@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,70 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The rendered markdown document — the preview half of a markdown tab.
8
+ *
9
+ * Extracted from `FileDocument` for the per-file ceiling, and it earns the
10
+ * boundary: everything here is "a document is on screen" (its scroller, its
11
+ * scroll memory, its zoom, its table of contents target) while what surrounds it
12
+ * is the editor's chrome.
13
+ *
14
+ * ## Two review states, one surface
15
+ *
16
+ * Review mode is a MODE the toolbar turns on. Off, the document is drawn exactly
17
+ * as it always was — `MarkdownReview` passes no review bridge, so no block
18
+ * attributes are emitted and every click keeps its meaning. On, the same
19
+ * component draws the marks and the judgement editor. There is deliberately no
20
+ * second preview component: one surface cannot drift from the other.
21
+ */
22
+
23
+ import { MarkdownReview } from '@/client/components/common/markdown-review';
24
+
25
+ export interface PreviewPaneProps {
26
+ content: string;
27
+ file: { name: string; path: string; root?: string | null; repo?: string | null };
28
+ zoomLevel: number;
29
+ /** Review mode, owned by the editor's toolbar. */
30
+ reviewActive: boolean;
31
+ onExitReview: () => void;
32
+ /** The scroller, shared by scroll restore and the table of contents. */
33
+ scrollRef: (element: HTMLElement | null) => void;
34
+ onScroll: () => void;
35
+ }
36
+
37
+ export function PreviewPane({
38
+ content,
39
+ file,
40
+ zoomLevel,
41
+ reviewActive,
42
+ onExitReview,
43
+ scrollRef,
44
+ onScroll,
45
+ }: PreviewPaneProps) {
46
+ return (
47
+ <div
48
+ ref={scrollRef}
49
+ onScroll={onScroll}
50
+ // No accessible name exists for a scroll container, so the E2E layer
51
+ // addresses it by testid (see `tests/e2e/fixtures/selectors.ts`).
52
+ data-testid="editor-scroller"
53
+ className="flex-1 overflow-auto bg-paper flex"
54
+ >
55
+ {/* No `prose` wrapper: markdown is styled by `.prose-content` alone
56
+ (the same system the chat timeline uses). The typography plugin
57
+ fought it — `.prose img` added 2em vertical margins that ballooned
58
+ a badge row into its own line box, and `--tw-prose-*` colors ignored
59
+ the theme. */}
60
+ <div className="p-6 max-w-4xl mx-auto font-sans flex-1" style={{ fontSize: `${zoomLevel}px` }}>
61
+ <MarkdownReview
62
+ content={content}
63
+ file={file}
64
+ active={reviewActive}
65
+ onExit={onExitReview}
66
+ />
67
+ </div>
68
+ </div>
69
+ );
70
+ }
@@ -33,14 +33,14 @@ export function SaveDeletedFileModal({ fileName, filePath, onClose, onConfirm }:
33
33
 
34
34
  return (
35
35
  <div
36
- className="fixed inset-0 z-50 flex items-center justify-center bg-ink/40 animate-in fade-in duration-200 p-4"
36
+ className="fixed inset-0 z-50 flex items-center justify-center modal-scrim animate-in fade-in duration-200 p-4"
37
37
  onClick={onClose}
38
38
  role="dialog"
39
39
  aria-modal="true"
40
40
  aria-label="Save deleted file"
41
41
  >
42
42
  <div
43
- className="bg-paper border border-ink/20 rounded-xl shadow-xl w-[min(94vw,440px)] overflow-hidden"
43
+ className="glass-overlay bg-paper border border-ink/20 rounded-xl shadow-xl w-[min(94vw,440px)] overflow-hidden"
44
44
  onClick={(e) => e.stopPropagation()}
45
45
  >
46
46
  <div className="flex items-center gap-3 px-4 py-3 border-b border-ink/10">
@@ -50,7 +50,7 @@ export function TabContextMenu({ x, y, rows, onAction, onClose }: TabContextMenu
50
50
  ref={menuRef}
51
51
  role="menu"
52
52
  aria-label="Tab actions"
53
- className="absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink"
53
+ className="glass-popover absolute w-52 bg-paper border border-ink/15 rounded-md shadow-xl py-1 text-xs text-ink"
54
54
  style={{ left: `${position.left}px`, top: `${position.top}px` }}
55
55
  onClick={(event) => event.stopPropagation()}
56
56
  >
@@ -244,7 +244,7 @@ export function EditorTabs({
244
244
  </button>
245
245
 
246
246
  {showDropdown && (
247
- <div className="absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1">
247
+ <div className="glass-popover absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1">
248
248
  <div className="px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1">
249
249
  Older Tabs
250
250
  </div>
@@ -7,7 +7,8 @@ import {
7
7
  } from 'lucide-preact';
8
8
  import { EditorViewButtons, useEditorViewActions } from '@/client/components/common/editor-view-buttons';
9
9
  import { ToolbarRow } from '@/client/components/common/toolbar-row';
10
- import { ACTION_CLASS, buildEditorClusters } from '@/client/components/workspace/editor/toolbar-clusters';
10
+ import { buildEditorClusters } from '@/client/components/workspace/editor/toolbar-clusters';
11
+ import { ACTION_CLASS } from '@/client/components/workspace/editor/toolbar-toggle';
11
12
  import { writeKabmoSettings } from '@/shared/lib/settings/client';
12
13
  import { EDITOR_BLAME_CHANGED_EVENT, currentEditorBlame, useEditorBlame } from '@/client/hooks/editor/blame-settings';
13
14
 
@@ -25,6 +26,13 @@ interface EditorToolbarProps {
25
26
  */
26
27
  hasPreview: boolean;
27
28
  isPreview: boolean;
29
+ /**
30
+ * A rendered markdown document is on screen, so blocks can be judged. False
31
+ * for every other kind: a CSV grid and an SVG picture have no markdown blocks.
32
+ */
33
+ hasReview: boolean;
34
+ /** Review mode is on for this tab. */
35
+ isReviewing: boolean;
28
36
  /** True for the 1.5s after a copy landed, so the button can confirm it. */
29
37
  copied: boolean;
30
38
  /**
@@ -59,6 +67,8 @@ interface EditorToolbarProps {
59
67
  onToggleFind: () => void;
60
68
  onSave: () => void;
61
69
  onTogglePreview: () => void;
70
+ /** Turn review mode on or off; the panel owns the state. */
71
+ onToggleReview: () => void;
62
72
  onToggleWordWrap: () => void;
63
73
  onZoomIn: () => void;
64
74
  onZoomOut: () => void;
@@ -94,6 +104,8 @@ export function EditorToolbar({
94
104
  wordWrap,
95
105
  hasPreview,
96
106
  isPreview,
107
+ hasReview,
108
+ isReviewing,
97
109
  copied,
98
110
  byteViewer = false,
99
111
  saveDisabled = false,
@@ -105,6 +117,7 @@ export function EditorToolbar({
105
117
  onToggleFind,
106
118
  onSave,
107
119
  onTogglePreview,
120
+ onToggleReview,
108
121
  onToggleWordWrap,
109
122
  onZoomIn,
110
123
  onZoomOut,
@@ -177,6 +190,8 @@ export function EditorToolbar({
177
190
  hasPreview,
178
191
  isPreview,
179
192
  wordWrap,
193
+ hasReview,
194
+ isReviewing,
180
195
  blameInline: blame.inline,
181
196
  findOpen,
182
197
  copied,
@@ -193,6 +208,7 @@ export function EditorToolbar({
193
208
  copyLabel: copied ? 'Copied' : byteViewer ? 'Copy image' : 'Copy content',
194
209
  maximizeLabel,
195
210
  onTogglePreview,
211
+ onToggleReview,
196
212
  onToggleFind,
197
213
  onToggleWordWrap,
198
214
  onToggleBlameInline: () => {
@@ -27,6 +27,8 @@ import { useSplitEditor } from '@/client/hooks/editor/use-split-editor';
27
27
  import { useExternalChangeNotice } from '@/client/hooks/editor/use-external-change-notice';
28
28
  import { useEditorPanelKeys } from '@/client/hooks/editor/use-editor-panel-keys';
29
29
  import { useCloseGuard } from '@/client/hooks/editor/use-close-guard';
30
+ import { useFileReviewMode } from '@/client/hooks/editor/use-file-review-mode';
31
+ import { useEditorPanelUi } from '@/client/hooks/editor/use-editor-panel-ui';
30
32
  import type { EditorProps } from '@/client/components/workspace/editor/props';
31
33
 
32
34
  export function Editor({
@@ -54,18 +56,16 @@ export function Editor({
54
56
  const activeFile = openedFiles.find(f => f.id === resolvedActiveFileId);
55
57
 
56
58
  const [previewMode, setPreviewMode, previewReady] = useSessionState<Record<string | number, boolean>>('editor.previewMode', {});
59
+ // Review mode: the same per-tab toggle the phone editor uses (one key, one rule).
60
+ // Off by default — the surface swallows block clicks, which is the last thing a
61
+ // reader who only wanted to follow a link asked for.
62
+ const review = useFileReviewMode(String(resolvedActiveFileId ?? ''));
57
63
  const [zoomLevel, setZoomLevel] = useSessionState<number>('editor.zoomLevel', EDITOR_DEFAULT_FONT_SIZE);
58
64
  const [isMaximized, setIsMaximized] = useState(false);
59
65
  const [wordWrap, setWordWrap] = useSessionState<boolean>('editor.wordWrap', true);
60
- // The panel's own transient UI: the palette, the go-to-line request, quick open and Save
61
- // As. All four are component state (never persisted) because each is a thing the user is
62
- // doing right now.
63
- const [paletteOpen, setPaletteOpen] = useState(false);
64
- // A counter, not a boolean: the dialog lives in the document (where the caret and the
65
- // handle are), so a boolean would need a matching "closed" write from there.
66
- const [goToLineRequest, setGoToLineRequest] = useState(0);
67
- const [quickOpen, setQuickOpen] = useState(false);
68
- const [saveAsOpen, setSaveAsOpen] = useState(false);
66
+ // The panel's transient UI (palette, go-to-line, quick open, Save As) lives in its own
67
+ // hook: all four are things the user is doing right now, and none is persisted.
68
+ const panelUi = useEditorPanelUi();
69
69
  const { sessionId } = useSessionStateContext();
70
70
  // The split's state and its derived values. `enabled: false` in a split pane, which never
71
71
  // splits again — the column has two panes, not a tree.
@@ -200,7 +200,7 @@ export function Editor({
200
200
  return;
201
201
  }
202
202
  if (command === 'goToLine') {
203
- setGoToLineRequest((previous) => previous + 1);
203
+ panelUi.openGoToLine();
204
204
  return;
205
205
  }
206
206
  // Everything else is the editor's, and it runs through the editor's own
@@ -210,11 +210,11 @@ export function Editor({
210
210
 
211
211
  const panelKeys = useEditorPanelKeys({
212
212
  find,
213
- paletteOpen,
214
- setPaletteOpen,
213
+ paletteOpen: panelUi.paletteOpen,
214
+ setPaletteOpen: panelUi.setPaletteOpen,
215
215
  runCommand,
216
216
  saveNow: editor.saveNow,
217
- openQuickOpen: () => setQuickOpen(true),
217
+ openQuickOpen: () => panelUi.setQuickOpen(true),
218
218
  reopenClosed: onReopenClosed,
219
219
  });
220
220
 
@@ -244,16 +244,19 @@ export function Editor({
244
244
  setWordWrap,
245
245
  viewerKind,
246
246
  isPreview: Boolean(isPreview),
247
+ // A review needs a rendered document: the source view has no blocks.
248
+ isReviewing: Boolean(isPreview) && review.active,
249
+ onToggleReview: review.toggle,
247
250
  isMaximized,
248
251
  setIsMaximized,
249
252
  zoomLevel,
250
253
  setZoomLevel,
251
- paletteOpen,
252
- setPaletteOpen,
253
- goToLineRequest,
254
- onSaveAs: () => setSaveAsOpen(true),
255
- quickOpen,
256
- onCloseQuickOpen: () => setQuickOpen(false),
254
+ paletteOpen: panelUi.paletteOpen,
255
+ setPaletteOpen: panelUi.setPaletteOpen,
256
+ goToLineRequest: panelUi.goToLineRequest,
257
+ onSaveAs: () => panelUi.setSaveAsOpen(true),
258
+ quickOpen: panelUi.quickOpen,
259
+ onCloseQuickOpen: () => panelUi.setQuickOpen(false),
257
260
  onOpenPath,
258
261
  rootPath,
259
262
  repoPath,
@@ -318,10 +321,10 @@ export function Editor({
318
321
  onReload={editor.resolveConflictByReload}
319
322
  onKeepMine={keepMineAgainstDisk}
320
323
  body={<EditorBody {...bodyProps} />}
321
- saveAsOpen={saveAsOpen}
322
- onSaveAsClose={() => setSaveAsOpen(false)}
324
+ saveAsOpen={panelUi.saveAsOpen}
325
+ onSaveAsClose={() => panelUi.setSaveAsOpen(false)}
323
326
  onSavedAs={(path) => {
324
- setSaveAsOpen(false);
327
+ panelUi.setSaveAsOpen(false);
325
328
  // The new file gets its OWN tab and the original stays open, which is what makes
326
329
  // Save As reversible by closing one tab.
327
330
  onOpenPath?.(path);
@@ -34,6 +34,9 @@ function state(): ToolbarState {
34
34
  previewLabel: 'Preview',
35
35
  isPreview: false,
36
36
  onTogglePreview: noop,
37
+ hasReview: false,
38
+ isReviewing: false,
39
+ onToggleReview: noop,
37
40
  findLabel: 'Find and replace',
38
41
  findOpen: false,
39
42
  onToggleFind: noop,
@@ -76,6 +79,17 @@ describe('buildEditorClusters order', () => {
76
79
  expect(pinned).toEqual(['save', 'view-modes', 'maximize']);
77
80
  });
78
81
 
82
+ test('the review toggle exists only where a rendered document can be judged', () => {
83
+ expect(buildEditorClusters(state()).map((cluster) => cluster.id)).not.toContain('review');
84
+ const reviewing = buildEditorClusters({ ...state(), hasReview: true, isReviewing: true });
85
+ expect(reviewing.map((cluster) => cluster.id)).toContain('review');
86
+ // A reading AID, but one that changes what a click means: it sits with the
87
+ // view toggles, after every write and before the reading-only clusters.
88
+ const ids = reviewing.map((cluster) => cluster.id);
89
+ expect(ids.indexOf('review')).toBeGreaterThan(ids.indexOf('save-as'));
90
+ expect(ids.indexOf('review')).toBeLessThan(ids.indexOf('preview'));
91
+ });
92
+
79
93
  test('a byte viewer drops the text-only clusters, Save as among them', () => {
80
94
  const ids = buildEditorClusters({ ...state(), byteViewer: true }).map((cluster) => cluster.id);
81
95
  for (const absent of ['save', 'save-as', 'find', 'wrap', 'blame', 'zoom']) {
@@ -27,14 +27,10 @@ import type { ComponentChildren } from 'preact';
27
27
  import {
28
28
  Copy,
29
29
  Download,
30
- Eye,
31
- EyeOff,
32
30
  GitCommitVertical,
33
31
  Maximize,
34
32
  Minimize,
35
33
  RotateCcw,
36
- Save,
37
- SaveAll,
38
34
  Search,
39
35
  WrapText,
40
36
  ZoomIn,
@@ -42,16 +38,22 @@ import {
42
38
  } from 'lucide-preact';
43
39
 
44
40
  import type { ToolbarCluster } from '@/client/components/common/toolbar-row';
45
-
46
- /** Shared icon-button shell. Every action here is icon-only, so each carries both names. */
47
- export const ACTION_CLASS =
48
- 'flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50';
41
+ import {
42
+ previewClusters,
43
+ reviewCluster,
44
+ writeClusters,
45
+ } from '@/client/components/workspace/editor/toolbar-write-clusters';
46
+ import { ACTION_CLASS, Toggle } from '@/client/components/workspace/editor/toolbar-toggle';
49
47
 
50
48
  /** The state the toolbar draws, already resolved by the caller. */
51
49
  export interface ToolbarState {
52
50
  byteViewer: boolean;
53
51
  hasPreview: boolean;
54
52
  isPreview: boolean;
53
+ /** The file has annotatable blocks (markdown) and a rendered preview to judge. */
54
+ hasReview: boolean;
55
+ /** Review mode is on, so the button reads as pressed. */
56
+ isReviewing: boolean;
55
57
  wordWrap: boolean;
56
58
  /** The inline blame label is drawn (the setting, not whether a file has blame). */
57
59
  blameInline: boolean;
@@ -67,6 +69,7 @@ export interface ToolbarState {
67
69
  copyLabel: string;
68
70
  maximizeLabel: string;
69
71
  onTogglePreview: () => void;
72
+ onToggleReview: () => void;
70
73
  onToggleFind: () => void;
71
74
  onToggleWordWrap: () => void;
72
75
  onToggleBlameInline: () => void;
@@ -83,34 +86,6 @@ export interface ToolbarState {
83
86
  viewModeButtons: ComponentChildren;
84
87
  }
85
88
 
86
- /** One pressed-state toggle. */
87
- function Toggle({
88
- label,
89
- pressed,
90
- title,
91
- onClick,
92
- children,
93
- }: {
94
- label: string;
95
- pressed: boolean;
96
- title?: string;
97
- onClick: () => void;
98
- children: ComponentChildren;
99
- }) {
100
- return (
101
- <button
102
- type="button"
103
- onClick={onClick}
104
- className={`${ACTION_CLASS} hover:bg-ink/5 ${pressed ? 'text-ink' : 'hover:text-ink'}`}
105
- title={title ?? label}
106
- aria-label={label}
107
- aria-pressed={pressed}
108
- >
109
- {children}
110
- </button>
111
- );
112
- }
113
-
114
89
  /**
115
90
  * The clusters, in hiding order.
116
91
  *
@@ -123,56 +98,7 @@ function Toggle({
123
98
  export function buildEditorClusters(state: ToolbarState): ToolbarCluster[] {
124
99
  const clusters: ToolbarCluster[] = [];
125
100
 
126
- if (!state.byteViewer) {
127
- clusters.push({
128
- id: 'save',
129
- // The primary action of the panel: a menu row must never be the only way to
130
- // save a file.
131
- pinned: true,
132
- actions: [{ label: 'Save file', icon: Save, onSelect: state.onSave, disabled: state.saveDisabled }],
133
- children: state.saveButton,
134
- });
135
-
136
- clusters.push({
137
- id: 'save-as',
138
- // Never pinned: it is a rare operation, and the row's space belongs to Save.
139
- // It IS placed directly after Save, because unpinned clusters take the row in
140
- // ROW ORDER: measured at the 320px floor, the 26px blame cluster added after
141
- // it claimed the last 30px and pushed `Save as` into `⋯` — a reading aid
142
- // evicting a write. Sibling writes outrank reading aids here.
143
- actions: [{ label: 'Save as…', icon: SaveAll, onSelect: state.onSaveAs }],
144
- children: (
145
- <button
146
- type="button"
147
- onClick={state.onSaveAs}
148
- className={`${ACTION_CLASS} hover:bg-ink/5 hover:text-ink`}
149
- title="Save the buffer to a new file"
150
- aria-label="Save as"
151
- >
152
- <SaveAll size={14} />
153
- </button>
154
- ),
155
- });
156
- }
157
-
158
- if (state.hasPreview) {
159
- clusters.push({
160
- id: 'preview',
161
- actions: [
162
- {
163
- label: state.previewLabel,
164
- icon: state.isPreview ? EyeOff : Eye,
165
- onSelect: state.onTogglePreview,
166
- active: state.isPreview,
167
- },
168
- ],
169
- children: (
170
- <Toggle label={state.previewLabel} pressed={state.isPreview} onClick={state.onTogglePreview}>
171
- {state.isPreview ? <EyeOff size={14} /> : <Eye size={14} />}
172
- </Toggle>
173
- ),
174
- });
175
- }
101
+ clusters.push(...writeClusters(state), ...reviewCluster(state), ...previewClusters(state));
176
102
 
177
103
  if (!state.byteViewer) {
178
104
  clusters.push({
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The editor toolbar's two shared primitives: the icon-button shell and the
8
+ * pressed-state toggle every control in the row is built from.
9
+ *
10
+ * In their own module because both cluster tables (`toolbar-clusters` for the
11
+ * reading aids, `toolbar-write-clusters` for saves and view toggles) draw with
12
+ * them — importing one from the other would be a cycle between two tables that
13
+ * are peers.
14
+ *
15
+ * **Every action is an icon-only `<button>` carrying both a `title` and an
16
+ * `aria-label`** — a bare `<svg onClick>` is unreachable by keyboard and
17
+ * invisible to a screen reader. That rule is the reason this shell exists rather
18
+ * than each call site re-deriving it.
19
+ */
20
+
21
+ import type { ComponentChildren } from 'preact';
22
+
23
+ /** Shared icon-button shell. */
24
+ export const ACTION_CLASS =
25
+ 'flex items-center justify-center p-1.5 rounded transition-colors cursor-pointer disabled:cursor-default disabled:opacity-50';
26
+
27
+ /** One pressed-state toggle. */
28
+ export function Toggle({
29
+ label,
30
+ pressed,
31
+ title,
32
+ onClick,
33
+ children,
34
+ }: {
35
+ label: string;
36
+ pressed: boolean;
37
+ title?: string;
38
+ onClick: () => void;
39
+ children: ComponentChildren;
40
+ }) {
41
+ return (
42
+ <button
43
+ type="button"
44
+ onClick={onClick}
45
+ className={`${ACTION_CLASS} hover:bg-ink/5 ${pressed ? 'text-ink' : 'hover:text-ink'}`}
46
+ title={title ?? label}
47
+ aria-label={label}
48
+ aria-pressed={pressed}
49
+ >
50
+ {children}
51
+ </button>
52
+ );
53
+ }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The WRITE clusters and the two VIEW-MODE toggles — the left half of the editor
8
+ * toolbar, split from `toolbar-clusters.tsx` for the per-file ceiling.
9
+ *
10
+ * The boundary is the two rules that were already there: writes come first and
11
+ * are the ones allowed to be pinned, while the reading aids (find, wrap, zoom,
12
+ * blame) may move into `⋯` on a narrow panel. Keeping the write pair beside the
13
+ * two view toggles is what stops a reading aid from being added in front of them
14
+ * — the measured bug the original comment records (`Save as` pushed into `⋯` by
15
+ * a later, narrower cluster).
16
+ */
17
+
18
+ import { Eye, EyeOff, MessageSquare, SaveAll } from 'lucide-preact';
19
+
20
+ import type { ToolbarState } from '@/client/components/workspace/editor/toolbar-clusters';
21
+ import { ACTION_CLASS, Toggle } from '@/client/components/workspace/editor/toolbar-toggle';
22
+ import type { ToolbarCluster } from '@/client/components/common/toolbar-row';
23
+
24
+ /** Save and Save as: never a menu row for the panel's own primary action. */
25
+ export function writeClusters(state: ToolbarState): ToolbarCluster[] {
26
+ if (state.byteViewer) return [];
27
+ return [
28
+ {
29
+ id: 'save',
30
+ // The primary action of the panel: a menu row must never be the only way to
31
+ // save a file.
32
+ pinned: true,
33
+ actions: [{ label: 'Save file', icon: SaveAll, onSelect: state.onSave, disabled: state.saveDisabled }],
34
+ children: state.saveButton,
35
+ },
36
+ {
37
+ id: 'save-as',
38
+ // Never pinned: it is a rare operation, and the row's space belongs to Save.
39
+ // It IS placed directly after Save, because unpinned clusters take the row in
40
+ // ROW ORDER: measured at the 320px floor, the 26px blame cluster added after
41
+ // it claimed the last 30px and pushed `Save as` into `⋯` — a reading aid
42
+ // evicting a write. Sibling writes outrank reading aids here.
43
+ actions: [{ label: 'Save as…', icon: SaveAll, onSelect: state.onSaveAs }],
44
+ children: (
45
+ <button
46
+ type="button"
47
+ onClick={state.onSaveAs}
48
+ className={`${ACTION_CLASS} hover:bg-ink/5 hover:text-ink`}
49
+ title="Save the buffer to a new file"
50
+ aria-label="Save as"
51
+ >
52
+ <SaveAll size={14} />
53
+ </button>
54
+ ),
55
+ },
56
+ ];
57
+ }
58
+
59
+ /**
60
+ * The review toggle — only where there is a rendered document to judge.
61
+ *
62
+ * Annotating the SOURCE has no blocks, so the button exists only while the
63
+ * preview branch is the one on screen: a control that switched a mode nothing
64
+ * could use would be a lie about what the panel can do.
65
+ */
66
+ export function reviewCluster(state: ToolbarState): ToolbarCluster[] {
67
+ if (!state.hasReview) return [];
68
+ const label = state.isReviewing ? 'Exit review mode' : 'Review this document';
69
+ return [
70
+ {
71
+ id: 'review',
72
+ actions: [{ label, icon: MessageSquare, onSelect: state.onToggleReview, active: state.isReviewing }],
73
+ children: (
74
+ <Toggle
75
+ label={label}
76
+ pressed={state.isReviewing}
77
+ title={
78
+ state.isReviewing
79
+ ? 'Review mode is on — click a block to judge it'
80
+ : 'Review: click blocks to mark them good or needing work'
81
+ }
82
+ onClick={state.onToggleReview}
83
+ >
84
+ <MessageSquare size={14} />
85
+ </Toggle>
86
+ ),
87
+ },
88
+ ];
89
+ }
90
+
91
+ /** The rendered-view toggle (markdown prose, CSV grid, SVG picture). */
92
+ export function previewClusters(state: ToolbarState): ToolbarCluster[] {
93
+ if (!state.hasPreview) return [];
94
+ return [
95
+ {
96
+ id: 'preview',
97
+ actions: [
98
+ {
99
+ label: state.previewLabel,
100
+ icon: state.isPreview ? EyeOff : Eye,
101
+ onSelect: state.onTogglePreview,
102
+ active: state.isPreview,
103
+ },
104
+ ],
105
+ children: (
106
+ <Toggle label={state.previewLabel} pressed={state.isPreview} onClick={state.onTogglePreview}>
107
+ {state.isPreview ? <EyeOff size={14} /> : <Eye size={14} />}
108
+ </Toggle>
109
+ ),
110
+ },
111
+ ];
112
+ }
@@ -129,7 +129,7 @@ export function FileContextMenu({ x, y, isFolder, hasGitStatus, pasteLabel, chai
129
129
  >
130
130
  <div
131
131
  ref={menuRef}
132
- className="fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans"
132
+ className="glass-popover fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans"
133
133
  style={{ top: posY, left: posX }}
134
134
  onClick={e => e.stopPropagation()}
135
135
  >