opencode-quota-gui 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -34
- package/dist/contracts/analytics-entity.d.ts +6 -1
- package/dist/contracts/analytics-entity.js +27 -10
- package/dist/contracts/build-identity.js +1 -1
- package/dist/contracts/card-visibility.d.ts +21 -0
- package/dist/contracts/card-visibility.js +19 -0
- package/dist/contracts/dashboard.d.ts +35 -1
- package/dist/contracts/dashboard.js +2 -0
- package/dist/contracts/dto-guards.d.ts +24 -0
- package/dist/contracts/dto-guards.js +594 -0
- package/dist/contracts/openai-quota.d.ts +3 -0
- package/dist/contracts/openai-quota.js +3 -0
- package/dist/contracts/provider-failure.d.ts +18 -0
- package/dist/contracts/provider-failure.js +25 -0
- package/dist/data/modelsdev-temporal.min.json +57 -0
- package/dist/gui/config.d.ts +20 -3
- package/dist/gui/config.js +72 -4
- package/dist/gui/dashboard-errors.d.ts +32 -0
- package/dist/gui/dashboard-errors.js +97 -0
- package/dist/gui/lifecycle.d.ts +47 -12
- package/dist/gui/lifecycle.js +215 -37
- package/dist/gui/primary-quota-windows.d.ts +28 -0
- package/dist/gui/primary-quota-windows.js +149 -0
- package/dist/gui/provider-cards.d.ts +11 -3
- package/dist/gui/provider-cards.js +85 -33
- package/dist/gui/quota-notification-detector.d.ts +151 -0
- package/dist/gui/quota-notification-detector.js +318 -0
- package/dist/gui/quota-notification-observer.d.ts +54 -0
- package/dist/gui/quota-notification-observer.js +412 -0
- package/dist/gui/rpc.d.ts +61 -0
- package/dist/gui/rpc.js +310 -0
- package/dist/gui/server.d.ts +15 -27
- package/dist/gui/server.js +34 -123
- package/dist/gui/snapshot-service.d.ts +34 -5
- package/dist/gui/snapshot-service.js +301 -70
- package/dist/gui/sources.d.ts +1 -1
- package/dist/gui/sources.js +98 -56
- package/dist/gui-experimental.cjs +1761 -0
- package/dist/lib/accounting-format.js +8 -0
- package/dist/lib/alibaba-coding-plan-cli.d.ts +79 -0
- package/dist/lib/alibaba-coding-plan-cli.js +539 -0
- package/dist/lib/anthropic-auth.d.ts +2 -3
- package/dist/lib/anthropic-auth.js +2 -3
- package/dist/lib/anthropic.d.ts +53 -12
- package/dist/lib/anthropic.js +622 -270
- package/dist/lib/api-key-retry-after.d.ts +7 -0
- package/dist/lib/api-key-retry-after.js +62 -0
- package/dist/lib/atomic-json.d.ts +2 -0
- package/dist/lib/atomic-json.js +1 -0
- package/dist/lib/cache-observer-ingestion.d.ts +90 -0
- package/dist/lib/cache-observer-ingestion.js +981 -0
- package/dist/lib/cache-observer.d.ts +138 -0
- package/dist/lib/cache-observer.js +317 -0
- package/dist/lib/canonical-config-lock.d.ts +9 -0
- package/dist/lib/canonical-config-lock.js +36 -0
- package/dist/lib/chutes.js +63 -35
- package/dist/lib/claude-agent-transcript-ttl.d.ts +48 -0
- package/dist/lib/claude-agent-transcript-ttl.js +154 -0
- package/dist/lib/claude-agent-ttl-tracker.d.ts +21 -0
- package/dist/lib/claude-agent-ttl-tracker.js +152 -0
- package/dist/lib/cli-show.js +5 -3
- package/dist/lib/config-write-target.d.ts +1 -1
- package/dist/lib/config-write-target.js +5 -2
- package/dist/lib/config.d.ts +6 -1
- package/dist/lib/config.js +241 -2
- package/dist/lib/copilot.js +198 -85
- package/dist/lib/dashboard-web-policy.d.ts +35 -0
- package/dist/lib/dashboard-web-policy.js +24 -0
- package/dist/lib/deepseek.js +34 -11
- package/dist/lib/display-sanitize.js +3 -0
- package/dist/lib/entries.d.ts +26 -0
- package/dist/lib/entries.js +2 -0
- package/dist/lib/format-utils.d.ts +1 -1
- package/dist/lib/format-utils.js +2 -2
- package/dist/lib/glm-coding-plan.js +102 -68
- package/dist/lib/google-agy.js +147 -24
- package/dist/lib/google-gemini-cli.js +140 -23
- package/dist/lib/http.d.ts +4 -0
- package/dist/lib/http.js +16 -2
- package/dist/lib/init-installer.js +30 -7
- package/dist/lib/kilo.js +63 -55
- package/dist/lib/kimi.js +43 -14
- package/dist/lib/mimo.d.ts +4 -0
- package/dist/lib/mimo.js +45 -1
- package/dist/lib/nanogpt.d.ts +3 -0
- package/dist/lib/nanogpt.js +50 -6
- package/dist/lib/ollama-cloud.d.ts +1 -1
- package/dist/lib/ollama-cloud.js +51 -29
- package/dist/lib/openai.js +90 -40
- package/dist/lib/opencode-auth-sqlite.d.ts +2 -2
- package/dist/lib/opencode-auth-sqlite.js +2 -2
- package/dist/lib/opencode-auth.d.ts +3 -2
- package/dist/lib/opencode-auth.js +8 -1
- package/dist/lib/opencode-config-editor.d.ts +1 -0
- package/dist/lib/opencode-config-editor.js +6 -1
- package/dist/lib/opencode-go.js +53 -5
- package/dist/lib/opencode-version-core.d.ts +23 -0
- package/dist/lib/opencode-version-core.js +49 -0
- package/dist/lib/opencode-version.d.ts +4 -3
- package/dist/lib/opencode-version.js +15 -11
- package/dist/lib/opencode-zen.d.ts +12 -1
- package/dist/lib/opencode-zen.js +98 -12
- package/dist/lib/provider-add.js +5 -2
- package/dist/lib/provider-registration.d.ts +19 -9
- package/dist/lib/provider-registration.js +17 -6
- package/dist/lib/quota-command-format.js +1 -1
- package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
- package/dist/lib/quota-exhaustion-projection.js +25 -0
- package/dist/lib/quota-providers-remote.d.ts +4 -1
- package/dist/lib/quota-providers-remote.js +137 -22
- package/dist/lib/quota-providers.d.ts +1 -1
- package/dist/lib/quota-providers.js +12 -35
- package/dist/lib/quota-render-data.d.ts +6 -0
- package/dist/lib/quota-render-data.js +43 -17
- package/dist/lib/quota-reset-notifications.d.ts +17 -0
- package/dist/lib/quota-reset-notifications.js +11 -2
- package/dist/lib/quota-state-codec.js +19 -1
- package/dist/lib/quota-state.d.ts +7 -1
- package/dist/lib/quota-state.js +208 -34
- package/dist/lib/quota-stats.js +21 -0
- package/dist/lib/quota-status.js +3 -51
- package/dist/lib/scoped-update.d.ts +1 -1
- package/dist/lib/synthetic.js +67 -48
- package/dist/lib/types.d.ts +49 -1
- package/dist/lib/types.js +16 -0
- package/dist/lib/xai.js +64 -24
- package/dist/plugin.d.ts +4 -3
- package/dist/plugin.js +293 -16
- package/dist/provider-logos/NOTICE.md +1 -1
- package/dist/provider-logos/OPENCODE-NOTICE.md +4 -3
- package/dist/providers/alibaba-coding-plan.js +107 -102
- package/dist/providers/alibaba-token-plan.js +17 -0
- package/dist/providers/anthropic.d.ts +12 -3
- package/dist/providers/anthropic.js +71 -219
- package/dist/providers/cache-policies.d.ts +11 -4
- package/dist/providers/cache-policies.js +19 -13
- package/dist/providers/claude-agent.d.ts +19 -0
- package/dist/providers/claude-agent.js +196 -0
- package/dist/providers/copilot.js +12 -2
- package/dist/providers/glm-coding-plan-provider.d.ts +3 -0
- package/dist/providers/glm-coding-plan-provider.js +5 -1
- package/dist/providers/google-account-format.js +2 -0
- package/dist/providers/google-agy.d.ts +6 -5
- package/dist/providers/google-agy.js +55 -17
- package/dist/providers/google-gemini-cli.js +13 -2
- package/dist/providers/kilo.js +10 -1
- package/dist/providers/kimi-code.js +13 -6
- package/dist/providers/mimo.js +9 -2
- package/dist/providers/minimax-coding-plan.js +28 -5
- package/dist/providers/nanogpt.js +4 -0
- package/dist/providers/ollama-cloud.js +3 -0
- package/dist/providers/openai.js +1 -0
- package/dist/providers/opencode-go.js +11 -1
- package/dist/providers/opencode-zen.js +32 -3
- package/dist/providers/openrouter.js +4 -0
- package/dist/providers/quota-providers.js +46 -9
- package/dist/providers/registry.js +2 -0
- package/dist/providers/result-helpers.d.ts +6 -0
- package/dist/providers/result-helpers.js +18 -2
- package/dist/rpc.d.ts +440 -4
- package/dist/rpc.js +507 -2
- package/dist/ui/assets/{index-Cs-nrywz.css → index-BcueIm3Z.css} +1 -1
- package/dist/ui/assets/index-C6qRSoh8.js +10 -0
- package/dist/ui/assets/{popover-DKRrwr_K.js → popover-4bFSvRZ7.js} +1 -1
- package/dist/ui/assets/providers/claude-agent.svg +3 -0
- package/dist/ui/index.html +2 -2
- package/package.json +15 -7
- package/dist/bin/opencode-quota-gui.d.ts.map +0 -1
- package/dist/bin/opencode-quota-gui.js.map +0 -1
- package/dist/contracts/analytics-entity.d.ts.map +0 -1
- package/dist/contracts/analytics-entity.js.map +0 -1
- package/dist/contracts/analytics-temporal.d.ts.map +0 -1
- package/dist/contracts/analytics-temporal.js.map +0 -1
- package/dist/contracts/build-identity.d.ts.map +0 -1
- package/dist/contracts/card-order.d.ts.map +0 -1
- package/dist/contracts/card-order.js.map +0 -1
- package/dist/contracts/collision-safe-key.d.ts.map +0 -1
- package/dist/contracts/collision-safe-key.js.map +0 -1
- package/dist/contracts/dashboard.d.ts.map +0 -1
- package/dist/contracts/dashboard.js.map +0 -1
- package/dist/contracts/guards.d.ts.map +0 -1
- package/dist/contracts/guards.js.map +0 -1
- package/dist/contracts/identity.d.ts.map +0 -1
- package/dist/contracts/identity.js.map +0 -1
- package/dist/contracts/openai-quota.d.ts.map +0 -1
- package/dist/contracts/openai-quota.js.map +0 -1
- package/dist/contracts/ranges.d.ts.map +0 -1
- package/dist/contracts/ranges.js.map +0 -1
- package/dist/contracts/settings.d.ts.map +0 -1
- package/dist/contracts/settings.js.map +0 -1
- package/dist/contracts/temporal.d.ts.map +0 -1
- package/dist/contracts/temporal.js.map +0 -1
- package/dist/contracts/time-zone.d.ts.map +0 -1
- package/dist/contracts/time-zone.js.map +0 -1
- package/dist/gui/aggregation.d.ts.map +0 -1
- package/dist/gui/aggregation.js.map +0 -1
- package/dist/gui/analytics-bridge.d.ts.map +0 -1
- package/dist/gui/analytics-bridge.js.map +0 -1
- package/dist/gui/analytics-engine.d.ts.map +0 -1
- package/dist/gui/analytics-engine.js.map +0 -1
- package/dist/gui/analytics-indexes.d.ts.map +0 -1
- package/dist/gui/analytics-indexes.js.map +0 -1
- package/dist/gui/analytics-model.d.ts.map +0 -1
- package/dist/gui/analytics-model.js.map +0 -1
- package/dist/gui/analytics-pricing-revision.d.ts.map +0 -1
- package/dist/gui/analytics-pricing-revision.js.map +0 -1
- package/dist/gui/analytics-protocol.d.ts.map +0 -1
- package/dist/gui/analytics-protocol.js.map +0 -1
- package/dist/gui/analytics-reader.d.ts.map +0 -1
- package/dist/gui/analytics-reader.js.map +0 -1
- package/dist/gui/analytics-service.d.ts.map +0 -1
- package/dist/gui/analytics-service.js.map +0 -1
- package/dist/gui/analytics-state.d.ts.map +0 -1
- package/dist/gui/analytics-state.js.map +0 -1
- package/dist/gui/analytics-worker-runtime.d.ts.map +0 -1
- package/dist/gui/analytics-worker-runtime.js.map +0 -1
- package/dist/gui/analytics-worker.d.ts.map +0 -1
- package/dist/gui/analytics-worker.js.map +0 -1
- package/dist/gui/config.d.ts.map +0 -1
- package/dist/gui/config.js.map +0 -1
- package/dist/gui/identity.d.ts.map +0 -1
- package/dist/gui/identity.js.map +0 -1
- package/dist/gui/lifecycle.d.ts.map +0 -1
- package/dist/gui/lifecycle.js.map +0 -1
- package/dist/gui/log.d.ts.map +0 -1
- package/dist/gui/log.js.map +0 -1
- package/dist/gui/provider-cards.d.ts.map +0 -1
- package/dist/gui/provider-cards.js.map +0 -1
- package/dist/gui/server.d.ts.map +0 -1
- package/dist/gui/server.js.map +0 -1
- package/dist/gui/settings-file-opener.d.ts.map +0 -1
- package/dist/gui/settings-file-opener.js.map +0 -1
- package/dist/gui/snapshot-service.d.ts.map +0 -1
- package/dist/gui/snapshot-service.js.map +0 -1
- package/dist/gui/sources.d.ts.map +0 -1
- package/dist/gui/sources.js.map +0 -1
- package/dist/gui/sse.d.ts.map +0 -1
- package/dist/gui/sse.js.map +0 -1
- package/dist/gui/temporal-quota-policy-data.d.ts.map +0 -1
- package/dist/gui/temporal-quota-policy-data.js.map +0 -1
- package/dist/gui/temporal-quota-policy.d.ts.map +0 -1
- package/dist/gui/temporal-quota-policy.js.map +0 -1
- package/dist/gui/temporal-status.d.ts.map +0 -1
- package/dist/gui/temporal-status.js.map +0 -1
- package/dist/gui/time-zone.d.ts.map +0 -1
- package/dist/gui/time-zone.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/accounting-format.d.ts.map +0 -1
- package/dist/lib/accounting-format.js.map +0 -1
- package/dist/lib/alibaba-auth.d.ts.map +0 -1
- package/dist/lib/alibaba-auth.js.map +0 -1
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts +0 -47
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts.map +0 -1
- package/dist/lib/alibaba-coding-plan-local-quota.js +0 -146
- package/dist/lib/alibaba-coding-plan-local-quota.js.map +0 -1
- package/dist/lib/alibaba-token-plan.d.ts.map +0 -1
- package/dist/lib/alibaba-token-plan.js.map +0 -1
- package/dist/lib/anthropic-auth.d.ts.map +0 -1
- package/dist/lib/anthropic-auth.js.map +0 -1
- package/dist/lib/anthropic.d.ts.map +0 -1
- package/dist/lib/anthropic.js.map +0 -1
- package/dist/lib/api-key-resolver.d.ts.map +0 -1
- package/dist/lib/api-key-resolver.js.map +0 -1
- package/dist/lib/atomic-json.d.ts.map +0 -1
- package/dist/lib/atomic-json.js.map +0 -1
- package/dist/lib/chutes-config.d.ts.map +0 -1
- package/dist/lib/chutes-config.js.map +0 -1
- package/dist/lib/chutes.d.ts.map +0 -1
- package/dist/lib/chutes.js.map +0 -1
- package/dist/lib/cli-reports.d.ts.map +0 -1
- package/dist/lib/cli-reports.js.map +0 -1
- package/dist/lib/cli-show.d.ts.map +0 -1
- package/dist/lib/cli-show.js.map +0 -1
- package/dist/lib/cli-status.d.ts.map +0 -1
- package/dist/lib/cli-status.js.map +0 -1
- package/dist/lib/command-parsing.d.ts.map +0 -1
- package/dist/lib/command-parsing.js.map +0 -1
- package/dist/lib/config-file-utils.d.ts.map +0 -1
- package/dist/lib/config-file-utils.js.map +0 -1
- package/dist/lib/config-write-target.d.ts.map +0 -1
- package/dist/lib/config-write-target.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/copilot.d.ts.map +0 -1
- package/dist/lib/copilot.js.map +0 -1
- package/dist/lib/cursor-detection.d.ts.map +0 -1
- package/dist/lib/cursor-detection.js.map +0 -1
- package/dist/lib/cursor-pricing.d.ts.map +0 -1
- package/dist/lib/cursor-pricing.js.map +0 -1
- package/dist/lib/cursor-usage.d.ts.map +0 -1
- package/dist/lib/cursor-usage.js.map +0 -1
- package/dist/lib/dashboard-visibility.d.ts.map +0 -1
- package/dist/lib/dashboard-visibility.js.map +0 -1
- package/dist/lib/deepseek-auth.d.ts.map +0 -1
- package/dist/lib/deepseek-auth.js.map +0 -1
- package/dist/lib/deepseek.d.ts.map +0 -1
- package/dist/lib/deepseek.js.map +0 -1
- package/dist/lib/display-sanitize.d.ts.map +0 -1
- package/dist/lib/display-sanitize.js.map +0 -1
- package/dist/lib/entries.d.ts.map +0 -1
- package/dist/lib/entries.js.map +0 -1
- package/dist/lib/env-template.d.ts.map +0 -1
- package/dist/lib/env-template.js.map +0 -1
- package/dist/lib/format-utils.d.ts.map +0 -1
- package/dist/lib/format-utils.js.map +0 -1
- package/dist/lib/format.d.ts.map +0 -1
- package/dist/lib/format.js.map +0 -1
- package/dist/lib/glm-coding-plan.d.ts.map +0 -1
- package/dist/lib/glm-coding-plan.js.map +0 -1
- package/dist/lib/google-agy-companion.d.ts.map +0 -1
- package/dist/lib/google-agy-companion.js.map +0 -1
- package/dist/lib/google-agy.d.ts.map +0 -1
- package/dist/lib/google-agy.js.map +0 -1
- package/dist/lib/google-companion-credentials.d.ts.map +0 -1
- package/dist/lib/google-companion-credentials.js.map +0 -1
- package/dist/lib/google-gemini-cli-companion.d.ts.map +0 -1
- package/dist/lib/google-gemini-cli-companion.js.map +0 -1
- package/dist/lib/google-gemini-cli.d.ts.map +0 -1
- package/dist/lib/google-gemini-cli.js.map +0 -1
- package/dist/lib/google-token-cache.d.ts.map +0 -1
- package/dist/lib/google-token-cache.js.map +0 -1
- package/dist/lib/grouped-entry-normalization.d.ts.map +0 -1
- package/dist/lib/grouped-entry-normalization.js.map +0 -1
- package/dist/lib/grouped-header-format.d.ts.map +0 -1
- package/dist/lib/grouped-header-format.js.map +0 -1
- package/dist/lib/gui-config-target.d.ts.map +0 -1
- package/dist/lib/gui-config-target.js.map +0 -1
- package/dist/lib/home-dir-display.d.ts.map +0 -1
- package/dist/lib/home-dir-display.js.map +0 -1
- package/dist/lib/http.d.ts.map +0 -1
- package/dist/lib/http.js.map +0 -1
- package/dist/lib/init-installer.d.ts.map +0 -1
- package/dist/lib/init-installer.js.map +0 -1
- package/dist/lib/jsonc.d.ts.map +0 -1
- package/dist/lib/jsonc.js.map +0 -1
- package/dist/lib/kilo-config.d.ts.map +0 -1
- package/dist/lib/kilo-config.js.map +0 -1
- package/dist/lib/kilo.d.ts.map +0 -1
- package/dist/lib/kilo.js.map +0 -1
- package/dist/lib/kimi-auth.d.ts.map +0 -1
- package/dist/lib/kimi-auth.js.map +0 -1
- package/dist/lib/kimi-endpoints.d.ts.map +0 -1
- package/dist/lib/kimi-endpoints.js.map +0 -1
- package/dist/lib/kimi.d.ts.map +0 -1
- package/dist/lib/kimi.js.map +0 -1
- package/dist/lib/maintainer-announcements.d.ts.map +0 -1
- package/dist/lib/maintainer-announcements.js.map +0 -1
- package/dist/lib/map-with-concurrency.d.ts.map +0 -1
- package/dist/lib/map-with-concurrency.js.map +0 -1
- package/dist/lib/markdown-table.d.ts.map +0 -1
- package/dist/lib/markdown-table.js.map +0 -1
- package/dist/lib/mimo-config.d.ts.map +0 -1
- package/dist/lib/mimo-config.js.map +0 -1
- package/dist/lib/mimo.d.ts.map +0 -1
- package/dist/lib/mimo.js.map +0 -1
- package/dist/lib/minimax-auth.d.ts.map +0 -1
- package/dist/lib/minimax-auth.js.map +0 -1
- package/dist/lib/minimax-endpoints.d.ts.map +0 -1
- package/dist/lib/minimax-endpoints.js.map +0 -1
- package/dist/lib/modelsdev-pricing.d.ts.map +0 -1
- package/dist/lib/modelsdev-pricing.js.map +0 -1
- package/dist/lib/modelsdev-temporal.d.ts.map +0 -1
- package/dist/lib/modelsdev-temporal.js.map +0 -1
- package/dist/lib/nanogpt-config.d.ts.map +0 -1
- package/dist/lib/nanogpt-config.js.map +0 -1
- package/dist/lib/nanogpt.d.ts.map +0 -1
- package/dist/lib/nanogpt.js.map +0 -1
- package/dist/lib/ollama-cloud-config.d.ts.map +0 -1
- package/dist/lib/ollama-cloud-config.js.map +0 -1
- package/dist/lib/ollama-cloud.d.ts.map +0 -1
- package/dist/lib/ollama-cloud.js.map +0 -1
- package/dist/lib/openai.d.ts.map +0 -1
- package/dist/lib/openai.js.map +0 -1
- package/dist/lib/opencode-auth-sqlite.d.ts.map +0 -1
- package/dist/lib/opencode-auth-sqlite.js.map +0 -1
- package/dist/lib/opencode-auth.d.ts.map +0 -1
- package/dist/lib/opencode-auth.js.map +0 -1
- package/dist/lib/opencode-config-editor.d.ts.map +0 -1
- package/dist/lib/opencode-config-editor.js.map +0 -1
- package/dist/lib/opencode-config-providers.d.ts.map +0 -1
- package/dist/lib/opencode-config-providers.js.map +0 -1
- package/dist/lib/opencode-config-read.d.ts.map +0 -1
- package/dist/lib/opencode-config-read.js.map +0 -1
- package/dist/lib/opencode-console-auth.d.ts.map +0 -1
- package/dist/lib/opencode-console-auth.js.map +0 -1
- package/dist/lib/opencode-db-path.d.ts.map +0 -1
- package/dist/lib/opencode-db-path.js.map +0 -1
- package/dist/lib/opencode-go-auth.d.ts.map +0 -1
- package/dist/lib/opencode-go-auth.js.map +0 -1
- package/dist/lib/opencode-go.d.ts.map +0 -1
- package/dist/lib/opencode-go.js.map +0 -1
- package/dist/lib/opencode-runtime-paths.d.ts.map +0 -1
- package/dist/lib/opencode-runtime-paths.js.map +0 -1
- package/dist/lib/opencode-sqlite.d.ts.map +0 -1
- package/dist/lib/opencode-sqlite.js.map +0 -1
- package/dist/lib/opencode-storage.d.ts.map +0 -1
- package/dist/lib/opencode-storage.js.map +0 -1
- package/dist/lib/opencode-version.d.ts.map +0 -1
- package/dist/lib/opencode-version.js.map +0 -1
- package/dist/lib/opencode-zen.d.ts.map +0 -1
- package/dist/lib/opencode-zen.js.map +0 -1
- package/dist/lib/openrouter.d.ts.map +0 -1
- package/dist/lib/openrouter.js.map +0 -1
- package/dist/lib/private-state-paths.d.ts.map +0 -1
- package/dist/lib/private-state-paths.js.map +0 -1
- package/dist/lib/provider-add-command.d.ts.map +0 -1
- package/dist/lib/provider-add-command.js.map +0 -1
- package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +0 -1
- package/dist/lib/provider-add-json-v1-questionnaire.js.map +0 -1
- package/dist/lib/provider-add.d.ts.map +0 -1
- package/dist/lib/provider-add.js.map +0 -1
- package/dist/lib/provider-availability.d.ts.map +0 -1
- package/dist/lib/provider-availability.js.map +0 -1
- package/dist/lib/provider-metadata.d.ts.map +0 -1
- package/dist/lib/provider-metadata.js.map +0 -1
- package/dist/lib/provider-model-matching.d.ts.map +0 -1
- package/dist/lib/provider-model-matching.js.map +0 -1
- package/dist/lib/provider-registration.d.ts.map +0 -1
- package/dist/lib/provider-registration.js.map +0 -1
- package/dist/lib/quota-accounting-projection.d.ts.map +0 -1
- package/dist/lib/quota-accounting-projection.js.map +0 -1
- package/dist/lib/quota-columns.d.ts.map +0 -1
- package/dist/lib/quota-columns.js.map +0 -1
- package/dist/lib/quota-command-format.d.ts.map +0 -1
- package/dist/lib/quota-command-format.js.map +0 -1
- package/dist/lib/quota-dialog-command-specs.d.ts.map +0 -1
- package/dist/lib/quota-dialog-command-specs.js.map +0 -1
- package/dist/lib/quota-dialog-commands.d.ts.map +0 -1
- package/dist/lib/quota-dialog-commands.js.map +0 -1
- package/dist/lib/quota-entry-display.d.ts.map +0 -1
- package/dist/lib/quota-entry-display.js.map +0 -1
- package/dist/lib/quota-exhaustion-projection.d.ts.map +0 -1
- package/dist/lib/quota-exhaustion-projection.js.map +0 -1
- package/dist/lib/quota-export-types.d.ts.map +0 -1
- package/dist/lib/quota-export-types.js.map +0 -1
- package/dist/lib/quota-export.d.ts.map +0 -1
- package/dist/lib/quota-export.js.map +0 -1
- package/dist/lib/quota-format-style.d.ts.map +0 -1
- package/dist/lib/quota-format-style.js.map +0 -1
- package/dist/lib/quota-providers-local.d.ts.map +0 -1
- package/dist/lib/quota-providers-local.js.map +0 -1
- package/dist/lib/quota-providers-remote.d.ts.map +0 -1
- package/dist/lib/quota-providers-remote.js.map +0 -1
- package/dist/lib/quota-providers.d.ts.map +0 -1
- package/dist/lib/quota-providers.js.map +0 -1
- package/dist/lib/quota-render-data.d.ts.map +0 -1
- package/dist/lib/quota-render-data.js.map +0 -1
- package/dist/lib/quota-report-message.d.ts.map +0 -1
- package/dist/lib/quota-report-message.js.map +0 -1
- package/dist/lib/quota-reset-notifications.d.ts.map +0 -1
- package/dist/lib/quota-reset-notifications.js.map +0 -1
- package/dist/lib/quota-retry-wait.d.ts.map +0 -1
- package/dist/lib/quota-retry-wait.js.map +0 -1
- package/dist/lib/quota-runtime-context.d.ts.map +0 -1
- package/dist/lib/quota-runtime-context.js.map +0 -1
- package/dist/lib/quota-state-codec.d.ts.map +0 -1
- package/dist/lib/quota-state-codec.js.map +0 -1
- package/dist/lib/quota-state.d.ts.map +0 -1
- package/dist/lib/quota-state.js.map +0 -1
- package/dist/lib/quota-stats-format.d.ts.map +0 -1
- package/dist/lib/quota-stats-format.js.map +0 -1
- package/dist/lib/quota-stats.d.ts.map +0 -1
- package/dist/lib/quota-stats.js.map +0 -1
- package/dist/lib/quota-status.d.ts.map +0 -1
- package/dist/lib/quota-status.js.map +0 -1
- package/dist/lib/quota-surface-data.d.ts.map +0 -1
- package/dist/lib/quota-surface-data.js.map +0 -1
- package/dist/lib/quota-telemetry.d.ts.map +0 -1
- package/dist/lib/quota-telemetry.js.map +0 -1
- package/dist/lib/report-document.d.ts.map +0 -1
- package/dist/lib/report-document.js.map +0 -1
- package/dist/lib/resolved-auth-identity.d.ts.map +0 -1
- package/dist/lib/resolved-auth-identity.js.map +0 -1
- package/dist/lib/runtime-provider-ids.d.ts.map +0 -1
- package/dist/lib/runtime-provider-ids.js.map +0 -1
- package/dist/lib/scoped-query-chunks.d.ts.map +0 -1
- package/dist/lib/scoped-query-chunks.js.map +0 -1
- package/dist/lib/scoped-update-migration.d.ts.map +0 -1
- package/dist/lib/scoped-update-migration.js.map +0 -1
- package/dist/lib/scoped-update.d.ts.map +0 -1
- package/dist/lib/scoped-update.js.map +0 -1
- package/dist/lib/session-tokens-format.d.ts.map +0 -1
- package/dist/lib/session-tokens-format.js.map +0 -1
- package/dist/lib/session-tokens.d.ts.map +0 -1
- package/dist/lib/session-tokens.js.map +0 -1
- package/dist/lib/synthetic-config.d.ts.map +0 -1
- package/dist/lib/synthetic-config.js.map +0 -1
- package/dist/lib/synthetic.d.ts.map +0 -1
- package/dist/lib/synthetic.js.map +0 -1
- package/dist/lib/toast-format-grouped.d.ts.map +0 -1
- package/dist/lib/toast-format-grouped.js.map +0 -1
- package/dist/lib/token-buckets.d.ts.map +0 -1
- package/dist/lib/token-buckets.js.map +0 -1
- package/dist/lib/token-cost.d.ts.map +0 -1
- package/dist/lib/token-cost.js.map +0 -1
- package/dist/lib/tui-compact-format.d.ts.map +0 -1
- package/dist/lib/tui-compact-format.js.map +0 -1
- package/dist/lib/tui-panel-state.d.ts.map +0 -1
- package/dist/lib/tui-panel-state.js.map +0 -1
- package/dist/lib/tui-prompt-bar-format.d.ts.map +0 -1
- package/dist/lib/tui-prompt-bar-format.js.map +0 -1
- package/dist/lib/tui-sidebar-format.d.ts.map +0 -1
- package/dist/lib/tui-sidebar-format.js.map +0 -1
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage-ownership.d.ts.map +0 -1
- package/dist/lib/usage-ownership.js.map +0 -1
- package/dist/lib/version.d.ts.map +0 -1
- package/dist/lib/version.js.map +0 -1
- package/dist/lib/xai.d.ts.map +0 -1
- package/dist/lib/xai.js.map +0 -1
- package/dist/lib/zai-auth.d.ts.map +0 -1
- package/dist/lib/zai-auth.js.map +0 -1
- package/dist/lib/zai.d.ts.map +0 -1
- package/dist/lib/zai.js.map +0 -1
- package/dist/lib/zhipu-auth.d.ts.map +0 -1
- package/dist/lib/zhipu-auth.js.map +0 -1
- package/dist/lib/zhipu.d.ts.map +0 -1
- package/dist/lib/zhipu.js.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js.map +0 -1
- package/dist/providers/accounting-decimal.d.ts.map +0 -1
- package/dist/providers/accounting-decimal.js.map +0 -1
- package/dist/providers/alibaba-coding-plan.d.ts.map +0 -1
- package/dist/providers/alibaba-coding-plan.js.map +0 -1
- package/dist/providers/alibaba-token-plan.d.ts.map +0 -1
- package/dist/providers/alibaba-token-plan.js.map +0 -1
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/cache-policies.d.ts.map +0 -1
- package/dist/providers/cache-policies.js.map +0 -1
- package/dist/providers/chutes.d.ts.map +0 -1
- package/dist/providers/chutes.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/cursor.d.ts.map +0 -1
- package/dist/providers/cursor.js.map +0 -1
- package/dist/providers/deepseek.d.ts.map +0 -1
- package/dist/providers/deepseek.js.map +0 -1
- package/dist/providers/glm-coding-plan-provider.d.ts.map +0 -1
- package/dist/providers/glm-coding-plan-provider.js.map +0 -1
- package/dist/providers/google-account-format.d.ts.map +0 -1
- package/dist/providers/google-account-format.js.map +0 -1
- package/dist/providers/google-agy.d.ts.map +0 -1
- package/dist/providers/google-agy.js.map +0 -1
- package/dist/providers/google-gemini-cli.d.ts.map +0 -1
- package/dist/providers/google-gemini-cli.js.map +0 -1
- package/dist/providers/kilo.d.ts.map +0 -1
- package/dist/providers/kilo.js.map +0 -1
- package/dist/providers/kimi-code.d.ts.map +0 -1
- package/dist/providers/kimi-code.js.map +0 -1
- package/dist/providers/mimo.d.ts.map +0 -1
- package/dist/providers/mimo.js.map +0 -1
- package/dist/providers/minimax-coding-plan.d.ts.map +0 -1
- package/dist/providers/minimax-coding-plan.js.map +0 -1
- package/dist/providers/nanogpt.d.ts.map +0 -1
- package/dist/providers/nanogpt.js.map +0 -1
- package/dist/providers/ollama-cloud.d.ts.map +0 -1
- package/dist/providers/ollama-cloud.js.map +0 -1
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/opencode-go.d.ts.map +0 -1
- package/dist/providers/opencode-go.js.map +0 -1
- package/dist/providers/opencode-zen.d.ts.map +0 -1
- package/dist/providers/opencode-zen.js.map +0 -1
- package/dist/providers/openrouter.d.ts.map +0 -1
- package/dist/providers/openrouter.js.map +0 -1
- package/dist/providers/quota-providers.d.ts.map +0 -1
- package/dist/providers/quota-providers.js.map +0 -1
- package/dist/providers/registry.d.ts.map +0 -1
- package/dist/providers/registry.js.map +0 -1
- package/dist/providers/result-helpers.d.ts.map +0 -1
- package/dist/providers/result-helpers.js.map +0 -1
- package/dist/providers/synthetic.d.ts.map +0 -1
- package/dist/providers/synthetic.js.map +0 -1
- package/dist/providers/xai.d.ts.map +0 -1
- package/dist/providers/xai.js.map +0 -1
- package/dist/providers/zai.d.ts.map +0 -1
- package/dist/providers/zai.js.map +0 -1
- package/dist/providers/zhipu.d.ts.map +0 -1
- package/dist/providers/zhipu.js.map +0 -1
- package/dist/rpc.d.ts.map +0 -1
- package/dist/rpc.js.map +0 -1
- package/dist/ui/assets/index-D9lFKhSN.js +0 -9
|
@@ -68,6 +68,63 @@
|
|
|
68
68
|
"2026-09-20",
|
|
69
69
|
"2026-10-10"
|
|
70
70
|
]
|
|
71
|
+
},
|
|
72
|
+
"2027": {
|
|
73
|
+
"timeZone": "Asia/Shanghai",
|
|
74
|
+
"source": "https://english.www.gov.cn/policies/latestreleases/202611/06/content_WS6aed74dcc6d00ca5f9a0e22e.html",
|
|
75
|
+
"published": "2026-11-06",
|
|
76
|
+
"intervals": [
|
|
77
|
+
{
|
|
78
|
+
"id": "new-year",
|
|
79
|
+
"localStart": "2027-01-01",
|
|
80
|
+
"localEnd": "2027-01-04",
|
|
81
|
+
"startMs": 1798732800000,
|
|
82
|
+
"endMs": 1798992000000
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"id": "spring-festival",
|
|
86
|
+
"localStart": "2027-02-05",
|
|
87
|
+
"localEnd": "2027-02-14",
|
|
88
|
+
"startMs": 1801756800000,
|
|
89
|
+
"endMs": 1802534400000
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "qingming",
|
|
93
|
+
"localStart": "2027-04-03",
|
|
94
|
+
"localEnd": "2027-04-06",
|
|
95
|
+
"startMs": 1806681600000,
|
|
96
|
+
"endMs": 1806940800000
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"id": "labour-day",
|
|
100
|
+
"localStart": "2027-05-01",
|
|
101
|
+
"localEnd": "2027-05-06",
|
|
102
|
+
"startMs": 1809100800000,
|
|
103
|
+
"endMs": 1809532800000
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "dragon-boat-festival",
|
|
107
|
+
"localStart": "2027-06-09",
|
|
108
|
+
"localEnd": "2027-06-10",
|
|
109
|
+
"startMs": 1812470400000,
|
|
110
|
+
"endMs": 1812556800000
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"id": "mid-autumn-festival",
|
|
114
|
+
"localStart": "2027-09-15",
|
|
115
|
+
"localEnd": "2027-09-16",
|
|
116
|
+
"startMs": 1820937600000,
|
|
117
|
+
"endMs": 1821024000000
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": "national-day",
|
|
121
|
+
"localStart": "2027-10-01",
|
|
122
|
+
"localEnd": "2027-10-08",
|
|
123
|
+
"startMs": 1822320000000,
|
|
124
|
+
"endMs": 1822924800000
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"makeupWorkdays": []
|
|
71
128
|
}
|
|
72
129
|
}
|
|
73
130
|
},
|
package/dist/gui/config.d.ts
CHANGED
|
@@ -10,16 +10,17 @@
|
|
|
10
10
|
* write helpers.
|
|
11
11
|
*/
|
|
12
12
|
import type { GuiSettingsStore } from "../contracts/dashboard.js";
|
|
13
|
+
import type { OpenCodeVersion } from "../lib/opencode-version-core.js";
|
|
13
14
|
import { type SettingsFileOpener } from "./settings-file-opener.js";
|
|
14
|
-
/** Writable GUI settings keys (spec §5.4 table order
|
|
15
|
-
export declare const GUI_SETTINGS_WRITABLE_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "opencodeGoWindows", "opencodeMonthlyLimit", "dashboard.hiddenCards", "dashboard.hiddenRows", "dashboard.providerOrder", "dashboard.cardOrder", "dashboard.temporalProviderOverrides"];
|
|
15
|
+
/** Writable GUI settings keys (spec §5.4 table order plus the web switch; port excluded). */
|
|
16
|
+
export declare const GUI_SETTINGS_WRITABLE_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "lowQuotaThresholdRemainingPercent", "duplicateCooldownMinutes", "nativeQuotaNotifications", "opencodeGoWindows", "opencodeMonthlyLimit", "dashboard.hiddenCards", "dashboard.hiddenRows", "dashboard.providerOrder", "dashboard.cardOrder", "dashboard.temporalProviderOverrides", "dashboard.enabled"];
|
|
16
17
|
/**
|
|
17
18
|
* Read-only GUI settings keys: the port needs a restart, and the hidden-card
|
|
18
19
|
* semantics marker is server-managed after an automatic write stamp.
|
|
19
20
|
*/
|
|
20
21
|
export declare const GUI_SETTINGS_READ_ONLY_KEYS: readonly ["dashboard.port", "dashboard.hiddenCardsVersion"];
|
|
21
22
|
/** Every GUI-exposed settings key (spec §5.4), in table order. */
|
|
22
|
-
export declare const GUI_SETTINGS_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "opencodeGoWindows", "opencodeMonthlyLimit", "dashboard.hiddenCards", "dashboard.hiddenRows", "dashboard.providerOrder", "dashboard.cardOrder", "dashboard.temporalProviderOverrides", "dashboard.port", "dashboard.hiddenCardsVersion"];
|
|
23
|
+
export declare const GUI_SETTINGS_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "lowQuotaThresholdRemainingPercent", "duplicateCooldownMinutes", "nativeQuotaNotifications", "opencodeGoWindows", "opencodeMonthlyLimit", "dashboard.hiddenCards", "dashboard.hiddenRows", "dashboard.providerOrder", "dashboard.cardOrder", "dashboard.temporalProviderOverrides", "dashboard.enabled", "dashboard.port", "dashboard.hiddenCardsVersion"];
|
|
23
24
|
export type GuiSettingsKey = (typeof GUI_SETTINGS_KEYS)[number];
|
|
24
25
|
export type GuiSettingsErrorCode = "config-read-error" | "config-changed" | "config-target-error" | "config-write-error" | "unknown-setting" | "invalid-setting";
|
|
25
26
|
export interface GuiSettingsErrorDetails {
|
|
@@ -43,12 +44,28 @@ export declare function getGuiDashboardPort(config: {
|
|
|
43
44
|
port?: number;
|
|
44
45
|
};
|
|
45
46
|
} | null | undefined): number;
|
|
47
|
+
/**
|
|
48
|
+
* The explicit canonical switch only: absence or any non-boolean value is off.
|
|
49
|
+
* The effective value also follows the host version when the key is absent; use
|
|
50
|
+
* `resolveDashboardWebEnabled` for that decision.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getGuiDashboardEnabled(config: {
|
|
53
|
+
dashboard?: {
|
|
54
|
+
enabled?: unknown;
|
|
55
|
+
};
|
|
56
|
+
} | null | undefined): boolean;
|
|
46
57
|
export declare function resolveGuiDashboardUrl(port: number): string;
|
|
47
58
|
export interface GuiSettingsStoreOptions {
|
|
48
59
|
/** Global OpenCode config dir; the canonical file lives under it. */
|
|
49
60
|
configDir: string;
|
|
50
61
|
/** Project config root whose legacy layers are read and reported, never written. */
|
|
51
62
|
workspaceRoot?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Running host version. When `dashboard.enabled` is absent, the snapshot
|
|
65
|
+
* reports the version-gated effective value so the Settings switch matches
|
|
66
|
+
* the transport. Missing or unparseable versions report off.
|
|
67
|
+
*/
|
|
68
|
+
hostVersion?: string | OpenCodeVersion;
|
|
52
69
|
/** Test/embedding seam: replaces the OS default-application opener. */
|
|
53
70
|
settingsFileOpener?: SettingsFileOpener;
|
|
54
71
|
}
|
package/dist/gui/config.js
CHANGED
|
@@ -14,16 +14,18 @@ import { existsSync } from "node:fs";
|
|
|
14
14
|
import { readFile } from "node:fs/promises";
|
|
15
15
|
import { resolve } from "node:path";
|
|
16
16
|
import { LEGACY_IMPORT_KEYS } from "../contracts/settings.js";
|
|
17
|
-
import {
|
|
17
|
+
import { withCanonicalConfigLock } from "../lib/canonical-config-lock.js";
|
|
18
|
+
import { buildConfigLayerCandidates, createLoadConfigMeta, GUI_CONFIG_RELATIVE_PATH, GUI_CONFIG_SIBLING_JSON_RELATIVE_PATH, getGuiConfigPath, getGuiConfigSiblingJsonPath, isPositiveNumber, isValidDuplicateCooldownMinutes, isValidLowQuotaThresholdRemainingPercent, isValidNativeQuotaNotificationPolicy, isValidOpenCodeGoWindows, loadConfig, loadConfigLayered, normalizeEnabledProviders, } from "../lib/config.js";
|
|
18
19
|
import { ConfigWriteTargetError, } from "../lib/config-write-target.js";
|
|
19
20
|
import { DASHBOARD_HIDDEN_CARDS_VERSION } from "../lib/dashboard-visibility.js";
|
|
21
|
+
import { getDashboardEnabledSetting, hasInvalidDashboardWebConfig, resolveDashboardWebEnabled, } from "../lib/dashboard-web-policy.js";
|
|
20
22
|
import { isResetTimeDecimals } from "../lib/format-utils.js";
|
|
21
23
|
import { assertGuiConfigTargetIsIndependent } from "../lib/gui-config-target.js";
|
|
22
24
|
import { applyConfigDocumentEdit, ConfigDocumentError, parseConfigDocument, planConfigDocumentEdit, } from "../lib/opencode-config-editor.js";
|
|
23
25
|
import { isQuotaFormatStyle, resolveQuotaFormatStyle } from "../lib/quota-format-style.js";
|
|
24
26
|
import { DASHBOARD_HIDDEN_ID_LIMIT, DEFAULT_DASHBOARD_PORT, } from "../lib/types.js";
|
|
25
27
|
import { createSettingsFileOpener, SettingsFileOpenError, } from "./settings-file-opener.js";
|
|
26
|
-
/** Writable GUI settings keys (spec §5.4 table order
|
|
28
|
+
/** Writable GUI settings keys (spec §5.4 table order plus the web switch; port excluded). */
|
|
27
29
|
export const GUI_SETTINGS_WRITABLE_KEYS = [
|
|
28
30
|
"formatStyle",
|
|
29
31
|
"percentDisplayMode",
|
|
@@ -36,6 +38,9 @@ export const GUI_SETTINGS_WRITABLE_KEYS = [
|
|
|
36
38
|
"minIntervalMs",
|
|
37
39
|
"requestTimeoutMs",
|
|
38
40
|
"accountingDetail",
|
|
41
|
+
"lowQuotaThresholdRemainingPercent",
|
|
42
|
+
"duplicateCooldownMinutes",
|
|
43
|
+
"nativeQuotaNotifications",
|
|
39
44
|
"opencodeGoWindows",
|
|
40
45
|
"opencodeMonthlyLimit",
|
|
41
46
|
"dashboard.hiddenCards",
|
|
@@ -43,6 +48,7 @@ export const GUI_SETTINGS_WRITABLE_KEYS = [
|
|
|
43
48
|
"dashboard.providerOrder",
|
|
44
49
|
"dashboard.cardOrder",
|
|
45
50
|
"dashboard.temporalProviderOverrides",
|
|
51
|
+
"dashboard.enabled",
|
|
46
52
|
];
|
|
47
53
|
/**
|
|
48
54
|
* Read-only GUI settings keys: the port needs a restart, and the hidden-card
|
|
@@ -95,6 +101,14 @@ export function getGuiDashboardPort(config) {
|
|
|
95
101
|
? port
|
|
96
102
|
: DEFAULT_DASHBOARD_PORT;
|
|
97
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* The explicit canonical switch only: absence or any non-boolean value is off.
|
|
106
|
+
* The effective value also follows the host version when the key is absent; use
|
|
107
|
+
* `resolveDashboardWebEnabled` for that decision.
|
|
108
|
+
*/
|
|
109
|
+
export function getGuiDashboardEnabled(config) {
|
|
110
|
+
return config?.dashboard?.enabled === true;
|
|
111
|
+
}
|
|
98
112
|
export function resolveGuiDashboardUrl(port) {
|
|
99
113
|
return `http://127.0.0.1:${getGuiDashboardPort({ dashboard: { port } })}`;
|
|
100
114
|
}
|
|
@@ -152,7 +166,8 @@ export function createGuiSettingsStore(options) {
|
|
|
152
166
|
let previewedRevision;
|
|
153
167
|
/** One serialized queue for all writers: the loser's stale revision yields 409. */
|
|
154
168
|
function withLock(run) {
|
|
155
|
-
const
|
|
169
|
+
const write = () => withCanonicalConfigLock(canonicalPath, run);
|
|
170
|
+
const next = lockTail.then(write, write);
|
|
156
171
|
lockTail = next.then(() => undefined, () => undefined);
|
|
157
172
|
return next;
|
|
158
173
|
}
|
|
@@ -206,6 +221,23 @@ export function createGuiSettingsStore(options) {
|
|
|
206
221
|
return config.requestTimeoutMs;
|
|
207
222
|
case "accountingDetail":
|
|
208
223
|
return config.accountingDetail;
|
|
224
|
+
case "lowQuotaThresholdRemainingPercent":
|
|
225
|
+
return config.lowQuotaThresholdRemainingPercent;
|
|
226
|
+
case "duplicateCooldownMinutes":
|
|
227
|
+
return config.duplicateCooldownMinutes;
|
|
228
|
+
case "nativeQuotaNotifications":
|
|
229
|
+
return {
|
|
230
|
+
enabled: config.nativeQuotaNotifications.enabled,
|
|
231
|
+
modelChangeToastEnabled: config.nativeQuotaNotifications.modelChangeToastEnabled,
|
|
232
|
+
low: { ...config.nativeQuotaNotifications.low },
|
|
233
|
+
exhausted: { ...config.nativeQuotaNotifications.exhausted },
|
|
234
|
+
reset: {
|
|
235
|
+
...config.nativeQuotaNotifications.reset,
|
|
236
|
+
windows: [...config.nativeQuotaNotifications.reset.windows],
|
|
237
|
+
},
|
|
238
|
+
providerError: { ...config.nativeQuotaNotifications.providerError },
|
|
239
|
+
duplicateCooldownMinutes: config.nativeQuotaNotifications.duplicateCooldownMinutes,
|
|
240
|
+
};
|
|
209
241
|
case "opencodeGoWindows":
|
|
210
242
|
return [...config.opencodeGoWindows];
|
|
211
243
|
case "opencodeMonthlyLimit":
|
|
@@ -222,6 +254,8 @@ export function createGuiSettingsStore(options) {
|
|
|
222
254
|
return [...config.dashboard.cardOrder];
|
|
223
255
|
case "dashboard.temporalProviderOverrides":
|
|
224
256
|
return { ...config.dashboard.temporalProviderOverrides };
|
|
257
|
+
case "dashboard.enabled":
|
|
258
|
+
return config.dashboard.enabled;
|
|
225
259
|
case "dashboard.port":
|
|
226
260
|
return config.dashboard.port;
|
|
227
261
|
}
|
|
@@ -389,6 +423,29 @@ export function createGuiSettingsStore(options) {
|
|
|
389
423
|
throw invalidSetting(key, 'expected "summary" or "detailed"');
|
|
390
424
|
}
|
|
391
425
|
return value;
|
|
426
|
+
case "lowQuotaThresholdRemainingPercent":
|
|
427
|
+
if (!isValidLowQuotaThresholdRemainingPercent(value)) {
|
|
428
|
+
throw invalidSetting(key, "expected an integer between 1 and 100");
|
|
429
|
+
}
|
|
430
|
+
return value;
|
|
431
|
+
case "duplicateCooldownMinutes":
|
|
432
|
+
if (!isValidDuplicateCooldownMinutes(value)) {
|
|
433
|
+
throw invalidSetting(key, "expected an integer of 0 or more");
|
|
434
|
+
}
|
|
435
|
+
return value;
|
|
436
|
+
case "nativeQuotaNotifications":
|
|
437
|
+
if (!isValidNativeQuotaNotificationPolicy(value)) {
|
|
438
|
+
throw invalidSetting(key, "expected a complete Native quota notification policy");
|
|
439
|
+
}
|
|
440
|
+
return {
|
|
441
|
+
enabled: value.enabled,
|
|
442
|
+
modelChangeToastEnabled: value.modelChangeToastEnabled,
|
|
443
|
+
low: { ...value.low },
|
|
444
|
+
exhausted: { ...value.exhausted },
|
|
445
|
+
reset: { ...value.reset, windows: [...new Set(value.reset.windows)] },
|
|
446
|
+
providerError: { ...value.providerError },
|
|
447
|
+
duplicateCooldownMinutes: value.duplicateCooldownMinutes,
|
|
448
|
+
};
|
|
392
449
|
case "opencodeGoWindows":
|
|
393
450
|
if (!isValidOpenCodeGoWindows(value)) {
|
|
394
451
|
throw invalidSetting(key, 'expected a non-empty subset of "rolling", "weekly", "monthly"');
|
|
@@ -435,6 +492,11 @@ export function createGuiSettingsStore(options) {
|
|
|
435
492
|
}
|
|
436
493
|
case "dashboard.port":
|
|
437
494
|
throw invalidSetting(key, "this setting is read-only; edit the canonical file and restart");
|
|
495
|
+
case "dashboard.enabled":
|
|
496
|
+
if (value !== true && value !== false) {
|
|
497
|
+
throw invalidSetting(key, "expected boolean");
|
|
498
|
+
}
|
|
499
|
+
return value;
|
|
438
500
|
case "dashboard.hiddenCardsVersion":
|
|
439
501
|
throw invalidSetting(key, "this setting is read-only; hidden-card semantics are managed automatically");
|
|
440
502
|
}
|
|
@@ -595,9 +657,15 @@ export function createGuiSettingsStore(options) {
|
|
|
595
657
|
}
|
|
596
658
|
async function settings() {
|
|
597
659
|
const state = await readState();
|
|
660
|
+
const dashboardEnabled = resolveDashboardWebEnabled({
|
|
661
|
+
explicitEnabled: getDashboardEnabledSetting(state.runtimeConfig, state.runtimeMeta),
|
|
662
|
+
...(options.hostVersion !== undefined ? { hostVersion: options.hostVersion } : {}),
|
|
663
|
+
invalidConfig: hasInvalidDashboardWebConfig(state.runtimeMeta),
|
|
664
|
+
});
|
|
598
665
|
const values = {};
|
|
599
666
|
for (const key of GUI_SETTINGS_KEYS) {
|
|
600
|
-
values[key] =
|
|
667
|
+
values[key] =
|
|
668
|
+
key === "dashboard.enabled" ? dashboardEnabled : settingValue(state.runtimeConfig, key);
|
|
601
669
|
}
|
|
602
670
|
const sources = {};
|
|
603
671
|
const provenance = {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared controlled error vocabulary for every dashboard transport (HTTP and
|
|
3
|
+
* RPC). Messages are fixed generics: raw exception text, absolute paths and
|
|
4
|
+
* provider payloads never cross a transport boundary.
|
|
5
|
+
*/
|
|
6
|
+
export type DashboardErrorCode = "bad-request" | "bad-host" | "bad-origin" | "unsupported-media-type" | "body-too-large" | "method-not-allowed" | "not-found" | "config-read-error" | "config-changed" | "config-target-error" | "config-write-error" | "unknown-setting" | "invalid-setting" | "project-not-found" | "session-not-found" | "internal";
|
|
7
|
+
export interface DashboardErrorDetails {
|
|
8
|
+
reason?: string;
|
|
9
|
+
key?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Status mapping from spec §5.3. */
|
|
12
|
+
export declare const DASHBOARD_ERROR_STATUS: Readonly<Record<DashboardErrorCode, number>>;
|
|
13
|
+
export declare const DASHBOARD_ERROR_MESSAGES: Readonly<Record<DashboardErrorCode, string>>;
|
|
14
|
+
/** The set above is the vocabulary; trust it as the membership proof. */
|
|
15
|
+
export declare function isDashboardSourceErrorCode(value: string): value is DashboardErrorCode;
|
|
16
|
+
/**
|
|
17
|
+
* `details.reason` is forwarded for `config-target-error` only, and only from
|
|
18
|
+
* the allowlisted target-reason vocabulary; `details.key` must be a setting key
|
|
19
|
+
* shape. Other payload data never crosses the boundary.
|
|
20
|
+
*/
|
|
21
|
+
export declare function sanitizeDashboardErrorDetails(code: DashboardErrorCode, input: {
|
|
22
|
+
reason?: string;
|
|
23
|
+
key?: string;
|
|
24
|
+
} | undefined): DashboardErrorDetails | undefined;
|
|
25
|
+
/** The stable source `code` field, across independently loaded module graphs. */
|
|
26
|
+
export declare function structuralDashboardSourceCode(error: unknown): DashboardErrorCode | undefined;
|
|
27
|
+
/** A controlled condition the source or a store wants surfaced verbatim-ish. */
|
|
28
|
+
export declare class DashboardHttpError extends Error {
|
|
29
|
+
readonly code: DashboardErrorCode;
|
|
30
|
+
constructor(code: DashboardErrorCode);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=dashboard-errors.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared controlled error vocabulary for every dashboard transport (HTTP and
|
|
3
|
+
* RPC). Messages are fixed generics: raw exception text, absolute paths and
|
|
4
|
+
* provider payloads never cross a transport boundary.
|
|
5
|
+
*/
|
|
6
|
+
/** Status mapping from spec §5.3. */
|
|
7
|
+
export const DASHBOARD_ERROR_STATUS = {
|
|
8
|
+
"bad-request": 400,
|
|
9
|
+
"bad-host": 403,
|
|
10
|
+
"bad-origin": 403,
|
|
11
|
+
"unsupported-media-type": 415,
|
|
12
|
+
"body-too-large": 413,
|
|
13
|
+
"method-not-allowed": 405,
|
|
14
|
+
"not-found": 404,
|
|
15
|
+
"config-read-error": 409,
|
|
16
|
+
"config-changed": 409,
|
|
17
|
+
"config-target-error": 409,
|
|
18
|
+
"config-write-error": 500,
|
|
19
|
+
"unknown-setting": 422,
|
|
20
|
+
"invalid-setting": 422,
|
|
21
|
+
"project-not-found": 404,
|
|
22
|
+
"session-not-found": 404,
|
|
23
|
+
internal: 500,
|
|
24
|
+
};
|
|
25
|
+
export const DASHBOARD_ERROR_MESSAGES = {
|
|
26
|
+
"bad-request": "Malformed request",
|
|
27
|
+
"bad-host": "Requests must target the dashboard loopback address",
|
|
28
|
+
"bad-origin": "Writes must originate from the dashboard page",
|
|
29
|
+
"unsupported-media-type": "Writes require application/json",
|
|
30
|
+
"body-too-large": "Request body exceeds the 64 KiB limit",
|
|
31
|
+
"method-not-allowed": "Method not allowed",
|
|
32
|
+
"not-found": "Not found",
|
|
33
|
+
"config-read-error": "The dashboard config file is not valid JSONC",
|
|
34
|
+
"config-changed": "Config changed since the last revision",
|
|
35
|
+
"config-target-error": "The dashboard config path is not writable",
|
|
36
|
+
"config-write-error": "Config write failed",
|
|
37
|
+
"unknown-setting": "Unknown setting",
|
|
38
|
+
"invalid-setting": "Invalid setting",
|
|
39
|
+
"project-not-found": "Project not found",
|
|
40
|
+
"session-not-found": "Session not found",
|
|
41
|
+
internal: "Internal dashboard error",
|
|
42
|
+
};
|
|
43
|
+
const SOURCE_ERROR_CODES = new Set([
|
|
44
|
+
"bad-request",
|
|
45
|
+
"project-not-found",
|
|
46
|
+
"session-not-found",
|
|
47
|
+
]);
|
|
48
|
+
/** The set above is the vocabulary; trust it as the membership proof. */
|
|
49
|
+
export function isDashboardSourceErrorCode(value) {
|
|
50
|
+
return SOURCE_ERROR_CODES.has(value);
|
|
51
|
+
}
|
|
52
|
+
const TARGET_REASONS = new Set([
|
|
53
|
+
"dangling",
|
|
54
|
+
"loop",
|
|
55
|
+
"depth",
|
|
56
|
+
"non-regular",
|
|
57
|
+
"permission",
|
|
58
|
+
]);
|
|
59
|
+
const SETTING_KEY_RE = /^[A-Za-z][A-Za-z0-9]*(\.[A-Za-z][A-Za-z0-9]*)*$/;
|
|
60
|
+
/**
|
|
61
|
+
* `details.reason` is forwarded for `config-target-error` only, and only from
|
|
62
|
+
* the allowlisted target-reason vocabulary; `details.key` must be a setting key
|
|
63
|
+
* shape. Other payload data never crosses the boundary.
|
|
64
|
+
*/
|
|
65
|
+
export function sanitizeDashboardErrorDetails(code, input) {
|
|
66
|
+
if (!input)
|
|
67
|
+
return undefined;
|
|
68
|
+
const details = {};
|
|
69
|
+
if (code === "config-target-error" &&
|
|
70
|
+
input.reason !== undefined &&
|
|
71
|
+
TARGET_REASONS.has(input.reason)) {
|
|
72
|
+
details.reason = input.reason;
|
|
73
|
+
}
|
|
74
|
+
if (input.key !== undefined && input.key.length <= 64 && SETTING_KEY_RE.test(input.key)) {
|
|
75
|
+
details.key = input.key;
|
|
76
|
+
}
|
|
77
|
+
return Object.keys(details).length > 0 ? details : undefined;
|
|
78
|
+
}
|
|
79
|
+
/** The stable source `code` field, across independently loaded module graphs. */
|
|
80
|
+
export function structuralDashboardSourceCode(error) {
|
|
81
|
+
if (error === null || typeof error !== "object" || !("code" in error))
|
|
82
|
+
return undefined;
|
|
83
|
+
const code = error.code;
|
|
84
|
+
if (typeof code !== "string" || !isDashboardSourceErrorCode(code))
|
|
85
|
+
return undefined;
|
|
86
|
+
return code;
|
|
87
|
+
}
|
|
88
|
+
/** A controlled condition the source or a store wants surfaced verbatim-ish. */
|
|
89
|
+
export class DashboardHttpError extends Error {
|
|
90
|
+
code;
|
|
91
|
+
constructor(code) {
|
|
92
|
+
super(DASHBOARD_ERROR_MESSAGES[code]);
|
|
93
|
+
this.name = "DashboardHttpError";
|
|
94
|
+
this.code = code;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=dashboard-errors.js.map
|
package/dist/gui/lifecycle.d.ts
CHANGED
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
* owner's source, and when that owner disposes while other leases remain the
|
|
9
9
|
* host switches to a live owner's source — created lazily on the next request —
|
|
10
10
|
* without dropping the socket. The settings store is host-scoped file access.
|
|
11
|
-
*
|
|
11
|
+
* One runtime — the stable delegating source and one `SnapshotService` — is
|
|
12
|
+
* shared by every transport attached to that host. The host closes with the
|
|
13
|
+
* last lease, releasing the snapshot service and every source it created. The
|
|
14
|
+
* web transport is optional and follows the host version when `dashboard.enabled`
|
|
15
|
+
* is absent (on below OpenCode 2.2.1, off from 2.2.1): when it is off, or when
|
|
16
|
+
* its fixed port cannot bind, the shared runtime stays available for the
|
|
17
|
+
* remaining leases and no HTTP/SSE/static surface is started.
|
|
12
18
|
*
|
|
13
19
|
* The registry lives on `globalThis` under a versioned `Symbol.for` key (the
|
|
14
20
|
* quota-telemetry precedent), so two separately loaded copies of this module in
|
|
@@ -17,14 +23,18 @@
|
|
|
17
23
|
* an error thrown by another module graph is structurally identical.
|
|
18
24
|
*
|
|
19
25
|
* Nothing here throws into the plugin: every failure becomes one controlled log
|
|
20
|
-
* line and a lease in state `unavailable`. A failed bind is terminal
|
|
21
|
-
* §4.3) — no alternate port is ever tried, and the plugin's
|
|
22
|
-
* untouched.
|
|
26
|
+
* line and a lease in state `unavailable`. A failed bind is terminal for the web
|
|
27
|
+
* transport (spec §4.3) — no alternate port is ever tried, and the plugin's
|
|
28
|
+
* other surfaces are untouched.
|
|
23
29
|
*/
|
|
24
30
|
import type { DashboardDataSource, GuiSettingsStore, QuotaSnapshot } from "../contracts/dashboard.js";
|
|
25
31
|
import type { QuotaProviderContext } from "../lib/entries.js";
|
|
32
|
+
import type { OpenCodeVersion } from "../lib/opencode-version-core.js";
|
|
33
|
+
import { type GuiSettingsStoreOptions } from "./config.js";
|
|
26
34
|
import { type GuiLogger } from "./log.js";
|
|
35
|
+
import { type QuotaNotificationObserver } from "./quota-notification-observer.js";
|
|
27
36
|
import { type DashboardServerHandle, type DashboardServerOptions } from "./server.js";
|
|
37
|
+
import { type SnapshotService, type SnapshotServiceOptions } from "./snapshot-service.js";
|
|
28
38
|
/**
|
|
29
39
|
* The V1-shaped client the quota read path already receives (plugin `client`):
|
|
30
40
|
* config reads plus the provider id list. The P3 read source accepts this shape.
|
|
@@ -32,7 +42,9 @@ import { type DashboardServerHandle, type DashboardServerOptions } from "./serve
|
|
|
32
42
|
export type DashboardClient = QuotaProviderContext["client"];
|
|
33
43
|
/** The read side of the dashboard source this lifecycle needs (P3 producer). */
|
|
34
44
|
export type DashboardReadSource = Pick<DashboardDataSource, "home" | "project" | "session" | "groups"> & {
|
|
35
|
-
quota?(
|
|
45
|
+
quota?(input?: {
|
|
46
|
+
refresh?: boolean;
|
|
47
|
+
}): Promise<QuotaSnapshot>;
|
|
36
48
|
/** One shared analytics refresh per transport tick, when the owner loaded analytics. */
|
|
37
49
|
refreshAnalytics?(): Promise<void>;
|
|
38
50
|
/** Owner dispose / host close: releases lazily created analytics resources. */
|
|
@@ -46,15 +58,29 @@ export interface DashboardSourceOptions {
|
|
|
46
58
|
export type DashboardSourceFactory = (options: DashboardSourceOptions) => DashboardReadSource | Promise<DashboardReadSource>;
|
|
47
59
|
export type DashboardUnavailableReason = "port-unavailable" | "source-unavailable" | "settings-unavailable" | "server-unavailable";
|
|
48
60
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
|
|
61
|
+
* The host-owned dependencies every transport attaches to. Both objects are
|
|
62
|
+
* created once per shared host; transports never construct or close them.
|
|
63
|
+
*/
|
|
64
|
+
export interface DashboardTransportRuntime {
|
|
65
|
+
readonly snapshots: SnapshotService;
|
|
66
|
+
readonly settings: GuiSettingsStore;
|
|
67
|
+
/** One host-owned observer; its safe events use the quota notification channel. */
|
|
68
|
+
readonly quotaNotifications?: QuotaNotificationObserver;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* One setup's claim on the dashboard host. `running` leases share the host
|
|
72
|
+
* runtime; `url` is present only when the web transport is enabled and bound.
|
|
73
|
+
* `unavailable` leases report a controlled `reason`; a web-only failure keeps
|
|
74
|
+
* the shared runtime alive until the last lease disposes. `runtime` is present
|
|
75
|
+
* whenever the shared source/settings/snapshot service started, including when
|
|
76
|
+
* web is disabled or its bind failed. Disposing is idempotent and never rejects.
|
|
52
77
|
*/
|
|
53
78
|
export interface DashboardLease {
|
|
54
79
|
readonly port: number;
|
|
55
80
|
readonly state: "running" | "unavailable";
|
|
56
81
|
readonly url?: string;
|
|
57
82
|
readonly reason?: DashboardUnavailableReason;
|
|
83
|
+
readonly runtime?: DashboardTransportRuntime;
|
|
58
84
|
dispose(): Promise<void>;
|
|
59
85
|
}
|
|
60
86
|
export interface StartDashboardOptions {
|
|
@@ -63,13 +89,22 @@ export interface StartDashboardOptions {
|
|
|
63
89
|
workspaceRoot: string;
|
|
64
90
|
/** Global OpenCode config dir; defaults to the runtime dirs. */
|
|
65
91
|
configDir?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Running OpenCode host version (`ctx.app?.version`). When absent, a bounded
|
|
94
|
+
* `opencode --version` probe supplies it; if that also fails, the
|
|
95
|
+
* version-dependent web default stays off.
|
|
96
|
+
*/
|
|
97
|
+
hostVersion?: string;
|
|
98
|
+
/** Test/embedding seam: replaces the bounded host-version probe. */
|
|
99
|
+
detectHostVersion?: () => Promise<OpenCodeVersion | undefined>;
|
|
66
100
|
/** Test/P7 seam: replaces the P3 read-source factory. */
|
|
67
101
|
createSource?: DashboardSourceFactory;
|
|
68
102
|
/** Test seam: replaces the P2 settings store factory. */
|
|
69
|
-
createSettingsStore?: (options:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
103
|
+
createSettingsStore?: (options: GuiSettingsStoreOptions) => GuiSettingsStore;
|
|
104
|
+
/** Test seam: replaces the per-host snapshot service factory. */
|
|
105
|
+
createSnapshots?: (options: SnapshotServiceOptions) => SnapshotService;
|
|
106
|
+
/** Test/embedding seam: private quota notification cooldown state path. */
|
|
107
|
+
quotaNotificationStatePath?: string;
|
|
73
108
|
/** Test seam: replaces the transport factory. */
|
|
74
109
|
createServer?: (options: DashboardServerOptions) => Promise<DashboardServerHandle>;
|
|
75
110
|
logger?: GuiLogger;
|