opencode-quota-gui 1.0.1 → 1.2.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 (376) hide show
  1. package/README.md +35 -19
  2. package/dist/contracts/analytics-entity.d.ts +32 -0
  3. package/dist/contracts/analytics-entity.d.ts.map +1 -0
  4. package/dist/contracts/analytics-entity.js +123 -0
  5. package/dist/contracts/analytics-entity.js.map +1 -0
  6. package/dist/contracts/analytics-temporal.d.ts +39 -0
  7. package/dist/contracts/analytics-temporal.d.ts.map +1 -0
  8. package/dist/contracts/analytics-temporal.js +11 -0
  9. package/dist/contracts/analytics-temporal.js.map +1 -0
  10. package/dist/contracts/build-identity.js +1 -1
  11. package/dist/contracts/collision-safe-key.d.ts +14 -0
  12. package/dist/contracts/collision-safe-key.d.ts.map +1 -0
  13. package/dist/contracts/collision-safe-key.js +28 -0
  14. package/dist/contracts/collision-safe-key.js.map +1 -0
  15. package/dist/contracts/dashboard.d.ts +152 -0
  16. package/dist/contracts/dashboard.d.ts.map +1 -1
  17. package/dist/contracts/dashboard.js.map +1 -1
  18. package/dist/contracts/temporal.d.ts +126 -0
  19. package/dist/contracts/temporal.d.ts.map +1 -0
  20. package/dist/contracts/temporal.js +10 -0
  21. package/dist/contracts/temporal.js.map +1 -0
  22. package/dist/data/modelsdev-pricing.min.json +1 -1064
  23. package/dist/data/modelsdev-temporal.min.json +3075 -0
  24. package/dist/gui/aggregation.d.ts.map +1 -1
  25. package/dist/gui/aggregation.js +9 -0
  26. package/dist/gui/aggregation.js.map +1 -1
  27. package/dist/gui/analytics-bridge.d.ts.map +1 -1
  28. package/dist/gui/analytics-bridge.js +14 -0
  29. package/dist/gui/analytics-bridge.js.map +1 -1
  30. package/dist/gui/analytics-engine.d.ts +3 -1
  31. package/dist/gui/analytics-engine.d.ts.map +1 -1
  32. package/dist/gui/analytics-engine.js +228 -7
  33. package/dist/gui/analytics-engine.js.map +1 -1
  34. package/dist/gui/analytics-model.d.ts +7 -5
  35. package/dist/gui/analytics-model.d.ts.map +1 -1
  36. package/dist/gui/analytics-model.js +625 -39
  37. package/dist/gui/analytics-model.js.map +1 -1
  38. package/dist/gui/analytics-pricing-revision.d.ts +43 -0
  39. package/dist/gui/analytics-pricing-revision.d.ts.map +1 -0
  40. package/dist/gui/analytics-pricing-revision.js +160 -0
  41. package/dist/gui/analytics-pricing-revision.js.map +1 -0
  42. package/dist/gui/analytics-protocol.d.ts +6 -2
  43. package/dist/gui/analytics-protocol.d.ts.map +1 -1
  44. package/dist/gui/analytics-protocol.js.map +1 -1
  45. package/dist/gui/analytics-service.d.ts +3 -1
  46. package/dist/gui/analytics-service.d.ts.map +1 -1
  47. package/dist/gui/analytics-service.js +14 -0
  48. package/dist/gui/analytics-service.js.map +1 -1
  49. package/dist/gui/analytics-state.d.ts +13 -0
  50. package/dist/gui/analytics-state.d.ts.map +1 -1
  51. package/dist/gui/analytics-state.js +25 -0
  52. package/dist/gui/analytics-state.js.map +1 -1
  53. package/dist/gui/analytics-worker-runtime.d.ts +5 -0
  54. package/dist/gui/analytics-worker-runtime.d.ts.map +1 -1
  55. package/dist/gui/analytics-worker-runtime.js +6 -0
  56. package/dist/gui/analytics-worker-runtime.js.map +1 -1
  57. package/dist/gui/config.d.ts +2 -2
  58. package/dist/gui/config.d.ts.map +1 -1
  59. package/dist/gui/config.js +18 -0
  60. package/dist/gui/config.js.map +1 -1
  61. package/dist/gui/lifecycle.d.ts +1 -1
  62. package/dist/gui/lifecycle.d.ts.map +1 -1
  63. package/dist/gui/lifecycle.js +1 -0
  64. package/dist/gui/lifecycle.js.map +1 -1
  65. package/dist/gui/server.d.ts.map +1 -1
  66. package/dist/gui/server.js +62 -0
  67. package/dist/gui/server.js.map +1 -1
  68. package/dist/gui/snapshot-service.d.ts +3 -1
  69. package/dist/gui/snapshot-service.d.ts.map +1 -1
  70. package/dist/gui/snapshot-service.js +10 -0
  71. package/dist/gui/snapshot-service.js.map +1 -1
  72. package/dist/gui/sources.d.ts +1 -1
  73. package/dist/gui/sources.d.ts.map +1 -1
  74. package/dist/gui/sources.js +53 -4
  75. package/dist/gui/sources.js.map +1 -1
  76. package/dist/gui/temporal-quota-policy-data.d.ts +24 -0
  77. package/dist/gui/temporal-quota-policy-data.d.ts.map +1 -0
  78. package/dist/gui/temporal-quota-policy-data.js +43 -0
  79. package/dist/gui/temporal-quota-policy-data.js.map +1 -0
  80. package/dist/gui/temporal-quota-policy.d.ts +38 -0
  81. package/dist/gui/temporal-quota-policy.d.ts.map +1 -0
  82. package/dist/gui/temporal-quota-policy.js +182 -0
  83. package/dist/gui/temporal-quota-policy.js.map +1 -0
  84. package/dist/gui/temporal-status.d.ts +53 -0
  85. package/dist/gui/temporal-status.d.ts.map +1 -0
  86. package/dist/gui/temporal-status.js +815 -0
  87. package/dist/gui/temporal-status.js.map +1 -0
  88. package/dist/lib/config.d.ts +1 -1
  89. package/dist/lib/config.d.ts.map +1 -1
  90. package/dist/lib/config.js +33 -0
  91. package/dist/lib/config.js.map +1 -1
  92. package/dist/lib/cursor-usage.d.ts.map +1 -1
  93. package/dist/lib/cursor-usage.js +8 -2
  94. package/dist/lib/cursor-usage.js.map +1 -1
  95. package/dist/lib/modelsdev-pricing.d.ts +54 -1
  96. package/dist/lib/modelsdev-pricing.d.ts.map +1 -1
  97. package/dist/lib/modelsdev-pricing.js +284 -43
  98. package/dist/lib/modelsdev-pricing.js.map +1 -1
  99. package/dist/lib/modelsdev-temporal.d.ts +143 -0
  100. package/dist/lib/modelsdev-temporal.d.ts.map +1 -0
  101. package/dist/lib/modelsdev-temporal.js +896 -0
  102. package/dist/lib/modelsdev-temporal.js.map +1 -0
  103. package/dist/lib/opencode-console-auth.d.ts +19 -0
  104. package/dist/lib/opencode-console-auth.d.ts.map +1 -1
  105. package/dist/lib/opencode-console-auth.js +263 -3
  106. package/dist/lib/opencode-console-auth.js.map +1 -1
  107. package/dist/lib/opencode-storage.d.ts +26 -11
  108. package/dist/lib/opencode-storage.d.ts.map +1 -1
  109. package/dist/lib/opencode-storage.js +33 -56
  110. package/dist/lib/opencode-storage.js.map +1 -1
  111. package/dist/lib/quota-providers-local.d.ts.map +1 -1
  112. package/dist/lib/quota-providers-local.js +13 -3
  113. package/dist/lib/quota-providers-local.js.map +1 -1
  114. package/dist/lib/quota-stats-format.d.ts.map +1 -1
  115. package/dist/lib/quota-stats-format.js +28 -6
  116. package/dist/lib/quota-stats-format.js.map +1 -1
  117. package/dist/lib/quota-stats.d.ts +71 -7
  118. package/dist/lib/quota-stats.d.ts.map +1 -1
  119. package/dist/lib/quota-stats.js +417 -22
  120. package/dist/lib/quota-stats.js.map +1 -1
  121. package/dist/lib/scoped-query-chunks.d.ts +15 -0
  122. package/dist/lib/scoped-query-chunks.d.ts.map +1 -0
  123. package/dist/lib/scoped-query-chunks.js +48 -0
  124. package/dist/lib/scoped-query-chunks.js.map +1 -0
  125. package/dist/lib/token-cost.d.ts +29 -0
  126. package/dist/lib/token-cost.d.ts.map +1 -1
  127. package/dist/lib/token-cost.js +74 -10
  128. package/dist/lib/token-cost.js.map +1 -1
  129. package/dist/lib/types.d.ts +6 -0
  130. package/dist/lib/types.d.ts.map +1 -1
  131. package/dist/lib/types.js +1 -0
  132. package/dist/lib/types.js.map +1 -1
  133. package/dist/provider-logos/NOTICE.md +12 -0
  134. package/dist/provider-logos/OPENCODE-MIT.txt +21 -0
  135. package/dist/provider-logos/OPENCODE-NOTICE.md +12 -0
  136. package/dist/provider-logos/UPSTREAM-MIT.txt +21 -0
  137. package/dist/providers/cache-policies.d.ts.map +1 -1
  138. package/dist/providers/cache-policies.js +4 -3
  139. package/dist/providers/cache-policies.js.map +1 -1
  140. package/dist/providers/opencode-go.d.ts.map +1 -1
  141. package/dist/providers/opencode-go.js +2 -0
  142. package/dist/providers/opencode-go.js.map +1 -1
  143. package/dist/providers/opencode-zen.d.ts.map +1 -1
  144. package/dist/providers/opencode-zen.js +2 -0
  145. package/dist/providers/opencode-zen.js.map +1 -1
  146. package/dist/ui/assets/{index-D3-Yn_WA.css → index-Cs-nrywz.css} +1 -1
  147. package/dist/ui/assets/index-D9lFKhSN.js +9 -0
  148. package/dist/ui/assets/popover-DKRrwr_K.js +1 -0
  149. package/dist/ui/assets/popover-mkHTmNjv.css +1 -0
  150. package/dist/ui/assets/providers/302ai.svg +7 -0
  151. package/dist/ui/assets/providers/abacus.svg +14 -0
  152. package/dist/ui/assets/providers/abliteration-ai.svg +6 -0
  153. package/dist/ui/assets/providers/above.svg +3 -0
  154. package/dist/ui/assets/providers/agentrouter.svg +4 -0
  155. package/dist/ui/assets/providers/agnes.svg +1 -0
  156. package/dist/ui/assets/providers/ai-router.svg +5 -0
  157. package/dist/ui/assets/providers/ai21.svg +3 -0
  158. package/dist/ui/assets/providers/aiand.svg +4 -0
  159. package/dist/ui/assets/providers/aihubmix.svg +3 -0
  160. package/dist/ui/assets/providers/aimlapi.svg +3 -0
  161. package/dist/ui/assets/providers/ainetcafe.svg +1 -0
  162. package/dist/ui/assets/providers/aixy.svg +4 -0
  163. package/dist/ui/assets/providers/aki-io.svg +7 -0
  164. package/dist/ui/assets/providers/alibaba-cn.svg +3 -0
  165. package/dist/ui/assets/providers/alibaba-coding-plan-cn.svg +3 -0
  166. package/dist/ui/assets/providers/alibaba-coding-plan.svg +3 -0
  167. package/dist/ui/assets/providers/alibaba-token-plan.svg +3 -0
  168. package/dist/ui/assets/providers/alibaba.svg +3 -0
  169. package/dist/ui/assets/providers/amazon-bedrock.svg +3 -0
  170. package/dist/ui/assets/providers/ambient.svg +3 -0
  171. package/dist/ui/assets/providers/amd.svg +3 -0
  172. package/dist/ui/assets/providers/anthropic.svg +3 -0
  173. package/dist/ui/assets/providers/anyapi.svg +3 -0
  174. package/dist/ui/assets/providers/arcee.svg +3 -0
  175. package/dist/ui/assets/providers/atomic-chat.svg +1 -0
  176. package/dist/ui/assets/providers/auriko.svg +6 -0
  177. package/dist/ui/assets/providers/azure-cognitive-services.svg +3 -0
  178. package/dist/ui/assets/providers/azure.svg +3 -0
  179. package/dist/ui/assets/providers/bailing.svg +3 -0
  180. package/dist/ui/assets/providers/baseten.svg +3 -0
  181. package/dist/ui/assets/providers/bee.svg +1 -0
  182. package/dist/ui/assets/providers/berget.svg +3 -0
  183. package/dist/ui/assets/providers/blueclaw.svg +3 -0
  184. package/dist/ui/assets/providers/bothub.svg +33 -0
  185. package/dist/ui/assets/providers/boundless.svg +12 -0
  186. package/dist/ui/assets/providers/cerebras.svg +4 -0
  187. package/dist/ui/assets/providers/clarifai.svg +3 -0
  188. package/dist/ui/assets/providers/claudinio.svg +19 -0
  189. package/dist/ui/assets/providers/cloudferro-sherlock.svg +5 -0
  190. package/dist/ui/assets/providers/cloudflare-ai-gateway.svg +4 -0
  191. package/dist/ui/assets/providers/cloudflare-workers-ai.svg +4 -0
  192. package/dist/ui/assets/providers/cohere.svg +5 -0
  193. package/dist/ui/assets/providers/commandcode.svg +11 -0
  194. package/dist/ui/assets/providers/coralbricks.svg +6 -0
  195. package/dist/ui/assets/providers/crossmodel.svg +5 -0
  196. package/dist/ui/assets/providers/crusoe.svg +23 -0
  197. package/dist/ui/assets/providers/daoxe.svg +3 -0
  198. package/dist/ui/assets/providers/databricks.svg +3 -0
  199. package/dist/ui/assets/providers/deepinfra.svg +4 -0
  200. package/dist/ui/assets/providers/deepseek.svg +3 -0
  201. package/dist/ui/assets/providers/digitalocean.svg +6 -0
  202. package/dist/ui/assets/providers/dinference.svg +1 -0
  203. package/dist/ui/assets/providers/drun.svg +8 -0
  204. package/dist/ui/assets/providers/ebcloud.svg +8 -0
  205. package/dist/ui/assets/providers/echo.svg +7 -0
  206. package/dist/ui/assets/providers/edenai.svg +8 -0
  207. package/dist/ui/assets/providers/empiriolabs.svg +1 -0
  208. package/dist/ui/assets/providers/engy.svg +1 -0
  209. package/dist/ui/assets/providers/evroc.svg +3 -0
  210. package/dist/ui/assets/providers/fastrouter.svg +3 -0
  211. package/dist/ui/assets/providers/fireworks-ai.svg +3 -0
  212. package/dist/ui/assets/providers/fluence.svg +3 -0
  213. package/dist/ui/assets/providers/freemodel.svg +3 -0
  214. package/dist/ui/assets/providers/friendli.svg +3 -0
  215. package/dist/ui/assets/providers/frogbot.svg +36 -0
  216. package/dist/ui/assets/providers/generic.svg +4 -0
  217. package/dist/ui/assets/providers/github-copilot.svg +3 -0
  218. package/dist/ui/assets/providers/gitlab.svg +3 -0
  219. package/dist/ui/assets/providers/google-vertex-anthropic.svg +10 -0
  220. package/dist/ui/assets/providers/google-vertex.svg +10 -0
  221. package/dist/ui/assets/providers/google.svg +3 -0
  222. package/dist/ui/assets/providers/greenpt.svg +6 -0
  223. package/dist/ui/assets/providers/groq.svg +3 -0
  224. package/dist/ui/assets/providers/helicone.svg +6 -0
  225. package/dist/ui/assets/providers/hetzner.svg +3 -0
  226. package/dist/ui/assets/providers/hpc-ai.svg +444 -0
  227. package/dist/ui/assets/providers/huggingface.svg +3 -0
  228. package/dist/ui/assets/providers/hyper.svg +20 -0
  229. package/dist/ui/assets/providers/impossibl.svg +3 -0
  230. package/dist/ui/assets/providers/inception.svg +14 -0
  231. package/dist/ui/assets/providers/inceptron.svg +14 -0
  232. package/dist/ui/assets/providers/inco.svg +3 -0
  233. package/dist/ui/assets/providers/infer.svg +4 -0
  234. package/dist/ui/assets/providers/inference.svg +3 -0
  235. package/dist/ui/assets/providers/inferx.svg +5 -0
  236. package/dist/ui/assets/providers/infomaniak.svg +3 -0
  237. package/dist/ui/assets/providers/io-net.svg +5 -0
  238. package/dist/ui/assets/providers/iteracompute.svg +6 -0
  239. package/dist/ui/assets/providers/jalapeno.svg +8 -0
  240. package/dist/ui/assets/providers/jiekou.svg +4 -0
  241. package/dist/ui/assets/providers/kenari.svg +4 -0
  242. package/dist/ui/assets/providers/kilo.svg +4 -0
  243. package/dist/ui/assets/providers/kimi-code-plan-cn.svg +3 -0
  244. package/dist/ui/assets/providers/kimi-code-plan-global.svg +3 -0
  245. package/dist/ui/assets/providers/klokintegration.svg +11 -0
  246. package/dist/ui/assets/providers/kosmik.svg +28 -0
  247. package/dist/ui/assets/providers/kuae-cloud-coding-plan.svg +3 -0
  248. package/dist/ui/assets/providers/lilac.svg +6 -0
  249. package/dist/ui/assets/providers/liquid.svg +1 -0
  250. package/dist/ui/assets/providers/llmgateway-providers.svg +6 -0
  251. package/dist/ui/assets/providers/llmgateway.svg +6 -0
  252. package/dist/ui/assets/providers/llmtech.svg +6 -0
  253. package/dist/ui/assets/providers/llmtr.svg +12 -0
  254. package/dist/ui/assets/providers/lmstudio.svg +3 -0
  255. package/dist/ui/assets/providers/longcat.svg +6 -0
  256. package/dist/ui/assets/providers/lowrouter.svg +8 -0
  257. package/dist/ui/assets/providers/lucidquery.svg +3 -0
  258. package/dist/ui/assets/providers/lynkr.svg +1 -0
  259. package/dist/ui/assets/providers/meganova.svg +3 -0
  260. package/dist/ui/assets/providers/melious.svg +3 -0
  261. package/dist/ui/assets/providers/merge-gateway.svg +4 -0
  262. package/dist/ui/assets/providers/meta.svg +3 -0
  263. package/dist/ui/assets/providers/minimax-cn-coding-plan.svg +3 -0
  264. package/dist/ui/assets/providers/minimax-cn.svg +3 -0
  265. package/dist/ui/assets/providers/minimax-coding-plan.svg +3 -0
  266. package/dist/ui/assets/providers/minimax.svg +3 -0
  267. package/dist/ui/assets/providers/mistral.svg +3 -0
  268. package/dist/ui/assets/providers/mixlayer.svg +8 -0
  269. package/dist/ui/assets/providers/moark.svg +3 -0
  270. package/dist/ui/assets/providers/modal.svg +3 -0
  271. package/dist/ui/assets/providers/model-oracle-ai.svg +11 -0
  272. package/dist/ui/assets/providers/modelis.svg +1 -0
  273. package/dist/ui/assets/providers/modelscope.svg +5 -0
  274. package/dist/ui/assets/providers/moonshotai-cn.svg +3 -0
  275. package/dist/ui/assets/providers/moonshotai.svg +3 -0
  276. package/dist/ui/assets/providers/munito-eu.svg +1 -0
  277. package/dist/ui/assets/providers/munito.svg +1 -0
  278. package/dist/ui/assets/providers/nan.svg +1 -0
  279. package/dist/ui/assets/providers/nano-gpt.svg +3 -0
  280. package/dist/ui/assets/providers/nearai.svg +1 -0
  281. package/dist/ui/assets/providers/nebius.svg +4 -0
  282. package/dist/ui/assets/providers/neon.svg +3 -0
  283. package/dist/ui/assets/providers/neosmith.svg +6 -0
  284. package/dist/ui/assets/providers/neuralwatt.svg +27 -0
  285. package/dist/ui/assets/providers/nova.svg +3 -0
  286. package/dist/ui/assets/providers/novita-ai.svg +10 -0
  287. package/dist/ui/assets/providers/nvidia.svg +3 -0
  288. package/dist/ui/assets/providers/oci.svg +3 -0
  289. package/dist/ui/assets/providers/ofox.svg +5 -0
  290. package/dist/ui/assets/providers/ollama-cloud.svg +7 -0
  291. package/dist/ui/assets/providers/openai.svg +3 -0
  292. package/dist/ui/assets/providers/opencode-go-g.svg +3 -0
  293. package/dist/ui/assets/providers/opencode-go.svg +4 -0
  294. package/dist/ui/assets/providers/opencode.svg +4 -0
  295. package/dist/ui/assets/providers/openreason.svg +8 -0
  296. package/dist/ui/assets/providers/openrouter.svg +3 -0
  297. package/dist/ui/assets/providers/opper.svg +3 -0
  298. package/dist/ui/assets/providers/orcarouter.svg +2 -0
  299. package/dist/ui/assets/providers/ovhcloud.svg +3 -0
  300. package/dist/ui/assets/providers/pareto.svg +5 -0
  301. package/dist/ui/assets/providers/pendra.svg +10 -0
  302. package/dist/ui/assets/providers/perplexity-agent.svg +3 -0
  303. package/dist/ui/assets/providers/perplexity.svg +3 -0
  304. package/dist/ui/assets/providers/pioneer.svg +3 -0
  305. package/dist/ui/assets/providers/poe.svg +7 -0
  306. package/dist/ui/assets/providers/poolside.svg +3 -0
  307. package/dist/ui/assets/providers/prime.svg +7 -0
  308. package/dist/ui/assets/providers/privatemode-ai.svg +5 -0
  309. package/dist/ui/assets/providers/qihang-ai.svg +9 -0
  310. package/dist/ui/assets/providers/qiniu-ai.svg +7 -0
  311. package/dist/ui/assets/providers/qvac.svg +6 -0
  312. package/dist/ui/assets/providers/reflection.svg +3 -0
  313. package/dist/ui/assets/providers/regolo-ai.svg +45 -0
  314. package/dist/ui/assets/providers/routing-run.svg +4 -0
  315. package/dist/ui/assets/providers/runinfra.svg +10 -0
  316. package/dist/ui/assets/providers/salad-cloud.svg +15 -0
  317. package/dist/ui/assets/providers/sambanova.svg +26 -0
  318. package/dist/ui/assets/providers/scaleway.svg +5 -0
  319. package/dist/ui/assets/providers/scnet-token-plan.svg +8 -0
  320. package/dist/ui/assets/providers/scx-ai.svg +1 -0
  321. package/dist/ui/assets/providers/sensenova.svg +18 -0
  322. package/dist/ui/assets/providers/siliconflow-cn.svg +3 -0
  323. package/dist/ui/assets/providers/siliconflow.svg +3 -0
  324. package/dist/ui/assets/providers/snowflake-cortex.svg +3 -0
  325. package/dist/ui/assets/providers/stackit.svg +3 -0
  326. package/dist/ui/assets/providers/standardcompute.svg +5 -0
  327. package/dist/ui/assets/providers/stepfun-ai-step-plan.svg +16 -0
  328. package/dist/ui/assets/providers/stepfun-ai.svg +16 -0
  329. package/dist/ui/assets/providers/stepfun-step-plan.svg +16 -0
  330. package/dist/ui/assets/providers/stepfun.svg +16 -0
  331. package/dist/ui/assets/providers/subconscious.svg +3 -0
  332. package/dist/ui/assets/providers/submodel.svg +3 -0
  333. package/dist/ui/assets/providers/teamorouter.svg +3 -0
  334. package/dist/ui/assets/providers/tempr.svg +4 -0
  335. package/dist/ui/assets/providers/tencent-coding-plan.svg +5 -0
  336. package/dist/ui/assets/providers/tencent-token-plan.svg +3 -0
  337. package/dist/ui/assets/providers/tencent-tokenhub.svg +3 -0
  338. package/dist/ui/assets/providers/tensorx.svg +6 -0
  339. package/dist/ui/assets/providers/the-grid-ai.svg +14 -0
  340. package/dist/ui/assets/providers/thinkingmachines.svg +3 -0
  341. package/dist/ui/assets/providers/tinfoil.svg +3 -0
  342. package/dist/ui/assets/providers/togetherai.svg +4 -0
  343. package/dist/ui/assets/providers/tokengo.svg +3 -0
  344. package/dist/ui/assets/providers/tokenrouter.svg +4 -0
  345. package/dist/ui/assets/providers/trustedrouter.svg +4 -0
  346. package/dist/ui/assets/providers/umans-ai-coding-plan.svg +29 -0
  347. package/dist/ui/assets/providers/umans-ai.svg +29 -0
  348. package/dist/ui/assets/providers/unorouter.svg +7 -0
  349. package/dist/ui/assets/providers/vancine.svg +6 -0
  350. package/dist/ui/assets/providers/venice.svg +4 -0
  351. package/dist/ui/assets/providers/vercel.svg +3 -0
  352. package/dist/ui/assets/providers/vispark.svg +3 -0
  353. package/dist/ui/assets/providers/vivgrid.svg +4 -0
  354. package/dist/ui/assets/providers/volcengine-coding-plan.svg +3 -0
  355. package/dist/ui/assets/providers/volcengine.svg +3 -0
  356. package/dist/ui/assets/providers/vultr.svg +6 -0
  357. package/dist/ui/assets/providers/wafer.ai.svg +3 -0
  358. package/dist/ui/assets/providers/wallaby.svg +4 -0
  359. package/dist/ui/assets/providers/wandb.svg +6 -0
  360. package/dist/ui/assets/providers/watsonx.svg +5 -0
  361. package/dist/ui/assets/providers/xai.svg +3 -0
  362. package/dist/ui/assets/providers/xiaomi-token-plan-ams.svg +3 -0
  363. package/dist/ui/assets/providers/xiaomi-token-plan-cn.svg +3 -0
  364. package/dist/ui/assets/providers/xiaomi-token-plan-sgp.svg +3 -0
  365. package/dist/ui/assets/providers/xiaomi.svg +3 -0
  366. package/dist/ui/assets/providers/xpersona.svg +8 -0
  367. package/dist/ui/assets/providers/zai-coding-plan.svg +3 -0
  368. package/dist/ui/assets/providers/zai.svg +3 -0
  369. package/dist/ui/assets/providers/zeldoc.svg +3 -0
  370. package/dist/ui/assets/providers/zenifra.svg +4 -0
  371. package/dist/ui/assets/providers/zenmux.svg +4 -0
  372. package/dist/ui/assets/providers/zhipuai-coding-plan.svg +3 -0
  373. package/dist/ui/assets/providers/zhipuai.svg +3 -0
  374. package/dist/ui/index.html +2 -2
  375. package/package.json +5 -1
  376. package/dist/ui/assets/index-CPEiQt-C.js +0 -8
