@adhdev/daemon-core 0.9.82-rc.48 → 0.9.82-rc.481
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/dist/boot/daemon-lifecycle.d.ts +9 -0
- package/dist/boot/process-hardening.d.ts +50 -0
- package/dist/build-info.d.ts +37 -0
- package/dist/chat/source-machine.d.ts +166 -0
- package/dist/chat/source-resolver.d.ts +104 -0
- package/dist/chat/subscription-updates.d.ts +1 -0
- package/dist/cli-adapter-types.d.ts +68 -2
- package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +220 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +126 -64
- package/dist/cli-adapters/provider-cli-parse.d.ts +5 -0
- package/dist/cli-adapters/provider-cli-runtime.d.ts +34 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +74 -0
- package/dist/cli-adapters/pty-write-chunking.d.ts +34 -0
- package/dist/cli-adapters/raw-terminal-io.d.ts +37 -0
- package/dist/cli-adapters/resolve-executable.d.ts +69 -0
- package/dist/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +6 -3
- package/dist/cli-adapters/terminal-backends/types.d.ts +10 -2
- package/dist/cli-adapters/terminal-screen.d.ts +4 -11
- package/dist/commands/chat-commands-debug-bundle.d.ts +14 -0
- package/dist/commands/chat-commands-read.d.ts +23 -0
- package/dist/commands/chat-commands-scope.d.ts +39 -0
- package/dist/commands/chat-commands-shared.d.ts +33 -0
- package/dist/commands/chat-commands-write.d.ts +14 -0
- package/dist/commands/chat-commands.d.ts +10 -23
- package/dist/commands/cli-manager.d.ts +51 -1
- package/dist/commands/handler.d.ts +125 -0
- package/dist/commands/high-family/index.d.ts +3 -0
- package/dist/commands/high-family/mesh-coordinator-launch.d.ts +2 -0
- package/dist/commands/high-family/mesh-events.d.ts +2 -0
- package/dist/commands/high-family/mesh-status.d.ts +2 -0
- package/dist/commands/high-family/types.d.ts +64 -0
- package/dist/commands/low-family/coordinator-prompt.d.ts +9 -0
- package/dist/commands/low-family/daemon-lifecycle.d.ts +2 -0
- package/dist/commands/low-family/diagnostics.d.ts +2 -0
- package/dist/commands/low-family/index.d.ts +3 -0
- package/dist/commands/low-family/mesh-ledger.d.ts +10 -0
- package/dist/commands/low-family/mesh-node-logs.d.ts +2 -0
- package/dist/commands/low-family/notification.d.ts +2 -0
- package/dist/commands/low-family/refine-config.d.ts +2 -0
- package/dist/commands/low-family/session-host.d.ts +2 -0
- package/dist/commands/low-family/spec-providerdev.d.ts +11 -0
- package/dist/commands/low-family/status-meta.d.ts +2 -0
- package/dist/commands/low-family/types.d.ts +33 -0
- package/dist/commands/med-family/cli-agent.d.ts +2 -0
- package/dist/commands/med-family/fast-forward.d.ts +2 -0
- package/dist/commands/med-family/ide.d.ts +10 -0
- package/dist/commands/med-family/index.d.ts +3 -0
- package/dist/commands/med-family/mesh-crud.d.ts +48 -0
- package/dist/commands/med-family/mesh-host-pairing.d.ts +2 -0
- package/dist/commands/med-family/mesh-queue.d.ts +2 -0
- package/dist/commands/med-family/mesh-restart.d.ts +2 -0
- package/dist/commands/med-family/types.d.ts +152 -0
- package/dist/commands/mesh-coordinator.d.ts +85 -1
- package/dist/commands/router-aggregate-status.d.ts +24 -0
- package/dist/commands/router-mesh-session-owner.d.ts +59 -0
- package/dist/commands/router-refine.d.ts +137 -0
- package/dist/commands/router-worktree-cleanup.d.ts +133 -0
- package/dist/commands/router.d.ts +204 -15
- package/dist/commands/upgrade-helper.d.ts +41 -1
- package/dist/config/chat-history.d.ts +11 -0
- package/dist/config/config.d.ts +19 -0
- package/dist/config/mesh-config.d.ts +136 -1
- package/dist/config/mesh-json-config.d.ts +199 -0
- package/dist/config/registry-resolver.d.ts +54 -0
- package/dist/config/repo-settings.d.ts +77 -0
- package/dist/config/state-store.d.ts +30 -0
- package/dist/daemon/dev-server.d.ts +0 -2
- package/dist/detection/cli-detector.d.ts +17 -0
- package/dist/detection/ide-detector.d.ts +13 -0
- package/dist/detection/win32-ide-version.d.ts +37 -0
- package/dist/git/change-impact-config.d.ts +159 -0
- package/dist/git/git-commands.d.ts +26 -2
- package/dist/git/git-diff.d.ts +6 -0
- package/dist/git/git-executor.d.ts +11 -0
- package/dist/git/git-status.d.ts +57 -0
- package/dist/git/git-types.d.ts +2 -50
- package/dist/git/git-worktree.d.ts +71 -1
- package/dist/git/index.d.ts +3 -1
- package/dist/index.d.ts +73 -17
- package/dist/index.js +52979 -18657
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59496 -25355
- package/dist/index.mjs.map +1 -1
- package/dist/installer.d.ts +1 -4
- package/dist/ipc/local-ipc-server.d.ts +91 -0
- package/dist/launch.d.ts +1 -1
- package/dist/logging/async-batch-writer.d.ts +10 -0
- package/dist/logging/debug-config.d.ts +16 -0
- package/dist/logging/log-redactor.d.ts +24 -0
- package/dist/logging/log-tail-reader.d.ts +81 -0
- package/dist/logging/logger.d.ts +1 -1
- package/dist/mesh/contracts.d.ts +230 -0
- package/dist/mesh/coordinator-prompt.d.ts +76 -0
- package/dist/mesh/coordinator-registry.d.ts +59 -0
- package/dist/mesh/mesh-active-work.d.ts +203 -0
- package/dist/mesh/mesh-clone-grace.d.ts +8 -0
- package/dist/mesh/mesh-completion-synthesis.d.ts +4 -0
- package/dist/mesh/mesh-coordinator-config.d.ts +21 -0
- package/dist/mesh/mesh-delivery-policy.d.ts +104 -0
- package/dist/mesh/mesh-event-classify.d.ts +7 -0
- package/dist/mesh/mesh-event-forwarding.d.ts +49 -0
- package/dist/mesh/mesh-event-trace.d.ts +21 -0
- package/dist/mesh/mesh-events-coordinator.d.ts +4 -0
- package/dist/mesh/mesh-events-pending.d.ts +246 -0
- package/dist/mesh/mesh-events-stale.d.ts +61 -0
- package/dist/mesh/mesh-events-utils.d.ts +75 -0
- package/dist/mesh/mesh-events.d.ts +6 -49
- package/dist/mesh/mesh-fast-forward.d.ts +81 -0
- package/dist/mesh/mesh-host-ownership.d.ts +29 -0
- package/dist/mesh/mesh-init.d.ts +128 -0
- package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -4
- package/dist/mesh/mesh-ledger.d.ts +139 -1
- package/dist/mesh/mesh-magi-status.d.ts +63 -0
- package/dist/mesh/mesh-missions.d.ts +281 -0
- package/dist/mesh/mesh-node-identity.d.ts +310 -0
- package/dist/mesh/mesh-queue-assignment.d.ts +158 -0
- package/dist/mesh/mesh-reconcile-acked-hold.d.ts +17 -0
- package/dist/mesh/mesh-reconcile-config.d.ts +6 -0
- package/dist/mesh/mesh-reconcile-identity.d.ts +6 -0
- package/dist/mesh/mesh-reconcile-loop.d.ts +80 -0
- package/dist/mesh/mesh-reconcile-v2-backstop.d.ts +16 -0
- package/dist/mesh/mesh-refine-batch.d.ts +68 -0
- package/dist/mesh/mesh-refine-gates.d.ts +428 -0
- package/dist/mesh/mesh-refine-status.d.ts +62 -0
- package/dist/mesh/mesh-remote-event-pull.d.ts +15 -0
- package/dist/mesh/mesh-review-inbox.d.ts +90 -0
- package/dist/mesh/mesh-routing.d.ts +70 -0
- package/dist/mesh/mesh-runtime-store.d.ts +508 -0
- package/dist/mesh/mesh-scheduling-runtime.d.ts +78 -0
- package/dist/mesh/mesh-task-inflight.d.ts +46 -0
- package/dist/mesh/mesh-task-stats.d.ts +49 -0
- package/dist/mesh/mesh-unresolved-forward-outbox.d.ts +30 -0
- package/dist/mesh/mesh-warmup-deadline.d.ts +68 -0
- package/dist/mesh/mesh-work-queue.d.ts +363 -5
- package/dist/mesh/preview-freshness.d.ts +28 -0
- package/dist/mesh/refine-config.d.ts +216 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +219 -0
- package/dist/providers/acp-provider-instance.d.ts +5 -0
- package/dist/providers/approval-utils.d.ts +46 -0
- package/dist/providers/chat-message-normalization.d.ts +58 -1
- package/dist/providers/cli-provider-effect-format.d.ts +30 -0
- package/dist/providers/cli-provider-history-dedup.d.ts +17 -0
- package/dist/providers/cli-provider-input-prompt.d.ts +12 -0
- package/dist/providers/cli-provider-instance-types.d.ts +45 -0
- package/dist/providers/cli-provider-instance.d.ts +406 -30
- package/dist/providers/cli-provider-status-helpers.d.ts +46 -0
- package/dist/providers/cli-provider-transcript-merge.d.ts +7 -0
- package/dist/providers/contracts.d.ts +149 -6
- package/dist/providers/external-sources.d.ts +71 -0
- package/dist/providers/manual-attendance.d.ts +79 -0
- package/dist/providers/native-history/antigravity-claim-registry.d.ts +39 -0
- package/dist/providers/native-history/antigravity-cli-transcript.d.ts +137 -0
- package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
- package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
- package/dist/providers/native-history/constants.d.ts +12 -0
- package/dist/providers/native-history/dispatcher.d.ts +44 -0
- package/dist/providers/native-history/hermes-cli-transcript.d.ts +30 -0
- package/dist/providers/native-history/index.d.ts +13 -0
- package/dist/providers/provider-instance-manager.d.ts +29 -0
- package/dist/providers/provider-instance.d.ts +30 -1
- package/dist/providers/provider-loader.d.ts +42 -5
- package/dist/providers/provider-trust.d.ts +31 -0
- package/dist/providers/read-chat-contract.d.ts +29 -0
- package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
- package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +86 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +65 -0
- package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
- package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
- package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
- package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
- package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
- package/dist/providers/sdk/v1/index.d.ts +30 -0
- package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
- package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
- package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
- package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
- package/dist/providers/sdk/v1/types/common/index.d.ts +203 -0
- package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
- package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
- package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
- package/dist/providers/spec/adapter.d.ts +98 -0
- package/dist/providers/spec/cli-adapter.d.ts +223 -0
- package/dist/providers/spec/evaluator.d.ts +45 -0
- package/dist/providers/spec/fsm-driver.d.ts +449 -0
- package/dist/providers/spec/fsm-evaluator.d.ts +93 -0
- package/dist/providers/spec/fsm-loader.d.ts +14 -0
- package/dist/providers/spec/fsm-types.d.ts +202 -0
- package/dist/providers/spec/native-history-executor.d.ts +41 -0
- package/dist/providers/spec/pre-launch-trust.d.ts +16 -0
- package/dist/providers/spec/route.d.ts +4 -0
- package/dist/providers/spec/types.d.ts +244 -0
- package/dist/providers/status-monitor.d.ts +7 -7
- package/dist/providers/transcript-v2.d.ts +176 -0
- package/dist/providers/types/interactive-prompt.d.ts +84 -0
- package/dist/providers/working-dir.d.ts +17 -0
- package/dist/repo-mesh-types.d.ts +629 -12
- package/dist/runtime-defaults.d.ts +2 -0
- package/dist/session-host/managed-host.d.ts +64 -0
- package/dist/session-host/runtime-surface.d.ts +10 -16
- package/dist/sessions/registry.d.ts +26 -0
- package/dist/shared-types-extra.d.ts +2 -4
- package/dist/shared-types.d.ts +98 -55
- package/dist/status/chat-tail-hot-sessions.d.ts +40 -0
- package/dist/status/normalize.d.ts +1 -1
- package/dist/status/normalize.js +1 -0
- package/dist/status/normalize.js.map +1 -1
- package/dist/status/normalize.mjs +1 -0
- package/dist/status/normalize.mjs.map +1 -1
- package/dist/status/reporter.d.ts +2 -0
- package/dist/status/snapshot.d.ts +26 -0
- package/dist/system/hash.d.ts +8 -0
- package/dist/system/load-better-sqlite3.d.ts +21 -0
- package/dist/types.d.ts +5 -0
- package/package.json +11 -4
- package/src/agent-stream/poller.ts +2 -3
- package/src/agent-stream/provider-adapter.ts +1 -1
- package/src/boot/daemon-lifecycle.ts +80 -14
- package/src/boot/process-hardening.ts +89 -0
- package/src/build-info.ts +73 -0
- package/src/chat/source-machine.ts +534 -0
- package/src/chat/source-resolver.ts +0 -0
- package/src/chat/subscription-updates.ts +20 -1
- package/src/cli-adapter-types.d.ts +3 -1
- package/src/cli-adapter-types.ts +68 -2
- package/src/cli-adapters/cli-script-runner.ts +421 -0
- package/src/cli-adapters/cli-state-engine.ts +1282 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +954 -1144
- package/src/cli-adapters/provider-cli-parse.d.ts +2 -0
- package/src/cli-adapters/provider-cli-parse.ts +19 -0
- package/src/cli-adapters/provider-cli-runtime.ts +56 -7
- package/src/cli-adapters/provider-cli-shared.d.ts +4 -0
- package/src/cli-adapters/provider-cli-shared.ts +121 -11
- package/src/cli-adapters/pty-transport.ts +2 -1
- package/src/cli-adapters/pty-write-chunking.ts +106 -0
- package/src/cli-adapters/raw-terminal-io.ts +252 -0
- package/src/cli-adapters/resolve-executable.ts +204 -0
- package/src/cli-adapters/session-host-transport.ts +2 -1
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +63 -29
- package/src/cli-adapters/terminal-backends/types.ts +10 -3
- package/src/cli-adapters/terminal-screen.ts +16 -81
- package/src/commands/chat-commands-debug-bundle.ts +398 -0
- package/src/commands/chat-commands-read.ts +2767 -0
- package/src/commands/chat-commands-scope.ts +54 -0
- package/src/commands/chat-commands-shared.ts +114 -0
- package/src/commands/chat-commands-write.ts +891 -0
- package/src/commands/chat-commands.ts +19 -1841
- package/src/commands/cli-manager.d.ts +2 -0
- package/src/commands/cli-manager.ts +659 -27
- package/src/commands/handler.ts +845 -2
- package/src/commands/high-family/index.ts +28 -0
- package/src/commands/high-family/mesh-coordinator-launch.ts +680 -0
- package/src/commands/high-family/mesh-events.ts +102 -0
- package/src/commands/high-family/mesh-status.ts +849 -0
- package/src/commands/high-family/types.ts +80 -0
- package/src/commands/low-family/coordinator-prompt.ts +72 -0
- package/src/commands/low-family/daemon-lifecycle.ts +120 -0
- package/src/commands/low-family/diagnostics.ts +57 -0
- package/src/commands/low-family/index.ts +37 -0
- package/src/commands/low-family/mesh-ledger.ts +62 -0
- package/src/commands/low-family/mesh-node-logs.ts +87 -0
- package/src/commands/low-family/notification.ts +116 -0
- package/src/commands/low-family/refine-config.ts +106 -0
- package/src/commands/low-family/session-host.ts +282 -0
- package/src/commands/low-family/spec-providerdev.ts +217 -0
- package/src/commands/low-family/status-meta.ts +112 -0
- package/src/commands/low-family/types.ts +39 -0
- package/src/commands/med-family/cli-agent.ts +241 -0
- package/src/commands/med-family/fast-forward.ts +230 -0
- package/src/commands/med-family/ide.ts +163 -0
- package/src/commands/med-family/index.ts +37 -0
- package/src/commands/med-family/mesh-crud.ts +1287 -0
- package/src/commands/med-family/mesh-host-pairing.ts +234 -0
- package/src/commands/med-family/mesh-queue.ts +167 -0
- package/src/commands/med-family/mesh-restart.ts +92 -0
- package/src/commands/med-family/types.ts +153 -0
- package/src/commands/mesh-coordinator.ts +334 -124
- package/src/commands/router-aggregate-status.ts +209 -0
- package/src/commands/router-mesh-session-owner.ts +114 -0
- package/src/commands/router-refine.ts +1711 -0
- package/src/commands/router-worktree-cleanup.ts +870 -0
- package/src/commands/router.ts +795 -4143
- package/src/commands/stream-commands.ts +8 -0
- package/src/commands/upgrade-helper.ts +310 -45
- package/src/config/chat-history.ts +517 -24
- package/src/config/config.ts +30 -0
- package/src/config/mesh-config.ts +632 -23
- package/src/config/mesh-json-config.ts +376 -0
- package/src/config/recent-activity.ts +8 -2
- package/src/config/registry-resolver.ts +100 -0
- package/src/config/repo-settings.ts +111 -0
- package/src/config/state-store.ts +55 -0
- package/src/daemon/dev-auto-implement.ts +3 -2
- package/src/daemon/dev-cli-debug.ts +10 -1
- package/src/daemon/dev-server.ts +0 -541
- package/src/detection/cli-detector.ts +94 -9
- package/src/detection/ide-detector.ts +55 -16
- package/src/detection/win32-ide-version.ts +106 -0
- package/src/git/change-impact-config.ts +354 -0
- package/src/git/git-commands.ts +112 -16
- package/src/git/git-diff.ts +81 -11
- package/src/git/git-executor.ts +12 -0
- package/src/git/git-status.ts +767 -48
- package/src/git/git-types.ts +14 -62
- package/src/git/git-worktree.ts +261 -4
- package/src/git/index.ts +17 -0
- package/src/index.ts +213 -13
- package/src/installer.d.ts +1 -1
- package/src/installer.ts +8 -6
- package/src/ipc/local-ipc-server.ts +278 -0
- package/src/launch.d.ts +1 -1
- package/src/launch.ts +37 -28
- package/src/logging/async-batch-writer.ts +55 -0
- package/src/logging/command-log.ts +7 -5
- package/src/logging/debug-config.ts +25 -0
- package/src/logging/debug-trace.ts +7 -2
- package/src/logging/log-redactor.ts +100 -0
- package/src/logging/log-tail-reader.ts +341 -0
- package/src/logging/logger.ts +14 -7
- package/src/mesh/contracts.ts +469 -0
- package/src/mesh/coordinator-prompt.ts +572 -34
- package/src/mesh/coordinator-registry.ts +121 -0
- package/src/mesh/mesh-active-work.ts +706 -0
- package/src/mesh/mesh-clone-grace.ts +68 -0
- package/src/mesh/mesh-completion-synthesis.ts +416 -0
- package/src/mesh/mesh-coordinator-config.ts +97 -0
- package/src/mesh/mesh-delivery-policy.ts +284 -0
- package/src/mesh/mesh-event-classify.ts +78 -0
- package/src/mesh/mesh-event-forwarding.ts +2002 -0
- package/src/mesh/mesh-event-trace.ts +67 -0
- package/src/mesh/mesh-events-coordinator.ts +32 -0
- package/src/mesh/mesh-events-pending.ts +1494 -0
- package/src/mesh/mesh-events-stale.ts +452 -0
- package/src/mesh/mesh-events-utils.ts +443 -0
- package/src/mesh/mesh-events.ts +43 -1035
- package/src/mesh/mesh-fast-forward.ts +856 -0
- package/src/mesh/mesh-host-ownership.ts +111 -0
- package/src/mesh/mesh-init.ts +350 -0
- package/src/mesh/mesh-ledger-reconciliation.ts +12 -7
- package/src/mesh/mesh-ledger.ts +898 -102
- package/src/mesh/mesh-magi-status.ts +223 -0
- package/src/mesh/mesh-missions.ts +695 -0
- package/src/mesh/mesh-node-identity.ts +2065 -0
- package/src/mesh/mesh-queue-assignment.ts +2263 -0
- package/src/mesh/mesh-reconcile-acked-hold.ts +230 -0
- package/src/mesh/mesh-reconcile-config.ts +66 -0
- package/src/mesh/mesh-reconcile-identity.ts +103 -0
- package/src/mesh/mesh-reconcile-loop.ts +1473 -0
- package/src/mesh/mesh-reconcile-v2-backstop.ts +62 -0
- package/src/mesh/mesh-refine-batch.ts +205 -0
- package/src/mesh/mesh-refine-gates.ts +1686 -0
- package/src/mesh/mesh-refine-status.ts +231 -0
- package/src/mesh/mesh-remote-event-pull.ts +279 -0
- package/src/mesh/mesh-review-inbox.ts +308 -0
- package/src/mesh/mesh-routing.ts +291 -0
- package/src/mesh/mesh-runtime-store.ts +2150 -0
- package/src/mesh/mesh-scheduling-runtime.ts +198 -0
- package/src/mesh/mesh-task-inflight.ts +70 -0
- package/src/mesh/mesh-task-stats.ts +161 -0
- package/src/mesh/mesh-unresolved-forward-outbox.ts +185 -0
- package/src/mesh/mesh-warmup-deadline.ts +152 -0
- package/src/mesh/mesh-work-queue.ts +1437 -147
- package/src/mesh/preview-freshness.ts +163 -0
- package/src/mesh/refine-config.ts +423 -0
- package/src/mesh/worktree-bootstrap-config.ts +599 -0
- package/src/providers/acp-provider-instance.ts +43 -10
- package/src/providers/approval-utils.d.ts +5 -0
- package/src/providers/approval-utils.ts +100 -6
- package/src/providers/chat-message-normalization.ts +126 -4
- package/src/providers/cli-provider-effect-format.ts +53 -0
- package/src/providers/cli-provider-history-dedup.ts +75 -0
- package/src/providers/cli-provider-input-prompt.ts +133 -0
- package/src/providers/cli-provider-instance-types.ts +131 -0
- package/src/providers/cli-provider-instance.ts +2709 -499
- package/src/providers/cli-provider-status-helpers.ts +123 -0
- package/src/providers/cli-provider-transcript-merge.ts +114 -0
- package/src/providers/contracts.d.ts +55 -0
- package/src/providers/contracts.ts +160 -6
- package/src/providers/extension-provider-instance.ts +12 -7
- package/src/providers/external-sources.ts +218 -0
- package/src/providers/ide-provider-instance.ts +35 -12
- package/src/providers/manual-attendance.ts +105 -0
- package/src/providers/native-history/antigravity-claim-registry.ts +138 -0
- package/src/providers/native-history/antigravity-cli-transcript.ts +1275 -0
- package/src/providers/native-history/claude-cli-transcript.ts +396 -0
- package/src/providers/native-history/codex-cli-transcript.ts +479 -0
- package/src/providers/native-history/constants.ts +19 -0
- package/src/providers/native-history/dispatcher.ts +617 -0
- package/src/providers/native-history/hermes-cli-transcript.ts +312 -0
- package/src/providers/native-history/index.ts +30 -0
- package/src/providers/provider-instance-manager.ts +71 -0
- package/src/providers/provider-instance.ts +24 -1
- package/src/providers/provider-loader.ts +700 -55
- package/src/providers/provider-schema.ts +87 -14
- package/src/providers/provider-trust.ts +114 -0
- package/src/providers/read-chat-contract.ts +76 -16
- package/src/providers/sdk/README.md +49 -0
- package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
- package/src/providers/sdk/v1/builders/cli/detect-status.ts +313 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval.ts +261 -0
- package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
- package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
- package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
- package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
- package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
- package/src/providers/sdk/v1/index.ts +152 -0
- package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
- package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
- package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
- package/src/providers/sdk/v1/schemas/cli/provider.schema.json +509 -0
- package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
- package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +125 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
- package/src/providers/sdk/v1/types/cli/index.ts +365 -0
- package/src/providers/sdk/v1/types/common/index.ts +229 -0
- package/src/providers/sdk/v1/validators/index.ts +19 -0
- package/src/providers/sdk/v1/validators/manifest.ts +110 -0
- package/src/providers/sdk/v1/validators/taint.ts +309 -0
- package/src/providers/spec/adapter.ts +246 -0
- package/src/providers/spec/cli-adapter.ts +1064 -0
- package/src/providers/spec/evaluator.ts +407 -0
- package/src/providers/spec/fsm-driver.ts +1528 -0
- package/src/providers/spec/fsm-evaluator.ts +290 -0
- package/src/providers/spec/fsm-loader.ts +128 -0
- package/src/providers/spec/fsm-types.ts +301 -0
- package/src/providers/spec/native-history-executor.ts +1241 -0
- package/src/providers/spec/pre-launch-trust.ts +104 -0
- package/src/providers/spec/route.ts +51 -0
- package/src/providers/spec/types.ts +284 -0
- package/src/providers/status-monitor.d.ts +7 -7
- package/src/providers/status-monitor.ts +37 -22
- package/src/providers/transcript-v2.ts +567 -0
- package/src/providers/types/interactive-prompt.ts +536 -0
- package/src/providers/version-archive.ts +64 -24
- package/src/providers/working-dir.ts +23 -0
- package/src/repo-mesh-types.ts +868 -13
- package/src/runtime-defaults.ts +39 -0
- package/src/session-host/managed-host.ts +218 -0
- package/src/session-host/runtime-surface.ts +20 -80
- package/src/sessions/registry.ts +44 -0
- package/src/shared-types-extra.ts +2 -4
- package/src/shared-types.d.ts +8 -0
- package/src/shared-types.ts +136 -55
- package/src/status/builders.ts +26 -6
- package/src/status/chat-tail-hot-sessions.ts +117 -2
- package/src/status/normalize.ts +2 -0
- package/src/status/reporter.ts +19 -1
- package/src/status/snapshot.ts +95 -26
- package/src/system/hash.ts +23 -0
- package/src/system/host-memory.ts +29 -12
- package/src/system/load-better-sqlite3.ts +68 -0
- package/src/types.ts +5 -0
- package/dist/cli-adapters/terminal-backends/xterm-backend.d.ts +0 -17
- package/dist/mesh/mesh-sync.d.ts +0 -53
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +0 -16
- package/src/cli-adapters/terminal-backends/xterm-backend.ts +0 -97
- package/src/mesh/mesh-sync.ts +0 -111
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest validators — runtime JSON Schema check for v1 provider manifests.
|
|
3
|
+
*
|
|
4
|
+
* The schemas live under `schemas/{category}/provider.schema.json` and are
|
|
5
|
+
* the authoritative contract for what a v1 manifest may contain. Daemon
|
|
6
|
+
* code that loads a manifest at install or boot time runs it through
|
|
7
|
+
* `validateCliProviderManifest()` first; failures are reported back to
|
|
8
|
+
* the caller with structured paths so manifest authors can locate the
|
|
9
|
+
* offending field without guessing.
|
|
10
|
+
*
|
|
11
|
+
* Validation lives in the SDK layer (not in provider-loader) so dashboards,
|
|
12
|
+
* registry workers, and the provider publish flow can all reuse the
|
|
13
|
+
* same code path and produce identical error messages.
|
|
14
|
+
*/
|
|
15
|
+
export interface ManifestValidationIssue {
|
|
16
|
+
/** JSON Pointer-style path into the manifest. Empty string for the root. */
|
|
17
|
+
path: string;
|
|
18
|
+
/** Schema-keyword that failed. */
|
|
19
|
+
keyword: string;
|
|
20
|
+
/** Human-readable explanation. */
|
|
21
|
+
message: string;
|
|
22
|
+
/** Allowed values when the failure is an `enum` / `const` / `additionalProperties`. */
|
|
23
|
+
allowed?: unknown;
|
|
24
|
+
}
|
|
25
|
+
export interface ManifestValidationResult {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
issues: ManifestValidationIssue[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validate a CLI provider.v1.json manifest. Returns `{ ok: true, issues: [] }`
|
|
31
|
+
* on success and `{ ok: false, issues: [...] }` on failure with each issue
|
|
32
|
+
* pointing at the offending field. Never throws — manifest parse errors
|
|
33
|
+
* should be caught by the caller before this is called.
|
|
34
|
+
*/
|
|
35
|
+
export declare function validateCliProviderManifest(manifest: unknown): ManifestValidationResult;
|
|
36
|
+
/**
|
|
37
|
+
* Render a list of validation issues as a single multi-line string,
|
|
38
|
+
* suitable for log lines or daemon command error fields.
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatManifestValidationIssues(issues: ManifestValidationIssue[]): string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static taint analyzer for extended-tier override JS.
|
|
3
|
+
*
|
|
4
|
+
* Goal: classify the override JS shipped with an extended-tier provider into
|
|
5
|
+
* one of three risk tiers, so the dashboard + daemon trust prompt can
|
|
6
|
+
* surface accurate language to the operator instead of a single generic
|
|
7
|
+
* "this provider contains JS" warning.
|
|
8
|
+
*
|
|
9
|
+
* - clean : no flagged APIs at all. The override looks like pure string
|
|
10
|
+
* manipulation. Still extended-tier, but the warning copy is
|
|
11
|
+
* "this provider contains JS; nothing dangerous was detected".
|
|
12
|
+
* - elevated : touches process / dynamic codegen / dynamic require / eval
|
|
13
|
+
* / Function constructor / child_process. The warning copy is
|
|
14
|
+
* explicit ("this provider can run shell commands / dynamically
|
|
15
|
+
* load code").
|
|
16
|
+
* - hostile : combines elevated APIs with network egress, AND uses obvious
|
|
17
|
+
* obfuscation (base64-decoded strings fed into Function / eval).
|
|
18
|
+
* The publish endpoint should reject these.
|
|
19
|
+
*
|
|
20
|
+
* Implementation note: this is a *static* analyzer — string + light AST scan
|
|
21
|
+
* via Node's built-in parser. It is intentionally fail-loud: anything that
|
|
22
|
+
* looks suspicious is flagged. False positives are fine; this exists to gate
|
|
23
|
+
* the trust prompt, not to be a real sandbox. The real sandbox lives in
|
|
24
|
+
* Phase 5 (isolated-vm).
|
|
25
|
+
*
|
|
26
|
+
* Used by:
|
|
27
|
+
* - `adhdev provider validate` (CLI tier classification)
|
|
28
|
+
* - registry publish endpoint static-check
|
|
29
|
+
* - daemon at provider-load time, to size the warning
|
|
30
|
+
*/
|
|
31
|
+
export type TaintLevel = 'clean' | 'elevated' | 'hostile';
|
|
32
|
+
export interface TaintFinding {
|
|
33
|
+
/** What was found, e.g. "child_process.exec". */
|
|
34
|
+
api: string;
|
|
35
|
+
/** Coarse category. */
|
|
36
|
+
category: TaintCategory;
|
|
37
|
+
/** File the finding came from. */
|
|
38
|
+
file: string;
|
|
39
|
+
/** Line number (1-indexed) of the first character of the matched token. */
|
|
40
|
+
line: number;
|
|
41
|
+
/** The surrounding source excerpt, trimmed. */
|
|
42
|
+
excerpt: string;
|
|
43
|
+
}
|
|
44
|
+
export type TaintCategory = 'process-control' | 'shell-exec' | 'fs-write' | 'fs-read' | 'network' | 'dynamic-codegen' | 'dynamic-require' | 'obfuscation' | 'global-mutation';
|
|
45
|
+
export interface TaintResult {
|
|
46
|
+
level: TaintLevel;
|
|
47
|
+
findings: TaintFinding[];
|
|
48
|
+
files: string[];
|
|
49
|
+
}
|
|
50
|
+
export declare function analyzeOverrideTaint(manifestPath: string): TaintResult;
|
|
51
|
+
/** Format a result as a single CLI-friendly block. */
|
|
52
|
+
export declare function formatTaintResult(result: TaintResult): string;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { PtyTransportFactory } from '../../cli-adapters/pty-transport.js';
|
|
2
|
+
export type { PtyTransportFactory };
|
|
3
|
+
export interface TerminalAdapterOpts {
|
|
4
|
+
binary: string;
|
|
5
|
+
args?: string[];
|
|
6
|
+
cwd?: string;
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
/**
|
|
9
|
+
* When true, `env` is already a COMPLETE, sanitized environment (the spawn
|
|
10
|
+
* planner merged + stripped process.env already) and must be passed to the
|
|
11
|
+
* PTY verbatim — NOT overlaid on top of process.env. Overlaying would
|
|
12
|
+
* re-introduce the npm_/PNPM_/parent-session keys the planner explicitly
|
|
13
|
+
* stripped, so the spec path's spawn env would diverge from the legacy
|
|
14
|
+
* path's. Defaults to false (legacy overlay behaviour) for any caller that
|
|
15
|
+
* still passes a partial env.
|
|
16
|
+
*/
|
|
17
|
+
envIsComplete?: boolean;
|
|
18
|
+
cols?: number;
|
|
19
|
+
rows?: number;
|
|
20
|
+
/** Coalesce screen snapshots: emit on_screen_changed at most this often. */
|
|
21
|
+
screenChangeDebounceMs?: number;
|
|
22
|
+
tickIntervalMs?: number;
|
|
23
|
+
transportFactory?: PtyTransportFactory;
|
|
24
|
+
}
|
|
25
|
+
export interface TerminalAdapterHandlers {
|
|
26
|
+
init?(info: {
|
|
27
|
+
pid: number;
|
|
28
|
+
}): void;
|
|
29
|
+
on_pty_data?(chunk: string): void;
|
|
30
|
+
on_screen_changed?(snapshot: string): void;
|
|
31
|
+
on_exit?(info: {
|
|
32
|
+
exitCode: number;
|
|
33
|
+
}): void;
|
|
34
|
+
tick?(): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* One entry in the PTY input/output event timeline (debug-only). Captured at
|
|
38
|
+
* the single common point every spec@4 provider funnels through — this adapter
|
|
39
|
+
* — so the Spec Debug Snapshot can answer "what input / output preceded a status
|
|
40
|
+
* transition?". Observation only; nothing here feeds the FSM decision.
|
|
41
|
+
*/
|
|
42
|
+
export interface SpecPtyEvent {
|
|
43
|
+
/** Wall-clock ms. */
|
|
44
|
+
ts: number;
|
|
45
|
+
kind: 'spawn' | 'input' | 'output' | 'resize' | 'cursor' | 'exit';
|
|
46
|
+
/** Human-readable, control-char-escaped, length-capped preview. */
|
|
47
|
+
content: string;
|
|
48
|
+
/** Raw byte length before truncation (output/input only). */
|
|
49
|
+
bytes?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare class TerminalAdapter {
|
|
52
|
+
private readonly opts;
|
|
53
|
+
private readonly handlers;
|
|
54
|
+
private rows;
|
|
55
|
+
private cols;
|
|
56
|
+
private readonly screenDebounceMs;
|
|
57
|
+
private readonly tickIntervalMs;
|
|
58
|
+
private readonly factory;
|
|
59
|
+
private screen;
|
|
60
|
+
private pty;
|
|
61
|
+
private screenTimer;
|
|
62
|
+
private tickTimer;
|
|
63
|
+
private lastScreen;
|
|
64
|
+
/** Debug-only ring buffer of PTY input/output/resize/cursor events. */
|
|
65
|
+
private events;
|
|
66
|
+
private lastCursorKey;
|
|
67
|
+
constructor(opts: TerminalAdapterOpts, handlers: TerminalAdapterHandlers);
|
|
68
|
+
start(): void;
|
|
69
|
+
resize(cols: number, rows: number): void;
|
|
70
|
+
snapshot(): string;
|
|
71
|
+
/**
|
|
72
|
+
* Full-buffer snapshot including scrollback history. Unlike snapshot()
|
|
73
|
+
* (visible viewport only), this survives a tall prompt whose top has
|
|
74
|
+
* scrolled off-screen — used for content-pattern extraction (modal
|
|
75
|
+
* buttons / approval anchors), NOT for cursor-relative conditions.
|
|
76
|
+
*/
|
|
77
|
+
snapshotWithScrollback(): string;
|
|
78
|
+
getCursorPosition(): {
|
|
79
|
+
row: number;
|
|
80
|
+
col: number;
|
|
81
|
+
};
|
|
82
|
+
send_keys(text: string): void;
|
|
83
|
+
/** Forward runtime metadata (meshNodeId, workspaceLabel, lifecycle, …) to
|
|
84
|
+
* the underlying transport so it reaches the session registry. The spec
|
|
85
|
+
* path previously dropped everything but providerSessionId here, which
|
|
86
|
+
* left autoLaunch's meshNodeId stamp unbound on the record (see
|
|
87
|
+
* SESSION-ACCUMULATION-LEAK). No-op when the transport does not support
|
|
88
|
+
* metadata updates (e.g. plain node-pty). */
|
|
89
|
+
updateMeta(meta: Record<string, unknown>, replace?: boolean): void;
|
|
90
|
+
/** Debug-only: most-recent PTY input/output/resize/cursor events, oldest
|
|
91
|
+
* first. Pure observation — never consulted by the FSM. */
|
|
92
|
+
getEventTimeline(limit?: number): SpecPtyEvent[];
|
|
93
|
+
private recordEvent;
|
|
94
|
+
kill(): void;
|
|
95
|
+
private onChunk;
|
|
96
|
+
private computeScreen;
|
|
97
|
+
private stopTimers;
|
|
98
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import type { CliAdapter, CliAdapterStatus } from '../../cli-adapter-types.js';
|
|
2
|
+
import type { PtyTransportFactory } from '../../cli-adapters/pty-transport.js';
|
|
3
|
+
import { type InteractivePromptResponse } from '../types/interactive-prompt.js';
|
|
4
|
+
export declare class SpecCliAdapter implements CliAdapter {
|
|
5
|
+
readonly cliType: string;
|
|
6
|
+
readonly cliName: string;
|
|
7
|
+
readonly workingDir: string;
|
|
8
|
+
/**
|
|
9
|
+
* Marker the daemon's finalization gate checks: `getStatus()` returns
|
|
10
|
+
* `messages: []` by design here (chat history lives in the daemon's
|
|
11
|
+
* native-history pipeline, not the adapter). Without this flag,
|
|
12
|
+
* cli-provider-instance's `missing_final_assistant` gate would stall
|
|
13
|
+
* every turn until the 30s safety timeout because it expects the
|
|
14
|
+
* adapter to surface the final assistant message.
|
|
15
|
+
*/
|
|
16
|
+
readonly chatMessagesOwnedExternally: true;
|
|
17
|
+
private driver;
|
|
18
|
+
/** Common spec fields the adapter reads, present in both v3 and v4. */
|
|
19
|
+
private spec;
|
|
20
|
+
private lastEvent;
|
|
21
|
+
private latestState;
|
|
22
|
+
private latestModal;
|
|
23
|
+
private statusCallback;
|
|
24
|
+
private ptyDataCallback;
|
|
25
|
+
private partialResponse;
|
|
26
|
+
private activeInteractivePrompt;
|
|
27
|
+
private interactivePromptTransport;
|
|
28
|
+
private claudeTuiPromptCaptureInFlight;
|
|
29
|
+
/**
|
|
30
|
+
* Wall clock of the first frame on which a held interactive prompt was
|
|
31
|
+
* observed to have left the screen. Mirrors the approval FSM's
|
|
32
|
+
* `modalLostAt` hysteresis (see cli-state-engine.ts): claude-cli's TUI
|
|
33
|
+
* repaints the choice picker as several PTY chunks, so a single frame
|
|
34
|
+
* with no "Enter to select" footer is not proof the prompt is gone — it
|
|
35
|
+
* may just be mid-repaint. We only clear the held prompt once it has
|
|
36
|
+
* been absent across a short grace window. Reset to null the moment the
|
|
37
|
+
* prompt footer reappears.
|
|
38
|
+
*
|
|
39
|
+
* Without this, a choice prompt resolved *directly in the terminal* (the
|
|
40
|
+
* user picked an option without going through ADHDev's
|
|
41
|
+
* setInteractivePromptResponse) was never cleared from
|
|
42
|
+
* `activeInteractivePrompt`, so getStatus() re-emitted the same prompt
|
|
43
|
+
* forever — the choice-resolve-stuck bug.
|
|
44
|
+
*/
|
|
45
|
+
private interactivePromptLostAt;
|
|
46
|
+
private jsonLineTail;
|
|
47
|
+
private exited;
|
|
48
|
+
private spawned;
|
|
49
|
+
private providerSessionId;
|
|
50
|
+
/** Wall clock at the moment spawn() ran. Used as the cutoff for
|
|
51
|
+
* native-history file selection so a prior session's transcript
|
|
52
|
+
* can't leak into this session before the agent has written its
|
|
53
|
+
* own records. */
|
|
54
|
+
private spawnedAtMs;
|
|
55
|
+
/** Env vars the daemon set on the spawned child. Mesh coordinator
|
|
56
|
+
* points hermes at a per-coordinator HERMES_HOME so the dashboard's
|
|
57
|
+
* native-history reader needs that override to find the right
|
|
58
|
+
* state.db; without it the reader sees ~/.hermes/state.db which
|
|
59
|
+
* the coordinator-launched hermes never writes to. The choice to
|
|
60
|
+
* redirect HERMES_HOME is a workaround for an unresolved hermes
|
|
61
|
+
* upstream feature gap (see hermes-agent#23130 — runtime-supplied
|
|
62
|
+
* MCP config), so this routing keeps the dashboard honest until
|
|
63
|
+
* hermes ships a runtime MCP override. */
|
|
64
|
+
private spawnedEnv;
|
|
65
|
+
constructor(specPath: string, workingDir: string, cliArgs: string[], extraEnv: Record<string, string>, transportFactory?: PtyTransportFactory);
|
|
66
|
+
spawn(): Promise<void>;
|
|
67
|
+
sendMessage(text: string): Promise<void>;
|
|
68
|
+
getStatus(): CliAdapterStatus;
|
|
69
|
+
private maybeRefreshNativeHistory;
|
|
70
|
+
getScriptParsedStatus(): unknown;
|
|
71
|
+
getPartialResponse(): string;
|
|
72
|
+
shutdown(): void;
|
|
73
|
+
cancel(): void;
|
|
74
|
+
isProcessing(): boolean;
|
|
75
|
+
isReady(): boolean;
|
|
76
|
+
setOnStatusChange(cb: () => void): void;
|
|
77
|
+
setOnPtyData(cb: (data: string) => void): void;
|
|
78
|
+
writeRaw(data: string): void;
|
|
79
|
+
resize(cols: number, rows: number): void;
|
|
80
|
+
resolveModal(buttonIndex: number): void;
|
|
81
|
+
resolveAction(data: unknown): Promise<void>;
|
|
82
|
+
setInteractivePromptResponse(response: InteractivePromptResponse): Promise<void>;
|
|
83
|
+
isApprovalRecentlyResolved(): boolean;
|
|
84
|
+
clearHistory(): void;
|
|
85
|
+
updateRuntimeSettings(): void;
|
|
86
|
+
setServerConn(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Map an invokeScript(name, args) call onto a control_bar entry.
|
|
89
|
+
*
|
|
90
|
+
* scriptName is matched against control.id. The control's action.type
|
|
91
|
+
* drives the dispatch:
|
|
92
|
+
*
|
|
93
|
+
* send_keys → click_control (e.g. stop)
|
|
94
|
+
* open_picker → two roles, driven by the screen, not a hardcoded list:
|
|
95
|
+
* - LIST (no choice arg): open the picker, wait for it
|
|
96
|
+
* to render, parse the on-screen options via
|
|
97
|
+
* `extract_choices`, and return them as
|
|
98
|
+
* `controlResult.options` (+ `currentValue`). This is
|
|
99
|
+
* how the dashboard's Model/Mode controls learn what is
|
|
100
|
+
* actually selectable in this CLI right now.
|
|
101
|
+
* - SELECT (args.choiceIndex / args.choiceLabel): drive
|
|
102
|
+
* the picker to that option using `submit_key`.
|
|
103
|
+
* attach_image → attach_image dispatch; expects args.blob (data url
|
|
104
|
+
* or base64) and args.mime
|
|
105
|
+
*
|
|
106
|
+
* Callers that pass an unknown control id get a { not_found } response.
|
|
107
|
+
* No control matched, no driver call — keeps the surface honest.
|
|
108
|
+
*/
|
|
109
|
+
invokeScript(scriptName: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
110
|
+
/**
|
|
111
|
+
* Open an `open_picker` control and return the options the CLI is showing,
|
|
112
|
+
* parsed live from the screen via `extract_choices`. Nothing is selected —
|
|
113
|
+
* the picker is left open so a follow-up SELECT invoke can commit a choice.
|
|
114
|
+
*/
|
|
115
|
+
private openPickerAndListChoices;
|
|
116
|
+
/**
|
|
117
|
+
* Drive an already-listable picker to a specific option. The option can be
|
|
118
|
+
* named (choiceLabel — matched against the parsed on-screen labels) or
|
|
119
|
+
* positional (choiceIndex — the on-screen number). The actual keystrokes
|
|
120
|
+
* come from the spec's `submit_key` with `{index}` substituted, so the spec
|
|
121
|
+
* — not this code — decides how a selection is keyed for each CLI.
|
|
122
|
+
*/
|
|
123
|
+
private selectPickerChoice;
|
|
124
|
+
/** Parse the picker choices only if the picker already appears rendered on
|
|
125
|
+
* the live screen (its `wait_for` condition currently matches and at least
|
|
126
|
+
* one choice parses). Returns the parsed choices when open, else null so
|
|
127
|
+
* the caller knows it must send the trigger to open it. Used to de-dup the
|
|
128
|
+
* picker open in {@link selectPickerChoice}. */
|
|
129
|
+
private extractPickerChoicesIfRendered;
|
|
130
|
+
/** Poll the live screen until the picker's `wait_for` condition matches,
|
|
131
|
+
* up to a short budget. Returns true if it rendered, false on timeout. */
|
|
132
|
+
private waitForPickerRendered;
|
|
133
|
+
/** Parse the picker's `extract_choices` pattern against the live screen.
|
|
134
|
+
* Each match yields { index, label, current }. `current` is true for the
|
|
135
|
+
* line the CLI marks with its cursor glyph (❯ ›). Purely screen-driven —
|
|
136
|
+
* no model/mode names are baked in. */
|
|
137
|
+
private extractPickerChoices;
|
|
138
|
+
/** Live text of a named screen section (or the whole screen when no
|
|
139
|
+
* section is named), resolved from the driver's current sections. */
|
|
140
|
+
private readScreenSectionText;
|
|
141
|
+
getDebugSnapshot(): unknown;
|
|
142
|
+
getRuntimeMetadata(): unknown;
|
|
143
|
+
updateRuntimeMeta(meta?: Record<string, unknown>): void;
|
|
144
|
+
refreshProviderDefinition(): void;
|
|
145
|
+
private handleEvent;
|
|
146
|
+
private detectInteractivePromptFromPtyChunk;
|
|
147
|
+
private readCurrentScreenSections;
|
|
148
|
+
private extractProviderSessionIdFromScreen;
|
|
149
|
+
private readClaudeScreenAssistantMessages;
|
|
150
|
+
/**
|
|
151
|
+
* Grace window a held interactive prompt must be absent from the screen
|
|
152
|
+
* before we treat it as resolved-in-terminal and clear it. claude-cli
|
|
153
|
+
* repaints the picker across multiple PTY chunks, so a single
|
|
154
|
+
* footer-less frame is not proof the prompt is gone. Sized in the same
|
|
155
|
+
* spirit as the approval FSM's `approvalCooldown` modal-lost hysteresis.
|
|
156
|
+
*/
|
|
157
|
+
private static readonly INTERACTIVE_PROMPT_LOST_GRACE_MS;
|
|
158
|
+
/**
|
|
159
|
+
* Multi-question TUI capture: after Tabbing to a page, re-snapshot at this
|
|
160
|
+
* interval until its checkbox glyph column has settled, up to the timeout.
|
|
161
|
+
* The interval matches the legacy single fixed wait (120ms); the timeout
|
|
162
|
+
* bounds total capture time so a single-select page (which never shows
|
|
163
|
+
* glyphs) doesn't stall the capture indefinitely.
|
|
164
|
+
*/
|
|
165
|
+
private static readonly CLAUDE_TUI_PAGE_POLL_INTERVAL_MS;
|
|
166
|
+
private static readonly CLAUDE_TUI_PAGE_SETTLE_TIMEOUT_MS;
|
|
167
|
+
/**
|
|
168
|
+
* Clear a held interactive prompt once the user has resolved it directly
|
|
169
|
+
* in the terminal (the choice picker leaves the screen without going
|
|
170
|
+
* through setInteractivePromptResponse). The approval path already does
|
|
171
|
+
* this via the FSM's modal-lost hysteresis; the interactive-prompt path
|
|
172
|
+
* had no equivalent, so a terminal-side answer left activeInteractivePrompt
|
|
173
|
+
* set and getStatus() re-emitted the same choice modal forever.
|
|
174
|
+
*
|
|
175
|
+
* Detection mirrors capture: the claude TUI picker is on-screen exactly
|
|
176
|
+
* while its "Enter to select" footer is rendered. When the footer is gone
|
|
177
|
+
* for INTERACTIVE_PROMPT_LOST_GRACE_MS the prompt is genuinely resolved.
|
|
178
|
+
*/
|
|
179
|
+
private maybeClearResolvedClaudeTuiPrompt;
|
|
180
|
+
private maybeCaptureClaudeTuiPrompt;
|
|
181
|
+
/**
|
|
182
|
+
* The TUI prompt is captured on the FIRST frame that renders the
|
|
183
|
+
* "Enter to select" footer. At that instant the option rows' checkbox
|
|
184
|
+
* column may not have drawn yet, so `detectClaudeTuiMultiSelect` returns
|
|
185
|
+
* false and the prompt is frozen as single-select — the dashboard then
|
|
186
|
+
* renders radio buttons even though the picker is multi-select.
|
|
187
|
+
*
|
|
188
|
+
* While the same TUI prompt is still on screen, re-check the live snapshot:
|
|
189
|
+
* if checkbox glyphs have since appeared, promote any single-select
|
|
190
|
+
* question to multi-select and re-emit status. Promotion is one-way
|
|
191
|
+
* (false→true only) — once a question is known multi-select we never demote
|
|
192
|
+
* it, since the glyph column can scroll out of view on later frames.
|
|
193
|
+
*
|
|
194
|
+
* For MULTI-question prompts the per-page Tab capture is the actual source
|
|
195
|
+
* of the bug: pages 2..N are snapshotted ~120ms after the Tab keypress,
|
|
196
|
+
* before their option-row glyph column has redrawn, so those questions
|
|
197
|
+
* freeze as single-select while page 1 (already settled) is correct. We
|
|
198
|
+
* cannot upgrade blindly — the live snapshot shows only ONE focused page —
|
|
199
|
+
* but we CAN read that page's question text/header and upgrade the matching
|
|
200
|
+
* question. As the user navigates the picker (or it settles), each page is
|
|
201
|
+
* eventually re-read and repaired.
|
|
202
|
+
*/
|
|
203
|
+
private maybeUpgradeClaudeTuiMultiSelect;
|
|
204
|
+
private readClaudeTuiHeaders;
|
|
205
|
+
/**
|
|
206
|
+
* Snapshot the currently-focused claude TUI page, polling until its
|
|
207
|
+
* option-row checkbox glyph column has settled (or a bounded timeout).
|
|
208
|
+
*
|
|
209
|
+
* Why poll: right after a Tab keypress the newly-focused page's glyph
|
|
210
|
+
* column has not redrawn yet, so an immediate snapshot shows the question +
|
|
211
|
+
* option labels but NO per-option checkbox markers — freezing that page as
|
|
212
|
+
* single-select. A fixed delay either races (too short) or is wasteful (too
|
|
213
|
+
* long). Instead we re-snapshot at a fixed interval and stop as soon as the
|
|
214
|
+
* frame shows multi-select glyphs, falling back to the last frame at the
|
|
215
|
+
* timeout. Single-select pages never show glyphs, so they always poll to the
|
|
216
|
+
* timeout — bounded small to keep capture snappy.
|
|
217
|
+
*/
|
|
218
|
+
private snapshotSettledClaudeTuiPage;
|
|
219
|
+
private captureClaudeTuiPrompt;
|
|
220
|
+
getDebugState(): Record<string, any>;
|
|
221
|
+
getTraceState(limit?: number): Record<string, any>;
|
|
222
|
+
getProviderResolutionMeta(): Record<string, any>;
|
|
223
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { SectionDef, Condition, ExtractTitle, ExtractButtons } from './types.js';
|
|
2
|
+
export interface ResolvedSection {
|
|
3
|
+
id: string;
|
|
4
|
+
fromLine: number;
|
|
5
|
+
toLine: number;
|
|
6
|
+
text: string;
|
|
7
|
+
}
|
|
8
|
+
export interface TraceEntry {
|
|
9
|
+
kind: 'section' | 'state_match' | 'state_skip' | 'modal' | 'control' | 'notification' | 'delegate';
|
|
10
|
+
text: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveSections(sectionsObj: Record<string, SectionDef>, lines: string[]): ResolvedSection[];
|
|
13
|
+
export declare function sectionText(sections: ResolvedSection[], sectionId: string | undefined, fullScreen: string): string;
|
|
14
|
+
export declare function evaluateCondition(cond: Condition, sections: ResolvedSection[], fullScreen: string, cursor: {
|
|
15
|
+
row: number;
|
|
16
|
+
col: number;
|
|
17
|
+
} | undefined, prevLines: string[] | undefined, trace: TraceEntry[], stateId: string): boolean;
|
|
18
|
+
export declare function extractTitle(rule: ExtractTitle, sections: ResolvedSection[], fullScreen: string): string | null;
|
|
19
|
+
export declare function extractButtonsFromRule(rule: ExtractButtons, hay: string): {
|
|
20
|
+
index: number;
|
|
21
|
+
label: string;
|
|
22
|
+
key: string;
|
|
23
|
+
current: boolean;
|
|
24
|
+
}[];
|
|
25
|
+
/**
|
|
26
|
+
* Reduce a top→bottom-ordered list of parsed numbered entries to only the
|
|
27
|
+
* bottom-most contiguous block — the run whose indices descend by exactly 1
|
|
28
|
+
* scanning upward from the last entry.
|
|
29
|
+
*
|
|
30
|
+
* Picker and approval choices always render as the LAST contiguous numbered
|
|
31
|
+
* block at the bottom of the modal section. The conversation history above can
|
|
32
|
+
* carry its own stray "1./2./3." numbered lists (and blockquote `>` lines), and
|
|
33
|
+
* because section anchoring can pull body lines into the modal section, a naive
|
|
34
|
+
* top-down scan would bind the low option indices to those body lines and drop
|
|
35
|
+
* the real choices (the dashboard would show, and an arrow-key picker would
|
|
36
|
+
* commit, the wrong row). Selecting the bottom block makes the on-screen picker
|
|
37
|
+
* win regardless of body content. Since pickers number their options 1..N
|
|
38
|
+
* contiguously and bodies use indices ≥ 1, the upward chain always breaks the
|
|
39
|
+
* moment it would need a "0." above the picker's "1." — so the picker block is
|
|
40
|
+
* isolated cleanly. Entries are assumed already in screen order; the returned
|
|
41
|
+
* slice keeps that order.
|
|
42
|
+
*/
|
|
43
|
+
export declare function lastContiguousNumberedBlock<T extends {
|
|
44
|
+
index: number;
|
|
45
|
+
}>(entries: T[]): T[];
|