create-principles-disciple 1.154.5 → 1.155.1
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/_release/product-identity.json +2 -2
- package/codex-adapter/dist/codec/input-decoder.d.ts +17 -0
- package/codex-adapter/dist/codec/input-decoder.js +39 -0
- package/codex-adapter/dist/ingestion/explicit-owner-statement.js +125 -1
- package/codex-adapter/dist/ingestion/pain-receipt-fallback.d.ts +46 -0
- package/codex-adapter/dist/ingestion/pain-receipt-fallback.js +193 -0
- package/codex-adapter/dist/ingestion/turn-context.d.ts +10 -15
- package/codex-adapter/dist/ingestion/turn-context.js +35 -9
- package/codex-adapter/dist/pd-hook.js +57 -1
- package/codex-adapter/dist/worker/workspace-worker.d.ts +15 -0
- package/codex-adapter/dist/worker/workspace-worker.js +91 -12
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/index.js +10 -0
- package/console/dist/server/models/EvidenceChainConsoleModel.js +31 -0
- package/console/dist/server/routes/service-host.d.ts +19 -0
- package/console/dist/server/routes/service-host.js +129 -0
- package/console/dist/web/assets/app.js +37 -37
- package/core/dist/runtime/context-payload.d.ts +48 -0
- package/core/dist/runtime/context-payload.d.ts.map +1 -1
- package/core/dist/runtime/context-payload.js +12 -0
- package/core/dist/runtime/context-payload.js.map +1 -1
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js +18 -0
- package/core/dist/runtime/diagnostician/rootcause-prompt-builder.js.map +1 -1
- package/core/dist/runtime/diagnostician-candidate.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician-candidate.js +18 -2
- package/core/dist/runtime/diagnostician-candidate.js.map +1 -1
- package/core/dist/runtime/evidence-guards.d.ts +7 -3
- package/core/dist/runtime/evidence-guards.d.ts.map +1 -1
- package/core/dist/runtime/evidence-guards.js +9 -7
- package/core/dist/runtime/evidence-guards.js.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-contract.js +14 -0
- package/core/dist/runtime/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.d.ts.map +1 -1
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js +8 -0
- package/core/dist/runtime/feature-flags/feature-flag-lifecycle.js.map +1 -1
- package/core/dist/runtime/host-submission-context.d.ts +83 -0
- package/core/dist/runtime/host-submission-context.d.ts.map +1 -0
- package/core/dist/runtime/host-submission-context.js +183 -0
- package/core/dist/runtime/host-submission-context.js.map +1 -0
- package/core/dist/runtime/index.d.ts +9 -2
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js +29 -2
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/intent/intent-doc.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-doc.js +29 -5
- package/core/dist/runtime/intent/intent-doc.js.map +1 -1
- package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +9 -0
- package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-distiller-runner.js +13 -0
- package/core/dist/runtime/internalization/diag-distiller-runner.js.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +11 -0
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.js +10 -0
- package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.d.ts +9 -0
- package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.js +13 -0
- package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
- package/core/dist/runtime/internalization/index.d.ts +1 -1
- package/core/dist/runtime/internalization/index.d.ts.map +1 -1
- package/core/dist/runtime/internalization/index.js +1 -1
- package/core/dist/runtime/internalization/index.js.map +1 -1
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts +19 -0
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.d.ts.map +1 -1
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.js +24 -0
- package/core/dist/runtime/internalization/intake-to-internalization-bridge.js.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts +8 -0
- package/core/dist/runtime/internalization/internalization-orchestrator.d.ts.map +1 -1
- package/core/dist/runtime/internalization/internalization-orchestrator.js +36 -4
- package/core/dist/runtime/internalization/internalization-orchestrator.js.map +1 -1
- package/core/dist/runtime/internalization/source-authorization-boundary.d.ts +39 -0
- package/core/dist/runtime/internalization/source-authorization-boundary.d.ts.map +1 -0
- package/core/dist/runtime/internalization/source-authorization-boundary.js +57 -0
- package/core/dist/runtime/internalization/source-authorization-boundary.js.map +1 -0
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.js +72 -5
- package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
- package/core/dist/runtime/pain-admission-disposition.d.ts +60 -0
- package/core/dist/runtime/pain-admission-disposition.d.ts.map +1 -0
- package/core/dist/runtime/pain-admission-disposition.js +37 -0
- package/core/dist/runtime/pain-admission-disposition.js.map +1 -0
- package/core/dist/runtime/pain-ingress-payload.d.ts +36 -2
- package/core/dist/runtime/pain-ingress-payload.d.ts.map +1 -1
- package/core/dist/runtime/pain-ingress-payload.js +63 -6
- package/core/dist/runtime/pain-ingress-payload.js.map +1 -1
- package/core/dist/runtime/pain-ingress.d.ts.map +1 -1
- package/core/dist/runtime/pain-ingress.js +28 -0
- package/core/dist/runtime/pain-ingress.js.map +1 -1
- package/core/dist/runtime/pain-recall-read-model.d.ts +13 -1
- package/core/dist/runtime/pain-recall-read-model.d.ts.map +1 -1
- package/core/dist/runtime/pain-recall-read-model.js +50 -7
- package/core/dist/runtime/pain-recall-read-model.js.map +1 -1
- package/core/dist/runtime/pain-receipt-recovery.d.ts +147 -0
- package/core/dist/runtime/pain-receipt-recovery.d.ts.map +1 -0
- package/core/dist/runtime/pain-receipt-recovery.js +475 -0
- package/core/dist/runtime/pain-receipt-recovery.js.map +1 -0
- package/core/dist/runtime/pain-signal-bridge.d.ts +13 -1
- package/core/dist/runtime/pain-signal-bridge.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-bridge.js +174 -0
- package/core/dist/runtime/pain-signal-bridge.js.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts +9 -0
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.js +8 -3
- package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime/pain-submit-capability.d.ts +11 -0
- package/core/dist/runtime/pain-submit-capability.d.ts.map +1 -1
- package/core/dist/runtime/pain-submit-capability.js +77 -3
- package/core/dist/runtime/pain-submit-capability.js.map +1 -1
- package/core/dist/runtime/pain-target-evidence-reconcile.d.ts +55 -0
- package/core/dist/runtime/pain-target-evidence-reconcile.d.ts.map +1 -0
- package/core/dist/runtime/pain-target-evidence-reconcile.js +164 -0
- package/core/dist/runtime/pain-target-evidence-reconcile.js.map +1 -0
- package/core/dist/runtime/pain-to-principle-service.d.ts +8 -0
- package/core/dist/runtime/pain-to-principle-service.d.ts.map +1 -1
- package/core/dist/runtime/pain-to-principle-service.js +1 -0
- package/core/dist/runtime/pain-to-principle-service.js.map +1 -1
- package/core/dist/runtime/source-material-authorization.d.ts +166 -0
- package/core/dist/runtime/source-material-authorization.d.ts.map +1 -0
- package/core/dist/runtime/source-material-authorization.js +250 -0
- package/core/dist/runtime/source-material-authorization.js.map +1 -0
- package/core/dist/runtime/store/context/index.d.ts +1 -0
- package/core/dist/runtime/store/context/index.d.ts.map +1 -1
- package/core/dist/runtime/store/context/index.js +1 -0
- package/core/dist/runtime/store/context/index.js.map +1 -1
- package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts +8 -0
- package/core/dist/runtime/store/context/promoted-evidence-reader.d.ts.map +1 -1
- package/core/dist/runtime/store/context/promoted-evidence-reader.js +15 -1
- package/core/dist/runtime/store/context/promoted-evidence-reader.js.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts +22 -0
- package/core/dist/runtime/store/context/sqlite-context-assembler.d.ts.map +1 -1
- package/core/dist/runtime/store/context/sqlite-context-assembler.js +153 -3
- package/core/dist/runtime/store/context/sqlite-context-assembler.js.map +1 -1
- package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts +13 -0
- package/core/dist/runtime/store/context/trajectory-turn-reader.d.ts.map +1 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +15 -0
- package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.js +16 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.js.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.d.ts +2 -0
- package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
- package/core/dist/runtime/store/task/memory-task-store.d.ts +1 -0
- package/core/dist/runtime/store/task/memory-task-store.d.ts.map +1 -1
- package/core/dist/runtime/store/task/memory-task-store.js +37 -0
- package/core/dist/runtime/store/task/memory-task-store.js.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts +10 -0
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.js +20 -0
- package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
- package/core/dist/runtime/store/task/task-store.d.ts +16 -0
- package/core/dist/runtime/store/task/task-store.d.ts.map +1 -1
- package/core/dist/runtime/task-status.d.ts +13 -0
- package/core/dist/runtime/task-status.d.ts.map +1 -1
- package/core/dist/runtime/task-status.js +9 -0
- package/core/dist/runtime/task-status.js.map +1 -1
- package/core/dist/runtime/types/evidence-chain-contract.d.ts +10 -0
- package/core/dist/runtime/types/evidence-chain-contract.d.ts.map +1 -1
- package/core/dist/runtime/types/evidence-chain-contract.js +7 -0
- package/core/dist/runtime/types/evidence-chain-contract.js.map +1 -1
- package/core/package.json +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +77 -30
- package/dist/installer.js.map +1 -1
- package/dist/installers/mcp-registration-conflict.d.ts +8 -0
- package/dist/installers/mcp-registration-conflict.d.ts.map +1 -1
- package/dist/installers/mcp-registration-conflict.js +34 -1
- package/dist/installers/mcp-registration-conflict.js.map +1 -1
- package/dist/installers/workbuddy-host-installer.d.ts +45 -13
- package/dist/installers/workbuddy-host-installer.d.ts.map +1 -1
- package/dist/installers/workbuddy-host-installer.js +284 -21
- package/dist/installers/workbuddy-host-installer.js.map +1 -1
- package/dist/prompts.d.ts +11 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +4 -0
- package/dist/prompts.js.map +1 -1
- package/dist/service-host-bridge.d.ts +67 -0
- package/dist/service-host-bridge.d.ts.map +1 -0
- package/dist/service-host-bridge.js +292 -0
- package/dist/service-host-bridge.js.map +1 -0
- package/dist/uninstaller.d.ts.map +1 -1
- package/dist/uninstaller.js +26 -0
- package/dist/uninstaller.js.map +1 -1
- package/dist/update/install-layout.d.ts +0 -12
- package/dist/update/install-layout.d.ts.map +1 -1
- package/dist/update/install-layout.js +42 -15
- package/dist/update/install-layout.js.map +1 -1
- package/host-runtime/dist/diagnostician-auto-run.js +4 -1
- package/host-runtime/dist/governance-observation-store.d.ts +7 -0
- package/host-runtime/dist/governance-observation-store.js +15 -4
- package/host-runtime/dist/governance-signal-admission.d.ts +49 -0
- package/host-runtime/dist/governance-signal-admission.js +355 -94
- package/host-runtime/dist/governance-trajectory-turn-reader.d.ts +20 -4
- package/host-runtime/dist/governance-trajectory-turn-reader.js +77 -5
- package/host-runtime/dist/index.d.ts +2 -0
- package/host-runtime/dist/index.js +5 -0
- package/host-runtime/dist/internalization-consumer-cycle.js +4 -1
- package/host-runtime/dist/pd-config.d.ts +10 -0
- package/host-runtime/dist/pd-config.js +37 -0
- package/host-runtime/dist/signal-stage2-cycle.js +28 -1
- package/host-runtime/dist/source-material-authorization.d.ts +53 -0
- package/host-runtime/dist/source-material-authorization.js +67 -0
- package/host-runtime/dist/source-revocation-sweep.d.ts +172 -0
- package/host-runtime/dist/source-revocation-sweep.js +928 -0
- package/host-runtime/package.json +5 -1
- package/install-layout/dist/background-execution-transition.d.ts +258 -0
- package/install-layout/dist/background-execution-transition.js +836 -0
- package/install-layout/dist/index.d.ts +8 -0
- package/install-layout/dist/index.js +8 -0
- package/install-layout/package.json +6 -2
- package/package.json +4 -4
- package/pd-cli/dist/commands/candidate.d.ts.map +1 -1
- package/pd-cli/dist/commands/candidate.js +16 -5
- package/pd-cli/dist/commands/candidate.js.map +1 -1
- package/pd-cli/dist/commands/codex-setup.d.ts.map +1 -1
- package/pd-cli/dist/commands/codex-setup.js +17 -1
- package/pd-cli/dist/commands/codex-setup.js.map +1 -1
- package/pd-cli/dist/commands/codex-worker.d.ts.map +1 -1
- package/pd-cli/dist/commands/codex-worker.js +8 -4
- package/pd-cli/dist/commands/codex-worker.js.map +1 -1
- package/pd-cli/dist/commands/consent-sweep-revoked.d.ts +20 -0
- package/pd-cli/dist/commands/consent-sweep-revoked.d.ts.map +1 -0
- package/pd-cli/dist/commands/consent-sweep-revoked.js +85 -0
- package/pd-cli/dist/commands/consent-sweep-revoked.js.map +1 -0
- package/pd-cli/dist/commands/context.d.ts.map +1 -1
- package/pd-cli/dist/commands/context.js +9 -1
- package/pd-cli/dist/commands/context.js.map +1 -1
- package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
- package/pd-cli/dist/commands/diagnose.js +12 -6
- package/pd-cli/dist/commands/diagnose.js.map +1 -1
- package/pd-cli/dist/commands/openclaw-worker.d.ts +11 -0
- package/pd-cli/dist/commands/openclaw-worker.d.ts.map +1 -0
- package/pd-cli/dist/commands/openclaw-worker.js +199 -0
- package/pd-cli/dist/commands/openclaw-worker.js.map +1 -0
- package/pd-cli/dist/commands/pain-explicit.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-explicit.js +1 -0
- package/pd-cli/dist/commands/pain-explicit.js.map +1 -1
- package/pd-cli/dist/commands/pain-recall.d.ts +2 -2
- package/pd-cli/dist/commands/pain-recall.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-recall.js +7 -1
- package/pd-cli/dist/commands/pain-recall.js.map +1 -1
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +12 -6
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +2 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts +1 -0
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +32 -8
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-wake-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-wake-once.js +2 -1
- package/pd-cli/dist/commands/runtime-internalization-wake-once.js.map +1 -1
- package/pd-cli/dist/commands/service-handover.d.ts +12 -0
- package/pd-cli/dist/commands/service-handover.d.ts.map +1 -0
- package/pd-cli/dist/commands/service-handover.js +117 -0
- package/pd-cli/dist/commands/service-handover.js.map +1 -0
- package/pd-cli/dist/commands/service-lifecycle.d.ts +31 -0
- package/pd-cli/dist/commands/service-lifecycle.d.ts.map +1 -0
- package/pd-cli/dist/commands/service-lifecycle.js +207 -0
- package/pd-cli/dist/commands/service-lifecycle.js.map +1 -0
- package/pd-cli/dist/commands/service-run-once.d.ts +96 -0
- package/pd-cli/dist/commands/service-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/service-run-once.js +432 -13
- package/pd-cli/dist/commands/service-run-once.js.map +1 -1
- package/pd-cli/dist/commands/workbuddy-setup.d.ts.map +1 -1
- package/pd-cli/dist/commands/workbuddy-setup.js +22 -2
- package/pd-cli/dist/commands/workbuddy-setup.js.map +1 -1
- package/pd-cli/dist/program.d.ts.map +1 -1
- package/pd-cli/dist/program.js +167 -9
- package/pd-cli/dist/program.js.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.d.ts +3 -1
- package/pd-cli/dist/services/admission-write-gate.d.ts.map +1 -1
- package/pd-cli/dist/services/admission-write-gate.js +1 -0
- package/pd-cli/dist/services/admission-write-gate.js.map +1 -1
- package/pd-cli/dist/services/service-host/coordinator-common.d.ts +49 -0
- package/pd-cli/dist/services/service-host/coordinator-common.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/coordinator-common.js +158 -0
- package/pd-cli/dist/services/service-host/coordinator-common.js.map +1 -0
- package/pd-cli/dist/services/service-host/handover-claims.d.ts +14 -0
- package/pd-cli/dist/services/service-host/handover-claims.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/handover-claims.js +50 -0
- package/pd-cli/dist/services/service-host/handover-claims.js.map +1 -0
- package/pd-cli/dist/services/service-host/index.d.ts +19 -3
- package/pd-cli/dist/services/service-host/index.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/index.js +21 -3
- package/pd-cli/dist/services/service-host/index.js.map +1 -1
- package/pd-cli/dist/services/service-host/install-identity.d.ts +23 -3
- package/pd-cli/dist/services/service-host/install-identity.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/install-identity.js +15 -5
- package/pd-cli/dist/services/service-host/install-identity.js.map +1 -1
- package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts +130 -9
- package/pd-cli/dist/services/service-host/locking/service-run-lock.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/locking/service-run-lock.js +99 -19
- package/pd-cli/dist/services/service-host/locking/service-run-lock.js.map +1 -1
- package/pd-cli/dist/services/service-host/managed-run.d.ts +75 -0
- package/pd-cli/dist/services/service-host/managed-run.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/managed-run.js +550 -0
- package/pd-cli/dist/services/service-host/managed-run.js.map +1 -0
- package/pd-cli/dist/services/service-host/progress-evidence.d.ts +38 -0
- package/pd-cli/dist/services/service-host/progress-evidence.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/progress-evidence.js +155 -0
- package/pd-cli/dist/services/service-host/progress-evidence.js.map +1 -0
- package/pd-cli/dist/services/service-host/run-once.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/run-once.js +4 -136
- package/pd-cli/dist/services/service-host/run-once.js.map +1 -1
- package/pd-cli/dist/services/service-host/scheduler/contract.d.ts +184 -0
- package/pd-cli/dist/services/service-host/scheduler/contract.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/contract.js +86 -0
- package/pd-cli/dist/services/service-host/scheduler/contract.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/index.d.ts +76 -0
- package/pd-cli/dist/services/service-host/scheduler/index.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/index.js +128 -0
- package/pd-cli/dist/services/service-host/scheduler/index.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/linux.d.ts +27 -0
- package/pd-cli/dist/services/service-host/scheduler/linux.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/linux.js +1010 -0
- package/pd-cli/dist/services/service-host/scheduler/linux.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/macos.d.ts +13 -0
- package/pd-cli/dist/services/service-host/scheduler/macos.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/macos.js +819 -0
- package/pd-cli/dist/services/service-host/scheduler/macos.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts +13 -0
- package/pd-cli/dist/services/service-host/scheduler/runtime-io.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/runtime-io.js +141 -0
- package/pd-cli/dist/services/service-host/scheduler/runtime-io.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts +99 -0
- package/pd-cli/dist/services/service-host/scheduler/service-status.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/service-status.js +202 -0
- package/pd-cli/dist/services/service-host/scheduler/service-status.js.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/windows.d.ts +40 -0
- package/pd-cli/dist/services/service-host/scheduler/windows.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/scheduler/windows.js +688 -0
- package/pd-cli/dist/services/service-host/scheduler/windows.js.map +1 -0
- package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts +43 -0
- package/pd-cli/dist/services/service-host/shadow-progress-store.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/shadow-progress-store.js +156 -0
- package/pd-cli/dist/services/service-host/shadow-progress-store.js.map +1 -0
- package/pd-cli/dist/services/service-host/shadow-run.d.ts +87 -0
- package/pd-cli/dist/services/service-host/shadow-run.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/shadow-run.js +549 -0
- package/pd-cli/dist/services/service-host/shadow-run.js.map +1 -0
- package/pd-cli/dist/services/service-host/status/service-run-status.d.ts +114 -4
- package/pd-cli/dist/services/service-host/status/service-run-status.d.ts.map +1 -1
- package/pd-cli/dist/services/service-host/status/service-run-status.js +37 -0
- package/pd-cli/dist/services/service-host/status/service-run-status.js.map +1 -1
- package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts +2 -0
- package/pd-cli/dist/services/service-host/worker-adapter-codex.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-codex.js +76 -0
- package/pd-cli/dist/services/service-host/worker-adapter-codex.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts +2 -0
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js +49 -0
- package/pd-cli/dist/services/service-host/worker-adapter-openclaw.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts +2 -0
- package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js +36 -0
- package/pd-cli/dist/services/service-host/worker-adapter-workbuddy.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter.d.ts +187 -0
- package/pd-cli/dist/services/service-host/worker-adapter.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-adapter.js +609 -0
- package/pd-cli/dist/services/service-host/worker-adapter.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-env.d.ts +84 -0
- package/pd-cli/dist/services/service-host/worker-env.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-env.js +195 -0
- package/pd-cli/dist/services/service-host/worker-env.js.map +1 -0
- package/pd-cli/dist/services/service-host/worker-process.d.ts +75 -0
- package/pd-cli/dist/services/service-host/worker-process.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/worker-process.js +225 -0
- package/pd-cli/dist/services/service-host/worker-process.js.map +1 -0
- package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts +61 -0
- package/pd-cli/dist/services/service-host/workspace-dispatch.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/workspace-dispatch.js +105 -0
- package/pd-cli/dist/services/service-host/workspace-dispatch.js.map +1 -0
- package/pd-cli/dist/services/service-host/workspace-handover.d.ts +190 -0
- package/pd-cli/dist/services/service-host/workspace-handover.d.ts.map +1 -0
- package/pd-cli/dist/services/service-host/workspace-handover.js +1393 -0
- package/pd-cli/dist/services/service-host/workspace-handover.js.map +1 -0
- package/pd-cli/package.json +6 -5
- package/pd-mcp-server/dist/submit-assembly.js +159 -42
- package/pd-mcp-server/dist/version.d.ts +1 -1
- package/pd-mcp-server/dist/version.js +1 -1
- package/pd-mcp-server/package.json +1 -1
- package/plugin/dist/bundle.js +586 -568
- package/plugin/dist/openclaw-worker.d.ts +92 -0
- package/plugin/dist/openclaw-worker.js +2439 -0
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/service/gateway-consumer-lease.d.ts +142 -0
- package/plugin/dist/service/gateway-quiesce-ack.d.ts +40 -0
- package/plugin/dist/service/internalization-auto-consumer-service.d.ts +68 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +5 -1
- package/release-manager/dist/installer.js +77 -30
- package/release-manager/dist/installers/mcp-registration-conflict.js +34 -1
- package/release-manager/dist/installers/workbuddy-host-installer.js +284 -21
- package/release-manager/dist/service-host-bridge.js +292 -0
- package/release-manager/dist/update/install-layout.js +42 -15
- package/release-manager/package.json +2 -2
- package/workbuddy-adapter/dist/index.d.ts +1 -1
- package/workbuddy-adapter/dist/index.js +1 -1
- package/workbuddy-adapter/dist/worker/workspace-worker.d.ts +7 -0
- package/workbuddy-adapter/dist/worker/workspace-worker.js +179 -10
- package/workbuddy-adapter/package.json +1 -1
- package/workbuddy-adapter/plugin/.codebuddy-plugin/plugin.json +2 -2
|
@@ -43,11 +43,15 @@
|
|
|
43
43
|
*/
|
|
44
44
|
import { spawnSync, execFileSync } from 'node:child_process';
|
|
45
45
|
import { createHash } from 'node:crypto';
|
|
46
|
-
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, readlinkSync, renameSync, rmSync, cpSync, writeFileSync, openSync, closeSync } from 'node:fs';
|
|
46
|
+
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, readlinkSync, renameSync, rmSync, cpSync, copyFileSync, writeFileSync, openSync, closeSync } from 'node:fs';
|
|
47
47
|
import * as path from 'node:path';
|
|
48
48
|
import * as yaml from 'js-yaml';
|
|
49
49
|
import semver from 'semver';
|
|
50
50
|
import { getInstallLayoutPaths, getWorkbuddyWorkspaceDir, installManifestHostsForPersist, mergeInstallManifestWorkspaces, parseInstallManifest, INSTALL_LAYOUT_VERSION, } from '@principles/install-layout';
|
|
51
|
+
// withInstallManifestWriteLock ships with the PRI-1282 install-layout
|
|
52
|
+
// cohort; a registry-resolved older dep lacks it, so the merge below
|
|
53
|
+
// detects the export (same release-window posture as installer.ts).
|
|
54
|
+
import * as installLayoutModule from '@principles/install-layout';
|
|
51
55
|
// 2026-11-08: the shared state DEFINITIONS for pd-cli health live in
|
|
52
56
|
// @principles/install-layout (interpretWorkbuddyPluginState /
|
|
53
57
|
// getWorkbuddyHostConfigPaths). The installer does NOT import them at
|
|
@@ -65,7 +69,7 @@ export const WORKBUDDY_MARKETPLACE_NAME = 'principles-disciple-market';
|
|
|
65
69
|
export const WORKBUDDY_PLUGIN_KEY = `${WORKBUDDY_PLUGIN_NAME}@${WORKBUDDY_MARKETPLACE_NAME}`;
|
|
66
70
|
const WORKBUDDY_REQUIRED_SKILLS = ['pd-cli-operator', 'pd-pain-signal', 'pd-review', 'pd-control'];
|
|
67
71
|
import { atomicReplaceTextFile, AtomicReplaceCleanupError, AtomicReplaceConflictError, errnoCode } from '../utils/config-file-io.js';
|
|
68
|
-
import { checkMcpRegistrationConflict } from './mcp-registration-conflict.js';
|
|
72
|
+
import { checkMcpRegistrationConflict, classifyWorkbuddyMcpJsonObject, PD_MCP_SERVER_NAME } from './mcp-registration-conflict.js';
|
|
69
73
|
import { deprecateAllLegacyWorkbuddySkills } from './legacy-workbuddy-skill.js';
|
|
70
74
|
import { resolveMcpServerDir, resolveMcpServerEntry } from '../mcp-server-layout-compat.js';
|
|
71
75
|
import { getHomeDir, generateConfigYamlContent, getConfigYamlPath, resolveDefaultModelForProvider, isValidHttpBaseUrl } from '../mvp-config.js';
|
|
@@ -1063,7 +1067,7 @@ function readInstallJsonRecord(manifestPath) {
|
|
|
1063
1067
|
* channel/autoCheck/releaseMetadataUrl — PRI-709 P0-1) are carried through.
|
|
1064
1068
|
* Malformed existing manifest → hard stop, zero modification.
|
|
1065
1069
|
*/
|
|
1066
|
-
|
|
1070
|
+
function mergeWorkbuddyIntoInstallManifestLocked(manifestPath, governanceDir, atomicReplace = atomicReplaceTextFile) {
|
|
1067
1071
|
let current;
|
|
1068
1072
|
let existed = false;
|
|
1069
1073
|
try {
|
|
@@ -1130,19 +1134,87 @@ export function mergeWorkbuddyIntoInstallManifest(manifestPath, governanceDir, a
|
|
|
1130
1134
|
};
|
|
1131
1135
|
}
|
|
1132
1136
|
}
|
|
1137
|
+
function installedOwnershipCapability() {
|
|
1138
|
+
const transitionModule = path.join(getHomeDir(), '.pd', 'runtime', 'install-layout', 'dist', 'background-execution-transition.js');
|
|
1139
|
+
let content;
|
|
1140
|
+
try {
|
|
1141
|
+
content = readFileSync(transitionModule, 'utf-8');
|
|
1142
|
+
}
|
|
1143
|
+
catch (error) {
|
|
1144
|
+
return errnoCode(error) === 'ENOENT' ? 'pre_cohort' : 'unverifiable';
|
|
1145
|
+
}
|
|
1146
|
+
return content.includes('withInstallManifestWriteLock') ? 'cohort' : 'pre_cohort';
|
|
1147
|
+
}
|
|
1148
|
+
function cohortWindowUnlockedWriteUnsafe(operation, capability) {
|
|
1149
|
+
return {
|
|
1150
|
+
ok: false,
|
|
1151
|
+
reason: `install_manifest_lock_unavailable: the bundled @principles/install-layout predates the §8.4 manifest write lock while the installed runtime ${capability === 'cohort' ? 'IS ownership-capable' : 'capability could not be verified'} — an unlocked ${operation} could clobber an in-flight handover/rollback write. No write was performed.`,
|
|
1152
|
+
nextAction: 'Update @principles/install-layout to a release that exports withInstallManifestWriteLock, or re-run the installer once the dependency resolves to that cohort.',
|
|
1153
|
+
};
|
|
1154
|
+
}
|
|
1155
|
+
export function mergeWorkbuddyIntoInstallManifest(manifestPath, governanceDir, atomicReplace = atomicReplaceTextFile) {
|
|
1156
|
+
// The manifest also carries §8.4 ownership records. Every read-modify-write
|
|
1157
|
+
// must join the same physical lock; an older dependency cohort without the
|
|
1158
|
+
// lock export is incompatible and must not write around the ownership CAS.
|
|
1159
|
+
const lock = installLayoutModule.withInstallManifestWriteLock;
|
|
1160
|
+
if (typeof lock !== 'function') {
|
|
1161
|
+
// An old installer dependency can coexist with a newer installed pd
|
|
1162
|
+
// runtime. Unlocked writes are safe only when that runtime is verifiably
|
|
1163
|
+
// pre-§8.4; otherwise it may be writing ownership concurrently.
|
|
1164
|
+
const capability = installedOwnershipCapability();
|
|
1165
|
+
if (capability !== 'pre_cohort') {
|
|
1166
|
+
return cohortWindowUnlockedWriteUnsafe('workbuddy.mergeInstallManifest', capability);
|
|
1167
|
+
}
|
|
1168
|
+
return mergeWorkbuddyIntoInstallManifestLocked(manifestPath, governanceDir, atomicReplace);
|
|
1169
|
+
}
|
|
1170
|
+
const locked = lock({ manifestPath, operation: 'workbuddy.mergeInstallManifest', context: governanceDir }, () => mergeWorkbuddyIntoInstallManifestLocked(manifestPath, governanceDir, atomicReplace));
|
|
1171
|
+
if (!locked.ok) {
|
|
1172
|
+
return {
|
|
1173
|
+
ok: false,
|
|
1174
|
+
reason: `install_manifest_lock_unavailable: ${locked.message}. No write was performed.`,
|
|
1175
|
+
nextAction: 'Wait for the in-flight manifest operation to finish and re-run the installer; the write is never done unlocked.',
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
return locked.value;
|
|
1179
|
+
}
|
|
1133
1180
|
/** Remove 'workbuddy' from manifest hosts (uninstall bookkeeping; workspaces/governance data preserved). */
|
|
1134
1181
|
function removeWorkbuddyFromInstallManifestHosts(manifestPath) {
|
|
1135
|
-
|
|
1182
|
+
if (!existsSync(manifestPath))
|
|
1183
|
+
return { ok: true };
|
|
1184
|
+
const lock = installLayoutModule.withInstallManifestWriteLock;
|
|
1185
|
+
if (typeof lock !== 'function') {
|
|
1186
|
+
return {
|
|
1187
|
+
ok: false,
|
|
1188
|
+
reason: 'install_manifest_lock_unavailable: the installed @principles/install-layout does not expose the shared manifest lock; WorkBuddy was removed but the host registration remains.',
|
|
1189
|
+
nextAction: 'Update the installer/runtime cohort, then retry WorkBuddy uninstall to remove the stale host registration safely.',
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
const write = () => {
|
|
1193
|
+
// Re-read inside the lock: bytes observed before the critical section are stale.
|
|
1136
1194
|
const parsed = JSON.parse(readFileSync(manifestPath, 'utf-8'));
|
|
1137
1195
|
if (!isRecord(parsed) || !Array.isArray(parsed.hosts))
|
|
1138
1196
|
return;
|
|
1139
1197
|
const hosts = parsed.hosts.filter((h) => typeof h === 'string' && h !== 'workbuddy');
|
|
1140
1198
|
const payload = { ...parsed, hosts };
|
|
1141
|
-
|
|
1199
|
+
atomicReplaceTextFile(manifestPath, JSON.stringify(payload, null, 2) + '\n');
|
|
1200
|
+
};
|
|
1201
|
+
try {
|
|
1202
|
+
const locked = lock({ manifestPath, operation: 'workbuddy.removeFromInstallManifest', context: path.dirname(manifestPath) }, write);
|
|
1203
|
+
if (!locked.ok) {
|
|
1204
|
+
return {
|
|
1205
|
+
ok: false,
|
|
1206
|
+
reason: `install_manifest_lock_unavailable: ${locked.message}; WorkBuddy host registration was preserved.`,
|
|
1207
|
+
nextAction: 'Wait for the in-flight manifest operation to finish, then retry WorkBuddy uninstall.',
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
return { ok: true };
|
|
1142
1211
|
}
|
|
1143
|
-
catch {
|
|
1144
|
-
|
|
1145
|
-
|
|
1212
|
+
catch (error) {
|
|
1213
|
+
return {
|
|
1214
|
+
ok: false,
|
|
1215
|
+
reason: `workbuddy_manifest_uninstall_write_failed: ${error instanceof Error ? error.message : String(error)}; the host registration was preserved.`,
|
|
1216
|
+
nextAction: 'Inspect ~/.pd/install.json and the manifest lock, then retry WorkBuddy uninstall.',
|
|
1217
|
+
};
|
|
1146
1218
|
}
|
|
1147
1219
|
}
|
|
1148
1220
|
// ─── Feature flag override (config.yaml line-targeted edit) ─────────────────
|
|
@@ -2329,11 +2401,11 @@ export class WorkBuddyHostInstaller {
|
|
|
2329
2401
|
// re-create the very deadlock this fix removes. The host's own registration
|
|
2330
2402
|
// record survives that, so either signal counts.
|
|
2331
2403
|
//
|
|
2332
|
-
// Why proceeding is not a user-config write
|
|
2333
|
-
//
|
|
2334
|
-
//
|
|
2335
|
-
//
|
|
2336
|
-
//
|
|
2404
|
+
// Why proceeding is not a user-config write AT THIS GATE: the conflict
|
|
2405
|
+
// classifier is read-only, so the bytes stay identical whether the install
|
|
2406
|
+
// proceeds or not here (the test asserts the sha256). A separate,
|
|
2407
|
+
// ownership-proven legacy cleanup (step 3c, `removeLegacyPdOwnedUserMcpEntry`)
|
|
2408
|
+
// may later strip a PD-owned `pd-recall` entry — never another server's.
|
|
2337
2409
|
const pdMcpBindingPresent = existsSync(path.join(p.marketplaceRoot, WORKBUDDY_PLUGIN_NAME, 'mcp-binding.json'));
|
|
2338
2410
|
const pdAlreadyInstalledForHost = pdMcpBindingPresent || details.registered;
|
|
2339
2411
|
const mcpRegistration = checkMcpRegistrationConflict('workbuddy', {
|
|
@@ -2359,6 +2431,13 @@ export class WorkBuddyHostInstaller {
|
|
|
2359
2431
|
const mcpRegistrationWarning = mcpRegistration.ok
|
|
2360
2432
|
? undefined
|
|
2361
2433
|
: `${mcpRegistration.reason} PD left that entry untouched and continued so this host is not left bound to the previous MCP server version. ${mcpRegistration.nextAction}`;
|
|
2434
|
+
// 3c. Legacy USER-level entry migration runs POST-COMMIT (step 9, review
|
|
2435
|
+
// 2026-11-22): deleting the entry here would leave it unrestored when a
|
|
2436
|
+
// later stage fails — the install transaction only snapshots PD-owned
|
|
2437
|
+
// targets — and would strip the only working pd-recall on a host whose
|
|
2438
|
+
// plugin ends up disabled. The read-only ownership gate above stays the
|
|
2439
|
+
// precondition; the deletion itself belongs to the commit-aftermath
|
|
2440
|
+
// stage, next to the legacy skill cleanup.
|
|
2362
2441
|
// 4. Materialize the PD-owned marketplace (source stays inside its root).
|
|
2363
2442
|
try {
|
|
2364
2443
|
materializeMarketplace(p.marketplaceRoot, payload.pluginDir);
|
|
@@ -2586,6 +2665,36 @@ export class WorkBuddyHostInstaller {
|
|
|
2586
2665
|
const pendingRebindNote = profilePendingAgents.length > 0
|
|
2587
2666
|
? ` Pending config: agent(s) ${profilePendingAgents.join(', ')} still bind to their explicit runtime profiles; to rebind them to the install profile, set internalAgents.agents.<name>.runtimeProfile to '${GOVERNANCE_PROFILE_ID}' (or remove the per-agent runtimeProfile row so they inherit internalAgents.defaultRuntime) in ${path.join(p.governanceDir, '.pd', 'config.yaml')}.`
|
|
2588
2667
|
: '';
|
|
2668
|
+
// 9. Legacy USER-level entry migration — POST-COMMIT (review 2026-11-22
|
|
2669
|
+
// R1/R2). Before the plugin-bundled `.mcp.json` became the only source,
|
|
2670
|
+
// PD also registered a USER-level `<config>/mcp.json` entry. That origin
|
|
2671
|
+
// is a DIFFERENT MCP origin: it requires a manual trust decision and
|
|
2672
|
+
// duplicates the plugin's own server in the MCP list, so an upgraded
|
|
2673
|
+
// machine would still look broken. The removal runs only here — never
|
|
2674
|
+
// inside the transaction — so a rolled-back install keeps the file
|
|
2675
|
+
// byte-identical, and only when the plugin-side replacement is PROVEN
|
|
2676
|
+
// usable; otherwise the old entry stays and the reason is reported (PD
|
|
2677
|
+
// never flips the Owner's enablement behind their back).
|
|
2678
|
+
let legacyUserMcpCleanup;
|
|
2679
|
+
if (mcpRegistration.ok && mcpRegistration.state === 'pd_owned') {
|
|
2680
|
+
const substituteBlocker = this.recallSubstituteBlocker(mcpBinding);
|
|
2681
|
+
if (substituteBlocker === undefined) {
|
|
2682
|
+
const cleanup = this.removeLegacyPdOwnedUserMcpEntry([payload.pluginDir]);
|
|
2683
|
+
if (cleanup.ok) {
|
|
2684
|
+
if (cleanup.removed) {
|
|
2685
|
+
legacyUserMcpCleanup =
|
|
2686
|
+
`Removed the legacy user-level "${PD_MCP_SERVER_NAME}" entry from ${path.join(p.configDir, 'mcp.json')} ` +
|
|
2687
|
+
`(backup: ${cleanup.backupPath}). The plugin's bundled .mcp.json is the single MCP source now.`;
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
else {
|
|
2691
|
+
legacyUserMcpCleanup = `${cleanup.reason} ${cleanup.nextAction}`;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
else {
|
|
2695
|
+
legacyUserMcpCleanup = substituteBlocker;
|
|
2696
|
+
}
|
|
2697
|
+
}
|
|
2589
2698
|
// SPEC-PD-AGENT-PAIN-INGRESS-001 §5.5 / TD §7.4: retire every old
|
|
2590
2699
|
// user-level PD skill once per install/upgrade (`pd-record-pain` plus the
|
|
2591
2700
|
// Codex-era pd-status/pd-setup/pd-disable and the pre-unification
|
|
@@ -2595,6 +2704,7 @@ export class WorkBuddyHostInstaller {
|
|
|
2595
2704
|
const installWarnings = [
|
|
2596
2705
|
...legacySkill.warnings,
|
|
2597
2706
|
...(mcpRegistrationWarning === undefined ? [] : [mcpRegistrationWarning]),
|
|
2707
|
+
...(legacyUserMcpCleanup === undefined ? [] : [legacyUserMcpCleanup]),
|
|
2598
2708
|
];
|
|
2599
2709
|
return {
|
|
2600
2710
|
success: true,
|
|
@@ -2809,7 +2919,9 @@ export class WorkBuddyHostInstaller {
|
|
|
2809
2919
|
/**
|
|
2810
2920
|
* The value an install should leave behind: an explicit boolean already in
|
|
2811
2921
|
* settings.json is the Owner's choice and always wins; otherwise the plugin
|
|
2812
|
-
* manifest's `defaultEnabled` applies.
|
|
2922
|
+
* manifest's `defaultEnabled` applies. PD ships `true`, so a fresh WorkBuddy
|
|
2923
|
+
* install is enabled (and its bundled pd-recall MCP server loads) without a
|
|
2924
|
+
* manual plugin-manager step.
|
|
2813
2925
|
*/
|
|
2814
2926
|
resolveInstalledEnabledValue(declaredDefaultEnabled) {
|
|
2815
2927
|
const p = this.paths();
|
|
@@ -2823,6 +2935,150 @@ export class WorkBuddyHostInstaller {
|
|
|
2823
2935
|
return { ok: true, value: current, fromOwnerChoice: true };
|
|
2824
2936
|
return { ok: true, value: declaredDefaultEnabled, fromOwnerChoice: false };
|
|
2825
2937
|
}
|
|
2938
|
+
/**
|
|
2939
|
+
* Is the plugin-side replacement for the legacy user-level `pd-recall`
|
|
2940
|
+
* proven usable? Returns a keep-and-report message when it is NOT, else
|
|
2941
|
+
* undefined — the migration may then delete the old entry.
|
|
2942
|
+
*
|
|
2943
|
+
* Three independent proofs, all read from post-install state:
|
|
2944
|
+
* 1. enablement — the host's `enabledPlugins[key]` ended TRUE (an
|
|
2945
|
+
* explicit Owner false survives registration, so a preserved-disable
|
|
2946
|
+
* host must keep its trusted user-level entry or lose pd-recall
|
|
2947
|
+
* entirely — the plugin's bundled .mcp.json never loads while
|
|
2948
|
+
* disabled);
|
|
2949
|
+
* 2. payload — the INSTALLED marketplace payload still declares
|
|
2950
|
+
* `mcpServers["pd-recall"]` in its .mcp.json;
|
|
2951
|
+
* 3. binding — writeWorkbuddyMcpBinding landed (a failed binding leaves
|
|
2952
|
+
* the launcher fail-closed; enablement alone proves nothing).
|
|
2953
|
+
*/
|
|
2954
|
+
recallSubstituteBlocker(mcpBinding) {
|
|
2955
|
+
const p = this.paths();
|
|
2956
|
+
const mcpPath = path.join(p.configDir, 'mcp.json');
|
|
2957
|
+
const state = this.readInstalledPluginState();
|
|
2958
|
+
if (state.enabled !== true) {
|
|
2959
|
+
return `Kept the legacy user-level "${PD_MCP_SERVER_NAME}" entry in ${mcpPath}: the plugin is not enabled (an explicit enabledPlugins choice wins over the shipped default), so its bundled pd-recall will not load and removing this entry would leave no usable recall service. Enable the plugin in WorkBuddy's plugin manager, then re-run the installer to finish the migration.`;
|
|
2960
|
+
}
|
|
2961
|
+
let declaresRecall = false;
|
|
2962
|
+
try {
|
|
2963
|
+
const manifest = JSON.parse(readFileSync(path.join(p.marketplaceRoot, WORKBUDDY_PLUGIN_NAME, '.mcp.json'), 'utf-8'));
|
|
2964
|
+
const servers = isRecord(manifest) && isRecord(manifest.mcpServers) ? manifest.mcpServers : undefined;
|
|
2965
|
+
declaresRecall = servers !== undefined && Object.hasOwn(servers, PD_MCP_SERVER_NAME);
|
|
2966
|
+
}
|
|
2967
|
+
catch { /* unreadable/unparsable payload manifest → not proven */ }
|
|
2968
|
+
if (!declaresRecall) {
|
|
2969
|
+
return `Kept the legacy user-level "${PD_MCP_SERVER_NAME}" entry in ${mcpPath}: the installed plugin payload does not declare a "${PD_MCP_SERVER_NAME}" server in its .mcp.json, so removing this entry could leave no usable recall service. Re-run the installer after restoring a complete plugin payload.`;
|
|
2970
|
+
}
|
|
2971
|
+
if (!mcpBinding.ok) {
|
|
2972
|
+
return `Kept the legacy user-level "${PD_MCP_SERVER_NAME}" entry in ${mcpPath}: the pd-recall launcher binding could not be written (${mcpBinding.reason ?? 'unknown'}), so the plugin's bundled server is not proven usable. Resolve the binding problem and re-run the installer to finish the migration.`;
|
|
2973
|
+
}
|
|
2974
|
+
return undefined;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Remove the LEGACY user-level `pd-recall` entry from `<config>/mcp.json`.
|
|
2978
|
+
*
|
|
2979
|
+
* ONE raw-bytes read drives the parse, the ownership verdict
|
|
2980
|
+
* (`classifyWorkbuddyMcpJsonObject` on that same parsed object — never a
|
|
2981
|
+
* second file read) and the backup; the same bytes are then passed to the
|
|
2982
|
+
* atomic replace as `expectedCurrentBytes`, so a host save landing between
|
|
2983
|
+
* the read and the rename is refused instead of silently overwritten
|
|
2984
|
+
* (review 2026-11-22: the stale-snapshot rewrite could drop an MCP server
|
|
2985
|
+
* WorkBuddy saved concurrently). On `AtomicReplaceConflictError` the file
|
|
2986
|
+
* is left exactly as the host wrote it and the backup is kept as evidence.
|
|
2987
|
+
*
|
|
2988
|
+
* Ownership still comes from the launcher bytes, never the key name: only a
|
|
2989
|
+
* `pd_owned` verdict may be deleted. The backup is a `copyFileSync` of the
|
|
2990
|
+
* source, so its permission bits match the original (CWE-732: a fresh 0644
|
|
2991
|
+
* backup of a private mcp.json would expose MCP credentials to other local
|
|
2992
|
+
* users). The caller turns the outcome into a warning, so a cleanup failure
|
|
2993
|
+
* can never fail the install.
|
|
2994
|
+
*/
|
|
2995
|
+
removeLegacyPdOwnedUserMcpEntry(pdLauncherRoots) {
|
|
2996
|
+
const mcpPath = path.join(this.paths().configDir, 'mcp.json');
|
|
2997
|
+
let rawBytes;
|
|
2998
|
+
try {
|
|
2999
|
+
rawBytes = readFileSync(mcpPath);
|
|
3000
|
+
}
|
|
3001
|
+
catch (error) {
|
|
3002
|
+
if (errnoCode(error) === 'ENOENT')
|
|
3003
|
+
return { ok: true, removed: false };
|
|
3004
|
+
return {
|
|
3005
|
+
ok: false,
|
|
3006
|
+
reason: `workbuddy_legacy_mcp_unreadable: cannot read ${mcpPath} (${error instanceof Error ? error.message : String(error)}). The legacy entry was left untouched.`,
|
|
3007
|
+
nextAction: 'Restore read access to the file, then re-run the installer.',
|
|
3008
|
+
};
|
|
3009
|
+
}
|
|
3010
|
+
let root;
|
|
3011
|
+
try {
|
|
3012
|
+
root = JSON.parse(rawBytes.toString('utf-8'));
|
|
3013
|
+
}
|
|
3014
|
+
catch (error) {
|
|
3015
|
+
return {
|
|
3016
|
+
ok: false,
|
|
3017
|
+
reason: `workbuddy_legacy_mcp_unparsable: ${mcpPath} is not valid JSON (${error instanceof Error ? error.message : String(error)}). The legacy entry was left untouched.`,
|
|
3018
|
+
nextAction: 'Fix or remove the malformed file manually, then re-run the installer. PD never merges into a config it cannot parse.',
|
|
3019
|
+
};
|
|
3020
|
+
}
|
|
3021
|
+
if (!isRecord(root)) {
|
|
3022
|
+
return {
|
|
3023
|
+
ok: false,
|
|
3024
|
+
reason: `workbuddy_legacy_mcp_unparsable: ${mcpPath} parsed to ${Array.isArray(root) ? 'an array' : typeof root}, expected an object. The legacy entry was left untouched.`,
|
|
3025
|
+
nextAction: 'Fix or remove the malformed file manually, then re-run the installer.',
|
|
3026
|
+
};
|
|
3027
|
+
}
|
|
3028
|
+
const servers = isRecord(root.mcpServers) ? root.mcpServers : undefined;
|
|
3029
|
+
if (servers === undefined || !Object.hasOwn(servers, PD_MCP_SERVER_NAME))
|
|
3030
|
+
return { ok: true, removed: false };
|
|
3031
|
+
const verdict = classifyWorkbuddyMcpJsonObject(root, mcpPath, {
|
|
3032
|
+
homeDir: this.deps.homeDir(),
|
|
3033
|
+
workbuddyConfigDir: this.paths().configDir,
|
|
3034
|
+
pdLauncherRoots,
|
|
3035
|
+
});
|
|
3036
|
+
// Only a PROVEN PD-owned entry may be removed. `conflict`, `unverifiable`
|
|
3037
|
+
// and an unreadable config keep the existing read-only gate semantics.
|
|
3038
|
+
if (!verdict.ok || verdict.state !== 'pd_owned')
|
|
3039
|
+
return { ok: true, removed: false };
|
|
3040
|
+
const nextServers = { ...servers };
|
|
3041
|
+
delete nextServers[PD_MCP_SERVER_NAME];
|
|
3042
|
+
const nextRoot = { ...root };
|
|
3043
|
+
if (Object.keys(nextServers).length === 0)
|
|
3044
|
+
delete nextRoot.mcpServers;
|
|
3045
|
+
else
|
|
3046
|
+
nextRoot.mcpServers = nextServers;
|
|
3047
|
+
const backupPath = `${mcpPath}.pd-legacy-${Date.now()}.bak`;
|
|
3048
|
+
try {
|
|
3049
|
+
// copyFileSync preserves the source mode — mcp.json may carry
|
|
3050
|
+
// credentials behind private permissions the backup must keep.
|
|
3051
|
+
copyFileSync(mcpPath, backupPath);
|
|
3052
|
+
}
|
|
3053
|
+
catch (error) {
|
|
3054
|
+
return {
|
|
3055
|
+
ok: false,
|
|
3056
|
+
reason: `workbuddy_legacy_mcp_backup_failed: ${error instanceof Error ? error.message : String(error)}. The legacy entry was left untouched.`,
|
|
3057
|
+
nextAction: `Check write permissions beside ${mcpPath}, then re-run the installer.`,
|
|
3058
|
+
};
|
|
3059
|
+
}
|
|
3060
|
+
try {
|
|
3061
|
+
this.deps.atomicReplaceConfig(mcpPath, JSON.stringify(nextRoot, null, 2) + '\n', undefined, undefined, rawBytes);
|
|
3062
|
+
}
|
|
3063
|
+
catch (error) {
|
|
3064
|
+
if (error instanceof AtomicReplaceConflictError) {
|
|
3065
|
+
// The host saved this file between our read and the rename: PD's
|
|
3066
|
+
// replacement never committed, the newer content wins, and the
|
|
3067
|
+
// byte-backup stays as recovery evidence.
|
|
3068
|
+
return {
|
|
3069
|
+
ok: false,
|
|
3070
|
+
reason: `workbuddy_legacy_mcp_concurrent_edit: ${mcpPath} changed between inspection and replacement, so the legacy entry was kept rather than overwriting the newer save (byte backup preserved at ${backupPath}).`,
|
|
3071
|
+
nextAction: 'Re-run the installer after WorkBuddy has finished writing, or remove the entry manually.',
|
|
3072
|
+
};
|
|
3073
|
+
}
|
|
3074
|
+
return {
|
|
3075
|
+
ok: false,
|
|
3076
|
+
reason: `workbuddy_legacy_mcp_write_failed: atomic replace of ${mcpPath} failed (${error instanceof Error ? error.message : String(error)}). The previous content is preserved at ${backupPath}.`,
|
|
3077
|
+
nextAction: `Manually restore ${backupPath} to ${mcpPath} if the file was left modified, then re-run the installer.`,
|
|
3078
|
+
};
|
|
3079
|
+
}
|
|
3080
|
+
return { ok: true, removed: true, backupPath };
|
|
3081
|
+
}
|
|
2826
3082
|
/** Write enabledPlugins[OUR_KEY]=value, preserving every other key. */
|
|
2827
3083
|
applyInstalledEnabledValue(value) {
|
|
2828
3084
|
const p = this.paths();
|
|
@@ -2856,9 +3112,9 @@ export class WorkBuddyHostInstaller {
|
|
|
2856
3112
|
}
|
|
2857
3113
|
/**
|
|
2858
3114
|
* Direct-write registration for engine-unreachable machines, aligned with the
|
|
2859
|
-
* frozen P01 formats: enabledPlugins[key] carries the manifest default
|
|
2860
|
-
*
|
|
2861
|
-
* other plugins preserved), installed_plugins.json v2 user registration
|
|
3115
|
+
* frozen P01 formats: enabledPlugins[key] carries the manifest default (PD
|
|
3116
|
+
* ships `true`, so a fresh install is enabled out of the box) or the Owner's
|
|
3117
|
+
* existing choice (other keys and other plugins preserved), installed_plugins.json v2 user registration
|
|
2862
3118
|
* (native scope array or legacy object), and the versioned cache
|
|
2863
3119
|
* copy under plugins/cache/<marketplace>/<plugin>/<version>/.
|
|
2864
3120
|
*/
|
|
@@ -2890,8 +3146,8 @@ export class WorkBuddyHostInstaller {
|
|
|
2890
3146
|
}
|
|
2891
3147
|
// settings.json merge — computed here, WRITTEN after the cache lands (see
|
|
2892
3148
|
// below): a failed payload must leave no registration state behind.
|
|
2893
|
-
//
|
|
2894
|
-
//
|
|
3149
|
+
// An explicit Owner choice is preserved; otherwise the manifest's
|
|
3150
|
+
// defaultEnabled applies (PD ships true: enabled out of the box).
|
|
2895
3151
|
const currentEnabled = isRecord(settings.value?.enabledPlugins)
|
|
2896
3152
|
? settings.value.enabledPlugins[WORKBUDDY_PLUGIN_KEY]
|
|
2897
3153
|
: undefined;
|
|
@@ -3223,8 +3479,14 @@ export class WorkBuddyHostInstaller {
|
|
|
3223
3479
|
}
|
|
3224
3480
|
// 6. Manifest bookkeeping: drop 'workbuddy' from hosts. The governance
|
|
3225
3481
|
// workspace entry and ALL governance data are preserved (§18 default).
|
|
3226
|
-
|
|
3227
|
-
removeWorkbuddyFromInstallManifestHosts(p.installManifestPath)
|
|
3482
|
+
const manifestBookkeeping = !otherScopesPresent
|
|
3483
|
+
? removeWorkbuddyFromInstallManifestHosts(p.installManifestPath)
|
|
3484
|
+
: { ok: true };
|
|
3485
|
+
if (!manifestBookkeeping.ok) {
|
|
3486
|
+
failedPaths.push(p.installManifestPath);
|
|
3487
|
+
preservedPaths.push(p.installManifestPath);
|
|
3488
|
+
notes.push(`${manifestBookkeeping.reason} ${manifestBookkeeping.nextAction}`);
|
|
3489
|
+
}
|
|
3228
3490
|
const governancePreservedByDesign = existsSync(p.governanceDir);
|
|
3229
3491
|
if (governancePreservedByDesign) {
|
|
3230
3492
|
preservedPaths.push(p.governanceDir);
|
|
@@ -3240,6 +3502,7 @@ export class WorkBuddyHostInstaller {
|
|
|
3240
3502
|
? `Partially uninstalled: ${failedPaths.join(', ')} could not be removed. ${notes.join(' ')}`
|
|
3241
3503
|
: `Uninstalled ${WORKBUDDY_PLUGIN_KEY}. ${notes.join(' ')}`.trim(),
|
|
3242
3504
|
nextAction: [
|
|
3505
|
+
...(!manifestBookkeeping.ok ? [manifestBookkeeping.nextAction] : []),
|
|
3243
3506
|
'Registration removal takes effect in NEW WorkBuddy sessions (or /reload-plugins in a running CLI session).',
|
|
3244
3507
|
governancePreservedByDesign
|
|
3245
3508
|
? `The governance database at ${p.governanceDir} is PRESERVED by design — delete it manually only after exporting what you need.`
|