@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
@@ -13,6 +13,9 @@ interface AgentSidebarListProps {
13
13
  onChangeProject: (project: string) => void;
14
14
  /** Real workspace folders; defaults to the shared placeholder list. */
15
15
  projectOptions?: ProjectOption[];
16
+ /** Why the list could not be read, and how to try again. */
17
+ loadError?: string;
18
+ onRetry?: () => void;
16
19
  }
17
20
 
18
21
  export const AgentSidebarList: FunctionComponent<AgentSidebarListProps> = ({
@@ -23,6 +26,8 @@ export const AgentSidebarList: FunctionComponent<AgentSidebarListProps> = ({
23
26
  selectedProject,
24
27
  onChangeProject,
25
28
  projectOptions,
29
+ loadError,
30
+ onRetry,
26
31
  }) => (
27
32
  <SettingsSidebarList
28
33
  items={agents}
@@ -30,13 +35,15 @@ export const AgentSidebarList: FunctionComponent<AgentSidebarListProps> = ({
30
35
  onSelect={onSelectAgent}
31
36
  onAddNew={onAddNewAgent}
32
37
  addTitle="Create new agent"
33
- builtInLabel="Built-in Agents"
34
- customLabel="Custom Agents"
38
+ builtInLabel="Project scope (read-only)"
39
+ customLabel="Your agent files"
35
40
  formatName={(name) => name}
36
41
  nameClassName="font-semibold text-xs text-ink truncate"
37
42
  selectedProject={selectedProject}
38
43
  onChangeProject={onChangeProject}
39
44
  {...(projectOptions ? { projectOptions } : {})}
45
+ {...(loadError ? { loadError } : {})}
46
+ {...(onRetry ? { onRetry } : {})}
40
47
  renderIcon={(isBuiltIn) => (
41
48
  <div className="relative">
42
49
  <Bot className={`w-3.5 h-3.5 ${isBuiltIn ? 'text-ink/80' : 'text-ink/60'} flex-shrink-0`} />
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The thinking levels an omp agent definition can pin.
8
+ *
9
+ * Mirrors `CLI_THINKING_LEVELS` in `@oh-my-pi/pi-tui` 18.16.0 — the selectors
10
+ * omp itself accepts and writes. A free-text field here invited `"medium "` or
11
+ * `"thinking"`, both of which `parseConfiguredThinkingLevel` drops, so the agent
12
+ * silently ran at the session's level with a value on screen saying otherwise.
13
+ */
14
+
15
+ import type { AgentItem } from '@/shared/types';
16
+
17
+ /** `off` and the effort ladder, then `auto`. The first entry is "inherit". */
18
+ export const AGENT_THINKING_LEVELS = [
19
+ 'off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'auto',
20
+ ] as const;
21
+
22
+ export type AgentThinkingLevel = (typeof AGENT_THINKING_LEVELS)[number];
23
+
24
+ /** What a row's `null` means: the agent does not pin a level. */
25
+ export const AGENT_THINKING_DEFAULT = '';
26
+
27
+ /** A definition the pane can edit, or the empty template a create starts from. */
28
+ export function emptyAgentTemplate(): AgentItem {
29
+ return {
30
+ id: 'new-agent',
31
+ name: 'new-agent',
32
+ description: '',
33
+ scope: 'user',
34
+ thinkingLevel: AGENT_THINKING_DEFAULT,
35
+ systemPrompt: '',
36
+ isBuiltIn: false,
37
+ };
38
+ }
@@ -17,6 +17,7 @@
17
17
  * read once would never arrive. The event fires only when a value moved.
18
18
  */
19
19
 
20
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
20
21
  import { readKabmoSetting, writeKabmoSettings } from '@/shared/lib/settings/client';
21
22
  import type { SettingsState } from '@/shared/types';
22
23
  import {
@@ -52,7 +53,7 @@ function Toggle({
52
53
  type="checkbox"
53
54
  checked={checked}
54
55
  onChange={(event) => onChange((event.target as HTMLInputElement).checked)}
55
- className="mt-0.5 shrink-0 accent-ink"
56
+ className={`${CHECKBOX_CLASS} mt-0.5 shrink-0 accent-ink`}
56
57
  />
57
58
  </label>
58
59
  );
@@ -16,6 +16,7 @@
16
16
  * screen. The event fires only when a value actually moved.
17
17
  */
18
18
 
19
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
19
20
  import { readKabmoSetting, writeKabmoSettings } from '@/shared/lib/settings/client';
20
21
  import type { SettingsState } from '@/shared/types';
21
22
  import {
@@ -52,7 +53,7 @@ function Toggle({
52
53
  checked={checked}
53
54
  onChange={(event) => onChange(event.currentTarget.checked)}
54
55
  aria-label={label}
55
- className="mt-0.5 accent-ink flex-shrink-0"
56
+ className={`${CHECKBOX_CLASS} mt-0.5 accent-ink flex-shrink-0`}
56
57
  />
57
58
  </label>
58
59
  );
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Settings → Appearance → Layout → Icons.
8
+ *
9
+ * The card has to answer the question the setting actually raises — "what
10
+ * changes when I pick full colour?" — and the answer now covers three families,
11
+ * so both miniatures draw the same SAMPLE of all three: two functional glyphs
12
+ * (one signal, one neutral), one provider mark and one file-type mark. A preview
13
+ * that showed only logos would under-sell the setting; one that showed only
14
+ * glyphs would hide the part users notice most.
15
+ *
16
+ * The previews are FIXED per card rather than rendered through the live
17
+ * components: those paint from the document attribute, so both cards would show
18
+ * the user's current choice and neither would preview its own. The colour values
19
+ * come from the SAME tables and formula the stylesheet uses (`ICON_TINT_TOKENS`,
20
+ * `iconHueColor`, `BRAND_COLORS`, `FILE_BRAND_COLORS`), so a preview cannot
21
+ * promise a look the shell does not ship.
22
+ */
23
+
24
+ import { Check, Trash2, Sparkles } from 'lucide-preact';
25
+ import type { ComponentType } from 'preact/compat';
26
+ import type { SettingsState } from '@/shared/types';
27
+ import {
28
+ ICON_STYLES,
29
+ ICON_STYLE_COPY,
30
+ resolveIconStyle,
31
+ type IconStyle,
32
+ } from '@/shared/lib/theme/icon-style';
33
+ import { BRAND_COLORS } from '@/shared/lib/models/provider/brand-color';
34
+ import { FILE_BRAND_COLORS } from '@/shared/lib/icons/file-brand-color';
35
+ import { ICON_TINT_TOKENS, iconHue, iconHueColor, iconTintRole } from '@/shared/lib/icons/tint';
36
+
37
+ interface IconStyleSectionProps {
38
+ settings: SettingsState;
39
+ onUpdate: (updater: Partial<SettingsState> | ((previous: SettingsState) => SettingsState)) => void;
40
+ }
41
+
42
+ /** One functional glyph, painted the way the chosen mode would paint it. */
43
+ function GlyphSample({ name, Icon, colored }: { name: string; Icon: typeof Check; colored: boolean }) {
44
+ const role = iconTintRole(name);
45
+ // The role wins over the hue, exactly as the stylesheet orders its rules.
46
+ // Same formula as the stylesheet's light paint, through the same helper: the
47
+ // sample reads the hue table and the ONE saturation/lightness pair.
48
+ const color = !colored
49
+ ? undefined
50
+ : role
51
+ ? ICON_TINT_TOKENS[role]
52
+ : iconHueColor(iconHue(name), 'light');
53
+ return <Icon size={13} strokeWidth={2} style={color ? { color } : undefined} aria-hidden="true" />;
54
+ }
55
+
56
+ /** A brand mark as a dot on a plate, in the mode's paint. */
57
+ function BrandSample({ name, base, colored }: { name: string; base: string; colored: boolean }) {
58
+ const color = colored ? base : undefined;
59
+ return (
60
+ <span
61
+ className="flex h-5 w-5 items-center justify-center rounded-[5px] border border-ink/10"
62
+ style={color ? { backgroundColor: `${color}22`, color } : undefined}
63
+ title={name}
64
+ aria-hidden="true"
65
+ >
66
+ <span
67
+ className={`block h-2 w-2 rounded-full ${colored ? '' : 'bg-ink/60'}`}
68
+ style={color ? { backgroundColor: color } : undefined}
69
+ />
70
+ </span>
71
+ );
72
+ }
73
+
74
+ function Miniature({ colored }: { colored: boolean }) {
75
+ return (
76
+ <span className="flex h-full items-center gap-1.5 rounded-md border border-ink/10 bg-canvas/60 px-2">
77
+ <GlyphSample name="Trash2" Icon={Trash2} colored={colored} />
78
+ <GlyphSample name="Check" Icon={Check} colored={colored} />
79
+ <GlyphSample name="Sparkles" Icon={Sparkles} colored={colored} />
80
+ <span className="mx-0.5 h-4 w-px bg-ink/10" />
81
+ <BrandSample name="claude" base={BRAND_COLORS.claude.light} colored={colored} />
82
+ <BrandSample name="Typescript" base={FILE_BRAND_COLORS.Typescript.light} colored={colored} />
83
+ </span>
84
+ );
85
+ }
86
+
87
+ const MINIATURES: Record<IconStyle, ComponentType> = {
88
+ monochrome: () => <Miniature colored={false} />,
89
+ color: () => <Miniature colored />,
90
+ };
91
+
92
+ export function IconStyleSection({ settings, onUpdate }: IconStyleSectionProps) {
93
+ const selected = resolveIconStyle(settings.iconStyle);
94
+
95
+ return (
96
+ <section className="space-y-3">
97
+ <div>
98
+ <h4 className="text-xs font-semibold text-ink">Icons</h4>
99
+ <p className="mt-0.5 text-[11px] text-ink/50">
100
+ Every icon: toolbar and panel glyphs, provider logos and file-type marks. Full colour
101
+ gives each glyph its own hue and keeps the palette’s red, green, amber and blue for
102
+ signals; a colour that would disappear on the active theme falls back to the ink. A
103
+ control that sets its own colour keeps it.
104
+ </p>
105
+ </div>
106
+
107
+ <div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2" role="group" aria-label="Icon style">
108
+ {ICON_STYLES.map((style) => {
109
+ const copy = ICON_STYLE_COPY[style];
110
+ const isSelected = style === selected;
111
+ const MiniatureView = MINIATURES[style];
112
+ return (
113
+ <button
114
+ key={style}
115
+ type="button"
116
+ onClick={() => onUpdate({ iconStyle: style })}
117
+ aria-pressed={isSelected}
118
+ aria-label={`${copy.label} icons — ${copy.description}`}
119
+ className={`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${
120
+ isSelected
121
+ ? 'border-ink/40 bg-ink/5'
122
+ : 'border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5'
123
+ }`}
124
+ >
125
+ <span className="block h-[42px]">
126
+ <MiniatureView />
127
+ </span>
128
+ <span className="flex items-center gap-1.5">
129
+ <span className="text-xs font-semibold text-ink">{copy.label}</span>
130
+ <span className="font-mono text-[10px] text-ink/40">{copy.caption}</span>
131
+ {isSelected && (
132
+ <span className="ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[9px] font-semibold text-paper">
133
+ active
134
+ </span>
135
+ )}
136
+ </span>
137
+ <span className="text-[11px] leading-relaxed text-ink/60">{copy.description}</span>
138
+ </button>
139
+ );
140
+ })}
141
+ </div>
142
+ </section>
143
+ );
144
+ }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * "Surfaces" — the two material cards, and the reason the frost is missing when
8
+ * it is.
9
+ *
10
+ * The notice is the point of this file. `glass.css` silently hands back opaque
11
+ * panels on an engine without `backdrop-filter` and under
12
+ * `prefers-reduced-transparency`, and a CSS fallback cannot say why — so a
13
+ * window whose setting reads `glass` and whose material is `classic` is
14
+ * indistinguishable from a broken setting on that device (measured: Chromium
15
+ * supports both, so the notice correctly renders nothing there; the copy paths
16
+ * are what is pinned here).
17
+ */
18
+
19
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
20
+ import { Window } from 'happy-dom';
21
+ import { h, render } from 'preact';
22
+ import { act } from 'preact/test-utils';
23
+
24
+ import { SurfaceStyleSection } from '@/client/components/settings/categories/appearance-settings/SurfaceStyleSection';
25
+ import { GLASS_LIMIT_COPY } from '@/shared/lib/theme/glass-support';
26
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
27
+ import type { SettingsState } from '@/shared/types';
28
+
29
+ let container: HTMLElement;
30
+ let backdropFilter = true;
31
+ let reducedTransparency = false;
32
+
33
+ /**
34
+ * `CSS` is the one browser global the hook reads that `installDomGlobals` does not
35
+ * install (it lists constructors, and `CSS.supports` is a namespace object), so
36
+ * this file states it explicitly and removes it again.
37
+ */
38
+ const realCss = globalThis.CSS;
39
+
40
+ beforeAll(() => {
41
+ installDomGlobals(new Window({ url: 'http://localhost' }));
42
+ // The probe asks the platform; here the platform is a stub, so each case can
43
+ // state what an engine/OS would answer.
44
+ globalThis.CSS = {
45
+ supports: (property: string) =>
46
+ property === 'backdrop-filter' || property === '-webkit-backdrop-filter'
47
+ ? backdropFilter
48
+ : window.CSS.supports(property),
49
+ } as unknown as typeof CSS;
50
+ window.matchMedia = ((query: string) => ({
51
+ matches: query.includes('prefers-reduced-transparency') ? reducedTransparency : false,
52
+ media: query,
53
+ onchange: null,
54
+ addEventListener: () => {},
55
+ removeEventListener: () => {},
56
+ addListener: () => {},
57
+ removeListener: () => {},
58
+ dispatchEvent: () => false,
59
+ })) as unknown as typeof window.matchMedia;
60
+ });
61
+
62
+ afterEach(() => {
63
+ if (container) render(null, container);
64
+ container?.remove();
65
+ backdropFilter = true;
66
+ reducedTransparency = false;
67
+ });
68
+
69
+ afterAll(() => {
70
+ if (realCss === undefined) delete (globalThis as { CSS?: unknown }).CSS;
71
+ else globalThis.CSS = realCss;
72
+ restoreDomGlobals();
73
+ });
74
+
75
+ function mount(surfaceStyle: SettingsState['surfaceStyle']): HTMLElement {
76
+ container = document.body.appendChild(document.createElement('div'));
77
+ act(() =>
78
+ render(
79
+ h(SurfaceStyleSection, {
80
+ settings: { surfaceStyle } as SettingsState,
81
+ onUpdate: () => {},
82
+ }),
83
+ container,
84
+ ),
85
+ );
86
+ return container;
87
+ }
88
+
89
+ describe('surface style section', () => {
90
+ test('a supported engine on glass shows no notice', () => {
91
+ const el = mount('glass');
92
+ expect(el.querySelector('[aria-live="polite"]')).toBeNull();
93
+ });
94
+
95
+ test('an engine without backdrop blur says so instead of pretending', () => {
96
+ backdropFilter = false;
97
+ const el = mount('glass');
98
+ const notice = el.querySelector('[aria-live="polite"]');
99
+ expect(notice?.textContent).toContain(GLASS_LIMIT_COPY['no-backdrop-filter']);
100
+ });
101
+
102
+ test('the system asking for less transparency is named, and glass is still the choice', () => {
103
+ reducedTransparency = true;
104
+ const el = mount('glass');
105
+ expect(el.querySelector('[aria-live="polite"]')?.textContent).toContain(
106
+ GLASS_LIMIT_COPY['reduced-transparency'],
107
+ );
108
+ // The cards still work: the limit is a REPORT, not a disabled control — the
109
+ // stored choice is the user's, and it takes effect again the moment the OS
110
+ // setting changes.
111
+ expect(el.querySelector('[aria-pressed="true"]')?.textContent).toContain('Glass');
112
+ });
113
+
114
+ test('classic never carries the notice, because it has nothing to explain', () => {
115
+ backdropFilter = false;
116
+ reducedTransparency = true;
117
+ const el = mount('classic');
118
+ expect(el.querySelector('[aria-live="polite"]')).toBeNull();
119
+ });
120
+ });
@@ -0,0 +1,180 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * Settings → Appearance → Surfaces.
8
+ *
9
+ * Two cards, each drawn as a MINIATURE of the material rather than an icon: the
10
+ * difference between an opaque panel and a frosted one is the only thing the
11
+ * setting decides, so the card has to show that difference where it happens —
12
+ * a chrome bar over a tinted ground, with the same rows inside.
13
+ *
14
+ * The miniature is built from the SAME tokens the product uses (`--glass-*` and
15
+ * the palette's `text-ink/*`), never from a hex, so a card cannot promise a
16
+ * look the shell does not ship.
17
+ *
18
+ * The cards are `aria-pressed` buttons rather than radios: there is no submit,
19
+ * the choice applies on click, and `applySettingsSideEffects` is what writes the
20
+ * document attribute — this file never touches the DOM itself, so the live
21
+ * apply and the persisted copy cannot disagree.
22
+ */
23
+
24
+ import type { ComponentType } from 'preact/compat';
25
+ import type { SettingsState } from '@/shared/types';
26
+ import {
27
+ SURFACE_STYLES,
28
+ SURFACE_STYLE_COPY,
29
+ resolveSurfaceStyle,
30
+ type SurfaceStyle,
31
+ } from '@/shared/lib/theme/surface-style';
32
+ import { GLASS_LIMIT_COPY } from '@/shared/lib/theme/glass-support';
33
+ import { useGlassLimits } from '@/client/hooks/ui/glass-support';
34
+
35
+ interface SurfaceStyleSectionProps {
36
+ settings: SettingsState;
37
+ onUpdate: (updater: Partial<SettingsState> | ((previous: SettingsState) => SettingsState)) => void;
38
+ }
39
+
40
+ /** The rows both miniatures share, so the ONLY difference is the material. */
41
+ function MiniRows() {
42
+ return (
43
+ <span className="flex h-full flex-col gap-1 p-1">
44
+ <span className="flex items-center gap-1">
45
+ <span className="h-[3px] w-[38%] rounded-full bg-ink/40" />
46
+ <span className="ml-auto h-[6px] w-[10%] rounded-[2px] border border-ink/20" />
47
+ </span>
48
+ <span className="h-[2px] w-full rounded-full bg-ink/15" />
49
+ <span className="flex items-center gap-1">
50
+ <span className="h-[3px] w-[52%] rounded-full bg-ink/30" />
51
+ <span className="h-[3px] w-[18%] rounded-full bg-ink/15" />
52
+ </span>
53
+ <span className="flex items-center gap-1">
54
+ <span className="h-[3px] w-[44%] rounded-full bg-ink/30" />
55
+ <span className="h-[3px] w-[22%] rounded-full bg-ink/15" />
56
+ </span>
57
+ </span>
58
+ );
59
+ }
60
+
61
+ /** Opaque panels on the palette canvas. */
62
+ function ClassicMiniature() {
63
+ return (
64
+ <span className="block h-full rounded-md border border-ink/15 bg-paper" aria-hidden="true">
65
+ <span className="block h-[13px] rounded-t-[5px] border-b border-ink/10 bg-paper">
66
+ <span className="mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/35" />
67
+ </span>
68
+ <MiniRows />
69
+ </span>
70
+ );
71
+ }
72
+
73
+ /**
74
+ * One frosted plane over a tinted glow.
75
+ *
76
+ * The glow is drawn INSIDE the card's box on purpose: a full-screen app has no
77
+ * outside for the aura to bleed into, which is why the real plane keeps its
78
+ * blobs under its own edge instead of around it.
79
+ */
80
+ function GlassMiniature() {
81
+ return (
82
+ <span className="relative block h-full overflow-hidden rounded-md border border-ink/15 bg-canvas" aria-hidden="true">
83
+ <span className="pointer-events-none absolute inset-0">
84
+ <span className="absolute -left-2 top-2 h-[70%] w-[55%] rounded-full bg-info/40 blur-md" />
85
+ <span className="absolute -right-2 -top-2 h-[60%] w-[50%] rounded-full bg-meta/35 blur-md" />
86
+ <span className="absolute -bottom-2 right-3 h-[45%] w-[45%] rounded-full bg-success/30 blur-md" />
87
+ </span>
88
+ <span className="relative block h-[13px] border-b border-ink/10 bg-paper/40">
89
+ <span className="mx-1 mt-[4px] block h-[3px] w-[40%] rounded-full bg-ink/40" />
90
+ </span>
91
+ <span className="relative block h-[calc(100%-13px)] bg-paper/50">
92
+ <MiniRows />
93
+ </span>
94
+ </span>
95
+ );
96
+ }
97
+
98
+ const MINIATURES: Record<SurfaceStyle, ComponentType> = {
99
+ classic: ClassicMiniature,
100
+ glass: GlassMiniature,
101
+ };
102
+
103
+ /**
104
+ * Why the frost is missing, when it is.
105
+ *
106
+ * `glass.css` falls back to opaque panels on an engine without `backdrop-filter`
107
+ * and under `prefers-reduced-transparency`, and a CSS fallback cannot say why —
108
+ * so a window that reports `glass` and looks `classic` is indistinguishable from
109
+ * a broken setting. This is the one surface that can name it, in the place the
110
+ * choice was made, and it names every reason that applies.
111
+ */
112
+ function GlassLimits() {
113
+ const limits = useGlassLimits();
114
+ if (limits.length === 0) return null;
115
+ return (
116
+ <ul className="space-y-1 rounded-lg border border-ink/15 bg-ink/[0.03] p-2.5" aria-live="polite">
117
+ {limits.map((limit) => (
118
+ <li key={limit} className="flex gap-1.5 text-[11px] leading-relaxed text-ink/60">
119
+ <span aria-hidden="true" className="mt-[5px] h-1 w-1 shrink-0 rounded-full bg-ink/40" />
120
+ <span>{GLASS_LIMIT_COPY[limit]}</span>
121
+ </li>
122
+ ))}
123
+ </ul>
124
+ );
125
+ }
126
+
127
+ export function SurfaceStyleSection({ settings, onUpdate }: SurfaceStyleSectionProps) {
128
+ const selected = resolveSurfaceStyle(settings.surfaceStyle);
129
+
130
+ return (
131
+ <section className="space-y-3">
132
+ <div>
133
+ <h4 className="text-xs font-semibold text-ink">Surfaces</h4>
134
+ <p className="mt-0.5 text-[11px] text-ink/50">
135
+ What the windows are made of. Both styles draw the same panels, rows and dialogs;
136
+ the frost is one blur pass per window, and it follows the palette — there is no
137
+ separate glass colour to tune.
138
+ </p>
139
+ </div>
140
+
141
+ <div className="grid grid-cols-1 gap-2.5 sm:grid-cols-2" role="group" aria-label="Surface style">
142
+ {SURFACE_STYLES.map((style) => {
143
+ const copy = SURFACE_STYLE_COPY[style];
144
+ const isSelected = style === selected;
145
+ const Miniature = MINIATURES[style];
146
+ return (
147
+ <button
148
+ key={style}
149
+ type="button"
150
+ onClick={() => onUpdate({ surfaceStyle: style })}
151
+ aria-pressed={isSelected}
152
+ aria-label={`${copy.label} surfaces — ${copy.description}`}
153
+ className={`flex flex-col gap-2 rounded-xl border p-2.5 text-left transition-colors cursor-pointer ${
154
+ isSelected
155
+ ? 'border-ink/40 bg-ink/5'
156
+ : 'border-ink/15 bg-paper hover:border-ink/30 hover:bg-ink/5'
157
+ }`}
158
+ >
159
+ <span className="block h-[78px]">
160
+ <Miniature />
161
+ </span>
162
+ <span className="flex items-center gap-1.5">
163
+ <span className="text-xs font-semibold text-ink">{copy.label}</span>
164
+ <span className="font-mono text-[10px] text-ink/40">{copy.caption}</span>
165
+ {isSelected && (
166
+ <span className="ml-auto rounded-full bg-ink px-1.5 py-[1px] text-[9px] font-semibold text-paper">
167
+ active
168
+ </span>
169
+ )}
170
+ </span>
171
+ <span className="text-[11px] leading-relaxed text-ink/60">{copy.description}</span>
172
+ </button>
173
+ );
174
+ })}
175
+ </div>
176
+
177
+ {selected === 'glass' && <GlassLimits />}
178
+ </section>
179
+ );
180
+ }
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from 'preact/hooks';
1
+ import { useEffect, useRef, useState } from 'preact/hooks';
2
2
  import type { FunctionComponent } from 'preact/compat';
3
3
  import { Check, Code, Copy, Info, RotateCcw, Save, ShieldCheck } from 'lucide-preact';
4
4
  import type { InstructionFileKind, InstructionSaveResult } from '@/shared/types';
@@ -49,6 +49,9 @@ export const BehaviorEditor: FunctionComponent<BehaviorEditorProps> = ({
49
49
  const [saved, setSaved] = useState(false);
50
50
  const [error, setError] = useState<string | null>(null);
51
51
  const [note, setNote] = useState<string | null>(null);
52
+ // The gutter follows the textarea's own scroll. Without it the numbers stay
53
+ // at line 1 while the body scrolls away, which reads as the wrong file.
54
+ const gutterRef = useRef<HTMLDivElement>(null);
52
55
 
53
56
  useEffect(() => {
54
57
  setEditorValue(content);
@@ -85,12 +88,21 @@ export const BehaviorEditor: FunctionComponent<BehaviorEditorProps> = ({
85
88
  };
86
89
 
87
90
  const handleCopy = () => {
88
- navigator.clipboard.writeText(editorValue);
89
- setCopied(true);
90
- setTimeout(() => setCopied(false), 2000);
91
+ navigator.clipboard.writeText(editorValue)
92
+ .then(() => {
93
+ setCopied(true);
94
+ setTimeout(() => setCopied(false), 2000);
95
+ })
96
+ .catch((err) => {
97
+ // A refused clipboard is REPORTED: the button used to flip to "Copied"
98
+ // whether or not anything reached it.
99
+ setError(`The clipboard refused the copy: ${err instanceof Error ? err.message : String(err)}`);
100
+ });
91
101
  };
92
102
 
93
- const handleSave = () => runPersist(() => onSave(editorValue));
103
+ const handleSave = () => {
104
+ void runPersist(() => onSave(editorValue));
105
+ };
94
106
 
95
107
  const handleReset = async () => {
96
108
  if (!onReset) return;
@@ -210,7 +222,11 @@ export const BehaviorEditor: FunctionComponent<BehaviorEditorProps> = ({
210
222
  <div className="flex-1 min-h-0 mt-3 rounded-lg border border-ink/20 hover:border-ink/40 bg-ink/5 overflow-hidden flex flex-col font-mono text-xs focus-within:border-ink transition-colors">
211
223
  <div className="flex-1 flex overflow-hidden">
212
224
  {/* Line Numbers */}
213
- <div className="w-10 py-3 pr-2 select-none text-right font-mono text-xs text-ink/30 border-r border-ink/10 bg-ink/[0.02] overflow-hidden leading-relaxed">
225
+ <div
226
+ ref={gutterRef}
227
+ aria-hidden="true"
228
+ className="w-10 py-3 pr-2 select-none text-right font-mono text-xs text-ink/30 border-r border-ink/10 bg-ink/[0.02] overflow-hidden leading-relaxed"
229
+ >
214
230
  {Array.from({ length: Math.max(lineCount, 12) }).map((_, i) => (
215
231
  <div key={i}>{i + 1}</div>
216
232
  ))}
@@ -219,8 +235,12 @@ export const BehaviorEditor: FunctionComponent<BehaviorEditorProps> = ({
219
235
  {/* Text Area */}
220
236
  <textarea
221
237
  value={editorValue}
222
- onChange={(e) => setEditorValue(e.currentTarget.value)}
238
+ onInput={(e) => setEditorValue(e.currentTarget.value)}
239
+ onScroll={(e) => {
240
+ if (gutterRef.current) gutterRef.current.scrollTop = e.currentTarget.scrollTop;
241
+ }}
223
242
  spellcheck={false}
243
+ aria-label={`${copy.title} content`}
224
244
  className="flex-1 p-3 bg-transparent text-ink font-mono text-xs leading-relaxed resize-none focus:outline-none overflow-y-auto"
225
245
  placeholder={copy.placeholder}
226
246
  />
@@ -6,12 +6,12 @@
6
6
  /**
7
7
  * How a tool call is drawn in the transcript.
8
8
  *
9
- * Four cards, one per renderer, in the order `TOOL_RENDER_MODES` declares:
9
+ * One card per renderer, in the order `TOOL_RENDER_MODES` declares:
10
10
  * fullest first. Each card carries a miniature of its own renderer, because the
11
- * difference between the modes is SHAPE — a label alone cannot show a rail or a
12
- * status line. The miniature is drawn from the same primitives the transcript
13
- * uses (a hairline, a dot, a mono line), so the preview is honest about what
14
- * the reader will get.
11
+ * difference between the modes is SHAPE — a label alone cannot show a rail, a
12
+ * status line or a terminal frame. The miniature is drawn from the same
13
+ * primitives the transcript uses (a hairline, a dot, a mono line), so the
14
+ * preview is honest about what the reader will get.
15
15
  *
16
16
  * The copy lives in `shared/lib/chat/timeline/tool-render-mode.ts`, so this
17
17
  * file states neither the names nor the descriptions.
@@ -70,6 +70,24 @@ function ModePreview({ mode }: { mode: ToolRenderMode }) {
70
70
  </div>
71
71
  );
72
72
  }
73
+ if (mode === 'tui') {
74
+ // A line of coloured terminal text, not a box: glyph in the state tone, the
75
+ // name in the accent, the subject in the meta hue, then the dim facts. The
76
+ // miniature mirrors the real row, so "TUI" cannot be mistaken for a card
77
+ // with a different paint job.
78
+ return (
79
+ <div aria-hidden className="space-y-1 px-1 py-1 font-mono">
80
+ {[0, 1].map((row) => (
81
+ <div key={row} className="flex items-baseline gap-1">
82
+ <span className="text-[6px] text-success">✔</span>
83
+ <span className="h-1 w-3 rounded-full bg-info/70" />
84
+ <span className="h-1 w-6 rounded-full bg-meta/70" />
85
+ <span className="ml-auto h-1 w-2 rounded-full bg-ink/25" />
86
+ </div>
87
+ ))}
88
+ </div>
89
+ );
90
+ }
73
91
  return (
74
92
  <div aria-hidden className="space-y-1.5 px-1 py-1">
75
93
  <div className="h-1 w-20 rounded-full bg-ink/25" />