@kabmo-labs/kabmo 0.22.0 → 0.24.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 (446) hide show
  1. package/README.md +1 -1
  2. package/dist/client/index.html +1 -1
  3. package/dist/client/index.js +873 -524
  4. package/dist/client/static/js/{index-297dck9a.js → index-jcr5twtp.js} +799 -795
  5. package/dist/client/static/js/index-z3w7n85q.css +1 -0
  6. package/marketplace/plugins/stats/package.json +2 -2
  7. package/marketplace/plugins/stats/src/groups.test.ts +14 -0
  8. package/marketplace/plugins/stats/src/groups.ts +20 -0
  9. package/marketplace/plugins/stats/src/labels.test.ts +9 -0
  10. package/marketplace/plugins/stats/src/labels.ts +7 -0
  11. package/marketplace/plugins/stats/src/server.ts +1 -1
  12. package/package.json +1 -1
  13. package/src/client/App.tsx +20 -19
  14. package/src/client/components/common/ComposerTextarea.tsx +10 -1
  15. package/src/client/components/common/Modal.tsx +2 -6
  16. package/src/client/components/common/PWAInstallButton.tsx +3 -2
  17. package/src/client/components/common/Toast.test.tsx +298 -0
  18. package/src/client/components/common/Toast.tsx +103 -37
  19. package/src/client/components/common/ToastStack.tsx +33 -12
  20. package/src/client/components/common/ViewportSelector.tsx +122 -114
  21. package/src/client/components/common/context-usage-button/Ring.tsx +38 -1
  22. package/src/client/components/common/context-usage-button/index.test.tsx +19 -3
  23. package/src/client/components/common/context-usage-button/index.tsx +5 -2
  24. package/src/client/components/common/harness-glyph/brands.ts +65 -0
  25. package/src/client/components/common/harness-glyph/harness-glyph.test.ts +185 -0
  26. package/src/client/components/common/harness-glyph/index.tsx +131 -0
  27. package/src/client/components/common/header-controls/MoreMenu.tsx +2 -1
  28. package/src/client/components/common/header-controls/index.tsx +16 -8
  29. package/src/client/components/common/header-panel-buttons/index.tsx +4 -3
  30. package/src/client/components/common/panel-mark/index.test.tsx +2 -2
  31. package/src/client/components/common/panel-mark/index.tsx +11 -2
  32. package/src/client/components/common/search-select/index.tsx +305 -0
  33. package/src/client/components/common/search-select/search-select.test.tsx +217 -0
  34. package/src/client/components/common/server-control/index.tsx +3 -2
  35. package/src/client/components/common/session-row/index.tsx +18 -1
  36. package/src/client/components/common/toolbar-row/index.tsx +57 -20
  37. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -3
  38. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +3 -2
  39. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +7 -1
  40. package/src/client/components/layout/desktop-layout/index.tsx +1 -3
  41. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +1 -0
  42. package/src/client/components/layout/session-sidebar/SessionItem.tsx +18 -1
  43. package/src/client/components/layout/session-sidebar/SessionsView.tsx +1 -3
  44. package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.test.tsx +332 -0
  45. package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +310 -0
  46. package/src/client/components/layout/session-sidebar/about-modal/SocialLinks.tsx +63 -51
  47. package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +4 -2
  48. package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +122 -0
  49. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +136 -35
  50. package/src/client/components/layout/session-sidebar/harness-mark.test.tsx +126 -0
  51. package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +4 -3
  52. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -0
  53. package/src/client/components/mobile/LayoutWrapper.tsx +1 -7
  54. package/src/client/components/mobile/SessionSidebar.tsx +1 -3
  55. package/src/client/components/mobile/mobile-main-view/Header.tsx +3 -2
  56. package/src/client/components/mobile/mobile-session-sidebar/Dialogs.tsx +0 -8
  57. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -0
  58. package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +17 -1
  59. package/src/client/components/settings/Modal.tsx +26 -22
  60. package/src/client/components/settings/Sidebar.tsx +45 -5
  61. package/src/client/components/settings/categories/HarnessSettings.tsx +207 -0
  62. package/src/client/components/settings/categories/ProjectSettings.tsx +1 -3
  63. package/src/client/components/settings/categories/ProviderSettings.tsx +0 -4
  64. package/src/client/components/settings/categories/SkillCatalogSettings.tsx +13 -23
  65. package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +23 -30
  66. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +20 -11
  67. package/src/client/components/settings/categories/chat-settings/GoalSection.tsx +16 -16
  68. package/src/client/components/settings/categories/harness-settings/AddProviderForm.tsx +219 -0
  69. package/src/client/components/settings/categories/harness-settings/ConfigForm.tsx +268 -0
  70. package/src/client/components/settings/categories/harness-settings/EnvProviderForm.tsx +146 -0
  71. package/src/client/components/settings/categories/harness-settings/HarnessCard.tsx +278 -0
  72. package/src/client/components/settings/categories/harness-settings/ImportSection.tsx +195 -0
  73. package/src/client/components/settings/categories/harness-settings/ProviderPanel.tsx +152 -0
  74. package/src/client/components/settings/categories/harness-settings/ToggleList.tsx +147 -0
  75. package/src/client/components/settings/categories/harness-settings/parts.test.tsx +97 -0
  76. package/src/client/components/settings/categories/harness-settings/parts.tsx +84 -0
  77. package/src/client/components/settings/categories/harness-settings/provider-panel.test.tsx +313 -0
  78. package/src/client/components/settings/categories/omp-settings/RoleEditor.test.ts +60 -39
  79. package/src/client/components/settings/categories/omp-settings/RoleRow.tsx +32 -41
  80. package/src/client/components/settings/categories/omp-settings/role-picker.test-util.ts +45 -0
  81. package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +1 -1
  82. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +11 -4
  83. package/src/client/components/settings/groups.test.tsx +160 -0
  84. package/src/client/components/settings/harness-icons.test.tsx +134 -0
  85. package/src/client/components/workspace/browser-panel/AddressBar.tsx +3 -13
  86. package/src/client/components/workspace/browser-toolbar/clusters.tsx +237 -0
  87. package/src/client/components/workspace/browser-toolbar/index.test.tsx +167 -0
  88. package/src/client/components/workspace/browser-toolbar/index.tsx +99 -100
  89. package/src/client/components/workspace/btw-panel/Messages.tsx +4 -1
  90. package/src/client/components/workspace/btw-panel/index.tsx +2 -0
  91. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +11 -7
  92. package/src/client/components/workspace/chat-timeline/ChatOverlays.tsx +5 -2
  93. package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +13 -0
  94. package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +13 -0
  95. package/src/client/components/workspace/chat-timeline/GeneratingIndicator.test.ts +41 -0
  96. package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +19 -14
  97. package/src/client/components/workspace/chat-timeline/MessageList.test.ts +14 -0
  98. package/src/client/components/workspace/chat-timeline/MessageList.tsx +6 -0
  99. package/src/client/components/workspace/chat-timeline/PendingChatView.tsx +14 -0
  100. package/src/client/components/workspace/chat-timeline/RunFooter.tsx +4 -0
  101. package/src/client/components/workspace/chat-timeline/RunMark.tsx +58 -0
  102. package/src/client/components/workspace/chat-timeline/SubagentView.tsx +4 -1
  103. package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +4 -0
  104. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +1 -0
  105. package/src/client/components/workspace/chat-timeline/chat-input/ComposerRows.tsx +11 -0
  106. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +13 -0
  107. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +8 -1
  108. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +27 -1
  109. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +48 -23
  110. package/src/client/components/workspace/chat-timeline/chat-input/composer-portal.test.tsx +1 -0
  111. package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +21 -1
  112. package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +7 -0
  113. package/src/client/components/workspace/chat-timeline/chat-input/props.ts +13 -0
  114. package/src/client/components/workspace/chat-timeline/chat-input/selection.ts +11 -2
  115. package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +1 -0
  116. package/src/client/components/workspace/chat-timeline/index.tsx +17 -15
  117. package/src/client/components/workspace/chat-timeline/pending-harness.test.tsx +157 -0
  118. package/src/client/components/workspace/chat-timeline/run-mark.test.ts +104 -0
  119. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +11 -20
  120. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/GroupedAsk.tsx +1 -1
  121. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +1 -1
  122. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts.ts +1 -1
  123. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -1
  124. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +31 -3
  125. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +5 -1
  126. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.test.ts +56 -45
  127. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +38 -94
  128. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/wait-parts.tsx +76 -0
  129. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/card-header.ts +2 -1
  130. package/src/client/components/workspace/file-explorer/index.test.ts +25 -0
  131. package/src/client/components/workspace/file-explorer/index.tsx +10 -6
  132. package/src/client/components/workspace/git-panel/index.test.ts +13 -3
  133. package/src/client/components/workspace/git-panel/index.tsx +1 -3
  134. package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +92 -0
  135. package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +290 -0
  136. package/src/client/components/workspace/model-dropdown/Item.tsx +11 -0
  137. package/src/client/components/workspace/model-dropdown/Panel.tsx +119 -8
  138. package/src/client/components/workspace/model-dropdown/Section.tsx +4 -0
  139. package/src/client/components/workspace/model-dropdown/fullscreen-picker.ts +51 -0
  140. package/src/client/components/workspace/model-dropdown/harness-models.test.ts +177 -0
  141. package/src/client/components/workspace/model-dropdown/harness-models.ts +148 -0
  142. package/src/client/components/workspace/model-dropdown/harness-tabs.test.tsx +336 -0
  143. package/src/client/components/workspace/model-dropdown/index.tsx +114 -85
  144. package/src/client/components/workspace/model-dropdown/placement.test.tsx +127 -0
  145. package/src/client/components/workspace/model-dropdown/popover-metrics.test.ts +107 -0
  146. package/src/client/components/workspace/model-dropdown/popover-metrics.ts +118 -0
  147. package/src/client/components/workspace/model-dropdown/row-mutations.ts +106 -0
  148. package/src/client/components/workspace/model-dropdown/trigger.test.ts +22 -2
  149. package/src/client/components/workspace/model-dropdown/use-popover-size.ts +89 -0
  150. package/src/client/data/settings/omp-schema.json +224 -17
  151. package/src/client/hooks/chat/composer/index.ts +11 -2
  152. package/src/client/hooks/chat/composer/items.test.ts +11 -0
  153. package/src/client/hooks/chat/composer/items.ts +4 -2
  154. package/src/client/hooks/chat/composer/model-selection.test.ts +110 -0
  155. package/src/client/hooks/chat/composer/model-selection.ts +45 -4
  156. package/src/client/hooks/chat/omp/prompt-send.ts +4 -2
  157. package/src/client/hooks/chat/timeline/actions.ts +10 -5
  158. package/src/client/hooks/chat/timeline/ask-frames.ts +5 -4
  159. package/src/client/hooks/chat/timeline/composer-local-actions.test.ts +19 -81
  160. package/src/client/hooks/chat/timeline/composer-modes.ts +11 -2
  161. package/src/client/hooks/chat/timeline/composer-refs.ts +16 -1
  162. package/src/client/hooks/chat/timeline/index.ts +27 -35
  163. package/src/client/hooks/chat/timeline/mode-availability.test.ts +51 -0
  164. package/src/client/hooks/chat/timeline/modes-contract.ts +6 -0
  165. package/src/client/hooks/chat/timeline/modes.ts +41 -2
  166. package/src/client/hooks/chat/timeline/new-chat-open.test.ts +86 -0
  167. package/src/client/hooks/chat/timeline/new-chat-open.ts +23 -5
  168. package/src/client/hooks/chat/timeline/new-chat.test.ts +32 -4
  169. package/src/client/hooks/chat/timeline/new-chat.ts +18 -6
  170. package/src/client/hooks/chat/timeline/prompt-text.test.ts +7 -0
  171. package/src/client/hooks/chat/timeline/prompt-text.ts +15 -6
  172. package/src/client/hooks/chat/timeline/rewind-actions.test.ts +51 -1
  173. package/src/client/hooks/chat/timeline/rewind-actions.ts +23 -1
  174. package/src/client/hooks/chat/timeline/run-identity.test.ts +52 -0
  175. package/src/client/hooks/chat/timeline/run-identity.ts +23 -11
  176. package/src/client/hooks/chat/timeline/send-execute.test.ts +55 -0
  177. package/src/client/hooks/chat/timeline/send-props.ts +11 -3
  178. package/src/client/hooks/chat/timeline/send-steer.test.ts +2 -3
  179. package/src/client/hooks/chat/timeline/send.test-util.ts +3 -2
  180. package/src/client/hooks/chat/timeline/send.test.ts +2 -3
  181. package/src/client/hooks/chat/timeline/send.ts +34 -8
  182. package/src/client/hooks/chat/timeline/session-harness.test.ts +163 -0
  183. package/src/client/hooks/chat/timeline/session-harness.ts +164 -0
  184. package/src/client/hooks/chat/timeline/session-load.test-util.ts +6 -2
  185. package/src/client/hooks/chat/timeline/session-load.test.ts +31 -0
  186. package/src/client/hooks/chat/timeline/session-load.ts +6 -14
  187. package/src/client/hooks/chat/timeline/session-shapes.ts +32 -0
  188. package/src/client/hooks/chat/timeline/spawn-harness.ts +41 -0
  189. package/src/client/hooks/chat/timeline/timeline-running.ts +55 -0
  190. package/src/client/hooks/chat/timeline/tui-only-guard.ts +9 -0
  191. package/src/client/hooks/chat/timeline/undo-confirmation.test.ts +131 -0
  192. package/src/client/hooks/models/harness-catalog.ts +114 -0
  193. package/src/client/hooks/models/provider-writes.test.ts +81 -0
  194. package/src/client/hooks/models/provider-writes.ts +144 -0
  195. package/src/client/hooks/models/use-harness-versions.test.ts +152 -0
  196. package/src/client/hooks/models/use-harness-versions.ts +136 -0
  197. package/src/client/hooks/models/use-harnesses-controller.ts +57 -0
  198. package/src/client/hooks/models/use-harnesses-signal.test.ts +128 -0
  199. package/src/client/hooks/models/use-harnesses.test.ts +187 -0
  200. package/src/client/hooks/models/use-harnesses.ts +215 -0
  201. package/src/client/hooks/settings/providers/index.ts +1 -3
  202. package/src/client/hooks/ui/editor-error-toast.ts +10 -3
  203. package/src/client/hooks/ui/icon-style.ts +28 -0
  204. package/src/client/hooks/ui/on-click-outside.test.ts +104 -0
  205. package/src/client/hooks/ui/on-click-outside.ts +14 -2
  206. package/src/client/hooks/ui/theme.ts +6 -0
  207. package/src/client/hooks/ui/toast-queue.test.ts +126 -0
  208. package/src/client/hooks/ui/toasts.ts +132 -27
  209. package/src/client/hooks/ui/ui-feedback.test.ts +4 -91
  210. package/src/client/lib/ui/control-plate.test.ts +76 -0
  211. package/src/client/lib/ui/control-plate.ts +65 -0
  212. package/src/client/tailwind.css +47 -1
  213. package/src/server/lib/assets/shell-attributes.server.ts +9 -2
  214. package/src/server/lib/assets/shell-attributes.test.ts +22 -6
  215. package/src/server/lib/db/schema.ts +4 -0
  216. package/src/server/lib/harness/acp/acp-audit.server.ts +107 -0
  217. package/src/server/lib/harness/acp/acp-goal-driver.server.ts +153 -0
  218. package/src/server/lib/harness/acp/acp-goal-state.server.ts +136 -0
  219. package/src/server/lib/harness/acp/acp-goal.server.ts +273 -0
  220. package/src/server/lib/harness/acp/acp-goal.test.ts +229 -0
  221. package/src/server/lib/harness/acp/acp-telemetry.server.ts +133 -0
  222. package/src/server/lib/harness/acp/acp-telemetry.test.ts +85 -0
  223. package/src/server/lib/harness/acp/acp-todos.server.ts +45 -0
  224. package/src/server/lib/harness/acp/acp-todos.test.ts +43 -0
  225. package/src/server/lib/harness/acp/activation.test.ts +81 -0
  226. package/src/server/lib/harness/acp/activation.ts +72 -0
  227. package/src/server/lib/harness/acp/calls.ts +97 -0
  228. package/src/server/lib/harness/acp/client.test.ts +73 -0
  229. package/src/server/lib/harness/acp/client.ts +339 -0
  230. package/src/server/lib/harness/acp/commands.test.ts +92 -0
  231. package/src/server/lib/harness/acp/commands.ts +165 -0
  232. package/src/server/lib/harness/acp/frames.test.ts +315 -0
  233. package/src/server/lib/harness/acp/frames.ts +349 -0
  234. package/src/server/lib/harness/acp/mapper.ts +204 -0
  235. package/src/server/lib/harness/acp/permissions.test.ts +66 -0
  236. package/src/server/lib/harness/acp/permissions.ts +155 -0
  237. package/src/server/lib/harness/acp/prompt.test.ts +130 -0
  238. package/src/server/lib/harness/acp/prompt.ts +134 -0
  239. package/src/server/lib/harness/acp/protocol.ts +162 -0
  240. package/src/server/lib/harness/acp/session-config.test.ts +73 -0
  241. package/src/server/lib/harness/acp/session-config.ts +148 -0
  242. package/src/server/lib/harness/acp/session-facts.ts +71 -0
  243. package/src/server/lib/harness/acp/session-handshake.ts +89 -0
  244. package/src/server/lib/harness/acp/session-idle.ts +51 -0
  245. package/src/server/lib/harness/acp/session-notifications.ts +95 -0
  246. package/src/server/lib/harness/acp/session-observers.test.ts +193 -0
  247. package/src/server/lib/harness/acp/session-options.ts +33 -0
  248. package/src/server/lib/harness/acp/session-permissions.test.ts +105 -0
  249. package/src/server/lib/harness/acp/session-permissions.ts +74 -0
  250. package/src/server/lib/harness/acp/session-reaper.test.ts +96 -0
  251. package/src/server/lib/harness/acp/session-turns.ts +95 -0
  252. package/src/server/lib/harness/acp/session-usage.ts +60 -0
  253. package/src/server/lib/harness/acp/session-web-state.ts +61 -0
  254. package/src/server/lib/harness/acp/session.test-util.ts +160 -0
  255. package/src/server/lib/harness/acp/session.test.ts +233 -0
  256. package/src/server/lib/harness/acp/session.ts +350 -0
  257. package/src/server/lib/harness/acp/turn.ts +199 -0
  258. package/src/server/lib/harness/acp/verbs.ts +87 -0
  259. package/src/server/lib/harness/auto-probe.server.test.ts +121 -0
  260. package/src/server/lib/harness/auto-probe.server.ts +178 -0
  261. package/src/server/lib/harness/capabilities.ts +67 -0
  262. package/src/server/lib/harness/config-invalidation.test.ts +91 -0
  263. package/src/server/lib/harness/config.server.test.ts +105 -0
  264. package/src/server/lib/harness/config.server.ts +98 -0
  265. package/src/server/lib/harness/enabled.server.test.ts +87 -0
  266. package/src/server/lib/harness/enabled.server.ts +61 -0
  267. package/src/server/lib/harness/launch-table.ts +195 -0
  268. package/src/server/lib/harness/launch.test.ts +220 -0
  269. package/src/server/lib/harness/launch.ts +216 -0
  270. package/src/server/lib/harness/probe-cache.server.test.ts +154 -0
  271. package/src/server/lib/harness/probe-cache.server.ts +177 -0
  272. package/src/server/lib/harness/provider-entry.ts +212 -0
  273. package/src/server/lib/harness/provider-file.server.ts +67 -0
  274. package/src/server/lib/harness/provider-import.test.ts +191 -0
  275. package/src/server/lib/harness/provider-probe.server.ts +123 -0
  276. package/src/server/lib/harness/provider-sources.server.test.ts +45 -0
  277. package/src/server/lib/harness/provider-sources.server.ts +308 -0
  278. package/src/server/lib/harness/provider-write-error.ts +19 -0
  279. package/src/server/lib/harness/provider-write.server.test.ts +308 -0
  280. package/src/server/lib/harness/provider-write.server.ts +339 -0
  281. package/src/server/lib/harness/provider-zcode.server.test.ts +270 -0
  282. package/src/server/lib/harness/provider-zcode.server.ts +324 -0
  283. package/src/server/lib/harness/register.server.ts +36 -0
  284. package/src/server/lib/harness/registry.ts +58 -0
  285. package/src/server/lib/harness/schema.server.ts +129 -0
  286. package/src/server/lib/harness/session-store.server.test.ts +175 -0
  287. package/src/server/lib/harness/session-store.server.ts +206 -0
  288. package/src/server/lib/harness/session-title.server.test.ts +109 -0
  289. package/src/server/lib/harness/session-title.server.ts +70 -0
  290. package/src/server/lib/harness/session.ts +74 -0
  291. package/src/server/lib/harness/spawn.server.ts +133 -0
  292. package/src/server/lib/harness/update-state.server.ts +185 -0
  293. package/src/server/lib/lifecycle/after-listen.ts +7 -0
  294. package/src/server/lib/models/provider-items.server.ts +1 -1
  295. package/src/server/lib/models/registry-refresh.server.test.ts +87 -0
  296. package/src/server/lib/models/registry-refresh.server.ts +98 -0
  297. package/src/server/lib/omp/config/models-config.ts +4 -0
  298. package/src/server/lib/omp/core/cli.ts +13 -0
  299. package/src/server/lib/omp/core/host-resolution.test.ts +6 -3
  300. package/src/server/lib/omp/rpc/child-config.ts +5 -4
  301. package/src/server/lib/omp/rpc/constants.test.ts +2 -1
  302. package/src/server/lib/omp/rpc/event-fanout.ts +9 -0
  303. package/src/server/lib/omp/rpc/forked-resume.test.ts +14 -3
  304. package/src/server/lib/omp/rpc/rpc-primitives.test.ts +11 -0
  305. package/src/server/lib/omp/rpc/session-registration.ts +7 -2
  306. package/src/server/lib/omp/rpc/session-registry.test.ts +2 -1
  307. package/src/server/lib/omp/rpc/session-registry.ts +74 -5
  308. package/src/server/lib/omp/session/acp-rows.server.ts +79 -0
  309. package/src/server/lib/omp/session/delete-flow.server.ts +15 -8
  310. package/src/server/lib/omp/session/delete.server.ts +12 -0
  311. package/src/server/lib/omp/session/sidebar-data.harness.test.ts +247 -0
  312. package/src/server/lib/omp/session/sidebar-data.server.ts +56 -3
  313. package/src/server/lib/queue/delivery.server.test.ts +4 -2
  314. package/src/server/lib/queue/payload.test.ts +67 -0
  315. package/src/server/lib/queue/payload.ts +9 -3
  316. package/src/server/lib/realtime/signals.server.test.ts +99 -0
  317. package/src/server/lib/realtime/signals.server.ts +25 -5
  318. package/src/server/lib/realtime/topics/session-data.server.ts +29 -0
  319. package/src/server/lib/realtime/topics/session.server.ts +3 -3
  320. package/src/server/routes/agent/command-resume.test.ts +77 -0
  321. package/src/server/routes/agent/command.test.ts +243 -2
  322. package/src/server/routes/agent/command.ts +78 -15
  323. package/src/server/routes/agent/harness-command.ts +133 -0
  324. package/src/server/routes/agent/new.ts +63 -1
  325. package/src/server/routes/chat/rewind.test.ts +147 -0
  326. package/src/server/routes/chat/rewind.ts +29 -7
  327. package/src/server/routes/chat/session.test.ts +240 -0
  328. package/src/server/routes/chat/session.ts +96 -4
  329. package/src/server/routes/harness/add-provider.test.ts +233 -0
  330. package/src/server/routes/harness/import-action.ts +272 -0
  331. package/src/server/routes/harness/import.test.ts +196 -0
  332. package/src/server/routes/harness/index.ts +13 -0
  333. package/src/server/routes/harness/root.ts +280 -0
  334. package/src/server/routes/harness/toggle.test.ts +127 -0
  335. package/src/server/routes/harness/update.ts +259 -0
  336. package/src/server/routes/harness/versions.test.ts +148 -0
  337. package/src/server/routes/harness/versions.ts +105 -0
  338. package/src/server/routes/index.ts +2 -0
  339. package/src/server/routes/sessions/delete-acp.test.ts +227 -0
  340. package/src/server/routes/sessions/queue.ts +7 -2
  341. package/src/server/routes/sessions/routes-queue.test.ts +52 -0
  342. package/src/server/routes/sessions/routes.test.ts +47 -13
  343. package/src/server/routes/sessions/session.ts +35 -0
  344. package/src/server/routes/settings/commands-harness.test.ts +92 -0
  345. package/src/server/routes/settings/commands.ts +26 -0
  346. package/src/server/routes/settings/model-override.ts +5 -2
  347. package/src/server/routes/settings/provider-entry.ts +2 -2
  348. package/src/server/routes/settings/provider-model.ts +2 -2
  349. package/src/server/routes/settings/provider-models.ts +2 -2
  350. package/src/server/routes/settings/provider-refresh.ts +6 -4
  351. package/src/server/routes/settings/providers.ts +3 -1
  352. package/src/server/routes/settings/settings-config-routes.test.ts +10 -2
  353. package/src/server/routes/settings/skills.ts +12 -0
  354. package/src/shared/lib/chat/ask-form/fields.ts +76 -0
  355. package/src/shared/lib/chat/ask-form/index.ts +323 -0
  356. package/src/shared/lib/chat/ask-form/tokens.ts +199 -0
  357. package/src/shared/lib/chat/ask-form/types.ts +43 -0
  358. package/src/shared/lib/chat/ask-form.test.ts +137 -0
  359. package/src/shared/lib/chat/ask-questions.test.ts +65 -1
  360. package/src/shared/lib/chat/ask-questions.ts +51 -145
  361. package/src/shared/lib/chat/ask-results.ts +198 -0
  362. package/src/shared/lib/chat/composer/client.ts +20 -8
  363. package/src/shared/lib/chat/context/usage.test.ts +8 -4
  364. package/src/shared/lib/chat/context/usage.ts +17 -3
  365. package/src/shared/lib/chat/omp/abort.test.ts +61 -0
  366. package/src/shared/lib/chat/omp/abort.ts +8 -2
  367. package/src/shared/lib/chat/omp/tool-frames.test.ts +23 -0
  368. package/src/shared/lib/chat/omp/tool-frames.ts +12 -2
  369. package/src/shared/lib/chat/timeline/omp-callbacks.ts +13 -1
  370. package/src/shared/lib/chat/timeline/prompt-error.test.ts +146 -0
  371. package/src/shared/lib/chat/timeline/prompt-error.ts +88 -0
  372. package/src/shared/lib/chat/tool/summary-wait.test.ts +18 -8
  373. package/src/shared/lib/chat/tool/wait-facts.ts +14 -8
  374. package/src/shared/lib/harness/brand-color.test.ts +66 -0
  375. package/src/shared/lib/harness/brand-color.ts +96 -0
  376. package/src/shared/lib/harness/catalog.test.ts +88 -0
  377. package/src/shared/lib/harness/catalog.ts +169 -0
  378. package/src/shared/lib/harness/config-fields.test.ts +139 -0
  379. package/src/shared/lib/harness/config-fields.ts +168 -0
  380. package/src/shared/lib/harness/config.test.ts +153 -0
  381. package/src/shared/lib/harness/config.ts +206 -0
  382. package/src/shared/lib/harness/dialects.test.ts +140 -0
  383. package/src/shared/lib/harness/dialects.ts +249 -0
  384. package/src/shared/lib/harness/enabled.test.ts +79 -0
  385. package/src/shared/lib/harness/enabled.ts +72 -0
  386. package/src/shared/lib/harness/menu.test.ts +94 -0
  387. package/src/shared/lib/harness/menu.ts +88 -0
  388. package/src/shared/lib/harness/provider-facts.test.ts +199 -0
  389. package/src/shared/lib/harness/provider-facts.ts +349 -0
  390. package/src/shared/lib/harness/provider-slug.ts +46 -0
  391. package/src/shared/lib/harness/providers.ts +175 -0
  392. package/src/shared/lib/harness/rewind.ts +24 -0
  393. package/src/shared/lib/harness/status.test.ts +158 -0
  394. package/src/shared/lib/harness/status.ts +112 -0
  395. package/src/shared/lib/harness/update-plan.test.ts +163 -0
  396. package/src/shared/lib/harness/update-plan.ts +140 -0
  397. package/src/shared/lib/harness/updates.test.ts +106 -0
  398. package/src/shared/lib/harness/updates.ts +177 -0
  399. package/src/shared/lib/icons/icon-paint-authority.test.ts +16 -4
  400. package/src/shared/lib/icons/icon-paint-authority.ts +57 -12
  401. package/src/shared/lib/icons/icon-paint-bucket.test.ts +84 -0
  402. package/src/shared/lib/icons/icon-paint-css.test.ts +23 -25
  403. package/src/shared/lib/icons/icon-paint-css.ts +69 -55
  404. package/src/shared/lib/icons/icon-paint-harness.test.ts +73 -0
  405. package/src/shared/lib/icons/icon-paint-harness.ts +75 -0
  406. package/src/shared/lib/icons/icon-paint-ink.ts +108 -0
  407. package/src/shared/lib/icons/icon-paint-panel.ts +19 -4
  408. package/src/shared/lib/icons/icon-paint-weight.ts +21 -2
  409. package/src/shared/lib/icons/icon-tone.ts +118 -21
  410. package/src/shared/lib/icons/tint-hues.generated.ts +100 -284
  411. package/src/shared/lib/icons/tint-tones.test.ts +79 -25
  412. package/src/shared/lib/icons/tint.ts +66 -6
  413. package/src/shared/lib/models/client.ts +10 -1
  414. package/src/shared/lib/models/provider/vendors.ts +72 -0
  415. package/src/shared/lib/omp/config/schema.test.ts +36 -0
  416. package/src/shared/lib/omp/dialog-methods.ts +4 -3
  417. package/src/shared/lib/omp/session/messages-map-trace.test.ts +42 -0
  418. package/src/shared/lib/omp/session/messages-map.ts +6 -1
  419. package/src/shared/lib/omp/session/parse-message-blocks-toolcall.test.ts +8 -0
  420. package/src/shared/lib/omp/session/parse-message-blocks.ts +6 -1
  421. package/src/shared/lib/omp/session/shell-trace.test.ts +69 -0
  422. package/src/shared/lib/omp/session/shell-trace.ts +63 -0
  423. package/src/shared/lib/omp/session/sidebar.ts +37 -10
  424. package/src/shared/lib/omp/session/wait-idle.test.ts +47 -0
  425. package/src/shared/lib/omp/session/wait-idle.ts +93 -0
  426. package/src/shared/lib/omp/session/wait.test.ts +34 -33
  427. package/src/shared/lib/omp/session/wait.ts +25 -39
  428. package/src/shared/lib/settings/sections.ts +24 -0
  429. package/src/shared/lib/theme/css.ts +2 -0
  430. package/src/shared/lib/theme/ink-scale.ts +21 -1
  431. package/src/shared/lib/theme/theme.test.ts +25 -9
  432. package/src/shared/lib/ui/safe-area.test.ts +28 -0
  433. package/src/shared/lib/ui/safe-area.ts +42 -0
  434. package/src/shared/lib/ui/toast-duration.test.ts +74 -0
  435. package/src/shared/lib/ui/toast-duration.ts +70 -0
  436. package/src/shared/types/harness-version.ts +59 -0
  437. package/src/shared/types/harness.ts +201 -0
  438. package/src/shared/types/index.ts +2 -0
  439. package/src/shared/types/omp/agent.ts +13 -0
  440. package/src/shared/types/settings/state.ts +10 -1
  441. package/src/shared/types/workspace.ts +10 -0
  442. package/src/test-support/env.ts +38 -0
  443. package/src/test-support/file-explorer-render.test-util.ts +37 -0
  444. package/src/test-support/file-explorer.test-util.ts +20 -18
  445. package/src/test-support/harness-table.test-util.ts +108 -0
  446. package/dist/client/static/js/index-7ppta1pb.css +0 -1
