create-principles-disciple 1.94.0 → 1.95.0
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/console/dist/server/config/WorkspaceConfigStore.js +2 -1
- package/console/dist/server/config/pd-config-store.d.ts +33 -0
- package/console/dist/server/config/pd-config-store.js +159 -0
- package/console/dist/server/index.js +18 -4
- package/console/dist/server/models/EvidenceChainConsoleModel.d.ts +0 -2
- package/console/dist/server/models/EvidenceChainConsoleModel.js +36 -2
- package/console/dist/server/models/HealthCheckModel.js +5 -3
- package/console/dist/server/models/IntentDecisionModel.d.ts +66 -0
- package/console/dist/server/models/IntentDecisionModel.js +207 -0
- package/console/dist/server/models/IntentPageModel.d.ts +18 -0
- package/console/dist/server/models/IntentPageModel.js +90 -0
- package/console/dist/server/models/PrinciplesConsoleModel.d.ts +2 -0
- package/console/dist/server/models/PrinciplesConsoleModel.js +37 -1
- package/console/dist/server/models/WorkspaceService.d.ts +0 -28
- package/console/dist/server/models/WorkspaceService.js +0 -115
- package/console/dist/server/routes/config.js +55 -1
- package/console/dist/server/routes/intent-decisions.d.ts +33 -0
- package/console/dist/server/routes/intent-decisions.js +499 -0
- package/console/dist/server/routes/intent.d.ts +3 -0
- package/console/dist/server/routes/intent.js +35 -0
- package/console/dist/server/routes/principles.js +67 -1
- package/console/dist/server/routes/update.d.ts +0 -1
- package/console/dist/server/routes/update.js +14 -11
- package/console/dist/ui/App.js +2 -7
- package/console/dist/ui/api.d.ts +44 -18
- package/console/dist/ui/api.js +44 -5
- package/console/dist/ui/components/layout/app-sidebar.js +2 -1
- package/console/dist/ui/components/ui/badge.d.ts +1 -1
- package/console/dist/ui/components/ui/button.d.ts +1 -1
- package/console/dist/ui/components/ui/shiny-text.d.ts +28 -0
- package/console/dist/ui/components/ui/shiny-text.js +46 -0
- package/console/dist/ui/i18n/en.json +167 -3
- package/console/dist/ui/i18n/zh-CN.json +167 -3
- package/console/dist/ui/pages/activation/ActivationPage.js +2 -1
- package/console/dist/ui/pages/control-center/ControlCenterPage.js +28 -2
- package/console/dist/ui/pages/control-center/EmpathyObserverCostHint.d.ts +28 -0
- package/console/dist/ui/pages/control-center/EmpathyObserverCostHint.js +38 -0
- package/console/dist/ui/pages/debt/DebtPage.js +219 -2
- package/console/dist/ui/pages/focus/FocusPage.js +2 -1
- package/console/dist/ui/pages/intent/IntentPage.d.ts +1 -0
- package/console/dist/ui/pages/intent/IntentPage.js +147 -0
- package/console/dist/ui/pages/pain/PainPage.js +234 -4
- package/console/dist/ui/pages/pain/pain-card-helpers.d.ts +75 -0
- package/console/dist/ui/pages/pain/pain-card-helpers.js +78 -0
- package/console/dist/ui/pages/principles/PrinciplesPage.js +2 -1
- package/console/dist/ui/utils/validators.d.ts +163 -0
- package/console/dist/ui/utils/validators.js +433 -0
- package/console/dist/web/assets/app.css +138 -0
- package/console/dist/web/assets/app.js +3124 -1288
- package/console/package.json +3 -0
- package/core/dist/principle-tree-ledger.d.ts +55 -4
- package/core/dist/principle-tree-ledger.d.ts.map +1 -1
- package/core/dist/principle-tree-ledger.js +472 -13
- package/core/dist/principle-tree-ledger.js.map +1 -1
- package/core/dist/prompt-builder/__tests__/prompt-builder-core.test.js +58 -0
- package/core/dist/prompt-builder/__tests__/prompt-builder-core.test.js.map +1 -1
- package/core/dist/prompt-builder/empathy-keyword-matching.d.ts.map +1 -1
- package/core/dist/prompt-builder/empathy-keyword-matching.js +9 -6
- package/core/dist/prompt-builder/empathy-keyword-matching.js.map +1 -1
- package/core/dist/prompt-builder/size-guard.d.ts +1 -0
- package/core/dist/prompt-builder/size-guard.d.ts.map +1 -1
- package/core/dist/prompt-builder/size-guard.js +21 -0
- package/core/dist/prompt-builder/size-guard.js.map +1 -1
- package/core/dist/prompt-builder/types.d.ts +2 -0
- package/core/dist/prompt-builder/types.d.ts.map +1 -1
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +118 -32
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.js +284 -0
- package/core/dist/runtime-v2/__tests__/evidence-chain-intent-tension.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js +105 -0
- package/core/dist/runtime-v2/__tests__/pain-signal-bridge-result-shaping.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js +7 -5
- package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/pi-artifact-store.test.js +11 -0
- package/core/dist/runtime-v2/__tests__/pi-artifact-store.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/proven-channel-baseline.test.js +15 -2
- package/core/dist/runtime-v2/__tests__/proven-channel-baseline.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/schema-float-precision.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/schema-float-precision.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/schema-float-precision.test.js +290 -0
- package/core/dist/runtime-v2/__tests__/schema-float-precision.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/schema-orphan-detection.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/schema-orphan-detection.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/schema-orphan-detection.test.js +158 -0
- package/core/dist/runtime-v2/__tests__/schema-orphan-detection.test.js.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/approval-store-extended.test.js +15 -1
- package/core/dist/runtime-v2/activation/__tests__/approval-store-extended.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.d.ts +2 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.js +62 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store-fk.test.js.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js +12 -2
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.d.ts +2 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.js +56 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store-fk.test.js.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js +8 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.js +20 -0
- package/core/dist/runtime-v2/activation/__tests__/story-a-acceptance.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/sqlite-activation-state-store.js +6 -0
- package/core/dist/runtime-v2/activation/sqlite-activation-state-store.js.map +1 -1
- package/core/dist/runtime-v2/activation/sqlite-approval-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/sqlite-approval-store.js +86 -32
- package/core/dist/runtime-v2/activation/sqlite-approval-store.js.map +1 -1
- package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js +65 -1
- package/core/dist/runtime-v2/activation/writers/__tests__/rule-host-writer.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/writers/rule-host-writer.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/writers/rule-host-writer.js +33 -11
- package/core/dist/runtime-v2/activation/writers/rule-host-writer.js.map +1 -1
- package/core/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.js +134 -15
- package/core/dist/runtime-v2/diagnostician/__tests__/diag-rootcause-output.test.js.map +1 -1
- package/core/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.d.ts +18 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.js +251 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/intent-tension-schema.test.js.map +1 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/rootcause-prompt-builder.test.js +73 -0
- package/core/dist/runtime-v2/diagnostician/__tests__/rootcause-prompt-builder.test.js.map +1 -1
- package/core/dist/runtime-v2/diagnostician/diag-rootcause-output.d.ts +98 -0
- package/core/dist/runtime-v2/diagnostician/diag-rootcause-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/diagnostician/diag-rootcause-output.js +131 -0
- package/core/dist/runtime-v2/diagnostician/diag-rootcause-output.js.map +1 -1
- package/core/dist/runtime-v2/diagnostician/rootcause-prompt-builder.d.ts +8 -0
- package/core/dist/runtime-v2/diagnostician/rootcause-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/diagnostician/rootcause-prompt-builder.js +66 -3
- package/core/dist/runtime-v2/diagnostician/rootcause-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/diagnostician-output.d.ts +23 -0
- package/core/dist/runtime-v2/diagnostician-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/diagnostician-output.js +16 -0
- package/core/dist/runtime-v2/diagnostician-output.js.map +1 -1
- package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts +32 -0
- package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/diagnostician-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts +1 -1
- package/core/dist/runtime-v2/evidence-triage/source-descriptors.js +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +23 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.js +30 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/intent-engineering-flag.test.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +2 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js +0 -9
- package/core/dist/runtime-v2/feature-flags/plugin-surface-registry.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +9 -4
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +12 -3
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/intent/__tests__/intent-decision-record.test.d.ts +2 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-decision-record.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-decision-record.test.js +185 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-decision-record.test.js.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.d.ts +2 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.js +91 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc.test.js.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-friction-block.test.d.ts +2 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-friction-block.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-friction-block.test.js +168 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-friction-block.test.js.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.d.ts +2 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.js +121 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-patch-proposal.test.js.map +1 -0
- package/core/dist/runtime-v2/intent/index.d.ts +6 -0
- package/core/dist/runtime-v2/intent/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/index.js +6 -0
- package/core/dist/runtime-v2/intent/index.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-decision-record.d.ts +125 -0
- package/core/dist/runtime-v2/intent/intent-decision-record.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-decision-record.js +21 -0
- package/core/dist/runtime-v2/intent/intent-decision-record.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc-reader-port.d.ts +95 -0
- package/core/dist/runtime-v2/intent/intent-doc-reader-port.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc-reader-port.js +43 -0
- package/core/dist/runtime-v2/intent/intent-doc-reader-port.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc.d.ts +19 -0
- package/core/dist/runtime-v2/intent/intent-doc.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc.js +70 -0
- package/core/dist/runtime-v2/intent/intent-doc.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-friction-block.d.ts +63 -0
- package/core/dist/runtime-v2/intent/intent-friction-block.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-friction-block.js +129 -0
- package/core/dist/runtime-v2/intent/intent-friction-block.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-patch-proposal.d.ts +42 -0
- package/core/dist/runtime-v2/intent/intent-patch-proposal.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-patch-proposal.js +81 -0
- package/core/dist/runtime-v2/intent/intent-patch-proposal.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.d.ts +54 -0
- package/core/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.js +219 -0
- package/core/dist/runtime-v2/internalization/__tests__/__fixtures__/intent-tension-cases.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.js +360 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-rootcause-intent-tension.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.js +333 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-router-intent-tension.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.js +113 -0
- package/core/dist/runtime-v2/internalization/__tests__/intent-tension-cases.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/diag-rootcause-runner.d.ts +13 -0
- package/core/dist/runtime-v2/internalization/diag-rootcause-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-rootcause-runner.js +42 -0
- package/core/dist/runtime-v2/internalization/diag-rootcause-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-router-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/diag-router-runner.js +27 -0
- package/core/dist/runtime-v2/internalization/diag-router-runner.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.js +257 -56
- package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
- package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts +12 -0
- package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-runtime-factory.js +1 -1
- package/core/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime-v2/pain-to-principle-service.d.ts +6 -0
- package/core/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-to-principle-service.js +2 -0
- package/core/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
- package/core/dist/runtime-v2/principle-tree/ledger-codec.js.map +1 -1
- package/core/dist/runtime-v2/proven-channel-baseline.js +1 -1
- package/core/dist/runtime-v2/proven-channel-baseline.js.map +1 -1
- package/core/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.d.ts +2 -0
- package/core/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.js +55 -0
- package/core/dist/runtime-v2/store/artifact/__tests__/sqlite-pi-artifact-store-fk.test.js.map +1 -0
- package/core/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.js +6 -0
- package/core/dist/runtime-v2/store/artifact/sqlite-pi-artifact-store.js.map +1 -1
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.d.ts +2 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.js +272 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-decision-store.test.js.map +1 -0
- package/core/dist/runtime-v2/store/intent/index.d.ts +6 -0
- package/core/dist/runtime-v2/store/intent/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/intent/index.js +5 -0
- package/core/dist/runtime-v2/store/intent/index.js.map +1 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-decision-store.d.ts +51 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-decision-store.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-decision-store.js +306 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-decision-store.js.map +1 -0
- package/core/dist/runtime-v2/store/sqlite-connection-pragma.test.js +14 -3
- package/core/dist/runtime-v2/store/sqlite-connection-pragma.test.js.map +1 -1
- package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.d.ts +2 -0
- package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.js +72 -0
- package/core/dist/runtime-v2/store/sqlite-connection-schema-version.test.js.map +1 -0
- package/core/dist/runtime-v2/store/sqlite-connection.d.ts +27 -0
- package/core/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/sqlite-connection.js +124 -12
- package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
- package/core/dist/runtime-v2/types/event-payload.d.ts +1 -20
- package/core/dist/runtime-v2/types/event-payload.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/event-payload.js +0 -12
- package/core/dist/runtime-v2/types/event-payload.js.map +1 -1
- package/core/dist/runtime-v2/types/event-types.d.ts +5 -34
- package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/event-types.js +0 -19
- package/core/dist/runtime-v2/types/event-types.js.map +1 -1
- package/core/dist/runtime-v2/types/evidence-chain-contract.d.ts +63 -0
- package/core/dist/runtime-v2/types/evidence-chain-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/evidence-chain-contract.js +234 -9
- package/core/dist/runtime-v2/types/evidence-chain-contract.js.map +1 -1
- package/core/dist/runtime-v2/types/index.d.ts +5 -5
- package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/index.js +5 -3
- package/core/dist/runtime-v2/types/index.js.map +1 -1
- package/core/dist/runtime-v2/types/ledger-store.d.ts +30 -30
- package/core/dist/runtime-v2/types/ledger-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/ledger-store.js +10 -5
- package/core/dist/runtime-v2/types/ledger-store.js.map +1 -1
- package/core/dist/workflow-funnel-loader.d.ts +2 -2
- package/core/dist/workflow-funnel-loader.d.ts.map +1 -1
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +16 -0
- package/dist/installer.js.map +1 -1
- package/package.json +1 -1
- package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.d.ts +9 -0
- package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.d.ts.map +1 -0
- package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js +166 -0
- package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js.map +1 -0
- package/pd-cli/dist/commands/intent.d.ts +59 -0
- package/pd-cli/dist/commands/intent.d.ts.map +1 -0
- package/pd-cli/dist/commands/intent.js +350 -0
- package/pd-cli/dist/commands/intent.js.map +1 -0
- package/pd-cli/dist/commands/runtime-init.d.ts +43 -0
- package/pd-cli/dist/commands/runtime-init.d.ts.map +1 -0
- package/pd-cli/dist/commands/runtime-init.js +264 -0
- package/pd-cli/dist/commands/runtime-init.js.map +1 -0
- package/pd-cli/dist/index.js +25 -0
- package/pd-cli/dist/index.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 -0
- package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
- package/pd-cli/package.json +1 -0
- package/plugin/dist/commands/pain.js +2 -0
- package/plugin/dist/core/control-ui-db.d.ts +11 -0
- package/plugin/dist/core/control-ui-db.js +40 -16
- package/plugin/dist/core/event-log.js +0 -5
- package/plugin/dist/core/intent-doc-reader-adapter.d.ts +28 -0
- package/plugin/dist/core/intent-doc-reader-adapter.js +56 -0
- package/plugin/dist/core/intent-doc-reader.d.ts +80 -0
- package/plugin/dist/core/intent-doc-reader.js +189 -0
- package/plugin/dist/core/principle-tree-ledger.d.ts +27 -79
- package/plugin/dist/core/principle-tree-ledger.js +39 -524
- package/plugin/dist/core/reflection/reflection-context.d.ts +2 -2
- package/plugin/dist/core/trajectory.d.ts +16 -0
- package/plugin/dist/core/trajectory.js +332 -254
- package/plugin/dist/core/workspace-context.d.ts +2 -3
- package/plugin/dist/hooks/pain.js +5 -0
- package/plugin/dist/hooks/prompt-helpers.d.ts +19 -1
- package/plugin/dist/hooks/prompt-helpers.js +39 -2
- package/plugin/dist/hooks/prompt-types.d.ts +8 -0
- package/plugin/dist/hooks/prompt.js +80 -21
- package/plugin/dist/index.d.ts +3 -1
- package/plugin/dist/index.js +9 -5
- package/plugin/dist/service/runtime-summary-service.js +1 -1
- package/plugin/dist/service/subagent-workflow/workflow-store.d.ts +14 -0
- package/plugin/dist/service/subagent-workflow/workflow-store.js +91 -2
- package/plugin/dist/types/event-types.d.ts +1 -1
- package/plugin/package.json +6 -3
- package/plugin/scripts/acceptance-test.mjs +3 -3
- package/plugin/dist/core/principle-tree-ledger-adapter.d.ts +0 -32
- package/plugin/dist/core/principle-tree-ledger-adapter.js +0 -125
- package/plugin/dist/service/central-database.d.ts +0 -138
- package/plugin/dist/service/central-database.js +0 -731
- package/plugin/dist/service/central-sync-service.d.ts +0 -8
- package/plugin/dist/service/central-sync-service.js +0 -71
- package/plugin/scripts/validate-live-path.ts +0 -462
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-467 — safeReadIntentDoc: plugin I/O wrapper for reading INTENT.md.
|
|
3
|
+
*
|
|
4
|
+
* Reads `.principles/INTENT.md` with:
|
|
5
|
+
* - Feature flag check FIRST (SPEC §12: flag off → flag_disabled without fs)
|
|
6
|
+
* - TTL + mtime cache (60s TTL, mtime check) mirroring prompt.ts cachedReadFile
|
|
7
|
+
* - 32KB size cap (INTENT_MAX_BYTES)
|
|
8
|
+
* - Never throws — all errors return structured `reason` + `nextAction`
|
|
9
|
+
*
|
|
10
|
+
* Trust boundary (SPEC §12.2):
|
|
11
|
+
* - Raw content is returned for the pure builder to escape; this reader does
|
|
12
|
+
* NOT escape or bound the content for prompt injection. The pure builder
|
|
13
|
+
* `buildIntentFrictionBlock` handles escaping + bounding.
|
|
14
|
+
*
|
|
15
|
+
* ERR checklist:
|
|
16
|
+
* EP-01 / ERR-001, ERR-005: raw content validated with typeof, never `as`
|
|
17
|
+
* EP-02 / ERR-025, ERR-070: production path; plugin I/O file in the whitelist
|
|
18
|
+
* EP-03 / ERR-002, ERR-014: every degraded path returns structured reason + nextAction
|
|
19
|
+
* EP-09: tests use real fs writes in temp dirs
|
|
20
|
+
*
|
|
21
|
+
* Architecture: this file is I/O (fs, path). It is whitelisted in
|
|
22
|
+
* architecture-regression.test.ts KNOWN_PLUGIN_CORE_FILES.
|
|
23
|
+
*/
|
|
24
|
+
import * as fs from 'node:fs';
|
|
25
|
+
import * as path from 'node:path';
|
|
26
|
+
import { INTENT_MAX_BYTES, parseIntentDocSections, computeIntentContentHash, validateIntentDocSections, } from '@principles/core/runtime-v2';
|
|
27
|
+
import { loadFeatureFlagFromConfig } from './pd-config-loader.js';
|
|
28
|
+
// ── Constants ────────────────────────────────────────────────────────────────
|
|
29
|
+
const INTENT_FILENAME = 'INTENT.md';
|
|
30
|
+
const INTENT_DIR = '.principles';
|
|
31
|
+
const INTENT_CACHE_TTL_MS = 60_000; // 1 minute (SPEC §12.1)
|
|
32
|
+
// ── Module-level cache (per-workspace) ───────────────────────────────────────
|
|
33
|
+
const _intentDocCache = new Map();
|
|
34
|
+
/**
|
|
35
|
+
* Reset the intent doc cache for test isolation.
|
|
36
|
+
* Call in beforeEach() to ensure tests don't pollute each other.
|
|
37
|
+
*/
|
|
38
|
+
export function resetIntentDocCacheForTest(workspaceDir) {
|
|
39
|
+
if (workspaceDir) {
|
|
40
|
+
_intentDocCache.delete(workspaceDir);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
_intentDocCache.clear();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
47
|
+
function getIntentFilePath(workspaceDir) {
|
|
48
|
+
return path.join(workspaceDir, INTENT_DIR, INTENT_FILENAME);
|
|
49
|
+
}
|
|
50
|
+
function buildDocFromRaw(raw, filePath, readAt) {
|
|
51
|
+
const sections = parseIntentDocSections(raw);
|
|
52
|
+
const warnings = validateIntentDocSections(sections);
|
|
53
|
+
const contentHash = computeIntentContentHash(raw);
|
|
54
|
+
return {
|
|
55
|
+
raw,
|
|
56
|
+
sections,
|
|
57
|
+
contentHash,
|
|
58
|
+
path: filePath,
|
|
59
|
+
readAt,
|
|
60
|
+
warnings,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// ── Main entrypoint ──────────────────────────────────────────────────────────
|
|
64
|
+
/**
|
|
65
|
+
* Safely read INTENT.md for prompt injection.
|
|
66
|
+
*
|
|
67
|
+
* Contract (SPEC §12):
|
|
68
|
+
* 1. Flag check FIRST via loadFeatureFlagFromConfig. Flag off → flag_disabled
|
|
69
|
+
* WITHOUT any fs access to INTENT.md.
|
|
70
|
+
* 2. Flag on → check TTL + mtime cache. If cached and fresh → return cached.
|
|
71
|
+
* 3. Otherwise → stat the file (oversized check), read, parse, validate, cache.
|
|
72
|
+
* 4. Never throws — all errors return structured reason + nextAction.
|
|
73
|
+
*
|
|
74
|
+
* @param workspaceDir - Absolute path to the workspace root
|
|
75
|
+
* @param options - Optional logger for debug-level diagnostics
|
|
76
|
+
* @returns SafeReadIntentDocResult (never throws)
|
|
77
|
+
*/
|
|
78
|
+
export function safeReadIntentDoc(workspaceDir, options) {
|
|
79
|
+
// SPEC §12 — Flag check FIRST. Flag off → no fs access, no cache access.
|
|
80
|
+
const flagResult = loadFeatureFlagFromConfig(workspaceDir, 'intent_engineering', options?.logger);
|
|
81
|
+
if (!flagResult.enabled) {
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
found: false,
|
|
85
|
+
flagEnabled: false,
|
|
86
|
+
reason: 'flag_disabled',
|
|
87
|
+
nextAction: 'Enable the intent_engineering feature flag in .pd/config.yaml to read INTENT.md.',
|
|
88
|
+
warnings: [],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const filePath = getIntentFilePath(workspaceDir);
|
|
92
|
+
const now = Date.now();
|
|
93
|
+
// Check cache freshness (TTL + mtime)
|
|
94
|
+
const cached = _intentDocCache.get(workspaceDir);
|
|
95
|
+
if (cached && (now - cached.loadedAt) < INTENT_CACHE_TTL_MS) {
|
|
96
|
+
// Cache is within TTL. Verify mtime hasn't changed.
|
|
97
|
+
try {
|
|
98
|
+
const stat = fs.statSync(filePath);
|
|
99
|
+
if (stat.mtimeMs === cached.mtime) {
|
|
100
|
+
// Cache hit — return cached doc
|
|
101
|
+
return {
|
|
102
|
+
ok: true,
|
|
103
|
+
found: true,
|
|
104
|
+
flagEnabled: true,
|
|
105
|
+
doc: cached.doc,
|
|
106
|
+
warnings: cached.doc.warnings,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// File may have been deleted since caching. Fall through to not_found path.
|
|
112
|
+
// Don't return cached doc if the file no longer exists.
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Fresh read path
|
|
116
|
+
try {
|
|
117
|
+
// Check existence first
|
|
118
|
+
if (!fs.existsSync(filePath)) {
|
|
119
|
+
// Invalidate stale cache entry if any
|
|
120
|
+
_intentDocCache.delete(workspaceDir);
|
|
121
|
+
return {
|
|
122
|
+
ok: false,
|
|
123
|
+
found: false,
|
|
124
|
+
flagEnabled: true,
|
|
125
|
+
reason: 'not_found',
|
|
126
|
+
nextAction: 'Create .principles/INTENT.md using "pd intent init".',
|
|
127
|
+
warnings: [],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const stat = fs.statSync(filePath);
|
|
131
|
+
// SPEC §12 — 32KB size cap
|
|
132
|
+
if (stat.size > INTENT_MAX_BYTES) {
|
|
133
|
+
_intentDocCache.delete(workspaceDir);
|
|
134
|
+
return {
|
|
135
|
+
ok: false,
|
|
136
|
+
found: true,
|
|
137
|
+
flagEnabled: true,
|
|
138
|
+
reason: 'oversized',
|
|
139
|
+
nextAction: `INTENT.md exceeds ${INTENT_MAX_BYTES} bytes (${stat.size} bytes). Reduce content.`,
|
|
140
|
+
warnings: [],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const raw = fs.readFileSync(filePath, 'utf8');
|
|
144
|
+
// PRI-467 review fix (P2): TOCTOU guard — re-check actual byte length
|
|
145
|
+
// after readFileSync. The file may have grown between statSync() and
|
|
146
|
+
// readFileSync(), bypassing the stat.size oversized check. Without this,
|
|
147
|
+
// an oversized file would enter parse/hash/cache as ok:true.
|
|
148
|
+
const actualBytes = Buffer.byteLength(raw, 'utf8');
|
|
149
|
+
if (actualBytes > INTENT_MAX_BYTES) {
|
|
150
|
+
_intentDocCache.delete(workspaceDir);
|
|
151
|
+
return {
|
|
152
|
+
ok: false,
|
|
153
|
+
found: true,
|
|
154
|
+
flagEnabled: true,
|
|
155
|
+
reason: 'oversized',
|
|
156
|
+
nextAction: `INTENT.md exceeds ${INTENT_MAX_BYTES} bytes (${actualBytes} bytes after read). Reduce content.`,
|
|
157
|
+
warnings: [],
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const doc = buildDocFromRaw(raw, filePath, new Date(now).toISOString());
|
|
161
|
+
// Update cache
|
|
162
|
+
_intentDocCache.set(workspaceDir, {
|
|
163
|
+
doc,
|
|
164
|
+
mtime: stat.mtimeMs,
|
|
165
|
+
loadedAt: now,
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
ok: true,
|
|
169
|
+
found: true,
|
|
170
|
+
flagEnabled: true,
|
|
171
|
+
doc,
|
|
172
|
+
warnings: doc.warnings,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
// ERR-002 — graceful degradation with reason + nextAction
|
|
177
|
+
_intentDocCache.delete(workspaceDir);
|
|
178
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
179
|
+
options?.logger?.warn?.(`[PD:Intent] safeReadIntentDoc failed: workspace=${workspaceDir}, error=${message}`);
|
|
180
|
+
return {
|
|
181
|
+
ok: false,
|
|
182
|
+
found: false,
|
|
183
|
+
flagEnabled: true,
|
|
184
|
+
reason: 'read_error',
|
|
185
|
+
nextAction: 'Check filesystem permissions for .principles/INTENT.md.',
|
|
186
|
+
warnings: [],
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -1,82 +1,30 @@
|
|
|
1
|
-
import type { Implementation, ImplementationLifecycleState, Principle, PrincipleTreeStore, PrincipleValueMetrics, Rule } from '../types/principle-tree-schema.js';
|
|
2
|
-
export declare const TREE_NAMESPACE = "_tree";
|
|
3
|
-
export interface LegacyPrincipleTrainingState {
|
|
4
|
-
principleId: string;
|
|
5
|
-
evaluability: 'deterministic' | 'weak_heuristic' | 'manual_only';
|
|
6
|
-
applicableOpportunityCount: number;
|
|
7
|
-
observedViolationCount: number;
|
|
8
|
-
complianceRate: number;
|
|
9
|
-
violationTrend: number;
|
|
10
|
-
generatedSampleCount: number;
|
|
11
|
-
approvedSampleCount: number;
|
|
12
|
-
includedTrainRunIds: string[];
|
|
13
|
-
deployedCheckpointIds: string[];
|
|
14
|
-
lastEvalScore?: number;
|
|
15
|
-
internalizationStatus: 'prompt_only' | 'needs_training' | 'in_training' | 'deployed_pending_eval' | 'internalized' | 'regressed';
|
|
16
|
-
}
|
|
17
|
-
export type LegacyPrincipleTrainingStore = Record<string, LegacyPrincipleTrainingState>;
|
|
18
|
-
export interface LedgerPrinciple extends Principle {
|
|
19
|
-
suggestedRules?: string[];
|
|
20
|
-
}
|
|
21
|
-
export interface LedgerRule extends Rule {
|
|
22
|
-
implementationIds: string[];
|
|
23
|
-
}
|
|
24
|
-
export interface LedgerTreeStore extends Omit<PrincipleTreeStore, 'principles' | 'rules'> {
|
|
25
|
-
principles: Record<string, LedgerPrinciple>;
|
|
26
|
-
rules: Record<string, LedgerRule>;
|
|
27
|
-
}
|
|
28
|
-
export interface HybridLedgerStore {
|
|
29
|
-
trainingStore: LegacyPrincipleTrainingStore;
|
|
30
|
-
tree: LedgerTreeStore;
|
|
31
|
-
}
|
|
32
|
-
export interface PrincipleSubtree {
|
|
33
|
-
principle: LedgerPrinciple;
|
|
34
|
-
rules: {
|
|
35
|
-
rule: LedgerRule;
|
|
36
|
-
implementations: Implementation[];
|
|
37
|
-
}[];
|
|
38
|
-
}
|
|
39
|
-
export declare function getLedgerFilePath(stateDir: string): string;
|
|
40
|
-
export declare function loadLedger(stateDir: string): HybridLedgerStore;
|
|
41
|
-
export declare function saveLedger(stateDir: string, store: HybridLedgerStore): void;
|
|
42
|
-
export declare function saveLedgerAsync(stateDir: string, store: HybridLedgerStore): Promise<void>;
|
|
43
|
-
export declare function updateTrainingStore(stateDir: string, mutate: (store: LegacyPrincipleTrainingStore) => void): void;
|
|
44
1
|
/**
|
|
45
|
-
*
|
|
46
|
-
* This is the companion to updatePrinciple() — use this when creating a NEW
|
|
47
|
-
* principle so the compiler can find it in tree.principles.
|
|
2
|
+
* Principle Tree Ledger — plugin adapter (re-export) over @principles/core.
|
|
48
3
|
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
* Transition an implementation's lifecycle state with validation.
|
|
73
|
-
* Throws on invalid transitions */
|
|
74
|
-
export declare function transitionImplementationState(stateDir: string, implementationId: string, newState: ImplementationLifecycleState): Implementation;
|
|
75
|
-
/**
|
|
76
|
-
* Get implementations in a specific lifecycle state for a given rule.
|
|
77
|
-
*/
|
|
78
|
-
export declare function listRuleImplementationsByState(stateDir: string, ruleId: string, state: ImplementationLifecycleState): Implementation[];
|
|
79
|
-
/**
|
|
80
|
-
* Find active implementation for a rule (helper for rule host lookup).
|
|
4
|
+
* PRI-459: This file WAS a full duplicate implementation of
|
|
5
|
+
* principle_training_state.json parsing / serialization / mutation (~600
|
|
6
|
+
* lines of inlined parsers, serializers, mutators, and a parallel codec).
|
|
7
|
+
* That dual ownership caused two real failure classes:
|
|
8
|
+
*
|
|
9
|
+
* 1. Lost updates — core wrote the file UNLOCKED, the plugin wrote it WITH
|
|
10
|
+
* a lock, and neither knew the other's lock. Concurrent writers (e.g.
|
|
11
|
+
* evolution-worker async + a pd-cli command) could silently drop edits.
|
|
12
|
+
* 2. Silent field loss — the two codecs parsed the same bytes at different
|
|
13
|
+
* strictness; a field one side persisted could be dropped on the next
|
|
14
|
+
* load by the other.
|
|
15
|
+
*
|
|
16
|
+
* Both are now fixed by converging on a SINGLE source of truth in core:
|
|
17
|
+
* - parse/serialize: @principles/core/runtime-v2/principle-tree/ledger-codec
|
|
18
|
+
* - mutation (with cross-process file lock): @principles/core/principle-tree-ledger
|
|
19
|
+
*
|
|
20
|
+
* This file is now a thin re-export so existing relative imports
|
|
21
|
+
* (`from './principle-tree-ledger.js'`) keep resolving. Consumers get the
|
|
22
|
+
* exact same API surface, now backed by the locked core implementation.
|
|
23
|
+
*
|
|
24
|
+
* Do NOT reintroduce parsing / serialization / mutation logic here. The
|
|
25
|
+
* architecture-regression guard "PRI-459: single principle_training_state
|
|
26
|
+
* ledger implementation" enforces this.
|
|
81
27
|
*/
|
|
82
|
-
export
|
|
28
|
+
export { type Principle, type Rule, type Implementation, type PrincipleValueMetrics, type LedgerPrinciple, type LedgerRule, type LedgerTreeStore, type LegacyPrincipleTrainingState, type LegacyPrincipleTrainingStore, type HybridLedgerStore, type ImplementationLifecycleState, type PrincipleSubtree, TREE_NAMESPACE, LockAcquisitionError, loadLedger, saveLedger, saveLedgerAsync, updateTrainingStore, addPrincipleToLedger, createRule, createImplementation, updatePrinciple, updateRule, deleteRule, updateImplementation, deleteImplementation, listImplementationsForRule, getPrincipleSubtree, updatePrincipleValueMetrics, isValidLifecycleTransition, getAllowedTransitions, transitionImplementationState, listRuleImplementationsByState, findActiveImplementation, } from '@principles/core/principle-tree-ledger';
|
|
29
|
+
import { getLedgerFilePathPublic } from '@principles/core/principle-tree-ledger';
|
|
30
|
+
export declare const getLedgerFilePath: typeof getLedgerFilePathPublic;
|