@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
@@ -0,0 +1,129 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Per-block review on a rendered markdown document: "this paragraph is good,
8
+ * that one needs work", with the verdicts handed to the agent as one prompt.
9
+ *
10
+ * ## Off unless the toolbar button turned it on
11
+ *
12
+ * `active` is the whole difference between this and an ordinary preview. Off:
13
+ * the renderer emits no block attributes, nothing is fetched, and every click
14
+ * keeps its usual meaning — links, copy buttons, the diagram viewer. On: each
15
+ * top-level block becomes addressable, a click opens the judge panel, and a rail
16
+ * stripe says what has been decided. An always-on layer would take those clicks
17
+ * away from a reader who never asked to review anything, which is why the mode
18
+ * is entered from a toolbar button and nowhere else.
19
+ *
20
+ * ## Identity is the block's text, not its line
21
+ *
22
+ * A render has no lines, and a line number lies the moment text above it is
23
+ * inserted. Each block carries `type:hash#occurrence` (`blocks/anchor.ts`), so a
24
+ * judgement follows its paragraph around the document; when the block's own text
25
+ * changes the anchor stops matching and the mark is reported as OUTDATED with
26
+ * its note intact — never dropped.
27
+ */
28
+
29
+ import { useEffect, useState } from 'preact/hooks';
30
+
31
+ import { MarkdownRenderer } from '@/client/components/common/MarkdownRenderer';
32
+ import { ReviewPopover } from '@/client/components/common/markdown-review/ReviewPopover';
33
+ import { ReviewSummary } from '@/client/components/common/markdown-review/ReviewSummary';
34
+ import { usePreviewReview } from '@/client/hooks/editor/use-preview-review';
35
+
36
+ export interface MarkdownReviewProps {
37
+ /** The document's text — the preview's buffer, not a re-read from disk. */
38
+ content: string;
39
+ file: { name: string; path: string; root?: string | null; repo?: string | null };
40
+ /** Review mode, owned by the editor's toolbar. */
41
+ active: boolean;
42
+ /** The exit control inside the summary bar; the toolbar owns the same switch. */
43
+ onExit: () => void;
44
+ }
45
+
46
+ export function MarkdownReview({ content, file, active, onExit }: MarkdownReviewProps) {
47
+ const review = usePreviewReview({ file, active });
48
+ const [sent, setSent] = useState(false);
49
+
50
+ // A scroll moves the block out from under a fixed panel, so closing is the
51
+ // honest answer — see `ReviewPopover`.
52
+ useEffect(() => {
53
+ if (!review.selected) return;
54
+ const onScroll = () => review.close();
55
+ window.addEventListener('scroll', onScroll, true);
56
+ return () => window.removeEventListener('scroll', onScroll, true);
57
+ }, [review.selected]);
58
+
59
+ // The mode was switched off (toolbar, or another tab of the same file): the
60
+ // panel must not survive into the ordinary preview.
61
+ useEffect(() => {
62
+ if (!active) review.close();
63
+ }, [active]);
64
+
65
+ // "Added to the chat box" describes the LAST send, so a change to what would be
66
+ // sent retires it: leaving it up after a mark was removed would claim the
67
+ // composer holds the review that is on screen.
68
+ const total = review.counts.good + review.counts.needsWork;
69
+ useEffect(() => {
70
+ setSent(false);
71
+ }, [total]);
72
+
73
+ const selected = review.selectedBlock;
74
+ const annotation = review.selectedAnnotation;
75
+
76
+ return (
77
+ // The class is what review mode's CSS hangs off, so the hover and rail rules
78
+ // exist only while the mode is on.
79
+ <div className={active ? 'md-review-active' : undefined}>
80
+ <MarkdownRenderer
81
+ content={content}
82
+ document
83
+ scope={{ path: file.path, root: file.root ?? undefined, repo: file.repo ?? undefined }}
84
+ onBlocks={review.setBlocks}
85
+ review={
86
+ active
87
+ ? { active: true, marks: review.marks, selected: review.selected, onPick: review.pick }
88
+ : undefined
89
+ }
90
+ />
91
+
92
+ {active && selected && review.anchor && (
93
+ <ReviewPopover
94
+ // A new block is a new form: the textarea's draft must not follow the
95
+ // selection.
96
+ key={selected.key}
97
+ block={selected}
98
+ verdict={review.marks.get(selected.key) ?? null}
99
+ note={annotation?.note ?? ''}
100
+ anchor={review.anchor}
101
+ onSave={(verdict, note) => {
102
+ review.save({ block: selected, verdict, note });
103
+ review.close();
104
+ }}
105
+ onRemove={() => {
106
+ if (annotation) review.remove(annotation.id);
107
+ review.close();
108
+ }}
109
+ onClose={review.close}
110
+ />
111
+ )}
112
+
113
+ {active && (
114
+ <ReviewSummary
115
+ counts={review.counts}
116
+ outdated={review.outdated}
117
+ error={review.error}
118
+ sent={sent}
119
+ onSend={() => setSent(review.send())}
120
+ onRemoveOutdated={review.remove}
121
+ onExit={() => {
122
+ review.close();
123
+ onExit();
124
+ }}
125
+ />
126
+ )}
127
+ </div>
128
+ );
129
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * A PANEL's mark, wherever a panel is listed.
8
+ *
9
+ * The activity bar, the phone's chip strip and the Built-in list in Settings all
10
+ * draw the same thing, and before this component each one decided its colour for
11
+ * itself: the rail stamped the PANEL id's hue, while the two lists drew the bare
12
+ * glyph and therefore took the GLYPH's hue — so `Files` was `hsl(0 …)` in one
13
+ * place and `hsl(320 …)` in the other, and `Wiki`'s `BookOpen` fell through to
14
+ * the `info` signal colour because it means something as a glyph but nothing as
15
+ * a panel.
16
+ *
17
+ * Two rules, and the split between them is the point:
18
+ *
19
+ * - **A BUILT-IN view** takes the hue of its PANEL ID (`usePanelHues`, resolved
20
+ * over the whole set of built-in views so the answer cannot depend on what a
21
+ * surface is drawing). That is one colour per view, everywhere.
22
+ * - **A PLUGIN panel** takes the plugin's OWN mark colour — the brand hex its
23
+ * manifest declares, else the hue of its name — because that is what its
24
+ * marketplace card draws. Keying it by the slot id instead gave one plugin two
25
+ * colours, which is the defect this component exists to remove.
26
+ *
27
+ * A declared brand colour still wins over everything: it is surfaced as the
28
+ * `--panel-color-light`/`-dark` pair, which the stylesheet reads before the hue.
29
+ * `data-declared` says the mark carries one, because the rail must not dim a
30
+ * colour the plugin author chose (see `icon-paint-css.ts`).
31
+ */
32
+
33
+ import type { ReactNode } from 'preact/compat';
34
+ import { legiblePair } from '@/shared/lib/theme/legibility';
35
+ import { usePanelHues } from '@/client/hooks/workspace/panel-hues';
36
+ import { panelHueOf } from '@/shared/lib/workspace/panel-hues';
37
+ import { PluginMark } from '@/client/components/settings/categories/panel-plugins/PluginMark';
38
+
39
+ interface PanelMarkProps {
40
+ /** The panel id a BUILT-IN view's hue is keyed by. */
41
+ panelId: string;
42
+ /**
43
+ * Which KIND of panel this is: a built-in view takes the panel-id hue, a
44
+ * plugin keeps its own mark colour. Stated rather than inferred from `icon`,
45
+ * because a built-in view may have no glyph of its own and would otherwise be
46
+ * recoloured as if it were a plugin.
47
+ */
48
+ builtin: boolean;
49
+ /** A built-in view's own glyph, when it has one. */
50
+ icon?: ReactNode;
51
+ /** The plugin's display name; also the fallback mark when it ships no icon. */
52
+ name: string;
53
+ iconUrl?: string;
54
+ /** The colour the plugin's manifest declares, when it declares one. */
55
+ color?: string;
56
+ size: number;
57
+ /**
58
+ * The mark's state, when the surface has one. `undefined` means "no state":
59
+ * the rail is the only caller that dims an inactive mark, and it must be able
60
+ * to say so without every other surface pretending to be inactive.
61
+ */
62
+ idle?: boolean;
63
+ /** Extra classes for the wrapper — a surface's own layout, nothing about colour. */
64
+ className?: string;
65
+ }
66
+
67
+ export function PanelMark({
68
+ panelId,
69
+ builtin,
70
+ icon,
71
+ name,
72
+ iconUrl,
73
+ color,
74
+ size,
75
+ idle,
76
+ className,
77
+ }: PanelMarkProps) {
78
+ const hues = usePanelHues();
79
+ const declared = color ? legiblePair(color) : null;
80
+ return (
81
+ <span
82
+ className={className ?? 'inline-flex'}
83
+ data-panel-mark=""
84
+ data-idle={idle === true ? '' : undefined}
85
+ // Stamped from the DATA (`panel.color`), not guessed from the stylesheet:
86
+ // the rail's idle filter is exempted by this attribute.
87
+ data-declared={declared ? '' : undefined}
88
+ style={{
89
+ ...(builtin ? { '--panel-hue': String(panelHueOf(hues, panelId)) } : {}),
90
+ ...(declared ? { '--panel-color-light': declared.light } : {}),
91
+ ...(declared?.dark ? { '--panel-color-dark': declared.dark } : {}),
92
+ }}
93
+ >
94
+ {icon ?? <PluginMark name={name} iconUrl={iconUrl} color={color} size={size} />}
95
+ </span>
96
+ );
97
+ }
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  import { describe, expect, test } from 'bun:test';
21
- import { BRAND_ICONS, BRAND_VIEWBOX } from '@/client/components/common/file-icon/brand-paths';
21
+ import { BRAND_ICONS, BRAND_VIEWBOX } from '@/shared/lib/icons/file-brand-paths';
22
22
  import { PROVIDER_GLYPHS } from '@/client/components/common/provider-icon/glyphs';
23
23
 
24
24
  describe('PROVIDER_GLYPHS', () => {
@@ -104,4 +104,18 @@ describe('ProviderIcon ink', () => {
104
104
  expect(el.querySelector('svg')).toBeNull();
105
105
  expect(el.textContent).toBe('ti.');
106
106
  });
107
+
108
+ test('a built-in mark names itself, so the colour rule has a key', () => {
109
+ const svg = paint(h(ProviderIcon, { slug: 'claude' })).querySelector('svg');
110
+
111
+ expect(svg?.getAttribute('data-provider')).toBe('claude');
112
+ });
113
+
114
+ test('the attribute is the GLYPH name, not the spelling the caller passed', () => {
115
+ // `claude-code` folds to the `claude` glyph; the colour row is keyed on the
116
+ // glyph, so a caller's spelling cannot miss it.
117
+ const svg = paint(h(ProviderIcon, { slug: 'claude-code' })).querySelector('svg');
118
+
119
+ expect(svg?.getAttribute('data-provider')).toBe('claude');
120
+ });
107
121
  });
@@ -132,6 +132,10 @@ export function ProviderIcon({
132
132
  // carry their own attributes (`azure`'s `fill-opacity`, `synthetic`'s
133
133
  // stroked outline, the baked `currentColor` paths) keep them.
134
134
  fill="currentColor"
135
+ // The colour rule's key: `<html data-icon-style="color">` paints
136
+ // `svg[data-provider=…]` from the brand table, and the attribute is absent
137
+ // for a plugin's own art so no guessed brand colour can land on it.
138
+ data-provider={glyph.brandKey ?? undefined}
135
139
  // `block` + the explicit width/height are the containment contract: an
136
140
  // inline SVG sits on the text baseline and adds descender space, which is
137
141
  // how a mark "fits" its attributes yet still pushes a plate's edge.
@@ -58,18 +58,18 @@ describe('resolveProviderMark', () => {
58
58
  test('a registered glyph wins over the built-in mark for that provider', () => {
59
59
  const mark = resolveProviderMark(['deepseek'], [row('demo', 'deepseek', CUSTOM)]);
60
60
 
61
- expect(mark).toEqual({ viewBox: '0 0 32 32', body: '<path d="M4 4h24v24H4z"/>' });
61
+ expect(mark).toEqual({ viewBox: '0 0 32 32', body: '<path d="M4 4h24v24H4z"/>', brandKey: null });
62
62
  });
63
63
 
64
64
  test('a registration leaves every other provider on its built-in mark', () => {
65
65
  const rows = [row('demo', 'deepseek', CUSTOM)];
66
66
 
67
- expect(resolveProviderMark(['openai'], rows)).toBe(PROVIDER_GLYPHS.openai);
68
- expect(resolveProviderMark(['deepseek'], rows)).not.toBe(PROVIDER_GLYPHS.deepseek);
67
+ expect(resolveProviderMark(['openai'], rows)).toEqual({ ...PROVIDER_GLYPHS.openai, brandKey: 'openai' });
68
+ expect(resolveProviderMark(['deepseek'], rows)?.brandKey).toBeNull();
69
69
  });
70
70
 
71
71
  test('an unregistered provider is unchanged, unknown ones still fall to initials', () => {
72
- expect(resolveProviderMark(['deepseek'], [])).toBe(PROVIDER_GLYPHS.deepseek);
72
+ expect(resolveProviderMark(['deepseek'], [])).toEqual({ ...PROVIDER_GLYPHS.deepseek, brandKey: 'deepseek' });
73
73
  expect(resolveProviderMark(['my-private-gateway'], [])).toBeNull();
74
74
  });
75
75
 
@@ -95,9 +95,10 @@ describe('resolveProviderMark', () => {
95
95
 
96
96
  test('a malformed glyph falls through instead of rendering a broken mark', () => {
97
97
  // On a provider the built-in table knows, the built-in mark comes back.
98
- expect(resolveProviderMark(['deepseek'], [row('demo', 'deepseek', MALFORMED)])).toBe(
99
- PROVIDER_GLYPHS.deepseek,
100
- );
98
+ expect(resolveProviderMark(['deepseek'], [row('demo', 'deepseek', MALFORMED)])).toEqual({
99
+ ...PROVIDER_GLYPHS.deepseek,
100
+ brandKey: 'deepseek',
101
+ });
101
102
  // With no built-in either, there is nothing to draw and the badge runs.
102
103
  expect(resolveProviderMark(['acme'], [row('demo', 'acme', MALFORMED)])).toBeNull();
103
104
  });
@@ -62,6 +62,18 @@ export function parseRegisteredGlyph(source: string): ProviderGlyph | null {
62
62
  return { viewBox: box, body };
63
63
  }
64
64
 
65
+ /**
66
+ * A mark ready to draw, plus the built-in name it came from.
67
+ *
68
+ * `brandKey` is what the colour rule keys on (`BRAND_COLORS` in
69
+ * `shared/lib/models/provider/brand-color.ts`) and is `null` for a plugin's own
70
+ * art: a registration is the user's SVG, and painting it in a brand colour this
71
+ * build guessed would be a colour the author never chose.
72
+ */
73
+ export interface ResolvedProviderMark extends ProviderGlyph {
74
+ brandKey: string | null;
75
+ }
76
+
65
77
  /**
66
78
  * The mark to draw for a provider: a plugin's registration when one matches,
67
79
  * otherwise the built-in table entry.
@@ -78,7 +90,7 @@ export function parseRegisteredGlyph(source: string): ProviderGlyph | null {
78
90
  export function resolveProviderMark(
79
91
  candidates: ReadonlyArray<string | null | undefined>,
80
92
  registered: ListSlotRows<ProviderIconRegistration>,
81
- ): ProviderGlyph | null {
93
+ ): ResolvedProviderMark | null {
82
94
  for (const candidate of candidates) {
83
95
  if (!candidate) continue;
84
96
  const key = foldProviderKey(candidate);
@@ -86,9 +98,10 @@ export function resolveProviderMark(
86
98
  const entry = registered.find((row) => foldProviderKey(row.registration.provider) === key);
87
99
  if (!entry) continue;
88
100
  const glyph = parseRegisteredGlyph(entry.registration.glyph);
89
- if (glyph) return glyph;
101
+ if (glyph) return { ...glyph, brandKey: null };
90
102
  break;
91
103
  }
92
104
  const name = resolveProviderGlyph(...candidates);
93
- return name ? (PROVIDER_GLYPHS[name] ?? null) : null;
105
+ const glyph = name ? PROVIDER_GLYPHS[name] : undefined;
106
+ return glyph ? { ...glyph, brandKey: name ?? null } : null;
94
107
  }
@@ -16,6 +16,8 @@
16
16
 
17
17
  import { useState } from 'preact/hooks';
18
18
  import { Check, Loader2, Play, Plus, RefreshCw, Server, Square, Trash2 } from 'lucide-preact';
19
+ import { AnchoredMenu } from '@/client/components/common/anchored-menu';
20
+ import { anchorRectOf } from '@/shared/lib/ui/menu-anchor';
19
21
  import type { ShellServersStore } from '@/client/hooks/shell/servers';
20
22
  import type { ShellServer } from '@/client/lib/shell/servers';
21
23
  import { mobileOverlayStyle } from '@/shared/lib/ui/mobile-overlay';
@@ -28,6 +30,8 @@ interface ServerPanelProps {
28
30
  /** `nav` hangs under a desktop navbar button; `chip` is a phone sheet. */
29
31
  variant: ServerControlVariant;
30
32
  store: ShellServersStore;
33
+ /** The button this panel hangs from; the nav variant is measured off it. */
34
+ triggerRef: { current: HTMLButtonElement | null };
31
35
  }
32
36
 
33
37
  function statusLine(server: ShellServer): string {
@@ -131,8 +135,24 @@ function Row({
131
135
  * A server is only offered as connectable while it ANSWERS: the shell probes
132
136
  * every URL before answering, so `running: false` is a real fact rather than a
133
137
  * guess, and the row says so instead of letting a click fail on a blank window.
138
+ *
139
+ * ## The panel is portalled, and why that is the fix rather than a z-index bump
140
+ *
141
+ * The desktop trigger lives in the navbar, a FLEX ITEM at `z-20`; a `z-50`
142
+ * panel inside it is still confined to that stacking context, so anything at
143
+ * `z-20`+ in the chat column painted over it (measured: an `elementFromPoint`
144
+ * walk found the timeline's minimap on top of the panel's middle rows at
145
+ * 1100×460). Raising the panel's own number cannot help — the number that
146
+ * decides is the ANCESTOR's. Same story on the phone: the drawer's title bar
147
+ * is a `z-20` flex item, and the sheet's lower rows fell under the sticky
148
+ * workspace headers beneath it.
149
+ *
150
+ * So the body is drawn by `common/anchored-menu/`: `fixed`, in `document.body`,
151
+ * at the layer above every panel and modal. The nav variant measures the
152
+ * trigger it hangs from; the chip variant keeps `mobileOverlayStyle`'s insets,
153
+ * which are a property of the device rather than of the button.
134
154
  */
135
- export function ServerPanel({ open, onClose, variant, store }: ServerPanelProps) {
155
+ export function ServerPanel({ open, onClose, variant, store, triggerRef }: ServerPanelProps) {
136
156
  const [label, setLabel] = useState('');
137
157
  const [url, setUrl] = useState('');
138
158
  const [adding, setAdding] = useState(false);
@@ -155,30 +175,20 @@ export function ServerPanel({ open, onClose, variant, store }: ServerPanelProps)
155
175
  }
156
176
  };
157
177
 
158
- // Desktop hangs under its navbar button; a phone pins to the VIEWPORT, because
159
- // its trigger sits in the drawer header and a 340px panel anchored there runs
160
- // off the right edge (measured at 390) and past the bottom in landscape.
161
- const placement =
162
- variant === 'chip'
163
- ? mobileOverlayStyle()
164
- : undefined;
178
+ // The panel's own chrome. `overflow-hidden` is gone: the rows scroll inside
179
+ // the body below, and a clipping root would cut the Add form's focus ring.
180
+ const panelClass = variant === 'chip'
181
+ ? 'rounded-xl border border-ink/15 bg-paper shadow-xl'
182
+ : 'w-[340px] rounded-xl border border-ink/15 bg-paper shadow-xl';
165
183
 
166
184
  return (
167
- <div
185
+ <AnchoredMenu
186
+ anchor={variant === 'nav' && triggerRef.current ? anchorRectOf(triggerRef.current) : null}
187
+ viewportStyle={variant === 'chip' ? mobileOverlayStyle() : undefined}
168
188
  role="dialog"
169
- aria-label="Servers"
170
- className={
171
- variant === 'chip'
172
- ? 'fixed z-50 rounded-xl border border-ink/15 bg-paper shadow-xl overflow-hidden'
173
- : 'absolute right-2 top-full mt-1 z-50 w-[340px] rounded-xl border border-ink/15 bg-paper shadow-xl overflow-hidden'
174
- }
175
- style={placement}
176
- onKeyDown={(event) => {
177
- if (event.key === 'Escape') {
178
- event.stopPropagation();
179
- onClose();
180
- }
181
- }}
189
+ ariaLabel="Servers"
190
+ className={panelClass}
191
+ onClose={onClose}
182
192
  >
183
193
  <div className="flex items-center justify-between px-3 py-2 border-b border-ink/10">
184
194
  <span className="flex items-center gap-1.5 text-xs font-semibold text-ink">
@@ -314,6 +324,6 @@ export function ServerPanel({ open, onClose, variant, store }: ServerPanelProps)
314
324
  </button>
315
325
  )}
316
326
  </div>
317
- </div>
327
+ </AnchoredMenu>
318
328
  );
319
329
  }
@@ -103,7 +103,13 @@ async function settle() {
103
103
  });
104
104
  }
105
105
 
106
- const text = () => (container.textContent ?? '').replace(/\s+/g, ' ').trim();
106
+ /**
107
+ * The panel is PORTALLED to `document.body` (an `absolute` panel inside the
108
+ * navbar's `z-20` stacking context lost to column content at equal or higher
109
+ * numbers — see `Panel.tsx`), so the panel's words are read from the document
110
+ * rather than from the trigger's own container.
111
+ */
112
+ const text = () => (win.document.body.textContent ?? '').replace(/\s+/g, ' ').trim();
107
113
 
108
114
  beforeEach(() => {
109
115
  win = new Window({ url: 'http://127.0.0.1:3001/' });
@@ -137,7 +143,7 @@ describe('ServerControl', () => {
137
143
  expect(text()).toContain('Found on this machine');
138
144
  expect(text()).toContain('Local :3000');
139
145
  // The active row carries its own marker rather than a colour alone.
140
- expect(container.querySelector('[aria-label="Active"]')).not.toBeNull();
146
+ expect(win.document.querySelector('[aria-label="Active"]')).not.toBeNull();
141
147
  });
142
148
 
143
149
  test('the trigger and the panel read ONE list — one read, not two polls', async () => {
@@ -150,17 +156,17 @@ describe('ServerControl', () => {
150
156
  mount(DESKTOP);
151
157
  await settle();
152
158
  expect(text()).toContain('Stopped');
153
- const nas = [...container.querySelectorAll('button')].find((button) =>
159
+ const nas = [...win.document.querySelectorAll('button')].find((button) =>
154
160
  (button.textContent ?? '').includes('NAS'),
155
161
  );
156
162
  expect(nas).toBeDefined();
157
- expect((nas as HTMLButtonElement).disabled).toBe(true);
163
+ expect(nas?.disabled).toBe(true);
158
164
  });
159
165
 
160
166
  test('Stop is offered only for a server this shell started', async () => {
161
167
  mount(DESKTOP);
162
168
  await settle();
163
- const stops = [...container.querySelectorAll('button')].filter((button) =>
169
+ const stops = [...win.document.querySelectorAll('button')].filter((button) =>
164
170
  (button.getAttribute('aria-label') ?? '').startsWith('Stop '),
165
171
  );
166
172
  expect(stops.map((button) => button.getAttribute('aria-label'))).toEqual(['Stop Local :3001']);
@@ -31,7 +31,6 @@ import { useEffect, useRef, useState } from 'preact/hooks';
31
31
  import { ServerCog } from 'lucide-preact';
32
32
  import { useShellServers } from '@/client/hooks/shell/servers';
33
33
  import { hasShellBridge } from '@/client/lib/shell/transport';
34
- import { useOnClickOutside } from '@/client/hooks/ui/on-click-outside';
35
34
  import { ServerPanel } from '@/client/components/common/server-control/Panel';
36
35
 
37
36
  export type ServerControlVariant = 'nav' | 'chip';
@@ -50,15 +49,16 @@ export function ServerControl({ variant }: ServerControlProps) {
50
49
  // would be a button that never works.
51
50
  const available = hasShellBridge();
52
51
  const [open, setOpen] = useState(false);
53
- const ref = useRef<HTMLDivElement>(null);
52
+ // The panel is PORTALLED (see `Panel.tsx` for the measured reason), so its
53
+ // dismissal is its own backdrop — an outside-click listener rooted at the
54
+ // trigger would read every click inside the panel as "outside".
55
+ const triggerRef = useRef<HTMLButtonElement>(null);
54
56
  const store = useShellServers(open);
55
57
  const active =
56
58
  store.state?.entries.find((entry) => entry.id === store.state?.activeId) ??
57
59
  store.state?.detected.find((entry) => entry.url === store.state?.activeUrl) ??
58
60
  null;
59
61
 
60
- useOnClickOutside(ref, () => setOpen(false));
61
-
62
62
  // A shell that went away (a page kept across a host restart) must not leave a
63
63
  // dangling promise behind: closing it is the honest state.
64
64
  useEffect(() => {
@@ -73,8 +73,9 @@ export function ServerControl({ variant }: ServerControlProps) {
73
73
 
74
74
  if (variant === 'chip') {
75
75
  return (
76
- <div className="relative flex-shrink-0" ref={ref}>
76
+ <div className="relative flex-shrink-0">
77
77
  <button
78
+ ref={triggerRef}
78
79
  type="button"
79
80
  onClick={() => setOpen((was) => !was)}
80
81
  className={CHIP_CLASS}
@@ -85,14 +86,15 @@ export function ServerControl({ variant }: ServerControlProps) {
85
86
  >
86
87
  <ServerCog size={18} strokeWidth={1.8} />
87
88
  </button>
88
- <ServerPanel open={open} onClose={() => setOpen(false)} variant="chip" store={store} />
89
+ <ServerPanel open={open} onClose={() => setOpen(false)} variant="chip" store={store} triggerRef={triggerRef} />
89
90
  </div>
90
91
  );
91
92
  }
92
93
 
93
94
  return (
94
- <div className="relative" ref={ref}>
95
+ <div className="relative">
95
96
  <button
97
+ ref={triggerRef}
96
98
  type="button"
97
99
  onClick={() => setOpen((was) => !was)}
98
100
  className="flex items-center gap-1.5 rounded px-1.5 py-1 text-ink/60 hover:text-ink hover:bg-ink/10 transition-colors cursor-pointer"
@@ -112,7 +114,7 @@ export function ServerControl({ variant }: ServerControlProps) {
112
114
  aria-hidden="true"
113
115
  />
114
116
  </button>
115
- <ServerPanel open={open} onClose={() => setOpen(false)} variant="nav" store={store} />
117
+ <ServerPanel open={open} onClose={() => setOpen(false)} variant="nav" store={store} triggerRef={triggerRef} />
116
118
  </div>
117
119
  );
118
120
  }
@@ -167,7 +167,7 @@ export function SessionActionsMenu({
167
167
  // the position before the browser paints, so this never flashes.
168
168
  visibility: pos ? 'visible' : 'hidden',
169
169
  }}
170
- className="fixed z-[70] w-44 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 text-xs text-ink font-sans"
170
+ className="glass-popover fixed z-[70] w-44 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 text-xs text-ink font-sans"
171
171
  onClick={(e) => e.stopPropagation()}
172
172
  >
173
173
  {onRename && (
@@ -231,7 +231,7 @@ function OverflowMenu({ actions }: { actions: ToolbarOverflowAction[] }) {
231
231
  // settles the position before the browser paints.
232
232
  visibility: position ? 'visible' : 'hidden',
233
233
  }}
234
- className="fixed z-[80] w-52 bg-paper border border-ink/15 rounded-lg shadow-lg py-1 text-xs"
234
+ className="glass-popover fixed z-[80] w-52 bg-paper border border-ink/15 rounded-lg shadow-lg py-1 text-xs"
235
235
  >
236
236
  {actions.map((action) => (
237
237
  <button
@@ -39,7 +39,7 @@ import { pluginEnablementKey } from '@/shared/lib/workspace/panel-ids';
39
39
  import { PANEL_MARK_SIZE } from '@/shared/lib/workspace/right-panels';
40
40
  import { SESSIONS_VIEW_ID, isLeftDockPanelId } from '@/shared/lib/workspace/left-dock';
41
41
  import { BUILTIN_PANELS } from '@/client/components/workspace/panels/builtin';
42
- import { PluginMark } from '@/client/components/settings/categories/panel-plugins/PluginMark';
42
+ import { PanelMark } from '@/client/components/common/panel-mark';
43
43
  import { PanelVisibilityMenu, type PanelVisibilityItem } from '@/client/components/layout/PanelVisibilityMenu';
44
44
 
45
45
  interface ActivityBarProps {
@@ -126,7 +126,7 @@ export function ActivityBar({ side, activePanel, onChangePanel, isPanelOpen, has
126
126
  ref={navRef}
127
127
  onContextMenu={openMenu}
128
128
  aria-label={side === 'left' ? 'Left panel views' : 'Right panel views'}
129
- className={`w-11 flex-shrink-0 ${side === 'left' ? 'border-r' : 'border-l'} border-ink/10 bg-paper flex flex-col items-center py-3 space-y-2 z-10`}
129
+ className={`glass-chrome w-11 flex-shrink-0 ${side === 'left' ? 'border-r' : 'border-l'} border-ink/10 bg-paper flex flex-col items-center py-3 space-y-2 z-10`}
130
130
  >
131
131
  <div className="flex flex-col items-center space-y-1 w-full">
132
132
  {drawn.map((panel, index) => (
@@ -243,7 +243,26 @@ function PanelButton({
243
243
  title={panel.title}
244
244
  aria-label={panel.title}
245
245
  >
246
- {panel.builtin && panel.icon ? panel.icon : panel.builtin ? <PluginMark name={panel.label} size={PANEL_MARK_SIZE} /> : <PluginMark name={panel.name} iconUrl={panel.iconUrl} size={PANEL_MARK_SIZE} />}
246
+ {/* The mark's wrapper carries the state as OPACITY, not as a text colour:
247
+ a `text-ink/40` here outranks the colour mode's hue rule, which is what
248
+ kept this rail monochrome while the panels behind it were tinted. In
249
+ the monochrome mode nothing dims the ink twice — `[data-idle]` is only
250
+ read under `[data-icon-style="color"]`.
251
+
252
+ The colour itself is NOT decided here: `PanelMark` stamps the same
253
+ `--panel-hue` the phone's chip strip and Settings read, so this button
254
+ cannot disagree with them about what `Files` looks like. */}
255
+ <PanelMark
256
+ className="panel-rail-mark inline-flex"
257
+ panelId={panel.id}
258
+ builtin={panel.builtin}
259
+ icon={panel.builtin ? panel.icon : undefined}
260
+ name={panel.builtin ? panel.label : panel.name}
261
+ {...(panel.iconUrl ? { iconUrl: panel.iconUrl } : {})}
262
+ {...(panel.color ? { color: panel.color } : {})}
263
+ size={PANEL_MARK_SIZE}
264
+ idle={!isActive}
265
+ />
247
266
  {showGitDot ? (
248
267
  <span
249
268
  className="absolute top-1.5 right-1.5 w-1.5 h-1.5 rounded-full bg-info"
@@ -101,7 +101,14 @@ export function LeftDockView({
101
101
  if (!panel.builtin && !isActive) return null;
102
102
  const viewBody: PanelBodyProps = { ...body, active: isActive, enabled: isActive };
103
103
  return (
104
- <div key={panel.id} className={isActive ? 'w-full h-full' : 'hidden'}>
104
+ // `data-panel-chrome`, like the right column's slot: a plugin
105
+ // placed on the LEFT draws its own `bg-paper` root too, and the
106
+ // column it lands in is chrome — one marker, both columns.
107
+ <div
108
+ key={panel.id}
109
+ data-panel-chrome=""
110
+ className={isActive ? 'w-full h-full' : 'hidden'}
111
+ >
105
112
  <PanelHostProvider value={viewBody}>{panel.render(viewBody)}</PanelHostProvider>
106
113
  </div>
107
114
  );
@@ -110,7 +117,7 @@ export function LeftDockView({
110
117
  whose bundle has not loaded — a notice, never a blank column. The
111
118
  session list is always drawable, so it is never this case. */}
112
119
  {!active ? (
113
- <div className="w-full h-full">
120
+ <div data-panel-chrome="" className="w-full h-full">
114
121
  <PluginPanelBody panelKey={activeView} />
115
122
  </div>
116
123
  ) : null}
@@ -76,7 +76,7 @@ export function PanelVisibilityMenu({ anchor, items, hidden, onToggle, onClose }
76
76
  // the position before the browser paints, so this never flashes.
77
77
  visibility: pos ? 'visible' : 'hidden',
78
78
  }}
79
- className="fixed z-[70] w-52 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 text-xs text-ink font-sans"
79
+ className="glass-popover fixed z-[70] w-52 bg-paper border border-ink/15 rounded-lg shadow-xl py-1 text-xs text-ink font-sans"
80
80
  onClick={(e) => e.stopPropagation()}
81
81
  >
82
82
  <div className="px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1">