@adhdev/daemon-core 0.9.82-rc.49 → 0.9.82-rc.490
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 +220 -0
- package/dist/cli-adapters/provider-cli-adapter.d.ts +137 -64
- package/dist/cli-adapters/provider-cli-parse.d.ts +5 -0
- package/dist/cli-adapters/provider-cli-runtime.d.ts +34 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +74 -0
- package/dist/cli-adapters/pty-write-chunking.d.ts +34 -0
- package/dist/cli-adapters/raw-terminal-io.d.ts +37 -0
- package/dist/cli-adapters/resolve-executable.d.ts +69 -0
- package/dist/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +6 -3
- package/dist/cli-adapters/terminal-backends/types.d.ts +10 -2
- package/dist/cli-adapters/terminal-screen.d.ts +4 -11
- package/dist/commands/chat-commands-debug-bundle.d.ts +14 -0
- package/dist/commands/chat-commands-read.d.ts +23 -0
- package/dist/commands/chat-commands-scope.d.ts +39 -0
- package/dist/commands/chat-commands-shared.d.ts +33 -0
- package/dist/commands/chat-commands-write.d.ts +14 -0
- package/dist/commands/chat-commands.d.ts +10 -23
- package/dist/commands/cli-manager.d.ts +71 -1
- package/dist/commands/handler.d.ts +125 -0
- package/dist/commands/high-family/index.d.ts +3 -0
- package/dist/commands/high-family/mesh-coordinator-launch.d.ts +2 -0
- package/dist/commands/high-family/mesh-events.d.ts +2 -0
- package/dist/commands/high-family/mesh-status.d.ts +2 -0
- package/dist/commands/high-family/types.d.ts +64 -0
- package/dist/commands/low-family/coordinator-prompt.d.ts +9 -0
- package/dist/commands/low-family/daemon-lifecycle.d.ts +2 -0
- package/dist/commands/low-family/diagnostics.d.ts +2 -0
- package/dist/commands/low-family/index.d.ts +3 -0
- package/dist/commands/low-family/mesh-ledger.d.ts +10 -0
- package/dist/commands/low-family/mesh-node-logs.d.ts +2 -0
- package/dist/commands/low-family/notification.d.ts +2 -0
- package/dist/commands/low-family/refine-config.d.ts +2 -0
- package/dist/commands/low-family/session-host.d.ts +2 -0
- package/dist/commands/low-family/spec-providerdev.d.ts +11 -0
- package/dist/commands/low-family/status-meta.d.ts +2 -0
- package/dist/commands/low-family/types.d.ts +33 -0
- package/dist/commands/med-family/cli-agent.d.ts +2 -0
- package/dist/commands/med-family/fast-forward.d.ts +2 -0
- package/dist/commands/med-family/ide.d.ts +10 -0
- package/dist/commands/med-family/index.d.ts +3 -0
- package/dist/commands/med-family/mesh-crud.d.ts +48 -0
- package/dist/commands/med-family/mesh-host-pairing.d.ts +2 -0
- package/dist/commands/med-family/mesh-queue.d.ts +2 -0
- package/dist/commands/med-family/mesh-restart.d.ts +2 -0
- package/dist/commands/med-family/types.d.ts +152 -0
- package/dist/commands/mesh-coordinator.d.ts +85 -1
- package/dist/commands/router-aggregate-status.d.ts +24 -0
- package/dist/commands/router-mesh-session-owner.d.ts +59 -0
- package/dist/commands/router-refine.d.ts +151 -0
- package/dist/commands/router-worktree-cleanup.d.ts +133 -0
- package/dist/commands/router.d.ts +203 -15
- package/dist/commands/upgrade-helper.d.ts +41 -1
- package/dist/config/chat-history.d.ts +11 -0
- package/dist/config/config.d.ts +19 -0
- package/dist/config/mesh-config.d.ts +65 -0
- package/dist/config/mesh-json-config.d.ts +199 -0
- package/dist/config/registry-resolver.d.ts +54 -0
- package/dist/config/repo-settings.d.ts +77 -0
- package/dist/config/state-store.d.ts +30 -0
- package/dist/daemon/dev-server.d.ts +0 -2
- package/dist/detection/cli-detector.d.ts +17 -0
- package/dist/detection/ide-detector.d.ts +13 -0
- package/dist/detection/win32-ide-version.d.ts +37 -0
- package/dist/git/change-impact-config.d.ts +159 -0
- package/dist/git/git-commands.d.ts +26 -2
- package/dist/git/git-diff.d.ts +6 -0
- package/dist/git/git-executor.d.ts +11 -0
- package/dist/git/git-status.d.ts +80 -0
- package/dist/git/git-types.d.ts +2 -50
- package/dist/git/git-worktree.d.ts +71 -1
- package/dist/git/index.d.ts +3 -1
- package/dist/index.d.ts +70 -17
- package/dist/index.js +53532 -19073
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53283 -18989
- package/dist/index.mjs.map +1 -1
- package/dist/installer.d.ts +1 -4
- package/dist/ipc/local-ipc-server.d.ts +91 -0
- package/dist/launch.d.ts +1 -1
- package/dist/logging/async-batch-writer.d.ts +10 -0
- package/dist/logging/debug-config.d.ts +16 -0
- package/dist/logging/log-redactor.d.ts +24 -0
- package/dist/logging/log-tail-reader.d.ts +81 -0
- package/dist/logging/logger.d.ts +1 -1
- package/dist/mesh/contracts.d.ts +256 -0
- package/dist/mesh/coordinator-prompt.d.ts +76 -0
- package/dist/mesh/coordinator-registry.d.ts +59 -0
- package/dist/mesh/mesh-active-work.d.ts +203 -0
- package/dist/mesh/mesh-clone-grace.d.ts +8 -0
- package/dist/mesh/mesh-completion-synthesis.d.ts +4 -0
- package/dist/mesh/mesh-coordinator-config.d.ts +21 -0
- package/dist/mesh/mesh-delivery-policy.d.ts +104 -0
- package/dist/mesh/mesh-event-classify.d.ts +7 -0
- package/dist/mesh/mesh-event-forwarding.d.ts +58 -0
- package/dist/mesh/mesh-event-trace.d.ts +21 -0
- package/dist/mesh/mesh-events-coordinator.d.ts +4 -0
- package/dist/mesh/mesh-events-pending.d.ts +258 -0
- package/dist/mesh/mesh-events-stale.d.ts +61 -0
- package/dist/mesh/mesh-events-utils.d.ts +75 -0
- package/dist/mesh/mesh-events.d.ts +6 -49
- package/dist/mesh/mesh-fast-forward.d.ts +81 -0
- package/dist/mesh/mesh-host-ownership.d.ts +21 -1
- package/dist/mesh/mesh-init.d.ts +128 -0
- package/dist/mesh/mesh-ledger-reconciliation.d.ts +23 -4
- package/dist/mesh/mesh-ledger.d.ts +139 -1
- package/dist/mesh/mesh-magi-status.d.ts +63 -0
- package/dist/mesh/mesh-missions.d.ts +281 -0
- package/dist/mesh/mesh-node-identity.d.ts +310 -0
- package/dist/mesh/mesh-queue-assignment.d.ts +162 -0
- package/dist/mesh/mesh-reconcile-acked-hold.d.ts +17 -0
- package/dist/mesh/mesh-reconcile-config.d.ts +6 -0
- package/dist/mesh/mesh-reconcile-identity.d.ts +6 -0
- package/dist/mesh/mesh-reconcile-loop.d.ts +84 -0
- package/dist/mesh/mesh-reconcile-v2-backstop.d.ts +16 -0
- package/dist/mesh/mesh-refine-batch.d.ts +68 -0
- package/dist/mesh/mesh-refine-gates.d.ts +457 -0
- package/dist/mesh/mesh-refine-status.d.ts +62 -0
- package/dist/mesh/mesh-remote-event-pull.d.ts +15 -0
- package/dist/mesh/mesh-review-inbox.d.ts +90 -0
- package/dist/mesh/mesh-routing.d.ts +70 -0
- package/dist/mesh/mesh-runtime-store.d.ts +567 -0
- package/dist/mesh/mesh-scheduling-runtime.d.ts +78 -0
- package/dist/mesh/mesh-task-inflight.d.ts +46 -0
- package/dist/mesh/mesh-task-stats.d.ts +49 -0
- package/dist/mesh/mesh-unresolved-forward-outbox.d.ts +34 -0
- package/dist/mesh/mesh-warmup-deadline.d.ts +68 -0
- package/dist/mesh/mesh-work-queue.d.ts +392 -1
- package/dist/mesh/preview-freshness.d.ts +28 -0
- package/dist/mesh/refine-config.d.ts +97 -0
- package/dist/mesh/worktree-bootstrap-config.d.ts +219 -0
- package/dist/providers/acp-provider-instance.d.ts +5 -0
- package/dist/providers/approval-utils.d.ts +46 -0
- package/dist/providers/chat-message-normalization.d.ts +58 -1
- package/dist/providers/cli-provider-effect-format.d.ts +30 -0
- package/dist/providers/cli-provider-history-dedup.d.ts +17 -0
- package/dist/providers/cli-provider-input-prompt.d.ts +12 -0
- package/dist/providers/cli-provider-instance-types.d.ts +45 -0
- package/dist/providers/cli-provider-instance.d.ts +426 -30
- package/dist/providers/cli-provider-status-helpers.d.ts +46 -0
- package/dist/providers/cli-provider-transcript-merge.d.ts +7 -0
- package/dist/providers/contracts.d.ts +196 -6
- package/dist/providers/external-sources.d.ts +71 -0
- package/dist/providers/manual-attendance.d.ts +79 -0
- package/dist/providers/native-history/antigravity-claim-registry.d.ts +39 -0
- package/dist/providers/native-history/antigravity-cli-transcript.d.ts +137 -0
- package/dist/providers/native-history/claude-cli-transcript.d.ts +70 -0
- package/dist/providers/native-history/codex-cli-transcript.d.ts +73 -0
- package/dist/providers/native-history/constants.d.ts +12 -0
- package/dist/providers/native-history/dispatcher.d.ts +44 -0
- package/dist/providers/native-history/hermes-cli-transcript.d.ts +30 -0
- package/dist/providers/native-history/index.d.ts +13 -0
- package/dist/providers/provider-instance-manager.d.ts +30 -0
- package/dist/providers/provider-instance.d.ts +31 -1
- package/dist/providers/provider-loader.d.ts +42 -5
- package/dist/providers/provider-trust.d.ts +31 -0
- package/dist/providers/read-chat-contract.d.ts +29 -0
- package/dist/providers/sdk/v1/builders/acp/detect-status.d.ts +68 -0
- package/dist/providers/sdk/v1/builders/cli/detect-status.d.ts +86 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval-squash.d.ts +59 -0
- package/dist/providers/sdk/v1/builders/cli/parse-approval.d.ts +65 -0
- package/dist/providers/sdk/v1/builders/cli/parse-session.d.ts +91 -0
- package/dist/providers/sdk/v1/builders/cli/visible-region.d.ts +42 -0
- package/dist/providers/sdk/v1/fixture-tooling/format.d.ts +126 -0
- package/dist/providers/sdk/v1/fixture-tooling/index.d.ts +8 -0
- package/dist/providers/sdk/v1/fixture-tooling/replay.d.ts +38 -0
- package/dist/providers/sdk/v1/index.d.ts +30 -0
- package/dist/providers/sdk/v1/sandbox/README-design.d.ts +193 -0
- package/dist/providers/sdk/v1/sandbox/require-whitelist.d.ts +74 -0
- package/dist/providers/sdk/v1/sandbox/script-runner.d.ts +98 -0
- package/dist/providers/sdk/v1/types/cli/index.d.ts +277 -0
- package/dist/providers/sdk/v1/types/common/index.d.ts +203 -0
- package/dist/providers/sdk/v1/validators/index.d.ts +5 -0
- package/dist/providers/sdk/v1/validators/manifest.d.ts +40 -0
- package/dist/providers/sdk/v1/validators/taint.d.ts +52 -0
- package/dist/providers/spec/adapter.d.ts +98 -0
- package/dist/providers/spec/cli-adapter.d.ts +223 -0
- package/dist/providers/spec/evaluator.d.ts +45 -0
- package/dist/providers/spec/fsm-driver.d.ts +449 -0
- package/dist/providers/spec/fsm-evaluator.d.ts +93 -0
- package/dist/providers/spec/fsm-loader.d.ts +14 -0
- package/dist/providers/spec/fsm-types.d.ts +202 -0
- package/dist/providers/spec/native-history-executor.d.ts +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 +244 -0
- package/dist/providers/status-monitor.d.ts +7 -7
- package/dist/providers/transcript-v2.d.ts +176 -0
- package/dist/providers/types/interactive-prompt.d.ts +84 -0
- package/dist/providers/working-dir.d.ts +17 -0
- package/dist/repo-mesh-types.d.ts +616 -12
- package/dist/runtime-defaults.d.ts +2 -0
- package/dist/session-host/managed-host.d.ts +64 -0
- package/dist/session-host/runtime-surface.d.ts +10 -16
- package/dist/sessions/registry.d.ts +26 -0
- package/dist/shared-types-extra.d.ts +2 -4
- package/dist/shared-types.d.ts +110 -55
- package/dist/status/chat-tail-hot-sessions.d.ts +40 -0
- package/dist/status/normalize.d.ts +1 -1
- package/dist/status/normalize.js +1 -0
- package/dist/status/normalize.js.map +1 -1
- package/dist/status/normalize.mjs +1 -0
- package/dist/status/normalize.mjs.map +1 -1
- package/dist/status/reporter.d.ts +2 -0
- package/dist/status/snapshot.d.ts +27 -0
- package/dist/system/hash.d.ts +8 -0
- package/dist/system/load-better-sqlite3.d.ts +21 -0
- package/dist/types.d.ts +20 -6
- package/package.json +11 -4
- package/src/agent-stream/poller.ts +2 -3
- package/src/agent-stream/provider-adapter.ts +1 -1
- package/src/boot/daemon-lifecycle.ts +80 -14
- package/src/boot/process-hardening.ts +89 -0
- package/src/build-info.ts +73 -0
- package/src/chat/source-machine.ts +534 -0
- package/src/chat/source-resolver.ts +0 -0
- package/src/chat/subscription-updates.ts +20 -1
- package/src/cli-adapter-types.d.ts +3 -1
- package/src/cli-adapter-types.ts +68 -2
- package/src/cli-adapters/cli-script-runner.ts +421 -0
- package/src/cli-adapters/cli-state-engine.ts +1282 -0
- package/src/cli-adapters/provider-cli-adapter.d.ts +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +1048 -1143
- package/src/cli-adapters/provider-cli-parse.d.ts +2 -0
- package/src/cli-adapters/provider-cli-parse.ts +19 -0
- package/src/cli-adapters/provider-cli-runtime.ts +56 -7
- package/src/cli-adapters/provider-cli-shared.d.ts +4 -0
- package/src/cli-adapters/provider-cli-shared.ts +121 -11
- package/src/cli-adapters/pty-transport.ts +2 -1
- package/src/cli-adapters/pty-write-chunking.ts +106 -0
- package/src/cli-adapters/raw-terminal-io.ts +252 -0
- package/src/cli-adapters/resolve-executable.ts +204 -0
- package/src/cli-adapters/session-host-transport.ts +2 -1
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.ts +63 -29
- package/src/cli-adapters/terminal-backends/types.ts +10 -3
- package/src/cli-adapters/terminal-screen.ts +16 -81
- package/src/commands/chat-commands-debug-bundle.ts +398 -0
- package/src/commands/chat-commands-read.ts +2788 -0
- package/src/commands/chat-commands-scope.ts +54 -0
- package/src/commands/chat-commands-shared.ts +114 -0
- package/src/commands/chat-commands-write.ts +891 -0
- package/src/commands/chat-commands.ts +19 -1841
- package/src/commands/cli-manager.d.ts +2 -0
- package/src/commands/cli-manager.ts +724 -27
- package/src/commands/handler.ts +865 -2
- package/src/commands/high-family/index.ts +28 -0
- package/src/commands/high-family/mesh-coordinator-launch.ts +696 -0
- package/src/commands/high-family/mesh-events.ts +102 -0
- package/src/commands/high-family/mesh-status.ts +857 -0
- package/src/commands/high-family/types.ts +80 -0
- package/src/commands/low-family/coordinator-prompt.ts +125 -0
- package/src/commands/low-family/daemon-lifecycle.ts +120 -0
- package/src/commands/low-family/diagnostics.ts +57 -0
- package/src/commands/low-family/index.ts +37 -0
- package/src/commands/low-family/mesh-ledger.ts +62 -0
- package/src/commands/low-family/mesh-node-logs.ts +87 -0
- package/src/commands/low-family/notification.ts +116 -0
- package/src/commands/low-family/refine-config.ts +106 -0
- package/src/commands/low-family/session-host.ts +282 -0
- package/src/commands/low-family/spec-providerdev.ts +217 -0
- package/src/commands/low-family/status-meta.ts +112 -0
- package/src/commands/low-family/types.ts +39 -0
- package/src/commands/med-family/cli-agent.ts +270 -0
- package/src/commands/med-family/fast-forward.ts +230 -0
- package/src/commands/med-family/ide.ts +163 -0
- package/src/commands/med-family/index.ts +37 -0
- package/src/commands/med-family/mesh-crud.ts +1268 -0
- package/src/commands/med-family/mesh-host-pairing.ts +234 -0
- package/src/commands/med-family/mesh-queue.ts +167 -0
- package/src/commands/med-family/mesh-restart.ts +92 -0
- package/src/commands/med-family/types.ts +153 -0
- package/src/commands/mesh-coordinator.ts +334 -124
- package/src/commands/router-aggregate-status.ts +209 -0
- package/src/commands/router-mesh-session-owner.ts +114 -0
- package/src/commands/router-refine.ts +1794 -0
- package/src/commands/router-worktree-cleanup.ts +870 -0
- package/src/commands/router.ts +567 -4149
- package/src/commands/stream-commands.ts +8 -0
- package/src/commands/upgrade-helper.ts +310 -45
- package/src/config/chat-history.ts +517 -24
- package/src/config/config.ts +30 -0
- package/src/config/mesh-config.ts +300 -24
- package/src/config/mesh-json-config.ts +376 -0
- package/src/config/recent-activity.ts +8 -2
- package/src/config/registry-resolver.ts +100 -0
- package/src/config/repo-settings.ts +111 -0
- package/src/config/state-store.ts +55 -0
- package/src/daemon/dev-auto-implement.ts +3 -2
- package/src/daemon/dev-cli-debug.ts +10 -1
- package/src/daemon/dev-server.ts +0 -541
- package/src/detection/cli-detector.ts +94 -9
- package/src/detection/ide-detector.ts +55 -16
- package/src/detection/win32-ide-version.ts +106 -0
- package/src/git/change-impact-config.ts +354 -0
- package/src/git/git-commands.ts +112 -16
- package/src/git/git-diff.ts +81 -11
- package/src/git/git-executor.ts +12 -0
- package/src/git/git-status.ts +822 -48
- package/src/git/git-types.ts +14 -62
- package/src/git/git-worktree.ts +261 -4
- package/src/git/index.ts +17 -0
- package/src/index.ts +190 -13
- package/src/installer.d.ts +1 -1
- package/src/installer.ts +8 -6
- package/src/ipc/local-ipc-server.ts +278 -0
- package/src/launch.d.ts +1 -1
- package/src/launch.ts +37 -28
- package/src/logging/async-batch-writer.ts +55 -0
- package/src/logging/command-log.ts +7 -5
- package/src/logging/debug-config.ts +25 -0
- package/src/logging/debug-trace.ts +7 -2
- package/src/logging/log-redactor.ts +100 -0
- package/src/logging/log-tail-reader.ts +341 -0
- package/src/logging/logger.ts +14 -7
- package/src/mesh/contracts.ts +510 -0
- package/src/mesh/coordinator-prompt.ts +627 -34
- package/src/mesh/coordinator-registry.ts +121 -0
- package/src/mesh/mesh-active-work.ts +706 -0
- package/src/mesh/mesh-clone-grace.ts +68 -0
- package/src/mesh/mesh-completion-synthesis.ts +416 -0
- package/src/mesh/mesh-coordinator-config.ts +97 -0
- package/src/mesh/mesh-delivery-policy.ts +284 -0
- package/src/mesh/mesh-event-classify.ts +78 -0
- package/src/mesh/mesh-event-forwarding.ts +2030 -0
- package/src/mesh/mesh-event-trace.ts +67 -0
- package/src/mesh/mesh-events-coordinator.ts +32 -0
- package/src/mesh/mesh-events-pending.ts +1548 -0
- package/src/mesh/mesh-events-stale.ts +452 -0
- package/src/mesh/mesh-events-utils.ts +443 -0
- package/src/mesh/mesh-events.ts +43 -1035
- package/src/mesh/mesh-fast-forward.ts +856 -0
- package/src/mesh/mesh-host-ownership.ts +41 -3
- package/src/mesh/mesh-init.ts +350 -0
- package/src/mesh/mesh-ledger-reconciliation.ts +12 -7
- package/src/mesh/mesh-ledger.ts +897 -102
- package/src/mesh/mesh-magi-status.ts +223 -0
- package/src/mesh/mesh-missions.ts +695 -0
- package/src/mesh/mesh-node-identity.ts +2065 -0
- package/src/mesh/mesh-queue-assignment.ts +2498 -0
- package/src/mesh/mesh-reconcile-acked-hold.ts +230 -0
- package/src/mesh/mesh-reconcile-config.ts +66 -0
- package/src/mesh/mesh-reconcile-identity.ts +103 -0
- package/src/mesh/mesh-reconcile-loop.ts +1696 -0
- package/src/mesh/mesh-reconcile-v2-backstop.ts +62 -0
- package/src/mesh/mesh-refine-batch.ts +205 -0
- package/src/mesh/mesh-refine-gates.ts +1792 -0
- package/src/mesh/mesh-refine-status.ts +231 -0
- package/src/mesh/mesh-remote-event-pull.ts +279 -0
- package/src/mesh/mesh-review-inbox.ts +308 -0
- package/src/mesh/mesh-routing.ts +291 -0
- package/src/mesh/mesh-runtime-store.ts +2292 -0
- package/src/mesh/mesh-scheduling-runtime.ts +198 -0
- package/src/mesh/mesh-task-inflight.ts +70 -0
- package/src/mesh/mesh-task-stats.ts +161 -0
- package/src/mesh/mesh-unresolved-forward-outbox.ts +215 -0
- package/src/mesh/mesh-warmup-deadline.ts +152 -0
- package/src/mesh/mesh-work-queue.ts +1489 -145
- package/src/mesh/preview-freshness.ts +163 -0
- package/src/mesh/refine-config.ts +129 -12
- package/src/mesh/worktree-bootstrap-config.ts +599 -0
- package/src/providers/acp-provider-instance.ts +43 -10
- package/src/providers/approval-utils.d.ts +5 -0
- package/src/providers/approval-utils.ts +100 -6
- package/src/providers/chat-message-normalization.ts +126 -4
- package/src/providers/cli-provider-effect-format.ts +53 -0
- package/src/providers/cli-provider-history-dedup.ts +75 -0
- package/src/providers/cli-provider-input-prompt.ts +133 -0
- package/src/providers/cli-provider-instance-types.ts +131 -0
- package/src/providers/cli-provider-instance.ts +2771 -499
- package/src/providers/cli-provider-status-helpers.ts +123 -0
- package/src/providers/cli-provider-transcript-merge.ts +114 -0
- package/src/providers/contracts.d.ts +55 -0
- package/src/providers/contracts.ts +207 -6
- package/src/providers/extension-provider-instance.ts +12 -7
- package/src/providers/external-sources.ts +218 -0
- package/src/providers/ide-provider-instance.ts +35 -12
- package/src/providers/manual-attendance.ts +105 -0
- package/src/providers/native-history/antigravity-claim-registry.ts +138 -0
- package/src/providers/native-history/antigravity-cli-transcript.ts +1275 -0
- package/src/providers/native-history/claude-cli-transcript.ts +396 -0
- package/src/providers/native-history/codex-cli-transcript.ts +479 -0
- package/src/providers/native-history/constants.ts +19 -0
- package/src/providers/native-history/dispatcher.ts +617 -0
- package/src/providers/native-history/hermes-cli-transcript.ts +312 -0
- package/src/providers/native-history/index.ts +30 -0
- package/src/providers/provider-instance-manager.ts +71 -0
- package/src/providers/provider-instance.ts +24 -1
- package/src/providers/provider-loader.ts +700 -55
- package/src/providers/provider-schema.ts +93 -14
- package/src/providers/provider-trust.ts +114 -0
- package/src/providers/read-chat-contract.ts +76 -16
- package/src/providers/sdk/README.md +49 -0
- package/src/providers/sdk/v1/builders/acp/detect-status.ts +144 -0
- package/src/providers/sdk/v1/builders/cli/detect-status.ts +313 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval-squash.ts +158 -0
- package/src/providers/sdk/v1/builders/cli/parse-approval.ts +261 -0
- package/src/providers/sdk/v1/builders/cli/parse-session.ts +276 -0
- package/src/providers/sdk/v1/builders/cli/visible-region.ts +143 -0
- package/src/providers/sdk/v1/fixture-tooling/format.ts +130 -0
- package/src/providers/sdk/v1/fixture-tooling/index.ts +22 -0
- package/src/providers/sdk/v1/fixture-tooling/replay.ts +352 -0
- package/src/providers/sdk/v1/index.ts +152 -0
- package/src/providers/sdk/v1/sandbox/README-design.ts +195 -0
- package/src/providers/sdk/v1/sandbox/require-whitelist.ts +472 -0
- package/src/providers/sdk/v1/sandbox/script-runner.ts +150 -0
- package/src/providers/sdk/v1/schemas/cli/provider.schema.json +538 -0
- package/src/providers/sdk/v1/schemas/primitives/acp-session-protocol-v1.json +131 -0
- package/src/providers/sdk/v1/schemas/primitives/native-history-codex-rollout-v1.json +66 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-approval-squash-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-assistant-block-v1.json +91 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-cue-ordering-v1.json +47 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-dispatch-order-v1.json +32 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-footer-chrome-v1.json +42 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-index-finder-v1.json +27 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-modal-v1.json +125 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-prompt-marker-v1.json +45 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-session-id-extraction-v1.json +46 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-settled-prompt-v1.json +71 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-spinner-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-transcript-pty-v1.json +83 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-visible-region-v1.json +57 -0
- package/src/providers/sdk/v1/schemas/primitives/tui-welcome-screen-v1.json +35 -0
- package/src/providers/sdk/v1/types/cli/index.ts +365 -0
- package/src/providers/sdk/v1/types/common/index.ts +229 -0
- package/src/providers/sdk/v1/validators/index.ts +19 -0
- package/src/providers/sdk/v1/validators/manifest.ts +110 -0
- package/src/providers/sdk/v1/validators/taint.ts +309 -0
- package/src/providers/spec/adapter.ts +246 -0
- package/src/providers/spec/cli-adapter.ts +1064 -0
- package/src/providers/spec/evaluator.ts +407 -0
- package/src/providers/spec/fsm-driver.ts +1528 -0
- package/src/providers/spec/fsm-evaluator.ts +290 -0
- package/src/providers/spec/fsm-loader.ts +128 -0
- package/src/providers/spec/fsm-types.ts +301 -0
- package/src/providers/spec/native-history-executor.ts +1241 -0
- package/src/providers/spec/pre-launch-trust.ts +104 -0
- package/src/providers/spec/route.ts +51 -0
- package/src/providers/spec/types.ts +284 -0
- package/src/providers/status-monitor.d.ts +7 -7
- package/src/providers/status-monitor.ts +37 -22
- package/src/providers/transcript-v2.ts +567 -0
- package/src/providers/types/interactive-prompt.ts +536 -0
- package/src/providers/version-archive.ts +64 -24
- package/src/providers/working-dir.ts +23 -0
- package/src/repo-mesh-types.ts +861 -14
- package/src/runtime-defaults.ts +39 -0
- package/src/session-host/managed-host.ts +218 -0
- package/src/session-host/runtime-surface.ts +20 -80
- package/src/sessions/registry.ts +44 -0
- package/src/shared-types-extra.ts +2 -4
- package/src/shared-types.d.ts +8 -0
- package/src/shared-types.ts +148 -55
- package/src/status/builders.ts +69 -6
- package/src/status/chat-tail-hot-sessions.ts +117 -2
- package/src/status/normalize.ts +2 -0
- package/src/status/reporter.ts +19 -1
- package/src/status/snapshot.ts +100 -27
- package/src/system/hash.ts +23 -0
- package/src/system/host-memory.ts +29 -12
- package/src/system/load-better-sqlite3.ts +68 -0
- package/src/types.ts +26 -6
- package/dist/cli-adapters/terminal-backends/xterm-backend.d.ts +0 -17
- package/dist/mesh/mesh-sync.d.ts +0 -53
- package/src/cli-adapters/terminal-backends/ghostty-vt-backend.d.ts +0 -16
- package/src/cli-adapters/terminal-backends/xterm-backend.ts +0 -97
- package/src/mesh/mesh-sync.ts +0 -111
package/src/config/config.ts
CHANGED
|
@@ -123,6 +123,22 @@ export interface ADHDevConfig {
|
|
|
123
123
|
// Optional explicit provider override root (for example a local adhdev-providers checkout)
|
|
124
124
|
providerDir?: string;
|
|
125
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Optional provider registry base URL override (for example a self-hosted
|
|
128
|
+
* registry). Highest-priority source in the registry resolver, ahead of the
|
|
129
|
+
* `ADHDEV_REGISTRY_URL` env var and the vendor default. See
|
|
130
|
+
* `config/registry-resolver.ts`.
|
|
131
|
+
*/
|
|
132
|
+
registryUrl?: string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Optional provider tarball (archive) URL override so self-hosters can point
|
|
136
|
+
* the daemon at their own provider mirror instead of the vendor GitHub repo.
|
|
137
|
+
* Highest-priority source, ahead of `ADHDEV_PROVIDER_TARBALL_URL` and the
|
|
138
|
+
* vendor default. See `config/registry-resolver.ts`.
|
|
139
|
+
*/
|
|
140
|
+
providerTarballUrl?: string;
|
|
141
|
+
|
|
126
142
|
/** Preferred daemon update channel. Defaults to stable/latest. */
|
|
127
143
|
updateChannel?: ReleaseChannel;
|
|
128
144
|
|
|
@@ -233,6 +249,8 @@ function normalizeConfig(raw: unknown): ADHDevConfig & { activeWorkspaceId?: str
|
|
|
233
249
|
ideSettings: isPlainObject(parsed.ideSettings) ? parsed.ideSettings : {},
|
|
234
250
|
providerSourceMode: resolveProviderSourceMode(parsed.providerSourceMode, parsed.disableUpstream),
|
|
235
251
|
providerDir: asOptionalString(parsed.providerDir),
|
|
252
|
+
registryUrl: asOptionalString(parsed.registryUrl),
|
|
253
|
+
providerTarballUrl: asOptionalString(parsed.providerTarballUrl),
|
|
236
254
|
updateChannel: parsed.updateChannel === 'preview' ? 'preview' : 'stable',
|
|
237
255
|
terminalSizingMode: parsed.terminalSizingMode === 'fit' ? 'fit' : 'measured',
|
|
238
256
|
};
|
|
@@ -272,6 +290,18 @@ export function getConfigDir(): string {
|
|
|
272
290
|
return dir;
|
|
273
291
|
}
|
|
274
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Get the daemon runtime data directory (~/.adhdev/daemon/).
|
|
295
|
+
* Distinct from the user-config dir so runtime state can be cleared independently.
|
|
296
|
+
*/
|
|
297
|
+
export function getDaemonDataDir(): string {
|
|
298
|
+
const dir = join(getConfigDir(), 'daemon');
|
|
299
|
+
if (!existsSync(dir)) {
|
|
300
|
+
mkdirSync(dir, { recursive: true });
|
|
301
|
+
}
|
|
302
|
+
return dir;
|
|
303
|
+
}
|
|
304
|
+
|
|
275
305
|
/**
|
|
276
306
|
* Get the config file path
|
|
277
307
|
*/
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
10
10
|
import { join } from 'path';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { randomBytes, randomUUID } from 'crypto';
|
|
12
|
+
import { shortHash } from '../system/hash.js';
|
|
13
|
+
import { getConfigDir, loadConfig } from './config.js';
|
|
13
14
|
import type {
|
|
14
15
|
LocalMeshConfig,
|
|
15
16
|
LocalMeshEntry,
|
|
@@ -21,7 +22,9 @@ import type {
|
|
|
21
22
|
RepoMeshHostMetadata,
|
|
22
23
|
RepoMeshDaemonRole,
|
|
23
24
|
} from '../repo-mesh-types.js';
|
|
24
|
-
import {
|
|
25
|
+
import type { MagiKindPanelMap, MagiSlot, MagiTaskKind, DifficultyBrainMap } from '@adhdev/mesh-shared';
|
|
26
|
+
import { normalizeDifficultyBrainMap, DEFAULT_DIFFICULTY_BRAINS } from '@adhdev/mesh-shared';
|
|
27
|
+
import { mergeAndNormalizePolicy } from '../repo-mesh-types.js';
|
|
25
28
|
import { createDefaultMeshHostMetadata } from '../mesh/mesh-host-ownership.js';
|
|
26
29
|
|
|
27
30
|
// ─── Persistence ────────────────────────────────
|
|
@@ -36,12 +39,85 @@ function loadMeshConfig(): LocalMeshConfig {
|
|
|
36
39
|
try {
|
|
37
40
|
const raw = JSON.parse(readFileSync(path, 'utf-8'));
|
|
38
41
|
if (!raw || !Array.isArray(raw.meshes)) return { meshes: [] };
|
|
39
|
-
|
|
42
|
+
const config = raw as LocalMeshConfig;
|
|
43
|
+
const migrated = migrateLoadedMeshConfig(config);
|
|
44
|
+
// Persist eagerly when the on-load migration changed anything, so the
|
|
45
|
+
// dead field is gone from disk even on a pure-read path (mesh_status /
|
|
46
|
+
// mesh_list_nodes) that never otherwise mutates the config. Best-effort:
|
|
47
|
+
// a write failure (e.g. read-only fs) must not break reads, so swallow.
|
|
48
|
+
if (migrated) {
|
|
49
|
+
try {
|
|
50
|
+
saveMeshConfig(config);
|
|
51
|
+
} catch {
|
|
52
|
+
// keep the in-memory strip; disk converges on the next mutating op
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return config;
|
|
40
56
|
} catch {
|
|
41
57
|
return { meshes: [] };
|
|
42
58
|
}
|
|
43
59
|
}
|
|
44
60
|
|
|
61
|
+
/**
|
|
62
|
+
* In-place migration applied to every loaded meshes.json. Strips data that
|
|
63
|
+
* outlived the feature that wrote it so the persisted config converges on the
|
|
64
|
+
* current schema the next time it is saved.
|
|
65
|
+
*
|
|
66
|
+
* Currently: drops the dead `role` field from each node policy's providerRoles
|
|
67
|
+
* entries. providerRoles is retained for its `maxParallel` per-(node, provider)
|
|
68
|
+
* cap, but the routing `role` was removed (routing is governed solely by
|
|
69
|
+
* required_tags). A meshes.json written before the removal still carries
|
|
70
|
+
* `role: "validator"` etc.; this drops it on load so mesh_status / mesh_list_nodes
|
|
71
|
+
* never surface the dead field and the next saveMeshConfig() persists it gone.
|
|
72
|
+
*
|
|
73
|
+
* Returns true when the config was mutated (caller may persist eagerly).
|
|
74
|
+
*/
|
|
75
|
+
function migrateLoadedMeshConfig(config: LocalMeshConfig): boolean {
|
|
76
|
+
let changed = false;
|
|
77
|
+
for (const mesh of config.meshes) {
|
|
78
|
+
if (!mesh || !Array.isArray(mesh.nodes)) continue;
|
|
79
|
+
for (const node of mesh.nodes) {
|
|
80
|
+
if (stripDeadRoleFromProviderRoles(node?.policy)) changed = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return changed;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Drop the legacy `role` field from each providerRoles entry of a node policy,
|
|
88
|
+
* in place. Keeps providerType + maxParallel (the still-meaningful per-(node,
|
|
89
|
+
* provider) cap). Defensive against malformed entries — non-object items are
|
|
90
|
+
* left untouched. Returns true when at least one `role` field was removed.
|
|
91
|
+
*/
|
|
92
|
+
function stripDeadRoleFromProviderRoles(policy: unknown): boolean {
|
|
93
|
+
if (!policy || typeof policy !== 'object') return false;
|
|
94
|
+
const roles = (policy as { providerRoles?: unknown }).providerRoles;
|
|
95
|
+
if (!Array.isArray(roles)) return false;
|
|
96
|
+
let changed = false;
|
|
97
|
+
for (const entry of roles) {
|
|
98
|
+
if (entry && typeof entry === 'object' && !Array.isArray(entry)
|
|
99
|
+
&& Object.prototype.hasOwnProperty.call(entry, 'role')) {
|
|
100
|
+
delete (entry as Record<string, unknown>).role;
|
|
101
|
+
changed = true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return changed;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function normalizeCapabilityTags(value: unknown): string[] | undefined {
|
|
108
|
+
if (!Array.isArray(value)) return undefined;
|
|
109
|
+
const seen = new Set<string>();
|
|
110
|
+
const tags = value
|
|
111
|
+
.map(tag => typeof tag === 'string' ? tag.trim() : '')
|
|
112
|
+
.filter(Boolean)
|
|
113
|
+
.filter(tag => {
|
|
114
|
+
if (seen.has(tag)) return false;
|
|
115
|
+
seen.add(tag);
|
|
116
|
+
return true;
|
|
117
|
+
});
|
|
118
|
+
return tags.length ? tags : undefined;
|
|
119
|
+
}
|
|
120
|
+
|
|
45
121
|
function saveMeshConfig(config: LocalMeshConfig): void {
|
|
46
122
|
const path = getMeshConfigPath();
|
|
47
123
|
writeFileSync(path, JSON.stringify(config, null, 2), { encoding: 'utf-8', mode: 0o600 });
|
|
@@ -77,24 +153,11 @@ export function normalizeRepoIdentity(remoteUrl: string): string {
|
|
|
77
153
|
|
|
78
154
|
// ─── CRUD Operations ────────────────────────────
|
|
79
155
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (!['block', 'warn', 'checkpoint_then_continue'].includes(policy.dirtyWorkspaceBehavior)) {
|
|
86
|
-
policy.dirtyWorkspaceBehavior = 'warn';
|
|
87
|
-
}
|
|
88
|
-
const maxParallelTasks = Number(policy.maxParallelTasks);
|
|
89
|
-
policy.maxParallelTasks = Number.isFinite(maxParallelTasks) ? Math.max(1, Math.min(8, Math.floor(maxParallelTasks))) : 2;
|
|
90
|
-
if (!SESSION_CLEANUP_MODES.has(String(policy.sessionCleanupOnNodeRemove))) {
|
|
91
|
-
policy.sessionCleanupOnNodeRemove = 'preserve';
|
|
92
|
-
}
|
|
93
|
-
if (!SPAWNED_SESSION_VISIBILITY_MODES.has(String(policy.spawnedSessionVisibility))) {
|
|
94
|
-
policy.spawnedSessionVisibility = 'visible';
|
|
95
|
-
}
|
|
96
|
-
return policy;
|
|
97
|
-
}
|
|
156
|
+
// Single source of truth for default+merge+per-field normalization is
|
|
157
|
+
// mergeAndNormalizePolicy in repo-mesh-types.ts. This thin alias keeps the local
|
|
158
|
+
// call sites (createMesh/updateMesh) reading naturally while ensuring config
|
|
159
|
+
// writes go through the exact same normalizer the scheduler/display paths use.
|
|
160
|
+
const mergeMeshPolicy = mergeAndNormalizePolicy;
|
|
98
161
|
|
|
99
162
|
export function listMeshes(): LocalMeshEntry[] {
|
|
100
163
|
return loadMeshConfig().meshes;
|
|
@@ -197,7 +260,7 @@ function normalizeManualHostAddress(hostAddress: string): string {
|
|
|
197
260
|
}
|
|
198
261
|
|
|
199
262
|
export function tokenIdForManualPairing(token: string): string {
|
|
200
|
-
return `tok_${
|
|
263
|
+
return `tok_${shortHash(token)}`;
|
|
201
264
|
}
|
|
202
265
|
|
|
203
266
|
function normalizeTokenExpiry(value: unknown): string | undefined {
|
|
@@ -422,12 +485,19 @@ export interface AddNodeOptions {
|
|
|
422
485
|
repoRoot?: string;
|
|
423
486
|
daemonId?: string;
|
|
424
487
|
machineId?: string;
|
|
488
|
+
capabilities?: string[];
|
|
425
489
|
userOverrides?: Partial<RepoMeshNodeCapabilities>;
|
|
426
490
|
policy?: RepoMeshNodePolicy;
|
|
427
491
|
isLocalWorktree?: boolean;
|
|
428
492
|
worktreeBranch?: string;
|
|
429
493
|
clonedFromNodeId?: string;
|
|
494
|
+
worktreeBootstrap?: LocalMeshNodeEntry['worktreeBootstrap'];
|
|
430
495
|
role?: RepoMeshDaemonRole;
|
|
496
|
+
/** Owning daemon's machine nickname. Defaults to this daemon's local
|
|
497
|
+
* config.machineNickname when omitted — a node is always added by (and on)
|
|
498
|
+
* the daemon that owns its workspace (self/base node or a local worktree
|
|
499
|
+
* clone), so the local config is the correct source. */
|
|
500
|
+
machineNickname?: string;
|
|
431
501
|
}
|
|
432
502
|
|
|
433
503
|
export function addNode(meshId: string, opts: AddNodeOptions): LocalMeshNodeEntry | undefined {
|
|
@@ -444,17 +514,34 @@ export function addNode(meshId: string, opts: AddNodeOptions): LocalMeshNodeEntr
|
|
|
444
514
|
throw new Error('This workspace is already in the mesh');
|
|
445
515
|
}
|
|
446
516
|
|
|
517
|
+
// A node is always added by the daemon that owns its workspace (the self/base
|
|
518
|
+
// node, or a local worktree clone spawned from this daemon), so this daemon's
|
|
519
|
+
// config.machineNickname is the correct owner nickname. Explicit opt wins.
|
|
520
|
+
const machineNickname = (() => {
|
|
521
|
+
const explicit = typeof opts.machineNickname === 'string' ? opts.machineNickname.trim() : '';
|
|
522
|
+
if (explicit) return explicit;
|
|
523
|
+
try {
|
|
524
|
+
const local = loadConfig().machineNickname;
|
|
525
|
+
return typeof local === 'string' && local.trim() ? local.trim() : undefined;
|
|
526
|
+
} catch {
|
|
527
|
+
return undefined;
|
|
528
|
+
}
|
|
529
|
+
})();
|
|
530
|
+
|
|
447
531
|
const node: LocalMeshNodeEntry = {
|
|
448
532
|
id: `node_${randomUUID().replace(/-/g, '')}`,
|
|
449
533
|
workspace: opts.workspace.trim(),
|
|
450
534
|
repoRoot: opts.repoRoot,
|
|
451
535
|
daemonId: opts.daemonId,
|
|
452
536
|
machineId: opts.machineId,
|
|
537
|
+
...(machineNickname ? { machineNickname } : {}),
|
|
538
|
+
capabilities: normalizeCapabilityTags(opts.capabilities),
|
|
453
539
|
userOverrides: opts.userOverrides || {},
|
|
454
540
|
policy: opts.policy || {},
|
|
455
541
|
isLocalWorktree: opts.isLocalWorktree,
|
|
456
542
|
worktreeBranch: opts.worktreeBranch,
|
|
457
543
|
clonedFromNodeId: opts.clonedFromNodeId,
|
|
544
|
+
worktreeBootstrap: opts.worktreeBootstrap,
|
|
458
545
|
role: opts.role,
|
|
459
546
|
};
|
|
460
547
|
|
|
@@ -481,7 +568,35 @@ export function removeNode(meshId: string, nodeId: string): boolean {
|
|
|
481
568
|
export function updateNode(
|
|
482
569
|
meshId: string,
|
|
483
570
|
nodeId: string,
|
|
484
|
-
opts: {
|
|
571
|
+
opts: {
|
|
572
|
+
userOverrides?: Partial<RepoMeshNodeCapabilities>;
|
|
573
|
+
policy?: RepoMeshNodePolicy;
|
|
574
|
+
/** Operator-defined custom capability tags used by mesh queue matching.
|
|
575
|
+
* Passing an array replaces the node's custom tags (empty/whitespace
|
|
576
|
+
* entries dropped, deduped); an empty result clears them. Omit to leave
|
|
577
|
+
* the existing tags untouched. */
|
|
578
|
+
capabilities?: string[];
|
|
579
|
+
worktreeBootstrap?: LocalMeshNodeEntry['worktreeBootstrap'];
|
|
580
|
+
/** Per-node instruction surfaced in the coordinator prompt. Pass an
|
|
581
|
+
* empty string or undefined to clear it. */
|
|
582
|
+
systemPrompt?: string;
|
|
583
|
+
/** Live self-reported platform/arch from the owning daemon's git_status
|
|
584
|
+
* envelope. Persisted distinctly from userOverrides (auto-detected, not
|
|
585
|
+
* operator intent) so capability-tag os=/arch= self-heals across loads. */
|
|
586
|
+
reportedPlatform?: string;
|
|
587
|
+
reportedArch?: string;
|
|
588
|
+
/** Owning daemon's self-reported machine nickname, carried on the
|
|
589
|
+
* git_status envelope. Persisted so the friendly label survives across
|
|
590
|
+
* coordinator restarts (mirrors reportedPlatform/reportedArch). */
|
|
591
|
+
reportedMachineNickname?: string;
|
|
592
|
+
/** Owning daemon's self-reported provider CLI/ACP versions + build version,
|
|
593
|
+
* carried on the git_status envelope. Persisted distinctly from userOverrides
|
|
594
|
+
* (auto-detected observability, not operator intent), mirroring the
|
|
595
|
+
* reportedPlatform/reportedArch self-heal so the value survives restarts and
|
|
596
|
+
* is overwritten by the next report. */
|
|
597
|
+
reportedProviderVersions?: Record<string, string>;
|
|
598
|
+
reportedDaemonBuildVersion?: string;
|
|
599
|
+
},
|
|
485
600
|
): LocalMeshNodeEntry | undefined {
|
|
486
601
|
const config = loadMeshConfig();
|
|
487
602
|
const mesh = config.meshes.find(m => m.id === meshId);
|
|
@@ -491,8 +606,169 @@ export function updateNode(
|
|
|
491
606
|
if (!node) return undefined;
|
|
492
607
|
|
|
493
608
|
if (opts.userOverrides) node.userOverrides = { ...node.userOverrides, ...opts.userOverrides };
|
|
609
|
+
if (opts.reportedPlatform && opts.reportedPlatform.trim()) node.reportedPlatform = opts.reportedPlatform.trim();
|
|
610
|
+
if (opts.reportedArch && opts.reportedArch.trim()) node.reportedArch = opts.reportedArch.trim();
|
|
611
|
+
if (opts.reportedMachineNickname && opts.reportedMachineNickname.trim()) node.machineNickname = opts.reportedMachineNickname.trim();
|
|
612
|
+
if (opts.reportedProviderVersions && Object.keys(opts.reportedProviderVersions).length > 0) {
|
|
613
|
+
node.reportedProviderVersions = { ...opts.reportedProviderVersions };
|
|
614
|
+
}
|
|
615
|
+
if (opts.reportedDaemonBuildVersion && opts.reportedDaemonBuildVersion.trim()) {
|
|
616
|
+
node.reportedDaemonBuildVersion = opts.reportedDaemonBuildVersion.trim();
|
|
617
|
+
}
|
|
494
618
|
if (opts.policy) node.policy = { ...node.policy, ...opts.policy };
|
|
619
|
+
if (Object.prototype.hasOwnProperty.call(opts, 'capabilities')) {
|
|
620
|
+
// Explicit replace: normalize (trim/dedup/drop-empties); an empty result
|
|
621
|
+
// clears the tags entirely so the field never persists as [].
|
|
622
|
+
const tags = normalizeCapabilityTags(opts.capabilities);
|
|
623
|
+
if (tags && tags.length) node.capabilities = tags;
|
|
624
|
+
else delete node.capabilities;
|
|
625
|
+
}
|
|
626
|
+
if (opts.worktreeBootstrap) node.worktreeBootstrap = opts.worktreeBootstrap;
|
|
627
|
+
if (Object.prototype.hasOwnProperty.call(opts, 'systemPrompt')) {
|
|
628
|
+
// Honor explicit clears: { systemPrompt: undefined } drops the field.
|
|
629
|
+
if (opts.systemPrompt && opts.systemPrompt.trim()) {
|
|
630
|
+
node.systemPrompt = opts.systemPrompt;
|
|
631
|
+
} else {
|
|
632
|
+
delete node.systemPrompt;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
495
635
|
mesh.updatedAt = new Date().toISOString();
|
|
496
636
|
saveMeshConfig(config);
|
|
497
637
|
return node;
|
|
498
638
|
}
|
|
639
|
+
|
|
640
|
+
// ─── MAGI Panels (machine-local cross-verification quorums) ──
|
|
641
|
+
|
|
642
|
+
// NOTE: the named-panel model (normalizeMagiPanel / list / get / upsert / remove,
|
|
643
|
+
// stored under meshes.json `magiPanels`) was REMOVED. MAGI now resolves its fan-out
|
|
644
|
+
// slots SOLELY from the per-task_kind `magiKindPanels` binding below. `normalizeMagiSlots`
|
|
645
|
+
// is the sole slot normalizer.
|
|
646
|
+
|
|
647
|
+
function normalizeReplicaCount(value: unknown): number | undefined {
|
|
648
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) return undefined;
|
|
649
|
+
const n = Math.floor(value);
|
|
650
|
+
return n >= 1 ? n : undefined;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
// ─── MAGI kind → panel bindings (MAGI-KIND-PANEL) ─────────
|
|
654
|
+
//
|
|
655
|
+
// Per-task_kind slot lists (machine-local, meshes.json `magiKindPanels`). A bare
|
|
656
|
+
// `mesh_magi_review({task_kind})` resolves its panel exclusively from here — an
|
|
657
|
+
// unconfigured kind is a hard error, never a synthesized fallback. Mirrors the named
|
|
658
|
+
// panel accessors above (normalize / list / get / set / remove).
|
|
659
|
+
|
|
660
|
+
/** The task kinds a kind-panel can be bound to. Unlike a named panel's defaultKind,
|
|
661
|
+
* 'freeform' IS a valid kind-panel key (this is a direct kind→slots binding). */
|
|
662
|
+
const MAGI_KIND_PANEL_KINDS: readonly MagiTaskKind[] = ['claim_audit', 'rca', 'design', 'freeform'];
|
|
663
|
+
const MAX_MAGI_KIND_SLOTS = 24;
|
|
664
|
+
|
|
665
|
+
function normalizeMagiTaskKindKey(raw: unknown): MagiTaskKind {
|
|
666
|
+
const s = typeof raw === 'string' ? raw.trim().toLowerCase() : '';
|
|
667
|
+
if (!(MAGI_KIND_PANEL_KINDS as readonly string[]).includes(s)) {
|
|
668
|
+
throw new Error(`invalid_magi_kind_panel: task_kind must be one of ${MAGI_KIND_PANEL_KINDS.join(' / ')} (got '${s || '(empty)'}')`);
|
|
669
|
+
}
|
|
670
|
+
return s as MagiTaskKind;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Validate + normalize a kind-panel's slots (the SOLE MAGI slot normalizer): provider
|
|
675
|
+
* required per slot, trims strings, drops empties, clamps replica counts, and carries
|
|
676
|
+
* an optional per-slot `model`. Throws on structurally invalid input (empty list / no
|
|
677
|
+
* provider) so the write returns a clear error. Returns the normalized slot array.
|
|
678
|
+
*/
|
|
679
|
+
export function normalizeMagiSlots(slots: unknown): MagiSlot[] {
|
|
680
|
+
if (!Array.isArray(slots) || slots.length === 0) {
|
|
681
|
+
throw new Error('invalid_magi_kind_panel: slots must be a non-empty array');
|
|
682
|
+
}
|
|
683
|
+
if (slots.length > MAX_MAGI_KIND_SLOTS) {
|
|
684
|
+
throw new Error(`invalid_magi_kind_panel: too many slots (max ${MAX_MAGI_KIND_SLOTS})`);
|
|
685
|
+
}
|
|
686
|
+
return slots.map((entry, idx) => {
|
|
687
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
688
|
+
throw new Error(`invalid_magi_kind_panel: slot[${idx}] must be an object`);
|
|
689
|
+
}
|
|
690
|
+
const s = entry as Record<string, unknown>;
|
|
691
|
+
const provider = typeof s.provider === 'string' ? s.provider.trim() : '';
|
|
692
|
+
if (!provider) {
|
|
693
|
+
throw new Error(`invalid_magi_kind_panel: slot[${idx}].provider is required`);
|
|
694
|
+
}
|
|
695
|
+
const nodeId = typeof s.nodeId === 'string' && s.nodeId.trim() ? s.nodeId.trim() : undefined;
|
|
696
|
+
const model = typeof s.model === 'string' && s.model.trim() ? s.model.trim() : undefined;
|
|
697
|
+
const capabilityTags = normalizeCapabilityTags(s.capabilityTags);
|
|
698
|
+
const n = normalizeReplicaCount(s.n);
|
|
699
|
+
return {
|
|
700
|
+
provider,
|
|
701
|
+
...(nodeId ? { nodeId } : {}),
|
|
702
|
+
...(model ? { model } : {}),
|
|
703
|
+
...(capabilityTags ? { capabilityTags } : {}),
|
|
704
|
+
...(n !== undefined ? { n } : {}),
|
|
705
|
+
};
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/** All configured kind-panels (machine-local), keyed by task_kind. Empty when none. */
|
|
710
|
+
export function listMagiKindPanels(): MagiKindPanelMap {
|
|
711
|
+
return loadMeshConfig().magiKindPanels ?? {};
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
/** The slot list for one task_kind, or undefined when the kind is not configured. */
|
|
715
|
+
export function getMagiKindPanel(kind: string): MagiSlot[] | undefined {
|
|
716
|
+
let key: MagiTaskKind;
|
|
717
|
+
try { key = normalizeMagiTaskKindKey(kind); } catch { return undefined; }
|
|
718
|
+
return loadMeshConfig().magiKindPanels?.[key];
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Upsert the slot list for one task_kind. Unlike named panels this ALWAYS overwrites
|
|
723
|
+
* (a kind has exactly one binding) — the editor pushes the full desired slot set.
|
|
724
|
+
* Returns the normalized, persisted slots.
|
|
725
|
+
*/
|
|
726
|
+
export function setMagiKindPanel(kind: string, slots: unknown): MagiSlot[] {
|
|
727
|
+
const key = normalizeMagiTaskKindKey(kind);
|
|
728
|
+
const normalized = normalizeMagiSlots(slots);
|
|
729
|
+
const stored = loadMeshConfig();
|
|
730
|
+
const map = stored.magiKindPanels ?? {};
|
|
731
|
+
map[key] = normalized;
|
|
732
|
+
stored.magiKindPanels = map;
|
|
733
|
+
saveMeshConfig(stored);
|
|
734
|
+
return normalized;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/** Remove the binding for one task_kind. Returns true when a binding was removed. */
|
|
738
|
+
export function removeMagiKindPanel(kind: string): boolean {
|
|
739
|
+
let key: MagiTaskKind;
|
|
740
|
+
try { key = normalizeMagiTaskKindKey(kind); } catch { return false; }
|
|
741
|
+
const stored = loadMeshConfig();
|
|
742
|
+
if (!stored.magiKindPanels || !stored.magiKindPanels[key]) return false;
|
|
743
|
+
delete stored.magiKindPanels[key];
|
|
744
|
+
saveMeshConfig(stored);
|
|
745
|
+
return true;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// ─── Brain routing: per-difficulty brain presets (machine-local) ───
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* The difficulty→brain presets, machine-local. When nothing is configured yet,
|
|
752
|
+
* returns the sensible DEFAULT_DIFFICULTY_BRAINS so the coordinator always has a
|
|
753
|
+
* usable mapping (the operator can override via setDifficultyBrains). Returns a
|
|
754
|
+
* normalized copy — never the stored reference.
|
|
755
|
+
*/
|
|
756
|
+
export function getDifficultyBrains(): DifficultyBrainMap {
|
|
757
|
+
const stored = loadMeshConfig().difficultyBrains;
|
|
758
|
+
const normalized = normalizeDifficultyBrainMap(stored);
|
|
759
|
+
return Object.keys(normalized).length > 0 ? normalized : { ...DEFAULT_DIFFICULTY_BRAINS };
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Replace the difficulty→brain presets wholesale (the editor pushes the full map).
|
|
764
|
+
* Passing an empty/normalized-empty map clears the override, so getDifficultyBrains
|
|
765
|
+
* falls back to the defaults again. Returns the normalized, persisted map.
|
|
766
|
+
*/
|
|
767
|
+
export function setDifficultyBrains(map: unknown): DifficultyBrainMap {
|
|
768
|
+
const normalized = normalizeDifficultyBrainMap(map);
|
|
769
|
+
const stored = loadMeshConfig();
|
|
770
|
+
if (Object.keys(normalized).length > 0) stored.difficultyBrains = normalized;
|
|
771
|
+
else delete stored.difficultyBrains;
|
|
772
|
+
saveMeshConfig(stored);
|
|
773
|
+
return normalized;
|
|
774
|
+
}
|