@kabmo-labs/kabmo 0.17.0 → 0.19.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 (438) hide show
  1. package/README.md +10 -7
  2. package/dist/client/index.html +1 -1
  3. package/dist/client/index.js +523 -441
  4. package/dist/client/static/js/{index-rerjq5th.js → index-fcee4c13.js} +828 -818
  5. package/dist/client/static/js/index-sxdw908m.css +1 -0
  6. package/marketplace/plugins/command-runner/package.json +3 -2
  7. package/marketplace/plugins/git-forge/package.json +3 -2
  8. package/marketplace/plugins/session-info/package.json +3 -2
  9. package/marketplace/plugins/stats/package.json +3 -2
  10. package/package.json +3 -1
  11. package/src/client/components/auth/login-screen/index.tsx +2 -1
  12. package/src/client/components/common/ComposerPicker.tsx +1 -1
  13. package/src/client/components/common/FolderPicker.tsx +2 -2
  14. package/src/client/components/common/MarkdownRenderer.tsx +136 -89
  15. package/src/client/components/common/Modal.tsx +2 -2
  16. package/src/client/components/common/PWAInstallButton.tsx +2 -2
  17. package/src/client/components/common/ViewportSelector.tsx +1 -1
  18. package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
  19. package/src/client/components/common/anchored-menu/index.tsx +147 -0
  20. package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
  21. package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
  22. package/src/client/components/common/brand-wordmark/index.tsx +13 -2
  23. package/src/client/components/common/checkbox/style.test.ts +139 -0
  24. package/src/client/components/common/checkbox/style.ts +51 -0
  25. package/src/client/components/common/context-usage-button/index.tsx +2 -2
  26. package/src/client/components/common/file-icon/index.tsx +23 -9
  27. package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
  28. package/src/client/components/common/markdown-review/ReviewPopover.tsx +144 -0
  29. package/src/client/components/common/markdown-review/ReviewSummary.tsx +108 -0
  30. package/src/client/components/common/markdown-review/index.tsx +129 -0
  31. package/src/client/components/common/panel-mark/index.tsx +97 -0
  32. package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
  33. package/src/client/components/common/provider-icon/index.test.ts +14 -0
  34. package/src/client/components/common/provider-icon/index.tsx +4 -0
  35. package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
  36. package/src/client/components/common/provider-icon/resolve.ts +16 -3
  37. package/src/client/components/common/server-control/Panel.tsx +33 -23
  38. package/src/client/components/common/server-control/index.test.tsx +11 -5
  39. package/src/client/components/common/server-control/index.tsx +10 -8
  40. package/src/client/components/common/session-actions-menu/index.tsx +1 -1
  41. package/src/client/components/common/toolbar-row/index.tsx +1 -1
  42. package/src/client/components/layout/ActivityBar.tsx +22 -3
  43. package/src/client/components/layout/LeftDock.tsx +9 -2
  44. package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
  45. package/src/client/components/layout/WindowAura.tsx +27 -0
  46. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
  47. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
  48. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
  49. package/src/client/components/layout/desktop-layout/index.tsx +3 -1
  50. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +44 -23
  51. package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +36 -17
  52. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -7
  53. package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
  54. package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
  55. package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
  56. package/src/client/components/layout/session-sidebar/about-modal/NotesDialog.tsx +94 -0
  57. package/src/client/components/layout/session-sidebar/about-modal/VersionLine.test.tsx +68 -0
  58. package/src/client/components/layout/session-sidebar/about-modal/VersionLine.tsx +36 -0
  59. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +57 -34
  60. package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
  61. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +40 -14
  62. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +7 -6
  63. package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +1 -1
  64. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
  65. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
  66. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
  67. package/src/client/components/layout/update-popup/ReleaseNotes.tsx +8 -3
  68. package/src/client/components/layout/update-popup/index.tsx +5 -1
  69. package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
  70. package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
  71. package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +13 -15
  72. package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +23 -1
  73. package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +30 -0
  74. package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +18 -2
  75. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
  76. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +22 -67
  77. package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
  78. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
  79. package/src/client/components/mobile/panel-chips.tsx +10 -2
  80. package/src/client/components/settings/Modal.tsx +4 -4
  81. package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
  82. package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
  83. package/src/client/components/settings/apply-side-effects.test.ts +30 -0
  84. package/src/client/components/settings/apply-side-effects.ts +14 -0
  85. package/src/client/components/settings/categories/AgentSettings.tsx +23 -50
  86. package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
  87. package/src/client/components/settings/categories/CommandSettings.tsx +2 -2
  88. package/src/client/components/settings/categories/McpSettings.tsx +4 -21
  89. package/src/client/components/settings/categories/OmpSettings.tsx +147 -194
  90. package/src/client/components/settings/categories/SkillSettings.tsx +2 -2
  91. package/src/client/components/settings/categories/TokenUsageSettings.tsx +211 -229
  92. package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +229 -237
  93. package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +71 -0
  94. package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +9 -2
  95. package/src/client/components/settings/categories/agent-settings/levels.ts +38 -0
  96. package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
  97. package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
  98. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
  99. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
  100. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
  101. package/src/client/components/settings/categories/behavior-settings/Editor.tsx +27 -7
  102. package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +23 -5
  103. package/src/client/components/settings/categories/command-settings/DetailPane.tsx +75 -33
  104. package/src/client/components/settings/categories/command-settings/SidebarList.tsx +7 -0
  105. package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +93 -77
  106. package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
  107. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +28 -15
  108. package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +20 -0
  109. package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +97 -36
  110. package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +151 -0
  111. package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +68 -32
  112. package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +119 -0
  113. package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +14 -7
  114. package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +15 -6
  115. package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +165 -226
  116. package/src/client/components/settings/categories/omp-settings/types.ts +28 -0
  117. package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
  118. package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
  119. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
  120. package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +51 -2
  121. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +43 -10
  122. package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
  123. package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
  124. package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
  125. package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
  126. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
  127. package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
  128. package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
  129. package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
  130. package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +37 -8
  131. package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +34 -14
  132. package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +21 -0
  133. package/src/client/components/settings/categories/skill-settings/pane.test.tsx +15 -6
  134. package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +242 -102
  135. package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +130 -56
  136. package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +135 -0
  137. package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +55 -33
  138. package/src/client/components/settings/categories/token-usage-settings/Provenance.tsx +59 -0
  139. package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +239 -0
  140. package/src/client/components/workspace/browser-panel/Screencast.test.ts +1 -0
  141. package/src/client/components/workspace/browser-panel/Screencast.tsx +17 -22
  142. package/src/client/components/workspace/browser-panel/TabStrip.test.tsx +158 -0
  143. package/src/client/components/workspace/browser-panel/TabStrip.tsx +90 -0
  144. package/src/client/components/workspace/browser-panel/index.tsx +50 -4
  145. package/src/client/components/workspace/browser-toolbar/index.tsx +41 -1
  146. package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
  147. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
  148. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
  149. package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +3 -1
  150. package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
  151. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
  152. package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
  153. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
  154. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
  155. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
  156. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
  157. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
  158. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
  159. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
  160. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
  161. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +88 -0
  162. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +24 -1
  163. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +34 -0
  164. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +5 -1
  165. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
  166. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +237 -0
  167. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +191 -0
  168. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +1 -1
  169. package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
  170. package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +21 -7
  171. package/src/client/components/workspace/diff-panel/changes.test.ts +51 -0
  172. package/src/client/components/workspace/diff-panel/changes.ts +28 -12
  173. package/src/client/components/workspace/diff-panel/index.tsx +2 -2
  174. package/src/client/components/workspace/diff-panel/merge.test.ts +28 -0
  175. package/src/client/components/workspace/diff-panel/merge.ts +21 -1
  176. package/src/client/components/workspace/editor/Body.tsx +7 -0
  177. package/src/client/components/workspace/editor/FileDocument.tsx +15 -21
  178. package/src/client/components/workspace/editor/FilePane.tsx +12 -0
  179. package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
  180. package/src/client/components/workspace/editor/PreviewPane.tsx +70 -0
  181. package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
  182. package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
  183. package/src/client/components/workspace/editor/Tabs.tsx +1 -1
  184. package/src/client/components/workspace/editor/Toolbar.tsx +17 -1
  185. package/src/client/components/workspace/editor/index.tsx +25 -22
  186. package/src/client/components/workspace/editor/toolbar-clusters.test.ts +14 -0
  187. package/src/client/components/workspace/editor/toolbar-clusters.tsx +12 -86
  188. package/src/client/components/workspace/editor/toolbar-toggle.tsx +53 -0
  189. package/src/client/components/workspace/editor/toolbar-write-clusters.tsx +112 -0
  190. package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
  191. package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
  192. package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
  193. package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
  194. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
  195. package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
  196. package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
  197. package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
  198. package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
  199. package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
  200. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
  201. package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
  202. package/src/client/components/workspace/git-panel/index.tsx +7 -0
  203. package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
  204. package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
  205. package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
  206. package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
  207. package/src/client/components/workspace/search-panel/Body.tsx +1 -1
  208. package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
  209. package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -0
  210. package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +201 -0
  211. package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +112 -0
  212. package/src/client/components/workspace/user-browser-panel/AnnotateLayer.test.tsx +225 -0
  213. package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +217 -0
  214. package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +99 -0
  215. package/src/client/components/workspace/user-browser-panel/Frame.tsx +30 -1
  216. package/src/client/components/workspace/user-browser-panel/index.tsx +81 -2
  217. package/src/client/data/agent-data/builtin.ts +0 -10
  218. package/src/client/data/agent-data/orchestrator.ts +0 -45
  219. package/src/client/data/agent-data/specialist.ts +0 -100
  220. package/src/client/data/mock/token-usage.ts +170 -120
  221. package/src/client/data/settings/omp-schema.json +33 -1
  222. package/src/client/glass.css +785 -0
  223. package/src/client/glass.test.ts +346 -0
  224. package/src/client/hooks/browser/use-annotate.test.ts +143 -0
  225. package/src/client/hooks/browser/use-annotate.ts +98 -0
  226. package/src/client/hooks/browser/use-close-tab.test.ts +148 -0
  227. package/src/client/hooks/browser/use-close-tab.ts +67 -0
  228. package/src/client/hooks/browser/use-screencast.ts +13 -1
  229. package/src/client/hooks/chat/composer/browser-context.test.ts +117 -0
  230. package/src/client/hooks/chat/composer/browser-context.ts +40 -16
  231. package/src/client/hooks/chat/composer/items.test.ts +1 -1
  232. package/src/client/hooks/chat/composer/review-context.ts +38 -0
  233. package/src/client/hooks/chat/composer/use-draft.test.ts +132 -0
  234. package/src/client/hooks/chat/composer/use-draft.ts +31 -2
  235. package/src/client/hooks/chat/timeline/row-window.test.ts +15 -2
  236. package/src/client/hooks/editor/use-document-annotations.ts +124 -0
  237. package/src/client/hooks/editor/use-editor-panel-ui.ts +52 -0
  238. package/src/client/hooks/editor/use-file-review-mode.ts +35 -0
  239. package/src/client/hooks/editor/use-preview-review.ts +148 -0
  240. package/src/client/hooks/settings/agents.ts +149 -0
  241. package/src/client/hooks/settings/crud-list.test.ts +28 -6
  242. package/src/client/hooks/settings/crud-list.ts +96 -57
  243. package/src/client/hooks/settings/omp-config.ts +164 -0
  244. package/src/client/hooks/settings/useTokenUsage.ts +125 -0
  245. package/src/client/hooks/settings/write-feedback.test.ts +104 -0
  246. package/src/client/hooks/settings/write-feedback.ts +63 -0
  247. package/src/client/hooks/ui/glass-support.ts +57 -0
  248. package/src/client/hooks/ui/icon-style.ts +59 -0
  249. package/src/client/hooks/ui/markdown-hydration.ts +125 -0
  250. package/src/client/hooks/ui/stuck-header.test.ts +188 -0
  251. package/src/client/hooks/ui/stuck-header.ts +91 -0
  252. package/src/client/hooks/ui/style-attributes.test.ts +120 -0
  253. package/src/client/hooks/ui/surface-style.ts +56 -0
  254. package/src/client/hooks/ui/updates/index.test.ts +100 -1
  255. package/src/client/hooks/ui/updates/index.ts +50 -0
  256. package/src/client/hooks/ui/updates/notes.test.ts +138 -0
  257. package/src/client/hooks/ui/updates/notes.ts +57 -0
  258. package/src/client/hooks/workspace/panel-hues.ts +23 -0
  259. package/src/client/lib/browser/element-at.test.ts +229 -0
  260. package/src/client/lib/browser/element-at.ts +139 -0
  261. package/src/client/lib/review/client.ts +73 -0
  262. package/src/client/lib/router/search-params.ts +42 -20
  263. package/src/client/main.tsx +10 -0
  264. package/src/client/tailwind.css +329 -11
  265. package/src/server/lib/assets/shell-attributes.server.ts +80 -0
  266. package/src/server/lib/assets/shell-attributes.test.ts +86 -0
  267. package/src/server/lib/btw/lifecycle.server.ts +2 -2
  268. package/src/server/lib/db/schema.ts +7 -0
  269. package/src/server/lib/db/seed-terminal.test.ts +4 -0
  270. package/src/server/lib/omp/config/agent-definitions.test.ts +273 -0
  271. package/src/server/lib/omp/config/agents.ts +231 -61
  272. package/src/server/lib/omp/config/definitions.test.ts +9 -105
  273. package/src/server/lib/omp/config/extensions.ts +16 -7
  274. package/src/server/lib/omp/config/omp-config-files.test.ts +27 -0
  275. package/src/server/lib/omp/rpc/constants.test.ts +11 -0
  276. package/src/server/lib/omp/rpc/constants.ts +15 -0
  277. package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
  278. package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
  279. package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
  280. package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
  281. package/src/server/lib/omp/rpc/manager.ts +2 -2
  282. package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
  283. package/src/server/lib/omp/rpc/process.test.ts +106 -0
  284. package/src/server/lib/omp/rpc/process.ts +39 -18
  285. package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
  286. package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
  287. package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
  288. package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
  289. package/src/server/lib/omp/rpc/session-commands.ts +17 -3
  290. package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
  291. package/src/server/lib/omp/rpc/utility-agent-dir.test.ts +134 -0
  292. package/src/server/lib/omp/rpc/utility-agent-dir.ts +138 -0
  293. package/src/server/lib/omp/rpc/utility.ts +12 -0
  294. package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
  295. package/src/server/lib/panels/manifest.test.ts +20 -0
  296. package/src/server/lib/panels/manifest.ts +12 -0
  297. package/src/server/lib/panels/scan.server.ts +4 -0
  298. package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
  299. package/src/server/lib/queue/delivery-harness.ts +8 -4
  300. package/src/server/lib/queue/delivery.server.test.ts +29 -0
  301. package/src/server/lib/queue/delivery.server.ts +39 -0
  302. package/src/server/lib/queue/store.server.test.ts +22 -2
  303. package/src/server/lib/queue/store.server.ts +33 -11
  304. package/src/server/lib/review/schema.server.ts +45 -0
  305. package/src/server/lib/review/store.server.ts +138 -0
  306. package/src/server/lib/terminal/attach-replay.test.ts +132 -0
  307. package/src/server/lib/terminal/output.test.ts +166 -0
  308. package/src/server/lib/terminal/output.ts +104 -0
  309. package/src/server/lib/terminal/runtime.server.ts +5 -0
  310. package/src/server/lib/terminal/send-result.test.ts +33 -0
  311. package/src/server/lib/terminal/send-result.ts +32 -0
  312. package/src/server/lib/terminal/session.server.ts +45 -11
  313. package/src/server/lib/terminal/store-liveness.test.ts +4 -0
  314. package/src/server/lib/updates/active-notes.test.ts +149 -0
  315. package/src/server/lib/updates/active-notes.ts +75 -0
  316. package/src/server/lib/updates/changelog-file.ts +42 -11
  317. package/src/server/lib/updates/changelog.test.ts +15 -1
  318. package/src/server/lib/updates/omp.ts +42 -15
  319. package/src/server/lib/updates/release-url.ts +27 -1
  320. package/src/server/lib/usage/index-parse.test.ts +200 -0
  321. package/src/server/lib/usage/index-parse.ts +178 -0
  322. package/src/server/lib/usage/index-query.server.ts +248 -0
  323. package/src/server/lib/usage/index-scan.server.ts +343 -0
  324. package/src/server/lib/usage/index-schema.server.ts +82 -0
  325. package/src/server/lib/usage/index.test.ts +234 -0
  326. package/src/server/lib/usage/providers.server.ts +4 -53
  327. package/src/server/plugins/ssr.ts +22 -5
  328. package/src/server/routes/browser/index.ts +3 -0
  329. package/src/server/routes/browser/stream.ts +31 -2
  330. package/src/server/routes/browser/tabs.test.ts +94 -0
  331. package/src/server/routes/browser/tabs.ts +85 -0
  332. package/src/server/routes/index.ts +2 -0
  333. package/src/server/routes/review/bindings.ts +11 -0
  334. package/src/server/routes/review/index.ts +127 -0
  335. package/src/server/routes/review/routes.test.ts +191 -0
  336. package/src/server/routes/settings/agents.test.ts +180 -0
  337. package/src/server/routes/settings/agents.ts +95 -102
  338. package/src/server/routes/settings/mcp.test.ts +135 -0
  339. package/src/server/routes/settings/mcp.ts +14 -6
  340. package/src/server/routes/settings/settings-store-routes.test.ts +6 -113
  341. package/src/server/routes/telemetry/tokens.test.ts +145 -0
  342. package/src/server/routes/telemetry/tokens.ts +70 -149
  343. package/src/server/routes/terminal/ws.ts +6 -5
  344. package/src/server/routes/updates/index.ts +2 -0
  345. package/src/server/routes/updates/notes.ts +34 -0
  346. package/src/server/routes/updates/routes.test.ts +49 -0
  347. package/src/shared/lib/browser/annotate.test.ts +283 -0
  348. package/src/shared/lib/browser/annotate.ts +231 -0
  349. package/src/shared/lib/browser/browser-viewer.test.ts +26 -4
  350. package/src/shared/lib/browser/frame-gate.test.ts +91 -0
  351. package/src/shared/lib/browser/frame-gate.ts +69 -0
  352. package/src/shared/lib/browser/frame-params.test.ts +43 -0
  353. package/src/shared/lib/browser/frame-params.ts +60 -0
  354. package/src/shared/lib/browser/frame-pipeline.test.ts +132 -0
  355. package/src/shared/lib/browser/frame-pipeline.ts +80 -0
  356. package/src/shared/lib/browser/page-context.ts +60 -4
  357. package/src/shared/lib/browser/snapshot.test.ts +115 -0
  358. package/src/shared/lib/browser/snapshot.ts +112 -0
  359. package/src/shared/lib/browser/tab-close.test.ts +74 -0
  360. package/src/shared/lib/browser/tab-close.ts +77 -0
  361. package/src/shared/lib/browser/viewer.ts +45 -26
  362. package/src/shared/lib/chat/timeline/block-chrome.ts +19 -0
  363. package/src/shared/lib/chat/timeline/tool-render-mode.ts +17 -4
  364. package/src/shared/lib/chat/tool/artifact.ts +55 -20
  365. package/src/shared/lib/chat/tool/bash-facts.ts +96 -0
  366. package/src/shared/lib/chat/tool/minimized.test.ts +98 -0
  367. package/src/shared/lib/chat/tool/minimized.ts +64 -0
  368. package/src/shared/lib/chat/tool/summary.test.ts +28 -8
  369. package/src/shared/lib/chat/tool/summary.ts +3 -32
  370. package/src/shared/lib/icons/file-brand-color.ts +38 -0
  371. package/src/shared/lib/icons/icon-paint-css.test.ts +234 -0
  372. package/src/shared/lib/icons/icon-paint-css.ts +284 -0
  373. package/src/shared/lib/icons/icon-paint-panel.ts +100 -0
  374. package/src/shared/lib/icons/tint-hues.generated.ts +230 -0
  375. package/src/shared/lib/icons/tint.test.ts +273 -0
  376. package/src/shared/lib/icons/tint.ts +219 -0
  377. package/src/shared/lib/markdown/blocks/anchor.ts +63 -0
  378. package/src/shared/lib/markdown/blocks/blocks.test.ts +141 -0
  379. package/src/shared/lib/markdown/blocks/renderer.ts +120 -0
  380. package/src/shared/lib/markdown/blocks/scan.ts +100 -0
  381. package/src/shared/lib/markdown/blocks/types.ts +62 -0
  382. package/src/shared/lib/markdown/marked.ts +58 -147
  383. package/src/shared/lib/markdown/math-extensions.ts +168 -0
  384. package/src/shared/lib/markdown/review/prompt.ts +77 -0
  385. package/src/shared/lib/markdown/review/reconcile.ts +55 -0
  386. package/src/shared/lib/markdown/review/review.test.ts +96 -0
  387. package/src/shared/lib/markdown/xml-sections.test.ts +140 -0
  388. package/src/shared/lib/markdown/xml-sections.ts +139 -0
  389. package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
  390. package/src/shared/lib/models/provider/brand-color.ts +103 -0
  391. package/src/shared/lib/models/provider/label.ts +57 -0
  392. package/src/shared/lib/omp/config/agent-file.test.ts +54 -0
  393. package/src/shared/lib/omp/config/agent-file.ts +43 -0
  394. package/src/shared/lib/omp/config/row-value.test.ts +95 -0
  395. package/src/shared/lib/omp/config/row-value.ts +97 -0
  396. package/src/shared/lib/omp/config/schema.test.ts +31 -0
  397. package/src/shared/lib/omp/config/schema.ts +6 -0
  398. package/src/shared/lib/omp/rpc/frame.test.ts +113 -47
  399. package/src/shared/lib/omp/rpc/frame.ts +107 -43
  400. package/src/shared/lib/settings/defaults.ts +4 -0
  401. package/src/shared/lib/theme/catalog.test.ts +5 -4
  402. package/src/shared/lib/theme/catalog.ts +18 -3
  403. package/src/shared/lib/theme/glass-support.test.ts +38 -0
  404. package/src/shared/lib/theme/glass-support.ts +73 -0
  405. package/src/shared/lib/theme/icon-style.test.ts +74 -0
  406. package/src/shared/lib/theme/icon-style.ts +90 -0
  407. package/src/shared/lib/theme/legibility.ts +91 -0
  408. package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
  409. package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
  410. package/src/shared/lib/theme/surface-style.test.ts +68 -0
  411. package/src/shared/lib/theme/surface-style.ts +91 -0
  412. package/src/shared/lib/theme/theme.test.ts +11 -7
  413. package/src/shared/lib/ui/menu-anchor.test.ts +69 -0
  414. package/src/shared/lib/ui/menu-anchor.ts +89 -0
  415. package/src/shared/lib/usage/breakdown.test.ts +197 -0
  416. package/src/shared/lib/usage/breakdown.ts +241 -0
  417. package/src/shared/lib/usage/range.test.ts +204 -0
  418. package/src/shared/lib/usage/range.ts +240 -0
  419. package/src/shared/lib/usage/view.test.ts +85 -0
  420. package/src/shared/lib/usage/view.ts +74 -0
  421. package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
  422. package/src/shared/lib/workspace/panel-hues.ts +57 -0
  423. package/src/shared/types/browser.ts +78 -0
  424. package/src/shared/types/index.ts +1 -0
  425. package/src/shared/types/panels-registry.ts +6 -0
  426. package/src/shared/types/panels.ts +14 -0
  427. package/src/shared/types/settings/agent.ts +28 -6
  428. package/src/shared/types/settings/state.ts +30 -3
  429. package/src/shared/types/settings/write.ts +6 -0
  430. package/src/shared/types/tokenUsage.ts +128 -21
  431. package/src/shared/types/updates.ts +20 -0
  432. package/src/test-support/fake-omp-frames.ts +163 -0
  433. package/dist/client/static/js/index-3ve31rzx.css +0 -1
  434. package/src/server/lib/omp/session/usage/aggregate-shaping.test.ts +0 -149
  435. package/src/server/lib/omp/session/usage/aggregate.test.ts +0 -243
  436. package/src/server/lib/omp/session/usage/aggregate.ts +0 -330
  437. package/src/server/lib/omp/session/usage/shaping.ts +0 -130
  438. /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
