@bastani/atomic 0.9.13-alpha.2 → 0.9.13-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 +30 -0
- package/README.md +1 -1
- package/dist/builtin/i-have-adhd/package.json +1 -1
- package/dist/builtin/intercom/CHANGELOG.md +14 -0
- package/dist/builtin/intercom/README.md +12 -12
- package/dist/builtin/intercom/incoming-message-delivery.ts +1 -1
- package/dist/builtin/intercom/index.ts +1 -1
- package/dist/builtin/intercom/intercom-tool.ts +1 -1
- package/dist/builtin/intercom/intercom-utils.ts +3 -6
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/result-renderers.ts +1 -1
- package/dist/builtin/intercom/session-target.ts +1 -15
- package/dist/builtin/intercom/skills/intercom/SKILL.md +6 -6
- package/dist/builtin/intercom/terminal-ordering-barrier.ts +2 -2
- package/dist/builtin/intercom/ui/inline-message.ts +7 -5
- package/dist/builtin/intercom/ui/session-list.ts +23 -10
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +19 -0
- package/dist/builtin/subagents/README.md +29 -73
- package/dist/builtin/subagents/package.json +2 -2
- package/dist/builtin/subagents/prompts/parallel-cleanup.md +1 -1
- package/dist/builtin/subagents/prompts/parallel-review.md +1 -1
- package/dist/builtin/subagents/prompts/review-loop.md +2 -2
- package/dist/builtin/subagents/skills/subagent/SKILL.md +23 -59
- package/dist/builtin/subagents/skills/tmux/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/control-notices.ts +2 -3
- package/dist/builtin/subagents/src/extension/doctor.ts +2 -14
- package/dist/builtin/subagents/src/extension/fanout-child.ts +1 -17
- package/dist/builtin/subagents/src/extension/index.ts +9 -70
- package/dist/builtin/subagents/src/extension/notification-content.ts +1 -1
- package/dist/builtin/subagents/src/extension/prompt-guidance.ts +2 -2
- package/dist/builtin/subagents/src/extension/schemas.ts +2 -8
- package/dist/builtin/subagents/src/extension/tool-description.ts +2 -3
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +1 -1
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +5 -46
- package/dist/builtin/subagents/src/runs/{background → foreground}/completion-notification.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts +25 -88
- package/dist/builtin/subagents/src/runs/{background → foreground}/notify.ts +5 -5
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +11 -28
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +3 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-runtime.ts +0 -5
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +30 -20
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +4 -4
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +0 -13
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +104 -48
- package/dist/builtin/subagents/src/runs/inprocess/index.ts +1 -1
- package/dist/builtin/subagents/src/runs/inprocess/runner.ts +5 -5
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-api.ts +0 -7
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-core.ts +0 -10
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-projection.ts +3 -108
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-sanitize.ts +0 -4
- package/dist/builtin/subagents/src/runs/shared/subagent-control.ts +1 -1
- package/dist/builtin/subagents/src/shared/formatters.ts +3 -5
- package/dist/builtin/subagents/src/shared/model-resolution.ts +78 -0
- package/dist/builtin/subagents/src/shared/status-format.ts +4 -11
- package/dist/builtin/subagents/src/shared/types-config.ts +10 -9
- package/dist/builtin/subagents/src/shared/types-nested.ts +127 -0
- package/dist/builtin/subagents/src/shared/types-results.ts +2 -8
- package/dist/builtin/subagents/src/shared/types-runtime.ts +0 -9
- package/dist/builtin/subagents/src/shared/types.ts +1 -1
- package/dist/builtin/subagents/src/shared/utils.ts +1 -109
- package/dist/builtin/subagents/src/slash/slash-commands.ts +7 -17
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +2 -252
- package/dist/builtin/subagents/src/tui/render-layout.ts +4 -4
- package/dist/builtin/subagents/src/tui/render-result.ts +0 -9
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +1 -34
- package/dist/builtin/subagents/src/tui/render.ts +0 -2
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +23 -0
- package/dist/builtin/workflows/README.md +3 -3
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/durable/backend.ts +11 -0
- package/dist/builtin/workflows/src/durable/completed-catalog-stage-groups.ts +63 -25
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +166 -25
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +42 -24
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +2 -1
- package/dist/builtin/workflows/src/durable/run-timing.ts +28 -7
- package/dist/builtin/workflows/src/durable/scoped-backend.ts +4 -0
- package/dist/builtin/workflows/src/durable/targeted-inspection.ts +110 -0
- package/dist/builtin/workflows/src/engine/run-durable-stage-session.ts +2 -2
- package/dist/builtin/workflows/src/engine/runtime.ts +19 -2
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +3 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +750 -168
- package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +6 -0
- package/dist/builtin/workflows/src/extension/ui-surface.ts +4 -0
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +6 -1
- package/dist/builtin/workflows/src/extension/workflow-targets.ts +18 -10
- package/dist/builtin/workflows/src/extension/workflow-tool-inspection.ts +31 -16
- package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +75 -3
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +53 -6
- package/dist/builtin/workflows/src/runs/background/run-inspect.ts +5 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +94 -60
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-context.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +7 -7
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +25 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +4 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +142 -4
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +2 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-session-heartbeat.ts +88 -0
- package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +1 -0
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +1 -0
- package/dist/builtin/workflows/src/tui/run-detail.ts +25 -12
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +27 -8
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +17 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +20 -3
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +10 -1
- package/dist/builtin/workflows/src/tui/workflow-resume-selector.ts +1 -0
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +22 -5
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.d.ts.map +1 -1
- package/dist/core/agent-session-export.js +2 -1
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +10 -4
- 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-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +68 -0
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
- package/dist/core/agent-session-queue-pause.js +6 -0
- package/dist/core/agent-session-queue-pause.js.map +1 -1
- package/dist/core/agent-session-summary.d.ts +21 -0
- package/dist/core/agent-session-summary.d.ts.map +1 -0
- package/dist/core/agent-session-summary.js +156 -0
- package/dist/core/agent-session-summary.js.map +1 -0
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +0 -4
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-transfer.d.ts.map +1 -1
- package/dist/core/agent-session-transfer.js +0 -2
- package/dist/core/agent-session-transfer.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +6 -0
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session.d.ts +21 -3
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +22 -5
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.js +2 -2
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/session-summarization.d.ts +41 -0
- package/dist/core/compaction/session-summarization.d.ts.map +1 -0
- package/dist/core/compaction/session-summarization.js +97 -0
- package/dist/core/compaction/session-summarization.js.map +1 -0
- package/dist/core/extensions/ui-types.d.ts +4 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/keybindings.d.ts +0 -5
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +3 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +9 -1
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts +24 -1
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js +48 -0
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +10 -0
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +10 -1
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +3 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +5 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-types.d.ts +4 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/slash-commands.js +2 -2
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash.d.ts +0 -15
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +3 -81
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/fetch-url.d.ts +12 -0
- package/dist/core/tools/fetch-url.d.ts.map +1 -1
- package/dist/core/tools/fetch-url.js +76 -10
- package/dist/core/tools/fetch-url.js.map +1 -1
- package/dist/core/tools/index.js +4 -4
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/session-temp-dir.d.ts +2 -2
- package/dist/core/tools/session-temp-dir.d.ts.map +1 -1
- package/dist/core/tools/session-temp-dir.js +6 -7
- package/dist/core/tools/session-temp-dir.js.map +1 -1
- package/dist/core/usage-totals.js +1 -1
- package/dist/core/usage-totals.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/host-session-picker.d.ts.map +1 -1
- package/dist/modes/interactive/components/host-session-picker.js +1 -0
- package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +29 -4
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/transcript-follow-indicator.d.ts +14 -0
- package/dist/modes/interactive/components/transcript-follow-indicator.d.ts.map +1 -0
- package/dist/modes/interactive/components/transcript-follow-indicator.js +36 -0
- package/dist/modes/interactive/components/transcript-follow-indicator.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector-content.js +6 -0
- package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +3 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +0 -3
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +7 -1
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +3 -3
- 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-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +2 -5
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +6 -0
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-transcript-follow.d.ts +2 -0
- package/dist/modes/interactive/interactive-transcript-follow.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-transcript-follow.js +6 -0
- package/dist/modes/interactive/interactive-transcript-follow.js.map +1 -0
- package/dist/modes/interactive/interactive-tui.d.ts +13 -1
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +59 -1
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +2 -0
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +1 -0
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +1 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +5 -1
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +21 -9
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/docs/environment-variables.md +1 -1
- package/docs/intercom.md +20 -21
- package/docs/keybindings.md +2 -5
- package/docs/quickstart.md +5 -1
- package/docs/sdk.md +1 -1
- package/docs/session-format.md +15 -0
- package/docs/sessions.md +8 -0
- package/docs/settings.md +6 -0
- package/docs/subagents.md +19 -31
- package/docs/tools.md +3 -5
- package/docs/usage.md +3 -1
- package/docs/windows.md +1 -1
- package/docs/workflows.md +60 -32
- package/npm-shrinkwrap.json +29 -29
- package/package.json +2 -2
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +0 -331
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +0 -161
- package/dist/builtin/subagents/src/runs/inprocess/background-single.ts +0 -195
- package/dist/builtin/subagents/src/runs/inprocess/background.ts +0 -90
- package/dist/builtin/subagents/src/shared/types-async.ts +0 -247
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +0 -217
- package/dist/builtin/subagents/src/tui/render-widget.ts +0 -366
- package/dist/core/async/format.d.ts +0 -3
- package/dist/core/async/format.d.ts.map +0 -1
- package/dist/core/async/format.js +0 -52
- package/dist/core/async/format.js.map +0 -1
- package/dist/core/async/job-manager.d.ts +0 -40
- package/dist/core/async/job-manager.d.ts.map +0 -1
- package/dist/core/async/job-manager.js +0 -293
- package/dist/core/async/job-manager.js.map +0 -1
- package/dist/core/async/session-manager.d.ts +0 -16
- package/dist/core/async/session-manager.d.ts.map +0 -1
- package/dist/core/async/session-manager.js +0 -34
- package/dist/core/async/session-manager.js.map +0 -1
- package/dist/core/async/types.d.ts +0 -23
- package/dist/core/async/types.d.ts.map +0 -1
- package/dist/core/async/types.js +0 -2
- package/dist/core/async/types.js.map +0 -1
- package/dist/core/tools/bash-async-execution.d.ts +0 -27
- package/dist/core/tools/bash-async-execution.d.ts.map +0 -1
- package/dist/core/tools/bash-async-execution.js +0 -81
- package/dist/core/tools/bash-async-execution.js.map +0 -1
- package/dist/core/tools/bash-async-jobs.d.ts +0 -30
- package/dist/core/tools/bash-async-jobs.d.ts.map +0 -1
- package/dist/core/tools/bash-async-jobs.js +0 -87
- package/dist/core/tools/bash-async-jobs.js.map +0 -1
- package/dist/core/tools/bash-async-output.d.ts +0 -13
- package/dist/core/tools/bash-async-output.d.ts.map +0 -1
- package/dist/core/tools/bash-async-output.js +0 -122
- package/dist/core/tools/bash-async-output.js.map +0 -1
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.13-alpha.
|
|
3
|
+
"version": "0.9.13-alpha.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@bastani/atomic",
|
|
9
|
-
"version": "0.9.13-alpha.
|
|
9
|
+
"version": "0.9.13-alpha.4",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@bastani/atomic-natives": "0.9.13-alpha.
|
|
12
|
+
"@bastani/atomic-natives": "0.9.13-alpha.4",
|
|
13
13
|
"@dbos-inc/dbos-sdk": "4.24.16",
|
|
14
14
|
"@earendil-works/pi-agent-core": "^0.84.1",
|
|
15
15
|
"@earendil-works/pi-ai": "^0.84.1",
|
|
@@ -517,18 +517,18 @@
|
|
|
517
517
|
}
|
|
518
518
|
},
|
|
519
519
|
"node_modules/@bastani/atomic-natives": {
|
|
520
|
-
"version": "0.9.13-alpha.
|
|
521
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.13-alpha.
|
|
520
|
+
"version": "0.9.13-alpha.4",
|
|
521
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives/-/atomic-natives-0.9.13-alpha.4.tgz",
|
|
522
522
|
"license": "MIT",
|
|
523
523
|
"optionalDependencies": {
|
|
524
|
-
"@bastani/atomic-natives-darwin-arm64": "0.9.13-alpha.
|
|
525
|
-
"@bastani/atomic-natives-darwin-x64": "0.9.13-alpha.
|
|
526
|
-
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.13-alpha.
|
|
527
|
-
"@bastani/atomic-natives-linux-arm64-musl": "0.9.13-alpha.
|
|
528
|
-
"@bastani/atomic-natives-linux-x64-gnu": "0.9.13-alpha.
|
|
529
|
-
"@bastani/atomic-natives-linux-x64-musl": "0.9.13-alpha.
|
|
530
|
-
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.13-alpha.
|
|
531
|
-
"@bastani/atomic-natives-win32-x64-msvc": "0.9.13-alpha.
|
|
524
|
+
"@bastani/atomic-natives-darwin-arm64": "0.9.13-alpha.4",
|
|
525
|
+
"@bastani/atomic-natives-darwin-x64": "0.9.13-alpha.4",
|
|
526
|
+
"@bastani/atomic-natives-linux-arm64-gnu": "0.9.13-alpha.4",
|
|
527
|
+
"@bastani/atomic-natives-linux-arm64-musl": "0.9.13-alpha.4",
|
|
528
|
+
"@bastani/atomic-natives-linux-x64-gnu": "0.9.13-alpha.4",
|
|
529
|
+
"@bastani/atomic-natives-linux-x64-musl": "0.9.13-alpha.4",
|
|
530
|
+
"@bastani/atomic-natives-win32-arm64-msvc": "0.9.13-alpha.4",
|
|
531
|
+
"@bastani/atomic-natives-win32-x64-msvc": "0.9.13-alpha.4"
|
|
532
532
|
},
|
|
533
533
|
"engines": {
|
|
534
534
|
"bun": ">=1.3.14",
|
|
@@ -536,8 +536,8 @@
|
|
|
536
536
|
}
|
|
537
537
|
},
|
|
538
538
|
"node_modules/@bastani/atomic-natives-darwin-arm64": {
|
|
539
|
-
"version": "0.9.13-alpha.
|
|
540
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.13-alpha.
|
|
539
|
+
"version": "0.9.13-alpha.4",
|
|
540
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-arm64/-/atomic-natives-darwin-arm64-0.9.13-alpha.4.tgz",
|
|
541
541
|
"license": "MIT",
|
|
542
542
|
"os": [
|
|
543
543
|
"darwin"
|
|
@@ -548,8 +548,8 @@
|
|
|
548
548
|
"optional": true
|
|
549
549
|
},
|
|
550
550
|
"node_modules/@bastani/atomic-natives-darwin-x64": {
|
|
551
|
-
"version": "0.9.13-alpha.
|
|
552
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.13-alpha.
|
|
551
|
+
"version": "0.9.13-alpha.4",
|
|
552
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-darwin-x64/-/atomic-natives-darwin-x64-0.9.13-alpha.4.tgz",
|
|
553
553
|
"license": "MIT",
|
|
554
554
|
"os": [
|
|
555
555
|
"darwin"
|
|
@@ -560,8 +560,8 @@
|
|
|
560
560
|
"optional": true
|
|
561
561
|
},
|
|
562
562
|
"node_modules/@bastani/atomic-natives-linux-arm64-gnu": {
|
|
563
|
-
"version": "0.9.13-alpha.
|
|
564
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.13-alpha.
|
|
563
|
+
"version": "0.9.13-alpha.4",
|
|
564
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-gnu/-/atomic-natives-linux-arm64-gnu-0.9.13-alpha.4.tgz",
|
|
565
565
|
"license": "MIT",
|
|
566
566
|
"os": [
|
|
567
567
|
"linux"
|
|
@@ -575,8 +575,8 @@
|
|
|
575
575
|
"optional": true
|
|
576
576
|
},
|
|
577
577
|
"node_modules/@bastani/atomic-natives-linux-arm64-musl": {
|
|
578
|
-
"version": "0.9.13-alpha.
|
|
579
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.13-alpha.
|
|
578
|
+
"version": "0.9.13-alpha.4",
|
|
579
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-arm64-musl/-/atomic-natives-linux-arm64-musl-0.9.13-alpha.4.tgz",
|
|
580
580
|
"license": "MIT",
|
|
581
581
|
"os": [
|
|
582
582
|
"linux"
|
|
@@ -590,8 +590,8 @@
|
|
|
590
590
|
"optional": true
|
|
591
591
|
},
|
|
592
592
|
"node_modules/@bastani/atomic-natives-linux-x64-gnu": {
|
|
593
|
-
"version": "0.9.13-alpha.
|
|
594
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.13-alpha.
|
|
593
|
+
"version": "0.9.13-alpha.4",
|
|
594
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-gnu/-/atomic-natives-linux-x64-gnu-0.9.13-alpha.4.tgz",
|
|
595
595
|
"license": "MIT",
|
|
596
596
|
"os": [
|
|
597
597
|
"linux"
|
|
@@ -605,8 +605,8 @@
|
|
|
605
605
|
"optional": true
|
|
606
606
|
},
|
|
607
607
|
"node_modules/@bastani/atomic-natives-linux-x64-musl": {
|
|
608
|
-
"version": "0.9.13-alpha.
|
|
609
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.13-alpha.
|
|
608
|
+
"version": "0.9.13-alpha.4",
|
|
609
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-linux-x64-musl/-/atomic-natives-linux-x64-musl-0.9.13-alpha.4.tgz",
|
|
610
610
|
"license": "MIT",
|
|
611
611
|
"os": [
|
|
612
612
|
"linux"
|
|
@@ -620,8 +620,8 @@
|
|
|
620
620
|
"optional": true
|
|
621
621
|
},
|
|
622
622
|
"node_modules/@bastani/atomic-natives-win32-arm64-msvc": {
|
|
623
|
-
"version": "0.9.13-alpha.
|
|
624
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.13-alpha.
|
|
623
|
+
"version": "0.9.13-alpha.4",
|
|
624
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-arm64-msvc/-/atomic-natives-win32-arm64-msvc-0.9.13-alpha.4.tgz",
|
|
625
625
|
"license": "MIT",
|
|
626
626
|
"os": [
|
|
627
627
|
"win32"
|
|
@@ -632,8 +632,8 @@
|
|
|
632
632
|
"optional": true
|
|
633
633
|
},
|
|
634
634
|
"node_modules/@bastani/atomic-natives-win32-x64-msvc": {
|
|
635
|
-
"version": "0.9.13-alpha.
|
|
636
|
-
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.13-alpha.
|
|
635
|
+
"version": "0.9.13-alpha.4",
|
|
636
|
+
"resolved": "https://registry.npmjs.org/@bastani/atomic-natives-win32-x64-msvc/-/atomic-natives-win32-x64-msvc-0.9.13-alpha.4.tgz",
|
|
637
637
|
"license": "MIT",
|
|
638
638
|
"os": [
|
|
639
639
|
"win32"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/atomic",
|
|
3
|
-
"version": "0.9.13-alpha.
|
|
3
|
+
"version": "0.9.13-alpha.4",
|
|
4
4
|
"description": "Atomic coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"atomicConfig": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"prepublishOnly": "bun run clean && bun run build && bun run shrinkwrap"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@bastani/atomic-natives": "0.9.13-alpha.
|
|
86
|
+
"@bastani/atomic-natives": "0.9.13-alpha.4",
|
|
87
87
|
"@dbos-inc/dbos-sdk": "4.24.16",
|
|
88
88
|
"@earendil-works/pi-agent-core": "^0.84.1",
|
|
89
89
|
"@earendil-works/pi-ai": "^0.84.1",
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
4
|
-
import type { AsyncJobState, AsyncJobStep, AsyncStartedEvent, AsyncStatus, SubagentState } from "../../shared/types.ts";
|
|
5
|
-
import { renderWidget } from "../../tui/render.ts";
|
|
6
|
-
import { listSubagentControls } from "../inprocess/control-registry.ts";
|
|
7
|
-
|
|
8
|
-
interface AsyncJobTrackerOptions {
|
|
9
|
-
completionRetentionMs?: number;
|
|
10
|
-
resultsDir?: string;
|
|
11
|
-
pollIntervalMs?: number;
|
|
12
|
-
kill?: (pid: number, signal?: NodeJS.Signals | 0) => boolean;
|
|
13
|
-
now?: () => number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function ctxHasUI(ctx: ExtensionContext | null | undefined): boolean {
|
|
17
|
-
if (!ctx) return false;
|
|
18
|
-
try {
|
|
19
|
-
return ctx.hasUI;
|
|
20
|
-
} catch {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function liveUiContext(state: SubagentState): ExtensionContext | undefined {
|
|
26
|
-
const ctx = state.lastUiContext;
|
|
27
|
-
if (!ctx) return undefined;
|
|
28
|
-
try {
|
|
29
|
-
void ctx.hasUI;
|
|
30
|
-
return ctx;
|
|
31
|
-
} catch {
|
|
32
|
-
state.lastUiContext = null;
|
|
33
|
-
return undefined;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function stateFromStatus(status: AsyncStatus, asyncDir: string): AsyncJobState {
|
|
38
|
-
const steps = (status.steps ?? []).map((step, index) => ({ ...step, index }));
|
|
39
|
-
const completedSteps = steps.filter((step) => step.status === "complete" || step.status === "completed").length;
|
|
40
|
-
return {
|
|
41
|
-
asyncId: status.runId,
|
|
42
|
-
asyncDir,
|
|
43
|
-
status: status.state,
|
|
44
|
-
...(status.sessionId ? { sessionId: status.sessionId } : {}),
|
|
45
|
-
...(status.activityState ? { activityState: status.activityState } : {}),
|
|
46
|
-
...(status.lastActivityAt !== undefined ? { lastActivityAt: status.lastActivityAt } : {}),
|
|
47
|
-
...(status.currentTool ? { currentTool: status.currentTool } : {}),
|
|
48
|
-
...(status.currentToolStartedAt !== undefined ? { currentToolStartedAt: status.currentToolStartedAt } : {}),
|
|
49
|
-
...(status.currentPath ? { currentPath: status.currentPath } : {}),
|
|
50
|
-
...(status.turnCount !== undefined ? { turnCount: status.turnCount } : {}),
|
|
51
|
-
...(status.toolCount !== undefined ? { toolCount: status.toolCount } : {}),
|
|
52
|
-
mode: status.mode,
|
|
53
|
-
agents: steps.map((step) => step.agent),
|
|
54
|
-
steps,
|
|
55
|
-
stepsTotal: steps.length,
|
|
56
|
-
runningSteps: steps.filter((step) => step.status === "running").length,
|
|
57
|
-
completedSteps: status.state === "complete" ? steps.length : completedSteps,
|
|
58
|
-
startedAt: status.startedAt,
|
|
59
|
-
updatedAt: status.lastUpdate ?? status.startedAt,
|
|
60
|
-
...(status.sessionDir ? { sessionDir: status.sessionDir } : {}),
|
|
61
|
-
...(status.outputFile ? { outputFile: status.outputFile } : {}),
|
|
62
|
-
...(status.totalTokens ? { totalTokens: status.totalTokens } : {}),
|
|
63
|
-
...(status.sessionFile ? { sessionFile: status.sessionFile } : {}),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function readActiveFileJobs(
|
|
68
|
-
asyncDirRoot: string,
|
|
69
|
-
currentSessionId: string | null,
|
|
70
|
-
currentCwd: string,
|
|
71
|
-
): Map<string, AsyncJobState> {
|
|
72
|
-
const jobs = new Map<string, AsyncJobState>();
|
|
73
|
-
let entries: string[];
|
|
74
|
-
try {
|
|
75
|
-
entries = fs.readdirSync(asyncDirRoot);
|
|
76
|
-
} catch {
|
|
77
|
-
return jobs;
|
|
78
|
-
}
|
|
79
|
-
for (const entry of entries) {
|
|
80
|
-
const asyncDir = path.join(asyncDirRoot, entry);
|
|
81
|
-
let status: AsyncStatus;
|
|
82
|
-
try {
|
|
83
|
-
if (!fs.statSync(asyncDir).isDirectory()) continue;
|
|
84
|
-
status = JSON.parse(fs.readFileSync(path.join(asyncDir, "status.json"), "utf8")) as AsyncStatus;
|
|
85
|
-
} catch {
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (status.state !== "queued" && status.state !== "running") continue;
|
|
89
|
-
if (status.sessionId && currentSessionId && status.sessionId !== currentSessionId) continue;
|
|
90
|
-
if (!status.sessionId && status.cwd && path.resolve(status.cwd) !== path.resolve(currentCwd)) continue;
|
|
91
|
-
jobs.set(status.runId || entry, stateFromStatus({ ...status, runId: status.runId || entry }, asyncDir));
|
|
92
|
-
}
|
|
93
|
-
return jobs;
|
|
94
|
-
}
|
|
95
|
-
function stepFromStartedEvent(info: AsyncStartedEvent): AsyncJobStep | undefined {
|
|
96
|
-
if (!info.agent) return undefined;
|
|
97
|
-
return {
|
|
98
|
-
index: 0,
|
|
99
|
-
agent: info.agent,
|
|
100
|
-
status: "running",
|
|
101
|
-
...(info.model !== undefined ? { model: info.model } : {}),
|
|
102
|
-
...(info.thinking !== undefined ? { thinking: info.thinking } : {}),
|
|
103
|
-
...(info.fastMode !== undefined ? { fastMode: info.fastMode } : {}),
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function mergeRegistryJob(previous: AsyncJobState | undefined, next: AsyncJobState): AsyncJobState {
|
|
108
|
-
if (!previous) return next;
|
|
109
|
-
const previousSteps = previous.steps ?? [];
|
|
110
|
-
const steps = next.steps?.map((step, index) => {
|
|
111
|
-
const previousStep = previousSteps.find(
|
|
112
|
-
(candidate, candidateIndex) =>
|
|
113
|
-
(candidate.index ?? candidateIndex) === (step.index ?? index) && candidate.agent === step.agent,
|
|
114
|
-
);
|
|
115
|
-
if (!previousStep) return step;
|
|
116
|
-
return {
|
|
117
|
-
...step,
|
|
118
|
-
...previousStep,
|
|
119
|
-
index: step.index,
|
|
120
|
-
agent: step.agent,
|
|
121
|
-
status: step.status,
|
|
122
|
-
...(step.model !== undefined ? { model: step.model } : {}),
|
|
123
|
-
...(step.thinking !== undefined ? { thinking: step.thinking } : {}),
|
|
124
|
-
...(step.fastMode !== undefined ? { fastMode: step.fastMode } : {}),
|
|
125
|
-
};
|
|
126
|
-
});
|
|
127
|
-
return {
|
|
128
|
-
...next,
|
|
129
|
-
asyncDir: previous.asyncDir,
|
|
130
|
-
...(previous.sessionId !== undefined ? { sessionId: previous.sessionId } : {}),
|
|
131
|
-
...(previous.mode !== undefined ? { mode: previous.mode } : {}),
|
|
132
|
-
...(previous.agents !== undefined ? { agents: [...previous.agents] } : {}),
|
|
133
|
-
...(previous.startedAt !== undefined ? { startedAt: previous.startedAt } : {}),
|
|
134
|
-
...(previous.sessionDir !== undefined ? { sessionDir: previous.sessionDir } : {}),
|
|
135
|
-
...(previous.outputFile !== undefined ? { outputFile: previous.outputFile } : {}),
|
|
136
|
-
...(previous.sessionFile !== undefined ? { sessionFile: previous.sessionFile } : {}),
|
|
137
|
-
...(previous.updatedAt !== undefined
|
|
138
|
-
? { updatedAt: Math.max(previous.updatedAt, next.updatedAt ?? previous.updatedAt) }
|
|
139
|
-
: {}),
|
|
140
|
-
...(steps ? { steps } : {}),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function hydrateRegistryJobs(
|
|
145
|
-
state: SubagentState,
|
|
146
|
-
currentSessionId: string | null,
|
|
147
|
-
fileJobs?: Map<string, AsyncJobState>,
|
|
148
|
-
): Map<string, AsyncJobState> {
|
|
149
|
-
const jobs = new Map<string, AsyncJobState>();
|
|
150
|
-
for (const control of listSubagentControls()) {
|
|
151
|
-
const children = control.listChildren();
|
|
152
|
-
if (children.length === 0) continue;
|
|
153
|
-
const steps = children.map((child, index) => ({
|
|
154
|
-
index,
|
|
155
|
-
agent: child.taskName,
|
|
156
|
-
status:
|
|
157
|
-
child.status === "ok"
|
|
158
|
-
? ("complete" as const)
|
|
159
|
-
: child.status === "error"
|
|
160
|
-
? ("failed" as const)
|
|
161
|
-
: child.status === "interrupted"
|
|
162
|
-
? ("paused" as const)
|
|
163
|
-
: child.status === "running" || child.status === "continued"
|
|
164
|
-
? ("running" as const)
|
|
165
|
-
: ("pending" as const),
|
|
166
|
-
...control.getChildMetadata(child.path),
|
|
167
|
-
}));
|
|
168
|
-
const status: AsyncJobState["status"] = steps.some(
|
|
169
|
-
(step) => step.status === "running" || step.status === "pending",
|
|
170
|
-
)
|
|
171
|
-
? "running"
|
|
172
|
-
: steps.some((step) => step.status === "failed")
|
|
173
|
-
? "failed"
|
|
174
|
-
: steps.some((step) => step.status === "paused")
|
|
175
|
-
? "paused"
|
|
176
|
-
: "complete";
|
|
177
|
-
if (status !== "running") continue;
|
|
178
|
-
const next: AsyncJobState = {
|
|
179
|
-
asyncId: control.parent.path,
|
|
180
|
-
asyncDir: control.parent.path,
|
|
181
|
-
status,
|
|
182
|
-
sessionId: currentSessionId ?? undefined,
|
|
183
|
-
mode: steps.length > 1 ? "parallel" : "single",
|
|
184
|
-
agents: steps.map((step) => step.agent),
|
|
185
|
-
steps,
|
|
186
|
-
stepsTotal: steps.length,
|
|
187
|
-
runningSteps: steps.filter((step) => step.status === "running").length,
|
|
188
|
-
completedSteps: steps.filter((step) => step.status === "complete").length,
|
|
189
|
-
activeParallelGroup: steps.some((step) => step.status === "running"),
|
|
190
|
-
startedAt: Date.now(),
|
|
191
|
-
updatedAt: Date.now(),
|
|
192
|
-
};
|
|
193
|
-
const previous = state.asyncJobs.get(control.parent.path) ?? fileJobs?.get(control.parent.path);
|
|
194
|
-
jobs.set(control.parent.path, mergeRegistryJob(previous, next));
|
|
195
|
-
}
|
|
196
|
-
return jobs;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export function createAsyncJobTracker(
|
|
200
|
-
pi: Pick<ExtensionAPI, "events">,
|
|
201
|
-
state: SubagentState,
|
|
202
|
-
asyncDirRoot: string,
|
|
203
|
-
options: AsyncJobTrackerOptions = {},
|
|
204
|
-
): {
|
|
205
|
-
ensurePoller: () => void;
|
|
206
|
-
handleStarted: (data: unknown) => void;
|
|
207
|
-
handleComplete: (data: unknown) => void;
|
|
208
|
-
resetJobs: (ctx?: ExtensionContext) => void;
|
|
209
|
-
hydrateActiveJobs: (ctx?: ExtensionContext) => void;
|
|
210
|
-
hydrateActiveJobsDeferred: (ctx?: ExtensionContext) => void;
|
|
211
|
-
} {
|
|
212
|
-
const completionRetentionMs = options.completionRetentionMs ?? 10_000;
|
|
213
|
-
const rerender = () => {
|
|
214
|
-
const ctx = liveUiContext(state);
|
|
215
|
-
if (ctxHasUI(ctx)) renderWidget(ctx!, [...state.asyncJobs.values()], pi);
|
|
216
|
-
};
|
|
217
|
-
const scheduleCleanup = (id: string) => {
|
|
218
|
-
const previous = state.cleanupTimers.get(id);
|
|
219
|
-
if (previous) clearTimeout(previous);
|
|
220
|
-
const timer = setTimeout(() => {
|
|
221
|
-
state.cleanupTimers.delete(id);
|
|
222
|
-
state.asyncJobs.delete(id);
|
|
223
|
-
rerender();
|
|
224
|
-
}, completionRetentionMs);
|
|
225
|
-
timer.unref?.();
|
|
226
|
-
state.cleanupTimers.set(id, timer);
|
|
227
|
-
};
|
|
228
|
-
const ensurePoller = () => {
|
|
229
|
-
hydrateActiveJobs();
|
|
230
|
-
};
|
|
231
|
-
const safeCtxCwd = (ctx?: ExtensionContext): string | undefined => {
|
|
232
|
-
if (!ctx) return undefined;
|
|
233
|
-
try {
|
|
234
|
-
return ctx.cwd;
|
|
235
|
-
} catch {
|
|
236
|
-
// The extension ctx goes stale after session replacement or reload; a
|
|
237
|
-
// deferred hydration must degrade to the base cwd, never crash the host.
|
|
238
|
-
return undefined;
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
const hydrateActiveJobs = (ctx?: ExtensionContext, cwdOverride?: string) => {
|
|
242
|
-
if (ctxHasUI(ctx)) state.lastUiContext = ctx!;
|
|
243
|
-
const currentCwd = cwdOverride ?? safeCtxCwd(ctx) ?? state.baseCwd;
|
|
244
|
-
const fileJobs = readActiveFileJobs(asyncDirRoot, state.currentSessionId, currentCwd);
|
|
245
|
-
const registryJobs = hydrateRegistryJobs(state, state.currentSessionId, fileJobs);
|
|
246
|
-
const next = new Map([...fileJobs, ...registryJobs]);
|
|
247
|
-
for (const id of state.asyncJobs.keys())
|
|
248
|
-
if (!next.has(id) && !state.cleanupTimers.has(id)) state.asyncJobs.delete(id);
|
|
249
|
-
for (const [id, job] of next) state.asyncJobs.set(id, job);
|
|
250
|
-
rerender();
|
|
251
|
-
};
|
|
252
|
-
function terminalStepStatus(result: { success?: boolean; status?: string }): "complete" | "failed" | "paused" {
|
|
253
|
-
return result.status === "interrupted"
|
|
254
|
-
? "paused"
|
|
255
|
-
: result.status === "error" || result.status === "skipped" || result.success === false
|
|
256
|
-
? "failed"
|
|
257
|
-
: "complete";
|
|
258
|
-
}
|
|
259
|
-
const handleStarted = (data: unknown) => {
|
|
260
|
-
const info = data as AsyncStartedEvent;
|
|
261
|
-
if (!info.id) return;
|
|
262
|
-
const now = Date.now();
|
|
263
|
-
const step = stepFromStartedEvent(info);
|
|
264
|
-
state.asyncJobs.set(info.id, {
|
|
265
|
-
asyncId: info.id,
|
|
266
|
-
asyncDir: info.asyncDir ?? path.join(asyncDirRoot, info.id),
|
|
267
|
-
status: "running",
|
|
268
|
-
sessionId: info.sessionId,
|
|
269
|
-
mode: info.mode ?? (info.agents && info.agents.length > 1 ? "parallel" : "single"),
|
|
270
|
-
agents: info.agents ?? (info.agent ? [info.agent] : undefined),
|
|
271
|
-
...(step ? { steps: [step], stepsTotal: 1, runningSteps: 1, completedSteps: 0 } : {}),
|
|
272
|
-
startedAt: now,
|
|
273
|
-
updatedAt: now,
|
|
274
|
-
});
|
|
275
|
-
rerender();
|
|
276
|
-
};
|
|
277
|
-
const handleComplete = (data: unknown) => {
|
|
278
|
-
const result = data as {
|
|
279
|
-
id?: string;
|
|
280
|
-
success?: boolean;
|
|
281
|
-
status?: string;
|
|
282
|
-
result?: { model?: string; thinking?: string; fastMode?: boolean };
|
|
283
|
-
};
|
|
284
|
-
if (!result.id) return;
|
|
285
|
-
const job = state.asyncJobs.get(result.id);
|
|
286
|
-
if (job) {
|
|
287
|
-
const stepStatus = terminalStepStatus(result);
|
|
288
|
-
job.status = stepStatus;
|
|
289
|
-
if (job.steps?.length) {
|
|
290
|
-
const completed = result.result;
|
|
291
|
-
job.steps = job.steps.map((step, index) =>
|
|
292
|
-
index !== 0
|
|
293
|
-
? step
|
|
294
|
-
: {
|
|
295
|
-
...step,
|
|
296
|
-
status: stepStatus,
|
|
297
|
-
...(completed?.model !== undefined ? { model: completed.model } : {}),
|
|
298
|
-
...(completed?.thinking !== undefined ? { thinking: completed.thinking } : {}),
|
|
299
|
-
...(completed ? { fastMode: completed.fastMode ?? false } : {}),
|
|
300
|
-
},
|
|
301
|
-
);
|
|
302
|
-
job.runningSteps = job.steps.filter((step) => step.status === "running").length;
|
|
303
|
-
job.completedSteps = job.steps.filter((step) => step.status === "complete").length;
|
|
304
|
-
}
|
|
305
|
-
job.updatedAt = Date.now();
|
|
306
|
-
scheduleCleanup(result.id);
|
|
307
|
-
}
|
|
308
|
-
rerender();
|
|
309
|
-
};
|
|
310
|
-
const resetJobs = (ctx?: ExtensionContext) => {
|
|
311
|
-
for (const timer of state.cleanupTimers.values()) clearTimeout(timer);
|
|
312
|
-
state.cleanupTimers.clear();
|
|
313
|
-
state.asyncJobs.clear();
|
|
314
|
-
state.foregroundControls?.clear();
|
|
315
|
-
state.lastForegroundControlId = null;
|
|
316
|
-
state.resultFileCoalescer.clear();
|
|
317
|
-
if (ctxHasUI(ctx)) state.lastUiContext = ctx!;
|
|
318
|
-
};
|
|
319
|
-
let pending: ReturnType<typeof setTimeout> | null = null;
|
|
320
|
-
const hydrateActiveJobsDeferred = (ctx?: ExtensionContext) => {
|
|
321
|
-
if (ctxHasUI(ctx)) state.lastUiContext = ctx!;
|
|
322
|
-
const capturedCwd = safeCtxCwd(ctx);
|
|
323
|
-
if (pending) clearTimeout(pending);
|
|
324
|
-
pending = setTimeout(() => {
|
|
325
|
-
pending = null;
|
|
326
|
-
hydrateActiveJobs(undefined, capturedCwd);
|
|
327
|
-
}, 0);
|
|
328
|
-
pending.unref?.();
|
|
329
|
-
};
|
|
330
|
-
return { ensurePoller, handleStarted, handleComplete, resetJobs, hydrateActiveJobs, hydrateActiveJobsDeferred };
|
|
331
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { APP_NAME } from "@bastani/atomic";
|
|
2
|
-
import { normalizeSkillInput } from "../../agents/skills.ts";
|
|
3
|
-
import { resolveSubagentIntercomTarget } from "../../intercom/intercom-bridge.ts";
|
|
4
|
-
import { collectKnownModelProviders, toModelInfo } from "../../shared/model-info.ts";
|
|
5
|
-
import type { SingleResult, SubagentToolResult } from "../../shared/types.ts";
|
|
6
|
-
import {
|
|
7
|
-
resolveChildMaxSubagentDepth,
|
|
8
|
-
resolveSubagentDepthPolicy,
|
|
9
|
-
resolveTopLevelParallelMaxTasks,
|
|
10
|
-
workflowSessionMetadataFromContext,
|
|
11
|
-
wrapForkTask,
|
|
12
|
-
} from "../../shared/types.ts";
|
|
13
|
-
import { formatAsyncStartedMessage } from "../inprocess/background.ts";
|
|
14
|
-
import { inheritedIntercomGroup } from "../shared/intercom-group.js";
|
|
15
|
-
import { runParallelPath } from "./subagent-executor-parallel.ts";
|
|
16
|
-
import type { ExecutionContextData, ResolvedExecutorDeps } from "./subagent-executor-types.ts";
|
|
17
|
-
import { buildParallelModeError, buildParallelWorktreeTaskCwdError } from "./subagent-executor-worktree.ts";
|
|
18
|
-
|
|
19
|
-
function continuedResult(data: ExecutionContextData, mode: "single" | "parallel"): SingleResult {
|
|
20
|
-
const path = `${data.runId}/orchestration_1`;
|
|
21
|
-
return {
|
|
22
|
-
agent: mode,
|
|
23
|
-
task: data.params.task ?? `${mode} subagent run`,
|
|
24
|
-
status: "continued",
|
|
25
|
-
path,
|
|
26
|
-
envelope: "Child continued in background.",
|
|
27
|
-
detached: true,
|
|
28
|
-
detachedReason: "async-requested",
|
|
29
|
-
messages: [],
|
|
30
|
-
usage: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 },
|
|
31
|
-
progress: {
|
|
32
|
-
index: 0,
|
|
33
|
-
agent: mode,
|
|
34
|
-
status: "running",
|
|
35
|
-
task: data.params.task ?? `${mode} subagent run`,
|
|
36
|
-
recentTools: [],
|
|
37
|
-
recentOutput: [],
|
|
38
|
-
toolCount: 0,
|
|
39
|
-
turnCount: 0,
|
|
40
|
-
tokens: 0,
|
|
41
|
-
durationMs: 0,
|
|
42
|
-
lastActivityAt: Date.now(),
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function modeFor(data: ExecutionContextData): "single" | "parallel" {
|
|
48
|
-
if ((data.params.tasks?.length ?? 0) > 0) return "parallel";
|
|
49
|
-
return "single";
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function runForegroundInBackground(data: ExecutionContextData, deps: ResolvedExecutorDeps): void {
|
|
53
|
-
const backgroundData: ExecutionContextData = { ...data, effectiveAsync: false };
|
|
54
|
-
void runParallelPath(backgroundData, deps).catch((error) => {
|
|
55
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
56
|
-
console.error(`[${APP_NAME}-subagents] in-process async parallel failed: ${message}`);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Async is a don't-wait request over the same in-process foreground executor. */
|
|
61
|
-
export async function runAsyncPath(
|
|
62
|
-
data: ExecutionContextData,
|
|
63
|
-
deps: ResolvedExecutorDeps,
|
|
64
|
-
): Promise<SubagentToolResult | null> {
|
|
65
|
-
if (!data.effectiveAsync) return null;
|
|
66
|
-
|
|
67
|
-
const mode = modeFor(data);
|
|
68
|
-
const { params, effectiveCwd } = data;
|
|
69
|
-
if (mode === "parallel" && params.tasks) {
|
|
70
|
-
const maxParallelTasks = resolveTopLevelParallelMaxTasks(deps.config.parallel?.maxTasks);
|
|
71
|
-
if (params.tasks.length > maxParallelTasks) return buildParallelModeError(`Max ${maxParallelTasks} tasks`);
|
|
72
|
-
if (params.worktree) {
|
|
73
|
-
const worktreeTaskCwdError = buildParallelWorktreeTaskCwdError(params.tasks, effectiveCwd);
|
|
74
|
-
if (worktreeTaskCwdError) return buildParallelModeError(worktreeTaskCwdError);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (!deps.runtime.isAsyncAvailable()) {
|
|
78
|
-
return {
|
|
79
|
-
content: [
|
|
80
|
-
{
|
|
81
|
-
type: "text",
|
|
82
|
-
text: `Async mode requires the in-process runner but it could not be initialized. Ensure the ${APP_NAME}-subagents package is installed.`,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
isError: true,
|
|
86
|
-
details: { mode, results: [] },
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (mode === "single") {
|
|
91
|
-
const agent = data.agents.find((candidate) => candidate.name === params.agent);
|
|
92
|
-
if (!agent) {
|
|
93
|
-
return {
|
|
94
|
-
content: [{ type: "text", text: `Unknown agent: ${params.agent}` }],
|
|
95
|
-
isError: true,
|
|
96
|
-
details: { mode: "single", results: [] },
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
const availableModels = data.ctx.modelRegistry.getAvailable().map(toModelInfo);
|
|
100
|
-
const knownModelProviders = collectKnownModelProviders(data.ctx.modelRegistry);
|
|
101
|
-
const depthPolicy = resolveSubagentDepthPolicy(data.ctx, deps.config.maxSubagentDepth);
|
|
102
|
-
const normalizedSkills = normalizeSkillInput(params.skill);
|
|
103
|
-
const skills = normalizedSkills === false ? [] : normalizedSkills;
|
|
104
|
-
const task = params.context === "fork" ? wrapForkTask(params.task ?? "") : (params.task ?? "");
|
|
105
|
-
const childIntercomTarget = data.intercomBridge.active
|
|
106
|
-
? (childAgent: string, index: number) => resolveSubagentIntercomTarget(data.runId, childAgent, index)
|
|
107
|
-
: undefined;
|
|
108
|
-
const currentModel = data.ctx.model ? `${data.ctx.model.provider}/${data.ctx.model.id}` : undefined;
|
|
109
|
-
const modelOverride = params.model ?? agent.model;
|
|
110
|
-
return deps.runtime.executeAsyncSingle(data.runId, {
|
|
111
|
-
agent: params.agent!,
|
|
112
|
-
task,
|
|
113
|
-
group: params.group,
|
|
114
|
-
agentConfig: agent,
|
|
115
|
-
ctx: {
|
|
116
|
-
pi: deps.pi,
|
|
117
|
-
cwd: data.ctx.cwd,
|
|
118
|
-
currentSessionId: deps.state.currentSessionId ?? data.ctx.sessionManager.getSessionId(),
|
|
119
|
-
currentModelProvider: data.ctx.model?.provider,
|
|
120
|
-
currentModel,
|
|
121
|
-
intercomGroup: inheritedIntercomGroup(data.ctx),
|
|
122
|
-
workflowSessionMetadata: workflowSessionMetadataFromContext(data.ctx),
|
|
123
|
-
},
|
|
124
|
-
cwd: effectiveCwd,
|
|
125
|
-
maxOutput: params.maxOutput,
|
|
126
|
-
artifactsDir: data.artifactConfig.enabled ? data.artifactsDir : undefined,
|
|
127
|
-
artifactConfig: data.artifactConfig,
|
|
128
|
-
shareEnabled: data.shareEnabled,
|
|
129
|
-
sessionRoot: data.sessionRoot,
|
|
130
|
-
sessionFile: data.sessionFileForIndex(0),
|
|
131
|
-
skills,
|
|
132
|
-
output: params.output,
|
|
133
|
-
outputMode: params.outputMode,
|
|
134
|
-
progress: params.progress,
|
|
135
|
-
modelOverride,
|
|
136
|
-
availableModels,
|
|
137
|
-
knownModelProviders,
|
|
138
|
-
maxSubagentDepth: resolveChildMaxSubagentDepth(depthPolicy.maxSubagentDepth, agent.maxSubagentDepth),
|
|
139
|
-
parentDepth: data.parentDepth,
|
|
140
|
-
workflowStageSubagentGuard: depthPolicy.workflowStageSubagentGuard,
|
|
141
|
-
worktreeSetupHook: deps.config.worktreeSetupHook,
|
|
142
|
-
worktreeSetupHookTimeoutMs: deps.config.worktreeSetupHookTimeoutMs,
|
|
143
|
-
controlConfig: data.controlConfig,
|
|
144
|
-
controlIntercomTarget: data.intercomBridge.active ? data.intercomBridge.orchestratorTarget : undefined,
|
|
145
|
-
childIntercomTarget,
|
|
146
|
-
nestedRoute: data.nestedRoute,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const continued = continuedResult(data, mode);
|
|
151
|
-
if (mode === "parallel") runForegroundInBackground(data, deps);
|
|
152
|
-
return {
|
|
153
|
-
content: [{ type: "text", text: formatAsyncStartedMessage(`Async ${mode}: ${data.runId}`) }],
|
|
154
|
-
details: {
|
|
155
|
-
mode,
|
|
156
|
-
runId: data.runId,
|
|
157
|
-
asyncId: data.runId,
|
|
158
|
-
results: [continued],
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
}
|