create-principles-disciple 1.121.7 → 1.121.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +4 -2
  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 +4 -5
  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 +7 -2
  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 +3 -2
  440. package/plugin/dist/bundle.js +870 -932
  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,76 @@
1
+ import { resolveOwnerIdentity, readOwnerIdentityFile, writeOwnerIdentityFile, deleteOwnerIdentityFile, } from '@principles/core/runtime-v2';
2
+ import { sendSuccess, sendError, sendBadRequest, sendMethodNotAllowed } from '../utils/response.js';
3
+ import { resolveOwnerConfigSnapshot } from './governance.js';
4
+ const MAX_BODY_SIZE = 16 * 1024;
5
+ async function readJson(req) {
6
+ const chunks = [];
7
+ let totalSize = 0;
8
+ for await (const chunk of req) {
9
+ const buf = typeof chunk === 'string' ? Buffer.from(chunk) : chunk;
10
+ totalSize += buf.length;
11
+ if (totalSize > MAX_BODY_SIZE)
12
+ throw new Error('payload_too_large');
13
+ chunks.push(buf);
14
+ }
15
+ return JSON.parse(Buffer.concat(chunks).toString('utf-8'));
16
+ }
17
+ /* eslint-disable @typescript-eslint/max-params */
18
+ export async function handleOwnerIdentityRoute(req, res, homeDir, subPath, authConfig) {
19
+ if (subPath !== '' && subPath !== '/') {
20
+ sendError(res, 404, 'not_found', 'Unknown owner identity endpoint.', { nextAction: 'Use GET / POST / DELETE /api/v1/owner-identity.' });
21
+ return;
22
+ }
23
+ const method = req.method ?? 'GET';
24
+ if (method === 'GET') {
25
+ const file = readOwnerIdentityFile(homeDir);
26
+ const resolved = resolveOwnerIdentity(process.env, homeDir);
27
+ const view = {
28
+ resolved,
29
+ fileRecord: file.record,
30
+ ...(file.error === undefined ? {} : { fileError: file.error }),
31
+ governance: resolveOwnerConfigSnapshot(authConfig, resolved),
32
+ };
33
+ sendSuccess(res, view);
34
+ return;
35
+ }
36
+ if (method === 'POST') {
37
+ let body;
38
+ try {
39
+ body = await readJson(req);
40
+ }
41
+ catch {
42
+ sendBadRequest(res, 'Invalid JSON body or payload too large.');
43
+ return;
44
+ }
45
+ const value = body;
46
+ const ownerId = typeof value?.ownerId === 'string' ? value.ownerId : '';
47
+ const credentialId = typeof value?.credentialId === 'string' ? value.credentialId : '';
48
+ const result = writeOwnerIdentityFile(homeDir, { ownerId, credentialId });
49
+ if (!result.ok) {
50
+ sendBadRequest(res, result.error);
51
+ return;
52
+ }
53
+ const resolved = resolveOwnerIdentity(process.env, homeDir);
54
+ sendSuccess(res, {
55
+ record: result.record,
56
+ source: 'file',
57
+ governance: resolveOwnerConfigSnapshot(authConfig, resolved),
58
+ });
59
+ return;
60
+ }
61
+ if (method === 'DELETE') {
62
+ const result = deleteOwnerIdentityFile(homeDir);
63
+ if (!result.ok) {
64
+ sendError(res, 500, 'owner_identity_delete_failed', result.error);
65
+ return;
66
+ }
67
+ const resolved = resolveOwnerIdentity(process.env, homeDir);
68
+ sendSuccess(res, {
69
+ ok: true,
70
+ source: 'none',
71
+ governance: resolveOwnerConfigSnapshot(authConfig, resolved),
72
+ });
73
+ return;
74
+ }
75
+ sendMethodNotAllowed(res);
76
+ }
@@ -1,11 +1,16 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ export declare const UPDATE_HISTORY_KINDS: readonly ['update', 'reinstall', 'legacy_migration', 'rollback', 'refusal', 'failure', 'recovery', 'unknown'];
3
+ export type UpdateHistoryKind = (typeof UPDATE_HISTORY_KINDS)[number];
2
4
  interface UpdateHistoryEntry {
3
5
  id: string;
4
6
  timestamp: string;
5
7
  fromVersion: string;
6
8
  toVersion: string;
7
9
  success: boolean;
10
+ kind: UpdateHistoryKind;
8
11
  backupPath?: string;
12
+ reason?: string;
13
+ nextAction?: string;
9
14
  }
