create-principles-disciple 1.146.4 → 1.146.6

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 (308) hide show
  1. package/_release/product-identity.json +1 -1
  2. package/package.json +3 -3
  3. package/release-manager/package.json +3 -3
  4. package/console/dist/ui/App.d.ts +0 -1
  5. package/console/dist/ui/App.js +0 -172
  6. package/console/dist/ui/api.d.ts +0 -611
  7. package/console/dist/ui/api.js +0 -1094
  8. package/console/dist/ui/components/auth/login-form.d.ts +0 -4
  9. package/console/dist/ui/components/auth/login-form.js +0 -142
  10. package/console/dist/ui/components/auth/splash-screen.d.ts +0 -9
  11. package/console/dist/ui/components/auth/splash-screen.js +0 -22
  12. package/console/dist/ui/components/error-boundary.d.ts +0 -15
  13. package/console/dist/ui/components/error-boundary.js +0 -30
  14. package/console/dist/ui/components/focus/daily-thought-card.d.ts +0 -1
  15. package/console/dist/ui/components/focus/daily-thought-card.js +0 -41
  16. package/console/dist/ui/components/language-switcher.d.ts +0 -2
  17. package/console/dist/ui/components/language-switcher.js +0 -17
  18. package/console/dist/ui/components/layout/app-sidebar.d.ts +0 -27
  19. package/console/dist/ui/components/layout/app-sidebar.js +0 -128
  20. package/console/dist/ui/components/layout/page-loading.d.ts +0 -13
  21. package/console/dist/ui/components/layout/page-loading.js +0 -14
  22. package/console/dist/ui/components/layout/page-shell.d.ts +0 -12
  23. package/console/dist/ui/components/layout/page-shell.js +0 -11
  24. package/console/dist/ui/components/layout/section-title.d.ts +0 -10
  25. package/console/dist/ui/components/layout/section-title.js +0 -9
  26. package/console/dist/ui/components/notifications/NotificationProvider.d.ts +0 -14
  27. package/console/dist/ui/components/notifications/NotificationProvider.js +0 -136
  28. package/console/dist/ui/components/notifications/favicon-badge.d.ts +0 -3
  29. package/console/dist/ui/components/notifications/favicon-badge.js +0 -68
  30. package/console/dist/ui/components/notifications/notification-reducer.d.ts +0 -9
  31. package/console/dist/ui/components/notifications/notification-reducer.js +0 -9
  32. package/console/dist/ui/components/notifications/sound-storage.d.ts +0 -3
  33. package/console/dist/ui/components/notifications/sound-storage.js +0 -37
  34. package/console/dist/ui/components/notifications/useNotifications.d.ts +0 -1
  35. package/console/dist/ui/components/notifications/useNotifications.js +0 -9
  36. package/console/dist/ui/components/onboarding/CircuitDiagram.d.ts +0 -8
  37. package/console/dist/ui/components/onboarding/CircuitDiagram.js +0 -18
  38. package/console/dist/ui/components/onboarding/DemoResultView.d.ts +0 -22
  39. package/console/dist/ui/components/onboarding/DemoResultView.js +0 -33
  40. package/console/dist/ui/components/onboarding/SlashCommandsCard.d.ts +0 -16
  41. package/console/dist/ui/components/onboarding/SlashCommandsCard.js +0 -20
  42. package/console/dist/ui/components/onboarding/slashCommands.d.ts +0 -20
  43. package/console/dist/ui/components/onboarding/slashCommands.js +0 -22
  44. package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.d.ts +0 -6
  45. package/console/dist/ui/components/receipts/ReceiptCoverageDisclosure.js +0 -66
  46. package/console/dist/ui/components/theme-provider.d.ts +0 -14
  47. package/console/dist/ui/components/theme-provider.js +0 -40
  48. package/console/dist/ui/components/theme-toggle.d.ts +0 -2
  49. package/console/dist/ui/components/theme-toggle.js +0 -11
  50. package/console/dist/ui/components/ui/alert-dialog.d.ts +0 -20
  51. package/console/dist/ui/components/ui/alert-dialog.js +0 -26
  52. package/console/dist/ui/components/ui/badge.d.ts +0 -9
  53. package/console/dist/ui/components/ui/badge.js +0 -22
  54. package/console/dist/ui/components/ui/button.d.ts +0 -11
  55. package/console/dist/ui/components/ui/button.js +0 -34
  56. package/console/dist/ui/components/ui/card.d.ts +0 -8
  57. package/console/dist/ui/components/ui/card.js +0 -16
  58. package/console/dist/ui/components/ui/charts.d.ts +0 -51
  59. package/console/dist/ui/components/ui/charts.js +0 -72
  60. package/console/dist/ui/components/ui/dialog.d.ts +0 -19
  61. package/console/dist/ui/components/ui/dialog.js +0 -22
  62. package/console/dist/ui/components/ui/input.d.ts +0 -3
  63. package/console/dist/ui/components/ui/input.js +0 -8
  64. package/console/dist/ui/components/ui/markdown.d.ts +0 -24
  65. package/console/dist/ui/components/ui/markdown.js +0 -119
  66. package/console/dist/ui/components/ui/progress-bar.d.ts +0 -20
  67. package/console/dist/ui/components/ui/progress-bar.js +0 -38
  68. package/console/dist/ui/components/ui/select.d.ts +0 -13
  69. package/console/dist/ui/components/ui/select.js +0 -26
  70. package/console/dist/ui/components/ui/separator.d.ts +0 -3
  71. package/console/dist/ui/components/ui/separator.js +0 -6
  72. package/console/dist/ui/components/ui/sheet.d.ts +0 -25
  73. package/console/dist/ui/components/ui/sheet.js +0 -37
  74. package/console/dist/ui/components/ui/shiny-text.d.ts +0 -28
  75. package/console/dist/ui/components/ui/shiny-text.js +0 -46
  76. package/console/dist/ui/components/ui/skeleton.d.ts +0 -3
  77. package/console/dist/ui/components/ui/skeleton.js +0 -6
  78. package/console/dist/ui/components/ui/sonner.d.ts +0 -3
  79. package/console/dist/ui/components/ui/sonner.js +0 -13
  80. package/console/dist/ui/components/ui/tooltip.d.ts +0 -7
  81. package/console/dist/ui/components/ui/tooltip.js +0 -10
  82. package/console/dist/ui/data/daily-thoughts.d.ts +0 -15
  83. package/console/dist/ui/data/daily-thoughts.js +0 -164
  84. package/console/dist/ui/hooks/useNotificationSound.d.ts +0 -12
  85. package/console/dist/ui/hooks/useNotificationSound.js +0 -74
  86. package/console/dist/ui/i18n/en.json +0 -2399
  87. package/console/dist/ui/i18n/index.d.ts +0 -2
  88. package/console/dist/ui/i18n/index.js +0 -32
  89. package/console/dist/ui/i18n/zh-CN.json +0 -2399
  90. package/console/dist/ui/main.d.ts +0 -1
  91. package/console/dist/ui/main.js +0 -9
  92. package/console/dist/ui/pages/ReportProblemValidators.d.ts +0 -144
  93. package/console/dist/ui/pages/ReportProblemValidators.js +0 -418
  94. package/console/dist/ui/pages/activation/ActivationPage.d.ts +0 -1
  95. package/console/dist/ui/pages/activation/ActivationPage.js +0 -512
  96. package/console/dist/ui/pages/activation/ActivationValidators.d.ts +0 -20
  97. package/console/dist/ui/pages/activation/ActivationValidators.js +0 -160
  98. package/console/dist/ui/pages/control-center/AgentCard.d.ts +0 -31
  99. package/console/dist/ui/pages/control-center/AgentCard.js +0 -212
  100. package/console/dist/ui/pages/control-center/AgentGroup.d.ts +0 -26
  101. package/console/dist/ui/pages/control-center/AgentGroup.js +0 -38
  102. package/console/dist/ui/pages/control-center/ControlCenterPage.d.ts +0 -1
  103. package/console/dist/ui/pages/control-center/ControlCenterPage.js +0 -509
  104. package/console/dist/ui/pages/control-center/DesignGatePanel.d.ts +0 -1
  105. package/console/dist/ui/pages/control-center/DesignGatePanel.js +0 -137
  106. package/console/dist/ui/pages/control-center/RuntimeProfileManager.d.ts +0 -31
  107. package/console/dist/ui/pages/control-center/RuntimeProfileManager.js +0 -199
  108. package/console/dist/ui/pages/control-center/WorkflowDiagram.d.ts +0 -17
  109. package/console/dist/ui/pages/control-center/WorkflowDiagram.js +0 -55
  110. package/console/dist/ui/pages/debt/DebtPage.d.ts +0 -2
  111. package/console/dist/ui/pages/debt/DebtPage.js +0 -222
  112. package/console/dist/ui/pages/design-system/DesignSystemPage.d.ts +0 -2
  113. package/console/dist/ui/pages/design-system/DesignSystemPage.js +0 -30
  114. package/console/dist/ui/pages/examiner/ExaminerPage.d.ts +0 -15
  115. package/console/dist/ui/pages/examiner/ExaminerPage.js +0 -158
  116. package/console/dist/ui/pages/failed-tasks/FailedTasksPage.d.ts +0 -1
  117. package/console/dist/ui/pages/failed-tasks/FailedTasksPage.js +0 -421
  118. package/console/dist/ui/pages/focus/ApprovalSubjectReading.d.ts +0 -24
  119. package/console/dist/ui/pages/focus/ApprovalSubjectReading.js +0 -133
  120. package/console/dist/ui/pages/focus/FocusPage.d.ts +0 -123
  121. package/console/dist/ui/pages/focus/FocusPage.js +0 -567
  122. package/console/dist/ui/pages/focus/OwnerDecisionCard.d.ts +0 -9
  123. package/console/dist/ui/pages/focus/OwnerDecisionCard.js +0 -111
  124. package/console/dist/ui/pages/focus/OwnerWorkbench.d.ts +0 -19
  125. package/console/dist/ui/pages/focus/OwnerWorkbench.js +0 -75
  126. package/console/dist/ui/pages/focus/RuleCandidateBindingPanel.d.ts +0 -34
  127. package/console/dist/ui/pages/focus/RuleCandidateBindingPanel.js +0 -298
  128. package/console/dist/ui/pages/focus/focus-validation.d.ts +0 -40
  129. package/console/dist/ui/pages/focus/focus-validation.js +0 -211
  130. package/console/dist/ui/pages/intent/IntentOnboarding.d.ts +0 -67
  131. package/console/dist/ui/pages/intent/IntentOnboarding.js +0 -289
  132. package/console/dist/ui/pages/intent/IntentPage.d.ts +0 -1
  133. package/console/dist/ui/pages/intent/IntentPage.js +0 -252
  134. package/console/dist/ui/pages/pain/PainEvidenceValidators.d.ts +0 -59
  135. package/console/dist/ui/pages/pain/PainEvidenceValidators.js +0 -125
  136. package/console/dist/ui/pages/pain/PainPage.d.ts +0 -1
  137. package/console/dist/ui/pages/pain/PainPage.js +0 -420
  138. package/console/dist/ui/pages/pain/pain-card-helpers.d.ts +0 -175
  139. package/console/dist/ui/pages/pain/pain-card-helpers.js +0 -181
  140. package/console/dist/ui/pages/principles/CorePrinciplesPage.d.ts +0 -10
  141. package/console/dist/ui/pages/principles/CorePrinciplesPage.js +0 -59
  142. package/console/dist/ui/pages/principles/PrincipleDetailPage.d.ts +0 -60
  143. package/console/dist/ui/pages/principles/PrincipleDetailPage.js +0 -602
  144. package/console/dist/ui/pages/principles/PrinciplesPage.d.ts +0 -1
  145. package/console/dist/ui/pages/principles/PrinciplesPage.js +0 -327
  146. package/console/dist/ui/pages/principles/PrinciplesViewNav.d.ts +0 -8
  147. package/console/dist/ui/pages/principles/PrinciplesViewNav.js +0 -15
  148. package/console/dist/ui/pages/report-problem/ReportProblemPage.d.ts +0 -1
  149. package/console/dist/ui/pages/report-problem/ReportProblemPage.js +0 -467
  150. package/console/dist/ui/pages/settings/SettingsPage.d.ts +0 -4
  151. package/console/dist/ui/pages/settings/SettingsPage.js +0 -457
  152. package/console/dist/ui/pages/settings/UpdatePage.d.ts +0 -1
  153. package/console/dist/ui/pages/settings/UpdatePage.js +0 -215
  154. package/console/dist/ui/pages/welcome/WelcomePage.d.ts +0 -5
  155. package/console/dist/ui/pages/welcome/WelcomePage.js +0 -187
  156. package/console/dist/ui/utils/agent-metadata.d.ts +0 -71
  157. package/console/dist/ui/utils/agent-metadata.js +0 -284
  158. package/console/dist/ui/utils/approval-review.d.ts +0 -30
  159. package/console/dist/ui/utils/approval-review.js +0 -50
  160. package/console/dist/ui/utils/approval-warning-localization.d.ts +0 -34
  161. package/console/dist/ui/utils/approval-warning-localization.js +0 -148
  162. package/console/dist/ui/utils/attention-presentation.d.ts +0 -35
  163. package/console/dist/ui/utils/attention-presentation.js +0 -46
  164. package/console/dist/ui/utils/blocker-localization.d.ts +0 -23
  165. package/console/dist/ui/utils/blocker-localization.js +0 -36
  166. package/console/dist/ui/utils/control-center-helpers.d.ts +0 -79
  167. package/console/dist/ui/utils/control-center-helpers.js +0 -189
  168. package/console/dist/ui/utils/enum-labels.d.ts +0 -50
  169. package/console/dist/ui/utils/enum-labels.js +0 -171
  170. package/console/dist/ui/utils/format-date.d.ts +0 -11
  171. package/console/dist/ui/utils/format-date.js +0 -17
  172. package/console/dist/ui/utils/onboarding-state.d.ts +0 -25
  173. package/console/dist/ui/utils/onboarding-state.js +0 -77
  174. package/console/dist/ui/utils/reading-layout.d.ts +0 -20
  175. package/console/dist/ui/utils/reading-layout.js +0 -46
  176. package/console/dist/ui/utils/rule-binding-validators.d.ts +0 -13
  177. package/console/dist/ui/utils/rule-binding-validators.js +0 -188
  178. package/console/dist/ui/utils/runtime-mode.d.ts +0 -11
  179. package/console/dist/ui/utils/runtime-mode.js +0 -11
  180. package/console/dist/ui/utils/token-storage.d.ts +0 -22
  181. package/console/dist/ui/utils/token-storage.js +0 -47
  182. package/console/dist/ui/utils/validators.d.ts +0 -1178
  183. package/console/dist/ui/utils/validators.js +0 -3297
  184. package/release-manager/dist/bootstrap-entry.d.ts +0 -2
  185. package/release-manager/dist/bootstrap-entry.d.ts.map +0 -1
  186. package/release-manager/dist/bootstrap-entry.js.map +0 -1
  187. package/release-manager/dist/i18n.d.ts +0 -6
  188. package/release-manager/dist/i18n.d.ts.map +0 -1
  189. package/release-manager/dist/i18n.js.map +0 -1
  190. package/release-manager/dist/index.d.ts +0 -7
  191. package/release-manager/dist/index.d.ts.map +0 -1
  192. package/release-manager/dist/index.js +0 -656
  193. package/release-manager/dist/index.js.map +0 -1
  194. package/release-manager/dist/installer.d.ts +0 -629
  195. package/release-manager/dist/installer.d.ts.map +0 -1
  196. package/release-manager/dist/installer.js.map +0 -1
  197. package/release-manager/dist/installers/codex-host-installer.d.ts +0 -39
  198. package/release-manager/dist/installers/codex-host-installer.d.ts.map +0 -1
  199. package/release-manager/dist/installers/codex-host-installer.js.map +0 -1
  200. package/release-manager/dist/installers/index.d.ts +0 -51
  201. package/release-manager/dist/installers/index.d.ts.map +0 -1
  202. package/release-manager/dist/installers/index.js.map +0 -1
  203. package/release-manager/dist/installers/openclaw-host-installer.d.ts +0 -14
  204. package/release-manager/dist/installers/openclaw-host-installer.d.ts.map +0 -1
  205. package/release-manager/dist/installers/openclaw-host-installer.js.map +0 -1
  206. package/release-manager/dist/installers/workbuddy-host-installer.d.ts +0 -335
  207. package/release-manager/dist/installers/workbuddy-host-installer.d.ts.map +0 -1
  208. package/release-manager/dist/installers/workbuddy-host-installer.js.map +0 -1
  209. package/release-manager/dist/mvp-config.d.ts +0 -233
  210. package/release-manager/dist/mvp-config.d.ts.map +0 -1
  211. package/release-manager/dist/mvp-config.js.map +0 -1
  212. package/release-manager/dist/prompts.d.ts +0 -43
  213. package/release-manager/dist/prompts.d.ts.map +0 -1
  214. package/release-manager/dist/prompts.js +0 -268
  215. package/release-manager/dist/prompts.js.map +0 -1
  216. package/release-manager/dist/skill-language.d.ts +0 -32
  217. package/release-manager/dist/skill-language.d.ts.map +0 -1
  218. package/release-manager/dist/skill-language.js.map +0 -1
  219. package/release-manager/dist/uninstaller.d.ts +0 -68
  220. package/release-manager/dist/uninstaller.d.ts.map +0 -1
  221. package/release-manager/dist/uninstaller.js +0 -746
  222. package/release-manager/dist/uninstaller.js.map +0 -1
  223. package/release-manager/dist/update/apply-payload.d.ts +0 -143
  224. package/release-manager/dist/update/apply-payload.d.ts.map +0 -1
  225. package/release-manager/dist/update/apply-payload.js.map +0 -1
  226. package/release-manager/dist/update/atomic-file.d.ts +0 -35
  227. package/release-manager/dist/update/atomic-file.d.ts.map +0 -1
  228. package/release-manager/dist/update/atomic-file.js.map +0 -1
  229. package/release-manager/dist/update/bootstrap-executor.d.ts +0 -21
  230. package/release-manager/dist/update/bootstrap-executor.d.ts.map +0 -1
  231. package/release-manager/dist/update/bootstrap-executor.js.map +0 -1
  232. package/release-manager/dist/update/bootstrap-protocol.d.ts +0 -56
  233. package/release-manager/dist/update/bootstrap-protocol.d.ts.map +0 -1
  234. package/release-manager/dist/update/bootstrap-protocol.js.map +0 -1
  235. package/release-manager/dist/update/channel-metadata.d.ts +0 -28
  236. package/release-manager/dist/update/channel-metadata.d.ts.map +0 -1
  237. package/release-manager/dist/update/channel-metadata.js.map +0 -1
  238. package/release-manager/dist/update/channel-promotion.d.ts +0 -39
  239. package/release-manager/dist/update/channel-promotion.d.ts.map +0 -1
  240. package/release-manager/dist/update/channel-promotion.js +0 -55
  241. package/release-manager/dist/update/channel-promotion.js.map +0 -1
  242. package/release-manager/dist/update/console-surface.d.ts +0 -19
  243. package/release-manager/dist/update/console-surface.d.ts.map +0 -1
  244. package/release-manager/dist/update/console-surface.js.map +0 -1
  245. package/release-manager/dist/update/data-compatibility.d.ts +0 -35
  246. package/release-manager/dist/update/data-compatibility.d.ts.map +0 -1
  247. package/release-manager/dist/update/data-compatibility.js +0 -45
  248. package/release-manager/dist/update/data-compatibility.js.map +0 -1
  249. package/release-manager/dist/update/install-layout.d.ts +0 -105
  250. package/release-manager/dist/update/install-layout.d.ts.map +0 -1
  251. package/release-manager/dist/update/install-layout.js.map +0 -1
  252. package/release-manager/dist/update/product-identity.d.ts +0 -70
  253. package/release-manager/dist/update/product-identity.d.ts.map +0 -1
  254. package/release-manager/dist/update/product-identity.js.map +0 -1
  255. package/release-manager/dist/update/release-asset-manifest.d.ts +0 -31
  256. package/release-manager/dist/update/release-asset-manifest.d.ts.map +0 -1
  257. package/release-manager/dist/update/release-asset-manifest.js.map +0 -1
  258. package/release-manager/dist/update/release-identity.d.ts +0 -33
  259. package/release-manager/dist/update/release-identity.d.ts.map +0 -1
  260. package/release-manager/dist/update/release-identity.js.map +0 -1
  261. package/release-manager/dist/update/release-manager-authority.d.ts +0 -39
  262. package/release-manager/dist/update/release-manager-authority.d.ts.map +0 -1
  263. package/release-manager/dist/update/release-manager-authority.js.map +0 -1
  264. package/release-manager/dist/update/release-manager.d.ts +0 -156
  265. package/release-manager/dist/update/release-manager.d.ts.map +0 -1
  266. package/release-manager/dist/update/release-manager.js.map +0 -1
  267. package/release-manager/dist/update/release-metadata-publisher.d.ts +0 -199
  268. package/release-manager/dist/update/release-metadata-publisher.d.ts.map +0 -1
  269. package/release-manager/dist/update/release-metadata-publisher.js +0 -478
  270. package/release-manager/dist/update/release-metadata-publisher.js.map +0 -1
  271. package/release-manager/dist/update/release-metadata-source.d.ts +0 -85
  272. package/release-manager/dist/update/release-metadata-source.d.ts.map +0 -1
  273. package/release-manager/dist/update/release-metadata-source.js.map +0 -1
  274. package/release-manager/dist/update/release-metadata.d.ts +0 -60
  275. package/release-manager/dist/update/release-metadata.d.ts.map +0 -1
  276. package/release-manager/dist/update/release-metadata.js.map +0 -1
  277. package/release-manager/dist/update/release-policy.d.ts +0 -51
  278. package/release-manager/dist/update/release-policy.d.ts.map +0 -1
  279. package/release-manager/dist/update/release-policy.js.map +0 -1
  280. package/release-manager/dist/update/rollback-policy.d.ts +0 -56
  281. package/release-manager/dist/update/rollback-policy.d.ts.map +0 -1
  282. package/release-manager/dist/update/rollback-policy.js +0 -61
  283. package/release-manager/dist/update/rollback-policy.js.map +0 -1
  284. package/release-manager/dist/update/transaction-journal.d.ts +0 -212
  285. package/release-manager/dist/update/transaction-journal.d.ts.map +0 -1
  286. package/release-manager/dist/update/transaction-journal.js.map +0 -1
  287. package/release-manager/dist/update/trust-metadata.d.ts +0 -55
  288. package/release-manager/dist/update/trust-metadata.d.ts.map +0 -1
  289. package/release-manager/dist/update/trust-metadata.js.map +0 -1
  290. package/release-manager/dist/update/trust-root-provisioning.d.ts +0 -99
  291. package/release-manager/dist/update/trust-root-provisioning.d.ts.map +0 -1
  292. package/release-manager/dist/update/trust-root-provisioning.js.map +0 -1
  293. package/release-manager/dist/update/update-history.d.ts +0 -46
  294. package/release-manager/dist/update/update-history.d.ts.map +0 -1
  295. package/release-manager/dist/update/update-history.js +0 -123
  296. package/release-manager/dist/update/update-history.js.map +0 -1
  297. package/release-manager/dist/utils/config-file-io.d.ts +0 -34
  298. package/release-manager/dist/utils/config-file-io.d.ts.map +0 -1
  299. package/release-manager/dist/utils/config-file-io.js.map +0 -1
  300. package/release-manager/dist/utils/env.d.ts +0 -94
  301. package/release-manager/dist/utils/env.d.ts.map +0 -1
  302. package/release-manager/dist/utils/env.js.map +0 -1
  303. package/release-manager/dist/utils/logger.d.ts +0 -15
  304. package/release-manager/dist/utils/logger.d.ts.map +0 -1
  305. package/release-manager/dist/utils/logger.js.map +0 -1
  306. package/release-manager/dist/utils/workspace-divergence.d.ts +0 -36
  307. package/release-manager/dist/utils/workspace-divergence.d.ts.map +0 -1
  308. package/release-manager/dist/utils/workspace-divergence.js.map +0 -1
