@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
@@ -0,0 +1,140 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Which parts of a harness an update must move — decided from the numbers, not
8
+ * from a guess.
9
+ *
10
+ * **A harness can be two installs.** `claude` is an npm ADAPTER
11
+ * (`@agentclientprotocol/claude-agent-acp`, the version the probe reports) sitting
12
+ * on top of the `claude` CLI (its own `--version`, its own `claude update`), and
13
+ * they move independently — measured on a real install: adapter 0.100.0 under CLI
14
+ * 2.1.318.
15
+ *
16
+ * The rule that matters: **a part is moved only when it is BEHIND.** Pushing both
17
+ * unconditionally reinstalled an adapter that was already current while the report
18
+ * claimed it had "updated to 0.101.0". And a part whose latest version Kabmo cannot
19
+ * read (a `self` CLI, a CLI with no package in the facts) is never planned: Kabmo
20
+ * cannot claim it is behind.
21
+ *
22
+ * Pure, so the decision is testable without spawning anything — the route only
23
+ * runs the argv this returns.
24
+ */
25
+
26
+ import { isNewer } from '@/shared/lib/updates/semver';
27
+ import type { HarnessUpdateFacts } from '@/shared/lib/harness/updates';
28
+
29
+ /** One part's installed and latest version. */
30
+ export interface UpdatePartVersions {
31
+ version: string | null;
32
+ latest: string | null;
33
+ }
34
+
35
+ /** What the version read knows about a harness. */
36
+ export interface UpdatePlanState {
37
+ /** Is the harness on this machine? An absent one has nothing to move. */
38
+ installed: boolean;
39
+ /** The ADAPTER — the version the probe reported — and its own package. */
40
+ agent: UpdatePartVersions;
41
+ /** The CLI underneath, when this harness is an adapter for one. */
42
+ cli: (UpdatePartVersions & { name: string }) | null;
43
+ }
44
+
45
+ /** One part of an update: what to run, and how the report names it. */
46
+ export interface HarnessUpdateStep {
47
+ /** `adapter`, `Claude Code`, or the harness label — never a bare package name. */
48
+ part: string;
49
+ /** The command line a reader could repeat. */
50
+ command: string;
51
+ /** The argv actually spawned. */
52
+ argv: string[];
53
+ }
54
+
55
+ /**
56
+ * The steps that would move this harness.
57
+ *
58
+ * No probe (`agentVersion === null`) means no number to compare, so the adapter
59
+ * step is still planned: a press on an unprobed row means "make this install
60
+ * current" rather than "it is already current", and the route's answer says that
61
+ * no comparison happened.
62
+ */
63
+ export function planHarnessUpdate(
64
+ label: string,
65
+ facts: HarnessUpdateFacts | null,
66
+ state: UpdatePlanState,
67
+ agentVersion: string | null,
68
+ ): HarnessUpdateStep[] {
69
+ if (!state.installed || !facts) return [];
70
+ const steps: HarnessUpdateStep[] = [];
71
+
72
+ if (facts.kind === 'npm' && facts.pkg && state.agent.latest) {
73
+ const latest = state.agent.latest;
74
+ const behind = agentVersion === null || isNewer(latest, agentVersion);
75
+ if (behind) {
76
+ steps.push({
77
+ // An adapter over a CLI is named `adapter`, so a report cannot be read as
78
+ // "the CLI moved" when only its bridge did.
79
+ part: state.cli ? 'adapter' : label,
80
+ command: `npm install -g ${facts.pkg}@${latest}`,
81
+ argv: ['npm', 'install', '-g', `${facts.pkg}@${latest}`],
82
+ });
83
+ }
84
+ }
85
+
86
+ // The CLI moves through ITS OWN updater (`claude update`), invoked by name: the
87
+ // adapter pins the CLI version it bridges, so this is the half that used to be
88
+ // left stale — and it is also the ONLY half that moves when the adapter is
89
+ // already current. An npm CLI with no vendor updater (`dsh`) moves through the
90
+ // package the facts name instead; without that half its installed number could
91
+ // never be compared, let alone moved.
92
+ const { cli } = state;
93
+ if (cli && cli.latest && cli.version && isNewer(cli.latest, cli.version)) {
94
+ if (facts.command) {
95
+ steps.push({
96
+ part: cli.name,
97
+ command: facts.command,
98
+ argv: facts.command.split(' '),
99
+ });
100
+ } else if (facts.cli?.pkg) {
101
+ steps.push({
102
+ part: cli.name,
103
+ command: `npm install -g ${facts.cli.pkg}@${cli.latest}`,
104
+ argv: ['npm', 'install', '-g', `${facts.cli.pkg}@${cli.latest}`],
105
+ });
106
+ }
107
+ }
108
+
109
+ return steps;
110
+ }
111
+
112
+ /**
113
+ * The launch command a successful adapter install should leave behind, or null.
114
+ *
115
+ * The launch table starts an npm adapter through a PINNED `npx -y pkg@x.y.z`,
116
+ * while the update installs the package GLOBALLY. Those are two different
117
+ * resolvers: `npm i -g` writes a binary onto PATH that `npx` never consults, so
118
+ * the press reported success while every new session still started the old
119
+ * pinned build — measured on `claude` (global 0.101.0, launch requested 0.100.0)
120
+ * and true by construction for codex/pi/zcode.
121
+ *
122
+ * The answer is the installed binary's name ONLY when this run installed the
123
+ * adapter, the binary is on PATH, and the harness has no user command of its
124
+ * own. A configured command is an explicit choice about how this machine starts
125
+ * the harness, so it is never replaced.
126
+ */
127
+ export function repointAdapterLaunch(
128
+ facts: HarnessUpdateFacts | null,
129
+ steps: readonly HarnessUpdateStep[],
130
+ currentCommand: string,
131
+ agentBinOnPath: boolean,
132
+ ): string | null {
133
+ const bin = facts?.agentBin;
134
+ const pkg = facts?.pkg;
135
+ if (!bin || !pkg || !agentBinOnPath || currentCommand.trim()) return null;
136
+ const installed = steps.some(
137
+ (step) => step.argv[0] === 'npm' && step.argv[3]?.startsWith(`${pkg}@`),
138
+ );
139
+ return installed ? bin : null;
140
+ }
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Version state for every harness, and how each one updates.
8
+ *
9
+ * The failure this prevents is a FABRICATED comparison. The first version of the
10
+ * table pointed `claude` at `@anthropic-ai/claude-code` while the probe reports
11
+ * `@agentclientprotocol/claude-agent-acp`: measured on a real probe, that read
12
+ * "0.100.0 → 2.1.318", an update across two unrelated number lines. Numbers that
13
+ * look comparable but are not are worse than a dash.
14
+ *
15
+ * So the cases are about kinds of knowledge:
16
+ *
17
+ * - `npm` — a registry read is a real answer, and the comparison needs BOTH
18
+ * numbers. One missing is `—`, never "up to date".
19
+ * - `self` — the CLI owns its updater; Kabmo must not install a package behind
20
+ * the vendor's launcher, so the fact is the COMMAND.
21
+ * - `own` — a vendor installer owns it, and the route refuses with the reason.
22
+ */
23
+
24
+ import { describe, expect, test } from 'bun:test';
25
+ import {
26
+ HARNESS_UPDATE_FACTS,
27
+ harnessUpdateFacts,
28
+ latestBasis,
29
+ latestSourceFor,
30
+ } from '@/shared/lib/harness/updates';
31
+ import { HARNESS_IDS } from '@/shared/lib/harness/catalog';
32
+
33
+ describe('update facts per harness', () => {
34
+ test('every harness this build lists has facts', () => {
35
+ for (const id of HARNESS_IDS) {
36
+ // `omp-rpc` is the built-in transport: no agent, nothing to update.
37
+ if (id === 'omp-rpc') continue;
38
+ expect(HARNESS_UPDATE_FACTS[id], `no update facts for ${id}`).toBeDefined();
39
+ }
40
+ });
41
+
42
+ test('the npm package is the one the PROBE reports, not a neighbouring one', () => {
43
+ // `claude` probed as @agentclientprotocol/claude-agent-acp 0.100.0. Pointing
44
+ // the table at @anthropic-ai/claude-code compared 0.100 against 2.1.
45
+ expect(latestSourceFor('claude')).toBe('@agentclientprotocol/claude-agent-acp');
46
+ expect(latestSourceFor('codex')).toBe('@agentclientprotocol/codex-acp');
47
+ });
48
+
49
+ test('a retired harness has no update facts, so nothing is offered', () => {
50
+ // `opencode2` is gone from the catalog: the 2.x preview became a shim for
51
+ // `opencode`. A stale row naming it must find no facts rather than a package.
52
+ expect(harnessUpdateFacts('opencode2')).toBeNull();
53
+ expect(latestSourceFor('opencode2')).toBeNull();
54
+ });
55
+
56
+ test('a self-updating CLI has NO registry source', () => {
57
+ // Asking npm about `opencode` would invent a discrepancy between two number
58
+ // lines; the vendor's `upgrade` is the only truthful answer.
59
+ expect(latestSourceFor('opencode')).toBeNull();
60
+ expect(latestBasis('opencode')).toBe('self');
61
+ expect(harnessUpdateFacts('opencode')?.command).toBe('opencode upgrade');
62
+ expect(harnessUpdateFacts('command-code')?.command).toBe('cmd update');
63
+ });
64
+
65
+ test('a vendor-installed harness is marked as not Kabmo’s to replace', () => {
66
+ expect(harnessUpdateFacts('antigravity')?.kind).toBe('own');
67
+ expect(harnessUpdateFacts('cursor')?.kind).toBe('own');
68
+ // It still carries the command, so the UI can show what WOULD update it.
69
+ expect(harnessUpdateFacts('antigravity')?.command).toContain('antigravity.google');
70
+ });
71
+
72
+ test('omp-acp defers to the Oh-My-Pi entry', () => {
73
+ // Same agent, same installer: two buttons for one binary is how a reader
74
+ // updates the same thing twice and cannot tell which one took effect.
75
+ expect(harnessUpdateFacts('omp-acp')?.kind).toBe('self');
76
+ expect(harnessUpdateFacts('omp-acp')?.command).toBe('omp update');
77
+ });
78
+
79
+ test('dsh compares its CLI package, not the ACP surface version', () => {
80
+ // Measured: the probe reports `deepseek-harness-acp` 0.0.1 while the
81
+ // installed CLI is 0.2.2-rc.1. The agent part has no registry package of its
82
+ // own; the CLI does, and that is the number an update can move.
83
+ expect(latestSourceFor('dsh')).toBeNull();
84
+ expect(harnessUpdateFacts('dsh')?.cli).toEqual({
85
+ bin: 'dsh',
86
+ name: 'deepseek-harness',
87
+ pkg: '@deepseek-ai/dsh',
88
+ });
89
+ });
90
+
91
+ test('an npx-launched adapter names the binary a global install writes', () => {
92
+ // The launch line pins `npx -y pkg@version`; `npm i -g` writes this binary,
93
+ // and the update route repoints the harness at it. Without the name the
94
+ // install cannot take effect on the next spawn.
95
+ expect(harnessUpdateFacts('claude')?.agentBin).toBe('claude-agent-acp');
96
+ expect(harnessUpdateFacts('codex')?.agentBin).toBe('codex-acp');
97
+ expect(harnessUpdateFacts('pi')?.agentBin).toBe('pi-acp');
98
+ expect(harnessUpdateFacts('zcode')?.agentBin).toBe('zcode-acp-server');
99
+ });
100
+
101
+ test('an unknown harness has no facts at all', () => {
102
+ expect(harnessUpdateFacts('some-future-agent')).toBeNull();
103
+ expect(latestSourceFor('some-future-agent')).toBeNull();
104
+ expect(latestBasis(null)).toBe('unknown');
105
+ });
106
+ });
@@ -0,0 +1,177 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * How each harness is installed and updated — the facts an "update" button needs.
8
+ *
9
+ * Three different mechanisms, and conflating them is how a button breaks an
10
+ * install:
11
+ *
12
+ * | Mechanism | Meaning | Harness |
13
+ * |---|---|---|
14
+ * | `npm` | Published on npm; the newest version is a registry read, and the install is that package at that version | most |
15
+ * | `self` | The CLI updates itself (`opencode upgrade`, `cmd update`). Kabmo must not install a package behind its back — the vendor owns the launcher, the binary location and the verification | opencode, command-code |
16
+ * | `own` | Installed by a vendor installer (curl script, app bundle). Kabmo can REPORT a version but has no business replacing it | antigravity, cursor |
17
+ *
18
+ * The `npm` entry is the ONLY one whose `latest` Kabmo resolves, because it is the
19
+ * only one where "latest on npm" is the version that install would move to. A
20
+ * probe-reported version is what the AGENT says it is; a registry version is what
21
+ * `npm i -g` would install. They answer different questions and both are shown.
22
+ */
23
+
24
+ import type { HarnessId } from '@/shared/lib/harness/catalog';
25
+
26
+ export type HarnessUpdateKind = 'npm' | 'self' | 'own';
27
+
28
+ export interface HarnessUpdateFacts {
29
+ kind: HarnessUpdateKind;
30
+ /**
31
+ * The CLI whose `--version` is the number a user recognises, when the agent the
32
+ * probe reports is an ADAPTER for it.
33
+ *
34
+ * `claude --version` answers `2.1.318 (Claude Code)` while the ACP adapter
35
+ * answers `0.101.0`. Reporting only the adapter beside a real install reads as
36
+ * "why is my 2.x showing 0.100?", so both are shown and the CLI's own number is
37
+ * the one compared against its own package.
38
+ *
39
+ * `pkg` is that package on npm, so the CLI's latest version is a registry read
40
+ * of its own rather than the adapter's number borrowed for the job. Without it
41
+ * the CLI line can only report what is installed.
42
+ */
43
+ cli?: { bin: string; name: string; pkg?: string };
44
+ /** The npm package, for `npm`. */
45
+ pkg?: string;
46
+ /**
47
+ * The command that updates it, for every kind.
48
+ *
49
+ * For `self` this is what Kabmo RUNS — the vendor's own updater, which is the
50
+ * only correct path for a CLI that owns its launcher. For `own` it is shown and
51
+ * refused, because a vendor installer is not Kabmo's to run.
52
+ */
53
+ command?: string;
54
+ /**
55
+ * The binary the ADAPTER's own package installs, when the launch line prefers
56
+ * a pinned `npx` run of that package. A global install writes this name onto
57
+ * PATH; the update route points the harness at it so the install is the one
58
+ * that actually runs (see `routes/harness/update.ts`).
59
+ */
60
+ agentBin?: string;
61
+ /** Where the command must run, when it is not the agent's own cwd. */
62
+ note?: string;
63
+ }
64
+
65
+ export const HARNESS_UPDATE_FACTS: Readonly<Partial<Record<HarnessId, HarnessUpdateFacts>>> = {
66
+ 'omp-acp': {
67
+ kind: 'self',
68
+ // omp owns its install mechanics (binary download, launcher retirement,
69
+ // verification), and Kabmo already drives them for `omp update`.
70
+ command: 'omp update',
71
+ note: 'Updated through the Oh-My-Pi entry above — omp owns its own installer.',
72
+ },
73
+ claude: {
74
+ // The package the PROBE reports, and therefore the one the comparison is
75
+ // against: `initialize` answers `@agentclientprotocol/claude-agent-acp` 0.100.0.
76
+ // Pointing this at `@anthropic-ai/claude-code` (2.1.318) put two different
77
+ // number lines side by side and reported an "update" from 0.100 to 2.1 — a
78
+ // fabricated comparison, measured on a real probe.
79
+ kind: 'npm',
80
+ pkg: '@agentclientprotocol/claude-agent-acp',
81
+ // The launch line runs `npx -y …@0.100.0`; the install writes this binary,
82
+ // and the route repoints the harness at it after a successful update.
83
+ agentBin: 'claude-agent-acp',
84
+ // The CLI underneath has its own updater (`claude update`), and the adapter
85
+ // pins the CLI version it bridges — so the adapter install alone can leave a
86
+ // stale CLI behind. Both lines are named.
87
+ command: 'claude update',
88
+ cli: { bin: 'claude', name: 'Claude Code', pkg: '@anthropic-ai/claude-code' },
89
+ note: 'The row reports the ADAPTER; `claude --version` is the CLI underneath.',
90
+ },
91
+ codex: {
92
+ // Same rule as claude: the package the probe reports is the one the number
93
+ // is compared against.
94
+ kind: 'npm',
95
+ pkg: '@agentclientprotocol/codex-acp',
96
+ agentBin: 'codex-acp',
97
+ cli: { bin: 'codex', name: 'codex' },
98
+ note: 'The row reports the ADAPTER; `codex --version` is the CLI underneath.',
99
+ },
100
+ opencode: {
101
+ kind: 'self',
102
+ command: 'opencode upgrade',
103
+ note: 'The CLI updates itself; Kabmo runs its own subcommand rather than replacing the install.',
104
+ },
105
+ 'command-code': {
106
+ kind: 'self',
107
+ command: 'cmd update',
108
+ note: 'The CLI updates itself (`cmd update`), which Kabmo runs for you.',
109
+ },
110
+ antigravity: {
111
+ kind: 'own',
112
+ command: 'curl -fsSL https://antigravity.google/install.sh | bash',
113
+ note: 'Installed by Google’s own script; Kabmo reports the version but does not replace the binary.',
114
+ },
115
+ pi: {
116
+ kind: 'npm',
117
+ pkg: 'pi-acp',
118
+ agentBin: 'pi-acp',
119
+ cli: { bin: 'pi', name: 'pi' },
120
+ // The ADAPTER is on npm; the agent it drives is not, so the note names both.
121
+ note: 'The row reports the ADAPTER; the `pi` binary it drives versions separately.',
122
+ },
123
+ qwen: { kind: 'npm', pkg: '@qwen-code/qwen-code' },
124
+ kimi: { kind: 'npm', pkg: '@moonshot-ai/kimi-code' },
125
+ minimax: { kind: 'npm', pkg: '@minimax-ai/code' },
126
+ dsh: {
127
+ kind: 'npm',
128
+ // The PROBE reports the ACP surface inside `dsh` (measured: agent
129
+ // `deepseek-harness-acp` 0.0.1), which is NOT the installed CLI's version
130
+ // (`dsh --version` is 0.2.2-rc.1). Comparing 0.0.1 against the package's
131
+ // 0.2.2 planned an install of the version already on disk on every press.
132
+ // The CLI is therefore the part that carries the package and the comparison;
133
+ // the agent line stays report-only.
134
+ cli: { bin: 'dsh', name: 'deepseek-harness', pkg: '@deepseek-ai/dsh' },
135
+ note: 'The row reports the `dsh` CLI; the ACP server it hosts reports its own version underneath.',
136
+ },
137
+ cursor: { kind: 'own', command: 'cursor-agent update', note: 'Cursor moves through its own installer.' },
138
+ // The ADAPTER is the npm package the probe reports; the `zcode` CLI it drives
139
+ // ships with the desktop app (or the vendor's own installer), so its version
140
+ // is shown on its own line and never replaced by a registry install.
141
+ zcode: {
142
+ kind: 'npm',
143
+ pkg: 'zcode-acp-server',
144
+ agentBin: 'zcode-acp-server',
145
+ cli: { bin: 'zcode', name: 'ZCode' },
146
+ note: 'The row reports the ACP bridge; the ZCode CLI it drives installs with the desktop app.',
147
+ },
148
+ };
149
+
150
+ /** The facts for a harness, or "Kabmo knows nothing about updating it". */
151
+ export function harnessUpdateFacts(id: string | null | undefined): HarnessUpdateFacts | null {
152
+ return id ? (HARNESS_UPDATE_FACTS as Record<string, HarnessUpdateFacts | undefined>)[id] ?? null : null;
153
+ }
154
+
155
+ /**
156
+ * The package an npm-registry version read should ask about, or null.
157
+ *
158
+ * A `self` harness gets null: its latest version is the VENDOR's answer, not
159
+ * npm's, and reporting a registry number beside a self-updating CLI would invent
160
+ * a discrepancy that does not exist.
161
+ */
162
+ export function latestSourceFor(id: string | null | undefined): string | null {
163
+ const facts = harnessUpdateFacts(id);
164
+ return facts?.kind === 'npm' ? facts.pkg ?? null : null;
165
+ }
166
+
167
+ /**
168
+ * How a "latest version" was learned, so the UI can say what it knows instead of
169
+ * presenting every number as the same kind of fact.
170
+ */
171
+ export type LatestBasis = 'npm' | 'self' | 'unknown';
172
+
173
+ export function latestBasis(id: string | null | undefined): LatestBasis {
174
+ const facts = harnessUpdateFacts(id);
175
+ if (!facts) return 'unknown';
176
+ return facts.kind === 'npm' ? 'npm' : 'self';
177
+ }
@@ -63,14 +63,25 @@ describe('an author class is authority', () => {
63
63
  });
