opencode-quota-gui 1.2.0 → 1.3.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 (523) hide show
  1. package/README.md +90 -30
  2. package/dist/bin/opencode-quota-gui.js +0 -0
  3. package/dist/contracts/analytics-entity.d.ts +6 -1
  4. package/dist/contracts/analytics-entity.js +27 -10
  5. package/dist/contracts/build-identity.js +1 -1
  6. package/dist/contracts/card-visibility.d.ts +21 -0
  7. package/dist/contracts/card-visibility.js +19 -0
  8. package/dist/contracts/dashboard.d.ts +27 -0
  9. package/dist/contracts/dashboard.js +2 -0
  10. package/dist/contracts/dto-guards.d.ts +24 -0
  11. package/dist/contracts/dto-guards.js +592 -0
  12. package/dist/contracts/provider-failure.d.ts +18 -0
  13. package/dist/contracts/provider-failure.js +25 -0
  14. package/dist/gui/config.d.ts +20 -3
  15. package/dist/gui/config.js +42 -3
  16. package/dist/gui/dashboard-errors.d.ts +32 -0
  17. package/dist/gui/dashboard-errors.js +97 -0
  18. package/dist/gui/lifecycle.d.ts +44 -11
  19. package/dist/gui/lifecycle.js +214 -36
  20. package/dist/gui/primary-quota-windows.d.ts +28 -0
  21. package/dist/gui/primary-quota-windows.js +147 -0
  22. package/dist/gui/provider-cards.d.ts +1 -1
  23. package/dist/gui/provider-cards.js +40 -16
  24. package/dist/gui/quota-notification-detector.d.ts +151 -0
  25. package/dist/gui/quota-notification-detector.js +284 -0
  26. package/dist/gui/quota-notification-observer.d.ts +55 -0
  27. package/dist/gui/quota-notification-observer.js +363 -0
  28. package/dist/gui/rpc.d.ts +59 -0
  29. package/dist/gui/rpc.js +302 -0
  30. package/dist/gui/server.d.ts +15 -27
  31. package/dist/gui/server.js +23 -121
  32. package/dist/gui/snapshot-service.d.ts +31 -4
  33. package/dist/gui/snapshot-service.js +177 -54
  34. package/dist/gui/sources.d.ts +1 -1
  35. package/dist/gui-experimental.cjs +1756 -0
  36. package/dist/lib/anthropic.d.ts +5 -0
  37. package/dist/lib/anthropic.js +18 -1
  38. package/dist/lib/chutes.js +19 -2
  39. package/dist/lib/config.d.ts +5 -1
  40. package/dist/lib/config.js +48 -0
  41. package/dist/lib/copilot.js +42 -14
  42. package/dist/lib/dashboard-web-policy.d.ts +35 -0
  43. package/dist/lib/dashboard-web-policy.js +24 -0
  44. package/dist/lib/deepseek.js +12 -1
  45. package/dist/lib/display-sanitize.js +2 -0
  46. package/dist/lib/entries.d.ts +3 -0
  47. package/dist/lib/format-utils.d.ts +1 -1
  48. package/dist/lib/format-utils.js +2 -2
  49. package/dist/lib/glm-coding-plan.js +14 -4
  50. package/dist/lib/google-agy.js +59 -14
  51. package/dist/lib/google-gemini-cli.js +58 -14
  52. package/dist/lib/init-installer.js +25 -4
  53. package/dist/lib/kilo.js +29 -40
  54. package/dist/lib/kimi.js +13 -1
  55. package/dist/lib/mimo.d.ts +2 -0
  56. package/dist/lib/mimo.js +9 -1
  57. package/dist/lib/nanogpt.d.ts +2 -0
  58. package/dist/lib/nanogpt.js +24 -3
  59. package/dist/lib/ollama-cloud.js +9 -0
  60. package/dist/lib/openai.js +6 -2
  61. package/dist/lib/opencode-auth.d.ts +3 -2
  62. package/dist/lib/opencode-auth.js +8 -1
  63. package/dist/lib/opencode-go.js +24 -3
  64. package/dist/lib/opencode-version.d.ts +21 -0
  65. package/dist/lib/opencode-version.js +53 -5
  66. package/dist/lib/opencode-zen.d.ts +9 -1
  67. package/dist/lib/opencode-zen.js +27 -7
  68. package/dist/lib/quota-providers-remote.d.ts +2 -0
  69. package/dist/lib/quota-providers-remote.js +78 -19
  70. package/dist/lib/quota-reset-notifications.d.ts +17 -0
  71. package/dist/lib/quota-reset-notifications.js +11 -2
  72. package/dist/lib/quota-state-codec.js +3 -1
  73. package/dist/lib/synthetic.js +8 -0
  74. package/dist/lib/types.d.ts +18 -0
  75. package/dist/lib/types.js +3 -0
  76. package/dist/lib/xai.js +16 -2
  77. package/dist/plugin.d.ts +4 -3
  78. package/dist/plugin.js +33 -4
  79. package/dist/providers/alibaba-coding-plan.js +3 -1
  80. package/dist/providers/alibaba-token-plan.js +17 -0
  81. package/dist/providers/anthropic.js +12 -3
  82. package/dist/providers/copilot.js +10 -2
  83. package/dist/providers/glm-coding-plan-provider.d.ts +2 -0
  84. package/dist/providers/glm-coding-plan-provider.js +5 -1
  85. package/dist/providers/google-account-format.js +1 -0
  86. package/dist/providers/google-agy.js +12 -2
  87. package/dist/providers/google-gemini-cli.js +12 -2
  88. package/dist/providers/kilo.js +9 -1
  89. package/dist/providers/kimi-code.js +11 -6
  90. package/dist/providers/mimo.js +8 -2
  91. package/dist/providers/minimax-coding-plan.js +28 -5
  92. package/dist/providers/nanogpt.js +3 -0
  93. package/dist/providers/ollama-cloud.js +3 -0
  94. package/dist/providers/openai.js +1 -0
  95. package/dist/providers/opencode-go.js +8 -1
  96. package/dist/providers/opencode-zen.js +30 -3
  97. package/dist/providers/openrouter.js +3 -0
  98. package/dist/providers/quota-providers.js +30 -4
  99. package/dist/providers/result-helpers.d.ts +4 -0
  100. package/dist/providers/result-helpers.js +16 -2
  101. package/dist/rpc.d.ts +327 -4
  102. package/dist/rpc.js +315 -2
  103. package/dist/ui/assets/index-DLHeXYff.js +9 -0
  104. package/dist/ui/assets/{index-Cs-nrywz.css → index-cDd9jUVY.css} +1 -1
  105. package/dist/ui/assets/{popover-DKRrwr_K.js → popover-BGkgv9s0.js} +1 -1
  106. package/dist/ui/index.html +2 -2
  107. package/package.json +49 -40
  108. package/dist/bin/opencode-quota-gui.d.ts.map +0 -1
  109. package/dist/bin/opencode-quota-gui.js.map +0 -1
  110. package/dist/contracts/analytics-entity.d.ts.map +0 -1
  111. package/dist/contracts/analytics-entity.js.map +0 -1
  112. package/dist/contracts/analytics-temporal.d.ts.map +0 -1
  113. package/dist/contracts/analytics-temporal.js.map +0 -1
  114. package/dist/contracts/build-identity.d.ts.map +0 -1
  115. package/dist/contracts/card-order.d.ts.map +0 -1
  116. package/dist/contracts/card-order.js.map +0 -1
  117. package/dist/contracts/collision-safe-key.d.ts.map +0 -1
  118. package/dist/contracts/collision-safe-key.js.map +0 -1
  119. package/dist/contracts/dashboard.d.ts.map +0 -1
  120. package/dist/contracts/dashboard.js.map +0 -1
  121. package/dist/contracts/guards.d.ts.map +0 -1
  122. package/dist/contracts/guards.js.map +0 -1
  123. package/dist/contracts/identity.d.ts.map +0 -1
  124. package/dist/contracts/identity.js.map +0 -1
  125. package/dist/contracts/openai-quota.d.ts.map +0 -1
  126. package/dist/contracts/openai-quota.js.map +0 -1
  127. package/dist/contracts/ranges.d.ts.map +0 -1
  128. package/dist/contracts/ranges.js.map +0 -1
  129. package/dist/contracts/settings.d.ts.map +0 -1
  130. package/dist/contracts/settings.js.map +0 -1
  131. package/dist/contracts/temporal.d.ts.map +0 -1
  132. package/dist/contracts/temporal.js.map +0 -1
  133. package/dist/contracts/time-zone.d.ts.map +0 -1
  134. package/dist/contracts/time-zone.js.map +0 -1
  135. package/dist/gui/aggregation.d.ts.map +0 -1
  136. package/dist/gui/aggregation.js.map +0 -1
  137. package/dist/gui/analytics-bridge.d.ts.map +0 -1
  138. package/dist/gui/analytics-bridge.js.map +0 -1
  139. package/dist/gui/analytics-engine.d.ts.map +0 -1
  140. package/dist/gui/analytics-engine.js.map +0 -1
  141. package/dist/gui/analytics-indexes.d.ts.map +0 -1
  142. package/dist/gui/analytics-indexes.js.map +0 -1
  143. package/dist/gui/analytics-model.d.ts.map +0 -1
  144. package/dist/gui/analytics-model.js.map +0 -1
  145. package/dist/gui/analytics-pricing-revision.d.ts.map +0 -1
  146. package/dist/gui/analytics-pricing-revision.js.map +0 -1
  147. package/dist/gui/analytics-protocol.d.ts.map +0 -1
  148. package/dist/gui/analytics-protocol.js.map +0 -1
  149. package/dist/gui/analytics-reader.d.ts.map +0 -1
  150. package/dist/gui/analytics-reader.js.map +0 -1
  151. package/dist/gui/analytics-service.d.ts.map +0 -1
  152. package/dist/gui/analytics-service.js.map +0 -1
  153. package/dist/gui/analytics-state.d.ts.map +0 -1
  154. package/dist/gui/analytics-state.js.map +0 -1
  155. package/dist/gui/analytics-worker-runtime.d.ts.map +0 -1
  156. package/dist/gui/analytics-worker-runtime.js.map +0 -1
  157. package/dist/gui/analytics-worker.d.ts.map +0 -1
  158. package/dist/gui/analytics-worker.js.map +0 -1
  159. package/dist/gui/config.d.ts.map +0 -1
  160. package/dist/gui/config.js.map +0 -1
  161. package/dist/gui/identity.d.ts.map +0 -1
  162. package/dist/gui/identity.js.map +0 -1
  163. package/dist/gui/lifecycle.d.ts.map +0 -1
  164. package/dist/gui/lifecycle.js.map +0 -1
  165. package/dist/gui/log.d.ts.map +0 -1
  166. package/dist/gui/log.js.map +0 -1
  167. package/dist/gui/provider-cards.d.ts.map +0 -1
  168. package/dist/gui/provider-cards.js.map +0 -1
  169. package/dist/gui/server.d.ts.map +0 -1
  170. package/dist/gui/server.js.map +0 -1
  171. package/dist/gui/settings-file-opener.d.ts.map +0 -1
  172. package/dist/gui/settings-file-opener.js.map +0 -1
  173. package/dist/gui/snapshot-service.d.ts.map +0 -1
  174. package/dist/gui/snapshot-service.js.map +0 -1
  175. package/dist/gui/sources.d.ts.map +0 -1
  176. package/dist/gui/sources.js.map +0 -1
  177. package/dist/gui/sse.d.ts.map +0 -1
  178. package/dist/gui/sse.js.map +0 -1
  179. package/dist/gui/temporal-quota-policy-data.d.ts.map +0 -1
  180. package/dist/gui/temporal-quota-policy-data.js.map +0 -1
  181. package/dist/gui/temporal-quota-policy.d.ts.map +0 -1
  182. package/dist/gui/temporal-quota-policy.js.map +0 -1
  183. package/dist/gui/temporal-status.d.ts.map +0 -1
  184. package/dist/gui/temporal-status.js.map +0 -1
  185. package/dist/gui/time-zone.d.ts.map +0 -1
  186. package/dist/gui/time-zone.js.map +0 -1
  187. package/dist/index.d.ts.map +0 -1
  188. package/dist/index.js.map +0 -1
  189. package/dist/lib/accounting-format.d.ts.map +0 -1
  190. package/dist/lib/accounting-format.js.map +0 -1
  191. package/dist/lib/alibaba-auth.d.ts.map +0 -1
  192. package/dist/lib/alibaba-auth.js.map +0 -1
  193. package/dist/lib/alibaba-coding-plan-local-quota.d.ts.map +0 -1
  194. package/dist/lib/alibaba-coding-plan-local-quota.js.map +0 -1
  195. package/dist/lib/alibaba-token-plan.d.ts.map +0 -1
  196. package/dist/lib/alibaba-token-plan.js.map +0 -1
  197. package/dist/lib/anthropic-auth.d.ts.map +0 -1
  198. package/dist/lib/anthropic-auth.js.map +0 -1
  199. package/dist/lib/anthropic.d.ts.map +0 -1
  200. package/dist/lib/anthropic.js.map +0 -1
  201. package/dist/lib/api-key-resolver.d.ts.map +0 -1
  202. package/dist/lib/api-key-resolver.js.map +0 -1
  203. package/dist/lib/atomic-json.d.ts.map +0 -1
  204. package/dist/lib/atomic-json.js.map +0 -1
  205. package/dist/lib/chutes-config.d.ts.map +0 -1
  206. package/dist/lib/chutes-config.js.map +0 -1
  207. package/dist/lib/chutes.d.ts.map +0 -1
  208. package/dist/lib/chutes.js.map +0 -1
  209. package/dist/lib/cli-reports.d.ts.map +0 -1
  210. package/dist/lib/cli-reports.js.map +0 -1
  211. package/dist/lib/cli-show.d.ts.map +0 -1
  212. package/dist/lib/cli-show.js.map +0 -1
  213. package/dist/lib/cli-status.d.ts.map +0 -1
  214. package/dist/lib/cli-status.js.map +0 -1
  215. package/dist/lib/command-parsing.d.ts.map +0 -1
  216. package/dist/lib/command-parsing.js.map +0 -1
  217. package/dist/lib/config-file-utils.d.ts.map +0 -1
  218. package/dist/lib/config-file-utils.js.map +0 -1
  219. package/dist/lib/config-write-target.d.ts.map +0 -1
  220. package/dist/lib/config-write-target.js.map +0 -1
  221. package/dist/lib/config.d.ts.map +0 -1
  222. package/dist/lib/config.js.map +0 -1
  223. package/dist/lib/copilot.d.ts.map +0 -1
  224. package/dist/lib/copilot.js.map +0 -1
  225. package/dist/lib/cursor-detection.d.ts.map +0 -1
  226. package/dist/lib/cursor-detection.js.map +0 -1
  227. package/dist/lib/cursor-pricing.d.ts.map +0 -1
  228. package/dist/lib/cursor-pricing.js.map +0 -1
  229. package/dist/lib/cursor-usage.d.ts.map +0 -1
  230. package/dist/lib/cursor-usage.js.map +0 -1
  231. package/dist/lib/dashboard-visibility.d.ts.map +0 -1
  232. package/dist/lib/dashboard-visibility.js.map +0 -1
  233. package/dist/lib/deepseek-auth.d.ts.map +0 -1
  234. package/dist/lib/deepseek-auth.js.map +0 -1
  235. package/dist/lib/deepseek.d.ts.map +0 -1
  236. package/dist/lib/deepseek.js.map +0 -1
  237. package/dist/lib/display-sanitize.d.ts.map +0 -1
  238. package/dist/lib/display-sanitize.js.map +0 -1
  239. package/dist/lib/entries.d.ts.map +0 -1
  240. package/dist/lib/entries.js.map +0 -1
  241. package/dist/lib/env-template.d.ts.map +0 -1
  242. package/dist/lib/env-template.js.map +0 -1
  243. package/dist/lib/format-utils.d.ts.map +0 -1
  244. package/dist/lib/format-utils.js.map +0 -1
  245. package/dist/lib/format.d.ts.map +0 -1
  246. package/dist/lib/format.js.map +0 -1
  247. package/dist/lib/glm-coding-plan.d.ts.map +0 -1
  248. package/dist/lib/glm-coding-plan.js.map +0 -1
  249. package/dist/lib/google-agy-companion.d.ts.map +0 -1
  250. package/dist/lib/google-agy-companion.js.map +0 -1
  251. package/dist/lib/google-agy.d.ts.map +0 -1
  252. package/dist/lib/google-agy.js.map +0 -1
  253. package/dist/lib/google-companion-credentials.d.ts.map +0 -1
  254. package/dist/lib/google-companion-credentials.js.map +0 -1
  255. package/dist/lib/google-gemini-cli-companion.d.ts.map +0 -1
  256. package/dist/lib/google-gemini-cli-companion.js.map +0 -1
  257. package/dist/lib/google-gemini-cli.d.ts.map +0 -1
  258. package/dist/lib/google-gemini-cli.js.map +0 -1
  259. package/dist/lib/google-token-cache.d.ts.map +0 -1
  260. package/dist/lib/google-token-cache.js.map +0 -1
  261. package/dist/lib/grouped-entry-normalization.d.ts.map +0 -1
  262. package/dist/lib/grouped-entry-normalization.js.map +0 -1
  263. package/dist/lib/grouped-header-format.d.ts.map +0 -1
  264. package/dist/lib/grouped-header-format.js.map +0 -1
  265. package/dist/lib/gui-config-target.d.ts.map +0 -1
  266. package/dist/lib/gui-config-target.js.map +0 -1
  267. package/dist/lib/home-dir-display.d.ts.map +0 -1
  268. package/dist/lib/home-dir-display.js.map +0 -1
  269. package/dist/lib/http.d.ts.map +0 -1
  270. package/dist/lib/http.js.map +0 -1
  271. package/dist/lib/init-installer.d.ts.map +0 -1
  272. package/dist/lib/init-installer.js.map +0 -1
  273. package/dist/lib/jsonc.d.ts.map +0 -1
  274. package/dist/lib/jsonc.js.map +0 -1
  275. package/dist/lib/kilo-config.d.ts.map +0 -1
  276. package/dist/lib/kilo-config.js.map +0 -1
  277. package/dist/lib/kilo.d.ts.map +0 -1
  278. package/dist/lib/kilo.js.map +0 -1
  279. package/dist/lib/kimi-auth.d.ts.map +0 -1
  280. package/dist/lib/kimi-auth.js.map +0 -1
  281. package/dist/lib/kimi-endpoints.d.ts.map +0 -1
  282. package/dist/lib/kimi-endpoints.js.map +0 -1
  283. package/dist/lib/kimi.d.ts.map +0 -1
  284. package/dist/lib/kimi.js.map +0 -1
  285. package/dist/lib/maintainer-announcements.d.ts.map +0 -1
  286. package/dist/lib/maintainer-announcements.js.map +0 -1
  287. package/dist/lib/map-with-concurrency.d.ts.map +0 -1
  288. package/dist/lib/map-with-concurrency.js.map +0 -1
  289. package/dist/lib/markdown-table.d.ts.map +0 -1
  290. package/dist/lib/markdown-table.js.map +0 -1
  291. package/dist/lib/mimo-config.d.ts.map +0 -1
  292. package/dist/lib/mimo-config.js.map +0 -1
  293. package/dist/lib/mimo.d.ts.map +0 -1
  294. package/dist/lib/mimo.js.map +0 -1
  295. package/dist/lib/minimax-auth.d.ts.map +0 -1
  296. package/dist/lib/minimax-auth.js.map +0 -1
  297. package/dist/lib/minimax-endpoints.d.ts.map +0 -1
  298. package/dist/lib/minimax-endpoints.js.map +0 -1
  299. package/dist/lib/modelsdev-pricing.d.ts.map +0 -1
  300. package/dist/lib/modelsdev-pricing.js.map +0 -1
  301. package/dist/lib/modelsdev-temporal.d.ts.map +0 -1
  302. package/dist/lib/modelsdev-temporal.js.map +0 -1
  303. package/dist/lib/nanogpt-config.d.ts.map +0 -1
  304. package/dist/lib/nanogpt-config.js.map +0 -1
  305. package/dist/lib/nanogpt.d.ts.map +0 -1
  306. package/dist/lib/nanogpt.js.map +0 -1
  307. package/dist/lib/ollama-cloud-config.d.ts.map +0 -1
  308. package/dist/lib/ollama-cloud-config.js.map +0 -1
  309. package/dist/lib/ollama-cloud.d.ts.map +0 -1
  310. package/dist/lib/ollama-cloud.js.map +0 -1
  311. package/dist/lib/openai.d.ts.map +0 -1
  312. package/dist/lib/openai.js.map +0 -1
  313. package/dist/lib/opencode-auth-sqlite.d.ts.map +0 -1
  314. package/dist/lib/opencode-auth-sqlite.js.map +0 -1
  315. package/dist/lib/opencode-auth.d.ts.map +0 -1
  316. package/dist/lib/opencode-auth.js.map +0 -1
  317. package/dist/lib/opencode-config-editor.d.ts.map +0 -1
  318. package/dist/lib/opencode-config-editor.js.map +0 -1
  319. package/dist/lib/opencode-config-providers.d.ts.map +0 -1
  320. package/dist/lib/opencode-config-providers.js.map +0 -1
  321. package/dist/lib/opencode-config-read.d.ts.map +0 -1
  322. package/dist/lib/opencode-config-read.js.map +0 -1
  323. package/dist/lib/opencode-console-auth.d.ts.map +0 -1
  324. package/dist/lib/opencode-console-auth.js.map +0 -1
  325. package/dist/lib/opencode-db-path.d.ts.map +0 -1
  326. package/dist/lib/opencode-db-path.js.map +0 -1
  327. package/dist/lib/opencode-go-auth.d.ts.map +0 -1
  328. package/dist/lib/opencode-go-auth.js.map +0 -1
  329. package/dist/lib/opencode-go.d.ts.map +0 -1
  330. package/dist/lib/opencode-go.js.map +0 -1
  331. package/dist/lib/opencode-runtime-paths.d.ts.map +0 -1
  332. package/dist/lib/opencode-runtime-paths.js.map +0 -1
  333. package/dist/lib/opencode-sqlite.d.ts.map +0 -1
  334. package/dist/lib/opencode-sqlite.js.map +0 -1
  335. package/dist/lib/opencode-storage.d.ts.map +0 -1
  336. package/dist/lib/opencode-storage.js.map +0 -1
  337. package/dist/lib/opencode-version.d.ts.map +0 -1
  338. package/dist/lib/opencode-version.js.map +0 -1
  339. package/dist/lib/opencode-zen.d.ts.map +0 -1
  340. package/dist/lib/opencode-zen.js.map +0 -1
  341. package/dist/lib/openrouter.d.ts.map +0 -1
  342. package/dist/lib/openrouter.js.map +0 -1
  343. package/dist/lib/private-state-paths.d.ts.map +0 -1
  344. package/dist/lib/private-state-paths.js.map +0 -1
  345. package/dist/lib/provider-add-command.d.ts.map +0 -1
  346. package/dist/lib/provider-add-command.js.map +0 -1
  347. package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +0 -1
  348. package/dist/lib/provider-add-json-v1-questionnaire.js.map +0 -1
  349. package/dist/lib/provider-add.d.ts.map +0 -1
  350. package/dist/lib/provider-add.js.map +0 -1
  351. package/dist/lib/provider-availability.d.ts.map +0 -1
  352. package/dist/lib/provider-availability.js.map +0 -1
  353. package/dist/lib/provider-metadata.d.ts.map +0 -1
  354. package/dist/lib/provider-metadata.js.map +0 -1
  355. package/dist/lib/provider-model-matching.d.ts.map +0 -1
  356. package/dist/lib/provider-model-matching.js.map +0 -1
  357. package/dist/lib/provider-registration.d.ts.map +0 -1
  358. package/dist/lib/provider-registration.js.map +0 -1
  359. package/dist/lib/quota-accounting-projection.d.ts.map +0 -1
  360. package/dist/lib/quota-accounting-projection.js.map +0 -1
  361. package/dist/lib/quota-columns.d.ts.map +0 -1
  362. package/dist/lib/quota-columns.js.map +0 -1
  363. package/dist/lib/quota-command-format.d.ts.map +0 -1
  364. package/dist/lib/quota-command-format.js.map +0 -1
  365. package/dist/lib/quota-dialog-command-specs.d.ts.map +0 -1
  366. package/dist/lib/quota-dialog-command-specs.js.map +0 -1
  367. package/dist/lib/quota-dialog-commands.d.ts.map +0 -1
  368. package/dist/lib/quota-dialog-commands.js.map +0 -1
  369. package/dist/lib/quota-entry-display.d.ts.map +0 -1
  370. package/dist/lib/quota-entry-display.js.map +0 -1
  371. package/dist/lib/quota-exhaustion-projection.d.ts.map +0 -1
  372. package/dist/lib/quota-exhaustion-projection.js.map +0 -1
  373. package/dist/lib/quota-export-types.d.ts.map +0 -1
  374. package/dist/lib/quota-export-types.js.map +0 -1
  375. package/dist/lib/quota-export.d.ts.map +0 -1
  376. package/dist/lib/quota-export.js.map +0 -1
  377. package/dist/lib/quota-format-style.d.ts.map +0 -1
  378. package/dist/lib/quota-format-style.js.map +0 -1
  379. package/dist/lib/quota-providers-local.d.ts.map +0 -1
  380. package/dist/lib/quota-providers-local.js.map +0 -1
  381. package/dist/lib/quota-providers-remote.d.ts.map +0 -1
  382. package/dist/lib/quota-providers-remote.js.map +0 -1
  383. package/dist/lib/quota-providers.d.ts.map +0 -1
  384. package/dist/lib/quota-providers.js.map +0 -1
  385. package/dist/lib/quota-render-data.d.ts.map +0 -1
  386. package/dist/lib/quota-render-data.js.map +0 -1
  387. package/dist/lib/quota-report-message.d.ts.map +0 -1
  388. package/dist/lib/quota-report-message.js.map +0 -1
  389. package/dist/lib/quota-reset-notifications.d.ts.map +0 -1
  390. package/dist/lib/quota-reset-notifications.js.map +0 -1
  391. package/dist/lib/quota-retry-wait.d.ts.map +0 -1
  392. package/dist/lib/quota-retry-wait.js.map +0 -1
  393. package/dist/lib/quota-runtime-context.d.ts.map +0 -1
  394. package/dist/lib/quota-runtime-context.js.map +0 -1
  395. package/dist/lib/quota-state-codec.d.ts.map +0 -1
  396. package/dist/lib/quota-state-codec.js.map +0 -1
  397. package/dist/lib/quota-state.d.ts.map +0 -1
  398. package/dist/lib/quota-state.js.map +0 -1
  399. package/dist/lib/quota-stats-format.d.ts.map +0 -1
  400. package/dist/lib/quota-stats-format.js.map +0 -1
  401. package/dist/lib/quota-stats.d.ts.map +0 -1
  402. package/dist/lib/quota-stats.js.map +0 -1
  403. package/dist/lib/quota-status.d.ts.map +0 -1
  404. package/dist/lib/quota-status.js.map +0 -1
  405. package/dist/lib/quota-surface-data.d.ts.map +0 -1
  406. package/dist/lib/quota-surface-data.js.map +0 -1
  407. package/dist/lib/quota-telemetry.d.ts.map +0 -1
  408. package/dist/lib/quota-telemetry.js.map +0 -1
  409. package/dist/lib/report-document.d.ts.map +0 -1
  410. package/dist/lib/report-document.js.map +0 -1
  411. package/dist/lib/resolved-auth-identity.d.ts.map +0 -1
  412. package/dist/lib/resolved-auth-identity.js.map +0 -1
  413. package/dist/lib/runtime-provider-ids.d.ts.map +0 -1
  414. package/dist/lib/runtime-provider-ids.js.map +0 -1
  415. package/dist/lib/scoped-query-chunks.d.ts.map +0 -1
  416. package/dist/lib/scoped-query-chunks.js.map +0 -1
  417. package/dist/lib/scoped-update-migration.d.ts.map +0 -1
  418. package/dist/lib/scoped-update-migration.js.map +0 -1
  419. package/dist/lib/scoped-update.d.ts.map +0 -1
  420. package/dist/lib/scoped-update.js.map +0 -1
  421. package/dist/lib/session-tokens-format.d.ts.map +0 -1
  422. package/dist/lib/session-tokens-format.js.map +0 -1
  423. package/dist/lib/session-tokens.d.ts.map +0 -1
  424. package/dist/lib/session-tokens.js.map +0 -1
  425. package/dist/lib/synthetic-config.d.ts.map +0 -1
  426. package/dist/lib/synthetic-config.js.map +0 -1
  427. package/dist/lib/synthetic.d.ts.map +0 -1
  428. package/dist/lib/synthetic.js.map +0 -1
  429. package/dist/lib/toast-format-grouped.d.ts.map +0 -1
  430. package/dist/lib/toast-format-grouped.js.map +0 -1
  431. package/dist/lib/token-buckets.d.ts.map +0 -1
  432. package/dist/lib/token-buckets.js.map +0 -1
  433. package/dist/lib/token-cost.d.ts.map +0 -1
  434. package/dist/lib/token-cost.js.map +0 -1
  435. package/dist/lib/tui-compact-format.d.ts.map +0 -1
  436. package/dist/lib/tui-compact-format.js.map +0 -1
  437. package/dist/lib/tui-panel-state.d.ts.map +0 -1
  438. package/dist/lib/tui-panel-state.js.map +0 -1
  439. package/dist/lib/tui-prompt-bar-format.d.ts.map +0 -1
  440. package/dist/lib/tui-prompt-bar-format.js.map +0 -1
  441. package/dist/lib/tui-sidebar-format.d.ts.map +0 -1
  442. package/dist/lib/tui-sidebar-format.js.map +0 -1
  443. package/dist/lib/types.d.ts.map +0 -1
  444. package/dist/lib/types.js.map +0 -1
  445. package/dist/lib/usage-ownership.d.ts.map +0 -1
  446. package/dist/lib/usage-ownership.js.map +0 -1
  447. package/dist/lib/version.d.ts.map +0 -1
  448. package/dist/lib/version.js.map +0 -1
  449. package/dist/lib/xai.d.ts.map +0 -1
  450. package/dist/lib/xai.js.map +0 -1
  451. package/dist/lib/zai-auth.d.ts.map +0 -1
  452. package/dist/lib/zai-auth.js.map +0 -1
  453. package/dist/lib/zai.d.ts.map +0 -1
  454. package/dist/lib/zai.js.map +0 -1
  455. package/dist/lib/zhipu-auth.d.ts.map +0 -1
  456. package/dist/lib/zhipu-auth.js.map +0 -1
  457. package/dist/lib/zhipu.d.ts.map +0 -1
  458. package/dist/lib/zhipu.js.map +0 -1
  459. package/dist/plugin.d.ts.map +0 -1
  460. package/dist/plugin.js.map +0 -1
  461. package/dist/providers/accounting-decimal.d.ts.map +0 -1
  462. package/dist/providers/accounting-decimal.js.map +0 -1
  463. package/dist/providers/alibaba-coding-plan.d.ts.map +0 -1
  464. package/dist/providers/alibaba-coding-plan.js.map +0 -1
  465. package/dist/providers/alibaba-token-plan.d.ts.map +0 -1
  466. package/dist/providers/alibaba-token-plan.js.map +0 -1
  467. package/dist/providers/anthropic.d.ts.map +0 -1
  468. package/dist/providers/anthropic.js.map +0 -1
  469. package/dist/providers/cache-policies.d.ts.map +0 -1
  470. package/dist/providers/cache-policies.js.map +0 -1
  471. package/dist/providers/chutes.d.ts.map +0 -1
  472. package/dist/providers/chutes.js.map +0 -1
  473. package/dist/providers/copilot.d.ts.map +0 -1
  474. package/dist/providers/copilot.js.map +0 -1
  475. package/dist/providers/cursor.d.ts.map +0 -1
  476. package/dist/providers/cursor.js.map +0 -1
  477. package/dist/providers/deepseek.d.ts.map +0 -1
  478. package/dist/providers/deepseek.js.map +0 -1
  479. package/dist/providers/glm-coding-plan-provider.d.ts.map +0 -1
  480. package/dist/providers/glm-coding-plan-provider.js.map +0 -1
  481. package/dist/providers/google-account-format.d.ts.map +0 -1
  482. package/dist/providers/google-account-format.js.map +0 -1
  483. package/dist/providers/google-agy.d.ts.map +0 -1
  484. package/dist/providers/google-agy.js.map +0 -1
  485. package/dist/providers/google-gemini-cli.d.ts.map +0 -1
  486. package/dist/providers/google-gemini-cli.js.map +0 -1
  487. package/dist/providers/kilo.d.ts.map +0 -1
  488. package/dist/providers/kilo.js.map +0 -1
  489. package/dist/providers/kimi-code.d.ts.map +0 -1
  490. package/dist/providers/kimi-code.js.map +0 -1
  491. package/dist/providers/mimo.d.ts.map +0 -1
  492. package/dist/providers/mimo.js.map +0 -1
  493. package/dist/providers/minimax-coding-plan.d.ts.map +0 -1
  494. package/dist/providers/minimax-coding-plan.js.map +0 -1
  495. package/dist/providers/nanogpt.d.ts.map +0 -1
  496. package/dist/providers/nanogpt.js.map +0 -1
  497. package/dist/providers/ollama-cloud.d.ts.map +0 -1
  498. package/dist/providers/ollama-cloud.js.map +0 -1
  499. package/dist/providers/openai.d.ts.map +0 -1
  500. package/dist/providers/openai.js.map +0 -1
  501. package/dist/providers/opencode-go.d.ts.map +0 -1
  502. package/dist/providers/opencode-go.js.map +0 -1
  503. package/dist/providers/opencode-zen.d.ts.map +0 -1
  504. package/dist/providers/opencode-zen.js.map +0 -1
  505. package/dist/providers/openrouter.d.ts.map +0 -1
  506. package/dist/providers/openrouter.js.map +0 -1
  507. package/dist/providers/quota-providers.d.ts.map +0 -1
  508. package/dist/providers/quota-providers.js.map +0 -1
  509. package/dist/providers/registry.d.ts.map +0 -1
  510. package/dist/providers/registry.js.map +0 -1
  511. package/dist/providers/result-helpers.d.ts.map +0 -1
  512. package/dist/providers/result-helpers.js.map +0 -1
  513. package/dist/providers/synthetic.d.ts.map +0 -1
  514. package/dist/providers/synthetic.js.map +0 -1
  515. package/dist/providers/xai.d.ts.map +0 -1
  516. package/dist/providers/xai.js.map +0 -1
  517. package/dist/providers/zai.d.ts.map +0 -1
  518. package/dist/providers/zai.js.map +0 -1
  519. package/dist/providers/zhipu.d.ts.map +0 -1
  520. package/dist/providers/zhipu.js.map +0 -1
  521. package/dist/rpc.d.ts.map +0 -1
  522. package/dist/rpc.js.map +0 -1
  523. package/dist/ui/assets/index-D9lFKhSN.js +0 -9
