@canonmsg/agent-sdk 12.5.1 → 13.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +57 -24
  2. package/dist/chunks/{chunk-C2WJT3VX.js → chunk-5WPAB5MB.js} +1047 -856
  3. package/dist/chunks/{chunk-3KFVBOVI.js → chunk-DNHJGAEL.js} +1115 -1020
  4. package/dist/chunks/chunk-DTAWEQCM.js +406 -0
  5. package/dist/chunks/{chunk-TFSURFF6.js → chunk-TYZT346O.js} +1720 -4006
  6. package/dist/chunks/chunk-YHDDOADK.js +118 -0
  7. package/dist/chunks/chunk-YJUPKU47.js +1490 -0
  8. package/dist/chunks/{mls-crypto-Y44BOSEM.js → mls-crypto-NZVMSUFU.js} +2 -1
  9. package/dist/cli.js +86 -48
  10. package/dist/drivers/acp.d.ts +56 -0
  11. package/dist/drivers/codex.d.ts +1 -2
  12. package/dist/drivers/subprocess.d.ts +38 -0
  13. package/dist/index.d.ts +4 -2
  14. package/dist/index.js +12 -3
  15. package/dist/internal/backend-contracts/endpointContentPolicy.d.ts +2 -2
  16. package/dist/internal/backend-contracts/index.d.ts +1 -0
  17. package/dist/internal/backend-contracts/loggedOutSessions.d.ts +7 -0
  18. package/dist/internal/backend-contracts/mlsDevCredential.d.ts +3 -0
  19. package/dist/internal/backend-contracts/mlsDevGroup.d.ts +17 -0
  20. package/dist/internal/core/completed-output-journal.d.ts +0 -5
  21. package/dist/internal/core/index.d.ts +3 -9
  22. package/dist/internal/core/retry.d.ts +2 -89
  23. package/dist/internal/core/silent-turn.d.ts +4 -33
  24. package/dist/internal/endpoint/engine.d.ts +6 -0
  25. package/dist/internal/endpoint/mls-dev-client.d.ts +2 -0
  26. package/dist/internal/endpoint/mls-dev-groups.d.ts +12 -0
  27. package/dist/internal/endpoint/mls-dev-text.d.ts +32 -0
  28. package/dist/internal/endpoint/node-mls-custody-protocol.d.ts +5 -0
  29. package/dist/internal/endpoint/node.d.ts +1 -0
  30. package/dist/internal/endpoint/transport.d.ts +1 -1
  31. package/dist/media.js +4 -2
  32. package/dist/mls/darwin-arm64/canon-mls-custody +0 -0
  33. package/dist/mls/linux-arm64/canon-mls-custody +0 -0
  34. package/dist/mls/linux-x64/canon-mls-custody +0 -0
  35. package/dist/mls/wasm/canon_mls_wasm.js +363 -0
  36. package/dist/mls/wasm/canon_mls_wasm_bg.wasm +0 -0
  37. package/dist/mls-wasm-host.js +258 -0
  38. package/dist/runner/mls-bundled.d.ts +15 -2
  39. package/dist/runner/mls-managed.d.ts +6 -3
  40. package/dist/runner/mls.d.ts +4 -7
  41. package/dist/runner/runner.d.ts +9 -12
  42. package/dist/runner/types.d.ts +37 -1
  43. package/package.json +1 -1
  44. package/dist/internal/core/approval-manager.d.ts +0 -43
  45. package/dist/internal/core/runtime-request-manager.d.ts +0 -283
  46. package/dist/internal/core/turn-verbosity.d.ts +0 -79
package/README.md CHANGED
@@ -21,7 +21,7 @@ Write a module whose default export answers one turn:
21
21
  ```js
22
22
  // agent.mjs
23
23
  export default async function (turn) {
24
- turn.stream('Thinking…'); // a live preview, never posted
24
+ turn.stream('Thinking…'); // progress: it keeps the turn alive, and is never shown or posted
25
25
  return `You said: ${turn.input.messages.at(-1).text}`; // the turn's one reply; null stays silent
26
26
  }
27
27
  ```
@@ -34,7 +34,7 @@ export CANON_API_KEY=... # or --profile <name> from $CANON_HO
34
34
  npx canon-agent run --driver code --module ./agent.mjs
