@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
@@ -7,11 +7,6 @@ export const specialistAgents: AgentItem[] = [
7
7
  name: 'crd-maker',
8
8
  description: 'You are **CRD Maker** (Change Request Description) specialist.',
9
9
  scope: 'user',
10
- mode: 'subagent',
11
- overrideModel: 'Not selected',
12
- thinkingVariant: 'default',
13
- temperature: null,
14
- topP: null,
15
10
  systemPrompt: `You are CRD Maker. Create structured, clear, and comprehensive Change Request Descriptions for tracking pull requests.`,
16
11
  },
17
12
  {
@@ -19,11 +14,6 @@ export const specialistAgents: AgentItem[] = [
19
14
  name: 'database-analyzer',
20
15
  description: 'You are **Database Analyzer**, schema optimizer, and SQL query reviewer.',
21
16
  scope: 'user',
22
- mode: 'subagent',
23
- overrideModel: 'Not selected',
24
- thinkingVariant: 'default',
25
- temperature: null,
26
- topP: null,
27
17
  systemPrompt: `You are Database Analyzer. Optimize indexing, schema normalizations, transaction boundaries, and query performance.`,
28
18
  },
29
19
  {
@@ -31,11 +21,6 @@ export const specialistAgents: AgentItem[] = [
31
21
  name: 'doc-writer',
32
22
  description: 'Generates API documentation, usage guides, and README updates.',
33
23
  scope: 'user',
34
- mode: 'subagent',
35
- overrideModel: 'Not selected',
36
- thinkingVariant: 'default',
37
- temperature: null,
38
- topP: null,
39
24
  systemPrompt: `You are Doc Writer. Write crisp, accurate technical documentation with code examples.`,
40
25
  },
41
26
  {
@@ -43,11 +28,6 @@ export const specialistAgents: AgentItem[] = [
43
28
  name: 'security-auditor',
44
29
  description: 'Scans code for vulnerability vectors, input sanitization, and secret leaks.',
45
30
  scope: 'user',
46
- mode: 'subagent',
47
- overrideModel: 'Not selected',
48
- thinkingVariant: 'default',
49
- temperature: null,
50
- topP: null,
51
31
  systemPrompt: `You are Security Auditor. Audit permissions, OWASP Top 10 vulnerabilities, and credentials leakage.`,
52
32
  },
53
33
  {
@@ -55,11 +35,6 @@ export const specialistAgents: AgentItem[] = [
55
35
  name: 'frontend-specialist',
56
36
  description: 'Crafts responsive layouts, Tailwind utility styling, and stateful React views.',
57
37
  scope: 'user',
58
- mode: 'all',
59
- overrideModel: 'Not selected',
60
- thinkingVariant: 'default',
61
- temperature: null,
62
- topP: null,
63
38
  systemPrompt: `You are Frontend Specialist. Build accessible, modern, fluid UI components with Tailwind CSS and React.`,
64
39
  },
65
40
  {
@@ -67,11 +42,6 @@ export const specialistAgents: AgentItem[] = [
67
42
  name: 'backend-specialist',
68
43
  description: 'Develops RESTful endpoints, edge runtime routes, and server handlers.',
69
44
  scope: 'user',
70
- mode: 'all',
71
- overrideModel: 'Not selected',
72
- thinkingVariant: 'default',
73
- temperature: null,
74
- topP: null,
75
45
  systemPrompt: `You are Backend Specialist. Handle server logic, validation, HTTP protocols, and edge workers.`,
76
46
  },
77
47
  {
@@ -79,11 +49,6 @@ export const specialistAgents: AgentItem[] = [
79
49
  name: 'test-engineer',
80
50
  description: 'Creates unit tests, integration suites, and mocks for reliability.',
81
51
  scope: 'user',
82
- mode: 'subagent',
83
- overrideModel: 'Not selected',
84
- thinkingVariant: 'default',
85
- temperature: null,
86
- topP: null,
87
52
  systemPrompt: `You are Test Engineer. Write robust tests with high coverage and descriptive assertion messages.`,
88
53
  },
89
54
  {
@@ -91,11 +56,6 @@ export const specialistAgents: AgentItem[] = [
91
56
  name: 'performance-tuner',
92
57
  description: 'Profiles render cycles, bundle footprints, memory, and cache hit ratios.',
93
58
  scope: 'user',
94
- mode: 'subagent',
95
- overrideModel: 'Not selected',
96
- thinkingVariant: 'default',
97
- temperature: null,
98
- topP: null,
99
59
  systemPrompt: `You are Performance Tuner. Eliminate unnecessary re-renders, optimize tree shaking, and reduce latency.`,
100
60
  },
101
61
  {
@@ -103,11 +63,6 @@ export const specialistAgents: AgentItem[] = [
103
63
  name: 'git-sync',
104
64
  description: 'Manages branches, merges, rebases, and clean conventional commit histories.',
105
65
  scope: 'user',
106
- mode: 'subagent',
107
- overrideModel: 'Not selected',
108
- thinkingVariant: 'default',
109
- temperature: null,
110
- topP: null,
111
66
  systemPrompt: `You are Git Sync. Formulate clean conventional commits, manage staging, and inspect branch states.`,
112
67
  },
113
68
  {
@@ -115,11 +70,6 @@ export const specialistAgents: AgentItem[] = [
115
70
  name: 'devops-runner',
116
71
  description: 'Oversees CI/CD scripts, Dockerfiles, Bun edge configs, and deployment gates.',
117
72
  scope: 'user',
118
- mode: 'subagent',
119
- overrideModel: 'Not selected',
120
- thinkingVariant: 'default',
121
- temperature: null,
122
- topP: null,
123
73
  systemPrompt: `You are DevOps Runner. Inspect build logs, configure container targets, and verify deployment artifacts.`,
124
74
  },
125
75
  {
@@ -127,11 +77,6 @@ export const specialistAgents: AgentItem[] = [
127
77
  name: 'api-designer',
128
78
  description: 'Designs schemas, OpenAPI specs, and contract types across clients and servers.',
129
79
  scope: 'user',
130
- mode: 'subagent',
131
- overrideModel: 'Not selected',
132
- thinkingVariant: 'default',
133
- temperature: null,
134
- topP: null,
135
80
  systemPrompt: `You are API Designer. Formulate robust, versioned REST/RPC contract specs.`,
136
81
  },
137
82
  {
@@ -139,11 +84,6 @@ export const specialistAgents: AgentItem[] = [
139
84
  name: 'ui-craftsman',
140
85
  description: 'Focuses on pixel-perfect micro-interactions, optical hierarchy, and theme variables.',
141
86
  scope: 'user',
142
- mode: 'subagent',
143
- overrideModel: 'Not selected',
144
- thinkingVariant: 'default',
145
- temperature: null,
146
- topP: null,
147
87
  systemPrompt: `You are UI Craftsman. Apply refined typographic hierarchy, e-ink monochrome aesthetics, and seamless UI details.`,
148
88
  },
149
89
  {
@@ -151,11 +91,6 @@ export const specialistAgents: AgentItem[] = [
151
91
  name: 'lint-fixer',
152
92
  description: 'Automates lint corrections, TypeScript error isolation, and unused import pruning.',
153
93
  scope: 'user',
154
- mode: 'subagent',
155
- overrideModel: 'Not selected',
156
- thinkingVariant: 'default',
157
- temperature: null,
158
- topP: null,
159
94
  systemPrompt: `You are Lint Fixer. Fix TypeScript errors and linter violations without altering runtime logic.`,
160
95
  },
161
96
  {
@@ -163,11 +98,6 @@ export const specialistAgents: AgentItem[] = [
163
98
  name: 'bundle-optimizer',
164
99
  description: 'Analyzes tree-shaking, vendor chunks, and code-splitting boundaries.',
165
100
  scope: 'user',
166
- mode: 'subagent',
167
- overrideModel: 'Not selected',
168
- thinkingVariant: 'default',
169
- temperature: null,
170
- topP: null,
171
101
  systemPrompt: `You are Bundle Optimizer. Reduce bundle weights, split dynamic imports, and speed up cold boots.`,
172
102
  },
173
103
  {
@@ -175,11 +105,6 @@ export const specialistAgents: AgentItem[] = [
175
105
  name: 'migration-agent',
176
106
  description: 'Upgrades dependencies, handles breaking framework changes, and codemods.',
177
107
  scope: 'user',
178
- mode: 'subagent',
179
- overrideModel: 'Not selected',
180
- thinkingVariant: 'default',
181
- temperature: null,
182
- topP: null,
183
108
  systemPrompt: `You are Migration Agent. Plan and execute library version upgrades with minimal disruption.`,
184
109
  },
185
110
  {
@@ -187,11 +112,6 @@ export const specialistAgents: AgentItem[] = [
187
112
  name: 'refactor-pro',
188
113
  description: 'Decomposes monolithic files, extracts clean interfaces, and refactors logic.',
189
114
  scope: 'user',
190
- mode: 'subagent',
191
- overrideModel: 'Not selected',
192
- thinkingVariant: 'default',
193
- temperature: null,
194
- topP: null,
195
115
  systemPrompt: `You are Refactor Pro. Extract reusable modules, keep files under 350 lines, and improve maintainability.`,
196
116
  },
197
117
  {
@@ -199,11 +119,6 @@ export const specialistAgents: AgentItem[] = [
199
119
  name: 'release-manager',
200
120
  description: 'Coordinates semver tagging, changelog compilation, and release artifact checks.',
201
121
  scope: 'user',
202
- mode: 'subagent',
203
- overrideModel: 'Not selected',
204
- thinkingVariant: 'default',
205
- temperature: null,
206
- topP: null,
207
122
  systemPrompt: `You are Release Manager. Draft changelogs and verify release readiness.`,
208
123
  },
209
124
  {
@@ -211,11 +126,6 @@ export const specialistAgents: AgentItem[] = [
211
126
  name: 'i18n-translator',
212
127
  description: 'Manages multilingual resource bundles and localization keys.',
213
128
  scope: 'user',
214
- mode: 'subagent',
215
- overrideModel: 'Not selected',
216
- thinkingVariant: 'default',
217
- temperature: null,
218
- topP: null,
219
129
  systemPrompt: `You are i18n Translator. Maintain localization catalogs and key-value translations.`,
220
130
  },
221
131
  {
@@ -223,11 +133,6 @@ export const specialistAgents: AgentItem[] = [
223
133
  name: 'e2e-runner',
224
134
  description: 'Executes Playwright end-to-end user journeys and assertions.',
225
135
  scope: 'user',
226
- mode: 'subagent',
227
- overrideModel: 'Not selected',
228
- thinkingVariant: 'default',
229
- temperature: null,
230
- topP: null,
231
136
  systemPrompt: `You are E2E Runner. Script and verify Playwright browser interactions across scenarios.`,
232
137
  },
233
138
  {
@@ -235,11 +140,6 @@ export const specialistAgents: AgentItem[] = [
235
140
  name: 'accessibility-tester',
236
141
  description: 'Audits WCAG AA contrast, keyboard navigation, and ARIA attributes.',
237
142
  scope: 'user',
238
- mode: 'subagent',
239
- overrideModel: 'Not selected',
240
- thinkingVariant: 'default',
241
- temperature: null,
242
- topP: null,
243
143
  systemPrompt: `You are Accessibility Tester. Enforce keyboard navigability, screen reader attributes, and contrast ratios.`,
244
144
  },
245
145
  ];
@@ -1,129 +1,179 @@
1
- import type { BreakdownRow, BreakdownTab, CadenceType, ChartSeriesPoint, TimeRangeOption, TimeRangeType, TokenUsageMetricSet } from '@/shared/types';
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
2
5
 
3
- export const TIME_RANGES: TimeRangeOption[] = [
4
- { id: 'today', label: 'Today', dateRange: 'Sep 7, 2026' },
5
- { id: '7d', label: 'Last 7 days', dateRange: 'Sep 1 to Sep 7' },
6
- { id: '30d', label: 'Last 30 days', dateRange: 'Aug 8 to Sep 7' },
7
- { id: '90d', label: 'Last 90 days', dateRange: 'Jun 9 to Sep 7' },
8
- { id: 'all', label: 'All time', dateRange: 'Jan 1 to Sep 7' },
9
- { id: 'custom', label: 'Custom…', dateRange: 'Custom period' },
10
- ];
6
+ /**
7
+ * Deterministic demo payload for the Token Usage panel under MOCK mode.
8
+ *
9
+ * Built through the same `TokenUsagePayload` shape the real route answers with,
10
+ * so a demo-only field can never exist and a real-only field can never be
11
+ * missing from the demo — that divergence is how a panel renders correctly in
12
+ * one mode and crashes in the other.
13
+ *
14
+ * The numbers are a plausible month for two providers sharing one model id,
15
+ * which is exactly the case the breakdown exists to separate.
16
+ */
11
17
 
12
- export const MOCK_RANGE_DATA: Record<Exclude<TimeRangeType, 'custom'>, TokenUsageMetricSet> = {
13
- today: {
14
- rawCost: '$0.01',
15
- processedTokens: '320K',
16
- activeRate: '320K per active day',
17
- cachedInput: '275K',
18
- cachedPercent: '85.9% of observed input',
19
- uncachedInput: '38.2K',
20
- outputTokens: '6.8K',
21
- reasoning: 'includes 2.9K reasoning',
22
- cacheSavings: '$0.00',
23
- scannedTranscripts: 3,
24
- usageRecords: 14,
25
- },
26
- '7d': {
27
- rawCost: '$0.04',
28
- processedTokens: '1.24M',
29
- activeRate: '248K per active day',
30
- cachedInput: '1.08M',
31
- cachedPercent: '87.0% of observed input',
32
- uncachedInput: '142.5K',
33
- outputTokens: '17.5K',
34
- reasoning: 'includes 7.1K reasoning',
35
- cacheSavings: '$0.00',
36
- scannedTranscripts: 7,
37
- usageRecords: 38,
38
- },
39
- '30d': {
40
- rawCost: '$0.10',
41
- processedTokens: '3.08M',
42
- activeRate: '1.54M per active day',
43
- cachedInput: '2.65M',
44
- cachedPercent: '87.2% of observed input',
45
- uncachedInput: '390.7K',
46
- outputTokens: '34.1K',
47
- reasoning: 'includes 14.5K reasoning',
48
- cacheSavings: '$0.00',
49
- scannedTranscripts: 12,
50
- usageRecords: 78,
18
+ import { dayRangeLabel, dayWindow, localDayKey, timeRangeOptions } from '@/shared/lib/usage/range';
19
+ import type {
20
+ TimeRangeType,
21
+ TokenUsagePayload,
22
+ UsageDayRow,
23
+ UsageProviderRow,
24
+ UsageProjectRow,
25
+ } from '@/shared/types';
26
+
27
+ const DAY_MS = 24 * 60 * 60 * 1000;
28
+
29
+ /** A record's worth of counters, so every row sums the same way. */
30
+ function counters(cost: number, tokens: number, records: number) {
31
+ const cacheRead = Math.round(tokens * 0.965);
32
+ const input = Math.round(tokens * 0.028);
33
+ const output = tokens - cacheRead - input;
34
+ return {
35
+ cost, tokens, input, output, cacheRead, cacheWrite: 0,
36
+ reasoning: Math.round(output * 0.21), cacheReadCost: cost * 0.12,
37
+ records, unpriced: 0,
38
+ };
39
+ }
40
+
41
+ const PROVIDER_BASE: Array<{ id: string; name: string; models: Array<[string, number, number, number]> }> = [
42
+ {
43
+ id: 'kenari-jatis',
44
+ name: 'Kenari Jatis',
45
+ models: [['deepseek-v4-1-flash', 38.42, 210_400_000, 1_120]],
51
46
  },
52
- '90d': {
53
- rawCost: '$0.38',
54
- processedTokens: '11.4M',
55
- activeRate: '1.42M per active day',
56
- cachedInput: '9.82M',
57
- cachedPercent: '86.1% of observed input',
58
- uncachedInput: '1.34M',
59
- outputTokens: '240K',
60
- reasoning: 'includes 102K reasoning',
61
- cacheSavings: '$0.00',
62
- scannedTranscripts: 34,
63
- usageRecords: 215,
47
+ {
48
+ id: 'kenari',
49
+ name: 'Kenari.id',
50
+ models: [
51
+ ['deepseek-v4-1-flash', 5.18, 190_200_000, 980],
52
+ ['minimax-m3', 2.71, 41_800_000, 214],
53
+ ['glm-5-3-flash', 0.42, 22_100_000, 168],
54
+ ],
64
55
  },
65
- all: {
66
- rawCost: '$1.24',
67
- processedTokens: '38.6M',
68
- activeRate: '1.28M per active day',
69
- cachedInput: '33.1M',
70
- cachedPercent: '85.7% of observed input',
71
- uncachedInput: '4.82M',
72
- outputTokens: '680K',
73
- reasoning: 'includes 294K reasoning',
74
- cacheSavings: '$0.00',
75
- scannedTranscripts: 89,
76
- usageRecords: 642,
56
+ {
57
+ id: 'deepseek',
58
+ name: 'DeepSeek',
59
+ models: [
60
+ ['deepseek-flash', 1.96, 64_300_000, 402],
61
+ ['deepseek-v4-pro', 0.61, 8_400_000, 96],
62
+ ],
77
63
  },
78
- };
64
+ ];
65
+
66
+ /** The provider → model tree for one period, scaled from the base numbers. */
67
+ function providersFor(scale: number): UsageProviderRow[] {
68
+ return PROVIDER_BASE.map((provider) => {
69
+ const models = provider.models.map(([model, cost, tokens, records]) => ({
70
+ model,
71
+ ...counters(cost * scale, Math.round(tokens * scale), Math.round(records * scale)),
72
+ }));
73
+ const summed = models.reduce(
74
+ (acc, model) => {
75
+ acc.cost += model.cost;
76
+ acc.tokens += model.tokens;
77
+ acc.input += model.input;
78
+ acc.output += model.output;
79
+ acc.cacheRead += model.cacheRead;
80
+ acc.cacheWrite += model.cacheWrite;
81
+ acc.reasoning += model.reasoning;
82
+ acc.cacheReadCost += model.cacheReadCost;
83
+ acc.records += model.records;
84
+ acc.unpriced += model.unpriced;
85
+ return acc;
86
+ },
87
+ { cost: 0, tokens: 0, input: 0, output: 0, cacheRead: 0, cacheWrite: 0, reasoning: 0, cacheReadCost: 0, records: 0, unpriced: 0 },
88
+ );
89
+ return { id: provider.id, name: provider.name, models, ...summed };
90
+ }).sort((a, b) => b.cost - a.cost);
91
+ }
92
+
93
+ /** Days covered by a range, newest last, with a plausible weekend shape. */
94
+ function daysFor(range: TimeRangeType, now: number): UsageDayRow[] {
95
+ const window = dayWindow(range, now);
96
+ const dayCount = window
97
+ ? Math.max(1, Math.round((Date.parse(`${window.to}T00:00:00`) - Date.parse(`${window.from}T00:00:00`)) / DAY_MS) + 1)
98
+ : 30;
99
+ const days: UsageDayRow[] = [];
100
+ for (let offset = dayCount - 1; offset >= 0; offset--) {
101
+ const at = now - offset * DAY_MS;
102
+ const dayKey = localDayKey(at);
103
+ if (window && (dayKey < window.from || dayKey > window.to)) continue;
104
+ const weekday = new Date(at).getDay();
105
+ const weekend = weekday === 0 || weekday === 6;
106
+ const weight = weekend ? 0.35 : 1;
107
+ const providers: Record<string, { cost: number; tokens: number }> = {
108
+ 'kenari-jatis': { cost: 1.24 * weight, tokens: Math.round(6_900_000 * weight) },
109
+ kenari: { cost: 0.24 * weight, tokens: Math.round(6_600_000 * weight) },
110
+ deepseek: { cost: 0.08 * weight, tokens: Math.round(2_200_000 * weight) },
111
+ };
112
+ const cost = Object.values(providers).reduce((sum, split) => sum + split.cost, 0);
113
+ const tokens = Object.values(providers).reduce((sum, split) => sum + split.tokens, 0);
114
+ days.push({ day: dayKey, providers, ...counters(cost, tokens, Math.round(weight * 78)) });
115
+ }
116
+ return days;
117
+ }
118
+
119
+ const PROJECTS = ['kabmo', 'omp', 'notes', 'scratch'];
79
120
 
80
- export const BREAKDOWN_DATA: Record<BreakdownTab, BreakdownRow[]> = {
81
- model: [
82
- { name: 'deepseek-v4-flash', cost: '$0.06', share: '63.7%', tokens: '2.0M', sharePercent: 63.7, dotColorClass: 'bg-ink/80' },
83
- { name: 'deepseek-v4-flash-vi...', cost: '$0.03', share: '28.0%', tokens: '1.0M', sharePercent: 28.0, dotColorClass: 'bg-ink/50' },
84
- { name: 'deepseek-v4-pro', cost: '$0.008', share: '8.3%', tokens: '18K', sharePercent: 8.3, dotColorClass: 'bg-transparent border border-ink/40' },
85
- ],
86
- day: [
87
- { name: 'Sep 07 (Today)', cost: '$0.054', share: '54.0%', tokens: '1.8M', sharePercent: 54.0, dotColorClass: 'bg-ink/80' },
88
- { name: 'Sep 06', cost: '$0.032', share: '32.0%', tokens: '950K', sharePercent: 32.0, dotColorClass: 'bg-ink/50' },
89
- { name: 'Sep 05', cost: '$0.014', share: '14.0%', tokens: '330K', sharePercent: 14.0, dotColorClass: 'bg-transparent border border-ink/40' },
90
- ],
91
- project: [
92
- { name: 'kabmo-core', cost: '$0.068', share: '68.0%', tokens: '2.1M', sharePercent: 68.0, dotColorClass: 'bg-ink/80' },
93
- { name: 'agent-runner', cost: '$0.022', share: '22.0%', tokens: '680K', sharePercent: 22.0, dotColorClass: 'bg-ink/50' },
94
- { name: 'remis-edge-runtime', cost: '$0.010', share: '10.0%', tokens: '300K', sharePercent: 10.0, dotColorClass: 'bg-transparent border border-ink/40' },
95
- ],
96
- };
121
+ function projectsFor(scale: number): UsageProjectRow[] {
122
+ const shares = [0.62, 0.24, 0.1, 0.04];
123
+ return PROJECTS.map((project, index) => ({
124
+ project,
125
+ ...counters(
126
+ Number((48.3 * scale * shares[index]).toFixed(2)),
127
+ Math.round(528_000_000 * scale * shares[index]),
128
+ Math.round(2_980 * scale * shares[index]),
129
+ ),
130
+ }));
131
+ }
97
132
 
98
- const point = (label: string, cost: number, tokens: number): ChartSeriesPoint => ({ label, cost, tokens });
133
+ /** Demo payload for the requested range. */
134
+ export function mockTokenUsagePayload(range: TimeRangeType, now: number = Date.now()): TokenUsagePayload {
135
+ const window = dayWindow(range, now);
136
+ const scale = range === 'today' ? 0.04 : range === '7d' ? 0.24 : range === '90d' ? 2.6 : range === 'all' ? 3.4 : 1;
137
+ const providers = providersFor(scale);
138
+ const days = daysFor(range, now);
139
+ const projects = projectsFor(scale);
99
140
 
100
- export const MOCK_CUSTOM_RANGE_DATA: TokenUsageMetricSet = {
101
- rawCost: '$0.07',
102
- processedTokens: '2.16M',
103
- activeRate: '9 active days',
104
- cachedInput: '1.86M',
105
- cachedPercent: '86.1% of observed input',
106
- uncachedInput: '271.4K',
107
- outputTokens: '24.3K',
108
- reasoning: 'includes 10.2K reasoning',
109
- cacheSavings: '$0.00',
110
- scannedTranscripts: 9,
111
- usageRecords: 57,
112
- };
141
+ const totals = providers.reduce(
142
+ (acc, provider) => {
143
+ acc.cost += provider.cost;
144
+ acc.tokens += provider.tokens;
145
+ acc.input += provider.input;
146
+ acc.output += provider.output;
147
+ acc.cacheRead += provider.cacheRead;
148
+ acc.cacheWrite += provider.cacheWrite;
149
+ acc.reasoning += provider.reasoning;
150
+ acc.cacheReadCost += provider.cacheReadCost;
151
+ acc.records += provider.records;
152
+ acc.unpriced += provider.unpriced;
153
+ return acc;
154
+ },
155
+ {
156
+ cost: 0, tokens: 0, input: 0, output: 0, cacheRead: 0, cacheWrite: 0,
157
+ reasoning: 0, cacheReadCost: 0, records: 0, unpriced: 0,
158
+ activeDays: days.length,
159
+ },
160
+ );
113
161
 
114
- export const MOCK_CHART_SERIES: Record<CadenceType, ChartSeriesPoint[]> = {
115
- daily: [
116
- point('Aug 8', 0.004, 210_000), point('Aug 11', 0.002, 95_000), point('Aug 14', 0.008, 310_000),
117
- point('Aug 17', 0.003, 150_000), point('Aug 20', 0.011, 420_000), point('Aug 23', 0.005, 240_000),
118
- point('Aug 26', 0.007, 330_000), point('Aug 29', 0.014, 560_000), point('Sep 1', 0.006, 280_000),
119
- point('Sep 4', 0.016, 640_000), point('Sep 7', 0.024, 880_000),
120
- ],
121
- weekly: [
122
- point('Aug 10', 0.014, 520_000), point('Aug 17', 0.019, 760_000), point('Aug 24', 0.026, 1_120_000),
123
- point('Aug 31', 0.031, 1_380_000), point('Sep 7', 0.052, 2_290_000),
124
- ],
125
- monthly: [
126
- point('Jun', 0.081, 3_120_000), point('Jul', 0.148, 5_640_000), point('Aug', 0.512, 16_860_000),
127
- point('Sep', 0.499, 12_980_000),
128
- ],
129
- };
162
+ return {
163
+ generatedAt: now,
164
+ index: {
165
+ state: 'ready',
166
+ transcripts: 1_225,
167
+ records: 143_969,
168
+ indexedAt: now,
169
+ scanMs: 4_120,
170
+ },
171
+ timeRanges: timeRangeOptions(now),
172
+ range,
173
+ periodLabel: window ? dayRangeLabel(window.from, window.to, now) : 'All time',
174
+ totals,
175
+ providers,
176
+ days,
177
+ projects,
178
+ };
179
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "source": "@oh-my-pi/pi-coding-agent 10 tabs / 579 settings",
2
+ "source": "@oh-my-pi/pi-coding-agent 10 tabs / 582 settings",
3
3
  "tabs": [
4
4
  {
5
5
  "id": "appearance",
@@ -937,6 +937,16 @@
937
937
  "description": "When steering messages interrupt tool execution"
938
938
  }
939
939
  },
940
+ "btw.inject": {
941
+ "type": "boolean",
942
+ "default": false,
943
+ "ui": {
944
+ "tab": "interaction",
945
+ "group": "Input",
946
+ "label": "/btw Steering Inject",
947
+ "description": "When you ask /btw for a steering prompt, it drafts one in <inject> tags, highlighted in the answer; Alt+I (app.btw.inject) sends it to the main session"
948
+ }
949
+ },
940
950
  "tui.vimMode": {
941
951
  "type": "boolean",
942
952
  "default": false,
@@ -1203,6 +1213,17 @@
1203
1213
  "description": "After a completed turn, ask the active model to predict your next message and show it as ghost text in the empty composer; Tab or Right inserts it without sending. Extra usage: every completed turn sends one more billed request over the whole conversation (counted in /stats)"
1204
1214
  }
1205
1215
  },
1216
+ "composer.predictionAlternatives": {
1217
+ "type": "boolean",
1218
+ "default": false,
1219
+ "ui": {
1220
+ "tab": "interaction",
1221
+ "group": "Input",
1222
+ "label": "Prediction Alternatives",
1223
+ "description": "Ask for up to four distinct predictions instead of one, most likely first. The ghost text shows the first one your draft matches; after inserting one, press Tab again to pick another. The same single request returns a few more output tokens",
1224
+ "condition": "composerPredictionsEnabled"
1225
+ }
1226
+ },
1206
1227
  "spelling.autocorrect": {
1207
1228
  "type": "boolean",
1208
1229
  "default": false,
@@ -5152,6 +5173,17 @@
5152
5173
  "condition": "hindsightActive"
5153
5174
  }
5154
5175
  },
5176
+ "hindsight.globalScope": {
5177
+ "type": "boolean",
5178
+ "default": false,
5179
+ "ui": {
5180
+ "tab": "memory",
5181
+ "group": "Hindsight",
5182
+ "label": "Hindsight Global Scope",
5183
+ "description": "Let retain and learn take scope: global, which stores a memory without the project tag so every project recalls it. Needs global or per-project-tagged scoping",
5184
+ "condition": "hindsightActive"
5185
+ }
5186
+ },
5155
5187
  "hindsight.autoRecall": {
5156
5188
  "type": "boolean",
5157
5189
  "default": true,