@bastani/atomic 0.9.39 → 0.9.40-alpha.2
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/CHANGELOG.md +14 -0
- package/dist/builtin/intercom/broker/broker.ts +523 -72
- package/dist/builtin/intercom/broker/client.ts +136 -5
- package/dist/builtin/intercom/broker/database-wake-up-bus.ts +274 -0
- package/dist/builtin/intercom/broker/group-membership.ts +2 -2
- package/dist/builtin/intercom/broker/multinode-router.ts +1500 -0
- package/dist/builtin/intercom/broker/multinode-state-store.ts +569 -0
- package/dist/builtin/intercom/broker/open-broker-state.ts +160 -0
- package/dist/builtin/intercom/broker/paths.ts +6 -0
- package/dist/builtin/intercom/broker/pending-send-registry.ts +14 -0
- package/dist/builtin/intercom/broker/recipient-receipts.ts +93 -0
- package/dist/builtin/intercom/broker/restoring-recipients.ts +263 -0
- package/dist/builtin/intercom/broker/send-handler.ts +241 -25
- package/dist/builtin/intercom/broker/session-id-reclaim.ts +41 -0
- package/dist/builtin/intercom/broker/socket-writes.ts +47 -0
- package/dist/builtin/intercom/broker/spawn.ts +10 -2
- package/dist/builtin/intercom/broker/sql-held-send-store.ts +96 -0
- package/dist/builtin/intercom/broker/sql-known-session-store.ts +129 -0
- package/dist/builtin/intercom/broker/sql-lease-store.ts +194 -0
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +249 -0
- package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +105 -0
- package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +295 -0
- package/dist/builtin/intercom/broker/sql-sent-message-authority.ts +126 -0
- package/dist/builtin/intercom/broker/supervisor-channel.ts +10 -0
- package/dist/builtin/intercom/broker/wake-up-bus.ts +60 -0
- package/dist/builtin/intercom/index.bundle.mjs +793 -91
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/retry-policy.ts +4 -0
- package/dist/builtin/intercom/session-target.ts +24 -0
- package/dist/builtin/intercom/types.ts +57 -3
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +31 -0
- package/dist/builtin/subagents/README.md +18 -12
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/agent-browser/SKILL.md +1 -1
- package/dist/builtin/subagents/skills/cua-driver/BROWSER.md +55 -8
- package/dist/builtin/subagents/skills/cua-driver/EMBEDDING.md +7 -2
- package/dist/builtin/subagents/skills/cua-driver/LINUX.md +7 -1
- package/dist/builtin/subagents/skills/cua-driver/MACOS.md +151 -27
- package/dist/builtin/subagents/skills/cua-driver/RUNTIME.md +1 -1
- package/dist/builtin/subagents/skills/cua-driver/SKILL.md +33 -17
- package/dist/builtin/subagents/skills/cua-driver/WINDOWS.md +5 -0
- package/dist/builtin/subagents/skills/cua-driver/WORKFLOW.md +46 -8
- package/dist/builtin/subagents/skills/subagent/SKILL.md +18 -20
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +8032 -6034
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/README.md +1 -1
- package/dist/builtin/web-access/index.bundle.mjs +2 -5
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +24 -0
- package/dist/builtin/workflows/README.md +1 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +8 -8
- package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/adapt.native.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/audit.md +4 -2
- package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/critique.md +22 -9
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/distill.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/extract.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/harden.md +2 -4
- package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/live.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +6 -6
- package/dist/builtin/workflows/skills/impeccable/reference/onboard.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +10 -0
- package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/impeccable +6 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/impeccable.cmd +47 -22
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-dom.js +34 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +25 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +33 -8
- package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +7 -7
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +22715 -22159
- package/dist/builtin/workflows/src/index.js +106 -35
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +17 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts +2 -0
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +6 -6
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +6 -3
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.d.ts +7 -2
- package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
- package/dist/core/agent-session-persistent-custom-messages.js +29 -12
- package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
- package/dist/core/agent-session-recovery.d.ts +14 -0
- package/dist/core/agent-session-recovery.d.ts.map +1 -0
- package/dist/core/agent-session-recovery.js +83 -0
- package/dist/core/agent-session-recovery.js.map +1 -0
- package/dist/core/agent-session-tasks.d.ts.map +1 -1
- package/dist/core/agent-session-tasks.js +4 -6
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +13 -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/agent-session.d.ts +2 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +4 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +3 -2
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/template.html +1 -0
- package/dist/core/export-html/template.js +37 -20
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +76 -3
- package/dist/core/extensions/api-types.d.ts +6 -2
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/event-results.d.ts +21 -0
- package/dist/core/extensions/event-results.d.ts.map +1 -1
- package/dist/core/extensions/event-results.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.map +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +4 -0
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/runner-events.d.ts +9 -2
- package/dist/core/extensions/runner-events.d.ts.map +1 -1
- package/dist/core/extensions/runner-events.js +29 -0
- package/dist/core/extensions/runner-events.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +5 -3
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +7 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +1 -0
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/session-events.d.ts +30 -2
- package/dist/core/extensions/session-events.d.ts.map +1 -1
- package/dist/core/extensions/session-events.js.map +1 -1
- package/dist/core/sdk-types.d.ts +3 -2
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-storage.d.ts.map +1 -1
- package/dist/core/session-storage.js +15 -9
- package/dist/core/session-storage.js.map +1 -1
- package/dist/core/storage/process-selection.d.ts +39 -0
- package/dist/core/storage/process-selection.d.ts.map +1 -0
- package/dist/core/storage/process-selection.js +154 -0
- package/dist/core/storage/process-selection.js.map +1 -0
- package/dist/core/storage/provider.d.ts +6 -1
- package/dist/core/storage/provider.d.ts.map +1 -1
- package/dist/core/storage/provider.js +3 -2
- package/dist/core/storage/provider.js.map +1 -1
- package/dist/core/storage/selection.d.ts +1 -1
- package/dist/core/storage/selection.d.ts.map +1 -1
- package/dist/core/storage/selection.js.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.d.ts +2 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.js +38 -2
- package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +11 -2
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +40 -16
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/pause.d.ts +4 -1
- package/dist/core/tasks/pause.d.ts.map +1 -1
- package/dist/core/tasks/pause.js +8 -5
- package/dist/core/tasks/pause.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +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 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +7 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +11 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +4 -0
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +2 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +3 -0
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +2 -0
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.d.ts +2 -1
- package/dist/modes/interactive/interactive-session-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +29 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +4 -1
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-args.js +4 -0
- package/dist/modes/interactive-engine/engine-args.js.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-render-service.js +4 -4
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +4 -0
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/remote-renderer.js +1 -1
- package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +4 -1
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js +4 -0
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +3 -0
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-command-timeouts.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-timeouts.js +1 -0
- package/dist/modes/rpc/rpc-command-timeouts.js.map +1 -1
- package/dist/modes/rpc/rpc-input-scheduler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-input-scheduler.js +6 -1
- package/dist/modes/rpc/rpc-input-scheduler.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +12 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +44 -11
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.js +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/background-tasks.md +5 -3
- package/docs/computer-use.md +2 -2
- package/docs/environment-variables.md +4 -1
- package/docs/extensions/events.md +29 -2
- package/docs/getting-started/first-session.md +1 -1
- package/docs/guides/intercom.md +1 -1
- package/docs/intercom/operations.md +103 -1
- package/docs/intercom/reference.md +10 -3
- package/docs/intercom.md +8 -6
- package/docs/keybindings.md +1 -1
- package/docs/models.md +1 -1
- package/docs/providers.md +5 -3
- package/docs/reference/cli.md +5 -0
- package/docs/rpc/protocol.md +19 -0
- package/docs/rpc.md +3 -0
- package/docs/sdk/web-server.md +1 -1
- package/docs/sdk.md +5 -2
- package/docs/sessions.md +17 -1
- package/docs/settings.md +6 -4
- package/docs/skills.md +1 -1
- package/docs/storage.md +54 -3
- package/docs/subagents.md +49 -9
- package/docs/usage.md +1 -1
- package/docs/windows.md +14 -4
- package/docs/workflows/api-reference.md +1 -1
- package/docs/workflows/authoring.md +1 -1
- package/docs/workflows/operations.md +10 -6
- package/npm-shrinkwrap.json +40 -40
- package/package.json +6 -6
- package/dist/core/export-html/template-js/data-tree.js +0 -287
- package/dist/core/export-html/template-js/entries-navigation.js +0 -434
- package/dist/core/export-html/template-js/initialization.js +0 -335
- package/dist/core/export-html/template-js/message-tools.js +0 -428
- package/dist/core/export-html/template-js/tree-filter-render.js +0 -419
- package/dist/core/export-html/template-script.d.ts +0 -3
- package/dist/core/export-html/template-script.d.ts.map +0 -1
- package/dist/core/export-html/template-script.js +0 -13
- package/dist/core/export-html/template-script.js.map +0 -1
|
@@ -20,7 +20,7 @@ Stage selectors preserve exact stage IDs and names, composite `runId:stageId` ID
|
|
|
20
20
|
|
|
21
21
|
### Intercom delivery to pending workflow stages
|
|
22
22
|
|
|
23
|
-
A workflow stage uses the root-anchored `workflow:<rootRunId>/<segment>[/<segment>...]` path shown by `intercom list` and workflow status surfaces. A segment may be a stage name, a materialized run id, or a glob: `*` matches one segment and may be embedded, while `**` matches any depth. Model-facing `workflow status` and interactive status list/detail surfaces enumerate materialized pending stages by display name and canonical stage ID, printing the path only when `pendingStageDeliveryAvailable` is true and the owning run is nonterminal. An ended root or nested child never advertises a retained pending target. Duplicate names remain independently identifiable. The workflow SDK `sessionId` is
|
|
23
|
+
A workflow stage uses the root-anchored `workflow:<rootRunId>/<segment>[/<segment>...]` path shown by `intercom list` and workflow status surfaces. A segment may be a stage name, a materialized run id, or a glob: `*` matches one segment and may be embedded, while `**` matches any depth. Model-facing `workflow status` and interactive status list/detail surfaces enumerate materialized pending stages by display name and canonical stage ID, printing the path only when `pendingStageDeliveryAvailable` is true and the owning run is nonterminal. An ended root or nested child never advertises a retained pending target. Duplicate names remain independently identifiable. The workflow SDK `sessionId` is the stage's Atomic session ID, not a workflow path: it reaches the stage only while the stage is connected and visible to you, and it never queues for a pending stage.
|
|
24
24
|
|
|
25
25
|
Join `workflow:<rootRunId>` and run `intercom({ action: "list" })` to see live sessions, materialized `PENDING`/`RUNNING` stages, and possible future literal, glob, and nested-child targets with queued counts. Then use ordinary Intercom delivery:
|
|
26
26
|
|
|
@@ -238,7 +238,7 @@ Mounted HIL and custom prompts take precedence: a `/skill:` answer is literal pr
|
|
|
238
238
|
|
|
239
239
|
`/tasks` opens the owner task list locally, never a skill or model message. Empty and populated lists use the same compact picker as main chat, without combining tasks from other chats. Enter inspects the selected task; focused actions offer retained transcript inspection, foreground waiting, confirmed cancellation, and stdin when available. Terminal tasks omit live actions. Escape returns to the picker with selection preserved, then to chat. A stage question arriving during inspection remains pending and is shown when you leave the inspector. Task navigation does not create a main-chat input-needed notice; genuine main-chat prompts waiting behind a visible graph still do.
|
|
240
240
|
|
|
241
|
-
`/tasks` is also suggested in the stage slash menu independently of `enableSkillCommands`. Its [background-task status](/background-tasks) appears below MCP status; the graph-return shortcut does not overwrite the task-inspection hint. Pausing a workflow stage cancels its active and admitted queued background agents and commands and waits for cleanup. It blocks fresh launches immediately; already-in-flight command setup may briefly start during the transition but must drain and be cancelled before pause completes. Stage-scoped pause leaves main-chat tasks and sibling stages alone. Merely detaching the chat or ending a foreground turn does not cancel background work. Closing the stage generation still cancels remaining owned work.
|
|
241
|
+
`/tasks` is also suggested in the stage slash menu independently of `enableSkillCommands`. Its [background-task status](/background-tasks) appears below MCP status; the graph-return shortcut does not overwrite the task-inspection hint. Pausing a workflow stage cancels its active and admitted queued background agents and commands and waits for cleanup. Subagents stopped this way stay resumable: the stage agent can continue them with `subagent({ action: "resume", id })`, and resuming the run after Atomic restarts restores them with the stage. Only a stage that finishes, or whose run ends or is cancelled, ends its subagents for good. It blocks fresh launches immediately; already-in-flight command setup may briefly start during the transition but must drain and be cancelled before pause completes. Stage-scoped pause leaves main-chat tasks and sibling stages alone. Merely detaching the chat or ending a foreground turn does not cancel background work. Closing the stage generation still cancels remaining owned work.
|
|
242
242
|
|
|
243
243
|
If inspection fails, the host displays the error and keeps your input for retry. It does not send the command to the model.
|
|
244
244
|
|
|
@@ -301,7 +301,7 @@ Control behavior:
|
|
|
301
301
|
- Intercom's slash-separated `target` is a messaging address, not a `workflow` `stageId`. An Intercom stage row also includes its owning `runId` and local `stageId`; pass that pair to `stage` or `transcript`, or use the expanded ID from `workflow stages` with the root run ID.
|
|
302
302
|
- `transcript` is reference-first with a small preview by default: it returns metadata, transcript paths, and up to 5 recent entries. For targeted lookup, quote the exact `sessionFile`/`transcriptPath` value without changing platform separators (preserve Windows backslashes), search it with `rg` or `grep`, then read only small surrounding ranges. Text results include JSON-escaped `sessionFileJson`/`transcriptPathJson` lines for copy-safe path literals. Pass explicit `tail` or `limit` to override the 5-entry preview; `tail` overrides `limit`; `includeToolOutput` includes captured snapshot tool output in snapshot transcript results.
|
|
303
303
|
- `answer` responds only to a pending primitive or structured human-input prompt. It accepts `promptId` plus `response`, `text`, or `message`, preserves prompt-kind validation, and never sends stage chat, steers, resumes, or starts a model turn.
|
|
304
|
-
- Send free-form updates through ordinary Intercom to `workflow:<rootRunId>/<segment>[/<segment>...]`; `*` matches one segment and `**` any depth. Use `intercom list` inside the invocation group to see live, pending, and possible future targets. Atomic delivers immediately to live stages and queues matching future stages, delivering them before their first model turn. `workflow:<rootRunId>/**` remains sticky for every future descendant until root termination; narrower name and pattern sends reach every future match. Valid paths outside the known set queue with a `notInKnownSet` warning and settle undeliverable at terminal only if never delivered. Use `ask` once the target has a reply-capable live session. Use `workflow resume` only for paused workflow control.
|
|
304
|
+
- Send free-form updates through ordinary Intercom to `workflow:<rootRunId>/<segment>[/<segment>...]`; `*` matches one segment and `**` any depth. Use `intercom list` inside the invocation group to see live, pending, and possible future targets. Atomic delivers immediately to live stages and queues matching future stages, delivering them before their first model turn. `workflow:<rootRunId>/**` remains sticky for every future descendant until root termination; narrower name and pattern sends reach every future match. Valid paths outside the known set queue with a `notInKnownSet` warning and settle undeliverable at terminal only if never delivered. Use `ask` once the target has a reply-capable live session. Use `workflow resume` only for paused workflow control. While an interrupted run waits for `/workflow resume`, the background subagents its stages launched are addressable as well: sends to them wait in the broker, not in the run's journal, and are delivered once after the resumed stage restores the subagent. If another session resumes the run, senders waiting for a subagent are told so and should send again there. If the run ends before the stage restores a subagent, the held sends return `Session not found`.
|
|
305
305
|
- `pause` and `quit` can target one top-level run or `all: true`; `stageId` cannot be combined with `all: true`. Stage-scoped `pause` controls can target a visible nested child stage from the expanded graph. Atomic routes stage controls to the owning nested run internally.
|
|
306
306
|
- `pause` and `quit` can also name one in-flight `ctx.tool` node with `stageId`, by expanded node id, local `tool:<argsHash>` id, or tool name. Both mean the same thing for a tool: abort that single call now. Tool nodes stay non-attachable — this is an abort control, not a chat target. Identifiers resolve exactly first and then uniquely; a name shared by two tool nodes (or by a stage and a tool) returns the same ambiguity diagnostic stages get, listing each match as `<name> (tool)`.
|
|
307
307
|
- Aborting one tool node leaves every sibling stage and sibling tool node running and does not pause the run. The node becomes `cancelled`, writes no replayable checkpoint, and re-runs on a later resume. Whether the run itself survives is ordinary author control flow: an awaited `ctx.tool` that is aborted rejects, exactly as it would for any other failure, unless the workflow catches it. A node that has already settled reports that it is not running rather than silently succeeding.
|
|
@@ -309,7 +309,7 @@ Control behavior:
|
|
|
309
309
|
- Whole-run `quit` stays authoritative even if workflow code catches the tool rejection. A catch may run cleanup, but its returned outputs do not convert the quit into a completed run: the executor suspends and quit's paused/resumable record stands. To abort one call and intentionally keep the workflow going, target that node instead of quitting the run.
|
|
310
310
|
- A targeted tool abort reports the node outcome and the run separately: `status: "cancelled"` for the node it cancelled, `stageId` for that node, `abandoned` when the callback ignored its signal, and `workflowStatus` for the run status *observed* when the action returned. It never reports `paused`, and it never predicts what the run does next.
|
|
311
311
|
- `pause` preserves resumable live work. With no active stage/tool handle (including initialization and between-node waits), it keeps the same executor paused rather than quitting it. Run-level `resume` on that live process releases the barrier exactly once; later tracked steps, cached replay, and run completion wait for that explicit resume. An already-started untracked JavaScript await or non-cancellable I/O may still finish; pause cannot physically freeze arbitrary author code or roll back effects. A stage declared during this pause defers registration until its asynchronous method runs after resume; synchronous session access requires resume first.
|
|
312
|
-
- A stage pause cancels that generation's owned task executions, not its queued messages or future workflow stages. User and Intercom messages remain held until resume; resume allows fresh tasks and never restarts the
|
|
312
|
+
- A stage pause cancels that generation's owned task executions, not its queued messages or future workflow stages. User and Intercom messages remain held until resume; resume allows fresh tasks and never restarts cancelled commands. Subagents the pause stopped stay resumable with `subagent({ action: "resume", id })`, and a resume after Atomic restarts restores them. Cancellation and cleanup failures reject the pause rather than reporting a successful stop.
|
|
313
313
|
- A whole-run executor-only pause also holds already-live owned child workflows, including children with no tracked node yet. Resume persists the root's running transition before releasing those child executors; a child-scoped control leaves sibling workflows alone.
|
|
314
314
|
- Live executor resume does not require a checkpoint. Cross-process resume still requires durable checkpoint or pending-prompt progress: losing a zero-progress live owner cannot reconstruct its JavaScript continuation. Cancelling the original startup request before acknowledgement remains terminal cancellation, not this live pause.
|
|
315
315
|
- `resume` can target a live paused stage with `stageId`; the target may be an exact stage id or an exact stage name. `message` is forwarded to paused work. Durable/cross-process resume is whole-run only and refuses a stage selector before dispatch rather than resuming the entire root. For a live interrupted streaming prompt, Atomic preserves the existing prompt loop without duplicating the user message and injects `Continue where you left off. If you believe you are finished with your original task (or a redefined task if the user told you), stop.` when required before normal readiness-gate completion. For a paused stage that was idle waiting for a new stage-chat turn, a non-empty message resumes the stage and starts exactly one fresh prompt containing that message; an empty resume releases the pause without creating a prompt.
|
|
@@ -350,6 +350,10 @@ The same continuation applies to user messages queued into a live streaming stag
|
|
|
350
350
|
|
|
351
351
|
Messages delivered to an idle stage start a fresh user turn immediately and receive no continuation nudge; abort, kill, workflow exit, and finalized/fail-fast stage boundaries suppress late prompt creation and continuation injection.
|
|
352
352
|
|
|
353
|
+
Resuming a stage that was interrupted mid-session also restores the background subagents that stage launched. It replays the stage's interrupted Intercom messages before the stage continues, and both are visible in the stage transcript. Stages keep the same `workflow:<rootRunId>/...` Intercom targets after resume, and messages queued for them while they were down are delivered once. Opening a post-mortem chat on a completed stage does not restart its stopped subagents.
|
|
354
|
+
|
|
355
|
+
Before you run `/workflow resume`, an interrupted run's stages stay reachable through Intercom: messages sent to them are queued and delivered once after resume. See [deferred delivery to pending stages](/intercom/reference#deferred-delivery-to-pending-stages).
|
|
356
|
+
|
|
353
357
|
Resuming several stages can make partial progress. Inspect status after an acknowledgement or persistence error: stages already running are not retried, and genuinely paused stages remain available for another resume. A later resume can retry a failed durable-state update. Terminal runs cannot be revived.
|
|
354
358
|
|
|
355
359
|
### Post-mortem chat vs. execution resume
|
|
@@ -376,7 +380,7 @@ The target sees the original ask, and its normal `intercom.reply` remains correl
|
|
|
376
380
|
|
|
377
381
|
This reopens only the conversation. The workflow DAG and terminal stage snapshot remain completed and are never resumed or re-dispatched. If the target run or stage was deleted, lacks a valid retained conversation, is non-resumable, or fails to reopen, the caller receives a bounded actionable `intercom.ask` tool error instead of waiting indefinitely.
|
|
378
382
|
|
|
379
|
-
Workflow stages and their subagent transcripts are excluded from ordinary `/resume`, `atomic -r`, `--continue`, and global history. Use workflow inspection and resume commands for stages; terminal
|
|
383
|
+
Workflow stages and their subagent transcripts are excluded from ordinary `/resume`, `atomic -r`, `--continue`, and global history. Use workflow inspection and resume commands for stages. A stage's subagents continue through `subagent({ action: "resume", id })` from the stage that launched them; once that stage has finished, or its run has ended or been cancelled, all of them are terminal, including ones the stage paused or quit, and `resume` refuses them with an error that says their workflow stage ended (see [Run control](/subagents#run-control)). An explicit `--session` file path can still open a stage transcript. Older unmarked workflow sessions may remain in ordinary history.
|
|
380
384
|
|
|
381
385
|
Embedding hosts can run the same pause, quit, and resume actions programmatically with `session.workflows`; see [Workflow run control](/sdk#workflow-run-control).
|
|
382
386
|
|
|
@@ -657,7 +661,7 @@ That history does not authorize any live release action.
|
|
|
657
661
|
|
|
658
662
|
### Configuring journal storage
|
|
659
663
|
|
|
660
|
-
Set `workflows.journal.path` in `settings.json` or set `ATOMIC_WORKFLOW_JOURNAL_PATH` before starting Atomic to select a local SQLite file. The non-empty environment value overrides settings; SDK `RunOpts.journal` and `createAgentSession({ journal })` override both. Relative settings paths resolve against the Atomic home directory, normally `~/.atomic`. With no override, Atomic uses `~/.atomic/workflows/journal.sqlite`. To use a remote database, select an [adapter module](/storage#selecting-an-adapter) in `workflows.journal` or shared `storage`.
|
|
664
|
+
Set `workflows.journal.path` in `settings.json` or set `ATOMIC_WORKFLOW_JOURNAL_PATH` before starting Atomic to select a local SQLite file. The non-empty environment value overrides settings; SDK `RunOpts.journal` and `createAgentSession({ journal })` override both. Relative settings paths resolve against the Atomic home directory, normally `~/.atomic`. With no override, Atomic uses `~/.atomic/workflows/journal.sqlite`. To use a remote database, select an [adapter module](/storage#selecting-an-adapter) in `workflows.journal` or shared `storage`. To select the journal for one process without editing settings, use `ATOMIC_WORKFLOWS_JOURNAL`, `ATOMIC_STORAGE`, or `--storage`; see [Selecting storage per process](/storage#selecting-storage-per-process).
|
|
661
665
|
|
|
662
666
|
For process-local storage, use `workflows.journal.memory: true` without a non-empty settings path, or pass `journal: { memory: true }` to SDK `run()`. Memory is never selected after a storage failure. Preserve a SQLite journal and its sidecar files; use the same journal and working directory to resume an existing run. See [Workflow storage settings](/settings#workflow-storage).
|
|
663
667
|
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.40-alpha.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@bastani/atomic",
|
|
9
|
-
"version": "0.9.
|
|
9
|
+
"version": "0.9.40-alpha.2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@bastani/atomic-natives": "0.9.
|
|
13
|
-
"@bastani/pi-ai": "0.9.
|
|
12
|
+
"@bastani/atomic-natives": "0.9.40-alpha.2",
|
|
13
|
+
"@bastani/pi-ai": "0.9.40-alpha.2",
|
|
14
14
|
"@earendil-works/pi-agent-core": "1.3.0",
|
|
15
15
|
"@earendil-works/pi-codemode": "1.3.0",
|
|
16
16
|
"@earendil-works/pi-tui": "1.3.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
19
19
|
"@mozilla/readability": "^0.6.0",
|
|
20
20
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
21
|
-
"@typesafe-ai/sdk": "0.
|
|
21
|
+
"@typesafe-ai/sdk": "0.7.0",
|
|
22
22
|
"brace-expansion": "5.0.12",
|
|
23
23
|
"chalk": "6.0.0",
|
|
24
24
|
"cross-spawn": "7.0.6",
|
|
@@ -427,18 +427,18 @@
|
|
|
427
427
|
}
|
|
428
428
|
},
|
|
429
429
|
"node_modules/@bastani/atomic-natives": {
|
|
430
|
-
"version": "0.9.
|
|
431
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.
|
|
430
|
+
"version": "0.9.40-alpha.2",
|
|
431
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.40-alpha.2.tgz",
|
|
432
432
|
"license": "MIT",
|
|
433
433
|
"optionalDependencies": {
|
|
434
|
-
"@bastani/atomic-natives-darwin-arm64": "0.9.
|
|
435
|
-
"@bastani/atomic-natives-darwin-x64": "0.9.
|
|
436
|
-
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.
|
|
437
|
-
"@bastani/atomic-natives-linux-arm64-musl": "0.9.
|
|
438
|
-
"@bastani/atomic-natives-linux-x64-gnu": "0.9.
|
|
439
|
-
"@bastani/atomic-natives-linux-x64-musl": "0.9.
|
|
440
|
-
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.
|
|
441
|
-
"@bastani/atomic-natives-win32-x64-msvc": "0.9.
|
|
434
|
+
"@bastani/atomic-natives-darwin-arm64": "0.9.40-alpha.2",
|
|
435
|
+
"@bastani/atomic-natives-darwin-x64": "0.9.40-alpha.2",
|
|
436
|
+
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.40-alpha.2",
|
|
437
|
+
"@bastani/atomic-natives-linux-arm64-musl": "0.9.40-alpha.2",
|
|
438
|
+
"@bastani/atomic-natives-linux-x64-gnu": "0.9.40-alpha.2",
|
|
439
|
+
"@bastani/atomic-natives-linux-x64-musl": "0.9.40-alpha.2",
|
|
440
|
+
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.40-alpha.2",
|
|
441
|
+
"@bastani/atomic-natives-win32-x64-msvc": "0.9.40-alpha.2"
|
|
442
442
|
},
|
|
443
443
|
"engines": {
|
|
444
444
|
"bun": ">=1.4.2",
|
|
@@ -446,8 +446,8 @@
|
|
|
446
446
|
}
|
|
447
447
|
},
|
|
448
448
|
"node_modules/@bastani/atomic-natives-darwin-arm64": {
|
|
449
|
-
"version": "0.9.
|
|
450
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.
|
|
449
|
+
"version": "0.9.40-alpha.2",
|
|
450
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.40-alpha.2.tgz",
|
|
451
451
|
"license": "MIT",
|
|
452
452
|
"os": [
|
|
453
453
|
"darwin"
|
|
@@ -458,8 +458,8 @@
|
|
|
458
458
|
"optional": true
|
|
459
459
|
},
|
|
460
460
|
"node_modules/@bastani/atomic-natives-darwin-x64": {
|
|
461
|
-
"version": "0.9.
|
|
462
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.
|
|
461
|
+
"version": "0.9.40-alpha.2",
|
|
462
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.40-alpha.2.tgz",
|
|
463
463
|
"license": "MIT",
|
|
464
464
|
"os": [
|
|
465
465
|
"darwin"
|
|
@@ -470,8 +470,8 @@
|
|
|
470
470
|
"optional": true
|
|
471
471
|
},
|
|
472
472
|
"node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
|
|
473
|
-
"version": "0.9.
|
|
474
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.
|
|
473
|
+
"version": "0.9.40-alpha.2",
|
|
474
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.40-alpha.2.tgz",
|
|
475
475
|
"license": "MIT",
|
|
476
476
|
"os": [
|
|
477
477
|
"linux"
|
|
@@ -485,8 +485,8 @@
|
|
|
485
485
|
"optional": true
|
|
486
486
|
},
|
|
487
487
|
"node_modules/@bastani/atomic-natives-linux-arm64-musl": {
|
|
488
|
-
"version": "0.9.
|
|
489
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.
|
|
488
|
+
"version": "0.9.40-alpha.2",
|
|
489
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.40-alpha.2.tgz",
|
|
490
490
|
"license": "MIT",
|
|
491
491
|
"os": [
|
|
492
492
|
"linux"
|
|
@@ -500,8 +500,8 @@
|
|
|
500
500
|
"optional": true
|
|
501
501
|
},
|
|
502
502
|
"node_modules/@bastani/atomic-natives-linux-x64-gnu": {
|
|
503
|
-
"version": "0.9.
|
|
504
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.
|
|
503
|
+
"version": "0.9.40-alpha.2",
|
|
504
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.40-alpha.2.tgz",
|
|
505
505
|
"license": "MIT",
|
|
506
506
|
"os": [
|
|
507
507
|
"linux"
|
|
@@ -515,8 +515,8 @@
|
|
|
515
515
|
"optional": true
|
|
516
516
|
},
|
|
517
517
|
"node_modules/@bastani/atomic-natives-linux-x64-musl": {
|
|
518
|
-
"version": "0.9.
|
|
519
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.
|
|
518
|
+
"version": "0.9.40-alpha.2",
|
|
519
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.40-alpha.2.tgz",
|
|
520
520
|
"license": "MIT",
|
|
521
521
|
"os": [
|
|
522
522
|
"linux"
|
|
@@ -530,8 +530,8 @@
|
|
|
530
530
|
"optional": true
|
|
531
531
|
},
|
|
532
532
|
"node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
|
|
533
|
-
"version": "0.9.
|
|
534
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.
|
|
533
|
+
"version": "0.9.40-alpha.2",
|
|
534
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.40-alpha.2.tgz",
|
|
535
535
|
"license": "MIT",
|
|
536
536
|
"os": [
|
|
537
537
|
"win32"
|
|
@@ -542,8 +542,8 @@
|
|
|
542
542
|
"optional": true
|
|
543
543
|
},
|
|
544
544
|
"node_modules/@bastani/atomic-natives-win32-x64-msvc": {
|
|
545
|
-
"version": "0.9.
|
|
546
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.
|
|
545
|
+
"version": "0.9.40-alpha.2",
|
|
546
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.40-alpha.2.tgz",
|
|
547
547
|
"license": "MIT",
|
|
548
548
|
"os": [
|
|
549
549
|
"win32"
|
|
@@ -554,8 +554,8 @@
|
|
|
554
554
|
"optional": true
|
|
555
555
|
},
|
|
556
556
|
"node_modules/@bastani/pi-ai": {
|
|
557
|
-
"version": "0.9.
|
|
558
|
-
"resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.
|
|
557
|
+
"version": "0.9.40-alpha.2",
|
|
558
|
+
"resolved": "https://registry.npmjs.org/@bastani/pi-ai/-/pi-ai-0.9.40-alpha.2.tgz",
|
|
559
559
|
"license": "MIT",
|
|
560
560
|
"dependencies": {
|
|
561
561
|
"@anthropic-ai/sdk": "0.129.0",
|
|
@@ -1209,12 +1209,12 @@
|
|
|
1209
1209
|
"license": "MIT"
|
|
1210
1210
|
},
|
|
1211
1211
|
"node_modules/@typesafe-ai/sdk": {
|
|
1212
|
-
"version": "0.
|
|
1213
|
-
"resolved": "https://registry.npmjs.org/@typesafe-ai/sdk/-/sdk-0.
|
|
1214
|
-
"integrity": "sha512-
|
|
1212
|
+
"version": "0.7.0",
|
|
1213
|
+
"resolved": "https://registry.npmjs.org/@typesafe-ai/sdk/-/sdk-0.7.0.tgz",
|
|
1214
|
+
"integrity": "sha512-Yg3OZArCQMJx98ut8QVkhx3rFo9ON7pz8Hjzv8c3FGz69Sk8jYftLOlz+Wf6kq6jol/1m08aBnjRAzJr2x3GoQ==",
|
|
1215
1215
|
"license": "MIT",
|
|
1216
1216
|
"engines": {
|
|
1217
|
-
"node": ">=
|
|
1217
|
+
"node": ">=22"
|
|
1218
1218
|
}
|
|
1219
1219
|
},
|
|
1220
1220
|
"node_modules/@xmldom/xmldom": {
|
|
@@ -2262,9 +2262,9 @@
|
|
|
2262
2262
|
}
|
|
2263
2263
|
},
|
|
2264
2264
|
"node_modules/hono": {
|
|
2265
|
-
"version": "4.13.
|
|
2266
|
-
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.
|
|
2267
|
-
"integrity": "sha512-
|
|
2265
|
+
"version": "4.13.13",
|
|
2266
|
+
"resolved": "https://registry.npmjs.org/hono/-/hono-4.13.13.tgz",
|
|
2267
|
+
"integrity": "sha512-CQ46U0ZkAGmbT/4UxdzzGJpacP2IeKgY4a5/tOI9AABbpOMfK739wfDXmv1usCk+3RkKj1hQy4/fjhiwa2xlrA==",
|
|
2268
2268
|
"license": "MIT",
|
|
2269
2269
|
"engines": {
|
|
2270
2270
|
"node": ">=16.9.0"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.40-alpha.2",
|
|
4
4
|
"description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"atomicConfig": {
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"start:fast": "bun run bundle:dev && bun dist-dev/cli.js",
|
|
77
77
|
"build:binary": "bun run clean && bun run build && bun build --target=bun --format=cjs --minify-syntax --external mupdf --external=*native-modifiers.js ./dist/bun/cli.js --outfile dist/app.js && bun build --target=bun --format=cjs --external mupdf ./src/utils/image-resize-worker.ts --outfile dist/image-resize-worker.js && bun run build:codemode-worker && bun build --compile --bytecode --format=cjs --external mupdf --no-compile-autoload-dotenv --no-compile-autoload-bunfig ./dist/bun/split-loader.js --outfile dist/atomic && bun run copy-binary-assets && bun run assert-binary-assets",
|
|
78
78
|
"build:codemode-worker": "bun build --target=bun --format=esm ./src/extensions/codemode/worker.ts --outfile dist/codemode-worker.js && shx cp ../../node_modules/quickjs-wasi/quickjs.wasm dist/",
|
|
79
|
-
"copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/modes/interactive/assets && shx cp src/modes/interactive/assets/*.png dist/modes/interactive/assets/ && shx mkdir -p dist/core/export-html/vendor
|
|
80
|
-
"copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/assets && shx cp src/modes/interactive/assets/*.png dist/assets/ && shx mkdir -p dist/export-html/vendor
|
|
79
|
+
"copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/modes/interactive/assets && shx cp src/modes/interactive/assets/*.png dist/modes/interactive/assets/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/ && bun run copy-builtin-packages",
|
|
80
|
+
"copy-binary-assets": "shx cp package.json dist/ && shx cp README.md dist/ && shx cp CHANGELOG.md dist/ && shx mkdir -p dist/theme && shx cp src/modes/interactive/theme/*.json dist/theme/ && shx mkdir -p dist/assets && shx cp src/modes/interactive/assets/*.png dist/assets/ && shx mkdir -p dist/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/export-html/ && shx cp src/core/export-html/vendor/*.js dist/export-html/vendor/ && shx cp ../../node_modules/@earendil-works/pi-tui/dist/native-modifiers.js dist/ && shx cp ../../node_modules/@earendil-works/pi-tui/dist/native-module-path.js dist/ && shx cp ../../node_modules/@earendil-works/pi-tui/dist/native-platform.js dist/ && shx mkdir -p dist/native/win32/prebuilds && shx cp -r ../../node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-* dist/native/win32/prebuilds/ && shx cp -r docs dist/ && shx cp -r examples dist/ && shx cp ../../node_modules/@silvia-odwyer/photon-node/photon_rs_bg.wasm dist/ && bun run copy-builtin-packages",
|
|
81
81
|
"copy-builtin-packages": "bun run scripts/copy-builtin-packages.ts",
|
|
82
82
|
"copy-builtin-workflows": "bun run copy-builtin-packages",
|
|
83
83
|
"assert-binary-assets": "bun run scripts/assert-pi-runtime-assets.ts --app dist/app.js",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
"prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@bastani/atomic-natives": "0.9.
|
|
93
|
-
"@bastani/pi-ai": "0.9.
|
|
92
|
+
"@bastani/atomic-natives": "0.9.40-alpha.2",
|
|
93
|
+
"@bastani/pi-ai": "0.9.40-alpha.2",
|
|
94
94
|
"@earendil-works/pi-agent-core": "1.3.0",
|
|
95
95
|
"@earendil-works/pi-codemode": "1.3.0",
|
|
96
96
|
"@earendil-works/pi-tui": "1.3.0",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
99
99
|
"@mozilla/readability": "^0.6.0",
|
|
100
100
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
101
|
-
"@typesafe-ai/sdk": "0.
|
|
101
|
+
"@typesafe-ai/sdk": "0.7.0",
|
|
102
102
|
"brace-expansion": "5.0.12",
|
|
103
103
|
"chalk": "6.0.0",
|
|
104
104
|
"cross-spawn": "7.0.6",
|
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
(function() {
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
// ============================================================
|
|
5
|
-
// DATA LOADING
|
|
6
|
-
// ============================================================
|
|
7
|
-
|
|
8
|
-
const base64 = document.getElementById('session-data').textContent;
|
|
9
|
-
const binary = atob(base64);
|
|
10
|
-
const bytes = new Uint8Array(binary.length);
|
|
11
|
-
for (let i = 0; i < binary.length; i++) {
|
|
12
|
-
bytes[i] = binary.charCodeAt(i);
|
|
13
|
-
}
|
|
14
|
-
const data = JSON.parse(new TextDecoder('utf-8').decode(bytes));
|
|
15
|
-
const { header, entries, leafId: defaultLeafId, systemPrompt, tools, renderedTools } = data;
|
|
16
|
-
|
|
17
|
-
// ============================================================
|
|
18
|
-
// URL PARAMETER HANDLING
|
|
19
|
-
// ============================================================
|
|
20
|
-
|
|
21
|
-
// Parse URL parameters for deep linking: leafId and targetId
|
|
22
|
-
// Check for injected params (when loaded in iframe via srcdoc) or use window.location
|
|
23
|
-
const injectedParams = document.querySelector('meta[name="pi-url-params"]');
|
|
24
|
-
const searchString = injectedParams ? injectedParams.content : window.location.search.substring(1);
|
|
25
|
-
const urlParams = new URLSearchParams(searchString);
|
|
26
|
-
const urlLeafId = urlParams.get('leafId');
|
|
27
|
-
const urlTargetId = urlParams.get('targetId');
|
|
28
|
-
// Use URL leafId if provided, otherwise fall back to session default
|
|
29
|
-
const leafId = urlLeafId || defaultLeafId;
|
|
30
|
-
|
|
31
|
-
// ============================================================
|
|
32
|
-
// DATA STRUCTURES
|
|
33
|
-
// ============================================================
|
|
34
|
-
|
|
35
|
-
// Entry lookup by ID
|
|
36
|
-
const byId = new Map();
|
|
37
|
-
for (const entry of entries) {
|
|
38
|
-
byId.set(entry.id, entry);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Tool call lookup (toolCallId -> {name, arguments})
|
|
42
|
-
const toolCallMap = new Map();
|
|
43
|
-
for (const entry of entries) {
|
|
44
|
-
if (entry.type === 'message' && entry.message.role === 'assistant') {
|
|
45
|
-
const content = entry.message.content;
|
|
46
|
-
if (Array.isArray(content)) {
|
|
47
|
-
for (const block of content) {
|
|
48
|
-
if (block.type === 'toolCall') {
|
|
49
|
-
toolCallMap.set(block.id, { name: block.name, arguments: block.arguments });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Label lookup (entryId -> label string)
|
|
57
|
-
// Labels are stored in 'label' entries that reference their target via targetId
|
|
58
|
-
const labelMap = new Map();
|
|
59
|
-
for (const entry of entries) {
|
|
60
|
-
if (entry.type === 'label' && entry.targetId && entry.label) {
|
|
61
|
-
labelMap.set(entry.targetId, entry.label);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// ============================================================
|
|
66
|
-
// TREE DATA PREPARATION (no DOM, pure data)
|
|
67
|
-
// ============================================================
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Build tree structure from flat entries.
|
|
71
|
-
* Returns array of root nodes, each with { entry, children, label }.
|
|
72
|
-
*/
|
|
73
|
-
function buildTree() {
|
|
74
|
-
const nodeMap = new Map();
|
|
75
|
-
const roots = [];
|
|
76
|
-
|
|
77
|
-
// Create nodes
|
|
78
|
-
for (const entry of entries) {
|
|
79
|
-
nodeMap.set(entry.id, {
|
|
80
|
-
entry,
|
|
81
|
-
children: [],
|
|
82
|
-
label: labelMap.get(entry.id)
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Build parent-child relationships
|
|
87
|
-
for (const entry of entries) {
|
|
88
|
-
const node = nodeMap.get(entry.id);
|
|
89
|
-
if (entry.parentId === null || entry.parentId === undefined || entry.parentId === entry.id) {
|
|
90
|
-
roots.push(node);
|
|
91
|
-
} else {
|
|
92
|
-
const parent = nodeMap.get(entry.parentId);
|
|
93
|
-
if (parent) {
|
|
94
|
-
parent.children.push(node);
|
|
95
|
-
} else {
|
|
96
|
-
roots.push(node);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Sort children by timestamp
|
|
102
|
-
function sortChildren(node) {
|
|
103
|
-
node.children.sort((a, b) =>
|
|
104
|
-
new Date(a.entry.timestamp).getTime() - new Date(b.entry.timestamp).getTime()
|
|
105
|
-
);
|
|
106
|
-
node.children.forEach(sortChildren);
|
|
107
|
-
}
|
|
108
|
-
roots.forEach(sortChildren);
|
|
109
|
-
|
|
110
|
-
return roots;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Build set of entry IDs on path from root to target.
|
|
115
|
-
*/
|
|
116
|
-
function buildActivePathIds(targetId) {
|
|
117
|
-
const ids = new Set();
|
|
118
|
-
let current = byId.get(targetId);
|
|
119
|
-
while (current) {
|
|
120
|
-
ids.add(current.id);
|
|
121
|
-
// Stop if no parent or self-referencing (root)
|
|
122
|
-
if (!current.parentId || current.parentId === current.id) {
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
current = byId.get(current.parentId);
|
|
126
|
-
}
|
|
127
|
-
return ids;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Get array of entries from root to target (the conversation path).
|
|
132
|
-
*/
|
|
133
|
-
function getPath(targetId) {
|
|
134
|
-
const path = [];
|
|
135
|
-
let current = byId.get(targetId);
|
|
136
|
-
while (current) {
|
|
137
|
-
path.unshift(current);
|
|
138
|
-
// Stop if no parent or self-referencing (root)
|
|
139
|
-
if (!current.parentId || current.parentId === current.id) {
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
current = byId.get(current.parentId);
|
|
143
|
-
}
|
|
144
|
-
return path;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Tree node lookup for finding leaves
|
|
148
|
-
let treeNodeMap = null;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Find the newest leaf node reachable from a given node.
|
|
152
|
-
* This allows clicking any node in a branch to show the full branch.
|
|
153
|
-
* Children are sorted by timestamp, so the newest is always last.
|
|
154
|
-
*/
|
|
155
|
-
function findNewestLeaf(nodeId) {
|
|
156
|
-
// Build tree node map lazily
|
|
157
|
-
if (!treeNodeMap) {
|
|
158
|
-
treeNodeMap = new Map();
|
|
159
|
-
const tree = buildTree();
|
|
160
|
-
function mapNodes(node) {
|
|
161
|
-
treeNodeMap.set(node.entry.id, node);
|
|
162
|
-
node.children.forEach(mapNodes);
|
|
163
|
-
}
|
|
164
|
-
tree.forEach(mapNodes);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const node = treeNodeMap.get(nodeId);
|
|
168
|
-
if (!node) return nodeId;
|
|
169
|
-
|
|
170
|
-
// Follow the newest (last) child at each level
|
|
171
|
-
let current = node;
|
|
172
|
-
while (current.children.length > 0) {
|
|
173
|
-
current = current.children[current.children.length - 1];
|
|
174
|
-
}
|
|
175
|
-
return current.entry.id;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Flatten tree into list with indentation and connector info.
|
|
180
|
-
* Returns array of { node, indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots }.
|
|
181
|
-
* Matches tree-selector.ts logic exactly.
|
|
182
|
-
*/
|
|
183
|
-
function flattenTree(roots, activePathIds) {
|
|
184
|
-
const result = [];
|
|
185
|
-
const multipleRoots = roots.length > 1;
|
|
186
|
-
|
|
187
|
-
// Mark which subtrees contain the active leaf
|
|
188
|
-
const containsActive = new Map();
|
|
189
|
-
function markActive(node) {
|
|
190
|
-
let has = activePathIds.has(node.entry.id);
|
|
191
|
-
for (const child of node.children) {
|
|
192
|
-
if (markActive(child)) has = true;
|
|
193
|
-
}
|
|
194
|
-
containsActive.set(node, has);
|
|
195
|
-
return has;
|
|
196
|
-
}
|
|
197
|
-
roots.forEach(markActive);
|
|
198
|
-
|
|
199
|
-
// Stack: [node, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild]
|
|
200
|
-
const stack = [];
|
|
201
|
-
|
|
202
|
-
// Add roots (prioritize branch containing active leaf)
|
|
203
|
-
const orderedRoots = [...roots].sort((a, b) =>
|
|
204
|
-
Number(containsActive.get(b)) - Number(containsActive.get(a))
|
|
205
|
-
);
|
|
206
|
-
for (let i = orderedRoots.length - 1; i >= 0; i--) {
|
|
207
|
-
const isLast = i === orderedRoots.length - 1;
|
|
208
|
-
stack.push([orderedRoots[i], multipleRoots ? 1 : 0, multipleRoots, multipleRoots, isLast, [], multipleRoots]);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
while (stack.length > 0) {
|
|
212
|
-
const [node, indent, justBranched, showConnector, isLast, gutters, isVirtualRootChild] = stack.pop();
|
|
213
|
-
|
|
214
|
-
result.push({ node, indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots });
|
|
215
|
-
|
|
216
|
-
const children = node.children;
|
|
217
|
-
const multipleChildren = children.length > 1;
|
|
218
|
-
|
|
219
|
-
// Order children (active branch first)
|
|
220
|
-
const orderedChildren = [...children].sort((a, b) =>
|
|
221
|
-
Number(containsActive.get(b)) - Number(containsActive.get(a))
|
|
222
|
-
);
|
|
223
|
-
|
|
224
|
-
// Calculate child indent (matches tree-selector.ts)
|
|
225
|
-
let childIndent;
|
|
226
|
-
if (multipleChildren) {
|
|
227
|
-
// Parent branches: children get +1
|
|
228
|
-
childIndent = indent + 1;
|
|
229
|
-
} else if (justBranched && indent > 0) {
|
|
230
|
-
// First generation after a branch: +1 for visual grouping
|
|
231
|
-
childIndent = indent + 1;
|
|
232
|
-
} else {
|
|
233
|
-
// Single-child chain: stay flat
|
|
234
|
-
childIndent = indent;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// Build gutters for children
|
|
238
|
-
const connectorDisplayed = showConnector && !isVirtualRootChild;
|
|
239
|
-
const currentDisplayIndent = multipleRoots ? Math.max(0, indent - 1) : indent;
|
|
240
|
-
const connectorPosition = Math.max(0, currentDisplayIndent - 1);
|
|
241
|
-
const childGutters = connectorDisplayed
|
|
242
|
-
? [...gutters, { position: connectorPosition, show: !isLast }]
|
|
243
|
-
: gutters;
|
|
244
|
-
|
|
245
|
-
// Add children in reverse order for stack
|
|
246
|
-
for (let i = orderedChildren.length - 1; i >= 0; i--) {
|
|
247
|
-
const childIsLast = i === orderedChildren.length - 1;
|
|
248
|
-
stack.push([orderedChildren[i], childIndent, multipleChildren, multipleChildren, childIsLast, childGutters, false]);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return result;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Build ASCII prefix string for tree node.
|
|
257
|
-
*/
|
|
258
|
-
function buildTreePrefix(flatNode) {
|
|
259
|
-
const { indent, showConnector, isLast, gutters, isVirtualRootChild, multipleRoots } = flatNode;
|
|
260
|
-
const displayIndent = multipleRoots ? Math.max(0, indent - 1) : indent;
|
|
261
|
-
const connector = showConnector && !isVirtualRootChild ? (isLast ? '└─ ' : '├─ ') : '';
|
|
262
|
-
const connectorPosition = connector ? displayIndent - 1 : -1;
|
|
263
|
-
|
|
264
|
-
const totalChars = displayIndent * 3;
|
|
265
|
-
const prefixChars = [];
|
|
266
|
-
for (let i = 0; i < totalChars; i++) {
|
|
267
|
-
const level = Math.floor(i / 3);
|
|
268
|
-
const posInLevel = i % 3;
|
|
269
|
-
|
|
270
|
-
const gutter = gutters.find(g => g.position === level);
|
|
271
|
-
if (gutter) {
|
|
272
|
-
prefixChars.push(posInLevel === 0 ? (gutter.show ? '│' : ' ') : ' ');
|
|
273
|
-
} else if (connector && level === connectorPosition) {
|
|
274
|
-
if (posInLevel === 0) {
|
|
275
|
-
prefixChars.push(isLast ? '└' : '├');
|
|
276
|
-
} else if (posInLevel === 1) {
|
|
277
|
-
prefixChars.push('─');
|
|
278
|
-
} else {
|
|
279
|
-
prefixChars.push(' ');
|
|
280
|
-
}
|
|
281
|
-
} else {
|
|
282
|
-
prefixChars.push(' ');
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return prefixChars.join('');
|
|
286
|
-
}
|
|
287
|
-
|