@@ -7,25 +7,26 @@
7
7
  * Schema-driven value editor for one native omp setting key.
8
8
  *
9
9
  * Renders the control matching the schema entry's type:
10
- * - boolean → inline toggle
11
- * - enum → select (submenu options or raw values)
12
- * - string → select for submenu options, password input for credentials,
13
- * otherwise a text field
14
- * - number → select for submenu options (option value parses to a number,
15
- * e.g. retry.maxRetries) or a plain number field
16
- * - array → ordered chip editor (first-match-ordered patterns; multi-select
17
- * checkboxes for unordered lists); JSON array string accepted when no
18
- * submenu choices exist
10
+ * - boolean → inline switch (commits on click)
11
+ * - enum → select over the schema's own values
12
+ * - string → select for submenu options, password input for credentials
13
+ * (with a reveal), otherwise a text field
14
+ * - number → text field with a numeric keypad hint
15
+ * - array → ordered chip editor when the schema ships options, JSON text
16
+ * otherwise
19
17
  * - record → single-line JSON object editor
20
18
  *
21
- * The initial value is captured once on mount; every control commits on
22
- * blur/change instead of per keystroke, so the parent's dirty-state diffing
23
- * against `initialValue` stays stable.
19
+ * Text controls commit on blur, Enter or the row's own check button, and
20
+ * Escape abandons the draft. A draft that cannot be parsed for its type says
21
+ * WHY under the field instead of reverting silently — the old editor reverted
22
+ * on a bad number or JSON with no message, which reads as "saving is broken".
24
23
  */
