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
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared coordinator steps (SPEC-PD-SERVICE-HOST-001 §8.2 steps 3–5, TD §5).
|
|
3
|
+
*
|
|
4
|
+
* The dry-run coordinator (run-once.ts, Phase 1) and the shadow coordinator
|
|
5
|
+
* (shadow-run.ts, Phase 2) execute the SAME prefix pipeline: manifest read
|
|
6
|
+
* with the five fail-closed verdicts, per-host root reporting, and manifest
|
|
7
|
+
* section projection. Those steps live here once so the two flows can never
|
|
8
|
+
* drift apart; each flow keeps its own execution phase.
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import { parseInstallManifest, } from '@principles/install-layout';
|
|
12
|
+
/** Read + parse the manifest with the five task-required verdicts. */
|
|
13
|
+
export function readManifest(identity) {
|
|
14
|
+
let raw;
|
|
15
|
+
try {
|
|
16
|
+
raw = fs.readFileSync(identity.manifestPath, 'utf8');
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
const code = typeof error === 'object' && error !== null && Object.hasOwn(error, 'code')
|
|
20
|
+
? String(Reflect.get(error, 'code'))
|
|
21
|
+
: '';
|
|
22
|
+
if (code === 'ENOENT') {
|
|
23
|
+
return { manifest: undefined, verdict: 'missing', reason: 'install_manifest_missing' };
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
manifest: undefined,
|
|
27
|
+
verdict: 'read_failed',
|
|
28
|
+
reason: code !== '' ? `install_manifest_read_failed:${code}` : 'install_manifest_read_failed',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
let parsed;
|
|
32
|
+
try {
|
|
33
|
+
parsed = JSON.parse(raw);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
+
return { manifest: undefined, verdict: 'unparsable', reason: `install_manifest_unparsable:${message.slice(0, 120)}` };
|
|
38
|
+
}
|
|
39
|
+
const result = parseInstallManifest(parsed);
|
|
40
|
+
if (result.manifest === undefined) {
|
|
41
|
+
const error = result.error ?? 'install_manifest_malformed';
|
|
42
|
+
return {
|
|
43
|
+
manifest: undefined,
|
|
44
|
+
verdict: error.startsWith('install_manifest_unsupported_version') ? 'version_mismatch' : 'invalid',
|
|
45
|
+
reason: error,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return { manifest: result.manifest, verdict: 'ok' };
|
|
49
|
+
}
|
|
50
|
+
/** Empty discovery counts for refusal statuses. */
|
|
51
|
+
export function zeroCounts() {
|
|
52
|
+
return { authorized: 0, degraded: 0, unavailable: 0, conflicting: 0, invalid: 0, discovered: 0 };
|
|
53
|
+
}
|
|
54
|
+
/** Build the empty discovery result used by refusal statuses. */
|
|
55
|
+
export function buildEmptyDiscovery() {
|
|
56
|
+
return { workspaces: [], discoveredTotal: 0, counts: zeroCounts() };
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The default host-root listability probe (P2-1). `statSync` succeeding is
|
|
60
|
+
* not enough — a directory the OS reports but `readdir` refuses (EACCES /
|
|
61
|
+
* EPERM) or fails on (EIO, transient FS errors) is NOT listable, and the
|
|
62
|
+
* claims collector could not have seen the workspaces under it. The four
|
|
63
|
+
* verdicts are distinct and none is ever faked:
|
|
64
|
+
* - `missing` — ENOENT/ENOTDIR at stat, or the dir vanished before readdir;
|
|
65
|
+
* - `not_directory` — the path exists but is not a directory;
|
|
66
|
+
* - `unreadable` — exists, is a directory, readdir failed for any reason;
|
|
67
|
+
* - `readable` — readdir actually succeeded.
|
|
68
|
+
*/
|
|
69
|
+
export function defaultListDir(dir) {
|
|
70
|
+
try {
|
|
71
|
+
if (!fs.statSync(dir).isDirectory())
|
|
72
|
+
return 'not_directory';
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const code = typeof error === 'object' && error !== null && Object.hasOwn(error, 'code')
|
|
76
|
+
? String(Reflect.get(error, 'code'))
|
|
77
|
+
: '';
|
|
78
|
+
return code === 'ENOENT' || code === 'ENOTDIR' ? 'missing' : 'unreadable';
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
fs.readdirSync(dir);
|
|
82
|
+
return 'readable';
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
const code = typeof error === 'object' && error !== null && Object.hasOwn(error, 'code')
|
|
86
|
+
? String(Reflect.get(error, 'code'))
|
|
87
|
+
: '';
|
|
88
|
+
return code === 'ENOENT' || code === 'ENOTDIR' ? 'missing' : 'unreadable';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Per-host root report (P1-2/P2-1): for every host, which root the claims
|
|
93
|
+
* collector consulted, whether an env override STEERED it, and whether the
|
|
94
|
+
* directory was actually LISTABLE. "Steered" = the variable was inherited
|
|
95
|
+
* AND honored: in the default mode the inherited host-root overrides steer
|
|
96
|
+
* discovery (P1-2); in `canonicalHostRootsOnly` mode (shadow) they were
|
|
97
|
+
* ignored (`identity.environment.ignoredHostRootEnvVars`) and the root is
|
|
98
|
+
* the trusted-home default. An unreadable root — whichever way it was
|
|
99
|
+
* selected — is surfaced as incomplete discovery, never silently folded
|
|
100
|
+
* into "no workspaces".
|
|
101
|
+
*/
|
|
102
|
+
export function hostRootReports(identity, listDir) {
|
|
103
|
+
const honored = new Set(identity.environment.inheritedHostRootEnvVars);
|
|
104
|
+
for (const ignored of identity.environment.ignoredHostRootEnvVars)
|
|
105
|
+
honored.delete(ignored);
|
|
106
|
+
const roots = [
|
|
107
|
+
{
|
|
108
|
+
host: 'openclaw',
|
|
109
|
+
root: identity.hostRoots.openclawHome,
|
|
110
|
+
source: honored.has('OPENCLAW_STATE_DIR') || honored.has('OPENCLAW_HOME') ? 'env' : 'default',
|
|
111
|
+
},
|
|
112
|
+
{ host: 'codex', root: identity.hostRoots.codexHome, source: honored.has('CODEX_HOME') ? 'env' : 'default' },
|
|
113
|
+
{
|
|
114
|
+
host: 'workbuddy',
|
|
115
|
+
root: identity.hostRoots.workbuddyConfigDir,
|
|
116
|
+
source: honored.has('WORKBUDDY_CONFIG_DIR') ? 'env' : 'default',
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
return roots.map((entry) => ({ ...entry, status: listDir(entry.root) }));
|
|
120
|
+
}
|
|
121
|
+
/** True when at least one consulted host root exists but could not be listed. */
|
|
122
|
+
export function discoveryIncompleteRoots(hostRoots) {
|
|
123
|
+
return hostRoots.filter((r) => r.status === 'unreadable' || r.status === 'not_directory');
|
|
124
|
+
}
|
|
125
|
+
/** Project a manifest read into the persisted status section. */
|
|
126
|
+
export function manifestSection(read) {
|
|
127
|
+
return read.manifest === undefined
|
|
128
|
+
? {
|
|
129
|
+
verdict: read.verdict,
|
|
130
|
+
...(read.reason !== undefined ? { reason: read.reason } : {}),
|
|
131
|
+
hosts: [],
|
|
132
|
+
unknownHosts: [],
|
|
133
|
+
workspacesCount: 0,
|
|
134
|
+
}
|
|
135
|
+
: {
|
|
136
|
+
verdict: 'ok',
|
|
137
|
+
hosts: [...read.manifest.hosts, ...(read.manifest.unknownHosts ?? [])],
|
|
138
|
+
unknownHosts: [...(read.manifest.unknownHosts ?? [])],
|
|
139
|
+
workspacesCount: (read.manifest.workspaces ?? []).length,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Claim-collection options for the shared prefix (P1-2): custom host roots
|
|
144
|
+
* (env overrides) reach the collector so workspaces under them stay
|
|
145
|
+
* discoverable; they can never steer pdHome itself.
|
|
146
|
+
*/
|
|
147
|
+
export function claimOptionsFor(identity, readDiagnostics, claimReaders) {
|
|
148
|
+
return {
|
|
149
|
+
homeDir: identity.homeDir,
|
|
150
|
+
codexHome: identity.hostRoots.codexHome,
|
|
151
|
+
openclawHome: identity.hostRoots.openclawHome,
|
|
152
|
+
workbuddyConfigDir: identity.hostRoots.workbuddyConfigDir,
|
|
153
|
+
platform: process.platform,
|
|
154
|
+
readDiagnostics,
|
|
155
|
+
...(claimReaders !== undefined ? { readers: claimReaders } : {}),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=coordinator-common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator-common.js","sourceRoot":"","sources":["../../../src/services/service-host/coordinator-common.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EACL,oBAAoB,GAKrB,MAAM,4BAA4B,CAAC;AAKpC,sEAAsE;AACtE,MAAM,UAAU,YAAY,CAAC,QAAyB;IAKpD,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,EAAE,C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,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;YACrD,eAAe,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,MAAM;SACzD,CAAC;AACR,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAyB,EACzB,eAAwC,EACxC,YAA+B;IAE/B,OAAO;QACL,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,SAAS;QACvC,YAAY,EAAE,QAAQ,CAAC,SAAS,CAAC,YAAY;QAC7C,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAAC,kBAAkB;QACzD,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,eAAe;QACf,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface HandoverBindingResult {
|
|
2
|
+
/** An OpenClaw claim (any of the three validated sources) names this workspace. */
|
|
3
|
+
readonly openclawClaimed: boolean;
|
|
4
|
+
/** Cross-host conflict owner(s); `null` when unambiguous. */
|
|
5
|
+
readonly foreignOwner: string | null;
|
|
6
|
+
/**
|
|
7
|
+
* PRI-1282 review (P1-4): a binding file that could not be read or parsed
|
|
8
|
+
* is NOT "no claim" — it means foreign ownership cannot be proven either
|
|
9
|
+
* way, and the handover must fail closed. Lists the offending files.
|
|
10
|
+
*/
|
|
11
|
+
readonly bindingUnverifiable: string | null;
|
|
12
|
+
}
|
|
13
|
+
export declare function collectHostWorkspaceClaimsFor(workspaceDir: string, homeDir: string, env?: Readonly<Record<string, string | undefined>>): HandoverBindingResult;
|
|
14
|
+
//# sourceMappingURL=handover-claims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handover-claims.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/handover-claims.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,qBAAqB;IACpC,mFAAmF;IACnF,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GACjD,qBAAqB,CAgCvB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-binding verification for the §8.4 handover (PRI-1282 Phase 4).
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper over the EXISTING authorized-discovery authorities
|
|
5
|
+
* (`collectHostWorkspaceClaims` + `findForeignWorkspaceOwner`) — the handover
|
|
6
|
+
* never invents a second binding source. A workspace is handover-eligible
|
|
7
|
+
* when OpenClaw holds a VALIDATED claim (default dir / host declaration /
|
|
8
|
+
* payload binding) and no OTHER host claims it.
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import { findForeignWorkspaceOwner, collectHostWorkspaceClaims } from '@principles/install-layout';
|
|
13
|
+
import { resolveCoordinatorInstallIdentity } from './install-identity.js';
|
|
14
|
+
import { claimOptionsFor } from './coordinator-common.js';
|
|
15
|
+
export function collectHostWorkspaceClaimsFor(workspaceDir, homeDir, env) {
|
|
16
|
+
const identity = resolveCoordinatorInstallIdentity(env ?? process.env, { trustedHomeDir: homeDir });
|
|
17
|
+
if (!identity.ok)
|
|
18
|
+
return { openclawClaimed: false, foreignOwner: 'install_identity_unresolved', bindingUnverifiable: null };
|
|
19
|
+
const diagnostics = [];
|
|
20
|
+
const options = claimOptionsFor(identity.identity, diagnostics);
|
|
21
|
+
const claims = collectHostWorkspaceClaims(options);
|
|
22
|
+
const canonical = path.resolve(workspaceDir);
|
|
23
|
+
// Claims are matched by REAL-directory identity, not lexical spelling —
|
|
24
|
+
// the manifest may hold an alias of the same directory (PRI-1282 review),
|
|
25
|
+
// which is exactly the shape `findForeignWorkspaceOwner` resolves too.
|
|
26
|
+
const identityOf = (candidate) => {
|
|
27
|
+
const lexical = path.resolve(candidate);
|
|
28
|
+
let resolved = lexical;
|
|
29
|
+
try {
|
|
30
|
+
resolved = fs.realpathSync.native(lexical);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Best effort: a missing path compares lexically.
|
|
34
|
+
}
|
|
35
|
+
return process.platform === 'win32' ? resolved.toLowerCase() : resolved;
|
|
36
|
+
};
|
|
37
|
+
const canonicalIdentity = identityOf(canonical);
|
|
38
|
+
const samePath = (candidate) => identityOf(candidate) === canonicalIdentity;
|
|
39
|
+
const openclawClaimed = claims.some((claim) => claim.host === 'openclaw' && samePath(claim.workspaceDir));
|
|
40
|
+
const foreign = findForeignWorkspaceOwner('openclaw', canonical, options);
|
|
41
|
+
const foreignOwner = foreign.owners.length > 0 ? foreign.owners.join('+') : null;
|
|
42
|
+
// PRI-1282 review (P1-4): an unreadable/malformed binding file was skipped
|
|
43
|
+
// during claim collection — treat "cannot verify foreign ownership" as a
|
|
44
|
+
// blocking fact, not as silence. The caller fails closed on this.
|
|
45
|
+
const bindingUnverifiable = diagnostics.length > 0
|
|
46
|
+
? diagnostics.map((d) => `${d.file}(${d.status})`).join(', ')
|
|
47
|
+
: null;
|
|
48
|
+
return { openclawClaimed, foreignOwner, bindingUnverifiable };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=handover-claims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handover-claims.js","sourceRoot":"","sources":["../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
|
|
7
|
-
*
|
|
6
|
+
* building blocks. Phase 2 adds the unified Worker Adapter contract and the
|
|
7
|
+
* explicit, bounded shadow coordinator (PRI-1280). Phase 3 adds the managed
|
|
8
|
+
* run (the OS scheduler entry), the Scheduler Adapter Contract with the
|
|
9
|
+
* three user-level platform adapters, and the unified read-only status
|
|
10
|
+
* contract (PRI-1281). No owner-marker writes, no handover — later phases
|
|
11
|
+
* extend this package within the same boundary (TD §11).
|
|
8
12
|
*/
|
|
9
13
|
export { resolveCoordinatorInstallIdentity, stripExperimentRoot, type CoordinatorEnvView, type InstallIdentity, } from './install-identity.js';
|
|
10
14
|
export { WORKSPACE_DISCOVERY_VERDICTS, discoverWorkspaces, type DiscoverWorkspacesInput, type DiscoveryProbes, type WorkspaceDiscoveryEntry, type WorkspaceDiscoveryResult, type WorkspaceDiscoveryVerdict, type WorkspaceSourceRef, } from './workspace-discovery.js';
|
|
11
15
|
export { projectWorkspaceOwner, type OwnerProjection } from './owner-projection.js';
|
|
16
|
+
export { buildEmptyDiscovery, claimOptionsFor, defaultListDir, discoveryIncompleteRoots, hostRootReports, manifestSection, readManifest, } from './coordinator-common.js';
|
|
12
17
|
export { SERVICE_RUN_LOCK_STALE_MS, acquireServiceRunLock, holdsServiceRunLock, releaseServiceRunLock, serviceRunLockPath, type AcquireServiceRunLockResult, type LockBodyRead, type ReleaseServiceRunLockResult, type ServiceRunLockHandle, } from './locking/service-run-lock.js';
|
|
13
|
-
export { SERVICE_RUN_STATUS_SCHEMA_VERSION, readActiveReleaseFacts, serviceRunStatusPath, writeServiceRunStatus, type ActiveReleaseFacts, type ServiceRunStatus, } from './status/service-run-status.js';
|
|
18
|
+
export { SERVICE_RUN_STATUS_SCHEMA_VERSION, readActiveReleaseFacts, readServiceRunStatus, serviceRunStatusPath, writeServiceRunStatus, type ActiveReleaseFacts, type ManagedExecutionRecord, type ManagedRunStatusSection, type ServiceRunStatus, type ServiceRunStatusRead, type ServiceRunTriggerSource, type ShadowExecutionRecord, type ShadowRunStatusSection, } from './status/service-run-status.js';
|
|
14
19
|
export { runServiceRunOnce, type RunOnceOptions, type RunOnceResult, } from './run-once.js';
|
|
20
|
+
export { WORKER_ADAPTER_CONTRACT_VERSION, WORKER_HOST_KINDS, resolveActiveReleaseCliEntry, type AdapterCycleHealth, type AdapterCycleOutcome, type AdapterCycleResult, type AdapterSupport, type BusinessProgressEvidence, type CliWorkerHostConfig, type WorkerAdapter, type WorkerAdapterExecuteInput, type WorkerAdapterProbes, type WorkerHostKind, type WorkspaceDescriptor, } from './worker-adapter.js';
|
|
21
|
+
export { createCodexWorkerAdapter } from './worker-adapter-codex.js';
|
|
22
|
+
export { createWorkbuddyWorkerAdapter } from './worker-adapter-workbuddy.js';
|
|
23
|
+
export { buildWorkerEnvironment, type WorkerEnvironment, type WorkerEnvironmentReport, } from './worker-env.js';
|
|
24
|
+
export { runWorkerProcess, type WorkerProcessOptions, type WorkerProcessResult, } from './worker-process.js';
|
|
25
|
+
export { diffTaskProgress, readTaskProgressSnapshot, type TaskProgressEvidence, type TaskProgressRead, type TaskProgressSnapshot, } from './progress-evidence.js';
|
|
26
|
+
export { DEFAULT_SHADOW_WORKSPACE_TIMEOUT_MS, runServiceShadowOnce, type ShadowRunOptions, type ShadowRunProbes, type ShadowRunResult, } from './shadow-run.js';
|
|
27
|
+
export { carriedProgress, dispatchWorkspaceAdapters, workspaceStateFor, type AdapterDispatchEntry, type AdapterDispatchOutcome, type DispatchWorkspaceAdaptersArgs, type WorkspaceDispatchResult, } from './workspace-dispatch.js';
|
|
28
|
+
export { DEFAULT_MANAGED_WORKSPACE_TIMEOUT_MS, runServiceManagedOnce, type ManagedRunOptions, type ManagedRunProbes, type ManagedRunResult, } from './managed-run.js';
|
|
29
|
+
export { DEFAULT_SCHEDULER_INTERVAL_MS, buildWindowsTaskXml, buildMacosLaunchAgentPlist, buildLinuxServiceUnit, buildLinuxTimerUnit, createLinuxSchedulerAdapter, createMacosSchedulerAdapter, createSpawnSchedulerRunner, createWindowsSchedulerAdapter, nodeSchedulerFileIo, runSchedulerLifecycle, schedulerIdentityFor, schedulerInvocationArgs, validateSchedulerIntervalMs, parseWindowsIntervalMs, parseMacosStartIntervalMs, parseLinuxTimerIntervalMs, type MacosSchedulerDeps, type LinuxSchedulerDeps, type SchedulerAdapter, type SchedulerAdapterResolution, type SchedulerCommandResult, type SchedulerCommandRunner, type SchedulerFileIo, type SchedulerFacts, type SchedulerIdentity, type SchedulerLifecycleOperation, type SchedulerLifecycleOptions, type SchedulerLifecycleResult, type SchedulerOperationResult, type SchedulerPlatform, type SchedulerRegistration, type WindowsSchedulerDeps, } from './scheduler/index.js';
|
|
30
|
+
export { SERVICE_HOST_STATUS_SCHEMA_VERSION, composeServiceHostStatus, type ServiceHostStatusDocument, type ServiceHostStatusOptions, type ServiceHostStatusResult, type ServiceHostStatusWorkspace, } from './scheduler/service-status.js';
|
|
15
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,iCAAiC,EACjC,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACpF,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,wBAAwB,EACx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B,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,GAChC,MAAM,+BAA+B,CAAC"}
|
|
@@ -3,13 +3,31 @@
|
|
|
3
3
|
* (SPEC-PD-SERVICE-HOST-001 / ADR-0020 §11.6 narrow scope).
|
|
4
4
|
*
|
|
5
5
|
* Phase 1 public surface: the read-only run-once coordinator and its
|
|
6
|
-
* building blocks.
|
|
7
|
-
*
|
|
6
|
+
* building blocks. Phase 2 adds the unified Worker Adapter contract and the
|
|
7
|
+
* explicit, bounded shadow coordinator (PRI-1280). Phase 3 adds the managed
|
|
8
|
+
* run (the OS scheduler entry), the Scheduler Adapter Contract with the
|
|
9
|
+
* three user-level platform adapters, and the unified read-only status
|
|
10
|
+
* contract (PRI-1281). No owner-marker writes, no handover — later phases
|
|
11
|
+
* extend this package within the same boundary (TD §11).
|
|
8
12
|
*/
|
|
9
13
|
export { resolveCoordinatorInstallIdentity, stripExperimentRoot, } from './install-identity.js';
|
|
10
14
|
export { WORKSPACE_DISCOVERY_VERDICTS, discoverWorkspaces, } from './workspace-discovery.js';
|
|
11
15
|
export { projectWorkspaceOwner } from './owner-projection.js';
|
|
16
|
+
export { buildEmptyDiscovery, claimOptionsFor, defaultListDir, discoveryIncompleteRoots, hostRootReports, manifestSection, readManifest, } from './coordinator-common.js';
|
|
12
17
|
export { SERVICE_RUN_LOCK_STALE_MS, acquireServiceRunLock, holdsServiceRunLock, releaseServiceRunLock, serviceRunLockPath, } from './locking/service-run-lock.js';
|
|
13
|
-
export { SERVICE_RUN_STATUS_SCHEMA_VERSION, readActiveReleaseFacts, serviceRunStatusPath, writeServiceRunStatus, } from './status/service-run-status.js';
|
|
18
|
+
export { SERVICE_RUN_STATUS_SCHEMA_VERSION, readActiveReleaseFacts, readServiceRunStatus, serviceRunStatusPath, writeServiceRunStatus, } from './status/service-run-status.js';
|
|
14
19
|
export { runServiceRunOnce, } from './run-once.js';
|
|
20
|
+
// ── Phase 2 (PRI-1280): Worker Adapter contract + shadow coordinator ──
|
|
21
|
+
export { WORKER_ADAPTER_CONTRACT_VERSION, WORKER_HOST_KINDS, resolveActiveReleaseCliEntry, } from './worker-adapter.js';
|
|
22
|
+
export { createCodexWorkerAdapter } from './worker-adapter-codex.js';
|
|
23
|
+
export { createWorkbuddyWorkerAdapter } from './worker-adapter-workbuddy.js';
|
|
24
|
+
export { buildWorkerEnvironment, } from './worker-env.js';
|
|
25
|
+
export { runWorkerProcess, } from './worker-process.js';
|
|
26
|
+
export { diffTaskProgress, readTaskProgressSnapshot, } from './progress-evidence.js';
|
|
27
|
+
export { DEFAULT_SHADOW_WORKSPACE_TIMEOUT_MS, runServiceShadowOnce, } from './shadow-run.js';
|
|
28
|
+
// ── Phase 3 (PRI-1281): shared dispatch core + managed run + OS scheduler ──
|
|
29
|
+
export { carriedProgress, dispatchWorkspaceAdapters, workspaceStateFor, } from './workspace-dispatch.js';
|
|
30
|
+
export { DEFAULT_MANAGED_WORKSPACE_TIMEOUT_MS, runServiceManagedOnce, } from './managed-run.js';
|
|
31
|
+
export { DEFAULT_SCHEDULER_INTERVAL_MS, buildWindowsTaskXml, buildMacosLaunchAgentPlist, buildLinuxServiceUnit, buildLinuxTimerUnit, createLinuxSchedulerAdapter, createMacosSchedulerAdapter, createSpawnSchedulerRunner, createWindowsSchedulerAdapter, nodeSchedulerFileIo, runSchedulerLifecycle, schedulerIdentityFor, schedulerInvocationArgs, validateSchedulerIntervalMs, parseWindowsIntervalMs, parseMacosStartIntervalMs, parseLinuxTimerIntervalMs, } from './scheduler/index.js';
|
|
32
|
+
export { SERVICE_HOST_STATUS_SCHEMA_VERSION, composeServiceHostStatus, } from './scheduler/service-status.js';
|
|
15
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/service-host/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/service-host/index.ts"],"names":[],"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EACL,6BAA6B,EAC7B,mBAAmB,EACnB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,GAiB1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kCAAkC,EAClC,wBAAwB,GAKzB,MAAM,+BAA+B,CAAC"}
|
|
@@ -12,11 +12,19 @@ export interface CoordinatorEnvView {
|
|
|
12
12
|
*/
|
|
13
13
|
readonly ignoredIdentityEnvVars: readonly string[];
|
|
14
14
|
/**
|
|
15
|
-
* Host-root overrides present in the inherited env.
|
|
16
|
-
* workspace discovery (P1-2) but cannot move
|
|
17
|
-
*
|
|
15
|
+
* Host-root overrides present in the inherited env. In the default (Phase 1
|
|
16
|
+
* dry-run) mode these DID steer workspace discovery (P1-2) but cannot move
|
|
17
|
+
* pdHome. In `canonicalHostRootsOnly` mode they did NOT steer anything —
|
|
18
|
+
* see `ignoredHostRootEnvVars`.
|
|
18
19
|
*/
|
|
19
20
|
readonly inheritedHostRootEnvVars: readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* Host-root overrides that were present in the inherited env but did NOT
|
|
23
|
+
* steer host-root resolution (always empty in the default mode; the present
|
|
24
|
+
* list in `canonicalHostRootsOnly` mode). Recorded so a polluted run is
|
|
25
|
+
* observable, never silent (rc-9).
|
|
26
|
+
*/
|
|
27
|
+
readonly ignoredHostRootEnvVars: readonly string[];
|
|
20
28
|
}
|
|
21
29
|
export interface InstallIdentity {
|
|
22
30
|
/** `<home>/.pd` — the install root this coordinator owns. */
|
|
@@ -53,6 +61,18 @@ export interface ResolveInstallIdentityOptions {
|
|
|
53
61
|
* When omitted the OS account record is consulted.
|
|
54
62
|
*/
|
|
55
63
|
readonly trustedHomeDir?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Resolve host roots from the trusted home ONLY (canonical
|
|
66
|
+
* `<home>/.openclaw` / `<home>/.codex` / `<home>/.workbuddy` defaults),
|
|
67
|
+
* ignoring inherited `OPENCLAW_STATE_DIR` / `OPENCLAW_HOME` /
|
|
68
|
+
* `CODEX_HOME` / `WORKBUDDY_CONFIG_DIR` overrides (recorded as
|
|
69
|
+
* `ignoredHostRootEnvVars`). The Phase 2 shadow coordinator sets this: a
|
|
70
|
+
* real cycle must never be discovered from — nor pinned to — an
|
|
71
|
+
* experiment/custom root an inherited env happened to name (TD §5.2). The
|
|
72
|
+
* Phase 1 dry-run keeps the shared production precedence (env honored for
|
|
73
|
+
* discovery, P1-2) because it starts nothing.
|
|
74
|
+
*/
|
|
75
|
+
readonly canonicalHostRootsOnly?: boolean;
|
|
56
76
|
}
|
|
57
77
|
/** Strip the experiment-root switch, keeping every other variable intact. */
|
|
58
78
|
export declare function stripExperimentRoot(env: Readonly<Record<string, string | undefined>>): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-identity.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/install-identity.ts"],"names":[],"mappings":"AAkDA,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,8EAA8E;IAC9E,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC,sFAAsF;IACtF,QAAQ,CAAC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,sBAAsB,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD
|
|
1
|
+
{"version":3,"file":"install-identity.d.ts","sourceRoot":"","sources":["../../../src/services/service-host/install-identity.ts"],"names":[],"mappings":"AAkDA,MAAM,WAAW,kBAAkB;IACjC,wEAAwE;IACxE,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,8EAA8E;IAC9E,QAAQ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C,CAAC,GAChD;IAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAAC,IAAI,EAAE,kBAAkB,CAAA;CAAE,CAmCvE;AAoBD;;;;;;;;GAQG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,EAC/D,OAAO,GAAE,6BAAkC,GAC1C;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAgE7F"}
|
|
@@ -56,6 +56,9 @@ export function stripExperimentRoot(env) {
|
|
|
56
56
|
const base = {
|
|
57
57
|
ignoredIdentityEnvVars,
|
|
58
58
|
inheritedHostRootEnvVars,
|
|
59
|
+
// Overridden by resolveCoordinatorInstallIdentity when host-root
|
|
60
|
+
// resolution ignores the inherited overrides (canonicalHostRootsOnly).
|
|
61
|
+
ignoredHostRootEnvVars: [],
|
|
59
62
|
};
|
|
60
63
|
const raw = env[PD_EXPERIMENT_ROOT];
|
|
61
64
|
if (raw === undefined) {
|
|
@@ -134,10 +137,17 @@ export function resolveCoordinatorInstallIdentity(env = process.env, options = {
|
|
|
134
137
|
'Fix the OS account home directory, or reinstall PD with `npx create-principles-disciple`.',
|
|
135
138
|
};
|
|
136
139
|
}
|
|
137
|
-
//
|
|
138
|
-
//
|
|
139
|
-
//
|
|
140
|
-
|
|
140
|
+
// canonicalHostRootsOnly: host-root resolution sees an EMPTY env — the
|
|
141
|
+
// overrides resolve to the trusted-home defaults — while the inherited
|
|
142
|
+
// presence is recorded as ignored (rc-9). HOME/USERPROFILE stay in
|
|
143
|
+
// `stripped` (they are never consulted for host roots anyway).
|
|
144
|
+
const ignoredHostRootEnvVars = options.canonicalHostRootsOnly === true
|
|
145
|
+
? view.inheritedHostRootEnvVars
|
|
146
|
+
: [];
|
|
147
|
+
const resolution = resolvePdHome({
|
|
148
|
+
env: options.canonicalHostRootsOnly === true ? {} : stripped,
|
|
149
|
+
homeDir,
|
|
150
|
+
});
|
|
141
151
|
if (!resolution.ok) {
|
|
142
152
|
return {
|
|
143
153
|
ok: false,
|
|
@@ -159,7 +169,7 @@ export function resolveCoordinatorInstallIdentity(env = process.env, options = {
|
|
|
159
169
|
workbuddyConfigDir: resolution.workbuddyConfigDir,
|
|
160
170
|
},
|
|
161
171
|
mode: 'production',
|
|
162
|
-
environment: view,
|
|
172
|
+
environment: { ...view, ignoredHostRootEnvVars },
|
|
163
173
|
},
|
|
164
174
|
};
|
|
165
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-identity.js","sourceRoot":"","sources":["../../../src/services/service-host/install-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,mEAAmE;AACnE,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,yBAAyB,GAAG,CAAC,MAAM,EAAE,aAAa,CAAU,CAAC;AACnE,MAAM,kBAAkB,GAAG;IACzB,oBAAoB;IACpB,eAAe;IACf,YAAY;IACZ,sBAAsB;CACd,CAAC;
|
|
1
|
+
{"version":3,"file":"install-identity.js","sourceRoot":"","sources":["../../../src/services/service-host/install-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MA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;IACD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,QAAQ,EAAE;YACR,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,UAAU;YACV,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,cAAc,CAAC;YAC1D,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC;YAC7D,SAAS,EAAE;gBACT,YAAY,EAAE,UAAU,CAAC,YAAY;gBACrC,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,kBAAkB,EAAE,UAAU,CAAC,kBAAkB;aAClD;YACD,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,EAAE,GAAG,IAAI,EAAE,sBAAsB,EAAE;SACjD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install-level single-instance run lock (SPEC-PD-SERVICE-HOST-001 §8.2 step
|
|
3
|
+
* 2, FR-08; TD §2.1 `locking/service-run-lock.ts`).
|
|
4
|
+
*
|
|
5
|
+
* The protocol is the one proven by PRI-1151's cross-process control-state
|
|
6
|
+
* lock (`host-runtime/product-telemetry/control-state-lock.ts`): atomic
|
|
7
|
+
* `'wx'` create with an owner body `<pid> <token> <createdAtISO>`; ownership-
|
|
8
|
+
* checked release; stale takeover gated on holder-liveness proof. It is
|
|
9
|
+
* re-declared here rather than exported because the semantic contract
|
|
10
|
+
* genuinely differs (P7: a real variation axis, not a speculative seam):
|
|
11
|
+
*
|
|
12
|
+
* - The control-state lock guards millisecond-scale read-modify-write
|
|
13
|
+
* transactions (5s stale window). A run-once coordinator legitimately
|
|
14
|
+
* runs for minutes, so a second coordinator must NEVER take over a lock
|
|
15
|
+
* that may still be a live run — the stale window is 30 minutes by
|
|
16
|
+
* default.
|
|
17
|
+
* - Contention is an IMMEDIATE verdict, not a bounded wait: SPEC §8.2
|
|
18
|
+
* requires the second instance to report `already_running`, not to queue
|
|
19
|
+
* behind the first.
|
|
20
|
+
* - A stale mtime whose body cannot be read is `corrupt` (fail-closed,
|
|
21
|
+
* human decision), never silently takeover-able and never reported as a
|
|
22
|
+
* live run.
|
|
23
|
+
*
|
|
24
|
+
* ── Concurrency protocol (P1-4 round 4: SQLite arbitration) ────────────────
|
|
25
|
+
*
|
|
26
|
+
* Every acquisition, takeover and release decision is serialized through a
|
|
27
|
+
* dedicated arbitration gate: the stable, short-lived SQLite database
|
|
28
|
+
* `<pdHome>/service/service-run-gate.db`, guarded by `BEGIN IMMEDIATE`.
|
|
29
|
+
* While one process holds the transaction, a contender's `BEGIN IMMEDIATE`
|
|
30
|
+
* fails with SQLITE_BUSY — ACQUIRE waits zero milliseconds (SPEC §8.2
|
|
31
|
+
* immediate `already_running`, never a queue), RELEASE retries briefly and
|
|
32
|
+
* bounded. A gate that cannot be opened or transacted at all maps to
|
|
33
|
+
* `unwritable` (fail-closed).
|
|
34
|
+
*
|
|
35
|
+
* The state machine inside the transaction is:
|
|
36
|
+
*
|
|
37
|
+
* evaluateLock ─ 'absent' → 'wx' create → acquired
|
|
38
|
+
* ├ 'fresh' → held
|
|
39
|
+
* ├ 'dead' → re-evaluate → unlink → 'wx' create
|
|
40
|
+
* │ → acquired(staleTakenOver)
|
|
41
|
+
* ├ 'stale-alive' → held (live or inconclusive owner)
|
|
42
|
+
* ├ 'stale-unreadable' → corrupt (identity unverifiable)
|
|
43
|
+
* └ 'stale-anonymous' → corrupt (no holder identity)
|
|
44
|
+
*
|
|
45
|
+
* 'dead' means the recorded holder PID is PROVABLY dead — age does not
|
|
46
|
+
* matter: a verifiably-exited holder is recovered immediately rather than
|
|
47
|
+
* waiting out the stale window (§P0.8).
|
|
48
|
+
*
|
|
49
|
+
* Why this closes the file-mutex races:
|
|
50
|
+
*
|
|
51
|
+
* - No mutex file exists. The arbiter is a real cross-process lock held by
|
|
52
|
+
* the OS/SQLite, not a file whose mtime pretends to prove liveness — so
|
|
53
|
+
* "stale mutex" reclaim is impossible by construction, and a live
|
|
54
|
+
* coordinator's arbitration can never be reclaimed by file-age
|
|
55
|
+
* heuristics (P1-4A moot). File age only feeds `evaluateLock`, and only
|
|
56
|
+
* inside the serialized section where PID liveness remains the sole
|
|
57
|
+
* takeover authority.
|
|
58
|
+
* - verify→delete→create is one transaction: two stale breakers cannot
|
|
59
|
+
* interleave (P1-4B). The first commits before the second's BEGIN
|
|
60
|
+
* completes; the second re-evaluates AFTER the first's lock is already
|
|
61
|
+
* in place and reports `held`.
|
|
62
|
+
* - A crashed coordinator releases its transaction through the OS
|
|
63
|
+
* automatically — recovery is immediate and deterministic (P1-4B).
|
|
64
|
+
* - Release is verify-body + unlink inside the SAME transaction: a true
|
|
65
|
+
* compare-and-delete under the arbiter, never a read→compare→unlink
|
|
66
|
+
* window (P1-4C). A foreign body is never unlinked.
|
|
67
|
+
* - No generic sweep touches arbitration state: `sweepOrphanSidecars`
|
|
68
|
+
* only removes age-proven legacy sidecars (`.mtx`, `.take-*`, `.rel-*`),
|
|
69
|
+
* none of which the new protocol creates or reads (P1-4D). The gate
|
|
70
|
+
* database and its `-journal`/`-wal`/`-shm` sidecars are never swept.
|
|
71
|
+
*
|
|
72
|
+
* No heartbeat exists and none is needed for Phase 1: a run is bounded far
|
|
73
|
+
* below the stale window, and mid-run ownership is re-verified by
|
|
74
|
+
* `holdsServiceRunLock` (the body compare IS the heartbeat-identity check —
|
|
75
|
+
* a file no longer carrying our body means we lost the run). PID liveness
|
|
76
|
+
* remains the sole takeover authority — file age alone is never the sole
|
|
77
|
+
* eviction signal (same rule as `principles-core/ledger-file-lock.ts`).
|
|
78
|
+
*
|
|
79
|
+
* Cross-platform note: `BEGIN IMMEDIATE` is the same advisory-file-lock
|
|
80
|
+
* arbitration on POSIX and Windows (SQLite's POSIX fcntl locks and Windows
|
|
81
|
+
* LockFileEx regions are both released by the OS on process death), and the
|
|
82
|
+
* lock file itself still changes hands only via 'wx' create + unlink —
|
|
83
|
+
* never rename, whose overwrite semantics differ between the platforms. A
|
|
84
|
+
* file still open by its dead holder is not unlinkable on Windows — unlink
|
|
85
|
+
* failure aborts the takeover fail-closed inside the transaction.
|
|
86
|
+
*/
|
|
87
|
+
import * as fs from 'node:fs';
|
|
1
88
|
/**
|
|
2
89
|
* A lock older than this is treated as a crashed holder. A legitimate
|
|
3
90
|
* run-once (bounded cycles, Phase 2 per-workspace timeouts) must stay well
|
|
@@ -6,6 +93,18 @@
|
|
|
6
93
|
export declare const SERVICE_RUN_LOCK_STALE_MS: number;
|
|
7
94
|
/** The one lock file per install: `<pdHome>/service/service-run.lock`. */
|
|
8
95
|
export declare function serviceRunLockPath(pdHome: string): string;
|
|
96
|
+
/**
|
|
97
|
+
* The per-workspace consumer mutex: `<pdHome>/service/workspace-runs/<hash>.lock`.
|
|
98
|
+
*
|
|
99
|
+
* A consuming Worker child holds this for the whole cycle, so an
|
|
100
|
+
* orchestrator (handover resume / rollback) can prove "an old worker is
|
|
101
|
+
* still running on THIS workspace" by holder-PID liveness instead of
|
|
102
|
+
* guessing from the coordinator's own lock. The workspace is addressed by
|
|
103
|
+
* its canonical real directory — the same spelling-or-alias identity rule
|
|
104
|
+
* the §8.4 ownership projection uses — so either path spelling reaches the
|
|
105
|
+
* same mutex (PRI-1282 review).
|
|
106
|
+
*/
|
|
107
|
+
export declare function workspaceServiceRunLockPath(pdHome: string, workspaceDir: string): string;
|
|
9
108
|
export interface ServiceRunLockHandle {
|
|
10
109
|
readonly lockPath: string;
|
|
11
110
|
/** Random per-acquisition token; identifies THIS holder inside the body. */
|
|
@@ -65,6 +164,13 @@ export interface ServiceRunLockProbes {
|
|
|
65
164
|
* (§P0). Production never sets it.
|
|
66
165
|
*/
|
|
67
166
|
readonly gateEndFailure?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Deterministic test seam: replace the lock-file stat (default
|
|
169
|
+
* `fs.statSync`). Lets tests reproduce EACCES/EIO/ENOTDIR stat failures on
|
|
170
|
+
* every platform without depending on OS permission behavior —
|
|
171
|
+
* production never sets it.
|
|
172
|
+
*/
|
|
173
|
+
readonly statLock?: (lockPath: string) => fs.Stats;
|
|
68
174
|
}
|
|
69
175
|
/**
|
|
70
176
|
* Structured lock-file read outcome (P0 round 6): a missing file and an
|
|
@@ -84,20 +190,35 @@ export type LockBodyRead = {
|
|
|
84
190
|
export declare function readLockBodyStatus(lockPath: string): LockBodyRead;
|
|
85
191
|
/** True when the lock file still carries OUR body (mid-run ownership re-check). */
|
|
86
192
|
export declare function holdsServiceRunLock(handle: ServiceRunLockHandle): boolean;
|
|
193
|
+
/** Acquire the install-level single-instance run lock (see {@link acquireLockAt}). */
|
|
194
|
+
export declare function acquireServiceRunLock(pdHome: string, options?: {
|
|
195
|
+
staleMs?: number;
|
|
196
|
+
probes?: ServiceRunLockProbes;
|
|
197
|
+
}): AcquireServiceRunLockResult;
|
|
87
198
|
/**
|
|
88
|
-
* Acquire the
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* holder is NEVER taken over, and the verify→delete→create sequence is
|
|
94
|
-
* serialized by the same transaction that a second contender's BEGIN
|
|
95
|
-
* cannot enter.
|
|
199
|
+
* Acquire the per-workspace consumer mutex (see
|
|
200
|
+
* {@link workspaceServiceRunLockPath}). Same protocol as the install-level
|
|
201
|
+
* lock; the Worker child holds it for its whole consuming cycle so a
|
|
202
|
+
* handover resume / rollback can prove the old worker is still running
|
|
203
|
+
* (PRI-1282 review).
|
|
96
204
|
*/
|
|
97
|
-
export declare function
|
|
205
|
+
export declare function acquireWorkspaceServiceRunLock(pdHome: string, workspaceDir: string, options?: {
|
|
98
206
|
staleMs?: number;
|
|
99
207
|
probes?: ServiceRunLockProbes;
|
|
100
208
|
}): AcquireServiceRunLockResult;
|
|
209
|
+
/**
|
|
210
|
+
* Non-mutating liveness probe: is a CONSUMING worker holding this lock
|
|
211
|
+
* right now? 'free' means no holder or a provably-dead one (recoverable);
|
|
212
|
+
* 'held' means a live or inconclusive holder — an orchestrator must refuse
|
|
213
|
+
* to overlap it; 'corrupt' means the body cannot be verified (fail-closed).
|
|
214
|
+
*/
|
|
215
|
+
export declare function probeServiceRunLockState(lockPath: string, options?: {
|
|
216
|
+
staleMs?: number;
|
|
217
|
+
probes?: ServiceRunLockProbes;
|
|
218
|
+
}): {
|
|
219
|
+
state: 'free' | 'held' | 'corrupt';
|
|
220
|
+
detail?: string;
|
|
221
|
+
};
|
|
101
222
|
/**
|
|
102
223
|
* Structured release outcome (§三): a release can never be silent.
|
|
103
224
|
* - `released` — our lock was verified and unlinked under the gate;
|