10
15
  export declare function appendUpdateHistory(workspaceDir: string, entry: Omit<UpdateHistoryEntry, 'id' | 'timestamp'>): void;
11
16
  export declare function handleUpdateHistoryRoute(req: IncomingMessage, res: ServerResponse, workspaceDir: string, _subPath: string): Promise<void>;
@@ -1,6 +1,52 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import { sendSuccess, sendMethodNotAllowed } from '../utils/response.js';
4
+ export const UPDATE_HISTORY_KINDS = [
5
+ 'update',
6
+ 'reinstall',
7
+ 'legacy_migration',
8
+ 'rollback',
9
+ 'refusal',
10
+ 'failure',
11
+ 'recovery',
12
+ 'unknown',
13
+ ];
14
+ function isHistoryKind(value) {
15
+ return typeof value === 'string' && UPDATE_HISTORY_KINDS.includes(value);
16
+ }
17
+ function parseHistoryEntry(value) {
18
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
19
+ return undefined;
20
+ const raw = value;
21
+ if (typeof raw.id !== 'string' ||
22
+ typeof raw.timestamp !== 'string' ||
23
+ typeof raw.fromVersion !== 'string' ||
24
+ typeof raw.toVersion !== 'string' ||
25
+ typeof raw.success !== 'boolean')
26
+ return undefined;
27
+ if (raw.kind !== undefined && !isHistoryKind(raw.kind))
28
+ return undefined;
29
+ if (raw.reason !== undefined && typeof raw.reason !== 'string')
30
+ return undefined;
31
+ if (raw.nextAction !== undefined && typeof raw.nextAction !== 'string')
32
+ return undefined;
33
+ if (raw.backupPath !== undefined && typeof raw.backupPath !== 'string')
34
+ return undefined;
35
+ return {
36
+ id: raw.id,
37
+ timestamp: raw.timestamp,
38
+ fromVersion: raw.fromVersion,
39
+ toVersion: raw.toVersion,
40
+ success: raw.success,
41
+ // Pre-Phase-0 records did not identify their operation. The operation is
42
+ // UNKNOWN — labeling them legacy_migration would claim a migration
43
+ // happened, which the record cannot prove (unknown ≠ legacy_migration).
44
+ kind: raw.kind === undefined ? 'unknown' : raw.kind,
45
+ ...(typeof raw.backupPath === 'string' ? { backupPath: raw.backupPath } : {}),
46
+ ...(typeof raw.reason === 'string' ? { reason: raw.reason } : {}),
47
+ ...(typeof raw.nextAction === 'string' ? { nextAction: raw.nextAction } : {}),
48
+ };
49
+ }
4
50
  function getHistoryPath(workspaceDir) {
5
51
  return path.join(workspaceDir, '.pd', 'update-history.json');
6
52
  }
@@ -10,10 +56,10 @@ function loadHistory(historyPath) {
10
56
  const raw = fs.readFileSync(historyPath, 'utf-8');
11
57
  const parsed = JSON.parse(raw);
12
58
  if (Array.isArray(parsed)) {
13
- return parsed.filter((e) => typeof e === 'object' && e !== null &&
14
- typeof e.fromVersion === 'string' &&
15
- typeof e.toVersion === 'string' &&
16
- typeof e.success === 'boolean');
59
+ return parsed.flatMap((entry) => {
60
+ const parsedEntry = parseHistoryEntry(entry);
61
+ return parsedEntry === undefined ? [] : [parsedEntry];
62
+ });
17
63
  }
18
64
  }
