From 848ea75382aa0d3b15a16ac3bb8e21f56faecbb6 Mon Sep 17 00:00:00 2001 From: shubhook Date: Tue, 20 Oct 2026 23:16:56 +0530 Subject: [PATCH 1/5] Narrow Settings to Usage, General, Allow list, and Updates. v0 only needs those four sections on web and mobile; hide model keys, password, notifications, and the rest while leaving Voice for the voice-removal thread. Co-authored-by: Cursor --- apps/mobile/app/(tabs)/account/index.tsx | 761 +++++++----------- apps/mobile/app/_layout.tsx | 1 + apps/mobile/app/allow-list.tsx | 142 ++++ apps/web/e2e/consequential-approval.spec.ts | 19 +- apps/web/e2e/current-models.spec.ts | 25 - apps/web/e2e/desktop-update.spec.ts | 3 +- apps/web/e2e/knowledge-panel.spec.ts | 60 -- apps/web/e2e/local-settings.spec.ts | 80 +- apps/web/e2e/model-picker-search.spec.ts | 76 -- apps/web/e2e/model-settings.spec.ts | 469 ----------- apps/web/e2e/settings-shell.spec.ts | 50 +- .../src/components/ApprovalRulesSettings.tsx | 5 +- .../src/pages/AccountSettingsOverlay.test.tsx | 144 +++- apps/web/src/pages/AccountSettingsOverlay.tsx | 427 +++++----- apps/web/src/pages/LocalSettings.tsx | 27 +- apps/web/src/pages/SettingsOverlay.test.tsx | 73 ++ apps/web/src/pages/SettingsOverlay.tsx | 120 +-- 17 files changed, 906 insertions(+), 1576 deletions(-) create mode 100644 apps/mobile/app/allow-list.tsx delete mode 100644 apps/web/e2e/current-models.spec.ts delete mode 100644 apps/web/e2e/model-picker-search.spec.ts delete mode 100644 apps/web/e2e/model-settings.spec.ts create mode 100644 apps/web/src/pages/SettingsOverlay.test.tsx diff --git a/apps/mobile/app/(tabs)/account/index.tsx b/apps/mobile/app/(tabs)/account/index.tsx index de967a00..1e4db0ec 100644 --- a/apps/mobile/app/(tabs)/account/index.tsx +++ b/apps/mobile/app/(tabs)/account/index.tsx @@ -1,31 +1,24 @@ -import type { AvatarStyle } from "@milo/contracts"; +import type { AvatarStyle, Connection, ConnectionCatalogItem } from "@milo/contracts"; +import { abortableDelay, buildFeaturedConnectorTiles } from "@milo/core"; import { useLocalSearchParams, useRouter } from "expo-router"; -import { useEffect, useState, useSyncExternalStore } from "react"; +import { useEffect, useRef, useState } from "react"; import { ActivityIndicator, Alert, - Button, - Platform, + Image, + Linking, Pressable, ScrollView, StyleSheet, - Switch, Text, - TextInput, View, } from "react-native"; import { SafeAreaView } from "react-native-safe-area-context"; +import { AgentLogo } from "../../../components/agent-logo"; import { useAvatarStyle } from "../../../components/avatar-style"; import { BotAvatar } from "../../../components/bot-avatar"; -import type { MobileBot, MobileMe } from "../../../lib/api"; -import { - currentApiBase, - deleteAccount, - loadSessionToken, - rpc, - selectedSpaceId, - signOut, -} from "../../../lib/api"; +import type { MobileMe, MobileModelCredential } from "../../../lib/api"; +import { rpc, signOut } from "../../../lib/api"; import { formatUpdateLabel, getAppVersionInfo } from "../../../lib/app-version"; import { getCachedAppearancePreference, @@ -33,62 +26,28 @@ import { setAppearancePreference, } from "../../../lib/appearance"; import { explicitSignInRoute } from "../../../lib/auth-routing"; -import { confirmDeleteBot } from "../../../lib/bot-lifecycle"; import { setUiLocale, useI18n } from "../../../lib/i18n"; -import type { LiveNotificationSettings } from "../../../lib/live-notifications"; -import { - canPostPromotedNotifications, - DEFAULT_LIVE_NOTIFICATION_SETTINGS, - getLiveNotificationSettings, - openLiveNotificationSettings, - openPromotedNotificationSettings, - setLiveNotificationSettings, -} from "../../../lib/live-notifications"; import { presentMessageActionSheet } from "../../../lib/message-action-sheet"; import { native, useResolvedAppearance, useThemedStyles } from "../../../lib/native"; -import { registerPushToken } from "../../../lib/push"; -import { - getCachedResponseStreamingEnabled, - setResponseStreamingPreference, - subscribeResponseStreaming, -} from "../../../lib/response-streaming"; import type { AccountUiLocale } from "../../../lib/ui-locale"; import { ACCOUNT_UI_LOCALES, UI_LOCALE_LABELS } from "../../../lib/ui-locale"; -/** Render account settings, including the entry point for voice configuration. */ +/** Settings is Usage, General, Allow list and Updates. Voice stays until thread C removes it. */ export default function Account() { const { t, locale } = useI18n(); const colorScheme = useResolvedAppearance(); const router = useRouter(); const { focus } = useLocalSearchParams<{ focus?: string }>(); const [me, setMe] = useState(null); - const [password, setPassword] = useState(""); + const [chatgpt, setChatgpt] = useState(false); const [localeSaving, setLocaleSaving] = useState(false); const [localeError, setLocaleError] = useState(null); const [pending, setPending] = useState(false); const [avatarPending, setAvatarPending] = useState(false); const [avatarError, setAvatarError] = useState(null); - const [notifications, setNotifications] = useState( - DEFAULT_LIVE_NOTIFICATION_SETTINGS, - ); - const [notificationsReady, setNotificationsReady] = useState(Platform.OS !== "android"); - const [notificationPending, setNotificationPending] = useState(false); - const [notificationError, setNotificationError] = useState(null); const [error, setError] = useState(null); - const [archivedBots, setArchivedBots] = useState([]); - const [usage, setUsage] = useState<{ - runs: number; - inputTokens: number; - outputTokens: number; - } | null>(null); const { avatarStyle, updateAvatarStyle } = useAvatarStyle(); const appearance = getCachedAppearancePreference(); - const streamReplies = useSyncExternalStore( - subscribeResponseStreaming, - getCachedResponseStreamingEnabled, - () => false, - ); - const [advancedOpen, setAdvancedOpen] = useState(false); const styles = useThemedStyles(createAccountStyles); const versionInfo = getAppVersionInfo(); const updateLabel = formatUpdateLabel(versionInfo.update, t); @@ -98,45 +57,14 @@ export default function Account() { void rpc("me") .then(setMe) .catch(() => undefined); - void rpc("bots/listArchived") - .then(setArchivedBots) - .catch(() => undefined); - void rpc<{ runs: number; inputTokens: number; outputTokens: number }>("usage/summary") - .then(setUsage) + void rpc("models/credentials") + .then((rows) => setChatgpt(rows.some((row) => row.provider === "chatgpt"))) .catch(() => undefined); - if (Platform.OS === "android") { - void getLiveNotificationSettings() - .then(setNotifications) - .catch(() => undefined) - .finally(() => setNotificationsReady(true)); - } }, []); - const usageBlock = ( - - {t("Usage")} - {usage ? ( - - {t("{runs} runs · {tokens} tokens", { - runs: usage.runs, - tokens: usage.inputTokens + usage.outputTokens, - })} - - ) : null} - - ); - - async function restoreBot(botId: string) { - try { - await rpc("bots/restore", { botId }); - setArchivedBots((bots) => bots.filter((bot) => bot.id !== botId)); - } catch (restoreError) { - Alert.alert( - t("Could not restore bot"), - restoreError instanceof Error ? restoreError.message : t("Try again."), - ); - } - } + useEffect(() => { + if (focus === "usage") router.push("/agent-models"); + }, [focus, router]); async function selectAvatarStyle(next: AvatarStyle) { if (next === avatarStyle) return; @@ -164,50 +92,6 @@ export default function Account() { } } - async function updateNotifications(next: LiveNotificationSettings) { - const previous = notifications; - setNotifications(next); - setNotificationPending(true); - setNotificationError(null); - try { - await setLiveNotificationSettings( - next, - currentApiBase(), - await loadSessionToken(), - selectedSpaceId() ?? "", - ); - if (next.liveConnection && !(await canPostPromotedNotifications())) { - await openPromotedNotificationSettings(); - } - await registerPushToken(); - } catch (cause) { - setNotifications(previous); - setNotificationError( - cause instanceof Error ? cause.message : t("Could not update notifications"), - ); - } finally { - setNotificationPending(false); - } - } - - function confirmDeletion() { - setError(null); - Alert.alert( - t("Delete your account?"), - t( - "This permanently deletes your account, bots, conversations, memories, files, and saved connections. This cannot be undone.", - ), - [ - { text: t("Cancel"), style: "cancel" }, - { - text: t("Delete account"), - style: "destructive", - onPress: () => void handleDeletion(), - }, - ], - ); - } - function applyLocale(code: AccountUiLocale) { if (code === locale || localeSaving) return; setLocaleSaving(true); @@ -233,43 +117,36 @@ export default function Account() { }); } - async function handleDeletion() { - setPending(true); - setError(null); - try { - await deleteAccount(password); - router.dismissAll(); - router.replace("/sign-in"); - } catch (err) { - setError(err instanceof Error ? err.message : t("Could not delete account")); - } finally { - setPending(false); - } - } - return ( - - ) : null} + -
- - - Advanced - - - -
-
- { - setStreamReplies(checked); - setResponseStreamingPreference(checked ? "on" : "off"); - }} - /> - -
-
- { - setShowToolActivity(checked); - setToolActivityPreference(checked ? "on" : "off"); - }} - /> - -
-
-
+
+ { + setShowToolActivity(checked); + setToolActivityPreference(checked ? "on" : "off"); + }} + /> + +
+ +
+ +
); } -export function UsageSettingsPanel({ - usage, - panelRef, - ownKeys = true, -}: { - usage?: { runs: number; inputTokens: number; outputTokens: number } | null; - panelRef?: RefObject; - /** Spend goes to the person's provider keys rather than an agent's plan. */ - ownKeys?: boolean; -}) { - // Nothing to say yet: keep only the focus target so the plan cards lead. - if (!usage && !ownKeys) { - return ( -
- ); +/** The featured catalog apps plus any other connected app, each with Connect or Disconnect. */ +function ConnectedAppsSection() { + const { t } = useLingui(); + const [catalog, setCatalog] = useState(null); + const [connections, setConnections] = useState([]); + const [pending, setPending] = useState(null); + const [error, setError] = useState(null); + const attempt = useRef(null); + + async function refresh() { + const [nextCatalog, nextConnections] = await Promise.all([ + rpc.connections.catalog({}), + rpc.connections.list(), + ]); + setCatalog(nextCatalog); + setConnections(nextConnections); } - return ( -
- {usage ? ( -

- - {usage.runs} runs · {usage.inputTokens + usage.outputTokens} tokens - -

- ) : null} - {ownKeys ? ( -

- Model spend uses your provider keys. -

- ) : null} -
- ); -} -export function ComputerSettingsPanel() { - return ( -
-

- Computers -

- -
- ); -} + useEffect(() => { + void refresh().catch(() => setCatalog([])); + return () => attempt.current?.abort(); + }, []); -export function UpdatesSettingsPanel({ - isDeploymentOwner = false, -}: { - isDeploymentOwner?: boolean; -}) { - return ( -
- - -
+ if (!catalog?.length) return null; + const featured = buildFeaturedConnectorTiles(catalog).flatMap((tile) => + tile.item ? [{ label: tile.label, item: tile.item }] : [], ); -} - -function ChangePasswordSection({ email }: { email?: string | null }) { - const { t } = useLingui(); - const [currentPassword, setCurrentPassword] = useState(""); - const [newPassword, setNewPassword] = useState(""); - const [confirmation, setConfirmation] = useState(""); - const [pending, setPending] = useState(false); - const [saved, setSaved] = useState(false); - const [error, setError] = useState(null); + const apps = [ + ...featured, + ...catalog + .filter((item) => item.connected && !featured.some((app) => app.item === item)) + .map((item) => ({ label: item.name, item })), + ]; - async function changePassword() { - if (pending) return; - if (newPassword !== confirmation) { - setError(t`Passwords do not match`); - return; + async function connect(label: string, item: ConnectionCatalogItem) { + attempt.current?.abort(); + const controller = new AbortController(); + attempt.current = controller; + setPending(item.slug); + setError(null); + try { + const outcome = await connectCatalogApp(item, label, controller.signal); + if (outcome === "pending") setError(t`Connection to ${label} is still pending.`); + await refresh(); + } catch (err) { + if (!controller.signal.aborted) { + setError(err instanceof Error ? err.message : t`Could not connect`); + } + } finally { + if (attempt.current === controller) { + attempt.current = null; + setPending(null); + } } - setPending(true); - setSaved(false); + } + + async function disconnect(item: ConnectionCatalogItem) { + setPending(item.slug); setError(null); try { - const result = await authClient.changePassword({ - currentPassword, - newPassword, - revokeOtherSessions: true, - }); - if (result.error) { - setError(result.error.message ?? t`Could not change password`); - return; + for (const row of appConnections(connections, item)) { + await rpc.connections.revoke({ connectionId: row.id }); } - setCurrentPassword(""); - setNewPassword(""); - setConfirmation(""); - setSaved(true); - } catch { - setError(t`Could not reach the server`); + await refresh(); + } catch (err) { + setError(err instanceof Error ? err.message : t`Could not revoke connection`); } finally { - setPending(false); + setPending(null); } } return ( -
+

- Password + Apps

-
- - - - -
+
    + {apps.map(({ label, item }) => ( +
  • + + {label} + {pending === item.slug ? ( + + Connecting… + + ) : item.connected ? ( + + ) : ( + + )} +
  • + ))} +
{error ? ( -

+

{error}

) : null} -
- - {saved ? : null} -
); } -function SettingsPasswordInput({ - label, - autoComplete, - value, - onChange, -}: { - label: string; - autoComplete: "current-password" | "new-password"; - value: string; - onChange: (value: string) => void; -}) { - const id = useId(); - return ( - - {label} - onChange(event.target.value)} - /> - +function appConnections(connections: Connection[], item: ConnectionCatalogItem) { + return connections.filter( + (row) => + row.connectorId === item.connectorId && + row.provider === item.slug && + (row.status === "connected" || row.status === "pending"), ); } +export function UpdatesSettingsPanel() { + return ; +} + function AppearancePicker({ value, onChange, diff --git a/apps/web/src/pages/LocalSettings.tsx b/apps/web/src/pages/LocalSettings.tsx index 75b20b8c..7a08bc93 100644 --- a/apps/web/src/pages/LocalSettings.tsx +++ b/apps/web/src/pages/LocalSettings.tsx @@ -3,19 +3,15 @@ import { Button } from "@milo/ui-web"; import { useEffect, useState } from "react"; import { IntegrationSetup } from "../components/integrations/IntegrationSetup"; import { rpc } from "../lib/rpc"; -import { ModelSettingsOverlay } from "./ModelSettingsOverlay"; export function LocalSettingsPage() { - const [section, setSection] = useState<"models" | "integrations" | null>(null); + const [integrations, setIntegrations] = useState(false); const [ready, setReady] = useState(false); - const [modelManaged, setModelManaged] = useState(false); const [error, setError] = useState(false); useEffect(() => { - void Promise.all([rpc.integrationSetup.get(), rpc.me()]) - .then(([, me]) => { - setModelManaged(me.modelManaged); - setReady(true); - }) + void rpc.integrationSetup + .get() + .then(() => setReady(true)) .catch(() => setError(true)); }, []); return ( @@ -35,22 +31,11 @@ export function LocalSettingsPage() { {ready ? ( <> - {section === "models" ? ( - setSection(null)} localOwner /> - ) : null} - {section === "integrations" ? : null} + {integrations ? : null} ) : null}
diff --git a/apps/web/src/pages/SettingsOverlay.test.tsx b/apps/web/src/pages/SettingsOverlay.test.tsx new file mode 100644 index 00000000..43ccd80a --- /dev/null +++ b/apps/web/src/pages/SettingsOverlay.test.tsx @@ -0,0 +1,73 @@ +// @vitest-environment jsdom + +import type { ReactNode } from "react"; +import { act } from "react"; +import { createRoot } from "react-dom/client"; +import { afterEach, expect, it, vi } from "vitest"; + +const bridge = vi.hoisted(() => ({ current: undefined as { update?: object } | undefined })); + +const lingui = vi.hoisted(() => { + const translate = (msg: { message?: string } | TemplateStringsArray) => + Array.isArray(msg) ? msg.join("") : String(msg?.message ?? ""); + return { useLingui: () => ({ t: translate, _: translate }) }; +}); +vi.mock("@lingui/react/macro", () => lingui); +vi.mock("@lingui/react", () => lingui); +vi.mock("@milo/ui-web", () => { + const Pass = ({ children }: { children?: ReactNode }) =>
{children}
; + return { + Button: () => null, + Dialog: Pass, + DialogClose: () => null, + DialogContent: Pass, + DialogTitle: Pass, + }; +}); +vi.mock("../components/ApprovalRulesSettings", () => ({ ApprovalRulesSettings: () => null })); +vi.mock("../lib/desktop", () => ({ desktopBridge: () => bridge.current })); +vi.mock("./AccountSettingsOverlay", () => ({ + GeneralSettingsPanels: () => null, + UpdatesSettingsPanel: () => null, +})); +vi.mock("./AgentModelsPanel", () => ({ AgentModelsPanel: () => null })); +vi.mock("./VoiceSettingsOverlay", () => ({ VoiceSettingsOverlay: () => null })); + +import { SettingsOverlay } from "./SettingsOverlay"; + +afterEach(() => { + bridge.current = undefined; + vi.unstubAllGlobals(); +}); + +async function navIds() { + vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true); + const container = document.createElement("div"); + document.body.append(container); + const root = createRoot(container); + await act(async () => { + root.render( + undefined} + onClose={() => undefined} + />, + ); + }); + const ids = [...container.querySelectorAll("[data-testid^='settings-nav-']")].map((node) => + node.getAttribute("data-testid")?.replace("settings-nav-", ""), + ); + await act(async () => root.unmount()); + container.remove(); + return ids.filter((id) => id !== "voice"); +} + +it("lists Usage, General, Allow list and Updates in the desktop app", async () => { + bridge.current = { update: {} }; + await expect(navIds()).resolves.toEqual(["usage", "general", "approvals", "updates"]); +}); + +it("leaves Updates out of a browser, which has nothing to update", async () => { + await expect(navIds()).resolves.toEqual(["usage", "general", "approvals"]); +}); diff --git a/apps/web/src/pages/SettingsOverlay.tsx b/apps/web/src/pages/SettingsOverlay.tsx index 7eb0b24f..50ecf1cf 100644 --- a/apps/web/src/pages/SettingsOverlay.tsx +++ b/apps/web/src/pages/SettingsOverlay.tsx @@ -1,41 +1,15 @@ import { useLingui } from "@lingui/react/macro"; import type { AvatarStyle } from "@milo/contracts"; import { Button, Dialog, DialogClose, DialogContent, DialogTitle } from "@milo/ui-web"; -import { - Bell, - Brain, - CloudDownload, - Gauge, - Monitor, - Settings, - ShieldCheck, - Volume2, - XIcon, -} from "lucide-react"; +import { CloudDownload, Gauge, Settings, ShieldCheck, Volume2, XIcon } from "lucide-react"; import { type ComponentType, useEffect, useRef, useState } from "react"; import { ApprovalRulesSettings } from "../components/ApprovalRulesSettings"; -import { computersAreUnavailable } from "../components/ComputersUnavailableHint"; -import { NotificationSettings } from "../components/NotificationSettings"; -import { - ComputerSettingsPanel, - GeneralSettingsPanels, - UpdatesSettingsPanel, - UsageSettingsPanel, -} from "./AccountSettingsOverlay"; +import { desktopBridge } from "../lib/desktop"; +import { GeneralSettingsPanels, UpdatesSettingsPanel } from "./AccountSettingsOverlay"; import { AgentModelsPanel } from "./AgentModelsPanel"; -import { SpaceMemorySection } from "./KnowledgeSection"; -import { ModelSettingsOverlay } from "./ModelSettingsOverlay"; import { VoiceSettingsOverlay } from "./VoiceSettingsOverlay"; -export type SettingsSection = - | "general" - | "usage" - | "approvals" - | "notifications" - | "memory" - | "voice" - | "computer" - | "updates"; +export type SettingsSection = "general" | "usage" | "approvals" | "voice" | "updates"; type NavItem = { id: SettingsSection; @@ -43,31 +17,28 @@ type NavItem = { icon: ComponentType<{ className?: string; strokeWidth?: number }>; }; +/** Settings is Usage, General, Allow list and Updates. */ export function SettingsOverlay({ email, name, - usage, - initialSection = "general", avatarStyle, onAvatarStyleChange, - isDeploymentOwner = false, - modelManaged = false, - sandboxProvider, + initialSection = "general", onClose, onVoiceStatusMaybeChanged, - onBotUpdated, }: { email?: string | null; name: string; - usage?: { runs: number; inputTokens: number; outputTokens: number } | null; - initialSection?: SettingsSection; avatarStyle: AvatarStyle; onAvatarStyleChange: (style: AvatarStyle) => Promise; + initialSection?: SettingsSection; + onClose: () => void; + onVoiceStatusMaybeChanged?: () => void | Promise; + // Still passed by the shell; nothing in v0 settings reads them. + usage?: { runs: number; inputTokens: number; outputTokens: number } | null; isDeploymentOwner?: boolean; modelManaged?: boolean; sandboxProvider?: string | null; - onClose: () => void; - onVoiceStatusMaybeChanged?: () => void | Promise; onBotUpdated?: () => void; }) { const { t } = useLingui(); @@ -75,7 +46,8 @@ export function SettingsOverlay({ const usageRef = useRef(null); const [section, setSection] = useState(initialSection); const [voiceBusy, setVoiceBusy] = useState(false); - const showComputer = isDeploymentOwner && computersAreUnavailable(sandboxProvider); + // The desktop app updates itself; a browser has nothing to update here. + const showUpdates = Boolean(desktopBridge()?.update); const panelBusy = voiceBusy; useEffect(() => { @@ -89,14 +61,11 @@ export function SettingsOverlay({ }, [section]); const navItems: NavItem[] = [ + { id: "usage", label: t`Usage`, icon: Gauge }, { id: "general", label: t`General`, icon: Settings }, - { id: "usage", label: t`Models`, icon: Gauge }, - { id: "approvals", label: t`Approvals`, icon: ShieldCheck }, - { id: "notifications", label: t`Notifications`, icon: Bell }, - { id: "memory", label: t`Memory`, icon: Brain }, + { id: "approvals", label: t`Allow list`, icon: ShieldCheck }, { id: "voice", label: t`Voice`, icon: Volume2 }, - ...(showComputer ? [{ id: "computer" as const, label: t`Computer`, icon: Monitor }] : []), - { id: "updates", label: t`Updates`, icon: CloudDownload }, + ...(showUpdates ? [{ id: "updates" as const, label: t`Updates`, icon: CloudDownload }] : []), ]; const sectionTitle = @@ -106,11 +75,9 @@ export function SettingsOverlay({ const closeLabel = section === "usage" ? t`Close usage settings` - : section === "memory" - ? t`Close memory settings` - : section === "voice" - ? t`Close voice settings` - : t`Close user settings`; + : section === "voice" + ? t`Close voice settings` + : t`Close user settings`; async function refreshVoiceStatus() { await onVoiceStatusMaybeChanged?.(); @@ -125,8 +92,7 @@ export function SettingsOverlay({ leaveSettings(onClose); } - const showModels = section === "usage" && !modelManaged; - const widePane = showModels || section === "voice"; + const widePane = section === "voice"; return ( - {section === "general" ? ( - - ) : null} - {section === "usage" && !showModels ? ( - <> - -
- -
- - ) : null} - {section === "approvals" ? : null} - {section === "notifications" ? ( - - ) : null} - {section === "computer" && showComputer ? : null} - {section === "updates" ? ( - - ) : null} - {showModels ? ( - <> -
- -
- - - ) : null} - {section === "memory" ? ( -
- + /> : null} + {section === "usage" ? ( +
+
) : null} + {section === "approvals" ? : null} + {section === "updates" && showUpdates ? : null} {section === "voice" ? ( ) : null} From 8fcf6978fbc8939abfa9632c76a1bd9c5e3fed25 Mon Sep 17 00:00:00 2001 From: shubhook Date: Tue, 20 Oct 2026 23:19:44 +0530 Subject: [PATCH 2/5] Fix Settings A2 format and lingui test typing. Biome rejected several Settings files, and the SettingsOverlay lingui mock needed a narrowed message descriptor type for tsc. Co-authored-by: Cursor --- apps/mobile/app/(tabs)/account/index.tsx | 6 +----- apps/web/e2e/knowledge-panel.spec.ts | 8 +------- apps/web/e2e/settings-shell.spec.ts | 4 +--- apps/web/src/pages/AccountSettingsOverlay.test.tsx | 9 ++------- apps/web/src/pages/SettingsOverlay.test.tsx | 8 ++++++-- apps/web/src/pages/SettingsOverlay.tsx | 6 ++++-- 6 files changed, 15 insertions(+), 26 deletions(-) diff --git a/apps/mobile/app/(tabs)/account/index.tsx b/apps/mobile/app/(tabs)/account/index.tsx index 1e4db0ec..130730e3 100644 --- a/apps/mobile/app/(tabs)/account/index.tsx +++ b/apps/mobile/app/(tabs)/account/index.tsx @@ -121,11 +121,7 @@ export default function Account() { - router.push("/agent-models")} - styles={styles} - /> + router.push("/agent-models")} styles={styles} /> router.push("/allow-list")} diff --git a/apps/web/e2e/knowledge-panel.spec.ts b/apps/web/e2e/knowledge-panel.spec.ts index 2e82504e..536e520a 100644 --- a/apps/web/e2e/knowledge-panel.spec.ts +++ b/apps/web/e2e/knowledge-panel.spec.ts @@ -1,12 +1,6 @@ import type { MemoryDocument } from "@milo/contracts"; import { expect, test } from "@playwright/test"; -import { - activeBotId, - captureScreenshot, - completeOnboarding, - rpc, - signup, -} from "./helpers"; +import { activeBotId, captureScreenshot, completeOnboarding, rpc, signup } from "./helpers"; test("memory and skills are readable and editable in the app", async ({ page }, testInfo) => { const stamp = Date.now(); diff --git a/apps/web/e2e/settings-shell.spec.ts b/apps/web/e2e/settings-shell.spec.ts index 17e7db0c..a8361e22 100644 --- a/apps/web/e2e/settings-shell.spec.ts +++ b/apps/web/e2e/settings-shell.spec.ts @@ -1,9 +1,7 @@ import { expect, test } from "@playwright/test"; import { captureScreenshot, completeOnboarding, openUserSettings, signup } from "./helpers"; -test("settings shell is Usage, General and Allow list in a browser", async ({ - page, -}, testInfo) => { +test("settings shell is Usage, General and Allow list in a browser", async ({ page }, testInfo) => { const stamp = Date.now(); const userName = `Settings shell ${stamp}`; await signup(page, `settings-shell-${stamp}@rakazo.test`, "password12", userName); diff --git a/apps/web/src/pages/AccountSettingsOverlay.test.tsx b/apps/web/src/pages/AccountSettingsOverlay.test.tsx index f9085108..a62e8a2b 100644 --- a/apps/web/src/pages/AccountSettingsOverlay.test.tsx +++ b/apps/web/src/pages/AccountSettingsOverlay.test.tsx @@ -18,13 +18,8 @@ const lingui = vi.hoisted(() => { }; return { useLingui: () => ({ t: translate, _: translate }), - Trans: ({ - children, - message, - }: { - children?: ReactNode; - message?: string; - }) => children ?? message ?? null, + Trans: ({ children, message }: { children?: ReactNode; message?: string }) => + children ?? message ?? null, }; }); vi.mock("@lingui/react/macro", () => lingui); diff --git a/apps/web/src/pages/SettingsOverlay.test.tsx b/apps/web/src/pages/SettingsOverlay.test.tsx index 43ccd80a..84bbef01 100644 --- a/apps/web/src/pages/SettingsOverlay.test.tsx +++ b/apps/web/src/pages/SettingsOverlay.test.tsx @@ -8,8 +8,12 @@ import { afterEach, expect, it, vi } from "vitest"; const bridge = vi.hoisted(() => ({ current: undefined as { update?: object } | undefined })); const lingui = vi.hoisted(() => { - const translate = (msg: { message?: string } | TemplateStringsArray) => - Array.isArray(msg) ? msg.join("") : String(msg?.message ?? ""); + const translate = (msg: { message?: string } | TemplateStringsArray) => { + if (typeof msg === "object" && msg !== null && "message" in msg) { + return String(msg.message ?? ""); + } + return Array.from(msg as TemplateStringsArray).join(""); + }; return { useLingui: () => ({ t: translate, _: translate }) }; }); vi.mock("@lingui/react/macro", () => lingui); diff --git a/apps/web/src/pages/SettingsOverlay.tsx b/apps/web/src/pages/SettingsOverlay.tsx index 50ecf1cf..82b55222 100644 --- a/apps/web/src/pages/SettingsOverlay.tsx +++ b/apps/web/src/pages/SettingsOverlay.tsx @@ -171,12 +171,14 @@ export function SettingsOverlay({ : "rk-scroll overflow-y-auto overscroll-contain px-6 pb-6 pt-5 sm:px-8 sm:pb-8" }`} > - {section === "general" ? : null} + /> + ) : null} {section === "usage" ? (
Date: Tue, 20 Oct 2026 23:25:46 +0530 Subject: [PATCH 3/5] Add mobile locale strings for the four Settings sections. The chrome coverage test requires zh/ru/de entries for Allow list and the related General labels introduced in A2. Co-authored-by: Cursor --- apps/mobile/lib/locales/de.ts | 11 +++++++++++ apps/mobile/lib/locales/ru.ts | 11 +++++++++++ apps/mobile/lib/locales/zh.ts | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/apps/mobile/lib/locales/de.ts b/apps/mobile/lib/locales/de.ts index e2814ef3..7dc2929c 100644 --- a/apps/mobile/lib/locales/de.ts +++ b/apps/mobile/lib/locales/de.ts @@ -670,4 +670,15 @@ export const DE_MESSAGES: Record = { 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", }; diff --git a/apps/mobile/lib/locales/ru.ts b/apps/mobile/lib/locales/ru.ts index 47152591..aba024d8 100644 --- a/apps/mobile/lib/locales/ru.ts +++ b/apps/mobile/lib/locales/ru.ts @@ -672,4 +672,15 @@ export const RU_MESSAGES: Record = { 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: "Обновления", }; diff --git a/apps/mobile/lib/locales/zh.ts b/apps/mobile/lib/locales/zh.ts index 03dab2cb..2f94de30 100644 --- a/apps/mobile/lib/locales/zh.ts +++ b/apps/mobile/lib/locales/zh.ts @@ -652,4 +652,15 @@ export const ZH_MESSAGES: Record = { 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: "更新", }; From 31d1a039cec7129d136674ad9790765fefc37bf0 Mon Sep 17 00:00:00 2001 From: shubhook Date: Tue, 20 Oct 2026 23:43:53 +0530 Subject: [PATCH 4/5] Fix Settings E2E fallout from the four-section shell. Drop useNavigate so fixture mounts of Settings stay router-free, keep Usage visible while models load, and update specs that still expected password, Stream replies, Advanced, or a Server integrations link. Co-authored-by: Cursor --- apps/web/e2e/auth-lifecycle.spec.ts | 34 +++---------------- apps/web/e2e/integration-setup.spec.ts | 18 ++++++---- apps/web/e2e/response-streaming.spec.ts | 23 +++---------- apps/web/e2e/tool-activity.spec.ts | 3 -- .../src/pages/AccountSettingsOverlay.test.tsx | 1 - apps/web/src/pages/AccountSettingsOverlay.tsx | 4 +-- apps/web/src/pages/AgentModelsPanel.tsx | 8 ++++- 7 files changed, 29 insertions(+), 62 deletions(-) diff --git a/apps/web/e2e/auth-lifecycle.spec.ts b/apps/web/e2e/auth-lifecycle.spec.ts index 437a4c37..26f2dd7b 100644 --- a/apps/web/e2e/auth-lifecycle.spec.ts +++ b/apps/web/e2e/auth-lifecycle.spec.ts @@ -143,11 +143,10 @@ 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"; @@ -155,37 +154,12 @@ test("changes and recovers an email password", async ({ page }, testInfo) => { 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(); diff --git a/apps/web/e2e/integration-setup.spec.ts b/apps/web/e2e/integration-setup.spec.ts index baf2088f..30c6936e 100644 --- a/apps/web/e2e/integration-setup.spec.ts +++ b/apps/web/e2e/integration-setup.spec.ts @@ -2,6 +2,7 @@ import { expect, test } from "@playwright/test"; import { captureScreenshot, completeOnboarding, + openUserSettings, reachMeetStep, sayHiToFirstBot, signup, @@ -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"); diff --git a/apps/web/e2e/response-streaming.spec.ts b/apps/web/e2e/response-streaming.spec.ts index 427a8b97..c0b3a634 100644 --- a/apps/web/e2e/response-streaming.spec.ts +++ b/apps/web/e2e/response-streaming.spec.ts @@ -59,27 +59,14 @@ async function capture( await writeShot(testInfo, name, screenshotPath); } -test("settings overlay keeps Stream replies inside Advanced", async ({ page }, testInfo) => { +test("settings overlay no longer exposes Stream replies", async ({ page }, testInfo) => { await page.setViewportSize({ width: 1440, height: 900 }); await openFixture(page, { view: "settings", stream: "off" }); const settings = page.getByTestId("user-settings"); - await expect(settings.getByRole("heading", { name: "Replies", exact: true })).toHaveCount(0); - await expect(settings.getByTestId("response-streaming-toggle")).toBeHidden(); - await settings.getByTestId("advanced-settings").locator("summary").click(); - const streamReplies = settings.getByTestId("response-streaming-toggle"); - await expect(streamReplies).toBeVisible(); - await expect(streamReplies).not.toBeChecked(); - await expect(settings.getByText("Stream replies", { exact: true })).toBeVisible(); - await streamReplies.scrollIntoViewIfNeeded(); - await capture(page, testInfo, "settings-stream-off"); - - await openFixture(page, { view: "settings", stream: "on" }); - const settingsOn = page.getByTestId("user-settings"); - await settingsOn.getByTestId("advanced-settings").locator("summary").click(); - const onToggle = settingsOn.getByTestId("response-streaming-toggle"); - await expect(onToggle).toBeVisible(); - await expect(onToggle).toBeChecked(); - await capture(page, testInfo, "settings-stream-on"); + await expect(settings.getByTestId("advanced-settings")).toHaveCount(0); + await expect(settings.getByTestId("response-streaming-toggle")).toHaveCount(0); + await expect(settings.getByText("Stream replies", { exact: true })).toHaveCount(0); + await capture(page, testInfo, "settings-stream-removed"); }); test("thread reducer hides live tokens when Stream replies is off", async ({ page }, testInfo) => { diff --git a/apps/web/e2e/tool-activity.spec.ts b/apps/web/e2e/tool-activity.spec.ts index 9615e4ff..64825f76 100644 --- a/apps/web/e2e/tool-activity.spec.ts +++ b/apps/web/e2e/tool-activity.spec.ts @@ -27,7 +27,6 @@ async function setToggle(page: Page, on: boolean) { await page.goto(`${fixture}?view=settings`); const settings = page.getByTestId("user-settings"); await expect(settings).toBeVisible(); - await settings.getByTestId("advanced-settings").locator("summary").click(); const toggle = settings.getByTestId("tool-activity-toggle"); await expect(toggle).toBeVisible(); await expect(settings.getByText("Show tool activity", { exact: true })).toBeVisible(); @@ -90,7 +89,6 @@ test("the settings toggle hides and restores tool activity", async ({ page }, te await page.goto(`${fixture}?view=settings`); const settings = page.getByTestId("user-settings"); await expect(settings).toBeVisible(); - await settings.getByTestId("advanced-settings").locator("summary").click(); const initialToggle = settings.getByTestId("tool-activity-toggle"); await expect(initialToggle).toBeVisible(); await expect(initialToggle).not.toBeChecked(); @@ -151,7 +149,6 @@ test("the chat transcript shows tool activity when turned on and hides it when t await captureScreenshot(page, testInfo, "shell-tool-activity-on"); const settings = await openUserSettings(page); - await settings.getByTestId("advanced-settings").locator("summary").click(); const toggle = settings.getByTestId("tool-activity-toggle"); await expect(toggle).toBeChecked(); await toggle.click(); diff --git a/apps/web/src/pages/AccountSettingsOverlay.test.tsx b/apps/web/src/pages/AccountSettingsOverlay.test.tsx index a62e8a2b..e561fd9e 100644 --- a/apps/web/src/pages/AccountSettingsOverlay.test.tsx +++ b/apps/web/src/pages/AccountSettingsOverlay.test.tsx @@ -97,7 +97,6 @@ vi.mock("../lib/ui-appearance", () => ({ getUiAppearancePreference: () => "system", setUiAppearance: vi.fn(), })); -vi.mock("react-router-dom", () => ({ useNavigate: () => vi.fn() })); import { TOOL_ACTIVITY_STORAGE_KEY } from "../lib/tool-activity-preference"; import { GeneralSettingsPanels } from "./AccountSettingsOverlay"; diff --git a/apps/web/src/pages/AccountSettingsOverlay.tsx b/apps/web/src/pages/AccountSettingsOverlay.tsx index 4a4e783f..e32f6bdc 100644 --- a/apps/web/src/pages/AccountSettingsOverlay.tsx +++ b/apps/web/src/pages/AccountSettingsOverlay.tsx @@ -5,7 +5,6 @@ import { BotAvatar, Button, Label, Switch, Toggle } from "@milo/ui-web"; import { ChevronDown } from "lucide-react"; import type { KeyboardEvent as ReactKeyboardEvent } from "react"; import { useEffect, useId, useRef, useState } from "react"; -import { useNavigate } from "react-router-dom"; import { AgentLogo } from "../components/AgentLogo"; import { Shimmer } from "../components/ai/primitives"; import { DesktopUpdateSection } from "../components/DesktopUpdates"; @@ -36,7 +35,6 @@ export function GeneralSettingsPanels({ onAvatarStyleChange, }: SettingsGeneralProps) { const { t } = useLingui(); - const navigate = useNavigate(); const [locale, setLocale] = useState(() => getActiveUiLocale()); const localeRequestRef = useRef(0); const [appearance, setAppearance] = useState(() => @@ -188,7 +186,7 @@ export function GeneralSettingsPanels({ onClick={() => void authClient.signOut().then(() => { clearSpaceSelection(); - navigate("/"); + window.location.assign("/"); }) } > diff --git a/apps/web/src/pages/AgentModelsPanel.tsx b/apps/web/src/pages/AgentModelsPanel.tsx index 9adc1ce8..00e6ed69 100644 --- a/apps/web/src/pages/AgentModelsPanel.tsx +++ b/apps/web/src/pages/AgentModelsPanel.tsx @@ -40,7 +40,13 @@ export function AgentModelsPanel() {

); } - if (!models) return null; + if (!models) { + return ( +

+ Loading… +

+ ); + } return (
    {models.map((model) => { From 895afe64cfc4ee907b23d095bee00710e79612e8 Mon Sep 17 00:00:00 2001 From: shubhook Date: Wed, 21 Oct 2026 00:00:43 +0530 Subject: [PATCH 5/5] Keep the Usage settings panel visible with no plan meters. An empty AgentModelsPanel collapsed to zero height, so Playwright treated usage-settings as hidden on fresh accounts. Co-authored-by: Cursor --- apps/web/e2e/settings-shell.spec.ts | 13 +++++++++++++ apps/web/src/pages/AgentModelsPanel.tsx | 9 ++++++++- apps/web/src/pages/SettingsOverlay.tsx | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/apps/web/e2e/settings-shell.spec.ts b/apps/web/e2e/settings-shell.spec.ts index a8361e22..6b7990eb 100644 --- a/apps/web/e2e/settings-shell.spec.ts +++ b/apps/web/e2e/settings-shell.spec.ts @@ -40,6 +40,13 @@ test("settings shell is Usage, General and Allow list in a browser", async ({ pa await expect(settings).toHaveAttribute("data-settings-section", "usage"); await expect(settings.getByRole("heading", { name: "Usage", exact: true })).toBeVisible(); await expect(settings.getByTestId("usage-settings")).toBeVisible(); + // Fresh accounts may have no plan meters yet; the panel still renders a body. + await expect( + settings + .getByTestId("agent-models") + .or(settings.getByTestId("agent-models-loading")) + .or(settings.getByRole("alert")), + ).toBeVisible(); await expect(settings.getByTestId("model-settings")).toHaveCount(0); await expect(settings.getByText("Model spend uses your provider keys.")).toHaveCount(0); await captureScreenshot(page, testInfo, "settings-shell-usage"); @@ -61,6 +68,12 @@ test("settings shell is Usage, General and Allow list in a browser", async ({ pa await openUserSettings(page, "usage"); await expect(page.getByTestId("user-settings")).toHaveAttribute("data-settings-section", "usage"); await expect(page.getByTestId("usage-settings")).toBeVisible(); + await expect( + page + .getByTestId("agent-models") + .or(page.getByTestId("agent-models-loading")) + .or(page.getByRole("alert")), + ).toBeVisible(); }); test("usage lists the agent's models with their plan limits", async ({ page }, testInfo) => { diff --git a/apps/web/src/pages/AgentModelsPanel.tsx b/apps/web/src/pages/AgentModelsPanel.tsx index 00e6ed69..5f64dafa 100644 --- a/apps/web/src/pages/AgentModelsPanel.tsx +++ b/apps/web/src/pages/AgentModelsPanel.tsx @@ -42,11 +42,18 @@ export function AgentModelsPanel() { } if (!models) { return ( -

    +

    Loading…

    ); } + if (models.length === 0) { + return ( +

    + Limits show after the next run. +

    + ); + } return (
      {models.map((model) => { diff --git a/apps/web/src/pages/SettingsOverlay.tsx b/apps/web/src/pages/SettingsOverlay.tsx index 82b55222..3fc380a6 100644 --- a/apps/web/src/pages/SettingsOverlay.tsx +++ b/apps/web/src/pages/SettingsOverlay.tsx @@ -184,7 +184,7 @@ export function SettingsOverlay({ ref={usageRef} tabIndex={-1} data-testid="usage-settings" - className="outline-none" + className="min-h-8 outline-none" >