@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
@@ -31,9 +31,9 @@ import {
31
31
  iconPaintStyleSheet,
32
32
  } from '@/shared/lib/icons/icon-paint-css';
33
33
  import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
34
+ import { SOLID_FILL_EXCLUSIONS } from '@/shared/lib/icons/icon-paint-authority';
34
35
  import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
35
- import { ICON_HUE_ROWS, ICON_TINT_ROWS, ICON_TINT_TOKENS } from '@/shared/lib/icons/tint';
36
- import { ICON_TONES, ICON_TONES_DARK } from '@/shared/lib/icons/tint-hues.generated';
36
+ import { ICON_TINT_ROWS, ICON_TINT_TOKENS } from '@/shared/lib/icons/tint';
37
37
 
38
38
  const css = iconPaintStyleSheet();
39
39
  const rules = css.split('\n').filter((line) => line.startsWith(':where('));
@@ -75,16 +75,15 @@ describe('the icon paint stylesheet', () => {
75
75
  });
76
76
 
77
77
  test('monochrome paints ink, not the inherited colour, and skips inverted surfaces', () => {
78
- // `currentColor` was not enough: a `Check` inside a green chip INHERITS the
79
- // chip's green, so two icons survived a monochrome pass that way.
80
- expect(css).toContain(
81
- ':root:not([data-icon-style="color"]) svg.lucide:not([class*="text-ink"]):not(.bg-ink *) { color: var(--theme-ink); }',
82
- );
78
+ // `currentColor` was not enough: a `Check` inside a green chip INHERITS the chip's green.
79
+ const ink = `:root:not([data-icon-style="color"]) svg.lucide:not([class*="text-ink"]):not(.bg-ink *)${SOLID_FILL_EXCLUSIONS} { color: var(--theme-ink); }`;
80
+ expect(css).toContain(ink);
83
81
  expect(css).toContain(':root:not([data-icon-style="color"]) [data-plugin-mark] { --plugin-color: currentColor; }');
84
82
  });
85
83
 
86
84
  test('a tool card is ink in both modes, so the transcript never turns into confetti', () => {
87
- expect(css).toContain('[data-tool-row] svg.lucide:not([class*="text-ink"]):not(.bg-ink *) { color: var(--theme-ink); }');
85
+ const ink = `[data-tool-row] svg.lucide:not([class*="text-ink"]):not(.bg-ink *)${SOLID_FILL_EXCLUSIONS} { color: var(--theme-ink); }`;
86
+ expect(css).toContain(ink);
88
87
  expect(css).toContain('[data-tool-row] [data-plugin-mark] { --plugin-color: var(--theme-ink); }');
89
88
  });
90
89
 
@@ -106,14 +105,17 @@ describe('the icon paint stylesheet', () => {
106
105
  // paints 0.78 of the tone rather than 0.6 and `/40` paints 0.67 rather than
107
106
  // 0.4. A straight `c * step` is what left 169 of 1139 coloured glyphs under
108
107
  // chroma 0.08 — greyer than the ink they replaced.
109
- expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink/60"] { --icon-paint: oklch(from var(--icon-color) l calc(c * 0.780) h); }');
110
- expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink/40"] { --icon-paint: oklch(from var(--icon-color) l calc(c * 0.670) h); }');
108
+ expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink/60"] { --icon-paint: oklch(from var(--icon-color) calc(l - 0.0176) calc(c * 0.780) h); }');
109
+ expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink/40"] { --icon-paint: oklch(from var(--icon-color) calc(l - 0.0264) calc(c * 0.670) h); }');
111
110
  expect(css).toContain('[data-icon-style="color"] svg.lucide:not(.project-accent-mark)[class~="text-ink"] { --icon-paint: var(--icon-color); }');
112
111
  expect(css).not.toContain('[class*="text-ink/');
113
112
  // Never toward transparency: a hue at 40% alpha is 1.56:1 against its
114
113
  // surface, worse than the `text-ink/40` it replaces.
115
114
  const muted = css.split('\n').find((line) => line.includes('text-ink/40"')) ?? '';
116
115
  expect(muted).toContain('oklch(from');
116
+ // The mute also DARKENS slightly as it removes chroma: scaling chroma alone
117
+ // measured 2.96:1 on a 13px muted folder, under the floor.
118
+ expect(muted).toContain('calc(l - ');
117
119
  expect(muted).not.toContain('transparent');
118
120
  expect(muted).not.toContain('var(--theme-ink)');
119
121
  });
