@bastani/atomic 0.9.38-alpha.4 → 0.9.38-alpha.6
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 +39 -0
- package/README.md +8 -6
- package/dist/builtin/intercom/CHANGELOG.md +15 -0
- package/dist/builtin/intercom/broker/broker.ts +6 -4
- package/dist/builtin/intercom/broker/delivered-message-cache.ts +50 -4
- package/dist/builtin/intercom/broker/send-handler.ts +6 -4
- package/dist/builtin/intercom/index.bundle.mjs +89 -40
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +29 -33
- package/dist/builtin/web-access/CHANGELOG.md +7 -0
- package/dist/builtin/web-access/index.bundle.mjs +53 -15
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +36 -0
- package/dist/builtin/workflows/builtin/{chunk-qrrkfg9v.js → chunk-2qgfyvzs.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-na3wpwzh.js → chunk-g1a4hw0s.js} +390 -345
- package/dist/builtin/workflows/builtin/{chunk-xg7kkgf8.js → chunk-neszcj53.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +3 -8
- package/dist/builtin/workflows/src/durable/journal/conformance.d.ts +9 -1
- package/dist/builtin/workflows/src/durable/journal/internal.d.ts +20 -0
- package/dist/builtin/workflows/src/durable/journal/lease-expiry.d.ts +2 -0
- package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +17 -1
- package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +6 -1
- package/dist/builtin/workflows/src/durable/journal/sql-run-journal.d.ts +45 -0
- package/dist/builtin/workflows/src/durable/journal/sqlite-run-journal.d.ts +5 -47
- package/dist/builtin/workflows/src/durable/journal/types.d.ts +15 -30
- package/dist/builtin/workflows/src/durable/journal/values.d.ts +2 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +23390 -22820
- package/dist/builtin/workflows/src/index.js +7614 -7060
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +7 -7
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +0 -14
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +6 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/session-picker.d.ts +2 -2
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +2 -2
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts +2 -3
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +18 -10
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-boundaries.d.ts +6 -6
- package/dist/core/agent-session-boundaries.d.ts.map +1 -1
- package/dist/core/agent-session-boundaries.js +22 -22
- package/dist/core/agent-session-boundaries.js.map +1 -1
- package/dist/core/agent-session-compaction.js +2 -2
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +10 -12
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +20 -13
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.js +1 -1
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts +2 -2
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +75 -59
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +2 -2
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +17 -8
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +15 -15
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +2 -2
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +59 -42
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts +4 -4
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +16 -17
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +6 -8
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +17 -15
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -8
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +44 -96
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-summary.js +1 -1
- package/dist/core/agent-session-summary.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +7 -7
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/cache-warmer.js +1 -1
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/export-html/index.js +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template-js/entries-navigation.js +1 -1
- package/dist/core/export-html/template.js +1 -1
- package/dist/core/extensions/api-types.d.ts +12 -12
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +4 -2
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/extension-work.d.ts +1 -0
- package/dist/core/extensions/extension-work.d.ts.map +1 -1
- package/dist/core/extensions/extension-work.js +5 -1
- package/dist/core/extensions/extension-work.js.map +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +40 -42
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-host-modules.js +6 -2
- package/dist/core/extensions/loader-host-modules.js.map +1 -1
- package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
- package/dist/core/extensions/loader-rollback.js +1 -0
- package/dist/core/extensions/loader-rollback.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +1 -0
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +1 -0
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +3 -2
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner-handlers.d.ts +1 -1
- package/dist/core/extensions/runner-handlers.d.ts.map +1 -1
- package/dist/core/extensions/runner-handlers.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +20 -12
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +7 -7
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/session-events.d.ts +5 -5
- package/dist/core/extensions/session-events.d.ts.map +1 -1
- package/dist/core/extensions/session-events.js.map +1 -1
- package/dist/core/fast-model-routing.d.ts.map +1 -1
- package/dist/core/fast-model-routing.js +1 -0
- package/dist/core/fast-model-routing.js.map +1 -1
- package/dist/core/intercom-runtime-group.js +1 -1
- package/dist/core/intercom-runtime-group.js.map +1 -1
- package/dist/core/provider-attribution.js +1 -1
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-archive.d.ts +2 -16
- package/dist/core/session-manager-archive.d.ts.map +1 -1
- package/dist/core/session-manager-archive.js +8 -104
- package/dist/core/session-manager-archive.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +48 -49
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +438 -306
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js +5 -10
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-errors.d.ts +10 -0
- package/dist/core/session-manager-errors.d.ts.map +1 -0
- package/dist/core/session-manager-errors.js +27 -0
- package/dist/core/session-manager-errors.js.map +1 -0
- package/dist/core/session-manager-list.d.ts +1 -0
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +14 -7
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-storage.d.ts +0 -11
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-storage.js +4 -61
- package/dist/core/session-manager-storage.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +2 -10
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/session-manager-validation.d.ts.map +1 -1
- package/dist/core/session-manager-validation.js +3 -2
- package/dist/core/session-manager-validation.js.map +1 -1
- package/dist/core/session-manager.d.ts +1 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-mutation-queue.d.ts +3 -0
- package/dist/core/session-mutation-queue.d.ts.map +1 -0
- package/dist/core/session-mutation-queue.js +14 -0
- package/dist/core/session-mutation-queue.js.map +1 -0
- package/dist/core/settings-merge.d.ts.map +1 -1
- package/dist/core/settings-merge.js +3 -2
- package/dist/core/settings-merge.js.map +1 -1
- package/dist/core/settings-schema.d.ts +0 -5
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +1 -15
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/storage/index.d.ts +1 -1
- package/dist/core/storage/index.d.ts.map +1 -1
- package/dist/core/storage/index.js +1 -1
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/node-sqlite.d.ts +2 -0
- package/dist/core/storage/node-sqlite.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite.js +47 -6
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.d.ts +9 -2
- package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.js +71 -27
- package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
- package/dist/core/storage/session/validation.js +1 -1
- package/dist/core/storage/session/validation.js.map +1 -1
- package/dist/core/storage/testing.d.ts +2 -0
- package/dist/core/storage/testing.d.ts.map +1 -1
- package/dist/core/storage/testing.js +45 -0
- package/dist/core/storage/testing.js.map +1 -1
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +2 -4
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tools/bash-session-environment.d.ts.map +1 -1
- package/dist/core/tools/bash-session-environment.js +0 -2
- package/dist/core/tools/bash-session-environment.js.map +1 -1
- package/dist/core/tools/todos-model.js +3 -3
- package/dist/core/tools/todos-model.js.map +1 -1
- package/dist/core/tools/todos-mutations.js +2 -2
- package/dist/core/tools/todos-mutations.js.map +1 -1
- package/dist/core/tools/todos-render.js +1 -1
- package/dist/core/tools/todos-render.js.map +1 -1
- package/dist/core/tools/todos-storage.js +2 -2
- package/dist/core/tools/todos-storage.js.map +1 -1
- package/dist/extensions/codemode/execute.js +1 -1
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +1 -1
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/herdr/index.d.ts.map +1 -1
- package/dist/extensions/herdr/index.js +1 -5
- package/dist/extensions/herdr/index.js.map +1 -1
- package/dist/extensions/mcp/index.js +1 -1
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/tools.d.ts.map +1 -1
- package/dist/extensions/mcp/tools.js +6 -1
- package/dist/extensions/mcp/tools.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +7 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +86 -52
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +51 -30
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +1 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +2 -2
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/host-session-picker.js +1 -1
- package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +4 -1
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts +9 -6
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +15 -14
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +7 -4
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +12 -14
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts +5 -1
- package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-component.js +20 -3
- package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.js +1 -1
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +2 -2
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +2 -2
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +2 -0
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +6 -4
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -5
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +12 -7
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +2 -2
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +24 -12
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +2 -2
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-args.js +7 -4
- package/dist/modes/interactive-engine/engine-args.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +90 -71
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-bash-request-owners.js +1 -1
- package/dist/modes/rpc/rpc-bash-request-owners.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js +2 -2
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +2 -2
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +18 -7
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +4 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +6 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +11 -8
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.js +2 -2
- package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +6 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/custom-provider/oauth.md +2 -2
- package/docs/custom-provider/override.md +3 -3
- package/docs/custom-provider/registration.md +7 -7
- package/docs/custom-provider/streaming.md +1 -1
- package/docs/custom-provider.md +5 -5
- package/docs/environment-variables.md +5 -1
- package/docs/extensions/api-reference.md +40 -19
- package/docs/extensions/authoring.md +1 -1
- package/docs/extensions/events.md +8 -8
- package/docs/extensions.md +2 -2
- package/docs/getting-started/installation.md +1 -2
- package/docs/providers.md +2 -2
- package/docs/quickstart.md +2 -1
- package/docs/reference/cli.md +3 -3
- package/docs/rpc/protocol.md +10 -4
- package/docs/sdk/reference.md +15 -13
- package/docs/sdk/web-server.md +5 -6
- package/docs/sdk.md +18 -1
- package/docs/session-format.md +7 -5
- package/docs/sessions.md +11 -2
- package/docs/settings.md +17 -2
- package/docs/storage.md +262 -1
- package/docs/usage.md +3 -2
- package/docs/workflows/api-reference.md +67 -11
- package/docs/workflows/operations.md +4 -2
- package/examples/extensions/bookmark.ts +2 -2
- package/examples/extensions/handoff.ts +2 -2
- package/examples/extensions/plan-mode/index.ts +15 -13
- package/examples/extensions/preset.ts +8 -8
- package/examples/extensions/session-name.ts +1 -1
- package/examples/extensions/snake.ts +3 -1
- package/examples/extensions/space-invaders.ts +3 -1
- package/examples/extensions/tic-tac-toe.ts +80 -80
- package/examples/sdk/11-sessions.ts +5 -5
- package/examples/sdk/13-session-runtime.ts +7 -7
- package/examples/sdk/README.md +1 -1
- package/npm-shrinkwrap.json +32 -32
- package/package.json +3 -3
- package/schemas/settings.schema.json +1 -22
- package/dist/builtin/workflows/builtin/chunk-h5fn47y5.js +0 -8
- package/dist/builtin/workflows/src/durable/journal/node-sqlite.d.ts +0 -20
|
@@ -12,9 +12,9 @@ Use `pi.registerProviderAlias()` instead of copying a provider's models, OAuth m
|
|
|
12
12
|
```typescript
|
|
13
13
|
import type { ExtensionAPI } from "@bastani/atomic";
|
|
14
14
|
|
|
15
|
-
export default function (pi: ExtensionAPI) {
|
|
15
|
+
export default async function (pi: ExtensionAPI) {
|
|
16
16
|
for (let account = 1; account <= 7; account++) {
|
|
17
|
-
pi.registerProviderAlias({
|
|
17
|
+
await pi.registerProviderAlias({
|
|
18
18
|
id: `openai-${account}`,
|
|
19
19
|
name: `OpenAI account ${account}`,
|
|
20
20
|
provider: "openai",
|
|
@@ -57,7 +57,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
57
57
|
}>;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
pi.registerProvider("local-openai", {
|
|
60
|
+
await pi.registerProvider("local-openai", {
|
|
61
61
|
baseUrl: "http://localhost:1234/v1",
|
|
62
62
|
apiKey: "$LOCAL_OPENAI_API_KEY",
|
|
63
63
|
api: "openai-completions",
|
|
@@ -77,7 +77,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
77
77
|
This registers the fetched models before startup finishes.
|
|
78
78
|
|
|
79
79
|
```typescript
|
|
80
|
-
pi.registerProvider("my-llm", {
|
|
80
|
+
await pi.registerProvider("my-llm", {
|
|
81
81
|
baseUrl: "https://api.my-llm.com/v1",
|
|
82
82
|
apiKey: "$MY_LLM_API_KEY", // env var reference; omit $ for a literal value
|
|
83
83
|
api: "openai-completions", // which streaming API to use
|
|
@@ -108,7 +108,7 @@ Use `pi.unregisterProvider(name)` to remove a provider that was previously regis
|
|
|
108
108
|
|
|
109
109
|
```typescript
|
|
110
110
|
// Register
|
|
111
|
-
pi.registerProvider("my-llm", {
|
|
111
|
+
await pi.registerProvider("my-llm", {
|
|
112
112
|
baseUrl: "https://api.my-llm.com/v1",
|
|
113
113
|
apiKey: "$MY_LLM_API_KEY",
|
|
114
114
|
api: "openai-completions",
|
|
@@ -126,7 +126,7 @@ pi.registerProvider("my-llm", {
|
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
// Later, remove it
|
|
129
|
-
pi.unregisterProvider("my-llm");
|
|
129
|
+
await pi.unregisterProvider("my-llm");
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
Unregistering removes that provider's dynamic models, API key fallback, OAuth provider registration, and custom stream handler registrations. Any built-in models or provider behavior that were overridden are restored.
|
|
@@ -185,7 +185,7 @@ Use `mistral-conversations` for native Mistral models. If you intentionally rout
|
|
|
185
185
|
If your provider expects `Authorization: Bearer <key>` but doesn't use a standard API, set `authHeader: true`:
|
|
186
186
|
|
|
187
187
|
```typescript
|
|
188
|
-
pi.registerProvider("custom-api", {
|
|
188
|
+
await pi.registerProvider("custom-api", {
|
|
189
189
|
baseUrl: "https://api.example.com",
|
|
190
190
|
apiKey: "$MY_API_KEY",
|
|
191
191
|
authHeader: true, // adds Authorization: Bearer header
|
|
@@ -213,7 +213,7 @@ calculateCost(model, output.usage);
|
|
|
213
213
|
Register your stream function:
|
|
214
214
|
|
|
215
215
|
```typescript
|
|
216
|
-
pi.registerProvider("my-provider", {
|
|
216
|
+
await pi.registerProvider("my-provider", {
|
|
217
217
|
baseUrl: "https://api.example.com",
|
|
218
218
|
apiKey: "$MY_API_KEY",
|
|
219
219
|
api: "my-custom-api",
|
package/docs/custom-provider.md
CHANGED
|
@@ -50,14 +50,14 @@ See these complete provider examples:
|
|
|
50
50
|
```typescript
|
|
51
51
|
import type { ExtensionAPI } from "@bastani/atomic";
|
|
52
52
|
|
|
53
|
-
export default function (pi: ExtensionAPI) {
|
|
53
|
+
export default async function (pi: ExtensionAPI) {
|
|
54
54
|
// Override baseUrl for existing provider
|
|
55
|
-
pi.registerProvider("anthropic", {
|
|
55
|
+
await pi.registerProvider("anthropic", {
|
|
56
56
|
baseUrl: "https://proxy.example.com"
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// Register new provider with models
|
|
60
|
-
pi.registerProvider("my-provider", {
|
|
60
|
+
await pi.registerProvider("my-provider", {
|
|
61
61
|
name: "My Provider",
|
|
62
62
|
baseUrl: "https://api.example.com",
|
|
63
63
|
apiKey: "$MY_API_KEY",
|
|
@@ -77,14 +77,14 @@ export default function (pi: ExtensionAPI) {
|
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
Await provider registration and removal. For dynamic model discovery, fetch and register models in the async extension factory instead of `session_start`. Atomic waits for the factory before startup continues, so the provider is available during interactive startup and to `atomic --list-models`.
|
|
81
81
|
|
|
82
82
|
Registering only `baseUrl` or `headers` for an existing provider preserves its built-in models. Supplying `models` in the legacy form replaces that provider's models across chat, image, and classifier operations. An omitted `type` means `"chat"`; image and classifier models require explicit discriminants and implementations keyed by their `api` values through the `images` and `classifiers` fields.
|
|
83
83
|
|
|
84
84
|
For example, a mixed-operation provider can register non-chat models and their implementations together:
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
|
-
pi.registerProvider("media-tools", {
|
|
87
|
+
await pi.registerProvider("media-tools", {
|
|
88
88
|
apiKey: "$MEDIA_TOOLS_API_KEY",
|
|
89
89
|
models: [
|
|
90
90
|
{
|
|
@@ -15,6 +15,7 @@ Atomic accepts environment variables for configuration, provider credentials, an
|
|
|
15
15
|
| `ATOMIC_REDUCED_MOTION` | `PI_REDUCED_MOTION` | Use static reduced-motion presentation |
|
|
16
16
|
| `ATOMIC_EXPERIMENTAL` | `PI_EXPERIMENTAL` | Set to `1` to enable experimental features and preferred strict JSON-schema constrained sampling for additional built-in tools; `read`, `edit`, `write`, `bash`, and PowerShell already prefer strict sampling by default. The footer shows an `xp` badge |
|
|
17
17
|
| `ATOMIC_CLIPBOARD_OSC52` | `PI_CLIPBOARD_OSC52` | Set to `1` to also send copied text to the terminal with OSC 52 after the local clipboard write, as Atomic does over SSH. Use it when a remote client reaches Atomic without SSH variables, such as a multiplexer attached from another machine or a remote IDE daemon |
|
|
18
|
+
| `ATOMIC_WORKFLOW_JOURNAL_PATH` | None | Non-empty value selects the local SQLite workflow journal file; overrides `workflows.journal` settings, but not SDK `RunOpts.journal` |
|
|
18
19
|
|
|
19
20
|
`VISUAL` and `EDITOR` select the Ctrl+G external editor when `externalEditor` is unset.
|
|
20
21
|
|
|
@@ -24,6 +25,10 @@ The renderer also owns `PI_HYPERLINKS`, `PI_IMAGE_PROTOCOL`, and `PI_TRUE_COLOR`
|
|
|
24
25
|
|
|
25
26
|
`PI_PROGRAM_STATUS=1` forces OSC 7501 program-status reports; `0` disables them. Otherwise Atomic reports only after the terminal confirms support. This renderer-owned variable has no `ATOMIC_*` alias. See [Program status](/terminal-setup#program-status).
|
|
26
27
|
|
|
28
|
+
## Workflow journal
|
|
29
|
+
|
|
30
|
+
The default workflow journal is `~/.atomic/workflows/journal.sqlite`. `ATOMIC_WORKFLOW_JOURNAL_PATH` selects another file; an empty value leaves settings in effect. In `settings.json`, use `workflows.journal.path` or explicitly select process-local memory with `workflows.journal.memory: true`. Relative settings paths resolve against the Atomic home directory. Memory cannot recover runs after process exit and is never selected after a storage failure. See [Workflow storage](/settings#workflow-storage).
|
|
31
|
+
|
|
27
32
|
## Prompt-cache retention
|
|
28
33
|
|
|
29
34
|
Atomic defaults to **long** prompt-cache retention in main chat, workflow stages, and subagents wherever the provider/model supports it. `PI_CACHE_RETENTION` intentionally has no `ATOMIC_*` alias. Set it before launching Atomic to choose `short`, `none`, or `long`:
|
|
@@ -55,7 +60,6 @@ Every built-in, factory-created, direct, workflow-stage, and isolated bash or Po
|
|
|
55
60
|
| Atomic variable | Exact Pi alias | Value |
|
|
56
61
|
|---|---|---|
|
|
57
62
|
| `ATOMIC_SESSION_ID` | `PI_SESSION_ID` | Active session ID |
|
|
58
|
-
| `ATOMIC_SESSION_FILE` | `PI_SESSION_FILE` | Active JSONL file; omitted for unsaved/ephemeral sessions |
|
|
59
63
|
| `ATOMIC_PROVIDER` | `PI_PROVIDER` | Active provider; omitted when no model is selected |
|
|
60
64
|
| `ATOMIC_MODEL` | `PI_MODEL` | Active model ID; omitted when no model is selected |
|
|
61
65
|
| `ATOMIC_REASONING_LEVEL` | `PI_REASONING_LEVEL` | Active reasoning level |
|
|
@@ -137,6 +137,25 @@ pi.on("tool_result", async (event, ctx) => {
|
|
|
137
137
|
});
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
+
### ctx.sessionSignal
|
|
141
|
+
|
|
142
|
+
A read-only `AbortSignal` for the session lifetime, available even while the agent is idle. It aborts when reload or shutdown begins, **before** Atomic drains admitted commands and emits `session_shutdown`. Unlike `ctx.signal`, it does not end when an agent turn finishes. A replacement session generation receives a new signal.
|
|
143
|
+
|
|
144
|
+
Custom UI mounted through `ctx.ui.custom` is dismissed automatically when the session ends; an explicit caller signal can still dismiss it earlier. Use `ctx.sessionSignal` for other long-running command resources, such as browser windows, instead of waiting for `session_shutdown`, which cannot run until those commands settle. Cancellation should stop waiting for input, not abandon a session write already started: keep awaiting that write so teardown can drain it safely.
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
148
|
+
|
|
149
|
+
pi.registerCommand("monitor", {
|
|
150
|
+
description: "Keep a monitor open until the session ends",
|
|
151
|
+
handler: async (_args, ctx) => {
|
|
152
|
+
await ctx.ui.custom(() => new Text("Monitoring; reload or quit to close."), {
|
|
153
|
+
signal: ctx.sessionSignal,
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
140
159
|
### ctx.isIdle() / ctx.abort() / ctx.hasPendingMessages()
|
|
141
160
|
|
|
142
161
|
Control flow helpers.
|
|
@@ -261,13 +280,13 @@ pi.registerCommand("my-cmd", {
|
|
|
261
280
|
Create a new session:
|
|
262
281
|
|
|
263
282
|
```typescript
|
|
264
|
-
const parentSession = ctx.sessionManager.
|
|
283
|
+
const parentSession = ctx.sessionManager.getSessionId();
|
|
265
284
|
const kickoff = "Continue in the replacement session";
|
|
266
285
|
|
|
267
286
|
const result = await ctx.newSession({
|
|
268
287
|
parentSession,
|
|
269
288
|
setup: async (sm) => {
|
|
270
|
-
sm.appendMessage({
|
|
289
|
+
await sm.appendMessage({
|
|
271
290
|
role: "user",
|
|
272
291
|
content: [{ type: "text", text: "Context from previous session..." }],
|
|
273
292
|
timestamp: Date.now(),
|
|
@@ -285,7 +304,7 @@ if (result.cancelled) {
|
|
|
285
304
|
```
|
|
286
305
|
|
|
287
306
|
Options:
|
|
288
|
-
- `parentSession`: parent session
|
|
307
|
+
- `parentSession`: parent session ID to record in the new session header
|
|
289
308
|
- `setup`: mutate the new session's `SessionManager` before `withSession` runs
|
|
290
309
|
- `withSession`: run post-switch work against a fresh replacement-session context. Do not use captured old `pi` / command `ctx`; see [Session replacement lifecycle and footguns](#session-replacement-lifecycle-and-footguns).
|
|
291
310
|
|
|
@@ -334,12 +353,12 @@ Options:
|
|
|
334
353
|
- `replaceInstructions`: If true, `customInstructions` replaces the default prompt instead of being appended
|
|
335
354
|
- `label`: Label to attach to the branch summary entry (or target entry if not summarizing)
|
|
336
355
|
|
|
337
|
-
### ctx.switchSession(
|
|
356
|
+
### ctx.switchSession(sessionId, options?)
|
|
338
357
|
|
|
339
|
-
Switch to a different session
|
|
358
|
+
Switch to a different session by its exact ID:
|
|
340
359
|
|
|
341
360
|
```typescript
|
|
342
|
-
const result = await ctx.switchSession("
|
|
361
|
+
const result = await ctx.switchSession("my-session-id", {
|
|
343
362
|
withSession: async (ctx) => {
|
|
344
363
|
await ctx.sendUserMessage("Resume work in the replacement session");
|
|
345
364
|
},
|
|
@@ -364,7 +383,7 @@ pi.registerCommand("switch", {
|
|
|
364
383
|
if (sessions.length === 0) return;
|
|
365
384
|
const choice = await ctx.ui.select(
|
|
366
385
|
"Pick session:",
|
|
367
|
-
sessions.map(s => s.
|
|
386
|
+
sessions.map(s => s.id),
|
|
368
387
|
);
|
|
369
388
|
if (choice) {
|
|
370
389
|
await ctx.switchSession(choice, {
|
|
@@ -633,7 +652,7 @@ See [send-user-message.ts](https://github.com/bastani-inc/atomic/blob/main/packa
|
|
|
633
652
|
Persist extension state (does NOT participate in LLM context).
|
|
634
653
|
|
|
635
654
|
```typescript
|
|
636
|
-
pi.appendEntry("my-state", { count: 42 });
|
|
655
|
+
await pi.appendEntry("my-state", { count: 42 });
|
|
637
656
|
|
|
638
657
|
// Restore on reload
|
|
639
658
|
pi.on("session_start", async (_event, ctx) => {
|
|
@@ -645,7 +664,9 @@ pi.on("session_start", async (_event, ctx) => {
|
|
|
645
664
|
});
|
|
646
665
|
```
|
|
647
666
|
|
|
648
|
-
Appending emits `entry_appended` with the
|
|
667
|
+
Await `pi.appendEntry` before using the new entry. The promise resolves after the write commits and rejects with the store's typed error if it fails. Setup entries also commit before the promise resolves. Appending emits `entry_appended` with the committed entry. This lets extensions react to session entries without polling.
|
|
668
|
+
|
|
669
|
+
During a transactional reload's `session_start` handler, `pi.appendEntry`, `pi.setSessionName`, and `pi.setLabel` stage their writes instead. Awaiting them confirms staging; the writes and their notifications are published in call order only after reload succeeds. Rejected reloads discard these changes. Do not depend on reading the staged changes back during that handler.
|
|
649
670
|
|
|
650
671
|
### pi.registerEntryRenderer(customType, renderer)
|
|
651
672
|
|
|
@@ -667,7 +688,7 @@ pi.registerEntryRenderer("status-card", (entry, { expanded }, theme) =>
|
|
|
667
688
|
Set the session display name (shown in session selector instead of first message).
|
|
668
689
|
|
|
669
690
|
```typescript
|
|
670
|
-
pi.setSessionName("Refactor auth module");
|
|
691
|
+
await pi.setSessionName("Refactor auth module");
|
|
671
692
|
```
|
|
672
693
|
|
|
673
694
|
### pi.getSessionName()
|
|
@@ -687,10 +708,10 @@ Set or clear a label on an entry. Labels are user-defined markers for bookmarkin
|
|
|
687
708
|
|
|
688
709
|
```typescript
|
|
689
710
|
// Set a label
|
|
690
|
-
pi.setLabel(entryId, "checkpoint-before-refactor");
|
|
711
|
+
await pi.setLabel(entryId, "checkpoint-before-refactor");
|
|
691
712
|
|
|
692
713
|
// Clear a label
|
|
693
|
-
pi.setLabel(entryId, undefined);
|
|
714
|
+
await pi.setLabel(entryId, undefined);
|
|
694
715
|
|
|
695
716
|
// Read labels via sessionManager
|
|
696
717
|
const label = ctx.sessionManager.getLabel(entryId);
|
|
@@ -895,7 +916,7 @@ Get the current thinking level. Level is clamped to model capabilities (non-reas
|
|
|
895
916
|
|
|
896
917
|
```typescript
|
|
897
918
|
const current = pi.getThinkingLevel(); // "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"
|
|
898
|
-
pi.setThinkingLevel("high");
|
|
919
|
+
await pi.setThinkingLevel("high");
|
|
899
920
|
```
|
|
900
921
|
|
|
901
922
|
### pi.events
|
|
@@ -919,7 +940,7 @@ In addition to `registerProvider(name, config)`, extensions can register a compl
|
|
|
919
940
|
|
|
920
941
|
### pi.registerProvider(name, config)
|
|
921
942
|
|
|
922
|
-
Register or override a model provider dynamically. Useful for proxies, custom endpoints, or team-wide model configurations.
|
|
943
|
+
Register or override a model provider dynamically. Await registration, aliases, and removal before starting dependent work. Useful for proxies, custom endpoints, or team-wide model configurations.
|
|
923
944
|
|
|
924
945
|
Calls made during the extension factory function are queued and applied once the runner initialises. Calls made after that — for example from a command handler following a user setup flow — take effect immediately without requiring a `/reload`.
|
|
925
946
|
|
|
@@ -927,7 +948,7 @@ If you need to discover models from a remote endpoint, prefer an async extension
|
|
|
927
948
|
|
|
928
949
|
```typescript
|
|
929
950
|
// Register a new provider with custom models
|
|
930
|
-
pi.registerProvider("my-proxy", {
|
|
951
|
+
await pi.registerProvider("my-proxy", {
|
|
931
952
|
name: "My Proxy",
|
|
932
953
|
baseUrl: "https://proxy.example.com",
|
|
933
954
|
apiKey: "$PROXY_API_KEY", // env var reference; omit $ for a literal
|
|
@@ -946,12 +967,12 @@ pi.registerProvider("my-proxy", {
|
|
|
946
967
|
});
|
|
947
968
|
|
|
948
969
|
// Override baseUrl for an existing provider (keeps all models)
|
|
949
|
-
pi.registerProvider("anthropic", {
|
|
970
|
+
await pi.registerProvider("anthropic", {
|
|
950
971
|
baseUrl: "https://proxy.example.com"
|
|
951
972
|
});
|
|
952
973
|
|
|
953
974
|
// Register provider with OAuth support for /login
|
|
954
|
-
pi.registerProvider("corporate-ai", {
|
|
975
|
+
await pi.registerProvider("corporate-ai", {
|
|
955
976
|
baseUrl: "https://ai.corp.com",
|
|
956
977
|
api: "openai-responses",
|
|
957
978
|
models: [...],
|
|
@@ -976,7 +997,7 @@ pi.registerProvider("corporate-ai", {
|
|
|
976
997
|
});
|
|
977
998
|
|
|
978
999
|
// Register provider-owned API-key setup for /login
|
|
979
|
-
pi.registerProvider("local-server", {
|
|
1000
|
+
await pi.registerProvider("local-server", {
|
|
980
1001
|
name: "Local Server",
|
|
981
1002
|
auth: {
|
|
982
1003
|
apiKey: {
|
|
@@ -1021,7 +1042,7 @@ Like `registerProvider`, this takes effect immediately when called after the ini
|
|
|
1021
1042
|
pi.registerCommand("my-setup-teardown", {
|
|
1022
1043
|
description: "Remove the custom proxy provider",
|
|
1023
1044
|
handler: async (_args, _ctx) => {
|
|
1024
|
-
pi.unregisterProvider("my-proxy");
|
|
1045
|
+
await pi.unregisterProvider("my-proxy");
|
|
1025
1046
|
},
|
|
1026
1047
|
});
|
|
1027
1048
|
```
|
|
@@ -56,7 +56,7 @@ export default async function (pi: ExtensionAPI) {
|
|
|
56
56
|
}>;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
pi.registerProvider("local-openai", {
|
|
59
|
+
await pi.registerProvider("local-openai", {
|
|
60
60
|
baseUrl: "http://localhost:1234/v1",
|
|
61
61
|
apiKey: "$LOCAL_OPENAI_API_KEY",
|
|
62
62
|
api: "openai-completions",
|
|
@@ -59,13 +59,13 @@ user sends another prompt ◄─────────────────
|
|
|
59
59
|
/new (new session) or /resume (switch session)
|
|
60
60
|
├─► session_before_switch (can cancel)
|
|
61
61
|
├─► session_shutdown
|
|
62
|
-
├─► session_start { reason: "new" | "resume",
|
|
62
|
+
├─► session_start { reason: "new" | "resume", previousSessionId? }
|
|
63
63
|
└─► resources_discover { reason: "startup" }
|
|
64
64
|
|
|
65
65
|
/fork or /clone
|
|
66
66
|
├─► session_before_fork (can cancel)
|
|
67
67
|
├─► session_shutdown
|
|
68
|
-
├─► session_start { reason: "fork",
|
|
68
|
+
├─► session_start { reason: "fork", previousSessionId }
|
|
69
69
|
└─► resources_discover { reason: "startup" }
|
|
70
70
|
|
|
71
71
|
/compact or auto-compaction
|
|
@@ -141,8 +141,8 @@ Fired when a session is started, loaded, or reloaded.
|
|
|
141
141
|
```typescript
|
|
142
142
|
pi.on("session_start", async (event, ctx) => {
|
|
143
143
|
// event.reason - "startup" | "reload" | "new" | "resume" | "fork"
|
|
144
|
-
// event.
|
|
145
|
-
ctx.ui.notify(`Session: ${ctx.sessionManager.
|
|
144
|
+
// event.previousSessionId - present for "new", "resume", and "fork"
|
|
145
|
+
ctx.ui.notify(`Session: ${ctx.sessionManager.getSessionId()}`, "info");
|
|
146
146
|
});
|
|
147
147
|
```
|
|
148
148
|
|
|
@@ -164,7 +164,7 @@ Fired before starting a new session (`/new`) or switching sessions (`/resume`).
|
|
|
164
164
|
```typescript
|
|
165
165
|
pi.on("session_before_switch", async (event, ctx) => {
|
|
166
166
|
// event.reason - "new" or "resume"
|
|
167
|
-
// event.
|
|
167
|
+
// event.targetSessionId - session we're switching to (only for "resume")
|
|
168
168
|
|
|
169
169
|
if (event.reason === "new") {
|
|
170
170
|
const ok = await ctx.ui.confirm("Clear?", "Delete all messages?");
|
|
@@ -173,7 +173,7 @@ pi.on("session_before_switch", async (event, ctx) => {
|
|
|
173
173
|
});
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
After a successful switch or new-session action, Atomic emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "new" | "resume"` and `
|
|
176
|
+
After a successful switch or new-session action, Atomic emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "new" | "resume"` and `previousSessionId`.
|
|
177
177
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
178
178
|
|
|
179
179
|
#### session_before_fork
|
|
@@ -190,7 +190,7 @@ pi.on("session_before_fork", async (event, ctx) => {
|
|
|
190
190
|
});
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
After a successful fork or clone, Atomic emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "fork"` and `
|
|
193
|
+
After a successful fork or clone, Atomic emits `session_shutdown` for the old extension instance, reloads and rebinds extensions for the new session, then emits `session_start` with `reason: "fork"` and `previousSessionId`.
|
|
194
194
|
Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `session_start`.
|
|
195
195
|
|
|
196
196
|
#### session_before_compact / session_compact / session_compact_failed
|
|
@@ -259,7 +259,7 @@ Fired before a started session runtime is torn down. Use this to clean up resour
|
|
|
259
259
|
```typescript
|
|
260
260
|
pi.on("session_shutdown", async (event, ctx) => {
|
|
261
261
|
// event.reason - "quit" | "reload" | "new" | "resume" | "fork"
|
|
262
|
-
// event.
|
|
262
|
+
// event.targetSessionId - destination session for session replacement flows
|
|
263
263
|
// event.fromSignal - true when a "quit" came from a host SIGTERM/SIGHUP, not an explicit quit
|
|
264
264
|
// Cleanup, save state, etc.
|
|
265
265
|
});
|
package/docs/extensions.md
CHANGED
|
@@ -498,9 +498,9 @@ Moved to [Extension API reference](/extensions/api-reference#ctx-fork-entryid-op
|
|
|
498
498
|
|
|
499
499
|
Moved to [Extension API reference](/extensions/api-reference#ctx-navigatetree-targetid-options).
|
|
500
500
|
|
|
501
|
-
### ctx.switchSession(
|
|
501
|
+
### ctx.switchSession(sessionId, options?)
|
|
502
502
|
|
|
503
|
-
Moved to [Extension API reference](/extensions/api-reference#ctx-switchsession-
|
|
503
|
+
Moved to [Extension API reference](/extensions/api-reference#ctx-switchsession-sessionid-options).
|
|
504
504
|
|
|
505
505
|
### Session replacement lifecycle and footguns
|
|
506
506
|
|
|
@@ -33,11 +33,10 @@ bun add -g @bastani/atomic
|
|
|
33
33
|
|
|
34
34
|
Atomic does not require package install scripts. Add `--ignore-scripts` if you want to disable dependency lifecycle scripts during a package install.
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Workflow persistence uses a local SQLite journal. No database server or separate database installation is needed. The default file is `~/.atomic/workflows/journal.sqlite`; configure another location with `ATOMIC_WORKFLOW_JOURNAL_PATH` or the [workflow storage settings](/settings#workflow-storage).
|
|
37
37
|
|
|
38
38
|
Keep a standalone archive's complete directory, including `node_modules`, libraries, and licenses. Package managers select the runtime for your platform automatically.
|
|
39
39
|
|
|
40
|
-
Windows ARM64 uses Windows x64 PostgreSQL under Windows 11's x64 emulation, not native PostgreSQL ARM64. It requires the Microsoft Visual C++ x64 v14 Redistributable. Windows 10 on ARM cannot run this x64 runtime, and Windows ARM64 execution still needs hardware validation.
|
|
41
40
|
|
|
42
41
|
### Release archive
|
|
43
42
|
|
package/docs/providers.md
CHANGED
|
@@ -566,8 +566,8 @@ export default {
|
|
|
566
566
|
extensionFactories: [
|
|
567
567
|
{
|
|
568
568
|
name: "cloudflare-gateway-binding",
|
|
569
|
-
factory: (pi) => {
|
|
570
|
-
pi.registerProvider("cloudflare-ai-gateway", {
|
|
569
|
+
factory: async (pi) => {
|
|
570
|
+
await pi.registerProvider("cloudflare-ai-gateway", {
|
|
571
571
|
// Placeholder credential: it marks the provider configured and becomes
|
|
572
572
|
// `cf-aig-authorization: Bearer cloudflare-gateway-binding`. On the plain
|
|
573
573
|
// binding fetch path, Cloudflare's gateway recognizes and strips it.
|
package/docs/quickstart.md
CHANGED
|
@@ -154,7 +154,8 @@ Sessions are saved automatically:
|
|
|
154
154
|
atomic -c # Continue most recent session
|
|
155
155
|
atomic -r # Browse previous sessions
|
|
156
156
|
atomic --name "my task" # Set session display name at startup
|
|
157
|
-
atomic --session <
|
|
157
|
+
atomic --session <id|prefix> # Open an exact ID or unique 8-hex UUID prefix
|
|
158
|
+
atomic --import <file> # Import a format-4 JSONL export
|
|
158
159
|
```
|
|
159
160
|
|
|
160
161
|
Inside Atomic, use `/resume`, `/new`, `/tree`, `/fork`, and `/clone` to manage sessions.
|
package/docs/reference/cli.md
CHANGED
|
@@ -133,9 +133,10 @@ When a print-mode turn correctly finishes by calling an opt-in terminating struc
|
|
|
133
133
|
|--------|-------------|
|
|
134
134
|
| `-c`, `--continue` | Continue the most recent session |
|
|
135
135
|
| `-r`, `--resume` | Browse and select a session |
|
|
136
|
-
| `--session <
|
|
136
|
+
| `--session <id\|prefix>` | Use an exact ID or unique 8-hex UUID prefix |
|
|
137
|
+
| `--import <file>` | Import a format-4 JSONL export into session storage |
|
|
137
138
|
| `--session-id <id>` | Use an exact project session ID; warn and create it when missing |
|
|
138
|
-
| `--fork <
|
|
139
|
+
| `--fork <id\|prefix>` | Fork an exact ID or unique 8-hex UUID prefix into a new session |
|
|
139
140
|
| `--session-dir <dir>` | Custom session storage directory |
|
|
140
141
|
| `--name <name>`, `-n <name>` | Set the session display name |
|
|
141
142
|
| `--no-session` | Ephemeral mode; do not save |
|
|
@@ -261,7 +262,6 @@ Every bash execution receives one execution-time snapshot of the active session.
|
|
|
261
262
|
| Atomic variable | Exact compatibility alias | Value |
|
|
262
263
|
|-----------------|---------------------------|-------|
|
|
263
264
|
| `ATOMIC_SESSION_ID` | `PI_SESSION_ID` | Active session ID |
|
|
264
|
-
| `ATOMIC_SESSION_FILE` | `PI_SESSION_FILE` | Active session JSONL path; omitted for unsaved sessions |
|
|
265
265
|
| `ATOMIC_PROVIDER` | `PI_PROVIDER` | Active model provider; omitted when no model is selected |
|
|
266
266
|
| `ATOMIC_MODEL` | `PI_MODEL` | Active model ID; omitted when no model is selected |
|
|
267
267
|
| `ATOMIC_REASONING_LEVEL` | `PI_REASONING_LEVEL` | Active reasoning level |
|
package/docs/rpc/protocol.md
CHANGED
|
@@ -157,7 +157,7 @@ Start a fresh session. Can be cancelled by a `session_before_switch` extension e
|
|
|
157
157
|
|
|
158
158
|
With optional parent session tracking:
|
|
159
159
|
```json
|
|
160
|
-
{"type": "new_session", "parentSession": "
|
|
160
|
+
{"type": "new_session", "parentSession": "parent-session-id"}
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
Response:
|
|
@@ -193,7 +193,7 @@ Response:
|
|
|
193
193
|
"isCompacting": false,
|
|
194
194
|
"steeringMode": "all",
|
|
195
195
|
"followUpMode": "one-at-a-time",
|
|
196
|
-
"
|
|
196
|
+
"sessionLocation": "/path/to/session.jsonl",
|
|
197
197
|
"sessionId": "abc123",
|
|
198
198
|
"sessionName": "my-feature-work",
|
|
199
199
|
"autoCompactionEnabled": true,
|
|
@@ -744,10 +744,16 @@ Response:
|
|
|
744
744
|
|
|
745
745
|
#### switch_session
|
|
746
746
|
|
|
747
|
-
Load a different session
|
|
747
|
+
Load a different session by its exact ID. Can be cancelled by a `session_before_switch` extension event handler. `sessionLocation` in `get_state` is optional display text, not a switch target.
|
|
748
|
+
|
|
749
|
+
```json
|
|
750
|
+
{"type": "switch_session", "sessionId": "abc123"}
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
When choosing a session from another project's JSONL store, pass `sessionDirectory` to bind the ID lookup to that directory. IDs may repeat in different project stores; an explicitly selected directory never falls back to another store. `cwdOverride` changes the resumed working directory, not the store used for lookup.
|
|
748
754
|
|
|
749
755
|
```json
|
|
750
|
-
{"type": "switch_session", "
|
|
756
|
+
{"type": "switch_session", "sessionId": "abc123", "sessionDirectory": "/path/to/project-sessions"}
|
|
751
757
|
```
|
|
752
758
|
|
|
753
759
|
Response:
|
package/docs/sdk/reference.md
CHANGED
|
@@ -555,12 +555,12 @@ const { session } = await createAgentSession({
|
|
|
555
555
|
|
|
556
556
|
// New persistent session
|
|
557
557
|
const { session: persisted } = await createAgentSession({
|
|
558
|
-
sessionManager: SessionManager.create(process.cwd()),
|
|
558
|
+
sessionManager: await SessionManager.create(process.cwd()),
|
|
559
559
|
});
|
|
560
560
|
|
|
561
561
|
// Continue most recent
|
|
562
562
|
const { session: continued, modelFallbackMessage } = await createAgentSession({
|
|
563
|
-
sessionManager: SessionManager.continueRecent(process.cwd()),
|
|
563
|
+
sessionManager: await SessionManager.continueRecent(process.cwd()),
|
|
564
564
|
});
|
|
565
565
|
if (modelFallbackMessage) {
|
|
566
566
|
console.log("Note:", modelFallbackMessage);
|
|
@@ -568,7 +568,7 @@ if (modelFallbackMessage) {
|
|
|
568
568
|
|
|
569
569
|
// Open specific file
|
|
570
570
|
const { session: opened } = await createAgentSession({
|
|
571
|
-
sessionManager: SessionManager.open("/path/to/session.jsonl"),
|
|
571
|
+
sessionManager: await SessionManager.open("/path/to/session.jsonl"),
|
|
572
572
|
});
|
|
573
573
|
|
|
574
574
|
// List sessions
|
|
@@ -592,14 +592,14 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
|
|
|
592
592
|
const runtime = await createAgentSessionRuntime(createRuntime, {
|
|
593
593
|
cwd: process.cwd(),
|
|
594
594
|
agentDir: getAgentDir(),
|
|
595
|
-
sessionManager: SessionManager.create(process.cwd()),
|
|
595
|
+
sessionManager: await SessionManager.create(process.cwd()),
|
|
596
596
|
});
|
|
597
597
|
|
|
598
598
|
// Replace the active session with a fresh one
|
|
599
599
|
await runtime.newSession();
|
|
600
600
|
|
|
601
601
|
// Replace the active session with another saved session
|
|
602
|
-
await runtime.switchSession("
|
|
602
|
+
await runtime.switchSession("session-id");
|
|
603
603
|
|
|
604
604
|
// Replace the active session with a fork from a specific user entry
|
|
605
605
|
await runtime.fork("entry-id");
|
|
@@ -608,10 +608,12 @@ await runtime.fork("entry-id");
|
|
|
608
608
|
await runtime.fork("entry-id", { position: "at" });
|
|
609
609
|
```
|
|
610
610
|
|
|
611
|
+
`SessionManager.create()`, `open()`, `continueRecent()`, `forkFrom()`, and mutations are asynchronous. `SessionManager.inMemory()` returns an explicitly memory-backed manager synchronously. Await a mutation before reading its result or starting dependent work. A resolved write is committed; a failed write rejects with the store's typed error and leaves the failed entry unpublished. New persistent sessions store their header during creation and commit setup entries immediately. There is no `flush` method. Reads remain synchronous.
|
|
612
|
+
|
|
611
613
|
**SessionManager tree API:**
|
|
612
614
|
|
|
613
615
|
```typescript
|
|
614
|
-
const sm = SessionManager.open("/path/to/session.jsonl");
|
|
616
|
+
const sm = await SessionManager.open("/path/to/session.jsonl");
|
|
615
617
|
|
|
616
618
|
// Session listing
|
|
617
619
|
const currentProjectSessions = await SessionManager.list(process.cwd());
|
|
@@ -627,12 +629,12 @@ const children = sm.getChildren(id); // Direct children of entry
|
|
|
627
629
|
|
|
628
630
|
// Labels
|
|
629
631
|
const label = sm.getLabel(id); // Get label for entry
|
|
630
|
-
sm.appendLabelChange(id, "checkpoint"); // Set label
|
|
632
|
+
await sm.appendLabelChange(id, "checkpoint"); // Set label
|
|
631
633
|
|
|
632
634
|
// Branching
|
|
633
|
-
sm.branch(entryId); // Move leaf to earlier entry
|
|
634
|
-
sm.branchWithSummary(id, "Summary..."); // Branch with context summary
|
|
635
|
-
sm.createBranchedSession(leafId); // Extract path to new file
|
|
635
|
+
await sm.branch(entryId); // Move leaf to earlier entry
|
|
636
|
+
await sm.branchWithSummary(id, "Summary..."); // Branch with context summary
|
|
637
|
+
await sm.createBranchedSession(leafId); // Extract path to new file
|
|
636
638
|
```
|
|
637
639
|
|
|
638
640
|
> See [examples/sdk/11-sessions.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/sdk/11-sessions.ts) and [Session Format](/session-format)
|
|
@@ -770,7 +772,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
|
|
|
770
772
|
const runtime = await createAgentSessionRuntime(createRuntime, {
|
|
771
773
|
cwd: process.cwd(),
|
|
772
774
|
agentDir: getAgentDir(),
|
|
773
|
-
sessionManager: SessionManager.create(process.cwd()),
|
|
775
|
+
sessionManager: await SessionManager.create(process.cwd()),
|
|
774
776
|
});
|
|
775
777
|
|
|
776
778
|
const mode = new InteractiveMode(runtime, {
|
|
@@ -810,7 +812,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
|
|
|
810
812
|
const runtime = await createAgentSessionRuntime(createRuntime, {
|
|
811
813
|
cwd: process.cwd(),
|
|
812
814
|
agentDir: getAgentDir(),
|
|
813
|
-
sessionManager: SessionManager.create(process.cwd()),
|
|
815
|
+
sessionManager: await SessionManager.create(process.cwd()),
|
|
814
816
|
});
|
|
815
817
|
|
|
816
818
|
await runPrintMode(runtime, {
|
|
@@ -847,7 +849,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
|
|
|
847
849
|
const runtime = await createAgentSessionRuntime(createRuntime, {
|
|
848
850
|
cwd: process.cwd(),
|
|
849
851
|
agentDir: getAgentDir(),
|
|
850
|
-
sessionManager: SessionManager.create(process.cwd()),
|
|
852
|
+
sessionManager: await SessionManager.create(process.cwd()),
|
|
851
853
|
});
|
|
852
854
|
|
|
853
855
|
await runRpcMode(runtime);
|
package/docs/sdk/web-server.md
CHANGED
|
@@ -267,7 +267,7 @@ export async function POST(request: Request): Promise<Response> {
|
|
|
267
267
|
const result = await run(reviewWorkflow, { topic }, {
|
|
268
268
|
cwd: WORKSPACE,
|
|
269
269
|
signal: abort.signal,
|
|
270
|
-
|
|
270
|
+
journal: { memory: true },
|
|
271
271
|
adapters: {
|
|
272
272
|
agentSession: createAgentSessionAdapter({ cwd: WORKSPACE, tools: ["read", "find", "search"] }),
|
|
273
273
|
},
|
|
@@ -298,14 +298,13 @@ export async function POST(request: Request): Promise<Response> {
|
|
|
298
298
|
|
|
299
299
|
`onStageSessionEvent` receives every stage's session events tagged with its run and stage ids, including stages that switch to a fallback model and stages of nested workflows. Aborting `signal`, here when the client disconnects, cancels the run.
|
|
300
300
|
|
|
301
|
-
### Choose workflow
|
|
301
|
+
### Choose workflow storage
|
|
302
302
|
|
|
303
|
-
By default, `run()` persists workflow state in
|
|
303
|
+
By default, `run()` persists workflow state in the local SQLite journal at `~/.atomic/workflows/journal.sqlite`. Keep it on durable local storage when your service needs restart recovery.
|
|
304
304
|
|
|
305
|
-
|
|
306
|
-
- **`durability: { mode: "memory" }`** explicitly keeps state for this call only and cannot resume after process exit. Use it only when that lifetime is intentional.
|
|
305
|
+
Use `journal: { path: "/var/lib/my-service/workflows.sqlite" }` to select a file for a run, or `journal: { memory: true }` for process-local state that cannot survive a restart. A caller-owned `node:sqlite` connection can be supplied as `{ database }`; Atomic does not close it. You can also supply a `RunJournal` instance.
|
|
307
306
|
|
|
308
|
-
|
|
307
|
+
`RunOpts.journal` overrides a non-empty `ATOMIC_WORKFLOW_JOURNAL_PATH`, which overrides `workflows.journal.path` or `workflows.journal.memory` in settings. Relative settings paths resolve against the Atomic home directory. Journal open or write failures stop the run instead of switching to memory. See [Choosing the durable backend](/workflows/api-reference#choosing-the-durable-backend).
|
|
309
308
|
|
|
310
309
|
## Secure the endpoint
|
|
311
310
|
|