25
24
 
26
- import { useEffect, useMemo, useRef, useState } from 'preact/hooks';
27
- import { X } from 'lucide-preact';
25
+ import { useEffect, useRef, useState } from 'preact/hooks';
26
+ import { Check, Eye, EyeOff, X } from 'lucide-preact';
28
27
  import type { SchemaEntry } from '@/shared/lib/omp/config/schema-types';
28
+ import { parseDraft, valueToText } from '@/shared/lib/omp/config/row-value';
29
+ import { OrderedChips } from '@/client/components/settings/categories/omp-settings/OrderedChips';
29
30
 
30
31
  interface RowEditorProps {
31
32
  entryKey: string;
@@ -33,8 +34,8 @@ interface RowEditorProps {
33
34
  value: unknown;
34
35
  initialValue: unknown;
35
36
  /** Report the local editing state so the parent can defer saving. */
36
- onChangeDirty: (key: string, dirty: boolean, revert: () => void) => void;
37
- /** Commit the new value; returns a promise resolving on success. */
37
+ onChangeDirty: (key: string, dirty: boolean) => void;
38
+ /** Commit the new value; resolves with the server's answer. */
38
39
  onCommit: (key: string, value: unknown) => Promise<boolean>;
39
40
  /** True while a commit/reset for this key is in flight. */
40
41
  saving: boolean;
@@ -42,41 +43,6 @@ interface RowEditorProps {
42
43
  saveError: boolean;
43
44
  }
44
45
 
45
- /** Deep equality for JSON-safe values (arrays, records, scalars). */
46
- const valuesEqual = (a: unknown, b: unknown): boolean => JSON.stringify(a) === JSON.stringify(b);
47
-
48
- /** Number-editor conversion: strip invalid input instead of shipping NaN. */
49
- const toFiniteNumber = (raw: string): number | null => {
50
- const trimmed = raw.trim();
51
- if (trimmed === '' || trimmed === '-' || trimmed === '+') return null;
52
- const parsed = Number(trimmed);
53
- return Number.isFinite(parsed) ? parsed : null;
54
- };
55
-
56
- /** Parse a JSON array; null when invalid (keeps previous value). */
57
- const parseJsonArray = (raw: string): unknown[] | null => {
58
- const trimmed = raw.trim();
59
- if (trimmed === '') return [];
60
- try {
61
- const parsed = JSON.parse(trimmed);
62
- return Array.isArray(parsed) ? parsed : null;
63
- } catch {
64
- return null;
65
- }
66
- };
67
-
68
- /** Parse a JSON record; null when invalid (keeps previous value). */
69
- const parseJsonRecord = (raw: string): Record<string, unknown> | null => {
70
- const trimmed = raw.trim();
71
- if (trimmed === '') return {};
72
- try {
73
- const parsed = JSON.parse(trimmed);
74
- return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed) ? parsed : null;
75
- } catch {
76
- return null;
77
- }
78
- };
79
-
80
46
  export function RowEditor({
81
47
  entryKey,
82
48
  entry,
@@ -87,80 +53,64 @@ export function RowEditor({
87
53
  saving,
88
54
  saveError,
89
55
  }: RowEditorProps) {
90
- const [raw, setRaw] = useState<string>(() => {
91
- if (value === undefined || value === null) return '';
92
- return Array.isArray(value) || (typeof value === 'object') ? JSON.stringify(value) : String(value);
93
- });
56
+ const [raw, setRaw] = useState(() => valueToText(value));
57
+ const [draftError, setDraftError] = useState<string | null>(null);
58
+ const [revealed, setRevealed] = useState(false);
94
59
  // True when a blur should commit (control went dirty then lost focus).
95
60
  const dirtyRef = useRef(false);
96
61
  const initialRef = useRef<unknown>(initialValue);
97
- const options = useMemo(() => (Array.isArray(entry.ui.options) ? entry.ui.options : null), [entry.ui.options]);
62
+ const options = Array.isArray(entry.ui.options) ? entry.ui.options : null;
98
63
 
99
64
  useEffect(() => {
100
- const next = value === undefined || value === null ? '' : Array.isArray(value) || (typeof value === 'object') ? JSON.stringify(value) : String(value);
101
- setRaw(next);
65
+ setRaw(valueToText(value));
66
+ setDraftError(null);
102
67
  dirtyRef.current = false;
103
68
  }, [value]);
104
69
 
105
70
  const revert = () => {
106
- const initial = initialRef.current;
107
- const text = initial === undefined || initial === null ? '' : Array.isArray(initial) || (typeof initial === 'object') ? JSON.stringify(initial) : String(initial);
108
- setRaw(text);
71
+ setRaw(valueToText(initialRef.current));
72
+ setDraftError(null);
109
73
  dirtyRef.current = false;
110
- onChangeDirty(entryKey, false, () => {});
74
+ onChangeDirty(entryKey, false);
111
75
  };
112
76
 
113
- /** Commit a normalized value; optimistic revert keeps the row consistent. */
114
- const commit = (next: unknown) => {
77
+ /** Commit a normalized value; a refusal puts the previous text back. */
78
+ const commit = async (next: unknown) => {
115
79
  const priorRaw = raw;
116
- setRaw(typeof next === 'string' ? next : JSON.stringify(next));
80
+ setRaw(valueToText(next));
81
+ setDraftError(null);
117
82
  dirtyRef.current = false;
118
- onCommit(entryKey, next)
119
- .then((ok) => {
120
- if (ok) onChangeDirty(entryKey, false, () => {});
121
- else {
122
- setRaw(priorRaw);
123
- onChangeDirty(entryKey, true, revert);
124
- }
125
- })
126
- .catch(() => {
127
- setRaw(priorRaw);
128
- onChangeDirty(entryKey, true, revert);
129
- });
83
+ const ok = await onCommit(entryKey, next);
84
+ if (ok) onChangeDirty(entryKey, false);
85
+ else {
86
+ setRaw(priorRaw);
87
+ dirtyRef.current = true;
88
+ onChangeDirty(entryKey, true);
89
+ }
130
90
  };
131
91
 
132
- const commitBlur = () => {
92
+ /** Commit the text draft, or name why it cannot be committed. */
93
+ const commitDraft = () => {
133
94
  if (!dirtyRef.current) return;
134
- if (entry.type === 'number') {
135
- const parsed = toFiniteNumber(raw);
136
- if (parsed === null || parsed === value) { revert(); return; }
137
- commit(parsed);
138
- return;
139
- }
140
- if (entry.type === 'string') {
141
- const next = raw.trim();
142
- if (next === value) { revert(); return; }
143
- commit(next);
95
+ const parsed = parseDraft(entry.type, raw);
96
+ if (!parsed.ok) {
97
+ setDraftError(parsed.error);
144
98
  return;
145
99
  }
146
- // array / record as JSON text
147
- if (entry.type === 'array') {
148
- const parsed = parseJsonArray(raw);
149
- if (parsed === null || valuesEqual(parsed, value)) { revert(); return; }
150
- commit(parsed);
100
+ if (JSON.stringify(parsed.value) === JSON.stringify(value)) {
101
+ setDraftError(null);
102
+ dirtyRef.current = false;
103
+ onChangeDirty(entryKey, false);
151
104
  return;
152
105
  }
153
- if (entry.type === 'record') {
154
- const parsed = parseJsonRecord(raw);
155
- if (parsed === null || valuesEqual(parsed, value)) { revert(); return; }
156
- commit(parsed);
157
- }
106
+ void commit(parsed.value);
158
107
  };
159
108
 
160
109
  const markDirty = () => {
161
110
  const wasDirty = dirtyRef.current;
162
111
  dirtyRef.current = true;
163
- if (!wasDirty) onChangeDirty(entryKey, true, revert);
112
+ setDraftError(null);
113
+ if (!wasDirty) onChangeDirty(entryKey, true);
164
114
  };
165
115
 
166
116
  if (entry.type === 'boolean') {
@@ -171,105 +121,64 @@ export function RowEditor({
171
121
  role="switch"
172
122
  aria-checked={checked}
173
123
  aria-label={entry.ui.label}
174
- onClick={() => {
175
- onChangeDirty(entryKey, false, () => {});
176
- commit(!checked);
177
- }}
124
+ onClick={() => void commit(!checked)}
178
125
  disabled={saving}
179
- className={`relative h-5 w-9 shrink-0 rounded-full transition-colors cursor-pointer ${checked ? 'bg-ink' : 'bg-ink/15'} ${saving ? 'opacity-50' : ''}`}
126
+ className={`relative h-5 w-9 shrink-0 rounded-full transition-colors cursor-pointer disabled:cursor-progress ${
127
+ checked ? 'bg-ink' : 'bg-ink/15'
128
+ } ${saving ? 'opacity-50' : ''}`}
180
129
  >
181
130
  <span
182
- className={`absolute top-0.5 h-4 w-4 rounded-full bg-paper shadow-sm transition-all ${checked ? 'left-[18px]' : 'left-0.5'}`}
131
+ className={`absolute top-0.5 h-4 w-4 rounded-full bg-paper shadow-sm transition-all ${
132
+ checked ? 'left-[18px]' : 'left-0.5'
133
+ }`}
183
134
  />
184
135
  </button>
185
136
  );
186
137
  }
187
138
 
188
139
  if (entry.type === 'array' && entry.ui.ordered && options) {
189
- // Ordered chip list — value is an array of option values; reorder + toggle.
190
- const current = Array.isArray(value) ? value.filter((v): v is string => typeof v === 'string') : [];
191
- const toggle = (optionValue: string) => {
192
- commit(current.includes(optionValue) ? current.filter((v) => v !== optionValue) : [...current, optionValue]);
193
- };
194
- const move = (index: number, delta: number) => {
195
- const target = index + delta;
196
- if (target < 0 || target >= current.length) return;
197
- const next = [...current];
198
- const [moved] = next.splice(index, 1);
199
- next.splice(target, 0, moved);
200
- commit(next);
201
- };
202
140
  return (
203
- <div className="flex flex-wrap items-center gap-1.5 justify-end max-w-72">
204
- {current.map((chip, index) => {
205
- const option = options.find((o) => o.value === chip);
206
- return (
207
- <span key={chip} className="inline-flex items-center gap-1 rounded-md border border-ink/15 bg-ink/[0.03] px-2 py-0.5 text-[10px] text-ink">
208
- {index > 0 && (
209
- <button type="button" aria-label={`${option?.label ?? chip} left`} onClick={() => move(index, -1)} className="text-ink/40 hover:text-ink cursor-pointer" disabled={saving}>←</button>
210
- )}
211
- {option?.label ?? chip}
212
- {index < current.length - 1 && (
213
- <button type="button" aria-label={`${option?.label ?? chip} right`} onClick={() => move(index, 1)} className="text-ink/40 hover:text-ink cursor-pointer" disabled={saving}>→</button>
214
- )}
215
- <button type="button" aria-label={`Remove ${option?.label ?? chip}`} onClick={() => toggle(chip)} className="text-ink/40 hover:text-error cursor-pointer" disabled={saving}>
216
- <X size={10} />
217
- </button>
218
- </span>
219
- );
220
- })}
221
- {current.length === 0 && <span className="text-[10px] text-ink/40">empty</span>}
222
- <details className="relative">
223
- <summary className="cursor-pointer rounded-md border border-ink/15 px-2 py-0.5 text-[10px] text-ink/70 hover:text-ink select-none">add…</summary>
224
- <div className="absolute right-0 top-full z-10 mt-1 max-h-44 w-48 overflow-auto rounded-md border border-ink/15 bg-paper p-1 shadow-lg">
225
- {options.filter((o) => !current.includes(o.value)).map((option) => (
226
- <button
227
- key={option.value}
228
- type="button"
229
- onClick={() => toggle(option.value)}
230
- className="block w-full rounded px-2 py-1 text-left text-[11px] text-ink/80 hover:bg-ink/5"
231
- >
232
- {option.label || option.value}
233
- </button>
234
- ))}
235
- {options.every((o) => current.includes(o.value)) && (
236
- <div className="px-2 py-1 text-[10px] text-ink/40">all selected</div>
237
- )}
238
- </div>
239
- </details>
240
- </div>
141
+ <OrderedChips
142
+ options={options}
143
+ value={value}
144
+ saving={saving}
145
+ onCommit={(next) => void commit(next)}
146
+ />
241
147
  );
242
148
  }
243
149
 
244
- const choices = options ?? (entry.type === 'enum' && entry.values ? entry.values.map((v) => ({ value: v, label: v, description: '' })) : null);
150
+ const choices = options
151
+ ?? (entry.type === 'enum' && entry.values
152
+ ? entry.values.map((optionValue) => ({ value: optionValue, label: optionValue, description: '' }))
153
+ : null);
245
154
 
246
155
  if (choices) {
247
156
  const current = value === undefined || value === null ? '' : String(value);
248
157
  return (
249
- <div className="flex items-center gap-2 shrink-0">
158
+ <div className="flex shrink-0 items-center gap-2">
250
159
  <select
251
160
  aria-label={entry.ui.label}
252
161
  value={current}
253
- onChange={(e) => {
254
- const selected = e.currentTarget.value;
162
+ onChange={(event) => {
163
+ const selected = event.currentTarget.value;
164
+ if (selected === current) return;
255
165
  if (entry.type === 'number') {
256
- const parsed = toFiniteNumber(selected);
257
- if (parsed === null || parsed === value) return;
258
- commit(parsed);
166
+ const parsed = Number(selected);
167
+ if (!Number.isFinite(parsed)) return;
168
+ void commit(parsed);
259
169
  } else {
260
- if (selected === value) return;
261
- commit(selected);
170
+ void commit(selected);
262
171
  }
263
172
  }}
264
173
  disabled={saving}
265
- className={`bg-paper border border-ink/15 rounded-md px-2 py-1 text-ink max-w-56 ${saving ? 'opacity-50' : ''}`}
174
+ className={`max-w-56 rounded-md border border-ink/15 bg-paper px-2 py-1 text-ink cursor-pointer disabled:cursor-progress ${
175
+ saving ? 'opacity-50' : ''
176
+ }`}
266
177
  >
267
- {current === '' && (
268
- <option value="" disabled>select…</option>
269
- )}
270
- {choices.map((option) => (
271
- <option key={option.value} value={option.value}>
272
- {option.label || option.value}
178
+ {current === '' && <option value="" disabled>select…</option>}
179
+ {choices.map((choice) => (
180
+ <option key={choice.value} value={choice.value}>
181
+ {choice.label || choice.value}
273
182
  </option>
274
183
  ))}
275
184
  </select>
@@ -277,61 +186,91 @@ export function RowEditor({
277
186
  );
278
187
  }
279
188
 
280
- if (entry.type === 'array') {
281
- return (
282
- <input
283
- aria-label={entry.ui.label}
284
- type="text"
285
- value={raw}
286
- onChange={(e) => { setRaw(e.currentTarget.value); markDirty(); }}
287
- onBlur={commitBlur}
288
- disabled={saving}
289
- placeholder='["anthropic","openai"]'
290
- className={`w-48 bg-paper border border-ink/15 rounded-md px-2 py-1 text-ink text-right font-mono text-[11px] ${saving ? 'opacity-50' : ''}`}
291
- />
292
- );
293
- }
189
+ const isText = entry.type === 'string' || entry.type === 'number'
190
+ || entry.type === 'array' || entry.type === 'record';
191
+ const placeholder = entry.type === 'array'
192
+ ? '["anthropic","openai"]'
193
+ : entry.type === 'record'
194
+ ? '{"bash":"prompt"}'
195
+ : entry.type === 'number'
196
+ ? 'unset'
197
+ : entry.credential
198
+ ? 'not set'
199
+ : 'unset';
294
200
 
295
- if (entry.type === 'record') {
296
- return (
297
- <input
298
- aria-label={entry.ui.label}
299
- type="text"
300
- value={raw}
301
- onChange={(e) => { setRaw(e.currentTarget.value); markDirty(); }}
302
- onBlur={commitBlur}
303
- disabled={saving}
304
- placeholder='{"bash":"prompt"}'
305
- className={`w-48 bg-paper border border-ink/15 rounded-md px-2 py-1 text-ink text-right font-mono text-[11px] ${saving ? 'opacity-50' : ''}`}
306
- />
307
- );
308
- }
309
-
310
- if (entry.type === 'number') {
311
- return (
312
- <input
313
- aria-label={entry.ui.label}
314
- type="text"
315
- inputMode="decimal"
316
- value={raw}
317
- onChange={(e) => { setRaw(e.currentTarget.value); markDirty(); }}
318
- onBlur={commitBlur}
319
- disabled={saving}
320
- className={`w-28 bg-paper border border-ink/15 rounded-md px-2 py-1 text-ink text-right font-mono text-[11px] ${saving ? 'opacity-50' : ''}`}
321
- />
322
- );
323
- }
324
-
325
- // string without submenu options
326
201
  return (
327
- <input
328
- aria-label={entry.ui.label}
329
- type={entry.credential ? 'password' : 'text'}
330
- value={raw}
331
- onChange={(e) => { setRaw(e.currentTarget.value); markDirty(); }}
332
- onBlur={commitBlur}
333
- disabled={saving}
334
- className={`w-48 bg-paper border border-ink/15 rounded-md px-2 py-1 text-ink text-right font-mono text-[11px] ${saving ? 'opacity-50' : ''} ${saveError ? 'border-error' : ''}`}
335
- />
202
+ <div className="flex shrink-0 flex-col items-end gap-1">
203
+ <div className="flex items-center gap-1">
204
+ <input
205
+ aria-label={entry.ui.label}
206
+ aria-invalid={draftError ? true : undefined}
207
+ type={entry.credential && !revealed ? 'password' : 'text'}
208
+ inputMode={entry.type === 'number' ? 'decimal' : undefined}
209
+ value={raw}
210
+ onChange={(event) => {
211
+ setRaw(event.currentTarget.value);
212
+ markDirty();
213
+ }}
214
+ onBlur={() => {
215
+ if (isText) commitDraft();
216
+ }}
217
+ onKeyDown={(event) => {
218
+ if (event.key === 'Enter') {
219
+ event.preventDefault();
220
+ commitDraft();
221
+ }
222
+ if (event.key === 'Escape') {
223
+ event.preventDefault();
224
+ revert();
225
+ }
226
+ }}
227
+ disabled={saving}
228
+ spellcheck={false}
229
+ placeholder={placeholder}
230
+ className={`bg-paper border rounded-md px-2 py-1 text-ink text-right text-[11px] ${
231
+ entry.type === 'string' && !entry.credential ? '' : 'font-mono'
232
+ } ${entry.type === 'number' ? 'w-28' : 'w-48'} ${
233
+ draftError || saveError ? 'border-error' : 'border-ink/15'
234
+ } ${saving ? 'opacity-50 cursor-progress' : ''} focus:outline-none focus:border-ink/50`}
235
+ />
236
+ {entry.credential && (
237
+ <button
238
+ type="button"
239
+ aria-label={revealed ? `Hide ${entry.ui.label}` : `Show ${entry.ui.label}`}
240
+ title={revealed ? 'Hide the value' : 'Show the value'}
241
+ onClick={() => setRevealed((isRevealed) => !isRevealed)}
242
+ className="rounded p-1 text-ink/35 hover:text-ink hover:bg-ink/5 cursor-pointer"
243
+ >
244
+ {revealed ? <EyeOff size={11} /> : <Eye size={11} />}
245
+ </button>
246
+ )}
247
+ {isText && dirtyRef.current && (
248
+ <button
249
+ type="button"
250
+ aria-label={`Save ${entry.ui.label}`}
251
+ title="Save (Enter)"
252
+ onClick={commitDraft}
253
+ disabled={saving}
254
+ className="rounded p-1 text-ink/50 hover:text-ink hover:bg-ink/5 cursor-pointer disabled:opacity-40"
255
+ >
256
+ <Check size={11} />
257
+ </button>
258
+ )}
259
+ {isText && draftError && (
260
+ <button
261
+ type="button"
262
+ aria-label={`Discard the change to ${entry.ui.label}`}
263
+ title="Discard (Escape)"
264
+ onClick={revert}
265
+ className="rounded p-1 text-error/70 hover:text-error hover:bg-error/5 cursor-pointer"
266
+ >
267
+ <X size={11} />
268
+ </button>
269
+ )}
270
+ </div>
271
+ {draftError && (
272
+ <span className="max-w-56 text-right text-[10px] leading-snug text-error">{draftError}</span>
273
+ )}
274
+ </div>
336
275
  );
337
276
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /** Live engine snapshot from `GET /api/omp/state`. */
7
+ export interface EngineState {
8
+ model?: { provider?: string; id?: string };
9
+ contextUsage?: { tokens?: number; contextWindow?: number; percent?: number } | null;
10
+ fastModeEnabled?: boolean;
11
+ thinkingLevel?: string;
12
+ tokensPerSecond?: number;
13
+ }
14
+
15
+ /** One module found under `.omp/extensions`. */
16
+ export interface ExtensionItem {
17
+ id: string;
18
+ name: string;
19
+ sourceRoot: string;
20
+ filePath: string;
21
+ disabled: boolean;
22
+ }
23
+
24
+ /** The outcome every settings write reports, so a refusal is never silent. */
25
+ export interface WriteOutcome {
26
+ ok: boolean;
27
+ error?: string;
28
+ }
@@ -69,7 +69,7 @@ export function AvailableList({ entries, busy, onInstall, onInstallUrl }: Availa
69
69
  className="flex flex-col gap-2 border border-ink/10 rounded-lg p-3 bg-paper hover:border-ink/20 transition-colors"
70
70
  >
71
71
  <div className="flex items-start gap-2.5">
72
- <PluginMark name={entry.name} iconUrl={entry.iconUrl} />
72
+ <PluginMark name={entry.name} iconUrl={entry.iconUrl} color={entry.color} />
73
73
  <div className="min-w-0 flex-1">
74
74
  <div className="text-xs font-medium text-ink truncate" title={entry.name}>
75
75
  {entry.name}
@@ -1,5 +1,7 @@
1
1
  import { Loader2 } from 'lucide-preact';
2
2
  import { BUILTIN_PANELS } from '@/client/components/workspace/panels/builtin';
3
+ import { PanelMark } from '@/client/components/common/panel-mark';
4
+ import { PANEL_MARK_SIZE } from '@/shared/lib/workspace/right-panels';
3
5
 
4
6
  interface BuiltinListProps {
5
7
  /** Every panel id switched off — a bare view id, or `plugin:<id>`. */
@@ -55,9 +57,25 @@ export function BuiltinList({ disabled, busy, onSetEnabled }: BuiltinListProps)
55
57
  enabled ? 'bg-paper' : 'bg-ink/[0.02]'
56
58
  }`}
57
59
  >
58
- <span className={enabled ? 'text-ink/70 flex-shrink-0' : 'text-ink/30 flex-shrink-0'}>
59
- {panel.icon}
60
- </span>
60
+ {/* The SAME mark the rail and the phone's chip strip draw, from
61
+ the same hue map: this row used to render the bare glyph and
62
+ therefore took the GLYPH's colour (`lucide-files` → 320°) while
63
+ the rail drew the PANEL's (`files` → 0°).
64
+
65
+ The off state is stated the way the rail states it — the ink
66
+ weight for the monochrome mode, `data-idle` for the colour
67
+ mode, which dims by LUMINANCE and keeps the chroma. `opacity`
68
+ here would have washed the hue out, the exact "kusem" the rail
69
+ stopped doing. */}
70
+ <PanelMark
71
+ className={`flex-shrink-0 ${enabled ? 'text-ink/70' : 'text-ink/30'}`}
72
+ panelId={panel.id}
73
+ builtin
74
+ icon={panel.icon}
75
+ name={panel.title}
76
+ size={PANEL_MARK_SIZE}
77
+ idle={!enabled}
78
+ />
61
79
  <span className="min-w-0 flex-1">
62
80
  <span className={`block text-xs truncate ${enabled ? 'text-ink' : 'text-ink/45'}`} title={panel.title}>
63
81
  {panel.title}
@@ -95,7 +95,7 @@ export function PluginCard({
95
95
  >
96
96
  <header className="flex items-start gap-2.5">
97
97
  <div className={plugin.enabled ? '' : 'opacity-50'}>
98
- <PluginMark name={plugin.name} iconUrl={iconUrl} />
98
+ <PluginMark name={plugin.name} iconUrl={iconUrl} color={plugin.color} />
99
99
  </div>
100
100
  <div className="min-w-0 flex-1">
101
101
  <div className="flex items-center gap-1.5 min-w-0">
@@ -74,8 +74,11 @@ describe('PluginMark', () => {
74
74
  expect(el.querySelector('img')).toBeNull();
75
75
  expect(span?.style.width).toBe('16px');
76
76
  expect(span?.style.height).toBe('16px');
77
- // Serialized lowercased by the engine (verified in Chrome and happy-dom).
78
- expect(span?.style.backgroundColor).toBe('currentcolor');
77
+ // The paint is a VARIABLE, so the mode decides it: monochrome leaves
78
+ // `--plugin-color` undefined and the mark keeps the ink it always used.
79
+ expect(span?.style.backgroundColor).toBe('var(--plugin-color, currentColor)');
80
+ expect(span?.getAttribute('data-plugin-mark')).toBe('');
81
+ expect(span?.style.getPropertyValue('--icon-hue')).not.toBe('');
79
82
  // The extension is read off the PATH; the registry's URL carries a `?v=` hash.
80
83
  expect(span?.style.maskImage).toContain('/api/panels/icon/demo/icon.svg?v=abc');
81
84
  expect(span?.style.maskSize).toBe('contain');
@@ -109,6 +112,52 @@ describe('PluginMark', () => {
109
112
  expect(el.querySelector('span')).toBeNull();
110
113
  });
111
114
 
115
+ test('a plugin mark carries its own hue, stable across renders', () => {
116
+ const first = paint(h(PluginMark, { name: 'Demo Plugin', iconUrl: '/api/panels/icon/demo/icon.svg' }))
117
+ .querySelector('span');
118
+ const hue = first?.style.getPropertyValue('--icon-hue');
119
+ render(null, container);
120
+ const second = paint(h(PluginMark, { name: 'Demo Plugin', iconUrl: '/api/panels/icon/demo/icon.svg' }))
121
+ .querySelector('span');
122
+
123
+ expect(hue).toMatch(/^\d+$/);
124
+ expect(second?.style.getPropertyValue('--icon-hue')).toBe(hue);
125
+ expect(paint(h(PluginMark, { name: 'Another Plugin' })).querySelector('span')?.style.getPropertyValue('--icon-hue')).not.toBe(hue);
126
+ });
127
+
128
+ test('the initials fallback takes the same colour hook as a vector mark', () => {
129
+ const badge = paint(h(PluginMark, { name: 'Session Info' })).querySelector('span');
130
+
131
+ expect(badge?.getAttribute('data-plugin-mark')).toBe('');
132
+ // 45% of the palette ink is what `text-ink/45` meant, restated as a value so
133
+ // the colour mode can replace it without a second class.
134
+ expect(badge?.style.color).toBe('var(--plugin-color, color-mix(in srgb, var(--theme-ink) 45%, transparent))');
135
+ });
136
+
137
+ test('a declared colour rides as a clamped pair, so the mode still gates it', () => {
138
+ // The manifest's `color` is the plugin's own brand. It is set as custom
139
+ // properties rather than as a colour, because `monochrome` must still paint
140
+ // the palette ink — the stylesheet reads them only under
141
+ // `[data-icon-style="color"]`. Two values, because `#34d399` is 1.9:1 on
142
+ // white paper and 7:1 on dark: `legiblePair` derives the light one.
143
+ const el = paint(h(PluginMark, { name: 'Demo', iconUrl: '/api/panels/icon/demo/icon.svg', color: '#34d399' }));
144
+ const span = el.querySelector('span');
145
+ const light = span?.style.getPropertyValue('--plugin-declared-light') ?? '';
146
+
147
+ expect(light).toMatch(/^#[0-9a-f]{6}$/);
148
+ expect(light).not.toBe('#34d399');
149
+ expect(span?.style.getPropertyValue('--plugin-declared-dark')).toBe('#34d399');
150
+ expect(span?.style.backgroundColor).toBe('var(--plugin-color, currentColor)');
151
+ });
152
+
153
+ test('no declared colour leaves both variables unset, so the hue applies', () => {
154
+ const span = paint(h(PluginMark, { name: 'Demo' })).querySelector('span');
155
+
156
+ expect(span?.style.getPropertyValue('--plugin-declared-light')).toBe('');
157
+ expect(span?.style.getPropertyValue('--plugin-declared-dark')).toBe('');
158
+ expect(span?.style.getPropertyValue('--icon-hue')).not.toBe('');
159
+ });
160
+
112
161
  test('falls back to the plugin initials when no icon is declared', () => {
113
162
  const el = paint(h(PluginMark, { name: 'Session Info', size: 16 }));
114
163