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
|
@@ -163,10 +163,12 @@ export class ApprovalsConsoleModel {
|
|
|
163
163
|
// error (409) untouched by both gates.
|
|
164
164
|
let supersedeActivationId;
|
|
165
165
|
let supersedeArtifactId;
|
|
166
|
+
let precheckSnapshot;
|
|
166
167
|
if (existing.channel === 'prompt' && (existing.status === 'pending' || (existing.status === 'approved' && options?.retryActivation === true))) {
|
|
167
168
|
const precheck = await this.precheckPromptCapacity(existing.artifactId, targetHost);
|
|
168
|
-
if (precheck
|
|
169
|
+
if (precheck.ok === false)
|
|
169
170
|
return precheck;
|
|
171
|
+
precheckSnapshot = precheck.snapshot;
|
|
170
172
|
const { connection } = this.createReadContext();
|
|
171
173
|
try {
|
|
172
174
|
const piArtifactStore = new SqlitePIArtifactStore(connection);
|
|
@@ -229,6 +231,15 @@ export class ApprovalsConsoleModel {
|
|
|
229
231
|
catch { /* best-effort */ }
|
|
230
232
|
}
|
|
231
233
|
}
|
|
234
|
+
// P1 review: the precheck above measured a read snapshot; this write runs
|
|
235
|
+
// on a later connection. Re-prove the snapshot first so a lineage/ledger/
|
|
236
|
+
// artifact change in between yields the distinct `precheck_stale` result
|
|
237
|
+
// (reload and re-judge) instead of a wrong allow or a false permanent block.
|
|
238
|
+
if (precheckSnapshot !== undefined) {
|
|
239
|
+
const stale = await this.verifyPromptPrecheckFreshness(precheckSnapshot);
|
|
240
|
+
if (stale !== undefined)
|
|
241
|
+
return stale;
|
|
242
|
+
}
|
|
232
243
|
const { queue: writeQueue, connection: writeConnection } = this.createWriteContext();
|
|
233
244
|
let approvalResult;
|
|
234
245
|
try {
|
|
@@ -245,6 +256,9 @@ export class ApprovalsConsoleModel {
|
|
|
245
256
|
if (!approvalResult.ok) {
|
|
246
257
|
if (approvalResult.error === 'stale_review')
|
|
247
258
|
return approvalResult;
|
|
259
|
+
if (approvalResult.error === 'strategic_conflict_unconfirmed') {
|
|
260
|
+
return { ok: false, error: approvalResult.error, reason: approvalResult.reason, nextAction: approvalResult.nextAction };
|
|
261
|
+
}
|
|
248
262
|
if (approvalResult.error === 'already_decided') {
|
|
249
263
|
return { ok: false, error: 'already_decided', status: approvalResult.status };
|
|
250
264
|
}
|
|
@@ -335,7 +349,59 @@ export class ApprovalsConsoleModel {
|
|
|
335
349
|
*/
|
|
336
350
|
async precheckPromptCapacity(artifactId, targetHost) {
|
|
337
351
|
let deliverability;
|
|
352
|
+
let snapshot;
|
|
338
353
|
try {
|
|
354
|
+
// The capacity precheck must bill the entry under the identity it will
|
|
355
|
+
// ACTUALLY activate as. Legacy scribe artifacts predate the identity
|
|
356
|
+
// column, but their ledger principle is still reachable through the
|
|
357
|
+
// candidate lineage — the dispatcher resolves it that way. Without this,
|
|
358
|
+
// the precheck refused such artifacts as `artifact_missing_principle_id`
|
|
359
|
+
// even though activation would have succeeded.
|
|
360
|
+
let resolvedPrincipleId;
|
|
361
|
+
let identityUnresolvedReason;
|
|
362
|
+
const { connection } = this.createReadContext();
|
|
363
|
+
try {
|
|
364
|
+
const piArtifactStore = new SqlitePIArtifactStore(connection);
|
|
365
|
+
const artifact = await piArtifactStore.getArtifactById(artifactId);
|
|
366
|
+
if (artifact !== null) {
|
|
367
|
+
const resolution = await resolveLedgerPrincipleId(artifact, createArtifactPrincipleResolutionDeps(connection, piArtifactStore, this.workspaceDir));
|
|
368
|
+
if (resolution.status === 'resolved') {
|
|
369
|
+
resolvedPrincipleId = resolution.principleId;
|
|
370
|
+
snapshot = {
|
|
371
|
+
artifactId: artifact.artifactId,
|
|
372
|
+
artifactUpdatedAt: artifact.updatedAt,
|
|
373
|
+
contentJson: artifact.contentJson,
|
|
374
|
+
resolvedPrincipleId: resolution.principleId,
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
else
|
|
378
|
+
identityUnresolvedReason = resolution.reason;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
finally {
|
|
382
|
+
try {
|
|
383
|
+
connection.close();
|
|
384
|
+
}
|
|
385
|
+
catch { /* best-effort */ }
|
|
386
|
+
}
|
|
387
|
+
// The activation boundary would refuse this identity too. Refusing here
|
|
388
|
+
// keeps the approval from being written and then failing activation; the
|
|
389
|
+
// reason matches what the Owner must repair (or they reject instead).
|
|
390
|
+
if (identityUnresolvedReason !== undefined) {
|
|
391
|
+
// An unreadable ledger is a TRANSIENT failure, not missing provenance.
|
|
392
|
+
// Emitting `artifact_content_unresolved` here would tell the Owner the
|
|
393
|
+
// record can never be approved; the honest code is retry-after-repair.
|
|
394
|
+
const transientLedgerFailure = identityUnresolvedReason.includes('ledger_unavailable');
|
|
395
|
+
return {
|
|
396
|
+
ok: false,
|
|
397
|
+
error: 'prompt_capacity_refused',
|
|
398
|
+
reason: `${transientLedgerFailure ? 'authority_unreadable' : 'artifact_content_unresolved'}: ${identityUnresolvedReason}`,
|
|
399
|
+
nextAction: transientLedgerFailure
|
|
400
|
+
? 'repair the principle ledger readability, then retry the approval'
|
|
401
|
+
: 'repair this material\'s source identity or reject the approval',
|
|
402
|
+
capacity: { category: 'content_unconfirmed' },
|
|
403
|
+
};
|
|
404
|
+
}
|
|
339
405
|
deliverability = await checkPromptArtifactDeliverabilityById({
|
|
340
406
|
workspaceDir: this.workspaceDir,
|
|
341
407
|
artifactId,
|
|
@@ -345,6 +411,7 @@ export class ApprovalsConsoleModel {
|
|
|
345
411
|
// the pre-approval default (system_policy) overstated the entry by
|
|
346
412
|
// the attribute delta and could refuse a borderline-fitting entry.
|
|
347
413
|
authority: 'owner',
|
|
414
|
+
...(resolvedPrincipleId !== undefined ? { resolvedPrincipleId } : {}),
|
|
348
415
|
});
|
|
349
416
|
}
|
|
350
417
|
catch (error) {
|
|
@@ -358,15 +425,16 @@ export class ApprovalsConsoleModel {
|
|
|
358
425
|
capacity: { category: 'content_unconfirmed' },
|
|
359
426
|
};
|
|
360
427
|
}
|
|
428
|
+
const success = () => ({ ok: true, ...(snapshot !== undefined ? { snapshot } : {}) });
|
|
361
429
|
if (deliverability.status === 'deliverable')
|
|
362
|
-
return
|
|
430
|
+
return success();
|
|
363
431
|
// SPEC-PD-MODEL-AWARE-PROMPT-BUDGET-001 §6.3: model_dependent is NOT a
|
|
364
432
|
// refusal — the entry fits within the supported budget range and whether
|
|
365
433
|
// it injects depends on the runtime model. The approval proceeds; the
|
|
366
434
|
// honest uncertainty is already visible on the pre-approval badge
|
|
367
435
|
// (promptBudgetTierFit) and the activation status surface.
|
|
368
436
|
if (deliverability.status === 'model_dependent')
|
|
369
|
-
return
|
|
437
|
+
return success();
|
|
370
438
|
if (deliverability.status === 'undeliverable') {
|
|
371
439
|
return {
|
|
372
440
|
ok: false,
|
|
@@ -396,6 +464,53 @@ export class ApprovalsConsoleModel {
|
|
|
396
464
|
},
|
|
397
465
|
};
|
|
398
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* P1 review: the precheck measures one read snapshot, the approval write runs
|
|
469
|
+
* on another connection. Re-resolve on a fresh read snapshot immediately
|
|
470
|
+
* before the write and refuse with a DISTINCT `precheck_stale` result when
|
|
471
|
+
* the material or its ledger identity moved. This never turns a transient
|
|
472
|
+
* change into a permanent "cannot approve" verdict and never writes an
|
|
473
|
+
* approval whose measured identity/mission no longer holds.
|
|
474
|
+
*/
|
|
475
|
+
async verifyPromptPrecheckFreshness(snapshot) {
|
|
476
|
+
const stale = (reason, nextAction) => ({
|
|
477
|
+
ok: false,
|
|
478
|
+
error: 'precheck_stale',
|
|
479
|
+
reason,
|
|
480
|
+
nextAction,
|
|
481
|
+
});
|
|
482
|
+
const { connection } = this.createReadContext();
|
|
483
|
+
try {
|
|
484
|
+
const piArtifactStore = new SqlitePIArtifactStore(connection);
|
|
485
|
+
const artifact = await piArtifactStore.getArtifactById(snapshot.artifactId);
|
|
486
|
+
if (artifact === null) {
|
|
487
|
+
return stale('artifact_unavailable: the material disappeared after the precheck', 'reload this approval; the card will show the current availability');
|
|
488
|
+
}
|
|
489
|
+
if (artifact.updatedAt !== snapshot.artifactUpdatedAt || artifact.contentJson !== snapshot.contentJson) {
|
|
490
|
+
return stale('artifact_replaced: the material content changed after the precheck', 'reload this approval and review the new material before approving');
|
|
491
|
+
}
|
|
492
|
+
const resolution = await resolveLedgerPrincipleId(artifact, createArtifactPrincipleResolutionDeps(connection, piArtifactStore, this.workspaceDir));
|
|
493
|
+
if (resolution.status !== 'resolved') {
|
|
494
|
+
const transient = resolution.reason.includes('ledger_unavailable');
|
|
495
|
+
return stale(`${transient ? 'authority_unreadable' : 'artifact_content_unresolved'}: ${resolution.reason}`, transient
|
|
496
|
+
? 'repair the principle ledger readability, then reload and retry'
|
|
497
|
+
: 'reload this approval; its source identity no longer resolves, then reject or repair it');
|
|
498
|
+
}
|
|
499
|
+
if (snapshot.resolvedPrincipleId !== undefined && resolution.principleId !== snapshot.resolvedPrincipleId) {
|
|
500
|
+
return stale(`ledger_identity_changed: the material now resolves to ${resolution.principleId} instead of ${snapshot.resolvedPrincipleId}`, 'reload this approval and review it against the current identity before approving');
|
|
501
|
+
}
|
|
502
|
+
return undefined;
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
return stale(`precheck_freshness_unreadable: ${errorMessage(error)}`, 'check the workspace .pd/state.db readability, then reload and retry');
|
|
506
|
+
}
|
|
507
|
+
finally {
|
|
508
|
+
try {
|
|
509
|
+
connection.close();
|
|
510
|
+
}
|
|
511
|
+
catch { /* best-effort */ }
|
|
512
|
+
}
|
|
513
|
+
}
|
|
399
514
|
/**
|
|
400
515
|
* PRI-890 (PRI-768 v6-02): recompute the production prompt injection
|
|
401
516
|
* projection and report whether `activationId` made it into the injected
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { type PromptInjectionTargetHost } from '@principles/host-runtime';
|
|
2
|
+
import type { StrategicConflictView } from '@principles/core/runtime';
|
|
2
3
|
import type { PromptInjectionBudgetStatus } from '../../shared/prompt-injection-contract.js';
|
|
4
|
+
export type ApprovalApproveBlockCode = 'identity_unresolved' | 'artifact_unavailable' | 'budget_exceeded' | 'route_unconfirmed' | 'authority_unreadable' | 'content_unconfirmed'
|
|
5
|
+
/**
|
|
6
|
+
* SIA v1.2 (TECH §8.3/§8.5): a CONFIRMED strategic conflict has no effective
|
|
7
|
+
* resolution for this exact contract. Computed by the SAME server function
|
|
8
|
+
* `SqliteApprovalStore.approve()` runs, so the card can never promise an
|
|
9
|
+
* approval the write path refuses.
|
|
10
|
+
*/
|
|
11
|
+
| 'strategic_conflict_unconfirmed';
|
|
12
|
+
export interface ApprovalApproveBlock {
|
|
13
|
+
code: ApprovalApproveBlockCode;
|
|
14
|
+
/** Machine-readable server reason (technical details; not the card copy). */
|
|
15
|
+
reason: string;
|
|
16
|
+
/** The server precheck's executable next step. */
|
|
17
|
+
nextAction: string;
|
|
18
|
+
}
|
|
3
19
|
export interface ApprovalGroup {
|
|
4
20
|
principleId: string;
|
|
5
21
|
principleTitle: string;
|
|
@@ -50,12 +66,34 @@ export interface ApprovalGroup {
|
|
|
50
66
|
artifactId: string;
|
|
51
67
|
channel: string;
|
|
52
68
|
createdAt: string;
|
|
69
|
+
/**
|
|
70
|
+
* Why THIS record cannot be approved from the review card right now. The
|
|
71
|
+
* server's approve precheck refuses the same conditions, so the card must
|
|
72
|
+
* not offer a button whose only outcome is a failure. Absent when approval
|
|
73
|
+
* is available. Computed per artifact: a group can hold several pending
|
|
74
|
+
* records, and a block proved for one of them must never fence its
|
|
75
|
+
* siblings. Rejecting stays legal — that is the Owner's exit for a record
|
|
76
|
+
* that can never be approved (the history is kept, not hidden).
|
|
77
|
+
*/
|
|
78
|
+
approveBlock?: ApprovalApproveBlock;
|
|
53
79
|
/**
|
|
54
80
|
* This record's own revision review is incomplete (the group flag also
|
|
55
81
|
* covers the multi-pending ambiguity, so readers must not use it to block
|
|
56
82
|
* an intact sibling approval).
|
|
57
83
|
*/
|
|
58
84
|
revisionReviewUnavailable?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* SIA v1.2: the strategic assessment carried by THIS record's V2 contract
|
|
87
|
+
* (relevance / conflictStatus / conflict targets) plus whether a confirmed
|
|
88
|
+
* conflict is effectively resolved. Absent for V1 artifacts. Read-only
|
|
89
|
+
* projection of the same predicate the approval write path enforces.
|
|
90
|
+
*
|
|
91
|
+
* REVIEW FIX (PR #2652 P1-5): the verdict is per-approval, never per-group.
|
|
92
|
+
* Two pending artifacts in one candidate group can have different conflict
|
|
93
|
+
* states; a group-level copy fenced the sibling with the first artifact's
|
|
94
|
+
* verdict.
|
|
95
|
+
*/
|
|
96
|
+
strategicConflict?: StrategicConflictView;
|
|
59
97
|
}[];
|
|
60
98
|
}
|
|
61
99
|
export interface ApprovalsGroupedResponse {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { SqliteConnection, SqliteApprovalQueueStore, SqlitePIArtifactStore, ApprovalQueue, RUNTIME_PRINCIPLE_BUDGET, detectPromptReplacementTarget, computeArtifactDigest, SqliteActivationStateStore, } from '@principles/core/runtime';
|
|
1
|
+
import { SqliteConnection, SqliteApprovalQueueStore, SqlitePIArtifactStore, ApprovalQueue, RUNTIME_PRINCIPLE_BUDGET, detectPromptReplacementTarget, computeArtifactDigest, SqliteActivationStateStore, readStrategicConflictView, } from '@principles/core/runtime';
|
|
2
2
|
import { resolveStateDbPath } from '@principles/core/runtime/storage-paths';
|
|
3
3
|
import { checkPromptArtifactDeliverability, hostRotationCapability, operatorDeclaredBudgetResolution, resolveLivePromptInjectionProjection, RUNTIME_BUDGET_OBSERVATION_STALE_REASON, runtimeBudgetObservationToResolution, selectConsoleRuntimeBudgetFacts, } from '@principles/host-runtime';
|
|
4
4
|
import { PROMPT_BUDGET_HOST_KINDS } from '@principles/core/runtime';
|
|
5
5
|
import { loadLedger } from '@principles/core/principle-tree-ledger';
|
|
6
6
|
import { loadPdConfig } from '../config/pd-config-store.js';
|
|
7
7
|
import { errorMessage } from '../utils/response.js';
|
|
8
|
-
import { createArtifactPrincipleResolutionDeps,
|
|
8
|
+
import { createArtifactPrincipleResolutionDeps, } from './artifact-principle-resolver.js';
|
|
9
|
+
import { resolveLedgerPrincipleId } from './principle-id-resolution.js';
|
|
9
10
|
import * as fs from 'node:fs';
|
|
10
11
|
import * as path from 'node:path';
|
|
11
12
|
/** Type guard: non-null object (not array). Replaces `as Record<string, unknown>` assertions. */
|
|
@@ -122,45 +123,121 @@ function extractCandidateDescription(contentJson) {
|
|
|
122
123
|
* conservative answer when the precheck itself fails — an unknown size must
|
|
123
124
|
* never become a rotation promise (rc-9).
|
|
124
125
|
*/
|
|
125
|
-
|
|
126
|
+
/**
|
|
127
|
+
* Map the precheck's honest verdict onto the review card's "cannot approve"
|
|
128
|
+
* signal. `deliverable` and `model_dependent` are approvable; everything else
|
|
129
|
+
* is refused by the approve precheck, so the card must not offer the action.
|
|
130
|
+
* The code only selects owner-facing copy — the raw reason and nextAction ride
|
|
131
|
+
* along for the technical-details layer.
|
|
132
|
+
*/
|
|
133
|
+
function approveBlockFromDeliverability(deliverability) {
|
|
134
|
+
if (deliverability.status === 'deliverable' || deliverability.status === 'model_dependent')
|
|
135
|
+
return undefined;
|
|
136
|
+
if (deliverability.status === 'undeliverable') {
|
|
137
|
+
return { code: 'budget_exceeded', reason: deliverability.reason, nextAction: deliverability.nextAction };
|
|
138
|
+
}
|
|
139
|
+
const { reason } = deliverability;
|
|
140
|
+
if (deliverability.perHost && deliverability.perHost.length > 0
|
|
141
|
+
&& deliverability.perHost.every((entry) => entry.tierFit === 'exceeds_max_tier')) {
|
|
142
|
+
return { code: 'budget_exceeded', reason, nextAction: deliverability.nextAction };
|
|
143
|
+
}
|
|
144
|
+
if (reason.startsWith('route_unconfirmed')) {
|
|
145
|
+
return { code: 'route_unconfirmed', reason, nextAction: deliverability.nextAction };
|
|
146
|
+
}
|
|
147
|
+
if (reason.includes('artifact_unavailable')) {
|
|
148
|
+
return { code: 'artifact_unavailable', reason, nextAction: deliverability.nextAction };
|
|
149
|
+
}
|
|
150
|
+
// A readable-store / unreadable-ledger failure is TRANSIENT: the identity may
|
|
151
|
+
// resolve after repair. Telling the Owner "this can never be approved" would
|
|
152
|
+
// be false and would push them to reject real history.
|
|
153
|
+
if (reason.includes('ledger_unavailable')) {
|
|
154
|
+
return { code: 'authority_unreadable', reason, nextAction: deliverability.nextAction };
|
|
155
|
+
}
|
|
156
|
+
if (reason.includes('artifact_missing_principle_id') || reason.includes('artifact_content_unresolved')) {
|
|
157
|
+
return { code: 'identity_unresolved', reason, nextAction: deliverability.nextAction };
|
|
158
|
+
}
|
|
159
|
+
if (reason.includes('authority') || reason.includes('read_failed')) {
|
|
160
|
+
return { code: 'authority_unreadable', reason, nextAction: deliverability.nextAction };
|
|
161
|
+
}
|
|
162
|
+
return { code: 'content_unconfirmed', reason, nextAction: deliverability.nextAction };
|
|
163
|
+
}
|
|
164
|
+
async function candidatePromptBudgetForecast(input) {
|
|
165
|
+
const { workspaceDir, artifact, resolvedPrincipleId, identityUnresolvedReason, targetHost } = input;
|
|
126
166
|
const deliverability = await checkPromptArtifactDeliverability({
|
|
127
167
|
workspaceDir,
|
|
128
168
|
targetHost,
|
|
169
|
+
// The review card's approve button runs the owner-authority precheck, so
|
|
170
|
+
// the forecast must measure the SAME post-approval entry. Measuring the
|
|
171
|
+
// pre-decision default here could promise an approval gate that then
|
|
172
|
+
// refuses (or vice versa) at the boundary.
|
|
173
|
+
authority: 'owner',
|
|
129
174
|
artifact: artifact
|
|
130
175
|
? {
|
|
131
176
|
artifactId: artifact.artifactId,
|
|
132
177
|
artifactKind: artifact.artifactKind,
|
|
133
178
|
contentJson: artifact.contentJson,
|
|
134
179
|
validationStatus: artifact.validationStatus,
|
|
180
|
+
...(artifact.sourcePrincipleId !== null ? { sourcePrincipleId: artifact.sourcePrincipleId } : {}),
|
|
181
|
+
// Legacy scribe artifacts were written before the identity column was
|
|
182
|
+
// stamped. Their real identity is the ledger principle reachable
|
|
183
|
+
// through the candidate lineage — the same authority the activation
|
|
184
|
+
// dispatcher uses. Passing it keeps this precheck from refusing a
|
|
185
|
+
// record that would activate successfully.
|
|
186
|
+
...(resolvedPrincipleId !== null ? { resolvedPrincipleId } : {}),
|
|
135
187
|
}
|
|
136
188
|
: null,
|
|
137
189
|
});
|
|
138
|
-
if (deliverability.status === 'deliverable')
|
|
139
|
-
return 'fits_all_tiers';
|
|
140
|
-
if (deliverability.status === 'model_dependent')
|
|
141
|
-
return 'model_dependent';
|
|
142
|
-
if (deliverability.status === 'undeliverable')
|
|
143
|
-
return 'exceeds_max_tier';
|
|
144
190
|
// Route/artifact unconfirmed: aggregate the per-host tier verdicts
|
|
145
191
|
// MONOTONICALLY. The list route bills ~700 fewer chars than the shared
|
|
146
192
|
// route for the same entry (fixed wrapper delta), so "shared exceeds but
|
|
147
|
-
// list does not" is REACHABLE
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
193
|
+
// list does not" is REACHABLE. Collapsing that to exceeds_max_tier would
|
|
194
|
+
// tell an OpenClaw owner their entry can never inject when a large-window
|
|
195
|
+
// list-route host could carry it. Only when EVERY applicable host exceeds
|
|
196
|
+
// is "oversized everywhere" true; any disagreement leaves the honest
|
|
197
|
+
// model_dependent. Without per-host facts, do not promise at all.
|
|
198
|
+
const tierFit = deliverability.status === 'deliverable'
|
|
199
|
+
? 'fits_all_tiers'
|
|
200
|
+
: deliverability.status === 'model_dependent'
|
|
201
|
+
? 'model_dependent'
|
|
202
|
+
: deliverability.status === 'undeliverable'
|
|
203
|
+
? 'exceeds_max_tier'
|
|
204
|
+
: (deliverability.perHost && deliverability.perHost.length > 0
|
|
205
|
+
? (deliverability.perHost.every((entry) => entry.tierFit === 'exceeds_max_tier')
|
|
206
|
+
? 'exceeds_max_tier'
|
|
207
|
+
: deliverability.perHost.every((entry) => entry.tierFit === 'fits_all_tiers')
|
|
208
|
+
? 'fits_all_tiers'
|
|
209
|
+
: 'model_dependent')
|
|
210
|
+
: 'unconfirmed');
|
|
211
|
+
const block = approveBlockFromDeliverability(deliverability);
|
|
212
|
+
// A prompt approval is only executable when the activation boundary can
|
|
213
|
+
// name its ledger principle. `resolvedPrincipleId === null` means the direct
|
|
214
|
+
// column already failed ledger membership AND the candidate lineage is
|
|
215
|
+
// unresolved, so activation would refuse even if the deliverability precheck
|
|
216
|
+
// accepted the stale column. Surface the identity failure as the block.
|
|
217
|
+
if (artifact !== null && resolvedPrincipleId === null) {
|
|
218
|
+
// An UNREADABLE ledger is not data drift: the identity may resolve after
|
|
219
|
+
// the ledger is repaired, so the honest verdict is "refresh later", not the
|
|
220
|
+
// permanent "never approvable" copy reserved for genuinely unlinked rows.
|
|
221
|
+
if (identityUnresolvedReason?.includes('ledger_unavailable') === true) {
|
|
222
|
+
return {
|
|
223
|
+
tierFit,
|
|
224
|
+
block: {
|
|
225
|
+
code: 'authority_unreadable',
|
|
226
|
+
reason: identityUnresolvedReason,
|
|
227
|
+
nextAction: 'repair the principle ledger readability, then reload this page',
|
|
228
|
+
},
|
|
229
|
+
};
|
|
160
230
|
}
|
|
161
|
-
return
|
|
231
|
+
return {
|
|
232
|
+
tierFit,
|
|
233
|
+
block: {
|
|
234
|
+
code: 'identity_unresolved',
|
|
235
|
+
reason: identityUnresolvedReason ?? 'artifact has no ledger-valid identity (direct column not in ledger, candidate lineage unresolved)',
|
|
236
|
+
nextAction: 'repair this material\'s source identity or reject the approval',
|
|
237
|
+
},
|
|
238
|
+
};
|
|
162
239
|
}
|
|
163
|
-
return
|
|
240
|
+
return { tierFit, ...(block !== undefined ? { block } : {}) };
|
|
164
241
|
}
|
|
165
242
|
export class ApprovalsGroupedConsoleModel {
|
|
166
243
|
workspaceDir;
|
|
@@ -201,19 +278,28 @@ export class ApprovalsGroupedConsoleModel {
|
|
|
201
278
|
// the pre-approval badge never promises rotation for an entry that is
|
|
202
279
|
// oversized (rotation cannot rescue a per-entry overflow).
|
|
203
280
|
const artifactFitsBudgetMap = new Map();
|
|
281
|
+
const artifactApproveBlockMap = new Map();
|
|
204
282
|
const revisionReviewUnavailable = new Set();
|
|
205
283
|
const revisionReviews = new Map();
|
|
206
284
|
// PRI-940: which approval artifacts are MISSING from the store (superseded
|
|
207
285
|
// or pruned) — those cards have no contentJson, so the UI must degrade
|
|
208
286
|
// visibly instead of rendering the `unlinked:` machine id as a title.
|
|
209
287
|
const artifactUnavailableMap = new Map();
|
|
288
|
+
// SIA v1.2: per-artifact strategic assessment computed read-only with the
|
|
289
|
+
// SAME server predicate the approval write path enforces (TECH §8.5).
|
|
290
|
+
const artifactStrategicMap = new Map();
|
|
210
291
|
const stateDir = path.join(this.workspaceDir, '.state');
|
|
211
292
|
const resolutionDeps = createArtifactPrincipleResolutionDeps(conn, artifactStore, this.workspaceDir);
|
|
212
293
|
for (const approval of allApprovals) {
|
|
213
294
|
if (!artifactPrincipleMap.has(approval.artifactId)) {
|
|
214
295
|
try {
|
|
215
296
|
const artifact = await artifactStore.getArtifactById(approval.artifactId);
|
|
216
|
-
|
|
297
|
+
// Keep the resolution STATUS, not just the id: an unreadable ledger
|
|
298
|
+
// and a genuinely unlinked artifact have the same null id but must
|
|
299
|
+
// not share the same Owner-facing verdict.
|
|
300
|
+
const resolution = artifact ? await resolveLedgerPrincipleId(artifact, resolutionDeps) : null;
|
|
301
|
+
const mappedId = resolution?.status === 'resolved' ? resolution.principleId : null;
|
|
302
|
+
const identityUnresolvedReason = resolution?.status === 'unresolved' ? resolution.reason : undefined;
|
|
217
303
|
artifactPrincipleMap.set(approval.artifactId, mappedId);
|
|
218
304
|
if (artifact?.contentJson) {
|
|
219
305
|
artifactDescriptionMap.set(approval.artifactId, extractCandidateDescription(artifact.contentJson));
|
|
@@ -221,6 +307,14 @@ export class ApprovalsGroupedConsoleModel {
|
|
|
221
307
|
else {
|
|
222
308
|
artifactDescriptionMap.set(approval.artifactId, null);
|
|
223
309
|
}
|
|
310
|
+
if (artifact !== null) {
|
|
311
|
+
artifactStrategicMap.set(approval.artifactId, readStrategicConflictView({
|
|
312
|
+
db: conn.getDb(),
|
|
313
|
+
artifactId: artifact.artifactId,
|
|
314
|
+
contentJson: artifact.contentJson,
|
|
315
|
+
artifactDigest: computeArtifactDigest(artifact),
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
224
318
|
if (artifact?.artifactKind === 'principle' && approval.channel === 'prompt' && approval.status === 'pending') {
|
|
225
319
|
const detection = await detectPromptReplacementTarget({
|
|
226
320
|
approvalArtifactId: artifact.artifactId,
|
|
@@ -253,7 +347,16 @@ export class ApprovalsGroupedConsoleModel {
|
|
|
253
347
|
if (!detection.ok || (detection.target !== null && !revisionReviews.has(artifact.artifactId)))
|
|
254
348
|
revisionReviewUnavailable.add(artifact.artifactId);
|
|
255
349
|
}
|
|
256
|
-
|
|
350
|
+
const forecast = await candidatePromptBudgetForecast({
|
|
351
|
+
workspaceDir: this.workspaceDir,
|
|
352
|
+
artifact,
|
|
353
|
+
resolvedPrincipleId: mappedId,
|
|
354
|
+
...(identityUnresolvedReason !== undefined ? { identityUnresolvedReason } : {}),
|
|
355
|
+
targetHost,
|
|
356
|
+
});
|
|
357
|
+
artifactFitsBudgetMap.set(approval.artifactId, forecast.tierFit);
|
|
358
|
+
if (forecast.block !== undefined)
|
|
359
|
+
artifactApproveBlockMap.set(approval.artifactId, forecast.block);
|
|
257
360
|
artifactUnavailableMap.set(approval.artifactId, artifact === null);
|
|
258
361
|
}
|
|
259
362
|
catch (err) {
|
|
@@ -261,6 +364,11 @@ export class ApprovalsGroupedConsoleModel {
|
|
|
261
364
|
artifactPrincipleMap.set(approval.artifactId, null);
|
|
262
365
|
artifactDescriptionMap.set(approval.artifactId, null);
|
|
263
366
|
artifactFitsBudgetMap.set(approval.artifactId, 'unconfirmed');
|
|
367
|
+
artifactApproveBlockMap.set(approval.artifactId, {
|
|
368
|
+
code: 'artifact_unavailable',
|
|
369
|
+
reason: 'approval_artifact_store_unreadable',
|
|
370
|
+
nextAction: 'check the workspace .pd/state.db readability, then reload',
|
|
371
|
+
});
|
|
264
372
|
artifactUnavailableMap.set(approval.artifactId, true);
|
|
265
373
|
}
|
|
266
374
|
else {
|
|
@@ -291,6 +399,28 @@ export class ApprovalsGroupedConsoleModel {
|
|
|
291
399
|
const records = groupMap.get(principleId);
|
|
292
400
|
if (!records)
|
|
293
401
|
continue;
|
|
402
|
+
// Only a pending PROMPT record uses the prompt precheck; a rule or
|
|
403
|
+
// archive record is not gated by prompt deliverability. Approved /
|
|
404
|
+
// rejected records are history and must not be retro-labelled.
|
|
405
|
+
// The verdict is attached to the RECORD that was measured: a sibling
|
|
406
|
+
// pending record in the same group must not inherit this fence.
|
|
407
|
+
// SIA v1.2: a confirmed-but-unresolved strategic conflict blocks ANY
|
|
408
|
+
// channel — the server refuses the write on every approval channel.
|
|
409
|
+
// REVIEW FIX (PR #2652 P1-5): this verdict belongs to THIS approval's
|
|
410
|
+
// artifact; a sibling pending record must never inherit it.
|
|
411
|
+
const recordStrategic = artifactStrategicMap.get(approval.artifactId);
|
|
412
|
+
const strategicView = approval.status === 'pending' ? recordStrategic : undefined;
|
|
413
|
+
const strategicBlock = strategicView !== undefined && !strategicView.resolved
|
|
414
|
+
? {
|
|
415
|
+
code: 'strategic_conflict_unconfirmed',
|
|
416
|
+
reason: strategicView.reason ?? 'no_effective_resolution',
|
|
417
|
+
nextAction: strategicView.nextAction ?? 'resolve the confirmed strategic conflict for this contract, then approve again',
|
|
418
|
+
}
|
|
419
|
+
: undefined;
|
|
420
|
+
const promptBlock = approval.status === 'pending' && approval.channel === 'prompt'
|
|
421
|
+
? artifactApproveBlockMap.get(approval.artifactId)
|
|
422
|
+
: undefined;
|
|
423
|
+
const recordApproveBlock = strategicBlock ?? promptBlock;
|
|
294
424
|
records.push({
|
|
295
425
|
id: approval.approvalId,
|
|
296
426
|
artifactId: approval.artifactId,
|
|
@@ -299,6 +429,8 @@ export class ApprovalsGroupedConsoleModel {
|
|
|
299
429
|
status: approval.status === 'approved' || approval.status === 'rejected'
|
|
300
430
|
? approval.status
|
|
301
431
|
: 'pending',
|
|
432
|
+
...(recordApproveBlock !== undefined ? { approveBlock: recordApproveBlock } : {}),
|
|
433
|
+
...(recordStrategic !== undefined ? { strategicConflict: recordStrategic } : {}),
|
|
302
434
|
...(revisionReviewUnavailable.has(approval.artifactId) ? { revisionReviewUnavailable: true } : {}),
|
|
303
435
|
});
|
|
304
436
|
}
|
|
@@ -23,6 +23,11 @@ export type IntentDecisionRecordResultModel = {
|
|
|
23
23
|
ok: true;
|
|
24
24
|
record: IntentDecisionRecord;
|
|
25
25
|
created: boolean;
|
|
26
|
+
conflict?: {
|
|
27
|
+
reason: string;
|
|
28
|
+
message: string;
|
|
29
|
+
nextAction: string;
|
|
30
|
+
};
|
|
26
31
|
} | {
|
|
27
32
|
ok: false;
|
|
28
33
|
reason: string;
|
|
@@ -43,7 +48,7 @@ export type FollowUpDispatchResultModel = {
|
|
|
43
48
|
record: IntentDecisionRecord;
|
|
44
49
|
} | {
|
|
45
50
|
ok: false;
|
|
46
|
-
reason: 'decision_not_found' | 'state_db_not_found' | 'intent_decisions_table_missing';
|
|
51
|
+
reason: 'decision_not_found' | 'candidate_already_bound' | 'state_db_not_found' | 'intent_decisions_table_missing';
|
|
47
52
|
nextAction: string;
|
|
48
53
|
};
|
|
49
54
|
export declare class IntentDecisionModel {
|
|
@@ -59,7 +59,9 @@ export class IntentDecisionModel {
|
|
|
59
59
|
try {
|
|
60
60
|
const store = new SqliteIntentDecisionStore(connection);
|
|
61
61
|
const result = await store.record(input);
|
|
62
|
-
return
|
|
62
|
+
return result.conflict === undefined
|
|
63
|
+
? { ok: true, record: result.record, created: result.created }
|
|
64
|
+
: { ok: true, record: result.record, created: result.created, conflict: result.conflict };
|
|
63
65
|
}
|
|
64
66
|
catch (err) {
|
|
65
67
|
if (isMissingTableError(err)) {
|
|
@@ -177,15 +179,21 @@ export class IntentDecisionModel {
|
|
|
177
179
|
const connection = new SqliteConnection({ workspaceDir: this.workspaceDir });
|
|
178
180
|
try {
|
|
179
181
|
const store = new SqliteIntentDecisionStore(connection);
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
182
|
+
const result = await store.updateFollowUp(id, patch);
|
|
183
|
+
if (!result.ok) {
|
|
184
|
+
return result.reason === 'candidate_already_bound'
|
|
185
|
+
? {
|
|
186
|
+
ok: false,
|
|
187
|
+
reason: 'candidate_already_bound',
|
|
188
|
+
nextAction: result.message + ' Record a new Owner decision for the other candidate instead.',
|
|
189
|
+
}
|
|
190
|
+
: {
|
|
191
|
+
ok: false,
|
|
192
|
+
reason: 'decision_not_found',
|
|
193
|
+
nextAction: 'Intent decision ' + id + ' does not exist. Refresh the page and try again.',
|
|
194
|
+
};
|
|
187
195
|
}
|
|
188
|
-
return { ok: true, record };
|
|
196
|
+
return { ok: true, record: result.record };
|
|
189
197
|
}
|
|
190
198
|
catch (err) {
|
|
191
199
|
if (isMissingTableError(err)) {
|