@@ -1,222 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } 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 { PageLoading } from "../../components/layout/page-loading.js";
7
- import { SectionTitle } from "../../components/layout/section-title.js";
8
- import { ShinyText } from "../../components/ui/shiny-text.js";
9
- import { Button } from "../../components/ui/button.js";
10
- import { AlertTriangle, Archive, Trash2 } from "lucide-react";
11
- import { fetchPrinciples, fetchAllActivations, fetchGovernanceQueue, archivePrinciple, unarchivePrinciple, disableActivation, } from "../../api.js";
12
- import { validatePrinciplesList, validateActivations, validateGovernanceQueue, } from "../../utils/validators.js";
13
- // ── Debt Card Component (Handles its own J.1 confirmation state) ──────────────
14
- function DebtCard({ item, onArchive, onDeactivate, isProcessing, }) {
15
- const { t } = useTranslation();
16
- const [confirmAction, setConfirmAction] = useState(null);
17
- const [selectedActivationId, setSelectedActivationId] = useState(null);
18
- const handleArchiveClick = () => {
19
- setConfirmAction("archive");
20
- };
21
- const handleDeactivateClick = (activationId) => {
22
- setSelectedActivationId(activationId);
23
- setConfirmAction("deactivate");
24
- };
25
- const handleCancel = () => {
26
- setConfirmAction(null);
27
- setSelectedActivationId(null);
28
- };
29
- const handleConfirm = async () => {
30
- if (confirmAction === "archive") {
31
- await onArchive(item.id);
32
- }
33
- else if (confirmAction === "deactivate" && selectedActivationId) {
34
- await onDeactivate(selectedActivationId, item.id);
35
- }
36
- setConfirmAction(null);
37
- setSelectedActivationId(null);
38
- };
39
- // Render natural language reason based on debt type
40
- const renderReason = () => {
41
- if (item.type === "never_activated") {
42
- return (_jsx("span", { className: "text-ink-2", children: t("pages.debt.reasonNeverActivated") }));
43
- }
44
- if (item.type === "stagnant") {
45
- return (_jsxs("span", { className: "text-ink-2", children: [t("pages.debt.reasonStagnant"), item.daysSince !== undefined && (_jsxs("span", { className: "text-amber font-semibold ml-1", children: ["(", t("pages.debt.daysSinceAgo", { count: item.daysSince }), ")"] }))] }));
46
- }
47
- return null;
48
- };
49
- const isStagnant = item.type === "stagnant";
50
- return (_jsx("article", { className: "p-5 bg-panel border border-line rounded-[6px] hover:border-line-2 transition-colors relative", "aria-label": t("pages.debt.principleAriaLabel", { id: item.id }), children: _jsxs("div", { className: "flex flex-col md:flex-row md:items-start gap-4", children: [_jsxs("div", { className: "flex-1 space-y-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "font-mono text-[11px] uppercase px-2 py-0.5 bg-line rounded text-ink-3", children: item.id }), _jsx("span", { className: `font-mono text-[11px] uppercase px-2 py-0.5 rounded ${isStagnant
51
- ? "bg-amber/10 text-amber"
52
- : "bg-danger/10 text-danger"}`, children: isStagnant ? t("pages.focus.summaryStagnation") : t("pages.sidebar.debt") })] }), _jsxs("div", { className: "space-y-1", children: [_jsx("p", { className: "text-ink text-[15px] font-medium leading-relaxed", children: item.text }), item.triggerPattern && (_jsxs("p", { className: "text-ink-3 text-[13px] font-mono leading-relaxed", children: [t("principles.detail.triggerLabel", { defaultValue: "Trigger:" }), " ", item.triggerPattern] }))] }), _jsxs("div", { className: "flex items-start gap-2 pt-1", children: [_jsx(AlertTriangle, { className: "w-4 h-4 text-amber shrink-0 mt-0.5", "aria-hidden": "true" }), _jsxs("div", { className: "text-[13px] leading-relaxed", children: [_jsxs("span", { className: "font-semibold text-ink-3", children: [t("pages.debt.suggestedAction"), ": "] }), renderReason()] })] })] }), _jsx("div", { className: "flex flex-col gap-2 shrink-0 md:w-48", children: !confirmAction ? (_jsxs(_Fragment, { children: [_jsxs("button", { onClick: handleArchiveClick, disabled: isProcessing, className: "w-full inline-flex items-center justify-center gap-1.5 border border-line bg-surface text-ink hover:border-line-2 transition-colors rounded-[3px] px-[14px] py-[6px] text-[12.5px] focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2", "data-testid": `archive-btn-${item.id}`, children: [_jsx(Archive, { className: "w-4 h-4 text-ink-3", "aria-hidden": "true" }), t("pages.debt.actionArchive")] }), item.activeActivationRecords && item.activeActivationRecords.length > 0 ? (item.activeActivationRecords.map((ar) => (_jsxs("button", { onClick: () => handleDeactivateClick(ar.activationId), disabled: isProcessing, className: "w-full inline-flex items-center justify-center gap-1.5 border border-danger/20 bg-surface text-danger hover:bg-danger/5 transition-colors rounded-[3px] px-[14px] py-[6px] text-[12.5px] focus-visible:outline-2 focus-visible:outline-gov focus-visible:outline-offset-2", "data-testid": `deactivate-btn-${ar.activationId}`, children: [_jsx(Trash2, { className: "w-4 h-4 text-danger/80", "aria-hidden": "true" }), t("pages.debt.actionDeactivate"), " (", ar.channel, ")"] }, ar.activationId)))) : (_jsx("button", { disabled: true, className: "w-full inline-flex items-center justify-center gap-1.5 border border-line bg-surface/50 text-ink-4 cursor-not-allowed rounded-[3px] px-[14px] py-[6px] text-[12.5px]", title: t("pages.debt.demoteTooltip"), children: t("pages.debt.actionKeep") }))] })) : (_jsxs("div", { className: "flex flex-col gap-2 p-3 bg-surface border border-amber/20 rounded-[4px] w-full", role: "alert", "data-testid": `confirm-bar-${item.id}`, children: [_jsx("p", { className: "text-ink-2 text-[12px] leading-relaxed", children: confirmAction === "archive"
53
- ? t("pages.debt.confirmArchive")
54
- : t("pages.debt.confirmDeactivate") }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { variant: "default", size: "sm", onClick: handleConfirm, disabled: isProcessing, className: "flex-1 text-[12px] py-1", "data-testid": `confirm-btn-${item.id}`, children: t("common.confirm") }), _jsx(Button, { variant: "outline", size: "sm", onClick: handleCancel, className: "flex-1 text-[12px] py-1", children: t("common.cancel") })] })] })) })] }) }));
55
- }
56
- // ── Main Page Component ──────────────────────────────────────────────────────
57
- export function DebtPage() {
58
- const { t } = useTranslation();
59
- const [loadingState, setLoadingState] = useState("loading");
60
- const [errorMessage, setErrorMessage] = useState(null);
61
- const [debtItems, setDebtItems] = useState([]);
62
- const [isProcessing, setIsProcessing] = useState(false);
63
- const loadData = useCallback(async () => {
64
- setLoadingState("loading");
65
- setErrorMessage(null);
66
- try {
67
- const [principlesRes, activationsRes, govQueueRes] = await Promise.all([
68
- fetchPrinciples("all"),
69
- fetchAllActivations(),
70
- fetchGovernanceQueue(),
71
- ]);
72
- // Handle raw response validation (EP-01 / EP-03)
73
- if (!principlesRes.success) {
74
- setLoadingState("error");
75
- setErrorMessage(principlesRes.error || "Failed to fetch principles");
76
- return;
77
- }
78
- if (!activationsRes.success) {
79
- setLoadingState("error");
80
- setErrorMessage(activationsRes.error || "Failed to fetch activations");
81
- return;
82
- }
83
- if (!govQueueRes.success) {
84
- setLoadingState("error");
85
- setErrorMessage(govQueueRes.error || "Failed to fetch governance queue");
86
- return;
87
- }
88
- const validatedPrinciples = validatePrinciplesList(principlesRes.data);
89
- const validatedActivations = validateActivations(activationsRes.data);
90
- const validatedGovQueue = validateGovernanceQueue(govQueueRes.data);
91
- if (!validatedPrinciples || !validatedActivations || !validatedGovQueue) {
92
- setLoadingState("error");
93
- setErrorMessage("Data validation failed: unexpected response shape");
94
- return;
95
- }
96
- // Filter and build the debt list (no-complexity heuristics)
97
- const allPrinciples = validatedPrinciples.principles;
98
- const allActivations = validatedActivations.activations;
99
- const stagnationSignals = validatedGovQueue.stagnationSignals;
100
- const items = [];
101
- // 1. Identify "Never Activated" Principles
102
- // An active principle with status === 'active' is never activated if it has no active activations.
103
- const activePrinciples = allPrinciples.filter((p) => p.status === "active");
104
- for (const p of activePrinciples) {
105
- const principleActivations = allActivations.filter((a) => a.principleId === p.id);
106
- const hasActiveActivation = principleActivations.some((a) => a.status === "active");
107
- if (!hasActiveActivation) {
108
- // It qualifies as never-activated debt
109
- items.push({
110
- id: p.id,
111
- text: p.text,
112
- triggerPattern: p.triggerPattern,
113
- type: "never_activated",
114
- status: p.status,
115
- activeActivationRecords: principleActivations.filter((a) => a.status === "active"),
116
- });
117
- }
118
- }
119
- // 2. Identify "Stagnant" Principle Approvals (stagnant for > 7 days)
120
- for (const signal of stagnationSignals) {
121
- // Skip if we already added it (should not overlap, but to be safe)
122
- if (items.some((item) => item.id === signal.principleId)) {
123
- continue;
124
- }
125
- const p = allPrinciples.find((p) => p.id === signal.principleId);
126
- if (p) {
127
- items.push({
128
- id: p.id,
129
- text: p.text,
130
- triggerPattern: p.triggerPattern,
131
- type: "stagnant",
132
- daysSince: signal.daysSince,
133
- status: p.status,
134
- });
135
- }
136
- }
137
- setDebtItems(items);
138
- setLoadingState("loaded");
139
- }
140
- catch (e) {
141
- setLoadingState("error");
142
- setErrorMessage(e instanceof Error ? e.message : String(e));
143
- }
144
- }, []);
145
- useEffect(() => {
146
- loadData();
147
- }, [loadData]);
148
- // Archive Action: calls POST /api/principles/:id/archive and triggers J.2 Undo toast
149
- const handleArchive = async (principleId) => {
150
- setIsProcessing(true);
151
- const result = await archivePrinciple(principleId);
152
- if (result.success) {
153
- // Remove it from the local view immediately
154
- setDebtItems((prev) => prev.filter((item) => item.id !== principleId));
155
- // J.2 Undo Toast: 5 seconds countdown action link
156
- toast.success(t("pages.debt.archiveSuccess"), {
157
- description: t("pages.activation.disableSuccessDescription", { id: principleId, defaultValue: `Principle ${principleId} archived` }),
158
- action: {
159
- label: t("pages.debt.undoAction"),
160
- onClick: async () => {
161
- const undoResult = await unarchivePrinciple(principleId);
162
- if (undoResult.success) {
163
- toast.success(t("pages.debt.undoSuccess"));
164
- loadData(); // Reload to restore the principle in list
165
- }
166
- else {
167
- toast.error(t("pages.debt.undoFailed"));
168
- }
169
- },
170
- },
171
- duration: 5000,
172
- });
173
- }
174
- else {
175
- toast.error(t("pages.debt.archiveFailed"), {
176
- description: result.error,
177
- duration: 8000,
178
- });
179
- }
180
- setIsProcessing(false);
181
- };
182
- // Deactivate Action: calls POST /api/v1/activations/:id/disable
183
- const handleDeactivate = async (activationId, principleId) => {
184
- setIsProcessing(true);
185
- const result = await disableActivation(activationId);
186
- if (result.success) {
187
- // Update local state by filtering out this deactivated record
188
- setDebtItems((prev) => prev
189
- .map((item) => {
190
- if (item.id !== principleId)
191
- return item;
192
- const updatedActivations = item.activeActivationRecords?.filter((ar) => ar.activationId !== activationId);
193
- return {
194
- ...item,
195
- activeActivationRecords: updatedActivations,
196
- };
197
- }));
198
- toast.success(t("pages.debt.deactivateSuccess"), {
199
- description: t("pages.activation.disableSuccessDescription", { id: principleId }),
200
- duration: 5000,
201
- });
202
- loadData(); // reload fresh state
203
- }
204
- else {
205
- toast.error(t("pages.debt.deactivateFailed"), {
206
- description: result.error,
207
- duration: 8000,
208
- });
209
- }
210
- setIsProcessing(false);
211
- };
212
- // ── Loading state ──────────────────────────────────────────────────────────
213
- if (loadingState === "loading") {
214
- return (_jsx(PageShell, { children: _jsx(PageLoading, { cardCount: 3, label: t("common.loading") }) }));
215
- }
216
- // ── Error state (ERR-002: degradation with explanation) ────────────────────
217
- if (loadingState === "error") {
218
- return (_jsxs(PageShell, { children: [_jsx("div", { className: "font-mono text-[12px] tracking-[0.14em] text-ink-3 uppercase mb-3", children: t("pages.debt.eyebrow") }), _jsx("h1", { className: "text-[29px] font-semibold tracking-tight text-ink mb-2", children: t("pages.debt.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.debt.loadError") }), errorMessage && (_jsx("p", { className: "mt-2 text-ink-4 text-[13px] font-mono", children: errorMessage }))] })] }));
219
- }
220
- // ── Loaded state ───────────────────────────────────────────────────────────
221
- return (_jsx(PageShell, { children: _jsxs("div", { className: "animate-[pdFadeIn_400ms_ease-out] space-y-6", children: [_jsxs("div", { children: [_jsx("div", { className: "font-mono text-[12px] tracking-[0.14em] text-ink-3 uppercase mb-3", children: t("pages.debt.eyebrow") }), _jsx(ShinyText, { as: "h1", className: "text-[29px] font-semibold tracking-tight text-ink mb-2", duration: 4.5, brightness: 0.5, disabled: debtItems.length === 0, children: t("pages.debt.title") }), _jsx("p", { className: "text-ink-3 text-[14px] max-w-[760px] leading-relaxed", children: t("pages.debt.subtitle") })] }), _jsx("section", { "aria-label": t("pages.debt.listAriaLabel"), className: "space-y-[14px]", children: debtItems.length > 0 ? (_jsxs(_Fragment, { children: [_jsxs(SectionTitle, { id: "section-debt-list", children: [t("pages.sidebar.debt"), " (", debtItems.length, ")"] }), _jsx("div", { className: "space-y-[14px]", children: debtItems.map((item) => (_jsx(DebtCard, { item: item, onArchive: handleArchive, onDeactivate: handleDeactivate, isProcessing: isProcessing }, `${item.id}-${item.type}`))) })] })) : (_jsxs("div", { className: "p-8 text-center bg-panel border border-line border-dashed rounded-[6px] space-y-3", role: "status", children: [_jsx("p", { className: "text-ink-2 font-medium text-[16px]", children: t("pages.debt.emptyTitle") }), _jsx("p", { className: "text-ink-3 text-[13px] max-w-[500px] mx-auto leading-relaxed", children: t("pages.debt.emptyDescription") })] })) })] }) }));
222
- }
@@ -1,2 +0,0 @@
1
- import * as React from "react";
2
- export declare function DesignSystemPage(): React.JSX.Element;
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button } from "../../components/ui/button.js";
3
- import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "../../components/ui/card.js";
4
- import { Badge } from "../../components/ui/badge.js";
5
- import { PageShell } from "../../components/layout/page-shell.js";
6
- import { SectionTitle } from "../../components/layout/section-title.js";
7
- /**
8
- * Design system preview page — dev-only visual regression anchor.
9
- * Renders all tokens, component states, and patterns for CR1 verification.
10
- */
11
- const LIGHT_TOKENS = [
12
- { name: "--paper", value: "#f7f3ea" },
13
- { name: "--paper-2", value: "#f2ede3" },
14
- { name: "--surface", value: "#fbf8f0" },
15
- { name: "--panel", value: "#fffdf7" },
16
- { name: "--ink", value: "#1f2933" },
17
- { name: "--ink-2", value: "#384150" },
18
- { name: "--ink-3", value: "#525966" },
19
- { name: "--ink-4", value: "#5F6774" },
20
- { name: "--line", value: "#d7d1c4" },
21
- { name: "--line-2", value: "#c7bfaf" },
22
- { name: "--gov", value: "#1e3a5f" },
23
- { name: "--gov-2", value: "#2f557f" },
24
- { name: "--amber", value: "#a66a2a" },
25
- { name: "--green", value: "#4d6b52" },
26
- { name: "--danger", value: "#8b3a3a" },
27
- ];
28
- export function DesignSystemPage() {
29
- return (_jsxs(PageShell, { children: [_jsx(SectionTitle, { children: "Design System Preview" }), _jsx("h1", { className: "text-[29px] font-semibold tracking-tight text-ink mb-2", children: "Warm Paper + Blueprint" }), _jsx("p", { className: "text-ink-3 text-sm mb-8", children: "Visual regression anchor for CR1. All tokens and component states rendered here." }), _jsx(SectionTitle, { children: "Color Palette" }), _jsx("div", { className: "grid grid-cols-5 gap-3 mb-8", children: LIGHT_TOKENS.map(({ name, value }) => (_jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx("div", { className: "w-full h-12 rounded-[var(--radius-md)] border border-line", style: { backgroundColor: value } }), _jsx("span", { className: "font-mono text-[10px] text-ink-3", children: name }), _jsx("span", { className: "font-mono text-[10px] text-ink-4", children: value })] }, name))) }), _jsx(SectionTitle, { children: "Buttons" }), _jsxs("div", { className: "flex flex-wrap gap-3 mb-8 items-center", children: [_jsx(Button, { variant: "default", children: "Primary (Gov)" }), _jsx(Button, { variant: "outline", children: "Outline" }), _jsx(Button, { variant: "ghost", children: "Ghost" }), _jsx(Button, { variant: "quiet", children: "Quiet" }), _jsx(Button, { variant: "secondary", children: "Secondary" }), _jsx(Button, { variant: "destructive", children: "Destructive" }), _jsx(Button, { variant: "link", children: "Link" }), _jsx(Button, { variant: "default", disabled: true, children: "Disabled" }), _jsx(Button, { variant: "default", size: "sm", children: "Small" }), _jsx(Button, { variant: "default", size: "lg", children: "Large" })] }), _jsx(SectionTitle, { children: "Cards" }), _jsxs("div", { className: "grid grid-cols-2 gap-4 mb-8", children: [_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: "Default Card" }), _jsx(CardDescription, { children: "With shadow, hover deepens border + shadow. No transform." })] }), _jsx(CardContent, { children: _jsxs("p", { className: "text-sm text-ink-3", children: ["Cards use ", _jsx("code", { className: "font-mono text-[11px] bg-paper-2 px-1 rounded-[2px]", children: "--shadow-card" }), " and hover with deeper shadow. No translateY or scale on hover (B.4.4)."] }) }), _jsx(CardFooter, { children: _jsx(Button, { variant: "default", size: "sm", children: "Action" }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { children: "Card with Badges" }), _jsx(CardDescription, { children: "Status labels in Blueprint style" })] }), _jsxs(CardContent, { children: [_jsxs("div", { className: "flex flex-wrap gap-2 mb-3", children: [_jsx(Badge, { variant: "default", children: "\u5F85\u5BA1\u67E5" }), _jsx(Badge, { variant: "amber", children: "\u9700\u6CE8\u610F" }), _jsx(Badge, { variant: "green", children: "\u7A33\u5B9A" }), _jsx(Badge, { variant: "destructive", children: "\u98CE\u9669" }), _jsx(Badge, { variant: "secondary", children: "\u5DF2\u5F52\u6863" }), _jsx(Badge, { variant: "outline", children: "\u5DF2\u6682\u5B58" })] }), _jsx("p", { className: "text-sm text-ink-3", children: "Badges: 2px border-radius, mono font, 11px, low saturation (B.4.5)." })] })] })] }), _jsx(SectionTitle, { children: "Badges / Status Labels" }), _jsxs("div", { className: "flex flex-wrap gap-3 mb-8", children: [_jsx(Badge, { variant: "default", children: "\u5F85\u5BA1\u67E5" }), _jsx(Badge, { variant: "amber", children: "\u9700\u6CE8\u610F" }), _jsx(Badge, { variant: "green", children: "\u7A33\u5B9A" }), _jsx(Badge, { variant: "destructive", children: "\u98CE\u9669" }), _jsx(Badge, { variant: "secondary", children: "\u5DF2\u5F52\u6863" }), _jsx(Badge, { variant: "outline", children: "\u5DF2\u6682\u5B58" })] }), _jsx(SectionTitle, { children: "Empty State" }), _jsx(Card, { className: "mb-8", children: _jsxs(CardContent, { className: "py-12 text-center", children: [_jsx("p", { className: "text-ink-3 text-sm mb-2", children: "\u8FD8\u6CA1\u6709\u53EF\u5BA1\u67E5\u539F\u5219\u3002\u5F53 PD \u6355\u83B7\u5230\u884C\u4E3A\u504F\u5DEE\u4FE1\u53F7\u65F6\uFF0C\u4F1A\u5728\u8FD9\u91CC\u751F\u6210\u539F\u5219\u5019\u9009\uFF0C\u7B49\u5F85\u4F60\u5BA1\u67E5\u3002" }), _jsx(Button, { variant: "outline", size: "sm", children: "\u4E86\u89E3\u66F4\u591A" })] }) }), _jsx(SectionTitle, { children: "Error State" }), _jsx(Card, { className: "mb-8", children: _jsxs(CardContent, { className: "py-8", children: [_jsx("p", { className: "text-ink-3 text-sm mb-2", children: "\u65E0\u6CD5\u52A0\u8F7D\u8FD9\u6761\u539F\u5219\u7684\u8BC1\u636E\u6765\u6E90\u3002\u539F\u5219\u672C\u8EAB\u672A\u53D7\u5F71\u54CD\u3002\u4F60\u53EF\u4EE5\u7A0D\u540E\u91CD\u8BD5\uFF0C\u6216\u6682\u65F6\u4FDD\u7559\u5728\u5F85\u5BA1\u67E5\u72B6\u6001\u3002" }), _jsx(Button, { variant: "outline", size: "sm", children: "\u91CD\u8BD5" })] }) }), _jsx(SectionTitle, { children: "Typography" }), _jsxs("div", { className: "space-y-3 mb-8", children: [_jsx("h1", { className: "text-[29px] font-semibold tracking-tight text-ink", children: "Page Title \u2014 29px" }), _jsx("h2", { className: "text-[17px] font-semibold tracking-tight text-ink", children: "Card Title \u2014 17px" }), _jsx("h3", { className: "text-[13px] font-semibold text-ink-2", children: "Section Title \u2014 13px" }), _jsx("p", { className: "text-[15px] text-ink leading-relaxed", children: "Body text \u2014 15px. The quick brown fox jumps over the lazy dog. \u6570\u5B57\u4F7F\u7528 tabular-nums: 1,234,567." }), _jsx("p", { className: "text-[14px] text-ink-2", children: "Card body \u2014 14px" }), _jsx("p", { className: "text-[13px] text-ink-3", children: "Auxiliary text \u2014 13px" }), _jsx("p", { className: "font-mono text-[11px] tracking-[0.1em] uppercase text-ink-3", children: "EYEBROW / LABEL \u2014 11PX MONO" }), _jsx("p", { className: "font-mono text-[11px] text-ink-4", children: "Metadata / timestamp \u2014 11px mono" })] }), _jsx(SectionTitle, { children: "Layout \u2014 712px Container" }), _jsx("p", { className: "text-sm text-ink-3 mb-4", children: "This page is already inside a PageShell (712px centered). The blueprint grid is visible on the body background." }), _jsx("div", { className: "border border-dashed border-line-2 p-4 text-center text-ink-4 text-xs font-mono", children: "\u2190 712px max-width \u2192" })] }));
30
- }
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- /**
3
- * SPEC-PD-EXAMINER-001 v0.9 §8 — Examiner product entry (offline-first).
4
- *
5
- * The Owner journey: pick a target principle from the workspace ledger →
6
- * choose a mode (full-library incremental default / isolated diagnostic) →
7
- * create the study (server-minted identity) → run the fail-closed preflight →
8
- * run the OFFLINE-STUB execution → read the Report V2 (ITT + fidelity).
9
- *
10
- * Honesty contract: every result is labelled offline-stub / synthetic gold —
11
- * the console NEVER presents these as real-host behavior; real runs require
12
- * separate Owner authorization (the gates panel says exactly what is and is
13
- * not ready).
14
- */
15
- export declare function ExaminerPage(): React.ReactElement;
@@ -1,158 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect, useCallback } from "react";
3
- import { useSearchParams } from "react-router-dom";
4
- import { useTranslation } from "react-i18next";
5
- import { toast } from "sonner";
6
- import { PageShell } from "../../components/layout/page-shell.js";
7
- import { PageLoading } from "../../components/layout/page-loading.js";
8
- import { SectionTitle } from "../../components/layout/section-title.js";
9
- import { Button } from "../../components/ui/button.js";
10
- import { truncateByCodePoints } from "../../utils/reading-layout.js";
11
- import { FlaskConical, ShieldCheck, Play, FileText, Loader2 } from "lucide-react";
12
- import { fetchExaminerOverview, fetchExaminerPrinciples, createExaminerStudy, fetchExaminerStudyStatus, runExaminerPreflight, runExaminerStudy, generateExaminerReport, fetchExaminerReport, } from "../../api.js";
13
- /**
14
- * SPEC-PD-EXAMINER-001 v0.9 §8 — Examiner product entry (offline-first).
15
- *
16
- * The Owner journey: pick a target principle from the workspace ledger →
17
- * choose a mode (full-library incremental default / isolated diagnostic) →
18
- * create the study (server-minted identity) → run the fail-closed preflight →
19
- * run the OFFLINE-STUB execution → read the Report V2 (ITT + fidelity).
20
- *
21
- * Honesty contract: every result is labelled offline-stub / synthetic gold —
22
- * the console NEVER presents these as real-host behavior; real runs require
23
- * separate Owner authorization (the gates panel says exactly what is and is
24
- * not ready).
25
- */
26
- export function ExaminerPage() {
27
- const { t } = useTranslation();
28
- // §8.1: prefill the target from the principle-detail entry link
29
- // (?principle=<id>); only an EXACT id match is honored.
30
- const [searchParams] = useSearchParams();
31
- const prefillPrinciple = searchParams.get("principle");
32
- const [overview, setOverview] = useState(null);
33
- const [principles, setPrinciples] = useState([]);
34
- const [targetPrincipleId, setTargetPrincipleId] = useState("");
35
- const [experimentMode, setExperimentMode] = useState("full_library_incremental");
36
- const [repetitions, setRepetitions] = useState(2);
37
- const [selectedStudy, setSelectedStudy] = useState(null);
38
- const [status, setStatus] = useState(null);
39
- const [preflight, setPreflight] = useState(null);
40
- const [report, setReport] = useState(null);
41
- const [busy, setBusy] = useState(null);
42
- const [error, setError] = useState(null);
43
- const refreshStatus = useCallback(async (studyId) => {
44
- const statusResponse = await fetchExaminerStudyStatus(studyId);
45
- if (!statusResponse.success) {
46
- setError(statusResponse.error ?? "status unavailable");
47
- return;
48
- }
49
- setStatus(statusResponse.data);
50
- }, []);
51
- const selectStudy = useCallback(async (studyId) => {
52
- setSelectedStudy(studyId);
53
- setStatus(null);
54
- setPreflight(null);
55
- setReport(null);
56
- await refreshStatus(studyId);
57
- const reportResponse = await fetchExaminerReport(studyId);
58
- if (reportResponse.success)
59
- setReport(reportResponse.data);
60
- }, [refreshStatus]);
61
- useEffect(() => {
62
- let cancelled = false;
63
- (async () => {
64
- const overviewResponse = await fetchExaminerOverview();
65
- if (cancelled)
66
- return;
67
- if (!overviewResponse.success) {
68
- setError(overviewResponse.error ?? t("pages.examiner.errors.unavailable"));
69
- return;
70
- }
71
- setOverview(overviewResponse.data);
72
- const principlesResponse = await fetchExaminerPrinciples();
73
- if (!cancelled && principlesResponse.success) {
74
- const active = principlesResponse.data.principles.filter((p) => p.status === "active");
75
- setPrinciples(active);
76
- if (prefillPrinciple !== null) {
77
- const prefilled = active.find((p) => p.id === prefillPrinciple);
78
- if (prefilled !== undefined)
79
- setTargetPrincipleId(prefilled.id);
80
- else if (active[0] !== undefined)
81
- setTargetPrincipleId(active[0].id);
82
- }
83
- else if (active[0] !== undefined) {
84
- setTargetPrincipleId(active[0].id);
85
- }
86
- }
87
- })();
88
- return () => {
89
- cancelled = true;
90
- };
91
- }, [t, prefillPrinciple]);
92
- const handleCreate = async () => {
93
- if (!targetPrincipleId)
94
- return;
95
- setBusy("create");
96
- setError(null);
97
- const response = await createExaminerStudy({ targetPrincipleId, experimentMode, repetitionsPerCase: repetitions });
98
- setBusy(null);
99
- if (!response.success) {
100
- toast.error(response.error ?? t("pages.examiner.errors.create"));
101
- return;
102
- }
103
- toast.success(t("pages.examiner.created", { studyId: response.data.studyId }));
104
- const overviewResponse = await fetchExaminerOverview();
105
- if (overviewResponse.success)
106
- setOverview(overviewResponse.data);
107
- await selectStudy(response.data.studyId);
108
- };
109
- const handlePreflight = async () => {
110
- if (!selectedStudy)
111
- return;
112
- setBusy("preflight");
113
- const response = await runExaminerPreflight(selectedStudy);
114
- setBusy(null);
115
- if (!response.success) {
116
- toast.error(response.error ?? t("pages.examiner.errors.preflight"));
117
- return;
118
- }
119
- setPreflight(response.data);
120
- };
121
- const handleRun = async () => {
122
- if (!selectedStudy)
123
- return;
124
- setBusy("run");
125
- const response = await runExaminerStudy(selectedStudy);
126
- setBusy(null);
127
- if (!response.success) {
128
- toast.error(response.error ?? t("pages.examiner.errors.run"));
129
- return;
130
- }
131
- toast.success(t("pages.examiner.runDone", { count: response.data.units.filter((u) => u.state === "SUCCEEDED").length }));
132
- await refreshStatus(selectedStudy);
133
- };
134
- const handleReport = async () => {
135
- if (!selectedStudy)
136
- return;
137
- setBusy("report");
138
- const generated = await generateExaminerReport(selectedStudy);
139
- setBusy(null);
140
- if (!generated.success) {
141
- toast.error(generated.error ?? t("pages.examiner.errors.report"));
142
- return;
143
- }
144
- const fetched = await fetchExaminerReport(selectedStudy);
145
- if (fetched.success)
146
- setReport(fetched.data);
147
- await refreshStatus(selectedStudy);
148
- toast.success(t("pages.examiner.reportGenerated", { status: generated.data.status }));
149
- };
150
- if (!overview && !error)
151
- return _jsx(PageLoading, { label: t("pages.examiner.loading") });
152
- return (_jsxs(PageShell, { children: [_jsxs("header", { className: "mb-6", children: [_jsx("h1", { className: "text-[22px] font-semibold text-ink", "data-testid": "examiner-page-title", children: t("pages.examiner.title") }), _jsx("p", { className: "mt-1 text-[14px] text-ink-3", children: t("pages.examiner.subtitle") })] }), error && (_jsx("div", { className: "rounded-lg border border-destructive/40 bg-destructive/10 p-4 text-sm text-destructive", "data-testid": "examiner-error", children: error })), overview && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "rounded-lg border bg-card p-4 text-sm", "data-testid": "examiner-scope", children: [_jsxs("div", { className: "flex items-center gap-2 font-medium", children: [_jsx(ShieldCheck, { className: "size-4" }), t("pages.examiner.scope.title")] }), _jsx("p", { className: "mt-1 text-muted-foreground", children: overview.executionScope }), _jsx("div", { className: "mt-3 grid gap-1 text-xs text-muted-foreground", children: Object.entries(overview.gates).map(([gate, state]) => (_jsxs("div", { "data-testid": `examiner-gate-${gate}`, children: [_jsx("span", { className: "font-mono", children: gate }), ": ", state] }, gate))) })] }), _jsx(SectionTitle, { children: t("pages.examiner.create.title") }), _jsxs("div", { className: "grid gap-3 rounded-lg border bg-card p-4", "data-testid": "examiner-create", children: [_jsxs("label", { className: "text-sm", children: [_jsx("span", { className: "mb-1 block font-medium", children: t("pages.examiner.create.target") }), _jsx("select", { className: "w-full rounded-md border bg-background px-3 py-2 text-sm", value: targetPrincipleId, onChange: (e) => setTargetPrincipleId(e.target.value), "data-testid": "examiner-target-select", children: principles.map((p) => (_jsxs("option", { value: p.id, children: [p.id, " \u2014 ", truncateByCodePoints(p.text, 60)] }, p.id))) })] }), _jsxs("label", { className: "text-sm", children: [_jsx("span", { className: "mb-1 block font-medium", children: t("pages.examiner.create.mode") }), _jsxs("select", { className: "w-full rounded-md border bg-background px-3 py-2 text-sm", value: experimentMode, onChange: (e) => setExperimentMode(e.target.value), "data-testid": "examiner-mode-select", children: [_jsx("option", { value: "full_library_incremental", children: t("pages.examiner.mode.full") }), _jsx("option", { value: "isolated_principle", children: t("pages.examiner.mode.isolated") })] })] }), _jsxs("label", { className: "text-sm", children: [_jsx("span", { className: "mb-1 block font-medium", children: t("pages.examiner.create.repetitions") }), _jsx("select", { className: "w-full rounded-md border bg-background px-3 py-2 text-sm", value: repetitions, onChange: (e) => setRepetitions(Number(e.target.value)), children: [1, 2, 3, 4, 5].map((n) => (_jsx("option", { value: n, children: n }, n))) })] }), _jsxs(Button, { onClick: handleCreate, disabled: !targetPrincipleId || busy === "create", "data-testid": "examiner-create-button", children: [busy === "create" ? _jsx(Loader2, { className: "size-4 animate-spin" }) : _jsx(FlaskConical, { className: "size-4" }), t("pages.examiner.create.submit")] }), _jsx("p", { className: "text-xs text-muted-foreground", children: t("pages.examiner.create.note") })] }), _jsx(SectionTitle, { children: t("pages.examiner.studies.title") }), _jsxs("div", { className: "grid gap-2", "data-testid": "examiner-study-list", children: [overview.studies.length === 0 && (_jsx("p", { className: "text-sm text-muted-foreground", children: t("pages.examiner.studies.empty") })), overview.studies.map((studyId) => (_jsx("button", { className: `rounded-md border px-3 py-2 text-left font-mono text-xs ${selectedStudy === studyId ? "border-primary bg-primary/10" : "bg-card hover:bg-accent"}`, onClick: () => selectStudy(studyId), "data-testid": `examiner-study-${studyId}`, children: studyId }, studyId)))] }), selectedStudy && status && (_jsxs(_Fragment, { children: [_jsx(SectionTitle, { children: t("pages.examiner.study.title", { studyId: selectedStudy }) }), _jsxs("div", { className: "grid gap-3 rounded-lg border bg-card p-4 text-sm", "data-testid": "examiner-study-detail", children: [_jsxs("div", { className: "grid grid-cols-2 gap-2 text-xs", children: [_jsxs("div", { children: [t("pages.examiner.study.mode"), ": ", _jsx("span", { className: "font-mono", children: status.experimentMode })] }), _jsxs("div", { children: [t("pages.examiner.study.intervention"), ": ", _jsx("span", { className: "font-mono", children: status.interventionType })] }), _jsxs("div", { children: [t("pages.examiner.study.target"), ": ", _jsx("span", { className: "font-mono", children: status.targetPrincipleId })] }), _jsxs("div", { children: [t("pages.examiner.study.plannedPairs"), ": ", status.plannedPairs] }), _jsxs("div", { children: [t("pages.examiner.study.run"), ": ", status.runStarted ? (status.runFinished ? t("pages.examiner.study.finished") : t("pages.examiner.study.running")) : t("pages.examiner.study.notRun")] }), _jsxs("div", { children: [t("pages.examiner.study.report"), ": ", _jsx("span", { className: "font-mono", children: status.reportStatus ?? "—" })] })] }), Object.keys(status.unitStates).length > 0 && (_jsx("div", { className: "text-xs text-muted-foreground", "data-testid": "examiner-unit-states", children: Object.entries(status.unitStates).map(([state, count]) => `${state}: ${count}`).join(" · ") })), _jsxs("div", { className: "flex flex-wrap gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: handlePreflight, disabled: busy === "preflight", "data-testid": "examiner-preflight-button", children: [busy === "preflight" ? _jsx(Loader2, { className: "size-4 animate-spin" }) : _jsx(ShieldCheck, { className: "size-4" }), t("pages.examiner.study.preflight")] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: handleRun, disabled: busy === "run", "data-testid": "examiner-run-button", children: [busy === "run" ? _jsx(Loader2, { className: "size-4 animate-spin" }) : _jsx(Play, { className: "size-4" }), t("pages.examiner.study.runOffline")] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: handleReport, disabled: busy === "report", "data-testid": "examiner-report-button", children: [busy === "report" ? _jsx(Loader2, { className: "size-4 animate-spin" }) : _jsx(FileText, { className: "size-4" }), t("pages.examiner.study.report")] })] }), preflight && (_jsxs("div", { className: "rounded-md border p-3 text-xs", "data-testid": "examiner-preflight-result", children: [_jsxs("div", { className: "font-medium", children: [t("pages.examiner.preflight.status"), ": ", preflight.status] }), preflight.blockers.length > 0 && (_jsx("div", { className: "mt-2 text-destructive", children: preflight.blockers.map((b) => (_jsxs("div", { children: ["\u26D4 ", b.id, ": ", b.detail] }, b.id))) })), preflight.warnings.length > 0 && (_jsx("div", { className: "mt-2 text-amber-600 dark:text-amber-400", children: preflight.warnings.map((w) => (_jsxs("div", { children: ["\u26A0 ", w.id, ": ", w.detail] }, w.id))) }))] }))] })] })), report && report.report && (_jsxs(_Fragment, { children: [_jsx(SectionTitle, { children: t("pages.examiner.report.title") }), _jsxs("div", { className: "grid gap-3 rounded-lg border bg-card p-4 text-sm", "data-testid": "examiner-report", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "rounded bg-muted px-2 py-0.5 font-mono text-xs", children: report.report.status }), report.report.examiner && (_jsx("span", { className: "rounded bg-muted px-2 py-0.5 font-mono text-xs", children: report.report.examiner.experimentMode }))] }), report.report.examiner ? (_jsxs("div", { className: "grid gap-3", children: [_jsxs("div", { className: "text-xs text-muted-foreground", children: [t("pages.examiner.report.target"), ": ", _jsx("span", { className: "font-mono", children: report.report.examiner.targetPrincipleId }), " \u00B7 ", t("pages.examiner.report.endpoint"), ": ", _jsx("span", { className: "font-mono", children: report.report.examiner.primaryEndpoint?.id })] }), _jsxs("div", { className: "rounded-md border p-3", "data-testid": "examiner-report-itt", children: [_jsx("div", { className: "font-medium", children: "ITT" }), report.report.examiner.itt.pointEstimate.status === "ESTIMABLE" ? (_jsx("div", { className: "text-2xl font-bold", children: report.report.examiner.itt.pointEstimate.value })) : (_jsxs("div", { className: "font-mono text-sm", children: ["[", report.report.examiner.itt.lowerBound.value ?? "n/a", ", ", report.report.examiner.itt.upperBound.value ?? "n/a", "]"] })), _jsx("div", { className: "text-xs text-muted-foreground", children: t("pages.examiner.report.ittNote", {
153
- planned: report.report.examiner.itt.plannedApplicablePairs,
154
- determined: report.report.examiner.itt.determinedPairs,
155
- unknown: report.report.examiner.itt.unknownPairs,
156
- na: report.report.examiner.applicability.notApplicablePairs,
157
- }) })] }), _jsxs("div", { className: "rounded-md border p-3", "data-testid": "examiner-report-fidelity", children: [_jsx("div", { className: "font-medium", children: t("pages.examiner.report.fidelity") }), _jsxs("div", { className: "text-xs", children: ["CONTEXT_PRESENT+ ", report.report.examiner.treatmentFidelity.contextPresent, "/", report.report.examiner.treatmentFidelity.plannedTreatmentUnits, " \u00B7 RUNTIME_LOADED ", report.report.examiner.treatmentFidelity.runtimeLoaded, " \u00B7 ", t("pages.examiner.report.contamination"), " ", report.report.examiner.treatmentFidelity.controlContamination.units, " \u00B7 ", t("pages.examiner.report.evictions"), " ", report.report.examiner.treatmentFidelity.capacityEvictions.units] })] })] })) : (_jsx("p", { className: "text-xs text-muted-foreground", children: t("pages.examiner.report.noExaminerBlock") })), _jsx("p", { className: "text-xs text-muted-foreground", children: t("pages.examiner.report.offlineNote") })] })] }))] }))] }));
158
- }
@@ -1 +0,0 @@
1
- export declare function FailedTasksPage(): import("react").JSX.Element;