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
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Anthropic
|
|
2
|
+
* Anthropic provider: OpenCode's own Anthropic logins only.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Subscription quota belongs to Claude Agent. API credentials expose no comparable quota here.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { AnthropicQuotaResult } from "../lib/anthropic.js";
|
|
7
|
+
import type { QuotaProvider, QuotaToastEntry } from "../lib/entries.js";
|
|
7
8
|
export declare function getAnthropicNoDataMessage(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Map subscription quota returned for the Claude Agent CLI login.
|
|
11
|
+
*/
|
|
12
|
+
export declare function anthropicQuotaEntries(quota: AnthropicQuotaResult, params: {
|
|
13
|
+
group: string;
|
|
14
|
+
acquisitionMethod: QuotaToastEntry["accounting"]["acquisitionMethod"];
|
|
15
|
+
sourceId?: string;
|
|
16
|
+
}): QuotaToastEntry[];
|
|
8
17
|
export declare const anthropicProvider: QuotaProvider;
|
|
9
18
|
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -1,236 +1,88 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Anthropic
|
|
2
|
+
* Anthropic provider: OpenCode's own Anthropic logins only.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Subscription quota belongs to Claude Agent. API credentials expose no comparable quota here.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { sanitizeDisplayText } from "../lib/display-sanitize.js";
|
|
9
|
-
import { credentialRowAuthEntry, formatCredentialDisplayNames, readCredentialRows, } from "../lib/opencode-auth.js";
|
|
10
|
-
import { isCanonicalProviderAvailable } from "../lib/provider-availability.js";
|
|
11
|
-
import { attemptedErrorResult, attemptedResult, notAttemptedResult, statusDetailsFromRecord, withStatusDetails, } from "./result-helpers.js";
|
|
6
|
+
import { resolveQuotaProviderSessionModelIdentity } from "../lib/quota-providers.js";
|
|
7
|
+
import { attemptedErrorResult, notAttemptedResult, statusDetailsFromRecord, withStatusDetails, } from "./result-helpers.js";
|
|
12
8
|
export function getAnthropicNoDataMessage() {
|
|
13
|
-
return "
|
|
9
|
+
return "Anthropic API quota unavailable";
|
|
10
|
+
}
|
|
11
|
+
const ANTHROPIC_API_QUOTA_UNAVAILABLE_MESSAGE = "Anthropic API quota is unavailable.";
|
|
12
|
+
/**
|
|
13
|
+
* Map subscription quota returned for the Claude Agent CLI login.
|
|
14
|
+
*/
|
|
15
|
+
export function anthropicQuotaEntries(quota, params) {
|
|
16
|
+
const { group } = params;
|
|
17
|
+
const accounting = {
|
|
18
|
+
resultType: "quota",
|
|
19
|
+
acquisitionMethod: params.acquisitionMethod,
|
|
20
|
+
ownership: "maintained",
|
|
21
|
+
authority: "provider_reported",
|
|
22
|
+
...(params.sourceId !== undefined ? { sourceId: params.sourceId } : {}),
|
|
23
|
+
};
|
|
24
|
+
const entries = [];
|
|
25
|
+
for (const [label, window, rowKey] of [
|
|
26
|
+
["5h", quota.five_hour, "window:five_hour"],
|
|
27
|
+
["Weekly", quota.seven_day, "window:week"],
|
|
28
|
+
]) {
|
|
29
|
+
if (!window)
|
|
30
|
+
continue;
|
|
31
|
+
entries.push({
|
|
32
|
+
accounting: { ...accounting },
|
|
33
|
+
name: `${group} ${label}`,
|
|
34
|
+
group,
|
|
35
|
+
label: `${label}:`,
|
|
36
|
+
rowKey,
|
|
37
|
+
percentRemaining: window.percentRemaining,
|
|
38
|
+
resetTimeIso: window.resetTimeIso,
|
|
39
|
+
...(window.fixedWindow ? { fixedWindow: { ...window.fixedWindow } } : {}),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (quota.extra_usage) {
|
|
43
|
+
entries.push({
|
|
44
|
+
accounting: { ...accounting },
|
|
45
|
+
name: `${group} Usage Credits`,
|
|
46
|
+
group: `${group} Usage Credits`,
|
|
47
|
+
label: "Monthly:",
|
|
48
|
+
rowKey: "window:month",
|
|
49
|
+
percentRemaining: quota.extra_usage.percentRemaining,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (quota.fable_weekly) {
|
|
53
|
+
entries.push({
|
|
54
|
+
accounting: { ...accounting },
|
|
55
|
+
name: `${group} Fable Weekly`,
|
|
56
|
+
group,
|
|
57
|
+
label: "Fable:",
|
|
58
|
+
semantic: {
|
|
59
|
+
metric: { kind: "named", name: "Fable weekly" },
|
|
60
|
+
prominence: "primary",
|
|
61
|
+
},
|
|
62
|
+
percentRemaining: quota.fable_weekly.percentRemaining,
|
|
63
|
+
resetTimeIso: quota.fable_weekly.resetTimeIso,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return entries;
|
|
14
67
|
}
|
|
15
68
|
export const anthropicProvider = {
|
|
16
69
|
id: "anthropic",
|
|
17
70
|
async isAvailable(ctx) {
|
|
18
|
-
|
|
19
|
-
ctx
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (!providerAvailable) {
|
|
24
|
-
return false;
|
|
71
|
+
if (ctx.config?.onlyCurrentModel === true) {
|
|
72
|
+
const selected = ctx.config.currentProviderID ??
|
|
73
|
+
resolveQuotaProviderSessionModelIdentity({ currentModel: ctx.config.currentModel ?? "" })
|
|
74
|
+
?.providerId;
|
|
75
|
+
return selected?.trim().toLowerCase() === "anthropic";
|
|
25
76
|
}
|
|
26
|
-
return
|
|
27
|
-
binaryPath: ctx.config?.anthropicBinaryPath,
|
|
28
|
-
});
|
|
77
|
+
return false;
|
|
29
78
|
},
|
|
30
79
|
matchesCurrentModel(model) {
|
|
31
80
|
return model.toLowerCase().startsWith("anthropic/");
|
|
32
81
|
},
|
|
33
82
|
async fetch(ctx) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
let statusDetails;
|
|
39
|
-
let acquisitionMethod = "local_cli";
|
|
40
|
-
// A failed login stays in the list so it shows as its own error row.
|
|
41
|
-
const databaseCredentials = (await readCredentialRows(["anthropic"], { methods: ["oauth"] })).flatMap((row) => {
|
|
42
|
-
if (row.integrationId !== "anthropic")
|
|
43
|
-
return [];
|
|
44
|
-
const auth = resolveAnthropicOAuth({ anthropic: credentialRowAuthEntry(row) });
|
|
45
|
-
return auth.state === "configured" || auth.state === "failed" ? [{ row, auth }] : [];
|
|
46
|
-
});
|
|
47
|
-
try {
|
|
48
|
-
const diagnostics = await getAnthropicDiagnostics(options);
|
|
49
|
-
const quota = diagnostics.quotaSupported ? diagnostics.quota : undefined;
|
|
50
|
-
if (diagnostics.quotaSupported && diagnostics.quotaSource !== "claude-auth-status-json") {
|
|
51
|
-
acquisitionMethod = "remote_api";
|
|
52
|
-
}
|
|
53
|
-
statusDetails = statusDetailsFromRecord({
|
|
54
|
-
cli_installed: diagnostics.installed ? "true" : "false",
|
|
55
|
-
cli_version: diagnostics.version ?? "(none)",
|
|
56
|
-
binary_path: diagnostics.binaryPath ?? "(none)",
|
|
57
|
-
auth_status: diagnostics.authStatus,
|
|
58
|
-
quota_supported: diagnostics.quotaSupported ? "true" : "false",
|
|
59
|
-
quota_source: diagnostics.quotaSource === "none" ? "(none)" : diagnostics.quotaSource,
|
|
60
|
-
oauth_credential_source: diagnostics.oauthCredentialSource ?? "(none)",
|
|
61
|
-
checked_commands: diagnostics.checkedCommands.join(" | ") || "(none)",
|
|
62
|
-
message: diagnostics.message,
|
|
63
|
-
five_hour_remaining: quota
|
|
64
|
-
? `${quota.five_hour.percentRemaining}% reset_at=${quota.five_hour.resetTimeIso ?? "(none)"}`
|
|
65
|
-
: undefined,
|
|
66
|
-
seven_day_remaining: quota
|
|
67
|
-
? `${quota.seven_day.percentRemaining}% reset_at=${quota.seven_day.resetTimeIso ?? "(none)"}`
|
|
68
|
-
: undefined,
|
|
69
|
-
fable_weekly_remaining: quota?.fable_weekly
|
|
70
|
-
? `${quota.fable_weekly.percentRemaining}% reset_at=${quota.fable_weekly.resetTimeIso ?? "(none)"}`
|
|
71
|
-
: undefined,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
statusDetails = statusDetailsFromRecord({
|
|
76
|
-
cli_installed: "false",
|
|
77
|
-
message: `failed to probe Claude CLI: ${sanitizeDisplayText(error instanceof Error ? error.message : String(error))}`,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
if (databaseCredentials.length > 0) {
|
|
81
|
-
const results = await Promise.all(databaseCredentials.map(async ({ row, auth }) => ({
|
|
82
|
-
row,
|
|
83
|
-
result: auth.state === "failed"
|
|
84
|
-
? {
|
|
85
|
-
success: false,
|
|
86
|
-
error: `Anthropic sign-in could not be read: ${auth.error}. Run \`opencode auth login anthropic\`.`,
|
|
87
|
-
}
|
|
88
|
-
: await queryAnthropicQuotaWithOAuth(auth.accessToken, options.requestTimeoutMs),
|
|
89
|
-
})));
|
|
90
|
-
const names = formatCredentialDisplayNames("Claude", results.map(({ row }) => ({ row, fallbackName: "Claude" })));
|
|
91
|
-
const accounts = results.map(({ row }, index) => ({
|
|
92
|
-
sourceId: row.id,
|
|
93
|
-
label: names[index] ?? "Claude",
|
|
94
|
-
active: row.active,
|
|
95
|
-
}));
|
|
96
|
-
const entries = [];
|
|
97
|
-
const errors = [];
|
|
98
|
-
for (const [index, { row, result }] of results.entries()) {
|
|
99
|
-
const group = names[index] ?? "Claude";
|
|
100
|
-
if (!result?.success) {
|
|
101
|
-
if (result)
|
|
102
|
-
errors.push({ label: group, message: result.error, sourceId: row.id });
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
entries.push(...[
|
|
106
|
-
["5h", result.five_hour, "window:five_hour"],
|
|
107
|
-
["Weekly", result.seven_day, "window:week"],
|
|
108
|
-
].map(([label, window, rowKey]) => ({
|
|
109
|
-
accounting: {
|
|
110
|
-
resultType: "quota",
|
|
111
|
-
acquisitionMethod: "remote_api",
|
|
112
|
-
ownership: "maintained",
|
|
113
|
-
authority: "provider_reported",
|
|
114
|
-
sourceId: row.id,
|
|
115
|
-
},
|
|
116
|
-
name: `${group} ${label}`,
|
|
117
|
-
group,
|
|
118
|
-
label: `${label}:`,
|
|
119
|
-
rowKey,
|
|
120
|
-
percentRemaining: window.percentRemaining,
|
|
121
|
-
resetTimeIso: window.resetTimeIso,
|
|
122
|
-
})));
|
|
123
|
-
if (result.extra_usage) {
|
|
124
|
-
entries.push({
|
|
125
|
-
accounting: {
|
|
126
|
-
resultType: "quota",
|
|
127
|
-
acquisitionMethod: "remote_api",
|
|
128
|
-
ownership: "maintained",
|
|
129
|
-
authority: "provider_reported",
|
|
130
|
-
sourceId: row.id,
|
|
131
|
-
},
|
|
132
|
-
name: `${group} Usage Credits`,
|
|
133
|
-
group: `${group} Usage Credits`,
|
|
134
|
-
label: "Monthly:",
|
|
135
|
-
rowKey: "window:month",
|
|
136
|
-
percentRemaining: result.extra_usage.percentRemaining,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
if (result.fable_weekly) {
|
|
140
|
-
entries.push({
|
|
141
|
-
accounting: {
|
|
142
|
-
resultType: "quota",
|
|
143
|
-
acquisitionMethod: "remote_api",
|
|
144
|
-
ownership: "maintained",
|
|
145
|
-
authority: "provider_reported",
|
|
146
|
-
sourceId: row.id,
|
|
147
|
-
},
|
|
148
|
-
name: `${group} Fable Weekly`,
|
|
149
|
-
group,
|
|
150
|
-
label: "Fable:",
|
|
151
|
-
semantic: {
|
|
152
|
-
metric: { kind: "named", name: "Fable weekly" },
|
|
153
|
-
prominence: "primary",
|
|
154
|
-
},
|
|
155
|
-
percentRemaining: result.fable_weekly.percentRemaining,
|
|
156
|
-
resetTimeIso: result.fable_weekly.resetTimeIso,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return withStatusDetails({ ...attemptedResult(entries, errors), accounts }, statusDetails);
|
|
161
|
-
}
|
|
162
|
-
const result = await queryAnthropicQuota(options);
|
|
163
|
-
if (!result) {
|
|
164
|
-
return withStatusDetails(notAttemptedResult(), statusDetails);
|
|
165
|
-
}
|
|
166
|
-
if (!result.success) {
|
|
167
|
-
return withStatusDetails(attemptedErrorResult("Claude", result.error), statusDetails);
|
|
168
|
-
}
|
|
169
|
-
const entries = [
|
|
170
|
-
{
|
|
171
|
-
accounting: {
|
|
172
|
-
resultType: "quota",
|
|
173
|
-
acquisitionMethod,
|
|
174
|
-
ownership: "maintained",
|
|
175
|
-
authority: "provider_reported",
|
|
176
|
-
},
|
|
177
|
-
name: "Claude 5h",
|
|
178
|
-
group: "Claude",
|
|
179
|
-
label: "5h:",
|
|
180
|
-
rowKey: "window:five_hour",
|
|
181
|
-
percentRemaining: result.five_hour.percentRemaining,
|
|
182
|
-
resetTimeIso: result.five_hour.resetTimeIso,
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
accounting: {
|
|
186
|
-
resultType: "quota",
|
|
187
|
-
acquisitionMethod,
|
|
188
|
-
ownership: "maintained",
|
|
189
|
-
authority: "provider_reported",
|
|
190
|
-
},
|
|
191
|
-
name: "Claude Weekly",
|
|
192
|
-
group: "Claude",
|
|
193
|
-
label: "Weekly:",
|
|
194
|
-
rowKey: "window:week",
|
|
195
|
-
percentRemaining: result.seven_day.percentRemaining,
|
|
196
|
-
resetTimeIso: result.seven_day.resetTimeIso,
|
|
197
|
-
},
|
|
198
|
-
];
|
|
199
|
-
if (result.extra_usage) {
|
|
200
|
-
entries.push({
|
|
201
|
-
accounting: {
|
|
202
|
-
resultType: "quota",
|
|
203
|
-
acquisitionMethod,
|
|
204
|
-
ownership: "maintained",
|
|
205
|
-
authority: "provider_reported",
|
|
206
|
-
},
|
|
207
|
-
name: "Claude Usage Credits",
|
|
208
|
-
group: "Claude Usage Credits",
|
|
209
|
-
label: "Monthly:",
|
|
210
|
-
rowKey: "window:month",
|
|
211
|
-
percentRemaining: result.extra_usage.percentRemaining,
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
if (result.fable_weekly) {
|
|
215
|
-
entries.push({
|
|
216
|
-
accounting: {
|
|
217
|
-
resultType: "quota",
|
|
218
|
-
acquisitionMethod,
|
|
219
|
-
ownership: "maintained",
|
|
220
|
-
authority: "provider_reported",
|
|
221
|
-
},
|
|
222
|
-
name: "Claude Fable Weekly",
|
|
223
|
-
group: "Claude",
|
|
224
|
-
label: "Fable:",
|
|
225
|
-
semantic: {
|
|
226
|
-
metric: { kind: "named", name: "Fable weekly" },
|
|
227
|
-
prominence: "primary",
|
|
228
|
-
},
|
|
229
|
-
percentRemaining: result.fable_weekly.percentRemaining,
|
|
230
|
-
resetTimeIso: result.fable_weekly.resetTimeIso,
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
return withStatusDetails(attemptedResult(entries), statusDetails);
|
|
83
|
+
return withStatusDetails(ctx.config?.onlyCurrentModel
|
|
84
|
+
? attemptedErrorResult("Anthropic", ANTHROPIC_API_QUOTA_UNAVAILABLE_MESSAGE)
|
|
85
|
+
: notAttemptedResult(), statusDetailsFromRecord({}));
|
|
234
86
|
},
|
|
235
87
|
};
|
|
236
88
|
//# sourceMappingURL=anthropic.js.map
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import type { QuotaProviderCachePolicy } from "../lib/entries.js";
|
|
1
|
+
import type { QuotaProviderCachePolicy, QuotaProviderContext } from "../lib/entries.js";
|
|
2
2
|
import type { QuotaProviderDefinition } from "../lib/quota-providers.js";
|
|
3
3
|
import { type ResolvedAuthIdentity } from "../lib/resolved-auth-identity.js";
|
|
4
4
|
export declare function resolveQuotaProviderDefinitionAuthIdentity(definition: QuotaProviderDefinition): Promise<ResolvedAuthIdentity | null>;
|
|
5
5
|
export declare const PROVIDER_CACHE_POLICIES: {
|
|
6
6
|
anthropic: {
|
|
7
|
+
readonly kind: "uncached";
|
|
8
|
+
};
|
|
9
|
+
"claude-agent": {
|
|
7
10
|
kind: "resolved-auth";
|
|
8
|
-
|
|
11
|
+
revalidateWithCycleCache: true;
|
|
12
|
+
resolveIdentity: (ctx: QuotaProviderContext) => Promise<ResolvedAuthIdentity | null>;
|
|
9
13
|
};
|
|
10
14
|
copilot: {
|
|
11
15
|
kind: "resolved-auth";
|
|
@@ -26,7 +30,9 @@ export declare const PROVIDER_CACHE_POLICIES: {
|
|
|
26
30
|
"alibaba-token-plan": {
|
|
27
31
|
readonly kind: "uncached";
|
|
28
32
|
};
|
|
29
|
-
"alibaba-coding-plan":
|
|
33
|
+
"alibaba-coding-plan": {
|
|
34
|
+
readonly kind: "uncached";
|
|
35
|
+
};
|
|
30
36
|
synthetic: QuotaProviderCachePolicy;
|
|
31
37
|
chutes: QuotaProviderCachePolicy;
|
|
32
38
|
"google-gemini-cli": {
|
|
@@ -61,7 +67,8 @@ export declare const PROVIDER_CACHE_POLICIES: {
|
|
|
61
67
|
"ollama-cloud": QuotaProviderCachePolicy;
|
|
62
68
|
"quota-providers": {
|
|
63
69
|
kind: "resolved-auth";
|
|
64
|
-
|
|
70
|
+
revalidateWithCycleCache?: true;
|
|
71
|
+
resolveIdentity: (ctx: QuotaProviderContext, cacheContext: import("../lib/entries.js").QuotaProviderCacheContext) => Promise<ResolvedAuthIdentity | null>;
|
|
65
72
|
};
|
|
66
73
|
};
|
|
67
74
|
//# sourceMappingURL=cache-policies.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolveAnthropicAuthIdentity } from "../lib/anthropic.js";
|
|
1
|
+
import { resolveClaudeAgentAccountIdentity } from "../lib/anthropic.js";
|
|
3
2
|
import { resolveChutesApiKey } from "../lib/chutes-config.js";
|
|
4
3
|
import { resolveCopilotAuthIdentity } from "../lib/copilot.js";
|
|
5
4
|
import { resolveDeepSeekApiKey } from "../lib/deepseek-auth.js";
|
|
@@ -21,6 +20,7 @@ import { resolveSyntheticApiKey } from "../lib/synthetic-config.js";
|
|
|
21
20
|
import { resolveXaiAuthIdentity } from "../lib/xai.js";
|
|
22
21
|
import { DEFAULT_ZAI_AUTH_CACHE_MAX_AGE_MS, resolveZaiAuthCached } from "../lib/zai-auth.js";
|
|
23
22
|
import { DEFAULT_ZHIPU_AUTH_CACHE_MAX_AGE_MS, resolveZhipuAuthCached } from "../lib/zhipu-auth.js";
|
|
23
|
+
import { getClaudeAgentRuntimeProviderId, isClaudeAgentRuntimeDetected } from "./claude-agent.js";
|
|
24
24
|
const UNCACHED = { kind: "uncached" };
|
|
25
25
|
function resolvedCredentialPolicy(providerId, resolve) {
|
|
26
26
|
return {
|
|
@@ -111,7 +111,7 @@ const quotaProvidersCachePolicy = {
|
|
|
111
111
|
const definitions = cacheContext.runtimeEligibleQuotaProviders;
|
|
112
112
|
if (!definitions || definitions.length === 0)
|
|
113
113
|
return null;
|
|
114
|
-
const identities = await Promise.all(definitions.map(resolveQuotaProviderDefinitionAuthIdentity));
|
|
114
|
+
const identities = await Promise.all(definitions.map((definition) => resolveQuotaProviderDefinitionAuthIdentity(definition)));
|
|
115
115
|
if (identities.some((identity) => identity === null))
|
|
116
116
|
return null;
|
|
117
117
|
return composeResolvedAuthIdentities({
|
|
@@ -120,10 +120,23 @@ const quotaProvidersCachePolicy = {
|
|
|
120
120
|
});
|
|
121
121
|
},
|
|
122
122
|
};
|
|
123
|
+
/** The Claude CLI login alone. */
|
|
124
|
+
async function claudeAgentIdentity(ctx) {
|
|
125
|
+
const selected = getClaudeAgentRuntimeProviderId(ctx) !== undefined;
|
|
126
|
+
return resolveClaudeAgentAccountIdentity({
|
|
127
|
+
binaryPath: ctx.config.anthropicBinaryPath,
|
|
128
|
+
operationCache: ctx.operationCache,
|
|
129
|
+
onlyCurrentModel: ctx.config.onlyCurrentModel === true,
|
|
130
|
+
runtimeDetected: selected ? false : await isClaudeAgentRuntimeDetected(ctx),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
123
133
|
export const PROVIDER_CACHE_POLICIES = {
|
|
124
|
-
anthropic:
|
|
134
|
+
anthropic: UNCACHED,
|
|
135
|
+
"claude-agent": {
|
|
125
136
|
kind: "resolved-auth",
|
|
126
|
-
|
|
137
|
+
// Identity uses this cycle's CLI probe; repeating it only spawns more processes.
|
|
138
|
+
revalidateWithCycleCache: true,
|
|
139
|
+
resolveIdentity: (ctx) => claudeAgentIdentity(ctx),
|
|
127
140
|
},
|
|
128
141
|
copilot: {
|
|
129
142
|
kind: "resolved-auth",
|
|
@@ -143,14 +156,7 @@ export const PROVIDER_CACHE_POLICIES = {
|
|
|
143
156
|
}),
|
|
144
157
|
cursor: UNCACHED,
|
|
145
158
|
"alibaba-token-plan": UNCACHED,
|
|
146
|
-
"alibaba-coding-plan":
|
|
147
|
-
const resolved = await resolveAlibabaCodingPlanAuthCached({
|
|
148
|
-
maxAgeMs: DEFAULT_ALIBABA_AUTH_CACHE_MAX_AGE_MS,
|
|
149
|
-
});
|
|
150
|
-
return resolved.state === "configured"
|
|
151
|
-
? { credential: resolved.apiKey, qualifiers: [resolved.tier] }
|
|
152
|
-
: null;
|
|
153
|
-
}),
|
|
159
|
+
"alibaba-coding-plan": UNCACHED,
|
|
154
160
|
synthetic: resolvedCredentialPolicy("synthetic", async () => {
|
|
155
161
|
const resolved = await resolveSyntheticApiKey();
|
|
156
162
|
return resolved ? { credential: resolved.key } : null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Agent provider: OpenCode's native Claude Agent integration, backed by the installed Claude
|
|
3
|
+
* CLI login. It is independent of OpenCode's Anthropic logins (see `./anthropic.ts`); it is the
|
|
4
|
+
* only provider that launches the Claude CLI.
|
|
5
|
+
*/
|
|
6
|
+
import type { QuotaProvider, QuotaProviderContext } from "../lib/entries.js";
|
|
7
|
+
/** `claude-agent` is OpenCode's native integration; `claude-code` is its legacy runtime alias. */
|
|
8
|
+
export declare const CLAUDE_AGENT_RUNTIME_IDS: readonly ["claude-agent", "claude-code"];
|
|
9
|
+
export declare function getClaudeAgentNoDataMessage(): string;
|
|
10
|
+
/** The Claude Agent route selected by `onlyCurrentModel`, if any. */
|
|
11
|
+
export declare function getClaudeAgentRuntimeProviderId(ctx: QuotaProviderContext): (typeof CLAUDE_AGENT_RUNTIME_IDS)[number] | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* OpenCode registers Claude Agent independently of the external login; provider presence alone
|
|
14
|
+
* cannot report its auth or quota. The independent CLI probe supplies what it can; it does not
|
|
15
|
+
* establish account equivalence from a matching email or plan.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isClaudeAgentRuntimeDetected(ctx: QuotaProviderContext): Promise<boolean>;
|
|
18
|
+
export declare const claudeAgentProvider: QuotaProvider;
|
|
19
|
+
//# sourceMappingURL=claude-agent.d.ts.map
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Agent provider: OpenCode's native Claude Agent integration, backed by the installed Claude
|
|
3
|
+
* CLI login. It is independent of OpenCode's Anthropic logins (see `./anthropic.ts`); it is the
|
|
4
|
+
* only provider that launches the Claude CLI.
|
|
5
|
+
*/
|
|
6
|
+
import { CLAUDE_AGENT_RESETS_ROW_KEY } from "../contracts/openai-quota.js";
|
|
7
|
+
import { getAnthropicDiagnostics, hasAnthropicCredentialsConfigured } from "../lib/anthropic.js";
|
|
8
|
+
import { QUOTA_FORCE_REFRESH } from "../lib/entries.js";
|
|
9
|
+
import { isAnyProviderIdAvailable } from "../lib/provider-availability.js";
|
|
10
|
+
import { resolveQuotaProviderSessionModelIdentity } from "../lib/quota-providers.js";
|
|
11
|
+
import { anthropicQuotaEntries } from "./anthropic.js";
|
|
12
|
+
import { attemptedErrorResult, attemptedResult, statusDetailsFromRecord, withStatusDetails, } from "./result-helpers.js";
|
|
13
|
+
/** `claude-agent` is OpenCode's native integration; `claude-code` is its legacy runtime alias. */
|
|
14
|
+
export const CLAUDE_AGENT_RUNTIME_IDS = ["claude-agent", "claude-code"];
|
|
15
|
+
const CLAUDE_AGENT_GROUP = "Claude Agent";
|
|
16
|
+
/** Always the OAuth-reported value: even beside CLI-local windows, resets come from the usage API. */
|
|
17
|
+
function claudeAgentResetsEntry(resets) {
|
|
18
|
+
return {
|
|
19
|
+
kind: "value",
|
|
20
|
+
accounting: {
|
|
21
|
+
resultType: "status",
|
|
22
|
+
acquisitionMethod: "remote_api",
|
|
23
|
+
ownership: "maintained",
|
|
24
|
+
authority: "provider_reported",
|
|
25
|
+
},
|
|
26
|
+
name: `${CLAUDE_AGENT_GROUP} Resets`,
|
|
27
|
+
group: CLAUDE_AGENT_GROUP,
|
|
28
|
+
label: "Resets:",
|
|
29
|
+
rowKey: CLAUDE_AGENT_RESETS_ROW_KEY,
|
|
30
|
+
value: `${resets.availableCount} available`,
|
|
31
|
+
bankedResets: {
|
|
32
|
+
availableCount: resets.availableCount,
|
|
33
|
+
credits: resets.credits.map((credit) => ({
|
|
34
|
+
...(credit.expiresAtIso !== undefined ? { expiresAtIso: credit.expiresAtIso } : {}),
|
|
35
|
+
})),
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function getClaudeAgentNoDataMessage() {
|
|
40
|
+
return "Quota unavailable via local Claude CLI";
|
|
41
|
+
}
|
|
42
|
+
function safeDiagnosticMessage(diagnostics) {
|
|
43
|
+
if (diagnostics.failureCategory === "provider_api")
|
|
44
|
+
return "Claude quota request failed.";
|
|
45
|
+
if (diagnostics.failureCategory === "credentials")
|
|
46
|
+
return "Claude sign-in could not be used. Run `claude auth login` and try again.";
|
|
47
|
+
if (!diagnostics.installed)
|
|
48
|
+
return "Claude CLI is unavailable.";
|
|
49
|
+
if (diagnostics.authStatus === "unauthenticated")
|
|
50
|
+
return "Claude is not authenticated. Run `claude auth login` and try again.";
|
|
51
|
+
if (diagnostics.authStatus === "unknown")
|
|
52
|
+
return "Claude authentication could not be verified. Run `claude auth login` and try again.";
|
|
53
|
+
return "Claude Agent usage is unavailable.";
|
|
54
|
+
}
|
|
55
|
+
/** The Claude Agent route selected by `onlyCurrentModel`, if any. */
|
|
56
|
+
export function getClaudeAgentRuntimeProviderId(ctx) {
|
|
57
|
+
if (ctx.config?.onlyCurrentModel !== true)
|
|
58
|
+
return undefined;
|
|
59
|
+
const currentProviderId = (ctx.config?.currentProviderID ??
|
|
60
|
+
resolveQuotaProviderSessionModelIdentity({ currentModel: ctx.config?.currentModel ?? "" })
|
|
61
|
+
?.providerId)
|
|
62
|
+
?.trim()
|
|
63
|
+
.toLowerCase();
|
|
64
|
+
return currentProviderId &&
|
|
65
|
+
CLAUDE_AGENT_RUNTIME_IDS.includes(currentProviderId)
|
|
66
|
+
? currentProviderId
|
|
67
|
+
: undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* OpenCode registers Claude Agent independently of the external login; provider presence alone
|
|
71
|
+
* cannot report its auth or quota. The independent CLI probe supplies what it can; it does not
|
|
72
|
+
* establish account equivalence from a matching email or plan.
|
|
73
|
+
*/
|
|
74
|
+
export async function isClaudeAgentRuntimeDetected(ctx) {
|
|
75
|
+
if (ctx.client?.integration) {
|
|
76
|
+
try {
|
|
77
|
+
const { data } = await ctx.client.integration.list();
|
|
78
|
+
if (Array.isArray(data)) {
|
|
79
|
+
const agent = data.find((integration) => integration.id === "claude-agent");
|
|
80
|
+
if (agent && Array.isArray(agent.connections)) {
|
|
81
|
+
if (agent.connections.some((connection) => connection.type === "credential" && connection.method === "external")) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
return await isAnyProviderIdAvailable({
|
|
85
|
+
ctx,
|
|
86
|
+
candidateIds: ["claude-code"],
|
|
87
|
+
fallbackOnError: false,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Older hosts or an unavailable integration service use legacy provider detection.
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return await isAnyProviderIdAvailable({
|
|
97
|
+
ctx,
|
|
98
|
+
candidateIds: CLAUDE_AGENT_RUNTIME_IDS,
|
|
99
|
+
fallbackOnError: false,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export const claudeAgentProvider = {
|
|
103
|
+
id: "claude-agent",
|
|
104
|
+
async isAvailable(ctx) {
|
|
105
|
+
if (ctx.config?.onlyCurrentModel === true) {
|
|
106
|
+
// A selected Claude Agent route stays visible; its CLI probe runs in fetch, so a missing or
|
|
107
|
+
// signed-out CLI shows as an error instead of disappearing.
|
|
108
|
+
return getClaudeAgentRuntimeProviderId(ctx) !== undefined;
|
|
109
|
+
}
|
|
110
|
+
const runtimeAvailable = await isAnyProviderIdAvailable({
|
|
111
|
+
ctx,
|
|
112
|
+
candidateIds: CLAUDE_AGENT_RUNTIME_IDS,
|
|
113
|
+
fallbackOnError: false,
|
|
114
|
+
});
|
|
115
|
+
if (!runtimeAvailable)
|
|
116
|
+
return false;
|
|
117
|
+
return await hasAnthropicCredentialsConfigured({
|
|
118
|
+
binaryPath: ctx.config?.anthropicBinaryPath,
|
|
119
|
+
operationCache: ctx.operationCache,
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
async isDiscovered(ctx) {
|
|
123
|
+
// Dashboard-only: a detected Claude Agent runtime stays visible while its CLI is not ready, and
|
|
124
|
+
// fetch says why.
|
|
125
|
+
if (ctx.config?.onlyCurrentModel === true)
|
|
126
|
+
return false;
|
|
127
|
+
return await isClaudeAgentRuntimeDetected(ctx);
|
|
128
|
+
},
|
|
129
|
+
matchesCurrentModel(model) {
|
|
130
|
+
const normalized = model.toLowerCase();
|
|
131
|
+
return CLAUDE_AGENT_RUNTIME_IDS.some((id) => normalized.startsWith(`${id}/`));
|
|
132
|
+
},
|
|
133
|
+
async fetch(ctx) {
|
|
134
|
+
const forceRefresh = ctx.operationCache?.get(QUOTA_FORCE_REFRESH) === true;
|
|
135
|
+
let diagnostics;
|
|
136
|
+
try {
|
|
137
|
+
diagnostics = await getAnthropicDiagnostics({
|
|
138
|
+
binaryPath: ctx.config?.anthropicBinaryPath,
|
|
139
|
+
...(ctx.operationCache ? { operationCache: ctx.operationCache } : {}),
|
|
140
|
+
requestTimeoutMs: ctx.config?.requestTimeoutMs,
|
|
141
|
+
...(forceRefresh ? { forceRefresh: true } : {}),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return withStatusDetails(attemptedErrorResult(CLAUDE_AGENT_GROUP, "Claude CLI probe failed."), statusDetailsFromRecord({ cli_installed: "false", message: "Failed to probe Claude CLI." }));
|
|
146
|
+
}
|
|
147
|
+
const statusDetails = statusDetailsFromRecord({
|
|
148
|
+
cli_installed: diagnostics.installed ? "true" : "false",
|
|
149
|
+
cli_version: diagnostics.version && /^\d+\.\d+\.\d+$/.test(diagnostics.version)
|
|
150
|
+
? diagnostics.version
|
|
151
|
+
: "(none)",
|
|
152
|
+
binary_path: diagnostics.binaryPath ? "(detected)" : "(none)",
|
|
153
|
+
auth_status: diagnostics.authStatus,
|
|
154
|
+
quota_supported: diagnostics.quotaSupported ? "true" : "false",
|
|
155
|
+
quota_source: diagnostics.quotaSource === "none" ? "(none)" : diagnostics.quotaSource,
|
|
156
|
+
oauth_credential_source: diagnostics.oauthCredentialSource ?? "(none)",
|
|
157
|
+
checked_commands: diagnostics.checkedCommands.length ? "(checked)" : "(none)",
|
|
158
|
+
message: diagnostics.message === undefined ? undefined : safeDiagnosticMessage(diagnostics),
|
|
159
|
+
five_hour_remaining: diagnostics.quota?.five_hour
|
|
160
|
+
? `${diagnostics.quota.five_hour.percentRemaining}% reset_at=${diagnostics.quota.five_hour.resetTimeIso ?? "(none)"}`
|
|
161
|
+
: undefined,
|
|
162
|
+
seven_day_remaining: diagnostics.quota?.seven_day
|
|
163
|
+
? `${diagnostics.quota.seven_day.percentRemaining}% reset_at=${diagnostics.quota.seven_day.resetTimeIso ?? "(none)"}`
|
|
164
|
+
: undefined,
|
|
165
|
+
fable_weekly_remaining: diagnostics.quota?.fable_weekly
|
|
166
|
+
? `${diagnostics.quota.fable_weekly.percentRemaining}% reset_at=${diagnostics.quota.fable_weekly.resetTimeIso ?? "(none)"}`
|
|
167
|
+
: undefined,
|
|
168
|
+
});
|
|
169
|
+
if (diagnostics.quotaSupported && diagnostics.quota) {
|
|
170
|
+
const acquisitionMethod = diagnostics.quotaSource === "claude-auth-status-json" ? "local_cli" : "remote_api";
|
|
171
|
+
const credits = diagnostics.quota.saved_resets?.credits.filter((credit) => credit.expiresAtIso == null || Date.parse(credit.expiresAtIso) > Date.now());
|
|
172
|
+
const savedResets = credits?.length ? { availableCount: credits.length, credits } : undefined;
|
|
173
|
+
const result = attemptedResult([
|
|
174
|
+
...anthropicQuotaEntries(diagnostics.quota, {
|
|
175
|
+
group: CLAUDE_AGENT_GROUP,
|
|
176
|
+
acquisitionMethod,
|
|
177
|
+
}),
|
|
178
|
+
...(savedResets && savedResets.availableCount > 0
|
|
179
|
+
? [claudeAgentResetsEntry(savedResets)]
|
|
180
|
+
: []),
|
|
181
|
+
]);
|
|
182
|
+
return withStatusDetails(diagnostics.planLabel === undefined
|
|
183
|
+
? result
|
|
184
|
+
: { ...result, planLabel: diagnostics.planLabel }, statusDetails);
|
|
185
|
+
}
|
|
186
|
+
return withStatusDetails(attemptedErrorResult(CLAUDE_AGENT_GROUP, safeDiagnosticMessage(diagnostics), {
|
|
187
|
+
...(diagnostics.failureCategory !== undefined
|
|
188
|
+
? { failureCategory: diagnostics.failureCategory }
|
|
189
|
+
: {}),
|
|
190
|
+
...(diagnostics.retryAtMs !== undefined
|
|
191
|
+
? { retryable: true, retryAtMs: diagnostics.retryAtMs }
|
|
192
|
+
: {}),
|
|
193
|
+
}), statusDetails);
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
//# sourceMappingURL=claude-agent.js.map
|