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
package/README.md CHANGED
@@ -126,7 +126,19 @@ PD supports updating through the Web UI:
126
126
 
127
127
  ## Requirements
128
128
 
129
- - Node.js >= 18.0.0
129
+ - Node.js >= 22.0.0
130
+
131
+ Self-contained native release assets are built locally (never cross-labelled) for:
132
+
133
+ | Platform | Architectures | Node.js major / ABI |
134
+ | --- | --- | --- |
135
+ | Windows | x64 | 22 / 127, 24 / 137, 26 / 147 |
136
+ | Linux | x64, arm64 | 22 / 127, 24 / 137, 26 / 147 |
137
+ | macOS | x64, arm64 | 22 / 127, 24 / 137, 26 / 147 |
138
+
139
+ Release builds require a fixed `SOURCE_DATE_EPOCH`. The output directory is published through one atomic rename and contains `payload/`, immutable `asset.tar`, and detached `asset.tar.sha256`. The installed machine does not run npm, lifecycle scripts, or native compilation.
140
+
141
+ PR feedback uses the single-target `.github/workflows/release-reproducibility.yml` quick check. Before npm publication, `publish-npm.yml` must call `.github/workflows/release-reproducibility-full.yml`: for every supported OS/CPU/Node target it builds the real production asset twice from a clean checkout, byte-compares the archives and detached digests, then installs from the archive without npm. Evidence limits: Node versions are pinned exactly, but GitHub runner images float beneath the label — the same-job double build controls toolchain drift within a job; cross-runner absolute byte-equality is not claimed. Committed dependency locks under `release-locks/` are regenerated by maintainers via `npm run generate:release-locks` and verified installable by `npm run check:release-locks`.
130
142
 
131
143
  ## License
132
144
 
@@ -111,9 +111,7 @@ export interface DefaultRuntimeUpdateResultErr {
111
111
  }
112
112
  export type DefaultRuntimeUpdateResult = DefaultRuntimeUpdateResultOk | DefaultRuntimeUpdateResultErr;
113
113
  export declare function updateDefaultRuntime(workspaceDir: string, payload: unknown): DefaultRuntimeUpdateResult;
114
- /** Valid values for principles.outputLanguage in config.yaml */
115
- export declare const VALID_OUTPUT_LANGUAGES: readonly ['zh-CN', 'en'];
116
- export type OutputLanguage = typeof VALID_OUTPUT_LANGUAGES[number];
114
+ import type { OutputLanguage } from '@principles/core/runtime-v2';
117
115
  export interface OutputLanguageResultOk {
118
116
  ok: true;
119
117
  outputLanguage: OutputLanguage;
@@ -464,13 +464,13 @@ export function updateDefaultRuntime(workspaceDir, payload) {
464
464
  };
465
465
  }
466
466
  // ── Principles Output Language (PRI-332 P1-1) ─────────────────────────────
467
- /** Valid values for principles.outputLanguage in config.yaml */
468
- export const VALID_OUTPUT_LANGUAGES = ['zh-CN', 'en'];
467
+ // PRI-611: the output-language contract derives from the canonical core
468
+ // authority (runtime-v2/language-directive.ts). Do NOT re-declare the value
469
+ // list or default here — a drift guard test fails on local re-declaration.
470
+ import { VALID_OUTPUT_LANGUAGES, DEFAULT_OUTPUT_LANGUAGE } from '@principles/core/runtime-v2';
469
471
  function isValidOutputLanguage(value) {
470
472
  return typeof value === 'string' && VALID_OUTPUT_LANGUAGES.includes(value);
471
473
  }
