@bastani/atomic 0.10.14 → 0.10.15-alpha.1
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.
- package/CHANGELOG.md +17 -0
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +3 -3
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +3 -3
- package/dist/_shared/mode-shared-2QJSCUM6.js +3 -3
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/runtime-O4KCSG4C.js +2 -2
- package/dist/_shared/{sdk-B5LEWGGI.js → sdk-OHKMDJ74.js} +27 -5
- package/dist/_shared/{sdk-B5LEWGGI.js.map → sdk-OHKMDJ74.js.map} +1 -1
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/startup-0-0-Q3MWKUK4.js +2 -2
- package/dist/_shared/startup-0-1-M6OWAYHH.js +2 -2
- package/dist/_shared/{startup-0-2-5QHPCEON.js → startup-0-2-2HUMCPKX.js} +14 -16
- package/dist/_shared/startup-0-2-2HUMCPKX.js.map +1 -0
- package/dist/_shared/startup-0-3-4ZYBYQNM.js +3 -3
- package/dist/_shared/startup-0-4-ZMJV547D.js +3 -3
- package/dist/_shared/startup-0-5-YDW47QX6.js +3 -3
- package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
- package/dist/_shared/startup-14-0-MLX36RBG.js +1 -1
- package/dist/_shared/startup-15-0-YUKGAC63.js +1 -1
- package/dist/_shared/startup-15-1-4S7FLMNG.js +6 -30
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +3 -3
- package/dist/_shared/startup-8-1-LZFXSD3Z.js +3 -3
- package/dist/_shared/storage-command-7MGXLJGZ.js +2 -2
- package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/auth-cli.code.js +1 -1
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +3 -3
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +1 -1
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +1 -1
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +1 -1
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +1 -1
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/compaction/compactor.d.ts +0 -8
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +2 -2
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/intercom-broker-control-host.code.js +1 -1
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +2 -2
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/sdk.code.js +1 -1
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +3 -3
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/node-sqlite-thread.js +2 -2
- package/dist/core/storage/node-sqlite.js +2 -2
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +2 -2
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +2 -2
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/expanded-child-details.code.js +2 -2
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-staging.code.js +1 -1
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-window.code.js +2 -2
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.code.js +2 -2
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +1 -1
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +2 -2
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-session-store.code.js +1 -1
- package/dist/core/storage/session/sql-session-store.impl.js +3 -3
- package/dist/core/storage/session/sql-session-store.js +3 -3
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.code.js +1 -1
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +2 -2
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +2 -2
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.js +2 -2
- package/dist/core/worktree-snapshot/errors.code.js +1 -1
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +1 -1
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.code.js +1 -1
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index.d.ts +21 -1
- package/dist/index.js +2 -2
- package/dist/main-first-time-setup.code.js +1 -1
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/modes/print-mode.js +1 -1
- package/dist/package-manager-cli.code.js +2 -2
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/6.js +1 -1
- package/dist/utils/startup-database-spare.code.js +1 -1
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/background-tasks/reference.md +182 -0
- package/docs/background-tasks.md +98 -405
- package/docs/build.md +67 -27
- package/docs/changelog.mdx +1 -1
- package/docs/codemode.md +108 -39
- package/docs/compaction/branch-summaries.md +54 -0
- package/docs/compaction/custom-compactors.md +161 -0
- package/docs/compaction/memory-compaction.md +77 -0
- package/docs/compaction/reference.md +86 -38
- package/docs/compaction.md +51 -252
- package/docs/computer-use.md +169 -321
- package/docs/containerization.md +71 -57
- package/docs/custom-provider/api-reference.md +119 -25
- package/docs/custom-provider/oauth.md +114 -132
- package/docs/custom-provider/override.md +37 -27
- package/docs/custom-provider/registration.md +107 -83
- package/docs/custom-provider/streaming.md +85 -71
- package/docs/custom-provider.md +85 -52
- package/docs/development.md +39 -29
- package/docs/docs.json +76 -63
- package/docs/environment-variables.md +94 -44
- package/docs/extensions/api-reference.md +86 -43
- package/docs/extensions/authoring.md +162 -154
- package/docs/extensions/events.md +80 -25
- package/docs/extensions/examples.md +90 -85
- package/docs/extensions/ui.md +206 -82
- package/docs/extensions.md +79 -108
- package/docs/getting-started/authentication.md +67 -36
- package/docs/getting-started/first-session.md +53 -43
- package/docs/getting-started/installation.md +116 -89
- package/docs/getting-started/project-instructions.md +48 -34
- package/docs/guides/configuration.md +82 -20
- package/docs/guides/non-interactive.md +66 -24
- package/docs/guides/resume-on-any-machine.md +135 -82
- package/docs/guides/team-setup.md +114 -105
- package/docs/guides.md +76 -32
- package/docs/herdr.md +15 -16
- package/docs/how-atomic-works.md +140 -0
- package/docs/index.md +58 -44
- package/docs/intercom/operations.md +141 -151
- package/docs/intercom/reference.md +85 -108
- package/docs/intercom.md +84 -145
- package/docs/json.md +120 -67
- package/docs/keybindings.md +85 -49
- package/docs/libraries/agent-core.md +137 -275
- package/docs/libraries/ai.md +100 -84
- package/docs/libraries/codemode.md +210 -300
- package/docs/libraries/schema.md +59 -53
- package/docs/libraries/storage-postgres.md +49 -35
- package/docs/libraries/telemetry.md +153 -354
- package/docs/libraries/tui.md +265 -393
- package/docs/libraries.md +42 -26
- package/docs/llama-cpp.md +171 -161
- package/docs/mcp-servers.md +90 -51
- package/docs/models/choose-a-model.md +188 -0
- package/docs/models/reference.md +74 -30
- package/docs/models.md +153 -88
- package/docs/orchestration/migrating-workflows.md +23 -16
- package/docs/orchestration/patterns.md +39 -44
- package/docs/orchestration.md +65 -26
- package/docs/packages/authoring.md +51 -29
- package/docs/packages/reference.md +42 -21
- package/docs/packages.md +69 -58
- package/docs/programmatic.md +118 -24
- package/docs/prompt-templates.md +84 -83
- package/docs/providers/reference.md +43 -48
- package/docs/providers.md +219 -451
- package/docs/quickstart.md +140 -120
- package/docs/reference/cli.md +135 -97
- package/docs/reference.md +20 -18
- package/docs/rpc/examples.md +76 -20
- package/docs/rpc/extension-ui.md +64 -38
- package/docs/rpc/protocol.md +361 -110
- package/docs/rpc.md +57 -17
- package/docs/sdk/reference.md +409 -534
- package/docs/sdk/storage.md +53 -13
- package/docs/sdk/structured-decisions.md +82 -56
- package/docs/sdk/web-server.md +57 -43
- package/docs/sdk.md +106 -84
- package/docs/security.md +42 -64
- package/docs/session-format.md +62 -38
- package/docs/sessions.md +99 -214
- package/docs/settings.md +165 -195
- package/docs/shell-aliases.md +9 -6
- package/docs/skills/authoring.md +69 -48
- package/docs/skills/reference.md +51 -20
- package/docs/skills.md +99 -148
- package/docs/slash-commands.md +129 -0
- package/docs/storage/custom-adapters.md +160 -85
- package/docs/storage/jsonl.md +81 -66
- package/docs/storage/postgres/pgbouncer.md +120 -126
- package/docs/storage/postgres/tuning.md +120 -143
- package/docs/storage/postgres.md +314 -330
- package/docs/storage/sqlite.md +71 -42
- package/docs/storage.md +298 -302
- package/docs/subagents/authoring.md +55 -38
- package/docs/subagents/reference.md +73 -33
- package/docs/subagents.md +119 -187
- package/docs/terminal-setup.md +50 -38
- package/docs/termux.md +67 -41
- package/docs/themes/reference.md +23 -19
- package/docs/themes.md +142 -127
- package/docs/tmux.md +47 -55
- package/docs/tools.md +147 -109
- package/docs/tui/reference.md +166 -214
- package/docs/tui.md +196 -341
- package/docs/usage.md +118 -138
- package/docs/verification.md +79 -51
- package/docs/web-access.md +121 -101
- package/docs/windows.md +26 -27
- package/docs/worktree-snapshots/reference.md +245 -0
- package/docs/worktree-snapshots.md +71 -259
- package/package.json +8 -8
- package/dist/_shared/startup-0-2-5QHPCEON.js.map +0 -1
- package/docs/guides/intercom.md +0 -32
- package/docs/guides/orchestration.md +0 -28
- package/docs/guides/subagents.md +0 -37
package/docs/rpc.md
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "RPC
|
|
3
|
-
sidebarTitle: "RPC
|
|
4
|
-
description: "Drive a long-lived Atomic process over stdin and stdout using newline-delimited JSON commands and events."
|
|
2
|
+
title: "Drive Atomic over RPC"
|
|
3
|
+
sidebarTitle: "Drive over RPC"
|
|
4
|
+
description: "Drive a long-lived Atomic process over stdin and stdout using newline-delimited JSON commands, concurrency lanes, and streamed events."
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
RPC mode runs Atomic headless over a JSON Lines protocol on stdin and stdout. Use it to integrate Atomic into non-Node languages, editors, IDEs, or custom UIs.
|
|
8
8
|
|
|
9
|
-
If you are building a Node.js or TypeScript application, you can embed `AgentSession` directly with the [TypeScript SDK](/sdk) or use the typed `RpcClient` exported from `@bastani/atomic` (see [RPC
|
|
9
|
+
If you are building a Node.js or TypeScript application, you can embed `AgentSession` directly with the [TypeScript SDK](/sdk) or use the typed `RpcClient` exported from `@bastani/atomic` (see [Connect with RPC clients](/rpc/examples)). Compare all four programmatic modes on [Choose an integration mode](/programmatic).
|
|
10
10
|
|
|
11
11
|
## Reference pages
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
<Columns cols={2}>
|
|
14
|
+
<Card title="RPC protocol reference" href="/rpc/protocol">
|
|
15
|
+
Every RPC command, streamed event, structured error code, and JSON wire type.
|
|
16
|
+
</Card>
|
|
17
|
+
<Card title="Handle extension UI over RPC" href="/rpc/extension-ui">
|
|
18
|
+
Answer extension dialogs, notifications, widgets, questionnaires, and OAuth prompts.
|
|
19
|
+
</Card>
|
|
20
|
+
<Card title="Connect with RPC clients" href="/rpc/examples">
|
|
21
|
+
TypeScript `RpcClient` recipes, caveats, and a standalone Node.js client.
|
|
22
|
+
</Card>
|
|
23
|
+
<Card title="Stored session summaries" href="/rpc/protocol#stored-session-summaries">
|
|
24
|
+
Inspect saved sessions with `get_session_summary` and `list_sessions` without starting a model turn.
|
|
25
|
+
</Card>
|
|
26
|
+
</Columns>
|
|
17
27
|
|
|
18
28
|
## Starting RPC mode
|
|
19
29
|
|
|
@@ -36,19 +46,42 @@ Common startup options:
|
|
|
36
46
|
- `--storage '<json>'` / `--storage-file <path>`: select storage for this process's sessions.
|
|
37
47
|
- `--tools <list>` / `--no-tools` / `--exclude-tools <list>`: control which tools are active.
|
|
38
48
|
|
|
49
|
+
<Note>
|
|
50
|
+
`@file` CLI arguments are **not supported** in RPC mode; passing any `@file` argument writes an error to stderr and exits immediately with code `1`. Send file content or base64 `images` inside `prompt`, `steer`, or `follow_up` commands instead.
|
|
51
|
+
</Note>
|
|
52
|
+
|
|
39
53
|
To isolate an RPC subprocess's session store without changing user settings, start it with `ATOMIC_STORAGE` or `--storage` set to the same JSON object as the `storage` setting (for example, an adapter config reading secrets from `{ "env": "..." }`). `list_sessions` reports that store while other `atomic` processes keep their own settings. Invalid storage selections fail at startup with `StorageConfigError`. See [Selecting storage per process](/storage#selecting-storage-per-process).
|
|
40
54
|
|
|
41
55
|
## Protocol overview
|
|
42
56
|
|
|
43
|
-
- **Commands
|
|
44
|
-
- **Responses
|
|
45
|
-
- **Events
|
|
57
|
+
- **Commands:** JSON objects written to stdin, one per line.
|
|
58
|
+
- **Responses:** JSON objects with `type: "response"` reporting command success or failure.
|
|
59
|
+
- **Events:** session events streamed to stdout as JSON lines.
|
|
46
60
|
|
|
47
61
|
Every command accepts an optional `id` string for request correlation. When you send `id`, the matching response echoes the same `id`.
|
|
48
62
|
|
|
49
63
|
If a saved default `provider/model` names a provider that remains unsupported after startup, the process stays alive and `prompt` returns a correlated error containing the configuration diagnostic before emitting any event. Non-prompt commands such as `get_available_models` keep working. Clear the error state with a successful explicit `set_model`, or a `cycle_model` that switches to a different available model (an unchanged or `null` cycle does not clear it). Supported providers with an unknown model or missing credentials fall back automatically as usual.
|
|
50
64
|
|
|
51
|
-
On compacted or branched sessions, `get_entries` and `get_tree` return the loaded context window, while `get_fork_messages` still includes prompts from older branches using short picker labels. Use [`get_history_page`](/rpc/protocol#get_history_page) (following `nextCursor`) and `get_history_chunk` to read older entries and oversized items.
|
|
65
|
+
On compacted or branched sessions, `get_entries` and `get_tree` return the loaded context window, while `get_fork_messages` still includes prompts from older branches using short picker labels. Use [`get_history_page`](/rpc/protocol#get_history_page) (following `nextCursor`) and [`get_history_chunk`](/rpc/protocol#get_history_chunk) to read older entries and oversized items.
|
|
66
|
+
|
|
67
|
+
### Waiting for turns to finish (`agent_settled` vs. `agent_end`)
|
|
68
|
+
|
|
69
|
+
A single `prompt` can trigger retries, model fallbacks, automatic compaction recovery, or queued turns:
|
|
70
|
+
|
|
71
|
+
- Check the `prompt` response's `data.disposition` first. If `disposition` is `"handled"`, an extension command or input hook consumed the message and **no turn started** — do not wait for `agent_end` or `agent_settled`.
|
|
72
|
+
- `agent_end` fires after **one** low-level agent loop finishes, even when a retry (`retryPending: true`), post-compaction continuation, or queued follow-up is about to run next.
|
|
73
|
+
- **`agent_settled`** fires once the entire turn chain finishes with no automatic work remaining (`{ "type": "agent_settled", "aborted": false }`). Wait for `agent_settled` rather than `agent_end` before closing stdin or treating a multi-step prompt as done.
|
|
74
|
+
|
|
75
|
+
## Command execution and concurrency
|
|
76
|
+
|
|
77
|
+
Atomic dispatches stdin frames across two lanes so cancellations and extension UI replies are never blocked behind slow commands:
|
|
78
|
+
|
|
79
|
+
| Lane | Commands | Behavior |
|
|
80
|
+
| --- | --- | --- |
|
|
81
|
+
| **Sequential (FIFO) lane** | Ordinary commands (`get_state`, `set_model`, `switch_session`, `compact`, `prompt`, etc.) | Executed strictly one at a time in arrival order. `prompt` responds once preflight completes and detaches immediately so later commands run while the turn streams. In standalone RPC mode, `compact` holds this lane until compaction completes. |
|
|
82
|
+
| **Concurrent / control lane** | Interrupts (`abort`, `cancel_login_provider`, `abort_compaction`, `abort_branch_summary`, `abort_retry`, `abort_bash`, `pause_queued_messages`, `resume_queued_messages`, `clear_queue`), `extension_ui_response`, and concurrent commands (`bash`, `user_bash`, `refresh_models`, `set_compaction_model`, `set_decision_model`, `start_pending_recovery`, `stop_all_background`) | Bypass the sequential queue and run immediately even while an ordinary command (such as `compact` or a slow `switch_session`) is in flight. |
|
|
83
|
+
|
|
84
|
+
Because the first sequential frame starts synchronously before the next line is read, a follow-up interrupt sent immediately after a command cannot overtake the command's initialization.
|
|
52
85
|
|
|
53
86
|
### Framing
|
|
54
87
|
|
|
@@ -62,7 +95,9 @@ Client framing rules:
|
|
|
62
95
|
- Strip an optional trailing `\r` from `\r\n` lines.
|
|
63
96
|
- Avoid generic line readers that split on Unicode line separators (`U+2028`, `U+2029`) or bare `\r`.
|
|
64
97
|
|
|
65
|
-
|
|
98
|
+
<Warning>
|
|
99
|
+
Node's `readline` module is **not** protocol-compliant because it splits on `U+2028` and `U+2029`, which are valid unescaped inside JSON strings. Similarly, Python's `text=True` universal newlines mode splits on bare `\r`; always read raw bytes and split strictly on `b"\n"`.
|
|
100
|
+
</Warning>
|
|
66
101
|
|
|
67
102
|
## Shutdown and signals
|
|
68
103
|
|
|
@@ -74,7 +109,7 @@ Node's `readline` module is not protocol-compliant because it splits on `U+2028`
|
|
|
74
109
|
|
|
75
110
|
## Example Python client
|
|
76
111
|
|
|
77
|
-
This minimal client reads stdout as binary lines split strictly on `\n`, sends one prompt,
|
|
112
|
+
This minimal client reads stdout as binary lines split strictly on `\n`, sends one correlated `prompt`, checks `data.disposition` in case an extension command handled it without starting a turn, streams text deltas, waits for `agent_settled` (covering any retries or continuations), and closes stdin for orderly shutdown:
|
|
78
113
|
|
|
79
114
|
```python
|
|
80
115
|
import json
|
|
@@ -108,13 +143,18 @@ def read_events():
|
|
|
108
143
|
yield json.loads(line.decode("utf-8"))
|
|
109
144
|
|
|
110
145
|
try:
|
|
111
|
-
send({"type": "prompt", "message": "Hello!"})
|
|
146
|
+
send({"id": "p-1", "type": "prompt", "message": "Hello!"})
|
|
112
147
|
for event in read_events():
|
|
113
|
-
if event.get("type") == "
|
|
148
|
+
if event.get("type") == "response" and event.get("id") == "p-1":
|
|
149
|
+
if not event.get("success"):
|
|
150
|
+
raise RuntimeError(event.get("error", "prompt failed"))
|
|
151
|
+
if event.get("data", {}).get("disposition") == "handled":
|
|
152
|
+
break
|
|
153
|
+
elif event.get("type") == "message_update":
|
|
114
154
|
delta = event.get("assistantMessageEvent", {})
|
|
115
155
|
if delta.get("type") == "text_delta":
|
|
116
156
|
print(delta["delta"], end="", flush=True)
|
|
117
|
-
|
|
157
|
+
elif event.get("type") == "agent_settled":
|
|
118
158
|
print()
|
|
119
159
|
break
|
|
120
160
|
finally:
|