@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
@@ -26,11 +26,13 @@
26
26
  * `rgb(138,138,138)` in both the inactive and the active state, against a
27
27
  * built-in's `text-ink/40` → `text-ink`.
28
28
  *
29
- * A mask has no document to inherit into, so the host supplies the paint
30
- * (`background-color: currentColor`) and the file supplies only its alpha
31
- * channel. That is also the app's own rule for marks: the palette is monochrome,
32
- * and brand identity is carried by the shape ({@link ProviderIcon} does the same
33
- * by folding every glyph to `currentColor` at bake time).
29
+ * A mask has no document to inherit into, so the host supplies the paint and the
30
+ * file supplies only its alpha channel. That paint is `var(--plugin-color,
31
+ * currentColor)`: monochrome resolves to the ink the mask always used, and
32
+ * `[data-icon-style="color"]` defines `--plugin-color` from a hue derived from
33
+ * the plugin's own name — so a marketplace mark gets its own colour without the
34
+ * host guessing one at build time, and without the component reading the mode
35
+ * from JavaScript.
34
36
  *
35
37
  * A RASTER mark keeps the `<img>`. Masking a PNG or a JPEG would throw away its
36
38
  * colour — a brand logo the plugin chose to ship — and a JPEG has no alpha to
@@ -38,17 +40,41 @@
38
40
  */
39
41
 
40
42
  import { providerInitials } from '@/shared/lib/models/provider/glyph';
43
+ import { hashHue } from '@/shared/lib/icons/tint';
44
+ import { legiblePair } from '@/shared/lib/theme/legibility';
41
45
 
42
46
  interface PluginMarkProps {
43
47
  name: string;
44
48
  /** The registry's content-addressed icon URL, when the plugin declares one. */
45
49
  iconUrl?: string;
50
+ /**
51
+ * The mark colour the plugin's manifest declares (`color`), when it does.
52
+ *
53
+ * Set as a custom property pair (`--plugin-declared-light`/`-dark`), not as a
54
+ * colour, so the STYLE still decides whether it is used: `monochrome` leaves
55
+ * the mark in the palette ink, and the declared brand colour only appears under
56
+ * `[data-icon-style="color"]`. Two values because a brand hex is legible on one
57
+ * variant and not the other; `legiblePair` derives both.
58
+ */
59
+ color?: string;
46
60
  size?: number;
47
61
  /** Filled background behind the fallback, for a card that wants a tile. */
48
62
  tile?: boolean;
49
63
  }
50
64
 
