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
|
@@ -18,6 +18,34 @@ import { createHash } from 'node:crypto';
|
|
|
18
18
|
import * as fs from 'node:fs';
|
|
19
19
|
import * as os from 'node:os';
|
|
20
20
|
import * as path from 'node:path';
|
|
21
|
+
const UNREADABLE_MARKER_NEXT_ACTION = 'Inspect the marker file and the workspace governance store. Enforcement ran fail-open when this was recorded; the recorder never clears the marker automatically — after investigating, an Owner may delete the marker file to reset this signal.';
|
|
22
|
+
function isRecord(value) {
|
|
23
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validate the persisted record as untrusted runtime data (rc-1..rc-4).
|
|
27
|
+
* A record missing/malforming any field is NOT silently repaired: repairing it
|
|
28
|
+
* would invent evidence about an enforcement bypass.
|
|
29
|
+
*/
|
|
30
|
+
function parseDegradedEnforcementRecord(value) {
|
|
31
|
+
if (!isRecord(value))
|
|
32
|
+
return null;
|
|
33
|
+
const { workspaceDir, reason, firstSeenAt, lastSeenAt, occurrences } = value;
|
|
34
|
+
if (typeof workspaceDir !== 'string' || workspaceDir === '')
|
|
35
|
+
return null;
|
|
36
|
+
if (typeof reason !== 'string' || reason === '')
|
|
37
|
+
return null;
|
|
38
|
+
if (typeof firstSeenAt !== 'string' || !Number.isFinite(Date.parse(firstSeenAt)))
|
|
39
|
+
return null;
|
|
40
|
+
if (typeof lastSeenAt !== 'string' || !Number.isFinite(Date.parse(lastSeenAt)))
|
|
41
|
+
return null;
|
|
42
|
+
if (typeof occurrences !== 'number' || !Number.isSafeInteger(occurrences) || occurrences < 1)
|
|
43
|
+
return null;
|
|
44
|
+
return { workspaceDir, reason, firstSeenAt, lastSeenAt, occurrences };
|
|
45
|
+
}
|
|
46
|
+
function unknownReading(markerPath, unreadableReason) {
|
|
47
|
+
return { state: 'unknown', markerPath, unreadableReason, nextAction: UNREADABLE_MARKER_NEXT_ACTION };
|
|
48
|
+
}
|
|
21
49
|
function markerDir() {
|
|
22
50
|
return path.join(path.resolve(os.homedir()), '.pd', 'enforcement-health');
|
|
23
51
|
}
|
|
@@ -64,3 +92,54 @@ export function recordDegradedEnforcement(workspaceDir, reason, now = new Date()
|
|
|
64
92
|
// Observability only — the gate's fail-open decision stands regardless.
|
|
65
93
|
}
|
|
66
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Read the durable degraded-enforcement marker for one workspace (PRI-1210).
|
|
97
|
+
*
|
|
98
|
+
* - no marker file → `healthy` (the gate never fail-opened here);
|
|
99
|
+
* - valid marker file → `degraded` with the recorded reason and timing;
|
|
100
|
+
* - unreadable / malformed → `unknown` (never folded into healthy or into 0).
|
|
101
|
+
*
|
|
102
|
+
* The marker is a historical record, not a live probe: `lastSeenAt` is the most
|
|
103
|
+
* recent observed fail-open, and this reader does not prove the current state
|
|
104
|
+
* of the governance store. Read-only by contract.
|
|
105
|
+
*/
|
|
106
|
+
export function readDegradedEnforcement(workspaceDir) {
|
|
107
|
+
const markerPath = markerPathFor(workspaceDir);
|
|
108
|
+
let raw;
|
|
109
|
+
try {
|
|
110
|
+
raw = fs.readFileSync(markerPath, 'utf8');
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
// rc-5: Object.hasOwn, not `in`, on a runtime-provided error object.
|
|
114
|
+
if (isRecord(error) && Object.hasOwn(error, 'code') && error.code === 'ENOENT') {
|
|
115
|
+
return { state: 'healthy', markerPath };
|
|
116
|
+
}
|
|
117
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
118
|
+
return unknownReading(markerPath, `marker_unreadable: ${message}`.slice(0, 300));
|
|
119
|
+
}
|
|
120
|
+
let parsed;
|
|
121
|
+
try {
|
|
122
|
+
parsed = JSON.parse(raw);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return unknownReading(markerPath, 'marker_malformed_json');
|
|
126
|
+
}
|
|
127
|
+
const record = parseDegradedEnforcementRecord(parsed);
|
|
128
|
+
if (record === null)
|
|
129
|
+
return unknownReading(markerPath, 'marker_shape_invalid');
|
|
130
|
+
// rc-6 lineage consistency: the marker path is keyed by the resolved
|
|
131
|
+
// workspace string, so a record naming another workspace means the file was
|
|
132
|
+
// tampered with or copied — report unknown instead of trusting the reason.
|
|
133
|
+
if (path.resolve(record.workspaceDir) !== path.resolve(workspaceDir)) {
|
|
134
|
+
return unknownReading(markerPath, 'marker_workspace_mismatch');
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
state: 'degraded',
|
|
138
|
+
markerPath,
|
|
139
|
+
reason: record.reason,
|
|
140
|
+
firstSeenAt: record.firstSeenAt,
|
|
141
|
+
lastSeenAt: record.lastSeenAt,
|
|
142
|
+
occurrences: record.occurrences,
|
|
143
|
+
nextAction: UNREADABLE_MARKER_NEXT_ACTION,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
@@ -28,6 +28,7 @@ export * from './signal-stage2-cycle.js';
|
|
|
28
28
|
export * from './host-liveness-contract.js';
|
|
29
29
|
export * from './internalization-consumer-governance.js';
|
|
30
30
|
export * from './internalization-consumer-cycle.js';
|
|
31
|
+
export * from './adaptive-consumer-schedule.js';
|
|
31
32
|
export * from './diagnostician-auto-run.js';
|
|
32
33
|
export * from './host-tool-declaration.js';
|
|
33
34
|
export * from './host-tool-semantic-resolver.js';
|
|
@@ -45,6 +46,7 @@ export * from './workbuddy-worker-status.js';
|
|
|
45
46
|
export * from './codex-legacy-registration.js';
|
|
46
47
|
export * from './codex-transcript-locate.js';
|
|
47
48
|
export * from './intervention-evidence-ingress.js';
|
|
49
|
+
export * from './degraded-enforcement-marker.js';
|
|
48
50
|
export declare const HOST_RUNTIME_ROUTES: readonly ['before_prompt_build', 'before_tool_call', 'after_tool_call'];
|
|
49
51
|
export type HostRuntimeRoute = (typeof HOST_RUNTIME_ROUTES)[number];
|
|
50
52
|
export type HostRuntimePort = (event: HostEvent) => HostEventResult | Promise<HostEventResult>;
|
|
@@ -49,6 +49,9 @@ export * from './host-liveness-contract.js';
|
|
|
49
49
|
// auto-consumer + Companion workspace worker call the same cycle).
|
|
50
50
|
export * from './internalization-consumer-governance.js';
|
|
51
51
|
export * from './internalization-consumer-cycle.js';
|
|
52
|
+
// SPEC-PD-PIPELINE-RELIABILITY-AND-EFFICIENCY-001 §4: pure adaptive schedule
|
|
53
|
+
// policy for the existing consumer timer chain (no new background service).
|
|
54
|
+
export * from './adaptive-consumer-schedule.js';
|
|
52
55
|
export * from './diagnostician-auto-run.js';
|
|
53
56
|
// PRI-634-F R2: durable host-authored tool declaration — hosts persist, host-
|
|
54
57
|
// neutral consumers (pd-cli/pd-console) resolve through the ONE resolver.
|
|
@@ -88,6 +91,11 @@ export * from './codex-transcript-locate.js';
|
|
|
88
91
|
// entry point every host source (OpenClaw hooks, Codex pd-hook) uses to
|
|
89
92
|
// append normalized evidence. Never throws; never delays a hook.
|
|
90
93
|
export * from './intervention-evidence-ingress.js';
|
|
94
|
+
// PRI-1210: the durable degraded-enforcement marker was write-only. The reader
|
|
95
|
+
// is exported so `pd health`, `pd health --host codex` and the Console report
|
|
96
|
+
// the SAME three-state fact (healthy / degraded / unknown) instead of each
|
|
97
|
+
// re-deriving the marker path and parse rules.
|
|
98
|
+
export * from './degraded-enforcement-marker.js';
|
|
91
99
|
export const HOST_RUNTIME_ROUTES = [
|
|
92
100
|
'before_prompt_build',
|
|
93
101
|
'before_tool_call',
|
|
@@ -90,6 +90,28 @@ export interface InternalizationConsumerCycleOutcome {
|
|
|
90
90
|
readonly taskId?: string;
|
|
91
91
|
readonly taskKind?: string;
|
|
92
92
|
readonly runStatus?: 'succeeded' | 'failed' | 'retried';
|
|
93
|
+
/**
|
|
94
|
+
* SPEC-PD-PIPELINE-RELIABILITY-AND-EFFICIENCY-001 §4: the failure category of
|
|
95
|
+
* the executed task (absent on success/skip). The host scheduler uses it to
|
|
96
|
+
* distinguish a provider rate limit from ordinary work.
|
|
97
|
+
*/
|
|
98
|
+
readonly errorCategory?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Facts the adaptive scheduler needs, observed by THIS cycle. A cycle that
|
|
101
|
+
* never reached the queue snapshot (disabled flag, malformed config) reports
|
|
102
|
+
* zeros — it genuinely observed nothing.
|
|
103
|
+
*
|
|
104
|
+
* `recovered` is filled by the finally-block recovery sweep, which runs after
|
|
105
|
+
* the return value is constructed; the object is intentionally mutated before
|
|
106
|
+
* the promise settles so the caller sees the sweep result.
|
|
107
|
+
*/
|
|
108
|
+
readonly signals: InternalizationConsumerCycleSignals;
|
|
109
|
+
}
|
|
110
|
+
export interface InternalizationConsumerCycleSignals {
|
|
111
|
+
readonly readyQueueDepth: number;
|
|
112
|
+
readonly retryQueueDepth: number;
|
|
113
|
+
readonly oldestReadyAgeMs: number | null;
|
|
114
|
+
readonly recovered: number;
|
|
93
115
|
}
|
|
94
116
|
/**
|
|
95
117
|
* PRI-954 (F10) oldest-ready-stage-first ordering. Returns the configured
|
|
@@ -103,10 +125,23 @@ export declare function orderKindsByOldestReadyStage<T extends string>(runnerKin
|
|
|
103
125
|
taskKind: T;
|
|
104
126
|
createdAt?: string;
|
|
105
127
|
}[]): T[];
|
|
128
|
+
/**
|
|
129
|
+
* SPEC §4: age of the oldest ready task, or null when no row carries a usable
|
|
130
|
+
* createdAt. Unknown age must never be reported as 0 (that would make a stalled
|
|
131
|
+
* queue look fresh and suppress the overload branch).
|
|
132
|
+
*/
|
|
133
|
+
export declare function oldestReadyAgeMs(readyTasks: readonly {
|
|
134
|
+
createdAt?: string;
|
|
135
|
+
}[], nowMs: number): number | null;
|
|
106
136
|
/**
|
|
107
137
|
* Run ONE bounded consumer cycle for a workspace. At most one downstream task
|
|
108
138
|
* is leased and executed per cycle (DEFAULT_CONSUMER_MAX_TASKS_PER_CYCLE=1);
|
|
109
139
|
* backlog converges over repeated cycles and never starves reconciliation
|
|
110
140
|
* (bounded budget in the finally block).
|
|
141
|
+
*
|
|
142
|
+
* SPEC-PD-PIPELINE-RELIABILITY-AND-EFFICIENCY-001 §4: the outcome now carries
|
|
143
|
+
* the queue facts the NEXT scheduling decision needs. They are collected in a
|
|
144
|
+
* single object that the inner cycle mutates, so the recovery sweep (finally
|
|
145
|
+
* block, after the return value is built) is still visible to the caller.
|
|
111
146
|
*/
|
|
112
147
|
export declare function runInternalizationConsumerCycle(workspaceDir: string, ports: InternalizationConsumerCyclePorts): Promise<InternalizationConsumerCycleOutcome>;
|
|
@@ -70,10 +70,12 @@ async function safeRunRecoverySweep(stateManager, ports) {
|
|
|
70
70
|
}));
|
|
71
71
|
logger.info(`[PD:${logLabel}] Recovery sweep: recovered=${sweep.recovered} failed=${sweep.errors.length}`);
|
|
72
72
|
}
|
|
73
|
+
return sweep.recovered;
|
|
73
74
|
}
|
|
74
75
|
catch (sweepErr) {
|
|
75
76
|
emitEvent('INTERNALIZATION_CONSUMER_RECOVER_FAILED', String(sweepErr));
|
|
76
77
|
logger.warn(`[PD:${logLabel}] Recovery sweep failed: ${String(sweepErr)}`);
|
|
78
|
+
return 0;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
@@ -116,6 +118,26 @@ export function orderKindsByOldestReadyStage(runnerKinds, readyTasks) {
|
|
|
116
118
|
return [...runnerKinds];
|
|
117
119
|
return [...runnerKinds.slice(startIndex), ...runnerKinds.slice(0, startIndex)];
|
|
118
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* SPEC §4: age of the oldest ready task, or null when no row carries a usable
|
|
123
|
+
* createdAt. Unknown age must never be reported as 0 (that would make a stalled
|
|
124
|
+
* queue look fresh and suppress the overload branch).
|
|
125
|
+
*/
|
|
126
|
+
export function oldestReadyAgeMs(readyTasks, nowMs) {
|
|
127
|
+
let oldestMs = null;
|
|
128
|
+
for (const task of readyTasks) {
|
|
129
|
+
if (typeof task.createdAt !== 'string' || task.createdAt.length === 0)
|
|
130
|
+
continue;
|
|
131
|
+
const parsed = Date.parse(task.createdAt);
|
|
132
|
+
if (!Number.isFinite(parsed))
|
|
133
|
+
continue;
|
|
134
|
+
if (oldestMs === null || parsed < oldestMs)
|
|
135
|
+
oldestMs = parsed;
|
|
136
|
+
}
|
|
137
|
+
if (oldestMs === null)
|
|
138
|
+
return null;
|
|
139
|
+
return Math.max(0, nowMs - oldestMs);
|
|
140
|
+
}
|
|
119
141
|
async function runReconciliationBudget(workspaceDir, orchestrator, ports) {
|
|
120
142
|
const { logger, emitEvent, logLabel } = ports;
|
|
121
143
|
try {
|
|
@@ -167,8 +189,24 @@ async function runReconciliationBudget(workspaceDir, orchestrator, ports) {
|
|
|
167
189
|
* is leased and executed per cycle (DEFAULT_CONSUMER_MAX_TASKS_PER_CYCLE=1);
|
|
168
190
|
* backlog converges over repeated cycles and never starves reconciliation
|
|
169
191
|
* (bounded budget in the finally block).
|
|
192
|
+
*
|
|
193
|
+
* SPEC-PD-PIPELINE-RELIABILITY-AND-EFFICIENCY-001 §4: the outcome now carries
|
|
194
|
+
* the queue facts the NEXT scheduling decision needs. They are collected in a
|
|
195
|
+
* single object that the inner cycle mutates, so the recovery sweep (finally
|
|
196
|
+
* block, after the return value is built) is still visible to the caller.
|
|
170
197
|
*/
|
|
171
198
|
export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
199
|
+
const signals = {
|
|
200
|
+
readyQueueDepth: 0,
|
|
201
|
+
retryQueueDepth: 0,
|
|
202
|
+
oldestReadyAgeMs: null,
|
|
203
|
+
recovered: 0,
|
|
204
|
+
};
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define -- the wrapper is the public entry point; the inner cycle is declared below so the exported surface reads first
|
|
206
|
+
const outcome = await executeConsumerCycle(workspaceDir, ports, signals);
|
|
207
|
+
return { ...outcome, signals };
|
|
208
|
+
}
|
|
209
|
+
async function executeConsumerCycle(workspaceDir, ports, signals) {
|
|
172
210
|
const { logger, emitEvent, logLabel, owner } = ports;
|
|
173
211
|
const { hostToolCatalog, toolSemantics } = ports;
|
|
174
212
|
// PRI-741: artificer host semantic projection — built once from the SAME
|
|
@@ -246,6 +284,11 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
246
284
|
actionableTaskKinds: new Set(MVP_CORE_TASK_KINDS),
|
|
247
285
|
});
|
|
248
286
|
const snapshot = await readModel.getSnapshot();
|
|
287
|
+
// SPEC §4: scheduling facts come from the SAME snapshot the decision used.
|
|
288
|
+
// A malformed createdAt is skipped (unknown age never becomes "0ms old").
|
|
289
|
+
signals.readyQueueDepth = snapshot.readyTasks.length;
|
|
290
|
+
signals.retryQueueDepth = snapshot.retryWaitCount;
|
|
291
|
+
signals.oldestReadyAgeMs = oldestReadyAgeMs(snapshot.readyTasks, Date.now());
|
|
249
292
|
if (snapshot.readyTasks.length > 5) {
|
|
250
293
|
logger.warn(`[PD:${logLabel}] Backlog detected: ${snapshot.readyTasks.length} tasks ready. Processing only one task.`);
|
|
251
294
|
}
|
|
@@ -834,21 +877,12 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
834
877
|
}
|
|
835
878
|
catch (runErr) {
|
|
836
879
|
logger.error(`[PD:${logLabel}] Runner crashed for task ${taskId}: ${String(runErr)}`);
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
}
|
|
844
|
-
else {
|
|
845
|
-
await stateManager.markTaskFailed(taskId, 'execution_failed', failureReason);
|
|
846
|
-
logger.info(`[PD:${logLabel}] Marked task ${taskId} as failed.`);
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
catch (dbErr) {
|
|
850
|
-
logger.error(`[PD:${logLabel}] Failed to update state for crashed task ${taskId}: ${String(dbErr)}`);
|
|
851
|
-
}
|
|
880
|
+
// SPEC §5.3 / task-book §1.1: this layer holds no execution identity
|
|
881
|
+
// (no lease fence, no runId), so it MUST NOT write task state. A crash
|
|
882
|
+
// that happens after acquisition is resolved by the task's own lease,
|
|
883
|
+
// and an unowned/stale lease is reclaimed by the recovery sweep above —
|
|
884
|
+
// both report what happened. Writing `failed`/`retry_wait` from here
|
|
885
|
+
// was the exact "unowned terminal write" this remediation removes.
|
|
852
886
|
throw runErr;
|
|
853
887
|
}
|
|
854
888
|
if (runResult.status === 'succeeded') {
|
|
@@ -881,7 +915,7 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
881
915
|
nextAction,
|
|
882
916
|
}));
|
|
883
917
|
logger.warn(`[PD:${logLabel}] Task ${taskId} status: ${runResult.status}. Category: ${errorCategory}. Reason: ${failureReason}. Next Action: ${nextAction}`);
|
|
884
|
-
return { ran: true, taskId, taskKind, runStatus: runResult.status === 'retried' ? 'retried' : 'failed' };
|
|
918
|
+
return { ran: true, taskId, taskKind, runStatus: runResult.status === 'retried' ? 'retried' : 'failed', ...(errorCategory !== undefined ? { errorCategory } : {}) };
|
|
885
919
|
}
|
|
886
920
|
catch (err) {
|
|
887
921
|
emitEvent('INTERNALIZATION_CONSUMER_ERROR', String(err));
|
|
@@ -896,7 +930,7 @@ export async function runInternalizationConsumerCycle(workspaceDir, ports) {
|
|
|
896
930
|
// executes if the orchestrator constructor threw — enumerate every early
|
|
897
931
|
// return between resource-open and the finally steps (ERR-024).
|
|
898
932
|
if (handle) {
|
|
899
|
-
await safeRunRecoverySweep(handle.stateManager, ports);
|
|
933
|
+
signals.recovered = await safeRunRecoverySweep(handle.stateManager, ports);
|
|
900
934
|
}
|
|
901
935
|
// A (最终复核): 每周期固定小预算 — continuous backlog 下 reconciliation
|
|
902
936
|
// 不会被 ready 任务永久饿死 (公平性);游标 restart-durable。
|
|
@@ -21,6 +21,14 @@ export interface PromptDeliverabilityCandidateArtifact {
|
|
|
21
21
|
validationStatus: string;
|
|
22
22
|
/** Formal ledger identity column; identity never comes from content titles. */
|
|
23
23
|
sourcePrincipleId?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Ledger identity resolved through the artifact's candidate lineage (the same
|
|
26
|
+
* authority the activation dispatcher uses). Legacy artifacts were written
|
|
27
|
+
* before the identity column was stamped; the precheck must measure them
|
|
28
|
+
* under the identity they will actually activate as, not refuse them as if
|
|
29
|
+
* they had none.
|
|
30
|
+
*/
|
|
31
|
+
resolvedPrincipleId?: string;
|
|
24
32
|
}
|
|
25
33
|
export type PromptArtifactDeliverability = {
|
|
26
34
|
status: 'deliverable';
|
|
@@ -148,4 +156,6 @@ export declare function checkPromptArtifactDeliverabilityById(input: {
|
|
|
148
156
|
targetHost?: PromptInjectionTargetHost;
|
|
149
157
|
/** See `checkPromptArtifactDeliverability.authority` (approve-time = 'owner'). */
|
|
150
158
|
authority?: 'owner' | 'system_policy';
|
|
159
|
+
/** Ledger identity already resolved from the artifact's candidate lineage. */
|
|
160
|
+
resolvedPrincipleId?: string;
|
|
151
161
|
}): Promise<PromptArtifactDeliverability>;
|
|
@@ -24,7 +24,7 @@ export function resolvePromptCandidatePrinciple(artifact) {
|
|
|
24
24
|
artifact_kind: artifact.artifactKind,
|
|
25
25
|
content_json: artifact.contentJson,
|
|
26
26
|
validation_status: artifact.validationStatus,
|
|
27
|
-
source_principle_id: artifact.sourcePrincipleId,
|
|
27
|
+
source_principle_id: artifact.resolvedPrincipleId ?? artifact.sourcePrincipleId,
|
|
28
28
|
}, syntheticPendingActivation(artifact.artifactId));
|
|
29
29
|
}
|
|
30
30
|
function selfReportEnabledFor(workspaceDir) {
|
|
@@ -222,6 +222,9 @@ export async function checkPromptArtifactDeliverabilityById(input) {
|
|
|
222
222
|
}
|
|
223
223
|
return checkPromptArtifactDeliverability({
|
|
224
224
|
...input,
|
|
225
|
-
artifact:
|
|
225
|
+
artifact: {
|
|
226
|
+
...loaded.artifact,
|
|
227
|
+
...(input.resolvedPrincipleId !== undefined ? { resolvedPrincipleId: input.resolvedPrincipleId } : {}),
|
|
228
|
+
},
|
|
226
229
|
});
|
|
227
230
|
}
|
|
@@ -49,3 +49,37 @@ export interface InjectionEventEvidenceReport {
|
|
|
49
49
|
export declare function readInjectionEventEvidence(input: {
|
|
50
50
|
stateDir: string;
|
|
51
51
|
}): InjectionEventEvidenceReport;
|
|
52
|
+
/**
|
|
53
|
+
* One Adaptive Activation turn, as recorded on the SAME injection event that
|
|
54
|
+
* carries the final assembly. `appendedActivationId` is the assembly fact
|
|
55
|
+
* (present only when the id reached `activationIds`), never a model-selection
|
|
56
|
+
* claim; `scored` states whether a scoring request actually left the process.
|
|
57
|
+
*/
|
|
58
|
+
export interface AdaptiveInjectionRecord {
|
|
59
|
+
ts: string | null;
|
|
60
|
+
runId: string | null;
|
|
61
|
+
sessionId: string;
|
|
62
|
+
resultCode: string;
|
|
63
|
+
scored: boolean;
|
|
64
|
+
appendedActivationId: string | null;
|
|
65
|
+
activationIds: string[];
|
|
66
|
+
}
|
|
67
|
+
export interface AdaptiveInjectionRecordsReport {
|
|
68
|
+
filesRead: string[];
|
|
69
|
+
lines: number;
|
|
70
|
+
parseFailures: number;
|
|
71
|
+
/** Newest first. Absence means "no Adaptive fact was recorded", not "no append". */
|
|
72
|
+
records: AdaptiveInjectionRecord[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Read-model for the Console's "what happened last time" card. Reads only the
|
|
76
|
+
* bounded `adaptive` fact already present on injection events (ids + codes),
|
|
77
|
+
* and never re-derives it from model output. Old events without the field are
|
|
78
|
+
* simply absent — there is no back-fill and no guess (rc-9).
|
|
79
|
+
*/
|
|
80
|
+
export declare function readAdaptiveInjectionRecords(input: {
|
|
81
|
+
stateDir: string;
|
|
82
|
+
workspaceDir?: string;
|
|
83
|
+
hostKind?: 'openclaw' | 'codex' | 'workbuddy';
|
|
84
|
+
limit?: number;
|
|
85
|
+
}): AdaptiveInjectionRecordsReport;
|
|
@@ -143,3 +143,99 @@ export function readInjectionEventEvidence(input) {
|
|
|
143
143
|
note: 'absence from rows means UNKNOWN (no logs), never zero; self-report is a separate signal and is not compliance evidence; rows never merge workspaces',
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Read-model for the Console's "what happened last time" card. Reads only the
|
|
148
|
+
* bounded `adaptive` fact already present on injection events (ids + codes),
|
|
149
|
+
* and never re-derives it from model output. Old events without the field are
|
|
150
|
+
* simply absent — there is no back-fill and no guess (rc-9).
|
|
151
|
+
*/
|
|
152
|
+
export function readAdaptiveInjectionRecords(input) {
|
|
153
|
+
const logsRoot = path.resolve(input.stateDir, 'logs');
|
|
154
|
+
const filesRead = [];
|
|
155
|
+
const limit = Math.max(1, Math.min(input.limit ?? 20, 100));
|
|
156
|
+
if (!fs.existsSync(logsRoot)) {
|
|
157
|
+
return { filesRead, lines: 0, parseFailures: 0, records: [] };
|
|
158
|
+
}
|
|
159
|
+
const files = fs.readdirSync(logsRoot)
|
|
160
|
+
.filter((name) => name.startsWith('events_') && name.endsWith('.jsonl'))
|
|
161
|
+
.sort();
|
|
162
|
+
let lines = 0;
|
|
163
|
+
let parseFailures = 0;
|
|
164
|
+
const records = [];
|
|
165
|
+
for (const name of files) {
|
|
166
|
+
const filePath = path.resolve(logsRoot, name);
|
|
167
|
+
if (!filePath.startsWith(logsRoot + path.sep) || path.basename(name) !== name)
|
|
168
|
+
continue;
|
|
169
|
+
filesRead.push(filePath);
|
|
170
|
+
const raw = fs.readFileSync(filePath, 'utf8');
|
|
171
|
+
for (const line of raw.split('\n')) {
|
|
172
|
+
if (line.trim().length === 0)
|
|
173
|
+
continue;
|
|
174
|
+
lines += 1;
|
|
175
|
+
let parsed;
|
|
176
|
+
try {
|
|
177
|
+
parsed = JSON.parse(line);
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
parseFailures += 1;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
if (!isRecord(parsed)) {
|
|
184
|
+
parseFailures += 1;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (nonEmptyString(parsed.type) !== 'runtime_v2_prompt_activations_injected')
|
|
188
|
+
continue;
|
|
189
|
+
const { data } = parsed;
|
|
190
|
+
if (!isRecord(data)) {
|
|
191
|
+
parseFailures += 1;
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const { adaptive } = data;
|
|
195
|
+
// No Adaptive fact on this event = this turn did not run Adaptive (or
|
|
196
|
+
// predates it). Not a parse failure: nothing was recorded.
|
|
197
|
+
if (adaptive === undefined)
|
|
198
|
+
continue;
|
|
199
|
+
if (!isRecord(adaptive)) {
|
|
200
|
+
parseFailures += 1;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const resultCode = nonEmptyString(adaptive.resultCode);
|
|
204
|
+
const sessionId = nonEmptyString(data.sessionId) ?? nonEmptyString(parsed.sessionId);
|
|
205
|
+
const workspaceDir = nonEmptyString(data.workspaceDir);
|
|
206
|
+
const { activationIds } = data;
|
|
207
|
+
if (resultCode === undefined || sessionId === undefined || workspaceDir === undefined
|
|
208
|
+
|| typeof adaptive.scored !== 'boolean' || !Array.isArray(activationIds)
|
|
209
|
+
|| !activationIds.every((id) => typeof id === 'string')) {
|
|
210
|
+
// rc-3/rc-4: a malformed Adaptive fact is skipped loudly, never guessed.
|
|
211
|
+
parseFailures += 1;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (input.workspaceDir !== undefined && workspaceDir !== input.workspaceDir)
|
|
215
|
+
continue;
|
|
216
|
+
const rawHostKind = data.hostKind;
|
|
217
|
+
const hostKind = isPromptInjectionTargetHost(rawHostKind) ? rawHostKind : 'unknown';
|
|
218
|
+
if (input.hostKind !== undefined && hostKind !== input.hostKind)
|
|
219
|
+
continue;
|
|
220
|
+
records.push({
|
|
221
|
+
ts: nonEmptyString(parsed.ts) ?? null,
|
|
222
|
+
runId: nonEmptyString(data.runId) ?? null,
|
|
223
|
+
sessionId,
|
|
224
|
+
resultCode,
|
|
225
|
+
scored: adaptive.scored,
|
|
226
|
+
appendedActivationId: nonEmptyString(adaptive.appendedActivationId) ?? null,
|
|
227
|
+
activationIds,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
records.sort((a, b) => {
|
|
232
|
+
if (a.ts === b.ts)
|
|
233
|
+
return 0;
|
|
234
|
+
if (a.ts === null)
|
|
235
|
+
return 1;
|
|
236
|
+
if (b.ts === null)
|
|
237
|
+
return -1;
|
|
238
|
+
return a.ts < b.ts ? 1 : -1;
|
|
239
|
+
});
|
|
240
|
+
return { filesRead, lines, parseFailures, records: records.slice(0, limit) };
|
|
241
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* No second model runtime is introduced (ADR-0029: pi-ai is the only backend).
|
|
14
14
|
*/
|
|
15
15
|
import path from 'node:path';
|
|
16
|
-
import { PiAiRuntimeAdapter, RUNTIME_CONTRACT_SCHEMA_VERSION, SIGNAL_CLASSIFIER_SYSTEM_PROMPT, buildLlmPrompt, resolveLlmClassificationPayload, safeStringifyPreview, } from '@principles/core/runtime';
|
|
16
|
+
import { PiAiRuntimeAdapter, RUNTIME_CONTRACT_SCHEMA_VERSION, SIGNAL_CLASSIFIER_SYSTEM_PROMPT, buildLlmPrompt, resolveLlmClassificationPayload, pdProviderCredentials, safeStringifyPreview, } from '@principles/core/runtime';
|
|
17
17
|
import { loadPdConfigForPlugin } from './pd-config.js';
|
|
18
18
|
/**
|
|
19
19
|
* The Stage-2 structured-output contract this classifier requests. It MUST stay
|
|
@@ -153,12 +153,12 @@ export function createSignalClassifierForWorkspace(workspaceDir, options = {}) {
|
|
|
153
153
|
nextAction: `Set provider and model on runtime profile '${runtimeProfileId}'`,
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
|
-
if (
|
|
156
|
+
if (pdProviderCredentials.resolve(profile.apiKeyEnv).value === null) {
|
|
157
157
|
return {
|
|
158
158
|
ok: false,
|
|
159
159
|
readiness: 'needs_setup',
|
|
160
|
-
reason: `
|
|
161
|
-
nextAction: `
|
|
160
|
+
reason: `No API key for '${profile.apiKeyEnv}' in env or ~/.pd/credentials.yaml`,
|
|
161
|
+
nextAction: `Save an API key for '${profile.apiKeyEnv}' in the console, or set the environment variable`,
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
const resolved = {
|
|
@@ -9,22 +9,11 @@
|
|
|
9
9
|
* - the launcher's binding gate and this declaration must produce the SAME
|
|
10
10
|
* verdict for the SAME input — `mcp-binding-contract-parity.test.ts` runs
|
|
11
11
|
* the real launcher over the fixtures below and fails on any divergence;
|
|
12
|
-
* - `pd health`
|
|
13
|
-
*
|
|
14
|
-
* mirror noted below instead of importing this module at runtime.
|
|
12
|
+
* - `pd health` and the packaged installer consume this module directly, so
|
|
13
|
+
* neither can be more permissive than the launcher.
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* The packaged installer cannot import this module at runtime (it must load
|
|
19
|
-
* against the PUBLISHED install-layout, PRI-669/RF-02, and a normal PR may not
|
|
20
|
-
* raise the dependency floor), so it mirrors these rules verbatim. The two
|
|
21
|
-
* files MUST change together, in the same commit; the 33-cell parity test
|
|
22
|
-
* (`mcp-binding-shape-mirror-parity.test.ts`) pins identical verdicts. The
|
|
23
|
-
* mirror is retired by PRI-1191 once the export is published and the installer
|
|
24
|
-
* floor is raised.
|
|
25
|
-
*
|
|
26
|
-
* Adding a reason code on either side without a fixture/exemption makes that
|
|
27
|
-
* parity test red — divergence is a defect, not something to remember.
|
|
15
|
+
* Adding a reason code without a fixture/exemption makes the launcher parity
|
|
16
|
+
* test red — divergence is a defect, not something to remember.
|
|
28
17
|
*/
|
|
29
18
|
import * as path from 'node:path';
|
|
30
19
|
export const MCP_BINDING_SCHEMA_VERSION = 'pd.mcp-binding.v1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-principles-disciple",
|
|
3
|
-
"version": "1.152.
|
|
3
|
+
"version": "1.152.4",
|
|
4
4
|
"description": "Interactive CLI installer for Principles Disciple OpenClaw plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@earendil-works/pi-agent-core": "1.2.0",
|
|
65
65
|
"@earendil-works/pi-ai": "1.4.0",
|
|
66
|
-
"@principles/install-layout": "^0.8.
|
|
66
|
+
"@principles/install-layout": "^0.8.2",
|
|
67
67
|
"@sinclair/typebox": "^0.34.52",
|
|
68
68
|
"@tufjs/models": "3.0.1",
|
|
69
69
|
"@inquirer/prompts": "^8.7.2",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"pd": {
|
|
102
102
|
"bundledPluginVersion": "2.2.13"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "8ad7b7924a5edb2231486ef0ed99c2462ad78318"
|
|
105
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health-codex.d.ts","sourceRoot":"","sources":["../../src/commands/health-codex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"health-codex.d.ts","sourceRoot":"","sources":["../../src/commands/health-codex.ts"],"names":[],"mappings":"AAqDA,UAAU,kBAAkB;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAuQD,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwapF"}
|
|
@@ -29,7 +29,7 @@ import * as path from 'path';
|
|
|
29
29
|
import * as os from 'os';
|
|
30
30
|
import { createRequire } from 'module';
|
|
31
31
|
import { resolveWorkspaceDir } from '../resolve-workspace.js';
|
|
32
|
-
import { loadPdConfigForPlugin, resolveNearestPdWorkspace, readCodexIngestionConsent, deriveCodexIngestionConsentState, listGovernanceCheckpoints, readGovernanceObservationStats, readGovernanceAdmissionCounts, detectLegacyCodexHookRegistration, CODEX_INGESTION_DISCLOSURE_VERSION, } from '@principles/host-runtime';
|
|
32
|
+
import { loadPdConfigForPlugin, resolveNearestPdWorkspace, readCodexIngestionConsent, deriveCodexIngestionConsentState, listGovernanceCheckpoints, readGovernanceObservationStats, readGovernanceAdmissionCounts, detectLegacyCodexHookRegistration, CODEX_INGESTION_DISCLOSURE_VERSION, readDegradedEnforcement, } from '@principles/host-runtime';
|
|
33
33
|
import { assessCodexInstall, CODEX_INSTALL_NEXT_ACTIONS } from './health-codex-install.js';
|
|
34
34
|
import { assessMcpHealth, formatMcpHealthLines } from './health-mcp.js';
|
|
35
35
|
import { getInstallLayoutPaths, parseInstallManifest } from '@principles/install-layout';
|
|
@@ -307,6 +307,16 @@ export async function handleHealthCodex(opts = {}) {
|
|
|
307
307
|
noteReadyBlocker('worker', 'manual_action_required');
|
|
308
308
|
if (manifest.error !== undefined)
|
|
309
309
|
warnings.push(`install_manifest: ${manifest.error}`);
|
|
310
|
+
// ── Rule enforcement (durable degraded marker, PRI-1210) ───────────────────
|
|
311
|
+
// Read the workspace's own marker. A recorded fail-open means rule
|
|
312
|
+
// enforcement was bypassed for this workspace; an unreadable marker means we
|
|
313
|
+
// do not know. Both block §15 `ready` — unknown is never healthy.
|
|
314
|
+
const enforcement = readDegradedEnforcement(resolvedWorkspace);
|
|
315
|
+
if (enforcement.state !== 'healthy') {
|
|
316
|
+
noteReadyBlocker('enforcement', enforcement.state === 'unknown'
|
|
317
|
+
? `unknown (${enforcement.unreadableReason ?? 'marker unreadable'})`
|
|
318
|
+
: enforcement.reason);
|
|
319
|
+
}
|
|
310
320
|
// ── Hook trust + dual registration ─────────────────────────────────────────
|
|
311
321
|
const codexConfigDir = detectCodexConfigDir();
|
|
312
322
|
const hooksTrust = detectHooksTrust(codexConfigDir);
|
|
@@ -484,6 +494,7 @@ export async function handleHealthCodex(opts = {}) {
|
|
|
484
494
|
hooksTrust,
|
|
485
495
|
dualRegistration,
|
|
486
496
|
worker,
|
|
497
|
+
enforcement,
|
|
487
498
|
rollouts,
|
|
488
499
|
observations,
|
|
489
500
|
admissions,
|
|
@@ -559,6 +570,20 @@ export async function handleHealthCodex(opts = {}) {
|
|
|
559
570
|
if (report.dualRegistration.detected)
|
|
560
571
|
line('dualRegistration.nextAction', report.dualRegistration.nextAction ?? '');
|
|
561
572
|
line('worker.mode', `${report.worker.mode}${report.worker.reason !== undefined ? ` (${report.worker.reason})` : ''}`);
|
|
573
|
+
line('enforcement.state', report.enforcement.state);
|
|
574
|
+
line('enforcement.markerPath', report.enforcement.markerPath);
|
|
575
|
+
if (report.enforcement.reason !== undefined)
|
|
576
|
+
line('enforcement.reason', report.enforcement.reason);
|
|
577
|
+
if (report.enforcement.firstSeenAt !== undefined)
|
|
578
|
+
line('enforcement.firstSeenAt', report.enforcement.firstSeenAt);
|
|
579
|
+
if (report.enforcement.lastSeenAt !== undefined)
|
|
580
|
+
line('enforcement.lastSeenAt', report.enforcement.lastSeenAt);
|
|
581
|
+
if (report.enforcement.occurrences !== undefined)
|
|
582
|
+
line('enforcement.occurrences', String(report.enforcement.occurrences));
|
|
583
|
+
if (report.enforcement.unreadableReason !== undefined)
|
|
584
|
+
line('enforcement.unreadableReason', report.enforcement.unreadableReason);
|
|
585
|
+
if (report.enforcement.nextAction !== undefined)
|
|
586
|
+
line('enforcement.nextAction', report.enforcement.nextAction);
|
|
562
587
|
if ('checkpoints' in report.rollouts) {
|
|
563
588
|
line('rollouts', String(report.rollouts.checkpoints.length));
|
|
564
589
|
for (const checkpoint of report.rollouts.checkpoints.slice(0, 10)) {
|