package/README.md CHANGED
@@ -4,37 +4,68 @@
4
4
 
5
5
  # OpenCode Quota GUI
6
6
 
7
- A local dashboard for your OpenCode quota, provider accounts, token usage, projects, and sessions. It runs beside OpenCode, listens only on loopback, and keeps its settings and cached data in this product's own namespace.
7
+ Quota, token usage, and analytics inside OpenCode Desktop. OpenCode Quota GUI adds a native side panel, a session-header quota slot, and native notifications to OpenCode. Everything is read and shown locally: there is no hosted service, no cloud account, and no remote usage store.
8
8
 
9
9
  <p align="center">
10
10
  <a href="https://www.npmjs.com/package/opencode-quota-gui"><img alt="npm" src="https://img.shields.io/npm/v/opencode-quota-gui?style=flat-square" /></a>
11
11
  <a href="./LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" /></a>
12
12
  </p>
13
13
 
14
+ ## Native OpenCode Desktop
15
+
16
+ The Native panel is the primary experience in **v1.3.0**. Open **Quota & Usage** for Quota, Analytics, Models, and their detail pages; OpenCode Settings includes the plugin's **Quota & analytics** page. The session header shows a compact quota slot with a combined preview.
17
+
18
+ The Native integration ships from **v1.3.0** and requires **OpenCode Desktop 2.2.0 or newer**.
19
+
20
+ <p align="center">
21
+ <img src="images/opencode-quota-gui_quota.png" alt="OpenCode Desktop with the native Quota & Usage side panel showing provider account cards, remaining quota windows, and reset countdowns" />
22
+ </p>
23
+
24
+ <table>
25
+ <tr>
26
+ <td width="50%" valign="top">
27
+ <img src="images/opencode-quota-gui_session.png" alt="Session analytics in the native panel with per-step context and cumulative token charts across a session tree, compaction markers, and a session tree table" />
28
+ <br />
29
+ <sub><strong>Session analytics</strong> — per-session and whole-tree usage, compaction markers, and the session tree.</sub>
30
+ </td>
31
+ <td width="50%" valign="top">
32
+ <img src="images/opencode-quota-gui_providers.png" alt="Models analytics grouped by provider with a stacked token chart, an API-equivalent cost line, and a cost and token breakdown by provider and model" />
33
+ <br />
34
+ <sub><strong>Models by provider</strong> — token and API-equivalent cost breakdown by provider and model.</sub>
35
+ </td>
36
+ </tr>
37
+ <tr>
38
+ <td width="50%" valign="top">
39
+ <img src="images/opencode-quota-gui_analytics.png" alt="Daily token usage with total tokens, an API-equivalent estimate, a stacked daily chart with cache hit rate, and project token totals" />
40
+ <br />
41
+ <sub><strong>Daily analytics</strong> — daily token usage, cache hit rate, and project totals.</sub>
42
+ </td>
43
+ <td width="50%" valign="top">
44
+ <img src="images/opencode-quota-gui_slot.png" alt="Session header quota rings with the combined quota preview popup open, listing each provider's windows and reset countdowns" />
45
+ <br />
46
+ <sub><strong>Header Slot</strong> — at-a-glance quota rings with the combined preview open.</sub>
47
+ </td>
48
+ </tr>
49
+ </table>
50
+
14
51
  ## What you get
