opencode-quota-gui 1.0.0 → 1.1.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 -23
- 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/build-identity.js +1 -1
- package/dist/contracts/card-order.d.ts +25 -0
- package/dist/contracts/card-order.d.ts.map +1 -0
- package/dist/contracts/card-order.js +50 -0
- package/dist/contracts/card-order.js.map +1 -0
- 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 +149 -0
- package/dist/contracts/dashboard.d.ts.map +1 -1
- package/dist/data/modelsdev-pricing.min.json +1 -1064
- package/dist/gui/aggregation.d.ts.map +1 -1
- package/dist/gui/aggregation.js +6 -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 +198 -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 +444 -38
- package/dist/gui/analytics-model.js.map +1 -1
- 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 +8 -0
- package/dist/gui/analytics-state.d.ts.map +1 -1
- package/dist/gui/analytics-state.js +13 -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 +7 -4
- package/dist/gui/config.d.ts.map +1 -1
- package/dist/gui/config.js +25 -3
- 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/provider-cards.d.ts +15 -18
- package/dist/gui/provider-cards.d.ts.map +1 -1
- package/dist/gui/provider-cards.js +33 -29
- package/dist/gui/provider-cards.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 +14 -9
- package/dist/gui/sources.d.ts.map +1 -1
- package/dist/gui/sources.js +50 -23
- package/dist/gui/sources.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +30 -5
- 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/dashboard-visibility.d.ts +13 -0
- package/dist/lib/dashboard-visibility.d.ts.map +1 -0
- package/dist/lib/dashboard-visibility.js +51 -0
- package/dist/lib/dashboard-visibility.js.map +1 -0
- package/dist/lib/entries.d.ts +2 -0
- package/dist/lib/entries.d.ts.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/opencode-console-auth.d.ts +68 -0
- package/dist/lib/opencode-console-auth.d.ts.map +1 -1
- package/dist/lib/opencode-console-auth.js +424 -14
- package/dist/lib/opencode-console-auth.js.map +1 -1
- package/dist/lib/opencode-go.d.ts.map +1 -1
- package/dist/lib/opencode-go.js +13 -7
- package/dist/lib/opencode-go.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/openrouter.d.ts +45 -1
- package/dist/lib/openrouter.d.ts.map +1 -1
- package/dist/lib/openrouter.js +177 -12
- package/dist/lib/openrouter.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-providers-remote.d.ts.map +1 -1
- package/dist/lib/quota-providers-remote.js +117 -38
- package/dist/lib/quota-providers-remote.js.map +1 -1
- package/dist/lib/quota-state-codec.d.ts.map +1 -1
- package/dist/lib/quota-state-codec.js +5 -1
- package/dist/lib/quota-state-codec.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 +49 -6
- package/dist/lib/quota-stats.d.ts.map +1 -1
- package/dist/lib/quota-stats.js +319 -20
- 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 +17 -3
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +3 -1
- 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 +8 -2
- package/dist/providers/cache-policies.d.ts.map +1 -1
- package/dist/providers/cache-policies.js +78 -24
- 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 +201 -84
- 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 +235 -166
- package/dist/providers/opencode-zen.js.map +1 -1
- package/dist/providers/openrouter.d.ts.map +1 -1
- package/dist/providers/openrouter.js +76 -14
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/ui/assets/{index-wlxynmbV.css → index-BZwMJ6Ax.css} +1 -1
- package/dist/ui/assets/index-CjNjqsse.js +8 -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 +4 -1
- package/dist/ui/assets/index-BvKGj9wc.js +0 -8
package/README.md
CHANGED
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
# OpenCode Quota GUI
|
|
6
6
|
|
|
7
|
-
A local dashboard for your OpenCode quota, 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
|
+
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.
|
|
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
|
-
<a href="https://www.npmjs.com/package/opencode-quota-gui"><img alt="npm downloads" src="https://img.shields.io/npm/dm/opencode-quota-gui?style=flat-square" /></a>
|
|
12
|
-
<a href="https://github.com/PVLPM/opencode-quota-gui/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/PVLPM/opencode-quota-gui/ci.yml?style=flat-square&label=CI" /></a>
|
|
13
11
|
<a href="./LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" /></a>
|
|
14
12
|
</p>
|
|
15
13
|
|
|
@@ -18,20 +16,24 @@ A local dashboard for your OpenCode quota, token usage, projects, and sessions.
|
|
|
18
16
|
| Screenshots |
|
|
19
17
|
| --- |
|
|
20
18
|
| **Quota** |
|
|
21
|
-
|  |
|
|
19
|
+
|  |
|
|
22
20
|
| **Analytics** |
|
|
23
|
-
|  |
|
|
22
|
+
| **Models by provider** |
|
|
23
|
+
|  |
|
|
24
24
|
| **Session** |
|
|
25
|
-
|  |
|
|
25
|
+
|  |
|
|
26
26
|
|
|
27
27
|
## Features
|
|
28
28
|
|
|
29
|
-
- **Quota
|
|
30
|
-
- **
|
|
31
|
-
- **
|
|
32
|
-
- **
|
|
33
|
-
- **
|
|
34
|
-
- **
|
|
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)`.
|
|
30
|
+
- **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.
|
|
31
|
+
- **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.
|
|
32
|
+
- **Drilldowns:** Analytics → project → session, and Models → provider/model, as real URLs with working reload and browser back/forward.
|
|
33
|
+
- **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.
|
|
34
|
+
- **API-equivalent estimates:** list-price estimates for recorded tokens, shown beside token totals in Analytics, Models, projects, providers, and models. They are estimates, not subscription spend.
|
|
35
|
+
- **Customization:** used or remaining percentages, label style, row detail, provider selection, refresh interval, request timeout, card order, and per-card or per-row visibility. Custom quota providers and pricing fallbacks live in the canonical config.
|
|
36
|
+
- **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`.
|
|
35
37
|
|
|
36
38
|
## Quick start
|
|
37
39
|
|
|
@@ -60,24 +62,34 @@ Requirements: OpenCode `2.0.16` or newer and Node.js `22.13+` or `23.4+`. This p
|
|
|
60
62
|
|
|
61
63
|
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.
|
|
62
64
|
|
|
63
|
-
- **Quota:** cards for discovered provider accounts, ordered and grouped by provider. Each card shows the rows
|
|
64
|
-
- **Analytics:**
|
|
65
|
-
- **
|
|
66
|
-
- **
|
|
65
|
+
- **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)`.
|
|
66
|
+
- **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.
|
|
67
|
+
- **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.
|
|
68
|
+
- **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.
|
|
69
|
+
- **Settings:** display, provider, request, visibility, and card-order controls, plus the canonical settings file, any reported configuration issues, and build information.
|
|
67
70
|
|
|
68
71
|
The routes are real URLs, so reload and browser back/forward work:
|
|
69
72
|
|
|
70
|
-
- `/quota` — provider cards
|
|
71
|
-
- `/analytics?range=7d` — usage and projects
|
|
72
|
-
- `/
|
|
73
|
+
- `/quota` — provider account cards
|
|
74
|
+
- `/analytics?range=7d` — token usage and projects
|
|
75
|
+
- `/models?range=30d` — usage grouped by provider; add `&group=model` for model grouping
|
|
76
|
+
- `/project/<id>?range=30d` — one project and its sessions
|
|
73
77
|
- `/session/<id>` — one session tree
|
|
74
78
|
- `/settings` — dashboard settings
|
|
75
79
|
|
|
76
80
|
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.
|
|
77
81
|
|
|
82
|
+
## Scope and limitations
|
|
83
|
+
|
|
84
|
+
- **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.
|
|
85
|
+
- **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.
|
|
86
|
+
- **`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.
|
|
87
|
+
- **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.
|
|
88
|
+
- **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.
|
|
89
|
+
|
|
78
90
|
## Providers
|
|
79
91
|
|
|
80
|
-
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.
|
|
92
|
+
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.
|
|
81
93
|
|
|
82
94
|
### Pre-configured American providers
|
|
83
95
|
|
|
@@ -97,7 +109,7 @@ Most providers work automatically once you log in through OpenCode. A **Needs se
|
|
|
97
109
|
| OpenAI | Automatic | Remote API | Quota |
|
|
98
110
|
| OpenCode Go | Automatic | Remote API | Quota |
|
|
99
111
|
| OpenCode Zen | Automatic | Remote API | Budget and balance |
|
|
100
|
-
| OpenRouter | Automatic | Remote API |
|
|
112
|
+
| OpenRouter | Automatic | Remote API | Key limit + spend |
|
|
101
113
|
| Synthetic | Automatic | Remote API | Quota |
|
|
102
114
|
| xAI SuperGrok | Automatic | Remote API | Quota |
|
|
103
115
|
|
|
@@ -117,7 +129,7 @@ Most providers work automatically once you log in through OpenCode. A **Needs se
|
|
|
117
129
|
| NanoGPT | Automatic | Remote API | Quota and balance |
|
|
118
130
|
| OpenAI | Automatic | Remote API | Quota |
|
|
119
131
|
| OpenCode Zen | Automatic | Remote API | Budget and balance |
|
|
120
|
-
| OpenRouter | Automatic | Remote API |
|
|
132
|
+
| OpenRouter | Automatic | Remote API | Key limit + spend |
|
|
121
133
|
| Synthetic | Automatic | Remote API | Quota |
|
|
122
134
|
| xAI SuperGrok | Automatic | Remote API | Quota |
|
|
123
135
|
|
|
@@ -181,7 +193,7 @@ The dashboard reads only the canonical file at runtime:
|
|
|
181
193
|
- **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.
|
|
182
194
|
- **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).
|
|
183
195
|
- **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.
|
|
184
|
-
- **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
|
|
196
|
+
- **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.
|
|
185
197
|
|
|
186
198
|
See [Configuration](docs/readme/configuration.md) for every supported settings key and the custom-provider rules.
|
|
187
199
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reversible, tagged, URL-safe tokens for exact model/provider identities.
|
|
3
|
+
*
|
|
4
|
+
* A known identity is `k.` plus the base64url encoding of its UTF-16 code
|
|
5
|
+
* units; the explicit `u` token is the missing identity. UTF-16 (not UTF-8)
|
|
6
|
+
* keeps every JavaScript string reversible, including lone surrogates, NUL,
|
|
7
|
+
* whitespace, slashes, percent signs, hashes and delimiter-shaped ids. A known
|
|
8
|
+
* empty id is `k.` and therefore never aliases `u`.
|
|
9
|
+
*
|
|
10
|
+
* Validation is confined to this token grammar: it deliberately does not reuse
|
|
11
|
+
* filesystem-oriented resource-id rules, because raw identities may contain any
|
|
12
|
+
* character.
|
|
13
|
+
*/
|
|
14
|
+
import type { AnalyticsEntityIdentity, AnalyticsGroupQuery } from "./dashboard.js";
|
|
15
|
+
/** The only token that means "this identity is missing". */
|
|
16
|
+
export declare const UNKNOWN_ANALYTICS_ENTITY_TOKEN = "u";
|
|
17
|
+
/** Encodes one exact identity; the result is a single URL path/query-safe token. */
|
|
18
|
+
export declare function encodeAnalyticsEntityToken(identity: AnalyticsEntityIdentity): string;
|
|
19
|
+
/**
|
|
20
|
+
* Decodes one token, or `undefined` for a malformed token. Only the canonical
|
|
21
|
+
* encoding is accepted, so two byte sequences cannot stand for one identity.
|
|
22
|
+
*/
|
|
23
|
+
export declare function decodeAnalyticsEntityToken(token: string): AnalyticsEntityIdentity | undefined;
|
|
24
|
+
/** True for a structurally valid grouped query; raw id contents are unconstrained. */
|
|
25
|
+
export declare function isAnalyticsGroupQuery(value: unknown): value is AnalyticsGroupQuery;
|
|
26
|
+
/**
|
|
27
|
+
* Collision-safe cache/coalescing key for one grouped query. Length-prefixed
|
|
28
|
+
* parts keep raw ids containing delimiters, empty strings and missing values
|
|
29
|
+
* distinct without a visible-label sentinel.
|
|
30
|
+
*/
|
|
31
|
+
export declare function encodeAnalyticsGroupQueryKey(query: AnalyticsGroupQuery): string;
|
|
32
|
+
//# sourceMappingURL=analytics-entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-entity.d.ts","sourceRoot":"","sources":["../../src/contracts/analytics-entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAEV,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAGxB,4DAA4D;AAC5D,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAoClD,oFAAoF;AACpF,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,uBAAuB,GAAG,MAAM,CAUpF;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CAc7F;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAclF;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,mBAAmB,GAAG,MAAM,CAS/E"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reversible, tagged, URL-safe tokens for exact model/provider identities.
|
|
3
|
+
*
|
|
4
|
+
* A known identity is `k.` plus the base64url encoding of its UTF-16 code
|
|
5
|
+
* units; the explicit `u` token is the missing identity. UTF-16 (not UTF-8)
|
|
6
|
+
* keeps every JavaScript string reversible, including lone surrogates, NUL,
|
|
7
|
+
* whitespace, slashes, percent signs, hashes and delimiter-shaped ids. A known
|
|
8
|
+
* empty id is `k.` and therefore never aliases `u`.
|
|
9
|
+
*
|
|
10
|
+
* Validation is confined to this token grammar: it deliberately does not reuse
|
|
11
|
+
* filesystem-oriented resource-id rules, because raw identities may contain any
|
|
12
|
+
* character.
|
|
13
|
+
*/
|
|
14
|
+
import { encodeIdentityKey } from "./collision-safe-key.js";
|
|
15
|
+
import { isRangeKey } from "./ranges.js";
|
|
16
|
+
/** The only token that means "this identity is missing". */
|
|
17
|
+
export const UNKNOWN_ANALYTICS_ENTITY_TOKEN = "u";
|
|
18
|
+
const KNOWN_TAG = "k.";
|
|
19
|
+
const BASE64URL_RE = /^[A-Za-z0-9_-]*$/;
|
|
20
|
+
const UTF16_CODE_UNITS_PER_BYTE = 2;
|
|
21
|
+
function isAnalyticsDimension(value) {
|
|
22
|
+
return value === "model" || value === "provider";
|
|
23
|
+
}
|
|
24
|
+
function toBase64Url(bytes) {
|
|
25
|
+
let binary = "";
|
|
26
|
+
const chunkSize = 0x8000;
|
|
27
|
+
for (let index = 0; index < bytes.length; index += chunkSize) {
|
|
28
|
+
binary += String.fromCharCode(...bytes.subarray(index, index + chunkSize));
|
|
29
|
+
}
|
|
30
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
31
|
+
}
|
|
32
|
+
function fromBase64Url(token) {
|
|
33
|
+
if (!BASE64URL_RE.test(token))
|
|
34
|
+
return undefined;
|
|
35
|
+
const standard = token.replace(/-/g, "+").replace(/_/g, "/");
|
|
36
|
+
const padding = (4 - (standard.length % 4)) % 4;
|
|
37
|
+
let binary;
|
|
38
|
+
try {
|
|
39
|
+
binary = atob(`${standard}${"=".repeat(padding)}`);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
const bytes = new Uint8Array(binary.length);
|
|
45
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
46
|
+
bytes[index] = binary.charCodeAt(index);
|
|
47
|
+
}
|
|
48
|
+
return bytes;
|
|
49
|
+
}
|
|
50
|
+
/** Encodes one exact identity; the result is a single URL path/query-safe token. */
|
|
51
|
+
export function encodeAnalyticsEntityToken(identity) {
|
|
52
|
+
if (identity.kind === "unknown")
|
|
53
|
+
return UNKNOWN_ANALYTICS_ENTITY_TOKEN;
|
|
54
|
+
const { id } = identity;
|
|
55
|
+
const bytes = new Uint8Array(id.length * UTF16_CODE_UNITS_PER_BYTE);
|
|
56
|
+
for (let index = 0; index < id.length; index += 1) {
|
|
57
|
+
const code = id.charCodeAt(index);
|
|
58
|
+
bytes[index * 2] = code & 0xff;
|
|
59
|
+
bytes[index * 2 + 1] = code >> 8;
|
|
60
|
+
}
|
|
61
|
+
return `${KNOWN_TAG}${toBase64Url(bytes)}`;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Decodes one token, or `undefined` for a malformed token. Only the canonical
|
|
65
|
+
* encoding is accepted, so two byte sequences cannot stand for one identity.
|
|
66
|
+
*/
|
|
67
|
+
export function decodeAnalyticsEntityToken(token) {
|
|
68
|
+
if (token === UNKNOWN_ANALYTICS_ENTITY_TOKEN)
|
|
69
|
+
return { kind: "unknown" };
|
|
70
|
+
if (!token.startsWith(KNOWN_TAG))
|
|
71
|
+
return undefined;
|
|
72
|
+
const payload = token.slice(KNOWN_TAG.length);
|
|
73
|
+
const bytes = fromBase64Url(payload);
|
|
74
|
+
if (bytes === undefined || bytes.length % UTF16_CODE_UNITS_PER_BYTE !== 0)
|
|
75
|
+
return undefined;
|
|
76
|
+
let id = "";
|
|
77
|
+
for (let index = 0; index < bytes.length; index += 2) {
|
|
78
|
+
const low = bytes[index] ?? 0;
|
|
79
|
+
const high = bytes[index + 1] ?? 0;
|
|
80
|
+
id += String.fromCharCode(low | (high << 8));
|
|
81
|
+
}
|
|
82
|
+
const identity = { kind: "known", id };
|
|
83
|
+
return encodeAnalyticsEntityToken(identity) === token ? identity : undefined;
|
|
84
|
+
}
|
|
85
|
+
/** True for a structurally valid grouped query; raw id contents are unconstrained. */
|
|
86
|
+
export function isAnalyticsGroupQuery(value) {
|
|
87
|
+
if (typeof value !== "object" || value === null)
|
|
88
|
+
return false;
|
|
89
|
+
const record = value;
|
|
90
|
+
if (!isRangeKey(record.range) || !isAnalyticsDimension(record.dimension))
|
|
91
|
+
return false;
|
|
92
|
+
const filter = record.filter;
|
|
93
|
+
if (filter === undefined)
|
|
94
|
+
return true;
|
|
95
|
+
if (typeof filter !== "object" || filter === null)
|
|
96
|
+
return false;
|
|
97
|
+
const filterRecord = filter;
|
|
98
|
+
if (!isAnalyticsDimension(filterRecord.dimension))
|
|
99
|
+
return false;
|
|
100
|
+
const identity = filterRecord.identity;
|
|
101
|
+
if (typeof identity !== "object" || identity === null)
|
|
102
|
+
return false;
|
|
103
|
+
const identityRecord = identity;
|
|
104
|
+
if (identityRecord.kind === "unknown")
|
|
105
|
+
return true;
|
|
106
|
+
return identityRecord.kind === "known" && typeof identityRecord.id === "string";
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Collision-safe cache/coalescing key for one grouped query. Length-prefixed
|
|
110
|
+
* parts keep raw ids containing delimiters, empty strings and missing values
|
|
111
|
+
* distinct without a visible-label sentinel.
|
|
112
|
+
*/
|
|
113
|
+
export function encodeAnalyticsGroupQueryKey(query) {
|
|
114
|
+
const filter = query.filter;
|
|
115
|
+
return encodeIdentityKey([
|
|
116
|
+
query.dimension,
|
|
117
|
+
query.range,
|
|
118
|
+
filter?.dimension ?? null,
|
|
119
|
+
filter?.identity.kind ?? null,
|
|
120
|
+
filter?.identity.kind === "known" ? filter.identity.id : null,
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=analytics-entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-entity.js","sourceRoot":"","sources":["../../src/contracts/analytics-entity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAM5D,OAAO,EAAE,UAAU,EAAE,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0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentation-only card ordering shared by the backend card projection and the
|
|
3
|
+
* Settings/Home surfaces (design spec dashboard visibility).
|
|
4
|
+
*
|
|
5
|
+
* This module is deliberately dependency-free and opaque-id-only: it never
|
|
6
|
+
* interprets an id, never adds or removes a card, and never mutates its input.
|
|
7
|
+
* The caller assembles the real cards first, then asks for a display order, so
|
|
8
|
+
* same-provider siblings are ordered independently.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Returns a fresh card array ordered for presentation.
|
|
12
|
+
*
|
|
13
|
+
* - A non-empty `cardOrder` is authoritative: known listed cards come first in
|
|
14
|
+
* saved order, then every other card in stable input (backend) order. Unknown
|
|
15
|
+
* and duplicate preference ids are ignored.
|
|
16
|
+
* - An absent or empty `cardOrder` falls back to the legacy provider order:
|
|
17
|
+
* providers listed in `providerOrder` come first in saved order, and their
|
|
18
|
+
* cards keep stable input order; unlisted providers keep input order after
|
|
19
|
+
* them. Unknown providers are ignored.
|
|
20
|
+
*/
|
|
21
|
+
export declare function orderCardsByPreference<T extends {
|
|
22
|
+
cardId: string;
|
|
23
|
+
providerId: string;
|
|
24
|
+
}>(cards: readonly T[], cardOrder?: readonly string[], providerOrder?: readonly string[]): T[];
|
|
25
|
+
//# sourceMappingURL=card-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-order.d.ts","sourceRoot":"","sources":["../../src/contracts/card-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA2BH;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EACrF,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,EAC7B,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,GAChC,CAAC,EAAE,CAYL"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Presentation-only card ordering shared by the backend card projection and the
|
|
3
|
+
* Settings/Home surfaces (design spec dashboard visibility).
|
|
4
|
+
*
|
|
5
|
+
* This module is deliberately dependency-free and opaque-id-only: it never
|
|
6
|
+
* interprets an id, never adds or removes a card, and never mutates its input.
|
|
7
|
+
* The caller assembles the real cards first, then asks for a display order, so
|
|
8
|
+
* same-provider siblings are ordered independently.
|
|
9
|
+
*/
|
|
10
|
+
const UNKNOWN_RANK = Number.POSITIVE_INFINITY;
|
|
11
|
+
function rankByIds(preference, knownIds) {
|
|
12
|
+
const ranks = new Map();
|
|
13
|
+
if (preference === undefined)
|
|
14
|
+
return ranks;
|
|
15
|
+
for (const [index, id] of preference.entries()) {
|
|
16
|
+
if (!knownIds.has(id) || ranks.has(id))
|
|
17
|
+
continue;
|
|
18
|
+
ranks.set(id, index);
|
|
19
|
+
}
|
|
20
|
+
return ranks;
|
|
21
|
+
}
|
|
22
|
+
function stableSortByRank(cards, rankOf) {
|
|
23
|
+
return cards
|
|
24
|
+
.map((card, index) => ({ card, index, rank: rankOf(card) }))
|
|
25
|
+
.sort((left, right) => left.rank === right.rank ? left.index - right.index : left.rank - right.rank)
|
|
26
|
+
.map(({ card }) => card);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns a fresh card array ordered for presentation.
|
|
30
|
+
*
|
|
31
|
+
* - A non-empty `cardOrder` is authoritative: known listed cards come first in
|
|
32
|
+
* saved order, then every other card in stable input (backend) order. Unknown
|
|
33
|
+
* and duplicate preference ids are ignored.
|
|
34
|
+
* - An absent or empty `cardOrder` falls back to the legacy provider order:
|
|
35
|
+
* providers listed in `providerOrder` come first in saved order, and their
|
|
36
|
+
* cards keep stable input order; unlisted providers keep input order after
|
|
37
|
+
* them. Unknown providers are ignored.
|
|
38
|
+
*/
|
|
39
|
+
export function orderCardsByPreference(cards, cardOrder, providerOrder) {
|
|
40
|
+
const input = [...cards];
|
|
41
|
+
if (cardOrder !== undefined && cardOrder.length > 0) {
|
|
42
|
+
const cardRanks = rankByIds(cardOrder, new Set(input.map((card) => card.cardId)));
|
|
43
|
+
return stableSortByRank(input, (card) => cardRanks.get(card.cardId) ?? UNKNOWN_RANK);
|
|
44
|
+
}
|
|
45
|
+
const providerRanks = rankByIds(providerOrder, new Set(input.map((card) => card.providerId)));
|
|
46
|
+
if (providerRanks.size === 0)
|
|
47
|
+
return input;
|
|
48
|
+
return stableSortByRank(input, (card) => providerRanks.get(card.providerId) ?? UNKNOWN_RANK);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=card-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-order.js","sourceRoot":"","sources":["../../src/contracts/card-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,YAAY,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAE9C,SAAS,SAAS,CAChB,UAAyC,EACzC,QAA6B;IAE7B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAE3C,KAAK,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,SAAS;QACjD,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,gBAAgB,CAAI,KAAmB,EAAE,MAA2B;IAC3E,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,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AI,YAAY,CAAC,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collision-safe composite keys for raw identities.
|
|
3
|
+
*
|
|
4
|
+
* Every part is self-describing: `u` for missing, `n` for null, and
|
|
5
|
+
* `s<length>:<value>` for a known string. Because values carry their length,
|
|
6
|
+
* no identity can forge a separator or another tuple. This matters at both the
|
|
7
|
+
* pricing-cache and rollup boundaries, where raw provider/model ids may contain
|
|
8
|
+
* any character and a missing id must stay distinct from an empty one.
|
|
9
|
+
*
|
|
10
|
+
* Lives in the contract layer so browser-safe contracts (and the analytics
|
|
11
|
+
* entity codec) never reach into `src/lib`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function encodeIdentityKey(parts: readonly (string | null | undefined)[]): string;
|
|
14
|
+
//# sourceMappingURL=collision-safe-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collision-safe-key.d.ts","sourceRoot":"","sources":["../../src/contracts/collision-safe-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAYvF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collision-safe composite keys for raw identities.
|
|
3
|
+
*
|
|
4
|
+
* Every part is self-describing: `u` for missing, `n` for null, and
|
|
5
|
+
* `s<length>:<value>` for a known string. Because values carry their length,
|
|
6
|
+
* no identity can forge a separator or another tuple. This matters at both the
|
|
7
|
+
* pricing-cache and rollup boundaries, where raw provider/model ids may contain
|
|
8
|
+
* any character and a missing id must stay distinct from an empty one.
|
|
9
|
+
*
|
|
10
|
+
* Lives in the contract layer so browser-safe contracts (and the analytics
|
|
11
|
+
* entity codec) never reach into `src/lib`.
|
|
12
|
+
*/
|
|
13
|
+
export function encodeIdentityKey(parts) {
|
|
14
|
+
let key = "";
|
|
15
|
+
for (const part of parts) {
|
|
16
|
+
if (part === undefined) {
|
|
17
|
+
key += "u;";
|
|
18
|
+
}
|
|
19
|
+
else if (part === null) {
|
|
20
|
+
key += "n;";
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
key += `s${part.length}:${part};`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return key;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=collision-safe-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collision-safe-key.js","sourceRoot":"","sources":["../../src/contracts/collision-safe-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6C;IAC7E,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,GAAG,IAAI,IAAI,CAAC;QACd,CAAC;aAAM,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YACzB,GAAG,IAAI,IAAI,CAAC;QACd,CAAC;aAAM,CAAC;YACN,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,GAAG,CAAC;QACpC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -89,6 +89,143 @@ export interface Usage {
|
|
|
89
89
|
sessionCount: number;
|
|
90
90
|
stale: boolean;
|
|
91
91
|
}
|
|
92
|
+
/** Grouping axis for model/provider analytics. */
|
|
93
|
+
export type AnalyticsDimension = "model" | "provider";
|
|
94
|
+
/**
|
|
95
|
+
* Exact raw identity of one analytics group. `unknown` is an explicit missing
|
|
96
|
+
* identity: it never aliases a known raw id, including the empty string.
|
|
97
|
+
*/
|
|
98
|
+
export type AnalyticsEntityIdentity = {
|
|
99
|
+
kind: "known";
|
|
100
|
+
id: string;
|
|
101
|
+
} | {
|
|
102
|
+
kind: "unknown";
|
|
103
|
+
};
|
|
104
|
+
/** One range bucket boundary shared by every row and series in a grouped snapshot. */
|
|
105
|
+
export interface AnalyticsBucketBoundary {
|
|
106
|
+
startMs: number;
|
|
107
|
+
endMs: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* One grouped model/provider row. A parent groups by the query dimension; its
|
|
111
|
+
* children group the same owned steps by the opposite dimension and are always
|
|
112
|
+
* present when the subtree has usage, including a sole child.
|
|
113
|
+
*
|
|
114
|
+
* Rows intentionally carry totals only. Bucket series live on
|
|
115
|
+
* `AnalyticsSeries`, so output stays bounded by series × buckets instead of
|
|
116
|
+
* (parents + children) × buckets for long lifetimes.
|
|
117
|
+
*/
|
|
118
|
+
export interface AnalyticsGroupRow {
|
|
119
|
+
identity: AnalyticsEntityIdentity;
|
|
120
|
+
/** Subtree totals; token categories equal the sum of the children's. */
|
|
121
|
+
tokens: CostedTokens;
|
|
122
|
+
/** Distinct owning sessions in this subtree (a set union, not a row count). */
|
|
123
|
+
sessionCount: number;
|
|
124
|
+
/** Fork-deduplicated owned steps in this subtree. */
|
|
125
|
+
stepCount: number;
|
|
126
|
+
children: AnalyticsGroupRow[];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* One opposite-dimension contribution inside a chart series bucket. For a
|
|
130
|
+
* model-series bucket, `identity` is a provider; for a provider-series bucket
|
|
131
|
+
* it is a model. The bucket entries are sparse: children with zero usage are
|
|
132
|
+
* omitted, and each child appears at most once per bucket.
|
|
133
|
+
*/
|
|
134
|
+
export interface AnalyticsSeriesChildBucket {
|
|
135
|
+
identity: AnalyticsEntityIdentity;
|
|
136
|
+
tokens: CostedTokens;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* One hidden same-dimension parent's additive share inside an Other bucket.
|
|
140
|
+
* The shape matches `AnalyticsSeriesChildBucket`; only `identity` differs: it
|
|
141
|
+
* uses the snapshot's own dimension (models when grouping by model). Entries
|
|
142
|
+
* are sparse and unique per bucket, so Other's composition is inspectable
|
|
143
|
+
* without a dense hidden-parent × bucket matrix.
|
|
144
|
+
*/
|
|
145
|
+
export type AnalyticsSeriesParentBucket = AnalyticsSeriesChildBucket;
|
|
146
|
+
/**
|
|
147
|
+
* One chart series for the visible grouping level, ranked by selected-range
|
|
148
|
+
* token volume. The trailing `"other"` series aggregates every entity outside
|
|
149
|
+
* the top five; it is chart-only and never replaces the breakdown rows.
|
|
150
|
+
*/
|
|
151
|
+
export type AnalyticsSeries = {
|
|
152
|
+
kind: "entity";
|
|
153
|
+
identity: AnalyticsEntityIdentity;
|
|
154
|
+
tokens: CostedTokens;
|
|
155
|
+
/** Aligned index-for-index with `AnalyticsGroupSnapshot.buckets`. */
|
|
156
|
+
buckets: CostedTokens[];
|
|
157
|
+
/**
|
|
158
|
+
* Additive in-bar subdivision: the opposite-dimension children inside
|
|
159
|
+
* each bucket, aligned index-for-index with `buckets`. Token categories,
|
|
160
|
+
* unpriced tokens, and unknown tokens conserve that same-index bucket;
|
|
161
|
+
* numeric cost also conserves it subject to floating-point rounding.
|
|
162
|
+
* This host always emits it for a series with
|
|
163
|
+
* usage; it is optional so older snapshots and readers remain compatible.
|
|
164
|
+
*/
|
|
165
|
+
childBuckets?: AnalyticsSeriesChildBucket[][];
|
|
166
|
+
} | {
|
|
167
|
+
kind: "other";
|
|
168
|
+
tokens: CostedTokens;
|
|
169
|
+
buckets: CostedTokens[];
|
|
170
|
+
/**
|
|
171
|
+
* Real children of every parent outside the top five, aggregated by exact
|
|
172
|
+
* child identity per bucket — never a remainder derived from a total.
|
|
173
|
+
*/
|
|
174
|
+
childBuckets?: AnalyticsSeriesChildBucket[][];
|
|
175
|
+
/**
|
|
176
|
+
* Sparse hidden same-dimension parents aggregated into Other, aligned
|
|
177
|
+
* index-for-index with `buckets`. Each entry is one exact raw parent
|
|
178
|
+
* identity with its real bucket tokens (token categories, cost status,
|
|
179
|
+
* unpriced and unknown counts), so inspection needs no row rescan and no
|
|
180
|
+
* hidden-parent × bucket dense array. Only Other carries this field.
|
|
181
|
+
*/
|
|
182
|
+
parentBuckets?: AnalyticsSeriesParentBucket[][];
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Exact entity selector for a grouped query. `dimension` names the entity kind
|
|
186
|
+
* independently of the query's grouping dimension, so a model detail query can
|
|
187
|
+
* group by provider while filtering one model (and vice versa).
|
|
188
|
+
*/
|
|
189
|
+
export interface AnalyticsGroupFilter {
|
|
190
|
+
dimension: AnalyticsDimension;
|
|
191
|
+
identity: AnalyticsEntityIdentity;
|
|
192
|
+
}
|
|
193
|
+
/** Input for one grouped model/provider query. */
|
|
194
|
+
export interface AnalyticsGroupQuery {
|
|
195
|
+
range: RangeKey;
|
|
196
|
+
dimension: AnalyticsDimension;
|
|
197
|
+
/**
|
|
198
|
+
* Optional exact entity filter, matched by both its entity dimension and its
|
|
199
|
+
* identity kind + raw id. A known empty/whitespace/delimiter-bearing id never
|
|
200
|
+
* matches `unknown`. No usage in range yields zero totals and empty
|
|
201
|
+
* rows/series; the echoed `filter` still identifies the selection.
|
|
202
|
+
*/
|
|
203
|
+
filter?: AnalyticsGroupFilter;
|
|
204
|
+
}
|
|
205
|
+
/** One range-certified grouped model/provider snapshot. */
|
|
206
|
+
export interface AnalyticsGroupSnapshot {
|
|
207
|
+
dimension: AnalyticsDimension;
|
|
208
|
+
range: RangeKey;
|
|
209
|
+
window: RangeWindow;
|
|
210
|
+
bucketUnit: BucketUnit;
|
|
211
|
+
timeZone: string;
|
|
212
|
+
/** Echo of the applied query filter; absent for an unfiltered query. */
|
|
213
|
+
filter?: AnalyticsGroupFilter;
|
|
214
|
+
/** Range bucket boundaries; every series bucket aligns by index. */
|
|
215
|
+
buckets: AnalyticsBucketBoundary[];
|
|
216
|
+
totals: CostedTokens;
|
|
217
|
+
sessionCount: number;
|
|
218
|
+
stepCount: number;
|
|
219
|
+
rows: AnalyticsGroupRow[];
|
|
220
|
+
/**
|
|
221
|
+
* Top five `rows` by selected-range token volume plus Other, for both
|
|
222
|
+
* filtered and unfiltered queries. Only these series carry bucket arrays and
|
|
223
|
+
* per-bucket breakdowns; Other additionally carries its hidden
|
|
224
|
+
* same-dimension parent breakdown.
|
|
225
|
+
*/
|
|
226
|
+
series: AnalyticsSeries[];
|
|
227
|
+
stale: boolean;
|
|
228
|
+
}
|
|
92
229
|
export interface QuotaCardRow {
|
|
93
230
|
rowId: RowId;
|
|
94
231
|
label: string;
|
|
@@ -125,8 +262,18 @@ export interface ProviderCard {
|
|
|
125
262
|
cardId: CardId;
|
|
126
263
|
providerId: string;
|
|
127
264
|
providerLabel: string;
|
|
265
|
+
/** Display-only plan shown before the account; never an identity input. */
|
|
266
|
+
planLabel?: string;
|
|
128
267
|
accountLabel?: string;
|
|
129
268
|
labelSource: "connection" | "org" | "account" | "provider";
|
|
269
|
+
/**
|
|
270
|
+
* Additive presentation metadata (optional for backwards compatibility): the
|
|
271
|
+
* provider-scope card id for this card's provider and its bare hash form.
|
|
272
|
+
* Settings uses these authoritative opaque values to recognize legacy
|
|
273
|
+
* provider-wide hides without hashing or reconstructing identities.
|
|
274
|
+
*/
|
|
275
|
+
providerScopeId?: CardId;
|
|
276
|
+
providerScopeHash?: string;
|
|
130
277
|
rows: QuotaCardRow[];
|
|
131
278
|
errors: {
|
|
132
279
|
label: string;
|
|
@@ -332,6 +479,8 @@ export interface DashboardDataSource {
|
|
|
332
479
|
session(input: {
|
|
333
480
|
sessionId: string;
|
|
334
481
|
}): Promise<SessionSnapshot>;
|
|
482
|
+
/** Range-certified grouped model/provider analytics (one exact query). */
|
|
483
|
+
groups(input: AnalyticsGroupQuery): Promise<AnalyticsGroupSnapshot>;
|
|
335
484
|
settings(): Promise<SettingsSnapshot>;
|
|
336
485
|
saveSettings(input: {
|
|
337
486
|
patch: Record<string, JsonValue>;
|