@@ -11,11 +11,13 @@
11
11
  * request-driven.
12
12
  */
13
13
  import { performance } from "node:perf_hooks";
14
+ import { encodeAnalyticsGroupQueryKey, isAnalyticsGroupQuery, } from "../contracts/analytics-entity.js";
14
15
  import { isRangeKey, rangeWindow } from "../contracts/ranges.js";
15
- import { compareOpenCodeSourceIdentity, } from "../lib/opencode-storage.js";
16
+ import { compareOpenCodeSourceIdentity, rawAssistantRowHasTokenUsage, } from "../lib/opencode-storage.js";
16
17
  import { createUsageAnalytics, UNKNOWN_PROJECT_ID } from "./aggregation.js";
17
18
  import { createAnalyticsIndexes } from "./analytics-indexes.js";
18
19
  import { createAnalyticsModel } from "./analytics-model.js";
20
+ import { getAnalyticsPricingFingerprint } from "./analytics-pricing-revision.js";
19
21
  import { createAnalyticsReader } from "./analytics-reader.js";
20
22
  import { ANALYTICS_PRESENTATION_SESSION_LIMIT, compactFingerprintOf, defaultAnalyticsPresentationPath, defaultAnalyticsSnapshotPath, fingerprintOf, loadAnalyticsPresentation, loadAnalyticsSnapshot, rowFromFingerprint, saveAnalyticsPresentation, saveAnalyticsSnapshot, } from "./analytics-state.js";
