@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,428 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mesh refine validation gates & gitlink fast-forward evaluation
|
|
3
|
+
*
|
|
4
|
+
* Extracted from commands/router.ts (behavior-preserving move). Contains:
|
|
5
|
+
* - the MeshCoordinator config-format type
|
|
6
|
+
* - refine validation / patch-equivalence / effective-diff / submodule
|
|
7
|
+
* reachability gates and their summary types + job handles
|
|
8
|
+
* - gitlink trivial-fast-forward evaluation and submodule alignment helpers
|
|
9
|
+
*
|
|
10
|
+
* router.ts re-exports every public symbol from here so existing import paths
|
|
11
|
+
* keep working. `CommandRouterResult` is imported type-only from router.ts
|
|
12
|
+
* (erased at compile time — no runtime import cycle).
|
|
13
|
+
*/
|
|
14
|
+
import type { WorktreeBootstrapState } from '../mesh/worktree-bootstrap-config.js';
|
|
15
|
+
import type { CommandRouterResult } from '../commands/router.js';
|
|
16
|
+
export type MeshCoordinatorConfigFormat = 'claude_mcp_json' | 'hermes_config_yaml';
|
|
17
|
+
type MeshRefineValidationStatus = 'passed' | 'failed' | 'skipped';
|
|
18
|
+
type MeshRefineValidationSummary = {
|
|
19
|
+
status: MeshRefineValidationStatus;
|
|
20
|
+
required: true;
|
|
21
|
+
commandsRun: Array<Record<string, unknown>>;
|
|
22
|
+
bootstrapCommandsRun: Array<Record<string, unknown>>;
|
|
23
|
+
rejectedCommands: Array<Record<string, unknown>>;
|
|
24
|
+
skippedReason?: string;
|
|
25
|
+
failureKind?: string;
|
|
26
|
+
failureCode?: string;
|
|
27
|
+
/** Human-readable cause when failureKind === 'spawn_resolution_failed' (win32 .cmd shim, etc). */
|
|
28
|
+
spawnResolutionError?: string;
|
|
29
|
+
timeoutMs: number;
|
|
30
|
+
outputLimitBytes: number;
|
|
31
|
+
configSource?: string;
|
|
32
|
+
configSourceType?: string;
|
|
33
|
+
suggestions?: unknown[];
|
|
34
|
+
suggestedConfig?: unknown;
|
|
35
|
+
/**
|
|
36
|
+
* M2-3: the bootstrap stage recorded separately from validation so review
|
|
37
|
+
* surfaces can distinguish environment failures from validation failures.
|
|
38
|
+
* cached — worktree_bootstrap was 'ready' (staleInputs unchanged), skipped
|
|
39
|
+
* ran — worktree_bootstrap was stale/never-ran and re-ran successfully
|
|
40
|
+
* failed — bootstrap run failed (refine stops before validation)
|
|
41
|
+
* skipped — refine config validation.bootstrap === 'skip'
|
|
42
|
+
* legacy — deprecated validation.bootstrapCommands path was used
|
|
43
|
+
* not_configured — no bootstrap definition anywhere
|
|
44
|
+
*/
|
|
45
|
+
bootstrap?: {
|
|
46
|
+
stage: 'cached' | 'ran' | 'failed' | 'skipped' | 'legacy' | 'not_configured';
|
|
47
|
+
status?: string;
|
|
48
|
+
skipped?: boolean;
|
|
49
|
+
configSource?: string;
|
|
50
|
+
staleReason?: string;
|
|
51
|
+
error?: string;
|
|
52
|
+
commandsRun?: Array<Record<string, unknown>>;
|
|
53
|
+
};
|
|
54
|
+
/** M2-2: deprecation notices from the refine config (e.g. bootstrapCommands). */
|
|
55
|
+
deprecationWarnings?: string[];
|
|
56
|
+
};
|
|
57
|
+
type MeshRefineStageStatus = 'passed' | 'failed' | 'skipped';
|
|
58
|
+
type MeshRefinePatchEquivalenceSummary = {
|
|
59
|
+
status: MeshRefineStageStatus;
|
|
60
|
+
equivalent: boolean;
|
|
61
|
+
baseHead: string;
|
|
62
|
+
branchHead: string;
|
|
63
|
+
mergeBase?: string;
|
|
64
|
+
mergedTree?: string;
|
|
65
|
+
expectedPatchId?: string;
|
|
66
|
+
actualPatchId?: string;
|
|
67
|
+
durationMs: number;
|
|
68
|
+
error?: string;
|
|
69
|
+
stdout?: string;
|
|
70
|
+
stderr?: string;
|
|
71
|
+
actionableHint?: MeshRefineSubmoduleConflictHint;
|
|
72
|
+
/**
|
|
73
|
+
* Set when a `merge-tree` submodule conflict was reclassified as a trivial
|
|
74
|
+
* gitlink fast-forward and the gate passed via a synthesized merge tree.
|
|
75
|
+
*/
|
|
76
|
+
gitlinkTrivialFastForward?: {
|
|
77
|
+
resolved: boolean;
|
|
78
|
+
gitlinks: Array<{
|
|
79
|
+
path: string;
|
|
80
|
+
baseCommit?: string;
|
|
81
|
+
branchCommit?: string;
|
|
82
|
+
fastForward: boolean;
|
|
83
|
+
}>;
|
|
84
|
+
reason?: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
type MeshRefineEffectiveDiffSummary = {
|
|
88
|
+
status: MeshRefineStageStatus;
|
|
89
|
+
/** True when there is at least one root-tree change between base and branch (incl. gitlink bumps). */
|
|
90
|
+
hasEffectiveDiff: boolean;
|
|
91
|
+
baseHead: string;
|
|
92
|
+
branchHead: string;
|
|
93
|
+
/** Root-level paths that differ between base and branch (capped). */
|
|
94
|
+
changedPaths?: string[];
|
|
95
|
+
/** Submodule paths with uncommitted/divergent commits but NO committed gitlink bump in the root tree. */
|
|
96
|
+
submoduleHints?: Array<{
|
|
97
|
+
path: string;
|
|
98
|
+
reason: string;
|
|
99
|
+
}>;
|
|
100
|
+
durationMs: number;
|
|
101
|
+
error?: string;
|
|
102
|
+
stdout?: string;
|
|
103
|
+
stderr?: string;
|
|
104
|
+
};
|
|
105
|
+
type MeshRefineSubmoduleConflictHint = {
|
|
106
|
+
kind: 'submodule_conflict';
|
|
107
|
+
message: string;
|
|
108
|
+
conflicts: Array<{
|
|
109
|
+
path: string;
|
|
110
|
+
baseCommit?: string;
|
|
111
|
+
branchCommit?: string;
|
|
112
|
+
}>;
|
|
113
|
+
nextSteps: string[];
|
|
114
|
+
};
|
|
115
|
+
type MeshRefineSubmoduleAlignmentSummary = {
|
|
116
|
+
status: 'passed' | 'failed' | 'skipped';
|
|
117
|
+
changedGitlinkPaths: string[];
|
|
118
|
+
outOfSyncPaths: string[];
|
|
119
|
+
updatedPaths: string[];
|
|
120
|
+
verifiedPaths: string[];
|
|
121
|
+
durationMs: number;
|
|
122
|
+
reason?: string;
|
|
123
|
+
command?: string;
|
|
124
|
+
error?: string;
|
|
125
|
+
stdout?: string;
|
|
126
|
+
stderr?: string;
|
|
127
|
+
};
|
|
128
|
+
type MeshRefineSubmoduleReachabilityEntry = {
|
|
129
|
+
path: string;
|
|
130
|
+
commit: string;
|
|
131
|
+
reachable: boolean;
|
|
132
|
+
publishRequired?: boolean;
|
|
133
|
+
autoPublishAllowed?: boolean;
|
|
134
|
+
autoPublishAttempted?: boolean;
|
|
135
|
+
autoPublishSucceeded?: boolean;
|
|
136
|
+
autoPublishVerified?: boolean;
|
|
137
|
+
autoPublishRefspec?: string;
|
|
138
|
+
autoPublishSkippedReason?: string;
|
|
139
|
+
importedFromWorktree?: boolean;
|
|
140
|
+
checkedLocal?: boolean;
|
|
141
|
+
localReachable?: boolean;
|
|
142
|
+
remote?: string;
|
|
143
|
+
remoteUrl?: string;
|
|
144
|
+
remoteReachable?: boolean;
|
|
145
|
+
remoteMainBranch?: string;
|
|
146
|
+
remoteMainReachable?: boolean;
|
|
147
|
+
fetchedFromOrigin?: boolean;
|
|
148
|
+
error?: string;
|
|
149
|
+
publishStdout?: string;
|
|
150
|
+
publishStderr?: string;
|
|
151
|
+
};
|
|
152
|
+
type MeshRefineSubmoduleReachabilitySummary = {
|
|
153
|
+
status: MeshRefineStageStatus;
|
|
154
|
+
checked: number;
|
|
155
|
+
unreachable: MeshRefineSubmoduleReachabilityEntry[];
|
|
156
|
+
entries: MeshRefineSubmoduleReachabilityEntry[];
|
|
157
|
+
durationMs: number;
|
|
158
|
+
autoPublishAllowed?: boolean;
|
|
159
|
+
autoPublishPolicySource?: string;
|
|
160
|
+
error?: string;
|
|
161
|
+
};
|
|
162
|
+
export type MeshRefineAsyncJobStatus = 'accepted' | 'completed' | 'failed';
|
|
163
|
+
export type MeshRefineJobHandle = {
|
|
164
|
+
success: true;
|
|
165
|
+
async: true;
|
|
166
|
+
status: MeshRefineAsyncJobStatus;
|
|
167
|
+
jobId: string;
|
|
168
|
+
interactionId: string;
|
|
169
|
+
meshId: string;
|
|
170
|
+
nodeId: string;
|
|
171
|
+
targetNodeId: string;
|
|
172
|
+
targetDaemonId?: string;
|
|
173
|
+
workspace?: string;
|
|
174
|
+
startedAt: string;
|
|
175
|
+
completedAt?: string;
|
|
176
|
+
duplicate?: boolean;
|
|
177
|
+
retryOfJobId?: string;
|
|
178
|
+
/**
|
|
179
|
+
* The coordinator daemon ID that initiated this refine job.
|
|
180
|
+
* When set, events for this job are scoped to that coordinator's
|
|
181
|
+
* pending-events queue instead of the shared broadcast queue.
|
|
182
|
+
*/
|
|
183
|
+
targetCoordinatorDaemonId?: string;
|
|
184
|
+
eventDelivery: {
|
|
185
|
+
pendingEvents: true;
|
|
186
|
+
ledger: true;
|
|
187
|
+
};
|
|
188
|
+
evidence: {
|
|
189
|
+
pendingEventsCommand: 'get_pending_mesh_events';
|
|
190
|
+
ledgerCommand: 'get_mesh_ledger_slice';
|
|
191
|
+
taskHistoryKind: 'task_dispatched' | 'task_completed' | 'task_failed';
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
export type MeshRefineTerminalJob = MeshRefineJobHandle & {
|
|
195
|
+
result?: Record<string, unknown>;
|
|
196
|
+
};
|
|
197
|
+
export type MeshRefineBatchJobStatus = 'accepted' | 'completed' | 'failed';
|
|
198
|
+
/**
|
|
199
|
+
* Async handle returned by the batch Refinery the instant a convergence run is
|
|
200
|
+
* accepted. Mirrors {@link MeshRefineJobHandle} (async:true / status:'accepted' +
|
|
201
|
+
* terminal pending-event + ledger delivery) but scopes a whole batch of sibling
|
|
202
|
+
* nodes rather than a single node. The synthetic `batchLabel` is used as the
|
|
203
|
+
* `nodeLabel` for the shared refine event/message renderer.
|
|
204
|
+
*/
|
|
205
|
+
export type MeshRefineBatchJobHandle = {
|
|
206
|
+
success: true;
|
|
207
|
+
async: true;
|
|
208
|
+
batch: true;
|
|
209
|
+
status: MeshRefineBatchJobStatus;
|
|
210
|
+
jobId: string;
|
|
211
|
+
interactionId: string;
|
|
212
|
+
meshId: string;
|
|
213
|
+
batchLabel: string;
|
|
214
|
+
nodeIds: string[];
|
|
215
|
+
nodeCount: number;
|
|
216
|
+
order: string[];
|
|
217
|
+
startedAt: string;
|
|
218
|
+
completedAt?: string;
|
|
219
|
+
duplicate?: boolean;
|
|
220
|
+
targetCoordinatorDaemonId?: string;
|
|
221
|
+
eventDelivery: {
|
|
222
|
+
pendingEvents: true;
|
|
223
|
+
ledger: true;
|
|
224
|
+
};
|
|
225
|
+
evidence: {
|
|
226
|
+
pendingEventsCommand: 'get_pending_mesh_events';
|
|
227
|
+
ledgerCommand: 'get_mesh_ledger_slice';
|
|
228
|
+
taskHistoryKind: 'task_dispatched' | 'task_completed' | 'task_failed';
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
export type MeshRefineBatchTerminalJob = MeshRefineBatchJobHandle & {
|
|
232
|
+
result?: Record<string, unknown>;
|
|
233
|
+
};
|
|
234
|
+
export declare function truncateValidationOutput(value: unknown): string;
|
|
235
|
+
/**
|
|
236
|
+
* A spawn-resolution failure is when the executable itself could not be found by
|
|
237
|
+
* the OS spawn boundary — `spawn <cmd> ENOENT` — as opposed to the command
|
|
238
|
+
* running and exiting non-zero. On win32 this is the .cmd-shim case: libuv's
|
|
239
|
+
* spawn search appends only .com/.exe, so a bare `npm`/`npx`/`tsc` (which are
|
|
240
|
+
* .cmd shims) ENOENTs even though it is installed. It carries no stderr, so it
|
|
241
|
+
* must be detected by error.code/syscall, not by string-matching output.
|
|
242
|
+
*/
|
|
243
|
+
export declare function isSpawnResolutionError(error: any): boolean;
|
|
244
|
+
export declare function describeSpawnError(error: any, command: string, spawnResolutionFailed: boolean): string;
|
|
245
|
+
export declare function recordMeshRefineStage(stages: Array<Record<string, unknown>>, stage: string, status: MeshRefineStageStatus, startedAt: number, details?: Record<string, unknown>): void;
|
|
246
|
+
export declare function buildSubmodulePublishRequiredNextStep(entries: MeshRefineSubmoduleReachabilityEntry[]): string;
|
|
247
|
+
/**
|
|
248
|
+
* Async git exec helper used across the synchronous-refine stage pipeline. Bound
|
|
249
|
+
* once in the orchestrator and threaded through RefineContext so every stage runs
|
|
250
|
+
* git the same way (execFile + promisify, utf8). Returns the child's stdout/stderr.
|
|
251
|
+
*/
|
|
252
|
+
export type RefineExecFileAsync = (file: string, args: string[], options: {
|
|
253
|
+
cwd: string;
|
|
254
|
+
encoding: 'utf8';
|
|
255
|
+
}) => Promise<{
|
|
256
|
+
stdout: string;
|
|
257
|
+
stderr: string;
|
|
258
|
+
}>;
|
|
259
|
+
/**
|
|
260
|
+
* Accumulated state shared by the synchronous-refine stages. The orchestrator
|
|
261
|
+
* (executeMeshRefineNodeSynchronously) seeds this in the resolve_refs stage and
|
|
262
|
+
* each later stage reads / extends it. `branchHead` and `patchEquivalence` are the
|
|
263
|
+
* only fields a stage mutates after creation (auto-rebase updates both), so they
|
|
264
|
+
* are carried on the mutable context rather than re-threaded through return types.
|
|
265
|
+
*/
|
|
266
|
+
export interface RefineContext {
|
|
267
|
+
meshId: string;
|
|
268
|
+
nodeId: string;
|
|
269
|
+
args: any;
|
|
270
|
+
refineStages: Array<Record<string, unknown>>;
|
|
271
|
+
execFileAsync: RefineExecFileAsync;
|
|
272
|
+
mesh: any;
|
|
273
|
+
node: any;
|
|
274
|
+
sourceNode: any;
|
|
275
|
+
repoRoot: string;
|
|
276
|
+
branch: string;
|
|
277
|
+
baseBranch: string;
|
|
278
|
+
baseHead: string;
|
|
279
|
+
branchHead: string;
|
|
280
|
+
validationSummary: Awaited<ReturnType<typeof runMeshRefineValidationGate>>;
|
|
281
|
+
patchEquivalence: Awaited<ReturnType<typeof runMeshRefinePatchEquivalenceGate>>;
|
|
282
|
+
submoduleReachability: Awaited<ReturnType<typeof runMeshRefineSubmoduleReachabilityGate>>;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Stage outcome for the synchronous-refine pipeline. A stage either produces a
|
|
286
|
+
* terminal CommandRouterResult (an early-exit gate failure, or a successful
|
|
287
|
+
* already-merged short-circuit), in which case the orchestrator returns it
|
|
288
|
+
* immediately, or it returns `continue` with the (possibly extended) context for
|
|
289
|
+
* the next stage. This makes the orchestrator a flat sequence of stage calls
|
|
290
|
+
* while preserving the original body's exact early-return control flow.
|
|
291
|
+
*/
|
|
292
|
+
export type RefineStageOutcome = {
|
|
293
|
+
kind: 'terminal';
|
|
294
|
+
result: CommandRouterResult;
|
|
295
|
+
} | {
|
|
296
|
+
kind: 'continue';
|
|
297
|
+
ctx: RefineContext;
|
|
298
|
+
};
|
|
299
|
+
export declare function resolveRefineryAutoPublishSubmoduleMainCommits(mesh: any, workspace: string): {
|
|
300
|
+
enabled: boolean;
|
|
301
|
+
source?: string;
|
|
302
|
+
};
|
|
303
|
+
export declare function runMeshRefinePatchEquivalenceGate(repoRoot: string, baseHead: string, branchHead: string): Promise<MeshRefinePatchEquivalenceSummary>;
|
|
304
|
+
export type MeshWorktreePatchContainmentSummary = {
|
|
305
|
+
/** True only when merging worktreeHead into ref introduces no new patch. */
|
|
306
|
+
contained: boolean;
|
|
307
|
+
ref: string;
|
|
308
|
+
worktreeHead: string;
|
|
309
|
+
mergeBase?: string;
|
|
310
|
+
mergedTree?: string;
|
|
311
|
+
/** patch-id of (ref -> synthesized merge tree); empty string when nothing new is added. */
|
|
312
|
+
residualPatchId?: string;
|
|
313
|
+
durationMs: number;
|
|
314
|
+
/** Set when the check could not run (treated conservatively as NOT contained). */
|
|
315
|
+
error?: string;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Patch-equivalence containment check for the worktree force-cleanup convergence
|
|
319
|
+
* guard. Answers a narrower question than {@link runMeshRefinePatchEquivalenceGate}:
|
|
320
|
+
* "are the worktree branch's changes ALREADY present in `ref` (e.g. origin/main),
|
|
321
|
+
* even though the worktree HEAD's commit SHA is not an ancestor of ref?"
|
|
322
|
+
*
|
|
323
|
+
* This is the cherry-pick / squash / rebase case: the same content landed on the
|
|
324
|
+
* default ref under a different commit SHA, so `merge-base --is-ancestor` (the
|
|
325
|
+
* primary cleanup guard) reports the worktree as un-converged and refuses to
|
|
326
|
+
* remove it. Refinery already accepts patch-equivalent landings via merge-tree +
|
|
327
|
+
* patch-id; this brings the same notion of "convergence" to the cleanup guard.
|
|
328
|
+
*
|
|
329
|
+
* Mechanism: synthesize the merge of `worktreeHead` into `ref` (reusing the same
|
|
330
|
+
* trivial-gitlink-fast-forward handling as the refine gate) and compute the
|
|
331
|
+
* patch-id of (ref -> mergedTree). If that residual diff is EMPTY, merging the
|
|
332
|
+
* worktree adds nothing new on top of ref — its changes are already present there
|
|
333
|
+
* and the worktree is safe to remove. A non-empty residual means the worktree
|
|
334
|
+
* still carries content not in ref, so it is NOT contained and must stay blocked.
|
|
335
|
+
*
|
|
336
|
+
* Conservative by construction: any merge-tree / patch-id failure, a genuine
|
|
337
|
+
* (non-trivial) submodule conflict, or any thrown error yields `contained: false`
|
|
338
|
+
* so an exception can never widen the cleanup allow-list.
|
|
339
|
+
*/
|
|
340
|
+
export declare function checkWorktreeChangesPatchEquivalentInRef(repoRoot: string, ref: string, worktreeHead: string): Promise<MeshWorktreePatchContainmentSummary>;
|
|
341
|
+
/**
|
|
342
|
+
* No-op guard: detect a "silent no-op" merge before the Refinery merge runs.
|
|
343
|
+
*
|
|
344
|
+
* A silent no-op occurs when the refine target branch's ROOT tree is byte-identical
|
|
345
|
+
* to the merge base (origin/main). This is the trap where a submodule (e.g. oss) has
|
|
346
|
+
* real commits but the root branch never committed the gitlink (oss-pointer) bump, so
|
|
347
|
+
* the root diff Refinery would merge is empty. Merging that produces a merge commit with
|
|
348
|
+
* no content change — reported as "success" while the actual work never reaches main.
|
|
349
|
+
*
|
|
350
|
+
* A committed gitlink bump (the legitimate oss-pointer bump) DOES show up in the root
|
|
351
|
+
* tree diff (as a 160000-mode entry), so this guard does NOT block legitimate refines —
|
|
352
|
+
* it only fires when the root tree diff vs base is COMPLETELY empty.
|
|
353
|
+
*
|
|
354
|
+
* Runs after the patch-equivalence gate; the "already merged via other path" case
|
|
355
|
+
* (branch has real changes already present in base) is handled upstream and never
|
|
356
|
+
* reaches here, so an empty root diff at this point is genuinely a no-op.
|
|
357
|
+
*/
|
|
358
|
+
export declare function runMeshRefineEffectiveDiffGate(repoRoot: string, baseHead: string, branchHead: string): Promise<MeshRefineEffectiveDiffSummary>;
|
|
359
|
+
/**
|
|
360
|
+
* Result of evaluating whether a `git merge-tree --write-tree` submodule
|
|
361
|
+
* conflict is in fact a trivial gitlink fast-forward that should pass the
|
|
362
|
+
* patch-equivalence gate.
|
|
363
|
+
*
|
|
364
|
+
* `git merge-tree` (and `git merge` with the default recursive strategy)
|
|
365
|
+
* refuses to 3-way merge gitlinks unless the case is "trivial" — and it
|
|
366
|
+
* treats *any* gitlink that differs across merge-base/base/branch as
|
|
367
|
+
* non-trivial, even when the branch-side commit is a strict descendant of the
|
|
368
|
+
* base-side commit (i.e. a real fast-forward). Refinery only ever wants to
|
|
369
|
+
* accept the branch's recorded gitlink, so a fast-forwardable bump is safe to
|
|
370
|
+
* resolve to the branch side without any conflict.
|
|
371
|
+
*/
|
|
372
|
+
type GitlinkTrivialFastForwardEvaluation = {
|
|
373
|
+
/** True only when the merge-tree conflict is *fully* explained by trivial-ff gitlinks. */
|
|
374
|
+
trivial: boolean;
|
|
375
|
+
/** Why the evaluation declined to treat the conflict as trivial (set when trivial=false). */
|
|
376
|
+
reason?: string;
|
|
377
|
+
/** Per-path detail for the changed gitlinks that were inspected. */
|
|
378
|
+
gitlinks: Array<{
|
|
379
|
+
path: string;
|
|
380
|
+
baseCommit?: string;
|
|
381
|
+
branchCommit?: string;
|
|
382
|
+
fastForward: boolean;
|
|
383
|
+
}>;
|
|
384
|
+
};
|
|
385
|
+
/**
|
|
386
|
+
* Return the changed gitlink paths between base and branch whose advance is a
|
|
387
|
+
* strict fast-forward (the base-side commit is an ancestor of the branch-side
|
|
388
|
+
* commit inside that submodule's repo). These are the paths whose patch-id hunk
|
|
389
|
+
* may legitimately differ when base has advanced the same submodule, so they
|
|
390
|
+
* are safe to exclude from the patch-equivalence comparison. A non-ff (genuinely
|
|
391
|
+
* diverged) gitlink is deliberately excluded from this set so it still fails the
|
|
392
|
+
* gate.
|
|
393
|
+
*/
|
|
394
|
+
export declare function collectFastForwardGitlinkPaths(repoRoot: string, baseHead: string, branchHead: string): string[];
|
|
395
|
+
/**
|
|
396
|
+
* Decide whether a merge-tree submodule conflict between base and branch is a
|
|
397
|
+
* trivial gitlink fast-forward (and nothing else).
|
|
398
|
+
*
|
|
399
|
+
* The conflict is treated as trivial ONLY when:
|
|
400
|
+
* 1. at least one changed gitlink exists,
|
|
401
|
+
* 2. every changed gitlink fast-forwards (base-commit is an ancestor of the
|
|
402
|
+
* branch-commit inside that submodule's repo), and
|
|
403
|
+
* 3. the *only* paths that changed on both sides of the merge (i.e. the paths
|
|
404
|
+
* that could possibly produce a 3-way conflict — the intersection of
|
|
405
|
+
* mergeBase→base and mergeBase→branch changes) are gitlinks. Any
|
|
406
|
+
* overlapping non-gitlink path means a genuine content conflict could be
|
|
407
|
+
* hiding behind the submodule failure, so we keep the block.
|
|
408
|
+
*
|
|
409
|
+
* If any of these fail, the conflict is left as a genuine block. This never
|
|
410
|
+
* passes a regular-file conflict or a diverged (non-ff) gitlink.
|
|
411
|
+
*/
|
|
412
|
+
export declare function evaluateGitlinkTrivialFastForward(repoRoot: string, baseHead: string, branchHead: string): GitlinkTrivialFastForwardEvaluation;
|
|
413
|
+
export declare function alignRefinerySubmodulesAfterMerge(repoRoot: string, previousBaseHead: string, currentHead: string, options?: {
|
|
414
|
+
submoduleIgnorePaths?: string[];
|
|
415
|
+
}): Promise<MeshRefineSubmoduleAlignmentSummary>;
|
|
416
|
+
export declare function runMeshRefineSubmoduleReachabilityGate(repoRoot: string, mergedTree: string, options?: {
|
|
417
|
+
allowAutoPublishSubmoduleMainCommits?: boolean;
|
|
418
|
+
autoPublishPolicySource?: string;
|
|
419
|
+
worktreeRoot?: string;
|
|
420
|
+
}): Promise<MeshRefineSubmoduleReachabilitySummary>;
|
|
421
|
+
export declare function buildMeshRefineValidationPlan(mesh: any, workspace: string): Record<string, unknown>;
|
|
422
|
+
export declare function runMeshRefineValidationGate(mesh: any, workspace: string, opts?: {
|
|
423
|
+
/** M2-2: persisted node bootstrap state for staleness evaluation. */
|
|
424
|
+
persistedBootstrapState?: WorktreeBootstrapState | null;
|
|
425
|
+
/** M2-2: called after an inherit-mode bootstrap run so the caller can persist the new state. */
|
|
426
|
+
onBootstrapStateChange?: (state: WorktreeBootstrapState) => void;
|
|
427
|
+
}): Promise<MeshRefineValidationSummary>;
|
|
428
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { MeshLedgerEntry } from './mesh-ledger.js';
|
|
2
|
+
import type { PendingMeshCoordinatorEvent } from './mesh-events.js';
|
|
3
|
+
import type { MeshAsyncJobLifecycle } from '../repo-mesh-types.js';
|
|
4
|
+
export type MeshAsyncRefineJobStatus = 'accepted' | 'running' | 'completed' | 'failed';
|
|
5
|
+
export interface MeshAsyncRefineJobSummary extends MeshAsyncJobLifecycle {
|
|
6
|
+
jobId: string;
|
|
7
|
+
interactionId?: string;
|
|
8
|
+
status: MeshAsyncRefineJobStatus;
|
|
9
|
+
meshId?: string;
|
|
10
|
+
nodeId?: string;
|
|
11
|
+
targetNodeId?: string;
|
|
12
|
+
targetDaemonId?: string;
|
|
13
|
+
workspace?: string;
|
|
14
|
+
branch?: string;
|
|
15
|
+
into?: string;
|
|
16
|
+
retryOfJobId?: string;
|
|
17
|
+
lastEvent?: string;
|
|
18
|
+
lastLedgerKind?: string;
|
|
19
|
+
lastUpdatedAt?: string;
|
|
20
|
+
instruction: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function buildMeshAsyncRefineJobs(args: {
|
|
23
|
+
meshId?: string;
|
|
24
|
+
ledgerEntries?: MeshLedgerEntry[];
|
|
25
|
+
pendingEvents?: PendingMeshCoordinatorEvent[];
|
|
26
|
+
}): MeshAsyncRefineJobSummary[];
|
|
27
|
+
/** Terminal refine jobs older than this (relative to the newest job in the set) are
|
|
28
|
+
* "stale" — already-resolved historical refinery rejections/successes that should not
|
|
29
|
+
* keep inflating the status counts in mesh_status. 6h covers a long working session
|
|
30
|
+
* while still folding multi-day-old residue. */
|
|
31
|
+
export declare const STALE_TERMINAL_REFINE_WINDOW_MS: number;
|
|
32
|
+
/** Cap on how many recent terminal jobs are counted even if all fall inside the freshness
|
|
33
|
+
* window — prevents a burst of refines from dominating the summary. */
|
|
34
|
+
export declare const RECENT_TERMINAL_REFINE_CAP = 8;
|
|
35
|
+
export interface MeshAsyncRefineJobsSummary {
|
|
36
|
+
/** Count of jobs reflected in `byStatus` (active jobs + recent terminal jobs). */
|
|
37
|
+
total: number;
|
|
38
|
+
byStatus: Record<string, number>;
|
|
39
|
+
/** Terminal jobs dropped from the counts because they are stale residue. */
|
|
40
|
+
staleTerminal: number;
|
|
41
|
+
/** Non-terminal (accepted/running) jobs still in flight. */
|
|
42
|
+
activeJobs: MeshAsyncRefineJobSummary[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Build a compact summary of refine jobs that folds stale terminal jobs.
|
|
46
|
+
*
|
|
47
|
+
* The full job list (from `buildMeshAsyncRefineJobs`) is derived from a recent ledger
|
|
48
|
+
* window and deduped by jobId, but it still includes every terminal (completed/failed)
|
|
49
|
+
* job that happens to fall in that window — including multi-day-old refinery rejections
|
|
50
|
+
* that have long since been resolved. Those stale terminals inflate `byStatus.failed`
|
|
51
|
+
* and read as "current breakage" when they are historical noise.
|
|
52
|
+
*
|
|
53
|
+
* Active (accepted/running) jobs are always counted. Terminal jobs are counted only when
|
|
54
|
+
* they are recent: within `STALE_TERMINAL_REFINE_WINDOW_MS` of the newest job's activity
|
|
55
|
+
* time AND among the `RECENT_TERMINAL_REFINE_CAP` most-recent terminals. Everything else
|
|
56
|
+
* is folded into `staleTerminal` and excluded from `byStatus`.
|
|
57
|
+
*
|
|
58
|
+
* Freshness is measured relative to the newest job in the set (not wall-clock), so the
|
|
59
|
+
* result is deterministic for a given input — important for tests and for stale-clock
|
|
60
|
+
* environments.
|
|
61
|
+
*/
|
|
62
|
+
export declare function summarizeMeshAsyncRefineJobs(jobs: MeshAsyncRefineJobSummary[]): MeshAsyncRefineJobsSummary;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M4.0: Review inbox — derive review items from existing truth.
|
|
3
|
+
*
|
|
4
|
+
* No new store: review items are a query-time projection of
|
|
5
|
+
* - mesh_status node statuses (daemon-owned branchConvergence), and
|
|
6
|
+
* - the task ledger (completion evidence envelopes + refine job results).
|
|
7
|
+
*
|
|
8
|
+
* Scope (M4.0): host-daemon-local nodes only. Remote nodes are excluded and
|
|
9
|
+
* surfaced via remoteNodesExcluded/excludedRemoteNodeIds until the
|
|
10
|
+
* daemon↔daemon P2P relay path is live-verified (M4.2).
|
|
11
|
+
*/
|
|
12
|
+
import type { MeshLedgerEntry } from './mesh-ledger.js';
|
|
13
|
+
export type MeshReviewInboxReason = 'merge_candidate' | 'refine_blocked_review';
|
|
14
|
+
export interface MeshReviewInboxConvergence {
|
|
15
|
+
status: string;
|
|
16
|
+
reason: string | null;
|
|
17
|
+
nextStep: string | null;
|
|
18
|
+
needsConvergence: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface MeshReviewInboxEvidence {
|
|
21
|
+
available: boolean;
|
|
22
|
+
/** Ledger kind of the entry the evidence came from. */
|
|
23
|
+
kind?: 'task_completed' | 'task_failed';
|
|
24
|
+
/** 'task_completion' = ordinary worker completion envelope; 'refine_job' = Refinery result. */
|
|
25
|
+
source?: 'task_completion' | 'refine_job';
|
|
26
|
+
timestamp?: string;
|
|
27
|
+
taskId?: string;
|
|
28
|
+
sessionId?: string;
|
|
29
|
+
/** M2-3 bootstrap stage from the refine validation gate: cached|ran|failed|skipped|legacy|not_configured. */
|
|
30
|
+
bootstrap?: Record<string, unknown> | null;
|
|
31
|
+
validation?: Record<string, unknown> | null;
|
|
32
|
+
checkpoint?: Record<string, unknown> | null;
|
|
33
|
+
worker?: {
|
|
34
|
+
status: string;
|
|
35
|
+
classification?: string;
|
|
36
|
+
changedFiles: string[];
|
|
37
|
+
changedFilesTruncated?: true;
|
|
38
|
+
validationResults: Array<Record<string, unknown>>;
|
|
39
|
+
errors: string[];
|
|
40
|
+
requiresUserAction: boolean;
|
|
41
|
+
} | null;
|
|
42
|
+
finalBranchConvergenceState?: Record<string, unknown>;
|
|
43
|
+
refineJob?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
export interface MeshReviewInboxDiffFile {
|
|
46
|
+
path: string;
|
|
47
|
+
status?: string;
|
|
48
|
+
insertions?: number;
|
|
49
|
+
deletions?: number;
|
|
50
|
+
binary?: boolean;
|
|
51
|
+
oldPath?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface MeshReviewInboxDiffSummary {
|
|
54
|
+
baseRef: string;
|
|
55
|
+
files: MeshReviewInboxDiffFile[];
|
|
56
|
+
totalFiles: number;
|
|
57
|
+
totalInsertions: number;
|
|
58
|
+
totalDeletions: number;
|
|
59
|
+
truncated: boolean;
|
|
60
|
+
error?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface MeshReviewInboxItem {
|
|
63
|
+
nodeId: string;
|
|
64
|
+
workspace: string | null;
|
|
65
|
+
branch: string | null;
|
|
66
|
+
defaultBranch: string | null;
|
|
67
|
+
isLocalWorktree: boolean;
|
|
68
|
+
reviewReason: MeshReviewInboxReason;
|
|
69
|
+
convergence: MeshReviewInboxConvergence;
|
|
70
|
+
evidence: MeshReviewInboxEvidence;
|
|
71
|
+
transcriptHandle: Record<string, unknown> | null;
|
|
72
|
+
/** Latest non-terminal Refinery job for this node (accepted/running), if any. */
|
|
73
|
+
activeRefineJob: Record<string, unknown> | null;
|
|
74
|
+
lastActivityAt: string | null;
|
|
75
|
+
/** Filled by the daemon command with a bounded base-branch diff probe; null when the workspace is not locally readable. */
|
|
76
|
+
diffSummary?: MeshReviewInboxDiffSummary | null;
|
|
77
|
+
}
|
|
78
|
+
export interface MeshReviewInboxDerivation {
|
|
79
|
+
items: MeshReviewInboxItem[];
|
|
80
|
+
remoteNodesExcluded: boolean;
|
|
81
|
+
excludedRemoteNodeIds: string[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Derive review inbox items from mesh_status node statuses and a bounded
|
|
85
|
+
* ledger tail. Pure and read-only; the caller attaches diffSummary separately.
|
|
86
|
+
*/
|
|
87
|
+
export declare function deriveMeshReviewInboxItems(args: {
|
|
88
|
+
nodes: Array<Record<string, unknown>>;
|
|
89
|
+
ledgerEntries: MeshLedgerEntry[];
|
|
90
|
+
}): MeshReviewInboxDerivation;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { DaemonComponents } from '../boot/daemon-lifecycle.js';
|
|
2
|
+
export type WorkerDelegateRejectionReason = 'not_cli' | 'no_workspace' | 'no_worker_envelope' | 'coordinator_not_dispatch_target' | 'mesh_unresolved';
|
|
3
|
+
export interface WorkerDelegateRouting {
|
|
4
|
+
/** True when the source session is a mesh worker whose events must route to a coordinator. */
|
|
5
|
+
isDelegate: boolean;
|
|
6
|
+
/** Resolved mesh id (runtime stamp, direct-dispatch recovery, or workspace lookup). */
|
|
7
|
+
meshId: string;
|
|
8
|
+
/** Resolved node id within the mesh, or '' when it cannot be determined. */
|
|
9
|
+
nodeId: string;
|
|
10
|
+
/** Human-readable node label for the coordinator system message. */
|
|
11
|
+
nodeLabel: string;
|
|
12
|
+
/** Coordinator daemon anchor (prefixed id) when the worker carries one; '' otherwise. */
|
|
13
|
+
coordinatorDaemonId: string;
|
|
14
|
+
/** Source session workspace (best-effort; '' when the session/workspace is missing). */
|
|
15
|
+
workspace: string;
|
|
16
|
+
/** Source session id echoed back, so diagnostics can name the dropped event's origin. */
|
|
17
|
+
sessionId: string;
|
|
18
|
+
/** Why routing was rejected (isDelegate=false), for fail-loud diagnostics (R4). */
|
|
19
|
+
rejectionReason?: WorkerDelegateRejectionReason;
|
|
20
|
+
}
|
|
21
|
+
interface ResolveDeps {
|
|
22
|
+
/** Resolve a mesh by id (local config + inline cache). */
|
|
23
|
+
getMeshById: (meshId: string) => any | undefined;
|
|
24
|
+
/** Resolve a mesh by workspace path (cached repo lookup). */
|
|
25
|
+
getMeshByWorkspace: (workspace: string) => any | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve how a source CLI session's mesh events should route to a coordinator.
|
|
29
|
+
*
|
|
30
|
+
* This is the single authoritative interpretation of the worker envelope. It folds
|
|
31
|
+
* together every signal that previously lived in inline branches:
|
|
32
|
+
* - runtime stamps (meshNodeFor / meshNodeId)
|
|
33
|
+
* - the coordinator anchor (meshCoordinatorDaemonId) and launch marker (launchedByCoordinator,
|
|
34
|
+
* meshCoordinatorNodeId) — any one proves delegation even if the node/mesh stamp was dropped
|
|
35
|
+
* - direct-dispatch recovery: a coordinator session that is itself a dispatch target
|
|
36
|
+
* - workspace→mesh fallback when no runtime mesh id survived
|
|
37
|
+
*
|
|
38
|
+
* Returns isDelegate=false (with a rejectionReason) instead of throwing, so the caller
|
|
39
|
+
* can either ignore non-delegate events or surface a diagnostic.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveWorkerDelegateRouting(components: DaemonComponents, instanceId: string, deps: ResolveDeps): WorkerDelegateRouting;
|
|
42
|
+
/** Ledger stream that collects delivery_unroutable diagnostics (no real mesh id exists for them). */
|
|
43
|
+
export declare const UNROUTABLE_DIAGNOSTIC_STREAM = "__unroutable__";
|
|
44
|
+
export declare function __resetUnroutableDiagnosticsForTests(): void;
|
|
45
|
+
/** True only for rejections that represent a silently-dropped delegate event worth a diagnostic. */
|
|
46
|
+
export declare function isUnroutableDelegateRejection(routing: WorkerDelegateRouting): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* R4: record that a worker event with a valid envelope could not be routed to a coordinator.
|
|
49
|
+
* Writes a `delivery_unroutable` ledger entry (deduped within a short window) so operators see
|
|
50
|
+
* WHY a completion never arrived instead of it vanishing. No-op for non-diagnostic rejections.
|
|
51
|
+
*/
|
|
52
|
+
export declare function recordUnroutableDelegateEvent(routing: WorkerDelegateRouting, eventName: string): boolean;
|
|
53
|
+
export interface UnroutableDeliveryDiagnostic {
|
|
54
|
+
timestamp: string;
|
|
55
|
+
event: string;
|
|
56
|
+
sessionId?: string;
|
|
57
|
+
workspace?: string;
|
|
58
|
+
coordinatorDaemonId?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* R4 visibility: recent delivery_unroutable diagnostics, newest first. Surfaced in mesh_status
|
|
62
|
+
* so an operator/coordinator can see that completions were dropped (envelope present, mesh
|
|
63
|
+
* unresolved) rather than the drops being invisible in a ledger nobody reads. The diagnostics
|
|
64
|
+
* live in a single shared stream because an unroutable event has no resolvable mesh.
|
|
65
|
+
*/
|
|
66
|
+
export declare function getRecentUnroutableDeliveries(opts?: {
|
|
67
|
+
sinceMs?: number;
|
|
68
|
+
limit?: number;
|
|
69
|
+
}): UnroutableDeliveryDiagnostic[];
|
|
70
|
+
export {};
|