@bastani/atomic 0.9.38-alpha.2 → 0.9.38-alpha.4
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 +35 -0
- 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/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +24 -0
- package/dist/builtin/workflows/README.md +5 -10
- package/dist/builtin/workflows/builtin/adversarial-verification.js +2 -2
- package/dist/builtin/workflows/builtin/{chunk-94f8zfz1.js → chunk-454hz1qt.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-wf876n16.js → chunk-4bwtzyjq.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-kb7s3gx2.js → chunk-5eh0brtd.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-r97ndfvt.js → chunk-bjva9j5k.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-x6az1sxp.js → chunk-h5fn47y5.js} +1 -1
- package/dist/builtin/workflows/builtin/chunk-na3wpwzh.js +3115 -0
- package/dist/builtin/workflows/builtin/{chunk-nkj4qhj6.js → chunk-q7dx7kh7.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-a1ar035d.js → chunk-qdd897wm.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-gyjck9z8.js → chunk-qjqn389g.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-ad83gc5p.js → chunk-qrrkfg9v.js} +5 -12
- package/dist/builtin/workflows/builtin/{chunk-632fxeb8.js → chunk-x0vvjyzg.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-3n2bnz64.js → chunk-xg7kkgf8.js} +2 -2
- package/dist/builtin/workflows/builtin/classify-and-act.js +2 -2
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +2 -2
- package/dist/builtin/workflows/builtin/generate-and-filter.js +2 -2
- package/dist/builtin/workflows/builtin/goal.js +3 -3
- package/dist/builtin/workflows/builtin/index.js +11 -11
- package/dist/builtin/workflows/builtin/loop-until-done.js +2 -2
- package/dist/builtin/workflows/builtin/open-claude-design.js +2 -2
- package/dist/builtin/workflows/builtin/ralph.js +3 -3
- package/dist/builtin/workflows/builtin/tournament.js +2 -2
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +8 -6
- package/dist/builtin/workflows/src/durable/journal/conformance.d.ts +4 -0
- package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +27 -0
- package/dist/builtin/workflows/src/durable/journal/node-sqlite.d.ts +20 -0
- package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +21 -0
- package/dist/builtin/workflows/src/durable/journal/sqlite-run-journal.d.ts +49 -0
- package/dist/builtin/workflows/src/durable/journal/types.d.ts +200 -0
- package/dist/builtin/workflows/src/durable/journal/values.d.ts +3 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +51916 -88191
- package/dist/builtin/workflows/src/index.js +9393 -45371
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +0 -6
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +4 -6
- package/dist/bun/split-loader.js +0 -13
- package/dist/bun/split-loader.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +1 -0
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +4 -0
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +1 -0
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +6 -6
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction-runner.d.ts +1 -0
- package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/compaction-runner.js +4 -1
- package/dist/core/compaction/compaction-runner.js.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.d.ts +2 -1
- package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.js +5 -5
- package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +2 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +32 -7
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +8 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/workflow-events.d.ts +2 -0
- package/dist/core/extensions/workflow-events.d.ts.map +1 -1
- package/dist/core/extensions/workflow-events.js.map +1 -1
- package/dist/core/extensions/workflow-run-control.d.ts +3 -3
- package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control.js +4 -4
- package/dist/core/extensions/workflow-run-control.js.map +1 -1
- package/dist/core/model-resolver-defaults.js +4 -4
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/session-manager-archive.d.ts.map +1 -1
- package/dist/core/session-manager-archive.js +3 -8
- package/dist/core/session-manager-archive.js.map +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +14 -20
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +4 -13
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-storage.d.ts +1 -0
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-storage.js +49 -24
- package/dist/core/session-manager-storage.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +2 -2
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js +2 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/session-manager-validation.d.ts +3 -0
- package/dist/core/session-manager-validation.d.ts.map +1 -1
- package/dist/core/session-manager-validation.js +16 -0
- package/dist/core/session-manager-validation.js.map +1 -1
- package/dist/core/session-manager.d.ts +1 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -2
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +4 -0
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +9 -0
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/storage/database.d.ts +21 -0
- package/dist/core/storage/database.d.ts.map +1 -0
- package/dist/core/storage/database.js +2 -0
- package/dist/core/storage/database.js.map +1 -0
- package/dist/core/storage/errors.d.ts +63 -0
- package/dist/core/storage/errors.d.ts.map +1 -0
- package/dist/core/storage/errors.js +103 -0
- package/dist/core/storage/errors.js.map +1 -0
- package/dist/core/storage/index.d.ts +6 -0
- package/dist/core/storage/index.d.ts.map +1 -0
- package/dist/core/storage/index.js +5 -0
- package/dist/core/storage/index.js.map +1 -0
- package/dist/core/storage/node-sqlite.d.ts +5 -0
- package/dist/core/storage/node-sqlite.d.ts.map +1 -0
- package/dist/core/storage/node-sqlite.js +161 -0
- package/dist/core/storage/node-sqlite.js.map +1 -0
- package/dist/core/storage/prefix.d.ts +5 -0
- package/dist/core/storage/prefix.d.ts.map +1 -0
- package/dist/core/storage/prefix.js +15 -0
- package/dist/core/storage/prefix.js.map +1 -0
- package/dist/core/storage/schema.d.ts +3 -0
- package/dist/core/storage/schema.d.ts.map +1 -0
- package/dist/core/storage/schema.js +6 -0
- package/dist/core/storage/schema.js.map +1 -0
- package/dist/core/storage/session/conformance.d.ts +12 -0
- package/dist/core/storage/session/conformance.d.ts.map +1 -0
- package/dist/core/storage/session/conformance.js +674 -0
- package/dist/core/storage/session/conformance.js.map +1 -0
- package/dist/core/storage/session/entry-structure.d.ts +4 -0
- package/dist/core/storage/session/entry-structure.d.ts.map +1 -0
- package/dist/core/storage/session/entry-structure.js +83 -0
- package/dist/core/storage/session/entry-structure.js.map +1 -0
- package/dist/core/storage/session/errors.d.ts +54 -0
- package/dist/core/storage/session/errors.d.ts.map +1 -0
- package/dist/core/storage/session/errors.js +95 -0
- package/dist/core/storage/session/errors.js.map +1 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts +57 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -0
- package/dist/core/storage/session/jsonl-session-store.js +482 -0
- package/dist/core/storage/session/jsonl-session-store.js.map +1 -0
- package/dist/core/storage/session/memory-session-store.d.ts +31 -0
- package/dist/core/storage/session/memory-session-store.d.ts.map +1 -0
- package/dist/core/storage/session/memory-session-store.js +113 -0
- package/dist/core/storage/session/memory-session-store.js.map +1 -0
- package/dist/core/storage/session/scratch-directory.d.ts +2 -0
- package/dist/core/storage/session/scratch-directory.d.ts.map +1 -0
- package/dist/core/storage/session/scratch-directory.js +5 -0
- package/dist/core/storage/session/scratch-directory.js.map +1 -0
- package/dist/core/storage/session/session-summary.d.ts +24 -0
- package/dist/core/storage/session/session-summary.d.ts.map +1 -0
- package/dist/core/storage/session/session-summary.js +79 -0
- package/dist/core/storage/session/session-summary.js.map +1 -0
- package/dist/core/storage/session/sql-session-store.d.ts +46 -0
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -0
- package/dist/core/storage/session/sql-session-store.js +227 -0
- package/dist/core/storage/session/sql-session-store.js.map +1 -0
- package/dist/core/storage/session/types.d.ts +68 -0
- package/dist/core/storage/session/types.d.ts.map +1 -0
- package/dist/core/storage/session/types.js +2 -0
- package/dist/core/storage/session/types.js.map +1 -0
- package/dist/core/storage/session/validation.d.ts +7 -0
- package/dist/core/storage/session/validation.d.ts.map +1 -0
- package/dist/core/storage/session/validation.js +47 -0
- package/dist/core/storage/session/validation.js.map +1 -0
- package/dist/core/storage/testing.d.ts +13 -0
- package/dist/core/storage/testing.d.ts.map +1 -0
- package/dist/core/storage/testing.js +264 -0
- package/dist/core/storage/testing.js.map +1 -0
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +8 -4
- package/dist/modes/interactive/components/chat-session-host.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 +5 -4
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +2 -1
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +8 -5
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +6 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts +1 -0
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +9 -2
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive/program-status-reporter.d.ts +4 -0
- package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
- package/dist/modes/interactive/program-status-reporter.js +45 -6
- package/dist/modes/interactive/program-status-reporter.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +2 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +9 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +4 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +39 -1
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +10 -0
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/docs/docs.json +1 -0
- package/docs/getting-started/installation.md +1 -2
- package/docs/json.md +1 -1
- package/docs/packages/authoring.md +1 -1
- package/docs/sdk/reference.md +1 -1
- package/docs/sdk/web-server.md +5 -5
- package/docs/sdk.md +11 -25
- package/docs/session-format.md +4 -10
- package/docs/settings.md +5 -29
- package/docs/storage.md +43 -0
- package/docs/workflows/api-reference.md +17 -55
- package/docs/workflows/authoring.md +2 -1
- package/docs/workflows/operations.md +31 -175
- package/docs/workflows/reliable-design.md +1 -1
- package/npm-shrinkwrap.json +32 -448
- package/package.json +13 -6
- package/schemas/settings.schema.json +27 -0
- package/dist/builtin/workflows/builtin/chunk-ymwq372z.js +0 -11609
- package/dist/core/session-manager-migrations.d.ts +0 -11
- package/dist/core/session-manager-migrations.d.ts.map +0 -1
- package/dist/core/session-manager-migrations.js +0 -80
- package/dist/core/session-manager-migrations.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-session-binding.js","sourceRoot":"","sources":["../../../src/modes/rpc/rpc-session-binding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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,CAAC,CAAC;YAC1E,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,KAAK,MAAM,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,MAAM,EAAE,CAAC;gBAC5E,IAAI,CAAC,MAAM,CAAC;oBACX,IAAI,EAAE,iBAAiB;oBACvB,aAAa,EAAE,cAAc,CAAC,IAAI;oBAClC,KAAK,EAAE,SAAS;oBAChB,KAAK,EAAE,cAAc,CAAC,KAAK;iBAC3B,CAAC,CAAC;YACJ,CAAC;YACD,MAAM,KAAK,CAAC;QACb,CAAC;QACD,IAAI,OAAO,KAAK,IAAI,CAAC,OAAO;YAAE,OAAO;QACrC,IAAI,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,oBAAoB;QACnB,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACrB,IAAI,CAAC,uBAAuB,EAAE,EAAE,CAAC;QACjC,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;QAC1B,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAClC,IAAI,CAAC,2BAA2B,EAAE,EAAE,CAAC;QACrC,IAAI,CAAC,2BAA2B,GAAG,SAAS,CAAC;QAC7C,IAAI,CAAC,kBAAkB,EAAE,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,uBAAuB,GAAG,SAAS,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACrC,CAAC;CACD","sourcesContent":["import { setCapabilityOverrides } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport type { AgentSessionRuntime } from \"../../core/agent-session-runtime.ts\";\nimport type { ProjectTrustContext } from \"../../core/extensions/index.js\";\nimport { FooterDataProvider } from \"../../core/footer-data-provider.ts\";\nimport { waitForRawStdoutBackpressure } from \"../../core/output-guard.ts\";\nimport type { EngineCustomUiService } from \"../interactive-engine/engine-custom-ui.ts\";\nimport type { EngineInputFormService } from \"../interactive-engine/engine-input-form.ts\";\nimport type { EngineRenderService } from \"../interactive-engine/engine-render-service.ts\";\nimport type { EngineSessionPickerService } from \"../interactive-engine/engine-session-picker.ts\";\nimport { forwardWorkflowActivity } from \"../interactive-engine/engine-workflow-activity.ts\";\nimport { toJsonEvent } from \"../json-event.ts\";\nimport { createRpcExtensionUIContext, type RpcPendingExtensionRequests } from \"./rpc-extension-ui.ts\";\nimport type { KeybindingsReloadCoordinator } from \"./rpc-keybindings-reload.ts\";\nimport type { RpcOutput } from \"./rpc-responses.ts\";\nimport { bindEngineTaskWidget } from \"./task-ui-bridge.js\";\n\ninterface RpcSessionBindingOptions {\n\truntimeHost: AgentSessionRuntime;\n\toutput: RpcOutput;\n\tpendingExtensionRequests: RpcPendingExtensionRequests;\n\tcustomUi?: EngineCustomUiService;\n\trenderService?: EngineRenderService;\n\tsessionPicker?: EngineSessionPickerService;\n\tinputForm?: EngineInputFormService;\n\t/** Present in the interactive engine child, which reports workflow activity to its host. */\n\twriteEngineLine?: (line: string) => void;\n\trequestShutdown: () => void;\n\treloadCoordinator?: KeybindingsReloadCoordinator<AgentSession>;\n}\n\nexport class RpcSessionBinding {\n\tprivate session: AgentSession;\n\tprivate boundRunner: AgentSession[\"extensionRunner\"] | undefined;\n\tprivate unsubscribe?: () => void;\n\tprivate unsubscribeBackpressure?: () => void;\n\tprivate unsubscribeTasks?: () => void;\n\tprivate unsubscribeWorkflowActivity?: () => void;\n\tprivate readonly runtimeHost: AgentSessionRuntime;\n\tprivate readonly output: RpcOutput;\n\tprivate readonly pendingExtensionRequests: RpcPendingExtensionRequests;\n\tprivate readonly customUi: EngineCustomUiService | undefined;\n\tprivate readonly renderService: EngineRenderService | undefined;\n\tprivate readonly sessionPicker: EngineSessionPickerService | undefined;\n\tprivate readonly inputForm: EngineInputFormService | undefined;\n\tprivate readonly writeEngineLine: ((line: string) => void) | undefined;\n\tprivate readonly requestShutdown: () => void;\n\tprivate readonly reloadCoordinator: KeybindingsReloadCoordinator<AgentSession> | undefined;\n\n\tprivate footerDataProvider: FooterDataProvider | undefined;\n\tconstructor({\n\t\truntimeHost,\n\t\toutput,\n\t\tpendingExtensionRequests,\n\t\trequestShutdown,\n\t\tcustomUi,\n\t\trenderService,\n\t\tsessionPicker,\n\t\tinputForm,\n\t\twriteEngineLine,\n\t\treloadCoordinator,\n\t}: RpcSessionBindingOptions) {\n\t\tthis.runtimeHost = runtimeHost;\n\t\tthis.output = output;\n\t\tthis.pendingExtensionRequests = pendingExtensionRequests;\n\t\tthis.requestShutdown = requestShutdown;\n\t\tthis.customUi = customUi;\n\t\tthis.renderService = renderService;\n\t\tthis.sessionPicker = sessionPicker;\n\t\tthis.inputForm = inputForm;\n\t\tthis.writeEngineLine = writeEngineLine;\n\t\tthis.reloadCoordinator = reloadCoordinator;\n\t\tthis.session = runtimeHost.session;\n\t\tthis.runtimeHost.setProjectTrustContextFactory?.((cwd) => this.createProjectTrustContext(cwd));\n\t}\n\n\tprivate createProjectTrustContext(cwd: string): ProjectTrustContext {\n\t\tconst runner = this.runtimeHost.session.extensionRunner;\n\t\tconst ui = runner.getUIContext();\n\t\tconst hasUI = this.customUi !== undefined;\n\t\treturn {\n\t\t\tcwd,\n\t\t\tmode: hasUI ? \"tui\" : \"rpc\",\n\t\t\thasUI,\n\t\t\tui: {\n\t\t\t\tselect: (title, options, opts) =>\n\t\t\t\t\thasUI\n\t\t\t\t\t\t? runner.withProjectTrustPrompt(\"select\", title, () => ui.select(title, options, opts))\n\t\t\t\t\t\t: Promise.resolve(undefined),\n\t\t\t\tconfirm: (title, message, opts) =>\n\t\t\t\t\thasUI\n\t\t\t\t\t\t? runner.withProjectTrustPrompt(\"confirm\", title, () => ui.confirm(title, message, opts))\n\t\t\t\t\t\t: Promise.resolve(false),\n\t\t\t\tinput: (title, placeholder, opts) =>\n\t\t\t\t\thasUI\n\t\t\t\t\t\t? runner.withProjectTrustPrompt(\"input\", title, () => ui.input(title, placeholder, opts))\n\t\t\t\t\t\t: Promise.resolve(undefined),\n\t\t\t\tnotify: (message, type) => ui.notify(message, type),\n\t\t\t},\n\t\t};\n\t}\n\n\tget currentSession(): AgentSession {\n\t\treturn this.session;\n\t}\n\n\tasync rebindSession(): Promise<void> {\n\t\tif (this.session === this.runtimeHost.session && this.boundRunner === this.session.extensionRunner) return;\n\t\tthis.session = this.runtimeHost.session;\n\t\tthis.disposeSubscriptions();\n\t\tconst session = this.session;\n\t\tsetCapabilityOverrides(session.settingsManager.getTerminalCapabilityOverrides());\n\t\tthis.renderService?.bindSession(session);\n\t\tthis.footerDataProvider = new FooterDataProvider(session.sessionManager.getCwd());\n\t\t// Seed the provider count from the current catalog snapshot, mirroring\n\t\t// updateProviderCountFromSnapshot() in interactive startup, so the\n\t\t// embedded footer shows the (provider) model prefix in multi-provider\n\t\t// sessions instead of defaulting to 0.\n\t\tconst models =\n\t\t\tsession.scopedModels.length > 0\n\t\t\t\t? session.scopedModels.map((scoped) => scoped.model)\n\t\t\t\t: session.modelRuntime.getAvailableSnapshot();\n\t\tthis.footerDataProvider.setAvailableProviderCount(new Set(models.map((model) => model.provider)).size);\n\n\t\ttry {\n\t\t\tawait session.bindExtensions({\n\t\t\t\tuiContext: createRpcExtensionUIContext({\n\t\t\t\t\toutput: this.output,\n\t\t\t\t\tpendingExtensionRequests: this.pendingExtensionRequests,\n\t\t\t\t\tcustomUi: this.customUi,\n\t\t\t\t\tsessionPicker: this.sessionPicker,\n\t\t\t\t\tinputForm: this.inputForm,\n\t\t\t\t\tfooterDataProvider: this.footerDataProvider,\n\t\t\t\t}),\n\t\t\t\tmode: this.customUi ? \"tui\" : \"rpc\",\n\t\t\t\tcommandContextActions: {\n\t\t\t\t\twaitForIdle: () => this.session.agent.waitForIdle(),\n\t\t\t\t\tnewSession: async (options) => this.runtimeHost.newSession(options),\n\t\t\t\t\tfork: async (entryId, forkOptions) => {\n\t\t\t\t\t\tconst result = await this.runtimeHost.fork(entryId, forkOptions);\n\t\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t\t},\n\t\t\t\t\tnavigateTree: async (targetId, options) => {\n\t\t\t\t\t\tconst result = await this.session.navigateTree(targetId, {\n\t\t\t\t\t\t\tsummarize: options?.summarize,\n\t\t\t\t\t\t\tcustomInstructions: options?.customInstructions,\n\t\t\t\t\t\t\treplaceInstructions: options?.replaceInstructions,\n\t\t\t\t\t\t\tlabel: options?.label,\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t\t},\n\t\t\t\t\tswitchSession: async (sessionPath, options) => {\n\t\t\t\t\t\treturn this.runtimeHost.switchSession(sessionPath, options);\n\t\t\t\t\t},\n\t\t\t\t\treload: async () => {\n\t\t\t\t\t\tconst steeringMode = this.session.steeringMode;\n\t\t\t\t\t\tconst followUpMode = this.session.followUpMode;\n\t\t\t\t\t\tif (this.reloadCoordinator) await this.reloadCoordinator.reload(this.session);\n\t\t\t\t\t\telse await this.session.reload();\n\t\t\t\t\t\tthis.session.setSteeringMode(steeringMode);\n\t\t\t\t\t\tthis.session.setFollowUpMode(followUpMode);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tshutdownHandler: this.requestShutdown,\n\t\t\t\tonError: (err) => {\n\t\t\t\t\tthis.output({\n\t\t\t\t\t\ttype: \"extension_error\",\n\t\t\t\t\t\textensionPath: err.extensionPath,\n\t\t\t\t\t\tevent: err.event,\n\t\t\t\t\t\terror: err.error,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t} catch (error) {\n\t\t\t// Leave no partially-initialized footer state behind if extension\n\t\t\t// binding fails; dispose the provider and rethrow.\n\t\t\tthis.footerDataProvider.dispose();\n\t\t\tthis.footerDataProvider = undefined;\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (this.customUi) this.unsubscribeTasks = bindEngineTaskWidget(session, session.extensionRunner.getUIContext());\n\t\tif (this.writeEngineLine) {\n\t\t\tthis.unsubscribeWorkflowActivity = forwardWorkflowActivity(session, this.writeEngineLine);\n\t\t}\n\t\tthis.unsubscribe = session.subscribe((event) => {\n\t\t\tthis.output(toJsonEvent(event));\n\t\t});\n\t\tthis.unsubscribeBackpressure = session.agent.subscribe(async () => {\n\t\t\tawait waitForRawStdoutBackpressure();\n\t\t});\n\t\tthis.reloadCoordinator?.publishCurrentState(session);\n\t\tthis.boundRunner = session.extensionRunner;\n\t}\n\n\t/** Load and atomically publish the optional resource set after the minimal interactive engine binds. */\n\tasync loadDeferredResources(): Promise<void> {\n\t\tconst session = this.session;\n\t\ttry {\n\t\t\tif (!(await this.runtimeHost.completeStartup?.())) {\n\t\t\t\tawait session.reload({ reason: \"startup\", failOnExtensionErrors: true });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tfor (const extensionError of session.resourceLoader.getExtensions().errors) {\n\t\t\t\tthis.output({\n\t\t\t\t\ttype: \"extension_error\",\n\t\t\t\t\textensionPath: extensionError.path,\n\t\t\t\t\tevent: \"startup\",\n\t\t\t\t\terror: extensionError.error,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tif (session !== this.session) return;\n\t\tthis.reloadCoordinator?.publishCurrentState(session);\n\t}\n\n\tdisposeSubscriptions(): void {\n\t\tthis.boundRunner = undefined;\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribeBackpressure?.();\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.unsubscribeTasks = undefined;\n\t\tthis.unsubscribeWorkflowActivity?.();\n\t\tthis.unsubscribeWorkflowActivity = undefined;\n\t\tthis.footerDataProvider?.dispose();\n\t\tthis.unsubscribe = undefined;\n\t\tthis.unsubscribeBackpressure = undefined;\n\t\tthis.footerDataProvider = undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rp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eAAe,EAAE,CACrB,iCAAiC,CAAC;YACjC,IAAI,EAAE,kBAAkB;YACxB,KAAK,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;SACrE,CAAC,CACF,CAAC;QACF,IAAI,CAAC,kBAAkB,EAAE,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,uBAAuB,GAAG,SAAS,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,SAAS,CAAC;IACrC,CAAC;CACD","sourcesContent":["import { setCapabilityOverrides } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.js\";\nimport type { AgentSessionRuntime } from \"../../core/agent-session-runtime.ts\";\nimport type { ProjectTrustContext } from \"../../core/extensions/index.js\";\nimport { FooterDataProvider } from \"../../core/footer-data-provider.ts\";\nimport { waitForRawStdoutBackpressure } from \"../../core/output-guard.ts\";\nimport type { EngineCustomUiService } from \"../interactive-engine/engine-custom-ui.ts\";\nimport type { EngineInputFormService } from \"../interactive-engine/engine-input-form.ts\";\nimport type { EngineRenderService } from \"../interactive-engine/engine-render-service.ts\";\nimport type { EngineSessionPickerService } from \"../interactive-engine/engine-session-picker.ts\";\nimport { forwardWorkflowActivity } from \"../interactive-engine/engine-workflow-activity.ts\";\nimport { serializeInteractiveEngineMessage } from \"../interactive-engine/protocol.ts\";\nimport { toJsonEvent } from \"../json-event.ts\";\nimport { createRpcExtensionUIContext, type RpcPendingExtensionRequests } from \"./rpc-extension-ui.ts\";\nimport type { KeybindingsReloadCoordinator } from \"./rpc-keybindings-reload.ts\";\nimport type { RpcOutput } from \"./rpc-responses.ts\";\nimport { bindEngineTaskWidget } from \"./task-ui-bridge.js\";\n\ninterface RpcSessionBindingOptions {\n\truntimeHost: AgentSessionRuntime;\n\toutput: RpcOutput;\n\tpendingExtensionRequests: RpcPendingExtensionRequests;\n\tcustomUi?: EngineCustomUiService;\n\trenderService?: EngineRenderService;\n\tsessionPicker?: EngineSessionPickerService;\n\tinputForm?: EngineInputFormService;\n\t/** Present in the interactive engine child, which reports workflow activity to its host. */\n\twriteEngineLine?: (line: string) => void;\n\trequestShutdown: () => void;\n\treloadCoordinator?: KeybindingsReloadCoordinator<AgentSession>;\n}\n\nexport class RpcSessionBinding {\n\tprivate session: AgentSession;\n\tprivate boundRunner: AgentSession[\"extensionRunner\"] | undefined;\n\tprivate unsubscribe?: () => void;\n\tprivate unsubscribeBackpressure?: () => void;\n\tprivate unsubscribeTasks?: () => void;\n\tprivate unsubscribeWorkflowActivity?: () => void;\n\tprivate readonly runtimeHost: AgentSessionRuntime;\n\tprivate readonly output: RpcOutput;\n\tprivate readonly pendingExtensionRequests: RpcPendingExtensionRequests;\n\tprivate readonly customUi: EngineCustomUiService | undefined;\n\tprivate readonly renderService: EngineRenderService | undefined;\n\tprivate readonly sessionPicker: EngineSessionPickerService | undefined;\n\tprivate readonly inputForm: EngineInputFormService | undefined;\n\tprivate readonly writeEngineLine: ((line: string) => void) | undefined;\n\tprivate readonly requestShutdown: () => void;\n\tprivate readonly reloadCoordinator: KeybindingsReloadCoordinator<AgentSession> | undefined;\n\n\tprivate footerDataProvider: FooterDataProvider | undefined;\n\tconstructor({\n\t\truntimeHost,\n\t\toutput,\n\t\tpendingExtensionRequests,\n\t\trequestShutdown,\n\t\tcustomUi,\n\t\trenderService,\n\t\tsessionPicker,\n\t\tinputForm,\n\t\twriteEngineLine,\n\t\treloadCoordinator,\n\t}: RpcSessionBindingOptions) {\n\t\tthis.runtimeHost = runtimeHost;\n\t\tthis.output = output;\n\t\tthis.pendingExtensionRequests = pendingExtensionRequests;\n\t\tthis.requestShutdown = requestShutdown;\n\t\tthis.customUi = customUi;\n\t\tthis.renderService = renderService;\n\t\tthis.sessionPicker = sessionPicker;\n\t\tthis.inputForm = inputForm;\n\t\tthis.writeEngineLine = writeEngineLine;\n\t\tthis.reloadCoordinator = reloadCoordinator;\n\t\tthis.session = runtimeHost.session;\n\t\tthis.runtimeHost.setProjectTrustContextFactory?.((cwd) => this.createProjectTrustContext(cwd));\n\t}\n\n\tprivate createProjectTrustContext(cwd: string): ProjectTrustContext {\n\t\tconst runner = this.runtimeHost.session.extensionRunner;\n\t\tconst ui = runner.getUIContext();\n\t\tconst hasUI = this.customUi !== undefined;\n\t\treturn {\n\t\t\tcwd,\n\t\t\tmode: hasUI ? \"tui\" : \"rpc\",\n\t\t\thasUI,\n\t\t\tui: {\n\t\t\t\tselect: (title, options, opts) =>\n\t\t\t\t\thasUI\n\t\t\t\t\t\t? runner.withProjectTrustPrompt(\"select\", title, () => ui.select(title, options, opts))\n\t\t\t\t\t\t: Promise.resolve(undefined),\n\t\t\t\tconfirm: (title, message, opts) =>\n\t\t\t\t\thasUI\n\t\t\t\t\t\t? runner.withProjectTrustPrompt(\"confirm\", title, () => ui.confirm(title, message, opts))\n\t\t\t\t\t\t: Promise.resolve(false),\n\t\t\t\tinput: (title, placeholder, opts) =>\n\t\t\t\t\thasUI\n\t\t\t\t\t\t? runner.withProjectTrustPrompt(\"input\", title, () => ui.input(title, placeholder, opts))\n\t\t\t\t\t\t: Promise.resolve(undefined),\n\t\t\t\tnotify: (message, type) => ui.notify(message, type),\n\t\t\t},\n\t\t};\n\t}\n\n\tget currentSession(): AgentSession {\n\t\treturn this.session;\n\t}\n\n\tasync rebindSession(): Promise<void> {\n\t\tif (this.session === this.runtimeHost.session && this.boundRunner === this.session.extensionRunner) return;\n\t\tthis.session = this.runtimeHost.session;\n\t\tthis.disposeSubscriptions();\n\t\tconst session = this.session;\n\t\tsetCapabilityOverrides(session.settingsManager.getTerminalCapabilityOverrides());\n\t\tthis.renderService?.bindSession(session);\n\t\tthis.footerDataProvider = new FooterDataProvider(session.sessionManager.getCwd());\n\t\t// Seed the provider count from the current catalog snapshot, mirroring\n\t\t// updateProviderCountFromSnapshot() in interactive startup, so the\n\t\t// embedded footer shows the (provider) model prefix in multi-provider\n\t\t// sessions instead of defaulting to 0.\n\t\tconst models =\n\t\t\tsession.scopedModels.length > 0\n\t\t\t\t? session.scopedModels.map((scoped) => scoped.model)\n\t\t\t\t: session.modelRuntime.getAvailableSnapshot();\n\t\tthis.footerDataProvider.setAvailableProviderCount(new Set(models.map((model) => model.provider)).size);\n\n\t\ttry {\n\t\t\tawait session.bindExtensions({\n\t\t\t\tonUIPrompt: (event) => {\n\t\t\t\t\tif (event.reason === \"ui_prompt\") {\n\t\t\t\t\t\tthis.writeEngineLine?.(serializeInteractiveEngineMessage({ type: \"engine_ui_prompt\", event }));\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tuiContext: createRpcExtensionUIContext({\n\t\t\t\t\toutput: this.output,\n\t\t\t\t\tpendingExtensionRequests: this.pendingExtensionRequests,\n\t\t\t\t\tcustomUi: this.customUi,\n\t\t\t\t\tsessionPicker: this.sessionPicker,\n\t\t\t\t\tinputForm: this.inputForm,\n\t\t\t\t\tfooterDataProvider: this.footerDataProvider,\n\t\t\t\t}),\n\t\t\t\tmode: this.customUi ? \"tui\" : \"rpc\",\n\t\t\t\tcommandContextActions: {\n\t\t\t\t\twaitForIdle: () => this.session.agent.waitForIdle(),\n\t\t\t\t\tnewSession: async (options) => this.runtimeHost.newSession(options),\n\t\t\t\t\tfork: async (entryId, forkOptions) => {\n\t\t\t\t\t\tconst result = await this.runtimeHost.fork(entryId, forkOptions);\n\t\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t\t},\n\t\t\t\t\tnavigateTree: async (targetId, options) => {\n\t\t\t\t\t\tconst result = await this.session.navigateTree(targetId, {\n\t\t\t\t\t\t\tsummarize: options?.summarize,\n\t\t\t\t\t\t\tcustomInstructions: options?.customInstructions,\n\t\t\t\t\t\t\treplaceInstructions: options?.replaceInstructions,\n\t\t\t\t\t\t\tlabel: options?.label,\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn { cancelled: result.cancelled };\n\t\t\t\t\t},\n\t\t\t\t\tswitchSession: async (sessionPath, options) => {\n\t\t\t\t\t\treturn this.runtimeHost.switchSession(sessionPath, options);\n\t\t\t\t\t},\n\t\t\t\t\treload: async () => {\n\t\t\t\t\t\tconst steeringMode = this.session.steeringMode;\n\t\t\t\t\t\tconst followUpMode = this.session.followUpMode;\n\t\t\t\t\t\tif (this.reloadCoordinator) await this.reloadCoordinator.reload(this.session);\n\t\t\t\t\t\telse await this.session.reload();\n\t\t\t\t\t\tthis.session.setSteeringMode(steeringMode);\n\t\t\t\t\t\tthis.session.setFollowUpMode(followUpMode);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tshutdownHandler: this.requestShutdown,\n\t\t\t\tonError: (err) => {\n\t\t\t\t\tthis.output({\n\t\t\t\t\t\ttype: \"extension_error\",\n\t\t\t\t\t\textensionPath: err.extensionPath,\n\t\t\t\t\t\tevent: err.event,\n\t\t\t\t\t\terror: err.error,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t\tthis.footerDataProvider.startGitWatcher();\n\t\t} catch (error) {\n\t\t\t// Leave no partially-initialized footer state behind if extension\n\t\t\t// binding fails; dispose the provider and rethrow.\n\t\t\tthis.footerDataProvider.dispose();\n\t\t\tthis.footerDataProvider = undefined;\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (this.customUi) this.unsubscribeTasks = bindEngineTaskWidget(session, session.extensionRunner.getUIContext());\n\t\tif (this.writeEngineLine) {\n\t\t\tthis.unsubscribeWorkflowActivity = forwardWorkflowActivity(session, this.writeEngineLine);\n\t\t}\n\t\tthis.unsubscribe = session.subscribe((event) => {\n\t\t\tthis.output(toJsonEvent(event));\n\t\t});\n\t\tthis.unsubscribeBackpressure = session.agent.subscribe(async () => {\n\t\t\tawait waitForRawStdoutBackpressure();\n\t\t});\n\t\tthis.reloadCoordinator?.publishCurrentState(session);\n\t\tthis.boundRunner = session.extensionRunner;\n\t}\n\n\t/** Load and atomically publish the optional resource set after the minimal interactive engine binds. */\n\tasync loadDeferredResources(): Promise<void> {\n\t\tconst session = this.session;\n\t\ttry {\n\t\t\tif (!(await this.runtimeHost.completeStartup?.())) {\n\t\t\t\tawait session.reload({ reason: \"startup\", failOnExtensionErrors: true });\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tfor (const extensionError of session.resourceLoader.getExtensions().errors) {\n\t\t\t\tthis.output({\n\t\t\t\t\ttype: \"extension_error\",\n\t\t\t\t\textensionPath: extensionError.path,\n\t\t\t\t\tevent: \"startup\",\n\t\t\t\t\terror: extensionError.error,\n\t\t\t\t});\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\tif (session !== this.session) return;\n\t\tthis.reloadCoordinator?.publishCurrentState(session);\n\t}\n\n\tdisposeSubscriptions(): void {\n\t\tthis.boundRunner = undefined;\n\t\tthis.unsubscribe?.();\n\t\tthis.unsubscribeBackpressure?.();\n\t\tthis.unsubscribeTasks?.();\n\t\tthis.unsubscribeTasks = undefined;\n\t\tthis.unsubscribeWorkflowActivity?.();\n\t\tthis.unsubscribeWorkflowActivity = undefined;\n\t\tthis.writeEngineLine?.(\n\t\t\tserializeInteractiveEngineMessage({\n\t\t\t\ttype: \"engine_ui_prompt\",\n\t\t\t\tevent: { type: \"ui_prompt_end\", reason: \"ui_prompt\", kind: \"custom\" },\n\t\t\t}),\n\t\t);\n\t\tthis.footerDataProvider?.dispose();\n\t\tthis.unsubscribe = undefined;\n\t\tthis.unsubscribeBackpressure = undefined;\n\t\tthis.footerDataProvider = undefined;\n\t}\n}\n"]}
|
package/docs/docs.json
CHANGED
|
@@ -103,10 +103,9 @@ How you install Atomic decides which runtime hosts it: a package-manager install
|
|
|
103
103
|
|
|
104
104
|
The shell installer detects Alpine and selects `atomic-linux-x64-musl.tar.gz` or `atomic-linux-arm64-musl.tar.gz`. Keep the complete archive, including payload-local `libgcc` and `libstdc++`; stock Alpine needs no runtime package install.
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
Clipboard setup depends on your environment:
|
|
107
107
|
|
|
108
108
|
- **Clipboard:** install `wl-clipboard` on Wayland, `xclip` or `xsel` on X11, or the Termux:API app and `termux-api` package on Termux. OSC 52 forwards copies over SSH or Mosh and is a fallback on headless Linux. Set `ATOMIC_CLIPBOARD_OSC52=1`, or the legacy `PI_CLIPBOARD_OSC52=1`, to force terminal forwarding. Your terminal must support it; forwarding does not confirm a successful local clipboard write.
|
|
109
|
-
- **Durable workflows:** PostgreSQL is included and provisions offline without Docker or external Postgres. If no durable backend can be provisioned, Atomic warns and uses non-durable in-memory storage.
|
|
110
109
|
|
|
111
110
|
Then start Atomic in the project directory you want it to work on:
|
|
112
111
|
|
package/docs/json.md
CHANGED
|
@@ -106,7 +106,7 @@ Extended messages from [`packages/coding-agent/src/core/messages.ts`](https://gi
|
|
|
106
106
|
Each line is a JSON object. The first line is the session header:
|
|
107
107
|
|
|
108
108
|
```json
|
|
109
|
-
{"type":"session","version":
|
|
109
|
+
{"type":"session","version":4,"id":"uuid","timestamp":"...","cwd":"/path"}
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
Followed by events as they occur:
|
|
@@ -87,7 +87,7 @@ If no app manifest (`atomic`, or legacy `pi`) is present, Atomic auto-discovers
|
|
|
87
87
|
|
|
88
88
|
Workflow files import `workflow` from `@bastani/atomic/workflows`, import `Type` from `typebox`, and export the definition returned by `workflow({ ... })`. TypeScript resolves the published `@bastani/atomic/workflows` specifier through the `@bastani/atomic` package.
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
Workflow files support `typebox`, `typebox/compile`, and `typebox/value`. Use these current imports even when an extension in the same package uses the host's additional schema aliases. See [Programmatic usage](/workflows/api-reference#programmatic-usage).
|
|
91
91
|
|
|
92
92
|
When a package manifest exists, declared resource arrays normally define what loads. Workflows are the exception: if `atomic.workflows` / legacy `pi.workflows` is omitted, Atomic still checks conventional `workflows/` and `workflow/` directories.
|
|
93
93
|
|
package/docs/sdk/reference.md
CHANGED
|
@@ -922,7 +922,7 @@ WorkflowRunNotResumableError
|
|
|
922
922
|
WorkflowStageNotFoundError
|
|
923
923
|
WorkflowStageAmbiguousError
|
|
924
924
|
WorkflowStageResumeUnsupportedError
|
|
925
|
-
|
|
925
|
+
WorkflowRunStorageError
|
|
926
926
|
WorkflowRunControlUnavailableError
|
|
927
927
|
|
|
928
928
|
// Tool factories
|
package/docs/sdk/web-server.md
CHANGED
|
@@ -20,7 +20,7 @@ npm install @bastani/atomic
|
|
|
20
20
|
|
|
21
21
|
Atomic needs Node.js 22.19 or newer and does not require dependency install scripts.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Dependency install scripts are not required. If your package manager reports blocked scripts, you do not need to enable them for Atomic.
|
|
24
24
|
|
|
25
25
|
## Keep Atomic out of the server bundle
|
|
26
26
|
|
|
@@ -300,12 +300,12 @@ export async function POST(request: Request): Promise<Response> {
|
|
|
300
300
|
|
|
301
301
|
### Choose workflow durability
|
|
302
302
|
|
|
303
|
-
By default, `run()`
|
|
303
|
+
By default, `run()` persists workflow state in a local SQLite journal so eligible runs can resume after the process exits. Keep that file on durable local storage in deployments that need restart recovery.
|
|
304
304
|
|
|
305
|
-
- **`durability: { mode: "
|
|
306
|
-
- **`durability: { mode: "
|
|
305
|
+
- **`durability: { mode: "durable" }`** explicitly requires persistent state. Journal open or write failures stop the run; they do not select non-durable execution.
|
|
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.
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
Set `ATOMIC_WORKFLOW_JOURNAL_PATH` before the first workflow action to choose the journal file. See [Choosing the durable backend](/workflows/api-reference#choosing-the-durable-backend) and [Workflows](/workflows).
|
|
309
309
|
|
|
310
310
|
## Secure the endpoint
|
|
311
311
|
|
package/docs/sdk.md
CHANGED
|
@@ -24,6 +24,8 @@ This page covers the SDK quick start, its core concepts, and one complete exampl
|
|
|
24
24
|
|
|
25
25
|
For a custom host that runs background work, see [Owner-bound task supervisor](/sdk/reference#owner-bound-task-supervisor-s1), [Supervised command SDK](/sdk/reference#supervised-command-sdk), and [Task transcript references](/sdk/reference#task-transcript-references).
|
|
26
26
|
|
|
27
|
+
For the standalone SQLite facade and adapter conformance suite, see [SQLite storage API](/storage).
|
|
28
|
+
|
|
27
29
|
Not sure the SDK is the right integration mode? Compare it with RPC and JSON mode on [Programmatic use](/programmatic).
|
|
28
30
|
|
|
29
31
|
To serve an agent over HTTP, see [Embedding Atomic in a web server](/sdk/web-server), which walks through a Next.js App Router route that streams session output to a browser.
|
|
@@ -115,7 +117,7 @@ When upgrading an existing host:
|
|
|
115
117
|
|
|
116
118
|
- Remove manual registration of Atomic's shipped builtin extensions. They and their resources are included by default. Use `builtins` to disable packages; use `tools`/`excludedTools` to control tool access. An empty tool allowlist also excludes Intercom.
|
|
117
119
|
- Supply all five `HostInput` methods (`confirm`, `select`, `input`, `editor`, `questionnaire`) through `extensionBindings.humanInput`. Preserve question text and option values, honor each request's abort signal, and return literal `true` only for explicit approval. No adapter is not consent: ordinary dialogs reject with `HumanInputUnavailable`, while required durable workflow gates remain pending. Do not translate cancellation into approval.
|
|
118
|
-
- Treat a headless workflow launch as acceptance, not completion. Inspect its run ID/status. After reconnecting, resume that
|
|
120
|
+
- Treat a headless workflow launch as acceptance, not completion. Inspect its run ID/status. After reconnecting, resume that run and bind the new adapter with `session.bindExtensions({ humanInput })`; do not start a second run to answer an outstanding question. Restore journal access before retrying a storage failure.
|
|
119
121
|
- Always `await session.dispose()` in `finally`, including on failure. Disposal is asynchronous and can reject with `ShutdownFailed` after attempting all cleanup; do not hide that rejection or call `process.exit()` to force a successful shutdown. Each session owns its own work, even when services are shared.
|
|
120
122
|
|
|
121
123
|
MCP servers and web providers still require their normal configuration and credentials. Importing the SDK does not connect them or take over standard input. Route host diagnostics through `extensionBindings.onDiagnostic`; a missing provider or extractor is an error, not an empty successful result.
|
|
@@ -232,7 +234,7 @@ Web provider configuration caches are session-local. Configuration discovery and
|
|
|
232
234
|
|
|
233
235
|
### Workflow run control
|
|
234
236
|
|
|
235
|
-
`session.workflows` controls this session's
|
|
237
|
+
`session.workflows` controls this session's runs without slash commands or the model-facing `workflow` tool. A fresh session can inspect a durable root by its full UUID within the same working directory and journal. Inspection stays read-only and does not add the run to `listRuns()`.
|
|
236
238
|
|
|
237
239
|
```typescript
|
|
238
240
|
interface SessionWorkflows {
|
|
@@ -251,11 +253,11 @@ interface SessionWorkflows {
|
|
|
251
253
|
|
|
252
254
|
`listRuns()` returns the same per-run data as `workflow status`: id, workflow name, status, active stages, and unanswered prompts (`awaitingInput`). Run IDs accept the full UUID or a unique 8-character prefix. `getRun()`, `getStages()`, `pause()` and `quit()` resolve a prefix against the runs this session holds and reject it at once when none matches, so pass the full UUID for a run recorded by an earlier process. `pause`, `quit` and `resume` resolve with the tool's acknowledged outcome: `action`, `runId` (`--all` for a batch), a `status` of `ok`, `running`, `paused`, `partial`, `noop` or `cancelled`, and a human-readable `message`. A `noop` means the request was understood and found nothing to change, such as pausing a run that already ended. A `partial` outcome means part of the request took effect. For `pause({ all: true })` and `quit({ all: true })`, `partial` means this call stopped at least one run and others are still active: `failedRuns` lists each run that is still active with its `runId`, a `reason` (for example `pause_failed` or `no_active_stages`) and a `message`, so check `outcome.status === "partial"` before treating a batch stop as complete. If active runs could not be stopped and this call stopped none, the call rejects with `WorkflowRunControlError` (`WORKFLOW_RUN_CONTROL_FAILED`) whose `failedRuns` carries the same list, even when other runs were already paused. Runs that are already paused or already ended are not failures, and a batch with no active run left to stop resolves as a `noop`. Call `getRun()` before retrying.
|
|
253
255
|
|
|
254
|
-
After an owning process crashes, create a new authorized SDK session with the original `cwd` and workflow
|
|
256
|
+
After an owning process crashes, create a new authorized SDK session with the original `cwd` and workflow journal. Keep the workflow definition available, then call `getRun(runId)` with the saved full UUID. Once the journal lease has expired (about two minutes without renewal), status reports `crashed`. `resume(runId)` claims the run under a new fenced lease, keeps its UUID, and replays completed checkpoints. This works with `SessionManager.inMemory()` and does not require reopening a session file. Concurrent recovery attempts admit only one executor; inspect again if another caller won the claim.
|
|
255
257
|
|
|
256
|
-
A
|
|
258
|
+
A run with a live foreign lease remains read-only, even while a long-running tool has not refreshed progress. `pause()` and `quit()` require the owning session. Missing ownership metadata, a different working directory, or unavailable journal storage prevents adoption. Use the full UUID to recover a foreign run.
|
|
257
259
|
|
|
258
|
-
|
|
260
|
+
Disposing an owning session with `await session.dispose()` stops its in-flight runs at their last checkpoint and records their release in the journal. Another authorized SDK session with the same `cwd` and journal can then call `resume(runId)`. The adopting session becomes the owner, and completed checkpoints replay without rerunning their callbacks.
|
|
259
261
|
|
|
260
262
|
Workflow resume is project-scoped. SDK and workflow-tool resume calls for a run from a different `cwd` return an actionable error without changing it. To continue in a different project, use `/workflow resume <id>` interactively and confirm the fork into the current directory. The fork receives a new run ID and copies saved progress; the original run is left untouched. To keep the original ID, create the successor session with the original `cwd`.
|
|
261
263
|
|
|
@@ -265,27 +267,11 @@ await owner.dispose(); // quits in-flight runs at their last checkpoint and rele
|
|
|
265
267
|
await successor.workflows.resume(runId); // adopts the run, even from another process
|
|
266
268
|
```
|
|
267
269
|
|
|
268
|
-
Switching
|
|
269
|
-
|
|
270
|
-
Live-cloned SDK hosts must share one authoritative PostgreSQL server and database. Configure a shared database endpoint for those hosts. Copying the managed PostgreSQL directory into another VM creates an independent database, even if both use the same `localhost` URL; separate databases cannot enforce cross-VM ownership exclusion.
|
|
271
|
-
|
|
272
|
-
Use a direct PostgreSQL connection or a proxy that preserves each client's database session. Ownership locks and write authorization depend on session affinity. Transaction-mode and statement-mode pooling, including those PgBouncer modes, are unsupported for the workflow database.
|
|
273
|
-
|
|
274
|
-
Database fencing protects ownership and durable checkpoints, not arbitrary external effects. If an owner loses its database connection, recovery may overlap an unfinished callback in that still-running process. The old owner cannot save new checkpoints, but an interrupted `ctx.tool` callback can be retried before the old callback stops. Make external effects idempotent, for example by passing a stable run/node operation key to an API that deduplicates requests. Completed checkpoints are replayed without rerunning their callbacks; unfinished callbacks do not have exactly-once execution guarantees.
|
|
275
|
-
|
|
276
|
-
An execution that loses its ownership connection cannot silently regain write authority. Restore database availability, inspect the retained run, and resume explicitly. Recovery uses a fresh execution generation while the disconnected generation stays fenced. Keep the database and completed checkpoints; deleting them is not a recovery step.
|
|
277
|
-
|
|
278
|
-
For an older run without database-fenced ownership, stop every older Atomic worker connected to its workflow database before enrollment. Upgrade the recovery host, retain the original database and workflow definition, and create an authorized SDK session with the original `cwd`. Inspect the full UUID, then explicitly confirm the stopped-worker prerequisite:
|
|
279
|
-
|
|
280
|
-
```ts
|
|
281
|
-
await session.workflows.resume(runId, {
|
|
282
|
-
legacyRecovery: { olderWorkersStopped: true },
|
|
283
|
-
});
|
|
284
|
-
```
|
|
270
|
+
Switching sessions (`/new`, `/fork`, `/resume`) also releases the previous session's paused runs for adoption. Reloading does not release runs. A paused run whose owning session has not released it stays protected; finished runs are not resumable.
|
|
285
271
|
|
|
286
|
-
|
|
272
|
+
Journal fencing protects ownership and durable checkpoints, not arbitrary external effects. An interrupted `ctx.tool` callback can run again if its result was not checkpointed. Make external effects idempotent, for example by using a stable run/node operation key with an API that deduplicates requests.
|
|
287
273
|
|
|
288
|
-
If
|
|
274
|
+
If storage fails, preserve the journal and run ID, restore access, inspect the retained run, and resume explicitly. A failed pause leaves the local scheduler paused; resume retries the journal transition before releasing it. A failed resume keeps the scheduler paused and surfaces the error.
|
|
289
275
|
|
|
290
276
|
Pausing a run doesn't park a stage that is waiting on a prompt, including an `ask_user_question` delivered through `HostInput.questionnaire`. If no other work is active, `pause(runId)` and `pause({ all: true })` mark the run `paused` without cancelling its question. Questions not yet shown wait until the run resumes. A later pause counts it as already paused. If your host then answers an already-open prompt, the stage can continue its turn before you call `resume`. To keep a paused run fully stopped, hold prompt answers until you resume it.
|
|
291
277
|
|
|
@@ -299,7 +285,7 @@ Requests that cannot be carried out reject with a subclass of `WorkflowRunContro
|
|
|
299
285
|
| `WorkflowStageNotFoundError` | `WORKFLOW_STAGE_NOT_FOUND` | `stageId` matches no stage of the run, or the stage has no control to pause. |
|
|
300
286
|
| `WorkflowStageAmbiguousError` | `WORKFLOW_STAGE_AMBIGUOUS` | `stageId` matches more than one stage; pass a more specific identifier. |
|
|
301
287
|
| `WorkflowStageResumeUnsupportedError` | `WORKFLOW_STAGE_RESUME_UNSUPPORTED` | A durable run resumes as a whole; call `resume()` without `stageId`. |
|
|
302
|
-
| `
|
|
288
|
+
| `WorkflowRunStorageError` | `WORKFLOW_RUN_STORAGE` | The workflow journal is unavailable, closed, or failed. Restore storage access and inspect the retained run before retrying. |
|
|
303
289
|
| `WorkflowRunControlError` | `WORKFLOW_RUN_CONTROL_FAILED` | Another failure; `message` explains it. |
|
|
304
290
|
| `WorkflowRunControlUnavailableError` | `WORKFLOW_RUN_CONTROL_UNAVAILABLE` | The workflows package is disabled, or the session was disposed. |
|
|
305
291
|
|
package/docs/session-format.md
CHANGED
|
@@ -18,13 +18,7 @@ Atomic also supports deleting sessions interactively from `/resume` (select a se
|
|
|
18
18
|
|
|
19
19
|
## Session Version
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- **Version 1**: Linear entry sequence (legacy, auto-migrated on load)
|
|
24
|
-
- **Version 2**: Tree structure with `id`/`parentId` linking
|
|
25
|
-
- **Version 3**: Renamed `hookMessage` role to `custom` (extensions unification)
|
|
26
|
-
|
|
27
|
-
Existing sessions are automatically migrated to the current version (v3) when loaded.
|
|
21
|
+
SessionManager writes version 4 headers. Other versions and structurally invalid entries are rejected before loading or forking; unloadable sessions are omitted from resume listings. Session-format migrations have been removed. Start a new session instead of relying on automatic conversion. Reading a file leaves its bytes unchanged. A complete final record without a newline is accepted; a torn final record is rejected.
|
|
28
22
|
|
|
29
23
|
## Source Files
|
|
30
24
|
|
|
@@ -203,19 +197,19 @@ interface SessionEntryBase {
|
|
|
203
197
|
First line of the file. Metadata only, not part of the tree (no `id`/`parentId`).
|
|
204
198
|
|
|
205
199
|
```json
|
|
206
|
-
{"type":"session","version":
|
|
200
|
+
{"type":"session","version":4,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project"}
|
|
207
201
|
```
|
|
208
202
|
|
|
209
203
|
For sessions with a parent (created via `/fork`, `/clone`, or `newSession({ parentSession })`):
|
|
210
204
|
|
|
211
205
|
```json
|
|
212
|
-
{"type":"session","version":
|
|
206
|
+
{"type":"session","version":4,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSession":"/path/to/original/session.jsonl"}
|
|
213
207
|
```
|
|
214
208
|
|
|
215
209
|
Workflow-owned sessions carry both `internal: true` and complete `workflow` linkage. Atomic writes this classification before the transcript becomes visible wherever possible, including workflow stage forks and fresh/forked subagents. A session is excluded from normal resume history only when `internal` is the exact boolean `true` and `workflow.runId`, `workflow.stageId`, and `workflow.stageName` are all non-empty strings:
|
|
216
210
|
|
|
217
211
|
```json
|
|
218
|
-
{"type":"session","version":
|
|
212
|
+
{"type":"session","version":4,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","internal":true,"workflow":{"runId":"run-1","stageId":"stage-build","stageName":"build"}}
|
|
219
213
|
```
|
|
220
214
|
|
|
221
215
|
Malformed, incomplete, workflow-only, or truthy non-boolean legacy markers remain visible in normal history. Atomic does not infer workflow ownership from `parentSession`, so ordinary user-created forks are unaffected. Valid workflow classification is inherited when an internal workflow transcript is branched or forked.
|
package/docs/settings.md
CHANGED
|
@@ -149,7 +149,7 @@ If `retry.enabled` is `false`, Atomic skips same-model retries and moves directl
|
|
|
149
149
|
|
|
150
150
|
The fallback model and its thinking level remain active for later turns in the same main-chat session. Choose another model explicitly with `/model` or model cycle to change them.
|
|
151
151
|
|
|
152
|
-
Workflow stages that set their own `model` or `fallbackModels` never use this list; they advance only the chain they declare. See [`fallbackModels`
|
|
152
|
+
Workflow stages that set their own `model` or `fallbackModels` never use this list; they advance only the chain they declare. See [`fallbackModels`](/workflows/api-reference#fallbackmodels).
|
|
153
153
|
|
|
154
154
|
A failure that another request to the same model cannot repair — a rejected credential, an unavailable model, a request that model cannot serve — takes that model out of the chain for the rest of the turn at **every** reasoning level, so a candidate that differs only by its `:low`/`:high` suffix is skipped rather than spent. Transient rate-limit and transport failures keep those reasoning variants, because retrying them can succeed.
|
|
155
155
|
|
|
@@ -548,40 +548,16 @@ Paths in `~/.atomic/agent/settings.json` resolve relative to `~/.atomic/agent`.
|
|
|
548
548
|
| `skills` | string[] | `[]` | Local skill file paths or directories |
|
|
549
549
|
| `prompts` | string[] | `[]` | Local prompt template paths or directories |
|
|
550
550
|
| `themes` | string[] | `[]` | Local theme file paths or directories |
|
|
551
|
-
| `workflows` | string[] or object | `[]` | Local workflow paths, or `{ "paths": [...]
|
|
551
|
+
| `workflows` | string[] or object | `[]` | Local workflow paths, or `{ "paths": [...] }`; see [Workflow storage](#workflow-storage) |
|
|
552
552
|
| `enableSkillCommands` | boolean | `true` | Register skills as `/skill:name` commands |
|
|
553
553
|
|
|
554
554
|
Arrays support glob patterns and exclusions. Use `!pattern` to exclude. Use `+path` to force-include an exact path and `-path` to force-exclude an exact path.
|
|
555
555
|
|
|
556
|
-
#### Workflow
|
|
556
|
+
#### Workflow storage
|
|
557
557
|
|
|
558
|
-
|
|
558
|
+
Workflow runs use a local SQLite journal at `~/.atomic/workflows/journal.sqlite`. Set `ATOMIC_WORKFLOW_JOURNAL_PATH` before starting Atomic to choose another file. Keep the journal on durable local storage and preserve it when upgrading or restarting. Changing the path selects a different run history; use the original journal to inspect or resume existing runs.
|
|
559
559
|
|
|
560
|
-
|
|
561
|
-
{
|
|
562
|
-
"workflows": {
|
|
563
|
-
"paths": ["./workflows"],
|
|
564
|
-
"durability": {
|
|
565
|
-
"systemDatabaseUrlFile": "~/.atomic/neon/direct.url"
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
| Setting | Type | Default | Description |
|
|
572
|
-
|---------|------|---------|-------------|
|
|
573
|
-
| `workflows.paths` | string[] | `[]` | Workflow resource paths in object-form settings; existing `workflows: [...]` settings remain supported |
|
|
574
|
-
| `workflows.durability.systemDatabaseUrl` | string | - | PostgreSQL URL for the workflow database |
|
|
575
|
-
| `workflows.durability.poolSize` | integer, at least 2 | `10` | Maximum connections per workflow database pool, for managed or remote PostgreSQL |
|
|
576
|
-
| `workflows.durability.systemDatabaseUrlFile` | string | - | Read the PostgreSQL URL from a UTF-8 file instead of storing credentials in settings |
|
|
577
|
-
|
|
578
|
-
Set only one URL source per scope. A project `durability` object replaces the global database selection; project settings are ignored unless trusted. Relative URL-file paths resolve beside the settings file that declares them: `~/.atomic/agent` for global settings and `.atomic` for project settings, or the matching `.pi` directory for inherited pi settings. Absolute paths and `~/` are supported. Protect credential files with permissions appropriate for your account, and do not commit them.
|
|
579
|
-
|
|
580
|
-
Precedence is nonempty `DBOS_SYSTEM_DATABASE_URL`, then settings, then managed embedded PostgreSQL with Docker as its provisioning fallback. URLs and file contents are trimmed. Invalid settings, including unrecognized `durability` keys, or missing, empty, or invalid URL files stop workflow initialization instead of silently choosing a local database. An explicit URL never starts managed PostgreSQL or Docker, even if the endpoint is unavailable. Existing non-durable fallback warnings still apply when DBOS cannot connect.
|
|
581
|
-
|
|
582
|
-
`poolSize` can be set without a URL, and still applies when `DBOS_SYSTEM_DATABASE_URL` supplies the URL. It is **per pool**, not a process-wide connection limit: each process opens at least two pools (DBOS SQL and the ownership fence), plus another fence pool after a recovery. The minimum is 2 because the ownership fence holds one long-lived advisory-lock connection and needs another for transactions. Lower it for hosted plans or poolers such as Neon, Supabase, or PgBouncer with low connection limits, or when many processes share one database. Raise it for one high-throughput process on a large database. Budget for all pools across all processes, and restart Atomic after changing the size.
|
|
583
|
-
|
|
584
|
-
Restart Atomic after changing the database selection. Selection takes effect on the first workflow action. Interactive and RPC sessions then report the selected provider and host without credentials; headless sessions report only a Docker fallback, on stderr. Changing databases does not migrate existing runs; use the original database to inspect or resume them. See [Durable workflows](/workflows/operations#durable-workflows-and-cross-session-resume).
|
|
560
|
+
Configure workflow resource paths with `workflows: ["./workflows"]` or `workflows: { "paths": ["./workflows"] }`. Storage does not require a separate server or connection settings. If the journal cannot be opened or written, the workflow action fails rather than switching to non-durable execution. Restore filesystem access and inspect the retained run before retrying. See [Durable workflows](/workflows/operations#durable-workflows-and-cross-session-resume).
|
|
585
561
|
|
|
586
562
|
#### packages
|
|
587
563
|
|
package/docs/storage.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# SQLite storage API
|
|
2
|
+
|
|
3
|
+
The SDK exposes an async SQLite API from `@bastani/atomic` and `@bastani/atomic/storage`. It does not change where Atomic stores sessions or workflow runs.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { openNodeSqliteDatabase } from "@bastani/atomic/storage";
|
|
7
|
+
|
|
8
|
+
const database = await openNodeSqliteDatabase("./data/example.sqlite");
|
|
9
|
+
try {
|
|
10
|
+
await database.exec("CREATE TABLE IF NOT EXISTS notes (id INTEGER PRIMARY KEY, text TEXT)");
|
|
11
|
+
await database.transaction(async (transaction) => {
|
|
12
|
+
await transaction.run("INSERT INTO notes(text) VALUES (?)", "hello");
|
|
13
|
+
});
|
|
14
|
+
const notes = await database.all("SELECT id, text FROM notes ORDER BY id");
|
|
15
|
+
} finally {
|
|
16
|
+
await database.close();
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`exec`, `run`, `get`, and `all` return promises. Bind values through positional `?` parameters; `run` returns `{ changes }`, `get` returns a row or `undefined`, and `all` returns an array. Values may be null, number, bigint, string, or Uint8Array. Binary values are copied when the call is made, so reusing a buffer afterward does not change queued work. INTEGER values inside the safe integer range are returned as numbers; larger values are returned as bigints.
|
|
21
|
+
|
|
22
|
+
The node adapter creates parent directories and enables WAL, full synchronization, and foreign keys. Its busy timeout defaults to 5000 ms; override it with `openNodeSqliteDatabase(path, { busyTimeoutMs: 1000 })`. Use `:memory:` for an ephemeral database.
|
|
23
|
+
|
|
24
|
+
Use only the supplied transaction handle inside a transaction callback. Calling the database itself there waits behind the transaction and deadlocks. Keep callbacks short and await only handle operations. A rejected callback rolls back and preserves the rejection. A failed commit rolls back and rejects with `StorageUnavailableError`. Handles expire after their callbacks settle. Other database operations execute in call order. `close()` drains accepted work, releases the database files, and is idempotent; new calls after closing begins reject with `StoreClosedError`.
|
|
25
|
+
|
|
26
|
+
Errors are exported classes with typed fields. `StorageUnavailableError` provides `adapter`, `location`, and `cause`; stop using the affected store after this error. `StorageRollbackError` retains the original `cause` and `rollbackCause` when rollback also fails. Do not assume that transaction rolled back. Branch on error classes rather than message text.
|
|
27
|
+
|
|
28
|
+
String bindings containing U+0000 are rejected before SQL executes with `StorageInvalidTextError`. Its `parameterIndex` is zero-based and its `reason` is `"nul-character"`. This rule applies to database calls and transaction handles. Store JSON with `JSON.stringify`, which escapes NUL characters, or use `Uint8Array` for binary data containing zero bytes. This validation does not inspect SQL source or SQL-generated values.
|
|
29
|
+
|
|
30
|
+
## Adapter conformance
|
|
31
|
+
|
|
32
|
+
Implement `SqliteDatabase` and run the exported suite from `@bastani/atomic/storage/testing`:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { describe, it } from "vitest";
|
|
36
|
+
import { registerSqliteDatabaseConformance } from "@bastani/atomic/storage/testing";
|
|
37
|
+
|
|
38
|
+
registerSqliteDatabaseConformance({ describe, it }, "my adapter", withSubject);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`withSubject` creates a fresh database for every case and calls the supplied callback with `{ database, reopen, withRollbackFailure }`. Clean up afterward, including on failure. `reopen()` closes and reopens the same persistent database and returns the new facade. `withRollbackFailure(error, callback)` injects a driver rollback failure only while running the callback, then restores normal behavior. The suite covers normal operation and reopening.
|
|
42
|
+
|
|
43
|
+
`validateStoragePrefix(prefix)` accepts an empty prefix or ASCII letters/underscores followed by ASCII letters, digits, or underscores. It rejects names beginning with `sqlite_`, regardless of case. Validate before opening files. `renderStorageIdentifiers(domain, names, prefix)` returns an immutable name map with `wf_` for `journal` or `session_` for `sessions`. `assertStorageSchemaVersion(domain, found, supported)` rejects a mismatched stored version without changing it.
|
|
@@ -546,16 +546,14 @@ Selects the primary stage model. String values can carry the reasoning suffix de
|
|
|
546
546
|
|
|
547
547
|
Use `model: "auto"` for prompt-based selection of an execution model and supported effort before session admission. Omission and concrete models keep prior behavior. Shared chain/parallel defaults accept `auto`; each stage receives one decision. The router sees the final supplied prompt, including interpolated inputs and supplied task context, rather than only a stage name.
|
|
548
548
|
|
|
549
|
-
`modelConstraints?: ModelConstraints` applies hard restrictions to auto selection and execution/compaction fallbacks. Fields are `allowedModels?: string[]`, `allowedProviders?: string[]`, `excludedProviders?: string[]`, `allowedEfforts?: (string | null)[]`, `maxInputCost?: number`, `maxOutputCost?: number`, `minContextWindow?: number`, and `requiredInputs?: ("text" | "image")[]`. Model IDs are exact provider/model IDs. Costs are catalog USD per million tokens including pricing tiers, not task budgets. Efforts are `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, or `null` for nonreasoning models. Empty allowlists admit nothing. Inherited and stage restrictions all hold; a task override cannot widen shared restrictions.
|
|
549
|
+
`modelConstraints?: ModelConstraints` applies hard restrictions to auto selection and execution/compaction fallbacks. Fields are `allowedModels?: string[]`, `allowedProviders?: string[]`, `excludedProviders?: string[]`, `allowedEfforts?: (string | null)[]`, `maxInputCost?: number`, `maxOutputCost?: number`, `minContextWindow?: number`, and `requiredInputs?: ("text" | "image")[]`. Model IDs are exact provider/model IDs. Costs are catalog USD per million tokens including pricing tiers, not task budgets. Efforts are `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`, or `null` for nonreasoning models. Empty allowlists admit nothing. Inherited and stage restrictions all hold; a task override cannot widen shared restrictions. Use `allowedEfforts` to restrict automatic reasoning selection. The user's [`modelRouting.allowedModels` and `excludedModels`](/settings#modelrouting) settings also apply to every auto stage, including builtin stages that omit a model; `modelConstraints` cannot widen them, and a stage whose filters leave no eligible model fails before launch.
|
|
550
550
|
|
|
551
551
|
An auto stage has no session until it receives prompt text. Model-dependent operations such as `compact()` or `cycleModel()` before that point report an error; call `prompt()` first or deliberately select a concrete model with `setModel()`. Session operations after admission keep their normal behavior.
|
|
552
552
|
|
|
553
|
-
### `fallbackModels`
|
|
553
|
+
### `fallbackModels`
|
|
554
554
|
|
|
555
555
|
```typescript
|
|
556
556
|
readonly fallbackModels?: readonly string[];
|
|
557
|
-
/** @deprecated Prefer a reasoning suffix on each fallback model. */
|
|
558
|
-
readonly fallbackThinkingLevels?: readonly string[];
|
|
559
557
|
```
|
|
560
558
|
|
|
561
559
|
`fallbackModels` tries the primary and each declared fallback in order. If all fail, the stage fails; the current Atomic-selected model is not appended implicitly. To use it as a final fallback, include it explicitly. The chain advances for:
|
|
@@ -590,27 +588,16 @@ Resume sends a replacement objective exactly once, including when pause occurred
|
|
|
590
588
|
|
|
591
589
|
Workflow-code errors, tool failures, validation failures, refusals, content-filter or safety blocks, cancellations, and task failures do not advance the chain. A reattached finished stage starts on the model that last succeeded; if that model fails retryably, the full chain restarts from the primary.
|
|
592
590
|
|
|
593
|
-
### `thinkingLevel` (deprecated)
|
|
594
|
-
|
|
595
|
-
```typescript
|
|
596
|
-
/** @deprecated Prefer suffixing model/fallbackModels entries with `:level`. */
|
|
597
|
-
readonly thinkingLevel?: WorkflowThinkingLevel;
|
|
598
|
-
```
|
|
599
|
-
|
|
600
|
-
Sets the default reasoning effort for candidates without a suffix. A suffix on the model string wins.
|
|
601
|
-
|
|
602
591
|
### `scopedModels`
|
|
603
592
|
|
|
604
593
|
```typescript
|
|
605
594
|
readonly scopedModels?: readonly WorkflowScopedModel[];
|
|
606
595
|
interface WorkflowScopedModel {
|
|
607
596
|
readonly model: WorkflowModelValue;
|
|
608
|
-
/** @deprecated Prefer a model-string reasoning suffix. */
|
|
609
|
-
readonly thinkingLevel?: WorkflowThinkingLevel;
|
|
610
597
|
}
|
|
611
598
|
```
|
|
612
599
|
|
|
613
|
-
Supplies stage-scoped model
|
|
600
|
+
Supplies stage-scoped model values. Use a model-string reasoning suffix to select effort.
|
|
614
601
|
|
|
615
602
|
### `tools` / `noTools` / `excludedTools`
|
|
616
603
|
|
|
@@ -653,7 +640,7 @@ readonly schema?: TSchema;
|
|
|
653
640
|
|
|
654
641
|
Enables one schema-backed `structured_output` call for that item. `ctx.stage`, `ctx.task`, `ctx.chain`, and `ctx.parallel` items accept a TypeBox schema or a plain JSON Schema descriptor object. The calling model supplies `instructions` and a nonempty named `state`, plus optional exact `model` and `fallbackModels` IDs. The tool infers a value matching the schema; that inferred value becomes the schema-backed `stage.prompt(...)` result or `WorkflowTaskResult.structured`. The calling model's arguments are not the result. The inferred result has no fixed size limit beyond the selected model's own output-token limit. Omit `model` to use the current stage chat model. After the primary and explicit fallbacks, the current chat model is tried if it was not already used. Atomic resolves each ID through the stage model registry. A registered classifier is used only when the schema is a finite Choice; otherwise that candidate is skipped and the skip is recorded. A classifier runtime failure advances to the next model unless the request was cancelled or refused for safety.
|
|
655
642
|
|
|
656
|
-
A schema-backed `StageContext` supports one `prompt()` call, so create another stage for another structured prompt. A missing call, or an inference failure that exhausts the tool's own model chain, receives up to three corrective follow-ups quoting the contract error. That budget is per stage model candidate. A candidate that spends the initial prompt and all three follow-ups without a valid inferred result fails, and the stage advances to the next entry in [`fallbackModels`](#fallbackmodels
|
|
643
|
+
A schema-backed `StageContext` supports one `prompt()` call, so create another stage for another structured prompt. A missing call, or an inference failure that exhausts the tool's own model chain, receives up to three corrective follow-ups quoting the contract error. That budget is per stage model candidate. A candidate that spends the initial prompt and all three follow-ups without a valid inferred result fails, and the stage advances to the next entry in [`fallbackModels`](#fallbackmodels), which receives the original stage prompt and its own fresh budget. With no stage fallback left, the stage fails with the contract error rather than completing. An explicit tool allowlist automatically receives `structured_output`, while items without `schema` do not.
|
|
657
644
|
|
|
658
645
|
With both `schema` and `output`, ordinary text from the successful `structured_output` message goes to the artifact. The inferred tool result is the typed value. Corrective attempts and later turns cannot replace that pair. If the successful message has no ordinary text, the artifact uses the most recent earlier assistant text without a `structured_output` call, or stays empty with a warning. The pattern builtins save their inter-stage decisions as JSON separately.
|
|
659
646
|
|
|
@@ -838,11 +825,10 @@ interface CompleteStageOpts {
|
|
|
838
825
|
readonly model?: WorkflowModelValue;
|
|
839
826
|
readonly maxTokens?: number;
|
|
840
827
|
readonly fallbackModels?: readonly string[];
|
|
841
|
-
readonly fallbackThinkingLevels?: readonly string[];
|
|
842
828
|
}
|
|
843
829
|
```
|
|
844
830
|
|
|
845
|
-
These options apply to `stage.complete(...)`.
|
|
831
|
+
These options apply to `stage.complete(...)`.
|
|
846
832
|
|
|
847
833
|
### Reasoning levels
|
|
848
834
|
|
|
@@ -856,17 +842,7 @@ await ctx.task("review", {
|
|
|
856
842
|
});
|
|
857
843
|
```
|
|
858
844
|
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
```diff
|
|
862
|
-
- model: "openai/gpt-5.5",
|
|
863
|
-
- fallbackModels: ["anthropic/claude-opus-4-8"],
|
|
864
|
-
- thinkingLevel: "high",
|
|
865
|
-
+ model: "openai/gpt-5.5:high",
|
|
866
|
-
+ fallbackModels: ["anthropic/claude-opus-4-8:high"],
|
|
867
|
-
```
|
|
868
|
-
|
|
869
|
-
This applies everywhere a stage accepts a model: direct `ctx.task`/`ctx.chain`/`ctx.parallel` options, `ctx.stage` options, builtin workflow stage definitions, and workflow parameters. `fallbackThinkingLevels` is an optional compatibility helper aligned by index to `fallbackModels`; it applies only to fallback entries that do not already carry a suffix. Each `WorkflowModelAttempt` reports the resolved model and the effective reasoning effort used for that attempt.
|
|
845
|
+
Reasoning suffixes apply to direct `ctx.task`/`ctx.chain`/`ctx.parallel` options, `ctx.stage` options, builtin workflow stage definitions, and workflow parameters. Each `WorkflowModelAttempt` reports the resolved model and effective reasoning effort for that attempt. Use suffixes rather than separate reasoning fields.
|
|
870
846
|
|
|
871
847
|
## StageContext
|
|
872
848
|
|
|
@@ -1183,9 +1159,9 @@ Each stage snapshot carries its graph position: `parentIds` lists the stages it
|
|
|
1183
1159
|
|
|
1184
1160
|
## Programmatic usage
|
|
1185
1161
|
|
|
1186
|
-
`@bastani/atomic/workflows` is Atomic's published workflow SDK. Import `workflow` from that specifier, import `Type` from `typebox`, and export the definition returned by `workflow({...})`. Workflow helpers may also import
|
|
1162
|
+
`@bastani/atomic/workflows` is Atomic's published workflow SDK. Import `workflow` from that specifier, import `Type` from `typebox`, and export the definition returned by `workflow({...})`. Workflow helpers may also import `typebox/compile` and `typebox/value`. Keep runtime helpers such as widget factories and shared utilities in a subdirectory outside the top-level discovery scan, such as `.atomic/workflows/lib/`; see [Workflow Locations](/workflows/operations#workflow-locations).
|
|
1187
1163
|
|
|
1188
|
-
Package authors list both `@bastani/atomic` and `typebox` in `peerDependencies`. The `@bastani/atomic` package publishes compiled JavaScript and declarations for `@bastani/atomic/workflows`, `@bastani/atomic/workflows/builtin`, and each `@bastani/atomic/workflows/builtin/*` module. TypeScript resolves those exports directly under `moduleResolution: NodeNext`. When Atomic executes a workflow file or an imported helper, its runtime loader
|
|
1164
|
+
Package authors list both `@bastani/atomic` and `typebox` in `peerDependencies`. The `@bastani/atomic` package publishes compiled JavaScript and declarations for `@bastani/atomic/workflows`, `@bastani/atomic/workflows/builtin`, and each `@bastani/atomic/workflows/builtin/*` module. TypeScript resolves those exports directly under `moduleResolution: NodeNext`. When Atomic executes a workflow file or an imported helper, its runtime loader supplies the workflow SDK and current TypeBox modules.
|
|
1189
1165
|
|
|
1190
1166
|
The loader also shares the host's modules for the exact specifiers `@bastani/atomic`, `@bastani/pi-ai`, and `@bastani/pi-ai/providers/all`. These exceptions expose Atomic's public root API and the AI compatibility API and provider transports. The host's versions take precedence over project-local copies, including in standalone-binary installs without project packages. Workflow files and relative imports still refresh on reload. Other deep subpaths resolve from disk. The workflow loader does not share the extension loader's remaining host aliases, including the separate agent-core and UI packages, other AI subpaths, and `proper-lockfile`. Older or alternative hosts without [`getWorkflowHostModules()`](/extensions/api-reference#pi-getworkflowhostmodules) retain filesystem resolution for the three specifiers.
|
|
1191
1167
|
|
|
@@ -1388,36 +1364,20 @@ The public authoring declaration intentionally excludes runtime-only executor fi
|
|
|
1388
1364
|
```typescript
|
|
1389
1365
|
type WorkflowDurability =
|
|
1390
1366
|
| { readonly mode: "memory" }
|
|
1391
|
-
| { readonly mode: "durable"
|
|
1367
|
+
| { readonly mode: "durable" };
|
|
1392
1368
|
```
|
|
1393
1369
|
|
|
1394
|
-
`run()`
|
|
1395
|
-
|
|
1396
|
-
- **Omitted:** durable, with Atomic's default database selection (`DBOS_SYSTEM_DATABASE_URL`, then its managed Postgres). If Postgres can't start, the run uses memory and prints a warning.
|
|
1397
|
-
- **`{ mode: "memory" }`:** runs with an in-memory backend that lasts only for this call. Postgres is never started, and nothing can be resumed after the process exits.
|
|
1398
|
-
- **`{ mode: "durable" }`:** requires durable state and fails fast. If the backend can't start, or only an in-memory fallback is available, `run()` rejects with `WorkflowDurabilityRequiredError` before the workflow runs.
|
|
1399
|
-
- **`{ mode: "durable", systemDatabaseUrl }`:** also chooses the Postgres database, for example a hosted one, and Atomic doesn't start or manage a local Postgres. `DBOS_SYSTEM_DATABASE_URL` overrides this value when set, so an operator can point a deployment at another database without changing code.
|
|
1400
|
-
- **`{ mode: "durable", poolSize }`:** sets the maximum connections per workflow database pool, with or without a URL, including when the URL comes from `DBOS_SYSTEM_DATABASE_URL`. Defaults to 10; must be an integer of at least 2 because an ownership pool holds one long-lived advisory-lock connection and needs another for transactions. Each process opens a DBOS SQL pool and an ownership-fence pool, plus another fence pool after recovery. Lower it for tight hosted connection limits or many processes; raise it for a high-throughput process on a large database.
|
|
1401
|
-
|
|
1402
|
-
One process uses one workflow database: DBOS runs a single executor per process, so a later run in the same process that asks for a different URL rejects. Separate processes are independent. The Atomic CLI and any number of SDK applications can each use their own database, or share one, including Atomic's managed Postgres. Each process only recovers its own interrupted runs, and an SDK process that exits doesn't stop the managed Postgres other processes are using.
|
|
1370
|
+
`run()` initializes the process's local SQLite journal on first use and releases each run's lease when execution settles. The journal remains available to other runs in the same process.
|
|
1403
1371
|
|
|
1404
|
-
|
|
1372
|
+
- **Omitted or `{ mode: "durable" }`:** writes durable state to the journal. Storage failures reject the call; Atomic does not silently switch to memory.
|
|
1373
|
+
- **`{ mode: "memory" }`:** explicitly chooses state that lasts only for this call and cannot resume after process exit.
|
|
1405
1374
|
|
|
1406
|
-
|
|
1375
|
+
The default journal is `~/.atomic/workflows/journal.sqlite`. Set `ATOMIC_WORKFLOW_JOURNAL_PATH` before the first workflow action to choose another file. Keep the same journal and working directory when resuming stored runs.
|
|
1407
1376
|
|
|
1408
1377
|
```ts
|
|
1409
|
-
import { run
|
|
1378
|
+
import { run } from "@bastani/atomic/workflows";
|
|
1410
1379
|
|
|
1411
|
-
await run(helloWorld, { name: "Atomic" }, { durability: { mode: "
|
|
1412
|
-
|
|
1413
|
-
try {
|
|
1414
|
-
await run(helloWorld, { name: "Atomic" }, {
|
|
1415
|
-
durability: { mode: "durable", systemDatabaseUrl: process.env.WORKFLOW_DATABASE_URL },
|
|
1416
|
-
});
|
|
1417
|
-
} catch (error) {
|
|
1418
|
-
if (error instanceof WorkflowDurabilityRequiredError) console.error(error.message);
|
|
1419
|
-
throw error;
|
|
1420
|
-
}
|
|
1380
|
+
await run(helloWorld, { name: "Atomic" }, { durability: { mode: "durable" } });
|
|
1421
1381
|
```
|
|
1422
1382
|
|
|
1423
1383
|
### `resolveInputs(schema, provided)`
|
|
@@ -1531,6 +1491,8 @@ interface StoreSnapshot {
|
|
|
1531
1491
|
|
|
1532
1492
|
`createStore()` returns an isolated workflow state store. `store` is the default singleton exported by the SDK authoring surface.
|
|
1533
1493
|
|
|
1494
|
+
Every `RunSnapshot` passed to `recordRunStart()` must include `toolNodes`. Use `toolNodes: []` when the run has no tool nodes.
|
|
1495
|
+
|
|
1534
1496
|
`snapshot()` returns a JSON copy of every run and notice; `version` increases on every store change. `graphSnapshot()` returns a cached, size-bounded copy for graph rendering that stays the same object until the store changes. `subscribe(listener)` calls `listener` with a fresh `snapshot()` after each change and returns an unsubscribe function.
|
|
1535
1497
|
|
|
1536
1498
|
Atomic's runtime store also has prompt, session, and pause/resume methods used by embedded integrations; those controls are not part of the published `Store` contract shown here.
|