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
3 changes: 2 additions & 1 deletion docs/GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Use these terms in issues, PRs, comments, and docs. If you need a term that is n
- **Delegation:** one task handed to a subagent, with its own ID and result. Giving the same subagent a second task is a second delegation on the same thread. A delegation ends as done, failed, stopped or interrupted, and that outcome does not change once the result is read. While the subagent is still waiting on its own subagents or on a delivery, the delegation is waiting on subagents and has no result yet; it ends once the subagent has nothing left to wait for.
- **Subagent title:** the short name a thread gives a subagent when it starts it, such as "API reviewer". It is unique among that thread's subagents and is how the thread later continues, reads or cancels that subagent.
- **Continue (a subagent):** send a follow-up to a subagent that already exists, by its title. It carries on in the same thread with what it already read, as a new delegation, instead of a new subagent starting from nothing. A message a person types in a subagent's thread is also a follow-up, and its parent hears the result.
- **Remote subagent:** a subagent an agent starts on another of the user's computers (`delegate_task` with `computer`). That computer runs it as an ordinary thread, under its own agents and accounts, in its project that holds the same repository, and its questions are answered there. Its parent continues, reads and stops it like any subagent; its result names the branch its work is on there. Agents may start one only when "Let agents start subagents on your other devices" is on in Settings → Agents → Agent access (off at first), and only on the computers checked under it. It runs no looser than its parent and within the highest permission mode that computer set for this one, which can be Full access.
- **Remote subagent:** a subagent an agent starts on another of the user's computers (`delegate_task` with `computer`). That computer runs it as an ordinary thread, under its own agents and accounts, in its project that holds the same repository, and its questions are answered there. Its parent continues, reads and stops it like any subagent; its result names the branch its work is on there. Agents may start one only when "Let agents work on your other devices" is on in Settings → Agents → Agent access (off at first), and only on the computers turned on under it. It runs no looser than its parent and within the highest permission mode that computer set for this one, which can be Full access.
- **Background work:** agents and shells a provider started that keep running after the turn that started them ended. Claude keeps one live process per thread so they survive. While a thread has background work it shows Waiting, and a subagent's task waits too.
- **Continuation run:** a run of a thread that records a turn the provider started on its own, because background work finished and the provider wants to read the report. It opens with a short note and ends at the provider's result.
- **Workflow:** a published sequence of steps that can run from chat (its slash command), the CLI, or an automation.
Expand Down Expand Up @@ -84,6 +84,7 @@ Use these terms in issues, PRs, comments, and docs. If you need a term that is n
- **Project group:** one entry in the sidebar's Projects view. A project of this computer and the projects of other computers that hold the same repository (they share a Git remote, so `sameAs` names the project here) are one group, with all their threads, each thread row still naming its computer. A project that exists on another computer only, or matches only by its first commit (`similarTo`: forks, templates), is a group of its own, named with its computer. A group stays, with offline rows, while a computer is out of reach.
- **Block (a device):** a setting on one computer that refuses every Bridge call, stream and request from one other device, at once. It is kept on that computer only, needs no authority, and is undone with Unblock.
- **Highest permission mode (for a device):** the most permissive permission mode a person on another computer can run a turn or create an "Always" rule in on this computer, and the most a remote subagent that computer's agents start here can run in. A new computer starts at Auto-accept edits.
- **Agent reach (for a device):** which threads of this computer another computer's agents may change (start, message, steer, stop), set beside its highest permission mode in Settings → Devices → Limits ("Agents on <device> may change"; or `mousse-cli bridge limits <node> --agent-reach`): Nothing, Threads they started (the default) or All threads. Reading follows the device's ordinary access. It is a rule for a computer that marks its agents' calls as it should, not a barrier: blocking the device and its highest permission mode are the controls for one that is not trusted.
- **Share bots with other devices:** the switch on each computer (Settings, Devices; or `mousse-cli bridge bots on|off`) that lets the user's phones and other computers list this computer's personal bots and chat with them. It is on by default and stored on that computer. While it is off, the lists other devices read carry no bots and every `bots.*` call they make is refused (`forbidden`, reason `setting_off`).
- **Devices (of a bot):** which of the owner's devices reach one personal bot, set in its About on the computer that holds it: All my devices (the default), Only this computer, or Chosen devices. **Bots on this computer** is the switch per device in Settings, Devices that lets that device reach none of the bots there. A device that is left out finds no such bot: it is in none of its lists, and every call about it answers as for a bot that is not there. See `docs/bots.md`, Two layers.
- **Editor connections from this device:** the per-device switch on the computer that runs a thread that lets one other computer open its editor on this computer's folders: its `ssh` signs in to this computer, carried inside Mousse Net, and always ends there (the other computer never names a host or a port): at Mousse's own SSH server inside the daemon, which needs no SSH server, no key and no setup on this computer, or at the computer's own SSH server when its owner chose "Use this computer's SSH server". It is off by default and separate from "Terminals from this device". It ends at once when the device is blocked, the switch (or "Let my other computers work on this computer's threads") goes off, the device loses "Works on threads" or is revoked, or Net is turned off. It is the same as shell access for the user on that computer. A Windows computer uses its own OpenSSH server instead only when the endpoint's helper is missing or does not run.
Expand Down
4 changes: 2 additions & 2 deletions docs/net/threat-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ A window of one computer reaches a thread on another computer through a router i
An agent can start a subagent on another of the user's computers (`delegate_task` with `computer`). This is the one way an agent of this computer reaches another computer, and it is narrow on purpose:

