create-principles-disciple 1.82.0 → 1.83.0

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 (494) hide show
  1. package/console/dist/server/config/pd-config-store.d.ts +135 -0
  2. package/console/dist/server/config/pd-config-store.js +660 -0
  3. package/console/dist/server/index.js +40 -389
  4. package/console/dist/server/models/ActivationsConsoleModel.d.ts +33 -0
  5. package/console/dist/server/models/ActivationsConsoleModel.js +112 -0
  6. package/console/dist/server/models/ApprovalsConsoleModel.d.ts +5 -0
  7. package/console/dist/server/models/ApprovalsConsoleModel.js +14 -0
  8. package/console/dist/server/models/ApprovalsGroupedConsoleModel.d.ts +25 -0
  9. package/console/dist/server/models/ApprovalsGroupedConsoleModel.js +126 -0
  10. package/console/dist/server/models/ConsoleLifecycleDatasource.d.ts +13 -0
  11. package/console/dist/server/models/ConsoleLifecycleDatasource.js +73 -0
  12. package/console/dist/server/models/EvidenceChainConsoleModel.d.ts +58 -0
  13. package/console/dist/server/models/EvidenceChainConsoleModel.js +493 -0
  14. package/console/dist/server/models/GovernanceConsoleModel.d.ts +74 -0
  15. package/console/dist/server/models/GovernanceConsoleModel.js +246 -0
  16. package/console/dist/server/models/HealthCheckModel.d.ts +0 -4
  17. package/console/dist/server/models/HealthCheckModel.js +49 -80
  18. package/console/dist/server/models/LifecycleConsoleModel.d.ts +19 -0
  19. package/console/dist/server/models/LifecycleConsoleModel.js +55 -0
  20. package/console/dist/server/models/PrincipleClassifier.d.ts +41 -0
  21. package/console/dist/server/models/PrincipleClassifier.js +100 -0
  22. package/console/dist/server/models/PrinciplesConsoleModel.d.ts +12 -1
  23. package/console/dist/server/models/PrinciplesConsoleModel.js +53 -6
  24. package/console/dist/server/models/WorkspaceService.d.ts +2 -1
  25. package/console/dist/server/models/WorkspaceService.js +51 -23
  26. package/console/dist/server/routes/activations.d.ts +3 -0
  27. package/console/dist/server/routes/activations.js +111 -0
  28. package/console/dist/server/routes/approvals-grouped.d.ts +3 -0
  29. package/console/dist/server/routes/approvals-grouped.js +32 -0
  30. package/console/dist/server/routes/approvals.js +28 -4
  31. package/console/dist/server/routes/config.d.ts +27 -0
  32. package/console/dist/server/routes/config.js +213 -0
  33. package/console/dist/server/routes/evidence-chain.d.ts +9 -0
  34. package/console/dist/server/routes/evidence-chain.js +32 -0
  35. package/console/dist/server/routes/governance.d.ts +3 -0
  36. package/console/dist/server/routes/governance.js +32 -0
  37. package/console/dist/server/routes/{evolution.d.ts → lifecycle.d.ts} +2 -2
  38. package/console/dist/server/routes/lifecycle.js +48 -0
  39. package/console/dist/server/routes/principles.js +74 -1
  40. package/console/dist/server/routes/workspaces.js +8 -1
  41. package/console/dist/server/utils/response.d.ts +1 -1
  42. package/console/dist/server/utils/response.js +6 -2
  43. package/console/dist/types.d.ts +1 -0
  44. package/console/dist/ui/App.js +116 -40
  45. package/console/dist/ui/api.d.ts +88 -501
  46. package/console/dist/ui/api.js +139 -162
  47. package/console/dist/ui/components/approval-card.js +1 -1
  48. package/console/dist/ui/components/approval-detail-dialog.js +1 -1
  49. package/console/dist/ui/components/auth/login-form.d.ts +3 -0
  50. package/console/dist/ui/components/auth/login-form.js +36 -0
  51. package/console/dist/ui/components/auth/splash-screen.d.ts +8 -0
  52. package/console/dist/ui/components/auth/splash-screen.js +22 -0
  53. package/console/dist/ui/components/layout/app-sidebar.d.ts +1 -0
  54. package/console/dist/ui/components/layout/app-sidebar.js +56 -0
  55. package/console/dist/ui/components/layout/page-shell.d.ts +11 -0
  56. package/console/dist/ui/components/layout/page-shell.js +10 -0
  57. package/console/dist/ui/components/layout/section-title.d.ts +10 -0
  58. package/console/dist/ui/components/layout/section-title.js +9 -0
  59. package/console/dist/ui/components/theme-provider.d.ts +1 -1
  60. package/console/dist/ui/components/theme-provider.js +13 -8
  61. package/console/dist/ui/components/theme-toggle.js +2 -21
  62. package/console/dist/ui/components/ui/badge.d.ts +1 -1
  63. package/console/dist/ui/components/ui/badge.js +7 -5
  64. package/console/dist/ui/components/ui/button.d.ts +2 -2
  65. package/console/dist/ui/components/ui/button.js +12 -11
  66. package/console/dist/ui/components/ui/card.js +6 -6
  67. package/console/dist/ui/components/ui/sheet.d.ts +1 -1
  68. package/console/dist/ui/i18n/en.json +401 -343
  69. package/console/dist/ui/i18n/index.js +2 -2
  70. package/console/dist/ui/i18n/zh-CN.json +406 -348
  71. package/console/dist/ui/main.d.ts +1 -1
  72. package/console/dist/ui/main.js +1 -0
  73. package/console/dist/ui/pages/activation/ActivationPage.d.ts +1 -0
  74. package/console/dist/ui/pages/activation/ActivationPage.js +150 -0
  75. package/console/dist/ui/pages/activation/ActivationValidators.d.ts +20 -0
  76. package/console/dist/ui/pages/activation/ActivationValidators.js +156 -0
  77. package/console/dist/ui/pages/control-center/ControlCenterPage.d.ts +1 -0
  78. package/console/dist/ui/pages/control-center/ControlCenterPage.js +447 -0
  79. package/console/dist/ui/pages/debt/DebtPage.d.ts +1 -0
  80. package/console/dist/ui/pages/debt/DebtPage.js +5 -0
  81. package/console/dist/ui/pages/design-system/DesignSystemPage.d.ts +1 -0
  82. package/console/dist/ui/pages/design-system/DesignSystemPage.js +30 -0
  83. package/console/dist/ui/pages/focus/FocusPage.d.ts +1 -0
  84. package/console/dist/ui/pages/focus/FocusPage.js +265 -0
  85. package/console/dist/ui/pages/pain/PainEvidenceValidators.d.ts +59 -0
  86. package/console/dist/ui/pages/pain/PainEvidenceValidators.js +125 -0
  87. package/console/dist/ui/pages/pain/PainPage.js +136 -0
  88. package/console/dist/ui/pages/principles/PrincipleDetailPage.js +264 -0
  89. package/console/dist/ui/pages/principles/PrinciplesPage.js +244 -0
  90. package/console/dist/ui/pages/report-problem/ReportProblemPage.js +245 -0
  91. package/console/dist/ui/pages/settings/SettingsPage.d.ts +4 -0
  92. package/console/dist/ui/pages/settings/SettingsPage.js +202 -0
  93. package/console/dist/ui/pages/settings/UpdatePage.d.ts +5 -0
  94. package/console/dist/ui/pages/settings/UpdatePage.js +168 -0
  95. package/console/dist/ui/utils/control-center-helpers.d.ts +58 -0
  96. package/console/dist/ui/utils/control-center-helpers.js +152 -0
  97. package/console/dist/ui/utils/validators.d.ts +350 -0
  98. package/console/dist/ui/utils/validators.js +995 -0
  99. package/console/dist/web/assets/app.css +672 -902
  100. package/console/dist/web/assets/app.js +6404 -15347
  101. package/console/dist/web/assets/jetbrains-mono-cyrillic-400-normal-C5JECUCT.woff2 +0 -0
  102. package/console/dist/web/assets/jetbrains-mono-cyrillic-400-normal-FGCZYWMY.woff +0 -0
  103. package/console/dist/web/assets/jetbrains-mono-cyrillic-ext-400-normal-C7IFWGF6.woff2 +0 -0
  104. package/console/dist/web/assets/jetbrains-mono-cyrillic-ext-400-normal-PWXUA557.woff +0 -0
  105. package/console/dist/web/assets/jetbrains-mono-greek-400-normal-JJNQZMPZ.woff +0 -0
  106. package/console/dist/web/assets/jetbrains-mono-greek-400-normal-O7JTTR3P.woff2 +0 -0
  107. package/console/dist/web/assets/jetbrains-mono-latin-400-normal-3OOWLGQ2.woff2 +0 -0
  108. package/console/dist/web/assets/jetbrains-mono-latin-400-normal-WDD34GPP.woff +0 -0
  109. package/console/dist/web/assets/jetbrains-mono-latin-ext-400-normal-55RNMRQS.woff +0 -0
  110. package/console/dist/web/assets/jetbrains-mono-latin-ext-400-normal-JVR3IR4Z.woff2 +0 -0
  111. package/console/dist/web/assets/jetbrains-mono-vietnamese-400-normal-7ULXAK72.woff +0 -0
  112. package/console/dist/web/assets/jetbrains-mono-vietnamese-400-normal-KU7YLUPA.woff2 +0 -0
  113. package/console/package.json +2 -1
  114. package/core/dist/runtime-v2/__tests__/admission-gate.test.js +49 -0
  115. package/core/dist/runtime-v2/__tests__/admission-gate.test.js.map +1 -1
  116. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +16 -1
  117. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  118. package/core/dist/runtime-v2/__tests__/evidence-sanitizer.test.d.ts +21 -0
  119. package/core/dist/runtime-v2/__tests__/evidence-sanitizer.test.d.ts.map +1 -0
  120. package/core/dist/runtime-v2/__tests__/evidence-sanitizer.test.js +354 -0
  121. package/core/dist/runtime-v2/__tests__/evidence-sanitizer.test.js.map +1 -0
  122. package/core/dist/runtime-v2/__tests__/language-directive.test.d.ts +12 -0
  123. package/core/dist/runtime-v2/__tests__/language-directive.test.d.ts.map +1 -0
  124. package/core/dist/runtime-v2/__tests__/language-directive.test.js +162 -0
  125. package/core/dist/runtime-v2/__tests__/language-directive.test.js.map +1 -0
  126. package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js +23 -1
  127. package/core/dist/runtime-v2/__tests__/pain-signal-observability.test.js.map +1 -1
  128. package/core/dist/runtime-v2/__tests__/pain-to-principle-service.test.js +48 -3
  129. package/core/dist/runtime-v2/__tests__/pain-to-principle-service.test.js.map +1 -1
  130. package/core/dist/runtime-v2/__tests__/proven-channel-baseline.test.js +13 -1
  131. package/core/dist/runtime-v2/__tests__/proven-channel-baseline.test.js.map +1 -1
  132. package/core/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.d.ts +12 -0
  133. package/core/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.d.ts.map +1 -0
  134. package/core/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.js +194 -0
  135. package/core/dist/runtime-v2/__tests__/resolve-runtime-config-from-pd-config.test.js.map +1 -0
  136. package/core/dist/runtime-v2/__tests__/runtime-config-boundary.test.js +5 -3
  137. package/core/dist/runtime-v2/__tests__/runtime-config-boundary.test.js.map +1 -1
  138. package/core/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js +1 -0
  139. package/core/dist/runtime-v2/activation/__tests__/activation-dispatcher.test.js.map +1 -1
  140. package/core/dist/runtime-v2/activation/__tests__/approval-queue.test.js +54 -0
  141. package/core/dist/runtime-v2/activation/__tests__/approval-queue.test.js.map +1 -1
  142. package/core/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.js +15 -2
  143. package/core/dist/runtime-v2/activation/__tests__/memory-activation-state-store.test.js.map +1 -1
  144. package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js +10 -0
  145. package/core/dist/runtime-v2/activation/__tests__/prompt-activation-reader-contract.test.js.map +1 -1
  146. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js +17 -2
  147. package/core/dist/runtime-v2/activation/__tests__/sqlite-activation-state-store.test.js.map +1 -1
  148. package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js +36 -0
  149. package/core/dist/runtime-v2/activation/__tests__/sqlite-approval-store.test.js.map +1 -1
  150. package/core/dist/runtime-v2/activation/activation-dispatcher.d.ts.map +1 -1
  151. package/core/dist/runtime-v2/activation/activation-dispatcher.js +1 -1
  152. package/core/dist/runtime-v2/activation/activation-dispatcher.js.map +1 -1
  153. package/core/dist/runtime-v2/activation/activation-types.d.ts +10 -0
  154. package/core/dist/runtime-v2/activation/activation-types.d.ts.map +1 -1
  155. package/core/dist/runtime-v2/activation/activation-types.js.map +1 -1
  156. package/core/dist/runtime-v2/activation/approval-queue.d.ts +6 -0
  157. package/core/dist/runtime-v2/activation/approval-queue.d.ts.map +1 -1
  158. package/core/dist/runtime-v2/activation/approval-queue.js +3 -0
  159. package/core/dist/runtime-v2/activation/approval-queue.js.map +1 -1
  160. package/core/dist/runtime-v2/activation/memory-activation-state-store.d.ts +2 -0
  161. package/core/dist/runtime-v2/activation/memory-activation-state-store.d.ts.map +1 -1
  162. package/core/dist/runtime-v2/activation/memory-activation-state-store.js +17 -1
  163. package/core/dist/runtime-v2/activation/memory-activation-state-store.js.map +1 -1
  164. package/core/dist/runtime-v2/activation/memory-approval-store.d.ts +6 -0
  165. package/core/dist/runtime-v2/activation/memory-approval-store.d.ts.map +1 -1
  166. package/core/dist/runtime-v2/activation/memory-approval-store.js +16 -0
  167. package/core/dist/runtime-v2/activation/memory-approval-store.js.map +1 -1
  168. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js +1 -1
  169. package/core/dist/runtime-v2/activation/prompt-activation-reader-contract.js.map +1 -1
  170. package/core/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts +2 -0
  171. package/core/dist/runtime-v2/activation/sqlite-activation-state-store.d.ts.map +1 -1
  172. package/core/dist/runtime-v2/activation/sqlite-activation-state-store.js +34 -6
  173. package/core/dist/runtime-v2/activation/sqlite-activation-state-store.js.map +1 -1
  174. package/core/dist/runtime-v2/activation/sqlite-approval-store.d.ts +6 -0
  175. package/core/dist/runtime-v2/activation/sqlite-approval-store.d.ts.map +1 -1
  176. package/core/dist/runtime-v2/activation/sqlite-approval-store.js +10 -0
  177. package/core/dist/runtime-v2/activation/sqlite-approval-store.js.map +1 -1
  178. package/core/dist/runtime-v2/adapter/__tests__/json-extractor.test.js +51 -1
  179. package/core/dist/runtime-v2/adapter/__tests__/json-extractor.test.js.map +1 -1
  180. package/core/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.js +145 -0
  181. package/core/dist/runtime-v2/adapter/__tests__/openclaw-cli-runtime-adapter.test.js.map +1 -1
  182. package/core/dist/runtime-v2/adapter/json-extractor.d.ts +13 -0
  183. package/core/dist/runtime-v2/adapter/json-extractor.d.ts.map +1 -1
  184. package/core/dist/runtime-v2/adapter/json-extractor.js +103 -0
  185. package/core/dist/runtime-v2/adapter/json-extractor.js.map +1 -1
  186. package/core/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.d.ts +4 -2
  187. package/core/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.d.ts.map +1 -1
  188. package/core/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.js +57 -5
  189. package/core/dist/runtime-v2/adapter/openclaw-cli-runtime-adapter.js.map +1 -1
  190. package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.d.ts +18 -0
  191. package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.d.ts.map +1 -0
  192. package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js +633 -0
  193. package/core/dist/runtime-v2/config/__tests__/pd-config-agent-binding.test.js.map +1 -0
  194. package/core/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js +92 -0
  195. package/core/dist/runtime-v2/config/__tests__/pd-config-validation-edge-cases.test.js.map +1 -1
  196. package/core/dist/runtime-v2/config/index.d.ts +3 -1
  197. package/core/dist/runtime-v2/config/index.d.ts.map +1 -1
  198. package/core/dist/runtime-v2/config/index.js +1 -0
  199. package/core/dist/runtime-v2/config/index.js.map +1 -1
  200. package/core/dist/runtime-v2/config/pd-config-agent-binding.d.ts +93 -0
  201. package/core/dist/runtime-v2/config/pd-config-agent-binding.d.ts.map +1 -0
  202. package/core/dist/runtime-v2/config/pd-config-agent-binding.js +184 -0
  203. package/core/dist/runtime-v2/config/pd-config-agent-binding.js.map +1 -0
  204. package/core/dist/runtime-v2/config/pd-config-defaults.d.ts.map +1 -1
  205. package/core/dist/runtime-v2/config/pd-config-defaults.js +2 -0
  206. package/core/dist/runtime-v2/config/pd-config-defaults.js.map +1 -1
  207. package/core/dist/runtime-v2/config/pd-config-effective.d.ts.map +1 -1
  208. package/core/dist/runtime-v2/config/pd-config-effective.js +3 -0
  209. package/core/dist/runtime-v2/config/pd-config-effective.js.map +1 -1
  210. package/core/dist/runtime-v2/config/pd-config-types.d.ts +8 -0
  211. package/core/dist/runtime-v2/config/pd-config-types.d.ts.map +1 -1
  212. package/core/dist/runtime-v2/config/pd-config-types.js.map +1 -1
  213. package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-language.test.d.ts +13 -0
  214. package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-language.test.d.ts.map +1 -0
  215. package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-language.test.js +97 -0
  216. package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-language.test.js.map +1 -0
  217. package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts +3 -2
  218. package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts.map +1 -1
  219. package/core/dist/runtime-v2/diagnostician-prompt-builder.js +6 -4
  220. package/core/dist/runtime-v2/diagnostician-prompt-builder.js.map +1 -1
  221. package/core/dist/runtime-v2/evidence-sanitizer.d.ts +57 -0
  222. package/core/dist/runtime-v2/evidence-sanitizer.d.ts.map +1 -0
  223. package/core/dist/runtime-v2/evidence-sanitizer.js +213 -0
  224. package/core/dist/runtime-v2/evidence-sanitizer.js.map +1 -0
  225. package/core/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.d.ts +7 -0
  226. package/core/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.d.ts.map +1 -0
  227. package/core/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.js +170 -0
  228. package/core/dist/runtime-v2/evidence-triage/__tests__/admission-events.test.js.map +1 -0
  229. package/core/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.d.ts +18 -0
  230. package/core/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.d.ts.map +1 -0
  231. package/core/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.js +277 -0
  232. package/core/dist/runtime-v2/evidence-triage/__tests__/source-descriptors.test.js.map +1 -0
  233. package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.d.ts +13 -0
  234. package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.d.ts.map +1 -0
  235. package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js +264 -0
  236. package/core/dist/runtime-v2/evidence-triage/__tests__/triage-policy.test.js.map +1 -0
  237. package/core/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.d.ts +16 -0
  238. package/core/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.d.ts.map +1 -0
  239. package/core/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.js +316 -0
  240. package/core/dist/runtime-v2/evidence-triage/__tests__/trigger-controller.test.js.map +1 -0
  241. package/core/dist/runtime-v2/evidence-triage/admission-events.d.ts +126 -0
  242. package/core/dist/runtime-v2/evidence-triage/admission-events.d.ts.map +1 -0
  243. package/core/dist/runtime-v2/evidence-triage/admission-events.js +159 -0
  244. package/core/dist/runtime-v2/evidence-triage/admission-events.js.map +1 -0
  245. package/core/dist/runtime-v2/evidence-triage/index.d.ts +16 -0
  246. package/core/dist/runtime-v2/evidence-triage/index.d.ts.map +1 -0
  247. package/core/dist/runtime-v2/evidence-triage/index.js +13 -0
  248. package/core/dist/runtime-v2/evidence-triage/index.js.map +1 -0
  249. package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts +48 -0
  250. package/core/dist/runtime-v2/evidence-triage/source-descriptors.d.ts.map +1 -0
  251. package/core/dist/runtime-v2/evidence-triage/source-descriptors.js +131 -0
  252. package/core/dist/runtime-v2/evidence-triage/source-descriptors.js.map +1 -0
  253. package/core/dist/runtime-v2/evidence-triage/triage-policy.d.ts +32 -0
  254. package/core/dist/runtime-v2/evidence-triage/triage-policy.d.ts.map +1 -0
  255. package/core/dist/runtime-v2/evidence-triage/triage-policy.js +95 -0
  256. package/core/dist/runtime-v2/evidence-triage/triage-policy.js.map +1 -0
  257. package/core/dist/runtime-v2/evidence-triage/trigger-controller.d.ts +116 -0
  258. package/core/dist/runtime-v2/evidence-triage/trigger-controller.d.ts.map +1 -0
  259. package/core/dist/runtime-v2/evidence-triage/trigger-controller.js +218 -0
  260. package/core/dist/runtime-v2/evidence-triage/trigger-controller.js.map +1 -0
  261. package/core/dist/runtime-v2/evidence-triage/types.d.ts +65 -0
  262. package/core/dist/runtime-v2/evidence-triage/types.d.ts.map +1 -0
  263. package/core/dist/runtime-v2/evidence-triage/types.js +38 -0
  264. package/core/dist/runtime-v2/evidence-triage/types.js.map +1 -0
  265. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js +10 -0
  266. package/core/dist/runtime-v2/feature-flags/__tests__/feature-flag-contract.test.js.map +1 -1
  267. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.d.ts.map +1 -1
  268. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js +1 -0
  269. package/core/dist/runtime-v2/feature-flags/feature-flag-contract.js.map +1 -1
  270. package/core/dist/runtime-v2/index.d.ts +8 -1
  271. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  272. package/core/dist/runtime-v2/index.js +7 -1
  273. package/core/dist/runtime-v2/index.js.map +1 -1
  274. package/core/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.d.ts +12 -0
  275. package/core/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.d.ts.map +1 -0
  276. package/core/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.js +83 -0
  277. package/core/dist/runtime-v2/internalization/__tests__/scribe-prompt-language.test.js.map +1 -0
  278. package/core/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts +10 -0
  279. package/core/dist/runtime-v2/internalization/scribe-prompt-builder.d.ts.map +1 -1
  280. package/core/dist/runtime-v2/internalization/scribe-prompt-builder.js +13 -1
  281. package/core/dist/runtime-v2/internalization/scribe-prompt-builder.js.map +1 -1
  282. package/core/dist/runtime-v2/internalization/scribe-runner.d.ts +3 -0
  283. package/core/dist/runtime-v2/internalization/scribe-runner.d.ts.map +1 -1
  284. package/core/dist/runtime-v2/internalization/scribe-runner.js +2 -0
  285. package/core/dist/runtime-v2/internalization/scribe-runner.js.map +1 -1
  286. package/core/dist/runtime-v2/internalization-chain-integrity-read-model.js +1 -1
  287. package/core/dist/runtime-v2/internalization-chain-integrity-read-model.js.map +1 -1
  288. package/core/dist/runtime-v2/language-directive.d.ts +80 -0
  289. package/core/dist/runtime-v2/language-directive.d.ts.map +1 -0
  290. package/core/dist/runtime-v2/language-directive.js +108 -0
  291. package/core/dist/runtime-v2/language-directive.js.map +1 -0
  292. package/core/dist/runtime-v2/pain-signal-observability.d.ts.map +1 -1
  293. package/core/dist/runtime-v2/pain-signal-observability.js +24 -11
  294. package/core/dist/runtime-v2/pain-signal-observability.js.map +1 -1
  295. package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts +16 -0
  296. package/core/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -1
  297. package/core/dist/runtime-v2/pain-signal-runtime-factory.js +97 -6
  298. package/core/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
  299. package/core/dist/runtime-v2/pain-to-principle-service.d.ts +7 -0
  300. package/core/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
  301. package/core/dist/runtime-v2/pain-to-principle-service.js +2 -0
  302. package/core/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
  303. package/core/dist/runtime-v2/proven-channel-baseline.d.ts.map +1 -1
  304. package/core/dist/runtime-v2/proven-channel-baseline.js +14 -0
  305. package/core/dist/runtime-v2/proven-channel-baseline.js.map +1 -1
  306. package/core/dist/runtime-v2/runner/__tests__/diagnostician-runner.test.js +40 -0
  307. package/core/dist/runtime-v2/runner/__tests__/diagnostician-runner.test.js.map +1 -1
  308. package/core/dist/runtime-v2/runner/base-peer-runner.d.ts.map +1 -1
  309. package/core/dist/runtime-v2/runner/base-peer-runner.js +1 -0
  310. package/core/dist/runtime-v2/runner/base-peer-runner.js.map +1 -1
  311. package/core/dist/runtime-v2/runner/diagnostician-runner-options.d.ts +10 -0
  312. package/core/dist/runtime-v2/runner/diagnostician-runner-options.d.ts.map +1 -1
  313. package/core/dist/runtime-v2/runner/diagnostician-runner-options.js +1 -0
  314. package/core/dist/runtime-v2/runner/diagnostician-runner-options.js.map +1 -1
  315. package/core/dist/runtime-v2/runner/diagnostician-runner.d.ts.map +1 -1
  316. package/core/dist/runtime-v2/runner/diagnostician-runner.js +28 -4
  317. package/core/dist/runtime-v2/runner/diagnostician-runner.js.map +1 -1
  318. package/core/dist/runtime-v2/runner/peer-runner-types.d.ts +9 -0
  319. package/core/dist/runtime-v2/runner/peer-runner-types.d.ts.map +1 -1
  320. package/core/dist/runtime-v2/store/runtime-state-manager.d.ts.map +1 -1
  321. package/core/dist/runtime-v2/store/runtime-state-manager.integration.test.js +34 -1
  322. package/core/dist/runtime-v2/store/runtime-state-manager.integration.test.js.map +1 -1
  323. package/core/dist/runtime-v2/store/runtime-state-manager.js +1 -0
  324. package/core/dist/runtime-v2/store/runtime-state-manager.js.map +1 -1
  325. package/core/dist/runtime-v2/store/sqlite-connection.d.ts.map +1 -1
  326. package/core/dist/runtime-v2/store/sqlite-connection.js +9 -1
  327. package/core/dist/runtime-v2/store/sqlite-connection.js.map +1 -1
  328. package/core/dist/runtime-v2/store/task/sqlite-task-store.js +1 -1
  329. package/core/dist/runtime-v2/store/task/sqlite-task-store.js.map +1 -1
  330. package/core/dist/runtime-v2/task-status.d.ts +4 -4
  331. package/core/dist/runtime-v2/task-status.d.ts.map +1 -1
  332. package/core/dist/runtime-v2/task-status.js +2 -2
  333. package/core/dist/runtime-v2/task-status.js.map +1 -1
  334. package/core/package.json +1 -1
  335. package/package.json +2 -2
  336. package/pd-cli/dist/commands/console.d.ts +2 -0
  337. package/pd-cli/dist/commands/console.d.ts.map +1 -1
  338. package/pd-cli/dist/commands/console.js +6 -1
  339. package/pd-cli/dist/commands/console.js.map +1 -1
  340. package/pd-cli/dist/commands/diagnose.d.ts.map +1 -1
  341. package/pd-cli/dist/commands/diagnose.js +18 -1
  342. package/pd-cli/dist/commands/diagnose.js.map +1 -1
  343. package/pd-cli/dist/commands/pain-evidence.d.ts +41 -0
  344. package/pd-cli/dist/commands/pain-evidence.d.ts.map +1 -0
  345. package/pd-cli/dist/commands/pain-evidence.js +177 -0
  346. package/pd-cli/dist/commands/pain-evidence.js.map +1 -0
  347. package/pd-cli/dist/commands/pain-record.d.ts.map +1 -1
  348. package/pd-cli/dist/commands/pain-record.js +24 -9
  349. package/pd-cli/dist/commands/pain-record.js.map +1 -1
  350. package/pd-cli/dist/commands/pain-retry.d.ts +19 -0
  351. package/pd-cli/dist/commands/pain-retry.d.ts.map +1 -0
  352. package/pd-cli/dist/commands/pain-retry.js +485 -0
  353. package/pd-cli/dist/commands/pain-retry.js.map +1 -0
  354. package/pd-cli/dist/commands/runtime-internalization-run-once.d.ts.map +1 -1
  355. package/pd-cli/dist/commands/runtime-internalization-run-once.js +59 -9
  356. package/pd-cli/dist/commands/runtime-internalization-run-once.js.map +1 -1
  357. package/pd-cli/dist/commands/runtime-uat.d.ts +1 -0
  358. package/pd-cli/dist/commands/runtime-uat.d.ts.map +1 -1
  359. package/pd-cli/dist/commands/runtime-uat.guard.test.d.ts +2 -0
  360. package/pd-cli/dist/commands/runtime-uat.guard.test.d.ts.map +1 -0
  361. package/pd-cli/dist/commands/runtime-uat.guard.test.js +155 -0
  362. package/pd-cli/dist/commands/runtime-uat.guard.test.js.map +1 -0
  363. package/pd-cli/dist/commands/runtime-uat.js +29 -3
  364. package/pd-cli/dist/commands/runtime-uat.js.map +1 -1
  365. package/pd-cli/dist/config-reader.d.ts +25 -0
  366. package/pd-cli/dist/config-reader.d.ts.map +1 -0
  367. package/pd-cli/dist/config-reader.js +109 -0
  368. package/pd-cli/dist/config-reader.js.map +1 -0
  369. package/pd-cli/dist/index.js +40 -5
  370. package/pd-cli/dist/index.js.map +1 -1
  371. package/pd-cli/dist/services/console-launcher.d.ts.map +1 -1
  372. package/pd-cli/dist/services/console-launcher.js +29 -15
  373. package/pd-cli/dist/services/console-launcher.js.map +1 -1
  374. package/pd-cli/dist/services/demo-story-a-runner.d.ts.map +1 -1
  375. package/pd-cli/dist/services/demo-story-a-runner.js +1 -0
  376. package/pd-cli/dist/services/demo-story-a-runner.js.map +1 -1
  377. package/pd-cli/dist/utils/production-workspace-guard.d.ts +77 -0
  378. package/pd-cli/dist/utils/production-workspace-guard.d.ts.map +1 -0
  379. package/pd-cli/dist/utils/production-workspace-guard.js +170 -0
  380. package/pd-cli/dist/utils/production-workspace-guard.js.map +1 -0
  381. package/pd-cli/dist/utils/production-workspace-guard.test.d.ts +2 -0
  382. package/pd-cli/dist/utils/production-workspace-guard.test.d.ts.map +1 -0
  383. package/pd-cli/dist/utils/production-workspace-guard.test.js +95 -0
  384. package/pd-cli/dist/utils/production-workspace-guard.test.js.map +1 -0
  385. package/pd-cli/package.json +1 -1
  386. package/plugin/dist/commands/pain.js +27 -2
  387. package/plugin/dist/core/pain-diagnostic-gate.d.ts +6 -0
  388. package/plugin/dist/core/pain-diagnostic-gate.js +9 -0
  389. package/plugin/dist/hooks/after-tool-call-helpers.d.ts +90 -0
  390. package/plugin/dist/hooks/after-tool-call-helpers.js +486 -0
  391. package/plugin/dist/hooks/after-tool-call-types.d.ts +92 -0
  392. package/plugin/dist/hooks/after-tool-call-types.js +13 -0
  393. package/plugin/dist/hooks/gate-block-helper.js +73 -29
  394. package/plugin/dist/hooks/llm.js +49 -29
  395. package/plugin/dist/hooks/message-sanitize.d.ts +21 -0
  396. package/plugin/dist/hooks/message-sanitize.js +30 -0
  397. package/plugin/dist/hooks/pain.d.ts +26 -3
  398. package/plugin/dist/hooks/pain.js +165 -425
  399. package/plugin/dist/hooks/prompt.js +3 -2
  400. package/plugin/dist/hooks/trajectory-evidence.d.ts +11 -0
  401. package/plugin/dist/hooks/trajectory-evidence.js +65 -0
  402. package/plugin/dist/hooks/triage-adapter.d.ts +82 -0
  403. package/plugin/dist/hooks/triage-adapter.js +121 -0
  404. package/console/dist/server/models/EventLogReadModel.d.ts +0 -33
  405. package/console/dist/server/models/EventLogReadModel.js +0 -218
  406. package/console/dist/server/models/EvolutionConsoleModel.d.ts +0 -79
  407. package/console/dist/server/models/EvolutionConsoleModel.js +0 -179
  408. package/console/dist/server/models/FeedbackConsoleModel.d.ts +0 -38
  409. package/console/dist/server/models/FeedbackConsoleModel.js +0 -129
  410. package/console/dist/server/models/GateConsoleModel.d.ts +0 -50
  411. package/console/dist/server/models/GateConsoleModel.js +0 -151
  412. package/console/dist/server/models/OverviewConsoleModel.d.ts +0 -22
  413. package/console/dist/server/models/OverviewConsoleModel.js +0 -202
  414. package/console/dist/server/models/PipelineStatsModel.d.ts +0 -35
  415. package/console/dist/server/models/PipelineStatsModel.js +0 -129
  416. package/console/dist/server/models/SampleConsoleModel.d.ts +0 -21
  417. package/console/dist/server/models/SampleConsoleModel.js +0 -188
  418. package/console/dist/server/models/ThinkingModelsConsoleModel.d.ts +0 -22
  419. package/console/dist/server/models/ThinkingModelsConsoleModel.js +0 -75
  420. package/console/dist/server/routes/agents.d.ts +0 -3
  421. package/console/dist/server/routes/agents.js +0 -442
  422. package/console/dist/server/routes/central.d.ts +0 -5
  423. package/console/dist/server/routes/central.js +0 -31
  424. package/console/dist/server/routes/events.d.ts +0 -10
  425. package/console/dist/server/routes/events.js +0 -99
  426. package/console/dist/server/routes/evolution.js +0 -73
  427. package/console/dist/server/routes/feedback.d.ts +0 -3
  428. package/console/dist/server/routes/feedback.js +0 -65
  429. package/console/dist/server/routes/gates.d.ts +0 -3
  430. package/console/dist/server/routes/gates.js +0 -52
  431. package/console/dist/server/routes/overview.d.ts +0 -3
  432. package/console/dist/server/routes/overview.js +0 -49
  433. package/console/dist/server/routes/pipeline.d.ts +0 -3
  434. package/console/dist/server/routes/pipeline.js +0 -33
  435. package/console/dist/server/routes/samples.d.ts +0 -3
  436. package/console/dist/server/routes/samples.js +0 -101
  437. package/console/dist/server/routes/thinking-models.d.ts +0 -3
  438. package/console/dist/server/routes/thinking-models.js +0 -54
  439. package/console/dist/ui/components/app-sidebar.d.ts +0 -7
  440. package/console/dist/ui/components/app-sidebar.js +0 -75
  441. package/console/dist/ui/components/compare-view.d.ts +0 -7
  442. package/console/dist/ui/components/compare-view.js +0 -32
  443. package/console/dist/ui/components/data-freshness-indicator.d.ts +0 -10
  444. package/console/dist/ui/components/data-freshness-indicator.js +0 -63
  445. package/console/dist/ui/components/health-diagnostic-card.d.ts +0 -15
  446. package/console/dist/ui/components/health-diagnostic-card.js +0 -42
  447. package/console/dist/ui/components/page-header.d.ts +0 -10
  448. package/console/dist/ui/components/page-header.js +0 -37
  449. package/console/dist/ui/hooks/useAutoRefresh.d.ts +0 -13
  450. package/console/dist/ui/hooks/useAutoRefresh.js +0 -64
  451. package/console/dist/ui/hooks/useBookmarks.d.ts +0 -6
  452. package/console/dist/ui/hooks/useBookmarks.js +0 -43
  453. package/console/dist/ui/hooks/useDebounce.d.ts +0 -2
  454. package/console/dist/ui/hooks/useDebounce.js +0 -32
  455. package/console/dist/ui/hooks/useKeyboardNavigation.d.ts +0 -14
  456. package/console/dist/ui/hooks/useKeyboardNavigation.js +0 -75
  457. package/console/dist/ui/pages/AgentsPage.d.ts +0 -1
  458. package/console/dist/ui/pages/AgentsPage.js +0 -167
  459. package/console/dist/ui/pages/ApprovalsPage.d.ts +0 -1
  460. package/console/dist/ui/pages/ApprovalsPage.js +0 -123
  461. package/console/dist/ui/pages/CentralPage.d.ts +0 -1
  462. package/console/dist/ui/pages/CentralPage.js +0 -57
  463. package/console/dist/ui/pages/DataFlowPage.d.ts +0 -1
  464. package/console/dist/ui/pages/DataFlowPage.js +0 -158
  465. package/console/dist/ui/pages/EventLogPage.d.ts +0 -1
  466. package/console/dist/ui/pages/EventLogPage.js +0 -176
  467. package/console/dist/ui/pages/EvolutionPage.d.ts +0 -1
  468. package/console/dist/ui/pages/EvolutionPage.js +0 -118
  469. package/console/dist/ui/pages/FeedbackPage.d.ts +0 -1
  470. package/console/dist/ui/pages/FeedbackPage.js +0 -46
  471. package/console/dist/ui/pages/GatesPage.d.ts +0 -1
  472. package/console/dist/ui/pages/GatesPage.js +0 -31
  473. package/console/dist/ui/pages/LoginPage.d.ts +0 -5
  474. package/console/dist/ui/pages/LoginPage.js +0 -39
  475. package/console/dist/ui/pages/OverviewPage.d.ts +0 -1
  476. package/console/dist/ui/pages/OverviewPage.js +0 -50
  477. package/console/dist/ui/pages/PainPage.js +0 -50
  478. package/console/dist/ui/pages/PrincipleDetailPage.js +0 -145
  479. package/console/dist/ui/pages/PrinciplesPage.js +0 -322
  480. package/console/dist/ui/pages/ReportProblemPage.js +0 -186
  481. package/console/dist/ui/pages/SamplesPage.d.ts +0 -1
  482. package/console/dist/ui/pages/SamplesPage.js +0 -105
  483. package/console/dist/ui/pages/SettingsPage.d.ts +0 -1
  484. package/console/dist/ui/pages/SettingsPage.js +0 -86
  485. package/console/dist/ui/pages/TasksPage.d.ts +0 -1
  486. package/console/dist/ui/pages/TasksPage.js +0 -373
  487. package/console/dist/ui/pages/ThinkingModelsPage.d.ts +0 -1
  488. package/console/dist/ui/pages/ThinkingModelsPage.js +0 -32
  489. package/console/dist/ui/pages/UpdatePage.d.ts +0 -1
  490. package/console/dist/ui/pages/UpdatePage.js +0 -142
  491. /package/console/dist/ui/pages/{PainPage.d.ts → pain/PainPage.d.ts} +0 -0
  492. /package/console/dist/ui/pages/{PrincipleDetailPage.d.ts → principles/PrincipleDetailPage.d.ts} +0 -0
  493. /package/console/dist/ui/pages/{PrinciplesPage.d.ts → principles/PrinciplesPage.d.ts} +0 -0
  494. /package/console/dist/ui/pages/{ReportProblemPage.d.ts → report-problem/ReportProblemPage.d.ts} +0 -0
