@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
package/docs/extensions.md
CHANGED
|
@@ -1,111 +1,38 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Extensions
|
|
3
|
-
|
|
2
|
+
title: "Extensions overview"
|
|
3
|
+
sidebarTitle: "Extensions overview"
|
|
4
|
+
description: "Build TypeScript extensions that add tools, slash commands, lifecycle hooks, and custom terminal UI to Atomic."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Extensions are TypeScript modules that extend Atomic's behavior. They can subscribe to lifecycle events, register custom tools callable by the LLM, add commands, and render custom UI.
|
|
9
|
-
|
|
10
|
-
## Reloading and startup behavior
|
|
11
|
-
|
|
12
|
-
Put extensions in `~/.atomic/agent/extensions/` (global) or `.atomic/extensions/` (project-local) for auto-discovery; legacy `.pi` paths remain supported. Use `atomic -e ./path.ts` for quick tests.
|
|
13
|
-
|
|
14
|
-
Auto-discovered extensions hot-reload with `/reload`. Atomic evaluates each extension file and the local modules and JSON files it imports through its own transform, including plain JavaScript (`.mjs`, `.cjs`, and `.js`). ESM keeps `import.meta.url`, strict mode, top-level await, and package or Node built-in imports. CommonJS keeps `require`, `module.exports`, `__filename`, `__dirname`, and sloppy mode.
|
|
15
|
-
|
|
16
|
-
Under Bun, extensions also load through Atomic's extension loader on the first load (not only on `/reload`). That keeps `typebox` and Atomic package imports pointing to Atomic's own copies right away and matches native `import.meta` values (including Windows backslashes). Because the loader reads runtime globals through `globalThis`, modules that declare a top-level `globalThis` binding cannot be loaded this way under Node or Bun.
|
|
17
|
-
|
|
18
|
-
Packages imported by name resolve from the importing file as Node or Bun would, falling back to Atomic's copy of a host package only when none is installed. Named packages, files under `node_modules` outside the extension's own package, and modules loaded through `createRequire()` load once per process, so restart Atomic after editing them.
|
|
19
|
-
|
|
20
|
-
If `/reload` reports `Reload retiring cleanup failed`, the error includes the extension cleanup cause. The replacement extensions, updated settings, and joined Intercom groups stay active. Fix the cleanup error before reloading again.
|
|
21
|
-
|
|
22
|
-
If an optional extension fails to import or initialize during interactive startup or `/reload`, Atomic skips it and shows its path and reason under `[Extension issues]` while keeping the session usable. Fix the extension or its dependencies and run `/reload`. Print mode (`-p`) and standalone RPC mode (`--mode rpc`) report the named failure and exit with status 1 instead so scripts do not silently run without a requested extension. Required built-in failures and failed cleanup stop startup in every mode.
|
|
23
|
-
|
|
24
|
-
Legacy extensions can import the running host API from `@mariozechner/pi-coding-agent` or `@earendil-works/pi-coding-agent`, including in release-archive installs, without a separate installation.
|
|
7
|
+
Extensions are TypeScript or JavaScript modules that customize how Atomic behaves. You can use them to add custom tools, intercept lifecycle events, register slash commands, store session state, or render custom terminal UI.
|
|
25
8
|
|
|
26
9
|
Key capabilities:
|
|
27
10
|
|
|
28
|
-
- **Custom tools.** Register tools the
|
|
29
|
-
- **Event
|
|
30
|
-
- **User interaction.**
|
|
31
|
-
- **Custom UI components.** Render interactive
|
|
32
|
-
- **Custom commands.** Register slash commands such as `/mycommand`
|
|
33
|
-
- **Session persistence.** Store durable
|
|
34
|
-
- **Reload-surviving state.** Keep in-memory objects alive across `/reload`
|
|
35
|
-
- **Custom rendering.** Control how tool calls, tool results, and custom messages appear in the
|
|
11
|
+
- **Custom tools.** Register tools the model can call with `atomic.registerTool()`.
|
|
12
|
+
- **Event hooks.** Block or modify tool calls, adjust context before requests, observe or replace compaction, and customize branch summaries.
|
|
13
|
+
- **User interaction.** Show interactive prompts and notifications via `ctx.ui` (`select`, `confirm`, `input`, `editor`, `notify`).
|
|
14
|
+
- **Custom UI components.** Render interactive terminal components and overlays with `ctx.ui.custom()`.
|
|
15
|
+
- **Custom commands.** Register slash commands such as `/mycommand` with `atomic.registerCommand()`.
|
|
16
|
+
- **Session persistence.** Store durable data across restarts with `atomic.appendEntry()`.
|
|
17
|
+
- **Reload-surviving state.** Keep in-memory objects alive across `/reload` with `sessionScopedExtensionState()`.
|
|
18
|
+
- **Custom rendering.** Control how tool calls, tool results, and custom messages appear in the terminal.
|
|
36
19
|
|
|
37
|
-
Common use cases include permission gates, git checkpointing, path protection, compaction policies, conversation summaries
|
|
38
|
-
|
|
39
|
-
Atomic also ships an environment-gated [Herdr reporter](/herdr) that reports the parent session's activity, running tasks, and approval requests in its pane. It defers to loaded community or legacy reporters and can be disabled with `herdr.enabled` in settings. See [Herdr setup](/herdr#setup) and [status indicators](/herdr#status-indicators).
|
|
20
|
+
Common use cases include permission gates, git checkpointing, path protection, compaction policies, conversation summaries, interactive wizards, webhooks or file watchers, and waiting-time games. See [Extension examples](/extensions/examples) for runnable code.
|
|
40
21
|
|
|
41
22
|
## Where to go next
|
|
42
23
|
|
|
43
|
-
Read this
|
|
24
|
+
Read this overview for a working first extension, discovery locations, imports, and runtime behavior, then continue:
|
|
44
25
|
|
|
45
|
-
- [
|
|
46
|
-
- [Extension events](/extensions/events). Look up every event, its payload, and its return contract.
|
|
47
|
-
- [Extension UI](/extensions/ui).
|
|
48
|
-
- [Extension API reference](/extensions/api-reference). Reference `ExtensionContext`, `ExtensionCommandContext`, `ExtensionAPI` methods, and error handling.
|
|
49
|
-
- [Extension examples](/extensions/examples). Browse runnable
|
|
26
|
+
- [Write an extension](/extensions/authoring). Structure an extension, manage state, register custom tools, and customize rendering.
|
|
27
|
+
- [Extension events](/extensions/events). Look up every lifecycle event, its payload, and its return contract.
|
|
28
|
+
- [Extension UI](/extensions/ui). Build dialogs, widgets, host-native pickers and forms, custom components, and message renderers.
|
|
29
|
+
- [Extension API reference](/extensions/api-reference). Reference `ExtensionContext`, `ExtensionToolContext`, `ExtensionCommandContext`, `ExtensionAPI` methods, and error handling.
|
|
30
|
+
- [Extension examples](/extensions/examples). Browse runnable extensions shipped with Atomic.
|
|
31
|
+
- [SDK extensions](/sdk/reference#extensions) and [Structured decisions](/sdk/structured-decisions). Load extensions programmatically with `DefaultResourceLoader`, pass standalone `customTools`, or run schema-validated decisions.
|
|
50
32
|
- [Security](/security). Review the project-trust boundary that controls whether a project's extensions load.
|
|
51
33
|
|
|
52
34
|
If an extension is heavier than you need, compare lighter options on [Build with Atomic](/build).
|
|
53
35
|
|
|
54
|
-
## Startup and lazy discovery
|
|
55
|
-
|
|
56
|
-
Built-in MCP, subagent, web-access, and Intercom commands are available at startup. Their first use may wait for discovery or connection.
|
|
57
|
-
|
|
58
|
-
Commands wait for the resources they need before returning results, including MCP tool calls and explicit reloads. Discovery scope depends on the operation:
|
|
59
|
-
|
|
60
|
-
- Enabled MCP servers connect in the background when a session starts. The first prompt waits up to 10 seconds for servers with direct tools.
|
|
61
|
-
- Codemode waits for the MCP namespaces a script names; `searchTools()` and `ALL_TOOLS` require all enabled servers. Tool search and resource tools also wait for discovery.
|
|
62
|
-
- `/mcp` provides server management; `/mcp login`, `/mcp logout`, and `/mcp reconnect` accept an optional server name. Completion lists actions and eligible servers.
|
|
63
|
-
- Autocomplete falls back to current and administrative completions when lazy discovery fails.
|
|
64
|
-
|
|
65
|
-
Failed connections can be retried with `/mcp reconnect`, and dropped MCP connections reconnect on the next call. Web-access batches with no successful items report a tool error; partial successes keep their completed items.
|
|
66
|
-
|
|
67
|
-
MCP `timeout` is an inactivity limit in seconds (default 60 seconds), reset by progress rather than a fixed total deadline. See [MCP servers](/mcp-servers) for configuration, exposure, resources, OAuth, and shell commands.
|
|
68
|
-
|
|
69
|
-
## Interactive callback isolation
|
|
70
|
-
|
|
71
|
-
Interactive sessions isolate extension callbacks from terminal input handling so a busy callback does not block keyboard input or spinners.
|
|
72
|
-
|
|
73
|
-
Escape requests cooperative cancellation from the engine and waits as long as the engine takes. There is no deadline on that wait, and Escape never terminates or replaces the engine, so an interrupt cannot discard in-flight tool state.
|
|
74
|
-
|
|
75
|
-
Ctrl+C is the host's escape hatch in two situations.
|
|
76
|
-
|
|
77
|
-
First, while an engine-owned `ctx.ui.custom()` component or overlay holds input, every key goes to the engine child. Ownership of Ctrl+C is declared per mount:
|
|
78
|
-
|
|
79
|
-
- A component mounted with `handlesCtrlC: true` receives the first Ctrl+C press and keeps its own skip, close, or cancel binding. If that same component still holds input on the next Ctrl+C press, the host closes it so no component can trap the keyboard.
|
|
80
|
-
- A component without `handlesCtrlC: true` is closed on the first Ctrl+C press through the ordinary close path: its `ctx.ui.custom()` promise resolves with `undefined`, the editor returns, and the engine keeps running (along with any other mounted component).
|
|
81
|
-
|
|
82
|
-
Declare `handlesCtrlC: true` whenever your component's hint row offers `ctrl+c`. Native host selectors, dialogs, input forms, session pickers, and unrelated native overlays keep Ctrl+C as their own cancel.
|
|
83
|
-
|
|
84
|
-
```typescript
|
|
85
|
-
await ctx.ui.custom<string | undefined>(
|
|
86
|
-
(tui, theme, keybindings, done) => new PromptCard(tui, theme, done),
|
|
87
|
-
{ overlay: true, handlesCtrlC: true },
|
|
88
|
-
);
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Both safety keys match by physical key identity rather than the configured `app.clear` action, so rebinding `app.clear` (even to Escape) cannot route Escape into engine replacement or disable Ctrl+C recovery. Rebinding `app.clear` to another key keeps normal editor clearing, and key-release events never act.
|
|
92
|
-
|
|
93
|
-
Second, if the engine is unresponsive, an abort or replacement has waited over one second, or replacement failed, Ctrl+C terminates and replaces the engine. This takes precedence over custom UI bindings. A failed replacement remains recoverable with another Ctrl+C; Atomic does not keep retrying automatically.
|
|
94
|
-
|
|
95
|
-
After an unexpected engine stop, Atomic closes custom UI and attempts one automatic restart. A clean restart prints nothing unless messages were still queued.
|
|
96
|
-
|
|
97
|
-
If messages were queued, main-chat messages return to the editor (steering first) with the warning `Engine restarted; 2 queued messages weren't sent and are back in the editor`. For a subagent chat, known-unsent queued messages (both messages confirmed absent from disk and messages still listed in its queue) return ahead of any draft into that subagent's own editor (immediately if its view is open and writable, or on the first writable reopen in the same session with `Engine restarted; 2 queued messages to <agent> weren't sent; they're back in its editor when you open it`); when the subagent view is read-only or confirmation is unavailable, Atomic prints `Engine restarted; 2 queued messages to <agent> weren't sent:` and never writes into main's editor. None are sent twice, and unstarted submissions return as exact drafts while accepted work is not retried automatically. With debug logging enabled, the restart cause goes to the debug log. A failed restart leaves the editor usable and reports `Interactive engine restart failed: ...`.
|
|
98
|
-
|
|
99
|
-
If a saved tool call has no recorded result, reopening the session marks its result unavailable. **Inspect files or external systems before retrying because the tool may already have had side effects.**
|
|
100
|
-
|
|
101
|
-
When spawning processes from an extension, pass an explicit `env` derived from `process.env`. Engine-only bootstrap values are not exposed there.
|
|
102
|
-
|
|
103
|
-
Dialogs, `ctx.ui.custom()` components, and component-factory widgets run in the isolated engine child and proxy rendered lines to the host with asynchronous input forwarding. Custom UI results must be JSON-safe. APIs that require a synchronous callback in the terminal host (raw `onTerminalInput` transforms, synchronous `getEditorText`, custom editor factories, autocomplete wrappers, and custom header or footer factories) are unavailable in isolated interactive mode and produce a warning instead of running extension code in the host. Print and public RPC modes keep their own execution models.
|
|
104
|
-
|
|
105
|
-
Use `ctx.ui.hostSessionPicker(request)` for a session-style picker with local navigation and search. Pass JSON-safe `HostSessionPickerRow` values (`SessionInfo` with `createdAt` and `modifiedAt` in epoch milliseconds). The returned handle provides `result`, `update(rows)`, `error(message)`, and `close()`. `result` resolves to the selected `path` or `undefined` on cancel, and your `onDelete(path)` callback owns deletion. This API works in both interactive modes and is absent in print and headless RPC. See [Host-native session picker](/tui/reference#host-native-session-picker).
|
|
106
|
-
|
|
107
|
-
For structured forms, use `ctx.ui.hostInputForm(request)` with JSON-safe descriptors (`string`, `text`, `number`, `integer`, `boolean`, or `select`) and raw `initialValue` fields. It resolves to a raw string record or `undefined` on cancel, and rejects with `"The host could not read this input form."` if the host cannot read the form. Editing, navigation, validation, and configured keybindings run locally in both interactive modes. Print and headless RPC omit this API. See [Host-native input form](/tui/reference#host-native-input-form).
|
|
108
|
-
|
|
109
36
|
## Quick start
|
|
110
37
|
|
|
111
38
|
Create `~/.atomic/agent/extensions/my-extension.ts` (the factory parameter can have any name; older extensions and examples call it `pi`):
|
|
@@ -135,7 +62,7 @@ export default function (atomic: ExtensionAPI) {
|
|
|
135
62
|
parameters: Type.Object({
|
|
136
63
|
name: Type.String({ description: "Name to greet" }),
|
|
137
64
|
}),
|
|
138
|
-
async execute(
|
|
65
|
+
async execute(_toolCallId, params) {
|
|
139
66
|
return {
|
|
140
67
|
content: [{ type: "text", text: `Hello, ${params.name}!` }],
|
|
141
68
|
details: {},
|
|
@@ -153,30 +80,70 @@ export default function (atomic: ExtensionAPI) {
|
|
|
153
80
|
}
|
|
154
81
|
```
|
|
155
82
|
|
|
156
|
-
Test with
|
|
83
|
+
Test it for one run with `-e` (or `--extension`):
|
|
157
84
|
|
|
158
85
|
```bash
|
|
159
86
|
atomic -e ./my-extension.ts
|
|
160
87
|
```
|
|
161
88
|
|
|
89
|
+
### Loading in the SDK
|
|
90
|
+
|
|
91
|
+
Embedded apps can load extension files, pass inline factories through `DefaultResourceLoader`, or register standalone tools directly with `createAgentSession({ customTools })`:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import { createAgentSession, DefaultResourceLoader, defineTool } from "@bastani/atomic";
|
|
95
|
+
import { Type } from "@bastani/atomic/typebox";
|
|
96
|
+
|
|
97
|
+
const loader = new DefaultResourceLoader({
|
|
98
|
+
additionalExtensionPaths: ["./my-extension.ts"],
|
|
99
|
+
extensionFactories: [
|
|
100
|
+
(atomic) => {
|
|
101
|
+
atomic.on("agent_start", () => console.log("Starting run"));
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
});
|
|
105
|
+
await loader.reload();
|
|
106
|
+
|
|
107
|
+
const pingTool = defineTool({
|
|
108
|
+
name: "ping",
|
|
109
|
+
label: "Ping",
|
|
110
|
+
description: "Return pong",
|
|
111
|
+
parameters: Type.Object({}),
|
|
112
|
+
async execute() {
|
|
113
|
+
return { content: [{ type: "text", text: "pong" }], details: {} };
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const { session } = await createAgentSession({
|
|
118
|
+
resourceLoader: loader,
|
|
119
|
+
customTools: [pingTool],
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
See [SDK extensions](/sdk/reference#extensions) and [SDK custom tools](/sdk/reference#custom-tools).
|
|
124
|
+
|
|
162
125
|
## Extension locations
|
|
163
126
|
|
|
164
127
|
> **Security:** Extensions run with your full system permissions and can execute arbitrary code. Install only from sources you trust.
|
|
165
128
|
|
|
166
|
-
|
|
129
|
+
Atomic auto-discovers extensions from these locations:
|
|
167
130
|
|
|
168
131
|
| Location | Scope |
|
|
169
|
-
|
|
170
|
-
| `~/.atomic/agent/extensions/*.ts` | Global (all projects) |
|
|
171
|
-
| `~/.atomic/agent/extensions/*/index.ts` | Global
|
|
172
|
-
|
|
|
173
|
-
| `.atomic/extensions
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| `~/.atomic/agent/extensions/*.{ts,js}` | Global single-file extensions (all projects) |
|
|
134
|
+
| `~/.atomic/agent/extensions/*/index.{ts,js}` | Global subdirectory extensions |
|
|
135
|
+
| `~/.atomic/agent/extensions/*/package.json` | Global subdirectories declaring `atomic.extensions` (or legacy `pi.extensions`) |
|
|
136
|
+
| `.atomic/extensions/*.{ts,js}` | Project single-file extensions (trusted projects only) |
|
|
137
|
+
| `.atomic/extensions/*/index.{ts,js}` | Project subdirectory extensions (trusted projects only) |
|
|
138
|
+
| `.atomic/extensions/*/package.json` | Project subdirectories declaring `atomic.extensions` (trusted projects only) |
|
|
174
139
|
|
|
175
|
-
|
|
140
|
+
Discovery rules:
|
|
176
141
|
|
|
177
|
-
|
|
142
|
+
- Scanning respects `.gitignore`, `.ignore`, and `.fdignore` inside extension directories, and skips dotfiles, dot-directories, and `node_modules`.
|
|
143
|
+
- Disable extension discovery with `--no-extensions` (short flag `-ne`). Explicit `-e` paths and the mandatory bundled Intercom extension still load.
|
|
144
|
+
- Atomic also discovers extensions and packages inherited from legacy `~/.pi/agent` and `.pi` directories. If an inherited legacy extension registers the exact same tool, command, prompt, flag, or shortcut name as a bundled Atomic extension, Atomic keeps the bundled registration and skips only that conflicting registration (summarized in yellow on interactive startup). Extensions configured through `.atomic` or passed with `-e` follow normal override rules.
|
|
178
145
|
|
|
179
|
-
Configure
|
|
146
|
+
Configure extra paths or packages in `settings.json`:
|
|
180
147
|
|
|
181
148
|
```json
|
|
182
149
|
{
|
|
@@ -191,204 +158,167 @@ Configure additional paths in `settings.json`:
|
|
|
191
158
|
}
|
|
192
159
|
```
|
|
193
160
|
|
|
161
|
+
To distribute extensions over npm or git, see [Install and manage packages](/packages).
|
|
162
|
+
|
|
194
163
|
### Built-in extension resources
|
|
195
164
|
|
|
196
|
-
Atomic exposes `builtin:llama.cpp
|
|
165
|
+
Atomic exposes `builtin:llama.cpp` ([llama.cpp](/llama-cpp)), `builtin:codemode` ([Codemode](/codemode)), and `builtin:tool-search` (which registers the [`tool_search`](/tools#tool_search) tool) as built-in extension resources rather than filesystem paths. Toggle them interactively in `atomic config`, or disable one in `settings.json`:
|
|
197
166
|
|
|
198
167
|
```json
|
|
199
168
|
{ "extensions": ["-builtin:codemode"] }
|
|
200
169
|
```
|
|
201
170
|
|
|
202
|
-
A trusted project `"+builtin:codemode"` entry
|
|
171
|
+
A trusted project `"+builtin:codemode"` entry overrides a global exclusion. You can also load one explicitly alongside `--no-extensions` (`-ne`):
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
atomic --no-extensions -e builtin:codemode --tools read,codemode
|
|
175
|
+
```
|
|
203
176
|
|
|
204
|
-
|
|
177
|
+
Passing an unrecognized `builtin:<name>` with `-e` stops with `Unknown built-in extension: builtin:<name>`.
|
|
205
178
|
|
|
206
|
-
|
|
179
|
+
Loading a built-in resource registers its tool. `codemode` is enabled in the default tool list (so a custom `--tools` list must name it), while `tool_search` is opt-in. Both `codemode` and `tool-search` are replaceable: a custom extension that registers the same tool, command, or flag takes over, and Atomic reports the replacement. Disable that extension in `atomic config` to restore the built-in version.
|
|
207
180
|
|
|
208
|
-
|
|
181
|
+
These built-in names do not replace Atomic's bundled MCP, subagent, web-access, or Intercom packages. There are no `builtin:mcp` or `builtin:subagents` aliases; configure those through package settings and MCP configuration.
|
|
209
182
|
|
|
210
183
|
## Available imports
|
|
211
184
|
|
|
185
|
+
Extensions can import Atomic's bundled packages without installing them in `node_modules`:
|
|
186
|
+
|
|
212
187
|
| Package | Purpose |
|
|
213
|
-
|
|
214
|
-
| `@bastani/atomic` | Extension types (`ExtensionAPI`, `ExtensionContext`, events)
|
|
215
|
-
| `
|
|
216
|
-
|
|
|
217
|
-
|
|
|
188
|
+
| --- | --- |
|
|
189
|
+
| [`@bastani/atomic`](/sdk) | Extension types (`ExtensionAPI`, `ExtensionContext`, events), helpers (`StringEnum`, `defineTool`), and built-in tool factories |
|
|
190
|
+
| [`@bastani/atomic/storage`](/sdk/storage) | Storage adapter interfaces, `createSqliteDatabase()`, and storage errors |
|
|
191
|
+
| `@bastani/atomic/typebox` | Atomic's copy of TypeBox plus subpaths (`/compile`, `/error`, `/format`, `/guard`, `/schema`, `/system`, `/type`, `/value`) |
|
|
192
|
+
| `typebox` and `@sinclair/typebox` | Direct schema imports (including `typebox/*`, `@sinclair/typebox/compile`, and `@sinclair/typebox/value`) resolve to Atomic's copy so formats registered with `Format.Set()` apply to tool validation |
|
|
193
|
+
| [`@bastani/atomic-ai`](/libraries/ai) | AI utilities, provider APIs, image generation, and subpaths (`/oauth`, `/models`, `/providers/all`) |
|
|
194
|
+
| [`@bastani/atomic-tui`](/libraries/tui) | Terminal UI components for custom rendering |
|
|
218
195
|
| [`@bastani/atomic-agent-core`](/libraries/agent-core) | Agent loop types and helpers |
|
|
219
|
-
| [`@bastani/atomic-codemode`](/libraries/codemode) | Codemode sandbox and declaration helpers |
|
|
220
|
-
| [`@bastani/atomic-schema`](/libraries/schema) | JSON Schema builders and
|
|
221
|
-
| [`@bastani/atomic-telemetry`](/libraries/telemetry) | Telemetry contracts |
|
|
196
|
+
| [`@bastani/atomic-codemode`](/libraries/codemode) | Codemode sandbox and declaration helpers (`@bastani/atomic-codemode/*`) |
|
|
197
|
+
| [`@bastani/atomic-schema`](/libraries/schema) | JSON Schema builders, validation, and `/formats` |
|
|
198
|
+
| [`@bastani/atomic-telemetry`](/libraries/telemetry) | Telemetry contracts and `/render` |
|
|
199
|
+
|
|
200
|
+
Atomic maintains these packages directly; [Libraries](/libraries) documents each one. Legacy import names (`@earendil-works/pi-*`, `@mariozechner/pi-*`, and `@bastani/pi-ai`) resolve to the same modules, including in release-archive installs. New extensions should import the `@bastani/atomic-*` names.
|
|
222
201
|
|
|
223
|
-
|
|
202
|
+
Node.js built-ins (`node:fs`, `node:path`, and the rest of `node:*`) are always available.
|
|
224
203
|
|
|
225
|
-
**Sharing TypeBox from dependencies and SDK apps.** Direct `typebox` imports inside an extension file
|
|
204
|
+
**Sharing TypeBox from dependencies and SDK apps.** Direct `typebox` imports inside an extension file map to Atomic's copy automatically. If a separate dependency or SDK app registers custom TypeBox formats, settings, or locales that must reach Atomic's tool validation, import from `@bastani/atomic/typebox` and its subpaths rather than from a separate `typebox` dependency. See [Sharing Atomic's TypeBox registry](/sdk#sharing-atomics-typebox-registry).
|
|
226
205
|
|
|
227
|
-
|
|
206
|
+
**Third-party npm dependencies.** Add a `package.json` next to your extension (or in a parent directory) and install dependencies with npm, pnpm, or Bun:
|
|
228
207
|
|
|
229
208
|
```bash
|
|
230
209
|
npm install
|
|
231
210
|
```
|
|
232
211
|
|
|
233
|
-
Imports from `node_modules/` resolve automatically.
|
|
234
|
-
|
|
235
|
-
For distributed Atomic packages installed with `atomic install` (npm or git), declare runtime dependencies in `dependencies`. Package installation installs production dependencies by default, so `devDependencies` are not available at runtime. When `npmCommand` is configured, git packages run a plain `install` for wrapper compatibility.
|
|
212
|
+
Imports from `node_modules/` resolve automatically. For distributed packages installed with `atomic install` (npm or git), declare runtime dependencies in `dependencies`; `devDependencies` are omitted by default. When `npmCommand` is configured in `settings.json`, git package installs still detect `npm`, `pnpm`, or `bun` inside wrapper commands (such as `["mise", "exec", "node@20", "--", "npm"]`) and pass manager-specific flags to skip dev and peer dependencies. Plain `install` runs only for unrecognized package manager commands.
|
|
236
213
|
|
|
237
214
|
### Tool parameter schemas
|
|
238
215
|
|
|
239
|
-
A tool's `parameters` can be a TypeBox schema or any plain JSON Schema object. Atomic validates the model
|
|
240
|
-
|
|
241
|
-
- **TypeBox schemas** are converted and checked by TypeBox, so TypeBox features outside JSON Schema (such as `Type.Refine()` and formats registered with `Format.Set()`) apply and validation errors use TypeBox's messages.
|
|
242
|
-
- **Plain JSON Schema** (such as an MCP server's tool schema or a schema built with `@bastani/atomic-schema`) is coerced and checked by `@bastani/atomic-schema`. A single value is wrapped into a one-item array when an array is expected, the `url` and `json-pointer-uri-fragment` formats are checked, and an unresolved `$ref` rejects only the argument at that field instead of every call. Validation errors use `@bastani/atomic-schema`'s messages, such as `- path: missing` or `- limit: expected number, got string`.
|
|
216
|
+
A tool's `parameters` can be a TypeBox schema or any plain JSON Schema object. Atomic validates arguments from the model after coercing loosely typed values (such as a numeric string to a number, `"true"` to `true`, or dropping `null` on an optional property):
|
|
243
217
|
|
|
244
|
-
|
|
218
|
+
- **TypeBox schemas** are validated by TypeBox, so TypeBox features outside JSON Schema (such as `Type.Refine()` and formats registered with `Format.Set()`) apply and errors use TypeBox's format.
|
|
219
|
+
- **Plain JSON Schema** (such as an MCP server's schema or one built with `@bastani/atomic-schema`) is coerced and checked by `@bastani/atomic-schema`. Single values wrap into one-item arrays when an array is expected, `url` and `json-pointer-uri-fragment` formats are checked, and an unresolved `$ref` rejects only that field instead of every call. Errors use `@bastani/atomic-schema`'s format, such as `- path: missing` or `- limit: expected number, got string`.
|
|
245
220
|
|
|
246
221
|
## Mode behavior
|
|
247
222
|
|
|
248
223
|
| Mode | UI methods | Notes |
|
|
249
|
-
|
|
250
|
-
| Interactive | Full TUI |
|
|
224
|
+
| --- | --- | --- |
|
|
225
|
+
| Interactive | Full TUI | Extensions run in a background worker so slow callbacks do not freeze the terminal |
|
|
251
226
|
| RPC (`--mode rpc`) | JSON protocol | Host handles UI; see [RPC mode](/rpc) |
|
|
252
227
|
| JSON (`--mode json`) | No-op | Event stream to stdout; see [JSON mode](/json) |
|
|
253
228
|
| Print (`-p`) | No-op | Extensions run without interactive prompts |
|
|
254
229
|
|
|
255
|
-
|
|
230
|
+
Check `ctx.hasUI` (or `ctx.mode === "tui"`) before using UI methods in extensions that may run outside interactive mode.
|
|
231
|
+
|
|
232
|
+
## Reloading and startup behavior
|
|
233
|
+
|
|
234
|
+
Auto-discovered extensions hot-reload when you run `/reload`. Atomic transpiles each extension file along with local TypeScript, JavaScript (`.mjs`, `.cjs`, `.js`), and JSON files it imports by relative path, so edits to those local files take effect on `/reload`.
|
|
235
|
+
|
|
236
|
+
- **Module format.** ESM files keep `import.meta.url`, strict mode, top-level `await`, and package or Node built-in imports. CommonJS files keep `require`, `module.exports`, `__filename`, and `__dirname`.
|
|
237
|
+
- **Caching on `/reload`.** Named npm packages, files under `node_modules` outside the extension's own package, and modules loaded via `createRequire()` are loaded once per process. Restart Atomic after editing those files.
|
|
238
|
+
- **Bun and `globalThis`.** Under Bun, extensions load through Atomic's loader on initial startup as well as `/reload`, keeping `typebox` and `@bastani/atomic-*` imports pinned to Atomic's own copies. Modules that declare a top-level variable named `globalThis` cannot be loaded under either Node or Bun.
|
|
239
|
+
- **Load failures.** If an optional extension fails to import or initialize during interactive startup or `/reload`, Atomic skips it, lists its path and error under `[Extension issues]`, and keeps the session open. Fix the issue and run `/reload`. In print (`-p`) and standalone RPC (`--mode rpc`) modes, any extension load failure prints the error and exits with code 1. Required built-in failures and cleanup failures stop startup in every mode.
|
|
240
|
+
- **Reload cleanup failures.** If `/reload` reports `Reload retiring cleanup failed`, the error names the failing cleanup callback while keeping the replacement extensions, updated settings, and Intercom groups active. Fix the cleanup bug before reloading again.
|
|
241
|
+
- **Built-in Herdr status reporter.** Inside a Herdr pane, Atomic automatically reports parent session status and resume commands with its built-in [Herdr integration](/herdr) and skips Herdr's legacy `herdr-agent-state.ts` or `.js` file (outside a Herdr pane, that legacy file loads normally). If you installed a separate `herdr-atomic-reporter` extension, disable either that extension or `herdr.enabled` in `settings.json` to prevent flickering status updates. See [Herdr setup](/herdr#setup).
|
|
242
|
+
|
|
243
|
+
## Startup and lazy discovery
|
|
244
|
+
|
|
245
|
+
Built-in [MCP](/mcp-servers), [subagent](/subagents), [web-access](/web-access), and [Intercom](/intercom) commands are available immediately at startup. Their first call may wait for background discovery or connection to finish:
|
|
246
|
+
|
|
247
|
+
- Enabled MCP servers connect in the background at startup. Your first prompt waits up to 10 seconds for servers that expose direct tools.
|
|
248
|
+
- Codemode waits for the MCP namespaces a script names; `searchTools()` and `ALL_TOOLS` wait for all enabled servers. Tool search and resource tools wait for discovery too.
|
|
249
|
+
- `/mcp` manages servers, and `/mcp login`, `/mcp logout`, and `/mcp reconnect` accept an optional server name. If lazy discovery fails, autocomplete falls back to currently known commands.
|
|
250
|
+
- Dropped MCP connections reconnect on the next call, and failed connections can be retried with `/mcp reconnect`. Web-access batches report a tool error when every item fails and keep completed items on partial success.
|
|
251
|
+
|
|
252
|
+
MCP `timeout` is an inactivity limit in seconds (default 60 seconds) that resets on progress rather than a fixed total deadline. See [MCP servers](/mcp-servers) for details.
|
|
253
|
+
|
|
254
|
+
<div id="interactive-callback-isolation" />
|
|
255
|
+
|
|
256
|
+
## Responsive UI and crash recovery
|
|
257
|
+
|
|
258
|
+
In default interactive mode, Atomic runs extensions in a separate background worker process so slow or stuck extension code does not freeze keyboard input or terminal spinners.
|
|
259
|
+
|
|
260
|
+
### Cancellation and Ctrl+C safety
|
|
261
|
+
|
|
262
|
+
- **Escape** asks the active turn or tool to cancel cooperatively and waits until it finishes. Escape never kills the worker process, so in-flight tool state is not discarded mid-operation.
|
|
263
|
+
- **Ctrl+C while custom UI is open:**
|
|
264
|
+
- If a `ctx.ui.custom()` component sets `{ handlesCtrlC: true }`, it receives the first `Ctrl+C` press for its own skip, close, or cancel behavior. If the same component still holds input on a second `Ctrl+C`, Atomic closes it so no extension can trap your keyboard.
|
|
265
|
+
- Without `handlesCtrlC: true`, the first `Ctrl+C` closes the component immediately, resolves its `ctx.ui.custom()` promise with `undefined`, and returns focus to the editor while the session keeps running.
|
|
266
|
+
- Set `handlesCtrlC: true` whenever your component displays a `ctrl+c` hint. Built-in selectors, dialogs, input forms, and session pickers handle `Ctrl+C` directly.
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
await ctx.ui.custom<string | undefined>(
|
|
270
|
+
(tui, theme, keybindings, done) => new PromptCard(tui, theme, done),
|
|
271
|
+
{ overlay: true, handlesCtrlC: true },
|
|
272
|
+
);
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
- **Ctrl+C when the worker is hung:** If the extension worker stops responding, an abort or restart waits longer than one second, or a prior restart failed, `Ctrl+C` terminates and restarts the worker (taking priority over custom UI bindings). Both `Escape` and `Ctrl+C` match physical keys, so rebinding `app.clear` cannot disable recovery.
|
|
276
|
+
|
|
277
|
+
### Automatic restart and queued messages
|
|
278
|
+
|
|
279
|
+
If the extension worker crashes unexpectedly, Atomic closes open custom UI and attempts one automatic restart. A clean restart stays quiet unless messages were still queued:
|
|
280
|
+
|
|
281
|
+
- Queued main-chat messages return to the editor (steering messages first) with a warning such as `Engine restarted; 2 queued messages weren't sent and are back in the editor`.
|
|
282
|
+
- Queued subagent messages confirmed not yet sent return ahead of any draft in that subagent's editor (immediately if open and writable, or when reopened), or print a notice if the subagent view is read-only. They are never placed into the main chat editor or sent twice.
|
|
283
|
+
- Drafts that never started are restored verbatim; work that already started is not retried automatically. If a saved tool call has no recorded result, reopening the session marks its result unavailable. **Inspect affected files or external systems before retrying because the tool may already have had side effects.**
|
|
284
|
+
- If you spawn child processes from an extension, derive an explicit `env` object from `process.env`; internal startup variables are not exported there.
|
|
285
|
+
|
|
286
|
+
### UI APIs in default interactive mode
|
|
287
|
+
|
|
288
|
+
Dialogs, `ctx.ui.custom()` components, and widget factories run inside the extension worker and forward rendered output to the terminal. Values returned from `ctx.ui.custom()` must be JSON-serializable.
|
|
289
|
+
|
|
290
|
+
APIs that require synchronous access inside the terminal UI process (`ctx.ui.onTerminalInput`, synchronous `ctx.ui.getEditorText`, `ctx.ui.setEditorComponent`, `ctx.ui.addAutocompleteProvider`, `ctx.ui.setHeader`, and `ctx.ui.setFooter`) do not run in default interactive mode and emit a warning instead. For interactive pickers and structured forms that work natively in default interactive mode, use `ctx.ui.hostSessionPicker()` and `ctx.ui.hostInputForm()`. See [Host-native pickers and forms](/extensions/ui#host-native-pickers-and-forms).
|
|
256
291
|
|
|
257
292
|
## Moved sections
|
|
258
293
|
|
|
259
|
-
<
|
|
260
|
-
|
|
261
|
-
<
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
<
|
|
266
|
-
|
|
267
|
-
<
|
|
268
|
-
|
|
269
|
-
<
|
|
270
|
-
|
|
271
|
-
<
|
|
272
|
-
|
|
273
|
-
<
|
|
274
|
-
|
|
275
|
-
<
|
|
276
|
-
<a id="renderresult" />
|
|
277
|
-
<a id="keybinding-hints" />
|
|
278
|
-
<a id="best-practices" />
|
|
279
|
-
<a id="fallback" />
|
|
280
|
-
|
|
281
|
-
- Extension structure, state management, custom tools, overrides, remote execution, truncation, and custom rendering moved to [Writing extensions](/extensions/authoring).
|
|
282
|
-
|
|
283
|
-
<a id="events" />
|
|
284
|
-
<a id="lifecycle-overview" />
|
|
285
|
-
<a id="startup-events" />
|
|
286
|
-
<a id="project_trust" />
|
|
287
|
-
<a id="resource-events" />
|
|
288
|
-
<a id="resources_discover" />
|
|
289
|
-
<a id="session-events" />
|
|
290
|
-
<a id="session_start" />
|
|
291
|
-
<a id="session_info_changed" />
|
|
292
|
-
<a id="session_before_switch" />
|
|
293
|
-
<a id="session_before_fork" />
|
|
294
|
-
<a id="session_before_compact-/-session_compact-/-session_compact_failed" />
|
|
295
|
-
<a id="session_before_tree-/-session_tree" />
|
|
296
|
-
<a id="session_shutdown" />
|
|
297
|
-
<a id="agent-events" />
|
|
298
|
-
<a id="before_agent_start" />
|
|
299
|
-
<a id="agent_start-/-agent_end-/-agent_before_settle-/-agent_settled" />
|
|
300
|
-
<a id="ui_prompt_start-/-ui_prompt_end" />
|
|
301
|
-
<a id="turn_start-/-turn_end" />
|
|
302
|
-
<a id="message_start-/-message_update-/-message_end" />
|
|
303
|
-
<a id="tool_execution_start-/-tool_execution_update-/-tool_execution_end" />
|
|
304
|
-
<a id="context" />
|
|
305
|
-
<a id="context_with_system" />
|
|
306
|
-
<a id="before_provider_headers" />
|
|
307
|
-
<a id="before_provider_request" />
|
|
308
|
-
<a id="after_provider_response" />
|
|
309
|
-
<a id="model-events" />
|
|
310
|
-
<a id="model_select" />
|
|
311
|
-
<a id="thinking_level_select" />
|
|
312
|
-
<a id="tool-events" />
|
|
313
|
-
<a id="tool_call" />
|
|
314
|
-
<a id="typing-custom-tool-input" />
|
|
315
|
-
<a id="tool_result" />
|
|
316
|
-
<a id="user-bash-events" />
|
|
317
|
-
<a id="user_bash" />
|
|
318
|
-
<a id="input-events" />
|
|
319
|
-
<a id="input" />
|
|
294
|
+
<div id="session-scoped-in-memory-state" />
|
|
295
|
+
|
|
296
|
+
<div id="custom-rendering" />
|
|
297
|
+
|
|
298
|
+
- Extension structure, state management, custom tools, overrides, remote execution, truncation, and custom rendering moved to [Write an extension](/extensions/authoring).
|
|
299
|
+
|
|
300
|
+
<div id="before_agent_start" />
|
|
301
|
+
|
|
302
|
+
<div id="message_start--message_update--message_end" />
|
|
303
|
+
|
|
304
|
+
<div id="before_provider_request" />
|
|
305
|
+
|
|
306
|
+
<div id="thinking_level_select" />
|
|
307
|
+
|
|
308
|
+
<div id="tool-call-events" />
|
|
309
|
+
|
|
310
|
+
<div id="user_bash" />
|
|
320
311
|
|
|
321
312
|
- Lifecycle diagrams, event payloads, and return contracts moved to [Extension events](/extensions/events).
|
|
322
313
|
|
|
323
|
-
<
|
|
324
|
-
<a id="dialogs" />
|
|
325
|
-
<a id="timed-dialogs-with-countdown" />
|
|
326
|
-
<a id="manual-dismissal-with-abortsignal" />
|
|
327
|
-
<a id="widgets-status-and-footer" />
|
|
328
|
-
<a id="autocomplete-providers" />
|
|
329
|
-
<a id="custom-components" />
|
|
330
|
-
<a id="overlay-mode-experimental" />
|
|
331
|
-
<a id="custom-editor" />
|
|
332
|
-
<a id="message-rendering" />
|
|
333
|
-
<a id="theme-colors" />
|
|
314
|
+
<div id="widgets-status-and-footer" />
|
|
334
315
|
|
|
335
|
-
|
|
316
|
+
<div id="autocomplete-providers" />
|
|
336
317
|
|
|
337
|
-
|
|
338
|
-
<a id="ctx-ui" />
|
|
339
|
-
<a id="ctx-hasui" />
|
|
340
|
-
<a id="ctx-cwd" />
|
|
341
|
-
<a id="ctx-isprojecttrusted" />
|
|
342
|
-
<a id="ctx-sessionmanager" />
|
|
343
|
-
<a id="ctx-modelregistry-/-ctx-model-/-ctx-scopedmodels" />
|
|
344
|
-
<a id="ctx-signal" />
|
|
345
|
-
<a id="ctx-isidle-/-ctx-abort-/-ctx-haspendingmessages" />
|
|
346
|
-
<a id="ctx-isprojecttrusted-2" />
|
|
347
|
-
<a id="ctx-shutdown" />
|
|
348
|
-
<a id="ctx-getcontextusage" />
|
|
349
|
-
<a id="ctx-compact" />
|
|
350
|
-
<a id="ctx-getsystemprompt" />
|
|
351
|
-
<a id="ctx-getskillcatalog" />
|
|
352
|
-
<a id="extensioncommandcontext" />
|
|
353
|
-
<a id="ctx-waitforidle" />
|
|
354
|
-
<a id="ctx-newsession-options" />
|
|
355
|
-
<a id="ctx-fork-entryid-options" />
|
|
356
|
-
<a id="ctx-navigatetree-targetid-options" />
|
|
357
|
-
<a id="ctx-switchsession-sessionid-options" />
|
|
358
|
-
<a id="session-replacement-lifecycle-and-footguns" />
|
|
359
|
-
<a id="ctx-reload" />
|
|
360
|
-
<a id="extensionapi-methods" />
|
|
361
|
-
<a id="pi-on-event-handler" />
|
|
362
|
-
<a id="pi-registertool-definition" />
|
|
363
|
-
<a id="built-in-tool-prompt-contributions" />
|
|
364
|
-
<a id="pi-sendmessage-message-options" />
|
|
365
|
-
<a id="pi-sendmessages-messages-options" />
|
|
366
|
-
<a id="pi-sendusermessage-content-options" />
|
|
367
|
-
<a id="pi-appendentry-customtype-data" />
|
|
368
|
-
<a id="pi-registerentryrenderer-customtype-renderer" />
|
|
369
|
-
<a id="pi-setsessionname-name" />
|
|
370
|
-
<a id="pi-getsessionname" />
|
|
371
|
-
<a id="pi-setlabel-entryid-label" />
|
|
372
|
-
<a id="pi-registercommand-name-options" />
|
|
373
|
-
<a id="pi-getcommands" />
|
|
374
|
-
<a id="pi-registermessagerenderer-customtype-renderer" />
|
|
375
|
-
<a id="pi-registermarkdowntransformer-transformer" />
|
|
376
|
-
<a id="pi-registershortcut-shortcut-options" />
|
|
377
|
-
<a id="pi-registerflag-name-options" />
|
|
378
|
-
<a id="pi-registeragentpanelsource-source" />
|
|
379
|
-
<a id="pi-exec-command-args-options" />
|
|
380
|
-
<a id="pi-getactivetools-/-pi-getalltools-/-pi-setactivetools-names" />
|
|
381
|
-
<a id="pi-setmodel-model" />
|
|
382
|
-
<a id="pi-getthinkinglevel-/-pi-setthinkinglevel-level" />
|
|
383
|
-
<a id="pi-events" />
|
|
384
|
-
<a id="native-providers" />
|
|
385
|
-
<a id="pi-registerprovider-name-config" />
|
|
386
|
-
<a id="pi-unregisterprovider-name" />
|
|
387
|
-
<a id="pi-registermcpserver-name-config" />
|
|
388
|
-
<a id="error-handling" />
|
|
318
|
+
- Dialogs, widgets, autocomplete providers, custom components, overlays, custom editors, and theme helpers moved to [Extension UI](/extensions/ui).
|
|
389
319
|
|
|
390
|
-
|
|
320
|
+
<div id="ctxsignal" />
|
|
391
321
|
|
|
392
|
-
<
|
|
322
|
+
<div id="pigetcommands" />
|
|
393
323
|
|
|
394
|
-
-
|
|
324
|
+
- `ExtensionContext`, `ExtensionCommandContext`, `ExtensionAPI` methods, and error handling moved to [Extension API reference](/extensions/api-reference).
|