@adhdev/daemon-core 0.9.82-rc.43 → 0.9.82-rc.430
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 +200 -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 +7 -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 +15 -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 +60 -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 +29 -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 +142 -0
- package/dist/commands/mesh-coordinator.d.ts +85 -1
- package/dist/commands/router.d.ts +276 -2
- package/dist/commands/upgrade-helper.d.ts +41 -1
- package/dist/config/chat-history.d.ts +9 -0
- package/dist/config/config.d.ts +5 -0
- package/dist/config/mesh-config.d.ts +100 -1
- package/dist/config/mesh-json-config.d.ts +199 -0
- package/dist/config/repo-settings.d.ts +77 -0
- package/dist/daemon/dev-server.d.ts +0 -2
- 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 +11 -1
- 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 +64 -14
- package/dist/index.js +49391 -19228
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48574 -18570
- 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/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 +164 -0
- package/dist/mesh/coordinator-prompt.d.ts +89 -0
- package/dist/mesh/coordinator-registry.d.ts +59 -0
- package/dist/mesh/mesh-active-work.d.ts +174 -0
- package/dist/mesh/mesh-clone-grace.d.ts +8 -0
- package/dist/mesh/mesh-coordinator-config.d.ts +21 -0
- package/dist/mesh/mesh-delivery-policy.d.ts +131 -0
- package/dist/mesh/mesh-event-classify.d.ts +5 -0
- package/dist/mesh/mesh-event-forwarding.d.ts +41 -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 +69 -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 +9 -0
- package/dist/mesh/mesh-init.d.ts +86 -0
- package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -4
- package/dist/mesh/mesh-ledger.d.ts +77 -1
- package/dist/mesh/mesh-magi-status.d.ts +63 -0
- package/dist/mesh/mesh-missions.d.ts +189 -0
- package/dist/mesh/mesh-node-identity.d.ts +289 -0
- package/dist/mesh/mesh-queue-assignment.d.ts +113 -0
- package/dist/mesh/mesh-reconcile-loop.d.ts +65 -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-review-inbox.d.ts +90 -0
- package/dist/mesh/mesh-routing.d.ts +70 -0
- package/dist/mesh/mesh-runtime-store.d.ts +450 -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 +290 -5
- package/dist/mesh/preview-freshness.d.ts +18 -0
- package/dist/mesh/refine-config.d.ts +216 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +145 -0
- package/dist/providers/acp-provider-instance.d.ts +5 -0
- package/dist/providers/approval-utils.d.ts +20 -0
- package/dist/providers/chat-message-normalization.d.ts +31 -1
- package/dist/providers/cli-provider-instance.d.ts +221 -3
- package/dist/providers/contracts.d.ts +139 -6
- package/dist/providers/external-sources.d.ts +71 -0
- package/dist/providers/manual-attendance.d.ts +63 -0
- package/dist/providers/native-history/antigravity-cli-transcript.d.ts +100 -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 +27 -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 +23 -1
- package/dist/providers/provider-loader.d.ts +26 -4
- 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 +91 -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 +422 -0
- package/dist/providers/spec/fsm-evaluator.d.ts +76 -0
- package/dist/providers/spec/fsm-loader.d.ts +14 -0
- package/dist/providers/spec/fsm-types.d.ts +174 -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 +222 -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 +501 -13
- package/dist/runtime-defaults.d.ts +2 -0
- package/dist/sessions/registry.d.ts +6 -0
- package/dist/shared-types-extra.d.ts +2 -4
- package/dist/shared-types.d.ts +59 -2
- 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 +7 -3
- package/src/agent-stream/poller.ts +2 -3
- package/src/agent-stream/provider-adapter.ts +1 -1
- package/src/boot/daemon-lifecycle.ts +63 -12
- 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 +1246 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +914 -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/WINDOWS-UPGRADE-LOCK-FAILURE.md +198 -0
- package/src/commands/chat-commands-debug-bundle.ts +398 -0
- package/src/commands/chat-commands-read.ts +2327 -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.ts +544 -26
- package/src/commands/handler.ts +841 -2
- package/src/commands/high-family/index.ts +28 -0
- package/src/commands/high-family/mesh-coordinator-launch.ts +678 -0
- package/src/commands/high-family/mesh-events.ts +80 -0
- package/src/commands/high-family/mesh-status.ts +710 -0
- package/src/commands/high-family/types.ts +76 -0
- package/src/commands/low-family/coordinator-prompt.ts +72 -0
- package/src/commands/low-family/daemon-lifecycle.ts +107 -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 +274 -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 +238 -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 +1066 -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 +143 -0
- package/src/commands/mesh-coordinator.ts +334 -124
- package/src/commands/router.ts +2711 -3254
- package/src/commands/stream-commands.ts +8 -0
- package/src/commands/upgrade-helper.ts +310 -45
- package/src/config/chat-history.ts +483 -24
- package/src/config/config.ts +12 -0
- package/src/config/mesh-config.ts +495 -22
- package/src/config/mesh-json-config.ts +376 -0
- package/src/config/recent-activity.ts +8 -2
- package/src/config/repo-settings.ts +111 -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 +28 -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 +59 -15
- 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 +194 -12
- 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/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 +338 -0
- package/src/mesh/coordinator-prompt.ts +381 -33
- package/src/mesh/coordinator-registry.ts +121 -0
- package/src/mesh/mesh-active-work.ts +645 -0
- package/src/mesh/mesh-clone-grace.ts +68 -0
- package/src/mesh/mesh-coordinator-config.ts +97 -0
- package/src/mesh/mesh-delivery-policy.ts +315 -0
- package/src/mesh/mesh-event-classify.ts +51 -0
- package/src/mesh/mesh-event-forwarding.ts +1888 -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 +656 -0
- package/src/mesh/mesh-events-stale.ts +389 -0
- package/src/mesh/mesh-events-utils.ts +443 -0
- package/src/mesh/mesh-events.ts +33 -1035
- package/src/mesh/mesh-fast-forward.ts +843 -0
- package/src/mesh/mesh-host-ownership.ts +73 -0
- package/src/mesh/mesh-init.ts +260 -0
- package/src/mesh/mesh-ledger-reconciliation.ts +12 -7
- package/src/mesh/mesh-ledger.ts +656 -102
- package/src/mesh/mesh-magi-status.ts +223 -0
- package/src/mesh/mesh-missions.ts +449 -0
- package/src/mesh/mesh-node-identity.ts +1887 -0
- package/src/mesh/mesh-queue-assignment.ts +1918 -0
- package/src/mesh/mesh-reconcile-loop.ts +1780 -0
- package/src/mesh/mesh-refine-batch.ts +205 -0
- package/src/mesh/mesh-refine-gates.ts +1673 -0
- package/src/mesh/mesh-refine-status.ts +231 -0
- package/src/mesh/mesh-review-inbox.ts +307 -0
- package/src/mesh/mesh-routing.ts +291 -0
- package/src/mesh/mesh-runtime-store.ts +1853 -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 +1243 -141
- package/src/mesh/preview-freshness.ts +118 -0
- package/src/mesh/refine-config.ts +423 -0
- package/src/mesh/worktree-bootstrap-config.ts +450 -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 +57 -5
- package/src/providers/chat-message-normalization.ts +92 -4
- package/src/providers/cli-provider-instance.ts +1933 -104
- package/src/providers/contracts.d.ts +55 -0
- package/src/providers/contracts.ts +150 -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 +85 -0
- package/src/providers/native-history/antigravity-cli-transcript.ts +643 -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 +339 -0
- package/src/providers/native-history/hermes-cli-transcript.ts +230 -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 +19 -1
- package/src/providers/provider-loader.ts +668 -50
- 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 +250 -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 +504 -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 +235 -0
- package/src/providers/spec/cli-adapter.ts +1056 -0
- package/src/providers/spec/evaluator.ts +407 -0
- package/src/providers/spec/fsm-driver.ts +1410 -0
- package/src/providers/spec/fsm-evaluator.ts +272 -0
- package/src/providers/spec/fsm-loader.ts +120 -0
- package/src/providers/spec/fsm-types.ts +273 -0
- package/src/providers/spec/native-history-executor.ts +1128 -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 +262 -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 +740 -14
- package/src/runtime-defaults.ts +39 -0
- package/src/sessions/registry.ts +6 -0
- package/src/shared-types-extra.ts +2 -4
- package/src/shared-types.d.ts +8 -0
- package/src/shared-types.ts +64 -1
- package/src/status/builders.ts +26 -6
- 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,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pre_launch_trust — generic, declarative "trust this folder before spawn"
|
|
3
|
+
* step for spec-backed CLI providers.
|
|
4
|
+
*
|
|
5
|
+
* Some agent CLIs (the canonical case is antigravity's `agy`) gate the first
|
|
6
|
+
* run in any new folder behind an interactive "Do you trust the files in this
|
|
7
|
+
* folder?" prompt. Under the v4 FSM spec path the daemon spawns the binary
|
|
8
|
+
* directly in the worktree (`cwd = workingDir`), so every fresh worktree —
|
|
9
|
+
* every delegated mesh task running in its own clone — hits that prompt and
|
|
10
|
+
* stalls until something clicks through it. (The legacy bash-wrapper symlink
|
|
11
|
+
* trick in provider.v1.json's `spawn` block is not used by SpecCliAdapter.)
|
|
12
|
+
*
|
|
13
|
+
* These CLIs persist their trusted folders in a JSON settings file as a string
|
|
14
|
+
* array. If we add the workspace path to that array *before* spawning, the
|
|
15
|
+
* prompt never appears. That is the most robust fix: the agent runs trusted
|
|
16
|
+
* from the first frame instead of relying on the FSM to detect and auto-click
|
|
17
|
+
* a modal whose wording or position could drift.
|
|
18
|
+
*
|
|
19
|
+
* The mechanism is intentionally data-driven and CLI-agnostic. A spec declares
|
|
20
|
+
* the settings file and the array key; the engine does the rest. CLIs that do
|
|
21
|
+
* not have a folder-trust gate simply omit `pre_launch_trust` and this code
|
|
22
|
+
* never runs for them — so other providers (claude/codex/hermes) are untouched.
|
|
23
|
+
*/
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
import * as fs from 'node:fs';
|
|
27
|
+
import * as os from 'node:os';
|
|
28
|
+
import * as path from 'node:path';
|
|
29
|
+
import type { PreLaunchTrust } from './fsm-types.js';
|
|
30
|
+
import { LOG } from '../../logging/logger.js';
|
|
31
|
+
|
|
32
|
+
/** Expand a leading `~` to the user's home directory. */
|
|
33
|
+
function expandHome(p: string): string {
|
|
34
|
+
if (p === '~') return os.homedir();
|
|
35
|
+
if (p.startsWith('~/')) return path.join(os.homedir(), p.slice(2));
|
|
36
|
+
return p;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the canonical, real (symlink-followed) absolute form of the
|
|
41
|
+
* workspace path. Trust files store realpaths, and matching has to be exact, so
|
|
42
|
+
* we normalise the same way the CLI does. Falls back to the raw path if the
|
|
43
|
+
* directory can't be stat'd (e.g. it does not exist yet).
|
|
44
|
+
*/
|
|
45
|
+
function realWorkspacePath(workingDir: string): string {
|
|
46
|
+
try {
|
|
47
|
+
return fs.realpathSync(workingDir);
|
|
48
|
+
} catch {
|
|
49
|
+
return path.resolve(workingDir);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Idempotently add `workingDir` (realpath) to the trusted-folders array named
|
|
55
|
+
* by `trust.key` inside the JSON settings file at `trust.settings_path`.
|
|
56
|
+
*
|
|
57
|
+
* - Creates the file (and parent dir) if missing.
|
|
58
|
+
* - Preserves all other settings; only the trust array is touched.
|
|
59
|
+
* - No-ops if the path is already present.
|
|
60
|
+
* - Best-effort: any failure is logged and swallowed. A failed pre-trust must
|
|
61
|
+
* not block the launch — the worst case is the old behavior (the FSM still
|
|
62
|
+
* detects the trust modal as an approval state), not a crash.
|
|
63
|
+
*
|
|
64
|
+
* Returns the path that was added (realpath), or null if nothing changed /
|
|
65
|
+
* an error occurred — purely so callers/tests can assert the effect.
|
|
66
|
+
*/
|
|
67
|
+
export function applyPreLaunchTrust(trust: PreLaunchTrust, workingDir: string): string | null {
|
|
68
|
+
const settingsPath = expandHome(trust.settings_path);
|
|
69
|
+
const key = trust.key;
|
|
70
|
+
const real = realWorkspacePath(workingDir);
|
|
71
|
+
try {
|
|
72
|
+
let parsed: Record<string, unknown> = {};
|
|
73
|
+
if (fs.existsSync(settingsPath)) {
|
|
74
|
+
const text = fs.readFileSync(settingsPath, 'utf8');
|
|
75
|
+
if (text.trim().length > 0) {
|
|
76
|
+
const json = JSON.parse(text);
|
|
77
|
+
if (json && typeof json === 'object' && !Array.isArray(json)) {
|
|
78
|
+
parsed = json as Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const existing = parsed[key];
|
|
84
|
+
const list: string[] = Array.isArray(existing)
|
|
85
|
+
? existing.filter((v): v is string => typeof v === 'string')
|
|
86
|
+
: [];
|
|
87
|
+
|
|
88
|
+
if (list.includes(real)) {
|
|
89
|
+
LOG.debug('pre-launch-trust', `[${trust.settings_path}] ${real} already trusted — no change`);
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
list.push(real);
|
|
94
|
+
parsed[key] = list;
|
|
95
|
+
|
|
96
|
+
fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
|
|
97
|
+
fs.writeFileSync(settingsPath, `${JSON.stringify(parsed, null, 2)}\n`, 'utf8');
|
|
98
|
+
LOG.info('pre-launch-trust', `pre-trusted workspace in ${trust.settings_path} (key="${key}")`);
|
|
99
|
+
return real;
|
|
100
|
+
} catch (err) {
|
|
101
|
+
LOG.warn('pre-launch-trust', `failed to pre-trust workspace in ${trust.settings_path}: ${(err as Error).message}`);
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routing — given a CLI provider definition, decide whether to drive
|
|
3
|
+
* it via the legacy ProviderCliAdapter (scripts/v1/*.js parsers +
|
|
4
|
+
* cli-state-engine) or via SpecCliAdapter (single spec.json +
|
|
5
|
+
* SpecDriver). The gate is the presence of spec.json in the resolved
|
|
6
|
+
* provider directory.
|
|
7
|
+
*
|
|
8
|
+
* This is the only place in the daemon that knows which path a given
|
|
9
|
+
* provider takes. Providers can be migrated one at a time by adding
|
|
10
|
+
* a spec.json next to their scripts/v1/, then deleting scripts/v1/.
|
|
11
|
+
*/
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
import * as fs from 'node:fs';
|
|
15
|
+
import * as path from 'node:path';
|
|
16
|
+
import { ProviderCliAdapter } from '../../cli-adapters/provider-cli-adapter.js';
|
|
17
|
+
import type { CliProviderModule } from '../../cli-adapters/provider-cli-adapter.js';
|
|
18
|
+
import type { PtyTransportFactory } from '../../cli-adapters/pty-transport.js';
|
|
19
|
+
import type { CliAdapter } from '../../cli-adapter-types.js';
|
|
20
|
+
import { SpecCliAdapter } from './cli-adapter.js';
|
|
21
|
+
import { LOG } from '../../logging/logger.js';
|
|
22
|
+
|
|
23
|
+
export function createCliAdapter(
|
|
24
|
+
provider: CliProviderModule,
|
|
25
|
+
workingDir: string,
|
|
26
|
+
cliArgs: string[],
|
|
27
|
+
extraEnv: Record<string, string>,
|
|
28
|
+
transportFactory?: PtyTransportFactory,
|
|
29
|
+
): CliAdapter {
|
|
30
|
+
// Prefer the path provider-loader already resolved (it walks the
|
|
31
|
+
// compatibility[i].spec → specs/default.json → spec.json chain).
|
|
32
|
+
// Fall back to the legacy spec.json-in-provider-dir lookup if the
|
|
33
|
+
// loader didn't attach one — keeps out-of-tree providers that still
|
|
34
|
+
// use the original layout working.
|
|
35
|
+
const resolvedSpecPath = (provider as unknown as { _resolvedSpecPath?: string })._resolvedSpecPath;
|
|
36
|
+
const dir = (provider as unknown as { _resolvedProviderDir?: string })._resolvedProviderDir;
|
|
37
|
+
let specPath: string | undefined = resolvedSpecPath && fs.existsSync(resolvedSpecPath) ? resolvedSpecPath : undefined;
|
|
38
|
+
if (!specPath && dir) {
|
|
39
|
+
const legacy = path.join(dir, 'spec.json');
|
|
40
|
+
if (fs.existsSync(legacy)) specPath = legacy;
|
|
41
|
+
}
|
|
42
|
+
if (specPath) {
|
|
43
|
+
try {
|
|
44
|
+
LOG.info('spec-route', `[${provider.type}] routing through SpecCliAdapter (${path.relative(dir || '', specPath) || specPath})`);
|
|
45
|
+
return new SpecCliAdapter(specPath, workingDir, cliArgs, extraEnv, transportFactory);
|
|
46
|
+
} catch (err) {
|
|
47
|
+
LOG.warn('spec-route', `[${provider.type}] spec invalid, falling back to ProviderCliAdapter: ${(err as Error).message}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return new ProviderCliAdapter(provider, workingDir, cliArgs, extraEnv, transportFactory) as unknown as CliAdapter;
|
|
51
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the adhdev:cli/spec@4 FSM spec system.
|
|
3
|
+
*
|
|
4
|
+
* These are the building blocks reused by fsm-types.ts, evaluator.ts, and
|
|
5
|
+
* the rest of the spec stack. v3/v1 types have been removed — all providers
|
|
6
|
+
* are on v4.
|
|
7
|
+
*/
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
11
|
+
// Shared / layout types
|
|
12
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
export type Size = number | string;
|
|
15
|
+
|
|
16
|
+
export interface SectionPattern {
|
|
17
|
+
section?: string;
|
|
18
|
+
pattern: string;
|
|
19
|
+
flags?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Inline wait_for shape used by open_picker control actions. */
|
|
23
|
+
export interface WaitForCondition {
|
|
24
|
+
section?: string;
|
|
25
|
+
regex?: string;
|
|
26
|
+
flags?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type ControlAction =
|
|
30
|
+
| { type: 'send_keys'; keys: string }
|
|
31
|
+
| {
|
|
32
|
+
type: 'open_picker';
|
|
33
|
+
trigger_keys: string;
|
|
34
|
+
wait_for: WaitForCondition;
|
|
35
|
+
extract_choices: SectionPattern;
|
|
36
|
+
submit_key: string;
|
|
37
|
+
/**
|
|
38
|
+
* How a parsed choice is committed once the picker is open.
|
|
39
|
+
* 'index' (default) — type the on-screen number then `submit_key`
|
|
40
|
+
* (`{index}\r`). Correct for CLIs whose picker is number-selectable
|
|
41
|
+
* (codex-cli, hermes-cli).
|
|
42
|
+
* 'arrow_keys' — the picker is a cursor list that ignores number keys
|
|
43
|
+
* (claude-cli /model): move the cursor from its current row to the
|
|
44
|
+
* target row with up/down arrows, then confirm with the `submit_key`
|
|
45
|
+
* tail (the `\r` left after stripping `{index}`). Requires the
|
|
46
|
+
* extracted choices to flag the current cursor row.
|
|
47
|
+
*/
|
|
48
|
+
select_mode?: 'index' | 'arrow_keys';
|
|
49
|
+
/** Arrow byte sequences for `select_mode: 'arrow_keys'`. Defaults to
|
|
50
|
+
* ANSI cursor up/down (`[A` / `[B`) when omitted. */
|
|
51
|
+
cursor_keys?: { up: string; down: string };
|
|
52
|
+
}
|
|
53
|
+
| {
|
|
54
|
+
type: 'attach_image';
|
|
55
|
+
method: 'tempfile_then_keys';
|
|
56
|
+
keys_template: string;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export interface Control {
|
|
60
|
+
id: string;
|
|
61
|
+
label: string;
|
|
62
|
+
visible_when_state?: string[];
|
|
63
|
+
action: ControlAction;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface NotificationRule {
|
|
67
|
+
id: string;
|
|
68
|
+
when_state: string;
|
|
69
|
+
title: string;
|
|
70
|
+
body?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface DelegateTrigger {
|
|
74
|
+
id: string;
|
|
75
|
+
when_state: string;
|
|
76
|
+
after_duration_ms?: number;
|
|
77
|
+
task_template: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface NativeHistoryConfig {
|
|
81
|
+
reader?: 'claude-cli' | 'codex-cli' | 'antigravity-cli' | 'hermes-cli';
|
|
82
|
+
source?: NativeHistorySource;
|
|
83
|
+
override_path?: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type NativeHistorySource =
|
|
87
|
+
| NativeHistoryJsonlSource
|
|
88
|
+
| NativeHistorySqliteSource;
|
|
89
|
+
|
|
90
|
+
export interface NativeHistoryJsonlSource {
|
|
91
|
+
kind: 'jsonl';
|
|
92
|
+
path: string;
|
|
93
|
+
file_pattern?: string;
|
|
94
|
+
recent_window_ms?: number;
|
|
95
|
+
session_id_from?: 'filename_uuid' | 'first_record';
|
|
96
|
+
session_id_path?: string;
|
|
97
|
+
message_filter?: { where: string };
|
|
98
|
+
message_map: NativeHistoryMessageMap;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface NativeHistorySqliteSource {
|
|
102
|
+
kind: 'sqlite';
|
|
103
|
+
path: string;
|
|
104
|
+
session_query: string;
|
|
105
|
+
message_query: string;
|
|
106
|
+
message_map: NativeHistoryMessageMap;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface NativeHistoryMessageMap {
|
|
110
|
+
role: string;
|
|
111
|
+
content: string;
|
|
112
|
+
content_strip?: string[];
|
|
113
|
+
content_unwrap?: string[];
|
|
114
|
+
timestamp_ms?: string;
|
|
115
|
+
kind?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Declarative tool-bubble extraction. Without it the executor only emits
|
|
118
|
+
* the text-bearing parts of each record, so a turn that is purely a tool
|
|
119
|
+
* call or tool result (no prose) is dropped — the restored transcript
|
|
120
|
+
* loses every tool interaction. When present, the executor walks each
|
|
121
|
+
* record's content blocks and emits an extra `kind:'tool'` message for
|
|
122
|
+
* any block whose `$.type` matches a tool shape.
|
|
123
|
+
*
|
|
124
|
+
* Defaults target the Anthropic-style content-block shape that claude-cli
|
|
125
|
+
* and codex-cli persist (blocks of `{ type: 'tool_use' | 'tool_result',
|
|
126
|
+
* name, input, content }`); a provider with a different on-disk shape
|
|
127
|
+
* overrides the field paths. Set `tools: {}` to opt in with the defaults.
|
|
128
|
+
*/
|
|
129
|
+
tools?: NativeHistoryToolMap;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* How to surface tool-call / tool-result blocks as `kind:'tool'` bubbles.
|
|
134
|
+
* Every field is optional — the defaults read the Anthropic block shape.
|
|
135
|
+
* Paths are jsonpath-lite evaluated against a single content block (the
|
|
136
|
+
* element of `$.message.content[]`), not the whole record.
|
|
137
|
+
*/
|
|
138
|
+
export interface NativeHistoryToolMap {
|
|
139
|
+
/** Path to a block's discriminator. Default `$.type`. */
|
|
140
|
+
block_type?: string;
|
|
141
|
+
/** Block-type values that mean "a tool was invoked". Default
|
|
142
|
+
* `['tool_use', 'function_call', 'custom_tool_call']`. */
|
|
143
|
+
call_types?: string[];
|
|
144
|
+
/** Block-type values that mean "a tool returned". Default
|
|
145
|
+
* `['tool_result', 'function_call_output', 'custom_tool_call_output']`. */
|
|
146
|
+
result_types?: string[];
|
|
147
|
+
/** Path to the tool name on a call block. Default `$.name`. */
|
|
148
|
+
call_name?: string;
|
|
149
|
+
/** Path to the tool arguments on a call block. Default `$.input`. */
|
|
150
|
+
call_args?: string;
|
|
151
|
+
/** Path to the result payload on a result block. Default `$.content`. */
|
|
152
|
+
result_content?: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
156
|
+
// Section definition
|
|
157
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
158
|
+
|
|
159
|
+
export interface AnchorContext {
|
|
160
|
+
prev?: string;
|
|
161
|
+
next?: string;
|
|
162
|
+
prev_flags?: string;
|
|
163
|
+
next_flags?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface SectionDef {
|
|
167
|
+
from_top?: Size;
|
|
168
|
+
from_bottom?: Size;
|
|
169
|
+
until?: string; // section id OR regex (starts with ^)
|
|
170
|
+
/**
|
|
171
|
+
* Anchor regex(es). A single string anchors on the first/last matching line
|
|
172
|
+
* (per `anchor_last`). An array is an OR-set of candidate shapes: each
|
|
173
|
+
* candidate resolves its OWN anchor line independently (anchor_last → that
|
|
174
|
+
* candidate's last matching line, else its first), then the TOPMOST resolved
|
|
175
|
+
* line across candidates wins — a section's anchor marks the top of its
|
|
176
|
+
* block, so the highest recognized landmark bounds the whole block. This
|
|
177
|
+
* lets one section capture two shapes — e.g. a box-divider modal AND a
|
|
178
|
+
* divider-less modal whose only stable landmark is the question line above
|
|
179
|
+
* its numbered choices — while preventing a stray LOWER landmark (e.g. an
|
|
180
|
+
* input-box `────` rule below the choices) from clipping the block.
|
|
181
|
+
*/
|
|
182
|
+
anchor?: string | string[];
|
|
183
|
+
anchor_flags?: string;
|
|
184
|
+
anchor_last?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Context guard(s) for the anchor. A single object applies to every anchor
|
|
187
|
+
* pattern. An array is matched positionally against an `anchor` array (entry
|
|
188
|
+
* i guards anchor i); a positional `undefined`/null entry means "no guard"
|
|
189
|
+
* for that anchor. A scalar `anchor` ignores array form beyond index 0.
|
|
190
|
+
*/
|
|
191
|
+
anchor_context?: AnchorContext | (AnchorContext | null)[];
|
|
192
|
+
lines?: number;
|
|
193
|
+
until_regex?: string;
|
|
194
|
+
until_regex_flags?: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
198
|
+
// Conditions (shared with fsm-types.ts FsmCondition leaves)
|
|
199
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
200
|
+
|
|
201
|
+
export interface RegexCondition {
|
|
202
|
+
section?: string;
|
|
203
|
+
matches: string;
|
|
204
|
+
flags?: string;
|
|
205
|
+
cursor_row_min?: number;
|
|
206
|
+
cursor_row_max?: number;
|
|
207
|
+
cursor_col_min?: number;
|
|
208
|
+
cursor_col_max?: number;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface ChangedCondition {
|
|
212
|
+
cursor_above: number;
|
|
213
|
+
changed: boolean;
|
|
214
|
+
stable_ms?: number;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface AllCondition {
|
|
218
|
+
all: Condition[];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface AnyCondition {
|
|
222
|
+
any: Condition[];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export type Condition = RegexCondition | ChangedCondition | AllCondition | AnyCondition;
|
|
226
|
+
|
|
227
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
228
|
+
// Extraction helpers
|
|
229
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
230
|
+
|
|
231
|
+
export interface ExtractTitle {
|
|
232
|
+
section?: string;
|
|
233
|
+
regex?: string;
|
|
234
|
+
flags?: string;
|
|
235
|
+
first_line?: true;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface ExtractButtons {
|
|
239
|
+
section?: string;
|
|
240
|
+
pattern: string;
|
|
241
|
+
flags?: string;
|
|
242
|
+
key_for_index: string;
|
|
243
|
+
min_count?: number;
|
|
244
|
+
continuation_lines?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* How a button is committed when its modal is resolved (auto-approve or an
|
|
247
|
+
* explicit dashboard click).
|
|
248
|
+
* 'index' (default) — send `key_for_index` with `{index}` filled in
|
|
249
|
+
* (`{index}\r` → `1\r`). Correct for modals whose buttons are
|
|
250
|
+
* number-selectable (codex, hermes, antigravity number rows).
|
|
251
|
+
* 'arrow_keys' — the modal is a cursor list that IGNORES number keys
|
|
252
|
+
* (claude-cli's new TUI approval modal): a typed `1` leaks into the
|
|
253
|
+
* composer as literal text and `\r` submits it. Instead move the cursor
|
|
254
|
+
* from its current row to the target row with up/down arrows, then
|
|
255
|
+
* confirm with the `key_for_index` tail (the `\r` left after stripping
|
|
256
|
+
* `{index}`). Mirrors the `open_picker` `select_mode` of the same name.
|
|
257
|
+
*/
|
|
258
|
+
select_mode?: 'index' | 'arrow_keys';
|
|
259
|
+
/** Arrow byte sequences for `select_mode: 'arrow_keys'`. Defaults to ANSI
|
|
260
|
+
* cursor up/down (`[A` / `[B`) when omitted. */
|
|
261
|
+
cursor_keys?: { up: string; down: string };
|
|
262
|
+
}
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Common across all Provider categories (IDE/Extension/CLI/ACP).
|
|
5
5
|
* - Approval waiting (waiting_approval) notification
|
|
6
|
-
* -
|
|
6
|
+
* - No-progress watchdog: alert when an active turn makes no progress for a while
|
|
7
7
|
* - All config toggleable via Provider Settings
|
|
8
8
|
*/
|
|
9
9
|
export interface MonitorConfig {
|
|
10
10
|
/** Enable awaiting-approval notification */
|
|
11
11
|
approvalAlert: boolean;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
12
|
+
/** No-progress watchdog notification enabled */
|
|
13
|
+
noProgressAlert: boolean;
|
|
14
|
+
/** No-progress threshold (seconds) */
|
|
15
|
+
noProgressThresholdSec: number;
|
|
16
16
|
/** Repeat notification cooldown (seconds) */
|
|
17
17
|
alertCooldownSec: number;
|
|
18
18
|
}
|
|
@@ -28,7 +28,7 @@ export declare class StatusMonitor {
|
|
|
28
28
|
private config;
|
|
29
29
|
private lastAlertTime;
|
|
30
30
|
private generatingStartTimes;
|
|
31
|
-
private
|
|
31
|
+
private noProgressAlerted;
|
|
32
32
|
private lastProgressFingerprint;
|
|
33
33
|
private lastProgressChangeAt;
|
|
34
34
|
constructor(config?: Partial<MonitorConfig>);
|
|
@@ -40,7 +40,7 @@ export declare class StatusMonitor {
|
|
|
40
40
|
* Check status transition → return notification event array.
|
|
41
41
|
* Called from each onTick() or detectStatusTransition().
|
|
42
42
|
*/
|
|
43
|
-
check(agentKey: string, status: string, now: number, progressFingerprint?: string): MonitorEvent[];
|
|
43
|
+
check(agentKey: string, status: string, now: number, progressFingerprint?: string, approvalPending?: boolean): MonitorEvent[];
|
|
44
44
|
/** Cooldown check — prevent sending the same notification too frequently */
|
|
45
45
|
private shouldAlert;
|
|
46
46
|
/** Reset (on agent terminate/restart) */
|
|
@@ -3,26 +3,26 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Common across all Provider categories (IDE/Extension/CLI/ACP).
|
|
5
5
|
* - Approval waiting (waiting_approval) notification
|
|
6
|
-
* -
|
|
6
|
+
* - No-progress watchdog: alert when an active turn makes no progress for a while
|
|
7
7
|
* - All config toggleable via Provider Settings
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
export interface MonitorConfig {
|
|
11
11
|
/** Enable awaiting-approval notification */
|
|
12
12
|
approvalAlert: boolean;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
|
|
13
|
+
/** No-progress watchdog notification enabled */
|
|
14
|
+
noProgressAlert: boolean;
|
|
15
|
+
/** No-progress threshold (seconds) */
|
|
16
|
+
noProgressThresholdSec: number;
|
|
17
17
|
/** Repeat notification cooldown (seconds) */
|
|
18
18
|
alertCooldownSec: number;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export const DEFAULT_MONITOR_CONFIG: MonitorConfig = {
|
|
22
22
|
approvalAlert: true,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
alertCooldownSec: 60,
|
|
23
|
+
noProgressAlert: true,
|
|
24
|
+
noProgressThresholdSec: 180, // 3 minutes
|
|
25
|
+
alertCooldownSec: 60, // 1 minute cooldown
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export interface MonitorEvent {
|
|
@@ -37,7 +37,7 @@ export class StatusMonitor {
|
|
|
37
37
|
private config: MonitorConfig;
|
|
38
38
|
private lastAlertTime = new Map<string, number>();
|
|
39
39
|
private generatingStartTimes = new Map<string, number>();
|
|
40
|
-
private
|
|
40
|
+
private noProgressAlerted = new Map<string, boolean>();
|
|
41
41
|
private lastProgressFingerprint = new Map<string, string>();
|
|
42
42
|
private lastProgressChangeAt = new Map<string, number>();
|
|
43
43
|
|
|
@@ -59,7 +59,7 @@ export class StatusMonitor {
|
|
|
59
59
|
* Check status transition → return notification event array.
|
|
60
60
|
* Called from each onTick() or detectStatusTransition().
|
|
61
61
|
*/
|
|
62
|
-
check(agentKey: string, status: string, now: number, progressFingerprint?: string): MonitorEvent[] {
|
|
62
|
+
check(agentKey: string, status: string, now: number, progressFingerprint?: string, approvalPending?: boolean): MonitorEvent[] {
|
|
63
63
|
const events: MonitorEvent[] = [];
|
|
64
64
|
|
|
65
65
|
// 1. Approval waiting notification
|
|
@@ -74,11 +74,26 @@ export class StatusMonitor {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// 2.
|
|
77
|
+
// 2. No-progress watchdog (identical for IDE/Extension/CLI/ACP)
|
|
78
78
|
if (status === 'generating' || status === 'streaming') {
|
|
79
|
+
// While an approval modal is pending we must NOT count the wait as
|
|
80
|
+
// no-progress. The assistant emits no tokens and the screen is frozen
|
|
81
|
+
// on the modal, so the progress fingerprint goes static — but this is
|
|
82
|
+
// a user action wait, not a freeze. Some callers (CLI/IDE auto-approve)
|
|
83
|
+
// also synthesize the reported status to 'generating' during the wait,
|
|
84
|
+
// so the plain `waiting_approval` branch below cannot catch it. Hold the
|
|
85
|
+
// progress anchor at `now` so the elapsed timer restarts the moment the
|
|
86
|
+
// approval clears and real generating resumes.
|
|
87
|
+
if (approvalPending) {
|
|
88
|
+
this.generatingStartTimes.set(agentKey, now);
|
|
89
|
+
this.lastProgressFingerprint.set(agentKey, progressFingerprint ?? '');
|
|
90
|
+
this.lastProgressChangeAt.set(agentKey, now);
|
|
91
|
+
this.noProgressAlerted.set(agentKey, false);
|
|
92
|
+
return events;
|
|
93
|
+
}
|
|
79
94
|
if (!this.generatingStartTimes.has(agentKey)) {
|
|
80
95
|
this.generatingStartTimes.set(agentKey, now);
|
|
81
|
-
this.
|
|
96
|
+
this.noProgressAlerted.set(agentKey, false);
|
|
82
97
|
const initialFingerprint = progressFingerprint ?? '';
|
|
83
98
|
this.lastProgressFingerprint.set(agentKey, initialFingerprint);
|
|
84
99
|
this.lastProgressChangeAt.set(agentKey, now);
|
|
@@ -88,17 +103,17 @@ export class StatusMonitor {
|
|
|
88
103
|
if (previousFingerprint !== currentFingerprint) {
|
|
89
104
|
this.lastProgressFingerprint.set(agentKey, currentFingerprint);
|
|
90
105
|
this.lastProgressChangeAt.set(agentKey, now);
|
|
91
|
-
this.
|
|
106
|
+
this.noProgressAlerted.set(agentKey, false);
|
|
92
107
|
}
|
|
93
|
-
if (this.config.
|
|
108
|
+
if (this.config.noProgressAlert) {
|
|
94
109
|
const progressChangedAt = this.lastProgressChangeAt.get(agentKey) || this.generatingStartTimes.get(agentKey)!;
|
|
95
110
|
const elapsedSec = Math.round((now - progressChangedAt) / 1000);
|
|
96
|
-
const alreadyAlerted = this.
|
|
97
|
-
if (elapsedSec > this.config.
|
|
98
|
-
if (this.shouldAlert(agentKey + ':
|
|
99
|
-
this.
|
|
111
|
+
const alreadyAlerted = this.noProgressAlerted.get(agentKey) === true;
|
|
112
|
+
if (elapsedSec > this.config.noProgressThresholdSec && !alreadyAlerted) {
|
|
113
|
+
if (this.shouldAlert(agentKey + ':no_progress', now)) {
|
|
114
|
+
this.noProgressAlerted.set(agentKey, true);
|
|
100
115
|
events.push({
|
|
101
|
-
type: 'monitor:
|
|
116
|
+
type: 'monitor:no_progress',
|
|
102
117
|
agentKey,
|
|
103
118
|
elapsedSec,
|
|
104
119
|
timestamp: now,
|
|
@@ -110,7 +125,7 @@ export class StatusMonitor {
|
|
|
110
125
|
} else {
|
|
111
126
|
// Reset timer when switching to non-generating status
|
|
112
127
|
this.generatingStartTimes.delete(agentKey);
|
|
113
|
-
this.
|
|
128
|
+
this.noProgressAlerted.delete(agentKey);
|
|
114
129
|
this.lastProgressFingerprint.delete(agentKey);
|
|
115
130
|
this.lastProgressChangeAt.delete(agentKey);
|
|
116
131
|
}
|
|
@@ -132,7 +147,7 @@ export class StatusMonitor {
|
|
|
132
147
|
reset(agentKey?: string): void {
|
|
133
148
|
if (agentKey) {
|
|
134
149
|
this.generatingStartTimes.delete(agentKey);
|
|
135
|
-
this.
|
|
150
|
+
this.noProgressAlerted.delete(agentKey);
|
|
136
151
|
this.lastProgressFingerprint.delete(agentKey);
|
|
137
152
|
this.lastProgressChangeAt.delete(agentKey);
|
|
138
153
|
// Delete all cooldowns for this key
|
|
@@ -141,7 +156,7 @@ export class StatusMonitor {
|
|
|
141
156
|
}
|
|
142
157
|
} else {
|
|
143
158
|
this.generatingStartTimes.clear();
|
|
144
|
-
this.
|
|
159
|
+
this.noProgressAlerted.clear();
|
|
145
160
|
this.lastProgressFingerprint.clear();
|
|
146
161
|
this.lastProgressChangeAt.clear();
|
|
147
162
|
this.lastAlertTime.clear();
|