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,223 @@
|
|
|
1
|
+
import { IntentPageModel } from '../models/IntentPageModel.js';
|
|
2
|
+
import { sendSuccess, sendError, sendJson } from '../utils/response.js';
|
|
3
|
+
import { loadPdConfig, computeFlagsFromLoadResult } from '../config/pd-config-store.js';
|
|
4
|
+
import { readBody } from '../utils/request.js';
|
|
5
|
+
/** Parse lang from query string; default 'zh-CN' if missing/invalid. */
|
|
6
|
+
function parseLang(req) {
|
|
7
|
+
const url = new URL(req.url ?? '', 'http://localhost');
|
|
8
|
+
const lang = url.searchParams.get('lang');
|
|
9
|
+
return lang === 'en' ? 'en' : 'zh-CN';
|
|
10
|
+
}
|
|
11
|
+
const MODEL_CACHE_TTL_MS = 30 * 1000;
|
|
12
|
+
const models = new Map();
|
|
13
|
+
function getModel(workspaceDir) {
|
|
14
|
+
const cached = models.get(workspaceDir);
|
|
15
|
+
if (cached && Date.now() - cached.cachedAt < MODEL_CACHE_TTL_MS) {
|
|
16
|
+
return cached.model;
|
|
17
|
+
}
|
|
18
|
+
const model = new IntentPageModel(workspaceDir);
|
|
19
|
+
models.set(workspaceDir, { model, cachedAt: Date.now() });
|
|
20
|
+
return model;
|
|
21
|
+
}
|
|
22
|
+
/** Load the intent_engineering flag state from config. */
|
|
23
|
+
function loadFlagEnabled(workspaceDir) {
|
|
24
|
+
const configResult = loadPdConfig(workspaceDir);
|
|
25
|
+
const flagsResult = computeFlagsFromLoadResult(configResult);
|
|
26
|
+
return flagsResult.flags.intent_engineering?.enabled === true;
|
|
27
|
+
}
|
|
28
|
+
/** Send a structured error with reason + nextAction (Runtime Contract Rule #9). */
|
|
29
|
+
function sendStructuredError(res, payload) {
|
|
30
|
+
sendError(res, payload.statusCode, payload.error, payload.reason, {
|
|
31
|
+
reason: payload.reason,
|
|
32
|
+
nextAction: payload.nextAction,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export async function handleIntentRoute(req, res, ctx) {
|
|
36
|
+
const { workspaceDir, subPath } = ctx;
|
|
37
|
+
const lang = parseLang(req);
|
|
38
|
+
try {
|
|
39
|
+
// ── GET /api/v1/intent — read Intent summary ──────────────────────────
|
|
40
|
+
if (req.method === 'GET' && subPath === '') {
|
|
41
|
+
const flagEnabled = loadFlagEnabled(workspaceDir);
|
|
42
|
+
const model = getModel(workspaceDir);
|
|
43
|
+
const summary = await model.getSummary(flagEnabled, lang);
|
|
44
|
+
sendSuccess(res, summary);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// ── GET /api/v1/intent/content — read raw INTENT.md for editing ─────────
|
|
48
|
+
if (req.method === 'GET' && subPath === '/content') {
|
|
49
|
+
const flagEnabled = loadFlagEnabled(workspaceDir);
|
|
50
|
+
if (!flagEnabled) {
|
|
51
|
+
sendStructuredError(res, {
|
|
52
|
+
statusCode: 403,
|
|
53
|
+
error: 'flag_disabled',
|
|
54
|
+
reason: 'flag_disabled',
|
|
55
|
+
nextAction: 'Enable the intent_engineering feature flag first.',
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const model = getModel(workspaceDir);
|
|
60
|
+
const result = await model.getRawContent(flagEnabled, lang);
|
|
61
|
+
if (!result.ok) {
|
|
62
|
+
// Map model error reason → HTTP status (rc-9-no-silent-fallback).
|
|
63
|
+
// not_found → 404; oversized → 413 (Payload Too Large, matches the
|
|
64
|
+
// byte-budget contract with getSummary); read_error / unknown → 500.
|
|
65
|
+
const statusCode = result.reason === 'not_found' ? 404 :
|
|
66
|
+
result.reason === 'oversized' ? 413 :
|
|
67
|
+
result.reason === 'flag_disabled' ? 403 :
|
|
68
|
+
500;
|
|
69
|
+
sendStructuredError(res, {
|
|
70
|
+
statusCode,
|
|
71
|
+
error: result.reason ?? 'intent_content_error',
|
|
72
|
+
reason: result.reason ?? 'unknown',
|
|
73
|
+
nextAction: result.nextAction,
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
sendSuccess(res, { content: result.content, path: result.path });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// ── GET /api/v1/intent/versions — list version history ────────────────
|
|
81
|
+
if (req.method === 'GET' && subPath === '/versions') {
|
|
82
|
+
const model = getModel(workspaceDir);
|
|
83
|
+
const result = await model.getVersions(lang);
|
|
84
|
+
if (!result.ok) {
|
|
85
|
+
sendSuccess(res, { versions: [], reason: result.reason, nextAction: result.nextAction });
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
sendSuccess(res, { versions: result.versions });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// ── POST /api/v1/intent/init — create INTENT.md template ──────────────
|
|
92
|
+
if (req.method === 'POST' && subPath === '/init') {
|
|
93
|
+
const flagEnabled = loadFlagEnabled(workspaceDir);
|
|
94
|
+
if (!flagEnabled) {
|
|
95
|
+
sendStructuredError(res, {
|
|
96
|
+
statusCode: 403,
|
|
97
|
+
error: 'flag_disabled',
|
|
98
|
+
reason: 'flag_disabled',
|
|
99
|
+
nextAction: 'Enable the intent_engineering feature flag first.',
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const body = await readBody(req);
|
|
104
|
+
let parsedBody = {};
|
|
105
|
+
if (body.trim().length > 0) {
|
|
106
|
+
try {
|
|
107
|
+
parsedBody = JSON.parse(body);
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
sendStructuredError(res, {
|
|
111
|
+
statusCode: 400,
|
|
112
|
+
error: 'bad_request',
|
|
113
|
+
reason: 'invalid_json',
|
|
114
|
+
nextAction: 'Request body must be valid JSON.',
|
|
115
|
+
});
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Extract force flag (default false — don't overwrite existing file)
|
|
120
|
+
let force = false;
|
|
121
|
+
if (parsedBody !== null && typeof parsedBody === 'object' && Object.hasOwn(parsedBody, 'force')) {
|
|
122
|
+
const forceVal = parsedBody.force;
|
|
123
|
+
if (typeof forceVal === 'boolean') {
|
|
124
|
+
force = forceVal;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const model = getModel(workspaceDir);
|
|
128
|
+
const result = await model.createTemplate(flagEnabled, force, lang);
|
|
129
|
+
if (result.ok) {
|
|
130
|
+
if (result.created) {
|
|
131
|
+
sendJson(res, 201, { success: true, data: result });
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
// already_exists — return 200 with reason
|
|
135
|
+
sendSuccess(res, result);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
sendStructuredError(res, {
|
|
140
|
+
statusCode: 500,
|
|
141
|
+
error: 'intent_init_error',
|
|
142
|
+
reason: result.reason ?? 'unknown',
|
|
143
|
+
nextAction: result.nextAction,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// ── PUT /api/v1/intent/content — save INTENT.md content ───────────────
|
|
149
|
+
if (req.method === 'PUT' && subPath === '/content') {
|
|
150
|
+
const flagEnabled = loadFlagEnabled(workspaceDir);
|
|
151
|
+
if (!flagEnabled) {
|
|
152
|
+
sendStructuredError(res, {
|
|
153
|
+
statusCode: 403,
|
|
154
|
+
error: 'flag_disabled',
|
|
155
|
+
reason: 'flag_disabled',
|
|
156
|
+
nextAction: 'Enable the intent_engineering feature flag first.',
|
|
157
|
+
});
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const body = await readBody(req);
|
|
161
|
+
let parsedBody;
|
|
162
|
+
try {
|
|
163
|
+
parsedBody = JSON.parse(body);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
sendStructuredError(res, {
|
|
167
|
+
statusCode: 400,
|
|
168
|
+
error: 'bad_request',
|
|
169
|
+
reason: 'invalid_json',
|
|
170
|
+
nextAction: 'Request body must be valid JSON.',
|
|
171
|
+
});
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
// Runtime Contract Rule #1: treat as unknown, validate with Object.hasOwn
|
|
175
|
+
if (parsedBody === null || typeof parsedBody !== 'object' || Array.isArray(parsedBody)) {
|
|
176
|
+
sendStructuredError(res, {
|
|
177
|
+
statusCode: 400,
|
|
178
|
+
error: 'bad_request',
|
|
179
|
+
reason: 'invalid_body',
|
|
180
|
+
nextAction: 'Request body must be a JSON object with a "content" field.',
|
|
181
|
+
});
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const bodyObj = parsedBody;
|
|
185
|
+
if (!Object.hasOwn(bodyObj, 'content')) {
|
|
186
|
+
sendStructuredError(res, {
|
|
187
|
+
statusCode: 400,
|
|
188
|
+
error: 'bad_request',
|
|
189
|
+
reason: 'missing_content',
|
|
190
|
+
nextAction: 'Request body must include a "content" string field.',
|
|
191
|
+
});
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const model = getModel(workspaceDir);
|
|
195
|
+
const result = await model.saveContent(flagEnabled, bodyObj.content, lang);
|
|
196
|
+
if (result.ok) {
|
|
197
|
+
sendSuccess(res, result);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
// Map known reasons to HTTP status codes
|
|
201
|
+
const statusCode = result.reason === 'invalid_content' || result.reason === 'empty_content' || result.reason === 'oversized'
|
|
202
|
+
? 400
|
|
203
|
+
: 500;
|
|
204
|
+
sendStructuredError(res, {
|
|
205
|
+
statusCode,
|
|
206
|
+
error: 'intent_save_error',
|
|
207
|
+
reason: result.reason ?? 'unknown',
|
|
208
|
+
nextAction: result.nextAction,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
// ── Unknown sub-path ──────────────────────────────────────────────────
|
|
214
|
+
sendError(res, 404, 'not_found', `Route /api/v1/intent${subPath} not found`);
|
|
215
|
+
}
|
|
216
|
+
catch (err) {
|
|
217
|
+
sendError(res, 500, 'intent_route_error', err instanceof Error ? err.message : 'Unknown error');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export function disposeIntentModels() {
|
|
221
|
+
// IntentPageModel holds no persistent resources; just clear the cache.
|
|
222
|
+
models.clear();
|
|
223
|
+
}
|
|
@@ -73,11 +73,77 @@ async function getDecidedPrincipleIds(workspaceDir) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
export async function handlePrinciplesRoute({ req, res, workspaceDir, subPath, }) {
|
|
76
|
+
const model = getModel(workspaceDir);
|
|
77
|
+
// ── POST Routes ─────────────────────────────────────────────────────────────
|
|
78
|
+
if (req.method === 'POST') {
|
|
79
|
+
// POST /api/principles/:id/archive
|
|
80
|
+
const archiveMatch = /^\/([^/]*)\/archive$/.exec(subPath);
|
|
81
|
+
if (archiveMatch) {
|
|
82
|
+
const [, rawPrincipleId] = archiveMatch;
|
|
83
|
+
if (!rawPrincipleId) {
|
|
84
|
+
sendError(res, 400, 'invalid_principle_id', 'Principle ID is missing');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
let principleId;
|
|
88
|
+
try {
|
|
89
|
+
principleId = decodeURIComponent(rawPrincipleId);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
sendError(res, 400, 'invalid_principle_id', 'Principle ID contains invalid URL encoding');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const ok = await model.archivePrinciple(principleId);
|
|
97
|
+
if (ok) {
|
|
98
|
+
sendSuccess(res, { success: true, principleId });
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
sendError(res, 500, 'archive_failed', `Failed to archive principle "${principleId}"`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
sendError(res, 500, 'archive_failed', err instanceof Error ? err.message : String(err));
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// POST /api/principles/:id/unarchive
|
|
110
|
+
const unarchiveMatch = /^\/([^/]*)\/unarchive$/.exec(subPath);
|
|
111
|
+
if (unarchiveMatch) {
|
|
112
|
+
const [, rawPrincipleId] = unarchiveMatch;
|
|
113
|
+
if (!rawPrincipleId) {
|
|
114
|
+
sendError(res, 400, 'invalid_principle_id', 'Principle ID is missing');
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
let principleId;
|
|
118
|
+
try {
|
|
119
|
+
principleId = decodeURIComponent(rawPrincipleId);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
sendError(res, 400, 'invalid_principle_id', 'Principle ID contains invalid URL encoding');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
const ok = await model.unarchivePrinciple(principleId);
|
|
127
|
+
if (ok) {
|
|
128
|
+
sendSuccess(res, { success: true, principleId });
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
sendError(res, 500, 'unarchive_failed', `Failed to unarchive principle "${principleId}"`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
sendError(res, 500, 'unarchive_failed', err instanceof Error ? err.message : String(err));
|
|
136
|
+
}
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
sendNotFound(res, `Route ${req.method} /api/principles${subPath} not found`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// ── GET Routes ──────────────────────────────────────────────────────────────
|
|
76
143
|
if (req.method !== 'GET') {
|
|
77
144
|
sendNotFound(res, `Route /api/principles${subPath} not found`);
|
|
78
145
|
return;
|
|
79
146
|
}
|
|
80
|
-
const model = getModel(workspaceDir);
|
|
81
147
|
if (subPath === '' || subPath === '/') {
|
|
82
148
|
try {
|
|
83
149
|
// Parse query string for filter parameter
|
|
@@ -183,6 +183,11 @@ async function doCheckForUpdates(currentVersion) {
|
|
|
183
183
|
return {
|
|
184
184
|
hasUpdate: false,
|
|
185
185
|
currentVersion,
|
|
186
|
+
// Contract with the UI (UpdatePage.tsx) requires latestVersion to be a
|
|
187
|
+
// string. When the registry check fails we don't know the latest version,
|
|
188
|
+
// so emit an empty string to keep the response shape stable and let the
|
|
189
|
+
// UI surface `error` instead of crashing the whole page.
|
|
190
|
+
latestVersion: '',
|
|
186
191
|
error: error instanceof Error ? error.message : 'Unknown error',
|
|
187
192
|
};
|
|
188
193
|
}
|
|
@@ -369,9 +374,17 @@ export async function handleUpdateRoute(req, res, workspaceDir, subPath) {
|
|
|
369
374
|
return;
|
|
370
375
|
}
|
|
371
376
|
try {
|
|
377
|
+
// ERR-002 / Runtime Contract Rule 9: 当无法确定当前版本时(如插件未安装),
|
|
378
|
+
// 返回 degraded 状态 + reason,而非 500。前端 validateUpdateStatus 要求
|
|
379
|
+
// currentVersion/latestVersion 为 string,hasUpdate 为 boolean。
|
|
372
380
|
const currentVersion = readCurrentVersion(pluginDir);
|
|
373
381
|
if (!currentVersion) {
|
|
374
|
-
|
|
382
|
+
sendSuccess(res, {
|
|
383
|
+
hasUpdate: false,
|
|
384
|
+
currentVersion: 'unknown',
|
|
385
|
+
latestVersion: '',
|
|
386
|
+
error: 'Could not determine current version (plugin not installed)',
|
|
387
|
+
});
|
|
375
388
|
return;
|
|
376
389
|
}
|
|
377
390
|
const result = await doCheckForUpdates(currentVersion);
|
|
@@ -427,16 +440,6 @@ export async function handleUpdateRoute(req, res, workspaceDir, subPath) {
|
|
|
427
440
|
}
|
|
428
441
|
return;
|
|
429
442
|
}
|
|
430
|
-
// GET /status
|
|
431
|
-
if (subPath === '/status') {
|
|
432
|
-
if (req.method !== 'GET') {
|
|
433
|
-
sendMethodNotAllowed(res);
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
const currentVersion = readCurrentVersion(pluginDir) ?? 'unknown';
|
|
437
|
-
sendSuccess(res, { checking: false, updating: false, currentVersion });
|
|
438
|
-
return;
|
|
439
|
-
}
|
|
440
443
|
// POST /rollback
|
|
441
444
|
if (subPath === '/rollback') {
|
|
442
445
|
if (req.method !== 'POST') {
|
package/console/dist/types.d.ts
CHANGED
package/console/dist/ui/App.js
CHANGED
|
@@ -22,6 +22,7 @@ import { ControlCenterPage } from "./pages/control-center/ControlCenterPage.js";
|
|
|
22
22
|
import { SettingsPage } from "./pages/settings/SettingsPage.js";
|
|
23
23
|
import { UpdatePage } from "./pages/settings/UpdatePage.js";
|
|
24
24
|
import { ReportProblemPage } from "./pages/report-problem/ReportProblemPage.js";
|
|
25
|
+
import { IntentPage } from "./pages/intent/IntentPage.js";
|
|
25
26
|
import { DesignSystemPage } from "./pages/design-system/DesignSystemPage.js";
|
|
26
27
|
// Vite replaces import.meta.env.DEV with a boolean literal at build time.
|
|
27
28
|
// The cast avoids TS2339 without needing a generated .d.ts file.
|
|
@@ -37,65 +38,6 @@ function AuthRoutes() {
|
|
|
37
38
|
useEffect(() => {
|
|
38
39
|
verifyAuth();
|
|
39
40
|
}, [verifyAuth]);
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (authed !== true)
|
|
42
|
-
return;
|
|
43
|
-
const handleKeyDown = (e) => {
|
|
44
|
-
console.log('handleKeyDown event:', e.key, 'altKey:', e.altKey);
|
|
45
|
-
if (!e.altKey)
|
|
46
|
-
return;
|
|
47
|
-
const target = e.target;
|
|
48
|
-
if (target &&
|
|
49
|
-
(target.tagName === "INPUT" ||
|
|
50
|
-
target.tagName === "TEXTAREA" ||
|
|
51
|
-
target.tagName === "SELECT" ||
|
|
52
|
-
target.isContentEditable)) {
|
|
53
|
-
console.log('handleKeyDown ignored: input focused');
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
let targetPath = null;
|
|
57
|
-
switch (e.key) {
|
|
58
|
-
case "3":
|
|
59
|
-
targetPath = "/focus";
|
|
60
|
-
break;
|
|
61
|
-
case "4":
|
|
62
|
-
targetPath = "/pain";
|
|
63
|
-
break;
|
|
64
|
-
case "5":
|
|
65
|
-
targetPath = "/principles";
|
|
66
|
-
break;
|
|
67
|
-
case "6":
|
|
68
|
-
targetPath = "/activation";
|
|
69
|
-
break;
|
|
70
|
-
case "7":
|
|
71
|
-
targetPath = "/debt";
|
|
72
|
-
break;
|
|
73
|
-
case "8":
|
|
74
|
-
targetPath = "/control-center";
|
|
75
|
-
break;
|
|
76
|
-
case "9":
|
|
77
|
-
targetPath = "/report-problem";
|
|
78
|
-
break;
|
|
79
|
-
case "0":
|
|
80
|
-
targetPath = "/settings";
|
|
81
|
-
break;
|
|
82
|
-
default:
|
|
83
|
-
console.log('handleKeyDown: key mismatch:', e.key);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (targetPath) {
|
|
87
|
-
console.log('handleKeyDown navigating to:', targetPath);
|
|
88
|
-
e.preventDefault();
|
|
89
|
-
navigate(targetPath);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
console.log('Registering handleKeyDown listener');
|
|
93
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
94
|
-
return () => {
|
|
95
|
-
console.log('Removing handleKeyDown listener');
|
|
96
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
97
|
-
};
|
|
98
|
-
}, [authed, navigate]);
|
|
99
41
|
useEffect(() => {
|
|
100
42
|
if (!showSplash)
|
|
101
43
|
return;
|
|
@@ -125,7 +67,7 @@ function AuthRoutes() {
|
|
|
125
67
|
else {
|
|
126
68
|
navigate("/login", { replace: true });
|
|
127
69
|
}
|
|
128
|
-
} }) }), _jsx(Route, { path: "/login", element: _jsx(LoginForm, { onAuthSuccess: handleAuthSuccess }) }), _jsx(Route, { path: "/*", element: authed === null ? (_jsx("div", { className: "min-h-screen bg-paper flex items-center justify-center", children: _jsxs("div", { className: "flex flex-col items-center gap-4", children: [_jsx("div", { className: "w-8 h-8 border-2 border-gov border-t-transparent rounded-full animate-spin" }), _jsx("span", { className: "text-[12px] font-mono tracking-wider text-ink-3 uppercase", children: "Verifying Session..." })] }) })) : authed ? (_jsx(NotificationProvider, { children: _jsxs("div", { className: "min-h-screen bg-paper text-ink", children: [_jsx("a", { href: "#main-content", className: "sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-4 focus:bg-paper focus:text-ink", children: "Skip to main content" }), _jsx(AppSidebar, {}), _jsx("main", { id: "main-content", className: "ml-[256px] min-h-screen overflow-y-auto", children: _jsx(ErrorBoundary, { children: _jsxs(Routes, { children: [_jsx(Route, { path: "/", element: _jsx(Navigate, { to: "/focus", replace: true }) }), _jsx(Route, { path: "/focus", element: _jsx(FocusPage, {}) }), _jsx(Route, { path: "/pain", element: _jsx(PainPage, {}) }), _jsx(Route, { path: "/principles", element: _jsx(PrinciplesPage, {}) }), _jsx(Route, { path: "/principles/:id", element: _jsx(PrincipleDetailPage, {}) }), _jsx(Route, { path: "/activation", element: _jsx(ActivationPage, {}) }), _jsx(Route, { path: "/debt", element: _jsx(DebtPage, {}) }), _jsx(Route, { path: "/control-center", element: _jsx(ControlCenterPage, {}) }), _jsx(Route, { path: "/settings", element: _jsx(SettingsPage, {}) }), _jsx(Route, { path: "/update", element: _jsx(UpdatePage, {}) }), _jsx(Route, { path: "/report-problem", element: _jsx(ReportProblemPage, {}) }), IS_DEV && (_jsx(Route, { path: "/design-system", element: _jsx(DesignSystemPage, {}) })), !IS_DEV && (_jsx(Route, { path: "/design-system", element: _jsx(Navigate, { to: "/focus", replace: true }) }))] }) }) })] }) })) : (_jsx(Navigate, { to: "/login", replace: true })) })] }));
|
|
70
|
+
} }) }), _jsx(Route, { path: "/login", element: _jsx(LoginForm, { onAuthSuccess: handleAuthSuccess }) }), _jsx(Route, { path: "/*", element: authed === null ? (_jsx("div", { className: "min-h-screen bg-paper flex items-center justify-center", children: _jsxs("div", { className: "flex flex-col items-center gap-4", children: [_jsx("div", { className: "w-8 h-8 border-2 border-gov border-t-transparent rounded-full animate-spin" }), _jsx("span", { className: "text-[12px] font-mono tracking-wider text-ink-3 uppercase", children: "Verifying Session..." })] }) })) : authed ? (_jsx(NotificationProvider, { children: _jsxs("div", { className: "min-h-screen bg-paper text-ink", children: [_jsx("a", { href: "#main-content", className: "sr-only focus:not-sr-only focus:absolute focus:z-50 focus:p-4 focus:bg-paper focus:text-ink", children: "Skip to main content" }), _jsx(AppSidebar, {}), _jsx("main", { id: "main-content", className: "ml-[256px] min-h-screen overflow-y-auto", children: _jsx(ErrorBoundary, { children: _jsxs(Routes, { children: [_jsx(Route, { path: "/", element: _jsx(Navigate, { to: "/focus", replace: true }) }), _jsx(Route, { path: "/focus", element: _jsx(FocusPage, {}) }), _jsx(Route, { path: "/pain", element: _jsx(PainPage, {}) }), _jsx(Route, { path: "/principles", element: _jsx(PrinciplesPage, {}) }), _jsx(Route, { path: "/principles/:id", element: _jsx(PrincipleDetailPage, {}) }), _jsx(Route, { path: "/activation", element: _jsx(ActivationPage, {}) }), _jsx(Route, { path: "/debt", element: _jsx(DebtPage, {}) }), _jsx(Route, { path: "/control-center", element: _jsx(ControlCenterPage, {}) }), _jsx(Route, { path: "/settings", element: _jsx(SettingsPage, {}) }), _jsx(Route, { path: "/update", element: _jsx(UpdatePage, {}) }), _jsx(Route, { path: "/report-problem", element: _jsx(ReportProblemPage, {}) }), _jsx(Route, { path: "/intent", element: _jsx(IntentPage, {}) }), IS_DEV && (_jsx(Route, { path: "/design-system", element: _jsx(DesignSystemPage, {}) })), !IS_DEV && (_jsx(Route, { path: "/design-system", element: _jsx(Navigate, { to: "/focus", replace: true }) }))] }) }) })] }) })) : (_jsx(Navigate, { to: "/login", replace: true })) })] }));
|
|
129
71
|
}
|
|
130
72
|
export function App() {
|
|
131
73
|
return (_jsx(ThemeProvider, { children: _jsxs(I18nextProvider, { i18n: i18n, children: [_jsx(HashRouter, { children: _jsx(AuthRoutes, {}) }), _jsx(Toaster, {})] }) }));
|
package/console/dist/ui/api.d.ts
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import type { ApiResponse } from "../types.js";
|
|
2
|
-
import type { FeedbackReportData, FeedbackDraftSummaryData, FeedbackDraftEnvelopeData, DeleteEnvelopeData, WorkspaceEntryData, RemovedEnvelopeData, SyncResultData, ConfigSummaryData, ConfigCatalogData, AgentBindingUpdateData, DefaultRuntimeUpdateData, OutputLanguageData, GovernanceQueueData, ActivationsData, DisableActivationData, LifecycleMetricsData, UpdateStatusData, UpdateHistoryData, ApplyUpdateResultData, RollbackResultData, ApprovalRecordData, PrinciplesListData, ApprovalsGroupedData, EvidenceChainData, TrajectoryData } from "./utils/validators.js";
|
|
2
|
+
import type { FeedbackReportData, FeedbackDraftSummaryData, FeedbackDraftEnvelopeData, DeleteEnvelopeData, WorkspaceEntryData, RemovedEnvelopeData, SyncResultData, ConfigSummaryData, ConfigCatalogData, AgentBindingUpdateData, DefaultRuntimeUpdateData, FeatureFlagUpdateData, OutputLanguageData, GovernanceQueueData, ActivationsData, DisableActivationData, LifecycleMetricsData, UpdateStatusData, UpdateHistoryData, ApplyUpdateResultData, RollbackResultData, ApprovalRecordData, PrinciplesListData, ApprovalsGroupedData, EvidenceChainData, TrajectoryData, IntentSummaryData, IntentDecisionRecordData, IntentDecisionResultData, IntentDecisionSummaryData, FollowUpResponseData, IntentInitResultData, IntentSaveResultData, IntentRawContentData, IntentVersionData } from "./utils/validators.js";
|
|
3
3
|
declare function getToken(): string | null;
|
|
4
4
|
declare function setToken(token: string): void;
|
|
5
5
|
declare function clearToken(): void;
|
|
6
|
-
/**
|
|
7
|
-
* Send an authenticated request to the Console API.
|
|
8
|
-
*
|
|
9
|
-
* Two overloads:
|
|
10
|
-
* 1. request(path, options?) → ApiResponse<unknown>
|
|
11
|
-
* For endpoints without a runtime validator (health checks, etc.).
|
|
12
|
-
* The caller receives unvalidated data and must not assume a specific shape.
|
|
13
|
-
*
|
|
14
|
-
* 2. request<T>(path, options, validate) → ApiResponse<T>
|
|
15
|
-
* For endpoints with a runtime validator. The validator is applied to the
|
|
16
|
-
* raw response; if validation fails, returns an error envelope instead.
|
|
17
|
-
*/
|
|
18
|
-
declare function request(path: string, options?: RequestInit): Promise<ApiResponse<unknown>>;
|
|
19
|
-
declare function request<T>(path: string, options: RequestInit | undefined, validate: (value: unknown) => T | null): Promise<ApiResponse<T>>;
|
|
20
6
|
declare function checkAuth(): Promise<boolean>;
|
|
21
7
|
declare function fetchWorkspaces(): Promise<ApiResponse<WorkspaceEntryData[]>>;
|
|
22
8
|
declare function addWorkspace(name: string, path: string): Promise<ApiResponse<WorkspaceEntryData>>;
|
|
@@ -24,8 +10,9 @@ declare function removeWorkspace(name: string): Promise<ApiResponse<RemovedEnvel
|
|
|
24
10
|
declare function syncWorkspace(name: string): Promise<ApiResponse<SyncResultData>>;
|
|
25
11
|
declare function fetchPrinciples(filter?: 'all' | 'actionable'): Promise<ApiResponse<PrinciplesListData>>;
|
|
26
12
|
declare function fetchPrincipleDetail(principleId: string): Promise<ApiResponse<unknown>>;
|
|
13
|
+
declare function archivePrinciple(principleId: string): Promise<ApiResponse<unknown>>;
|
|
14
|
+
declare function unarchivePrinciple(principleId: string): Promise<ApiResponse<unknown>>;
|
|
27
15
|
declare function fetchPrincipleTrajectory(principleId: string): Promise<ApiResponse<TrajectoryData>>;
|
|
28
|
-
declare function fetchApprovalDetail(approvalId: string): Promise<ApiResponse<ApprovalRecordData>>;
|
|
29
16
|
declare function approveApproval(approvalId: string, note?: string): Promise<ApiResponse<ApprovalRecordData>>;
|
|
30
17
|
declare function rejectApproval(approvalId: string, reason: string): Promise<ApiResponse<ApprovalRecordData>>;
|
|
31
18
|
declare function editApproval(approvalId: string, newArtifactId: string, editReason: string): Promise<ApiResponse<ApprovalRecordData>>;
|
|
@@ -39,6 +26,7 @@ declare function fetchConfigSummary(): Promise<ApiResponse<ConfigSummaryData>>;
|
|
|
39
26
|
declare function fetchConfigCatalog(): Promise<ApiResponse<ConfigCatalogData>>;
|
|
40
27
|
declare function updateAgentBinding(agentName: string, runtimeProfile: string, enabled: boolean): Promise<ApiResponse<AgentBindingUpdateData>>;
|
|
41
28
|
declare function updateDefaultRuntime(defaultRuntime: string): Promise<ApiResponse<DefaultRuntimeUpdateData>>;
|
|
29
|
+
declare function patchFeatureFlag(featureName: string, enabled: boolean): Promise<ApiResponse<FeatureFlagUpdateData>>;
|
|
42
30
|
declare function fetchOutputLanguage(): Promise<ApiResponse<OutputLanguageData>>;
|
|
43
31
|
declare function updateOutputLanguage(outputLanguage: string): Promise<ApiResponse<OutputLanguageData>>;
|
|
44
32
|
declare function fetchGovernanceQueue(): Promise<ApiResponse<GovernanceQueueData>>;
|
|
@@ -51,8 +39,60 @@ declare function fetchUpdateHistory(): Promise<ApiResponse<UpdateHistoryData>>;
|
|
|
51
39
|
declare function applyUpdate(): Promise<ApiResponse<ApplyUpdateResultData>>;
|
|
52
40
|
declare function rollbackUpdate(backupDir: string): Promise<ApiResponse<RollbackResultData>>;
|
|
53
41
|
declare function fetchEvidenceChain(): Promise<ApiResponse<EvidenceChainData>>;
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
declare function fetchIntentSummary(lang?: 'zh-CN' | 'en'): Promise<ApiResponse<IntentSummaryData>>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetch raw INTENT.md content for editing via GET /api/v1/intent/content.
|
|
45
|
+
*/
|
|
46
|
+
declare function fetchIntentContent(lang?: 'zh-CN' | 'en'): Promise<ApiResponse<IntentRawContentData>>;
|
|
47
|
+
/**
|
|
48
|
+
* Create INTENT.md from the SPEC §7 template via POST /api/v1/intent/init.
|
|
49
|
+
* Does NOT overwrite an existing file unless force=true.
|
|
50
|
+
*/
|
|
51
|
+
declare function createIntentTemplate(force?: boolean, lang?: 'zh-CN' | 'en'): Promise<ApiResponse<IntentInitResultData>>;
|
|
52
|
+
/**
|
|
53
|
+
* Save user-edited INTENT.md content via PUT /api/v1/intent/content.
|
|
54
|
+
*/
|
|
55
|
+
declare function saveIntentContent(content: string, lang?: 'zh-CN' | 'en'): Promise<ApiResponse<IntentSaveResultData>>;
|
|
56
|
+
declare function fetchIntentVersions(lang?: 'zh-CN' | 'en'): Promise<ApiResponse<IntentVersionData>>;
|
|
57
|
+
/**
|
|
58
|
+
* Frontend-friendly payload for recording an Owner decision on an intent tension.
|
|
59
|
+
* Field names match the server's `IntentDecisionInput` contract (SPEC §21.7).
|
|
60
|
+
*/
|
|
61
|
+
export interface IntentDecisionInputPayload {
|
|
62
|
+
id: string;
|
|
63
|
+
taskId: string;
|
|
64
|
+
source: string;
|
|
65
|
+
evidenceStrength: string;
|
|
66
|
+
relatedIntentFields: string[];
|
|
67
|
+
evidenceRefs: string[];
|
|
68
|
+
ownerAction: string;
|
|
69
|
+
painId?: string;
|
|
70
|
+
intentDocHash?: string;
|
|
71
|
+
note?: string;
|
|
72
|
+
}
|
|
73
|
+
declare function recordIntentDecision(payload: IntentDecisionInputPayload): Promise<ApiResponse<IntentDecisionResultData>>;
|
|
74
|
+
declare function listIntentDecisionsByPainId(painId: string): Promise<ApiResponse<IntentDecisionRecordData[]>>;
|
|
75
|
+
declare function listIntentDecisionsByTaskId(taskId: string): Promise<ApiResponse<IntentDecisionRecordData[]>>;
|
|
76
|
+
declare function fetchIntentDecisionSummary(): Promise<ApiResponse<IntentDecisionSummaryData>>;
|
|
77
|
+
/**
|
|
78
|
+
* Payload for dispatching a governed follow-up action after an Owner decision
|
|
79
|
+
* has been persisted (SPEC §22.1.4).
|
|
80
|
+
*
|
|
81
|
+
* - `link_candidate`: link an existing principle candidate to this decision.
|
|
82
|
+
* `candidateId` is required.
|
|
83
|
+
* - `guide_rulehost`: get CLI guidance for promoting to RuleHost. No DB write.
|
|
84
|
+
* - `generate_patch_proposal`: generate a read-only Intent Patch Proposal.
|
|
85
|
+
*
|
|
86
|
+
* The server validates `type` and `candidateId` (when required); the frontend
|
|
87
|
+
* trusts the server to fail loud on invalid input (Rule 3).
|
|
88
|
+
*/
|
|
89
|
+
export interface FollowUpPayload {
|
|
90
|
+
type: 'link_candidate' | 'guide_rulehost' | 'generate_patch_proposal';
|
|
91
|
+
candidateId?: string;
|
|
92
|
+
}
|
|
93
|
+
declare function dispatchFollowUp(decisionId: string, payload: FollowUpPayload): Promise<ApiResponse<FollowUpResponseData>>;
|
|
94
|
+
export { getToken, setToken, clearToken, checkAuth, approveApproval, rejectApproval, editApproval, fetchPrinciples, fetchPrincipleDetail, fetchPrincipleTrajectory, archivePrinciple, unarchivePrinciple, createFeedbackReport, listFeedbackReports, getFeedbackReport, deleteFeedbackReport, fetchConfigSummary, fetchConfigCatalog, updateAgentBinding, updateDefaultRuntime, patchFeatureFlag, fetchOutputLanguage, updateOutputLanguage, fetchWorkspaces, addWorkspace, removeWorkspace, syncWorkspace, fetchGovernanceQueue, fetchApprovalsGrouped, fetchAllActivations, disableActivation, fetchLifecycleMetrics, fetchUpdateStatus, fetchUpdateHistory, applyUpdate, rollbackUpdate, fetchEvidenceChain, fetchIntentSummary, fetchIntentContent, createIntentTemplate, saveIntentContent, fetchIntentVersions, recordIntentDecision, listIntentDecisionsByPainId, listIntentDecisionsByTaskId, fetchIntentDecisionSummary, dispatchFollowUp, };
|
|
95
|
+
export type { FeedbackReportData, FeedbackDraftSummaryData, FeedbackDraftEnvelopeData, DeleteEnvelopeData, WorkspaceEntryData, RemovedEnvelopeData, SyncResultData, ConfigSummaryData, ConfigCatalogData, AgentBindingUpdateData, DefaultRuntimeUpdateData, FeatureFlagUpdateData, OutputLanguageData, GovernanceQueueData, ActivationsData, DisableActivationData, LifecycleMetricsData, UpdateStatusData, UpdateHistoryData, ApplyUpdateResultData, RollbackResultData, ApprovalRecordData, PrinciplesListData, ApprovalsGroupedData, EvidenceChainData, EvidenceChainRecordData, EvidenceChainStateData, TrajectoryData, TrajectoryStageData, IntentSummaryData, IntentSectionsData, IntentDocWarningData, IntentDecisionRecordData, IntentDecisionResultData, IntentDecisionSummaryData, FollowUpResponseData, LinkCandidateFollowUpData, GuideRulehostFollowUpData, GeneratePatchProposalFollowUpData, IntentVersionEntry, IntentVersionData, } from "./utils/validators.js";
|
|
56
96
|
export type { ActivationRecordData as ActivationRecord } from "./utils/validators.js";
|
|
57
97
|
export type { ApprovalRecordData as ApprovalRecord } from "./utils/validators.js";
|
|
58
98
|
export type { WorkspaceEntryData as WorkspaceEntry } from "./utils/validators.js";
|