create-principles-disciple 1.152.2 → 1.152.4
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 +1 -1
- package/codex-adapter/dist/pd-hook.js +34 -4
- package/codex-adapter/package.json +1 -1
- package/console/dist/server/config/pd-config-store.d.ts +48 -0
- package/console/dist/server/config/pd-config-store.js +273 -93
- package/console/dist/server/index.js +16 -1
- package/console/dist/server/models/ActivationsConsoleModel.d.ts +72 -1
- package/console/dist/server/models/ActivationsConsoleModel.js +92 -14
- package/console/dist/server/models/AdaptiveActivationConsoleModel.d.ts +79 -0
- package/console/dist/server/models/AdaptiveActivationConsoleModel.js +151 -0
- package/console/dist/server/models/ApprovalsConsoleModel.d.ts +28 -0
- package/console/dist/server/models/ApprovalsConsoleModel.js +118 -3
- package/console/dist/server/models/ApprovalsGroupedConsoleModel.d.ts +38 -0
- package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +158 -26
- package/console/dist/server/models/IntentDecisionModel.d.ts +6 -1
- package/console/dist/server/models/IntentDecisionModel.js +17 -9
- package/console/dist/server/models/pipeline-health-metrics.d.ts +128 -0
- package/console/dist/server/models/pipeline-health-metrics.js +225 -0
- package/console/dist/server/routes/approvals.js +14 -0
- package/console/dist/server/routes/config.js +212 -1
- package/console/dist/server/routes/diagnostician.js +13 -2
- package/console/dist/server/routes/intent-decisions.js +19 -1
- package/console/dist/server/routes/pipeline-health.d.ts +9 -0
- package/console/dist/server/routes/pipeline-health.js +124 -0
- package/console/dist/web/assets/app.css +484 -67
- package/console/dist/web/assets/app.js +36 -31
- package/console/dist/web/assets/evidence-art-1.webp +0 -0
- package/console/dist/web/assets/evidence-art-2.webp +0 -0
- package/console/dist/web/assets/evidence-art-3.webp +0 -0
- package/console/dist/web/assets/evidence-art-4.webp +0 -0
- package/console/dist/web/assets/principle-grove.jpg +0 -0
- package/console/dist/web/assets/principle-stone-steps.jpg +0 -0
- package/console/dist/web/assets/principles-art-1.webp +0 -0
- package/console/dist/web/assets/principles-art-2.webp +0 -0
- package/console/dist/web/assets/principles-art-3.webp +0 -0
- package/console/dist/web/assets/principles-art-4.webp +0 -0
- package/console/dist/web/assets/today-art-1.webp +0 -0
- package/console/dist/web/assets/today-art-2.webp +0 -0
- package/console/dist/web/assets/today-art-3.webp +0 -0
- package/console/dist/web/assets/today-art-4.webp +0 -0
- package/core/dist/runtime/activation/activation-types.d.ts +6 -0
- package/core/dist/runtime/activation/activation-types.d.ts.map +1 -1
- package/core/dist/runtime/activation/activation-types.js.map +1 -1
- package/core/dist/runtime/activation/index.d.ts +2 -1
- package/core/dist/runtime/activation/index.d.ts.map +1 -1
- package/core/dist/runtime/activation/index.js +1 -1
- package/core/dist/runtime/activation/index.js.map +1 -1
- package/core/dist/runtime/activation/ledger-identity.d.ts +8 -0
- package/core/dist/runtime/activation/ledger-identity.d.ts.map +1 -1
- package/core/dist/runtime/activation/ledger-identity.js +20 -1
- package/core/dist/runtime/activation/ledger-identity.js.map +1 -1
- package/core/dist/runtime/activation/sqlite-approval-store.d.ts +18 -0
- package/core/dist/runtime/activation/sqlite-approval-store.d.ts.map +1 -1
- package/core/dist/runtime/activation/sqlite-approval-store.js +146 -20
- package/core/dist/runtime/activation/sqlite-approval-store.js.map +1 -1
- package/core/dist/runtime/adapter/artificer-l2-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/artificer-l2-adapter.js +11 -4
- package/core/dist/runtime/adapter/artificer-l2-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/l2-agent-loop-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/l2-agent-loop-adapter.js +11 -4
- package/core/dist/runtime/adapter/l2-agent-loop-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/output-repair-contract.d.ts +21 -1
- package/core/dist/runtime/adapter/output-repair-contract.d.ts.map +1 -1
- package/core/dist/runtime/adapter/output-repair-contract.js.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-catalog.d.ts +42 -0
- package/core/dist/runtime/adapter/pi-ai-catalog.d.ts.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-catalog.js +68 -0
- package/core/dist/runtime/adapter/pi-ai-catalog.js.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-connection-probe.d.ts +45 -0
- package/core/dist/runtime/adapter/pi-ai-connection-probe.d.ts.map +1 -0
- package/core/dist/runtime/adapter/pi-ai-connection-probe.js +321 -0
- package/core/dist/runtime/adapter/pi-ai-connection-probe.js.map +1 -0
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts +27 -2
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js +71 -10
- package/core/dist/runtime/adapter/pi-ai-runtime-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/schema-prompt-adapter.d.ts.map +1 -1
- package/core/dist/runtime/adapter/schema-prompt-adapter.js +39 -6
- package/core/dist/runtime/adapter/schema-prompt-adapter.js.map +1 -1
- package/core/dist/runtime/adapter/structured-output-repair.d.ts +26 -0
- package/core/dist/runtime/adapter/structured-output-repair.d.ts.map +1 -1
- package/core/dist/runtime/adapter/structured-output-repair.js +140 -2
- package/core/dist/runtime/adapter/structured-output-repair.js.map +1 -1
- package/core/dist/runtime/config/execution-timing.d.ts +56 -0
- package/core/dist/runtime/config/execution-timing.d.ts.map +1 -0
- package/core/dist/runtime/config/execution-timing.js +76 -0
- package/core/dist/runtime/config/execution-timing.js.map +1 -0
- package/core/dist/runtime/config/index.d.ts +4 -0
- package/core/dist/runtime/config/index.d.ts.map +1 -1
- package/core/dist/runtime/config/index.js +2 -0
- package/core/dist/runtime/config/index.js.map +1 -1
- package/core/dist/runtime/config/pd-config-redaction.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-redaction.js +4 -0
- package/core/dist/runtime/config/pd-config-redaction.js.map +1 -1
- package/core/dist/runtime/config/pd-config-types.d.ts +5 -0
- package/core/dist/runtime/config/pd-config-types.d.ts.map +1 -1
- package/core/dist/runtime/config/pd-config-types.js.map +1 -1
- package/core/dist/runtime/config/pd-credentials.d.ts +105 -0
- package/core/dist/runtime/config/pd-credentials.d.ts.map +1 -0
- package/core/dist/runtime/config/pd-credentials.js +409 -0
- package/core/dist/runtime/config/pd-credentials.js.map +1 -0
- package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts +13 -2
- package/core/dist/runtime/diagnostician/diag-rootcause-output.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician/diag-rootcause-output.js.map +1 -1
- package/core/dist/runtime/diagnostician/diagnostic-context-budget.d.ts +45 -0
- package/core/dist/runtime/diagnostician/diagnostic-context-budget.d.ts.map +1 -0
- package/core/dist/runtime/diagnostician/diagnostic-context-budget.js +74 -0
- package/core/dist/runtime/diagnostician/diagnostic-context-budget.js.map +1 -0
- package/core/dist/runtime/diagnostician/prompt-projection.d.ts +51 -0
- package/core/dist/runtime/diagnostician/prompt-projection.d.ts.map +1 -0
- package/core/dist/runtime/diagnostician/prompt-projection.js +192 -0
- package/core/dist/runtime/diagnostician/prompt-projection.js.map +1 -0
- package/core/dist/runtime/diagnostician-output.d.ts +1 -1
- package/core/dist/runtime/diagnostician-output.d.ts.map +1 -1
- package/core/dist/runtime/diagnostician-output.js +2 -2
- package/core/dist/runtime/diagnostician-output.js.map +1 -1
- package/core/dist/runtime/index.d.ts +5 -2
- package/core/dist/runtime/index.d.ts.map +1 -1
- package/core/dist/runtime/index.js +11 -1
- package/core/dist/runtime/index.js.map +1 -1
- package/core/dist/runtime/intent/index.d.ts +2 -0
- package/core/dist/runtime/intent/index.d.ts.map +1 -1
- package/core/dist/runtime/intent/index.js +2 -0
- package/core/dist/runtime/intent/index.js.map +1 -1
- package/core/dist/runtime/intent/intent-decision-record.d.ts +51 -3
- package/core/dist/runtime/intent/intent-decision-record.d.ts.map +1 -1
- package/core/dist/runtime/intent/intent-snapshot.d.ts +104 -0
- package/core/dist/runtime/intent/intent-snapshot.d.ts.map +1 -0
- package/core/dist/runtime/intent/intent-snapshot.js +164 -0
- package/core/dist/runtime/intent/intent-snapshot.js.map +1 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.d.ts +70 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.d.ts.map +1 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.js +148 -0
- package/core/dist/runtime/intent/strategic-conflict-gate.js.map +1 -0
- package/core/dist/runtime/internalization/artificer-runner.js +1 -1
- package/core/dist/runtime/internalization/artificer-runner.js.map +1 -1
- package/core/dist/runtime/internalization/diag-distiller-runner.d.ts +6 -0
- package/core/dist/runtime/internalization/diag-distiller-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-distiller-runner.js +62 -5
- package/core/dist/runtime/internalization/diag-distiller-runner.js.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts +41 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-rootcause-runner.js +190 -43
- package/core/dist/runtime/internalization/diag-rootcause-runner.js.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.d.ts +6 -0
- package/core/dist/runtime/internalization/diag-router-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/diag-router-runner.js +114 -69
- package/core/dist/runtime/internalization/diag-router-runner.js.map +1 -1
- package/core/dist/runtime/internalization/dreamer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/dreamer-prompt-builder.js +3 -0
- package/core/dist/runtime/internalization/dreamer-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/dreamer-runner.js +1 -1
- package/core/dist/runtime/internalization/dreamer-runner.js.map +1 -1
- package/core/dist/runtime/internalization/evaluator-runner.js +4 -4
- package/core/dist/runtime/internalization/evaluator-runner.js.map +1 -1
- package/core/dist/runtime/internalization/formation-context.d.ts +54 -0
- package/core/dist/runtime/internalization/formation-context.d.ts.map +1 -1
- package/core/dist/runtime/internalization/formation-context.js +135 -3
- package/core/dist/runtime/internalization/formation-context.js.map +1 -1
- package/core/dist/runtime/internalization/index.d.ts +2 -2
- 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/intent-contract.d.ts +107 -0
- package/core/dist/runtime/internalization/intent-contract.d.ts.map +1 -1
- package/core/dist/runtime/internalization/intent-contract.js +315 -4
- package/core/dist/runtime/internalization/intent-contract.js.map +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.d.ts +8 -0
- package/core/dist/runtime/internalization/peer-runner-contracts.d.ts.map +1 -1
- package/core/dist/runtime/internalization/peer-runner-contracts.js.map +1 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts +22 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/philosopher-prompt-builder.js +22 -3
- package/core/dist/runtime/internalization/philosopher-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/philosopher-runner.d.ts +15 -0
- package/core/dist/runtime/internalization/philosopher-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/philosopher-runner.js +74 -2
- package/core/dist/runtime/internalization/philosopher-runner.js.map +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.d.ts +32 -0
- package/core/dist/runtime/internalization/pitask-metadata.d.ts.map +1 -1
- package/core/dist/runtime/internalization/pitask-metadata.js +44 -0
- package/core/dist/runtime/internalization/pitask-metadata.js.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-runner.d.ts +6 -1
- package/core/dist/runtime/internalization/rollout-reviewer-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/rollout-reviewer-runner.js +31 -15
- package/core/dist/runtime/internalization/rollout-reviewer-runner.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-output.d.ts +21 -0
- package/core/dist/runtime/internalization/scribe-output.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-output.js +125 -2
- package/core/dist/runtime/internalization/scribe-output.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts +26 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-prompt-builder.js +33 -3
- package/core/dist/runtime/internalization/scribe-prompt-builder.js.map +1 -1
- package/core/dist/runtime/internalization/scribe-runner.d.ts +32 -2
- package/core/dist/runtime/internalization/scribe-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/scribe-runner.js +106 -8
- package/core/dist/runtime/internalization/scribe-runner.js.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts +46 -0
- package/core/dist/runtime/internalization/split-diagnostician-runner.d.ts.map +1 -1
- package/core/dist/runtime/internalization/split-diagnostician-runner.js +220 -20
- package/core/dist/runtime/internalization/split-diagnostician-runner.js.map +1 -1
- package/core/dist/runtime/internalization-integrity-remediation.d.ts +7 -0
- package/core/dist/runtime/internalization-integrity-remediation.d.ts.map +1 -1
- package/core/dist/runtime/internalization-integrity-remediation.js +44 -12
- package/core/dist/runtime/internalization-integrity-remediation.js.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.d.ts.map +1 -1
- package/core/dist/runtime/pain-signal-runtime-factory.js +25 -4
- package/core/dist/runtime/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime/pain-submit-capability.js +5 -5
- package/core/dist/runtime/pain-submit-capability.js.map +1 -1
- package/core/dist/runtime/runner/base-peer-runner.d.ts +90 -2
- package/core/dist/runtime/runner/base-peer-runner.d.ts.map +1 -1
- package/core/dist/runtime/runner/base-peer-runner.js +463 -170
- package/core/dist/runtime/runner/base-peer-runner.js.map +1 -1
- package/core/dist/runtime/runner/peer-runner-types.d.ts +19 -0
- package/core/dist/runtime/runner/peer-runner-types.d.ts.map +1 -1
- package/core/dist/runtime/runtime-protocol.d.ts +19 -0
- package/core/dist/runtime/runtime-protocol.d.ts.map +1 -1
- package/core/dist/runtime/signal-collector/llm-stage.d.ts +5 -0
- package/core/dist/runtime/signal-collector/llm-stage.d.ts.map +1 -1
- package/core/dist/runtime/signal-collector/llm-stage.js.map +1 -1
- package/core/dist/runtime/store/artifact/sqlite-pi-artifact-store.d.ts +14 -0
- package/core/dist/runtime/store/artifact/sqlite-pi-artifact-store.d.ts.map +1 -1
- package/core/dist/runtime/store/artifact/sqlite-pi-artifact-store.js +16 -1
- package/core/dist/runtime/store/artifact/sqlite-pi-artifact-store.js.map +1 -1
- package/core/dist/runtime/store/commit/diagnostician-committer.d.ts +19 -0
- package/core/dist/runtime/store/commit/diagnostician-committer.d.ts.map +1 -1
- package/core/dist/runtime/store/commit/diagnostician-committer.js +11 -0
- package/core/dist/runtime/store/commit/diagnostician-committer.js.map +1 -1
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.d.ts +2 -2
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.d.ts.map +1 -1
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.js +285 -35
- package/core/dist/runtime/store/intent/sqlite-intent-decision-store.js.map +1 -1
- package/core/dist/runtime/store/lifecycle/fenced-task-writer.d.ts +64 -0
- package/core/dist/runtime/store/lifecycle/fenced-task-writer.d.ts.map +1 -0
- package/core/dist/runtime/store/lifecycle/fenced-task-writer.js +231 -0
- package/core/dist/runtime/store/lifecycle/fenced-task-writer.js.map +1 -0
- package/core/dist/runtime/store/lifecycle/index.d.ts +2 -0
- package/core/dist/runtime/store/lifecycle/index.d.ts.map +1 -1
- package/core/dist/runtime/store/lifecycle/index.js +1 -0
- package/core/dist/runtime/store/lifecycle/index.js.map +1 -1
- package/core/dist/runtime/store/lifecycle/lease-fence.d.ts +80 -0
- package/core/dist/runtime/store/lifecycle/lease-fence.d.ts.map +1 -0
- package/core/dist/runtime/store/lifecycle/lease-fence.js +79 -0
- package/core/dist/runtime/store/lifecycle/lease-fence.js.map +1 -0
- package/core/dist/runtime/store/lifecycle/lease-heartbeat.d.ts +118 -0
- package/core/dist/runtime/store/lifecycle/lease-heartbeat.d.ts.map +1 -0
- package/core/dist/runtime/store/lifecycle/lease-heartbeat.js +187 -0
- package/core/dist/runtime/store/lifecycle/lease-heartbeat.js.map +1 -0
- package/core/dist/runtime/store/lifecycle/lease-manager.d.ts +30 -20
- package/core/dist/runtime/store/lifecycle/lease-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/lifecycle/lease-manager.js +94 -53
- package/core/dist/runtime/store/lifecycle/lease-manager.js.map +1 -1
- package/core/dist/runtime/store/lifecycle/recovery-sweep.d.ts.map +1 -1
- package/core/dist/runtime/store/lifecycle/recovery-sweep.js +32 -15
- package/core/dist/runtime/store/lifecycle/recovery-sweep.js.map +1 -1
- package/core/dist/runtime/store/run/sqlite-run-store.d.ts +29 -0
- package/core/dist/runtime/store/run/sqlite-run-store.d.ts.map +1 -1
- package/core/dist/runtime/store/run/sqlite-run-store.js +40 -0
- package/core/dist/runtime/store/run/sqlite-run-store.js.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.d.ts +64 -10
- package/core/dist/runtime/store/runtime-state-manager.d.ts.map +1 -1
- package/core/dist/runtime/store/runtime-state-manager.js +154 -89
- package/core/dist/runtime/store/runtime-state-manager.js.map +1 -1
- package/core/dist/runtime/store/sqlite-connection.d.ts.map +1 -1
- package/core/dist/runtime/store/sqlite-connection.js +73 -4
- package/core/dist/runtime/store/sqlite-connection.js.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.d.ts.map +1 -1
- package/core/dist/runtime/store/task/sqlite-task-store.js +6 -3
- package/core/dist/runtime/store/task/sqlite-task-store.js.map +1 -1
- package/core/dist/runtime/task-status.d.ts +16 -0
- package/core/dist/runtime/task-status.d.ts.map +1 -1
- package/core/dist/runtime/task-status.js +8 -0
- package/core/dist/runtime/task-status.js.map +1 -1
- package/core/dist/runtime/trajectory-schema.d.ts.map +1 -1
- package/core/dist/runtime/trajectory-schema.js +20 -1
- package/core/dist/runtime/trajectory-schema.js.map +1 -1
- package/core/dist/runtime/types/event-types.d.ts +20 -0
- package/core/dist/runtime/types/event-types.d.ts.map +1 -1
- package/core/dist/runtime/types/event-types.js +7 -0
- package/core/dist/runtime/types/event-types.js.map +1 -1
- package/core/dist/telemetry-event.d.ts +2 -2
- package/core/dist/telemetry-event.d.ts.map +1 -1
- package/core/dist/telemetry-event.js +27 -2
- package/core/dist/telemetry-event.js.map +1 -1
- package/core/dist/trajectory-types.d.ts +33 -0
- package/core/dist/trajectory-types.d.ts.map +1 -1
- package/core/package.json +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +12 -5
- package/dist/installer.js.map +1 -1
- package/dist/installers/codex-host-installer.d.ts.map +1 -1
- package/dist/installers/codex-host-installer.js +9 -12
- package/dist/installers/codex-host-installer.js.map +1 -1
- package/host-runtime/dist/adaptive-consumer-schedule.d.ts +103 -0
- package/host-runtime/dist/adaptive-consumer-schedule.js +145 -0
- package/host-runtime/dist/adaptive-priority-provider.d.ts +7 -1
- package/host-runtime/dist/adaptive-priority-provider.js +6 -3
- package/host-runtime/dist/adaptive-selection.d.ts +1 -1
- package/host-runtime/dist/adaptive-selection.js +2 -1
- package/host-runtime/dist/degraded-enforcement-marker.d.ts +35 -0
- package/host-runtime/dist/degraded-enforcement-marker.js +79 -0
- package/host-runtime/dist/index.d.ts +2 -0
- package/host-runtime/dist/index.js +8 -0
- package/host-runtime/dist/internalization-consumer-cycle.d.ts +35 -0
- package/host-runtime/dist/internalization-consumer-cycle.js +51 -17
- package/host-runtime/dist/prompt-activation-deliverability.d.ts +10 -0
- package/host-runtime/dist/prompt-activation-deliverability.js +5 -2
- package/host-runtime/dist/prompt-injection-event-evidence.d.ts +34 -0
- package/host-runtime/dist/prompt-injection-event-evidence.js +96 -0
- package/host-runtime/dist/signal-classifier.js +4 -4
- package/host-runtime/package.json +1 -1
- package/install-layout/dist/mcp-binding-contract.js +4 -15
- package/install-layout/package.json +1 -1
- package/package.json +3 -3
- package/pd-cli/dist/commands/health-codex.d.ts.map +1 -1
- package/pd-cli/dist/commands/health-codex.js +26 -1
- package/pd-cli/dist/commands/health-codex.js.map +1 -1
- package/pd-cli/dist/commands/health.d.ts.map +1 -1
- package/pd-cli/dist/commands/health.js +32 -2
- package/pd-cli/dist/commands/health.js.map +1 -1
- package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-retry.js +6 -4
- package/pd-cli/dist/commands/pain-retry.js.map +1 -1
- package/pd-cli/dist/commands/runtime-init.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-init.js +29 -1
- package/pd-cli/dist/commands/runtime-init.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-once.js +9 -14
- package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js +5 -5
- package/pd-cli/dist/commands/runtime-internalization-run-rulehost.js.map +1 -1
- package/pd-cli/dist/commands/runtime-usage.d.ts +62 -0
- package/pd-cli/dist/commands/runtime-usage.d.ts.map +1 -0
- package/pd-cli/dist/commands/runtime-usage.js +315 -0
- package/pd-cli/dist/commands/runtime-usage.js.map +1 -0
- package/pd-cli/dist/commands/runtime.js +6 -6
- package/pd-cli/dist/commands/runtime.js.map +1 -1
- package/pd-cli/dist/index.d.ts.map +1 -1
- package/pd-cli/dist/index.js +51 -17
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-cli/dist/program.d.ts.map +1 -1
- package/pd-cli/dist/program.js +4 -0
- package/pd-cli/dist/program.js.map +1 -1
- package/pd-cli/dist/services/cli-invocation-log.d.ts +66 -0
- package/pd-cli/dist/services/cli-invocation-log.d.ts.map +1 -0
- package/pd-cli/dist/services/cli-invocation-log.js +139 -0
- package/pd-cli/dist/services/cli-invocation-log.js.map +1 -0
- package/pd-cli/dist/services/config-doctor.d.ts.map +1 -1
- package/pd-cli/dist/services/config-doctor.js +5 -4
- package/pd-cli/dist/services/config-doctor.js.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.d.ts.map +1 -1
- package/pd-cli/dist/services/demo-story-a-runner.js +6 -2
- package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
- package/pd-cli/dist/services/pd-config-loader.d.ts +3 -1
- package/pd-cli/dist/services/pd-config-loader.d.ts.map +1 -1
- package/pd-cli/dist/services/pd-config-loader.js +20 -8
- package/pd-cli/dist/services/pd-config-loader.js.map +1 -1
- package/pd-cli/dist/services/runtime-adapter-resolver.d.ts.map +1 -1
- package/pd-cli/dist/services/runtime-adapter-resolver.js +5 -5
- package/pd-cli/dist/services/runtime-adapter-resolver.js.map +1 -1
- package/pd-cli/package.json +1 -1
- package/plugin/dist/bundle.js +632 -536
- package/plugin/dist/core/signal-collector-host.d.ts +5 -0
- package/plugin/dist/governance-audit.js +2 -2
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +13 -10
- package/plugin/dist/service/internalization-auto-consumer-service.d.ts +2 -1
- package/plugin/dist/templates/langs/en/skills/pd-pain-signal/SKILL.md +1 -1
- package/plugin/dist/templates/langs/zh/skills/pd-pain-signal/SKILL.md +1 -1
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/plugin/templates/langs/en/skills/pd-pain-signal/SKILL.md +1 -1
- package/plugin/templates/langs/zh/skills/pd-pain-signal/SKILL.md +1 -1
- package/release-manager/dist/installer.js +12 -5
- package/release-manager/dist/installers/codex-host-installer.js +9 -12
- package/release-manager/package.json +1 -1
- package/workbuddy-adapter/package.json +1 -1
- package/workbuddy-adapter/plugin/skills/pd-pain-signal/SKILL.md +1 -1
- package/dist/installers/mcp-binding-shape-mirror.d.ts +0 -27
- package/dist/installers/mcp-binding-shape-mirror.d.ts.map +0 -1
- package/dist/installers/mcp-binding-shape-mirror.js +0 -105
- package/dist/installers/mcp-binding-shape-mirror.js.map +0 -1
- package/release-manager/dist/installers/mcp-binding-shape-mirror.js +0 -105
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
function defaultSetTimeout(handler, ms) {
|
|
2
|
+
// A heartbeat must never keep a short-lived CLI process alive on its own.
|
|
3
|
+
const timer = setTimeout(handler, ms);
|
|
4
|
+
timer.unref?.();
|
|
5
|
+
return timer;
|
|
6
|
+
}
|
|
7
|
+
function defaultClearTimeout(handle) {
|
|
8
|
+
clearTimeout(handle);
|
|
9
|
+
}
|
|
10
|
+
export class LeaseHeartbeat {
|
|
11
|
+
options;
|
|
12
|
+
state = 'idle';
|
|
13
|
+
timerHandle = null;
|
|
14
|
+
inFlight = null;
|
|
15
|
+
renewalCountValue = 0;
|
|
16
|
+
lastRenewedAtValue = null;
|
|
17
|
+
lastErrorValue = null;
|
|
18
|
+
setTimeoutFn;
|
|
19
|
+
clearTimeoutFn;
|
|
20
|
+
now;
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.options = options;
|
|
23
|
+
// Fail closed at construction time: a heartbeat that cannot probe the
|
|
24
|
+
// persisted row would have to guess, and guessing "owned" is the defect
|
|
25
|
+
// this module exists to remove. Harnesses must opt in explicitly.
|
|
26
|
+
if (!options.readOwnership && !options.unfencedTestMode) {
|
|
27
|
+
throw new Error('LeaseHeartbeat requires readOwnership (or an explicit unfencedTestMode) — an unverifiable lease is not proof of ownership');
|
|
28
|
+
}
|
|
29
|
+
this.setTimeoutFn = options.setTimeoutFn ?? defaultSetTimeout;
|
|
30
|
+
this.clearTimeoutFn = options.clearTimeoutFn ?? defaultClearTimeout;
|
|
31
|
+
this.now = options.now ?? (() => new Date());
|
|
32
|
+
}
|
|
33
|
+
/** The identity every renewal and every fenced write must carry. */
|
|
34
|
+
get fence() {
|
|
35
|
+
return {
|
|
36
|
+
taskId: this.options.taskId,
|
|
37
|
+
owner: this.options.owner,
|
|
38
|
+
leaseGeneration: this.options.leaseGeneration,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
get status() {
|
|
42
|
+
return this.state;
|
|
43
|
+
}
|
|
44
|
+
/** True once a renewal (or ownership probe) proved the worker lost the lease. */
|
|
45
|
+
get lost() {
|
|
46
|
+
return this.state === 'lost';
|
|
47
|
+
}
|
|
48
|
+
get renewalCount() {
|
|
49
|
+
return this.renewalCountValue;
|
|
50
|
+
}
|
|
51
|
+
get lastRenewedAt() {
|
|
52
|
+
return this.lastRenewedAtValue;
|
|
53
|
+
}
|
|
54
|
+
get lastError() {
|
|
55
|
+
return this.lastErrorValue;
|
|
56
|
+
}
|
|
57
|
+
/** Begin periodic renewal. Idempotent while running. */
|
|
58
|
+
start() {
|
|
59
|
+
if (this.state === 'running')
|
|
60
|
+
return;
|
|
61
|
+
if (this.state === 'lost')
|
|
62
|
+
return; // a lost lease can never be re-acquired here
|
|
63
|
+
this.state = 'running';
|
|
64
|
+
this.scheduleNext();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Stop renewing and wait for an in-flight renewal to settle.
|
|
68
|
+
*
|
|
69
|
+
* Awaiting matters: a renewal racing with `stop()` must not update the row
|
|
70
|
+
* after the caller believes the lease is released.
|
|
71
|
+
*/
|
|
72
|
+
async stop() {
|
|
73
|
+
if (this.state !== 'lost') {
|
|
74
|
+
this.state = 'stopped';
|
|
75
|
+
}
|
|
76
|
+
this.clearTimer();
|
|
77
|
+
if (this.inFlight) {
|
|
78
|
+
try {
|
|
79
|
+
await this.inFlight;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// tick() already recorded the failure; stop() must not rethrow it.
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Commit-time ownership verdict.
|
|
88
|
+
*
|
|
89
|
+
* A positive verdict requires ALL of: the persisted task exists, is still
|
|
90
|
+
* `leased`, carries OUR owner, carries OUR fencing generation, and has not
|
|
91
|
+
* expired. Anything else — a missing row, a probe error, a different
|
|
92
|
+
* generation under the same owner string — is a lost lease.
|
|
93
|
+
*
|
|
94
|
+
* A probe error and a missing row are BOTH fail-closed: an unprovable
|
|
95
|
+
* ownership claim must never be treated as proof (Evidence Over Assumption),
|
|
96
|
+
* and the recovery sweep may simply have deleted the row.
|
|
97
|
+
*/
|
|
98
|
+
async assertOwned() {
|
|
99
|
+
if (this.state === 'lost')
|
|
100
|
+
return false;
|
|
101
|
+
if (!this.options.readOwnership) {
|
|
102
|
+
// Only reachable in explicit `unfencedTestMode` (constructor enforces it).
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
let snapshot;
|
|
106
|
+
try {
|
|
107
|
+
snapshot = await this.options.readOwnership(this.options.taskId);
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
this.markLost('ownership_probe_failed', error instanceof Error ? error.message : String(error));
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (!snapshot) {
|
|
114
|
+
this.markLost('lease_row_missing', `task ${this.options.taskId} is no longer readable`);
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if (snapshot.status !== 'leased' || snapshot.leaseOwner !== this.options.owner) {
|
|
118
|
+
this.markLost('ownership_probe_mismatch', `expected leased/${this.options.owner}, observed ${snapshot.status}/${snapshot.leaseOwner ?? 'none'}`);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
const observedGeneration = typeof snapshot.leaseGeneration === 'number' ? snapshot.leaseGeneration : null;
|
|
122
|
+
if (observedGeneration === null || observedGeneration !== this.options.leaseGeneration) {
|
|
123
|
+
this.markLost('ownership_probe_mismatch', `lease generation moved: expected ${this.options.leaseGeneration}, observed ${observedGeneration ?? 'unknown'}`);
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
if (!snapshot.leaseExpiresAt) {
|
|
127
|
+
this.markLost('ownership_probe_mismatch', 'leased row has no lease_expires_at');
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
if (new Date(snapshot.leaseExpiresAt).getTime() <= this.now().getTime()) {
|
|
131
|
+
this.markLost('lease_expired', `lease expired at ${snapshot.leaseExpiresAt}`);
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
scheduleNext() {
|
|
137
|
+
if (this.state !== 'running')
|
|
138
|
+
return;
|
|
139
|
+
this.timerHandle = this.setTimeoutFn(() => {
|
|
140
|
+
this.inFlight = this.tick().finally(() => {
|
|
141
|
+
this.inFlight = null;
|
|
142
|
+
});
|
|
143
|
+
}, this.options.intervalMs);
|
|
144
|
+
}
|
|
145
|
+
async tick() {
|
|
146
|
+
if (this.state !== 'running')
|
|
147
|
+
return;
|
|
148
|
+
try {
|
|
149
|
+
await this.options.renewLease(this.fence, this.options.leaseTtlMs);
|
|
150
|
+
this.renewalCountValue += 1;
|
|
151
|
+
this.lastRenewedAtValue = this.now().toISOString();
|
|
152
|
+
this.options.emit?.({
|
|
153
|
+
type: 'renewed',
|
|
154
|
+
taskId: this.options.taskId,
|
|
155
|
+
owner: this.options.owner,
|
|
156
|
+
renewalCount: this.renewalCountValue,
|
|
157
|
+
occurredAt: this.lastRenewedAtValue,
|
|
158
|
+
});
|
|
159
|
+
this.scheduleNext();
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
this.markLost('renewal_failed', error instanceof Error ? error.message : String(error));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
markLost(type, detail) {
|
|
166
|
+
if (this.state === 'lost')
|
|
167
|
+
return;
|
|
168
|
+
this.state = 'lost';
|
|
169
|
+
this.lastErrorValue = `${type}: ${detail}`;
|
|
170
|
+
this.clearTimer();
|
|
171
|
+
this.options.emit?.({
|
|
172
|
+
type: type === 'renewal_failed' ? 'renewal_failed' : 'ownership_lost',
|
|
173
|
+
taskId: this.options.taskId,
|
|
174
|
+
owner: this.options.owner,
|
|
175
|
+
renewalCount: this.renewalCountValue,
|
|
176
|
+
occurredAt: this.now().toISOString(),
|
|
177
|
+
detail: this.lastErrorValue,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
clearTimer() {
|
|
181
|
+
if (this.timerHandle !== null) {
|
|
182
|
+
this.clearTimeoutFn(this.timerHandle);
|
|
183
|
+
this.timerHandle = null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=lease-heartbeat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lease-heartbeat.js","sourceRoot":"","sources":["../../../../src/runtime/store/lifecycle/lease-heartbeat.ts"],"names":[],"mappings":"AA2EA,SAAS,iBAAiB,CAAC,OAAmB,EAAE,EAAU;IACxD,0EAA0E;IAC1E,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAA2D,CAAC;IAChG,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;IAChB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAe;IAC1C,YAAY,CAAC,MAAuC,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,OAAO,cAAc;IAWW,OAAO;IAVnC,KAAK,GAAwB,MAAM,CAAC;IACpC,WAAW,GAAY,IAAI,CAAC;IAC5B,QAAQ,GAAyB,IAAI,CAAC;IACtC,iBAAiB,GAAG,CAAC,CAAC;IACtB,kBAAkB,GAAkB,IAAI,CAAC;IACzC,cAAc,GAAkB,IAAI,CAAC;IAC5B,YAAY,CAA+C;IAC3D,cAAc,CAA4B;IAC1C,GAAG,CAAa;IAEjC,YAAoC,OAA8B;uBAA9B,OAAO;QACzC,sEAAsE;QACtE,wEAAwE;QACxE,kEAAkE;QAClE,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CACb,2HAA2H,CAC5H,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY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AC,MAAM;YAC3B,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;YACzB,YAAY,EAAE,IAAI,CAAC,iBAAiB;YACpC,UAAU,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;YACpC,MAAM,EAAE,IAAI,CAAC,cAAc;SAC5B,CAAC,CAAC;IACL,CAAC;IAEO,UAAU;QAChB,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;YAC9B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC1B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -3,12 +3,26 @@ import type { TaskStore } from '../task/task-store.js';
|
|
|
3
3
|
import type { RunStore } from '../run/run-store.js';
|
|
4
4
|
import type { SqliteConnection } from '../sqlite-connection.js';
|
|
5
5
|
import { type StoreEventEmitter } from '../event-emitter.js';
|
|
6
|
+
import { type LeaseFence } from './lease-fence.js';
|
|
6
7
|
export interface AcquireLeaseOptions {
|
|
7
8
|
taskId: string;
|
|
8
9
|
owner: string;
|
|
9
10
|
durationMs?: number;
|
|
10
11
|
runtimeKind: string;
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Everything an execution needs from an acquisition.
|
|
15
|
+
*
|
|
16
|
+
* `runId` and `leaseGeneration` are the identity the caller must carry into
|
|
17
|
+
* EVERY subsequent write (terminal state, diagnostic JSON, artifacts). They
|
|
18
|
+
* are returned here precisely so call sites never have to guess ("the latest
|
|
19
|
+
* run") or re-derive the token from a label.
|
|
20
|
+
*/
|
|
21
|
+
export interface LeaseAcquisition {
|
|
22
|
+
readonly task: TaskRecord;
|
|
23
|
+
readonly runId: string;
|
|
24
|
+
readonly leaseGeneration: number;
|
|
25
|
+
}
|
|
12
26
|
export interface LeaseManager {
|
|
13
27
|
/**
|
|
14
28
|
* Atomically acquire a lease on a task.
|
|
@@ -20,6 +34,7 @@ export interface LeaseManager {
|
|
|
20
34
|
* Side effects (same transaction):
|
|
21
35
|
* - Task status → 'leased'
|
|
22
36
|
* - lease_owner, lease_expires_at set
|
|
37
|
+
* - lease_generation incremented (the fencing token for THIS acquisition)
|
|
23
38
|
* - A new Run record is created with execution_status = 'running'
|
|
24
39
|
*
|
|
25
40
|
* @returns The updated TaskRecord
|
|
@@ -27,32 +42,26 @@ export interface LeaseManager {
|
|
|
27
42
|
* @throws PDRuntimeError with category 'lease_conflict' if task not in acquireable state
|
|
28
43
|
*/
|
|
29
44
|
acquireLease(options: AcquireLeaseOptions): Promise<TaskRecord>;
|
|
45
|
+
/**
|
|
46
|
+
* Same acquisition, returning the runId and fencing token the caller must
|
|
47
|
+
* use for every subsequent write. Production execution paths use this.
|
|
48
|
+
*/
|
|
49
|
+
acquireLeaseDetailed(options: AcquireLeaseOptions): Promise<LeaseAcquisition>;
|
|
30
50
|
/**
|
|
31
51
|
* Release a lease, returning the task to pending state.
|
|
32
52
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* - The calling owner must match the current lease_owner
|
|
36
|
-
*
|
|
37
|
-
* @returns The updated TaskRecord (status = 'pending')
|
|
38
|
-
* @throws PDRuntimeError with category 'storage_unavailable' if task not found
|
|
39
|
-
* @throws PDRuntimeError with category 'lease_conflict' if owner does not match
|
|
53
|
+
* Only the exact acquisition that holds the fence may release: owner AND
|
|
54
|
+
* generation must match, and the lease must not have expired.
|
|
40
55
|
*/
|
|
41
|
-
releaseLease(
|
|
56
|
+
releaseLease(fence: LeaseFence): Promise<TaskRecord>;
|
|
42
57
|
/**
|
|
43
58
|
* Renew (extend) the lease duration for a currently leased task.
|
|
44
59
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* - The calling owner must match the current lease_owner
|
|
49
|
-
*
|
|
50
|
-
* @param durationMs - New lease duration from now (default: 300_000 ms / 5 minutes)
|
|
51
|
-
* @returns The updated TaskRecord with new lease_expires_at
|
|
52
|
-
* @throws PDRuntimeError with category 'storage_unavailable' if task not found
|
|
53
|
-
* @throws PDRuntimeError with category 'lease_conflict' if owner/state check fails
|
|
60
|
+
* CAS: `status = leased AND owner AND generation AND not expired`. A lease
|
|
61
|
+
* that already expired can NEVER be revived by a renewal — it must be
|
|
62
|
+
* reclaimed by recovery and re-acquired (which mints a new generation).
|
|
54
63
|
*/
|
|
55
|
-
renewLease(
|
|
64
|
+
renewLease(fence: LeaseFence, durationMs?: number): Promise<TaskRecord>;
|
|
56
65
|
/**
|
|
57
66
|
* Check whether a task's lease has expired.
|
|
58
67
|
*
|
|
@@ -83,8 +92,9 @@ export declare class DefaultLeaseManager implements LeaseManager {
|
|
|
83
92
|
private readonly emitter;
|
|
84
93
|
constructor(taskStore: TaskStore, runStore: RunStore, connection: SqliteConnection, options?: LeaseManagerOptions);
|
|
85
94
|
acquireLease(options: AcquireLeaseOptions): Promise<TaskRecord>;
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
acquireLeaseDetailed(options: AcquireLeaseOptions): Promise<LeaseAcquisition>;
|
|
96
|
+
releaseLease(fence: LeaseFence): Promise<TaskRecord>;
|
|
97
|
+
renewLease(fence: LeaseFence, durationMs?: number): Promise<TaskRecord>;
|
|
88
98
|
isLeaseExpired(task: TaskRecord): boolean;
|
|
89
99
|
forceExpire(taskId: string): Promise<TaskRecord>;
|
|
90
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease-manager.d.ts","sourceRoot":"","sources":["../../../../src/runtime/store/lifecycle/lease-manager.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAgB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ol.js';
|
|
16
16
|
import { PDRuntimeError } from '../../error-categories.js';
|
|
17
17
|
import { storeEmitter } from '../event-emitter.js';
|
|
18
|
+
import { assertLeaseFenceShape, leaseFenceValues } from './lease-fence.js';
|
|
18
19
|
export class DefaultLeaseManager {
|
|
19
20
|
taskStore;
|
|
20
21
|
runStore;
|
|
@@ -28,13 +29,19 @@ export class DefaultLeaseManager {
|
|
|
28
29
|
this.emitter = options?.emitter ?? storeEmitter;
|
|
29
30
|
}
|
|
30
31
|
async acquireLease(options) {
|
|
32
|
+
return (await this.acquireLeaseDetailed(options)).task;
|
|
33
|
+
}
|
|
34
|
+
async acquireLeaseDetailed(options) {
|
|
31
35
|
const { taskId, owner, durationMs = 300_000, runtimeKind } = options;
|
|
32
36
|
if (!Value.Check(RuntimeKindSchema, runtimeKind)) {
|
|
33
37
|
throw new PDRuntimeError('input_invalid', `Invalid runtime kind: ${runtimeKind}`);
|
|
34
38
|
}
|
|
35
39
|
const db = this.connection.getDb();
|
|
40
|
+
// `.immediate()` takes the write lock up-front: the read (status /
|
|
41
|
+
// generation) and the conditional UPDATE are one serialised unit, so two
|
|
42
|
+
// connections racing for the same task cannot both observe 'pending'.
|
|
36
43
|
const tx = db.transaction(() => {
|
|
37
|
-
const row = db.prepare('SELECT task_id, status, attempt_count FROM tasks WHERE task_id = ?').get(taskId);
|
|
44
|
+
const row = db.prepare('SELECT task_id, status, attempt_count, lease_generation FROM tasks WHERE task_id = ?').get(taskId);
|
|
38
45
|
if (!row) {
|
|
39
46
|
throw new PDRuntimeError('storage_unavailable', `Task not found: ${taskId}`);
|
|
40
47
|
}
|
|
@@ -57,19 +64,27 @@ export class DefaultLeaseManager {
|
|
|
57
64
|
const lastAttemptNumber = lastRun?.attempt_number ?? 0;
|
|
58
65
|
const attemptNumber = lastAttemptNumber + 1;
|
|
59
66
|
const epochAttemptCount = Number(row.attempt_count ?? 0) + 1;
|
|
60
|
-
|
|
67
|
+
// Fencing token: strictly greater than the previous one. The DB trigger
|
|
68
|
+
// `tasks_lease_acquire_requires_generation` re-asserts this invariant for
|
|
69
|
+
// writers that bypass this manager entirely.
|
|
70
|
+
const leaseGeneration = Number(row.lease_generation ?? 0) + 1;
|
|
71
|
+
const { changes } = db.prepare(`
|
|
61
72
|
UPDATE tasks
|
|
62
|
-
SET status = 'leased', lease_owner = ?, lease_expires_at = ?, updated_at = ?,
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
SET status = 'leased', lease_owner = ?, lease_expires_at = ?, updated_at = ?,
|
|
74
|
+
attempt_count = ?, lease_generation = ?
|
|
75
|
+
WHERE task_id = ? AND status = ? AND COALESCE(lease_generation, 0) = ?
|
|
76
|
+
`).run(owner, expiresAt, nowIso, epochAttemptCount, leaseGeneration, taskId, currentStatus, Number(row.lease_generation ?? 0));
|
|
77
|
+
if (changes === 0) {
|
|
78
|
+
throw new PDRuntimeError('lease_conflict', `Task ${taskId} was acquired concurrently; this acquisition lost the race`);
|
|
79
|
+
}
|
|
65
80
|
const runId = `run_${taskId}_${attemptNumber}`;
|
|
66
81
|
db.prepare(`
|
|
67
82
|
INSERT INTO runs (run_id, task_id, runtime_kind, execution_status, started_at, attempt_number, created_at, updated_at)
|
|
68
83
|
VALUES (?, ?, ?, 'running', ?, ?, ?, ?)
|
|
69
84
|
`).run(runId, taskId, runtimeKind, nowIso, attemptNumber, nowIso, nowIso);
|
|
70
|
-
return attemptNumber;
|
|
85
|
+
return { attemptNumber, runId, leaseGeneration };
|
|
71
86
|
});
|
|
72
|
-
tx();
|
|
87
|
+
const { runId, leaseGeneration } = tx.immediate();
|
|
73
88
|
const updated = await this.taskStore.getTask(taskId);
|
|
74
89
|
if (!updated)
|
|
75
90
|
throw new PDRuntimeError('storage_unavailable', `Task not found after lease: ${taskId}`);
|
|
@@ -78,68 +93,86 @@ export class DefaultLeaseManager {
|
|
|
78
93
|
traceId: taskId,
|
|
79
94
|
timestamp: new Date().toISOString(),
|
|
80
95
|
sessionId: owner,
|
|
81
|
-
payload: {
|
|
96
|
+
payload: {
|
|
97
|
+
taskId,
|
|
98
|
+
owner,
|
|
99
|
+
durationMs,
|
|
100
|
+
runtimeKind,
|
|
101
|
+
attemptCount: updated.attemptCount,
|
|
102
|
+
leaseGeneration,
|
|
103
|
+
runId,
|
|
104
|
+
},
|
|
82
105
|
});
|
|
83
|
-
return updated;
|
|
106
|
+
return { task: updated, runId, leaseGeneration };
|
|
84
107
|
}
|
|
85
|
-
async releaseLease(
|
|
108
|
+
async releaseLease(fence) {
|
|
109
|
+
assertLeaseFenceShape(fence);
|
|
86
110
|
const db = this.connection.getDb();
|
|
111
|
+
const nowIso = new Date().toISOString();
|
|
87
112
|
db.transaction(() => {
|
|
88
|
-
const
|
|
89
|
-
if (!row) {
|
|
90
|
-
throw new PDRuntimeError('storage_unavailable', `Task not found: ${taskId}`);
|
|
91
|
-
}
|
|
92
|
-
if (String(row.lease_owner) !== owner) {
|
|
93
|
-
throw new PDRuntimeError('lease_conflict', `Task ${taskId} is not owned by ${owner}`);
|
|
94
|
-
}
|
|
95
|
-
const nowIso = new Date().toISOString();
|
|
96
|
-
db.prepare(`
|
|
113
|
+
const { changes } = db.prepare(`
|
|
97
114
|
UPDATE tasks
|
|
98
115
|
SET status = 'pending', lease_owner = NULL, lease_expires_at = NULL, updated_at = ?
|
|
99
116
|
WHERE task_id = ?
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
117
|
+
AND status = 'leased'
|
|
118
|
+
AND lease_owner = ?
|
|
119
|
+
AND lease_generation = ?
|
|
120
|
+
AND lease_expires_at IS NOT NULL
|
|
121
|
+
AND lease_expires_at >= ?
|
|
122
|
+
`).run(nowIso, fence.taskId, ...leaseFenceValues(fence, nowIso));
|
|
123
|
+
if (changes === 0) {
|
|
124
|
+
throw new PDRuntimeError('lease_conflict', `Task ${fence.taskId} is not owned by lease generation ${fence.leaseGeneration} (owner ${fence.owner})`, { taskId: fence.taskId, owner: fence.owner, leaseGeneration: fence.leaseGeneration });
|
|
125
|
+
}
|
|
126
|
+
}).immediate();
|
|
127
|
+
const updated = await this.taskStore.getTask(fence.taskId);
|
|
103
128
|
if (!updated)
|
|
104
|
-
throw new PDRuntimeError('storage_unavailable', `Task not found after release: ${taskId}`);
|
|
129
|
+
throw new PDRuntimeError('storage_unavailable', `Task not found after release: ${fence.taskId}`);
|
|
105
130
|
this.emitter.emitTelemetry({
|
|
106
131
|
eventType: 'lease_released',
|
|
107
|
-
traceId: taskId,
|
|
132
|
+
traceId: fence.taskId,
|
|
108
133
|
timestamp: new Date().toISOString(),
|
|
109
|
-
sessionId: owner,
|
|
110
|
-
payload: { taskId, owner, executionStatus: updated.status },
|
|
134
|
+
sessionId: fence.owner,
|
|
135
|
+
payload: { taskId: fence.taskId, owner: fence.owner, leaseGeneration: fence.leaseGeneration, executionStatus: updated.status },
|
|
111
136
|
});
|
|
112
137
|
return updated;
|
|
113
138
|
}
|
|
114
|
-
async renewLease(
|
|
139
|
+
async renewLease(fence, durationMs = 300_000) {
|
|
140
|
+
assertLeaseFenceShape(fence);
|
|
115
141
|
const db = this.connection.getDb();
|
|
142
|
+
const nowIso = new Date().toISOString();
|
|
143
|
+
const expiresAt = new Date(Date.now() + durationMs).toISOString();
|
|
144
|
+
// CAS. `lease_expires_at >= now` is part of the predicate: renewal extends
|
|
145
|
+
// a LIVE lease, it never resurrects an expired one. A stale worker holding
|
|
146
|
+
// generation N cannot renew after a takeover because the generation (and,
|
|
147
|
+
// after expiry, the predicate itself) no longer matches.
|
|
116
148
|
db.transaction(() => {
|
|
117
|
-
const
|
|
118
|
-
if (!row) {
|
|
119
|
-
throw new PDRuntimeError('storage_unavailable', `Task not found: ${taskId}`);
|
|
120
|
-
}
|
|
121
|
-
if (String(row.lease_owner) !== owner) {
|
|
122
|
-
throw new PDRuntimeError('lease_conflict', `Task ${taskId} is not owned by ${owner}`);
|
|
123
|
-
}
|
|
124
|
-
if (String(row.status) !== 'leased') {
|
|
125
|
-
throw new PDRuntimeError('lease_conflict', `Task ${taskId} is not leased`);
|
|
126
|
-
}
|
|
127
|
-
const nowIso = new Date().toISOString();
|
|
128
|
-
const expiresAt = new Date(Date.now() + durationMs).toISOString();
|
|
129
|
-
db.prepare(`
|
|
149
|
+
const { changes } = db.prepare(`
|
|
130
150
|
UPDATE tasks SET lease_expires_at = ?, updated_at = ?
|
|
131
151
|
WHERE task_id = ?
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
152
|
+
AND status = 'leased'
|
|
153
|
+
AND lease_owner = ?
|
|
154
|
+
AND lease_generation = ?
|
|
155
|
+
AND lease_expires_at IS NOT NULL
|
|
156
|
+
AND lease_expires_at >= ?
|
|
157
|
+
`).run(expiresAt, nowIso, fence.taskId, ...leaseFenceValues(fence, nowIso));
|
|
158
|
+
if (changes === 0) {
|
|
159
|
+
throw new PDRuntimeError('lease_conflict', `Task ${fence.taskId} cannot be renewed by lease generation ${fence.leaseGeneration} (owner ${fence.owner}): the lease was superseded or has expired`, { taskId: fence.taskId, owner: fence.owner, leaseGeneration: fence.leaseGeneration });
|
|
160
|
+
}
|
|
161
|
+
}).immediate();
|
|
162
|
+
const updated = await this.taskStore.getTask(fence.taskId);
|
|
135
163
|
if (!updated)
|
|
136
|
-
throw new PDRuntimeError('storage_unavailable', `Task not found after renew: ${taskId}`);
|
|
164
|
+
throw new PDRuntimeError('storage_unavailable', `Task not found after renew: ${fence.taskId}`);
|
|
137
165
|
this.emitter.emitTelemetry({
|
|
138
166
|
eventType: 'lease_renewed',
|
|
139
|
-
traceId: taskId,
|
|
167
|
+
traceId: fence.taskId,
|
|
140
168
|
timestamp: new Date().toISOString(),
|
|
141
|
-
sessionId: owner,
|
|
142
|
-
payload: {
|
|
169
|
+
sessionId: fence.owner,
|
|
170
|
+
payload: {
|
|
171
|
+
taskId: fence.taskId,
|
|
172
|
+
owner: fence.owner,
|
|
173
|
+
leaseGeneration: fence.leaseGeneration,
|
|
174
|
+
newExpiresAt: updated.leaseExpiresAt,
|
|
175
|
+
},
|
|
143
176
|
});
|
|
144
177
|
return updated;
|
|
145
178
|
}
|
|
@@ -150,17 +183,25 @@ export class DefaultLeaseManager {
|
|
|
150
183
|
return new Date(task.leaseExpiresAt) < new Date();
|
|
151
184
|
}
|
|
152
185
|
async forceExpire(taskId) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
186
|
+
// Recovery-only. The lease is released without minting a token: the old
|
|
187
|
+
// execution is invalidated by (a) the row no longer being `leased` and
|
|
188
|
+
// (b) the next acquisition minting a strictly greater generation.
|
|
189
|
+
const db = this.connection.getDb();
|
|
190
|
+
const nowIso = new Date().toISOString();
|
|
191
|
+
db.prepare(`
|
|
192
|
+
UPDATE tasks
|
|
193
|
+
SET status = 'pending', lease_owner = NULL, lease_expires_at = NULL, updated_at = ?
|
|
194
|
+
WHERE task_id = ?
|
|
195
|
+
`).run(nowIso, taskId);
|
|
196
|
+
const updated = await this.taskStore.getTask(taskId);
|
|
197
|
+
if (!updated)
|
|
198
|
+
throw new PDRuntimeError('storage_unavailable', `Task not found: ${taskId}`);
|
|
158
199
|
this.emitter.emitTelemetry({
|
|
159
200
|
eventType: 'lease_expired',
|
|
160
201
|
traceId: taskId,
|
|
161
202
|
timestamp: new Date().toISOString(),
|
|
162
203
|
sessionId: 'system',
|
|
163
|
-
payload: { taskId, reason: 'force_expire' },
|
|
204
|
+
payload: { taskId, reason: 'force_expire', leaseGeneration: updated.leaseGeneration },
|
|
164
205
|
});
|
|
165
206
|
return updated;
|
|
166
207
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease-manager.js","sourceRoot":"","sources":["../../../../src/runtime/store/lifecycle/lease-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B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