opencode-quota-gui 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -34
- package/dist/bin/opencode-quota-gui.js +0 -0
- package/dist/contracts/analytics-entity.d.ts +6 -1
- package/dist/contracts/analytics-entity.js +27 -10
- package/dist/contracts/analytics-temporal.d.ts +39 -0
- package/dist/contracts/analytics-temporal.js +11 -0
- package/dist/contracts/build-identity.js +1 -1
- package/dist/contracts/card-visibility.d.ts +21 -0
- package/dist/contracts/card-visibility.js +19 -0
- package/dist/contracts/dashboard.d.ts +40 -0
- package/dist/contracts/dashboard.js +2 -0
- package/dist/contracts/dto-guards.d.ts +24 -0
- package/dist/contracts/dto-guards.js +592 -0
- package/dist/contracts/provider-failure.d.ts +18 -0
- package/dist/contracts/provider-failure.js +25 -0
- package/dist/contracts/temporal.d.ts +126 -0
- package/dist/contracts/temporal.js +10 -0
- package/dist/data/modelsdev-temporal.min.json +3075 -0
- package/dist/gui/aggregation.js +3 -0
- package/dist/gui/analytics-engine.js +30 -0
- package/dist/gui/analytics-model.js +181 -1
- package/dist/gui/analytics-pricing-revision.d.ts +43 -0
- package/dist/gui/analytics-pricing-revision.js +160 -0
- package/dist/gui/analytics-state.d.ts +7 -2
- package/dist/gui/analytics-state.js +14 -2
- package/dist/gui/config.d.ts +20 -3
- package/dist/gui/config.js +60 -3
- package/dist/gui/dashboard-errors.d.ts +32 -0
- package/dist/gui/dashboard-errors.js +97 -0
- package/dist/gui/lifecycle.d.ts +44 -11
- package/dist/gui/lifecycle.js +214 -36
- package/dist/gui/primary-quota-windows.d.ts +28 -0
- package/dist/gui/primary-quota-windows.js +147 -0
- package/dist/gui/provider-cards.d.ts +1 -1
- package/dist/gui/provider-cards.js +40 -16
- package/dist/gui/quota-notification-detector.d.ts +151 -0
- package/dist/gui/quota-notification-detector.js +284 -0
- package/dist/gui/quota-notification-observer.d.ts +55 -0
- package/dist/gui/quota-notification-observer.js +363 -0
- package/dist/gui/rpc.d.ts +59 -0
- package/dist/gui/rpc.js +302 -0
- package/dist/gui/server.d.ts +15 -27
- package/dist/gui/server.js +23 -121
- package/dist/gui/snapshot-service.d.ts +31 -4
- package/dist/gui/snapshot-service.js +177 -54
- package/dist/gui/sources.d.ts +1 -1
- package/dist/gui/sources.js +28 -0
- package/dist/gui/temporal-quota-policy-data.d.ts +24 -0
- package/dist/gui/temporal-quota-policy-data.js +43 -0
- package/dist/gui/temporal-quota-policy.d.ts +38 -0
- package/dist/gui/temporal-quota-policy.js +182 -0
- package/dist/gui/temporal-status.d.ts +53 -0
- package/dist/gui/temporal-status.js +815 -0
- package/dist/gui-experimental.cjs +1756 -0
- package/dist/lib/anthropic.d.ts +5 -0
- package/dist/lib/anthropic.js +18 -1
- package/dist/lib/chutes.js +19 -2
- package/dist/lib/config.d.ts +5 -1
- package/dist/lib/config.js +81 -0
- package/dist/lib/copilot.js +42 -14
- package/dist/lib/dashboard-web-policy.d.ts +35 -0
- package/dist/lib/dashboard-web-policy.js +24 -0
- package/dist/lib/deepseek.js +12 -1
- package/dist/lib/display-sanitize.js +2 -0
- package/dist/lib/entries.d.ts +3 -0
- package/dist/lib/format-utils.d.ts +1 -1
- package/dist/lib/format-utils.js +2 -2
- package/dist/lib/glm-coding-plan.js +14 -4
- package/dist/lib/google-agy.js +59 -14
- package/dist/lib/google-gemini-cli.js +58 -14
- package/dist/lib/init-installer.js +25 -4
- package/dist/lib/kilo.js +29 -40
- package/dist/lib/kimi.js +13 -1
- package/dist/lib/mimo.d.ts +2 -0
- package/dist/lib/mimo.js +9 -1
- package/dist/lib/modelsdev-temporal.d.ts +143 -0
- package/dist/lib/modelsdev-temporal.js +896 -0
- package/dist/lib/nanogpt.d.ts +2 -0
- package/dist/lib/nanogpt.js +24 -3
- package/dist/lib/ollama-cloud.js +9 -0
- package/dist/lib/openai.js +6 -2
- package/dist/lib/opencode-auth.d.ts +3 -2
- package/dist/lib/opencode-auth.js +8 -1
- package/dist/lib/opencode-go.js +24 -3
- package/dist/lib/opencode-version.d.ts +21 -0
- package/dist/lib/opencode-version.js +53 -5
- package/dist/lib/opencode-zen.d.ts +9 -1
- package/dist/lib/opencode-zen.js +27 -7
- package/dist/lib/quota-providers-remote.d.ts +2 -0
- package/dist/lib/quota-providers-remote.js +78 -19
- package/dist/lib/quota-reset-notifications.d.ts +17 -0
- package/dist/lib/quota-reset-notifications.js +11 -2
- package/dist/lib/quota-state-codec.js +3 -1
- package/dist/lib/quota-stats.d.ts +22 -1
- package/dist/lib/quota-stats.js +111 -15
- package/dist/lib/synthetic.js +8 -0
- package/dist/lib/types.d.ts +24 -0
- package/dist/lib/types.js +4 -0
- package/dist/lib/xai.js +16 -2
- package/dist/plugin.d.ts +4 -3
- package/dist/plugin.js +33 -4
- package/dist/providers/alibaba-coding-plan.js +3 -1
- package/dist/providers/alibaba-token-plan.js +17 -0
- package/dist/providers/anthropic.js +12 -3
- package/dist/providers/copilot.js +10 -2
- package/dist/providers/glm-coding-plan-provider.d.ts +2 -0
- package/dist/providers/glm-coding-plan-provider.js +5 -1
- package/dist/providers/google-account-format.js +1 -0
- package/dist/providers/google-agy.js +12 -2
- package/dist/providers/google-gemini-cli.js +12 -2
- package/dist/providers/kilo.js +9 -1
- package/dist/providers/kimi-code.js +11 -6
- package/dist/providers/mimo.js +8 -2
- package/dist/providers/minimax-coding-plan.js +28 -5
- package/dist/providers/nanogpt.js +3 -0
- package/dist/providers/ollama-cloud.js +3 -0
- package/dist/providers/openai.js +1 -0
- package/dist/providers/opencode-go.js +8 -1
- package/dist/providers/opencode-zen.js +30 -3
- package/dist/providers/openrouter.js +3 -0
- package/dist/providers/quota-providers.js +30 -4
- package/dist/providers/result-helpers.d.ts +4 -0
- package/dist/providers/result-helpers.js +16 -2
- package/dist/rpc.d.ts +327 -4
- package/dist/rpc.js +315 -2
- package/dist/ui/assets/index-DLHeXYff.js +9 -0
- package/dist/ui/assets/{index-BZwMJ6Ax.css → index-cDd9jUVY.css} +1 -1
- package/dist/ui/assets/popover-BGkgv9s0.js +1 -0
- package/dist/ui/assets/popover-mkHTmNjv.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +49 -39
- package/dist/bin/opencode-quota-gui.d.ts.map +0 -1
- package/dist/bin/opencode-quota-gui.js.map +0 -1
- package/dist/contracts/analytics-entity.d.ts.map +0 -1
- package/dist/contracts/analytics-entity.js.map +0 -1
- package/dist/contracts/build-identity.d.ts.map +0 -1
- package/dist/contracts/card-order.d.ts.map +0 -1
- package/dist/contracts/card-order.js.map +0 -1
- package/dist/contracts/collision-safe-key.d.ts.map +0 -1
- package/dist/contracts/collision-safe-key.js.map +0 -1
- package/dist/contracts/dashboard.d.ts.map +0 -1
- package/dist/contracts/dashboard.js.map +0 -1
- package/dist/contracts/guards.d.ts.map +0 -1
- package/dist/contracts/guards.js.map +0 -1
- package/dist/contracts/identity.d.ts.map +0 -1
- package/dist/contracts/identity.js.map +0 -1
- package/dist/contracts/openai-quota.d.ts.map +0 -1
- package/dist/contracts/openai-quota.js.map +0 -1
- package/dist/contracts/ranges.d.ts.map +0 -1
- package/dist/contracts/ranges.js.map +0 -1
- package/dist/contracts/settings.d.ts.map +0 -1
- package/dist/contracts/settings.js.map +0 -1
- package/dist/contracts/time-zone.d.ts.map +0 -1
- package/dist/contracts/time-zone.js.map +0 -1
- package/dist/gui/aggregation.d.ts.map +0 -1
- package/dist/gui/aggregation.js.map +0 -1
- package/dist/gui/analytics-bridge.d.ts.map +0 -1
- package/dist/gui/analytics-bridge.js.map +0 -1
- package/dist/gui/analytics-engine.d.ts.map +0 -1
- package/dist/gui/analytics-engine.js.map +0 -1
- package/dist/gui/analytics-indexes.d.ts.map +0 -1
- package/dist/gui/analytics-indexes.js.map +0 -1
- package/dist/gui/analytics-model.d.ts.map +0 -1
- package/dist/gui/analytics-model.js.map +0 -1
- package/dist/gui/analytics-protocol.d.ts.map +0 -1
- package/dist/gui/analytics-protocol.js.map +0 -1
- package/dist/gui/analytics-reader.d.ts.map +0 -1
- package/dist/gui/analytics-reader.js.map +0 -1
- package/dist/gui/analytics-service.d.ts.map +0 -1
- package/dist/gui/analytics-service.js.map +0 -1
- package/dist/gui/analytics-state.d.ts.map +0 -1
- package/dist/gui/analytics-state.js.map +0 -1
- package/dist/gui/analytics-worker-runtime.d.ts.map +0 -1
- package/dist/gui/analytics-worker-runtime.js.map +0 -1
- package/dist/gui/analytics-worker.d.ts.map +0 -1
- package/dist/gui/analytics-worker.js.map +0 -1
- package/dist/gui/config.d.ts.map +0 -1
- package/dist/gui/config.js.map +0 -1
- package/dist/gui/identity.d.ts.map +0 -1
- package/dist/gui/identity.js.map +0 -1
- package/dist/gui/lifecycle.d.ts.map +0 -1
- package/dist/gui/lifecycle.js.map +0 -1
- package/dist/gui/log.d.ts.map +0 -1
- package/dist/gui/log.js.map +0 -1
- package/dist/gui/provider-cards.d.ts.map +0 -1
- package/dist/gui/provider-cards.js.map +0 -1
- package/dist/gui/server.d.ts.map +0 -1
- package/dist/gui/server.js.map +0 -1
- package/dist/gui/settings-file-opener.d.ts.map +0 -1
- package/dist/gui/settings-file-opener.js.map +0 -1
- package/dist/gui/snapshot-service.d.ts.map +0 -1
- package/dist/gui/snapshot-service.js.map +0 -1
- package/dist/gui/sources.d.ts.map +0 -1
- package/dist/gui/sources.js.map +0 -1
- package/dist/gui/sse.d.ts.map +0 -1
- package/dist/gui/sse.js.map +0 -1
- package/dist/gui/time-zone.d.ts.map +0 -1
- package/dist/gui/time-zone.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/accounting-format.d.ts.map +0 -1
- package/dist/lib/accounting-format.js.map +0 -1
- package/dist/lib/alibaba-auth.d.ts.map +0 -1
- package/dist/lib/alibaba-auth.js.map +0 -1
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts.map +0 -1
- package/dist/lib/alibaba-coding-plan-local-quota.js.map +0 -1
- package/dist/lib/alibaba-token-plan.d.ts.map +0 -1
- package/dist/lib/alibaba-token-plan.js.map +0 -1
- package/dist/lib/anthropic-auth.d.ts.map +0 -1
- package/dist/lib/anthropic-auth.js.map +0 -1
- package/dist/lib/anthropic.d.ts.map +0 -1
- package/dist/lib/anthropic.js.map +0 -1
- package/dist/lib/api-key-resolver.d.ts.map +0 -1
- package/dist/lib/api-key-resolver.js.map +0 -1
- package/dist/lib/atomic-json.d.ts.map +0 -1
- package/dist/lib/atomic-json.js.map +0 -1
- package/dist/lib/chutes-config.d.ts.map +0 -1
- package/dist/lib/chutes-config.js.map +0 -1
- package/dist/lib/chutes.d.ts.map +0 -1
- package/dist/lib/chutes.js.map +0 -1
- package/dist/lib/cli-reports.d.ts.map +0 -1
- package/dist/lib/cli-reports.js.map +0 -1
- package/dist/lib/cli-show.d.ts.map +0 -1
- package/dist/lib/cli-show.js.map +0 -1
- package/dist/lib/cli-status.d.ts.map +0 -1
- package/dist/lib/cli-status.js.map +0 -1
- package/dist/lib/command-parsing.d.ts.map +0 -1
- package/dist/lib/command-parsing.js.map +0 -1
- package/dist/lib/config-file-utils.d.ts.map +0 -1
- package/dist/lib/config-file-utils.js.map +0 -1
- package/dist/lib/config-write-target.d.ts.map +0 -1
- package/dist/lib/config-write-target.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/copilot.d.ts.map +0 -1
- package/dist/lib/copilot.js.map +0 -1
- package/dist/lib/cursor-detection.d.ts.map +0 -1
- package/dist/lib/cursor-detection.js.map +0 -1
- package/dist/lib/cursor-pricing.d.ts.map +0 -1
- package/dist/lib/cursor-pricing.js.map +0 -1
- package/dist/lib/cursor-usage.d.ts.map +0 -1
- package/dist/lib/cursor-usage.js.map +0 -1
- package/dist/lib/dashboard-visibility.d.ts.map +0 -1
- package/dist/lib/dashboard-visibility.js.map +0 -1
- package/dist/lib/deepseek-auth.d.ts.map +0 -1
- package/dist/lib/deepseek-auth.js.map +0 -1
- package/dist/lib/deepseek.d.ts.map +0 -1
- package/dist/lib/deepseek.js.map +0 -1
- package/dist/lib/display-sanitize.d.ts.map +0 -1
- package/dist/lib/display-sanitize.js.map +0 -1
- package/dist/lib/entries.d.ts.map +0 -1
- package/dist/lib/entries.js.map +0 -1
- package/dist/lib/env-template.d.ts.map +0 -1
- package/dist/lib/env-template.js.map +0 -1
- package/dist/lib/format-utils.d.ts.map +0 -1
- package/dist/lib/format-utils.js.map +0 -1
- package/dist/lib/format.d.ts.map +0 -1
- package/dist/lib/format.js.map +0 -1
- package/dist/lib/glm-coding-plan.d.ts.map +0 -1
- package/dist/lib/glm-coding-plan.js.map +0 -1
- package/dist/lib/google-agy-companion.d.ts.map +0 -1
- package/dist/lib/google-agy-companion.js.map +0 -1
- package/dist/lib/google-agy.d.ts.map +0 -1
- package/dist/lib/google-agy.js.map +0 -1
- package/dist/lib/google-companion-credentials.d.ts.map +0 -1
- package/dist/lib/google-companion-credentials.js.map +0 -1
- package/dist/lib/google-gemini-cli-companion.d.ts.map +0 -1
- package/dist/lib/google-gemini-cli-companion.js.map +0 -1
- package/dist/lib/google-gemini-cli.d.ts.map +0 -1
- package/dist/lib/google-gemini-cli.js.map +0 -1
- package/dist/lib/google-token-cache.d.ts.map +0 -1
- package/dist/lib/google-token-cache.js.map +0 -1
- package/dist/lib/grouped-entry-normalization.d.ts.map +0 -1
- package/dist/lib/grouped-entry-normalization.js.map +0 -1
- package/dist/lib/grouped-header-format.d.ts.map +0 -1
- package/dist/lib/grouped-header-format.js.map +0 -1
- package/dist/lib/gui-config-target.d.ts.map +0 -1
- package/dist/lib/gui-config-target.js.map +0 -1
- package/dist/lib/home-dir-display.d.ts.map +0 -1
- package/dist/lib/home-dir-display.js.map +0 -1
- package/dist/lib/http.d.ts.map +0 -1
- package/dist/lib/http.js.map +0 -1
- package/dist/lib/init-installer.d.ts.map +0 -1
- package/dist/lib/init-installer.js.map +0 -1
- package/dist/lib/jsonc.d.ts.map +0 -1
- package/dist/lib/jsonc.js.map +0 -1
- package/dist/lib/kilo-config.d.ts.map +0 -1
- package/dist/lib/kilo-config.js.map +0 -1
- package/dist/lib/kilo.d.ts.map +0 -1
- package/dist/lib/kilo.js.map +0 -1
- package/dist/lib/kimi-auth.d.ts.map +0 -1
- package/dist/lib/kimi-auth.js.map +0 -1
- package/dist/lib/kimi-endpoints.d.ts.map +0 -1
- package/dist/lib/kimi-endpoints.js.map +0 -1
- package/dist/lib/kimi.d.ts.map +0 -1
- package/dist/lib/kimi.js.map +0 -1
- package/dist/lib/maintainer-announcements.d.ts.map +0 -1
- package/dist/lib/maintainer-announcements.js.map +0 -1
- package/dist/lib/map-with-concurrency.d.ts.map +0 -1
- package/dist/lib/map-with-concurrency.js.map +0 -1
- package/dist/lib/markdown-table.d.ts.map +0 -1
- package/dist/lib/markdown-table.js.map +0 -1
- package/dist/lib/mimo-config.d.ts.map +0 -1
- package/dist/lib/mimo-config.js.map +0 -1
- package/dist/lib/mimo.d.ts.map +0 -1
- package/dist/lib/mimo.js.map +0 -1
- package/dist/lib/minimax-auth.d.ts.map +0 -1
- package/dist/lib/minimax-auth.js.map +0 -1
- package/dist/lib/minimax-endpoints.d.ts.map +0 -1
- package/dist/lib/minimax-endpoints.js.map +0 -1
- package/dist/lib/modelsdev-pricing.d.ts.map +0 -1
- package/dist/lib/modelsdev-pricing.js.map +0 -1
- package/dist/lib/nanogpt-config.d.ts.map +0 -1
- package/dist/lib/nanogpt-config.js.map +0 -1
- package/dist/lib/nanogpt.d.ts.map +0 -1
- package/dist/lib/nanogpt.js.map +0 -1
- package/dist/lib/ollama-cloud-config.d.ts.map +0 -1
- package/dist/lib/ollama-cloud-config.js.map +0 -1
- package/dist/lib/ollama-cloud.d.ts.map +0 -1
- package/dist/lib/ollama-cloud.js.map +0 -1
- package/dist/lib/openai.d.ts.map +0 -1
- package/dist/lib/openai.js.map +0 -1
- package/dist/lib/opencode-auth-sqlite.d.ts.map +0 -1
- package/dist/lib/opencode-auth-sqlite.js.map +0 -1
- package/dist/lib/opencode-auth.d.ts.map +0 -1
- package/dist/lib/opencode-auth.js.map +0 -1
- package/dist/lib/opencode-config-editor.d.ts.map +0 -1
- package/dist/lib/opencode-config-editor.js.map +0 -1
- package/dist/lib/opencode-config-providers.d.ts.map +0 -1
- package/dist/lib/opencode-config-providers.js.map +0 -1
- package/dist/lib/opencode-config-read.d.ts.map +0 -1
- package/dist/lib/opencode-config-read.js.map +0 -1
- package/dist/lib/opencode-console-auth.d.ts.map +0 -1
- package/dist/lib/opencode-console-auth.js.map +0 -1
- package/dist/lib/opencode-db-path.d.ts.map +0 -1
- package/dist/lib/opencode-db-path.js.map +0 -1
- package/dist/lib/opencode-go-auth.d.ts.map +0 -1
- package/dist/lib/opencode-go-auth.js.map +0 -1
- package/dist/lib/opencode-go.d.ts.map +0 -1
- package/dist/lib/opencode-go.js.map +0 -1
- package/dist/lib/opencode-runtime-paths.d.ts.map +0 -1
- package/dist/lib/opencode-runtime-paths.js.map +0 -1
- package/dist/lib/opencode-sqlite.d.ts.map +0 -1
- package/dist/lib/opencode-sqlite.js.map +0 -1
- package/dist/lib/opencode-storage.d.ts.map +0 -1
- package/dist/lib/opencode-storage.js.map +0 -1
- package/dist/lib/opencode-version.d.ts.map +0 -1
- package/dist/lib/opencode-version.js.map +0 -1
- package/dist/lib/opencode-zen.d.ts.map +0 -1
- package/dist/lib/opencode-zen.js.map +0 -1
- package/dist/lib/openrouter.d.ts.map +0 -1
- package/dist/lib/openrouter.js.map +0 -1
- package/dist/lib/private-state-paths.d.ts.map +0 -1
- package/dist/lib/private-state-paths.js.map +0 -1
- package/dist/lib/provider-add-command.d.ts.map +0 -1
- package/dist/lib/provider-add-command.js.map +0 -1
- package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +0 -1
- package/dist/lib/provider-add-json-v1-questionnaire.js.map +0 -1
- package/dist/lib/provider-add.d.ts.map +0 -1
- package/dist/lib/provider-add.js.map +0 -1
- package/dist/lib/provider-availability.d.ts.map +0 -1
- package/dist/lib/provider-availability.js.map +0 -1
- package/dist/lib/provider-metadata.d.ts.map +0 -1
- package/dist/lib/provider-metadata.js.map +0 -1
- package/dist/lib/provider-model-matching.d.ts.map +0 -1
- package/dist/lib/provider-model-matching.js.map +0 -1
- package/dist/lib/provider-registration.d.ts.map +0 -1
- package/dist/lib/provider-registration.js.map +0 -1
- package/dist/lib/quota-accounting-projection.d.ts.map +0 -1
- package/dist/lib/quota-accounting-projection.js.map +0 -1
- package/dist/lib/quota-columns.d.ts.map +0 -1
- package/dist/lib/quota-columns.js.map +0 -1
- package/dist/lib/quota-command-format.d.ts.map +0 -1
- package/dist/lib/quota-command-format.js.map +0 -1
- package/dist/lib/quota-dialog-command-specs.d.ts.map +0 -1
- package/dist/lib/quota-dialog-command-specs.js.map +0 -1
- package/dist/lib/quota-dialog-commands.d.ts.map +0 -1
- package/dist/lib/quota-dialog-commands.js.map +0 -1
- package/dist/lib/quota-entry-display.d.ts.map +0 -1
- package/dist/lib/quota-entry-display.js.map +0 -1
- package/dist/lib/quota-exhaustion-projection.d.ts.map +0 -1
- package/dist/lib/quota-exhaustion-projection.js.map +0 -1
- package/dist/lib/quota-export-types.d.ts.map +0 -1
- package/dist/lib/quota-export-types.js.map +0 -1
- package/dist/lib/quota-export.d.ts.map +0 -1
- package/dist/lib/quota-export.js.map +0 -1
- package/dist/lib/quota-format-style.d.ts.map +0 -1
- package/dist/lib/quota-format-style.js.map +0 -1
- package/dist/lib/quota-providers-local.d.ts.map +0 -1
- package/dist/lib/quota-providers-local.js.map +0 -1
- package/dist/lib/quota-providers-remote.d.ts.map +0 -1
- package/dist/lib/quota-providers-remote.js.map +0 -1
- package/dist/lib/quota-providers.d.ts.map +0 -1
- package/dist/lib/quota-providers.js.map +0 -1
- package/dist/lib/quota-render-data.d.ts.map +0 -1
- package/dist/lib/quota-render-data.js.map +0 -1
- package/dist/lib/quota-report-message.d.ts.map +0 -1
- package/dist/lib/quota-report-message.js.map +0 -1
- package/dist/lib/quota-reset-notifications.d.ts.map +0 -1
- package/dist/lib/quota-reset-notifications.js.map +0 -1
- package/dist/lib/quota-retry-wait.d.ts.map +0 -1
- package/dist/lib/quota-retry-wait.js.map +0 -1
- package/dist/lib/quota-runtime-context.d.ts.map +0 -1
- package/dist/lib/quota-runtime-context.js.map +0 -1
- package/dist/lib/quota-state-codec.d.ts.map +0 -1
- package/dist/lib/quota-state-codec.js.map +0 -1
- package/dist/lib/quota-state.d.ts.map +0 -1
- package/dist/lib/quota-state.js.map +0 -1
- package/dist/lib/quota-stats-format.d.ts.map +0 -1
- package/dist/lib/quota-stats-format.js.map +0 -1
- package/dist/lib/quota-stats.d.ts.map +0 -1
- package/dist/lib/quota-stats.js.map +0 -1
- package/dist/lib/quota-status.d.ts.map +0 -1
- package/dist/lib/quota-status.js.map +0 -1
- package/dist/lib/quota-surface-data.d.ts.map +0 -1
- package/dist/lib/quota-surface-data.js.map +0 -1
- package/dist/lib/quota-telemetry.d.ts.map +0 -1
- package/dist/lib/quota-telemetry.js.map +0 -1
- package/dist/lib/report-document.d.ts.map +0 -1
- package/dist/lib/report-document.js.map +0 -1
- package/dist/lib/resolved-auth-identity.d.ts.map +0 -1
- package/dist/lib/resolved-auth-identity.js.map +0 -1
- package/dist/lib/runtime-provider-ids.d.ts.map +0 -1
- package/dist/lib/runtime-provider-ids.js.map +0 -1
- package/dist/lib/scoped-query-chunks.d.ts.map +0 -1
- package/dist/lib/scoped-query-chunks.js.map +0 -1
- package/dist/lib/scoped-update-migration.d.ts.map +0 -1
- package/dist/lib/scoped-update-migration.js.map +0 -1
- package/dist/lib/scoped-update.d.ts.map +0 -1
- package/dist/lib/scoped-update.js.map +0 -1
- package/dist/lib/session-tokens-format.d.ts.map +0 -1
- package/dist/lib/session-tokens-format.js.map +0 -1
- package/dist/lib/session-tokens.d.ts.map +0 -1
- package/dist/lib/session-tokens.js.map +0 -1
- package/dist/lib/synthetic-config.d.ts.map +0 -1
- package/dist/lib/synthetic-config.js.map +0 -1
- package/dist/lib/synthetic.d.ts.map +0 -1
- package/dist/lib/synthetic.js.map +0 -1
- package/dist/lib/toast-format-grouped.d.ts.map +0 -1
- package/dist/lib/toast-format-grouped.js.map +0 -1
- package/dist/lib/token-buckets.d.ts.map +0 -1
- package/dist/lib/token-buckets.js.map +0 -1
- package/dist/lib/token-cost.d.ts.map +0 -1
- package/dist/lib/token-cost.js.map +0 -1
- package/dist/lib/tui-compact-format.d.ts.map +0 -1
- package/dist/lib/tui-compact-format.js.map +0 -1
- package/dist/lib/tui-panel-state.d.ts.map +0 -1
- package/dist/lib/tui-panel-state.js.map +0 -1
- package/dist/lib/tui-prompt-bar-format.d.ts.map +0 -1
- package/dist/lib/tui-prompt-bar-format.js.map +0 -1
- package/dist/lib/tui-sidebar-format.d.ts.map +0 -1
- package/dist/lib/tui-sidebar-format.js.map +0 -1
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage-ownership.d.ts.map +0 -1
- package/dist/lib/usage-ownership.js.map +0 -1
- package/dist/lib/version.d.ts.map +0 -1
- package/dist/lib/version.js.map +0 -1
- package/dist/lib/xai.d.ts.map +0 -1
- package/dist/lib/xai.js.map +0 -1
- package/dist/lib/zai-auth.d.ts.map +0 -1
- package/dist/lib/zai-auth.js.map +0 -1
- package/dist/lib/zai.d.ts.map +0 -1
- package/dist/lib/zai.js.map +0 -1
- package/dist/lib/zhipu-auth.d.ts.map +0 -1
- package/dist/lib/zhipu-auth.js.map +0 -1
- package/dist/lib/zhipu.d.ts.map +0 -1
- package/dist/lib/zhipu.js.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js.map +0 -1
- package/dist/providers/accounting-decimal.d.ts.map +0 -1
- package/dist/providers/accounting-decimal.js.map +0 -1
- package/dist/providers/alibaba-coding-plan.d.ts.map +0 -1
- package/dist/providers/alibaba-coding-plan.js.map +0 -1
- package/dist/providers/alibaba-token-plan.d.ts.map +0 -1
- package/dist/providers/alibaba-token-plan.js.map +0 -1
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/cache-policies.d.ts.map +0 -1
- package/dist/providers/cache-policies.js.map +0 -1
- package/dist/providers/chutes.d.ts.map +0 -1
- package/dist/providers/chutes.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/cursor.d.ts.map +0 -1
- package/dist/providers/cursor.js.map +0 -1
- package/dist/providers/deepseek.d.ts.map +0 -1
- package/dist/providers/deepseek.js.map +0 -1
- package/dist/providers/glm-coding-plan-provider.d.ts.map +0 -1
- package/dist/providers/glm-coding-plan-provider.js.map +0 -1
- package/dist/providers/google-account-format.d.ts.map +0 -1
- package/dist/providers/google-account-format.js.map +0 -1
- package/dist/providers/google-agy.d.ts.map +0 -1
- package/dist/providers/google-agy.js.map +0 -1
- package/dist/providers/google-gemini-cli.d.ts.map +0 -1
- package/dist/providers/google-gemini-cli.js.map +0 -1
- package/dist/providers/kilo.d.ts.map +0 -1
- package/dist/providers/kilo.js.map +0 -1
- package/dist/providers/kimi-code.d.ts.map +0 -1
- package/dist/providers/kimi-code.js.map +0 -1
- package/dist/providers/mimo.d.ts.map +0 -1
- package/dist/providers/mimo.js.map +0 -1
- package/dist/providers/minimax-coding-plan.d.ts.map +0 -1
- package/dist/providers/minimax-coding-plan.js.map +0 -1
- package/dist/providers/nanogpt.d.ts.map +0 -1
- package/dist/providers/nanogpt.js.map +0 -1
- package/dist/providers/ollama-cloud.d.ts.map +0 -1
- package/dist/providers/ollama-cloud.js.map +0 -1
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/opencode-go.d.ts.map +0 -1
- package/dist/providers/opencode-go.js.map +0 -1
- package/dist/providers/opencode-zen.d.ts.map +0 -1
- package/dist/providers/opencode-zen.js.map +0 -1
- package/dist/providers/openrouter.d.ts.map +0 -1
- package/dist/providers/openrouter.js.map +0 -1
- package/dist/providers/quota-providers.d.ts.map +0 -1
- package/dist/providers/quota-providers.js.map +0 -1
- package/dist/providers/registry.d.ts.map +0 -1
- package/dist/providers/registry.js.map +0 -1
- package/dist/providers/result-helpers.d.ts.map +0 -1
- package/dist/providers/result-helpers.js.map +0 -1
- package/dist/providers/synthetic.d.ts.map +0 -1
- package/dist/providers/synthetic.js.map +0 -1
- package/dist/providers/xai.d.ts.map +0 -1
- package/dist/providers/xai.js.map +0 -1
- package/dist/providers/zai.d.ts.map +0 -1
- package/dist/providers/zai.js.map +0 -1
- package/dist/providers/zhipu.d.ts.map +0 -1
- package/dist/providers/zhipu.js.map +0 -1
- package/dist/rpc.d.ts.map +0 -1
- package/dist/rpc.js.map +0 -1
- package/dist/ui/assets/index-CjNjqsse.js +0 -8
package/dist/gui/aggregation.js
CHANGED
|
@@ -159,6 +159,9 @@ function addRawStep(accumulator, row, pricingCache) {
|
|
|
159
159
|
providerID: row.providerID,
|
|
160
160
|
modelID: row.modelID,
|
|
161
161
|
tokens,
|
|
162
|
+
// A completed physical row is priced at its own assistant completion
|
|
163
|
+
// instant; never infer a timestamp from a range boundary or wall clock.
|
|
164
|
+
atMs: row.completedAtMs,
|
|
162
165
|
cache: pricingCache,
|
|
163
166
|
});
|
|
164
167
|
if (outcome.status === "partial") {
|
|
@@ -17,6 +17,7 @@ import { compareOpenCodeSourceIdentity, rawAssistantRowHasTokenUsage, } from "..
|
|
|
17
17
|
import { createUsageAnalytics, UNKNOWN_PROJECT_ID } from "./aggregation.js";
|
|
18
18
|
import { createAnalyticsIndexes } from "./analytics-indexes.js";
|
|
19
19
|
import { createAnalyticsModel } from "./analytics-model.js";
|
|
20
|
+
import { getAnalyticsPricingFingerprint } from "./analytics-pricing-revision.js";
|
|
20
21
|
import { createAnalyticsReader } from "./analytics-reader.js";
|
|
21
22
|
import { ANALYTICS_PRESENTATION_SESSION_LIMIT, compactFingerprintOf, defaultAnalyticsPresentationPath, defaultAnalyticsSnapshotPath, fingerprintOf, loadAnalyticsPresentation, loadAnalyticsSnapshot, rowFromFingerprint, saveAnalyticsPresentation, saveAnalyticsSnapshot, } from "./analytics-state.js";
|
|
22
23
|
import { resolveHostTimeZone } from "./time-zone.js";
|
|
@@ -239,6 +240,8 @@ export function createAnalyticsEngine(options = {}) {
|
|
|
239
240
|
let closePromise;
|
|
240
241
|
let modelHydrated = false;
|
|
241
242
|
let modelDirty = true;
|
|
243
|
+
/** Exact combined pricing fingerprint the model and derived DTOs were built from. */
|
|
244
|
+
let pricingRevision = getAnalyticsPricingFingerprint();
|
|
242
245
|
let lastPresentationSaveAtMs = 0;
|
|
243
246
|
let presentationSavedAtMs = 0;
|
|
244
247
|
let generation = 0;
|
|
@@ -968,6 +971,28 @@ export function createAnalyticsEngine(options = {}) {
|
|
|
968
971
|
function invalidateGroupSnapshots() {
|
|
969
972
|
groupCache.clear();
|
|
970
973
|
}
|
|
974
|
+
/**
|
|
975
|
+
* Cached Home/Project/Session/group DTOs contain derived costs. If the
|
|
976
|
+
* combined pricing/temporal fingerprint changes, those DTOs and the hydrated
|
|
977
|
+
* model no longer certify the rates that produced them, so rebuild them
|
|
978
|
+
* instead of serving stale prices.
|
|
979
|
+
*/
|
|
980
|
+
function ensurePricingRevision() {
|
|
981
|
+
const current = getAnalyticsPricingFingerprint();
|
|
982
|
+
if (current === pricingRevision)
|
|
983
|
+
return;
|
|
984
|
+
pricingRevision = current;
|
|
985
|
+
state.presentation = undefined;
|
|
986
|
+
warmPresentation = undefined;
|
|
987
|
+
warmSourceIdentity = undefined;
|
|
988
|
+
warmIdentityVerification = undefined;
|
|
989
|
+
warmIdentityVerifiedGeneration = -1;
|
|
990
|
+
sidecarNewerThanIndex = false;
|
|
991
|
+
lastPresentationSaveAtMs = 0;
|
|
992
|
+
modelHydrated = false;
|
|
993
|
+
modelDirty = true;
|
|
994
|
+
invalidateGroupSnapshots();
|
|
995
|
+
}
|
|
971
996
|
/**
|
|
972
997
|
* Once 30d is indexed, derive the three bounded Home DTOs together while the
|
|
973
998
|
* model is already hydrated. Missing entries are filled; this never triggers
|
|
@@ -2227,6 +2252,7 @@ export function createAnalyticsEngine(options = {}) {
|
|
|
2227
2252
|
if (closed)
|
|
2228
2253
|
throw new Error("analytics closed");
|
|
2229
2254
|
await ensureLoaded();
|
|
2255
|
+
ensurePricingRevision();
|
|
2230
2256
|
const atMs = now();
|
|
2231
2257
|
const window = rangeWindow(range, atMs);
|
|
2232
2258
|
lastGlobalRange.value = widerRange(lastGlobalRange.value, range);
|
|
@@ -2285,6 +2311,7 @@ export function createAnalyticsEngine(options = {}) {
|
|
|
2285
2311
|
if (closed)
|
|
2286
2312
|
throw new Error("analytics closed");
|
|
2287
2313
|
await ensureLoaded();
|
|
2314
|
+
ensurePricingRevision();
|
|
2288
2315
|
const { range } = query;
|
|
2289
2316
|
const atMs = now();
|
|
2290
2317
|
const window = rangeWindow(range, atMs);
|
|
@@ -2375,6 +2402,7 @@ export function createAnalyticsEngine(options = {}) {
|
|
|
2375
2402
|
if (!projectId)
|
|
2376
2403
|
throw new AnalyticsLookupError("bad-request");
|
|
2377
2404
|
await ensureLoaded();
|
|
2405
|
+
ensurePricingRevision();
|
|
2378
2406
|
const atMs = now();
|
|
2379
2407
|
lastProjectScopes.set(projectId, widerRange(lastProjectScopes.get(projectId), range));
|
|
2380
2408
|
const cached = cachedProject(projectId, range);
|
|
@@ -2444,6 +2472,7 @@ export function createAnalyticsEngine(options = {}) {
|
|
|
2444
2472
|
if (!sessionId)
|
|
2445
2473
|
throw new AnalyticsLookupError("bad-request");
|
|
2446
2474
|
await ensureLoaded();
|
|
2475
|
+
ensurePricingRevision();
|
|
2447
2476
|
lastDetailSessionIds.add(sessionId);
|
|
2448
2477
|
trimSet(lastDetailSessionIds, MAX_SCOPE_BATCH * 4);
|
|
2449
2478
|
const cached = cachedSession(sessionId);
|
|
@@ -2484,6 +2513,7 @@ export function createAnalyticsEngine(options = {}) {
|
|
|
2484
2513
|
if (closed)
|
|
2485
2514
|
throw new Error("analytics closed");
|
|
2486
2515
|
await ensureIndexLoaded();
|
|
2516
|
+
ensurePricingRevision();
|
|
2487
2517
|
const atMs = now();
|
|
2488
2518
|
const hasInterests = lastGlobalRange.value !== undefined ||
|
|
2489
2519
|
lastDetailSessionIds.size > 0 ||
|
|
@@ -10,11 +10,14 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { sumTokenStack } from "../contracts/guards.js";
|
|
12
12
|
import { planRangeBuckets, rangeBucketUnit, rangeWindow, } from "../contracts/ranges.js";
|
|
13
|
+
import { lookupCost, selectCostAtContext } from "../lib/modelsdev-pricing.js";
|
|
14
|
+
import { getTemporalPolicy, resolveTemporalRates, TEMPORAL_RATE_KEYS, } from "../lib/modelsdev-temporal.js";
|
|
13
15
|
import { rawAssistantRowFingerprint, rawAssistantRowHasTokenUsage, } from "../lib/opencode-storage.js";
|
|
14
|
-
import { priceTokenBuckets } from "../lib/quota-stats.js";
|
|
16
|
+
import { priceTokenBuckets, resolvePricingKey, } from "../lib/quota-stats.js";
|
|
15
17
|
import { selectForkOwners } from "../lib/usage-ownership.js";
|
|
16
18
|
import { UNKNOWN_PROJECT_ID, UNTITLED_SESSION_TITLE } from "./aggregation.js";
|
|
17
19
|
const HOUR_MS = 3_600_000;
|
|
20
|
+
const TEMPORAL_FACTOR_EPSILON = 1e-9;
|
|
18
21
|
function createAccumulator() {
|
|
19
22
|
return {
|
|
20
23
|
input: 0,
|
|
@@ -322,6 +325,9 @@ export function createAnalyticsModel(options = {}) {
|
|
|
322
325
|
cache_read: row.tokens.cacheRead,
|
|
323
326
|
cache_write: row.tokens.cacheWrite,
|
|
324
327
|
},
|
|
328
|
+
// Historical temporal pricing follows the physical assistant completion
|
|
329
|
+
// instant, not the enclosing range window or the worker's wall clock.
|
|
330
|
+
atMs: row.completedAtMs,
|
|
325
331
|
cache: pricingCache,
|
|
326
332
|
});
|
|
327
333
|
if (outcome.status === "partial") {
|
|
@@ -340,6 +346,147 @@ export function createAnalyticsModel(options = {}) {
|
|
|
340
346
|
}
|
|
341
347
|
return { costUsd: 0, pricedAny: false, unpricedTokens: 0, unknownTokens: total };
|
|
342
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* Relative movement of one effective monetary rate state against the route's
|
|
351
|
+
* selected base. Partial override rates are compared field by field; a state
|
|
352
|
+
* that moves categories in opposite directions is mixed and unusable.
|
|
353
|
+
*/
|
|
354
|
+
function rateMovement(base, resolved) {
|
|
355
|
+
let comparable = false;
|
|
356
|
+
let sawIncrease = false;
|
|
357
|
+
let sawDecrease = false;
|
|
358
|
+
for (const key of TEMPORAL_RATE_KEYS) {
|
|
359
|
+
const baseRate = base[key];
|
|
360
|
+
const resolvedRate = resolved[key];
|
|
361
|
+
if (typeof baseRate !== "number" ||
|
|
362
|
+
baseRate <= 0 ||
|
|
363
|
+
typeof resolvedRate !== "number" ||
|
|
364
|
+
!Number.isFinite(resolvedRate)) {
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
comparable = true;
|
|
368
|
+
if (resolvedRate > baseRate * (1 + TEMPORAL_FACTOR_EPSILON))
|
|
369
|
+
sawIncrease = true;
|
|
370
|
+
else if (resolvedRate < baseRate * (1 - TEMPORAL_FACTOR_EPSILON))
|
|
371
|
+
sawDecrease = true;
|
|
372
|
+
}
|
|
373
|
+
if (!comparable)
|
|
374
|
+
return "incomparable";
|
|
375
|
+
if (sawIncrease && sawDecrease)
|
|
376
|
+
return "mixed";
|
|
377
|
+
if (sawIncrease)
|
|
378
|
+
return "increase";
|
|
379
|
+
if (sawDecrease)
|
|
380
|
+
return "decrease";
|
|
381
|
+
return "equal";
|
|
382
|
+
}
|
|
383
|
+
function multiplierMovement(factor) {
|
|
384
|
+
const value = typeof factor === "number" ? factor : factor.text;
|
|
385
|
+
if (!Number.isFinite(value))
|
|
386
|
+
return "incomparable";
|
|
387
|
+
if (value > 1 + TEMPORAL_FACTOR_EPSILON)
|
|
388
|
+
return "increase";
|
|
389
|
+
if (value < 1 - TEMPORAL_FACTOR_EPSILON)
|
|
390
|
+
return "decrease";
|
|
391
|
+
return "equal";
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Direction of every admissible rule in the exact route's policy. A policy
|
|
395
|
+
* that only discounts has a peak base state; one that only surcharges has an
|
|
396
|
+
* off-peak base state. Mixed or equal-only rules cannot establish which side
|
|
397
|
+
* of the schedule the unchanged base belongs to, so they fail closed.
|
|
398
|
+
*/
|
|
399
|
+
function temporalPolicyDirection(policy, base) {
|
|
400
|
+
let discount = false;
|
|
401
|
+
let surcharge = false;
|
|
402
|
+
for (const override of policy.overrides) {
|
|
403
|
+
const movement = rateMovement(base, override.rates);
|
|
404
|
+
if (movement === "mixed")
|
|
405
|
+
return "mixed";
|
|
406
|
+
if (movement === "increase")
|
|
407
|
+
surcharge = true;
|
|
408
|
+
else if (movement === "decrease")
|
|
409
|
+
discount = true;
|
|
410
|
+
}
|
|
411
|
+
for (const multiplier of policy.multipliers) {
|
|
412
|
+
const movement = multiplierMovement(multiplier.factor);
|
|
413
|
+
if (movement === "increase")
|
|
414
|
+
surcharge = true;
|
|
415
|
+
else if (movement === "decrease")
|
|
416
|
+
discount = true;
|
|
417
|
+
}
|
|
418
|
+
if (discount && surcharge)
|
|
419
|
+
return "mixed";
|
|
420
|
+
if (discount)
|
|
421
|
+
return "discount";
|
|
422
|
+
if (surcharge)
|
|
423
|
+
return "surcharge";
|
|
424
|
+
return "equal";
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* One historical phase relative to the policy's full set of admissible
|
|
428
|
+
* periods. A discount policy keeps its unchanged base on peak; a surcharge
|
|
429
|
+
* policy keeps its unchanged base on off-peak. Unknown, mixed, equal-only or
|
|
430
|
+
* internally contradictory states are omitted instead of defaulted.
|
|
431
|
+
*/
|
|
432
|
+
function temporalPhaseFromRates(policy, base, resolved) {
|
|
433
|
+
const direction = temporalPolicyDirection(policy, base);
|
|
434
|
+
if (direction === "mixed" || direction === "equal")
|
|
435
|
+
return undefined;
|
|
436
|
+
const movement = rateMovement(base, resolved);
|
|
437
|
+
if (movement === "mixed" || movement === "incomparable")
|
|
438
|
+
return undefined;
|
|
439
|
+
if (direction === "discount") {
|
|
440
|
+
if (movement === "decrease")
|
|
441
|
+
return "offpeak";
|
|
442
|
+
if (movement === "equal")
|
|
443
|
+
return "peak";
|
|
444
|
+
return undefined;
|
|
445
|
+
}
|
|
446
|
+
if (movement === "increase")
|
|
447
|
+
return "peak";
|
|
448
|
+
if (movement === "equal")
|
|
449
|
+
return "offpeak";
|
|
450
|
+
return undefined;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Historical phase for one owned physical row. Only an exact source
|
|
454
|
+
* provider/model route with a supported monetary policy in the modelsdev
|
|
455
|
+
* temporal snapshot is admitted. Non-monetary quota schedules live in a
|
|
456
|
+
* separate data source and therefore never appear here; an exact monetary
|
|
457
|
+
* policy is admitted regardless of provider name.
|
|
458
|
+
*/
|
|
459
|
+
function temporalPhaseForStep(step) {
|
|
460
|
+
if (step.providerID === undefined || step.modelID === undefined)
|
|
461
|
+
return undefined;
|
|
462
|
+
const provider = step.providerID.trim();
|
|
463
|
+
const model = step.modelID.trim();
|
|
464
|
+
if (!provider || !model)
|
|
465
|
+
return undefined;
|
|
466
|
+
const resolution = resolvePricingKey({
|
|
467
|
+
providerID: step.providerID,
|
|
468
|
+
modelID: step.modelID,
|
|
469
|
+
});
|
|
470
|
+
if (!resolution.ok)
|
|
471
|
+
return undefined;
|
|
472
|
+
const key = resolution.key;
|
|
473
|
+
if (provider.toLowerCase() !== key.provider.toLowerCase())
|
|
474
|
+
return undefined;
|
|
475
|
+
if (model !== key.model)
|
|
476
|
+
return undefined;
|
|
477
|
+
const policy = getTemporalPolicy(key.provider, key.model);
|
|
478
|
+
if (policy === null || policy.status !== "supported")
|
|
479
|
+
return undefined;
|
|
480
|
+
const promptTokens = step.tokens.input + step.tokens.cacheRead + step.tokens.cacheWrite;
|
|
481
|
+
const cost = lookupCost(key.provider, key.model);
|
|
482
|
+
if (cost === null)
|
|
483
|
+
return undefined;
|
|
484
|
+
const base = selectCostAtContext(cost, promptTokens).rates;
|
|
485
|
+
const resolved = resolveTemporalRates(key.provider, key.model, step.completedAtMs, base);
|
|
486
|
+
if (resolved.status !== "resolved" || resolved.rates === null)
|
|
487
|
+
return undefined;
|
|
488
|
+
return temporalPhaseFromRates(policy, base, resolved.rates);
|
|
489
|
+
}
|
|
343
490
|
function bucketFor(startMs) {
|
|
344
491
|
let bucket = hours.get(startMs);
|
|
345
492
|
if (!bucket) {
|
|
@@ -852,6 +999,10 @@ export function createAnalyticsModel(options = {}) {
|
|
|
852
999
|
const parentGroups = new Map();
|
|
853
1000
|
const childDimension = oppositeDimension(dimension);
|
|
854
1001
|
const lifetime = range === "lifetime";
|
|
1002
|
+
const wantsTemporalBreakdown = dimension === "provider" && filter?.dimension === "model" && filter.identity.kind === "known";
|
|
1003
|
+
const temporalPhases = wantsTemporalBreakdown
|
|
1004
|
+
? new Map()
|
|
1005
|
+
: undefined;
|
|
855
1006
|
let stepCount = 0;
|
|
856
1007
|
let earliestMatchedMs;
|
|
857
1008
|
eachOwnedStep((step) => {
|
|
@@ -877,6 +1028,17 @@ export function createAnalyticsModel(options = {}) {
|
|
|
877
1028
|
parent.children.set(childRaw, child);
|
|
878
1029
|
}
|
|
879
1030
|
addStepToGroupNode(child, step);
|
|
1031
|
+
if (temporalPhases !== undefined) {
|
|
1032
|
+
const phase = temporalPhaseForStep(step);
|
|
1033
|
+
if (phase !== undefined) {
|
|
1034
|
+
let phases = temporalPhases.get(parentRaw);
|
|
1035
|
+
if (!phases) {
|
|
1036
|
+
phases = { peak: createAccumulator(), offpeak: createAccumulator() };
|
|
1037
|
+
temporalPhases.set(parentRaw, phases);
|
|
1038
|
+
}
|
|
1039
|
+
addStepToAccumulator(phases[phase], step);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
880
1042
|
});
|
|
881
1043
|
// Lifetime buckets start at the exact first positive owned step for this
|
|
882
1044
|
// query filter — never session metadata, and never an older unrelated
|
|
@@ -890,6 +1052,22 @@ export function createAnalyticsModel(options = {}) {
|
|
|
890
1052
|
.map(([raw, node]) => ({ raw, node }))
|
|
891
1053
|
.sort(compareGroupEntries);
|
|
892
1054
|
const rows = ranked.map((entry) => materializeGroupRow(entry.raw, entry.node));
|
|
1055
|
+
let temporalBreakdown;
|
|
1056
|
+
if (temporalPhases !== undefined) {
|
|
1057
|
+
const breakdownRows = [];
|
|
1058
|
+
for (const entry of ranked) {
|
|
1059
|
+
const phases = temporalPhases.get(entry.raw);
|
|
1060
|
+
if (phases === undefined)
|
|
1061
|
+
continue;
|
|
1062
|
+
breakdownRows.push({
|
|
1063
|
+
identity: identityOf(entry.raw),
|
|
1064
|
+
peak: finalize(phases.peak),
|
|
1065
|
+
offpeak: finalize(phases.offpeak),
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
if (breakdownRows.length > 0)
|
|
1069
|
+
temporalBreakdown = { rows: breakdownRows };
|
|
1070
|
+
}
|
|
893
1071
|
const topEntries = ranked.slice(0, 5);
|
|
894
1072
|
const otherEntries = ranked.slice(5);
|
|
895
1073
|
const topBucketTotals = topEntries.map(() => new Map());
|
|
@@ -969,6 +1147,8 @@ export function createAnalyticsModel(options = {}) {
|
|
|
969
1147
|
};
|
|
970
1148
|
if (filter !== undefined)
|
|
971
1149
|
snapshot.filter = filter;
|
|
1150
|
+
if (temporalBreakdown !== undefined)
|
|
1151
|
+
snapshot.temporalBreakdown = temporalBreakdown;
|
|
972
1152
|
return snapshot;
|
|
973
1153
|
}
|
|
974
1154
|
function buildUsage(range, nowMs, options = {}, earliestMs = earliestActivity()) {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fingerprint format version. Bump whenever the covered inputs or their
|
|
3
|
+
* canonical encoding change, so derived presentation caches are rebuilt.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ANALYTICS_PRICING_FINGERPRINT_SCHEMA = 1;
|
|
6
|
+
/** Stable v1 models.dev pricing snapshot schema this fingerprint understands. */
|
|
7
|
+
export declare const PRICING_SNAPSHOT_SCHEMA_VERSION = 1;
|
|
8
|
+
/** Temporal snapshot schema this fingerprint understands. */
|
|
9
|
+
export declare const TEMPORAL_SNAPSHOT_SCHEMA_VERSION = 1;
|
|
10
|
+
export type AnalyticsPricingFingerprintInput = {
|
|
11
|
+
pricing: {
|
|
12
|
+
schemaVersion: number;
|
|
13
|
+
source: "runtime" | "bundled" | "empty";
|
|
14
|
+
meta: {
|
|
15
|
+
source: string;
|
|
16
|
+
generatedAt: number;
|
|
17
|
+
providers: readonly string[];
|
|
18
|
+
units: string;
|
|
19
|
+
};
|
|
20
|
+
/** Hash of the selected snapshot's actual provider/model rates and tiers. */
|
|
21
|
+
contentFingerprint: string;
|
|
22
|
+
};
|
|
23
|
+
temporal: {
|
|
24
|
+
schemaVersion: number;
|
|
25
|
+
revision: string;
|
|
26
|
+
source: string;
|
|
27
|
+
generatedAt: number;
|
|
28
|
+
validationError: string | null;
|
|
29
|
+
/** Hash of the actual temporal policy values and bundled calendar content. */
|
|
30
|
+
contentFingerprint: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Canonical SHA-256 over both pricing inputs that can change a derived cost:
|
|
35
|
+
* the selected stable v1 pricing snapshot identity/content and the temporal
|
|
36
|
+
* snapshot identity/content/schema.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildAnalyticsPricingFingerprint(identity: AnalyticsPricingFingerprintInput): string;
|
|
39
|
+
/** Current combined pricing fingerprint for derived analytics presentation. */
|
|
40
|
+
export declare function getAnalyticsPricingFingerprint(): string;
|
|
41
|
+
/** Test seam: force the next request to reread snapshot content. */
|
|
42
|
+
export declare function __resetAnalyticsPricingFingerprintCacheForTests(): void;
|
|
43
|
+
//# sourceMappingURL=analytics-pricing-revision.d.ts.map
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFileSync, statSync } from "node:fs";
|
|
3
|
+
import { getPricingSnapshotMeta, getPricingSnapshotSource, listModelsForProvider, listProviders, lookupCost, } from "../lib/modelsdev-pricing.js";
|
|
4
|
+
import { getTemporalPolicy, getTemporalSnapshotMeta, getTemporalSnapshotValidationError, } from "../lib/modelsdev-temporal.js";
|
|
5
|
+
/**
|
|
6
|
+
* Fingerprint format version. Bump whenever the covered inputs or their
|
|
7
|
+
* canonical encoding change, so derived presentation caches are rebuilt.
|
|
8
|
+
*/
|
|
9
|
+
export const ANALYTICS_PRICING_FINGERPRINT_SCHEMA = 1;
|
|
10
|
+
/** Stable v1 models.dev pricing snapshot schema this fingerprint understands. */
|
|
11
|
+
export const PRICING_SNAPSHOT_SCHEMA_VERSION = 1;
|
|
12
|
+
/** Temporal snapshot schema this fingerprint understands. */
|
|
13
|
+
export const TEMPORAL_SNAPSHOT_SCHEMA_VERSION = 1;
|
|
14
|
+
const TEMPORAL_SNAPSHOT_URL = new URL("../data/modelsdev-temporal.min.json", import.meta.url);
|
|
15
|
+
/**
|
|
16
|
+
* Content hashes are keyed by the loaded snapshot's `_meta` object. A reload
|
|
17
|
+
* or selection change installs a new object, so identical metadata values still
|
|
18
|
+
* invalidate while repeated requests reuse the already-computed content hash.
|
|
19
|
+
*/
|
|
20
|
+
let pricingContentCache = new WeakMap();
|
|
21
|
+
let temporalSourceCache;
|
|
22
|
+
function compareIds(a, b) {
|
|
23
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
24
|
+
}
|
|
25
|
+
function sha256(value) {
|
|
26
|
+
return createHash("sha256").update(value).digest("hex");
|
|
27
|
+
}
|
|
28
|
+
/** Stable representation of every monetary field, including context tiers. */
|
|
29
|
+
function canonicalCost(cost) {
|
|
30
|
+
if (!cost)
|
|
31
|
+
return null;
|
|
32
|
+
return [
|
|
33
|
+
cost.input ?? null,
|
|
34
|
+
cost.output ?? null,
|
|
35
|
+
cost.cache_read ?? null,
|
|
36
|
+
cost.cache_write ?? null,
|
|
37
|
+
cost.reasoning ?? null,
|
|
38
|
+
(cost.tiers ?? []).map((tier) => [
|
|
39
|
+
tier.tier.size,
|
|
40
|
+
tier.input ?? null,
|
|
41
|
+
tier.output ?? null,
|
|
42
|
+
tier.cache_read ?? null,
|
|
43
|
+
tier.cache_write ?? null,
|
|
44
|
+
tier.reasoning ?? null,
|
|
45
|
+
]),
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
/** Hash the selected snapshot's actual priced content, not its metadata. */
|
|
49
|
+
function getPricingContentFingerprint(meta, source) {
|
|
50
|
+
let bySource = pricingContentCache.get(meta);
|
|
51
|
+
if (!bySource) {
|
|
52
|
+
bySource = new Map();
|
|
53
|
+
pricingContentCache.set(meta, bySource);
|
|
54
|
+
}
|
|
55
|
+
const cached = bySource.get(source);
|
|
56
|
+
if (cached !== undefined)
|
|
57
|
+
return cached;
|
|
58
|
+
const hash = createHash("sha256");
|
|
59
|
+
for (const providerId of [...listProviders()].sort(compareIds)) {
|
|
60
|
+
for (const modelId of [...listModelsForProvider(providerId)].sort(compareIds)) {
|
|
61
|
+
hash.update(JSON.stringify([providerId, modelId, canonicalCost(lookupCost(providerId, modelId))]));
|
|
62
|
+
hash.update("\n");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const fingerprint = hash.digest("hex");
|
|
66
|
+
bySource.set(source, fingerprint);
|
|
67
|
+
return fingerprint;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Bundled temporal content identity. The file hash covers calendars and any
|
|
71
|
+
* routes this process cannot enumerate from the public runtime API; the route
|
|
72
|
+
* list lets policy-value changes made to the loaded snapshot participate too.
|
|
73
|
+
*/
|
|
74
|
+
function getTemporalSourceIdentity() {
|
|
75
|
+
try {
|
|
76
|
+
const stat = statSync(TEMPORAL_SNAPSHOT_URL);
|
|
77
|
+
const cacheKey = `${stat.mtimeMs}:${stat.size}`;
|
|
78
|
+
if (temporalSourceCache?.cacheKey === cacheKey)
|
|
79
|
+
return temporalSourceCache;
|
|
80
|
+
const text = readFileSync(TEMPORAL_SNAPSHOT_URL, "utf8");
|
|
81
|
+
const raw = JSON.parse(text);
|
|
82
|
+
const routes = [];
|
|
83
|
+
const providers = raw.providers ?? {};
|
|
84
|
+
for (const providerId of Object.keys(providers).sort(compareIds)) {
|
|
85
|
+
const models = providers[providerId];
|
|
86
|
+
if (!models || typeof models !== "object")
|
|
87
|
+
continue;
|
|
88
|
+
for (const modelId of Object.keys(models).sort(compareIds)) {
|
|
89
|
+
routes.push([providerId, modelId]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
temporalSourceCache = { cacheKey, fileFingerprint: sha256(text), routes };
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
temporalSourceCache = { cacheKey: "missing", fileFingerprint: "", routes: [] };
|
|
96
|
+
}
|
|
97
|
+
return temporalSourceCache;
|
|
98
|
+
}
|
|
99
|
+
/** Hash the actual temporal policy values for every canonical bundled route. */
|
|
100
|
+
function getTemporalContentFingerprint() {
|
|
101
|
+
const source = getTemporalSourceIdentity();
|
|
102
|
+
const hash = createHash("sha256");
|
|
103
|
+
hash.update(source.fileFingerprint);
|
|
104
|
+
hash.update("\n");
|
|
105
|
+
for (const [providerId, modelId] of source.routes) {
|
|
106
|
+
hash.update(JSON.stringify([providerId, modelId, getTemporalPolicy(providerId, modelId)]));
|
|
107
|
+
hash.update("\n");
|
|
108
|
+
}
|
|
109
|
+
return hash.digest("hex");
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Canonical SHA-256 over both pricing inputs that can change a derived cost:
|
|
113
|
+
* the selected stable v1 pricing snapshot identity/content and the temporal
|
|
114
|
+
* snapshot identity/content/schema.
|
|
115
|
+
*/
|
|
116
|
+
export function buildAnalyticsPricingFingerprint(identity) {
|
|
117
|
+
const providers = [...identity.pricing.meta.providers].sort(compareIds);
|
|
118
|
+
const payload = JSON.stringify([
|
|
119
|
+
ANALYTICS_PRICING_FINGERPRINT_SCHEMA,
|
|
120
|
+
identity.pricing.schemaVersion,
|
|
121
|
+
identity.pricing.source,
|
|
122
|
+
identity.pricing.meta.source,
|
|
123
|
+
identity.pricing.meta.generatedAt,
|
|
124
|
+
identity.pricing.meta.units,
|
|
125
|
+
providers,
|
|
126
|
+
identity.pricing.contentFingerprint,
|
|
127
|
+
identity.temporal.schemaVersion,
|
|
128
|
+
identity.temporal.revision,
|
|
129
|
+
identity.temporal.source,
|
|
130
|
+
identity.temporal.generatedAt,
|
|
131
|
+
identity.temporal.validationError,
|
|
132
|
+
identity.temporal.contentFingerprint,
|
|
133
|
+
]);
|
|
134
|
+
return sha256(payload);
|
|
135
|
+
}
|
|
136
|
+
/** Current combined pricing fingerprint for derived analytics presentation. */
|
|
137
|
+
export function getAnalyticsPricingFingerprint() {
|
|
138
|
+
const pricingMeta = getPricingSnapshotMeta();
|
|
139
|
+
const pricingSource = getPricingSnapshotSource();
|
|
140
|
+
return buildAnalyticsPricingFingerprint({
|
|
141
|
+
pricing: {
|
|
142
|
+
schemaVersion: PRICING_SNAPSHOT_SCHEMA_VERSION,
|
|
143
|
+
source: pricingSource,
|
|
144
|
+
meta: pricingMeta,
|
|
145
|
+
contentFingerprint: getPricingContentFingerprint(pricingMeta, pricingSource),
|
|
146
|
+
},
|
|
147
|
+
temporal: {
|
|
148
|
+
schemaVersion: TEMPORAL_SNAPSHOT_SCHEMA_VERSION,
|
|
149
|
+
...getTemporalSnapshotMeta(),
|
|
150
|
+
validationError: getTemporalSnapshotValidationError(),
|
|
151
|
+
contentFingerprint: getTemporalContentFingerprint(),
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/** Test seam: force the next request to reread snapshot content. */
|
|
156
|
+
export function __resetAnalyticsPricingFingerprintCacheForTests() {
|
|
157
|
+
pricingContentCache = new WeakMap();
|
|
158
|
+
temporalSourceCache = undefined;
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=analytics-pricing-revision.js.map
|
|
@@ -7,9 +7,10 @@ export declare const ANALYTICS_SNAPSHOT_SCHEMA = "ocq-analytics-state";
|
|
|
7
7
|
* Warm DTO aggregation semantics. This is separate from the compact candidate
|
|
8
8
|
* version because the presentation cache is disposable: a sidecar written
|
|
9
9
|
* under older semantics (for example before zero-token rows were excluded from
|
|
10
|
-
* usage rollups
|
|
10
|
+
* usage rollups, or before exact historical temporal pricing) must be rebuilt,
|
|
11
|
+
* not served as if it were current.
|
|
11
12
|
*/
|
|
12
|
-
export declare const ANALYTICS_PRESENTATION_VERSION =
|
|
13
|
+
export declare const ANALYTICS_PRESENTATION_VERSION = 3;
|
|
13
14
|
export interface AnalyticsCoverage {
|
|
14
15
|
/** Inclusive start; absent means the lifetime read reached the beginning. */
|
|
15
16
|
sinceMs?: number;
|
|
@@ -72,6 +73,8 @@ export interface WarmAnalyticsPresentation extends AnalyticsPresentation {
|
|
|
72
73
|
frontierAtMs?: number;
|
|
73
74
|
/** Coverage captured with these DTOs; legacy sidecars may omit it. */
|
|
74
75
|
coverage?: AnalyticsCoverage;
|
|
76
|
+
/** Combined pricing/temporal fingerprint used to derive these DTOs. */
|
|
77
|
+
pricingRevision?: string;
|
|
75
78
|
}
|
|
76
79
|
export interface AnalyticsState {
|
|
77
80
|
sessions: Record<string, OpenCodeSessionInfo>;
|
|
@@ -168,6 +171,8 @@ interface PersistedPresentationFile {
|
|
|
168
171
|
sinceMs: number | null;
|
|
169
172
|
untilMs: number;
|
|
170
173
|
} | null;
|
|
174
|
+
/** Combined pricing/temporal fingerprint the DTO costs were derived from. */
|
|
175
|
+
pricingRevision: string;
|
|
171
176
|
presentation: {
|
|
172
177
|
home: Partial<Record<RangeKey, HomeSnapshot>>;
|
|
173
178
|
project: Array<[projectId: string, range: RangeKey, snapshot: ProjectSnapshot]>;
|
|
@@ -16,15 +16,17 @@ import { dirname, join } from "node:path";
|
|
|
16
16
|
import { isRangeKey } from "../contracts/ranges.js";
|
|
17
17
|
import { getOpencodeRuntimeDirs } from "../lib/opencode-runtime-paths.js";
|
|
18
18
|
import { rawAssistantRowFingerprint, } from "../lib/opencode-storage.js";
|
|
19
|
+
import { getAnalyticsPricingFingerprint } from "./analytics-pricing-revision.js";
|
|
19
20
|
export const ANALYTICS_SNAPSHOT_VERSION = 3;
|
|
20
21
|
export const ANALYTICS_SNAPSHOT_SCHEMA = "ocq-analytics-state";
|
|
21
22
|
/**
|
|
22
23
|
* Warm DTO aggregation semantics. This is separate from the compact candidate
|
|
23
24
|
* version because the presentation cache is disposable: a sidecar written
|
|
24
25
|
* under older semantics (for example before zero-token rows were excluded from
|
|
25
|
-
* usage rollups
|
|
26
|
+
* usage rollups, or before exact historical temporal pricing) must be rebuilt,
|
|
27
|
+
* not served as if it were current.
|
|
26
28
|
*/
|
|
27
|
-
export const ANALYTICS_PRESENTATION_VERSION =
|
|
29
|
+
export const ANALYTICS_PRESENTATION_VERSION = 3;
|
|
28
30
|
/**
|
|
29
31
|
* In-memory newest session DTOs retained. The serialized sidecar can keep
|
|
30
32
|
* fewer because its byte budget is a disk cap, not a heap bound.
|
|
@@ -426,6 +428,7 @@ export function encodeAnalyticsPresentation(state, savedAtMs) {
|
|
|
426
428
|
coverage: state.extent
|
|
427
429
|
? { sinceMs: state.extent.sinceMs ?? null, untilMs: state.extent.untilMs }
|
|
428
430
|
: null,
|
|
431
|
+
pricingRevision: getAnalyticsPricingFingerprint(),
|
|
429
432
|
presentation: state.presentation
|
|
430
433
|
? {
|
|
431
434
|
home: state.presentation.home,
|
|
@@ -494,6 +497,14 @@ export function decodeAnalyticsPresentation(value) {
|
|
|
494
497
|
// compact index instead of serving possibly inflated steps/rollups.
|
|
495
498
|
if (record.presentationVersion !== ANALYTICS_PRESENTATION_VERSION)
|
|
496
499
|
return undefined;
|
|
500
|
+
// Derived costs are only certified against the combined pricing and temporal
|
|
501
|
+
// fingerprint they were computed from. A missing token is a pre-fingerprint
|
|
502
|
+
// sidecar and is rebuilt just like a mismatch.
|
|
503
|
+
const pricingRevision = record.pricingRevision;
|
|
504
|
+
if (typeof pricingRevision !== "string")
|
|
505
|
+
return undefined;
|
|
506
|
+
if (pricingRevision !== getAnalyticsPricingFingerprint())
|
|
507
|
+
return undefined;
|
|
497
508
|
if (!isFiniteNumber(record.savedAtMs))
|
|
498
509
|
return undefined;
|
|
499
510
|
const identityValue = record.sourceIdentity;
|
|
@@ -538,6 +549,7 @@ export function decodeAnalyticsPresentation(value) {
|
|
|
538
549
|
...(coverage ? { coverage } : {}),
|
|
539
550
|
savedAtMs: record.savedAtMs,
|
|
540
551
|
...(typeof frontierValue === "number" ? { frontierAtMs: frontierValue } : {}),
|
|
552
|
+
pricingRevision,
|
|
541
553
|
sourceIdentity: identityValue === undefined || identityValue === null
|
|
542
554
|
? undefined
|
|
543
555
|
: identityFromTuple(identityValue),
|
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.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"];
|
|
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", "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.port", "dashboard.hiddenCardsVersion"];
|
|
23
|
+
export declare const GUI_SETTINGS_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "lowQuotaThresholdRemainingPercent", "duplicateCooldownMinutes", "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
|
}
|