21
23
  import { resolveHostTimeZone } from "./time-zone.js";
@@ -26,6 +28,8 @@ export const ANALYTICS_FULL_REPAIR_INTERVAL_MS = 7 * 24 * 60 * 60_000;
26
28
  export const ANALYTICS_SOURCE_CURSOR_OVERLAP_MS = 5 * 60_000;
27
29
  const MAX_SCOPE_BATCH = 8;
28
30
  const MAX_PROJECT_CACHE = 12;
31
+ /** Bound on in-memory grouped DTOs; keeps detail navigation from growing state. */
32
+ const MAX_GROUP_CACHE = 24;
29
33
  const PRESENTATION_SAVE_INTERVAL_MS = 60_000;
30
34
  /**
31
35
  * Idle grace before the automatic 7d -> 30d extension starts. A zero-delay
@@ -236,11 +240,17 @@ export function createAnalyticsEngine(options = {}) {
236
240
  let closePromise;
237
241
  let modelHydrated = false;
238
242
  let modelDirty = true;
243
+ /** Exact combined pricing fingerprint the model and derived DTOs were built from. */
244
+ let pricingRevision = getAnalyticsPricingFingerprint();
239
245
  let lastPresentationSaveAtMs = 0;
240
246
  let presentationSavedAtMs = 0;
