@kabmo-labs/kabmo 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (438) hide show
  1. package/README.md +10 -7
  2. package/dist/client/index.html +1 -1
  3. package/dist/client/index.js +523 -441
  4. package/dist/client/static/js/{index-rerjq5th.js → index-fcee4c13.js} +828 -818
  5. package/dist/client/static/js/index-sxdw908m.css +1 -0
  6. package/marketplace/plugins/command-runner/package.json +3 -2
  7. package/marketplace/plugins/git-forge/package.json +3 -2
  8. package/marketplace/plugins/session-info/package.json +3 -2
  9. package/marketplace/plugins/stats/package.json +3 -2
  10. package/package.json +3 -1
  11. package/src/client/components/auth/login-screen/index.tsx +2 -1
  12. package/src/client/components/common/ComposerPicker.tsx +1 -1
  13. package/src/client/components/common/FolderPicker.tsx +2 -2
  14. package/src/client/components/common/MarkdownRenderer.tsx +136 -89
  15. package/src/client/components/common/Modal.tsx +2 -2
  16. package/src/client/components/common/PWAInstallButton.tsx +2 -2
  17. package/src/client/components/common/ViewportSelector.tsx +1 -1
  18. package/src/client/components/common/anchored-menu/index.test.tsx +141 -0
  19. package/src/client/components/common/anchored-menu/index.tsx +147 -0
  20. package/src/client/components/common/batch-selection/SelectionCheckbox.tsx +2 -1
  21. package/src/client/components/common/brand-wordmark/index.test.tsx +13 -2
  22. package/src/client/components/common/brand-wordmark/index.tsx +13 -2
  23. package/src/client/components/common/checkbox/style.test.ts +139 -0
  24. package/src/client/components/common/checkbox/style.ts +51 -0
  25. package/src/client/components/common/context-usage-button/index.tsx +2 -2
  26. package/src/client/components/common/file-icon/index.tsx +23 -9
  27. package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
  28. package/src/client/components/common/markdown-review/ReviewPopover.tsx +144 -0
  29. package/src/client/components/common/markdown-review/ReviewSummary.tsx +108 -0
  30. package/src/client/components/common/markdown-review/index.tsx +129 -0
  31. package/src/client/components/common/panel-mark/index.tsx +97 -0
  32. package/src/client/components/common/provider-icon/glyphs.test.ts +1 -1
  33. package/src/client/components/common/provider-icon/index.test.ts +14 -0
  34. package/src/client/components/common/provider-icon/index.tsx +4 -0
  35. package/src/client/components/common/provider-icon/resolve.test.ts +8 -7
  36. package/src/client/components/common/provider-icon/resolve.ts +16 -3
  37. package/src/client/components/common/server-control/Panel.tsx +33 -23
  38. package/src/client/components/common/server-control/index.test.tsx +11 -5
  39. package/src/client/components/common/server-control/index.tsx +10 -8
  40. package/src/client/components/common/session-actions-menu/index.tsx +1 -1
  41. package/src/client/components/common/toolbar-row/index.tsx +1 -1
  42. package/src/client/components/layout/ActivityBar.tsx +22 -3
  43. package/src/client/components/layout/LeftDock.tsx +9 -2
  44. package/src/client/components/layout/PanelVisibilityMenu.tsx +1 -1
  45. package/src/client/components/layout/WindowAura.tsx +27 -0
  46. package/src/client/components/layout/desktop-layout/LeftColumn.tsx +1 -1
  47. package/src/client/components/layout/desktop-layout/TopNavbar.tsx +2 -2
  48. package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +11 -2
  49. package/src/client/components/layout/desktop-layout/index.tsx +3 -1
  50. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +44 -23
  51. package/src/client/components/layout/session-sidebar/CategoryHeader.worktree.test.tsx +36 -17
  52. package/src/client/components/layout/session-sidebar/CategoryItem.tsx +8 -7
  53. package/src/client/components/layout/session-sidebar/Header.tsx +1 -1
  54. package/src/client/components/layout/session-sidebar/OverflowMenu.tsx +1 -1
  55. package/src/client/components/layout/session-sidebar/Toolbar.tsx +1 -1
  56. package/src/client/components/layout/session-sidebar/about-modal/NotesDialog.tsx +94 -0
  57. package/src/client/components/layout/session-sidebar/about-modal/VersionLine.test.tsx +68 -0
  58. package/src/client/components/layout/session-sidebar/about-modal/VersionLine.tsx +36 -0
  59. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +57 -34
  60. package/src/client/components/layout/session-sidebar/modern/ActionRow.tsx +1 -1
  61. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +40 -14
  62. package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +7 -6
  63. package/src/client/components/layout/session-sidebar/modern/workspace-header.test.tsx +1 -1
  64. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
  65. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +2 -1
  66. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +2 -2
  67. package/src/client/components/layout/update-popup/ReleaseNotes.tsx +8 -3
  68. package/src/client/components/layout/update-popup/index.tsx +5 -1
  69. package/src/client/components/mobile/LayoutWrapper.tsx +3 -1
  70. package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
  71. package/src/client/components/mobile/mobile-right-sidebar/FullEditor.tsx +13 -15
  72. package/src/client/components/mobile/mobile-right-sidebar/Header.tsx +23 -1
  73. package/src/client/components/mobile/mobile-right-sidebar/MissingFileBanner.tsx +30 -0
  74. package/src/client/components/mobile/mobile-right-sidebar/PreviewScroller.tsx +18 -2
  75. package/src/client/components/mobile/mobile-session-sidebar/Header.tsx +1 -1
  76. package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +22 -67
  77. package/src/client/components/mobile/mobile-session-sidebar/ItemMenu.tsx +110 -0
  78. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
  79. package/src/client/components/mobile/panel-chips.tsx +10 -2
  80. package/src/client/components/settings/Modal.tsx +4 -4
  81. package/src/client/components/settings/ProjectSelectorDropdown.tsx +2 -2
  82. package/src/client/components/settings/SettingsSidebarList.tsx +20 -0
  83. package/src/client/components/settings/apply-side-effects.test.ts +30 -0
  84. package/src/client/components/settings/apply-side-effects.ts +14 -0
  85. package/src/client/components/settings/categories/AgentSettings.tsx +23 -50
  86. package/src/client/components/settings/categories/AppearanceSettings.tsx +6 -0
  87. package/src/client/components/settings/categories/CommandSettings.tsx +2 -2
  88. package/src/client/components/settings/categories/McpSettings.tsx +4 -21
  89. package/src/client/components/settings/categories/OmpSettings.tsx +147 -194
  90. package/src/client/components/settings/categories/SkillSettings.tsx +2 -2
  91. package/src/client/components/settings/categories/TokenUsageSettings.tsx +211 -229
  92. package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +229 -237
  93. package/src/client/components/settings/categories/agent-settings/ModelPicker.tsx +71 -0
  94. package/src/client/components/settings/categories/agent-settings/SidebarList.tsx +9 -2
  95. package/src/client/components/settings/categories/agent-settings/levels.ts +38 -0
  96. package/src/client/components/settings/categories/appearance-settings/EditorBlameSection.tsx +2 -1
  97. package/src/client/components/settings/categories/appearance-settings/EditorTypingSection.tsx +2 -1
  98. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +144 -0
  99. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.test.tsx +120 -0
  100. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +180 -0
  101. package/src/client/components/settings/categories/behavior-settings/Editor.tsx +27 -7
  102. package/src/client/components/settings/categories/chat-settings/ToolRenderSection.tsx +23 -5
  103. package/src/client/components/settings/categories/command-settings/DetailPane.tsx +75 -33
  104. package/src/client/components/settings/categories/command-settings/SidebarList.tsx +7 -0
  105. package/src/client/components/settings/categories/mcp-settings/DetailPane.tsx +93 -77
  106. package/src/client/components/settings/categories/mcp-settings/EnvVarsSection.tsx +83 -0
  107. package/src/client/components/settings/categories/mcp-settings/ImportModal.tsx +28 -15
  108. package/src/client/components/settings/categories/mcp-settings/SidebarList.tsx +20 -0
  109. package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +97 -36
  110. package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +151 -0
  111. package/src/client/components/settings/categories/omp-settings/ExtensionsPanel.tsx +68 -32
  112. package/src/client/components/settings/categories/omp-settings/OrderedChips.tsx +119 -0
  113. package/src/client/components/settings/categories/omp-settings/PresetBar.tsx +14 -7
  114. package/src/client/components/settings/categories/omp-settings/RoleEditor.tsx +15 -6
  115. package/src/client/components/settings/categories/omp-settings/RowEditor.tsx +165 -226
  116. package/src/client/components/settings/categories/omp-settings/types.ts +28 -0
  117. package/src/client/components/settings/categories/panel-plugins/AvailableList.tsx +1 -1
  118. package/src/client/components/settings/categories/panel-plugins/BuiltinList.tsx +21 -3
  119. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
  120. package/src/client/components/settings/categories/panel-plugins/PluginMark.test.ts +51 -2
  121. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +43 -10
  122. package/src/client/components/settings/categories/plugin-settings/DetailPane.tsx +2 -1
  123. package/src/client/components/settings/categories/plugin-settings/SettingsSection.tsx +2 -1
  124. package/src/client/components/settings/categories/project-settings/ModelDropdown.tsx +1 -1
  125. package/src/client/components/settings/categories/project-settings/WorktreeSettings.tsx +2 -1
  126. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +2 -2
  127. package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +3 -2
  128. package/src/client/components/settings/categories/provider-settings/LogoutProviderModal.tsx +2 -2
  129. package/src/client/components/settings/categories/skill-catalog/GitImportPanel.tsx +3 -2
  130. package/src/client/components/settings/categories/skill-settings/DetailHeader.tsx +37 -8
  131. package/src/client/components/settings/categories/skill-settings/DetailPane.tsx +34 -14
  132. package/src/client/components/settings/categories/skill-settings/SidebarList.tsx +21 -0
  133. package/src/client/components/settings/categories/skill-settings/pane.test.tsx +15 -6
  134. package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +242 -102
  135. package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +130 -56
  136. package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +135 -0
  137. package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +55 -33
  138. package/src/client/components/settings/categories/token-usage-settings/Provenance.tsx +59 -0
  139. package/src/client/components/settings/categories/token-usage-settings/panel.test.tsx +239 -0
  140. package/src/client/components/workspace/browser-panel/Screencast.test.ts +1 -0
  141. package/src/client/components/workspace/browser-panel/Screencast.tsx +17 -22
  142. package/src/client/components/workspace/browser-panel/TabStrip.test.tsx +158 -0
  143. package/src/client/components/workspace/browser-panel/TabStrip.tsx +90 -0
  144. package/src/client/components/workspace/browser-panel/index.tsx +50 -4
  145. package/src/client/components/workspace/browser-toolbar/index.tsx +41 -1
  146. package/src/client/components/workspace/btw-panel/TopicMenu.tsx +1 -1
  147. package/src/client/components/workspace/chat-timeline/AiMessageFooter.tsx +2 -2
  148. package/src/client/components/workspace/chat-timeline/NewChatModal.tsx +3 -3
  149. package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +3 -1
  150. package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +2 -0
  151. package/src/client/components/workspace/chat-timeline/UndoConfirmModal.tsx +2 -2
  152. package/src/client/components/workspace/chat-timeline/block-chrome.test.tsx +13 -2
  153. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
  154. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +4 -3
  155. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
  156. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +1 -1
  157. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +2 -2
  158. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
  159. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
  160. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/index.tsx +2 -6
  161. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.test.ts +88 -0
  162. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +24 -1
  163. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.test.ts +34 -0
  164. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +5 -1
  165. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +7 -6
  166. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.test.tsx +237 -0
  167. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Tui.tsx +191 -0
  168. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/styles.test.tsx +1 -1
  169. package/src/client/components/workspace/context-panel/CostBreakdownPopover.tsx +1 -1
  170. package/src/client/components/workspace/diff-panel/MergeDiffView.tsx +21 -7
  171. package/src/client/components/workspace/diff-panel/changes.test.ts +51 -0
  172. package/src/client/components/workspace/diff-panel/changes.ts +28 -12
  173. package/src/client/components/workspace/diff-panel/index.tsx +2 -2
  174. package/src/client/components/workspace/diff-panel/merge.test.ts +28 -0
  175. package/src/client/components/workspace/diff-panel/merge.ts +21 -1
  176. package/src/client/components/workspace/editor/Body.tsx +7 -0
  177. package/src/client/components/workspace/editor/FileDocument.tsx +15 -21
  178. package/src/client/components/workspace/editor/FilePane.tsx +12 -0
  179. package/src/client/components/workspace/editor/PluginRail.tsx +1 -1
  180. package/src/client/components/workspace/editor/PreviewPane.tsx +70 -0
  181. package/src/client/components/workspace/editor/SaveDeletedFileModal.tsx +2 -2
  182. package/src/client/components/workspace/editor/TabContextMenu.tsx +1 -1
  183. package/src/client/components/workspace/editor/Tabs.tsx +1 -1
  184. package/src/client/components/workspace/editor/Toolbar.tsx +17 -1
  185. package/src/client/components/workspace/editor/index.tsx +25 -22
  186. package/src/client/components/workspace/editor/toolbar-clusters.test.ts +14 -0
  187. package/src/client/components/workspace/editor/toolbar-clusters.tsx +12 -86
  188. package/src/client/components/workspace/editor/toolbar-toggle.tsx +53 -0
  189. package/src/client/components/workspace/editor/toolbar-write-clusters.tsx +112 -0
  190. package/src/client/components/workspace/file-explorer/ContextMenu.tsx +1 -1
  191. package/src/client/components/workspace/file-explorer/Modals.tsx +10 -10
  192. package/src/client/components/workspace/file-explorer/RootMenu.tsx +1 -1
  193. package/src/client/components/workspace/git-panel/BranchToolbar.test.tsx +130 -0
  194. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +21 -11
  195. package/src/client/components/workspace/git-panel/CommitBox.tsx +2 -1
  196. package/src/client/components/workspace/git-panel/Modals.tsx +2 -2
  197. package/src/client/components/workspace/git-panel/StashSection.tsx +2 -1
  198. package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -1
  199. package/src/client/components/workspace/git-panel/branch-modal/RenameDialog.tsx +2 -1
  200. package/src/client/components/workspace/git-panel/commit-modal/index.tsx +2 -2
  201. package/src/client/components/workspace/git-panel/commit-modal.test.ts +5 -3
  202. package/src/client/components/workspace/git-panel/index.tsx +7 -0
  203. package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
  204. package/src/client/components/workspace/model-dropdown/SpecsTooltip.tsx +1 -1
  205. package/src/client/components/workspace/plugin-panel/catalog.tsx +7 -0
  206. package/src/client/components/workspace/plugin-panel/resolve.tsx +4 -0
  207. package/src/client/components/workspace/search-panel/Body.tsx +1 -1
  208. package/src/client/components/workspace/usage-panel/ProviderSelect.tsx +1 -1
  209. package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -0
  210. package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +201 -0
  211. package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +112 -0
  212. package/src/client/components/workspace/user-browser-panel/AnnotateLayer.test.tsx +225 -0
  213. package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +217 -0
  214. package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +99 -0
  215. package/src/client/components/workspace/user-browser-panel/Frame.tsx +30 -1
  216. package/src/client/components/workspace/user-browser-panel/index.tsx +81 -2
  217. package/src/client/data/agent-data/builtin.ts +0 -10
  218. package/src/client/data/agent-data/orchestrator.ts +0 -45
  219. package/src/client/data/agent-data/specialist.ts +0 -100
  220. package/src/client/data/mock/token-usage.ts +170 -120
  221. package/src/client/data/settings/omp-schema.json +33 -1
  222. package/src/client/glass.css +785 -0
  223. package/src/client/glass.test.ts +346 -0
  224. package/src/client/hooks/browser/use-annotate.test.ts +143 -0
  225. package/src/client/hooks/browser/use-annotate.ts +98 -0
  226. package/src/client/hooks/browser/use-close-tab.test.ts +148 -0
  227. package/src/client/hooks/browser/use-close-tab.ts +67 -0
  228. package/src/client/hooks/browser/use-screencast.ts +13 -1
  229. package/src/client/hooks/chat/composer/browser-context.test.ts +117 -0
  230. package/src/client/hooks/chat/composer/browser-context.ts +40 -16
  231. package/src/client/hooks/chat/composer/items.test.ts +1 -1
  232. package/src/client/hooks/chat/composer/review-context.ts +38 -0
  233. package/src/client/hooks/chat/composer/use-draft.test.ts +132 -0
  234. package/src/client/hooks/chat/composer/use-draft.ts +31 -2
  235. package/src/client/hooks/chat/timeline/row-window.test.ts +15 -2
  236. package/src/client/hooks/editor/use-document-annotations.ts +124 -0
  237. package/src/client/hooks/editor/use-editor-panel-ui.ts +52 -0
  238. package/src/client/hooks/editor/use-file-review-mode.ts +35 -0
  239. package/src/client/hooks/editor/use-preview-review.ts +148 -0
  240. package/src/client/hooks/settings/agents.ts +149 -0
  241. package/src/client/hooks/settings/crud-list.test.ts +28 -6
  242. package/src/client/hooks/settings/crud-list.ts +96 -57
  243. package/src/client/hooks/settings/omp-config.ts +164 -0
  244. package/src/client/hooks/settings/useTokenUsage.ts +125 -0
  245. package/src/client/hooks/settings/write-feedback.test.ts +104 -0
  246. package/src/client/hooks/settings/write-feedback.ts +63 -0
  247. package/src/client/hooks/ui/glass-support.ts +57 -0
  248. package/src/client/hooks/ui/icon-style.ts +59 -0
  249. package/src/client/hooks/ui/markdown-hydration.ts +125 -0
  250. package/src/client/hooks/ui/stuck-header.test.ts +188 -0
  251. package/src/client/hooks/ui/stuck-header.ts +91 -0
  252. package/src/client/hooks/ui/style-attributes.test.ts +120 -0
  253. package/src/client/hooks/ui/surface-style.ts +56 -0
  254. package/src/client/hooks/ui/updates/index.test.ts +100 -1
  255. package/src/client/hooks/ui/updates/index.ts +50 -0
  256. package/src/client/hooks/ui/updates/notes.test.ts +138 -0
  257. package/src/client/hooks/ui/updates/notes.ts +57 -0
  258. package/src/client/hooks/workspace/panel-hues.ts +23 -0
  259. package/src/client/lib/browser/element-at.test.ts +229 -0
  260. package/src/client/lib/browser/element-at.ts +139 -0
  261. package/src/client/lib/review/client.ts +73 -0
  262. package/src/client/lib/router/search-params.ts +42 -20
  263. package/src/client/main.tsx +10 -0
  264. package/src/client/tailwind.css +329 -11
  265. package/src/server/lib/assets/shell-attributes.server.ts +80 -0
  266. package/src/server/lib/assets/shell-attributes.test.ts +86 -0
  267. package/src/server/lib/btw/lifecycle.server.ts +2 -2
  268. package/src/server/lib/db/schema.ts +7 -0
  269. package/src/server/lib/db/seed-terminal.test.ts +4 -0
  270. package/src/server/lib/omp/config/agent-definitions.test.ts +273 -0
  271. package/src/server/lib/omp/config/agents.ts +231 -61
  272. package/src/server/lib/omp/config/definitions.test.ts +9 -105
  273. package/src/server/lib/omp/config/extensions.ts +16 -7
  274. package/src/server/lib/omp/config/omp-config-files.test.ts +27 -0
  275. package/src/server/lib/omp/rpc/constants.test.ts +11 -0
  276. package/src/server/lib/omp/rpc/constants.ts +15 -0
  277. package/src/server/lib/omp/rpc/frame-fold-host.test-util.ts +1 -0
  278. package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +2 -30
  279. package/src/server/lib/omp/rpc/frame-fold.test.ts +55 -0
  280. package/src/server/lib/omp/rpc/frame-fold.ts +4 -0
  281. package/src/server/lib/omp/rpc/manager.ts +2 -2
  282. package/src/server/lib/omp/rpc/process-helpers.ts +11 -0
  283. package/src/server/lib/omp/rpc/process.test.ts +106 -0
  284. package/src/server/lib/omp/rpc/process.ts +39 -18
  285. package/src/server/lib/omp/rpc/run-settle.server.ts +12 -0
  286. package/src/server/lib/omp/rpc/run-settle.test.ts +22 -0
  287. package/src/server/lib/omp/rpc/session-command-guards.ts +5 -0
  288. package/src/server/lib/omp/rpc/session-commands.test.ts +9 -1
  289. package/src/server/lib/omp/rpc/session-commands.ts +17 -3
  290. package/src/server/lib/omp/rpc/terminal-settle.ts +29 -7
  291. package/src/server/lib/omp/rpc/utility-agent-dir.test.ts +134 -0
  292. package/src/server/lib/omp/rpc/utility-agent-dir.ts +138 -0
  293. package/src/server/lib/omp/rpc/utility.ts +12 -0
  294. package/src/server/lib/panels/bundled-catalog.server.ts +1 -0
  295. package/src/server/lib/panels/manifest.test.ts +20 -0
  296. package/src/server/lib/panels/manifest.ts +12 -0
  297. package/src/server/lib/panels/scan.server.ts +4 -0
  298. package/src/server/lib/queue/delivery-dispatch.server.test.ts +48 -0
  299. package/src/server/lib/queue/delivery-harness.ts +8 -4
  300. package/src/server/lib/queue/delivery.server.test.ts +29 -0
  301. package/src/server/lib/queue/delivery.server.ts +39 -0
  302. package/src/server/lib/queue/store.server.test.ts +22 -2
  303. package/src/server/lib/queue/store.server.ts +33 -11
  304. package/src/server/lib/review/schema.server.ts +45 -0
  305. package/src/server/lib/review/store.server.ts +138 -0
  306. package/src/server/lib/terminal/attach-replay.test.ts +132 -0
  307. package/src/server/lib/terminal/output.test.ts +166 -0
  308. package/src/server/lib/terminal/output.ts +104 -0
  309. package/src/server/lib/terminal/runtime.server.ts +5 -0
  310. package/src/server/lib/terminal/send-result.test.ts +33 -0
  311. package/src/server/lib/terminal/send-result.ts +32 -0
  312. package/src/server/lib/terminal/session.server.ts +45 -11
  313. package/src/server/lib/terminal/store-liveness.test.ts +4 -0
  314. package/src/server/lib/updates/active-notes.test.ts +149 -0
  315. package/src/server/lib/updates/active-notes.ts +75 -0
  316. package/src/server/lib/updates/changelog-file.ts +42 -11
  317. package/src/server/lib/updates/changelog.test.ts +15 -1
  318. package/src/server/lib/updates/omp.ts +42 -15
  319. package/src/server/lib/updates/release-url.ts +27 -1
  320. package/src/server/lib/usage/index-parse.test.ts +200 -0
  321. package/src/server/lib/usage/index-parse.ts +178 -0
  322. package/src/server/lib/usage/index-query.server.ts +248 -0
  323. package/src/server/lib/usage/index-scan.server.ts +343 -0
  324. package/src/server/lib/usage/index-schema.server.ts +82 -0
  325. package/src/server/lib/usage/index.test.ts +234 -0
  326. package/src/server/lib/usage/providers.server.ts +4 -53
  327. package/src/server/plugins/ssr.ts +22 -5
  328. package/src/server/routes/browser/index.ts +3 -0
  329. package/src/server/routes/browser/stream.ts +31 -2
  330. package/src/server/routes/browser/tabs.test.ts +94 -0
  331. package/src/server/routes/browser/tabs.ts +85 -0
  332. package/src/server/routes/index.ts +2 -0
  333. package/src/server/routes/review/bindings.ts +11 -0
  334. package/src/server/routes/review/index.ts +127 -0
  335. package/src/server/routes/review/routes.test.ts +191 -0
  336. package/src/server/routes/settings/agents.test.ts +180 -0
  337. package/src/server/routes/settings/agents.ts +95 -102
  338. package/src/server/routes/settings/mcp.test.ts +135 -0
  339. package/src/server/routes/settings/mcp.ts +14 -6
  340. package/src/server/routes/settings/settings-store-routes.test.ts +6 -113
  341. package/src/server/routes/telemetry/tokens.test.ts +145 -0
  342. package/src/server/routes/telemetry/tokens.ts +70 -149
  343. package/src/server/routes/terminal/ws.ts +6 -5
  344. package/src/server/routes/updates/index.ts +2 -0
  345. package/src/server/routes/updates/notes.ts +34 -0
  346. package/src/server/routes/updates/routes.test.ts +49 -0
  347. package/src/shared/lib/browser/annotate.test.ts +283 -0
  348. package/src/shared/lib/browser/annotate.ts +231 -0
  349. package/src/shared/lib/browser/browser-viewer.test.ts +26 -4
  350. package/src/shared/lib/browser/frame-gate.test.ts +91 -0
  351. package/src/shared/lib/browser/frame-gate.ts +69 -0
  352. package/src/shared/lib/browser/frame-params.test.ts +43 -0
  353. package/src/shared/lib/browser/frame-params.ts +60 -0
  354. package/src/shared/lib/browser/frame-pipeline.test.ts +132 -0
  355. package/src/shared/lib/browser/frame-pipeline.ts +80 -0
  356. package/src/shared/lib/browser/page-context.ts +60 -4
  357. package/src/shared/lib/browser/snapshot.test.ts +115 -0
  358. package/src/shared/lib/browser/snapshot.ts +112 -0
  359. package/src/shared/lib/browser/tab-close.test.ts +74 -0
  360. package/src/shared/lib/browser/tab-close.ts +77 -0
  361. package/src/shared/lib/browser/viewer.ts +45 -26
  362. package/src/shared/lib/chat/timeline/block-chrome.ts +19 -0
  363. package/src/shared/lib/chat/timeline/tool-render-mode.ts +17 -4
  364. package/src/shared/lib/chat/tool/artifact.ts +55 -20
  365. package/src/shared/lib/chat/tool/bash-facts.ts +96 -0
  366. package/src/shared/lib/chat/tool/minimized.test.ts +98 -0
  367. package/src/shared/lib/chat/tool/minimized.ts +64 -0
  368. package/src/shared/lib/chat/tool/summary.test.ts +28 -8
  369. package/src/shared/lib/chat/tool/summary.ts +3 -32
  370. package/src/shared/lib/icons/file-brand-color.ts +38 -0
  371. package/src/shared/lib/icons/icon-paint-css.test.ts +234 -0
  372. package/src/shared/lib/icons/icon-paint-css.ts +284 -0
  373. package/src/shared/lib/icons/icon-paint-panel.ts +100 -0
  374. package/src/shared/lib/icons/tint-hues.generated.ts +230 -0
  375. package/src/shared/lib/icons/tint.test.ts +273 -0
  376. package/src/shared/lib/icons/tint.ts +219 -0
  377. package/src/shared/lib/markdown/blocks/anchor.ts +63 -0
  378. package/src/shared/lib/markdown/blocks/blocks.test.ts +141 -0
  379. package/src/shared/lib/markdown/blocks/renderer.ts +120 -0
  380. package/src/shared/lib/markdown/blocks/scan.ts +100 -0
  381. package/src/shared/lib/markdown/blocks/types.ts +62 -0
  382. package/src/shared/lib/markdown/marked.ts +58 -147
  383. package/src/shared/lib/markdown/math-extensions.ts +168 -0
  384. package/src/shared/lib/markdown/review/prompt.ts +77 -0
  385. package/src/shared/lib/markdown/review/reconcile.ts +55 -0
  386. package/src/shared/lib/markdown/review/review.test.ts +96 -0
  387. package/src/shared/lib/markdown/xml-sections.test.ts +140 -0
  388. package/src/shared/lib/markdown/xml-sections.ts +139 -0
  389. package/src/shared/lib/models/provider/brand-color.test.ts +116 -0
  390. package/src/shared/lib/models/provider/brand-color.ts +103 -0
  391. package/src/shared/lib/models/provider/label.ts +57 -0
  392. package/src/shared/lib/omp/config/agent-file.test.ts +54 -0
  393. package/src/shared/lib/omp/config/agent-file.ts +43 -0
  394. package/src/shared/lib/omp/config/row-value.test.ts +95 -0
  395. package/src/shared/lib/omp/config/row-value.ts +97 -0
  396. package/src/shared/lib/omp/config/schema.test.ts +31 -0
  397. package/src/shared/lib/omp/config/schema.ts +6 -0
  398. package/src/shared/lib/omp/rpc/frame.test.ts +113 -47
  399. package/src/shared/lib/omp/rpc/frame.ts +107 -43
  400. package/src/shared/lib/settings/defaults.ts +4 -0
  401. package/src/shared/lib/theme/catalog.test.ts +5 -4
  402. package/src/shared/lib/theme/catalog.ts +18 -3
  403. package/src/shared/lib/theme/glass-support.test.ts +38 -0
  404. package/src/shared/lib/theme/glass-support.ts +73 -0
  405. package/src/shared/lib/theme/icon-style.test.ts +74 -0
  406. package/src/shared/lib/theme/icon-style.ts +90 -0
  407. package/src/shared/lib/theme/legibility.ts +91 -0
  408. package/src/shared/lib/theme/palettes/dark-extended.ts +152 -0
  409. package/src/shared/lib/theme/palettes/light-extended.ts +157 -0
  410. package/src/shared/lib/theme/surface-style.test.ts +68 -0
  411. package/src/shared/lib/theme/surface-style.ts +91 -0
  412. package/src/shared/lib/theme/theme.test.ts +11 -7
  413. package/src/shared/lib/ui/menu-anchor.test.ts +69 -0
  414. package/src/shared/lib/ui/menu-anchor.ts +89 -0
  415. package/src/shared/lib/usage/breakdown.test.ts +197 -0
  416. package/src/shared/lib/usage/breakdown.ts +241 -0
  417. package/src/shared/lib/usage/range.test.ts +204 -0
  418. package/src/shared/lib/usage/range.ts +240 -0
  419. package/src/shared/lib/usage/view.test.ts +85 -0
  420. package/src/shared/lib/usage/view.ts +74 -0
  421. package/src/shared/lib/workspace/panel-hues.test.ts +68 -0
  422. package/src/shared/lib/workspace/panel-hues.ts +57 -0
  423. package/src/shared/types/browser.ts +78 -0
  424. package/src/shared/types/index.ts +1 -0
  425. package/src/shared/types/panels-registry.ts +6 -0
  426. package/src/shared/types/panels.ts +14 -0
  427. package/src/shared/types/settings/agent.ts +28 -6
  428. package/src/shared/types/settings/state.ts +30 -3
  429. package/src/shared/types/settings/write.ts +6 -0
  430. package/src/shared/types/tokenUsage.ts +128 -21
  431. package/src/shared/types/updates.ts +20 -0
  432. package/src/test-support/fake-omp-frames.ts +163 -0
  433. package/dist/client/static/js/index-3ve31rzx.css +0 -1
  434. package/src/server/lib/omp/session/usage/aggregate-shaping.test.ts +0 -149
  435. package/src/server/lib/omp/session/usage/aggregate.test.ts +0 -243
  436. package/src/server/lib/omp/session/usage/aggregate.ts +0 -330
  437. package/src/server/lib/omp/session/usage/shaping.ts +0 -130
  438. /package/src/{client/components/common/file-icon/brand-paths.ts → shared/lib/icons/file-brand-paths.ts} +0 -0
