Skip to content
This repository was archived by the owner on Oct 27, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
757 changes: 294 additions & 463 deletions apps/mobile/app/(tabs)/account/index.tsx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/mobile/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export default function Layout() {
/>
<Stack.Screen name="models" options={{ title: t("Models") }} />
<Stack.Screen name="agent-models" options={{ title: t("Usage") }} />
<Stack.Screen name="allow-list" options={{ title: t("Allow list") }} />
<Stack.Screen name="voice" options={{ title: t("Voice") }} />
<Stack.Screen name="integrations" options={{ title: t("Integrations") }} />
<Stack.Screen
Expand Down
142 changes: 142 additions & 0 deletions apps/mobile/app/allow-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import type { ActionApprovalRule } from "@milo/contracts";
import { Stack } from "expo-router";
import { useEffect, useState } from "react";
import { Pressable, ScrollView, StyleSheet, Text, View } from "react-native";
import { rpc } from "../lib/api";
import { mobileTokens } from "../lib/appearance";
import { useI18n } from "../lib/i18n";
import { native, useThemedStyles } from "../lib/native";

type Category = "email" | "purchase";
type Level = "act" | "ask";

function categoryRules(rules: ActionApprovalRule[], category: Category) {
return rules.filter(
(rule) =>
(rule.effect === "require_approval" || rule.effect === "hand_off") &&
rule.matchKind === "category" &&
rule.matchValue === category,
);
}

/** Space-wide levels per category: bots act by default, or ask first. */
export default function AllowList() {
const styles = useThemedStyles(createStyles);
const { t } = useI18n();
const [rules, setRules] = useState<ActionApprovalRule[] | null>(null);
const [saving, setSaving] = useState<Category | null>(null);
const [error, setError] = useState<string | null>(null);

useEffect(() => {
void rpc<ActionApprovalRule[]>("approvalRules/list")
.then(setRules)
.catch(() => setError(t("Could not load approval rules")));
}, [t]);

async function setLevel(category: Category, level: Level) {
if (!rules || saving) return;
const current = categoryRules(rules, category);
if ((current.length > 0 ? "ask" : "act") === level) return;
setSaving(category);
setError(null);
try {
await Promise.all(current.map((rule) => rpc("approvalRules/remove", { id: rule.id })));
const saved =
level === "ask"
? await rpc<ActionApprovalRule>("approvalRules/set", {
effect: "require_approval",
matchKind: "category",
matchValue: category,
})
: null;
setRules((previous) => [
...(previous ?? []).filter((rule) => !current.includes(rule)),
...(saved ? [saved] : []),
]);
} catch (cause) {
setError(cause instanceof Error ? cause.message : t("Could not save rule"));
} finally {
setSaving(null);
}
}

const categories: { id: Category; label: string }[] = [
{ id: "email", label: t("Email") },
{ id: "purchase", label: t("Purchases") },
];
const levels: { id: Level; label: string }[] = [
{ id: "act", label: t("Act") },
{ id: "ask", label: t("Ask first") },
];

return (
<ScrollView style={styles.screen} contentContainerStyle={styles.content}>
<Stack.Screen options={{ title: t("Allow list") }} />
<View style={styles.group}>
{categories.map((category) => {
const current = rules && categoryRules(rules, category.id).length > 0 ? "ask" : "act";
return (
<View key={category.id} accessibilityLabel={category.label} style={styles.row}>
<Text style={styles.label}>{category.label}</Text>
<View style={styles.options}>
{levels.map((level) => {
const selected = rules !== null && current === level.id;
return (
<Pressable
key={level.id}
accessibilityRole="button"
accessibilityLabel={`${category.label}: ${level.label}`}
accessibilityState={{ selected, disabled: saving !== null }}
disabled={!rules || saving !== null}
onPress={() => void setLevel(category.id, level.id)}
style={({ pressed }) => [
styles.option,
selected && styles.optionSelected,
pressed && styles.pressed,
]}
>
<Text style={styles.optionLabel}>{level.label}</Text>
</Pressable>
);
})}
</View>
</View>
);
})}
</View>
{error ? <Text style={styles.error}>{error}</Text> : null}
</ScrollView>
);
}

function createStyles() {
const tokens = mobileTokens();
return StyleSheet.create({
screen: { flex: 1, backgroundColor: native.page },
content: { padding: 20, gap: 12 },
group: { borderRadius: 16, backgroundColor: native.fill, paddingHorizontal: 18 },
row: {
minHeight: 62,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
gap: 12,
paddingVertical: 10,
},
label: { flex: 1, color: native.label, fontSize: 17, fontWeight: "600" },
options: { flexDirection: "row", gap: 6 },
option: {
minHeight: 36,
borderRadius: 10,
borderWidth: StyleSheet.hairlineWidth,
borderColor: native.tertiaryLabel,
paddingHorizontal: 12,
alignItems: "center",
justifyContent: "center",
},
optionSelected: { borderColor: native.label, backgroundColor: native.fillPressed },
optionLabel: { color: native.label, fontSize: 14, fontWeight: "600" },
error: { color: tokens.destructive, fontSize: 14 },
pressed: { opacity: 0.7 },
});
}
11 changes: 11 additions & 0 deletions apps/mobile/lib/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,4 +670,15 @@ export const DE_MESSAGES: Record<string, string> = {
Weekly: "Wöchentlich",
"{days}-day": "{days} Tage",
"{hours}-hour": "{hours} Stunden",
// Settings: Usage / General / Allow list / Updates
Act: "Handeln",
"Allow list": "Freigabeliste",
Apps: "Apps",
"Ask first": "Erst fragen",
ChatGPT: "ChatGPT",
"Could not load approval rules": "Bestätigungsregeln konnten nicht geladen werden",
"Could not save rule": "Regel konnte nicht gespeichert werden",
General: "Allgemein",
Purchases: "Käufe",
Updates: "Updates",
};
11 changes: 11 additions & 0 deletions apps/mobile/lib/locales/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,4 +672,15 @@ export const RU_MESSAGES: Record<string, string> = {
Weekly: "Неделя",
"{days}-day": "{days} дн.",
"{hours}-hour": "{hours} ч",
// Settings: Usage / General / Allow list / Updates
Act: "Действовать",
"Allow list": "Список разрешений",
Apps: "Приложения",
"Ask first": "Сначала спросить",
ChatGPT: "ChatGPT",
"Could not load approval rules": "Не удалось загрузить правила одобрения.",
"Could not save rule": "Не удалось сохранить правило.",
General: "Общие",
Purchases: "Покупки",
Updates: "Обновления",
};
11 changes: 11 additions & 0 deletions apps/mobile/lib/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,4 +652,15 @@ export const ZH_MESSAGES: Record<string, string> = {
Weekly: "每周",
"{days}-day": "{days} 天",
"{hours}-hour": "{hours} 小时",
// Settings: Usage / General / Allow list / Updates
Act: "直接执行",
"Allow list": "允许列表",
Apps: "应用",
"Ask first": "先询问",
ChatGPT: "ChatGPT",
"Could not load approval rules": "无法加载审批规则",
"Could not save rule": "无法保存规则",
General: "通用",
Purchases: "购买",
Updates: "更新",
};
34 changes: 4 additions & 30 deletions apps/web/e2e/auth-lifecycle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,49 +143,23 @@ test("logout protects bot deep links and sign-in restores the session", async ({
await expect(page.getByTestId("transcript").getByText(message, { exact: true })).toBeVisible();
});

test("changes and recovers an email password", async ({ page }, testInfo) => {
test("recovers an email password from the sign-in screen", async ({ page }, testInfo) => {
const stamp = Date.now();
const email = `password-recovery-${stamp}@rakazo.test`;
const originalPassword = "password12";
const changedPassword = "changed-password12";
const resetPassword = "reset-password12";
const userName = "Password Recovery";

await signup(page, email, originalPassword, userName);
await completeOnboarding(page);
await page.waitForURL(/\/app\/[^/]+$/);

// v0 Settings dropped the change-password form; recovery still starts from sign-in.
await page.getByTestId("sidebar-settings").click();
const settings = page.getByTestId("user-settings");
await expect(settings).toBeVisible();
await expect(page.getByTestId("sidebar-search").locator("input")).toHaveAttribute(
"autocomplete",
"off",
);
await expect(page.getByTestId("sidebar-search").locator("input")).toHaveAttribute(
"name",
"sidebar-search",
);
await expect(settings.locator('input[name="username"]')).toHaveAttribute(
"autocomplete",
"username",
);
await expect(settings.locator('input[name="username"]')).toHaveValue(email);
await expect(settings.getByLabel("Current password")).toHaveAttribute(
"autocomplete",
"current-password",
);
await expect(settings.getByLabel("New password")).toHaveAttribute("autocomplete", "new-password");
await expect(settings.getByLabel("Confirm password")).toHaveAttribute(
"autocomplete",
"new-password",
);
await settings.getByLabel("Current password").fill(originalPassword);
await settings.getByLabel("New password").fill(changedPassword);
await settings.getByLabel("Confirm password").fill(changedPassword);
await settings.getByRole("button", { name: "Change password" }).click();
await expect(settings.getByText("Password updated")).toBeVisible();
await captureScreenshot(page, testInfo, "41-password-changed");
await expect(settings.getByLabel("Current password")).toHaveCount(0);
await expect(settings.getByRole("button", { name: "Change password" })).toHaveCount(0);
await settings.getByRole("button", { name: "Close user settings" }).click();

await page.getByRole("button", { name: new RegExp(userName, "i") }).click();
Expand Down
19 changes: 9 additions & 10 deletions apps/web/e2e/consequential-approval.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
signup,
} from "./helpers";

test("actions run by default while optional confirmations live in Settings > Approvals", async ({
test("actions run by default while optional confirmations live in Settings > Allow list", async ({
page,
}, testInfo) => {
const stamp = Date.now();
Expand All @@ -28,12 +28,14 @@ test("actions run by default while optional confirmations live in Settings > App

const settings = await openUserSettings(page, "approvals");
await expect(settings).toHaveAttribute("role", "dialog");
await expect(settings.getByRole("heading", { name: "Approvals", exact: true })).toBeVisible();
await expect(settings.getByRole("heading", { name: "Allow list", exact: true })).toBeVisible();
const email = settings.getByRole("group", { name: "Email" });
await expect(email.getByRole("button", { name: "Act", exact: true })).toHaveAttribute(
"aria-pressed",
"true",
);
// v0 offers two levels; Hand to me shows only for a category already set to it.
await expect(email.getByRole("button", { name: "Hand to me", exact: true })).toHaveCount(0);
await expect(settings.getByTestId("auto-review-toggle")).toBeVisible();
await expect(settings.getByTestId("auto-review-toggle")).not.toBeChecked();
await expect(settings.getByText("Flag unexpected actions")).toBeVisible();
Expand Down Expand Up @@ -110,20 +112,17 @@ test("Hand to me never asks: the action is handed back to the person", async ({
await signup(page, `hand-to-me-${Date.now()}@rakazo.test`, "password12", "Hand To Me");
await completeOnboarding(page);

await rpc(page, "approvalRules/set", {
effect: "hand_off",
matchKind: "category",
matchValue: "email",
});
const settings = await openUserSettings(page, "approvals");
const email = settings.getByRole("group", { name: "Email" });
await email.getByRole("button", { name: "Hand to me", exact: true }).click();
await expect(email.getByRole("button", { name: "Hand to me", exact: true })).toHaveAttribute(
"aria-pressed",
"true",
);
await expect
.poll(async () =>
(await rpc<{ matchValue: string; effect: string }[]>(page, "approvalRules/list", undefined))
.filter((rule) => rule.matchValue === "email")
.map((rule) => rule.effect),
)
.toEqual(["hand_off"]);
await captureScreenshot(page, testInfo, "57-settings-approvals-hand-to-me");
await settings.getByRole("button", { name: "Close user settings" }).click();

Expand Down
25 changes: 0 additions & 25 deletions apps/web/e2e/current-models.spec.ts

This file was deleted.

3 changes: 2 additions & 1 deletion apps/web/e2e/desktop-update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ test("desktop update can be checked, deferred, and installed from settings", asy
test("ordinary web sessions do not show desktop update controls", async ({ page }) => {
await signup(page, `web-update-${Date.now()}@rakazo.test`, "password12", "Web Tester");
await completeOnboarding(page);
await openUserSettings(page, "updates");
const settings = await openUserSettings(page);
await expect(settings.getByTestId("settings-nav-updates")).toHaveCount(0);
await expect(page.getByTestId("desktop-update-settings")).toHaveCount(0);
await expect(page.getByRole("complementary", { name: "Desktop update" })).toHaveCount(0);
});
18 changes: 12 additions & 6 deletions apps/web/e2e/integration-setup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect, test } from "@playwright/test";
import {
captureScreenshot,
completeOnboarding,
openUserSettings,
reachMeetStep,
sayHiToFirstBot,
signup,
Expand Down Expand Up @@ -253,13 +254,18 @@ test("configured server owners manage providers from settings", async ({ page },
await signup(page, `configured-owner-${Date.now()}@rakazo.test`, "password12", "Server Owner");
await expect(page.getByRole("heading", { name: "Server integrations" })).toBeHidden();
await completeOnboarding(page);
await page.getByTestId("sidebar-settings").click();
const settings = page.getByTestId("user-settings");
const link = settings.getByRole("link", { name: "Server integrations", exact: true });
await expect(link).toBeVisible();
await captureScreenshot(page, testInfo, "server-integrations-settings");
await link.click();
// v0 Settings no longer links here; owners still open the setup page directly.
const settings = await openUserSettings(page);
await expect(
settings.getByRole("link", { name: "Server integrations", exact: true }),
).toHaveCount(0);
await expect(
settings.getByRole("button", { name: "Server integrations", exact: true }),
).toHaveCount(0);
await page.keyboard.press("Escape");
await page.goto("/integrations/setup");
await expect(page.getByRole("heading", { name: "Server integrations" })).toBeVisible();
await captureScreenshot(page, testInfo, "server-integrations-settings");
await page.getByRole("button", { name: "Composio", exact: true }).click();
await expect(page.getByText("Connected", { exact: true })).toBeVisible();
await captureScreenshot(page, testInfo, "server-integrations-configured");
Expand Down
Loading
Loading