@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
@@ -0,0 +1,155 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The pending chat's dock is the REAL timeline's dock.
8
+ *
9
+ * The generating indicator is drawn from one component, but its height in the
10
+ * pane came from two different wrappers: the real timeline docked it in
11
+ * `ComposerDock` (`p-4 pt-1`), while the pending `new-…` chat kept the landing
12
+ * page's centred `p-8` column with a `space-y-3` stack. Measured with the
13
+ * built CSS at 1200x1400: the indicator sat **141px** above the pane's bottom
14
+ * while the spawn was in flight (`Loading…`) and **113px** once the run
15
+ * streamed (`Thinking…`) — the row jumped 28px at adoption, which is why the
16
+ * two states read as two different indicators.
17
+ *
18
+ * Both are `ComposerDockFrame` now. What this suite pins is that the frame is
19
+ * the ONE wrapper for the pending dock, that the indicator is inside it in both
20
+ * identity states, and that the landing page — which has no run to report — is
21
+ * the only state that keeps the centred column.
22
+ */
23
+
24
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
25
+ import { Window } from 'happy-dom';
26
+ import { h, render } from 'preact';
27
+ import { act } from 'preact/test-utils';
28
+
29
+ import { EmptyWorkspacePrompt } from '@/client/components/workspace/chat-timeline/EmptyWorkspacePrompt';
30
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
31
+ import { silenceRealtime, restoreRealtime } from '@/test-support/silent-socket';
32
+ import { resetHarnessesStore } from '@/client/hooks/models/harness-catalog';
33
+ import { invalidateModelsCache } from '@/shared/lib/models/client';
34
+
35
+ let container: HTMLElement;
36
+
37
+ beforeAll(() => {
38
+ installDomGlobals(new Window({ url: 'http://localhost' }));
39
+ // The composer measures its textarea through the BARE global (`auto-grow.ts`),
40
+ // which happy-dom only provides on the window it installed.
41
+ (globalThis as unknown as Record<string, unknown>).getComputedStyle = window.getComputedStyle.bind(window);
42
+ });
43
+ afterAll(() => restoreDomGlobals());
44
+
45
+ beforeEach(() => {
46
+ silenceRealtime();
47
+ resetHarnessesStore();
48
+ invalidateModelsCache();
49
+ globalThis.fetch = (async (input: RequestInfo | URL) => {
50
+ const url = String(input);
51
+ if (url.startsWith('/api/harness')) {
52
+ return Response.json({ harnesses: [], configs: {}, providerSupport: {} });
53
+ }
54
+ if (url.startsWith('/api/models')) {
55
+ return Response.json({ models: {}, modelList: [], selectedModel: null, defaultModel: null, thinkingLevels: {} });
56
+ }
57
+ return Response.json({});
58
+ }) as typeof fetch;
59
+ container = document.createElement('div');
60
+ document.body.appendChild(container);
61
+ });
62
+
63
+ afterEach(() => {
64
+ render(null, container);
65
+ container.remove();
66
+ restoreRealtime();
67
+ });
68
+
69
+ function mount(props: Record<string, unknown>) {
70
+ act(() => {
71
+ render(h(EmptyWorkspacePrompt, {
72
+ selectedFolderId: 1,
73
+ setSelectedFolderId: () => {},
74
+ inputValue: '',
75
+ setInputValue: () => {},
76
+ onSend: () => {},
77
+ isGenerating: false,
78
+ accessMode: 'always-ask',
79
+ onAccessModeChange: () => {},
80
+ composerModelRef: { current: null },
81
+ deferredComposerPickRef: { current: null },
82
+ ...props,
83
+ } as never), container);
84
+ });
85
+ return container;
86
+ }
87
+
88
+ /** The model catalog is read through a promise chain; one macrotask drains it. */
89
+ async function settle(): Promise<void> {
90
+ await act(async () => {
91
+ const { promise, resolve } = Promise.withResolvers<void>();
92
+ setTimeout(resolve, 30);
93
+ await promise;
94
+ });
95
+ }
96
+
97
+ const USER_ROW = { id: 'msg-1-user', role: 'user', content: 'halo', date: 'Today, 12:22 PM' };
98
+
99
+ describe('pending chat dock frame', () => {
100
+ test('the indicator rides the dock frame in both identity states', async () => {
101
+ // `Loading…` — the spawn has not answered, so neither half is known.
102
+ const loading = mount({ messages: [USER_ROW], isGenerating: true, generatingVerb: 'Thinking' });
103
+ await settle();
104
+ const loadingDock = loading.querySelector('[data-composer-dock]');
105
+ const loadingIndicator = loading.querySelector('#generating-docked-indicator');
106
+ expect(loadingDock).not.toBeNull();
107
+ expect(loadingIndicator).not.toBeNull();
108
+ expect(loadingDock!.contains(loadingIndicator!)).toBe(true);
109
+ expect(loading.textContent).toContain('Loading');
110
+
111
+ render(null, container);
112
+ // `Thinking…` — same run, identity resolved.
113
+ const thinking = mount({
114
+ messages: [USER_ROW],
115
+ isGenerating: true,
116
+ generatingVerb: 'Thinking',
117
+ provider: 'kenari',
118
+ modelName: 'DeepSeek V4',
119
+ });
120
+ await settle();
121
+ const thinkingDock = thinking.querySelector('[data-composer-dock]');
122
+ const thinkingIndicator = thinking.querySelector('#generating-docked-indicator');
123
+ expect(thinkingDock).not.toBeNull();
124
+ expect(thinkingDock!.contains(thinkingIndicator!)).toBe(true);
125
+ expect(thinking.textContent).toContain('Thinking');
126
+
127
+ // The one fact: no second wrapper may change between the two states.
128
+ expect(thinkingDock!.className).toBe(loadingDock!.className);
129
+ });
130
+
131
+ test('the frame carries the real dock padding on both layouts', async () => {
132
+ const desktop = mount({ messages: [USER_ROW], isGenerating: true });
133
+ await settle();
134
+ const desktopDock = desktop.querySelector('[data-composer-dock]') as HTMLElement;
135
+ // The dock's box, not the landing page's `p-8`.
136
+ expect(desktopDock.className).toContain('p-4');
137
+ expect(desktopDock.className).not.toContain('p-8');
138
+
139
+ render(null, container);
140
+ const mobile = mount({ messages: [USER_ROW], isGenerating: true, variant: 'mobile' });
141
+ await settle();
142
+ const mobileDock = mobile.querySelector('[data-composer-dock]') as HTMLElement;
143
+ expect(mobileDock.className).toContain('px-3');
144
+ expect(mobileDock.className).not.toContain('p-8');
145
+ });
146
+
147
+ test('the landing page keeps the centred column and draws no dock', async () => {
148
+ const el = mount({ messages: [], isGenerating: false });
149
+ await settle();
150
+ expect(el.querySelector('[data-composer-dock]')).toBeNull();
151
+ const column = el.firstElementChild?.firstElementChild as HTMLElement;
152
+ expect(column.className).toContain('my-auto');
153
+ expect(column.className).toContain('justify-center');
154
+ });
155
+ });
@@ -13,6 +13,7 @@ import { useChatTimeline } from '@/client/hooks/chat/timeline';
13
13
  import { useSessionTitle } from '@/client/hooks/chat/timeline/session-title';