15
52
 
16
- | Screenshots |
17
- | --- |
18
- | **Quota** |
19
- | ![Quota dashboard with provider logos, one card per account, plan and account labels, remaining quota windows, reset countdowns, and balance or spend rows](images/opencode-quota-gui_quota-1.1.0.png) |
20
- | **Analytics** |
21
- | ![Analytics dashboard with total tokens, an API-equivalent estimate, a daily token chart split into cache read, input, reasoning, and output, a cache hit rate line, and project totals](images/opencode-quota-gui_analytics-1.1.0.png) |
22
- | **Models by provider** |
23
- | ![Models dashboard grouped by provider with provider logos, a stacked token chart with an API-equivalent cost line, and a breakdown by provider and model](images/opencode-quota-gui_providers-1.1.0.png) |
24
- | **Session** |
25
- | ![Session detail with context and cumulative token charts across a session tree, compaction markers, and nested sessions with step and token counts](images/opencode-quota-gui_session-1.1.0.png) |
53
+ The Native panel is the primary surface in v1.3.0. Every feature below is available there, and the optional browser dashboard mirrors the same views as a fallback.
26
54
 
27
55
  ## Features
28
56
 
29
- - **Quota by provider account:** provider logos with plan, account, or workspace labels, and one card per signed-in account, seat, API key, or workspace. Cards show the quota and rate-limit windows, reset countdowns, and balance, spend, budget, or status rows the integration supports. OpenAI cards can add banked resets and credits; Cursor and Alibaba can estimate from local history; the active login is marked `(active)`.
57
+ - **Native panel:** Quota, Analytics, Models, and Settings live in OpenCode Desktop, with project, session, provider, and model drilldowns in the same side panel.
58
+ - **Header quota slot:** compact rings for quota windows with a stable identity, plus a combined preview of every visible provider and account.
59
+ - **Native notifications:** low quota, exhausted quota, quota reset, and provider or API failures. A focused window shows an in-app toast; a background window asks OpenCode to notify you. Set the low-quota threshold and duplicate cooldown in Settings.
60
+ - **Quota by provider account:** provider logos with plan, account, or workspace labels, and one card per signed-in account, seat, API key, or workspace. Multiple logins for one provider each get their own card. Cards show the quota and rate-limit windows, reset countdowns, and balance, spend, budget, or status rows the integration supports. OpenAI cards can add banked resets and credits; Cursor and Alibaba can estimate from local history; the active login is marked `(active)`.
30
61
  - **Peak and off-peak pricing:** for providers whose published rules define time-of-day pricing, the Quota header shows **Peak**, **Off-peak**, or **Mixed** with the next change, a per-model schedule in your local time, and holiday exceptions. Model detail pages split each provider route's historical tokens and API-equivalent cost into Peak and Off-peak rows.
