@kabmo-labs/kabmo 0.23.0 → 0.25.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 (325) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +805 -736
  3. package/dist/client/static/js/index-bc9aa4mx.css +1 -0
  4. package/dist/client/static/js/{index-ph0q59rs.js → index-ga8cbpt4.js} +1071 -1171
  5. package/package.json +2 -4
  6. package/src/cli/lib/args.js +24 -1
  7. package/src/cli/lib/args.test.js +16 -0
  8. package/src/cli/lib/commands/session.js +233 -0
  9. package/src/cli/lib/commands/session.test.js +103 -0
  10. package/src/cli/main.js +1 -1
  11. package/src/client/components/common/ComposerPicker.tsx +3 -0
  12. package/src/client/components/common/Modal.tsx +2 -6
  13. package/src/client/components/common/code-surface/shiki.test.ts +82 -0
  14. package/src/client/components/common/code-surface/shiki.ts +28 -7
  15. package/src/client/components/common/session-actions-menu/NewChildSessionDialog.tsx +113 -0
  16. package/src/client/components/common/session-actions-menu/index.tsx +33 -2
  17. package/src/client/components/common/session-row/StatusSlot.tsx +4 -4
  18. package/src/client/components/common/session-row/index.tsx +27 -1
  19. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +7 -1
  20. package/src/client/components/layout/desktop-layout/resizer/separator-drag.ts +3 -3
  21. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +25 -12
  22. package/src/client/components/layout/session-sidebar/ChildSessionList.tsx +66 -0
  23. package/src/client/components/layout/session-sidebar/SessionItem.tsx +28 -3
  24. package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.test.tsx +20 -0
  25. package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +59 -12
  26. package/src/client/components/layout/session-sidebar/about-modal/HarnessTableLog.test.tsx +94 -0
  27. package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.test.tsx +130 -0
  28. package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.tsx +120 -0
  29. package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +47 -0
  30. package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +122 -0
  31. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +55 -46
  32. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +18 -5
  33. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +21 -4
  34. package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +27 -5
  35. package/src/client/components/settings/categories/harness-settings/EnvProviderForm.tsx +31 -0
  36. package/src/client/components/settings/categories/harness-settings/provider-panel.test.tsx +49 -0
  37. package/src/client/components/workspace/chat-timeline/ChatOverlays.tsx +5 -2
  38. package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +64 -70
  39. package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +35 -0
  40. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +135 -118
  41. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +22 -1
  42. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +14 -0
  43. package/src/client/components/workspace/chat-timeline/MessageList.tsx +4 -0
  44. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +3 -0
  45. package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +4 -3
  46. package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +155 -0
  47. package/src/client/components/workspace/chat-timeline/index.tsx +5 -2
  48. package/src/client/components/workspace/chat-timeline/pending-harness.test.tsx +1 -1
  49. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +11 -20
  50. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/GroupedAsk.tsx +1 -1
  51. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +1 -1
  52. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts.ts +1 -1
  53. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -1
  54. package/src/client/components/workspace/file-explorer/index.test.ts +25 -0
  55. package/src/client/components/workspace/file-explorer/index.tsx +9 -3
  56. package/src/client/components/workspace/model-dropdown/harness-models.test.ts +17 -0
  57. package/src/client/components/workspace/model-dropdown/harness-models.ts +33 -18
  58. package/src/client/components/workspace/model-dropdown/index.tsx +3 -3
  59. package/src/client/components/workspace/model-dropdown/popover-metrics.ts +4 -1
  60. package/src/client/components/workspace/terminal-panel/KeyBar.tsx +10 -8
  61. package/src/client/components/workspace/terminal-panel/{RealtimeXtermView.tsx → RealtimeTerminalView.tsx} +51 -58
  62. package/src/client/components/workspace/terminal-panel/fit.test.ts +37 -0
  63. package/src/client/components/workspace/terminal-panel/fit.ts +64 -0
  64. package/src/client/components/workspace/terminal-panel/fonts.test.ts +161 -0
  65. package/src/client/components/workspace/terminal-panel/fonts.ts +164 -0
  66. package/src/client/components/workspace/terminal-panel/grid.test.ts +52 -0
  67. package/src/client/components/workspace/terminal-panel/grid.ts +118 -0
  68. package/src/client/components/workspace/terminal-panel/index.tsx +25 -21
  69. package/src/client/components/workspace/terminal-panel/mount.ts +247 -223
  70. package/src/client/components/workspace/terminal-panel/navigation.test.ts +54 -0
  71. package/src/client/components/workspace/terminal-panel/navigation.ts +47 -0
  72. package/src/client/data/settings/omp-schema.json +5 -5
  73. package/src/client/data/theme/terminal.test.ts +25 -0
  74. package/src/client/data/theme/terminal.ts +96 -79
  75. package/src/client/hooks/chat/composer/items.test.ts +12 -26
  76. package/src/client/hooks/chat/composer/pick-mapping.test.ts +42 -0
  77. package/src/client/hooks/chat/omp/prompt-send.test.ts +7 -7
  78. package/src/client/hooks/chat/omp/prompt-send.ts +26 -14
  79. package/src/client/hooks/chat/timeline/actions.ts +2 -2
  80. package/src/client/hooks/chat/timeline/ask-frames.ts +5 -4
  81. package/src/client/hooks/chat/timeline/new-chat-open.test.ts +86 -0
  82. package/src/client/hooks/chat/timeline/new-chat-open.ts +23 -5
  83. package/src/client/hooks/chat/timeline/new-chat.test.ts +32 -4
  84. package/src/client/hooks/chat/timeline/new-chat.ts +18 -6
  85. package/src/client/hooks/chat/timeline/prompt-text.test.ts +34 -1
  86. package/src/client/hooks/chat/timeline/prompt-text.ts +47 -20
  87. package/src/client/hooks/chat/timeline/rewind-actions.test.ts +24 -1
  88. package/src/client/hooks/chat/timeline/rewind-actions.ts +15 -11
  89. package/src/client/hooks/chat/timeline/run-identity.test.ts +52 -0
  90. package/src/client/hooks/chat/timeline/run-identity.ts +23 -11
  91. package/src/client/hooks/chat/timeline/send-execute.test.ts +56 -0
  92. package/src/client/hooks/chat/timeline/send-helpers.ts +30 -1
  93. package/src/client/hooks/chat/timeline/send-props.ts +5 -3
  94. package/src/client/hooks/chat/timeline/send-steer.test.ts +4 -4
  95. package/src/client/hooks/chat/timeline/send.test-util.ts +8 -2
  96. package/src/client/hooks/chat/timeline/send.test.ts +4 -4
  97. package/src/client/hooks/chat/timeline/send.ts +59 -53
  98. package/src/client/hooks/chat/timeline/session-load.test-util.ts +6 -2
  99. package/src/client/hooks/chat/timeline/session-load.test.ts +31 -0
  100. package/src/client/hooks/chat/timeline/session-load.ts +6 -14
  101. package/src/client/hooks/chat/timeline/session-shapes.ts +32 -0
  102. package/src/client/hooks/chat/timeline/use-fork-session.ts +49 -0
  103. package/src/client/hooks/models/harness-catalog.ts +114 -0
  104. package/src/client/hooks/models/provider-writes.test.ts +81 -0
  105. package/src/client/hooks/models/provider-writes.ts +10 -3
  106. package/src/client/hooks/models/use-harness-update.test.ts +193 -0
  107. package/src/client/hooks/models/use-harness-update.ts +202 -0
  108. package/src/client/hooks/models/use-harnesses-controller.ts +57 -0
  109. package/src/client/hooks/models/use-harnesses-signal.test.ts +128 -0
  110. package/src/client/hooks/models/use-harnesses.test.ts +2 -1
  111. package/src/client/hooks/models/use-harnesses.ts +48 -114
  112. package/src/client/hooks/workspace/child-expansion.ts +33 -0
  113. package/src/client/hooks/workspace/terminal/index.ts +17 -3
  114. package/src/client/hooks/workspace/terminal/socket.ts +9 -4
  115. package/src/client/lib/session-tree.test.ts +50 -0
  116. package/src/client/lib/session-tree.ts +59 -0
  117. package/src/client/tailwind.css +26 -12
  118. package/src/server/index.ts +2 -0
  119. package/src/server/lib/auth/guard.ts +10 -0
  120. package/src/server/lib/btw/session-copy.server.ts +6 -44
  121. package/src/server/lib/btw/session-copy.test.ts +2 -1
  122. package/src/server/lib/db/schema.ts +4 -0
  123. package/src/server/lib/db/seed-terminal.test.ts +1 -1
  124. package/src/server/lib/db/seed.test.ts +1 -1
  125. package/src/server/lib/harness/acp/activation.test.ts +81 -0
  126. package/src/server/lib/harness/acp/activation.ts +72 -0
  127. package/src/server/lib/harness/acp/background-work.test.ts +262 -0
  128. package/src/server/lib/harness/acp/background-work.ts +320 -0
  129. package/src/server/lib/harness/acp/client.ts +2 -2
  130. package/src/server/lib/harness/acp/frames.test.ts +50 -1
  131. package/src/server/lib/harness/acp/frames.ts +17 -5
  132. package/src/server/lib/harness/acp/gateway-env.test.ts +64 -0
  133. package/src/server/lib/harness/acp/gateway-env.ts +70 -0
  134. package/src/server/lib/harness/acp/mapper.ts +6 -4
  135. package/src/server/lib/harness/acp/prompt.test.ts +20 -0
  136. package/src/server/lib/harness/acp/prompt.ts +19 -3
  137. package/src/server/lib/harness/acp/session-background.test.ts +129 -0
  138. package/src/server/lib/harness/acp/session-config.test.ts +73 -0
  139. package/src/server/lib/harness/acp/session-config.ts +87 -6
  140. package/src/server/lib/harness/acp/session-exit.ts +31 -0
  141. package/src/server/lib/harness/acp/session-handshake.test.ts +108 -0
  142. package/src/server/lib/harness/acp/session-handshake.ts +36 -3
  143. package/src/server/lib/harness/acp/session-idle.ts +51 -0
  144. package/src/server/lib/harness/acp/session-listeners.ts +31 -0
  145. package/src/server/lib/harness/acp/session-notifications.ts +19 -3
  146. package/src/server/lib/harness/acp/session-observers.test.ts +9 -0
  147. package/src/server/lib/harness/acp/session-options.ts +33 -0
  148. package/src/server/lib/harness/acp/session-reaper.test.ts +96 -0
  149. package/src/server/lib/harness/acp/session-requests.ts +47 -0
  150. package/src/server/lib/harness/acp/session-turns.ts +20 -5
  151. package/src/server/lib/harness/acp/session.test-util.ts +54 -3
  152. package/src/server/lib/harness/acp/session.test.ts +65 -3
  153. package/src/server/lib/harness/acp/session.ts +79 -79
  154. package/src/server/lib/harness/acp/turn.test.ts +81 -0
  155. package/src/server/lib/harness/acp/turn.ts +54 -13
  156. package/src/server/lib/harness/acp/verbs.ts +12 -2
  157. package/src/server/lib/harness/auto-probe.server.test.ts +121 -0
  158. package/src/server/lib/harness/auto-probe.server.ts +178 -0
  159. package/src/server/lib/harness/config.server.test.ts +1 -1
  160. package/src/server/lib/harness/config.server.ts +1 -1
  161. package/src/server/lib/harness/launch-table.ts +195 -0
  162. package/src/server/lib/harness/launch.test.ts +37 -0
  163. package/src/server/lib/harness/launch.ts +16 -116
  164. package/src/server/lib/harness/provider-entry.ts +32 -0
  165. package/src/server/lib/harness/provider-file.server.ts +3 -0
  166. package/src/server/lib/harness/provider-sources.server.test.ts +45 -0
  167. package/src/server/lib/harness/provider-sources.server.ts +26 -2
  168. package/src/server/lib/harness/provider-write.server.ts +21 -32
  169. package/src/server/lib/harness/provider-zcode.server.test.ts +270 -0
  170. package/src/server/lib/harness/provider-zcode.server.ts +324 -0
  171. package/src/server/lib/harness/spawn.server.ts +15 -2
  172. package/src/server/lib/harness/update-job-store.test.ts +126 -0
  173. package/src/server/lib/harness/update-job-store.ts +109 -0
  174. package/src/server/lib/harness/update-job.server.ts +203 -0
  175. package/src/server/lib/harness/update-state.server.ts +15 -20
  176. package/src/server/lib/harness/update-worker.test.ts +153 -0
  177. package/src/server/lib/harness/update-worker.ts +197 -0
  178. package/src/server/lib/lifecycle/after-listen.ts +7 -0
  179. package/src/server/lib/lifecycle/paths.ts +23 -0
  180. package/src/server/lib/models/registry-refresh.server.test.ts +87 -0
  181. package/src/server/lib/models/registry-refresh.server.ts +98 -0
  182. package/src/server/lib/omp/rpc/child-config.ts +5 -4
  183. package/src/server/lib/omp/rpc/constants.test.ts +2 -1
  184. package/src/server/lib/omp/rpc/forked-resume.test.ts +14 -3
  185. package/src/server/lib/omp/rpc/manager.ts +5 -5
  186. package/src/server/lib/omp/rpc/prewarm-pool.ts +12 -3
  187. package/src/server/lib/omp/rpc/session-registry.ts +14 -2
  188. package/src/server/lib/omp/rpc/terminal-settle.ts +53 -5
  189. package/src/server/lib/omp/session/delete-flow.server.ts +62 -8
  190. package/src/server/lib/omp/session/delete.server.ts +17 -0
  191. package/src/server/lib/omp/session/rewind-file.ts +39 -21
  192. package/src/server/lib/omp/session/sidebar-data.server.ts +6 -6
  193. package/src/server/lib/omp/session/transcript-copy.ts +123 -0
  194. package/src/server/lib/sessions/agent-token.server.test.ts +64 -0
  195. package/src/server/lib/sessions/agent-token.server.ts +134 -0
  196. package/src/server/lib/sessions/answers.server.test.ts +33 -0
  197. package/src/server/lib/sessions/answers.server.ts +37 -0
  198. package/src/server/lib/sessions/dispatch.server.test.ts +143 -0
  199. package/src/server/lib/sessions/dispatch.server.ts +128 -0
  200. package/src/server/lib/sessions/fork.server.test.ts +209 -0
  201. package/src/server/lib/sessions/fork.server.ts +304 -0
  202. package/src/server/lib/sessions/lifecycle.server.test.ts +75 -0
  203. package/src/server/lib/sessions/lifecycle.server.ts +71 -0
  204. package/src/server/lib/sessions/notify.server.test.ts +112 -0
  205. package/src/server/lib/sessions/notify.server.ts +212 -0
  206. package/src/server/lib/sessions/relation-types.ts +76 -0
  207. package/src/server/lib/sessions/relations.server.test.ts +207 -0
  208. package/src/server/lib/sessions/relations.server.ts +337 -0
  209. package/src/server/lib/sessions/resolve.server.ts +106 -0
  210. package/src/server/lib/sessions/schema.server.ts +82 -0
  211. package/src/server/lib/sessions/sidebar-relations.server.test.ts +61 -0
  212. package/src/server/lib/sessions/sidebar-relations.server.ts +47 -0
  213. package/src/server/lib/sessions/spawn.server.test.ts +196 -0
  214. package/src/server/lib/sessions/spawn.server.ts +310 -0
  215. package/src/server/lib/terminal/attach-replay.test.ts +2 -2
  216. package/src/server/lib/terminal/output.test.ts +2 -2
  217. package/src/server/lib/terminal/output.ts +1 -1
  218. package/src/server/lib/terminal/resize.test.ts +99 -0
  219. package/src/server/lib/terminal/runtime.server.ts +26 -6
  220. package/src/server/lib/terminal/send-result.test.ts +18 -1
  221. package/src/server/lib/terminal/send-result.ts +26 -2
  222. package/src/server/lib/terminal/session.server.ts +6 -6
  223. package/src/server/lib/usage/new-api.test.ts +92 -0
  224. package/src/server/lib/usage/new-api.ts +131 -0
  225. package/src/server/lib/usage/provider-endpoint.test.ts +106 -0
  226. package/src/server/lib/usage/provider-key.ts +33 -0
  227. package/src/server/lib/usage/providers.server.ts +10 -3
  228. package/src/server/lib/usage/vendor-balance.server.ts +4 -53
  229. package/src/server/lib/usage/vendor-http.ts +41 -0
  230. package/src/server/lib/usage/window.ts +55 -0
  231. package/src/server/routes/agent/command.ts +14 -1
  232. package/src/server/routes/agent/harness-command.ts +6 -0
  233. package/src/server/routes/agent/new.ts +15 -0
  234. package/src/server/routes/chat/rewind.test.ts +147 -0
  235. package/src/server/routes/chat/rewind.ts +29 -7
  236. package/src/server/routes/chat/session.test.ts +165 -10
  237. package/src/server/routes/chat/session.ts +60 -7
  238. package/src/server/routes/harness/add-provider.test.ts +9 -1
  239. package/src/server/routes/harness/import-action.ts +22 -4
  240. package/src/server/routes/harness/import.test.ts +1 -1
  241. package/src/server/routes/harness/index.ts +5 -1
  242. package/src/server/routes/harness/root.ts +8 -49
  243. package/src/server/routes/harness/toggle.test.ts +20 -0
  244. package/src/server/routes/harness/update-status.ts +26 -0
  245. package/src/server/routes/harness/update.test.ts +119 -0
  246. package/src/server/routes/harness/update.ts +67 -113
  247. package/src/server/routes/harness/versions.ts +5 -1
  248. package/src/server/routes/sessions/answer.ts +24 -0
  249. package/src/server/routes/sessions/batch-delete.ts +11 -5
  250. package/src/server/routes/sessions/delete-acp.test.ts +227 -0
  251. package/src/server/routes/sessions/delete.ts +4 -2
  252. package/src/server/routes/sessions/fork.ts +74 -0
  253. package/src/server/routes/sessions/index.ts +14 -0
  254. package/src/server/routes/sessions/relations.ts +85 -0
  255. package/src/server/routes/sessions/session.ts +4 -0
  256. package/src/server/routes/sessions/spawn.ts +134 -0
  257. package/src/server/routes/settings/model-override.ts +5 -2
  258. package/src/server/routes/settings/provider-entry.ts +2 -2
  259. package/src/server/routes/settings/provider-model.ts +2 -2
  260. package/src/server/routes/settings/provider-models.ts +2 -2
  261. package/src/server/routes/settings/provider-refresh.ts +6 -4
  262. package/src/server/routes/settings/providers.ts +3 -1
  263. package/src/server/routes/settings/settings-config-routes.test.ts +10 -2
  264. package/src/server/routes/terminal/ws.ts +3 -3
  265. package/src/shared/lib/chat/ask-form/fields.ts +76 -0
  266. package/src/shared/lib/chat/ask-form/index.ts +323 -0
  267. package/src/shared/lib/chat/ask-form/tokens.ts +199 -0
  268. package/src/shared/lib/chat/ask-form/types.ts +43 -0
  269. package/src/shared/lib/chat/ask-form.test.ts +137 -0
  270. package/src/shared/lib/chat/ask-questions.test.ts +65 -1
  271. package/src/shared/lib/chat/ask-questions.ts +51 -145
  272. package/src/shared/lib/chat/ask-results.ts +198 -0
  273. package/src/shared/lib/chat/composer/client.ts +31 -2
  274. package/src/shared/lib/chat/composer/delegation.test.ts +93 -0
  275. package/src/shared/lib/chat/composer/delegation.ts +206 -0
  276. package/src/shared/lib/chat/notice-text.ts +1 -1
  277. package/src/shared/lib/chat/timeline/omp-callbacks.ts +13 -1
  278. package/src/shared/lib/chat/timeline/prompt-error.test.ts +146 -0
  279. package/src/shared/lib/chat/timeline/prompt-error.ts +88 -0
  280. package/src/shared/lib/chat/tool/summary-wait.test.ts +11 -0
  281. package/src/shared/lib/code/ansi.ts +1 -1
  282. package/src/shared/lib/fonts/nerd-symbols.css +4 -3
  283. package/src/shared/lib/fonts/nerd-symbols.test.ts +9 -9
  284. package/src/shared/lib/harness/catalog.test.ts +1 -1
  285. package/src/shared/lib/harness/config-fields.test.ts +4 -0
  286. package/src/shared/lib/harness/config-fields.ts +19 -4
  287. package/src/shared/lib/harness/dialects.test.ts +8 -0
  288. package/src/shared/lib/harness/dialects.ts +12 -0
  289. package/src/shared/lib/harness/provider-facts.test.ts +59 -8
  290. package/src/shared/lib/harness/provider-facts.ts +46 -11
  291. package/src/shared/lib/harness/providers.ts +44 -1
  292. package/src/shared/lib/harness/rewind.ts +24 -0
  293. package/src/shared/lib/harness/update-job.ts +33 -0
  294. package/src/shared/lib/harness/update-plan.test.ts +69 -4
  295. package/src/shared/lib/harness/update-plan.ts +57 -9
  296. package/src/shared/lib/harness/updates.test.ts +22 -0
  297. package/src/shared/lib/harness/updates.ts +24 -1
  298. package/src/shared/lib/models/client.ts +10 -1
  299. package/src/shared/lib/omp/dialog-methods.ts +4 -3
  300. package/src/shared/lib/omp/session/wait-idle.test.ts +11 -0
  301. package/src/shared/lib/omp/session/wait-idle.ts +12 -2
  302. package/src/shared/lib/theme/catalog.test.ts +13 -9
  303. package/src/shared/lib/theme/color.test.ts +2 -2
  304. package/src/shared/lib/theme/color.ts +4 -4
  305. package/src/shared/lib/theme/css.ts +2 -0
  306. package/src/shared/lib/theme/ink-scale.ts +21 -1
  307. package/src/shared/lib/theme/theme.test.ts +26 -10
  308. package/src/shared/lib/ui/safe-area.test.ts +28 -0
  309. package/src/shared/lib/ui/safe-area.ts +42 -0
  310. package/src/shared/lib/workspace/terminal/input.test.ts +27 -0
  311. package/src/shared/lib/workspace/terminal/input.ts +33 -0
  312. package/src/shared/lib/workspace/terminal/keys.test.ts +1 -1
  313. package/src/shared/lib/workspace/terminal/keys.ts +7 -7
  314. package/src/shared/types/chat.ts +1 -1
  315. package/src/shared/types/harness-update.ts +65 -0
  316. package/src/shared/types/harness.ts +30 -4
  317. package/src/shared/types/omp/agent.ts +19 -2
  318. package/src/shared/types/workspace.ts +4 -0
  319. package/src/test-support/fake-omp-fork.ts +16 -2
  320. package/src/test-support/file-explorer-render.test-util.ts +37 -0
  321. package/src/test-support/file-explorer.test-util.ts +20 -18
  322. package/src/test-support/harness-table.test-util.ts +21 -4
  323. package/dist/client/static/js/index-jhmg4w91.css +0 -1
  324. package/src/client/components/workspace/terminal-panel/webgl.test.ts +0 -75
  325. package/src/client/components/workspace/terminal-panel/webgl.ts +0 -108