@@ -1,7 +1,9 @@
1
- import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';
2
2
  import type { ClipboardEvent, SetStateAction } from 'preact/compat';
3
3
  import type { Attachment } from '@/shared/types';
4
4
  import { useModelSelection } from '@/client/hooks/chat/composer/model-selection';
5
+ import { useHarnesses } from '@/client/hooks/models/use-harnesses';
6
+ import { harnessModels } from '@/client/components/workspace/model-dropdown/harness-models';
5
7
  import { NO_PENDING_PICK } from '@/client/hooks/chat/timeline/deferred-model';
6
8
  import { CHAT_COMPOSER_MAX_LINES, useAutoGrow } from '@/client/hooks/chat/composer/auto-grow';
7
9
  import { useVoiceInput } from '@/client/hooks/chat/composer/voice-input';
@@ -56,6 +58,9 @@ export function ChatInput({
56
58
  expandable = false,
57
59
  hero = false,
58
60
  shrinkWhileReading = false,
61
+ harness,
62
+ harnessEditable = true,
63
+ onSelectHarness,
59
64
  }: ChatInputProps) {
60
65
  // The Goal modal is owned here, not by the toolbar: the button is a toggle,
61
66
  // and the modal it opens needs the same `modes` slice the toolbar got.
@@ -71,11 +76,22 @@ export function ChatInput({
71
76
  const [composerFocused, setComposerFocused] = useState(false);
72
77
  const cardRef = useRef<HTMLDivElement>(null);
73
78
 
79
+ const { harnesses, liveModels } = useHarnesses();
80
+ // The ACTIVE agent's own catalog. omp's registry is not a stand-in: no ACP
81
+ // harness shares its ids, and matching a session model against it left the
82
+ // composer naming a model the agent never ran.
83
+ const live = harness ? liveModels[harness] : undefined;
84
+ const scopedModels = useMemo(
85
+ () => (harness && harness !== 'omp-rpc' ? harnessModels(harnesses, harness, [], live).models : null),
86
+ [harness, harnesses, live],
87
+ );
88
+
74
89
  const { selectedModel, setSelectedModel, thinkingLevels, currentThinking, selectThinking } = useModelSelection({
75
90
  composerModelRef,
76
91
  sessionModel,
77
92
  sessionThinkingLevel,
78
93
  deferredComposerPickRef,
94
+ scopedModels,
79
95
  onThinkingLevelChange,
80
96
  });
81
97
 
@@ -264,6 +280,7 @@ export function ChatInput({
264
280
  wrapperClass: layout.wrapperClass,
265
281
  pickerPlacement: layout.pickerPlacement,
266
282
  attachments,
283
+ sessionId: sessionId ?? null,
267
284
  onFilesSelected: (files) => acceptFiles(files),
268
285
  onRemoveAttachment: removeAttachment,
269
286
  modes,
@@ -299,6 +316,9 @@ export function ChatInput({
299
316
  currentThinking,
300
317
  onSelectThinking: selectThinking,
301
318
  onThinkingLevelChange,
319
+ ...(harness ? { harness } : {}),
320
+ harnessEditable,
321
+ ...(onSelectHarness ? { onSelectHarness } : {}),
302
322
  isGenerating,
303
323
  chatRunning,
304
324
  onStop,
@@ -41,6 +41,13 @@ export interface ComposerModes {
41
41
  * other is active, so offering both would present a button whose only
42
42
  * outcome is a refusal. */
43
43
  planAvailable: boolean;
44
+ /**
45
+ * Goal is offered only where a `/kabmo-mode` extension exists (omp's two
46
+ * transports). A non-omp ACP agent has none — its own mode selector is the
47
+ * only place plan can live, and nothing can express an objective — so the
48
+ * button could only refuse.
49
+ */
50
+ goalAvailable: boolean;
44
51
  /**
45
52
  * The last mode-command refusal, from either side of the wire (the route's
46
53
  * error, or a `KABMO_MODE_ERROR` from the extension). The composer renders
@@ -34,6 +34,19 @@ export interface ChatInputProps {
34
34
  onAttachmentsChange?: (attachments: SetStateAction<Attachment[]>) => void;
35
35
  onThinkingLevelChange?: (level: string) => void;
36
36
  onModelChange?: (provider: string, modelId: string) => void;
37
+ /**
38
+ * Which harness runs this chat. Absent on a chat that has not spawned, where
39
+ * the picker shows the user's last choice.
40
+ */
41
+ harness?: string;
42
+ /**
43
+ * False while the open chat has a transcript. Harness is decided at SPAWN, so
44
+ * the tab strip explains instead of switching the transport under a running
45
+ * conversation.
46
+ */
47
+ harnessEditable?: boolean;
48
+ /** Picked a harness for a chat with no transcript yet. */
49
+ onSelectHarness?: (harness: string) => void;
37
50
  /** Model last used by the active session (omp `model_change` entry). */
38
51
  sessionModel?: { provider: string; modelId: string } | null;
39
52
  /** Thinking level last used by the active session (omp `thinking_level_change` entry). */
@@ -10,7 +10,7 @@
10
10
  * ChatInput so the level rule cannot drift between them.
11
11
  */
12
12
 
13
- import type { AIModelOption, ModelEntry } from '@/shared/types';
13
+ import type { AIModelOption } from '@/shared/types';
14
14
  import { selectableThinkingLevels } from '@/shared/lib/models/thinking-levels';
15
15
 
16
16
  /**
@@ -40,9 +40,18 @@ export function resolveThinkingLevel(
40
40
  return currentLevel ?? UNKNOWN_THINKING_LEVEL;
41
41
  }
42
42
 
43
+ /** The fields a catalog entry must carry to become a composer selection. */
44
+ export interface SelectionSource {
45
+ id: string;
46
+ name: string;
47
+ provider: string;
48
+ contextWindow?: string | number;
49
+ thinkingLevels?: string[];
50
+ }
51
+
43
52
  /** The composer's selection for a catalog model, carrying its thinking level. */
44
53
  export function selectionFor(
45
- match: ModelEntry,
54
+ match: SelectionSource,
46
55
  sessionLevel: string | null | undefined,
47
56
  current: AIModelOption | null,
48
57
  ): AIModelOption {
@@ -97,6 +97,7 @@ async function mount(style: ComposerStyle): Promise<HTMLElement> {
97
97
  disarmGoal: () => {},
98
98
  pending: false,
99
99
  planAvailable: true,
100
+ goalAvailable: true,
100
101
  error: null,
101
102
  clearError: () => {},
102
103
  onTogglePlan: () => {},
@@ -18,12 +18,12 @@ import { useRunIdentity } from '@/client/hooks/chat/timeline/run-identity';
18
18
  import { useProviderNames } from '@/client/hooks/models/use-provider-names';
19
19
  import { useToasts } from '@/client/hooks/ui/toasts';
20
20
  import { ChatOverlays } from '@/client/components/workspace/chat-timeline/ChatOverlays';
21
- import { ToastStack } from '@/client/components/common/ToastStack';
22
21
  import { composerRootFor } from '@/shared/lib/workspace/active-project';
23
22
  import { usePendingProjectModel } from '@/client/hooks/chat/timeline/pending-model';
24
23
  import { useNewChatOpen } from '@/client/hooks/chat/timeline/new-chat-open';
25
24
  import { useSidebarData } from '@/client/hooks/chat/omp/session-list';
26
25
  import { useHeldWait } from '@/client/hooks/chat/waiting/held';
26
+ import { useSessionHarness } from '@/client/hooks/chat/timeline/session-harness';
27
27
 
28
28
  interface ChatTimelineProps {
29
29
  className?: string;
@@ -41,7 +41,7 @@ interface ChatTimelineProps {
41
41
  export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle, variant = 'desktop' }: ChatTimelineProps) {
42
42
  const { folders, streamStatusMap, titleHint } = useSidebarData();
43
43
  const isMobile = variant === 'mobile';
44
- const { toasts, pushToast, dismissToast } = useToasts();
44
+ const { pushToast } = useToasts();
45
45
  const {
46
46
  sessionId,
47
47
  selectedFolderId,
@@ -92,15 +92,14 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
92
92
  respondToExtensionUi,
93
93
  spawnTarget,
94
94
  setSpawnTarget,
95
+ pendingHarnessRef,
95
96
  } = useChatTimeline({ folders, streamStatusMap, appSettings, reportActionError: pushToast });
96
97
 
97
- // Ask dialogs render on their own tool card; anything else omp is blocked on
98
- // (an approval gate, an extension picker) has no card and keeps the modal.
99
- // The modal also waits for the session's committed history: a dialog replayed
100
- // on open (the agent probe answers from local flags, long before the JSONL
101
- // fetch lands) has no card to be matched against yet, so deciding "no card
102
- // owns this" during that window painted the ask modal and then took it back —
103
- // the flash on switching to a session parked on a question.
98
+ const activeHarness = useSessionHarness(folders, sessionId, localMessages.length, pendingHarnessRef);
99
+ // Ask dialogs render on their own tool card; anything else the agent is
100
+ // blocked on (an approval gate, an extension picker) has no card and keeps
101
+ // the modal. It also waits for committed history: a replayed dialog has no
102
+ // card to match yet, and deciding early flashed the modal and withdrew it.
104
103
  const { framesByTool, orphanAsks, modalRequest } = useMemo(
105
104
  () => splitAskFrames(localMessages, extensionDialogs, !sessionLoading),
106
105
  [localMessages, extensionDialogs, sessionLoading],
@@ -114,7 +113,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
114
113
  [framesByTool, orphanAsks, respondToFrame],
115
114
  );
116
115
 
117
- const newChat = useNewChatOpen({ folders, sessionId, selectedFolderId });
116
+ const newChat = useNewChatOpen({ folders, sessionId, selectedFolderId, ...(activeHarness.harness ? { harness: activeHarness.harness } : {}) });
118
117
  const { pendingUndo, undoing, error: undoError, requestUndo: handleRequestUndo, closeUndoConfirm, confirmUndo } = useUndoConfirmation(handleUndo);
119
118
  const [searchParams, setSearchParams] = useSearchParams();
120
119
 
@@ -151,12 +150,11 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
151
150
  const handleNewChat = newChat.open;
152
151
 
153
152
  const modelNames = useModelNames();
154
- const providerNames = useProviderNames();
155
153
  const { sessionProvider, sessionModelName } = useRunIdentity({ folders, sessionId, sessionData, modelNames });
154
+ const providerNames = useProviderNames();
156
155
 
157
- // A pending "new-…" session has no messages yet, so the workspace picker
158
- // must stay available until the first chat is sent (which spawns the real
159
- // omp session). Never lock the user into a folder before sending.
156
+ // A pending "new-…" chat has no messages yet, so the workspace picker stays
157
+ // available until the first send spawns the real session.
160
158
  const isPendingSession = Boolean(sessionId?.startsWith('new-'));
161
159
 
162
160
  const { heldWait, cancelHeldWait } = useHeldWait(sessionId, isPendingSession, pushToast);
@@ -220,6 +218,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
220
218
  spawnTarget={spawnTarget}
221
219
  onSpawnTargetChange={setSpawnTarget}
222
220
  onWorktreeReport={(message) => pushToast(message, 'success', { duration: 6000 })}
221
+ {...activeHarness.picker}
223
222
  />
224
223
  );
225
224
  }
@@ -240,6 +239,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
240
239
  onBack={handleSubagentBack}
241
240
  provider={sessionProvider}
242
241
  providerNames={providerNames}
242
+ {...(activeHarness.harness ? { harness: activeHarness.harness } : {})}
243
243
  isMobile={isMobile}
244
244
  />
245
245
  ) : (
@@ -262,6 +262,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
262
262
  modelName={sessionModelName}
263
263
  modelNames={modelNames}
264
264
  thinkingLevel={sessionData?.thinkingLevel}
265
+ {...(activeHarness.harness ? { harness: activeHarness.harness } : {})}
265
266
  onUndo={handleRequestUndo}
266
267
  onRetry={handleRetry}
267
268
  onNewChat={handleNewChat}
@@ -305,6 +306,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
305
306
  deferredComposerPickRef={deferredComposerPickRef}
306
307
  sessionModel={typeof sessionData?.model === 'object' ? sessionData.model : null}
307
308
  sessionThinkingLevel={sessionData?.thinkingLevel}
309
+ {...activeHarness.picker}
308
310
  variant={variant}
309
311
  // The same scroll geometry that draws the scroll-to-bottom
310
312
  // button, with hysteresis: the reader is back through the
@@ -328,6 +330,7 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
328
330
  isOmpSession={Boolean(sessionId) && !sessionId.startsWith('new-') && Number.isNaN(Number(sessionId))}
329
331
  newChatInitialContent={newChat.content}
330
332
  newChatInitialAttachments={newChat.attachments}
333
+ newChatHarness={newChat.harness}
331
334
  onCloseNewChat={newChat.close}
332
335
  onSendNewChat={submitNewChat}
333
336
  appSettings={appSettings}
@@ -339,7 +342,6 @@ export function ChatTimeline({ className = '', appSettings = {}, onSessionTitle,
339
342
  planReview={planReview}
340
343
  />
341
344
 
342
- <ToastStack toasts={toasts} onDismiss={dismissToast} />
343
345
  </div>
344
346
  </AskFramesContext.Provider>
345
347
  );
@@ -0,0 +1,157 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The pending chat's composer actually CARRYING the harness.
8
+ *
9
+ * The tab strip already knew how to report a pick (`harness-tabs.test.tsx`), and
10
+ * the model dropdown already drew the mark. What was missing was the wire
11
+ * between them and the spawn: `EmptyWorkspacePrompt` was never handed
12
+ * `harness` / `onSelectHarness`, so a click changed the strip's local view and
13
+ * nothing else — the server then spawned `omp-rpc` for an `opencode` pick.
14
+ *
15
+ * Both halves are asserted here, from the surface the user presses:
16
+ * - a harness passed in shows its own mark on the model trigger;
17
+ * - clicking another tab calls `onSelectHarness` with that id.
18
+ */
19
+
20
+ import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
21
+ import { Window } from 'happy-dom';
22
+ import { h, render } from 'preact';
23
+ import { act } from 'preact/test-utils';
24
+
25
+ import { EmptyWorkspacePrompt } from '@/client/components/workspace/chat-timeline/EmptyWorkspacePrompt';
26
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
27
+ import { silenceRealtime, restoreRealtime } from '@/test-support/silent-socket';
28
+ import { resetHarnessesStore } from '@/client/hooks/models/harness-catalog';
29
+ import { invalidateModelsCache } from '@/shared/lib/models/client';
30
+ import type { HarnessSummary } from '@/shared/types/harness';
31
+
32
+ let container: HTMLElement;
33
+
34
+ beforeAll(() => {
35
+ installDomGlobals(new Window({ url: 'http://localhost' }));
36
+ // The composer measures its textarea through the BARE global (`auto-grow.ts`),
37
+ // which happy-dom only provides on the window it installed.
38
+ (globalThis as unknown as Record<string, unknown>).getComputedStyle = window.getComputedStyle.bind(window);
39
+ });
40
+ afterAll(() => restoreDomGlobals());
41
+
42
+ const HARNESSES: HarnessSummary[] = [
43
+ { id: 'omp-rpc', label: 'omp', transport: 'rpc', builtIn: true, canLaunch: true, enabled: true, probe: null },
44
+ {
45
+ id: 'opencode',
46
+ label: 'opencode',
47
+ transport: 'acp',
48
+ canLaunch: true,
49
+ enabled: true,
50
+ probe: {
51
+ harness: 'opencode',
52
+ capabilities: {
53
+ configModel: 1, configThinking: 0, configMode: 0, modeValues: [],
54
+ loadSession: false, listSessions: false, forkSession: false, deleteSession: false,
55
+ resumeSession: false, closeSession: false, hasUsage: false, hasPlan: false, steerMode: null,
56
+ },
57
+ models: [{ value: 'opencode/gpt-5', name: 'GPT-5' }],
58
+ thinking: [], modes: [], probedAt: Date.now(),
59
+ },
60
+ },
61
+ ];
62
+
63
+ beforeEach(() => {
64
+ silenceRealtime();
65
+ // Both catalogs are MODULE state shared by every suite in this process. Bun
66
+ // imports every file before any test runs, so an earlier file's read is
67
+ // already cached and this suite's stub would never be asked — the picker then
68
+ // renders with no harnesses and no models, and the assertions below fail for a
69
+ // reason that has nothing to do with the wiring.
70
+ resetHarnessesStore();
71
+ invalidateModelsCache();
72
+ globalThis.fetch = (async (input: RequestInfo | URL) => {
73
+ const url = String(input);
74
+ if (url.startsWith('/api/harness')) {
75
+ return Response.json({ harnesses: HARNESSES, configs: {}, providerSupport: {} });
76
+ }
77
+ if (url.startsWith('/api/models')) {
78
+ // One row: the trigger draws its mark only beside a SELECTION, and the
79
+ // question here is which mark it is, not what the list holds.
80
+ return Response.json({
81
+ models: { openai: 'OpenAI' },
82
+ modelList: [{ id: 'gpt-5', name: 'GPT-5', provider: 'openai', thinkingLevels: ['auto'] }],
83
+ // The trigger draws its mark only beside a SELECTION, and a persisted
84
+ // pick is where one comes from on a chat that has not spawned.
85
+ selectedModel: { id: 'gpt-5', name: 'GPT-5', provider: 'openai', thinkingLevels: ['auto'] },
86
+ defaultModel: null,
87
+ thinkingLevels: {},
88
+ });
89
+ }
90
+ return Response.json({});
91
+ }) as typeof fetch;
92
+ container = document.createElement('div');
93
+ document.body.appendChild(container);
94
+ });
95
+
96
+ afterEach(() => {
97
+ render(null, container);
98
+ container.remove();
99
+ restoreRealtime();
100
+ });
101
+
102
+ function mount(props: Record<string, unknown>) {
103
+ act(() => {
104
+ render(h(EmptyWorkspacePrompt, {
105
+ selectedFolderId: 1,
106
+ setSelectedFolderId: () => {},
107
+ inputValue: '',
108
+ setInputValue: () => {},
109
+ onSend: () => {},
110
+ isGenerating: false,
111
+ accessMode: 'always-ask',
112
+ onAccessModeChange: () => {},
113
+ composerModelRef: { current: null },
114
+ deferredComposerPickRef: { current: null },
115
+ ...props,
116
+ } as never), container);
117
+ });
118
+ return container;
119
+ }
120
+
121
+ /** The model catalog is read through a promise chain; one macrotask drains it. */
122
+ async function settle(): Promise<void> {
123
+ await act(async () => {
124
+ await new Promise((resolve) => setTimeout(resolve, 30));
125
+ });
126
+ }
127
+
128
+ describe('pending composer harness wiring', () => {
129
+ test('the mark on the model trigger is the harness the chat will spawn on', async () => {
130
+ const el = mount({ harness: 'opencode', onSelectHarness: () => {} });
131
+ await settle();
132
+ expect(el.querySelector('svg[data-harness="opencode"]')).not.toBeNull();
133
+ });
134
+
135
+ test('picking another tab reports the harness id to the spawn path', async () => {
136
+ const picked: string[] = [];
137
+ const el = mount({ harness: 'omp-rpc', onSelectHarness: (id: string) => picked.push(id) });
138
+ await settle();
139
+
140
+ const trigger = el.querySelector('[data-model-dropdown-root] button');
141
+ expect(trigger, 'no model trigger').not.toBeNull();
142
+ act(() => {
143
+ (trigger as HTMLElement).dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
144
+ });
145
+ await settle();
146
+
147
+ const tabs = [...el.querySelectorAll('[role="tab"]')];
148
+ // A tab is the MARK ONLY now, so the accessible name is what identifies it —
149
+ // there is no label text to search for.
150
+ const opencode = tabs.find((tab) => tab.getAttribute('aria-label') === 'opencode');
151
+ expect(opencode, 'the opencode tab is not offered').toBeDefined();
152
+ act(() => {
153
+ (opencode as HTMLElement).dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
154
+ });
155
+ expect(picked).toEqual(['opencode']);
156
+ });
157
+ });
@@ -0,0 +1,104 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The two surfaces that name WHICH agent is working.
8
+ *
9
+ * Both used to hardcode `lucide`'s `Bot`, so an `opencode` or `claude` chat
10
+ * announced itself as omp in the one row the user watches while waiting. The
11
+ * assertions are on the MARK (`data-harness`), not on colours, because
12
+ * happy-dom paints nothing — but the fallback matters as much: a session with
13
+ * no harness, or one this build cannot name, must still draw a mark rather than
14
+ * an empty square.
15
+ */
16
+
17
+ import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
18
+ import { Window } from 'happy-dom';
19
+ import { h, render } from 'preact';
20
+ import { act } from 'preact/test-utils';
21
+
22
+ import { GeneratingIndicator } from '@/client/components/workspace/chat-timeline/GeneratingIndicator';
23
+ import { AiMessageFooter } from '@/client/components/workspace/chat-timeline/AiMessageFooter';
24
+ import { RunFooter } from '@/client/components/workspace/chat-timeline/RunFooter';
25
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
26
+
27
+ let container: HTMLElement;
28
+
29
+ beforeAll(() => installDomGlobals(new Window({ url: 'http://localhost' })));
30
+ afterAll(() => restoreDomGlobals());
31
+
32
+ beforeEach(() => {
33
+ container = document.createElement('div');
34
+ document.body.appendChild(container);
35
+ });
36
+
37
+ function mount(node: preact.ComponentChild): HTMLElement {
38
+ act(() => {
39
+ render(node, container);
40
+ });
41
+ return container;
42
+ }
43
+
44
+ function cleanup(): void {
45
+ render(null, container);
46
+ container.remove();
47
+ }
48
+
49
+ describe('GeneratingIndicator mark', () => {
50
+ test('draws the running harness mark, not a generic robot', () => {
51
+ const el = mount(h(GeneratingIndicator, { harness: 'opencode', modelName: 'gpt-5', provider: 'openai' }));
52
+ // The badge's SVG is tagged with the BRAND key, and the wrapper with the id.
53
+ expect(el.querySelector('svg[data-harness="opencode"]')).not.toBeNull();
54
+ expect(el.querySelector('[data-harness="opencode"]')).not.toBeNull();
55
+ cleanup();
56
+ });
57
+
58
+ test("omp's own mark for the default harness", () => {
59
+ const el = mount(h(GeneratingIndicator, { harness: 'omp-rpc', modelName: 'DeepSeek V4 Flash' }));
60
+ expect(el.querySelector('svg[data-harness="omp"]')).not.toBeNull();
61
+ cleanup();
62
+ });
63
+
64
+ test('an unknown or absent harness keeps a mark instead of an empty badge', () => {
65
+ for (const harness of [undefined, '', 'some-future-agent']) {
66
+ const el = mount(h(GeneratingIndicator, { ...(harness ? { harness } : {}), modelName: 'm', provider: 'p' }));
67
+ const badge = el.querySelector('.generating-mark-ring')?.nextElementSibling;
68
+ expect(badge, `no badge for ${String(harness)}`).not.toBeNull();
69
+ expect(badge!.querySelector('svg'), `no mark for ${String(harness)}`).not.toBeNull();
70
+ expect(el.querySelector('svg[data-harness]'), `${String(harness)} drew a harness claim`).toBeNull();
71
+ cleanup();
72
+ }
73
+ });
74
+ });
75
+
76
+ describe('answer footer mark', () => {
77
+ test('the desktop strip draws the harness that wrote the answer', () => {
78
+ const el = mount(h(AiMessageFooter, { currentModel: 'sonnet', content: 'ok', msgId: 'm1', harness: 'claude' }));
79
+ expect(el.querySelector('svg[data-harness="claudecode"]')).not.toBeNull();
80
+ cleanup();
81
+ });
82
+
83
+ test('the phone strip draws it too, from the same props', () => {
84
+ const el = mount(h(AiMessageFooter, { currentModel: 'sonnet', content: 'ok', msgId: 'm2', harness: 'codex', isMobile: true }));
85
+ expect(el.querySelector('svg[data-harness="codex"]')).not.toBeNull();
86
+ cleanup();
87
+ });
88
+
89
+ test('a footer with no harness still draws a mark', () => {
90
+ const el = mount(h(AiMessageFooter, { currentModel: 'sonnet', content: 'ok', msgId: 'm3' }));
91
+ expect(el.querySelector('svg')).not.toBeNull();
92
+ expect(el.querySelector('svg[data-harness]')).toBeNull();
93
+ cleanup();
94
+ });
95
+
96
+ test('RunFooter forwards the run harness to the strip', () => {
97
+ const el = mount(h(RunFooter, {
98
+ msg: { id: 'ai-1', role: 'ai', content: 'answer', model: 'gpt-5', provider: 'openai' },
99
+ harness: 'opencode',
100
+ }));
101
+ expect(el.querySelector('svg[data-harness="opencode"]')).not.toBeNull();
102
+ cleanup();
103
+ });
104
+ });
@@ -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';