14
14
  import { useSubagentView } from '@/client/hooks/chat/timeline/subagent-view';
15
15
  import { useUndoConfirmation } from '@/client/hooks/chat/timeline/undo-confirmation';
16
+ import { useForkSession } from '@/client/hooks/chat/timeline/use-fork-session';
16
17
  import { useModelNames } from '@/client/hooks/models/use-model-names';
17
18
  import { useRunIdentity } from '@/client/hooks/chat/timeline/run-identity';
18
19
  import { useProviderNames } from '@/client/hooks/models/use-provider-names';
@@ -113,7 +114,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
113
114
  [framesByTool, orphanAsks, respondToFrame],
114
115
  );
115
116
 
116
- const newChat = useNewChatOpen({ folders, sessionId, selectedFolderId });
117
+ const newChat = useNewChatOpen({ folders, sessionId, selectedFolderId, ...(activeHarness.harness ? { harness: activeHarness.harness } : {}) });
117
118
  const { pendingUndo, undoing, error: undoError, requestUndo: handleRequestUndo, closeUndoConfirm, confirmUndo } = useUndoConfirmation(handleUndo);
118
119
  const [searchParams, setSearchParams] = useSearchParams();
119
120
 
@@ -148,7 +149,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
148
149
  }, [jumpToUserTurn]);
