create-principles-disciple 1.121.8 → 1.121.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (461) hide show
  1. package/README.md +13 -1
  2. package/console/dist/server/config/pd-config-store.d.ts +1 -3
  3. package/console/dist/server/config/pd-config-store.js +4 -4
  4. package/console/dist/server/feedback/channels.d.ts +2 -8
  5. package/console/dist/server/feedback/channels.js +0 -11
  6. package/console/dist/server/index.js +34 -5
  7. package/console/dist/server/models/ActivationsConsoleModel.d.ts +28 -1
  8. package/console/dist/server/models/ActivationsConsoleModel.js +72 -30
  9. package/console/dist/server/models/GovernanceExperienceCollector.d.ts +28 -0
  10. package/console/dist/server/models/GovernanceExperienceCollector.js +305 -0
  11. package/console/dist/server/models/GovernanceProjectionCollector.d.ts +60 -2
  12. package/console/dist/server/models/GovernanceProjectionCollector.js +323 -285
  13. package/console/dist/server/models/PrincipleClassifier.d.ts +1 -1
  14. package/console/dist/server/models/PrincipleClassifier.js +7 -4
  15. package/console/dist/server/models/PrinciplesConsoleModel.d.ts +2 -1
  16. package/console/dist/server/models/ReceiptsConsoleModel.d.ts +5 -0
  17. package/console/dist/server/models/ReceiptsConsoleModel.js +140 -13
  18. package/console/dist/server/routes/activations.js +1 -1
  19. package/console/dist/server/routes/failed-tasks.js +28 -11
  20. package/console/dist/server/routes/governance.d.ts +26 -0
  21. package/console/dist/server/routes/governance.js +51 -0
  22. package/console/dist/server/routes/owner-identity.d.ts +31 -0
  23. package/console/dist/server/routes/owner-identity.js +76 -0
  24. package/console/dist/server/routes/update-history.d.ts +5 -0
  25. package/console/dist/server/routes/update-history.js +50 -4
  26. package/console/dist/server/routes/update.js +186 -32
  27. package/console/dist/shared/feedback-channel-ids.d.ts +13 -0
  28. package/console/dist/shared/feedback-channel-ids.js +12 -0
  29. package/console/dist/shared/feedback-contract.d.ts +46 -0
  30. package/console/dist/shared/feedback-contract.js +45 -0
  31. package/console/dist/ui/App.js +1 -1
  32. package/console/dist/ui/api.d.ts +22 -3
  33. package/console/dist/ui/api.js +63 -3
  34. package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.d.ts +6 -0
  35. package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.js +66 -0
  36. package/console/dist/ui/i18n/en.json +198 -2
  37. package/console/dist/ui/i18n/zh-CN.json +196 -0
  38. package/console/dist/ui/pages/activation/ActivationPage.js +14 -2
  39. package/console/dist/ui/pages/failed-tasks/FailedTasksPage.js +25 -5
  40. package/console/dist/ui/pages/focus/FocusPage.d.ts +28 -1
  41. package/console/dist/ui/pages/focus/FocusPage.js +128 -15
  42. package/console/dist/ui/pages/principles/PrincipleDetailPage.d.ts +30 -0
  43. package/console/dist/ui/pages/principles/PrincipleDetailPage.js +49 -6
  44. package/console/dist/ui/pages/settings/SettingsPage.js +67 -2
  45. package/console/dist/ui/pages/settings/UpdatePage.js +7 -7
  46. package/console/dist/ui/utils/enum-labels.js +0 -1
  47. package/console/dist/ui/utils/validators.d.ts +53 -21
  48. package/console/dist/ui/utils/validators.js +248 -21
  49. package/console/dist/web/assets/app.css +6 -0
  50. package/console/dist/web/assets/app.js +2721 -1664
  51. package/console/package.json +3 -1
  52. package/core/dist/host/host-adapter.d.ts +1 -1
  53. package/core/dist/host/host-adapter.d.ts.map +1 -1
  54. package/core/dist/host/host-adapter.js +1 -0
  55. package/core/dist/host/host-adapter.js.map +1 -1
  56. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +12 -2
  57. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  58. package/core/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.js +1 -1
  59. package/core/dist/runtime-v2/__tests__/attack-e2e-pipeline-smoke.test.js.map +1 -1
  60. package/core/dist/runtime-v2/__tests__/governance-experience.test.d.ts +2 -0
  61. package/core/dist/runtime-v2/__tests__/governance-experience.test.d.ts.map +1 -0
  62. package/core/dist/runtime-v2/__tests__/governance-experience.test.js +300 -0
  63. package/core/dist/runtime-v2/__tests__/governance-experience.test.js.map +1 -0
  64. package/core/dist/runtime-v2/__tests__/owner-identity.test.d.ts +2 -0
  65. package/core/dist/runtime-v2/__tests__/owner-identity.test.d.ts.map +1 -0
  66. package/core/dist/runtime-v2/__tests__/owner-identity.test.js +147 -0
  67. package/core/dist/runtime-v2/__tests__/owner-identity.test.js.map +1 -0
  68. package/core/dist/runtime-v2/__tests__/product-telemetry-contract.test.d.ts +18 -0
  69. package/core/dist/runtime-v2/__tests__/product-telemetry-contract.test.d.ts.map +1 -0
  70. package/core/dist/runtime-v2/__tests__/product-telemetry-contract.test.js +303 -0
  71. package/core/dist/runtime-v2/__tests__/product-telemetry-contract.test.js.map +1 -0
  72. package/core/dist/runtime-v2/__tests__/recovery-actions-log.test.js +40 -0
  73. package/core/dist/runtime-v2/__tests__/recovery-actions-log.test.js.map +1 -1
  74. package/core/dist/runtime-v2/__tests__/status-contract.test.d.ts +2 -0
  75. package/core/dist/runtime-v2/__tests__/status-contract.test.d.ts.map +1 -0
  76. package/core/dist/runtime-v2/__tests__/status-contract.test.js +107 -0
  77. package/core/dist/runtime-v2/__tests__/status-contract.test.js.map +1 -0
  78. package/core/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.d.ts +2 -0
  79. package/core/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.d.ts.map +1 -0
  80. package/core/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.js +104 -0
  81. package/core/dist/runtime-v2/activation/__tests__/promotion-evidence-snapshot.test.js.map +1 -0
  82. package/core/dist/runtime-v2/activation/__tests__/promotion-readiness-evaluator.test.js +19 -0
  83. package/core/dist/runtime-v2/activation/__tests__/promotion-readiness-evaluator.test.js.map +1 -1
  84. package/core/dist/runtime-v2/activation/__tests__/rulecode-owner-decision-service.test.js +20 -0
  85. package/core/dist/runtime-v2/activation/__tests__/rulecode-owner-decision-service.test.js.map +1 -1
  86. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-safety-store.test.js +40 -0
  87. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-safety-store.test.js.map +1 -1
  88. package/core/dist/runtime-v2/activation/index.d.ts +2 -0
  89. package/core/dist/runtime-v2/activation/index.d.ts.map +1 -1
  90. package/core/dist/runtime-v2/activation/index.js +1 -0
  91. package/core/dist/runtime-v2/activation/index.js.map +1 -1
  92. package/core/dist/runtime-v2/activation/promotion-evidence-snapshot.d.ts +30 -0
  93. package/core/dist/runtime-v2/activation/promotion-evidence-snapshot.d.ts.map +1 -0
  94. package/core/dist/runtime-v2/activation/promotion-evidence-snapshot.js +87 -0
  95. package/core/dist/runtime-v2/activation/promotion-evidence-snapshot.js.map +1 -0
  96. package/core/dist/runtime-v2/activation/promotion-readiness-evaluator.d.ts.map +1 -1
  97. package/core/dist/runtime-v2/activation/promotion-readiness-evaluator.js +3 -0
  98. package/core/dist/runtime-v2/activation/promotion-readiness-evaluator.js.map +1 -1
  99. package/core/dist/runtime-v2/activation/promotion-readiness-reader.d.ts +1 -1
  100. package/core/dist/runtime-v2/activation/promotion-readiness-reader.d.ts.map +1 -1
  101. package/core/dist/runtime-v2/activation/promotion-readiness-reader.js +2 -2
  102. package/core/dist/runtime-v2/activation/promotion-readiness-reader.js.map +1 -1
  103. package/core/dist/runtime-v2/activation/rulecode-owner-decision-service.d.ts.map +1 -1
  104. package/core/dist/runtime-v2/activation/rulecode-owner-decision-service.js +18 -9
  105. package/core/dist/runtime-v2/activation/rulecode-owner-decision-service.js.map +1 -1
  106. package/core/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.js +1 -1
  107. package/core/dist/runtime-v2/adapter/__tests__/chaos-json-repair.test.js.map +1 -1
  108. package/core/dist/runtime-v2/adapter/__tests__/json-extractor.test.js +91 -1
  109. package/core/dist/runtime-v2/adapter/__tests__/json-extractor.test.js.map +1 -1
  110. package/core/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js +59 -12
  111. package/core/dist/runtime-v2/adapter/__tests__/pi-ai-runtime-adapter.test.js.map +1 -1
  112. package/core/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.js +10 -9
  113. package/core/dist/runtime-v2/adapter/__tests__/runtime-config-contract.test.js.map +1 -1
  114. package/core/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.js +42 -1
  115. package/core/dist/runtime-v2/adapter/__tests__/structured-output-repair.test.js.map +1 -1
  116. package/core/dist/runtime-v2/adapter/json-extractor.d.ts +25 -0
  117. package/core/dist/runtime-v2/adapter/json-extractor.d.ts.map +1 -1
  118. package/core/dist/runtime-v2/adapter/json-extractor.js +126 -0
  119. package/core/dist/runtime-v2/adapter/json-extractor.js.map +1 -1
  120. package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.d.ts +9 -4
  121. package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.d.ts.map +1 -1
  122. package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.js +9 -4
  123. package/core/dist/runtime-v2/adapter/l2-agent-loop-adapter.js.map +1 -1
  124. package/core/dist/runtime-v2/adapter/output-repair-contract.d.ts +5 -1
  125. package/core/dist/runtime-v2/adapter/output-repair-contract.d.ts.map +1 -1
  126. package/core/dist/runtime-v2/adapter/output-repair-contract.js +4 -1
  127. package/core/dist/runtime-v2/adapter/output-repair-contract.js.map +1 -1
  128. package/core/dist/runtime-v2/adapter/pi-ai-catalog.d.ts +7 -0
  129. package/core/dist/runtime-v2/adapter/pi-ai-catalog.d.ts.map +1 -0
  130. package/core/dist/runtime-v2/adapter/pi-ai-catalog.js +19 -0
  131. package/core/dist/runtime-v2/adapter/pi-ai-catalog.js.map +1 -0
  132. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts +13 -15
  133. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
  134. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js +104 -37
  135. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js.map +1 -1
  136. package/core/dist/runtime-v2/adapter/structured-output-repair.d.ts +16 -1
  137. package/core/dist/runtime-v2/adapter/structured-output-repair.d.ts.map +1 -1
  138. package/core/dist/runtime-v2/adapter/structured-output-repair.js +38 -6
  139. package/core/dist/runtime-v2/adapter/structured-output-repair.js.map +1 -1
  140. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts +1 -1
  141. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts.map +1 -1
  142. package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js +8 -9
  143. package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js.map +1 -1
  144. package/core/dist/runtime-v2/config/__tests__/pd-config-contract.test.js +27 -3
  145. package/core/dist/runtime-v2/config/__tests__/pd-config-contract.test.js.map +1 -1
  146. package/core/dist/runtime-v2/config/__tests__/pd-config-principles.test.d.ts +11 -0
  147. package/core/dist/runtime-v2/config/__tests__/pd-config-principles.test.d.ts.map +1 -0
  148. package/core/dist/runtime-v2/config/__tests__/pd-config-principles.test.js +93 -0
  149. package/core/dist/runtime-v2/config/__tests__/pd-config-principles.test.js.map +1 -0
  150. package/core/dist/runtime-v2/config/__tests__/pd-config-workspace.test.js +41 -0
  151. package/core/dist/runtime-v2/config/__tests__/pd-config-workspace.test.js.map +1 -1
  152. package/core/dist/runtime-v2/config/index.d.ts +2 -2
  153. package/core/dist/runtime-v2/config/index.d.ts.map +1 -1
  154. package/core/dist/runtime-v2/config/index.js +2 -0
  155. package/core/dist/runtime-v2/config/index.js.map +1 -1
  156. package/core/dist/runtime-v2/config/pd-config-agent-binding.d.ts.map +1 -1
  157. package/core/dist/runtime-v2/config/pd-config-agent-binding.js +4 -13
  158. package/core/dist/runtime-v2/config/pd-config-agent-binding.js.map +1 -1
  159. package/core/dist/runtime-v2/config/pd-config-effective.d.ts.map +1 -1
  160. package/core/dist/runtime-v2/config/pd-config-effective.js +14 -7
  161. package/core/dist/runtime-v2/config/pd-config-effective.js.map +1 -1
  162. package/core/dist/runtime-v2/config/pd-config-feature-flags.d.ts.map +1 -1
  163. package/core/dist/runtime-v2/config/pd-config-feature-flags.js +5 -12
  164. package/core/dist/runtime-v2/config/pd-config-feature-flags.js.map +1 -1
  165. package/core/dist/runtime-v2/config/pd-config-types.d.ts +8 -0
  166. package/core/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
  167. package/core/dist/runtime-v2/config/pd-config-types.js +2 -0
  168. package/core/dist/runtime-v2/config/pd-config-types.js.map +1 -1
  169. package/core/dist/runtime-v2/config/pd-config-validate.d.ts.map +1 -1
  170. package/core/dist/runtime-v2/config/pd-config-validate.js +48 -3
  171. package/core/dist/runtime-v2/config/pd-config-validate.js.map +1 -1
  172. package/core/dist/runtime-v2/core-principles/__tests__/core-axiom-block.test.js +36 -8
  173. package/core/dist/runtime-v2/core-principles/__tests__/core-axiom-block.test.js.map +1 -1
  174. package/core/dist/runtime-v2/core-principles/__tests__/core-principle-registry.test.js +36 -12
  175. package/core/dist/runtime-v2/core-principles/__tests__/core-principle-registry.test.js.map +1 -1
  176. package/core/dist/runtime-v2/core-principles/core-axiom-block.d.ts +22 -8
  177. package/core/dist/runtime-v2/core-principles/core-axiom-block.d.ts.map +1 -1
  178. package/core/dist/runtime-v2/core-principles/core-axiom-block.js +28 -13
  179. package/core/dist/runtime-v2/core-principles/core-axiom-block.js.map +1 -1
  180. package/core/dist/runtime-v2/core-principles/core-principle-registry.d.ts +29 -4
  181. package/core/dist/runtime-v2/core-principles/core-principle-registry.d.ts.map +1 -1
  182. package/core/dist/runtime-v2/core-principles/core-principle-registry.js +68 -33
  183. package/core/dist/runtime-v2/core-principles/core-principle-registry.js.map +1 -1
  184. package/core/dist/runtime-v2/core-principles/index.d.ts +3 -3
  185. package/core/dist/runtime-v2/core-principles/index.d.ts.map +1 -1
  186. package/core/dist/runtime-v2/core-principles/index.js +1 -1
  187. package/core/dist/runtime-v2/core-principles/index.js.map +1 -1
  188. package/core/dist/runtime-v2/evolution/evolution-types.d.ts +2 -1
  189. package/core/dist/runtime-v2/evolution/evolution-types.d.ts.map +1 -1
  190. package/core/dist/runtime-v2/evolution/evolution-types.js.map +1 -1
  191. package/core/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.d.ts +2 -0
  192. package/core/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.d.ts.map +1 -0
  193. package/core/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.js +48 -0
  194. package/core/dist/runtime-v2/feature-flags/__tests__/anonymous-product-telemetry-flag.test.js.map +1 -0
  195. package/core/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.d.ts +2 -0
  196. package/core/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.d.ts.map +1 -0
  197. package/core/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.js +46 -0
  198. package/core/dist/runtime-v2/feature-flags/__tests__/codex-conversation-ingestion-flag.test.js.map +1 -0
  199. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +86 -31
  200. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
  201. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.d.ts +2 -0
  202. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.d.ts.map +1 -0
  203. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.js +83 -0
  204. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-lifecycle.test.js.map +1 -0
  205. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts +19 -1
  206. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  207. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +128 -10
  208. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  209. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts +37 -0
  210. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.d.ts.map +1 -0
  211. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js +304 -0
  212. package/core/dist/runtime-v2/feature-flags/feature-flag-lifecycle.js.map +1 -0
  213. package/core/dist/runtime-v2/feature-flags/index.d.ts +4 -2
  214. package/core/dist/runtime-v2/feature-flags/index.d.ts.map +1 -1
  215. package/core/dist/runtime-v2/feature-flags/index.js +3 -1
  216. package/core/dist/runtime-v2/feature-flags/index.js.map +1 -1
  217. package/core/dist/runtime-v2/governance-experience-contract.d.ts +468 -0
  218. package/core/dist/runtime-v2/governance-experience-contract.d.ts.map +1 -0
  219. package/core/dist/runtime-v2/governance-experience-contract.js +208 -0
  220. package/core/dist/runtime-v2/governance-experience-contract.js.map +1 -0
  221. package/core/dist/runtime-v2/governance-experience.d.ts +11 -0
  222. package/core/dist/runtime-v2/governance-experience.d.ts.map +1 -0
  223. package/core/dist/runtime-v2/governance-experience.js +276 -0
  224. package/core/dist/runtime-v2/governance-experience.js.map +1 -0
  225. package/core/dist/runtime-v2/index.d.ts +20 -8
  226. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  227. package/core/dist/runtime-v2/index.js +20 -6
  228. package/core/dist/runtime-v2/index.js.map +1 -1
  229. package/core/dist/runtime-v2/internalization/__tests__/artificer-output-retry-flag.test.js +29 -10
  230. package/core/dist/runtime-v2/internalization/__tests__/artificer-output-retry-flag.test.js.map +1 -1
  231. package/core/dist/runtime-v2/owner-identity.d.ts +69 -0
  232. package/core/dist/runtime-v2/owner-identity.d.ts.map +1 -0
  233. package/core/dist/runtime-v2/owner-identity.js +179 -0
  234. package/core/dist/runtime-v2/owner-identity.js.map +1 -0
  235. package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -1
  236. package/core/dist/runtime-v2/pain-signal-runtime-factory.js +2 -3
  237. package/core/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
  238. package/core/dist/runtime-v2/product-telemetry/daily-identity.d.ts +70 -0
  239. package/core/dist/runtime-v2/product-telemetry/daily-identity.d.ts.map +1 -0
  240. package/core/dist/runtime-v2/product-telemetry/daily-identity.js +89 -0
  241. package/core/dist/runtime-v2/product-telemetry/daily-identity.js.map +1 -0
  242. package/core/dist/runtime-v2/product-telemetry/snapshot-contract.d.ts +110 -0
  243. package/core/dist/runtime-v2/product-telemetry/snapshot-contract.d.ts.map +1 -0
  244. package/core/dist/runtime-v2/product-telemetry/snapshot-contract.js +250 -0
  245. package/core/dist/runtime-v2/product-telemetry/snapshot-contract.js.map +1 -0
  246. package/core/dist/runtime-v2/pruning-read-model.d.ts +2 -1
  247. package/core/dist/runtime-v2/pruning-read-model.d.ts.map +1 -1
  248. package/core/dist/runtime-v2/pruning-read-model.js.map +1 -1
  249. package/core/dist/runtime-v2/receipt-coverage.d.ts +63 -0
  250. package/core/dist/runtime-v2/receipt-coverage.d.ts.map +1 -0
  251. package/core/dist/runtime-v2/receipt-coverage.js +19 -0
  252. package/core/dist/runtime-v2/receipt-coverage.js.map +1 -0
  253. package/core/dist/runtime-v2/recovery-actions-log.d.ts +7 -0
  254. package/core/dist/runtime-v2/recovery-actions-log.d.ts.map +1 -1
  255. package/core/dist/runtime-v2/recovery-actions-log.js +6 -0
  256. package/core/dist/runtime-v2/recovery-actions-log.js.map +1 -1
  257. package/core/dist/runtime-v2/runtime-protocol.js +1 -1
  258. package/core/dist/runtime-v2/runtime-protocol.js.map +1 -1
  259. package/core/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.js +17 -1
  260. package/core/dist/runtime-v2/store/task/__tests__/sqlite-task-store.failed-tasks.test.js.map +1 -1
  261. package/core/dist/runtime-v2/store/task/sqlite-task-store.d.ts.map +1 -1
  262. package/core/dist/runtime-v2/store/task/sqlite-task-store.js +10 -0
  263. package/core/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
  264. package/core/dist/runtime-v2/store/task/task-types.d.ts +2 -0
  265. package/core/dist/runtime-v2/store/task/task-types.d.ts.map +1 -1
  266. package/core/dist/runtime-v2/task-status.d.ts +9 -5
  267. package/core/dist/runtime-v2/task-status.d.ts.map +1 -1
  268. package/core/dist/runtime-v2/task-status.js +15 -7
  269. package/core/dist/runtime-v2/task-status.js.map +1 -1
  270. package/core/dist/runtime-v2/types/event-types.d.ts +4 -0
  271. package/core/dist/runtime-v2/types/event-types.d.ts.map +1 -1
  272. package/core/dist/runtime-v2/types/event-types.js.map +1 -1
  273. package/core/dist/runtime-v2/types/index.d.ts +1 -1
  274. package/core/dist/runtime-v2/types/index.d.ts.map +1 -1
  275. package/core/dist/runtime-v2/types/index.js +1 -1
  276. package/core/dist/runtime-v2/types/index.js.map +1 -1
  277. package/core/dist/runtime-v2/types/principle-enums.d.ts +3 -2
  278. package/core/dist/runtime-v2/types/principle-enums.d.ts.map +1 -1
  279. package/core/dist/runtime-v2/types/principle-enums.js +11 -5
  280. package/core/dist/runtime-v2/types/principle-enums.js.map +1 -1
  281. package/core/dist/runtime-v2/types/principle-schema.d.ts +1 -1
  282. package/core/dist/runtime-v2/types/principle-tree-store.d.ts +1 -1
  283. package/core/dist/runtime-v2/utils/cli-process-runner.d.ts.map +1 -1
  284. package/core/dist/runtime-v2/utils/cli-process-runner.js +3 -2
  285. package/core/dist/runtime-v2/utils/cli-process-runner.js.map +1 -1
  286. package/core/package.json +2 -3
  287. package/dist/i18n.d.ts.map +1 -1
  288. package/dist/i18n.js +4 -2
  289. package/dist/i18n.js.map +1 -1
  290. package/dist/index.d.ts +2 -0
  291. package/dist/index.d.ts.map +1 -1
  292. package/dist/index.js +47 -11
  293. package/dist/index.js.map +1 -1
  294. package/dist/installer.d.ts +31 -5
  295. package/dist/installer.d.ts.map +1 -1
  296. package/dist/installer.js +472 -161
  297. package/dist/installer.js.map +1 -1
  298. package/dist/installers/codex-host-installer.d.ts.map +1 -1
  299. package/dist/installers/codex-host-installer.js +4 -0
  300. package/dist/installers/codex-host-installer.js.map +1 -1
  301. package/dist/mvp-config.d.ts +10 -0
  302. package/dist/mvp-config.d.ts.map +1 -1
  303. package/dist/mvp-config.js +30 -3
  304. package/dist/mvp-config.js.map +1 -1
  305. package/dist/uninstaller.d.ts +9 -1
  306. package/dist/uninstaller.d.ts.map +1 -1
  307. package/dist/uninstaller.js +103 -23
  308. package/dist/uninstaller.js.map +1 -1
  309. package/dist/update/atomic-file.d.ts +35 -0
  310. package/dist/update/atomic-file.d.ts.map +1 -0
  311. package/dist/update/atomic-file.js +120 -0
  312. package/dist/update/atomic-file.js.map +1 -0
  313. package/dist/update/bootstrap-protocol.d.ts +55 -0
  314. package/dist/update/bootstrap-protocol.d.ts.map +1 -0
  315. package/dist/update/bootstrap-protocol.js +132 -0
  316. package/dist/update/bootstrap-protocol.js.map +1 -0
  317. package/dist/update/channel-metadata.d.ts +28 -0
  318. package/dist/update/channel-metadata.d.ts.map +1 -0
  319. package/dist/update/channel-metadata.js +90 -0
  320. package/dist/update/channel-metadata.js.map +1 -0
  321. package/dist/update/channel-promotion.d.ts +39 -0
  322. package/dist/update/channel-promotion.d.ts.map +1 -0
  323. package/dist/update/channel-promotion.js +55 -0
  324. package/dist/update/channel-promotion.js.map +1 -0
  325. package/dist/update/data-compatibility.d.ts +35 -0
  326. package/dist/update/data-compatibility.d.ts.map +1 -0
  327. package/dist/update/data-compatibility.js +45 -0
  328. package/dist/update/data-compatibility.js.map +1 -0
  329. package/dist/update/install-layout.d.ts +59 -0
  330. package/dist/update/install-layout.d.ts.map +1 -0
  331. package/dist/update/install-layout.js +127 -0
  332. package/dist/update/install-layout.js.map +1 -0
  333. package/dist/update/legacy-migration.d.ts +56 -0
  334. package/dist/update/legacy-migration.d.ts.map +1 -0
  335. package/dist/update/legacy-migration.js +254 -0
  336. package/dist/update/legacy-migration.js.map +1 -0
  337. package/dist/update/product-identity.d.ts +50 -0
  338. package/dist/update/product-identity.d.ts.map +1 -0
  339. package/dist/update/product-identity.js +63 -0
  340. package/dist/update/product-identity.js.map +1 -0
  341. package/dist/update/release-asset-manifest.d.ts +31 -0
  342. package/dist/update/release-asset-manifest.d.ts.map +1 -0
  343. package/dist/update/release-asset-manifest.js +161 -0
  344. package/dist/update/release-asset-manifest.js.map +1 -0
  345. package/dist/update/release-identity.d.ts +33 -0
  346. package/dist/update/release-identity.d.ts.map +1 -0
  347. package/dist/update/release-identity.js +108 -0
  348. package/dist/update/release-identity.js.map +1 -0
  349. package/dist/update/release-manager.d.ts +96 -0
  350. package/dist/update/release-manager.d.ts.map +1 -0
  351. package/dist/update/release-manager.js +253 -0
  352. package/dist/update/release-manager.js.map +1 -0
  353. package/dist/update/release-metadata.d.ts +57 -0
  354. package/dist/update/release-metadata.d.ts.map +1 -0
  355. package/dist/update/release-metadata.js +200 -0
  356. package/dist/update/release-metadata.js.map +1 -0
  357. package/dist/update/release-policy.d.ts +51 -0
  358. package/dist/update/release-policy.d.ts.map +1 -0
  359. package/dist/update/release-policy.js +103 -0
  360. package/dist/update/release-policy.js.map +1 -0
  361. package/dist/update/rollback-policy.d.ts +56 -0
  362. package/dist/update/rollback-policy.d.ts.map +1 -0
  363. package/dist/update/rollback-policy.js +61 -0
  364. package/dist/update/rollback-policy.js.map +1 -0
  365. package/dist/update/transaction-journal.d.ts +121 -0
  366. package/dist/update/transaction-journal.d.ts.map +1 -0
  367. package/dist/update/transaction-journal.js +333 -0
  368. package/dist/update/transaction-journal.js.map +1 -0
  369. package/dist/update/trust-metadata.d.ts +55 -0
  370. package/dist/update/trust-metadata.d.ts.map +1 -0
  371. package/dist/update/trust-metadata.js +170 -0
  372. package/dist/update/trust-metadata.js.map +1 -0
  373. package/dist/update/update-history.d.ts +46 -0
  374. package/dist/update/update-history.d.ts.map +1 -0
  375. package/dist/update/update-history.js +123 -0
  376. package/dist/update/update-history.js.map +1 -0
  377. package/dist/utils/env.d.ts +7 -0
  378. package/dist/utils/env.d.ts.map +1 -1
  379. package/dist/utils/env.js +134 -44
  380. package/dist/utils/env.js.map +1 -1
  381. package/host-runtime/dist/governance-observation-store.d.ts +172 -0
  382. package/host-runtime/dist/governance-observation-store.js +649 -0
  383. package/host-runtime/dist/index.d.ts +6 -0
  384. package/host-runtime/dist/index.js +8 -0
  385. package/host-runtime/dist/product-telemetry/consent-store.d.ts +107 -0
  386. package/host-runtime/dist/product-telemetry/consent-store.js +329 -0
  387. package/host-runtime/dist/product-telemetry/eligibility.d.ts +53 -0
  388. package/host-runtime/dist/product-telemetry/eligibility.js +69 -0
  389. package/host-runtime/dist/product-telemetry/exporter.d.ts +46 -0
  390. package/host-runtime/dist/product-telemetry/exporter.js +71 -0
  391. package/host-runtime/dist/product-telemetry/milestone-readers.d.ts +61 -0
  392. package/host-runtime/dist/product-telemetry/milestone-readers.js +234 -0
  393. package/host-runtime/dist/product-telemetry/service.d.ts +142 -0
  394. package/host-runtime/dist/product-telemetry/service.js +532 -0
  395. package/host-runtime/dist/product-telemetry/workspace-scope.d.ts +38 -0
  396. package/host-runtime/dist/product-telemetry/workspace-scope.js +64 -0
  397. package/host-runtime/package.json +6 -1
  398. package/install-layout/dist/index.d.ts +48 -0
  399. package/install-layout/dist/index.js +81 -0
  400. package/install-layout/dist/index.test.d.ts +1 -0
  401. package/install-layout/dist/index.test.js +34 -0
  402. package/install-layout/package.json +33 -0
  403. package/package.json +16 -6
  404. package/pd-cli/dist/commands/__tests__/telemetry-flag-wiring.test.d.ts +9 -0
  405. package/pd-cli/dist/commands/__tests__/telemetry-flag-wiring.test.d.ts.map +1 -0
  406. package/pd-cli/dist/commands/__tests__/telemetry-flag-wiring.test.js +76 -0
  407. package/pd-cli/dist/commands/__tests__/telemetry-flag-wiring.test.js.map +1 -0
  408. package/pd-cli/dist/commands/__tests__/version.test.d.ts +2 -0
  409. package/pd-cli/dist/commands/__tests__/version.test.d.ts.map +1 -0
  410. package/pd-cli/dist/commands/__tests__/version.test.js +134 -0
  411. package/pd-cli/dist/commands/__tests__/version.test.js.map +1 -0
  412. package/pd-cli/dist/commands/console.d.ts.map +1 -1
  413. package/pd-cli/dist/commands/console.js +29 -10
  414. package/pd-cli/dist/commands/console.js.map +1 -1
  415. package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
  416. package/pd-cli/dist/commands/pain-record.js +6 -15
  417. package/pd-cli/dist/commands/pain-record.js.map +1 -1
  418. package/pd-cli/dist/commands/runtime-activation.d.ts +29 -0
  419. package/pd-cli/dist/commands/runtime-activation.d.ts.map +1 -1
  420. package/pd-cli/dist/commands/runtime-activation.js +70 -31
  421. package/pd-cli/dist/commands/runtime-activation.js.map +1 -1
  422. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.d.ts.map +1 -1
  423. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js +2 -2
  424. package/pd-cli/dist/commands/runtime-internalization-enqueue-successors.js.map +1 -1
  425. package/pd-cli/dist/commands/telemetry.d.ts +82 -0
  426. package/pd-cli/dist/commands/telemetry.d.ts.map +1 -0
  427. package/pd-cli/dist/commands/telemetry.js +268 -0
  428. package/pd-cli/dist/commands/telemetry.js.map +1 -0
  429. package/pd-cli/dist/commands/version.d.ts +11 -0
  430. package/pd-cli/dist/commands/version.d.ts.map +1 -0
  431. package/pd-cli/dist/commands/version.js +48 -0
  432. package/pd-cli/dist/commands/version.js.map +1 -0
  433. package/pd-cli/dist/index.js +35 -2
  434. package/pd-cli/dist/index.js.map +1 -1
  435. package/pd-cli/dist/services/version-report.d.ts +44 -0
  436. package/pd-cli/dist/services/version-report.d.ts.map +1 -0
  437. package/pd-cli/dist/services/version-report.js +152 -0
  438. package/pd-cli/dist/services/version-report.js.map +1 -0
  439. package/pd-cli/package.json +2 -1
  440. package/plugin/dist/bundle.js +868 -936
  441. package/plugin/dist/core/init.d.ts +2 -1
  442. package/plugin/dist/core/principle-application-ledger.d.ts +10 -0
  443. package/plugin/dist/core/product-telemetry-trigger.d.ts +14 -0
  444. package/plugin/dist/core/thinking-os-parser.d.ts +5 -2
  445. package/plugin/dist/governance-audit.js +386 -0
  446. package/plugin/dist/hooks/gate-block-helper.d.ts +25 -1
  447. package/plugin/dist/hooks/gate.d.ts +22 -0
  448. package/plugin/dist/openclaw.plugin.json +1 -1
  449. package/plugin/dist/rulehost-evidence.js +832 -0
  450. package/plugin/dist/templates/langs/en/principles/THINKING_OS.md +53 -45
  451. package/plugin/dist/templates/langs/en/skills/pd-mentor/SKILL.md +1 -1
  452. package/plugin/dist/templates/langs/zh/principles/THINKING_OS.md +62 -46
  453. package/plugin/dist/templates/langs/zh/skills/pd-mentor/SKILL.md +1 -1
  454. package/plugin/dist/templates/workspace/.principles/THINKING_OS.md +66 -38
  455. package/plugin/openclaw.plugin.json +1 -1
  456. package/plugin/package.json +1 -1
  457. package/plugin/templates/langs/en/principles/THINKING_OS.md +53 -45
  458. package/plugin/templates/langs/en/skills/pd-mentor/SKILL.md +1 -1
  459. package/plugin/templates/langs/zh/principles/THINKING_OS.md +62 -46
  460. package/plugin/templates/langs/zh/skills/pd-mentor/SKILL.md +1 -1
  461. package/plugin/templates/workspace/.principles/THINKING_OS.md +66 -38