31
62
  - **Analytics:** token usage over `24h`, `7d`, `30d`, or `lifetime`; a stacked daily token chart for cache read, input, reasoning, and output; a cache hit rate line; and projects you can sort by activity or tokens.
32
63
  - **Models:** stacked token charts grouped by provider or model, with an API-equivalent cost line and a sortable cost/token breakdown. Open a provider to see its models or a model to see its providers.
33
- - **Drilldowns:** Analytics → project → session, and Models → provider/model, as real URLs with working reload and browser back/forward.
64
+ - **Drilldowns:** Analytics → project → session, and Models → provider or model, with working back navigation.
34
65
  - **Session detail:** per-step context and cumulative own-session and whole-tree token charts, compaction markers, and a nested session tree with steps and totals.
35
66
  - **API-equivalent estimates:** list-price estimates for recorded tokens, using the peak or off-peak rate that applied when each step completed, shown beside token totals in Analytics, Models, projects, providers, and models. They are estimates, not subscription spend.
36
67
  - **Customization:** used or remaining percentages, label style, row detail, provider selection, refresh interval, request timeout, card order, per-card or per-row visibility, and which providers show peak and off-peak status. Custom quota providers and pricing fallbacks live in the canonical config.
37
- - **Local-first operation:** binds to `127.0.0.1`, has no cloud account or hosted sync, and reads OpenCode data on this machine. Reset-aware retry can hold a request until the provider's used-up quota window resets; turn it off with `waitForQuotaReset: false`.
68
+ - **Local-first operation:** no cloud account and no hosted sync; the plugin reads OpenCode data on this machine. The optional browser dashboard binds only to `127.0.0.1`. Reset-aware retry can hold a request until the provider's used-up quota window resets; turn it off with `waitForQuotaReset: false`.
38
69
 
