@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
|
@@ -27,13 +27,14 @@ import type {
|
|
|
27
27
|
} from "@bastani/atomic";
|
|
28
28
|
import type { StageAdapters, StageSessionCreateResult, StageSessionRuntime } from "../runs/foreground/stage-runner.js";
|
|
29
29
|
import type { StageExecutionMeta, StageOptions } from "../shared/types.js";
|
|
30
|
+
import { resolveStageGroup, stageHasIntercomAccess } from "../shared/intercom-group.js";
|
|
30
31
|
import { stageUiBroker, type StageUiBroker } from "../shared/stage-ui-broker.js";
|
|
31
32
|
import { prepareAtomicStageSessionOptions } from "./atomic-stage-session.js";
|
|
32
33
|
import type { PiCodingAgentSdk, PrepareAtomicStageSessionOptions } from "./atomic-stage-session.js";
|
|
33
34
|
export { prepareAtomicStageSessionOptions } from "./atomic-stage-session.js";
|
|
34
35
|
export type { AtomicCreateAgentSessionOptions, PiCodingAgentSdk, PiSdkResourceLoader, PiSdkSettingsManager, PrepareAtomicStageSessionOptions } from "./atomic-stage-session.js";
|
|
35
36
|
import type { PiCustomOverlayFactory, PiCustomOverlayOptions, PiUISurface } from "./ui-surface.js";
|
|
36
|
-
export type { PiCustomComponent, PiCustomOverlayFactory, PiCustomOverlayFactoryTui, PiCustomOverlayFunction, PiCustomOverlayOptions, PiEditorComponent, PiEditorFactory, PiHostCustomUiState, PiHostCustomUiStateListener, PiKeybindings, PiOverlayHandle, PiOverlayOptions, PiTheme, PiUIDialogOptions, PiUISurface, UIWiringSurface } from "./ui-surface.js";
|
|
37
|
+
export type { PiCustomComponent, PiCustomOverlayFactory, PiCustomOverlayFactoryTui, PiCustomOverlayFunction, PiCustomOverlayOptions, PiEditorComponent, PiEditorFactory, PiHostCustomUiState, PiHostCustomUiStateListener, PiHostSessionPickerFunction, PiHostSessionPickerHandle, PiHostSessionPickerRequest, PiHostSessionPickerRow, PiKeybindings, PiOverlayHandle, PiOverlayOptions, PiRemoteTerminalControl, PiTheme, PiUIDialogOptions, PiUISurface, UIWiringSurface } from "./ui-surface.js";
|
|
37
38
|
|
|
38
39
|
// ---------------------------------------------------------------------------
|
|
39
40
|
// Minimal pi surface
|
|
@@ -60,6 +61,23 @@ export interface PiExecOpts {
|
|
|
60
61
|
timeout?: number;
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
type StageLateMessageRouter = NonNullable<
|
|
65
|
+
NonNullable<CreateAgentSessionOptions["orchestrationContext"]>["lateMessageRouter"]
|
|
66
|
+
>;
|
|
67
|
+
|
|
68
|
+
const LATE_STAGE_MESSAGE_EVENT = "atomic:workflow-stage-late-message";
|
|
69
|
+
type LateStageMessage = Parameters<StageLateMessageRouter["routeMessage"]>[0];
|
|
70
|
+
type LateStageMessageEvent = {
|
|
71
|
+
handled: boolean;
|
|
72
|
+
completion?: Promise<void>;
|
|
73
|
+
batch: boolean;
|
|
74
|
+
messages: LateStageMessage[];
|
|
75
|
+
workflowRunId: string;
|
|
76
|
+
workflowStageId: string;
|
|
77
|
+
workflowStageName: string;
|
|
78
|
+
options?: Parameters<StageLateMessageRouter["routeMessage"]>[1];
|
|
79
|
+
};
|
|
80
|
+
|
|
63
81
|
export interface RuntimeWiringSurface {
|
|
64
82
|
exec?: (command: string, args: string[], opts?: PiExecOpts) => Promise<PiExecResult>;
|
|
65
83
|
ui?: PiUISurface;
|
|
@@ -67,6 +85,9 @@ export interface RuntimeWiringSurface {
|
|
|
67
85
|
getResourceLoaderInheritanceSnapshot?: () => DefaultResourceLoaderInheritanceSnapshot | undefined;
|
|
68
86
|
/** Test seam: inject a stub session factory instead of importing the SDK. */
|
|
69
87
|
createAgentSession?: (options?: CreateAgentSessionOptions) => Promise<StageSessionCreateResult>;
|
|
88
|
+
sendMessage?: StageLateMessageRouter["routeMessage"];
|
|
89
|
+
sendMessages?: StageLateMessageRouter["routeMessages"];
|
|
90
|
+
events?: { emit?: (channel: string, data: Record<string, unknown>) => void };
|
|
70
91
|
}
|
|
71
92
|
|
|
72
93
|
export interface RuntimeAdapterBuildOptions {
|
|
@@ -170,19 +191,63 @@ async function createTestAgentSession(_options?: CreateAgentSessionOptions): Pro
|
|
|
170
191
|
function stripWorkflowOnlyOptions(options: (StageOptions | CreateAgentSessionOptions) | undefined): CreateAgentSessionOptions | undefined {
|
|
171
192
|
if (!options) return options;
|
|
172
193
|
const maybeWorkflowOptions = options as StageOptions;
|
|
173
|
-
const { schema: _schema, mcp: _mcp, fallbackModels: _fallbackModels, ...sessionOptions } = maybeWorkflowOptions;
|
|
194
|
+
const { schema: _schema, mcp: _mcp, fallbackModels: _fallbackModels, group: _group, ...sessionOptions } = maybeWorkflowOptions;
|
|
174
195
|
return sessionOptions as CreateAgentSessionOptions;
|
|
175
196
|
}
|
|
176
197
|
|
|
177
|
-
function
|
|
198
|
+
function emitLateIntercomRoute(
|
|
199
|
+
pi: RuntimeWiringSurface,
|
|
200
|
+
meta: StageExecutionMeta,
|
|
201
|
+
messages: LateStageMessage[],
|
|
202
|
+
options: LateStageMessageEvent["options"] | undefined,
|
|
203
|
+
batch: boolean,
|
|
204
|
+
): Promise<void> | undefined {
|
|
205
|
+
if (!messages.some((message) => message.customType === "intercom_message") || !pi.events?.emit) return undefined;
|
|
206
|
+
const event: LateStageMessageEvent = {
|
|
207
|
+
handled: false,
|
|
208
|
+
messages,
|
|
209
|
+
options,
|
|
210
|
+
batch,
|
|
211
|
+
workflowRunId: meta.runId,
|
|
212
|
+
workflowStageId: meta.stageId,
|
|
213
|
+
workflowStageName: meta.stageName,
|
|
214
|
+
};
|
|
215
|
+
pi.events.emit(LATE_STAGE_MESSAGE_EVENT, event as unknown as Record<string, unknown>);
|
|
216
|
+
if (!event.handled) return undefined;
|
|
217
|
+
return event.completion ?? Promise.resolve();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function makeWorkflowStageOrchestrationContext(
|
|
221
|
+
meta: StageExecutionMeta,
|
|
222
|
+
pi: RuntimeWiringSurface,
|
|
223
|
+
): NonNullable<CreateAgentSessionOptions["orchestrationContext"]> {
|
|
224
|
+
const intercomGroup = stageHasIntercomAccess(meta.stageOptions) ? resolveStageGroup(meta.stageOptions) : undefined;
|
|
178
225
|
return {
|
|
179
226
|
kind: "workflow-stage",
|
|
180
227
|
workflowRunId: meta.runId,
|
|
181
228
|
workflowStageId: meta.stageId,
|
|
182
229
|
workflowStageName: meta.stageName,
|
|
183
|
-
constraints: {
|
|
184
|
-
|
|
185
|
-
|
|
230
|
+
constraints: { disableWorkflowTool: true, maxSubagentDepth: 5 },
|
|
231
|
+
...(intercomGroup ? { intercomGroup } : {}),
|
|
232
|
+
lateMessageRouter: {
|
|
233
|
+
routeMessage(message, options) {
|
|
234
|
+
const intercomRoute = emitLateIntercomRoute(pi, meta, [message], options, false);
|
|
235
|
+
if (intercomRoute) return intercomRoute;
|
|
236
|
+
if (!pi.sendMessage) throw new Error("atomic-workflows: main-chat late-message route is unavailable");
|
|
237
|
+
return pi.sendMessage(message, options);
|
|
238
|
+
},
|
|
239
|
+
routeMessages(messages, options) {
|
|
240
|
+
const intercomRoute = emitLateIntercomRoute(pi, meta, messages, options, true);
|
|
241
|
+
if (intercomRoute) return intercomRoute;
|
|
242
|
+
if (pi.sendMessages) return pi.sendMessages(messages, options);
|
|
243
|
+
const sendMessage = pi.sendMessage;
|
|
244
|
+
if (!sendMessage) throw new Error("atomic-workflows: main-chat late-message route is unavailable");
|
|
245
|
+
return (async () => {
|
|
246
|
+
for (const [index, message] of messages.entries()) {
|
|
247
|
+
await sendMessage(message, index === 0 ? options : { deliverAs: "followUp" });
|
|
248
|
+
}
|
|
249
|
+
})();
|
|
250
|
+
},
|
|
186
251
|
},
|
|
187
252
|
};
|
|
188
253
|
}
|
|
@@ -190,6 +255,7 @@ function makeWorkflowStageOrchestrationContext(meta: StageExecutionMeta): NonNul
|
|
|
190
255
|
function withWorkflowStageSessionOptions(
|
|
191
256
|
options: CreateAgentSessionOptions,
|
|
192
257
|
meta: StageExecutionMeta | undefined,
|
|
258
|
+
pi: RuntimeWiringSurface,
|
|
193
259
|
): CreateAgentSessionOptions {
|
|
194
260
|
// Workflow stage sessions should never see the workflow tool, even when older
|
|
195
261
|
// meta-less callers cannot receive the richer runtime orchestration context.
|
|
@@ -204,7 +270,9 @@ function withWorkflowStageSessionOptions(
|
|
|
204
270
|
return {
|
|
205
271
|
...options,
|
|
206
272
|
excludedTools,
|
|
207
|
-
...(meta
|
|
273
|
+
...(meta
|
|
274
|
+
? { orchestrationContext: meta.orchestrationContext ?? makeWorkflowStageOrchestrationContext(meta, pi) }
|
|
275
|
+
: {}),
|
|
208
276
|
};
|
|
209
277
|
}
|
|
210
278
|
|
|
@@ -309,6 +377,7 @@ export function buildRuntimeAdapters(
|
|
|
309
377
|
const sessionOptions = withWorkflowStageSessionOptions(
|
|
310
378
|
stripWorkflowOnlyOptions(stageOptions) ?? {},
|
|
311
379
|
meta,
|
|
380
|
+
pi,
|
|
312
381
|
);
|
|
313
382
|
const result = await createSession(sessionOptions);
|
|
314
383
|
const bindable = result.session as BindableStageSession;
|
|
@@ -27,7 +27,7 @@ function adminCompletions(): PiArgumentCompletion[] {
|
|
|
27
27
|
{ value: "list ", label: "list", description: "List registered workflows" },
|
|
28
28
|
{ value: "status ", label: "status", description: "List current-session active and retained terminal runs" },
|
|
29
29
|
{ value: "interrupt ", label: "interrupt", description: "Interrupt a run" },
|
|
30
|
-
{ value: "
|
|
30
|
+
{ value: "quit ", label: "quit", description: "Quit a run and keep it resumable" },
|
|
31
31
|
{ value: "pause ", label: "pause", description: "Pause a run or stage" },
|
|
32
32
|
{ value: "resume ", label: "resume", description: "Re-open overlay for a run" },
|
|
33
33
|
{ value: "inputs ", label: "inputs", description: "Show a workflow's input schema" },
|
|
@@ -56,7 +56,7 @@ export function workflowArgumentCompletionsNeedWorkflowResources(partial: string
|
|
|
56
56
|
const subcommand = parts[0] ?? "";
|
|
57
57
|
if (!partial.includes(" ")) return true;
|
|
58
58
|
if (!subcommand || subcommand === "inputs") return true;
|
|
59
|
-
if (["status", "connect", "resume", "attach", "pause", "interrupt", "
|
|
59
|
+
if (["status", "connect", "resume", "attach", "pause", "interrupt", "quit", "reload"].includes(subcommand)) {
|
|
60
60
|
return false;
|
|
61
61
|
}
|
|
62
62
|
return true;
|
|
@@ -76,15 +76,20 @@ export function workflowArgumentCompletions(
|
|
|
76
76
|
if (["status", "connect", "resume", "attach", "pause"].includes(subcommand)) {
|
|
77
77
|
return completeToken(partial, runIdItems());
|
|
78
78
|
}
|
|
79
|
-
if (subcommand === "interrupt"
|
|
80
|
-
const verb = subcommand === "kill" ? "Kill and retain" : "Interrupt";
|
|
79
|
+
if (subcommand === "interrupt") {
|
|
81
80
|
return completeToken(partial, [
|
|
82
|
-
{ value: "--all ", label: "--all", description:
|
|
81
|
+
{ value: "--all ", label: "--all", description: "Interrupt all in-flight runs" },
|
|
83
82
|
{ value: "--yes ", label: "--yes", description: "Skip confirmation" },
|
|
84
83
|
{ value: "-y ", label: "-y", description: "Skip confirmation" },
|
|
85
84
|
...runIdItems(),
|
|
86
85
|
]);
|
|
87
86
|
}
|
|
87
|
+
if (subcommand === "quit") {
|
|
88
|
+
return completeToken(partial, [
|
|
89
|
+
{ value: "--all ", label: "--all", description: "Quit and keep all in-flight runs resumable" },
|
|
90
|
+
...runIdItems(),
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
88
93
|
if (!subcommand) return completeToken(partial, [...adminCompletions(), ...workflows()]);
|
|
89
94
|
|
|
90
95
|
const workflow = runtime.registry.get(subcommand);
|
|
@@ -5,6 +5,7 @@ import { store } from "../shared/store.js";
|
|
|
5
5
|
import type { WorkflowExecutionPolicy } from "../shared/types.js";
|
|
6
6
|
import { emitChatSurface } from "../tui/chat-surface-message.js";
|
|
7
7
|
import { openInlineInputsForm } from "../tui/inline-form-overlay.js";
|
|
8
|
+
import { openHostInputsForm } from "../tui/host-input-form.js";
|
|
8
9
|
import { openInputsPicker } from "../tui/inputs-overlay.js";
|
|
9
10
|
import { deriveGraphTheme } from "../tui/graph-theme.js";
|
|
10
11
|
import { selectRunsForPicker } from "../tui/session-picker.js";
|
|
@@ -59,7 +60,7 @@ export function registerWorkflowSlashCommand(
|
|
|
59
60
|
pi,
|
|
60
61
|
"workflow",
|
|
61
62
|
{
|
|
62
|
-
description: "Run or inspect Atomic workflows. Usage: /workflow <name> [key=value…] | /workflow [list|status|connect|attach|interrupt|
|
|
63
|
+
description: "Run or inspect Atomic workflows. Usage: /workflow <name> [key=value…] | /workflow [list|status|connect|attach|interrupt|quit|pause|resume|inputs|reload] [args]",
|
|
63
64
|
handler: (args, ctx) => workflowSlashHandler(args, ctx, pi, deps),
|
|
64
65
|
getArgumentCompletions: (partial: string): PiArgumentCompletionResult | Promise<PiArgumentCompletionResult> => {
|
|
65
66
|
const buildCompletions = (): PiArgumentCompletionResult => workflowArgumentCompletions(partial, deps.runtimeProxy);
|
|
@@ -69,6 +70,18 @@ export function registerWorkflowSlashCommand(
|
|
|
69
70
|
},
|
|
70
71
|
workflowCommands,
|
|
71
72
|
);
|
|
73
|
+
registerWorkflowCommand(
|
|
74
|
+
pi,
|
|
75
|
+
"workflows",
|
|
76
|
+
{
|
|
77
|
+
description: "List retained workflow runs or open one by id. Usage: /workflows [run-id]",
|
|
78
|
+
handler: (args, ctx) => {
|
|
79
|
+
const target = args.trim();
|
|
80
|
+
return workflowSlashHandler(target.length === 0 ? "resume" : `resume ${target}`, ctx, pi, deps);
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
workflowCommands,
|
|
84
|
+
);
|
|
72
85
|
}
|
|
73
86
|
|
|
74
87
|
async function workflowSlashHandler(
|
|
@@ -154,10 +167,14 @@ async function workflowSlashHandler(
|
|
|
154
167
|
}
|
|
155
168
|
return;
|
|
156
169
|
}
|
|
157
|
-
if (subcommand === "interrupt"
|
|
170
|
+
if (subcommand === "interrupt") {
|
|
158
171
|
await handleRunControlCommand(subcommand, withImplicitYesFlag(parts.slice(1)), ctx, reporter, deps.runControl);
|
|
159
172
|
return;
|
|
160
173
|
}
|
|
174
|
+
if (subcommand === "quit") {
|
|
175
|
+
await handleRunControlCommand(subcommand, parts.slice(1), ctx, reporter, deps.runControl);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
161
178
|
if (subcommand === "inputs") {
|
|
162
179
|
const workflowName = parts[1] ?? "";
|
|
163
180
|
if (!workflowName) return fail("Usage: /workflow inputs <name>");
|
|
@@ -176,7 +193,9 @@ async function workflowSlashHandler(
|
|
|
176
193
|
let mergedInputs = inputs;
|
|
177
194
|
let pickerWasShown = false;
|
|
178
195
|
const canOpenPicker = policy.allowInputPicker && !wantsPickerSkip && (
|
|
179
|
-
typeof ctx.ui?.
|
|
196
|
+
typeof ctx.ui?.hostInputForm === "function" ||
|
|
197
|
+
typeof ctx.ui?.setEditorComponent === "function" ||
|
|
198
|
+
typeof ctx.ui?.custom === "function"
|
|
180
199
|
);
|
|
181
200
|
if (canOpenPicker) {
|
|
182
201
|
await ensureWorkflowResourcesVisible();
|
|
@@ -191,9 +210,12 @@ async function workflowSlashHandler(
|
|
|
191
210
|
if (fields.length > 0 && (inputTokens.length === 0 || missingRequired)) {
|
|
192
211
|
pickerWasShown = true;
|
|
193
212
|
const pickerTheme = deriveGraphTheme({});
|
|
194
|
-
let pickerResult = typeof ctx.ui?.
|
|
195
|
-
? await
|
|
213
|
+
let pickerResult = typeof ctx.ui?.hostInputForm === "function"
|
|
214
|
+
? await openHostInputsForm(ctx.ui, { workflowName, fields, prefilled: inputs })
|
|
196
215
|
: { kind: "unsupported" as const };
|
|
216
|
+
if (pickerResult.kind === "unsupported" && typeof ctx.ui?.setEditorComponent === "function") {
|
|
217
|
+
pickerResult = await openInlineInputsForm(pi, ctx, { workflowName, fields, prefilled: inputs, theme: pickerTheme });
|
|
218
|
+
}
|
|
197
219
|
if (pickerResult.kind === "unsupported" && typeof ctx.ui?.custom === "function") {
|
|
198
220
|
pickerResult = await openInputsPicker(ctx.ui, { workflowName, fields, prefilled: inputs, theme: pickerTheme });
|
|
199
221
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { WorkflowPersistencePort } from "../shared/types.js";
|
|
2
1
|
import { store } from "../shared/store.js";
|
|
3
2
|
import type { RunSnapshot } from "../shared/store-types.js";
|
|
4
3
|
import { openWorkflowResumeSelector } from "../tui/workflow-resume-selector.js";
|
|
@@ -7,6 +6,10 @@ import { formatResumableWorkflowList } from "../durable/resume-catalog.js";
|
|
|
7
6
|
import { getDurableBackend } from "../durable/factory.js";
|
|
8
7
|
import { listOpenableCompletedWorkflows } from "../durable/completed-catalog.js";
|
|
9
8
|
import { openCompletedDurableWorkflow } from "../durable/completed-inspection.js";
|
|
9
|
+
import {
|
|
10
|
+
deleteDurableWorkflowIfSafe,
|
|
11
|
+
type DurableWorkflowDeleteOutcome,
|
|
12
|
+
} from "../durable/retention-policy.js";
|
|
10
13
|
import type { ResumableWorkflowEntry } from "../durable/types.js";
|
|
11
14
|
import type { ExtensionRuntime } from "./runtime.js";
|
|
12
15
|
import type { ExtensionAPI, PiCommandContext } from "./public-types.js";
|
|
@@ -18,7 +21,6 @@ import { overlaySurfaceFromContext } from "./workflow-targets.js";
|
|
|
18
21
|
export interface WorkflowRunControlDeps {
|
|
19
22
|
pi: ExtensionAPI;
|
|
20
23
|
overlay: GraphOverlayPort;
|
|
21
|
-
getPersistence: () => WorkflowPersistencePort | undefined;
|
|
22
24
|
runtimeForContext: (ctx?: PiCommandContext) => ExtensionRuntime;
|
|
23
25
|
ensureWorkflowResourcesLoaded: () => Promise<void> | void;
|
|
24
26
|
}
|
|
@@ -43,24 +45,36 @@ export async function prepareWorkflowResumeCatalog(
|
|
|
43
45
|
activeLiveIds: ReadonlySet<string>,
|
|
44
46
|
target?: string,
|
|
45
47
|
): Promise<WorkflowResumeCatalog> {
|
|
46
|
-
const
|
|
48
|
+
const shared = await runtime.prepareDurableCatalog?.();
|
|
49
|
+
const prepared = shared?.resumable ?? await runtime.prepareDurableResumable(target);
|
|
47
50
|
const backend = getDurableBackend();
|
|
51
|
+
const isDisplayLoadable = (entry: ResumableWorkflowEntry): boolean =>
|
|
52
|
+
shared !== undefined || backend.isWorkflowLoadable(entry.workflowId);
|
|
48
53
|
const resumable = filterSelectorDurableEntries(runtime, prepared)
|
|
49
|
-
.filter((entry) => !activeLiveIds.has(entry.workflowId) &&
|
|
50
|
-
const completed = runtime.prepareCompletedDurable !== undefined
|
|
54
|
+
.filter((entry) => !activeLiveIds.has(entry.workflowId) && isDisplayLoadable(entry));
|
|
55
|
+
const completed = shared?.completed ?? (runtime.prepareCompletedDurable !== undefined
|
|
51
56
|
? await runtime.prepareCompletedDurable()
|
|
52
|
-
: listOpenableCompletedWorkflows(backend);
|
|
57
|
+
: listOpenableCompletedWorkflows(backend));
|
|
53
58
|
return {
|
|
54
59
|
resumable,
|
|
55
|
-
completed: completed.filter((entry) => !activeLiveIds.has(entry.workflowId) &&
|
|
60
|
+
completed: completed.filter((entry) => !activeLiveIds.has(entry.workflowId) && isDisplayLoadable(entry)),
|
|
56
61
|
};
|
|
57
62
|
}
|
|
58
63
|
|
|
64
|
+
export function deleteWorkflowResumeEntry(workflowId: string): Promise<DurableWorkflowDeleteOutcome> {
|
|
65
|
+
return deleteDurableWorkflowIfSafe(getDurableBackend(), workflowId, (candidateId) => {
|
|
66
|
+
const run = store.runs().find((candidate) => candidate.id === candidateId);
|
|
67
|
+
return run !== undefined && run.status !== "completed"
|
|
68
|
+
&& (run.endedAt === undefined || run.status === "paused");
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
59
72
|
export async function handleDurableResume(
|
|
60
73
|
target: string | undefined,
|
|
61
74
|
ctx: PiCommandContext,
|
|
62
75
|
reporter: WorkflowCommandReporter,
|
|
63
76
|
deps: WorkflowRunControlDeps,
|
|
77
|
+
preparedCatalog?: WorkflowResumeCatalog,
|
|
64
78
|
): Promise<boolean> {
|
|
65
79
|
const print = (message: string): void => reporter.info(message);
|
|
66
80
|
const fail = (message: string): void => reporter.error(message);
|
|
@@ -71,7 +85,7 @@ export async function handleDurableResume(
|
|
|
71
85
|
}
|
|
72
86
|
const runtime = deps.runtimeForContext(ctx);
|
|
73
87
|
const policy = workflowPolicyFromContext(ctx);
|
|
74
|
-
const catalog = await prepareWorkflowResumeCatalog(runtime, new Set(), target);
|
|
88
|
+
const catalog = preparedCatalog ?? await prepareWorkflowResumeCatalog(runtime, new Set(), target);
|
|
75
89
|
const allOpenable = [...catalog.resumable, ...catalog.completed];
|
|
76
90
|
|
|
77
91
|
if (target !== undefined) {
|
|
@@ -79,7 +93,9 @@ export async function handleDurableResume(
|
|
|
79
93
|
target,
|
|
80
94
|
[],
|
|
81
95
|
catalog.resumable,
|
|
82
|
-
|
|
96
|
+
// Reuse the catalog prepared above instead of re-enumerating the durable
|
|
97
|
+
// directory a second time for the same command invocation.
|
|
98
|
+
catalog.completed,
|
|
83
99
|
);
|
|
84
100
|
if (resolved.kind === "ambiguous") {
|
|
85
101
|
fail(`Ambiguous workflow prefix "${target}" matches: ${formatMatches(resolved.matches)}`);
|
|
@@ -89,7 +105,7 @@ export async function handleDurableResume(
|
|
|
89
105
|
return openCompletedTarget(resolved.workflowId, catalog.completed, ctx, reporter, deps, runtime);
|
|
90
106
|
}
|
|
91
107
|
if (resolved.kind === "durable") {
|
|
92
|
-
return resumeDurableTarget(resolved.workflowId, ctx, reporter, deps, runtime);
|
|
108
|
+
return await resumeDurableTarget(resolved.workflowId, ctx, reporter, deps, runtime);
|
|
93
109
|
}
|
|
94
110
|
|
|
95
111
|
const completedAttempt = openCompleted(runtime, target, catalog.completed);
|
|
@@ -97,7 +113,7 @@ export async function handleDurableResume(
|
|
|
97
113
|
fail(completedAttempt.message);
|
|
98
114
|
return true;
|
|
99
115
|
}
|
|
100
|
-
const result = runtime.resumeDurableWorkflow(target, { policy });
|
|
116
|
+
const result = await runtime.resumeDurableWorkflow(target, { policy });
|
|
101
117
|
fail(allOpenable.length === 0
|
|
102
118
|
? result.message
|
|
103
119
|
: `${result.message}\n\n${formatResumableWorkflowList(allOpenable)}`);
|
|
@@ -113,12 +129,26 @@ export async function handleDurableResume(
|
|
|
113
129
|
print(`${formatResumableWorkflowList(allOpenable)}\n\n${instruction}: /workflow resume <id>`);
|
|
114
130
|
return true;
|
|
115
131
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
132
|
+
let picked: Awaited<ReturnType<typeof openWorkflowResumeSelector>>;
|
|
133
|
+
try {
|
|
134
|
+
picked = await openWorkflowResumeSelector(
|
|
135
|
+
ctx.ui,
|
|
136
|
+
[],
|
|
137
|
+
// Catalog already prepared above; resolve it immediately with no rescan.
|
|
138
|
+
() => Promise.resolve({ durable: catalog.resumable, completed: catalog.completed }),
|
|
139
|
+
{ deleteWorkflow: deleteWorkflowResumeEntry },
|
|
140
|
+
);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
// No fallback: a host without the session-picker capability fails the
|
|
143
|
+
// resume command with one actionable message.
|
|
144
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
if (picked.result.kind === "durable") {
|
|
148
|
+
return resumeDurableTarget(picked.result.workflowId, ctx, reporter, deps, runtime);
|
|
119
149
|
}
|
|
120
|
-
if (picked.kind === "completed") {
|
|
121
|
-
return openCompletedTarget(picked.workflowId, catalog.completed, ctx, reporter, deps, runtime);
|
|
150
|
+
if (picked.result.kind === "completed") {
|
|
151
|
+
return openCompletedTarget(picked.result.workflowId, catalog.completed, ctx, reporter, deps, runtime);
|
|
122
152
|
}
|
|
123
153
|
return true;
|
|
124
154
|
}
|
|
@@ -172,14 +202,14 @@ function isExplicitResumeCandidate(run: RunSnapshot): boolean {
|
|
|
172
202
|
return run.resumable === true && run.failureRecoverability === "recoverable";
|
|
173
203
|
}
|
|
174
204
|
|
|
175
|
-
function resumeDurableTarget(
|
|
205
|
+
async function resumeDurableTarget(
|
|
176
206
|
workflowId: string,
|
|
177
207
|
ctx: PiCommandContext,
|
|
178
208
|
reporter: WorkflowCommandReporter,
|
|
179
209
|
deps: WorkflowRunControlDeps,
|
|
180
210
|
runtime: ExtensionRuntime,
|
|
181
|
-
): boolean {
|
|
182
|
-
const result = runtime.resumeDurableWorkflow(workflowId, { policy: workflowPolicyFromContext(ctx) });
|
|
211
|
+
): Promise<boolean> {
|
|
212
|
+
const result = await runtime.resumeDurableWorkflow(workflowId, { policy: workflowPolicyFromContext(ctx) });
|
|
183
213
|
if (!result.ok) reporter.error(result.message);
|
|
184
214
|
else {
|
|
185
215
|
reporter.info(result.message);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export const WORKFLOW_TOOL_DESCRIPTION =
|
|
2
|
-
"Run named builtin, project, user, or package workflows
|
|
2
|
+
"Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " +
|
|
3
3
|
"when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; " +
|
|
4
|
-
"discover with list/get/inputs, inspect status/stages/stage details, " +
|
|
5
|
-
"send prompt answers or steering, pause/resume/interrupt/
|
|
4
|
+
"discover with list/get/inputs, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " +
|
|
5
|
+
"send prompt answers or steering, pause/resume/interrupt/quit runs, and reload workflow resources. " +
|
|
6
6
|
"For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " +
|
|
7
7
|
"For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, " +
|
|
8
8
|
"quote the exact path without rewriting separators (Windows backslashes are valid), " +
|
|
9
9
|
"then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview.";
|
|
10
10
|
|
|
11
11
|
export const DEFAULT_PROMPT_GUIDANCE: string[] = [
|
|
12
|
-
`**Workflows**: Treat workflows as the default execution path for any non-trivial task and for any request that has inherent structure plus an objective you can make verifiable. Use the \`workflow\` tool for existing named workflows
|
|
12
|
+
`**Workflows**: Treat workflows as the default execution path for any non-trivial task and for any request that has inherent structure plus an objective you can make verifiable. Use the \`workflow\` tool for existing named workflows; when the task needs a graph that is not installed, author a custom TypeScript \`workflow({...})\` inline with normal coding tools, reload workflow resources, and run it.
|
|
13
13
|
- Decide the execution mode before your first tool call on a new request and state it in one short line: inline (tiny, deterministic, low-risk) or workflow. Reconnaissance counts as inline execution, so an unstated "explore first" default must not silently commit you to an unbounded inline session.
|
|
14
14
|
- Workflow fit check: prefer a workflow for implementation, build, debug/diagnosis, bug-fix, migration, new-feature, scoped multi-file, or docs/code changes with validation; and whenever there are multiple steps, dependencies, handoffs, uncertainty, review/validation needs, long-running work, measurable done criteria, or an outcome that needs evidence.
|
|
15
15
|
- Treat loop or stop-condition wording as a strong workflow signal, especially "do X until Y", "repeat until", "iterate until", "review/fix until passing", "run checks and fix until green", "keep going until done", or any prompt that names an approval gate or evidence requirement.
|
|
16
|
-
- Do not force-fit an installed workflow
|
|
16
|
+
- Do not force-fit an installed workflow or builtin such as \`goal\` or \`ralph\`. When another graph better matches the task, write a task-specific TypeScript workflow inline. Use and combine the documented starter patterns: Classify-and-act for runtime routing, Fan-out-and-synthesize for independent slices, Adversarial verification for worker/reviewer/reducer repair, Generate-and-filter or Tournament for competing candidates, and Loop until done for bounded convergence. Rich custom workflows may use deterministic branching, dynamic fan-out, child workflows, artifacts, structured outputs, human-in-the-loop prompts, gates, retries, and explicit stop conditions.
|
|
17
17
|
- Compose workflows instead of rebuilding every capability in one graph. Workflow definitions are normal TypeScript modules: import reusable project/package definitions or builtins from \`@bastani/workflows/builtin\`, then call \`ctx.workflow(childDefinition, { inputs, stageName })\`. Imported children may nest more workflows up to \`maxDepth\`; their stages, HIL prompts, control, durability, and declared outputs remain part of the expanded parent graph. Pass definitions, not registry-name strings or paths.
|
|
18
18
|
- Composition examples: import \`deepResearchCodebase\`, then conditionally nest \`goal\` or \`ralph\` for implementation; wrap \`openClaudeDesign\` with project-specific approval/export stages; or build a reusable user-defined research child and import it into several parent workflows. Prefer composing a proven builtin or shared child over copying its prompt/graph.
|
|
19
19
|
- Example custom shapes: classify a request and dispatch category-specific stages; fan out per package and synthesize artifact-backed results; implement, run fresh-context verifiers, reduce findings, and loop through repairs until approved; generate several plans and filter or tournament-rank them; or rerun checks and fixes until green with a progress ledger and max-iteration escape hatch.
|
|
@@ -22,9 +22,9 @@ export const DEFAULT_PROMPT_GUIDANCE: string[] = [
|
|
|
22
22
|
- Only skip workflows for tiny, deterministic, low-risk answers or direct edits where stage tracking clearly costs more than it adds, typically a single-file/no-test/no-review change or a simple answer.`,
|
|
23
23
|
`**Workflow discovery and lifecycle**:
|
|
24
24
|
- For unfamiliar named workflows, discover with \`action: "list"\`, inspect with \`action: "get"\` or \`action: "inputs"\`, and run with \`action: "run"\`, \`workflow\`, and validated \`inputs\`; do not invent workflow names or input keys.
|
|
25
|
-
- In interactive chat,
|
|
26
|
-
- Natural-language instructions to create or use a worktree do not enable runner isolation.
|
|
27
|
-
- Once you run a workflow, end the current turn and wait for user input or a lifecycle notice. Do not use sleep/status polling loops: key start, finish, and failure events arrive automatically. Use targeted \`status\`/\`stages\`/\`stage\` checks only when the user asks or the next step needs them, and use \`send\`/\`pause\`/\`resume\`/\`interrupt\`/\`
|
|
25
|
+
- In interactive chat, named workflow launches run in the background. Run \`/workflow connect <run>\` to see agents working and chat with and steer each stage. Inspection and control calls (\`status\`, \`stages\`, \`stage\`, \`transcript\`, \`send\`, \`pause\`, \`resume\`, \`interrupt\`, \`quit\`) remain available while work runs.
|
|
26
|
+
- Natural-language instructions to create or use a worktree do not enable runner isolation. A named workflow must declare and implement any worktree inputs it supports; inspect its inputs before launching it.
|
|
27
|
+
- Once you run a workflow, end the current turn and wait for user input or a lifecycle notice. Do not use sleep/status polling loops: key start, finish, and failure events arrive automatically. Use targeted \`status\`/\`stages\`/\`stage\` checks only when the user asks or the next step needs them, and use \`send\`/\`pause\`/\`resume\`/\`interrupt\`/\`quit\` only to answer, steer, or honor control requests.
|
|
28
28
|
- For transcripts, avoid whole-file reads. Get \`sessionFile\`/\`transcriptPath\` from \`stages\` or \`stage\`, preserve the exact path and platform separators, search with \`rg\`/\`grep\`, and read small relevant ranges; use explicit \`tail\` or \`limit\` only for a bounded preview.`,
|
|
29
29
|
`**Workflow authoring and handoffs**:
|
|
30
30
|
- When a user asks to create or edit a workflow, clarify only unresolved requirements that materially affect its purpose, inputs, stages, handoffs, validation, success criteria, or starter pattern. Read the workflow docs/examples, implement the TypeScript definition with normal coding tools, reload it, and run representative test inputs before presenting it. Use the create-spec skill when it adds value; it is not mandatory when context is already sufficient.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row sources for the `/workflow resume` picker.
|
|
3
|
+
*
|
|
4
|
+
* Only inactive workflows belong in the resume selector. Live runs contribute
|
|
5
|
+
* paused (quit) or recoverably-failed rows; actively-running live runs are
|
|
6
|
+
* hidden because resuming an executing workflow would double-dispatch it.
|
|
7
|
+
* The same collection backs the picker's live refresh (store changes plus a
|
|
8
|
+
* bounded cross-session poll), so state transitions appear while it is open.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { getDurableBackend } from "../durable/factory.js";
|
|
12
|
+
import type { ResumableWorkflowEntry } from "../durable/types.js";
|
|
13
|
+
import type { Store } from "../shared/store.js";
|
|
14
|
+
import type { RunSnapshot } from "../shared/store-types.js";
|
|
15
|
+
import { topLevelWorkflowRuns } from "../shared/run-visibility.js";
|
|
16
|
+
import type { WorkflowResumeRefresh } from "../tui/workflow-resume-selector.js";
|
|
17
|
+
import { reconcileDurableResumeShadow } from "./workflow-resume-shadow.js";
|
|
18
|
+
import type { ExtensionRuntime } from "./runtime.js";
|
|
19
|
+
import { prepareWorkflowResumeCatalog } from "./workflow-durable-resume-command.js";
|
|
20
|
+
|
|
21
|
+
export interface ResumePickerLiveSource {
|
|
22
|
+
readonly liveRuns: readonly RunSnapshot[];
|
|
23
|
+
readonly activeLiveIds: ReadonlySet<string>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function isActiveRecoverableBlock(run: RunSnapshot): boolean {
|
|
27
|
+
return run.endedAt === undefined
|
|
28
|
+
&& run.resumable === true
|
|
29
|
+
&& run.failureRecoverability === "recoverable";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function collectResumePickerLiveRuns(runStore: Store): ResumePickerLiveSource {
|
|
33
|
+
const durableResumeShadows = new Set(
|
|
34
|
+
topLevelWorkflowRuns(runStore.runs())
|
|
35
|
+
.filter((run) => reconcileDurableResumeShadow(run, runStore))
|
|
36
|
+
.map((run) => run.id),
|
|
37
|
+
);
|
|
38
|
+
const liveRuns = topLevelWorkflowRuns(runStore.runs()).filter((run) =>
|
|
39
|
+
!durableResumeShadows.has(run.id) &&
|
|
40
|
+
(run.status === "paused" || (run.status === "failed" && run.resumable !== false) || isActiveRecoverableBlock(run)) &&
|
|
41
|
+
getDurableBackend().isWorkflowLoadable(run.id),
|
|
42
|
+
);
|
|
43
|
+
const activeLiveIds = new Set(
|
|
44
|
+
topLevelWorkflowRuns(runStore.runs())
|
|
45
|
+
.filter((run) =>
|
|
46
|
+
!durableResumeShadows.has(run.id) &&
|
|
47
|
+
run.endedAt === undefined &&
|
|
48
|
+
run.status === "running" &&
|
|
49
|
+
!isActiveRecoverableBlock(run) &&
|
|
50
|
+
run.exitReason !== "quit")
|
|
51
|
+
.map((run) => run.id),
|
|
52
|
+
);
|
|
53
|
+
return { liveRuns, activeLiveIds };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface ResumePickerLiveUpdateOptions {
|
|
57
|
+
readonly watch: (onChange: () => void) => () => void;
|
|
58
|
+
readonly refresh: WorkflowResumeRefresh;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function resumePickerLiveUpdateOptions(
|
|
62
|
+
runStore: Store,
|
|
63
|
+
runtime: ExtensionRuntime,
|
|
64
|
+
): ResumePickerLiveUpdateOptions {
|
|
65
|
+
return {
|
|
66
|
+
watch: (onChange) => runStore.subscribe(() => onChange()),
|
|
67
|
+
refresh: async () => {
|
|
68
|
+
const current = collectResumePickerLiveRuns(runStore);
|
|
69
|
+
const catalog = await prepareWorkflowResumeCatalog(runtime, current.activeLiveIds);
|
|
70
|
+
return {
|
|
71
|
+
liveRuns: current.liveRuns,
|
|
72
|
+
catalog: { durable: catalog.resumable, completed: catalog.completed },
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface ResumePickerCatalogRows {
|
|
79
|
+
readonly durable: readonly ResumableWorkflowEntry[];
|
|
80
|
+
readonly completed: readonly ResumableWorkflowEntry[];
|
|
81
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { DurableWorkflowBackend } from "../durable/backend.js";
|
|
2
|
+
import { getLoadableDurableWorkflow } from "../durable/workflow-status-transition.js";
|
|
3
|
+
import { getDurableBackend } from "../durable/factory.js";
|
|
4
|
+
import { isDurableWorkflowResumable } from "../durable/resume-eligibility.js";
|
|
5
|
+
import { jobTracker, type JobTracker } from "../runs/background/job-tracker.js";
|
|
6
|
+
import {
|
|
7
|
+
stageControlRegistry,
|
|
8
|
+
type StageControlRegistry,
|
|
9
|
+
} from "../runs/foreground/stage-control-registry.js";
|
|
10
|
+
import { expandWorkflowGraph } from "../shared/expanded-workflow-graph.js";
|
|
11
|
+
import type { Store } from "../shared/store-public-types.js";
|
|
12
|
+
import type { RunSnapshot } from "../shared/store-types.js";
|
|
13
|
+
|
|
14
|
+
interface DurableResumeShadowDeps {
|
|
15
|
+
readonly backend?: DurableWorkflowBackend;
|
|
16
|
+
readonly jobs?: JobTracker;
|
|
17
|
+
readonly stageControls?: StageControlRegistry;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DurableResumeShadowClassification = "eligible" | "ineligible" | "not_shadow";
|
|
21
|
+
|
|
22
|
+
/** Classify restored metadata without manufacturing progress the durable backend rejects. */
|
|
23
|
+
export function classifyDurableResumeShadow(
|
|
24
|
+
run: RunSnapshot,
|
|
25
|
+
store: Store,
|
|
26
|
+
deps: DurableResumeShadowDeps = {},
|
|
27
|
+
): DurableResumeShadowClassification {
|
|
28
|
+
const backend = deps.backend ?? getDurableBackend();
|
|
29
|
+
const handle = getLoadableDurableWorkflow(backend, run.id);
|
|
30
|
+
if (handle?.status !== "paused" && handle?.status !== "running") return "not_shadow";
|
|
31
|
+
const jobs = deps.jobs ?? jobTracker;
|
|
32
|
+
if (jobs.has(run.id)) return "not_shadow";
|
|
33
|
+
const controls = deps.stageControls ?? stageControlRegistry;
|
|
34
|
+
const graph = expandWorkflowGraph(store.snapshot(), run.id);
|
|
35
|
+
const controlRunIds = new Set<string>([run.id]);
|
|
36
|
+
for (const stage of graph.stages) controlRunIds.add(stage.workflowGraphTarget.runId);
|
|
37
|
+
if ([...controlRunIds].some((runId) => controls.run(runId).stages().length > 0)) return "not_shadow";
|
|
38
|
+
if (!isDurableWorkflowResumable(handle)) return "ineligible";
|
|
39
|
+
if (run.status !== "paused" || run.exitReason !== "quit" || run.resumable !== true) {
|
|
40
|
+
store.recordRunPaused(run.id, undefined, { exitReason: "quit", resumable: true });
|
|
41
|
+
}
|
|
42
|
+
return "eligible";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Reconcile a session-restored snapshot with an authoritative resumable
|
|
47
|
+
* durable handle. Live jobs/controls win; zero-progress orphans remain intact.
|
|
48
|
+
*/
|
|
49
|
+
export function reconcileDurableResumeShadow(
|
|
50
|
+
run: RunSnapshot,
|
|
51
|
+
store: Store,
|
|
52
|
+
deps: DurableResumeShadowDeps = {},
|
|
53
|
+
): boolean {
|
|
54
|
+
return classifyDurableResumeShadow(run, store, deps) === "eligible";
|
|
55
|
+
}
|