Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
app_settings: end-to-end approval mode, rename and config cards; inventory in the spec
aivsomkar8e1fb203c341
diff --git a/docs/superpowers/specs/2026-11-12-app-settings-tool-design.md b/docs/superpowers/specs/2026-11-12-app-settings-tool-design.mdindex 76df4c2096..65439d3733 100644--- a/docs/superpowers/specs/2026-11-12-app-settings-tool-design.md+++ b/docs/superpowers/specs/2026-11-12-app-settings-tool-design.md@@ -40,16 +40,16 @@ registry's deps instead of taking a `ctx`.| Tier | Behaviour | Examples ||---|---|---|| `safe` | Applies at once. Posts an applied-change card with Undo. | skin/theme, Simple or Advanced, font, chat width, send key, notification sounds, language, bot order, sidebar groups, thread limits and cleanup, room turn timeout, MCP call timeout, default model for new bots |-| `confirm` | Always posts a "Change X?" card with Change and Cancel, at every approval level including Full access. The tool call waits on the answer (outbound-hold style, 9 minutes). Allow needs owner review. | provider base URLs (`anthropic.url`, `openaiCompat.url`/`model`, `xai.url`, `groq.url`, `meta.url`, `tts.baseUrl`) |+| `confirm` | Always posts a "Change X?" card with Change and Cancel, at every approval level including Full access. The tool call waits on the answer (outbound-hold style, 9 minutes). Allow needs owner review. | provider base URLs, AI engines, and every setting added since (each bot's approval mode, name, colour and model, remote access, server config values, the rest of the window's preferences): see the inventory below || `secret` | `set` never takes a value. It posts the existing secret card (`secretCards.requestCredential` with a `CREDENTIAL_TARGETS` id). The person types the key into the card. The bot hears only provided or dismissed. | provider keys (OpenAI, Anthropic, OpenRouter, Mistral, Groq, ...) |-| `owner-only` | Readable and explainable. `set` is refused with where to change it. | any bot's approval mode, remote access, Cloud account, Vault, backups, computer sharing, revealing a key |+| `owner-only` | Readable and explainable. `set` is refused with where to change it. | Cloud account, Vault, backups and restore, pairing devices, lending folders, sidebar picture, organization |## Guards- **Owner turns only for writes.** Every `set` requires `phones.turnOwner({ botId, threadId, generation }) !== null`. That already refuses peer asks, relayed lines, webhook and routine runs the owner did not write, guests, shared-membership servers, and service-trust loopback. Reads are allowed in any turn the internal gate admits.- **Full access never skips a confirm card.** The confirm path must not consult `fullAccess()`.- **No secret ever reaches the bot.** `read` returns configured-or-not for keys. Secret writes go only through the secret card.-- **A bot cannot raise its own permissions.** Approval modes are `owner-only`.+- **A bot cannot raise its own permissions on its own.** An approval mode change is a `confirm` card that only the owner's review can approve.- **Owner review on Allow.** A confirm card's Allow counts only with `ownerReview` (bot-messages.ts), so a bot's own shell cannot approve its card.- **One open confirm card per bot.** A second `set` on a confirm setting while one waits is refused.- **Write budget.** At most 10 writes per turn (generation). The rest are refused.@@ -89,7 +89,8 @@ Skin, Simple mode, font, chat width, send key and notification sounds live in th## Out of scope-Remote access, Cloud, Vault and backup writes. Adding, signing in or removing sign-in accounts (Claude, ChatGPT, Antigravity).+Cloud, Vault and backup writes. Adding, signing in or removing sign-in accounts (Claude, ChatGPT, Antigravity). (Remote access moved+in, on cards; see "Everything else, on approval" below.)## As built (2026-11-12)@@ -128,3 +129,108 @@ Deviations from the design above, each chosen as the safer or simpler option:threads or the new-bot default uses; the card warns when it is the only working engine. Writes go through`POST /api/instances/*` and `DELETE /api/instances/:id`, so the Settings window's checks (including a running turn onthe engine) still apply.++## Everything else, on approval (2026-11-13)++The owner asked for every remaining Settings value, each one behind a Change/Cancel card. Every newly added setting is+`confirm`; the 15 `safe` entries stay `safe`, and the existing `confirm` and `secret` entries are unchanged. The registry+now holds 104 settings: 15 safe, 62 confirm (8 before), 19 secret, 8 owner-only (6 before).++**Owner-only moved to confirm, and why that is safe.** Per-bot approval mode (`bots.approvalModes`, value+`{"botId","mode"}`), remote access (`remote.wifi`, `remote.relay`, `remote.tailscale`, `remote.keepAwake`,+`remote.httpsAddress` off only, `remote.domain`) and computer sharing (`computer.sharing`, the+`features.sharedComputers` switch) are now `confirm`. The card is what keeps them safe: its Change counts only with+`ownerReview` (the desktop app or a paired Full-access device), so a bot's own shell on loopback gets 403, and the confirm+path never reads `fullAccess()`, so Full access never skips it. Every card names the bot and the effect in plain words+(`Let Kiwi act without asking (Full access)`, `Let your paired phones reach this computer from anywhere, through MausBot's+relay`, `... A lent folder can be used to reach a shell`). `describe` refuses before any card an unknown bot, Custom+approval (desktop app only), and Approve for me on this computer's own desktop (the route takes that only with the+warning the bot's Settings dialog shows). The approval change is sent with `applyToAllThreads`, as the bot panel does.+`cloud.account` and `vault.logins` stay owner-only.++**How the new groups write.**++- Per-bot (`server/app-settings/registry-bots.ts`): `PATCH /api/bots/:id` through `routes.botPatch`, so the route's own+ checks run (name limits, the colour list, `checkedModelSelection` with `requireAvailableModel`, Custom and hosted+ Full-access refusals, the default bot's rules). `current()` is undefined, so a per-bot card has no Undo.+- Server config (`server/app-settings/registry-config.ts`): `PUT /api/config` through `routes.config`, validated first+ with the route's own section schema (`CONFIG_PATCH_FIELDS` exported from `server/config.ts`). Other routes go through+ a new `call(route, ...)` dep: `POST`/`DELETE /api/settings/custom-domain` (moved out of `server/index.ts` into+ `server/routes/custom-domain.ts`), `POST /api/starter/awake`, `PATCH /api/skills-library/:name` and+ `PUT /api/bots/:id/skills-library`. A route that throws (the domain verifier) comes back as a refusal.+- Window and desktop (`server/app-settings/registry-window.ts`): a confirm variant of `windowPref`; the frame goes out+ only on Change. `src/lib/window-prefs.ts` applies each with the row's own setter, and reaches desktop-only ones through+ the preload bridge (`openAtLogin`, `talkShortcut`, `windowFrame`, `rail`, `workspaces.color`, `updatesConsent`,+ `companion`). Reads may be async; a preference whose bridge is absent is left out of the report, and the server refuses+ a preference the window never reported ("The open MausBot window can't change this here").+- Keys: `withoutKeys` (the engines refusal, now shared) wraps every object value that could carry one; decider and+ image sections drop their key fields, and `read` strips any key, token, secret or password field.+- Anything that sends data off the computer says so on its card: decision provider, image provider, product update+ emails (your address goes to MausBot), usage analytics (PostHog).++**Inventory** (every row of `src/components/settings/settings-index.ts`):++| Row | Setting id(s) | Tier | Written by |+|---|---|---|---|+| pair, paired | `phone.pairing` | owner-only | pairing takes a code; removal and per-device grants stay in Settings |+| wifi | `remote.wifi` | confirm | window → `companion.setRoute("wifi")` |+| relay | `remote.relay` | confirm | window → `companion.setRoute("relay")` (needs a MausBot sign-in) |+| keep-awake | `remote.keepAwake` | confirm | window → `companion.keepAwake` |+| wake-automations | — | skipped | opens Automations, not a value |+| tailscale | `remote.tailscale`, `remote.httpsAddress` | confirm | window → `companion.setTailscale` / `setRoute("https", false)`; turning HTTPS on needs the pairing flow |+| domain | `remote.domain` | confirm | `POST`/`DELETE /api/settings/custom-domain`, checked live |+| sidebar-color | `appearance.sidebarColor` | confirm | window → `workspaces.color` |+| sidebar-picture | `appearance.sidebarPicture` | owner-only | a picture file |+| show-helper | `sidebar.showHelper` | confirm | `PATCH /api/bots/:id {sidebarHidden}` on the default bot |+| providers | `engines` | confirm (existing) | `/api/instances/*`; sign-in accounts stay in Settings |+| keys | `keys.*`, provider addresses | secret, confirm (existing) | secure card; `PUT /api/config` |+| backup-model | `ai.backupModel` | confirm | `PUT /api/config {automaticRecovery}` |+| routing | `ai.routing` | confirm | `PUT /api/config {decider}` without keys; its keys have no secure-card target, so they are typed in Settings |+| images | `ai.images` | confirm | `PUT /api/config {imageGen}` without keys (OpenAI image key is `keys.openaiImageApiKey`) |+| about-you | `profile.name`, `profile.email`, `profile.aboutMe`, `profile.photo` (remove only), `bots.everyBotRules` | confirm | `PUT /api/config {profile}` / `{everyBotRules}`; a new photo is a file |+| away-emails | — | skipped | Team Cloud only and per person; a Team Cloud never has an owner turn |+| new-bots | `bots.newBotEffort`, `bots.newBotTemplate`, `bots.defaultModel` | confirm, confirm, safe (existing) | `PUT /api/config {newBots}` / `{newBotDefaults}`; sharing as a preset is an export |+| limits | `bots.keepWarm`, `bots.awake`, `mcp.callTimeoutMinutes` | confirm, confirm, safe (existing) | `PUT /api/config {cacheKeepWarm}`; `POST /api/starter/awake` |+| parallel | `threads.maxConcurrentPerBot` | safe (existing) | `PUT /api/config` |+| group-turns | `rooms.turnTimeoutMinutes` | safe (existing) | `PUT /api/config` |+| skills | `skills.library`, `bots.skills` | confirm | `PATCH /api/skills-library/:name`, `PUT /api/bots/:id/skills-library`; importing a skill is content |+| early | `bots.skillAuthoring`, `bots.skillReview`, `bots.shareLearnedSkills` | confirm | `PUT /api/config {features}` |+| all-bots | — | skipped | a page |+| browser | `desktops.browser`, `desktops.browserLocalNetwork`, `desktops.browserEngine`, `desktops.browserProfiles` | confirm | `PUT /api/config {features}` / `{browserEngine}` / `{browserProfiles}`; removing a profile deletes its logins, so it is refused |+| desktop-kinds | `desktops.privateDesktop` | confirm | `PUT /api/config {localVm}`; pull, start, stop and remove are actions |+| saved-steps | `desktops.savedSteps` | confirm | `PUT /api/config {features}` |+| (computer sharing) | `computer.sharing`, `computer.lending` | confirm, owner-only | `PUT /api/config {features.sharedComputers}`; each lent folder is picked and confirmed in the desktop's own dialogs |+| vault | `vault.logins` | owner-only | logins and secrets |+| spending | — | skipped | information |+| backups | `data.backups` | owner-only | no schedule or location exists; a backup takes a password, the company schedule a typed confirmation, restore and delete are destructive |+| bring-in | — | skipped | a one-time import |+| move | `data.keepHere` | owner-only | the desktop takes it only from the person's click |+| storage | `threads.eventLogRetentionDays`, `threads.eventLogMaxBytes` | safe (existing), confirm | `PUT /api/config {threads}`; clearing attachments deletes data |+| activity | — | skipped | a read-only log |+| members | `people.signIn` | confirm | `PUT /api/config {signIn}` |+| bot-access | — | skipped | Team Cloud only (no owner turn there) |+| account | `cloud.account` | owner-only | sign-in |+| organization | `account.organization` | owner-only | portal sign-in |+| emails | `account.productEmails` | confirm | window → `updatesConsent.choose` |+| plan, this-week | — | skipped | billing and information |+| updates, your-computers, help, shortcuts, apps | — | skipped | actions and navigation |+| language | `general.language` | safe (existing) | `PUT /api/config` |+| send-key | `general.sendKey`, `general.followUp` | safe (existing), confirm | window |+| talk | `general.talkShortcut` | confirm | window → `talkShortcut.set` |+| notifications | `general.notificationSounds`, `general.finishedNotifications`, `general.notificationFeed` | safe (existing), confirm, confirm | window; turning device notifications on asks the system first |+| startup | `general.openAtLogin` | confirm | window → `openAtLogin.set` |+| analytics | `general.analytics` | confirm | window → `setAnalyticsEnabled` |+| light-dark, theme | `appearance.skin` | safe (existing) | window |+| bubbles | `appearance.userBubbles` | confirm | window |+| tool-calls | `appearance.toolCalls`, `appearance.runCard`, `appearance.chatWidth`, `appearance.font` | confirm, confirm, safe, safe | `PUT /api/config {features.showToolCalls}`; window |+| layout | `appearance.showComputers`, `appearance.windowFrame`, `appearance.showThreads`, `appearance.toolsLayout`, `appearance.pinnedCircles`, `appearance.universalPins`, `appearance.pinnedPages` | confirm | window (rail and frame through the desktop bridge) |+| bot-settings | `bots.approvalModes`, `bots.name`, `bots.color`, `bots.model`, `bots.archived`, `bots.settings` | confirm | `PATCH /api/bots/:id` |++**Not exposed.** A bot's outbound policy, connector and phone-app scopes, tool scope, MCP servers, fallback models,+always-allow list and managed sections are left out of `bots.settings`: the bot route refuses those loosenings from the+local API while any bot works, and the asking bot is always working while its card waits. A browser profile removal,+attachment clearing and backup restore delete data. Away emails and bot sharing exist only on a Team Cloud, where no turn+is the owner's. Window-side reads come from the window's last report, so a change made by hand since shows on the next+report, and a desktop bridge that refuses a change (Tailscale not installed, no sign-in for the relay) leaves the old value+in the next report while the bot was told it changed.+diff --git a/docs/verification/app-settings.md b/docs/verification/app-settings.mdindex af5131cc9e..515a2ab823 100644--- a/docs/verification/app-settings.md+++ b/docs/verification/app-settings.md@@ -31,8 +31,18 @@ would. Nothing touches live app data.- **Secret.** `set keys.xaiApiKey` with a value is refused. Without a value itposts the secure key card. The key is in no tool result, message, decisionrow or saved config.-- **Owner-only.** `set bots.approvalModes` is refused with where the owner- changes it.+- **Owner-only.** `set vault.logins` is refused with where the owner changes+ it.+- **A bot's own settings and a config value.** One turn renames the bot through+ `bots.name` and sets `profile.name`. Each waits on its own card; nothing+ changes until the owner's paired device taps Change, then `GET /api/bots` shows+ the new name (written by the real `PATCH /api/bots/:id`) and `config.json`+ the new profile name.+- **Approval mode.** The Full-access bot asks to put itself on Ask. The card+ reads "Make Setter ask you before each command or file change (Ask for+ approval)"; a local Allow is refused with 403, Cancel keeps Full access, and+ Change from the owner's device moves the bot and every thread to Ask. The+ fixture then puts it back on Full access for the tests after it.- **Stop.** Stopping a turn whose provider-address card waits closes the card asunavailable at once; a later Change applies nothing, and the next turn can ask again.- **Window preferences.** A skin change is refused while no app window's live@@ -50,7 +60,10 @@ would. Nothing touches live app data.The scripted engine stands in for the model. This recipe does not show whethera real model follows the tool's instructions. It checks server and proxy-behaviour, not the rendered cards or how phones draw them. A second open card, a Stop landing after Change,+behaviour, not the rendered cards or how phones draw them. The desktop-bridge+preferences (remote access, open at login, window frame, sidebar colour, talk+shortcut, product emails) are covered only by `src/lib/window-prefs.test.ts`+with a stubbed bridge, not a packaged desktop app. A second open card, a Stop landing after Change,the refusal to remove an engine in use, and the 9-minute timeout of an unanswered card are covered only bythe unit tests in `server/app-settings/host.test.ts`. The fixture's engine reports no toolactivity lines, so the secret check reads the thread as the fixture writes it.diff --git a/server/app-settings.e2e.test.ts b/server/app-settings.e2e.test.tsindex d0c37f469f..b35008660b 100644--- a/server/app-settings.e2e.test.ts+++ b/server/app-settings.e2e.test.ts@@ -228,11 +228,64 @@ it("a key is never taken as a value: set with a value is refused, set without on}, 60_000);it("an owner-only setting is refused with where to change it", async () => {- await start("OWNER-ONLY", [step({ action: "set", id: "bots.approvalModes", value: JSON.stringify({ [bot.id]: "full" }) }, true)]);+ await start("OWNER-ONLY", [step({ action: "set", id: "vault.logins", value: "on" }, true)]);expect(results(await finished("OWNER-ONLY"))).toEqual([expect.objectContaining({ isError: true,- text: "Approval modes is changed only by the owner, in a bot's Settings. Tell the user where to find it; do not try another way." })]);+ text: "Vault and logins is changed only by the owner, in Settings → Vault. Tell the user where to find it; do not try another way." })]);}, 60_000);+/** The unanswered card for `settingId`, once it shows. */+const waitingCard = async (settingId: string) => {+ let waiting: any;+ await expect.poll(async () => (waiting = (await settingCards(bot.threadId)).find((one) => one.card.appSettingRequest.settingId === settingId && !one.card.answered)) !== undefined,+ { timeout: 20_000, message: `an unanswered ${settingId} card` }).toBe(true);+ return waiting.card;+};+const botNow = async () => (await api("GET", "/api/bots")).bots.find((one: any) => one.id === bot.id);++it("a bot's own name and a server setting change through the real routes only on the owner's Change", async () => {+ await start("BOT-AND-CONFIG", [+ step({ action: "set", id: "bots.name", value: JSON.stringify({ botId: bot.id, name: "Setter Two" }) }),+ step({ action: "set", id: "profile.name", value: "Ada" }),+ ], 60_000);+ const rename = await waitingCard("bots.name");+ expect(rename).toMatchObject({ title: "Change Bot name?", subtitle: "Rename Setter to \"Setter Two\"", options: ["Change", "Cancel"] });+ expect((await botNow()).name, "nothing changes while the card waits").toBe("Setter");+ await api("POST", `/api/threads/${bot.threadId}/respond`, { requestId: rename.requestId, behavior: "allow" }, 200, ownerDevice);+ const profile = await waitingCard("profile.name");+ expect(profile.subtitle).toBe("not set → Ada");+ expect(config().profile?.name).toBeUndefined();+ await api("POST", `/api/threads/${bot.threadId}/respond`, { requestId: profile.requestId, behavior: "allow" }, 200, ownerDevice);+ const [renamed, named] = results(await finished("BOT-AND-CONFIG"));+ expect(renamed).toMatchObject({ isError: false, text: expect.stringMatching(/^Done: Rename Setter to "Setter Two"\./) });+ expect(named).toMatchObject({ isError: false, text: "Changed Your name from not set to Ada." });+ expect((await botNow()).name).toBe("Setter Two");+ expect(config().profile.name).toBe("Ada");+}, 90_000);++it("a Full-access bot's own approval mode changes only on a card: Cancel keeps it, Change from the owner's device applies it to every thread", async () => {+ const change = step({ action: "set", id: "bots.approvalModes", value: JSON.stringify({ botId: bot.id, mode: "ask" }) });+ await start("APPROVAL-CANCEL", [{ ...change, expectError: true }], 60_000);+ const first = await waitingCard("bots.approvalModes");+ expect(first).toMatchObject({ title: "Change Approval mode?", options: ["Change", "Cancel"] });+ expect(first.subtitle).toMatch(/^Make Setter( Two)? ask you before each command or file change \(Ask for approval\)$/);+ // Security: a local Allow while the bot works could be the bot's own shell.+ expect((await api("POST", `/api/threads/${bot.threadId}/respond`, { requestId: first.requestId, behavior: "allow" }, 403)).error).toMatch(/^Approve settings changes from the desktop app/);+ await api("POST", `/api/threads/${bot.threadId}/respond`, { requestId: first.requestId, behavior: "deny" }, 200, ownerDevice);+ expect(results(await finished("APPROVAL-CANCEL"))[0]?.text).toMatch(/^The user cancelled the change to Approval mode\./);+ expect((await botNow()).approvalMode).toBe("full");++ await start("APPROVAL-CHANGE", [change], 60_000);+ const second = await waitingCard("bots.approvalModes");+ expect((await botNow()).approvalMode, "Full access did not skip the card").toBe("full");+ await api("POST", `/api/threads/${bot.threadId}/respond`, { requestId: second.requestId, behavior: "allow" }, 200, ownerDevice);+ expect(results(await finished("APPROVAL-CHANGE"))[0]).toMatchObject({ isError: false, text: expect.stringMatching(/^Done: Make Setter/) });+ const now = await botNow();+ expect(now.approvalMode).toBe("ask");+ expect(now.tasks.every((task: any) => (task.approvalMode ?? "ask") === "ask")).toBe(true);+ // Fixture cleanup: the owner's device puts the bot back on Full access for the tests after this one.+ await api("PATCH", `/api/bots/${bot.id}`, { approvalMode: "full", applyToAllThreads: true }, 200, ownerDevice);+}, 120_000);+it("pinning a bot goes through the sidebar's own bot route, and Undo unpins it", async () => {const pinnedNow = async () => (await api("GET", "/api/bots")).bots.find((one: any) => one.id === bot.id)?.pinned === true;expect(await pinnedNow()).toBe(false);