@adhdev/daemon-core 0.9.82-rc.44 → 0.9.82-rc.441
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 +120 -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 +50719 -20120
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50317 -19882
- 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 +29 -0
- package/dist/mesh/mesh-init.d.ts +128 -0
- package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -4
- package/dist/mesh/mesh-ledger.d.ts +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 +300 -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 +252 -3
- package/dist/providers/contracts.d.ts +149 -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 +509 -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 +2447 -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 +572 -27
- 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 +714 -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 +1242 -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 +2846 -3484
- package/src/commands/stream-commands.ts +8 -0
- package/src/commands/upgrade-helper.ts +310 -45
- package/src/config/chat-history.ts +493 -24
- package/src/config/config.ts +12 -0
- package/src/config/mesh-config.ts +593 -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 +196 -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 +415 -34
- 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 +1897 -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 +111 -0
- package/src/mesh/mesh-init.ts +350 -0
- package/src/mesh/mesh-ledger-reconciliation.ts +12 -7
- package/src/mesh/mesh-ledger.ts +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 +1924 -0
- package/src/mesh/mesh-reconcile-loop.ts +1997 -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 +1254 -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 +2001 -106
- package/src/providers/contracts.d.ts +55 -0
- package/src/providers/contracts.ts +160 -6
- package/src/providers/extension-provider-instance.ts +12 -7
- package/src/providers/external-sources.ts +218 -0
- package/src/providers/ide-provider-instance.ts +35 -12
- package/src/providers/manual-attendance.ts +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 +345 -0
- package/src/providers/native-history/hermes-cli-transcript.ts +260 -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 +509 -0
- package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
- package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +125 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
- package/src/providers/sdk/v1/types/cli/index.ts +365 -0
- package/src/providers/sdk/v1/types/common/index.ts +229 -0
- package/src/providers/sdk/v1/validators/index.ts +19 -0
- package/src/providers/sdk/v1/validators/manifest.ts +110 -0
- package/src/providers/sdk/v1/validators/taint.ts +309 -0
- package/src/providers/spec/adapter.ts +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 +1143 -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 +748 -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,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M7: Operational stats (time/attempts) derived from existing truth.
|
|
3
|
+
*
|
|
4
|
+
* No cost/token accounting — ADHDev observes PTY/CDP and cannot see API
|
|
5
|
+
* tokens (explicit non-goal). Everything here is derived at query time from
|
|
6
|
+
* the SQLite ledger and queue rows; there is no separate aggregate table.
|
|
7
|
+
* Tasks with missing ledger evidence report incompleteEvidence instead of
|
|
8
|
+
* estimated numbers.
|
|
9
|
+
*/
|
|
10
|
+
export interface MeshTaskStats {
|
|
11
|
+
taskId: string;
|
|
12
|
+
status: string;
|
|
13
|
+
dispatchedAt: string | null;
|
|
14
|
+
terminalAt: string | null;
|
|
15
|
+
terminalKind: 'task_completed' | 'task_failed' | null;
|
|
16
|
+
/** dispatched → terminal wall clock; null when evidence is incomplete. */
|
|
17
|
+
durationMs: number | null;
|
|
18
|
+
/** Number of task_dispatched ledger entries observed for this task. */
|
|
19
|
+
dispatchCount: number;
|
|
20
|
+
/** Queue requeueCount (0 when the row is gone or never requeued). */
|
|
21
|
+
requeueCount: number;
|
|
22
|
+
/** True when dispatch or terminal ledger evidence is missing — numbers are withheld, never estimated. */
|
|
23
|
+
incompleteEvidence?: true;
|
|
24
|
+
}
|
|
25
|
+
export interface MeshMissionStats {
|
|
26
|
+
missionId: string;
|
|
27
|
+
taskCount: number;
|
|
28
|
+
completed: number;
|
|
29
|
+
failed: number;
|
|
30
|
+
/** Sum of per-task durations with complete evidence. */
|
|
31
|
+
totalDurationMs: number;
|
|
32
|
+
/** First dispatch → last terminal across the mission's tasks; null without complete endpoints. */
|
|
33
|
+
wallClockMs: number | null;
|
|
34
|
+
/** Total requeue attempts across the mission's tasks. */
|
|
35
|
+
retries: number;
|
|
36
|
+
/** Task ids whose ledger evidence was incomplete (excluded from sums). */
|
|
37
|
+
incompleteTaskIds: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Compute per-task stats from ledger entries. Scans a bounded tail window —
|
|
41
|
+
* stats are an operational view of recent work, not a full historical report.
|
|
42
|
+
*/
|
|
43
|
+
export declare function computeMeshTaskStats(meshId: string, opts?: {
|
|
44
|
+
taskIds?: string[];
|
|
45
|
+
missionId?: string;
|
|
46
|
+
tail?: number;
|
|
47
|
+
}): MeshTaskStats[];
|
|
48
|
+
/** Mission rollup — derived from per-task stats, no stored aggregates. */
|
|
49
|
+
export declare function computeMeshMissionStats(meshId: string, missionId: string): MeshMissionStats;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const UNRESOLVED_FORWARD_OUTBOX_MESH_ID = "__unresolved_forward_outbox__";
|
|
2
|
+
export interface UnresolvedForwardEntry {
|
|
3
|
+
/** Row id in mesh_pending_events; pass back to ack/expire after a push attempt. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The coordinator daemon to push this event to (mesh_forward_event target). */
|
|
6
|
+
coordinatorDaemonId: string;
|
|
7
|
+
/** The flat payload to forward (already shaped for handleMeshForwardEvent). */
|
|
8
|
+
payload: Record<string, unknown>;
|
|
9
|
+
/** When the entry was first enqueued (epoch ms) — used for age-based expiry. */
|
|
10
|
+
queuedAt: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Durably enqueue an unresolved-delegate forward for a coordinator daemon. The
|
|
14
|
+
* `forwardPayload` is the flat shape handleMeshForwardEvent reads on the coordinator.
|
|
15
|
+
* Idempotent on the event fingerprint. Returns true when a new row was written (or a
|
|
16
|
+
* duplicate was harmlessly ignored), false on a hard persistence failure.
|
|
17
|
+
*/
|
|
18
|
+
export declare function enqueueUnresolvedDelegateForward(coordinatorDaemonId: string, eventName: string, forwardPayload: Record<string, unknown>): boolean;
|
|
19
|
+
/** Peek (non-destructive) every undrained outbox entry across all coordinators. */
|
|
20
|
+
export declare function peekUnresolvedDelegateForwards(): UnresolvedForwardEntry[];
|
|
21
|
+
/** Mark an outbox entry delivered (acked) after a successful push. */
|
|
22
|
+
export declare function ackUnresolvedDelegateForward(id: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Drop outbox entries that have exceeded the max retry age. Returns the count
|
|
25
|
+
* expired so the caller can log a fail-loud trace (a dropped completion is a real
|
|
26
|
+
* loss; it must be visible, not silent).
|
|
27
|
+
*/
|
|
28
|
+
export declare function expireStaleUnresolvedDelegateForwards(nowMs?: number): number;
|
|
29
|
+
/** Test helper: purge the entire outbox. */
|
|
30
|
+
export declare function __clearUnresolvedDelegateForwardOutboxForTests(): void;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Await `work` under a warmup-aware deadline so a cold-open DataChannel handshake
|
|
3
|
+
* is NOT charged against the command response budget — the root cause of the
|
|
4
|
+
* "first mesh dispatch to a cold peer false-times-out, the warm retry succeeds"
|
|
5
|
+
* signature. Two budgets, switched by the live peer connection state:
|
|
6
|
+
*
|
|
7
|
+
* - While `isConnected()` returns false the peer's channel is still opening; the
|
|
8
|
+
* cold-open `connectTimeoutMs` budget applies. This phase is deliberately
|
|
9
|
+
* generous because a TURN-relayed cross-machine handshake legitimately needs
|
|
10
|
+
* many seconds — but a genuine connect *failure* is surfaced by `work`
|
|
11
|
+
* rejecting on its own (the mesh manager fails the peer the instant its
|
|
12
|
+
* PeerConnection state goes terminal), so a real failure is never masked for
|
|
13
|
+
* the whole window.
|
|
14
|
+
* - The first time `isConnected()` returns true the channel is warm; from that
|
|
15
|
+
* instant the tight `responseTimeoutMs` governs how long the handler may take.
|
|
16
|
+
* Warm-channel callers therefore see behavior identical to the old single
|
|
17
|
+
* `Promise.race(work, responseTimeoutMs)`.
|
|
18
|
+
*
|
|
19
|
+
* Rejects with `Error('timeout')` when either budget is exhausted, mirroring the
|
|
20
|
+
* previous single-race contract. When no connection getter is wired callers must
|
|
21
|
+
* NOT pass `() => true` ("always warm") — that re-introduces the cold-open
|
|
22
|
+
* false-timeout. Use {@link resolveWarmupDeadlineOpts} which degrades conservatively.
|
|
23
|
+
*/
|
|
24
|
+
export declare function awaitWithWarmupDeadline<T>(work: Promise<T>, opts: {
|
|
25
|
+
isConnected: () => boolean;
|
|
26
|
+
connectTimeoutMs: number;
|
|
27
|
+
responseTimeoutMs: number;
|
|
28
|
+
pollIntervalMs?: number;
|
|
29
|
+
}): Promise<T>;
|
|
30
|
+
/** Minimal connection-state reader: a mesh peer snapshot stamps its live state on `.state`. */
|
|
31
|
+
export declare function readWarmupConnectionState(connection: Record<string, unknown> | null | undefined): string | undefined;
|
|
32
|
+
export interface ResolvedWarmupDeadlineOpts {
|
|
33
|
+
isConnected: () => boolean;
|
|
34
|
+
connectTimeoutMs: number;
|
|
35
|
+
responseTimeoutMs: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build {@link awaitWithWarmupDeadline} opts from an OPTIONAL live peer-connection
|
|
39
|
+
* probe, handling the missing-getter case fail-loud instead of silently degrading.
|
|
40
|
+
*
|
|
41
|
+
* When `getConnection` is wired the normal cold-open/warm split applies: the probe
|
|
42
|
+
* is consulted live and the channel is "warm" only once it reports `connected`.
|
|
43
|
+
*
|
|
44
|
+
* When `getConnection` is ABSENT the old call sites fell back to `() => true`
|
|
45
|
+
* ("always warm"), which charges a still-opening cold channel against the response
|
|
46
|
+
* budget and silently re-introduces the exact cold-open false-timeout the warmup
|
|
47
|
+
* deadline exists to prevent. Instead we degrade CONSERVATIVELY and FAIL LOUD:
|
|
48
|
+
* - `onMissingGetter` is invoked so the caller can warn (the degrade is visible,
|
|
49
|
+
* never silent) — keyed/throttled by the caller as it sees fit.
|
|
50
|
+
* - the channel is treated as NOT observably warm (`isConnected: () => false`),
|
|
51
|
+
* so the response deadline never arms early on an unobservable channel.
|
|
52
|
+
* - the cold peer is granted the COMBINED connect+response window as one deadline,
|
|
53
|
+
* so a slow-but-live cold open is never false-timed at the shorter response
|
|
54
|
+
* budget. A genuinely hung dispatch still rejects when the combined window
|
|
55
|
+
* lapses, and `work` rejecting on its own (a real transport failure) still
|
|
56
|
+
* settles immediately.
|
|
57
|
+
*
|
|
58
|
+
* Note: a present getter that returns a non-`connected` snapshot (or `null` for an
|
|
59
|
+
* unknown peer) correctly yields `isConnected() === false` — i.e. the generous
|
|
60
|
+
* connect budget, never "always warm". Only a wholly absent getter degrades.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveWarmupDeadlineOpts(opts: {
|
|
63
|
+
getConnection?: ((daemonId: string) => Record<string, unknown> | null) | undefined;
|
|
64
|
+
daemonId: string;
|
|
65
|
+
connectTimeoutMs: number;
|
|
66
|
+
responseTimeoutMs: number;
|
|
67
|
+
onMissingGetter?: (daemonId: string) => void;
|
|
68
|
+
}): ResolvedWarmupDeadlineOpts;
|
|
@@ -1,21 +1,101 @@
|
|
|
1
|
+
import type { RepoMeshDaemonRole } from '../repo-mesh-types.js';
|
|
2
|
+
import { MeshRuntimeStore } from './mesh-runtime-store.js';
|
|
1
3
|
export type MeshTaskStatus = 'pending' | 'assigned' | 'completed' | 'failed' | 'cancelled';
|
|
2
4
|
export type MeshActiveTaskStatus = Extract<MeshTaskStatus, 'pending' | 'assigned'>;
|
|
3
5
|
export type MeshHistoricalTaskStatus = Extract<MeshTaskStatus, 'completed' | 'failed' | 'cancelled'>;
|
|
6
|
+
export type MeshTaskMode = 'code_change' | 'validation' | 'live_debug_readonly' | 'launch_app' | 'convergence';
|
|
4
7
|
export declare const ACTIVE_MESH_QUEUE_STATUSES: MeshActiveTaskStatus[];
|
|
5
8
|
export declare const HISTORICAL_MESH_QUEUE_STATUSES: MeshHistoricalTaskStatus[];
|
|
9
|
+
export declare const MESH_TASK_MODES: MeshTaskMode[];
|
|
10
|
+
/**
|
|
11
|
+
* QUEUE-NODE-SERIALIZATION: single source of truth for "is this task read-only?".
|
|
12
|
+
*
|
|
13
|
+
* Read-only classification used to be inlined as `task.taskMode === 'live_debug_readonly'`
|
|
14
|
+
* at every enforcement site (node-conflict claim gate, auto-launch isolation, the
|
|
15
|
+
* write/readonly cap counters, the write guardrail). That spread-out comparison is the
|
|
16
|
+
* exact recurring-defect class — one site drifting from the others silently makes the same
|
|
17
|
+
* task read-only at some gates and write at others, i.e. partial serialization. All sites
|
|
18
|
+
* MUST call this predicate so the classification is decided in exactly one place.
|
|
19
|
+
*
|
|
20
|
+
* Two orthogonal inputs feed the same boolean axis (kept backward-compatible):
|
|
21
|
+
* • `readonly === true` — the explicit boolean axis (new API surface).
|
|
22
|
+
* • `taskMode === 'live_debug_readonly'` — the original enum value, preserved as an
|
|
23
|
+
* OR-fallback so existing live_debug_readonly tasks keep behaving identically.
|
|
24
|
+
*
|
|
25
|
+
* Accepts any task-like shape (full {@link MeshWorkQueueEntry} or a bare
|
|
26
|
+
* `{ readonly?, taskMode? }`) so the daemon-core and mcp-server boundaries can share it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isTaskReadonly(task: {
|
|
29
|
+
readonly?: boolean;
|
|
30
|
+
taskMode?: MeshTaskMode | string;
|
|
31
|
+
} | null | undefined): boolean;
|
|
32
|
+
export interface MeshTaskModeValidationResult {
|
|
33
|
+
valid: boolean;
|
|
34
|
+
taskMode?: MeshTaskMode;
|
|
35
|
+
violations: string[];
|
|
36
|
+
allowedOperations?: string[];
|
|
37
|
+
}
|
|
38
|
+
export declare function normalizeMeshTaskMode(value: unknown): MeshTaskMode | undefined;
|
|
39
|
+
export declare function validateMeshTaskModeRequest(mode: unknown, message: string, readonly?: boolean): MeshTaskModeValidationResult;
|
|
6
40
|
export interface MeshWorkQueueEntry {
|
|
7
41
|
id: string;
|
|
8
42
|
meshId: string;
|
|
9
43
|
message: string;
|
|
10
44
|
status: MeshTaskStatus;
|
|
45
|
+
taskMode?: MeshTaskMode;
|
|
46
|
+
/**
|
|
47
|
+
* QUEUE-NODE-SERIALIZATION: explicit read-only axis, orthogonal to taskMode. When
|
|
48
|
+
* true the task is treated as read-only by every scheduling gate (no node-busy
|
|
49
|
+
* isolation, counted under the read-only cap, write commands rejected) regardless of
|
|
50
|
+
* its taskMode. Decided exclusively through {@link isTaskReadonly}; `taskMode ===
|
|
51
|
+
* 'live_debug_readonly'` remains an OR-fallback so legacy rows behave unchanged.
|
|
52
|
+
*/
|
|
53
|
+
readonly?: boolean;
|
|
11
54
|
/** If specified, only this node can claim the task (used by legacy mesh_send_task) */
|
|
12
55
|
targetNodeId?: string;
|
|
13
56
|
/** If specified, only this runtime session can claim the task */
|
|
14
57
|
targetSessionId?: string;
|
|
58
|
+
/** If specified, a node must expose all tags before it can claim the task. */
|
|
59
|
+
requiredTags?: string[];
|
|
60
|
+
/**
|
|
61
|
+
* M1: ids of tasks that must reach 'completed' before this task is claimable.
|
|
62
|
+
* Forward references (ids not yet enqueued) are allowed for batch flows and
|
|
63
|
+
* simply keep the task waiting until the referenced task exists and completes.
|
|
64
|
+
*/
|
|
65
|
+
dependsOn?: string[];
|
|
66
|
+
/** M1/M3: mission this task belongs to (joins mesh_missions). */
|
|
67
|
+
missionId?: string;
|
|
68
|
+
/**
|
|
69
|
+
* MAGI: consensus group id shared by every replica of one mesh_magi_review
|
|
70
|
+
* fan-out. Marks the task as part of an INTENTIONAL same-prompt quorum so the
|
|
71
|
+
* completion-event dedup (mesh-events-pending) never collapses grouped
|
|
72
|
+
* replicas. Absent on ordinary tasks. Rides in the payload JSON (no column).
|
|
73
|
+
*/
|
|
74
|
+
consensusGroupId?: string;
|
|
75
|
+
/**
|
|
76
|
+
* MAGI-KIND-PANEL (model axis): model override for the session that executes this
|
|
77
|
+
* task. When the task auto-launches a session, this is passed to launch_cli as
|
|
78
|
+
* `initialModel` (ACP → setConfigOption; CLI → modelLaunchArgs template). Absent on
|
|
79
|
+
* ordinary tasks. Rides in the payload JSON (no column). Best-effort — a provider
|
|
80
|
+
* that cannot honor the model still runs the task (never a fatal launch error).
|
|
81
|
+
*/
|
|
82
|
+
model?: string;
|
|
83
|
+
/**
|
|
84
|
+
* M1: why this task is held back (e.g. "dependency_failed:<taskId>").
|
|
85
|
+
* Only set by the system on dependency failure under the 'block' policy;
|
|
86
|
+
* waiting-on-dependency state is computed at view time, not stored.
|
|
87
|
+
*/
|
|
88
|
+
blockedReason?: string;
|
|
15
89
|
/** The node that actually claimed and is executing the task */
|
|
16
90
|
assignedNodeId?: string;
|
|
17
91
|
/** The session currently executing the task */
|
|
18
92
|
assignedSessionId?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Provider type of the session that claimed the task. Recorded so the queue
|
|
95
|
+
* can enforce per-(node, provider) maxParallel caps (RepoMeshNodePolicy
|
|
96
|
+
* providerRoles) by counting active assignments grouped by node + provider.
|
|
97
|
+
*/
|
|
98
|
+
assignedProviderType?: string;
|
|
19
99
|
/** Human/operator reason for terminal cancellation. */
|
|
20
100
|
cancelReason?: string;
|
|
21
101
|
cancelledAt?: string;
|
|
@@ -23,6 +103,16 @@ export interface MeshWorkQueueEntry {
|
|
|
23
103
|
requeueReason?: string;
|
|
24
104
|
requeuedAt?: string;
|
|
25
105
|
requeueCount?: number;
|
|
106
|
+
/** Max automatic requeue attempts. When requeueCount reaches this, task is auto-failed. */
|
|
107
|
+
maxRetries?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Bug B: number of times the reconcile assigned-stranded watchdog has reclaimed this
|
|
110
|
+
* row from 'assigned' back to 'pending' because its dispatch was never confirmed
|
|
111
|
+
* delivered. Separate from requeueCount (operator/execution retries) and bounded by
|
|
112
|
+
* MAX_STRANDED_RECLAIMS so a permanently-undeliverable target auto-fails rather than
|
|
113
|
+
* cycling reclaim→re-dispatch→strand forever.
|
|
114
|
+
*/
|
|
115
|
+
strandedReclaimCount?: number;
|
|
26
116
|
/** Last automatic queue session spin-up attempt, for mesh_view_queue/debug visibility. */
|
|
27
117
|
autoLaunch?: {
|
|
28
118
|
status: 'skipped' | 'started' | 'failed' | 'completed';
|
|
@@ -34,55 +124,215 @@ export interface MeshWorkQueueEntry {
|
|
|
34
124
|
};
|
|
35
125
|
/** ISO timestamp when the task was dispatched (assigned) to a node/session. Used for precise matching on completion. */
|
|
36
126
|
dispatchTimestamp?: string;
|
|
127
|
+
/**
|
|
128
|
+
* (3) The ORIGINATING coordinator session that enqueued this task. Stamped onto the
|
|
129
|
+
* worker at dispatch (meshCoordinatorSessionId) so the task's completion routes back to
|
|
130
|
+
* the exact coordinator session — even when several coordinator sessions share one
|
|
131
|
+
* daemon. Rides in the queue payload JSON (no column migration); absent on legacy rows
|
|
132
|
+
* → daemon-level routing fallback (backward + version-skew safe).
|
|
133
|
+
*/
|
|
134
|
+
sourceCoordinatorSessionId?: string;
|
|
37
135
|
createdAt: string;
|
|
38
136
|
updatedAt: string;
|
|
39
137
|
}
|
|
138
|
+
export interface MeshQueueMutationOptions {
|
|
139
|
+
ownerRole?: RepoMeshDaemonRole;
|
|
140
|
+
}
|
|
141
|
+
export declare function normalizeMeshCapabilityTags(value: unknown): string[];
|
|
142
|
+
export declare function buildMeshNodeCapabilityTags(node: {
|
|
143
|
+
capabilities?: unknown;
|
|
144
|
+
policy?: unknown;
|
|
145
|
+
isLocalWorktree?: unknown;
|
|
146
|
+
worktreeBranch?: unknown;
|
|
147
|
+
userOverrides?: unknown;
|
|
148
|
+
reportedPlatform?: unknown;
|
|
149
|
+
reportedArch?: unknown;
|
|
150
|
+
} | undefined, providerType?: string): string[];
|
|
151
|
+
export declare function nodeSatisfiesRequiredTags(requiredTags: unknown, capabilityTags: unknown): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Convergence-aware required-tags resolution (load-balancing scheduler, opt-in).
|
|
154
|
+
*
|
|
155
|
+
* When the mesh enables policy.autoConvergeCodeChange, a `converge=refine` required
|
|
156
|
+
* tag is merged into a code_change task's required tags at enqueue time, so the
|
|
157
|
+
* scheduler hard-filters the task onto refine-capable worktree nodes only (on any
|
|
158
|
+
* machine — refine_mesh_node forwards to the owning daemon). Because the tag is
|
|
159
|
+
* persisted on the queue entry, BOTH the eligibility scan (maybeAutoLaunchOneQueueSession)
|
|
160
|
+
* and the claim transaction (claimNextQueueTask → nodeSatisfiesRequiredTags) enforce
|
|
161
|
+
* it consistently.
|
|
162
|
+
*
|
|
163
|
+
* Strict backward compatibility — the injection is skipped (returns the explicit tags
|
|
164
|
+
* unchanged) when ANY of:
|
|
165
|
+
* - the mesh does not opt in (autoConvergeCodeChange !== true), or
|
|
166
|
+
* - the task is not code_change (validation / live_debug_readonly / launch_app /
|
|
167
|
+
* convergence carry no merge cost and may run anywhere), or
|
|
168
|
+
* - the task is explicitly targeted (targetNodeId): the operator chose the node, so
|
|
169
|
+
* we do not second-guess it by filtering on convergence capability.
|
|
170
|
+
* Idempotent: normalizeMeshCapabilityTags dedupes, so re-injection is a no-op.
|
|
171
|
+
*/
|
|
172
|
+
export declare function resolveConvergeRequiredTags(meshId: string, taskMode: MeshTaskMode | undefined, explicitRequiredTags: string[], opts?: {
|
|
173
|
+
targetNodeId?: string;
|
|
174
|
+
}): string[];
|
|
175
|
+
/**
|
|
176
|
+
* M1: detect dependency cycles before enqueue. Walks the dependency graph of
|
|
177
|
+
* existing queue entries plus the new task's edges. Fail-closed: a cycle
|
|
178
|
+
* rejects the enqueue entirely. Synchronous and bounded by queue size.
|
|
179
|
+
*/
|
|
180
|
+
export declare function assertNoDependencyCycle(meshId: string, newTaskId: string, dependsOn: string[]): void;
|
|
40
181
|
/**
|
|
41
182
|
* Add a new task to the mesh queue.
|
|
42
183
|
*/
|
|
43
184
|
export declare function enqueueTask(meshId: string, message: string, opts?: {
|
|
44
185
|
targetNodeId?: string;
|
|
45
186
|
targetSessionId?: string;
|
|
46
|
-
|
|
187
|
+
taskMode?: MeshTaskMode | string;
|
|
188
|
+
/** QUEUE-NODE-SERIALIZATION: explicit read-only axis (orthogonal to taskMode). */
|
|
189
|
+
readonly?: boolean;
|
|
190
|
+
requiredTags?: string[];
|
|
191
|
+
/** M1: tasks that must complete before this one is claimable. */
|
|
192
|
+
dependsOn?: string[];
|
|
193
|
+
/** M1/M3: mission this task belongs to. */
|
|
194
|
+
missionId?: string;
|
|
195
|
+
/** MAGI: consensus group id shared by every replica of a mesh_magi_review fan-out. */
|
|
196
|
+
consensusGroupId?: string;
|
|
197
|
+
/** MAGI-KIND-PANEL: model override forwarded to the executing session's launch (initialModel). */
|
|
198
|
+
model?: string;
|
|
199
|
+
/** Explicit task id for batch/template flows (M5). Random UUID when omitted. */
|
|
200
|
+
id?: string;
|
|
201
|
+
/** (3) Originating coordinator session id (for session-anchored completion routing). */
|
|
202
|
+
sourceCoordinatorSessionId?: string;
|
|
203
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry;
|
|
204
|
+
/**
|
|
205
|
+
* Record a direct-dispatch task (mesh_send_task) as an already-assigned queue
|
|
206
|
+
* entry so it is attributable to a mission.
|
|
207
|
+
*
|
|
208
|
+
* Direct dispatch normally bypasses the queue entirely — the task lives only in
|
|
209
|
+
* the ledger + mesh_direct_dispatches table, neither of which carries a
|
|
210
|
+
* missionId, so {@link summarizeMissionTasks}/{@link computeMeshTaskStats}
|
|
211
|
+
* (which both scan the queue for `task.missionId`) count it as 0. When a
|
|
212
|
+
* mission is attached, we materialise the same queue entry shape an enqueued
|
|
213
|
+
* task would have, but pre-assigned to the dispatched node/session and stamped
|
|
214
|
+
* with the dispatch timestamp. The terminal event path (updateSessionTaskStatus
|
|
215
|
+
* → findAssignedBySession) then flips it to completed/failed exactly like a
|
|
216
|
+
* pulled task, so mission total + completed aggregates work with no extra wiring.
|
|
217
|
+
*
|
|
218
|
+
* Intentionally separate from {@link enqueueTask}: enqueue creates `pending`
|
|
219
|
+
* work for the queue to assign, whereas this records work already dispatched
|
|
220
|
+
* out-of-band. They share the missionId stamping rule and mode validation.
|
|
221
|
+
*/
|
|
222
|
+
export declare function recordDirectDispatchTask(meshId: string, message: string, opts: {
|
|
223
|
+
id: string;
|
|
224
|
+
missionId: string;
|
|
225
|
+
assignedNodeId?: string;
|
|
226
|
+
assignedSessionId?: string;
|
|
227
|
+
taskMode?: MeshTaskMode | string;
|
|
228
|
+
/** QUEUE-NODE-SERIALIZATION: explicit read-only axis (orthogonal to taskMode). */
|
|
229
|
+
readonly?: boolean;
|
|
230
|
+
dispatchedAt?: string;
|
|
231
|
+
}): MeshWorkQueueEntry | null;
|
|
47
232
|
/**
|
|
48
233
|
* Get all tasks in the queue, optionally filtered by status.
|
|
49
234
|
*/
|
|
50
235
|
export declare function getQueue(meshId: string, opts?: {
|
|
51
236
|
status?: MeshTaskStatus[];
|
|
52
237
|
}): MeshWorkQueueEntry[];
|
|
238
|
+
export declare function getMeshQueueRevision(meshId: string): string;
|
|
53
239
|
/**
|
|
54
240
|
* Find the next pending task that this node is allowed to claim, and mark it as assigned.
|
|
241
|
+
*
|
|
242
|
+
* `opts.providerType` is stamped onto the claimed entry (assignedProviderType) so
|
|
243
|
+
* per-(node, provider) caps can be counted. `opts.providerMaxParallel`, when set,
|
|
244
|
+
* is the enforced per-(node, provider) cap from RepoMeshNodePolicy.providerRoles:
|
|
245
|
+
* a task is not assigned to this (node, provider) once it already has that many
|
|
246
|
+
* active assignments. This composes with the global/taskMode caps (stricter wins).
|
|
55
247
|
*/
|
|
56
|
-
export declare function claimNextTask(meshId: string, nodeId: string, sessionId: string
|
|
248
|
+
export declare function claimNextTask(meshId: string, nodeId: string, sessionId: string, capabilityTags?: string[], opts?: {
|
|
249
|
+
providerType?: string;
|
|
250
|
+
providerMaxParallel?: number;
|
|
251
|
+
nodeIsWorktree?: boolean;
|
|
252
|
+
}): MeshWorkQueueEntry | null;
|
|
253
|
+
export type DependencyFailurePolicy = 'block' | 'cancel';
|
|
57
254
|
/**
|
|
58
255
|
* Update the status of a specific task.
|
|
59
256
|
* Used when a session completes, fails, or stalls.
|
|
60
257
|
*/
|
|
61
|
-
export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus): MeshWorkQueueEntry | null;
|
|
258
|
+
export declare function updateTaskStatus(meshId: string, taskId: string, status: MeshTaskStatus, opts?: MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
62
259
|
export declare function recordTaskAutoLaunch(meshId: string, taskId: string, autoLaunch: Omit<NonNullable<MeshWorkQueueEntry['autoLaunch']>, 'updatedAt'>): MeshWorkQueueEntry | null;
|
|
63
260
|
/**
|
|
64
261
|
* Mark a queue task as manually cancelled without deleting audit history.
|
|
65
262
|
*/
|
|
66
263
|
export declare function cancelTask(meshId: string, taskId: string, opts?: {
|
|
67
264
|
reason?: string;
|
|
68
|
-
}): MeshWorkQueueEntry | null;
|
|
265
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
69
266
|
/**
|
|
70
267
|
* Return a queue task to pending for retry. By default, dead session targeting
|
|
71
268
|
* and assigned ownership are cleared so stale assignments do not strand again.
|
|
72
269
|
*/
|
|
270
|
+
export type RequeueResult = {
|
|
271
|
+
status: 'requeued';
|
|
272
|
+
entry: MeshWorkQueueEntry;
|
|
273
|
+
} | {
|
|
274
|
+
status: 'failed_max_retries';
|
|
275
|
+
entry: MeshWorkQueueEntry;
|
|
276
|
+
maxRetries: number;
|
|
277
|
+
requeueCount: number;
|
|
278
|
+
} | {
|
|
279
|
+
status: 'not_found';
|
|
280
|
+
};
|
|
73
281
|
export declare function requeueTask(meshId: string, taskId: string, opts?: {
|
|
74
282
|
reason?: string;
|
|
75
283
|
targetNodeId?: string;
|
|
76
284
|
targetSessionId?: string;
|
|
77
285
|
clearTargetNode?: boolean;
|
|
78
286
|
clearTargetSession?: boolean;
|
|
79
|
-
|
|
287
|
+
/**
|
|
288
|
+
* Override the retry cap for this call. Use only for explicit operator actions.
|
|
289
|
+
* If true, the task is requeued even when requeueCount >= maxRetries.
|
|
290
|
+
*/
|
|
291
|
+
force?: boolean;
|
|
292
|
+
/** Per-task retry cap override. Falls back to mesh policy maxTaskRetries (default 1). */
|
|
293
|
+
maxRetries?: number;
|
|
294
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
295
|
+
/**
|
|
296
|
+
* Bug B: reclaim a task stuck in 'assigned' because its dispatch was never confirmed.
|
|
297
|
+
*
|
|
298
|
+
* claimNextTask atomically marks a row 'assigned' BEFORE the fire-and-forget dispatch
|
|
299
|
+
* runs. If that dispatch neither rejects (→ no .catch requeue) nor is confirmed
|
|
300
|
+
* delivered — a relay that hangs without acking, or a confirm timer lost across a
|
|
301
|
+
* daemon restart — the row stays 'assigned' forever, contributing 0 pending so PHASE 3
|
|
302
|
+
* reconcile never re-examines it. This returns such a row to 'pending' and clears its
|
|
303
|
+
* dead assignment ownership (node / session / provider / dispatchTimestamp) — the same
|
|
304
|
+
* ownership-clear requeueTask applies — so PHASE 3 can re-dispatch it onto a fresh idle
|
|
305
|
+
* session.
|
|
306
|
+
*
|
|
307
|
+
* Guarded to 'assigned' rows only (a completion/cancel that already moved the row off
|
|
308
|
+
* 'assigned' must never be resurrected) and bounded by MAX_STRANDED_RECLAIMS (beyond
|
|
309
|
+
* which the task is failed so dependents unblock).
|
|
310
|
+
*/
|
|
311
|
+
export declare function reclaimStrandedAssignedTask(meshId: string, taskId: string, opts?: {
|
|
312
|
+
reason?: string;
|
|
313
|
+
ageMs?: number;
|
|
314
|
+
} & MeshQueueMutationOptions): MeshWorkQueueEntry | null;
|
|
80
315
|
/**
|
|
81
316
|
* Update the status of the task currently assigned to a specific session.
|
|
82
317
|
*/
|
|
83
318
|
export declare function updateSessionTaskStatus(meshId: string, sessionId: string, status: MeshTaskStatus, opts?: {
|
|
84
319
|
occurredAt?: string;
|
|
320
|
+
taskId?: string;
|
|
85
321
|
}): MeshWorkQueueEntry | null;
|
|
322
|
+
/**
|
|
323
|
+
* M1-3: true when at least one pending task is waiting on the given task.
|
|
324
|
+
* Used by the completion event path to decide whether to wake the queue.
|
|
325
|
+
*/
|
|
326
|
+
export declare function hasPendingDependents(meshId: string, taskId: string): boolean;
|
|
327
|
+
/**
|
|
328
|
+
* M1-4: view-time dependency state for a task — unmet dependency ids and
|
|
329
|
+
* whether the task is currently claimable from a dependency standpoint.
|
|
330
|
+
* Not stored (truth stays in task statuses).
|
|
331
|
+
*/
|
|
332
|
+
export declare function describeTaskDependencyState(entry: Pick<MeshWorkQueueEntry, 'dependsOn' | 'blockedReason'>, statusById: Map<string, MeshTaskStatus | string>): {
|
|
333
|
+
waitingOn: string[];
|
|
334
|
+
dependenciesSatisfied: boolean;
|
|
335
|
+
};
|
|
86
336
|
export interface MeshWorkQueueStats {
|
|
87
337
|
total: number;
|
|
88
338
|
active: number;
|
|
@@ -107,3 +357,48 @@ export interface MeshWorkQueueStats {
|
|
|
107
357
|
* Return aggregate queue statistics for the given mesh.
|
|
108
358
|
*/
|
|
109
359
|
export declare function getMeshQueueStats(meshId: string): MeshWorkQueueStats;
|
|
360
|
+
export declare function __replaceMeshQueueForTests(meshId: string, queue: MeshWorkQueueEntry[]): void;
|
|
361
|
+
export declare function __clearMeshQueueForTests(meshId: string): void;
|
|
362
|
+
export declare function __clearDirectDispatchesForTests(meshId: string): void;
|
|
363
|
+
export declare function __resetMeshRuntimeStoreForTests(): void;
|
|
364
|
+
export type DirectDispatchRecord = ReturnType<MeshRuntimeStore['getActiveDirectDispatches']>[number];
|
|
365
|
+
export declare function insertDirectDispatch(meshId: string, data: {
|
|
366
|
+
taskId: string;
|
|
367
|
+
nodeId?: string;
|
|
368
|
+
sessionId?: string;
|
|
369
|
+
providerType?: string;
|
|
370
|
+
message: string;
|
|
371
|
+
taskMode?: string;
|
|
372
|
+
via: string;
|
|
373
|
+
dispatchedToIdleSession?: boolean;
|
|
374
|
+
dispatchedAt: string;
|
|
375
|
+
}): void;
|
|
376
|
+
export declare function getActiveDirectDispatches(meshId: string): DirectDispatchRecord[];
|
|
377
|
+
export declare function updateDirectDispatchStatus(meshId: string, sessionId: string, status: 'acked' | 'completed' | 'failed' | 'stale', taskId?: string): void;
|
|
378
|
+
export declare function cleanupTerminalDirectDispatches(olderThanMs?: number): void;
|
|
379
|
+
export declare function markStaleDirectDispatches(meshId: string, olderThanMs?: number): void;
|
|
380
|
+
/**
|
|
381
|
+
* Delete specific direct dispatch rows by taskId. Returns the number of rows deleted.
|
|
382
|
+
* Used by the staleDirect prune path to evict orphaned/terminal dispatch records from the
|
|
383
|
+
* active staleDirect surface while leaving the append-only mesh ledger (audit history) intact.
|
|
384
|
+
*/
|
|
385
|
+
export declare function deleteDirectDispatchesByTaskId(meshId: string, taskIds: string[]): number;
|
|
386
|
+
export type MeshToolCallRateResult = {
|
|
387
|
+
rateLimitExceeded: boolean;
|
|
388
|
+
callsInWindow: number;
|
|
389
|
+
advisory: string | null;
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* Record a coordinator tool call and return a rate-limit advisory when the
|
|
393
|
+
* call rate for that tool exceeds the allowed threshold.
|
|
394
|
+
*
|
|
395
|
+
* Defaults: 10-second sliding window, max 5 calls before advisory is raised.
|
|
396
|
+
* Returns { rateLimitExceeded: false } on any store error so callers are not blocked.
|
|
397
|
+
*/
|
|
398
|
+
export declare function recordMeshToolCall(opts: {
|
|
399
|
+
meshId: string;
|
|
400
|
+
tool: string;
|
|
401
|
+
sessionId?: string | null;
|
|
402
|
+
windowMs?: number;
|
|
403
|
+
maxCalls?: number;
|
|
404
|
+
}): MeshToolCallRateResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type PreviewFreshnessStatus = 'fresh' | 'stale' | 'unknown' | 'not_configured';
|
|
2
|
+
export interface PreviewFreshness {
|
|
3
|
+
status: PreviewFreshnessStatus;
|
|
4
|
+
lastPreviewCommit: string | null;
|
|
5
|
+
currentMainCommit: string | null;
|
|
6
|
+
currentMainCommitSource: 'origin/main' | 'HEAD' | 'unknown';
|
|
7
|
+
recordPath: string;
|
|
8
|
+
lastDeployedAt?: string;
|
|
9
|
+
lastTarget?: string;
|
|
10
|
+
previewVersion?: string;
|
|
11
|
+
targets: Record<'npm' | 'server' | 'web', {
|
|
12
|
+
commit: string | null;
|
|
13
|
+
deployedAt?: string;
|
|
14
|
+
status: PreviewFreshnessStatus;
|
|
15
|
+
}>;
|
|
16
|
+
nextAction: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function buildPreviewFreshness(repoRoot: string): PreviewFreshness;
|