@bastani/atomic 0.9.9 → 0.9.10-alpha.1
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 +66 -0
- package/README.md +2 -0
- package/dist/builtin/cursor/CHANGELOG.md +6 -0
- package/dist/builtin/cursor/package.json +3 -3
- package/dist/builtin/intercom/CHANGELOG.md +15 -0
- package/dist/builtin/intercom/README.md +12 -4
- package/dist/builtin/intercom/broker/broker.ts +96 -14
- package/dist/builtin/intercom/broker/client-message-validation.ts +39 -0
- package/dist/builtin/intercom/broker/client.ts +101 -92
- package/dist/builtin/intercom/broker/group-isolation.ts +28 -0
- package/dist/builtin/intercom/broker/send-handler.ts +62 -10
- package/dist/builtin/intercom/broker/send-signature.ts +3 -0
- package/dist/builtin/intercom/broker/supervisor-channel.ts +126 -0
- package/dist/builtin/intercom/closed-workflow-stage-message.ts +66 -0
- package/dist/builtin/intercom/config.ts +10 -0
- package/dist/builtin/intercom/contact-supervisor-tool.ts +14 -10
- package/dist/builtin/intercom/foreground-detach-handoff.ts +12 -2
- package/dist/builtin/intercom/group.ts +46 -0
- package/dist/builtin/intercom/inbound-message-admission.ts +79 -0
- package/dist/builtin/intercom/incoming-message-delivery.ts +49 -0
- package/dist/builtin/intercom/index-heavy.ts +148 -94
- package/dist/builtin/intercom/index.ts +66 -4
- package/dist/builtin/intercom/intercom-test-seams.ts +6 -0
- package/dist/builtin/intercom/intercom-tool.ts +71 -20
- package/dist/builtin/intercom/intercom-utils.ts +15 -2
- package/dist/builtin/intercom/late-stage-message-router.ts +148 -0
- package/dist/builtin/intercom/lifecycle.ts +10 -4
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/reconnect-backoff.ts +6 -0
- package/dist/builtin/intercom/reply-tracker.ts +8 -0
- package/dist/builtin/intercom/skills/intercom/SKILL.md +2 -0
- package/dist/builtin/intercom/stable-delivery-retry.ts +32 -0
- package/dist/builtin/intercom/subagent-relay.ts +67 -14
- package/dist/builtin/intercom/supervisor-authorization-registry.ts +22 -0
- package/dist/builtin/intercom/terminal-ordering-barrier.ts +144 -25
- package/dist/builtin/intercom/types.ts +18 -5
- package/dist/builtin/intercom/workflow-reply-tracker.ts +19 -0
- package/dist/builtin/intercom/workflow-stage-admission.ts +43 -0
- package/dist/builtin/intercom/workflow-stage-delivery-failure.ts +77 -0
- package/dist/builtin/mcp/CHANGELOG.md +11 -0
- package/dist/builtin/mcp/README.md +6 -2
- package/dist/builtin/mcp/config.ts +8 -8
- package/dist/builtin/mcp/direct-tool-executor.ts +7 -6
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/mcp/proxy-call.ts +5 -4
- package/dist/builtin/mcp/sampling-handler.ts +7 -2
- package/dist/builtin/mcp/tool-call-timeout.ts +101 -0
- package/dist/builtin/mcp/tool-result-renderer.ts +3 -2
- package/dist/builtin/mcp/types.ts +5 -0
- package/dist/builtin/mcp/ui-server.ts +3 -2
- package/dist/builtin/subagents/CHANGELOG.md +21 -0
- package/dist/builtin/subagents/README.md +6 -3
- package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
- package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-locator.md +1 -1
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +1 -1
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-locator.md +1 -1
- package/dist/builtin/subagents/agents/debugger.md +1 -1
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/subagents/skills/subagent/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.ts +37 -61
- package/dist/builtin/subagents/src/extension/notification-content.ts +80 -0
- package/dist/builtin/subagents/src/extension/schemas.ts +9 -0
- package/dist/builtin/subagents/src/extension/tool-description.ts +1 -0
- package/dist/builtin/subagents/src/intercom/supervisor-authorization.ts +23 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +4 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +2 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +4 -0
- package/dist/builtin/subagents/src/runs/background/async-job-tracker.ts +75 -13
- package/dist/builtin/subagents/src/runs/background/async-status.ts +19 -0
- package/dist/builtin/subagents/src/runs/background/completion-notification.ts +4 -3
- package/dist/builtin/subagents/src/runs/background/notify.ts +76 -15
- package/dist/builtin/subagents/src/runs/background/stale-run-reconciler.ts +1 -1
- package/dist/builtin/subagents/src/runs/background/subagent-runner-dynamic.ts +13 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-parallel.ts +1 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-sequential.ts +1 -0
- package/dist/builtin/subagents/src/runs/background/subagent-runner-step.ts +2 -1
- package/dist/builtin/subagents/src/runs/background/subagent-runner-types.ts +4 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +13 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-step.ts +19 -2
- package/dist/builtin/subagents/src/runs/foreground/detached-cleanup-barrier.ts +26 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +19 -30
- package/dist/builtin/subagents/src/runs/foreground/execution-intercom-detach.ts +47 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +60 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +21 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +21 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +6 -1
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/intercom-group.ts +50 -0
- package/dist/builtin/subagents/src/runs/shared/pi-args.ts +16 -0
- package/dist/builtin/subagents/src/runs/shared/worktree-post-create.ts +75 -0
- package/dist/builtin/subagents/src/runs/shared/worktree-root.ts +51 -0
- package/dist/builtin/subagents/src/runs/shared/worktree.ts +69 -77
- package/dist/builtin/subagents/src/shared/types-config.ts +6 -0
- package/dist/builtin/subagents/src/slash/slash-commands.ts +3 -2
- package/dist/builtin/subagents/src/tui/render-result-compact.ts +5 -3
- package/dist/builtin/subagents/src/tui/render-result.ts +5 -3
- package/dist/builtin/subagents/src/tui/render-widget-graph.ts +7 -4
- package/dist/builtin/web-access/CHANGELOG.md +11 -0
- package/dist/builtin/web-access/extract-frames.ts +14 -13
- package/dist/builtin/web-access/extract.ts +2 -2
- package/dist/builtin/web-access/gemini-api.ts +0 -3
- package/dist/builtin/web-access/gemini-web-config.ts +1 -3
- package/dist/builtin/web-access/gemini-web.ts +1 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/web-access/perplexity.ts +0 -3
- package/dist/builtin/web-access/result-renderers.ts +7 -5
- package/dist/builtin/web-access/subprocess.ts +100 -0
- package/dist/builtin/web-access/summary-review.ts +14 -3
- package/dist/builtin/web-access/video-extract.ts +12 -17
- package/dist/builtin/web-access/web-search-browser.ts +18 -10
- package/dist/builtin/web-access/web-search-summary.ts +9 -2
- package/dist/builtin/web-access/youtube-extract.ts +22 -25
- package/dist/builtin/workflows/CHANGELOG.md +77 -0
- package/dist/builtin/workflows/README.md +76 -38
- package/dist/builtin/workflows/ambient.d.ts +30 -0
- package/dist/builtin/workflows/builtin/adversarial-verification-prompts.ts +15 -0
- package/dist/builtin/workflows/builtin/adversarial-verification-runner.ts +93 -0
- package/dist/builtin/workflows/builtin/adversarial-verification.d.ts +11 -0
- package/dist/builtin/workflows/builtin/adversarial-verification.ts +24 -0
- package/dist/builtin/workflows/builtin/classify-and-act-prompts.ts +11 -0
- package/dist/builtin/workflows/builtin/classify-and-act-runner.ts +110 -0
- package/dist/builtin/workflows/builtin/classify-and-act.d.ts +24 -0
- package/dist/builtin/workflows/builtin/classify-and-act.ts +35 -0
- package/dist/builtin/workflows/builtin/deep-research-codebase-utils.ts +8 -2
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize-prompts.ts +11 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize-runner.ts +96 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.d.ts +23 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.ts +32 -0
- package/dist/builtin/workflows/builtin/generate-and-filter-prompts.ts +15 -0
- package/dist/builtin/workflows/builtin/generate-and-filter-runner.ts +75 -0
- package/dist/builtin/workflows/builtin/generate-and-filter.d.ts +11 -0
- package/dist/builtin/workflows/builtin/generate-and-filter.ts +26 -0
- package/dist/builtin/workflows/builtin/goal-models.ts +72 -0
- package/dist/builtin/workflows/builtin/goal-runner.ts +2 -64
- package/dist/builtin/workflows/builtin/index.d.ts +44 -0
- package/dist/builtin/workflows/builtin/index.ts +6 -0
- package/dist/builtin/workflows/builtin/loop-until-done-prompts.ts +79 -0
- package/dist/builtin/workflows/builtin/loop-until-done-runner.ts +189 -0
- package/dist/builtin/workflows/builtin/loop-until-done.d.ts +34 -0
- package/dist/builtin/workflows/builtin/loop-until-done.ts +31 -0
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +6 -1
- package/dist/builtin/workflows/builtin/pattern-artifact-root.ts +28 -0
- package/dist/builtin/workflows/builtin/ralph-models.ts +26 -5
- package/dist/builtin/workflows/builtin/ralph-runner.ts +1 -0
- package/dist/builtin/workflows/builtin/tournament-prompts.ts +79 -0
- package/dist/builtin/workflows/builtin/tournament-runner.ts +188 -0
- package/dist/builtin/workflows/builtin/tournament.d.ts +33 -0
- package/dist/builtin/workflows/builtin/tournament.ts +34 -0
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/authoring.d.ts +2 -6
- package/dist/builtin/workflows/src/durable/backend.ts +163 -120
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +37 -64
- package/dist/builtin/workflows/src/durable/completed-inspection.ts +4 -72
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +242 -195
- package/dist/builtin/workflows/src/durable/dbos-embedded-postgres.ts +207 -0
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +42 -42
- package/dist/builtin/workflows/src/durable/dbos-lifecycle.ts +155 -0
- package/dist/builtin/workflows/src/durable/dbos-local-postgres.ts +126 -0
- package/dist/builtin/workflows/src/durable/dbos-metadata.ts +105 -58
- package/dist/builtin/workflows/src/durable/dbos-prompt-reservations.ts +320 -0
- package/dist/builtin/workflows/src/durable/dbos-sdk-handle.ts +161 -0
- package/dist/builtin/workflows/src/durable/dbos-status-transition.ts +62 -0
- package/dist/builtin/workflows/src/durable/dbos-tombstone.ts +2 -2
- package/dist/builtin/workflows/src/durable/durable-hash.ts +20 -0
- package/dist/builtin/workflows/src/durable/factory.ts +23 -83
- package/dist/builtin/workflows/src/durable/format-version.ts +4 -10
- package/dist/builtin/workflows/src/durable/index.ts +16 -20
- package/dist/builtin/workflows/src/durable/local-command.ts +63 -0
- package/dist/builtin/workflows/src/durable/prompt-reservation-state.ts +177 -0
- package/dist/builtin/workflows/src/durable/prompt-reservations.ts +36 -0
- package/dist/builtin/workflows/src/durable/resume-catalog.ts +2 -200
- package/dist/builtin/workflows/src/durable/resume-eligibility.ts +42 -2
- package/dist/builtin/workflows/src/durable/resume-runtime.ts +121 -118
- package/dist/builtin/workflows/src/durable/retention-policy.ts +42 -0
- package/dist/builtin/workflows/src/durable/run-timing.ts +98 -0
- package/dist/builtin/workflows/src/durable/scoped-backend.ts +62 -14
- package/dist/builtin/workflows/src/durable/stage-primitive.ts +15 -2
- package/dist/builtin/workflows/src/durable/tool-primitive.ts +11 -7
- package/dist/builtin/workflows/src/durable/types.ts +25 -18
- package/dist/builtin/workflows/src/durable/ui-primitive.ts +117 -29
- package/dist/builtin/workflows/src/durable/workflow-status-transition.ts +30 -0
- package/dist/builtin/workflows/src/engine/primitives/parallel.ts +20 -5
- package/dist/builtin/workflows/src/engine/primitives/task.ts +3 -2
- package/dist/builtin/workflows/src/engine/primitives/ui.ts +6 -3
- package/dist/builtin/workflows/src/engine/run-durable-finalize.ts +14 -22
- package/dist/builtin/workflows/src/engine/run-durable-stage-session.ts +14 -14
- package/dist/builtin/workflows/src/engine/run.ts +35 -37
- package/dist/builtin/workflows/src/engine/runtime.ts +3 -0
- package/dist/builtin/workflows/src/engine/workflow-activity.ts +9 -0
- package/dist/builtin/workflows/src/extension/completed-stage-intercom-ask.ts +155 -0
- package/dist/builtin/workflows/src/extension/config-file-loader.ts +13 -0
- package/dist/builtin/workflows/src/extension/config-loader.ts +20 -0
- package/dist/builtin/workflows/src/extension/dispatcher.ts +56 -17
- package/dist/builtin/workflows/src/extension/extension-factory.ts +13 -10
- package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +37 -59
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +16 -18
- package/dist/builtin/workflows/src/extension/lifecycle-notification-delivery.ts +83 -0
- package/dist/builtin/workflows/src/extension/lifecycle-notifications.ts +80 -41
- package/dist/builtin/workflows/src/extension/postmortem-deps.ts +73 -0
- package/dist/builtin/workflows/src/extension/public-types.ts +11 -51
- package/dist/builtin/workflows/src/extension/render-call.ts +3 -9
- package/dist/builtin/workflows/src/extension/render-result.ts +22 -7
- package/dist/builtin/workflows/src/extension/runtime-active-block-claim.ts +78 -0
- package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +50 -29
- package/dist/builtin/workflows/src/extension/runtime.ts +70 -219
- package/dist/builtin/workflows/src/extension/ui-surface.ts +107 -3
- package/dist/builtin/workflows/src/extension/wiring.ts +76 -7
- package/dist/builtin/workflows/src/extension/workflow-command-completions.ts +10 -5
- package/dist/builtin/workflows/src/extension/workflow-command-registration.ts +27 -5
- package/dist/builtin/workflows/src/extension/workflow-durable-resume-command.ts +49 -19
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +8 -8
- package/dist/builtin/workflows/src/extension/workflow-resume-picker-rows.ts +81 -0
- package/dist/builtin/workflows/src/extension/workflow-resume-shadow.ts +55 -0
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +193 -145
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +9 -133
- package/dist/builtin/workflows/src/extension/workflow-status-summary.ts +189 -0
- package/dist/builtin/workflows/src/extension/workflow-targets.ts +1 -1
- package/dist/builtin/workflows/src/extension/workflow-tool-content.ts +78 -3
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +185 -89
- package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +92 -11
- package/dist/builtin/workflows/src/extension/workflow-tool.ts +18 -24
- package/dist/builtin/workflows/src/runs/background/durable-resume-transition.ts +63 -0
- package/dist/builtin/workflows/src/runs/background/quit.ts +139 -29
- package/dist/builtin/workflows/src/runs/background/resume-acknowledgements.ts +97 -0
- package/dist/builtin/workflows/src/runs/background/run-inspect.ts +111 -0
- package/dist/builtin/workflows/src/runs/background/runner.ts +46 -17
- package/dist/builtin/workflows/src/runs/background/startup-admission.ts +77 -0
- package/dist/builtin/workflows/src/runs/background/status.ts +133 -224
- package/dist/builtin/workflows/src/runs/background/workflow-lifecycle-aggregate.ts +44 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +57 -256
- package/dist/builtin/workflows/src/runs/foreground/executor-hil.ts +7 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-lifecycle.ts +12 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +39 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-queued-user-message.ts +75 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +44 -12
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +63 -12
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-factory.ts +30 -4
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +3 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-types.ts +4 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts +0 -67
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +6 -0
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +0 -1
- package/dist/builtin/workflows/src/runs/foreground/postmortem-stage-chat.ts +169 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +38 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-candidate.ts +21 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +21 -3
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +85 -84
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-message-admission.ts +195 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +12 -5
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-replacement.ts +42 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-send-user-message.ts +100 -8
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-session-options.ts +51 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +19 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +28 -2
- package/dist/builtin/workflows/src/runs/shared/prompt-callsite.ts +4 -6
- package/dist/builtin/workflows/src/runs/shared/worktree-git-runner.ts +89 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-git.ts +29 -133
- package/dist/builtin/workflows/src/runs/shared/worktree-post-create.ts +130 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-root.ts +84 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-setup.ts +77 -63
- package/dist/builtin/workflows/src/runs/shared/worktree-types.ts +4 -0
- package/dist/builtin/workflows/src/sdk-surface.ts +1 -1
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +29 -22
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.ts +26 -24
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +5 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +5 -0
- package/dist/builtin/workflows/src/shared/intercom-group.ts +51 -0
- package/dist/builtin/workflows/src/shared/persistence-restore-helpers.ts +6 -0
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +4 -0
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +3 -0
- package/dist/builtin/workflows/src/shared/prompt-callsite-context.ts +13 -0
- package/dist/builtin/workflows/src/shared/returned-run-status.ts +2 -1
- package/dist/builtin/workflows/src/shared/session-transcript.ts +74 -0
- package/dist/builtin/workflows/src/shared/store-stage-methods.ts +1 -0
- package/dist/builtin/workflows/src/shared/store-types.ts +8 -0
- package/dist/builtin/workflows/src/shared/timing.ts +4 -1
- package/dist/builtin/workflows/src/shared/types.ts +2 -6
- package/dist/builtin/workflows/src/tui/chat-surface-message.ts +2 -42
- package/dist/builtin/workflows/src/tui/dispatch-confirm.ts +2 -2
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +7 -3
- package/dist/builtin/workflows/src/tui/graph-view-input.ts +29 -67
- package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +15 -10
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +0 -2
- package/dist/builtin/workflows/src/tui/graph-view-types.ts +3 -9
- package/dist/builtin/workflows/src/tui/host-input-form.ts +62 -0
- package/dist/builtin/workflows/src/tui/mouse-input.ts +63 -0
- package/dist/builtin/workflows/src/tui/node-card.ts +1 -0
- package/dist/builtin/workflows/src/tui/overlay-adapter.ts +67 -42
- package/dist/builtin/workflows/src/tui/overlay-terminal-modes.ts +49 -0
- package/dist/builtin/workflows/src/tui/session-overlays.ts +3 -104
- package/dist/builtin/workflows/src/tui/session-picker.ts +3 -12
- package/dist/builtin/workflows/src/tui/stage-chat-composer-drafts.ts +19 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +30 -10
- package/dist/builtin/workflows/src/tui/stage-chat-view-footer-status.ts +19 -9
- package/dist/builtin/workflows/src/tui/stage-chat-view-input.ts +25 -38
- package/dist/builtin/workflows/src/tui/stage-chat-view-render-helpers.ts +1 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +7 -6
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +7 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +3 -1
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +19 -20
- package/dist/builtin/workflows/src/tui/switcher.ts +4 -4
- package/dist/builtin/workflows/src/tui/widget.ts +46 -33
- package/dist/builtin/workflows/src/tui/workflow-attach-pane-handle.ts +26 -0
- package/dist/builtin/workflows/src/tui/workflow-attach-pane-types.ts +14 -2
- package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +26 -27
- package/dist/builtin/workflows/src/tui/workflow-resume-selector.ts +208 -69
- package/dist/bun/cli.js +3 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +3 -0
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +19 -2
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.js +2 -2
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +5 -3
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.js +1 -1
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts +2 -4
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +9 -2
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +6 -0
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +107 -36
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +18 -7
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-models.d.ts +3 -1
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +1 -1
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.d.ts +16 -0
- package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -0
- package/dist/core/agent-session-post-tool-compaction.js +113 -0
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -0
- package/dist/core/agent-session-prompt.d.ts +12 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +22 -5
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +3 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +21 -0
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +2 -1
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +7 -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 +6 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +18 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/async/job-manager.d.ts +1 -0
- package/dist/core/async/job-manager.d.ts.map +1 -1
- package/dist/core/async/job-manager.js +29 -5
- package/dist/core/async/job-manager.js.map +1 -1
- package/dist/core/async/session-manager.d.ts +2 -4
- package/dist/core/async/session-manager.d.ts.map +1 -1
- package/dist/core/async/session-manager.js +5 -32
- package/dist/core/async/session-manager.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +2 -0
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/auth-storage.d.ts +20 -10
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +151 -92
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/callback-activity.d.ts +27 -0
- package/dist/core/callback-activity.d.ts.map +1 -0
- package/dist/core/callback-activity.js +44 -0
- package/dist/core/callback-activity.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +4 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +4 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction-boundary.d.ts +1 -1
- package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
- package/dist/core/compaction/compaction-boundary.js +10 -23
- package/dist/core/compaction/compaction-boundary.js.map +1 -1
- package/dist/core/compaction/compaction-runner.d.ts +4 -1
- package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/compaction-runner.js +1 -1
- package/dist/core/compaction/compaction-runner.js.map +1 -1
- package/dist/core/compaction/compaction-types.d.ts +3 -2
- package/dist/core/compaction/compaction-types.d.ts.map +1 -1
- package/dist/core/compaction/compaction-types.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +6 -6
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +12 -9
- package/dist/core/compaction/compaction.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/range-planner-diagnostics.d.ts +101 -0
- package/dist/core/compaction/range-planner-diagnostics.d.ts.map +1 -0
- package/dist/core/compaction/range-planner-diagnostics.js +116 -0
- package/dist/core/compaction/range-planner-diagnostics.js.map +1 -0
- package/dist/core/compaction/range-planner.d.ts +13 -3
- package/dist/core/compaction/range-planner.d.ts.map +1 -1
- package/dist/core/compaction/range-planner.js +117 -68
- package/dist/core/compaction/range-planner.js.map +1 -1
- package/dist/core/compaction/truncated-range-recovery.d.ts +47 -0
- package/dist/core/compaction/truncated-range-recovery.d.ts.map +1 -0
- package/dist/core/compaction/truncated-range-recovery.js +112 -0
- package/dist/core/compaction/truncated-range-recovery.js.map +1 -0
- package/dist/core/extensions/api-types.d.ts +2 -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/context-types.d.ts +23 -1
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/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.js +2 -2
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-core.d.ts.map +1 -1
- package/dist/core/extensions/loader-core.js +8 -1
- package/dist/core/extensions/loader-core.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +9 -6
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/message-types.d.ts +17 -0
- package/dist/core/extensions/message-types.d.ts.map +1 -1
- package/dist/core/extensions/message-types.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +3 -0
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runner-events.d.ts.map +1 -1
- package/dist/core/extensions/runner-events.js +11 -10
- package/dist/core/extensions/runner-events.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +2 -2
- 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/ui-types.d.ts +78 -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/model-registry-auth.d.ts +2 -1
- package/dist/core/model-registry-auth.d.ts.map +1 -1
- package/dist/core/model-registry-auth.js +25 -6
- package/dist/core/model-registry-auth.js.map +1 -1
- package/dist/core/model-registry-builtins.d.ts +3 -2
- package/dist/core/model-registry-builtins.d.ts.map +1 -1
- package/dist/core/model-registry-builtins.js +12 -6
- package/dist/core/model-registry-builtins.js.map +1 -1
- package/dist/core/model-registry-dynamic.d.ts +1 -0
- package/dist/core/model-registry-dynamic.d.ts.map +1 -1
- package/dist/core/model-registry-dynamic.js +53 -13
- package/dist/core/model-registry-dynamic.js.map +1 -1
- package/dist/core/model-registry-loader.d.ts +2 -1
- package/dist/core/model-registry-loader.d.ts.map +1 -1
- package/dist/core/model-registry-loader.js +2 -2
- package/dist/core/model-registry-loader.js.map +1 -1
- package/dist/core/model-registry-types.d.ts +10 -3
- package/dist/core/model-registry-types.d.ts.map +1 -1
- package/dist/core/model-registry-types.js.map +1 -1
- package/dist/core/model-registry.d.ts +15 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +214 -30
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/models-store.d.ts +25 -0
- package/dist/core/models-store.d.ts.map +1 -0
- package/dist/core/models-store.js +73 -0
- package/dist/core/models-store.js.map +1 -0
- package/dist/core/oauth-compat.d.ts +17 -0
- package/dist/core/oauth-compat.d.ts.map +1 -0
- package/dist/core/oauth-compat.js +2 -0
- package/dist/core/oauth-compat.js.map +1 -0
- package/dist/core/oauth-provider-bridge.d.ts +40 -0
- package/dist/core/oauth-provider-bridge.d.ts.map +1 -0
- package/dist/core/oauth-provider-bridge.js +169 -0
- package/dist/core/oauth-provider-bridge.js.map +1 -0
- package/dist/core/output-guard.d.ts +2 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +14 -0
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts +5 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -0
- package/dist/core/remote-catalog-provider.js +138 -0
- package/dist/core/remote-catalog-provider.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +8 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +1 -1
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts +1 -1
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +2 -2
- package/dist/core/session-manager-history.js +2 -2
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +65 -23
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +3 -2
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +9 -5
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -3
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/find.js +2 -2
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.js +2 -2
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.js +2 -2
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +4 -3
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/todos-render.d.ts.map +1 -1
- package/dist/core/tools/todos-render.js +3 -2
- package/dist/core/tools/todos-render.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +3 -2
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/write.js +2 -2
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +29 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -0
- package/dist/core/workflow-stage-admission.js +81 -0
- package/dist/core/workflow-stage-admission.js.map +1 -0
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/main-types.d.ts +13 -0
- package/dist/main-types.d.ts.map +1 -0
- package/dist/main-types.js +2 -0
- package/dist/main-types.js.map +1 -0
- package/dist/main.d.ts +2 -5
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +25 -17
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +17 -12
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/atomic-banner.d.ts +7 -0
- package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
- package/dist/modes/interactive/components/atomic-banner.js +20 -0
- package/dist/modes/interactive/components/atomic-banner.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +5 -3
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +3 -4
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +4 -0
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +4 -0
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +79 -8
- package/dist/modes/interactive/components/chat-session-host-events.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 +4 -2
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +1 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +4 -1
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.js +3 -4
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
- package/dist/modes/interactive/components/host-input-form-mount.d.ts +14 -0
- package/dist/modes/interactive/components/host-input-form-mount.d.ts.map +1 -0
- package/dist/modes/interactive/components/host-input-form-mount.js +79 -0
- package/dist/modes/interactive/components/host-input-form-mount.js.map +1 -0
- package/dist/modes/interactive/components/host-input-form.d.ts +52 -0
- package/dist/modes/interactive/components/host-input-form.d.ts.map +1 -0
- package/dist/modes/interactive/components/host-input-form.js +278 -0
- package/dist/modes/interactive/components/host-input-form.js.map +1 -0
- package/dist/modes/interactive/components/host-session-picker.d.ts +46 -0
- package/dist/modes/interactive/components/host-session-picker.d.ts.map +1 -0
- package/dist/modes/interactive/components/host-session-picker.js +183 -0
- package/dist/modes/interactive/components/host-session-picker.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts +2 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +12 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +3 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +8 -2
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +7 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +57 -10
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +15 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +35 -3
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +3 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +24 -10
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +7 -1
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +3 -3
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +49 -0
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.js +2 -0
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-context.js +14 -0
- package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-global-clear.d.ts +13 -0
- package/dist/modes/interactive/interactive-global-clear.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-global-clear.js +11 -0
- package/dist/modes/interactive/interactive-global-clear.js.map +1 -0
- package/dist/modes/interactive/interactive-input-handling.js +17 -10
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +6 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +25 -2
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +4 -3
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +2 -2
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +4 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +14 -1
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +3 -2
- 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-types.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +7 -4
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +2 -2
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +25 -4
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +3 -0
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +5 -2
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +22 -9
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-terminal-title.d.ts +6 -0
- package/dist/modes/interactive/interactive-terminal-title.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-terminal-title.js +7 -0
- package/dist/modes/interactive/interactive-terminal-title.js.map +1 -0
- package/dist/modes/interactive-engine/activity-watchdog.d.ts +45 -0
- package/dist/modes/interactive-engine/activity-watchdog.d.ts.map +1 -0
- package/dist/modes/interactive-engine/activity-watchdog.js +74 -0
- package/dist/modes/interactive-engine/activity-watchdog.js.map +1 -0
- package/dist/modes/interactive-engine/create-isolated-runtime.d.ts +14 -0
- package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -0
- package/dist/modes/interactive-engine/create-isolated-runtime.js +56 -0
- package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -0
- package/dist/modes/interactive-engine/engine-args.d.ts +10 -0
- package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-args.js +55 -0
- package/dist/modes/interactive-engine/engine-args.js.map +1 -0
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts +7 -0
- package/dist/modes/interactive-engine/engine-child-liveness.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-child-liveness.js +50 -0
- package/dist/modes/interactive-engine/engine-child-liveness.js.map +1 -0
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +47 -0
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-custom-ui.js +276 -0
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -0
- package/dist/modes/interactive-engine/engine-input-form.d.ts +13 -0
- package/dist/modes/interactive-engine/engine-input-form.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-input-form.js +49 -0
- package/dist/modes/interactive-engine/engine-input-form.js.map +1 -0
- package/dist/modes/interactive-engine/engine-monitor.d.ts +18 -0
- package/dist/modes/interactive-engine/engine-monitor.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-monitor.js +63 -0
- package/dist/modes/interactive-engine/engine-monitor.js.map +1 -0
- package/dist/modes/interactive-engine/engine-render-service.d.ts +17 -0
- package/dist/modes/interactive-engine/engine-render-service.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-render-service.js +150 -0
- package/dist/modes/interactive-engine/engine-render-service.js.map +1 -0
- package/dist/modes/interactive-engine/engine-session-picker.d.ts +22 -0
- package/dist/modes/interactive-engine/engine-session-picker.d.ts.map +1 -0
- package/dist/modes/interactive-engine/engine-session-picker.js +106 -0
- package/dist/modes/interactive-engine/engine-session-picker.js.map +1 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +23 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.js +126 -0
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -0
- package/dist/modes/interactive-engine/input-form-host.d.ts +15 -0
- package/dist/modes/interactive-engine/input-form-host.d.ts.map +1 -0
- package/dist/modes/interactive-engine/input-form-host.js +44 -0
- package/dist/modes/interactive-engine/input-form-host.js.map +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +75 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.js +448 -0
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -0
- package/dist/modes/interactive-engine/protocol.d.ts +184 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -0
- package/dist/modes/interactive-engine/protocol.js +254 -0
- package/dist/modes/interactive-engine/protocol.js.map +1 -0
- package/dist/modes/interactive-engine/remote-command-catalog.d.ts +33 -0
- package/dist/modes/interactive-engine/remote-command-catalog.d.ts.map +1 -0
- package/dist/modes/interactive-engine/remote-command-catalog.js +51 -0
- package/dist/modes/interactive-engine/remote-command-catalog.js.map +1 -0
- package/dist/modes/interactive-engine/remote-component.d.ts +16 -0
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -0
- package/dist/modes/interactive-engine/remote-component.js +209 -0
- package/dist/modes/interactive-engine/remote-component.js.map +1 -0
- package/dist/modes/interactive-engine/remote-frame-clamp.d.ts +25 -0
- package/dist/modes/interactive-engine/remote-frame-clamp.d.ts.map +1 -0
- package/dist/modes/interactive-engine/remote-frame-clamp.js +43 -0
- package/dist/modes/interactive-engine/remote-frame-clamp.js.map +1 -0
- package/dist/modes/interactive-engine/remote-renderer.d.ts +59 -0
- package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -0
- package/dist/modes/interactive-engine/remote-renderer.js +123 -0
- package/dist/modes/interactive-engine/remote-renderer.js.map +1 -0
- package/dist/modes/interactive-engine/session-picker-host.d.ts +25 -0
- package/dist/modes/interactive-engine/session-picker-host.d.ts.map +1 -0
- package/dist/modes/interactive-engine/session-picker-host.js +75 -0
- package/dist/modes/interactive-engine/session-picker-host.js.map +1 -0
- package/dist/modes/interactive-engine/terminal-mode-controller.d.ts +43 -0
- package/dist/modes/interactive-engine/terminal-mode-controller.d.ts.map +1 -0
- package/dist/modes/interactive-engine/terminal-mode-controller.js +109 -0
- package/dist/modes/interactive-engine/terminal-mode-controller.js.map +1 -0
- package/dist/modes/rpc/bounded-writer.d.ts +27 -0
- package/dist/modes/rpc/bounded-writer.d.ts.map +1 -0
- package/dist/modes/rpc/bounded-writer.js +103 -0
- package/dist/modes/rpc/bounded-writer.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +15 -12
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js +102 -28
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +83 -0
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client-api.js +64 -0
- package/dist/modes/rpc/rpc-client-api.js.map +1 -0
- package/dist/modes/rpc/rpc-client-process.d.ts +19 -0
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client-process.js +79 -0
- package/dist/modes/rpc/rpc-client-process.js.map +1 -0
- package/dist/modes/rpc/rpc-client-waits.d.ts +8 -0
- package/dist/modes/rpc/rpc-client-waits.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client-waits.js +33 -0
- package/dist/modes/rpc/rpc-client-waits.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +48 -124
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +295 -249
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts +5 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +79 -3
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.d.ts +11 -0
- package/dist/modes/rpc/rpc-event-buffer.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-event-buffer.js +30 -0
- package/dist/modes/rpc/rpc-event-buffer.js.map +1 -0
- package/dist/modes/rpc/rpc-extension-ui.d.ts +7 -1
- package/dist/modes/rpc/rpc-extension-ui.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-extension-ui.js +54 -32
- package/dist/modes/rpc/rpc-extension-ui.js.map +1 -1
- package/dist/modes/rpc/rpc-input-scheduler.d.ts +16 -0
- package/dist/modes/rpc/rpc-input-scheduler.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-input-scheduler.js +69 -0
- package/dist/modes/rpc/rpc-input-scheduler.js.map +1 -0
- package/dist/modes/rpc/rpc-input.d.ts +2 -1
- package/dist/modes/rpc/rpc-input.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-input.js +4 -9
- package/dist/modes/rpc/rpc-input.js.map +1 -1
- package/dist/modes/rpc/rpc-keybindings-reload.d.ts +27 -0
- package/dist/modes/rpc/rpc-keybindings-reload.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-keybindings-reload.js +69 -0
- package/dist/modes/rpc/rpc-keybindings-reload.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +63 -8
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-output-buffer.d.ts +10 -0
- package/dist/modes/rpc/rpc-output-buffer.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-output-buffer.js +70 -0
- package/dist/modes/rpc/rpc-output-buffer.js.map +1 -0
- package/dist/modes/rpc/rpc-session-binding.d.ts +16 -1
- package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +16 -3
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +109 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli-parser.d.ts +2 -0
- package/dist/package-manager-cli-parser.d.ts.map +1 -1
- package/dist/package-manager-cli-parser.js +24 -5
- package/dist/package-manager-cli-parser.js.map +1 -1
- package/dist/package-manager-cli.d.ts +7 -0
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +65 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/shell.d.ts +1 -0
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +46 -0
- package/dist/utils/shell.js.map +1 -1
- package/docs/changelog.mdx +11 -0
- package/docs/compaction.md +53 -17
- package/docs/custom-provider.md +24 -5
- package/docs/development.md +9 -7
- package/docs/docs.json +1 -0
- package/docs/extensions.md +30 -16
- package/docs/intercom.md +489 -0
- package/docs/json.md +1 -1
- package/docs/keybindings.md +1 -1
- package/docs/packages.md +1 -0
- package/docs/quickstart.md +11 -5
- package/docs/rpc.md +9 -7
- package/docs/sdk.md +6 -0
- package/docs/session-format.md +7 -6
- package/docs/sessions.md +4 -2
- package/docs/settings.md +2 -2
- package/docs/subagents.md +7 -2
- package/docs/tui.md +61 -2
- package/docs/usage.md +6 -5
- package/docs/workflows.md +2572 -1379
- package/examples/extensions/handoff.ts +1 -1
- package/examples/extensions/qna.ts +1 -1
- package/examples/extensions/summarize.ts +1 -1
- package/npm-shrinkwrap.json +225 -76
- package/package.json +7 -6
- package/dist/builtin/workflows/src/durable/file-backend.ts +0 -439
- package/dist/builtin/workflows/src/durable/file-lock.ts +0 -153
- package/dist/builtin/workflows/src/durable/file-state.ts +0 -104
- package/dist/builtin/workflows/src/extension/runtime-direct.ts +0 -96
- package/dist/builtin/workflows/src/extension/workflow-tool-helpers.ts +0 -66
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-output.ts +0 -91
- package/dist/builtin/workflows/src/runs/foreground/executor-direct.ts +0 -282
- package/dist/builtin/workflows/src/shared/resumable-workflow-notices.ts +0 -43
- package/dist/builtin/workflows/src/tui/session-confirm.ts +0 -299
|
@@ -3,7 +3,7 @@ import * as fs from "node:fs";
|
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import type { AgentToolResult } from "@earendil-works/pi-agent-core";
|
|
6
|
-
import { APP_NAME, getEnvValue } from "@bastani/atomic";
|
|
6
|
+
import { APP_NAME, getEnvValue, keyHintIfBound } from "@bastani/atomic";
|
|
7
7
|
import { type ExtensionAPI, type ExtensionContext, type ToolDefinition } from "@bastani/atomic";
|
|
8
8
|
import { Box, Container, Spacer, Text, truncateToWidth, visibleWidth, wrapTextWithAnsi, type Component } from "@earendil-works/pi-tui";
|
|
9
9
|
import { discoverAgents } from "../agents/agents.ts";
|
|
@@ -23,6 +23,7 @@ import registerFanoutChildSubagentExtension from "./fanout-child.ts";
|
|
|
23
23
|
import { formatDuration, shortenPath } from "../shared/formatters.ts";
|
|
24
24
|
import { loadConfig } from "./config.ts";
|
|
25
25
|
import { DEFAULT_PROMPT_GUIDANCE } from "./prompt-guidance.ts";
|
|
26
|
+
import { parseSubagentNotifyContent } from "./notification-content.ts";
|
|
26
27
|
import { SUBAGENT_TOOL_DESCRIPTION } from "./tool-description.ts";
|
|
27
28
|
export { SUBAGENT_TOOL_DESCRIPTION } from "./tool-description.ts";
|
|
28
29
|
import { type Details, type SubagentState, ASYNC_DIR, DEFAULT_ARTIFACT_CONFIG, RESULTS_DIR, SLASH_RESULT_TYPE, SUBAGENT_ASYNC_COMPLETE_EVENT, SUBAGENT_ASYNC_STARTED_EVENT, SUBAGENT_CONTROL_EVENT } from "../shared/types.ts";
|
|
@@ -98,36 +99,39 @@ function createSlashResultComponent(
|
|
|
98
99
|
};
|
|
99
100
|
return container;
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
export function renderSubagentNotification(
|
|
103
|
+
message: { content: unknown; details?: unknown },
|
|
104
|
+
options: { expanded: boolean },
|
|
105
|
+
theme: ExtensionContext["ui"]["theme"],
|
|
106
|
+
): Text {
|
|
107
|
+
const content = typeof message.content === "string" ? message.content : "";
|
|
108
|
+
const details = (message.details as SubagentNotifyDetails | undefined) ?? parseSubagentNotifyContent(content);
|
|
109
|
+
if (!details) return new Text(content, 0, 0);
|
|
110
|
+
const icon = details.status === "completed"
|
|
111
|
+
? theme.fg("success", "✓")
|
|
112
|
+
: details.status === "paused"
|
|
113
|
+
? theme.fg("warning", "■")
|
|
114
|
+
: theme.fg("error", "✗");
|
|
115
|
+
const parts: string[] = [];
|
|
116
|
+
if (details.taskInfo) parts.push(details.taskInfo);
|
|
117
|
+
if (details.durationMs !== undefined) parts.push(formatDuration(details.durationMs));
|
|
118
|
+
let text = `${icon} ${theme.bold(details.agent)} ${theme.fg("dim", details.status)}`;
|
|
119
|
+
if (parts.length > 0) text += ` ${theme.fg("dim", "·")} ${parts.map((part) => theme.fg("dim", part)).join(` ${theme.fg("dim", "·")} `)}`;
|
|
120
|
+
const trimmedPreview = details.resultPreview.trim();
|
|
121
|
+
const previewLines = options.expanded
|
|
122
|
+
? trimmedPreview.split("\n").filter((line) => line.trim())
|
|
123
|
+
: [trimmedPreview.split("\n", 1)[0] ?? ""].filter((line) => line.trim());
|
|
124
|
+
for (const line of previewLines.length > 0 ? previewLines : ["(no output)"]) {
|
|
125
|
+
text += `\n ${theme.fg("dim", `⎿ ${line}`)}`;
|
|
113
126
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
let sessionLabel: string | undefined;
|
|
118
|
-
let sessionValue: string | undefined;
|
|
119
|
-
if (sessionLine) {
|
|
120
|
-
const separator = sessionLine.indexOf(":");
|
|
121
|
-
sessionLabel = sessionLine.slice(0, separator).toLowerCase();
|
|
122
|
-
sessionValue = sessionLine.slice(separator + 1).trim();
|
|
127
|
+
if (!options.expanded && trimmedPreview.includes("\n")) {
|
|
128
|
+
const expandHint = keyHintIfBound("app.tools.expand", "full notification");
|
|
129
|
+
if (expandHint) text += `\n ${expandHint}`;
|
|
123
130
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
resultPreview,
|
|
129
|
-
...(sessionLabel && sessionValue ? { sessionLabel, sessionValue } : {}),
|
|
130
|
-
};
|
|
131
|
+
if (details.sessionLabel && details.sessionValue) {
|
|
132
|
+
text += `\n ${theme.fg("muted", `${details.sessionLabel}: ${shortenPath(details.sessionValue)}`)}`;
|
|
133
|
+
}
|
|
134
|
+
return new Text(text, 0, 0);
|
|
131
135
|
}
|
|
132
136
|
class SubagentControlNoticeComponent implements Component {
|
|
133
137
|
constructor(
|
|
@@ -197,7 +201,7 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
197
201
|
registrationFailureCleanups.push(() => maintenance.stop());
|
|
198
202
|
maintenance.startResultWatcherDeferred();
|
|
199
203
|
maintenance.primeExistingResultsDeferred();
|
|
200
|
-
const { ensurePoller, handleStarted, handleComplete, resetJobs,
|
|
204
|
+
const { ensurePoller, handleStarted, handleComplete, resetJobs, hydrateActiveJobsDeferred } = createAsyncJobTracker(pi, state, ASYNC_DIR);
|
|
201
205
|
const executor = createSubagentExecutor({
|
|
202
206
|
pi,
|
|
203
207
|
state,
|
|
@@ -213,35 +217,7 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
213
217
|
if (!details) return undefined;
|
|
214
218
|
return createSlashResultComponent(details, options, theme, pi);
|
|
215
219
|
});
|
|
216
|
-
pi.registerMessageRenderer<SubagentNotifyDetails>("subagent-notify",
|
|
217
|
-
const content = typeof message.content === "string" ? message.content : "";
|
|
218
|
-
const details = (message.details as SubagentNotifyDetails | undefined) ?? parseSubagentNotifyContent(content);
|
|
219
|
-
if (!details) return new Text(content, 0, 0);
|
|
220
|
-
const icon = details.status === "completed"
|
|
221
|
-
? theme.fg("success", "✓")
|
|
222
|
-
: details.status === "paused"
|
|
223
|
-
? theme.fg("warning", "■")
|
|
224
|
-
: theme.fg("error", "✗");
|
|
225
|
-
const parts: string[] = [];
|
|
226
|
-
if (details.taskInfo) parts.push(details.taskInfo);
|
|
227
|
-
if (details.durationMs !== undefined) parts.push(formatDuration(details.durationMs));
|
|
228
|
-
let text = `${icon} ${theme.bold(details.agent)} ${theme.fg("dim", details.status)}`;
|
|
229
|
-
if (parts.length > 0) text += ` ${theme.fg("dim", "·")} ${parts.map((part) => theme.fg("dim", part)).join(` ${theme.fg("dim", "·")} `)}`;
|
|
230
|
-
const trimmedPreview = details.resultPreview.trim();
|
|
231
|
-
const previewLines = options.expanded
|
|
232
|
-
? trimmedPreview.split("\n").filter((line) => line.trim())
|
|
233
|
-
: [trimmedPreview.split("\n", 1)[0] ?? ""].filter((line) => line.trim());
|
|
234
|
-
for (const line of previewLines.length > 0 ? previewLines : ["(no output)"]) {
|
|
235
|
-
text += `\n ${theme.fg("dim", `⎿ ${line}`)}`;
|
|
236
|
-
}
|
|
237
|
-
if (!options.expanded && trimmedPreview.includes("\n")) {
|
|
238
|
-
text += `\n ${theme.fg("dim", "ctrl+o full notification")}`;
|
|
239
|
-
}
|
|
240
|
-
if (details.sessionLabel && details.sessionValue) {
|
|
241
|
-
text += `\n ${theme.fg("muted", `${details.sessionLabel}: ${shortenPath(details.sessionValue)}`)}`;
|
|
242
|
-
}
|
|
243
|
-
return new Text(text, 0, 0);
|
|
244
|
-
});
|
|
220
|
+
pi.registerMessageRenderer<SubagentNotifyDetails>("subagent-notify", renderSubagentNotification);
|
|
245
221
|
pi.registerMessageRenderer<SubagentControlMessageDetails>(SUBAGENT_CONTROL_MESSAGE_TYPE, (message, _options, theme) => {
|
|
246
222
|
const details = message.details as SubagentControlMessageDetails | undefined;
|
|
247
223
|
if (!details?.event) return undefined;
|
|
@@ -422,7 +398,7 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
422
398
|
if (!lifecycle.isCurrent() || event.toolName !== "subagent") return;
|
|
423
399
|
if (!ctx.hasUI) return;
|
|
424
400
|
state.lastUiContext = ctx;
|
|
425
|
-
|
|
401
|
+
hydrateActiveJobsDeferred(ctx);
|
|
426
402
|
if (state.asyncJobs.size > 0) ensurePoller();
|
|
427
403
|
});
|
|
428
404
|
const cleanupSessionArtifacts = (ctx: ExtensionContext) => {
|
|
@@ -435,7 +411,7 @@ export default function registerSubagentExtension(pi: ExtensionAPI): void {
|
|
|
435
411
|
cleanupSessionArtifacts(ctx);
|
|
436
412
|
clearPendingForegroundControlNotices(state);
|
|
437
413
|
resetJobs(ctx);
|
|
438
|
-
|
|
414
|
+
hydrateActiveJobsDeferred(ctx);
|
|
439
415
|
restoreSlashFinalSnapshots(ctx.sessionManager.getEntries(), pi);
|
|
440
416
|
maintenance.primeExistingResultsDeferred();
|
|
441
417
|
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { SubagentNotifyDetails } from "../runs/background/notify.ts";
|
|
2
|
+
|
|
3
|
+
const HEADER_PREFIXES = [
|
|
4
|
+
["Background task completed: **", "completed"],
|
|
5
|
+
["Background task failed: **", "failed"],
|
|
6
|
+
["Background task paused: **", "paused"],
|
|
7
|
+
] as const;
|
|
8
|
+
|
|
9
|
+
function isHeaderLineTerminator(character: string): boolean {
|
|
10
|
+
return character === "\r" || character === "\u2028" || character === "\u2029";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function isWhitespace(character: string | undefined): boolean {
|
|
14
|
+
return character !== undefined && character.trim() === "";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function parseHeader(header: string): Pick<SubagentNotifyDetails, "agent" | "status" | "taskInfo"> | undefined {
|
|
18
|
+
const matchedPrefix = HEADER_PREFIXES.find(([prefix]) => header.startsWith(prefix));
|
|
19
|
+
if (!matchedPrefix) return undefined;
|
|
20
|
+
const [prefix, status] = matchedPrefix;
|
|
21
|
+
const suffix = header.slice(prefix.length);
|
|
22
|
+
|
|
23
|
+
if (suffix.endsWith("**")) {
|
|
24
|
+
const agent = suffix.slice(0, -2);
|
|
25
|
+
if (!agent || [...agent].some(isHeaderLineTerminator)) return undefined;
|
|
26
|
+
return { agent, status };
|
|
27
|
+
}
|
|
28
|
+
if (!suffix.endsWith(")")) return undefined;
|
|
29
|
+
|
|
30
|
+
const lastInteriorClose = suffix.lastIndexOf(")", suffix.length - 2);
|
|
31
|
+
let index = 1;
|
|
32
|
+
while (index < suffix.length - 1) {
|
|
33
|
+
if (suffix[index] !== "*" || suffix[index + 1] !== "*") {
|
|
34
|
+
index += 1;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
let taskStart = index + 2;
|
|
38
|
+
if (!isWhitespace(suffix[taskStart])) {
|
|
39
|
+
index += 1;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
while (isWhitespace(suffix[taskStart])) taskStart += 1;
|
|
43
|
+
if (suffix[taskStart] === "(" && taskStart > lastInteriorClose) {
|
|
44
|
+
const agent = suffix.slice(0, index);
|
|
45
|
+
if ([...agent].some(isHeaderLineTerminator)) return undefined;
|
|
46
|
+
return { agent, status, taskInfo: suffix.slice(taskStart) };
|
|
47
|
+
}
|
|
48
|
+
index = taskStart;
|
|
49
|
+
}
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function parseSubagentNotifyContent(content: string): SubagentNotifyDetails | undefined {
|
|
54
|
+
const lines = content.split("\n");
|
|
55
|
+
const parsedHeader = parseHeader(lines[0] ?? "");
|
|
56
|
+
if (!parsedHeader) return undefined;
|
|
57
|
+
const body = lines.slice(2);
|
|
58
|
+
let sessionIndex = -1;
|
|
59
|
+
for (let i = body.length - 1; i >= 1; i--) {
|
|
60
|
+
if (body[i - 1]?.trim() === "" && /^(Session|Session file|Session share error):\s+/.test(body[i]!)) {
|
|
61
|
+
sessionIndex = i;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const sessionLine = sessionIndex >= 0 ? body[sessionIndex] : undefined;
|
|
66
|
+
const resultLines = sessionIndex >= 0 ? body.slice(0, sessionIndex) : body;
|
|
67
|
+
const resultPreview = resultLines.join("\n").trim() || "(no output)";
|
|
68
|
+
let sessionLabel: string | undefined;
|
|
69
|
+
let sessionValue: string | undefined;
|
|
70
|
+
if (sessionLine) {
|
|
71
|
+
const separator = sessionLine.indexOf(":");
|
|
72
|
+
sessionLabel = sessionLine.slice(0, separator).toLowerCase();
|
|
73
|
+
sessionValue = sessionLine.slice(separator + 1).trim();
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
...parsedHeader,
|
|
77
|
+
resultPreview,
|
|
78
|
+
...(sessionLabel && sessionValue ? { sessionLabel, sessionValue } : {}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -54,6 +54,10 @@ const MaxOutputSchema = Type.Object({
|
|
|
54
54
|
lines: Type.Optional(Type.Number()),
|
|
55
55
|
}, { additionalProperties: false });
|
|
56
56
|
|
|
57
|
+
const GroupSchema = Type.Union([Type.String(), Type.Boolean()], {
|
|
58
|
+
description: "Intercom group for spawned children. A named string joins that group; boolean `true` or the trimmed, case-insensitive string sentinel `true`/`auto` auto-generates one shared UUID group per parallel set. The names `true` and `auto` are reserved; use a different literal group name. Defaults to the current session/stage's group. Only applied when the child has intercom access; contact_supervisor still reaches the supervisor across groups.",
|
|
59
|
+
});
|
|
60
|
+
|
|
57
61
|
const TaskItem = Type.Object({
|
|
58
62
|
agent: Type.String(),
|
|
59
63
|
task: Type.String(),
|
|
@@ -65,6 +69,7 @@ const TaskItem = Type.Object({
|
|
|
65
69
|
progress: Type.Optional(Type.Boolean({ description: "Enable progress.md tracking for this task" })),
|
|
66
70
|
model: Type.Optional(Type.String({ description: "Override model for this task (e.g. 'google/gemini-3-pro')" })),
|
|
67
71
|
skill: Type.Optional(SkillOverride),
|
|
72
|
+
group: Type.Optional(GroupSchema),
|
|
68
73
|
});
|
|
69
74
|
|
|
70
75
|
// Parallel task item (within a parallel step)
|
|
@@ -83,6 +88,7 @@ const ParallelTaskSchema = Type.Object({
|
|
|
83
88
|
progress: Type.Optional(Type.Boolean({ description: "Enable progress.md tracking in {chain_dir}" })),
|
|
84
89
|
skill: Type.Optional(SkillOverride),
|
|
85
90
|
model: Type.Optional(Type.String({ description: "Override model for this task" })),
|
|
91
|
+
group: Type.Optional(GroupSchema),
|
|
86
92
|
});
|
|
87
93
|
|
|
88
94
|
const DynamicExpandSchema = Type.Object({
|
|
@@ -109,6 +115,7 @@ const DynamicParallelTemplateSchema = Type.Object({
|
|
|
109
115
|
progress: Type.Optional(Type.Boolean({ description: "Enable progress.md tracking in {chain_dir}" })),
|
|
110
116
|
skill: Type.Optional(SkillOverride),
|
|
111
117
|
model: Type.Optional(Type.String({ description: "Override model for this task" })),
|
|
118
|
+
group: Type.Optional(GroupSchema),
|
|
112
119
|
}, { additionalProperties: false });
|
|
113
120
|
|
|
114
121
|
const DynamicCollectSchema = Type.Object({
|
|
@@ -147,6 +154,7 @@ const ChainItem = Type.Object({
|
|
|
147
154
|
worktree: Type.Optional(Type.Boolean({
|
|
148
155
|
description: "Create isolated git worktrees for each parallel task."
|
|
149
156
|
})),
|
|
157
|
+
group: Type.Optional(GroupSchema),
|
|
150
158
|
}, {
|
|
151
159
|
description: "Chain step: use {agent, task?, ...} for sequential, {parallel: [...]} for static concurrent execution, or {expand, parallel: {...}, collect} for dynamic fanout.",
|
|
152
160
|
additionalProperties: false,
|
|
@@ -203,6 +211,7 @@ export const SubagentParams = Type.Object({
|
|
|
203
211
|
description: `PARALLEL mode: [{agent, task, count?, output?, outputMode?, reads?, progress?}, ...]. Maximum ${MAX_PARALLEL_TASKS} tasks after count expansion.`,
|
|
204
212
|
})),
|
|
205
213
|
concurrency: Type.Optional(Type.Integer({ minimum: 1, description: "Top-level PARALLEL mode only: max concurrent tasks. Defaults to config.parallel.concurrency or 4." })),
|
|
214
|
+
group: Type.Optional(GroupSchema),
|
|
206
215
|
worktree: Type.Optional(Type.Boolean({
|
|
207
216
|
description: "Create isolated git worktrees for each parallel task. " +
|
|
208
217
|
"Prevents filesystem conflicts. Requires clean git state. " +
|
|
@@ -9,6 +9,7 @@ EXECUTION (use exactly ONE mode):
|
|
|
9
9
|
• PARALLEL: { tasks: [{agent,task,count?,output?,reads?,progress?}, ...], concurrency?: number, worktree?: true } - independent concurrent tasks (worktree: isolate each task in a git worktree)
|
|
10
10
|
• Optional context: { context: "fresh" | "fork" } (default: if any requested agent has defaultContext: "fork", the whole invocation uses fork; otherwise "fresh"; inspect agent defaults via { action: "list" })
|
|
11
11
|
• async:true is selective for genuinely long-running/background work; foreground is appropriate when the parent needs the result before proceeding
|
|
12
|
+
• group (string | true) sets the intercom group for spawned children so same-group subagents can intercom each other but stay isolated from other groups. Boolean true or the trimmed, case-insensitive string sentinel "true"/"auto" auto-generates one shared group per parallel set; those names are reserved and cannot be literal groups. Defaults to the current session/stage's group (subagents inherit their launching stage's group). Only applied when the child has intercom access; contact_supervisor still reaches the supervisor across groups.
|
|
12
13
|
CHAIN TEMPLATE VARIABLES (use in task strings):
|
|
13
14
|
• {task} - The original task/request from the user
|
|
14
15
|
• {previous} - Text response from the previous step (empty for first step)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IntercomEventBus } from "../shared/types.ts";
|
|
2
|
+
|
|
3
|
+
export const SUBAGENT_SUPERVISOR_AUTHORIZATION_EVENT = "subagent:supervisor-authorization";
|
|
4
|
+
|
|
5
|
+
export interface SupervisorAuthorization {
|
|
6
|
+
capability: string;
|
|
7
|
+
supervisorSessionId: string;
|
|
8
|
+
childName: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Ask the parent Intercom extension to mint a broker-issued child capability. */
|
|
12
|
+
export async function requestSupervisorAuthorization(
|
|
13
|
+
events: IntercomEventBus | undefined,
|
|
14
|
+
childName: string | undefined,
|
|
15
|
+
): Promise<SupervisorAuthorization | undefined> {
|
|
16
|
+
const normalizedChildName = childName?.trim();
|
|
17
|
+
if (!events || !normalizedChildName) return undefined;
|
|
18
|
+
const request: { childName: string; completion?: Promise<SupervisorAuthorization> } = {
|
|
19
|
+
childName: normalizedChildName,
|
|
20
|
+
};
|
|
21
|
+
events.emit(SUBAGENT_SUPERVISOR_AUTHORIZATION_EVENT, request);
|
|
22
|
+
return request.completion ? await request.completion : undefined;
|
|
23
|
+
}
|
|
@@ -54,6 +54,8 @@ export function executeAsyncChain(
|
|
|
54
54
|
controlConfig,
|
|
55
55
|
controlIntercomTarget,
|
|
56
56
|
childIntercomTarget,
|
|
57
|
+
supervisorAuthorizations,
|
|
58
|
+
dynamicSupervisorAuthorizations,
|
|
57
59
|
nestedRoute,
|
|
58
60
|
} = params;
|
|
59
61
|
const resultMode = params.resultMode ?? "chain";
|
|
@@ -292,6 +294,8 @@ export function executeAsyncChain(
|
|
|
292
294
|
controlConfig,
|
|
293
295
|
controlIntercomTarget,
|
|
294
296
|
childIntercomTargets,
|
|
297
|
+
supervisorAuthorizations,
|
|
298
|
+
dynamicSupervisorAuthorizations,
|
|
295
299
|
resultMode,
|
|
296
300
|
dynamicFanoutMaxItems: params.dynamicFanoutMaxItems,
|
|
297
301
|
workflowGraph,
|
|
@@ -47,6 +47,7 @@ export function executeAsyncSingle(
|
|
|
47
47
|
controlConfig,
|
|
48
48
|
controlIntercomTarget,
|
|
49
49
|
childIntercomTarget,
|
|
50
|
+
supervisorAuthorization,
|
|
50
51
|
nestedRoute,
|
|
51
52
|
spawnRunner = defaultSpawnRunner,
|
|
52
53
|
} = params;
|
|
@@ -159,6 +160,7 @@ export function executeAsyncSingle(
|
|
|
159
160
|
controlConfig,
|
|
160
161
|
controlIntercomTarget,
|
|
161
162
|
childIntercomTargets: childIntercomTarget ? [childIntercomTarget(agent, 0)] : undefined,
|
|
163
|
+
supervisorAuthorizations: supervisorAuthorization ? [supervisorAuthorization] : undefined,
|
|
162
164
|
resultMode: "single",
|
|
163
165
|
nestedRoute: nestedRoute ?? inheritedNestedRoute,
|
|
164
166
|
workflowStageSubagentGuard,
|
|
@@ -2,6 +2,7 @@ import type { ExtensionAPI, SessionWorkflowMetadata } from "@bastani/atomic";
|
|
|
2
2
|
import type { AgentConfig } from "../../agents/agents.ts";
|
|
3
3
|
import type { ChainStep } from "../../shared/settings.ts";
|
|
4
4
|
import type { AvailableModelInfo } from "../shared/model-fallback.ts";
|
|
5
|
+
import type { SupervisorAuthorization } from "../../intercom/supervisor-authorization.ts";
|
|
5
6
|
import type {
|
|
6
7
|
ArtifactConfig,
|
|
7
8
|
Details,
|
|
@@ -44,6 +45,8 @@ export interface AsyncChainParams {
|
|
|
44
45
|
controlConfig?: ResolvedControlConfig;
|
|
45
46
|
controlIntercomTarget?: string;
|
|
46
47
|
childIntercomTarget?: (agent: string, index: number) => string | undefined;
|
|
48
|
+
supervisorAuthorizations?: Array<SupervisorAuthorization | undefined>;
|
|
49
|
+
dynamicSupervisorAuthorizations?: Record<number, SupervisorAuthorization[]>;
|
|
47
50
|
nestedRoute?: NestedRouteInfo;
|
|
48
51
|
}
|
|
49
52
|
|
|
@@ -73,6 +76,7 @@ export interface AsyncSingleParams {
|
|
|
73
76
|
controlConfig?: ResolvedControlConfig;
|
|
74
77
|
controlIntercomTarget?: string;
|
|
75
78
|
childIntercomTarget?: (agent: string, index: number) => string | undefined;
|
|
79
|
+
supervisorAuthorization?: SupervisorAuthorization;
|
|
76
80
|
nestedRoute?: NestedRouteInfo;
|
|
77
81
|
/** Internal launch seam used by focused runtime tests. */
|
|
78
82
|
spawnRunner?: (
|
|
@@ -29,6 +29,9 @@ interface AsyncJobTrackerOptions {
|
|
|
29
29
|
|
|
30
30
|
const ACTIVE_HYDRATION_STATES: Array<AsyncRunSummary["state"]> = ["queued", "running"];
|
|
31
31
|
|
|
32
|
+
/** Only eagerly hydrate runs touched within the last 7 days; older runs stay on-demand. */
|
|
33
|
+
const ACTIVE_HYDRATION_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
34
|
+
|
|
32
35
|
function cwdMatches(summaryCwd: string | undefined, currentCwd: string | undefined): boolean {
|
|
33
36
|
return Boolean(summaryCwd && currentCwd && path.resolve(summaryCwd) === path.resolve(currentCwd));
|
|
34
37
|
}
|
|
@@ -38,6 +41,31 @@ function shouldHydrateRunForCurrentUi(summary: AsyncRunSummary, currentSessionId
|
|
|
38
41
|
return cwdMatches(summary.cwd, currentCwd);
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Extension contexts captured for timer-driven work (deferred hydration and
|
|
46
|
+
* state.lastUiContext) go stale after ctx.newSession(), ctx.fork(),
|
|
47
|
+
* ctx.switchSession(), or ctx.reload(); every accessor on a stale context
|
|
48
|
+
* throws. Probe defensively so an unref'd timer can never crash the host
|
|
49
|
+
* process with an unhandled stale-context error.
|
|
50
|
+
*/
|
|
51
|
+
function ctxHasUI(ctx: ExtensionContext | null | undefined): boolean {
|
|
52
|
+
if (!ctx) return false;
|
|
53
|
+
try {
|
|
54
|
+
return ctx.hasUI;
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function ctxCwd(ctx: ExtensionContext | null | undefined): string | undefined {
|
|
61
|
+
if (!ctx) return undefined;
|
|
62
|
+
try {
|
|
63
|
+
return ctx.cwd;
|
|
64
|
+
} catch {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
41
69
|
function asyncRunSummaryToJobState(summary: AsyncRunSummary, existing?: AsyncJobState): AsyncJobState {
|
|
42
70
|
const chainStepCount = summary.chainStepCount ?? summary.steps.length;
|
|
43
71
|
const groups = normalizeParallelGroups(summary.parallelGroups, summary.steps.length, chainStepCount);
|
|
@@ -92,6 +120,7 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
92
120
|
handleComplete: (data: unknown) => void;
|
|
93
121
|
resetJobs: (ctx?: ExtensionContext) => void;
|
|
94
122
|
hydrateActiveJobs: (ctx?: ExtensionContext) => void;
|
|
123
|
+
hydrateActiveJobsDeferred: (ctx?: ExtensionContext) => void;
|
|
95
124
|
} {
|
|
96
125
|
const completionRetentionMs = options.completionRetentionMs ?? 10000;
|
|
97
126
|
const pollIntervalMs = options.pollIntervalMs ?? POLL_INTERVAL_MS;
|
|
@@ -99,6 +128,18 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
99
128
|
const rerenderWidget = (ctx: ExtensionContext, jobs = Array.from(state.asyncJobs.values())) => {
|
|
100
129
|
renderWidget(ctx, jobs, pi);
|
|
101
130
|
};
|
|
131
|
+
/** Return the retained UI context when it is still usable; drop it once stale. */
|
|
132
|
+
const liveUiContext = (): ExtensionContext | undefined => {
|
|
133
|
+
const ctx = state.lastUiContext;
|
|
134
|
+
if (!ctx) return undefined;
|
|
135
|
+
try {
|
|
136
|
+
void ctx.hasUI;
|
|
137
|
+
return ctx;
|
|
138
|
+
} catch {
|
|
139
|
+
state.lastUiContext = null;
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
102
143
|
const cancelCleanup = (asyncId: string) => {
|
|
103
144
|
const existingTimer = state.cleanupTimers.get(asyncId);
|
|
104
145
|
if (!existingTimer) return;
|
|
@@ -110,8 +151,9 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
110
151
|
const timer = setTimeout(() => {
|
|
111
152
|
state.cleanupTimers.delete(asyncId);
|
|
112
153
|
state.asyncJobs.delete(asyncId);
|
|
113
|
-
|
|
114
|
-
|
|
154
|
+
const uiCtx = liveUiContext();
|
|
155
|
+
if (uiCtx) {
|
|
156
|
+
rerenderWidget(uiCtx);
|
|
115
157
|
}
|
|
116
158
|
}, completionRetentionMs);
|
|
117
159
|
state.cleanupTimers.set(asyncId, timer);
|
|
@@ -176,7 +218,8 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
176
218
|
if (state.poller) return;
|
|
177
219
|
state.poller = setInterval(() => {
|
|
178
220
|
if (state.asyncJobs.size === 0) {
|
|
179
|
-
|
|
221
|
+
const idleUiCtx = liveUiContext();
|
|
222
|
+
if (ctxHasUI(idleUiCtx)) rerenderWidget(idleUiCtx!, []);
|
|
180
223
|
if (state.poller) {
|
|
181
224
|
clearInterval(state.poller);
|
|
182
225
|
state.poller = null;
|
|
@@ -288,15 +331,17 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
288
331
|
if (widgetRenderKey(job) !== widgetStateBefore) widgetChanged = true;
|
|
289
332
|
}
|
|
290
333
|
|
|
291
|
-
|
|
334
|
+
const pollUiCtx = liveUiContext();
|
|
335
|
+
if (widgetChanged && ctxHasUI(pollUiCtx)) rerenderWidget(pollUiCtx!);
|
|
292
336
|
}, pollIntervalMs);
|
|
293
337
|
state.poller.unref?.();
|
|
294
338
|
};
|
|
295
339
|
|
|
296
340
|
const hydrateActiveJobs = (ctx?: ExtensionContext) => {
|
|
297
|
-
if (ctx
|
|
298
|
-
const
|
|
299
|
-
const
|
|
341
|
+
if (ctxHasUI(ctx)) state.lastUiContext = ctx!;
|
|
342
|
+
const retainedCtx = liveUiContext();
|
|
343
|
+
const renderCtx = ctxHasUI(retainedCtx) ? retainedCtx : undefined;
|
|
344
|
+
const currentCwd = (ctxCwd(ctx) ?? ctxCwd(retainedCtx) ?? state.baseCwd) || undefined;
|
|
300
345
|
let summaries: AsyncRunSummary[];
|
|
301
346
|
try {
|
|
302
347
|
summaries = listAsyncRuns(asyncDirRoot, {
|
|
@@ -304,6 +349,7 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
304
349
|
resultsDir,
|
|
305
350
|
kill: options.kill,
|
|
306
351
|
now: options.now,
|
|
352
|
+
maxAgeMs: ACTIVE_HYDRATION_MAX_AGE_MS,
|
|
307
353
|
});
|
|
308
354
|
} catch (error) {
|
|
309
355
|
console.error(`Failed to hydrate active async jobs from '${asyncDirRoot}':`, error);
|
|
@@ -358,8 +404,9 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
358
404
|
updatedAt: now,
|
|
359
405
|
});
|
|
360
406
|
ensurePoller();
|
|
361
|
-
|
|
362
|
-
|
|
407
|
+
const startedUiCtx = liveUiContext();
|
|
408
|
+
if (startedUiCtx) {
|
|
409
|
+
rerenderWidget(startedUiCtx);
|
|
363
410
|
}
|
|
364
411
|
};
|
|
365
412
|
|
|
@@ -380,8 +427,9 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
380
427
|
console.error(`Failed to refresh nested async descendants for '${job.asyncDir}':`, error);
|
|
381
428
|
}
|
|
382
429
|
}
|
|
383
|
-
|
|
384
|
-
|
|
430
|
+
const completeUiCtx = liveUiContext();
|
|
431
|
+
if (completeUiCtx) {
|
|
432
|
+
rerenderWidget(completeUiCtx);
|
|
385
433
|
}
|
|
386
434
|
if (!nestedRefreshFailed && !hasLiveNestedDescendants(job?.nestedChildren)) scheduleCleanup(asyncId);
|
|
387
435
|
};
|
|
@@ -395,8 +443,22 @@ export function createAsyncJobTracker(pi: Pick<ExtensionAPI, "events">, state: S
|
|
|
395
443
|
state.foregroundControls?.clear();
|
|
396
444
|
state.lastForegroundControlId = null;
|
|
397
445
|
state.resultFileCoalescer.clear();
|
|
398
|
-
if (ctx
|
|
446
|
+
if (ctxHasUI(ctx)) state.lastUiContext = ctx!;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// Hydration scans the async run root synchronously; deferring it off the
|
|
450
|
+
// session_start hot path keeps startup latency independent of run history.
|
|
451
|
+
let pendingDeferredHydration: ReturnType<typeof setTimeout> | null = null;
|
|
452
|
+
const hydrateActiveJobsDeferred = (ctx?: ExtensionContext) => {
|
|
453
|
+
if (ctxHasUI(ctx)) state.lastUiContext = ctx!;
|
|
454
|
+
if (pendingDeferredHydration !== null) clearTimeout(pendingDeferredHydration);
|
|
455
|
+
const timer = setTimeout(() => {
|
|
456
|
+
pendingDeferredHydration = null;
|
|
457
|
+
hydrateActiveJobs(ctx);
|
|
458
|
+
}, 0);
|
|
459
|
+
timer.unref?.();
|
|
460
|
+
pendingDeferredHydration = timer;
|
|
399
461
|
};
|
|
400
462
|
|
|
401
|
-
return { ensurePoller, handleStarted, handleComplete, resetJobs, hydrateActiveJobs };
|
|
463
|
+
return { ensurePoller, handleStarted, handleComplete, resetJobs, hydrateActiveJobs, hydrateActiveJobsDeferred };
|
|
402
464
|
}
|
|
@@ -75,6 +75,8 @@ interface AsyncRunListOptions {
|
|
|
75
75
|
kill?: (pid: number, signal?: NodeJS.Signals | 0) => boolean;
|
|
76
76
|
now?: () => number;
|
|
77
77
|
reconcile?: boolean;
|
|
78
|
+
/** Only consider run dirs whose dir or status.json changed within this window. */
|
|
79
|
+
maxAgeMs?: number;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
function getErrorMessage(error: unknown): string {
|
|
@@ -100,6 +102,19 @@ function isAsyncRunDir(root: string, entry: string): boolean {
|
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
function runDirTouchedSince(asyncDir: string, cutoffMs: number): boolean {
|
|
106
|
+
try {
|
|
107
|
+
if (fs.statSync(asyncDir).mtimeMs >= cutoffMs) return true;
|
|
108
|
+
} catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
return fs.statSync(path.join(asyncDir, "status.json")).mtimeMs >= cutoffMs;
|
|
113
|
+
} catch {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
103
118
|
function outputFileMtime(outputFile: string | undefined): number | undefined {
|
|
104
119
|
if (!outputFile) return undefined;
|
|
105
120
|
try {
|
|
@@ -232,9 +247,13 @@ export function listAsyncRuns(asyncDirRoot: string, options: AsyncRunListOptions
|
|
|
232
247
|
}
|
|
233
248
|
|
|
234
249
|
const allowedStates = options.states ? new Set(options.states) : undefined;
|
|
250
|
+
const cutoff = options.maxAgeMs !== undefined ? (options.now?.() ?? Date.now()) - options.maxAgeMs : undefined;
|
|
235
251
|
const runs: AsyncRunSummary[] = [];
|
|
236
252
|
for (const entry of entries) {
|
|
237
253
|
const asyncDir = path.join(asyncDirRoot, entry);
|
|
254
|
+
// Recency cutoff: skip reconcile/read/parse work for long-untouched runs
|
|
255
|
+
// (two stats instead of a full per-run reconciliation at startup).
|
|
256
|
+
if (cutoff !== undefined && !runDirTouchedSince(asyncDir, cutoff)) continue;
|
|
238
257
|
const reconciliation = options.reconcile === false
|
|
239
258
|
? undefined
|
|
240
259
|
: reconcileAsyncRun(asyncDir, { resultsDir: options.resultsDir, kill: options.kill, now: options.now });
|
|
@@ -4,6 +4,7 @@ import { SUBAGENT_ASYNC_COMPLETE_EVENT } from "../../shared/types.ts";
|
|
|
4
4
|
export interface CompletionNotificationEnvelope extends Record<string, unknown> {
|
|
5
5
|
notificationId: string;
|
|
6
6
|
acknowledge: (delivered: boolean) => void;
|
|
7
|
+
defer: () => void;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export function deliverLocalCompletionNotification(
|
|
@@ -13,6 +14,7 @@ export function deliverLocalCompletionNotification(
|
|
|
13
14
|
): Promise<boolean> {
|
|
14
15
|
return new Promise((resolve) => {
|
|
15
16
|
let settled = false;
|
|
17
|
+
let deferred = false;
|
|
16
18
|
const finish = (delivered: boolean) => {
|
|
17
19
|
if (settled) return;
|
|
18
20
|
settled = true;
|
|
@@ -22,11 +24,10 @@ export function deliverLocalCompletionNotification(
|
|
|
22
24
|
events.emit(SUBAGENT_ASYNC_COMPLETE_EVENT, {
|
|
23
25
|
...payload,
|
|
24
26
|
notificationId,
|
|
27
|
+
defer: () => { deferred = true; },
|
|
25
28
|
acknowledge: finish,
|
|
26
29
|
} satisfies CompletionNotificationEnvelope);
|
|
27
|
-
|
|
28
|
-
// delivery. Production listeners can synchronously reject via acknowledge(false).
|
|
29
|
-
finish(true);
|
|
30
|
+
if (!deferred) finish(true);
|
|
30
31
|
} catch {
|
|
31
32
|
finish(false);
|
|
32
33
|
}
|