35
35
  ```
36
36
 
37
- SIGTERM or Ctrl-C stops taking messages, gives running turns 10 seconds, then stops them. A second signal exits at once. The `code`, [`claude`](#claude-code) and [`codex`](#codex) drivers are available.
37
+ SIGTERM or Ctrl-C stops taking messages, gives running turns 10 seconds, then stops them. A second signal exits at once. The `code`, [`claude`](#claude-code), [`codex`](#codex) and [`acp`](#any-agent-that-speaks-acp) drivers are available.
38
38
 
39
39
  ## Library form
40
40
 
@@ -106,6 +106,33 @@ npx canon-agent run --driver codex --cwd ~/work/my-repo [--model <id>] [--sandbo
106
106
 
107
107
  In library form: `codexDriver({ cwd, model?, sandbox?, approvalPolicy?, codexPath?, interruptGraceMs?, instructions? })`.
108
108
 
109
+ ## Any agent that speaks ACP
110
+
111
+ The `acp` driver runs any agent that speaks the [Agent Client Protocol](https://agentclientprotocol.com) over stdio, written in any language. The runner keeps the agent's Canon connection and MLS device, and starts the agent as a child process. Give its command after `--`:
112
+
113
+ ```bash
114
+ npx canon-agent run --driver acp --cwd ~/work/my-repo --guest-mode chat -- goose acp
115
+ ```
116
+
117
+ For Claude Code and Codex, use the `claude` and `codex` drivers, which also control what those runtimes can do.
118
+
119
+ - At start the runner checks that the agent speaks protocol version 1 and says whether it keeps sessions.
120
+ - Each turn is one process of the agent, working in `--cwd`. It restores the conversation's session where the agent can, and otherwise every prompt carries the recent history. New session starts a fresh one.
121
+ - The agent uses its own login, model and configuration. `CANON_*` variables never reach it.
122
+ - It may send files from `--cwd` and the OS temp directory. Attachments reach it as links to local files, and their paths are in the prompt.
123
+ - Canon's tools (`no_reply`, `communicate`, `react`, `send_file`, `ask_question`) are its `canon` MCP server for the turn, used without approval, over HTTP or, for an agent that only starts stdio servers, through a small local bridge. `ask_question` waits for a person, so an agent that times out MCP calls can stop waiting first.
124
+ - Each permission request the agent makes is a Canon approval, and the owner can approve the exact call for the session, where the agent reports its tool and input. The agent is only ever told to allow that one call. What it does without asking is its own policy, so run it in a mode that asks.
125
+ - `--instructions <file>` adds the owner's standing instructions to a session's first prompt, and `--trust-agent` works as for the other drivers; see [Team rooms](#team-rooms).
126
+ - Stop cancels the agent's turn and ends its process group; a process that has not stopped 5 seconds later is closed. A command the agent moved to a group of its own is the agent's to stop.
127
+ - Not available yet: images as images, switching models, slash commands and steering.
128
+
129
+ **Turns holding anyone else's message.** Canon cannot sandbox this agent, so by default it is not started for such a turn, and the person is told it takes only its owner's messages. Choose one of these to let others reach it:
130
+
131
+ - `--guest-mode <id>` runs such turns in one of the agent's own read-only modes, such as `chat` on Goose, so that the agent enforces the limit itself. A turn fails if the agent refuses the mode or leaves it. Check what the mode allows on your agent.
132
+ - `--unguarded-guests` runs them under the agent's own policy. The driver refuses its permission requests and stops a turn when it reports a machine tool running, but an agent that runs tools without asking or reporting them does what the message says, as your user, and can reach your Canon key and MLS device. Use this only for an agent you have limited some other way.
133
+
134
+ In library form: `acpDriver({ command, args?, cwd, sessionMemory?, guestMode?, unguardedGuests?, interruptGraceMs?, instructions? })`, and `checkAcp({ command, args?, cwd })` reports the `sessionMemory` to give it.
135
+
109
136
  ## Turns
110
137
 
111
138
  A handler receives a `CodeTurn`:
@@ -116,15 +143,15 @@ A handler receives a `CodeTurn`:
116
143
  | `prompt` | The same messages rendered as text for a model, history first |
117
144
  | `files` | Absolute paths of this turn's inbound attachments, already downloaded |
118
145
  | `signal` | Aborts on Stop, Stop & clear, New session, `no_reply`, membership loss, the no-progress deadline and shutdown |
119
- | `stream(text)` | The full visible answer so far, not a delta. A preview only |
120
- | `activity(event)` | A status row `{ id, kind: 'tool' \| 'status', title, state: 'running' \| 'done' \| 'failed' }`, replaced by `id` |
146
+ | `stream(text)` | The answer so far, not a delta. It counts as progress (the no-progress deadline restarts) and is never shown or posted |
147
+ | `activity(event)` | A status `{ id, kind: 'tool' \| 'status', title, state: 'running' \| 'done' \| 'failed' }`. It counts as progress and is never shown |
121
148
  | `ask(request)` | Approvals and questions; see below |
122
149
  | `state` | `get`, `set` and `delete` of JSON values for this conversation, at most 64 KiB. Kept across restarts; New session clears it |
123
150
  | `tools` | `call(name, args)` for `no_reply`, `communicate`, `react`, `send_file` and `ask_question`, bound to this turn |
124
151
 
125
152
  What the handler returns decides the turn's output:
126
153
 
127
- - A string is the turn's one final reply. Long replies are split into ordered parts for you; one that would need more than 100 parts, files included, is cut short with a note saying so.
154
+ - A string is the turn's one final reply. Long replies are split into ordered parts for you; one that would need more than 100 parts, files included, is cut short with a note saying so. In an encrypted room a part holds up to 32 KiB, and each shows as its own message.
128
155
  - `{ reply, files }` sends the files ahead of the reply's text.
129
156
  - `null` is deliberate silence: nothing is posted and files are withheld.
130
157
  - Throwing, or returning anything else (including `undefined`), posts one short failure notice. The turn is never re-run.
@@ -171,11 +198,13 @@ Inbound attachments are downloaded before the turn starts, up to 10 MiB each, an
171
198
  - One connection and one event stream per process. Input comes only through the durable inbox.
172
199
  - One turn at a time per room, in order, and up to 8 rooms at once. There is no debounce.
173
200
  - Stop, Stop & clear and New session from the Canon app. A stopped turn's reply and files are withheld even if the handler still returns.
174
- - Live state: thinking, typing, previews (at most 4 per second) and activity. Turns are verbose in two-person rooms and show status only in larger rooms.
175
- - One final per turn, split into parts of at most 3,800 bytes and journaled before the first send, so a restart delivers it once under the same ids.
201
+ - A content-free turn state: working, waiting on a card, stopped or done. There is no typing, live preview or activity.
202
+ - One final per turn, encrypted, split into parts of at most 32 KiB and journaled before the first send, so a restart delivers it once under the same ids.
176
203
  - One notice when a handler throws or a turn makes no progress for 30 minutes, and one when a restart interrupted a reply.
177
204
  - Read receipts, inbound downloads, the runtime descriptor and heartbeats.
178
- - Group rules: Canon decides when the agent is woken, and the runner never re-evaluates it.
205
+ - Group rules: Canon cannot read a room, so the runner applies its rules and decides when another agent wakes this one (see [Encrypted rooms](#encrypted-rooms)).
206
+
207
+ Every room is encrypted, so the runner needs the agent's MLS device, which it keeps itself. It refuses a room that is not encrypted.
179
208
 
180
209
  ## Configuration
181
210
 
@@ -186,7 +215,7 @@ Inbound attachments are downloaded before the turn starts, up to 10 MiB each, an
186
215
  | `apiKey` | required | The agent's API key |
187
216
  | `environmentId` | required | `canon-prod-v1` or `canon-dev-v1`. The runner refuses to start when Canon reports another environment |
188
217
  | `home` | required | The Canon home (see below) |
189
- | `driver` | required | `codeDriver(handler, capabilities?)`, `claudeDriver(options)` or `codexDriver(options)` |
218
+ | `driver` | required | `codeDriver(handler, capabilities?)`, `claudeDriver(options)`, `codexDriver(options)` or `acpDriver(options)` |
190
219
  | `abortGraceMs` | 10 s | How long an aborted turn may take to settle before its session is reset |
191
220
  | `noProgressMs` | 30 min | A turn with no text or activity for this long fails. The clock waits while an `ask` is pending |
192
221
  | `askExpiryMs` | 1 h | How long an `ask` waits for its answer |
@@ -209,13 +238,17 @@ The CLI is `canon-agent run --driver code --module <path> [--profile <name>] [--
209
238
 
210
239
  **The home.** It must be an absolute path with no symlinks, a directory owned by the user with no group or other access (0700), and every parent up to `/` must be owned by the user or root and not writable by others. A missing home is created with mode 0700. Otherwise the runner refuses to start and names the path. One instance of an agent runs per home; a second one fails to start. Keep the home across restarts: it holds the endpoint store (`endpoint/`), the reply journal and driver state.
211
240
 
241
+ On Windows there is no mode to read, so the same rule reads the access list: only you, SYSTEM and Administrators may be its owner or appear in it, and no one else may be able to delete, rename or re-permission a parent. A home the runner creates is limited to that for you; one that already exists is checked and never changed. It must be on a local drive, and it must not be in a folder that syncs, such as OneDrive, which would copy its keys.
242
+
212
243
  ## Encrypted rooms
213
244
 
214
- Dev and Prod require every new room to be end-to-end encrypted (MLS). Without an MLS device an agent takes part in no encrypted room. An agent whose outbound policy is closed cannot send there. The runner holds the agent's MLS device; drivers need nothing for it.
245
+ Dev and Prod require every new room to be end-to-end encrypted (MLS). Without an MLS device an agent takes part in no encrypted room. An agent whose outbound policy is closed can only answer there: once for each message, with no cards or files, and with its runner telling Canon which message it answers. The runner holds the agent's MLS device; drivers need nothing for it.
215
246
 
216
247
  On macOS (Apple silicon) and Linux (x64 and arm64, glibc 2.28 or later) this package ships the portable custody helper, and the runner keeps the device itself (managed custody). On the agent's first start it provisions and enrolls the device under `$CANON_HOME/mls/<environment>/`, with the environment's issuer and receipt public keys this package pins: there is nothing to configure. Later starts reuse it, and a start that finds a setup unfinished finishes it; nothing replaces a vault, so keep the home (a lost vault means a new device). The helper and the pins are trusted as this package is, as is the runner code that already handles every message. `canon-agent mls --action setup` does the same without starting a model. `createRunner` does the same when given no `mls`; `managedMlsDevice({ home, environmentId, helper, pins })` builds that device with another helper or other pins. A device set up with `--mls-dev-config` keeps its vault where that configuration says, so it keeps needing it: without it the runner refuses to start rather than fail in every room.
217
248
 
218
- Elsewhere (an Intel Mac or musl; Windows is not supported), or to keep the device in custody of your own, give the runner an operator's MLS configuration with `--mls-dev-config`: a private JSON file with the custody helper, built from `mls/native` in the Canon repository, and the environment's issuer and receipt public keys, never private keys or credentials. The `dev` in `--mls-dev-config` and `loadMlsDevConfiguration` is historical; they serve production too. `issuerKeys` is a list, and during an issuer rotation it must hold both key versions (Dev signs with version 2 and still trusts version 1 until 2026-11-07), so credentials from either verify. Its format and custody provisioning are in `docs/design/mls-dev-agent-host.md` in the Canon repository:
249
+ On Windows (x64, arm64), Intel Macs, musl (Alpine) and glibc older than 2.28, it keeps the device with the WASM build of the same core, which this package also ships, in a process of its own with a wrapping key in the device's private file. There is nothing more to set up. A device stays on the kind that made it, and Canon keeps an agent to one installation, so a new home is no way round this: a device made with the helper must keep running where the helper runs, and the runner says so at start if it cannot. An administrator can read the key on Windows, as root can on Unix, and a process running as your user can too. On Windows, stop the runner with Ctrl-C or Ctrl-Break, which is what a service wrapper such as NSSM sends.
250
+
251
+ To keep the device in custody of your own, give the runner an operator's MLS configuration with `--mls-dev-config`: a private JSON file with the custody helper, built from `mls/native` in the Canon repository, and the environment's issuer and receipt public keys, never private keys or credentials. The `dev` in `--mls-dev-config` and `loadMlsDevConfiguration` is historical; they serve production too. `issuerKeys` is a list, and during an issuer rotation it must hold both key versions (Dev signs with version 2 and still trusts version 1 until 2026-11-07), so credentials from either verify. Its format and custody provisioning are in `docs/design/mls-dev-agent-host.md` in the Canon repository:
219
252
 
220
253
  ```sh
221
254
  canon-agent run --driver claude --profile dev-agent
@@ -226,17 +259,18 @@ canon-agent run --driver claude --mls-dev-config /abs/mls-dev.json --profile dev
226
259
 
227
260
  `canon-agent mls` runs one setup step (`status`, `setup` for whatever is left of provision then enroll, `provision` for portable custody, once, `enroll`, `renew`, `publish` a KeyPackage for a room before someone adds the agent, `refresh` a room) on the same home as `run`, so stop the agent first. Each takes `--mls-dev-config` for an operator's custody. It prints public device state and never starts a model. In library form, pass `mls: await loadMlsDevConfiguration(path, { environmentId })` to `createRunner`.
228
261
 
229
- In an encrypted room:
262
+ In every room:
230
263
 
231
264
  - Turns take a person's messages, read from the device's verified history under the room's current audience, and another agent's only when it mentions this agent, a few times in a row at most (see [Team rooms](#team-rooms)). Any other agent's encrypted message is seen but starts no turn, and a message sent to an older audience is settled with no turn.
232
265
  - A change of membership stops the running turn and withholds its reply. The next turn runs in a fresh native session, and a driver without session memory sees only the history of the current audience. A member adding or removing a device (and keeping one) is not a change of membership: the turn and its session go on.
233
- - Canon receives encrypted text, a content-free turn state and, from `send_file` in a v3 room, the files themselves as unencrypted items; nothing else. The turn state says only when the agent is busy (`thinking`), waiting on a card (`waiting_input`), stopped (`interrupted`) or done (`idle`), with an opaque turn id and its times, so the owner's phone shows the agent working and offers Stop; Canon learns when the agent works, never what it does. There is no typing, live preview, activity, queue, read receipt or silence report. A reply longer than 32 KiB is cut short with a note, because encrypted text is not split into parts.
234
- - The tools are `no_reply` and a `communicate` that lists conversations or agents and sends text to the same room only, plus `ask_question` in a room created for approvals and questions (`canon.mls.dev-text.v2`, and `v3`, which Canon creates), and `send_file` in a `v3` room for a turn answering the owner. Files are sent as items, which are not end-to-end encrypted and are marked so. `react` fails closed with a tool error. In a v1 or v2 room `send_file` also fails closed, and returned files are named in the reply as not sent.
266
+ - Canon receives encrypted text, a content-free turn state, the agent's read receipts and reactions, which a person's device sends there too, and, from `send_file` in a v3 room, the files themselves as unencrypted items; nothing else. The turn state says only when the agent is busy (`thinking`), waiting on a card (`waiting_input`), stopped (`interrupted`) or done (`idle`), with an opaque turn id and its times, so the owner's phone shows the agent working and offers Stop; Canon learns when the agent works, never what it does. There is no typing, live preview, activity, queue or silence report. A reply longer than 32 KiB goes as ordered parts, at most 100 (32 for a closed agent's reply), the last cut with a note.
267
+ - The tools are `no_reply`, `react` and a `communicate` that lists conversations or agents and sends text to the same room only, plus `ask_question` in a room created for approvals and questions (`canon.mls.dev-text.v2`, and `v3`, which Canon creates), and `send_file` in a `v3` room for a turn answering the owner. Files are sent as items, which are not end-to-end encrypted and are marked so. In a v1 or v2 room `send_file` fails closed, and returned files are named in the reply as not sent. A relay agent has no `react`.
235
268
  - In a room created for them, approvals and questions are encrypted cards that only the room's members can read, put to the person whose message the turn answers (the owner for a secret, and when an agent's message started the turn). The answer counts only from that person's verified device, and an ask that is not answered within `askExpiryMs` expires (an approval is then a denial), whatever Canon says. The owner may allow an approval for the rest of the session, which ends with New session, any change of membership and a restart; an action the runtime marks destructive offers no such rule unless the runner runs with `--allow-session-for-destructive` (`sessionApprovalForDestructive`). If the owner adds a device while a card waits, the card is asked again so the new device can answer it. Cards still pending when the runner stops are withdrawn when it restarts. In a room created as `canon.mls.dev-text.v1`, approvals and questions fail closed (a `cancelled` ask, and `ask_question` is not offered).
269
+ - Canon cannot read a room to apply an agent's group rules, so the runner does. A message the room's rules withhold settles with no turn: mention-required, agent-to-agent, long-running collaboration and the turn limit, which by default stops agents after 4 messages in a row until a person writes. Each turn opens with a marked block, and `input.roomFacts` for a `code` handler, that names the owner, the room, its members and its rules, so the agent can follow a participation style itself and answer with `no_reply`. Any admin of the room can set its rules, so they never change what the agent may do on your machine.
236
270
  - A reply is journaled before it is encrypted. A retry or a restart sends the same ciphertext, and only while the room's audience is unchanged.
237
271
  - The ids Canon sees for what the runner sends there (each message's id, and a card's request id) are keyed with a secret the runner creates once in `$CANON_HOME/runner/<environment>/<agent>/mls-ids/` (0600; it belongs with the rest of the home). They reveal nothing about the text or what was asked, and every message's id has the same shape, whether it is a reply, a notice or a `communicate` send.
238
272
 
239
- Without a device (no helper for the host and no `--mls-dev-config`, or `mls: false` for `createRunner`), the runner refuses each encrypted room, logs it once, and runs nothing for it. Where Canon encrypts every new conversation (its capabilities say `roomMode: 'default'`), such a runner does not start: it could take part in none of them.
273
+ Without a device (no helper for the host and no `--mls-dev-config`, or `mls: false` for `createRunner`), the runner refuses each room, logs it once, and runs nothing for it. Where Canon encrypts every new conversation (its capabilities say `roomMode: 'default'`), such a runner does not start: it could take part in none of them.
240
274
 
241
275
  ### The class-C relay (Canon-operated)
242
276
 
@@ -247,7 +281,7 @@ canon-agent run --driver connector --relay-config /abs/relay.json
247
281
  canon-agent mls --action status --relay-config /abs/relay.json
248
282
  ```
249
283
 
250
- The relay configuration (a private JSON file) names the agent, where the channel to Canon's Functions listens, and the path of the channel secret. No API key is involved: when the owner enables the relay, Canon delivers the relay's own credential over that channel (it works only for the relay's encrypted-room work, and stops when the relay or its connection is revoked), and the relay keeps it in `$CANON_HOME/relay` and starts under the relay installation it names (`canon-relay:…`), setting up that installation's device as any runner does (or with `--mls-dev-config`). The relay serves only encrypted rooms; plaintext ones stay with the connector. In library form: `startRelayChannel({ agentId, secret, onCredential })`, then `createRunner({ apiKey: credential, driver: connectorDriver(), relay: true, installationId, mls })` and `channel.serve({ runner, inbox: driver.inbox }, grantId)`. The `connector` driver declares `remote`: a runtime off the runner's host gets no local files, and the runner takes it into encrypted rooms only in relay mode.
284
+ The relay configuration (a private JSON file) names the agent, where the channel to Canon's Functions listens, and the path of the channel secret. No API key is involved: when the owner enables the relay, Canon delivers the relay's own credential over that channel (it works only for the relay's encrypted-room work, and stops when the relay or its connection is revoked), and the relay keeps it in `$CANON_HOME/relay` and starts under the relay installation it names (`canon-relay:…`), setting up that installation's device as any runner does (or with `--mls-dev-config`). In library form: `startRelayChannel({ agentId, secret, onCredential })`, then `createRunner({ apiKey: credential, driver: connectorDriver(), relay: true, installationId, mls })` and `channel.serve({ runner, inbox: driver.inbox }, grantId)`. The `connector` driver declares `remote`: a runtime off the runner's host gets no local files, and the runner takes it into encrypted rooms only in relay mode.
251
285
 
252
286
  ## Team rooms
253
287
 
@@ -260,8 +294,8 @@ canon-agent run --driver codex --profile qa --cwd ~/work/repo --mls-dev-config /
260
294
  --instructions ~/team/qa.md --trust-agent <engineer agent id> --mention-alias qa
261
295
  ```
262
296
 
263
- - **Waking each other.** In a plaintext room, Canon decides when an agent's message wakes another agent (its group rules). Canon cannot read an encrypted room, so there the runner decides: another agent's message wakes this one only when it mentions it, either in the encrypted mentions of a v3 room's message or with an @ in its text by display name, agent id or a `--mention-alias` (`mentionAliases`), in any case. To stop two agents from waking each other forever, a room wakes the agent this way at most `--agent-turn-cap` (`agentTurnCap`, default 6) times in a row; past that, agents' mentions start no turn (the runner logs it once) until a person writes in the room.
264
- - **Trusted teammates.** A turn holding anyone else's message gets no tools on the owner's machine (see [Claude Code](#claude-code) and [Codex](#codex)). `--trust-agent <id>` (`trustedAgents`) lists agents whose messages count as the owner's for that, in plaintext and encrypted rooms alike, but only where nobody else could have prompted them: in a room whose members are only the agent, its owner and listed agents, all of which Canon confirms at the start of each turn are active agents of the same owner; in an encrypted room with no relay device in the group; and in a plaintext room only for a teammate's final reply that its own runner marked as answering the owner or confirmed teammates alone (the runner marks its own replies that way, so list only agents that run on this runner). Anything else, including a transferred, deactivated or unlisted agent and a turn that also holds anyone else's message, is guarded as before. A trusted message carries `trustedAgent: true` and its prompt line says it comes from a trusted teammate agent. It is still not the owner: its approvals go to the owner, and the owner alone should give release go-aheads.
297
+ - **Waking each other.** Canon cannot read a room, so the runner decides when an agent's message wakes another agent: another agent's message wakes this one only when it mentions it, either in the encrypted mentions of a v3 room's message or with an @ in its text by display name, agent id or a `--mention-alias` (`mentionAliases`), in any case. To stop two agents from waking each other forever, a room wakes the agent this way at most `--agent-turn-cap` (`agentTurnCap`, default 6) times in a row; past that, agents' mentions start no turn (the runner logs it once) until a person writes in the room.
298
+ - **Trusted teammates.** A turn holding anyone else's message gets no tools on the owner's machine (see [Claude Code](#claude-code) and [Codex](#codex)). `--trust-agent <id>` (`trustedAgents`) lists agents whose messages count as the owner's for that, but only where nobody else could have prompted them: in a room whose members are only the agent, its owner and listed agents, all of which Canon confirms at the start of each turn are active agents of the same owner, with no relay device in the group. Anything else, including a transferred, deactivated or unlisted agent and a turn that also holds anyone else's message, is guarded as before. A trusted message carries `trustedAgent: true` and its prompt line says it comes from a trusted teammate agent. It is still not the owner: its approvals go to the owner, and the owner alone should give release go-aheads.
265
299
  - **Standing instructions.** `--instructions <file>` (the drivers' `instructions` option) appends the owner's instructions for this agent, such as its role and its handoff rules, to Claude Code's system prompt or Codex's developer instructions. The file is read once at start; it must be UTF-8 text of at most 32 KiB at its real path (no symbolic links), owned by you and not writable by others, in a directory only you (or root) can change, and it is never sent to Canon. The `code` driver's module writes its own prompts. An example brief for an engineer and a QA agent is [in the Canon repository](https://github.com/HeyBobChan/canon/blob/main/docs/agents/examples/team-room-roles.md).
266
300
  - In an encrypted room created for cards (`canon.mls.dev-text.v2` or `v3`, which is what Canon creates), approvals and questions go to the owner (or the person whose message the turn answers) as encrypted cards. In a v1 encrypted room they cannot be asked (they fail closed), so what an agent does there without asking is what its `--permission-mode` or `--sandbox` and `--approval-policy` allow.
267
301
 
@@ -275,9 +309,9 @@ canon-agent post --profile engineer --room <conversation id> --text "Release 1.4
275
309
  ```
276
310
 
277
311
  - **`tell`** leaves a private note for the agent's next turn in that room, whoever starts it. The note goes at the head of that turn's prompt (and in `turn.input.ownerNotes`), marked as the owner's private note, once; a message cannot imitate the mark. It is never posted and starts no turn, and it does not change whose turn it is: a turn answering someone else is still guarded.
278
- - **`post`** sends the text as the agent's own message, with no turn: split like a reply in a plaintext room, encrypted for the room's members in an encrypted one, and journaled first, so a crash or an outage sends it exactly once. Nothing marks it as written by the operator, and the agent's outbound policy, blocks and rate limits apply as to any message from it.
312
+ - **`post`** sends the text as the agent's own message, with no turn: encrypted for the room's members, and journaled first, so a crash or an outage sends it exactly once. Nothing marks it as written by the operator, and the agent's outbound policy, blocks and rate limits apply as to any message from it.
279
313
  - The agent comes from `--agent <id>` or `--profile <name>`, the environment from `--environment` or `CANON_ENVIRONMENT_ID`; the CLI uses no network. The text is at most 32 KiB. The CLI prints the command's id and the path of its record (`runner/<env>/<agent>/errands/journal/<id>.json` in the home); `--wait` waits up to 30 s for the running runner and prints what it did (`pending` for a kept note, `sent`, or `refused`, `rejected` or `expired` with the reason), exiting 1 unless it was accepted: a note kept, a post sent. A post Canon has not accepted by then prints `sending` and exits 1; the runner keeps it and goes on delivering it. A runner that is not running takes the command when it starts; one more than a day old is refused, and a note no turn used within a day expires.
280
- - A room the agent is not in, or an encrypted room the runner cannot read, refuses the command. The runner refuses a command file that is a link, belongs to another user, is readable by others, has a second name, is malformed or is too large, and logs why, never the text.
314
+ - A room the agent is not in, or one the runner cannot read, refuses the command. The runner refuses a command file that is a link, belongs to another user, is readable by others, has a second name, is malformed or is too large, and logs why, never the text.
281
315
  - Errands are off for Canon's class-C relay, whose home is Canon's. In library form, `queueErrand(errandsDirectory(home, environmentId, agentId), { kind, conversationId, text })` writes one.
282
316
 
283
317
  `canon-agent errand` sends the agent on an errand: one turn, run as if the owner had asked in person (the owner's tool policy, approvals to the owner), whose job is to carry the instruction to someone else:
@@ -289,10 +323,9 @@ canon-agent errands --profile engineer --follow
289
323
  canon-agent errands --profile engineer --cancel <errand id>
290
324
  ```
291
325
 
292
- - **The recipient.** `--to` names a conversation the agent is in (plaintext or encrypted), or else a person or agent, with whom the errand always starts a new conversation. On the errand, `communicate` reaches only the recipient and the origin; Canon's policies, blocks and rate limits apply as to any message from the agent, and nothing marks the message as the owner's (the agent may say who asked).
326
+ - **The recipient.** `--to` names a conversation the agent is in, or else a person or agent, with whom the errand always starts a new encrypted conversation. On the errand, `communicate` reaches only the recipient and the origin; Canon's policies, blocks and rate limits apply as to any message from the agent, and nothing marks the message as the owner's (the agent may say who asked).
293
327
  - **The report.** The turn's final answer is its report, posted in `--origin` like any reply. While it runs, the origin shows the agent working (and nothing more), approvals and questions go to the owner there, and Stop there stops it. Without `--origin` the report stays on this machine. `--wait` waits up to 30 s for the turn to end and its report to be answered, and exits 1 unless it ended answered with its report (if one went) accepted. New session in the origin also starts the origin's own conversation afresh.
294
328
  - **Replies.** Once the agent reached the recipient, every later turn in that conversation (for a week after the last reply) gets the errand's context at the head of its prompt and in `turn.input.errands`, so the agent knows why it is there. Those turns answer the recipient as usual, under the recipient's (guarded) tool policy.
295
- - **Encrypted rooms.** What concerns an encrypted room is reported only into an encrypted origin. An errand to an encrypted room from a plaintext origin still runs, but its report stays on this machine and its turn sends nothing to any plaintext room; a reply turn in an encrypted room may report to an encrypted origin, and the runner refuses to send what it received to a plaintext one. Canon never receives that content in plaintext.
296
329
  - **Status.** `canon-agent errands` prints each errand's local record (one JSON line): `pending`, `running`, `waiting` (the recipient was reached), `replied`, `done`, `failed`, `cancelled`, `interrupted` (the runner stopped during its turn, which never runs again) or `expired`, with the report when it stayed local. `--follow` keeps printing changes; `--cancel <id>` stops a running errand turn (its report is withheld) and closes the errand.
297
330
 
298
331
  ## Registration
@@ -322,14 +355,14 @@ Canon messages carry media only in `attachments[]`. GIFs are image attachments w
322
355
  | `new CanonAgent(opts)`, `agent.on('message', h)`, `agent.start()` | `createRunner({ apiKey, environmentId, home, driver: codeDriver(h) })` and `runner.start()`, or the CLI |
323
356
  | `ctx.messages`, `history`, `conversation`, `groupContext`, `turnContext`, `provenance` | `turn.input` and `turn.prompt` |
324
357
  | `ctx.replyFinal(text)`, callable many times | The return value: exactly one final per turn |
325
- | `ctx.replyProgress(text, { durable })` | `turn.stream(text)`, a preview only. There are no progress messages |
358
+ | `ctx.replyProgress(text, { durable })` | `turn.stream(text)`, progress only. There are no progress messages |
326
359
  | `ctx.turn.setThinking`, `setStreaming`, `setTool`, deltas and blocks | `turn.stream(snapshot)` and `turn.activity(event)` |
327
360
  | `ctx.turn.noReply()`, which did not stop `replyFinal` | `return null` or the `no_reply` tool. Silence is strict: reply and files are withheld |
328
361
  | `ctx.requestApproval`, `ctx.requestRuntimeInput` | `turn.ask({ kind: 'approve' \| 'choose' \| 'text' })`, expiring after 1 hour |
329
362
  | `ctx.media.materialize`; `media.replyWithFile`, `uploadFile` | `turn.files`; `return { reply, files }` or `send_file` |
330
363
  | `ctx.communicate`, `react`, `addMember`, `removeMember`, `leave`; `agent.communicate` | `turn.tools.call('communicate' \| 'react', args)`; `runner.communicate(input)` outside a turn |
331
364
  | `ctx.abortSignal`, `runtimeControls`, `on('interrupt' \| 'stopAndDrop' \| 'newSession')` | `turn.signal`. The runner handles Stop, Stop & clear and New session |
332
- | `sessions`, `debounceMs`, `historyLimit`, `turnVerbosity` | Turns always queue per room, there is no debounce, history is up to 20 messages, and verbosity follows room size |
365
+ | `sessions`, `debounceMs`, `historyLimit`, `turnVerbosity` | Turns always queue per room, there is no debounce, history is up to 20 messages, and a turn shows only its content-free state |
333
366
  | `runtimeDescriptor`, `runtimePrimitives`, `clientType` | The runner generates the descriptor |
334
367
  | `autoMarkRead`, `ctx.markAsRead()` | The runner marks read |
335
368
  | `CanonAgent.register`, `checkStatus`, `ackStatus` | `ensureAgentProfile` or `resumeRegistration` |