@@ -0,0 +1,158 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The agent browser's tab strip, and the close control that makes it usable.
8
+ *
9
+ * Why this exists at all: omp opens a page per site and never tidies up, and
10
+ * the viewer follows the NEWEST owned tab — so a stale page keeps stealing the
11
+ * panel. The strip is the only map of those pages, which makes it the only
12
+ * place they can be closed.
13
+ *
14
+ * Pinned here: one close control per tab, the ACTIVE tab's control stays visible
15
+ * (a hover-only control is unreachable on a touch screen and the active tab is
16
+ * the one most likely to be closed), a click closes THAT tab and does not
17
+ * bubble into a select, and the tab being closed has its control disabled.
18
+ */
19
+
20
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
21
+ import { Window } from 'happy-dom';
22
+ import { h, render } from 'preact';
23
+ import { act } from 'preact/test-utils';
24
+ import { BrowserTabStrip } from '@/client/components/workspace/browser-panel/TabStrip';
25
+ import type { BrowserTabInfo } from '@/shared/types';
26
+
27
+ const DOM_GLOBALS = ['window', 'document', 'navigator', 'Node', 'Element', 'HTMLElement', 'Event'] as const;
28
+ const native: Partial<Record<(typeof DOM_GLOBALS)[number], unknown>> = {};
29
+ let container: HTMLElement | undefined;
30
+
31
+ beforeAll(() => {
32
+ const win = new Window({ url: 'http://localhost' });
33
+ const target = globalThis as unknown as Record<string, unknown>;
34
+ for (const key of DOM_GLOBALS) {
35
+ if (!(key in native)) native[key] = target[key];
36
+ target[key] = (win as unknown as Record<string, unknown>)[key];
37
+ }
38
+ });
39
+
40
+ afterAll(() => {
41
+ const target = globalThis as unknown as Record<string, unknown>;
42
+ for (const key of DOM_GLOBALS) {
43
+ if (native[key] === undefined) delete target[key];
44
+ else target[key] = native[key];
45
+ }
46
+ });
47
+
48
+ afterEach(() => {
49
+ if (container) render(null, container);
50
+ container?.remove();
51
+ container = undefined;
52
+ });
53
+
54
+ const TABS: BrowserTabInfo[] = [
55
+ { targetId: 't1', url: 'https://one.test', title: 'One' },
56
+ { targetId: 't2', url: 'https://two.test', title: 'Two' },
57
+ { targetId: 't3', url: 'https://three.test', title: 'Three' },
58
+ ];
59
+
60
+ interface Recorder {
61
+ selected: string[];
62
+ closed: string[];
63
+ }
64
+
65
+ async function mount(props: { targetId?: string; closing?: string | null } = {}): Promise<{ host: HTMLElement; seen: Recorder }> {
66
+ const seen: Recorder = { selected: [], closed: [] };
67
+ const host = document.body.appendChild(document.createElement('div'));
68
+ container = host;
69
+ await act(async () => {
70
+ render(
71
+ h(BrowserTabStrip, {
72
+ tabs: TABS,
73
+ targetId: props.targetId ?? 't2',
74
+ closing: props.closing ?? null,
75
+ onSelectTarget: (id) => seen.selected.push(id),
76
+ onCloseTarget: (id) => seen.closed.push(id),
77
+ }),
78
+ host,
79
+ );
80
+ });
81
+ return { host, seen };
82
+ }
83
+
84
+ const closeButtons = (host: HTMLElement): HTMLButtonElement[] =>
85
+ [...host.querySelectorAll('button')].filter((button) => button.getAttribute('aria-label')?.startsWith('Tutup tab '));
86
+
87
+ describe('BrowserTabStrip', () => {
88
+ test('every tab gets a close control named for that tab', async () => {
89
+ const { host } = await mount();
90
+ const buttons = closeButtons(host);
91
+ expect(buttons).toHaveLength(TABS.length);
92
+ expect(buttons.map((button) => button.getAttribute('aria-label'))).toEqual([
93
+ 'Tutup tab One',
94
+ 'Tutup tab Two',
95
+ 'Tutup tab Three',
96
+ ]);
97
+ });
98
+
99
+ test('a close click names exactly that tab', async () => {
100
+ const { host, seen } = await mount();
101
+ const second = closeButtons(host)[1];
102
+ await act(async () => {
103
+ second.click();
104
+ });
105
+ expect(seen.closed).toEqual(['t2']);
106
+ // Closing must not also select: the panel re-points the viewer itself once
107
+ // the server confirms, and a select here would fight that.
108
+ expect(seen.selected).toEqual([]);
109
+ });
110
+
111
+ test('the active tab keeps its close control visible', async () => {
112
+ const { host } = await mount({ targetId: 't2' });
113
+ const [first, second, third] = closeButtons(host);
114
+ // The inactive ones reveal on hover/focus only.
115
+ expect(first.className).toContain('opacity-0');
116
+ expect(third.className).toContain('opacity-0');
117
+ // The active one does not, so a touch user can still close it.
118
+ expect(second.className).not.toContain('opacity-0');
119
+ });
120
+
121
+ test('the tab being closed has its control disabled', async () => {
122
+ const { host } = await mount({ closing: 't3' });
123
+ expect(closeButtons(host)[2].disabled).toBe(true);
124
+ expect(closeButtons(host)[0].disabled).toBe(false);
125
+ });
126
+
127
+ test('selecting a tab still works, and the active one unpins to follow newest', async () => {
128
+ const { host, seen } = await mount({ targetId: 't2' });
129
+ const select = (index: number) => [...host.querySelectorAll('button')].filter((b) => b.getAttribute('aria-pressed') !== null)[index];
130
+ await act(async () => {
131
+ select(0).click();
132
+ });
133
+ await act(async () => {
134
+ select(1).click();
135
+ });
136
+ expect(seen.selected).toEqual(['t1', '']);
137
+ });
138
+
139
+ test('a tab with no title falls back to its URL, then its id', async () => {
140
+ const host = document.body.appendChild(document.createElement('div'));
141
+ container = host;
142
+ await act(async () => {
143
+ render(
144
+ h(BrowserTabStrip, {
145
+ tabs: [
146
+ { targetId: 'a', url: 'https://url-only.test', title: '' },
147
+ { targetId: 'b', url: '', title: '' },
148
+ ],
149
+ onSelectTarget: () => {},
150
+ onCloseTarget: () => {},
151
+ }),
152
+ host,
153
+ );
154
+ });
155
+ expect(host.textContent).toContain('https://url-only.test');
156
+ expect(host.textContent).toContain('b');
157
+ });
158
+ });
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The agent browser's tab strip: which pages this session owns, which one the
8
+ * panel is showing, and a close control per tab.
9
+ *
10
+ * The close button exists because omp opens a page per site it visits and never
11
+ * tidies up. The strip is the only place a user can see them, so it is also the
12
+ * only place they can be closed — and closing is what keeps the panel on the
13
+ * page the user cares about, since the viewer follows the NEWEST owned tab.
14
+ *
15
+ * Every tab is closable, not just the active one: the fleet of stale pages is
16
+ * the problem being solved. The close control is `group-hover` revealed except
17
+ * on the active tab, which keeps it visible — a control that only appears on
18
+ * hover is unreachable on a touch screen, and the active tab is the one a user
19
+ * is most likely to want gone.
20
+ */
21
+
22
+ import { useEffect, useRef } from 'preact/hooks';
23
+ import { X } from 'lucide-preact';
24
+ import type { BrowserTabInfo } from '@/shared/types';
25
+
26
+ interface BrowserTabStripProps {
27
+ tabs: BrowserTabInfo[];
28
+ targetId?: string;
29
+ /** Tab whose close request is in flight (its button is disabled). */
30
+ closing?: string | null;
31
+ onSelectTarget: (targetId: string) => void;
32
+ onCloseTarget: (targetId: string) => void;
33
+ }
34
+
35
+ /** What a tab row says: its title, else its URL, else the id as a last resort. */
36
+ function tabLabel(tab: BrowserTabInfo): string {
37
+ return tab.title || tab.url || tab.targetId;
38
+ }
39
+
40
+ export function BrowserTabStrip({ tabs, targetId, closing, onSelectTarget, onCloseTarget }: BrowserTabStripProps) {
41
+ const activeRef = useRef<HTMLDivElement | null>(null);
42
+
43
+ // A session that opens pages can push the active tab out of view; the strip
44
+ // is the only map of them, so it must keep the current one visible.
45
+ useEffect(() => {
46
+ activeRef.current?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
47
+ }, [targetId, tabs.length]);
48
+
49
+ return (
50
+ <div className="px-2 py-1 border-b border-ink/10 bg-paper flex items-center gap-1 overflow-x-auto flex-shrink-0">
51
+ {tabs.map((tab) => {
52
+ const active = tab.targetId === targetId;
53
+ const label = tabLabel(tab);
54
+ return (
55
+ <div
56
+ key={tab.targetId}
57
+ ref={active ? activeRef : undefined}
58
+ className={`group flex items-center rounded border transition-colors flex-shrink-0 ${
59
+ active
60
+ ? 'bg-ink text-canvas border-ink'
61
+ : 'bg-paper text-ink/70 border-ink/15 hover:border-ink/35 hover:text-ink'
62
+ }`}
63
+ >
64
+ <button
65
+ type="button"
66
+ onClick={() => onSelectTarget(active ? '' : tab.targetId)}
67
+ className="pl-2 pr-1 py-0.5 text-[11px] font-mono max-w-[220px] truncate cursor-pointer"
68
+ title={`${label}\n${tab.url}`}
69
+ aria-pressed={active}
70
+ >
71
+ {label}
72
+ </button>
73
+ <button
74
+ type="button"
75
+ onClick={() => onCloseTarget(tab.targetId)}
76
+ disabled={closing === tab.targetId}
77
+ className={`mr-0.5 p-1 rounded hover:bg-error hover:text-paper transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${
78
+ active ? 'text-canvas/70' : 'text-ink/40 opacity-0 group-hover:opacity-100 focus-visible:opacity-100'
79
+ }`}
80
+ aria-label={`Tutup tab ${label}`}
81
+ title={`Tutup tab ${label}`}
82
+ >
83
+ <X size={11} />
84
+ </button>
85
+ </div>
86
+ );
87
+ })}
88
+ </div>
89
+ );
90
+ }
@@ -1,7 +1,8 @@
1
- import { useCallback } from 'preact/hooks';
1
+ import { useCallback, useState } from 'preact/hooks';
2
2
  import { BrowserAddressBar } from '@/client/components/workspace/browser-panel/AddressBar';
