diff --git a/apps/mobile/app/(tabs)/account/index.tsx b/apps/mobile/app/(tabs)/account/index.tsx
index de967a00..130730e3 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,32 @@ 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 (
-
+
+ );
+}
- router.push("/integrations")}
- style={({ pressed }) => [styles.settingsButton, pressed && styles.pressed]}
- >
- {t("Integrations")}
- ›
-
+function NavRow({
+ label,
+ onPress,
+ styles,
+}: {
+ label: string;
+ onPress: () => void;
+ styles: ReturnType;
+}) {
+ return (
+ [styles.navRow, pressed && styles.pressed]}
+ >
+ {label}
+ ›
+
+ );
+}
- {me?.isDeploymentOwner ? (
- router.push("/integration-setup")}
- style={styles.settingsButton}
- >
- {t("Server integrations")}
-
- ) : null}
+function ConnectedAppsSection({ styles }: { styles: ReturnType }) {
+ const { t } = useI18n();
+ const [catalog, setCatalog] = useState(null);
+ const [connections, setConnections] = useState([]);
+ const [pending, setPending] = useState(null);
+ const [error, setError] = useState(null);
+ const attempt = useRef(null);
- setAdvancedOpen((open) => !open)}
- style={({ pressed }) => [styles.settingsButton, pressed && styles.pressed]}
- >
- {t("Advanced")}
- {advancedOpen ? "⌃" : "›"}
-
- {advancedOpen ? (
-
-
- {t("Stream replies")}
-
- void setResponseStreamingPreference(checked ? "on" : "off")
- }
- />
-
-
- ) : null}
+ async function refresh() {
+ const [nextCatalog, nextConnections] = await Promise.all([
+ rpc("connections/catalog"),
+ rpc("connections/list"),
+ ]);
+ setCatalog(nextCatalog);
+ setConnections(nextConnections);
+ }
- void handleSignOut()}
- style={({ pressed }) => [styles.button, pressed && styles.pressed]}
- >
- {t("Sign out")}
-
+ useEffect(() => {
+ void refresh().catch(() => setCatalog([]));
+ return () => attempt.current?.abort();
+ }, []);
- {archivedBots.length > 0 ? (
-
- {t("Archived bots")}
- {archivedBots.map((bot) => (
-
-
- {bot.name}
-
- void restoreBot(bot.id)} hitSlop={8}>
- {t("Restore")}
-
-
- confirmDeleteBot(bot, () =>
- setArchivedBots((bots) => bots.filter((item) => item.id !== bot.id)),
- )
- }
- hitSlop={8}
- >
- {t("Delete")}
-
-
- ))}
-
- ) : null}
+ if (!catalog?.length) return null;
- {versionInfo.nativeLabel || updateLabel ? (
-
- {versionInfo.nativeLabel ? (
- {versionInfo.nativeLabel}
- ) : null}
- {updateLabel ? {updateLabel} : null}
-
- ) : null}
+ const featured = buildFeaturedConnectorTiles(catalog).flatMap((tile) =>
+ tile.item ? [{ label: tile.label, item: tile.item }] : [],
+ );
+ const apps = [
+ ...featured,
+ ...catalog
+ .filter((item) => item.connected && !featured.some((app) => app.item === item))
+ .map((item) => ({ label: item.name, item })),
+ ];
-
- {t("Delete account")}
- {
- setPassword(value);
- setError(null);
- }}
- placeholder={t("Current password")}
- placeholderTextColor={native.tertiaryLabel}
- secureTextEntry
- style={styles.password}
- textContentType="password"
- value={password}
- />
- {error ? {error} : null}
- [
- styles.deleteButton,
- (pending || !password) && styles.disabled,
- pressed && styles.pressed,
- ]}
- >
- {pending ? (
-
- ) : (
- {t("Delete account")}
- )}
-
+ async function connect(label: string, item: ConnectionCatalogItem) {
+ attempt.current?.abort();
+ const controller = new AbortController();
+ attempt.current = controller;
+ setPending(item.slug);
+ setError(null);
+ try {
+ const started = await rpc<{ connectionId: string; authorizationUrl: string | null }>(
+ "connections/begin",
+ {
+ connectorId: item.connectorId,
+ provider: item.slug,
+ displayName: label,
+ },
+ );
+ if (started.authorizationUrl) await Linking.openURL(started.authorizationUrl);
+ for (let i = 0; i < 45; i += 1) {
+ if (controller.signal.aborted) return;
+ const row = await rpc("connections/complete", {
+ connectionId: started.connectionId,
+ }).catch(() => undefined);
+ if (row?.status === "connected") {
+ await refresh();
+ return;
+ }
+ await abortableDelay(2_000, controller.signal);
+ }
+ if (!controller.signal.aborted) {
+ Alert.alert(
+ t("Connection pending"),
+ t("Finish connecting in the browser, then refresh this page."),
+ );
+ }
+ } catch (cause) {
+ if (!controller.signal.aborted) {
+ setError(cause instanceof Error ? cause.message : t("Could not connect"));
+ }
+ } finally {
+ if (attempt.current === controller) {
+ attempt.current = null;
+ setPending(null);
+ }
+ }
+ }
+
+ async function disconnect(item: ConnectionCatalogItem) {
+ setPending(item.slug);
+ setError(null);
+ try {
+ const matches = connections.filter(
+ (row) =>
+ row.connectorId === item.connectorId &&
+ row.provider === item.slug &&
+ (row.status === "connected" || row.status === "pending"),
+ );
+ for (const row of matches) {
+ await rpc("connections/revoke", { connectionId: row.id });
+ }
+ await refresh();
+ } catch (cause) {
+ setError(cause instanceof Error ? cause.message : t("Could not revoke connection"));
+ } finally {
+ setPending(null);
+ }
+ }
+
+ return (
+
+ {t("Apps")}
+ {apps.map(({ label, item }) => (
+
+
+ {label}
+ {pending === item.slug ? (
+
+ ) : (
+ void (item.connected ? disconnect(item) : connect(label, item))}
+ hitSlop={8}
+ >
+
+ {item.connected ? t("Disconnect") : t("Connect")}
+
+
+ )}
-
-
+ ))}
+ {error ? {error} : null}
+
);
}
-function NotificationSwitch({
+function AppLogo({
+ logo,
label,
- detail,
- value,
- disabled,
- onChange,
+ styles,
}: {
+ logo?: string | null;
label: string;
- detail: string;
- value: boolean;
- disabled: boolean;
- onChange: (value: boolean) => void;
+ styles: ReturnType;
}) {
- return (
-
-
- {label}
- {detail}
+ const [failed, setFailed] = useState(false);
+ useEffect(() => {
+ setFailed(false);
+ }, [logo]);
+ if (!logo || failed) {
+ return (
+
+ {(label.trim()[0] || "?").toUpperCase()}
-
-
+ );
+ }
+ return (
+ setFailed(true)}
+ resizeMode="contain"
+ source={{ uri: logo }}
+ style={styles.logo}
+ />
);
}
function createAccountStyles() {
- const tokens = mobileTokens();
return StyleSheet.create({
screen: {
flex: 1,
@@ -616,7 +454,27 @@ function createAccountStyles() {
content: {
flexGrow: 1,
padding: 20,
- gap: 20,
+ gap: 16,
+ },
+ navGroup: {
+ borderRadius: 16,
+ backgroundColor: native.fill,
+ overflow: "hidden",
+ },
+ navRow: {
+ minHeight: 52,
+ paddingHorizontal: 16,
+ flexDirection: "row",
+ alignItems: "center",
+ justifyContent: "space-between",
+ },
+ sectionLabel: {
+ color: native.secondaryLabel,
+ fontSize: 13,
+ fontWeight: "600",
+ textTransform: "uppercase",
+ marginTop: 8,
+ marginLeft: 4,
},
profile: {
borderRadius: 16,
@@ -633,6 +491,15 @@ function createAccountStyles() {
color: native.secondaryLabel,
fontSize: 15,
},
+ chatgptRow: {
+ minHeight: 56,
+ borderRadius: 16,
+ backgroundColor: native.fill,
+ paddingHorizontal: 16,
+ flexDirection: "row",
+ alignItems: "center",
+ gap: 12,
+ },
button: {
minHeight: 50,
borderRadius: 14,
@@ -645,36 +512,6 @@ function createAccountStyles() {
fontSize: 17,
fontWeight: "600",
},
- archivedSection: {
- borderRadius: 16,
- backgroundColor: native.fill,
- padding: 18,
- gap: 14,
- },
- sectionTitle: {
- color: native.secondaryLabel,
- fontSize: 14,
- fontWeight: "600",
- },
- archivedRow: {
- flexDirection: "row",
- alignItems: "center",
- gap: 14,
- },
- archivedName: {
- flex: 1,
- color: native.label,
- fontSize: 16,
- },
- restoreLabel: {
- color: native.label,
- fontSize: 14,
- fontWeight: "600",
- },
- archivedDeleteLabel: {
- color: tokens.destructive,
- fontSize: 14,
- },
settingsButton: {
minHeight: 62,
borderRadius: 14,
@@ -741,17 +578,6 @@ function createAccountStyles() {
fontSize: 17,
fontWeight: "600",
},
- switchRow: {
- minHeight: 44,
- flexDirection: "row",
- alignItems: "center",
- gap: 12,
- },
- switchLabel: {
- flex: 1,
- color: native.label,
- fontSize: 15,
- },
settingsTrailing: {
flexDirection: "row",
alignItems: "center",
@@ -761,63 +587,68 @@ function createAccountStyles() {
settingsValue: {
color: native.secondaryLabel,
fontSize: 15,
+ marginLeft: "auto",
},
chevron: {
color: native.secondaryLabel,
fontSize: 28,
fontWeight: "300",
},
- versionFooter: {
- marginTop: 4,
- alignItems: "center",
- gap: 2,
- },
- versionLine: {
- color: native.tertiaryLabel,
- fontSize: 12,
- textAlign: "center",
- },
- dangerZone: {
- marginTop: 12,
+ appsSection: {
borderRadius: 16,
- borderWidth: StyleSheet.hairlineWidth,
- borderColor: tokens.destructive,
+ backgroundColor: native.fill,
padding: 18,
+ gap: 12,
},
- dangerTitle: {
- color: tokens.destructive,
- fontSize: 17,
- fontWeight: "600",
+ appRow: {
+ minHeight: 44,
+ flexDirection: "row",
+ alignItems: "center",
+ gap: 12,
},
- password: {
- height: 48,
- borderRadius: 12,
- backgroundColor: native.fill,
+ appName: {
+ flex: 1,
color: native.label,
- paddingHorizontal: 14,
- marginTop: 16,
fontSize: 16,
},
- error: {
- color: tokens.destructive,
- fontSize: 14,
- marginTop: 10,
+ appAction: {
+ color: native.label,
+ fontSize: 15,
+ fontWeight: "600",
},
- deleteButton: {
- minHeight: 50,
- borderRadius: 12,
+ logo: {
+ width: 28,
+ height: 28,
+ borderRadius: 8,
+ },
+ logoFallback: {
+ width: 28,
+ height: 28,
+ borderRadius: 8,
+ backgroundColor: native.fillPressed,
alignItems: "center",
justifyContent: "center",
- backgroundColor: tokens.destructive,
- marginTop: 14,
},
- deleteLabel: {
- color: tokens.destructiveForeground,
- fontSize: 16,
+ logoInitial: {
+ color: native.secondaryLabel,
+ fontSize: 13,
fontWeight: "700",
},
- disabled: {
- opacity: 0.45,
+ versionCard: {
+ borderRadius: 16,
+ backgroundColor: native.fill,
+ padding: 18,
+ alignItems: "center",
+ gap: 4,
+ },
+ versionLine: {
+ color: native.tertiaryLabel,
+ fontSize: 13,
+ textAlign: "center",
+ },
+ error: {
+ color: mobileTokens().destructive,
+ fontSize: 14,
},
pressed: {
opacity: 0.7,
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx
index 1802dd34..73de6702 100644
--- a/apps/mobile/app/_layout.tsx
+++ b/apps/mobile/app/_layout.tsx
@@ -112,6 +112,7 @@ export default function Layout() {
/>
+
+ (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(null);
+ const [saving, setSaving] = useState(null);
+ const [error, setError] = useState(null);
+
+ useEffect(() => {
+ void rpc("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("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 (
+
+
+
+ {categories.map((category) => {
+ const current = rules && categoryRules(rules, category.id).length > 0 ? "ask" : "act";
+ return (
+
+ {category.label}
+
+ {levels.map((level) => {
+ const selected = rules !== null && current === level.id;
+ return (
+ void setLevel(category.id, level.id)}
+ style={({ pressed }) => [
+ styles.option,
+ selected && styles.optionSelected,
+ pressed && styles.pressed,
+ ]}
+ >
+ {level.label}
+
+ );
+ })}
+
+
+ );
+ })}
+
+ {error ? {error} : null}
+
+ );
+}
+
+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 },
+ });
+}
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: "更新",
};
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/consequential-approval.spec.ts b/apps/web/e2e/consequential-approval.spec.ts
index ab221db7..40663fe0 100644
--- a/apps/web/e2e/consequential-approval.spec.ts
+++ b/apps/web/e2e/consequential-approval.spec.ts
@@ -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();
@@ -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();
@@ -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();
diff --git a/apps/web/e2e/current-models.spec.ts b/apps/web/e2e/current-models.spec.ts
deleted file mode 100644
index 9391b08e..00000000
--- a/apps/web/e2e/current-models.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { expect, test } from "@playwright/test";
-import { captureScreenshot, completeOnboarding, openUserSettings, signup } from "./helpers";
-
-test("current subscription models appear in the picker", async ({ page }, testInfo) => {
- await signup(page, `current-models-${Date.now()}@rakazo.test`, "password12", "Model Picker");
- await completeOnboarding(page);
- await openUserSettings(page, "usage");
- for (const [provider, model, screenshot] of [
- ["Anthropic", "Claude Sonnet 5.5", "model-sonnet-55"],
- ["OpenAI Codex", "GPT-6.1 Sol", "model-sol-61"],
- ]) {
- await page.getByPlaceholder("Search providers").fill(provider!);
- await page
- .getByTestId("model-settings")
- .getByRole("button")
- .filter({ hasText: provider! })
- .first()
- .click();
- await page.getByRole("combobox", { name: "Model", exact: true }).click();
- await page.getByRole("combobox", { name: "Search models" }).fill(model!);
- await expect(page.getByRole("option", { name: model!, exact: true })).toBeVisible();
- await captureScreenshot(page, testInfo, screenshot!);
- await page.keyboard.press("Escape");
- }
-});
diff --git a/apps/web/e2e/desktop-update.spec.ts b/apps/web/e2e/desktop-update.spec.ts
index efae19de..5ade5081 100644
--- a/apps/web/e2e/desktop-update.spec.ts
+++ b/apps/web/e2e/desktop-update.spec.ts
@@ -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);
});
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/knowledge-panel.spec.ts b/apps/web/e2e/knowledge-panel.spec.ts
index f190d0e0..536e520a 100644
--- a/apps/web/e2e/knowledge-panel.spec.ts
+++ b/apps/web/e2e/knowledge-panel.spec.ts
@@ -1,14 +1,6 @@
-import { readFile } from "node:fs/promises";
import type { MemoryDocument } from "@milo/contracts";
import { expect, test } from "@playwright/test";
-import {
- activeBotId,
- captureScreenshot,
- completeOnboarding,
- openUserSettings,
- 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();
@@ -18,64 +10,6 @@ test("memory and skills are readable and editable in the app", async ({ page },
await page.goto("/app");
await page.waitForURL(/\/app\/[^/]+$/);
- // Space-wide documents live in Settings → Memory. Open that before bot
- // settings so the Knowledge Memory tab cannot steal this click.
- await openUserSettings(page, "memory");
- await expect(page.getByLabel("Close memory settings")).toBeVisible();
- const spaceDocs = page.getByTestId("space-memory-documents");
- await expect(spaceDocs.getByText("Shared documents")).toBeVisible();
- const memoryRow = spaceDocs.getByRole("button", { name: /MEMORY\.md/ });
- await expect(memoryRow).toBeVisible();
- await memoryRow.click();
- const docEditor = spaceDocs.locator("textarea");
- const marker = `Edited in e2e ${stamp}`;
- await docEditor.fill(`# Memory\n\n${marker}\n`);
- await captureScreenshot(page, testInfo, "83-space-memory-editor");
- let releaseSave!: () => void;
- const saveGate = new Promise((resolve) => {
- releaseSave = resolve;
- });
- await page.route(
- "**/rpc/memory/update",
- async (route) => {
- await saveGate;
- await route.continue();
- },
- { times: 1 },
- );
- await spaceDocs.getByRole("button", { name: "Save", exact: true }).click();
- try {
- await expect(docEditor).toBeDisabled();
- await expect(memoryRow).toBeDisabled();
- await expect(spaceDocs.getByRole("button", { name: "Cancel", exact: true })).toBeDisabled();
- } finally {
- releaseSave();
- }
- await expect(spaceDocs.getByText("rev 2")).toBeVisible();
-
- // The save persisted: reopen the document and find the marker.
- await memoryRow.click();
- await expect(docEditor).toHaveValue(new RegExp(marker));
- await captureScreenshot(page, testInfo, "84-space-memory-saved");
- const sharedDocuments = await rpc(page, "memory/list", { scope: "user" });
- expect(sharedDocuments).toContainEqual(
- expect.objectContaining({ content: `# Memory\n\n${marker}\n`, revision: 2 }),
- );
- // Export must fetch fresh content and exclude the bot's private document.
- const sharedDocument = sharedDocuments.find((doc) => doc.path === "MEMORY.md")!;
- const latestMarker = `Latest shared memory ${stamp}`;
- await rpc(page, "memory/update", { documentId: sharedDocument.id, content: latestMarker });
- const downloadPromise = page.waitForEvent("download");
- await spaceDocs.getByRole("button", { name: "Download as markdown" }).click();
- const download = await downloadPromise;
- expect(download.suggestedFilename()).toBe("space-memory.md");
- const exported = await readFile((await download.path())!, "utf8");
- expect(exported).toContain(latestMarker);
- expect(exported).not.toContain(marker);
- expect(exported).not.toContain("# Chief");
- await page.getByLabel("Close memory settings").click();
- await expect(page.getByLabel("Close memory settings")).toHaveCount(0);
-
// The bot's Knowledge section lives under Advanced in its settings panel.
await page
.locator("main")
diff --git a/apps/web/e2e/local-settings.spec.ts b/apps/web/e2e/local-settings.spec.ts
index 653e5543..91012a84 100644
--- a/apps/web/e2e/local-settings.spec.ts
+++ b/apps/web/e2e/local-settings.spec.ts
@@ -25,36 +25,6 @@ test("local settings open and save integrations without an app session", async (
throw new Error("Unexpected input");
connected = true;
json = { ok: true };
- } else if (procedure === "models/list") {
- json = [
- {
- provider: "openai-compatible",
- providerName: "OpenAI-compatible",
- id: "custom",
- label: "Custom model",
- billing: "",
- placeholder: true,
- auth: "api-key",
- },
- ];
- } else if (procedure === "models/credentials") {
- json = [];
- } else if (procedure === "me") {
- json = {
- userId: "owner",
- spaceId: "default",
- email: "owner@example.test",
- name: "Owner",
- isDeploymentOwner: true,
- needsModel: true,
- modelManaged: false,
- defaultProvider: "openai-compatible",
- defaultModel: "custom",
- computerHost: "local",
- canChooseHostComputer: true,
- sandboxProvider: "docker",
- avatarStyle: "robot",
- };
} else throw new Error(`Unexpected procedure: ${procedure}`);
return { status: 200, body: JSON.stringify({ json }) };
},
@@ -69,10 +39,7 @@ test("local settings open and save integrations without an app session", async (
await expect(page.getByText("Connected", { exact: true })).toBeVisible();
await expect(page.getByLabel("API key", { exact: true })).toHaveValue("");
await captureScreenshot(page, testInfo, "local-server-integrations-logged-out");
- await page.getByRole("button", { name: "Models", exact: true }).click();
- await expect(page.getByText("Models for the server owner’s default space.")).toBeVisible();
- await expect(page.getByLabel("OpenAI-compatible server URL")).toBeVisible();
- await captureScreenshot(page, testInfo, "local-server-models-logged-out");
+ await expect(page.getByRole("button", { name: "Models", exact: true })).toHaveCount(0);
});
test("ordinary browsers cannot use local settings", async ({ page }) => {
@@ -80,48 +47,3 @@ test("ordinary browsers cannot use local settings", async ({ page }) => {
await expect(page.getByRole("alert")).toContainText("Could not open local settings");
await expect(page.getByRole("button", { name: "Models", exact: true })).toBeHidden();
});
-
-test("local settings hide models when the runtime supplies one", async ({ page }, testInfo) => {
- await page.addInitScript(() => {
- window.rakazoDesktop = {
- platform: "darwin",
- localSettings: {
- request: async (pathname: string) => {
- const procedure = pathname.split("/rpc/")[1];
- let json: unknown;
- if (procedure === "integrationSetup/get") {
- json = {
- canConfigure: true,
- needsSetup: true,
- providers: [{ id: "composio", configured: false }],
- webUrl: "https://example.test/integrations/setup",
- };
- } else if (procedure === "me") {
- json = {
- userId: "owner",
- spaceId: "default",
- email: "owner@example.test",
- name: "Owner",
- isDeploymentOwner: true,
- needsModel: false,
- modelManaged: true,
- defaultProvider: "claude-code",
- defaultModel: "sonnet",
- computerHost: "local",
- canChooseHostComputer: true,
- sandboxProvider: "docker",
- avatarStyle: "robot",
- };
- } else throw new Error(`Unexpected procedure: ${procedure}`);
- return { status: 200, body: JSON.stringify({ json }) };
- },
- },
- } as typeof window.rakazoDesktop;
- });
- await page.goto("/desktop-settings");
- await expect(
- page.getByRole("button", { name: "Server integrations", exact: true }),
- ).toBeVisible();
- await expect(page.getByRole("button", { name: "Models", exact: true })).toBeHidden();
- await captureScreenshot(page, testInfo, "local-server-settings-managed-model");
-});
diff --git a/apps/web/e2e/model-picker-search.spec.ts b/apps/web/e2e/model-picker-search.spec.ts
deleted file mode 100644
index e02ed975..00000000
--- a/apps/web/e2e/model-picker-search.spec.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { expect, test } from "@playwright/test";
-import { captureScreenshot, completeOnboarding, openUserSettings, signup } from "./helpers";
-
-test("model dropdown search and provider group headers", async ({ page }, testInfo) => {
- const stamp = Date.now();
- const userName = `Model picker ${stamp}`;
- await signup(page, `model-picker-${stamp}@rakazo.test`, "password12", userName);
- await completeOnboarding(page);
-
- await openUserSettings(page, "usage");
- await expect(page.getByRole("button", { name: "Close usage settings" })).toBeVisible();
-
- // OpenRouter has many models so group headers and search are obvious.
- const providerSearch = page.getByPlaceholder("Search providers");
- await providerSearch.fill("openrouter");
- await page.getByRole("button", { name: /OpenRouter/ }).click();
-
- const modelCombobox = page.getByRole("combobox", { name: "Model", exact: true });
- await modelCombobox.click();
-
- const modelSearch = page.getByRole("combobox", { name: "Search models" });
- const modelOptions = page.getByRole("listbox", { name: "Model options" });
- await expect(modelSearch).toBeVisible();
- await expect(modelSearch).toHaveAttribute("placeholder", "Search");
- await expect(modelOptions).toBeVisible();
- // A single provider group repeats the provider name already shown by the
- // picker, so the redundant section header stays hidden.
- await expect(modelOptions.getByText("OpenRouter", { exact: true })).toBeHidden();
-
- await captureScreenshot(page, testInfo, "model-picker-dropdown-groups");
-
- await modelSearch.fill("claude");
- const optionTexts = await modelOptions.getByRole("option").allTextContents();
- expect(optionTexts.length).toBeGreaterThan(0);
- expect(optionTexts.every((text) => /claude/i.test(text))).toBe(true);
- await expect(page.getByText("No matching models")).toBeHidden();
-
- await captureScreenshot(page, testInfo, "model-picker-dropdown-filtered");
-
- const firstActive = await modelSearch.getAttribute("aria-activedescendant");
- expect(firstActive).toBeTruthy();
- await modelSearch.press("ArrowDown");
- await expect(modelSearch).toBeFocused();
- const afterDown = await modelSearch.getAttribute("aria-activedescendant");
- expect(afterDown).toBeTruthy();
- expect(afterDown).not.toBe(firstActive);
-
- await modelSearch.press("Home");
- await expect(modelSearch).toBeFocused();
- await expect(modelSearch).toHaveAttribute("aria-activedescendant", firstActive!);
-
- await modelSearch.press("End");
- await expect(modelSearch).toBeFocused();
- const afterEnd = await modelSearch.getAttribute("aria-activedescendant");
- expect(afterEnd).toBeTruthy();
- expect(afterEnd).not.toBe(firstActive);
-
- await modelSearch.press("ArrowUp");
- await expect(modelSearch).toBeFocused();
- const afterUp = await modelSearch.getAttribute("aria-activedescendant");
- expect(afterUp).toBeTruthy();
- expect(afterUp).not.toBe(afterEnd);
-
- const highlighted = page.locator(`[id="${afterUp}"]`);
- const selectedLabel = ((await highlighted.locator("span").first().textContent()) ?? "").trim();
- expect(selectedLabel.length).toBeGreaterThan(0);
- await modelSearch.press("Enter");
- await expect(modelSearch).toBeHidden();
- await expect(modelCombobox).toHaveText(selectedLabel);
-
- await modelCombobox.click();
- await expect(modelSearch).toBeVisible();
- await modelSearch.fill("no-model-matches-this");
- await expect(page.getByText("No matching models")).toBeVisible();
- await expect(modelOptions.getByRole("option")).toHaveCount(0);
-});
diff --git a/apps/web/e2e/model-settings.spec.ts b/apps/web/e2e/model-settings.spec.ts
deleted file mode 100644
index 45a1e24b..00000000
--- a/apps/web/e2e/model-settings.spec.ts
+++ /dev/null
@@ -1,469 +0,0 @@
-import { createServer } from "node:http";
-import type { AddressInfo } from "node:net";
-import { expect, test } from "@playwright/test";
-import { captureScreenshot, completeOnboarding, openUserSettings, rpc, signup } from "./helpers";
-
-const LOCAL_MODEL_ID = "rakazo-e2e-local";
-const LOCAL_MODEL_REPLY = "OpenAI-compatible endpoint verified end to end.";
-
-test("custom connections persist reasoning support and bot thinking", async ({
- page,
-}, testInfo) => {
- const stamp = Date.now();
- const userName = `Reasoning ${stamp}`;
- await signup(page, `reasoning-model-${stamp}@rakazo.test`, "password12", userName);
- await completeOnboarding(page);
- await openUserSettings(page, "usage");
- await page.getByPlaceholder("Search providers").fill("openai-compatible");
- await page.getByRole("button", { name: /OpenAI-compatible/ }).click();
- await page.getByLabel("OpenAI-compatible server URL").fill("http://127.0.0.1:8090/v1");
- await page.getByLabel("Model id").fill("arbitrary-model");
- await expect(page.getByRole("checkbox", { name: "Supports thinking" })).toBeHidden();
- await expect(page.getByRole("checkbox", { name: "Supports images" })).toBeHidden();
- await page.getByText("Advanced", { exact: true }).click();
- await page.getByRole("checkbox", { name: "Supports thinking" }).check();
- await page.getByRole("combobox", { name: "Reasoning effort", exact: true }).selectOption("low");
- await page.getByLabel("Maximum output tokens").fill("8192");
- await page.getByLabel("Context limit").fill("65536");
- await page.getByRole("checkbox", { name: "Supports images" }).check();
- await page.getByLabel("Maximum images per request").fill("1");
- await captureScreenshot(page, testInfo, "openai-compatible-thinking-connection");
- await page.getByRole("button", { name: "Save", exact: true }).click();
- await expect(page.getByText("Saved.", { exact: true })).toBeVisible();
- const credentials = await rpc<
- Array<{
- modelId?: string;
- reasoning?: boolean;
- thinkingLevel?: string | null;
- maxTokens?: number;
- contextWindow?: number;
- supportsImages?: boolean;
- maxImagesPerPrompt?: number;
- }>
- >(page, "models/credentials", {});
- expect(credentials.find((entry) => entry.modelId === "arbitrary-model")?.reasoning).toBe(true);
- expect(credentials.find((entry) => entry.modelId === "arbitrary-model")?.thinkingLevel).toBe(
- "low",
- );
- expect(credentials.find((entry) => entry.modelId === "arbitrary-model")?.maxTokens).toBe(8192);
- expect(credentials.find((entry) => entry.modelId === "arbitrary-model")?.contextWindow).toBe(
- 65536,
- );
- expect(credentials.find((entry) => entry.modelId === "arbitrary-model")?.supportsImages).toBe(
- true,
- );
- expect(credentials.find((entry) => entry.modelId === "arbitrary-model")?.maxImagesPerPrompt).toBe(
- 1,
- );
- await page.reload();
- await openUserSettings(page, "usage");
- await page.getByText("Advanced", { exact: true }).click();
- await expect(page.getByRole("checkbox", { name: "Supports thinking" })).toBeChecked();
- await expect(page.getByRole("combobox", { name: "Reasoning effort", exact: true })).toHaveValue(
- "low",
- );
- await expect(page.getByLabel("Maximum output tokens")).toHaveValue("8192");
- await expect(page.getByLabel("Context limit")).toHaveValue("65536");
- await expect(page.getByRole("checkbox", { name: "Supports images" })).toBeChecked();
- await expect(page.getByLabel("Maximum images per request")).toHaveValue("1");
- await page.getByLabel("Maximum images per request").fill("");
- await page.getByRole("button", { name: "Save", exact: true }).click();
- await expect(page.getByText("Saved.", { exact: true })).toBeVisible();
- const clearedCredentials = await rpc>(
- page,
- "models/credentials",
- {},
- );
- expect(
- clearedCredentials.find((entry) => entry.modelId === "arbitrary-model")?.maxImagesPerPrompt,
- ).toBeUndefined();
- await page.getByRole("button", { name: "Close usage settings" }).click();
- await page.locator("main").getByRole("button", { name: "Chief", exact: true }).click();
- const settings = page.getByTestId("bot-settings");
- await expect(settings).toBeVisible();
- const advanced = settings.getByTestId("bot-settings-advanced");
- await advanced.evaluate((element) => {
- (element as HTMLDetailsElement).open = true;
- });
- // NativeSelect sits inside a wrapping
- );
-}
+ 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 }) => (
+ -
+
+ {item.logo ? (
+
+ ) : (
+ label.charAt(0)
+ )}
+
+ {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/AgentModelsPanel.tsx b/apps/web/src/pages/AgentModelsPanel.tsx
index 9adc1ce8..5f64dafa 100644
--- a/apps/web/src/pages/AgentModelsPanel.tsx
+++ b/apps/web/src/pages/AgentModelsPanel.tsx
@@ -40,7 +40,20 @@ export function AgentModelsPanel() {
);
}
- if (!models) return null;
+ 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/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..84bbef01
--- /dev/null
+++ b/apps/web/src/pages/SettingsOverlay.test.tsx
@@ -0,0 +1,77 @@
+// @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) => {
+ 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);
+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..3fc380a6 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 (
) : null}
- {section === "usage" && !showModels ? (
- <>
-
-
- >
- ) : null}
- {section === "approvals" ? : null}
- {section === "notifications" ? (
-
- ) : null}
- {section === "computer" && showComputer ? : null}
- {section === "updates" ? (
-
- ) : null}
- {showModels ? (
- <>
-
-
-
-
- >
- ) : null}
- {section === "memory" ? (
-
-
+ {section === "usage" ? (
+
) : null}
+ {section === "approvals" ?
: null}
+ {section === "updates" && showUpdates ?
: null}
{section === "voice" ? (
) : null}