opencode-quota-gui 1.2.0 → 1.3.1
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 +104 -34
- package/dist/contracts/analytics-entity.d.ts +6 -1
- package/dist/contracts/analytics-entity.js +27 -10
- package/dist/contracts/build-identity.js +1 -1
- package/dist/contracts/card-visibility.d.ts +21 -0
- package/dist/contracts/card-visibility.js +19 -0
- package/dist/contracts/dashboard.d.ts +35 -1
- package/dist/contracts/dashboard.js +2 -0
- package/dist/contracts/dto-guards.d.ts +24 -0
- package/dist/contracts/dto-guards.js +594 -0
- package/dist/contracts/openai-quota.d.ts +3 -0
- package/dist/contracts/openai-quota.js +3 -0
- package/dist/contracts/provider-failure.d.ts +18 -0
- package/dist/contracts/provider-failure.js +25 -0
- package/dist/data/modelsdev-temporal.min.json +57 -0
- package/dist/gui/config.d.ts +20 -3
- package/dist/gui/config.js +72 -4
- package/dist/gui/dashboard-errors.d.ts +32 -0
- package/dist/gui/dashboard-errors.js +97 -0
- package/dist/gui/lifecycle.d.ts +47 -12
- package/dist/gui/lifecycle.js +215 -37
- package/dist/gui/primary-quota-windows.d.ts +28 -0
- package/dist/gui/primary-quota-windows.js +149 -0
- package/dist/gui/provider-cards.d.ts +11 -3
- package/dist/gui/provider-cards.js +85 -33
- package/dist/gui/quota-notification-detector.d.ts +151 -0
- package/dist/gui/quota-notification-detector.js +318 -0
- package/dist/gui/quota-notification-observer.d.ts +54 -0
- package/dist/gui/quota-notification-observer.js +412 -0
- package/dist/gui/rpc.d.ts +61 -0
- package/dist/gui/rpc.js +310 -0
- package/dist/gui/server.d.ts +15 -27
- package/dist/gui/server.js +34 -123
- package/dist/gui/snapshot-service.d.ts +34 -5
- package/dist/gui/snapshot-service.js +301 -70
- package/dist/gui/sources.d.ts +1 -1
- package/dist/gui/sources.js +98 -56
- package/dist/gui-experimental.cjs +1761 -0
- package/dist/lib/accounting-format.js +8 -0
- package/dist/lib/alibaba-coding-plan-cli.d.ts +79 -0
- package/dist/lib/alibaba-coding-plan-cli.js +539 -0
- package/dist/lib/anthropic-auth.d.ts +2 -3
- package/dist/lib/anthropic-auth.js +2 -3
- package/dist/lib/anthropic.d.ts +53 -12
- package/dist/lib/anthropic.js +622 -270
- package/dist/lib/api-key-retry-after.d.ts +7 -0
- package/dist/lib/api-key-retry-after.js +62 -0
- package/dist/lib/atomic-json.d.ts +2 -0
- package/dist/lib/atomic-json.js +1 -0
- package/dist/lib/cache-observer-ingestion.d.ts +90 -0
- package/dist/lib/cache-observer-ingestion.js +981 -0
- package/dist/lib/cache-observer.d.ts +138 -0
- package/dist/lib/cache-observer.js +317 -0
- package/dist/lib/canonical-config-lock.d.ts +9 -0
- package/dist/lib/canonical-config-lock.js +36 -0
- package/dist/lib/chutes.js +63 -35
- package/dist/lib/claude-agent-transcript-ttl.d.ts +48 -0
- package/dist/lib/claude-agent-transcript-ttl.js +154 -0
- package/dist/lib/claude-agent-ttl-tracker.d.ts +21 -0
- package/dist/lib/claude-agent-ttl-tracker.js +152 -0
- package/dist/lib/cli-show.js +5 -3
- package/dist/lib/config-write-target.d.ts +1 -1
- package/dist/lib/config-write-target.js +5 -2
- package/dist/lib/config.d.ts +6 -1
- package/dist/lib/config.js +241 -2
- package/dist/lib/copilot.js +198 -85
- package/dist/lib/dashboard-web-policy.d.ts +35 -0
- package/dist/lib/dashboard-web-policy.js +24 -0
- package/dist/lib/deepseek.js +34 -11
- package/dist/lib/display-sanitize.js +3 -0
- package/dist/lib/entries.d.ts +26 -0
- package/dist/lib/entries.js +2 -0
- package/dist/lib/format-utils.d.ts +1 -1
- package/dist/lib/format-utils.js +2 -2
- package/dist/lib/glm-coding-plan.js +102 -68
- package/dist/lib/google-agy.js +147 -24
- package/dist/lib/google-gemini-cli.js +140 -23
- package/dist/lib/http.d.ts +4 -0
- package/dist/lib/http.js +16 -2
- package/dist/lib/init-installer.js +30 -7
- package/dist/lib/kilo.js +63 -55
- package/dist/lib/kimi.js +43 -14
- package/dist/lib/mimo.d.ts +4 -0
- package/dist/lib/mimo.js +45 -1
- package/dist/lib/nanogpt.d.ts +3 -0
- package/dist/lib/nanogpt.js +50 -6
- package/dist/lib/ollama-cloud.d.ts +1 -1
- package/dist/lib/ollama-cloud.js +51 -29
- package/dist/lib/openai.js +90 -40
- package/dist/lib/opencode-auth-sqlite.d.ts +2 -2
- package/dist/lib/opencode-auth-sqlite.js +2 -2
- package/dist/lib/opencode-auth.d.ts +3 -2
- package/dist/lib/opencode-auth.js +8 -1
- package/dist/lib/opencode-config-editor.d.ts +1 -0
- package/dist/lib/opencode-config-editor.js +6 -1
- package/dist/lib/opencode-go.js +53 -5
- package/dist/lib/opencode-version-core.d.ts +23 -0
- package/dist/lib/opencode-version-core.js +49 -0
- package/dist/lib/opencode-version.d.ts +4 -3
- package/dist/lib/opencode-version.js +15 -11
- package/dist/lib/opencode-zen.d.ts +12 -1
- package/dist/lib/opencode-zen.js +98 -12
- package/dist/lib/provider-add.js +5 -2
- package/dist/lib/provider-registration.d.ts +19 -9
- package/dist/lib/provider-registration.js +17 -6
- package/dist/lib/quota-command-format.js +1 -1
- package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
- package/dist/lib/quota-exhaustion-projection.js +25 -0
- package/dist/lib/quota-providers-remote.d.ts +4 -1
- package/dist/lib/quota-providers-remote.js +137 -22
- package/dist/lib/quota-providers.d.ts +1 -1
- package/dist/lib/quota-providers.js +12 -35
- package/dist/lib/quota-render-data.d.ts +6 -0
- package/dist/lib/quota-render-data.js +43 -17
- package/dist/lib/quota-reset-notifications.d.ts +17 -0
- package/dist/lib/quota-reset-notifications.js +11 -2
- package/dist/lib/quota-state-codec.js +19 -1
- package/dist/lib/quota-state.d.ts +7 -1
- package/dist/lib/quota-state.js +208 -34
- package/dist/lib/quota-stats.js +21 -0
- package/dist/lib/quota-status.js +3 -51
- package/dist/lib/scoped-update.d.ts +1 -1
- package/dist/lib/synthetic.js +67 -48
- package/dist/lib/types.d.ts +49 -1
- package/dist/lib/types.js +16 -0
- package/dist/lib/xai.js +64 -24
- package/dist/plugin.d.ts +4 -3
- package/dist/plugin.js +293 -16
- package/dist/provider-logos/NOTICE.md +1 -1
- package/dist/provider-logos/OPENCODE-NOTICE.md +4 -3
- package/dist/providers/alibaba-coding-plan.js +107 -102
- package/dist/providers/alibaba-token-plan.js +17 -0
- package/dist/providers/anthropic.d.ts +12 -3
- package/dist/providers/anthropic.js +71 -219
- package/dist/providers/cache-policies.d.ts +11 -4
- package/dist/providers/cache-policies.js +19 -13
- package/dist/providers/claude-agent.d.ts +19 -0
- package/dist/providers/claude-agent.js +196 -0
- package/dist/providers/copilot.js +12 -2
- package/dist/providers/glm-coding-plan-provider.d.ts +3 -0
- package/dist/providers/glm-coding-plan-provider.js +5 -1
- package/dist/providers/google-account-format.js +2 -0
- package/dist/providers/google-agy.d.ts +6 -5
- package/dist/providers/google-agy.js +55 -17
- package/dist/providers/google-gemini-cli.js +13 -2
- package/dist/providers/kilo.js +10 -1
- package/dist/providers/kimi-code.js +13 -6
- package/dist/providers/mimo.js +9 -2
- package/dist/providers/minimax-coding-plan.js +28 -5
- package/dist/providers/nanogpt.js +4 -0
- package/dist/providers/ollama-cloud.js +3 -0
- package/dist/providers/openai.js +1 -0
- package/dist/providers/opencode-go.js +11 -1
- package/dist/providers/opencode-zen.js +32 -3
- package/dist/providers/openrouter.js +4 -0
- package/dist/providers/quota-providers.js +46 -9
- package/dist/providers/registry.js +2 -0
- package/dist/providers/result-helpers.d.ts +6 -0
- package/dist/providers/result-helpers.js +18 -2
- package/dist/rpc.d.ts +440 -4
- package/dist/rpc.js +507 -2
- package/dist/ui/assets/{index-Cs-nrywz.css → index-BcueIm3Z.css} +1 -1
- package/dist/ui/assets/index-C6qRSoh8.js +10 -0
- package/dist/ui/assets/{popover-DKRrwr_K.js → popover-4bFSvRZ7.js} +1 -1
- package/dist/ui/assets/providers/claude-agent.svg +3 -0
- package/dist/ui/index.html +2 -2
- package/package.json +15 -7
- package/dist/bin/opencode-quota-gui.d.ts.map +0 -1
- package/dist/bin/opencode-quota-gui.js.map +0 -1
- package/dist/contracts/analytics-entity.d.ts.map +0 -1
- package/dist/contracts/analytics-entity.js.map +0 -1
- package/dist/contracts/analytics-temporal.d.ts.map +0 -1
- package/dist/contracts/analytics-temporal.js.map +0 -1
- package/dist/contracts/build-identity.d.ts.map +0 -1
- package/dist/contracts/card-order.d.ts.map +0 -1
- package/dist/contracts/card-order.js.map +0 -1
- package/dist/contracts/collision-safe-key.d.ts.map +0 -1
- package/dist/contracts/collision-safe-key.js.map +0 -1
- package/dist/contracts/dashboard.d.ts.map +0 -1
- package/dist/contracts/dashboard.js.map +0 -1
- package/dist/contracts/guards.d.ts.map +0 -1
- package/dist/contracts/guards.js.map +0 -1
- package/dist/contracts/identity.d.ts.map +0 -1
- package/dist/contracts/identity.js.map +0 -1
- package/dist/contracts/openai-quota.d.ts.map +0 -1
- package/dist/contracts/openai-quota.js.map +0 -1
- package/dist/contracts/ranges.d.ts.map +0 -1
- package/dist/contracts/ranges.js.map +0 -1
- package/dist/contracts/settings.d.ts.map +0 -1
- package/dist/contracts/settings.js.map +0 -1
- package/dist/contracts/temporal.d.ts.map +0 -1
- package/dist/contracts/temporal.js.map +0 -1
- package/dist/contracts/time-zone.d.ts.map +0 -1
- package/dist/contracts/time-zone.js.map +0 -1
- package/dist/gui/aggregation.d.ts.map +0 -1
- package/dist/gui/aggregation.js.map +0 -1
- package/dist/gui/analytics-bridge.d.ts.map +0 -1
- package/dist/gui/analytics-bridge.js.map +0 -1
- package/dist/gui/analytics-engine.d.ts.map +0 -1
- package/dist/gui/analytics-engine.js.map +0 -1
- package/dist/gui/analytics-indexes.d.ts.map +0 -1
- package/dist/gui/analytics-indexes.js.map +0 -1
- package/dist/gui/analytics-model.d.ts.map +0 -1
- package/dist/gui/analytics-model.js.map +0 -1
- package/dist/gui/analytics-pricing-revision.d.ts.map +0 -1
- package/dist/gui/analytics-pricing-revision.js.map +0 -1
- package/dist/gui/analytics-protocol.d.ts.map +0 -1
- package/dist/gui/analytics-protocol.js.map +0 -1
- package/dist/gui/analytics-reader.d.ts.map +0 -1
- package/dist/gui/analytics-reader.js.map +0 -1
- package/dist/gui/analytics-service.d.ts.map +0 -1
- package/dist/gui/analytics-service.js.map +0 -1
- package/dist/gui/analytics-state.d.ts.map +0 -1
- package/dist/gui/analytics-state.js.map +0 -1
- package/dist/gui/analytics-worker-runtime.d.ts.map +0 -1
- package/dist/gui/analytics-worker-runtime.js.map +0 -1
- package/dist/gui/analytics-worker.d.ts.map +0 -1
- package/dist/gui/analytics-worker.js.map +0 -1
- package/dist/gui/config.d.ts.map +0 -1
- package/dist/gui/config.js.map +0 -1
- package/dist/gui/identity.d.ts.map +0 -1
- package/dist/gui/identity.js.map +0 -1
- package/dist/gui/lifecycle.d.ts.map +0 -1
- package/dist/gui/lifecycle.js.map +0 -1
- package/dist/gui/log.d.ts.map +0 -1
- package/dist/gui/log.js.map +0 -1
- package/dist/gui/provider-cards.d.ts.map +0 -1
- package/dist/gui/provider-cards.js.map +0 -1
- package/dist/gui/server.d.ts.map +0 -1
- package/dist/gui/server.js.map +0 -1
- package/dist/gui/settings-file-opener.d.ts.map +0 -1
- package/dist/gui/settings-file-opener.js.map +0 -1
- package/dist/gui/snapshot-service.d.ts.map +0 -1
- package/dist/gui/snapshot-service.js.map +0 -1
- package/dist/gui/sources.d.ts.map +0 -1
- package/dist/gui/sources.js.map +0 -1
- package/dist/gui/sse.d.ts.map +0 -1
- package/dist/gui/sse.js.map +0 -1
- package/dist/gui/temporal-quota-policy-data.d.ts.map +0 -1
- package/dist/gui/temporal-quota-policy-data.js.map +0 -1
- package/dist/gui/temporal-quota-policy.d.ts.map +0 -1
- package/dist/gui/temporal-quota-policy.js.map +0 -1
- package/dist/gui/temporal-status.d.ts.map +0 -1
- package/dist/gui/temporal-status.js.map +0 -1
- package/dist/gui/time-zone.d.ts.map +0 -1
- package/dist/gui/time-zone.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/accounting-format.d.ts.map +0 -1
- package/dist/lib/accounting-format.js.map +0 -1
- package/dist/lib/alibaba-auth.d.ts.map +0 -1
- package/dist/lib/alibaba-auth.js.map +0 -1
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts +0 -47
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts.map +0 -1
- package/dist/lib/alibaba-coding-plan-local-quota.js +0 -146
- package/dist/lib/alibaba-coding-plan-local-quota.js.map +0 -1
- package/dist/lib/alibaba-token-plan.d.ts.map +0 -1
- package/dist/lib/alibaba-token-plan.js.map +0 -1
- package/dist/lib/anthropic-auth.d.ts.map +0 -1
- package/dist/lib/anthropic-auth.js.map +0 -1
- package/dist/lib/anthropic.d.ts.map +0 -1
- package/dist/lib/anthropic.js.map +0 -1
- package/dist/lib/api-key-resolver.d.ts.map +0 -1
- package/dist/lib/api-key-resolver.js.map +0 -1
- package/dist/lib/atomic-json.d.ts.map +0 -1
- package/dist/lib/atomic-json.js.map +0 -1
- package/dist/lib/chutes-config.d.ts.map +0 -1
- package/dist/lib/chutes-config.js.map +0 -1
- package/dist/lib/chutes.d.ts.map +0 -1
- package/dist/lib/chutes.js.map +0 -1
- package/dist/lib/cli-reports.d.ts.map +0 -1
- package/dist/lib/cli-reports.js.map +0 -1
- package/dist/lib/cli-show.d.ts.map +0 -1
- package/dist/lib/cli-show.js.map +0 -1
- package/dist/lib/cli-status.d.ts.map +0 -1
- package/dist/lib/cli-status.js.map +0 -1
- package/dist/lib/command-parsing.d.ts.map +0 -1
- package/dist/lib/command-parsing.js.map +0 -1
- package/dist/lib/config-file-utils.d.ts.map +0 -1
- package/dist/lib/config-file-utils.js.map +0 -1
- package/dist/lib/config-write-target.d.ts.map +0 -1
- package/dist/lib/config-write-target.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/copilot.d.ts.map +0 -1
- package/dist/lib/copilot.js.map +0 -1
- package/dist/lib/cursor-detection.d.ts.map +0 -1
- package/dist/lib/cursor-detection.js.map +0 -1
- package/dist/lib/cursor-pricing.d.ts.map +0 -1
- package/dist/lib/cursor-pricing.js.map +0 -1
- package/dist/lib/cursor-usage.d.ts.map +0 -1
- package/dist/lib/cursor-usage.js.map +0 -1
- package/dist/lib/dashboard-visibility.d.ts.map +0 -1
- package/dist/lib/dashboard-visibility.js.map +0 -1
- package/dist/lib/deepseek-auth.d.ts.map +0 -1
- package/dist/lib/deepseek-auth.js.map +0 -1
- package/dist/lib/deepseek.d.ts.map +0 -1
- package/dist/lib/deepseek.js.map +0 -1
- package/dist/lib/display-sanitize.d.ts.map +0 -1
- package/dist/lib/display-sanitize.js.map +0 -1
- package/dist/lib/entries.d.ts.map +0 -1
- package/dist/lib/entries.js.map +0 -1
- package/dist/lib/env-template.d.ts.map +0 -1
- package/dist/lib/env-template.js.map +0 -1
- package/dist/lib/format-utils.d.ts.map +0 -1
- package/dist/lib/format-utils.js.map +0 -1
- package/dist/lib/format.d.ts.map +0 -1
- package/dist/lib/format.js.map +0 -1
- package/dist/lib/glm-coding-plan.d.ts.map +0 -1
- package/dist/lib/glm-coding-plan.js.map +0 -1
- package/dist/lib/google-agy-companion.d.ts.map +0 -1
- package/dist/lib/google-agy-companion.js.map +0 -1
- package/dist/lib/google-agy.d.ts.map +0 -1
- package/dist/lib/google-agy.js.map +0 -1
- package/dist/lib/google-companion-credentials.d.ts.map +0 -1
- package/dist/lib/google-companion-credentials.js.map +0 -1
- package/dist/lib/google-gemini-cli-companion.d.ts.map +0 -1
- package/dist/lib/google-gemini-cli-companion.js.map +0 -1
- package/dist/lib/google-gemini-cli.d.ts.map +0 -1
- package/dist/lib/google-gemini-cli.js.map +0 -1
- package/dist/lib/google-token-cache.d.ts.map +0 -1
- package/dist/lib/google-token-cache.js.map +0 -1
- package/dist/lib/grouped-entry-normalization.d.ts.map +0 -1
- package/dist/lib/grouped-entry-normalization.js.map +0 -1
- package/dist/lib/grouped-header-format.d.ts.map +0 -1
- package/dist/lib/grouped-header-format.js.map +0 -1
- package/dist/lib/gui-config-target.d.ts.map +0 -1
- package/dist/lib/gui-config-target.js.map +0 -1
- package/dist/lib/home-dir-display.d.ts.map +0 -1
- package/dist/lib/home-dir-display.js.map +0 -1
- package/dist/lib/http.d.ts.map +0 -1
- package/dist/lib/http.js.map +0 -1
- package/dist/lib/init-installer.d.ts.map +0 -1
- package/dist/lib/init-installer.js.map +0 -1
- package/dist/lib/jsonc.d.ts.map +0 -1
- package/dist/lib/jsonc.js.map +0 -1
- package/dist/lib/kilo-config.d.ts.map +0 -1
- package/dist/lib/kilo-config.js.map +0 -1
- package/dist/lib/kilo.d.ts.map +0 -1
- package/dist/lib/kilo.js.map +0 -1
- package/dist/lib/kimi-auth.d.ts.map +0 -1
- package/dist/lib/kimi-auth.js.map +0 -1
- package/dist/lib/kimi-endpoints.d.ts.map +0 -1
- package/dist/lib/kimi-endpoints.js.map +0 -1
- package/dist/lib/kimi.d.ts.map +0 -1
- package/dist/lib/kimi.js.map +0 -1
- package/dist/lib/maintainer-announcements.d.ts.map +0 -1
- package/dist/lib/maintainer-announcements.js.map +0 -1
- package/dist/lib/map-with-concurrency.d.ts.map +0 -1
- package/dist/lib/map-with-concurrency.js.map +0 -1
- package/dist/lib/markdown-table.d.ts.map +0 -1
- package/dist/lib/markdown-table.js.map +0 -1
- package/dist/lib/mimo-config.d.ts.map +0 -1
- package/dist/lib/mimo-config.js.map +0 -1
- package/dist/lib/mimo.d.ts.map +0 -1
- package/dist/lib/mimo.js.map +0 -1
- package/dist/lib/minimax-auth.d.ts.map +0 -1
- package/dist/lib/minimax-auth.js.map +0 -1
- package/dist/lib/minimax-endpoints.d.ts.map +0 -1
- package/dist/lib/minimax-endpoints.js.map +0 -1
- package/dist/lib/modelsdev-pricing.d.ts.map +0 -1
- package/dist/lib/modelsdev-pricing.js.map +0 -1
- package/dist/lib/modelsdev-temporal.d.ts.map +0 -1
- package/dist/lib/modelsdev-temporal.js.map +0 -1
- package/dist/lib/nanogpt-config.d.ts.map +0 -1
- package/dist/lib/nanogpt-config.js.map +0 -1
- package/dist/lib/nanogpt.d.ts.map +0 -1
- package/dist/lib/nanogpt.js.map +0 -1
- package/dist/lib/ollama-cloud-config.d.ts.map +0 -1
- package/dist/lib/ollama-cloud-config.js.map +0 -1
- package/dist/lib/ollama-cloud.d.ts.map +0 -1
- package/dist/lib/ollama-cloud.js.map +0 -1
- package/dist/lib/openai.d.ts.map +0 -1
- package/dist/lib/openai.js.map +0 -1
- package/dist/lib/opencode-auth-sqlite.d.ts.map +0 -1
- package/dist/lib/opencode-auth-sqlite.js.map +0 -1
- package/dist/lib/opencode-auth.d.ts.map +0 -1
- package/dist/lib/opencode-auth.js.map +0 -1
- package/dist/lib/opencode-config-editor.d.ts.map +0 -1
- package/dist/lib/opencode-config-editor.js.map +0 -1
- package/dist/lib/opencode-config-providers.d.ts.map +0 -1
- package/dist/lib/opencode-config-providers.js.map +0 -1
- package/dist/lib/opencode-config-read.d.ts.map +0 -1
- package/dist/lib/opencode-config-read.js.map +0 -1
- package/dist/lib/opencode-console-auth.d.ts.map +0 -1
- package/dist/lib/opencode-console-auth.js.map +0 -1
- package/dist/lib/opencode-db-path.d.ts.map +0 -1
- package/dist/lib/opencode-db-path.js.map +0 -1
- package/dist/lib/opencode-go-auth.d.ts.map +0 -1
- package/dist/lib/opencode-go-auth.js.map +0 -1
- package/dist/lib/opencode-go.d.ts.map +0 -1
- package/dist/lib/opencode-go.js.map +0 -1
- package/dist/lib/opencode-runtime-paths.d.ts.map +0 -1
- package/dist/lib/opencode-runtime-paths.js.map +0 -1
- package/dist/lib/opencode-sqlite.d.ts.map +0 -1
- package/dist/lib/opencode-sqlite.js.map +0 -1
- package/dist/lib/opencode-storage.d.ts.map +0 -1
- package/dist/lib/opencode-storage.js.map +0 -1
- package/dist/lib/opencode-version.d.ts.map +0 -1
- package/dist/lib/opencode-version.js.map +0 -1
- package/dist/lib/opencode-zen.d.ts.map +0 -1
- package/dist/lib/opencode-zen.js.map +0 -1
- package/dist/lib/openrouter.d.ts.map +0 -1
- package/dist/lib/openrouter.js.map +0 -1
- package/dist/lib/private-state-paths.d.ts.map +0 -1
- package/dist/lib/private-state-paths.js.map +0 -1
- package/dist/lib/provider-add-command.d.ts.map +0 -1
- package/dist/lib/provider-add-command.js.map +0 -1
- package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +0 -1
- package/dist/lib/provider-add-json-v1-questionnaire.js.map +0 -1
- package/dist/lib/provider-add.d.ts.map +0 -1
- package/dist/lib/provider-add.js.map +0 -1
- package/dist/lib/provider-availability.d.ts.map +0 -1
- package/dist/lib/provider-availability.js.map +0 -1
- package/dist/lib/provider-metadata.d.ts.map +0 -1
- package/dist/lib/provider-metadata.js.map +0 -1
- package/dist/lib/provider-model-matching.d.ts.map +0 -1
- package/dist/lib/provider-model-matching.js.map +0 -1
- package/dist/lib/provider-registration.d.ts.map +0 -1
- package/dist/lib/provider-registration.js.map +0 -1
- package/dist/lib/quota-accounting-projection.d.ts.map +0 -1
- package/dist/lib/quota-accounting-projection.js.map +0 -1
- package/dist/lib/quota-columns.d.ts.map +0 -1
- package/dist/lib/quota-columns.js.map +0 -1
- package/dist/lib/quota-command-format.d.ts.map +0 -1
- package/dist/lib/quota-command-format.js.map +0 -1
- package/dist/lib/quota-dialog-command-specs.d.ts.map +0 -1
- package/dist/lib/quota-dialog-command-specs.js.map +0 -1
- package/dist/lib/quota-dialog-commands.d.ts.map +0 -1
- package/dist/lib/quota-dialog-commands.js.map +0 -1
- package/dist/lib/quota-entry-display.d.ts.map +0 -1
- package/dist/lib/quota-entry-display.js.map +0 -1
- package/dist/lib/quota-exhaustion-projection.d.ts.map +0 -1
- package/dist/lib/quota-exhaustion-projection.js.map +0 -1
- package/dist/lib/quota-export-types.d.ts.map +0 -1
- package/dist/lib/quota-export-types.js.map +0 -1
- package/dist/lib/quota-export.d.ts.map +0 -1
- package/dist/lib/quota-export.js.map +0 -1
- package/dist/lib/quota-format-style.d.ts.map +0 -1
- package/dist/lib/quota-format-style.js.map +0 -1
- package/dist/lib/quota-providers-local.d.ts.map +0 -1
- package/dist/lib/quota-providers-local.js.map +0 -1
- package/dist/lib/quota-providers-remote.d.ts.map +0 -1
- package/dist/lib/quota-providers-remote.js.map +0 -1
- package/dist/lib/quota-providers.d.ts.map +0 -1
- package/dist/lib/quota-providers.js.map +0 -1
- package/dist/lib/quota-render-data.d.ts.map +0 -1
- package/dist/lib/quota-render-data.js.map +0 -1
- package/dist/lib/quota-report-message.d.ts.map +0 -1
- package/dist/lib/quota-report-message.js.map +0 -1
- package/dist/lib/quota-reset-notifications.d.ts.map +0 -1
- package/dist/lib/quota-reset-notifications.js.map +0 -1
- package/dist/lib/quota-retry-wait.d.ts.map +0 -1
- package/dist/lib/quota-retry-wait.js.map +0 -1
- package/dist/lib/quota-runtime-context.d.ts.map +0 -1
- package/dist/lib/quota-runtime-context.js.map +0 -1
- package/dist/lib/quota-state-codec.d.ts.map +0 -1
- package/dist/lib/quota-state-codec.js.map +0 -1
- package/dist/lib/quota-state.d.ts.map +0 -1
- package/dist/lib/quota-state.js.map +0 -1
- package/dist/lib/quota-stats-format.d.ts.map +0 -1
- package/dist/lib/quota-stats-format.js.map +0 -1
- package/dist/lib/quota-stats.d.ts.map +0 -1
- package/dist/lib/quota-stats.js.map +0 -1
- package/dist/lib/quota-status.d.ts.map +0 -1
- package/dist/lib/quota-status.js.map +0 -1
- package/dist/lib/quota-surface-data.d.ts.map +0 -1
- package/dist/lib/quota-surface-data.js.map +0 -1
- package/dist/lib/quota-telemetry.d.ts.map +0 -1
- package/dist/lib/quota-telemetry.js.map +0 -1
- package/dist/lib/report-document.d.ts.map +0 -1
- package/dist/lib/report-document.js.map +0 -1
- package/dist/lib/resolved-auth-identity.d.ts.map +0 -1
- package/dist/lib/resolved-auth-identity.js.map +0 -1
- package/dist/lib/runtime-provider-ids.d.ts.map +0 -1
- package/dist/lib/runtime-provider-ids.js.map +0 -1
- package/dist/lib/scoped-query-chunks.d.ts.map +0 -1
- package/dist/lib/scoped-query-chunks.js.map +0 -1
- package/dist/lib/scoped-update-migration.d.ts.map +0 -1
- package/dist/lib/scoped-update-migration.js.map +0 -1
- package/dist/lib/scoped-update.d.ts.map +0 -1
- package/dist/lib/scoped-update.js.map +0 -1
- package/dist/lib/session-tokens-format.d.ts.map +0 -1
- package/dist/lib/session-tokens-format.js.map +0 -1
- package/dist/lib/session-tokens.d.ts.map +0 -1
- package/dist/lib/session-tokens.js.map +0 -1
- package/dist/lib/synthetic-config.d.ts.map +0 -1
- package/dist/lib/synthetic-config.js.map +0 -1
- package/dist/lib/synthetic.d.ts.map +0 -1
- package/dist/lib/synthetic.js.map +0 -1
- package/dist/lib/toast-format-grouped.d.ts.map +0 -1
- package/dist/lib/toast-format-grouped.js.map +0 -1
- package/dist/lib/token-buckets.d.ts.map +0 -1
- package/dist/lib/token-buckets.js.map +0 -1
- package/dist/lib/token-cost.d.ts.map +0 -1
- package/dist/lib/token-cost.js.map +0 -1
- package/dist/lib/tui-compact-format.d.ts.map +0 -1
- package/dist/lib/tui-compact-format.js.map +0 -1
- package/dist/lib/tui-panel-state.d.ts.map +0 -1
- package/dist/lib/tui-panel-state.js.map +0 -1
- package/dist/lib/tui-prompt-bar-format.d.ts.map +0 -1
- package/dist/lib/tui-prompt-bar-format.js.map +0 -1
- package/dist/lib/tui-sidebar-format.d.ts.map +0 -1
- package/dist/lib/tui-sidebar-format.js.map +0 -1
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage-ownership.d.ts.map +0 -1
- package/dist/lib/usage-ownership.js.map +0 -1
- package/dist/lib/version.d.ts.map +0 -1
- package/dist/lib/version.js.map +0 -1
- package/dist/lib/xai.d.ts.map +0 -1
- package/dist/lib/xai.js.map +0 -1
- package/dist/lib/zai-auth.d.ts.map +0 -1
- package/dist/lib/zai-auth.js.map +0 -1
- package/dist/lib/zai.d.ts.map +0 -1
- package/dist/lib/zai.js.map +0 -1
- package/dist/lib/zhipu-auth.d.ts.map +0 -1
- package/dist/lib/zhipu-auth.js.map +0 -1
- package/dist/lib/zhipu.d.ts.map +0 -1
- package/dist/lib/zhipu.js.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js.map +0 -1
- package/dist/providers/accounting-decimal.d.ts.map +0 -1
- package/dist/providers/accounting-decimal.js.map +0 -1
- package/dist/providers/alibaba-coding-plan.d.ts.map +0 -1
- package/dist/providers/alibaba-coding-plan.js.map +0 -1
- package/dist/providers/alibaba-token-plan.d.ts.map +0 -1
- package/dist/providers/alibaba-token-plan.js.map +0 -1
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/cache-policies.d.ts.map +0 -1
- package/dist/providers/cache-policies.js.map +0 -1
- package/dist/providers/chutes.d.ts.map +0 -1
- package/dist/providers/chutes.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/cursor.d.ts.map +0 -1
- package/dist/providers/cursor.js.map +0 -1
- package/dist/providers/deepseek.d.ts.map +0 -1
- package/dist/providers/deepseek.js.map +0 -1
- package/dist/providers/glm-coding-plan-provider.d.ts.map +0 -1
- package/dist/providers/glm-coding-plan-provider.js.map +0 -1
- package/dist/providers/google-account-format.d.ts.map +0 -1
- package/dist/providers/google-account-format.js.map +0 -1
- package/dist/providers/google-agy.d.ts.map +0 -1
- package/dist/providers/google-agy.js.map +0 -1
- package/dist/providers/google-gemini-cli.d.ts.map +0 -1
- package/dist/providers/google-gemini-cli.js.map +0 -1
- package/dist/providers/kilo.d.ts.map +0 -1
- package/dist/providers/kilo.js.map +0 -1
- package/dist/providers/kimi-code.d.ts.map +0 -1
- package/dist/providers/kimi-code.js.map +0 -1
- package/dist/providers/mimo.d.ts.map +0 -1
- package/dist/providers/mimo.js.map +0 -1
- package/dist/providers/minimax-coding-plan.d.ts.map +0 -1
- package/dist/providers/minimax-coding-plan.js.map +0 -1
- package/dist/providers/nanogpt.d.ts.map +0 -1
- package/dist/providers/nanogpt.js.map +0 -1
- package/dist/providers/ollama-cloud.d.ts.map +0 -1
- package/dist/providers/ollama-cloud.js.map +0 -1
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/opencode-go.d.ts.map +0 -1
- package/dist/providers/opencode-go.js.map +0 -1
- package/dist/providers/opencode-zen.d.ts.map +0 -1
- package/dist/providers/opencode-zen.js.map +0 -1
- package/dist/providers/openrouter.d.ts.map +0 -1
- package/dist/providers/openrouter.js.map +0 -1
- package/dist/providers/quota-providers.d.ts.map +0 -1
- package/dist/providers/quota-providers.js.map +0 -1
- package/dist/providers/registry.d.ts.map +0 -1
- package/dist/providers/registry.js.map +0 -1
- package/dist/providers/result-helpers.d.ts.map +0 -1
- package/dist/providers/result-helpers.js.map +0 -1
- package/dist/providers/synthetic.d.ts.map +0 -1
- package/dist/providers/synthetic.js.map +0 -1
- package/dist/providers/xai.d.ts.map +0 -1
- package/dist/providers/xai.js.map +0 -1
- package/dist/providers/zai.d.ts.map +0 -1
- package/dist/providers/zai.js.map +0 -1
- package/dist/providers/zhipu.d.ts.map +0 -1
- package/dist/providers/zhipu.js.map +0 -1
- package/dist/rpc.d.ts.map +0 -1
- package/dist/rpc.js.map +0 -1
- package/dist/ui/assets/index-D9lFKhSN.js +0 -9
package/README.md
CHANGED
|
@@ -4,37 +4,68 @@
|
|
|
4
4
|
|
|
5
5
|
# OpenCode Quota GUI
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Quota, token usage, and analytics inside OpenCode Desktop. OpenCode Quota GUI adds a native side panel, a session-header quota slot, and native notifications to OpenCode. Everything is read and shown locally: there is no hosted service, no cloud account, and no remote usage store.
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
10
|
<a href="https://www.npmjs.com/package/opencode-quota-gui"><img alt="npm" src="https://img.shields.io/npm/v/opencode-quota-gui?style=flat-square" /></a>
|
|
11
11
|
<a href="./LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" /></a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
+
## Native OpenCode Desktop
|
|
15
|
+
|
|
16
|
+
The Native panel is the primary experience in **v1.3.1**. Open **Quota & Usage** for Quota, Analytics, Models, and their detail pages; OpenCode Settings includes the plugin's **Quota & analytics** page. The session header shows a compact quota slot with a combined preview.
|
|
17
|
+
|
|
18
|
+
The full Native integration ships from **v1.3.0** and requires **OpenCode Desktop 2.2.1 or newer**.
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img src="images/opencode-quota-gui_quota.png" alt="OpenCode Desktop with the native Quota & Usage side panel showing provider account cards, remaining quota windows, and reset countdowns" />
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
<table>
|
|
25
|
+
<tr>
|
|
26
|
+
<td width="50%" valign="top">
|
|
27
|
+
<img src="images/opencode-quota-gui_session.png" alt="Session analytics in the native panel with per-step context and cumulative token charts across a session tree, compaction markers, and a session tree table" />
|
|
28
|
+
<br />
|
|
29
|
+
<sub><strong>Session analytics</strong> — per-session and whole-tree usage, compaction markers, and the session tree.</sub>
|
|
30
|
+
</td>
|
|
31
|
+
<td width="50%" valign="top">
|
|
32
|
+
<img src="images/opencode-quota-gui_providers.png" alt="Models analytics grouped by provider with a stacked token chart, an API-equivalent cost line, and a cost and token breakdown by provider and model" />
|
|
33
|
+
<br />
|
|
34
|
+
<sub><strong>Models by provider</strong> — token and API-equivalent cost breakdown by provider and model.</sub>
|
|
35
|
+
</td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<td width="50%" valign="top">
|
|
39
|
+
<img src="images/opencode-quota-gui_analytics.png" alt="Daily token usage with total tokens, an API-equivalent estimate, a stacked daily chart with cache hit rate, and project token totals" />
|
|
40
|
+
<br />
|
|
41
|
+
<sub><strong>Daily analytics</strong> — daily token usage, cache hit rate, and project totals.</sub>
|
|
42
|
+
</td>
|
|
43
|
+
<td width="50%" valign="top">
|
|
44
|
+
<img src="images/opencode-quota-gui_slot.png" alt="Session header quota rings with the combined quota preview popup open, listing each provider's windows and reset countdowns" />
|
|
45
|
+
<br />
|
|
46
|
+
<sub><strong>Header Slot</strong> — at-a-glance quota rings with the combined preview open.</sub>
|
|
47
|
+
</td>
|
|
48
|
+
</tr>
|
|
49
|
+
</table>
|
|
50
|
+
|
|
14
51
|
## What you get
|
|
15
52
|
|
|
16
|
-
|
|
17
|
-
| --- |
|
|
18
|
-
| **Quota** |
|
|
19
|
-
|  |
|
|
20
|
-
| **Analytics** |
|
|
21
|
-
|  |
|
|
22
|
-
| **Models by provider** |
|
|
23
|
-
|  |
|
|
24
|
-
| **Session** |
|
|
25
|
-
|  |
|
|
53
|
+
The Native panel is the primary surface in v1.3.1. Every feature below is available there, and the optional browser dashboard mirrors the same views as a fallback.
|
|
26
54
|
|
|
27
55
|
## Features
|
|
28
56
|
|
|
29
|
-
- **
|
|
57
|
+
- **Native panel:** Quota, Analytics, Models, and Settings live in OpenCode Desktop, with project, session, provider, and model drilldowns in the same side panel.
|
|
58
|
+
- **Header quota slot:** compact rings for quota windows with a stable identity, plus a combined preview of every visible provider and account.
|
|
59
|
+
- **Native notifications:** low quota, exhausted quota, quota reset, and provider or API failures. A focused window shows an in-app toast; a background window asks OpenCode to notify you. Set the low-quota threshold and duplicate cooldown in Settings.
|
|
60
|
+
- **Quota by provider account:** provider logos with plan, account, or workspace labels, and one card per signed-in account, seat, API key, or workspace. Multiple logins for one provider each get their own card. Cards show the quota and rate-limit windows, reset countdowns, and balance, spend, budget, or status rows the integration supports. OpenAI cards can add banked resets and credits; Claude Agent cards can show read-only saved resets; Cursor can estimate from local history; Alibaba Coding Plan reads quota from the Bailian CLI. The active login is marked `(active)`.
|
|
30
61
|
- **Peak and off-peak pricing:** for providers whose published rules define time-of-day pricing, the Quota header shows **Peak**, **Off-peak**, or **Mixed** with the next change, a per-model schedule in your local time, and holiday exceptions. Model detail pages split each provider route's historical tokens and API-equivalent cost into Peak and Off-peak rows.
|
|
31
62
|
- **Analytics:** token usage over `24h`, `7d`, `30d`, or `lifetime`; a stacked daily token chart for cache read, input, reasoning, and output; a cache hit rate line; and projects you can sort by activity or tokens.
|
|
32
63
|
- **Models:** stacked token charts grouped by provider or model, with an API-equivalent cost line and a sortable cost/token breakdown. Open a provider to see its models or a model to see its providers.
|
|
33
|
-
- **Drilldowns:** Analytics → project → session, and Models → provider
|
|
64
|
+
- **Drilldowns:** Analytics → project → session, and Models → provider or model, with working back navigation.
|
|
34
65
|
- **Session detail:** per-step context and cumulative own-session and whole-tree token charts, compaction markers, and a nested session tree with steps and totals.
|
|
35
66
|
- **API-equivalent estimates:** list-price estimates for recorded tokens, using the peak or off-peak rate that applied when each step completed, shown beside token totals in Analytics, Models, projects, providers, and models. They are estimates, not subscription spend.
|
|
36
67
|
- **Customization:** used or remaining percentages, label style, row detail, provider selection, refresh interval, request timeout, card order, per-card or per-row visibility, and which providers show peak and off-peak status. Custom quota providers and pricing fallbacks live in the canonical config.
|
|
37
|
-
- **Local-first operation:**
|
|
68
|
+
- **Local-first operation:** no cloud account and no hosted sync; the plugin reads OpenCode data on this machine. The optional browser dashboard binds only to `127.0.0.1`. Reset-aware retry can hold a request until the provider's used-up quota window resets; turn it off with `waitForQuotaReset: false`.
|
|
38
69
|
|
|
39
70
|
## Quick start
|
|
40
71
|
|
|
@@ -55,19 +86,56 @@ That adds this entry to your OpenCode configuration, keeping the other plugins t
|
|
|
55
86
|
|
|
56
87
|
OpenCode installs the configured npm plugin itself; you do not need a separate `npm install`. If you prefer to edit the config manually, add the same `opencode-quota-gui` entry to the plural `plugins` array in `~/.config/opencode/opencode.json(c)` or a project `opencode.json(c)`.
|
|
57
88
|
|
|
58
|
-
|
|
89
|
+
Then open **Quota & Usage** in OpenCode Desktop. The full Native panel is available from **v1.3.0** and requires **OpenCode Desktop 2.2.1 or newer**.
|
|
90
|
+
|
|
91
|
+
The browser dashboard default follows the OpenCode host version. On supported hosts below **2.2.1** (including **2.2.0**), it is on by default because the full Native panel is unavailable there; at **2.2.1 or newer** it is off by default. An explicit `dashboard.enabled` value in the canonical settings always wins. When it runs, it is served on `127.0.0.1` at `dashboard.port` (default `4144`). To pin the behavior either way, edit the canonical settings file and restart OpenCode:
|
|
92
|
+
|
|
93
|
+
```jsonc
|
|
94
|
+
{
|
|
95
|
+
"dashboard": {
|
|
96
|
+
"enabled": true,
|
|
97
|
+
"port": 4144
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`true` forces web access on and `false` keeps it off. Then open <http://localhost:4144/quota>. The first page may show an empty dashboard until OpenCode has loaded the plugin and discovered a provider account. The path and platform overrides are in [Configuration](docs/readme/configuration.md#web-dashboard).
|
|
59
103
|
|
|
60
|
-
Requirements: OpenCode
|
|
104
|
+
Requirements: OpenCode `>= 2.0.16 < 2.3.0` and Node.js `22.13+` or `23.4+`. The full Native Desktop integration ships from v1.3.0 and requires OpenCode Desktop 2.2.1+. On supported older hosts, the browser dashboard is the automatic fallback. This package does not support OpenCode 1.
|
|
61
105
|
|
|
62
|
-
##
|
|
106
|
+
## Native panel
|
|
63
107
|
|
|
64
|
-
|
|
108
|
+
In OpenCode Desktop 2.2.1+, **Quota & Usage** opens the product in the side panel, and OpenCode Settings includes the plugin's **Quota & analytics** page. The session header shows compact quota rings; select the slot for the combined preview.
|
|
65
109
|
|
|
66
110
|
- **Quota:** cards for discovered provider accounts, ordered and grouped by provider. Each card shows the provider mark, plan and account or workspace labels, the rows the integration supports, a compact percentage bar for percentage rows, reset countdowns, and card-local errors. OpenAI cards can include banked resets and credits. Multiple logins for one provider get their own cards, and the active login is marked `(active)`. For providers with time-based pricing, the header shows live peak and off-peak status; open a status for its schedule, next change, and holiday exceptions.
|
|
67
111
|
- **Analytics:** total tokens and API-equivalent estimate for the selected range, a stacked token chart with cache hit rate, and projects ordered by activity or tokens. Open a project for its own token chart, worktree label, and root sessions.
|
|
68
112
|
- **Models:** token usage and API-equivalent cost grouped by provider or model. Use the Provider/Model switch and sort the breakdown by cost or tokens. Provider and model rows open their own detail pages.
|
|
69
113
|
- **Session:** the opened session and its descendants, with per-step context and cumulative token charts, own-session and whole-tree totals, compaction markers, and a session-tree table.
|
|
70
|
-
- **Settings:** display, provider, request, temporal pricing, visibility, and card-order controls, plus the canonical settings file, any reported configuration issues, and build information.
|
|
114
|
+
- **Settings:** display, provider, request, temporal pricing, visibility, and card-order controls, plus the web dashboard switch, the canonical settings file, any reported configuration issues, and build information.
|
|
115
|
+
|
|
116
|
+
The panel follows you between sessions: switching sessions reuses the same shared quota and analytics state instead of starting over, and header quota indicators stay in place across OpenCode Desktop's normal dashboard watch rotations.
|
|
117
|
+
|
|
118
|
+
The Native composer also shows **Cache observation**, for example `TTL ~4m 30s · Cache 99.70% · Hit`. Its percentage is the cache-read share of the last completed primary call with reliable usage data, not a session average, labelled by how much of the prompt was reused: `Low reuse` (above 0% up to 50%), `Partial reuse` (above 50% to under 90%) and `Hit` (90% or more). These are reuse-efficiency bands, not provider cache-hit semantics, so a small positive cache read is technically a cache hit but shows `Low reuse`. `Miss` is reserved for an independently confirmed zero. `Unknown` means the usage data was missing or invalid, or the share is zero: OpenCode reports a missing cache-read count as zero, so a plain zero is never shown as a confirmed `Miss`. The `~` marks the TTL countdown as an estimate; it is not an authoritative expiry, and no supported OpenCode host exposes one. For Claude Agent, a call whose cache writes are recorded as 1-hour-only with zero cache reads in its session record is estimated at 60 minutes instead of 5; an observed 1-hour write does not prove that earlier cached segments last an hour. See [Cache TTL evidence](docs/readme/cache-ttl-evidence.md) for what is and is not observable per route. Green means cache reuse is likely within an estimated retention window; yellow means the estimate is uncertain or in its final 20%; red means estimated expiry, observed invalidation, or a model change; gray means there is insufficient reliable information. An active session with confirmed prior cache reads may also show yellow when its retention is unknown, without a countdown. Colors estimate future reuse and do not guarantee the next hit or prove what a provider retained. Select a session row to open its Session Analytics in the panel without switching the active chat; its breadcrumbs link back to parent sessions.
|
|
119
|
+
|
|
120
|
+
<p align="center">
|
|
121
|
+
<img src="https://raw.githubusercontent.com/PVLPM/opencode-quota-gui/main/images/opencode-quota-gui_composer_pill.png" alt="Native composer Cache observation popover listing per-session TTL estimates and cache-read percentages above the TTL, Cache and Hit pill" width="320" />
|
|
122
|
+
</p>
|
|
123
|
+
|
|
124
|
+
For eligible quota windows, hover or focus the percentage or progress bar to see a linear runway estimate. It is available only when the provider data supports a reliable window projection; a reset timestamp alone is not enough. In particular, OpenCode Go's rolling five-hour window does not establish a fixed window start.
|
|
125
|
+
|
|
126
|
+
Native notifications cover low quota, exhausted quota, quota reset, and provider or API failures. The low-quota threshold and duplicate cooldown are configurable in Settings. A focused window shows an in-app toast; a background window asks OpenCode to notify you. The model-change toast has its own Settings toggle and does not control cache mismatch detection. Delivery is best effort, not exactly once.
|
|
127
|
+
|
|
128
|
+
## Optional browser dashboard
|
|
129
|
+
|
|
130
|
+
The browser dashboard is a fallback for browser access, not the primary surface. Its default follows the OpenCode host version: on supported hosts below **2.2.1**, including **2.2.0**, it is on by default because the full Native panel requires 2.2.1 or newer; at **2.2.1 or newer** it is off by default. An explicit `dashboard.enabled: true` or `false` in the canonical settings always wins. If the host version is missing or unparseable, the automatic fallback fails closed; a valid explicit setting still applies. A malformed canonical config or invalid setting also fails closed. When it runs, it is served on `127.0.0.1` at the fixed `dashboard.port` (default `4144`) only. It does not listen on network interfaces, does not fall back to another port, and has no cloud component. Local port forwarding, proxy configuration, or another process running on the same machine is outside this guarantee.
|
|
131
|
+
|
|
132
|
+
The browser view exposes the same product areas:
|
|
133
|
+
|
|
134
|
+
- **Quota:** provider account cards with the same rows, labels, reset countdowns, and peak and off-peak status as the Native panel.
|
|
135
|
+
- **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.
|
|
136
|
+
- **Models:** token usage and API-equivalent cost grouped by provider or model, with detail pages for each.
|
|
137
|
+
- **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.
|
|
138
|
+
- **Settings:** the same shared settings form and canonical settings file information.
|
|
71
139
|
|
|
72
140
|
The routes are real URLs, so reload and browser back/forward work:
|
|
73
141
|
|
|
@@ -78,19 +146,17 @@ The routes are real URLs, so reload and browser back/forward work:
|
|
|
78
146
|
- `/session/<id>` — one session tree
|
|
79
147
|
- `/settings` — dashboard settings
|
|
80
148
|
|
|
81
|
-
OpenCode 2 currently has no stable native frontend extension surface suitable for rendering this dashboard inside the host UI. It therefore runs in your browser, and the plugin exposes only the local HTTP and event stream needed by that page. If a stable host extension API emerges, this integration may evolve; no such API or timeline is announced.
|
|
82
|
-
|
|
83
149
|
## Scope and limitations
|
|
84
150
|
|
|
85
151
|
- **Tokens are not quota.** Quota cards show provider-reported quota, rate-limit, balance, spend, budget, or status values, plus documented local estimates for some providers. Analytics shows token activity recorded by OpenCode on this machine. A token total does not measure remaining quota, and a quota reset does not clear token history. Provider quota can include usage from outside OpenCode, while local analytics cannot see that usage.
|
|
86
152
|
- **Cost estimates are not bills.** The API-equivalent figure applies list prices to recorded tokens. It is not subscription spend, an invoice, or a reconciliation of what a provider charged; plan pricing, credits, discounts, taxes, and provider billing adjustments are not applied.
|
|
87
153
|
- **`Free`, `Unpriced`, and unknown tokens are distinct.** `Free` appears only for a non-empty total whose every token has an explicit zero list price. Unpriced or unknown tokens are excluded from the estimate; a mixed total is marked `Partial estimate`, and a non-empty total with no priced tokens is `Unpriced`, never `Free` or `USD 0`. A model with a missing or unrecognized identity or price can make a total partial or unpriced.
|
|
88
|
-
- **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
|
|
89
|
-
- **
|
|
154
|
+
- **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's local-history billing-cycle estimate is not an official provider total. Alibaba Coding Plan uses quota reported by the Bailian CLI.
|
|
155
|
+
- **Native and browser surfaces.** The full Native panel requires OpenCode Desktop 2.2.1+ and ships from v1.3.0. The optional browser dashboard binds to `127.0.0.1`; it is not a hosted service, and the package has no TUI.
|
|
90
156
|
|
|
91
157
|
## Providers
|
|
92
158
|
|
|
93
|
-
Most providers work automatically once you log in through OpenCode. A **Needs setup** link points to the extra step. Provider data is collected by the plugin inside the OpenCode host; the
|
|
159
|
+
Most providers work automatically once you log in through OpenCode. A **Needs setup** link points to the extra step. Provider data is collected by the plugin inside the OpenCode host; the plugin does not run a separate polling service. Quota cards use provider marks and plan, account, or workspace labels; each signed-in account, seat, API key, or workspace gets its own card, and the active login is marked `(active)`. OpenCode Console workspace display names refresh automatically.
|
|
94
160
|
|
|
95
161
|
### Pre-configured American providers
|
|
96
162
|
|
|
@@ -99,7 +165,8 @@ Most providers work automatically once you log in through OpenCode. A **Needs se
|
|
|
99
165
|
|
|
100
166
|
| Provider | Auth/setup | Data from | Reports |
|
|
101
167
|
| ------------------ | -------------------------------------------------------------- | ------------------ | ------------------ |
|
|
102
|
-
| Anthropic
|
|
168
|
+
| Anthropic | [Unavailable](docs/readme/providers.md#anthropic) | — | — |
|
|
169
|
+
| Claude Agent | [Needs setup](docs/readme/providers.md#claude-agent) | Local CLI/OAuth | Quota |
|
|
103
170
|
| Chutes AI | Automatic | Remote API | Quota |
|
|
104
171
|
| Cursor | [Needs setup](docs/readme/providers.md#cursor) | Local estimate | Budget and spend |
|
|
105
172
|
| GitHub Copilot | Automatic | Remote API | Budget and usage |
|
|
@@ -121,7 +188,8 @@ Most providers work automatically once you log in through OpenCode. A **Needs se
|
|
|
121
188
|
|
|
122
189
|
| Provider | Auth/setup | Data from | Reports |
|
|
123
190
|
| ----------------------- | -------------------------------------------------------------- | ------------------ | ------------------ |
|
|
124
|
-
| Anthropic
|
|
191
|
+
| Anthropic | [Unavailable](docs/readme/providers.md#anthropic) | — | — |
|
|
192
|
+
| Claude Agent | [Needs setup](docs/readme/providers.md#claude-agent) | Local CLI/OAuth | Quota |
|
|
125
193
|
| Chutes AI | Automatic | Remote API | Quota |
|
|
126
194
|
| Cursor | [Needs setup](docs/readme/providers.md#cursor) | Local estimate | Budget and spend |
|
|
127
195
|
| Gemini CLI | [Needs setup](docs/readme/providers.md#gemini-cli) | Remote API | Quota |
|
|
@@ -145,7 +213,7 @@ Gemini CLI works only with Gemini Code Assist Standard or Enterprise (organizati
|
|
|
145
213
|
|
|
146
214
|
| Provider | Auth/setup | Data from | Reports |
|
|
147
215
|
| ----------------------------- | ---------------------------------------------------------------------------- | -------------- | ------------------ |
|
|
148
|
-
| Alibaba Coding Plan |
|
|
216
|
+
| Alibaba Coding Plan | [Needs setup](docs/readme/providers.md#alibaba-coding-plan) | Official CLI | Quota |
|
|
149
217
|
| Alibaba Personal Token Plan | [Needs setup](docs/readme/providers.md#alibaba-personal-token-plan) | Official CLI | Quota |
|
|
150
218
|
| DeepSeek | Automatic | Remote API | Balance and status |
|
|
151
219
|
| Kimi Code | Automatic | Remote API | Quota |
|
|
@@ -175,11 +243,11 @@ These show only your own member API key's usage, not the whole organization's.
|
|
|
175
243
|
|
|
176
244
|
### Custom providers
|
|
177
245
|
|
|
178
|
-
A custom provider can read a supported quota API or estimate usage from your local OpenCode history. Define it in the global canonical settings file under `quotaProviders`; see the [custom-provider guide](docs/readme/providers.md#custom-providers) for the complete schema, adapter rules, and security limits. The
|
|
246
|
+
A custom provider can read a supported quota API or estimate usage from your local OpenCode history. Define it in the global canonical settings file under `quotaProviders`; see the [custom-provider guide](docs/readme/providers.md#custom-providers) for the complete schema, adapter rules, and security limits. The Native Settings page does not create provider definitions.
|
|
179
247
|
|
|
180
248
|
## Settings and privacy
|
|
181
249
|
|
|
182
|
-
The
|
|
250
|
+
The plugin reads only the canonical file at runtime:
|
|
183
251
|
|
|
184
252
|
```text
|
|
185
253
|
~/.config/opencode/opencode-quota-gui/config.jsonc
|
|
@@ -190,12 +258,12 @@ The dashboard reads only the canonical file at runtime:
|
|
|
190
258
|
- **Legacy import:** when a global legacy OpenCode Quota source exists, Settings can preview and copy seven compatible keys: `percentDisplayMode`, `percentLabelStyle`, `enabledProviders`, `minIntervalMs`, `requestTimeoutMs`, `accountingDetail`, and `waitForQuotaReset`. The import is read-only for the source; files stay byte-for-byte untouched. Custom provider definitions are not imported, so copy `quotaProviders` into the canonical file yourself.
|
|
191
259
|
- **Visibility:** hiding a provider or row is presentation only and never changes polling or provider data. Opaque card and row IDs in `dashboard.hiddenCards` and `dashboard.hiddenRows` are internal identifiers: use **Settings → Visibility** to manage them instead of editing or deriving IDs by hand.
|
|
192
260
|
- **Temporal pricing:** `dashboard.temporalProviderOverrides` stores sparse per-provider on/off choices for the live peak and off-peak status in the Quota header. A provider with a discovered account is shown by default; an explicit choice wins. Hiding a status is presentation only and never changes polling, quota values, or recorded usage.
|
|
193
|
-
- **
|
|
261
|
+
- **Web dashboard (optional fallback):** on by default below OpenCode 2.2.1 (including 2.2.0) and off by default at 2.2.1 and newer. An explicit `"dashboard": { "enabled": true }` or `"dashboard": { "enabled": false }` in the canonical file always wins. When enabled, the browser UI is served on `127.0.0.1` at `dashboard.port` (default `4144`), and the server never falls back to another port. Missing/unparseable host versions and malformed or invalid canonical settings fail closed when the switch is absent. Changes apply after an OpenCode restart.
|
|
194
262
|
- **Browser storage:** the dashboard uses browser-local storage for display state such as the selected range and a visibility-catalog cache. It does not use cross-site cookies.
|
|
195
263
|
- **Local data:** the plugin reads OpenCode's local configuration and login data through OpenCode, plus OpenCode's local session database for usage and session views. Provider quota checks use the provider's API or the documented local CLI or companion plugin. Token pricing can come from the bundled snapshot or `models.dev` at runtime. Peak and off-peak rules ship in the bundled snapshot and are evaluated locally.
|
|
196
264
|
- **OpenTelemetry (optional):** off by default. Set `"telemetry": { "enabled": true }` in the canonical file to publish two gauges, `opencode.quota.consumed` and `opencode.quota.cache.age`, through the `@opentelemetry/api` global `MeterProvider` that your host process configures. The plugin does not create a `MeterProvider`, exporter, collector, or metrics endpoint, sends no metrics by itself, and makes no extra provider requests for telemetry. Metric names and attributes are not a public API. See [External integration](docs/readme/external-integration.md#optional-opentelemetry-advanced-host-owned).
|
|
197
265
|
- **No hosted service:** this project has no cloud account, hosted dashboard, or remote usage store. The local server permits only loopback hosts and origins and sends no CORS headers.
|
|
198
|
-
- **Build details:** Settings → About reports the embedded Version, Build, and Contract. A build or contract mismatch means the
|
|
266
|
+
- **Build details:** Settings → About reports the embedded Version, Build, and Contract. A build or contract mismatch means the page and server plugin are from different builds; restart OpenCode, then reload the page. Reinstall the same package if it persists.
|
|
199
267
|
|
|
200
268
|
See [Configuration](docs/readme/configuration.md) for every supported settings key and the custom-provider rules.
|
|
201
269
|
|
|
@@ -217,11 +285,13 @@ For a local build or release candidate, build the checkout and point the optiona
|
|
|
217
285
|
|
|
218
286
|
## OpenCode and upstream compatibility
|
|
219
287
|
|
|
220
|
-
This
|
|
288
|
+
This project has no TUI panel, terminal quota interface or reports, slash command, tool, report hook, or status line, and it produces no report message, marker, or metadata contract. The `init` and `update` commands described above are maintenance only, not a quota interface. The server plugin owns dashboard data, credentials, and reset-retry lifecycle; its dashboard RPC supports the Native Desktop GUI.
|
|
221
289
|
|
|
222
290
|
It is independent of the upstream `@slkiser/opencode-quota` package. The two packages may be configured at the same time, and there is no dependency or conflict guard between them. Each owns its configuration and private state; this package writes under the `opencode-quota-gui` namespace and does not migrate, rewrite, or delete upstream configuration, cache, or credential files.
|
|
223
291
|
|
|
224
|
-
|
|
292
|
+
The browser dashboard default follows the OpenCode host version: it is on by default below 2.2.1 (including 2.2.0), where the full Native panel is unavailable, and off by default at 2.2.1 and newer. An explicit `dashboard.enabled` value in the canonical settings always wins. Either way, the server stays loopback-only on `127.0.0.1`.
|
|
293
|
+
|
|
294
|
+
Use the upstream project if you want its terminal surfaces. Use this project if you want quota and usage inside OpenCode Desktop. See [Updating safely](docs/readme/updating.md) for migration and coexistence details.
|
|
225
295
|
|
|
226
296
|
## Support
|
|
227
297
|
|
|
@@ -239,7 +309,7 @@ Outside references: [OpenCode v2 docs](https://opencode.ai/v2/docs/) · [OpenCod
|
|
|
239
309
|
|
|
240
310
|
## Contributing
|
|
241
311
|
|
|
242
|
-
Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening an issue or pull request. In short: open an issue first, run `pnpm verify`, keep the fix focused, and include before-and-after
|
|
312
|
+
Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening an issue or pull request. In short: open an issue first, run `pnpm verify`, keep the fix focused, and include before-and-after screenshots for any visible change. Credentials, account identifiers, and private paths must be redacted.
|
|
243
313
|
|
|
244
314
|
## Acknowledgements and license
|
|
245
315
|
|
|
@@ -21,7 +21,12 @@ export declare function encodeAnalyticsEntityToken(identity: AnalyticsEntityIden
|
|
|
21
21
|
* encoding is accepted, so two byte sequences cannot stand for one identity.
|
|
22
22
|
*/
|
|
23
23
|
export declare function decodeAnalyticsEntityToken(token: string): AnalyticsEntityIdentity | undefined;
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* True for an exact structurally valid grouped query; raw id contents are
|
|
26
|
+
* unconstrained. Nested `filter`/`identity` objects may not carry extra keys:
|
|
27
|
+
* the source echoes the filter into its response, so accepting extras would
|
|
28
|
+
* round-trip unvalidated data through the transport.
|
|
29
|
+
*/
|
|
25
30
|
export declare function isAnalyticsGroupQuery(value: unknown): value is AnalyticsGroupQuery;
|
|
26
31
|
/**
|
|
27
32
|
* Collision-safe cache/coalescing key for one grouped query. Length-prefixed
|
|
@@ -82,28 +82,45 @@ export function decodeAnalyticsEntityToken(token) {
|
|
|
82
82
|
const identity = { kind: "known", id };
|
|
83
83
|
return encodeAnalyticsEntityToken(identity) === token ? identity : undefined;
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
function hasExactKeys(record, keys) {
|
|
86
|
+
const actual = Object.keys(record);
|
|
87
|
+
return actual.length === keys.length && actual.every((key) => keys.includes(key));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* True for an exact structurally valid grouped query; raw id contents are
|
|
91
|
+
* unconstrained. Nested `filter`/`identity` objects may not carry extra keys:
|
|
92
|
+
* the source echoes the filter into its response, so accepting extras would
|
|
93
|
+
* round-trip unvalidated data through the transport.
|
|
94
|
+
*/
|
|
86
95
|
export function isAnalyticsGroupQuery(value) {
|
|
87
|
-
if (typeof value !== "object" || value === null)
|
|
96
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
88
97
|
return false;
|
|
89
98
|
const record = value;
|
|
90
99
|
if (!isRangeKey(record.range) || !isAnalyticsDimension(record.dimension))
|
|
91
100
|
return false;
|
|
92
101
|
const filter = record.filter;
|
|
93
|
-
if (filter === undefined)
|
|
94
|
-
return
|
|
95
|
-
|
|
102
|
+
if (filter === undefined) {
|
|
103
|
+
return hasExactKeys(record, ["range", "dimension"]);
|
|
104
|
+
}
|
|
105
|
+
if (!hasExactKeys(record, ["range", "dimension", "filter"]))
|
|
106
|
+
return false;
|
|
107
|
+
if (typeof filter !== "object" || filter === null || Array.isArray(filter))
|
|
96
108
|
return false;
|
|
97
109
|
const filterRecord = filter;
|
|
98
|
-
if (!
|
|
110
|
+
if (!hasExactKeys(filterRecord, ["dimension", "identity"]) ||
|
|
111
|
+
!isAnalyticsDimension(filterRecord.dimension)) {
|
|
99
112
|
return false;
|
|
113
|
+
}
|
|
100
114
|
const identity = filterRecord.identity;
|
|
101
|
-
if (typeof identity !== "object" || identity === null)
|
|
115
|
+
if (typeof identity !== "object" || identity === null || Array.isArray(identity))
|
|
102
116
|
return false;
|
|
103
117
|
const identityRecord = identity;
|
|
104
|
-
if (identityRecord.kind === "unknown")
|
|
105
|
-
return
|
|
106
|
-
|
|
118
|
+
if (identityRecord.kind === "unknown") {
|
|
119
|
+
return hasExactKeys(identityRecord, ["kind"]);
|
|
120
|
+
}
|
|
121
|
+
return (identityRecord.kind === "known" &&
|
|
122
|
+
hasExactKeys(identityRecord, ["kind", "id"]) &&
|
|
123
|
+
typeof identityRecord.id === "string");
|
|
107
124
|
}
|
|
108
125
|
/**
|
|
109
126
|
* Collision-safe cache/coalescing key for one grouped query. Length-prefixed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const BUILD_IDENTITY = Object.freeze({"version":"1.
|
|
1
|
+
export const BUILD_IDENTITY = Object.freeze({"version":"1.3.1","build":"f35c0fbe33be"});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoritative normalized card-visibility semantics.
|
|
3
|
+
*
|
|
4
|
+
* Browser-safe and shared by the UI and the server-side quota notification
|
|
5
|
+
* detector. A card is hidden when the effective hidden-card list contains its
|
|
6
|
+
* exact `cardId`, its `providerId`, or its authoritative bare provider-scope
|
|
7
|
+
* hash. Effective server settings normalize legacy full scope ids to
|
|
8
|
+
* `providerId`; every full card id is now an exact hide. Row hiding is a
|
|
9
|
+
* separate, exact `rowId` check and is not affected by this helper.
|
|
10
|
+
*/
|
|
11
|
+
export interface ProviderVisibilityIdentity {
|
|
12
|
+
providerId: string;
|
|
13
|
+
providerScopeHash?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CardVisibilityIdentity extends ProviderVisibilityIdentity {
|
|
16
|
+
cardId: string;
|
|
17
|
+
}
|
|
18
|
+
/** Consume normalized settings; never guess old semantics from the current catalog. */
|
|
19
|
+
export declare function isLegacyProviderHidden(card: ProviderVisibilityIdentity, hidden: ReadonlySet<string>): boolean;
|
|
20
|
+
export declare function isCardHidden(card: CardVisibilityIdentity, hidden: ReadonlySet<string>): boolean;
|
|
21
|
+
//# sourceMappingURL=card-visibility.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoritative normalized card-visibility semantics.
|
|
3
|
+
*
|
|
4
|
+
* Browser-safe and shared by the UI and the server-side quota notification
|
|
5
|
+
* detector. A card is hidden when the effective hidden-card list contains its
|
|
6
|
+
* exact `cardId`, its `providerId`, or its authoritative bare provider-scope
|
|
7
|
+
* hash. Effective server settings normalize legacy full scope ids to
|
|
8
|
+
* `providerId`; every full card id is now an exact hide. Row hiding is a
|
|
9
|
+
* separate, exact `rowId` check and is not affected by this helper.
|
|
10
|
+
*/
|
|
11
|
+
/** Consume normalized settings; never guess old semantics from the current catalog. */
|
|
12
|
+
export function isLegacyProviderHidden(card, hidden) {
|
|
13
|
+
return (hidden.has(card.providerId) ||
|
|
14
|
+
(card.providerScopeHash !== undefined && hidden.has(card.providerScopeHash)));
|
|
15
|
+
}
|
|
16
|
+
export function isCardHidden(card, hidden) {
|
|
17
|
+
return hidden.has(card.cardId) || isLegacyProviderHidden(card, hidden);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=card-visibility.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AnalyticsTemporalBreakdown } from "./analytics-temporal.js";
|
|
2
2
|
import type { CardId, RowId } from "./identity.js";
|
|
3
3
|
import type { BankedResetAvailability } from "./openai-quota.js";
|
|
4
|
+
import type { ProviderFailureCategory } from "./provider-failure.js";
|
|
4
5
|
import type { BucketUnit, RangeKey, RangeWindow } from "./ranges.js";
|
|
5
6
|
import type { TemporalStatusSnapshot } from "./temporal.js";
|
|
6
7
|
/**
|
|
@@ -265,7 +266,24 @@ export type RunwayProjection = {
|
|
|
265
266
|
} | {
|
|
266
267
|
kind: "lasts_past_reset";
|
|
267
268
|
};
|
|
269
|
+
/** Approved maximum number of primary quota-window references per card. */
|
|
270
|
+
export declare const PRIMARY_QUOTA_WINDOW_LIMIT = 3;
|
|
271
|
+
/**
|
|
272
|
+
* Stable provider-defined ring slot: 0 outermost, 1 middle, 2 innermost.
|
|
273
|
+
* Slots are per-card family positions in full-card order, not global time-unit
|
|
274
|
+
* ranks. They are assigned from established window semantics, never from
|
|
275
|
+
* current utilization, and remain fixed when earlier windows are absent.
|
|
276
|
+
*/
|
|
277
|
+
export type PrimaryQuotaWindowSlot = 0 | 1 | 2;
|
|
278
|
+
export interface PrimaryQuotaWindowRef {
|
|
279
|
+
/** Existing row on the owning card. */
|
|
280
|
+
rowId: RowId;
|
|
281
|
+
/** Stable provider-defined ring slot, not the array position. */
|
|
282
|
+
slot: PrimaryQuotaWindowSlot;
|
|
283
|
+
}
|
|
268
284
|
export interface ProviderCard {
|
|
285
|
+
/** Rows are retained from the last successful measurement. */
|
|
286
|
+
stale?: true;
|
|
269
287
|
cardId: CardId;
|
|
270
288
|
providerId: string;
|
|
271
289
|
providerLabel: string;
|
|
@@ -282,10 +300,23 @@ export interface ProviderCard {
|
|
|
282
300
|
providerScopeId?: CardId;
|
|
283
301
|
providerScopeHash?: string;
|
|
284
302
|
rows: QuotaCardRow[];
|
|
303
|
+
/**
|
|
304
|
+
* Primary quota-window references for the native `session.header` rings
|
|
305
|
+
* (additive, optional): unique existing percent rows, at most three, never
|
|
306
|
+
* budget/spend/auxiliary percentages. Each entry carries the stable
|
|
307
|
+
* provider-defined `slot` (0..2), so a missing earlier window does not move
|
|
308
|
+
* later rings. Absent means the provider/card has no defensible primary
|
|
309
|
+
* mapping, not an empty quota.
|
|
310
|
+
*/
|
|
311
|
+
primaryQuotaWindows?: PrimaryQuotaWindowRef[];
|
|
285
312
|
errors: {
|
|
286
313
|
label: string;
|
|
287
314
|
message: string;
|
|
288
315
|
retryable?: boolean;
|
|
316
|
+
retryAtMs?: number;
|
|
317
|
+
kind?: "intentional-filter";
|
|
318
|
+
/** Source-assigned safe category; absence means unknown and consumers fail closed. */
|
|
319
|
+
failureCategory?: ProviderFailureCategory;
|
|
289
320
|
}[];
|
|
290
321
|
/** Explicit safe field list only — never a raw `statusDetails` copy. */
|
|
291
322
|
details?: {
|
|
@@ -314,6 +345,7 @@ export interface HomeSnapshot {
|
|
|
314
345
|
generatedAtMs: number;
|
|
315
346
|
range: RangeKey;
|
|
316
347
|
stale: boolean;
|
|
348
|
+
/** `polledAtMs` is a poll time, not a guarantee that every provider succeeded. */
|
|
317
349
|
providers: {
|
|
318
350
|
cards: ProviderCard[];
|
|
319
351
|
enabledProviders: string[] | "auto";
|
|
@@ -484,7 +516,9 @@ export interface DashboardDataSource {
|
|
|
484
516
|
home(input: {
|
|
485
517
|
range: RangeKey;
|
|
486
518
|
}): Promise<HomeSnapshot>;
|
|
487
|
-
quota(
|
|
519
|
+
quota(input?: {
|
|
520
|
+
refresh?: boolean;
|
|
521
|
+
}): Promise<QuotaSnapshot>;
|
|
488
522
|
project(input: {
|
|
489
523
|
projectId: string;
|
|
490
524
|
range: RangeKey;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
/** Contract revision advertised by `DashboardDataSource.health()`. */
|
|
2
2
|
export const DASHBOARD_CONTRACT_VERSION = 2;
|
|
3
|
+
/** Approved maximum number of primary quota-window references per card. */
|
|
4
|
+
export const PRIMARY_QUOTA_WINDOW_LIMIT = 3;
|
|
3
5
|
//# sourceMappingURL=dashboard.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe structural guards for every dashboard DTO that crosses a
|
|
3
|
+
* transport boundary.
|
|
4
|
+
*
|
|
5
|
+
* These are deliberately separate from the richer UI decoders: they answer
|
|
6
|
+
* "is this the documented DTO shape?" without constructing a new object, so a
|
|
7
|
+
* transport can reject a malformed payload while preserving additive fields.
|
|
8
|
+
* Existing narrow guards (`isTokenStack`, `isCostedTokens`, `isRangeKey`) are
|
|
9
|
+
* reused rather than re-implemented.
|
|
10
|
+
*/
|
|
11
|
+
import type { AnalyticsGroupQuery, AnalyticsGroupSnapshot, DashboardHealth, HomeSnapshot, ImportPreview, JsonValue, ProjectSnapshot, QuotaSnapshot, SessionSnapshot, SettingsSnapshot, SettingsWriteResult } from "./dashboard.js";
|
|
12
|
+
export declare function isJsonValue(value: unknown, depth?: number): value is JsonValue;
|
|
13
|
+
export declare function isDashboardHealth(value: unknown): value is DashboardHealth;
|
|
14
|
+
export declare function isQuotaSnapshot(value: unknown): value is QuotaSnapshot;
|
|
15
|
+
export declare function isHomeSnapshot(value: unknown): value is HomeSnapshot;
|
|
16
|
+
/** Exact-key grouped query validation, including the nested filter identity. */
|
|
17
|
+
export declare function isAnalyticsGroupQuery(value: unknown): value is AnalyticsGroupQuery;
|
|
18
|
+
export declare function isAnalyticsGroupSnapshot(value: unknown): value is AnalyticsGroupSnapshot;
|
|
19
|
+
export declare function isProjectSnapshot(value: unknown): value is ProjectSnapshot;
|
|
20
|
+
export declare function isSessionSnapshot(value: unknown): value is SessionSnapshot;
|
|
21
|
+
export declare function isSettingsSnapshot(value: unknown): value is SettingsSnapshot;
|
|
22
|
+
export declare function isSettingsWriteResult(value: unknown): value is SettingsWriteResult;
|
|
23
|
+
export declare function isImportPreview(value: unknown): value is ImportPreview;
|
|
24
|
+
//# sourceMappingURL=dto-guards.d.ts.map
|