@polderlabs/bizar 7.0.2 → 8.0.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 (490) hide show
  1. package/.claude/settings.local.json +8 -0
  2. package/bizar-dash/DESIGN.md +729 -969
  3. package/bizar-dash/GLYPH.md +418 -0
  4. package/bizar-dash/PLAN.md +1135 -0
  5. package/bizar-dash/dist/assets/ActivityFeed-BRBtQOHB.js +6 -0
  6. package/bizar-dash/dist/assets/ActivityFeed-BRBtQOHB.js.map +1 -0
  7. package/bizar-dash/dist/assets/ActivityView-CwqhxBfh.js +1 -0
  8. package/bizar-dash/dist/assets/ActivityView-CwqhxBfh.js.map +1 -0
  9. package/bizar-dash/dist/assets/AgentActivity-6MxU-a9F.js +1 -0
  10. package/bizar-dash/dist/assets/AgentActivity-6MxU-a9F.js.map +1 -0
  11. package/bizar-dash/dist/assets/AgentsView-BYrOFdwl.js +8 -0
  12. package/bizar-dash/dist/assets/AgentsView-BYrOFdwl.js.map +1 -0
  13. package/bizar-dash/dist/assets/Badge-Cd61wsBa.js +1 -0
  14. package/bizar-dash/dist/assets/Badge-Cd61wsBa.js.map +1 -0
  15. package/bizar-dash/dist/assets/Card-C_bvqXdQ.js +1 -0
  16. package/bizar-dash/dist/assets/Card-C_bvqXdQ.js.map +1 -0
  17. package/bizar-dash/dist/assets/EmptyState-BWQuKnk9.js +1 -0
  18. package/bizar-dash/dist/assets/EmptyState-BWQuKnk9.js.map +1 -0
  19. package/bizar-dash/dist/assets/GoalsView-Dok0yt9S.js +11 -0
  20. package/bizar-dash/dist/assets/GoalsView-Dok0yt9S.js.map +1 -0
  21. package/bizar-dash/dist/assets/Grid-C62gCPqt.js +1 -0
  22. package/bizar-dash/dist/assets/Grid-C62gCPqt.js.map +1 -0
  23. package/bizar-dash/dist/assets/KanbanCard-CtTKP6ZX.js +21 -0
  24. package/bizar-dash/dist/assets/KanbanCard-CtTKP6ZX.js.map +1 -0
  25. package/bizar-dash/dist/assets/LibrariesView-BcyBQXiY.js +67 -0
  26. package/bizar-dash/dist/assets/LibrariesView-BcyBQXiY.js.map +1 -0
  27. package/bizar-dash/dist/assets/MemoryView-49wR4u-y.js +13 -0
  28. package/bizar-dash/dist/assets/MemoryView-49wR4u-y.js.map +1 -0
  29. package/bizar-dash/dist/assets/OverviewView-BtQ_UWYj.js +1 -0
  30. package/bizar-dash/dist/assets/OverviewView-BtQ_UWYj.js.map +1 -0
  31. package/bizar-dash/dist/assets/ProgressBar-CpvDeq9F.js +1 -0
  32. package/bizar-dash/dist/assets/ProgressBar-CpvDeq9F.js.map +1 -0
  33. package/bizar-dash/dist/assets/SettingsRow-DmIe5OUu.js +30 -0
  34. package/bizar-dash/dist/assets/SettingsRow-DmIe5OUu.js.map +1 -0
  35. package/bizar-dash/dist/assets/SettingsView-D1KmGWbi.js +48 -0
  36. package/bizar-dash/dist/assets/SettingsView-D1KmGWbi.js.map +1 -0
  37. package/bizar-dash/dist/assets/StatTile-BkIP32gG.js +11 -0
  38. package/bizar-dash/dist/assets/StatTile-BkIP32gG.js.map +1 -0
  39. package/bizar-dash/dist/assets/TasksView-Cba3GJ42.js +1 -0
  40. package/bizar-dash/dist/assets/TasksView-Cba3GJ42.js.map +1 -0
  41. package/bizar-dash/dist/assets/ViewHeader-D6c2cw1b.js +6 -0
  42. package/bizar-dash/dist/assets/ViewHeader-D6c2cw1b.js.map +1 -0
  43. package/bizar-dash/dist/assets/brain-DeoXNDE2.js +6 -0
  44. package/bizar-dash/dist/assets/brain-DeoXNDE2.js.map +1 -0
  45. package/bizar-dash/dist/assets/calendar-DRlQkGJc.js +6 -0
  46. package/bizar-dash/dist/assets/calendar-DRlQkGJc.js.map +1 -0
  47. package/bizar-dash/dist/assets/circle-check-DmYQ3vGp.js +6 -0
  48. package/bizar-dash/dist/assets/circle-check-DmYQ3vGp.js.map +1 -0
  49. package/bizar-dash/dist/assets/cmdk-BwN8hcKQ.js +80 -0
  50. package/bizar-dash/dist/assets/cmdk-BwN8hcKQ.js.map +1 -0
  51. package/bizar-dash/dist/assets/dnd-kit-DR2Qzzxk.js +5 -0
  52. package/bizar-dash/dist/assets/dnd-kit-DR2Qzzxk.js.map +1 -0
  53. package/bizar-dash/dist/assets/git-merge-OoqBKQer.js +6 -0
  54. package/bizar-dash/dist/assets/git-merge-OoqBKQer.js.map +1 -0
  55. package/bizar-dash/dist/assets/git-pull-request-CXBQTR2f.js +6 -0
  56. package/bizar-dash/dist/assets/git-pull-request-CXBQTR2f.js.map +1 -0
  57. package/bizar-dash/dist/assets/main-COdgjqbZ.css +1 -0
  58. package/bizar-dash/dist/assets/main-Cw6gybzS.js +109 -0
  59. package/bizar-dash/dist/assets/main-Cw6gybzS.js.map +1 -0
  60. package/bizar-dash/dist/assets/message-square-DUTeIQAR.js +6 -0
  61. package/bizar-dash/dist/assets/message-square-DUTeIQAR.js.map +1 -0
  62. package/bizar-dash/dist/assets/minus-CrStJTZ7.js +6 -0
  63. package/bizar-dash/dist/assets/minus-CrStJTZ7.js.map +1 -0
  64. package/bizar-dash/dist/assets/wrench-BJ1WIC4u.js +6 -0
  65. package/bizar-dash/dist/assets/wrench-BJ1WIC4u.js.map +1 -0
  66. package/bizar-dash/dist/{mobile.html → v8.html} +6 -9
  67. package/bizar-dash/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  68. package/bizar-dash/src/server/server.mjs +1 -57
  69. package/bizar-dash/src/web/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  70. package/bizar-dash/src/web/v8/App.tsx +188 -0
  71. package/bizar-dash/src/web/v8/__tests__/App.test.tsx +102 -0
  72. package/bizar-dash/src/web/v8/__tests__/AppShell.test.tsx +79 -0
  73. package/bizar-dash/src/web/v8/__tests__/PageSkeleton.test.tsx +12 -0
  74. package/bizar-dash/src/web/v8/__tests__/SettingsView.test.tsx +84 -0
  75. package/bizar-dash/src/web/v8/__tests__/Sidebar.test.tsx +95 -0
  76. package/bizar-dash/src/web/v8/__tests__/activity.test.tsx +63 -0
  77. package/bizar-dash/src/web/v8/__tests__/agents.test.tsx +90 -0
  78. package/bizar-dash/src/web/v8/__tests__/controls.test.tsx +135 -0
  79. package/bizar-dash/src/web/v8/__tests__/cx.test.ts +25 -0
  80. package/bizar-dash/src/web/v8/__tests__/data.test.tsx +293 -0
  81. package/bizar-dash/src/web/v8/__tests__/feedback.test.tsx +213 -0
  82. package/bizar-dash/src/web/v8/__tests__/goals.test.tsx +105 -0
  83. package/bizar-dash/src/web/v8/__tests__/kanban.test.tsx +176 -0
  84. package/bizar-dash/src/web/v8/__tests__/libraries.test.tsx +70 -0
  85. package/bizar-dash/src/web/v8/__tests__/memory.test.tsx +60 -0
  86. package/bizar-dash/src/web/v8/__tests__/navigation.test.tsx +137 -0
  87. package/bizar-dash/src/web/v8/__tests__/settings.test.tsx +104 -0
  88. package/bizar-dash/src/web/v8/__tests__/theme.test.tsx +98 -0
  89. package/bizar-dash/src/web/v8/__tests__/views.test.tsx +112 -0
  90. package/bizar-dash/src/web/v8/main.tsx +28 -0
  91. package/bizar-dash/src/web/v8/shell/AppShell.tsx +90 -0
  92. package/bizar-dash/src/web/v8/shell/PageSkeleton.tsx +29 -0
  93. package/bizar-dash/src/web/v8/shell/Sidebar.tsx +361 -0
  94. package/bizar-dash/src/web/v8/shell/StatusBar.tsx +63 -0
  95. package/bizar-dash/src/web/v8/shell/Topbar.tsx +113 -0
  96. package/bizar-dash/src/web/v8/shell/index.ts +15 -0
  97. package/bizar-dash/src/web/v8/ui/activity/ActivityFeed.tsx +137 -0
  98. package/bizar-dash/src/web/v8/ui/agents/AgentActivity.tsx +101 -0
  99. package/bizar-dash/src/web/v8/ui/agents/AgentCard.tsx +158 -0
  100. package/bizar-dash/src/web/v8/ui/controls/Button.tsx +141 -0
  101. package/bizar-dash/src/web/v8/ui/controls/ButtonGroup.tsx +32 -0
  102. package/bizar-dash/src/web/v8/ui/controls/Checkbox.tsx +49 -0
  103. package/bizar-dash/src/web/v8/ui/controls/Field.tsx +78 -0
  104. package/bizar-dash/src/web/v8/ui/controls/Form.tsx +23 -0
  105. package/bizar-dash/src/web/v8/ui/controls/IconButton.tsx +112 -0
  106. package/bizar-dash/src/web/v8/ui/controls/Input.tsx +94 -0
  107. package/bizar-dash/src/web/v8/ui/controls/RadioGroup.tsx +74 -0
  108. package/bizar-dash/src/web/v8/ui/controls/Select.tsx +171 -0
  109. package/bizar-dash/src/web/v8/ui/controls/Slider.tsx +68 -0
  110. package/bizar-dash/src/web/v8/ui/controls/Switch.tsx +56 -0
  111. package/bizar-dash/src/web/v8/ui/controls/Textarea.tsx +64 -0
  112. package/bizar-dash/src/web/v8/ui/controls/Toggle.tsx +36 -0
  113. package/bizar-dash/src/web/v8/ui/controls/ToggleGroup.tsx +85 -0
  114. package/bizar-dash/src/web/v8/ui/data/Accordion.tsx +134 -0
  115. package/bizar-dash/src/web/v8/ui/data/Avatar.tsx +175 -0
  116. package/bizar-dash/src/web/v8/ui/data/Badge.tsx +93 -0
  117. package/bizar-dash/src/web/v8/ui/data/BarList.tsx +101 -0
  118. package/bizar-dash/src/web/v8/ui/data/Card.tsx +140 -0
  119. package/bizar-dash/src/web/v8/ui/data/Chip.tsx +96 -0
  120. package/bizar-dash/src/web/v8/ui/data/Kbd.tsx +42 -0
  121. package/bizar-dash/src/web/v8/ui/data/ProgressBar.tsx +93 -0
  122. package/bizar-dash/src/web/v8/ui/data/Sparkline.tsx +98 -0
  123. package/bizar-dash/src/web/v8/ui/data/StatTile.tsx +150 -0
  124. package/bizar-dash/src/web/v8/ui/data/Table.tsx +170 -0
  125. package/bizar-dash/src/web/v8/ui/data/Timeline.tsx +130 -0
  126. package/bizar-dash/src/web/v8/ui/data/ViewHeader.tsx +122 -0
  127. package/bizar-dash/src/web/v8/ui/feedback/Alert.tsx +95 -0
  128. package/bizar-dash/src/web/v8/ui/feedback/Banner.tsx +39 -0
  129. package/bizar-dash/src/web/v8/ui/feedback/ContextMenu.tsx +143 -0
  130. package/bizar-dash/src/web/v8/ui/feedback/Dialog.tsx +149 -0
  131. package/bizar-dash/src/web/v8/ui/feedback/Drawer.tsx +8 -0
  132. package/bizar-dash/src/web/v8/ui/feedback/DropdownMenu.tsx +231 -0
  133. package/bizar-dash/src/web/v8/ui/feedback/EmptyState.tsx +48 -0
  134. package/bizar-dash/src/web/v8/ui/feedback/Popover.tsx +56 -0
  135. package/bizar-dash/src/web/v8/ui/feedback/Sheet.tsx +103 -0
  136. package/bizar-dash/src/web/v8/ui/feedback/Skeleton.tsx +67 -0
  137. package/bizar-dash/src/web/v8/ui/feedback/Spinner.tsx +30 -0
  138. package/bizar-dash/src/web/v8/ui/feedback/Toast.tsx +66 -0
  139. package/bizar-dash/src/web/v8/ui/feedback/Tooltip.tsx +89 -0
  140. package/bizar-dash/src/web/v8/ui/goals/GoalCard.tsx +176 -0
  141. package/bizar-dash/src/web/v8/ui/goals/KeyResult.tsx +115 -0
  142. package/bizar-dash/src/web/v8/ui/index.ts +322 -0
  143. package/bizar-dash/src/web/v8/ui/kanban/KanbanBoard.tsx +80 -0
  144. package/bizar-dash/src/web/v8/ui/kanban/KanbanCard.tsx +247 -0
  145. package/bizar-dash/src/web/v8/ui/kanban/KanbanColumn.tsx +181 -0
  146. package/bizar-dash/src/web/v8/ui/kanban/KanbanContextMenu.tsx +122 -0
  147. package/bizar-dash/src/web/v8/ui/kanban/KanbanQuickAdd.tsx +141 -0
  148. package/bizar-dash/src/web/v8/ui/libraries/LibraryGrid.tsx +30 -0
  149. package/bizar-dash/src/web/v8/ui/libraries/LibraryItem.tsx +161 -0
  150. package/bizar-dash/src/web/v8/ui/memory/MemoryVault.tsx +144 -0
  151. package/bizar-dash/src/web/v8/ui/navigation/CommandPalette.tsx +224 -0
  152. package/bizar-dash/src/web/v8/ui/navigation/NavLink.tsx +81 -0
  153. package/bizar-dash/src/web/v8/ui/navigation/Pagination.tsx +164 -0
  154. package/bizar-dash/src/web/v8/ui/navigation/Tabs.tsx +128 -0
  155. package/bizar-dash/src/web/v8/ui/navigation/useCommandPaletteHotkey.test.ts +79 -0
  156. package/bizar-dash/src/web/v8/ui/primitives/Box.tsx +144 -0
  157. package/bizar-dash/src/web/v8/ui/primitives/Center.tsx +40 -0
  158. package/bizar-dash/src/web/v8/ui/primitives/Cluster.tsx +67 -0
  159. package/bizar-dash/src/web/v8/ui/primitives/Grid.tsx +104 -0
  160. package/bizar-dash/src/web/v8/ui/primitives/Inline.tsx +77 -0
  161. package/bizar-dash/src/web/v8/ui/primitives/Portal.tsx +33 -0
  162. package/bizar-dash/src/web/v8/ui/primitives/ScrollArea.tsx +62 -0
  163. package/bizar-dash/src/web/v8/ui/primitives/Separator.tsx +42 -0
  164. package/bizar-dash/src/web/v8/ui/primitives/Stack.tsx +73 -0
  165. package/bizar-dash/src/web/v8/ui/primitives/VisuallyHidden.tsx +49 -0
  166. package/bizar-dash/src/web/v8/ui/settings/SettingsNav.tsx +91 -0
  167. package/bizar-dash/src/web/v8/ui/settings/SettingsRow.tsx +88 -0
  168. package/bizar-dash/src/web/v8/ui/settings/SettingsSection.tsx +109 -0
  169. package/bizar-dash/src/web/v8/ui/styles/globals.css +220 -0
  170. package/bizar-dash/src/web/v8/ui/styles/reset.css +57 -0
  171. package/bizar-dash/src/web/v8/ui/styles/tokens.css +217 -0
  172. package/bizar-dash/src/web/v8/ui/theme/DensityProvider.test.tsx +74 -0
  173. package/bizar-dash/src/web/v8/ui/theme/DensityProvider.tsx +66 -0
  174. package/bizar-dash/src/web/v8/ui/theme/ThemeProvider.test.tsx +86 -0
  175. package/bizar-dash/src/web/v8/ui/theme/ThemeProvider.tsx +94 -0
  176. package/bizar-dash/src/web/v8/ui/theme/ThemeToggle.tsx +88 -0
  177. package/bizar-dash/src/web/v8/ui/theme/useDensity.ts +15 -0
  178. package/bizar-dash/src/web/v8/ui/theme/useTheme.ts +16 -0
  179. package/bizar-dash/src/web/v8/ui/utils/cx.ts +19 -0
  180. package/bizar-dash/src/web/v8/views/Activity/ActivityView.tsx +33 -0
  181. package/bizar-dash/src/web/v8/views/Agents/AgentsView.tsx +108 -0
  182. package/bizar-dash/src/web/v8/views/CommandPalette/AppCommandPalette.test.tsx +142 -0
  183. package/bizar-dash/src/web/v8/views/CommandPalette/AppCommandPalette.tsx +144 -0
  184. package/bizar-dash/src/web/v8/views/Goals/GoalsView.tsx +84 -0
  185. package/bizar-dash/src/web/v8/views/Libraries/LibrariesView.tsx +41 -0
  186. package/bizar-dash/src/web/v8/views/Memory/MemoryView.tsx +61 -0
  187. package/bizar-dash/src/web/v8/views/Overview/OverviewView.tsx +92 -0
  188. package/bizar-dash/src/web/v8/views/Router.tsx +96 -0
  189. package/bizar-dash/src/web/v8/views/Settings/SettingsView.tsx +305 -0
  190. package/bizar-dash/src/web/v8/views/Tasks/CommandPalettePlaceholder.tsx +106 -0
  191. package/bizar-dash/src/web/v8/views/Tasks/TasksKanbanPlaceholder.tsx +62 -0
  192. package/bizar-dash/src/web/v8/views/Tasks/TasksView.tsx +74 -0
  193. package/bizar-dash/src/web/v8/vite-env.d.ts +15 -0
  194. package/bizar-dash/src/web/{mobile.html → v8.html} +4 -7
  195. package/bizar-dash/tests/settings-layout.test.tsx +2 -2
  196. package/bizar-dash/tests/settings-nav.test.tsx +6 -6
  197. package/bizar-dash/tests/setup.ts +26 -0
  198. package/bizar-dash/vite.config.ts +26 -2
  199. package/bizar-dash/vitest.config.ts +5 -3
  200. package/cli/provision-claude.mjs +108 -5
  201. package/package.json +36 -3
  202. package/bizar-dash/dist/assets/EnvVarsSection-BfhAz3ax.js +0 -114
  203. package/bizar-dash/dist/assets/EnvVarsSection-BfhAz3ax.js.map +0 -1
  204. package/bizar-dash/dist/assets/MobileChat-DLWdv6tQ.js +0 -1
  205. package/bizar-dash/dist/assets/MobileChat-DLWdv6tQ.js.map +0 -1
  206. package/bizar-dash/dist/assets/MobileSettings-Bxv62uPY.js +0 -1
  207. package/bizar-dash/dist/assets/MobileSettings-Bxv62uPY.js.map +0 -1
  208. package/bizar-dash/dist/assets/Toast-ATSAmbdi.js +0 -26
  209. package/bizar-dash/dist/assets/Toast-ATSAmbdi.js.map +0 -1
  210. package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js +0 -1
  211. package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js.map +0 -1
  212. package/bizar-dash/dist/assets/main-306CZfn6.js +0 -430
  213. package/bizar-dash/dist/assets/main-306CZfn6.js.map +0 -1
  214. package/bizar-dash/dist/assets/main-G3bNDpY3.css +0 -1
  215. package/bizar-dash/dist/assets/mobile-C_naUN91.js +0 -1
  216. package/bizar-dash/dist/assets/mobile-C_naUN91.js.map +0 -1
  217. package/bizar-dash/dist/assets/mobile-layout-BWLtwtfQ.css +0 -1
  218. package/bizar-dash/dist/assets/mobile-layout-GZ3bE8L6.js +0 -211
  219. package/bizar-dash/dist/assets/mobile-layout-GZ3bE8L6.js.map +0 -1
  220. package/bizar-dash/dist/assets/useSlashCommands-BOwD7lNb.js +0 -65
  221. package/bizar-dash/dist/assets/useSlashCommands-BOwD7lNb.js.map +0 -1
  222. package/bizar-dash/dist/index.html +0 -43
  223. package/bizar-dash/src/web/App.tsx +0 -915
  224. package/bizar-dash/src/web/MobileApp.tsx +0 -414
  225. package/bizar-dash/src/web/components/ArtifactCreateDialog.tsx +0 -95
  226. package/bizar-dash/src/web/components/ArtifactListDialog.tsx +0 -55
  227. package/bizar-dash/src/web/components/ArtifactViewer.tsx +0 -144
  228. package/bizar-dash/src/web/components/AuditDialog.tsx +0 -79
  229. package/bizar-dash/src/web/components/AutosaveField.tsx +0 -50
  230. package/bizar-dash/src/web/components/BackupRestore.tsx +0 -330
  231. package/bizar-dash/src/web/components/BgStatusBadge.tsx +0 -32
  232. package/bizar-dash/src/web/components/Button.tsx +0 -56
  233. package/bizar-dash/src/web/components/CanvasContextMenu.tsx +0 -68
  234. package/bizar-dash/src/web/components/Card.tsx +0 -40
  235. package/bizar-dash/src/web/components/CollapsibleSection.tsx +0 -72
  236. package/bizar-dash/src/web/components/CommandDialog.tsx +0 -66
  237. package/bizar-dash/src/web/components/DoctorPanel.tsx +0 -160
  238. package/bizar-dash/src/web/components/EmptyState.tsx +0 -30
  239. package/bizar-dash/src/web/components/EnvVarManager.tsx +0 -430
  240. package/bizar-dash/src/web/components/EvalDiff.tsx +0 -157
  241. package/bizar-dash/src/web/components/EvalExportButton.tsx +0 -27
  242. package/bizar-dash/src/web/components/EvalRunCard.tsx +0 -78
  243. package/bizar-dash/src/web/components/FileBrowser.tsx +0 -633
  244. package/bizar-dash/src/web/components/HeadroomSettings.tsx +0 -418
  245. package/bizar-dash/src/web/components/HeadroomStatus.tsx +0 -158
  246. package/bizar-dash/src/web/components/HelpDialog.tsx +0 -55
  247. package/bizar-dash/src/web/components/InviteDialog.tsx +0 -205
  248. package/bizar-dash/src/web/components/KillConfirmDialog.tsx +0 -88
  249. package/bizar-dash/src/web/components/MobileBottomNav.tsx +0 -38
  250. package/bizar-dash/src/web/components/MobileDrawer.tsx +0 -68
  251. package/bizar-dash/src/web/components/MobileHeader.tsx +0 -50
  252. package/bizar-dash/src/web/components/MobileLayout.tsx +0 -63
  253. package/bizar-dash/src/web/components/Modal.tsx +0 -215
  254. package/bizar-dash/src/web/components/Notifications.tsx +0 -242
  255. package/bizar-dash/src/web/components/ScheduleTemplateCard.tsx +0 -72
  256. package/bizar-dash/src/web/components/ScreenshotCapture.tsx +0 -138
  257. package/bizar-dash/src/web/components/ScreenshotOCR.tsx +0 -42
  258. package/bizar-dash/src/web/components/SearchModal.tsx +0 -227
  259. package/bizar-dash/src/web/components/SettingsNav.tsx +0 -112
  260. package/bizar-dash/src/web/components/SettingsSearch.tsx +0 -328
  261. package/bizar-dash/src/web/components/Sidebar.tsx +0 -89
  262. package/bizar-dash/src/web/components/Spinner.tsx +0 -19
  263. package/bizar-dash/src/web/components/StatusBadge.tsx +0 -56
  264. package/bizar-dash/src/web/components/Tag.tsx +0 -41
  265. package/bizar-dash/src/web/components/TailscaleSettings.tsx +0 -161
  266. package/bizar-dash/src/web/components/TaskCard.tsx +0 -69
  267. package/bizar-dash/src/web/components/TaskCreateSheet.tsx +0 -76
  268. package/bizar-dash/src/web/components/Toast.tsx +0 -150
  269. package/bizar-dash/src/web/components/Toggle.tsx +0 -31
  270. package/bizar-dash/src/web/components/Topbar.tsx +0 -410
  271. package/bizar-dash/src/web/components/UsageChart.tsx +0 -250
  272. package/bizar-dash/src/web/components/UsageTable.tsx +0 -90
  273. package/bizar-dash/src/web/components/VirtualList.tsx +0 -53
  274. package/bizar-dash/src/web/components/VisualPlanDialog.tsx +0 -58
  275. package/bizar-dash/src/web/components/VoiceNotesPanel.tsx +0 -211
  276. package/bizar-dash/src/web/components/VoiceRecorder.tsx +0 -105
  277. package/bizar-dash/src/web/components/WorkspaceSelector.tsx +0 -158
  278. package/bizar-dash/src/web/components/agents/CommunicationLog.tsx +0 -126
  279. package/bizar-dash/src/web/components/agents/DependencyGraph.tsx +0 -163
  280. package/bizar-dash/src/web/components/agents/QualityGates.tsx +0 -123
  281. package/bizar-dash/src/web/components/agents/RealTimeEventLog.tsx +0 -127
  282. package/bizar-dash/src/web/components/agents/RoutingDecisions.test.tsx +0 -148
  283. package/bizar-dash/src/web/components/agents/RoutingDecisions.tsx +0 -160
  284. package/bizar-dash/src/web/components/background/AttachButton.tsx +0 -96
  285. package/bizar-dash/src/web/components/background/TmuxAttachCard.tsx +0 -122
  286. package/bizar-dash/src/web/components/chat/AgentChip.tsx +0 -68
  287. package/bizar-dash/src/web/components/chat/AgentNode.tsx +0 -127
  288. package/bizar-dash/src/web/components/chat/AgentTree.tsx +0 -80
  289. package/bizar-dash/src/web/components/chat/ChatBubble.tsx +0 -60
  290. package/bizar-dash/src/web/components/chat/ChatComposer.tsx +0 -72
  291. package/bizar-dash/src/web/components/chat/ChatInfoPanel.tsx +0 -370
  292. package/bizar-dash/src/web/components/chat/ChatRail.tsx +0 -387
  293. package/bizar-dash/src/web/components/chat/ChatThread.tsx +0 -127
  294. package/bizar-dash/src/web/components/chat/ChatTopBar.tsx +0 -50
  295. package/bizar-dash/src/web/components/chat/Composer.tsx +0 -166
  296. package/bizar-dash/src/web/components/chat/ConfirmModal.tsx +0 -54
  297. package/bizar-dash/src/web/components/chat/EmptyState.tsx +0 -21
  298. package/bizar-dash/src/web/components/chat/FirstRunGreeting.tsx +0 -18
  299. package/bizar-dash/src/web/components/chat/FloatingComposer.tsx +0 -38
  300. package/bizar-dash/src/web/components/chat/InfoPanel.tsx +0 -184
  301. package/bizar-dash/src/web/components/chat/JumpToLatest.tsx +0 -58
  302. package/bizar-dash/src/web/components/chat/LoadingSkeleton.tsx +0 -19
  303. package/bizar-dash/src/web/components/chat/MessageBlock.tsx +0 -260
  304. package/bizar-dash/src/web/components/chat/MessageBubble.tsx +0 -60
  305. package/bizar-dash/src/web/components/chat/SessionList.tsx +0 -163
  306. package/bizar-dash/src/web/components/chat/SessionRowMenu.tsx +0 -206
  307. package/bizar-dash/src/web/components/chat/StreamingIndicator.tsx +0 -37
  308. package/bizar-dash/src/web/components/chat/SuggestionCards.tsx +0 -55
  309. package/bizar-dash/src/web/components/chat/WelcomeScreen.tsx +0 -36
  310. package/bizar-dash/src/web/components/chat/_legacy.ts +0 -30
  311. package/bizar-dash/src/web/components/chat/index.ts +0 -31
  312. package/bizar-dash/src/web/components/chat/useAutoGrowTextarea.ts +0 -18
  313. package/bizar-dash/src/web/components/chat/useChat.ts +0 -1190
  314. package/bizar-dash/src/web/components/chat/useSlashCommands.ts +0 -47
  315. package/bizar-dash/src/web/components/goals/GoalInput.tsx +0 -86
  316. package/bizar-dash/src/web/components/goals/PlanVisualization.tsx +0 -111
  317. package/bizar-dash/src/web/components/tasks/BacklogPanel.css +0 -109
  318. package/bizar-dash/src/web/components/tasks/BacklogPanel.tsx +0 -209
  319. package/bizar-dash/src/web/hooks/useAutosave.ts +0 -107
  320. package/bizar-dash/src/web/hooks/useI18n.ts +0 -13
  321. package/bizar-dash/src/web/index.html +0 -37
  322. package/bizar-dash/src/web/lib/api.ts +0 -237
  323. package/bizar-dash/src/web/lib/goapPlanner.ts +0 -614
  324. package/bizar-dash/src/web/lib/i18n.ts +0 -25
  325. package/bizar-dash/src/web/lib/logger.ts +0 -30
  326. package/bizar-dash/src/web/lib/markdown.tsx +0 -59
  327. package/bizar-dash/src/web/lib/search.ts +0 -115
  328. package/bizar-dash/src/web/lib/types.ts +0 -894
  329. package/bizar-dash/src/web/lib/utils.ts +0 -114
  330. package/bizar-dash/src/web/lib/ws.ts +0 -177
  331. package/bizar-dash/src/web/locales/en.json +0 -52
  332. package/bizar-dash/src/web/main.tsx +0 -43
  333. package/bizar-dash/src/web/mobile/MobileApp.tsx +0 -309
  334. package/bizar-dash/src/web/mobile/MobileBottomNav.tsx +0 -38
  335. package/bizar-dash/src/web/mobile/MobileChat.tsx +0 -138
  336. package/bizar-dash/src/web/mobile/MobileDoctor.tsx +0 -80
  337. package/bizar-dash/src/web/mobile/MobileEval.tsx +0 -167
  338. package/bizar-dash/src/web/mobile/MobileMemory.tsx +0 -108
  339. package/bizar-dash/src/web/mobile/MobileOverview.tsx +0 -213
  340. package/bizar-dash/src/web/mobile/MobileSettings.tsx +0 -251
  341. package/bizar-dash/src/web/mobile/MobileTasks.tsx +0 -94
  342. package/bizar-dash/src/web/mobile/MobileTopbar.tsx +0 -115
  343. package/bizar-dash/src/web/mobile/components/MobileBottomSheet.tsx +0 -182
  344. package/bizar-dash/src/web/mobile/components/MobileListItem.tsx +0 -64
  345. package/bizar-dash/src/web/mobile/components/MobileModal.tsx +0 -123
  346. package/bizar-dash/src/web/mobile/views/MobileActivity.tsx +0 -273
  347. package/bizar-dash/src/web/mobile/views/MobileAgents.tsx +0 -374
  348. package/bizar-dash/src/web/mobile/views/MobileArtifactCanvas.tsx +0 -439
  349. package/bizar-dash/src/web/mobile/views/MobileArtifacts.tsx +0 -143
  350. package/bizar-dash/src/web/mobile/views/MobileChat.tsx +0 -257
  351. package/bizar-dash/src/web/mobile/views/MobileConfig.tsx +0 -175
  352. package/bizar-dash/src/web/mobile/views/MobileHistory.tsx +0 -191
  353. package/bizar-dash/src/web/mobile/views/MobileMods.tsx +0 -149
  354. package/bizar-dash/src/web/mobile/views/MobileMore.tsx +0 -121
  355. package/bizar-dash/src/web/mobile/views/MobileNotifications.tsx +0 -137
  356. package/bizar-dash/src/web/mobile/views/MobilePlans.tsx +0 -26
  357. package/bizar-dash/src/web/mobile/views/MobileSchedules.tsx +0 -685
  358. package/bizar-dash/src/web/mobile/views/MobileSearchModal.tsx +0 -172
  359. package/bizar-dash/src/web/mobile/views/MobileSettings.tsx +0 -363
  360. package/bizar-dash/src/web/mobile/views/MobileSkills.tsx +0 -153
  361. package/bizar-dash/src/web/mobile/views/MobileTasks.tsx +0 -564
  362. package/bizar-dash/src/web/mobile/views/QrCodePanel.tsx +0 -69
  363. package/bizar-dash/src/web/mobile.tsx +0 -14
  364. package/bizar-dash/src/web/styles/agents-redesign.css +0 -311
  365. package/bizar-dash/src/web/styles/chat.css +0 -1740
  366. package/bizar-dash/src/web/styles/glyphs.css +0 -960
  367. package/bizar-dash/src/web/styles/main.css +0 -10391
  368. package/bizar-dash/src/web/styles/memory.css +0 -1182
  369. package/bizar-dash/src/web/styles/minimax-usage.css +0 -842
  370. package/bizar-dash/src/web/styles/mobile-chat.css +0 -5
  371. package/bizar-dash/src/web/styles/mobile-layout.css +0 -233
  372. package/bizar-dash/src/web/styles/mobile.css +0 -2181
  373. package/bizar-dash/src/web/styles/settings.css +0 -795
  374. package/bizar-dash/src/web/styles/skills.css +0 -302
  375. package/bizar-dash/src/web/styles/tasks-redesign.css +0 -253
  376. package/bizar-dash/src/web/styles/tasks.css +0 -605
  377. package/bizar-dash/src/web/ui/controls/Button.tsx +0 -77
  378. package/bizar-dash/src/web/ui/controls/Checkbox.tsx +0 -95
  379. package/bizar-dash/src/web/ui/controls/IconButton.tsx +0 -66
  380. package/bizar-dash/src/web/ui/controls/Kbd.tsx +0 -24
  381. package/bizar-dash/src/web/ui/controls/NumberInput.tsx +0 -77
  382. package/bizar-dash/src/web/ui/controls/RadioGroup.tsx +0 -109
  383. package/bizar-dash/src/web/ui/controls/SearchInput.tsx +0 -91
  384. package/bizar-dash/src/web/ui/controls/Select.tsx +0 -92
  385. package/bizar-dash/src/web/ui/controls/Slider.tsx +0 -70
  386. package/bizar-dash/src/web/ui/controls/TextInput.tsx +0 -67
  387. package/bizar-dash/src/web/ui/controls/Textarea.tsx +0 -56
  388. package/bizar-dash/src/web/ui/controls/Toggle.tsx +0 -79
  389. package/bizar-dash/src/web/ui/controls/controls.css +0 -476
  390. package/bizar-dash/src/web/ui/controls/index.ts +0 -35
  391. package/bizar-dash/src/web/ui/data/BarChart.tsx +0 -60
  392. package/bizar-dash/src/web/ui/data/DataTable.tsx +0 -216
  393. package/bizar-dash/src/web/ui/data/EmptyState.tsx +0 -60
  394. package/bizar-dash/src/web/ui/data/ErrorState.tsx +0 -56
  395. package/bizar-dash/src/web/ui/data/KeyValueList.tsx +0 -106
  396. package/bizar-dash/src/web/ui/data/LoadingState.tsx +0 -65
  397. package/bizar-dash/src/web/ui/data/Sparkline.tsx +0 -87
  398. package/bizar-dash/src/web/ui/data/StatTile.tsx +0 -87
  399. package/bizar-dash/src/web/ui/data/data.css +0 -535
  400. package/bizar-dash/src/web/ui/data/index.ts +0 -31
  401. package/bizar-dash/src/web/ui/feedback/Badge.tsx +0 -49
  402. package/bizar-dash/src/web/ui/feedback/Dialog.tsx +0 -209
  403. package/bizar-dash/src/web/ui/feedback/ProgressBar.tsx +0 -69
  404. package/bizar-dash/src/web/ui/feedback/StatusDot.tsx +0 -50
  405. package/bizar-dash/src/web/ui/feedback/Toast.tsx +0 -200
  406. package/bizar-dash/src/web/ui/feedback/Tooltip.tsx +0 -126
  407. package/bizar-dash/src/web/ui/feedback/feedback.css +0 -314
  408. package/bizar-dash/src/web/ui/feedback/index.ts +0 -43
  409. package/bizar-dash/src/web/ui/index.ts +0 -56
  410. package/bizar-dash/src/web/ui/layout/AppShell.tsx +0 -51
  411. package/bizar-dash/src/web/ui/layout/Breadcrumbs.tsx +0 -97
  412. package/bizar-dash/src/web/ui/layout/Panel.tsx +0 -73
  413. package/bizar-dash/src/web/ui/layout/PanelHeader.tsx +0 -39
  414. package/bizar-dash/src/web/ui/layout/Sidebar.tsx +0 -131
  415. package/bizar-dash/src/web/ui/layout/Tabs.tsx +0 -133
  416. package/bizar-dash/src/web/ui/layout/Topbar.tsx +0 -42
  417. package/bizar-dash/src/web/ui/layout/ViewHeader.tsx +0 -48
  418. package/bizar-dash/src/web/ui/layout/index.ts +0 -34
  419. package/bizar-dash/src/web/ui/layout/layout.css +0 -464
  420. package/bizar-dash/src/web/ui/navigation/CommandPalette.tsx +0 -199
  421. package/bizar-dash/src/web/ui/navigation/NavGroup.tsx +0 -95
  422. package/bizar-dash/src/web/ui/navigation/NavLink.tsx +0 -93
  423. package/bizar-dash/src/web/ui/navigation/index.ts +0 -17
  424. package/bizar-dash/src/web/ui/navigation/navigation.css +0 -343
  425. package/bizar-dash/src/web/ui/primitives/Box.tsx +0 -91
  426. package/bizar-dash/src/web/ui/primitives/Grid.tsx +0 -49
  427. package/bizar-dash/src/web/ui/primitives/Inline.tsx +0 -55
  428. package/bizar-dash/src/web/ui/primitives/Separator.tsx +0 -46
  429. package/bizar-dash/src/web/ui/primitives/Stack.tsx +0 -54
  430. package/bizar-dash/src/web/ui/primitives/VisuallyHidden.tsx +0 -26
  431. package/bizar-dash/src/web/ui/primitives/index.ts +0 -23
  432. package/bizar-dash/src/web/ui/primitives/primitives.css +0 -183
  433. package/bizar-dash/src/web/ui/styles/globals.css +0 -86
  434. package/bizar-dash/src/web/ui/styles/reset.css +0 -125
  435. package/bizar-dash/src/web/ui/styles/tokens.css +0 -208
  436. package/bizar-dash/src/web/ui/theme/ThemeProvider.tsx +0 -142
  437. package/bizar-dash/src/web/ui/theme/tokens.ts +0 -131
  438. package/bizar-dash/src/web/ui/theme/useTheme.ts +0 -22
  439. package/bizar-dash/src/web/ui/utils/cx.ts +0 -42
  440. package/bizar-dash/src/web/views/Activity.tsx +0 -1221
  441. package/bizar-dash/src/web/views/Agents.tsx +0 -964
  442. package/bizar-dash/src/web/views/Artifacts.tsx +0 -1494
  443. package/bizar-dash/src/web/views/BackgroundAgents.tsx +0 -822
  444. package/bizar-dash/src/web/views/Chat.tsx +0 -532
  445. package/bizar-dash/src/web/views/Config.tsx +0 -3
  446. package/bizar-dash/src/web/views/Doctor.tsx +0 -317
  447. package/bizar-dash/src/web/views/Eval.tsx +0 -372
  448. package/bizar-dash/src/web/views/EvalReport.tsx +0 -353
  449. package/bizar-dash/src/web/views/GoalPlanner.tsx +0 -158
  450. package/bizar-dash/src/web/views/Harness.tsx +0 -306
  451. package/bizar-dash/src/web/views/History.tsx +0 -353
  452. package/bizar-dash/src/web/views/Memory.tsx +0 -161
  453. package/bizar-dash/src/web/views/MiniMaxUsage.tsx +0 -942
  454. package/bizar-dash/src/web/views/ModView.tsx +0 -207
  455. package/bizar-dash/src/web/views/Mods.tsx +0 -706
  456. package/bizar-dash/src/web/views/Overview.tsx +0 -1364
  457. package/bizar-dash/src/web/views/Providers.tsx +0 -302
  458. package/bizar-dash/src/web/views/Schedules.tsx +0 -902
  459. package/bizar-dash/src/web/views/Settings.tsx +0 -308
  460. package/bizar-dash/src/web/views/Skills.tsx +0 -383
  461. package/bizar-dash/src/web/views/SpawnAgentModal.tsx +0 -221
  462. package/bizar-dash/src/web/views/Tasks.tsx +0 -789
  463. package/bizar-dash/src/web/views/Workspace.tsx +0 -294
  464. package/bizar-dash/src/web/views/glyphs/GlyphRenderer.tsx +0 -844
  465. package/bizar-dash/src/web/views/glyphs/components.tsx +0 -1098
  466. package/bizar-dash/src/web/views/memory/ConfigPanel.tsx +0 -426
  467. package/bizar-dash/src/web/views/memory/FromScreenshotPanel.tsx +0 -23
  468. package/bizar-dash/src/web/views/memory/GitSyncPanel.tsx +0 -220
  469. package/bizar-dash/src/web/views/memory/LightragPanel.tsx +0 -310
  470. package/bizar-dash/src/web/views/memory/MemoryGraphLegend.tsx +0 -29
  471. package/bizar-dash/src/web/views/memory/MemoryGraphPanel.tsx +0 -192
  472. package/bizar-dash/src/web/views/memory/MemoryGraphView.tsx +0 -336
  473. package/bizar-dash/src/web/views/memory/MemoryOverview.tsx +0 -367
  474. package/bizar-dash/src/web/views/memory/MemoryStatusCard.tsx +0 -160
  475. package/bizar-dash/src/web/views/memory/ObsidianPanel.tsx +0 -650
  476. package/bizar-dash/src/web/views/memory/SemanticSearchPanel.tsx +0 -197
  477. package/bizar-dash/src/web/views/memory/VaultFromClipboardPanel.tsx +0 -101
  478. package/bizar-dash/src/web/views/settings/ActivitySection.tsx +0 -205
  479. package/bizar-dash/src/web/views/settings/AgentSection.tsx +0 -305
  480. package/bizar-dash/src/web/views/settings/AuthSection.tsx +0 -159
  481. package/bizar-dash/src/web/views/settings/EnvVarsSection.tsx +0 -15
  482. package/bizar-dash/src/web/views/settings/GeneralSection.tsx +0 -128
  483. package/bizar-dash/src/web/views/settings/HeadroomSection.tsx +0 -39
  484. package/bizar-dash/src/web/views/settings/MemorySection.tsx +0 -154
  485. package/bizar-dash/src/web/views/settings/NetworkSection.tsx +0 -87
  486. package/bizar-dash/src/web/views/settings/NotificationsSection.tsx +0 -34
  487. package/bizar-dash/src/web/views/settings/SystemLlmSection.tsx +0 -81
  488. package/bizar-dash/src/web/views/settings/ThemeSection.tsx +0 -168
  489. package/bizar-dash/src/web/views/settings/UpdatesSection.tsx +0 -256
  490. package/bizar-dash/src/web/views/settings/WorkspacesSection.tsx +0 -189
