@bastani/atomic 0.9.38-alpha.5 → 0.9.38-alpha.7
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 +70 -0
- package/README.md +8 -6
- package/dist/builtin/intercom/CHANGELOG.md +9 -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 +78 -33
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +140 -145
- 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 +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +48 -0
- package/dist/builtin/workflows/builtin/{chunk-q7dx7kh7.js → chunk-85mx6wcf.js} +6 -6
- package/dist/builtin/workflows/builtin/{chunk-xg7kkgf8.js → chunk-8kkv04hz.js} +15 -15
- package/dist/builtin/workflows/builtin/{chunk-na3wpwzh.js → chunk-8x61e0s7.js} +396 -363
- package/dist/builtin/workflows/builtin/{chunk-qrrkfg9v.js → chunk-y45tkftg.js} +7 -7
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +4 -4
- package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- 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 +1 -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 +9 -1
- package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +19 -8
- 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 +9 -114
- package/dist/builtin/workflows/src/durable/journal/values.d.ts +2 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +6963 -6181
- package/dist/builtin/workflows/src/index.js +9078 -8395
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +8 -8
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +0 -14
- package/dist/cli/args.d.ts +3 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +35 -5
- 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 +5 -5
- 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 +26 -14
- 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 +7 -8
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +88 -100
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -2
- package/dist/core/agent-session-services.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/compaction/branch-summarization.d.ts +1 -4
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +0 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.js +1 -3
- package/dist/core/compaction/pi-summary-fallback.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 +10 -3
- 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/model-config.d.ts +765 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +46 -24
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/provider-attribution.js +1 -1
- package/dist/core/provider-attribution.js.map +1 -1
- package/dist/core/resource-loader-reload.js +1 -1
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +1 -1
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/sdk-types.d.ts +4 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +50 -20
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-lifecycle-work.d.ts +3 -0
- package/dist/core/session-lifecycle-work.d.ts.map +1 -1
- package/dist/core/session-lifecycle-work.js +2 -0
- package/dist/core/session-lifecycle-work.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 +53 -51
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +547 -307
- 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 +21 -14
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-storage.d.ts +3 -13
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-storage.js +28 -69
- package/dist/core/session-manager-storage.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +3 -11
- 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 +2 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +2 -1
- 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/session-resume-args.d.ts +4 -0
- package/dist/core/session-resume-args.d.ts.map +1 -0
- package/dist/core/session-resume-args.js +9 -0
- package/dist/core/session-resume-args.js.map +1 -0
- package/dist/core/session-storage.d.ts +26 -0
- package/dist/core/session-storage.d.ts.map +1 -0
- package/dist/core/session-storage.js +155 -0
- package/dist/core/session-storage.js.map +1 -0
- package/dist/core/session-store-list.d.ts +4 -0
- package/dist/core/session-store-list.d.ts.map +1 -0
- package/dist/core/session-store-list.js +28 -0
- package/dist/core/session-store-list.js.map +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts +0 -1
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +0 -5
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-merge.d.ts.map +1 -1
- package/dist/core/settings-merge.js +8 -2
- package/dist/core/settings-merge.js.map +1 -1
- package/dist/core/settings-schema.d.ts +74 -8
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +29 -29
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/storage/errors.d.ts +1 -0
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/storage/index.d.ts +5 -1
- package/dist/core/storage/index.d.ts.map +1 -1
- package/dist/core/storage/index.js +4 -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/provider.d.ts +58 -0
- package/dist/core/storage/provider.d.ts.map +1 -0
- package/dist/core/storage/provider.js +243 -0
- package/dist/core/storage/provider.js.map +1 -0
- package/dist/core/storage/run-journal.d.ts +93 -0
- package/dist/core/storage/run-journal.d.ts.map +1 -0
- package/dist/core/storage/run-journal.js +15 -0
- package/dist/core/storage/run-journal.js.map +1 -0
- package/dist/core/storage/selection.d.ts +16 -0
- package/dist/core/storage/selection.d.ts.map +1 -0
- package/dist/core/storage/selection.js +87 -0
- package/dist/core/storage/selection.js.map +1 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts +11 -2
- package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.js +127 -54
- package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
- package/dist/core/storage/session/legacy-format.d.ts +18 -0
- package/dist/core/storage/session/legacy-format.d.ts.map +1 -0
- package/dist/core/storage/session/legacy-format.js +63 -0
- package/dist/core/storage/session/legacy-format.js.map +1 -0
- package/dist/core/storage/session/memory-session-store.d.ts +3 -1
- package/dist/core/storage/session/memory-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/memory-session-store.js +9 -2
- package/dist/core/storage/session/memory-session-store.js.map +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts +4 -1
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/sql-session-store.js +25 -6
- package/dist/core/storage/session/sql-session-store.js.map +1 -1
- package/dist/core/storage/session/types.d.ts +4 -0
- package/dist/core/storage/session/types.d.ts.map +1 -1
- package/dist/core/storage/session/types.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/read-url.d.ts.map +1 -1
- package/dist/core/tools/read-url.js +6 -1
- package/dist/core/tools/read-url.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.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +14 -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 +6 -8
- 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 +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +12 -2
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +148 -53
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +97 -42
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +3 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +16 -7
- 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-delete.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts +12 -9
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +27 -25
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +8 -4
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +27 -18
- 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.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +7 -3
- 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 +38 -14
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +5 -3
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.js +8 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-args.js +11 -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 +99 -74
- 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 +20 -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 +12 -9
- 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-terminal-drain.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-terminal-drain.js +11 -2
- package/dist/modes/rpc/rpc-terminal-drain.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/dist/utils/canonical-path.d.ts +5 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +26 -0
- package/dist/utils/canonical-path.js.map +1 -0
- package/dist/utils/paths.d.ts +1 -7
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +1 -15
- package/dist/utils/paths.js.map +1 -1
- package/docs/codemode.md +2 -0
- package/docs/compaction.md +2 -2
- 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/docs.json +1 -0
- package/docs/environment-variables.md +10 -2
- 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/models/reference.md +2 -0
- package/docs/models-configuration.md +206 -0
- package/docs/models.md +11 -1
- package/docs/providers.md +4 -4
- package/docs/quickstart.md +2 -1
- package/docs/reference/cli.md +7 -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 +56 -2
- package/docs/session-format.md +35 -28
- package/docs/sessions.md +50 -17
- package/docs/settings.md +44 -7
- package/docs/storage.md +346 -2
- package/docs/usage.md +3 -2
- package/docs/workflows/api-reference.md +80 -16
- package/docs/workflows/operations.md +6 -4
- package/docs/workflows/reliable-design.md +16 -16
- 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 +53 -53
- package/package.json +7 -6
- package/schemas/models.schema.json +62 -29
- package/schemas/settings.schema.json +137 -53
- package/dist/builtin/workflows/builtin/chunk-h5fn47y5.js +0 -8
- package/dist/builtin/workflows/src/durable/journal/node-sqlite.d.ts +0 -20
|
@@ -529,7 +529,7 @@ Ordinary `intercom` is enabled by default but respects `tools`, `excludedTools`,
|
|
|
529
529
|
- Persist decisions under stable keys. Pause/resume, model fallback, durable replay, and nested workflows then reread the artifact instead of sending duplicate interventions.
|
|
530
530
|
- Omit `group` for ordinary use. The worker, guard, nested workflows, and delegated subagents inherit the top-level workflow invocation's stable Intercom group. Set an explicit group only for intentional isolation; an override isolates that stage from ordinary same-group peers while leaving it steerable from the invocation context, which retains directional list/send/live-ask control over the subgroups it owns.
|
|
531
531
|
- Use `context: "fresh"` for guards, reviewers, and judges. They should see only the contract, candidate, decision artifacts, and current files.
|
|
532
|
-
- Use `context: "fork"` plus `
|
|
532
|
+
- Use `context: "fork"` plus `forkFromSessionId` for implementation, debugging, and repair roles that need continuity with an owned earlier session. `context: "fork"` alone does not name a fork source; an initial worker with no prior lineage may start fresh. A later continuation should use the earlier worker's `sessionId` in the selected session store when available. Do not fork an independent guard from the worker it judges.
|
|
533
533
|
- Send a forked continuation only the delta after the fork point: new evidence, the decision artifact, any human answer, and the next action. Keep the full shared contract in its canonical file.
|
|
534
534
|
|
|
535
535
|
Expected lifecycle state is not a defect. If the contract says `candidate → validation → approval → push/publish`, a guard at the candidate or validation boundary must not reject the patch merely because it is unpushed or unpublished. Only the later publication stage owns that action.
|
|
@@ -568,10 +568,10 @@ const decisionLogSchema = Type.Object(
|
|
|
568
568
|
|
|
569
569
|
type DecisionLog = Static<typeof decisionLogSchema>;
|
|
570
570
|
|
|
571
|
-
function continueWorker(
|
|
572
|
-
return
|
|
571
|
+
function continueWorker(sessionId: string | undefined) {
|
|
572
|
+
return sessionId === undefined
|
|
573
573
|
? { context: "fork" as const }
|
|
574
|
-
: { context: "fork" as const,
|
|
574
|
+
: { context: "fork" as const, forkFromSessionId: sessionId };
|
|
575
575
|
}
|
|
576
576
|
|
|
577
577
|
export default workflow({
|
|
@@ -627,7 +627,7 @@ export default workflow({
|
|
|
627
627
|
].join("\n"));
|
|
628
628
|
|
|
629
629
|
await ctx.task("continue worker", {
|
|
630
|
-
...continueWorker(worker.
|
|
630
|
+
...continueWorker(worker.sessionId),
|
|
631
631
|
reads: [contract, decisionLog],
|
|
632
632
|
prompt: [
|
|
633
633
|
`Read the decision log at ${decisionLog}.`,
|
|
@@ -653,10 +653,10 @@ Use `ctx.stage(...)` when one independent checker needs a retained conversation.
|
|
|
653
653
|
import { workflow } from "@bastani/atomic/workflows";
|
|
654
654
|
import { Type } from "typebox";
|
|
655
655
|
|
|
656
|
-
function continueWorker(
|
|
657
|
-
return
|
|
656
|
+
function continueWorker(sessionId: string | undefined) {
|
|
657
|
+
return sessionId === undefined
|
|
658
658
|
? { context: "fork" as const }
|
|
659
|
-
: { context: "fork" as const,
|
|
659
|
+
: { context: "fork" as const, forkFromSessionId: sessionId };
|
|
660
660
|
}
|
|
661
661
|
|
|
662
662
|
export default workflow({
|
|
@@ -703,7 +703,7 @@ export default workflow({
|
|
|
703
703
|
);
|
|
704
704
|
|
|
705
705
|
await ctx.task("apply retained decision", {
|
|
706
|
-
...continueWorker(worker.
|
|
706
|
+
...continueWorker(worker.sessionId),
|
|
707
707
|
reads: [contract, decisionLog],
|
|
708
708
|
prompt: [
|
|
709
709
|
`Read ${decisionLog}.`,
|
|
@@ -742,10 +742,10 @@ const coordinationSchema = Type.Object(
|
|
|
742
742
|
|
|
743
743
|
type Coordination = Static<typeof coordinationSchema>;
|
|
744
744
|
|
|
745
|
-
function workerContext(
|
|
746
|
-
return
|
|
745
|
+
function workerContext(sessionId: string | undefined) {
|
|
746
|
+
return sessionId === undefined
|
|
747
747
|
? { context: "fresh" as const }
|
|
748
|
-
: { context: "fork" as const,
|
|
748
|
+
: { context: "fork" as const, forkFromSessionId: sessionId };
|
|
749
749
|
}
|
|
750
750
|
|
|
751
751
|
export default workflow({
|
|
@@ -753,7 +753,7 @@ export default workflow({
|
|
|
753
753
|
description: "Run a worker with a live same-group scope peer.",
|
|
754
754
|
inputs: {
|
|
755
755
|
scope_contract: Type.String(),
|
|
756
|
-
|
|
756
|
+
worker_session_id: Type.Optional(Type.String({
|
|
757
757
|
description: "Earlier worker session to continue; omit when no worker lineage exists.",
|
|
758
758
|
})),
|
|
759
759
|
fallback_policy: Type.Union([
|
|
@@ -778,7 +778,7 @@ export default workflow({
|
|
|
778
778
|
[
|
|
779
779
|
{
|
|
780
780
|
name: "worker",
|
|
781
|
-
...workerContext(ctx.inputs.
|
|
781
|
+
...workerContext(ctx.inputs.worker_session_id),
|
|
782
782
|
reads: [contract],
|
|
783
783
|
prompt: [
|
|
784
784
|
`Read the immutable scope contract at ${contract}.`,
|
|
@@ -910,11 +910,11 @@ State important constraints once. Reserve absolute wording for safety, required
|
|
|
910
910
|
|
|
911
911
|
Avoid unrelated workflow internals such as reducer algorithms, future PR stages, sibling reviewer names, loop implementation details, or project-specific nicknames unless they are explicitly part of the current stage contract. If a term such as a gate name, ledger field, or workflow nickname is necessary, define it in the prompt before using it.
|
|
912
912
|
|
|
913
|
-
Choose context mode deliberately. Use `context: "fork"` or `
|
|
913
|
+
Choose context mode deliberately. Use `context: "fork"` or `forkFromSessionId` for coherent long-running implementation stages that need continuity from their own earlier work. Use `context: "fresh"` for unbiased reviewer, evaluator, and gate stages so they inspect the current files and explicit artifacts rather than inheriting the implementer's assumptions. When continuity is needed across fresh stages, pass it explicitly through files, declared outputs, and `reads`.
|
|
914
914
|
|
|
915
915
|
### Context-Mode-Aware Prompt Text
|
|
916
916
|
|
|
917
|
-
Context mode is an execution property configured with `context`/`
|
|
917
|
+
Context mode is an execution property configured with `context`/`forkFromSessionId`; the model cannot act on context mode, so keep it out of prompt text:
|
|
918
918
|
|
|
919
919
|
- **Never describe the stage's own context mode.** Sentences like "you are running in a fresh context window", "your context is clean/non-forked", or "this is a forked session" add tokens without changing behavior. State the concrete action, inputs, and success criteria instead.
|
|
920
920
|
- **Fresh stages must not reference invisible context.** A fresh stage has no "previous conversation", cannot see sibling stages' transcripts, and does not know the surrounding graph, so instructions like "compare against previous workflow reasoning" or "this runs in parallel with the locator pass" do not help and may confuse the model. Phrase the same intent stage-locally ("compare the working tree against the baseline branch"; "do your own scan; do not assume any other stage's output is available") and pass any state the stage needs through files, declared outputs, and `reads`. If a stage should talk to a live peer, say so explicitly and tell it how to find that peer with `intercom list`; see [peer coordination between stages](#peer-coordination-between-stages).
|
|
@@ -20,7 +20,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
20
20
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
21
21
|
const entry = entries[i];
|
|
22
22
|
if (entry.type === "message" && entry.message.role === "assistant") {
|
|
23
|
-
pi.setLabel(entry.id, label);
|
|
23
|
+
await pi.setLabel(entry.id, label);
|
|
24
24
|
ctx.ui.notify(`Bookmarked as: ${label}`, "info");
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -39,7 +39,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
39
39
|
const entry = entries[i];
|
|
40
40
|
const label = ctx.sessionManager.getLabel(entry.id);
|
|
41
41
|
if (label) {
|
|
42
|
-
pi.setLabel(entry.id, undefined);
|
|
42
|
+
await pi.setLabel(entry.id, undefined);
|
|
43
43
|
ctx.ui.notify(`Removed bookmark: ${label}`, "info");
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
@@ -71,7 +71,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
71
71
|
// Convert to LLM format and serialize
|
|
72
72
|
const llmMessages = convertToLlm(messages);
|
|
73
73
|
const conversationText = serializeConversation(llmMessages);
|
|
74
|
-
const
|
|
74
|
+
const currentSessionId = ctx.sessionManager.getSessionId();
|
|
75
75
|
|
|
76
76
|
// Generate the handoff prompt with loader UI
|
|
77
77
|
const result = await ctx.ui.custom<string | null>((tui, theme, _kb, done) => {
|
|
@@ -144,7 +144,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
144
144
|
// context for post-switch UI work; the original ctx is stale after a
|
|
145
145
|
// successful session replacement.
|
|
146
146
|
const newSessionResult = await ctx.newSession({
|
|
147
|
-
parentSession:
|
|
147
|
+
parentSession: currentSessionId,
|
|
148
148
|
withSession: async (replacementCtx) => {
|
|
149
149
|
replacementCtx.ui.setEditorText(editedPrompt);
|
|
150
150
|
replacementCtx.ui.notify("Handoff ready. Submit when ready.", "info");
|
|
@@ -88,11 +88,11 @@ export default function planModeExtension(pi: ExtensionAPI): void {
|
|
|
88
88
|
updateStatus(ctx);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
function persistState(): void {
|
|
92
|
-
pi.appendEntry("plan-mode", {
|
|
91
|
+
async function persistState(todos: TodoItem[], executing = executionMode): Promise<void> {
|
|
92
|
+
await pi.appendEntry("plan-mode", {
|
|
93
93
|
enabled: planModeEnabled,
|
|
94
|
-
todos
|
|
95
|
-
executing
|
|
94
|
+
todos,
|
|
95
|
+
executing,
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -210,10 +210,11 @@ After completing a step, include a [DONE:n] tag in your response.`,
|
|
|
210
210
|
if (!isAssistantMessage(event.message)) return;
|
|
211
211
|
|
|
212
212
|
const text = getTextContent(event.message);
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
const nextTodos = todoItems.map((item) => ({ ...item }));
|
|
214
|
+
const changed = markCompletedSteps(text, nextTodos);
|
|
215
|
+
await persistState(nextTodos);
|
|
216
|
+
todoItems = nextTodos;
|
|
217
|
+
if (changed > 0) updateStatus(ctx);
|
|
217
218
|
});
|
|
218
219
|
|
|
219
220
|
// Handle plan completion and plan mode UI
|
|
@@ -222,15 +223,16 @@ After completing a step, include a [DONE:n] tag in your response.`,
|
|
|
222
223
|
if (executionMode && todoItems.length > 0) {
|
|
223
224
|
if (todoItems.every((t) => t.completed)) {
|
|
224
225
|
const completedList = todoItems.map((t) => `~~${t.text}~~`).join("\n");
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
{ triggerTurn: false },
|
|
228
|
-
);
|
|
226
|
+
// Commit the cleared state before publishing completion, so a failure can be retried.
|
|
227
|
+
await persistState([], false);
|
|
229
228
|
executionMode = false;
|
|
230
229
|
todoItems = [];
|
|
231
230
|
pi.setActiveTools(NORMAL_MODE_TOOLS);
|
|
232
231
|
updateStatus(ctx);
|
|
233
|
-
|
|
232
|
+
await pi.sendMessage(
|
|
233
|
+
{ customType: "plan-complete", content: `**Plan Complete!** ✓\n\n${completedList}`, display: true },
|
|
234
|
+
{ triggerTurn: false },
|
|
235
|
+
);
|
|
234
236
|
}
|
|
235
237
|
return;
|
|
236
238
|
}
|
|
@@ -146,7 +146,7 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
146
146
|
|
|
147
147
|
// Apply thinking level if specified
|
|
148
148
|
if (preset.thinkingLevel) {
|
|
149
|
-
pi.setThinkingLevel(preset.thinkingLevel);
|
|
149
|
+
await pi.setThinkingLevel(preset.thinkingLevel);
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// Apply tools if specified
|
|
@@ -271,17 +271,17 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
271
271
|
|
|
272
272
|
if (result === "(none)") {
|
|
273
273
|
// Clear preset and restore original state
|
|
274
|
-
activePresetName = undefined;
|
|
275
|
-
activePreset = undefined;
|
|
276
274
|
if (originalState) {
|
|
277
275
|
if (originalState.model) {
|
|
278
276
|
await pi.setModel(originalState.model);
|
|
279
277
|
}
|
|
280
|
-
pi.setThinkingLevel(originalState.thinkingLevel);
|
|
278
|
+
await pi.setThinkingLevel(originalState.thinkingLevel);
|
|
281
279
|
pi.setActiveTools(originalState.tools);
|
|
282
280
|
} else {
|
|
283
281
|
pi.setActiveTools(["read", "bash", "edit", "write"]);
|
|
284
282
|
}
|
|
283
|
+
activePresetName = undefined;
|
|
284
|
+
activePreset = undefined;
|
|
285
285
|
ctx.ui.notify("Preset cleared, defaults restored", "info");
|
|
286
286
|
updateStatus(ctx);
|
|
287
287
|
return;
|
|
@@ -327,17 +327,17 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
327
327
|
const nextName = cycleList[nextIndex];
|
|
328
328
|
|
|
329
329
|
if (nextName === "(none)") {
|
|
330
|
-
activePresetName = undefined;
|
|
331
|
-
activePreset = undefined;
|
|
332
330
|
if (originalState) {
|
|
333
331
|
if (originalState.model) {
|
|
334
332
|
await pi.setModel(originalState.model);
|
|
335
333
|
}
|
|
336
|
-
pi.setThinkingLevel(originalState.thinkingLevel);
|
|
334
|
+
await pi.setThinkingLevel(originalState.thinkingLevel);
|
|
337
335
|
pi.setActiveTools(originalState.tools);
|
|
338
336
|
} else {
|
|
339
337
|
pi.setActiveTools(["read", "bash", "edit", "write"]);
|
|
340
338
|
}
|
|
339
|
+
activePresetName = undefined;
|
|
340
|
+
activePreset = undefined;
|
|
341
341
|
ctx.ui.notify("Preset cleared, defaults restored", "info");
|
|
342
342
|
updateStatus(ctx);
|
|
343
343
|
return;
|
|
@@ -432,7 +432,7 @@ export default function presetExtension(pi: ExtensionAPI) {
|
|
|
432
432
|
// Persist preset state
|
|
433
433
|
pi.on("turn_start", async () => {
|
|
434
434
|
if (activePresetName) {
|
|
435
|
-
pi.appendEntry("preset-state", { name: activePresetName });
|
|
435
|
+
await pi.appendEntry("preset-state", { name: activePresetName });
|
|
436
436
|
}
|
|
437
437
|
});
|
|
438
438
|
}
|
|
@@ -333,7 +333,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
333
333
|
() => done(undefined),
|
|
334
334
|
(state) => {
|
|
335
335
|
// Save or clear state
|
|
336
|
-
pi
|
|
336
|
+
void pi
|
|
337
|
+
.appendEntry(SNAKE_SAVE_TYPE, state)
|
|
338
|
+
.catch((error: Error) => ctx.ui.notify(error.message, "error"));
|
|
337
339
|
},
|
|
338
340
|
savedState,
|
|
339
341
|
);
|
|
@@ -490,7 +490,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
490
490
|
tui,
|
|
491
491
|
() => done(undefined),
|
|
492
492
|
(state) => {
|
|
493
|
-
pi
|
|
493
|
+
void pi
|
|
494
|
+
.appendEntry(INVADERS_SAVE_TYPE, state)
|
|
495
|
+
.catch((error: Error) => ctx.ui.notify(error.message, "error"));
|
|
494
496
|
},
|
|
495
497
|
savedState,
|
|
496
498
|
);
|
|
@@ -79,20 +79,20 @@ function getBoardDetails(): BoardDetails {
|
|
|
79
79
|
return toBoardDetails(gameState);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
function applyCursorMove(action: Exclude<Action, "play">): string {
|
|
82
|
+
function applyCursorMove(state: GameState, action: Exclude<Action, "play">): string {
|
|
83
83
|
switch (action) {
|
|
84
84
|
case "move_up":
|
|
85
|
-
if (
|
|
86
|
-
return `Moved up. Cursor: (${
|
|
85
|
+
if (state.agentCursorRow > 0) state.agentCursorRow--;
|
|
86
|
+
return `Moved up. Cursor: (${state.agentCursorRow}, ${state.agentCursorCol})`;
|
|
87
87
|
case "move_down":
|
|
88
|
-
if (
|
|
89
|
-
return `Moved down. Cursor: (${
|
|
88
|
+
if (state.agentCursorRow < 2) state.agentCursorRow++;
|
|
89
|
+
return `Moved down. Cursor: (${state.agentCursorRow}, ${state.agentCursorCol})`;
|
|
90
90
|
case "move_left":
|
|
91
|
-
if (
|
|
92
|
-
return `Moved left. Cursor: (${
|
|
91
|
+
if (state.agentCursorCol > 0) state.agentCursorCol--;
|
|
92
|
+
return `Moved left. Cursor: (${state.agentCursorRow}, ${state.agentCursorCol})`;
|
|
93
93
|
case "move_right":
|
|
94
|
-
if (
|
|
95
|
-
return `Moved right. Cursor: (${
|
|
94
|
+
if (state.agentCursorCol < 2) state.agentCursorCol++;
|
|
95
|
+
return `Moved right. Cursor: (${state.agentCursorRow}, ${state.agentCursorCol})`;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -103,7 +103,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
103
103
|
// Sent once per game at end-of-game. The custom renderer paints the banner;
|
|
104
104
|
// `content` is a plain-text fallback for any non-TUI consumer and for the
|
|
105
105
|
// LLM (in case the message ends up in future context).
|
|
106
|
-
const emitGameOverMessage = (): void => {
|
|
106
|
+
const emitGameOverMessage = async (): Promise<void> => {
|
|
107
107
|
const label =
|
|
108
108
|
gameState.status === "win_X"
|
|
109
109
|
? "Player X (human) wins"
|
|
@@ -112,7 +112,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
112
112
|
: gameState.status === "draw"
|
|
113
113
|
? "Draw"
|
|
114
114
|
: "Game over";
|
|
115
|
-
pi.sendMessage({
|
|
115
|
+
await pi.sendMessage({
|
|
116
116
|
customType: GAME_OVER_MESSAGE_TYPE,
|
|
117
117
|
content: `Game over: ${label}.`,
|
|
118
118
|
display: true,
|
|
@@ -154,8 +154,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
154
154
|
if (gameState.status !== "playing") {
|
|
155
155
|
gameState = createInitialState();
|
|
156
156
|
}
|
|
157
|
+
await pi.setSessionName("Tic-Tac-Toe");
|
|
157
158
|
gameActive = true;
|
|
158
|
-
|
|
159
|
+
let userMovePending = false;
|
|
159
160
|
|
|
160
161
|
await ctx.ui.custom<void>((tui, _theme, _kb, done) => {
|
|
161
162
|
component = new TicTacToeComponent(
|
|
@@ -166,40 +167,48 @@ export default function (pi: ExtensionAPI) {
|
|
|
166
167
|
done(undefined);
|
|
167
168
|
},
|
|
168
169
|
(row, col) => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
170
|
+
if (userMovePending) return;
|
|
171
|
+
userMovePending = true;
|
|
172
|
+
void (async () => {
|
|
173
|
+
const nextState = { ...gameState, board: gameState.board.map((row) => [...row]) };
|
|
174
|
+
nextState.board[row][col] = nextState.userMark;
|
|
175
|
+
nextState.status = checkWin(nextState.board);
|
|
176
|
+
if (nextState.status === "playing") nextState.currentTurn = nextState.agentMark;
|
|
177
|
+
await pi.appendEntry(SAVE_TYPE, toBoardDetails(nextState));
|
|
178
|
+
gameState = nextState;
|
|
179
|
+
component?.updateState(gameState);
|
|
180
|
+
|
|
181
|
+
if (gameState.status === "playing") {
|
|
182
|
+
// IMPORTANT: user play does NOT touch the agent cursor.
|
|
183
|
+
// The agent cursor is only reset after a successful agent play.
|
|
184
|
+
const boardAscii = boardToAscii(
|
|
185
|
+
gameState.board,
|
|
186
|
+
gameState.agentCursorRow,
|
|
187
|
+
gameState.agentCursorCol,
|
|
188
|
+
);
|
|
189
|
+
await pi.sendMessage(
|
|
190
|
+
{
|
|
191
|
+
customType: MOVE_MESSAGE_TYPE,
|
|
192
|
+
content:
|
|
193
|
+
`Player X played at (row=${row}, col=${col}). It is now Player O's turn.\n\n` +
|
|
194
|
+
`Board (your cursor marked with <>):\n${boardAscii}\n\n` +
|
|
195
|
+
`Your cursor is at (row=${gameState.agentCursorRow}, col=${gameState.agentCursorCol}). ` +
|
|
196
|
+
`Decide your target cell, then emit every move_* and the final play ` +
|
|
197
|
+
`as separate tic_tac_toe tool calls in THIS response.`,
|
|
198
|
+
display: true,
|
|
199
|
+
details: getBoardDetails(),
|
|
200
|
+
},
|
|
201
|
+
{ triggerTurn: true },
|
|
202
|
+
);
|
|
203
|
+
} else {
|
|
204
|
+
await emitGameOverMessage();
|
|
205
|
+
gameActive = false;
|
|
206
|
+
}
|
|
207
|
+
})()
|
|
208
|
+
.catch((error: Error) => ctx.ui.notify(error.message, "error"))
|
|
209
|
+
.finally(() => {
|
|
210
|
+
userMovePending = false;
|
|
211
|
+
});
|
|
203
212
|
},
|
|
204
213
|
gameState,
|
|
205
214
|
);
|
|
@@ -230,15 +239,16 @@ export default function (pi: ExtensionAPI) {
|
|
|
230
239
|
const actionDelay = ACTION_DELAYS[params.action];
|
|
231
240
|
if (actionDelay > 0) await delay(actionDelay);
|
|
232
241
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
|
|
242
|
+
const nextState = { ...gameState, board: gameState.board.map((row) => [...row]) };
|
|
243
|
+
const result =
|
|
244
|
+
params.action === "play" ? handleAgentPlay(nextState) : applyCursorMove(nextState, params.action);
|
|
245
|
+
await pi.appendEntry(SAVE_TYPE, toBoardDetails(nextState));
|
|
246
|
+
gameState = nextState;
|
|
240
247
|
component?.updateState(gameState);
|
|
241
|
-
|
|
248
|
+
if (params.action === "play" && gameState.status !== "playing") {
|
|
249
|
+
gameActive = false;
|
|
250
|
+
await emitGameOverMessage();
|
|
251
|
+
}
|
|
242
252
|
|
|
243
253
|
return {
|
|
244
254
|
content: [{ type: "text", text: result }],
|
|
@@ -303,43 +313,33 @@ export default function (pi: ExtensionAPI) {
|
|
|
303
313
|
});
|
|
304
314
|
}
|
|
305
315
|
|
|
306
|
-
function handleAgentPlay(
|
|
307
|
-
if (
|
|
308
|
-
throw new TicTacToeError(`Game is over (${
|
|
316
|
+
function handleAgentPlay(state: GameState): string {
|
|
317
|
+
if (state.status !== "playing") {
|
|
318
|
+
throw new TicTacToeError(`Game is over (${state.status}).`);
|
|
309
319
|
}
|
|
310
|
-
if (
|
|
320
|
+
if (state.currentTurn !== state.agentMark) {
|
|
311
321
|
throw new TicTacToeError("It is not your turn.");
|
|
312
322
|
}
|
|
313
|
-
const r =
|
|
314
|
-
const c =
|
|
315
|
-
if (
|
|
323
|
+
const r = state.agentCursorRow;
|
|
324
|
+
const c = state.agentCursorCol;
|
|
325
|
+
if (state.board[r][c] !== " ") {
|
|
316
326
|
// Do NOT reset the cursor on failure. The agent can retry
|
|
317
327
|
// from the cursor's current position.
|
|
318
|
-
component?.updateState(gameState);
|
|
319
|
-
appendSave();
|
|
320
328
|
throw new TicTacToeError(
|
|
321
|
-
`Cell (${r},${c}) is already ${
|
|
329
|
+
`Cell (${r},${c}) is already ${state.board[r][c]}. Your cursor is still at (${r},${c}). Move to an empty cell and retry play.`,
|
|
322
330
|
);
|
|
323
331
|
}
|
|
324
332
|
|
|
325
|
-
|
|
326
|
-
|
|
333
|
+
state.board[r][c] = state.agentMark;
|
|
334
|
+
state.status = checkWin(state.board);
|
|
327
335
|
// Reset agent cursor to home ONLY on successful play.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (
|
|
331
|
-
|
|
336
|
+
state.agentCursorRow = AGENT_CURSOR_HOME_ROW;
|
|
337
|
+
state.agentCursorCol = AGENT_CURSOR_HOME_COL;
|
|
338
|
+
if (state.status === "playing") {
|
|
339
|
+
state.currentTurn = state.userMark;
|
|
332
340
|
return `Placed O at (${r},${c}). Cursor reset to (${AGENT_CURSOR_HOME_ROW},${AGENT_CURSOR_HOME_COL}). Your turn, X!`;
|
|
333
341
|
}
|
|
334
|
-
if (
|
|
335
|
-
|
|
336
|
-
emitGameOverMessage();
|
|
337
|
-
return `Placed O at (${r},${c}). Player O wins!`;
|
|
338
|
-
}
|
|
339
|
-
if (gameState.status === "draw") {
|
|
340
|
-
gameActive = false;
|
|
341
|
-
emitGameOverMessage();
|
|
342
|
-
return `Placed O at (${r},${c}). It's a draw!`;
|
|
343
|
-
}
|
|
342
|
+
if (state.status === "win_O") return `Placed O at (${r},${c}). Player O wins!`;
|
|
343
|
+
if (state.status === "draw") return `Placed O at (${r},${c}). It's a draw!`;
|
|
344
344
|
return `Placed O at (${r},${c}).`;
|
|
345
345
|
}
|
|
@@ -15,14 +15,14 @@ inMemory.dispose();
|
|
|
15
15
|
|
|
16
16
|
// New persistent session
|
|
17
17
|
const { session: newSession } = await createAgentSession({
|
|
18
|
-
sessionManager: SessionManager.create(process.cwd()),
|
|
18
|
+
sessionManager: await SessionManager.create(process.cwd()),
|
|
19
19
|
});
|
|
20
20
|
console.log("New session file:", newSession.sessionFile);
|
|
21
21
|
newSession.dispose();
|
|
22
22
|
|
|
23
23
|
// Continue most recent session (or create new if none)
|
|
24
24
|
const { session: continued, modelFallbackMessage } = await createAgentSession({
|
|
25
|
-
sessionManager: SessionManager.continueRecent(process.cwd()),
|
|
25
|
+
sessionManager: await SessionManager.continueRecent(process.cwd()),
|
|
26
26
|
});
|
|
27
27
|
if (modelFallbackMessage) console.log("Note:", modelFallbackMessage);
|
|
28
28
|
console.log("Continued session:", continued.sessionFile);
|
|
@@ -37,7 +37,7 @@ for (const info of sessions.slice(0, 3)) {
|
|
|
37
37
|
|
|
38
38
|
if (sessions.length > 0) {
|
|
39
39
|
const { session: opened } = await createAgentSession({
|
|
40
|
-
sessionManager: SessionManager.open(sessions[0].path),
|
|
40
|
+
sessionManager: await SessionManager.open(sessions[0].path),
|
|
41
41
|
});
|
|
42
42
|
console.log(`\nOpened: ${opened.sessionId}`);
|
|
43
43
|
opened.dispose();
|
|
@@ -46,7 +46,7 @@ if (sessions.length > 0) {
|
|
|
46
46
|
// Custom session directory (no cwd encoding)
|
|
47
47
|
// const customDir = "/path/to/my-sessions";
|
|
48
48
|
// const { session } = await createAgentSession({
|
|
49
|
-
// sessionManager: SessionManager.create(process.cwd(), customDir),
|
|
49
|
+
// sessionManager: await SessionManager.create(process.cwd(), customDir),
|
|
50
50
|
// });
|
|
51
51
|
// SessionManager.list(process.cwd(), customDir);
|
|
52
|
-
// SessionManager.continueRecent(process.cwd(), customDir);
|
|
52
|
+
// await SessionManager.continueRecent(process.cwd(), customDir);
|
|
@@ -32,7 +32,7 @@ const createRuntime: CreateAgentSessionRuntimeFactory = async ({ cwd, sessionMan
|
|
|
32
32
|
const runtime = await createAgentSessionRuntime(createRuntime, {
|
|
33
33
|
cwd: process.cwd(),
|
|
34
34
|
agentDir: getAgentDir(),
|
|
35
|
-
sessionManager: SessionManager.create(process.cwd()),
|
|
35
|
+
sessionManager: await SessionManager.create(process.cwd()),
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
let unsubscribe: (() => void) | undefined;
|
|
@@ -50,17 +50,17 @@ async function bindSession() {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
let session = await bindSession();
|
|
53
|
-
const
|
|
54
|
-
console.log("Initial session:",
|
|
53
|
+
const originalSessionId = session.sessionId;
|
|
54
|
+
console.log("Initial session:", originalSessionId);
|
|
55
55
|
|
|
56
56
|
await runtime.newSession();
|
|
57
57
|
session = await bindSession();
|
|
58
|
-
console.log("After newSession():", session.
|
|
58
|
+
console.log("After newSession():", session.sessionId);
|
|
59
59
|
|
|
60
|
-
if (
|
|
61
|
-
await runtime.switchSession(
|
|
60
|
+
if (originalSessionId) {
|
|
61
|
+
await runtime.switchSession(originalSessionId);
|
|
62
62
|
session = await bindSession();
|
|
63
|
-
console.log("After switchSession():", session.
|
|
63
|
+
console.log("After switchSession():", session.sessionId);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
unsubscribe?.();
|
package/examples/sdk/README.md
CHANGED
|
@@ -120,7 +120,7 @@ await session.prompt("Hello");
|
|
|
120
120
|
| `excludedTools` | `[]` | Blocklist tool names across built-in, extension, and custom tools; applied after `tools` |
|
|
121
121
|
| `customTools` | `[]` | Additional tool definitions |
|
|
122
122
|
| `resourceLoader` | DefaultResourceLoader | Resource loader for extensions, skills, prompts, themes |
|
|
123
|
-
| `sessionManager` | `SessionManager.create(cwd)` | Persistence |
|
|
123
|
+
| `sessionManager` | `await SessionManager.create(cwd)` | Persistence |
|
|
124
124
|
| `settingsManager` | `SettingsManager.create(cwd, agentDir)` | Settings overrides |
|
|
125
125
|
|
|
126
126
|
## Events
|