@adhdev/daemon-core 0.9.82-rc.50 → 0.9.82-rc.500
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 +85 -2
- package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +246 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +139 -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 +71 -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 +151 -0
- package/dist/commands/router-worktree-cleanup.d.ts +133 -0
- package/dist/commands/router.d.ts +203 -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 +66 -0
- 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 +80 -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 +71 -17
- package/dist/index.js +56455 -21586
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53763 -19064
- 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 +256 -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 +58 -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 +258 -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 +21 -1
- package/dist/mesh/mesh-idle-reminder.d.ts +68 -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 +162 -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 +84 -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 +457 -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 +584 -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 +34 -0
- package/dist/mesh/mesh-warmup-deadline.d.ts +68 -0
- package/dist/mesh/mesh-work-queue.d.ts +392 -1
- package/dist/mesh/preview-freshness.d.ts +28 -0
- package/dist/mesh/refine-config.d.ts +97 -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 +47 -0
- package/dist/providers/cli-provider-instance.d.ts +461 -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 +196 -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 +30 -0
- package/dist/providers/provider-instance.d.ts +31 -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/background-task-detector.d.ts +29 -0
- package/dist/providers/spec/cli-adapter.d.ts +224 -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 +50 -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 -14
- 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 +110 -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 +27 -0
- package/dist/system/hash.d.ts +8 -0
- package/dist/system/load-better-sqlite3.d.ts +21 -0
- package/dist/types.d.ts +20 -6
- 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 +79 -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 +85 -2
- package/src/cli-adapters/cli-script-runner.ts +421 -0
- package/src/cli-adapters/cli-state-engine.ts +1379 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +1059 -1143
- 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 +2788 -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 +724 -27
- package/src/commands/handler.ts +865 -2
- package/src/commands/high-family/index.ts +28 -0
- package/src/commands/high-family/mesh-coordinator-launch.ts +696 -0
- package/src/commands/high-family/mesh-events.ts +102 -0
- package/src/commands/high-family/mesh-status.ts +857 -0
- package/src/commands/high-family/types.ts +80 -0
- package/src/commands/low-family/coordinator-prompt.ts +125 -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 +270 -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 +1309 -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 +1794 -0
- package/src/commands/router-worktree-cleanup.ts +870 -0
- package/src/commands/router.ts +567 -4149
- 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 +300 -24
- 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 +822 -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 +191 -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 +510 -0
- package/src/mesh/coordinator-prompt.ts +626 -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 +2042 -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 +1548 -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 +41 -3
- package/src/mesh/mesh-idle-reminder.ts +153 -0
- package/src/mesh/mesh-init.ts +350 -0
- package/src/mesh/mesh-ledger-reconciliation.ts +12 -7
- package/src/mesh/mesh-ledger.ts +897 -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 +2498 -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 +1709 -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 +1792 -0
- package/src/mesh/mesh-refine-status.ts +231 -0
- package/src/mesh/mesh-remote-event-pull.ts +286 -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 +2318 -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 +215 -0
- package/src/mesh/mesh-warmup-deadline.ts +152 -0
- package/src/mesh/mesh-work-queue.ts +1489 -145
- package/src/mesh/p2p-relay-failure.ts +2 -2
- package/src/mesh/preview-freshness.ts +163 -0
- package/src/mesh/refine-config.ts +129 -12
- 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 +150 -0
- package/src/providers/cli-provider-instance.ts +2914 -498
- 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 +207 -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 +93 -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 +538 -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/background-task-detector.ts +178 -0
- package/src/providers/spec/cli-adapter.ts +1090 -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 +1256 -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 +877 -16
- 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 +148 -55
- package/src/status/builders.ts +69 -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 +100 -27
- 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 +26 -6
- 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,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CliStateEngine — CLI provider status state machine
|
|
3
|
+
*
|
|
4
|
+
* Owns all status-transition logic, timer management, and script-driven
|
|
5
|
+
* evaluation. Reads buffer state from the transport and writes to PTY via
|
|
6
|
+
* the transport interface — adapter stays as pure I/O layer.
|
|
7
|
+
*/
|
|
8
|
+
import { type TurnParseScope } from './provider-cli-parse.js';
|
|
9
|
+
import { type CliProviderModule, type CliSessionStatus, type CliTraceEntry, type ParsedSession } from './provider-cli-shared.js';
|
|
10
|
+
import type { CliScriptRunner } from './cli-script-runner.js';
|
|
11
|
+
export interface CliBufferSnapshot {
|
|
12
|
+
accumulatedBuffer: string;
|
|
13
|
+
accumulatedRawBuffer: string;
|
|
14
|
+
recentOutputBuffer: string;
|
|
15
|
+
responseBuffer: string;
|
|
16
|
+
screenText: string;
|
|
17
|
+
parseScreenText: string;
|
|
18
|
+
workingDir: string;
|
|
19
|
+
providerSessionId: string | null;
|
|
20
|
+
runtimeSettings: Record<string, any>;
|
|
21
|
+
isWaitingForResponse: boolean;
|
|
22
|
+
currentTurnScope: TurnParseScope | null;
|
|
23
|
+
lastOutputAt: number;
|
|
24
|
+
lastNonEmptyOutputAt: number;
|
|
25
|
+
lastScreenChangeAt: number;
|
|
26
|
+
lastScreenSnapshot: string;
|
|
27
|
+
}
|
|
28
|
+
/** What the engine needs from the transport layer */
|
|
29
|
+
export interface CliTransportAccess {
|
|
30
|
+
getSnapshot(): CliBufferSnapshot;
|
|
31
|
+
writeRaw(data: string | Buffer): void;
|
|
32
|
+
getApprovalKeyForIndex(buttonIndex: number): string | undefined;
|
|
33
|
+
flushOutboundQueue(): void;
|
|
34
|
+
isAlive(): boolean;
|
|
35
|
+
/** Optional: override script dispatch (used by tests to mock detection) */
|
|
36
|
+
runDetectStatus?(text: string): string | null;
|
|
37
|
+
/** Optional: override script dispatch (used by tests to mock approval) */
|
|
38
|
+
runParseApproval?(tail: string): {
|
|
39
|
+
message: string;
|
|
40
|
+
buttons: string[];
|
|
41
|
+
} | null;
|
|
42
|
+
/** Optional: override full session parse (used by tests to mock parsing) */
|
|
43
|
+
runParseSession?(): ParsedSession | null;
|
|
44
|
+
/** Optional: provider type override — used when tests patch the adapter's cliType */
|
|
45
|
+
cliType?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface CliStateEngineCallbacks {
|
|
48
|
+
onStatusChange(): void;
|
|
49
|
+
onApplyParsedSession(session: ParsedSession): void;
|
|
50
|
+
onTurnCompleted(): void;
|
|
51
|
+
/**
|
|
52
|
+
* FALSE-IDLE (Fix 2): true when the owning session is inside the post-approval
|
|
53
|
+
* resume grace — an autonomous auto-approving mesh session that resolved a modal
|
|
54
|
+
* within the resume-grace window. The engine cannot decide this on its own (it has
|
|
55
|
+
* no mesh/auto-approve awareness); the instance answers using the SAME
|
|
56
|
+
* `inApprovalResumeGrace` judgment Fix 1 uses, so the two fixes stay in lockstep.
|
|
57
|
+
* Optional: absent ⇒ treated as false (no hysteresis) so any non-instance embedder
|
|
58
|
+
* keeps the pre-fix behavior.
|
|
59
|
+
*/
|
|
60
|
+
isInApprovalResumeGrace?(): boolean;
|
|
61
|
+
}
|
|
62
|
+
export declare class CliStateEngine {
|
|
63
|
+
private readonly provider;
|
|
64
|
+
private readonly runner;
|
|
65
|
+
private readonly transport;
|
|
66
|
+
private readonly callbacks;
|
|
67
|
+
private readonly timeouts;
|
|
68
|
+
currentStatus: CliSessionStatus['status'];
|
|
69
|
+
isWaitingForResponse: boolean;
|
|
70
|
+
currentTurnScope: TurnParseScope | null;
|
|
71
|
+
currentTurnTaskId: string | null;
|
|
72
|
+
currentTurnStartedAt: number;
|
|
73
|
+
activeModal: {
|
|
74
|
+
message: string;
|
|
75
|
+
buttons: string[];
|
|
76
|
+
} | null;
|
|
77
|
+
lastApprovalResolvedAt: number;
|
|
78
|
+
lastResolvedModalMessage: string;
|
|
79
|
+
/**
|
|
80
|
+
* Monotonic counter bumped every time the FSM *enters* waiting_approval
|
|
81
|
+
* with a freshly captured modal (see `applyWaitingApproval`). It is the
|
|
82
|
+
* single discriminator between "the same approval re-observed across TUI
|
|
83
|
+
* paint flaps" and "a genuinely new, distinct approval".
|
|
84
|
+
*
|
|
85
|
+
* The message-equality cooldown below (`lastResolvedModalMessage`) cannot
|
|
86
|
+
* tell these apart on its own: claude-cli routinely presents consecutive
|
|
87
|
+
* approvals whose modal message text is identical (e.g. two back-to-back
|
|
88
|
+
* Bash-command prompts). When that second approval arrived inside
|
|
89
|
+
* `approvalCooldown`, the message-equality guard silently swallowed the
|
|
90
|
+
* key write and the approval stuck forever — fatal under auto-approval.
|
|
91
|
+
*
|
|
92
|
+
* `approvalEntrySeq` increments on every fresh entry; `lastResolvedEntrySeq`
|
|
93
|
+
* records which entry the cooldown belongs to. We only short-circuit the
|
|
94
|
+
* write when we are still resolving *that same* entry — a new entry (new
|
|
95
|
+
* seq) is always a real, distinct approval and must be written.
|
|
96
|
+
*/
|
|
97
|
+
approvalEntrySeq: number;
|
|
98
|
+
lastResolvedEntrySeq: number;
|
|
99
|
+
/**
|
|
100
|
+
* When the engine previously held a modal but the latest parse failed
|
|
101
|
+
* to extract one, we record the timestamp here and only drop the modal
|
|
102
|
+
* after the configured `approvalCooldown` to avoid flapping between
|
|
103
|
+
* waiting_approval and generating on every Claude TUI redraw — that
|
|
104
|
+
* flapping is what fed auto-approve a fresh modal signature on each
|
|
105
|
+
* paint and made the engine type "1" repeatedly into the prompt.
|
|
106
|
+
*/
|
|
107
|
+
modalLostAt: number;
|
|
108
|
+
private approvalExitTimeout;
|
|
109
|
+
responseEpoch: number;
|
|
110
|
+
submitPendingUntil: number;
|
|
111
|
+
responseSettleIgnoreUntil: number;
|
|
112
|
+
submitRetryUsed: boolean;
|
|
113
|
+
submitRetryPromptSnippet: string;
|
|
114
|
+
finishRetryCount: number;
|
|
115
|
+
providerErrorMessage: string | null;
|
|
116
|
+
providerErrorReason: string | null;
|
|
117
|
+
private settleTimer;
|
|
118
|
+
private idleTimeout;
|
|
119
|
+
private finishRetryTimer;
|
|
120
|
+
private providerErrorRetryTimer;
|
|
121
|
+
private providerErrorRetryKey;
|
|
122
|
+
pendingScriptStatus: 'generating' | 'waiting_approval' | null;
|
|
123
|
+
pendingScriptStatusSince: number;
|
|
124
|
+
private pendingScriptStatusTimer;
|
|
125
|
+
private idleFinishCandidate;
|
|
126
|
+
private approvalResumeDeferSince;
|
|
127
|
+
private approvalResumeDeferEpoch;
|
|
128
|
+
/**
|
|
129
|
+
* `finishResponse` produces the `generating → idle` transition that
|
|
130
|
+
* coordinators interpret as "task complete". Some providers (antigravity-
|
|
131
|
+
* cli observed in the wild) briefly paint a screen that looks like an
|
|
132
|
+
* idle prompt between tool result frames while still actively running,
|
|
133
|
+
* which fired `response_finished` and broke completion semantics.
|
|
134
|
+
* We defer the actual idle transition by IDLE_CONFIRMATION_GRACE_MS and
|
|
135
|
+
* cancel it if the scripted detection re-detects generating during that
|
|
136
|
+
* window — a true completion stays idle for many seconds, so a 2-second
|
|
137
|
+
* grace is sufficient to filter the paint blip.
|
|
138
|
+
*/
|
|
139
|
+
private pendingIdleFinishTimer;
|
|
140
|
+
private pendingIdleFinishAt;
|
|
141
|
+
private statusHistory;
|
|
142
|
+
private traceEntries;
|
|
143
|
+
private traceSeq;
|
|
144
|
+
private traceSessionId;
|
|
145
|
+
constructor(provider: CliProviderModule, runner: CliScriptRunner, transport: CliTransportAccess, callbacks: CliStateEngineCallbacks, timeouts: Required<NonNullable<CliProviderModule['timeouts']>>);
|
|
146
|
+
setStatus(status: CliSessionStatus['status'], trigger?: string): void;
|
|
147
|
+
scheduleSettle(): void;
|
|
148
|
+
/** Called from sendMessage in transport once a turn scope is established. */
|
|
149
|
+
onTurnStarted(turnScope: TurnParseScope): void;
|
|
150
|
+
/** Called when PTY exits */
|
|
151
|
+
onPtyExit(): void;
|
|
152
|
+
/** Called when adapter starts up successfully */
|
|
153
|
+
onSpawnReady(): void;
|
|
154
|
+
resolveModal(buttonIndex: number): void;
|
|
155
|
+
isApprovalRecentlyResolved(): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Called from sendMessage before starting a new turn.
|
|
158
|
+
* Clears stale idle response state when the terminal looks idle and no modal is active.
|
|
159
|
+
*/
|
|
160
|
+
clearStaleIdleResponseGuard(reason: string, snap: CliBufferSnapshot): boolean;
|
|
161
|
+
/**
|
|
162
|
+
* Called from sendMessage before starting a new turn.
|
|
163
|
+
* Clears stale idle response state when the parsed session confirms idle with a final assistant message.
|
|
164
|
+
*/
|
|
165
|
+
clearParsedIdleResponseGuard(reason: string, parsedStatus: any, snap: CliBufferSnapshot): boolean;
|
|
166
|
+
clearAllTimers(): void;
|
|
167
|
+
resetActiveTurnState(): void;
|
|
168
|
+
clearIdleFinishCandidate(reason: string): void;
|
|
169
|
+
/**
|
|
170
|
+
* Poll-driven static-idle confirm (D4). A hosted CLI session (e.g. a fresh
|
|
171
|
+
* antigravity coordinator) whose boot banner drove the FSM into 'generating'
|
|
172
|
+
* can then sit at a STATIC ready prompt emitting no further PTY output. Every
|
|
173
|
+
* output-driven busy→idle re-eval (handleOutput/resolveStartupState/settle)
|
|
174
|
+
* is starved because there is no new output, and the startup-settle loop has
|
|
175
|
+
* hard-stopped past spawnAt+10s — so currentStatus stays frozen at generating
|
|
176
|
+
* and the dashboard disables Send. This is the ONE path that can release that
|
|
177
|
+
* wedge from the read-only status poll.
|
|
178
|
+
*
|
|
179
|
+
* Safety: this must NEVER flip a real generating turn to idle. The gate is
|
|
180
|
+
* done by the caller (getStatus) reusing resolveStartupState's proven
|
|
181
|
+
* predicates: no recent PTY output for a grace window, runDetectStatus of the
|
|
182
|
+
* current screen === 'idle', and no active/parsed modal. Here we add the
|
|
183
|
+
* final structural guard: there must be NO active turn scope. A live user
|
|
184
|
+
* turn always carries a currentTurnScope (set in onTurnStarted), so this only
|
|
185
|
+
* releases the boot-banner wedge and the post-turn static-idle case, both of
|
|
186
|
+
* which have already had their scope nulled. Returns true when it transitioned.
|
|
187
|
+
*/
|
|
188
|
+
confirmPollStaticIdle(reason: string): boolean;
|
|
189
|
+
hasActionableApproval(startupModal?: {
|
|
190
|
+
message: string;
|
|
191
|
+
buttons: string[];
|
|
192
|
+
} | null): boolean;
|
|
193
|
+
getTraceEntries(): CliTraceEntry[];
|
|
194
|
+
getStatusHistory(): {
|
|
195
|
+
status: string;
|
|
196
|
+
at: number;
|
|
197
|
+
trigger?: string;
|
|
198
|
+
}[];
|
|
199
|
+
getTraceSessionId(): string;
|
|
200
|
+
/** Record a trace entry from the transport layer (e.g. output events in debug mode). */
|
|
201
|
+
recordExternalTrace(type: string, payload?: Record<string, any>): void;
|
|
202
|
+
runDetectStatus(snap: CliBufferSnapshot): string | null;
|
|
203
|
+
runParseApproval(snap: CliBufferSnapshot): {
|
|
204
|
+
message: string;
|
|
205
|
+
buttons: string[];
|
|
206
|
+
} | null;
|
|
207
|
+
runParseSession(snap: CliBufferSnapshot): ParsedSession | null;
|
|
208
|
+
evaluateSettled(snap: CliBufferSnapshot): void;
|
|
209
|
+
private applyPendingScriptStatusDebounce;
|
|
210
|
+
private applyHoldGenerating;
|
|
211
|
+
private applyWaitingApproval;
|
|
212
|
+
private applyGenerating;
|
|
213
|
+
private applyError;
|
|
214
|
+
private maybeScheduleProviderErrorRetry;
|
|
215
|
+
private applyIdle;
|
|
216
|
+
/**
|
|
217
|
+
* FALSE-IDLE (Fix 2): should applyIdle suppress the idle/finish for the current
|
|
218
|
+
* turn because we are inside the post-approval resume grace?
|
|
219
|
+
*
|
|
220
|
+
* True only when: (a) the owning instance reports it is an autonomous auto-approving
|
|
221
|
+
* mesh session that resolved a modal within the resume-grace window
|
|
222
|
+
* (isInApprovalResumeGrace callback — the SAME judgment Fix 1 uses), AND (b) the defer
|
|
223
|
+
* for THIS response epoch has not yet exceeded APPROVAL_RESUME_IDLE_DEFER_CAP_MS.
|
|
224
|
+
* The cap guarantees no infinite defer: a turn that genuinely ended right after an
|
|
225
|
+
* approval and stays silent past the cap stops being suppressed and finishes normally.
|
|
226
|
+
* The per-epoch anchor means a fresh turn/response restarts the clock.
|
|
227
|
+
*/
|
|
228
|
+
private shouldDeferIdleForApprovalResume;
|
|
229
|
+
private clearApprovalResumeDefer;
|
|
230
|
+
finishResponse(): void;
|
|
231
|
+
private scheduleIdleFinish;
|
|
232
|
+
private cancelPendingIdleFinish;
|
|
233
|
+
private armApprovalExitTimeout;
|
|
234
|
+
private armIdleFinishCandidate;
|
|
235
|
+
private shouldDeferIdleTimeoutFinish;
|
|
236
|
+
private hasRecentInteractiveActivity;
|
|
237
|
+
private hasMeaningfulResponseBuffer;
|
|
238
|
+
private shouldDeferFinishForTranscript;
|
|
239
|
+
private rescheduleTranscriptFinishCheck;
|
|
240
|
+
private shouldRetryFinishResponse;
|
|
241
|
+
private commitCurrentTranscript;
|
|
242
|
+
private maybeCommitVisibleIdleTranscript;
|
|
243
|
+
private parsedStatusHasFinalAssistantMessage;
|
|
244
|
+
private parsedStatusHasFinalStandardAssistantMessage;
|
|
245
|
+
private recordTrace;
|
|
246
|
+
}
|
|
@@ -13,31 +13,34 @@
|
|
|
13
13
|
* type, name, category: 'cli', binary, spawn, approvalKeys
|
|
14
14
|
* compatibility: [{ ideVersion, scriptDir }] ← versioned scripts
|
|
15
15
|
*/
|
|
16
|
-
import type { CliAdapter } from '../cli-adapter-types.js';
|
|
16
|
+
import type { CliAdapter, CliLaunchInfo } from '../cli-adapter-types.js';
|
|
17
|
+
import type { InteractivePromptResponse } from '../providers/types/interactive-prompt.js';
|
|
17
18
|
import { type PtyRuntimeMetadata, type PtyTransportFactory } from './pty-transport.js';
|
|
18
|
-
import { type CliProviderModule, type CliScripts, type CliSessionStatus } from './provider-cli-shared.js';
|
|
19
|
+
import { type CliProviderModule, type CliScripts, type CliSessionStatus, type CliTraceEntry, type ParsedSession } from './provider-cli-shared.js';
|
|
20
|
+
import { CliStateEngine, type CliBufferSnapshot } from './cli-state-engine.js';
|
|
21
|
+
import { type TurnParseScope } from './provider-cli-parse.js';
|
|
19
22
|
import { type ProviderResolutionMeta } from './provider-cli-config.js';
|
|
20
23
|
export { normalizeCliProviderForRuntime, type CliApprovalInput, type CliChatMessage, type CliProviderModule, type CliScreenLine, type CliScreenSnapshot, type CliScriptInput, type CliScripts, type CliSessionStatus, type CliStatusInput, type CliTraceEntry, } from './provider-cli-shared.js';
|
|
21
24
|
export declare function appendBoundedText(current: string, chunk: string, maxChars: number): string;
|
|
22
25
|
export declare class ProviderCliAdapter implements CliAdapter {
|
|
23
26
|
private extraArgs;
|
|
24
27
|
private extraEnv;
|
|
25
|
-
|
|
28
|
+
cliType: string;
|
|
26
29
|
readonly cliName: string;
|
|
27
30
|
workingDir: string;
|
|
28
31
|
private provider;
|
|
29
32
|
private ptyProcess;
|
|
30
33
|
private transportFactory;
|
|
31
|
-
private currentStatus;
|
|
32
34
|
private onStatusChange;
|
|
35
|
+
private inApprovalResumeGraceProbe;
|
|
36
|
+
readonly engine: CliStateEngine;
|
|
33
37
|
private responseBuffer;
|
|
34
38
|
private recentOutputBuffer;
|
|
35
|
-
private
|
|
36
|
-
private
|
|
37
|
-
private parseErrorMessage;
|
|
39
|
+
private get parseErrorMessage();
|
|
40
|
+
private providerSessionId;
|
|
38
41
|
private responseTimeout;
|
|
39
|
-
private idleTimeout;
|
|
40
42
|
private ready;
|
|
43
|
+
private firstTurnSent;
|
|
41
44
|
private startupBuffer;
|
|
42
45
|
private startupParseGate;
|
|
43
46
|
private startupSettleTimer;
|
|
@@ -55,30 +58,36 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
55
58
|
private lastScreenSnapshot;
|
|
56
59
|
private lastScreenText;
|
|
57
60
|
private lastScreenSnapshotReadAt;
|
|
61
|
+
private staticIdlePollStreak;
|
|
58
62
|
private serverConn;
|
|
59
63
|
private logBuffer;
|
|
60
|
-
private
|
|
61
|
-
private
|
|
62
|
-
private
|
|
63
|
-
private pendingScriptStatus;
|
|
64
|
-
private pendingScriptStatusSince;
|
|
65
|
-
private pendingScriptStatusTimer;
|
|
66
|
-
private settleTimer;
|
|
67
|
-
private settledBuffer;
|
|
68
|
-
private submitPendingUntil;
|
|
69
|
-
private responseSettleIgnoreUntil;
|
|
70
|
-
private responseEpoch;
|
|
64
|
+
private pendingOutboundQueue;
|
|
65
|
+
private pendingOutboundFlushTimer;
|
|
66
|
+
private pendingOutboundFlushInFlight;
|
|
71
67
|
private submitRetryTimer;
|
|
72
|
-
private
|
|
73
|
-
private submitRetryPromptSnippet;
|
|
74
|
-
private idleFinishCandidate;
|
|
75
|
-
private finishRetryTimer;
|
|
76
|
-
private finishRetryCount;
|
|
68
|
+
private ptyWriteChain;
|
|
77
69
|
private resizeSuppressUntil;
|
|
78
|
-
private
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
private readonly runner;
|
|
71
|
+
/** @deprecated use runner.cliScripts for direct script access */
|
|
72
|
+
get cliScripts(): CliScripts;
|
|
73
|
+
/**
|
|
74
|
+
* Recent script invocations (oldest → newest). Exposed via the
|
|
75
|
+
* `get_chat_debug_bundle` daemon command so anyone debugging a
|
|
76
|
+
* stuck-status regression can read what each detectStatus /
|
|
77
|
+
* parseSession call actually saw and returned, instead of having
|
|
78
|
+
* to instrument the daemon.
|
|
79
|
+
*/
|
|
80
|
+
getScriptInvocationTrace(): import("./cli-script-runner.js").CliScriptInvocationTrace[];
|
|
81
|
+
/**
|
|
82
|
+
* Returns the full raw PTY byte stream captured since adapter start.
|
|
83
|
+
* Used by the `record_provider_pty` IPC command to produce fixtures.
|
|
84
|
+
* Bounded by MAX_ACCUMULATED_BUFFER; older bytes may have been dropped.
|
|
85
|
+
*/
|
|
86
|
+
getAccumulatedRawBuffer(): {
|
|
87
|
+
text: string;
|
|
88
|
+
droppedChars: number;
|
|
89
|
+
};
|
|
90
|
+
set cliScripts(scripts: CliScripts);
|
|
82
91
|
private runtimeSettings;
|
|
83
92
|
/** Full accumulated rendered PTY transcript for parser/readback use */
|
|
84
93
|
private accumulatedBuffer;
|
|
@@ -98,16 +107,10 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
98
107
|
* Hermes turn (tool calls + reasoning + final bubble) without the
|
|
99
108
|
* rolling window pushing the turn's ╭─ opening line out of view. */
|
|
100
109
|
private static readonly MAX_ACCUMULATED_BUFFER;
|
|
101
|
-
private currentTurnScope;
|
|
102
|
-
private traceEntries;
|
|
103
|
-
private traceSeq;
|
|
104
|
-
private traceSessionId;
|
|
105
110
|
private parsedStatusCache;
|
|
106
111
|
private static readonly SCREEN_SNAPSHOT_MIN_INTERVAL_MS;
|
|
107
|
-
private static readonly
|
|
112
|
+
private static readonly STATIC_IDLE_POLL_CONFIRM_COUNT;
|
|
108
113
|
private readonly providerResolutionMeta;
|
|
109
|
-
private static readonly FINISH_RETRY_DELAY_MS;
|
|
110
|
-
private static readonly MAX_FINISH_RETRIES;
|
|
111
114
|
private getBufferState;
|
|
112
115
|
private recordBoundedAppendDrop;
|
|
113
116
|
private readTerminalScreenText;
|
|
@@ -120,18 +123,13 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
120
123
|
private shouldUseFullProviderTranscriptContext;
|
|
121
124
|
private getIdleFinishConfirmMs;
|
|
122
125
|
private getStatusActivityHoldMs;
|
|
123
|
-
private
|
|
124
|
-
private clearIdleFinishCandidate;
|
|
125
|
-
private armIdleFinishCandidate;
|
|
126
|
-
private recordTrace;
|
|
127
|
-
private resetTraceSession;
|
|
126
|
+
private isAutonomousMeshSession;
|
|
128
127
|
private readonly timeouts;
|
|
129
128
|
private readonly approvalKeys;
|
|
130
129
|
private readonly sendDelayMs;
|
|
131
130
|
private readonly sendKey;
|
|
132
131
|
private readonly submitStrategy;
|
|
133
132
|
private readonly requirePromptEchoBeforeSubmit;
|
|
134
|
-
private static readonly SCRIPT_STATUS_DEBOUNCE_MS;
|
|
135
133
|
constructor(provider: CliProviderModule, workingDir: string, extraArgs?: string[], extraEnv?: Record<string, string>, transportFactory?: PtyTransportFactory);
|
|
136
134
|
/** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
|
|
137
135
|
setCliScripts(scripts: CliScripts): void;
|
|
@@ -140,35 +138,22 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
140
138
|
updateRuntimeSettings(settings: Record<string, any>): void;
|
|
141
139
|
setServerConn(serverConn: any): void;
|
|
142
140
|
setOnStatusChange(callback: () => void): void;
|
|
141
|
+
setInApprovalResumeGraceProbe(probe: () => boolean): void;
|
|
143
142
|
setOnPtyData(callback: (data: string) => void): void;
|
|
144
143
|
private flushPendingOutputParse;
|
|
145
144
|
spawn(): Promise<void>;
|
|
146
145
|
private handleOutput;
|
|
147
146
|
private resolveStartupState;
|
|
148
147
|
private scheduleStartupSettleCheck;
|
|
149
|
-
private scheduleSettle;
|
|
150
|
-
private armApprovalExitTimeout;
|
|
151
|
-
private shouldRetryFinishResponse;
|
|
152
|
-
private hasRecentInteractiveActivity;
|
|
153
|
-
private shouldDeferIdleTimeoutFinish;
|
|
154
148
|
private waitForInteractivePrompt;
|
|
155
149
|
private clearAllTimers;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
private
|
|
163
|
-
private applyIdle;
|
|
164
|
-
private finishResponse;
|
|
165
|
-
private maybeCommitVisibleIdleTranscript;
|
|
166
|
-
private commitCurrentTranscript;
|
|
167
|
-
private invokeCliScript;
|
|
168
|
-
private runParseSession;
|
|
169
|
-
private runDetectStatus;
|
|
170
|
-
private runParseApproval;
|
|
171
|
-
private hasActionableApproval;
|
|
150
|
+
runParseSession(): ParsedSession | null;
|
|
151
|
+
runDetectStatus(text: string): string | null;
|
|
152
|
+
runParseApproval(tail: string): {
|
|
153
|
+
message: string;
|
|
154
|
+
buttons: string[];
|
|
155
|
+
} | null;
|
|
156
|
+
private applyParsedSessionMetadata;
|
|
172
157
|
private projectEffectiveStatus;
|
|
173
158
|
getStatus(options?: {
|
|
174
159
|
allowParse?: boolean;
|
|
@@ -187,21 +172,54 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
187
172
|
* Uses resolveAction script if available, otherwise falls back to standard text.
|
|
188
173
|
*/
|
|
189
174
|
resolveAction(data: any): Promise<void>;
|
|
175
|
+
setInteractivePromptResponse(_response: InteractivePromptResponse): Promise<void>;
|
|
190
176
|
private isSubmitStuck;
|
|
177
|
+
private hasMeaningfulResponseBufferLocal;
|
|
178
|
+
/** Serialize `data` onto the per-session PTY write chain. Returns a promise
|
|
179
|
+
* that resolves (or rejects) with THIS write's own outcome, so callers keep
|
|
180
|
+
* their existing "await my write completion" semantics. The underlying chain
|
|
181
|
+
* link swallows its own error before releasing the next write, so a failed
|
|
182
|
+
* write surfaces to its caller but never wedges subsequent writes behind a
|
|
183
|
+
* permanently-rejected tail (FIFO order preserved). */
|
|
191
184
|
private writeToPty;
|
|
185
|
+
private doWriteToPty;
|
|
186
|
+
/** Write `data` to the PTY in bounded, surrogate-safe chunks with a short
|
|
187
|
+
* inter-chunk gap (win32 paced write). Awaits each chunk's write and the gap
|
|
188
|
+
* so the returned promise resolves only after the FINAL chunk (carrying any
|
|
189
|
+
* trailing submit key) has been written. */
|
|
190
|
+
private writeWin32Chunked;
|
|
192
191
|
private resetPendingSendState;
|
|
193
192
|
private commitSendUserTurn;
|
|
194
193
|
private armResponseTimeout;
|
|
195
194
|
private writeSubmitKeyForRetry;
|
|
195
|
+
private writeStuckRetry;
|
|
196
196
|
private retrySubmitIfStuck;
|
|
197
197
|
private retryImmediateSubmitIfStuck;
|
|
198
198
|
private submitSendKey;
|
|
199
199
|
private submitImmediatePrompt;
|
|
200
200
|
private waitForEchoAndSubmit;
|
|
201
|
-
sendMessage(text: string
|
|
201
|
+
sendMessage(text: string, options?: {
|
|
202
|
+
force?: boolean;
|
|
203
|
+
meshTaskId?: string;
|
|
204
|
+
}): Promise<void>;
|
|
205
|
+
forceSendMessage(text: string, meshTaskId?: string): Promise<void>;
|
|
206
|
+
private waitForForceSubmitSettle;
|
|
207
|
+
private enqueuePendingOutboundMessage;
|
|
208
|
+
private shouldQueuePendingOutboundMessage;
|
|
209
|
+
private schedulePendingOutboundFlush;
|
|
210
|
+
private flushPendingOutboundQueue;
|
|
211
|
+
private sendMessageNow;
|
|
202
212
|
getPartialResponse(): string;
|
|
203
213
|
getDebugSnapshot(): Record<string, unknown>;
|
|
204
214
|
getRuntimeMetadata(): PtyRuntimeMetadata | null;
|
|
215
|
+
/**
|
|
216
|
+
* Launch metadata for the dashboard Session info panel. Re-derives the spawn plan
|
|
217
|
+
* (pure — same inputs the live PTY was spawned with) so the dashboard sees the
|
|
218
|
+
* resolved binary, full arg vector, and cwd without us having to persist it.
|
|
219
|
+
* extraEnv values are intentionally dropped (keys only) so secrets passed at
|
|
220
|
+
* launch time never reach the dashboard.
|
|
221
|
+
*/
|
|
222
|
+
getLaunchInfo(): CliLaunchInfo;
|
|
205
223
|
updateRuntimeMeta(meta: Record<string, unknown>, replace?: boolean): void;
|
|
206
224
|
cancel(): void;
|
|
207
225
|
saveAndStop(): Promise<void>;
|
|
@@ -211,8 +229,65 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
211
229
|
clearHistory(): void;
|
|
212
230
|
isProcessing(): boolean;
|
|
213
231
|
isReady(): boolean;
|
|
214
|
-
|
|
232
|
+
get currentStatus(): CliSessionStatus['status'];
|
|
233
|
+
set currentStatus(v: CliSessionStatus['status']);
|
|
234
|
+
get isWaitingForResponse(): boolean;
|
|
235
|
+
set isWaitingForResponse(v: boolean);
|
|
236
|
+
get activeModal(): {
|
|
237
|
+
message: string;
|
|
238
|
+
buttons: string[];
|
|
239
|
+
} | null;
|
|
240
|
+
set activeModal(v: {
|
|
241
|
+
message: string;
|
|
242
|
+
buttons: string[];
|
|
243
|
+
} | null);
|
|
244
|
+
get currentTurnScope(): TurnParseScope | null;
|
|
245
|
+
set currentTurnScope(v: TurnParseScope | null);
|
|
246
|
+
get currentTurnTaskId(): string | null;
|
|
247
|
+
get currentTurnStartedAt(): number;
|
|
248
|
+
get responseEpoch(): number;
|
|
249
|
+
set responseEpoch(v: number);
|
|
250
|
+
get submitRetryUsed(): boolean;
|
|
251
|
+
set submitRetryUsed(v: boolean);
|
|
252
|
+
get submitRetryPromptSnippet(): string;
|
|
253
|
+
set submitRetryPromptSnippet(v: string);
|
|
254
|
+
get responseSettleIgnoreUntil(): number;
|
|
255
|
+
set responseSettleIgnoreUntil(v: number);
|
|
256
|
+
get submitPendingUntil(): number;
|
|
257
|
+
set submitPendingUntil(v: number);
|
|
258
|
+
get lastApprovalResolvedAt(): number;
|
|
259
|
+
set lastApprovalResolvedAt(v: number);
|
|
260
|
+
get providerErrorMessage(): string | null;
|
|
261
|
+
get providerErrorReason(): string | null;
|
|
262
|
+
get pendingScriptStatus(): 'generating' | 'waiting_approval' | null;
|
|
263
|
+
get pendingScriptStatusSince(): number;
|
|
264
|
+
get finishRetryCount(): number;
|
|
265
|
+
set finishRetryCount(v: number);
|
|
266
|
+
get traceSessionId(): string;
|
|
267
|
+
get traceEntries(): CliTraceEntry[];
|
|
268
|
+
get statusHistory(): {
|
|
269
|
+
status: string;
|
|
270
|
+
at: number;
|
|
271
|
+
trigger?: string;
|
|
272
|
+
}[];
|
|
273
|
+
get traceSeq(): number;
|
|
274
|
+
/** Expose engine's evaluateSettled for test access */
|
|
275
|
+
evaluateSettled(): void;
|
|
276
|
+
/** Expose engine's scheduleSettle for test access */
|
|
277
|
+
scheduleSettle(): void;
|
|
278
|
+
/** Expose engine's clearIdleFinishCandidate for test access */
|
|
279
|
+
clearIdleFinishCandidate(reason: string): void;
|
|
280
|
+
/** Expose engine's finishResponse for test access */
|
|
281
|
+
finishResponse(): void;
|
|
282
|
+
/** Returns a point-in-time snapshot of all buffer/screen state for external consumers (e.g. CliStateEngine). */
|
|
283
|
+
getSnapshot(): CliBufferSnapshot;
|
|
284
|
+
isAlive(): boolean;
|
|
285
|
+
flushOutboundQueue(): void;
|
|
286
|
+
writeRaw(data: string | Buffer): Promise<void>;
|
|
215
287
|
resolveModal(buttonIndex: number): void;
|
|
288
|
+
getApprovalKeyForIndex(buttonIndex: number): string | undefined;
|
|
289
|
+
/** Returns true if an approval was resolved within the adapter's cooldown window. */
|
|
290
|
+
isApprovalRecentlyResolved(): boolean;
|
|
216
291
|
resize(cols: number, rows: number): void;
|
|
217
292
|
private getParsedDebugState;
|
|
218
293
|
getDebugState(): Record<string, any>;
|
|
@@ -4,6 +4,7 @@ export interface TurnParseScope {
|
|
|
4
4
|
startedAt: number;
|
|
5
5
|
bufferStart: number;
|
|
6
6
|
rawBufferStart: number;
|
|
7
|
+
taskId?: string;
|
|
7
8
|
}
|
|
8
9
|
export declare function normalizeCliParsedMessages(parsedMessages: any[], _options: {
|
|
9
10
|
scope?: TurnParseScope | null;
|
|
@@ -15,11 +16,15 @@ export declare function buildCliParseInput(options: {
|
|
|
15
16
|
accumulatedRawBuffer: string;
|
|
16
17
|
recentOutputBuffer: string;
|
|
17
18
|
terminalScreenText: string;
|
|
19
|
+
workingDir?: string;
|
|
20
|
+
providerSessionId?: string;
|
|
21
|
+
historySessionId?: string;
|
|
18
22
|
baseMessages: CliChatMessage[];
|
|
19
23
|
partialResponse: string;
|
|
20
24
|
isWaitingForResponse?: boolean;
|
|
21
25
|
scope?: TurnParseScope | null;
|
|
22
26
|
runtimeSettings: Record<string, any>;
|
|
27
|
+
spawnAt?: number;
|
|
23
28
|
}): CliScriptInput;
|
|
24
29
|
export declare function summarizeCliTraceText(text: string, max?: number): string;
|
|
25
30
|
export declare function summarizeCliTraceMessages(messages: CliChatMessage[], limit?: number): {
|
|
@@ -17,6 +17,40 @@ export declare function resolveCliSpawnPlan(options: {
|
|
|
17
17
|
extraArgs: string[];
|
|
18
18
|
extraEnv?: Record<string, string>;
|
|
19
19
|
}): CliSpawnPlan;
|
|
20
|
+
/**
|
|
21
|
+
* Cols/rows for a PTY spawn. Defaults to the session-host terminal size; the
|
|
22
|
+
* spec driver may override per-instance.
|
|
23
|
+
*/
|
|
24
|
+
export interface CliSpawnGeometry {
|
|
25
|
+
cols?: number;
|
|
26
|
+
rows?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Core spawn-plan resolution from already-flattened spawn parts — the single
|
|
30
|
+
* source of truth for binary resolution (findBinary: PATH + npm-global / Node
|
|
31
|
+
* dir fallback), `{{workingDir}}` token substitution, shell wrapping
|
|
32
|
+
* (script-shims / non-absolute / non-native binaries), and env sanitization +
|
|
33
|
+
* TERMINAL_CWD. Both the legacy provider-module path (resolveCliSpawnPlan) and
|
|
34
|
+
* the spec/FSM path (FsmDriver.buildAdapterOpts) feed into this so the two
|
|
35
|
+
* spawn paths can never diverge.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveCliSpawnPlanFromParts(options: {
|
|
38
|
+
/** Raw command from the spec/provider (`binary` / `spawn.command`), or an
|
|
39
|
+
* operator-configured executable path override. */
|
|
40
|
+
command: string;
|
|
41
|
+
/** Base launch args declared by the spec/provider (`spawn_args` /
|
|
42
|
+
* `spawn.args`). */
|
|
43
|
+
baseArgs?: string[];
|
|
44
|
+
/** When true, always wrap the launch in a login shell. */
|
|
45
|
+
shell?: boolean;
|
|
46
|
+
/** Base env declared by the spec/provider (`env` / `spawn.env`). */
|
|
47
|
+
baseEnv?: Record<string, string>;
|
|
48
|
+
workingDir: string;
|
|
49
|
+
/** Per-launch extra args (e.g. resume session id) appended after baseArgs. */
|
|
50
|
+
extraArgs?: string[];
|
|
51
|
+
extraEnv?: Record<string, string>;
|
|
52
|
+
geometry?: CliSpawnGeometry;
|
|
53
|
+
}): CliSpawnPlan;
|
|
20
54
|
export declare function buildCliLoginShellRetry(plan: Pick<CliSpawnPlan, 'binaryPath' | 'allArgs'>): {
|
|
21
55
|
shellCmd: string;
|
|
22
56
|
shellArgs: string[];
|