@@ -0,0 +1,161 @@
1
+ import { createHash } from 'node:crypto';
2
+ import * as fs from 'node:fs';
3
+ import { readFile } from 'node:fs/promises';
4
+ import * as path from 'node:path';
5
+ export class ReleaseAssetManifestError extends Error {
6
+ code;
7
+ constructor(code, message) {
8
+ super(message);
9
+ this.name = 'ReleaseAssetManifestError';
10
+ this.code = code;
11
+ }
12
+ }
13
+ function isSafeRelativePath(value) {
14
+ return value.length > 0
15
+ && !path.isAbsolute(value)
16
+ && !value.split(/[\\/]/).some((segment) => segment.length === 0 || segment === '.' || segment === '..');
17
+ }
18
+ function listPayloadFilePaths(assetDir) {
19
+ const rootDir = path.resolve(assetDir);
20
+ if (!fs.existsSync(rootDir) || !fs.statSync(rootDir).isDirectory()) {
21
+ throw new ReleaseAssetManifestError('asset_directory_missing', `Release asset directory does not exist: ${rootDir}`);
22
+ }
23
+ const files = [];
24
+ const visit = (directory) => {
25
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
26
+ const absolutePath = path.resolve(directory, entry.name);
27
+ // Containment guard: enumeration must never escape the asset root.
28
+ if (absolutePath !== rootDir && !absolutePath.startsWith(rootDir + path.sep)) {
29
+ throw new ReleaseAssetManifestError('asset_path_unsafe', `Release asset enumeration escaped the asset root: ${absolutePath}`);
30
+ }
31
+ const relativePath = path.relative(rootDir, absolutePath).split(path.sep).join('/');
32
+ if (relativePath === '_release')
33
+ continue;
34
+ // Depth-0 node_modules is the package's own toolchain install, excluded
35
+ // from the manifest by build-release-asset — the verifier must apply
36
+ // the identical rule or every packaged install would report unexpected
37
+ // files.
38
+ if (relativePath === 'node_modules')
39
+ continue;
40
+ if (entry.isSymbolicLink()) {
41
+ throw new ReleaseAssetManifestError('asset_path_unsafe', `Release asset must not contain symlinks: ${relativePath}`);
42
+ }
43
+ if (entry.isDirectory()) {
44
+ visit(absolutePath);
45
+ continue;
46
+ }
47
+ if (!entry.isFile() || !isSafeRelativePath(relativePath)) {
48
+ throw new ReleaseAssetManifestError('asset_path_unsafe', `Release asset contains an unsafe entry: ${relativePath}`);
49
+ }
50
+ files.push({ absolutePath, relativePath });
51
+ }
52
+ };
53
+ visit(rootDir);
54
+ return files.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
55
+ }
56
+ function readPayloadFiles(assetDir) {
57
+ return listPayloadFilePaths(assetDir).map(({ absolutePath, relativePath }) => {
58
+ const bytes = fs.readFileSync(absolutePath);
59
+ return {
60
+ path: relativePath,
61
+ sha256: createHash('sha256').update(bytes).digest('hex'),
62
+ size: bytes.length,
63
+ };
64
+ });
65
+ }
66
+ function isRecord(value) {
67
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
68
+ }
69
+ export function parseReleaseAssetManifest(value) {
70
+ if (!isRecord(value) || value.schemaVersion !== 1 || !Array.isArray(value.files)) {
71
+ throw new ReleaseAssetManifestError('asset_manifest_invalid', 'Release asset manifest has an unsupported schema.');
72
+ }
73
+ const files = [];
74
+ const seenPaths = new Set();
75
+ for (const file of value.files) {
76
+ if (!isRecord(file)) {
77
+ throw new ReleaseAssetManifestError('asset_manifest_invalid', 'Release asset manifest contains an invalid file record.');
78
+ }
79
+ const { path: filePath, sha256, size } = file;
80
+ if (typeof filePath !== 'string' || !isSafeRelativePath(filePath) || seenPaths.has(filePath)) {
81
+ throw new ReleaseAssetManifestError('asset_manifest_invalid', 'Release asset manifest contains an unsafe or duplicate path.');
82
+ }
83
+ if (typeof size !== 'number' || !Number.isSafeInteger(size) || size < 0 || typeof sha256 !== 'string' || !/^[a-f0-9]{64}$/i.test(sha256)) {
84
+ throw new ReleaseAssetManifestError('asset_manifest_invalid', `Release asset manifest has invalid integrity data for ${filePath}.`);
85
+ }
86
+ seenPaths.add(filePath);
87
+ files.push({ path: filePath, size, sha256: sha256.toLowerCase() });
88
+ }
89
+ return { schemaVersion: 1, files };
90
+ }
91
+ export function parseReleaseAssetIdentity(value) {
92
+ if (!isRecord(value) || value.schemaVersion !== 1) {
93
+ throw new ReleaseAssetManifestError('asset_identity_invalid', 'Release asset identity has an unsupported schema.');
94
+ }
95
+ const platform = Object.hasOwn(value, 'platform') ? value.platform : undefined;
96
+ const arch = Object.hasOwn(value, 'arch') ? value.arch : undefined;
97
+ const nodeAbi = Object.hasOwn(value, 'nodeAbi') ? value.nodeAbi : undefined;
98
+ if (typeof platform !== 'string' || platform.trim().length === 0
99
+ || typeof arch !== 'string' || arch.trim().length === 0
100
+ || typeof nodeAbi !== 'string' || !/^\d+$/.test(nodeAbi)) {
101
+ throw new ReleaseAssetManifestError('asset_identity_invalid', 'Release asset identity must declare platform, architecture, and numeric Node ABI.');
102
+ }
103
+ return { schemaVersion: 1, platform, arch, nodeAbi };
104
+ }
105
+ export function verifyReleaseAssetTarget(identity, target) {
106
+ const validatedIdentity = parseReleaseAssetIdentity(identity);
107
+ if (validatedIdentity.platform !== target.platform
108
+ || validatedIdentity.arch !== target.arch
109
+ || validatedIdentity.nodeAbi !== target.nodeAbi) {
110
+ throw new ReleaseAssetManifestError('asset_target_mismatch', `Release asset target ${validatedIdentity.platform}/${validatedIdentity.arch}/abi${validatedIdentity.nodeAbi} does not match this runtime ${target.platform}/${target.arch}/abi${target.nodeAbi}.`);
111
+ }
112
+ }
113
+ export function createReleaseAssetManifest(assetDir) {
114
+ return { schemaVersion: 1, files: readPayloadFiles(assetDir) };
115
+ }
116
+ export function verifyReleaseAssetManifest(assetDir, manifest) {
117
+ const validatedManifest = parseReleaseAssetManifest(manifest);
118
+ const actualFiles = readPayloadFiles(assetDir);
119
+ const expectedByPath = new Map(validatedManifest.files.map((file) => [file.path, file]));
120
+ if (actualFiles.length !== expectedByPath.size) {
121
+ throw new ReleaseAssetManifestError('asset_file_unexpected', 'Release asset file set does not match its manifest.');
122
+ }
123
+ for (const actualFile of actualFiles) {
124
+ const expectedFile = expectedByPath.get(actualFile.path);
125
+ if (!expectedFile) {
126
+ throw new ReleaseAssetManifestError('asset_file_unexpected', `Release asset contains an unexpected file: ${actualFile.path}`);
127
+ }
128
+ if (actualFile.size !== expectedFile.size || actualFile.sha256 !== expectedFile.sha256.toLowerCase()) {
129
+ throw new ReleaseAssetManifestError('asset_digest_mismatch', `Release asset integrity check failed: ${actualFile.path}`);
130
+ }
131
+ }
132
+ }
133
+ export async function verifyReleaseAssetManifestAsync(assetDir, manifest) {
134
+ const validatedManifest = parseReleaseAssetManifest(manifest);
135
+ const payloadPaths = listPayloadFilePaths(assetDir);
136
+ const expectedByPath = new Map(validatedManifest.files.map((file) => [file.path, file]));
137
+ if (payloadPaths.length !== expectedByPath.size) {
138
+ throw new ReleaseAssetManifestError('asset_file_unexpected', 'Release asset file set does not match its manifest.');
139
+ }
140
+ const concurrency = Math.min(64, Math.max(1, payloadPaths.length));
141
+ let nextIndex = 0;
142
+ await Promise.all(Array.from({ length: concurrency }, async () => {
143
+ while (nextIndex < payloadPaths.length) {
144
+ const index = nextIndex;
145
+ nextIndex += 1;
146
+ const payload = payloadPaths[index];
147
+ if (!payload)
148
+ throw new ReleaseAssetManifestError('asset_manifest_invalid', 'Release asset verification lost its file cursor.');
149
+ const expected = expectedByPath.get(payload.relativePath);
150
+ if (!expected) {
151
+ throw new ReleaseAssetManifestError('asset_file_unexpected', `Release asset contains an unexpected file: ${payload.relativePath}`);
152
+ }
153
+ const bytes = await readFile(payload.absolutePath);
154
+ const digest = createHash('sha256').update(bytes).digest('hex');
155
+ if (bytes.length !== expected.size || digest !== expected.sha256) {
156
+ throw new ReleaseAssetManifestError('asset_digest_mismatch', `Release asset integrity check failed: ${payload.relativePath}`);
157
+ }
158
+ }
159
+ }));
160
+ }
161
+ //# sourceMappingURL=release-asset-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-asset-manifest.js","sourceRoot":"","sources":["../../src/update/release-asset-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AA6BlC,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IACzC,IAAI,CAAgC;IAE7C,YAAY,IAAmC,EAAE,OAAe;QAC9D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,KAAa;IACvC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;WAClB,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;WACvB,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC,CAAC;AAC5G,CAAC;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AAK,IAAI,EAAE;QAC/D,OAAO,SAAS,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,SAAS,CAAC;YACxB,SAAS,IAAI,CAAC,CAAC;YACf,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAI,yBAAyB,CAAC,wBAAwB,EAAE,kDAAkD,CAAC,CAAC;YAChI,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAC1D,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,MAAM,IAAI,yBAAyB,CAAC,uBAAuB,EAAE,8CAA8C,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;YACrI,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YACnD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAChE,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,IAAI,IAAI,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACjE,MAAM,IAAI,yBAAyB,CAAC,uBAAuB,EAAE,yCAAyC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;YAChI,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Immutable release identity derivation (SPEC §4.1, §4.3).
3
+ *
4
+ * releaseId = sha256 over the canonical identity inputs: product version,
5
+ * source commit, the sorted platform asset identities, the minimum bootstrap
6
+ * version, and the digest of the metadata content that excludes releaseId
7
+ * itself (avoiding circular hashing, per SPEC §4.2's detached-digest rule).
8
+ * Informational build time is never an identity input.
9
+ */
10
+ export interface ReleaseAssetIdentity {
11
+ readonly platform: string;
12
+ readonly arch: string;
13
+ readonly nodeAbi: string;
14
+ readonly archiveSha256: string;
15
+ readonly archiveSizeBytes: number;
16
+ }
17
+ export interface ReleaseIdentityInputs {
18
+ readonly productVersion: string;
19
+ readonly sourceCommit: string;
20
+ readonly minBootstrapVersion: string;
21
+ readonly assets: readonly ReleaseAssetIdentity[];
22
+ }
23
+ /** Deterministic JSON: sorted keys, no insignificant whitespace. */
24
+ export declare function canonicalJson(value: unknown): string;
25
+ /** Content digest of the identity-relevant metadata, with `releaseId` removed. */
26
+ export declare function computeReleaseContentDigest(contentWithoutReleaseId: unknown): string;
27
+ /**
28
+ * Derives the immutable release ID. Same source + same declared inputs MUST
29
+ * produce the same ID; any input change produces a different ID. Deterministic
30
+ * across platforms (canonical JSON, sorted assets, LF strings).
31
+ */
32
+ export declare function deriveReleaseId(inputs: ReleaseIdentityInputs): string;
33
+ //# sourceMappingURL=release-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-identity.d.ts","sourceRoot":"","sources":["../../src/update/release-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAClD;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAWpD;AAgCD,kFAAkF;AAClF,wBAAgB,2BAA2B,CAAC,uBAAuB,EAAE,OAAO,GAAG,MAAM,CAEpF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CA6CrE"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Immutable release identity derivation (SPEC §4.1, §4.3).
3
+ *
4
+ * releaseId = sha256 over the canonical identity inputs: product version,
5
+ * source commit, the sorted platform asset identities, the minimum bootstrap
6
+ * version, and the digest of the metadata content that excludes releaseId
7
+ * itself (avoiding circular hashing, per SPEC §4.2's detached-digest rule).
8
+ * Informational build time is never an identity input.
9
+ */
10
+ import { createHash } from 'node:crypto';
11
+ import { assertGitCommit, assertSha256Hex, parseProductVersion, ProductIdentityError, } from './product-identity.js';
12
+ /** Deterministic JSON: sorted keys, no insignificant whitespace. */
13
+ export function canonicalJson(value) {
14
+ if (Array.isArray(value)) {
15
+ return `[${value.map(canonicalJson).join(',')}]`;
16
+ }
17
+ if (typeof value === 'object' && value !== null) {
18
+ const entries = Object.entries(value)
19
+ .filter(([, v]) => v !== undefined)
20
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
21
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${canonicalJson(v)}`).join(',')}}`;
22
+ }
23
+ return JSON.stringify(value);
24
+ }
25
+ function validateAssetIdentity(asset, index) {
26
+ if (typeof asset !== 'object' || asset === null || Array.isArray(asset)) {
27
+ throw new ProductIdentityError('assets', `assets[${index}] must be an object`);
28
+ }
29
+ const record = asset;
30
+ const { platform } = record;
31
+ const { arch } = record;
32
+ const { nodeAbi } = record;
33
+ const { archiveSha256 } = record;
34
+ const { archiveSizeBytes } = record;
35
+ for (const [field, value] of [['platform', platform], ['arch', arch], ['nodeAbi', nodeAbi]]) {
36
+ if (typeof value !== 'string' || value.length === 0 || !/^[a-z0-9-]+$/.test(value)) {
37
+ throw new ProductIdentityError('assets', `assets[${index}].${field} must be a non-empty lowercase identifier, got: ${JSON.stringify(value)}`);
38
+ }
39
+ }
40
+ if (typeof nodeAbi !== 'string' || !/^\d+$/.test(nodeAbi)) {
41
+ throw new ProductIdentityError('assets', `assets[${index}].nodeAbi must be a numeric Node ABI string (e.g. "147"), got: ${JSON.stringify(nodeAbi)}`);
42
+ }
43
+ if (typeof archiveSizeBytes !== 'number' || !Number.isSafeInteger(archiveSizeBytes) || archiveSizeBytes <= 0) {
44
+ throw new ProductIdentityError('assets', `assets[${index}].archiveSizeBytes must be a positive safe integer, got: ${JSON.stringify(archiveSizeBytes)}`);
45
+ }
46
+ return {
47
+ platform,
48
+ arch,
49
+ nodeAbi,
50
+ archiveSha256: assertSha256Hex(archiveSha256, `assets[${index}].archiveSha256`),
51
+ archiveSizeBytes,
52
+ };
53
+ }
54
+ /** Content digest of the identity-relevant metadata, with `releaseId` removed. */
55
+ export function computeReleaseContentDigest(contentWithoutReleaseId) {
56
+ return createHash('sha256').update(canonicalJson(contentWithoutReleaseId), 'utf8').digest('hex');
57
+ }
58
+ /**
59
+ * Derives the immutable release ID. Same source + same declared inputs MUST
60
+ * produce the same ID; any input change produces a different ID. Deterministic
61
+ * across platforms (canonical JSON, sorted assets, LF strings).
62
+ */
63
+ export function deriveReleaseId(inputs) {
64
+ const productVersion = parseProductVersion(inputs.productVersion);
65
+ parseProductVersion(inputs.minBootstrapVersion, 'minBootstrapVersion');
66
+ assertGitCommit(inputs.sourceCommit, 'sourceCommit');
67
+ if (!Array.isArray(inputs.assets) || inputs.assets.length === 0) {
68
+ throw new ProductIdentityError('assets', 'a release must declare at least one platform asset');
69
+ }
70
+ const assets = inputs.assets.map(validateAssetIdentity);
71
+ // Duplicate detection runs BEFORE sorting as an explicit pass — sort
72
+ // comparators are not guaranteed to compare every element pair, so a
73
+ // duplicate key could slip into the identity input unnoticed.
74
+ const seenKeys = new Set();
75
+ for (const asset of assets) {
76
+ const key = `${asset.platform}/${asset.arch}/abi${asset.nodeAbi}`;
77
+ if (seenKeys.has(key)) {
78
+ throw new ProductIdentityError('assets', `duplicate platform asset declared: ${key}`);
79
+ }
80
+ seenKeys.add(key);
81
+ }
82
+ const sortedAssets = [...assets].sort((a, b) => {
83
+ const keyA = `${a.platform}/${a.arch}/abi${a.nodeAbi}`;
84
+ const keyB = `${b.platform}/${b.arch}/abi${b.nodeAbi}`;
85
+ return keyA < keyB ? -1 : keyA > keyB ? 1 : 0;
86
+ });
87
+ const identityContent = {
88
+ kind: 'pd-release-identity-v1',
89
+ productVersion: productVersion.productVersion,
90
+ sourceCommit: inputs.sourceCommit,
91
+ minBootstrapVersion: inputs.minBootstrapVersion,
92
+ assets: sortedAssets.map((asset) => ({
93
+ platform: asset.platform,
94
+ arch: asset.arch,
95
+ nodeAbi: asset.nodeAbi,
96
+ archiveSha256: asset.archiveSha256,
97
+ archiveSizeBytes: asset.archiveSizeBytes,
98
+ })),
99
+ };
100
+ const contentDigest = computeReleaseContentDigest(identityContent);
101
+ // The SPEC's "release metadata digest" input is the digest of the identity
102
+ // content above — hashed again with the kind tag so releaseId ≠ any
103
+ // intermediate digest.
104
+ return createHash('sha256')
105
+ .update(`pd-release-id-v1:${contentDigest}`, 'utf8')
106
+ .digest('hex');
107
+ }
108
+ //# sourceMappingURL=release-identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-identity.js","sourceRoot":"","sources":["../../src/update/release-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAiB/B,oEAAoE;AACpE,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAA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).
3
+ *
4
+ * External surface is intentionally small: inspect / check / apply /
5
+ * rollback. The module hides metadata validation, download, extraction,
6
+ * staging, probes, journaling, host control, rollback, and cleanup. In this
7
+ * phase (shadow mode) apply/rollback refuse read-only: activation lands with
8
+ * the transaction state machine, never by loosening this gate.
9
+ *
10
+ * Every refusal carries a stable reason and an Owner-visible next action
11
+ * (rc-9) and is computed BEFORE any installation state is mutated.
12
+ */
13
+ import { resolveTrustedReleaseTarget, type TrustedReleaseTarget } from './trust-metadata.js';
14
+ import { buildReleaseMetadata } from './release-metadata.js';
15
+ import { type ReleasePolicyDecision } from './release-policy.js';
16
+ import type { ReleaseChannelName } from './product-identity.js';
17
+ export type ReleaseManagerReason = 'shadow_mode_read_only' | 'bootstrap_not_installed' | 'metadata_refresh_failed' | 'release_metadata_unavailable' | 'release_metadata_invalid' | 'active_record_corrupt';
18
+ export declare class ReleaseManagerError extends Error {
19
+ readonly reason: ReleaseManagerReason;
20
+ readonly nextAction: string;
21
+ constructor(reason: ReleaseManagerReason, message: string, nextAction: string);
22
+ }
23
+ export type InstallationLayout = 'dual-slot' | 'legacy-overlay' | 'none';
24
+ export interface InstallStatus {
25
+ readonly layout: InstallationLayout;
26
+ readonly productVersion: string | null;
27
+ readonly releaseId: string | null;
28
+ readonly generation: number | null;
29
+ readonly bootstrapVersion: string | null;
30
+ readonly channel: ReleaseChannelName;
31
+ }
32
+ /** What the legacy updater decided for the same question (shadow comparison). */
33
+ export interface LegacyUpdaterDecision {
34
+ readonly source: 'legacy-updater';
35
+ readonly latestVersion: string | null;
36
+ readonly updateAvailable: boolean | null;
37
+ }
38
+ export interface UpdateCheck {
39
+ readonly channel: ReleaseChannelName;
40
+ readonly candidate: {
41
+ readonly productVersion: string;
42
+ readonly releaseId: string;
43
+ readonly publicationSequence: number;
44
+ readonly assets: readonly {
45
+ platform: string;
46
+ arch: string;
47
+ nodeAbi: string;
48
+ }[];
49
+ } | null;
50
+ readonly decision: ReleasePolicyDecision;
51
+ readonly trustedTarget: TrustedReleaseTarget | null;
52
+ readonly shadowComparison: {
53
+ readonly legacy: LegacyUpdaterDecision | null;
54
+ readonly agrees: boolean | null;
55
+ readonly note: string | null;
56
+ };
57
+ }
58
+ export interface ReleaseManagerOptions {
59
+ readonly pdHome: string;
60
+ readonly metadataBaseUrl: string;
61
+ readonly fetcher?: Parameters<typeof resolveTrustedReleaseTarget>[0]['fetcher'];
62
+ readonly now?: () => Date;
63
+ /** Injected in production from the legacy updater; tests inject fakes. */
64
+ readonly legacyCheck?: (currentVersion: string) => Promise<LegacyUpdaterDecision | null>;
65
+ /**
66
+ * Explicit OpenClaw home directory for legacy-overlay detection. When
67
+ * omitted, falls back to `~/.openclaw` relative to the OS home — correct
68
+ * for standard installs but WRONG for custom pdHome roots (test dirs,
69
+ * enterprise installs, containers). Callers that pass a custom pdHome
70
+ * MUST also pass the matching openclawHome.
71
+ */
72
+ readonly openclawHome?: string;
73
+ }
74
+ /**
75
+ * The signed channel document is fetched from the trusted TUF target
76
+ * `channels/<channel>.json`; its payload is the ChannelMetadata. The release
77
+ * metadata document comes from `releases/<release-id>/metadata.json` —
78
+ * already verified as a trusted target with an exact digest.
79
+ */
80
+ export declare class ReleaseManager {
81
+ private readonly paths;
82
+ private readonly options;
83
+ constructor(options: ReleaseManagerOptions);
84
+ inspect(): InstallStatus;
85
+ check(channel: ReleaseChannelName): Promise<UpdateCheck>;
86
+ apply(): Promise<never>;
87
+ rollback(): Promise<never>;
88
+ private legacyOverlayMarker;
89
+ private readChannelMetadataPayload;
90
+ private readActiveReleaseMetadata;
91
+ private readReleaseMetadataDocument;
92
+ private compareWithLegacyUpdater;
93
+ }
94
+ /** Producer helper re-exported for the publication pipeline. */
95
+ export { buildReleaseMetadata };
96
+ //# sourceMappingURL=release-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-manager.d.ts","sourceRoot":"","sources":["../../src/update/release-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAA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