opencode-quota-gui 0.0.0-stage → 1.0.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/LICENSE +21 -0
- package/README.md +243 -2
- package/dist/bin/opencode-quota-gui.d.ts +4 -0
- package/dist/bin/opencode-quota-gui.d.ts.map +1 -0
- package/dist/bin/opencode-quota-gui.js +75 -0
- package/dist/bin/opencode-quota-gui.js.map +1 -0
- package/dist/contracts/build-identity.d.ts +8 -0
- package/dist/contracts/build-identity.d.ts.map +1 -0
- package/dist/contracts/build-identity.js +1 -0
- package/dist/contracts/card-order.d.ts +25 -0
- package/dist/contracts/card-order.d.ts.map +1 -0
- package/dist/contracts/card-order.js +50 -0
- package/dist/contracts/card-order.js.map +1 -0
- package/dist/contracts/dashboard.d.ts +368 -0
- package/dist/contracts/dashboard.d.ts.map +1 -0
- package/dist/contracts/dashboard.js +3 -0
- package/dist/contracts/dashboard.js.map +1 -0
- package/dist/contracts/guards.d.ts +14 -0
- package/dist/contracts/guards.d.ts.map +1 -0
- package/dist/contracts/guards.js +56 -0
- package/dist/contracts/guards.js.map +1 -0
- package/dist/contracts/identity.d.ts +41 -0
- package/dist/contracts/identity.d.ts.map +1 -0
- package/dist/contracts/identity.js +27 -0
- package/dist/contracts/identity.js.map +1 -0
- package/dist/contracts/openai-quota.d.ts +34 -0
- package/dist/contracts/openai-quota.d.ts.map +1 -0
- package/dist/contracts/openai-quota.js +19 -0
- package/dist/contracts/openai-quota.js.map +1 -0
- package/dist/contracts/ranges.d.ts +48 -0
- package/dist/contracts/ranges.d.ts.map +1 -0
- package/dist/contracts/ranges.js +84 -0
- package/dist/contracts/ranges.js.map +1 -0
- package/dist/contracts/settings.d.ts +4 -0
- package/dist/contracts/settings.d.ts.map +1 -0
- package/dist/contracts/settings.js +14 -0
- package/dist/contracts/settings.js.map +1 -0
- package/dist/contracts/time-zone.d.ts +33 -0
- package/dist/contracts/time-zone.d.ts.map +1 -0
- package/dist/contracts/time-zone.js +217 -0
- package/dist/contracts/time-zone.js.map +1 -0
- package/dist/data/modelsdev-pricing.min.json +1064 -0
- package/dist/gui/aggregation.d.ts +55 -0
- package/dist/gui/aggregation.d.ts.map +1 -0
- package/dist/gui/aggregation.js +792 -0
- package/dist/gui/aggregation.js.map +1 -0
- package/dist/gui/analytics-bridge.d.ts +50 -0
- package/dist/gui/analytics-bridge.d.ts.map +1 -0
- package/dist/gui/analytics-bridge.js +382 -0
- package/dist/gui/analytics-bridge.js.map +1 -0
- package/dist/gui/analytics-engine.d.ts +61 -0
- package/dist/gui/analytics-engine.d.ts.map +1 -0
- package/dist/gui/analytics-engine.js +2381 -0
- package/dist/gui/analytics-engine.js.map +1 -0
- package/dist/gui/analytics-indexes.d.ts +34 -0
- package/dist/gui/analytics-indexes.d.ts.map +1 -0
- package/dist/gui/analytics-indexes.js +142 -0
- package/dist/gui/analytics-indexes.js.map +1 -0
- package/dist/gui/analytics-model.d.ts +48 -0
- package/dist/gui/analytics-model.d.ts.map +1 -0
- package/dist/gui/analytics-model.js +824 -0
- package/dist/gui/analytics-model.js.map +1 -0
- package/dist/gui/analytics-protocol.d.ts +102 -0
- package/dist/gui/analytics-protocol.d.ts.map +1 -0
- package/dist/gui/analytics-protocol.js +11 -0
- package/dist/gui/analytics-protocol.js.map +1 -0
- package/dist/gui/analytics-reader.d.ts +14 -0
- package/dist/gui/analytics-reader.d.ts.map +1 -0
- package/dist/gui/analytics-reader.js +15 -0
- package/dist/gui/analytics-reader.js.map +1 -0
- package/dist/gui/analytics-service.d.ts +49 -0
- package/dist/gui/analytics-service.d.ts.map +1 -0
- package/dist/gui/analytics-service.js +187 -0
- package/dist/gui/analytics-service.js.map +1 -0
- package/dist/gui/analytics-state.d.ts +183 -0
- package/dist/gui/analytics-state.d.ts.map +1 -0
- package/dist/gui/analytics-state.js +692 -0
- package/dist/gui/analytics-state.js.map +1 -0
- package/dist/gui/analytics-worker-runtime.d.ts +11 -0
- package/dist/gui/analytics-worker-runtime.d.ts.map +1 -0
- package/dist/gui/analytics-worker-runtime.js +98 -0
- package/dist/gui/analytics-worker-runtime.js.map +1 -0
- package/dist/gui/analytics-worker.d.ts +2 -0
- package/dist/gui/analytics-worker.d.ts.map +1 -0
- package/dist/gui/analytics-worker.js +64 -0
- package/dist/gui/analytics-worker.js.map +1 -0
- package/dist/gui/config.d.ts +56 -0
- package/dist/gui/config.d.ts.map +1 -0
- package/dist/gui/config.js +701 -0
- package/dist/gui/config.js.map +1 -0
- package/dist/gui/identity.d.ts +23 -0
- package/dist/gui/identity.d.ts.map +1 -0
- package/dist/gui/identity.js +57 -0
- package/dist/gui/identity.js.map +1 -0
- package/dist/gui/lifecycle.d.ts +82 -0
- package/dist/gui/lifecycle.d.ts.map +1 -0
- package/dist/gui/lifecycle.js +402 -0
- package/dist/gui/lifecycle.js.map +1 -0
- package/dist/gui/log.d.ts +23 -0
- package/dist/gui/log.d.ts.map +1 -0
- package/dist/gui/log.js +37 -0
- package/dist/gui/log.js.map +1 -0
- package/dist/gui/provider-cards.d.ts +55 -0
- package/dist/gui/provider-cards.d.ts.map +1 -0
- package/dist/gui/provider-cards.js +417 -0
- package/dist/gui/provider-cards.js.map +1 -0
- package/dist/gui/server.d.ts +60 -0
- package/dist/gui/server.d.ts.map +1 -0
- package/dist/gui/server.js +815 -0
- package/dist/gui/server.js.map +1 -0
- package/dist/gui/settings-file-opener.d.ts +34 -0
- package/dist/gui/settings-file-opener.d.ts.map +1 -0
- package/dist/gui/settings-file-opener.js +110 -0
- package/dist/gui/settings-file-opener.js.map +1 -0
- package/dist/gui/snapshot-service.d.ts +128 -0
- package/dist/gui/snapshot-service.d.ts.map +1 -0
- package/dist/gui/snapshot-service.js +591 -0
- package/dist/gui/snapshot-service.js.map +1 -0
- package/dist/gui/sources.d.ts +99 -0
- package/dist/gui/sources.d.ts.map +1 -0
- package/dist/gui/sources.js +410 -0
- package/dist/gui/sources.js.map +1 -0
- package/dist/gui/sse.d.ts +32 -0
- package/dist/gui/sse.d.ts.map +1 -0
- package/dist/gui/sse.js +100 -0
- package/dist/gui/sse.js.map +1 -0
- package/dist/gui/time-zone.d.ts +10 -0
- package/dist/gui/time-zone.d.ts.map +1 -0
- package/dist/gui/time-zone.js +21 -0
- package/dist/gui/time-zone.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/accounting-format.d.ts +54 -0
- package/dist/lib/accounting-format.d.ts.map +1 -0
- package/dist/lib/accounting-format.js +271 -0
- package/dist/lib/accounting-format.js.map +1 -0
- package/dist/lib/alibaba-auth.d.ts +46 -0
- package/dist/lib/alibaba-auth.d.ts.map +1 -0
- package/dist/lib/alibaba-auth.js +193 -0
- package/dist/lib/alibaba-auth.js.map +1 -0
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts +47 -0
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts.map +1 -0
- package/dist/lib/alibaba-coding-plan-local-quota.js +146 -0
- package/dist/lib/alibaba-coding-plan-local-quota.js.map +1 -0
- package/dist/lib/alibaba-token-plan.d.ts +91 -0
- package/dist/lib/alibaba-token-plan.d.ts.map +1 -0
- package/dist/lib/alibaba-token-plan.js +527 -0
- package/dist/lib/alibaba-token-plan.js.map +1 -0
- package/dist/lib/anthropic-auth.d.ts +29 -0
- package/dist/lib/anthropic-auth.d.ts.map +1 -0
- package/dist/lib/anthropic-auth.js +37 -0
- package/dist/lib/anthropic-auth.js.map +1 -0
- package/dist/lib/anthropic.d.ts +104 -0
- package/dist/lib/anthropic.d.ts.map +1 -0
- package/dist/lib/anthropic.js +1134 -0
- package/dist/lib/anthropic.js.map +1 -0
- package/dist/lib/api-key-resolver.d.ts +227 -0
- package/dist/lib/api-key-resolver.d.ts.map +1 -0
- package/dist/lib/api-key-resolver.js +336 -0
- package/dist/lib/api-key-resolver.js.map +1 -0
- package/dist/lib/atomic-json.d.ts +11 -0
- package/dist/lib/atomic-json.d.ts.map +1 -0
- package/dist/lib/atomic-json.js +64 -0
- package/dist/lib/atomic-json.js.map +1 -0
- package/dist/lib/chutes-config.d.ts +15 -0
- package/dist/lib/chutes-config.d.ts.map +1 -0
- package/dist/lib/chutes-config.js +28 -0
- package/dist/lib/chutes-config.js.map +1 -0
- package/dist/lib/chutes.d.ts +12 -0
- package/dist/lib/chutes.d.ts.map +1 -0
- package/dist/lib/chutes.js +60 -0
- package/dist/lib/chutes.js.map +1 -0
- package/dist/lib/cli-reports.d.ts +30 -0
- package/dist/lib/cli-reports.d.ts.map +1 -0
- package/dist/lib/cli-reports.js +172 -0
- package/dist/lib/cli-reports.js.map +1 -0
- package/dist/lib/cli-show.d.ts +30 -0
- package/dist/lib/cli-show.d.ts.map +1 -0
- package/dist/lib/cli-show.js +213 -0
- package/dist/lib/cli-show.js.map +1 -0
- package/dist/lib/cli-status.d.ts +8 -0
- package/dist/lib/cli-status.d.ts.map +1 -0
- package/dist/lib/cli-status.js +98 -0
- package/dist/lib/cli-status.js.map +1 -0
- package/dist/lib/command-parsing.d.ts +43 -0
- package/dist/lib/command-parsing.d.ts.map +1 -0
- package/dist/lib/command-parsing.js +103 -0
- package/dist/lib/command-parsing.js.map +1 -0
- package/dist/lib/config-file-utils.d.ts +46 -0
- package/dist/lib/config-file-utils.d.ts.map +1 -0
- package/dist/lib/config-file-utils.js +194 -0
- package/dist/lib/config-file-utils.js.map +1 -0
- package/dist/lib/config-write-target.d.ts +28 -0
- package/dist/lib/config-write-target.d.ts.map +1 -0
- package/dist/lib/config-write-target.js +159 -0
- package/dist/lib/config-write-target.js.map +1 -0
- package/dist/lib/config.d.ts +119 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +1352 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/copilot.d.ts +78 -0
- package/dist/lib/copilot.d.ts.map +1 -0
- package/dist/lib/copilot.js +1111 -0
- package/dist/lib/copilot.js.map +1 -0
- package/dist/lib/cursor-detection.d.ts +18 -0
- package/dist/lib/cursor-detection.d.ts.map +1 -0
- package/dist/lib/cursor-detection.js +189 -0
- package/dist/lib/cursor-detection.js.map +1 -0
- package/dist/lib/cursor-pricing.d.ts +34 -0
- package/dist/lib/cursor-pricing.d.ts.map +1 -0
- package/dist/lib/cursor-pricing.js +235 -0
- package/dist/lib/cursor-pricing.js.map +1 -0
- package/dist/lib/cursor-usage.d.ts +33 -0
- package/dist/lib/cursor-usage.d.ts.map +1 -0
- package/dist/lib/cursor-usage.js +109 -0
- package/dist/lib/cursor-usage.js.map +1 -0
- package/dist/lib/dashboard-visibility.d.ts +13 -0
- package/dist/lib/dashboard-visibility.d.ts.map +1 -0
- package/dist/lib/dashboard-visibility.js +51 -0
- package/dist/lib/dashboard-visibility.js.map +1 -0
- package/dist/lib/deepseek-auth.d.ts +15 -0
- package/dist/lib/deepseek-auth.d.ts.map +1 -0
- package/dist/lib/deepseek-auth.js +28 -0
- package/dist/lib/deepseek-auth.js.map +1 -0
- package/dist/lib/deepseek.d.ts +40 -0
- package/dist/lib/deepseek.d.ts.map +1 -0
- package/dist/lib/deepseek.js +118 -0
- package/dist/lib/deepseek.js.map +1 -0
- package/dist/lib/display-sanitize.d.ts +20 -0
- package/dist/lib/display-sanitize.d.ts.map +1 -0
- package/dist/lib/display-sanitize.js +178 -0
- package/dist/lib/display-sanitize.js.map +1 -0
- package/dist/lib/entries.d.ts +367 -0
- package/dist/lib/entries.d.ts.map +1 -0
- package/dist/lib/entries.js +69 -0
- package/dist/lib/entries.js.map +1 -0
- package/dist/lib/env-template.d.ts +26 -0
- package/dist/lib/env-template.d.ts.map +1 -0
- package/dist/lib/env-template.js +36 -0
- package/dist/lib/env-template.js.map +1 -0
- package/dist/lib/format-utils.d.ts +89 -0
- package/dist/lib/format-utils.d.ts.map +1 -0
- package/dist/lib/format-utils.js +206 -0
- package/dist/lib/format-utils.js.map +1 -0
- package/dist/lib/format.d.ts +25 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +300 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/glm-coding-plan.d.ts +19 -0
- package/dist/lib/glm-coding-plan.d.ts.map +1 -0
- package/dist/lib/glm-coding-plan.js +81 -0
- package/dist/lib/glm-coding-plan.js.map +1 -0
- package/dist/lib/google-agy-companion.d.ts +8 -0
- package/dist/lib/google-agy-companion.d.ts.map +1 -0
- package/dist/lib/google-agy-companion.js +64 -0
- package/dist/lib/google-agy-companion.js.map +1 -0
- package/dist/lib/google-agy.d.ts +48 -0
- package/dist/lib/google-agy.d.ts.map +1 -0
- package/dist/lib/google-agy.js +572 -0
- package/dist/lib/google-agy.js.map +1 -0
- package/dist/lib/google-companion-credentials.d.ts +70 -0
- package/dist/lib/google-companion-credentials.d.ts.map +1 -0
- package/dist/lib/google-companion-credentials.js +315 -0
- package/dist/lib/google-companion-credentials.js.map +1 -0
- package/dist/lib/google-gemini-cli-companion.d.ts +8 -0
- package/dist/lib/google-gemini-cli-companion.d.ts.map +1 -0
- package/dist/lib/google-gemini-cli-companion.js +64 -0
- package/dist/lib/google-gemini-cli-companion.js.map +1 -0
- package/dist/lib/google-gemini-cli.d.ts +47 -0
- package/dist/lib/google-gemini-cli.d.ts.map +1 -0
- package/dist/lib/google-gemini-cli.js +481 -0
- package/dist/lib/google-gemini-cli.js.map +1 -0
- package/dist/lib/google-token-cache.d.ts +27 -0
- package/dist/lib/google-token-cache.d.ts.map +1 -0
- package/dist/lib/google-token-cache.js +52 -0
- package/dist/lib/google-token-cache.js.map +1 -0
- package/dist/lib/grouped-entry-normalization.d.ts +12 -0
- package/dist/lib/grouped-entry-normalization.d.ts.map +1 -0
- package/dist/lib/grouped-entry-normalization.js +124 -0
- package/dist/lib/grouped-entry-normalization.js.map +1 -0
- package/dist/lib/grouped-header-format.d.ts +5 -0
- package/dist/lib/grouped-header-format.d.ts.map +1 -0
- package/dist/lib/grouped-header-format.js +16 -0
- package/dist/lib/grouped-header-format.js.map +1 -0
- package/dist/lib/gui-config-target.d.ts +12 -0
- package/dist/lib/gui-config-target.d.ts.map +1 -0
- package/dist/lib/gui-config-target.js +88 -0
- package/dist/lib/gui-config-target.js.map +1 -0
- package/dist/lib/home-dir-display.d.ts +10 -0
- package/dist/lib/home-dir-display.d.ts.map +1 -0
- package/dist/lib/home-dir-display.js +108 -0
- package/dist/lib/home-dir-display.js.map +1 -0
- package/dist/lib/http.d.ts +19 -0
- package/dist/lib/http.d.ts.map +1 -0
- package/dist/lib/http.js +47 -0
- package/dist/lib/http.js.map +1 -0
- package/dist/lib/init-installer.d.ts +146 -0
- package/dist/lib/init-installer.d.ts.map +1 -0
- package/dist/lib/init-installer.js +1056 -0
- package/dist/lib/init-installer.js.map +1 -0
- package/dist/lib/jsonc.d.ts +17 -0
- package/dist/lib/jsonc.d.ts.map +1 -0
- package/dist/lib/jsonc.js +23 -0
- package/dist/lib/jsonc.js.map +1 -0
- package/dist/lib/kilo-config.d.ts +15 -0
- package/dist/lib/kilo-config.d.ts.map +1 -0
- package/dist/lib/kilo-config.js +27 -0
- package/dist/lib/kilo-config.js.map +1 -0
- package/dist/lib/kilo.d.ts +32 -0
- package/dist/lib/kilo.d.ts.map +1 -0
- package/dist/lib/kilo.js +265 -0
- package/dist/lib/kilo.js.map +1 -0
- package/dist/lib/kimi-auth.d.ts +49 -0
- package/dist/lib/kimi-auth.d.ts.map +1 -0
- package/dist/lib/kimi-auth.js +82 -0
- package/dist/lib/kimi-auth.js.map +1 -0
- package/dist/lib/kimi-endpoints.d.ts +10 -0
- package/dist/lib/kimi-endpoints.d.ts.map +1 -0
- package/dist/lib/kimi-endpoints.js +18 -0
- package/dist/lib/kimi-endpoints.js.map +1 -0
- package/dist/lib/kimi.d.ts +26 -0
- package/dist/lib/kimi.d.ts.map +1 -0
- package/dist/lib/kimi.js +230 -0
- package/dist/lib/kimi.js.map +1 -0
- package/dist/lib/maintainer-announcements.d.ts +46 -0
- package/dist/lib/maintainer-announcements.d.ts.map +1 -0
- package/dist/lib/maintainer-announcements.js +155 -0
- package/dist/lib/maintainer-announcements.js.map +1 -0
- package/dist/lib/map-with-concurrency.d.ts +2 -0
- package/dist/lib/map-with-concurrency.d.ts.map +1 -0
- package/dist/lib/map-with-concurrency.js +17 -0
- package/dist/lib/map-with-concurrency.js.map +1 -0
- package/dist/lib/markdown-table.d.ts +51 -0
- package/dist/lib/markdown-table.d.ts.map +1 -0
- package/dist/lib/markdown-table.js +179 -0
- package/dist/lib/markdown-table.js.map +1 -0
- package/dist/lib/mimo-config.d.ts +29 -0
- package/dist/lib/mimo-config.d.ts.map +1 -0
- package/dist/lib/mimo-config.js +146 -0
- package/dist/lib/mimo-config.js.map +1 -0
- package/dist/lib/mimo.d.ts +35 -0
- package/dist/lib/mimo.d.ts.map +1 -0
- package/dist/lib/mimo.js +236 -0
- package/dist/lib/mimo.js.map +1 -0
- package/dist/lib/minimax-auth.d.ts +62 -0
- package/dist/lib/minimax-auth.d.ts.map +1 -0
- package/dist/lib/minimax-auth.js +206 -0
- package/dist/lib/minimax-auth.js.map +1 -0
- package/dist/lib/minimax-endpoints.d.ts +10 -0
- package/dist/lib/minimax-endpoints.d.ts.map +1 -0
- package/dist/lib/minimax-endpoints.js +19 -0
- package/dist/lib/minimax-endpoints.js.map +1 -0
- package/dist/lib/modelsdev-pricing.d.ts +93 -0
- package/dist/lib/modelsdev-pricing.d.ts.map +1 -0
- package/dist/lib/modelsdev-pricing.js +674 -0
- package/dist/lib/modelsdev-pricing.js.map +1 -0
- package/dist/lib/nanogpt-config.d.ts +15 -0
- package/dist/lib/nanogpt-config.d.ts.map +1 -0
- package/dist/lib/nanogpt-config.js +31 -0
- package/dist/lib/nanogpt-config.js.map +1 -0
- package/dist/lib/nanogpt.d.ts +48 -0
- package/dist/lib/nanogpt.d.ts.map +1 -0
- package/dist/lib/nanogpt.js +251 -0
- package/dist/lib/nanogpt.js.map +1 -0
- package/dist/lib/ollama-cloud-config.d.ts +15 -0
- package/dist/lib/ollama-cloud-config.d.ts.map +1 -0
- package/dist/lib/ollama-cloud-config.js +27 -0
- package/dist/lib/ollama-cloud-config.js.map +1 -0
- package/dist/lib/ollama-cloud.d.ts +14 -0
- package/dist/lib/ollama-cloud.d.ts.map +1 -0
- package/dist/lib/ollama-cloud.js +186 -0
- package/dist/lib/ollama-cloud.js.map +1 -0
- package/dist/lib/openai.d.ts +68 -0
- package/dist/lib/openai.d.ts.map +1 -0
- package/dist/lib/openai.js +394 -0
- package/dist/lib/openai.js.map +1 -0
- package/dist/lib/opencode-auth-sqlite.d.ts +17 -0
- package/dist/lib/opencode-auth-sqlite.d.ts.map +1 -0
- package/dist/lib/opencode-auth-sqlite.js +105 -0
- package/dist/lib/opencode-auth-sqlite.js.map +1 -0
- package/dist/lib/opencode-auth.d.ts +146 -0
- package/dist/lib/opencode-auth.d.ts.map +1 -0
- package/dist/lib/opencode-auth.js +465 -0
- package/dist/lib/opencode-auth.js.map +1 -0
- package/dist/lib/opencode-config-editor.d.ts +62 -0
- package/dist/lib/opencode-config-editor.d.ts.map +1 -0
- package/dist/lib/opencode-config-editor.js +387 -0
- package/dist/lib/opencode-config-editor.js.map +1 -0
- package/dist/lib/opencode-config-providers.d.ts +24 -0
- package/dist/lib/opencode-config-providers.d.ts.map +1 -0
- package/dist/lib/opencode-config-providers.js +144 -0
- package/dist/lib/opencode-config-providers.js.map +1 -0
- package/dist/lib/opencode-config-read.d.ts +23 -0
- package/dist/lib/opencode-config-read.d.ts.map +1 -0
- package/dist/lib/opencode-config-read.js +30 -0
- package/dist/lib/opencode-config-read.js.map +1 -0
- package/dist/lib/opencode-console-auth.d.ts +96 -0
- package/dist/lib/opencode-console-auth.d.ts.map +1 -0
- package/dist/lib/opencode-console-auth.js +213 -0
- package/dist/lib/opencode-console-auth.js.map +1 -0
- package/dist/lib/opencode-db-path.d.ts +9 -0
- package/dist/lib/opencode-db-path.d.ts.map +1 -0
- package/dist/lib/opencode-db-path.js +16 -0
- package/dist/lib/opencode-db-path.js.map +1 -0
- package/dist/lib/opencode-go-auth.d.ts +16 -0
- package/dist/lib/opencode-go-auth.d.ts.map +1 -0
- package/dist/lib/opencode-go-auth.js +42 -0
- package/dist/lib/opencode-go-auth.js.map +1 -0
- package/dist/lib/opencode-go.d.ts +17 -0
- package/dist/lib/opencode-go.d.ts.map +1 -0
- package/dist/lib/opencode-go.js +284 -0
- package/dist/lib/opencode-go.js.map +1 -0
- package/dist/lib/opencode-runtime-paths.d.ts +17 -0
- package/dist/lib/opencode-runtime-paths.d.ts.map +1 -0
- package/dist/lib/opencode-runtime-paths.js +24 -0
- package/dist/lib/opencode-runtime-paths.js.map +1 -0
- package/dist/lib/opencode-sqlite.d.ts +11 -0
- package/dist/lib/opencode-sqlite.d.ts.map +1 -0
- package/dist/lib/opencode-sqlite.js +88 -0
- package/dist/lib/opencode-sqlite.js.map +1 -0
- package/dist/lib/opencode-storage.d.ts +306 -0
- package/dist/lib/opencode-storage.d.ts.map +1 -0
- package/dist/lib/opencode-storage.js +1269 -0
- package/dist/lib/opencode-storage.js.map +1 -0
- package/dist/lib/opencode-version.d.ts +6 -0
- package/dist/lib/opencode-version.d.ts.map +1 -0
- package/dist/lib/opencode-version.js +26 -0
- package/dist/lib/opencode-version.js.map +1 -0
- package/dist/lib/opencode-zen.d.ts +55 -0
- package/dist/lib/opencode-zen.d.ts.map +1 -0
- package/dist/lib/opencode-zen.js +348 -0
- package/dist/lib/opencode-zen.js.map +1 -0
- package/dist/lib/openrouter.d.ts +60 -0
- package/dist/lib/openrouter.d.ts.map +1 -0
- package/dist/lib/openrouter.js +215 -0
- package/dist/lib/openrouter.js.map +1 -0
- package/dist/lib/private-state-paths.d.ts +10 -0
- package/dist/lib/private-state-paths.d.ts.map +1 -0
- package/dist/lib/private-state-paths.js +28 -0
- package/dist/lib/private-state-paths.js.map +1 -0
- package/dist/lib/provider-add-command.d.ts +35 -0
- package/dist/lib/provider-add-command.d.ts.map +1 -0
- package/dist/lib/provider-add-command.js +204 -0
- package/dist/lib/provider-add-command.js.map +1 -0
- package/dist/lib/provider-add-json-v1-questionnaire.d.ts +32 -0
- package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +1 -0
- package/dist/lib/provider-add-json-v1-questionnaire.js +336 -0
- package/dist/lib/provider-add-json-v1-questionnaire.js.map +1 -0
- package/dist/lib/provider-add.d.ts +21 -0
- package/dist/lib/provider-add.d.ts.map +1 -0
- package/dist/lib/provider-add.js +219 -0
- package/dist/lib/provider-add.js.map +1 -0
- package/dist/lib/provider-availability.d.ts +13 -0
- package/dist/lib/provider-availability.d.ts.map +1 -0
- package/dist/lib/provider-availability.js +20 -0
- package/dist/lib/provider-availability.js.map +1 -0
- package/dist/lib/provider-metadata.d.ts +32 -0
- package/dist/lib/provider-metadata.d.ts.map +1 -0
- package/dist/lib/provider-metadata.js +90 -0
- package/dist/lib/provider-metadata.js.map +1 -0
- package/dist/lib/provider-model-matching.d.ts +12 -0
- package/dist/lib/provider-model-matching.d.ts.map +1 -0
- package/dist/lib/provider-model-matching.js +23 -0
- package/dist/lib/provider-model-matching.js.map +1 -0
- package/dist/lib/provider-registration.d.ts +321 -0
- package/dist/lib/provider-registration.d.ts.map +1 -0
- package/dist/lib/provider-registration.js +335 -0
- package/dist/lib/provider-registration.js.map +1 -0
- package/dist/lib/quota-accounting-projection.d.ts +9 -0
- package/dist/lib/quota-accounting-projection.d.ts.map +1 -0
- package/dist/lib/quota-accounting-projection.js +254 -0
- package/dist/lib/quota-accounting-projection.js.map +1 -0
- package/dist/lib/quota-columns.d.ts +38 -0
- package/dist/lib/quota-columns.d.ts.map +1 -0
- package/dist/lib/quota-columns.js +129 -0
- package/dist/lib/quota-columns.js.map +1 -0
- package/dist/lib/quota-command-format.d.ts +34 -0
- package/dist/lib/quota-command-format.d.ts.map +1 -0
- package/dist/lib/quota-command-format.js +240 -0
- package/dist/lib/quota-command-format.js.map +1 -0
- package/dist/lib/quota-dialog-command-specs.d.ts +63 -0
- package/dist/lib/quota-dialog-command-specs.d.ts.map +1 -0
- package/dist/lib/quota-dialog-command-specs.js +145 -0
- package/dist/lib/quota-dialog-command-specs.js.map +1 -0
- package/dist/lib/quota-dialog-commands.d.ts +75 -0
- package/dist/lib/quota-dialog-commands.d.ts.map +1 -0
- package/dist/lib/quota-dialog-commands.js +586 -0
- package/dist/lib/quota-dialog-commands.js.map +1 -0
- package/dist/lib/quota-entry-display.d.ts +7 -0
- package/dist/lib/quota-entry-display.d.ts.map +1 -0
- package/dist/lib/quota-entry-display.js +59 -0
- package/dist/lib/quota-entry-display.js.map +1 -0
- package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
- package/dist/lib/quota-exhaustion-projection.d.ts.map +1 -0
- package/dist/lib/quota-exhaustion-projection.js +105 -0
- package/dist/lib/quota-exhaustion-projection.js.map +1 -0
- package/dist/lib/quota-export-types.d.ts +96 -0
- package/dist/lib/quota-export-types.d.ts.map +1 -0
- package/dist/lib/quota-export-types.js +2 -0
- package/dist/lib/quota-export-types.js.map +1 -0
- package/dist/lib/quota-export.d.ts +44 -0
- package/dist/lib/quota-export.d.ts.map +1 -0
- package/dist/lib/quota-export.js +221 -0
- package/dist/lib/quota-export.js.map +1 -0
- package/dist/lib/quota-format-style.d.ts +21 -0
- package/dist/lib/quota-format-style.d.ts.map +1 -0
- package/dist/lib/quota-format-style.js +38 -0
- package/dist/lib/quota-format-style.js.map +1 -0
- package/dist/lib/quota-providers-local.d.ts +55 -0
- package/dist/lib/quota-providers-local.d.ts.map +1 -0
- package/dist/lib/quota-providers-local.js +327 -0
- package/dist/lib/quota-providers-local.js.map +1 -0
- package/dist/lib/quota-providers-remote.d.ts +27 -0
- package/dist/lib/quota-providers-remote.d.ts.map +1 -0
- package/dist/lib/quota-providers-remote.js +757 -0
- package/dist/lib/quota-providers-remote.js.map +1 -0
- package/dist/lib/quota-providers.d.ts +158 -0
- package/dist/lib/quota-providers.d.ts.map +1 -0
- package/dist/lib/quota-providers.js +1160 -0
- package/dist/lib/quota-providers.js.map +1 -0
- package/dist/lib/quota-render-data.d.ts +135 -0
- package/dist/lib/quota-render-data.d.ts.map +1 -0
- package/dist/lib/quota-render-data.js +462 -0
- package/dist/lib/quota-render-data.js.map +1 -0
- package/dist/lib/quota-report-message.d.ts +22 -0
- package/dist/lib/quota-report-message.d.ts.map +1 -0
- package/dist/lib/quota-report-message.js +36 -0
- package/dist/lib/quota-report-message.js.map +1 -0
- package/dist/lib/quota-reset-notifications.d.ts +20 -0
- package/dist/lib/quota-reset-notifications.d.ts.map +1 -0
- package/dist/lib/quota-reset-notifications.js +331 -0
- package/dist/lib/quota-reset-notifications.js.map +1 -0
- package/dist/lib/quota-retry-wait.d.ts +36 -0
- package/dist/lib/quota-retry-wait.d.ts.map +1 -0
- package/dist/lib/quota-retry-wait.js +67 -0
- package/dist/lib/quota-retry-wait.js.map +1 -0
- package/dist/lib/quota-runtime-context.d.ts +56 -0
- package/dist/lib/quota-runtime-context.d.ts.map +1 -0
- package/dist/lib/quota-runtime-context.js +113 -0
- package/dist/lib/quota-runtime-context.js.map +1 -0
- package/dist/lib/quota-state-codec.d.ts +16 -0
- package/dist/lib/quota-state-codec.d.ts.map +1 -0
- package/dist/lib/quota-state-codec.js +479 -0
- package/dist/lib/quota-state-codec.js.map +1 -0
- package/dist/lib/quota-state.d.ts +28 -0
- package/dist/lib/quota-state.d.ts.map +1 -0
- package/dist/lib/quota-state.js +473 -0
- package/dist/lib/quota-state.js.map +1 -0
- package/dist/lib/quota-stats-format.d.ts +29 -0
- package/dist/lib/quota-stats-format.d.ts.map +1 -0
- package/dist/lib/quota-stats-format.js +459 -0
- package/dist/lib/quota-stats-format.js.map +1 -0
- package/dist/lib/quota-stats.d.ts +174 -0
- package/dist/lib/quota-stats.d.ts.map +1 -0
- package/dist/lib/quota-stats.js +713 -0
- package/dist/lib/quota-stats.js.map +1 -0
- package/dist/lib/quota-status.d.ts +58 -0
- package/dist/lib/quota-status.d.ts.map +1 -0
- package/dist/lib/quota-status.js +865 -0
- package/dist/lib/quota-status.js.map +1 -0
- package/dist/lib/quota-surface-data.d.ts +21 -0
- package/dist/lib/quota-surface-data.d.ts.map +1 -0
- package/dist/lib/quota-surface-data.js +361 -0
- package/dist/lib/quota-surface-data.js.map +1 -0
- package/dist/lib/quota-telemetry.d.ts +45 -0
- package/dist/lib/quota-telemetry.d.ts.map +1 -0
- package/dist/lib/quota-telemetry.js +304 -0
- package/dist/lib/quota-telemetry.js.map +1 -0
- package/dist/lib/report-document.d.ts +90 -0
- package/dist/lib/report-document.d.ts.map +1 -0
- package/dist/lib/report-document.js +190 -0
- package/dist/lib/report-document.js.map +1 -0
- package/dist/lib/resolved-auth-identity.d.ts +36 -0
- package/dist/lib/resolved-auth-identity.d.ts.map +1 -0
- package/dist/lib/resolved-auth-identity.js +192 -0
- package/dist/lib/resolved-auth-identity.js.map +1 -0
- package/dist/lib/runtime-provider-ids.d.ts +4 -0
- package/dist/lib/runtime-provider-ids.d.ts.map +1 -0
- package/dist/lib/runtime-provider-ids.js +10 -0
- package/dist/lib/runtime-provider-ids.js.map +1 -0
- package/dist/lib/scoped-update-migration.d.ts +103 -0
- package/dist/lib/scoped-update-migration.d.ts.map +1 -0
- package/dist/lib/scoped-update-migration.js +348 -0
- package/dist/lib/scoped-update-migration.js.map +1 -0
- package/dist/lib/scoped-update.d.ts +78 -0
- package/dist/lib/scoped-update.d.ts.map +1 -0
- package/dist/lib/scoped-update.js +640 -0
- package/dist/lib/scoped-update.js.map +1 -0
- package/dist/lib/session-tokens-format.d.ts +36 -0
- package/dist/lib/session-tokens-format.d.ts.map +1 -0
- package/dist/lib/session-tokens-format.js +111 -0
- package/dist/lib/session-tokens-format.js.map +1 -0
- package/dist/lib/session-tokens.d.ts +27 -0
- package/dist/lib/session-tokens.d.ts.map +1 -0
- package/dist/lib/session-tokens.js +55 -0
- package/dist/lib/session-tokens.js.map +1 -0
- package/dist/lib/synthetic-config.d.ts +15 -0
- package/dist/lib/synthetic-config.d.ts.map +1 -0
- package/dist/lib/synthetic-config.js +28 -0
- package/dist/lib/synthetic-config.js.map +1 -0
- package/dist/lib/synthetic.d.ts +12 -0
- package/dist/lib/synthetic.d.ts.map +1 -0
- package/dist/lib/synthetic.js +173 -0
- package/dist/lib/synthetic.js.map +1 -0
- package/dist/lib/toast-format-grouped.d.ts +25 -0
- package/dist/lib/toast-format-grouped.d.ts.map +1 -0
- package/dist/lib/toast-format-grouped.js +296 -0
- package/dist/lib/toast-format-grouped.js.map +1 -0
- package/dist/lib/token-buckets.d.ts +24 -0
- package/dist/lib/token-buckets.d.ts.map +1 -0
- package/dist/lib/token-buckets.js +28 -0
- package/dist/lib/token-buckets.js.map +1 -0
- package/dist/lib/token-cost.d.ts +10 -0
- package/dist/lib/token-cost.d.ts.map +1 -0
- package/dist/lib/token-cost.js +16 -0
- package/dist/lib/token-cost.js.map +1 -0
- package/dist/lib/tui-compact-format.d.ts +10 -0
- package/dist/lib/tui-compact-format.d.ts.map +1 -0
- package/dist/lib/tui-compact-format.js +460 -0
- package/dist/lib/tui-compact-format.js.map +1 -0
- package/dist/lib/tui-panel-state.d.ts +15 -0
- package/dist/lib/tui-panel-state.d.ts.map +1 -0
- package/dist/lib/tui-panel-state.js +2 -0
- package/dist/lib/tui-panel-state.js.map +1 -0
- package/dist/lib/tui-prompt-bar-format.d.ts +25 -0
- package/dist/lib/tui-prompt-bar-format.d.ts.map +1 -0
- package/dist/lib/tui-prompt-bar-format.js +206 -0
- package/dist/lib/tui-prompt-bar-format.js.map +1 -0
- package/dist/lib/tui-sidebar-format.d.ts +13 -0
- package/dist/lib/tui-sidebar-format.d.ts.map +1 -0
- package/dist/lib/tui-sidebar-format.js +34 -0
- package/dist/lib/tui-sidebar-format.js.map +1 -0
- package/dist/lib/types.d.ts +738 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +85 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/usage-ownership.d.ts +47 -0
- package/dist/lib/usage-ownership.d.ts.map +1 -0
- package/dist/lib/usage-ownership.js +98 -0
- package/dist/lib/usage-ownership.js.map +1 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +33 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/lib/xai.d.ts +52 -0
- package/dist/lib/xai.d.ts.map +1 -0
- package/dist/lib/xai.js +253 -0
- package/dist/lib/xai.js.map +1 -0
- package/dist/lib/zai-auth.d.ts +15 -0
- package/dist/lib/zai-auth.d.ts.map +1 -0
- package/dist/lib/zai-auth.js +37 -0
- package/dist/lib/zai-auth.js.map +1 -0
- package/dist/lib/zai.d.ts +5 -0
- package/dist/lib/zai.d.ts.map +1 -0
- package/dist/lib/zai.js +14 -0
- package/dist/lib/zai.js.map +1 -0
- package/dist/lib/zhipu-auth.d.ts +15 -0
- package/dist/lib/zhipu-auth.d.ts.map +1 -0
- package/dist/lib/zhipu-auth.js +42 -0
- package/dist/lib/zhipu-auth.js.map +1 -0
- package/dist/lib/zhipu.d.ts +5 -0
- package/dist/lib/zhipu.d.ts.map +1 -0
- package/dist/lib/zhipu.js +13 -0
- package/dist/lib/zhipu.js.map +1 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +95 -0
- package/dist/plugin.js.map +1 -0
- package/dist/providers/accounting-decimal.d.ts +2 -0
- package/dist/providers/accounting-decimal.d.ts.map +1 -0
- package/dist/providers/accounting-decimal.js +23 -0
- package/dist/providers/accounting-decimal.js.map +1 -0
- package/dist/providers/alibaba-coding-plan.d.ts +3 -0
- package/dist/providers/alibaba-coding-plan.d.ts.map +1 -0
- package/dist/providers/alibaba-coding-plan.js +122 -0
- package/dist/providers/alibaba-coding-plan.js.map +1 -0
- package/dist/providers/alibaba-token-plan.d.ts +3 -0
- package/dist/providers/alibaba-token-plan.d.ts.map +1 -0
- package/dist/providers/alibaba-token-plan.js +90 -0
- package/dist/providers/alibaba-token-plan.js.map +1 -0
- package/dist/providers/anthropic.d.ts +9 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +236 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/cache-policies.d.ts +67 -0
- package/dist/providers/cache-policies.d.ts.map +1 -0
- package/dist/providers/cache-policies.js +263 -0
- package/dist/providers/cache-policies.js.map +1 -0
- package/dist/providers/chutes.d.ts +6 -0
- package/dist/providers/chutes.d.ts.map +1 -0
- package/dist/providers/chutes.js +50 -0
- package/dist/providers/chutes.js.map +1 -0
- package/dist/providers/copilot.d.ts +9 -0
- package/dist/providers/copilot.d.ts.map +1 -0
- package/dist/providers/copilot.js +323 -0
- package/dist/providers/copilot.js.map +1 -0
- package/dist/providers/cursor.d.ts +3 -0
- package/dist/providers/cursor.d.ts.map +1 -0
- package/dist/providers/cursor.js +182 -0
- package/dist/providers/cursor.js.map +1 -0
- package/dist/providers/deepseek.d.ts +9 -0
- package/dist/providers/deepseek.d.ts.map +1 -0
- package/dist/providers/deepseek.js +111 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/glm-coding-plan-provider.d.ts +56 -0
- package/dist/providers/glm-coding-plan-provider.d.ts.map +1 -0
- package/dist/providers/glm-coding-plan-provider.js +146 -0
- package/dist/providers/glm-coding-plan-provider.js.map +1 -0
- package/dist/providers/google-account-format.d.ts +7 -0
- package/dist/providers/google-account-format.d.ts.map +1 -0
- package/dist/providers/google-account-format.js +52 -0
- package/dist/providers/google-account-format.js.map +1 -0
- package/dist/providers/google-agy.d.ts +17 -0
- package/dist/providers/google-agy.d.ts.map +1 -0
- package/dist/providers/google-agy.js +256 -0
- package/dist/providers/google-agy.js.map +1 -0
- package/dist/providers/google-gemini-cli.d.ts +17 -0
- package/dist/providers/google-gemini-cli.d.ts.map +1 -0
- package/dist/providers/google-gemini-cli.js +228 -0
- package/dist/providers/google-gemini-cli.js.map +1 -0
- package/dist/providers/kilo.d.ts +6 -0
- package/dist/providers/kilo.d.ts.map +1 -0
- package/dist/providers/kilo.js +145 -0
- package/dist/providers/kilo.js.map +1 -0
- package/dist/providers/kimi-code.d.ts +4 -0
- package/dist/providers/kimi-code.d.ts.map +1 -0
- package/dist/providers/kimi-code.js +175 -0
- package/dist/providers/kimi-code.js.map +1 -0
- package/dist/providers/mimo.d.ts +3 -0
- package/dist/providers/mimo.d.ts.map +1 -0
- package/dist/providers/mimo.js +149 -0
- package/dist/providers/mimo.js.map +1 -0
- package/dist/providers/minimax-coding-plan.d.ts +26 -0
- package/dist/providers/minimax-coding-plan.d.ts.map +1 -0
- package/dist/providers/minimax-coding-plan.js +391 -0
- package/dist/providers/minimax-coding-plan.js.map +1 -0
- package/dist/providers/nanogpt.d.ts +6 -0
- package/dist/providers/nanogpt.d.ts.map +1 -0
- package/dist/providers/nanogpt.js +160 -0
- package/dist/providers/nanogpt.js.map +1 -0
- package/dist/providers/ollama-cloud.d.ts +9 -0
- package/dist/providers/ollama-cloud.d.ts.map +1 -0
- package/dist/providers/ollama-cloud.js +129 -0
- package/dist/providers/ollama-cloud.js.map +1 -0
- package/dist/providers/openai.d.ts +6 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +313 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/opencode-go.d.ts +4 -0
- package/dist/providers/opencode-go.d.ts.map +1 -0
- package/dist/providers/opencode-go.js +409 -0
- package/dist/providers/opencode-go.js.map +1 -0
- package/dist/providers/opencode-zen.d.ts +3 -0
- package/dist/providers/opencode-zen.d.ts.map +1 -0
- package/dist/providers/opencode-zen.js +288 -0
- package/dist/providers/opencode-zen.js.map +1 -0
- package/dist/providers/openrouter.d.ts +6 -0
- package/dist/providers/openrouter.d.ts.map +1 -0
- package/dist/providers/openrouter.js +94 -0
- package/dist/providers/openrouter.js.map +1 -0
- package/dist/providers/quota-providers.d.ts +6 -0
- package/dist/providers/quota-providers.d.ts.map +1 -0
- package/dist/providers/quota-providers.js +287 -0
- package/dist/providers/quota-providers.js.map +1 -0
- package/dist/providers/registry.d.ts +9 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +71 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/result-helpers.d.ts +61 -0
- package/dist/providers/result-helpers.d.ts.map +1 -0
- package/dist/providers/result-helpers.js +117 -0
- package/dist/providers/result-helpers.js.map +1 -0
- package/dist/providers/synthetic.d.ts +6 -0
- package/dist/providers/synthetic.d.ts.map +1 -0
- package/dist/providers/synthetic.js +79 -0
- package/dist/providers/synthetic.js.map +1 -0
- package/dist/providers/xai.d.ts +6 -0
- package/dist/providers/xai.d.ts.map +1 -0
- package/dist/providers/xai.js +122 -0
- package/dist/providers/xai.js.map +1 -0
- package/dist/providers/zai.d.ts +2 -0
- package/dist/providers/zai.d.ts.map +1 -0
- package/dist/providers/zai.js +24 -0
- package/dist/providers/zai.js.map +1 -0
- package/dist/providers/zhipu.d.ts +2 -0
- package/dist/providers/zhipu.d.ts.map +1 -0
- package/dist/providers/zhipu.js +21 -0
- package/dist/providers/zhipu.js.map +1 -0
- package/dist/rpc.d.ts +72 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +77 -0
- package/dist/rpc.js.map +1 -0
- package/dist/ui/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/ui/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/ui/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/ui/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/ui/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/ui/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/ui/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/ui/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/ui/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/ui/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/ui/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/ui/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/ui/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/ui/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/ui/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/ui/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/ui/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/ui/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/ui/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/ui/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/ui/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/ui/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/ui/assets/index-CPEiQt-C.js +8 -0
- package/dist/ui/assets/index-D3-Yn_WA.css +1 -0
- package/dist/ui/index.html +13 -0
- package/package.json +123 -3
|
@@ -0,0 +1,1352 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration loader for the opencode-quota-gui product.
|
|
3
|
+
*
|
|
4
|
+
* `loadConfig` is the runtime loader: canonical GUI config plus defaults only.
|
|
5
|
+
* `loadConfigLayered` retains the full precedence below for the explicit
|
|
6
|
+
* legacy settings import/preview:
|
|
7
|
+
* - Global/user config provides defaults.
|
|
8
|
+
* - Workspace config at the resolved config root overrides ordinary settings.
|
|
9
|
+
* - SDK config is used only as a fallback when no file-backed config exists.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, realpathSync } from "fs";
|
|
12
|
+
import { join } from "path";
|
|
13
|
+
import { DASHBOARD_HIDDEN_CARDS_VERSION, normalizeLegacyDashboardHiddenCards, } from "./dashboard-visibility.js";
|
|
14
|
+
import { isResetTimeDecimals } from "./format-utils.js";
|
|
15
|
+
import { buildOpenCodeConfigCandidates, readOpenCodeConfigCandidate, } from "./opencode-config-read.js";
|
|
16
|
+
import { getOpencodeRuntimeDirs } from "./opencode-runtime-paths.js";
|
|
17
|
+
import { getQuotaProviderShape, normalizeQuotaProviderId } from "./provider-metadata.js";
|
|
18
|
+
import { isQuotaFormatStyle, resolveQuotaFormatStyle } from "./quota-format-style.js";
|
|
19
|
+
import { cloneQuotaProviders, validateQuotaProviders } from "./quota-providers.js";
|
|
20
|
+
import { DASHBOARD_HIDDEN_ID_LIMIT, DEFAULT_CONFIG } from "./types.js";
|
|
21
|
+
export const QUOTA_TOAST_CONFIG_RELATIVE_PATHS = [
|
|
22
|
+
"opencode-quota/quota-toast.jsonc",
|
|
23
|
+
"opencode-quota/quota-toast.json",
|
|
24
|
+
];
|
|
25
|
+
export const QUOTA_TOAST_CONFIG_RELATIVE_PATH = QUOTA_TOAST_CONFIG_RELATIVE_PATHS[1];
|
|
26
|
+
/**
|
|
27
|
+
* Global canonical dashboard config (spec §7): read/written only here, applied
|
|
28
|
+
* after every global legacy layer and before project layers, and never an
|
|
29
|
+
* authoritative sidecar root. The in-repo `opencode-quota-gui/config.jsonc`
|
|
30
|
+
* stays reserved but inactive.
|
|
31
|
+
*/
|
|
32
|
+
export const GUI_CONFIG_RELATIVE_PATH = "opencode-quota-gui/config.jsonc";
|
|
33
|
+
export const GUI_CONFIG_SIBLING_JSON_RELATIVE_PATH = "opencode-quota-gui/config.json";
|
|
34
|
+
export function getGuiConfigPath(configDir) {
|
|
35
|
+
return join(configDir, GUI_CONFIG_RELATIVE_PATH);
|
|
36
|
+
}
|
|
37
|
+
export function getGuiConfigSiblingJsonPath(configDir) {
|
|
38
|
+
return join(configDir, GUI_CONFIG_SIBLING_JSON_RELATIVE_PATH);
|
|
39
|
+
}
|
|
40
|
+
export const QUOTA_TOAST_SETTING_SOURCE_KEYS = [
|
|
41
|
+
"enabled",
|
|
42
|
+
"enableToast",
|
|
43
|
+
"resetNotifications.enabled",
|
|
44
|
+
"resetNotifications.windows",
|
|
45
|
+
"tuiCommandDisplay",
|
|
46
|
+
"formatStyle",
|
|
47
|
+
"percentDisplayMode",
|
|
48
|
+
"quotaProjection",
|
|
49
|
+
"percentLabelStyle",
|
|
50
|
+
"accountingDetail",
|
|
51
|
+
"resetTimeDecimals",
|
|
52
|
+
"resetTimeSpaced",
|
|
53
|
+
"minIntervalMs",
|
|
54
|
+
"requestTimeoutMs",
|
|
55
|
+
"debug",
|
|
56
|
+
"enabledProviders",
|
|
57
|
+
"quotaProviders",
|
|
58
|
+
"anthropicBinaryPath",
|
|
59
|
+
"cursorPlan",
|
|
60
|
+
"cursorIncludedApiUsd",
|
|
61
|
+
"cursorBillingCycleStartDay",
|
|
62
|
+
"opencodeGoWindows",
|
|
63
|
+
"opencodeMonthlyLimit",
|
|
64
|
+
"pricingSnapshot.source",
|
|
65
|
+
"pricingSnapshot.autoRefresh",
|
|
66
|
+
"showOnIdle",
|
|
67
|
+
"showOnQuestion",
|
|
68
|
+
"showOnCompact",
|
|
69
|
+
"showOnBothFail",
|
|
70
|
+
"toastDurationMs",
|
|
71
|
+
"onlyCurrentModel",
|
|
72
|
+
"waitForQuotaReset",
|
|
73
|
+
"showSessionTokens",
|
|
74
|
+
"sessionTokenScope",
|
|
75
|
+
"tuiSidebarPanel.enabled",
|
|
76
|
+
"tuiSidebarPanel.formatStyle",
|
|
77
|
+
"tuiSidebarPanel.opencodeGoPreferredWindow",
|
|
78
|
+
"tuiCompactStatus.enabled",
|
|
79
|
+
"tuiCompactStatus.homeBottom",
|
|
80
|
+
"tuiCompactStatus.sessionPrompt",
|
|
81
|
+
"tuiCompactStatus.maxWidth",
|
|
82
|
+
"tuiCompactStatus.formatStyle",
|
|
83
|
+
"tuiPromptBar.enabled",
|
|
84
|
+
"maintainerAnnouncements.enabled",
|
|
85
|
+
"maintainerAnnouncements.home",
|
|
86
|
+
"maintainerAnnouncements.homeFrequency",
|
|
87
|
+
"layout.maxWidth",
|
|
88
|
+
"layout.narrowAt",
|
|
89
|
+
"layout.tinyAt",
|
|
90
|
+
"export.enabled",
|
|
91
|
+
"export.path",
|
|
92
|
+
"telemetry.enabled",
|
|
93
|
+
"dashboard.port",
|
|
94
|
+
"dashboard.hiddenCards",
|
|
95
|
+
"dashboard.hiddenCardsVersion",
|
|
96
|
+
"dashboard.hiddenRows",
|
|
97
|
+
"dashboard.providerOrder",
|
|
98
|
+
"dashboard.cardOrder",
|
|
99
|
+
];
|
|
100
|
+
export function createLoadConfigMeta() {
|
|
101
|
+
return {
|
|
102
|
+
source: "defaults",
|
|
103
|
+
paths: [],
|
|
104
|
+
globalConfigPaths: [],
|
|
105
|
+
workspaceConfigPaths: [],
|
|
106
|
+
settingSources: {},
|
|
107
|
+
settingSourceLayers: {},
|
|
108
|
+
networkSettingSources: {},
|
|
109
|
+
configIssues: [],
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const NETWORK_SETTING_SOURCE_KEYS = [
|
|
113
|
+
"enabled",
|
|
114
|
+
"enabledProviders",
|
|
115
|
+
"quotaProviders",
|
|
116
|
+
"minIntervalMs",
|
|
117
|
+
"requestTimeoutMs",
|
|
118
|
+
"pricingSnapshot.source",
|
|
119
|
+
"pricingSnapshot.autoRefresh",
|
|
120
|
+
"showOnIdle",
|
|
121
|
+
"showOnQuestion",
|
|
122
|
+
"showOnCompact",
|
|
123
|
+
"showOnBothFail",
|
|
124
|
+
];
|
|
125
|
+
export function getQuotaToastConfigPath(configRootDir, format = "json") {
|
|
126
|
+
return join(configRootDir, `opencode-quota/quota-toast.${format}`);
|
|
127
|
+
}
|
|
128
|
+
export function resolveQuotaToastConfigPath(configRootDir) {
|
|
129
|
+
return (QUOTA_TOAST_CONFIG_RELATIVE_PATHS.map((relativePath) => join(configRootDir, relativePath)).find((path) => existsSync(path)) ?? getQuotaToastConfigPath(configRootDir));
|
|
130
|
+
}
|
|
131
|
+
function hasOwnKey(value, key) {
|
|
132
|
+
return Object.hasOwn(value, key);
|
|
133
|
+
}
|
|
134
|
+
function isPlainObject(value) {
|
|
135
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
136
|
+
}
|
|
137
|
+
function isValidCursorQuotaPlan(plan) {
|
|
138
|
+
return typeof plan === "string" && ["none", "pro", "pro-plus", "ultra"].includes(plan);
|
|
139
|
+
}
|
|
140
|
+
function isValidPricingSnapshotSource(source) {
|
|
141
|
+
return typeof source === "string" && ["auto", "bundled", "runtime"].includes(source);
|
|
142
|
+
}
|
|
143
|
+
function isValidPricingSnapshotAutoRefresh(value) {
|
|
144
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0;
|
|
145
|
+
}
|
|
146
|
+
function isValidPercentDisplayMode(value) {
|
|
147
|
+
return value === "remaining" || value === "used";
|
|
148
|
+
}
|
|
149
|
+
function isValidPercentLabelStyle(value) {
|
|
150
|
+
return value === "full" || value === "bare";
|
|
151
|
+
}
|
|
152
|
+
function isValidAccountingDetail(value) {
|
|
153
|
+
return value === "summary" || value === "detailed";
|
|
154
|
+
}
|
|
155
|
+
function isValidTuiCommandDisplay(value) {
|
|
156
|
+
return value === "inline" || value === "dialog";
|
|
157
|
+
}
|
|
158
|
+
function isValidSessionTokenScope(value) {
|
|
159
|
+
return value === "current" || value === "tree";
|
|
160
|
+
}
|
|
161
|
+
export function isPositiveNumber(value) {
|
|
162
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
163
|
+
}
|
|
164
|
+
function isNonNegativeNumber(value) {
|
|
165
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
166
|
+
}
|
|
167
|
+
function isValidDashboardPort(value) {
|
|
168
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 65535;
|
|
169
|
+
}
|
|
170
|
+
function isValidCursorBillingCycleStartDay(value) {
|
|
171
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 1 && value <= 28;
|
|
172
|
+
}
|
|
173
|
+
const VALID_OPENCODE_GO_WINDOWS = ["rolling", "weekly", "monthly"];
|
|
174
|
+
function isValidOpenCodeGoWindow(value) {
|
|
175
|
+
return (typeof value === "string" &&
|
|
176
|
+
VALID_OPENCODE_GO_WINDOWS.includes(value));
|
|
177
|
+
}
|
|
178
|
+
export function isValidOpenCodeGoWindows(value) {
|
|
179
|
+
if (!Array.isArray(value))
|
|
180
|
+
return false;
|
|
181
|
+
if (value.length === 0)
|
|
182
|
+
return false;
|
|
183
|
+
return value.every(isValidOpenCodeGoWindow);
|
|
184
|
+
}
|
|
185
|
+
function normalizeOptionalString(value) {
|
|
186
|
+
if (typeof value !== "string") {
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
const trimmed = value.trim();
|
|
190
|
+
return trimmed ? trimmed : undefined;
|
|
191
|
+
}
|
|
192
|
+
function getExplicitFormatStyle(config) {
|
|
193
|
+
if (!config || !isQuotaFormatStyle(config.formatStyle)) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
return resolveQuotaFormatStyle(config.formatStyle);
|
|
197
|
+
}
|
|
198
|
+
function getConfiguredFormatStyle(quotaToastConfig) {
|
|
199
|
+
const formatStyle = getExplicitFormatStyle(quotaToastConfig);
|
|
200
|
+
if (formatStyle) {
|
|
201
|
+
return formatStyle;
|
|
202
|
+
}
|
|
203
|
+
const legacyFormatStyle = quotaToastConfig
|
|
204
|
+
?.toastStyle;
|
|
205
|
+
if (isQuotaFormatStyle(legacyFormatStyle)) {
|
|
206
|
+
return resolveQuotaFormatStyle(legacyFormatStyle);
|
|
207
|
+
}
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Remove duplicates from an array while preserving order
|
|
212
|
+
*/
|
|
213
|
+
function dedupe(list) {
|
|
214
|
+
return [...new Set(list)];
|
|
215
|
+
}
|
|
216
|
+
function cloneDefaultConfig() {
|
|
217
|
+
return cloneConfig(DEFAULT_CONFIG);
|
|
218
|
+
}
|
|
219
|
+
function cloneConfig(config) {
|
|
220
|
+
return {
|
|
221
|
+
...config,
|
|
222
|
+
enabledProviders: Array.isArray(config.enabledProviders)
|
|
223
|
+
? [...config.enabledProviders]
|
|
224
|
+
: config.enabledProviders,
|
|
225
|
+
quotaProviders: cloneQuotaProviders(config.quotaProviders),
|
|
226
|
+
resetNotifications: {
|
|
227
|
+
...config.resetNotifications,
|
|
228
|
+
windows: [...config.resetNotifications.windows],
|
|
229
|
+
},
|
|
230
|
+
opencodeGoWindows: [...config.opencodeGoWindows],
|
|
231
|
+
opencodeMonthlyLimit: config.opencodeMonthlyLimit,
|
|
232
|
+
pricingSnapshot: { ...config.pricingSnapshot },
|
|
233
|
+
tuiSidebarPanel: { ...config.tuiSidebarPanel },
|
|
234
|
+
tuiCompactStatus: { ...config.tuiCompactStatus },
|
|
235
|
+
tuiPromptBar: { ...config.tuiPromptBar },
|
|
236
|
+
maintainerAnnouncements: { ...config.maintainerAnnouncements },
|
|
237
|
+
layout: { ...config.layout },
|
|
238
|
+
export: { ...config.export },
|
|
239
|
+
telemetry: { ...config.telemetry },
|
|
240
|
+
dashboard: {
|
|
241
|
+
port: config.dashboard.port,
|
|
242
|
+
hiddenCards: [...config.dashboard.hiddenCards],
|
|
243
|
+
hiddenCardsVersion: config.dashboard.hiddenCardsVersion,
|
|
244
|
+
hiddenRows: [...config.dashboard.hiddenRows],
|
|
245
|
+
providerOrder: [...config.dashboard.providerOrder],
|
|
246
|
+
cardOrder: [...config.dashboard.cardOrder],
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
const QUOTA_RESET_WINDOWS = [
|
|
251
|
+
"fiveHour",
|
|
252
|
+
"hourly",
|
|
253
|
+
"daily",
|
|
254
|
+
"weekly",
|
|
255
|
+
"monthly",
|
|
256
|
+
"yearly",
|
|
257
|
+
];
|
|
258
|
+
function extractQuotaResetNotificationsPatch(value, reportIssue) {
|
|
259
|
+
if (!isPlainObject(value))
|
|
260
|
+
return undefined;
|
|
261
|
+
const patch = {};
|
|
262
|
+
if (hasOwnKey(value, "enabled")) {
|
|
263
|
+
if (typeof value.enabled === "boolean")
|
|
264
|
+
patch.enabled = value.enabled;
|
|
265
|
+
else
|
|
266
|
+
reportIssue?.("resetNotifications.enabled", "expected boolean");
|
|
267
|
+
}
|
|
268
|
+
if (hasOwnKey(value, "windows")) {
|
|
269
|
+
if (Array.isArray(value.windows) &&
|
|
270
|
+
value.windows.length > 0 &&
|
|
271
|
+
value.windows.every((window) => QUOTA_RESET_WINDOWS.includes(window))) {
|
|
272
|
+
patch.windows = dedupe(value.windows);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
reportIssue?.("resetNotifications.windows", `expected a non-empty array of: ${QUOTA_RESET_WINDOWS.join(", ")}`);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
279
|
+
}
|
|
280
|
+
function describeInvalidProviderValue(value) {
|
|
281
|
+
return typeof value === "string" ? value : typeof value;
|
|
282
|
+
}
|
|
283
|
+
/** Shared `enabledProviders` normalization (loader + GUI settings writes). */
|
|
284
|
+
export function normalizeEnabledProviders(value) {
|
|
285
|
+
if (value === "auto") {
|
|
286
|
+
return { value: "auto", issues: [] };
|
|
287
|
+
}
|
|
288
|
+
if (!Array.isArray(value)) {
|
|
289
|
+
return {
|
|
290
|
+
value: [],
|
|
291
|
+
issues: ['expected "auto" or an array of provider ids'],
|
|
292
|
+
invalidEmpty: true,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
if (value.length === 0) {
|
|
296
|
+
return { value: [], issues: [] };
|
|
297
|
+
}
|
|
298
|
+
const validProviders = [];
|
|
299
|
+
const invalidProviders = [];
|
|
300
|
+
for (const provider of value) {
|
|
301
|
+
if (typeof provider !== "string") {
|
|
302
|
+
invalidProviders.push(describeInvalidProviderValue(provider));
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
const normalized = normalizeQuotaProviderId(provider);
|
|
306
|
+
if (normalized && getQuotaProviderShape(normalized)) {
|
|
307
|
+
validProviders.push(normalized);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
invalidProviders.push(provider);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const issues = invalidProviders.length
|
|
314
|
+
? [`unknown provider id(s): ${dedupe(invalidProviders).join(", ")}`]
|
|
315
|
+
: [];
|
|
316
|
+
const normalizedProviders = dedupe(validProviders);
|
|
317
|
+
return {
|
|
318
|
+
value: normalizedProviders,
|
|
319
|
+
issues,
|
|
320
|
+
invalidEmpty: normalizedProviders.length === 0 && invalidProviders.length > 0,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function extractPricingSnapshotPatch(value) {
|
|
324
|
+
if (!isPlainObject(value)) {
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
327
|
+
const patch = {};
|
|
328
|
+
if (hasOwnKey(value, "source") && isValidPricingSnapshotSource(value.source)) {
|
|
329
|
+
patch.source = value.source;
|
|
330
|
+
}
|
|
331
|
+
if (hasOwnKey(value, "autoRefresh") && isValidPricingSnapshotAutoRefresh(value.autoRefresh)) {
|
|
332
|
+
patch.autoRefresh = value.autoRefresh;
|
|
333
|
+
}
|
|
334
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
335
|
+
}
|
|
336
|
+
function extractTuiSidebarPanelPatch(value) {
|
|
337
|
+
if (!isPlainObject(value)) {
|
|
338
|
+
return undefined;
|
|
339
|
+
}
|
|
340
|
+
const patch = {};
|
|
341
|
+
if (hasOwnKey(value, "enabled") && typeof value.enabled === "boolean") {
|
|
342
|
+
patch.enabled = value.enabled;
|
|
343
|
+
}
|
|
344
|
+
const sidebarFormatStyle = getExplicitFormatStyle(value);
|
|
345
|
+
if (sidebarFormatStyle) {
|
|
346
|
+
patch.formatStyle = sidebarFormatStyle;
|
|
347
|
+
}
|
|
348
|
+
if (hasOwnKey(value, "opencodeGoPreferredWindow") &&
|
|
349
|
+
isValidOpenCodeGoWindow(value.opencodeGoPreferredWindow)) {
|
|
350
|
+
patch.opencodeGoPreferredWindow = value.opencodeGoPreferredWindow;
|
|
351
|
+
}
|
|
352
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
353
|
+
}
|
|
354
|
+
function extractTuiCompactStatusPatch(value) {
|
|
355
|
+
if (!isPlainObject(value)) {
|
|
356
|
+
return undefined;
|
|
357
|
+
}
|
|
358
|
+
const patch = {};
|
|
359
|
+
if (hasOwnKey(value, "enabled") && typeof value.enabled === "boolean") {
|
|
360
|
+
patch.enabled = value.enabled;
|
|
361
|
+
}
|
|
362
|
+
if (hasOwnKey(value, "homeBottom") && typeof value.homeBottom === "boolean") {
|
|
363
|
+
patch.homeBottom = value.homeBottom;
|
|
364
|
+
}
|
|
365
|
+
if (hasOwnKey(value, "sessionPrompt") && typeof value.sessionPrompt === "boolean") {
|
|
366
|
+
patch.sessionPrompt = value.sessionPrompt;
|
|
367
|
+
}
|
|
368
|
+
if (hasOwnKey(value, "maxWidth") && isPositiveNumber(value.maxWidth)) {
|
|
369
|
+
patch.maxWidth = value.maxWidth;
|
|
370
|
+
}
|
|
371
|
+
const compactFormatStyle = getExplicitFormatStyle(value);
|
|
372
|
+
if (compactFormatStyle) {
|
|
373
|
+
patch.formatStyle = compactFormatStyle;
|
|
374
|
+
}
|
|
375
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
376
|
+
}
|
|
377
|
+
function extractTuiPromptBarPatch(value) {
|
|
378
|
+
if (!isPlainObject(value)) {
|
|
379
|
+
return undefined;
|
|
380
|
+
}
|
|
381
|
+
const patch = {};
|
|
382
|
+
if (hasOwnKey(value, "enabled") && typeof value.enabled === "boolean") {
|
|
383
|
+
patch.enabled = value.enabled;
|
|
384
|
+
}
|
|
385
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
386
|
+
}
|
|
387
|
+
function extractMaintainerAnnouncementsPatch(value) {
|
|
388
|
+
if (!isPlainObject(value)) {
|
|
389
|
+
return undefined;
|
|
390
|
+
}
|
|
391
|
+
const patch = {};
|
|
392
|
+
if (hasOwnKey(value, "enabled") && typeof value.enabled === "boolean") {
|
|
393
|
+
patch.enabled = value.enabled;
|
|
394
|
+
}
|
|
395
|
+
if (hasOwnKey(value, "home") && typeof value.home === "boolean") {
|
|
396
|
+
patch.home = value.home;
|
|
397
|
+
}
|
|
398
|
+
if (hasOwnKey(value, "homeFrequency") &&
|
|
399
|
+
(value.homeFrequency === "daily" || value.homeFrequency === "always")) {
|
|
400
|
+
patch.homeFrequency = value.homeFrequency;
|
|
401
|
+
}
|
|
402
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
403
|
+
}
|
|
404
|
+
function extractLayoutPatch(value) {
|
|
405
|
+
if (!isPlainObject(value)) {
|
|
406
|
+
return undefined;
|
|
407
|
+
}
|
|
408
|
+
const patch = {};
|
|
409
|
+
if (hasOwnKey(value, "maxWidth") && isPositiveNumber(value.maxWidth)) {
|
|
410
|
+
patch.maxWidth = value.maxWidth;
|
|
411
|
+
}
|
|
412
|
+
if (hasOwnKey(value, "narrowAt") && isPositiveNumber(value.narrowAt)) {
|
|
413
|
+
patch.narrowAt = value.narrowAt;
|
|
414
|
+
}
|
|
415
|
+
if (hasOwnKey(value, "tinyAt") && isPositiveNumber(value.tinyAt)) {
|
|
416
|
+
patch.tinyAt = value.tinyAt;
|
|
417
|
+
}
|
|
418
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
419
|
+
}
|
|
420
|
+
function extractExportConfigPatch(value) {
|
|
421
|
+
if (!isPlainObject(value)) {
|
|
422
|
+
return undefined;
|
|
423
|
+
}
|
|
424
|
+
const patch = {};
|
|
425
|
+
if (hasOwnKey(value, "enabled") && typeof value.enabled === "boolean") {
|
|
426
|
+
patch.enabled = value.enabled;
|
|
427
|
+
}
|
|
428
|
+
if (hasOwnKey(value, "path") && typeof value.path === "string") {
|
|
429
|
+
patch.path = value.path;
|
|
430
|
+
}
|
|
431
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
432
|
+
}
|
|
433
|
+
function extractTelemetryConfigPatch(value) {
|
|
434
|
+
if (!isPlainObject(value)) {
|
|
435
|
+
return undefined;
|
|
436
|
+
}
|
|
437
|
+
const patch = {};
|
|
438
|
+
if (hasOwnKey(value, "enabled") && typeof value.enabled === "boolean") {
|
|
439
|
+
patch.enabled = value.enabled;
|
|
440
|
+
}
|
|
441
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
442
|
+
}
|
|
443
|
+
function normalizeHiddenIdList(value) {
|
|
444
|
+
if (!Array.isArray(value)) {
|
|
445
|
+
return undefined;
|
|
446
|
+
}
|
|
447
|
+
const ids = [];
|
|
448
|
+
for (const entry of value) {
|
|
449
|
+
if (typeof entry !== "string" || entry.length === 0 || entry.length > 512) {
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
ids.push(entry);
|
|
453
|
+
}
|
|
454
|
+
return dedupe(ids).slice(0, DASHBOARD_HIDDEN_ID_LIMIT);
|
|
455
|
+
}
|
|
456
|
+
function extractDashboardPatch(value, reportIssue) {
|
|
457
|
+
if (!isPlainObject(value)) {
|
|
458
|
+
return undefined;
|
|
459
|
+
}
|
|
460
|
+
const patch = {};
|
|
461
|
+
if (hasOwnKey(value, "port")) {
|
|
462
|
+
if (isValidDashboardPort(value.port)) {
|
|
463
|
+
patch.port = value.port;
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
reportIssue?.("dashboard.port", "expected an integer between 1 and 65535");
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
if (hasOwnKey(value, "hiddenCardsVersion")) {
|
|
470
|
+
if (value.hiddenCardsVersion === DASHBOARD_HIDDEN_CARDS_VERSION) {
|
|
471
|
+
patch.hiddenCardsVersion = DASHBOARD_HIDDEN_CARDS_VERSION;
|
|
472
|
+
}
|
|
473
|
+
else if (value.hiddenCardsVersion !== 1) {
|
|
474
|
+
reportIssue?.("dashboard.hiddenCardsVersion", "expected 2");
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
for (const key of ["hiddenCards", "hiddenRows", "providerOrder", "cardOrder"]) {
|
|
478
|
+
if (!hasOwnKey(value, key)) {
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
const ids = normalizeHiddenIdList(value[key]);
|
|
482
|
+
if (!ids) {
|
|
483
|
+
reportIssue?.(`dashboard.${key}`, "expected an array of id strings");
|
|
484
|
+
continue;
|
|
485
|
+
}
|
|
486
|
+
// A layer without a v2 marker owns legacy semantics: a full provider-scope
|
|
487
|
+
// card id meant the whole provider group. Version 2 preserves exact ids.
|
|
488
|
+
patch[key] =
|
|
489
|
+
key === "hiddenCards" && value.hiddenCardsVersion !== DASHBOARD_HIDDEN_CARDS_VERSION
|
|
490
|
+
? normalizeLegacyDashboardHiddenCards(ids)
|
|
491
|
+
: ids;
|
|
492
|
+
}
|
|
493
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
494
|
+
}
|
|
495
|
+
function extractValidatedQuotaToastPatch(quotaToastConfig, reportIssue, options = {}) {
|
|
496
|
+
const patch = {};
|
|
497
|
+
if (hasOwnKey(quotaToastConfig, "enabled") && typeof quotaToastConfig.enabled === "boolean") {
|
|
498
|
+
patch.enabled = quotaToastConfig.enabled;
|
|
499
|
+
}
|
|
500
|
+
if (hasOwnKey(quotaToastConfig, "enableToast") &&
|
|
501
|
+
typeof quotaToastConfig.enableToast === "boolean") {
|
|
502
|
+
patch.enableToast = quotaToastConfig.enableToast;
|
|
503
|
+
}
|
|
504
|
+
if (hasOwnKey(quotaToastConfig, "resetNotifications")) {
|
|
505
|
+
const resetNotifications = extractQuotaResetNotificationsPatch(quotaToastConfig.resetNotifications, reportIssue);
|
|
506
|
+
if (resetNotifications)
|
|
507
|
+
patch.resetNotifications = resetNotifications;
|
|
508
|
+
}
|
|
509
|
+
if (hasOwnKey(quotaToastConfig, "tuiCommandDisplay")) {
|
|
510
|
+
if (isValidTuiCommandDisplay(quotaToastConfig.tuiCommandDisplay)) {
|
|
511
|
+
patch.tuiCommandDisplay = quotaToastConfig.tuiCommandDisplay;
|
|
512
|
+
}
|
|
513
|
+
else {
|
|
514
|
+
reportIssue?.("tuiCommandDisplay", 'expected "inline" or "dialog"');
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
const formatStyle = getConfiguredFormatStyle(quotaToastConfig);
|
|
518
|
+
if (formatStyle) {
|
|
519
|
+
patch.formatStyle = formatStyle;
|
|
520
|
+
}
|
|
521
|
+
if (hasOwnKey(quotaToastConfig, "percentDisplayMode") &&
|
|
522
|
+
isValidPercentDisplayMode(quotaToastConfig.percentDisplayMode)) {
|
|
523
|
+
patch.percentDisplayMode = quotaToastConfig.percentDisplayMode;
|
|
524
|
+
}
|
|
525
|
+
if (hasOwnKey(quotaToastConfig, "quotaProjection")) {
|
|
526
|
+
if (quotaToastConfig.quotaProjection === "runway") {
|
|
527
|
+
patch.quotaProjection = "runway";
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
reportIssue?.("quotaProjection", 'expected "runway"');
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (hasOwnKey(quotaToastConfig, "percentLabelStyle") &&
|
|
534
|
+
isValidPercentLabelStyle(quotaToastConfig.percentLabelStyle)) {
|
|
535
|
+
patch.percentLabelStyle = quotaToastConfig.percentLabelStyle;
|
|
536
|
+
}
|
|
537
|
+
if (hasOwnKey(quotaToastConfig, "accountingDetail")) {
|
|
538
|
+
if (isValidAccountingDetail(quotaToastConfig.accountingDetail)) {
|
|
539
|
+
patch.accountingDetail = quotaToastConfig.accountingDetail;
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
reportIssue?.("accountingDetail", 'expected "summary" or "detailed"');
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (hasOwnKey(quotaToastConfig, "resetTimeDecimals") &&
|
|
546
|
+
isResetTimeDecimals(quotaToastConfig.resetTimeDecimals)) {
|
|
547
|
+
patch.resetTimeDecimals = quotaToastConfig.resetTimeDecimals;
|
|
548
|
+
}
|
|
549
|
+
if (hasOwnKey(quotaToastConfig, "resetTimeSpaced") &&
|
|
550
|
+
typeof quotaToastConfig.resetTimeSpaced === "boolean") {
|
|
551
|
+
patch.resetTimeSpaced = quotaToastConfig.resetTimeSpaced;
|
|
552
|
+
}
|
|
553
|
+
if (hasOwnKey(quotaToastConfig, "minIntervalMs") &&
|
|
554
|
+
isPositiveNumber(quotaToastConfig.minIntervalMs)) {
|
|
555
|
+
patch.minIntervalMs = quotaToastConfig.minIntervalMs;
|
|
556
|
+
}
|
|
557
|
+
if (hasOwnKey(quotaToastConfig, "requestTimeoutMs") &&
|
|
558
|
+
isPositiveNumber(quotaToastConfig.requestTimeoutMs)) {
|
|
559
|
+
patch.requestTimeoutMs = quotaToastConfig.requestTimeoutMs;
|
|
560
|
+
}
|
|
561
|
+
if (hasOwnKey(quotaToastConfig, "debug") && typeof quotaToastConfig.debug === "boolean") {
|
|
562
|
+
patch.debug = quotaToastConfig.debug;
|
|
563
|
+
}
|
|
564
|
+
if (hasOwnKey(quotaToastConfig, "enabledProviders")) {
|
|
565
|
+
const enabledProviders = normalizeEnabledProviders(quotaToastConfig.enabledProviders);
|
|
566
|
+
for (const issue of enabledProviders.issues) {
|
|
567
|
+
reportIssue?.("enabledProviders", issue);
|
|
568
|
+
}
|
|
569
|
+
if (enabledProviders.value !== undefined) {
|
|
570
|
+
patch.enabledProviders = enabledProviders.value;
|
|
571
|
+
if (enabledProviders.invalidEmpty) {
|
|
572
|
+
patch.enabledProvidersInvalidEmpty = true;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (hasOwnKey(quotaToastConfig, "anthropicBinaryPath")) {
|
|
577
|
+
const anthropicBinaryPath = normalizeOptionalString(quotaToastConfig.anthropicBinaryPath);
|
|
578
|
+
if (anthropicBinaryPath !== undefined) {
|
|
579
|
+
patch.anthropicBinaryPath = anthropicBinaryPath;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
if (hasOwnKey(quotaToastConfig, "cursorPlan") &&
|
|
583
|
+
isValidCursorQuotaPlan(quotaToastConfig.cursorPlan)) {
|
|
584
|
+
patch.cursorPlan = quotaToastConfig.cursorPlan;
|
|
585
|
+
}
|
|
586
|
+
if (hasOwnKey(quotaToastConfig, "cursorIncludedApiUsd") &&
|
|
587
|
+
isPositiveNumber(quotaToastConfig.cursorIncludedApiUsd)) {
|
|
588
|
+
patch.cursorIncludedApiUsd = quotaToastConfig.cursorIncludedApiUsd;
|
|
589
|
+
}
|
|
590
|
+
if (hasOwnKey(quotaToastConfig, "cursorBillingCycleStartDay") &&
|
|
591
|
+
isValidCursorBillingCycleStartDay(quotaToastConfig.cursorBillingCycleStartDay)) {
|
|
592
|
+
patch.cursorBillingCycleStartDay = quotaToastConfig.cursorBillingCycleStartDay;
|
|
593
|
+
}
|
|
594
|
+
if (hasOwnKey(quotaToastConfig, "opencodeGoWindows") &&
|
|
595
|
+
isValidOpenCodeGoWindows(quotaToastConfig.opencodeGoWindows)) {
|
|
596
|
+
patch.opencodeGoWindows = quotaToastConfig.opencodeGoWindows;
|
|
597
|
+
}
|
|
598
|
+
if (hasOwnKey(quotaToastConfig, "opencodeMonthlyLimit")) {
|
|
599
|
+
const monthlyLimit = quotaToastConfig.opencodeMonthlyLimit;
|
|
600
|
+
// The GUI table accepts 0 as a real budget; legacy layers keep the strict form.
|
|
601
|
+
const monthlyLimitIsValid = options.allowZeroMonthlyLimit
|
|
602
|
+
? isNonNegativeNumber(monthlyLimit)
|
|
603
|
+
: isPositiveNumber(monthlyLimit);
|
|
604
|
+
if (monthlyLimitIsValid && typeof monthlyLimit === "number") {
|
|
605
|
+
patch.opencodeMonthlyLimit = monthlyLimit;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
if (hasOwnKey(quotaToastConfig, "opencodeZenDisplay")) {
|
|
609
|
+
reportIssue?.("opencodeZenDisplay", 'removed; use root "accountingDetail" ("summary" or "detailed")');
|
|
610
|
+
}
|
|
611
|
+
if (hasOwnKey(quotaToastConfig, "pricingSnapshot")) {
|
|
612
|
+
const pricingSnapshot = extractPricingSnapshotPatch(quotaToastConfig.pricingSnapshot);
|
|
613
|
+
if (pricingSnapshot) {
|
|
614
|
+
patch.pricingSnapshot = pricingSnapshot;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
if (hasOwnKey(quotaToastConfig, "showOnIdle") &&
|
|
618
|
+
typeof quotaToastConfig.showOnIdle === "boolean") {
|
|
619
|
+
patch.showOnIdle = quotaToastConfig.showOnIdle;
|
|
620
|
+
}
|
|
621
|
+
if (hasOwnKey(quotaToastConfig, "showOnQuestion") &&
|
|
622
|
+
typeof quotaToastConfig.showOnQuestion === "boolean") {
|
|
623
|
+
patch.showOnQuestion = quotaToastConfig.showOnQuestion;
|
|
624
|
+
}
|
|
625
|
+
if (hasOwnKey(quotaToastConfig, "showOnCompact") &&
|
|
626
|
+
typeof quotaToastConfig.showOnCompact === "boolean") {
|
|
627
|
+
patch.showOnCompact = quotaToastConfig.showOnCompact;
|
|
628
|
+
}
|
|
629
|
+
if (hasOwnKey(quotaToastConfig, "showOnBothFail") &&
|
|
630
|
+
typeof quotaToastConfig.showOnBothFail === "boolean") {
|
|
631
|
+
patch.showOnBothFail = quotaToastConfig.showOnBothFail;
|
|
632
|
+
}
|
|
633
|
+
if (hasOwnKey(quotaToastConfig, "toastDurationMs") &&
|
|
634
|
+
isPositiveNumber(quotaToastConfig.toastDurationMs)) {
|
|
635
|
+
patch.toastDurationMs = quotaToastConfig.toastDurationMs;
|
|
636
|
+
}
|
|
637
|
+
if (hasOwnKey(quotaToastConfig, "onlyCurrentModel") &&
|
|
638
|
+
typeof quotaToastConfig.onlyCurrentModel === "boolean") {
|
|
639
|
+
patch.onlyCurrentModel = quotaToastConfig.onlyCurrentModel;
|
|
640
|
+
}
|
|
641
|
+
if (hasOwnKey(quotaToastConfig, "waitForQuotaReset") &&
|
|
642
|
+
typeof quotaToastConfig.waitForQuotaReset === "boolean") {
|
|
643
|
+
patch.waitForQuotaReset = quotaToastConfig.waitForQuotaReset;
|
|
644
|
+
}
|
|
645
|
+
if (hasOwnKey(quotaToastConfig, "showSessionTokens") &&
|
|
646
|
+
typeof quotaToastConfig.showSessionTokens === "boolean") {
|
|
647
|
+
patch.showSessionTokens = quotaToastConfig.showSessionTokens;
|
|
648
|
+
}
|
|
649
|
+
if (hasOwnKey(quotaToastConfig, "sessionTokenScope")) {
|
|
650
|
+
if (isValidSessionTokenScope(quotaToastConfig.sessionTokenScope)) {
|
|
651
|
+
patch.sessionTokenScope = quotaToastConfig.sessionTokenScope;
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
654
|
+
reportIssue?.("sessionTokenScope", 'expected "current" or "tree"');
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
if (hasOwnKey(quotaToastConfig, "tuiSidebarPanel")) {
|
|
658
|
+
const tuiSidebarPanel = extractTuiSidebarPanelPatch(quotaToastConfig.tuiSidebarPanel);
|
|
659
|
+
if (tuiSidebarPanel) {
|
|
660
|
+
patch.tuiSidebarPanel = tuiSidebarPanel;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (hasOwnKey(quotaToastConfig, "tuiCompactStatus")) {
|
|
664
|
+
const tuiCompactStatus = extractTuiCompactStatusPatch(quotaToastConfig.tuiCompactStatus);
|
|
665
|
+
if (tuiCompactStatus) {
|
|
666
|
+
patch.tuiCompactStatus = tuiCompactStatus;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (hasOwnKey(quotaToastConfig, "tuiPromptBar")) {
|
|
670
|
+
const tuiPromptBar = extractTuiPromptBarPatch(quotaToastConfig.tuiPromptBar);
|
|
671
|
+
if (tuiPromptBar) {
|
|
672
|
+
patch.tuiPromptBar = tuiPromptBar;
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
if (hasOwnKey(quotaToastConfig, "maintainerAnnouncements")) {
|
|
676
|
+
const maintainerAnnouncements = extractMaintainerAnnouncementsPatch(quotaToastConfig.maintainerAnnouncements);
|
|
677
|
+
if (maintainerAnnouncements) {
|
|
678
|
+
patch.maintainerAnnouncements = maintainerAnnouncements;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
if (hasOwnKey(quotaToastConfig, "layout")) {
|
|
682
|
+
const layout = extractLayoutPatch(quotaToastConfig.layout);
|
|
683
|
+
if (layout) {
|
|
684
|
+
patch.layout = layout;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
if (hasOwnKey(quotaToastConfig, "export")) {
|
|
688
|
+
const exportConfig = extractExportConfigPatch(quotaToastConfig.export);
|
|
689
|
+
if (exportConfig) {
|
|
690
|
+
patch.export = exportConfig;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (hasOwnKey(quotaToastConfig, "telemetry")) {
|
|
694
|
+
const telemetry = extractTelemetryConfigPatch(quotaToastConfig.telemetry);
|
|
695
|
+
if (telemetry) {
|
|
696
|
+
patch.telemetry = telemetry;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
if (hasOwnKey(quotaToastConfig, "dashboard")) {
|
|
700
|
+
const dashboard = extractDashboardPatch(quotaToastConfig.dashboard, reportIssue);
|
|
701
|
+
if (dashboard) {
|
|
702
|
+
patch.dashboard = dashboard;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return patch;
|
|
706
|
+
}
|
|
707
|
+
function applySettingSource(settingSources, key, sourcePath) {
|
|
708
|
+
settingSources[key] = sourcePath;
|
|
709
|
+
}
|
|
710
|
+
function applyValidatedQuotaToastPatch(config, patch, sourcePath, settingSources) {
|
|
711
|
+
if (hasOwnKey(patch, "enabled")) {
|
|
712
|
+
config.enabled = patch.enabled;
|
|
713
|
+
applySettingSource(settingSources, "enabled", sourcePath);
|
|
714
|
+
}
|
|
715
|
+
if (hasOwnKey(patch, "enableToast")) {
|
|
716
|
+
config.enableToast = patch.enableToast;
|
|
717
|
+
applySettingSource(settingSources, "enableToast", sourcePath);
|
|
718
|
+
}
|
|
719
|
+
if (patch.resetNotifications) {
|
|
720
|
+
if (hasOwnKey(patch.resetNotifications, "enabled")) {
|
|
721
|
+
config.resetNotifications.enabled = patch.resetNotifications.enabled;
|
|
722
|
+
applySettingSource(settingSources, "resetNotifications.enabled", sourcePath);
|
|
723
|
+
}
|
|
724
|
+
if (hasOwnKey(patch.resetNotifications, "windows")) {
|
|
725
|
+
config.resetNotifications.windows = [...patch.resetNotifications.windows];
|
|
726
|
+
applySettingSource(settingSources, "resetNotifications.windows", sourcePath);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
if (hasOwnKey(patch, "tuiCommandDisplay")) {
|
|
730
|
+
config.tuiCommandDisplay = patch.tuiCommandDisplay;
|
|
731
|
+
applySettingSource(settingSources, "tuiCommandDisplay", sourcePath);
|
|
732
|
+
}
|
|
733
|
+
if (hasOwnKey(patch, "formatStyle")) {
|
|
734
|
+
config.formatStyle = patch.formatStyle;
|
|
735
|
+
applySettingSource(settingSources, "formatStyle", sourcePath);
|
|
736
|
+
}
|
|
737
|
+
if (hasOwnKey(patch, "percentDisplayMode")) {
|
|
738
|
+
config.percentDisplayMode = patch.percentDisplayMode;
|
|
739
|
+
applySettingSource(settingSources, "percentDisplayMode", sourcePath);
|
|
740
|
+
}
|
|
741
|
+
if (hasOwnKey(patch, "quotaProjection")) {
|
|
742
|
+
config.quotaProjection = patch.quotaProjection;
|
|
743
|
+
applySettingSource(settingSources, "quotaProjection", sourcePath);
|
|
744
|
+
}
|
|
745
|
+
if (hasOwnKey(patch, "percentLabelStyle")) {
|
|
746
|
+
config.percentLabelStyle = patch.percentLabelStyle;
|
|
747
|
+
applySettingSource(settingSources, "percentLabelStyle", sourcePath);
|
|
748
|
+
}
|
|
749
|
+
if (hasOwnKey(patch, "accountingDetail")) {
|
|
750
|
+
config.accountingDetail = patch.accountingDetail;
|
|
751
|
+
applySettingSource(settingSources, "accountingDetail", sourcePath);
|
|
752
|
+
}
|
|
753
|
+
if (hasOwnKey(patch, "resetTimeDecimals")) {
|
|
754
|
+
config.resetTimeDecimals = patch.resetTimeDecimals;
|
|
755
|
+
applySettingSource(settingSources, "resetTimeDecimals", sourcePath);
|
|
756
|
+
}
|
|
757
|
+
if (hasOwnKey(patch, "resetTimeSpaced")) {
|
|
758
|
+
config.resetTimeSpaced = patch.resetTimeSpaced;
|
|
759
|
+
applySettingSource(settingSources, "resetTimeSpaced", sourcePath);
|
|
760
|
+
}
|
|
761
|
+
if (hasOwnKey(patch, "minIntervalMs")) {
|
|
762
|
+
config.minIntervalMs = patch.minIntervalMs;
|
|
763
|
+
applySettingSource(settingSources, "minIntervalMs", sourcePath);
|
|
764
|
+
}
|
|
765
|
+
if (hasOwnKey(patch, "requestTimeoutMs")) {
|
|
766
|
+
config.requestTimeoutMs = patch.requestTimeoutMs;
|
|
767
|
+
applySettingSource(settingSources, "requestTimeoutMs", sourcePath);
|
|
768
|
+
}
|
|
769
|
+
if (hasOwnKey(patch, "debug")) {
|
|
770
|
+
config.debug = patch.debug;
|
|
771
|
+
applySettingSource(settingSources, "debug", sourcePath);
|
|
772
|
+
}
|
|
773
|
+
if (hasOwnKey(patch, "enabledProviders")) {
|
|
774
|
+
if (!(patch.enabledProvidersInvalidEmpty && settingSources.enabledProviders)) {
|
|
775
|
+
config.enabledProviders =
|
|
776
|
+
patch.enabledProviders === "auto" ? "auto" : [...patch.enabledProviders];
|
|
777
|
+
applySettingSource(settingSources, "enabledProviders", sourcePath);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
if (hasOwnKey(patch, "anthropicBinaryPath")) {
|
|
781
|
+
config.anthropicBinaryPath = patch.anthropicBinaryPath;
|
|
782
|
+
applySettingSource(settingSources, "anthropicBinaryPath", sourcePath);
|
|
783
|
+
}
|
|
784
|
+
if (hasOwnKey(patch, "cursorPlan")) {
|
|
785
|
+
config.cursorPlan = patch.cursorPlan;
|
|
786
|
+
applySettingSource(settingSources, "cursorPlan", sourcePath);
|
|
787
|
+
}
|
|
788
|
+
if (hasOwnKey(patch, "cursorIncludedApiUsd")) {
|
|
789
|
+
config.cursorIncludedApiUsd = patch.cursorIncludedApiUsd;
|
|
790
|
+
applySettingSource(settingSources, "cursorIncludedApiUsd", sourcePath);
|
|
791
|
+
}
|
|
792
|
+
if (hasOwnKey(patch, "cursorBillingCycleStartDay")) {
|
|
793
|
+
config.cursorBillingCycleStartDay = patch.cursorBillingCycleStartDay;
|
|
794
|
+
applySettingSource(settingSources, "cursorBillingCycleStartDay", sourcePath);
|
|
795
|
+
}
|
|
796
|
+
if (hasOwnKey(patch, "opencodeGoWindows")) {
|
|
797
|
+
config.opencodeGoWindows = [...patch.opencodeGoWindows];
|
|
798
|
+
applySettingSource(settingSources, "opencodeGoWindows", sourcePath);
|
|
799
|
+
}
|
|
800
|
+
if (hasOwnKey(patch, "opencodeMonthlyLimit")) {
|
|
801
|
+
config.opencodeMonthlyLimit = patch.opencodeMonthlyLimit;
|
|
802
|
+
applySettingSource(settingSources, "opencodeMonthlyLimit", sourcePath);
|
|
803
|
+
}
|
|
804
|
+
if (patch.pricingSnapshot) {
|
|
805
|
+
if (hasOwnKey(patch.pricingSnapshot, "source")) {
|
|
806
|
+
config.pricingSnapshot.source = patch.pricingSnapshot.source;
|
|
807
|
+
applySettingSource(settingSources, "pricingSnapshot.source", sourcePath);
|
|
808
|
+
}
|
|
809
|
+
if (hasOwnKey(patch.pricingSnapshot, "autoRefresh")) {
|
|
810
|
+
config.pricingSnapshot.autoRefresh = patch.pricingSnapshot.autoRefresh;
|
|
811
|
+
applySettingSource(settingSources, "pricingSnapshot.autoRefresh", sourcePath);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
if (hasOwnKey(patch, "showOnIdle")) {
|
|
815
|
+
config.showOnIdle = patch.showOnIdle;
|
|
816
|
+
applySettingSource(settingSources, "showOnIdle", sourcePath);
|
|
817
|
+
}
|
|
818
|
+
if (hasOwnKey(patch, "showOnQuestion")) {
|
|
819
|
+
config.showOnQuestion = patch.showOnQuestion;
|
|
820
|
+
applySettingSource(settingSources, "showOnQuestion", sourcePath);
|
|
821
|
+
}
|
|
822
|
+
if (hasOwnKey(patch, "showOnCompact")) {
|
|
823
|
+
config.showOnCompact = patch.showOnCompact;
|
|
824
|
+
applySettingSource(settingSources, "showOnCompact", sourcePath);
|
|
825
|
+
}
|
|
826
|
+
if (hasOwnKey(patch, "showOnBothFail")) {
|
|
827
|
+
config.showOnBothFail = patch.showOnBothFail;
|
|
828
|
+
applySettingSource(settingSources, "showOnBothFail", sourcePath);
|
|
829
|
+
}
|
|
830
|
+
if (hasOwnKey(patch, "toastDurationMs")) {
|
|
831
|
+
config.toastDurationMs = patch.toastDurationMs;
|
|
832
|
+
applySettingSource(settingSources, "toastDurationMs", sourcePath);
|
|
833
|
+
}
|
|
834
|
+
if (hasOwnKey(patch, "onlyCurrentModel")) {
|
|
835
|
+
config.onlyCurrentModel = patch.onlyCurrentModel;
|
|
836
|
+
applySettingSource(settingSources, "onlyCurrentModel", sourcePath);
|
|
837
|
+
}
|
|
838
|
+
if (hasOwnKey(patch, "waitForQuotaReset")) {
|
|
839
|
+
config.waitForQuotaReset = patch.waitForQuotaReset;
|
|
840
|
+
applySettingSource(settingSources, "waitForQuotaReset", sourcePath);
|
|
841
|
+
}
|
|
842
|
+
if (hasOwnKey(patch, "showSessionTokens")) {
|
|
843
|
+
config.showSessionTokens = patch.showSessionTokens;
|
|
844
|
+
applySettingSource(settingSources, "showSessionTokens", sourcePath);
|
|
845
|
+
}
|
|
846
|
+
if (hasOwnKey(patch, "sessionTokenScope")) {
|
|
847
|
+
config.sessionTokenScope = patch.sessionTokenScope;
|
|
848
|
+
applySettingSource(settingSources, "sessionTokenScope", sourcePath);
|
|
849
|
+
}
|
|
850
|
+
if (patch.tuiSidebarPanel) {
|
|
851
|
+
if (hasOwnKey(patch.tuiSidebarPanel, "enabled")) {
|
|
852
|
+
config.tuiSidebarPanel.enabled = patch.tuiSidebarPanel.enabled;
|
|
853
|
+
applySettingSource(settingSources, "tuiSidebarPanel.enabled", sourcePath);
|
|
854
|
+
}
|
|
855
|
+
if (hasOwnKey(patch.tuiSidebarPanel, "formatStyle")) {
|
|
856
|
+
config.tuiSidebarPanel.formatStyle = patch.tuiSidebarPanel.formatStyle;
|
|
857
|
+
applySettingSource(settingSources, "tuiSidebarPanel.formatStyle", sourcePath);
|
|
858
|
+
}
|
|
859
|
+
if (hasOwnKey(patch.tuiSidebarPanel, "opencodeGoPreferredWindow")) {
|
|
860
|
+
config.tuiSidebarPanel.opencodeGoPreferredWindow =
|
|
861
|
+
patch.tuiSidebarPanel.opencodeGoPreferredWindow;
|
|
862
|
+
applySettingSource(settingSources, "tuiSidebarPanel.opencodeGoPreferredWindow", sourcePath);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
if (patch.tuiCompactStatus) {
|
|
866
|
+
if (hasOwnKey(patch.tuiCompactStatus, "enabled")) {
|
|
867
|
+
config.tuiCompactStatus.enabled = patch.tuiCompactStatus.enabled;
|
|
868
|
+
applySettingSource(settingSources, "tuiCompactStatus.enabled", sourcePath);
|
|
869
|
+
}
|
|
870
|
+
if (hasOwnKey(patch.tuiCompactStatus, "homeBottom")) {
|
|
871
|
+
config.tuiCompactStatus.homeBottom = patch.tuiCompactStatus.homeBottom;
|
|
872
|
+
applySettingSource(settingSources, "tuiCompactStatus.homeBottom", sourcePath);
|
|
873
|
+
}
|
|
874
|
+
if (hasOwnKey(patch.tuiCompactStatus, "sessionPrompt")) {
|
|
875
|
+
config.tuiCompactStatus.sessionPrompt = patch.tuiCompactStatus.sessionPrompt;
|
|
876
|
+
applySettingSource(settingSources, "tuiCompactStatus.sessionPrompt", sourcePath);
|
|
877
|
+
}
|
|
878
|
+
if (hasOwnKey(patch.tuiCompactStatus, "maxWidth")) {
|
|
879
|
+
config.tuiCompactStatus.maxWidth = patch.tuiCompactStatus.maxWidth;
|
|
880
|
+
applySettingSource(settingSources, "tuiCompactStatus.maxWidth", sourcePath);
|
|
881
|
+
}
|
|
882
|
+
if (hasOwnKey(patch.tuiCompactStatus, "formatStyle")) {
|
|
883
|
+
config.tuiCompactStatus.formatStyle = patch.tuiCompactStatus.formatStyle;
|
|
884
|
+
applySettingSource(settingSources, "tuiCompactStatus.formatStyle", sourcePath);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
if (patch.tuiPromptBar) {
|
|
888
|
+
if (hasOwnKey(patch.tuiPromptBar, "enabled")) {
|
|
889
|
+
config.tuiPromptBar.enabled = patch.tuiPromptBar.enabled;
|
|
890
|
+
applySettingSource(settingSources, "tuiPromptBar.enabled", sourcePath);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
if (patch.maintainerAnnouncements) {
|
|
894
|
+
if (hasOwnKey(patch.maintainerAnnouncements, "enabled")) {
|
|
895
|
+
config.maintainerAnnouncements.enabled = patch.maintainerAnnouncements.enabled;
|
|
896
|
+
applySettingSource(settingSources, "maintainerAnnouncements.enabled", sourcePath);
|
|
897
|
+
}
|
|
898
|
+
if (hasOwnKey(patch.maintainerAnnouncements, "home")) {
|
|
899
|
+
config.maintainerAnnouncements.home = patch.maintainerAnnouncements.home;
|
|
900
|
+
applySettingSource(settingSources, "maintainerAnnouncements.home", sourcePath);
|
|
901
|
+
}
|
|
902
|
+
if (hasOwnKey(patch.maintainerAnnouncements, "homeFrequency")) {
|
|
903
|
+
config.maintainerAnnouncements.homeFrequency = patch.maintainerAnnouncements.homeFrequency;
|
|
904
|
+
applySettingSource(settingSources, "maintainerAnnouncements.homeFrequency", sourcePath);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
if (patch.layout) {
|
|
908
|
+
if (hasOwnKey(patch.layout, "maxWidth")) {
|
|
909
|
+
config.layout.maxWidth = patch.layout.maxWidth;
|
|
910
|
+
applySettingSource(settingSources, "layout.maxWidth", sourcePath);
|
|
911
|
+
}
|
|
912
|
+
if (hasOwnKey(patch.layout, "narrowAt")) {
|
|
913
|
+
config.layout.narrowAt = patch.layout.narrowAt;
|
|
914
|
+
applySettingSource(settingSources, "layout.narrowAt", sourcePath);
|
|
915
|
+
}
|
|
916
|
+
if (hasOwnKey(patch.layout, "tinyAt")) {
|
|
917
|
+
config.layout.tinyAt = patch.layout.tinyAt;
|
|
918
|
+
applySettingSource(settingSources, "layout.tinyAt", sourcePath);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
if (patch.export) {
|
|
922
|
+
if (hasOwnKey(patch.export, "enabled")) {
|
|
923
|
+
config.export.enabled = patch.export.enabled;
|
|
924
|
+
applySettingSource(settingSources, "export.enabled", sourcePath);
|
|
925
|
+
}
|
|
926
|
+
if (hasOwnKey(patch.export, "path")) {
|
|
927
|
+
config.export.path = patch.export.path;
|
|
928
|
+
applySettingSource(settingSources, "export.path", sourcePath);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
if (patch.telemetry && hasOwnKey(patch.telemetry, "enabled")) {
|
|
932
|
+
config.telemetry.enabled = patch.telemetry.enabled;
|
|
933
|
+
applySettingSource(settingSources, "telemetry.enabled", sourcePath);
|
|
934
|
+
}
|
|
935
|
+
if (patch.dashboard) {
|
|
936
|
+
if (hasOwnKey(patch.dashboard, "port")) {
|
|
937
|
+
config.dashboard.port = patch.dashboard.port;
|
|
938
|
+
applySettingSource(settingSources, "dashboard.port", sourcePath);
|
|
939
|
+
}
|
|
940
|
+
if (hasOwnKey(patch.dashboard, "hiddenCards")) {
|
|
941
|
+
config.dashboard.hiddenCards = [...patch.dashboard.hiddenCards];
|
|
942
|
+
applySettingSource(settingSources, "dashboard.hiddenCards", sourcePath);
|
|
943
|
+
}
|
|
944
|
+
if (hasOwnKey(patch.dashboard, "hiddenCardsVersion")) {
|
|
945
|
+
config.dashboard.hiddenCardsVersion = patch.dashboard.hiddenCardsVersion;
|
|
946
|
+
applySettingSource(settingSources, "dashboard.hiddenCardsVersion", sourcePath);
|
|
947
|
+
}
|
|
948
|
+
if (hasOwnKey(patch.dashboard, "hiddenRows")) {
|
|
949
|
+
config.dashboard.hiddenRows = [...patch.dashboard.hiddenRows];
|
|
950
|
+
applySettingSource(settingSources, "dashboard.hiddenRows", sourcePath);
|
|
951
|
+
}
|
|
952
|
+
if (patch.dashboard.providerOrder) {
|
|
953
|
+
config.dashboard.providerOrder = [...patch.dashboard.providerOrder];
|
|
954
|
+
applySettingSource(settingSources, "dashboard.providerOrder", sourcePath);
|
|
955
|
+
}
|
|
956
|
+
if (patch.dashboard.cardOrder) {
|
|
957
|
+
config.dashboard.cardOrder = [...patch.dashboard.cardOrder];
|
|
958
|
+
applySettingSource(settingSources, "dashboard.cardOrder", sourcePath);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
function projectNetworkSettingSources(settingSources) {
|
|
963
|
+
const projected = {};
|
|
964
|
+
for (const key of NETWORK_SETTING_SOURCE_KEYS) {
|
|
965
|
+
const source = settingSources[key];
|
|
966
|
+
if (typeof source === "string" && source.length > 0) {
|
|
967
|
+
projected[key] = source;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
return projected;
|
|
971
|
+
}
|
|
972
|
+
function buildConfigLayerCandidatesForRoot(dir, scope) {
|
|
973
|
+
return [
|
|
974
|
+
...QUOTA_TOAST_CONFIG_RELATIVE_PATHS.map((relativePath) => ({
|
|
975
|
+
path: join(dir, relativePath),
|
|
976
|
+
rootDir: dir,
|
|
977
|
+
scope,
|
|
978
|
+
kind: "plugin",
|
|
979
|
+
})),
|
|
980
|
+
...buildOpenCodeConfigCandidates({
|
|
981
|
+
directories: [dir],
|
|
982
|
+
formatOrder: ["json", "jsonc"],
|
|
983
|
+
}).map((candidate) => ({
|
|
984
|
+
path: candidate.path,
|
|
985
|
+
rootDir: dir,
|
|
986
|
+
scope,
|
|
987
|
+
kind: "legacy",
|
|
988
|
+
})),
|
|
989
|
+
];
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Filesystem identity of a layer root: the same real directory can be named
|
|
993
|
+
* through different casing (Windows) or through a symlink/junction, so existing
|
|
994
|
+
* roots compare by their native real path; a missing root compares by its own
|
|
995
|
+
* path, with no case folding, keeping distinct case-sensitive roots distinct.
|
|
996
|
+
*/
|
|
997
|
+
function configLayerRootIdentity(path) {
|
|
998
|
+
if (!existsSync(path)) {
|
|
999
|
+
return path;
|
|
1000
|
+
}
|
|
1001
|
+
try {
|
|
1002
|
+
return realpathSync.native(path);
|
|
1003
|
+
}
|
|
1004
|
+
catch {
|
|
1005
|
+
return path;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
export function buildConfigLayerCandidates(globalConfigDir, configRootDir) {
|
|
1009
|
+
const workspaceCandidates = buildConfigLayerCandidatesForRoot(configRootDir, "workspace");
|
|
1010
|
+
const globalCandidates = buildConfigLayerCandidatesForRoot(globalConfigDir, "global");
|
|
1011
|
+
const sameRealRoot = configLayerRootIdentity(globalConfigDir) === configLayerRootIdentity(configRootDir);
|
|
1012
|
+
const globalPaths = new Set(globalCandidates.map((candidate) => candidate.path));
|
|
1013
|
+
return [
|
|
1014
|
+
...globalCandidates,
|
|
1015
|
+
// The canonical dashboard file is a global layer: it overrides global
|
|
1016
|
+
// legacy values, but a project layer still wins for the same key.
|
|
1017
|
+
{
|
|
1018
|
+
path: getGuiConfigPath(globalConfigDir),
|
|
1019
|
+
rootDir: globalConfigDir,
|
|
1020
|
+
scope: "global",
|
|
1021
|
+
kind: "canonical",
|
|
1022
|
+
},
|
|
1023
|
+
// When both roots name the same real directory, the workspace layer is the
|
|
1024
|
+
// global layer reached through an alias: dropping every workspace candidate
|
|
1025
|
+
// keeps the canonical global layer on top instead of reapplying global
|
|
1026
|
+
// legacy values after it.
|
|
1027
|
+
...workspaceCandidates.filter((candidate) => !sameRealRoot && !globalPaths.has(candidate.path)),
|
|
1028
|
+
];
|
|
1029
|
+
}
|
|
1030
|
+
function getConfigLayerSourceLabel(candidate) {
|
|
1031
|
+
if (candidate.kind === "canonical") {
|
|
1032
|
+
return candidate.path;
|
|
1033
|
+
}
|
|
1034
|
+
const suffix = candidate.kind === "plugin"
|
|
1035
|
+
? candidate.path.endsWith(".jsonc")
|
|
1036
|
+
? QUOTA_TOAST_CONFIG_RELATIVE_PATHS[0]
|
|
1037
|
+
: QUOTA_TOAST_CONFIG_RELATIVE_PATHS[1]
|
|
1038
|
+
: "experimental.quotaToast";
|
|
1039
|
+
return `${candidate.path} (${suffix})`;
|
|
1040
|
+
}
|
|
1041
|
+
async function readConfigJsonFile(path) {
|
|
1042
|
+
const result = await readOpenCodeConfigCandidate({
|
|
1043
|
+
path,
|
|
1044
|
+
format: path.endsWith(".jsonc") ? "jsonc" : "json",
|
|
1045
|
+
});
|
|
1046
|
+
return result.state === "parsed" ? result.value : null;
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Load plugin configuration from OpenCode config
|
|
1050
|
+
*
|
|
1051
|
+
* Legacy-compatible layered read (`defaults → global legacy → global canonical
|
|
1052
|
+
* → project layers → SDK fallback`). Reserved for the explicit settings import
|
|
1053
|
+
* and its preview; runtime callers use the canonical-only `loadConfig`.
|
|
1054
|
+
*
|
|
1055
|
+
* @param client - Optional OpenCode SDK client fallback
|
|
1056
|
+
* @returns Merged configuration with defaults
|
|
1057
|
+
*/
|
|
1058
|
+
export async function loadConfigLayered(client, meta, options) {
|
|
1059
|
+
async function readJson(path) {
|
|
1060
|
+
return readConfigJsonFile(path);
|
|
1061
|
+
}
|
|
1062
|
+
async function loadFromFiles() {
|
|
1063
|
+
const configRootDir = options?.configRootDir ?? options?.cwd ?? process.cwd();
|
|
1064
|
+
const configDir = options?.globalConfigDir ?? getOpencodeRuntimeDirs().configDir;
|
|
1065
|
+
const config = cloneDefaultConfig();
|
|
1066
|
+
const usedPaths = [];
|
|
1067
|
+
const globalConfigPaths = [];
|
|
1068
|
+
const workspaceConfigPaths = [];
|
|
1069
|
+
const settingSources = {};
|
|
1070
|
+
const settingSourceLayers = {};
|
|
1071
|
+
const configIssues = [];
|
|
1072
|
+
const authoritativeSidecarRoots = new Set();
|
|
1073
|
+
for (const candidate of buildConfigLayerCandidates(configDir, configRootDir)) {
|
|
1074
|
+
const rootKey = `${candidate.scope}:${candidate.rootDir}`;
|
|
1075
|
+
if (candidate.kind === "legacy" && authoritativeSidecarRoots.has(rootKey)) {
|
|
1076
|
+
continue;
|
|
1077
|
+
}
|
|
1078
|
+
if (candidate.kind === "plugin" && authoritativeSidecarRoots.has(rootKey)) {
|
|
1079
|
+
continue;
|
|
1080
|
+
}
|
|
1081
|
+
if (!existsSync(candidate.path)) {
|
|
1082
|
+
continue;
|
|
1083
|
+
}
|
|
1084
|
+
const parsed = await readJson(candidate.path);
|
|
1085
|
+
if (!isPlainObject(parsed)) {
|
|
1086
|
+
if (candidate.kind === "plugin" || candidate.kind === "canonical") {
|
|
1087
|
+
const sourcePath = getConfigLayerSourceLabel(candidate);
|
|
1088
|
+
usedPaths.push(sourcePath);
|
|
1089
|
+
if (candidate.scope === "global") {
|
|
1090
|
+
globalConfigPaths.push(sourcePath);
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
workspaceConfigPaths.push(sourcePath);
|
|
1094
|
+
}
|
|
1095
|
+
configIssues.push({
|
|
1096
|
+
path: sourcePath,
|
|
1097
|
+
key: "$root",
|
|
1098
|
+
message: candidate.kind === "canonical"
|
|
1099
|
+
? "malformed JSONC; lower layers apply and writes are disabled"
|
|
1100
|
+
: "expected readable JSON object; this sidecar is not authoritative",
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
continue;
|
|
1104
|
+
}
|
|
1105
|
+
if (candidate.kind === "plugin") {
|
|
1106
|
+
authoritativeSidecarRoots.add(rootKey);
|
|
1107
|
+
if (candidate.path.endsWith(".jsonc") &&
|
|
1108
|
+
existsSync(getQuotaToastConfigPath(candidate.rootDir, "json"))) {
|
|
1109
|
+
configIssues.push({
|
|
1110
|
+
path: getConfigLayerSourceLabel(candidate),
|
|
1111
|
+
key: "$file",
|
|
1112
|
+
message: "both quota-toast.jsonc and quota-toast.json exist; using quota-toast.jsonc",
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
const extractedQuotaToast = candidate.kind === "plugin" || candidate.kind === "canonical"
|
|
1117
|
+
? parsed
|
|
1118
|
+
: isPlainObject(parsed.experimental)
|
|
1119
|
+
? parsed.experimental.quotaToast
|
|
1120
|
+
: undefined;
|
|
1121
|
+
if (!isPlainObject(extractedQuotaToast)) {
|
|
1122
|
+
continue;
|
|
1123
|
+
}
|
|
1124
|
+
const sourcePath = getConfigLayerSourceLabel(candidate);
|
|
1125
|
+
usedPaths.push(sourcePath);
|
|
1126
|
+
if (candidate.scope === "global") {
|
|
1127
|
+
globalConfigPaths.push(sourcePath);
|
|
1128
|
+
}
|
|
1129
|
+
else {
|
|
1130
|
+
workspaceConfigPaths.push(sourcePath);
|
|
1131
|
+
}
|
|
1132
|
+
applyValidatedQuotaToastPatch(config, extractValidatedQuotaToastPatch(extractedQuotaToast, (key, message) => {
|
|
1133
|
+
configIssues.push({ path: sourcePath, key, message });
|
|
1134
|
+
}, { allowZeroMonthlyLimit: candidate.kind === "canonical" }), sourcePath, settingSources);
|
|
1135
|
+
if (hasOwnKey(extractedQuotaToast, "alibabaCodingPlanTier")) {
|
|
1136
|
+
configIssues.push({
|
|
1137
|
+
path: sourcePath,
|
|
1138
|
+
key: "alibabaCodingPlanTier",
|
|
1139
|
+
message: 'removed in v4; tune Alibaba through "quotaProviders"',
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
if (hasOwnKey(extractedQuotaToast, "customSources")) {
|
|
1143
|
+
configIssues.push({
|
|
1144
|
+
path: sourcePath,
|
|
1145
|
+
key: "customSources",
|
|
1146
|
+
message: 'removed in v4; use the global-only "quotaProviders" property',
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
if (hasOwnKey(extractedQuotaToast, "quotaProviders")) {
|
|
1150
|
+
if (candidate.scope === "global") {
|
|
1151
|
+
const validation = validateQuotaProviders(extractedQuotaToast.quotaProviders);
|
|
1152
|
+
for (const issue of validation.issues) {
|
|
1153
|
+
configIssues.push({ path: sourcePath, key: issue.key, message: issue.message });
|
|
1154
|
+
}
|
|
1155
|
+
if (validation.value) {
|
|
1156
|
+
config.quotaProviders = cloneQuotaProviders(validation.value);
|
|
1157
|
+
applySettingSource(settingSources, "quotaProviders", sourcePath);
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
configIssues.push({
|
|
1162
|
+
path: sourcePath,
|
|
1163
|
+
key: "quotaProviders",
|
|
1164
|
+
message: "allowed only in global OpenCode or global opencode-quota config",
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
// Only keys actually applied from this layer acquire its structured scope.
|
|
1169
|
+
for (const key of QUOTA_TOAST_SETTING_SOURCE_KEYS) {
|
|
1170
|
+
if (settingSources[key] === sourcePath) {
|
|
1171
|
+
settingSourceLayers[key] = { scope: candidate.scope, kind: candidate.kind };
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
if (usedPaths.length === 0) {
|
|
1176
|
+
return {
|
|
1177
|
+
config: null,
|
|
1178
|
+
usedPaths: [],
|
|
1179
|
+
globalConfigPaths: [],
|
|
1180
|
+
workspaceConfigPaths: [],
|
|
1181
|
+
settingSources: {},
|
|
1182
|
+
settingSourceLayers: {},
|
|
1183
|
+
networkSettingSources: {},
|
|
1184
|
+
configIssues: [],
|
|
1185
|
+
};
|
|
1186
|
+
}
|
|
1187
|
+
return {
|
|
1188
|
+
config,
|
|
1189
|
+
usedPaths,
|
|
1190
|
+
globalConfigPaths,
|
|
1191
|
+
workspaceConfigPaths,
|
|
1192
|
+
settingSources,
|
|
1193
|
+
settingSourceLayers,
|
|
1194
|
+
networkSettingSources: projectNetworkSettingSources(settingSources),
|
|
1195
|
+
configIssues,
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
const fileConfig = await loadFromFiles();
|
|
1199
|
+
if (fileConfig.config) {
|
|
1200
|
+
if (meta) {
|
|
1201
|
+
meta.source = "files";
|
|
1202
|
+
meta.paths = fileConfig.usedPaths;
|
|
1203
|
+
meta.globalConfigPaths = fileConfig.globalConfigPaths;
|
|
1204
|
+
meta.workspaceConfigPaths = fileConfig.workspaceConfigPaths;
|
|
1205
|
+
meta.settingSources = fileConfig.settingSources;
|
|
1206
|
+
meta.settingSourceLayers = fileConfig.settingSourceLayers;
|
|
1207
|
+
meta.networkSettingSources = fileConfig.networkSettingSources;
|
|
1208
|
+
meta.configIssues = fileConfig.configIssues;
|
|
1209
|
+
}
|
|
1210
|
+
return fileConfig.config;
|
|
1211
|
+
}
|
|
1212
|
+
if (client) {
|
|
1213
|
+
try {
|
|
1214
|
+
const response = await client.config.get();
|
|
1215
|
+
// OpenCode config schema is strict; plugin-specific config must live under
|
|
1216
|
+
// experimental.* to avoid "unrecognized key" validation errors.
|
|
1217
|
+
const quotaToastConfig = response.data?.experimental?.quotaToast;
|
|
1218
|
+
if (isPlainObject(quotaToastConfig)) {
|
|
1219
|
+
const config = cloneDefaultConfig();
|
|
1220
|
+
const settingSources = {};
|
|
1221
|
+
const configIssues = [];
|
|
1222
|
+
applyValidatedQuotaToastPatch(config, extractValidatedQuotaToastPatch(quotaToastConfig, (key, message) => {
|
|
1223
|
+
configIssues.push({ path: "client.config.get", key, message });
|
|
1224
|
+
}), "client.config.get", settingSources);
|
|
1225
|
+
if (hasOwnKey(quotaToastConfig, "alibabaCodingPlanTier")) {
|
|
1226
|
+
configIssues.push({
|
|
1227
|
+
path: "client.config.get",
|
|
1228
|
+
key: "alibabaCodingPlanTier",
|
|
1229
|
+
message: 'removed in v4; tune Alibaba through "quotaProviders"',
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
if (hasOwnKey(quotaToastConfig, "customSources")) {
|
|
1233
|
+
configIssues.push({
|
|
1234
|
+
path: "client.config.get",
|
|
1235
|
+
key: "customSources",
|
|
1236
|
+
message: 'removed in v4; use the global-only "quotaProviders" property',
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
if (hasOwnKey(quotaToastConfig, "quotaProviders")) {
|
|
1240
|
+
configIssues.push({
|
|
1241
|
+
path: "client.config.get",
|
|
1242
|
+
key: "quotaProviders",
|
|
1243
|
+
message: "file provenance is required; define quotaProviders in global config",
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
if (meta) {
|
|
1247
|
+
meta.source = "sdk";
|
|
1248
|
+
meta.paths = ["client.config.get"];
|
|
1249
|
+
meta.globalConfigPaths = [];
|
|
1250
|
+
meta.workspaceConfigPaths = [];
|
|
1251
|
+
meta.settingSources = settingSources;
|
|
1252
|
+
meta.settingSourceLayers = {};
|
|
1253
|
+
meta.networkSettingSources = projectNetworkSettingSources(settingSources);
|
|
1254
|
+
meta.configIssues = configIssues;
|
|
1255
|
+
}
|
|
1256
|
+
return config;
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
catch {
|
|
1260
|
+
// ignore; fall back to defaults below
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
if (meta) {
|
|
1264
|
+
meta.source = "defaults";
|
|
1265
|
+
meta.paths = [];
|
|
1266
|
+
meta.globalConfigPaths = [];
|
|
1267
|
+
meta.workspaceConfigPaths = [];
|
|
1268
|
+
meta.settingSources = {};
|
|
1269
|
+
meta.settingSourceLayers = {};
|
|
1270
|
+
meta.networkSettingSources = {};
|
|
1271
|
+
meta.configIssues = [];
|
|
1272
|
+
}
|
|
1273
|
+
return cloneDefaultConfig();
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Effective runtime configuration: canonical GUI config plus defaults only.
|
|
1277
|
+
*
|
|
1278
|
+
* OpenCode SDK settings, workspace layers and legacy `experimental.quotaToast` /
|
|
1279
|
+
* `opencode-quota` sidecars are deliberately not read here. They remain available
|
|
1280
|
+
* through `loadConfigLayered` for the explicit settings import, and only become
|
|
1281
|
+
* effective once the user applies that import to the canonical file. The client
|
|
1282
|
+
* parameter stays in the signature for runtime callers that share one contract.
|
|
1283
|
+
*/
|
|
1284
|
+
export async function loadConfig(_client, meta, options) {
|
|
1285
|
+
const configDir = options?.globalConfigDir ?? getOpencodeRuntimeDirs().configDir;
|
|
1286
|
+
const canonicalPath = getGuiConfigPath(configDir);
|
|
1287
|
+
const config = cloneDefaultConfig();
|
|
1288
|
+
const settingSources = {};
|
|
1289
|
+
const settingSourceLayers = {};
|
|
1290
|
+
const configIssues = [];
|
|
1291
|
+
let usedPaths = [];
|
|
1292
|
+
let source = "defaults";
|
|
1293
|
+
if (existsSync(canonicalPath)) {
|
|
1294
|
+
const parsed = await readConfigJsonFile(canonicalPath);
|
|
1295
|
+
if (!isPlainObject(parsed)) {
|
|
1296
|
+
configIssues.push({
|
|
1297
|
+
path: canonicalPath,
|
|
1298
|
+
key: "$root",
|
|
1299
|
+
message: "malformed JSONC; defaults apply",
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
else {
|
|
1303
|
+
source = "files";
|
|
1304
|
+
usedPaths = [canonicalPath];
|
|
1305
|
+
applyValidatedQuotaToastPatch(config, extractValidatedQuotaToastPatch(parsed, (key, message) => {
|
|
1306
|
+
configIssues.push({ path: canonicalPath, key, message });
|
|
1307
|
+
}, { allowZeroMonthlyLimit: true }), canonicalPath, settingSources);
|
|
1308
|
+
if (hasOwnKey(parsed, "alibabaCodingPlanTier")) {
|
|
1309
|
+
configIssues.push({
|
|
1310
|
+
path: canonicalPath,
|
|
1311
|
+
key: "alibabaCodingPlanTier",
|
|
1312
|
+
message: 'removed in v4; tune Alibaba through "quotaProviders"',
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
if (hasOwnKey(parsed, "customSources")) {
|
|
1316
|
+
configIssues.push({
|
|
1317
|
+
path: canonicalPath,
|
|
1318
|
+
key: "customSources",
|
|
1319
|
+
message: 'removed in v4; use the global-only "quotaProviders" property',
|
|
1320
|
+
});
|
|
1321
|
+
}
|
|
1322
|
+
if (hasOwnKey(parsed, "quotaProviders")) {
|
|
1323
|
+
const validation = validateQuotaProviders(parsed.quotaProviders);
|
|
1324
|
+
for (const issue of validation.issues) {
|
|
1325
|
+
configIssues.push({ path: canonicalPath, key: issue.key, message: issue.message });
|
|
1326
|
+
}
|
|
1327
|
+
if (validation.value) {
|
|
1328
|
+
config.quotaProviders = cloneQuotaProviders(validation.value);
|
|
1329
|
+
applySettingSource(settingSources, "quotaProviders", canonicalPath);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
// Only keys actually applied from the canonical layer acquire its structured scope.
|
|
1333
|
+
for (const key of QUOTA_TOAST_SETTING_SOURCE_KEYS) {
|
|
1334
|
+
if (settingSources[key] === canonicalPath) {
|
|
1335
|
+
settingSourceLayers[key] = { scope: "global", kind: "canonical" };
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
if (meta) {
|
|
1341
|
+
meta.source = source;
|
|
1342
|
+
meta.paths = usedPaths;
|
|
1343
|
+
meta.globalConfigPaths = usedPaths;
|
|
1344
|
+
meta.workspaceConfigPaths = [];
|
|
1345
|
+
meta.settingSources = settingSources;
|
|
1346
|
+
meta.settingSourceLayers = settingSourceLayers;
|
|
1347
|
+
meta.networkSettingSources = projectNetworkSettingSources(settingSources);
|
|
1348
|
+
meta.configIssues = configIssues;
|
|
1349
|
+
}
|
|
1350
|
+
return config;
|
|
1351
|
+
}
|
|
1352
|
+
//# sourceMappingURL=config.js.map
|