@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,206 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `@harness` delegation mentions in the composer.
8
+ *
9
+ * A mention is a commitment, not a suggestion: `@harness:claude` (or bare
10
+ * `@claude`) names the agent that must do the paragraph's work, and the text of
11
+ * that paragraph is its whole brief. The parser turns a message into a
12
+ * delegation plan the orchestrator can execute with the CLI, so the model never
13
+ * has to guess a harness, a model or which words were the task.
14
+ *
15
+ * Namespaced `harness:` cannot collide with `@file:` or an omp `@agent`; a bare
16
+ * `@claude` is accepted only when the token is a known harness id and is not a
17
+ * known agent name.
18
+ */
19
+
20
+ import { HARNESS_CATALOG, HARNESS_IDS, type HarnessId } from '@/shared/lib/harness/catalog';
21
+
22
+ export interface HarnessDelegation {
23
+ harness: HarnessId;
24
+ /** The agent's own model value, or null for the harness default. */
25
+ model: string | null;
26
+ task: string;
27
+ /** The exact token the user typed, for diagnostics and display. */
28
+ token: string;
29
+ }
30
+
31
+ export type DelegationErrorCode = 'unknown_harness' | 'empty_task' | 'multiple_mentions';
32
+
33
+ export interface DelegationError {
34
+ code: DelegationErrorCode;
35
+ message: string;
36
+ paragraph: string;
37
+ }
38
+
39
+ export interface DelegationPlan {
40
+ delegations: HarnessDelegation[];
41
+ /** The paragraphs that stay with the orchestrator, mentions removed. */
42
+ orchestratorText: string;
43
+ errors: DelegationError[];
44
+ }
45
+
46
+ export interface ParseDelegationOptions {
47
+ /** Bare `@name` is an omp agent when it matches one of these. */
48
+ agentNames?: readonly string[];
49
+ }
50
+
51
+ /** `@harness:<id>[:<model>]` or bare `@<harnessId>`. */
52
+ const MENTION_RE = /(^|[\s([{])@(?:(harness):)?([a-z0-9][a-z0-9-]*)(?::([^\s#]+))?/gi;
53
+
54
+ /** The names users type that are not catalog ids. `omp` is the default RPC
55
+ * surface; `claude-code` is the vendor's name for the `claude` adapter. */
56
+ const HARNESS_ALIASES: Readonly<Record<string, HarnessId>> = {
57
+ omp: 'omp-rpc',
58
+ 'claude-code': 'claude',
59
+ };
60
+
61
+ function harnessIdFor(name: string): HarnessId | null {
62
+ return HARNESS_ALIASES[name] ?? (HARNESS_IDS.includes(name as HarnessId) ? (name as HarnessId) : null);
63
+ }
64
+
65
+ /**
66
+ * Parse one message. The error list is non-empty when the message cannot be
67
+ * delegated as written; the caller refuses the send rather than guessing.
68
+ */
69
+ export function parseHarnessMentions(
70
+ text: string,
71
+ options: ParseDelegationOptions = {},
72
+ ): DelegationPlan {
73
+ const agentNames = new Set((options.agentNames ?? []).map((name) => name.toLowerCase()));
74
+ const paragraphs = text.split(/\n\s*\n/);
75
+ const delegations: HarnessDelegation[] = [];
76
+ const kept: string[] = [];
77
+ const errors: DelegationError[] = [];
78
+
79
+ for (const paragraph of paragraphs) {
80
+ const matches: { start: number; end: number; harness: HarnessId; model: string | null; token: string }[] = [];
81
+ MENTION_RE.lastIndex = 0;
82
+ for (const match of paragraph.matchAll(MENTION_RE)) {
83
+ const namespace = match[2]?.toLowerCase();
84
+ const name = match[3]?.toLowerCase();
85
+ if (!name) continue;
86
+ const isBare = namespace === undefined;
87
+ const known = harnessIdFor(name);
88
+ if (namespace && !known) {
89
+ errors.push({
90
+ code: 'unknown_harness',
91
+ message: `Unknown harness "${name}"`,
92
+ paragraph,
93
+ });
94
+ continue;
95
+ }
96
+ if (!known) continue;
97
+ if (isBare && agentNames.has(name)) continue;
98
+ const tokenStart = (match.index ?? 0) + (match[1]?.length ?? 0);
99
+ const token = match[0].slice(match[1]?.length ?? 0);
100
+ matches.push({
101
+ start: tokenStart,
102
+ end: tokenStart + token.length,
103
+ harness: known,
104
+ model: match[4] ?? null,
105
+ token,
106
+ });
107
+ }
108
+
109
+ if (matches.length === 0) {
110
+ if (paragraph.trim()) kept.push(paragraph.trim());
111
+ continue;
112
+ }
113
+ if (matches.length > 1) {
114
+ errors.push({
115
+ code: 'multiple_mentions',
116
+ message: 'One paragraph can delegate to one harness; separate workers with a blank line',
117
+ paragraph,
118
+ });
119
+ continue;
120
+ }
121
+
122
+ const mention = matches[0];
123
+ const task = `${paragraph.slice(0, mention.start)}${paragraph.slice(mention.end)}`
124
+ .replace(/\s+/g, ' ')
125
+ .replace(/^[\s,;:-]+/, '')
126
+ .trim();
127
+ if (!task) {
128
+ errors.push({
129
+ code: 'empty_task',
130
+ message: `@${mention.token.replace(/^@/, '')} needs a task in the same paragraph`,
131
+ paragraph,
132
+ });
133
+ continue;
134
+ }
135
+ delegations.push({
136
+ harness: mention.harness,
137
+ model: mention.model,
138
+ task,
139
+ token: mention.token,
140
+ });
141
+ }
142
+
143
+ // A message that is only an unknown `@harness:` is an error, not prose.
144
+ if (errors.length > 0) {
145
+ return { delegations: [], orchestratorText: text.trim(), errors };
146
+ }
147
+ return {
148
+ delegations,
149
+ orchestratorText: kept.join('\n\n'),
150
+ errors,
151
+ };
152
+ }
153
+
154
+ /** The exact command an orchestrator runs, with the task in a heredoc. */
155
+ export function delegationCommand(delegation: HarnessDelegation, index: number): string {
156
+ const tag = `KABMO_TASK_${index + 1}`;
157
+ const model = delegation.model ? ` --model ${delegation.model}` : '';
158
+ return [
159
+ `kabmo session spawn --parent-self --harness ${delegation.harness}${model} --prompt-file - <<'${tag}'`,
160
+ delegation.task,
161
+ tag,
162
+ ].join('\n');
163
+ }
164
+
165
+ /**
166
+ * The block prepended to the orchestrator's own prompt. It names every worker,
167
+ * gives the exact spawn command, and states the one behaviour the host cannot
168
+ * enforce by itself: end the turn instead of polling.
169
+ */
170
+ export function formatDelegationPrompt(plan: DelegationPlan): string {
171
+ const lines = [
172
+ '[kabmo orchestration contract]',
173
+ 'You are the orchestrator for this message. Start each worker below with the exact command,',
174
+ 'then end your turn. A worker sees nothing of this conversation: its TASK is the whole brief.',
175
+ 'Kabmo adds the dispatched-worker preamble and sends each worker outcome back as a new',
176
+ 'message. Do not poll, do not resend the same task, and do not delegate work that is not',
177
+ 'listed here unless the user asks.',
178
+ '',
179
+ 'Workers:',
180
+ ];
181
+ plan.delegations.forEach((delegation, index) => {
182
+ const model = delegation.model ?? 'default model';
183
+ lines.push(
184
+ '',
185
+ `${index + 1}. ${HARNESS_CATALOG[delegation.harness]?.label ?? delegation.harness} · ${model}`,
186
+ delegationCommand(delegation, index),
187
+ );
188
+ });
189
+ lines.push(
190
+ '',
191
+ 'When a worker finishes, read its output with `kabmo session output <id>` and report the',
192
+ 'result to the user. Reconcile conflicting reports; do not relay one verbatim.',
193
+ '[/kabmo orchestration contract]',
194
+ );
195
+ if (plan.orchestratorText) lines.push('', plan.orchestratorText);
196
+ return lines.join('\n');
197
+ }
198
+
199
+ /** A user-facing refusal, or null when the message can be sent. */
200
+ export function delegationErrorText(plan: DelegationPlan): string | null {
201
+ if (plan.errors.length === 0) return null;
202
+ return plan.errors
203
+ .map((error) => error.message)
204
+ .filter((message, index, all) => all.indexOf(message) === index)
205
+ .join(' · ');
206
+ }
@@ -17,7 +17,7 @@
17
17
  * runs and half-block progress bars. The notice card renders markdown through
18
18
  * Shiki, which treats `\x1b[38;2;…m` as literal text, so `/context` drew 48
19
19
  * escape bytes as `38;2;107;114;128m████…`. True colour stays available in the
20
- * realtime xterm panel, which parses ANSI natively.
20
+ * realtime terminal panel, which parses ANSI natively.
21
21
  * - **`<system-notice>` wrappers.** omp tags its own notices; the tag is
22
22
  * scaffolding, not content. (The runtime-notice wrappers —
23
23
  * `<system-reminder>`, `<system-interrupt>`, `<task-result>` — are NOT
@@ -23,6 +23,7 @@ import {
23
23
  queueStreamingUpdate,
24
24
  } from '@/shared/lib/chat/timeline/stream-coalescer';
25
25
  import { appendNoticeRow } from '@/shared/lib/chat/timeline/command-output';
26
+ import { reportPromptError } from '@/shared/lib/chat/timeline/prompt-error';
26
27
  import { retryNotice } from '@/shared/lib/chat/timeline/provider-retry';
27
28
  import { handleAgentStart, handleResumeStream, handleTurnStart } from '@/shared/lib/chat/timeline/run-signals';
28
29
  import { isAnswerableUiRequest } from '@/shared/lib/omp/dialog-methods';
@@ -271,8 +272,13 @@ export function createOmpAgentCallbacks(deps: OmpAgentCallbacksDeps): OmpAgentCa
271
272
  if (sid) setTimeout(() => refreshSessionMeta(sid), 150);
272
273
  },
273
274
  onPromptError: (errorMessage) => {
275
+ // Drop queued stream updates first: any frame from the failed run that
276
+ // has not been folded yet would resurrect partial content beside the row
277
+ // this error is about to mark.
278
+ disposeStreamingCoalescer();
274
279
  setGenerating(false);
275
280
  abortControllerRef.current = null;
281
+ reportPromptError(errorMessage, deps);
276
282
  console.error('OMP prompt error:', errorMessage);
277
283
  },
278
284
  // The prompt ran a built-in slash command (omp answered on the command
@@ -312,8 +318,14 @@ export function createOmpAgentCallbacks(deps: OmpAgentCallbacksDeps): OmpAgentCa
312
318
  const sid = adoptedSessionIdRef.current ?? sessionIdRef.current;
313
319
  if (sid) refreshSessionMeta(sid);
314
320
  },
315
- onNotice: (_level, message) => {
321
+ onNotice: (level, message) => {
316
322
  console.info('OMP notice:', message);
323
+ // A warning/error notice is the only place some transports report why a
324
+ // turn went nowhere (ACP can push an error `notice` instead of failing
325
+ // the prompt). A console line is not a surface the operator reads.
326
+ if ((level === 'error' || level === 'warning') && message.trim()) {
327
+ appendNoticeRow(message, deps);
328
+ }
317
329
  },
318
330
  onExtensionUiRequest: (request: IncomingExtensionUiRequest) => {
319
331
  // The blocking-method list is SHARED with the server
@@ -0,0 +1,146 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * A prompt failure the timeline must DRAW.
8
+ *
9
+ * ACP's silent turn emits `prompt_error` with no `message_end`; before this the
10
+ * callback only logged it, so the assistant bubble stayed empty and the reason
11
+ * was invisible. These cases pin where the failure lands: the optimistic row it
12
+ * would have streamed into, or a dedicated row when the run already answered.
13
+ */
14
+
15
+ import { describe, expect, test } from 'bun:test';
16
+ import type { ChatMessageData } from '@/shared/types';
17
+ import { reportPromptError, type PromptErrorDeps } from '@/shared/lib/chat/timeline/prompt-error';
18
+ import {
19
+ createOmpAgentCallbacks,
20
+ type OmpAgentCallbacksDeps,
21
+ } from '@/shared/lib/chat/timeline/omp-callbacks';
22
+
23
+ interface MountedPromptError {
24
+ deps: PromptErrorDeps;
25
+ ref: { current: string | null };
26
+ rows: () => ChatMessageData[];
27
+ persisted: () => ChatMessageData[][];
28
+ }
29
+
30
+ function mount(messages: ChatMessageData[], placeholderId: string | null = null): MountedPromptError {
31
+ let rows = messages;
32
+ const persisted: ChatMessageData[][] = [];
33
+ const ref = { current: placeholderId };
34
+ const deps = {
35
+ setLocalMessages: (update: ChatMessageData[] | ((prev: ChatMessageData[]) => ChatMessageData[])) => {
36
+ rows = typeof update === 'function' ? update(rows) : update;
37
+ },
38
+ aiPlaceholderIdRef: ref,
39
+ persistMessages: (next: ChatMessageData[]) => {
40
+ persisted.push(next);
41
+ },
42
+ };
43
+ return {
44
+ deps,
45
+ ref,
46
+ rows: () => rows,
47
+ persisted: () => persisted,
48
+ };
49
+ }
50
+
51
+ const userRow: ChatMessageData = { id: 'u1', role: 'user', content: 'hello' };
52
+
53
+ describe('reportPromptError', () => {
54
+ test('marks the empty optimistic row and disarms the placeholder', () => {
55
+ const probe = mount([userRow, { id: 'ai1', role: 'ai', content: '' }], 'ai1');
56
+ reportPromptError('The agent ended the turn without sending an answer', probe.deps);
57
+
58
+ expect(probe.ref.current).toBeNull();
59
+ expect(probe.rows()).toHaveLength(2);
60
+ expect(probe.rows()[1]?.error).toEqual({ message: 'The agent ended the turn without sending an answer' });
61
+ expect(probe.persisted()).toHaveLength(1);
62
+ });
63
+
64
+ test('a completed answer is not relabelled as the failure', () => {
65
+ const probe = mount([userRow, { id: 'ai1', role: 'ai', content: 'the answer' }]);
66
+ reportPromptError('agent crashed', probe.deps);
67
+
68
+ expect(probe.rows()).toHaveLength(3);
69
+ expect(probe.rows()[1]?.error).toBeUndefined();
70
+ expect(probe.rows()[2]?.error).toEqual({ message: 'agent crashed' });
71
+ });
72
+
73
+ test('a blank trailing row adopts the error instead of stacking a card', () => {
74
+ const probe = mount([userRow, { id: 'ai1', role: 'ai', content: '' }]);
75
+ reportPromptError('agent crashed', probe.deps);
76
+
77
+ expect(probe.rows()).toHaveLength(2);
78
+ expect(probe.rows()[1]?.error).toEqual({ message: 'agent crashed' });
79
+ });
80
+
81
+ test('the same failure arriving twice does not stack two cards', () => {
82
+ const probe = mount([userRow, { id: 'ai1', role: 'ai', content: 'the answer' }]);
83
+ reportPromptError('agent crashed', probe.deps);
84
+ reportPromptError('agent crashed', probe.deps);
85
+
86
+ expect(probe.rows()).toHaveLength(3);
87
+ });
88
+
89
+ test('the first, specific reason survives a later generic one', () => {
90
+ const probe = mount([userRow, { id: 'ai1', role: 'ai', content: '' }], 'ai1');
91
+ reportPromptError('401 Unauthorized', probe.deps);
92
+ reportPromptError('The agent ended the turn without sending an answer', probe.deps);
93
+
94
+ expect(probe.rows()[1]?.error).toEqual({ message: '401 Unauthorized' });
95
+ });
96
+ });
97
+
98
+ /** The callbacks with every dep defaulted, wiring the three the row needs into
99
+ * this file's state probe. */
100
+ function callbacksFor(probe: MountedPromptError) {
101
+ const deps: OmpAgentCallbacksDeps = {
102
+ setGenerating: () => {},
103
+ setGeneratingVerb: () => {},
104
+ activityRef: { current: '' },
105
+ scrollToBottom: () => {},
106
+ adoptedSessionIdRef: { current: null },
107
+ sessionIdRef: { current: 'sess-1' },
108
+ metaRefreshedRef: { current: null },
109
+ refreshSessionMeta: () => {},
110
+ setLocalMessages: probe.deps.setLocalMessages,
111
+ aiPlaceholderIdRef: probe.ref,
112
+ optimisticUserIdRef: { current: null },
113
+ pendingUserDisplaysRef: { current: [] },
114
+ persistMessages: probe.deps.persistMessages,
115
+ abortControllerRef: { current: null },
116
+ appSettings: {},
117
+ enqueueExtensionDialog: () => {},
118
+ withdrawExtensionDialog: () => {},
119
+ reloadMessages: () => {},
120
+ needsReloadRef: { current: false },
121
+ };
122
+ return createOmpAgentCallbacks(deps);
123
+ }
124
+
125
+ describe('prompt_error / notice wiring', () => {
126
+ test('a silent ACP failure marks the empty assistant row and persists it', () => {
127
+ const probe = mount([userRow, { id: 'ai1', role: 'ai', content: '' }], 'ai1');
128
+ callbacksFor(probe).onPromptError?.('The agent ended the turn without sending an answer');
129
+
130
+ expect(probe.ref.current).toBeNull();
131
+ expect(probe.rows()[1]?.error).toEqual({ message: 'The agent ended the turn without sending an answer' });
132
+ expect(probe.persisted()).toHaveLength(1);
133
+ });
134
+
135
+ test('a warning notice becomes a row; an info notice does not', () => {
136
+ const probe = mount([userRow]);
137
+ const callbacks = callbacksFor(probe);
138
+
139
+ callbacks.onNotice?.('warning', 'provider refused the request');
140
+ callbacks.onNotice?.('info', 'model warmed');
141
+
142
+ expect(probe.rows().filter((row) => row.notice)).toEqual([
143
+ expect.objectContaining({ notice: 'provider refused the request' }),
144
+ ]);
145
+ });
146
+ });
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Turn a `prompt_error` frame into a row the timeline DRAWS.
8
+ *
9
+ * The frame used to reach `onPromptError` only, which logged it and cleared the
10
+ * generating flag. On an ACP harness a silent failure therefore left the
11
+ * optimistic AI bubble exactly as it was — an empty answer — and the reason
12
+ * lived in the console. The row the answer would have streamed into is where
13
+ * the error belongs: `MessageItem` already draws `msg.error` as the
14
+ * Provider/API Error alert for omp's transcript rows, so this path reuses that
15
+ * renderer instead of inventing a second error card.
16
+ *
17
+ * The placeholder is consumed even when it never received a byte; leaving it
18
+ * armed would let a late frame fill an empty bubble after the error.
19
+ */
20
+
21
+ import type { Dispatch, SetStateAction } from 'preact/compat';
22
+ import type { ChatMessageData } from '@/shared/types';
23
+ import { isNoticeRow } from '@/shared/lib/chat/notice-row';
24
+ import { formatClock } from '@/shared/lib/format/time';
25
+
26
+ export interface PromptErrorDeps {
27
+ setLocalMessages: Dispatch<SetStateAction<ChatMessageData[]>>;
28
+ aiPlaceholderIdRef: { current: string | null };
29
+ persistMessages: (messages: ChatMessageData[]) => void;
30
+ }
31
+
32
+ /** A row with nothing the timeline renders: no text, no thinking, no tool. */
33
+ function isBlankAnswer(msg: ChatMessageData): boolean {
34
+ if (typeof msg.content === 'string' && msg.content.trim()) return false;
35
+ if (msg.thinking || msg.monologue) return false;
36
+ return !(msg.toolCalls?.length || msg.actions?.length || msg.actions2?.length);
37
+ }
38
+
39
+ /** Tail-most rendered AI row IF it is still blank, else -1. */
40
+ function blankAssistantIndex(messages: ChatMessageData[]): number {
41
+ for (let index = messages.length - 1; index >= 0; index--) {
42
+ const msg = messages[index];
43
+ if (msg.role === 'user' || isNoticeRow(msg)) continue;
44
+ return isBlankAnswer(msg) ? index : -1;
45
+ }
46
+ return -1;
47
+ }
48
+
49
+ function errorRow(message: string): ChatMessageData {
50
+ return {
51
+ id: `prompt-error-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
52
+ role: 'ai',
53
+ date: `Today, ${formatClock()}`,
54
+ content: '',
55
+ error: { message },
56
+ };
57
+ }
58
+
59
+ /**
60
+ * Attach the failure to the run's own row, or append a dedicated error row when
61
+ * the run already produced an answer (an agent that dies after replying must
62
+ * not relabel that reply as the failure).
63
+ */
64
+ export function reportPromptError(errorMessage: string, deps: PromptErrorDeps): void {
65
+ const message = errorMessage.trim() || 'Prompt failed';
66
+ const placeholderId = deps.aiPlaceholderIdRef.current;
67
+ deps.aiPlaceholderIdRef.current = null;
68
+ const row = errorRow(message);
69
+
70
+ deps.setLocalMessages((prev) => {
71
+ const placeholderIndex = placeholderId ? prev.findIndex((msg) => msg.id === placeholderId) : -1;
72
+ const targetIndex = placeholderIndex !== -1 ? placeholderIndex : blankAssistantIndex(prev);
73
+ if (targetIndex === -1) {
74
+ // Two failure frames for one run must not stack two identical cards.
75
+ if (prev[prev.length - 1]?.error?.message === message) return prev;
76
+ const next = [...prev, row];
77
+ deps.persistMessages(next);
78
+ return next;
79
+ }
80
+ const next = prev.map((msg, index) =>
81
+ index === targetIndex
82
+ ? { ...msg, error: { ...(msg.error ?? {}), message: msg.error?.message || message } }
83
+ : msg,
84
+ );
85
+ deps.persistMessages(next);
86
+ return next;
87
+ });
88
+ }
@@ -93,6 +93,17 @@ describe('toolSummary — wait', () => {
93
93
  expect(summary?.line).toBe('15s · idle 15s total');
94
94
  });
95
95
 
96
+ test('the 18.18.6 hint after the window does not hide the idle chip', () => {
97
+ // omp 18.18.6: `No reply within 10s; a back-to-back wait allows up to 30s.`
98
+ const summary = toolSummary(tool({
99
+ type: 'wait',
100
+ durationMs: 10_000,
101
+ output: 'No reply within 10s; a back-to-back wait allows up to 30s.',
102
+ details: { op: 'wait', jobs: [] },
103
+ }));
104
+ expect(summary?.line).toBe('10s · idle 10s');
105
+ });
106
+
96
107
  test('an unreadable result keeps the generic fallback', () => {
97
108
  // No `details.op`, so this is not a wait result at all — the output's first
98
109
  // line is the only thing worth saying.
@@ -9,7 +9,7 @@
9
9
  * Timeline cards render with Shiki (`Bash`, `FallbackOutput`), which treats
10
10
  * raw `\x1b[…m` sequences as literal text — so escapes are dropped here
11
11
  * first and the clean text goes to the highlighter. True terminal colors
12
- * stay available in the realtime xterm panel, which parses ANSI natively.
12
+ * stay available in the realtime terminal panel, which parses ANSI natively.
13
13
  */
14
14
 
15
15
  /** Any ANSI escape: OSC hyperlink, charset select, or CSI sequence. */
@@ -11,7 +11,7 @@
11
11
  * contains. `@fontsource/fira-code`'s latin subset maps 226 codepoints and not
12
12
  * one of them is above U+FFFF, so the terminal's stack can only reach them
13
13
  * through a Nerd Font. Until now the stack named installed families only
14
- * (`XTERM_GLYPH_FALLBACKS`), which means the glyphs appeared on the machine
14
+ * (`TERMINAL_GLYPH_FALLBACKS`), which means the glyphs appeared on the machine
15
15
  * that had one installed and were hollow tofu boxes on every other device — a
16
16
  * phone, a second laptop, a colleague's browser.
17
17
  *
@@ -29,8 +29,9 @@
29
29
  *
30
30
  * `font-display: block` rather than `swap`, unlike the text faces beside it: a
31
31
  * swapped symbol paints a tofu box first and repaints, and in a terminal that
32
- * box is exactly the artifact this face exists to remove. `mount.ts` awaits the
33
- * face before opening xterm for the same reason — see `ensureNerdGlyphs`.
32
+ * box is exactly the artifact this face exists to remove. `mount.ts` waits for
33
+ * the face before opening the terminal for the same reason — see
34
+ * `ensureNerdGlyphs`.
34
35
  *
35
36
  * Generated by `bun run scripts/nerd-symbols-font.mjs` from
36
37
  * `SymbolsNerdFontMono-Regular.ttf` (Nerd Fonts v3.5.1). See NOTICE.md in this
@@ -8,7 +8,7 @@
8
8
  * and every way it can break is silent at runtime:
9
9
  *
10
10
  * - The bundled face's family name is written twice — in the stack
11
- * (`XTERM_FONT_FAMILY`) and in the `@font-face` (`nerd-symbols.css`). If they
11
+ * (`TERMINAL_FONT_FAMILY`) and in the `@font-face` (`nerd-symbols.css`). If they
12
12
  * drift, the face loads and nothing uses it: prompts render as tofu boxes
13
13
  * with no error anywhere.
14
14
  * - The face must stay LAST in the stack. Moved ahead of the installed families
@@ -30,8 +30,8 @@ import { join } from 'node:path';
30
30
 
31
31
  import {
32
32
  NERD_SYMBOLS_FAMILY,
33
- XTERM_FONT_FAMILY,
34
- XTERM_GLYPH_FALLBACKS,
33
+ TERMINAL_FONT_FAMILY,
34
+ TERMINAL_GLYPH_FALLBACKS,
35
35
  } from '@/client/data/theme/terminal';
36
36
 
37
37
  const FONT_DIR = import.meta.dir;
@@ -67,19 +67,19 @@ describe('bundled Nerd Font symbols face', () => {
67
67
  // machine that has none — which is also what keeps the desktop from
68
68
  // downloading it (its unicode-range is PUA-only, so it is never fetched
69
69
  // when another family supplies the glyph).
70
- expect(XTERM_FONT_FAMILY.indexOf(NERD_SYMBOLS_FAMILY)).toBeGreaterThan(
71
- XTERM_FONT_FAMILY.indexOf('PowerlineSymbols'),
70
+ expect(TERMINAL_FONT_FAMILY.indexOf(NERD_SYMBOLS_FAMILY)).toBeGreaterThan(
71
+ TERMINAL_FONT_FAMILY.indexOf('PowerlineSymbols'),
72
72
  );
73
73
  // Only the generic fallbacks may follow it.
74
- const after = XTERM_FONT_FAMILY.slice(XTERM_FONT_FAMILY.indexOf(NERD_SYMBOLS_FAMILY));
74
+ const after = TERMINAL_FONT_FAMILY.slice(TERMINAL_FONT_FAMILY.indexOf(NERD_SYMBOLS_FAMILY));
75
75
  expect(after).not.toMatch(/Nerd Font Mono'/);
76
76
  });
77
77
 
78
78
  test('every installed family is still offered before the bundled one', () => {
79
79
  for (const family of ['FiraCode Nerd Font Mono', 'JetBrainsMono Nerd Font', 'Symbols Nerd Font Mono']) {
80
- expect(XTERM_GLYPH_FALLBACKS).toContain(family);
81
- expect(XTERM_FONT_FAMILY.indexOf(family)).toBeLessThan(
82
- XTERM_FONT_FAMILY.indexOf(NERD_SYMBOLS_FAMILY),
80
+ expect(TERMINAL_GLYPH_FALLBACKS).toContain(family);
81
+ expect(TERMINAL_FONT_FAMILY.indexOf(family)).toBeLessThan(
82
+ TERMINAL_FONT_FAMILY.indexOf(NERD_SYMBOLS_FAMILY),
83
83
  );
84
84
  }
85
85
  });
@@ -24,7 +24,7 @@
24
24
 
25
25
  import { describe, expect, test } from 'bun:test';
26
26
  import { HARNESS_CATALOG, HARNESS_IDS, harnessDescriptor } from '@/shared/lib/harness/catalog';
27
- import { HARNESS_LAUNCH } from '@/server/lib/harness/launch';
27
+ import { HARNESS_LAUNCH } from '@/server/lib/harness/launch-table';
28
28
 
29
29
  describe('harness catalog after the Gemini retirement', () => {
30
30
  test('gemini is not a harness this build offers', () => {
@@ -104,6 +104,10 @@ describe('the env box speaks the agent’s own vocabulary', () => {
104
104
  expect(plan.envHint).toContain('ANTHROPIC_AUTH_TOKEN');
105
105
  expect(plan.envPlaceholder).toContain('ANTHROPIC_BASE_URL');
106
106
  expect(plan.envPlaceholder).not.toContain('GEMINI');
107
+ // The picker's aliases need their own variables, or a gateway answers the
108
+ // vendor's ids with 400.
109
+ expect(plan.envHint).toContain('ANTHROPIC_DEFAULT_SONNET_MODEL');
110
+ expect(plan.envPlaceholder).toContain('ANTHROPIC_DEFAULT_OPUS_MODEL');
107
111
  // And it says what a provider here even IS.
108
112
  expect(plan.notes.join(' ')).toContain('no provider registry');
109
113
  });
@@ -85,11 +85,26 @@ function providersOf(models: readonly { value: string }[]): string[] {
85
85
  function environmentFacts(id: HarnessId): { hint: string; placeholder: string; notes: string[] } {
86
86
  const facts = providerFacts(id);
87
87
  if (facts.env) {
88
- const names = [facts.env.baseUrl, facts.env.apiKey, facts.env.model].filter(Boolean).join(', ');
88
+ const { env } = facts;
89
+ const names = [env.baseUrl, env.apiKey, env.model].filter(Boolean).join(', ');
90
+ const aliases = env.modelAliases ?? [];
91
+ const aliasNames = aliases.map((alias) => alias.env).join(', ');
89
92
  return {
90
- hint: `The variables that point this agent at one endpoint: ${names}. Setting them REPLACES its own provider.`,
91
- placeholder: `${facts.env.baseUrl}=https://…\n${facts.env.apiKey}=…`,
92
- notes: ['This agent has no provider registry — a provider here is an endpoint and a key, nothing else.'],
93
+ hint: aliases.length > 0
94
+ ? `The variables that point this agent at one endpoint: ${names}. A picker alias still resolves to the vendor's model id unless ${aliasNames} pins it to an id this endpoint serves; unpinned aliases answer 400. Setting them REPLACES its own provider.`
95
+ : `The variables that point this agent at one endpoint: ${names}. Setting them REPLACES its own provider.`,
96
+ placeholder: [
97
+ `${env.baseUrl}=https://…`,
98
+ `${env.apiKey}=…`,
99
+ ...(env.model ? [`${env.model}=…`] : []),
100
+ ...(aliases[0] ? [`${aliases[0].env}=…`] : []),
101
+ ].join('\n'),
102
+ notes: [
103
+ 'This agent has no provider registry — a provider here is an endpoint and a key, nothing else.',
104
+ ...(aliases.length > 0
105
+ ? ['A picker alias with no default-model variable keeps the vendor’s model id; a custom endpoint answers that id with 400.']
106
+ : []),
107
+ ],
93
108
  };
94
109
  }
95
110
  if (facts.registry.kind === 'none') {
@@ -129,4 +129,12 @@ describe('supportedProtocols', () => {
129
129
  expect(supportedProtocols('none')).toEqual([]);
130
130
  expect(supportedProtocols('agent-managed')).toEqual([]);
131
131
  });
132
+
133
+ test('zcode carries its three documented wire types, not Gemini', () => {
134
+ expect(supportedProtocols('zcode-provider-rules')).toEqual([
135
+ 'openai-chat', 'openai-responses', 'anthropic-messages',
136
+ ]);
137
+ // The registry has no Google route: an import must refuse, not mislabel.
138
+ expect(dialectFor('zcode-provider-rules', 'google-genai')).toBeNull();
139
+ });
132
140
  });