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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ActivationStatusRecord, PromotionReadinessResult, ActivationControlState, ActivationDecisionRecord, GlobalRuleCodePause, OwnerPromotionActor, OwnerPromotionResult } from '@principles/core/runtime';
|
|
2
|
-
import { collectRuleCodeEventEntries, type PromptInjectionTargetHost } from '@principles/host-runtime';
|
|
2
|
+
import { collectRuleCodeEventEntries, type PromptInjectionTargetHost, type DegradedEnforcementReading } from '@principles/host-runtime';
|
|
3
3
|
import type { PromptActivationInjectionStatusWire, PromptInjectionRouteSummaryWire } from '../../shared/prompt-injection-contract.js';
|
|
4
4
|
import { type GovernanceAuditWriter } from 'principles-disciple/governance-audit';
|
|
5
5
|
import type { ApprovedRuleRevisionRequest } from '../../shared/approved-rule-revision-contract.js';
|
|
@@ -70,6 +70,19 @@ export interface ActivationsResponse {
|
|
|
70
70
|
nextAction?: string;
|
|
71
71
|
/** R-A3/AC-01: route context for the per-activation injection statuses. */
|
|
72
72
|
promptInjectionRoute?: PromptInjectionRouteSummaryWire;
|
|
73
|
+
/**
|
|
74
|
+
* PRI-1210: durable degraded-enforcement marker for this workspace. The
|
|
75
|
+
* Console used to have no view of it at all. Three states: `healthy` (no
|
|
76
|
+
* marker), `degraded` (a recorded RuleHost fail-open with reason + timing),
|
|
77
|
+
* and `unknown` (marker unreadable/malformed — never rendered as healthy).
|
|
78
|
+
*
|
|
79
|
+
* Always set by `getActivations`. Optional on the interface because two
|
|
80
|
+
* other read models (`ExaminerEvidenceModel`, `RuleCandidateBindingConsoleModel`)
|
|
81
|
+
* build their own degraded fallbacks from an unavailable activations read and
|
|
82
|
+
* do not own workspace enforcement facts; those payloads render as UNKNOWN,
|
|
83
|
+
* never as healthy.
|
|
84
|
+
*/
|
|
85
|
+
enforcement?: DegradedEnforcementReading;
|
|
73
86
|
}
|
|
74
87
|
export interface RuleCodeOwnerReview {
|
|
75
88
|
activation: ActivationStatusRecord;
|
|
@@ -100,7 +113,26 @@ interface RuleCodeTelemetryWindow {
|
|
|
100
113
|
eligible: number | null;
|
|
101
114
|
matched: number | null;
|
|
102
115
|
blocked: number | null;
|
|
116
|
+
/**
|
|
117
|
+
* PRI-1211 secondary figure: RAW `rulehost_unhealthy` event rows in the
|
|
118
|
+
* window. Since PRI-1208 the writer emits at most one row per process for a
|
|
119
|
+
* persistent defect, so this number is "rows written", not "failures".
|
|
120
|
+
*/
|
|
103
121
|
unhealthy: number | null;
|
|
122
|
+
/**
|
|
123
|
+
* PRI-1211 primary figure: DISTINCT fault signatures in the window (see
|
|
124
|
+
* `countRuleHostFaultSignatures`). `null` when it cannot be derived — never
|
|
125
|
+
* folded into 0 and never conflated with the raw row count.
|
|
126
|
+
*/
|
|
127
|
+
unhealthySignatures: number | null;
|
|
128
|
+
/**
|
|
129
|
+
* Why `unhealthySignatures` is/is not available:
|
|
130
|
+
* - `ok` — every fault row carried the signature fields;
|
|
131
|
+
* - `undedupable` — at least one row lacked them, so no deduplicated figure
|
|
132
|
+
* is reported (UNKNOWN, not 0);
|
|
133
|
+
* - `unknown` — the telemetry source itself could not be read.
|
|
134
|
+
*/
|
|
135
|
+
unhealthySignatureStatus: 'ok' | 'undedupable' | 'unknown';
|
|
104
136
|
circuitTrips: number;
|
|
105
137
|
toolDistribution: Record<string, number> | null;
|
|
106
138
|
}
|
|
@@ -135,6 +167,45 @@ export interface OwnerMutationInput {
|
|
|
135
167
|
export declare const RULECODE_EVENT_LOG_CANDIDATE_DIRS: readonly string[];
|
|
136
168
|
export { collectRuleCodeEventEntries };
|
|
137
169
|
export type { CollectedRuleCodeEventEntries } from '@principles/host-runtime';
|
|
170
|
+
export interface RuleHostFaultSignatureCount {
|
|
171
|
+
/** Raw `rulehost_unhealthy` event rows in scope. */
|
|
172
|
+
rawRows: number;
|
|
173
|
+
/**
|
|
174
|
+
* Distinct fault signatures. `null` when at least one row was missing the
|
|
175
|
+
* signature fields — an incomplete dedup is reported as UNKNOWN rather than
|
|
176
|
+
* as a plausible-looking number (PRI-1211).
|
|
177
|
+
*/
|
|
178
|
+
distinctSignatures: number | null;
|
|
179
|
+
/** Rows that could not be attributed to a signature (missing fields). */
|
|
180
|
+
undedupableRows: number;
|
|
181
|
+
status: 'ok' | 'undedupable';
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* PRI-1211: count RuleHost fault SIGNATURES separately from raw event rows.
|
|
185
|
+
*
|
|
186
|
+
* The OpenClaw adapter (`openclaw-plugin/src/hooks/gate.ts`) deduplicates
|
|
187
|
+
* faults in-process on
|
|
188
|
+
* `stateDir|kind|mode|activationId|artifactId|reason`. The persisted row does
|
|
189
|
+
* NOT carry `stateDir`, `kind` (it is the event type) or `mode`, so the
|
|
190
|
+
* reader-visible signature is `activationId + artifactId + reason`:
|
|
191
|
+
* `activationId` already fixes the activation's mode, and `stateDir` is the
|
|
192
|
+
* log the rows were read from. Matching the producer key exactly is what makes
|
|
193
|
+
* "N signatures" mean the same thing on both sides.
|
|
194
|
+
*
|
|
195
|
+
* Rows written before the producer deduplicated are still dedupable here — the
|
|
196
|
+
* three fields were already required by the event schema; the count is the
|
|
197
|
+
* number of distinct defects, independent of how many rows recorded them. A
|
|
198
|
+
* row that DOES lack them cannot be deduplicated: it is counted as
|
|
199
|
+
* `undedupableRows`, and `distinctSignatures` becomes `null` (never 0).
|
|
200
|
+
*
|
|
201
|
+
* Pure function: no I/O, no mutation of the entries. The window is
|
|
202
|
+
* `[minimumTime, maximumTime]` (both inclusive) and is supplied by the caller;
|
|
203
|
+
* rows with an invalid, empty, null or future timestamp are excluded.
|
|
204
|
+
*/
|
|
205
|
+
export declare function countRuleHostFaultSignatures(entries: readonly unknown[], activationId: string, window: {
|
|
206
|
+
minimumTime: number;
|
|
207
|
+
maximumTime: number;
|
|
208
|
+
}): RuleHostFaultSignatureCount;
|
|
138
209
|
export declare class ActivationsConsoleModel {
|
|
139
210
|
private readonly workspaceDir;
|
|
140
211
|
private readonly governanceAuditWriter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SqliteConnection, SqliteActivationStateStore, SqlitePIArtifactStore, extractPrincipleId, extractEvidenceRefs, PromotionReadinessReader, RuleHostWriter, createProductionGateDeps, SqliteActivationSafetyStore, isFeatureEnabled, RuleCodeOwnerDecisionService, collectOpenClawPromotionChecks, summarizeRuleCodeShadowEvents, buildPromotionEvidenceSnapshot, createRuntimeStateHandle, PrincipleTreeLedgerAdapter, previewApprovedRuleRevision, reviseApprovedRuleOnce, } from '@principles/core/runtime';
|
|
2
2
|
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
3
|
-
import { resolvePromotionHostLiveness, resolveWorkspaceHostToolSemantics, readPromptActivationInjectionStatuses, operatorDeclaredBudgetResolution, runtimeBudgetObservationToResolution, selectConsoleRuntimeBudgetFacts, productionRouteRotationState, RUNTIME_BUDGET_OBSERVATION_STALE_REASON, RUNTIME_EVENT_LOG_CANDIDATE_DIRS, collectRuleCodeEventEntries } from '@principles/host-runtime';
|
|
3
|
+
import { resolvePromotionHostLiveness, resolveWorkspaceHostToolSemantics, readPromptActivationInjectionStatuses, operatorDeclaredBudgetResolution, runtimeBudgetObservationToResolution, selectConsoleRuntimeBudgetFacts, productionRouteRotationState, RUNTIME_BUDGET_OBSERVATION_STALE_REASON, RUNTIME_EVENT_LOG_CANDIDATE_DIRS, collectRuleCodeEventEntries, readDegradedEnforcement } from '@principles/host-runtime';
|
|
4
4
|
import { PROMPT_BUDGET_HOST_KINDS } from '@principles/core/runtime';
|
|
5
5
|
import { loadPdConfig, computeFlagsFromLoadResult } from '../config/pd-config-store.js';
|
|
6
6
|
import { errorMessage } from '../utils/response.js';
|
|
@@ -15,6 +15,23 @@ import { authorizeGovernanceAction, writeGovernanceAction, } from 'principles-di
|
|
|
15
15
|
function isRecord(value) {
|
|
16
16
|
return value !== null && value !== undefined && typeof value === 'object' && !Array.isArray(value);
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* ONE timestamp-window rule for every telemetry counter (PRI-1211 review fix).
|
|
20
|
+
*
|
|
21
|
+
* `Date.parse` returns NaN for malformed/empty timestamps, and NaN fails every
|
|
22
|
+
* comparison — so a bare `timestamp < minimumTime` check silently ADMITS
|
|
23
|
+
* invalid rows into the statistics. Future timestamps are excluded as well: a
|
|
24
|
+
* window can never contain events that have not happened at the moment it is
|
|
25
|
+
* summarized. Both bounds are inclusive.
|
|
26
|
+
*
|
|
27
|
+
* Pure: the caller supplies both bounds (no implicit clock dependency).
|
|
28
|
+
*/
|
|
29
|
+
function isTimestampInWindow(value, minimumTime, maximumTime) {
|
|
30
|
+
if (typeof value !== 'string')
|
|
31
|
+
return false;
|
|
32
|
+
const timestamp = Date.parse(value);
|
|
33
|
+
return Number.isFinite(timestamp) && timestamp >= minimumTime && timestamp <= maximumTime;
|
|
34
|
+
}
|
|
18
35
|
function isMissingTableError(err) {
|
|
19
36
|
if (!(err instanceof Error))
|
|
20
37
|
return false;
|
|
@@ -75,28 +92,79 @@ export const RULECODE_EVENT_LOG_CANDIDATE_DIRS = RUNTIME_EVENT_LOG_CANDIDATE_DIR
|
|
|
75
92
|
// the CLI promotion path cannot drift. Kept as a re-export because existing
|
|
76
93
|
// tests import it from this module.
|
|
77
94
|
export { collectRuleCodeEventEntries };
|
|
95
|
+
/**
|
|
96
|
+
* PRI-1211: count RuleHost fault SIGNATURES separately from raw event rows.
|
|
97
|
+
*
|
|
98
|
+
* The OpenClaw adapter (`openclaw-plugin/src/hooks/gate.ts`) deduplicates
|
|
99
|
+
* faults in-process on
|
|
100
|
+
* `stateDir|kind|mode|activationId|artifactId|reason`. The persisted row does
|
|
101
|
+
* NOT carry `stateDir`, `kind` (it is the event type) or `mode`, so the
|
|
102
|
+
* reader-visible signature is `activationId + artifactId + reason`:
|
|
103
|
+
* `activationId` already fixes the activation's mode, and `stateDir` is the
|
|
104
|
+
* log the rows were read from. Matching the producer key exactly is what makes
|
|
105
|
+
* "N signatures" mean the same thing on both sides.
|
|
106
|
+
*
|
|
107
|
+
* Rows written before the producer deduplicated are still dedupable here — the
|
|
108
|
+
* three fields were already required by the event schema; the count is the
|
|
109
|
+
* number of distinct defects, independent of how many rows recorded them. A
|
|
110
|
+
* row that DOES lack them cannot be deduplicated: it is counted as
|
|
111
|
+
* `undedupableRows`, and `distinctSignatures` becomes `null` (never 0).
|
|
112
|
+
*
|
|
113
|
+
* Pure function: no I/O, no mutation of the entries. The window is
|
|
114
|
+
* `[minimumTime, maximumTime]` (both inclusive) and is supplied by the caller;
|
|
115
|
+
* rows with an invalid, empty, null or future timestamp are excluded.
|
|
116
|
+
*/
|
|
117
|
+
export function countRuleHostFaultSignatures(entries, activationId, window) {
|
|
118
|
+
const signatures = new Set();
|
|
119
|
+
let rawRows = 0;
|
|
120
|
+
let undedupableRows = 0;
|
|
121
|
+
for (const entry of entries) {
|
|
122
|
+
if (!isRecord(entry) || !isTimestampInWindow(entry.ts, window.minimumTime, window.maximumTime))
|
|
123
|
+
continue;
|
|
124
|
+
if (entry.type !== 'rulehost_unhealthy' || !isRecord(entry.data) || entry.data.activationId !== activationId)
|
|
125
|
+
continue;
|
|
126
|
+
rawRows += 1;
|
|
127
|
+
const { artifactId, reason } = entry.data;
|
|
128
|
+
if (typeof artifactId !== 'string' || artifactId === '' || typeof reason !== 'string' || reason === '') {
|
|
129
|
+
undedupableRows += 1;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
signatures.add(`${artifactId}\u0000${reason}`);
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
rawRows,
|
|
136
|
+
distinctSignatures: undedupableRows > 0 ? null : signatures.size,
|
|
137
|
+
undedupableRows,
|
|
138
|
+
status: undedupableRows > 0 ? 'undedupable' : 'ok',
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* PRI-1211 known gap (deliberately NOT fixed here): `rulehost_evaluated` carries
|
|
143
|
+
* no field distinguishing "no armed rules" from "rule load failed", so these
|
|
144
|
+
* eligible/matched counts cannot assert rule-load health. Closing that gap
|
|
145
|
+
* requires adding a field at EMISSION time — a write-path change this
|
|
146
|
+
* read/display-only task is explicitly forbidden from making. Recorded here so
|
|
147
|
+
* nobody later reads the counts as proof that rules loaded.
|
|
148
|
+
*/
|
|
78
149
|
function readRuleCodeTelemetry(workspaceDir, activationId, options) {
|
|
79
150
|
const { decisions } = options;
|
|
80
|
-
const countCircuitTrips = (minimumTime) => decisions.filter(decision => decision.decision === 'safety_isolate' &&
|
|
151
|
+
const countCircuitTrips = (minimumTime, maximumTime) => decisions.filter(decision => decision.decision === 'safety_isolate' && isTimestampInWindow(decision.decidedAt, minimumTime, maximumTime)).length;
|
|
81
152
|
const now = Date.now();
|
|
82
|
-
const unavailableWindow = (minimumTime) => ({ eligible: null, matched: null, blocked: null, unhealthy: null, circuitTrips: countCircuitTrips(minimumTime), toolDistribution: null });
|
|
153
|
+
const unavailableWindow = (minimumTime, maximumTime) => ({ eligible: null, matched: null, blocked: null, unhealthy: null, unhealthySignatures: null, unhealthySignatureStatus: 'unknown', circuitTrips: countCircuitTrips(minimumTime, maximumTime), toolDistribution: null });
|
|
83
154
|
const collected = collectRuleCodeEventEntries(workspaceDir);
|
|
84
155
|
if (collected.sourceDirsFound === 0)
|
|
85
|
-
return { shadowSummary: unavailableShadowSummary(), metrics: { last24Hours: unavailableWindow(now - 24 * 60 * 60 * 1000), last7Days: unavailableWindow(now - 7 * 24 * 60 * 60 * 1000), representativeSamples: [] } };
|
|
156
|
+
return { shadowSummary: unavailableShadowSummary(), metrics: { last24Hours: unavailableWindow(now - 24 * 60 * 60 * 1000, now), last7Days: unavailableWindow(now - 7 * 24 * 60 * 60 * 1000, now), representativeSamples: [] } };
|
|
86
157
|
const { entries } = collected;
|
|
87
|
-
const summarizeWindow = (minimumTime) => {
|
|
158
|
+
const summarizeWindow = (minimumTime, maximumTime) => {
|
|
88
159
|
let eligible = 0;
|
|
89
160
|
let matched = 0;
|
|
90
161
|
let blocked = 0;
|
|
91
|
-
let unhealthy = 0;
|
|
92
162
|
const tools = {};
|
|
93
163
|
for (const entry of entries) {
|
|
94
|
-
if (!isRecord(entry) ||
|
|
164
|
+
if (!isRecord(entry) || !isTimestampInWindow(entry.ts, minimumTime, maximumTime) || !isRecord(entry.data) || entry.data.activationId !== activationId)
|
|
95
165
|
continue;
|
|
96
|
-
if (entry.type === 'rulehost_unhealthy')
|
|
97
|
-
unhealthy += 1;
|
|
166
|
+
if (entry.type === 'rulehost_unhealthy')
|
|
98
167
|
continue;
|
|
99
|
-
}
|
|
100
168
|
if (entry.type !== 'rulehost_evaluated' || entry.data.activationMode !== 'live')
|
|
101
169
|
continue;
|
|
102
170
|
eligible += 1;
|
|
@@ -107,7 +175,11 @@ function readRuleCodeTelemetry(workspaceDir, activationId, options) {
|
|
|
107
175
|
if (typeof entry.data.toolName === 'string')
|
|
108
176
|
tools[entry.data.toolName] = (tools[entry.data.toolName] ?? 0) + 1;
|
|
109
177
|
}
|
|
110
|
-
|
|
178
|
+
// PRI-1211: the raw row count and the deduplicated signature count are
|
|
179
|
+
// TWO facts. `unhealthy` keeps the historical raw-row meaning; the
|
|
180
|
+
// signature figure is additive and never replaces it.
|
|
181
|
+
const faults = countRuleHostFaultSignatures(entries, activationId, { minimumTime, maximumTime });
|
|
182
|
+
return { eligible, matched, blocked, unhealthy: faults.rawRows, unhealthySignatures: faults.distinctSignatures, unhealthySignatureStatus: faults.status, circuitTrips: countCircuitTrips(minimumTime, maximumTime), toolDistribution: tools };
|
|
111
183
|
};
|
|
112
184
|
const representativeSamples = [];
|
|
113
185
|
for (const entry of entries) {
|
|
@@ -122,7 +194,7 @@ function readRuleCodeTelemetry(workspaceDir, activationId, options) {
|
|
|
122
194
|
// only samples attributed to the workspace's resolved promotion host —
|
|
123
195
|
// another host's samples (and pre-attribution legacy rows) can never
|
|
124
196
|
// satisfy this host's readiness threshold.
|
|
125
|
-
return { shadowSummary: summarizeRuleCodeShadowEvents(entries, activationId, options.promotionHostKind), metrics: { last24Hours: summarizeWindow(now - 24 * 60 * 60 * 1000), last7Days: summarizeWindow(now - 7 * 24 * 60 * 60 * 1000), representativeSamples } };
|
|
197
|
+
return { shadowSummary: summarizeRuleCodeShadowEvents(entries, activationId, options.promotionHostKind), metrics: { last24Hours: summarizeWindow(now - 24 * 60 * 60 * 1000, now), last7Days: summarizeWindow(now - 7 * 24 * 60 * 60 * 1000, now), representativeSamples } };
|
|
126
198
|
}
|
|
127
199
|
export class ActivationsConsoleModel {
|
|
128
200
|
workspaceDir;
|
|
@@ -156,9 +228,13 @@ export class ActivationsConsoleModel {
|
|
|
156
228
|
}
|
|
157
229
|
}
|
|
158
230
|
async getActivations(targetHost) {
|
|
231
|
+
// PRI-1210: workspace-level fact, independent of the activation list — the
|
|
232
|
+
// marker is read even when state.db is missing, because "the governance
|
|
233
|
+
// store is unavailable" is exactly what produces the marker.
|
|
234
|
+
const enforcement = readDegradedEnforcement(this.workspaceDir);
|
|
159
235
|
const stateDbPath = resolveStateDbPath(this.workspaceDir);
|
|
160
236
|
if (!fs.existsSync(stateDbPath)) {
|
|
161
|
-
return { activations: [], status: 'degraded', reason: 'state.db not found — workspace may not be initialized', nextAction: 'Run pd runtime diagnostics to check workspace state' };
|
|
237
|
+
return { activations: [], status: 'degraded', reason: 'state.db not found — workspace may not be initialized', nextAction: 'Run pd runtime diagnostics to check workspace state', enforcement };
|
|
162
238
|
}
|
|
163
239
|
const conn = new SqliteConnection({ workspaceDir: this.workspaceDir, readonly: true });
|
|
164
240
|
try {
|
|
@@ -170,7 +246,7 @@ export class ActivationsConsoleModel {
|
|
|
170
246
|
}
|
|
171
247
|
catch (err) {
|
|
172
248
|
if (isMissingTableError(err)) {
|
|
173
|
-
return { activations: [], status: 'degraded', reason: 'activation table not found — workspace may not be initialized', nextAction: 'Run pd runtime internalization integrity to check schema' };
|
|
249
|
+
return { activations: [], status: 'degraded', reason: 'activation table not found — workspace may not be initialized', nextAction: 'Run pd runtime internalization integrity to check schema', enforcement };
|
|
174
250
|
}
|
|
175
251
|
throw err;
|
|
176
252
|
}
|
|
@@ -422,12 +498,14 @@ export class ActivationsConsoleModel {
|
|
|
422
498
|
reason: `${danglingArtifactIds.size} activation(s) reference non-existent artifact_id(s): ${Array.from(danglingArtifactIds).join(', ')}`,
|
|
423
499
|
nextAction: 'Run pd runtime internalization integrity to check for orphaned activations',
|
|
424
500
|
promptInjectionRoute,
|
|
501
|
+
enforcement,
|
|
425
502
|
};
|
|
426
503
|
}
|
|
427
504
|
return {
|
|
428
505
|
activations: facts,
|
|
429
506
|
status: 'ok',
|
|
430
507
|
promptInjectionRoute,
|
|
508
|
+
enforcement,
|
|
431
509
|
};
|
|
432
510
|
}
|
|
433
511
|
finally {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type AdaptiveInjectionRecord } from '@principles/host-runtime';
|
|
2
|
+
import { type AdaptiveServicePresetId } from '../config/pd-config-store.js';
|
|
3
|
+
export type AdaptiveCandidateEmptyState = 'ok' | 'zero' | 'prompt_disabled' | 'db_missing' | 'read_failed';
|
|
4
|
+
/**
|
|
5
|
+
* Evidence tri-state. `unknown` exists so a failed read can NEVER be reported
|
|
6
|
+
* as "no host call observed": UNKNOWN is not NOT_OBSERVED.
|
|
7
|
+
*
|
|
8
|
+
* - observed — at least one valid Adaptive injection fact exists;
|
|
9
|
+
* - not_observed — the logs were read successfully and contain no Adaptive fact;
|
|
10
|
+
* - unknown — the logs could not be read, or the unreadable portion is
|
|
11
|
+
* large enough that "no Adaptive fact" cannot be concluded.
|
|
12
|
+
*/
|
|
13
|
+
export type AdaptiveEvidenceStatus = 'observed' | 'not_observed' | 'unknown';
|
|
14
|
+
/** Closed set — the UI maps these codes; no raw error text or path crosses the wire. */
|
|
15
|
+
export type AdaptiveEvidenceReason = 'observed' | 'observed_partial' | 'no_adaptive_fact' | 'logs_unreadable' | 'records_unreadable';
|
|
16
|
+
export interface AdaptiveEvidenceView {
|
|
17
|
+
status: AdaptiveEvidenceStatus;
|
|
18
|
+
reason: AdaptiveEvidenceReason;
|
|
19
|
+
/** Injection-log lines that could not be parsed (bounded count, no content). */
|
|
20
|
+
parseFailures: number;
|
|
21
|
+
/** Number of injection log files read successfully — count only, never paths. */
|
|
22
|
+
logFilesRead: number;
|
|
23
|
+
}
|
|
24
|
+
export interface AdaptiveActivationView {
|
|
25
|
+
workspaceDir: string;
|
|
26
|
+
codex: {
|
|
27
|
+
/** The existing switch — `host.codex.adaptive_activation`. */
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
/** A complete `adaptiveActivation` section exists in this workspace. */
|
|
30
|
+
serviceConfigured: boolean;
|
|
31
|
+
/** Enabled AND service configured — what "已保存" means. */
|
|
32
|
+
saved: boolean;
|
|
33
|
+
};
|
|
34
|
+
service: {
|
|
35
|
+
presetId: AdaptiveServicePresetId;
|
|
36
|
+
endpoint: string;
|
|
37
|
+
model: string;
|
|
38
|
+
provider: string | null;
|
|
39
|
+
responseModels: string[];
|
|
40
|
+
/** Environment VARIABLE NAME only — never the value. */
|
|
41
|
+
apiKeyEnv: string;
|
|
42
|
+
/** Whether THIS console process sees the variable. Not proof for the hook. */
|
|
43
|
+
credentialSeenInConsoleProcess: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Non-empty = the existing configuration replaces directives instead of
|
|
47
|
+
* appending; the append-only entry must refuse to enable/rewrite service
|
|
48
|
+
* config and offer the disable path instead.
|
|
49
|
+
*/
|
|
50
|
+
replaceableActivationIds: string[];
|
|
51
|
+
appendOnlyEligible: boolean;
|
|
52
|
+
/** Other hosts sharing the same workspace-scoped service config. */
|
|
53
|
+
otherHostAaEnabled: ('openclaw' | 'workbuddy')[];
|
|
54
|
+
candidates: {
|
|
55
|
+
/** Candidates the assembly could actually draw from. */
|
|
56
|
+
validCount: number;
|
|
57
|
+
/**
|
|
58
|
+
* Any warning here blocks Adaptive selection at runtime (the assembly only
|
|
59
|
+
* runs the gap selection when `warnings.length === 0`).
|
|
60
|
+
*/
|
|
61
|
+
blockingWarnings: string[];
|
|
62
|
+
aborted: boolean;
|
|
63
|
+
emptyState: AdaptiveCandidateEmptyState;
|
|
64
|
+
};
|
|
65
|
+
lastRecord: AdaptiveInjectionRecord | null;
|
|
66
|
+
/**
|
|
67
|
+
* Tri-state evidence for the last turn. `lastRecord === null` alone says
|
|
68
|
+
* nothing — always branch on this status, never on the record's absence.
|
|
69
|
+
*/
|
|
70
|
+
evidence: AdaptiveEvidenceView;
|
|
71
|
+
}
|
|
72
|
+
/** Absolute state dir for this workspace — shared with the route layer. */
|
|
73
|
+
export declare function adaptiveActivationStateDir(workspaceDir: string): string;
|
|
74
|
+
export declare class AdaptiveActivationConsoleModel {
|
|
75
|
+
private readonly workspaceDir;
|
|
76
|
+
constructor(workspaceDir: string);
|
|
77
|
+
private stateDir;
|
|
78
|
+
getView(): Promise<AdaptiveActivationView>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adaptive Activation — Console settings read model (Codex desktop, append-only v1).
|
|
3
|
+
*
|
|
4
|
+
* Answers the three questions the Owner actually asks:
|
|
5
|
+
* 1. what is the state of THIS workspace (principles, blocking warnings);
|
|
6
|
+
* 2. what service is configured, and is it really in use by the host;
|
|
7
|
+
* 3. what happened last time (append / no gap / abstain / failure).
|
|
8
|
+
*
|
|
9
|
+
* Honesty boundary (rc-1..rc-9):
|
|
10
|
+
* - a saved configuration is NOT proof that the desktop hook ran it; only an
|
|
11
|
+
* observed injection event with an `adaptive` fact is;
|
|
12
|
+
* - the console process environment is NOT proof of the desktop hook's
|
|
13
|
+
* environment — the two are reported separately;
|
|
14
|
+
* - candidates are read through the SAME production reader the assembly uses,
|
|
15
|
+
* so "blocking" here means exactly what blocks the selection at runtime.
|
|
16
|
+
*/
|
|
17
|
+
import path from 'node:path';
|
|
18
|
+
import { readAdaptiveInjectionRecords, readPromptActivationCandidates, } from '@principles/host-runtime';
|
|
19
|
+
import { pdProviderCredentials } from '@principles/core/runtime';
|
|
20
|
+
import { loadPdConfig, ADAPTIVE_ACTIVATION_SERVICE_PRESET } from '../config/pd-config-store.js';
|
|
21
|
+
const UNKNOWN_EVIDENCE = {
|
|
22
|
+
status: 'unknown',
|
|
23
|
+
reason: 'logs_unreadable',
|
|
24
|
+
parseFailures: 0,
|
|
25
|
+
logFilesRead: 0,
|
|
26
|
+
};
|
|
27
|
+
function classifyEvidence(report) {
|
|
28
|
+
const logFilesRead = report.filesRead.length;
|
|
29
|
+
if (report.records.length > 0) {
|
|
30
|
+
// A valid fact exists. Unreadable lines still mean the picture may be
|
|
31
|
+
// incomplete, which is a warning — not a downgrade of the observation.
|
|
32
|
+
return {
|
|
33
|
+
status: 'observed',
|
|
34
|
+
reason: report.parseFailures > 0 ? 'observed_partial' : 'observed',
|
|
35
|
+
parseFailures: report.parseFailures,
|
|
36
|
+
logFilesRead,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (report.parseFailures > 0) {
|
|
40
|
+
// The unreadable portion could have contained the Adaptive fact, so the
|
|
41
|
+
// honest answer is UNKNOWN — not "no host call".
|
|
42
|
+
return { status: 'unknown', reason: 'records_unreadable', parseFailures: report.parseFailures, logFilesRead };
|
|
43
|
+
}
|
|
44
|
+
return { status: 'not_observed', reason: 'no_adaptive_fact', parseFailures: 0, logFilesRead };
|
|
45
|
+
}
|
|
46
|
+
function classifyEmptyState(candidates) {
|
|
47
|
+
if (candidates.principles.length > 0)
|
|
48
|
+
return 'ok';
|
|
49
|
+
if (candidates.aborted) {
|
|
50
|
+
if (candidates.warnings.some((warning) => warning.startsWith('prompt_feature_disabled')))
|
|
51
|
+
return 'prompt_disabled';
|
|
52
|
+
if (candidates.warnings.some((warning) => warning.startsWith('activation_db_not_found')))
|
|
53
|
+
return 'db_missing';
|
|
54
|
+
return 'read_failed';
|
|
55
|
+
}
|
|
56
|
+
if (candidates.warnings.length > 0)
|
|
57
|
+
return 'read_failed';
|
|
58
|
+
return 'zero';
|
|
59
|
+
}
|
|
60
|
+
/** Absolute state dir for this workspace — shared with the route layer. */
|
|
61
|
+
export function adaptiveActivationStateDir(workspaceDir) {
|
|
62
|
+
return path.join(workspaceDir, '.state');
|
|
63
|
+
}
|
|
64
|
+
export class AdaptiveActivationConsoleModel {
|
|
65
|
+
workspaceDir;
|
|
66
|
+
constructor(workspaceDir) {
|
|
67
|
+
this.workspaceDir = workspaceDir;
|
|
68
|
+
}
|
|
69
|
+
stateDir() {
|
|
70
|
+
return adaptiveActivationStateDir(this.workspaceDir);
|
|
71
|
+
}
|
|
72
|
+
async getView() {
|
|
73
|
+
const loaded = loadPdConfig(this.workspaceDir);
|
|
74
|
+
const config = loaded.ok ? loaded.effective.config : loaded.defaults.config;
|
|
75
|
+
const section = config.adaptiveActivation;
|
|
76
|
+
const flags = config.features;
|
|
77
|
+
const codexEnabled = flags['host.codex.adaptive_activation']?.enabled === true;
|
|
78
|
+
const serviceConfigured = section !== undefined
|
|
79
|
+
&& typeof section.endpoint === 'string' && section.endpoint.length > 0
|
|
80
|
+
&& typeof section.model === 'string' && section.model.length > 0
|
|
81
|
+
&& typeof section.apiKeyEnv === 'string' && section.apiKeyEnv.length > 0;
|
|
82
|
+
const replaceableActivationIds = section?.replaceableActivationIds ?? [];
|
|
83
|
+
const apiKeyEnv = section?.apiKeyEnv ?? ADAPTIVE_ACTIVATION_SERVICE_PRESET.apiKeyEnv;
|
|
84
|
+
let candidates;
|
|
85
|
+
try {
|
|
86
|
+
candidates = await readPromptActivationCandidates({ workspaceDir: this.workspaceDir, includeAuthority: true });
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// No error text and no path: a reader failure must not leak filesystem
|
|
90
|
+
// detail to the browser, and the Owner only needs the code + action.
|
|
91
|
+
candidates = {
|
|
92
|
+
principles: [],
|
|
93
|
+
warnings: ['activation_db_unreadable; nextAction=check_workspace_pd_state_db'],
|
|
94
|
+
aborted: false,
|
|
95
|
+
selfReportEnabled: false,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
let lastRecord = null;
|
|
99
|
+
let evidence;
|
|
100
|
+
try {
|
|
101
|
+
const report = readAdaptiveInjectionRecords({
|
|
102
|
+
stateDir: this.stateDir(),
|
|
103
|
+
workspaceDir: this.workspaceDir,
|
|
104
|
+
hostKind: 'codex',
|
|
105
|
+
limit: 1,
|
|
106
|
+
});
|
|
107
|
+
lastRecord = report.records[0] ?? null;
|
|
108
|
+
evidence = classifyEvidence(report);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// rc-9: a failed read is UNKNOWN. No error message and no path is copied
|
|
112
|
+
// into the view — the Owner sees a status code plus an action, never an
|
|
113
|
+
// internal filesystem location.
|
|
114
|
+
evidence = { ...UNKNOWN_EVIDENCE };
|
|
115
|
+
}
|
|
116
|
+
const otherHostAaEnabled = [];
|
|
117
|
+
if (flags['host.openclaw.adaptive_activation']?.enabled === true)
|
|
118
|
+
otherHostAaEnabled.push('openclaw');
|
|
119
|
+
if (flags['host.workbuddy.adaptive_activation']?.enabled === true)
|
|
120
|
+
otherHostAaEnabled.push('workbuddy');
|
|
121
|
+
return {
|
|
122
|
+
workspaceDir: this.workspaceDir,
|
|
123
|
+
codex: {
|
|
124
|
+
enabled: codexEnabled,
|
|
125
|
+
serviceConfigured,
|
|
126
|
+
saved: codexEnabled && serviceConfigured,
|
|
127
|
+
},
|
|
128
|
+
service: {
|
|
129
|
+
presetId: ADAPTIVE_ACTIVATION_SERVICE_PRESET.id,
|
|
130
|
+
endpoint: section?.endpoint ?? ADAPTIVE_ACTIVATION_SERVICE_PRESET.endpoint,
|
|
131
|
+
model: section?.model ?? ADAPTIVE_ACTIVATION_SERVICE_PRESET.model,
|
|
132
|
+
provider: section?.provider ?? null,
|
|
133
|
+
responseModels: section?.responseModels ?? [],
|
|
134
|
+
apiKeyEnv,
|
|
135
|
+
// PRI-1213: a key saved in ~/.pd/credentials.yaml is visible to this process too.
|
|
136
|
+
credentialSeenInConsoleProcess: pdProviderCredentials.resolve(apiKeyEnv).value !== null,
|
|
137
|
+
},
|
|
138
|
+
replaceableActivationIds: [...replaceableActivationIds],
|
|
139
|
+
appendOnlyEligible: replaceableActivationIds.length === 0,
|
|
140
|
+
otherHostAaEnabled,
|
|
141
|
+
candidates: {
|
|
142
|
+
validCount: candidates.principles.length,
|
|
143
|
+
blockingWarnings: [...candidates.warnings],
|
|
144
|
+
aborted: candidates.aborted,
|
|
145
|
+
emptyState: classifyEmptyState(candidates),
|
|
146
|
+
},
|
|
147
|
+
lastRecord,
|
|
148
|
+
evidence,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -50,6 +50,12 @@ export type ApproveWithActivationResult = {
|
|
|
50
50
|
} | {
|
|
51
51
|
ok: false;
|
|
52
52
|
error: 'not_found';
|
|
53
|
+
} | {
|
|
54
|
+
ok: false;
|
|
55
|
+
error: 'strategic_conflict_unconfirmed';
|
|
56
|
+
reason: string;
|
|
57
|
+
nextAction: string;
|
|
58
|
+
status?: never;
|
|
53
59
|
} | {
|
|
54
60
|
ok: false;
|
|
55
61
|
error: 'stale_review';
|
|
@@ -100,6 +106,19 @@ export type ApproveWithActivationResult = {
|
|
|
100
106
|
costChars: number;
|
|
101
107
|
}[];
|
|
102
108
|
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The submit-time precheck passed, then the material or its ledger identity
|
|
112
|
+
* moved before the approval write. Nothing was written, so this is NOT a
|
|
113
|
+
* permanent refusal: the card must be reloaded and re-judged. Kept distinct
|
|
114
|
+
* from `prompt_capacity_refused` so the Owner is never told "never approvable"
|
|
115
|
+
* for a state that merely changed.
|
|
116
|
+
*/
|
|
117
|
+
| {
|
|
118
|
+
ok: false;
|
|
119
|
+
error: 'precheck_stale';
|
|
120
|
+
reason: string;
|
|
121
|
+
nextAction: string;
|
|
103
122
|
};
|
|
104
123
|
export type ReopenApprovalResult = {
|
|
105
124
|
ok: true;
|
|
@@ -146,6 +165,15 @@ export declare class ApprovalsConsoleModel {
|
|
|
146
165
|
* confirmed; returns undefined when the write may proceed.
|
|
147
166
|
*/
|
|
148
167
|
private precheckPromptCapacity;
|
|
168
|
+
/**
|
|
169
|
+
* P1 review: the precheck measures one read snapshot, the approval write runs
|
|
170
|
+
* on another connection. Re-resolve on a fresh read snapshot immediately
|
|
171
|
+
* before the write and refuse with a DISTINCT `precheck_stale` result when
|
|
172
|
+
* the material or its ledger identity moved. This never turns a transient
|
|
173
|
+
* change into a permanent "cannot approve" verdict and never writes an
|
|
174
|
+
* approval whose measured identity/mission no longer holds.
|
|
175
|
+
*/
|
|
176
|
+
private verifyPromptPrecheckFreshness;
|
|
149
177
|
/**
|
|
150
178
|
* PRI-890 (PRI-768 v6-02): recompute the production prompt injection
|
|
151
179
|
* projection and report whether `activationId` made it into the injected
|