@@ -31,6 +31,7 @@
31
31
  import { useState } from 'preact/hooks';
32
32
  import { Download, Loader2 } from 'lucide-preact';
33
33
  import { HarnessGlyph, HARNESS_GLYPH_SIZE } from '@/client/components/common/harness-glyph';
34
+ import { UpdateLogLine } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogLine';
34
35
  import { harnessStatus, type HarnessState } from '@/shared/lib/harness/status';
35
36
  import { harnessCategoryId } from '@/shared/lib/harness/menu';
36
37
  import type { HarnessSummary } from '@/shared/types/harness';
@@ -41,10 +42,23 @@ interface HarnessTableProps {
41
42
  versions: HarnessVersionRow[];
42
43
  loading?: boolean;
43
44
  onOpenHarness: (id: string) => void;
44
- /** Runs one npm harness's update; resolves to a refusal, or null. */
45
+ /** Starts one harness's update as a background job and follows it; resolves
46
+ * to a refusal (a busy server, an unknown harness), or null when it began. */
45
47
  onUpdate: (id: string) => Promise<string | null>;
46
- /** Which harness is mid-update. */
48
+ /** Which harness is mid-update, and the step it is on (an adapter install,
49
+ * `claude update`, …). The step comes from the background job's record. */
47
50
  updating: string | null;
51
+ progress?: string | null;
52
+ /**
53
+ * The last update record this card read, running OR finished.
54
+ *
55
+ * The run is a background worker, and its output lives in that record — so the
56
+ * row that owns it offers `View log` next to the spinner, and keeps offering it
57
+ * once the run has settled, because a failure is exactly when the output is
58
+ * worth reading.
59
+ */
60
+ log?: { harness: string; message: string | null } | null;
61
+ onOpenLog?: () => void;
48
62
  }
