create-principles-disciple 1.121.7 → 1.121.9
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/README.md +13 -1
- package/console/dist/server/config/pd-config-store.d.ts +1 -3
- package/console/dist/server/config/pd-config-store.js +4 -4
- package/console/dist/server/feedback/channels.d.ts +2 -8
- package/console/dist/server/feedback/channels.js +0 -11
- package/console/dist/server/index.js +34 -5
- package/console/dist/server/models/ActivationsConsoleModel.d.ts +28 -1
- package/console/dist/server/models/ActivationsConsoleModel.js +72 -30
- package/console/dist/server/models/GovernanceExperienceCollector.d.ts +28 -0
- package/console/dist/server/models/GovernanceExperienceCollector.js +305 -0
- package/console/dist/server/models/GovernanceProjectionCollector.d.ts +60 -2
- package/console/dist/server/models/GovernanceProjectionCollector.js +323 -285
- package/console/dist/server/models/PrincipleClassifier.d.ts +1 -1
- package/console/dist/server/models/PrincipleClassifier.js +7 -4
- package/console/dist/server/models/PrinciplesConsoleModel.d.ts +2 -1
- package/console/dist/server/models/ReceiptsConsoleModel.d.ts +5 -0
- package/console/dist/server/models/ReceiptsConsoleModel.js +140 -13
- package/console/dist/server/routes/activations.js +1 -1
- package/console/dist/server/routes/failed-tasks.js +28 -11
- package/console/dist/server/routes/governance.d.ts +26 -0
- package/console/dist/server/routes/governance.js +51 -0
- package/console/dist/server/routes/owner-identity.d.ts +31 -0
- package/console/dist/server/routes/owner-identity.js +76 -0
- package/console/dist/server/routes/update-history.d.ts +5 -0
- package/console/dist/server/routes/update-history.js +50 -4
- package/console/dist/server/routes/update.js +186 -32
- package/console/dist/shared/feedback-channel-ids.d.ts +13 -0
- package/console/dist/shared/feedback-channel-ids.js +12 -0
- package/console/dist/shared/feedback-contract.d.ts +46 -0
- package/console/dist/shared/feedback-contract.js +45 -0
- package/console/dist/ui/App.js +1 -1
- package/console/dist/ui/api.d.ts +22 -3
- package/console/dist/ui/api.js +63 -3
- package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.d.ts +6 -0
- package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.js +66 -0
- package/console/dist/ui/i18n/en.json +198 -2
- package/console/dist/ui/i18n/zh-CN.json +196 -0
- package/console/dist/ui/pages/activation/ActivationPage.js +14 -2
- package/console/dist/ui/pages/failed-tasks/FailedTasksPage.js +25 -5
- package/console/dist/ui/pages/focus/FocusPage.d.ts +28 -1
- package/console/dist/ui/pages/focus/FocusPage.js +128 -15
- package/console/dist/ui/pages/principles/PrincipleDetailPage.d.ts +30 -0
- package/console/dist/ui/pages/principles/PrincipleDetailPage.js +49 -6
- package/console/dist/ui/pages/settings/SettingsPage.js +67 -2
- package/console/dist/ui/pages/settings/UpdatePage.js +7 -7
- package/console/dist/ui/utils/enum-labels.js +0 -1
- package/console/dist/ui/utils/validators.d.ts +53 -21
- package/console/dist/ui/utils/validators.js +248 -21
- package/console/dist/web/assets/app.css +6 -0
- package/console/dist/web/assets/app.js +2721 -1664
- package/console/package.json +4 -2
- package/core/dist/host/host-adapter.d.ts +1 -1
- package/core/dist/host/host-adapter.d.ts.map +1 -1
- package/core/dist/host/host-adapter.js +1 -0
- package/core/dist/host/host-adapter.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +12 -2
- package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.js +1 -1
- package/core/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/governance-experience.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/governance-experience.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/governance-experience.test.js +300 -0
- package/core/dist/runtime-v2/__tests__/governance-experience.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/owner-identity.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/owner-identity.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/owner-identity.test.js +147 -0
- package/core/dist/runtime-v2/__tests__/owner-identity.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/product-telemetry-contract.test.d.ts +18 -0
- package/core/dist/runtime-v2/__tests__/product-telemetry-contract.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/product-telemetry-contract.test.js +303 -0
- package/core/dist/runtime-v2/__tests__/product-telemetry-contract.test.js.map +1 -0
- package/core/dist/runtime-v2/__tests__/recovery-actions-log.test.js +40 -0
- package/core/dist/runtime-v2/__tests__/recovery-actions-log.test.js.map +1 -1
- package/core/dist/runtime-v2/__tests__/status-contract.test.d.ts +2 -0
- package/core/dist/runtime-v2/__tests__/status-contract.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/__tests__/status-contract.test.js +107 -0
- package/core/dist/runtime-v2/__tests__/status-contract.test.js.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.d.ts +2 -0
- package/core/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.js +104 -0
- package/core/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.js.map +1 -0
- package/core/dist/runtime-v2/activation/__tests__/promotion-readiness-evaluator.test.js +19 -0
- package/core/dist/runtime-v2/activation/__tests__/promotion-readiness-evaluator.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/rulecode-owner-decision-service.test.js +20 -0
- package/core/dist/runtime-v2/activation/__tests__/rulecode-owner-decision-service.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-safety-store.test.js +40 -0
- package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-safety-store.test.js.map +1 -1
- package/core/dist/runtime-v2/activation/index.d.ts +2 -0
- package/core/dist/runtime-v2/activation/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/index.js +1 -0
- package/core/dist/runtime-v2/activation/index.js.map +1 -1
- package/core/dist/runtime-v2/activation/promotion-evidence-snapshot.d.ts +30 -0
- package/core/dist/runtime-v2/activation/promotion-evidence-snapshot.d.ts.map +1 -0
- package/core/dist/runtime-v2/activation/promotion-evidence-snapshot.js +87 -0
- package/core/dist/runtime-v2/activation/promotion-evidence-snapshot.js.map +1 -0
- package/core/dist/runtime-v2/activation/promotion-readiness-evaluator.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/promotion-readiness-evaluator.js +3 -0
- package/core/dist/runtime-v2/activation/promotion-readiness-evaluator.js.map +1 -1
- package/core/dist/runtime-v2/activation/promotion-readiness-reader.d.ts +1 -1
- package/core/dist/runtime-v2/activation/promotion-readiness-reader.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/promotion-readiness-reader.js +2 -2
- package/core/dist/runtime-v2/activation/promotion-readiness-reader.js.map +1 -1
- package/core/dist/runtime-v2/activation/rulecode-owner-decision-service.d.ts.map +1 -1
- package/core/dist/runtime-v2/activation/rulecode-owner-decision-service.js +18 -9
- package/core/dist/runtime-v2/activation/rulecode-owner-decision-service.js.map +1 -1
- package/core/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.js +1 -1
- package/core/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.js.map +1 -1
- package/core/dist/runtime-v2/adapter/__tests__/json-extractor.test.js +91 -1
- package/core/dist/runtime-v2/adapter/__tests__/json-extractor.test.js.map +1 -1
- package/core/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js +59 -12
- package/core/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js.map +1 -1
- package/core/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.js +10 -9
- package/core/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.js +42 -1
- package/core/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.js.map +1 -1
- package/core/dist/runtime-v2/adapter/json-extractor.d.ts +25 -0
- package/core/dist/runtime-v2/adapter/json-extractor.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/json-extractor.js +126 -0
- package/core/dist/runtime-v2/adapter/json-extractor.js.map +1 -1
- package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.d.ts +9 -4
- package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.js +9 -4
- package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.js.map +1 -1
- package/core/dist/runtime-v2/adapter/output-repair-contract.d.ts +5 -1
- package/core/dist/runtime-v2/adapter/output-repair-contract.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/output-repair-contract.js +4 -1
- package/core/dist/runtime-v2/adapter/output-repair-contract.js.map +1 -1
- package/core/dist/runtime-v2/adapter/pi-ai-catalog.d.ts +7 -0
- package/core/dist/runtime-v2/adapter/pi-ai-catalog.d.ts.map +1 -0
- package/core/dist/runtime-v2/adapter/pi-ai-catalog.js +19 -0
- package/core/dist/runtime-v2/adapter/pi-ai-catalog.js.map +1 -0
- package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts +13 -15
- package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js +104 -37
- package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js.map +1 -1
- package/core/dist/runtime-v2/adapter/structured-output-repair.d.ts +16 -1
- package/core/dist/runtime-v2/adapter/structured-output-repair.d.ts.map +1 -1
- package/core/dist/runtime-v2/adapter/structured-output-repair.js +38 -6
- package/core/dist/runtime-v2/adapter/structured-output-repair.js.map +1 -1
- package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts +1 -1
- package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js +8 -9
- package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js.map +1 -1
- package/core/dist/runtime-v2/config/__tests__/pd-config-contract.test.js +27 -3
- package/core/dist/runtime-v2/config/__tests__/pd-config-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/config/__tests__/pd-config-principles.test.d.ts +11 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-principles.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-principles.test.js +93 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-principles.test.js.map +1 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-workspace.test.js +41 -0
- package/core/dist/runtime-v2/config/__tests__/pd-config-workspace.test.js.map +1 -1
- package/core/dist/runtime-v2/config/index.d.ts +2 -2
- package/core/dist/runtime-v2/config/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/index.js +2 -0
- package/core/dist/runtime-v2/config/index.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-agent-binding.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-agent-binding.js +4 -13
- package/core/dist/runtime-v2/config/pd-config-agent-binding.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-effective.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-effective.js +14 -7
- package/core/dist/runtime-v2/config/pd-config-effective.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-feature-flags.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-feature-flags.js +5 -12
- package/core/dist/runtime-v2/config/pd-config-feature-flags.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-types.d.ts +8 -0
- package/core/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-types.js +2 -0
- package/core/dist/runtime-v2/config/pd-config-types.js.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-validate.d.ts.map +1 -1
- package/core/dist/runtime-v2/config/pd-config-validate.js +48 -3
- package/core/dist/runtime-v2/config/pd-config-validate.js.map +1 -1
- package/core/dist/runtime-v2/core-principles/__tests__/core-axiom-block.test.js +36 -8
- package/core/dist/runtime-v2/core-principles/__tests__/core-axiom-block.test.js.map +1 -1
- package/core/dist/runtime-v2/core-principles/__tests__/core-principle-registry.test.js +36 -12
- package/core/dist/runtime-v2/core-principles/__tests__/core-principle-registry.test.js.map +1 -1
- package/core/dist/runtime-v2/core-principles/core-axiom-block.d.ts +22 -8
- package/core/dist/runtime-v2/core-principles/core-axiom-block.d.ts.map +1 -1
- package/core/dist/runtime-v2/core-principles/core-axiom-block.js +28 -13
- package/core/dist/runtime-v2/core-principles/core-axiom-block.js.map +1 -1
- package/core/dist/runtime-v2/core-principles/core-principle-registry.d.ts +29 -4
- package/core/dist/runtime-v2/core-principles/core-principle-registry.d.ts.map +1 -1
- package/core/dist/runtime-v2/core-principles/core-principle-registry.js +68 -33
- package/core/dist/runtime-v2/core-principles/core-principle-registry.js.map +1 -1
- package/core/dist/runtime-v2/core-principles/index.d.ts +3 -3
- package/core/dist/runtime-v2/core-principles/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/core-principles/index.js +1 -1
- package/core/dist/runtime-v2/core-principles/index.js.map +1 -1
- package/core/dist/runtime-v2/evolution/evolution-types.d.ts +2 -1
- package/core/dist/runtime-v2/evolution/evolution-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/evolution/evolution-types.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.js +48 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.js +46 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +86 -31
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.d.ts +2 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.js +83 -0
- package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts +19 -1
- 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 +128 -10
- package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
- package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts +37 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts.map +1 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js +304 -0
- package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js.map +1 -0
- package/core/dist/runtime-v2/feature-flags/index.d.ts +4 -2
- package/core/dist/runtime-v2/feature-flags/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/feature-flags/index.js +3 -1
- package/core/dist/runtime-v2/feature-flags/index.js.map +1 -1
- package/core/dist/runtime-v2/governance-experience-contract.d.ts +468 -0
- package/core/dist/runtime-v2/governance-experience-contract.d.ts.map +1 -0
- package/core/dist/runtime-v2/governance-experience-contract.js +208 -0
- package/core/dist/runtime-v2/governance-experience-contract.js.map +1 -0
- package/core/dist/runtime-v2/governance-experience.d.ts +11 -0
- package/core/dist/runtime-v2/governance-experience.d.ts.map +1 -0
- package/core/dist/runtime-v2/governance-experience.js +276 -0
- package/core/dist/runtime-v2/governance-experience.js.map +1 -0
- package/core/dist/runtime-v2/index.d.ts +20 -8
- package/core/dist/runtime-v2/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/index.js +20 -6
- package/core/dist/runtime-v2/index.js.map +1 -1
- package/core/dist/runtime-v2/internalization/__tests__/artificer-output-retry-flag.test.js +29 -10
- package/core/dist/runtime-v2/internalization/__tests__/artificer-output-retry-flag.test.js.map +1 -1
- package/core/dist/runtime-v2/owner-identity.d.ts +69 -0
- package/core/dist/runtime-v2/owner-identity.d.ts.map +1 -0
- package/core/dist/runtime-v2/owner-identity.js +179 -0
- package/core/dist/runtime-v2/owner-identity.js.map +1 -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 +2 -3
- package/core/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
- package/core/dist/runtime-v2/product-telemetry/daily-identity.d.ts +70 -0
- package/core/dist/runtime-v2/product-telemetry/daily-identity.d.ts.map +1 -0
- package/core/dist/runtime-v2/product-telemetry/daily-identity.js +89 -0
- package/core/dist/runtime-v2/product-telemetry/daily-identity.js.map +1 -0
- package/core/dist/runtime-v2/product-telemetry/snapshot-contract.d.ts +110 -0
- package/core/dist/runtime-v2/product-telemetry/snapshot-contract.d.ts.map +1 -0
- package/core/dist/runtime-v2/product-telemetry/snapshot-contract.js +250 -0
- package/core/dist/runtime-v2/product-telemetry/snapshot-contract.js.map +1 -0
- package/core/dist/runtime-v2/pruning-read-model.d.ts +2 -1
- package/core/dist/runtime-v2/pruning-read-model.d.ts.map +1 -1
- package/core/dist/runtime-v2/pruning-read-model.js.map +1 -1
- package/core/dist/runtime-v2/receipt-coverage.d.ts +63 -0
- package/core/dist/runtime-v2/receipt-coverage.d.ts.map +1 -0
- package/core/dist/runtime-v2/receipt-coverage.js +19 -0
- package/core/dist/runtime-v2/receipt-coverage.js.map +1 -0
- package/core/dist/runtime-v2/recovery-actions-log.d.ts +7 -0
- package/core/dist/runtime-v2/recovery-actions-log.d.ts.map +1 -1
- package/core/dist/runtime-v2/recovery-actions-log.js +6 -0
- package/core/dist/runtime-v2/recovery-actions-log.js.map +1 -1
- package/core/dist/runtime-v2/runtime-protocol.js +1 -1
- package/core/dist/runtime-v2/runtime-protocol.js.map +1 -1
- package/core/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.js +17 -1
- package/core/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.js.map +1 -1
- package/core/dist/runtime-v2/store/task/sqlite-task-store.d.ts.map +1 -1
- package/core/dist/runtime-v2/store/task/sqlite-task-store.js +10 -0
- package/core/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
- package/core/dist/runtime-v2/store/task/task-types.d.ts +2 -0
- package/core/dist/runtime-v2/store/task/task-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/task-status.d.ts +9 -5
- package/core/dist/runtime-v2/task-status.d.ts.map +1 -1
- package/core/dist/runtime-v2/task-status.js +15 -7
- package/core/dist/runtime-v2/task-status.js.map +1 -1
- package/core/dist/runtime-v2/types/event-types.d.ts +4 -0
- package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/event-types.js.map +1 -1
- package/core/dist/runtime-v2/types/index.d.ts +1 -1
- package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/index.js +1 -1
- package/core/dist/runtime-v2/types/index.js.map +1 -1
- package/core/dist/runtime-v2/types/principle-enums.d.ts +3 -2
- package/core/dist/runtime-v2/types/principle-enums.d.ts.map +1 -1
- package/core/dist/runtime-v2/types/principle-enums.js +11 -5
- package/core/dist/runtime-v2/types/principle-enums.js.map +1 -1
- package/core/dist/runtime-v2/types/principle-schema.d.ts +1 -1
- package/core/dist/runtime-v2/types/principle-tree-store.d.ts +1 -1
- package/core/dist/runtime-v2/utils/cli-process-runner.d.ts.map +1 -1
- package/core/dist/runtime-v2/utils/cli-process-runner.js +3 -2
- package/core/dist/runtime-v2/utils/cli-process-runner.js.map +1 -1
- package/core/package.json +4 -5
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +4 -2
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -11
- package/dist/index.js.map +1 -1
- package/dist/installer.d.ts +31 -5
- package/dist/installer.d.ts.map +1 -1
- package/dist/installer.js +472 -161
- package/dist/installer.js.map +1 -1
- package/dist/installers/codex-host-installer.d.ts.map +1 -1
- package/dist/installers/codex-host-installer.js +4 -0
- package/dist/installers/codex-host-installer.js.map +1 -1
- package/dist/mvp-config.d.ts +10 -0
- package/dist/mvp-config.d.ts.map +1 -1
- package/dist/mvp-config.js +30 -3
- package/dist/mvp-config.js.map +1 -1
- package/dist/uninstaller.d.ts +9 -1
- package/dist/uninstaller.d.ts.map +1 -1
- package/dist/uninstaller.js +103 -23
- package/dist/uninstaller.js.map +1 -1
- package/dist/update/atomic-file.d.ts +35 -0
- package/dist/update/atomic-file.d.ts.map +1 -0
- package/dist/update/atomic-file.js +120 -0
- package/dist/update/atomic-file.js.map +1 -0
- package/dist/update/bootstrap-protocol.d.ts +55 -0
- package/dist/update/bootstrap-protocol.d.ts.map +1 -0
- package/dist/update/bootstrap-protocol.js +132 -0
- package/dist/update/bootstrap-protocol.js.map +1 -0
- package/dist/update/channel-metadata.d.ts +28 -0
- package/dist/update/channel-metadata.d.ts.map +1 -0
- package/dist/update/channel-metadata.js +90 -0
- package/dist/update/channel-metadata.js.map +1 -0
- package/dist/update/channel-promotion.d.ts +39 -0
- package/dist/update/channel-promotion.d.ts.map +1 -0
- package/dist/update/channel-promotion.js +55 -0
- package/dist/update/channel-promotion.js.map +1 -0
- package/dist/update/data-compatibility.d.ts +35 -0
- package/dist/update/data-compatibility.d.ts.map +1 -0
- package/dist/update/data-compatibility.js +45 -0
- package/dist/update/data-compatibility.js.map +1 -0
- package/dist/update/install-layout.d.ts +59 -0
- package/dist/update/install-layout.d.ts.map +1 -0
- package/dist/update/install-layout.js +127 -0
- package/dist/update/install-layout.js.map +1 -0
- package/dist/update/legacy-migration.d.ts +56 -0
- package/dist/update/legacy-migration.d.ts.map +1 -0
- package/dist/update/legacy-migration.js +254 -0
- package/dist/update/legacy-migration.js.map +1 -0
- package/dist/update/product-identity.d.ts +50 -0
- package/dist/update/product-identity.d.ts.map +1 -0
- package/dist/update/product-identity.js +63 -0
- package/dist/update/product-identity.js.map +1 -0
- package/dist/update/release-asset-manifest.d.ts +31 -0
- package/dist/update/release-asset-manifest.d.ts.map +1 -0
- package/dist/update/release-asset-manifest.js +161 -0
- package/dist/update/release-asset-manifest.js.map +1 -0
- package/dist/update/release-identity.d.ts +33 -0
- package/dist/update/release-identity.d.ts.map +1 -0
- package/dist/update/release-identity.js +108 -0
- package/dist/update/release-identity.js.map +1 -0
- package/dist/update/release-manager.d.ts +96 -0
- package/dist/update/release-manager.d.ts.map +1 -0
- package/dist/update/release-manager.js +253 -0
- package/dist/update/release-manager.js.map +1 -0
- package/dist/update/release-metadata.d.ts +57 -0
- package/dist/update/release-metadata.d.ts.map +1 -0
- package/dist/update/release-metadata.js +200 -0
- package/dist/update/release-metadata.js.map +1 -0
- package/dist/update/release-policy.d.ts +51 -0
- package/dist/update/release-policy.d.ts.map +1 -0
- package/dist/update/release-policy.js +103 -0
- package/dist/update/release-policy.js.map +1 -0
- package/dist/update/rollback-policy.d.ts +56 -0
- package/dist/update/rollback-policy.d.ts.map +1 -0
- package/dist/update/rollback-policy.js +61 -0
- package/dist/update/rollback-policy.js.map +1 -0
- package/dist/update/transaction-journal.d.ts +121 -0
- package/dist/update/transaction-journal.d.ts.map +1 -0
- package/dist/update/transaction-journal.js +333 -0
- package/dist/update/transaction-journal.js.map +1 -0
- package/dist/update/trust-metadata.d.ts +55 -0
- package/dist/update/trust-metadata.d.ts.map +1 -0
- package/dist/update/trust-metadata.js +170 -0
- package/dist/update/trust-metadata.js.map +1 -0
- package/dist/update/update-history.d.ts +46 -0
- package/dist/update/update-history.d.ts.map +1 -0
- package/dist/update/update-history.js +123 -0
- package/dist/update/update-history.js.map +1 -0
- package/dist/utils/env.d.ts +7 -0
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +134 -44
- package/dist/utils/env.js.map +1 -1
- package/host-runtime/dist/governance-observation-store.d.ts +172 -0
- package/host-runtime/dist/governance-observation-store.js +649 -0
- package/host-runtime/dist/index.d.ts +6 -0
- package/host-runtime/dist/index.js +8 -0
- package/host-runtime/dist/product-telemetry/consent-store.d.ts +107 -0
- package/host-runtime/dist/product-telemetry/consent-store.js +329 -0
- package/host-runtime/dist/product-telemetry/eligibility.d.ts +53 -0
- package/host-runtime/dist/product-telemetry/eligibility.js +69 -0
- package/host-runtime/dist/product-telemetry/exporter.d.ts +46 -0
- package/host-runtime/dist/product-telemetry/exporter.js +71 -0
- package/host-runtime/dist/product-telemetry/milestone-readers.d.ts +61 -0
- package/host-runtime/dist/product-telemetry/milestone-readers.js +234 -0
- package/host-runtime/dist/product-telemetry/service.d.ts +142 -0
- package/host-runtime/dist/product-telemetry/service.js +532 -0
- package/host-runtime/dist/product-telemetry/workspace-scope.d.ts +38 -0
- package/host-runtime/dist/product-telemetry/workspace-scope.js +64 -0
- package/host-runtime/package.json +7 -2
- package/install-layout/dist/index.d.ts +48 -0
- package/install-layout/dist/index.js +81 -0
- package/install-layout/dist/index.test.d.ts +1 -0
- package/install-layout/dist/index.test.js +34 -0
- package/install-layout/package.json +33 -0
- package/package.json +16 -6
- package/pd-cli/dist/commands/__tests__/telemetry-flag-wiring.test.d.ts +9 -0
- package/pd-cli/dist/commands/__tests__/telemetry-flag-wiring.test.d.ts.map +1 -0
- package/pd-cli/dist/commands/__tests__/telemetry-flag-wiring.test.js +76 -0
- package/pd-cli/dist/commands/__tests__/telemetry-flag-wiring.test.js.map +1 -0
- package/pd-cli/dist/commands/__tests__/version.test.d.ts +2 -0
- package/pd-cli/dist/commands/__tests__/version.test.d.ts.map +1 -0
- package/pd-cli/dist/commands/__tests__/version.test.js +134 -0
- package/pd-cli/dist/commands/__tests__/version.test.js.map +1 -0
- package/pd-cli/dist/commands/console.d.ts.map +1 -1
- package/pd-cli/dist/commands/console.js +29 -10
- package/pd-cli/dist/commands/console.js.map +1 -1
- package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
- package/pd-cli/dist/commands/pain-record.js +6 -15
- package/pd-cli/dist/commands/pain-record.js.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.d.ts +29 -0
- package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-activation.js +70 -31
- package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +2 -2
- package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
- package/pd-cli/dist/commands/telemetry.d.ts +82 -0
- package/pd-cli/dist/commands/telemetry.d.ts.map +1 -0
- package/pd-cli/dist/commands/telemetry.js +268 -0
- package/pd-cli/dist/commands/telemetry.js.map +1 -0
- package/pd-cli/dist/commands/version.d.ts +11 -0
- package/pd-cli/dist/commands/version.d.ts.map +1 -0
- package/pd-cli/dist/commands/version.js +48 -0
- package/pd-cli/dist/commands/version.js.map +1 -0
- package/pd-cli/dist/index.js +35 -2
- package/pd-cli/dist/index.js.map +1 -1
- package/pd-cli/dist/services/version-report.d.ts +44 -0
- package/pd-cli/dist/services/version-report.d.ts.map +1 -0
- package/pd-cli/dist/services/version-report.js +152 -0
- package/pd-cli/dist/services/version-report.js.map +1 -0
- package/pd-cli/package.json +3 -2
- package/plugin/dist/bundle.js +870 -932
- package/plugin/dist/core/init.d.ts +2 -1
- package/plugin/dist/core/principle-application-ledger.d.ts +10 -0
- package/plugin/dist/core/product-telemetry-trigger.d.ts +14 -0
- package/plugin/dist/core/thinking-os-parser.d.ts +5 -2
- package/plugin/dist/governance-audit.js +386 -0
- package/plugin/dist/hooks/gate-block-helper.d.ts +25 -1
- package/plugin/dist/hooks/gate.d.ts +22 -0
- package/plugin/dist/openclaw.plugin.json +1 -1
- package/plugin/dist/rulehost-evidence.js +832 -0
- package/plugin/dist/templates/langs/en/principles/THINKING_OS.md +53 -45
- package/plugin/dist/templates/langs/en/skills/pd-mentor/SKILL.md +1 -1
- package/plugin/dist/templates/langs/zh/principles/THINKING_OS.md +62 -46
- package/plugin/dist/templates/langs/zh/skills/pd-mentor/SKILL.md +1 -1
- package/plugin/dist/templates/workspace/.principles/THINKING_OS.md +66 -38
- package/plugin/openclaw.plugin.json +1 -1
- package/plugin/package.json +1 -1
- package/plugin/templates/langs/en/principles/THINKING_OS.md +53 -45
- package/plugin/templates/langs/en/skills/pd-mentor/SKILL.md +1 -1
- package/plugin/templates/langs/zh/principles/THINKING_OS.md +62 -46
- package/plugin/templates/langs/zh/skills/pd-mentor/SKILL.md +1 -1
- package/plugin/templates/workspace/.principles/THINKING_OS.md +66 -38
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - demo: Demo / example principles planted by the framework
|
|
8
8
|
* - smoke: Smoke-test principles for CI validation
|
|
9
9
|
* - historical: Archived or deprecated principles (already decided long ago)
|
|
10
|
-
* - builtin: Core Thinking OS axioms (T-
|
|
10
|
+
* - builtin: Core Thinking OS axioms (registry T-NN ids) — not governance targets
|
|
11
11
|
* - already_decided: Approved / rejected via approval queue
|
|
12
12
|
*
|
|
13
13
|
* Classification is purely read-side; it does NOT mutate any data.
|
|
@@ -7,14 +7,13 @@
|
|
|
7
7
|
* - demo: Demo / example principles planted by the framework
|
|
8
8
|
* - smoke: Smoke-test principles for CI validation
|
|
9
9
|
* - historical: Archived or deprecated principles (already decided long ago)
|
|
10
|
-
* - builtin: Core Thinking OS axioms (T-
|
|
10
|
+
* - builtin: Core Thinking OS axioms (registry T-NN ids) — not governance targets
|
|
11
11
|
* - already_decided: Approved / rejected via approval queue
|
|
12
12
|
*
|
|
13
13
|
* Classification is purely read-side; it does NOT mutate any data.
|
|
14
14
|
*/
|
|
15
|
+
import { isCorePrincipleId } from '@principles/core/runtime-v2';
|
|
15
16
|
// ── Heuristics ────────────────────────────────────────────────────────────────
|
|
16
|
-
/** Regex that matches core Thinking OS axiom IDs (T-NN pattern, e.g. T-01..T-10) */
|
|
17
|
-
const BUILTIN_ID_REGEX = /^T-(0[1-9]|10)$/;
|
|
18
17
|
/** ID prefixes that indicate demo / dogfood data */
|
|
19
18
|
const DEMO_ID_PREFIXES = ['DEMO_', 'demo_', 'story-a', 'story_a', 'dogfood_'];
|
|
20
19
|
/** ID prefixes that indicate smoke / test data */
|
|
@@ -32,8 +31,12 @@ function hasKeyword(text, keywords) {
|
|
|
32
31
|
const lower = text.toLowerCase();
|
|
33
32
|
return keywords.some((k) => lower.includes(k));
|
|
34
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Core Thinking OS axiom IDs — validated against the @principles/core
|
|
36
|
+
* registry so the builtin set always mirrors the canonical T-01..T-10.
|
|
37
|
+
*/
|
|
35
38
|
function isBuiltinId(id) {
|
|
36
|
-
return
|
|
39
|
+
return isCorePrincipleId(id);
|
|
37
40
|
}
|
|
38
41
|
// ── Classifier ────────────────────────────────────────────────────────────────
|
|
39
42
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { PrincipleStatus } from '@principles/core/runtime-v2';
|
|
2
|
+
export type { PrincipleStatus };
|
|
2
3
|
export type PrinciplePriority = 'P0' | 'P1' | 'P2';
|
|
3
4
|
export type PrincipleScope = 'general' | 'domain';
|
|
4
5
|
export type PrincipleEvaluability = 'manual_only' | 'deterministic' | 'weak_heuristic';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReceiptEvidenceCoverage } from '@principles/core/runtime-v2';
|
|
1
2
|
export interface ReceiptEvent {
|
|
2
3
|
kind: 'rule_blocked' | 'auto_correct_applied' | 'self_reported' | 'prompt_injected';
|
|
3
4
|
level: 'effect' | 'presence';
|
|
@@ -16,6 +17,7 @@ export interface PrincipleReceipts {
|
|
|
16
17
|
presenceCount: number;
|
|
17
18
|
lastEffectAt: string | null;
|
|
18
19
|
events: ReceiptEvent[];
|
|
20
|
+
coverage: ReceiptEvidenceCoverage;
|
|
19
21
|
}
|
|
20
22
|
export interface ReceiptCountEntry {
|
|
21
23
|
principleId: string;
|
|
@@ -28,6 +30,7 @@ export interface ReceiptCounts {
|
|
|
28
30
|
reason?: string;
|
|
29
31
|
nextAction?: string;
|
|
30
32
|
counts: ReceiptCountEntry[];
|
|
33
|
+
coverage: ReceiptEvidenceCoverage;
|
|
31
34
|
}
|
|
32
35
|
export declare class ReceiptsConsoleModel {
|
|
33
36
|
private readonly workspaceDir;
|
|
@@ -37,6 +40,8 @@ export declare class ReceiptsConsoleModel {
|
|
|
37
40
|
/**
|
|
38
41
|
* Shared preconditions: state.db exists + ledger flag enabled. Returns a
|
|
39
42
|
* degraded partial response when a precondition fails (rc-9), else null.
|
|
43
|
+
* Unavailable outranks disabled (mirrors the legacy precheck order, so
|
|
44
|
+
* observable behavior is unchanged).
|
|
40
45
|
*/
|
|
41
46
|
private precheck;
|
|
42
47
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Receipts Console Model — PRI-533 (SPEC §5.4).
|
|
2
|
+
* Receipts Console Model — PRI-533 (SPEC §5.4), coverage disclosure PRI-590..594.
|
|
3
3
|
*
|
|
4
4
|
* Read-side model for the principle receipt ledger (principle_applications,
|
|
5
5
|
* written by the plugin when principle_receipt_ledger is enabled). Serves:
|
|
6
6
|
* - per-principle receipt history (effect/presence counts + bounded timeline)
|
|
7
7
|
* - per-principle counts for the activations page columns
|
|
8
8
|
*
|
|
9
|
+
* Every response carries `coverage` (ReceiptEvidenceCoverage) describing what
|
|
10
|
+
* the numbers mean: source readability, data trustworthiness, observed range
|
|
11
|
+
* and retention policy. Coverage is derived from the same read — no extra
|
|
12
|
+
* fact source, no behavior change to the legacy status/reason/nextAction
|
|
13
|
+
* contract.
|
|
14
|
+
*
|
|
9
15
|
* Degradation rules (rc-9): state.db missing, table missing (pre-PRI-531
|
|
10
16
|
* workspace), or the ledger flag disabled → status degraded with reason +
|
|
11
17
|
* nextAction. Never throws to the route.
|
|
@@ -14,7 +20,7 @@
|
|
|
14
20
|
*/
|
|
15
21
|
import * as fs from 'node:fs';
|
|
16
22
|
import * as path from 'node:path';
|
|
17
|
-
import { SqliteConnection } from '@principles/core/runtime-v2';
|
|
23
|
+
import { SqliteConnection, RECEIPT_RETENTION_POLICY_DAYS } from '@principles/core/runtime-v2';
|
|
18
24
|
import { computeFlagsFromLoadResult, loadPdConfig } from '../config/pd-config-store.js';
|
|
19
25
|
const KINDS = new Set(['rule_blocked', 'auto_correct_applied', 'self_reported', 'prompt_injected']);
|
|
20
26
|
const LEVELS = new Set(['effect', 'presence']);
|
|
@@ -42,6 +48,43 @@ function toEvent(row) {
|
|
|
42
48
|
function isMissingTableError(err) {
|
|
43
49
|
return err instanceof Error && err.message.includes('no such table');
|
|
44
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Coverage for a source that was not read. validationStatus stays 'valid' —
|
|
53
|
+
* no data assessment was performed (the unreadable state itself is carried
|
|
54
|
+
* by sourceStatus + reasonCode). See receipt-coverage.ts contract docs.
|
|
55
|
+
*/
|
|
56
|
+
function unreadCoverage(sourceStatus, reasonCode, nextActionCode) {
|
|
57
|
+
return {
|
|
58
|
+
sourceStatus,
|
|
59
|
+
validationStatus: 'valid',
|
|
60
|
+
observedFrom: null,
|
|
61
|
+
asOf: new Date().toISOString(),
|
|
62
|
+
retentionPolicyDays: RECEIPT_RETENTION_POLICY_DAYS,
|
|
63
|
+
reasonCode,
|
|
64
|
+
nextActionCode,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function readCoverage(validation, observedFrom) {
|
|
68
|
+
return {
|
|
69
|
+
sourceStatus: 'available',
|
|
70
|
+
validationStatus: validation.validationStatus,
|
|
71
|
+
observedFrom,
|
|
72
|
+
asOf: new Date().toISOString(),
|
|
73
|
+
retentionPolicyDays: RECEIPT_RETENTION_POLICY_DAYS,
|
|
74
|
+
...(validation.reasonCode === undefined ? {} : { reasonCode: validation.reasonCode }),
|
|
75
|
+
...(validation.nextActionCode === undefined ? {} : { nextActionCode: validation.nextActionCode }),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function resolveValidation(malformedReasonCode, partialReasonCode) {
|
|
79
|
+
if (malformedReasonCode !== undefined) {
|
|
80
|
+
// Counts are untrustworthy — owner must not read them as facts.
|
|
81
|
+
return { validationStatus: 'malformed', reasonCode: malformedReasonCode, nextActionCode: 'inspect_state_db' };
|
|
82
|
+
}
|
|
83
|
+
if (partialReasonCode !== undefined) {
|
|
84
|
+
return { validationStatus: 'partial', reasonCode: partialReasonCode, nextActionCode: 'inspect_state_db' };
|
|
85
|
+
}
|
|
86
|
+
return { validationStatus: 'valid' };
|
|
87
|
+
}
|
|
45
88
|
export class ReceiptsConsoleModel {
|
|
46
89
|
workspaceDir;
|
|
47
90
|
constructor(workspaceDir) {
|
|
@@ -50,23 +93,40 @@ export class ReceiptsConsoleModel {
|
|
|
50
93
|
async getPrincipleReceipts(principleId) {
|
|
51
94
|
const guard = this.precheck();
|
|
52
95
|
if (guard) {
|
|
53
|
-
return {
|
|
96
|
+
return {
|
|
97
|
+
...guard,
|
|
98
|
+
principleId,
|
|
99
|
+
effectCount: 0,
|
|
100
|
+
presenceCount: 0,
|
|
101
|
+
lastEffectAt: null,
|
|
102
|
+
events: [],
|
|
103
|
+
};
|
|
54
104
|
}
|
|
55
105
|
const conn = new SqliteConnection({ workspaceDir: this.workspaceDir, readonly: true, bootstrapIfMissing: false });
|
|
56
106
|
try {
|
|
57
107
|
const rows = conn.getDb().prepare('SELECT kind, level, session_id, tool_name, file_path, digest, created_at FROM principle_applications WHERE principle_id = ? ORDER BY created_at DESC, id DESC LIMIT ?').all(principleId, TIMELINE_LIMIT);
|
|
58
108
|
const events = [];
|
|
109
|
+
let droppedRows = 0;
|
|
59
110
|
for (const row of Array.isArray(rows) ? rows : []) {
|
|
60
111
|
const event = toEvent(row);
|
|
61
112
|
if (event)
|
|
62
113
|
events.push(event);
|
|
114
|
+
else
|
|
115
|
+
droppedRows++;
|
|
63
116
|
}
|
|
64
|
-
const counts = conn.getDb().prepare(
|
|
117
|
+
const counts = conn.getDb().prepare('SELECT level, COUNT(*) AS n, MAX(created_at) AS last_at, MIN(created_at) AS first_at FROM principle_applications WHERE principle_id = ? GROUP BY level').all(principleId);
|
|
65
118
|
let effectCount = 0;
|
|
66
119
|
let presenceCount = 0;
|
|
67
120
|
let lastEffectAt = null;
|
|
121
|
+
let observedFrom = null;
|
|
122
|
+
let levelAnomaly = false;
|
|
68
123
|
for (const row of Array.isArray(counts) ? counts : []) {
|
|
69
124
|
const rec = row;
|
|
125
|
+
// ISO8601-UTC lexicographic comparison: safe only while created_at stays
|
|
126
|
+
// zero-padded UTC from toISOString() — pin this precondition here.
|
|
127
|
+
const firstAt = asNullableString(rec.first_at);
|
|
128
|
+
if (firstAt !== null && (observedFrom === null || firstAt < observedFrom))
|
|
129
|
+
observedFrom = firstAt;
|
|
70
130
|
if (rec.level === 'effect') {
|
|
71
131
|
effectCount = typeof rec.n === 'number' ? rec.n : 0;
|
|
72
132
|
lastEffectAt = asNullableString(rec.last_at);
|
|
@@ -74,8 +134,27 @@ export class ReceiptsConsoleModel {
|
|
|
74
134
|
else if (rec.level === 'presence') {
|
|
75
135
|
presenceCount = typeof rec.n === 'number' ? rec.n : 0;
|
|
76
136
|
}
|
|
137
|
+
else {
|
|
138
|
+
// Rows exist outside the effect/presence level space (schema drift /
|
|
139
|
+
// tampering) — the two counts above silently miss them, so the
|
|
140
|
+
// aggregate is untrustworthy.
|
|
141
|
+
levelAnomaly = true;
|
|
142
|
+
}
|
|
77
143
|
}
|
|
78
|
-
|
|
144
|
+
// COUNT(*) in a GROUP BY output is always a number — no unreadable-counts
|
|
145
|
+
// branch exists on this endpoint (ERR-099: no unreachable conditionals).
|
|
146
|
+
const malformedReasonCode = levelAnomaly ? 'ledger_level_invalid' : undefined;
|
|
147
|
+
const partialReasonCode = droppedRows > 0 ? 'receipt_rows_dropped' : undefined;
|
|
148
|
+
const validation = resolveValidation(malformedReasonCode, partialReasonCode);
|
|
149
|
+
return {
|
|
150
|
+
status: 'ok',
|
|
151
|
+
principleId,
|
|
152
|
+
effectCount,
|
|
153
|
+
presenceCount,
|
|
154
|
+
lastEffectAt,
|
|
155
|
+
events,
|
|
156
|
+
coverage: readCoverage(validation, observedFrom),
|
|
157
|
+
};
|
|
79
158
|
}
|
|
80
159
|
catch (err) {
|
|
81
160
|
if (isMissingTableError(err)) {
|
|
@@ -83,7 +162,12 @@ export class ReceiptsConsoleModel {
|
|
|
83
162
|
status: 'degraded',
|
|
84
163
|
reason: 'principle_applications table not found — ledger not initialized on this workspace',
|
|
85
164
|
nextAction: 'Update the plugin to a version including PRI-531 and enable principle_receipt_ledger',
|
|
86
|
-
principleId,
|
|
165
|
+
principleId,
|
|
166
|
+
effectCount: 0,
|
|
167
|
+
presenceCount: 0,
|
|
168
|
+
lastEffectAt: null,
|
|
169
|
+
events: [],
|
|
170
|
+
coverage: unreadCoverage('unavailable', 'ledger_table_missing', 'update_plugin'),
|
|
87
171
|
};
|
|
88
172
|
}
|
|
89
173
|
throw err;
|
|
@@ -95,29 +179,67 @@ export class ReceiptsConsoleModel {
|
|
|
95
179
|
async getReceiptCounts() {
|
|
96
180
|
const guard = this.precheck();
|
|
97
181
|
if (guard) {
|
|
98
|
-
return {
|
|
182
|
+
return {
|
|
183
|
+
status: guard.status,
|
|
184
|
+
reason: guard.reason,
|
|
185
|
+
nextAction: guard.nextAction,
|
|
186
|
+
counts: [],
|
|
187
|
+
coverage: guard.coverage,
|
|
188
|
+
};
|
|
99
189
|
}
|
|
100
190
|
const conn = new SqliteConnection({ workspaceDir: this.workspaceDir, readonly: true, bootstrapIfMissing: false });
|
|
101
191
|
try {
|
|
102
192
|
const rows = conn.getDb().prepare(`SELECT principle_id,
|
|
103
193
|
SUM(CASE WHEN level = 'effect' THEN 1 ELSE 0 END) AS effect_count,
|
|
104
194
|
SUM(CASE WHEN level = 'presence' THEN 1 ELSE 0 END) AS presence_count,
|
|
105
|
-
MAX(CASE WHEN level = 'effect' THEN created_at END) AS last_effect_at
|
|
106
|
-
|
|
195
|
+
MAX(CASE WHEN level = 'effect' THEN created_at END) AS last_effect_at,
|
|
196
|
+
COUNT(*) AS total_count,
|
|
197
|
+
SUM(CASE WHEN kind NOT IN ('rule_blocked','auto_correct_applied','self_reported','prompt_injected') THEN 1 ELSE 0 END) AS invalid_kind_count
|
|
198
|
+
FROM principle_applications GROUP BY principle_id`).all();
|
|
199
|
+
// Global observed range (the retention sweep is table-wide, not per principle).
|
|
200
|
+
const firstAtRow = conn.getDb().prepare('SELECT MIN(created_at) AS first_at FROM principle_applications').get();
|
|
201
|
+
const observedFrom = asNullableString(firstAtRow?.first_at);
|
|
107
202
|
const counts = [];
|
|
203
|
+
let skippedRows = 0;
|
|
204
|
+
let levelAnomaly = false;
|
|
205
|
+
let kindAnomaly = false;
|
|
108
206
|
for (const row of Array.isArray(rows) ? rows : []) {
|
|
109
207
|
const rec = row;
|
|
110
208
|
const principleId = asNullableString(rec.principle_id);
|
|
111
|
-
if (!principleId)
|
|
209
|
+
if (!principleId) {
|
|
210
|
+
skippedRows++;
|
|
112
211
|
continue;
|
|
212
|
+
}
|
|
213
|
+
// SUM(CASE ... ELSE 0 END) / COUNT(*) in GROUP BY output are always
|
|
214
|
+
// numbers — no unreadable-counts branch exists on this endpoint
|
|
215
|
+
// (ERR-099: no unreachable conditionals).
|
|
216
|
+
const effectCount = typeof rec.effect_count === 'number' ? rec.effect_count : 0;
|
|
217
|
+
const presenceCount = typeof rec.presence_count === 'number' ? rec.presence_count : 0;
|
|
218
|
+
if (typeof rec.total_count === 'number' && rec.total_count > effectCount + presenceCount) {
|
|
219
|
+
// Rows outside the effect/presence level space inflate the row total
|
|
220
|
+
// without landing in either count — the aggregate is untrustworthy.
|
|
221
|
+
levelAnomaly = true;
|
|
222
|
+
}
|
|
223
|
+
if (typeof rec.invalid_kind_count === 'number' && rec.invalid_kind_count > 0) {
|
|
224
|
+
// Unknown-kind rows are still counted (valid level) but the detail
|
|
225
|
+
// timeline drops them — align the partial verdict across endpoints.
|
|
226
|
+
kindAnomaly = true;
|
|
227
|
+
}
|
|
113
228
|
counts.push({
|
|
114
229
|
principleId,
|
|
115
|
-
effectCount
|
|
116
|
-
presenceCount
|
|
230
|
+
effectCount,
|
|
231
|
+
presenceCount,
|
|
117
232
|
lastEffectAt: asNullableString(rec.last_effect_at),
|
|
118
233
|
});
|
|
119
234
|
}
|
|
120
|
-
|
|
235
|
+
const malformedReasonCode = levelAnomaly ? 'ledger_level_invalid' : undefined;
|
|
236
|
+
const partialReasonCode = skippedRows > 0 || kindAnomaly ? 'receipt_rows_dropped' : undefined;
|
|
237
|
+
const validation = resolveValidation(malformedReasonCode, partialReasonCode);
|
|
238
|
+
return {
|
|
239
|
+
status: 'ok',
|
|
240
|
+
counts,
|
|
241
|
+
coverage: readCoverage(validation, observedFrom),
|
|
242
|
+
};
|
|
121
243
|
}
|
|
122
244
|
catch (err) {
|
|
123
245
|
if (isMissingTableError(err)) {
|
|
@@ -126,6 +248,7 @@ export class ReceiptsConsoleModel {
|
|
|
126
248
|
reason: 'principle_applications table not found — ledger not initialized on this workspace',
|
|
127
249
|
nextAction: 'Update the plugin to a version including PRI-531 and enable principle_receipt_ledger',
|
|
128
250
|
counts: [],
|
|
251
|
+
coverage: unreadCoverage('unavailable', 'ledger_table_missing', 'update_plugin'),
|
|
129
252
|
};
|
|
130
253
|
}
|
|
131
254
|
throw err;
|
|
@@ -137,6 +260,8 @@ export class ReceiptsConsoleModel {
|
|
|
137
260
|
/**
|
|
138
261
|
* Shared preconditions: state.db exists + ledger flag enabled. Returns a
|
|
139
262
|
* degraded partial response when a precondition fails (rc-9), else null.
|
|
263
|
+
* Unavailable outranks disabled (mirrors the legacy precheck order, so
|
|
264
|
+
* observable behavior is unchanged).
|
|
140
265
|
*/
|
|
141
266
|
precheck() {
|
|
142
267
|
const stateDbPath = path.join(this.workspaceDir, '.pd', 'state.db');
|
|
@@ -145,6 +270,7 @@ export class ReceiptsConsoleModel {
|
|
|
145
270
|
status: 'degraded',
|
|
146
271
|
reason: 'state.db not found — workspace may not be initialized',
|
|
147
272
|
nextAction: 'Run pd runtime diagnostics to check workspace state',
|
|
273
|
+
coverage: unreadCoverage('unavailable', 'state_db_missing', 'run_runtime_diagnostics'),
|
|
148
274
|
};
|
|
149
275
|
}
|
|
150
276
|
const flags = computeFlagsFromLoadResult(loadPdConfig(this.workspaceDir));
|
|
@@ -153,6 +279,7 @@ export class ReceiptsConsoleModel {
|
|
|
153
279
|
status: 'degraded',
|
|
154
280
|
reason: 'principle_receipt_ledger flag is disabled — no receipt history is being recorded',
|
|
155
281
|
nextAction: 'Enable the flag in .pd/config.yaml: features.principle_receipt_ledger.enabled = true',
|
|
282
|
+
coverage: unreadCoverage('disabled', 'ledger_flag_disabled', 'enable_ledger_flag'),
|
|
156
283
|
};
|
|
157
284
|
}
|
|
158
285
|
return null;
|
|
@@ -175,7 +175,7 @@ export async function handleActivationsRoute(req, res, workspaceDir, subPath, au
|
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
try {
|
|
178
|
-
sendSuccess(res, await getModel(workspaceDir).getOwnerReview(activationId, authority?.ownerActor !== null && authority?.ownerActor !== undefined));
|
|
178
|
+
sendSuccess(res, await getModel(workspaceDir).getOwnerReview(activationId, authority?.ownerActor !== null && authority?.ownerActor !== undefined, authority?.ownerActor ?? undefined));
|
|
179
179
|
}
|
|
180
180
|
catch (err) {
|
|
181
181
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -106,14 +106,14 @@ function tryParseJson(body) {
|
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
108
|
* Parse the optional recover request body. Accepts an empty body (reason is
|
|
109
|
-
* optional) or a JSON object with
|
|
110
|
-
* (rc-1/rc-2: parsed value stays `unknown` until
|
|
111
|
-
* checks pass). Returns a discriminated result;
|
|
112
|
-
* bad-request message.
|
|
109
|
+
* optional) or a JSON object with optional `reason` (string) and `force`
|
|
110
|
+
* (boolean) fields (rc-1/rc-2: parsed value stays `unknown` until
|
|
111
|
+
* Object.hasOwn + typeof checks pass). Returns a discriminated result;
|
|
112
|
+
* `ok === false` carries the bad-request message.
|
|
113
113
|
*/
|
|
114
114
|
function parseRecoverBody(body) {
|
|
115
115
|
if (body.trim().length === 0)
|
|
116
|
-
return { ok: true };
|
|
116
|
+
return { ok: true, force: false };
|
|
117
117
|
const raw = tryParseJson(body);
|
|
118
118
|
if (raw === undefined)
|
|
119
119
|
return { ok: false, error: 'Request body must be valid JSON' };
|
|
@@ -127,8 +127,14 @@ function parseRecoverBody(body) {
|
|
|
127
127
|
return { ok: false, error: `reason must be at most ${MAX_REASON_LENGTH} characters` };
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
+
// Fail loud on a malformed force flag (rc-3): silently coercing "yes" to
|
|
131
|
+
// false would silently downgrade an Owner-requested force recovery.
|
|
132
|
+
if (Object.hasOwn(raw, 'force') && typeof raw.force !== 'boolean') {
|
|
133
|
+
return { ok: false, error: 'force must be a boolean' };
|
|
134
|
+
}
|
|
130
135
|
const reason = typeof raw.reason === 'string' && raw.reason.length > 0 ? raw.reason : undefined;
|
|
131
|
-
|
|
136
|
+
const force = raw.force === true;
|
|
137
|
+
return { ok: true, reason, force };
|
|
132
138
|
}
|
|
133
139
|
/**
|
|
134
140
|
* Dispatch one recovery attempt through the shared core services.
|
|
@@ -137,32 +143,40 @@ function parseRecoverBody(body) {
|
|
|
137
143
|
* needs_human_review → owner authority reset. A null first result means
|
|
138
144
|
* "missing or not failed"; the second call distinguishes not_found /
|
|
139
145
|
* wrong-status / metadata_invalid. No recovery logic lives here.
|
|
146
|
+
*
|
|
147
|
+
* `force` applies only to the failed path: when true, an exhausted task
|
|
148
|
+
* (attemptCount >= maxAttempts) is reset anyway and its maxAttempts budget
|
|
149
|
+
* is raised (core raises it by +3). needs_human_review resets ignore it —
|
|
150
|
+
* the owner authority reset has its own budget semantics.
|
|
140
151
|
*/
|
|
141
|
-
async function dispatchRecovery(workspaceDir, taskId) {
|
|
152
|
+
async function dispatchRecovery(workspaceDir, taskId, force) {
|
|
142
153
|
const { service, close } = await createRecoverySweepService({ workspaceDir });
|
|
143
154
|
try {
|
|
144
155
|
// failed → pending (crash-retry semantics: completionIntent preserved)
|
|
145
156
|
try {
|
|
146
|
-
const failedResult = await service.recoverFailedTask(taskId);
|
|
157
|
+
const failedResult = await service.recoverFailedTask(taskId, force);
|
|
147
158
|
if (failedResult) {
|
|
148
159
|
return {
|
|
149
160
|
ok: true,
|
|
150
161
|
result: 'recovered',
|
|
151
162
|
previousStatus: failedResult.previousStatus,
|
|
152
163
|
newStatus: failedResult.newStatus,
|
|
164
|
+
forceApplied: failedResult.forceApplied,
|
|
153
165
|
};
|
|
154
166
|
}
|
|
155
167
|
}
|
|
156
168
|
catch (err) {
|
|
157
169
|
if (err instanceof PDRuntimeError && err.category === 'input_invalid') {
|
|
158
|
-
//
|
|
170
|
+
// Attempt budget exhausted and the request carried no force — either
|
|
171
|
+
// the client sent force:false or its row snapshot went stale between
|
|
172
|
+
// list render and click. Backstop; the UI sends force itself.
|
|
159
173
|
return {
|
|
160
174
|
ok: false,
|
|
161
175
|
failure: {
|
|
162
176
|
httpStatus: 409,
|
|
163
177
|
errorCode: 'task_attempts_exhausted',
|
|
164
178
|
message: err.message,
|
|
165
|
-
nextAction: 'This task exhausted its attempt budget.
|
|
179
|
+
nextAction: 'This task exhausted its attempt budget. Retry with force (force: true), or via CLI: pd runtime recovery failed-tasks --confirm --force',
|
|
166
180
|
},
|
|
167
181
|
};
|
|
168
182
|
}
|
|
@@ -176,6 +190,7 @@ async function dispatchRecovery(workspaceDir, taskId) {
|
|
|
176
190
|
result: 'requeued',
|
|
177
191
|
previousStatus: outcome.previousStatus,
|
|
178
192
|
newStatus: 'pending',
|
|
193
|
+
forceApplied: false,
|
|
179
194
|
};
|
|
180
195
|
}
|
|
181
196
|
if (outcome.status === 'not_found') {
|
|
@@ -349,7 +364,7 @@ export async function handleFailedTasksRoute(req, res, ctx) {
|
|
|
349
364
|
sendBadRequest(res, bodyResult.error);
|
|
350
365
|
return;
|
|
351
366
|
}
|
|
352
|
-
const dispatch = await dispatchRecovery(workspaceDir, taskId);
|
|
367
|
+
const dispatch = await dispatchRecovery(workspaceDir, taskId, bodyResult.force);
|
|
353
368
|
if (!dispatch.ok) {
|
|
354
369
|
sendError(res, dispatch.failure.httpStatus, dispatch.failure.errorCode, dispatch.failure.message, dispatch.failure.nextAction ? { nextAction: dispatch.failure.nextAction, ...dispatch.failure.extras } : dispatch.failure.extras);
|
|
355
370
|
return;
|
|
@@ -364,6 +379,7 @@ export async function handleFailedTasksRoute(req, res, ctx) {
|
|
|
364
379
|
result: dispatch.result,
|
|
365
380
|
operator: 'console',
|
|
366
381
|
reason: bodyResult.reason ?? null,
|
|
382
|
+
forceApplied: dispatch.forceApplied,
|
|
367
383
|
});
|
|
368
384
|
}
|
|
369
385
|
catch (auditErr) {
|
|
@@ -377,6 +393,7 @@ export async function handleFailedTasksRoute(req, res, ctx) {
|
|
|
377
393
|
previousStatus: dispatch.previousStatus,
|
|
378
394
|
newStatus: dispatch.newStatus,
|
|
379
395
|
result: dispatch.result,
|
|
396
|
+
forceApplied: dispatch.forceApplied,
|
|
380
397
|
nextAction: 'Recovery accepted. The task is pending again and will be picked up by the internalization consumer (or advance it manually: pd runtime internalization run-once).',
|
|
381
398
|
});
|
|
382
399
|
}
|
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { OwnerConfigSnapshot, OwnerIdentityResolved } from '@principles/core/runtime-v2';
|
|
3
|
+
export interface GovernanceExperienceContext {
|
|
4
|
+
workspaceDir: string;
|
|
5
|
+
featureFlags?: Record<string, {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
} | undefined>;
|
|
8
|
+
ownerConfig: OwnerConfigSnapshot;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Owner identity evidence for the governance experience snapshot. Mirrors the
|
|
12
|
+
* activations authority wiring in server/index.ts (authConfig.isEnabled() +
|
|
13
|
+
* PD_OWNER_ID + PD_OWNER_CREDENTIAL_ID) — the two must stay in sync; the route
|
|
14
|
+
* tests lock the mapping.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveOwnerConfigSnapshot(authConfig: {
|
|
17
|
+
isEnabled(): boolean;
|
|
18
|
+
}, identity: OwnerIdentityResolved): OwnerConfigSnapshot;
|
|
19
|
+
/**
|
|
20
|
+
* GET /api/v1/governance/experience — read-only Governance Experience Snapshot
|
|
21
|
+
* v1.5.1 (PRI-585).
|
|
22
|
+
*
|
|
23
|
+
* Flag contract (SPEC §14.1): with `governance_experience_v1` disabled the
|
|
24
|
+
* route returns 403 `feature_disabled` BEFORE any DB / ledger / config access.
|
|
25
|
+
* The snapshot explains governance state; it never authorizes mutations.
|
|
26
|
+
*/
|
|
27
|
+
export declare function handleGovernanceExperienceRoute(req: IncomingMessage, res: ServerResponse, ctx: GovernanceExperienceContext): Promise<void>;
|
|
2
28
|
export declare function handleGovernanceRoute(req: IncomingMessage, res: ServerResponse, workspaceDir: string): Promise<void>;
|
|
3
29
|
export declare function disposeGovernanceModels(): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GovernanceConsoleModel } from '../models/GovernanceConsoleModel.js';
|
|
2
|
+
import { GovernanceExperienceCollector } from '../models/GovernanceExperienceCollector.js';
|
|
2
3
|
import { sendSuccess, sendError, sendNotFound } from '../utils/response.js';
|
|
3
4
|
const models = new Map();
|
|
4
5
|
function getModel(workspaceDir) {
|
|
@@ -9,6 +10,55 @@ function getModel(workspaceDir) {
|
|
|
9
10
|
}
|
|
10
11
|
return model;
|
|
11
12
|
}
|
|
13
|
+
const experienceCollectors = new Map();
|
|
14
|
+
function getExperienceCollector(workspaceDir) {
|
|
15
|
+
let collector = experienceCollectors.get(workspaceDir);
|
|
16
|
+
if (!collector) {
|
|
17
|
+
collector = new GovernanceExperienceCollector(workspaceDir);
|
|
18
|
+
experienceCollectors.set(workspaceDir, collector);
|
|
19
|
+
}
|
|
20
|
+
return collector;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Owner identity evidence for the governance experience snapshot. Mirrors the
|
|
24
|
+
* activations authority wiring in server/index.ts (authConfig.isEnabled() +
|
|
25
|
+
* PD_OWNER_ID + PD_OWNER_CREDENTIAL_ID) — the two must stay in sync; the route
|
|
26
|
+
* tests lock the mapping.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveOwnerConfigSnapshot(authConfig, identity) {
|
|
29
|
+
const authEnabled = authConfig.isEnabled();
|
|
30
|
+
return {
|
|
31
|
+
authenticationMode: authEnabled ? 'authenticated' : 'no_auth',
|
|
32
|
+
ownerIdentityConfiguration: authEnabled && identity.ownerId && identity.credentialId ? 'configured' : 'missing',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* GET /api/v1/governance/experience — read-only Governance Experience Snapshot
|
|
37
|
+
* v1.5.1 (PRI-585).
|
|
38
|
+
*
|
|
39
|
+
* Flag contract (SPEC §14.1): with `governance_experience_v1` disabled the
|
|
40
|
+
* route returns 403 `feature_disabled` BEFORE any DB / ledger / config access.
|
|
41
|
+
* The snapshot explains governance state; it never authorizes mutations.
|
|
42
|
+
*/
|
|
43
|
+
export async function handleGovernanceExperienceRoute(req, res, ctx) {
|
|
44
|
+
if (req.method !== 'GET') {
|
|
45
|
+
sendError(res, 405, 'method_not_allowed', 'Use GET for /api/v1/governance/experience.', { nextAction: 'Retry with GET.' });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Gate first — flag-off must not touch the database, ledger, or config files.
|
|
49
|
+
if (ctx.featureFlags?.governance_experience_v1?.enabled !== true) {
|
|
50
|
+
sendError(res, 403, 'feature_disabled', 'governance_experience_v1 feature flag is disabled. The governance experience snapshot endpoint is inactive.', { nextAction: 'Enable features.governance_experience_v1.enabled: true in .pd/config.yaml and restart the Console server.' });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const snapshot = getExperienceCollector(ctx.workspaceDir).collectSnapshot({ ownerConfig: ctx.ownerConfig });
|
|
55
|
+
sendSuccess(res, snapshot);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
59
|
+
sendError(res, 500, 'governance_experience_error', message, { nextAction: 'Inspect the workspace state (.pd/state.db, .state/principle_training_state.json, .pd/config.yaml) and retry.' });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
12
62
|
export async function handleGovernanceRoute(req, res, workspaceDir) {
|
|
13
63
|
if (req.method !== 'GET') {
|
|
14
64
|
sendNotFound(res, 'Route /api/v1/governance/queue not found');
|
|
@@ -29,4 +79,5 @@ export function disposeGovernanceModels() {
|
|
|
29
79
|
model.dispose();
|
|
30
80
|
}
|
|
31
81
|
models.clear();
|
|
82
|
+
experienceCollectors.clear();
|
|
32
83
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GET/POST/DELETE /api/v1/owner-identity — install-level Owner identity
|
|
3
|
+
* registration (ADR-0022, PRI-578).
|
|
4
|
+
*
|
|
5
|
+
* - GET resolved identity (env > ~/.pd/owner.json > none) + file record
|
|
6
|
+
* + governance readiness (canonical resolveOwnerConfigSnapshot)
|
|
7
|
+
* - POST register: write ~/.pd/owner.json (identifiers only, no secrets)
|
|
8
|
+
* - DELETE unregister: delete ~/.pd/owner.json (idempotent)
|
|
9
|
+
*
|
|
10
|
+
* Registration (where the identity comes from) and governance readiness
|
|
11
|
+
* (whether Owner governance actions can execute) are DIFFERENT facts: the
|
|
12
|
+
* latter additionally requires Console token authentication and is derived
|
|
13
|
+
* ONLY by resolveOwnerConfigSnapshot — never re-derived in the UI.
|
|
14
|
+
*
|
|
15
|
+
* Env vars remain the highest-priority source; file registration is the
|
|
16
|
+
* install-level fallback; a partial env pair is invalid and fails closed
|
|
17
|
+
* (no file fallback). Registration takes effect immediately (the resolver
|
|
18
|
+
* reads the file per call); env-var changes still require a process restart.
|
|
19
|
+
*/
|
|
20
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
21
|
+
import { type OwnerIdentityResolved, type OwnerIdentityRecord, type OwnerConfigSnapshot } from '@principles/core/runtime-v2';
|
|
22
|
+
export interface OwnerIdentityRouteView {
|
|
23
|
+
resolved: OwnerIdentityResolved;
|
|
24
|
+
fileRecord: OwnerIdentityRecord | null;
|
|
25
|
+
fileError?: string;
|
|
26
|
+
/** Canonical governance readiness — the same derivation the governance experience uses. */
|
|
27
|
+
governance: OwnerConfigSnapshot;
|
|
28
|
+
}
|
|
29
|
+
export declare function handleOwnerIdentityRoute(req: IncomingMessage, res: ServerResponse, homeDir: string, subPath: string, authConfig: {
|
|
30
|
+
isEnabled(): boolean;
|
|
31
|
+
}): Promise<void>;
|