241
247
  let generation = 0;
242
248
  const projectFreshAt = new Map();
243
249
  const detailFreshAt = new Map();
250
+ /** Bounded in-memory range-certified grouped DTOs, keyed collision-safely. */
251
+ const groupCache = new Map();
252
+ /** Last non-blocking scoped-lifetime lifetime read attempt (backoff only). */
253
+ let scopedLifetimeReadAtMs;
244
254
  const closeWriteTimeoutMs = options.closeWriteTimeoutMs !== undefined && Number.isFinite(options.closeWriteTimeoutMs)
245
255
  ? Math.max(0, options.closeWriteTimeoutMs)
246
256
  : 2_000;
@@ -393,6 +403,7 @@ export function createAnalyticsEngine(options = {}) {
393
403
  state.presentation = undefined;
394
404
  state.extent = undefined;
395
405
  state.frontierAtMs = 0;
406
+ invalidateGroupSnapshots();
396
407
  return false;
397
408
  })();
398
409
  return warmIdentityVerification;
@@ -476,8 +487,13 @@ export function createAnalyticsEngine(options = {}) {
476
487
  const rows = function* rowsForModel() {
477
488
  for (const occurrence of state.occurrences.values()) {
478
489
  const row = rowOf(occurrence);
479
- if (row)
480
- yield row;
490
+ if (!row)
491
+ continue;
492
+ // Zero-token rows stay in the membership index for exact delta
493
+ // reconciliation, but never enter model ownership/rollups.
494
+ if (!rawAssistantRowHasTokenUsage(row))
495
+ continue;
496
+ yield row;
481
497
  }
482
498
  };
483
499
  model.apply(rows(), []);
@@ -508,6 +524,10 @@ export function createAnalyticsEngine(options = {}) {
508
524
  const row = rowOf(occurrence);
509
525
  if (!row)
510
526
  continue;
527
+ // Zero-token rows are metadata/activity only; the session DTO is a
528
+ // usage view, so it must not grow steps, ownership, or pricing work.
529
+ if (!rawAssistantRowHasTokenUsage(row))
530
+ continue;
511
531
  messages.push(row);
512
532
  includedSessionIds.add(occurrence.sessionID);
513
533
  }
@@ -876,6 +896,103 @@ export function createAnalyticsEngine(options = {}) {
876
896
  projects: snapshot.projects,
877
897
  };
878
898
  }
