create-principles-disciple 1.121.8 → 1.121.10
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 +263 -41
- package/console/dist/server/utils/update-links.d.ts +38 -0
- package/console/dist/server/utils/update-links.js +71 -0
- 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 +3 -1
- 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 +1 -2
- 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 +5 -0
- 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 +29 -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 +1 -0
- package/plugin/dist/bundle.js +868 -936
- 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/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
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installation layout contract (SPEC §5).
|
|
3
|
+
*
|
|
4
|
+
* Production installation state lives under `~/.pd`:
|
|
5
|
+
*
|
|
6
|
+
* bootstrap/ installer-owned; a product release can never overwrite it
|
|
7
|
+
* install.json channel selection + automatic check settings
|
|
8
|
+
* trust/ TUF trusted root metadata cache
|
|
9
|
+
* channels/ cached signed channel metadata
|
|
10
|
+
* releases/<release-id>/
|
|
11
|
+
* staging/<transaction-id>/
|
|
12
|
+
* transactions/<transaction-id>.json
|
|
13
|
+
* active.json / previous.json
|
|
14
|
+
* logs/
|
|
15
|
+
*
|
|
16
|
+
* This module owns ONLY path derivation and strict readers. Every read of
|
|
17
|
+
* untrusted on-disk JSON returns `unknown` until validated (rc-1) and fails
|
|
18
|
+
* loud on malformed required fields (rc-3).
|
|
19
|
+
*/
|
|
20
|
+
import * as fs from 'node:fs';
|
|
21
|
+
import * as path from 'node:path';
|
|
22
|
+
import { parseProductVersion, ProductIdentityError, isReleaseChannelName } from './product-identity.js';
|
|
23
|
+
export function resolvePdHomePaths(pdHome) {
|
|
24
|
+
const home = path.resolve(pdHome);
|
|
25
|
+
return {
|
|
26
|
+
home,
|
|
27
|
+
bootstrapDir: path.join(home, 'bootstrap'),
|
|
28
|
+
bootstrapManifestPath: path.join(home, 'bootstrap', 'bootstrap.json'),
|
|
29
|
+
installConfigPath: path.join(home, 'install.json'),
|
|
30
|
+
trustDir: path.join(home, 'trust'),
|
|
31
|
+
channelsDir: path.join(home, 'channels'),
|
|
32
|
+
releasesDir: path.join(home, 'releases'),
|
|
33
|
+
stagingDir: path.join(home, 'staging'),
|
|
34
|
+
transactionsDir: path.join(home, 'transactions'),
|
|
35
|
+
activeRecordPath: path.join(home, 'active.json'),
|
|
36
|
+
previousRecordPath: path.join(home, 'previous.json'),
|
|
37
|
+
logsDir: path.join(home, 'logs'),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Creates the installation skeleton once; never touches an existing file. */
|
|
41
|
+
export function ensurePdHomeLayout(paths) {
|
|
42
|
+
for (const directory of [
|
|
43
|
+
paths.bootstrapDir, paths.trustDir, paths.channelsDir,
|
|
44
|
+
paths.releasesDir, paths.stagingDir, paths.transactionsDir, paths.logsDir,
|
|
45
|
+
]) {
|
|
46
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export class InstallLayoutError extends Error {
|
|
50
|
+
field;
|
|
51
|
+
constructor(field, message) {
|
|
52
|
+
super(message);
|
|
53
|
+
this.name = 'InstallLayoutError';
|
|
54
|
+
this.field = field;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function readJsonFileIfExists(filePath, label) {
|
|
58
|
+
if (!fs.existsSync(filePath))
|
|
59
|
+
return undefined;
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
// A bare SyntaxError would escape every typed reader below; corrupt
|
|
65
|
+
// installation state fails loud with its own field-tagged error (rc-3).
|
|
66
|
+
throw new InstallLayoutError(label, `${label} is not valid JSON (${filePath}): ${error instanceof Error ? error.message : String(error)}. Restore it with the official installer; do not guess a partial state.`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Strict reader for the installer-owned bootstrap manifest. */
|
|
70
|
+
export function readBootstrapManifest(paths) {
|
|
71
|
+
const value = readJsonFileIfExists(paths.bootstrapManifestPath, 'bootstrap.json');
|
|
72
|
+
if (value === undefined)
|
|
73
|
+
return null;
|
|
74
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
75
|
+
throw new InstallLayoutError('bootstrap', `bootstrap manifest must be a JSON object: ${paths.bootstrapManifestPath}`);
|
|
76
|
+
}
|
|
77
|
+
const record = value;
|
|
78
|
+
if (!Object.hasOwn(record, 'bootstrapVersion')) {
|
|
79
|
+
throw new InstallLayoutError('bootstrapVersion', 'bootstrap manifest is missing bootstrapVersion');
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
const { bootstrapVersion } = { bootstrapVersion: parseProductVersion(record.bootstrapVersion, 'bootstrapVersion') };
|
|
83
|
+
const { installedAt } = record;
|
|
84
|
+
if (typeof installedAt !== 'string' || installedAt.length === 0) {
|
|
85
|
+
throw new InstallLayoutError('installedAt', 'bootstrap manifest installedAt must be a non-empty timestamp string');
|
|
86
|
+
}
|
|
87
|
+
return { bootstrapVersion: bootstrapVersion.productVersion, installedAt };
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (error instanceof ProductIdentityError) {
|
|
91
|
+
throw new InstallLayoutError(error.field, error.message);
|
|
92
|
+
}
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Installation-level settings (SPEC §2.3). Missing file yields the safe
|
|
98
|
+
* default (stable channel, automatic checks off); a malformed file fails
|
|
99
|
+
* loud instead of degrading to guesses.
|
|
100
|
+
*/
|
|
101
|
+
export function readInstallConfig(paths) {
|
|
102
|
+
const value = readJsonFileIfExists(paths.installConfigPath, 'install.json');
|
|
103
|
+
if (value === undefined)
|
|
104
|
+
return { channel: 'stable', autoCheck: false };
|
|
105
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
106
|
+
throw new InstallLayoutError('install.json', `install.json must be a JSON object: ${paths.installConfigPath}`);
|
|
107
|
+
}
|
|
108
|
+
const record = value;
|
|
109
|
+
const channelValue = Object.hasOwn(record, 'channel') ? record.channel : 'stable';
|
|
110
|
+
if (!isReleaseChannelName(channelValue)) {
|
|
111
|
+
throw new InstallLayoutError('channel', `install.json channel must be "stable" or "candidate", got: ${JSON.stringify(channelValue)}`);
|
|
112
|
+
}
|
|
113
|
+
const autoCheckValue = Object.hasOwn(record, 'autoCheck') ? record.autoCheck : false;
|
|
114
|
+
if (typeof autoCheckValue !== 'boolean') {
|
|
115
|
+
throw new InstallLayoutError('autoCheck', `install.json autoCheck must be a boolean, got: ${JSON.stringify(autoCheckValue)}`);
|
|
116
|
+
}
|
|
117
|
+
return { channel: channelValue, autoCheck: autoCheckValue };
|
|
118
|
+
}
|
|
119
|
+
export function writeInstallConfig(paths, config) {
|
|
120
|
+
const payload = {
|
|
121
|
+
channel: config.channel,
|
|
122
|
+
autoCheck: config.autoCheck,
|
|
123
|
+
};
|
|
124
|
+
fs.mkdirSync(paths.home, { recursive: true });
|
|
125
|
+
fs.writeFileSync(paths.installConfigPath, `${JSON.stringify(payload, null, 2)}\n`);
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=install-layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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,CAAC,SAAS;KAC5B,CAAC;IACF,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Official legacy-overlay migration (SPEC §15 Phase 5).
|
|
3
|
+
*
|
|
4
|
+
* ONLY an official installer transaction migrates an existing overlay
|
|
5
|
+
* installation (~/.openclaw/extensions/principles-disciple) into the
|
|
6
|
+
* bootstrap + dual-slot layout. The legacy updater must never transform
|
|
7
|
+
* itself in place. Owner data, workspace config, and governance assets are
|
|
8
|
+
* preserved untouched; the overlay directory itself is left in place as
|
|
9
|
+
* read-only legacy diagnostics for a bounded period — never deleted or
|
|
10
|
+
* rewritten by the migration.
|
|
11
|
+
*
|
|
12
|
+
* Dry-run is the default posture (cli-4): the plan describes every resolved
|
|
13
|
+
* target and the exact step list without touching anything.
|
|
14
|
+
*/
|
|
15
|
+
export type MigrationRefusalReason = 'overlay_missing' | 'already_migrated' | 'overlay_manifest_invalid' | 'bootstrap_write_out_of_scope';
|
|
16
|
+
export interface MigrationRefusal {
|
|
17
|
+
readonly migrated: false;
|
|
18
|
+
readonly dryRun: boolean;
|
|
19
|
+
readonly reason: MigrationRefusalReason;
|
|
20
|
+
readonly message: string;
|
|
21
|
+
readonly nextAction: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MigrationStep {
|
|
24
|
+
readonly description: string;
|
|
25
|
+
readonly resolvedTarget: string;
|
|
26
|
+
}
|
|
27
|
+
export interface MigrationPlan {
|
|
28
|
+
readonly migrated: true;
|
|
29
|
+
readonly dryRun: boolean;
|
|
30
|
+
readonly overlayDir: string;
|
|
31
|
+
readonly pdHome: string;
|
|
32
|
+
readonly productVersion: string;
|
|
33
|
+
readonly releaseId: string;
|
|
34
|
+
readonly steps: readonly MigrationStep[];
|
|
35
|
+
readonly historyEventPath: string;
|
|
36
|
+
}
|
|
37
|
+
export type MigrationResult = MigrationPlan | MigrationRefusal;
|
|
38
|
+
export interface LegacyMigrationInput {
|
|
39
|
+
readonly homeDir: string;
|
|
40
|
+
readonly openclawHome: string;
|
|
41
|
+
/** Only the official installer sets this — a product release may not write the bootstrap. */
|
|
42
|
+
readonly invokedByOfficialInstaller: boolean;
|
|
43
|
+
readonly dryRun: boolean;
|
|
44
|
+
readonly bootstrapVersion: string;
|
|
45
|
+
readonly transactionId: string;
|
|
46
|
+
readonly now?: () => Date;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Plans (and when dryRun=false, executes) the one-time official migration.
|
|
50
|
+
* The migration: lays down the bootstrap manifest, derives the overlay's
|
|
51
|
+
* canonical release identity, records it as generation 1 of the dual-slot
|
|
52
|
+
* layout, writes install.json defaults, and appends a legacy_migration
|
|
53
|
+
* history event. The overlay tree itself is never modified.
|
|
54
|
+
*/
|
|
55
|
+
export declare function migrateLegacyOverlay(input: LegacyMigrationInput): MigrationResult;
|
|
56
|
+
//# sourceMappingURL=legacy-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-migration.d.ts","sourceRoot":"","sources":["../../src/update/legacy-migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAsBH,MAAM,MAAM,sBAAsB,GAC9B,iBAAiB,GACjB,kBAAkB,GAClB,0BAA0B,GAC1B,8BAA8B,CAAC;AAEnC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CA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
|
+
* installation (~/.openclaw/extensions/principles-disciple) into the
|
|
6
|
+
* bootstrap + dual-slot layout. The legacy updater must never transform
|
|
7
|
+
* itself in place. Owner data, workspace config, and governance assets are
|
|
8
|
+
* preserved untouched; the overlay directory itself is left in place as
|
|
9
|
+
* read-only legacy diagnostics for a bounded period — never deleted or
|
|
10
|
+
* rewritten by the migration.
|
|
11
|
+
*
|
|
12
|
+
* Dry-run is the default posture (cli-4): the plan describes every resolved
|
|
13
|
+
* target and the exact step list without touching anything.
|
|
14
|
+
*/
|
|
15
|
+
import * as fs from 'node:fs';
|
|
16
|
+
import * as path from 'node:path';
|
|
17
|
+
import { createHash } from 'node:crypto';
|
|
18
|
+
import { ensurePdHomeLayout, resolvePdHomePaths } from './install-layout.js';
|
|
19
|
+
import { appendJournalTransition, writeActiveRecord } from './transaction-journal.js';
|
|
20
|
+
import { appendHistoryEvent, classifyDirection } from './update-history.js';
|
|
21
|
+
import { deriveReleaseId } from './release-identity.js';
|
|
22
|
+
import { buildReleaseMetadata } from './release-metadata.js';
|
|
23
|
+
import { parseProductVersion, ProductIdentityError } from './product-identity.js';
|
|
24
|
+
/** Every path this migration writes must resolve inside the target ~/.pd root. */
|
|
25
|
+
function assertWithinPdHome(candidate, pdHome, label) {
|
|
26
|
+
const resolved = path.resolve(candidate);
|
|
27
|
+
const root = path.resolve(pdHome);
|
|
28
|
+
if (resolved !== root && !resolved.startsWith(root + path.sep)) {
|
|
29
|
+
throw new ProductIdentityError(label, `Migration write escaped ~/.pd (${root}): ${resolved}`);
|
|
30
|
+
}
|
|
31
|
+
return resolved;
|
|
32
|
+
}
|
|
33
|
+
function overlayPluginDir(openclawHome) {
|
|
34
|
+
return path.join(openclawHome, 'extensions', 'principles-disciple');
|
|
35
|
+
}
|
|
36
|
+
function readOverlayProductVersion(overlayDir) {
|
|
37
|
+
const manifestPath = path.join(overlayDir, 'plugin', 'package.json');
|
|
38
|
+
if (!fs.existsSync(manifestPath)) {
|
|
39
|
+
throw new ProductIdentityError('overlay', `The overlay installation has no plugin manifest: ${manifestPath}`);
|
|
40
|
+
}
|
|
41
|
+
let value;
|
|
42
|
+
try {
|
|
43
|
+
value = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw new ProductIdentityError('overlay', `The overlay plugin manifest is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
47
|
+
}
|
|
48
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
49
|
+
throw new ProductIdentityError('overlay', 'The overlay plugin manifest is not an object.');
|
|
50
|
+
}
|
|
51
|
+
const version = Reflect.get(value, 'version');
|
|
52
|
+
return parseProductVersion(version, 'overlay.plugin.version').productVersion;
|
|
53
|
+
}
|
|
54
|
+
function overlayComponentDigests(overlayDir) {
|
|
55
|
+
const digests = [];
|
|
56
|
+
for (const component of ['plugin', 'console', 'core', 'pd-cli', 'host-runtime', 'install-layout']) {
|
|
57
|
+
const manifestPath = path.join(overlayDir, component, 'package.json');
|
|
58
|
+
if (!fs.existsSync(manifestPath))
|
|
59
|
+
continue;
|
|
60
|
+
const bytes = fs.readFileSync(manifestPath);
|
|
61
|
+
digests.push({
|
|
62
|
+
component,
|
|
63
|
+
sha256: createHash('sha256').update(bytes).digest('hex'),
|
|
64
|
+
sizeBytes: bytes.length,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return digests;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Plans (and when dryRun=false, executes) the one-time official migration.
|
|
71
|
+
* The migration: lays down the bootstrap manifest, derives the overlay's
|
|
72
|
+
* canonical release identity, records it as generation 1 of the dual-slot
|
|
73
|
+
* layout, writes install.json defaults, and appends a legacy_migration
|
|
74
|
+
* history event. The overlay tree itself is never modified.
|
|
75
|
+
*/
|
|
76
|
+
export function migrateLegacyOverlay(input) {
|
|
77
|
+
const now = input.now ?? (() => new Date());
|
|
78
|
+
const overlayDir = overlayPluginDir(input.openclawHome);
|
|
79
|
+
const pdHome = path.join(input.homeDir, '.pd');
|
|
80
|
+
const paths = resolvePdHomePaths(pdHome);
|
|
81
|
+
if (!fs.existsSync(overlayDir)) {
|
|
82
|
+
return {
|
|
83
|
+
migrated: false,
|
|
84
|
+
dryRun: input.dryRun,
|
|
85
|
+
reason: 'overlay_missing',
|
|
86
|
+
message: `No legacy overlay installation found at ${overlayDir}.`,
|
|
87
|
+
nextAction: 'Nothing to migrate. Install PD with the official installer for the new layout.',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (fs.existsSync(paths.activeRecordPath)) {
|
|
91
|
+
return {
|
|
92
|
+
migrated: false,
|
|
93
|
+
dryRun: input.dryRun,
|
|
94
|
+
reason: 'already_migrated',
|
|
95
|
+
message: `This installation already uses the dual-slot layout (${paths.activeRecordPath} exists).`,
|
|
96
|
+
nextAction: 'Use the normal update flow; do not re-run the legacy migration.',
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (!input.invokedByOfficialInstaller) {
|
|
100
|
+
return {
|
|
101
|
+
migrated: false,
|
|
102
|
+
dryRun: input.dryRun,
|
|
103
|
+
reason: 'bootstrap_write_out_of_scope',
|
|
104
|
+
message: 'The bootstrap and trust root may only be written by an official installer transaction — a product release or the legacy updater cannot migrate itself in place.',
|
|
105
|
+
nextAction: 'Re-run the official installer, which performs the migration as part of its own transaction.',
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
let productVersion;
|
|
109
|
+
let componentDigests;
|
|
110
|
+
try {
|
|
111
|
+
productVersion = readOverlayProductVersion(overlayDir);
|
|
112
|
+
componentDigests = overlayComponentDigests(overlayDir);
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
if (error instanceof ProductIdentityError) {
|
|
116
|
+
return {
|
|
117
|
+
migrated: false,
|
|
118
|
+
dryRun: input.dryRun,
|
|
119
|
+
reason: 'overlay_manifest_invalid',
|
|
120
|
+
message: error.message,
|
|
121
|
+
nextAction: 'Reinstall the overlay with the official installer so its manifests are complete, then retry the migration.',
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
// The migrated overlay's release identity is derived from the overlay's own
|
|
127
|
+
// component digests — canonical identity, not a checkout package.json.
|
|
128
|
+
const releaseId = deriveReleaseId({
|
|
129
|
+
productVersion,
|
|
130
|
+
sourceCommit: '0'.repeat(40),
|
|
131
|
+
minBootstrapVersion: input.bootstrapVersion,
|
|
132
|
+
assets: componentDigests.map((digest) => ({
|
|
133
|
+
platform: `overlay-${digest.component}`,
|
|
134
|
+
arch: 'x64',
|
|
135
|
+
nodeAbi: '0',
|
|
136
|
+
archiveSha256: digest.sha256,
|
|
137
|
+
archiveSizeBytes: digest.sizeBytes,
|
|
138
|
+
})),
|
|
139
|
+
});
|
|
140
|
+
const steps = [
|
|
141
|
+
{ description: 'Create the ~/.pd installation skeleton', resolvedTarget: paths.home },
|
|
142
|
+
{ description: `Write the installer-owned bootstrap manifest (v${input.bootstrapVersion})`, resolvedTarget: paths.bootstrapManifestPath },
|
|
143
|
+
{ description: `Record the overlay release ${productVersion} as generation 1`, resolvedTarget: path.join(paths.releasesDir, releaseId) },
|
|
144
|
+
{ description: 'Write installation defaults (stable channel, automatic checks off)', resolvedTarget: paths.installConfigPath },
|
|
145
|
+
{ description: 'Append the legacy_migration history event (overlay remains read-only)', resolvedTarget: path.join(paths.logsDir, 'history.jsonl') },
|
|
146
|
+
];
|
|
147
|
+
if (input.dryRun) {
|
|
148
|
+
return {
|
|
149
|
+
migrated: true,
|
|
150
|
+
dryRun: true,
|
|
151
|
+
overlayDir,
|
|
152
|
+
pdHome,
|
|
153
|
+
productVersion,
|
|
154
|
+
releaseId,
|
|
155
|
+
steps,
|
|
156
|
+
historyEventPath: path.join(paths.logsDir, 'history.jsonl'),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const journalPath = assertWithinPdHome(path.join(paths.transactionsDir, `${input.transactionId}.jsonl`), pdHome, 'journal');
|
|
160
|
+
const bootstrapManifestPath = assertWithinPdHome(paths.bootstrapManifestPath, pdHome, 'bootstrap');
|
|
161
|
+
const releaseDir = assertWithinPdHome(path.join(paths.releasesDir, releaseId), pdHome, 'releases');
|
|
162
|
+
const releaseMetadataPath = assertWithinPdHome(path.join(releaseDir, 'metadata.json'), pdHome, 'release-metadata');
|
|
163
|
+
const activeRecordPath = assertWithinPdHome(paths.activeRecordPath, pdHome, 'active-record');
|
|
164
|
+
const installConfigPath = assertWithinPdHome(paths.installConfigPath, pdHome, 'install-config');
|
|
165
|
+
const historyPath = assertWithinPdHome(path.join(paths.logsDir, 'history.jsonl'), pdHome, 'history');
|
|
166
|
+
// The migrated release's metadata is built through the strict producer so
|
|
167
|
+
// its releaseId AND canonical metadataDigest close the identity chain —
|
|
168
|
+
// placeholder digests would fail verifyReleaseMetadataIdentity on the
|
|
169
|
+
// first future update check.
|
|
170
|
+
const migratedRelease = buildReleaseMetadata({
|
|
171
|
+
productVersion,
|
|
172
|
+
sourceCommit: '0'.repeat(40),
|
|
173
|
+
minBootstrapVersion: input.bootstrapVersion,
|
|
174
|
+
publicationSequence: 1,
|
|
175
|
+
expiresAt: '9999-12-31T00:00:00Z',
|
|
176
|
+
assets: componentDigests.map((digest) => ({
|
|
177
|
+
platform: `overlay-${digest.component}`,
|
|
178
|
+
arch: 'x64',
|
|
179
|
+
nodeAbi: '0',
|
|
180
|
+
archiveSha256: digest.sha256,
|
|
181
|
+
archiveSizeBytes: digest.sizeBytes,
|
|
182
|
+
})),
|
|
183
|
+
dataSchemaForwardReadableFrom: productVersion,
|
|
184
|
+
});
|
|
185
|
+
if (migratedRelease.releaseId !== releaseId) {
|
|
186
|
+
throw new ProductIdentityError('releaseId', 'Migration identity derivation diverged between planning and execution.');
|
|
187
|
+
}
|
|
188
|
+
const transition = (from, to, detail) => {
|
|
189
|
+
appendJournalTransition(journalPath, {
|
|
190
|
+
at: now().toISOString(),
|
|
191
|
+
from,
|
|
192
|
+
to,
|
|
193
|
+
transactionId: input.transactionId,
|
|
194
|
+
releaseId,
|
|
195
|
+
productVersion,
|
|
196
|
+
releaseMetadataDigest: migratedRelease.metadataDigest,
|
|
197
|
+
generation: 1,
|
|
198
|
+
detail,
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
// Journal-first ordering (SPEC §8): EVERY transition is appended and
|
|
202
|
+
// fsynced BEFORE the side effect it describes. A crash between a journal
|
|
203
|
+
// append and its side effect is always recoverable (re-running the
|
|
204
|
+
// migration or the recovery rules sees the intent); a crash between a side
|
|
205
|
+
// effect and its journal append is not (the journal understates reality).
|
|
206
|
+
transition(null, 'planned', 'official legacy migration planned');
|
|
207
|
+
ensurePdHomeLayout(paths);
|
|
208
|
+
transition('planned', 'staged', 'writing the installer-owned bootstrap manifest');
|
|
209
|
+
fs.writeFileSync(bootstrapManifestPath, `${JSON.stringify({
|
|
210
|
+
bootstrapVersion: input.bootstrapVersion,
|
|
211
|
+
installedAt: now().toISOString(),
|
|
212
|
+
}, null, 2)}\n`);
|
|
213
|
+
transition('staged', 'probed', 'recording the overlay identity as the generation 1 release');
|
|
214
|
+
fs.mkdirSync(releaseDir, { recursive: true });
|
|
215
|
+
fs.writeFileSync(releaseMetadataPath, `${JSON.stringify(migratedRelease, null, 2)}\n`);
|
|
216
|
+
transition('probed', 'activated', 'writing the generation 1 active record');
|
|
217
|
+
writeActiveRecord(activeRecordPath, {
|
|
218
|
+
generation: 1,
|
|
219
|
+
releaseId,
|
|
220
|
+
releaseMetadataDigest: migratedRelease.metadataDigest,
|
|
221
|
+
previousReleaseId: null,
|
|
222
|
+
transactionId: input.transactionId,
|
|
223
|
+
productVersion,
|
|
224
|
+
});
|
|
225
|
+
// No previous.json: a freshly migrated installation has exactly ONE slot.
|
|
226
|
+
// Copying the generation-1 record here would let a rollback "succeed" as a
|
|
227
|
+
// no-op onto the same release while reporting a switch.
|
|
228
|
+
transition('activated', 'confirmed', 'confirming the legacy migration; overlay tree left untouched as read-only diagnostics');
|
|
229
|
+
fs.writeFileSync(installConfigPath, `${JSON.stringify({ channel: 'stable', autoCheck: false }, null, 2)}\n`);
|
|
230
|
+
appendHistoryEvent(historyPath, {
|
|
231
|
+
at: now().toISOString(),
|
|
232
|
+
kind: 'legacy_migration',
|
|
233
|
+
direction: classifyDirection({ kind: 'legacy_migration', releasePublicationSequence: 1, previousPublicationSequence: null }),
|
|
234
|
+
outcome: 'succeeded',
|
|
235
|
+
productVersion,
|
|
236
|
+
releaseId,
|
|
237
|
+
previousReleaseId: null,
|
|
238
|
+
previousRemainsActive: false,
|
|
239
|
+
reason: `Migrated the overlay installation at ${overlayDir} into the dual-slot layout; the overlay tree is preserved read-only.`,
|
|
240
|
+
nextAction: null,
|
|
241
|
+
transactionId: input.transactionId,
|
|
242
|
+
});
|
|
243
|
+
return {
|
|
244
|
+
migrated: true,
|
|
245
|
+
dryRun: false,
|
|
246
|
+
overlayDir,
|
|
247
|
+
pdHome,
|
|
248
|
+
productVersion,
|
|
249
|
+
releaseId,
|
|
250
|
+
steps,
|
|
251
|
+
historyEventPath: historyPath,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=legacy-migration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-migration.js","sourceRoot":"","sources":["../../src/update/legacy-migration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;AAC7G,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC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EAAE,iBAAiB,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,CAAC,EAAE,2BAA2B,EAAE,IAAI,EAAE,CAAC;QAC5H,OAAO,EAAE,WAAW;QACpB,cAAc;QACd,SAAS;QACT,iBAAiB,EAAE,IAAI;QACvB,qBAAqB,EAAE,KAAK;QAC5B,MAAM,EAAE,wCAAwC,UAAU,sEAAsE;QAChI,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,KAAK,CAAC,aAAa;KACnC,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,KAAK;QACb,UAAU;QACV,MAAM;QACN,cAAc;QACd,SAAS;QACT,KAAK;QACL,gBAAgB,EAAE,WAAW;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical product identity (SPEC §4.1, §12).
|
|
3
|
+
*
|
|
4
|
+
* The product has ONE public `productVersion`. Component package versions are
|
|
5
|
+
* diagnostics. This module owns the strict runtime contract every surface
|
|
6
|
+
* (CLI, Console, Companion, manifest) must share so they can never report
|
|
7
|
+
* incompatible meanings of "current version".
|
|
8
|
+
*/
|
|
9
|
+
export type ReleaseChannelName = 'stable' | 'candidate';
|
|
10
|
+
export interface CanonicalProductVersion {
|
|
11
|
+
readonly major: number;
|
|
12
|
+
readonly minor: number;
|
|
13
|
+
readonly patch: number;
|
|
14
|
+
readonly productVersion: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class ProductIdentityError extends Error {
|
|
17
|
+
readonly field: string;
|
|
18
|
+
constructor(field: string, message: string);
|
|
19
|
+
}
|
|
20
|
+
/** Strict `x.y.z` parse — no prerelease/build suffixes in the product version. */
|
|
21
|
+
export declare function parseProductVersion(value: unknown, field?: string): CanonicalProductVersion;
|
|
22
|
+
/** Total-order comparison; negative when `left` is older than `right`. */
|
|
23
|
+
export declare function compareProductVersions(left: CanonicalProductVersion, right: CanonicalProductVersion): number;
|
|
24
|
+
export declare function isSha256Hex(value: unknown): value is string;
|
|
25
|
+
export declare function assertSha256Hex(value: unknown, field: string): string;
|
|
26
|
+
export declare function assertGitCommit(value: unknown, field: string): string;
|
|
27
|
+
export declare function isReleaseChannelName(value: unknown): value is ReleaseChannelName;
|
|
28
|
+
/**
|
|
29
|
+
* `pd version --json` report (SPEC §12). Phase 1 defines the contract; the
|
|
30
|
+
* product surfaces fill it in Phase 6. Every field is required so a missing
|
|
31
|
+
* fact fails loud instead of degrading into a partial lie.
|
|
32
|
+
*/
|
|
33
|
+
export interface VersionReport {
|
|
34
|
+
readonly productVersion: string;
|
|
35
|
+
readonly releaseId: string;
|
|
36
|
+
readonly components: Readonly<Record<string, string>>;
|
|
37
|
+
readonly bootstrapVersion: string;
|
|
38
|
+
readonly channel: ReleaseChannelName;
|
|
39
|
+
readonly source: 'official-installer' | 'official-legacy-overlay' | 'development-checkout' | 'unknown';
|
|
40
|
+
readonly generation: number;
|
|
41
|
+
readonly health: 'healthy' | 'degraded' | 'corrupt';
|
|
42
|
+
readonly lastTransaction: Readonly<{
|
|
43
|
+
id: string;
|
|
44
|
+
kind: string;
|
|
45
|
+
outcome: string;
|
|
46
|
+
}> | null;
|
|
47
|
+
}
|
|
48
|
+
/** `pd --version` short stable text contract: `Principles Disciple <version> (<releaseId prefix>)`. */
|
|
49
|
+
export declare function formatShortVersion(report: Pick<VersionReport, 'productVersion' | 'releaseId'>): string;
|
|
50
|
+
//# sourceMappingURL=product-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-identity.d.ts","sourceRoot":"","sources":["../../src/update/product-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAMxD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MA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,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;IACpD,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;CAC1F;AAED,uGAAuG;AACvG,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,gBAAgB,GAAG,WAAW,CAAC,GAAG,MAAM,CAEtG"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical product identity (SPEC §4.1, §12).
|
|
3
|
+
*
|
|
4
|
+
* The product has ONE public `productVersion`. Component package versions are
|
|
5
|
+
* diagnostics. This module owns the strict runtime contract every surface
|
|
6
|
+
* (CLI, Console, Companion, manifest) must share so they can never report
|
|
7
|
+
* incompatible meanings of "current version".
|
|
8
|
+
*/
|
|
9
|
+
const PRODUCT_VERSION_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
10
|
+
const SHA256_HEX_PATTERN = /^[a-f0-9]{64}$/;
|
|
11
|
+
const GIT_COMMIT_PATTERN = /^[a-f0-9]{40}$/;
|
|
12
|
+
export class ProductIdentityError extends Error {
|
|
13
|
+
field;
|
|
14
|
+
constructor(field, message) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = 'ProductIdentityError';
|
|
17
|
+
this.field = field;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/** Strict `x.y.z` parse — no prerelease/build suffixes in the product version. */
|
|
21
|
+
export function parseProductVersion(value, field = 'productVersion') {
|
|
22
|
+
if (typeof value !== 'string' || !PRODUCT_VERSION_PATTERN.test(value)) {
|
|
23
|
+
throw new ProductIdentityError(field, `${field} must be a strict x.y.z version, got: ${JSON.stringify(value)}`);
|
|
24
|
+
}
|
|
25
|
+
const [major, minor, patch] = value.split('.');
|
|
26
|
+
return {
|
|
27
|
+
major: Number(major),
|
|
28
|
+
minor: Number(minor),
|
|
29
|
+
patch: Number(patch),
|
|
30
|
+
productVersion: value,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Total-order comparison; negative when `left` is older than `right`. */
|
|
34
|
+
export function compareProductVersions(left, right) {
|
|
35
|
+
if (left.major !== right.major)
|
|
36
|
+
return left.major - right.major;
|
|
37
|
+
if (left.minor !== right.minor)
|
|
38
|
+
return left.minor - right.minor;
|
|
39
|
+
return left.patch - right.patch;
|
|
40
|
+
}
|
|
41
|
+
export function isSha256Hex(value) {
|
|
42
|
+
return typeof value === 'string' && SHA256_HEX_PATTERN.test(value);
|
|
43
|
+
}
|
|
44
|
+
export function assertSha256Hex(value, field) {
|
|
45
|
+
if (!isSha256Hex(value)) {
|
|
46
|
+
throw new ProductIdentityError(field, `${field} must be a lowercase 64-char sha256 hex digest, got: ${JSON.stringify(value)}`);
|
|
47
|
+
}
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
export function assertGitCommit(value, field) {
|
|
51
|
+
if (typeof value !== 'string' || !GIT_COMMIT_PATTERN.test(value)) {
|
|
52
|
+
throw new ProductIdentityError(field, `${field} must be a 40-char git commit sha, got: ${JSON.stringify(value)}`);
|
|
53
|
+
}
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
export function isReleaseChannelName(value) {
|
|
57
|
+
return value === 'stable' || value === 'candidate';
|
|
58
|
+
}
|
|
59
|
+
/** `pd --version` short stable text contract: `Principles Disciple <version> (<releaseId prefix>)`. */
|
|
60
|
+
export function formatShortVersion(report) {
|
|
61
|
+
return `Principles Disciple ${report.productVersion} (${report.releaseId.slice(0, 12)})`;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=product-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-identity.js","sourceRoot":"","sources":["../../src/update/product-identity.ts"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;
|
|
4
|
+
size: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ReleaseAssetManifest {
|
|
7
|
+
files: ReleaseAssetManifestFile[];
|
|
8
|
+
schemaVersion: 1;
|
|
9
|
+
}
|
|
10
|
+
export interface ReleaseAssetIdentity {
|
|
11
|
+
arch: string;
|
|
12
|
+
nodeAbi: string;
|
|
13
|
+
platform: string;
|
|
14
|
+
schemaVersion: 1;
|
|
15
|
+
}
|
|
16
|
+
export type ReleaseAssetManifestErrorCode = 'asset_directory_missing' | 'asset_file_unexpected' | 'asset_digest_mismatch' | 'asset_identity_invalid' | 'asset_manifest_invalid' | 'asset_path_unsafe' | 'asset_target_mismatch';
|
|
17
|
+
export declare class ReleaseAssetManifestError extends Error {
|
|
18
|
+
readonly code: ReleaseAssetManifestErrorCode;
|
|
19
|
+
constructor(code: ReleaseAssetManifestErrorCode, message: string);
|
|
20
|
+
}
|
|
21
|
+
export declare function parseReleaseAssetManifest(value: unknown): ReleaseAssetManifest;
|
|
22
|
+
export declare function parseReleaseAssetIdentity(value: unknown): ReleaseAssetIdentity;
|
|
23
|
+
export declare function verifyReleaseAssetTarget(identity: ReleaseAssetIdentity, target: {
|
|
24
|
+
platform: string;
|
|
25
|
+
arch: string;
|
|
26
|
+
nodeAbi: string;
|
|
27
|
+
}): void;
|
|
28
|
+
export declare function createReleaseAssetManifest(assetDir: string): ReleaseAssetManifest;
|
|
29
|
+
export declare function verifyReleaseAssetManifest(assetDir: string, manifest: ReleaseAssetManifest): void;
|
|
30
|
+
export declare function verifyReleaseAssetManifestAsync(assetDir: string, manifest: ReleaseAssetManifest): Promise<void>;
|
|
31
|
+
//# sourceMappingURL=release-asset-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-asset-manifest.d.ts","sourceRoot":"","sources":["../../src/update/release-asset-manifest.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM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