39
70
  ## Quick start
40
71
 
@@ -55,19 +86,48 @@ That adds this entry to your OpenCode configuration, keeping the other plugins t
55
86
 
56
87
  OpenCode installs the configured npm plugin itself; you do not need a separate `npm install`. If you prefer to edit the config manually, add the same `opencode-quota-gui` entry to the plural `plugins` array in `~/.config/opencode/opencode.json(c)` or a project `opencode.json(c)`.
57
88
 
58
- Restart OpenCode, then open <http://localhost:4144/quota>. The first page may show an empty dashboard until OpenCode has loaded the plugin and discovered a provider account.
89
+ Then open **Quota & Usage** in OpenCode Desktop. The Native panel is available from **v1.3.0** and requires **OpenCode Desktop 2.2.0 or newer**.
90
+
91
+ The browser dashboard default follows the OpenCode host version. On hosts below **2.2.0**, it is on by default because the Native panel is unavailable there; at **2.2.0 or newer** it is off by default. An explicit `dashboard.enabled` value in the canonical settings always wins. When it runs, it is served on `127.0.0.1` at `dashboard.port` (default `4144`). To pin the behavior either way, edit the canonical settings file and restart OpenCode:
59
92
 
60
- Requirements: OpenCode `2.0.16` or newer and Node.js `22.13+` or `23.4+`. This package does not support OpenCode 1.
93
+ ```jsonc
94
+ {
95
+ "dashboard": {
96
+ "enabled": true,
97
+ "port": 4144
98
+ }
99
+ }
100
+ ```
61
101
 
