@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,6 +1,7 @@
1
- import { useRef, useState } from 'preact/hooks';
1
+ import { useState } from 'preact/hooks';
2
2
  import { Check, ChevronDown, Laptop, Monitor, Ratio, Smartphone, Tablet } from 'lucide-preact';
3
- import { useOnClickOutside } from '@/client/hooks/ui/on-click-outside';
3
+ import { AnchoredMenu } from '@/client/components/common/anchored-menu';
4
+ import { anchorRectOf, type AnchorRect } from '@/shared/lib/ui/menu-anchor';
4
5
  import type { ViewportMode } from '@/shared/types';
5
6
 
6
7
  interface BrowserViewportSelectorProps {
@@ -10,7 +11,7 @@ interface BrowserViewportSelectorProps {
10
11
  onSetZoom?: (zoom: number) => void;
11
12
  }
12
13
 
13
- const VIEWPORT_OPTIONS: Array<{
14
+ export const VIEWPORT_OPTIONS: Array<{
14
15
  id: ViewportMode;
15
16
  label: string;
16
17
  category: 'responsive' | 'mobile';
@@ -24,34 +25,40 @@ const VIEWPORT_OPTIONS: Array<{
24
25
  { id: 'mobile-lg', label: 'Mobile Large (414 × 896)', category: 'mobile', icon: Smartphone },
25
26
  ];
26
27
 
28
+ function getViewportLabel(mode: ViewportMode): string {
29
+ switch (mode) {
30
+ case 'desktop-16-9':
31
+ return 'Desktop 16:9';
32
+ case 'laptop':
33
+ return 'Laptop 1024p';
34
+ case 'tablet':
35
+ return 'Tablet 768p';
36
+ case 'mobile':
37
+ return 'Mobile 375p';
38
+ case 'mobile-lg':
39
+ return 'Mobile Lg 414p';
40
+ case 'responsive':
41
+ default:
42
+ return 'Responsive';
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Device presets plus the zoom-scale shortcuts, for the user panel's iframe.
48
+ *
49
+ * The panel is PORTALLED through `AnchoredMenu` because the selector now lives
50
+ * inside a `ToolbarRow`, which is one line tall and `overflow-hidden` — an
51
+ * `absolute top-full` dropdown there is clipped to nothing. `AnchoredMenu` also
52
+ * places it against the viewport, so a bar at the right edge of a narrow panel
53
+ * cannot draw the preset names past the window.
54
+ */
27
55
  export function BrowserViewportSelector({
28
56
  viewportMode,
29
57
  onChangeViewport,
30
58
  zoomLevel = 100,
31
59
  onSetZoom,
32
60
  }: BrowserViewportSelectorProps) {
33
- const [dropdownOpen, setDropdownOpen] = useState(false);
34
- const dropdownRef = useRef<HTMLDivElement>(null);
35
-
36
- useOnClickOutside(dropdownRef, () => setDropdownOpen(false));
37
-
38
- const getViewportLabel = (mode: ViewportMode) => {
39
- switch (mode) {
40
- case 'desktop-16-9':
41
- return 'Desktop 16:9';
42
- case 'laptop':
43
- return 'Laptop 1024p';
44
- case 'tablet':
45
- return 'Tablet 768p';
46
- case 'mobile':
47
- return 'Mobile 375p';
48
- case 'mobile-lg':
49
- return 'Mobile Lg 414p';
50
- case 'responsive':
51
- default:
52
- return 'Responsive';
53
- }
54
- };
61
+ const [anchor, setAnchor] = useState<AnchorRect | null>(null);
55
62
 
56
63
  return (
57
64
  <div className="flex items-center space-x-1.5 flex-shrink-0">
@@ -100,107 +107,108 @@ export function BrowserViewportSelector({
100
107
  </div>
101
108
 
102
109
  {/* Viewport Testing Dropdown */}
103
- <div className="relative" ref={dropdownRef}>
104
- <button
105
- type="button"
106
- onClick={() => setDropdownOpen((prev) => !prev)}
107
- className="flex items-center space-x-1 px-2 py-1 rounded bg-canvas border border-ink/15 hover:border-ink/30 text-ink text-[11px] font-mono transition-colors cursor-pointer"
108
- title="Device & Responsive Testing Menu"
109
- >
110
- <span className="hidden md:inline text-[10px] font-medium">
111
- {getViewportLabel(viewportMode)}
112
- </span>
113
- <ChevronDown size={11} className="text-ink/60" />
114
- </button>
110
+ <button
111
+ type="button"
112
+ aria-haspopup="menu"
113
+ aria-expanded={anchor !== null}
114
+ onClick={(event) => setAnchor(anchor ? null : anchorRectOf(event.currentTarget))}
115
+ className="flex items-center space-x-1 px-2 py-1 rounded bg-canvas border border-ink/15 hover:border-ink/30 text-ink text-[11px] font-mono transition-colors cursor-pointer"
116
+ title="Device & Responsive Testing Menu"
117
+ >
118
+ <span className="hidden md:inline text-[10px] font-medium">{getViewportLabel(viewportMode)}</span>
119
+ <ChevronDown size={11} className="text-ink/60" />
120
+ </button>
115
121
 
116
- {dropdownOpen && (
117
- <div className="glass-popover absolute right-0 top-full mt-1 w-56 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 z-50 text-xs font-mono">
118
- {/* Responsive Section */}
119
- <div className="px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold">
120
- Responsive Testing
121
- </div>
122
- {VIEWPORT_OPTIONS.filter((opt) => opt.category === 'responsive').map((opt) => {
123
- const Icon = opt.icon;
124
- const isSelected = viewportMode === opt.id;
125
- return (
126
- <button
127
- key={opt.id}
128
- type="button"
129
- onClick={() => {
130
- onChangeViewport(opt.id);
131
- setDropdownOpen(false);
132
- }}
133
- className={`w-full px-2.5 py-1.5 flex items-center justify-between text-left hover:bg-ink/5 cursor-pointer ${
134
- isSelected ? 'bg-ink/10 font-semibold text-ink' : 'text-ink/75'
135
- }`}
136
- >
137
- <div className="flex items-center space-x-2">
138
- <Icon size={13} className="text-ink/60" />
139
- <span>{opt.label}</span>
140
- </div>
141
- {isSelected && <Check size={12} className="text-success" />}
142
- </button>
143
- );
144
- })}
122
+ <AnchoredMenu
123
+ anchor={anchor}
124
+ ariaLabel="Device & Responsive Testing Menu"
125
+ className="w-56 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 text-xs font-mono"
126
+ onClose={() => setAnchor(null)}
127
+ >
128
+ {/* Responsive Section */}
129
+ <div className="px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold">
130
+ Responsive Testing
131
+ </div>
132
+ {VIEWPORT_OPTIONS.filter((opt) => opt.category === 'responsive').map((opt) => {
133
+ const Icon = opt.icon;
134
+ const isSelected = viewportMode === opt.id;
135
+ return (
136
+ <button
137
+ key={opt.id}
138
+ type="button"
139
+ onClick={() => {
140
+ onChangeViewport(opt.id);
141
+ setAnchor(null);
142
+ }}
143
+ className={`w-full px-2.5 py-1.5 flex items-center justify-between text-left hover:bg-ink/5 cursor-pointer ${
144
+ isSelected ? 'bg-ink/10 font-semibold text-ink' : 'text-ink/75'
145
+ }`}
146
+ >
147
+ <div className="flex items-center space-x-2">
148
+ <Icon size={13} className="text-ink/60" />
149
+ <span>{opt.label}</span>
150
+ </div>
151
+ {isSelected && <Check size={12} className="text-success" />}
152
+ </button>
153
+ );
154
+ })}
155
+
156
+ {/* Mobile Section */}
157
+ <div className="mt-1 pt-1 border-t border-ink/10 px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold">
158
+ Mobile Testing
159
+ </div>
160
+ {VIEWPORT_OPTIONS.filter((opt) => opt.category === 'mobile').map((opt) => {
161
+ const Icon = opt.icon;
162
+ const isSelected = viewportMode === opt.id;
163
+ return (
164
+ <button
165
+ key={opt.id}
166
+ type="button"
167
+ onClick={() => {
168
+ onChangeViewport(opt.id);
169
+ setAnchor(null);
170
+ }}
171
+ className={`w-full px-2.5 py-1.5 flex items-center justify-between text-left hover:bg-ink/5 cursor-pointer ${
172
+ isSelected ? 'bg-ink/10 font-semibold text-ink' : 'text-ink/75'
173
+ }`}
174
+ >
175
+ <div className="flex items-center space-x-2">
176
+ <Icon size={13} className="text-ink/60" />
177
+ <span>{opt.label}</span>
178
+ </div>
179
+ {isSelected && <Check size={12} className="text-success" />}
180
+ </button>
181
+ );
182
+ })}
145
183
 
146
- {/* Mobile Section */}
184
+ {/* Zoom Presets Section */}
185
+ {onSetZoom && (
186
+ <>
147
187
  <div className="mt-1 pt-1 border-t border-ink/10 px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold">
148
- Mobile Testing
188
+ Zoom Scale ({zoomLevel}%)
149
189
  </div>
150
- {VIEWPORT_OPTIONS.filter((opt) => opt.category === 'mobile').map((opt) => {
151
- const Icon = opt.icon;
152
- const isSelected = viewportMode === opt.id;
153
- return (
190
+ <div className="grid grid-cols-3 gap-1 px-2 py-1">
191
+ {[50, 75, 100, 125, 150, 200].map((z) => (
154
192
  <button
155
- key={opt.id}
193
+ key={z}
156
194
  type="button"
157
195
  onClick={() => {
158
- onChangeViewport(opt.id);
159
- setDropdownOpen(false);
196
+ onSetZoom(z);
197
+ setAnchor(null);
160
198
  }}
161
- className={`w-full px-2.5 py-1.5 flex items-center justify-between text-left hover:bg-ink/5 cursor-pointer ${
162
- isSelected ? 'bg-ink/10 font-semibold text-ink' : 'text-ink/75'
199
+ className={`px-1.5 py-1 text-center rounded text-[11px] font-mono cursor-pointer transition-colors ${
200
+ zoomLevel === z
201
+ ? 'bg-ink text-canvas font-semibold'
202
+ : 'bg-canvas border border-ink/10 text-ink/75 hover:bg-ink/5'
163
203
  }`}
164
204
  >
165
- <div className="flex items-center space-x-2">
166
- <Icon size={13} className="text-ink/60" />
167
- <span>{opt.label}</span>
168
- </div>
169
- {isSelected && <Check size={12} className="text-success" />}
205
+ {z}%
170
206
  </button>
171
- );
172
- })}
173
-
174
- {/* Zoom Presets Section */}
175
- {onSetZoom && (
176
- <>
177
- <div className="mt-1 pt-1 border-t border-ink/10 px-2.5 py-1 text-[10px] text-ink/40 uppercase tracking-wider font-semibold">
178
- Zoom Scale ({zoomLevel}%)
179
- </div>
180
- <div className="grid grid-cols-3 gap-1 px-2 py-1">
181
- {[50, 75, 100, 125, 150, 200].map((z) => (
182
- <button
183
- key={z}
184
- type="button"
185
- onClick={() => {
186
- onSetZoom(z);
187
- setDropdownOpen(false);
188
- }}
189
- className={`px-1.5 py-1 text-center rounded text-[11px] font-mono cursor-pointer transition-colors ${
190
- zoomLevel === z
191
- ? 'bg-ink text-canvas font-semibold'
192
- : 'bg-canvas border border-ink/10 text-ink/75 hover:bg-ink/5'
193
- }`}
194
- >
195
- {z}%
196
- </button>
197
- ))}
198
- </div>
199
- </>
200
- )}
201
- </div>
207
+ ))}
208
+ </div>
209
+ </>
202
210
  )}
203
- </div>
211
+ </AnchoredMenu>
204
212
  </div>
205
213
  );
206
214
  }
@@ -22,10 +22,42 @@
22
22
  *
23
23
  * Colour is the band's, and the TRACK is deliberately neutral ink — a track in
24
24
  * the band colour made an empty ring look half full at a glance.
25
+ *
26
+ * ## The track has two weights, because it has two jobs
27
+ *
28
+ * An EMPTY ring carries no arc, so the track is the only thing that says the
29
+ * control is there: it is the whole graphic and needs to clear WCAG's 3:1
30
+ * non-text floor on its own. At `/20` it composited to `rgb(66, 71, 80)` on the
31
+ * dark navbar's glass chrome — **1.39:1** — so on `one-dark-pro-soft` the
32
+ * control disappeared entirely ("icon context di topnavbar gelap"). `/75` is
33
+ * the first rung whose worst case clears 3:1 on every one of the 63 palettes
34
+ * (3.02:1 on `solarized-light`, 3.89:1 on `solarized-dark`), and it is the rung
35
+ * the checkbox ring already uses for the same reason.
36
+ *
37
+ * A FILLED ring is the opposite problem, and it is measured, not aesthetic:
38
+ * `/75` sits at almost the same luminance as the arc's solved signal colour, so
39
+ * the two halves merged — worst case **1.04:1** from the arc on light palettes
40
+ * (`nightowl-light`) and **1.00:1** on dark (`rose-pine-dark`), which is the
41
+ * reported "mode light terlalu gelap, context warna hijau ndak kelihatan". No
42
+ * single rung can do both jobs: on `paper`, the ink range between the surface
43
+ * and the green arc is too narrow for one value to clear 3:1 against both.
44
+ *
45
+ * So the weight follows the arc. While an arc is drawn the track steps back to
46
+ * `/35`, the rung that maximises the WORSE of its two contrasts (`/35` and
47
+ * `/40` are the only candidates whose separation from the arc stays above 1.5
48
+ * everywhere; `/35` keeps more of it — 1.86:1 worst case, and 2.20-3.55:1 on
49
+ * the two shipped themes). The arc is the information then, and it clears
50
+ * 4.50:1 on every palette by construction.
25
51
  */
26
52
 
27
53
  import { CONTEXT_BAND_TONES, contextRingGeometry, contextUsageBand } from '@/shared/lib/chat/context/usage';
28
54
 
55
+ /** The track while nothing is filled in: the ring IS the control. */
56
+ const EMPTY_TRACK = 'text-ink/75';
57
+
58
+ /** The track under an arc: quiet enough that the band colour stays the signal. */
59
+ const FILLED_TRACK = 'text-ink/35';
60
+
29
61
  interface ContextRingProps {
30
62
  percent: number;
31
63
  size?: number;
@@ -36,6 +68,11 @@ export function ContextRing({ percent, size = 18, strokeWidth = 2 }: ContextRing
36
68
  const { radius, circumference, dashOffset } = contextRingGeometry(percent, size, strokeWidth);
37
69
  const centre = size / 2;
38
70
  const band = contextUsageBand(percent);
71
+ // The threshold is GEOMETRIC, not a guessed percentage: an arc shorter than
72
+ // its own stroke width is a round-capped dot, not a share you can read, so
73
+ // below that the ring still takes the heavier track (a 2% arc on an 18px dial
74
+ // is a single pixel of colour, and the control would read as missing again).
75
+ const filled = circumference - dashOffset >= strokeWidth;
39
76
  const stroke = {
40
77
  fill: 'none',
41
78
  stroke: 'currentColor',
@@ -55,7 +92,7 @@ export function ContextRing({ percent, size = 18, strokeWidth = 2 }: ContextRing
55
92
  r={radius}
56
93
  {...stroke}
57
94
  transform={`rotate(-90 ${centre} ${centre})`}
58
- className="text-ink/20"
95
+ className={filled ? FILLED_TRACK : EMPTY_TRACK}
59
96
  />
60
97
  <circle
61
98
  cx={centre}
@@ -148,20 +148,36 @@ describe('ContextUsageButton', () => {
148
148
 
149
149
  test('draws the band the share falls in', async () => {
150
150
  await mount(telemetryAt(42));
151
- expect(arc().getAttribute('class')).toContain('text-success');
151
+ expect(arc().getAttribute('class')).toContain('text-success-text');
152
152
  expect(trigger().getAttribute('title')).toContain('42%');
153
153
 
154
154
  render(null, container);
155
155
  resetRealtimeClient();
156
156
  server.stop();
157
157
  await mount(telemetryAt(55));
158
- expect(arc().getAttribute('class')).toContain('text-warning');
158
+ expect(arc().getAttribute('class')).toContain('text-warning-text');
159
159
 
160
160
  render(null, container);
161
161
  resetRealtimeClient();
162
162
  server.stop();
163
163
  await mount(telemetryAt(72));
164
- expect(arc().getAttribute('class')).toContain('text-error');
164
+ expect(arc().getAttribute('class')).toContain('text-error-text');
165
+ });
166
+
167
+ test('the track carries the state: heavy while empty, quiet under an arc', async () => {
168
+ // Two reported bugs, one control. At `/20` an EMPTY ring was invisible in
169
+ // dark mode (1.39:1 on the glass chrome), so it takes `/75` — the first rung
170
+ // clearing 3:1 on all 63 palettes. At `/75` a FILLED ring's track sat on the
171
+ // arc's own luminance (1.04:1 worst case on light), which is "warna hijau
172
+ // ndak kelihatan", so it steps back to `/35` once there is an arc to read.
173
+ await mount(telemetryAt(0));
174
+ expect(container.querySelectorAll('svg circle')[0].getAttribute('class')).toBe('text-ink/75');
175
+
176
+ render(null, container);
177
+ resetRealtimeClient();
178
+ server.stop();
179
+ await mount(telemetryAt(42));
180
+ expect(container.querySelectorAll('svg circle')[0].getAttribute('class')).toBe('text-ink/35');
165
181
  });
166
182
 
167
183
  test('the popover prints the session numbers, and Escape closes it', async () => {
@@ -29,6 +29,7 @@ import { providerLabel } from '@/shared/lib/models/provider/label';
29
29
  import { formatCompactTokens } from '@/shared/lib/format/number';
30
30
  import { CONTEXT_BAND_TONES, contextUsageBand } from '@/shared/lib/chat/context/usage';
31
31
  import { ContextRing } from '@/client/components/common/context-usage-button/Ring';
32
+ import { CONTROL_BOX } from '@/client/lib/ui/control-plate';
32
33
 
33
34
  interface ContextUsageButtonProps {
34
35
  sessionId: string | null;
@@ -73,8 +74,8 @@ export function ContextUsageButton({ sessionId, layout = 'desktop' }: ContextUsa
73
74
  const started = Boolean(telemetry && telemetry.messagesCount > 0);
74
75
  const band = contextUsageBand(percent);
75
76
  const triggerClass = layout === 'mobile'
76
- ? 'tap-target w-8 h-8 rounded-lg hover:bg-ink/5 active:bg-ink/10 flex items-center justify-center transition-colors cursor-pointer'
77
- : 'p-1.5 rounded hover:bg-ink/10 transition-colors cursor-pointer';
77
+ ? `${CONTROL_BOX.mobile} hover:bg-ink/5 active:bg-ink/10 transition-colors cursor-pointer`
78
+ : `${CONTROL_BOX.desktop} hover:bg-ink/10 transition-colors cursor-pointer`;
78
79
 
79
80
  return (
80
81
  <div className="relative flex items-center" ref={containerRef}>
@@ -90,6 +91,8 @@ export function ContextUsageButton({ sessionId, layout = 'desktop' }: ContextUsa
90
91
  aria-haspopup="dialog"
91
92
  aria-expanded={open}
92
93
  >
94
+ {/* The ring keeps its own 18px: it is a dial, not a glyph, and it reads
95
+ smaller than a stroke icon at the same box. */}
93
96
  <ContextRing percent={percent} />
94
97
  </button>
95
98
 
@@ -0,0 +1,65 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The official brand mark of every harness Kabmo can drive, one glyph per agent.
8
+ *
9
+ * GENERATED DATA — do not hand-edit a path. Sources, in order:
10
+ *
11
+ * 1. `@lobehub/icons-static-svg` (MIT) — the agent's own monochrome mark
12
+ * (`claudecode`, `codex`, `commandcode`, `opencode`, `deepseek`, `kimi`,
13
+ * `minimax`, `cursor`, `qwen`, `antigravity`, `pi`).
14
+ * 2. The vendor's own logo with its plate and gradient dropped — omp's
15
+ * `favicon.svg`, whose gradient `url(#g)` and dark background rect were
16
+ * removed so the mark paints in `currentColor` like every other one.
17
+ *
18
+ * `body` is inner markup only: the caller owns the `<svg>`, so a mark inherits
19
+ * the surrounding ink and never carries a hardcoded colour. That is also why
20
+ * the plates and gradients are stripped — a full-colour logo per session row
21
+ * would be the only chroma in the densest list in the app.
22
+ *
23
+ * These are third-party trademarks, used to identify the agent each one belongs
24
+ * to. They are not covered by this project's licence.
25
+ */
26
+
27
+ export interface HarnessBrandGlyph {
28
+ /**
29
+ * The INK's bounding box in the source art's own coordinates, measured with
30
+ * `getBBox()` on the rendered mark (`harness-glyph.test.ts` measures it again
31
+ * rather than trusting this table).
32
+ *
33
+ * It doubles as the `<svg viewBox>`, because the source box is not the mark:
34
+ * omp draws a `36x40` mark inside a `64x64` viewport — 62.5% of its height —
35
+ * while codex fills its `24x24` exactly. Drawing both at one `size` therefore
36
+ * produced two different sizes (measured in the running picker: 11px of omp
37
+ * ink beside 18px of codex, which read as the omp tab being smaller). Cropping
38
+ * to this box makes `size` mean the same thing for every brand.
39
+ */
40
+ ink: readonly [number, number, number, number];
41
+ /** Inner SVG markup, painted in `currentColor`. */
42
+ body: string;
43
+ }
44
+
45
+ /**
46
+ * Keyed by the LOBEHUB brand name, not by `HarnessId`: two harnesses can share
47
+ * one brand (`omp-rpc` and `omp-acp` are both omp), and a brand can serve a
48
+ * harness this build does not launch yet.
49
+ */
50
+ export const HARNESS_BRAND_GLYPHS: Readonly<Record<string, HarnessBrandGlyph>> = {
51
+ omp: { ink: [14, 16, 36, 40], body: "<path d=\"M14 16h36v8H40v32h-8V24h-6v22h-8V24h-4z\"/>" },
52
+ claudecode: { ink: [0, 5, 24, 15], body: "<path clip-rule=\"evenodd\" d=\"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z\"></path>" },
53
+ codex: { ink: [0, 0, 24, 24], body: "<path clip-rule=\"evenodd\" d=\"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z\"></path>" },
54
+ commandcode: { ink: [0, 0, 24, 24], body: "<path clip-rule=\"evenodd\" d=\"M19.334 0a4.67 4.67 0 0 0-4.666 4.668v2H9.334v-2A4.67 4.67 0 0 0 4.668 0 4.67 4.67 0 0 0 0 4.668a4.67 4.67 0 0 0 4.668 4.665h2v5.334h-2A4.67 4.67 0 0 0 0 19.334 4.67 4.67 0 0 0 4.668 24a4.67 4.67 0 0 0 4.666-4.666v-2h5.334v2A4.67 4.67 0 0 0 19.334 24 4.67 4.67 0 0 0 24 19.334a4.67 4.67 0 0 0-4.666-4.667h-2V9.333h2A4.67 4.67 0 0 0 24 4.668 4.673 4.673 0 0 0 19.334 0m-2 6.666v-2c0-1.107.893-2 2-2s2 .893 2 2-.893 2-2 2zm-12.668 0c-1.107 0-2-.893-2-2s.893-2 2-2 2 .893 2 2v2zm4.666 8V9.334h5.334v5.334zm10.002 6.667c-1.107 0-2-.893-2-2v-2h2c1.107 0 2 .892 2 2 0 1.107-.893 2-2 2m-14.668 0c-1.107 0-2-.893-2-2 0-1.108.893-2 2-2h2v2c0 1.107-.893 2-2 2\"/>" },
55
+ opencode: { ink: [4, 2, 16, 20], body: "<path d=\"M16 6H8v12h8V6zm4 16H4V2h16v20z\"></path>" },
56
+ deepseek: { ink: [0, 3, 24, 17.66], body: "<path d=\"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z\"></path>" },
57
+ kimi: { ink: [3, 0, 20.77, 20], body: "<path d=\"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z\"></path><path d=\"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z\"></path>" },
58
+ minimax: { ink: [0, 2, 24, 20], body: "<path d=\"M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z\"></path>" },
59
+ cursor: { ink: [1.47, 0, 21.05, 24], body: "<path d=\"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z\"></path>" },
60
+ qwen: { ink: [0, 0, 23.59, 24], body: "<path d=\"M19.713 2.825h-5.907c0-.251-.066-.503-.196-.728L12.819.728A1.46 1.46 0 0 0 11.559 0h-1.58c-.52 0-1 .275-1.26.728l-2.42 4.19a1.45 1.45 0 0 0 0 1.453l.791 1.37c.26.448.74.727 1.26.727h11.36c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-.79-1.37a1.46 1.46 0 0 0-1.26-.728zM.195 9.905l2.951 5.115a1.46 1.46 0 0 0-.531.531l-.791 1.37a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h4.84c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451L5.086 7.083a1.46 1.46 0 0 0-1.26-.728h-1.58c-.52 0-1 .276-1.26.728l-.79 1.37a1.45 1.45 0 0 0 0 1.452m15.888 13.367 2.951-5.115c.217.125.469.196.728.196h1.582c.52 0 1-.275 1.26-.728l.79-1.37a1.45 1.45 0 0 0 0-1.451l-2.42-4.191a1.46 1.46 0 0 0-1.259-.728h-1.582c-.52 0-1 .276-1.259.728l-5.678 9.838a1.45 1.45 0 0 0 0 1.452l.79 1.37c.26.448.74.727 1.26.727h1.582c.52 0 1-.275 1.26-.728z\"></path>" },
61
+ antigravity: { ink: [0, 1, 24, 22.11], body: "<path d=\"M21.751 22.607c1.34 1.005 3.35.335 1.508-1.508C17.73 15.74 18.904 1 12.037 1 5.17 1 6.342 15.74.815 21.1c-2.01 2.009.167 2.511 1.507 1.506 5.192-3.517 4.857-9.714 9.715-9.714 4.857 0 4.522 6.197 9.714 9.715z\"></path>" },
62
+ pi: { ink: [1, 1, 22, 22], body: "<path clip-rule=\"evenodd\" d=\"M1 1h16.5v11H12v5.5H6.5V23H1V1zm5.5 5.5V12H12V6.5H6.5z\"></path><path d=\"M17.5 12H23v11h-5.5V12z\"></path>" },
63
+ // Z.ai's own mark (ZCode is that vendor's agent), monochrome variant.
64
+ zcode: { ink: [0, 2, 24, 20], body: "<path d=\"M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z\"></path>" },
65
+ };