create-principles-disciple 1.94.0 → 1.96.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 +196 -0
- package/console/dist/server/index.js +19 -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 +52 -0
- package/console/dist/server/models/IntentPageModel.js +292 -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 +7 -0
- package/console/dist/server/routes/intent.js +223 -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/types.d.ts +1 -0
- package/console/dist/ui/App.js +2 -60
- package/console/dist/ui/api.d.ts +58 -18
- package/console/dist/ui/api.js +78 -6
- package/console/dist/ui/components/layout/app-sidebar.js +13 -12
- 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 +306 -3
- package/console/dist/ui/i18n/zh-CN.json +306 -3
- package/console/dist/ui/pages/activation/ActivationPage.js +2 -1
- package/console/dist/ui/pages/control-center/AgentCard.d.ts +31 -0
- package/console/dist/ui/pages/control-center/AgentCard.js +156 -0
- package/console/dist/ui/pages/control-center/AgentGroup.d.ts +26 -0
- package/console/dist/ui/pages/control-center/AgentGroup.js +38 -0
- package/console/dist/ui/pages/control-center/ControlCenterPage.js +103 -41
- 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/control-center/WorkflowDiagram.d.ts +17 -0
- package/console/dist/ui/pages/control-center/WorkflowDiagram.js +55 -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/IntentOnboarding.d.ts +67 -0
- package/console/dist/ui/pages/intent/IntentOnboarding.js +289 -0
- package/console/dist/ui/pages/intent/IntentPage.d.ts +1 -0
- package/console/dist/ui/pages/intent/IntentPage.js +258 -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/agent-metadata.d.ts +58 -0
- package/console/dist/ui/utils/agent-metadata.js +275 -0
- package/console/dist/ui/utils/control-center-helpers.d.ts +19 -0
- package/console/dist/ui/utils/control-center-helpers.js +37 -0
- package/console/dist/ui/utils/validators.d.ts +200 -0
- package/console/dist/ui/utils/validators.js +563 -0
- package/console/dist/web/assets/app.css +498 -3
- package/console/dist/web/assets/app.js +5063 -1418
- 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 +143 -65
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.test.js +85 -7
- package/core/dist/runtime-v2/__tests__/evaluator-runner-vslice-v2.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__/golden-trace-replay-validator.test.js +70 -0
- package/core/dist/runtime-v2/__tests__/golden-trace-replay-validator.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/golden-trace.test.js +136 -1
- package/core/dist/runtime-v2/__tests__/golden-trace.test.js.map +1 -1
- 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/__tests__/v2-adversarial-cases.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.test.js +211 -0
- package/core/dist/runtime-v2/__tests__/v2-adversarial-cases.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 +158 -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 +11 -0
- 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 +55 -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/__tests__/rulecode-context-v2-flag.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js +74 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/rulecode-context-v2-flag.test.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.test.js +246 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/surface-guard-policy.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 +9 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/index.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/index.js +2 -0
- package/core/dist/runtime-v2/feature-flags/index.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/{plugin/dist/core/surface-guard.d.ts → core/dist/runtime-v2/feature-flags/surface-guard-policy.d.ts} +15 -5
- package/core/dist/runtime-v2/feature-flags/surface-guard-policy.d.ts.map +1 -0
- package/{plugin/dist/core/surface-guard.js → core/dist/runtime-v2/feature-flags/surface-guard-policy.js} +14 -2
- package/core/dist/runtime-v2/feature-flags/surface-guard-policy.js.map +1 -0
- package/core/dist/runtime-v2/golden-trace-replay-validator.js +1 -1
- package/core/dist/runtime-v2/golden-trace-replay-validator.js.map +1 -1
- package/core/dist/runtime-v2/golden-trace.d.ts +19 -3
- package/core/dist/runtime-v2/golden-trace.d.ts.map +1 -1
- package/core/dist/runtime-v2/golden-trace.js +2 -0
- package/core/dist/runtime-v2/golden-trace.js.map +1 -1
- package/core/dist/runtime-v2/index.d.ts +21 -4
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +21 -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-version.test.d.ts +2 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.test.js +88 -0
- package/core/dist/runtime-v2/intent/__tests__/intent-doc-version.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 +181 -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 +8 -0
- package/core/dist/runtime-v2/intent/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/index.js +8 -0
- package/core/dist/runtime-v2/intent/index.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-browser.d.ts +23 -0
- package/core/dist/runtime-v2/intent/intent-browser.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-browser.js +21 -0
- package/core/dist/runtime-v2/intent/intent-browser.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-version.d.ts +28 -0
- package/core/dist/runtime-v2/intent/intent-doc-version.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc-version.js +21 -0
- package/core/dist/runtime-v2/intent/intent-doc-version.js.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc.d.ts +35 -0
- package/core/dist/runtime-v2/intent/intent-doc.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-doc.js +158 -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-hash.d.ts +2 -0
- package/core/dist/runtime-v2/intent/intent-hash.d.ts.map +1 -0
- package/core/dist/runtime-v2/intent/intent-hash.js +10 -0
- package/core/dist/runtime-v2/intent/intent-hash.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__/artificer-prompt-builder.test.js +41 -1
- package/core/dist/runtime-v2/internalization/__tests__/artificer-prompt-builder.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js +130 -2
- package/core/dist/runtime-v2/internalization/__tests__/artificer-rule-output.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js +228 -0
- package/core/dist/runtime-v2/internalization/__tests__/behavior-example-pack.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js +41 -11
- package/core/dist/runtime-v2/internalization/__tests__/diag-chain-e2e.test.js.map +1 -1
- 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/__tests__/refiner-sandbox-wrapper.test.js +135 -0
- package/core/dist/runtime-v2/internalization/__tests__/refiner-sandbox-wrapper.test.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts +2 -0
- package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js +449 -0
- package/core/dist/runtime-v2/internalization/__tests__/rule-context-v2.test.js.map +1 -0
- package/core/dist/runtime-v2/internalization/adversarial-case.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/adversarial-case.js +24 -0
- package/core/dist/runtime-v2/internalization/adversarial-case.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-output.d.ts +10 -0
- package/core/dist/runtime-v2/internalization/artificer-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-output.js +45 -0
- package/core/dist/runtime-v2/internalization/artificer-output.js.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts +2 -2
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js +7 -2
- package/core/dist/runtime-v2/internalization/artificer-prompt-builder.js.map +1 -1
- package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts +66 -0
- package/core/dist/runtime-v2/internalization/behavior-example-pack.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/behavior-example-pack.js +183 -0
- package/core/dist/runtime-v2/internalization/behavior-example-pack.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/internalization/evaluator-output.d.ts +8 -0
- package/core/dist/runtime-v2/internalization/evaluator-output.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-output.js +10 -0
- package/core/dist/runtime-v2/internalization/evaluator-output.js.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts +17 -0
- package/core/dist/runtime-v2/internalization/evaluator-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/evaluator-runner.js +118 -24
- package/core/dist/runtime-v2/internalization/evaluator-runner.js.map +1 -1
- package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js +1 -1
- package/core/dist/runtime-v2/internalization/refiner-sandbox-wrapper.js.map +1 -1
- package/core/dist/runtime-v2/internalization/rule-context-v2.d.ts +61 -0
- package/core/dist/runtime-v2/internalization/rule-context-v2.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/rule-context-v2.js +301 -0
- package/core/dist/runtime-v2/internalization/rule-context-v2.js.map +1 -0
- package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts +9 -0
- package/core/dist/runtime-v2/internalization/rule-host-contracts.d.ts.map +1 -1
- package/core/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts +55 -0
- package/core/dist/runtime-v2/internalization/v2-adversarial-cases.d.ts.map +1 -0
- package/core/dist/runtime-v2/internalization/v2-adversarial-cases.js +131 -0
- package/core/dist/runtime-v2/internalization/v2-adversarial-cases.js.map +1 -0
- package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
- package/core/dist/runtime-v2/pain-signal-observability.js +280 -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/risk/__tests__/risk-calculator-policy.test.d.ts +2 -0
- package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js +95 -0
- package/core/dist/runtime-v2/risk/__tests__/risk-calculator-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/risk/index.d.ts +7 -0
- package/core/dist/runtime-v2/risk/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/risk/index.js +6 -0
- package/core/dist/runtime-v2/risk/index.js.map +1 -0
- package/core/dist/runtime-v2/risk/risk-calculator-policy.d.ts +18 -0
- package/core/dist/runtime-v2/risk/risk-calculator-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/risk/risk-calculator-policy.js +47 -0
- package/core/dist/runtime-v2/risk/risk-calculator-policy.js.map +1 -0
- 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/__tests__/sqlite-intent-doc-version-store.test.d.ts +2 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js +83 -0
- package/core/dist/runtime-v2/store/intent/__tests__/sqlite-intent-doc-version-store.test.js.map +1 -0
- package/core/dist/runtime-v2/store/intent/index.d.ts +7 -0
- package/core/dist/runtime-v2/store/intent/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/intent/index.js +6 -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/intent/sqlite-intent-doc-version-store.d.ts +28 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.d.ts.map +1 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-store.js +88 -0
- package/core/dist/runtime-v2/store/intent/sqlite-intent-doc-version-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 +138 -12
- package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
- package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts +2 -0
- package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js +149 -0
- package/core/dist/runtime-v2/thinking-models/__tests__/thinking-models-policy.test.js.map +1 -0
- package/core/dist/runtime-v2/thinking-models/index.d.ts +3 -0
- package/core/dist/runtime-v2/thinking-models/index.d.ts.map +1 -0
- package/core/dist/runtime-v2/thinking-models/index.js +3 -0
- package/core/dist/runtime-v2/thinking-models/index.js.map +1 -0
- package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts +73 -0
- package/core/dist/runtime-v2/thinking-models/thinking-models-policy.d.ts.map +1 -0
- package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js +227 -0
- package/core/dist/runtime-v2/thinking-models/thinking-models-policy.js.map +1 -0
- package/core/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js +40 -1
- package/core/dist/runtime-v2/tools/__tests__/artificer-l2-tool-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js +28 -1
- package/core/dist/runtime-v2/tools/artificer-l2-tool-contract.js.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-output-typebox.d.ts +3 -0
- package/core/dist/runtime-v2/tools/artificer-output-typebox.d.ts.map +1 -1
- package/core/dist/runtime-v2/tools/artificer-output-typebox.js +3 -0
- package/core/dist/runtime-v2/tools/artificer-output-typebox.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/core/package.json +4 -0
- 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 +237 -0
- package/pd-cli/dist/commands/__tests__/intent-flag-wiring.test.js.map +1 -0
- package/pd-cli/dist/commands/intent.d.ts +76 -0
- package/pd-cli/dist/commands/intent.d.ts.map +1 -0
- package/pd-cli/dist/commands/intent.js +411 -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/behavior-example-pack-assembler.d.ts +43 -0
- package/plugin/dist/core/behavior-example-pack-assembler.js +247 -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 +36 -0
- package/plugin/dist/core/intent-doc-reader-adapter.js +76 -0
- package/plugin/dist/core/intent-doc-reader.d.ts +89 -0
- package/plugin/dist/core/intent-doc-reader.js +210 -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/rule-context-assembler.d.ts +45 -0
- package/plugin/dist/core/rule-context-assembler.js +148 -0
- package/plugin/dist/core/thinking-models.d.ts +12 -57
- package/plugin/dist/core/thinking-models.js +18 -224
- package/plugin/dist/core/trajectory-types.d.ts +18 -0
- package/plugin/dist/core/trajectory.d.ts +50 -2
- package/plugin/dist/core/trajectory.js +435 -254
- package/plugin/dist/core/workspace-context.d.ts +2 -3
- package/plugin/dist/hooks/gate.js +59 -2
- 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 +81 -21
- package/plugin/dist/index.d.ts +3 -1
- package/plugin/dist/index.js +10 -6
- 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/evolution-migration.d.ts +0 -5
- package/plugin/dist/core/evolution-migration.js +0 -65
- 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/core/risk-calculator.d.ts +0 -22
- package/plugin/dist/core/risk-calculator.js +0 -88
- package/plugin/dist/core/rule-host-helpers.d.ts +0 -8
- package/plugin/dist/core/rule-host-helpers.js +0 -7
- package/plugin/dist/core/rule-host-types.d.ts +0 -7
- package/plugin/dist/core/rule-host-types.js +0 -7
- package/plugin/dist/core/schema/db-types.d.ts +0 -11
- package/plugin/dist/core/schema/db-types.js +0 -5
- package/plugin/dist/core/schema/index.d.ts +0 -17
- package/plugin/dist/core/schema/index.js +0 -15
- package/plugin/dist/core/schema/migration-runner.d.ts +0 -53
- package/plugin/dist/core/schema/migration-runner.js +0 -170
- package/plugin/dist/core/schema/migrations/001-init-trajectory.d.ts +0 -6
- package/plugin/dist/core/schema/migrations/001-init-trajectory.js +0 -190
- package/plugin/dist/core/schema/migrations/002-init-central.d.ts +0 -5
- package/plugin/dist/core/schema/migrations/002-init-central.js +0 -108
- package/plugin/dist/core/schema/migrations/003-init-workflow.d.ts +0 -5
- package/plugin/dist/core/schema/migrations/003-init-workflow.js +0 -50
- package/plugin/dist/core/schema/migrations/004-add-thinking-and-gfi.d.ts +0 -8
- package/plugin/dist/core/schema/migrations/004-add-thinking-and-gfi.js +0 -66
- package/plugin/dist/core/schema/migrations/index.d.ts +0 -16
- package/plugin/dist/core/schema/migrations/index.js +0 -27
- package/plugin/dist/core/schema/schema-definitions.d.ts +0 -46
- package/plugin/dist/core/schema/schema-definitions.js +0 -599
- 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/db-migrate.mjs +0 -170
- package/plugin/scripts/validate-live-path.ts +0 -462
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IntentDecisionRecord — durable audit record of Owner decisions on surfaced
|
|
3
|
+
* intentTension (PRI-470, SPEC §21.7).
|
|
4
|
+
*
|
|
5
|
+
* Owner decisions on intentTension MUST form an auditable record. This module
|
|
6
|
+
* defines the pure types and the store interface; the SQLite implementation
|
|
7
|
+
* lives in `runtime-v2/store/intent/`.
|
|
8
|
+
*
|
|
9
|
+
* Persistence boundary (SPEC §21.7):
|
|
10
|
+
* - Records are durable (state.db `intent_decisions` table), never transient.
|
|
11
|
+
* - Same `painId + intentDocHash + ownerAction` resubmission is idempotent.
|
|
12
|
+
* - Records are refresh-safe: read side can query by painId / taskId.
|
|
13
|
+
* - Write failure fails loud with reason + nextAction.
|
|
14
|
+
*
|
|
15
|
+
* ERR checklist:
|
|
16
|
+
* - EP-01 / ERR-001, ERR-005: enum fields validated via type guards, never `as`
|
|
17
|
+
* - EP-03 / ERR-002: store failures surface reason, never silent
|
|
18
|
+
* - EP-09: pure types — independently usable without I/O mocks
|
|
19
|
+
*/
|
|
20
|
+
import type { IntentTensionSource, EvidenceStrength, IntentRelatedField, SuggestedOwnerAction } from '../diagnostician/diag-rootcause-output.js';
|
|
21
|
+
/**
|
|
22
|
+
* Durable record of an Owner decision on a surfaced intentTension.
|
|
23
|
+
*
|
|
24
|
+
* Per SPEC §21.7, this is the minimal auditable field set. `evidenceRefs`
|
|
25
|
+
* MUST point to Pain Evidence, trace, Owner correction, or an INTENT field.
|
|
26
|
+
*/
|
|
27
|
+
export interface IntentDecisionRecord {
|
|
28
|
+
id: string;
|
|
29
|
+
painId?: string;
|
|
30
|
+
taskId?: string;
|
|
31
|
+
runId?: string;
|
|
32
|
+
intentDocHash?: string;
|
|
33
|
+
source: IntentTensionSource;
|
|
34
|
+
evidenceStrength: EvidenceStrength;
|
|
35
|
+
relatedIntentFields: IntentRelatedField[];
|
|
36
|
+
ownerAction: SuggestedOwnerAction;
|
|
37
|
+
evidenceRefs: string[];
|
|
38
|
+
resultingCandidateId?: string;
|
|
39
|
+
resultingRuleCandidateId?: string;
|
|
40
|
+
patchProposalId?: string;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Input for creating an IntentDecisionRecord.
|
|
45
|
+
*
|
|
46
|
+
* `id` is caller-supplied so the Console API can return the canonical id
|
|
47
|
+
* before persistence completes. `note` is an optional Owner free-text note
|
|
48
|
+
* that the store persists alongside the decision.
|
|
49
|
+
*/
|
|
50
|
+
export interface IntentDecisionInput {
|
|
51
|
+
id: string;
|
|
52
|
+
painId?: string;
|
|
53
|
+
taskId?: string;
|
|
54
|
+
runId?: string;
|
|
55
|
+
intentDocHash?: string;
|
|
56
|
+
source: IntentTensionSource;
|
|
57
|
+
evidenceStrength: EvidenceStrength;
|
|
58
|
+
relatedIntentFields: IntentRelatedField[];
|
|
59
|
+
ownerAction: SuggestedOwnerAction;
|
|
60
|
+
evidenceRefs: string[];
|
|
61
|
+
note?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Result of recording a decision.
|
|
65
|
+
*
|
|
66
|
+
* `created=false` means an idempotent hit — the same decision already exists
|
|
67
|
+
* and `record` is the pre-existing record. Callers SHOULD return 200 (not 201)
|
|
68
|
+
* in this case so clients can distinguish a fresh write from a replay.
|
|
69
|
+
*/
|
|
70
|
+
export interface IntentDecisionRecordResult {
|
|
71
|
+
record: IntentDecisionRecord;
|
|
72
|
+
created: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Lightweight audit summary derived from IntentDecisionRecord (SPEC §22.1.1).
|
|
76
|
+
*
|
|
77
|
+
* `counts` holds a tally per SuggestedOwnerAction (every key is present,
|
|
78
|
+
* defaulting to 0). `lastDecisionAt` is the most recent `createdAt` across
|
|
79
|
+
* all records, or null when no records exist.
|
|
80
|
+
*/
|
|
81
|
+
export interface IntentDecisionSummary {
|
|
82
|
+
counts: Record<SuggestedOwnerAction, number>;
|
|
83
|
+
lastDecisionAt: string | null;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Patch for updating follow-up action fields on an existing IntentDecisionRecord.
|
|
87
|
+
* Used by PRI-471 to record which follow-up action was dispatched after the
|
|
88
|
+
* Owner decision was persisted (SPEC §22.1.4).
|
|
89
|
+
*
|
|
90
|
+
* Only one field should be set per call — each follow-up type is independent.
|
|
91
|
+
* Setting a field to `undefined` leaves it unchanged; the store only updates
|
|
92
|
+
* fields that are explicitly provided.
|
|
93
|
+
*/
|
|
94
|
+
export interface FollowUpPatch {
|
|
95
|
+
resultingCandidateId?: string;
|
|
96
|
+
resultingRuleCandidateId?: string;
|
|
97
|
+
patchProposalId?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Durable store contract for IntentDecisionRecord (SPEC §21.7 persistence).
|
|
101
|
+
*
|
|
102
|
+
* Implementations MUST:
|
|
103
|
+
* - Be idempotent on (painId + intentDocHash + ownerAction) when painId is
|
|
104
|
+
* non-null; fall back to (taskId + intentDocHash + ownerAction) when painId
|
|
105
|
+
* is null.
|
|
106
|
+
* - Store immutable snapshots of source / evidenceStrength /
|
|
107
|
+
* relatedIntentFields / evidenceRefs so the audit trail stays accurate even
|
|
108
|
+
* if the underlying artifact is later modified.
|
|
109
|
+
* - Truncate evidence to max 3 items before storing.
|
|
110
|
+
* - Fail loud (throw) on write failure — never return a silent "success".
|
|
111
|
+
*/
|
|
112
|
+
export interface IntentDecisionStore {
|
|
113
|
+
record(input: IntentDecisionInput): Promise<IntentDecisionRecordResult>;
|
|
114
|
+
getById(id: string): Promise<IntentDecisionRecord | null>;
|
|
115
|
+
listByPainId(painId: string): Promise<IntentDecisionRecord[]>;
|
|
116
|
+
listByTaskId(taskId: string): Promise<IntentDecisionRecord[]>;
|
|
117
|
+
getSummary(): Promise<IntentDecisionSummary>;
|
|
118
|
+
/**
|
|
119
|
+
* Update follow-up action fields on an existing record (PRI-471, SPEC §22.1.4).
|
|
120
|
+
* Returns the updated record, or null if the record does not exist.
|
|
121
|
+
* Only fields present in `patch` are updated; others remain unchanged.
|
|
122
|
+
*/
|
|
123
|
+
updateFollowUp(id: string, patch: FollowUpPatch): Promise<IntentDecisionRecord | null>;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=intent-decision-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-decision-record.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-decision-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,2CAA2C,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,WAAW,EAAE,oBAAoB,CAAC;IAClC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,mBAAmB,CAAC;IAC5B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;IAC1C,WAAW,EAAE,oBAAoB,CAAC;IAClC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAC7C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACxE,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAC1D,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC9D,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC9D,UAAU,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7C;;;;OAIG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;CACxF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IntentDecisionRecord — durable audit record of Owner decisions on surfaced
|
|
3
|
+
* intentTension (PRI-470, SPEC §21.7).
|
|
4
|
+
*
|
|
5
|
+
* Owner decisions on intentTension MUST form an auditable record. This module
|
|
6
|
+
* defines the pure types and the store interface; the SQLite implementation
|
|
7
|
+
* lives in `runtime-v2/store/intent/`.
|
|
8
|
+
*
|
|
9
|
+
* Persistence boundary (SPEC §21.7):
|
|
10
|
+
* - Records are durable (state.db `intent_decisions` table), never transient.
|
|
11
|
+
* - Same `painId + intentDocHash + ownerAction` resubmission is idempotent.
|
|
12
|
+
* - Records are refresh-safe: read side can query by painId / taskId.
|
|
13
|
+
* - Write failure fails loud with reason + nextAction.
|
|
14
|
+
*
|
|
15
|
+
* ERR checklist:
|
|
16
|
+
* - EP-01 / ERR-001, ERR-005: enum fields validated via type guards, never `as`
|
|
17
|
+
* - EP-03 / ERR-002: store failures surface reason, never silent
|
|
18
|
+
* - EP-09: pure types — independently usable without I/O mocks
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=intent-decision-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-decision-record.js","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-decision-record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IntentDocReader — port interface for reading INTENT.md from the plugin layer.
|
|
3
|
+
*
|
|
4
|
+
* PRI-468 / SPEC §12 — the diagnostician Stage A runner needs INTENT.md
|
|
5
|
+
* content to optionally produce `intentTension`. Core cannot do I/O, so it
|
|
6
|
+
* defines this port; the plugin provides a concrete implementation that
|
|
7
|
+
* wraps `safeReadIntentDoc()` with feature-flag checking.
|
|
8
|
+
*
|
|
9
|
+
* Contract (SPEC §12):
|
|
10
|
+
* - When `intent_engineering` flag is off, implementations MUST return
|
|
11
|
+
* `{ ok: false, flagEnabled: false, reason: 'flag_disabled' }` WITHOUT
|
|
12
|
+
* any filesystem access.
|
|
13
|
+
* - Implementations MUST NOT throw — all error paths return a structured
|
|
14
|
+
* `reason` + `nextAction` (EP-03 / ERR-002: no silent fallback).
|
|
15
|
+
* - `doc.raw` is unescaped; the caller is responsible for escaping when
|
|
16
|
+
* injecting into a prompt (SPEC §12.2 trust boundary).
|
|
17
|
+
*
|
|
18
|
+
* This interface is intentionally minimal — it returns only the fields the
|
|
19
|
+
* diagnostician runner needs: `raw` (for prompt injection) and
|
|
20
|
+
* `contentHash` (for `intentTension.intentDocHash` lineage). Validation
|
|
21
|
+
* warnings are NOT surfaced here because the diagnostician does not act on
|
|
22
|
+
* them; they remain visible via `pd intent show`.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* A successfully read INTENT.md reference.
|
|
26
|
+
*
|
|
27
|
+
* `raw` is the unescaped file content. `contentHash` is the SHA-256 hash
|
|
28
|
+
* used for `intentTension.intentDocHash` lineage (SPEC §16.2).
|
|
29
|
+
*/
|
|
30
|
+
export interface IntentDocReference {
|
|
31
|
+
/** Raw INTENT.md content (unescaped — caller escapes for prompt injection). */
|
|
32
|
+
readonly raw: string;
|
|
33
|
+
/** SHA-256 content hash for deduplication and audit (e.g. "sha256:abc..."). */
|
|
34
|
+
readonly contentHash: string;
|
|
35
|
+
/** Absolute path to the INTENT.md file (for telemetry only — never read by core). */
|
|
36
|
+
readonly path: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Structured reason for a degraded read path.
|
|
40
|
+
*
|
|
41
|
+
* Mirrors `SafeReadIntentDocReason` from the plugin layer (PRI-467), but
|
|
42
|
+
* defined here so core has no plugin-layer import.
|
|
43
|
+
*/
|
|
44
|
+
export type IntentDocReadReason = 'flag_disabled' | 'not_found' | 'oversized' | 'read_error';
|
|
45
|
+
/**
|
|
46
|
+
* Result of reading INTENT.md.
|
|
47
|
+
*
|
|
48
|
+
* When `ok === true`, `doc` is present. When `ok === false`, `reason` and
|
|
49
|
+
* `nextAction` are present (EP-03 / ERR-002: no silent fallback).
|
|
50
|
+
*/
|
|
51
|
+
export interface IntentDocReadResult {
|
|
52
|
+
/** True when the doc was successfully read and parsed. */
|
|
53
|
+
readonly ok: boolean;
|
|
54
|
+
/** True when the INTENT.md file exists on disk (false when not_found). */
|
|
55
|
+
readonly found: boolean;
|
|
56
|
+
/** True when the intent_engineering flag is enabled. */
|
|
57
|
+
readonly flagEnabled: boolean;
|
|
58
|
+
/** The parsed IntentDoc, present only when ok=true. */
|
|
59
|
+
readonly doc?: IntentDocReference;
|
|
60
|
+
/** Structured reason for a degraded path (present when ok=false). */
|
|
61
|
+
readonly reason?: IntentDocReadReason;
|
|
62
|
+
/** Next action for the operator (present when ok=false). */
|
|
63
|
+
readonly nextAction?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Port interface for reading INTENT.md.
|
|
67
|
+
*
|
|
68
|
+
* Core defines this interface; the plugin provides a concrete implementation
|
|
69
|
+
* that wraps `safeReadIntentDoc(workspaceDir)` with feature-flag checking.
|
|
70
|
+
*
|
|
71
|
+
* The implementation is expected to be a closure bound to a specific
|
|
72
|
+
* workspaceDir (created in `pain-signal-runtime-factory.ts`), so this
|
|
73
|
+
* method takes no arguments.
|
|
74
|
+
*/
|
|
75
|
+
export interface IntentDocReader {
|
|
76
|
+
/**
|
|
77
|
+
* Read INTENT.md for the bound workspace.
|
|
78
|
+
*
|
|
79
|
+
* NEVER throws — all error paths return a structured result.
|
|
80
|
+
* When `intent_engineering` flag is off, returns `flag_disabled` WITHOUT
|
|
81
|
+
* any filesystem access (SPEC §12).
|
|
82
|
+
*/
|
|
83
|
+
readIntentDoc(): IntentDocReadResult;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* No-op IntentDocReader for backward compatibility.
|
|
87
|
+
*
|
|
88
|
+
* Used when no reader is provided (e.g., in unit tests that don't care
|
|
89
|
+
* about INTENT). Always returns `flag_disabled` — ensuring the runner
|
|
90
|
+
* behaves as if the flag is off, producing byte-identical prompts.
|
|
91
|
+
*/
|
|
92
|
+
export declare class NullIntentDocReader implements IntentDocReader {
|
|
93
|
+
readIntentDoc(): IntentDocReadResult;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=intent-doc-reader-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-doc-reader-port.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-doc-reader-port.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAC3B,eAAe,GACf,WAAW,GACX,WAAW,GACX,YAAY,CAAC;AAEjB;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC;IAClC,qEAAqE;IACrE,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IACtC,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,aAAa,IAAI,mBAAmB,CAAC;CACtC;AAED;;;;;;GAMG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IAEzD,aAAa,IAAI,mBAAmB;CASrC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IntentDocReader — port interface for reading INTENT.md from the plugin layer.
|
|
3
|
+
*
|
|
4
|
+
* PRI-468 / SPEC §12 — the diagnostician Stage A runner needs INTENT.md
|
|
5
|
+
* content to optionally produce `intentTension`. Core cannot do I/O, so it
|
|
6
|
+
* defines this port; the plugin provides a concrete implementation that
|
|
7
|
+
* wraps `safeReadIntentDoc()` with feature-flag checking.
|
|
8
|
+
*
|
|
9
|
+
* Contract (SPEC §12):
|
|
10
|
+
* - When `intent_engineering` flag is off, implementations MUST return
|
|
11
|
+
* `{ ok: false, flagEnabled: false, reason: 'flag_disabled' }` WITHOUT
|
|
12
|
+
* any filesystem access.
|
|
13
|
+
* - Implementations MUST NOT throw — all error paths return a structured
|
|
14
|
+
* `reason` + `nextAction` (EP-03 / ERR-002: no silent fallback).
|
|
15
|
+
* - `doc.raw` is unescaped; the caller is responsible for escaping when
|
|
16
|
+
* injecting into a prompt (SPEC §12.2 trust boundary).
|
|
17
|
+
*
|
|
18
|
+
* This interface is intentionally minimal — it returns only the fields the
|
|
19
|
+
* diagnostician runner needs: `raw` (for prompt injection) and
|
|
20
|
+
* `contentHash` (for `intentTension.intentDocHash` lineage). Validation
|
|
21
|
+
* warnings are NOT surfaced here because the diagnostician does not act on
|
|
22
|
+
* them; they remain visible via `pd intent show`.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* No-op IntentDocReader for backward compatibility.
|
|
26
|
+
*
|
|
27
|
+
* Used when no reader is provided (e.g., in unit tests that don't care
|
|
28
|
+
* about INTENT). Always returns `flag_disabled` — ensuring the runner
|
|
29
|
+
* behaves as if the flag is off, producing byte-identical prompts.
|
|
30
|
+
*/
|
|
31
|
+
export class NullIntentDocReader {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/class-methods-use-this
|
|
33
|
+
readIntentDoc() {
|
|
34
|
+
return {
|
|
35
|
+
ok: false,
|
|
36
|
+
found: false,
|
|
37
|
+
flagEnabled: false,
|
|
38
|
+
reason: 'flag_disabled',
|
|
39
|
+
nextAction: 'No IntentDocReader configured — intent_engineering is effectively off.',
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=intent-doc-reader-port.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-doc-reader-port.js","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-doc-reader-port.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAuEH;;;;;;GAMG;AACH,MAAM,OAAO,mBAAmB;IAC9B,qEAAqE;IACrE,aAAa;QACX,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,eAAe;YACvB,UAAU,EAAE,wEAAwE;SACrF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type IntentLang } from './intent-doc.js';
|
|
2
|
+
export interface IntentDocVersion {
|
|
3
|
+
id: string;
|
|
4
|
+
lang: IntentLang;
|
|
5
|
+
contentHash: string;
|
|
6
|
+
contentSnapshot: string;
|
|
7
|
+
reason: string | null;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IntentDocVersionStore {
|
|
11
|
+
saveVersion(input: {
|
|
12
|
+
lang: IntentLang;
|
|
13
|
+
content: string;
|
|
14
|
+
reason?: string;
|
|
15
|
+
}): Promise<IntentDocVersion>;
|
|
16
|
+
listVersions(lang: IntentLang, limit?: number): Promise<IntentDocVersion[]>;
|
|
17
|
+
getVersion(id: string): Promise<IntentDocVersion | null>;
|
|
18
|
+
getLatest(lang: IntentLang): Promise<IntentDocVersion | null>;
|
|
19
|
+
}
|
|
20
|
+
export declare function computeVersionDiff(oldContent: string, newContent: string): {
|
|
21
|
+
section: string;
|
|
22
|
+
changed: boolean;
|
|
23
|
+
}[];
|
|
24
|
+
export declare function formatVersionSummary(version: IntentDocVersion, index: number): {
|
|
25
|
+
label: string;
|
|
26
|
+
preview: string;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=intent-doc-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-doc-version.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-doc-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACtG,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC5E,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IACzD,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;CAC/D;AAID,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAAE,CAOzC;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,MAAM,GACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CASpC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { parseIntentDocSections } from './intent-doc.js';
|
|
2
|
+
const SECTION_KEYS = ['why', 'desiredOutcome', 'nonNegotiables', 'stopEscalation', 'currentStrategicFocus'];
|
|
3
|
+
export function computeVersionDiff(oldContent, newContent) {
|
|
4
|
+
const oldSections = parseIntentDocSections(oldContent);
|
|
5
|
+
const newSections = parseIntentDocSections(newContent);
|
|
6
|
+
return SECTION_KEYS.map(key => ({
|
|
7
|
+
section: key,
|
|
8
|
+
changed: (oldSections[key] ?? '') !== (newSections[key] ?? ''),
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
export function formatVersionSummary(version, index) {
|
|
12
|
+
const versionNumber = `v${index + 1}`;
|
|
13
|
+
// Language-aware fallback for missing reason (CodeRabbit review):
|
|
14
|
+
// English versions should not show Chinese default text.
|
|
15
|
+
const reason = version.reason ?? (version.lang === 'en' ? '(no note)' : '无备注');
|
|
16
|
+
const label = `${versionNumber} · ${reason}`;
|
|
17
|
+
const previewText = version.contentSnapshot.replace(/##\s*\d+\.\s*[^\n]*/g, '').trim();
|
|
18
|
+
const preview = previewText.length > 80 ? previewText.slice(0, 77) + '...' : previewText;
|
|
19
|
+
return { label, preview };
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=intent-doc-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-doc-version.js","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-doc-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAmB,MAAM,iBAAiB,CAAC;AAkB1E,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,uBAAuB,CAAU,CAAC;AAErH,MAAM,UAAU,kBAAkB,CAChC,UAAkB,EAClB,UAAkB;IAElB,MAAM,WAAW,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IACvD,MAAM,WAAW,GAAG,sBAAsB,CAAC,UAAU,CAAC,CAAC;IACvD,OAAO,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9B,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;KAC/D,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,OAAyB,EACzB,KAAa;IAEb,MAAM,aAAa,GAAG,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;IACtC,kEAAkE;IAClE,yDAAyD;IACzD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC/E,MAAM,KAAK,GAAG,GAAG,aAAa,MAAM,MAAM,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvF,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC;IACzF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface IntentDocSections {
|
|
2
|
+
why?: string;
|
|
3
|
+
desiredOutcome?: string;
|
|
4
|
+
nonNegotiables?: string;
|
|
5
|
+
stopEscalation?: string;
|
|
6
|
+
currentStrategicFocus?: string;
|
|
7
|
+
}
|
|
8
|
+
export type IntentDocWarningCode = 'missing_section' | 'empty_section' | 'too_vague' | 'oversized' | 'parse_failed';
|
|
9
|
+
export interface IntentDocWarning {
|
|
10
|
+
code: IntentDocWarningCode;
|
|
11
|
+
message: string;
|
|
12
|
+
section?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const INTENT_MAX_BYTES: number;
|
|
15
|
+
export declare function parseIntentDocSections(raw: string): IntentDocSections;
|
|
16
|
+
/**
|
|
17
|
+
* Assemble a complete INTENT.md document from individual sections.
|
|
18
|
+
*
|
|
19
|
+
* Symmetric to `parseIntentDocSections`: round-trip
|
|
20
|
+
* `parseIntentDocSections(assembleIntentDoc(sections))` returns the same
|
|
21
|
+
* sections (for non-empty content). Missing sections still emit their header
|
|
22
|
+
* with empty content, so the assembled doc always has all 5 headers in order.
|
|
23
|
+
*
|
|
24
|
+
* Used by the wizard and the section editor to save user input without
|
|
25
|
+
* hand-written string concatenation in the UI layer.
|
|
26
|
+
*/
|
|
27
|
+
export declare function assembleIntentDoc(sections: IntentDocSections): string;
|
|
28
|
+
export declare function validateIntentDocSections(sections: IntentDocSections): IntentDocWarning[];
|
|
29
|
+
export declare const INTENT_DOC_TEMPLATE = "# INTENT.md\n\n## 1. Why\n\nWhy does this project matter?\n\n## 2. Desired Outcome\n\nWhat observable change should happen?\n\n## 3. Non-negotiables\n\nWhat cannot be sacrificed?\n\n## 4. Stop / Escalation\n\nWhen must the Agent stop and ask?\n\n## 5. Current Strategic Focus\n\nWhat is the current strategic trade-off?\n";
|
|
30
|
+
export type IntentLang = 'zh-CN' | 'en';
|
|
31
|
+
export declare function getIntentFilename(lang: IntentLang): string;
|
|
32
|
+
export declare const INTENT_DOC_TEMPLATE_ZH = "# INTENT.md\n\n## 1. Why\n\n\u8FD9\u4E2A\u9879\u76EE / \u9636\u6BB5\u4E3A\u4EC0\u4E48\u91CD\u8981\uFF1F\n\u5B83\u670D\u52A1\u4E8E\u4EC0\u4E48\u957F\u671F\u76EE\u6807\uFF1F\n\u5B83\u4E0D\u53EA\u662F\u8981\u5B8C\u6210\u4EC0\u4E48\u4EFB\u52A1\uFF0C\u800C\u662F\u8981\u89E3\u51B3\u4EC0\u4E48\u771F\u5B9E\u95EE\u9898\uFF1F\n\n## 2. Desired Outcome\n\n\u5B8C\u6210\u540E\uFF0C\u4E16\u754C\u5E94\u8BE5\u53D1\u751F\u4EC0\u4E48\u53EF\u89C2\u5BDF\u7684\u53D8\u5316\uFF1F\n\u4EC0\u4E48\u7ED3\u679C\u80FD\u8BF4\u660E\u6211\u4EEC\u66F4\u63A5\u8FD1\u76EE\u6807\uFF1F\n\u907F\u514D\u5199\"\u8BA9\u4EA7\u54C1\u66F4\u597D\"\u8FD9\u79CD\u4E0D\u53EF\u6BD4\u8F83\u63CF\u8FF0\u3002\n\n## 3. Non-negotiables\n\n\u4E3A\u4E86\u8FBE\u6210\u76EE\u6807\uFF0C\u54EA\u4E9B\u4E1C\u897F\u4E0D\u80FD\u88AB\u727A\u7272\uFF1F\n\u4F8B\u5982\uFF1AOwner \u6CE8\u610F\u529B\u3001\u7528\u6237\u4FE1\u4EFB\u3001MVP \u901F\u5EA6\u3001\u5B89\u5168\u8FB9\u754C\u3001\u53EF\u7EF4\u62A4\u6027\u3001\u54C1\u724C\u8C03\u6027\u3002\n\n## 4. Stop / Escalation\n\n\u4EC0\u4E48\u60C5\u51B5\u4E0B Agent \u5FC5\u987B\u505C\u4E0B\u3001\u8BE2\u95EE\u6216\u5347\u7EA7\u7ED9 Owner\uFF1F\n\n\u6CE8\u610F\uFF1A\u8FD9\u4E9B\u662F\u8F6F\u5347\u7EA7\u6761\u4EF6\uFF1B\u9664\u975E\u53E6\u884C\u7F16\u7801\u8FDB RuleHost\uFF0C\u5426\u5219\u4E0D\u6784\u6210\u786C\u62E6\u622A\u3002\n\n## 5. Current Strategic Focus\n\n\u5F53\u524D\u9636\u6BB5\u6700\u91CD\u8981\u7684\u6218\u7565\u53D6\u820D\u662F\u4EC0\u4E48\uFF1F\n\u4F8B\u5982\uFF1A\u9A8C\u8BC1\u75DB\u70B9\u4F18\u5148\u4E8E\u67B6\u6784\u5B8C\u7F8E\uFF1B\u53D1\u5E03 MVP \u4F18\u5148\u4E8E\u529F\u80FD\u5B8C\u6574\uFF1B\u4FDD\u62A4 Owner \u6CE8\u610F\u529B\u4F18\u5148\u4E8E\u81EA\u52A8\u5316\u8986\u76D6\u7387\u3002\n";
|
|
33
|
+
export declare const INTENT_DOC_TEMPLATE_EN = "# INTENT.md\n\n## 1. Why\n\nWhy does this project matter?\nWhat long-term goal does it serve?\nWhat real problem does it solve \u2014 beyond just completing tasks?\n\n## 2. Desired Outcome\n\nAfter completion, what observable change should happen in the world?\nWhat result would indicate we are closer to the goal?\nAvoid non-comparable descriptions like \"make the product better\".\n\n## 3. Non-negotiables\n\nTo achieve the goal, what cannot be sacrificed?\nExamples: Owner attention, user trust, MVP speed, security boundaries, maintainability, brand voice.\n\n## 4. Stop / Escalation\n\nUnder what circumstances must the Agent stop, ask, or escalate to Owner?\n\nNote: These are soft escalation conditions; unless separately encoded into RuleHost, they do not constitute hard blocks.\n\n## 5. Current Strategic Focus\n\nWhat is the most important strategic trade-off for the current phase?\nExamples: Validating pain points over architectural perfection; Shipping MVP over feature completeness; Protecting Owner attention over automation coverage.\n";
|
|
34
|
+
export declare function createIntentTemplate(lang: IntentLang): string;
|
|
35
|
+
//# sourceMappingURL=intent-doc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-doc.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-doc.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAAG,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAAE;AAC/J,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG,eAAe,GAAG,WAAW,GAAG,WAAW,GAAG,cAAc,CAAC;AACpH,MAAM,WAAW,gBAAgB;IAAG,IAAI,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAAE;AACpG,eAAO,MAAM,gBAAgB,QAAY,CAAC;AAU1C,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAYrE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,CAQrE;AACD,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,gBAAgB,EAAE,CAWzF;AACD,eAAO,MAAM,mBAAmB,sUAqB/B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC;AAExC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAE1D;AAED,eAAO,MAAM,sBAAsB,8qDA6BlC,CAAC;AAEF,eAAO,MAAM,sBAAsB,oiCA6BlC,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAG7D"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
export const INTENT_MAX_BYTES = 32 * 1024;
|
|
2
|
+
const MIN_SECTION_LENGTH = 10;
|
|
3
|
+
const SECTION_DEFS = [
|
|
4
|
+
{ key: 'why', headerRegex: /^##\s+1\.\s*Why\s*$/im, label: 'why', header: '## 1. Why' },
|
|
5
|
+
{ key: 'desiredOutcome', headerRegex: /^##\s+2\.\s*Desired Outcome\s*$/im, label: 'desiredOutcome', header: '## 2. Desired Outcome' },
|
|
6
|
+
{ key: 'nonNegotiables', headerRegex: /^##\s+3\.\s*Non-negotiables\s*$/im, label: 'nonNegotiables', header: '## 3. Non-negotiables' },
|
|
7
|
+
{ key: 'stopEscalation', headerRegex: /^##\s+4\.\s*Stop\s*\/\s*Escalation\s*$/im, label: 'stopEscalation', header: '## 4. Stop / Escalation' },
|
|
8
|
+
{ key: 'currentStrategicFocus', headerRegex: /^##\s+5\.\s*Current Strategic Focus\s*$/im, label: 'currentStrategicFocus', header: '## 5. Current Strategic Focus' },
|
|
9
|
+
];
|
|
10
|
+
export function parseIntentDocSections(raw) {
|
|
11
|
+
const sections = {};
|
|
12
|
+
for (const def of SECTION_DEFS) {
|
|
13
|
+
const match = def.headerRegex.exec(raw);
|
|
14
|
+
if (match === null) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const rest = raw.slice(match.index + match[0].length);
|
|
18
|
+
const next = /^##\s+/m.exec(rest);
|
|
19
|
+
// Direct assignment is type-safe: def.key is keyof IntentDocSections,
|
|
20
|
+
// all fields are `string | undefined`, and we assign a string.
|
|
21
|
+
sections[def.key] = rest.slice(0, next !== null ? next.index : rest.length).trim();
|
|
22
|
+
}
|
|
23
|
+
return sections;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Assemble a complete INTENT.md document from individual sections.
|
|
27
|
+
*
|
|
28
|
+
* Symmetric to `parseIntentDocSections`: round-trip
|
|
29
|
+
* `parseIntentDocSections(assembleIntentDoc(sections))` returns the same
|
|
30
|
+
* sections (for non-empty content). Missing sections still emit their header
|
|
31
|
+
* with empty content, so the assembled doc always has all 5 headers in order.
|
|
32
|
+
*
|
|
33
|
+
* Used by the wizard and the section editor to save user input without
|
|
34
|
+
* hand-written string concatenation in the UI layer.
|
|
35
|
+
*/
|
|
36
|
+
export function assembleIntentDoc(sections) {
|
|
37
|
+
const parts = ['# INTENT.md', ''];
|
|
38
|
+
for (const def of SECTION_DEFS) {
|
|
39
|
+
const value = sections[def.key];
|
|
40
|
+
const content = typeof value === 'string' ? value : '';
|
|
41
|
+
parts.push(def.header, '', content, '');
|
|
42
|
+
}
|
|
43
|
+
return parts.join('\n');
|
|
44
|
+
}
|
|
45
|
+
export function validateIntentDocSections(sections) {
|
|
46
|
+
const warnings = [];
|
|
47
|
+
for (const def of SECTION_DEFS) {
|
|
48
|
+
const hasKey = Object.hasOwn(sections, def.key);
|
|
49
|
+
const value = hasKey ? sections[def.key] : undefined;
|
|
50
|
+
if (value === undefined) {
|
|
51
|
+
warnings.push({ code: 'missing_section', message: `Section "${def.label}" is missing from INTENT.md.`, section: def.label });
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (typeof value !== 'string') {
|
|
55
|
+
warnings.push({ code: 'parse_failed', message: `Section "${def.label}" has a non-string value.`, section: def.label });
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (value.trim().length === 0) {
|
|
59
|
+
warnings.push({ code: 'empty_section', message: `Section "${def.label}" is empty.`, section: def.label });
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (value.length < MIN_SECTION_LENGTH) {
|
|
63
|
+
warnings.push({ code: 'too_vague', message: `Section "${def.label}" is too short.`, section: def.label });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return warnings;
|
|
67
|
+
}
|
|
68
|
+
export const INTENT_DOC_TEMPLATE = `# INTENT.md
|
|
69
|
+
|
|
70
|
+
## 1. Why
|
|
71
|
+
|
|
72
|
+
Why does this project matter?
|
|
73
|
+
|
|
74
|
+
## 2. Desired Outcome
|
|
75
|
+
|
|
76
|
+
What observable change should happen?
|
|
77
|
+
|
|
78
|
+
## 3. Non-negotiables
|
|
79
|
+
|
|
80
|
+
What cannot be sacrificed?
|
|
81
|
+
|
|
82
|
+
## 4. Stop / Escalation
|
|
83
|
+
|
|
84
|
+
When must the Agent stop and ask?
|
|
85
|
+
|
|
86
|
+
## 5. Current Strategic Focus
|
|
87
|
+
|
|
88
|
+
What is the current strategic trade-off?
|
|
89
|
+
`;
|
|
90
|
+
export function getIntentFilename(lang) {
|
|
91
|
+
return `INTENT.${lang}.md`;
|
|
92
|
+
}
|
|
93
|
+
export const INTENT_DOC_TEMPLATE_ZH = `# INTENT.md
|
|
94
|
+
|
|
95
|
+
## 1. Why
|
|
96
|
+
|
|
97
|
+
这个项目 / 阶段为什么重要?
|
|
98
|
+
它服务于什么长期目标?
|
|
99
|
+
它不只是要完成什么任务,而是要解决什么真实问题?
|
|
100
|
+
|
|
101
|
+
## 2. Desired Outcome
|
|
102
|
+
|
|
103
|
+
完成后,世界应该发生什么可观察的变化?
|
|
104
|
+
什么结果能说明我们更接近目标?
|
|
105
|
+
避免写"让产品更好"这种不可比较描述。
|
|
106
|
+
|
|
107
|
+
## 3. Non-negotiables
|
|
108
|
+
|
|
109
|
+
为了达成目标,哪些东西不能被牺牲?
|
|
110
|
+
例如:Owner 注意力、用户信任、MVP 速度、安全边界、可维护性、品牌调性。
|
|
111
|
+
|
|
112
|
+
## 4. Stop / Escalation
|
|
113
|
+
|
|
114
|
+
什么情况下 Agent 必须停下、询问或升级给 Owner?
|
|
115
|
+
|
|
116
|
+
注意:这些是软升级条件;除非另行编码进 RuleHost,否则不构成硬拦截。
|
|
117
|
+
|
|
118
|
+
## 5. Current Strategic Focus
|
|
119
|
+
|
|
120
|
+
当前阶段最重要的战略取舍是什么?
|
|
121
|
+
例如:验证痛点优先于架构完美;发布 MVP 优先于功能完整;保护 Owner 注意力优先于自动化覆盖率。
|
|
122
|
+
`;
|
|
123
|
+
export const INTENT_DOC_TEMPLATE_EN = `# INTENT.md
|
|
124
|
+
|
|
125
|
+
## 1. Why
|
|
126
|
+
|
|
127
|
+
Why does this project matter?
|
|
128
|
+
What long-term goal does it serve?
|
|
129
|
+
What real problem does it solve — beyond just completing tasks?
|
|
130
|
+
|
|
131
|
+
## 2. Desired Outcome
|
|
132
|
+
|
|
133
|
+
After completion, what observable change should happen in the world?
|
|
134
|
+
What result would indicate we are closer to the goal?
|
|
135
|
+
Avoid non-comparable descriptions like "make the product better".
|
|
136
|
+
|
|
137
|
+
## 3. Non-negotiables
|
|
138
|
+
|
|
139
|
+
To achieve the goal, what cannot be sacrificed?
|
|
140
|
+
Examples: Owner attention, user trust, MVP speed, security boundaries, maintainability, brand voice.
|
|
141
|
+
|
|
142
|
+
## 4. Stop / Escalation
|
|
143
|
+
|
|
144
|
+
Under what circumstances must the Agent stop, ask, or escalate to Owner?
|
|
145
|
+
|
|
146
|
+
Note: These are soft escalation conditions; unless separately encoded into RuleHost, they do not constitute hard blocks.
|
|
147
|
+
|
|
148
|
+
## 5. Current Strategic Focus
|
|
149
|
+
|
|
150
|
+
What is the most important strategic trade-off for the current phase?
|
|
151
|
+
Examples: Validating pain points over architectural perfection; Shipping MVP over feature completeness; Protecting Owner attention over automation coverage.
|
|
152
|
+
`;
|
|
153
|
+
export function createIntentTemplate(lang) {
|
|
154
|
+
if (lang === 'zh-CN')
|
|
155
|
+
return INTENT_DOC_TEMPLATE_ZH;
|
|
156
|
+
return INTENT_DOC_TEMPLATE_EN;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=intent-doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-doc.js","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-doc.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,MAAM,YAAY,GAAiB;IACjC,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE;IACvF,EAAE,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,mCAAmC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,uBAAuB,EAAE;IACrI,EAAE,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,mCAAmC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,uBAAuB,EAAE;IACrI,EAAE,GAAG,EAAE,gBAAgB,EAAE,WAAW,EAAE,0CAA0C,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,yBAAyB,EAAE;IAC9I,EAAE,GAAG,EAAE,uBAAuB,EAAE,WAAW,EAAE,2CAA2C,EAAE,KAAK,EAAE,uBAAuB,EAAE,MAAM,EAAE,+BAA+B,EAAE;CACpK,CAAC;AACF,MAAM,UAAU,sBAAsB,CAAC,GAAW;IAChD,MAAM,QAAQ,GAAsB,EAAE,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAAC,SAAS;QAAC,CAAC;QACjC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,sEAAsE;QACtE,+DAA+D;QAC/D,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACrF,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAA2B;IAC3D,MAAM,KAAK,GAAa,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC5C,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAI,QAAoC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AACD,MAAM,UAAU,yBAAyB,CAAC,QAA2B;IACnE,MAAM,QAAQ,GAAuB,EAAE,CAAC;IACxC,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAE,QAAoC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAClF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,GAAG,CAAC,KAAK,8BAA8B,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QACpK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,GAAG,CAAC,KAAK,2BAA2B,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QACpK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,GAAG,CAAC,KAAK,aAAa,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QACvJ,IAAI,KAAK,CAAC,MAAM,GAAG,kBAAkB,EAAE,CAAC;YAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,GAAG,CAAC,KAAK,iBAAiB,EAAE,OAAO,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;QAAC,CAAC;IACvJ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AACD,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBlC,CAAC;AAIF,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,OAAO,UAAU,IAAI,KAAK,CAAC;AAC7B,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BrC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BrC,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,IAAgB;IACnD,IAAI,IAAI,KAAK,OAAO;QAAE,OAAO,sBAAsB,CAAC;IACpD,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRI-467 — Pure builder for the Intent Friction Prompt Block.
|
|
3
|
+
*
|
|
4
|
+
* Produces a bounded, escaped `<intent_anchor>` + `<intent_doc>` +
|
|
5
|
+
* `<intent_friction>` block per SPEC §13.2 and §13.3.
|
|
6
|
+
*
|
|
7
|
+
* Trust boundary (SPEC §12.2):
|
|
8
|
+
* - INTENT.md is treated as quoted reference data, never as executable
|
|
9
|
+
* system/tool instructions.
|
|
10
|
+
* - Raw content is XML-escaped before embedding so it cannot break the
|
|
11
|
+
* surrounding prompt block structure or inject live XML tags.
|
|
12
|
+
* - Content is bounded to INTENT_INJECT_MAX_CHARS to avoid prompt budget
|
|
13
|
+
* explosion; oversized content is truncated with a visible marker.
|
|
14
|
+
*
|
|
15
|
+
* Pure logic — no I/O, no side effects, never throws. Callers that have
|
|
16
|
+
* no intent doc (flag off, missing file, read error) should pass `undefined`
|
|
17
|
+
* and receive an empty string.
|
|
18
|
+
*
|
|
19
|
+
* ERR checklist:
|
|
20
|
+
* EP-01 / ERR-001, ERR-005, ERR-009: input validated with typeof, never `as`
|
|
21
|
+
* EP-03 / ERR-002: missing/invalid input returns empty string, never throws
|
|
22
|
+
* EP-09: pure function — independently unit-testable without mocks
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Maximum number of characters of raw INTENT.md content injected into the
|
|
26
|
+
* prompt. Oversized content is truncated with a visible marker so the Agent
|
|
27
|
+
* still knows the doc was bounded.
|
|
28
|
+
*
|
|
29
|
+
* SPEC §12.2 requires bounded injection. 4000 chars is well within the
|
|
30
|
+
* prompt hook size guard budget (9000 chars total) and leaves room for
|
|
31
|
+
* other appendSystemContext blocks.
|
|
32
|
+
*/
|
|
33
|
+
export declare const INTENT_INJECT_MAX_CHARS = 4000;
|
|
34
|
+
/**
|
|
35
|
+
* Input to buildIntentFrictionBlock. `rawIntentMd` is the raw, unescaped
|
|
36
|
+
* INTENT.md file content. The builder escapes and bounds it.
|
|
37
|
+
*/
|
|
38
|
+
export interface IntentFrictionBlockInput {
|
|
39
|
+
rawIntentMd: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Truncation marker appended when raw intent content exceeds the budget.
|
|
43
|
+
* Kept as a constant so tests can match it exactly.
|
|
44
|
+
*/
|
|
45
|
+
export declare const INTENT_TRUNCATION_MARKER = "\n...[truncated: intent doc exceeds injection budget]";
|
|
46
|
+
/**
|
|
47
|
+
* Build the Intent Friction Prompt Block (SPEC §13.2 + §13.3).
|
|
48
|
+
*
|
|
49
|
+
* Returns an empty string when:
|
|
50
|
+
* - input is undefined (flag-off / no-doc path)
|
|
51
|
+
* - rawIntentMd is not a string
|
|
52
|
+
* - rawIntentMd is empty or whitespace-only
|
|
53
|
+
*
|
|
54
|
+
* Otherwise returns a string containing three XML blocks:
|
|
55
|
+
* 1. `<intent_anchor>` — declares INTENT as Owner-owned quoted reference
|
|
56
|
+
* 2. `<intent_doc>` — bounded + XML-escaped raw intent content
|
|
57
|
+
* 3. `<intent_friction>` — instructions for the optional intent_check format
|
|
58
|
+
*
|
|
59
|
+
* The function never throws. Callers can safely pipe the result into
|
|
60
|
+
* appendSystemContext assembly.
|
|
61
|
+
*/
|
|
62
|
+
export declare function buildIntentFrictionBlock(input: IntentFrictionBlockInput | undefined): string;
|
|
63
|
+
//# sourceMappingURL=intent-friction-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-friction-block.d.ts","sourceRoot":"","sources":["../../../src/runtime-v2/intent/intent-friction-block.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,0DACoB,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,wBAAwB,GAAG,SAAS,GAC1C,MAAM,CA8ER"}
|