@adhdev/daemon-core 0.9.82-rc.37 → 0.9.82-rc.371
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 +55 -2
- package/dist/cli-adapters/cli-script-runner.d.ts +117 -0
- package/dist/cli-adapters/cli-state-engine.d.ts +198 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +116 -64
- package/dist/cli-adapters/provider-cli-parse.d.ts +4 -0
- package/dist/cli-adapters/provider-cli-runtime.d.ts +34 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +63 -0
- package/dist/cli-adapters/raw-terminal-io.d.ts +37 -0
- package/dist/cli-adapters/resolve-executable.d.ts +14 -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.d.ts +27 -0
- 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 +2 -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 +116 -0
- package/dist/commands/mesh-coordinator.d.ts +85 -1
- package/dist/commands/router.d.ts +666 -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 +77 -1
- 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 +23 -0
- package/dist/git/git-types.d.ts +2 -50
- package/dist/git/index.d.ts +2 -0
- package/dist/index.d.ts +55 -13
- package/dist/index.js +46565 -19737
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43563 -16868
- 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 +46 -0
- package/dist/logging/logger.d.ts +1 -1
- package/dist/mesh/contracts.d.ts +164 -0
- package/dist/mesh/coordinator-prompt.d.ts +36 -0
- package/dist/mesh/coordinator-registry.d.ts +59 -0
- package/dist/mesh/mesh-active-work.d.ts +174 -0
- package/dist/mesh/mesh-delivery-policy.d.ts +131 -0
- package/dist/mesh/mesh-event-trace.d.ts +21 -0
- package/dist/mesh/mesh-events-coordinator.d.ts +91 -0
- package/dist/mesh/mesh-events-pending.d.ts +55 -0
- package/dist/mesh/mesh-events-stale.d.ts +40 -0
- package/dist/mesh/mesh-events-utils.d.ts +61 -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 -3
- package/dist/mesh/mesh-ledger.d.ts +77 -1
- package/dist/mesh/mesh-missions.d.ts +164 -0
- package/dist/mesh/mesh-reconcile-loop.d.ts +7 -0
- package/dist/mesh/mesh-refine-batch.d.ts +68 -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 +429 -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 +246 -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 +135 -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 +12 -0
- package/dist/providers/cli-provider-instance.d.ts +108 -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/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 +14 -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 +395 -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 +295 -13
- 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 +1 -0
- package/src/cli-adapter-types.ts +56 -2
- package/src/cli-adapters/cli-script-runner.ts +421 -0
- package/src/cli-adapters/cli-state-engine.ts +1221 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +775 -1141
- package/src/cli-adapters/provider-cli-parse.d.ts +1 -0
- package/src/cli-adapters/provider-cli-parse.ts +13 -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 +110 -11
- package/src/cli-adapters/pty-transport.ts +2 -1
- package/src/cli-adapters/raw-terminal-io.ts +252 -0
- package/src/cli-adapters/resolve-executable.ts +90 -0
- package/src/cli-adapters/session-host-transport.ts +2 -1
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +53 -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.ts +1917 -62
- package/src/commands/cli-manager.ts +502 -24
- 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 +592 -0
- package/src/commands/high-family/mesh-events.ts +47 -0
- package/src/commands/high-family/mesh-status.ts +642 -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 +81 -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 +218 -0
- package/src/commands/med-family/fast-forward.ts +198 -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 +788 -0
- package/src/commands/med-family/mesh-host-pairing.ts +234 -0
- package/src/commands/med-family/mesh-queue.ts +131 -0
- package/src/commands/med-family/mesh-restart.ts +92 -0
- package/src/commands/med-family/types.ts +120 -0
- package/src/commands/mesh-coordinator.ts +334 -124
- package/src/commands/router.ts +5121 -2369
- 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 +389 -6
- package/src/config/recent-activity.ts +8 -2
- 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 +55 -14
- package/src/git/git-diff.ts +81 -11
- package/src/git/git-executor.ts +12 -0
- package/src/git/git-status.ts +574 -43
- package/src/git/git-types.ts +14 -62
- package/src/git/git-worktree.ts +8 -1
- package/src/git/index.ts +16 -0
- package/src/index.ts +158 -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 +220 -0
- package/src/logging/logger.ts +14 -7
- package/src/mesh/contracts.ts +338 -0
- package/src/mesh/coordinator-prompt.ts +234 -31
- package/src/mesh/coordinator-registry.ts +121 -0
- package/src/mesh/mesh-active-work.ts +645 -0
- package/src/mesh/mesh-delivery-policy.ts +315 -0
- package/src/mesh/mesh-event-trace.ts +67 -0
- package/src/mesh/mesh-events-coordinator.ts +2866 -0
- package/src/mesh/mesh-events-pending.ts +599 -0
- package/src/mesh/mesh-events-stale.ts +309 -0
- package/src/mesh/mesh-events-utils.ts +387 -0
- package/src/mesh/mesh-events.ts +30 -1035
- package/src/mesh/mesh-fast-forward.ts +839 -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 -5
- package/src/mesh/mesh-ledger.ts +591 -102
- package/src/mesh/mesh-missions.ts +322 -0
- package/src/mesh/mesh-reconcile-loop.ts +1134 -0
- package/src/mesh/mesh-refine-batch.ts +197 -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 +1697 -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 +997 -141
- package/src/mesh/preview-freshness.ts +118 -0
- package/src/mesh/refine-config.ts +423 -0
- package/src/mesh/worktree-bootstrap-config.ts +331 -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 +45 -5
- package/src/providers/cli-provider-instance.ts +1310 -101
- 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/dispatcher.ts +340 -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 +30 -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 +1051 -0
- package/src/providers/spec/evaluator.ts +407 -0
- package/src/providers/spec/fsm-driver.ts +1305 -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 +1136 -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 +378 -14
- 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,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Possible delivery statuses for a session delivery record.
|
|
3
|
+
*/
|
|
4
|
+
export type MeshSessionDeliveryStatus = 'queued' | 'delivering' | 'delivered' | 'acked' | 'completed' | 'failed' | 'expired' | 'cancelled';
|
|
5
|
+
/**
|
|
6
|
+
* Kind of delivery — controls priority and policy handling.
|
|
7
|
+
*/
|
|
8
|
+
export type MeshSessionDeliveryKind = 'task' | 'followup' | 'approval' | 'recovery' | 'system_notice';
|
|
9
|
+
/**
|
|
10
|
+
* A session delivery decision — what to do when a task arrives for a session.
|
|
11
|
+
*/
|
|
12
|
+
export type MeshDeliveryDecision = 'immediate' | 'queued' | 'rejected';
|
|
13
|
+
export interface MeshDeliveryPolicyResult {
|
|
14
|
+
decision: MeshDeliveryDecision;
|
|
15
|
+
reason: string;
|
|
16
|
+
/** When decision='queued', estimated deliver-after ISO timestamp if known. */
|
|
17
|
+
deliverAfter?: string;
|
|
18
|
+
/** Human-readable explanation for coordinator/operator. */
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Determine whether to deliver immediately, queue, or reject based on session status.
|
|
23
|
+
*
|
|
24
|
+
* This is a pure function — it does not write to any store.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveDeliveryDecision(sessionStatus: string | undefined, opts?: {
|
|
27
|
+
kind?: MeshSessionDeliveryKind;
|
|
28
|
+
/** When true, busy session immediate injection is allowed (provider-specific capability). */
|
|
29
|
+
allowBusyInjection?: boolean;
|
|
30
|
+
}): MeshDeliveryPolicyResult;
|
|
31
|
+
export interface SessionDeliveryRecord {
|
|
32
|
+
id: string;
|
|
33
|
+
meshId: string;
|
|
34
|
+
nodeId?: string;
|
|
35
|
+
sessionId?: string;
|
|
36
|
+
providerType?: string;
|
|
37
|
+
taskId?: string;
|
|
38
|
+
kind: MeshSessionDeliveryKind;
|
|
39
|
+
priority: number;
|
|
40
|
+
message: string;
|
|
41
|
+
status: MeshSessionDeliveryStatus;
|
|
42
|
+
deliverAfter?: string;
|
|
43
|
+
expiresAt?: string;
|
|
44
|
+
attemptCount: number;
|
|
45
|
+
sourceCoordinatorSessionId?: string;
|
|
46
|
+
sourceCoordinatorDaemonId?: string;
|
|
47
|
+
lastError?: string;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a delivery record in the store.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createSessionDelivery(opts: {
|
|
55
|
+
meshId: string;
|
|
56
|
+
nodeId?: string;
|
|
57
|
+
sessionId?: string;
|
|
58
|
+
providerType?: string;
|
|
59
|
+
taskId?: string;
|
|
60
|
+
kind: MeshSessionDeliveryKind;
|
|
61
|
+
message: string;
|
|
62
|
+
status: MeshSessionDeliveryStatus;
|
|
63
|
+
priority?: number;
|
|
64
|
+
deliverAfter?: string;
|
|
65
|
+
expiresAt?: string;
|
|
66
|
+
sourceCoordinatorSessionId?: string;
|
|
67
|
+
sourceCoordinatorDaemonId?: string;
|
|
68
|
+
}): SessionDeliveryRecord;
|
|
69
|
+
/**
|
|
70
|
+
* Update the status of a delivery record.
|
|
71
|
+
*/
|
|
72
|
+
export declare function updateSessionDeliveryStatus(id: string, status: MeshSessionDeliveryStatus, opts?: {
|
|
73
|
+
lastError?: string;
|
|
74
|
+
incrementAttempt?: boolean;
|
|
75
|
+
}): void;
|
|
76
|
+
/**
|
|
77
|
+
* Get active (non-terminal) deliveries for a mesh, optionally filtered by session.
|
|
78
|
+
*/
|
|
79
|
+
export declare function getActiveSessionDeliveries(meshId: string, sessionId?: string): {
|
|
80
|
+
id: string;
|
|
81
|
+
meshId: string;
|
|
82
|
+
nodeId: string | null;
|
|
83
|
+
sessionId: string | null;
|
|
84
|
+
providerType: string | null;
|
|
85
|
+
taskId: string | null;
|
|
86
|
+
kind: string;
|
|
87
|
+
priority: number;
|
|
88
|
+
message: string;
|
|
89
|
+
status: string;
|
|
90
|
+
deliverAfter: string | null;
|
|
91
|
+
expiresAt: string | null;
|
|
92
|
+
attemptCount: number;
|
|
93
|
+
sourceCoordinatorSessionId: string | null;
|
|
94
|
+
sourceCoordinatorDaemonId: string | null;
|
|
95
|
+
lastError: string | null;
|
|
96
|
+
createdAt: string;
|
|
97
|
+
updatedAt: string;
|
|
98
|
+
}[];
|
|
99
|
+
/**
|
|
100
|
+
* Record a completion conflict diagnostic when a duplicate event points to
|
|
101
|
+
* different task/session than the already-seen event with the same fingerprint.
|
|
102
|
+
*/
|
|
103
|
+
export declare function recordCompletionConflict(opts: {
|
|
104
|
+
meshId: string;
|
|
105
|
+
fingerprint: string;
|
|
106
|
+
conflictingTaskId?: string;
|
|
107
|
+
conflictingSessionId?: string;
|
|
108
|
+
originalTaskId?: string;
|
|
109
|
+
originalSessionId?: string;
|
|
110
|
+
event: string;
|
|
111
|
+
}): void;
|
|
112
|
+
/**
|
|
113
|
+
* Get recent completion conflicts for diagnostic inspection.
|
|
114
|
+
*/
|
|
115
|
+
export declare function getRecentCompletionConflicts(meshId: string, limitMs?: number): {
|
|
116
|
+
id: string;
|
|
117
|
+
meshId: string;
|
|
118
|
+
fingerprint: string;
|
|
119
|
+
conflictingTaskId: string | null;
|
|
120
|
+
conflictingSessionId: string | null;
|
|
121
|
+
originalTaskId: string | null;
|
|
122
|
+
originalSessionId: string | null;
|
|
123
|
+
event: string;
|
|
124
|
+
createdAt: string;
|
|
125
|
+
}[];
|
|
126
|
+
export declare function __clearSessionDeliveriesForTests(meshId: string): void;
|
|
127
|
+
/**
|
|
128
|
+
* Mark all active (queued/delivering/delivered/acked) deliveries for a session as completed or failed.
|
|
129
|
+
* Called when a task's terminal status is confirmed so delivery records stay in sync.
|
|
130
|
+
*/
|
|
131
|
+
export declare function markSessionDeliveriesTerminal(meshId: string, sessionId: string, terminalStatus: 'completed' | 'failed'): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface MeshEventTraceCtx {
|
|
2
|
+
/** Primary correlation anchor — the mesh task id (meshActiveTaskId / metadataEvent.taskId). */
|
|
3
|
+
taskId?: unknown;
|
|
4
|
+
/** Optional per-event id when the producer assigns one. */
|
|
5
|
+
eventId?: unknown;
|
|
6
|
+
/** Worker session id — the fallback anchor when no task is attached. */
|
|
7
|
+
sessionId?: unknown;
|
|
8
|
+
nodeId?: unknown;
|
|
9
|
+
meshId?: unknown;
|
|
10
|
+
event?: unknown;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Stable, greppable correlation key. `task=` and `sess=` are ALWAYS rendered (as `-`
|
|
14
|
+
* when absent) so the key shape is uniform across stages and a single grep alternation
|
|
15
|
+
* (`task=<id>\|sess=<id>`) follows the event end-to-end.
|
|
16
|
+
*/
|
|
17
|
+
export declare function meshEventTraceKey(ctx: MeshEventTraceCtx): string;
|
|
18
|
+
/** Lifecycle progress (INFO). One line per stage the event clears. */
|
|
19
|
+
export declare function traceMeshEventStage(stage: string, ctx: MeshEventTraceCtx, detail?: string): void;
|
|
20
|
+
/** Event did not advance — rejected / held / skipped / deduped (WARN). */
|
|
21
|
+
export declare function traceMeshEventDrop(reason: string, ctx: MeshEventTraceCtx, detail?: string): void;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { DaemonComponents } from '../boot/daemon-lifecycle.js';
|
|
2
|
+
import type { RepoMeshSchedulingStrategy } from '../repo-mesh-types.js';
|
|
3
|
+
export declare function __resetIdleAutoFastForwardForTests(): void;
|
|
4
|
+
export declare function __resetMeshWorkspaceCacheForTests(): void;
|
|
5
|
+
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
6
|
+
/** Active assignments that hold the one-active-per-node / global-parallel invariant
|
|
7
|
+
* (everything except read-only diagnoses, which run unbounded by the write cap). */
|
|
8
|
+
export declare function activeWriteAssignedCount(meshId: string): number;
|
|
9
|
+
/** Active read-only (live_debug_readonly) assignments, for the read-only safety cap. */
|
|
10
|
+
export declare function activeReadonlyAssignedCount(meshId: string): number;
|
|
11
|
+
/**
|
|
12
|
+
* Order eligible nodes for assignment per the mesh scheduling pipeline:
|
|
13
|
+
* PRIORITY (schedulingPriority desc) → TIE-BREAK (strategy).
|
|
14
|
+
*
|
|
15
|
+
* The caller has already applied the TAG hard-filter and is responsible for the
|
|
16
|
+
* MAX-ALLOC capacity gate (the per-node launch/claim checks). This function only
|
|
17
|
+
* decides the *preference order* among nodes that are otherwise eligible.
|
|
18
|
+
*
|
|
19
|
+
* - 'first_eligible' (default): returns the input order verbatim and does NOT touch
|
|
20
|
+
* the round-robin cursor — byte-for-byte the pre-feature behavior.
|
|
21
|
+
* - 'priority_only': schedulingPriority desc, then input order (load ignored).
|
|
22
|
+
* - 'least_loaded': schedulingPriority desc, then active load asc, then input order.
|
|
23
|
+
* - 'round_robin': same as least_loaded, but among nodes tied at (priority, load)
|
|
24
|
+
* the input order is rotated by a per-mesh cursor that advances once per pass.
|
|
25
|
+
*
|
|
26
|
+
* `nodes` carries the original config/array index so the tie-break can fall back to
|
|
27
|
+
* deterministic input order. `bumpCursor` advances the round-robin cursor exactly
|
|
28
|
+
* once per scheduling pass (only consulted for 'round_robin').
|
|
29
|
+
*/
|
|
30
|
+
interface RankableNode {
|
|
31
|
+
nodeId: string;
|
|
32
|
+
node: any;
|
|
33
|
+
index: number;
|
|
34
|
+
}
|
|
35
|
+
/** Test-only: the pure node-ordering stage (PRIORITY → TIE-BREAK). Exposed so the
|
|
36
|
+
* scheduling pipeline can be unit-tested without standing up live CLI sessions. */
|
|
37
|
+
export declare function __orderEligibleNodesForTests(meshId: string, strategy: RepoMeshSchedulingStrategy, nodes: RankableNode[], opts?: {
|
|
38
|
+
bumpCursor?: boolean;
|
|
39
|
+
}): RankableNode[];
|
|
40
|
+
export interface MeshQueueTriggerResult {
|
|
41
|
+
success: true;
|
|
42
|
+
meshId: string;
|
|
43
|
+
pendingBefore: number;
|
|
44
|
+
assignedBefore: number;
|
|
45
|
+
pendingAfter: number;
|
|
46
|
+
assignedAfter: number;
|
|
47
|
+
claimed: boolean;
|
|
48
|
+
newlyAssignedTasks: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
nodeId?: string;
|
|
51
|
+
sessionId?: string;
|
|
52
|
+
}>;
|
|
53
|
+
localIdleSessionsChecked: number;
|
|
54
|
+
remoteIdleSessionsChecked: number;
|
|
55
|
+
skippedSessions: Array<{
|
|
56
|
+
nodeId?: string;
|
|
57
|
+
sessionId?: string;
|
|
58
|
+
reason: string;
|
|
59
|
+
status?: string;
|
|
60
|
+
}>;
|
|
61
|
+
autoLaunchStarted: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* True when a worker session is already on its way to claim a still-pending task —
|
|
64
|
+
* either launched this tick (autoLaunchStarted) or launched on a prior tick and still
|
|
65
|
+
* booting/awaiting-claim. Callers MUST treat this as "wait, do not launch another
|
|
66
|
+
* session": a second launch double-edits the worktree. Mutually informative with
|
|
67
|
+
* `noIdleMeshSessionAvailable`, which is suppressed whenever this is true.
|
|
68
|
+
*/
|
|
69
|
+
autoLaunchPending?: boolean;
|
|
70
|
+
noIdleMeshSessionAvailable?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare function triggerMeshQueue(components: DaemonComponents, meshId: string): Promise<MeshQueueTriggerResult>;
|
|
73
|
+
export declare function isMeshCoordinatorEvent(eventName: unknown): eventName is string;
|
|
74
|
+
export declare const MESH_FORCE_INJECT_EVENTS: ReadonlySet<string>;
|
|
75
|
+
export declare function shouldForceInjectMeshEvent(eventName: unknown): boolean;
|
|
76
|
+
export declare function buildRelayMetadataEvent(payload: Record<string, unknown>): Record<string, unknown>;
|
|
77
|
+
export declare function handleMeshForwardEvent(components: DaemonComponents, payload: Record<string, unknown>): {
|
|
78
|
+
[extra: string]: unknown;
|
|
79
|
+
success: true;
|
|
80
|
+
forwarded: 0;
|
|
81
|
+
suppressed: true;
|
|
82
|
+
} | {
|
|
83
|
+
success: boolean;
|
|
84
|
+
forwarded: number;
|
|
85
|
+
error?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
success: boolean;
|
|
88
|
+
error: string;
|
|
89
|
+
};
|
|
90
|
+
export declare function setupMeshEventForwarding(components: DaemonComponents): void;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface PendingMeshCoordinatorEvent {
|
|
2
|
+
event: string;
|
|
3
|
+
meshId: string;
|
|
4
|
+
nodeLabel: string;
|
|
5
|
+
nodeId?: string;
|
|
6
|
+
workspace?: string;
|
|
7
|
+
metadataEvent: Record<string, unknown>;
|
|
8
|
+
coordinatorMessage?: string;
|
|
9
|
+
queuedAt: number;
|
|
10
|
+
/**
|
|
11
|
+
* When set, this event is intended for a specific coordinator daemon.
|
|
12
|
+
* Coordinators on other daemons should ignore it during drain.
|
|
13
|
+
* Absent on legacy events — treated as broadcast to any coordinator.
|
|
14
|
+
*/
|
|
15
|
+
targetCoordinatorDaemonId?: string;
|
|
16
|
+
/**
|
|
17
|
+
* When set, this event is intended for a specific coordinator SESSION on the
|
|
18
|
+
* target daemon (the session that originally dispatched the work). PHASE 2 inject
|
|
19
|
+
* strict-matches the live coordinator by this session id so a sibling coordinator
|
|
20
|
+
* session on the same daemon does not receive another coordinator's completion.
|
|
21
|
+
* Absent on legacy / version-skewed events → daemon-level broadcast (no regression).
|
|
22
|
+
* Rides inside the event payload, so it survives the SQLite payload round-trip and
|
|
23
|
+
* the JSONL file without a dedicated column; it is NOT a drain-scoping key.
|
|
24
|
+
*/
|
|
25
|
+
targetCoordinatorSessionId?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function readRefineJobId(event: {
|
|
28
|
+
metadataEvent?: Record<string, unknown>;
|
|
29
|
+
} | Record<string, unknown>): string;
|
|
30
|
+
export declare function buildPendingEventFingerprint(event: PendingMeshCoordinatorEvent): string;
|
|
31
|
+
export declare function hasPendingCoordinatorEventDuplicate(event: PendingMeshCoordinatorEvent): boolean;
|
|
32
|
+
export declare function queuePendingMeshCoordinatorEvent(event: PendingMeshCoordinatorEvent): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Drain and return pending coordinator events for meshId, removing the drained
|
|
35
|
+
* ones from both the SQLite inbox and the JSONL legacy file.
|
|
36
|
+
*
|
|
37
|
+
* When `opts.onlyEvents` is supplied, ONLY events whose name is in that set are
|
|
38
|
+
* drained; every other event stays queued (undrained in SQLite, rewritten back to
|
|
39
|
+
* the JSONL file). The reconcile loop uses this to force-drain terminal/force-inject
|
|
40
|
+
* events into a *generating* coordinator while leaving non-force progress events for
|
|
41
|
+
* the coordinator's next idle transition. The atomic SQLite drained=1 marking and the
|
|
42
|
+
* atomic JSONL rename keep force-drain and a concurrent full drain from double-consuming.
|
|
43
|
+
*/
|
|
44
|
+
export declare function drainPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string | ReadonlyArray<string>, opts?: {
|
|
45
|
+
onlyEvents?: ReadonlySet<string>;
|
|
46
|
+
}): PendingMeshCoordinatorEvent[];
|
|
47
|
+
/** Peek at pending coordinator events without draining (non-destructive). */
|
|
48
|
+
export declare function getPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string | ReadonlyArray<string>): readonly PendingMeshCoordinatorEvent[];
|
|
49
|
+
/**
|
|
50
|
+
* Test helper: purge all pending-event state for a mesh — SQLite rows
|
|
51
|
+
* (including drained fingerprint history) and JSONL files.
|
|
52
|
+
*/
|
|
53
|
+
export declare function __clearMeshPendingEventsForTests(meshId: string): void;
|
|
54
|
+
/** Explicitly clear all pending coordinator events for a mesh (and coordinator if scoped). */
|
|
55
|
+
export declare function clearPendingMeshCoordinatorEvents(meshId?: string, coordinatorDaemonId?: string): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { MeshLedgerKind } from './mesh-ledger.js';
|
|
2
|
+
export declare function findRecentTerminalLedgerEvidence(args: {
|
|
3
|
+
meshId: string;
|
|
4
|
+
sessionId?: string;
|
|
5
|
+
nodeId?: string;
|
|
6
|
+
}): {
|
|
7
|
+
id: string;
|
|
8
|
+
kind: MeshLedgerKind;
|
|
9
|
+
payload: Record<string, unknown>;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function hasDispatchAfterTerminal(meshId: string, sessionId: string, terminalId: string): boolean;
|
|
13
|
+
export declare function hasUnterminalDirectDispatchLedgerEntry(meshId: string, sessionId: string): boolean;
|
|
14
|
+
export declare function reconcileDirectDispatchCompletionFromTranscript(args: {
|
|
15
|
+
meshId: string;
|
|
16
|
+
nodeId?: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
providerType?: string;
|
|
19
|
+
providerSessionId?: string;
|
|
20
|
+
taskId: string;
|
|
21
|
+
finalSummary: string;
|
|
22
|
+
transcriptMessageAt?: string;
|
|
23
|
+
completedAt?: string;
|
|
24
|
+
targetCoordinatorDaemonId?: string;
|
|
25
|
+
source?: string;
|
|
26
|
+
}): {
|
|
27
|
+
reconciled: boolean;
|
|
28
|
+
kind?: MeshLedgerKind;
|
|
29
|
+
alreadyTerminal?: boolean;
|
|
30
|
+
workerResult?: unknown;
|
|
31
|
+
ledgerEntryId?: string;
|
|
32
|
+
reason?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function buildNoProgressCompletionReconciliation(args: {
|
|
35
|
+
meshId: string;
|
|
36
|
+
nodeId?: string;
|
|
37
|
+
nodeLabel: string;
|
|
38
|
+
metadataEvent: Record<string, unknown>;
|
|
39
|
+
sourceInstanceId?: string;
|
|
40
|
+
}): Record<string, unknown> | null;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { SessionRecoveryContext } from './mesh-ledger.js';
|
|
2
|
+
export declare function readNonEmptyString(value: unknown): string;
|
|
3
|
+
export declare function readRecord(value: unknown): Record<string, unknown> | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* The relay-safety metadata a worker session must carry so that its completion /
|
|
6
|
+
* generating events route back to the coordinator proactively (without waiting for
|
|
7
|
+
* a mesh_read_chat reconcile). meshCoordinatorDaemonId is the routing anchor the
|
|
8
|
+
* core forwarder (injectMeshSystemMessage) keys on to pick a remote coordinator
|
|
9
|
+
* target; meshNodeFor/meshNodeId identify the worker, and launchedByCoordinator is
|
|
10
|
+
* the delegation proof. See resolveWorkerDelegateRouting().
|
|
11
|
+
*/
|
|
12
|
+
export interface MeshWorkerRelayStamp {
|
|
13
|
+
meshNodeFor?: string;
|
|
14
|
+
meshNodeId?: string;
|
|
15
|
+
meshCoordinatorDaemonId?: string;
|
|
16
|
+
meshCoordinatorSessionId?: string;
|
|
17
|
+
launchedByCoordinator?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Build the relay-safety stamp from a dispatch's meshContext, only including fields
|
|
21
|
+
* the session does not already carry. Returns undefined when there is nothing new to
|
|
22
|
+
* stamp, so callers can skip a no-op updateSettings() write.
|
|
23
|
+
*
|
|
24
|
+
* This closes the remote-session relay gap: a worker session reached by a dispatch
|
|
25
|
+
* that carries coordinatorDaemonId (mesh_send_task / queue assignment over P2P) gets
|
|
26
|
+
* the coordinator anchor persisted onto its settings at dispatch time, even if it was
|
|
27
|
+
* not launched via mesh_launch_session. Without the stamp the forwarder cannot resolve
|
|
28
|
+
* a remote coordinator and the completion event sits in the pending queue until a
|
|
29
|
+
* read_chat-triggered reconcile drains it.
|
|
30
|
+
*/
|
|
31
|
+
export declare function buildMeshWorkerRelayStamp(currentSettings: Record<string, unknown> | undefined, meshContext: {
|
|
32
|
+
meshId?: unknown;
|
|
33
|
+
nodeId?: unknown;
|
|
34
|
+
coordinatorDaemonId?: unknown;
|
|
35
|
+
coordinatorSessionId?: unknown;
|
|
36
|
+
} | undefined): MeshWorkerRelayStamp | undefined;
|
|
37
|
+
export declare function resolveEventSessionId(event: Record<string, unknown>, fallback?: unknown): string;
|
|
38
|
+
export declare function readRefineJobId(event: {
|
|
39
|
+
metadataEvent?: Record<string, unknown>;
|
|
40
|
+
} | Record<string, unknown>): string;
|
|
41
|
+
export declare function readWorkerResultMetadata(event: Record<string, unknown>): Record<string, unknown> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* The worker's final assistant text carried on a completion event — read from
|
|
44
|
+
* `finalSummary` (and the `workerResult.summary` / `result.summary` fallbacks some
|
|
45
|
+
* paths use). Returns '' when the event carries no assistant text (lifecycle events
|
|
46
|
+
* without a summary). Shared by the coordinator chat surface (buildMeshSystemMessage)
|
|
47
|
+
* and the held-event ledger audit record so both read the summary the same way.
|
|
48
|
+
*/
|
|
49
|
+
export declare function readMeshCompletionSummary(metadataEvent: Record<string, unknown>): string;
|
|
50
|
+
export declare function resolveMeshSurfacedSessionPreview(metadataEvent: Record<string, unknown>): {
|
|
51
|
+
preview: string;
|
|
52
|
+
role: 'assistant';
|
|
53
|
+
receivedAt: number;
|
|
54
|
+
} | undefined;
|
|
55
|
+
export declare function isWeakCompletionMetadata(metadataEvent: Record<string, unknown>): boolean;
|
|
56
|
+
export declare function buildMeshSystemMessage(args: {
|
|
57
|
+
event: string;
|
|
58
|
+
nodeLabel: string;
|
|
59
|
+
metadataEvent: Record<string, unknown>;
|
|
60
|
+
recoveryContext?: SessionRecoveryContext | null;
|
|
61
|
+
}): string;
|
|
@@ -1,49 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
workspace?: string;
|
|
8
|
-
metadataEvent: Record<string, unknown>;
|
|
9
|
-
queuedAt: number;
|
|
10
|
-
}
|
|
11
|
-
export declare function queuePendingMeshCoordinatorEvent(event: PendingMeshCoordinatorEvent): boolean;
|
|
12
|
-
/** Drain and return all pending coordinator events for meshId, removing them from disk. */
|
|
13
|
-
export declare function drainPendingMeshCoordinatorEvents(meshId?: string): PendingMeshCoordinatorEvent[];
|
|
14
|
-
/** Peek at pending coordinator events without draining (non-destructive). */
|
|
15
|
-
export declare function getPendingMeshCoordinatorEvents(meshId?: string): readonly PendingMeshCoordinatorEvent[];
|
|
16
|
-
/** Explicitly clear all pending coordinator events for a mesh. */
|
|
17
|
-
export declare function clearPendingMeshCoordinatorEvents(meshId?: string): void;
|
|
18
|
-
export declare function tryAssignQueueTask(components: DaemonComponents, meshId: string, nodeId: string, sessionId: string, providerType: string): boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Triggers a queue check for all nodes in the mesh.
|
|
21
|
-
* Called when a new task is enqueued, in case nodes are already idle.
|
|
22
|
-
*/
|
|
23
|
-
export declare function triggerMeshQueue(components: DaemonComponents, meshId: string): Promise<void>;
|
|
24
|
-
export declare function handleMeshForwardEvent(components: DaemonComponents, payload: Record<string, unknown>): {
|
|
25
|
-
success: boolean;
|
|
26
|
-
forwarded: number;
|
|
27
|
-
suppressed: boolean;
|
|
28
|
-
intentionalCleanupStop: boolean;
|
|
29
|
-
duplicateCompletion?: undefined;
|
|
30
|
-
error?: undefined;
|
|
31
|
-
} | {
|
|
32
|
-
success: boolean;
|
|
33
|
-
forwarded: number;
|
|
34
|
-
suppressed: boolean;
|
|
35
|
-
duplicateCompletion: boolean;
|
|
36
|
-
intentionalCleanupStop?: undefined;
|
|
37
|
-
error?: undefined;
|
|
38
|
-
} | {
|
|
39
|
-
success: boolean;
|
|
40
|
-
forwarded: number;
|
|
41
|
-
suppressed?: undefined;
|
|
42
|
-
intentionalCleanupStop?: undefined;
|
|
43
|
-
duplicateCompletion?: undefined;
|
|
44
|
-
error?: undefined;
|
|
45
|
-
} | {
|
|
46
|
-
success: boolean;
|
|
47
|
-
error: string;
|
|
48
|
-
};
|
|
49
|
-
export declare function setupMeshEventForwarding(components: DaemonComponents): void;
|
|
1
|
+
export type { PendingMeshCoordinatorEvent } from './mesh-events-pending.js';
|
|
2
|
+
export { queuePendingMeshCoordinatorEvent, drainPendingMeshCoordinatorEvents, getPendingMeshCoordinatorEvents, clearPendingMeshCoordinatorEvents, } from './mesh-events-pending.js';
|
|
3
|
+
export { reconcileDirectDispatchCompletionFromTranscript, } from './mesh-events-stale.js';
|
|
4
|
+
export { setupMeshReconcileLoop, runMeshReconcileTick, } from './mesh-reconcile-loop.js';
|
|
5
|
+
export type { MeshQueueTriggerResult } from './mesh-events-coordinator.js';
|
|
6
|
+
export { tryAssignQueueTask, triggerMeshQueue, handleMeshForwardEvent, setupMeshEventForwarding, isMeshCoordinatorEvent, __resetIdleAutoFastForwardForTests, __resetMeshWorkspaceCacheForTests, } from './mesh-events-coordinator.js';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { GitRepoStatus } from '../git/git-types.js';
|
|
2
|
+
export interface MeshFastForwardNodeArgs {
|
|
3
|
+
nodeId?: string;
|
|
4
|
+
meshId?: string;
|
|
5
|
+
workspace: string;
|
|
6
|
+
branch?: string;
|
|
7
|
+
execute?: boolean;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
updateSubmodules?: boolean;
|
|
10
|
+
submoduleIgnorePaths?: string[];
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
trigger?: 'manual' | 'idle_auto' | string;
|
|
13
|
+
/**
|
|
14
|
+
* Operation mode. 'merge' (default) absorbs upstream commits into the local
|
|
15
|
+
* branch via git merge --ff-only (requires ahead=0, behind>0). 'push' publishes
|
|
16
|
+
* local commits to origin via a strict ff-only push (requires HEAD to be a
|
|
17
|
+
* descendant of origin/<branch>); it never force-pushes, resets, or rebases.
|
|
18
|
+
*/
|
|
19
|
+
mode?: 'merge' | 'push';
|
|
20
|
+
/**
|
|
21
|
+
* When mode='push', also fast-forward push submodule (e.g. oss) HEADs to their
|
|
22
|
+
* origin main branch. Gated by allowAutoPublishSubmoduleMainCommits — skipped
|
|
23
|
+
* unless that policy is true. Each submodule must still pass the descendant gate.
|
|
24
|
+
* Defaults false (root push only).
|
|
25
|
+
*/
|
|
26
|
+
pushSubmodules?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Mesh policy flag mirrored from RepoMeshPolicy.allowAutoPublishSubmoduleMainCommits.
|
|
29
|
+
* Submodule pushes are refused unless this is true.
|
|
30
|
+
*/
|
|
31
|
+
allowAutoPublishSubmoduleMainCommits?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface MeshFastForwardPlannedStep {
|
|
34
|
+
operation: 'refresh_upstream' | 'verify_clean_worktree' | 'verify_fast_forward' | 'merge_ff_only' | 'submodule_update' | 'verify_post_status' | 'verify_push_descendant' | 'push_ff_only' | 'push_submodules_ff_only';
|
|
35
|
+
description: string;
|
|
36
|
+
safe: true;
|
|
37
|
+
willMutateWorktree: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface MeshFastForwardSubmodulePushResult {
|
|
40
|
+
path: string;
|
|
41
|
+
commit?: string;
|
|
42
|
+
remote: string;
|
|
43
|
+
remoteBranch: string;
|
|
44
|
+
pushed: boolean;
|
|
45
|
+
skipped: boolean;
|
|
46
|
+
code: string;
|
|
47
|
+
refspec?: string;
|
|
48
|
+
error?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface MeshFastForwardResult {
|
|
51
|
+
success: boolean;
|
|
52
|
+
code: string;
|
|
53
|
+
nodeId?: string;
|
|
54
|
+
meshId?: string;
|
|
55
|
+
workspace: string;
|
|
56
|
+
mode: 'merge' | 'push';
|
|
57
|
+
allowed: boolean;
|
|
58
|
+
dryRun: boolean;
|
|
59
|
+
willRun: boolean;
|
|
60
|
+
executed: boolean;
|
|
61
|
+
updateSubmodules: boolean;
|
|
62
|
+
blockingReasons: string[];
|
|
63
|
+
plannedSteps: MeshFastForwardPlannedStep[];
|
|
64
|
+
current?: GitRepoStatus;
|
|
65
|
+
preStatus?: GitRepoStatus;
|
|
66
|
+
postStatus?: GitRepoStatus;
|
|
67
|
+
/** Push target derived from the tracked upstream (mode='push'). */
|
|
68
|
+
pushTarget?: {
|
|
69
|
+
remote: string;
|
|
70
|
+
remoteBranch: string;
|
|
71
|
+
refspec: string;
|
|
72
|
+
};
|
|
73
|
+
/** Submodule ff-only push outcomes (mode='push' with pushSubmodules). */
|
|
74
|
+
submodulePushes?: MeshFastForwardSubmodulePushResult[];
|
|
75
|
+
finalBranchConvergenceState?: Record<string, unknown>;
|
|
76
|
+
operationError?: string;
|
|
77
|
+
ledgerError?: string;
|
|
78
|
+
nextStep?: string;
|
|
79
|
+
trigger?: string;
|
|
80
|
+
}
|
|
81
|
+
export declare function fastForwardMeshNode(args: MeshFastForwardNodeArgs): Promise<MeshFastForwardResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RepoMeshDaemonRole, RepoMeshHostMetadata, RepoMeshHostStatus } from '../repo-mesh-types.js';
|
|
2
|
+
export declare function normalizeMeshDaemonRole(value: unknown): RepoMeshDaemonRole | undefined;
|
|
3
|
+
export declare function resolveMeshHostStatus(mesh: unknown): RepoMeshHostStatus;
|
|
4
|
+
export declare function isMeshHostOwner(mesh: unknown): boolean;
|
|
5
|
+
export declare function buildMeshHostRequiredFailure(mesh: unknown, operation: string): Record<string, unknown>;
|
|
6
|
+
export declare function requireMeshHostQueueOwner(opts?: {
|
|
7
|
+
ownerRole?: RepoMeshDaemonRole;
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function createDefaultMeshHostMetadata(): RepoMeshHostMetadata;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mesh init / onboarding helper.
|
|
3
|
+
*
|
|
4
|
+
* One-shot helper that onboards an existing git project into Repo Mesh:
|
|
5
|
+
* 1. suggest + write `.adhdev/refine.json` (Refinery validation config)
|
|
6
|
+
* 2. suggest + write `.adhdev/worktree_bootstrap.json` (worktree bootstrap config)
|
|
7
|
+
* 3. recommend a node providerPriority from the installed CLI providers
|
|
8
|
+
*
|
|
9
|
+
* Design contract (matches the rest of the mesh tooling):
|
|
10
|
+
* - Heuristics are suggestion/scaffold only. The written files are the
|
|
11
|
+
* execution source of truth; Refinery/bootstrap only ever read the saved
|
|
12
|
+
* config. The suggestion functions never become the execution path.
|
|
13
|
+
* - Writing is opt-in (`write: true`) and never clobbers an existing config
|
|
14
|
+
* unless `overwrite: true` is set, so re-running init on an already-onboarded
|
|
15
|
+
* repo is safe.
|
|
16
|
+
* - The providerPriority recommendation is returned, not auto-applied to the
|
|
17
|
+
* node policy — applying it mutates mesh policy, which is the coordinator's
|
|
18
|
+
* decision.
|
|
19
|
+
*/
|
|
20
|
+
import { type RepoMeshRefineConfig, type RepoMeshRefineValidationCommandConfig } from './refine-config.js';
|
|
21
|
+
import { type RepoMeshWorktreeBootstrapConfig } from './worktree-bootstrap-config.js';
|
|
22
|
+
import type { CLIInfo } from '../detection/cli-detector.js';
|
|
23
|
+
/** Canonical write targets — the first/preferred location for each config family. */
|
|
24
|
+
export declare const MESH_INIT_REFINE_CONFIG_PATH: string;
|
|
25
|
+
export declare const MESH_INIT_WORKTREE_BOOTSTRAP_CONFIG_PATH: string;
|
|
26
|
+
export interface MeshInitConfigFileResult {
|
|
27
|
+
path: string;
|
|
28
|
+
relativePath: string;
|
|
29
|
+
written: boolean;
|
|
30
|
+
/** Why it was not written (already_exists / not_suggested / no change). */
|
|
31
|
+
skippedReason?: 'already_exists' | 'no_suggestion';
|
|
32
|
+
config?: RepoMeshRefineConfig | RepoMeshWorktreeBootstrapConfig;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build a worktree_bootstrap scaffold from package scripts. Mirrors
|
|
36
|
+
* suggestMeshRefineConfig's "scaffold only" posture: prefers an `install`/`ci`
|
|
37
|
+
* style script, else falls back to `npm install`, and records existing
|
|
38
|
+
* lockfiles as staleInputs so a base merge that changes them re-runs bootstrap.
|
|
39
|
+
*
|
|
40
|
+
* Returns undefined when there is nothing meaningful to scaffold.
|
|
41
|
+
*/
|
|
42
|
+
export declare function suggestMeshWorktreeBootstrapConfig(workspace: string): {
|
|
43
|
+
commands: RepoMeshRefineValidationCommandConfig[];
|
|
44
|
+
staleInputs: string[];
|
|
45
|
+
suggestedConfig?: RepoMeshWorktreeBootstrapConfig;
|
|
46
|
+
};
|
|
47
|
+
export declare function suggestNodeProviderPriority(detected: CLIInfo[]): {
|
|
48
|
+
providerPriority: string[];
|
|
49
|
+
installedProviders: Array<{
|
|
50
|
+
id: string;
|
|
51
|
+
displayName: string;
|
|
52
|
+
version?: string;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
export interface RunMeshInitOptions {
|
|
56
|
+
/** When true, persist suggested configs to disk. Defaults to dry-run (false). */
|
|
57
|
+
write?: boolean;
|
|
58
|
+
/** When true, overwrite an existing config file. Defaults to false (never clobber). */
|
|
59
|
+
overwrite?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface RunMeshInitResult {
|
|
62
|
+
success: true;
|
|
63
|
+
workspace: string;
|
|
64
|
+
dryRun: boolean;
|
|
65
|
+
refine: MeshInitConfigFileResult;
|
|
66
|
+
worktreeBootstrap: MeshInitConfigFileResult;
|
|
67
|
+
providers: {
|
|
68
|
+
providerPriority: string[];
|
|
69
|
+
installedProviders: Array<{
|
|
70
|
+
id: string;
|
|
71
|
+
displayName: string;
|
|
72
|
+
version?: string;
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
note: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Orchestrate the full onboarding flow for one workspace:
|
|
79
|
+
* detect installed CLIs → suggest refine + bootstrap configs → (optionally)
|
|
80
|
+
* write them → recommend a node providerPriority.
|
|
81
|
+
*
|
|
82
|
+
* `detected` is injected (the caller resolves it via detectCLIs with its
|
|
83
|
+
* ProviderLoader) so this module stays free of provider-loader wiring and is
|
|
84
|
+
* trivially unit-testable.
|
|
85
|
+
*/
|
|
86
|
+
export declare function runMeshInit(mesh: any, workspace: string, detected: CLIInfo[], options?: RunMeshInitOptions): RunMeshInitResult;
|