62
- ## Dashboard
102
+ `true` forces web access on and `false` keeps it off. Then open <http://localhost:4144/quota>. The first page may show an empty dashboard until OpenCode has loaded the plugin and discovered a provider account. The path and platform overrides are in [Configuration](docs/readme/configuration.md#web-dashboard).
63
103
 
64
- The dashboard starts with the plugin and is served on `127.0.0.1` only. It does not listen on network interfaces, and there is no cloud component. Local port forwarding, proxy configuration, or another process running on the same machine is outside this guarantee.
104
+ Requirements: OpenCode `>= 2.0.16 < 2.3.0` and Node.js `22.13+` or `23.4+`. The Native Desktop integration ships from v1.3.0 and requires OpenCode Desktop 2.2.0+. This package does not support OpenCode 1.
105
+
106
+ ## Native panel
107
+
108
+ In OpenCode Desktop 2.2.0+, **Quota & Usage** opens the product in the side panel, and OpenCode Settings includes the plugin's **Quota & analytics** page. The session header shows compact quota rings; select the slot for the combined preview.
65
109
 
66
110
  - **Quota:** cards for discovered provider accounts, ordered and grouped by provider. Each card shows the provider mark, plan and account or workspace labels, the rows the integration supports, a compact percentage bar for percentage rows, reset countdowns, and card-local errors. OpenAI cards can include banked resets and credits. Multiple logins for one provider get their own cards, and the active login is marked `(active)`. For providers with time-based pricing, the header shows live peak and off-peak status; open a status for its schedule, next change, and holiday exceptions.
67
111
  - **Analytics:** total tokens and API-equivalent estimate for the selected range, a stacked token chart with cache hit rate, and projects ordered by activity or tokens. Open a project for its own token chart, worktree label, and root sessions.
68
112
  - **Models:** token usage and API-equivalent cost grouped by provider or model. Use the Provider/Model switch and sort the breakdown by cost or tokens. Provider and model rows open their own detail pages.
69
113
  - **Session:** the opened session and its descendants, with per-step context and cumulative token charts, own-session and whole-tree totals, compaction markers, and a session-tree table.
70
- - **Settings:** display, provider, request, temporal pricing, visibility, and card-order controls, plus the canonical settings file, any reported configuration issues, and build information.
114
+ - **Settings:** display, provider, request, temporal pricing, visibility, and card-order controls, plus the web dashboard switch, the canonical settings file, any reported configuration issues, and build information.
115
+
116
+ The panel follows you between sessions: switching sessions reuses the same shared quota and analytics state instead of starting over, and header quota indicators stay in place across OpenCode Desktop's normal dashboard watch rotations.
117
+
118
+ Native notifications cover low quota, exhausted quota, quota reset, and provider or API failures. The low-quota threshold and duplicate cooldown are configurable in Settings. A focused window shows an in-app toast; a background window asks OpenCode to notify you. Delivery is best effort, not exactly once.
119
+
120
+ ## Optional browser dashboard
121
+
122
+ The browser dashboard is a fallback for browser access, not the primary surface. Its default follows the OpenCode host version: on hosts below **2.2.0** it is on by default, because the Native panel requires 2.2.0 or newer; at **2.2.0 or newer** it is off by default. An explicit `dashboard.enabled: true` or `false` in the canonical settings always wins. When it runs, it is served on `127.0.0.1` at the fixed `dashboard.port` (default `4144`) only. It does not listen on network interfaces, does not fall back to another port, and has no cloud component. Local port forwarding, proxy configuration, or another process running on the same machine is outside this guarantee.
123
+
124
+ The browser view exposes the same product areas:
125
+
126
+ - **Quota:** provider account cards with the same rows, labels, reset countdowns, and peak and off-peak status as the Native panel.
127
+ - **Analytics:** total tokens and API-equivalent estimate for the selected range, a stacked token chart with cache hit rate, and projects ordered by activity or tokens.
128
+ - **Models:** token usage and API-equivalent cost grouped by provider or model, with detail pages for each.
129
+ - **Session:** the opened session and its descendants, with per-step context and cumulative token charts, own-session and whole-tree totals, compaction markers, and a session-tree table.
130
+ - **Settings:** the same shared settings form and canonical settings file information.
71
131
 
72
132
  The routes are real URLs, so reload and browser back/forward work:
73
133
 
@@ -78,19 +138,17 @@ The routes are real URLs, so reload and browser back/forward work:
78
138
  - `/session/<id>` — one session tree
79
139
  - `/settings` — dashboard settings
80
140
 
81
- OpenCode 2 currently has no stable native frontend extension surface suitable for rendering this dashboard inside the host UI. It therefore runs in your browser, and the plugin exposes only the local HTTP and event stream needed by that page. If a stable host extension API emerges, this integration may evolve; no such API or timeline is announced.
82
-
83
141
  ## Scope and limitations
84
142
 
85
143
  - **Tokens are not quota.** Quota cards show provider-reported quota, rate-limit, balance, spend, budget, or status values, plus documented local estimates for some providers. Analytics shows token activity recorded by OpenCode on this machine. A token total does not measure remaining quota, and a quota reset does not clear token history. Provider quota can include usage from outside OpenCode, while local analytics cannot see that usage.
86
144
  - **Cost estimates are not bills.** The API-equivalent figure applies list prices to recorded tokens. It is not subscription spend, an invoice, or a reconciliation of what a provider charged; plan pricing, credits, discounts, taxes, and provider billing adjustments are not applied.
87
145
  - **`Free`, `Unpriced`, and unknown tokens are distinct.** `Free` appears only for a non-empty total whose every token has an explicit zero list price. Unpriced or unknown tokens are excluded from the estimate; a mixed total is marked `Partial estimate`, and a non-empty total with no priced tokens is `Unpriced`, never `Free` or `USD 0`. A model with a missing or unrecognized identity or price can make a total partial or unpriced.
88
146
  - **Coverage is local and provider-limited.** Analytics covers completed steps in the local OpenCode database; other machines, other clients, deleted sessions, and activity not recorded as completed steps are absent. Historical provider/model attribution depends on the raw identities OpenCode stored. Provider coverage and plan support vary: some APIs expose only balance, spend, budget, or status, and a card cannot invent quota that the provider does not return. Cursor and Alibaba cards that use local history are estimates, not official provider totals.
89
- - **Browser and host limits.** The dashboard is a local browser UI bound to `127.0.0.1`; it is not a hosted service and has no TUI. It requires OpenCode 2 and a supported Node.js version.
147
+ - **Native and browser surfaces.** The Native panel requires OpenCode Desktop 2.2.0+ and ships from v1.3.0. The optional browser dashboard binds to `127.0.0.1`; it is not a hosted service, and the package has no TUI.
90
148
 
91
149
  ## Providers
92
150
 
93
- Most providers work automatically once you log in through OpenCode. A **Needs setup** link points to the extra step. Provider data is collected by the plugin inside the OpenCode host; the dashboard does not run a separate polling service. Quota cards use provider marks and plan, account, or workspace labels; each signed-in account, seat, API key, or workspace gets its own card, and the active login is marked `(active)`. OpenCode Console workspace display names refresh automatically.
151
+ Most providers work automatically once you log in through OpenCode. A **Needs setup** link points to the extra step. Provider data is collected by the plugin inside the OpenCode host; the plugin does not run a separate polling service. Quota cards use provider marks and plan, account, or workspace labels; each signed-in account, seat, API key, or workspace gets its own card, and the active login is marked `(active)`. OpenCode Console workspace display names refresh automatically.
94
152
 
95
153
  ### Pre-configured American providers
96
154
 
@@ -175,11 +233,11 @@ These show only your own member API key's usage, not the whole organization's.
175
233
 
176
234
  ### Custom providers
177
235
 