64
64
 
65
65
  describe('a solid signal fill owns its foreground', () => {
66
+ const scope =
67
+ '[class~="bg-error"], [class~="bg-error-text"], [class~="bg-success"], [class~="bg-success-text"], [class~="bg-warning"], [class~="bg-warning-text"], [class~="bg-info"], [class~="bg-info-text"]';
68
+
66
69
  test('an icon on bg-error/success/warning/info takes the inherited colour', () => {
67
70
  // `bg-error text-canvas` is a filled destructive button — Delete, Close, the
68
71
  // mobile save — and the glyph was painted in the SAME red as its fill:
69
72
  // measured in the running console, `Trash2` computed rgb(200,50,30) on
70
73
  // rgb(200,50,30), 1.00:1, a blank square where a bin should be.
71
- expect(css).toContain(
72
- '[data-icon-style="color"] :where([class~="bg-error"], [class~="bg-success"], [class~="bg-warning"], [class~="bg-info"]) svg.lucide { color: currentColor; }',
73
- );
74
+ //
75
+ // `-text` is the same slot solved to 4.5:1 against paper and canvas, and it
76
+ // is the token a filled CONTROL uses: the raw palette hex is chosen for a
77
+ // chip's ground (measured 1.94:1 on `aura-light` for info). A scope that
78
+ // knew only the raw spelling left the composer's Stop and Send glyphs on
79
+ // the icon mode's own hue.
80
+ expect(css).toContain(`[data-icon-style="color"] :where(${scope}) svg.lucide { color: currentColor; }`);
81
+ });
82
+
83
+ test('the same fill in monochrome, which is the DEFAULT mode', () => {
84
+ expect(css).toContain(`:root:not([data-icon-style="color"]) :where(${scope}) svg.lucide { color: currentColor; }`);
74
85
  });
75
86
 
76
87
  test('a TINTED signal chip keeps its hue', () => {
@@ -81,6 +92,7 @@ describe('a solid signal fill owns its foreground', () => {
81
92
  });
82
93
 
83
94
  test('a plugin mark on the fill takes it too', () => {
84
- expect(css).toContain(':where([class~="bg-error"], [class~="bg-success"]');
95
+ expect(css).toContain(`:where([data-icon-style="color"]) :where(${scope}) :where([data-plugin-mark]) { --plugin-color: currentColor; }`);
96
+ expect(css).toContain(`:root:not([data-icon-style="color"]) :where(${scope}) :where([data-plugin-mark]) { --plugin-color: currentColor; }`);
85
97
  });
86
98
  });
@@ -67,28 +67,73 @@ export function authorColourRules(): string[] {
67
67
  return rules;
68
68
  }
69
69
 
70
+ /**
71
+ * The class tokens that mean "this element IS a solid signal fill".
72
+ *
73
+ * Both spellings count. `bg-error` is the palette's own hex, and `bg-error-text`
74
+ * is the SAME hue solved to 4.5:1 against paper and canvas — the one a filled
75
+ * control uses, because the raw hex is chosen for a chip's ground and measures
76
+ * 2.73:1 on `mono-light`. A rule that knew only `bg-error` left the composer's
77
+ * Stop and Send glyphs on the icon mode's own hue.
78
+ */
79
+ const SOLID_FILL_TOKENS = [
80
+ 'bg-error',
81
+ 'bg-error-text',
82
+ 'bg-success',
83
+ 'bg-success-text',
84
+ 'bg-warning',
85
+ 'bg-warning-text',
86
+ 'bg-info',
87
+ 'bg-info-text',
88
+ ] as const;
89
+
90
+ /** `[class~="bg-error"], …` — the SOLID classes only, never a `/10` tint. */
91
+ const SOLID_FILL_SCOPE = SOLID_FILL_TOKENS.map((token) => `[class~="${token}"]`).join(', ');
92
+
70
93
  /**
71
94
  * Inside a SOLID signal fill, the glyph takes the surface's own foreground.
72
95
  *
73
96
  * `bg-error text-canvas` is a filled destructive button — Delete, Close, the
74
- * mobile save-and-recreate — and the colour mode painted the glyph in the same
75
- * red as the fill it sits on: measured in the running console, `Trash2` on the
76
- * Delete button computed `rgb(200, 50, 30)` on `rgb(200, 50, 30)`, **1.00:1**,
77
- * a white space where a bin should be. A hue is tuned for paper; a signal fill
78
- * is the signal used as paper, so the surface's declared foreground is the only
79
- * value that is right on it — exactly the argument `invertedSurfaceRules` makes
80
- * for `bg-ink`.
97
+ * mobile save-and-recreate, the composer's Stop and Send — and the colour mode
98
+ * painted the glyph in the same red as the fill it sits on: measured in the
99
+ * running console, `Trash2` on the Delete button computed `rgb(200, 50, 30)` on
100
+ * `rgb(200, 50, 30)`, **1.00:1**, a white space where a bin should be. A hue is
101
+ * tuned for paper; a signal fill is the signal used as paper, so the surface's
102
+ * declared foreground is the only value that is right on it — exactly the
103
+ * argument `invertedSurfaceRules` makes for `bg-ink`.
81
104
  *
82
105
  * `[class~="bg-error"]` matches the SOLID class only: Tailwind spells a tinted
83
106
  * one `bg-error/10`, a different token, so a tinted chip keeps its hue. Stated
84
107
  * after `paintRules` at the same (0,2,1) so it wins on order.
85
108
  */
86
109
  export function solidSignalFillRules(): string[] {
87
- const scope = ['bg-error', 'bg-success', 'bg-warning', 'bg-info']
88
- .map((token) => `[class~="${token}"]`)
89
- .join(', ');
90
110
  return [
91
- `[data-icon-style="color"] :where(${scope}) svg.lucide { color: currentColor; }`,
92
- `:where([data-icon-style="color"]) :where(${scope}) :where([data-plugin-mark]) { --plugin-color: currentColor; }`,
111
+ `[data-icon-style="color"] :where(${SOLID_FILL_SCOPE}) svg.lucide { color: currentColor; }`,
112
+ `:where([data-icon-style="color"]) :where(${SOLID_FILL_SCOPE}) :where([data-plugin-mark]) { --plugin-color: currentColor; }`,
113
+ ];
114
+ }
115
+
116
+ /**
117
+ * The same fill, in MONOCHROME — and there it was a blank button.
118
+ *
119
+ * The rule above is gated on the colour mode, but `monochrome` is the DEFAULT
120
+ * (`DEFAULT_ICON_STYLE`), and its rule paints every glyph without a `text-ink`
121
+ * class in `var(--theme-ink)`. On a solid signal fill that ink is the fill:
122
+ * measured across the 63 palettes, `Square` on `bg-error` computes **1.04:1**
123
+ * on `osaka-jade-light` and 44 of 63 sit under the 3:1 graphic floor. So the
124
+ * fill has to be excluded from the ink pass and take the surface's foreground
125
+ * in this mode too.
126
+ *
127
+ * The exclusions live on the monochrome rule itself (below) rather than here,
128
+ * because that rule is (0,5,1) and anything stated after it would need to
129
+ * out-specify a selector that exists to beat single utilities.
130
+ */
131
+ export function monochromeSolidFillRules(): string[] {
132
+ return [
133
+ `:root:not([data-icon-style="color"]) :where(${SOLID_FILL_SCOPE}) svg.lucide { color: currentColor; }`,
134
+ `:root:not([data-icon-style="color"]) :where(${SOLID_FILL_SCOPE}) :where([data-plugin-mark]) { --plugin-color: currentColor; }`,
93
135
  ];
94
136
  }
137
+
138
+ /** The monochrome ink pass must not reach a solid fill (see above). */
139
+ export const SOLID_FILL_EXCLUSIONS = SOLID_FILL_TOKENS.map((token) => `:not([class~="${token}"] *)`).join('');
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The paper-bucket half of the generated stylesheet.
8
+ *
9
+ * One light tone table had to clear the floor on the DARKEST light paper in the
10
+ * catalog, so every palette with a brighter paper painted an icon at a lightness
11
+ * it did not need — measured on the default palette at mean L 0.582 where that
12
+ * paper allows 0.640, against dark's 0.782. That is the report "light mode
13
+ * kusam", and the fix is a table per bucket plus ONE attribute that picks it.
14
+ *
15
+ * Two properties are load-bearing here, and both fail silently:
16
+ *
17
+ * - **Every row carries all three light buckets AND dark.** A row stamped with
18
+ * only the deep tone paints every bright palette with the dark paper's answer.
19
+ * - **`deep` has no selector.** `--icon-tone` IS the deep value, so a document
20
+ * that never writes the attribute still paints a legal colour rather than
21
+ * falling through to nothing.
22
+ */
23
+
24
+ import { describe, expect, test } from 'bun:test';
25
+ import { iconPaintStyleSheet } from '@/shared/lib/icons/icon-paint-css';
26
+ import { ICON_HUE_ROWS } from '@/shared/lib/icons/tint';
27
+ import { PAPER_BUCKETS } from '@/shared/lib/icons/icon-tone';
28
+ import { ICON_TONES, ICON_TONES_DARK } from '@/shared/lib/icons/tint-hues.generated';
29
+
30
+ const css = iconPaintStyleSheet();
31
+
32
+ describe('the paper buckets in the paint stylesheet', () => {
33
+ test('one hue statement per generated row, carrying every bucket and dark', () => {
34
+ for (const { className, hue } of ICON_HUE_ROWS) {
35
+ const tones = PAPER_BUCKETS.map(
36
+ (bucket) => `--icon-tone${bucket === 'deepest' ? '' : `-${bucket}`}: ${ICON_TONES[bucket][hue]};`,
37
+ ).join(' ');
38
+ expect(css).toContain(
39
+ `:where(svg.${className}) { --icon-hue: ${hue}; ${tones} --icon-tone-dark: ${ICON_TONES_DARK[hue]}; }`,
40
+ );
41
+ }
42
+ });
43
+
44
+ test('a bucket rule re-points the tone for that paper, and only that paper', () => {
45
+ for (const bucket of PAPER_BUCKETS.filter((name) => name !== 'deepest')) {
46
+ expect(css, bucket).toContain(
47
+ `:where([data-icon-style="color"][data-icon-paper="${bucket}"]) :where(svg.lucide) { --icon-color: var(--icon-tone-${bucket}, var(--icon-color)); }`,
48
+ );
49
+ }
50
+ // `deep` IS `--icon-tone`; a rule for it would be a second statement of the
51
+ // same fact, and the one that could disagree.
52
+ expect(css).not.toContain('data-icon-paper="deepest"');
53
+ });
54
+
55
+ test('every bucket rule is gated on the colour mode', () => {
56
+ // Two families: the glyph rule is `:where([data-icon-style="color"]…`, and a
57
+ // PANEL mark rule starts at `:root[…]` because that is the specificity it
58
+ // needs to beat a caller's state class. Both must name the mode.
59
+ const bucketRules = css.split('\n').filter((line) => line.includes('data-icon-paper='));
60
+ expect(bucketRules.length).toBeGreaterThan(0);
61
+ for (const line of bucketRules) expect(line, line.slice(0, 90)).toContain('data-icon-style="color"');
62
+ });
63
+ });
64
+
65
+ describe('a small glyph is drawn heavier', () => {
66
+ test('the 10-14px sizes get a heavier stroke, and only those', () => {
67
+ // At 12px a 2px stroke is barely one pixel of ink. The colour cannot be made
68
+ // brighter to compensate: on `#f1f1f0`, L 0.78 is 1.96:1 — invisible. Ink
69
+ // coverage is the lever that costs no contrast.
70
+ expect(css).toContain(
71
+ 'svg.lucide:is([width="10"], [width="11"], [width="12"], [width="13"], [width="14"]) { stroke-width: 2.25; }',
72
+ );
73
+ // The larger sizes keep the library's weight: a 24px glyph does not need it,
74
+ // and a blanket rule would thicken every mark in the app.
75
+ expect(css).not.toMatch(/svg\.lucide\s*\{[^}]*stroke-width/);
76
+ });
77
+
78
+ test('the rule is not keyed on the attribute, which cannot distinguish a default', () => {
79
+ // Lucide writes `stroke-width="2"` for a default AND `stroke-width="1.8"` for
80
+ // an explicit prop, so `:not([stroke-width])` matches nothing and a rule
81
+ // built on it is dead code that reads as a working opt-out.
82
+ expect(css).not.toContain(':not([stroke-width])');
83
+ });
84
+ });