19
65
  catch (err) {
@@ -8,6 +8,7 @@ import { appendUpdateHistory } from './update-history.js';
8
8
  import { checkOpenClawGateway, stopOpenClawGateway, restartOpenClawGateway, } from '../utils/gateway.js';
9
9
  import { migrateLegacyExtensionBackups, reservePdBackupDestination, resolvePdBackupsRoot, } from '../utils/pd-backups.js';
10
10
  import { ActivationCompatibilityReadModel } from '@principles/core/runtime-v2';
11
+ import { getInstallLayoutPaths, resolveInstallLayout } from '@principles/install-layout';
11
12
  /**
12
13
  * Legacy rule contract preflight (2026-08-19): refuse to swap the runtime
13
14
  * while an ACTIVE owner-approved rule still depends on a RuleHost contract
@@ -68,8 +69,48 @@ function resolveOpenclawHome() {
68
69
  function resolveExtensionsDir() {
69
70
  return path.join(resolveOpenclawHome(), 'extensions');
70
71
  }
72
+ function resolveUpdateLayout() {
73
+ const homeDir = os.homedir();
74
+ const paths = getInstallLayoutPaths(homeDir);
75
+ const legacyPluginDir = path.join(resolveExtensionsDir(), 'principles-disciple');
76
+ let manifest;
77
+ try {
78
+ manifest = JSON.parse(fs.readFileSync(paths.manifest, 'utf8'));
79
+ }
80
+ catch {
81
+ manifest = undefined;
82
+ }
83
+ const resolution = resolveInstallLayout({
84
+ homeDir,
85
+ manifest,
86
+ canonicalRuntimeExists: fs.existsSync(paths.runtimeDir),
87
+ legacyExtensionExists: fs.existsSync(legacyPluginDir),
88
+ });
89
+ if (resolution.mode === 'missing')
90
+ return undefined;
91
+ if (resolution.mode === 'canonical') {
92
+ return {
93
+ pluginDir: paths.pluginDir,
94
+ consoleDir: paths.consoleDir,
95
+ coreDir: paths.coreDir,
96
+ hostRuntimeDir: paths.hostRuntimeDir,
97
+ pdCliDir: paths.pdCliDir,
98
+ installLayoutDir: paths.installLayoutDir,
99
+ hosts: resolution.manifest?.hosts ?? [],
100
+ };
101
+ }
102
+ return {
103
+ pluginDir: legacyPluginDir,
104
+ consoleDir: path.join(legacyPluginDir, 'console'),
105
+ coreDir: path.join(legacyPluginDir, 'core'),
106
+ hostRuntimeDir: path.join(legacyPluginDir, 'host-runtime'),
107
+ pdCliDir: path.join(legacyPluginDir, 'pd-cli'),
108
+ installLayoutDir: path.join(legacyPluginDir, 'install-layout'),
109
+ hosts: ['openclaw'],
110
+ };
111
+ }
71
112
  function resolvePluginDir(_workspaceDir) {
72
- return path.join(resolveExtensionsDir(), 'principles-disciple');
113
+ return resolveUpdateLayout()?.pluginDir ?? path.join(resolveExtensionsDir(), 'principles-disciple');
73
114
  }
74
115
  function readCurrentVersion(pluginDir) {
75
116
  const pkgPath = path.join(pluginDir, 'package.json');
@@ -480,6 +521,26 @@ async function doApplyUpdate(options, workspaceDir) {
480
521
  const toVersion = typeof data.version === 'string' ? data.version : undefined;
481
522
  if (!toVersion)
482
523
  return { success: false, message: 'Missing version in registry response' };
524
+ const advancesInstalled = fromVersion !== 'unknown' &&
525
+ semver.valid(fromVersion) !== null &&
526
+ semver.valid(toVersion) !== null &&
527
+ semver.gt(toVersion, fromVersion);
528
+ if (!advancesInstalled) {
529
+ appendUpdateHistory(workspaceDir, {
530
+ fromVersion,
531
+ toVersion,
532
+ success: false,
533
+ kind: 'refusal',
534
+ reason: 'installer_bundle_stale',
535
+ nextAction: 'Wait for a newer installer release, then retry the update.',
536
+ });
537
+ return {
538
+ success: false,
539
+ message: 'Installed version would not advance — the update source is stale or malformed.',
540
+ reason: 'installer_bundle_stale',
541
+ nextAction: 'Wait for a newer installer release, then retry the update.',
542
+ };
543
+ }
483
544
  const dist = typeof data.dist === 'object' && data.dist !== null ? data.dist : null;
484
545
  const tarball = dist && typeof dist.tarball === 'string' ? dist.tarball : undefined;
485
546
  if (!tarball)
@@ -559,6 +620,7 @@ async function doApplyUpdate(options, workspaceDir) {
559
620
  fromVersion,
560
621
  toVersion,
561
622
  success: true,
623
+ kind: 'update',
562
624
  backupPath,
563
625
  });
564
626
  return {
@@ -620,6 +682,7 @@ async function doRollbackUpdate(options, workspaceDir) {
620
682
  fromVersion: 'rolled-back',
621
683
  toVersion: readCurrentVersion(targetDir) ?? 'unknown',
622
684
  success: true,
685
+ kind: 'rollback',
623
686
  backupPath: backupDir,
624
687
  });
625
688
  return { success: true, message: 'Rollback completed successfully' };
@@ -676,14 +739,20 @@ function depsMeaningfullyChanged(oldDeps, newDeps) {
676
739
  * Returns undefined on success, or an error message (rc-9: observable, never
677
740
  * silent — a missing link means the updated console cannot start).
678
741
  */
679
- function ensureHostRuntimeResolutionLinks(extDir) {
680
- const hostRuntimeDir = path.join(extDir, 'host-runtime');
742
+ function ensureRuntimeResolutionLinks(layout) {
681
743
  const links = [
682
- { linkPath: path.join(extDir, 'console', 'node_modules', '@principles', 'host-runtime'), target: hostRuntimeDir, unixTarget: '../../../host-runtime' },
683
- { linkPath: path.join(extDir, 'pd-cli', 'node_modules', '@principles', 'host-runtime'), target: hostRuntimeDir, unixTarget: '../../../host-runtime' },
684
- { linkPath: path.join(extDir, 'console', 'node_modules', 'principles-disciple'), target: extDir, unixTarget: '../../' },
744
+ { linkPath: path.join(layout.consoleDir, 'node_modules', '@principles', 'host-runtime'), target: layout.hostRuntimeDir },
745
+ { linkPath: path.join(layout.pdCliDir, 'node_modules', '@principles', 'host-runtime'), target: layout.hostRuntimeDir },
746
+ { linkPath: path.join(layout.consoleDir, 'node_modules', '@principles', 'install-layout'), target: layout.installLayoutDir },
747
+ { linkPath: path.join(layout.pdCliDir, 'node_modules', '@principles', 'install-layout'), target: layout.installLayoutDir },
748
+ // host-runtime depends on @principles/install-layout at runtime; /apply-full
749
+ // skips npm install, so its node_modules must self-provision the link too.
750
+ { linkPath: path.join(layout.hostRuntimeDir, 'node_modules', '@principles', 'install-layout'), target: layout.installLayoutDir },
751
+ { linkPath: path.join(layout.consoleDir, 'node_modules', 'principles-disciple'), target: layout.pluginDir },
685
752
  ];
686
- for (const { linkPath, target, unixTarget } of links) {
753
+ for (const { linkPath, target } of links) {
754
+ if (!fs.existsSync(target))
755
+ continue;
687
756
  if (fs.existsSync(linkPath))
688
757
  continue;
689
758
  try {
@@ -692,17 +761,27 @@ function ensureHostRuntimeResolutionLinks(extDir) {
692
761
  fs.symlinkSync(target, linkPath, 'junction');
693
762
  }
694
763
  else {
695
- fs.symlinkSync(unixTarget, linkPath, 'dir');
764
+ fs.symlinkSync(path.relative(path.dirname(linkPath), target), linkPath, 'dir');
696
765
  }
697
766
  }
698
767
  catch (error) {
699
- return `Failed to create host-runtime resolution link at ${linkPath}: ${error instanceof Error ? error.message : String(error)}`;
768
+ return `Failed to create runtime resolution link at ${linkPath}: ${error instanceof Error ? error.message : String(error)}`;
700
769
  }
701
770
  }
702
771
  return undefined;
703
772
  }
704
773
  async function doInlineFullUpdate(workspaceDir) {
705
- const extDir = resolvePluginDir(workspaceDir);
774
+ const layout = resolveUpdateLayout();
775
+ if (!layout) {
776
+ return {
777
+ success: false,
778
+ message: 'PD install runtime could not be resolved.',
779
+ reason: 'install_runtime_missing',
780
+ nextAction: 'Run npx create-principles-disciple to install or repair PD, then retry the update.',
781
+ requiresRestart: false,
782
+ };
783
+ }
784
+ const extDir = layout.pluginDir;
706
785
  // Legacy-contract preflight BEFORE stopping the gateway or touching files:
707
786
  // refuse while an active rule still uses a removed RuleHost contract
708
787
  // symbol — the running installation stays exactly as it was.
@@ -716,23 +795,16 @@ async function doInlineFullUpdate(workspaceDir) {
716
795
  requiresRestart: false,
717
796
  };
718
797
  }
719
- // 1. Stop gateway (releases native module locks held by the gateway process)
720
- const gatewayStatus = await checkOpenClawGateway();
798
+ // gatewayWasStopped records whether we had to stop an OpenClaw gateway to
799
+ // release native module locks. It is only ever set after candidate
800
+ // verification, in the host-aware stop below.
721
801
  let gatewayWasStopped = false;
722
- if (gatewayStatus.isRunning) {
723
- const stopRes = stopOpenClawGateway();
724
- if (stopRes.ok)
725
- gatewayWasStopped = true;
726
- }
727
- // Capture version before changes
802
+ // Capture installed facts before staging any candidate release.
728
803
  const fromVersion = readCurrentVersion(extDir) ?? 'unknown';
729
804
  // Capture the installed skill language before the tarball's manifest
730
805
  // overwrites it (PR #1332 companion — see reapplySkillLanguage).
731
806
  const skillLanguage = detectInstalledSkillLanguage(extDir);
732
807
  let tempDir;
733
- // Heal legacy installs: move old backups out of the extensions dir so
734
- // OpenClaw discovery stops reporting a duplicate plugin (see pd-backups.ts).
735
- logLegacyBackupMigration('pd-update-full');
736
808
  try {
737
809
  // 2. Fetch installer package info from npm
738
810
  const response = await fetchWithRetry(NPM_REGISTRY_INSTALLER, 'Installer registry check');
@@ -740,6 +812,32 @@ async function doInlineFullUpdate(workspaceDir) {
740
812
  if (!isRecord(rawData))
741
813
  return { success: false, message: 'Invalid registry response', requiresRestart: false };
742
814
  const toVersion = typeof rawData.version === 'string' ? rawData.version : undefined;
815
+ const bundledPluginVersion = isRecord(rawData.pd) && typeof rawData.pd.bundledPluginVersion === 'string'
816
+ ? rawData.pd.bundledPluginVersion
817
+ : undefined;
818
+ if (bundledPluginVersion !== undefined) {
819
+ const advancesInstalled = fromVersion !== 'unknown' &&
820
+ semver.valid(fromVersion) !== null &&
821
+ semver.valid(bundledPluginVersion) !== null &&
822
+ semver.gt(bundledPluginVersion, fromVersion);
823
+ if (!advancesInstalled) {
824
+ appendUpdateHistory(workspaceDir, {
825
+ fromVersion,
826
+ toVersion: bundledPluginVersion,
827
+ success: false,
828
+ kind: 'refusal',
829
+ reason: 'installer_bundle_stale',
830
+ nextAction: 'Wait for a newer installer release, then retry the update.',
831
+ });
832
+ return {
833
+ success: false,
834
+ message: 'Installed version would not advance — the update source is stale or malformed.',
835
+ reason: 'installer_bundle_stale',
836
+ nextAction: 'Wait for a newer installer release, then retry the update.',
837
+ requiresRestart: false,
838
+ };
839
+ }
840
+ }
743
841
  const dist = isRecord(rawData.dist) ? rawData.dist : null;
744
842
  const tarball = dist && typeof dist.tarball === 'string' ? dist.tarball : undefined;
745
843
  if (!tarball)
@@ -754,10 +852,53 @@ async function doInlineFullUpdate(workspaceDir) {
754
852
  // shell syntax (Mimosa command-injection finding, 2026-08-22).
755
853
  execFileSync('tar', ['xzf', tarballPath, '-C', tempDir, '--strip-components=1'], { stdio: 'pipe' });
756
854
  fs.unlinkSync(tarballPath);
855
+ // The tarball, not the installer package version, is the release we are
856
+ // about to activate. Prove it advances the installed plugin BEFORE the
857
+ // gateway is stopped or any production file is copied.
858
+ const newPkgPath = path.join(tempDir, 'plugin', 'package.json');
859
+ const stagedVersion = readCurrentVersion(path.join(tempDir, 'plugin'));
860
+ const progressed = fromVersion !== 'unknown' &&
861
+ stagedVersion !== undefined &&
862
+ semver.valid(fromVersion) !== null &&
863
+ semver.valid(stagedVersion) !== null &&
864
+ semver.gt(stagedVersion, fromVersion) &&
865
+ (bundledPluginVersion === undefined || bundledPluginVersion === stagedVersion);
866
+ if (!progressed) {
867
+ if (tempDir && fs.existsSync(tempDir)) {
868
+ fs.rmSync(tempDir, { recursive: true, force: true });
869
+ }
870
+ appendUpdateHistory(workspaceDir, {
871
+ fromVersion,
872
+ toVersion: stagedVersion ?? 'unknown',
873
+ success: false,
874
+ kind: 'refusal',
875
+ reason: 'installer_bundle_stale',
876
+ nextAction: 'Wait for a newer installer release, then retry the update.',
877
+ });
878
+ return {
879
+ success: false,
880
+ message: 'Installed version would not advance — the update source is stale or malformed.',
881
+ reason: 'installer_bundle_stale',
882
+ nextAction: 'Wait for a newer installer release, then retry the update.',
883
+ requiresRestart: false,
884
+ };
885
+ }
886
+ // Only a verified advancing release may cause host interruption or touch
887
+ // the production installation.
888
+ const gatewayStatus = layout.hosts.includes('openclaw')
889
+ ? await checkOpenClawGateway()
890
+ : { isRunning: false };
891
+ if (gatewayStatus.isRunning) {
892
+ const stopRes = stopOpenClawGateway();
893
+ if (stopRes.ok)
894
+ gatewayWasStopped = true;
895
+ }
896
+ // Heal legacy installs only after candidate verification. This writes
897
+ // outside the release tree, so it must not happen for a refused release.
898
+ logLegacyBackupMigration('pd-update-full');
757
899
  // 4. Detect dependency changes (informational — logged but not blocking;
758
900
  // the .js files are still updated; node_modules stays as-is)
759
901
  let depsChanged = false;
760
- const newPkgPath = path.join(tempDir, 'plugin', 'package.json');
761
902
  const oldPkgPath = path.join(extDir, 'package.json');
762
903
  if (fs.existsSync(newPkgPath) && fs.existsSync(oldPkgPath)) {
763
904
  try {
@@ -785,17 +926,22 @@ async function doInlineFullUpdate(workspaceDir) {
785
926
  // console that does not import it, so skipping is consistent for
786
927
  // them. On fresh installs this is an overlay refresh + link no-op.
787
928
  const hostRuntimeSrc = path.join(tempDir, 'host-runtime');
788
- const hostRuntimeDest = path.join(extDir, 'host-runtime');
929
+ const hostRuntimeDest = layout.hostRuntimeDir;
789
930
  if (fs.existsSync(hostRuntimeSrc) &&
790
931
  fs.existsSync(path.join(hostRuntimeSrc, 'package.json')) &&
791
932
  fs.existsSync(path.join(hostRuntimeSrc, 'dist'))) {
792
933
  copyDirRecursive(hostRuntimeSrc, hostRuntimeDest, SKIP_DIRS);
793
- const linkError = ensureHostRuntimeResolutionLinks(extDir);
934
+ const installLayoutSrc = path.join(tempDir, 'install-layout');
935
+ if (fs.existsSync(path.join(installLayoutSrc, 'package.json')) && fs.existsSync(path.join(installLayoutSrc, 'dist'))) {
936
+ copyDirRecursive(installLayoutSrc, layout.installLayoutDir, SKIP_DIRS);
937
+ }
938
+ const linkError = ensureRuntimeResolutionLinks(layout);
794
939
  if (linkError) {
795
940
  appendUpdateHistory(workspaceDir, {
796
941
  fromVersion,
797
942
  toVersion: 'failed',
798
943
  success: false,
944
+ kind: 'failure',
799
945
  });
800
946
  return {
801
947
  success: false,
@@ -818,20 +964,20 @@ async function doInlineFullUpdate(workspaceDir) {
818
964
  // console/node_modules/ may contain locked native modules like
819
965
  // better-sqlite3 that the running console process holds via dlopen)
820
966
  const consoleSrc = path.join(tempDir, 'console');
821
- const consoleDest = path.join(extDir, 'console');
967
+ const consoleDest = layout.consoleDir;
822
968
  if (fs.existsSync(consoleSrc)) {
823
969
  copyDirRecursive(consoleSrc, consoleDest, SKIP_DIRS);
824
970
  }
825
971
  // c. core/ → extDir/core/ (overwrite, skip node_modules for safety)
826
972
  const coreSrc = path.join(tempDir, 'core');
827
- const coreDest = path.join(extDir, 'core');
973
+ const coreDest = layout.coreDir;
828
974
  if (fs.existsSync(coreSrc)) {
829
975
  copyDirRecursive(coreSrc, coreDest, SKIP_DIRS);
830
976
  }
831
977
  // d. pd-cli/dist + package.json → extDir/pd-cli/ (overwrite only,
832
978
  // do NOT rmSync — preserves node_modules symlinks created at install)
833
979
  const pdCliSrc = path.join(tempDir, 'pd-cli');
834
- const pdCliDest = path.join(extDir, 'pd-cli');
980
+ const pdCliDest = layout.pdCliDir;
835
981
  if (fs.existsSync(pdCliSrc)) {
836
982
  const distSrc = path.join(pdCliSrc, 'dist');
837
983
  const distDest = path.join(pdCliDest, 'dist');
@@ -857,11 +1003,8 @@ async function doInlineFullUpdate(workspaceDir) {
857
1003
  // false "update available". Detect that and fail loud (rc-9) instead of
858
1004
  // reporting a false success.
859
1005
  const newVersion = readCurrentVersion(extDir) ?? toVersion ?? 'unknown';
860
- const progressed = fromVersion !== 'unknown' &&
861
- semver.valid(fromVersion) !== null &&
862
- semver.valid(newVersion) !== null &&
863
- semver.gt(newVersion, fromVersion);
864
- if (!progressed) {
1006
+ const installedExpectedRelease = newVersion === stagedVersion;
1007
+ if (!installedExpectedRelease) {
865
1008
  // Files were already rewritten to the same (or lower) version. Record a
866
1009
  // FAILED history entry so the operator sees why, and return a structured
867
1010
  // error with nextAction.
@@ -869,6 +1012,7 @@ async function doInlineFullUpdate(workspaceDir) {
869
1012
  fromVersion,
870
1013
  toVersion: newVersion,
871
1014
  success: false,
1015
+ kind: 'failure',
872
1016
  });
873
1017
  return {
874
1018
  success: false,
@@ -883,6 +1027,7 @@ async function doInlineFullUpdate(workspaceDir) {
883
1027
  fromVersion,
884
1028
  toVersion: newVersion,
885
1029
  success: true,
1030
+ kind: 'update',
886
1031
  });
887
1032
  return {
888
1033
  success: true,
@@ -908,6 +1053,7 @@ async function doInlineFullUpdate(workspaceDir) {
908
1053
  fromVersion,
909
1054
  toVersion: 'failed',
910
1055
  success: false,
1056
+ kind: 'failure',
911
1057
  });
912
1058
  if (isLockError) {
913
1059
  return {
@@ -990,6 +1136,14 @@ export async function handleUpdateRoute(req, res, workspaceDir, subPath) {
990
1136
  }
991
1137
  // createBackup is a boolean (default false)
992
1138
  const createBackup = typeof body.createBackup === 'boolean' ? body.createBackup : false;
1139
+ // The Console updater owns only the installed PD runtime selected at
1140
+ // process start. A caller-supplied path inside a workspace may be a
1141
+ // development checkout; accepting it lets a registry package overwrite
1142
+ // source files and makes version history describe the wrong product.
1143
+ if (path.resolve(targetDir) !== path.resolve(pluginDir)) {
1144
+ sendError(res, 400, 'update_target_not_installed', 'Updates may only target the installed PD runtime.', { nextAction: 'Run the official installer to repair the installation, then retry from Console.' });
1145
+ return;
1146
+ }
993
1147
  // Path traversal validation
994
1148
  if (!validatePathInWorkspace(targetDir, workspaceDir)) {
995
1149
  sendBadRequest(res, 'targetDir must be within workspace or extensions directory');
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Feedback channel identity constants — PRI-613.
3
+ *
4
+ * Kept in a dependency-free module so the browser bundle can import the
5
+ * runtime const WITHOUT pulling @sinclair/typebox in (the schema module
6
+ * imports typebox; importing it at runtime from UI code would add ~850KB to
7
+ * the browser bundle — measured, SPEC §10.5 stop condition). The schema
8
+ * module derives its literal union from this const; the UI derives its
9
+ * runtime channel-ID check from the same const. One authority, two safe
10
+ * import contexts.
11
+ */
12
+ export declare const FEEDBACK_CHANNEL_IDS: readonly ['ingest', 'github', 'email', 'file'];
13
+ export type FeedbackChannelId = (typeof FEEDBACK_CHANNEL_IDS)[number];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Feedback channel identity constants — PRI-613.
3
+ *
4
+ * Kept in a dependency-free module so the browser bundle can import the
5
+ * runtime const WITHOUT pulling @sinclair/typebox in (the schema module
6
+ * imports typebox; importing it at runtime from UI code would add ~850KB to
7
+ * the browser bundle — measured, SPEC §10.5 stop condition). The schema
8
+ * module derives its literal union from this const; the UI derives its
9
+ * runtime channel-ID check from the same const. One authority, two safe
10
+ * import contexts.
11
+ */
12
+ export const FEEDBACK_CHANNEL_IDS = ['ingest', 'github', 'email', 'file'];
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Feedback submit-ladder shared contract — PRI-613 Schema→Type→Validator pilot.
3
+ *
4
+ * Canonical authority for the wire shapes shared by server and UI. The
5
+ * TypeBox schemas here are the single source: the server's ChannelStatus
6
+ * derives from them (type-only import), and the UI's validator data shapes
7
+ * derive via `import type` — the browser bundle must NOT import this module
8
+ * at runtime (it would bundle @sinclair/typebox, ~850KB; see
9
+ * feedback-channel-ids.ts for the runtime-safe const).
10
+ *
11
+ * UI validators (ui/utils/validators.ts) are a machine-enforced mirror:
12
+ * tests/integration/feedback-contract.test.ts asserts schema-vs-validator
13
+ * equivalence on an accept/reject matrix, so drift is CI-detectable without
14
+ * shipping typebox to the browser.
15
+ *
16
+ * Single direction: Schema → Static type. Do NOT add a parallel interface
17
+ * next to these schemas.
18
+ */
19
+ import { type Static } from '@sinclair/typebox';
20
+ export declare const FeedbackChannelStatusSchema: import("@sinclair/typebox").TObject<{
21
+ id: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"email" | "file" | "github" | "ingest">[]>;
22
+ available: import("@sinclair/typebox").TBoolean;
23
+ reason: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
24
+ nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
25
+ }>;
26
+ export type FeedbackChannelStatus = Static<typeof FeedbackChannelStatusSchema>;
27
+ export declare const FeedbackChannelsDataSchema: import("@sinclair/typebox").TObject<{
28
+ channels: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
29
+ id: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"email" | "file" | "github" | "ingest">[]>;
30
+ available: import("@sinclair/typebox").TBoolean;
31
+ reason: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
32
+ nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
33
+ }>>;
34
+ }>;
35
+ export type FeedbackChannelsData = Static<typeof FeedbackChannelsDataSchema>;
36
+ export declare const FeedbackSubmitResultSchema: import("@sinclair/typebox").TObject<{
37
+ ok: import("@sinclair/typebox").TBoolean;
38
+ alreadySubmitted: import("@sinclair/typebox").TBoolean;
39
+ status: import("@sinclair/typebox").TString;
40
+ submittedVia: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
41
+ trackingId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
42
+ externalUrl: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
43
+ writeBackFailed: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
44
+ nextAction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
45
+ }>;
46
+ export type FeedbackSubmitResult = Static<typeof FeedbackSubmitResultSchema>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Feedback submit-ladder shared contract — PRI-613 Schema→Type→Validator pilot.
3
+ *
4
+ * Canonical authority for the wire shapes shared by server and UI. The
5
+ * TypeBox schemas here are the single source: the server's ChannelStatus
6
+ * derives from them (type-only import), and the UI's validator data shapes
7
+ * derive via `import type` — the browser bundle must NOT import this module
8
+ * at runtime (it would bundle @sinclair/typebox, ~850KB; see
9
+ * feedback-channel-ids.ts for the runtime-safe const).
10
+ *
11
+ * UI validators (ui/utils/validators.ts) are a machine-enforced mirror:
12
+ * tests/integration/feedback-contract.test.ts asserts schema-vs-validator
13
+ * equivalence on an accept/reject matrix, so drift is CI-detectable without
14
+ * shipping typebox to the browser.
15
+ *
16
+ * Single direction: Schema → Static type. Do NOT add a parallel interface
17
+ * next to these schemas.
18
+ */
19
+ import { Type } from '@sinclair/typebox';
20
+ import { FEEDBACK_CHANNEL_IDS } from './feedback-channel-ids.js';
21
+ /**
22
+ * Optional explanation fields are `string | null` on the wire: absent means
23
+ * "no reason to show"; explicit null is accepted and normalized to absent by
24
+ * the UI validator (legacy readNullableString semantics).
25
+ */
26
+ const optionalNullableString = Type.Optional(Type.Union([Type.String(), Type.Null()]));
27
+ export const FeedbackChannelStatusSchema = Type.Object({
28
+ id: Type.Union(FEEDBACK_CHANNEL_IDS.map((id) => Type.Literal(id))),
29
+ available: Type.Boolean(),
30
+ reason: optionalNullableString,
31
+ nextAction: optionalNullableString,
32
+ });
33
+ export const FeedbackChannelsDataSchema = Type.Object({
34
+ channels: Type.Array(FeedbackChannelStatusSchema),
35
+ });
36
+ export const FeedbackSubmitResultSchema = Type.Object({
37
+ ok: Type.Boolean(),
38
+ alreadySubmitted: Type.Boolean(),
39
+ status: Type.String(),
40
+ submittedVia: optionalNullableString,
41
+ trackingId: optionalNullableString,
42
+ externalUrl: optionalNullableString,
43
+ writeBackFailed: Type.Optional(Type.Boolean()),
44
+ nextAction: optionalNullableString,
45
+ });