@@ -0,0 +1,168 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect, useCallback } from "react";
3
+ import { useTranslation } from "react-i18next";
4
+ import { toast } from "sonner";
5
+ import { PageShell } from "../../components/layout/page-shell.js";
6
+ import { SectionTitle } from "../../components/layout/section-title.js";
7
+ import { fetchUpdateStatus, fetchUpdateHistory, } from "../../api.js";
8
+ // ── Runtime validators (H section / ERR-001/005/009/013) ─────────────────────
9
+ /** Type guard: is this a non-null object with own properties (not inherited)? */
10
+ function isRecord(value) {
11
+ return typeof value === "object" && value !== null && !Array.isArray(value);
12
+ }
13
+ export function validateUpdateStatusData(raw) {
14
+ if (!isRecord(raw))
15
+ return null;
16
+ if (!Object.hasOwn(raw, "currentVersion") ||
17
+ !Object.hasOwn(raw, "latestVersion") ||
18
+ !Object.hasOwn(raw, "updateAvailable") ||
19
+ !Object.hasOwn(raw, "lastChecked")) {
20
+ return null;
21
+ }
22
+ const currentVersion = raw.currentVersion;
23
+ const latestVersion = raw.latestVersion;
24
+ const updateAvailable = raw.updateAvailable;
25
+ const lastChecked = raw.lastChecked;
26
+ if (typeof currentVersion !== "string" ||
27
+ typeof latestVersion !== "string" ||
28
+ typeof updateAvailable !== "boolean" ||
29
+ typeof lastChecked !== "string") {
30
+ return null;
31
+ }
32
+ return { currentVersion, latestVersion, updateAvailable, lastChecked };
33
+ }
34
+ export function validateUpdateHistoryEntry(raw) {
35
+ if (!isRecord(raw))
36
+ return null;
37
+ if (!Object.hasOwn(raw, "version") ||
38
+ !Object.hasOwn(raw, "appliedAt") ||
39
+ !Object.hasOwn(raw, "notes")) {
40
+ return null;
41
+ }
42
+ const version = raw.version;
43
+ const appliedAt = raw.appliedAt;
44
+ const notes = raw.notes;
45
+ if (typeof version !== "string" ||
46
+ typeof appliedAt !== "string" ||
47
+ typeof notes !== "string") {
48
+ return null;
49
+ }
50
+ return { version, appliedAt, notes };
51
+ }
52
+ export function validateUpdateHistoryData(raw) {
53
+ if (!isRecord(raw))
54
+ return null;
55
+ if (!Object.hasOwn(raw, "updates")) {
56
+ return null;
57
+ }
58
+ const updates = raw.updates;
59
+ if (!Array.isArray(updates)) {
60
+ return null;
61
+ }
62
+ // Fail loud: any invalid entry rejects the entire payload (ERR-009)
63
+ const validatedEntries = [];
64
+ for (const entry of updates) {
65
+ const validated = validateUpdateHistoryEntry(entry);
66
+ if (validated === null)
67
+ return null;
68
+ validatedEntries.push(validated);
69
+ }
70
+ return { updates: validatedEntries };
71
+ }
72
+ // ── Helper: format ISO date string to locale-aware display ────────────────────
73
+ function formatDate(isoString, locale) {
74
+ try {
75
+ const date = new Date(isoString);
76
+ if (Number.isNaN(date.getTime()))
77
+ return isoString;
78
+ return date.toLocaleDateString(locale, {
79
+ year: "numeric",
80
+ month: "short",
81
+ day: "numeric",
82
+ hour: "2-digit",
83
+ minute: "2-digit",
84
+ });
85
+ }
86
+ catch {
87
+ return isoString;
88
+ }
89
+ }
90
+ export function UpdatePage() {
91
+ const { t, i18n } = useTranslation();
92
+ const [statusData, setStatusData] = useState(null);
93
+ const [historyData, setHistoryData] = useState(null);
94
+ const [loadingState, setLoadingState] = useState("loading");
95
+ const [checking, setChecking] = useState(false);
96
+ const [errorMessage, setErrorMessage] = useState(null);
97
+ const [historyErrorReason, setHistoryErrorReason] = useState(null);
98
+ const locale = i18n.language === "zh-CN" ? "zh-CN" : "en-US";
99
+ const loadData = useCallback(async () => {
100
+ setLoadingState("loading");
101
+ setErrorMessage(null);
102
+ setHistoryErrorReason(null);
103
+ const [statusResult, historyResult] = await Promise.all([
104
+ fetchUpdateStatus(),
105
+ fetchUpdateHistory(),
106
+ ]);
107
+ // Validate status data (H section / ERR-001/005)
108
+ if (!statusResult.success) {
109
+ setLoadingState("error");
110
+ setErrorMessage(statusResult.error);
111
+ return;
112
+ }
113
+ const validatedStatus = validateUpdateStatusData(statusResult.data);
114
+ if (validatedStatus === null) {
115
+ setLoadingState("error");
116
+ setErrorMessage("Update status data has unexpected shape");
117
+ return;
118
+ }
119
+ setStatusData(validatedStatus);
120
+ // Validate history data (ERR-002: degradation with reason)
121
+ if (!historyResult.success) {
122
+ setHistoryData(null);
123
+ setHistoryErrorReason(historyResult.error ?? "Update history unavailable");
124
+ }
125
+ else {
126
+ const validatedHistory = validateUpdateHistoryData(historyResult.data);
127
+ setHistoryData(validatedHistory);
128
+ if (validatedHistory === null) {
129
+ setHistoryErrorReason("Update history data has unexpected shape");
130
+ }
131
+ }
132
+ setLoadingState("loaded");
133
+ }, []);
134
+ useEffect(() => {
135
+ loadData();
136
+ }, [loadData]);
137
+ const handleCheckForUpdates = useCallback(async () => {
138
+ setChecking(true);
139
+ const result = await fetchUpdateStatus();
140
+ if (!result.success) {
141
+ toast.error(t("pages.update.checkFailed"));
142
+ setChecking(false);
143
+ return;
144
+ }
145
+ const validated = validateUpdateStatusData(result.data);
146
+ if (validated === null) {
147
+ toast.error(t("pages.update.checkFailed"));
148
+ setChecking(false);
149
+ return;
150
+ }
151
+ setStatusData(validated);
152
+ setChecking(false);
153
+ }, [t]);
154
+ // ── Loading state ────────────────────────────────────────────────────────
155
+ if (loadingState === "loading") {
156
+ return (_jsx(PageShell, { children: _jsxs("div", { className: "text-ink-3 text-sm", role: "status", "aria-live": "polite", children: [t("common.loading"), "\u2026"] }) }));
157
+ }
158
+ // ── Error state (ERR-002: degradation with reason) ───────────────────────
159
+ if (loadingState === "error") {
160
+ return (_jsxs(PageShell, { children: [_jsx("div", { className: "font-mono text-[12px] tracking-[0.14em] text-ink-3 uppercase mb-3", children: t("pages.update.eyebrow") }), _jsx("h1", { className: "text-[29px] font-semibold tracking-tight text-ink mb-2", children: t("pages.update.title") }), _jsxs("div", { className: "mt-6 p-4 bg-panel border border-line rounded-[6px] text-ink-2 text-sm", children: [_jsx("p", { children: t("pages.update.loadError") }), errorMessage && (_jsx("p", { className: "mt-2 text-ink-4 text-[13px] font-mono", children: errorMessage }))] })] }));
161
+ }
162
+ // ── Loaded state ─────────────────────────────────────────────────────────
163
+ const isUpToDate = statusData ? !statusData.updateAvailable : true;
164
+ const lastCheckedDisplay = statusData
165
+ ? (statusData.lastChecked ? formatDate(statusData.lastChecked, locale) : t("pages.update.neverChecked"))
166
+ : t("pages.update.neverChecked");
167
+ return (_jsxs(PageShell, { children: [_jsx("div", { className: "font-mono text-[12px] tracking-[0.14em] text-ink-3 uppercase mb-3", children: t("pages.update.eyebrow") }), _jsx("h1", { className: "text-[29px] font-semibold tracking-tight text-ink mb-2", children: t("pages.update.title") }), _jsx("p", { className: "text-ink-3 text-[14px] max-w-[760px] leading-relaxed mb-7", children: t("pages.update.subtitle") }), _jsxs("section", { className: "mb-8", "aria-labelledby": "section-update-status", children: [_jsx(SectionTitle, { id: "section-update-status", children: t("pages.update.currentVersion") }), _jsxs("div", { className: "bg-panel border border-line rounded-[6px] p-5", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-ink-3 text-[13px]", children: t("pages.update.currentVersion") }), _jsx("span", { className: "font-mono text-[13px] text-ink", children: statusData?.currentVersion ?? "—" })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-ink-3 text-[13px]", children: t("pages.update.latestVersion") }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "font-mono text-[13px] text-ink", children: statusData?.latestVersion ?? "—" }), isUpToDate ? (_jsx("span", { className: "inline-flex items-center border border-green/35 text-green rounded-[2px] px-[7px] py-1 font-mono text-[11px] uppercase", children: t("pages.update.upToDate") })) : (_jsx("span", { className: "inline-flex items-center border border-amber/35 text-amber rounded-[2px] px-[7px] py-1 font-mono text-[11px] uppercase", children: t("pages.update.updateAvailable") }))] })] }), _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "text-ink-3 text-[13px]", children: t("pages.update.lastChecked") }), _jsx("span", { className: "text-ink-3 text-[13px]", children: lastCheckedDisplay })] })] }), _jsx("div", { className: "mt-5 pt-4 border-t border-line", children: _jsx("button", { type: "button", onClick: handleCheckForUpdates, disabled: checking, className: "border border-line bg-surface text-ink rounded-[3px] px-[14px] py-[6px] text-[12.5px] hover:border-line-2 transition-colors disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2", children: checking ? t("pages.update.checking") : t("pages.update.checkForUpdates") }) })] })] }), _jsxs("section", { "aria-labelledby": "section-update-history", children: [_jsx(SectionTitle, { id: "section-update-history", children: t("pages.update.history") }), historyErrorReason ? (_jsxs("div", { className: "text-ink-3 text-[13px] leading-relaxed py-3", children: [t("pages.update.loadError"), " (", historyErrorReason, ")"] })) : historyData && historyData.updates.length > 0 ? (_jsx("div", { className: "space-y-[10px]", children: historyData.updates.map((entry, index) => (_jsxs("article", { className: "bg-panel border border-line rounded-[6px] px-5 py-4", children: [_jsxs("div", { className: "flex items-center justify-between mb-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "inline-flex items-center border border-line rounded-[2px] px-[7px] py-1 font-mono text-[11px] text-ink-3 bg-surface/80 uppercase", children: t("pages.update.version") }), _jsx("span", { className: "font-mono text-[13px] text-ink", children: entry.version })] }), _jsx("span", { className: "text-ink-3 text-[13px]", children: formatDate(entry.appliedAt, locale) })] }), entry.notes && (_jsx("div", { className: "text-ink-2 text-[13px] leading-relaxed mt-1", children: entry.notes }))] }, `${entry.version}-${index}`))) })) : (_jsx("div", { className: "text-ink-3 text-[13px] leading-relaxed py-3", children: t("pages.update.noHistory") }))] })] }));
168
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Control Center Helpers — PRI-303
3
+ *
4
+ * Pure logic for the Control Center UI:
5
+ * - Readiness badge/label mapping
6
+ * - Overall readiness computation
7
+ * - Agent grouping by readiness
8
+ * - Redacted diagnostics for clipboard copy
9
+ *
10
+ * ERR entries:
11
+ * - ERR-001/ERR-005: No `as` bypasses on untrusted data
12
+ * - ERR-014/ERR-016/ERR-017: Safe serialization for diagnostics copy
13
+ * - ERR-045: ANY-segment redaction for sensitive keys
14
+ */
15
+ import type { ReadinessStatus } from '../api.js';
16
+ export interface RedactedRuntimeProfileSummary {
17
+ id: string;
18
+ type: string;
19
+ label: string;
20
+ apiKeyEnv?: string;
21
+ readiness: ReadinessStatus;
22
+ }
23
+ export interface RedactedAgentSummary {
24
+ name: string;
25
+ enabled: boolean;
26
+ runtimeProfileId: string;
27
+ runtimeProfileLabel: string;
28
+ readiness: ReadinessStatus;
29
+ }
30
+ export interface RedactedFeatureSummary {
31
+ id: string;
32
+ category: string;
33
+ enabled: boolean;
34
+ }
35
+ export interface ControlCenterDiagnostics {
36
+ version: number;
37
+ source: 'defaults' | 'user_config';
38
+ features: RedactedFeatureSummary[];
39
+ runtimeProfiles: RedactedRuntimeProfileSummary[];
40
+ defaultRuntime: string;
41
+ agents: RedactedAgentSummary[];
42
+ ui: {
43
+ diagnostics: {
44
+ mode: string;
45
+ };
46
+ };
47
+ warnings: string[];
48
+ errors?: {
49
+ path: string;
50
+ reason: string;
51
+ nextAction: string;
52
+ }[];
53
+ }
54
+ export declare function getReadinessBadgeVariant(readiness: ReadinessStatus): 'default' | 'secondary' | 'destructive' | 'outline';
55
+ export declare function getReadinessLabel(readiness: ReadinessStatus): string;
56
+ export declare function computeOverallReadiness(diag: ControlCenterDiagnostics): ReadinessStatus;
57
+ export declare function groupAgentsByReadiness(diag: ControlCenterDiagnostics): Record<ReadinessStatus, RedactedAgentSummary[]>;
58
+ export declare function redactDiagnosticsForCopy(diag: ControlCenterDiagnostics): string;
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Control Center Helpers — PRI-303
3
+ *
4
+ * Pure logic for the Control Center UI:
5
+ * - Readiness badge/label mapping
6
+ * - Overall readiness computation
7
+ * - Agent grouping by readiness
8
+ * - Redacted diagnostics for clipboard copy
9
+ *
10
+ * ERR entries:
11
+ * - ERR-001/ERR-005: No `as` bypasses on untrusted data
12
+ * - ERR-014/ERR-016/ERR-017: Safe serialization for diagnostics copy
13
+ * - ERR-045: ANY-segment redaction for sensitive keys
14
+ */
15
+ // ── Readiness Badge Variant ──────────────────────────────────────────────────
16
+ export function getReadinessBadgeVariant(readiness) {
17
+ switch (readiness) {
18
+ case 'ready': return 'default';
19
+ case 'needs_setup': return 'secondary';
20
+ case 'disabled': return 'outline';
21
+ case 'not_ready': return 'destructive';
22
+ case 'unknown': return 'secondary';
23
+ default: return 'secondary';
24
+ }
25
+ }
26
+ // ── Readiness Label ──────────────────────────────────────────────────────────
27
+ export function getReadinessLabel(readiness) {
28
+ switch (readiness) {
29
+ case 'ready': return 'Ready';
30
+ case 'needs_setup': return 'Needs Setup';
31
+ case 'disabled': return 'Disabled';
32
+ case 'not_ready': return 'Not Ready';
33
+ case 'unknown': return 'Unknown';
34
+ default: return 'Unknown';
35
+ }
36
+ }
37
+ // ── Overall Readiness ────────────────────────────────────────────────────────
38
+ export function computeOverallReadiness(diag) {
39
+ const enabledAgents = diag.agents.filter(a => a.enabled);
40
+ if (enabledAgents.length === 0) {
41
+ return diag.agents.length === 0 ? 'unknown' : 'disabled';
42
+ }
43
+ const readinessOrder = ['not_ready', 'needs_setup', 'unknown', 'disabled', 'ready'];
44
+ for (const status of readinessOrder) {
45
+ if (status === 'disabled')
46
+ continue; // disabled agents are filtered out above
47
+ if (enabledAgents.some(a => a.readiness === status)) {
48
+ return status;
49
+ }
50
+ }
51
+ return 'ready';
52
+ }
53
+ // ── Group Agents by Readiness ────────────────────────────────────────────────
54
+ export function groupAgentsByReadiness(diag) {
55
+ const groups = {
56
+ ready: [],
57
+ needs_setup: [],
58
+ disabled: [],
59
+ not_ready: [],
60
+ unknown: [],
61
+ };
62
+ for (const agent of diag.agents) {
63
+ const status = agent.readiness;
64
+ if (Object.hasOwn(groups, status)) {
65
+ groups[status].push(agent);
66
+ }
67
+ else {
68
+ groups.unknown.push(agent);
69
+ }
70
+ }
71
+ return groups;
72
+ }
73
+ // ── Redacted Diagnostics for Copy ────────────────────────────────────────────
74
+ /** Maximum items per section in diagnostics output (ERR-014/ERR-016/ERR-017) */
75
+ const MAX_ITEMS_PER_SECTION = 50;
76
+ function takeBounded(arr) {
77
+ if (arr.length <= MAX_ITEMS_PER_SECTION)
78
+ return { items: arr, truncated: 0 };
79
+ return {
80
+ items: arr.slice(0, MAX_ITEMS_PER_SECTION),
81
+ truncated: arr.length - MAX_ITEMS_PER_SECTION,
82
+ };
83
+ }
84
+ export function redactDiagnosticsForCopy(diag) {
85
+ const overall = computeOverallReadiness(diag);
86
+ const lines = [];
87
+ lines.push('=== PD Control Center Diagnostics ===');
88
+ lines.push(`Overall Status: ${getReadinessLabel(overall)}`);
89
+ lines.push(`Config Source: ${diag.source}`);
90
+ lines.push(`Config Version: ${diag.version}`);
91
+ lines.push('');
92
+ // Features
93
+ lines.push('--- Features ---');
94
+ const features = takeBounded(diag.features);
95
+ for (const f of features.items) {
96
+ lines.push(` ${f.id}: ${f.category} / ${f.enabled ? 'enabled' : 'disabled'}`);
97
+ }
98
+ if (features.truncated > 0)
99
+ lines.push(` ... +${features.truncated} more`);
100
+ lines.push('');
101
+ // Runtime Profiles (redacted)
102
+ lines.push('--- Runtime Profiles ---');
103
+ const profiles = takeBounded(diag.runtimeProfiles);
104
+ for (const p of profiles.items) {
105
+ const parts = [` ${p.id}: ${p.label} [${getReadinessLabel(p.readiness)}]`];
106
+ // apiKeyEnv is a secret-like key — redact it (ERR-045)
107
+ if (p.apiKeyEnv) {
108
+ parts.push(` apiKeyEnv: [REDACTED]`);
109
+ }
110
+ lines.push(parts.join('\n'));
111
+ }
112
+ if (profiles.truncated > 0)
113
+ lines.push(` ... +${profiles.truncated} more`);
114
+ lines.push('');
115
+ // Default Runtime
116
+ lines.push(`Default Runtime: ${diag.defaultRuntime}`);
117
+ lines.push('');
118
+ // Agents
119
+ lines.push('--- Agents ---');
120
+ const agents = takeBounded(diag.agents);
121
+ for (const a of agents.items) {
122
+ const status = a.enabled ? getReadinessLabel(a.readiness) : 'Disabled';
123
+ lines.push(` ${a.name}: ${status} (profile: ${a.runtimeProfileLabel})`);
124
+ }
125
+ if (agents.truncated > 0)
126
+ lines.push(` ... +${agents.truncated} more`);
127
+ lines.push('');
128
+ // Warnings
129
+ if (diag.warnings.length > 0) {
130
+ lines.push('--- Warnings ---');
131
+ const warnings = takeBounded(diag.warnings);
132
+ for (const w of warnings.items) {
133
+ lines.push(` - ${w}`);
134
+ }
135
+ if (warnings.truncated > 0)
136
+ lines.push(` ... +${warnings.truncated} more`);
137
+ lines.push('');
138
+ }
139
+ // Errors
140
+ if (diag.errors && diag.errors.length > 0) {
141
+ lines.push('--- Errors ---');
142
+ const errors = takeBounded(diag.errors);
143
+ for (const e of errors.items) {
144
+ lines.push(` ${e.path}: ${e.reason} → ${e.nextAction}`);
145
+ }
146
+ if (errors.truncated > 0)
147
+ lines.push(` ... +${errors.truncated} more`);
148
+ lines.push('');
149
+ }
150
+ lines.push('=== End Diagnostics ===');
151
+ return lines.join('\n');
152
+ }