49
63
 
50
64
  /** The state mark. Shape carries the state, so tone is reinforcement only. */
@@ -66,6 +80,11 @@ function StateMark({ state }: { state: HarnessState }) {
66
80
  * - the VERSION column held `7.5rem` (120px), which clipped the widest thing
67
81
  * it ever holds — an adapter's `adapter 0.100.0 → 0.101.0` line, measured at
68
82
  * 151px in this face. It is `9.5rem` (152px), the content's own width.
83
+ * - on a PHONE it is `7rem`: the About card is 512px at most, and the 152px
84
+ * track left the agent's own name ~130px, so `command-code` and
85
+ * `deepseek-harness` were the cells that truncated while the name is the one
86
+ * thing a reader is scanning for. The version line ellipsizes instead, and
87
+ * carries its full text in `title`.
69
88
  *
70
89
  * It stays a FIXED track rather than `auto`: every row is its own grid, so an
71
90
  * `auto` track is measured per row and the version numbers stop lining up in a
@@ -80,10 +99,11 @@ function StateMark({ state }: { state: HarnessState }) {
80
99
  * `adapter …` line under it), and centering measured the number 7.5px BELOW the
81
100
  * name it belongs to. Top-aligned, line one of every cell shares one baseline.
82
101
  */
83
- const COLUMNS = 'grid grid-cols-[minmax(0,1fr)_9.5rem_1.75rem] items-start gap-x-2';
102
+ const COLUMNS = 'grid grid-cols-[minmax(0,1fr)_7rem_1.75rem] items-start gap-x-2 md:grid-cols-[minmax(0,1fr)_9.5rem_1.75rem]';
84
103
 
85
104
  export function HarnessTable({
86
- harnesses, versions, loading = false, onOpenHarness, onUpdate, updating,
105
+ harnesses, versions, loading = false, onOpenHarness, onUpdate, updating, progress = null,
106
+ log = null, onOpenLog,
87
107
  }: HarnessTableProps) {
88
108
  const [problem, setProblem] = useState<{ id: string; message: string } | null>(null);
89
109
 
@@ -136,21 +156,35 @@ export function HarnessTable({
136
156
  ))}
137
157
  </div>
138
158
  ) : (
139
- // On a PHONE the list scrolls inside the card; on a desktop the card grows
140
- // to fit it, because a dialog that scrolls fourteen rows is hiding
141
- // information it has the room to show.
142
- <div className="grid max-h-[46vh] grid-cols-1 gap-x-6 overflow-y-auto scrollbar-overlay-container md:max-h-none md:grid-cols-2 md:overflow-visible">
159
+ // ONE list, no scroll cap of its own. It used to be `max-h-[46vh]
160
+ // overflow-y-auto` on a phone, which scroll-trapped fourteen rows inside
161
+ // a card that had most of the screen empty below them — two nested
162
+ // scrollers, and the inner one had no reason to exist. The About panel's
163
+ // own body is the single scroller now, so the list simply grows.
164
+ <div data-harness-rows="" className="grid grid-cols-1 gap-x-6 md:grid-cols-2">
143
165
  {entries.map((entry) => {
144
166
  const status = harnessStatus(entry);
145
167
  const version = byId.get(entry.id);
146
168
  const isUpdating = updating === entry.id;
169
+ // The row that owns the record gets the log line: while its worker
170
+ // runs, and after it settles so the output is not lost with it.
171
+ const showLogLine = isUpdating || log?.harness === entry.id;
147
172
  // The number a reader calls "the version": the CLI when the harness is
148
173
  // an adapter, otherwise the agent itself. Each part carries its own
149
174
  // `latest` and its own ability to move, so the two are never compared
150
175
  // across each other.
151
- const lead = version?.cli ?? version?.agent ?? null;
176
+ //
177
+ // A CLI part EXISTS for every adapter even when its `--version` could
178
+ // not be read (the binary is absent, or its launcher is broken). Taking
179
+ // that empty part as the lead painted `—` over a known adapter number:
180
+ // measured on `zcode` (adapter 0.82.3 probed, no `zcode` runtime) and
181
+ // `claude` (`claude --version` fails while the adapter answers). The
182
+ // part that HAS a number leads.
183
+ const cli = version?.cli ?? null;
184
+ const agent = version?.agent ?? null;
185
+ const lead = cli?.version ? cli : agent;
152
186
  const showAdapterLine = Boolean(
153
- version?.cli?.version && version.agent.version && version.agent.version !== version.cli.version,
187
+ cli?.version && agent?.version && agent.version !== cli.version,
154
188
  );
155
189
  // What the press would install, named: an adapter and a CLI are two
156
190
  // different products, so the accessible name says which is moving.
@@ -165,6 +199,10 @@ export function HarnessTable({
165
199
  ].filter((target): target is string => Boolean(target))
166
200
  : [];
167
201
  const updateLabel = `Update ${entry.label}${targets.length > 0 ? ` to ${targets.join(' + ')}` : ''}`;
202
+ // While the background worker runs, the button names the STEP it is
203
+ // on: one press can be an adapter install and then `claude update`,
204
+ // and "Updating…" alone would hide which half is moving.
205
+ const actionLabel = isUpdating && progress ? `Updating ${entry.label}: ${progress}` : updateLabel;
168
206
  return (
169
207
  <div key={entry.id} className={`${COLUMNS} border-b border-ink/5 py-1.5`}>
170
208
  {/* The name is the link: one target per row, and the row's other
@@ -262,8 +300,8 @@ export function HarnessTable({
262
300
  type="button"
263
301
  onClick={() => void runUpdate(entry.id)}
264
302
  disabled={isUpdating}
265
- aria-label={updateLabel}
266
- title={updateLabel}
303
+ aria-label={actionLabel}
304
+ title={actionLabel}
267
305
  className="inline-flex cursor-pointer items-center justify-center rounded border border-ink/25 p-1 text-ink transition-colors hover:border-ink/50 hover:bg-ink/5 disabled:cursor-not-allowed disabled:opacity-50"
268
306
  >
269
307
  {isUpdating
@@ -278,6 +316,15 @@ export function HarnessTable({
278
316
  {problem?.id === entry.id && (
279
317
  <span className="col-span-3 pb-1 text-[10px] text-ink/70">{problem.message}</span>
280
318
  )}
319
+
320
+ {showLogLine && (
321
+ <UpdateLogLine
322
+ running={isUpdating}
323
+ progress={progress}
324
+ message={log?.message ?? null}
325
+ onOpenLog={onOpenLog}
326
+ />
327
+ )}
281
328
  </div>
282
329
  );
283
330
  })}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The row's link to its update log.
8
+ *
9
+ * A harness update runs in a background worker, so the row can only show *that*
10
+ * something is installing — never what it printed. That output lives in the
11
+ * job record, and these cases pin the row's half of the deal: while the worker
12
+ * runs the row names the step and offers `View log`; once it settles the row
13
+ * keeps offering the log with the run's own sentence, because a failure is
14
+ * exactly when the output is worth reading; and a record never leaks onto a row
15
+ * that does not own it.
16
+ */
17
+
18
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
19
+ import { act } from 'preact/test-utils';
20
+ import { render } from 'preact';
21
+
22
+ import {
23
+ harnessRows,
24
+ installHarnessTableDom,
25
+ mountHarnessTable,
26
+ restoreHarnessTableDom,
27
+ summary,
28
+ version,
29
+ } from '@/test-support/harness-table.test-util';
30
+
31
+ let container: HTMLElement;
32
+
33
+ beforeAll(() => {
34
+ installHarnessTableDom();
35
+ });
36
+
37
+ beforeEach(() => {
38
+ container = document.createElement('div');
39
+ document.body.appendChild(container);
40
+ });
41
+
42
+ afterEach(() => {
43
+ render(null, container);
44
+ container.remove();
45
+ });
46
+
47
+ afterAll(() => {
48
+ restoreHarnessTableDom();
49
+ });
50
+
51
+ /** The claude row, with an update record attached. */
52
+ function mountClaude(state: Parameters<typeof mountHarnessTable>[5]): HTMLElement {
53
+ return mountHarnessTable(
54
+ container,
55
+ [summary()],
56
+ [version({ updateAvailable: true, agent: { version: '0.100.0', latest: '0.102.0', updateAvailable: true } })],
57
+ undefined,
58
+ undefined,
59
+ state,
60
+ );
61
+ }
62
+
63
+ describe('harness row update log', () => {
64
+ test('while the worker runs, the row names the step and offers the log', () => {
65
+ let opened = 0;
66
+ const el = mountClaude({
67
+ updating: 'claude',
68
+ progress: 'adapter',
69
+ log: { harness: 'claude', message: null },
70
+ onOpenLog: () => { opened += 1; },
71
+ });
72
+ const row = harnessRows(el)[0];
73
+ expect(row.textContent).toContain('Installing adapter…');
74
+ const log = row.querySelector<HTMLButtonElement>('[data-update-log]');
75
+ expect(log?.textContent).toBe('View log');
76
+ act(() => log!.click());
77
+ expect(opened).toBe(1);
78
+ });
79
+
80
+ test('after the run settles the log stays, with the run’s sentence', () => {
81
+ const el = mountClaude({
82
+ log: { harness: 'claude', message: 'claude update failed (exit 3)' },
83
+ onOpenLog: () => {},
84
+ });
85
+ const row = harnessRows(el)[0];
86
+ expect(row.textContent).toContain('claude update failed (exit 3)');
87
+ expect(row.querySelector('[data-update-log]')).not.toBeNull();
88
+ });
89
+
90
+ test('a record for another harness does not appear on this row', () => {
91
+ const el = mountClaude({ log: { harness: 'codex', message: 'codex updated' } });
92
+ expect(harnessRows(el)[0].querySelector('[data-update-log]')).toBeNull();
93
+ });
94
+ });
@@ -0,0 +1,130 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The panel a reader opens when a harness update is running (or just failed).
8
+ *
9
+ * The complaint it answers was concrete: press Update on `claude`, and the card
10
+ * showed a spinner with no way to see what the install was printing — so a
11
+ * failure said "update failed" with the reason already gone. These cases pin the
12
+ * three things the panel must state: every step and its command, the streamed
13
+ * output, and the finished run's own sentence.
14
+ */
15
+
16
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
17
+ import { Window } from 'happy-dom';
18
+ import { render } from 'preact';
19
+ import { act } from 'preact/test-utils';
20
+ import { UpdateLogDialog } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogDialog';
21
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
22
+ import type { HarnessUpdateJob } from '@/shared/types/harness-update';
23
+
24
+ beforeAll(() => {
25
+ installDomGlobals(new Window({ url: 'http://localhost' }));
26
+ });
27
+
28
+ afterAll(() => {
29
+ restoreDomGlobals();
30
+ });
31
+
32
+ let container: HTMLElement | null = null;
33
+
34
+ afterEach(() => {
35
+ if (container) act(() => render(null, container!));
36
+ container?.remove();
37
+ container = null;
38
+ for (const node of Array.from(document.body.children)) node.remove();
39
+ });
40
+
41
+ function job(overrides: Partial<HarnessUpdateJob> = {}): HarnessUpdateJob {
42
+ return {
43
+ harness: 'claude',
44
+ label: 'claude',
45
+ startedAt: Date.now(),
46
+ finishedAt: null,
47
+ pid: 4242,
48
+ steps: [
49
+ {
50
+ part: 'adapter',
51
+ command: 'npm install -g @agentclientprotocol/claude-agent-acp@0.102.0',
52
+ argv: ['npm', 'install', '-g', '@agentclientprotocol/claude-agent-acp@0.102.0'],
53
+ state: 'running',
54
+ code: null,
55
+ },
56
+ ],
57
+ output: '',
58
+ ok: null,
59
+ message: null,
60
+ applied: false,
61
+ repointed: null,
62
+ ...overrides,
63
+ };
64
+ }
65
+
66
+ /** Mount the panel and hand back its dialog element. */
67
+ function mountPanel(record: HarnessUpdateJob, onClose: () => void = () => {}): HTMLElement {
68
+ container = document.createElement('div');
69
+ document.body.appendChild(container);
70
+ act(() => render(<UpdateLogDialog job={record} onClose={onClose} />, container!));
71
+ const panel = document.querySelector('[role="dialog"]');
72
+ if (!panel) throw new Error('the log panel did not mount');
73
+ return panel as HTMLElement;
74
+ }
75
+
76
+ describe('UpdateLogDialog', () => {
77
+ test('a running step shows its command and says it is waiting for output', () => {
78
+ const panel = mountPanel(job());
79
+ expect(panel.textContent).toContain('Updating claude');
80
+ expect(panel.textContent).toContain('Installing…');
81
+ expect(panel.textContent).toContain('adapter');
82
+ // The command is the reader's way to repeat a step by hand after a failure.
83
+ expect(panel.textContent).toContain('npm install -g @agentclientprotocol/claude-agent-acp@0.102.0');
84
+ expect(panel.textContent).toContain('Waiting for output…');
85
+ });
86
+
87
+ test('the streamed output is rendered verbatim', () => {
88
+ const panel = mountPanel(job({ output: 'added 1 package in 3s\nnpm warn deprecated x' }));
89
+ expect(panel.querySelector('pre')?.textContent).toContain('added 1 package in 3s');
90
+ });
91
+
92
+ test('a failed step names its exit code, and the run its sentence', () => {
93
+ const panel = mountPanel(job({
94
+ finishedAt: Date.now(),
95
+ pid: null,
96
+ ok: false,
97
+ applied: true,
98
+ message: 'claude update failed (exit 3)',
99
+ output: 'boom',
100
+ steps: [{
101
+ part: 'Claude Code',
102
+ command: 'claude update',
103
+ argv: ['claude', 'update'],
104
+ state: 'failed',
105
+ code: 3,
106
+ }],
107
+ }));
108
+ expect(panel.textContent).toContain('Failed');
109
+ expect(panel.textContent).toContain('claude update');
110
+ expect(panel.textContent).toContain('exit 3');
111
+ expect(panel.textContent).toContain('claude update failed (exit 3)');
112
+ });
113
+
114
+ test('a finished run with no output says so instead of showing an empty box', () => {
115
+ const panel = mountPanel(job({ finishedAt: Date.now(), pid: null, ok: true, message: 'claude updated (adapter)' }));
116
+ expect(panel.textContent).toContain('The commands printed nothing.');
117
+ expect(panel.textContent).toContain('claude updated (adapter)');
118
+ expect(panel.textContent).toContain('Finished');
119
+ });
120
+
121
+ test('the close control asks to close', () => {
122
+ let closed = 0;
123
+ const panel = mountPanel(job(), () => { closed += 1; });
124
+ const close = panel.querySelector<HTMLButtonElement>('button[aria-label="Close"]')
125
+ ?? panel.querySelector<HTMLButtonElement>('button');
126
+ expect(close).not.toBeNull();
127
+ act(() => close!.click());
128
+ expect(closed).toBe(1);
129
+ });
130
+ });
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The install's own console, opened from the row that is updating.
8
+ *
9
+ * A harness update is a background job now, so the dialog's spinner says that
10
+ * *something* is running and nothing about what it is doing — and when a press
11
+ * fails, "claude update failed" without the command's output is not actionable.
12
+ * The worker already streams every step's stdout/stderr into the job record
13
+ * (throttled to 400 ms), so this panel is only a view of that: the steps, and
14
+ * the output, pinned to the newest line.
15
+ *
16
+ * It stays open after the run settles — the failure case is exactly when the log
17
+ * matters — and the record it renders is the last one the card polled, so a
18
+ * finished run keeps its output until another update replaces it.
19
+ */
20
+
21
+ import { useEffect, useRef } from 'preact/hooks';
22
+ import { createPortal } from 'preact/compat';
23
+ import { Ban, CheckCircle2, CircleDashed, Loader2 } from 'lucide-preact';
24
+ import { Modal } from '@/client/components/common/Modal';
25
+ import type { HarnessUpdateJob, HarnessUpdateJobStep } from '@/shared/types/harness-update';
26
+
27
+ export interface UpdateLogDialogProps {
28
+ job: HarnessUpdateJob;
29
+ onClose: () => void;
30
+ }
31
+
32
+ /** The mark for one step's state. */
33
+ function StepMark({ state }: { state: HarnessUpdateJobStep['state'] }) {
34
+ if (state === 'ok') return <CheckCircle2 size={12} className="shrink-0 text-ink/55" />;
35
+ if (state === 'failed') return <Ban size={12} className="shrink-0 text-error" />;
36
+ if (state === 'running') return <Loader2 size={12} className="shrink-0 animate-spin text-ink motion-reduce:animate-none" />;
37
+ return <CircleDashed size={12} className="shrink-0 text-ink/25" />;
38
+ }
39
+
40
+ /** How the panel describes the run, in the same words the toast uses. */
41
+ function phaseLabel(job: HarnessUpdateJob): string {
42
+ if (job.finishedAt === null) return 'Installing…';
43
+ return job.ok ? 'Finished' : 'Failed';
44
+ }
45
+
46
+ export function UpdateLogDialog({ job, onClose }: UpdateLogDialogProps) {
47
+ const output = useRef<HTMLPreElement | null>(null);
48
+ const running = job.finishedAt === null;
49
+
50
+ // Pin to the newest line while the worker streams. Without it the panel shows
51
+ // the top of npm's output and the reason for a failure is always below the
52
+ // fold.
53
+ useEffect(() => {
54
+ const node = output.current;
55
+ if (node) node.scrollTop = node.scrollHeight;
56
+ }, [job.output]);
57
+
58
+ return createPortal(
59
+ <Modal
60
+ onClose={onClose}
61
+ // Above About (`z-50`) — the log is opened FROM that card, not instead of it.
62
+ zClass="z-[65]"
63
+ maxWidthClass="max-w-3xl"
64
+ ariaLabel={`Update log for ${job.label}`}
65
+ header={
66
+ <div className="flex min-w-0 items-center gap-3">
67
+ {running
68
+ ? <Loader2 size={15} className="shrink-0 animate-spin text-ink/70 motion-reduce:animate-none" />
69
+ : <StepMark state={job.ok ? 'ok' : 'failed'} />}
70
+ <div className="min-w-0">
71
+ <h2 className="truncate text-sm font-semibold text-ink">Updating {job.label}</h2>
72
+ <p className="truncate font-mono text-[11px] text-ink/50">
73
+ {phaseLabel(job)}
74
+ {job.steps.length > 0 ? ` · ${job.steps.filter((step) => step.state === 'ok').length}/${job.steps.length} steps` : ''}
75
+ </p>
76
+ </div>
77
+ </div>
78
+ }
79
+ footer={
80
+ job.message ? (
81
+ <div className="border-t border-ink/10 px-5 py-2.5">
82
+ <p className="text-[11px] leading-4 text-ink/65">{job.message}</p>
83
+ </div>
84
+ ) : undefined
85
+ }
86
+ >
87
+ <div className="flex min-h-0 flex-col gap-3 px-5 py-4">
88
+ {/* What the run will do, and what it is doing: the commands are the
89
+ reader's way to repeat a step by hand after a failure. */}
90
+ <ul className="space-y-1">
91
+ {job.steps.map((step, index) => (
92
+ <li key={`${step.part}-${index}`} className="flex items-start gap-2">
93
+ <span className="mt-0.5 flex h-3.5 items-center"><StepMark state={step.state} /></span>
94
+ <span className="min-w-0 flex-1">
95
+ <span className="block text-[11px] leading-4 text-ink">{step.part}</span>
96
+ <span className="block break-all font-mono text-[10px] leading-[15px] text-ink/45">
97
+ {step.command}
98
+ {step.state === 'failed' && step.code !== null ? ` — exit ${step.code}` : ''}
99
+ </span>
100
+ </span>
101
+ {/* One line per STATE, because a press can run two installs: the
102
+ reader has to see which half is done. */}
103
+ <span className="shrink-0 text-[10px] leading-4 text-ink/40">{step.state}</span>
104
+ </li>
105
+ ))}
106
+ </ul>
107
+
108
+ {/* The output box scrolls on its own — the modal body must not, or the
109
+ step list would scroll away from the log it explains. */}
110
+ <pre
111
+ ref={output}
112
+ className="max-h-[38vh] min-h-[8rem] overflow-auto rounded-lg border border-ink/10 bg-ink/[0.03] px-3 py-2 font-mono text-[10px] leading-[15px] whitespace-pre-wrap break-all text-ink/75"
113
+ >
114
+ {job.output || (running ? 'Waiting for output…' : 'The commands printed nothing.')}
115
+ </pre>
116
+ </div>
117
+ </Modal>,
118
+ document.body,
119
+ );
120
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The in-flow line an updating harness row carries: what the background worker
8
+ * is doing, and the way into its log.
9
+ *
10
+ * It is a LINE under the row rather than a second icon in the action cell,
11
+ * because that cell is a fixed `1.75rem` track measured for one 24px button —
12
+ * two of them overflow it, which is the same defect the earlier `7rem` track
13
+ * caused in the other direction. In flow it can also carry the step's name,
14
+ * which a bare icon cannot.
15
+ *
16
+ * After the run settles the line stays, showing what happened and keeping
17
+ * `View log` available: the failure case is exactly when the output matters, and
18
+ * the record it lives in survives until the next update replaces it.
19
+ */
20
+
21
+ export interface UpdateLogLineProps {
22
+ /** Is the worker still installing? */
23
+ running: boolean;
24
+ /** The step it is on (`adapter`, `Claude Code`, …), when the record says. */
25
+ progress: string | null;
26
+ /** The finished run's sentence, once it has one. */
27
+ message: string | null;
28
+ onOpenLog?: () => void;
29
+ }
30
+
31
+ export function UpdateLogLine({ running, progress, message, onOpenLog }: UpdateLogLineProps) {
32
+ return (
33
+ <span className="col-span-3 flex items-center gap-2 pb-1 text-[10px] text-ink/60">
34
+ {running
35
+ ? <span>{progress ? `Installing ${progress}…` : 'Updating…'}</span>
36
+ : <span className="min-w-0 truncate">{message ?? 'Update finished'}</span>}
37
+ <button
38
+ type="button"
39
+ data-update-log
40
+ onClick={() => onOpenLog?.()}
41
+ className="shrink-0 cursor-pointer font-medium text-ink underline decoration-ink/30 underline-offset-2 transition-colors hover:decoration-ink"
42
+ >
43
+ View log
44
+ </button>
45
+ </span>
46
+ );
47
+ }
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The About card's FRAME, at both sizes.
8
+ *
9
+ * The phone used to get a full-bleed sheet (`h-full w-full`, no gutters), which
10
+ * put the card's own header against the viewport's top edge — under the status
11
+ * bar on a `viewport-fit: cover` surface — and capped the harness list at `46vh`
12
+ * inside it, so the list scrolled while most of the screen sat empty below it.
13
+ *
14
+ * Two things are guarded here, and both are properties of the TREE rather than
15
+ * of a stylesheet: the card is a bounded floating card sized by the same width
16
+ * cap the composer's model picker uses, and the card carries exactly ONE scroll
17
+ * container (its body) — the harness list must not be a second one.
18
+ */
19
+
20
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
21
+ import { Window } from 'happy-dom';
22
+ import { render } from 'preact';
23
+ import { act } from 'preact/test-utils';
24
+ import { AboutModal } from '@/client/components/layout/session-sidebar/about-modal';
25
+ import { MAX_WIDTH } from '@/client/components/workspace/model-dropdown/popover-metrics';
26
+ import { resetHarnessVersions } from '@/client/hooks/models/use-harness-versions';
27
+ import { resetHarnessesStore } from '@/client/hooks/models/harness-catalog';
28
+ import { delay } from '@/client/hooks/chat/composer/file-reads';
29
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
30
+ import type { UseUpdatesResult } from '@/client/hooks/ui/updates';
31
+
32
+ /** A console with nothing to install: this suite reads the frame, not the data. */
33
+ const UPDATES: UseUpdatesResult = {
34
+ info: null,
35
+ checking: false,
36
+ applying: null,
37
+ progress: null,
38
+ error: null,
39
+ hasUpdate: false,
40
+ check: async () => {},
41
+ apply: async () => null,
42
+ };
43
+
44
+ const nativeFetch = globalThis.fetch;
45
+
46
+ beforeAll(() => {
47
+ installDomGlobals(new Window({ url: 'http://localhost' }));
48
+ // Both catalogs are module-level stores: a suite that ran earlier and left a
49
+ // read in flight (or the "already loaded" flag set) makes this card mount
50
+ // against that state instead of its own 501, and the harness list then renders
51
+ // its skeleton forever — the frame assertions still pass, the ROWS assertion
52
+ // does not. Cold stores make the suite order-independent.
53
+ resetHarnessesStore();
54
+ resetHarnessVersions();
55
+ // The card reads two catalogs on mount; a 501 makes both hooks report their
56
+ // error state instead of dialing a server that is not there.
57
+ globalThis.fetch = (async () => ({
58
+ ok: false,
59
+ status: 501,
60
+ json: async () => ({}),
61
+ })) as unknown as typeof fetch;
62
+ });
63
+
64
+ afterAll(() => {
65
+ globalThis.fetch = nativeFetch;
66
+ restoreDomGlobals();
67
+ });
68
+
69
+ let container: HTMLElement | null = null;
70
+
71
+ afterEach(() => {
72
+ if (container) act(() => render(null, container!));
73
+ container?.remove();
74
+ container = null;
75
+ for (const node of Array.from(document.body.children)) node.remove();
76
+ });
77
+
78
+ /** Mount the card and return its `role="dialog"` panel. */
79
+ async function mountCard(): Promise<HTMLElement> {
80
+ container = document.createElement('div');
81
+ document.body.appendChild(container);
82
+ act(() => render(<AboutModal isOpen onClose={() => {}} updates={UPDATES} />, container!));
83
+ // The two catalog reads land after the first paint; the harness list only
84
+ // exists once the store reports it is done loading.
85
+ await act(() => delay(0));
86
+ const panel = document.querySelector('[role="dialog"][aria-label="About Kabmo"]');
87
+ if (!panel) throw new Error('About card did not mount');
88
+ return panel as HTMLElement;
89
+ }
90
+
91
+ describe('the About card frame', () => {
92
+ test('a floating card sized by the model picker’s cap, not the whole screen', async () => {
93
+ const panel = await mountCard();
94
+ // `h-full` was the full-bleed sheet: a card stretched to the screen's top
95
+ // edge is exactly what drew its header under the status bar.
96
+ expect(panel.classList.contains('h-full')).toBe(false);
97
+ expect(panel.style.getPropertyValue('--about-card-max')).toBe(`min(${MAX_WIDTH}px, 100%)`);
98
+ expect(panel.classList.contains('max-h-full')).toBe(true);
99
+ expect(panel.classList.contains('rounded-2xl')).toBe(true);
100
+ });
101
+
102
+ test('the card is centered with a capped height, never stretched', async () => {
103
+ const panel = await mountCard();
104
+ const backdrop = panel.parentElement!;
105
+ // `items-stretch` + `h-full` was the sheet; a stretched card has no gutter to
106
+ // keep the safe area clear, and no height cap to scroll inside.
107
+ expect(backdrop.className).toContain('items-center');
108
+ expect(backdrop.className).not.toContain('items-stretch');
109
+ expect(panel.classList.contains('max-h-full')).toBe(true);
110
+ });
111
+
112
+ test('exactly ONE scroll container inside the card', async () => {
113
+ const panel = await mountCard();
114
+ const scrollers = panel.querySelectorAll('.scrollbar-overlay-container');
115
+ expect(scrollers).toHaveLength(1);
116
+ // …and the harness list is not it.
117
+ const list = panel.querySelector('[data-harness-rows]');
118
+ expect(list).not.toBeNull();
119
+ expect(list!.classList.contains('scrollbar-overlay-container')).toBe(false);
120
+ expect(list!.classList.contains('overflow-y-auto')).toBe(false);
121
+ });
122
+ });