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.
- package/README.md +35 -19
- package/dist/contracts/analytics-entity.d.ts +32 -0
- package/dist/contracts/analytics-entity.d.ts.map +1 -0
- package/dist/contracts/analytics-entity.js +123 -0
- package/dist/contracts/analytics-entity.js.map +1 -0
- package/dist/contracts/analytics-temporal.d.ts +39 -0
- package/dist/contracts/analytics-temporal.d.ts.map +1 -0
- package/dist/contracts/analytics-temporal.js +11 -0
- package/dist/contracts/analytics-temporal.js.map +1 -0
- package/dist/contracts/build-identity.js +1 -1
- package/dist/contracts/collision-safe-key.d.ts +14 -0
- package/dist/contracts/collision-safe-key.d.ts.map +1 -0
- package/dist/contracts/collision-safe-key.js +28 -0
- package/dist/contracts/collision-safe-key.js.map +1 -0
- package/dist/contracts/dashboard.d.ts +152 -0
- package/dist/contracts/dashboard.d.ts.map +1 -1
- package/dist/contracts/dashboard.js.map +1 -1
- package/dist/contracts/temporal.d.ts +126 -0
- package/dist/contracts/temporal.d.ts.map +1 -0
- package/dist/contracts/temporal.js +10 -0
- package/dist/contracts/temporal.js.map +1 -0
- package/dist/data/modelsdev-pricing.min.json +1 -1064
- package/dist/data/modelsdev-temporal.min.json +3075 -0
- package/dist/gui/aggregation.d.ts.map +1 -1
- package/dist/gui/aggregation.js +9 -0
- package/dist/gui/aggregation.js.map +1 -1
- package/dist/gui/analytics-bridge.d.ts.map +1 -1
- package/dist/gui/analytics-bridge.js +14 -0
- package/dist/gui/analytics-bridge.js.map +1 -1
- package/dist/gui/analytics-engine.d.ts +3 -1
- package/dist/gui/analytics-engine.d.ts.map +1 -1
- package/dist/gui/analytics-engine.js +228 -7
- package/dist/gui/analytics-engine.js.map +1 -1
- package/dist/gui/analytics-model.d.ts +7 -5
- package/dist/gui/analytics-model.d.ts.map +1 -1
- package/dist/gui/analytics-model.js +625 -39
- package/dist/gui/analytics-model.js.map +1 -1
- package/dist/gui/analytics-pricing-revision.d.ts +43 -0
- package/dist/gui/analytics-pricing-revision.d.ts.map +1 -0
- package/dist/gui/analytics-pricing-revision.js +160 -0
- package/dist/gui/analytics-pricing-revision.js.map +1 -0
- package/dist/gui/analytics-protocol.d.ts +6 -2
- package/dist/gui/analytics-protocol.d.ts.map +1 -1
- package/dist/gui/analytics-protocol.js.map +1 -1
- package/dist/gui/analytics-service.d.ts +3 -1
- package/dist/gui/analytics-service.d.ts.map +1 -1
- package/dist/gui/analytics-service.js +14 -0
- package/dist/gui/analytics-service.js.map +1 -1
- package/dist/gui/analytics-state.d.ts +13 -0
- package/dist/gui/analytics-state.d.ts.map +1 -1
- package/dist/gui/analytics-state.js +25 -0
- package/dist/gui/analytics-state.js.map +1 -1
- package/dist/gui/analytics-worker-runtime.d.ts +5 -0
- package/dist/gui/analytics-worker-runtime.d.ts.map +1 -1
- package/dist/gui/analytics-worker-runtime.js +6 -0
- package/dist/gui/analytics-worker-runtime.js.map +1 -1
- package/dist/gui/config.d.ts +2 -2
- package/dist/gui/config.d.ts.map +1 -1
- package/dist/gui/config.js +18 -0
- package/dist/gui/config.js.map +1 -1
- package/dist/gui/lifecycle.d.ts +1 -1
- package/dist/gui/lifecycle.d.ts.map +1 -1
- package/dist/gui/lifecycle.js +1 -0
- package/dist/gui/lifecycle.js.map +1 -1
- package/dist/gui/server.d.ts.map +1 -1
- package/dist/gui/server.js +62 -0
- package/dist/gui/server.js.map +1 -1
- package/dist/gui/snapshot-service.d.ts +3 -1
- package/dist/gui/snapshot-service.d.ts.map +1 -1
- package/dist/gui/snapshot-service.js +10 -0
- package/dist/gui/snapshot-service.js.map +1 -1
- package/dist/gui/sources.d.ts +1 -1
- package/dist/gui/sources.d.ts.map +1 -1
- package/dist/gui/sources.js +53 -4
- package/dist/gui/sources.js.map +1 -1
- package/dist/gui/temporal-quota-policy-data.d.ts +24 -0
- package/dist/gui/temporal-quota-policy-data.d.ts.map +1 -0
- package/dist/gui/temporal-quota-policy-data.js +43 -0
- package/dist/gui/temporal-quota-policy-data.js.map +1 -0
- package/dist/gui/temporal-quota-policy.d.ts +38 -0
- package/dist/gui/temporal-quota-policy.d.ts.map +1 -0
- package/dist/gui/temporal-quota-policy.js +182 -0
- package/dist/gui/temporal-quota-policy.js.map +1 -0
- package/dist/gui/temporal-status.d.ts +53 -0
- package/dist/gui/temporal-status.d.ts.map +1 -0
- package/dist/gui/temporal-status.js +815 -0
- package/dist/gui/temporal-status.js.map +1 -0
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +33 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/cursor-usage.d.ts.map +1 -1
- package/dist/lib/cursor-usage.js +8 -2
- package/dist/lib/cursor-usage.js.map +1 -1
- package/dist/lib/modelsdev-pricing.d.ts +54 -1
- package/dist/lib/modelsdev-pricing.d.ts.map +1 -1
- package/dist/lib/modelsdev-pricing.js +284 -43
- package/dist/lib/modelsdev-pricing.js.map +1 -1
- package/dist/lib/modelsdev-temporal.d.ts +143 -0
- package/dist/lib/modelsdev-temporal.d.ts.map +1 -0
- package/dist/lib/modelsdev-temporal.js +896 -0
- package/dist/lib/modelsdev-temporal.js.map +1 -0
- package/dist/lib/opencode-console-auth.d.ts +19 -0
- package/dist/lib/opencode-console-auth.d.ts.map +1 -1
- package/dist/lib/opencode-console-auth.js +263 -3
- package/dist/lib/opencode-console-auth.js.map +1 -1
- package/dist/lib/opencode-storage.d.ts +26 -11
- package/dist/lib/opencode-storage.d.ts.map +1 -1
- package/dist/lib/opencode-storage.js +33 -56
- package/dist/lib/opencode-storage.js.map +1 -1
- package/dist/lib/quota-providers-local.d.ts.map +1 -1
- package/dist/lib/quota-providers-local.js +13 -3
- package/dist/lib/quota-providers-local.js.map +1 -1
- package/dist/lib/quota-stats-format.d.ts.map +1 -1
- package/dist/lib/quota-stats-format.js +28 -6
- package/dist/lib/quota-stats-format.js.map +1 -1
- package/dist/lib/quota-stats.d.ts +71 -7
- package/dist/lib/quota-stats.d.ts.map +1 -1
- package/dist/lib/quota-stats.js +417 -22
- package/dist/lib/quota-stats.js.map +1 -1
- package/dist/lib/scoped-query-chunks.d.ts +15 -0
- package/dist/lib/scoped-query-chunks.d.ts.map +1 -0
- package/dist/lib/scoped-query-chunks.js +48 -0
- package/dist/lib/scoped-query-chunks.js.map +1 -0
- package/dist/lib/token-cost.d.ts +29 -0
- package/dist/lib/token-cost.d.ts.map +1 -1
- package/dist/lib/token-cost.js +74 -10
- package/dist/lib/token-cost.js.map +1 -1
- package/dist/lib/types.d.ts +6 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +1 -0
- package/dist/lib/types.js.map +1 -1
- package/dist/provider-logos/NOTICE.md +12 -0
- package/dist/provider-logos/OPENCODE-MIT.txt +21 -0
- package/dist/provider-logos/OPENCODE-NOTICE.md +12 -0
- package/dist/provider-logos/UPSTREAM-MIT.txt +21 -0
- package/dist/providers/cache-policies.d.ts.map +1 -1
- package/dist/providers/cache-policies.js +4 -3
- package/dist/providers/cache-policies.js.map +1 -1
- package/dist/providers/opencode-go.d.ts.map +1 -1
- package/dist/providers/opencode-go.js +2 -0
- package/dist/providers/opencode-go.js.map +1 -1
- package/dist/providers/opencode-zen.d.ts.map +1 -1
- package/dist/providers/opencode-zen.js +2 -0
- package/dist/providers/opencode-zen.js.map +1 -1
- package/dist/ui/assets/{index-D3-Yn_WA.css → index-Cs-nrywz.css} +1 -1
- package/dist/ui/assets/index-D9lFKhSN.js +9 -0
- package/dist/ui/assets/popover-DKRrwr_K.js +1 -0
- package/dist/ui/assets/popover-mkHTmNjv.css +1 -0
- package/dist/ui/assets/providers/302ai.svg +7 -0
- package/dist/ui/assets/providers/abacus.svg +14 -0
- package/dist/ui/assets/providers/abliteration-ai.svg +6 -0
- package/dist/ui/assets/providers/above.svg +3 -0
- package/dist/ui/assets/providers/agentrouter.svg +4 -0
- package/dist/ui/assets/providers/agnes.svg +1 -0
- package/dist/ui/assets/providers/ai-router.svg +5 -0
- package/dist/ui/assets/providers/ai21.svg +3 -0
- package/dist/ui/assets/providers/aiand.svg +4 -0
- package/dist/ui/assets/providers/aihubmix.svg +3 -0
- package/dist/ui/assets/providers/aimlapi.svg +3 -0
- package/dist/ui/assets/providers/ainetcafe.svg +1 -0
- package/dist/ui/assets/providers/aixy.svg +4 -0
- package/dist/ui/assets/providers/aki-io.svg +7 -0
- package/dist/ui/assets/providers/alibaba-cn.svg +3 -0
- package/dist/ui/assets/providers/alibaba-coding-plan-cn.svg +3 -0
- package/dist/ui/assets/providers/alibaba-coding-plan.svg +3 -0
- package/dist/ui/assets/providers/alibaba-token-plan.svg +3 -0
- package/dist/ui/assets/providers/alibaba.svg +3 -0
- package/dist/ui/assets/providers/amazon-bedrock.svg +3 -0
- package/dist/ui/assets/providers/ambient.svg +3 -0
- package/dist/ui/assets/providers/amd.svg +3 -0
- package/dist/ui/assets/providers/anthropic.svg +3 -0
- package/dist/ui/assets/providers/anyapi.svg +3 -0
- package/dist/ui/assets/providers/arcee.svg +3 -0
- package/dist/ui/assets/providers/atomic-chat.svg +1 -0
- package/dist/ui/assets/providers/auriko.svg +6 -0
- package/dist/ui/assets/providers/azure-cognitive-services.svg +3 -0
- package/dist/ui/assets/providers/azure.svg +3 -0
- package/dist/ui/assets/providers/bailing.svg +3 -0
- package/dist/ui/assets/providers/baseten.svg +3 -0
- package/dist/ui/assets/providers/bee.svg +1 -0
- package/dist/ui/assets/providers/berget.svg +3 -0
- package/dist/ui/assets/providers/blueclaw.svg +3 -0
- package/dist/ui/assets/providers/bothub.svg +33 -0
- package/dist/ui/assets/providers/boundless.svg +12 -0
- package/dist/ui/assets/providers/cerebras.svg +4 -0
- package/dist/ui/assets/providers/clarifai.svg +3 -0
- package/dist/ui/assets/providers/claudinio.svg +19 -0
- package/dist/ui/assets/providers/cloudferro-sherlock.svg +5 -0
- package/dist/ui/assets/providers/cloudflare-ai-gateway.svg +4 -0
- package/dist/ui/assets/providers/cloudflare-workers-ai.svg +4 -0
- package/dist/ui/assets/providers/cohere.svg +5 -0
- package/dist/ui/assets/providers/commandcode.svg +11 -0
- package/dist/ui/assets/providers/coralbricks.svg +6 -0
- package/dist/ui/assets/providers/crossmodel.svg +5 -0
- package/dist/ui/assets/providers/crusoe.svg +23 -0
- package/dist/ui/assets/providers/daoxe.svg +3 -0
- package/dist/ui/assets/providers/databricks.svg +3 -0
- package/dist/ui/assets/providers/deepinfra.svg +4 -0
- package/dist/ui/assets/providers/deepseek.svg +3 -0
- package/dist/ui/assets/providers/digitalocean.svg +6 -0
- package/dist/ui/assets/providers/dinference.svg +1 -0
- package/dist/ui/assets/providers/drun.svg +8 -0
- package/dist/ui/assets/providers/ebcloud.svg +8 -0
- package/dist/ui/assets/providers/echo.svg +7 -0
- package/dist/ui/assets/providers/edenai.svg +8 -0
- package/dist/ui/assets/providers/empiriolabs.svg +1 -0
- package/dist/ui/assets/providers/engy.svg +1 -0
- package/dist/ui/assets/providers/evroc.svg +3 -0
- package/dist/ui/assets/providers/fastrouter.svg +3 -0
- package/dist/ui/assets/providers/fireworks-ai.svg +3 -0
- package/dist/ui/assets/providers/fluence.svg +3 -0
- package/dist/ui/assets/providers/freemodel.svg +3 -0
- package/dist/ui/assets/providers/friendli.svg +3 -0
- package/dist/ui/assets/providers/frogbot.svg +36 -0
- package/dist/ui/assets/providers/generic.svg +4 -0
- package/dist/ui/assets/providers/github-copilot.svg +3 -0
- package/dist/ui/assets/providers/gitlab.svg +3 -0
- package/dist/ui/assets/providers/google-vertex-anthropic.svg +10 -0
- package/dist/ui/assets/providers/google-vertex.svg +10 -0
- package/dist/ui/assets/providers/google.svg +3 -0
- package/dist/ui/assets/providers/greenpt.svg +6 -0
- package/dist/ui/assets/providers/groq.svg +3 -0
- package/dist/ui/assets/providers/helicone.svg +6 -0
- package/dist/ui/assets/providers/hetzner.svg +3 -0
- package/dist/ui/assets/providers/hpc-ai.svg +444 -0
- package/dist/ui/assets/providers/huggingface.svg +3 -0
- package/dist/ui/assets/providers/hyper.svg +20 -0
- package/dist/ui/assets/providers/impossibl.svg +3 -0
- package/dist/ui/assets/providers/inception.svg +14 -0
- package/dist/ui/assets/providers/inceptron.svg +14 -0
- package/dist/ui/assets/providers/inco.svg +3 -0
- package/dist/ui/assets/providers/infer.svg +4 -0
- package/dist/ui/assets/providers/inference.svg +3 -0
- package/dist/ui/assets/providers/inferx.svg +5 -0
- package/dist/ui/assets/providers/infomaniak.svg +3 -0
- package/dist/ui/assets/providers/io-net.svg +5 -0
- package/dist/ui/assets/providers/iteracompute.svg +6 -0
- package/dist/ui/assets/providers/jalapeno.svg +8 -0
- package/dist/ui/assets/providers/jiekou.svg +4 -0
- package/dist/ui/assets/providers/kenari.svg +4 -0
- package/dist/ui/assets/providers/kilo.svg +4 -0
- package/dist/ui/assets/providers/kimi-code-plan-cn.svg +3 -0
- package/dist/ui/assets/providers/kimi-code-plan-global.svg +3 -0
- package/dist/ui/assets/providers/klokintegration.svg +11 -0
- package/dist/ui/assets/providers/kosmik.svg +28 -0
- package/dist/ui/assets/providers/kuae-cloud-coding-plan.svg +3 -0
- package/dist/ui/assets/providers/lilac.svg +6 -0
- package/dist/ui/assets/providers/liquid.svg +1 -0
- package/dist/ui/assets/providers/llmgateway-providers.svg +6 -0
- package/dist/ui/assets/providers/llmgateway.svg +6 -0
- package/dist/ui/assets/providers/llmtech.svg +6 -0
- package/dist/ui/assets/providers/llmtr.svg +12 -0
- package/dist/ui/assets/providers/lmstudio.svg +3 -0
- package/dist/ui/assets/providers/longcat.svg +6 -0
- package/dist/ui/assets/providers/lowrouter.svg +8 -0
- package/dist/ui/assets/providers/lucidquery.svg +3 -0
- package/dist/ui/assets/providers/lynkr.svg +1 -0
- package/dist/ui/assets/providers/meganova.svg +3 -0
- package/dist/ui/assets/providers/melious.svg +3 -0
- package/dist/ui/assets/providers/merge-gateway.svg +4 -0
- package/dist/ui/assets/providers/meta.svg +3 -0
- package/dist/ui/assets/providers/minimax-cn-coding-plan.svg +3 -0
- package/dist/ui/assets/providers/minimax-cn.svg +3 -0
- package/dist/ui/assets/providers/minimax-coding-plan.svg +3 -0
- package/dist/ui/assets/providers/minimax.svg +3 -0
- package/dist/ui/assets/providers/mistral.svg +3 -0
- package/dist/ui/assets/providers/mixlayer.svg +8 -0
- package/dist/ui/assets/providers/moark.svg +3 -0
- package/dist/ui/assets/providers/modal.svg +3 -0
- package/dist/ui/assets/providers/model-oracle-ai.svg +11 -0
- package/dist/ui/assets/providers/modelis.svg +1 -0
- package/dist/ui/assets/providers/modelscope.svg +5 -0
- package/dist/ui/assets/providers/moonshotai-cn.svg +3 -0
- package/dist/ui/assets/providers/moonshotai.svg +3 -0
- package/dist/ui/assets/providers/munito-eu.svg +1 -0
- package/dist/ui/assets/providers/munito.svg +1 -0
- package/dist/ui/assets/providers/nan.svg +1 -0
- package/dist/ui/assets/providers/nano-gpt.svg +3 -0
- package/dist/ui/assets/providers/nearai.svg +1 -0
- package/dist/ui/assets/providers/nebius.svg +4 -0
- package/dist/ui/assets/providers/neon.svg +3 -0
- package/dist/ui/assets/providers/neosmith.svg +6 -0
- package/dist/ui/assets/providers/neuralwatt.svg +27 -0
- package/dist/ui/assets/providers/nova.svg +3 -0
- package/dist/ui/assets/providers/novita-ai.svg +10 -0
- package/dist/ui/assets/providers/nvidia.svg +3 -0
- package/dist/ui/assets/providers/oci.svg +3 -0
- package/dist/ui/assets/providers/ofox.svg +5 -0
- package/dist/ui/assets/providers/ollama-cloud.svg +7 -0
- package/dist/ui/assets/providers/openai.svg +3 -0
- package/dist/ui/assets/providers/opencode-go-g.svg +3 -0
- package/dist/ui/assets/providers/opencode-go.svg +4 -0
- package/dist/ui/assets/providers/opencode.svg +4 -0
- package/dist/ui/assets/providers/openreason.svg +8 -0
- package/dist/ui/assets/providers/openrouter.svg +3 -0
- package/dist/ui/assets/providers/opper.svg +3 -0
- package/dist/ui/assets/providers/orcarouter.svg +2 -0
- package/dist/ui/assets/providers/ovhcloud.svg +3 -0
- package/dist/ui/assets/providers/pareto.svg +5 -0
- package/dist/ui/assets/providers/pendra.svg +10 -0
- package/dist/ui/assets/providers/perplexity-agent.svg +3 -0
- package/dist/ui/assets/providers/perplexity.svg +3 -0
- package/dist/ui/assets/providers/pioneer.svg +3 -0
- package/dist/ui/assets/providers/poe.svg +7 -0
- package/dist/ui/assets/providers/poolside.svg +3 -0
- package/dist/ui/assets/providers/prime.svg +7 -0
- package/dist/ui/assets/providers/privatemode-ai.svg +5 -0
- package/dist/ui/assets/providers/qihang-ai.svg +9 -0
- package/dist/ui/assets/providers/qiniu-ai.svg +7 -0
- package/dist/ui/assets/providers/qvac.svg +6 -0
- package/dist/ui/assets/providers/reflection.svg +3 -0
- package/dist/ui/assets/providers/regolo-ai.svg +45 -0
- package/dist/ui/assets/providers/routing-run.svg +4 -0
- package/dist/ui/assets/providers/runinfra.svg +10 -0
- package/dist/ui/assets/providers/salad-cloud.svg +15 -0
- package/dist/ui/assets/providers/sambanova.svg +26 -0
- package/dist/ui/assets/providers/scaleway.svg +5 -0
- package/dist/ui/assets/providers/scnet-token-plan.svg +8 -0
- package/dist/ui/assets/providers/scx-ai.svg +1 -0
- package/dist/ui/assets/providers/sensenova.svg +18 -0
- package/dist/ui/assets/providers/siliconflow-cn.svg +3 -0
- package/dist/ui/assets/providers/siliconflow.svg +3 -0
- package/dist/ui/assets/providers/snowflake-cortex.svg +3 -0
- package/dist/ui/assets/providers/stackit.svg +3 -0
- package/dist/ui/assets/providers/standardcompute.svg +5 -0
- package/dist/ui/assets/providers/stepfun-ai-step-plan.svg +16 -0
- package/dist/ui/assets/providers/stepfun-ai.svg +16 -0
- package/dist/ui/assets/providers/stepfun-step-plan.svg +16 -0
- package/dist/ui/assets/providers/stepfun.svg +16 -0
- package/dist/ui/assets/providers/subconscious.svg +3 -0
- package/dist/ui/assets/providers/submodel.svg +3 -0
- package/dist/ui/assets/providers/teamorouter.svg +3 -0
- package/dist/ui/assets/providers/tempr.svg +4 -0
- package/dist/ui/assets/providers/tencent-coding-plan.svg +5 -0
- package/dist/ui/assets/providers/tencent-token-plan.svg +3 -0
- package/dist/ui/assets/providers/tencent-tokenhub.svg +3 -0
- package/dist/ui/assets/providers/tensorx.svg +6 -0
- package/dist/ui/assets/providers/the-grid-ai.svg +14 -0
- package/dist/ui/assets/providers/thinkingmachines.svg +3 -0
- package/dist/ui/assets/providers/tinfoil.svg +3 -0
- package/dist/ui/assets/providers/togetherai.svg +4 -0
- package/dist/ui/assets/providers/tokengo.svg +3 -0
- package/dist/ui/assets/providers/tokenrouter.svg +4 -0
- package/dist/ui/assets/providers/trustedrouter.svg +4 -0
- package/dist/ui/assets/providers/umans-ai-coding-plan.svg +29 -0
- package/dist/ui/assets/providers/umans-ai.svg +29 -0
- package/dist/ui/assets/providers/unorouter.svg +7 -0
- package/dist/ui/assets/providers/vancine.svg +6 -0
- package/dist/ui/assets/providers/venice.svg +4 -0
- package/dist/ui/assets/providers/vercel.svg +3 -0
- package/dist/ui/assets/providers/vispark.svg +3 -0
- package/dist/ui/assets/providers/vivgrid.svg +4 -0
- package/dist/ui/assets/providers/volcengine-coding-plan.svg +3 -0
- package/dist/ui/assets/providers/volcengine.svg +3 -0
- package/dist/ui/assets/providers/vultr.svg +6 -0
- package/dist/ui/assets/providers/wafer.ai.svg +3 -0
- package/dist/ui/assets/providers/wallaby.svg +4 -0
- package/dist/ui/assets/providers/wandb.svg +6 -0
- package/dist/ui/assets/providers/watsonx.svg +5 -0
- package/dist/ui/assets/providers/xai.svg +3 -0
- package/dist/ui/assets/providers/xiaomi-token-plan-ams.svg +3 -0
- package/dist/ui/assets/providers/xiaomi-token-plan-cn.svg +3 -0
- package/dist/ui/assets/providers/xiaomi-token-plan-sgp.svg +3 -0
- package/dist/ui/assets/providers/xiaomi.svg +3 -0
- package/dist/ui/assets/providers/xpersona.svg +8 -0
- package/dist/ui/assets/providers/zai-coding-plan.svg +3 -0
- package/dist/ui/assets/providers/zai.svg +3 -0
- package/dist/ui/assets/providers/zeldoc.svg +3 -0
- package/dist/ui/assets/providers/zenifra.svg +4 -0
- package/dist/ui/assets/providers/zenmux.svg +4 -0
- package/dist/ui/assets/providers/zhipuai-coding-plan.svg +3 -0
- package/dist/ui/assets/providers/zhipuai.svg +3 -0
- package/dist/ui/index.html +2 -2
- package/package.json +5 -1
- 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
|
-
|
|
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
|
-
|
|
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 (
|
|
2006
|
-
model.apply(modelUpserts,
|
|
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
|
},
|