- It is the daemon's own service (`src/mms/orchestrator/RemoteSubagents.ts`), not the agent, that calls the other computer, through the router's client, so the rule that only a `gui` connection routes still holds for everything an agent's tools or shell send.
- Nothing starts unless "Let agents start subagents on your other devices" (`agentAccess.remoteSubagents`) is on in Settings → Agents → Agent access, and then only on the computers the user checked under it (`agentAccess.computers`). The switch is off and the list empty by default; both are read on every `delegate_task` and `continue_subagent`. Turning the switch off stops new starts and follow-ups; a subagent already running finishes, and its parent can stop it.
- Nothing starts unless "Let agents work on your other devices" (`agentAccess.remoteSubagents`, named "Subagents on other devices" before) is on in Settings → Agents → Agent access, and then only on the computers the user turned on under it (`agentAccess.computers`). The switch is off and the list empty by default; both are read on every `delegate_task` and `continue_subagent`. Turning the switch off stops new starts and follow-ups; a subagent already running finishes, and its parent can stop it.
- It makes only these routed calls: `projects.match`, `threads.create`, `composer.options`, `threads.setPermissionMode`, `threads.setModel`, `orchestrator.send`, `runs.get`, `orchestrator.pendingQuestions`, `thread.snapshot`, `workspace.getStatus`, `orchestrator.abort` and `threads.settle` (archiving a thread it just made, when the task was refused). No terminal, file, Git or settings row.
- The thread there runs in the narrowest of the parent thread's mode, the parent's run and the limit that computer set for this one (it refuses a mode above that limit, so the service narrows to it first). A follow-up (`continue_subagent`) runs no looser than the run that sends it and the mode the subagent was started with. No fixed mode caps it (issue #1160): when that computer's limit for this one is Full access and the parent runs in Full access, the subagent runs in Full access there, so an agent on this computer can run commands on that one without anyone being asked. That limit starts at Auto-accept edits, so this happens only after a person on that computer raised it for this one. A task that is read-only here (`workspace: 'shared'`, or a plan ceiling) is sent in Plan mode.
- A thread another device started (a remote subagent's thread, or one a phone or another computer started) cannot start remote subagents, so a chain is one computer deep.
Expand All @@ -254,7 +254,7 @@ Seven routed rows take a key `agent: { thread, run, title, hops, mode }`: `threa
- **Who sets it.** Only the calling computer's daemon service. The router refuses it from a window (`invalid_params`; the key is in the rows, so it would otherwise pass through), and a phone's `threads.create` takes exact keys and the backend refuses the key outright. The key is never dropped for an older owner: the caller refuses to send a key the owner's version of the row does not know (`computer_outdated`), so an agent's message is never delivered as a person's. Any change to the key's shape or meaning raises the version of all seven rows. Its fields avoid `…Id`, so the id rewriting leaves them alone.
- **What the owner does with it** (`src/mms/bridge/routed/remoteAgent.ts`). The calling computer comes from the authenticated link and its name from the owner's own pairing record, never from the call. The call runs through a remote agent actor (`AgentActor.remote`) that carries the sender's mode and hop count, so nothing is looked up as if the sender were local (a lookup would find no run and fall back to the profile default, which can be Full access). Compared with the same call from a person on that device, a marked call runs as source `mcp` (no "Always" rules, no `person_turn`), in the narrowest of the mode it carried, the device limit and, for a message into an existing thread, the thread's own mode; its text is never read for `/skill` or workflow commands; it is refused while a question or approval waits (`questions_pending`); a steer into a run looser than the sender is refused (`ceiling_exceeded`); the owner builds the envelope itself (the sender's title cut to 80 characters with control, direction and zero-width characters removed, both envelope markers defused in the title and the body) and the body is at most 16,000 characters (`agent_message_too_long`); the thread, the run and a queued item record the calling computer (`sentFrom`, `run.sent_from`), so blocking the device takes the agent's work away too; and the audit row says `actor: agent` (`bridge_audit.actor`).
- **The owner's own limits**, each refused with its own code: agent messages in a row (the larger of the carried count and the owner's own count from the thread's latest run; `agent_hops_exceeded`), queued agent messages and repeats (the rules every agent's message has, on one computer or two: three waiting per sender and ten in all, `agent_queue_full_per_sender` and `agent_queue_full`, and the same text from the same sender within two minutes, `duplicate_message`, refused with the reason, never dropped; a sender on another computer is counted by its computer and thread), 20 messages per device and thread in 10 minutes (`agent_rate_limited`), and 200 agent-started runs per device a day (`agent_daily_budget`). The rate limit and the budget are counted from the audit, so a restart does not reset them. A follow-up from the agent that started the thread adds none of the owner's own count, as a follow-up to a subagent does on one computer.
- **Agent reach** (`net_node_policy.agent_reach`): which threads a device's agents may change, `none`, `launched` (default: threads they started here, from the owner's own `startedFrom`) or `all`, decided at each call. A marked Stop ends only runs an agent of that device started and leaves a thread a person took over. There is no setting in the app yet.
- **Agent reach** (`net_node_policy.agent_reach`): which threads a device's agents may change, `none`, `launched` (default: threads they started here, from the owner's own `startedFrom`) or `all`, decided at each call. A marked Stop ends only runs an agent of that device started and leaves a thread a person took over. A person on the owner sets it in Settings → Devices → Limits ("Agents on <device> may change") or with `mousse-cli bridge limits <node> --agent-reach`, through `bridge.policy`, a local method of the owner's own windows and command line that is never routed, so a device cannot widen its own reach. The device's activity list marks the calls its agents made ("by an agent").
- **Threads they start.** A marked `threads.create` records `startedFrom.agent { thread, title, mode }` and holds the thread to that mode from its first write, so a launch cut off later has already left a thread no wider than its launcher. `createdByThreadId` stays unset: a foreign id there would be rewritten to a thread of the owner that does not exist. A marked `threads.setPermissionMode` above that mode is refused (`agent_mode_above_thread`), and such a thread cannot start subagents on a third computer. The stored sender of a message is `origin.from { node, thread, run, title }` with no `origin.threadId`; the id rewriting leaves `from` unchanged on every computer.
- **A policy, not a boundary.** The owner cannot verify that a marked call came from an agent, so the mark only narrows: a marked call may do strictly less than the same call unmarked, and a caller that lies about it gains nothing. A process that controls the calling computer can still send unmarked calls, which the owner handles as a person's. The device limit, the block and the audit remain the controls against a computer that is not trusted.

Expand Down
22 changes: 17 additions & 5 deletions src/cli/commands/net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { NODE_CAPABILITIES, type NodeCapability } from '../../shared/net/capabil
import { NET_ERRORS, isNetErrorCode, type NetErrorCode } from '../../shared/net/errors'
import { isId } from '../../shared/net/ids'
import { isJoinVia } from '../../shared/net/via'
import { isAgentReach } from '../../shared/net/local'
import { isPermissionMode } from '../../shared/permissionMode'

export const NET_HELP = `Usage:
Expand Down Expand Up @@ -97,7 +98,7 @@ export const BRIDGE_HELP = `Usage:
mousse-cli bridge block <node-id>
mousse-cli bridge unblock <node-id>
mousse-cli bridge limits <node-id> [--max-mode ask|accept_edits|auto|full] [--terminal on|off]
[--editor on|off] [--bots on|off]
[--editor on|off] [--bots on|off] [--agent-reach none|launched|all]
mousse-cli bridge caps <node-id> --caps read,chat,write,settings
mousse-cli bridge kind <node-id> computer|phone
mousse-cli bridge threads [on|off]
Expand Down Expand Up @@ -354,7 +355,7 @@ export function prepareNetCommand(args: ParsedArgs): NetCliRequest {
'bridge.rename': [],
'bridge.setCaps': ['caps'],
'bridge.setKind': [],
'bridge.policy': args.subcommand === 'limits' ? ['max-mode', 'terminal', 'editor', 'bots'] : [],
'bridge.policy': args.subcommand === 'limits' ? ['max-mode', 'terminal', 'editor', 'bots', 'agent-reach'] : [],
'bridge.workOnThreads': [],
'bridge.shareBots': [],
'bridge.editorServer': []
Expand Down Expand Up @@ -625,10 +626,17 @@ export function prepareNetCommand(args: ParsedArgs): NetCliRequest {
const mode = stringFlag(args, 'max-mode'),
terminal = stringFlag(args, 'terminal'),
editor = stringFlag(args, 'editor'),
bots = stringFlag(args, 'bots')
if (mode === undefined && terminal === undefined && editor === undefined && bots === undefined)
bots = stringFlag(args, 'bots'),
reach = stringFlag(args, 'agent-reach')
if (
mode === undefined &&
terminal === undefined &&
editor === undefined &&
bots === undefined &&
reach === undefined
)
invalid(
'bridge limits requires --max-mode ask|accept_edits|auto|full, --terminal on|off, --editor on|off and/or --bots on|off.'
'bridge limits requires --max-mode ask|accept_edits|auto|full, --terminal on|off, --editor on|off, --bots on|off and/or --agent-reach none|launched|all.'
)
if (mode !== undefined) {
if (!isPermissionMode(mode)) invalid('--max-mode requires ask, accept_edits, auto or full.')
Expand All @@ -646,6 +654,10 @@ export function prepareNetCommand(args: ParsedArgs): NetCliRequest {
if (bots !== 'on' && bots !== 'off') invalid('--bots requires on or off.')
params.bots = bots === 'on'
}
if (reach !== undefined) {
if (!isAgentReach(reach)) invalid('--agent-reach requires none, launched or all.')
params.agentReach = reach
}
}
}
return {
Expand Down
2 changes: 2 additions & 0 deletions src/mms/bridge/deviceActivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function entryOf(
outcome: string
thread?: string
project?: string
actor?: 'agent'
}
): DeviceActivityEntry {
const entry: DeviceActivityEntry = {
Expand All @@ -98,6 +99,7 @@ function entryOf(
kind: row.kind,
outcome: row.outcome
}
if (row.actor === 'agent') entry.actor = 'agent'
if (row.thread) entry.thread = { id: row.thread, name: threadHere(services, row.thread)?.name ?? null }
if (row.project && !isHashedPath(row.project))
entry.project = { name: services.projects.getProject(row.project)?.name ?? null }
Expand Down
10 changes: 7 additions & 3 deletions src/mms/net/NetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import type {
import type { PermissionMode } from '../../shared/permissionMode'
import { routedVersions } from '../../shared/bridge/routed'
import { bridgeRemoteMethodNames } from '../bridge/remote/capabilities'
import type { NodePolicy } from './store/nodePolicy'
import type { AgentReach, NodePolicy } from './store/nodePolicy'
import type {
AddonRecordStore,
Clock,
Expand Down Expand Up @@ -150,7 +150,8 @@ const policyView = (policy: NodePolicy): BridgeNodePolicy => ({
maxPermissionMode: policy.maxPermissionMode,
terminal: policy.terminal,
editor: policy.editor,
bots: policy.bots
bots: policy.bots,
agentReach: policy.agentReach
})

interface NetConfiguration {
Expand Down Expand Up @@ -1036,7 +1037,10 @@ export class NetService {
: { maxPermissionMode: params.maxPermissionMode as PermissionMode }),
...(params.terminal === undefined ? {} : { terminal: params.terminal as boolean }),
...(params.editor === undefined ? {} : { editor: params.editor as boolean }),
...(params.bots === undefined ? {} : { bots: params.bots as boolean })
...(params.bots === undefined ? {} : { bots: params.bots as boolean }),
...(params.agentReach === undefined
? {}
: { agentReach: params.agentReach as AgentReach })
})
this.emit()
return { policy: policyView(policy) }
Expand Down
Loading
Loading