3
3
  import { BrowserScreencast } from '@/client/components/workspace/browser-panel/Screencast';
4
4
  import { useScreencast } from '@/client/hooks/browser/use-screencast';
5
+ import { useCloseBrowserTab } from '@/client/hooks/browser/use-close-tab';
5
6
  import { useSessionState } from '@/client/hooks/workspace/session-state';
6
7
  import { emitBrowserPageContext } from '@/shared/lib/browser/page-context';
7
8
 
@@ -15,8 +16,13 @@ interface BrowserPanelProps {
15
16
  * Read-only live view of the browser tab this session's omp agent drives in the
16
17
  * project-shared Chromium (see app/lib/browser/ + /api/browser/:id/stream).
17
18
  *
18
- * This panel only mirrors what the agent does. Interactive browsing belongs to
19
- * the separate user-browser panel, which runs its own private Chromium.
19
+ * This panel only mirrors what the agent does, with ONE exception: it can CLOSE
20
+ * the session's tabs. The agent opens a page per site and never tidies up, and
21
+ * the viewer follows the newest owned tab — so without a close control a stale
22
+ * page keeps stealing the panel.
23
+ *
24
+ * Interactive browsing belongs to the separate user-browser panel, which runs
25
+ * its own private Chromium.
20
26
  *
21
27
  * There is deliberately NO device/viewport selector here: the surface is a
22
28
  * fixed-resolution screencast JPEG, so a preset could only letterbox the image
@@ -26,7 +32,9 @@ interface BrowserPanelProps {
26
32
  */
27
33
  export function BrowserPanel({ className = '', active = true }: BrowserPanelProps) {
28
34
  const [zoomLevel, setZoomLevel] = useSessionState<number>('browser.zoomLevel', 100);
29
- const { status, url, title, tabs, targetId, frame, actions, selectTarget, reconnect } = useScreencast(active);
35
+ const { status, url, title, tabs, targetId, frame, actions, sessionId, selectTarget, reconnect } = useScreencast(active);
36
+ const { closeTab, closing } = useCloseBrowserTab(sessionId);
37
+ const [closeError, setCloseError] = useState<string | null>(null);
30
38
 
31
39
  const handleOpenExternal = () => {
32
40
  if (!url) return;
@@ -40,6 +48,24 @@ export function BrowserPanel({ className = '', active = true }: BrowserPanelProp
40
48
  emitBrowserPageContext({ url, title });
41
49
  }, [url, title]);
42
50
 
51
+ // Closing a tab re-points the viewer at the neighbour the server named. The
52
+ // empty string means "follow the newest owned tab"; a real id pins it so the
53
+ // strip does not jump to an unrelated page.
54
+ const handleCloseTarget = useCallback(
55
+ (closingTarget: string) => {
56
+ if (closing === closingTarget) return;
57
+ void closeTab(closingTarget).then((result) => {
58
+ if (!result.ok) {
59
+ setCloseError(result.error ?? 'Gagal menutup tab');
60
+ return;
61
+ }
62
+ setCloseError(null);
63
+ selectTarget(result.next ?? '');
64
+ });
65
+ },
66
+ [closeTab, closing, selectTarget],
67
+ );
68
+
43
69
  return (
44
70
  <div className={`flex flex-col h-full w-full bg-paper text-ink overflow-hidden select-none ${className}`}>
45
71
  <BrowserAddressBar
@@ -54,6 +80,24 @@ export function BrowserPanel({ className = '', active = true }: BrowserPanelProp
54
80
  onResetZoom={() => setZoomLevel(100)}
55
81
  />
56
82
 
83
+ {closeError && (
84
+ <div
85
+ role="alert"
86
+ className="px-2.5 py-1 border-b border-error/30 bg-error/5 text-[11px] text-error flex items-center justify-between gap-2 flex-shrink-0"
87
+ >
88
+ <span className="truncate" title={closeError}>
89
+ {closeError}
90
+ </span>
91
+ <button
92
+ type="button"
93
+ onClick={() => setCloseError(null)}
94
+ className="text-[10px] uppercase tracking-wide text-error/80 hover:text-error cursor-pointer flex-shrink-0"
95
+ >
96
+ Tutup
97
+ </button>
98
+ </div>
99
+ )}
100
+
57
101
  <BrowserScreencast
58
102
  status={status}
59
103
  url={url}
@@ -62,6 +106,8 @@ export function BrowserPanel({ className = '', active = true }: BrowserPanelProp
62
106
  frame={frame}
63
107
  actions={actions}
64
108
  onSelectTarget={selectTarget}
109
+ onCloseTarget={handleCloseTarget}
110
+ closingTarget={closing}
65
111
  zoomLevel={zoomLevel}
66
112
  />
67
113
  </div>
@@ -1,5 +1,5 @@
1
1
  import { useState } from 'preact/hooks';
2
- import { Check, Copy, ExternalLink, MessageSquarePlus } from 'lucide-preact';
2
+ import { Check, Copy, ExternalLink, MessageSquarePlus, SquarePen } from 'lucide-preact';
3
3
  import { BrowserViewportSelector } from '@/client/components/common/ViewportSelector';
4
4
  import { ZoomControls } from '@/client/components/workspace/browser-toolbar/ZoomControls';
5
5
  import type { ComponentChildren } from 'preact';
@@ -8,6 +8,13 @@ import type { ViewportMode } from '@/shared/types';
8
8
  export const ICON_BUTTON =
9
9
  'p-1.5 rounded hover:bg-ink/5 disabled:opacity-25 disabled:hover:bg-transparent text-ink/70 hover:text-ink transition-colors cursor-pointer disabled:cursor-not-allowed';
10
10
 
11
+ /** The user panel's annotation toggle; the agent panel never supplies it. */
12
+ export interface BrowserToolbarAnnotate {
13
+ active: boolean;
14
+ count: number;
15
+ onToggle: () => void;
16
+ }
17
+
11
18
  export interface BrowserToolbarProps {
12
19
  url: string;
13
20
  /** Status dot class plus its label — the only per-panel difference. */
@@ -29,6 +36,13 @@ export interface BrowserToolbarProps {
29
36
  viewportMode?: ViewportMode;
30
37
  onChangeViewport?: (mode: ViewportMode) => void;
31
38
  onSetZoom?: (zoom: number) => void;
39
+ /**
40
+ * Annotation mode, rendered only when supplied. The USER panel passes it: its
41
+ * marks are normalized against a measured iframe box. The AGENT panel does
42
+ * not — its surface is the agent's own live view, so the user annotates the
43
+ * page by asking the agent instead of drawing on a JPEG.
44
+ */
45
+ annotate?: BrowserToolbarAnnotate;
32
46
  /** Shown after the include/copy buttons — the agent panel's reconnect button. */
33
47
  trailingControls?: ComponentChildren;
34
48
  /** Open-external button label/title, differing between the two panels. */
@@ -57,6 +71,7 @@ export function BrowserToolbar({
57
71
  onZoomOut,
58
72
  onResetZoom,
59
73
  onSetZoom,
74
+ annotate,
60
75
  onIncludeInChat,
61
76
  onOpenExternal,
62
77
  trailingControls,
@@ -121,6 +136,31 @@ export function BrowserToolbar({
121
136
  {included ? <Check size={14} className="text-success" /> : <MessageSquarePlus size={14} />}
122
137
  </button>
123
138
 
139
+ {annotate && (
140
+ <button
141
+ type="button"
142
+ onClick={annotate.onToggle}
143
+ disabled={!url}
144
+ aria-label="Mode anotasi halaman"
145
+ aria-pressed={annotate.active}
146
+ title={
147
+ annotate.active
148
+ ? 'Tutup mode anotasi'
149
+ : annotate.count > 0
150
+ ? `Anotasi (${annotate.count}) — buka lagi`
151
+ : 'Tandai bagian halaman lalu kirim ke chat'
152
+ }
153
+ className={`${ICON_BUTTON} relative ${annotate.active ? 'bg-ink/10 text-ink' : ''}`}
154
+ >
155
+ <SquarePen size={14} />
156
+ {annotate.count > 0 && (
157
+ <span className="absolute -top-0.5 -right-0.5 min-w-[13px] h-[13px] px-0.5 rounded-full bg-error text-paper text-[9px] leading-[13px] font-mono text-center">
158
+ {annotate.count}
159
+ </span>
160
+ )}
161
+ </button>
162
+ )}
163
+
124
164
  <button
125
165
  type="button"
126
166
  onClick={handleCopy}
@@ -59,7 +59,7 @@ export function BtwTopicMenu({ topics, activeTopicId, onSelectTopic, onDeleteTop
59
59
  ref={menuRef}
60
60
  role="menu"
61
61
  aria-label="Side question history"
62
- className="absolute left-0 top-full mt-1 z-50 bg-paper border border-ink/15 rounded-lg shadow-xl min-w-[280px] max-h-72 overflow-y-auto scrollbar-overlay-container p-1"
62
+ className="glass-popover absolute left-0 top-full mt-1 z-50 bg-paper border border-ink/15 rounded-lg shadow-xl min-w-[280px] max-h-72 overflow-y-auto scrollbar-overlay-container p-1"
63
63
  >
64
64
  {topics.length === 0 && (
65
65
  <div className="px-2.5 py-2 text-[12px] text-ink/50">No side questions yet.</div>
@@ -149,12 +149,12 @@ export function AiMessageFooter({
149
149
 
150
150
  {isMenuOpen && (
151
151
  <div
152
- className="fixed inset-0 z-[70] flex items-end bg-ink/40 backdrop-blur-[1px] animate-in fade-in duration-150"
152
+ className="fixed inset-0 z-[70] flex items-end modal-scrim backdrop-blur-[1px] animate-in fade-in duration-150"
153
153
  role="presentation"
154
154
  onClick={() => setIsMenuOpen(false)}
155
155
  >
156
156
  <div
157
- className="w-full max-h-[80vh] overflow-y-auto rounded-t-2xl border border-ink/15 bg-paper pb-[max(0.75rem,env(safe-area-inset-bottom,0px))] shadow-2xl animate-in slide-in-from-bottom-4 duration-200"
157
+ className="glass-overlay w-full max-h-[80vh] overflow-y-auto rounded-t-2xl border border-ink/15 bg-paper pb-[max(0.75rem,env(safe-area-inset-bottom,0px))] shadow-2xl animate-in slide-in-from-bottom-4 duration-200"
158
158
  role="dialog"
159
159
  aria-modal="true"
160
160
  aria-labelledby={`message-actions-${msgId}`}
@@ -69,13 +69,13 @@ export function NewChatModal({
69
69
  };
70
70
 
71
71
  return (
72
- <div className="fixed inset-0 z-50 flex items-center justify-center bg-ink/40 animate-in fade-in duration-200 p-4">
72
+ <div className="fixed inset-0 z-50 flex items-center justify-center modal-scrim animate-in fade-in duration-200 p-4">
73
73
  <div
74
- className="bg-canvas border border-ink/15 rounded-xl shadow-xl w-full flex flex-col overflow-hidden"
74
+ className="glass-overlay bg-canvas border border-ink/15 rounded-xl shadow-xl w-full flex flex-col overflow-hidden"
75
75
  style={maximized ? MODAL_EXPANDED_STYLE : MODAL_DEFAULT_STYLE}
76
76
  onClick={(e) => e.stopPropagation()}
77
77
  >
78
- <div className="flex items-center justify-between px-4 py-3 border-b border-ink/10 bg-paper">
78
+ <div className="flex items-center justify-between px-4 py-3 border-b border-ink/10">
79
79
  <h2 className="text-[13px] font-semibold text-ink">New Chat</h2>
80
80
  <div className="flex items-center gap-0.5">
81
81
  <button
@@ -56,7 +56,9 @@ export function ThinkingSection({
56
56
  }: ThinkingSectionProps) {
57
57
  const mode = useToolRenderMode();
58
58
  const chrome = blockChrome(mode);
59
- const framed = mode === 'card';
59
+ // Whether the style draws a FRAME is the chrome's own fact, not the mode's
60
+ // name: `card` boxes the block, `compact`/`trace`/`minimal`/`tui` are lines.
61
+ const framed = chrome.frame !== '';
60
62
 
61
63
  const isGenerating = typeof thinking === 'object' ? Boolean(thinking.isGenerating) : false;
62
64
  const { isOpen, toggle: toggleOpen } = useThinkingOpenState(messageId, defaultExpanded, isGenerating);
@@ -33,6 +33,7 @@ import { CardRow } from '@/client/components/workspace/chat-timeline/tool-render
33
33
  import { CompactRow } from '@/client/components/workspace/chat-timeline/tool-renderers/styles/Compact';
34
34
  import { TraceRow } from '@/client/components/workspace/chat-timeline/tool-renderers/styles/Trace';
35
35
  import { MinimalRow } from '@/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal';
36
+ import { TuiRow } from '@/client/components/workspace/chat-timeline/tool-renderers/styles/Tui';
36
37
  import type { ToolRowProps } from '@/client/components/workspace/chat-timeline/tool-renderers/styles/props';
37
38
 
38
39
  interface ToolCallingSectionProps {
@@ -48,6 +49,7 @@ const ROW_BY_MODE: Record<ToolRenderMode, FunctionComponent<ToolRowProps>> = {
48
49
  compact: CompactRow,
49
50
  trace: TraceRow,
50
51
  minimal: MinimalRow,
52
+ tui: TuiRow,
51
53
  };
52
54
 
53
55
  function normalizeToolData(action: ToolCallData | AgentActionData, index: number): ToolCallData {
@@ -35,14 +35,14 @@ export function UndoConfirmModal({ content, isOmpSession, undoing, error, onClos
35
35
 
36
36
  return (
37
37
  <div
38
- className="fixed inset-0 z-50 flex items-center justify-center bg-ink/40 animate-in fade-in duration-200 p-4"
38
+ className="fixed inset-0 z-50 flex items-center justify-center modal-scrim animate-in fade-in duration-200 p-4"
39
39
  onClick={undoing ? undefined : onClose}
40
40
  role="dialog"
41
41
  aria-modal="true"
42
42
  aria-label="Confirm undo"
43
43
  >
44
44
  <div
45
- className="bg-paper border border-ink/20 rounded-xl shadow-xl w-[min(94vw,420px)] overflow-hidden"
45
+ className="glass-overlay bg-paper border border-ink/20 rounded-xl shadow-xl w-[min(94vw,420px)] overflow-hidden"
46
46
  onClick={(e) => e.stopPropagation()}
47
47
  >
48
48
  <div className="flex items-center gap-3 px-4 py-3 border-b border-ink/10">
@@ -86,10 +86,12 @@ async function paint(style: string, node: preact.ComponentChildren): Promise<HTM
86
86
  }
87
87
 
88
88
  describe('blockChrome', () => {
89
- test('only the card style has a frame', () => {
89
+ test('only the card style has a frame; tui is a line of text like its siblings', () => {
90
90
  expect(blockChrome('card').frame).toContain('rounded-xl');
91
91
  expect(blockChrome('card').frame).toContain('border-ink/10');
92
- for (const mode of ['compact', 'trace', 'minimal'] as const) {
92
+ // `tui` is NOT a card: no border, no fill. Its shape lives in the header
93
+ // row's type and colour, not in a box.
94
+ for (const mode of ['compact', 'trace', 'minimal', 'tui'] as const) {
93
95
  expect(blockChrome(mode).frame).toBe('');
94
96
  }
95
97
  });
@@ -100,6 +102,7 @@ describe('blockChrome', () => {
100
102
  expect(blockChrome('compact').node).toBeUndefined();
101
103
  expect(blockChrome('card').node).toBeUndefined();
102
104
  expect(blockChrome('minimal').node).toBeUndefined();
105
+ expect(blockChrome('tui').node).toBeUndefined();
103
106
  });
104
107
 
105
108
  test('the minimal style is the smallest type, the frame styles the largest', () => {
@@ -108,6 +111,14 @@ describe('blockChrome', () => {
108
111
  expect(blockChrome('card').header).toContain('px-3 py-2.5');
109
112
  expect(blockChrome('compact').header).toContain('py-1');
110
113
  });
114
+
115
+ test('the tui header is terminal text: monospace, accent name, meta subject', () => {
116
+ expect(blockChrome('tui').header).toContain('font-mono');
117
+ expect(blockChrome('tui').title).toContain('text-info');
118
+ expect(blockChrome('tui').subtitle).toContain('text-meta');
119
+ expect(blockChrome('tui').body).toContain('font-mono');
120
+ expect(blockChrome('tui').header).not.toBe(blockChrome('card').header);
121
+ });
111
122
  });
112
123
 
113
124
  describe('thinking follows the render style', () => {
@@ -32,7 +32,7 @@ export function AccessDropdown({ value, onSelect }: AccessDropdownProps) {
32
32
  <span className="hidden lg:inline">{ACCESS_LEVEL_LABELS[value]}</span>
33
33
  </button>
34
34
  {showAccess && (
35
- <div className="absolute bottom-full left-0 mb-1 w-40 bg-paper border border-ink/20 rounded-md shadow-lg z-50 py-1 text-xs">
35
+ <div className="glass-popover absolute bottom-full left-0 mb-1 w-40 bg-paper border border-ink/20 rounded-md shadow-lg z-50 py-1 text-xs">
36
36
  <div className="px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold mb-1">Access Control</div>
37
37
  {APPROVAL_MODES.map(mode => (
38
38
  <button
@@ -21,6 +21,7 @@
21
21
  * accepts the same vocabulary.
22
22
  */
23
23
 
24
+ import { CHECKBOX_CLASS } from '@/client/components/common/checkbox/style';
24
25
  import { useEffect, useRef, useState } from 'preact/hooks';
25
26
  import type { ComponentChildren } from 'preact';
26
27
  import { Target, X } from 'lucide-preact';
@@ -121,9 +122,9 @@ export function GoalModal({ open, goal, goalRecord, pending, defaultBudget = nul
121
122
  };
122
123
 
123
124
  return (
124
- <div className="fixed inset-0 z-[60] flex items-center justify-center bg-ink/30 p-4" onClick={onClose}>
125
+ <div className="fixed inset-0 z-[60] flex items-center justify-center modal-scrim p-4" onClick={onClose}>
125
126
  <div
126
- className="w-full max-w-lg overflow-hidden rounded-xl border border-ink/15 bg-paper shadow-xl"
127
+ className="glass-overlay w-full max-w-lg overflow-hidden rounded-xl border border-ink/15 bg-paper shadow-xl"
127
128
  onClick={(event) => event.stopPropagation()}
128
129
  >
129
130
  <div className="flex items-center justify-between border-b border-ink/10 px-4 py-3">
@@ -258,7 +259,7 @@ export function GoalModal({ open, goal, goalRecord, pending, defaultBudget = nul
258
259
  type="checkbox"
259
260
  checked={guided}
260
261
  onChange={(event) => setGuided(event.currentTarget.checked)}
261
- className="mt-0.5"
262
+ className={`${CHECKBOX_CLASS} mt-0.5`}
262
263
  />
263
264
  <span>
264
265
  Let the agent interview me first — it asks one question per turn, then writes the objective itself.
@@ -30,7 +30,7 @@ export function ThinkingLevelDropdown({ thinkingLevels, currentThinking, onSelec
30
30
  <span className="hidden lg:inline">{currentThinking}</span>
31
31
  </button>
32
32
  {showThinking && thinkingLevels.length > 0 && (
33
- <div className="absolute bottom-full left-0 mb-1 w-40 bg-paper border border-ink/20 rounded-md shadow-lg z-50 py-1 text-xs">
33
+ <div className="glass-popover absolute bottom-full left-0 mb-1 w-40 bg-paper border border-ink/20 rounded-md shadow-lg z-50 py-1 text-xs">
34
34
  <div className="px-3 py-1 text-[10px] uppercase tracking-wider text-ink/40 font-semibold mb-1">Thinking Level</div>
35
35
  {thinkingLevels.map(level => (
36
36
  <button
@@ -127,7 +127,7 @@ export function WaitingDependencyPicker({
127
127
  </button>
128
128
 
129
129
  {open && (
130
- <div className="absolute bottom-full left-0 mb-1.5 w-72 bg-paper border border-ink/10 rounded-lg shadow-lg z-50 flex flex-col overflow-hidden text-xs py-1">
130
+ <div className="glass-popover absolute bottom-full left-0 mb-1.5 w-72 bg-paper border border-ink/10 rounded-lg shadow-lg z-50 flex flex-col overflow-hidden text-xs py-1">
131
131
  <div className="flex items-center justify-between px-3 py-1.5 border-b border-ink/5">
132
132
  <span className="text-[10px] uppercase tracking-wider text-ink/40 font-semibold">Wait for session</span>
133
133
  {value && (
@@ -67,8 +67,8 @@ export function PlanReviewPanel({ proposal, deciding, error, onDecide, onDismiss
67
67
  .join('\n\n');
68
68
 
69
69
  return (
70
- <div className="fixed inset-0 z-[70] flex items-center justify-center bg-ink/40 p-4">
71
- <div className="flex h-[88vh] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-ink/15 bg-paper shadow-2xl">
70
+ <div className="fixed inset-0 z-[70] flex items-center justify-center modal-scrim p-4">
71
+ <div className="glass-overlay flex h-[88vh] w-full max-w-5xl flex-col overflow-hidden rounded-xl border border-ink/15 bg-paper shadow-2xl">
72
72
  <div className="flex items-center justify-between border-b border-ink/10 px-4 py-3">
73
73
  <div className="flex min-w-0 items-center gap-2">
74
74
  <FileText size={15} className="shrink-0 text-ink/60" />
@@ -81,7 +81,7 @@ export function WorkspacePicker({
81
81
  {open && (
82
82
  <div
83
83
  role="menu"
84
- className="absolute bottom-full left-0 mb-1.5 w-64 bg-paper border border-ink/10 rounded-lg shadow-lg z-50 flex flex-col overflow-hidden text-xs py-1"
84
+ className="glass-popover absolute bottom-full left-0 mb-1.5 w-64 bg-paper border border-ink/10 rounded-lg shadow-lg z-50 flex flex-col overflow-hidden text-xs py-1"
85
85
  >
86
86
  <div className="px-3 py-1.5 text-[10px] uppercase tracking-wider text-ink/40 font-semibold border-b border-ink/5">
87
87
  Target Workspace
@@ -172,7 +172,7 @@ export function WorktreePicker({ folders, selectedFolderId, target, setTarget, o
172
172
  {open && (
173
173
  <div
174
174
  role="menu"
175
- className="absolute bottom-full left-0 mb-1.5 w-72 bg-paper border border-ink/10 rounded-lg shadow-lg z-50 flex flex-col overflow-hidden text-xs py-1"
175
+ className="glass-popover absolute bottom-full left-0 mb-1.5 w-72 bg-paper border border-ink/10 rounded-lg shadow-lg z-50 flex flex-col overflow-hidden text-xs py-1"
176
176
  >
177
177
  <div className="px-3 py-1.5 text-[10px] uppercase tracking-wider text-ink/40 font-semibold border-b border-ink/5">
178
178
  Project root