@bastani/atomic 0.9.38-alpha.3 → 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 +26 -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 +51800 -88088
- 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-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/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/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-queueing.js +8 -5
- package/dist/modes/interactive/interactive-queueing.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
|
@@ -85,11 +85,13 @@ InteractiveModeBase.prototype.flushCompactionQueue = async function (options) {
|
|
|
85
85
|
const queuedMessages = [...this.compactionQueuedMessages];
|
|
86
86
|
this.compactionQueuedMessages = [];
|
|
87
87
|
this.updatePendingMessagesDisplay();
|
|
88
|
-
const restoreQueue = (error) => {
|
|
89
|
-
this.
|
|
90
|
-
|
|
88
|
+
const restoreQueue = (error, messages = queuedMessages) => {
|
|
89
|
+
this.compactionQueuedMessages = [
|
|
90
|
+
...messages,
|
|
91
|
+
...this.compactionQueuedMessages.filter((message) => !messages.includes(message)),
|
|
92
|
+
];
|
|
91
93
|
this.updatePendingMessagesDisplay();
|
|
92
|
-
this.showError(`Failed to send queued message${
|
|
94
|
+
this.showError(`Failed to send queued message${messages.length > 1 ? "s" : ""}: ${error instanceof Error ? error.message : String(error)}`);
|
|
93
95
|
};
|
|
94
96
|
try {
|
|
95
97
|
if (!options?.willRetry && (this.session.isStreaming || this.session.queuedMessagesPaused)) {
|
|
@@ -134,7 +136,7 @@ InteractiveModeBase.prototype.flushCompactionQueue = async function (options) {
|
|
|
134
136
|
const promptPromise = this.session
|
|
135
137
|
.prompt(firstPrompt.text, { streamingBehavior: firstPrompt.mode })
|
|
136
138
|
.catch((error) => {
|
|
137
|
-
restoreQueue(error);
|
|
139
|
+
restoreQueue(error, [firstPrompt]);
|
|
138
140
|
});
|
|
139
141
|
// Queue remaining messages
|
|
140
142
|
for (const message of rest) {
|
|
@@ -152,6 +154,7 @@ InteractiveModeBase.prototype.flushCompactionQueue = async function (options) {
|
|
|
152
154
|
void promptPromise;
|
|
153
155
|
}
|
|
154
156
|
catch (error) {
|
|
157
|
+
this.session.clearQueue();
|
|
155
158
|
restoreQueue(error);
|
|
156
159
|
}
|
|
157
160
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactive-queueing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-queueing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE1G,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,GAAG;IAIpD,OAAO;QACN,QAAQ,EAAE;YACT,GAAG,IAAI,CAAC,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AI,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gBACxC,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACP,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACxC,CAAC;QACF,CAAC;QACD,IAAI,CAAC,4BAA4B,EAAE,CAAC;QACpC,KAAK,aAAa,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,YAAY,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,0BAA0B,GAAG;IAC1D,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACpD,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { combineQueuedMessagesForEditor, Spacer, TruncatedText, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.getAllQueuedMessages = function (this: InteractiveModeBase): {\n\tsteering: string[];\n\tfollowUp: string[];\n} {\n\treturn {\n\t\tsteering: [\n\t\t\t...this.session.getSteeringMessages(),\n\t\t\t...this.compactionQueuedMessages.filter((msg) => msg.mode === \"steer\").map((msg) => msg.text),\n\t\t],\n\t\tfollowUp: [\n\t\t\t...this.session.getFollowUpMessages(),\n\t\t\t...this.compactionQueuedMessages.filter((msg) => msg.mode === \"followUp\").map((msg) => msg.text),\n\t\t],\n\t};\n};\n\nInteractiveModeBase.prototype.clearAllQueues = function (\n\tthis: InteractiveModeBase,\n\toptions?: { preserveUnprotectedCustomMessages?: boolean },\n): {\n\tsteering: string[];\n\tfollowUp: string[];\n} {\n\tconst { steering, followUp } = this.session.clearQueue(options);\n\tconst compactionSteering = this.compactionQueuedMessages\n\t\t.filter((msg) => msg.mode === \"steer\")\n\t\t.map((msg) => msg.text);\n\tconst compactionFollowUp = this.compactionQueuedMessages\n\t\t.filter((msg) => msg.mode === \"followUp\")\n\t\t.map((msg) => msg.text);\n\tthis.compactionQueuedMessages = [];\n\treturn {\n\t\tsteering: [...steering, ...compactionSteering],\n\t\tfollowUp: [...followUp, ...compactionFollowUp],\n\t};\n};\n\nInteractiveModeBase.prototype.updatePendingMessagesDisplay = function (this: InteractiveModeBase): void {\n\tthis.pendingMessagesContainer.clear();\n\tconst { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();\n\tif (steeringMessages.length > 0 || followUpMessages.length > 0) {\n\t\tthis.pendingMessagesContainer.addChild(new Spacer(1));\n\t\tfor (const message of steeringMessages) {\n\t\t\tconst text = theme.fg(\"dim\", `Steering: ${message}`);\n\t\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));\n\t\t}\n\t\tfor (const message of followUpMessages) {\n\t\t\tconst text = theme.fg(\"dim\", `Follow-up: ${message}`);\n\t\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));\n\t\t}\n\t\tconst dequeueHint = this.getAppKeyDisplay(\"app.message.dequeue\");\n\t\tconst hintText = theme.fg(\"dim\", `↳ ${dequeueHint} to edit all queued messages`);\n\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));\n\t}\n};\n\nInteractiveModeBase.prototype.restoreQueuedMessagesToEditor = function (\n\tthis: InteractiveModeBase,\n\toptions?: {\n\t\tabort?: boolean;\n\t\tcurrentText?: string;\n\t\tpreserveUnprotectedCustomMessages?: boolean;\n\t},\n): number {\n\tconst { steering, followUp } = this.clearAllQueues(options);\n\tconst allQueued = [...steering, ...followUp];\n\tif (allQueued.length === 0) {\n\t\tthis.updatePendingMessagesDisplay();\n\t\tif (options?.abort) {\n\t\t\tvoid this.session.abort();\n\t\t}\n\t\treturn 0;\n\t}\n\tconst currentText = options?.currentText ?? this.editor.getText();\n\tconst combinedText = combineQueuedMessagesForEditor(allQueued, currentText);\n\tthis.editor.setText(combinedText);\n\tthis.updatePendingMessagesDisplay();\n\tif (options?.abort) {\n\t\tvoid this.session.abort();\n\t}\n\treturn allQueued.length;\n};\n\nInteractiveModeBase.prototype.queueCompactionMessage = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tmode: \"steer\" | \"followUp\",\n): void {\n\tthis.compactionQueuedMessages.push({ text, mode });\n\tthis.editor.addToHistory?.(text);\n\tthis.editor.setText(\"\");\n\tthis.updatePendingMessagesDisplay();\n\tthis.showStatus(\"Queued message for after compaction\");\n};\n\nInteractiveModeBase.prototype.isExtensionCommand = function (this: InteractiveModeBase, text: string): boolean {\n\tif (!text.startsWith(\"/\")) return false;\n\n\tconst extensionRunner = this.session.extensionRunner;\n\n\tconst spaceIndex = text.indexOf(\" \");\n\tconst commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);\n\treturn !!extensionRunner.getCommand(commandName);\n};\n\nInteractiveModeBase.prototype.flushCompactionQueue = async function (\n\tthis: InteractiveModeBase,\n\toptions?: {\n\t\twillRetry?: boolean;\n\t},\n): Promise<void> {\n\tif (this.compactionQueuedMessages.length === 0) {\n\t\treturn;\n\t}\n\n\tconst queuedMessages = [...this.compactionQueuedMessages];\n\tthis.compactionQueuedMessages = [];\n\tthis.updatePendingMessagesDisplay();\n\n\tconst restoreQueue = (error: unknown) => {\n\t\tthis.session.clearQueue();\n\t\tthis.compactionQueuedMessages = queuedMessages;\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthis.showError(\n\t\t\t`Failed to send queued message${queuedMessages.length > 1 ? \"s\" : \"\"}: ${\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t}`,\n\t\t);\n\t};\n\n\ttry {\n\t\tif (!options?.willRetry && (this.session.isStreaming || this.session.queuedMessagesPaused)) {\n\t\t\tawait Promise.all(\n\t\t\t\tqueuedMessages.map((message) => this.session.prompt(message.text, { streamingBehavior: message.mode })),\n\t\t\t);\n\t\t\tthis.updatePendingMessagesDisplay();\n\t\t\treturn;\n\t\t}\n\t\tif (options?.willRetry) {\n\t\t\t// When retry is pending, queue messages for the retry turn\n\t\t\tfor (const message of queuedMessages) {\n\t\t\t\tif (this.isExtensionCommand(message.text)) {\n\t\t\t\t\tawait this.session.prompt(message.text);\n\t\t\t\t} else if (message.mode === \"followUp\") {\n\t\t\t\t\tawait this.session.followUp(message.text);\n\t\t\t\t} else {\n\t\t\t\t\tawait this.session.steer(message.text);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.updatePendingMessagesDisplay();\n\t\t\treturn;\n\t\t}\n\n\t\t// Find first non-extension-command message to use as prompt\n\t\tconst firstPromptIndex = queuedMessages.findIndex((message) => !this.isExtensionCommand(message.text));\n\t\tif (firstPromptIndex === -1) {\n\t\t\t// All extension commands - execute them all\n\t\t\tfor (const message of queuedMessages) {\n\t\t\t\tawait this.session.prompt(message.text);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Execute any extension commands before the first prompt\n\t\tconst preCommands = queuedMessages.slice(0, firstPromptIndex);\n\t\tconst firstPrompt = queuedMessages[firstPromptIndex];\n\t\tconst rest = queuedMessages.slice(firstPromptIndex + 1);\n\n\t\tfor (const message of preCommands) {\n\t\t\tawait this.session.prompt(message.text);\n\t\t}\n\n\t\t// Start a prompt when idle, or preserve its delivery mode if a run is\n\t\t// still winding down after compaction.\n\t\tconst promptPromise = this.session\n\t\t\t.prompt(firstPrompt.text, { streamingBehavior: firstPrompt.mode })\n\t\t\t.catch((error) => {\n\t\t\t\trestoreQueue(error);\n\t\t\t});\n\n\t\t// Queue remaining messages\n\t\tfor (const message of rest) {\n\t\t\tif (this.isExtensionCommand(message.text)) {\n\t\t\t\tawait this.session.prompt(message.text);\n\t\t\t} else if (message.mode === \"followUp\") {\n\t\t\t\tawait this.session.followUp(message.text);\n\t\t\t} else {\n\t\t\t\tawait this.session.steer(message.text);\n\t\t\t}\n\t\t}\n\t\tthis.updatePendingMessagesDisplay();\n\t\tvoid promptPromise;\n\t} catch (error) {\n\t\trestoreQueue(error);\n\t}\n};\n\nInteractiveModeBase.prototype.flushPendingBashComponents = function (this: InteractiveModeBase): void {\n\tfor (const component of this.pendingBashComponents) {\n\t\tthis.pendingMessagesContainer.removeChild(component);\n\t\tthis.chatContainer.addChild(component);\n\t}\n\tthis.pendingBashComponents = [];\n};\n"]}
|
|
1
|
+
{"version":3,"file":"interactive-queueing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-queueing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAE1G,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,GAAG;IAIpD,OAAO;QACN,QAAQ,EAAE;YACT,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;YACrC,GAAG,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;SAC7F;QACD,QAAQ,EAAE;YACT,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;YACrC,GAAG,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;SAChG;KACD,CAAC;AAC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AE,CAAC;QAChB,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAC1B,YAAY,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,0BAA0B,GAAG;IAC1D,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACpD,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { combineQueuedMessagesForEditor, Spacer, TruncatedText, theme } from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.getAllQueuedMessages = function (this: InteractiveModeBase): {\n\tsteering: string[];\n\tfollowUp: string[];\n} {\n\treturn {\n\t\tsteering: [\n\t\t\t...this.session.getSteeringMessages(),\n\t\t\t...this.compactionQueuedMessages.filter((msg) => msg.mode === \"steer\").map((msg) => msg.text),\n\t\t],\n\t\tfollowUp: [\n\t\t\t...this.session.getFollowUpMessages(),\n\t\t\t...this.compactionQueuedMessages.filter((msg) => msg.mode === \"followUp\").map((msg) => msg.text),\n\t\t],\n\t};\n};\n\nInteractiveModeBase.prototype.clearAllQueues = function (\n\tthis: InteractiveModeBase,\n\toptions?: { preserveUnprotectedCustomMessages?: boolean },\n): {\n\tsteering: string[];\n\tfollowUp: string[];\n} {\n\tconst { steering, followUp } = this.session.clearQueue(options);\n\tconst compactionSteering = this.compactionQueuedMessages\n\t\t.filter((msg) => msg.mode === \"steer\")\n\t\t.map((msg) => msg.text);\n\tconst compactionFollowUp = this.compactionQueuedMessages\n\t\t.filter((msg) => msg.mode === \"followUp\")\n\t\t.map((msg) => msg.text);\n\tthis.compactionQueuedMessages = [];\n\treturn {\n\t\tsteering: [...steering, ...compactionSteering],\n\t\tfollowUp: [...followUp, ...compactionFollowUp],\n\t};\n};\n\nInteractiveModeBase.prototype.updatePendingMessagesDisplay = function (this: InteractiveModeBase): void {\n\tthis.pendingMessagesContainer.clear();\n\tconst { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();\n\tif (steeringMessages.length > 0 || followUpMessages.length > 0) {\n\t\tthis.pendingMessagesContainer.addChild(new Spacer(1));\n\t\tfor (const message of steeringMessages) {\n\t\t\tconst text = theme.fg(\"dim\", `Steering: ${message}`);\n\t\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));\n\t\t}\n\t\tfor (const message of followUpMessages) {\n\t\t\tconst text = theme.fg(\"dim\", `Follow-up: ${message}`);\n\t\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));\n\t\t}\n\t\tconst dequeueHint = this.getAppKeyDisplay(\"app.message.dequeue\");\n\t\tconst hintText = theme.fg(\"dim\", `↳ ${dequeueHint} to edit all queued messages`);\n\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));\n\t}\n};\n\nInteractiveModeBase.prototype.restoreQueuedMessagesToEditor = function (\n\tthis: InteractiveModeBase,\n\toptions?: {\n\t\tabort?: boolean;\n\t\tcurrentText?: string;\n\t\tpreserveUnprotectedCustomMessages?: boolean;\n\t},\n): number {\n\tconst { steering, followUp } = this.clearAllQueues(options);\n\tconst allQueued = [...steering, ...followUp];\n\tif (allQueued.length === 0) {\n\t\tthis.updatePendingMessagesDisplay();\n\t\tif (options?.abort) {\n\t\t\tvoid this.session.abort();\n\t\t}\n\t\treturn 0;\n\t}\n\tconst currentText = options?.currentText ?? this.editor.getText();\n\tconst combinedText = combineQueuedMessagesForEditor(allQueued, currentText);\n\tthis.editor.setText(combinedText);\n\tthis.updatePendingMessagesDisplay();\n\tif (options?.abort) {\n\t\tvoid this.session.abort();\n\t}\n\treturn allQueued.length;\n};\n\nInteractiveModeBase.prototype.queueCompactionMessage = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tmode: \"steer\" | \"followUp\",\n): void {\n\tthis.compactionQueuedMessages.push({ text, mode });\n\tthis.editor.addToHistory?.(text);\n\tthis.editor.setText(\"\");\n\tthis.updatePendingMessagesDisplay();\n\tthis.showStatus(\"Queued message for after compaction\");\n};\n\nInteractiveModeBase.prototype.isExtensionCommand = function (this: InteractiveModeBase, text: string): boolean {\n\tif (!text.startsWith(\"/\")) return false;\n\n\tconst extensionRunner = this.session.extensionRunner;\n\n\tconst spaceIndex = text.indexOf(\" \");\n\tconst commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);\n\treturn !!extensionRunner.getCommand(commandName);\n};\n\nInteractiveModeBase.prototype.flushCompactionQueue = async function (\n\tthis: InteractiveModeBase,\n\toptions?: {\n\t\twillRetry?: boolean;\n\t},\n): Promise<void> {\n\tif (this.compactionQueuedMessages.length === 0) {\n\t\treturn;\n\t}\n\n\tconst queuedMessages = [...this.compactionQueuedMessages];\n\tthis.compactionQueuedMessages = [];\n\tthis.updatePendingMessagesDisplay();\n\n\tconst restoreQueue = (error: unknown, messages = queuedMessages) => {\n\t\tthis.compactionQueuedMessages = [\n\t\t\t...messages,\n\t\t\t...this.compactionQueuedMessages.filter((message) => !messages.includes(message)),\n\t\t];\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthis.showError(\n\t\t\t`Failed to send queued message${messages.length > 1 ? \"s\" : \"\"}: ${\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t}`,\n\t\t);\n\t};\n\n\ttry {\n\t\tif (!options?.willRetry && (this.session.isStreaming || this.session.queuedMessagesPaused)) {\n\t\t\tawait Promise.all(\n\t\t\t\tqueuedMessages.map((message) => this.session.prompt(message.text, { streamingBehavior: message.mode })),\n\t\t\t);\n\t\t\tthis.updatePendingMessagesDisplay();\n\t\t\treturn;\n\t\t}\n\t\tif (options?.willRetry) {\n\t\t\t// When retry is pending, queue messages for the retry turn\n\t\t\tfor (const message of queuedMessages) {\n\t\t\t\tif (this.isExtensionCommand(message.text)) {\n\t\t\t\t\tawait this.session.prompt(message.text);\n\t\t\t\t} else if (message.mode === \"followUp\") {\n\t\t\t\t\tawait this.session.followUp(message.text);\n\t\t\t\t} else {\n\t\t\t\t\tawait this.session.steer(message.text);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.updatePendingMessagesDisplay();\n\t\t\treturn;\n\t\t}\n\n\t\t// Find first non-extension-command message to use as prompt\n\t\tconst firstPromptIndex = queuedMessages.findIndex((message) => !this.isExtensionCommand(message.text));\n\t\tif (firstPromptIndex === -1) {\n\t\t\t// All extension commands - execute them all\n\t\t\tfor (const message of queuedMessages) {\n\t\t\t\tawait this.session.prompt(message.text);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Execute any extension commands before the first prompt\n\t\tconst preCommands = queuedMessages.slice(0, firstPromptIndex);\n\t\tconst firstPrompt = queuedMessages[firstPromptIndex];\n\t\tconst rest = queuedMessages.slice(firstPromptIndex + 1);\n\n\t\tfor (const message of preCommands) {\n\t\t\tawait this.session.prompt(message.text);\n\t\t}\n\n\t\t// Start a prompt when idle, or preserve its delivery mode if a run is\n\t\t// still winding down after compaction.\n\t\tconst promptPromise = this.session\n\t\t\t.prompt(firstPrompt.text, { streamingBehavior: firstPrompt.mode })\n\t\t\t.catch((error) => {\n\t\t\t\trestoreQueue(error, [firstPrompt]);\n\t\t\t});\n\n\t\t// Queue remaining messages\n\t\tfor (const message of rest) {\n\t\t\tif (this.isExtensionCommand(message.text)) {\n\t\t\t\tawait this.session.prompt(message.text);\n\t\t\t} else if (message.mode === \"followUp\") {\n\t\t\t\tawait this.session.followUp(message.text);\n\t\t\t} else {\n\t\t\t\tawait this.session.steer(message.text);\n\t\t\t}\n\t\t}\n\t\tthis.updatePendingMessagesDisplay();\n\t\tvoid promptPromise;\n\t} catch (error) {\n\t\tthis.session.clearQueue();\n\t\trestoreQueue(error);\n\t}\n};\n\nInteractiveModeBase.prototype.flushPendingBashComponents = function (this: InteractiveModeBase): void {\n\tfor (const component of this.pendingBashComponents) {\n\t\tthis.pendingMessagesContainer.removeChild(component);\n\t\tthis.chatContainer.addChild(component);\n\t}\n\tthis.pendingBashComponents = [];\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.
|