149
150
 
150
151
  const handleNewChat = newChat.open;
151
-
152
+ const handleFork = useForkSession(sessionId, pushToast);
152
153
  const modelNames = useModelNames();
153
154
  const { sessionProvider, sessionModelName } = useRunIdentity({ folders, sessionId, sessionData, modelNames });
154
155
  const providerNames = useProviderNames();
@@ -266,6 +267,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
266
267
  onUndo={handleRequestUndo}
267
268
  onRetry={handleRetry}
268
269
  onNewChat={handleNewChat}
270
+ onFork={handleFork}
269
271
  showScrollBottom={showScrollBottom}
270
272
  jumpToBottom={jumpToBottom}
271
273
  rowWindow={rowWindow}
@@ -330,6 +332,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
330
332
  isOmpSession={Boolean(sessionId) && !sessionId.startsWith('new-') && Number.isNaN(Number(sessionId))}
331
333
  newChatInitialContent={newChat.content}
332
334
  newChatInitialAttachments={newChat.attachments}
335
+ newChatHarness={newChat.harness}
333
336
  onCloseNewChat={newChat.close}
334
337
  onSendNewChat={submitNewChat}
335
338
  appSettings={appSettings}
@@ -25,7 +25,7 @@ import { act } from 'preact/test-utils';
25
25
  import { EmptyWorkspacePrompt } from '@/client/components/workspace/chat-timeline/EmptyWorkspacePrompt';
26
26
  import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
27
27
  import { silenceRealtime, restoreRealtime } from '@/test-support/silent-socket';
28
- import { resetHarnessesStore } from '@/client/hooks/models/use-harnesses';
28
+ import { resetHarnessesStore } from '@/client/hooks/models/harness-catalog';
29
29
  import { invalidateModelsCache } from '@/shared/lib/models/client';
30
30
  import type { HarnessSummary } from '@/shared/types/harness';
31
31
 
