@bastani/atomic 0.10.9-alpha.1 → 0.10.10-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/README.md +211 -155
- 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} +145 -58
- 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 +85 -114
- 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 +37 -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 +71 -138
- 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 +60 -87
- 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 +235 -243
- package/docs/build.md +12 -11
- package/docs/codemode.md +60 -51
- package/docs/compaction/reference.md +61 -24
- package/docs/compaction.md +117 -65
- package/docs/computer-use.md +179 -146
- package/docs/containerization.md +79 -33
- package/docs/custom-provider/api-reference.md +148 -11
- package/docs/custom-provider/oauth.md +44 -27
- package/docs/custom-provider/override.md +14 -7
- package/docs/custom-provider/registration.md +75 -65
- package/docs/custom-provider/streaming.md +42 -19
- package/docs/custom-provider.md +25 -61
- package/docs/development.md +47 -43
- package/docs/docs.json +33 -33
- package/docs/environment-variables.md +83 -57
- package/docs/extensions/api-reference.md +323 -734
- 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 +152 -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 +42 -20
- package/docs/guides/intercom.md +17 -13
- package/docs/guides/non-interactive.md +29 -16
- package/docs/guides/orchestration.md +16 -10
- package/docs/guides/resume-on-any-machine.md +54 -49
- package/docs/guides/subagents.md +22 -14
- package/docs/guides/team-setup.md +37 -26
- package/docs/guides.md +22 -21
- package/docs/herdr.md +21 -16
- package/docs/index.md +16 -17
- package/docs/intercom/operations.md +68 -66
- package/docs/intercom/reference.md +196 -191
- package/docs/intercom.md +103 -92
- package/docs/json.md +71 -71
- package/docs/keybindings.md +63 -50
- package/docs/libraries/agent-core.md +49 -8
- package/docs/libraries/ai.md +21 -12
- package/docs/libraries/codemode.md +28 -6
- package/docs/libraries/schema.md +7 -7
- package/docs/libraries/telemetry.md +7 -7
- package/docs/libraries/tui.md +74 -94
- package/docs/libraries.md +5 -5
- package/docs/llama-cpp.md +38 -33
- package/docs/mcp-servers.md +96 -90
- package/docs/models/reference.md +46 -33
- package/docs/models-configuration.md +12 -6
- package/docs/models.md +93 -88
- package/docs/orchestration/migrating-workflows.md +21 -19
- package/docs/orchestration/patterns.md +35 -20
- package/docs/orchestration.md +22 -21
- package/docs/packages/authoring.md +28 -19
- package/docs/packages/reference.md +75 -16
- package/docs/packages.md +31 -33
- package/docs/programmatic.md +22 -21
- package/docs/prompt-templates.md +63 -41
- package/docs/providers/reference.md +35 -19
- package/docs/providers.md +61 -71
- package/docs/quickstart.md +32 -46
- package/docs/reference/cli.md +249 -252
- package/docs/reference.md +23 -20
- package/docs/rpc/examples.md +74 -17
- package/docs/rpc/extension-ui.md +79 -62
- package/docs/rpc/protocol.md +816 -358
- package/docs/rpc.md +75 -151
- package/docs/sdk/reference.md +175 -45
- package/docs/sdk/structured-decisions.md +92 -62
- package/docs/sdk/web-server.md +79 -46
- package/docs/sdk.md +237 -195
- package/docs/security.md +106 -43
- package/docs/session-format.md +96 -59
- package/docs/sessions.md +149 -113
- package/docs/settings.md +289 -204
- 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 +104 -97
- package/docs/storage.md +140 -242
- package/docs/subagents/authoring.md +147 -16
- package/docs/subagents/reference.md +100 -30
- package/docs/subagents.md +220 -252
- package/docs/terminal-setup.md +97 -69
- package/docs/termux.md +51 -85
- package/docs/themes/reference.md +51 -37
- package/docs/themes.md +49 -54
- package/docs/tmux.md +38 -21
- package/docs/tools.md +198 -147
- package/docs/tui/reference.md +64 -32
- package/docs/tui.md +38 -66
- package/docs/usage.md +76 -78
- package/docs/verification.md +25 -25
- package/docs/web-access.md +72 -55
- package/docs/windows.md +53 -58
- package/docs/worktree-snapshots.md +62 -65
- package/package.json +8 -8
- package/schemas/models.schema.json +51 -0
- 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/containerization.md
CHANGED
|
@@ -1,57 +1,70 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
|
|
2
|
+
title: "Run Atomic in containers"
|
|
3
|
+
sidebarTitle: "Containers"
|
|
4
|
+
description: "Isolate Atomic or its built-in tools using Gondolin micro-VMs, Docker containers, or NVIDIA OpenShell sandboxes."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
Atomic runs with all of your local user permissions by default. To restrict which directories it can access and modify, choose one of two isolation models:
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
1. Run the whole `atomic` process inside a container or managed sandbox.
|
|
10
|
+
2. Run `atomic` on your host and route built-in file and shell tools into a micro-VM.
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
2. Run `atomic` on the host and route tool execution into an isolated environment.
|
|
12
|
+
Containerization is the outer boundary, not the only one. Read [Security and project trust](/security) alongside this page to see how project trust gates which project extensions, skills, and settings load before work starts.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
## Choose a pattern
|
|
14
|
+
## Choose an isolation pattern
|
|
16
15
|
|
|
17
16
|
| Pattern | What is isolated | Best for | Notes |
|
|
18
17
|
| --- | --- | --- | --- |
|
|
19
|
-
| Gondolin
|
|
20
|
-
|
|
|
21
|
-
| OpenShell | Whole `atomic` process in a policy-controlled sandbox | Local or remote managed
|
|
18
|
+
| Gondolin micro-VM | Selected file tools, `bash`, and `!` commands | Local VM tool routing while keeping credentials on the host | `search` and custom host extensions remain on the host. See [`examples/extensions/gondolin/`](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/gondolin). |
|
|
19
|
+
| Docker | Whole `atomic` process in a local container | Simple local isolation | Provider API keys enter the container. |
|
|
20
|
+
| NVIDIA OpenShell | Whole `atomic` process in a policy-controlled sandbox | Local or remote managed sandboxes with upstream credential injection | Requires an OpenShell gateway. |
|
|
22
21
|
|
|
23
|
-
Extensions run wherever the `atomic` process runs. If you run host `atomic` with a tool-routing extension, other
|
|
22
|
+
Extensions run wherever the `atomic` process runs. If you run host `atomic` with a tool-routing extension, other loaded extensions still run on your host unless they also route their work into the VM.
|
|
24
23
|
|
|
25
|
-
## Gondolin
|
|
24
|
+
## Gondolin micro-VM
|
|
26
25
|
|
|
27
|
-
[Gondolin](https://github.com/earendil-works/gondolin)
|
|
26
|
+
[Gondolin](https://github.com/earendil-works/gondolin) runs a local Linux micro-VM. Use the [Gondolin example extension](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/gondolin) when you want `atomic` on your host with selected file tools and shell execution routed into the VM. This does not isolate the entire session.
|
|
28
27
|
|
|
29
|
-
Copy
|
|
28
|
+
Copy `examples/extensions/gondolin` to a directory **outside** `~/.atomic/agent/extensions/` (for example `~/.local/share/atomic-gondolin`) when you want opt-in per-session use with `-e`, then install its dependencies:
|
|
30
29
|
|
|
31
30
|
```bash
|
|
32
|
-
cp -R "$(npm root -g)/@bastani/atomic/examples/extensions/gondolin" ~/.
|
|
33
|
-
cd ~/.
|
|
31
|
+
cp -R "$(npm root -g)/@bastani/atomic/examples/extensions/gondolin" ~/.local/share/atomic-gondolin
|
|
32
|
+
cd ~/.local/share/atomic-gondolin
|
|
34
33
|
npm ci --ignore-scripts
|
|
35
34
|
```
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
Launch Atomic with `-e` from the project directory you want mounted inside the VM:
|
|
38
37
|
|
|
39
38
|
```bash
|
|
40
39
|
cd /path/to/project
|
|
41
|
-
atomic -e ~/.
|
|
40
|
+
atomic -e ~/.local/share/atomic-gondolin
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
Do not copy the extension into `~/.atomic/agent/extensions/gondolin` unless you want **every** `atomic` session on your machine to boot a Gondolin VM automatically. Because that directory contains both `index.ts` and `package.json`, placing it inside `~/.atomic/agent/extensions/` causes Atomic to auto-load it globally even without `-e`.
|
|
44
|
+
|
|
45
|
+
### What the Gondolin extension routes and omits
|
|
46
|
+
|
|
47
|
+
- **Workspace mount:** Mounts your current host working directory at `/workspace` inside the VM. Edits under `/workspace` write through to your host files.
|
|
48
|
+
- **Routed tools and status:** Overrides `read`, `write`, `edit`, `bash`, `find`, and `ls`, plus interactive `!` commands. Registers the `/gondolin` command (prints VM ID, host workspace, guest workspace, and guest shell) and a footer status item (`Gondolin: <id> (/workspace)`).
|
|
49
|
+
- **Environment isolation:** Does not forward host shell environment variables into VM commands, keeping host API keys out of the VM.
|
|
50
|
+
- **Guest shell and tool caveats:** Probes `bash` first inside the guest and falls back to `/bin/sh`. Routed `find` skips `.git` and `node_modules` only and does not apply `.gitignore`. Routed `read` detects images by filename extension (`.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`), and routed `write` writes UTF-8 text.
|
|
51
|
+
- **Unrouted tools:** `search` stays on the host and is not routed into the VM. Run searches inside the guest through `bash` or `!`.
|
|
52
|
+
|
|
53
|
+
To expose only the routed built-in tools in a session:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
atomic --tools read,write,edit,bash,find,ls -e ~/.local/share/atomic-gondolin
|
|
57
|
+
```
|
|
45
58
|
|
|
46
|
-
`
|
|
59
|
+
`ls` is a built-in tool that is off by default unless listed. Restricting `--tools` to this allowlist also disables `intercom`, `subagent`, and other extension tools; MCP tools stay hidden unless a `mcp__*` pattern is listed. Other loaded host extensions can still run code on the host, so use whole-process isolation when host filesystem access must be prevented completely.
|
|
47
60
|
|
|
48
|
-
Requirements
|
|
61
|
+
**Requirements:** npm to install dependencies, Node.js 23.6.0 or newer for `@earendil-works/gondolin`, and QEMU installed through your system package manager.
|
|
49
62
|
|
|
50
|
-
##
|
|
63
|
+
## Docker
|
|
51
64
|
|
|
52
|
-
Run the whole `atomic` process
|
|
65
|
+
Run the whole `atomic` process inside Docker for a clean local container boundary.
|
|
53
66
|
|
|
54
|
-
`Dockerfile.atomic
|
|
67
|
+
Create `Dockerfile.atomic` using Node.js and npm:
|
|
55
68
|
|
|
56
69
|
```dockerfile
|
|
57
70
|
FROM node:24-bookworm-slim
|
|
@@ -80,9 +93,9 @@ WORKDIR /workspace
|
|
|
80
93
|
ENTRYPOINT ["atomic"]
|
|
81
94
|
```
|
|
82
95
|
|
|
83
|
-
The archive installer unpacks
|
|
96
|
+
The archive installer unpacks a self-contained bundle with no JavaScript runtime required. If you adapt this Dockerfile to a smaller base image, make sure `install.sh` has `uname`, `tar` with `gzip`, core file utilities (`mkdir`, `mv`, `chmod`, `ln`, `rm`, `rmdir`), `curl` or `wget`, `sha256sum` (or `shasum` or `openssl`), and `ldd` on non-Alpine Linux. `debian:bookworm-slim` already includes these tools.
|
|
84
97
|
|
|
85
|
-
Build and run:
|
|
98
|
+
Build and run the container:
|
|
86
99
|
|
|
87
100
|
```bash
|
|
88
101
|
docker build -t atomic-sandbox -f Dockerfile.atomic .
|
|
@@ -94,11 +107,23 @@ docker run --rm -it \
|
|
|
94
107
|
atomic-sandbox
|
|
95
108
|
```
|
|
96
109
|
|
|
97
|
-
`-v "$PWD:/workspace"` mounts your current directory at `/workspace
|
|
110
|
+
`-v "$PWD:/workspace"` mounts your current directory at `/workspace`, so edits under `/workspace` write directly to your host files.
|
|
98
111
|
|
|
99
|
-
|
|
112
|
+
### Persisting settings and sessions in Docker
|
|
100
113
|
|
|
101
|
-
|
|
114
|
+
Mount a named volume on `/root/.atomic` (`-v atomic-home:/root/.atomic`) to persist both container-local settings (`/root/.atomic/agent`) and the default SQLite session database (`/root/.atomic/workflows/journal.sqlite`).
|
|
115
|
+
|
|
116
|
+
If you mount only `/root/.atomic/agent`, setting `ATOMIC_CODING_AGENT_DIR=/root/.atomic/agent` does **not** keep sessions inside that volume. Because `/root/.atomic/agent` matches the default agent directory, Atomic still places `journal.sqlite` outside the volume at `/root/.atomic/workflows/journal.sqlite`.
|
|
117
|
+
|
|
118
|
+
When mounting only `/root/.atomic/agent`, persist sessions with one of these options:
|
|
119
|
+
|
|
120
|
+
- Pass `--session-store /root/.atomic/agent/journal.sqlite` (or configure `ATOMIC_STORAGE` or `ATOMIC_SESSIONS_STORAGE` to point inside `/root/.atomic/agent`).
|
|
121
|
+
- Set `ATOMIC_CODING_AGENT_DIR` to a non-default subdirectory inside the volume, such as `/root/.atomic/agent/state`, so Atomic stores sessions at `/root/.atomic/agent/state/workflows/journal.sqlite`.
|
|
122
|
+
- Mount `/root/.atomic` instead of only `/root/.atomic/agent`.
|
|
123
|
+
|
|
124
|
+
Avoid mounting your host `~/.atomic` or `~/.atomic/agent` directory unless the container should have access to your host credentials, settings, and sessions.
|
|
125
|
+
|
|
126
|
+
## NVIDIA OpenShell
|
|
102
127
|
|
|
103
128
|
Use [NVIDIA OpenShell](https://docs.nvidia.com/openshell/about/overview) for a policy-controlled sandbox with filesystem, process, network, credential, and inference controls. OpenShell runs sandboxes through a local gateway backed by Docker, Podman, or a VM runtime, or through a remote Kubernetes gateway.
|
|
104
129
|
|
|
@@ -115,7 +140,7 @@ Launch `atomic` inside an OpenShell sandbox:
|
|
|
115
140
|
openshell sandbox create --name atomic-sandbox --from atomic -- atomic
|
|
116
141
|
```
|
|
117
142
|
|
|
118
|
-
|
|
143
|
+
The whole `atomic` process runs inside the sandbox, so built-in tools, `!` commands, and extension tools execute inside the OpenShell boundary.
|
|
119
144
|
|
|
120
145
|
With a remote gateway, project files are not bind-mounted from the host, so writes in the sandbox do not modify your local checkout. Clone the repository inside the sandbox or transfer files with OpenShell:
|
|
121
146
|
|
|
@@ -124,4 +149,25 @@ openshell sandbox upload atomic-sandbox ./repo /workspace
|
|
|
124
149
|
openshell sandbox download atomic-sandbox /workspace/repo ./repo-out
|
|
125
150
|
```
|
|
126
151
|
|
|
127
|
-
|
|
152
|
+
### Routing inference through OpenShell
|
|
153
|
+
|
|
154
|
+
OpenShell providers can keep raw model API keys outside the sandbox. When inference routing is enabled, tools inside the sandbox call `https://inference.local` and the OpenShell gateway injects provider credentials upstream.
|
|
155
|
+
|
|
156
|
+
Point Atomic at `https://inference.local` by adding a provider entry to `~/.atomic/agent/models.json` inside the sandbox. For example, to route an OpenAI-compatible gateway endpoint:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"providers": {
|
|
161
|
+
"openshell": {
|
|
162
|
+
"baseUrl": "https://inference.local/v1",
|
|
163
|
+
"api": "openai-completions",
|
|
164
|
+
"apiKey": "openshell-managed",
|
|
165
|
+
"models": [
|
|
166
|
+
{ "id": "your-model-id" }
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Use `"api": "anthropic-messages"` when your OpenShell gateway exposes an Anthropic-compatible endpoint, or override `baseUrl` on a built-in provider entry. See [Custom models](/models) and [Custom providers](/custom-provider) for full `models.json` options.
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
|
|
2
|
+
title: "Custom provider API reference"
|
|
3
|
+
sidebarTitle: "Custom provider API"
|
|
4
|
+
description: "TypeScript interfaces and methods for registerProvider(), registerProviderAlias(), unregisterProvider(), and model definitions."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
## Extension methods
|
|
8
|
+
|
|
9
|
+
Extensions register, alias, and unregister providers through `ExtensionAPI`:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
interface ExtensionAPI {
|
|
13
|
+
registerProvider(name: string, config: ProviderConfig): Promise<void>;
|
|
14
|
+
registerProvider(provider: Provider): Promise<void>;
|
|
15
|
+
registerProviderAlias(config: ProviderAliasConfig): Promise<void>;
|
|
16
|
+
unregisterProvider(name: string): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- Calling `registerProvider(name, config)` again for the same `name` merges defined fields over the previous registration (except when setting or replacing `aliasOf`, which resets it).
|
|
21
|
+
- `registerProvider`, `registerProviderAlias`, and `unregisterProvider` take effect immediately when called after initial extension loading without running `/reload`.
|
|
7
22
|
|
|
8
23
|
## Config reference
|
|
9
24
|
|
|
@@ -12,13 +27,16 @@ interface ProviderConfig {
|
|
|
12
27
|
/** Display name for the provider in UI such as /login. */
|
|
13
28
|
name?: string;
|
|
14
29
|
|
|
15
|
-
/**
|
|
30
|
+
/** Source provider ID to alias (shorthand equivalent of registerProviderAlias). No other config fields may be set alongside aliasOf except name. */
|
|
31
|
+
aliasOf?: string;
|
|
32
|
+
|
|
33
|
+
/** API endpoint URL. Required at provider or model level when defining models (unless overriding a built-in provider). */
|
|
16
34
|
baseUrl?: string;
|
|
17
35
|
|
|
18
|
-
/** API key literal or config value ("$ENV_VAR", "${ENV_VAR}", or "!command").
|
|
36
|
+
/** Optional API key literal or config value ("$ENV_VAR", "${ENV_VAR}", or "!command"). Omitting it lets users authenticate via /login <provider> in auth.json. */
|
|
19
37
|
apiKey?: string;
|
|
20
38
|
|
|
21
|
-
/** Default streaming API for chat models. Required at provider or model level when defining models. */
|
|
39
|
+
/** Default streaming API for chat models. Required at provider level when supplying streamSimple, and at provider or model level when defining models. */
|
|
22
40
|
api?: Api;
|
|
23
41
|
|
|
24
42
|
/** Custom streaming implementation for non-standard chat APIs. */
|
|
@@ -37,7 +55,7 @@ interface ProviderConfig {
|
|
|
37
55
|
/** Custom headers sent with every request. Values use the same config-value syntax as apiKey. */
|
|
38
56
|
headers?: Record<string, string>;
|
|
39
57
|
|
|
40
|
-
/** When true, sends Authorization: Bearer <apiKey>. */
|
|
58
|
+
/** When true, sends Authorization: Bearer <apiKey>. Fails if no API key resolves. */
|
|
41
59
|
authHeader?: boolean;
|
|
42
60
|
|
|
43
61
|
/** Models to register. Replaces all existing chat, image, and classifier models for this provider. */
|
|
@@ -54,6 +72,7 @@ interface ProviderConfig {
|
|
|
54
72
|
login(callbacks: OAuthLoginCallbacks, signal: AbortSignal): Promise<OAuthCredentials>;
|
|
55
73
|
refreshToken(credentials: OAuthCredentials, signal: AbortSignal): Promise<OAuthCredentials>;
|
|
56
74
|
getApiKey(credentials: OAuthCredentials): string;
|
|
75
|
+
/** Adjust chat models based on credentials (image and classifier models pass through unchanged). */
|
|
57
76
|
modifyModels?(models: Model<Api>[], credentials: OAuthCredentials): Model<Api>[];
|
|
58
77
|
};
|
|
59
78
|
}
|
|
@@ -113,7 +132,13 @@ interface ProviderChatModelConfig extends ProviderModelConfigBase {
|
|
|
113
132
|
>;
|
|
114
133
|
contextWindow: number;
|
|
115
134
|
maxTokens: number;
|
|
135
|
+
/** Best-effort prompt cache lifetimes in seconds for short and long retention tiers. */
|
|
136
|
+
promptCache?: { short?: number; long?: number };
|
|
116
137
|
samplingParams?: Record<string, unknown>;
|
|
138
|
+
/** Sampling parameter overrides applied per Atomic thinking level on top of samplingParams. */
|
|
139
|
+
samplingParamsByThinkingLevel?: Partial<
|
|
140
|
+
Record<"off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max", Record<string, unknown>>
|
|
141
|
+
>;
|
|
117
142
|
/** API-specific compatibility overrides (including Atomic's `supportsGrammarTools` alias). */
|
|
118
143
|
compat?: AtomicProviderCompat;
|
|
119
144
|
}
|
|
@@ -129,12 +154,29 @@ interface ProviderClassifierModelConfig extends ProviderModelConfigBase {
|
|
|
129
154
|
type: "classifier";
|
|
130
155
|
api?: ClassifierApi;
|
|
131
156
|
contextWindow: number;
|
|
157
|
+
/** Classifier API compatibility overrides (such as System One imageInput and sendImageOptInHeader). */
|
|
158
|
+
compat?: ClassifierCompat;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
interface ProviderCompactorModelConfig extends ProviderModelConfigBase {
|
|
162
|
+
type: "compactor";
|
|
163
|
+
/** Compactor API identifier. Required at model or provider level unless overriding an existing compactor model. */
|
|
164
|
+
api?: CompactorApi;
|
|
165
|
+
/** Endpoint path appended to `baseUrl` (default `"/compact"`). Set `""` to POST directly to `baseUrl`. */
|
|
166
|
+
endpointPath?: string;
|
|
167
|
+
/** API-specific request-body parameters merged into `{ messages, query, model }`. Omitted by default so the remote API uses its own defaults. */
|
|
168
|
+
compactionParams?: Record<string, unknown>;
|
|
169
|
+
/** Wall-clock request timeout in milliseconds (default `120000`). */
|
|
170
|
+
timeoutMs?: number;
|
|
171
|
+
/** Upper bound on compacted output in estimated tokens (default `32000`; still capped at 50% of automatic trigger budget). */
|
|
172
|
+
maxTokens?: number;
|
|
132
173
|
}
|
|
133
174
|
|
|
134
175
|
type ProviderModelConfig =
|
|
135
176
|
| ProviderChatModelConfig
|
|
136
177
|
| ProviderImageModelConfig
|
|
137
|
-
| ProviderClassifierModelConfig
|
|
178
|
+
| ProviderClassifierModelConfig
|
|
179
|
+
| ProviderCompactorModelConfig;
|
|
138
180
|
```
|
|
139
181
|
|
|
140
182
|
### Cost and pricing tiers
|
|
@@ -143,10 +185,105 @@ type ProviderModelConfig =
|
|
|
143
185
|
|
|
144
186
|
### Compatibility and capability flags
|
|
145
187
|
|
|
146
|
-
For the
|
|
188
|
+
For the complete list of per-API `compat` fields (`thinkingFormat`, `chatTemplateKwargs`, `chatTemplateArgs`, `thinkingTokenBudgetField`, `vllmPriority`, `cacheControlFormat`, `supportsToolSearch`, `supportsAdditionalTools`, `supportsExplicitPromptCacheMode`, `supportsMidConvoEffort`, and more), see [`models.json` schema reference](/models-configuration#compatibility).
|
|
147
189
|
|
|
148
190
|
Keep these rules in mind when declaring capabilities on custom providers:
|
|
149
191
|
|
|
150
|
-
- **Capability flags are enforcement claims, not preferences.** `supportsStrictMode` controls strict JSON-schema tools for OpenAI-compatible APIs; `supportsStrictTools` applies to Anthropic
|
|
151
|
-
- **Session affinity headers differ by OpenAI API.** For `openai-responses`, `compat.sessionAffinityFormat: "openai"` sends `session-id` (
|
|
192
|
+
- **Capability flags are enforcement claims, not preferences.** `supportsStrictMode` controls strict JSON-schema tools for OpenAI-compatible APIs and Amazon Bedrock Converse (`bedrock-converse-stream`); `supportsStrictTools` applies to Anthropic Messages (`anthropic-messages`) only; `supportsOpenAIGrammarTools` (or Atomic's alias `supportsGrammarTools`, where the canonical field wins on conflict) controls OpenAI Lark/regex custom tools. Leave these unset or `false` unless the endpoint actually enforces them. See [Constrained sampling](/extensions/authoring#constrained-sampling).
|
|
193
|
+
- **Session affinity headers differ by OpenAI API.** For `openai-responses`, `compat.sessionAffinityFormat: "openai"` sends `session-id` (with `-`) and `x-client-request-id`, `"openai-nosession"` sends only `x-client-request-id`, and `"openrouter"` sends `x-session-id`. For `openai-completions`, `"openai"` sends `session_id` (with `_`), `x-client-request-id`, and `x-session-affinity`.
|
|
152
194
|
- **Responses gateway options.** Set `supportsToolSearch: true` only on `openai-responses` providers that support deferred tool loading. `supportsMaxOutputTokens` defaults to `true`; set it to `false` for Responses-compatible gateways that reject `max_output_tokens` with HTTP 400.
|
|
195
|
+
|
|
196
|
+
## ProviderAliasConfig
|
|
197
|
+
|
|
198
|
+
Passed to `atomic.registerProviderAlias(config)` to create an account alias for an existing provider:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
interface ProviderAliasConfig {
|
|
202
|
+
/** Unique alias ID (cannot match an existing built-in, models.json, or non-alias extension provider). */
|
|
203
|
+
id: string;
|
|
204
|
+
|
|
205
|
+
/** Optional display name shown in /login and /model. */
|
|
206
|
+
name?: string;
|
|
207
|
+
|
|
208
|
+
/** Registered source provider ID (cannot be another alias). */
|
|
209
|
+
provider: string;
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## RefreshModelsContext
|
|
214
|
+
|
|
215
|
+
Passed to `refreshModels(context)` on both `ProviderConfig` and native `Provider` registrations:
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
interface RefreshModelsContext {
|
|
219
|
+
/** Effective configured credential (OAuth tokens are refreshed before network access). */
|
|
220
|
+
credential?: Credential;
|
|
221
|
+
|
|
222
|
+
/** Immutable provider-scoped catalog snapshot read from models-store.json before this refresh. */
|
|
223
|
+
stored?: Readonly<ModelsStoreEntry>;
|
|
224
|
+
|
|
225
|
+
/** Generation-checked catalog publication used by native Provider registrations. */
|
|
226
|
+
publish(publication: ModelsPublication): Promise<boolean>;
|
|
227
|
+
|
|
228
|
+
/** False during offline or cache-only startup restoration. */
|
|
229
|
+
allowNetwork: boolean;
|
|
230
|
+
|
|
231
|
+
/** True when the caller asked to bypass freshness checks and fetch immediately. */
|
|
232
|
+
force?: boolean;
|
|
233
|
+
|
|
234
|
+
/** Cancellation signal (always provided). */
|
|
235
|
+
signal: AbortSignal;
|
|
236
|
+
|
|
237
|
+
/** Effective base URL of the provider, including overrides. */
|
|
238
|
+
baseUrl?: string;
|
|
239
|
+
|
|
240
|
+
/** Persist account metadata alongside a stored OAuth login or saved API key during network refresh. */
|
|
241
|
+
updateCredential?(update: (current: Credential) => Credential | undefined): Promise<void>;
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Image and classifier handlers
|
|
246
|
+
|
|
247
|
+
Implement these interfaces for `ProviderConfig.images` and `ProviderConfig.classifiers`:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
interface ProviderImages {
|
|
251
|
+
generateImages(
|
|
252
|
+
model: ImageModel<ImageApi>,
|
|
253
|
+
context: ImagesContext,
|
|
254
|
+
options?: ImagesOptions
|
|
255
|
+
): Promise<AssistantImages>;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
interface ProviderClassifier {
|
|
259
|
+
classify(
|
|
260
|
+
model: ClassifierModel<ClassifierApi>,
|
|
261
|
+
context: ClassifierContext,
|
|
262
|
+
options?: ClassifierOptions
|
|
263
|
+
): Promise<ClassifierResult>;
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Native Provider registration
|
|
268
|
+
|
|
269
|
+
For full control over authentication flows, credential-scoped model filtering, and persisted catalog state, pass a native `Provider<TApi>` object from `@bastani/atomic-ai` directly to `atomic.registerProvider(provider)`:
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
interface Provider<TApi extends Api = Api> {
|
|
273
|
+
readonly id: string;
|
|
274
|
+
readonly name: string;
|
|
275
|
+
readonly baseUrl?: string;
|
|
276
|
+
readonly headers?: ProviderHeaders;
|
|
277
|
+
readonly auth: ProviderAuth;
|
|
278
|
+
getModels(): readonly Model<TApi>[];
|
|
279
|
+
getAllModels?(): readonly AnyModel[];
|
|
280
|
+
refreshModels?(context: RefreshModelsContext): Promise<void>;
|
|
281
|
+
readonly refreshModelsAuth?: "credential" | "configured";
|
|
282
|
+
filterModels?(models: readonly Model<TApi>[], credential: Credential | undefined): readonly Model<TApi>[];
|
|
283
|
+
filterAllModels?(models: readonly AnyModel[], credential: Credential | undefined): readonly AnyModel[];
|
|
284
|
+
stream<T extends TApi>(model: Model<T>, context: TranscriptContext, options?: ApiStreamOptions<T>): AssistantMessageEventStream;
|
|
285
|
+
streamSimple(model: Model<TApi>, context: TranscriptContext, options?: SimpleStreamOptions): AssistantMessageEventStream;
|
|
286
|
+
generateImages?(model: ImageModel<ImageApi>, context: ImagesContext, options?: ImagesOptions): Promise<AssistantImages>;
|
|
287
|
+
classify?(model: ClassifierModel<ClassifierApi>, context: ClassifierContext, options?: ClassifierOptions): Promise<ClassifierResult>;
|
|
288
|
+
}
|
|
289
|
+
```
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
|
|
2
|
+
title: "Add OAuth login to a provider"
|
|
3
|
+
sidebarTitle: "OAuth login"
|
|
4
|
+
description: "Implement OAuth login callbacks, token refresh, rejected-login errors, and dynamic model catalog refresh."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Provider OAuth
|
|
7
|
-
|
|
8
7
|
## OAuth support
|
|
9
8
|
|
|
10
9
|
Add OAuth or SSO login integrated with `/login`:
|
|
@@ -58,7 +57,7 @@ await atomic.registerProvider("corporate-ai", {
|
|
|
58
57
|
return credentials.access;
|
|
59
58
|
},
|
|
60
59
|
|
|
61
|
-
// Optional: adjust models based on the user's token
|
|
60
|
+
// Optional: adjust chat models based on the user's token (image and classifier models pass through unchanged)
|
|
62
61
|
modifyModels(models, credentials) {
|
|
63
62
|
const region = decodeRegionFromToken(credentials.access);
|
|
64
63
|
return models.map((model) => ({
|
|
@@ -72,17 +71,13 @@ await atomic.registerProvider("corporate-ai", {
|
|
|
72
71
|
|
|
73
72
|
Users can then sign in with `/login corporate-ai`.
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
OAuth callbacks run in the engine process in isolated interactive mode. Use the provided callbacks for all prompts and notices instead of reading terminal process state.
|
|
78
|
-
|
|
79
|
-
Set `loginLabel` to customize the login dialog title. Set `usesCallbackServer: true` to show a redirect-URL paste field alongside the local callback server.
|
|
80
|
-
|
|
81
|
-
For a native `atomic.registerProvider(provider)` registration, set `provider.auth.oauth.usesCallbackServer: true` when your flow races a local callback server against `interaction.prompt({ type: "manual_code", message: "Paste redirect URL:" })`. The built-in Anthropic, OpenAI, OpenAI Codex, and OpenRouter OAuth objects already set this flag; keep it when wrapping them, or set `false` for a replacement flow without a callback server. `atomic.registerProvider(id, config)` reads `config.oauth.usesCallbackServer`.
|
|
82
|
-
|
|
83
|
-
Successful login saves credentials before refreshing the model catalog. Logout removes stored credentials without calling `refreshModels`. Pressing Escape or Ctrl+C cancels login cleanly and keeps prior credentials and models unchanged. Later registrations override earlier ones by provider ID.
|
|
74
|
+
Refresh and callback behavior:
|
|
84
75
|
|
|
85
|
-
|
|
76
|
+
- **Refresh timing and locking.** Atomic refreshes stored OAuth tokens when fewer than **5 minutes** of validity remain and serializes concurrent refreshes across sessions under a credential lock held for up to **2 minutes**. Catalog refreshes wait up to **60 seconds**, while chat requests allow **15 seconds** for pre-request authentication preparation. Atomic never aborts the `signal` passed to `refreshToken` on caller timeout because the provider may have already rotated the refresh token; a late response still saves, and normal exit waits up to **3 seconds** for it. Do not add a shorter abort timeout to your token refresh call.
|
|
77
|
+
- **Callback isolation.** Always use the provided callbacks for user prompts and notices instead of reading stdin or writing directly to stdout or stderr, because login callbacks may run in a separate background process.
|
|
78
|
+
- **Dialog options.** Set `loginLabel` to customize the login dialog title. Set `usesCallbackServer: true` to show a redirect-URL paste field alongside a local callback server.
|
|
79
|
+
- **Two registration forms.** Config-object registration (`atomic.registerProvider(id, config)`) reads `config.oauth.usesCallbackServer`. Native `Provider` registration (`atomic.registerProvider(provider)`) reads `provider.auth.oauth.usesCallbackServer` when racing a local callback server against `interaction.prompt({ type: "manual_code", message: "Paste redirect URL:" })`. The built-in Anthropic, OpenAI, OpenAI Codex, and OpenRouter OAuth objects already set this flag; keep it when wrapping them, or set `false` for a replacement flow without a callback server. See [Native `Provider` registration](/custom-provider/api-reference#native-provider-registration).
|
|
80
|
+
- **Lifecycle and cancellation.** Successful login saves credentials before refreshing the model catalog. Logout removes stored credentials without calling `refreshModels`. Pressing Escape or Ctrl+C cancels login cleanly and keeps prior credentials and models unchanged. Later registrations override earlier ones by provider ID. Intentional cancellation (native `AbortError`, an aborted `signal`, nested abort causes, or the legacy exact `Login cancelled` error) stays quiet, whereas provider denials, timeouts, network errors, malformed responses, token exchange failures, and storage errors remain visible. Catalog-refresh errors appear in `/model` while keeping cached models usable and never roll back a saved login.
|
|
86
81
|
|
|
87
82
|
## Rejected logins
|
|
88
83
|
|
|
@@ -118,7 +113,7 @@ Atomic checks whether another session saved a newer login first. If not, the req
|
|
|
118
113
|
OAuth refresh failed for corporate-ai: invalid_grant (Refresh token expired). The provider rejected the stored login; run /login corporate-ai to sign in again.
|
|
119
114
|
```
|
|
120
115
|
|
|
121
|
-
The message displays only the provider ID, error code (or `HTTP <status>`), and description. Pass stored tokens as the third argument so Atomic strips any description that
|
|
116
|
+
The message displays only the provider ID, error code (or `HTTP <status>`), and description. Pass stored tokens as the third argument so Atomic strips any description that echoes a secret, contains a URL, or exceeds safe length bounds.
|
|
122
117
|
|
|
123
118
|
Atomic also recognizes rejected logins thrown as plain errors or wrapped in `cause` when they match built-in rejection codes (`invalid_grant`, `refresh_token_expired`, `refresh_token_reused`, `refresh_token_invalidated`) or HTTP 401:
|
|
124
119
|
|
|
@@ -146,35 +141,57 @@ await atomic.registerProvider("corporate-ai", {
|
|
|
146
141
|
});
|
|
147
142
|
```
|
|
148
143
|
|
|
149
|
-
|
|
144
|
+
- **Config-object registration (`registerProvider(id, config)`):** `refreshModels(context)` returns `ProviderModelConfig[]` definitions (chat, image, or classifier) that replace that registration's live models. When `allowNetwork` is `false` (offline or cache-only startup restore), return cached models to populate initial availability without making network requests.
|
|
145
|
+
- **Native `Provider` registration (`registerProvider(provider)`):** `refreshModels(context)` calls `await context.publish({ persist, update })` to persist an optional `ModelsStoreEntry` in `models-store.json` and install provider-owned state, then exposes the latest models from `getModels()` (or `getAllModels()` for mixed-operation providers).
|
|
150
146
|
|
|
151
|
-
The existing catalog stays usable while a refresh runs. Each provider's refresh settles independently; if one fails, times out, or sees an aborted `signal`, it keeps its previous list.
|
|
147
|
+
The existing catalog stays usable while a refresh runs. Each provider's refresh settles independently; if one fails, times out, or sees an aborted `signal`, it keeps its previous list. For all `RefreshModelsContext` fields (`credential`, `stored`, `publish`, `allowNetwork`, `force`, `signal`, `baseUrl`, and `updateCredential`), see [`RefreshModelsContext`](/custom-provider/api-reference#refreshmodelscontext).
|
|
152
148
|
|
|
153
|
-
|
|
149
|
+
## OAuthLoginCallbacks
|
|
154
150
|
|
|
155
|
-
`callbacks` exposes
|
|
151
|
+
`callbacks` exposes the full user-interaction surface for `config.oauth.login()`:
|
|
156
152
|
|
|
157
153
|
```typescript
|
|
158
154
|
interface OAuthLoginCallbacks {
|
|
159
|
-
|
|
160
|
-
onAuth(
|
|
155
|
+
/** Open a URL in the browser (for OAuth redirects). */
|
|
156
|
+
onAuth(info: { url: string; instructions?: string }): void;
|
|
161
157
|
|
|
162
|
-
|
|
163
|
-
onDeviceCode(
|
|
158
|
+
/** Show a device code (for device authorization flows). */
|
|
159
|
+
onDeviceCode(info: {
|
|
164
160
|
userCode: string;
|
|
165
161
|
verificationUri: string;
|
|
166
162
|
openBrowserOnConfirm?: boolean; // default true
|
|
167
163
|
copyCodeOnConfirm?: boolean; // default true
|
|
164
|
+
intervalSeconds?: number;
|
|
165
|
+
expiresInSeconds?: number;
|
|
168
166
|
}): void;
|
|
169
167
|
|
|
170
|
-
|
|
171
|
-
onPrompt(
|
|
168
|
+
/** Prompt the user for input (for manual code or token entry). */
|
|
169
|
+
onPrompt(prompt: {
|
|
170
|
+
message: string;
|
|
171
|
+
placeholder?: string;
|
|
172
|
+
allowEmpty?: boolean;
|
|
173
|
+
}): Promise<string>;
|
|
174
|
+
|
|
175
|
+
/** Report non-blocking status updates during login. */
|
|
176
|
+
onProgress?(message: string): void;
|
|
177
|
+
|
|
178
|
+
/** Read a manually pasted redirect URL or authorization code. */
|
|
179
|
+
onManualCodeInput?(): Promise<string>;
|
|
180
|
+
|
|
181
|
+
/** Let the user pick from a list of options (for example tenant or workspace). */
|
|
182
|
+
onSelect(prompt: {
|
|
183
|
+
message: string;
|
|
184
|
+
options: Array<{ id: string; label: string }>;
|
|
185
|
+
}): Promise<string | undefined>;
|
|
186
|
+
|
|
187
|
+
/** Cancellation signal for the active login attempt. */
|
|
188
|
+
signal?: AbortSignal;
|
|
172
189
|
}
|
|
173
190
|
```
|
|
174
191
|
|
|
175
192
|
In `/login`, pressing Enter (`tui.select.confirm`) opens the device verification URL and copies the code by default. Disable either action with `openBrowserOnConfirm: false` or `copyCodeOnConfirm: false` in `onDeviceCode` or native `AuthEvent` notifications.
|
|
176
193
|
|
|
177
|
-
|
|
194
|
+
## OAuthCredentials
|
|
178
195
|
|
|
179
196
|
OAuth credentials save to `~/.atomic/agent/auth.json` (Atomic may also read legacy `~/.pi/agent/auth.json`):
|
|
180
197
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Override
|
|
3
|
-
|
|
2
|
+
title: "Override a built-in provider"
|
|
3
|
+
sidebarTitle: "Override provider"
|
|
4
|
+
description: "Change the base URL or request headers of a built-in provider from an extension while keeping its models."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Override existing provider
|
|
7
|
+
## Override a built-in provider {#override-existing-provider}
|
|
9
8
|
|
|
10
9
|
Redirect an existing built-in provider through a proxy or attach custom headers without redefining its models:
|
|
11
10
|
|
|
@@ -26,9 +25,17 @@ await atomic.registerProvider("openai", {
|
|
|
26
25
|
await atomic.registerProvider("google", {
|
|
27
26
|
baseUrl: "https://ai-gateway.corp.com/google",
|
|
28
27
|
headers: {
|
|
29
|
-
|
|
28
|
+
// Supports $ENV_VAR, ${ENV_VAR}, !command, or literal values ($$ for $, $! for leading !)
|
|
29
|
+
"X-Corp-Auth": "$CORP_AUTH_TOKEN"
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
When you pass only `baseUrl` or `headers` (with no `models`), Atomic keeps all existing models and authentication for that provider. To register new models or a new provider, see [Register a provider](/custom-provider/registration).
|
|
34
|
+
When you pass only `baseUrl` or `headers` (with no `models`), Atomic keeps all existing models and authentication for that provider. To register new models or a new provider, see [Register a custom provider](/custom-provider/registration).
|
|
35
|
+
|
|
36
|
+
## How overrides merge and revert
|
|
37
|
+
|
|
38
|
+
- **Header merging.** Extension `headers` merge over `models.json` `headers` and over provider authentication headers (extension values win on key collision). Header values support `$ENV_VAR`, `${ENV_VAR}`, `!command`, `$$`, and `$!`. See [Value resolution](/models/reference#value-resolution).
|
|
39
|
+
- **Incremental re-registration.** Calling `registerProvider("anthropic", { headers })` after `registerProvider("anthropic", { baseUrl })` keeps `baseUrl`, because defined fields merge over the previous registration.
|
|
40
|
+
- **Derived fast variants.** Overriding `baseUrl` on `anthropic`, `openai`, or `xai` preserves derived `-fast` variants as long as you do not supply a custom `streamSimple` or replace `models`. Supplying `streamSimple` suppresses derived `-fast` variants for that API.
|
|
41
|
+
- **Reverting an override.** Call `await atomic.unregisterProvider("anthropic")` to remove the extension override and restore the built-in provider (along with any `models.json` configuration) immediately without running `/reload`.
|