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,76 @@
|
|
|
1
|
+
import { resolveOwnerIdentity, readOwnerIdentityFile, writeOwnerIdentityFile, deleteOwnerIdentityFile, } from '@principles/core/runtime-v2';
|
|
2
|
+
import { sendSuccess, sendError, sendBadRequest, sendMethodNotAllowed } from '../utils/response.js';
|
|
3
|
+
import { resolveOwnerConfigSnapshot } from './governance.js';
|
|
4
|
+
const MAX_BODY_SIZE = 16 * 1024;
|
|
5
|
+
async function readJson(req) {
|
|
6
|
+
const chunks = [];
|
|
7
|
+
let totalSize = 0;
|
|
8
|
+
for await (const chunk of req) {
|
|
9
|
+
const buf = typeof chunk === 'string' ? Buffer.from(chunk) : chunk;
|
|
10
|
+
totalSize += buf.length;
|
|
11
|
+
if (totalSize > MAX_BODY_SIZE)
|
|
12
|
+
throw new Error('payload_too_large');
|
|
13
|
+
chunks.push(buf);
|
|
14
|
+
}
|
|
15
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf-8'));
|
|
16
|
+
}
|
|
17
|
+
/* eslint-disable @typescript-eslint/max-params */
|
|
18
|
+
export async function handleOwnerIdentityRoute(req, res, homeDir, subPath, authConfig) {
|
|
19
|
+
if (subPath !== '' && subPath !== '/') {
|
|
20
|
+
sendError(res, 404, 'not_found', 'Unknown owner identity endpoint.', { nextAction: 'Use GET / POST / DELETE /api/v1/owner-identity.' });
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const method = req.method ?? 'GET';
|
|
24
|
+
if (method === 'GET') {
|
|
25
|
+
const file = readOwnerIdentityFile(homeDir);
|
|
26
|
+
const resolved = resolveOwnerIdentity(process.env, homeDir);
|
|
27
|
+
const view = {
|
|
28
|
+
resolved,
|
|
29
|
+
fileRecord: file.record,
|
|
30
|
+
...(file.error === undefined ? {} : { fileError: file.error }),
|
|
31
|
+
governance: resolveOwnerConfigSnapshot(authConfig, resolved),
|
|
32
|
+
};
|
|
33
|
+
sendSuccess(res, view);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (method === 'POST') {
|
|
37
|
+
let body;
|
|
38
|
+
try {
|
|
39
|
+
body = await readJson(req);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
sendBadRequest(res, 'Invalid JSON body or payload too large.');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const value = body;
|
|
46
|
+
const ownerId = typeof value?.ownerId === 'string' ? value.ownerId : '';
|
|
47
|
+
const credentialId = typeof value?.credentialId === 'string' ? value.credentialId : '';
|
|
48
|
+
const result = writeOwnerIdentityFile(homeDir, { ownerId, credentialId });
|
|
49
|
+
if (!result.ok) {
|
|
50
|
+
sendBadRequest(res, result.error);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const resolved = resolveOwnerIdentity(process.env, homeDir);
|
|
54
|
+
sendSuccess(res, {
|
|
55
|
+
record: result.record,
|
|
56
|
+
source: 'file',
|
|
57
|
+
governance: resolveOwnerConfigSnapshot(authConfig, resolved),
|
|
58
|
+
});
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (method === 'DELETE') {
|
|
62
|
+
const result = deleteOwnerIdentityFile(homeDir);
|
|
63
|
+
if (!result.ok) {
|
|
64
|
+
sendError(res, 500, 'owner_identity_delete_failed', result.error);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const resolved = resolveOwnerIdentity(process.env, homeDir);
|
|
68
|
+
sendSuccess(res, {
|
|
69
|
+
ok: true,
|
|
70
|
+
source: 'none',
|
|
71
|
+
governance: resolveOwnerConfigSnapshot(authConfig, resolved),
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
sendMethodNotAllowed(res);
|
|
76
|
+
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
export declare const UPDATE_HISTORY_KINDS: readonly ['update', 'reinstall', 'legacy_migration', 'rollback', 'refusal', 'failure', 'recovery', 'unknown'];
|
|
3
|
+
export type UpdateHistoryKind = (typeof UPDATE_HISTORY_KINDS)[number];
|
|
2
4
|
interface UpdateHistoryEntry {
|
|
3
5
|
id: string;
|
|
4
6
|
timestamp: string;
|
|
5
7
|
fromVersion: string;
|
|
6
8
|
toVersion: string;
|
|
7
9
|
success: boolean;
|
|
10
|
+
kind: UpdateHistoryKind;
|
|
8
11
|
backupPath?: string;
|
|
12
|
+
reason?: string;
|
|
13
|
+
nextAction?: string;
|
|
9
14
|
}
|
|
10
15
|
export declare function appendUpdateHistory(workspaceDir: string, entry: Omit<UpdateHistoryEntry, 'id' | 'timestamp'>): void;
|
|
11
16
|
export declare function handleUpdateHistoryRoute(req: IncomingMessage, res: ServerResponse, workspaceDir: string, _subPath: string): Promise<void>;
|
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { sendSuccess, sendMethodNotAllowed } from '../utils/response.js';
|
|
4
|
+
export const UPDATE_HISTORY_KINDS = [
|
|
5
|
+
'update',
|
|
6
|
+
'reinstall',
|
|
7
|
+
'legacy_migration',
|
|
8
|
+
'rollback',
|
|
9
|
+
'refusal',
|
|
10
|
+
'failure',
|
|
11
|
+
'recovery',
|
|
12
|
+
'unknown',
|
|
13
|
+
];
|
|
14
|
+
function isHistoryKind(value) {
|
|
15
|
+
return typeof value === 'string' && UPDATE_HISTORY_KINDS.includes(value);
|
|
16
|
+
}
|
|
17
|
+
function parseHistoryEntry(value) {
|
|
18
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
19
|
+
return undefined;
|
|
20
|
+
const raw = value;
|
|
21
|
+
if (typeof raw.id !== 'string' ||
|
|
22
|
+
typeof raw.timestamp !== 'string' ||
|
|
23
|
+
typeof raw.fromVersion !== 'string' ||
|
|
24
|
+
typeof raw.toVersion !== 'string' ||
|
|
25
|
+
typeof raw.success !== 'boolean')
|
|
26
|
+
return undefined;
|
|
27
|
+
if (raw.kind !== undefined && !isHistoryKind(raw.kind))
|
|
28
|
+
return undefined;
|
|
29
|
+
if (raw.reason !== undefined && typeof raw.reason !== 'string')
|
|
30
|
+
return undefined;
|
|
31
|
+
if (raw.nextAction !== undefined && typeof raw.nextAction !== 'string')
|
|
32
|
+
return undefined;
|
|
33
|
+
if (raw.backupPath !== undefined && typeof raw.backupPath !== 'string')
|
|
34
|
+
return undefined;
|
|
35
|
+
return {
|
|
36
|
+
id: raw.id,
|
|
37
|
+
timestamp: raw.timestamp,
|
|
38
|
+
fromVersion: raw.fromVersion,
|
|
39
|
+
toVersion: raw.toVersion,
|
|
40
|
+
success: raw.success,
|
|
41
|
+
// Pre-Phase-0 records did not identify their operation. The operation is
|
|
42
|
+
// UNKNOWN — labeling them legacy_migration would claim a migration
|
|
43
|
+
// happened, which the record cannot prove (unknown ≠ legacy_migration).
|
|
44
|
+
kind: raw.kind === undefined ? 'unknown' : raw.kind,
|
|
45
|
+
...(typeof raw.backupPath === 'string' ? { backupPath: raw.backupPath } : {}),
|
|
46
|
+
...(typeof raw.reason === 'string' ? { reason: raw.reason } : {}),
|
|
47
|
+
...(typeof raw.nextAction === 'string' ? { nextAction: raw.nextAction } : {}),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
4
50
|
function getHistoryPath(workspaceDir) {
|
|
5
51
|
return path.join(workspaceDir, '.pd', 'update-history.json');
|
|
6
52
|
}
|
|
@@ -10,10 +56,10 @@ function loadHistory(historyPath) {
|
|
|
10
56
|
const raw = fs.readFileSync(historyPath, 'utf-8');
|
|
11
57
|
const parsed = JSON.parse(raw);
|
|
12
58
|
if (Array.isArray(parsed)) {
|
|
13
|
-
return parsed.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
59
|
+
return parsed.flatMap((entry) => {
|
|
60
|
+
const parsedEntry = parseHistoryEntry(entry);
|
|
61
|
+
return parsedEntry === undefined ? [] : [parsedEntry];
|
|
62
|
+
});
|
|
17
63
|
}
|
|
18
64
|
}
|
|
19
65
|
catch (err) {
|
|
@@ -8,6 +8,8 @@ import { appendUpdateHistory } from './update-history.js';
|
|
|
8
8
|
import { checkOpenClawGateway, stopOpenClawGateway, restartOpenClawGateway, } from '../utils/gateway.js';
|
|
9
9
|
import { migrateLegacyExtensionBackups, reservePdBackupDestination, resolvePdBackupsRoot, } from '../utils/pd-backups.js';
|
|
10
10
|
import { ActivationCompatibilityReadModel } from '@principles/core/runtime-v2';
|
|
11
|
+
import { getInstallLayoutPaths, resolveInstallLayout } from '@principles/install-layout';
|
|
12
|
+
import { collectFileDepLinkSpecs } from '../utils/update-links.js';
|
|
11
13
|
/**
|
|
12
14
|
* Legacy rule contract preflight (2026-08-19): refuse to swap the runtime
|
|
13
15
|
* while an ACTIVE owner-approved rule still depends on a RuleHost contract
|
|
@@ -68,8 +70,48 @@ function resolveOpenclawHome() {
|
|
|
68
70
|
function resolveExtensionsDir() {
|
|
69
71
|
return path.join(resolveOpenclawHome(), 'extensions');
|
|
70
72
|
}
|
|
73
|
+
function resolveUpdateLayout() {
|
|
74
|
+
const homeDir = os.homedir();
|
|
75
|
+
const paths = getInstallLayoutPaths(homeDir);
|
|
76
|
+
const legacyPluginDir = path.join(resolveExtensionsDir(), 'principles-disciple');
|
|
77
|
+
let manifest;
|
|
78
|
+
try {
|
|
79
|
+
manifest = JSON.parse(fs.readFileSync(paths.manifest, 'utf8'));
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
manifest = undefined;
|
|
83
|
+
}
|
|
84
|
+
const resolution = resolveInstallLayout({
|
|
85
|
+
homeDir,
|
|
86
|
+
manifest,
|
|
87
|
+
canonicalRuntimeExists: fs.existsSync(paths.runtimeDir),
|
|
88
|
+
legacyExtensionExists: fs.existsSync(legacyPluginDir),
|
|
89
|
+
});
|
|
90
|
+
if (resolution.mode === 'missing')
|
|
91
|
+
return undefined;
|
|
92
|
+
if (resolution.mode === 'canonical') {
|
|
93
|
+
return {
|
|
94
|
+
pluginDir: paths.pluginDir,
|
|
95
|
+
consoleDir: paths.consoleDir,
|
|
96
|
+
coreDir: paths.coreDir,
|
|
97
|
+
hostRuntimeDir: paths.hostRuntimeDir,
|
|
98
|
+
pdCliDir: paths.pdCliDir,
|
|
99
|
+
installLayoutDir: paths.installLayoutDir,
|
|
100
|
+
hosts: resolution.manifest?.hosts ?? [],
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
pluginDir: legacyPluginDir,
|
|
105
|
+
consoleDir: path.join(legacyPluginDir, 'console'),
|
|
106
|
+
coreDir: path.join(legacyPluginDir, 'core'),
|
|
107
|
+
hostRuntimeDir: path.join(legacyPluginDir, 'host-runtime'),
|
|
108
|
+
pdCliDir: path.join(legacyPluginDir, 'pd-cli'),
|
|
109
|
+
installLayoutDir: path.join(legacyPluginDir, 'install-layout'),
|
|
110
|
+
hosts: ['openclaw'],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
71
113
|
function resolvePluginDir(_workspaceDir) {
|
|
72
|
-
return path.join(resolveExtensionsDir(), 'principles-disciple');
|
|
114
|
+
return resolveUpdateLayout()?.pluginDir ?? path.join(resolveExtensionsDir(), 'principles-disciple');
|
|
73
115
|
}
|
|
74
116
|
function readCurrentVersion(pluginDir) {
|
|
75
117
|
const pkgPath = path.join(pluginDir, 'package.json');
|
|
@@ -480,6 +522,26 @@ async function doApplyUpdate(options, workspaceDir) {
|
|
|
480
522
|
const toVersion = typeof data.version === 'string' ? data.version : undefined;
|
|
481
523
|
if (!toVersion)
|
|
482
524
|
return { success: false, message: 'Missing version in registry response' };
|
|
525
|
+
const advancesInstalled = fromVersion !== 'unknown' &&
|
|
526
|
+
semver.valid(fromVersion) !== null &&
|
|
527
|
+
semver.valid(toVersion) !== null &&
|
|
528
|
+
semver.gt(toVersion, fromVersion);
|
|
529
|
+
if (!advancesInstalled) {
|
|
530
|
+
appendUpdateHistory(workspaceDir, {
|
|
531
|
+
fromVersion,
|
|
532
|
+
toVersion,
|
|
533
|
+
success: false,
|
|
534
|
+
kind: 'refusal',
|
|
535
|
+
reason: 'installer_bundle_stale',
|
|
536
|
+
nextAction: 'Wait for a newer installer release, then retry the update.',
|
|
537
|
+
});
|
|
538
|
+
return {
|
|
539
|
+
success: false,
|
|
540
|
+
message: 'Installed version would not advance — the update source is stale or malformed.',
|
|
541
|
+
reason: 'installer_bundle_stale',
|
|
542
|
+
nextAction: 'Wait for a newer installer release, then retry the update.',
|
|
543
|
+
};
|
|
544
|
+
}
|
|
483
545
|
const dist = typeof data.dist === 'object' && data.dist !== null ? data.dist : null;
|
|
484
546
|
const tarball = dist && typeof dist.tarball === 'string' ? dist.tarball : undefined;
|
|
485
547
|
if (!tarball)
|
|
@@ -559,6 +621,7 @@ async function doApplyUpdate(options, workspaceDir) {
|
|
|
559
621
|
fromVersion,
|
|
560
622
|
toVersion,
|
|
561
623
|
success: true,
|
|
624
|
+
kind: 'update',
|
|
562
625
|
backupPath,
|
|
563
626
|
});
|
|
564
627
|
return {
|
|
@@ -620,6 +683,7 @@ async function doRollbackUpdate(options, workspaceDir) {
|
|
|
620
683
|
fromVersion: 'rolled-back',
|
|
621
684
|
toVersion: readCurrentVersion(targetDir) ?? 'unknown',
|
|
622
685
|
success: true,
|
|
686
|
+
kind: 'rollback',
|
|
623
687
|
backupPath: backupDir,
|
|
624
688
|
});
|
|
625
689
|
return { success: true, message: 'Rollback completed successfully' };
|
|
@@ -661,48 +725,131 @@ function depsMeaningfullyChanged(oldDeps, newDeps) {
|
|
|
661
725
|
return aKeys.some((k, i) => bKeys[i] !== k || a[k] !== b[k]);
|
|
662
726
|
}
|
|
663
727
|
/**
|
|
664
|
-
* Create the node_modules
|
|
665
|
-
*
|
|
728
|
+
* Create the node_modules resolution links for the installed components, if
|
|
729
|
+
* missing.
|
|
666
730
|
*
|
|
667
731
|
* Mirrors installer.ts syncPdCli: junction on Windows (no elevation needed),
|
|
668
732
|
* relative symlink elsewhere. Fresh installs get these links via npm install
|
|
669
|
-
* (the bundled package.json rewrites
|
|
670
|
-
* full update deliberately skips npm install, so it must create them
|
|
671
|
-
* Without
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
*
|
|
733
|
+
* (the bundled package.json rewrites internal deps to file:../<component>);
|
|
734
|
+
* the full update deliberately skips npm install, so it must create them
|
|
735
|
+
* itself. Without a link, updated dists crash at startup with
|
|
736
|
+
* ERR_MODULE_NOT_FOUND (host-runtime: PRI-561, 2026-08-21).
|
|
737
|
+
*
|
|
738
|
+
* Two sources, both fail-closed on creation errors:
|
|
739
|
+
* 1. the explicit link list below (known-critical links: a missing one
|
|
740
|
+
* means the updated console cannot start);
|
|
741
|
+
* 2. a data-driven pass that derives links from the STAGED manifests —
|
|
742
|
+
* the freshly extracted release trees under tempDir. Their `file:`
|
|
743
|
+
* declarations are the authoritative list of links the updated tree
|
|
744
|
+
* needs. Reading the deployed (pre-update) manifests instead would
|
|
745
|
+
* miss every dependency this release newly introduced: the running
|
|
746
|
+
* console executes update logic from its own dist (one generation
|
|
747
|
+
* behind the components it installs) — observed 2026-08-29 when the
|
|
748
|
+
* 1.221.2 console updated hosts to 1.222.5 but could not know about
|
|
749
|
+
* the newly introduced install-layout component, leaving
|
|
750
|
+
* host-runtime/node_modules/@principles/install-layout missing and
|
|
751
|
+
* every pd-cli runtime command failing with ERR_MODULE_NOT_FOUND.
|
|
675
752
|
*
|
|
676
753
|
* Returns undefined on success, or an error message (rc-9: observable, never
|
|
677
754
|
* silent — a missing link means the updated console cannot start).
|
|
678
755
|
*/
|
|
679
|
-
function
|
|
680
|
-
const hostRuntimeDir = path.join(extDir, 'host-runtime');
|
|
756
|
+
function ensureRuntimeResolutionLinks(layout, tempDir) {
|
|
681
757
|
const links = [
|
|
682
|
-
{ linkPath: path.join(
|
|
683
|
-
{ linkPath: path.join(
|
|
684
|
-
{ linkPath: path.join(
|
|
758
|
+
{ linkPath: path.join(layout.consoleDir, 'node_modules', '@principles', 'host-runtime'), target: layout.hostRuntimeDir },
|
|
759
|
+
{ linkPath: path.join(layout.pdCliDir, 'node_modules', '@principles', 'host-runtime'), target: layout.hostRuntimeDir },
|
|
760
|
+
{ linkPath: path.join(layout.consoleDir, 'node_modules', '@principles', 'install-layout'), target: layout.installLayoutDir },
|
|
761
|
+
{ linkPath: path.join(layout.pdCliDir, 'node_modules', '@principles', 'install-layout'), target: layout.installLayoutDir },
|
|
762
|
+
// host-runtime depends on @principles/install-layout at runtime; /apply-full
|
|
763
|
+
// skips npm install, so its node_modules must self-provision the link too.
|
|
764
|
+
{ linkPath: path.join(layout.hostRuntimeDir, 'node_modules', '@principles', 'install-layout'), target: layout.installLayoutDir },
|
|
765
|
+
{ linkPath: path.join(layout.consoleDir, 'node_modules', 'principles-disciple'), target: layout.pluginDir },
|
|
766
|
+
];
|
|
767
|
+
// Data-driven pass: derive links from the STAGED component manifests (see
|
|
768
|
+
// the comment above — staged, never the deployed pre-update manifests).
|
|
769
|
+
const stagedComponents = [
|
|
770
|
+
{ manifestDir: path.join(tempDir, 'console'), deployedDir: layout.consoleDir },
|
|
771
|
+
{ manifestDir: path.join(tempDir, 'pd-cli'), deployedDir: layout.pdCliDir },
|
|
772
|
+
{ manifestDir: path.join(tempDir, 'host-runtime'), deployedDir: layout.hostRuntimeDir },
|
|
773
|
+
{ manifestDir: path.join(tempDir, 'install-layout'), deployedDir: layout.installLayoutDir },
|
|
774
|
+
{ manifestDir: path.join(tempDir, 'core'), deployedDir: layout.coreDir },
|
|
775
|
+
{ manifestDir: path.join(tempDir, 'plugin'), deployedDir: layout.pluginDir },
|
|
685
776
|
];
|
|
686
|
-
|
|
777
|
+
const readStagedDependencies = (manifestDir) => {
|
|
778
|
+
try {
|
|
779
|
+
const pkgPath = path.join(manifestDir, 'package.json');
|
|
780
|
+
if (!fs.existsSync(pkgPath))
|
|
781
|
+
return {};
|
|
782
|
+
const parsed = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
783
|
+
if (!isRecord(parsed) || !isRecord(parsed.dependencies))
|
|
784
|
+
return {};
|
|
785
|
+
const out = {};
|
|
786
|
+
for (const [name, ref] of Object.entries(parsed.dependencies)) {
|
|
787
|
+
if (typeof ref === 'string')
|
|
788
|
+
out[name] = ref;
|
|
789
|
+
}
|
|
790
|
+
return out;
|
|
791
|
+
}
|
|
792
|
+
catch {
|
|
793
|
+
// rc-9: an unreadable staged manifest degrades to "no derived links" —
|
|
794
|
+
// the explicit list above still covers the known-critical links.
|
|
795
|
+
return {};
|
|
796
|
+
}
|
|
797
|
+
};
|
|
798
|
+
const fileDepSpecs = collectFileDepLinkSpecs(stagedComponents, readStagedDependencies);
|
|
799
|
+
const createResolutionLink = (linkPath, target) => {
|
|
800
|
+
// Idempotent: never overwrite an existing link or directory (fresh
|
|
801
|
+
// installs have npm-created real dirs in these slots).
|
|
687
802
|
if (fs.existsSync(linkPath))
|
|
688
|
-
|
|
803
|
+
return undefined;
|
|
689
804
|
try {
|
|
690
805
|
fs.mkdirSync(path.dirname(linkPath), { recursive: true });
|
|
691
806
|
if (process.platform === 'win32') {
|
|
692
807
|
fs.symlinkSync(target, linkPath, 'junction');
|
|
693
808
|
}
|
|
694
809
|
else {
|
|
695
|
-
fs.symlinkSync(
|
|
810
|
+
fs.symlinkSync(path.relative(path.dirname(linkPath), target), linkPath, 'dir');
|
|
696
811
|
}
|
|
812
|
+
return undefined;
|
|
697
813
|
}
|
|
698
814
|
catch (error) {
|
|
699
|
-
return `Failed to create
|
|
815
|
+
return `Failed to create runtime resolution link at ${linkPath}: ${error instanceof Error ? error.message : String(error)}`;
|
|
700
816
|
}
|
|
817
|
+
};
|
|
818
|
+
// Pass 1 — explicit known-critical links, fail-closed BEFORE any byte is
|
|
819
|
+
// swapped (a link-creation failure aborts with the installed packages
|
|
820
|
+
// untouched: the PRI-561 ordering contract).
|
|
821
|
+
for (const { linkPath, target } of links) {
|
|
822
|
+
if (!fs.existsSync(target))
|
|
823
|
+
continue;
|
|
824
|
+
const error = createResolutionLink(linkPath, target);
|
|
825
|
+
if (error)
|
|
826
|
+
return error;
|
|
827
|
+
}
|
|
828
|
+
// Pass 2 — data-driven derived links. Their deployed target dir may be
|
|
829
|
+
// created by the copy steps that follow (a brand-new component's dir does
|
|
830
|
+
// not exist yet); each staged target's existence was already proven by the
|
|
831
|
+
// extraction, and the copies below run unconditionally.
|
|
832
|
+
for (const spec of fileDepSpecs) {
|
|
833
|
+
if (fs.existsSync(spec.linkPath))
|
|
834
|
+
continue;
|
|
835
|
+
const error = createResolutionLink(spec.linkPath, spec.target);
|
|
836
|
+
if (error)
|
|
837
|
+
return error;
|
|
701
838
|
}
|
|
702
839
|
return undefined;
|
|
703
840
|
}
|
|
704
841
|
async function doInlineFullUpdate(workspaceDir) {
|
|
705
|
-
const
|
|
842
|
+
const layout = resolveUpdateLayout();
|
|
843
|
+
if (!layout) {
|
|
844
|
+
return {
|
|
845
|
+
success: false,
|
|
846
|
+
message: 'PD install runtime could not be resolved.',
|
|
847
|
+
reason: 'install_runtime_missing',
|
|
848
|
+
nextAction: 'Run npx create-principles-disciple to install or repair PD, then retry the update.',
|
|
849
|
+
requiresRestart: false,
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
const extDir = layout.pluginDir;
|
|
706
853
|
// Legacy-contract preflight BEFORE stopping the gateway or touching files:
|
|
707
854
|
// refuse while an active rule still uses a removed RuleHost contract
|
|
708
855
|
// symbol — the running installation stays exactly as it was.
|
|
@@ -716,23 +863,16 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
716
863
|
requiresRestart: false,
|
|
717
864
|
};
|
|
718
865
|
}
|
|
719
|
-
//
|
|
720
|
-
|
|
866
|
+
// gatewayWasStopped records whether we had to stop an OpenClaw gateway to
|
|
867
|
+
// release native module locks. It is only ever set after candidate
|
|
868
|
+
// verification, in the host-aware stop below.
|
|
721
869
|
let gatewayWasStopped = false;
|
|
722
|
-
|
|
723
|
-
const stopRes = stopOpenClawGateway();
|
|
724
|
-
if (stopRes.ok)
|
|
725
|
-
gatewayWasStopped = true;
|
|
726
|
-
}
|
|
727
|
-
// Capture version before changes
|
|
870
|
+
// Capture installed facts before staging any candidate release.
|
|
728
871
|
const fromVersion = readCurrentVersion(extDir) ?? 'unknown';
|
|
729
872
|
// Capture the installed skill language before the tarball's manifest
|
|
730
873
|
// overwrites it (PR #1332 companion — see reapplySkillLanguage).
|
|
731
874
|
const skillLanguage = detectInstalledSkillLanguage(extDir);
|
|
732
875
|
let tempDir;
|
|
733
|
-
// Heal legacy installs: move old backups out of the extensions dir so
|
|
734
|
-
// OpenClaw discovery stops reporting a duplicate plugin (see pd-backups.ts).
|
|
735
|
-
logLegacyBackupMigration('pd-update-full');
|
|
736
876
|
try {
|
|
737
877
|
// 2. Fetch installer package info from npm
|
|
738
878
|
const response = await fetchWithRetry(NPM_REGISTRY_INSTALLER, 'Installer registry check');
|
|
@@ -740,6 +880,32 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
740
880
|
if (!isRecord(rawData))
|
|
741
881
|
return { success: false, message: 'Invalid registry response', requiresRestart: false };
|
|
742
882
|
const toVersion = typeof rawData.version === 'string' ? rawData.version : undefined;
|
|
883
|
+
const bundledPluginVersion = isRecord(rawData.pd) && typeof rawData.pd.bundledPluginVersion === 'string'
|
|
884
|
+
? rawData.pd.bundledPluginVersion
|
|
885
|
+
: undefined;
|
|
886
|
+
if (bundledPluginVersion !== undefined) {
|
|
887
|
+
const advancesInstalled = fromVersion !== 'unknown' &&
|
|
888
|
+
semver.valid(fromVersion) !== null &&
|
|
889
|
+
semver.valid(bundledPluginVersion) !== null &&
|
|
890
|
+
semver.gt(bundledPluginVersion, fromVersion);
|
|
891
|
+
if (!advancesInstalled) {
|
|
892
|
+
appendUpdateHistory(workspaceDir, {
|
|
893
|
+
fromVersion,
|
|
894
|
+
toVersion: bundledPluginVersion,
|
|
895
|
+
success: false,
|
|
896
|
+
kind: 'refusal',
|
|
897
|
+
reason: 'installer_bundle_stale',
|
|
898
|
+
nextAction: 'Wait for a newer installer release, then retry the update.',
|
|
899
|
+
});
|
|
900
|
+
return {
|
|
901
|
+
success: false,
|
|
902
|
+
message: 'Installed version would not advance — the update source is stale or malformed.',
|
|
903
|
+
reason: 'installer_bundle_stale',
|
|
904
|
+
nextAction: 'Wait for a newer installer release, then retry the update.',
|
|
905
|
+
requiresRestart: false,
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
}
|
|
743
909
|
const dist = isRecord(rawData.dist) ? rawData.dist : null;
|
|
744
910
|
const tarball = dist && typeof dist.tarball === 'string' ? dist.tarball : undefined;
|
|
745
911
|
if (!tarball)
|
|
@@ -754,10 +920,53 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
754
920
|
// shell syntax (Mimosa command-injection finding, 2026-08-22).
|
|
755
921
|
execFileSync('tar', ['xzf', tarballPath, '-C', tempDir, '--strip-components=1'], { stdio: 'pipe' });
|
|
756
922
|
fs.unlinkSync(tarballPath);
|
|
923
|
+
// The tarball, not the installer package version, is the release we are
|
|
924
|
+
// about to activate. Prove it advances the installed plugin BEFORE the
|
|
925
|
+
// gateway is stopped or any production file is copied.
|
|
926
|
+
const newPkgPath = path.join(tempDir, 'plugin', 'package.json');
|
|
927
|
+
const stagedVersion = readCurrentVersion(path.join(tempDir, 'plugin'));
|
|
928
|
+
const progressed = fromVersion !== 'unknown' &&
|
|
929
|
+
stagedVersion !== undefined &&
|
|
930
|
+
semver.valid(fromVersion) !== null &&
|
|
931
|
+
semver.valid(stagedVersion) !== null &&
|
|
932
|
+
semver.gt(stagedVersion, fromVersion) &&
|
|
933
|
+
(bundledPluginVersion === undefined || bundledPluginVersion === stagedVersion);
|
|
934
|
+
if (!progressed) {
|
|
935
|
+
if (tempDir && fs.existsSync(tempDir)) {
|
|
936
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
937
|
+
}
|
|
938
|
+
appendUpdateHistory(workspaceDir, {
|
|
939
|
+
fromVersion,
|
|
940
|
+
toVersion: stagedVersion ?? 'unknown',
|
|
941
|
+
success: false,
|
|
942
|
+
kind: 'refusal',
|
|
943
|
+
reason: 'installer_bundle_stale',
|
|
944
|
+
nextAction: 'Wait for a newer installer release, then retry the update.',
|
|
945
|
+
});
|
|
946
|
+
return {
|
|
947
|
+
success: false,
|
|
948
|
+
message: 'Installed version would not advance — the update source is stale or malformed.',
|
|
949
|
+
reason: 'installer_bundle_stale',
|
|
950
|
+
nextAction: 'Wait for a newer installer release, then retry the update.',
|
|
951
|
+
requiresRestart: false,
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
// Only a verified advancing release may cause host interruption or touch
|
|
955
|
+
// the production installation.
|
|
956
|
+
const gatewayStatus = layout.hosts.includes('openclaw')
|
|
957
|
+
? await checkOpenClawGateway()
|
|
958
|
+
: { isRunning: false };
|
|
959
|
+
if (gatewayStatus.isRunning) {
|
|
960
|
+
const stopRes = stopOpenClawGateway();
|
|
961
|
+
if (stopRes.ok)
|
|
962
|
+
gatewayWasStopped = true;
|
|
963
|
+
}
|
|
964
|
+
// Heal legacy installs only after candidate verification. This writes
|
|
965
|
+
// outside the release tree, so it must not happen for a refused release.
|
|
966
|
+
logLegacyBackupMigration('pd-update-full');
|
|
757
967
|
// 4. Detect dependency changes (informational — logged but not blocking;
|
|
758
968
|
// the .js files are still updated; node_modules stays as-is)
|
|
759
969
|
let depsChanged = false;
|
|
760
|
-
const newPkgPath = path.join(tempDir, 'plugin', 'package.json');
|
|
761
970
|
const oldPkgPath = path.join(extDir, 'package.json');
|
|
762
971
|
if (fs.existsSync(newPkgPath) && fs.existsSync(oldPkgPath)) {
|
|
763
972
|
try {
|
|
@@ -785,17 +994,22 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
785
994
|
// console that does not import it, so skipping is consistent for
|
|
786
995
|
// them. On fresh installs this is an overlay refresh + link no-op.
|
|
787
996
|
const hostRuntimeSrc = path.join(tempDir, 'host-runtime');
|
|
788
|
-
const hostRuntimeDest =
|
|
997
|
+
const hostRuntimeDest = layout.hostRuntimeDir;
|
|
789
998
|
if (fs.existsSync(hostRuntimeSrc) &&
|
|
790
999
|
fs.existsSync(path.join(hostRuntimeSrc, 'package.json')) &&
|
|
791
1000
|
fs.existsSync(path.join(hostRuntimeSrc, 'dist'))) {
|
|
792
1001
|
copyDirRecursive(hostRuntimeSrc, hostRuntimeDest, SKIP_DIRS);
|
|
793
|
-
const
|
|
1002
|
+
const installLayoutSrc = path.join(tempDir, 'install-layout');
|
|
1003
|
+
if (fs.existsSync(path.join(installLayoutSrc, 'package.json')) && fs.existsSync(path.join(installLayoutSrc, 'dist'))) {
|
|
1004
|
+
copyDirRecursive(installLayoutSrc, layout.installLayoutDir, SKIP_DIRS);
|
|
1005
|
+
}
|
|
1006
|
+
const linkError = ensureRuntimeResolutionLinks(layout, tempDir);
|
|
794
1007
|
if (linkError) {
|
|
795
1008
|
appendUpdateHistory(workspaceDir, {
|
|
796
1009
|
fromVersion,
|
|
797
1010
|
toVersion: 'failed',
|
|
798
1011
|
success: false,
|
|
1012
|
+
kind: 'failure',
|
|
799
1013
|
});
|
|
800
1014
|
return {
|
|
801
1015
|
success: false,
|
|
@@ -818,20 +1032,20 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
818
1032
|
// console/node_modules/ may contain locked native modules like
|
|
819
1033
|
// better-sqlite3 that the running console process holds via dlopen)
|
|
820
1034
|
const consoleSrc = path.join(tempDir, 'console');
|
|
821
|
-
const consoleDest =
|
|
1035
|
+
const consoleDest = layout.consoleDir;
|
|
822
1036
|
if (fs.existsSync(consoleSrc)) {
|
|
823
1037
|
copyDirRecursive(consoleSrc, consoleDest, SKIP_DIRS);
|
|
824
1038
|
}
|
|
825
1039
|
// c. core/ → extDir/core/ (overwrite, skip node_modules for safety)
|
|
826
1040
|
const coreSrc = path.join(tempDir, 'core');
|
|
827
|
-
const coreDest =
|
|
1041
|
+
const coreDest = layout.coreDir;
|
|
828
1042
|
if (fs.existsSync(coreSrc)) {
|
|
829
1043
|
copyDirRecursive(coreSrc, coreDest, SKIP_DIRS);
|
|
830
1044
|
}
|
|
831
1045
|
// d. pd-cli/dist + package.json → extDir/pd-cli/ (overwrite only,
|
|
832
1046
|
// do NOT rmSync — preserves node_modules symlinks created at install)
|
|
833
1047
|
const pdCliSrc = path.join(tempDir, 'pd-cli');
|
|
834
|
-
const pdCliDest =
|
|
1048
|
+
const pdCliDest = layout.pdCliDir;
|
|
835
1049
|
if (fs.existsSync(pdCliSrc)) {
|
|
836
1050
|
const distSrc = path.join(pdCliSrc, 'dist');
|
|
837
1051
|
const distDest = path.join(pdCliDest, 'dist');
|
|
@@ -857,11 +1071,8 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
857
1071
|
// false "update available". Detect that and fail loud (rc-9) instead of
|
|
858
1072
|
// reporting a false success.
|
|
859
1073
|
const newVersion = readCurrentVersion(extDir) ?? toVersion ?? 'unknown';
|
|
860
|
-
const
|
|
861
|
-
|
|
862
|
-
semver.valid(newVersion) !== null &&
|
|
863
|
-
semver.gt(newVersion, fromVersion);
|
|
864
|
-
if (!progressed) {
|
|
1074
|
+
const installedExpectedRelease = newVersion === stagedVersion;
|
|
1075
|
+
if (!installedExpectedRelease) {
|
|
865
1076
|
// Files were already rewritten to the same (or lower) version. Record a
|
|
866
1077
|
// FAILED history entry so the operator sees why, and return a structured
|
|
867
1078
|
// error with nextAction.
|
|
@@ -869,6 +1080,7 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
869
1080
|
fromVersion,
|
|
870
1081
|
toVersion: newVersion,
|
|
871
1082
|
success: false,
|
|
1083
|
+
kind: 'failure',
|
|
872
1084
|
});
|
|
873
1085
|
return {
|
|
874
1086
|
success: false,
|
|
@@ -883,6 +1095,7 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
883
1095
|
fromVersion,
|
|
884
1096
|
toVersion: newVersion,
|
|
885
1097
|
success: true,
|
|
1098
|
+
kind: 'update',
|
|
886
1099
|
});
|
|
887
1100
|
return {
|
|
888
1101
|
success: true,
|
|
@@ -908,6 +1121,7 @@ async function doInlineFullUpdate(workspaceDir) {
|
|
|
908
1121
|
fromVersion,
|
|
909
1122
|
toVersion: 'failed',
|
|
910
1123
|
success: false,
|
|
1124
|
+
kind: 'failure',
|
|
911
1125
|
});
|
|
912
1126
|
if (isLockError) {
|
|
913
1127
|
return {
|
|
@@ -990,6 +1204,14 @@ export async function handleUpdateRoute(req, res, workspaceDir, subPath) {
|
|
|
990
1204
|
}
|
|
991
1205
|
// createBackup is a boolean (default false)
|
|
992
1206
|
const createBackup = typeof body.createBackup === 'boolean' ? body.createBackup : false;
|
|
1207
|
+
// The Console updater owns only the installed PD runtime selected at
|
|
1208
|
+
// process start. A caller-supplied path inside a workspace may be a
|
|
1209
|
+
// development checkout; accepting it lets a registry package overwrite
|
|
1210
|
+
// source files and makes version history describe the wrong product.
|
|
1211
|
+
if (path.resolve(targetDir) !== path.resolve(pluginDir)) {
|
|
1212
|
+
sendError(res, 400, 'update_target_not_installed', 'Updates may only target the installed PD runtime.', { nextAction: 'Run the official installer to repair the installation, then retry from Console.' });
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
993
1215
|
// Path traversal validation
|
|
994
1216
|
if (!validatePathInWorkspace(targetDir, workspaceDir)) {
|
|
995
1217
|
sendBadRequest(res, 'targetDir must be within workspace or extensions directory');
|