Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Use these terms in issues, PRs, comments, and docs. If you need a term that is n
- **Bot:** an agent a person makes from a look and one sentence to do one job on its own, within permissions they approved. Mousse makes built-in bots. A bot lives in the Chats tab, where its owner talks to it in its bot chat. It runs when asked there and on its own schedules. A personal bot runs only for its owner, on this computer and the owner's own providers. Its models are named only on Runs on (in About and New bot), beside its name at the top of About (its Talk model), in one chat line when a model picked there can't run, and on the line of one piece of work the owner asked to run on another model, and in the owner's own `/model` lines in the bot chat. See `docs/bots.md`.
- **Built-in bot:** a bot Mousse makes for the profile when a feature needs it. Enabling the pill adds Mousse for quick questions. Finishing the first meeting adds Meeting notes. Both start with an empty bot chat, unpicked models and Reach limited to this computer.
- **Bound secret:** a secret the owner gave a bot for one HTTPS service. Mousse keeps the value and adds it only to that service's fixed authentication header through a GET or HEAD read. Known services also fix the allowed path segments and version headers. Commands outside a sandbox can still read the owner's secret-store files.
- **Command sandbox:** the owner's per-bot switch in About → Can use ("Sandbox commands", and "Allow network for sandboxed commands") that decides whether a bot's commands run in a sandbox that limits the files they can change, and whether those commands may use the network. Off, commands run as the owner's own threads run them, with the bot's permissions and approvals still applied. When it is on but can't start on the bot's computer, the owner gets a card with Turn off sandbox for this bot and, where a package fixes it, Install what's missing. See `docs/plans/bot-sandbox-setting.md`.
- **Command sandbox:** the owner's per-bot setting in About → Sandbox (a dialog) that decides whether a bot's commands run in a sandbox that limits the files they can change, and what network those commands get: Blocked, Public web (public internet sites only) or Direct (this computer's network). Off, commands run as the owner's own threads run them, with the bot's permissions and approvals still applied. When it is on but can't start on the bot's computer, the owner gets a card with Turn off this limit and, where it may help, Repair. See `docs/plans/bot-sandbox-setting.md`.
- **Space bot:** a bot a member adds to a Space, which answers in the Space's chat. Its code lives in `bots/space/`, apart from personal bots.
- **Grant:** what a bot's owner approved: the tools the bot may use beyond what every bot has, and its limits. The bot works inside its grant without asking. Every bot also has, without a grant, the profiler, Mousse's look, scheduled jobs, secrets the owner gives and quick actions, and, unless switched off in About, every MCP server set up in Mousse, every skill and the automation tools.
- **Use your threads:** the bot permission, off by default, to read, search and act on its owner's reachable threads. Work and scheduled runs, their subagents, and chat turns started by creation, an owner message or tap, a wake, a question or a job may act under the grant. A turn from another bot's message is read-only. A thread it starts uses the target computer's default permission mode, capped by device limits. A message uses the target thread's mode. It answers the questions and approvals of the threads it reaches, labelled as its own answers; in a thread it started, those requests don't ping the owner. Private threads and other bots' threads stay out of reach. The owner can switch the permission off in About. See `docs/bots.md`.
Expand Down
15 changes: 8 additions & 7 deletions docs/bots.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ With the sandbox off, a bot that holds "run commands" can read anything its owne

## Command sandbox

The owner decides, per bot, whether its commands run in a sandbox and whether sandboxed commands may use the network: About → Can use, under Run commands, **Sandbox commands** and **Allow network for sandboxed commands** (`bots.sandbox.get` and `.set`; design in [the plan](plans/bot-sandbox-setting.md)). The setting is the bot's own row in `bots.db` (`bot_sandbox`, v19), apart from its grant: no grant, Allow everything or ask changes it, and a bot can't ask for it. Only a person at a Mousse window changes it or asks to install what's missing: locally only the app's window, and from another device only with its router's person mark (`window: person`), as for the system instructions. The bot's computer reads that mark as the calling device's router set it: it can't itself tell that a window made the call, here or for any other person-only method, local or remote (#2052). A device paired at Full can already change the bot's grant from there.
The owner decides, per bot, whether its commands run in a sandbox and whether sandboxed commands may use the network: About → Can use, under Run commands, one **Sandbox** row with its state ("Off", "On · Public web"), which opens the Sandbox dialog: the switch, Files, Network (**Blocked**, **Public web**, **Direct**), Local servers, the bot's secrets and their rules, Approvals (Auto, or Full commands) and a summary of what commands reach, read from the resolver (`bots.sandbox.get` and `.set`; `BotSandboxSettings.tsx`; design in [the plan](plans/bot-sandbox-setting.md)). The dialog names the bot's computer, where the setting is kept. New bot has the same controls as a Sandbox step after Runs on, off by default, written with the bot before its first turn (`bots.create`'s `sandbox`, sent only where the choices carry `sandboxOnCreate`). The setting is the bot's own row in `bots.db` (`bot_sandbox`, v19), apart from its grant: no grant, Allow everything or ask changes it, and a bot can't ask for it. Only a person at a Mousse window changes it or asks to install what's missing: locally only the app's window, and from another device only with its router's person mark (`window: person`), as for the system instructions. The bot's computer reads that mark as the calling device's router set it: it can't itself tell that a window made the call, here or for any other person-only method, local or remote (#2052). A device paired at Full can already change the bot's grant from there.

- **One policy per launch.** `BotSandboxResolver` reads the setting with the actual entry (or Mousse's own runner, for background and secret commands) and gives `open`, `held` (with the network) or `unavailable` (why, and whether a package fixes it). Every turn carries it (`BotAuthority.sandbox`), and About, the card and the bot's system text read the same result.
- **Off** runs commands as the owner's own threads run them on that provider: no sandbox and no command-network block. The grant gate, approvals and destructive-command cards, bound-secret rules, masking and the filtered command environment stay.
Expand All @@ -484,15 +484,16 @@ The owner decides, per bot, whether its commands run in a sandbox and whether sa
| Pi's `bash`, background commands, secret commands | Mousse's bubblewrap (`mousseHeldSpawn`): the system's folders read-only, the bot's folders writable, a new network namespace only when blocked | `sandbox-exec` with a profile over the same folders: the home folder unreadable but for the bot's folders, writes only to them, the network denied when blocked | unavailable |
| Antigravity | unavailable: it has no command sandbox | unavailable | unavailable |

- **Network open on Mousse's runner.** With the network allowed, a command on Mousse's runner uses this computer's own network, so it can reach services listening here (`127.0.0.1`) and on the local network. That is wider than Claude Code's path, whose proxy refuses those addresses. Blocking the network closes both.
- **Network open on Claude Code.** Claude Code's sandbox sends commands' traffic through a proxy that takes only listed hosts, and the pinned CLI refuses a bare `*`. So Mousse runs its own small HTTP proxy on `127.0.0.1` (`connectProxy.ts`), named in the sandbox's `network.httpProxyPort`. It tunnels `CONNECT` without reading the traffic, so `gh` and `git` check certificates as usual, and allows every host for now. It reaches ordinary public addresses only (`refusedAddress`), whatever name leads there. It follows IANA's IPv4 and IPv6 special-purpose address registries and refuses every block in them: loopback, the owner's private network (`10/8`, `172.16/12`, `192.168/16`, `fc00::/7`), carrier-grade NAT (`100.64/10`), link-local addresses such as cloud metadata, documentation, benchmarking and reserved ranges, and the anycast service ranges the registry marks globally reachable, since their nearest server can be the owner's own router. It also refuses multicast, IPv6 outside global unicast (`2000::/3`), and any address of this computer's own network cards, read at each request. An IPv6 address that carries an IPv4 address (`::ffff:`, NAT64, 6to4) is judged by that IPv4 address. It looks each name up once, checks every address the name leads to, and connects to the address it checked. Plain `http://` requests follow the same rule. Any program on this computer can connect to the proxy, not only the bot's sandbox: Claude Code takes an outside proxy as a port number alone and gives it no password, so the sandbox has no secret it could show. That is safe because the proxy only reaches what any program here can already reach directly. Blocked is the empty, strict list of hosts.
- **Network choices.** Each launcher says which networks it gives (`BotSandboxSupport.networks`), and the resolver makes any other choice unavailable (`network_mode`) instead of giving a wider or narrower one: Claude Code gives Blocked and Public web; Codex and Mousse's runner give Blocked and Direct. A choice saved as `open` before the split keeps its meaning: the public web on Claude Code, this computer's network on Codex and the runner; the dialog shows no choice picked for it, and a new choice is never `open`. The runner's own launch opens this computer's network only for Direct. A subagent on Direct is never within work held to the public web (`BotCommandHold.publicOnly`).
- **Direct on Mousse's runner and Codex.** A command uses this computer's own network, so it can reach services listening here (`127.0.0.1`) and on the local network, and servers it starts can be reached from this computer.
- **Public web on Claude Code.** Claude Code's sandbox sends commands' traffic through a proxy that takes only listed hosts, and the pinned CLI refuses a bare `*`. So Mousse runs its own small HTTP proxy on `127.0.0.1` (`connectProxy.ts`), named in the sandbox's `network.httpProxyPort`. It tunnels `CONNECT` without reading the traffic, so `gh` and `git` check certificates as usual, and allows every host for now. It reaches ordinary public addresses only (`refusedAddress`), whatever name leads there. It follows IANA's IPv4 and IPv6 special-purpose address registries and refuses every block in them: loopback, the owner's private network (`10/8`, `172.16/12`, `192.168/16`, `fc00::/7`), carrier-grade NAT (`100.64/10`), link-local addresses such as cloud metadata, documentation, benchmarking and reserved ranges, and the anycast service ranges the registry marks globally reachable, since their nearest server can be the owner's own router. It also refuses multicast, IPv6 outside global unicast (`2000::/3`), and any address of this computer's own network cards, read at each request. An IPv6 address that carries an IPv4 address (`::ffff:`, NAT64, 6to4) is judged by that IPv4 address. It looks each name up once, checks every address the name leads to, and connects to the address it checked. Plain `http://` requests follow the same rule. Any program on this computer can connect to the proxy, not only the bot's sandbox: Claude Code takes an outside proxy as a port number alone and gives it no password, so the sandbox has no secret it could show. That is safe because the proxy only reaches what any program here can already reach directly. Blocked is the empty, strict list of hosts.
- **When it can't start.** Before a turn the sandbox is started for real (`BotEngine.refresh`): the programs on the command's own PATH, WSL 1, user namespaces, and a harmless command in it. Only a start that worked is kept; a real start failure later drops it (`BotAuthority.sandbox.startFailed`). On Claude Code a real start failure is what Claude Code says (`claudeSandboxStartFailure`): its sandbox required but unavailable at its start, its subprocess scrub finding no bubblewrap at its start, "Sandbox is required but failed to initialize" at a command, or bubblewrap's own refusal, such as `bwrap: Can't mkdir /mnt/c/…` on WSL with a Windows drive mounted (the card then names the drive). A turn that fails at its start that way starts again once with its commands refused, so the chat still answers. Then:
- the turn's commands don't run, and the bot is told why and what to tell its owner (`botSandboxRefusal`, `botSandboxSystemLine`);
- Mousse posts one card per reason in the chat (`BotSandboxCard`): **Command sandbox unavailable on {computer}**, the reason, "This bot's work is waiting. Mousse checks again on the next turn.", **Turn off sandbox for this bot** and, when a package fixes it, **Install what's missing**. About shows the same state. Each card names the launcher that failed (`provider`, and `entry`: the provider entry, or `mousse` for Mousse's runner) and reads that launcher's own state (`BotSandboxView.entries`), standing as posted while the view has none of it; with the sandbox off every card settles, whatever launcher it names. A card of Mousse's runner, or of a subagent's other entry, keeps its buttons while that launcher can't start, even when the work's provider can, and About shows the runner's state ("background and secret commands can't start") when the work's provider starts (`BotSandboxView.runner`). Install what's missing types the packages every failing launcher needs, the card's own launcher included (`bots.sandbox.install` with the card's `entry`); when the computer has nothing to install for a card, only that card stops offering it;
- Mousse posts one card per reason in the chat (`BotSandboxCard`): **Command sandbox unavailable on {computer}**, the reason, "This bot's work is waiting. Mousse checks again on the next turn.", **Repair** where installing a package or a fresh start may fix it, and **Turn off this limit** (`botSandboxCardActions`). Allow once and Keep allowing need a launch Mousse holds and can let through; they come with Mousse's command runner and never show before. The Sandbox dialog shows the same state. Each card names the launcher that failed (`provider`, and `entry`: the provider entry, or `mousse` for Mousse's runner) and reads that launcher's own state (`BotSandboxView.entries`), standing as posted while the view has none of it; with the sandbox off every card settles, whatever launcher it names. A card of Mousse's runner, or of a subagent's other entry, keeps its buttons while that launcher can't start, even when the work's provider can, and the dialog's summary names the runner's commands ("Background commands: Can't start") when the work's provider starts (`BotSandboxView.runner`). Repair types the packages every failing launcher needs, the card's own launcher included (`bots.sandbox.install` with the card's `entry`); when the computer has nothing to install for a card, only that card stops offering it;
- work that met it waits once (`blocked`, end reason `sandbox`), a background or secret command refused by Mousse's runner included (a secret command's real start failure is recorded against the runner, `BotCommandSandbox.runnerFailed`), and carries on when the owner turns the sandbox off, or when a later turn or a recheck finds every launcher it met unavailable starts (`sandbox_ready`): a turn whose provider starts doesn't wake work the runner parked. The launchers it waits for are kept with it (`bot_memory_state`, `sandbox-needs:<work>`), so a restart doesn't narrow them to its provider's. A launcher not probed since the start or a recheck never counts as started, and one that failed may have been fixed: each is probed again before the work carries on (`wakeSandboxWaiters`, `BotSandboxResolver.probed`). A Codex thread setup's finding of the owner's command rules (`command_rules`) is the bot's own: the resolver keeps no launcher-wide failure for it, and reads the rules again for each bot's folder at each resolve. A subagent's entry is probed when it starts and when its turn starts, as a work's turn is.
- **Install what's missing** opens the owner's terminal on the bot's computer with the package manager's command typed, not run (`apt-get`, `dnf`, `pacman` or `zypper`, read from `/etc/os-release`; `bots.sandbox.install`). The owner signs in to `sudo` there; closing the terminal checks again. Mousse ships no helper programs. WSL 1, blocked user namespaces and a provider or OS with no sandbox get no Install button. GitHub sign-in errors and DNS outages are a command's own failures, not the sandbox's.
- **Changing it while work runs.** Tighter (the sandbox on, or the network blocked) stops running work that holds commands and its subagents (`cutForSwitch`), stops the bot's background commands, and closes the chat's warm process. Looser closes the warm process and carries on work that waited for the sandbox. An interrupted command never runs again by itself. The chat's warm key and Codex's thread key include the setting's revision.
- **Defaults.** Every bot starts off, a new one and one from before the setting (`BOT_SANDBOX_DEFAULT`), with the network open for when the owner turns it on. A bot from before the setting gets that row once, when this version first starts (`upgradeSandboxSettings`), with nothing posted in its chat; any later first read writes the same default.
- **Repair**, where a package fixes it, opens the owner's terminal on the bot's computer with the package manager's command typed, not run (`apt-get`, `dnf`, `pacman` or `zypper`, read from `/etc/os-release`; `bots.sandbox.install`). The owner signs in to `sudo` there; closing the terminal checks again. Mousse ships no helper programs. Without a package to install, Repair starts the sandbox again; WSL 1, a network a launcher can't give and a provider or OS with no sandbox get no Repair. GitHub sign-in errors and DNS outages are a command's own failures, not the sandbox's.
- **Changing it while work runs.** Tighter (the sandbox on, or any network change that is not only wider, `botSandboxNetworkWidens`) stops running work that holds commands and its subagents (`cutForSwitch`), stops the bot's background commands, and closes the chat's warm process. Looser closes the warm process and carries on work that waited for the sandbox. An interrupted command never runs again by itself. The chat's warm key and Codex's thread key include the setting's revision.

- **Moving.** The setting moves with the bot (bundle format 3), its revision starting again at 1. The target checks support at the first turn. An older Mousse refuses a format 3 bundle at its commit, so the bot stays where it was.

## Files
Expand Down
Loading
Loading