opencode-quota-gui 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -34
- package/dist/bin/opencode-quota-gui.js +0 -0
- package/dist/contracts/analytics-entity.d.ts +6 -1
- package/dist/contracts/analytics-entity.js +27 -10
- package/dist/contracts/analytics-temporal.d.ts +39 -0
- package/dist/contracts/analytics-temporal.js +11 -0
- 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 +40 -0
- package/dist/contracts/dashboard.js +2 -0
- package/dist/contracts/dto-guards.d.ts +24 -0
- package/dist/contracts/dto-guards.js +592 -0
- package/dist/contracts/provider-failure.d.ts +18 -0
- package/dist/contracts/provider-failure.js +25 -0
- package/dist/contracts/temporal.d.ts +126 -0
- package/dist/contracts/temporal.js +10 -0
- package/dist/data/modelsdev-temporal.min.json +3075 -0
- package/dist/gui/aggregation.js +3 -0
- package/dist/gui/analytics-engine.js +30 -0
- package/dist/gui/analytics-model.js +181 -1
- package/dist/gui/analytics-pricing-revision.d.ts +43 -0
- package/dist/gui/analytics-pricing-revision.js +160 -0
- package/dist/gui/analytics-state.d.ts +7 -2
- package/dist/gui/analytics-state.js +14 -2
- package/dist/gui/config.d.ts +20 -3
- package/dist/gui/config.js +60 -3
- package/dist/gui/dashboard-errors.d.ts +32 -0
- package/dist/gui/dashboard-errors.js +97 -0
- package/dist/gui/lifecycle.d.ts +44 -11
- package/dist/gui/lifecycle.js +214 -36
- package/dist/gui/primary-quota-windows.d.ts +28 -0
- package/dist/gui/primary-quota-windows.js +147 -0
- package/dist/gui/provider-cards.d.ts +1 -1
- package/dist/gui/provider-cards.js +40 -16
- package/dist/gui/quota-notification-detector.d.ts +151 -0
- package/dist/gui/quota-notification-detector.js +284 -0
- package/dist/gui/quota-notification-observer.d.ts +55 -0
- package/dist/gui/quota-notification-observer.js +363 -0
- package/dist/gui/rpc.d.ts +59 -0
- package/dist/gui/rpc.js +302 -0
- package/dist/gui/server.d.ts +15 -27
- package/dist/gui/server.js +23 -121
- package/dist/gui/snapshot-service.d.ts +31 -4
- package/dist/gui/snapshot-service.js +177 -54
- package/dist/gui/sources.d.ts +1 -1
- package/dist/gui/sources.js +28 -0
- package/dist/gui/temporal-quota-policy-data.d.ts +24 -0
- package/dist/gui/temporal-quota-policy-data.js +43 -0
- package/dist/gui/temporal-quota-policy.d.ts +38 -0
- package/dist/gui/temporal-quota-policy.js +182 -0
- package/dist/gui/temporal-status.d.ts +53 -0
- package/dist/gui/temporal-status.js +815 -0
- package/dist/gui-experimental.cjs +1756 -0
- package/dist/lib/anthropic.d.ts +5 -0
- package/dist/lib/anthropic.js +18 -1
- package/dist/lib/chutes.js +19 -2
- package/dist/lib/config.d.ts +5 -1
- package/dist/lib/config.js +81 -0
- package/dist/lib/copilot.js +42 -14
- package/dist/lib/dashboard-web-policy.d.ts +35 -0
- package/dist/lib/dashboard-web-policy.js +24 -0
- package/dist/lib/deepseek.js +12 -1
- package/dist/lib/display-sanitize.js +2 -0
- package/dist/lib/entries.d.ts +3 -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 +14 -4
- package/dist/lib/google-agy.js +59 -14
- package/dist/lib/google-gemini-cli.js +58 -14
- package/dist/lib/init-installer.js +25 -4
- package/dist/lib/kilo.js +29 -40
- package/dist/lib/kimi.js +13 -1
- package/dist/lib/mimo.d.ts +2 -0
- package/dist/lib/mimo.js +9 -1
- package/dist/lib/modelsdev-temporal.d.ts +143 -0
- package/dist/lib/modelsdev-temporal.js +896 -0
- package/dist/lib/nanogpt.d.ts +2 -0
- package/dist/lib/nanogpt.js +24 -3
- package/dist/lib/ollama-cloud.js +9 -0
- package/dist/lib/openai.js +6 -2
- package/dist/lib/opencode-auth.d.ts +3 -2
- package/dist/lib/opencode-auth.js +8 -1
- package/dist/lib/opencode-go.js +24 -3
- package/dist/lib/opencode-version.d.ts +21 -0
- package/dist/lib/opencode-version.js +53 -5
- package/dist/lib/opencode-zen.d.ts +9 -1
- package/dist/lib/opencode-zen.js +27 -7
- package/dist/lib/quota-providers-remote.d.ts +2 -0
- package/dist/lib/quota-providers-remote.js +78 -19
- 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 +3 -1
- package/dist/lib/quota-stats.d.ts +22 -1
- package/dist/lib/quota-stats.js +111 -15
- package/dist/lib/synthetic.js +8 -0
- package/dist/lib/types.d.ts +24 -0
- package/dist/lib/types.js +4 -0
- package/dist/lib/xai.js +16 -2
- package/dist/plugin.d.ts +4 -3
- package/dist/plugin.js +33 -4
- package/dist/providers/alibaba-coding-plan.js +3 -1
- package/dist/providers/alibaba-token-plan.js +17 -0
- package/dist/providers/anthropic.js +12 -3
- package/dist/providers/copilot.js +10 -2
- package/dist/providers/glm-coding-plan-provider.d.ts +2 -0
- package/dist/providers/glm-coding-plan-provider.js +5 -1
- package/dist/providers/google-account-format.js +1 -0
- package/dist/providers/google-agy.js +12 -2
- package/dist/providers/google-gemini-cli.js +12 -2
- package/dist/providers/kilo.js +9 -1
- package/dist/providers/kimi-code.js +11 -6
- package/dist/providers/mimo.js +8 -2
- package/dist/providers/minimax-coding-plan.js +28 -5
- package/dist/providers/nanogpt.js +3 -0
- package/dist/providers/ollama-cloud.js +3 -0
- package/dist/providers/openai.js +1 -0
- package/dist/providers/opencode-go.js +8 -1
- package/dist/providers/opencode-zen.js +30 -3
- package/dist/providers/openrouter.js +3 -0
- package/dist/providers/quota-providers.js +30 -4
- package/dist/providers/result-helpers.d.ts +4 -0
- package/dist/providers/result-helpers.js +16 -2
- package/dist/rpc.d.ts +327 -4
- package/dist/rpc.js +315 -2
- package/dist/ui/assets/index-DLHeXYff.js +9 -0
- package/dist/ui/assets/{index-BZwMJ6Ax.css → index-cDd9jUVY.css} +1 -1
- package/dist/ui/assets/popover-BGkgv9s0.js +1 -0
- package/dist/ui/assets/popover-mkHTmNjv.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +49 -39
- 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/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/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-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/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.map +0 -1
- 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/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-CjNjqsse.js +0 -8
package/dist/lib/types.js
CHANGED
|
@@ -16,6 +16,8 @@ export const DEFAULT_CONFIG = {
|
|
|
16
16
|
enabled: false,
|
|
17
17
|
windows: ["weekly"],
|
|
18
18
|
},
|
|
19
|
+
lowQuotaThresholdRemainingPercent: 10,
|
|
20
|
+
duplicateCooldownMinutes: 30,
|
|
19
21
|
tuiCommandDisplay: "dialog",
|
|
20
22
|
formatStyle: DEFAULT_QUOTA_FORMAT_STYLE,
|
|
21
23
|
percentDisplayMode: "remaining",
|
|
@@ -69,12 +71,14 @@ export const DEFAULT_CONFIG = {
|
|
|
69
71
|
enabled: false,
|
|
70
72
|
},
|
|
71
73
|
dashboard: {
|
|
74
|
+
enabled: false,
|
|
72
75
|
port: DEFAULT_DASHBOARD_PORT,
|
|
73
76
|
hiddenCards: [],
|
|
74
77
|
hiddenCardsVersion: 2,
|
|
75
78
|
hiddenRows: [],
|
|
76
79
|
providerOrder: [],
|
|
77
80
|
cardOrder: [],
|
|
81
|
+
temporalProviderOverrides: {},
|
|
78
82
|
},
|
|
79
83
|
layout: {
|
|
80
84
|
maxWidth: 50,
|
package/dist/lib/xai.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* OpenCode remains the sole owner of OAuth refresh and opencode.db persistence.
|
|
12
12
|
*/
|
|
13
|
+
import { providerFailureCategoryForHttpStatus, } from "../contracts/provider-failure.js";
|
|
13
14
|
import { sanitizeSingleLineDisplaySnippet } from "./display-sanitize.js";
|
|
14
15
|
import { clampPercent } from "./format-utils.js";
|
|
15
16
|
import { fetchWithTimeout } from "./http.js";
|
|
@@ -206,6 +207,7 @@ export async function queryXaiQuota(options = {}) {
|
|
|
206
207
|
return {
|
|
207
208
|
success: false,
|
|
208
209
|
error: `xAI sign-in could not be refreshed: ${resolvedAuth.error}. Run \`opencode auth login xai\`.`,
|
|
210
|
+
failureCategory: "credentials",
|
|
209
211
|
};
|
|
210
212
|
}
|
|
211
213
|
if (resolvedAuth.state !== "configured")
|
|
@@ -214,8 +216,10 @@ export async function queryXaiQuota(options = {}) {
|
|
|
214
216
|
return {
|
|
215
217
|
success: false,
|
|
216
218
|
error: "xAI OAuth token expired; use xAI in OpenCode to refresh it or reconnect xAI",
|
|
219
|
+
failureCategory: "credentials",
|
|
217
220
|
};
|
|
218
221
|
}
|
|
222
|
+
let responseStatus;
|
|
219
223
|
try {
|
|
220
224
|
const creditsResult = await fetchWithTimeout(CREDITS_URL, {
|
|
221
225
|
request: {
|
|
@@ -224,17 +228,24 @@ export async function queryXaiQuota(options = {}) {
|
|
|
224
228
|
},
|
|
225
229
|
timeoutMs: options.requestTimeoutMs,
|
|
226
230
|
consume: async (response) => {
|
|
231
|
+
responseStatus = response.status;
|
|
227
232
|
if (!response.ok) {
|
|
228
233
|
const body = await response.text();
|
|
229
234
|
return {
|
|
230
235
|
success: false,
|
|
231
236
|
error: `xAI API error ${response.status}: ${safeErrorText(body, resolvedAuth.accessToken)}`,
|
|
237
|
+
failureCategory: providerFailureCategoryForHttpStatus(response.status),
|
|
232
238
|
};
|
|
233
239
|
}
|
|
234
240
|
const payload = await response.json();
|
|
235
241
|
const window = parseCreditsWindow(payload, Date.now());
|
|
236
|
-
if (!window)
|
|
237
|
-
return {
|
|
242
|
+
if (!window) {
|
|
243
|
+
return {
|
|
244
|
+
success: false,
|
|
245
|
+
error: "No weekly quota data",
|
|
246
|
+
failureCategory: "discovery",
|
|
247
|
+
};
|
|
248
|
+
}
|
|
238
249
|
return { success: true, window };
|
|
239
250
|
},
|
|
240
251
|
});
|
|
@@ -247,6 +258,9 @@ export async function queryXaiQuota(options = {}) {
|
|
|
247
258
|
return {
|
|
248
259
|
success: false,
|
|
249
260
|
error: safeErrorText(error instanceof Error ? error.message : String(error), resolvedAuth.accessToken),
|
|
261
|
+
failureCategory: responseStatus === undefined
|
|
262
|
+
? "provider_api"
|
|
263
|
+
: providerFailureCategoryForHttpStatus(responseStatus),
|
|
250
264
|
};
|
|
251
265
|
}
|
|
252
266
|
}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenCode V2 server plugin for the GUI-only product: it starts the
|
|
3
|
-
* dashboard
|
|
4
|
-
*
|
|
2
|
+
* OpenCode V2 server plugin for the GUI-only product: it starts the shared
|
|
3
|
+
* dashboard runtime, attaches the typed dashboard RPC transport, and keeps the
|
|
4
|
+
* credential and quota-reset retry lifecycle working. Inherited terminal
|
|
5
|
+
* surfaces (commands, tool, the TUI quota RPC and report hooks) are retained in
|
|
5
6
|
* their source modules but are not registered by this product.
|
|
6
7
|
*/
|
|
7
8
|
import { Plugin } from "@opencode/plugin";
|
package/dist/plugin.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OpenCode V2 server plugin for the GUI-only product: it starts the
|
|
3
|
-
* dashboard
|
|
4
|
-
*
|
|
2
|
+
* OpenCode V2 server plugin for the GUI-only product: it starts the shared
|
|
3
|
+
* dashboard runtime, attaches the typed dashboard RPC transport, and keeps the
|
|
4
|
+
* credential and quota-reset retry lifecycle working. Inherited terminal
|
|
5
|
+
* surfaces (commands, tool, the TUI quota RPC and report hooks) are retained in
|
|
5
6
|
* their source modules but are not registered by this product.
|
|
6
7
|
*/
|
|
7
8
|
import { Plugin } from "@opencode/plugin";
|
|
8
9
|
import { startDashboard } from "./gui/lifecycle.js";
|
|
10
|
+
import { scrubLogReason } from "./gui/log.js";
|
|
11
|
+
import { registerDashboardRpc } from "./gui/rpc.js";
|
|
9
12
|
import { resolveOpenCodeLocationRoots } from "./lib/config-file-utils.js";
|
|
10
13
|
import { bindCredentialSource, createIntegrationCredentialSource, notifyCredentialsChanged, scrubCredentialErrorText, } from "./lib/opencode-auth.js";
|
|
11
14
|
import { resolveQuotaResetRetryDelayMs } from "./lib/quota-retry-wait.js";
|
|
@@ -14,7 +17,7 @@ function logReason(error) {
|
|
|
14
17
|
return scrubCredentialErrorText(error instanceof Error ? error.message : String(error));
|
|
15
18
|
}
|
|
16
19
|
export const QuotaToastPlugin = Plugin.define({
|
|
17
|
-
id: "opencode-quota-gui
|
|
20
|
+
id: "opencode-quota-gui",
|
|
18
21
|
async setup(ctx) {
|
|
19
22
|
const roots = resolveOpenCodeLocationRoots(ctx.location.directory);
|
|
20
23
|
// The quota collector accepts a small V1-shaped configuration client. V2
|
|
@@ -69,17 +72,43 @@ export const QuotaToastPlugin = Plugin.define({
|
|
|
69
72
|
// first snapshot is computed on the first request.
|
|
70
73
|
let dashboardLease;
|
|
71
74
|
try {
|
|
75
|
+
// Older hosts may not supply `ctx.app` at runtime; an absent or empty
|
|
76
|
+
// version lets the lifecycle use its bounded `opencode --version` probe.
|
|
77
|
+
const hostVersion = ctx.app?.version;
|
|
72
78
|
dashboardLease = await startDashboard({
|
|
73
79
|
client,
|
|
74
80
|
workspaceRoot: ctx.location.directory,
|
|
81
|
+
...(hostVersion !== undefined ? { hostVersion } : {}),
|
|
75
82
|
});
|
|
76
83
|
}
|
|
77
84
|
catch (error) {
|
|
78
85
|
console.warn(`[opencode-quota-gui] dashboard unavailable: ${logReason(error)}`);
|
|
79
86
|
}
|
|
87
|
+
// Attach the native RPC transport to the same host runtime the web
|
|
88
|
+
// transport receives. It is available when web is disabled or its bind
|
|
89
|
+
// failed, and it never constructs another source/snapshot/service.
|
|
90
|
+
let dashboardRpc;
|
|
91
|
+
if (dashboardLease?.runtime && ctx.rpc) {
|
|
92
|
+
try {
|
|
93
|
+
dashboardRpc = await registerDashboardRpc(ctx.rpc, dashboardLease.runtime, {
|
|
94
|
+
location: ctx.location,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
console.warn(`[opencode-quota-gui] dashboard RPC unavailable: registration-failed`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
80
101
|
return async () => {
|
|
81
102
|
credentialEvents.abort();
|
|
82
103
|
unbindCredentialSource();
|
|
104
|
+
if (dashboardRpc) {
|
|
105
|
+
try {
|
|
106
|
+
await dashboardRpc.dispose();
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.warn(`[opencode-quota-gui] dashboard RPC stop failed: ${scrubLogReason(error instanceof Error ? error.message : String(error))}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
83
112
|
if (dashboardLease) {
|
|
84
113
|
try {
|
|
85
114
|
await dashboardLease.dispose();
|
|
@@ -56,7 +56,9 @@ export const alibabaCodingPlanProvider = {
|
|
|
56
56
|
return withStatusDetails(notAttemptedResult(), statusDetails);
|
|
57
57
|
}
|
|
58
58
|
if (plan.state === "invalid") {
|
|
59
|
-
return withStatusDetails(attemptedErrorResult("Alibaba Coding Plan", plan.error
|
|
59
|
+
return withStatusDetails(attemptedErrorResult("Alibaba Coding Plan", plan.error, {
|
|
60
|
+
failureCategory: "credentials",
|
|
61
|
+
}), statusDetails);
|
|
60
62
|
}
|
|
61
63
|
const tuning = findQuotaProviderDefinition(ctx.config.quotaProviders ?? [], "alibaba-coding-plan");
|
|
62
64
|
const limits = tuning?.mode === "local-estimate"
|
|
@@ -38,6 +38,21 @@ function statusDetailsFromResult(result, platform) {
|
|
|
38
38
|
failure_kind: result.error.kind,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
+
function alibabaFailureCategory(kind) {
|
|
42
|
+
switch (kind) {
|
|
43
|
+
case "executable_not_found":
|
|
44
|
+
case "shell_launcher_rejected":
|
|
45
|
+
case "workspace_path_rejected":
|
|
46
|
+
case "spawn_failed":
|
|
47
|
+
return "local";
|
|
48
|
+
case "not_authenticated":
|
|
49
|
+
return "credentials";
|
|
50
|
+
default:
|
|
51
|
+
// Timeout, malformed output, nonzero exit, and unavailable data can come
|
|
52
|
+
// from either the CLI process or the remote console. Absence fails closed.
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
41
56
|
function mapClosedResult(result) {
|
|
42
57
|
if (result.ok) {
|
|
43
58
|
const entries = [];
|
|
@@ -50,8 +65,10 @@ function mapClosedResult(result) {
|
|
|
50
65
|
if (result.error.kind === "unsupported_platform") {
|
|
51
66
|
return notAttemptedResult();
|
|
52
67
|
}
|
|
68
|
+
const failureCategory = alibabaFailureCategory(result.error.kind);
|
|
53
69
|
return attemptedErrorResult(GROUP, result.error.message, {
|
|
54
70
|
retryable: result.error.retryable === true,
|
|
71
|
+
...(failureCategory !== undefined ? { failureCategory } : {}),
|
|
55
72
|
});
|
|
56
73
|
}
|
|
57
74
|
export const alibabaTokenPlanProvider = {
|
|
@@ -84,6 +84,7 @@ export const anthropicProvider = {
|
|
|
84
84
|
? {
|
|
85
85
|
success: false,
|
|
86
86
|
error: `Anthropic sign-in could not be read: ${auth.error}. Run \`opencode auth login anthropic\`.`,
|
|
87
|
+
failureCategory: "credentials",
|
|
87
88
|
}
|
|
88
89
|
: await queryAnthropicQuotaWithOAuth(auth.accessToken, options.requestTimeoutMs),
|
|
89
90
|
})));
|
|
@@ -98,8 +99,14 @@ export const anthropicProvider = {
|
|
|
98
99
|
for (const [index, { row, result }] of results.entries()) {
|
|
99
100
|
const group = names[index] ?? "Claude";
|
|
100
101
|
if (!result?.success) {
|
|
101
|
-
if (result)
|
|
102
|
-
errors.push({
|
|
102
|
+
if (result) {
|
|
103
|
+
errors.push({
|
|
104
|
+
label: group,
|
|
105
|
+
message: result.error,
|
|
106
|
+
sourceId: row.id,
|
|
107
|
+
failureCategory: result.failureCategory,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
103
110
|
continue;
|
|
104
111
|
}
|
|
105
112
|
entries.push(...[
|
|
@@ -164,7 +171,9 @@ export const anthropicProvider = {
|
|
|
164
171
|
return withStatusDetails(notAttemptedResult(), statusDetails);
|
|
165
172
|
}
|
|
166
173
|
if (!result.success) {
|
|
167
|
-
return withStatusDetails(attemptedErrorResult("Claude", result.error
|
|
174
|
+
return withStatusDetails(attemptedErrorResult("Claude", result.error, {
|
|
175
|
+
failureCategory: result.failureCategory,
|
|
176
|
+
}), statusDetails);
|
|
168
177
|
}
|
|
169
178
|
const entries = [
|
|
170
179
|
{
|
|
@@ -274,7 +274,12 @@ export const copilotProvider = {
|
|
|
274
274
|
if (!result)
|
|
275
275
|
continue;
|
|
276
276
|
if (!result.success) {
|
|
277
|
-
errors.push({
|
|
277
|
+
errors.push({
|
|
278
|
+
label: group,
|
|
279
|
+
message: result.error,
|
|
280
|
+
sourceId: row.id,
|
|
281
|
+
failureCategory: result.failureCategory,
|
|
282
|
+
});
|
|
278
283
|
continue;
|
|
279
284
|
}
|
|
280
285
|
const resultEntries = result.mode === "user_plan"
|
|
@@ -292,6 +297,7 @@ export const copilotProvider = {
|
|
|
292
297
|
label: group,
|
|
293
298
|
message,
|
|
294
299
|
sourceId: row.id,
|
|
300
|
+
failureCategory: "provider_api",
|
|
295
301
|
})));
|
|
296
302
|
}
|
|
297
303
|
return withStatusDetails({ ...attemptedResult(entries, errors), accounts }, statusDetails);
|
|
@@ -301,7 +307,9 @@ export const copilotProvider = {
|
|
|
301
307
|
if (!result)
|
|
302
308
|
return withStatusDetails(notAttemptedResult(), statusDetails);
|
|
303
309
|
if (!result.success) {
|
|
304
|
-
return withStatusDetails(attemptedErrorResult("Copilot", result.error
|
|
310
|
+
return withStatusDetails(attemptedErrorResult("Copilot", result.error, {
|
|
311
|
+
failureCategory: result.failureCategory,
|
|
312
|
+
}), statusDetails);
|
|
305
313
|
}
|
|
306
314
|
const entries = result.mode === "user_plan"
|
|
307
315
|
? planEntries(result)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProviderFailureCategory } from "../contracts/provider-failure.js";
|
|
1
2
|
import type { QuotaProvider } from "../lib/entries.js";
|
|
2
3
|
import type { CanonicalQuotaProviderId } from "../lib/provider-metadata.js";
|
|
3
4
|
import type { AuthData } from "../lib/types.js";
|
|
@@ -49,6 +50,7 @@ export declare function createGlmCodingPlanProvider(params: {
|
|
|
49
50
|
}) => Promise<GlmQuotaResult | {
|
|
50
51
|
success: false;
|
|
51
52
|
error: string;
|
|
53
|
+
failureCategory?: ProviderFailureCategory;
|
|
52
54
|
} | null>;
|
|
53
55
|
matchesCurrentModel: (model: string) => boolean;
|
|
54
56
|
}): QuotaProvider;
|
|
@@ -67,7 +67,11 @@ export function createGlmCodingPlanProvider(params) {
|
|
|
67
67
|
const results = await Promise.all(credentials.map(async ({ row, auth }) => ({
|
|
68
68
|
row,
|
|
69
69
|
result: auth.state === "invalid"
|
|
70
|
-
? {
|
|
70
|
+
? {
|
|
71
|
+
success: false,
|
|
72
|
+
error: auth.error,
|
|
73
|
+
failureCategory: "credentials",
|
|
74
|
+
}
|
|
71
75
|
: await params.queryQuota({
|
|
72
76
|
requestTimeoutMs: ctx.config?.requestTimeoutMs,
|
|
73
77
|
apiKey: auth.apiKey,
|
|
@@ -47,6 +47,7 @@ export function formatGoogleAccountErrors(errors, style, labels) {
|
|
|
47
47
|
return errors.map((error) => ({
|
|
48
48
|
label: (error.email && labels?.get(error.email)) ?? formatGoogleAccountLabel(error.email, style),
|
|
49
49
|
message: error.error,
|
|
50
|
+
...(error.failureCategory !== undefined ? { failureCategory: error.failureCategory } : {}),
|
|
50
51
|
}));
|
|
51
52
|
}
|
|
52
53
|
//# sourceMappingURL=google-account-format.js.map
|
|
@@ -168,7 +168,12 @@ export const googleAgyProvider = {
|
|
|
168
168
|
if (!result)
|
|
169
169
|
continue;
|
|
170
170
|
if (!result.success) {
|
|
171
|
-
errors.push({
|
|
171
|
+
errors.push({
|
|
172
|
+
label: credentialName,
|
|
173
|
+
message: result.error,
|
|
174
|
+
sourceId: row.id,
|
|
175
|
+
failureCategory: result.failureCategory,
|
|
176
|
+
});
|
|
172
177
|
continue;
|
|
173
178
|
}
|
|
174
179
|
for (const bucket of [...result.buckets].sort(compareBuckets)) {
|
|
@@ -197,6 +202,9 @@ export const googleAgyProvider = {
|
|
|
197
202
|
label: credentialName,
|
|
198
203
|
message: error.error,
|
|
199
204
|
sourceId: row.id,
|
|
205
|
+
...(error.failureCategory !== undefined
|
|
206
|
+
? { failureCategory: error.failureCategory }
|
|
207
|
+
: {}),
|
|
200
208
|
})));
|
|
201
209
|
}
|
|
202
210
|
return withStatusDetails({ ...attemptedResult(entries, errors, { singleWindowShowRight: true }), accounts }, statusDetails);
|
|
@@ -210,7 +218,9 @@ export const googleAgyProvider = {
|
|
|
210
218
|
return withStatusDetails(notAttemptedResult(), statusDetails);
|
|
211
219
|
}
|
|
212
220
|
if (!result.success) {
|
|
213
|
-
return withStatusDetails(attemptedErrorResult("Google AGY", result.error
|
|
221
|
+
return withStatusDetails(attemptedErrorResult("Google AGY", result.error, {
|
|
222
|
+
failureCategory: result.failureCategory,
|
|
223
|
+
}), statusDetails);
|
|
214
224
|
}
|
|
215
225
|
const sortedBuckets = [...result.buckets].sort(compareBuckets);
|
|
216
226
|
const accountLabels = createGoogleAccountLabelMap([
|
|
@@ -112,7 +112,12 @@ export const googleGeminiCliProvider = {
|
|
|
112
112
|
if (!result)
|
|
113
113
|
continue;
|
|
114
114
|
if (!result.success) {
|
|
115
|
-
errors.push({
|
|
115
|
+
errors.push({
|
|
116
|
+
label: group,
|
|
117
|
+
message: result.error,
|
|
118
|
+
sourceId: row.id,
|
|
119
|
+
failureCategory: result.failureCategory,
|
|
120
|
+
});
|
|
116
121
|
continue;
|
|
117
122
|
}
|
|
118
123
|
for (const bucket of result.buckets) {
|
|
@@ -150,6 +155,9 @@ export const googleGeminiCliProvider = {
|
|
|
150
155
|
label: group,
|
|
151
156
|
message: error.error,
|
|
152
157
|
sourceId: row.id,
|
|
158
|
+
...(error.failureCategory !== undefined
|
|
159
|
+
? { failureCategory: error.failureCategory }
|
|
160
|
+
: {}),
|
|
153
161
|
})));
|
|
154
162
|
}
|
|
155
163
|
return withStatusDetails({
|
|
@@ -169,7 +177,9 @@ export const googleGeminiCliProvider = {
|
|
|
169
177
|
return withStatusDetails(notAttemptedResult(), statusDetails);
|
|
170
178
|
}
|
|
171
179
|
if (!result.success) {
|
|
172
|
-
return withStatusDetails(attemptedErrorResult("Gemini CLI", result.error
|
|
180
|
+
return withStatusDetails(attemptedErrorResult("Gemini CLI", result.error, {
|
|
181
|
+
failureCategory: result.failureCategory,
|
|
182
|
+
}), statusDetails);
|
|
173
183
|
}
|
|
174
184
|
const accountLabels = createGoogleAccountLabelMap([
|
|
175
185
|
...result.buckets.map((bucket) => bucket.accountEmail),
|
package/dist/providers/kilo.js
CHANGED
|
@@ -130,7 +130,15 @@ export const kiloProvider = {
|
|
|
130
130
|
return withStatusDetails({
|
|
131
131
|
attempted: true,
|
|
132
132
|
entries: [],
|
|
133
|
-
errors: [
|
|
133
|
+
errors: [
|
|
134
|
+
{
|
|
135
|
+
label: "Kilo Gateway",
|
|
136
|
+
message: stateResult.error,
|
|
137
|
+
...(stateResult.failureCategory !== undefined
|
|
138
|
+
? { failureCategory: stateResult.failureCategory }
|
|
139
|
+
: {}),
|
|
140
|
+
},
|
|
141
|
+
],
|
|
134
142
|
}, keyStatusDetails);
|
|
135
143
|
}
|
|
136
144
|
const providerResult = stateResult.mode === "kilo_pass"
|
|
@@ -62,6 +62,7 @@ function createKimiProvider(spec) {
|
|
|
62
62
|
label: displayNamesByRowId.get(row.id) ?? spec.label,
|
|
63
63
|
message: rowAuth.error,
|
|
64
64
|
sourceId: row.id,
|
|
65
|
+
failureCategory: "credentials",
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
return rowAuth.state === "configured" ? [{ row, auth: rowAuth }] : [];
|
|
@@ -86,7 +87,12 @@ function createKimiProvider(spec) {
|
|
|
86
87
|
for (const { row, result } of results) {
|
|
87
88
|
const group = displayNamesByRowId.get(row.id) ?? spec.label;
|
|
88
89
|
if (!result.success) {
|
|
89
|
-
errors.push({
|
|
90
|
+
errors.push({
|
|
91
|
+
label: group,
|
|
92
|
+
message: result.error,
|
|
93
|
+
sourceId: row.id,
|
|
94
|
+
failureCategory: result.failureCategory,
|
|
95
|
+
});
|
|
90
96
|
continue;
|
|
91
97
|
}
|
|
92
98
|
entries.push(...result.windows.map((window) => ({
|
|
@@ -110,7 +116,7 @@ function createKimiProvider(spec) {
|
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
118
|
if (auth.state === "invalid") {
|
|
113
|
-
return withStatusDetails(attemptedErrorResult(spec.label, auth.error), authDetails);
|
|
119
|
+
return withStatusDetails(attemptedErrorResult(spec.label, auth.error, { failureCategory: "credentials" }), authDetails);
|
|
114
120
|
}
|
|
115
121
|
const result = await queryKimiQuota({
|
|
116
122
|
apiKey: auth.apiKey,
|
|
@@ -119,10 +125,9 @@ function createKimiProvider(spec) {
|
|
|
119
125
|
requestTimeoutMs: ctx.config?.requestTimeoutMs,
|
|
120
126
|
});
|
|
121
127
|
if (!result.success) {
|
|
122
|
-
return withStatusDetails(attemptedErrorResult(spec.label, result.error
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
]);
|
|
128
|
+
return withStatusDetails(attemptedErrorResult(spec.label, result.error, {
|
|
129
|
+
failureCategory: result.failureCategory,
|
|
130
|
+
}), [...authDetails, { key: "live_fetch_error", value: result.error }]);
|
|
126
131
|
}
|
|
127
132
|
const entries = result.windows.map((window) => ({
|
|
128
133
|
accounting: {
|
package/dist/providers/mimo.js
CHANGED
|
@@ -70,7 +70,11 @@ function endpointErrors(result) {
|
|
|
70
70
|
const errors = [];
|
|
71
71
|
for (const endpoint of [result.usage, result.detail, result.balance]) {
|
|
72
72
|
if (endpoint.state === "error") {
|
|
73
|
-
errors.push({
|
|
73
|
+
errors.push({
|
|
74
|
+
label: MIMO_LABEL,
|
|
75
|
+
message: endpoint.error,
|
|
76
|
+
failureCategory: endpoint.failureCategory,
|
|
77
|
+
});
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
return errors;
|
|
@@ -101,7 +105,9 @@ export const xiaomiProvider = {
|
|
|
101
105
|
if (config.state === "none")
|
|
102
106
|
return withStatusDetails(notAttemptedResult(), statusDetails);
|
|
103
107
|
if (config.state === "invalid") {
|
|
104
|
-
return withStatusDetails(attemptedErrorResult(MIMO_LABEL, `Invalid config (${config.source}): ${config.error}
|
|
108
|
+
return withStatusDetails(attemptedErrorResult(MIMO_LABEL, `Invalid config (${config.source}): ${config.error}`, {
|
|
109
|
+
failureCategory: "local",
|
|
110
|
+
}), statusDetails);
|
|
105
111
|
}
|
|
106
112
|
const result = await queryMimoDashboard(config.config.cookie, {
|
|
107
113
|
requestTimeoutMs: ctx.config?.requestTimeoutMsConfigured
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* the structured accounting core: `basis` (used/limit/remaining facts with
|
|
6
6
|
* authority), `semantic` (metric + prominence), and `accounting` metadata.
|
|
7
7
|
*/
|
|
8
|
+
import { providerFailureCategoryForHttpStatus } from "../contracts/provider-failure.js";
|
|
8
9
|
import { sanitizeDisplayText } from "../lib/display-sanitize.js";
|
|
9
10
|
import { fetchWithTimeout } from "../lib/http.js";
|
|
10
11
|
import { DEFAULT_MINIMAX_AUTH_CACHE_MAX_AGE_MS, getMiniMaxAuthDiagnostics, getMiniMaxChinaAuthDiagnostics, resolveMiniMaxAuth, resolveMiniMaxAuthCached, resolveMiniMaxChinaAuth, resolveMiniMaxChinaAuthCached, } from "../lib/minimax-auth.js";
|
|
@@ -168,6 +169,14 @@ function selectCanonicalMiniMaxModel(models, endpointId) {
|
|
|
168
169
|
return left.model_name.localeCompare(right.model_name);
|
|
169
170
|
})[0] ?? null);
|
|
170
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* MiniMax `base_resp.status_code` is an application code, not an HTTP status.
|
|
174
|
+
* Only the documented authentication code maps to credentials; every other
|
|
175
|
+
* application code stays unclassified, and the message text never classifies.
|
|
176
|
+
*/
|
|
177
|
+
function minimaxApplicationFailureCategory(statusCode) {
|
|
178
|
+
return statusCode === 1004 ? "credentials" : undefined;
|
|
179
|
+
}
|
|
171
180
|
/**
|
|
172
181
|
* Fetch MiniMax Token Plan quota from the API.
|
|
173
182
|
*
|
|
@@ -180,6 +189,7 @@ function selectCanonicalMiniMaxModel(models, endpointId) {
|
|
|
180
189
|
export async function queryMiniMaxQuota(apiKey, options = {}) {
|
|
181
190
|
const endpointId = options.endpoint ?? "international";
|
|
182
191
|
const endpoint = getMiniMaxQuotaEndpoint(endpointId);
|
|
192
|
+
let responseStatus;
|
|
183
193
|
try {
|
|
184
194
|
return await fetchWithTimeout(endpoint.quotaUrl, {
|
|
185
195
|
request: {
|
|
@@ -191,13 +201,17 @@ export async function queryMiniMaxQuota(apiKey, options = {}) {
|
|
|
191
201
|
},
|
|
192
202
|
timeoutMs: options.requestTimeoutMs,
|
|
193
203
|
consume: async (response) => {
|
|
204
|
+
responseStatus = response.status;
|
|
194
205
|
if (!response.ok) {
|
|
195
206
|
const text = await response.text();
|
|
196
|
-
return attemptedErrorResult(options.label ?? MINIMAX_PROVIDER_LABEL, `MiniMax API error ${response.status}: ${sanitizeMiniMaxMessage(text, 120)}
|
|
207
|
+
return attemptedErrorResult(options.label ?? MINIMAX_PROVIDER_LABEL, `MiniMax API error ${response.status}: ${sanitizeMiniMaxMessage(text, 120)}`, { failureCategory: providerFailureCategoryForHttpStatus(response.status) });
|
|
197
208
|
}
|
|
198
209
|
const payload = (await response.json());
|
|
199
210
|
if (payload.base_resp?.status_code !== 0) {
|
|
200
|
-
|
|
211
|
+
const applicationFailureCategory = minimaxApplicationFailureCategory(payload.base_resp?.status_code);
|
|
212
|
+
return attemptedErrorResult(options.label ?? MINIMAX_PROVIDER_LABEL, `MiniMax API error: ${sanitizeMiniMaxMessage(payload.base_resp?.status_msg ?? "unknown")}`, applicationFailureCategory !== undefined
|
|
213
|
+
? { failureCategory: applicationFailureCategory }
|
|
214
|
+
: {});
|
|
201
215
|
}
|
|
202
216
|
const matchingModels = (payload.model_remains ?? []).filter((model) => isMiniMaxModelRecord(model) && isMiniMaxCodingModelName(model.model_name));
|
|
203
217
|
const canonicalModel = selectCanonicalMiniMaxModel(matchingModels, endpointId);
|
|
@@ -209,7 +223,11 @@ export async function queryMiniMaxQuota(apiKey, options = {}) {
|
|
|
209
223
|
});
|
|
210
224
|
}
|
|
211
225
|
catch (err) {
|
|
212
|
-
return attemptedErrorResult(options.label ?? MINIMAX_PROVIDER_LABEL, sanitizeMiniMaxMessage(err instanceof Error ? err.message : String(err))
|
|
226
|
+
return attemptedErrorResult(options.label ?? MINIMAX_PROVIDER_LABEL, sanitizeMiniMaxMessage(err instanceof Error ? err.message : String(err)), {
|
|
227
|
+
failureCategory: responseStatus === undefined
|
|
228
|
+
? "provider_api"
|
|
229
|
+
: providerFailureCategoryForHttpStatus(responseStatus),
|
|
230
|
+
});
|
|
213
231
|
}
|
|
214
232
|
}
|
|
215
233
|
function isMiniMaxChinaExplicitlyEnabled(context) {
|
|
@@ -295,6 +313,7 @@ function createMiniMaxProvider(spec) {
|
|
|
295
313
|
label: displayNamesByRowId.get(row.id) ?? spec.label,
|
|
296
314
|
message: rowAuth.error,
|
|
297
315
|
sourceId: row.id,
|
|
316
|
+
failureCategory: "credentials",
|
|
298
317
|
});
|
|
299
318
|
}
|
|
300
319
|
return rowAuth.state === "configured" ? [{ row, auth: rowAuth }] : [];
|
|
@@ -334,7 +353,7 @@ function createMiniMaxProvider(spec) {
|
|
|
334
353
|
}
|
|
335
354
|
}
|
|
336
355
|
if (auth.state === "invalid") {
|
|
337
|
-
return withStatusDetails(attemptedErrorResult(spec.label, auth.error), statusDetails);
|
|
356
|
+
return withStatusDetails(attemptedErrorResult(spec.label, auth.error, { failureCategory: "credentials" }), statusDetails);
|
|
338
357
|
}
|
|
339
358
|
const result = await queryMiniMaxQuota(auth.apiKey, {
|
|
340
359
|
endpoint: spec.endpoint,
|
|
@@ -343,7 +362,11 @@ function createMiniMaxProvider(spec) {
|
|
|
343
362
|
});
|
|
344
363
|
if (result.errors.length > 0) {
|
|
345
364
|
const firstError = result.errors[0];
|
|
346
|
-
return withStatusDetails(attemptedErrorResult(spec.label, firstError?.message ?? "MiniMax API error"
|
|
365
|
+
return withStatusDetails(attemptedErrorResult(spec.label, firstError?.message ?? "MiniMax API error", {
|
|
366
|
+
...(firstError?.failureCategory !== undefined
|
|
367
|
+
? { failureCategory: firstError.failureCategory }
|
|
368
|
+
: {}),
|
|
369
|
+
}), [
|
|
347
370
|
...statusDetails,
|
|
348
371
|
{ key: "live_fetch_error", value: firstError?.message ?? "MiniMax API error" },
|
|
349
372
|
]);
|
|
@@ -66,6 +66,7 @@ function mapNanoGptSuccess(result) {
|
|
|
66
66
|
const errors = result.endpointErrors?.map((entry) => ({
|
|
67
67
|
label: entry.endpoint === "usage" ? "NanoGPT Usage" : "NanoGPT Balance",
|
|
68
68
|
message: entry.message,
|
|
69
|
+
...(entry.failureCategory !== undefined ? { failureCategory: entry.failureCategory } : {}),
|
|
69
70
|
})) ?? [];
|
|
70
71
|
const subscription = result.subscription;
|
|
71
72
|
if (subscription?.daily)
|
|
@@ -97,12 +98,14 @@ function mapNanoGptSuccess(result) {
|
|
|
97
98
|
errors.push({
|
|
98
99
|
label: "NanoGPT",
|
|
99
100
|
message: `Subscription state: ${subscription.state}`,
|
|
101
|
+
failureCategory: "discovery",
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
104
|
if (entries.length === 0) {
|
|
103
105
|
errors.push({
|
|
104
106
|
label: "NanoGPT",
|
|
105
107
|
message: "No usable NanoGPT quota or balance data",
|
|
108
|
+
failureCategory: "discovery",
|
|
106
109
|
});
|
|
107
110
|
}
|
|
108
111
|
const formatSubscriptionUsage = (usage) => usage
|
|
@@ -71,6 +71,8 @@ function mapOllamaCloudSuccess(result) {
|
|
|
71
71
|
value: `$${result.purchasedUsd.toFixed(2)} left`,
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
+
// Row-level mapping warnings carry no source-assigned category; absence means
|
|
75
|
+
// unknown, so they stay unclassified rather than being inferred as API failures.
|
|
74
76
|
const errors = (result.rowErrors ?? []).map((message) => ({
|
|
75
77
|
label: OLLAMA_CLOUD_PROVIDER_LABEL,
|
|
76
78
|
message,
|
|
@@ -79,6 +81,7 @@ function mapOllamaCloudSuccess(result) {
|
|
|
79
81
|
errors.push({
|
|
80
82
|
label: OLLAMA_CLOUD_PROVIDER_LABEL,
|
|
81
83
|
message: "Ollama Cloud returned no limits or balance",
|
|
84
|
+
failureCategory: "discovery",
|
|
82
85
|
});
|
|
83
86
|
}
|
|
84
87
|
return withStatusDetails(attemptedResult(entries, errors), [
|