@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
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Status
|
|
2
|
+
* Status, internal cancellation, and resume helpers for retained workflow runs.
|
|
3
3
|
*
|
|
4
4
|
* These helpers operate against the singleton store and are consumed by:
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
5
|
+
* - Workflow inspection/resume surfaces
|
|
6
|
+
* - Internal lifecycle cancellation
|
|
7
7
|
*
|
|
8
8
|
* cross-ref: spec §5.5, §8.1 Phase D
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { Store } from "../../shared/store.js";
|
|
12
12
|
import type { RunSnapshot, RunStatus, StageSnapshot } from "../../shared/store-types.js";
|
|
13
|
-
import type {
|
|
13
|
+
import type { WorkflowPersistencePort } from "../../shared/types.js";
|
|
14
14
|
import type { CancellationRegistry } from "./cancellation-registry.js";
|
|
15
15
|
import type { StageControlRegistry } from "../foreground/stage-control-registry.js";
|
|
16
16
|
import { store as defaultStore } from "../../shared/store.js";
|
|
@@ -18,8 +18,10 @@ import { stageControlRegistry as defaultStageControlRegistry } from "../foregrou
|
|
|
18
18
|
import { appendRunEnd } from "../../shared/persistence-session-entries.js";
|
|
19
19
|
import { expandWorkflowGraph } from "../../shared/expanded-workflow-graph.js";
|
|
20
20
|
import { topLevelWorkflowRuns } from "../../shared/run-visibility.js";
|
|
21
|
-
import {
|
|
22
|
-
|
|
21
|
+
import { effectiveRunStatus } from "../../shared/returned-run-status.js";
|
|
22
|
+
import { markDurableResumed } from "./durable-resume-transition.js";
|
|
23
|
+
import { resumeAcknowledgementMessage, settleResumeAcknowledgements, waitForResumeReconciliation } from "./resume-acknowledgements.js";
|
|
24
|
+
import { aggregateWorkflowRootRunId, expandedControlRunIds, workflowHasPausedStages } from "./workflow-lifecycle-aggregate.js";
|
|
23
25
|
// ---------------------------------------------------------------------------
|
|
24
26
|
// Types
|
|
25
27
|
// ---------------------------------------------------------------------------
|
|
@@ -43,7 +45,7 @@ export type ResumeResult =
|
|
|
43
45
|
runId: string;
|
|
44
46
|
snapshot: RunSnapshot;
|
|
45
47
|
resumed: readonly StageSnapshot[];
|
|
46
|
-
mode?: "snapshot" | "paused" | "not_resumable";
|
|
48
|
+
mode?: "snapshot" | "paused" | "partial" | "not_resumable";
|
|
47
49
|
message?: string;
|
|
48
50
|
}
|
|
49
51
|
| { ok: false; runId: string; reason: "not_found" };
|
|
@@ -62,43 +64,7 @@ export type PauseResult =
|
|
|
62
64
|
|
|
63
65
|
export type InterruptRunResult = PauseResult;
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
* Per-run detail returned by {@link inspectRun}. A read-only view over the
|
|
67
|
-
* store snapshot suitable for the " RUN" detail surface — same data the
|
|
68
|
-
* resume snapshot carries, plus a normalised `mode` field derived from
|
|
69
|
-
* stage shape so renderers don't have to recompute it.
|
|
70
|
-
*/
|
|
71
|
-
export interface RunDetail {
|
|
72
|
-
readonly runId: string;
|
|
73
|
-
readonly name: string;
|
|
74
|
-
readonly status: RunStatus;
|
|
75
|
-
readonly mode: "single" | "chain";
|
|
76
|
-
readonly startedAt: number;
|
|
77
|
-
readonly endedAt?: number;
|
|
78
|
-
readonly durationMs?: number;
|
|
79
|
-
readonly pausedDurationMs?: number;
|
|
80
|
-
readonly pausedAt?: number;
|
|
81
|
-
readonly resumedAt?: number;
|
|
82
|
-
readonly inputs: Readonly<WorkflowInputValues>;
|
|
83
|
-
readonly stages: readonly RunSnapshot["stages"][number][];
|
|
84
|
-
readonly result?: WorkflowOutputValues;
|
|
85
|
-
readonly error?: string;
|
|
86
|
-
readonly exited?: boolean;
|
|
87
|
-
readonly exitReason?: string;
|
|
88
|
-
readonly failureKind?: RunSnapshot["failureKind"];
|
|
89
|
-
readonly failureCode?: RunSnapshot["failureCode"];
|
|
90
|
-
readonly failureRecoverability?: RunSnapshot["failureRecoverability"];
|
|
91
|
-
readonly failureDisposition?: RunSnapshot["failureDisposition"];
|
|
92
|
-
readonly failedStageId?: string;
|
|
93
|
-
readonly resumable?: boolean;
|
|
94
|
-
readonly retryAfterMs?: number;
|
|
95
|
-
readonly blockedAt?: number;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export type InspectRunResult =
|
|
99
|
-
| { ok: true; runId: string; detail: RunDetail }
|
|
100
|
-
| { ok: false; runId: string; reason: "not_found" };
|
|
101
|
-
|
|
67
|
+
export { inspectRun, type InspectRunResult, type RunDetail } from "./run-inspect.js";
|
|
102
68
|
// ---------------------------------------------------------------------------
|
|
103
69
|
// statusRuns
|
|
104
70
|
// ---------------------------------------------------------------------------
|
|
@@ -122,7 +88,6 @@ export function statusRuns(opts?: { all?: boolean; store?: Store }): RunStatusEn
|
|
|
122
88
|
stageCount: expandWorkflowGraph(snapshot, run.id).stages.length,
|
|
123
89
|
}));
|
|
124
90
|
}
|
|
125
|
-
|
|
126
91
|
// ---------------------------------------------------------------------------
|
|
127
92
|
// killRun
|
|
128
93
|
// ---------------------------------------------------------------------------
|
|
@@ -198,28 +163,20 @@ export function killAllRuns(opts?: {
|
|
|
198
163
|
killRun(r.id, { store: activeStore, cancellation: opts?.cancellation, persistence: opts?.persistence }),
|
|
199
164
|
);
|
|
200
165
|
}
|
|
201
|
-
|
|
202
166
|
// ---------------------------------------------------------------------------
|
|
203
167
|
// resumeRun
|
|
204
168
|
// ---------------------------------------------------------------------------
|
|
205
169
|
|
|
206
170
|
/**
|
|
207
|
-
* Reopen a run for display,
|
|
171
|
+
* Reopen a run for display, awaiting every live stage-control resume before
|
|
172
|
+
* recording the corresponding store and durable transitions.
|
|
208
173
|
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* - paused run with a live `WorkflowRunControlHandle` in the
|
|
214
|
-
* stage-control registry: clears the paused state, resumes every
|
|
215
|
-
* currently-paused stage (or only `stageId` when supplied), and
|
|
216
|
-
* returns the resumed stage snapshots alongside the deep-copy.
|
|
217
|
-
*
|
|
218
|
-
* Returns ok:false "not_found" when the runId is unknown to the store.
|
|
219
|
-
* Read-only against cancellation/persistence/job tracker; mutates the
|
|
220
|
-
* store only when paused stages were actually resumed.
|
|
174
|
+
* Non-paused and terminal runs still return a read-only snapshot. Every
|
|
175
|
+
* paused control is attempted. An all-failed acknowledgement set rejects;
|
|
176
|
+
* partial success returns the actual running/paused split with qualified
|
|
177
|
+
* failures so callers never misreport externally visible progress as a no-op.
|
|
221
178
|
*/
|
|
222
|
-
export function resumeRun(
|
|
179
|
+
export async function resumeRun(
|
|
223
180
|
runId: string,
|
|
224
181
|
opts?: {
|
|
225
182
|
store?: Store;
|
|
@@ -229,51 +186,91 @@ export function resumeRun(
|
|
|
229
186
|
/** Optional resume message forwarded to each resumed stage. */
|
|
230
187
|
message?: string;
|
|
231
188
|
},
|
|
232
|
-
): ResumeResult {
|
|
189
|
+
): Promise<ResumeResult> {
|
|
233
190
|
const activeStore = opts?.store ?? defaultStore;
|
|
234
191
|
const registry = opts?.stageControlRegistry ?? defaultStageControlRegistry;
|
|
235
192
|
const runs = activeStore.runs();
|
|
236
|
-
const run = runs.find((
|
|
193
|
+
const run = runs.find((candidate) => candidate.id === runId);
|
|
237
194
|
|
|
238
|
-
if (!run) {
|
|
239
|
-
return { ok: false, runId, reason: "not_found" };
|
|
240
|
-
}
|
|
195
|
+
if (!run) return { ok: false, runId, reason: "not_found" };
|
|
241
196
|
|
|
242
197
|
const resumed: StageSnapshot[] = [];
|
|
198
|
+
const aggregateRootRunId = aggregateWorkflowRootRunId(activeStore, runId);
|
|
199
|
+
let partialFailureMessage: string | undefined;
|
|
200
|
+
let durabilityFailure: string | undefined;
|
|
201
|
+
let acknowledgedTargets = 0;
|
|
243
202
|
const controlRunIds = opts?.stageId ? [runId] : expandedControlRunIds(activeStore, runId);
|
|
244
203
|
const hasPausedState = controlRunIds.some((controlRunId) => {
|
|
245
204
|
const controlRun = runs.find((candidate) => candidate.id === controlRunId);
|
|
246
|
-
return controlRun?.status === "paused" || (controlRun?.stages.some((
|
|
205
|
+
return controlRun?.status === "paused" || (controlRun?.stages.some((stage) => stage.status === "paused") ?? false);
|
|
247
206
|
});
|
|
248
207
|
if (hasPausedState) {
|
|
249
208
|
const handles = opts?.stageId
|
|
250
209
|
? [registry.get(runId, opts.stageId)].filter(
|
|
251
|
-
(
|
|
210
|
+
(handle): handle is NonNullable<typeof handle> => handle !== undefined && handle.status === "paused",
|
|
252
211
|
).map((handle) => ({ controlRunId: runId, handle }))
|
|
253
212
|
: controlRunIds.flatMap((controlRunId) =>
|
|
254
213
|
registry.run(controlRunId).pausedStages().map((handle) => ({ controlRunId, handle })),
|
|
255
214
|
);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
if (stageSnap) resumed.push(stageSnap);
|
|
266
|
-
activeStore.recordRunResumed(controlRunId);
|
|
267
|
-
}
|
|
268
|
-
if (!opts?.stageId || resumed.length > 0) {
|
|
215
|
+
const acknowledgements = await settleResumeAcknowledgements(activeStore, handles, opts?.message);
|
|
216
|
+
acknowledgedTargets = acknowledgements.acknowledged;
|
|
217
|
+
resumed.push(...acknowledgements.resumed);
|
|
218
|
+
const currentRun = activeStore.runs().find((candidate) => candidate.id === runId);
|
|
219
|
+
const hasPausedDescendant = workflowHasPausedStages(activeStore, runId);
|
|
220
|
+
if (acknowledgements.acknowledged > 0 || (
|
|
221
|
+
handles.length === 0 && acknowledgements.failures.length === 0 &&
|
|
222
|
+
!hasPausedDescendant && currentRun?.status === "paused"
|
|
223
|
+
)) {
|
|
269
224
|
activeStore.recordRunResumed(runId);
|
|
225
|
+
if (aggregateRootRunId !== runId) activeStore.recordRunResumed(aggregateRootRunId);
|
|
226
|
+
}
|
|
227
|
+
const reconciledRoot = activeStore.runs().find((candidate) => candidate.id === runId);
|
|
228
|
+
if (acknowledgements.failures.length > 0) {
|
|
229
|
+
const failureMessage = "Failed to resume workflow stages: " + acknowledgements.failures.join("; ");
|
|
230
|
+
if (reconciledRoot?.status !== "running") throw new Error(failureMessage);
|
|
231
|
+
partialFailureMessage = "Partially resumed " + runId + ": " + resumed.length
|
|
232
|
+
+ " stage(s) running; " + failureMessage + ". Failed paused stages remain resumable.";
|
|
233
|
+
} else if (acknowledgements.lateFailures.length > 0) {
|
|
234
|
+
partialFailureMessage = "Resumed " + resumed.length + " stage(s) on " + runId
|
|
235
|
+
+ "; acknowledgements reported after visible resume: " + acknowledgements.lateFailures.join("; ")
|
|
236
|
+
+ ". Running stages are not retryable.";
|
|
270
237
|
}
|
|
271
238
|
}
|
|
272
239
|
|
|
273
|
-
|
|
274
|
-
|
|
240
|
+
await waitForResumeReconciliation(acknowledgedTargets);
|
|
241
|
+
|
|
242
|
+
const locallyReconciledRoot = activeStore.runs().find((candidate) => candidate.id === aggregateRootRunId);
|
|
243
|
+
if (locallyReconciledRoot?.endedAt === undefined && locallyReconciledRoot?.status === "running") {
|
|
244
|
+
try {
|
|
245
|
+
const transition = await markDurableResumed(aggregateRootRunId);
|
|
246
|
+
if (transition === "refused") {
|
|
247
|
+
durabilityFailure = "authoritative durable workflow " + aggregateRootRunId + " refused the running transition";
|
|
248
|
+
}
|
|
249
|
+
} catch (error) {
|
|
250
|
+
durabilityFailure = error instanceof Error ? error.message : String(error);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (durabilityFailure !== undefined) {
|
|
254
|
+
const durableMessage = "Durable resume transition failed after visible local resume: " + durabilityFailure + ".";
|
|
255
|
+
partialFailureMessage = partialFailureMessage === undefined
|
|
256
|
+
? durableMessage
|
|
257
|
+
: partialFailureMessage + " " + durableMessage;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const current = activeStore.runs().find((candidate) => candidate.id === runId) ?? run;
|
|
261
|
+
const snapshot = structuredClone(current);
|
|
275
262
|
const resumedCopy = structuredClone(resumed);
|
|
276
|
-
if (
|
|
263
|
+
if (partialFailureMessage !== undefined) {
|
|
264
|
+
return {
|
|
265
|
+
ok: true,
|
|
266
|
+
runId,
|
|
267
|
+
snapshot,
|
|
268
|
+
resumed: resumedCopy,
|
|
269
|
+
mode: "partial",
|
|
270
|
+
message: partialFailureMessage,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
if (current.status === "killed" || current.resumable === false) {
|
|
277
274
|
return {
|
|
278
275
|
ok: true,
|
|
279
276
|
runId,
|
|
@@ -284,10 +281,10 @@ export function resumeRun(
|
|
|
284
281
|
};
|
|
285
282
|
}
|
|
286
283
|
if (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
284
|
+
current.endedAt === undefined &&
|
|
285
|
+
current.resumable === true &&
|
|
286
|
+
current.failureRecoverability === "recoverable" &&
|
|
287
|
+
current.failedStageId !== undefined
|
|
291
288
|
) {
|
|
292
289
|
return {
|
|
293
290
|
ok: true,
|
|
@@ -295,46 +292,25 @@ export function resumeRun(
|
|
|
295
292
|
snapshot,
|
|
296
293
|
resumed: resumedCopy,
|
|
297
294
|
mode: resumedCopy.length > 0 ? "paused" : "snapshot",
|
|
298
|
-
message: `Workflow is blocked on a recoverable ${
|
|
295
|
+
message: `Workflow is blocked on a recoverable ${current.failureCode ?? current.failureKind ?? "workflow"} failure at stage ${current.failedStageId}; retry/resume after the issue clears.`,
|
|
299
296
|
};
|
|
300
297
|
}
|
|
298
|
+
const acknowledgementMessage = resumeAcknowledgementMessage(
|
|
299
|
+
acknowledgedTargets, resumedCopy.length, runId, current,
|
|
300
|
+
);
|
|
301
301
|
return {
|
|
302
302
|
ok: true,
|
|
303
303
|
runId,
|
|
304
304
|
snapshot,
|
|
305
305
|
resumed: resumedCopy,
|
|
306
306
|
mode: resumedCopy.length > 0 ? "paused" : "snapshot",
|
|
307
|
+
...(acknowledgementMessage !== undefined ? { message: acknowledgementMessage } : {}),
|
|
307
308
|
};
|
|
308
309
|
}
|
|
309
310
|
|
|
310
|
-
// ---------------------------------------------------------------------------
|
|
311
311
|
// pauseRun
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Pause a run or a specific stage within a run.
|
|
316
|
-
*
|
|
317
|
-
* - With no `stageId`: every currently-running stage with a live handle
|
|
318
|
-
* in the stage-control registry is paused. If at least one stage is
|
|
319
|
-
* paused, the run is marked `paused` in the store.
|
|
320
|
-
* - With `stageId`: only that stage is paused. The run is marked paused
|
|
321
|
-
* only when *every* still-active stage in the run is paused after the
|
|
322
|
-
* operation.
|
|
323
|
-
*
|
|
324
|
-
* Refuses runs that are already terminal (completed / failed / killed)
|
|
325
|
-
* with `reason: "already_ended"`. Refuses runs with no pausable stage
|
|
326
|
-
* handles in the registry with `reason: "no_active_stages"`. Refuses a
|
|
327
|
-
* stage-scoped pause when no matching handle exists with
|
|
328
|
-
* `reason: "stage_not_found"`.
|
|
329
|
-
*/
|
|
330
|
-
function expandedControlRunIds(activeStore: Store, runId: string): string[] {
|
|
331
|
-
const graph = expandWorkflowGraph(activeStore.snapshot(), runId);
|
|
332
|
-
const ids = new Set<string>([runId]);
|
|
333
|
-
for (const stage of graph.stages) ids.add(stage.workflowGraphTarget.runId);
|
|
334
|
-
return [...ids];
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export function pauseRun(
|
|
312
|
+
/** Pause a run only after its live stage controls acknowledge the request. */
|
|
313
|
+
export async function pauseRun(
|
|
338
314
|
runId: string,
|
|
339
315
|
opts?: {
|
|
340
316
|
store?: Store;
|
|
@@ -342,34 +318,30 @@ export function pauseRun(
|
|
|
342
318
|
/** Pause only this stage. */
|
|
343
319
|
stageId?: string;
|
|
344
320
|
},
|
|
345
|
-
): PauseResult {
|
|
321
|
+
): Promise<PauseResult> {
|
|
346
322
|
const activeStore = opts?.store ?? defaultStore;
|
|
347
323
|
const registry = opts?.stageControlRegistry ?? defaultStageControlRegistry;
|
|
348
|
-
const
|
|
349
|
-
const run = runs.find((r) => r.id === runId);
|
|
324
|
+
const run = activeStore.runs().find((candidate) => candidate.id === runId);
|
|
350
325
|
|
|
351
|
-
if (!run) {
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
if (run.endedAt !== undefined) {
|
|
355
|
-
return { ok: false, runId, reason: "already_ended" };
|
|
356
|
-
}
|
|
326
|
+
if (!run) return { ok: false, runId, reason: "not_found" };
|
|
327
|
+
if (run.endedAt !== undefined) return { ok: false, runId, reason: "already_ended" };
|
|
357
328
|
|
|
358
329
|
if (opts?.stageId !== undefined) {
|
|
359
330
|
const handle = registry.get(runId, opts.stageId);
|
|
360
|
-
if (!handle) {
|
|
361
|
-
return { ok: false, runId, reason: "stage_not_found" };
|
|
362
|
-
}
|
|
331
|
+
if (!handle) return { ok: false, runId, reason: "stage_not_found" };
|
|
363
332
|
if (handle.status !== "running" && handle.status !== "pending") {
|
|
364
333
|
return { ok: false, runId, reason: "no_active_stages" };
|
|
365
334
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
335
|
+
await handle.pause();
|
|
336
|
+
activeStore.recordStagePaused(runId, opts.stageId);
|
|
337
|
+
const currentRun = activeStore.runs().find((candidate) => candidate.id === runId);
|
|
338
|
+
const stage = currentRun?.stages.find((candidate) => candidate.id === opts.stageId);
|
|
339
|
+
const paused = stage === undefined ? [] : [structuredClone(stage)];
|
|
340
|
+
const stillActive = currentRun?.stages.some(
|
|
341
|
+
(candidate) =>
|
|
342
|
+
candidate.id !== opts.stageId &&
|
|
343
|
+
(candidate.status === "running" || candidate.status === "pending"),
|
|
344
|
+
) ?? false;
|
|
373
345
|
if (!stillActive) activeStore.recordRunPaused(runId);
|
|
374
346
|
return { ok: true, runId, paused };
|
|
375
347
|
}
|
|
@@ -377,123 +349,60 @@ export function pauseRun(
|
|
|
377
349
|
const controlRunIds = expandedControlRunIds(activeStore, runId);
|
|
378
350
|
const handles = controlRunIds.flatMap((controlRunId) =>
|
|
379
351
|
registry.run(controlRunId).stages().filter(
|
|
380
|
-
(
|
|
352
|
+
(handle) => handle.status === "running" || handle.status === "pending",
|
|
381
353
|
).map((handle) => ({ controlRunId, handle })),
|
|
382
354
|
);
|
|
383
|
-
if (handles.length === 0) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
const
|
|
355
|
+
if (handles.length === 0) return { ok: false, runId, reason: "no_active_stages" };
|
|
356
|
+
|
|
357
|
+
const paused: StageSnapshot[] = [];
|
|
358
|
+
const pausedRunIds = new Set<string>();
|
|
387
359
|
for (const { controlRunId, handle } of handles) {
|
|
388
|
-
|
|
360
|
+
await handle.pause();
|
|
361
|
+
activeStore.recordStagePaused(controlRunId, handle.stageId);
|
|
362
|
+
pausedRunIds.add(controlRunId);
|
|
389
363
|
const controlRun = activeStore.runs().find((candidate) => candidate.id === controlRunId);
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
392
|
-
activeStore.recordRunPaused(controlRunId);
|
|
364
|
+
const stage = controlRun?.stages.find((candidate) => candidate.id === handle.stageId);
|
|
365
|
+
if (stage !== undefined) paused.push(structuredClone(stage));
|
|
393
366
|
}
|
|
367
|
+
for (const pausedRunId of pausedRunIds) activeStore.recordRunPaused(pausedRunId);
|
|
394
368
|
activeStore.recordRunPaused(runId);
|
|
395
|
-
return { ok: true, runId, paused
|
|
369
|
+
return { ok: true, runId, paused };
|
|
396
370
|
}
|
|
397
371
|
|
|
398
|
-
export function pauseAllRuns(opts?: {
|
|
372
|
+
export async function pauseAllRuns(opts?: {
|
|
399
373
|
store?: Store;
|
|
400
374
|
stageControlRegistry?: StageControlRegistry;
|
|
401
|
-
}): PauseResult[] {
|
|
375
|
+
}): Promise<PauseResult[]> {
|
|
402
376
|
const activeStore = opts?.store ?? defaultStore;
|
|
403
|
-
const inFlight = topLevelWorkflowRuns(activeStore.runs()).filter((
|
|
404
|
-
return inFlight.map((
|
|
405
|
-
pauseRun(
|
|
406
|
-
);
|
|
377
|
+
const inFlight = topLevelWorkflowRuns(activeStore.runs()).filter((run) => run.endedAt === undefined);
|
|
378
|
+
return Promise.all(inFlight.map((run) =>
|
|
379
|
+
pauseRun(run.id, { store: activeStore, stageControlRegistry: opts?.stageControlRegistry })
|
|
380
|
+
));
|
|
407
381
|
}
|
|
408
|
-
|
|
409
|
-
|
|
410
382
|
// ---------------------------------------------------------------------------
|
|
411
383
|
// interruptRun
|
|
412
384
|
// ---------------------------------------------------------------------------
|
|
413
385
|
|
|
414
|
-
/**
|
|
415
|
-
|
|
416
|
-
* available. This never aborts the workflow controller and
|
|
417
|
-
* never removes the run from status/history.
|
|
418
|
-
*/
|
|
419
|
-
export function interruptRun(
|
|
386
|
+
/** Interrupt a run in a resumable way without destructive cancellation. */
|
|
387
|
+
export async function interruptRun(
|
|
420
388
|
runId: string,
|
|
421
389
|
opts?: {
|
|
422
390
|
store?: Store;
|
|
423
391
|
stageControlRegistry?: StageControlRegistry;
|
|
424
392
|
stageId?: string;
|
|
425
393
|
},
|
|
426
|
-
): InterruptRunResult {
|
|
394
|
+
): Promise<InterruptRunResult> {
|
|
427
395
|
return pauseRun(runId, opts);
|
|
428
396
|
}
|
|
429
397
|
|
|
430
398
|
/** Interrupt all in-flight runs without removing them from history/status. */
|
|
431
|
-
export function interruptAllRuns(opts?: {
|
|
399
|
+
export async function interruptAllRuns(opts?: {
|
|
432
400
|
store?: Store;
|
|
433
401
|
stageControlRegistry?: StageControlRegistry;
|
|
434
|
-
}): InterruptRunResult[] {
|
|
402
|
+
}): Promise<InterruptRunResult[]> {
|
|
435
403
|
const activeStore = opts?.store ?? defaultStore;
|
|
436
|
-
const inFlight = topLevelWorkflowRuns(activeStore.runs()).filter((
|
|
437
|
-
return inFlight.map((
|
|
438
|
-
interruptRun(
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// ---------------------------------------------------------------------------
|
|
443
|
-
// inspectRun
|
|
444
|
-
// ---------------------------------------------------------------------------
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Look up a single run by id (full UUID or unique prefix) and return a
|
|
448
|
-
* normalised {@link RunDetail} for the per-run text/TUI surfaces.
|
|
449
|
-
*
|
|
450
|
-
* Returns ok:false "not_found" when no run matches, "ambiguous" when a
|
|
451
|
-
* prefix matches multiple. Read-only: does not mutate the store.
|
|
452
|
-
*/
|
|
453
|
-
export function inspectRun(
|
|
454
|
-
runId: string,
|
|
455
|
-
opts?: { store?: Store },
|
|
456
|
-
): InspectRunResult {
|
|
457
|
-
const activeStore = opts?.store ?? defaultStore;
|
|
458
|
-
const runs = activeStore.runs();
|
|
459
|
-
|
|
460
|
-
const exact = runs.find((r) => r.id === runId);
|
|
461
|
-
const candidate = exact ?? (runs.length > 0 ? runs.find((r) => r.id.startsWith(runId)) : undefined);
|
|
462
|
-
|
|
463
|
-
if (!candidate) {
|
|
464
|
-
return { ok: false, runId, reason: "not_found" };
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
// Deep copy so callers cannot mutate the store via the snapshot.
|
|
468
|
-
const copy = structuredClone(candidate);
|
|
469
|
-
const expandedStages = expandWorkflowGraph(activeStore.snapshot(), copy.id).stages;
|
|
470
|
-
|
|
471
|
-
const detail: RunDetail = {
|
|
472
|
-
runId: copy.id,
|
|
473
|
-
name: copy.name,
|
|
474
|
-
status: effectiveRunStatus(copy),
|
|
475
|
-
mode: expandedStages.length > 1 ? "chain" : "single",
|
|
476
|
-
startedAt: copy.startedAt,
|
|
477
|
-
endedAt: copy.endedAt,
|
|
478
|
-
durationMs: copy.durationMs,
|
|
479
|
-
pausedDurationMs: copy.pausedDurationMs,
|
|
480
|
-
pausedAt: copy.pausedAt,
|
|
481
|
-
resumedAt: copy.resumedAt,
|
|
482
|
-
inputs: copy.inputs,
|
|
483
|
-
stages: expandedStages.map((stage) => structuredClone(stage)),
|
|
484
|
-
result: copy.result,
|
|
485
|
-
error: copy.error ?? (effectiveRunStatus(copy) === copy.status ? undefined : (structuredRecoverableWorkflowFailureText(copy) ?? actionableReturnedStatusText(copy.result))),
|
|
486
|
-
exited: copy.exited,
|
|
487
|
-
exitReason: copy.exitReason,
|
|
488
|
-
failureKind: copy.failureKind,
|
|
489
|
-
failureCode: copy.failureCode,
|
|
490
|
-
failureRecoverability: copy.failureRecoverability,
|
|
491
|
-
failureDisposition: copy.failureDisposition,
|
|
492
|
-
failedStageId: copy.failedStageId,
|
|
493
|
-
resumable: copy.resumable,
|
|
494
|
-
retryAfterMs: copy.retryAfterMs,
|
|
495
|
-
blockedAt: copy.blockedAt,
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
return { ok: true, runId: copy.id, detail };
|
|
404
|
+
const inFlight = topLevelWorkflowRuns(activeStore.runs()).filter((run) => run.endedAt === undefined);
|
|
405
|
+
return Promise.all(inFlight.map((run) =>
|
|
406
|
+
interruptRun(run.id, { store: activeStore, stageControlRegistry: opts?.stageControlRegistry })
|
|
407
|
+
));
|
|
499
408
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { expandWorkflowGraph } from "../../shared/expanded-workflow-graph.js";
|
|
2
|
+
import type { Store } from "../../shared/store-public-types.js";
|
|
3
|
+
|
|
4
|
+
/** Control-run ids visible below one workflow boundary, in graph order. */
|
|
5
|
+
export function expandedControlRunIds(store: Store, runId: string): string[] {
|
|
6
|
+
const graph = expandWorkflowGraph(store.snapshot(), runId);
|
|
7
|
+
const ids = new Set<string>([runId]);
|
|
8
|
+
for (const stage of graph.stages) ids.add(stage.workflowGraphTarget.runId);
|
|
9
|
+
return [...ids];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Find the aggregate top-level lifecycle owner for a nested child run. */
|
|
13
|
+
export function aggregateWorkflowRootRunId(store: Store, runId: string): string {
|
|
14
|
+
let current = runId;
|
|
15
|
+
const visited = new Set<string>();
|
|
16
|
+
while (!visited.has(current)) {
|
|
17
|
+
visited.add(current);
|
|
18
|
+
const parent = store.runs().find((run) => run.stages.some((stage) =>
|
|
19
|
+
stage.workflowChildRun?.runId === current || stage.workflowChild?.runId === current
|
|
20
|
+
));
|
|
21
|
+
if (parent === undefined) return current;
|
|
22
|
+
current = parent.id;
|
|
23
|
+
}
|
|
24
|
+
return current;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Whether this workflow boundary contains a paused/blocked descendant stage. */
|
|
28
|
+
export function workflowHasPausedStages(store: Store, runId: string): boolean {
|
|
29
|
+
return expandedControlRunIds(store, runId).some((controlRunId) =>
|
|
30
|
+
store.runs().find((run) => run.id === controlRunId)?.stages.some(
|
|
31
|
+
(stage) => stage.status === "paused" || stage.status === "blocked",
|
|
32
|
+
) ?? false
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Whether this workflow boundary or any descendant remains paused. */
|
|
37
|
+
export function workflowHasPausedState(store: Store, runId: string): boolean {
|
|
38
|
+
return expandedControlRunIds(store, runId).some((controlRunId) => {
|
|
39
|
+
const run = store.runs().find((candidate) => candidate.id === controlRunId);
|
|
40
|
+
return run?.status === "paused" || run?.stages.some(
|
|
41
|
+
(stage) => stage.status === "paused" || stage.status === "blocked",
|
|
42
|
+
) === true;
|
|
43
|
+
});
|
|
44
|
+
}
|