@bastani/atomic 0.10.9 → 0.10.10-alpha.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.
- package/CHANGELOG.md +83 -0
- package/README.md +226 -163
- 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 +27 -12
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +47 -7
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
- package/dist/_shared/mode-shared-2QJSCUM6.js +48 -19
- package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
- package/dist/_shared/{p1a-prewarm-UQY3X2UK.js → p1a-prewarm-XIU57JHF.js} +5 -5
- package/dist/_shared/{p1a-prewarm-UQY3X2UK.js.map → p1a-prewarm-XIU57JHF.js.map} +1 -1
- package/dist/_shared/p2-shell-main-B2WIALFD.js +30 -25
- package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +5 -5
- package/dist/_shared/{sdk-OSBEPR3Q.js → sdk-RRLVN7ER.js} +15 -9
- package/dist/_shared/sdk-RRLVN7ER.js.map +1 -0
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/settings-startup-8-DNZ2RIHM.js +4 -1
- package/dist/_shared/settings-startup-8-DNZ2RIHM.js.map +1 -1
- package/dist/_shared/{startup-0-0-TYUFUOJZ.js → startup-0-0-4VG2G44V.js} +427 -33
- package/dist/_shared/startup-0-0-4VG2G44V.js.map +1 -0
- package/dist/_shared/{startup-0-1-W2G2UY7R.js → startup-0-1-XTIL65D4.js} +18 -11
- package/dist/_shared/startup-0-1-XTIL65D4.js.map +1 -0
- package/dist/_shared/{startup-0-2-UXBUEOXW.js → startup-0-2-27OWFHV6.js} +150 -62
- package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -0
- package/dist/_shared/startup-0-3-T4DVFYWX.js +15 -25
- package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
- package/dist/_shared/{startup-0-4-HN5EB4K7.js → startup-0-4-ZMJV547D.js} +81 -12
- package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -0
- package/dist/_shared/startup-0-5-FD2P735I.js +90 -50
- package/dist/_shared/startup-0-5-FD2P735I.js.map +1 -1
- package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
- package/dist/_shared/startup-12-0-55AAXBJZ.js +13 -7
- package/dist/_shared/startup-12-0-55AAXBJZ.js.map +1 -1
- package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
- package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
- package/dist/_shared/startup-15-1-4S7FLMNG.js +88 -28
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +5 -5
- package/dist/_shared/startup-8-1-4KANEHRA.js +61 -17
- package/dist/_shared/startup-8-1-4KANEHRA.js.map +1 -1
- package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/README.md +87 -116
- package/dist/builtin/intercom/broker/broker.bundle.mjs +3 -3
- package/dist/builtin/intercom/broker/presence-handler.ts +1 -1
- package/dist/builtin/intercom/group.ts +7 -3
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/README.md +61 -27
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +8 -0
- package/dist/builtin/subagents/README.md +74 -141
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +213 -74
- package/dist/builtin/web-access/CHANGELOG.md +9 -0
- package/dist/builtin/web-access/README.md +61 -88
- package/dist/builtin/web-access/index.bundle.mjs +387 -351
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +4 -4
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +2 -2
- 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.code.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 +2 -2
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +2 -2
- 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 +2 -2
- 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 +2 -2
- 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/agent-session-methods.d.ts +4 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/compaction/compactor.d.ts +20 -14
- package/dist/core/compaction/errors.d.ts +120 -0
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/model-resolver.d.ts +2 -2
- 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.code.js +1 -1
- 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/api-types.d.ts +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- 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.code.js +1 -1
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/extensions/loader-virtual-modules.js +1 -1
- package/dist/core/extensions/provider-types.d.ts +18 -6
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runner-context.js +1 -1
- 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 +3 -3
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/model-config.d.ts +40 -0
- package/dist/core/model-registry.js +1 -1
- package/dist/core/model-resolver-scope.d.ts +4 -4
- package/dist/core/model-runtime.d.ts +1 -1
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/provider-composer-internal.d.ts +11 -2
- package/dist/core/sdk.code.js +3 -3
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +5 -5
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.code.js +1 -1
- 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/settings-manager-basic-accessors.d.ts +6 -2
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +4 -4
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.code.js +1 -1
- 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.code.js +2 -2
- 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 +3 -3
- 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.code.js +1 -1
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +2 -2
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +2 -2
- 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-extensions.d.ts +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +7 -7
- package/dist/main-first-time-setup.code.js +2 -2
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -0
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- 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/interactive/theme/color-utils.d.ts +5 -5
- package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
- package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -0
- package/dist/modes/print-mode.js +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +6 -0
- package/dist/modes/rpc/rpc-types.d.ts +29 -2
- package/dist/package-manager-cli.code.js +5 -5
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/rpc-entry.js +1 -1
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/5.js +1 -1
- package/dist/startup-stages/7.js +1 -1
- package/dist/startup-stages/8.js +1 -2
- package/dist/startup-stages/9.js +2 -1
- package/dist/utils/native-module.d.ts +44 -0
- package/dist/utils/startup-database-spare.code.js +3 -3
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.code.js +1 -1
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/background-tasks.md +238 -243
- package/docs/build.md +21 -15
- package/docs/changelog.mdx +1 -1
- package/docs/codemode.md +68 -51
- package/docs/compaction/reference.md +65 -26
- package/docs/compaction.md +118 -66
- package/docs/computer-use.md +179 -146
- package/docs/containerization.md +87 -33
- package/docs/custom-provider/api-reference.md +152 -13
- package/docs/custom-provider/oauth.md +45 -28
- package/docs/custom-provider/override.md +14 -7
- package/docs/custom-provider/registration.md +77 -67
- package/docs/custom-provider/streaming.md +42 -19
- package/docs/custom-provider.md +26 -62
- package/docs/development.md +81 -42
- package/docs/docs.json +54 -38
- package/docs/environment-variables.md +92 -64
- package/docs/extensions/api-reference.md +326 -735
- package/docs/extensions/authoring.md +186 -269
- package/docs/extensions/events.md +308 -375
- package/docs/extensions/examples.md +122 -74
- package/docs/extensions/ui.md +217 -197
- package/docs/extensions.md +189 -259
- package/docs/getting-started/authentication.md +27 -14
- package/docs/getting-started/first-session.md +25 -26
- package/docs/getting-started/installation.md +62 -84
- package/docs/getting-started/project-instructions.md +39 -14
- package/docs/guides/configuration.md +62 -20
- package/docs/guides/intercom.md +20 -12
- package/docs/guides/non-interactive.md +31 -16
- package/docs/guides/orchestration.md +17 -9
- package/docs/guides/resume-on-any-machine.md +63 -52
- package/docs/guides/subagents.md +26 -14
- package/docs/guides/team-setup.md +49 -27
- package/docs/guides.md +30 -23
- package/docs/herdr.md +22 -17
- package/docs/index.md +24 -17
- package/docs/intercom/operations.md +90 -66
- package/docs/intercom/reference.md +219 -192
- package/docs/intercom.md +111 -92
- package/docs/json.md +73 -71
- package/docs/keybindings.md +74 -48
- package/docs/libraries/agent-core.md +52 -9
- package/docs/libraries/ai.md +90 -63
- package/docs/libraries/codemode.md +31 -8
- package/docs/libraries/schema.md +12 -9
- package/docs/libraries/storage-libsql.md +92 -0
- package/docs/libraries/storage-postgres.md +119 -0
- package/docs/libraries/telemetry.md +42 -9
- package/docs/libraries/tui.md +74 -94
- package/docs/libraries.md +25 -8
- package/docs/llama-cpp.md +38 -33
- package/docs/mcp-servers.md +140 -88
- package/docs/models/reference.md +53 -36
- package/docs/models-configuration.md +19 -13
- package/docs/models.md +102 -87
- package/docs/orchestration/migrating-workflows.md +22 -20
- package/docs/orchestration/patterns.md +36 -21
- package/docs/orchestration.md +24 -21
- package/docs/packages/authoring.md +29 -18
- package/docs/packages/reference.md +77 -16
- package/docs/packages.md +34 -34
- package/docs/programmatic.md +28 -21
- package/docs/prompt-templates.md +65 -41
- package/docs/providers/reference.md +36 -20
- package/docs/providers.md +78 -76
- package/docs/quickstart.md +42 -54
- package/docs/reference/cli.md +256 -254
- package/docs/reference.md +30 -23
- package/docs/rpc/examples.md +121 -17
- package/docs/rpc/extension-ui.md +86 -63
- package/docs/rpc/protocol.md +817 -358
- package/docs/rpc.md +78 -152
- package/docs/sdk/reference.md +309 -73
- package/docs/sdk/storage.md +614 -0
- package/docs/sdk/structured-decisions.md +168 -65
- package/docs/sdk/web-server.md +80 -46
- package/docs/sdk.md +168 -215
- package/docs/security.md +117 -44
- package/docs/session-format.md +127 -76
- package/docs/sessions.md +155 -113
- package/docs/settings.md +293 -205
- package/docs/shell-aliases.md +15 -6
- package/docs/skills/authoring.md +17 -9
- package/docs/skills/reference.md +23 -21
- package/docs/skills.md +148 -97
- package/docs/storage.md +172 -260
- package/docs/subagents/authoring.md +148 -15
- package/docs/subagents/reference.md +105 -29
- package/docs/subagents.md +247 -250
- package/docs/terminal-setup.md +97 -69
- package/docs/termux.md +51 -85
- package/docs/themes/reference.md +51 -37
- package/docs/themes.md +52 -55
- package/docs/tmux.md +38 -21
- package/docs/tools.md +209 -147
- package/docs/tui/reference.md +64 -32
- package/docs/tui.md +38 -66
- package/docs/usage.md +94 -86
- package/docs/verification.md +25 -25
- package/docs/web-access.md +106 -54
- package/docs/windows.md +55 -57
- package/docs/worktree-snapshots.md +82 -74
- package/examples/sdk/11-sessions.ts +4 -4
- package/package.json +8 -8
- package/schemas/models.schema.json +58 -7
- package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
- package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
- package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
- package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
- package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Intercom reference
|
|
3
|
-
|
|
2
|
+
title: "Intercom reference"
|
|
3
|
+
sidebarTitle: "Intercom"
|
|
4
|
+
description: "Complete specification of the intercom tool, targeting rules, groups, delivery limits, SDK errors, and config.json."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
This page is the exact reference for the `intercom` tool, group rules, `config.json`, wake queues, and SDK error classes. For concepts, see [Intercom overview](/guides/intercom). For quick-start patterns and `contact_supervisor`, see [Coordinate sessions with Intercom](/intercom). For multi-machine setup, broker upgrades, and troubleshooting, see [Operate Intercom](/intercom/operations). For programmatic setup, see [Intercom group and reach in the SDK](/sdk#intercom-group-and-reach).
|
|
7
8
|
|
|
8
|
-
## The intercom tool
|
|
9
|
+
## The `intercom` tool {#the-intercom-tool}
|
|
9
10
|
|
|
10
11
|
| Parameter | Type | Description |
|
|
11
12
|
| --- | --- | --- |
|
|
12
13
|
| `action` | string | `"list"`, `"groups"`, `"join"`, `"leave"`, `"send"`, `"ask"`, `"reply"`, `"pending"`, `"cancel"`, or `"status"`. |
|
|
13
|
-
| `to` | string | Exact session name, full session ID, or unique 8-hex session UUID prefix. `send` also accepts a session-name glob or `subagents:` target ([Sending to several sessions at once](#sending-to-several-sessions-at-once)). `ask` requires one exact target. |
|
|
14
|
+
| `to` | string | Exact session name, full session ID, or unique 8-hex session UUID prefix. `send` also accepts a session-name glob (`*` only) or `subagents:` target ([Sending to several sessions at once](#sending-to-several-sessions-at-once)). `ask` requires one exact target. |
|
|
14
15
|
| `message` | string | Message text for `send`, `ask`, or `reply`. |
|
|
15
16
|
| `broadcast` | boolean | For `send` to a session-name glob: set `true` to send to every matching session. Without it, a glob matching more than one session is refused with the match list. `subagents:` targets broadcast without this flag. |
|
|
16
17
|
| `attachments` | array | Optional `file`, `snippet`, or `context` attachments (`{ type, name, content, language? }`). |
|
|
17
|
-
| `delivery` | string |
|
|
18
|
+
| `delivery` | string | Case-sensitive mode for `send` and `ask`: `"steer"` (default, arrives after current tool calls without cancelling work), `"followUp"` (arrives after the recipient finishes and stops), or `"interrupt"` (cancels the current model call or cancellable tool call immediately). |
|
|
18
19
|
| `wait` | object | For `ask`: how long to wait for an inline reply before yielding, matching `bash`. Omit for the automatic yield (default 10 seconds), pass `{ kind: "foreground", budgetMs }` to wait up to a budget, or pass `{ kind: "background" }` to return at delivery. |
|
|
19
|
-
| `askId` | string | For `cancel`:
|
|
20
|
-
| `replyTo` | string | Exact message ID or
|
|
20
|
+
| `askId` | string | For `cancel`: any unique case-sensitive prefix (or full ID) of one of your pending outbound asks. If both `askId` and `replyTo` are passed to `cancel`, `askId` takes precedence and `replyTo` is ignored. |
|
|
21
|
+
| `replyTo` | string | Exact message ID or exact 8-hex UUID prefix of an unresolved inbound ask. With `reply`, overrides current-turn and pending-ask fallback. With `cancel`, closes that inbound ask without sending anything to its sender. |
|
|
21
22
|
| `group` | string | Group name for `join` or an optional targeted `leave`, or a read-only group filter for `list` and `status`. `send` and `ask` still require a shared membership or reach policy. |
|
|
22
23
|
|
|
23
24
|
### Actions
|
|
24
25
|
|
|
25
26
|
| Action | Behavior |
|
|
26
27
|
| --- | --- |
|
|
27
|
-
| `join` | Adds a trimmed named group membership, creating the group if needed. Waits for broker confirmation and reports the resulting membership set. Joining `default` while multi-node routing is on adds a warning. `true` and `auto` are reserved for subagent auto-groups. |
|
|
28
|
-
| `leave` | With `group`, removes
|
|
28
|
+
| `join` | Adds a trimmed named group membership, creating the group if needed. Waits for broker confirmation and reports the resulting membership set. Joining `default` while multi-node routing is on adds a warning. `true` and `auto` are reserved (case-insensitively) for subagent auto-groups. |
|
|
29
|
+
| `leave` | With `group`, removes that membership and keeps all others; if it was your only remaining group, returns you to your resolved startup home group (for example `project:<path>` under multi-node routing, or `"default"` locally). Without `group`, resets memberships to the startup home group. Reports the resulting membership set. |
|
|
29
30
|
| `groups` | Lists every group with at least one connected session, along with its session count and whether this session belongs to it. |
|
|
30
31
|
| `list` | Lists the current session and active sessions visible through your memberships. Pass `group` for a read-only view of one group. |
|
|
31
32
|
| `send` | Fire-and-forget delivery through ordinary Intercom. Requires `to` and `message`; cannot message the current session. |
|
|
32
33
|
| `ask` | Sends a question to a live recipient and returns at delivery with `askId`, `delivered`, and `recipient` (`name`, `state`, and `currentAction` when known). A reply within `wait` returns inline; otherwise the ask stays pending with no expiry and its reply arrives later as a message ([send vs ask vs reply](#send-vs-ask-vs-reply)). |
|
|
33
|
-
| `reply` | Answers the
|
|
34
|
+
| `reply` | Answers the Intercom message that triggered the current turn, or falls back to the sole unresolved inbound ask. With multiple pending asks, pass `to` or inspect with `pending` and pass `replyTo`. |
|
|
34
35
|
| `pending` | Lists unresolved inbound asks (sender, message ID, elapsed time, and preview) and your pending outbound asks (ask ID, target, elapsed time, and question). |
|
|
35
|
-
| `cancel` | With `askId
|
|
36
|
+
| `cancel` | With `askId` (any unique case-sensitive prefix), cancels one of your outbound asks (a reply arriving later still displays once, marked late). With `replyTo` (exact full ID or exact 8-hex prefix), closes an inbound ask without replying; it leaves `pending`, stays closed across restarts, and sends nothing to the asker. If both `askId` and `replyTo` are passed, `askId` wins and `replyTo` is ignored. |
|
|
36
37
|
| `status` | Reports connection state, session ID, all group memberships (plus reachable groups when a [reach policy](#reach-policies) applies), visible active session count, and the broker's multi-node routing state with live peer broker count. Passing `group` performs a read-only peek. |
|
|
37
38
|
|
|
38
39
|
To give two chat sessions a private shared group, have both call:
|
|
@@ -49,18 +50,18 @@ Sent and received messages are stored in session history as `intercom_sent` and
|
|
|
49
50
|
|
|
50
51
|
### Targeting sessions
|
|
51
52
|
|
|
52
|
-
Live session lookup
|
|
53
|
+
Live session lookup checks targets in this order:
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
1. **Exact full Intercom session ID** (case-sensitive).
|
|
56
|
+
2. **Exact session name** (case-insensitive). If multiple local sessions share the same name, lookup fails with `Multiple sessions named "<target>" are connected. Use the session ID instead.`
|
|
57
|
+
3. **Unique 8-character hexadecimal prefix** (`^[0-9a-f]{8}$/i`) of a standard UUID-format (`8-4-4-4-12`) session ID. Prefixes of 6, 7, or 9+ characters do not match.
|
|
58
|
+
4. **Atomic session ID** (case-sensitive, the ID passed to `atomic --session`), checked only when the rules above match nothing and exactly one visible session registered it.
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
Ambiguous prefixes list only authorized candidates and require the full UUID. Isolated subagents can target their authorized supervisor by a unique 8-hex UUID prefix without gaining access to unrelated groups.
|
|
60
61
|
|
|
61
62
|
Reopened sessions and restored background subagents reclaim their previous Intercom session ID so peers can keep using the ID printed by `intercom list`. The session persists this ID as an `intercom_session_identity` entry. While a live session holds an ID, another registration receives a fresh ID instead; once released, only that same Atomic session can reclaim it while the broker remembers its previous holder.
|
|
62
63
|
|
|
63
|
-
With [multi-node routing](/intercom/operations#running-intercom-across-machines), session ID reclaim works across machines once the shared database has the current schema (on PostgreSQL, run `atomic storage migrate` as the schema owner role):
|
|
64
|
+
With [multi-node routing](/intercom/operations#running-intercom-across-machines), session ID reclaim works across machines once the shared database has the current schema (on [PostgreSQL storage](/storage#postgresql), run `atomic storage migrate` as the schema owner role):
|
|
64
65
|
|
|
65
66
|
- A session that disconnects cleanly reclaims its ID immediately on any machine.
|
|
66
67
|
- A session whose broker crashed reclaims its ID immediately on the same machine, or on another machine after the crashed broker's 30-second lease expires (until then it receives a fresh ID and automatically rebinds once the lease lapses).
|
|
@@ -73,13 +74,13 @@ With [multi-node routing](/intercom/operations#running-intercom-across-machines)
|
|
|
73
74
|
|
|
74
75
|
| Target | Reaches |
|
|
75
76
|
| --- | --- |
|
|
76
|
-
| `subagent-worker-*`, `subagent-*`, `*` | Every visible live session in your groups whose name matches, excluding yourself. `*`
|
|
77
|
-
| `subagents:*` | Every running, released, or paused subagent launched by this session across all runs. |
|
|
78
|
-
| `subagents:<runId>/*` | Every running, released, or paused subagent in one `subagent` run. |
|
|
77
|
+
| `subagent-worker-*`, `subagent-*`, `*` | Every visible live session in your groups whose name (or session ID if unnamed) matches, excluding yourself. **Only `*` is a wildcard** (case-insensitive); `?` and `[...]` match literally. |
|
|
78
|
+
| `subagents:*` | Every **running, released, or paused** subagent launched by this session across all runs. Does **not** include `quit` subagents. |
|
|
79
|
+
| `subagents:<runId>/*` | Every **running, released, or paused** subagent in one `subagent` run (`subagents:` prefix is case-sensitive; `<runId>` cannot contain `/` or `*`). Does **not** include `quit` subagents. |
|
|
79
80
|
|
|
80
|
-
Each recipient receives its own direct send with standard receipts, refusals, and reconnect retries. Pattern sends never [resume a finished subagent](#messages-that-resume-a-finished-subagent): a copy targeting an ended subagent returns the refusal in [Subagents with no live session](#subagents-with-no-live-session). The result lists every recipient's outcome (`delivered`, `queued`, `not delivered` with reason, or `outcome unknown`) and errors only if zero recipients were reached. A glob matching no visible session returns an error listing
|
|
81
|
+
Each recipient receives its own direct send (dispatched up to 16 concurrently) with standard receipts, refusals, and reconnect retries. Pattern sends never [resume a finished subagent](#messages-that-resume-a-finished-subagent): a copy targeting an ended subagent returns the refusal in [Subagents with no live session](#subagents-with-no-live-session). The result lists every recipient's outcome (`delivered`, `queued`, `not delivered` with reason, or `outcome unknown`) and errors only if zero recipients were reached. A glob matching no visible session returns an error listing up to 5 closest visible names.
|
|
81
82
|
|
|
82
|
-
A name glob matching more than one session (including `*`) requires `broadcast: true`. Without it, nothing is sent and the error lists every match so you can pick one exact name or repeat with `broadcast: true`. A glob matching a single session sends without the flag. `subagents:*` and `subagents:<runId>/*` never require `broadcast: true`.
|
|
83
|
+
A name glob matching more than one session (including `*`) requires `broadcast: true`. Without it, nothing is sent and the error lists every match so you can pick one exact name or repeat with `broadcast: true`. A glob matching a single session sends without the flag. `subagents:*` and `subagents:<runId>/*` never require `broadcast: true`. When `confirmSend: true` is set in an interactive session, a pattern send shows one confirmation prompt listing all matched recipients before sending.
|
|
83
84
|
|
|
84
85
|
```typescript
|
|
85
86
|
intercom({ action: "send", to: "subagent-worker-*", message: "Scope changed", broadcast: true })
|
|
@@ -91,48 +92,148 @@ Workflow stage targets (`workflow:<rootRunId>/...`) were removed in Atomic 0.10.
|
|
|
91
92
|
|
|
92
93
|
Session list rows show the copyable session ID first, followed by status and working directory. Generated fallback aliases are hidden in list formatting while remaining valid lookup targets. Non-agent connections (such as internal control connections) are always refused as message targets.
|
|
93
94
|
|
|
94
|
-
###
|
|
95
|
+
### Groups
|
|
95
96
|
|
|
96
|
-
|
|
97
|
+
Every session belongs to a non-empty set of Intercom groups. Sessions with no explicit group belong only to `"default"` locally (or their [project group](/intercom/operations#project-groups) when multi-node routing is on). Ordinary discovery and messaging require at least one shared group membership; cross-group sends are rejected by the broker.
|
|
97
98
|
|
|
98
|
-
|
|
99
|
+
- **Case sensitivity.** Group names are case-sensitive (`"Team"` and `"team"` are separate groups). The reserved names `"true"` and `"auto"` are rejected case-insensitively by `join` and `leave`.
|
|
100
|
+
- **Leaving your last group.** Calling `leave` with `group` naming your only group returns you to your resolved startup home group (for example `project:<path>` under multi-node routing, or `"default"` locally). Calling `leave` with no `group` resets all memberships to your startup home group.
|
|
101
|
+
- **Persistence.** Joined and left memberships persist across restarts of the same session under the same home group, and are not inherited by forked sessions.
|
|
102
|
+
- **Commands.** `list` returns the union of sessions visible through your memberships (or a read-only peek of one `group`), `groups` lists all active groups, and `status` reports your complete membership set.
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
- **Exactly-once replies.** Each question accepts one reply across all nodes. Later replies to the same question are refused and never queued as ordinary messages. Retries with the same message ID return the first attempt's outcome.
|
|
102
|
-
- **When a reply is refused.** A reply fails without reaching the subagent if the launching session disconnected, dropped the hold, or ended, or if the subagent itself ended or was stopped. If the subagent's `ask` already yielded before release, the reply (or refusal) is held like an ordinary send and wakes the subagent as a `Reply to your ask` message.
|
|
103
|
-
- **Authorized receiver only.** Only the relaunched subagent presenting the owner's supervisor capability receives held sends. Unrelated sessions registering the same name receive nothing and do not end the hold.
|
|
104
|
-
- **Save confirmation.** The launching session confirms the reply once saved. If it does not confirm within about 8 seconds, the replier gets an [uncertain-outcome failure](/intercom/operations#how-it-works) and may retry. Reusing a message ID already awaiting confirmation for another reply fails with `message_id_conflict`.
|
|
105
|
-
- **How long a question stays open.** An owned reply route stays open until answered or until the question's original deadline expires. An unowned reply route (whose launching session disconnected or never reserved the child) is dropped once the launching session has been away for 7 days, matching away-session ask retention and keeping abandoned routes from filling the broker's route table permanently.
|
|
106
|
-
- **Multi-node and restarts.** Without multi-node routing, the replier and launching session must share a local broker, and a broker restart drops local reply routes (delivering a timeout to the child). With multi-node routing on, questions asked of remote peers live in the shared database and survive both session reopens and broker restarts.
|
|
107
|
-
- **Route capacity.** Each local broker keeps at most 10,000 local released-asker reply routes (shared-database routes do not count toward this cap). Past 10,000, new routes are refused and the subagent wakes with one failed-ask message: `The Intercom broker's released-subagent reply routes are full (limit 10000); this ask can no longer receive its reply`.
|
|
104
|
+
Home group resolution follows this precedence (highest first):
|
|
108
105
|
|
|
109
|
-
|
|
106
|
+
1. Explicit task or subagent `group`
|
|
107
|
+
2. Inherited launching-session group
|
|
108
|
+
3. SDK host `group` passed to [`createAgentSession({ intercom })`](/sdk#intercom-group-and-reach)
|
|
109
|
+
4. Environment variable `ATOMIC_INTERCOM_GROUP` (setting `ATOMIC_INTERCOM_GROUP=""` explicitly shadows legacy `PI_INTERCOM_GROUP` and falls through to `config.json`)
|
|
110
|
+
5. `"group"` in Intercom `config.json`
|
|
111
|
+
6. Project group `project:<path>` while multi-node routing is on
|
|
112
|
+
7. `"default"`
|
|
110
113
|
|
|
111
|
-
|
|
114
|
+
Supervisor authorization is granted by the launching parent and allows `contact_supervisor` to cross groups only for that parent-child relationship. Joining a group never grants supervisor access.
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
| --- | --- | --- | --- | --- |
|
|
115
|
-
| `ReleasedReplyAnsweredError` | `released_reply_answered` | The launching session already accepted another reply to this question, or refused a duplicate handoff after a lost confirmation. | `false` | Do not resend this reply. Send a new ordinary message if the subagent needs follow-up. |
|
|
116
|
-
| `ReleasedReplyInFlightError` | `released_reply_in_flight` | Another reply to this question is currently being handed to the launching session. | `true` | Wait, then reply again if the question is still unanswered. |
|
|
116
|
+
### Answering a sender outside your groups
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
A session can receive a message from outside its groups (for example from a session with a [reach policy](#reach-policies), or through supervisor escalation). The recipient may answer that sender directly using `send` or `ask` without joining a new group, subject to strict return-path limits:
|
|
119
119
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
| `UnknownReleasedChildError` | `unknown_released_child` | Wake acknowledgement named a child no session reserved. | Reserve the child first. |
|
|
120
|
+
- **Single-session scope.** The return path reaches only that specific sender by explicit `send` or `ask`, never by pattern send (`*`, `subagents:*`), and does not add the sender to `intercom list`.
|
|
121
|
+
- **Session-bound.** When the sender quits permanently, the path closes; another session taking the same name or ID later cannot be reached through it.
|
|
122
|
+
- **Count and window.** Up to **3 messages** within **30 minutes** of the sender's latest message to you. Each new message from that sender resets the count and 30-minute window. Retried deliveries do not reopen it, and retried answers count once.
|
|
123
|
+
- **Multi-node support.** Return paths work identically across machines, including offline-session queueing if the sender disconnects.
|
|
124
|
+
- **Reach-policy exclusion.** A session that has its own [reach policy](#reach-policies) never uses return paths; recipients without a reach policy can still answer it through a return path.
|
|
126
125
|
|
|
127
|
-
|
|
126
|
+
Once closed, sends to that sender fail with `<sender> is outside your intercom groups and its return path has closed`. Return paths live in broker memory and clear on broker restart. If a session inside your own groups shares the same name, address the external sender by session ID. For longer exchanges, join a shared group.
|
|
128
127
|
|
|
129
|
-
|
|
130
|
-
| --- | --- | --- | --- |
|
|
131
|
-
| `HostedSessionRequestError` | `invalid_hosted_frame` | Malformed request: 1 to 500 sessions per frame under distinct non-empty keys, or 1 to 500 IDs to remove. | Fix the request and resend. |
|
|
132
|
-
| `HostedSessionRequestError` | `invalid_hosted_session` | Missing name, invalid agent registration, malformed return address, or group outside the hosting session's [reach policy](#reach-policies). | Fix the named item and resend. |
|
|
133
|
-
| `NotHostedSessionError` | `not_hosted_by_connection` | Send named a `hostedSender`, or removal named an ID, not hosted by this connection. | Use the hosting connection, or re-host after reconnecting. |
|
|
128
|
+
### send vs ask vs reply
|
|
134
129
|
|
|
135
|
-
|
|
130
|
+
**`send`** returns immediately after delivery (or queueing). It sends without prompting by default; set `confirmSend: true` in `config.json` to prompt once before single or broadcast non-reply sends in interactive sessions (replies carrying `replyTo` skip confirmation).
|
|
131
|
+
|
|
132
|
+
**`ask`** never blocks the caller indefinitely. It returns once the question is delivered with `askId`, recipient state (`idle` or `busy`), and `currentAction` when known. Wait behavior matches `bash`:
|
|
133
|
+
|
|
134
|
+
| `wait` | Behavior |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| Omitted | Waits up to the automatic yield (default 10 seconds) and returns the reply inline if it arrives in time. |
|
|
137
|
+
| `{ kind: "foreground", budgetMs }` | Waits up to `budgetMs`, then yields. |
|
|
138
|
+
| `{ kind: "background" }` | Returns immediately after delivery. |
|
|
139
|
+
|
|
140
|
+
If an `ask` yields or is interrupted, it stays pending with no expiry. Its reply arrives later as a message starting `Reply to your ask <id> from <name>` (starting a turn when idle, or arriving after the current tool call when busy). Refusals and recipient exits arrive as failed-ask messages starting `Your ask <id> to <name> failed`. Saved sessions that close (anything other than `--no-session`) count as away rather than ended, so their asks stay pending until they reopen.
|
|
141
|
+
|
|
142
|
+
**Pending ask persistence and limits:**
|
|
143
|
+
|
|
144
|
+
- Use `pending` to view waiting asks and `cancel` (`askId`) to cancel one. Replies arriving after cancellation still show once, marked late.
|
|
145
|
+
- Restarting either session preserves open asks and delivers each reply once (holding replies for closed askers with `Reply delivered (held for <asker> until it is back)`).
|
|
146
|
+
- Asks waiting on a session that stays away for more than 7 days, or ends permanently, are dropped. Forked sessions do not inherit their parent's asks.
|
|
147
|
+
- Each closed recipient holds at most 1,000 waiting asks; asks beyond that fail immediately with `Session "<name>" went away and its queue of asks waiting for its return is full (limit 1000); this ask was not kept`. Existing asks and held replies are never evicted.
|
|
148
|
+
- Only the asked recipient can answer an ask; messages naming the ask from another session arrive as ordinary messages.
|
|
149
|
+
- Up to `maxPendingAsks` asks (default `6`, shared with `contact_supervisor` blocking waits) can wait inline concurrently; further asks still send and deliver their replies as messages.
|
|
150
|
+
|
|
151
|
+
An inbound ask stays in `pending` until you reply to it or close it with `intercom({ action: "cancel", replyTo })`. It also closes automatically when no reply can reach the asker (for example if the asker was one of your subagents and ended, or if the broker rejects the route).
|
|
152
|
+
|
|
153
|
+
**Subagents and terminal reply capability.** Single-target `send` and `ask` calls from `intercom` to completed or failed subagents queue immediately and resume the subagent through its launching session. Calls to paused or quit subagents queue without resuming until the launching session continues them.
|
|
154
|
+
|
|
155
|
+
Only permanently cancelled (`killed`) subagents, pattern sends, calls past the wake rate or chain limits, or a still-connected registration marked `replyCapability: "terminal"` reject asks immediately with `Target noninteractive child is terminal and cannot reply; launch a fresh child with explicit context`. In-flight pending asks fail explicitly if the recipient terminates before replying. Live interactive idle sessions remain askable.
|
|
156
|
+
|
|
157
|
+
**`contact_supervisor`** allows one blocking `need_decision` (requires `message`) or `interview_request` wait per subagent at a time (coexisting with ordinary peer asks and sharing the `maxPendingAsks` capacity). A second concurrent supervisor wait fails with `Already waiting for a supervisor reply`. Blocking supervisor waits time out after 10 minutes. Only a direct single-child launch in an embedded SDK session without background task management uses the terminal `[TASK_CONTEXT]` fresh-child handoff when a blocking parent request is claimed.
|
|
158
|
+
|
|
159
|
+
**`reply`** targets the incoming Intercom message that triggered the current turn, or falls back to the single unresolved inbound ask. When multiple asks are pending, inspect with `pending` and pass `to` or the exact `replyTo` message ID (required when one sender has multiple open asks). Explicit `to` and `replyTo` selectors override the active turn, must match each other if both are provided, and fail without fallback when unknown or stale.
|
|
160
|
+
|
|
161
|
+
### Attachments
|
|
162
|
+
|
|
163
|
+
`send`, `ask`, and `reply` accept `attachments`: an array of `{ type, name, content, language? }` objects where `type` is `"file"`, `"snippet"`, or `"context"`. Attachment content appears inside the recipient's model-visible message body. In an embedded SDK session without background task management, a claimed direct single-child handoff preserves the same ordered attachments verbatim. Attachments are not exposed in the `Alt+M` compose overlay.
|
|
164
|
+
|
|
165
|
+
### Message size limits
|
|
166
|
+
|
|
167
|
+
Message text is capped at **1 MiB** (UTF-8 bytes), and text plus all attachment names, languages, and content is capped at **8 MiB**. Larger messages are refused without sending:
|
|
168
|
+
|
|
169
|
+
- Text over 1 MiB: `Intercom message text is <n> bytes, over the limit of 1048576 bytes (1 MiB); the message was not sent`
|
|
170
|
+
- Total over 8 MiB: `Intercom message text and attachments total <n> bytes, over the limit of 8388608 bytes (8 MiB); the message was not sent`
|
|
171
|
+
|
|
172
|
+
For larger payloads, write a file and send its path.
|
|
173
|
+
|
|
174
|
+
Any received message whose text and attachments exceed **50 KB** (UTF-8 bytes) is saved to a file in the recipient's session directory (or temporary directory when unsaved) instead of entering context whole. The chat card displays a preview and the file path, matching oversized tool output.
|
|
175
|
+
|
|
176
|
+
## Configuration
|
|
177
|
+
|
|
178
|
+
Create `~/.atomic/agent/intercom/config.json` (or under `ATOMIC_CODING_AGENT_DIR`, falling back to `PI_CODING_AGENT_DIR`; when `ATOMIC_CODING_AGENT_DIR` is unset, Atomic falls back to `~/.pi/agent/intercom/config.json` if the Atomic file is absent):
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"brokerCommand": "npx",
|
|
183
|
+
"brokerArgs": ["--no-install", "tsx"],
|
|
184
|
+
"brokerStartupTimeoutMs": 30000,
|
|
185
|
+
"confirmSend": false,
|
|
186
|
+
"maxPendingAsks": 6,
|
|
187
|
+
"replyHint": true,
|
|
188
|
+
"status": "researching",
|
|
189
|
+
"group": "default",
|
|
190
|
+
"joinAtStartup": true
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
| Setting | Default | Description |
|
|
195
|
+
| --- | --- | --- |
|
|
196
|
+
| `brokerCommand` | `"npx"` | Non-empty trimmed string naming the command used to start the local broker process. The default sentinel uses Atomic's own runtime without requiring `npx` or `tsx` on `PATH`. |
|
|
197
|
+
| `brokerArgs` | `["--no-install", "tsx"]` | String array of arguments passed to `brokerCommand` before the broker script path. |
|
|
198
|
+
| `brokerStartupTimeoutMs` | `30000` | Integer >= `1000`. Milliseconds a spawn attempt waits for a newly started broker to answer on its socket. |
|
|
199
|
+
| `confirmSend` | `false` | Boolean. Show a confirmation dialog before single or broadcast non-reply sends in interactive sessions with UI. |
|
|
200
|
+
| `maxPendingAsks` | `6` | Integer >= `1`. Maximum concurrent blocking reply waits per session (shared by `intercom` `ask` and `contact_supervisor`); further asks still send and deliver replies as messages. |
|
|
201
|
+
| `replyHint` | `true` | Boolean. Include the `intercom({ action: "reply", ... })` hint in incoming messages. |
|
|
202
|
+
| `status` | None | Optional custom string suffix appended after the automatic lifecycle status (for example `thinking · researching`). |
|
|
203
|
+
| `group` | `"default"`, or project group with multi-node routing | String setting the default home Intercom group ([Groups](#groups)). An empty string `""` falls through to the project group or `"default"`. Overridden by `ATOMIC_INTERCOM_GROUP` / `PI_INTERCOM_GROUP`, SDK host `intercom` policy, and subagent group injection. |
|
|
204
|
+
| `joinAtStartup` | `true` | Boolean. Have interactive sessions join Intercom automatically 3 seconds after startup. Set `false` to join on first Intercom use instead. Overridden by `ATOMIC_INTERCOM_JOIN_AT_STARTUP` (`0`/`false` disables, `1`/`true` enables; legacy `PI_INTERCOM_JOIN_AT_STARTUP`). |
|
|
205
|
+
|
|
206
|
+
Explicit custom broker commands remain supported. For example, to run the broker with Bun from `PATH`:
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"brokerCommand": "bun",
|
|
211
|
+
"brokerArgs": []
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Config validation is strict for the 9 recognized keys above (unknown extra keys are ignored): if `config.json` is invalid JSON or any recognized key has an invalid type or range, the entire file is rejected, an error is logged, and all defaults apply.
|
|
216
|
+
|
|
217
|
+
Intercom publishes live session status automatically: sessions register as `idle`, switch to `thinking` while running, show `tool:<name>` during tool calls, and return to `idle` on completion. Any configured `status` string is appended rather than replacing lifecycle status.
|
|
218
|
+
|
|
219
|
+
Activity status is separate from reply capability. As an SDK/host metadata field, session rows expose `replyCapability` (`"live"` or `"terminal"`) when supplied by the host. A still-connected non-interactive child marked `"terminal"` rejects asks even if its activity reads `idle`, while a completed or failed subagent whose session has ended is resumed by single-target `send` or `ask` from the `intercom` tool.
|
|
220
|
+
|
|
221
|
+
## Subagent delivery and wake queues
|
|
222
|
+
|
|
223
|
+
### Released subagents
|
|
224
|
+
|
|
225
|
+
A [released subagent](/subagents#released-subagents) stays addressable through its launching session. That session asks the broker to hold sends to the subagent's name and IDs and wakes it when a message arrives. Only the launching session owns that hold; if its connection closes, sends wait up to 20 seconds and return `recipient_owner_suspended` until the same Atomic session reconnects and takes the hold back.
|
|
226
|
+
|
|
227
|
+
A background subagent waiting on an `ask` or on `contact_supervisor` (`need_decision` or `interview_request`) can be released while its question remains open, under both local and [multi-node routing](/intercom/operations#running-intercom-across-machines). While multi-node routing is starting or unavailable, the subagent stays live instead.
|
|
228
|
+
|
|
229
|
+
- **Reply delivery.** Reply normally using `reply` or `send` with `replyTo`. The reply goes to the launching session, which wakes the subagent with the answer as its tool result.
|
|
230
|
+
- **Exactly-once replies.** Each question accepts one reply across all nodes. Later replies to the same question are refused and never queued as ordinary messages. Retries with the same message ID return the first attempt's outcome.
|
|
231
|
+
- **When a reply is refused.** A reply fails without reaching the subagent if the launching session disconnected, dropped the hold, or ended, or if the subagent itself ended or was stopped. If the subagent's `ask` already yielded before release, the reply (or refusal) is held like an ordinary send and wakes the subagent as a `Reply to your ask` message.
|
|
232
|
+
- **Authorized receiver only.** Only the relaunched subagent presenting the launching session's supervisor capability receives held sends. Unrelated sessions registering the same name receive nothing and do not end the hold.
|
|
233
|
+
- **Save confirmation.** The launching session confirms the reply once saved. If it does not confirm within about 8 seconds, the replier gets an [uncertain-outcome failure](/intercom/operations#how-it-works) and may retry. Reusing a message ID already awaiting confirmation for another reply fails with `message_id_conflict`.
|
|
234
|
+
- **How long a question stays open.** A reply route backed by a live launching session stays open until answered or until the question's original deadline expires. A reply route whose launching session disconnected or never reserved the subagent is dropped once the launching session has been away for 7 days, matching away-session ask retention.
|
|
235
|
+
- **Multi-node and restarts.** Without multi-node routing, the replier and launching session must share a local broker, and a broker restart drops local reply routes (delivering a timeout to the subagent). With multi-node routing on, questions asked of remote peers live in the shared database and survive both session reopens and broker restarts.
|
|
236
|
+
- **Route capacity.** Each local broker keeps at most 10,000 local released-asker reply routes (shared-database routes do not count toward this cap). Past 10,000, new routes are refused and the subagent wakes with one failed-ask message: `The Intercom broker's released-subagent reply routes are full (limit 10000); this ask can no longer receive its reply`.
|
|
136
237
|
|
|
137
238
|
### Subagents with no live session
|
|
138
239
|
|
|
@@ -151,11 +252,11 @@ The send result exposes `reasonCode` and `error` (`target`, `childName`, optiona
|
|
|
151
252
|
| `SubagentRecipientDisconnectedError` | `recipient_disconnected` | The subagent disconnected, did not reconnect within 20 seconds, and no owner report arrived. | `true` | Check `subagent({ action: "status" })` in the launching session, or retry shortly. |
|
|
152
253
|
| `SubagentRecipientOwnerSuspendedError` | `recipient_owner_suspended` | The subagent is released, but its launching session is disconnected or suspended. | `true` | Retry once the launching session reconnects. |
|
|
153
254
|
|
|
154
|
-
Launching sessions report at most 500 ended subagents per
|
|
255
|
+
Launching sessions report at most 500 ended subagents per request; malformed reports fail with the `ReleasedChildReservationError` codes below.
|
|
155
256
|
|
|
156
257
|
### Messages that resume a finished subagent
|
|
157
258
|
|
|
158
|
-
A single-target `send` or `ask` from the `intercom` tool to a subagent by name or ID opts in to waking an ended recipient (`SendOptions.wakeEndedRecipient`; SDK callers set this option explicitly). Behavior depends on how the
|
|
259
|
+
A single-target `send` or `ask` from the `intercom` tool to a subagent by name or ID opts in to waking an ended recipient (`SendOptions.wakeEndedRecipient`; SDK callers set this option explicitly). Behavior depends on how the subagent ended:
|
|
159
260
|
|
|
160
261
|
| Last run | Immediate result | What happens next |
|
|
161
262
|
| --- | --- | --- |
|
|
@@ -163,7 +264,7 @@ A single-target `send` or `ask` from the `intercom` tool to a subagent by name o
|
|
|
163
264
|
| Paused or quit (or interrupted with its parent) | Returns at once with `queued: true` and `target: "paused subagent"`. | The subagent is not resumed automatically. Your message waits until the launching session continues it, arriving after the continuation prompt. |
|
|
164
265
|
| Permanently cancelled or gone | Refused immediately with `recipient_cancelled`. | Nothing is queued. |
|
|
165
266
|
|
|
166
|
-
The launching session keeps ownership of the resumed
|
|
267
|
+
The launching session keeps ownership of the resumed subagent: its completion notice, `/tasks` entry, budget, and `pause`/`quit` controls stay in that session, and its transcript records who woke it. An `ask` stays open and delivers its answer later as `Reply to your ask <id> from <name>`.
|
|
167
268
|
|
|
168
269
|
If a queued message can no longer be delivered, the sender receives one delivery failure (a failed ask or `Intercom delivery failed`). Common causes are the subagent being cancelled, the launching session declining or missing the 20-second wake reply window, the resumed subagent failing to start within 1 hour, or the launching session ending or staying away for 7 days in a row.
|
|
169
270
|
|
|
@@ -171,12 +272,12 @@ Messages for paused subagents have no wait limit while the launching session sta
|
|
|
171
272
|
|
|
172
273
|
#### Across restarts
|
|
173
274
|
|
|
174
|
-
Queued messages for finished or paused subagents are persisted before the broker reports `queued`: locally in `ended-child-queue.sqlite` (owner-only, inside the Intercom directory), or in the shared database under the configured `prefix` when [multi-node routing](/intercom/operations#running-intercom-across-machines) is on.
|
|
275
|
+
Queued messages for finished or paused subagents are persisted before the broker reports `queued`: locally in `ended-child-queue.sqlite` (owner-only, inside the Intercom directory), or in the [shared database](/storage#sharing-storage-across-hosts) under the configured `prefix` when [multi-node routing](/intercom/operations#running-intercom-across-machines) is on.
|
|
175
276
|
|
|
176
277
|
After a broker restart, crash, or reboot, the next broker restores queued messages in order:
|
|
177
278
|
|
|
178
279
|
- When the launching session reconnects and reports the subagent, completed or failed subagents resume once for their queued messages, while paused or quit subagents keep waiting until continued.
|
|
179
|
-
- The broker waits up to 7 consecutive days while the launching session is away; reconnecting resets that 7-day counter, and connected
|
|
280
|
+
- The broker waits up to 7 consecutive days while the launching session is away; reconnecting resets that 7-day counter, and connected launching sessions have no wait limit.
|
|
180
281
|
- A message already handed to the subagent just before a broker crash is redelivered on reconnect without triggering a duplicate resume, and a saved copy is ignored.
|
|
181
282
|
- A sender retrying the same message ID after a disconnect receives `queued` again without duplicating the stored message.
|
|
182
283
|
|
|
@@ -191,83 +292,7 @@ A write blocked by another process's lock for 5 seconds fails immediately. Local
|
|
|
191
292
|
- **Queue capacity.** Up to 256 messages and 32 MiB per subagent, 256 MiB across one broker, and a 1,088 MiB local-file cap. Queued messages are never dropped to make room; new messages past a cap are refused until space frees up.
|
|
192
293
|
- **Scope.** Pattern sends (`subagents:*`, `name-*`), replies, and older clients never wake an ended subagent. Under [multi-node routing](/intercom/operations#running-intercom-across-machines), only senders on the launching session's broker trigger this wake queue; senders on other hosts use the [offline-session queue](/intercom/operations#offline-sessions).
|
|
193
294
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
Every session belongs to a non-empty set of Intercom groups. Sessions with no explicit group belong only to `"default"` locally (or their [project group](/intercom/operations#project-groups) when multi-node routing is on). Ordinary discovery and messaging require at least one shared group membership; cross-group sends are rejected by the broker.
|
|
197
|
-
|
|
198
|
-
- `list` returns the union of sessions visible through your memberships, or a read-only view of one `group`.
|
|
199
|
-
- `groups` lists all active groups, their session counts, and your memberships.
|
|
200
|
-
- `join` adds one group; `leave` removes the named group or, with no `group`, resets to your startup home group.
|
|
201
|
-
- `status` reports your complete membership set.
|
|
202
|
-
|
|
203
|
-
Home group resolution follows this precedence (highest first):
|
|
204
|
-
|
|
205
|
-
1. Explicit task or subagent `group`
|
|
206
|
-
2. Inherited launching-session group
|
|
207
|
-
3. SDK host `group` passed to [`createAgentSession({ intercom })`](/sdk#intercom-group-and-reach)
|
|
208
|
-
4. Environment variable `ATOMIC_INTERCOM_GROUP` (legacy fallback `PI_INTERCOM_GROUP`)
|
|
209
|
-
5. `"group"` in Intercom `config.json`
|
|
210
|
-
6. Project group `project:<owner>/<repo>` while multi-node routing is on
|
|
211
|
-
7. `"default"`
|
|
212
|
-
|
|
213
|
-
Supervisor authorization is granted by the launching parent and allows `contact_supervisor` to cross groups only for that parent-child relationship. Joining a group never grants supervisor access.
|
|
214
|
-
|
|
215
|
-
#### Reach policies
|
|
216
|
-
|
|
217
|
-
An SDK host can assign a reach policy via [`createAgentSession({ intercom: { group, reachable } })`](/sdk#intercom-group-and-reach) and update `reachable` dynamically with `session.intercom.setReachable(groups)`:
|
|
218
|
-
|
|
219
|
-
- The session can list, send to, and ask only sessions in its home group, its `reachable` groups, or subgroups under its home group (`<group>/...`, where its subagents run). Out-of-policy targets fail with `Target session is outside this session's Intercom reach (...)` (or `Session not found` for unseen names) and are never queued or held.
|
|
220
|
-
- Reach is one-way: reaching group B does not let group B initiate messages back unless B's own memberships or policy allow it. Replies to asks received by B are always allowed.
|
|
221
|
-
- `groups` lists only home and reachable groups (including empty ones), `join` accepts only those groups, `leave` cannot remove the home group, and `list`/`status` peeks stay within reach.
|
|
222
|
-
- Narrowing `reachable` automatically leaves removed groups from the next call onward. In-flight sends already accepted by the broker keep their original reach; sends with unknown outcomes after a disconnect are never retried under a changed reach.
|
|
223
|
-
- Subagents of a policy-constrained session inherit a reach policy with their own group as home (placed under the parent's home group if custom) and no additional reachable groups. `contact_supervisor` keeps its authorized route.
|
|
224
|
-
|
|
225
|
-
The broker enforces reach policies server-side. Sessions with a reach policy require a current broker; if an older broker cannot be replaced automatically, connection fails with `IntercomReachUnsupportedError` until you run `atomic intercom restart`.
|
|
226
|
-
|
|
227
|
-
### Answering a sender outside your groups
|
|
228
|
-
|
|
229
|
-
A session can receive a message from outside its groups (for example from a session with a [reach policy](#reach-policies), or through supervisor escalation). The recipient may answer that sender directly using `send` or `ask` without joining a new group, subject to strict return-path limits:
|
|
230
|
-
|
|
231
|
-
- **Single-session scope.** The return path reaches only that specific sender by explicit `send` or `ask`, never by pattern send (`*`, `subagents:*`), and does not add the sender to `intercom list`.
|
|
232
|
-
- **Session-bound.** When the sender quits permanently, the path closes; another session taking the same name or ID later cannot be reached through it.
|
|
233
|
-
- **Count and window.** Up to **3 messages** within **30 minutes** of the sender's latest message to you. Each new message from that sender resets the count and 30-minute window. Retried deliveries do not reopen it, and retried answers count once.
|
|
234
|
-
- **Multi-node support.** Return paths work identically across machines, including offline-session queueing if the sender disconnects.
|
|
235
|
-
- **Reach-policy exclusion.** A session that has its own [reach policy](#reach-policies) never uses return paths; recipients without a reach policy can still answer it through a return path.
|
|
236
|
-
|
|
237
|
-
Once closed, sends to that sender fail with `<sender> is outside your intercom groups and its return path has closed`. Return paths live in broker memory and clear on broker restart. If a session inside your own groups shares the same name, address the external sender by session ID. For longer exchanges, join a shared group.
|
|
238
|
-
|
|
239
|
-
### send vs ask vs reply
|
|
240
|
-
|
|
241
|
-
**`send`** returns immediately after delivery (or queueing). It sends without prompting by default; set `confirmSend: true` in `config.json` to prompt before non-reply sends in interactive sessions (replies carrying `replyTo` still skip confirmation).
|
|
242
|
-
|
|
243
|
-
**`ask`** never blocks the caller indefinitely. It returns once the question is delivered with `askId`, recipient state (`idle` or `busy`), and `currentAction` when known. Wait behavior matches `bash`:
|
|
244
|
-
|
|
245
|
-
| `wait` | Behavior |
|
|
246
|
-
| --- | --- |
|
|
247
|
-
| Omitted | Waits up to the automatic yield (default 10 seconds) and returns the reply inline if it arrives in time. |
|
|
248
|
-
| `{ kind: "foreground", budgetMs }` | Waits up to `budgetMs`, then yields. |
|
|
249
|
-
| `{ kind: "background" }` | Returns immediately after delivery. |
|
|
250
|
-
|
|
251
|
-
If an `ask` yields or is interrupted, it stays pending with no expiry. Its reply arrives later as a message starting `Reply to your ask <id> from <name>` (starting a turn when idle, or arriving after the current tool call when busy). Refusals and recipient exits arrive as failed-ask messages starting `Your ask <id> to <name> failed`. Saved sessions that close (anything other than `--no-session`) count as away rather than ended, so their asks stay pending until they reopen.
|
|
252
|
-
|
|
253
|
-
**Pending ask persistence and limits:**
|
|
254
|
-
|
|
255
|
-
- Use `pending` to view waiting asks and `cancel` (`askId`) to cancel one. Replies arriving after cancellation still show once, marked late.
|
|
256
|
-
- Restarting either session preserves open asks and delivers each reply once (holding replies for closed askers with `Reply delivered (held for <asker> until it is back)`).
|
|
257
|
-
- Asks waiting on a session that stays away for more than 7 days, or ends permanently, are dropped. Forked sessions do not inherit their parent's asks.
|
|
258
|
-
- Each closed recipient holds at most 1,000 waiting asks; asks beyond that fail immediately with `Session "<name>" went away and its queue of asks waiting for its return is full (limit 1000); this ask was not kept`. Existing asks and held replies are never evicted.
|
|
259
|
-
- Only the asked recipient can answer an ask; messages naming the ask from another session arrive as ordinary messages.
|
|
260
|
-
- Up to `maxPendingAsks` asks (default `6`) can wait inline concurrently; further asks still send and deliver their replies as messages.
|
|
261
|
-
|
|
262
|
-
An inbound ask stays in `pending` until you reply to it or close it with `intercom({ action: "cancel", replyTo })`. It also closes automatically when no reply can reach the asker (for example if the asker was one of your subagents and ended, or if the broker rejects the route).
|
|
263
|
-
|
|
264
|
-
**Subagents and terminal reply capability.** Single-target `send` and `ask` calls from `intercom` to completed or failed subagents queue immediately and resume the child through its launching session. Calls to paused or quit subagents queue without resuming until the launching session continues them.
|
|
265
|
-
|
|
266
|
-
Only permanently cancelled (`killed`) children, pattern sends, calls past the wake rate or chain limits, or a still-connected registration marked `replyCapability: "terminal"` reject asks immediately with `Target noninteractive child is terminal and cannot reply; launch a fresh child with explicit context`. In-flight pending asks fail explicitly if the recipient terminates before replying. Live interactive idle sessions remain askable.
|
|
267
|
-
|
|
268
|
-
**`contact_supervisor`** allows one blocking `need_decision` or `interview_request` wait per child at a time (coexisting with ordinary peer asks). A second concurrent supervisor wait fails with `Already waiting for a supervisor reply`. Blocking supervisor waits time out after 10 minutes. Only a direct single-child launch in an SDK session without a task host retains the terminal `[TASK_CONTEXT]` fresh-child handoff when a blocking parent request is claimed.
|
|
269
|
-
|
|
270
|
-
**`reply`** targets the incoming Intercom message that triggered the current turn, or falls back to the single unresolved inbound ask. When multiple asks are pending, inspect with `pending` and pass `to` or the exact `replyTo` message ID (required when one sender has multiple open asks). Explicit `to` and `replyTo` selectors override the active turn, must match each other if both are provided, and fail without fallback when unknown or stale.
|
|
295
|
+
## Programmatic and SDK reference
|
|
271
296
|
|
|
272
297
|
### From codemode scripts
|
|
273
298
|
|
|
@@ -292,22 +317,69 @@ return Promise.all(
|
|
|
292
317
|
);
|
|
293
318
|
```
|
|
294
319
|
|
|
295
|
-
###
|
|
320
|
+
### Reach policies
|
|
296
321
|
|
|
297
|
-
|
|
322
|
+
An SDK host can assign a reach policy via [`createAgentSession({ intercom: { group, reachable } })`](/sdk#intercom-group-and-reach) and update `reachable` dynamically with `session.intercom.setReachable(groups)`. To disable Intercom completely in an SDK session, pass `builtins: { intercom: false }` ([SDK tools](/sdk/reference#tools)). Invalid group names or calling `setReachable()` on a session created without an `intercom` policy throw `IntercomPolicyError` from `@bastani/atomic`:
|
|
298
323
|
|
|
299
|
-
|
|
324
|
+
```typescript
|
|
325
|
+
import { createAgentSession, IntercomPolicyError } from "@bastani/atomic";
|
|
326
|
+
|
|
327
|
+
try {
|
|
328
|
+
const { session } = await createAgentSession({
|
|
329
|
+
intercom: { group: "team-api", reachable: ["team-shared"] },
|
|
330
|
+
});
|
|
331
|
+
await session.intercom.setReachable(["team-shared", "team-qa"]);
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if (error instanceof IntercomPolicyError) {
|
|
334
|
+
console.error("Invalid Intercom policy:", error.message);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
300
337
|
|
|
301
|
-
|
|
338
|
+
// Disable the bundled Intercom package entirely for this session
|
|
339
|
+
const isolated = await createAgentSession({
|
|
340
|
+
builtins: { intercom: false },
|
|
341
|
+
});
|
|
342
|
+
```
|
|
302
343
|
|
|
303
|
-
-
|
|
304
|
-
-
|
|
344
|
+
- The session can list, send to, and ask only sessions in its home group, its `reachable` groups, or subgroups under its home group (`<group>/...`, where its subagents run). Out-of-policy targets fail with `Target session is outside this session's Intercom reach (...)` (or `Session not found` for unseen names) and are never queued or held.
|
|
345
|
+
- Reach is one-way: reaching group B does not let group B initiate messages back unless B's own memberships or policy allow it. Replies to asks received by B are always allowed.
|
|
346
|
+
- `groups` lists only home and reachable groups (including empty ones), `join` accepts only those groups, `leave` cannot remove the home group, and `list`/`status` peeks stay within reach.
|
|
347
|
+
- Narrowing `reachable` automatically leaves removed groups from the next call onward. In-flight sends already accepted by the broker keep their original reach; sends with unknown outcomes after a disconnect are never retried under a changed reach.
|
|
348
|
+
- Subagents of a policy-constrained session inherit a reach policy with their own group as home (placed under the parent's home group if custom) and no additional reachable groups. `contact_supervisor` keeps its authorized route.
|
|
305
349
|
|
|
306
|
-
|
|
350
|
+
The broker enforces reach policies server-side. Sessions with a reach policy require a current broker; if an older broker cannot be replaced automatically, connection fails with `IntercomReachUnsupportedError` until you run `atomic intercom restart`.
|
|
307
351
|
|
|
308
|
-
|
|
352
|
+
### Hosted sessions and registration purpose (SDK)
|
|
353
|
+
|
|
354
|
+
Custom SDK hosts can optionally pass `recipientPurpose` (`"agent"` or `"control"`) when registering a session; omitting it defaults to `"agent"`. Invalid values are rejected, and a session's purpose cannot change after registration.
|
|
355
|
+
|
|
356
|
+
A session can host lightweight sessions on its broker connection via `IntercomClient.hostSessions` (messages arrive as `hosted_message` events, and `send(to, { hostedSender })` sends as them). Refusals return `IntercomHostedSessionError` subclasses (`code`, `key` or `sessionId`, `hint`, `retryable: false`), importable with `isIntercomHostedSessionError` and `serializeIntercomHostedSessionError` / `rehydrateIntercomHostedSessionError` from `@bastani/intercom`:
|
|
357
|
+
|
|
358
|
+
| Class | `code` | When | What to do |
|
|
359
|
+
| --- | --- | --- | --- |
|
|
360
|
+
| `HostedSessionRequestError` | `invalid_hosted_frame` | Malformed request: 1 to 500 sessions per request under distinct non-empty keys, or 1 to 500 IDs to remove. | Fix the request and resend. |
|
|
361
|
+
| `HostedSessionRequestError` | `invalid_hosted_session` | Missing name, invalid agent registration, malformed return address, or group outside the hosting session's [reach policy](#reach-policies). | Fix the named item and resend. |
|
|
362
|
+
| `NotHostedSessionError` | `not_hosted_by_connection` | Send named a `hostedSender`, or removal named an ID, not hosted by this connection. | Use the hosting connection, or re-host after reconnecting. |
|
|
363
|
+
|
|
364
|
+
A hosting request unanswered after 5 seconds fails with `IntercomHostedSessionTimeoutError` (`code: "hosted_session_timeout"`, `retryable: true`). An older broker that does not support hosted sessions fails with `IntercomBrokerProtocolError` until you run `atomic intercom restart`.
|
|
309
365
|
|
|
310
|
-
|
|
366
|
+
### Released-subagent SDK errors
|
|
367
|
+
|
|
368
|
+
With multi-node routing on, a conflicting reply to a shared-database released-asker question returns a typed `IntercomReleasedReplyError` (`code`, `messageId`, `questionId`, `childName`, `hint`, `retryable`) with `reasonCode` matching `code`. Check `isIntercomReleasedReplyError`, `isReleasedReplyAnsweredError`, `isReleasedReplyInFlightError`, or `isRetryableIntercomReleasedReplyError` rather than matching message text. Import these classes, guards, `IntercomReleasedReplyErrorCode`, and `serializeIntercomReleasedReplyError` / `rehydrateIntercomReleasedReplyError` from `@bastani/intercom`.
|
|
369
|
+
|
|
370
|
+
| Class | `code` | When | `retryable` | What to do |
|
|
371
|
+
| --- | --- | --- | --- | --- |
|
|
372
|
+
| `ReleasedReplyAnsweredError` | `released_reply_answered` | The launching session already accepted another reply to this question, or refused a duplicate handoff after a lost confirmation. | `false` | Do not resend this reply. Send a new ordinary message if the subagent needs follow-up. |
|
|
373
|
+
| `ReleasedReplyInFlightError` | `released_reply_in_flight` | Another reply to this question is currently being handed to the launching session. | `true` | Wait, then reply again if the question is still unanswered. |
|
|
374
|
+
|
|
375
|
+
Reservation, drop, and wake-acknowledgement requests are atomic per request: if one item is refused, nothing in the request takes effect. Errors carry `code`, `childName` when applicable, `hint`, and `retryable: false`. Import classes, `isIntercomReleasedChildError`, `IntercomReleasedChildErrorCode`, and `serializeIntercomReleasedChildError` / `rehydrateIntercomReleasedChildError` from `@bastani/intercom`.
|
|
376
|
+
|
|
377
|
+
| Class | `code` | When | What to do |
|
|
378
|
+
| --- | --- | --- | --- |
|
|
379
|
+
| `ReleasedChildReservationError` | `not_owner` | Another session owns the child (reserved it first or authorized it as supervisor). | Send the request from the owning session, or launch a new child. |
|
|
380
|
+
| `ReleasedChildReservationError` | `group_not_allowed` | An older broker rejected a `workflow:` group reservation from a non-member session. | Reserve from a session in that group, or omit `group`. |
|
|
381
|
+
| `ReleasedChildReservationError` | `invalid_frame`, `invalid_child_name`, `invalid_alias`, `too_many_aliases`, `invalid_group` | Malformed request: requests accept 1 to 500 children, non-empty names other than `*`, at most 4 session-ID aliases, and string groups. | Fix the invalid item and retry. |
|
|
382
|
+
| `UnknownReleasedChildError` | `unknown_released_child` | Wake acknowledgement named a child no session reserved. | Reserve the child first. |
|
|
311
383
|
|
|
312
384
|
### Broker errors
|
|
313
385
|
|
|
@@ -325,53 +397,8 @@ Exported from `@bastani/atomic` with `isProjectGroupError()`, `isIntercomRouting
|
|
|
325
397
|
|
|
326
398
|
| Class | `code` | When it happens | Fields | What to do |
|
|
327
399
|
| --- | --- | --- | --- | --- |
|
|
328
|
-
| `ProjectGroupError` | `git-unavailable` or `git-failed` | Multi-node routing tried to derive `project:<
|
|
400
|
+
| `ProjectGroupError` | `git-unavailable` or `git-failed` | Multi-node routing tried to derive `project:<path>` inside a Git repository, but `git` is missing or failed. Not retried in the background. | `cwd`, `detail`, `hint` | Install Git, fix the repository error, or set `ATOMIC_INTERCOM_GROUP` to skip the lookup. |
|
|
329
401
|
| `IntercomRoutingMismatchError` | `broker-routing-mismatch` | The broker routes across machines while the session joined implicitly as `default` (`reason: "implicit-default-on-remote-broker"`), or the session selected shared storage (`storage` or `ATOMIC_PROFILE=ci`) while the running broker started without it (`reason: "shared-storage-not-on-broker"`). Terminal until session restart. | `reason`, `group`, `hint`, `retryable: false` | Run `atomic intercom restart` (if the broker lacks shared storage), then restart the session or set `ATOMIC_INTERCOM_GROUP`. |
|
|
330
402
|
| `IntercomRoutingUnavailableError` | `broker-routing-unavailable` | The broker closed status without answering (`reason: "unsupported"`), sent an unreadable report (`"malformed"`), or is an older broker that could not be replaced while multi-node storage is active. | `reason`, `phase`, `hint`, `retryable: true`, optional `cause` | Run `atomic intercom restart` to replace the broker. |
|
|
331
403
|
| `IntercomRoutingTimeoutError` | `broker-routing-timeout` | The broker accepted the routing status check but did not answer in time. | `timeoutMs`, `elapsedMs`, `phase`, `hint`, `retryable: true` | Wait for reconnect backoff, or run `atomic intercom restart` if it persists. |
|
|
332
404
|
| `IntercomRoutingChangedError` | `broker-routing-changed` | The broker's routing mode changed between the session's status check and registration, so registration was refused. | `expectedAcrossMachines`, `hint`, `retryable: true` | Wait for automatic retry, or run `atomic intercom restart` if it persists. |
|
|
333
|
-
|
|
334
|
-
## Configuration
|
|
335
|
-
|
|
336
|
-
Create `~/.atomic/agent/intercom/config.json` (Atomic falls back to `~/.pi/agent/intercom/config.json` when the Atomic file is absent):
|
|
337
|
-
|
|
338
|
-
```json
|
|
339
|
-
{
|
|
340
|
-
"brokerCommand": "npx",
|
|
341
|
-
"brokerArgs": ["--no-install", "tsx"],
|
|
342
|
-
"brokerStartupTimeoutMs": 30000,
|
|
343
|
-
"confirmSend": false,
|
|
344
|
-
"maxPendingAsks": 6,
|
|
345
|
-
"replyHint": true,
|
|
346
|
-
"status": "researching",
|
|
347
|
-
"group": "default",
|
|
348
|
-
"joinAtStartup": true
|
|
349
|
-
}
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
| Setting | Default | Description |
|
|
353
|
-
| --- | --- | --- |
|
|
354
|
-
| `brokerCommand` | `"npx"` | Command used to start the local broker process. The default sentinel uses Atomic's own runtime without requiring `npx` or `tsx` on `PATH`. |
|
|
355
|
-
| `brokerArgs` | `["--no-install", "tsx"]` | Arguments passed to `brokerCommand` before the broker script path. |
|
|
356
|
-
| `brokerStartupTimeoutMs` | `30000` | Integer >= `1000`. Milliseconds a spawn attempt waits for a newly started broker to answer on its socket. |
|
|
357
|
-
| `confirmSend` | `false` | Show a confirmation dialog before non-reply sends in interactive sessions with UI. |
|
|
358
|
-
| `maxPendingAsks` | `6` | Integer >= `1`. Maximum concurrent blocking reply waits per session; further asks still send and deliver replies as messages. |
|
|
359
|
-
| `replyHint` | `true` | Include the `intercom({ action: "reply", ... })` hint in incoming messages. |
|
|
360
|
-
| `status` | None | Optional custom status suffix appended after the automatic lifecycle status (for example `thinking · researching`). |
|
|
361
|
-
| `group` | `"default"`, or project group with multi-node routing | Default home Intercom group ([Groups](#groups)). Overridden by `ATOMIC_INTERCOM_GROUP` / `PI_INTERCOM_GROUP`, SDK host `intercom` policy, and subagent group injection. |
|
|
362
|
-
| `joinAtStartup` | `true` | Have interactive sessions join Intercom automatically a few seconds after startup. Set `false` to join on first Intercom use instead. Overridden by `ATOMIC_INTERCOM_JOIN_AT_STARTUP` (`0` disables, `1` enables). |
|
|
363
|
-
|
|
364
|
-
Explicit custom broker commands remain supported. For example, to run the broker with Bun from `PATH`:
|
|
365
|
-
|
|
366
|
-
```json
|
|
367
|
-
{
|
|
368
|
-
"brokerCommand": "bun",
|
|
369
|
-
"brokerArgs": []
|
|
370
|
-
}
|
|
371
|
-
```
|
|
372
|
-
|
|
373
|
-
Config validation is strict: if `config.json` is invalid JSON or any field has an invalid type or range, the entire file is rejected, an error is logged, and all defaults apply.
|
|
374
|
-
|
|
375
|
-
Intercom publishes live session status automatically: sessions register as `idle`, switch to `thinking` while running, show `tool:<name>` during tool calls, and return to `idle` on completion. Any configured `status` string is appended rather than replacing lifecycle status.
|
|
376
|
-
|
|
377
|
-
Activity status is not reply capability. Session rows expose `replyCapability` (`"live"` or `"terminal"`) when supplied by the host. A still-connected non-interactive child marked `"terminal"` rejects asks even if its activity reads `idle`, while a completed or failed subagent whose session has ended is resumed by single-target `send` or `ask` from the `intercom` tool.
|