472
- /** Default output language when not configured. */
473
- const DEFAULT_OUTPUT_LANGUAGE = 'zh-CN';
474
474
  /**
475
475
  * Read principles.outputLanguage from config.yaml.
476
476
  * Returns default ('zh-CN') when not set.
@@ -1,17 +1,11 @@
1
+ import type { FeedbackChannelStatus } from '../../shared/feedback-contract.js';
1
2
  import type * as childProcessNS from 'node:child_process';
2
3
  import type * as fsNS from 'node:fs';
3
4
  import type * as osNS from 'node:os';
4
5
  import type * as pathNS from 'node:path';
5
6
  import type { FeedbackChannelConfig } from '../config/pd-config-store.js';
6
7
  type ExecFileFn = typeof childProcessNS.execFile;
7
- export interface ChannelStatus {
8
- id: 'ingest' | 'github' | 'email' | 'file';
9
- available: boolean;
10
- /** Human-readable reason when unavailable. */
11
- reason?: string;
12
- /** Concrete next action the user can take (rc-9). */
13
- nextAction?: string;
14
- }
8
+ export type ChannelStatus = FeedbackChannelStatus;
15
9
  export interface ChannelsResult {
16
10
  ok: true;
17
11
  channels: ChannelStatus[];
@@ -1,14 +1,3 @@
1
- // channels.ts
2
- // Channel-ladder availability probing for feedback submission (PRI-543).
3
- //
4
- // Spec §4 / §8.1: the UI orders channels by ladder position and disables
5
- // unavailable ones, showing reason + nextAction (rc-9). Probing is fail-open:
6
- // inability to probe is reported as available so a transient probe failure
7
- // never hides a channel; the submit path then fails loudly and surfaces a
8
- // structured reason + downgrade hint.
9
- //
10
- // Probing results are cached per (channel,url-or-repo) for 60s to avoid
11
- // hammering the relay /shelling out to gh on every list/via fetch.
12
1
  import { probeIngestHealth } from './ingest-adapter.js';
13
2
  import { detectGithubCli } from './github-adapter.js';
14
3
  const PROBE_CACHE_TTL_MS = 60_000;
@@ -3,6 +3,8 @@ import * as fs from 'fs';
3
3
  import * as path from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { loadPdConfig, computeFlagsFromLoadResult, getFeedbackMaintainerEmail, getFeedbackChannelConfig, } from './config/pd-config-store.js';
6
+ import { resolveOwnerIdentity, defaultOwnerIdentityHomeDir } from '@principles/core/runtime-v2';
7
+ import { createProductTelemetryService, scheduleProductTelemetryExport } from '@principles/host-runtime';
6
8
  import { AuthConfig } from './config/AuthConfig.js';
7
9
  import { WorkspaceConfigStore } from './config/WorkspaceConfigStore.js';
8
10
  import { WorkspaceService } from './models/WorkspaceService.js';
@@ -15,7 +17,8 @@ import { handleLifecycleRoute, disposeLifecycleModels } from './routes/lifecycle
15
17
  import { handleActivationsRoute, disposeActivationsModels } from './routes/activations.js';
16
18
  import { handleReceiptsRoute, disposeReceiptsModels } from './routes/receipts.js';
17
19
  import { handleApprovalsGroupedRoute, disposeApprovalsGroupedModels } from './routes/approvals-grouped.js';
18
- import { handleGovernanceRoute, disposeGovernanceModels } from './routes/governance.js';
20
+ import { handleGovernanceRoute, handleGovernanceExperienceRoute, resolveOwnerConfigSnapshot, disposeGovernanceModels } from './routes/governance.js';
21
+ import { handleOwnerIdentityRoute } from './routes/owner-identity.js';
19
22
  import { handleEvidenceChainRoute, disposeEvidenceChainModels } from './routes/evidence-chain.js';
20
23
  import { handleIntentRoute, disposeIntentModels } from './routes/intent.js';
21
24
  import { handleIntentDecisionsRoute, disposeIntentDecisionModels } from './routes/intent-decisions.js';
@@ -214,11 +217,15 @@ async function initServices(workspaceDir, authConfig) {
214
217
  // Governance Recovery Actions v1: fail-closed — recovery stays disabled unless
215
218
  // explicitly enabled (default off keeps the Console read-only).
216
219
  const failedTaskRecoveryEnabled = pdFlags.flags.failed_task_recovery_console?.enabled ?? false;
220
+ // Governance Experience Snapshot v1.5.1 (PRI-584~587): default off; flag-off
221
+ // keeps the legacy Focus experience and 403s the endpoint before any DB access.
222
+ const governanceExperienceEnabled = pdFlags.flags.governance_experience_v1?.enabled ?? false;
217
223
  const feedbackFlags = {
218
224
  feedback_channel: { enabled: feedbackChannelEnabled },
219
225
  failed_tasks_observability: { enabled: failedTasksObservabilityEnabled },
220
226
  principle_governance_projection_v2: { enabled: governanceProjectionEnabled },
221
227
  failed_task_recovery_console: { enabled: failedTaskRecoveryEnabled },
228
+ governance_experience_v1: { enabled: governanceExperienceEnabled },
222
229
  };
223
230
  if (!configResult.ok) {
224
231
  console.warn('[pd-console] PD config loading failed (using defaults for feedback channel):', configResult.errors.map(e => e.reason).join('; '));
@@ -380,10 +387,10 @@ function handleRequest(services) {
380
387
  // CR8: GET /api/v1/activations
381
388
  if (urlPath === '/api/v1/activations' || urlPath.startsWith('/api/v1/activations/')) {
382
389
  const subPath = urlPath.slice('/api/v1/activations'.length);
383
- const ownerId = process.env.PD_OWNER_ID?.trim();
384
- const credentialId = process.env.PD_OWNER_CREDENTIAL_ID?.trim();
385
- const ownerActor = services.authConfig.isEnabled() && ownerId && credentialId
386
- ? { principal: { kind: 'configured_owner', ownerId }, authentication: { method: 'console_token', credentialId } }
390
+ // ADR-0022 (PRI-578): single resolver — env > ~/.pd/owner.json > none
391
+ const identity = resolveOwnerIdentity(process.env, defaultOwnerIdentityHomeDir());
392
+ const ownerActor = services.authConfig.isEnabled() && identity.ownerId && identity.credentialId
393
+ ? { principal: { kind: 'configured_owner', ownerId: identity.ownerId }, authentication: { method: 'console_token', credentialId: identity.credentialId } }
387
394
  : null;
388
395
  asyncHandler(() => handleActivationsRoute(req, res, services.workspaceDir, subPath, {
389
396
  ownerActor,
@@ -391,6 +398,21 @@ function handleRequest(services) {
391
398
  }))(req, res);
392
399
  return;
393
400
  }
401
+ // ADR-0022 (PRI-578): /api/v1/owner-identity — GET status, POST register, DELETE unregister
402
+ if (urlPath === '/api/v1/owner-identity' || urlPath.startsWith('/api/v1/owner-identity/')) {
403
+ const subPath = urlPath.slice('/api/v1/owner-identity'.length);
404
+ asyncHandler(() => handleOwnerIdentityRoute(req, res, defaultOwnerIdentityHomeDir(), subPath, services.authConfig))(req, res);
405
+ return;
406
+ }
407
+ // PRI-585: GET /api/v1/governance/experience (flag-gated read-only snapshot)
408
+ if (urlPath === '/api/v1/governance/experience') {
409
+ asyncHandler(() => handleGovernanceExperienceRoute(req, res, {
410
+ workspaceDir: services.workspaceDir,
411
+ featureFlags: services.feedbackFlags,
412
+ ownerConfig: resolveOwnerConfigSnapshot(services.authConfig, resolveOwnerIdentity(process.env, defaultOwnerIdentityHomeDir())),
413
+ }))(req, res);
414
+ return;
415
+ }
394
416
  // CR8: GET /api/v1/governance/queue
395
417
  if (urlPath === '/api/v1/governance/queue') {
396
418
  asyncHandler(() => handleGovernanceRoute(req, res, services.workspaceDir))(req, res);
@@ -461,6 +483,13 @@ export async function main() {
461
483
  console.warn('[pd-console] Legacy backup migration failed:', err instanceof Error ? err.message : err);
462
484
  }
463
485
  const server = http.createServer(handleRequest(services));
486
+ // Anonymous Product Telemetry v1 (PRI-595~603): one fire-and-forget export
487
+ // attempt per console startup. The console process is the long-lived PD
488
+ // surface for Codex-host installations (the pd-hook subprocess is too
489
+ // short-lived to host async export). All gating (flag + consent +
490
+ // environment eligibility) happens inside the service; failures are
491
+ // contained and never affect console behavior.
492
+ scheduleProductTelemetryExport(createProductTelemetryService({ logger: { info: (m) => console.log(m), warn: (m) => console.warn(m) } }), workspace);
464
493
  const shutdown = async (signal) => {
465
494
  console.log(`[pd-console] Received ${signal}, shutting down...`);
466
495
  await new Promise((resolve) => { server.close(() => resolve()); });
@@ -106,12 +106,39 @@ export interface OwnerMutationInput {
106
106
  reasonCode: string;
107
107
  note?: string;
108
108
  }
109
+ /**
110
+ * PRI-577: RuleCode event telemetry candidate directories, in priority order.
111
+ *
112
+ * Runtime V2 convention is `.pd/logs`, but the v1 EventLog writer
113
+ * (openclaw-plugin `src/core/event-log.ts`) still emits `events_*.jsonl` under
114
+ * `.state/logs`. No production code ever created `.pd/logs`, so scanning only
115
+ * that path made every activation's shadow metrics report "unavailable" in the
116
+ * console while real evaluations accumulated unread in `.state/logs`. Readers
117
+ * scan both candidates until the writer migrates (ERR-031: both readers derive
118
+ * from this same list).
119
+ */
120
+ export declare const RULECODE_EVENT_LOG_CANDIDATE_DIRS: readonly string[];
121
+ export interface CollectedRuleCodeEventEntries {
122
+ entries: unknown[];
123
+ /** Number of candidate directories that actually exist on disk. */
124
+ sourceDirsFound: number;
125
+ }
126
+ /**
127
+ * Collect rulehost telemetry entries from all candidate log directories.
128
+ * Malformed lines are excluded individually. A directory counts as a source
129
+ * only after it can be enumerated, so an unreadable path cannot be mistaken
130
+ * for a healthy channel with zero events (ERR-002).
131
+ *
132
+ * Exact lines copied between candidate directories are deduplicated by
133
+ * priority. Different events in same-named daily files are retained.
134
+ */
135
+ export declare function collectRuleCodeEventEntries(workspaceDir: string): CollectedRuleCodeEventEntries;
109
136
  export declare class ActivationsConsoleModel {
110
137
  private readonly workspaceDir;
111
138
  private readonly governanceAuditWriter;
112
139
  constructor(workspaceDir: string, governanceAuditWriter?: GovernanceAuditWriter);
113
140
  getActivations(): Promise<ActivationsResponse>;
114
- getOwnerReview(activationId: string, ownerIdentityConfigured?: boolean): Promise<RuleCodeOwnerReview>;
141
+ getOwnerReview(activationId: string, ownerIdentityConfigured?: boolean, ownerActor?: OwnerPromotionActor): Promise<RuleCodeOwnerReview>;
115
142
  continueObserving(activationId: string, input: OwnerMutationInput): Promise<{
116
143
  decisionId: string;
117
144
  }>;
@@ -1,4 +1,4 @@
1
- import { SqliteConnection, SqliteActivationStateStore, SqlitePIArtifactStore, extractPrincipleId, extractEvidenceRefs, PromotionReadinessReader, RuleHostWriter, createProductionGateDeps, SqliteActivationSafetyStore, isFeatureEnabled, RuleCodeOwnerDecisionService, collectOpenClawPromotionChecks, summarizeRuleCodeShadowEvents, } from '@principles/core/runtime-v2';
1
+ import { SqliteConnection, SqliteActivationStateStore, SqlitePIArtifactStore, extractPrincipleId, extractEvidenceRefs, PromotionReadinessReader, RuleHostWriter, createProductionGateDeps, SqliteActivationSafetyStore, isFeatureEnabled, RuleCodeOwnerDecisionService, collectOpenClawPromotionChecks, summarizeRuleCodeShadowEvents, buildPromotionEvidenceSnapshot, } from '@principles/core/runtime-v2';
2
2
  import { OPENCLAW_HOST_LIVENESS_CONTRACT } from '@principles/host-runtime';
3
3
  import { loadPdConfig, computeFlagsFromLoadResult } from '../config/pd-config-store.js';
4
4
  import * as fs from 'node:fs';
@@ -54,27 +54,69 @@ function unavailableShadowSummary() {
54
54
  firstObservedAt: null, lastObservedAt: null,
55
55
  };
56
56
  }
57
- function readRuleCodeTelemetry(workspaceDir, activationId, decisions) {
58
- const logsDir = path.join(workspaceDir, '.pd', 'logs');
59
- const countCircuitTrips = (minimumTime) => decisions.filter(decision => decision.decision === 'safety_isolate' && Date.parse(decision.decidedAt) >= minimumTime).length;
60
- const now = Date.now();
61
- const unavailableWindow = (minimumTime) => ({ eligible: null, matched: null, blocked: null, unhealthy: null, circuitTrips: countCircuitTrips(minimumTime), toolDistribution: null });
62
- if (!fs.existsSync(logsDir))
63
- return { shadowSummary: unavailableShadowSummary(), metrics: { last24Hours: unavailableWindow(now - 24 * 60 * 60 * 1000), last7Days: unavailableWindow(now - 7 * 24 * 60 * 60 * 1000), representativeSamples: [] } };
57
+ /**
58
+ * PRI-577: RuleCode event telemetry candidate directories, in priority order.
59
+ *
60
+ * Runtime V2 convention is `.pd/logs`, but the v1 EventLog writer
61
+ * (openclaw-plugin `src/core/event-log.ts`) still emits `events_*.jsonl` under
62
+ * `.state/logs`. No production code ever created `.pd/logs`, so scanning only
63
+ * that path made every activation's shadow metrics report "unavailable" in the
64
+ * console while real evaluations accumulated unread in `.state/logs`. Readers
65
+ * scan both candidates until the writer migrates (ERR-031: both readers derive
66
+ * from this same list).
67
+ */
68
+ export const RULECODE_EVENT_LOG_CANDIDATE_DIRS = ['.pd/logs', '.state/logs'];
69
+ /**
70
+ * Collect rulehost telemetry entries from all candidate log directories.
71
+ * Malformed lines are excluded individually. A directory counts as a source
72
+ * only after it can be enumerated, so an unreadable path cannot be mistaken
73
+ * for a healthy channel with zero events (ERR-002).
74
+ *
75
+ * Exact lines copied between candidate directories are deduplicated by
76
+ * priority. Different events in same-named daily files are retained.
77
+ */
78
+ export function collectRuleCodeEventEntries(workspaceDir) {
64
79
  const entries = [];
65
- try {
66
- for (const file of fs.readdirSync(logsDir).filter(name => /^events_.*\.jsonl$/.test(name)).sort().slice(-7)) {
67
- for (const line of fs.readFileSync(path.join(logsDir, file), 'utf8').split('\n').filter(Boolean)) {
68
- try {
69
- entries.push(JSON.parse(line));
80
+ let sourceDirsFound = 0;
81
+ const higherPriorityLines = new Set();
82
+ for (const candidate of RULECODE_EVENT_LOG_CANDIDATE_DIRS) {
83
+ const logsDir = path.join(workspaceDir, ...candidate.split('/'));
84
+ if (!fs.existsSync(logsDir))
85
+ continue;
86
+ try {
87
+ const files = fs.readdirSync(logsDir)
88
+ .filter(name => /^events_.*\.jsonl$/.test(name))
89
+ .sort()
90
+ .slice(-7);
91
+ sourceDirsFound += 1;
92
+ const currentSourceLines = [];
93
+ for (const file of files) {
94
+ const lines = fs.readFileSync(path.join(logsDir, file), 'utf8').split('\n').filter(Boolean);
95
+ for (const line of lines) {
96
+ currentSourceLines.push(line);
97
+ if (higherPriorityLines.has(line))
98
+ continue;
99
+ try {
100
+ entries.push(JSON.parse(line));
101
+ }
102
+ catch { /* exclude malformed telemetry */ }
70
103
  }
71
- catch { /* malformed telemetry is excluded, readiness remains bounded */ }
72
104
  }
105
+ for (const line of currentSourceLines)
106
+ higherPriorityLines.add(line);
73
107
  }
108
+ catch { /* unreadable directory contributes no entries */ }
74
109
  }
75
- catch {
110
+ return { entries, sourceDirsFound };
111
+ }
112
+ function readRuleCodeTelemetry(workspaceDir, activationId, decisions) {
113
+ const countCircuitTrips = (minimumTime) => decisions.filter(decision => decision.decision === 'safety_isolate' && Date.parse(decision.decidedAt) >= minimumTime).length;
114
+ const now = Date.now();
115
+ const unavailableWindow = (minimumTime) => ({ eligible: null, matched: null, blocked: null, unhealthy: null, circuitTrips: countCircuitTrips(minimumTime), toolDistribution: null });
116
+ const collected = collectRuleCodeEventEntries(workspaceDir);
117
+ if (collected.sourceDirsFound === 0)
76
118
  return { shadowSummary: unavailableShadowSummary(), metrics: { last24Hours: unavailableWindow(now - 24 * 60 * 60 * 1000), last7Days: unavailableWindow(now - 7 * 24 * 60 * 60 * 1000), representativeSamples: [] } };
77
- }
119
+ const { entries } = collected;
78
120
  const summarizeWindow = (minimumTime) => {
79
121
  let eligible = 0;
80
122
  let matched = 0;
@@ -293,7 +335,7 @@ export class ActivationsConsoleModel {
293
335
  catch { /* best-effort */ }
294
336
  }
295
337
  }
296
- async getOwnerReview(activationId, ownerIdentityConfigured = false) {
338
+ async getOwnerReview(activationId, ownerIdentityConfigured = false, ownerActor) {
297
339
  const conn = new SqliteConnection({ workspaceDir: this.workspaceDir, readonly: true });
298
340
  try {
299
341
  const activationStore = new SqliteActivationStateStore(conn);
@@ -336,19 +378,19 @@ export class ActivationsConsoleModel {
336
378
  validateProductionArtifact: candidate => writer.canActivate(candidate),
337
379
  });
338
380
  },
339
- buildEvidenceSnapshot: (checks, value) => {
340
- const createdAt = new Date().toISOString();
341
- const artifactDigest = value
342
- ? `sha256:${createHash('sha256').update(JSON.stringify(value), 'utf8').digest('hex')}` : digest;
343
- const body = JSON.stringify({ artifactDigest, checks, createdAt });
344
- return {
345
- snapshotId: `snapshot-${randomUUID()}`,
346
- snapshotDigest: `sha256:${createHash('sha256').update(body, 'utf8').digest('hex')}`,
347
- artifactDigest, lineageRefs: value ? [value.sourceTaskId, ...value.lineageArtifactIds] : [],
348
- hostRuntimeVersion: 'openclaw-legacy@1', safetyGateResults: checks,
381
+ buildEvidenceSnapshot: (checks, value, evaluationId) => {
382
+ return buildPromotionEvidenceSnapshot({
383
+ activationId,
384
+ evaluationId,
385
+ checks,
386
+ artifact: value,
387
+ expectedArtifactDigest: digest,
388
+ // Bind the real authenticated actor; null (not a placeholder) when
389
+ // the review is read without an Owner session.
390
+ ownerIdentity: ownerActor ?? null,
391
+ hostRuntimeVersion: 'openclaw-legacy@1',
349
392
  shadowSummary: telemetry.shadowSummary,
350
- configurationVersion: 'pd-config-current', redaction: { version: 'v1', rawParametersStored: false }, createdAt,
351
- };
393
+ });
352
394
  },
353
395
  newEvaluationId: () => `readiness-${randomUUID()}`,
354
396
  });
@@ -476,7 +518,7 @@ export class ActivationsConsoleModel {
476
518
  }
477
519
  }
478
520
  async promoteRuleCode(activationId, expected, input) {
479
- const review = await this.getOwnerReview(activationId, input.actor.principal.kind === 'configured_owner' && input.actor.authentication.method === 'console_token');
521
+ const review = await this.getOwnerReview(activationId, input.actor.principal.kind === 'configured_owner' && input.actor.authentication.method === 'console_token', input.actor);
480
522
  const flags = computeFlagsFromLoadResult(loadPdConfig(this.workspaceDir));
481
523
  const conn = new SqliteConnection({ workspaceDir: this.workspaceDir, readonly: false });
482
524
  try {
@@ -0,0 +1,28 @@
1
+ import type { GovernanceExperienceInputs, GovernanceExperienceSnapshot, OwnerConfigSnapshot } from '@principles/core/runtime-v2';
2
+ import { type GovernanceProjectionTables } from './GovernanceProjectionCollector.js';
3
+ /**
4
+ * Stable, path-safe workspace hash for snapshotId (SPEC §13): never exposes the
5
+ * raw path and is never persisted. Windows normalization: backslashes become
6
+ * forward slashes and the drive letter is case-folded, so `D:\a\b`, `d:/a/b/`
7
+ * and `D:/a/b` hash identically. POSIX path case is intentionally preserved.
8
+ */
9
+ export declare function hashWorkspacePath(workspaceDir: string): string;
10
+ export interface GovernanceExperienceCollectOptions {
11
+ ownerConfig: OwnerConfigSnapshot;
12
+ /** ISO-8601 UTC timestamp; defaults to now. Injected by tests for determinism. */
13
+ asOf?: string;
14
+ /** Test seam for the query-budget contract; production always reads via GovernanceProjectionCollector.readTables. */
15
+ tableReader?: (workspaceDir: string) => GovernanceProjectionTables;
16
+ }
17
+ export declare class GovernanceExperienceCollector {
18
+ private readonly workspaceDir;
19
+ constructor(workspaceDir: string);
20
+ collectSnapshot(options: GovernanceExperienceCollectOptions): GovernanceExperienceSnapshot;
21
+ buildInputs(options: GovernanceExperienceCollectOptions): GovernanceExperienceInputs;
22
+ /**
23
+ * Reads the principle ledger once and validates every entry. A readable file
24
+ * with a malformed tree counts as an unavailable ledger source (no views can
25
+ * be built); individual invalid entries degrade to data-quality groups.
26
+ */
27
+ private scanLedger;
28
+ }