@@ -76,7 +76,7 @@ export function FrameControl({ frame, multi, selected, onAnswer, onToggle, onRes
76
76
  <textarea
77
77
  autoFocus
78
78
  value={text}
79
- onChange={(event) => setText(event.currentTarget.value)}
79
+ onInput={(event) => setText(event.currentTarget.value)}
80
80
  rows={4}
81
81
  placeholder={frame.placeholder || 'Type your answer…'}
82
82
  className="w-full rounded-md border border-ink/15 bg-canvas/40 px-2.5 py-1.5 font-mono text-[11.5px] leading-relaxed text-ink outline-none focus:border-ink"
@@ -87,7 +87,7 @@ export function FrameControl({ frame, multi, selected, onAnswer, onToggle, onRes
87
87
  type={frame.secret === true ? 'password' : 'text'}
88
88
  value={text}
89
89
  placeholder={frame.placeholder || 'Type your answer…'}
90
- onChange={(event) => setText(event.currentTarget.value)}
90
+ onInput={(event) => setText(event.currentTarget.value)}
91
91
  onKeyDown={(event) => {
92
92
  if (event.key !== 'Enter') return;
93
93
  event.preventDefault();
@@ -115,9 +115,6 @@ export function FrameControl({ frame, multi, selected, onAnswer, onToggle, onRes
115
115
  return (
116
116
  <div className="mt-2 space-y-1" role={multi ? 'group' : 'radiogroup'}>
117
117
  {options.map((label, index) => {
118
- // A single-choice question resolves "Other" to the typed text, so the
119
- // row itself is a prompt to type — never a literal answer.
120
- if (!multi && isOtherOption(label)) return null;
121
118
  const checked = multi && selected.includes(label);
122
119
  const finish = multi && DONE_ROW.test(label);
123
120
  return (
@@ -129,24 +126,18 @@ export function FrameControl({ frame, multi, selected, onAnswer, onToggle, onRes
129
126
  checked={checked}
130
127
  suggested={RECOMMENDED.test(label) && !multi}
131
128
  emphasis={finish}
132
- onClick={() => (multi ? (finish ? onRespond({ value: label }) : onToggle(label)) : onAnswer(label))}
129
+ onClick={() => {
130
+ // 18.18.3 accepts only a label it OFFERED: a typed answer sent in
131
+ // place of the "Other" row matches no index and cancels the whole
132
+ // ask. Choosing the row is what opens omp's free-text `input`, and
133
+ // that dialog answers in the same question's group.
134
+ if (!multi && isOtherOption(label)) onRespond({ value: label });
135
+ else if (multi) (finish ? onRespond({ value: label }) : onToggle(label));
136
+ else onAnswer(label);
137
+ }}
133
138
  />
134
139
  );
135
140
  })}
136
-
137
- {!multi && (
138
- <input
139
- value={text}
140
- placeholder="Other: type your own answer…"
141
- onChange={(event) => setText(event.currentTarget.value)}
142
- onKeyDown={(event) => {
143
- if (event.key !== 'Enter' || !text.trim()) return;
144
- event.preventDefault();
145
- onAnswer(text.trim());
146
- }}
147
- className="w-full rounded-md border border-ink/15 bg-canvas/40 px-2.5 py-1.5 text-[11.5px] text-ink outline-none focus:border-ink"
148
- />
149
- )}
150
141
  </div>
151
142
  );
152
143
  }
@@ -32,7 +32,7 @@ import { useMemo, useState } from 'preact/hooks';
32
32
  import type { ComponentChildren } from 'preact';
33
33
  import { CornerDownLeft } from 'lucide-preact';
34
34
  import type { ExtensionAskQuestion, ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
35
- import type { AskAnswer } from '@/shared/lib/chat/ask-questions';
35
+ import type { AskAnswer } from '@/shared/lib/chat/ask-form/types';
36
36
  import { AnswerList, QuestionCard } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard';
37
37
  import { OptionRow } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow';
38
38
  import type { ExtensionDialogResponse } from '@/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Lazy';
@@ -18,7 +18,7 @@
18
18
  import { Ban, CheckCircle2, Clock } from 'lucide-preact';
19
19
  import type { ComponentChildren } from 'preact';
20
20
  import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
21
- import type { AskAnswer, AskQuestion } from '@/shared/lib/chat/ask-questions';
21
+ import type { AskAnswer, AskQuestion } from '@/shared/lib/chat/ask-form/types';
22
22
  import { FrameControl } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl';
23
23
  import { AnswerList, QuestionCard } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard';
24
24
  import type { ExtensionDialogResponse } from '@/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Lazy';
@@ -20,7 +20,7 @@
20
20
 
21
21
  import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
22
22
  import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
23
- import type { AskAnswer, AskQuestion } from '@/shared/lib/chat/ask-questions';
23
+ import type { AskAnswer, AskQuestion } from '@/shared/lib/chat/ask-form/types';
24
24
  import type { ExtensionDialogResponse } from '@/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Lazy';
25
25
 
26
26
  interface UseAskDraftsOptions {
@@ -26,7 +26,8 @@ import { useState } from 'preact/hooks';
26
26
  import { HelpCircle, XCircle } from 'lucide-preact';
27
27
  import type { ToolCallData } from '@/shared/types';
28
28
  import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
29
- import { isAskSettled, parseAskQuestions, parseAskResult } from '@/shared/lib/chat/ask-questions';
29
+ import { isAskSettled, parseAskQuestions } from '@/shared/lib/chat/ask-questions';
30
+ import { parseAskResult } from '@/shared/lib/chat/ask-results';
30
31
  import { useAskFrames } from '@/client/hooks/chat/timeline/ask-frames';
31
32
  import { liveFrame, useAskDrafts } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts';
32
33
  import { QuestionBlock } from '@/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock';
@@ -60,6 +60,31 @@ describe('Files panel listing', () => {
60
60
  expect(panel.container.textContent).toContain('keep.ts');
61
61
  });
62
62
 
63
+ test('reopening the panel re-reads the root and the open folders, so hidden-time edits appear', async () => {
64
+ panel.disk = { '.': { src: null }, src: { 'keep.ts': 'file', 'gone.ts': 'file' } };
65
+ panel.dirReads = [];
66
+ await panel.mount();
67
+ await panel.clickRow('src');
68
+ expect(panel.container.textContent).toContain('gone.ts');
69
+
70
+ // The right column is collapsed, or another view is on screen: the layout
71
+ // keeps this panel MOUNTED and hidden, so nothing here reads while the
72
+ // filesystem moves underneath it.
73
+ await panel.setActive(false);
74
+ delete panel.disk['src']!['gone.ts'];
75
+ panel.disk['.']!['added.ts'] = 'file';
76
+ panel.dirReads = [];
77
+
78
+ await panel.setActive(true);
79
+
80
+ // Reopening IS a read — of the root AND of every folder still expanded —
81
+ // so the deleted row is gone and the new one is drawn.
82
+ expect(panel.dirReads).toContain('.');
83
+ expect(panel.dirReads).toContain('src');
84
+ expect(panel.container.textContent).toContain('added.ts');
85
+ expect(panel.container.textContent).not.toContain('gone.ts');
86
+ });
87
+
63
88
  test('an expanded empty folder is read once, and expanding a sibling does not re-read it', async () => {
64
89
  panel.disk = { '.': { empty: null, keep: null }, empty: {}, keep: { 'a.ts': 'file' } };
65
90
  panel.dirReads = [];
@@ -21,7 +21,7 @@ import { fsTopic } from '@/shared/lib/realtime/protocol';
21
21
  import { unfoldChains } from '@/shared/lib/fs/folder-chain';
22
22
  import { useRootDropTarget } from '@/client/hooks/workspace/root-drop-target';
23
23
 
24
- export function FileExplorer({ className = '', enabled = true, rootPath, onOpenFile, refreshKey = 0, onRefresh }: { className?: string, enabled?: boolean, rootPath?: string, onOpenFile?: (file: any) => void, refreshKey?: number, onRefresh?: () => void }) {
24
+ export function FileExplorer({ className = '', enabled = true, active = true, rootPath, onOpenFile, refreshKey = 0, onRefresh }: { className?: string, enabled?: boolean, active?: boolean, rootPath?: string, onOpenFile?: (file: any) => void, refreshKey?: number, onRefresh?: () => void }) {
25
25
  const [searchQuery, setSearchQuery] = useSessionState<string>('files.searchQuery', '');
26
26
  const [storedExpandedPaths, setStoredExpandedPaths, expandedPathsReady] = useSessionState<string[]>('files.expandedPaths', []);
27
27
  const [expandedPaths, setExpandedPaths] = useState<Set<string>>(() => new Set(storedExpandedPaths));
@@ -56,12 +56,18 @@ export function FileExplorer({ className = '', enabled = true, rootPath, onOpenF
56
56
  });
57
57
 
58
58
  useEffect(() => {
59
- if (!expandedPathsReady) return;
59
+ if (!expandedPathsReady || !active) return;
60
60
  void listing.reload();
61
61
  // `listing.reload` reads the current scope and expansion set off refs, so
62
62
  // the effect is keyed on what should trigger a read, not on the callback.
63
+ // `active` is one of them: the layout keeps this view MOUNTED while the
64
+ // right column is collapsed (or another view is on screen), so without it a
65
+ // reopened panel would draw the tree it read when it was last looked at —
66
+ // a file added, deleted or renamed outside this panel in between would not
67
+ // be there. While inactive the panel starts no reload of its own; being
68
+ // shown again IS the read.
63
69
  // eslint-disable-next-line react-hooks/exhaustive-deps
64
- }, [refreshKey, rootPath, enabled, activeRepo, expandedPathsReady]);
70
+ }, [refreshKey, rootPath, enabled, activeRepo, expandedPathsReady, active]);
65
71
 
66
72
  // The ROOT listing rides the `fs:<root>\0<repo>` topic: the server pushes a
67
73
  // fresh read when a run's work may have touched the tree. Expanded CHILDREN
@@ -124,6 +124,23 @@ describe('harness model lists', () => {
124
124
  const list = harnessModels([probed('claude', [{ value: 'opus', name: 'Opus' }])], 'claude', ompModels);
125
125
  expect(list.models[0]?.thinkingLevels).toBeUndefined();
126
126
  });
127
+
128
+ test('the open chat’s own lists outrank the one-spawn probe', () => {
129
+ // codex refuses a probe while a chat runs, and the probe's blocked message
130
+ // then sat beside rows that chat was already offering.
131
+ const summary: HarnessSummary = {
132
+ id: 'codex', label: 'codex', transport: 'acp', canLaunch: true, enabled: true,
133
+ probe: probed('codex', [{ value: 'probe-only', name: 'Probe only' }]).probe,
134
+ unavailable: 'Probe refused',
135
+ };
136
+ const list = harnessModels([summary], 'codex', ompModels, {
137
+ models: [{ value: 'openai/gpt-5', name: 'GPT-5' }],
138
+ thinking: [{ value: 'medium', name: 'Medium' }],
139
+ });
140
+ expect(list.models.map((model) => model.id)).toEqual(['gpt-5']);
141
+ expect(list.models[0]?.thinkingLevels).toEqual(['medium']);
142
+ expect(list.blocked).toBeUndefined();
143
+ });
127
144
  });
128
145
 
129
146
  describe('which harnesses the picker offers', () => {
@@ -12,26 +12,26 @@
12
12
  * omp's list under the `claude` tab would offer a model that agent cannot run,
13
13
  * and picking it would fail at the first prompt.
14
14
  *
15
- * The rule is therefore: **the active tab decides the list.** Two sources exist
16
- * and only two:
15
+ * The rule is therefore: **the active tab decides the list.** Three sources
16
+ * exist, and they are ranked:
17
17
  *
18
18
  * - `omp-rpc` — Kabmo's `/api/models` (today's list, with favorites, recents
19
19
  * and the provider plates), because that registry IS omp's;
20
- * - every ACP harness — the `models[]` its own `session/new` returned, mapped
21
- * into the same `AIModelOption` shape so the rows render identically.
20
+ * - an ACP harness with a LIVE chat — the selectors that session itself
21
+ * published (`get_state` → `configOptions`), because that is the list the
22
+ * agent is offering right now. A probe runs its OWN spawn, so it can refuse
23
+ * (codex asks for authentication in the probe while the chat that is
24
+ * already running lists its models) and its answer ages;
25
+ * - an ACP harness with no live chat — the `models[]` its own probe
26
+ * `session/new` returned, mapped into the same `AIModelOption` shape so the
27
+ * rows render identically.
22
28
  *
23
- * An unprobed ACP harness yields an EMPTY list plus the reason, never omp's
29
+ * An ACP harness with neither yields an EMPTY list plus the reason, never omp's
24
30
  * models as a stand-in.
25
31
  */
26
32
 
27
33
  import type { AIModelOption } from '@/shared/types';
28
- import type { HarnessSummary } from '@/shared/types/harness';
29
-
30
- /** An `<option>`-style pair, as `configOptions` publishes them. */
31
- export interface HarnessModelOption {
32
- value: string;
33
- name: string;
34
- }
34
+ import type { HarnessSelectorValue, HarnessSummary, LiveHarnessModels } from '@/shared/types/harness';
35
35
 
36
36
  export interface HarnessModelList {
37
37
  /** Exactly the rows to render — never a union of two harnesses' catalogs. */
@@ -56,9 +56,9 @@ function splitSelector(value: string): { provider: string; id: string } {
56
56
 
57
57
  /** Map one ACP selector value into the picker's row shape. */
58
58
  export function acpModelOption(
59
- option: HarnessModelOption,
59
+ option: HarnessSelectorValue,
60
60
  harness: string,
61
- thinking: readonly HarnessModelOption[] = [],
61
+ thinking: readonly HarnessSelectorValue[] = [],
62
62
  ): AIModelOption {
63
63
  const { provider, id } = splitSelector(option.value);
64
64
  return {
@@ -86,11 +86,15 @@ export function acpModelOption(
86
86
  * recents and the provider plates the user built up. Any other harness REPLACES
87
87
  * it — never merges: two agents' models in one list is a row the tab does not
88
88
  * describe.
89
+ *
90
+ * `live` is what the OPEN chat's own session published, when it is running on
91
+ * this harness. It wins over `probe` (see the module header).
89
92
  */
90
93
  export function harnessModels(
91
94
  harnesses: readonly HarnessSummary[],
92
95
  harness: string | undefined,
93
96
  ompModels: readonly AIModelOption[] = [],
97
+ live?: LiveHarnessModels | null,
94
98
  ): HarnessModelList {
95
99
  // No harness yet (a brand-new chat) → omp's registry, which is the default
96
100
  // agent and therefore the honest preview.
@@ -98,11 +102,22 @@ export function harnessModels(
98
102
 
99
103
  const summary = harnesses.find((entry) => entry.id === harness);
100
104
  if (!summary) return { models: [], unprobed: true };
101
- const blocked = summary.probe?.capabilities.blocked ?? summary.unavailable;
102
- if (!summary.probe) return { models: [], unprobed: true, ...(blocked ? { blocked } : {}) };
105
+
106
+ // What the OPEN CHAT published outranks what one spawn measured: the live
107
+ // session is the one about to receive the pick.
108
+ const liveModels = live?.models ?? [];
109
+ const published = liveModels.length > 0 ? liveModels : (summary.probe?.models ?? []);
110
+ const thinking = live?.thinking?.length ? live.thinking : (summary.probe?.thinking ?? []);
111
+ if (published.length === 0) {
112
+ const blocked = summary.probe?.capabilities.blocked ?? summary.unavailable;
113
+ return { models: [], unprobed: !summary.probe, ...(blocked ? { blocked } : {}) };
114
+ }
115
+ // A block is evidence about a DIFFERENT spawn; saying "Authentication
116
+ // required" beside rows the running chat is offering would contradict the list
117
+ // it sits on, so only an uninstalled harness keeps its refusal here.
118
+ const blocked = liveModels.length > 0 ? undefined : summary.unavailable;
103
119
  return {
104
- models: (summary.probe.models ?? []).map((option) =>
105
- acpModelOption(option, harness, summary.probe?.thinking ?? [])),
120
+ models: published.map((option) => acpModelOption(option, harness, thinking)),
106
121
  unprobed: false,
107
122
  ...(blocked ? { blocked } : {}),
108
123
  };
@@ -47,7 +47,7 @@ export function ModelDropdown({
47
47
  harnessEditable = true,
48
48
  isMobile,
49
49
  }: ModelDropdownProps) {
50
- const { harnesses } = useHarnesses();
50
+ const { harnesses, liveModels } = useHarnesses();
51
51
  /**
52
52
  * The harness whose list is on screen.
53
53
  *
@@ -88,8 +88,8 @@ export function ModelDropdown({
88
88
  * at the first prompt.
89
89
  */
90
90
  const harnessList = useMemo(
91
- () => harnessModels(harnesses, activeHarness, models),
92
- [harnesses, activeHarness, models],
91
+ () => harnessModels(harnesses, activeHarness, models, liveModels[activeHarness]),
92
+ [harnesses, activeHarness, models, liveModels],
93
93
  );
94
94
  /** The tabs this picker may offer, from the same rule the model rows use. */
95
95
  const tabsForPicker = pickerHarnesses(harnesses, activeHarness);
@@ -34,8 +34,11 @@ const GUTTER = 8;
34
34
  * marks, the model name, a context figure, a thinking chip and a favourite star,
35
35
  * and `Agnes-2-5-Flash - Free` measured `scrollWidth 139 / clientWidth 0` once
36
36
  * the trailing plates took their share.
37
+ *
38
+ * Exported because the About card sizes itself to this same cap: the console has
39
+ * one width class for its floating cards, and a second number there would drift.
37
40
  */
38
- const MAX_WIDTH = 512;
41
+ export const MAX_WIDTH = 512;
39
42
  /** Narrowest it is allowed to get before it stops being usable. */
40
43
  const MIN_WIDTH = 240;
41
44
  /**
@@ -47,15 +47,17 @@ const ARMED_CLASS = 'bg-ink text-canvas border-ink';
47
47
  * **Copy and Paste stand in for Cmd+C / Cmd+V**, which is what those chords mean
48
48
  * in a terminal and the one thing a phone genuinely cannot do: it has no
49
49
  * selection to right-click and no paste without a long-press the terminal canvas
50
- * does not offer. There is no raw Cmd button because xterm discards `metaKey`
51
- * on every key but Cmd+A (`if (ev.metaKey) break;`, which routes Cmd+A to
52
- * select-all) — a Cmd button would send nothing, while the Cmd chords the user
53
- * does have keep working untouched. Copy reports when there was no selection
54
- * rather than flashing a check for a clipboard it did not fill.
50
+ * does not offer. There is no raw Cmd button because the renderer treats Cmd as
51
+ * the host's modifier, not the terminal's: a printable character with `metaKey`
52
+ * set sends nothing (`isPrintableCharacter` returns false), and Cmd+C / Cmd+V
53
+ * are its own copy and paste. A Cmd button would therefore send nothing, while
54
+ * the Cmd chords the user does have keep working untouched. Copy reports when
55
+ * there was no selection rather than flashing a check for a clipboard it did not
56
+ * fill.
55
57
  *
56
- * `pointerdown` is swallowed so tapping a key never moves focus out of xterm's
57
- * hidden textarea: blurring it closes the OS keyboard, and a key bar that makes
58
- * the keyboard disappear is worse than no key bar.
58
+ * `pointerdown` is swallowed so tapping a key never moves focus out of the
59
+ * renderer's hidden input: blurring it closes the OS keyboard, and a key bar
60
+ * that makes the keyboard disappear is worse than no key bar.
59
61
  *
60
62
  * Wrapping, not horizontal scrolling. The diff toolbar taught that a
61
63
  * `no-scrollbar` overflow hides actions with nothing on screen to say so