51
- export function PluginMark({ name, iconUrl, size = 16, tile = false }: PluginMarkProps) {
65
+ export function PluginMark({ name, iconUrl, color, size = 16, tile = false }: PluginMarkProps) {
66
+ // The mark's own colour, on the same wheel as every functional glyph. Set as a
67
+ // custom property rather than a colour so the STYLE decides whether it is used:
68
+ // monochrome leaves `--plugin-color` undefined and the mark keeps the ink.
69
+ // A declared brand colour is clamped the way every other brand mark is
70
+ // (`legiblePair`): a bright hex like `#34d399` is 1.9:1 on white paper, so the
71
+ // light and dark values are derived instead of trusted.
72
+ const declared = color ? legiblePair(color) : null;
73
+ const hue = {
74
+ '--icon-hue': String(hashHue(name)),
75
+ ...(declared ? { '--plugin-declared-light': declared.light } : {}),
76
+ ...(declared?.dark ? { '--plugin-declared-dark': declared.dark } : {}),
77
+ } as Record<string, string>;
52
78
  if (iconUrl) {
53
79
  // The QUERY is stripped before the extension is read: the registry's URL is
54
80
  // `/api/panels/icon/<plugin>/<path>?v=<hash>`, so the extension is on the
@@ -59,13 +85,15 @@ export function PluginMark({ name, iconUrl, size = 16, tile = false }: PluginMar
59
85
  return (
60
86
  <span
61
87
  aria-hidden="true"
88
+ data-plugin-mark=""
62
89
  className="inline-block flex-shrink-0"
63
90
  style={{
91
+ ...hue,
64
92
  width: size,
65
93
  height: size,
66
- // The ink the mask is cut out of, so the mark follows the theme
67
- // exactly like a built-in view's icon does.
68
- backgroundColor: 'currentColor',
94
+ // The ink the mask is cut out of — or the plugin's own colour, which
95
+ // `[data-icon-style="color"]` supplies through `--plugin-color`.
96
+ backgroundColor: 'var(--plugin-color, currentColor)',
69
97
  maskImage: `url("${iconUrl}")`,
70
98
  maskSize: 'contain',
71
99
  maskRepeat: 'no-repeat',
@@ -98,10 +126,15 @@ export function PluginMark({ name, iconUrl, size = 16, tile = false }: PluginMar
98
126
  return (
99
127
  <span
100
128
  aria-hidden="true"
101
- className={`inline-flex flex-shrink-0 items-center justify-center font-semibold lowercase leading-none text-ink/45 ${
129
+ data-plugin-mark=""
130
+ className={`inline-flex flex-shrink-0 items-center justify-center font-semibold lowercase leading-none ${
102
131
  tile ? 'rounded bg-ink/5' : ''
103
132
  }`}
104
133
  style={{
134
+ ...hue,
135
+ // 45% of the palette ink is what `text-ink/45` meant; stated as a value
136
+ // so the colour mode can replace it without a second class.
137
+ color: 'var(--plugin-color, color-mix(in srgb, var(--theme-ink) 45%, transparent))',
105
138
  height: size,
106
139
  minWidth: size,
107
140
  paddingInline: Math.max(1, Math.round(size * 0.12)),
@@ -1,3 +1,4 @@
1
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
1
2
  import { useEffect, useState } from 'preact/hooks';
2
3
  import { ExternalLink, RotateCcw, Trash2 } from 'lucide-preact';
3
4
  import type { PluginFeatureSpec, PluginItem } from '@/shared/types';
@@ -268,7 +269,7 @@ function FeaturesSection({
268
269
  : prev.filter((name) => name !== feature.name),
269
270
  )
270
271
  }
271
- className="mt-0.5 accent-ink cursor-pointer disabled:opacity-60"
272
+ className={`${CHECKBOX_CLASS} mt-0.5 accent-ink cursor-pointer disabled:opacity-60`}
272
273
  />
273
274
  <span className="min-w-0">
274
275
  <span className="text-xs font-medium text-ink font-mono">{feature.name}</span>
@@ -1,3 +1,4 @@
1
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
1
2
  import { useEffect, useState } from 'preact/hooks';
2
3
  import { Check, ChevronDown, ChevronRight, KeyRound } from 'lucide-preact';
3
4
  import type { PluginItem, PluginSettingSpec } from '@/shared/types';
@@ -172,7 +173,7 @@ function SettingInput({
172
173
  checked={value === 'true'}
173
174
  disabled={disabled}
174
175
  onChange={(event) => onChange(event.currentTarget.checked ? 'true' : 'false')}
175
- className="accent-ink cursor-pointer"
176
+ className={`${CHECKBOX_CLASS} accent-ink cursor-pointer`}
176
177
  />
177
178
  <span className="text-[11px] text-ink/70">{value === 'true' ? 'true' : 'false'}</span>
178
179
  </label>
@@ -95,7 +95,7 @@ export function ProjectModelDropdown({
95
95
  </button>
96
96
 
97
97
  {isOpen && (
98
- <div className="absolute right-0 mt-1 w-[288px] bg-paper border border-ink/15 rounded-lg shadow-xl z-50 overflow-hidden">
98
+ <div className="glass-popover absolute right-0 mt-1 w-[288px] bg-paper border border-ink/15 rounded-lg shadow-xl z-50 overflow-hidden">
99
99
  <div className="flex items-center gap-1.5 px-2.5 py-2 border-b border-ink/10">
100
100
  <Search size={12} className="text-ink/40 shrink-0" />
101
101
  <input
@@ -18,6 +18,7 @@
18
18
  * the next create uses — including one started by a scheduled task.
19
19
  */
20
20
 
21
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
21
22
  import { useState } from 'preact/hooks';
22
23
  import { readKabmoSetting, writeSetting } from '@/shared/lib/settings/client';
23
24
  import { useWorktrees } from '@/client/hooks/workspace/worktree/index';
@@ -131,7 +132,7 @@ export function WorktreeSettings({ root, folderId, onReport }: WorktreeSettingsP
131
132
  setCarry(next);
132
133
  writeSetting(WORKTREE_CARRY_SETTING, next);
133
134
  }}
134
- className="mt-0.5"
135
+ className={`${CHECKBOX_CLASS} mt-0.5`}
135
136
  />
136
137
  <span className="flex flex-col gap-0.5">
137
138
  <span className="text-xs font-semibold text-ink">Copy ignored files into new worktrees</span>
@@ -56,14 +56,14 @@ export function DeleteProviderModal({
56
56
 
57
57
  return (
58
58
  <div
59
- className="fixed inset-0 z-[70] flex items-center justify-center bg-ink/40 backdrop-blur-[2px] p-4"
59
+ className="fixed inset-0 z-[70] flex items-center justify-center modal-scrim backdrop-blur-[2px] p-4"
60
60
  onClick={isDeleting ? undefined : onClose}
61
61
  role="dialog"
62
62
  aria-modal="true"
63
63
  aria-label="Confirm provider deletion"
64
64
  >
65
65
  <div
66
- className="bg-paper border border-ink/20 rounded-xl shadow-2xl w-[min(94vw,460px)] max-h-full overflow-y-auto scrollbar-overlay-container text-ink"
66
+ className="glass-overlay bg-paper border border-ink/20 rounded-xl shadow-2xl w-[min(94vw,460px)] max-h-full overflow-y-auto scrollbar-overlay-container text-ink"
67
67
  onClick={(e) => e.stopPropagation()}
68
68
  >
69
69
  <div className="flex items-center gap-3 px-5 py-4 border-b border-ink/10">
@@ -1,3 +1,4 @@
1
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
1
2
  import { Plus, X } from 'lucide-preact';
2
3
  import { PROVIDER_DISCOVERY_TYPES } from '@/shared/lib/models/provider/dialect';
3
4
  import type { ProviderDiscoveryType } from '@/shared/types/settings/provider';
@@ -95,7 +96,7 @@ export function EntryAdvanced({
95
96
  type="checkbox"
96
97
  checked={discovery.injectV1 === true}
97
98
  onChange={(e) => patch({ injectV1: e.currentTarget.checked })}
98
- className="mt-0.5"
99
+ className={`${CHECKBOX_CLASS} mt-0.5`}
99
100
  />
100
101
  <span>
101
102
  Skip the forced <span className="font-mono">/v1</span> prefix — for a gateway rooted at a
@@ -109,7 +110,7 @@ export function EntryAdvanced({
109
110
  type="checkbox"
110
111
  checked={discovery.advertisedReasoning === true}
111
112
  onChange={(e) => patch({ advertisedReasoning: e.currentTarget.checked })}
112
- className="mt-0.5"
113
+ className={`${CHECKBOX_CLASS} mt-0.5`}
113
114
  />
114
115
  <span>Trust the reasoning ladder the endpoint advertises in its model rows.</span>
115
116
  </label>
@@ -79,14 +79,14 @@ export function LogoutProviderModal({ isOpen, provider, onClose, onSignedOut }:
79
79
 
80
80
  return (
81
81
  <div
82
- className="fixed inset-0 z-[70] flex items-center justify-center bg-ink/40 backdrop-blur-[2px] p-4"
82
+ className="fixed inset-0 z-[70] flex items-center justify-center modal-scrim backdrop-blur-[2px] p-4"
83
83
  onClick={busyId !== null ? undefined : onClose}
84
84
  role="dialog"
85
85
  aria-modal="true"
86
86
  aria-label="Confirm sign out"
87
87
  >
88
88
  <div
89
- className="bg-paper border border-ink/20 rounded-xl shadow-2xl w-[min(94vw,480px)] max-h-full overflow-y-auto scrollbar-overlay-container text-ink"
89
+ className="glass-overlay bg-paper border border-ink/20 rounded-xl shadow-2xl w-[min(94vw,480px)] max-h-full overflow-y-auto scrollbar-overlay-container text-ink"
90
90
  onClick={(e) => e.stopPropagation()}
91
91
  >
92
92
  <div className="flex items-center gap-3 px-5 py-4 border-b border-ink/10">
@@ -1,3 +1,4 @@
1
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
1
2
  import { useEffect, useState } from 'preact/hooks';
2
3
  import type { ComponentChildren } from 'preact';
3
4
  import { AlertCircle, Check, GitBranch, Loader2, Search } from 'lucide-preact';
@@ -123,7 +124,7 @@ export function GitImportPanel({ controller, onInstalled }: GitImportPanelProps)
123
124
  checked={isSelected}
124
125
  disabled={Boolean(blocked)}
125
126
  onChange={() => controller.toggle(skill.path)}
126
- className="mt-0.5 accent-ink cursor-pointer disabled:cursor-not-allowed"
127
+ className={`${CHECKBOX_CLASS} mt-0.5 accent-ink cursor-pointer disabled:cursor-not-allowed`}
127
128
  />
128
129
  <div className="min-w-0 flex-1">
129
130
  <div className="flex items-center gap-2 min-w-0">
@@ -190,7 +191,7 @@ export function GitImportPanel({ controller, onInstalled }: GitImportPanelProps)
190
191
  type="checkbox"
191
192
  checked={overwrite}
192
193
  onChange={(event) => controller.setOverwrite(event.currentTarget.checked)}
193
- className="mt-0.5 accent-ink cursor-pointer"
194
+ className={`${CHECKBOX_CLASS} mt-0.5 accent-ink cursor-pointer`}
194
195
  />
195
196
  <span className="text-[11px] text-ink/70 leading-relaxed">
196
197
  Replace skills that already have the same name
@@ -1,5 +1,6 @@
1
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
1
2
  import type { ComponentChildren } from 'preact';
2
- import { Check, Eye, EyeOff, Lock, RefreshCw, Save, Sparkles, Trash2 } from 'lucide-preact';
3
+ import { AlertCircle, Check, Eye, EyeOff, Loader2, Lock, RefreshCw, Save, Sparkles, Trash2 } from 'lucide-preact';
3
4
  import type { SkillItem } from '@/shared/types';
4
5
  import { scopeLabel, sourceBadge } from '@/client/components/settings/categories/skill-settings/row-meta';
5
6
 
@@ -21,6 +22,13 @@ interface SkillDetailHeaderProps {
21
22
  onConfirmDelete: () => void;
22
23
  onCancelDelete: () => void;
23
24
  onSave: () => void;
25
+ /** A write is in flight: the buttons report that instead of accepting another. */
26
+ saving?: boolean;
27
+ /** The last write landed (flashes briefly). */
28
+ saved?: boolean;
29
+ /** The last write's refusal, in the server's own words. */
30
+ writeError?: string | null;
31
+ onDismissWriteError?: () => void;
24
32
  }
25
33
 
26
34
  function Badge({ children, title }: { children: ComponentChildren; title?: string }) {
@@ -60,6 +68,10 @@ export function SkillDetailHeader({
60
68
  onConfirmDelete,
61
69
  onCancelDelete,
62
70
  onSave,
71
+ saving = false,
72
+ saved = false,
73
+ writeError = null,
74
+ onDismissWriteError,
63
75
  }: SkillDetailHeaderProps) {
64
76
  const title = isCreatingNew ? 'New skill' : (skill?.name ?? name);
65
77
 
@@ -136,7 +148,7 @@ export function SkillDetailHeader({
136
148
  checked={hidden}
137
149
  disabled={readOnly}
138
150
  onChange={(event) => onHiddenChange(event.currentTarget.checked)}
139
- className="mt-0.5 accent-ink cursor-pointer disabled:cursor-not-allowed"
151
+ className={`${CHECKBOX_CLASS} mt-0.5 accent-ink cursor-pointer disabled:cursor-not-allowed`}
140
152
  />
141
153
  <span className="text-[11px] text-ink/75 leading-relaxed">
142
154
  <span className="inline-flex items-center gap-1">
@@ -151,6 +163,18 @@ export function SkillDetailHeader({
151
163
 
152
164
  {validationError ? <p className="text-[11px] text-error leading-relaxed">{validationError}</p> : null}
153
165
 
166
+ {writeError ? (
167
+ <div className="flex items-start gap-1.5 rounded-lg border border-error/30 bg-error/5 px-2.5 py-2 text-[11px] text-error">
168
+ <AlertCircle size={12} className="mt-px flex-shrink-0" />
169
+ <span className="flex-1 break-words">{writeError}</span>
170
+ {onDismissWriteError ? (
171
+ <button type="button" onClick={onDismissWriteError} className="cursor-pointer text-error/60 hover:text-error" aria-label="Dismiss error">
172
+ ×
173
+ </button>
174
+ ) : null}
175
+ </div>
176
+ ) : null}
177
+
154
178
  <div className="flex items-center justify-between gap-2">
155
179
  {!isCreatingNew && skill && !readOnly ? (
156
180
  confirmingDelete ? (
@@ -188,19 +212,24 @@ export function SkillDetailHeader({
188
212
  <button
189
213
  type="button"
190
214
  onClick={onSave}
191
- disabled={Boolean(validationError) || (!dirty && !isCreatingNew)}
192
- className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-ink text-paper text-[11px] font-medium hover:bg-ink/90 disabled:opacity-40 transition-colors cursor-pointer"
215
+ disabled={saving || Boolean(validationError) || (!dirty && !isCreatingNew)}
216
+ className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-ink text-paper text-[11px] font-medium hover:bg-ink/90 disabled:opacity-40 transition-colors cursor-pointer disabled:cursor-not-allowed"
193
217
  >
194
- <Save size={12} />
195
- <span>{isCreatingNew ? 'Create skill' : 'Save changes'}</span>
218
+ {saving ? <Loader2 size={12} className="animate-spin" /> : <Save size={12} />}
219
+ <span>{saving ? 'Saving…' : isCreatingNew ? 'Create skill' : 'Save changes'}</span>
196
220
  </button>
197
221
  ) : null}
198
222
  </div>
199
223
 
200
- {!readOnly && !dirty && !isCreatingNew ? (
224
+ {saved ? (
225
+ <p className="flex items-center gap-1 text-[10px] text-ink/60">
226
+ <Check size={10} />
227
+ Saved
228
+ </p>
229
+ ) : !readOnly && !dirty && !isCreatingNew ? (
201
230
  <p className="flex items-center gap-1 text-[10px] text-ink/40">
202
231
  <Check size={10} />
203
- Saved — nothing to write
232
+ Nothing to write
204
233
  </p>
205
234
  ) : null}
206
235
  </div>
@@ -1,14 +1,15 @@
1
1
  import { useEffect, useMemo, useState } from 'preact/hooks';
2
2
  import { Info } from 'lucide-preact';
3
- import type { SkillItem } from '@/shared/types';
3
+ import type { SkillItem, WriteOutcome } from '@/shared/types';
4
+ import { useWriteFeedback } from '@/client/hooks/settings/write-feedback';
4
5
  import { SkillDetailHeader } from '@/client/components/settings/categories/skill-settings/DetailHeader';
5
6
  import { InstructionsEditor } from '@/client/components/settings/categories/skill-settings/InstructionsEditor';
6
7
 
7
8
  interface SkillDetailPaneProps {
8
9
  skill: SkillItem | null;
9
10
  isCreatingNew: boolean;
10
- onSave: (skillData: Partial<SkillItem>) => void;
11
- onDelete?: (id: string) => void;
11
+ onSave: (skillData: Partial<SkillItem>) => Promise<WriteOutcome>;
12
+ onDelete?: (id: string) => Promise<WriteOutcome>;
12
13
  onOpenCatalog?: () => void;
13
14
  onReload?: () => void;
14
15
  isReloading?: boolean;
@@ -51,6 +52,7 @@ export function SkillDetailPane({
51
52
  const [showLineNumbers, setShowLineNumbers] = useState(true);
52
53
  const [confirmingDelete, setConfirmingDelete] = useState(false);
53
54
  const [savedAt, setSavedAt] = useState(0);
55
+ const feedback = useWriteFeedback();
54
56
 
55
57
  const readOnly = !isCreatingNew && skill != null && skill.managed !== true;
56
58
  const locationLabel = location === 'project' ? 'Project / .omp/skills' : 'User / omp agent';
@@ -95,17 +97,31 @@ export function SkillDetailPane({
95
97
  return null;
96
98
  }, [name, description, readOnly]);
97
99
 
100
+ // The timestamp is set from the WRITE'S answer, not the click: a refused save
101
+ // (a duplicate name, a read-only file) used to print "Last saved <time>".
98
102
  const handleSave = () => {
99
- if (readOnly || validationError) return;
100
- onSave({
101
- name: name.trim(),
102
- description: description.trim(),
103
- location,
104
- locationLabel,
105
- instructions: draftBody(instructions),
106
- hidden,
103
+ if (readOnly || validationError || feedback.saving) return;
104
+ void feedback.run(async () => {
105
+ const outcome = await onSave({
106
+ name: name.trim(),
107
+ description: description.trim(),
108
+ location,
109
+ locationLabel,
110
+ instructions: draftBody(instructions),
111
+ hidden,
112
+ });
113
+ if (outcome.ok) setSavedAt(Date.now());
114
+ return outcome;
115
+ });
116
+ };
117
+
118
+ const handleDelete = () => {
119
+ if (!skill || !onDelete) return;
120
+ void feedback.run(async () => {
121
+ const outcome = await onDelete(skill.id);
122
+ if (!outcome.ok) setConfirmingDelete(false);
123
+ return outcome;
107
124
  });
108
- setSavedAt(Date.now());
109
125
  };
110
126
 
111
127
  return (
@@ -128,9 +144,13 @@ export function SkillDetailPane({
128
144
  onCancelDelete={() => setConfirmingDelete(false)}
129
145
  onConfirmDelete={() => {
130
146
  setConfirmingDelete(false);
131
- if (skill && onDelete) onDelete(skill.id);
147
+ handleDelete();
132
148
  }}
133
149
  onSave={handleSave}
150
+ saving={feedback.saving}
151
+ saved={feedback.saved}
152
+ writeError={feedback.error}
153
+ onDismissWriteError={feedback.dismissError}
134
154
  />
135
155
 
136
156
  {!readOnly ? (
@@ -204,7 +224,7 @@ export function SkillDetailPane({
204
224
  onToggleLineNumbers={() => setShowLineNumbers(!showLineNumbers)}
205
225
  />
206
226
 
207
- {savedAt > 0 && !dirty ? (
227
+ {savedAt > 0 && !dirty && !feedback.error ? (
208
228
  <p className="text-[10px] text-ink/40">
209
229
  Last saved {new Date(savedAt).toLocaleTimeString()} — omp sessions were told to reload their skills.
210
230
  </p>
@@ -23,6 +23,9 @@ interface SkillSidebarListProps {
23
23
  onSelectProject: (project: string) => void;
24
24
  /** Real workspace folders; defaults to the shared placeholder list. */
25
25
  projectOptions?: ProjectOption[];
26
+ /** Why the list could not be read, and how to try again. */
27
+ loadError?: string;
28
+ onRetry?: () => void;
26
29
  }
27
30
 
28
31
  /**
@@ -43,6 +46,8 @@ export function SkillSidebarList({
43
46
  selectedProject,
44
47
  onSelectProject,
45
48
  projectOptions,
49
+ loadError,
50
+ onRetry,
46
51
  }: SkillSidebarListProps) {
47
52
  const [collapsedGroups, setCollapsedGroups] = useState<Record<string, boolean>>({});
48
53
  const [query, setQuery] = useState('');
@@ -134,6 +139,22 @@ export function SkillSidebarList({
134
139
  </div>
135
140
 
136
141
  <div className="flex-1 scrollbar-overlay-container p-1.5 space-y-2">
142
+ {loadError ? (
143
+ <div className="mx-1 rounded-lg border border-error/30 bg-error/5 px-2.5 py-2 text-[11px] leading-snug text-error">
144
+ <div className="font-semibold">Could not read the skills</div>
145
+ <div className="mt-0.5 break-words text-error/80">{loadError}</div>
146
+ {onRetry ? (
147
+ <button
148
+ type="button"
149
+ onClick={onRetry}
150
+ className="mt-1.5 rounded border border-error/40 px-2 py-0.5 font-medium hover:bg-error/10 cursor-pointer"
151
+ >
152
+ Retry
153
+ </button>
154
+ ) : null}
155
+ </div>
156
+ ) : null}
157
+
137
158
  {isCreatingNew ? (
138
159
  <div className="px-2.5 py-1.5 rounded-lg bg-ink/10 text-ink font-medium text-xs">new-skill</div>
139
160
  ) : null}
@@ -22,7 +22,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test
22
22
  import { Window } from 'happy-dom';
23
23
  import { h, render } from 'preact';
24
24
  import { act } from 'preact/test-utils';
25
- import type { SkillItem } from '@/shared/types';
25
+ import type { SkillItem, WriteOutcome } from '@/shared/types';
26
26
  import {
27
27
  SKILL_FILTERS,
28
28
  filterCounts,
@@ -54,6 +54,15 @@ function mount(node: h.JSX.Element): HTMLElement {
54
54
  return container;
55
55
  }
56
56
 
57
+ /** A save the server accepts; the pane's badge is driven by this answer. */
58
+ const okSave = async (): Promise<WriteOutcome> => ({ ok: true });
59
+
60
+ /** Collect the drafts a pane sends, while answering like a healthy server. */
61
+ const okSaveTracking = (saved: Partial<SkillItem>[]) => async (draft: Partial<SkillItem>): Promise<WriteOutcome> => {
62
+ saved.push(draft);
63
+ return { ok: true };
64
+ };
65
+
57
66
  function skill(overrides: Partial<SkillItem> = {}): SkillItem {
58
67
  return {
59
68
  id: 'omp-user-alpha',
@@ -117,12 +126,12 @@ describe('filterSkills and filterCounts', () => {
117
126
  describe('SkillDetailPane', () => {
118
127
  test('an unchanged draft cannot be saved', () => {
119
128
  const el = mount(
120
- h(SkillDetailPane, { skill: skill(), isCreatingNew: false, onSave: () => {} }),
129
+ h(SkillDetailPane, { skill: skill(), isCreatingNew: false, onSave: okSave }),
121
130
  );
122
131
  const save = [...el.querySelectorAll('button')].find((button) => button.textContent?.includes('Save changes'));
123
132
  expect(save).toBeDefined();
124
133
  expect((save as HTMLButtonElement).disabled).toBe(true);
125
- expect(el.textContent).toContain('Saved — nothing to write');
134
+ expect(el.textContent).toContain('Nothing to write');
126
135
  });
127
136
 
128
137
  test('a draft missing its description reports that omp would not load it', () => {
@@ -130,7 +139,7 @@ describe('SkillDetailPane', () => {
130
139
  h(SkillDetailPane, {
131
140
  skill: skill({ description: '' }),
132
141
  isCreatingNew: false,
133
- onSave: () => {},
142
+ onSave: okSave,
134
143
  }),
135
144
  );
136
145
  expect(el.textContent).toContain('omp does not load a SKILL.md without one');
@@ -140,7 +149,7 @@ describe('SkillDetailPane', () => {
140
149
 
141
150
  test('a read-only skill offers no editor or save at all', () => {
142
151
  const el = mount(
143
- h(SkillDetailPane, { skill: skill({ managed: false, source: 'agents:user' }), isCreatingNew: false, onSave: () => {} }),
152
+ h(SkillDetailPane, { skill: skill({ managed: false, source: 'agents:user' }), isCreatingNew: false, onSave: okSave }),
144
153
  );
145
154
  expect(el.textContent).toContain('read-only');
146
155
  expect(el.textContent).not.toContain('Save changes');
@@ -153,7 +162,7 @@ describe('SkillDetailPane', () => {
153
162
  h(SkillDetailPane, {
154
163
  skill: skill({ instructions: '---\ndescription: First skill\n---\n\ndo the thing\n' }),
155
164
  isCreatingNew: false,
156
- onSave: (draft) => saved.push(draft),
165
+ onSave: okSaveTracking(saved),
157
166
  }),
158
167
  );
159
168
  // The pane has two textareas: the description and the SKILL.md body.