@@ -1,942 +0,0 @@
1
- // src/views/MiniMaxUsage.tsx — v4.6.0
2
- //
3
- // Full rewrite with two tabs:
4
- // 1. Token Plan — existing 5h + weekly remaining quota (unchanged)
5
- // 2. Usage Analytics — charts, KPIs, per-model breakdown, per-key status
6
- //
7
- // The usage data comes from the JSONL store at ~/.local/share/bizar/usage.jsonl
8
- // (written by minimax.mjs after every chatCompletion / fetchRemains call).
9
- // The Usage Analytics tab is only shown when the key is configured.
10
-
11
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
12
- import {
13
- Coins,
14
- RefreshCw,
15
- AlertTriangle,
16
- CheckCircle2,
17
- KeyRound,
18
- Send,
19
- Loader2,
20
- Calendar,
21
- Activity,
22
- Save,
23
- Eye,
24
- EyeOff,
25
- Sparkles,
26
- X,
27
- ExternalLink,
28
- ShieldCheck,
29
- CircleCheck,
30
- BarChart2,
31
- } from 'lucide-react';
32
- import { Card, CardTitle, CardMeta } from '../components/Card';
33
- import { Button } from '../components/Button';
34
- import { Spinner } from '../components/Spinner';
35
- import { UsageChart } from '../components/UsageChart';
36
- import { UsageTable, type PerModelRow } from '../components/UsageTable';
37
- import { useToast } from '../components/Toast';
38
- import { api } from '../lib/api';
39
- import { cn } from '../lib/utils';
40
-
41
- // ─── Types ───────────────────────────────────────────────────────────
42
-
43
- type Props = {
44
- snapshot: unknown;
45
- settings: unknown;
46
- activeTab: string;
47
- setActiveTab: (id: string) => void;
48
- refreshSnapshot: () => Promise<void>;
49
- };
50
-
51
- type RemainsModel = {
52
- model_name: string;
53
- current_interval_remaining_percent: number;
54
- current_weekly_remaining_percent: number;
55
- current_interval_consumed_percent?: number;
56
- weekly_consumed_percent?: number;
57
- current_interval_status: number;
58
- current_weekly_status: number;
59
- current_interval_total_count: number;
60
- current_interval_usage_count: number;
61
- current_weekly_total_count: number;
62
- current_weekly_usage_count: number;
63
- endTimeISO?: string;
64
- weeklyEndTimeISO?: string;
65
- intervalResetInMs?: number;
66
- weeklyResetInMs?: number;
67
- intervalResetInHuman?: string;
68
- weeklyResetInHuman?: string;
69
- intervalUsed?: number;
70
- intervalTotal?: number;
71
- weeklyUsed?: number;
72
- weeklyTotal?: number;
73
- };
74
-
75
- type RemainsSnapshot = {
76
- ok: boolean;
77
- cached?: boolean;
78
- fetchedAt?: number;
79
- apiKeyHint?: string;
80
- keySource?: string;
81
- groupId?: string;
82
- baseUrl?: string;
83
- models?: RemainsModel[];
84
- baseResp?: { status_code: number; status_msg: string };
85
- error?: string;
86
- message?: string;
87
- };
88
-
89
- type Status = {
90
- configured: boolean;
91
- apiKeyHint: string;
92
- source: string;
93
- groupId: string;
94
- tokenBaseUrl: string;
95
- chatBaseUrl: string;
96
- knownModels: string[];
97
- keyPatternValid: boolean | null;
98
- cache: { fetchedAt: number; apiKeyHint: string; modelCount: number } | null;
99
- };
100
-
101
- type OnboardingState = {
102
- dismissedAt: number | null;
103
- hiddenModels: string[];
104
- };
105
-
106
- type TestResult = {
107
- ok: boolean;
108
- error?: string;
109
- message?: string;
110
- model?: string;
111
- content?: string;
112
- reasoning?: string;
113
- finishReason?: string;
114
- usage?: {
115
- total_tokens?: number;
116
- prompt_tokens?: number;
117
- completion_tokens?: number;
118
- prompt_tokens_details?: { cached_tokens?: number };
119
- };
120
- status?: number;
121
- raw?: unknown;
122
- };
123
-
124
- // Usage analytics types.
125
- type UsageTotals = {
126
- requests: number;
127
- errors: number;
128
- promptTokens: number;
129
- completionTokens: number;
130
- totalTokens: number;
131
- cachedTokens: number;
132
- reasoningTokens: number;
133
- avgLatencyMs: number;
134
- p95LatencyMs: number;
135
- costEstimate: number;
136
- };
137
-
138
- type DailyBucket = {
139
- date: string;
140
- requests: number;
141
- totalTokens: number;
142
- promptTokens: number;
143
- completionTokens: number;
144
- errors: number;
145
- avgLatencyMs: number;
146
- };
147
-
148
- type PerModelBucket = {
149
- providerId: string;
150
- modelId: string;
151
- requests: number;
152
- totalTokens: number;
153
- promptTokens: number;
154
- completionTokens: number;
155
- errors: number;
156
- avgLatencyMs: number;
157
- };
158
-
159
- type PerKeyBucket = {
160
- keyEnvVar: string;
161
- isBackup: boolean;
162
- requests: number;
163
- errors: number;
164
- lastUsed: number | null;
165
- status: 'active' | 'backup';
166
- };
167
-
168
- type UsageQueryResult = {
169
- totals: UsageTotals;
170
- daily: DailyBucket[];
171
- perModel: PerModelBucket[];
172
- perKey: PerKeyBucket[];
173
- errors: { code: string; message: string; count: number; lastOccurred: number | null }[];
174
- };
175
-
176
- type RecentRecord = {
177
- ts: number;
178
- providerId: string;
179
- modelId: string;
180
- endpoint: string;
181
- requestId: string;
182
- promptTokens: number;
183
- completionTokens: number;
184
- totalTokens: number;
185
- cachedTokens: number;
186
- reasoningTokens: number;
187
- latencyMs: number;
188
- finishReason: string | null;
189
- error: { code: string; message: string } | null;
190
- keyEnvVar: string;
191
- isBackup: boolean;
192
- cached: boolean;
193
- };
194
-
195
- type TimeRange = '24h' | '7d' | '30d' | 'custom';
196
-
197
- // ─── Main component ────────────────────────────────────────────────────
198
-
199
- function MiniMaxUsageInner({ activeTab, setActiveTab }: Props) {
200
- // Share state between tabs.
201
- const [view, setView] = useState<'quota' | 'analytics'>('quota');
202
- const toast = useToast();
203
-
204
- // Load based on active view.
205
- return (
206
- <div className="view-container view-minimax-usage">
207
- {/* Sub-tab switcher */}
208
- <div className="minimax-sub-tabs">
209
- <button
210
- className={cn('minimax-sub-tab', view === 'quota' && 'is-active')}
211
- onClick={() => setView('quota')}
212
- >
213
- <Coins size={13} /> Token Plan
214
- </button>
215
- <button
216
- className={cn('minimax-sub-tab', view === 'analytics' && 'is-active')}
217
- onClick={() => setView('analytics')}
218
- >
219
- <BarChart2 size={13} /> Usage Analytics
220
- </button>
221
- </div>
222
-
223
- {view === 'quota'
224
- ? <QuotaView activeTab={activeTab} setActiveTab={setActiveTab} />
225
- : <AnalyticsView toast={toast} />
226
- }
227
- </div>
228
- );
229
- }
230
-
231
- // ─── Token Plan view (existing functionality) ──────────────────────────
232
-
233
- function QuotaView({ activeTab, setActiveTab }: Pick<Props, 'activeTab' | 'setActiveTab'>) {
234
- const toast = useToast();
235
- const [status, setStatus] = useState<Status | null>(null);
236
- const [remains, setRemains] = useState<RemainsSnapshot | null>(null);
237
- const [onboarding, setOnboarding] = useState<OnboardingState | null>(null);
238
- const [loading, setLoading] = useState(true);
239
- const [refreshing, setRefreshing] = useState(false);
240
- const [error, setError] = useState<string | null>(null);
241
- const [testResult, setTestResult] = useState<TestResult | null>(null);
242
- const [testing, setTesting] = useState(false);
243
- const [wizardStep, setWizardStep] = useState(0);
244
- const [wizardVerifying, setWizardVerifying] = useState(false);
245
- const [wizardVerifyResult, setWizardVerifyResult] = useState<TestResult | null>(null);
246
- const [keyDraft, setKeyDraft] = useState('');
247
- const [showKey, setShowKey] = useState(false);
248
- const [savingKey, setSavingKey] = useState(false);
249
-
250
- const load = useCallback(async () => {
251
- setLoading(true);
252
- setError(null);
253
- try {
254
- const [s, r, o] = await Promise.all([
255
- api.get<Status>('/minimax/status'),
256
- api.get<RemainsSnapshot>('/minimax/remains'),
257
- api.get<OnboardingState>('/minimax/onboarding'),
258
- ]);
259
- setStatus(s);
260
- setRemains(r);
261
- setOnboarding(o);
262
- if (s.configured) setWizardStep(4);
263
- } catch (err) {
264
- setError((err as Error).message || 'Failed to load MiniMax data');
265
- } finally {
266
- setLoading(false);
267
- }
268
- }, []);
269
-
270
- useEffect(() => { load(); }, [load]);
271
-
272
- const dismissWizard = useCallback(async () => {
273
- try {
274
- await api.post('/minimax/onboarding', { dismissedAt: Date.now() });
275
- setOnboarding((o) => o ? { ...o, dismissedAt: Date.now() } : o);
276
- } catch { /* best-effort */ }
277
- }, []);
278
-
279
- const verifyKeyBeforeSave = useCallback(async () => {
280
- if (!keyDraft.trim()) { toast.error('Paste a Subscription Key first.'); return; }
281
- setWizardVerifying(true);
282
- setWizardVerifyResult(null);
283
- try {
284
- const r = await api.post<TestResult>('/minimax/test', {
285
- prompt: 'Reply with a single word: pong',
286
- model: 'MiniMax-M3',
287
- maxTokens: 16,
288
- });
289
- setWizardVerifyResult(r);
290
- if (r.ok) {
291
- setWizardStep(3);
292
- toast.success('Key works. Saving…');
293
- try {
294
- await api.post('/minimax/onboarding/save-key', { key: keyDraft.trim(), groupId: 'default' });
295
- clearRemainsCacheClient();
296
- toast.success('Subscription Key saved.');
297
- } catch (err) { toast.error(`Save failed: ${(err as Error).message}`); }
298
- void load();
299
- } else {
300
- toast.error(`Verification failed: ${r.message ?? r.error ?? 'unknown'}`);
301
- }
302
- } catch (err) { toast.error(`Test request failed: ${(err as Error).message}`); }
303
- finally { setWizardVerifying(false); }
304
- }, [keyDraft, toast, load]);
305
-
306
- const saveKey = useCallback(async () => {
307
- if (!keyDraft.trim()) { toast.error('Paste a Subscription Key first.'); return; }
308
- setSavingKey(true);
309
- try {
310
- const r = await api.post<{ ok: boolean; path?: string; apiKeyHint?: string; error?: string; message?: string }>(
311
- '/minimax/onboarding/save-key', { key: keyDraft.trim(), groupId: 'default' },
312
- );
313
- if (!r.ok) { toast.error(`Save failed: ${r.message ?? r.error ?? 'unknown'}`); return; }
314
- setKeyDraft('');
315
- clearRemainsCacheClient();
316
- toast.success('Subscription Key saved. Loading quota…');
317
- void load();
318
- } catch (err) { toast.error(`Save failed: ${(err as Error).message}`); }
319
- finally { setSavingKey(false); }
320
- }, [keyDraft, toast, load]);
321
-
322
- const clearRemainsCacheClient = useCallback(async () => {
323
- try { await api.del('/minimax/cache'); } catch { /* best-effort */ }
324
- }, []);
325
-
326
- const refresh = useCallback(async () => {
327
- setRefreshing(true);
328
- setError(null);
329
- try {
330
- await api.post('/minimax/remains/refresh');
331
- await load();
332
- toast.success('Refreshed');
333
- } catch (err) { toast.error(`Refresh failed: ${(err as Error).message}`); }
334
- finally { setRefreshing(false); }
335
- }, [load, toast]);
336
-
337
- const sendTest = useCallback(async () => {
338
- setTesting(true);
339
- setTestResult(null);
340
- try {
341
- const r = await api.post<TestResult>('/minimax/test', {
342
- prompt: 'Reply with a single word: pong',
343
- model: 'MiniMax-M3',
344
- maxTokens: 16,
345
- });
346
- setTestResult(r);
347
- if (r.ok) toast.success(`Test ok — used ${r.usage?.total_tokens ?? '?'} tokens`);
348
- else toast.error(`Test failed: ${r.message ?? r.error ?? 'unknown'}`);
349
- } catch (err) { toast.error(`Test request failed: ${(err as Error).message}`); }
350
- finally { setTesting(false); }
351
- }, [toast]);
352
-
353
- if (loading && !status) {
354
- return <div className="view-container"><Spinner /> Loading MiniMax data…</div>;
355
- }
356
- if (!status) {
357
- return (
358
- <div className="view-container">
359
- <div className="error-card">
360
- <AlertTriangle size={20} />
361
- <div><strong>Couldn't load MiniMax status</strong><pre>{error ?? 'unknown error'}</pre></div>
362
- </div>
363
- </div>
364
- );
365
- }
366
-
367
- const showWizard = !status.configured && (onboarding?.dismissedAt == null) && wizardStep < 4;
368
- if (showWizard) {
369
- return <OnboardingWizard
370
- step={wizardStep} setStep={setWizardStep}
371
- keyDraft={keyDraft} setKeyDraft={setKeyDraft}
372
- showKey={showKey} setShowKey={setShowKey}
373
- verifying={wizardVerifying} verifyResult={wizardVerifyResult}
374
- onVerify={verifyKeyBeforeSave}
375
- onSkip={async () => { await dismissWizard(); toast.success("Skipped."); }}
376
- onManualKeySave={saveKey} savingKey={savingKey} status={status}
377
- />;
378
- }
379
-
380
- return (
381
- <>
382
- <header className="view-header">
383
- <div className="view-header-titles">
384
- <h1 className="view-title">
385
- <Coins size={20} style={{ verticalAlign: 'text-bottom', marginRight: 6 }} />
386
- MiniMax Token Plan
387
- </h1>
388
- <p className="view-subtitle">
389
- Remaining 5-hour + weekly quota per model. Fetches live from{' '}
390
- <code>www.minimax.io/v1/token_plan/remains</code>.
391
- </p>
392
- </div>
393
- <div className="view-header-actions">
394
- <Button variant="secondary" size="sm" onClick={() => setActiveTab('settings')} title="Configure your Subscription Key">
395
- <KeyRound size={14} /> {status.configured ? `Key ${status.apiKeyHint}` : 'Add key'}
396
- </Button>
397
- <Button variant="secondary" size="sm" onClick={refresh} disabled={refreshing}>
398
- {refreshing ? <Loader2 size={14} className="spin" /> : <RefreshCw size={14} />} Refresh
399
- </Button>
400
- </div>
401
- </header>
402
-
403
- {remains && !remains.ok && (
404
- <div className="banner banner-err">
405
- <AlertTriangle size={16} />
406
- <span><strong>Couldn't load quota</strong>: {remains.message ?? remains.error ?? 'unknown error'}</span>
407
- </div>
408
- )}
409
-
410
- {remains?.ok && remains.models && (
411
- <>
412
- <div className="minimax-stats-row">
413
- <Stat label="Models tracked" value={String(remains.models.length)} hint="Distinct model quotas returned by the API" />
414
- <Stat label="Last fetched" value={remains.fetchedAt ? relativeTime(remains.fetchedAt) : '—'} hint="Refreshed on demand + every 60s" />
415
- <Stat label="Group" value={remains.groupId ?? '—'} hint="Usually 'default' for an individual team" />
416
- <Stat label="API key" value={remains.apiKeyHint ?? '—'} hint="Masked; the real key never leaves auth.json" />
417
- </div>
418
- <div className="minimax-models-grid">
419
- {remains.models.map((m) => <ModelQuotaCard key={m.model_name} model={m} />)}
420
- </div>
421
- </>
422
- )}
423
-
424
- {status.configured && (
425
- <Card id="minimax-test">
426
- <CardTitle><Send size={14} /> Test the API key</CardTitle>
427
- <CardMeta>One-shot chat completion to <code>{status.chatBaseUrl}/chat/completions</code>.</CardMeta>
428
- <div className="minimax-test-actions">
429
- <Button onClick={sendTest} disabled={testing} variant="primary" size="sm">
430
- {testing ? <Loader2 size={14} className="spin" /> : <Send size={14} />} Send test prompt
431
- </Button>
432
- <code className="minimax-test-prompt">"Reply with a single word: pong"</code>
433
- </div>
434
- {testResult && (
435
- <div className={cn('minimax-test-result', testResult.ok ? 'ok' : 'err')}>
436
- {testResult.ok ? <CheckCircle2 size={14} /> : <AlertTriangle size={14} />}
437
- <div className="minimax-test-body">
438
- {testResult.ok ? (
439
- <>
440
- <div className="minimax-test-line">
441
- <strong>model:</strong> <code>{testResult.model}</code> ·{' '}
442
- <strong>finish:</strong> {testResult.finishReason ?? '—'}
443
- </div>
444
- {testResult.content && (
445
- <div className="minimax-test-content"><code>{testResult.content}</code></div>
446
- )}
447
- {testResult.usage && (
448
- <div className="minimax-test-usage">
449
- <strong>usage:</strong> total <code>{testResult.usage.total_tokens ?? '?'}</code> · prompt{' '}
450
- <code>{testResult.usage.prompt_tokens ?? '?'}</code> · completion{' '}
451
- <code>{testResult.usage.completion_tokens ?? '?'}</code>
452
- {testResult.usage.prompt_tokens_details?.cached_tokens != null && (
453
- <> · cached <code>{testResult.usage.prompt_tokens_details.cached_tokens}</code></>
454
- )}
455
- </div>
456
- )}
457
- </>
458
- ) : (
459
- <pre>{testResult.message ?? testResult.error ?? 'unknown error'}</pre>
460
- )}
461
- </div>
462
- </div>
463
- )}
464
- </Card>
465
- )}
466
- </>
467
- );
468
- }
469
-
470
- // ─── Analytics view ────────────────────────────────────────────────────
471
-
472
- function AnalyticsView({ toast }: { toast: ReturnType<typeof useToast> }) {
473
- const [range, setRange] = useState<TimeRange>('24h');
474
- const [customFrom, setCustomFrom] = useState('');
475
- const [customTo, setCustomTo] = useState('');
476
- const [loading, setLoading] = useState(true);
477
- const [usage, setUsage] = useState<UsageQueryResult | null>(null);
478
- const [recent, setRecent] = useState<RecentRecord[]>([]);
479
- const [sortKey, setSortKey] = useState('requests');
480
- const [sortDir, setSortDir] = useState<'asc' | 'desc'>('desc');
481
- const [refreshing, setRefreshing] = useState(false);
482
-
483
- const load = useCallback(async (r: TimeRange, fromMs?: number, toMs?: number) => {
484
- setLoading(true);
485
- try {
486
- const params = new URLSearchParams({ range: r });
487
- if (r === 'custom' && fromMs && toMs) {
488
- params.set('from', String(fromMs));
489
- params.set('to', String(toMs));
490
- }
491
- const [u, rec] = await Promise.all([
492
- api.get<UsageQueryResult>(`/usage?${params.toString()}`),
493
- api.get<{ records: RecentRecord[]; total: number; returned: number }>('/usage/recent?limit=20'),
494
- ]);
495
- setUsage(u);
496
- setRecent(rec.records);
497
- } catch (err) {
498
- toast.error(`Failed to load usage data: ${(err as Error).message}`);
499
- } finally {
500
- setLoading(false);
501
- }
502
- }, [toast]);
503
-
504
- useEffect(() => {
505
- if (range === 'custom') {
506
- const from = customFrom ? new Date(customFrom).getTime() : Date.now() - 7 * 86_400_000;
507
- const to = customTo ? new Date(customTo).getTime() : Date.now();
508
- void load('custom', from, to);
509
- } else {
510
- void load(range);
511
- }
512
- }, [range, load]);
513
-
514
- const handleSort = useCallback((key: string) => {
515
- if (sortKey === key) setSortDir(d => d === 'asc' ? 'desc' : 'asc');
516
- else { setSortKey(key); setSortDir('desc'); }
517
- }, [sortKey]);
518
-
519
- const sortedModels = useMemo(() => {
520
- if (!usage?.perModel) return [];
521
- return [...usage.perModel].sort((a, b) => {
522
- const av = (a as Record<string, unknown>)[sortKey] ?? 0;
523
- const bv = (b as Record<string, unknown>)[sortKey] ?? 0;
524
- const cmp = typeof av === 'number' && typeof bv === 'number' ? av - bv : String(av).localeCompare(String(bv));
525
- return sortDir === 'asc' ? cmp : -cmp;
526
- });
527
- }, [usage?.perModel, sortKey, sortDir]);
528
-
529
- const chartSeries = useMemo(() => {
530
- if (!usage?.daily) return { labels: [] as string[], requests: [] as number[], tokens: [] as number[] };
531
- return {
532
- labels: usage.daily.map(d => d.date.slice(5)), // "MM-DD"
533
- requests: usage.daily.map(d => d.requests),
534
- tokens: usage.daily.map(d => d.totalTokens),
535
- };
536
- }, [usage?.daily]);
537
-
538
- const refresh = useCallback(async () => {
539
- setRefreshing(true);
540
- await load(range === 'custom' ? 'custom' : range,
541
- range === 'custom' && customFrom ? new Date(customFrom).getTime() : undefined,
542
- range === 'custom' && customTo ? new Date(customTo).getTime() : undefined);
543
- setRefreshing(false);
544
- }, [load, range, customFrom, customTo]);
545
-
546
- if (loading && !usage) {
547
- return <div className="view-container"><Spinner /> Loading usage data…</div>;
548
- }
549
-
550
- const t = usage?.totals;
551
- const errors = usage?.errors ?? [];
552
- const perKey = usage?.perKey ?? [];
553
-
554
- return (
555
- <>
556
- {/* Header */}
557
- <header className="view-header">
558
- <div className="view-header-titles">
559
- <h1 className="view-title">
560
- <BarChart2 size={20} style={{ verticalAlign: 'text-bottom', marginRight: 6 }} />
561
- Usage Analytics
562
- </h1>
563
- <p className="view-subtitle">
564
- Aggregated from <code>~/.local/share/bizar/usage.jsonl</code> —
565
- every chatCompletion and fetchRemains call.
566
- </p>
567
- </div>
568
- <div className="view-header-actions">
569
- <Button variant="secondary" size="sm" onClick={refresh} disabled={refreshing}>
570
- {refreshing ? <Loader2 size={14} className="spin" /> : <RefreshCw size={14} />} Refresh
571
- </Button>
572
- </div>
573
- </header>
574
-
575
- {/* Time range selector */}
576
- <div className="usage-time-range">
577
- {(['24h', '7d', '30d', 'custom'] as TimeRange[]).map(r => (
578
- <button
579
- key={r}
580
- className={cn('usage-range-chip', range === r && 'is-active')}
581
- onClick={() => setRange(r)}
582
- >
583
- {r === 'custom' ? 'Custom' : r.toUpperCase()}
584
- </button>
585
- ))}
586
- {range === 'custom' && (
587
- <div className="usage-custom-dates">
588
- <label htmlFor="usage-from-date" className="sr-only">From date</label>
589
- <input
590
- id="usage-from-date"
591
- type="date"
592
- className="usage-date-input"
593
- value={customFrom}
594
- onChange={e => setCustomFrom(e.target.value)}
595
- aria-label="From date"
596
- />
597
- <span style={{ color: 'var(--text-muted)', fontSize: 12 }} aria-hidden>to</span>
598
- <label htmlFor="usage-to-date" className="sr-only">To date</label>
599
- <input
600
- id="usage-to-date"
601
- type="date"
602
- className="usage-date-input"
603
- value={customTo}
604
- onChange={e => setCustomTo(e.target.value)}
605
- aria-label="To date"
606
- />
607
- </div>
608
- )}
609
- </div>
610
-
611
- {/* KPI row */}
612
- <div className="usage-kpi-row">
613
- <KpiCard
614
- label="Total Requests"
615
- value={t?.requests.toLocaleString() ?? '—'}
616
- sub={t ? `${t.errors} errors` : undefined}
617
- tone={t && t.errors > t.requests * 0.1 ? 'warn' : undefined}
618
- />
619
- <KpiCard
620
- label="Total Tokens"
621
- value={t ? (t.totalTokens >= 1000 ? `${Math.round(t.totalTokens / 1000)}k` : String(t.totalTokens)) : '—'}
622
- sub={t ? `${t.promptTokens.toLocaleString()} prompt · ${t.completionTokens.toLocaleString()} completion` : undefined}
623
- />
624
- <KpiCard
625
- label="Errors"
626
- value={String(t?.errors ?? '—')}
627
- sub={errors.length > 0 ? `${errors[0].code}: ${errors[0].count}` : undefined}
628
- tone={t && t.errors > 0 ? 'err' : undefined}
629
- />
630
- <KpiCard
631
- label="Avg Latency"
632
- value={t?.avgLatencyMs != null ? `${t.avgLatencyMs}ms` : '—'}
633
- sub={t?.p95LatencyMs != null ? `p95 ${t.p95LatencyMs}ms` : undefined}
634
- />
635
- <KpiCard
636
- label="Est. Cost"
637
- value={t?.costEstimate != null && t.costEstimate > 0 ? `$${t.costEstimate.toFixed(4)}` : '—'}
638
- sub="approximate USD"
639
- tone={undefined}
640
- />
641
- </div>
642
-
643
- {/* Chart */}
644
- <Card className="usage-chart-card">
645
- <div className="usage-chart-wrap">
646
- <UsageChart series={chartSeries} height={280} />
647
- </div>
648
- <div className="usage-legend">
649
- <div className="usage-legend-item">
650
- <div className="usage-legend-bar" style={{ background: 'var(--accent)' }} />
651
- <span>Requests (bar)</span>
652
- </div>
653
- <div className="usage-legend-item">
654
- <div className="usage-legend-line" style={{ background: 'var(--warning, #d29922)' }} />
655
- <span>Tokens (line)</span>
656
- </div>
657
- </div>
658
- </Card>
659
-
660
- {/* Per-model table */}
661
- <Card>
662
- <CardTitle>Per-model breakdown</CardTitle>
663
- <UsageTable
664
- rows={sortedModels as PerModelRow[]}
665
- sortKey={sortKey}
666
- sortDir={sortDir}
667
- onSort={handleSort}
668
- />
669
- </Card>
670
-
671
- {/* Per-key status */}
672
- {perKey.length > 0 && (
673
- <Card>
674
- <CardTitle>API Keys</CardTitle>
675
- <div className="usage-key-row">
676
- {perKey.map(k => (
677
- <span
678
- key={k.keyEnvVar}
679
- className={cn('usage-key-badge', k.isBackup ? 'is-backup' : 'is-active')}
680
- >
681
- <span className="usage-key-dot" />
682
- {k.keyEnvVar}
683
- {k.isBackup ? ' (backup)' : ' (active)'}
684
- {' · '}
685
- {k.requests} req
686
- </span>
687
- ))}
688
- </div>
689
- </Card>
690
- )}
691
-
692
- {/* Recent activity */}
693
- {recent.length > 0 && (
694
- <Card>
695
- <CardTitle>Recent activity</CardTitle>
696
- <div className="usage-recent-list">
697
- {recent.map((r, i) => (
698
- <div key={`${r.requestId}-${i}`} className={cn('usage-recent-item', r.error && 'is-err')}>
699
- <span className="usage-recent-time">
700
- {new Date(r.ts).toLocaleTimeString()}
701
- </span>
702
- <span className="usage-recent-model">
703
- <code>{r.modelId}</code>
704
- </span>
705
- <span className="usage-recent-tokens">
706
- {r.totalTokens.toLocaleString()} tok
707
- </span>
708
- <span className="usage-recent-latency">
709
- {r.latencyMs}ms
710
- </span>
711
- <span className="usage-recent-endpoint">{r.endpoint}</span>
712
- </div>
713
- ))}
714
- </div>
715
- </Card>
716
- )}
717
- </>
718
- );
719
- }
720
-
721
- // ─── Kpi card ──────────────────────────────────────────────────────────
722
-
723
- function KpiCard({ label, value, sub, tone }: { label: string; value: string; sub?: string; tone?: 'warn' | 'err' | 'ok' }) {
724
- return (
725
- <div className="usage-kpi-card">
726
- <div className="usage-kpi-label">{label}</div>
727
- <div className={cn('usage-kpi-value', tone && `is-${tone}`)}>{value}</div>
728
- {sub && <div className="usage-kpi-sub">{sub}</div>}
729
- </div>
730
- );
731
- }
732
-
733
- // ─── Sub-components (quota view) ───────────────────────────────────────
734
-
735
- function Stat({ label, value, hint }: { label: string; value: string; hint?: string }) {
736
- return (
737
- <div className="stat">
738
- <div className="stat-label">{label}</div>
739
- <div className="stat-value">{value}</div>
740
- {hint && <div className="stat-hint">{hint}</div>}
741
- </div>
742
- );
743
- }
744
-
745
- function ModelQuotaCard({ model }: { model: RemainsModel }) {
746
- const fivePct = clamp(model.current_interval_remaining_percent ?? 0, 0, 100);
747
- const weekPct = clamp(model.current_weekly_remaining_percent ?? 0, 0, 100);
748
- const fiveConsumed = clamp(100 - fivePct, 0, 100);
749
- const weekConsumed = clamp(100 - weekPct, 0, 100);
750
- return (
751
- <Card id={`minimax-model-${model.model_name}`} className="minimax-model-card">
752
- <div className="minimax-model-head">
753
- <div className="minimax-model-name">{model.model_name}</div>
754
- <div className={cn('minimax-model-status', fivePct < 25 || weekPct < 25 ? 'is-warn' : 'is-ok')}>
755
- {model.current_interval_status === 1 ? 'active' : 'idle'} ·{' '}
756
- {model.current_weekly_status === 1 ? 'week active' : 'week idle'}
757
- </div>
758
- </div>
759
- <div className="minimax-quota-rows">
760
- <QuotaBar
761
- icon={<Activity size={12} />} label="5-hour rolling"
762
- remainingPct={fivePct} consumedPct={fiveConsumed}
763
- used={model.current_interval_usage_count ?? 0} total={model.current_interval_total_count ?? 0}
764
- resetIn={model.intervalResetInHuman} resetISO={model.endTimeISO}
765
- />
766
- <QuotaBar
767
- icon={<Calendar size={12} />} label="Weekly"
768
- remainingPct={weekPct} consumedPct={weekConsumed}
769
- used={model.current_weekly_usage_count ?? 0} total={model.current_weekly_total_count ?? 0}
770
- resetIn={model.weeklyResetInHuman} resetISO={model.weeklyEndTimeISO}
771
- />
772
- </div>
773
- </Card>
774
- );
775
- }
776
-
777
- function QuotaBar({ icon, label, remainingPct, consumedPct, used, total, resetIn, resetISO }: {
778
- icon: React.ReactNode; label: string; remainingPct: number; consumedPct: number;
779
- used: number; total: number; resetIn?: string; resetISO?: string;
780
- }) {
781
- const tone = remainingPct >= 75 ? 'good' : remainingPct >= 25 ? 'warn' : 'low';
782
- return (
783
- <div className={`minimax-quota-row is-${tone}`}>
784
- <div className="minimax-quota-head">
785
- <span className="minimax-quota-label">{icon} {label}</span>
786
- <span className="minimax-quota-remaining">{remainingPct}% remaining</span>
787
- <span className="minimax-quota-consumed">· {consumedPct}% used</span>
788
- </div>
789
- <div className="minimax-bar">
790
- <div className="minimax-bar-fill" style={{ width: `${consumedPct}%` }} aria-label={`${consumedPct}% consumed`} />
791
- </div>
792
- <div className="minimax-quota-meta">
793
- <span><strong>{used}</strong> / {total || '—'} requests</span>
794
- <span title={resetISO}>{resetIn ? `resets in ${resetIn}` : '—'}</span>
795
- </div>
796
- </div>
797
- );
798
- }
799
-
800
- function clamp(n: number, lo: number, hi: number) {
801
- return Math.max(lo, Math.min(hi, n));
802
- }
803
-
804
- function relativeTime(ts: number): string {
805
- const ms = Date.now() - ts;
806
- if (ms < 5_000) return 'just now';
807
- if (ms < 60_000) return `${Math.floor(ms / 1000)}s ago`;
808
- if (ms < 3_600_000) return `${Math.floor(ms / 60_000)}m ago`;
809
- return `${Math.floor(ms / 3_600_000)}h ago`;
810
- }
811
-
812
- // ─── Onboarding wizard ─────────────────────────────────────────────────
813
-
814
- type OnboardingProps = {
815
- step: number; setStep: (n: number) => void;
816
- keyDraft: string; setKeyDraft: (s: string) => void;
817
- showKey: boolean; setShowKey: React.Dispatch<React.SetStateAction<boolean>>;
818
- verifying: boolean; verifyResult: TestResult | null;
819
- onVerify: () => void; onSkip: () => void; onManualKeySave: () => void;
820
- savingKey: boolean; status: Status;
821
- };
822
-
823
- function OnboardingWizard({ step, setStep, keyDraft, setKeyDraft, showKey, setShowKey, verifying, verifyResult, onVerify, onSkip, onManualKeySave, savingKey, status }: OnboardingProps) {
824
- return (
825
- <div className="view-container view-minimax-onboarding">
826
- <header className="view-header">
827
- <div className="view-header-titles">
828
- <h1 className="view-title">
829
- <Sparkles size={20} style={{ verticalAlign: 'text-bottom', marginRight: 6 }} />
830
- Set up MiniMax Token Plan tracking
831
- </h1>
832
- <p className="view-subtitle">We'll read your Subscription Key and show your remaining quota.</p>
833
- </div>
834
- <div className="view-header-actions">
835
- <Button variant="ghost" size="sm" onClick={onSkip}><X size={14} /> Skip for now</Button>
836
- </div>
837
- </header>
838
-
839
- <div className="minimax-wizard-stepper">
840
- {(['Welcome', 'Get a key', 'Paste & test', 'Done']).map((label, i) => (
841
- <div key={label} className={cn('minimax-wizard-step', i === step && 'is-current', i < step && 'is-done', i > step && 'is-todo')}>
842
- <div className="minimax-wizard-step-bullet">{i < step ? <CircleCheck size={14} /> : i + 1}</div>
843
- <div className="minimax-wizard-step-label">{label}</div>
844
- </div>
845
- ))}
846
- </div>
847
-
848
- <Card id="minimax-wizard-card">
849
- {step === 0 && (
850
- <div className="minimax-wizard-body">
851
- <h3 className="minimax-wizard-title">Welcome</h3>
852
- <p className="minimax-wizard-prose">
853
- BizarHarness shows you how much of your MiniMax Token Plan quota you have left —
854
- both the <strong>5-hour rolling</strong> and <strong>weekly</strong> windows.
855
- </p>
856
- <ul className="minimax-wizard-list">
857
- <li>Stored in <code>~/.local/share/cline/auth.json</code>.</li>
858
- <li>Read fresh on every dashboard load.</li>
859
- <li>Never logged in full.</li>
860
- </ul>
861
- <div className="minimax-wizard-actions">
862
- <Button onClick={() => setStep(1)} variant="primary" size="md">Get started <span style={{ marginLeft: 6 }}>→</span></Button>
863
- </div>
864
- </div>
865
- )}
866
-
867
- {step === 1 && (
868
- <div className="minimax-wizard-body">
869
- <h3 className="minimax-wizard-title">Get your Subscription Key</h3>
870
- <p className="minimax-wizard-prose">Go to the MiniMax console and copy your Subscription Key.</p>
871
- <ol className="minimax-wizard-list">
872
- <li>Open <a href="https://platform.minimax.io/user-center/payment/token-plan" target="_blank" rel="noreferrer" className="minimax-wizard-link"><ExternalLink size={12} /> platform.minimax.io</a></li>
873
- <li>Click <strong>Copy Subscription Key</strong>.</li>
874
- <li>Come back here and paste it.</li>
875
- </ol>
876
- <div className="minimax-wizard-actions">
877
- <Button variant="secondary" size="md" onClick={() => setStep(0)}>← Back</Button>
878
- <Button variant="primary" size="md" onClick={() => setStep(2)}>I have my key <span style={{ marginLeft: 6 }}>→</span></Button>
879
- </div>
880
- </div>
881
- )}
882
-
883
- {step === 2 && (
884
- <div className="minimax-wizard-body">
885
- <h3 className="minimax-wizard-title">Paste &amp; test</h3>
886
- <p className="minimax-wizard-prose">Paste your key below. We'll test it against the real API before saving.</p>
887
- <div className="minimax-key-row">
888
- <div className="minimax-key-input-wrap">
889
- <KeyRound size={12} className="minimax-key-icon" aria-hidden />
890
- <label htmlFor="minimax-key-input" className="sr-only">Subscription Key</label>
891
- <input
892
- id="minimax-key-input"
893
- type={showKey ? 'text' : 'password'}
894
- value={keyDraft}
895
- onChange={e => setKeyDraft(e.target.value)}
896
- placeholder="sk-cp-..."
897
- spellCheck={false}
898
- autoComplete="off"
899
- className="minimax-key-input"
900
- autoFocus
901
- aria-label="Subscription Key"
902
- />
903
- <button type="button" onClick={() => setShowKey(v => !v)} className="minimax-key-toggle" aria-label={showKey ? 'Hide key' : 'Show key'}>
904
- {showKey ? <EyeOff size={13} /> : <Eye size={13} />}
905
- </button>
906
- </div>
907
- </div>
908
- {verifyResult && !verifyResult.ok && (
909
- <div className="minimax-wizard-error"><AlertTriangle size={14} /><span><strong>Verification failed:</strong> {verifyResult.message ?? verifyResult.error}</span></div>
910
- )}
911
- <div className="minimax-wizard-actions">
912
- <Button variant="secondary" size="md" onClick={() => setStep(1)}>← Back</Button>
913
- <Button variant="primary" size="md" onClick={onVerify} disabled={verifying || !keyDraft.trim()}>
914
- {verifying ? <Loader2 size={14} className="spin" /> : <ShieldCheck size={14} />}
915
- {verifying ? 'Testing…' : 'Test &amp; save key'}
916
- </Button>
917
- </div>
918
- <p className="minimax-wizard-prose minimax-wizard-prose--muted">
919
- Don't want to test first? <a href="#" onClick={e => { e.preventDefault(); onManualKeySave(); }} className="minimax-wizard-link">Save without testing</a>
920
- </p>
921
- </div>
922
- )}
923
-
924
- {step === 3 && (
925
- <div className="minimax-wizard-body">
926
- <h3 className="minimax-wizard-title"><CircleCheck size={18} style={{ verticalAlign: 'text-bottom', marginRight: 6 }} />All set</h3>
927
- <p className="minimax-wizard-prose">The key works and is saved. Reloading so you can see your live quota.</p>
928
- <div className="minimax-wizard-actions">
929
- <Button variant="primary" size="md" onClick={() => window.location.reload()}>View your quota →</Button>
930
- </div>
931
- </div>
932
- )}
933
-
934
- <div className="minimax-wizard-footer">
935
- <ShieldCheck size={11} />
936
- <span>Key written to <code>~/.local/share/cline/auth.json</code> with mode 0600.</span>
937
- </div>
938
- </Card>
939
- </div>
940
- );
941
- }
942
- export const MiniMaxUsage = React.memo(MiniMaxUsageInner);