@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
|
@@ -55,7 +55,6 @@ export abstract class GraphViewState {
|
|
|
55
55
|
protected store: Store;
|
|
56
56
|
protected graphTheme: GraphTheme;
|
|
57
57
|
protected onClose?: () => void;
|
|
58
|
-
protected onQuit?: (runId: string) => void;
|
|
59
58
|
protected onHide?: () => void;
|
|
60
59
|
protected onPromptResolve?: (runId: string, promptId: string, response: unknown) => void;
|
|
61
60
|
protected onStageAttach?: (runId: string, stageId: string) => void;
|
|
@@ -95,7 +94,6 @@ export abstract class GraphViewState {
|
|
|
95
94
|
this.store = opts.store;
|
|
96
95
|
this.graphTheme = opts.graphTheme;
|
|
97
96
|
this.onClose = opts.onClose;
|
|
98
|
-
this.onQuit = opts.onQuit;
|
|
99
97
|
this.onHide = opts.onHide;
|
|
100
98
|
this.onPromptResolve = opts.onPromptResolve;
|
|
101
99
|
this.onStageAttach = opts.onStageAttach;
|
|
@@ -10,12 +10,6 @@ export interface GraphViewOpts {
|
|
|
10
10
|
store: Store;
|
|
11
11
|
graphTheme: GraphTheme;
|
|
12
12
|
onClose?: () => void;
|
|
13
|
-
/**
|
|
14
|
-
* Invoked when the user presses `q` inside the pane. This quits/detaches
|
|
15
|
-
* the orchestrator view and leaves the workflow resumable; it must not use
|
|
16
|
-
* the `/workflow kill` terminal path.
|
|
17
|
-
*/
|
|
18
|
-
onQuit?: (runId: string) => void;
|
|
19
13
|
/**
|
|
20
14
|
* Invoked when the user presses `h` inside the pane. Hides without
|
|
21
15
|
* unmounting (overlay-adapter calls `setHidden(true)`). Re-open via
|
|
@@ -35,9 +29,9 @@ export interface GraphViewOpts {
|
|
|
35
29
|
*/
|
|
36
30
|
onStageAttach?: (runId: string, stageId: string) => void;
|
|
37
31
|
/**
|
|
38
|
-
* Invoked when the user presses `Ctrl+
|
|
39
|
-
*
|
|
40
|
-
*
|
|
32
|
+
* Invoked when the user presses `Ctrl+X` in graph mode. Returns to main
|
|
33
|
+
* chat by hiding the popup with `setHidden(true)`. Falls back to `onHide`
|
|
34
|
+
* when unset.
|
|
41
35
|
*/
|
|
42
36
|
onDetach?: () => void;
|
|
43
37
|
/**
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { WorkflowInputEntry } from "../extension/render-result.js";
|
|
2
|
+
import type {
|
|
3
|
+
PiHostInputFormField,
|
|
4
|
+
PiHostInputFormFunction,
|
|
5
|
+
} from "../extension/ui-surface.js";
|
|
6
|
+
import type { WorkflowInputValues } from "../shared/types.js";
|
|
7
|
+
import { coerceValues } from "./inputs-picker.js";
|
|
8
|
+
import type { InputsPickerResult } from "./inputs-overlay.js";
|
|
9
|
+
|
|
10
|
+
export interface HostInputsFormUi {
|
|
11
|
+
hostInputForm?: PiHostInputFormFunction;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function supportedType(type: string): PiHostInputFormField["type"] {
|
|
15
|
+
switch (type) {
|
|
16
|
+
case "text":
|
|
17
|
+
case "number":
|
|
18
|
+
case "integer":
|
|
19
|
+
case "boolean":
|
|
20
|
+
case "select":
|
|
21
|
+
return type;
|
|
22
|
+
default:
|
|
23
|
+
return "string";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function initialValue(field: WorkflowInputEntry, prefilled: WorkflowInputValues): string {
|
|
28
|
+
if (prefilled[field.name] !== undefined) return String(prefilled[field.name]);
|
|
29
|
+
if (field.default !== undefined) return String(field.default);
|
|
30
|
+
if (field.type === "select" && field.choices && field.choices.length > 0) return field.choices[0]!;
|
|
31
|
+
if (field.type === "boolean") return "false";
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Adapt workflow schemas to the host-owned, raw-string form capability. */
|
|
36
|
+
export async function openHostInputsForm(
|
|
37
|
+
ui: HostInputsFormUi,
|
|
38
|
+
options: {
|
|
39
|
+
workflowName: string;
|
|
40
|
+
fields: readonly WorkflowInputEntry[];
|
|
41
|
+
prefilled?: WorkflowInputValues;
|
|
42
|
+
},
|
|
43
|
+
): Promise<InputsPickerResult | { kind: "unsupported" }> {
|
|
44
|
+
const open = ui.hostInputForm;
|
|
45
|
+
if (typeof open !== "function") return { kind: "unsupported" };
|
|
46
|
+
const prefilled = options.prefilled ?? {};
|
|
47
|
+
const fields: PiHostInputFormField[] = options.fields.map((field) => ({
|
|
48
|
+
name: field.name,
|
|
49
|
+
type: supportedType(field.type),
|
|
50
|
+
initialValue: initialValue(field, prefilled),
|
|
51
|
+
...(field.description !== undefined ? { description: field.description } : {}),
|
|
52
|
+
...(field.required !== undefined ? { required: field.required } : {}),
|
|
53
|
+
...(field.choices !== undefined ? { choices: [...field.choices] } : {}),
|
|
54
|
+
...(field.placeholder !== undefined ? { placeholder: field.placeholder } : {}),
|
|
55
|
+
}));
|
|
56
|
+
try {
|
|
57
|
+
const raw = await open.call(ui, { title: options.workflowName, fields });
|
|
58
|
+
return raw === undefined ? { kind: "cancel" } : { kind: "run", values: coerceValues(options.fields, raw) };
|
|
59
|
+
} catch {
|
|
60
|
+
return { kind: "unsupported" };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type TerminalMouseProtocol = "sgr" | "x10";
|
|
2
|
+
export type TerminalMouseAction = "press" | "release";
|
|
3
|
+
export type TerminalMouseWheelDirection = "up" | "down" | "left" | "right";
|
|
4
|
+
|
|
5
|
+
export interface TerminalMouseEvent {
|
|
6
|
+
readonly protocol: TerminalMouseProtocol;
|
|
7
|
+
readonly action: TerminalMouseAction;
|
|
8
|
+
readonly buttonCode: number;
|
|
9
|
+
/** Zero-based terminal column. */
|
|
10
|
+
readonly col: number;
|
|
11
|
+
/** Zero-based terminal row. */
|
|
12
|
+
readonly row: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Parse one complete SGR or legacy X10 terminal mouse sequence. */
|
|
16
|
+
export function parseTerminalMouseInput(data: string): TerminalMouseEvent | null {
|
|
17
|
+
const sgr = data.match(/^\x1b\[<(\d+);(\d+);(\d+)([Mm])$/);
|
|
18
|
+
if (sgr) {
|
|
19
|
+
const oneBasedCol = Number.parseInt(sgr[2]!, 10);
|
|
20
|
+
const oneBasedRow = Number.parseInt(sgr[3]!, 10);
|
|
21
|
+
if (oneBasedCol < 1 || oneBasedRow < 1) return null;
|
|
22
|
+
return {
|
|
23
|
+
protocol: "sgr",
|
|
24
|
+
action: sgr[4] === "M" ? "press" : "release",
|
|
25
|
+
buttonCode: Number.parseInt(sgr[1]!, 10),
|
|
26
|
+
col: oneBasedCol - 1,
|
|
27
|
+
row: oneBasedRow - 1,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!data.startsWith("\x1b[M") || data.length !== 6) return null;
|
|
32
|
+
const buttonCode = data.charCodeAt(3) - 32;
|
|
33
|
+
const col = data.charCodeAt(4) - 33;
|
|
34
|
+
const row = data.charCodeAt(5) - 33;
|
|
35
|
+
if (buttonCode < 0 || col < 0 || row < 0) return null;
|
|
36
|
+
return {
|
|
37
|
+
protocol: "x10",
|
|
38
|
+
action: (buttonCode & (64 | 32)) === 0 && (buttonCode & 3) === 3
|
|
39
|
+
? "release"
|
|
40
|
+
: "press",
|
|
41
|
+
buttonCode,
|
|
42
|
+
col,
|
|
43
|
+
row,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function terminalMouseWheelDirection(
|
|
48
|
+
event: TerminalMouseEvent,
|
|
49
|
+
): TerminalMouseWheelDirection | null {
|
|
50
|
+
if (event.action !== "press" || (event.buttonCode & 64) === 0) return null;
|
|
51
|
+
const direction = event.buttonCode & 3;
|
|
52
|
+
if (direction === 0) return "up";
|
|
53
|
+
if (direction === 1) return "down";
|
|
54
|
+
if (direction === 2) return "left";
|
|
55
|
+
return "right";
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function isTerminalLeftMousePress(event: TerminalMouseEvent): boolean {
|
|
59
|
+
return event.action === "press"
|
|
60
|
+
&& (event.buttonCode & 64) === 0
|
|
61
|
+
&& (event.buttonCode & 32) === 0
|
|
62
|
+
&& (event.buttonCode & 3) === 0;
|
|
63
|
+
}
|
|
@@ -119,6 +119,7 @@ function durationText(stage: StageSnapshot): string {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function metaText(stage: StageSnapshot): string {
|
|
122
|
+
if (stage.topologyState === "unavailable") return "topology unavailable";
|
|
122
123
|
const deps = stage.parentIds.length;
|
|
123
124
|
const dependencyText = deps === 0 ? "root" : deps === 1 ? "1 dep" : `${deps} deps`;
|
|
124
125
|
return stage.fastMode === true ? `${dependencyText} · fast` : dependencyText;
|
|
@@ -21,10 +21,16 @@ import type { ChatMessageRenderOptions, ReadonlyFooterDataProvider } from "@bast
|
|
|
21
21
|
import { WorkflowAttachPane } from "./workflow-attach-pane.js";
|
|
22
22
|
import { WORKFLOW_STATUS_KEY } from "./workflow-status.js";
|
|
23
23
|
import { deriveGraphThemeFromPiTheme } from "./graph-theme.js";
|
|
24
|
-
import { quitRun as defaultQuitRun } from "../runs/background/quit.js";
|
|
25
24
|
import { stageControlRegistry as defaultStageControlRegistry } from "../runs/foreground/stage-control-registry.js";
|
|
26
25
|
import type { StageControlRegistry } from "../runs/foreground/stage-control-registry.js";
|
|
27
26
|
import type { StageUiBroker } from "../shared/stage-ui-broker.js";
|
|
27
|
+
import type { PostMortemHandleResolution } from "./workflow-attach-pane-types.js";
|
|
28
|
+
import {
|
|
29
|
+
remoteTerminalControlFrom,
|
|
30
|
+
setMouseScrollTracking,
|
|
31
|
+
setTerminalAutowrap,
|
|
32
|
+
} from "./overlay-terminal-modes.js";
|
|
33
|
+
import type { OverlayTerminalOutput } from "./overlay-terminal-modes.js";
|
|
28
34
|
import type {
|
|
29
35
|
PiCustomComponent,
|
|
30
36
|
PiCustomOverlayFactoryTui,
|
|
@@ -36,11 +42,14 @@ import type {
|
|
|
36
42
|
PiKeybindings,
|
|
37
43
|
PiOverlayHandle,
|
|
38
44
|
PiOverlayOptions,
|
|
45
|
+
PiRemoteTerminalControl,
|
|
39
46
|
PiTheme,
|
|
40
47
|
} from "../extension/wiring.js";
|
|
41
48
|
|
|
42
49
|
export type OverlayChatRenderSettings = Partial<Omit<ChatMessageRenderOptions, "ui" | "cwd">>;
|
|
43
50
|
|
|
51
|
+
export type { OverlayTerminalOutput } from "./overlay-terminal-modes.js";
|
|
52
|
+
|
|
44
53
|
export interface OverlayUISurface {
|
|
45
54
|
custom?: PiCustomOverlayFunction;
|
|
46
55
|
getHostCustomUiState?: () => PiHostCustomUiState;
|
|
@@ -64,12 +73,12 @@ export interface OverlayPiSurface {
|
|
|
64
73
|
* `toggle(runId)`— show if hidden, hide if visible, create if absent.
|
|
65
74
|
* `close()` — permanently dismiss.
|
|
66
75
|
*
|
|
67
|
-
* Optional `stageId` (on `open`)
|
|
68
|
-
*
|
|
76
|
+
* Optional `stageId` and owning `stageRunId` (on `open`) open directly on
|
|
77
|
+
* that exact stage-chat node — used by `/workflow attach <runId> <stageId>`
|
|
69
78
|
* and the picker overlay's connect-to-stage flow.
|
|
70
79
|
*/
|
|
71
80
|
export interface GraphOverlayPort {
|
|
72
|
-
open(runId: string | null, surface?: OverlayPiSurface, stageId?: string): void;
|
|
81
|
+
open(runId: string | null, surface?: OverlayPiSurface, stageId?: string, stageRunId?: string): void;
|
|
73
82
|
toggle(runId: string | null, surface?: OverlayPiSurface): void;
|
|
74
83
|
close(): void;
|
|
75
84
|
}
|
|
@@ -101,42 +110,25 @@ const FULLSCREEN_OVERLAY_OPTIONS: PiOverlayOptions = {
|
|
|
101
110
|
margin: 0,
|
|
102
111
|
};
|
|
103
112
|
|
|
104
|
-
const MOUSE_SCROLL_TRACKING_ON = "\x1b[?1000h\x1b[?1002h\x1b[?1006h";
|
|
105
|
-
const MOUSE_SCROLL_TRACKING_OFF = "\x1b[?1006l\x1b[?1002l\x1b[?1000l";
|
|
106
|
-
const TERMINAL_AUTOWRAP_ON = "\x1b[?7h";
|
|
107
|
-
const TERMINAL_AUTOWRAP_OFF = "\x1b[?7l";
|
|
108
113
|
const MAIN_CHAT_INPUT_STATUS_KEY = `${WORKFLOW_STATUS_KEY}:main-chat-input`;
|
|
109
114
|
const MAIN_CHAT_INPUT_STATUS = "Main chat needs input — exit graph to answer.";
|
|
110
115
|
|
|
111
|
-
export interface OverlayTerminalOutput {
|
|
112
|
-
platform: NodeJS.Platform;
|
|
113
|
-
isTTY: boolean | undefined;
|
|
114
|
-
write(data: string): void;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function setMouseScrollTracking(enabled: boolean, output: OverlayTerminalOutput): void {
|
|
118
|
-
if (!output.isTTY) return;
|
|
119
|
-
output.write(enabled ? MOUSE_SCROLL_TRACKING_ON : MOUSE_SCROLL_TRACKING_OFF);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function setTerminalAutowrap(enabled: boolean, output: OverlayTerminalOutput): void {
|
|
123
|
-
if (output.platform !== "win32" || !output.isTTY) return;
|
|
124
|
-
output.write(enabled ? TERMINAL_AUTOWRAP_ON : TERMINAL_AUTOWRAP_OFF);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
116
|
export interface BuildGraphOverlayAdapterOpts {
|
|
128
117
|
/**
|
|
129
118
|
* Live stage-control registry threaded through to the attach shell.
|
|
130
119
|
* Defaults to the singleton registry registered alongside the store.
|
|
131
120
|
*/
|
|
132
121
|
stageControlRegistry?: StageControlRegistry;
|
|
133
|
-
/** Broker used to route stage-local custom UI into attached stage chats. */
|
|
134
|
-
stageUiBroker?: StageUiBroker;
|
|
135
122
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
123
|
+
* Resolver that revives a post-mortem chat handle for an eligible terminal
|
|
124
|
+
* agent stage with a valid retained session but no process-local handle.
|
|
125
|
+
* Threaded into every `WorkflowAttachPane` so generic attach/connect and
|
|
126
|
+
* restored/replayed durable snapshots open as interactive follow-up chats;
|
|
127
|
+
* unavailable results provide the pane's actionable read-only reason.
|
|
138
128
|
*/
|
|
139
|
-
|
|
129
|
+
resolvePostMortemHandle?: (runId: string, stageId: string) => PostMortemHandleResolution;
|
|
130
|
+
/** Broker used to route stage-local custom UI into attached stage chats. */
|
|
131
|
+
stageUiBroker?: StageUiBroker;
|
|
140
132
|
/** Optional clock injection for deterministic attach-pane transition tests. */
|
|
141
133
|
now?: () => number;
|
|
142
134
|
/** Terminal output seam used to test raw overlay control sequences. */
|
|
@@ -149,6 +141,7 @@ export function buildGraphOverlayAdapter(
|
|
|
149
141
|
buildOpts: BuildGraphOverlayAdapterOpts = {},
|
|
150
142
|
): GraphOverlayPort {
|
|
151
143
|
const registry = buildOpts.stageControlRegistry ?? defaultStageControlRegistry;
|
|
144
|
+
const resolvePostMortemHandle = buildOpts.resolvePostMortemHandle;
|
|
152
145
|
const stageUiBroker = buildOpts.stageUiBroker;
|
|
153
146
|
const terminalOutput = buildOpts.terminalOutput ?? {
|
|
154
147
|
platform: process.platform,
|
|
@@ -157,12 +150,14 @@ export function buildGraphOverlayAdapter(
|
|
|
157
150
|
process.stdout.write(data);
|
|
158
151
|
},
|
|
159
152
|
};
|
|
153
|
+
// Isolated interactive mode exposes a remote terminal-control capability;
|
|
154
|
+
// prefer it so the real host TTY (not the child's non-TTY JSONL stdout) gets
|
|
155
|
+
// the modes. Otherwise fall back to the local process.stdout seam.
|
|
156
|
+
let remoteTerminalControl: PiRemoteTerminalControl | null = null;
|
|
160
157
|
const updateMouseScrollTracking = (enabled: boolean): void => {
|
|
161
|
-
setMouseScrollTracking(enabled
|
|
158
|
+
if (remoteTerminalControl) remoteTerminalControl.setMouseScrollTracking(enabled);
|
|
159
|
+
else setMouseScrollTracking(enabled, terminalOutput);
|
|
162
160
|
};
|
|
163
|
-
const quitRun = buildOpts.onQuitRun ?? ((id: string): void => {
|
|
164
|
-
defaultQuitRun(id, { store, stageControlRegistry: registry });
|
|
165
|
-
});
|
|
166
161
|
let currentView: WorkflowAttachPane | null = null;
|
|
167
162
|
// pi-tui returns an OverlayHandle via `options.onHandle`. We hold onto
|
|
168
163
|
// it so toggle() can flip `setHidden` rather than remounting the
|
|
@@ -171,6 +166,11 @@ export function buildGraphOverlayAdapter(
|
|
|
171
166
|
let currentHandle: PiOverlayHandle | null = null;
|
|
172
167
|
let mounted = false;
|
|
173
168
|
let finishMounted: (() => void) | null = null;
|
|
169
|
+
// Repaints the mounted overlay through its factory TUI. Needed on the
|
|
170
|
+
// hidden→visible flip: store updates while hidden intentionally skip
|
|
171
|
+
// `requestRender` (#1856), so reopening must explicitly render the
|
|
172
|
+
// invalidated view from the current snapshot.
|
|
173
|
+
let requestMountedRender: (() => void) | null = null;
|
|
174
174
|
let observedUi: OverlayUISurface | undefined;
|
|
175
175
|
let unsubscribeHostCustomUi: (() => void) | null = null;
|
|
176
176
|
let hostInlineCustomUiActive = false;
|
|
@@ -179,6 +179,10 @@ export function buildGraphOverlayAdapter(
|
|
|
179
179
|
function updateTerminalAutowrap(visible: boolean): void {
|
|
180
180
|
if (overlayVisible === visible) return;
|
|
181
181
|
overlayVisible = visible;
|
|
182
|
+
if (remoteTerminalControl) {
|
|
183
|
+
if (terminalOutput.platform === "win32") remoteTerminalControl.setAutowrap(!visible);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
182
186
|
setTerminalAutowrap(!visible, terminalOutput);
|
|
183
187
|
}
|
|
184
188
|
|
|
@@ -231,11 +235,13 @@ export function buildGraphOverlayAdapter(
|
|
|
231
235
|
finishMounted = null;
|
|
232
236
|
currentView = null;
|
|
233
237
|
mounted = false;
|
|
238
|
+
remoteTerminalControl = null;
|
|
239
|
+
requestMountedRender = null;
|
|
234
240
|
clearHostCustomUiObservation();
|
|
235
241
|
}
|
|
236
242
|
|
|
237
243
|
/**
|
|
238
|
-
* Non-destructive
|
|
244
|
+
* Non-destructive return path used by graph-mode `Ctrl+X` / `h`. Goes
|
|
239
245
|
* through Pi/pi public primitives in priority order:
|
|
240
246
|
* 1. `OverlayHandle.setHidden(true)` when the host exposed an
|
|
241
247
|
* overlay handle via `options.onHandle`. Keeps the overlay
|
|
@@ -246,9 +252,8 @@ export function buildGraphOverlayAdapter(
|
|
|
246
252
|
* component, hides the overlay if present, restores focus to
|
|
247
253
|
* the editor, and resolves the custom() promise.
|
|
248
254
|
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
* running and can be re-attached.
|
|
255
|
+
* This is UI-only: the backing workflow keeps running unchanged and the
|
|
256
|
+
* same mounted overlay can be reopened later.
|
|
252
257
|
*/
|
|
253
258
|
function hideMounted(): void {
|
|
254
259
|
updateMouseScrollTracking(false);
|
|
@@ -279,8 +284,15 @@ export function buildGraphOverlayAdapter(
|
|
|
279
284
|
view: WorkflowAttachPane,
|
|
280
285
|
tui: PiCustomOverlayFactoryTui,
|
|
281
286
|
): PiCustomComponent {
|
|
287
|
+
requestMountedRender = () => tui.requestRender?.();
|
|
282
288
|
const onStoreUpdate = (snapshot: StoreSnapshot): void => {
|
|
289
|
+
// Always invalidate retained view state so a later reopen renders the
|
|
290
|
+
// current snapshot — but while the overlay is hidden, never ask the
|
|
291
|
+
// host to render (#1856): each hidden-overlay render request became
|
|
292
|
+
// terminal writes that flickered main chat and could snap native
|
|
293
|
+
// scrollback to the bottom.
|
|
283
294
|
view.invalidate();
|
|
295
|
+
if (currentHandle?.isHidden() === true) return;
|
|
284
296
|
refocusVisibleOverlayForAwaitingInput(snapshot);
|
|
285
297
|
tui.requestRender?.();
|
|
286
298
|
};
|
|
@@ -295,6 +307,8 @@ export function buildGraphOverlayAdapter(
|
|
|
295
307
|
dispose: () => {
|
|
296
308
|
updateTerminalAutowrap(false);
|
|
297
309
|
updateMouseScrollTracking(false);
|
|
310
|
+
remoteTerminalControl = null;
|
|
311
|
+
requestMountedRender = null;
|
|
298
312
|
unsubscribe();
|
|
299
313
|
view.dispose();
|
|
300
314
|
},
|
|
@@ -305,29 +319,31 @@ export function buildGraphOverlayAdapter(
|
|
|
305
319
|
runId: string | null,
|
|
306
320
|
surface?: OverlayPiSurface,
|
|
307
321
|
stageId?: string,
|
|
322
|
+
stageRunId?: string,
|
|
308
323
|
): void {
|
|
309
324
|
const ui = surface?.ui ?? pi.ui;
|
|
310
325
|
observeHostCustomUi(ui);
|
|
311
326
|
|
|
312
327
|
// Already mounted but hidden — flip visibility without remounting.
|
|
313
328
|
if (mounted && currentHandle?.isHidden()) {
|
|
314
|
-
currentView?.retarget(runId, stageId);
|
|
329
|
+
currentView?.retarget(runId, stageId, stageRunId);
|
|
315
330
|
currentView?.setVisible(true);
|
|
316
331
|
updateTerminalAutowrap(true);
|
|
317
332
|
updateMouseScrollTracking(currentView?.wantsMouseScrollTracking() ?? true);
|
|
318
333
|
currentHandle.setHidden(false);
|
|
319
334
|
currentHandle.focus();
|
|
335
|
+
requestMountedRender?.();
|
|
320
336
|
return;
|
|
321
337
|
}
|
|
322
338
|
if (mounted) {
|
|
323
|
-
currentView?.retarget(runId, stageId);
|
|
339
|
+
currentView?.retarget(runId, stageId, stageRunId);
|
|
324
340
|
updateTerminalAutowrap(true);
|
|
325
341
|
updateMouseScrollTracking(currentView?.wantsMouseScrollTracking() ?? true);
|
|
326
342
|
// Restore keyboard focus to the visible overlay after retargeting.
|
|
327
343
|
// pi-tui dispatches key events only to the focused component, so a
|
|
328
344
|
// mounted-but-visible overlay that is retargeted (e.g. to a stage-scoped
|
|
329
345
|
// HIL prompt / readiness gate) would otherwise appear frozen — arrows,
|
|
330
|
-
// Enter
|
|
346
|
+
// Enter and Ctrl+X all dead — if focus stayed on an underlying or
|
|
331
347
|
// previously-focused pane (issue #1120).
|
|
332
348
|
currentHandle?.focus();
|
|
333
349
|
return;
|
|
@@ -344,6 +360,9 @@ export function buildGraphOverlayAdapter(
|
|
|
344
360
|
keybindings: PiKeybindings,
|
|
345
361
|
done: (result: undefined) => void,
|
|
346
362
|
): PiCustomComponent => {
|
|
363
|
+
// Prefer the host's remote terminal-control capability (isolated mode);
|
|
364
|
+
// stays null for non-isolated hosts, keeping the local process.stdout seam.
|
|
365
|
+
remoteTerminalControl = remoteTerminalControlFrom(tui);
|
|
347
366
|
const finish = (): void => {
|
|
348
367
|
if (settled) return;
|
|
349
368
|
settled = true;
|
|
@@ -355,11 +374,13 @@ export function buildGraphOverlayAdapter(
|
|
|
355
374
|
currentHandle = null;
|
|
356
375
|
finishMounted = null;
|
|
357
376
|
mounted = false;
|
|
377
|
+
requestMountedRender = null;
|
|
358
378
|
clearHostCustomUiObservation();
|
|
359
379
|
try {
|
|
360
380
|
done(undefined);
|
|
361
381
|
} finally {
|
|
362
382
|
updateTerminalAutowrap(false);
|
|
383
|
+
remoteTerminalControl = null;
|
|
363
384
|
}
|
|
364
385
|
};
|
|
365
386
|
const view = new WorkflowAttachPane({
|
|
@@ -367,12 +388,13 @@ export function buildGraphOverlayAdapter(
|
|
|
367
388
|
graphTheme: deriveGraphThemeFromPiTheme(theme),
|
|
368
389
|
runId,
|
|
369
390
|
stageControlRegistry: registry,
|
|
391
|
+
resolvePostMortemHandle,
|
|
370
392
|
stageUiBroker,
|
|
371
393
|
uiStatus,
|
|
372
394
|
onClose: finish,
|
|
373
395
|
onHide: hideMounted,
|
|
374
|
-
onQuit: quitRun,
|
|
375
396
|
initialAttachStageId: stageId,
|
|
397
|
+
initialAttachRunId: stageRunId,
|
|
376
398
|
piTui: tui,
|
|
377
399
|
piTheme: theme,
|
|
378
400
|
piKeybindings: keybindings,
|
|
@@ -452,7 +474,10 @@ export function buildGraphOverlayAdapter(
|
|
|
452
474
|
);
|
|
453
475
|
currentHandle.setHidden(nowHidden);
|
|
454
476
|
if (nowHidden) updateTerminalAutowrap(false);
|
|
455
|
-
else
|
|
477
|
+
else {
|
|
478
|
+
currentHandle.focus();
|
|
479
|
+
requestMountedRender?.();
|
|
480
|
+
}
|
|
456
481
|
return;
|
|
457
482
|
}
|
|
458
483
|
if (mounted) {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Terminal-mode seams for the workflow graph overlay: raw mouse-scroll
|
|
3
|
+
* reporting and autowrap (DECAWM) escape sequences for the local TTY, plus
|
|
4
|
+
* extraction of the isolated host's remote terminal-control capability.
|
|
5
|
+
*
|
|
6
|
+
* cross-ref: src/tui/overlay-adapter.ts (sole consumer)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
PiCustomOverlayFactoryTui,
|
|
11
|
+
PiRemoteTerminalControl,
|
|
12
|
+
} from "../extension/wiring.js";
|
|
13
|
+
|
|
14
|
+
const MOUSE_SCROLL_TRACKING_ON = "\x1b[?1000h\x1b[?1002h\x1b[?1006h";
|
|
15
|
+
const MOUSE_SCROLL_TRACKING_OFF = "\x1b[?1006l\x1b[?1002l\x1b[?1000l";
|
|
16
|
+
const TERMINAL_AUTOWRAP_ON = "\x1b[?7h";
|
|
17
|
+
const TERMINAL_AUTOWRAP_OFF = "\x1b[?7l";
|
|
18
|
+
|
|
19
|
+
export interface OverlayTerminalOutput {
|
|
20
|
+
platform: NodeJS.Platform;
|
|
21
|
+
isTTY: boolean | undefined;
|
|
22
|
+
write(data: string): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function setMouseScrollTracking(enabled: boolean, output: OverlayTerminalOutput): void {
|
|
26
|
+
if (!output.isTTY) return;
|
|
27
|
+
output.write(enabled ? MOUSE_SCROLL_TRACKING_ON : MOUSE_SCROLL_TRACKING_OFF);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function setTerminalAutowrap(enabled: boolean, output: OverlayTerminalOutput): void {
|
|
31
|
+
if (output.platform !== "win32" || !output.isTTY) return;
|
|
32
|
+
output.write(enabled ? TERMINAL_AUTOWRAP_ON : TERMINAL_AUTOWRAP_OFF);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Extract the host's remote terminal-control capability from the factory TUI —
|
|
37
|
+
* present in isolated interactive mode (drives the real host TTY over the
|
|
38
|
+
* allowlisted engine protocol); `null` for non-isolated hosts and test seams.
|
|
39
|
+
*/
|
|
40
|
+
export function remoteTerminalControlFrom(tui: PiCustomOverlayFactoryTui): PiRemoteTerminalControl | null {
|
|
41
|
+
const terminal = tui.terminal;
|
|
42
|
+
if (terminal === undefined || typeof terminal.setMouseScrollTracking !== "function" || typeof terminal.setAutowrap !== "function") {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
setMouseScrollTracking: terminal.setMouseScrollTracking.bind(terminal),
|
|
47
|
+
setAutowrap: terminal.setAutowrap.bind(terminal),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mount
|
|
2
|
+
* Mount adapter for the workflow session picker.
|
|
3
3
|
*
|
|
4
|
-
* Both overlays use Pi / pi's real `ctx.ui.custom(factory, options)`
|
|
5
|
-
* primitive. There is no legacy object-shaped fallback — when the host
|
|
6
|
-
* doesn't expose `pi.ui.custom` the picker resolves with `close` and the
|
|
7
|
-
* kill-confirm falls back to `pi.ui.confirm` (or `false` when even that
|
|
8
|
-
* is absent, since the action is destructive).
|
|
9
4
|
*
|
|
10
5
|
* Mount mode
|
|
11
6
|
* ----------
|
|
@@ -20,9 +15,6 @@
|
|
|
20
15
|
* chrome wedged between command and picker (those rows are owned by
|
|
21
16
|
* the editor area we just replaced).
|
|
22
17
|
*
|
|
23
|
-
* The kill-confirm intentionally stays on `{ overlay: true }` — it is a
|
|
24
|
-
* destructive modal and reads better as a centered popup over the
|
|
25
|
-
* editor, not as an inline replacement.
|
|
26
18
|
*
|
|
27
19
|
* cross-ref:
|
|
28
20
|
* - src/tui/session-picker.ts (state machine + render)
|
|
@@ -35,7 +27,6 @@ import type {
|
|
|
35
27
|
PiCustomComponent,
|
|
36
28
|
PiCustomOverlayFactoryTui,
|
|
37
29
|
PiCustomOverlayFunction,
|
|
38
|
-
PiOverlayOptions,
|
|
39
30
|
} from "../extension/wiring.js";
|
|
40
31
|
import type { Store } from "../shared/store.js";
|
|
41
32
|
import type { GraphTheme } from "./graph-theme.js";
|
|
@@ -45,34 +36,16 @@ import {
|
|
|
45
36
|
renderSessionPicker,
|
|
46
37
|
selectRunsForPicker,
|
|
47
38
|
} from "./session-picker.js";
|
|
48
|
-
import {
|
|
49
|
-
createKillConfirmState,
|
|
50
|
-
handleKillConfirmInput,
|
|
51
|
-
renderKillConfirm,
|
|
52
|
-
} from "./session-confirm.js";
|
|
53
|
-
import type { RunSnapshot } from "../shared/store-types.js";
|
|
54
39
|
|
|
55
|
-
/**
|
|
56
|
-
* Aspirational confirm-modal geometry. Current pi interactive
|
|
57
|
-
* `custom()` does not forward `overlayOptions` to pi-tui's overlay
|
|
58
|
-
* layout (it always uses `{ anchor: "bottom-center", width: "100%",
|
|
59
|
-
* maxHeight: "100%", margin: 0 }`); the value is retained for future
|
|
60
|
-
* hosts that honour the option bag and for the test seam.
|
|
61
|
-
*/
|
|
62
|
-
const CONFIRM_OVERLAY: PiOverlayOptions = {
|
|
63
|
-
anchor: "center",
|
|
64
|
-
width: "60%",
|
|
65
|
-
};
|
|
66
40
|
|
|
67
41
|
export interface UiSurface {
|
|
68
42
|
custom?: PiCustomOverlayFunction;
|
|
69
43
|
}
|
|
70
44
|
|
|
71
|
-
export type SessionPickerIntent = "connect" | "
|
|
45
|
+
export type SessionPickerIntent = "connect" | "pause" | "resume";
|
|
72
46
|
|
|
73
47
|
export type SessionPickerResult =
|
|
74
48
|
| { kind: "connect"; runId: string }
|
|
75
|
-
| { kind: "kill"; runId: string }
|
|
76
49
|
| { kind: "pause"; runId: string }
|
|
77
50
|
| { kind: "resume"; runId: string }
|
|
78
51
|
| { kind: "close" };
|
|
@@ -82,9 +55,6 @@ export type SessionPickerResult =
|
|
|
82
55
|
*
|
|
83
56
|
* `intent` (default `"connect"`) determines what Enter does on a row:
|
|
84
57
|
* - `connect`: resolve with `{ kind: "connect", runId }`.
|
|
85
|
-
* - `kill`: resolve with `{ kind: "kill", runId }` (caller still
|
|
86
|
-
* owns the destructive confirm — `x` on a row preserves the
|
|
87
|
-
* legacy fast-kill path).
|
|
88
58
|
* - `pause`: resolve with `{ kind: "pause", runId }`.
|
|
89
59
|
* - `resume`: resolve with `{ kind: "resume", runId }`.
|
|
90
60
|
*/
|
|
@@ -94,13 +64,11 @@ export function openSessionPicker(
|
|
|
94
64
|
theme: GraphTheme,
|
|
95
65
|
intent: SessionPickerIntent = "connect",
|
|
96
66
|
): Promise<SessionPickerResult> {
|
|
97
|
-
function toResult(action: { kind: "connect"
|
|
98
|
-
if (action.kind === "kill") return { kind: "kill", runId: action.runId };
|
|
67
|
+
function toResult(action: { kind: "connect"; runId: string }): SessionPickerResult {
|
|
99
68
|
// Enter action arrives as `connect` from the picker; remap based on
|
|
100
69
|
// caller intent so a pause/resume picker doesn't open the graph.
|
|
101
70
|
if (intent === "pause") return { kind: "pause", runId: action.runId };
|
|
102
71
|
if (intent === "resume") return { kind: "resume", runId: action.runId };
|
|
103
|
-
if (intent === "kill") return { kind: "kill", runId: action.runId };
|
|
104
72
|
return { kind: "connect", runId: action.runId };
|
|
105
73
|
}
|
|
106
74
|
return new Promise<SessionPickerResult>((resolve) => {
|
|
@@ -168,72 +136,3 @@ export function openSessionPicker(
|
|
|
168
136
|
void custom(factory, { overlay: false });
|
|
169
137
|
});
|
|
170
138
|
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Mount the kill-confirmation overlay. Resolves with `true` when the user
|
|
174
|
-
* confirms, `false` otherwise. When `pi.ui.custom` is unavailable, falls
|
|
175
|
-
* back to `pi.ui.confirm` if present, else returns `false` (safe default
|
|
176
|
-
* for a destructive action).
|
|
177
|
-
*/
|
|
178
|
-
export interface ConfirmUiSurface extends UiSurface {
|
|
179
|
-
confirm?: (title: string, message: string) => Promise<boolean>;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export function openKillConfirm(
|
|
183
|
-
ui: ConfirmUiSurface,
|
|
184
|
-
run: RunSnapshot,
|
|
185
|
-
theme: GraphTheme,
|
|
186
|
-
): Promise<boolean> {
|
|
187
|
-
return new Promise<boolean>((resolve) => {
|
|
188
|
-
const custom = ui.custom;
|
|
189
|
-
if (typeof custom !== "function") {
|
|
190
|
-
// Fall back to plain confirm dialog when available.
|
|
191
|
-
if (typeof ui.confirm === "function") {
|
|
192
|
-
ui.confirm(
|
|
193
|
-
"Kill workflow run?",
|
|
194
|
-
`Abort ${run.name} (${run.id.slice(0, 8)})? Active stage work will be discarded.`,
|
|
195
|
-
).then(resolve, () => resolve(false));
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
resolve(false);
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const state = createKillConfirmState();
|
|
203
|
-
let settled = false;
|
|
204
|
-
|
|
205
|
-
const factory = (
|
|
206
|
-
tui: PiCustomOverlayFactoryTui,
|
|
207
|
-
_theme: unknown,
|
|
208
|
-
_keys: unknown,
|
|
209
|
-
done: (r: undefined) => void,
|
|
210
|
-
): PiCustomComponent => {
|
|
211
|
-
const finish = (result: boolean): void => {
|
|
212
|
-
if (settled) return;
|
|
213
|
-
settled = true;
|
|
214
|
-
done(undefined);
|
|
215
|
-
resolve(result);
|
|
216
|
-
};
|
|
217
|
-
return {
|
|
218
|
-
render: (width: number) => renderKillConfirm({ width, theme, run, state }),
|
|
219
|
-
handleInput: (data: string) => {
|
|
220
|
-
const action = handleKillConfirmInput(data, state);
|
|
221
|
-
if (action.kind === "noop") {
|
|
222
|
-
tui.requestRender?.();
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
finish(action.kind === "confirm");
|
|
226
|
-
},
|
|
227
|
-
invalidate: () => tui.requestRender?.(),
|
|
228
|
-
dispose: () => {
|
|
229
|
-
if (!settled) {
|
|
230
|
-
settled = true;
|
|
231
|
-
resolve(false);
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
void custom(factory, { overlay: true, overlayOptions: CONFIRM_OVERLAY });
|
|
238
|
-
});
|
|
239
|
-
}
|