@@ -175,20 +177,10 @@ describe('the icon paint stylesheet', () => {
175
177
  test('the base hue rule states --icon-color, per variant, and one rule paints it', () => {
176
178
  expect(css).toContain(':where(svg.lucide) { --icon-color: var(--icon-tone, hsl(var(--icon-hue,');
177
179
  expect(css).toContain(':where([data-icon-style="color"][data-theme-variant="dark"]) :where(svg.lucide) { --icon-color: var(--icon-tone-dark, hsl(var(--icon-hue,');
178
- // ONE `color:` statement, derived from the two custom properties. Stating it
179
- // per source instead made the weight rules fight them on specificity, and a
180
- // signal token could be overwritten by winning that race.
181
- expect(css).toContain('[data-icon-style="color"] :is(svg.lucide, svg[data-provider], svg[data-file-brand]) { --icon-paint: var(--icon-color); color: var(--icon-paint); }');
182
- });
183
-
184
- test('one hue statement per generated row', () => {
185
- for (const { className, hue } of ICON_HUE_ROWS) {
186
- // BOTH variants on one row: stamping only the light tone is what left
187
- // dark on a single `hsl()` pair for every hue.
188
- expect(css).toContain(
189
- `:where(svg.${className}) { --icon-hue: ${hue}; --icon-tone: ${ICON_TONES[hue]}; --icon-tone-dark: ${ICON_TONES_DARK[hue]}; }`,
190
- );
191
- }
180
+ // ONE `color:` statement from the two custom properties; four families feed it.
181
+ expect(css).toContain(
182
+ '[data-icon-style="color"] :is(svg.lucide, svg[data-provider], svg[data-file-brand], svg[data-harness]) { --icon-paint: var(--icon-color); color: var(--icon-paint); }',
183
+ );
192
184
  });
193
185
 
194
186
  test('every signal row paints its palette token, after the hue rows', () => {
@@ -269,6 +261,11 @@ describe('the icon paint stylesheet', () => {
269
261
  // paint rule and win on order, and it cannot feed `currentColor` back into
270
262
  // `--icon-color` — that is a cycle on the property computing `color`.
271
263
  expect(css).toContain('[data-icon-style="color"] .bg-ink svg.lucide { color: currentColor; }');
264
+ // The harness mark fills the same badge in the generating indicator and the
265
+ // answer footer, and it is the ONE icon family with a brand hue of its own:
266
+ // without this rule an `opencode`/`claude` mark painted its brand colour on
267
+ // the palette's foreground, which is illegible in one of the two themes.
268
+ expect(css).toContain('[data-icon-style="color"] .bg-ink svg[data-harness] { color: currentColor; }');
272
269
  expect(css).toContain(':where([data-icon-style="color"]) :where(.bg-ink) :where([data-plugin-mark]) { --plugin-color: currentColor; }');
273
270
  // Same zero specificity as the base rules, so it has to come AFTER them.
274
271
  expect(css.indexOf('.bg-ink svg.lucide { color: currentColor; }')).toBeGreaterThan(
@@ -334,7 +331,7 @@ describe('the ink weight selectors', () => {
334
331
  const stepped = weightRules.filter((line) => /text-ink\/\d+"\]/.test(line));
335
332
  expect(stepped.length).toBeGreaterThan(0);
336
333
  for (const rule of stepped) {
337
- expect(rule, rule.slice(0, 90)).toContain('oklch(from var(--icon-color) l calc(c *');
334
+ expect(rule, rule.slice(0, 90)).toContain('oklch(from var(--icon-color) calc(l - ');
338
335
  expect(rule, rule.slice(0, 90)).not.toContain('var(--theme-ink)');
339
336
  expect(rule, rule.slice(0, 90)).not.toContain('color-mix(');
340
337
  }
@@ -343,6 +340,7 @@ describe('the ink weight selectors', () => {
343
340
  test('every weight is gated on the colour mode and skips the project accent', () => {
344
341
  for (const rule of weightRules) {
345
342
  expect(rule.startsWith('[data-icon-style="color"]'), rule.slice(0, 80)).toBe(true);
343
+ // The project accent is the operator's own mark, never a brand hue.
346
344
  expect(rule, rule.slice(0, 80)).toContain(':not(.project-accent-mark)');
347
345
  }
348
346
  });
@@ -48,13 +48,22 @@
48
48
  import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
49
49
  import { panelMarkRules } from '@/shared/lib/icons/icon-paint-panel';
50
50
  import { inkWeightRules } from '@/shared/lib/icons/icon-paint-weight';
51
- import { authorColourRules, solidSignalFillRules } from '@/shared/lib/icons/icon-paint-authority';
51
+ import {
52
+ authorColourRules,
53
+ monochromeSolidFillRules,
54
+ solidSignalFillRules,
55
+ } from '@/shared/lib/icons/icon-paint-authority';
56
+ import { monochromeRules, smallGlyphStrokeRules, toolCardRules } from '@/shared/lib/icons/icon-paint-ink';
52
57
  import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
58
+ import { harnessBrandRules, harnessTabSurfaceRules } from '@/shared/lib/icons/icon-paint-harness';
53
59
  import {
54
60
  DEFAULT_ICON_HUE,
55
61
  ICON_HUE_ROWS,
56
62
  ICON_TINT_ROWS,
57
63
  ICON_TINT_TOKENS,
64
+ ICON_TONE_BUCKETS,
65
+ ICON_PAPER_ATTRIBUTE,
66
+ ICON_TONE_VARIABLE,
58
67
  iconHuePaint,
59
68
  iconTone,
60
69
  } from '@/shared/lib/icons/tint';
@@ -82,16 +91,35 @@ function hueRules(): string[] {
82
91
  `:where([data-icon-style="color"][data-theme-variant="dark"]) :where(svg.lucide) { --icon-color: ${iconHuePaint('dark')}; }`,
83
92
  ];
84
93
  for (const { className, hue } of ICON_HUE_ROWS) {
85
- // BOTH variants on one element, so the variant rule below only has to pick
86
- // between two custom properties. Stamping `--icon-tone` alone is what left
87
- // dark on a single `hsl()` pair for every hue.
94
+ // EVERY variant and EVERY paper bucket on one element, so the rules below
95
+ // only have to pick between custom properties. Stamping one value is what
96
+ // left dark on a single `hsl()` pair per hue, and what made every bright
97
+ // light palette paint an icon at the lightness the DARKEST paper merely
98
+ // tolerates.
88
99
  rules.push(
89
- `:where([data-icon-style="color"]) :where(svg.${className}) { --icon-hue: ${hue}; --icon-tone: ${iconTone(hue, 'light')}; --icon-tone-dark: ${iconTone(hue, 'dark')}; }`,
100
+ `:where([data-icon-style="color"]) :where(svg.${className}) { --icon-hue: ${hue}; ${toneVariables(hue)} }`,
90
101
  );
91
102
  }
92
103
  return rules;
93
104
  }
94
105
 
106
+ /**
107
+ * The tone custom properties for one hue: one per paper bucket, plus dark.
108
+ *
109
+ * `--icon-tone` stays the DEEP value, because that is the one every palette
110
+ * clears — a rule that reads it without a bucket gets the conservative colour
111
+ * rather than an illegible one.
112
+ */
113
+ function toneVariables(hue: number): string {
114
+ return [
115
+ // Every light bucket, then dark. The FIRST bucket's variable keeps the bare
116
+ // `--icon-tone` name, so a document with no `data-icon-paper` still paints
117
+ // the legal colour rather than nothing.
118
+ ...ICON_TONE_BUCKETS.map(([bucket, table]) => `${ICON_TONE_VARIABLE[bucket]}: ${table[hue]};`),
119
+ `${ICON_TONE_VARIABLE.dark}: ${iconTone(hue, 'dark')};`,
120
+ ].join(' ');
121
+ }
122
+
95
123
  /**
96
124
  * The paint itself. Stated ONCE, after the sources above, so every rule that
97
125
  * decides a colour only has to set `--icon-color`.
@@ -124,56 +152,7 @@ function paintRules(): string[] {
124
152
  // resolved to `oklab(… / 0.6)`). (0,2,1) beats a single utility, and the
125
153
  // rules that must still override it — a panel mark, a tool card, an inverted
126
154
  // surface, the project accent — are stated after this one with more weight.
127
- `[data-icon-style="color"] :is(svg.lucide, svg[data-provider], svg[data-file-brand]) { --icon-paint: var(--icon-color); color: var(--icon-paint); }`,
128
- ];
129
- }
130
-
131
- /**
132
- * MONOCHROME: an icon takes the ink of the text beside it.
133
- *
134
- * The colour mode is a generated sheet of hues; monochrome is the ABSENCE of the
135
- * attribute, and until this rule that absence only meant "no hue is added" — it
136
- * did not take away the colours an AUTHOR had written. So a `Check` with
137
- * `text-success` in a tool card stayed green with the setting on monochrome
138
- * ("di setting monochrome kenapa iconnya berwarna?"), and the same icon then
139
- * turned into a hue under `color`, which read as the mode being half-applied.
140
- *
141
- * `var(--theme-ink)`, not `currentColor`: a `Check` inside a green status chip
142
- * INHERITS the chip's green, so `currentColor` left it green — measured, two
143
- * icons survived a monochrome pass that way (`lucide-info` in an info chip, a
144
- * loader in a warning one). Icons that say `text-ink/…` are excluded (that IS
145
- * the ink, at the weight the caller chose), and an inverted `bg-ink` surface
146
- * keeps its own foreground.
147
- *
148
- * Specificity is the point: `:root:not(…)` plus the class beats a single utility
149
- * class, so this wins over `text-success` inside the same layer.
150
- */
151
- function monochromeRules(): string[] {
152
- return [
153
- ':root:not([data-icon-style="color"]) svg.lucide:not([class*="text-ink"]):not(.bg-ink *) { color: var(--theme-ink); }',
154
- ':root:not([data-icon-style="color"]) [data-plugin-mark] { --plugin-color: currentColor; }',
155
- ];
156
- }
157
-
158
- /**
159
- * Inside a TOOL CARD, icons are ink in BOTH modes.
160
- *
161
- * A transcript is a reading surface: one turn can hold twenty cards, each with a
162
- * status chip, a file mark and a chevron, and a hue per icon turns the densest
163
- * part of the app into confetti. The codebase already said so for file-type
164
- * marks — `languageBrandIcon` passes `monochrome` for exactly this surface — but
165
- * the Lucide glyphs inside a card were never covered, so they followed the mode
166
- * and flipped colour the moment the setting changed.
167
- *
168
- * `var(--theme-ink)` rather than `currentColor`: the check inside a green status
169
- * chip inherits the chip's green, which is the colour this rule exists to remove.
170
- * Icons that declare `text-ink/…` are left alone (that is the ink, at the weight
171
- * the caller chose), and an inverted `bg-ink` surface keeps its own foreground.
172
- */
173
- function toolCardRules(): string[] {
174
- return [
175
- '[data-tool-row] svg.lucide:not([class*="text-ink"]):not(.bg-ink *) { color: var(--theme-ink); }',
176
- '[data-tool-row] [data-plugin-mark] { --plugin-color: var(--theme-ink); }',
155
+ `[data-icon-style="color"] :is(svg.lucide, svg[data-provider], svg[data-file-brand], svg[data-harness]) { --icon-paint: var(--icon-color); color: var(--icon-paint); }`,
177
156
  ];
178
157
  }
179
158
 
@@ -244,6 +223,11 @@ function invertedSurfaceRules(): string[] {
244
223
  // `currentColor` resolves FROM `color`: feeding it back into the property
245
224
  // that computes `color` is a cycle the browser drops.
246
225
  '[data-icon-style="color"] .bg-ink svg.lucide { color: currentColor; }',
226
+ // A HARNESS mark inside an inverted badge (the generating indicator and the
227
+ // answer footer fill `bg-ink` and set `text-canvas`): the brand hue and the
228
+ // muted ink both disappear against a fill that IS the palette's foreground,
229
+ // so the mark takes the badge's own foreground like every other icon here.
230
+ '[data-icon-style="color"] .bg-ink svg[data-harness] { color: currentColor; }',
247
231
  ':where([data-icon-style="color"]) :where(.bg-ink) :where([data-plugin-mark]) { --plugin-color: currentColor; }',
248
232
  ];
249
233
  }
@@ -263,6 +247,25 @@ function pluginMarkRules(): string[] {
263
247
  ];
264
248
  }
265
249
 
250
+ /**
251
+ * The paper bucket picks which solved table paints the light glyph.
252
+ *
253
+ * `--icon-tone` already holds the DEEP value, and that is deliberate: an engine
254
+ * or a document with no `data-icon-paper` paints the colour every palette
255
+ * clears. The two rules below only RE-POINT a source that a generated row has
256
+ * already stamped, so they are gated on the attribute rather than on the mode
257
+ * and cost nothing when the bucket is `deep`.
258
+ *
259
+ * `:where()` throughout, like every other source rule: a caller's own colour
260
+ * still wins, and the paint rule that follows is what turns this into a `color`.
261
+ */
262
+ function paperBucketRules(): string[] {
263
+ return ICON_TONE_BUCKETS.filter(([bucket]) => bucket !== 'deepest').map(
264
+ ([bucket]) =>
265
+ `:where([data-icon-style="color"][${ICON_PAPER_ATTRIBUTE}="${bucket}"]) :where(svg.lucide) { --icon-color: var(${ICON_TONE_VARIABLE[bucket]}, var(--icon-color)); }`,
266
+ );
267
+ }
268
+
266
269
  /** The signal colours, which beat the hue because they are stated after it. */
267
270
  function signalRules(): string[] {
268
271
  return ICON_TINT_ROWS.map(
@@ -282,6 +285,7 @@ export function iconPaintStyleSheet(): string {
282
285
  '@layer theme, base, components, utilities;',
283
286
  '@layer utilities {',
284
287
  ...hueRules(),
288
+ ...paperBucketRules(),
285
289
  ...signalRules(),
286
290
  // An author's own signal class is a decision, so it is stated after the
287
291
  // table that would otherwise guess one for the same glyph.
@@ -298,13 +302,23 @@ export function iconPaintStyleSheet(): string {
298
302
  ...solidSignalFillRules(),
299
303
  ...projectAccentRules(),
300
304
  ...monochromeRules(),
305
+ // After the ink pass it corrects: same subject, so order decides.
306
+ ...monochromeSolidFillRules(),
301
307
  ...toolCardRules(),
308
+ ...smallGlyphStrokeRules(),
302
309
  ...Object.entries(BRAND_COLORS).flatMap(([name, entry]) =>
303
310
  brandRules(`svg[data-provider="${name}"]`, entry.light, entry.dark),
304
311
  ),
305
312
  ...Object.entries(FILE_BRAND_COLORS).flatMap(([name, entry]) =>
306
313
  brandRules(`svg[data-file-brand="${name}"]`, entry.light, entry.dark),
307
314
  ),
315
+ // Harness marks, brand rows then surface overrides — the order inside that
316
+ // module is what lets `omp-acp` beat the one `omp` brand it shares.
317
+ ...harnessBrandRules(),
318
+ // LAST, because it overrides the rows above in BOTH modes: the composer's tab
319
+ // strip tells its two omp marks apart by hue alone, so the hue survives
320
+ // monochrome there.
321
+ ...harnessTabSurfaceRules(),
308
322
  '}',
309
323
  ].join('\n');
310
324
  return cached;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The harness families inside the generated paint sheet.
8
+ *
9
+ * Kept beside `icon-paint-css.test.ts` rather than in it because the sheet is one
10
+ * string and the harness rules are the only family with TWO layers: a brand row
11
+ * per logo (gated on the colour mode, like every other brand) and a surface row
12
+ * per HARNESS, for the vendor whose two transports share one logo.
13
+ *
14
+ * The ordering assertions are the load-bearing half. Both layers are the same
15
+ * statement at the same specificity, so only document order decides who wins —
16
+ * and a surface rule stated first would be silently overwritten by the brand row
17
+ * it exists to correct.
18
+ */
19
+
20
+ import { describe, expect, test } from 'bun:test';
21
+
22
+ import { iconPaintStyleSheet } from '@/shared/lib/icons/icon-paint-css';
23
+ import { HARNESS_BRAND_COLORS, HARNESS_SURFACE_COLORS } from '@/shared/lib/harness/brand-color';
24
+
25
+ const css = iconPaintStyleSheet();
26
+
27
+ describe('harness paint', () => {
28
+ test('every brand row paints both variants', () => {
29
+ for (const [name, entry] of Object.entries(HARNESS_BRAND_COLORS)) {
30
+ const selector = `svg[data-harness="${name}"]`;
31
+ expect(css).toContain(`:where(${selector}) { --icon-color: ${entry.light}; }`);
32
+ expect(css).toContain(`--icon-color: ${entry.dark ?? 'var(--theme-ink)'}; }`);
33
+ }
34
+ });
35
+
36
+ test('a harness SURFACE overrides the one brand its transports share', () => {
37
+ // Both omp transports draw the same brand key, so the brand rule paints them
38
+ // the same colour. The tab is now the mark alone, which leaves the hue as the
39
+ // only thing distinguishing them — so the per-surface rules must exist AND
40
+ // come after the brand rows.
41
+ const brandIndex = css.lastIndexOf('svg[data-harness="omp"]');
42
+ for (const [id, entry] of Object.entries(HARNESS_SURFACE_COLORS)) {
43
+ const rule = `:where(svg[data-harness-id="${id}"]) { --icon-color: ${entry.light}; }`;
44
+ expect(css).toContain(rule);
45
+ expect(css).toContain(`--icon-color: ${entry.dark ?? 'var(--theme-ink)'}; }`);
46
+ expect(css.indexOf(rule), `${id} must follow the brand rows`).toBeGreaterThan(brandIndex);
47
+ }
48
+ });
49
+
50
+ test('the composer tab strip keeps its two omp hues in BOTH modes', () => {
51
+ // Measured with the label gone: in monochrome both omp marks computed the
52
+ // same ink, so the strip showed two identical glyphs naming two transports.
53
+ // The hue is the name there, so these rules are NOT gated on the colour mode
54
+ // — and they come last, because they also have to beat the colour mode's own
55
+ // `color` statement on the same element.
56
+ for (const [id, entry] of Object.entries(HARNESS_SURFACE_COLORS)) {
57
+ const rule = `[data-harness-tabs] svg[data-harness-id="${id}"] { color: ${entry.light}; }`;
58
+ expect(css).toContain(rule);
59
+ expect(css).toContain(
60
+ `:root[data-theme-variant="dark"] [data-harness-tabs] svg[data-harness-id="${id}"] { color: ${entry.dark ?? entry.light}; }`,
61
+ );
62
+ }
63
+ // Both statement forms, and after the paint rule that sets `color`.
64
+ const paintIndex = css.indexOf('{ --icon-paint: var(--icon-color); color: var(--icon-paint); }');
65
+ expect(css.indexOf('[data-harness-tabs] svg[data-harness-id="omp-acp"]')).toBeGreaterThan(paintIndex);
66
+ });
67
+
68
+ test('an inverted badge still takes its own foreground over the brand hue', () => {
69
+ // The generating indicator and the answer footer fill `bg-ink`; a brand hue on
70
+ // the palette's own foreground is illegible in one of the two themes.
71
+ expect(css).toContain('[data-icon-style="color"] .bg-ink svg[data-harness] { color: currentColor; }');
72
+ });
73
+ });
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The HARNESS marks' paint, split out of `icon-paint-css.ts` so that sheet stays
8
+ * readable. Not independent: these are two of the families it concatenates.
9
+ *
10
+ * Two layers live here, and the second exists because the first cannot express
11
+ * one real case:
12
+ *
13
+ * 1. **The brand** (`data-harness`) — the agent's own colour, gated on the colour
14
+ * mode like every other brand family, so `monochrome` leaves it in the ink.
15
+ * 2. **The surface** (`data-harness-id`) — the same statement keyed by HARNESS
16
+ * rather than by logo, for a vendor publishing ONE mark for two transports.
17
+ * omp is exactly that: `omp-rpc` and `omp-acp` share the art, so the brand row
18
+ * paints them the same purple.
19
+ */
20
+
21
+ import { HARNESS_BRAND_COLORS, HARNESS_SURFACE_COLORS } from '@/shared/lib/harness/brand-color';
22
+
23
+ /** Both rules for one brand, since a brand colour has two values. */
24
+ function brandRules(selector: string, light: string, dark: string | null): string[] {
25
+ return [
26
+ `:where([data-icon-style="color"]) :where(${selector}) { --icon-color: ${light}; }`,
27
+ `:where([data-icon-style="color"][data-theme-variant="dark"]) :where(${selector}) { --icon-color: ${dark ?? 'var(--theme-ink)'}; }`,
28
+ ];
29
+ }
30
+
31
+ /**
32
+ * Every harness mark's brand colour, then the per-surface overrides after it.
33
+ *
34
+ * The order is the contract: an override and the brand row it corrects are the
35
+ * same statement at the same specificity, so only order can let `omp-acp` win
36
+ * over the one `omp` brand both transports share. Stated first, the red would be
37
+ * overwritten by the purple a line above it.
38
+ */
39
+ export function harnessBrandRules(): string[] {
40
+ return [
41
+ ...Object.entries(HARNESS_BRAND_COLORS).flatMap(([name, entry]) =>
42
+ brandRules(`svg[data-harness="${name}"]`, entry.light, entry.dark),
43
+ ),
44
+ ...Object.entries(HARNESS_SURFACE_COLORS).flatMap(([id, entry]) =>
45
+ brandRules(`svg[data-harness-id="${id}"]`, entry.light, entry.dark),
46
+ ),
47
+ ];
48
+ }
49
+
50
+ /**
51
+ * The composer's tab strip paints its TWO omp surfaces in BOTH modes.
52
+ *
53
+ * The one place a harness hue is not a decoration to be dropped when the user
54
+ * picks monochrome, and the reason is structural: `omp-rpc` and `omp-acp` draw
55
+ * the SAME brand art, the strip prints no label, and measured with the label
56
+ * gone, both marks computed the identical ink (`rgb(101, 99, 95)`) — two glyphs
57
+ * side by side, indistinguishable, naming two different transports. The hue IS
58
+ * the name here, so it survives the mode that repaints every other icon; every
59
+ * other harness mark still follows the mode.
60
+ *
61
+ * `color` on the svg rather than `--icon-color`: under the colour mode the paint
62
+ * rule also sets `color` at (0,2,1), and these rules are emitted LAST at the same
63
+ * weight, so order is what lets the surface win — the same contract as the gated
64
+ * rows above.
65
+ */
66
+ export function harnessTabSurfaceRules(): string[] {
67
+ const rules: string[] = [];
68
+ for (const [id, entry] of Object.entries(HARNESS_SURFACE_COLORS)) {
69
+ rules.push(`[data-harness-tabs] svg[data-harness-id="${id}"] { color: ${entry.light}; }`);
70
+ rules.push(
71
+ `:root[data-theme-variant="dark"] [data-harness-tabs] svg[data-harness-id="${id}"] { color: ${entry.dark ?? entry.light}; }`,
72
+ );
73
+ }
74
+ return rules;
75
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The two modes that paint a glyph in INK rather than a hue.
8
+ *
9
+ * Split out of `icon-paint-css.ts` so both files stay readable, not because the
10
+ * rules are independent: they are one of the families that sheet concatenates.
11
+ *
12
+ * Monochrome is the absence of `data-icon-style`, and a tool card is ink in BOTH
13
+ * modes — so these are the only rules in the sheet that can override a caller's
14
+ * colour class by design rather than by cascade accident.
15
+ */
16
+
17
+ import { SOLID_FILL_EXCLUSIONS } from '@/shared/lib/icons/icon-paint-authority';
18
+
19
+ /**
20
+ * MONOCHROME: an icon takes the ink of the text beside it.
21
+ *
22
+ * The colour mode is a generated sheet of hues; monochrome is the ABSENCE of the
23
+ * attribute, and until this rule that absence only meant "no hue is added" — it
24
+ * did not take away the colours an AUTHOR had written. So a `Check` with
25
+ * `text-success` in a tool card stayed green with the setting on monochrome
26
+ * ("di setting monochrome kenapa iconnya berwarna?"), and the same icon then
27
+ * turned into a hue under `color`, which read as the mode being half-applied.
28
+ *
29
+ * `var(--theme-ink)`, not `currentColor`: a `Check` inside a green status chip
30
+ * INHERITS the chip's green, so `currentColor` left it green — measured, two
31
+ * icons survived a monochrome pass that way (`lucide-info` in an info chip, a
32
+ * loader in a warning one). Icons that say `text-ink/…` are excluded (that IS
33
+ * the ink, at the weight the caller chose), and an inverted `bg-ink` surface
34
+ * keeps its own foreground.
35
+ *
36
+ * A SOLID SIGNAL FILL is excluded for the same reason as `bg-ink`: the ink is
37
+ * the wrong end of the contrast on it. Measured over the 63 palettes, a glyph
38
+ * on `bg-error` computed 1.04:1 on `osaka-jade-light`, and 44 of 63 sat under
39
+ * the 3:1 floor for a graphic — the composer's newly filled Stop and Send
40
+ * buttons would have been blank squares on any monochrome install. The
41
+ * foreground comes from `monochromeSolidFillRules`, stated after this one.
42
+ *
43
+ * Specificity is the point: `:root:not(…)` plus the class beats a single utility
44
+ * class, so this wins over `text-success` inside the same layer.
45
+ */
46
+ export function monochromeRules(): string[] {
47
+ return [
48
+ `:root:not([data-icon-style="color"]) svg.lucide:not([class*="text-ink"]):not(.bg-ink *)${SOLID_FILL_EXCLUSIONS} { color: var(--theme-ink); }`,
49
+ ':root:not([data-icon-style="color"]) [data-plugin-mark] { --plugin-color: currentColor; }',
50
+ ];
51
+ }
52
+
53
+ /**
54
+ * Inside a TOOL CARD, icons are ink in BOTH modes.
55
+ *
56
+ * A transcript is a reading surface: one turn can hold twenty cards, each with a
57
+ * status chip, a file mark and a chevron, and a hue per icon turns the densest
58
+ * part of the app into confetti. The codebase already said so for file-type
59
+ * marks — `languageBrandIcon` passes `monochrome` for exactly this surface — but
60
+ * the Lucide glyphs inside a card were never covered, so they followed the mode
61
+ * and flipped colour the moment the setting changed.
62
+ *
63
+ * `var(--theme-ink)` rather than `currentColor`: the check inside a green status
64
+ * chip inherits the chip's green, which is the colour this rule exists to remove.
65
+ * Icons that declare `text-ink/…` are left alone (that is the ink, at the weight
66
+ * the caller chose), and an inverted `bg-ink` surface or a solid signal fill
67
+ * keeps its own foreground — that surface declares it, and this rule is about
68
+ * the glyphs that declare nothing.
69
+ */
70
+ export function toolCardRules(): string[] {
71
+ return [
72
+ `[data-tool-row] svg.lucide:not([class*="text-ink"]):not(.bg-ink *)${SOLID_FILL_EXCLUSIONS} { color: var(--theme-ink); }`,
73
+ '[data-tool-row] [data-plugin-mark] { --plugin-color: var(--theme-ink); }',
74
+ ];
75
+ }
76
+
77
+ /**
78
+ * A small glyph is drawn with a slightly heavier stroke, because at 12-14px a 2px
79
+ * stroke is barely one pixel of ink once rasterised.
80
+ *
81
+ * This is the answer to "ikon kecil kurang tegas" that costs NOTHING in contrast:
82
+ * the colour already solves to the brightest legal lightness the paper allows
83
+ * (mean L 0.626 on the light side, 3.15:1 minimum), and a light-mode glyph cannot
84
+ * be made brighter than that without dropping under the graphic floor — measured,
85
+ * L 0.78 on `#f1f1f0` is 1.96:1, which is invisible. Thickening the stroke raises
86
+ * how much ink the glyph actually puts down instead.
87
+ *
88
+ * **Measured constraint: the attribute cannot opt out.** Lucide writes
89
+ * `stroke-width="2"` for a default AND `stroke-width="1.8"` for an explicit prop,
90
+ * so `:not([stroke-width])` never matches anything and a rule keyed on it is
91
+ * dead. This rule therefore wins over both, which is acceptable because the four
92
+ * bundled explicit weights (1.6, 1.8, 2.2, 2.4) are all within a quarter-pixel of
93
+ * this value — the dense outline lists that ask for 1.8 asked for a LIGHTER
94
+ * stroke than 2.4, and 2.25 keeps that intent within one step while making the
95
+ * 12px glyph legible. CSS outranks a presentation attribute, which is what makes
96
+ * this a stylesheet rule instead of 400 call-site edits.
97
+ *
98
+ * The selector is deliberately narrow: `svg.lucide` is on the element, so the
99
+ * rule only reaches an ICON, and the sizes are listed because SVG has no numeric
100
+ * attribute selector.
101
+ */
102
+ const SMALL_GLYPH_STROKE = '2.25';
103
+
104
+ export function smallGlyphStrokeRules(): string[] {
105
+ return [
106
+ `svg.lucide:is([width="10"], [width="11"], [width="12"], [width="13"], [width="14"]) { stroke-width: ${SMALL_GLYPH_STROKE}; }`,
107
+ ];
108
+ }
@@ -18,7 +18,8 @@
18
18
  * to dim, and the colour comes from the mode.
19
19
  */
20
20
 
21
- import { DEFAULT_ICON_HUE, ICON_HUE_PAINT } from '@/shared/lib/icons/tint';
21
+ import { DEFAULT_ICON_HUE, ICON_HUE_PAINT, ICON_PAPER_ATTRIBUTE } from '@/shared/lib/icons/tint';
22
+ import type { PaperBucket } from '@/shared/lib/icons/icon-tone';
22
23
 
23
24
  /**
24
25
  * Three sources, in this order: the colour a PLUGIN DECLARED in its manifest
@@ -31,19 +32,23 @@ import { DEFAULT_ICON_HUE, ICON_HUE_PAINT } from '@/shared/lib/icons/tint';
31
32
  * same `legiblePair` rule the brand tables use, so the plugin's colour reaches
32
33
  * the mark without dropping it below the floor.
33
34
  */
34
- function panelPaint(variant: 'light' | 'dark'): string {
35
+ function panelPaint(variant: 'light' | 'dark', bucket: PaperBucket = 'deepest'): string {
35
36
  const { saturation, lightness } = ICON_HUE_PAINT[variant];
36
37
  const hsl = `hsl(var(--panel-hue, var(--icon-hue, ${DEFAULT_ICON_HUE})) ${saturation}% ${lightness}%)`;
37
38
  // Both variants read a `--panel-tone*` stamped by `PanelMark` from the solved
38
39
  // table: a panel's hue is assigned at runtime, so it cannot be a generated CSS
39
40
  // row, and an unsolved `hsl()` on the dark side is the lightness spread this
40
- // mode was fixed by removing.
41
- const toned = variant === 'light' ? `var(--panel-tone, ${hsl})` : `var(--panel-tone-dark, ${hsl})`;
41
+ // mode was fixed by removing. Light picks the bucket the palette is painting,
42
+ // exactly like the generated glyph rows.
43
+ const toned = variant === 'light' ? `var(--panel-tone${bucket === 'deepest' ? '' : `-${bucket}`}, ${hsl})` : `var(--panel-tone-dark, ${hsl})`;
42
44
  return `var(--panel-color-${variant}, ${toned})`;
43
45
  }
44
46
 
45
47
  export function panelMarkRules(): string[] {
46
48
  const light = panelPaint('light');
49
+ const brighter = (['deeper', 'deep', 'mid', 'light', 'bright'] as const).map(
50
+ (bucket) => [bucket, panelPaint('light', bucket)] as const,
51
+ );
47
52
  const dark = panelPaint('dark');
48
53
  // `[data-panel-mark]`, not `.panel-rail-mark`: the rail is not the only surface
49
54
  // that draws a panel, and it used to be the only one that got the PANEL's
@@ -64,12 +69,22 @@ export function panelMarkRules(): string[] {
64
69
  // tuned for paper, and the chip already declares its own foreground.
65
70
  const scope = `:root[data-icon-style="color"] [data-panel-mark]:not(.bg-ink *) svg.lucide`;
66
71
  const scopeDark = `:root[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark]:not(.bg-ink *) svg.lucide`;
72
+ // The two brighter buckets, stated AFTER the deep one at the same specificity,
73
+ // so a `mid` or `bright` paper re-points the same mark the glyph rows use.
74
+ // Without these a panel would keep the deepest table on every light palette —
75
+ // the rail reading darker than the icons in the panels behind it.
76
+ const bucketRule = (bucket: string, paint: string) =>
77
+ `:root[data-icon-style="color"][${ICON_PAPER_ATTRIBUTE}="${bucket}"] [data-panel-mark]:not(.bg-ink *) svg.lucide { color: ${paint}; }`;
78
+ const bucketPluginRule = (bucket: string, paint: string) =>
79
+ `:root[data-icon-style="color"][${ICON_PAPER_ATTRIBUTE}="${bucket}"] [data-panel-mark] [data-plugin-mark] { --plugin-color: ${paint}; }`;
67
80
  return [
68
81
  `${scope} { color: ${light}; }`,
82
+ ...brighter.map(([bucket, paint]) => bucketRule(bucket, paint)),
69
83
  `${scopeDark} { color: ${dark}; }`,
70
84
  // A plugin's mark states its own `--plugin-color` from its name; inside a
71
85
  // panel mark the panel's declared colour (or assigned hue) is the authority.
72
86
  `:root[data-icon-style="color"] [data-panel-mark] [data-plugin-mark] { --plugin-color: ${light}; }`,
87
+ ...brighter.map(([bucket, paint]) => bucketPluginRule(bucket, paint)),
73
88
  `:root[data-icon-style="color"][data-theme-variant="dark"] [data-panel-mark] [data-plugin-mark] { --plugin-color: ${dark}; }`,
74
89
  // The idle state moves LUMINANCE, never alpha.
75
90
  //
@@ -93,11 +93,30 @@ const WEIGHT_STEPS = [20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90
93
93
  */
94
94
  const WEIGHT_CHROMA_FLOOR = 0.45;
95
95
 
96
+ /**
97
+ * How far a weight DARKENS while it removes chroma, per unit of chroma lost.
98
+ *
99
+ * Scaling chroma alone is not contrast-neutral: the tone sits AT the floor
100
+ * (3.15-3.3:1), and a less chromatic colour at the same lightness measures
101
+ * slightly worse against paper. Measured on the mid bucket after the tone was
102
+ * brightened, `text-ink/50` on a 13px folder glyph read **2.96:1** — under the
103
+ * floor, on the sidebar's own marks. The correction is negative lightness
104
+ * proportional to the chroma actually removed: `sink 0.08` takes the quietest
105
+ * weight (`/20`) from min **3.02** to **3.48**, and `/40` from 3.06 to 3.41.
106
+ *
107
+ * It darkens only the MUTED steps, so the full-strength tone keeps the brightness
108
+ * it was solved for — which is the whole report.
109
+ */
110
+ const WEIGHT_LIGHTNESS_SINK = 0.08;
111
+
96
112
  /** The weight at `step/100`, or the untouched colour. */
97
113
  function paintAt(step: number | null): string {
98
114
  if (step === null) return 'var(--icon-color)';
99
- const scale = (WEIGHT_CHROMA_FLOOR + (1 - WEIGHT_CHROMA_FLOOR) * (step / 100)).toFixed(3);
100
- return `oklch(from var(--icon-color) l calc(c * ${scale}) h)`;
115
+ const scale = WEIGHT_CHROMA_FLOOR + (1 - WEIGHT_CHROMA_FLOOR) * (step / 100);
116
+ // `l - SINK * (1 - scale)` is the same expression the measurement used: no sink
117
+ // at full strength, the deepest sink at the quietest step.
118
+ const sink = (WEIGHT_LIGHTNESS_SINK * (1 - scale)).toFixed(4);
119
+ return `oklch(from var(--icon-color) calc(l - ${sink}) calc(c * ${scale.toFixed(3)}) h)`;
101
120
  }
102
121
 
103
122
  /** Every variant prefix that carries a `text-ink` weight somewhere in this app. */