178
- A custom provider can read a supported quota API or estimate usage from your local OpenCode history. Define it in the global canonical settings file under `quotaProviders`; see the [custom-provider guide](docs/readme/providers.md#custom-providers) for the complete schema, adapter rules, and security limits. The dashboard Settings page does not create provider definitions.
236
+ A custom provider can read a supported quota API or estimate usage from your local OpenCode history. Define it in the global canonical settings file under `quotaProviders`; see the [custom-provider guide](docs/readme/providers.md#custom-providers) for the complete schema, adapter rules, and security limits. The Native Settings page does not create provider definitions.
179
237
 
180
238
  ## Settings and privacy
181
239
 
182
- The dashboard reads only the canonical file at runtime:
240
+ The plugin reads only the canonical file at runtime:
183
241
 
184
242
  ```text
185
243
  ~/.config/opencode/opencode-quota-gui/config.jsonc
@@ -190,12 +248,12 @@ The dashboard reads only the canonical file at runtime:
190
248
  - **Legacy import:** when a global legacy OpenCode Quota source exists, Settings can preview and copy seven compatible keys: `percentDisplayMode`, `percentLabelStyle`, `enabledProviders`, `minIntervalMs`, `requestTimeoutMs`, `accountingDetail`, and `waitForQuotaReset`. The import is read-only for the source; files stay byte-for-byte untouched. Custom provider definitions are not imported, so copy `quotaProviders` into the canonical file yourself.
191
249
  - **Visibility:** hiding a provider or row is presentation only and never changes polling or provider data. Opaque card and row IDs in `dashboard.hiddenCards` and `dashboard.hiddenRows` are internal identifiers: use **Settings → Visibility** to manage them instead of editing or deriving IDs by hand.
192
250
  - **Temporal pricing:** `dashboard.temporalProviderOverrides` stores sparse per-provider on/off choices for the live peak and off-peak status in the Quota header. A provider with a discovered account is shown by default; an explicit choice wins. Hiding a status is presentation only and never changes polling, quota values, or recorded usage.
193
- - **Port:** `dashboard.port` is read-only in the web UI. Edit the canonical file and restart OpenCode to change it; the default is `4144`.
251
+ - **Web dashboard (optional fallback):** on by default below OpenCode 2.2.0 and off by default at 2.2.0 and newer. An explicit `"dashboard": { "enabled": true }` or `"dashboard": { "enabled": false }` in the canonical file always wins. When enabled, the browser UI is served on `127.0.0.1` at `dashboard.port` (default `4144`), and the server never falls back to another port. Changes apply after an OpenCode restart.
194
252
  - **Browser storage:** the dashboard uses browser-local storage for display state such as the selected range and a visibility-catalog cache. It does not use cross-site cookies.
195
253
  - **Local data:** the plugin reads OpenCode's local configuration and login data through OpenCode, plus OpenCode's local session database for usage and session views. Provider quota checks use the provider's API or the documented local CLI or companion plugin. Token pricing can come from the bundled snapshot or `models.dev` at runtime. Peak and off-peak rules ship in the bundled snapshot and are evaluated locally.
196
254
  - **OpenTelemetry (optional):** off by default. Set `"telemetry": { "enabled": true }` in the canonical file to publish two gauges, `opencode.quota.consumed` and `opencode.quota.cache.age`, through the `@opentelemetry/api` global `MeterProvider` that your host process configures. The plugin does not create a `MeterProvider`, exporter, collector, or metrics endpoint, sends no metrics by itself, and makes no extra provider requests for telemetry. Metric names and attributes are not a public API. See [External integration](docs/readme/external-integration.md#optional-opentelemetry-advanced-host-owned).
197
255
  - **No hosted service:** this project has no cloud account, hosted dashboard, or remote usage store. The local server permits only loopback hosts and origins and sends no CORS headers.
198
- - **Build details:** Settings → About reports the embedded Version, Build, and Contract. A build or contract mismatch means the browser page and server plugin are from different builds; restart OpenCode, then reload the page. Reinstall the same package if it persists.
256
+ - **Build details:** Settings → About reports the embedded Version, Build, and Contract. A build or contract mismatch means the page and server plugin are from different builds; restart OpenCode, then reload the page. Reinstall the same package if it persists.
199
257
 
200
258
  See [Configuration](docs/readme/configuration.md) for every supported settings key and the custom-provider rules.
201
259
 
@@ -217,11 +275,13 @@ For a local build or release candidate, build the checkout and point the optiona
217
275
 
218
276
  ## OpenCode and upstream compatibility
219
277
 
220
- This release is GUI-only: it has no TUI. It does not register or provide a TUI panel, terminal quota interface or reports, slash command, tool, RPC method, report hook, toast, or status line, and it produces no report message, marker, or metadata contract. The `init` and `update` commands described above are maintenance only, not a quota interface. The only product activation is the OpenCode server plugin that starts the dashboard and keeps the credential and reset-retry lifecycle working.
278
+ This project has no TUI panel, terminal quota interface or reports, slash command, tool, report hook, or status line, and it produces no report message, marker, or metadata contract. The `init` and `update` commands described above are maintenance only, not a quota interface. The server plugin owns dashboard data, credentials, and reset-retry lifecycle; its dashboard RPC supports the Native Desktop GUI.
221
279
 
222
280
  It is independent of the upstream `@slkiser/opencode-quota` package. The two packages may be configured at the same time, and there is no dependency or conflict guard between them. Each owns its configuration and private state; this package writes under the `opencode-quota-gui` namespace and does not migrate, rewrite, or delete upstream configuration, cache, or credential files.
223
281
 
224
- Use the upstream project if you want its terminal surfaces. Use this project if you want the local dashboard. See [Updating safely](docs/readme/updating.md) for migration and coexistence details.
282
+ The browser dashboard default follows the OpenCode host version: it is on by default below 2.2.0, where the Native panel does not exist, and off by default at 2.2.0 and newer. An explicit `dashboard.enabled` value in the canonical settings always wins. Either way, the server stays loopback-only on `127.0.0.1`.
283
+
284
+ Use the upstream project if you want its terminal surfaces. Use this project if you want quota and usage inside OpenCode Desktop. See [Updating safely](docs/readme/updating.md) for migration and coexistence details.
225
285
 
226
286
  ## Support
227
287
 
@@ -239,7 +299,7 @@ Outside references: [OpenCode v2 docs](https://opencode.ai/v2/docs/) · [OpenCod
239
299
 
240
300
  ## Contributing
241
301
 
242
- Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening an issue or pull request. In short: open an issue first, run `pnpm verify`, keep the fix focused, and include before-and-after dashboard screenshots for any visible change. Credentials, account identifiers, and private paths must be redacted.
302
+ Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening an issue or pull request. In short: open an issue first, run `pnpm verify`, keep the fix focused, and include before-and-after screenshots for any visible change. Credentials, account identifiers, and private paths must be redacted.
243
303
 
244
304
  ## Acknowledgements and license
245
305
 
File without changes
@@ -21,7 +21,12 @@ export declare function encodeAnalyticsEntityToken(identity: AnalyticsEntityIden
21
21
  * encoding is accepted, so two byte sequences cannot stand for one identity.
22
22
  */
23
23
  export declare function decodeAnalyticsEntityToken(token: string): AnalyticsEntityIdentity | undefined;
24
- /** True for a structurally valid grouped query; raw id contents are unconstrained. */
24
+ /**
25
+ * True for an exact structurally valid grouped query; raw id contents are
26
+ * unconstrained. Nested `filter`/`identity` objects may not carry extra keys:
27
+ * the source echoes the filter into its response, so accepting extras would
28
+ * round-trip unvalidated data through the transport.
29
+ */
25
30
  export declare function isAnalyticsGroupQuery(value: unknown): value is AnalyticsGroupQuery;
26
31
  /**
27
32
  * Collision-safe cache/coalescing key for one grouped query. Length-prefixed
@@ -82,28 +82,45 @@ export function decodeAnalyticsEntityToken(token) {
82
82
  const identity = { kind: "known", id };
83
83
  return encodeAnalyticsEntityToken(identity) === token ? identity : undefined;
84
84
  }
85
- /** True for a structurally valid grouped query; raw id contents are unconstrained. */
85
+ function hasExactKeys(record, keys) {
86
+ const actual = Object.keys(record);
87
+ return actual.length === keys.length && actual.every((key) => keys.includes(key));
88
+ }
89
+ /**
90
+ * True for an exact structurally valid grouped query; raw id contents are
91
+ * unconstrained. Nested `filter`/`identity` objects may not carry extra keys:
92
+ * the source echoes the filter into its response, so accepting extras would
93
+ * round-trip unvalidated data through the transport.
94
+ */
86
95
  export function isAnalyticsGroupQuery(value) {
87
- if (typeof value !== "object" || value === null)
96
+ if (typeof value !== "object" || value === null || Array.isArray(value))
88
97
  return false;
89
98
  const record = value;
90
99
  if (!isRangeKey(record.range) || !isAnalyticsDimension(record.dimension))
91
100
  return false;
92
101
  const filter = record.filter;
93
- if (filter === undefined)
94
- return true;
95
- if (typeof filter !== "object" || filter === null)
102
+ if (filter === undefined) {
103
+ return hasExactKeys(record, ["range", "dimension"]);
104
+ }
105
+ if (!hasExactKeys(record, ["range", "dimension", "filter"]))
106
+ return false;
107
+ if (typeof filter !== "object" || filter === null || Array.isArray(filter))
96
108
  return false;
97
109
  const filterRecord = filter;
98
- if (!isAnalyticsDimension(filterRecord.dimension))
110
+ if (!hasExactKeys(filterRecord, ["dimension", "identity"]) ||
111
+ !isAnalyticsDimension(filterRecord.dimension)) {
99
112
  return false;
113
+ }
100
114
  const identity = filterRecord.identity;
101
- if (typeof identity !== "object" || identity === null)
115
+ if (typeof identity !== "object" || identity === null || Array.isArray(identity))
102
116
  return false;
103
117
  const identityRecord = identity;
104
- if (identityRecord.kind === "unknown")
105
- return true;
106
- return identityRecord.kind === "known" && typeof identityRecord.id === "string";
118
+ if (identityRecord.kind === "unknown") {
119
+ return hasExactKeys(identityRecord, ["kind"]);
120
+ }
121
+ return (identityRecord.kind === "known" &&
122
+ hasExactKeys(identityRecord, ["kind", "id"]) &&
123
+ typeof identityRecord.id === "string");
107
124
  }
108
125
  /**
109
126
  * Collision-safe cache/coalescing key for one grouped query. Length-prefixed
@@ -1 +1 @@
1
- export const BUILD_IDENTITY = Object.freeze({"version":"1.2.0","build":"3f518e1d2171"});
1
+ export const BUILD_IDENTITY = Object.freeze({"version":"1.3.0","build":"fea4e867c45c"});
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Authoritative normalized card-visibility semantics.
3
+ *
4
+ * Browser-safe and shared by the UI and the server-side quota notification
5
+ * detector. A card is hidden when the effective hidden-card list contains its
6
+ * exact `cardId`, its `providerId`, or its authoritative bare provider-scope
7
+ * hash. Effective server settings normalize legacy full scope ids to
8
+ * `providerId`; every full card id is now an exact hide. Row hiding is a
9
+ * separate, exact `rowId` check and is not affected by this helper.
10
+ */
11
+ export interface ProviderVisibilityIdentity {
12
+ providerId: string;
13
+ providerScopeHash?: string;
14
+ }
15
+ export interface CardVisibilityIdentity extends ProviderVisibilityIdentity {
16
+ cardId: string;
17
+ }
18
+ /** Consume normalized settings; never guess old semantics from the current catalog. */
19
+ export declare function isLegacyProviderHidden(card: ProviderVisibilityIdentity, hidden: ReadonlySet<string>): boolean;
20
+ export declare function isCardHidden(card: CardVisibilityIdentity, hidden: ReadonlySet<string>): boolean;
21
+ //# sourceMappingURL=card-visibility.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Authoritative normalized card-visibility semantics.
3
+ *
4
+ * Browser-safe and shared by the UI and the server-side quota notification
5
+ * detector. A card is hidden when the effective hidden-card list contains its
6
+ * exact `cardId`, its `providerId`, or its authoritative bare provider-scope
7
+ * hash. Effective server settings normalize legacy full scope ids to
8
+ * `providerId`; every full card id is now an exact hide. Row hiding is a
9
+ * separate, exact `rowId` check and is not affected by this helper.
10
+ */
11
+ /** Consume normalized settings; never guess old semantics from the current catalog. */
12
+ export function isLegacyProviderHidden(card, hidden) {
13
+ return (hidden.has(card.providerId) ||
14
+ (card.providerScopeHash !== undefined && hidden.has(card.providerScopeHash)));
15
+ }
16
+ export function isCardHidden(card, hidden) {
17
+ return hidden.has(card.cardId) || isLegacyProviderHidden(card, hidden);
18
+ }
19
+ //# sourceMappingURL=card-visibility.js.map
@@ -1,6 +1,7 @@
1
1
  import type { AnalyticsTemporalBreakdown } from "./analytics-temporal.js";
2
2
  import type { CardId, RowId } from "./identity.js";
3
3
  import type { BankedResetAvailability } from "./openai-quota.js";
4
+ import type { ProviderFailureCategory } from "./provider-failure.js";
4
5
  import type { BucketUnit, RangeKey, RangeWindow } from "./ranges.js";
5
6
  import type { TemporalStatusSnapshot } from "./temporal.js";
6
7
  /**
@@ -265,6 +266,21 @@ export type RunwayProjection = {
265
266
  } | {
266
267
  kind: "lasts_past_reset";
267
268
  };
269
+ /** Approved maximum number of primary quota-window references per card. */
270
+ export declare const PRIMARY_QUOTA_WINDOW_LIMIT = 3;
271
+ /**
272
+ * Stable provider-defined ring slot: 0 outermost, 1 middle, 2 innermost.
273
+ * Slots are per-card family positions in full-card order, not global time-unit
274
+ * ranks. They are assigned from established window semantics, never from
275
+ * current utilization, and remain fixed when earlier windows are absent.
276
+ */
277
+ export type PrimaryQuotaWindowSlot = 0 | 1 | 2;
278
+ export interface PrimaryQuotaWindowRef {
279
+ /** Existing row on the owning card. */
280
+ rowId: RowId;
281
+ /** Stable provider-defined ring slot, not the array position. */
282
+ slot: PrimaryQuotaWindowSlot;
283
+ }
268
284
  export interface ProviderCard {
269
285
  cardId: CardId;
270
286
  providerId: string;
@@ -282,10 +298,21 @@ export interface ProviderCard {
282
298
  providerScopeId?: CardId;
283
299
  providerScopeHash?: string;
284
300
  rows: QuotaCardRow[];
301
+ /**
302
+ * Primary quota-window references for the native `session.header` rings
303
+ * (additive, optional): unique existing percent rows, at most three, never
304
+ * budget/spend/auxiliary percentages. Each entry carries the stable
305
+ * provider-defined `slot` (0..2), so a missing earlier window does not move
306
+ * later rings. Absent means the provider/card has no defensible primary
307
+ * mapping, not an empty quota.
308
+ */
309
+ primaryQuotaWindows?: PrimaryQuotaWindowRef[];
285
310
  errors: {
286
311
  label: string;
287
312
  message: string;
288
313
  retryable?: boolean;
314
+ /** Source-assigned safe category; absence means unknown and consumers fail closed. */
315
+ failureCategory?: ProviderFailureCategory;
289
316
  }[];
290
317
  /** Explicit safe field list only — never a raw `statusDetails` copy. */
291
318
  details?: {
@@ -1,3 +1,5 @@
1
1
  /** Contract revision advertised by `DashboardDataSource.health()`. */
2
2
  export const DASHBOARD_CONTRACT_VERSION = 2;
3
+ /** Approved maximum number of primary quota-window references per card. */
4
+ export const PRIMARY_QUOTA_WINDOW_LIMIT = 3;
3
5
  //# sourceMappingURL=dashboard.js.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Browser-safe structural guards for every dashboard DTO that crosses a
3
+ * transport boundary.
4
+ *
5
+ * These are deliberately separate from the richer UI decoders: they answer
6
+ * "is this the documented DTO shape?" without constructing a new object, so a
7
+ * transport can reject a malformed payload while preserving additive fields.
8
+ * Existing narrow guards (`isTokenStack`, `isCostedTokens`, `isRangeKey`) are
9
+ * reused rather than re-implemented.
10
+ */
11
+ import type { AnalyticsGroupQuery, AnalyticsGroupSnapshot, DashboardHealth, HomeSnapshot, ImportPreview, JsonValue, ProjectSnapshot, QuotaSnapshot, SessionSnapshot, SettingsSnapshot, SettingsWriteResult } from "./dashboard.js";
12
+ export declare function isJsonValue(value: unknown, depth?: number): value is JsonValue;
13
+ export declare function isDashboardHealth(value: unknown): value is DashboardHealth;
14
+ export declare function isQuotaSnapshot(value: unknown): value is QuotaSnapshot;
15
+ export declare function isHomeSnapshot(value: unknown): value is HomeSnapshot;
16
+ /** Exact-key grouped query validation, including the nested filter identity. */
17
+ export declare function isAnalyticsGroupQuery(value: unknown): value is AnalyticsGroupQuery;
18
+ export declare function isAnalyticsGroupSnapshot(value: unknown): value is AnalyticsGroupSnapshot;
19
+ export declare function isProjectSnapshot(value: unknown): value is ProjectSnapshot;
20
+ export declare function isSessionSnapshot(value: unknown): value is SessionSnapshot;
21
+ export declare function isSettingsSnapshot(value: unknown): value is SettingsSnapshot;
22
+ export declare function isSettingsWriteResult(value: unknown): value is SettingsWriteResult;
23
+ export declare function isImportPreview(value: unknown): value is ImportPreview;
24
+ //# sourceMappingURL=dto-guards.d.ts.map