899
+ /**
900
+ * Grouped DTOs are cheap to rebuild from the already-owned model and share
901
+ * Home's certified `nowMs`; only a bounded LRU keeps repeats off the model.
902
+ */
903
+ function deriveGroupSnapshot(query, atMs) {
904
+ return measureSync("dtoAggregation", () => model.groups(query, atMs));
905
+ }
906
+ /**
907
+ * Lifetime's exact window is the one Home already served. Prefer the loaded
908
+ * Home lifetime DTO so crossing a local-day boundary cannot move the window
909
+ * or its buckets; otherwise the successful global certification epoch is the
910
+ * same anchor Home's finite ranges use.
911
+ */
912
+ function certifiedLifetimeWindowAtMs(atMs) {
913
+ const presented = state.presentation?.home.lifetime;
914
+ if (presented !== undefined && presented.usage.timeZone === timeZone) {
915
+ return presented.usage.window.untilMs;
916
+ }
917
+ return homeCertifiedSyncAtMs("lifetime", atMs);
918
+ }
919
+ function groupDerivationAtMs(range, atMs) {
920
+ const certified = range === "lifetime" ? certifiedLifetimeWindowAtMs(atMs) : homeCertifiedSyncAtMs(range, atMs);
921
+ return certified ?? atMs;
922
+ }
923
+ /**
924
+ * Provider/model detail lifetime is a scoped view: as soon as any owned
925
+ * hourly data exists, it can be derived without blocking on the source. It is
926
+ * marked stale until a global lifetime extent certifies completeness; the
927
+ * missing history is filled by one background read per refresh interval.
928
+ *
929
+ * Membership alone is not owned usage: zero-token occurrences are retained
930
+ * for exact delta reconciliation but never enter the model. Using their count
931
+ * would let a lifetime filtered view return an inaccurate empty result while
932
+ * older matching positive history has not been read yet.
933
+ */
934
+ function canDeriveScopedLifetimeFromOwnedData(query) {
935
+ if (query.range !== "lifetime" ||
936
+ query.filter === undefined ||
937
+ state.occurrences.size === 0 ||
938
+ coversSince(undefined, state.extent)) {
939
+ return false;
940
+ }
941
+ ensureModel();
942
+ return model.ownedStepCount() > 0;
943
+ }
944
+ function scheduleScopedLifetimeRefresh(atMs) {
945
+ if (scopedLifetimeReadAtMs !== undefined && atMs - scopedLifetimeReadAtMs < refreshIntervalMs) {
946
+ return;
947
+ }
948
+ scopedLifetimeReadAtMs = atMs;
949
+ requestBackground({ globalRange: "lifetime", detailSessionIds: [], projectScopes: [] }, true);
950
+ }
951
+ function cachedGroupSnapshot(query) {
952
+ const key = encodeAnalyticsGroupQueryKey(query);
953
+ const cached = groupCache.get(key);
954
+ if (cached === undefined)
955
+ return undefined;
956
+ groupCache.delete(key);
957
+ groupCache.set(key, cached);
958
+ return cached;
959
+ }
960
+ function storeGroupSnapshot(query, snapshot) {
961
+ const key = encodeAnalyticsGroupQueryKey(query);
962
+ groupCache.delete(key);
963
+ groupCache.set(key, { ...snapshot, stale: false });
964
+ while (groupCache.size > MAX_GROUP_CACHE) {
965
+ const oldest = groupCache.keys().next().value;
966
+ if (oldest === undefined)
967
+ break;
968
+ groupCache.delete(oldest);
969
+ }
970
+ }
971
+ function invalidateGroupSnapshots() {
972
+ groupCache.clear();
973
+ }
974
+ /**
975
+ * Cached Home/Project/Session/group DTOs contain derived costs. If the
976
+ * combined pricing/temporal fingerprint changes, those DTOs and the hydrated
977
+ * model no longer certify the rates that produced them, so rebuild them
978
+ * instead of serving stale prices.
979
+ */
980
+ function ensurePricingRevision() {
981
+ const current = getAnalyticsPricingFingerprint();
982
+ if (current === pricingRevision)
983
+ return;
984
+ pricingRevision = current;
985
+ state.presentation = undefined;
986
+ warmPresentation = undefined;
987
+ warmSourceIdentity = undefined;
988
+ warmIdentityVerification = undefined;
989
+ warmIdentityVerifiedGeneration = -1;
990
+ sidecarNewerThanIndex = false;
991
+ lastPresentationSaveAtMs = 0;
992
+ modelHydrated = false;
993
+ modelDirty = true;
994
+ invalidateGroupSnapshots();
995
+ }
879
996
  /**
880
997
  * Once 30d is indexed, derive the three bounded Home DTOs together while the
881
998
  * model is already hydrated. Missing entries are filled; this never triggers
@@ -1826,11 +1943,13 @@ export function createAnalyticsEngine(options = {}) {
1826
1943
  projectCoverage.clear();
1827
1944
  projectFreshAt.clear();
1828
1945
  detailFreshAt.clear();
1946
+ invalidateGroupSnapshots();
1829
1947
  indexes.rebuild([], {});
1830
1948
  lastSessionIndexSignature = "";
1831
1949
  measureSync("modelUpdate", () => model.clear());
1832
1950
  modelHydrated = false;
1833
1951
  modelDirty = true;
1952
+ scopedLifetimeReadAtMs = undefined;
1834
1953
  }
1835
1954
  const removals = [];
1836
1955
  const upserts = [];
@@ -1994,16 +2113,24 @@ export function createAnalyticsEngine(options = {}) {
1994
2113
  // and avoid a no-op host notification in that case.
1995
2114
  if (dataChanged)
1996
2115
  state.presentation = undefined;
2116
+ // Any contribution/ownership mutation or newly covered history makes
2117
+ // cached grouped totals incomplete or merely old: rebuild on demand.
2118
+ if (dataChanged || candidate.extentChanged)
2119
+ invalidateGroupSnapshots();
1997
2120
  }
1998
2121
  if (modelHydrated) {
1999
- const modelUpserts = agentUpserts.length > 0 ? [...upserts, ...agentUpserts] : upserts;
2000
- if (removals.length > 0 || modelUpserts.length > 0 || sessionsChanged || projectsChanged) {
2122
+ const modelUpserts = (agentUpserts.length > 0 ? [...upserts, ...agentUpserts] : upserts).filter(rawAssistantRowHasTokenUsage);
2123
+ const modelRemovals = removals.filter(rawAssistantRowHasTokenUsage);
2124
+ if (modelRemovals.length > 0 ||
2125
+ modelUpserts.length > 0 ||
2126
+ sessionsChanged ||
2127
+ projectsChanged) {
2001
2128
  measureSync("modelUpdate", () => {
2002
2129
  if (sessionsChanged || projectsChanged) {
2003
2130
  model.setMetadata(candidate.sessions, candidate.projects);
2004
2131
  }
2005
- if (removals.length > 0 || modelUpserts.length > 0) {
2006
- model.apply(modelUpserts, removals);
2132
+ if (modelRemovals.length > 0 || modelUpserts.length > 0) {
2133
+ model.apply(modelUpserts, modelRemovals);
2007
2134
  }
2008
2135
  });
2009
2136
  }
@@ -2125,6 +2252,7 @@ export function createAnalyticsEngine(options = {}) {
2125
2252
  if (closed)
2126
2253
  throw new Error("analytics closed");
2127
2254
  await ensureLoaded();
2255
+ ensurePricingRevision();
2128
2256
  const atMs = now();
2129
2257
  const window = rangeWindow(range, atMs);
2130
2258
  lastGlobalRange.value = widerRange(lastGlobalRange.value, range);
@@ -2177,6 +2305,95 @@ export function createAnalyticsEngine(options = {}) {
2177
2305
  scheduleThirtyDayExtension(range, atMs);
2178
2306
  return homeSnapshotWithStaleness(result, range, atMs, stale);
2179
2307
  },
2308
+ async groups(query) {
2309
+ if (!isAnalyticsGroupQuery(query))
2310
+ throw new AnalyticsLookupError("bad-request");
2311
+ if (closed)
2312
+ throw new Error("analytics closed");
2313
+ await ensureLoaded();
2314
+ ensurePricingRevision();
2315
+ const { range } = query;
2316
+ const atMs = now();
2317
+ const window = rangeWindow(range, atMs);
2318
+ const cacheKey = encodeAnalyticsGroupQueryKey(query);
2319
+ lastGlobalRange.value = widerRange(lastGlobalRange.value, range);
2320
+ const cached = cachedGroupSnapshot(query);
2321
+ if (cached && (await warmCacheAllowed())) {
2322
+ let current = cached;
2323
+ let expired = false;
2324
+ let rederiveAtMs;
2325
+ if (range === "lifetime") {
2326
+ const anchor = certifiedLifetimeWindowAtMs(atMs);
2327
+ if (anchor !== undefined && current.window.untilMs !== anchor) {
2328
+ rederiveAtMs = anchor;
2329
+ }
2330
+ }
2331
+ else {
2332
+ const certified = homeCertifiedSyncAtMs(range, atMs);
2333
+ if (certified !== undefined && current.window.untilMs < certified) {
2334
+ rederiveAtMs = certified;
2335
+ }
2336
+ }
2337
+ if (rederiveAtMs !== undefined) {
2338
+ if (modelHydrated && !modelDirty) {
2339
+ current = deriveGroupSnapshot(query, rederiveAtMs);
2340
+ storeGroupSnapshot(query, current);
2341
+ }
2342
+ else {
2343
+ groupCache.delete(cacheKey);
2344
+ expired = true;
2345
+ }
2346
+ }
2347
+ if (!expired) {
2348
+ const missingCoverage = !coversSince(window.sinceMs, state.extent);
2349
+ const stale = current.stale ||
2350
+ sidecarNewerThanIndex ||
2351
+ unavailable ||
2352
+ missingCoverage ||
2353
+ isStale(atMs);
2354
+ if (stale) {
2355
+ const scopedLifetime = range === "lifetime" && query.filter !== undefined;
2356
+ requestBackground({ globalRange: range, detailSessionIds: [], projectScopes: [] }, scopedLifetime ? sidecarNewerThanIndex : sidecarNewerThanIndex || missingCoverage);
2357
+ }
2358
+ return { ...current, stale };
2359
+ }
2360
+ }
2361
+ await ensureIndexLoaded();
2362
+ if (canDeriveScopedLifetimeFromOwnedData(query)) {
2363
+ ensureModel();
2364
+ const result = {
2365
+ ...deriveGroupSnapshot(query, groupDerivationAtMs("lifetime", atMs)),
2366
+ stale: true,
2367
+ };
2368
+ storeGroupSnapshot(query, result);
2369
+ scheduleScopedLifetimeRefresh(atMs);
2370
+ return result;
2371
+ }
2372
+ if (!coverageTrusted || !coversSince(window.sinceMs, state.extent)) {
2373
+ await requestRefresh({ globalRange: range, detailSessionIds: [], projectScopes: [] });
2374
+ if (unavailable &&
2375
+ state.occurrences.size === 0 &&
2376
+ Object.keys(state.sessions).length === 0) {
2377
+ throw new AnalyticsLookupError("unavailable");
2378
+ }
2379
+ }
2380
+ const derivationAtMs = groupDerivationAtMs(range, atMs);
2381
+ const missingCoverage = !coversSince(window.sinceMs, state.extent);
2382
+ const stale = sidecarNewerThanIndex || unavailable || missingCoverage || isStale(atMs);
2383
+ // The foreground attempt above already counts against due/backoff. Do not
2384
+ // force a second immediate refresh just because last-good data leaves
2385
+ // lifetime coverage incomplete; Home schedules the same bounded attempt.
2386
+ if (stale) {
2387
+ requestBackground({ globalRange: range, detailSessionIds: [], projectScopes: [] });
2388
+ }
2389
+ ensureModel();
2390
+ const result = {
2391
+ ...deriveGroupSnapshot(query, derivationAtMs),
2392
+ stale,
2393
+ };
2394
+ storeGroupSnapshot(query, result);
2395
+ return result;
2396
+ },
2180
2397
  async project(projectId, range) {
2181
2398
  if (!isRangeKey(range))
2182
2399
  throw new AnalyticsLookupError("bad-request");
@@ -2185,6 +2402,7 @@ export function createAnalyticsEngine(options = {}) {
2185
2402
  if (!projectId)
2186
2403
  throw new AnalyticsLookupError("bad-request");
2187
2404
  await ensureLoaded();
2405
+ ensurePricingRevision();
2188
2406
  const atMs = now();
2189
2407
  lastProjectScopes.set(projectId, widerRange(lastProjectScopes.get(projectId), range));
2190
2408
  const cached = cachedProject(projectId, range);
@@ -2254,6 +2472,7 @@ export function createAnalyticsEngine(options = {}) {
2254
2472
  if (!sessionId)
2255
2473
  throw new AnalyticsLookupError("bad-request");
2256
2474
  await ensureLoaded();
2475
+ ensurePricingRevision();
2257
2476
  lastDetailSessionIds.add(sessionId);
2258
2477
  trimSet(lastDetailSessionIds, MAX_SCOPE_BATCH * 4);
2259
2478
  const cached = cachedSession(sessionId);
@@ -2294,6 +2513,7 @@ export function createAnalyticsEngine(options = {}) {
2294
2513
  if (closed)
2295
2514
  throw new Error("analytics closed");
2296
2515
  await ensureIndexLoaded();
2516
+ ensurePricingRevision();
2297
2517
  const atMs = now();
2298
2518
  const hasInterests = lastGlobalRange.value !== undefined ||
2299
2519
  lastDetailSessionIds.size > 0 ||
@@ -2373,6 +2593,7 @@ export function createAnalyticsEngine(options = {}) {
2373
2593
  projectCoverage.clear();
2374
2594
  projectFreshAt.clear();
2375
2595
  detailFreshAt.clear();
2596
+ invalidateGroupSnapshots();
2376
2597
  })();
2377
2598
  return await closePromise;
2378
2599
  },