@bastani/atomic 0.10.9 → 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 +57 -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
|
@@ -1,39 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Register a provider
|
|
3
|
-
|
|
2
|
+
title: "Register a custom provider"
|
|
3
|
+
sidebarTitle: "Register provider"
|
|
4
|
+
description: "Add custom providers, choose a streaming API, set up multi-account aliases, and unregister providers."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## Multiple accounts for one provider
|
|
9
|
-
|
|
10
|
-
Use `atomic.registerProviderAlias()` to reuse an existing provider's models, OAuth flows, and transport under separate logins. Register aliases inside the extension factory so they are available at startup:
|
|
11
|
-
|
|
12
|
-
```typescript
|
|
13
|
-
import type { ExtensionAPI } from "@bastani/atomic";
|
|
14
|
-
|
|
15
|
-
export default async function (atomic: ExtensionAPI) {
|
|
16
|
-
for (let account = 1; account <= 7; account++) {
|
|
17
|
-
await atomic.registerProviderAlias({
|
|
18
|
-
id: `openai-${account}`,
|
|
19
|
-
name: `OpenAI account ${account}`,
|
|
20
|
-
provider: "openai",
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Run `/login openai-1`, choose **Sign in with ChatGPT**, and select an `openai-1` model in `/model`. Repeat for each alias. The source `openai` uses OpenAI ChatGPT sign-in rather than `openai-codex`.
|
|
27
|
-
|
|
28
|
-
Each alias stores and refreshes its own credentials without borrowing the source's stored login or ambient environment keys. Keeping the same alias ID preserves saved credentials. Confirm the intended account in your browser during login; an alias name does not select an account or increase quota.
|
|
29
|
-
|
|
30
|
-
Aliases work with OAuth logins and non-empty stored API keys. For ambient-only authentication (such as an AWS profile or environment-based service account), use the original provider or register a full custom provider instead.
|
|
31
|
-
|
|
32
|
-
Aliases inherit the source's endpoint, shared headers, models, derived Fast variants, OAuth callbacks, and request handling. Do not hard-code account secrets in source headers; supply per-account credentials through `/login`. Saved messages and callbacks keep the alias ID. Source catalog updates are shared while availability filters run against each alias's credential; aliases do not run separate per-account catalog discovery.
|
|
33
|
-
|
|
34
|
-
The source provider must already be registered and cannot be an alias itself. Alias IDs cannot replace an existing provider. Configure endpoints, headers, and `models.json` overrides on the source provider rather than the alias. Call `atomic.unregisterProvider("openai-1")` to remove an alias without deleting its saved credentials.
|
|
35
|
-
|
|
36
|
-
## Register new provider
|
|
7
|
+
## Register a new provider {#register-new-provider}
|
|
37
8
|
|
|
38
9
|
Specify `models` alongside the provider endpoint and API to register a new provider. For remote model discovery, fetch and register inside an async extension factory so startup waits for the models to load:
|
|
39
10
|
|
|
@@ -73,7 +44,7 @@ Or register static models directly:
|
|
|
73
44
|
```typescript
|
|
74
45
|
await atomic.registerProvider("my-llm", {
|
|
75
46
|
baseUrl: "https://api.my-llm.com/v1",
|
|
76
|
-
apiKey: "$MY_LLM_API_KEY", //
|
|
47
|
+
apiKey: "$MY_LLM_API_KEY", // supports $ENV_VAR, ${ENV_VAR}, !command, or literal values
|
|
77
48
|
api: "openai-completions", // streaming API implementation
|
|
78
49
|
models: [
|
|
79
50
|
{
|
|
@@ -98,37 +69,9 @@ Providing `models` replaces all existing chat, image, and classifier models for
|
|
|
98
69
|
|
|
99
70
|
Registered providers appear in `/login` like built-in providers: `/login my-llm` prompts for an API key and stores it in `auth.json`, and the selector shows configured status (such as `✓ env: MY_LLM_API_KEY`). Once configured, `/model` lists its models; without credentials, selecting one reports `No API key found for my-llm` with the `/login` hint.
|
|
100
71
|
|
|
101
|
-
|
|
72
|
+
### API types
|
|
102
73
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
```typescript
|
|
106
|
-
await atomic.registerProvider("my-llm", {
|
|
107
|
-
baseUrl: "https://api.my-llm.com/v1",
|
|
108
|
-
apiKey: "$MY_LLM_API_KEY",
|
|
109
|
-
api: "openai-completions",
|
|
110
|
-
models: [
|
|
111
|
-
{
|
|
112
|
-
id: "my-llm-large",
|
|
113
|
-
name: "My LLM Large",
|
|
114
|
-
reasoning: true,
|
|
115
|
-
input: ["text", "image"],
|
|
116
|
-
cost: { input: 3.0, output: 15.0, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
117
|
-
contextWindow: 200000,
|
|
118
|
-
maxTokens: 16384
|
|
119
|
-
}
|
|
120
|
-
]
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
// Remove later without needing /reload
|
|
124
|
-
await atomic.unregisterProvider("my-llm");
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Unregistering removes the provider's dynamic models, API key fallback, OAuth registration, and custom stream handlers, restoring any overridden built-in provider behavior. Calls made after initial extension loading take effect immediately without `/reload`.
|
|
128
|
-
|
|
129
|
-
### API Types
|
|
130
|
-
|
|
131
|
-
The `api` field selects the built-in streaming implementation:
|
|
74
|
+
The `api` field selects the built-in chat streaming implementation:
|
|
132
75
|
|
|
133
76
|
| API | Use for |
|
|
134
77
|
| --- | --- |
|
|
@@ -141,6 +84,9 @@ The `api` field selects the built-in streaming implementation:
|
|
|
141
84
|
| `google-generative-ai` | Google Generative AI API |
|
|
142
85
|
| `google-vertex` | Google Vertex AI API |
|
|
143
86
|
| `bedrock-converse-stream` | Amazon Bedrock Converse API |
|
|
87
|
+
| `pi-messages` | Custom gateways speaking the `pi-messages` protocol |
|
|
88
|
+
|
|
89
|
+
Image (`images`) and classifier (`classifiers`) handlers use their own operation-specific `api` keys independent of this chat streaming table.
|
|
144
90
|
|
|
145
91
|
Most OpenAI-compatible servers use `openai-completions`. Configure model-specific thinking controls with `thinkingLevelMap` and endpoint quirks with `compat`:
|
|
146
92
|
|
|
@@ -174,7 +120,7 @@ models: [{
|
|
|
174
120
|
|
|
175
121
|
See [Compatibility fields](/models-configuration#compatibility) for every `compat` option (`thinkingFormat`, `cacheControlFormat`, session affinity, and tool flags). Use `mistral-conversations` for native Mistral endpoints; if routing a Mistral-compatible endpoint through `openai-completions`, configure `compat` flags explicitly.
|
|
176
122
|
|
|
177
|
-
### Auth
|
|
123
|
+
### Auth header
|
|
178
124
|
|
|
179
125
|
Set `authHeader: true` when an endpoint expects `Authorization: Bearer <key>` using the resolved `apiKey`:
|
|
180
126
|
|
|
@@ -187,3 +133,67 @@ await atomic.registerProvider("custom-api", {
|
|
|
187
133
|
models: []
|
|
188
134
|
});
|
|
189
135
|
```
|
|
136
|
+
|
|
137
|
+
If `authHeader: true` is set and the provider resolves no API key (for example, `$MY_API_KEY` is unset and no key is saved in `auth.json`), requests fail with a missing API key error (`authHeader requires a resolved API key`).
|
|
138
|
+
|
|
139
|
+
## Multiple accounts for one provider
|
|
140
|
+
|
|
141
|
+
Use `atomic.registerProviderAlias()` to reuse an existing provider's models, OAuth flows, and transport under separate logins. Register aliases inside the extension factory so they are available at startup:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import type { ExtensionAPI } from "@bastani/atomic";
|
|
145
|
+
|
|
146
|
+
export default async function (atomic: ExtensionAPI) {
|
|
147
|
+
for (let account = 1; account <= 7; account++) {
|
|
148
|
+
await atomic.registerProviderAlias({
|
|
149
|
+
id: `openai-${account}`,
|
|
150
|
+
name: `OpenAI account ${account}`,
|
|
151
|
+
provider: "openai",
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Run `/login openai-1`, choose **Sign in with ChatGPT**, and select an `openai-1` model in `/model`. Repeat for each alias. The source `openai` uses OpenAI ChatGPT sign-in rather than `openai-codex`.
|
|
158
|
+
|
|
159
|
+
Each alias stores and refreshes its own credentials without borrowing the source's stored login or ambient environment keys. Keeping the same alias ID preserves saved credentials. Confirm the intended account in your browser during login; an alias name does not select an account or increase quota.
|
|
160
|
+
|
|
161
|
+
Aliases work with OAuth logins and non-empty stored API keys. For ambient-only authentication (such as an AWS profile or environment-based service account), use the original provider or register a full custom provider instead.
|
|
162
|
+
|
|
163
|
+
Aliases inherit the source's endpoint, shared headers, models, derived Fast variants, OAuth callbacks, and request handling. Do not hard-code account secrets in source headers; supply per-account credentials through `/login`. Saved messages and callbacks keep the alias ID. Source catalog updates are shared while availability filters run against each alias's credential; aliases do not run separate per-account catalog discovery, except `github-copilot` aliases, which refresh their own account's model list independently.
|
|
164
|
+
|
|
165
|
+
Validation rules for `registerProviderAlias()`:
|
|
166
|
+
|
|
167
|
+
- `id` and `provider` must be distinct, non-empty strings.
|
|
168
|
+
- `id` cannot match any built-in provider, `models.json` provider, or existing non-alias extension provider (throws `Provider alias <id> cannot replace an existing provider.`).
|
|
169
|
+
- `provider` must already be registered and cannot itself be an alias (throws `Provider aliases must refer directly to a source provider, not another alias.`).
|
|
170
|
+
- `registerProviderAlias({ id, name, provider })` is shorthand for `registerProvider(id, { aliasOf: provider, name })`. No other fields (such as `baseUrl` or `headers`) are allowed on an alias; configure endpoints, headers, and `models.json` overrides on the source provider instead.
|
|
171
|
+
- Call `atomic.unregisterProvider("openai-1")` to remove an alias without deleting its saved credentials.
|
|
172
|
+
|
|
173
|
+
## Unregister a provider {#unregister-provider}
|
|
174
|
+
|
|
175
|
+
Call `atomic.unregisterProvider(name)` to remove a provider registered with `atomic.registerProvider()` or `atomic.registerProviderAlias()`:
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
await atomic.registerProvider("my-llm", {
|
|
179
|
+
baseUrl: "https://api.my-llm.com/v1",
|
|
180
|
+
apiKey: "$MY_LLM_API_KEY",
|
|
181
|
+
api: "openai-completions",
|
|
182
|
+
models: [
|
|
183
|
+
{
|
|
184
|
+
id: "my-llm-large",
|
|
185
|
+
name: "My LLM Large",
|
|
186
|
+
reasoning: true,
|
|
187
|
+
input: ["text", "image"],
|
|
188
|
+
cost: { input: 3.0, output: 15.0, cacheRead: 0.3, cacheWrite: 3.75 },
|
|
189
|
+
contextWindow: 200000,
|
|
190
|
+
maxTokens: 16384
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// Remove later without needing /reload
|
|
196
|
+
await atomic.unregisterProvider("my-llm");
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Unregistering removes the provider's dynamic models, API key fallback, OAuth registration, and custom stream handlers, restoring any overridden built-in provider behavior. Calls made after initial extension loading take effect immediately without `/reload`. If the current session is using a model from the unregistered provider, Atomic refreshes the active model immediately. Calling `unregisterProvider()` for a provider that is not registered is a safe no-op.
|
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
3
|
-
|
|
2
|
+
title: "Implement provider streaming"
|
|
3
|
+
sidebarTitle: "Streaming API"
|
|
4
|
+
description: "Build a custom streamSimple handler with stream events, content blocks, tool calls, stop reasons, and cost calculation."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# Provider streaming API
|
|
7
|
-
|
|
8
7
|
## Custom streaming API
|
|
9
8
|
|
|
10
|
-
For providers with non-standard APIs, implement `streamSimple`. Study the
|
|
9
|
+
For providers with non-standard APIs, implement `streamSimple`. Study Atomic's built-in streaming implementations in the [`@bastani/atomic-ai` API source directory](https://github.com/bastani-inc/atomic/tree/main/packages/ai/src/api) before writing your own:
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
- `anthropic-messages.ts`: Anthropic Messages API
|
|
12
|
+
- `mistral-conversations.ts`: Mistral Conversations and Chat streaming
|
|
13
|
+
- `openai-completions.ts`: OpenAI Chat Completions
|
|
14
|
+
- `openai-responses.ts`: OpenAI Responses API
|
|
15
|
+
- `google-generative-ai.ts`: Google Generative AI
|
|
16
|
+
- `bedrock-converse-stream.ts`: Amazon Bedrock Converse API
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
- `anthropic-messages.d.ts` / `anthropic-messages.js` - Anthropic Messages API
|
|
16
|
-
- `mistral-conversations.d.ts` / `mistral-conversations.js` - Mistral Conversations/Chat streaming
|
|
17
|
-
- `openai-completions.d.ts` / `openai-completions.js` - OpenAI Chat Completions
|
|
18
|
-
- `openai-responses.d.ts` / `openai-responses.js` - OpenAI Responses API
|
|
19
|
-
- `google-generative-ai.d.ts` / `google-generative-ai.js` - Google Generative AI
|
|
20
|
-
- `bedrock-converse-stream.d.ts` / `bedrock-converse-stream.js` - Amazon Bedrock Converse API
|
|
21
|
-
Per-vendor provider configurations (base URLs, auth, model catalogs) live under `dist/providers/`, for example `anthropic.d.ts` / `anthropic.js` and `mistral.d.ts` / `mistral.js`.
|
|
18
|
+
Built-in provider configurations (base URLs, auth, and model catalogs) live in [`packages/ai/src/providers`](https://github.com/bastani-inc/atomic/tree/main/packages/ai/src/providers). For general library usage, see the [AI library reference](/libraries/ai).
|
|
22
19
|
|
|
23
|
-
### Stream
|
|
20
|
+
### Stream pattern
|
|
24
21
|
|
|
25
22
|
Return a stream from `createAssistantMessageEventStream()` or construct `AssistantMessageEventStream` directly. A plain `EventStream` subclass does not satisfy the response stream type.
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
`AssistantMessageEventStream` populates `output.durationMs` automatically using a monotonic clock when you push a `done` or `error` event. Set `timestamp` when the request starts. Existing durations stay intact, and messages whose timestamps predate the stream (such as fetched deferred results) remain untimed.
|
|
25
|
+
|
|
26
|
+
Note on context types: `@bastani/atomic-ai` types the `context` argument as `TranscriptContext`, while `ProviderConfig.streamSimple` uses the compatible `Context` alias; both pass the normalized message transcript where `getCurrentSystemPrompt(context.messages)` and `getCurrentTools(context.messages)` read the active system prompt and tools.
|
|
28
27
|
|
|
29
28
|
```typescript
|
|
30
29
|
import {
|
|
@@ -102,6 +101,20 @@ function streamMyProvider(
|
|
|
102
101
|
}
|
|
103
102
|
```
|
|
104
103
|
|
|
104
|
+
Common fields on `options` (`SimpleStreamOptions`):
|
|
105
|
+
|
|
106
|
+
| Option | Purpose |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| `apiKey`, `headers`, `env` | Resolved request credentials, merged headers, and provider-scoped environment overrides |
|
|
109
|
+
| `signal` | `AbortSignal` for user cancellation or deadlines; forward to `fetch()` |
|
|
110
|
+
| `fetch` | Optional custom `fetch` implementation |
|
|
111
|
+
| `reasoning`, `thinkingBudgets` | Requested thinking level (`off` through `max`) and optional per-level token budgets |
|
|
112
|
+
| `toolChoice` | Provider-neutral tool selection preference |
|
|
113
|
+
| `temperature`, `maxTokens`, `samplingParams` | Generation parameters and custom request-body sampling overrides |
|
|
114
|
+
| `sessionId`, `cacheRetention`, `transport` | Session affinity ID, prompt-cache retention tier, and transport preference |
|
|
115
|
+
| `timeoutMs`, `websocketConnectTimeoutMs`, `streamDeadlineMs`, `retryDeadline` | Request, handshake, idle-stream, and retry timeout bounds |
|
|
116
|
+
| `onPayload`, `onResponse`, `onProviderStreamEvent` | Lifecycle hooks to inspect/modify request payloads, inspect HTTP responses, and observe raw parsed stream events before normalization |
|
|
117
|
+
|
|
105
118
|
### Event types
|
|
106
119
|
|
|
107
120
|
Push events with `stream.push()` in this order:
|
|
@@ -198,18 +211,28 @@ output.usage.totalTokens =
|
|
|
198
211
|
calculateCost(model, output.usage);
|
|
199
212
|
```
|
|
200
213
|
|
|
201
|
-
`calculateCost()` applies one rate set to the whole request. Aggregate input is `usage.input + usage.cacheRead + usage.cacheWrite`; a tier applies only when that total strictly exceeds `inputTokensAbove`, and the highest matching threshold wins. Every tier must define `input`, `output`, `cacheRead`, and `cacheWrite`. Extension-registered models keep these tiers, and `models.json` `modelOverrides` follow the rules in [Request-wide cost tiers](/models/reference#request-wide-cost-tiers).
|
|
214
|
+
`calculateCost(model, output.usage)` mutates `output.usage.cost` in place and returns it. It applies one rate set to the whole request. Aggregate input is `usage.input + usage.cacheRead + usage.cacheWrite`; a tier applies only when that total strictly exceeds `inputTokensAbove`, and the highest matching threshold wins. Every tier must define `input`, `output`, `cacheRead`, and `cacheWrite`. Extension-registered models keep these tiers, and `models.json` `modelOverrides` follow the rules in [Request-wide cost tiers](/models/reference#request-wide-cost-tiers).
|
|
202
215
|
|
|
203
216
|
### Registration
|
|
204
217
|
|
|
205
|
-
Register your stream handler with `atomic.registerProvider()`:
|
|
218
|
+
Register your stream handler with `atomic.registerProvider()`. Providing `streamSimple` requires `api` at the provider level and suppresses derived `-fast` variants for that `api`:
|
|
206
219
|
|
|
207
220
|
```typescript
|
|
208
221
|
await atomic.registerProvider("my-provider", {
|
|
209
222
|
baseUrl: "https://api.example.com",
|
|
210
223
|
apiKey: "$MY_API_KEY",
|
|
211
224
|
api: "my-custom-api",
|
|
212
|
-
models: [
|
|
225
|
+
models: [
|
|
226
|
+
{
|
|
227
|
+
id: "my-model-1",
|
|
228
|
+
name: "My Model 1",
|
|
229
|
+
reasoning: false,
|
|
230
|
+
input: ["text"],
|
|
231
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
232
|
+
contextWindow: 128000,
|
|
233
|
+
maxTokens: 8192
|
|
234
|
+
}
|
|
235
|
+
],
|
|
213
236
|
streamSimple: streamMyProvider
|
|
214
237
|
});
|
|
215
238
|
```
|
package/docs/custom-provider.md
CHANGED
|
@@ -1,50 +1,35 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
|
|
2
|
+
title: "Build custom providers"
|
|
3
|
+
sidebarTitle: "Custom providers"
|
|
4
|
+
description: "Register custom model providers, proxies, OAuth login flows, and streaming APIs from an Atomic extension."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Extensions can register custom model providers with `atomic.registerProvider()`:
|
|
7
|
+
Extensions can register custom model providers with `atomic.registerProvider()`, create multi-account aliases with `atomic.registerProviderAlias()`, and remove overrides with `atomic.unregisterProvider()`:
|
|
9
8
|
|
|
10
9
|
- **Proxies:** Route requests through corporate proxies or API gateways.
|
|
11
10
|
- **Custom endpoints:** Connect self-hosted or private model deployments.
|
|
12
11
|
- **OAuth and SSO:** Add custom login flows for enterprise providers.
|
|
13
12
|
- **Custom APIs:** Implement streaming, image generation, or classification for non-standard APIs.
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
If you only need to add models for an API Atomic already supports, use [Configure custom models](/models) instead.
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
## Where to go next
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
- [Multiple accounts for one provider](/custom-provider/registration#multiple-accounts-for-one-provider): inherit provider behavior with separate logins.
|
|
21
|
-
- [Register a provider](/custom-provider/registration): register, unregister, and choose a streaming API type.
|
|
22
|
-
- [Provider OAuth](/custom-provider/oauth): login callbacks, credential storage, rejected logins, and dynamic catalog refresh.
|
|
23
|
-
- [Provider streaming API](/custom-provider/streaming): stream events, content blocks, tool calls, stop reasons, and cost calculation.
|
|
24
|
-
- [Provider API reference](/custom-provider/api-reference): TypeScript interfaces for `ProviderConfig` and `ProviderModelConfig`.
|
|
18
|
+
Start with the quick reference below, then use the focused guides for your scenario:
|
|
25
19
|
|
|
26
|
-
|
|
20
|
+
- [Override a built-in provider](/custom-provider/override): change `baseUrl` or headers for a built-in provider while keeping its models.
|
|
21
|
+
- [Register a custom provider](/custom-provider/registration): add static or dynamically discovered models, choose a streaming API, set up [multi-account aliases](/custom-provider/registration#multiple-accounts-for-one-provider), or unregister providers.
|
|
22
|
+
- [Add OAuth login to a provider](/custom-provider/oauth): implement login callbacks, credential storage, rejected-login handling, and dynamic catalog refresh.
|
|
23
|
+
- [Implement provider streaming](/custom-provider/streaming): build a custom `streamSimple` handler with stream events, tool calls, stop reasons, and cost calculation.
|
|
24
|
+
- [Custom provider API reference](/custom-provider/api-reference): TypeScript interfaces for `ProviderConfig`, `ProviderModelConfig`, `ProviderAliasConfig`, `RefreshModelsContext`, and native `Provider` registrations.
|
|
27
25
|
|
|
28
26
|
## Example extensions
|
|
29
27
|
|
|
30
|
-
See these complete provider examples:
|
|
28
|
+
See these complete provider examples in the repository:
|
|
31
29
|
|
|
32
30
|
- [`examples/extensions/custom-provider-anthropic/`](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/custom-provider-anthropic)
|
|
33
31
|
- [`examples/extensions/custom-provider-gitlab-duo/`](https://github.com/bastani-inc/atomic/tree/main/packages/coding-agent/examples/extensions/custom-provider-gitlab-duo)
|
|
34
32
|
|
|
35
|
-
## Contents
|
|
36
|
-
|
|
37
|
-
- [Example extensions](#example-extensions)
|
|
38
|
-
- [Quick reference](#quick-reference)
|
|
39
|
-
- [Override existing provider](/custom-provider/override#override-existing-provider)
|
|
40
|
-
- [Register new provider](/custom-provider/registration#register-new-provider)
|
|
41
|
-
- [Unregister provider](/custom-provider/registration#unregister-provider)
|
|
42
|
-
- [OAuth support](/custom-provider/oauth#oauth-support)
|
|
43
|
-
- [Custom streaming API](/custom-provider/streaming#custom-streaming-api)
|
|
44
|
-
- [Testing your implementation](#testing-your-implementation)
|
|
45
|
-
- [Config reference](/custom-provider/api-reference#config-reference)
|
|
46
|
-
- [Model definition reference](/custom-provider/api-reference#model-definition-reference)
|
|
47
|
-
|
|
48
33
|
## Quick reference
|
|
49
34
|
|
|
50
35
|
```typescript
|
|
@@ -77,9 +62,18 @@ export default async function (atomic: ExtensionAPI) {
|
|
|
77
62
|
}
|
|
78
63
|
```
|
|
79
64
|
|
|
80
|
-
|
|
65
|
+
### Registration and merge rules
|
|
66
|
+
|
|
67
|
+
- **Await registration inside the extension factory.** For dynamic model discovery, fetch and register models inside the async extension factory rather than `session_start`. Atomic waits for the factory before startup completes, making the provider available at interactive startup and in `atomic --list-models`.
|
|
68
|
+
- **Two `registerProvider` overloads.** Pass `(id, config)` for config-object registration, or pass a native `Provider` instance from `@bastani/atomic-ai` (`await atomic.registerProvider(provider)`) for full control over auth, filtering, and catalog persistence. See [Custom provider API reference](/custom-provider/api-reference).
|
|
69
|
+
- **Repeated registrations merge defined fields.** Calling `atomic.registerProvider(id, config)` again for the same `id` merges defined fields over the previous registration while keeping `undefined` fields intact, except when registering or replacing an alias (`aliasOf`), which resets the previous registration.
|
|
70
|
+
- **Interaction with `models.json`.** Extension `headers` merge over `models.json` `headers` (extension values win on key collision). `models.json` `modelOverrides` still apply on top of extension-registered chat models.
|
|
71
|
+
- **Partial vs full model registration.** Passing only `baseUrl` or `headers` for an existing provider keeps its built-in models. Supplying `models` replaces that provider's models across chat, image, and classifier operations.
|
|
72
|
+
- **Required fields.** When defining `models`, `baseUrl` is required at provider or model level (unless overriding a built-in provider that already has one), and `api` is required at model level (or provider level for chat models) unless overriding a built-in provider that supplies defaults. When supplying `streamSimple`, `api` is required at provider level. Every model requires `id`, `name`, `input`, and `cost`; chat and classifier models require `contextWindow`; chat models also require `maxTokens` and `reasoning`; image models require `output`.
|
|
81
73
|
|
|
82
|
-
|
|
74
|
+
### Mixed-operation providers
|
|
75
|
+
|
|
76
|
+
An omitted `type` defaults to `"chat"`. Image and classifier entries require explicit `type` discriminants and matching handlers in `images` or `classifiers` keyed by each model's `api`:
|
|
83
77
|
|
|
84
78
|
```typescript
|
|
85
79
|
await atomic.registerProvider("media-tools", {
|
|
@@ -115,7 +109,7 @@ await atomic.registerProvider("media-tools", {
|
|
|
115
109
|
});
|
|
116
110
|
```
|
|
117
111
|
|
|
118
|
-
Model-level `baseUrl` overrides the provider endpoint. Equal model IDs across different operations (chat, image, classifier) stay distinct, including model-specific headers.
|
|
112
|
+
Model-level `baseUrl` overrides the provider endpoint. Equal model IDs across different operations (chat, image, classifier) stay distinct, including model-specific headers.
|
|
119
113
|
|
|
120
114
|
## Testing your implementation
|
|
121
115
|
|
|
@@ -134,33 +128,3 @@ Verify your provider and model pairs against these scenarios (filenames are sugg
|
|
|
134
128
|
| `image-tool-result.test.ts` | Images returned in tool results |
|
|
135
129
|
| `total-tokens.test.ts` | Total token calculation |
|
|
136
130
|
| `cross-provider-handoff.test.ts` | Conversation handoff across providers |
|
|
137
|
-
|
|
138
|
-
## Moved sections
|
|
139
|
-
|
|
140
|
-
<a id="override-existing-provider" />
|
|
141
|
-
<a id="register-new-provider" />
|
|
142
|
-
<a id="unregister-provider" />
|
|
143
|
-
<a id="api-types" />
|
|
144
|
-
<a id="auth-header" />
|
|
145
|
-
<a id="oauth-support" />
|
|
146
|
-
<a id="dynamic-model-catalog-refresh" />
|
|
147
|
-
<a id="oauthlogincallbacks" />
|
|
148
|
-
<a id="oauthcredentials" />
|
|
149
|
-
<a id="custom-streaming-api" />
|
|
150
|
-
<a id="stream-pattern" />
|
|
151
|
-
<a id="event-types" />
|
|
152
|
-
<a id="stop-reasons" />
|
|
153
|
-
<a id="content-blocks" />
|
|
154
|
-
<a id="tool-calls" />
|
|
155
|
-
<a id="usage-and-cost" />
|
|
156
|
-
<a id="registration" />
|
|
157
|
-
<a id="config-reference" />
|
|
158
|
-
<a id="model-definition-reference" />
|
|
159
|
-
|
|
160
|
-
Detailed sections moved to child pages:
|
|
161
|
-
|
|
162
|
-
- [Override an existing provider](/custom-provider/override#override-existing-provider)
|
|
163
|
-
- [Register a provider](/custom-provider/registration#register-new-provider): [Unregister provider](/custom-provider/registration#unregister-provider), [API types](/custom-provider/registration#api-types), and [Auth header](/custom-provider/registration#auth-header)
|
|
164
|
-
- [Provider OAuth](/custom-provider/oauth#oauth-support): [Dynamic model catalog refresh](/custom-provider/oauth#dynamic-model-catalog-refresh), [OAuthLoginCallbacks](/custom-provider/oauth#oauthlogincallbacks), and [OAuthCredentials](/custom-provider/oauth#oauthcredentials)
|
|
165
|
-
- [Provider streaming API](/custom-provider/streaming#custom-streaming-api): [Stream pattern](/custom-provider/streaming#stream-pattern), [Event types](/custom-provider/streaming#event-types), [Stop reasons](/custom-provider/streaming#stop-reasons), [Content blocks](/custom-provider/streaming#content-blocks), [Tool calls](/custom-provider/streaming#tool-calls), [Usage and cost](/custom-provider/streaming#usage-and-cost), and [Registration](/custom-provider/streaming#registration)
|
|
166
|
-
- [Provider API reference](/custom-provider/api-reference#config-reference): [Config reference](/custom-provider/api-reference#config-reference) and [Model definition reference](/custom-provider/api-reference#model-definition-reference)
|
package/docs/development.md
CHANGED
|
@@ -1,90 +1,94 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: "
|
|
3
|
-
|
|
2
|
+
title: "Diagnostics and debugging"
|
|
3
|
+
sidebarTitle: "Diagnostics"
|
|
4
|
+
description: "Enable debug logs, capture UI snapshots, profile event-loop stalls, and collect diagnostics for bug reports."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
For building extensions, custom providers, or SDK integrations, start with [Build with Atomic](/build). To install the CLI, see [Installation](/getting-started/installation).
|
|
9
|
-
|
|
10
|
-
<a id="forking--rebranding"></a>
|
|
11
|
-
|
|
12
|
-
## Path resolution
|
|
13
|
-
|
|
14
|
-
Atomic supports both package-manager installs and self-contained release archives. Keep an archive's complete directory structure intact so Atomic can resolve its bundled assets and native module.
|
|
7
|
+
Use these tools to inspect failures, diagnose slow startup or UI stalls, and gather bug-report diagnostics. To build extensions, custom providers, or SDK integrations, start with [Build with Atomic](/build). To install the CLI, see [Installation](/getting-started/installation).
|
|
15
8
|
|
|
16
9
|
## Debugging
|
|
17
10
|
|
|
18
|
-
Enable debug mode from **Debug mode** in `/settings` (the [`debug` setting](/settings#debug-mode)), by passing `--debug`, or by setting `ATOMIC_DEBUG=1
|
|
11
|
+
Enable debug mode from **Debug mode** in `/settings` (the global [`debug` setting](/settings#debug-mode)), by passing `--debug`, or by setting `ATOMIC_DEBUG=1` (legacy `PI_DEBUG=1`). The footer displays a `debug` badge while debug mode is active.
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
Only the exact value `"1"` enables debug mode via environment variable (`true` and `yes` are ignored). If `"debug": true` is saved in `~/.atomic/agent/settings.json`, setting `ATOMIC_DEBUG=0` does not turn debug mode off for that run; toggle **Debug mode** in `/settings` or edit `settings.json` instead.
|
|
14
|
+
|
|
15
|
+
When debug mode is active, Atomic appends one JSON line per event to `~/.atomic/agent/atomic-debug.log` in the form `{"at", "pid", "area", "event", "data"}`:
|
|
21
16
|
|
|
22
17
|
| Area | What it records |
|
|
23
18
|
| --- | --- |
|
|
24
19
|
| `decision` | A [classifier decision](/settings#decisionmodel) that failed and fell back to the current chat model. |
|
|
25
|
-
| `engine` |
|
|
26
|
-
| `storage` |
|
|
20
|
+
| `engine` | Background session recovery events and late tool results dropped after the conversation moved past them (`stale-detached-call`). |
|
|
21
|
+
| `storage` | Storage fallback and diagnostic events across SQLite [writer queues](/storage), worktree snapshot pools (locks, leases, evictions, seeds, refs), lock releases, compaction backups, resume checkouts and timings, startup progress, and migrations. Writer-queue degradation records its code, reason, adapter, path, and error code; other storage fallback events include redacted error messages and causes. |
|
|
27
22
|
|
|
28
|
-
Debug logs record IDs, names, counts, and status details, never prompts or conversation text. Common credential formats are replaced with `[redacted]`: bearer tokens, JWTs, GitHub tokens, private key blocks, `sk-...` API keys, and `key: value` or `key=value` pairs whose name
|
|
23
|
+
Debug mode logs record IDs, names, counts, and status details, never prompts or conversation text. Common credential formats are replaced with `[redacted]`: bearer tokens, JWTs, GitHub tokens, private key blocks, `sk-...` API keys, credentials embedded in URLs (`https://user:pass@host`), and `key: value` or `key=value` pairs whose name contains a key, token, secret, or password. Other secret formats can pass through, so review the log before sharing it. Individual text fields truncate at 2,000 characters.
|
|
29
24
|
|
|
30
|
-
The Intercom broker and other child processes started while debug mode is on inherit it, and subagents follow it
|
|
25
|
+
The Intercom broker and other child processes started while debug mode is on inherit it, and subagents follow it right away. Processes already running keep the setting they started with until they restart. If the debug log cannot be written, Atomic prints one warning and keeps running.
|
|
31
26
|
|
|
32
27
|
Extensions and SDK programs can read debug state and append records with the [debug output API](/sdk/reference#debug-output).
|
|
33
28
|
|
|
34
|
-
###
|
|
29
|
+
### Capture a UI and message snapshot (`/debug`)
|
|
30
|
+
|
|
31
|
+
Run `/debug` (a hidden slash command) or press `Shift+Ctrl+D` anywhere in the TUI (regardless of which element has focus) to append a diagnostic snapshot to `~/.atomic/agent/atomic-debug.log`.
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
Each snapshot appends plain text containing:
|
|
37
34
|
|
|
38
|
-
-
|
|
39
|
-
-
|
|
35
|
+
- Timestamp, terminal dimensions (`columns x rows`), and total rendered line count
|
|
36
|
+
- Every rendered TUI line, JSON-escaped with ANSI codes and visible widths
|
|
37
|
+
- **All messages in the current session context** as JSONL, **completely unredacted**
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
Because `/debug` writes your full session messages with no credential redaction and appends plain text into the same `atomic-debug.log` file where debug mode appends JSONL, delete `atomic-debug.log` before reproducing an issue (Atomic never trims or rotates it) and review and redact the file before sharing.
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
## Finding what freezes the UI
|
|
44
42
|
|
|
45
|
-
If the interactive UI stalls and keystrokes or streamed output appear late, set `ATOMIC_EVENT_LOOP_BLOCK_MS` to the shortest stall duration
|
|
43
|
+
If the interactive UI stalls and keystrokes or streamed output appear late, set `ATOMIC_EVENT_LOOP_BLOCK_MS` to the shortest stall duration in milliseconds you want to capture, reproduce the stall, and quit:
|
|
46
44
|
|
|
47
45
|
```bash
|
|
48
46
|
ATOMIC_EVENT_LOOP_BLOCK_MS=100 atomic
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
`ATOMIC_EVENT_LOOP_BLOCK_MS` must be a positive whole number (`1` or greater); `"0"`, negative numbers, decimals, and non-numeric values are ignored and no monitor starts.
|
|
50
|
+
|
|
51
|
+
Interactive sessions log both the terminal UI process (`role: "host"`) and the background session worker (`role: "engine"`) to `~/.atomic/agent/event-loop-blocks.jsonl`. Single-process runs write only `role: "host"`. Override the log file path with `ATOMIC_EVENT_LOOP_BLOCK_LOG` (relative paths resolve from the startup working directory). If the file cannot be written at startup, Atomic prints one warning and skips monitoring.
|
|
52
52
|
|
|
53
53
|
| `type` | Written | Fields |
|
|
54
54
|
| --- | --- | --- |
|
|
55
|
-
| `start` | When monitoring starts | `role`, `pid`, `runtime
|
|
56
|
-
| `block` | After each stall at or above
|
|
57
|
-
| `delay` | When ready for input (`startup`), when starting to quit (`session`), and on exit (`shutdown`) | `phase` (`startup`, `session`, or `shutdown`), `
|
|
55
|
+
| `start` | When monitoring starts | `at`, `role`, `pid`, `runtime` (`"node"` or `"bun"`), `thresholdMs`, and `stacks` (`"profiler"`, `"disabled"`, or `"unavailable"` if the inspector cannot connect) |
|
|
56
|
+
| `block` | After each stall at or above `thresholdMs` | `at` (when the event loop was due to respond), `role`, `pid`, `durationMs`, `thresholdMs`, `samples`, `hotFrames` (up to 10 most specific functions first), and `stacks` (up to 3 most common stacks, trimmed to the first 12 and last 12 frames) |
|
|
57
|
+
| `delay` | When ready for input (`startup`), when starting to quit (`session`), and on exit (`shutdown`) | `at`, `role`, `pid`, `phase` (`"startup"`, `"session"`, or `"shutdown"`), `durationMs`, `ticks`, `p50Ms`, `p99Ms`, and `maxMs` |
|
|
58
58
|
|
|
59
|
-
Quit Atomic, close the terminal or console window, or sign out of Windows
|
|
59
|
+
Quit Atomic cleanly, close the terminal or console window, or sign out of Windows so the final `shutdown` delay summary flushes to disk.
|
|
60
60
|
|
|
61
|
-
Block records contain function names and
|
|
61
|
+
Block records contain function names and source paths, never prompts or message text. Atomic never trims `event-loop-blocks.jsonl`, so delete it before reproducing a new issue.
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
The monitor checks the event loop every 20 ms, tracks delay histograms at 10 ms resolution, and samples the CPU every 2 ms using a sampling profiler rather than debugger pauses. A `debugger;` statement does not pause Atomic just because monitoring is active, and an attached debugger keeps control of its own breakpoints. Completed 5-second profile windows stay available until overlapping stalls are recorded, and functions sharing a name are tracked separately by source location.
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
Because CPU sampling adds some overhead, pass `ATOMIC_EVENT_LOOP_BLOCK_STACKS=0` (must be exact `"0"`; `"false"` leaves stacks enabled) when measuring raw latency:
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
68
|
ATOMIC_EVENT_LOOP_BLOCK_MS=100 ATOMIC_EVENT_LOOP_BLOCK_STACKS=0 atomic
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
In delay-only mode, `start` records report `stacks: "disabled"` and `block` records have zero samples, while every stall duration and delay summary is still
|
|
71
|
+
In delay-only mode, `start` records report `stacks: "disabled"` and `block` records have zero samples, while every stall duration and delay summary is still recorded.
|
|
72
72
|
|
|
73
|
-
##
|
|
73
|
+
## Document conversion diagnostics
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Diagnostics from document conversion (`.pdf`, `.doc`, `.docx`, `.ppt`, `.pptx`, `.xls`, `.xlsx`, `.rtf`, and `.epub`) and background session workers appear as status messages in interactive sessions and on stderr or console output in other modes. Conversion failures also include diagnostic details in the tool error result.
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
Long or noisy diagnostics may truncate, and interactive sessions keep only recent messages. Atomic strips ANSI escape codes and control characters so diagnostics render as plain text, and RPC clients receive them separately from JSON responses. Atomic does not write an `atomic-engine-stderr.log` file; copy the displayed diagnostic text and conversion error when reporting a document conversion issue.
|
|
78
78
|
|
|
79
|
-
##
|
|
79
|
+
## Startup timing and bug reports
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
To profile slow startup or session resume:
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
- Set `ATOMIC_TIMING=1` (legacy `PI_TIMING=1`) to print startup timings and `atomic --session` resume timings to stderr.
|
|
84
|
+
- Set `ATOMIC_STARTUP_TRACE=/tmp/atomic-startup.jsonl` (legacy `PI_STARTUP_TRACE`) to append JSONL startup milestones with wall-clock timestamps.
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
When reporting a bug or startup problem, include:
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
- Your OS and version
|
|
89
|
+
- Your terminal emulator (and tmux or Herdr version if applicable)
|
|
90
|
+
- Your installation method (npm/package manager, self-contained release archive, or standalone binary)
|
|
91
|
+
- Output of `atomic --version`
|
|
92
|
+
- Relevant redacted diagnostic logs
|
|
89
93
|
|
|
90
|
-
|
|
94
|
+
If you installed from a self-contained release archive, keep the archive's complete directory structure intact so Atomic can locate its bundled assets and native module. For dependency versions and official release downloads, see [Installation](/getting-started/installation#package-managers).
|