opencode-quota-gui 0.0.0-stage → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +243 -2
- package/dist/bin/opencode-quota-gui.d.ts +4 -0
- package/dist/bin/opencode-quota-gui.d.ts.map +1 -0
- package/dist/bin/opencode-quota-gui.js +75 -0
- package/dist/bin/opencode-quota-gui.js.map +1 -0
- package/dist/contracts/build-identity.d.ts +8 -0
- package/dist/contracts/build-identity.d.ts.map +1 -0
- package/dist/contracts/build-identity.js +1 -0
- package/dist/contracts/card-order.d.ts +25 -0
- package/dist/contracts/card-order.d.ts.map +1 -0
- package/dist/contracts/card-order.js +50 -0
- package/dist/contracts/card-order.js.map +1 -0
- package/dist/contracts/dashboard.d.ts +368 -0
- package/dist/contracts/dashboard.d.ts.map +1 -0
- package/dist/contracts/dashboard.js +3 -0
- package/dist/contracts/dashboard.js.map +1 -0
- package/dist/contracts/guards.d.ts +14 -0
- package/dist/contracts/guards.d.ts.map +1 -0
- package/dist/contracts/guards.js +56 -0
- package/dist/contracts/guards.js.map +1 -0
- package/dist/contracts/identity.d.ts +41 -0
- package/dist/contracts/identity.d.ts.map +1 -0
- package/dist/contracts/identity.js +27 -0
- package/dist/contracts/identity.js.map +1 -0
- package/dist/contracts/openai-quota.d.ts +34 -0
- package/dist/contracts/openai-quota.d.ts.map +1 -0
- package/dist/contracts/openai-quota.js +19 -0
- package/dist/contracts/openai-quota.js.map +1 -0
- package/dist/contracts/ranges.d.ts +48 -0
- package/dist/contracts/ranges.d.ts.map +1 -0
- package/dist/contracts/ranges.js +84 -0
- package/dist/contracts/ranges.js.map +1 -0
- package/dist/contracts/settings.d.ts +4 -0
- package/dist/contracts/settings.d.ts.map +1 -0
- package/dist/contracts/settings.js +14 -0
- package/dist/contracts/settings.js.map +1 -0
- package/dist/contracts/time-zone.d.ts +33 -0
- package/dist/contracts/time-zone.d.ts.map +1 -0
- package/dist/contracts/time-zone.js +217 -0
- package/dist/contracts/time-zone.js.map +1 -0
- package/dist/data/modelsdev-pricing.min.json +1064 -0
- package/dist/gui/aggregation.d.ts +55 -0
- package/dist/gui/aggregation.d.ts.map +1 -0
- package/dist/gui/aggregation.js +792 -0
- package/dist/gui/aggregation.js.map +1 -0
- package/dist/gui/analytics-bridge.d.ts +50 -0
- package/dist/gui/analytics-bridge.d.ts.map +1 -0
- package/dist/gui/analytics-bridge.js +382 -0
- package/dist/gui/analytics-bridge.js.map +1 -0
- package/dist/gui/analytics-engine.d.ts +61 -0
- package/dist/gui/analytics-engine.d.ts.map +1 -0
- package/dist/gui/analytics-engine.js +2381 -0
- package/dist/gui/analytics-engine.js.map +1 -0
- package/dist/gui/analytics-indexes.d.ts +34 -0
- package/dist/gui/analytics-indexes.d.ts.map +1 -0
- package/dist/gui/analytics-indexes.js +142 -0
- package/dist/gui/analytics-indexes.js.map +1 -0
- package/dist/gui/analytics-model.d.ts +48 -0
- package/dist/gui/analytics-model.d.ts.map +1 -0
- package/dist/gui/analytics-model.js +824 -0
- package/dist/gui/analytics-model.js.map +1 -0
- package/dist/gui/analytics-protocol.d.ts +102 -0
- package/dist/gui/analytics-protocol.d.ts.map +1 -0
- package/dist/gui/analytics-protocol.js +11 -0
- package/dist/gui/analytics-protocol.js.map +1 -0
- package/dist/gui/analytics-reader.d.ts +14 -0
- package/dist/gui/analytics-reader.d.ts.map +1 -0
- package/dist/gui/analytics-reader.js +15 -0
- package/dist/gui/analytics-reader.js.map +1 -0
- package/dist/gui/analytics-service.d.ts +49 -0
- package/dist/gui/analytics-service.d.ts.map +1 -0
- package/dist/gui/analytics-service.js +187 -0
- package/dist/gui/analytics-service.js.map +1 -0
- package/dist/gui/analytics-state.d.ts +183 -0
- package/dist/gui/analytics-state.d.ts.map +1 -0
- package/dist/gui/analytics-state.js +692 -0
- package/dist/gui/analytics-state.js.map +1 -0
- package/dist/gui/analytics-worker-runtime.d.ts +11 -0
- package/dist/gui/analytics-worker-runtime.d.ts.map +1 -0
- package/dist/gui/analytics-worker-runtime.js +98 -0
- package/dist/gui/analytics-worker-runtime.js.map +1 -0
- package/dist/gui/analytics-worker.d.ts +2 -0
- package/dist/gui/analytics-worker.d.ts.map +1 -0
- package/dist/gui/analytics-worker.js +64 -0
- package/dist/gui/analytics-worker.js.map +1 -0
- package/dist/gui/config.d.ts +56 -0
- package/dist/gui/config.d.ts.map +1 -0
- package/dist/gui/config.js +701 -0
- package/dist/gui/config.js.map +1 -0
- package/dist/gui/identity.d.ts +23 -0
- package/dist/gui/identity.d.ts.map +1 -0
- package/dist/gui/identity.js +57 -0
- package/dist/gui/identity.js.map +1 -0
- package/dist/gui/lifecycle.d.ts +82 -0
- package/dist/gui/lifecycle.d.ts.map +1 -0
- package/dist/gui/lifecycle.js +402 -0
- package/dist/gui/lifecycle.js.map +1 -0
- package/dist/gui/log.d.ts +23 -0
- package/dist/gui/log.d.ts.map +1 -0
- package/dist/gui/log.js +37 -0
- package/dist/gui/log.js.map +1 -0
- package/dist/gui/provider-cards.d.ts +55 -0
- package/dist/gui/provider-cards.d.ts.map +1 -0
- package/dist/gui/provider-cards.js +417 -0
- package/dist/gui/provider-cards.js.map +1 -0
- package/dist/gui/server.d.ts +60 -0
- package/dist/gui/server.d.ts.map +1 -0
- package/dist/gui/server.js +815 -0
- package/dist/gui/server.js.map +1 -0
- package/dist/gui/settings-file-opener.d.ts +34 -0
- package/dist/gui/settings-file-opener.d.ts.map +1 -0
- package/dist/gui/settings-file-opener.js +110 -0
- package/dist/gui/settings-file-opener.js.map +1 -0
- package/dist/gui/snapshot-service.d.ts +128 -0
- package/dist/gui/snapshot-service.d.ts.map +1 -0
- package/dist/gui/snapshot-service.js +591 -0
- package/dist/gui/snapshot-service.js.map +1 -0
- package/dist/gui/sources.d.ts +99 -0
- package/dist/gui/sources.d.ts.map +1 -0
- package/dist/gui/sources.js +410 -0
- package/dist/gui/sources.js.map +1 -0
- package/dist/gui/sse.d.ts +32 -0
- package/dist/gui/sse.d.ts.map +1 -0
- package/dist/gui/sse.js +100 -0
- package/dist/gui/sse.js.map +1 -0
- package/dist/gui/time-zone.d.ts +10 -0
- package/dist/gui/time-zone.d.ts.map +1 -0
- package/dist/gui/time-zone.js +21 -0
- package/dist/gui/time-zone.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/accounting-format.d.ts +54 -0
- package/dist/lib/accounting-format.d.ts.map +1 -0
- package/dist/lib/accounting-format.js +271 -0
- package/dist/lib/accounting-format.js.map +1 -0
- package/dist/lib/alibaba-auth.d.ts +46 -0
- package/dist/lib/alibaba-auth.d.ts.map +1 -0
- package/dist/lib/alibaba-auth.js +193 -0
- package/dist/lib/alibaba-auth.js.map +1 -0
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts +47 -0
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts.map +1 -0
- package/dist/lib/alibaba-coding-plan-local-quota.js +146 -0
- package/dist/lib/alibaba-coding-plan-local-quota.js.map +1 -0
- package/dist/lib/alibaba-token-plan.d.ts +91 -0
- package/dist/lib/alibaba-token-plan.d.ts.map +1 -0
- package/dist/lib/alibaba-token-plan.js +527 -0
- package/dist/lib/alibaba-token-plan.js.map +1 -0
- package/dist/lib/anthropic-auth.d.ts +29 -0
- package/dist/lib/anthropic-auth.d.ts.map +1 -0
- package/dist/lib/anthropic-auth.js +37 -0
- package/dist/lib/anthropic-auth.js.map +1 -0
- package/dist/lib/anthropic.d.ts +104 -0
- package/dist/lib/anthropic.d.ts.map +1 -0
- package/dist/lib/anthropic.js +1134 -0
- package/dist/lib/anthropic.js.map +1 -0
- package/dist/lib/api-key-resolver.d.ts +227 -0
- package/dist/lib/api-key-resolver.d.ts.map +1 -0
- package/dist/lib/api-key-resolver.js +336 -0
- package/dist/lib/api-key-resolver.js.map +1 -0
- package/dist/lib/atomic-json.d.ts +11 -0
- package/dist/lib/atomic-json.d.ts.map +1 -0
- package/dist/lib/atomic-json.js +64 -0
- package/dist/lib/atomic-json.js.map +1 -0
- package/dist/lib/chutes-config.d.ts +15 -0
- package/dist/lib/chutes-config.d.ts.map +1 -0
- package/dist/lib/chutes-config.js +28 -0
- package/dist/lib/chutes-config.js.map +1 -0
- package/dist/lib/chutes.d.ts +12 -0
- package/dist/lib/chutes.d.ts.map +1 -0
- package/dist/lib/chutes.js +60 -0
- package/dist/lib/chutes.js.map +1 -0
- package/dist/lib/cli-reports.d.ts +30 -0
- package/dist/lib/cli-reports.d.ts.map +1 -0
- package/dist/lib/cli-reports.js +172 -0
- package/dist/lib/cli-reports.js.map +1 -0
- package/dist/lib/cli-show.d.ts +30 -0
- package/dist/lib/cli-show.d.ts.map +1 -0
- package/dist/lib/cli-show.js +213 -0
- package/dist/lib/cli-show.js.map +1 -0
- package/dist/lib/cli-status.d.ts +8 -0
- package/dist/lib/cli-status.d.ts.map +1 -0
- package/dist/lib/cli-status.js +98 -0
- package/dist/lib/cli-status.js.map +1 -0
- package/dist/lib/command-parsing.d.ts +43 -0
- package/dist/lib/command-parsing.d.ts.map +1 -0
- package/dist/lib/command-parsing.js +103 -0
- package/dist/lib/command-parsing.js.map +1 -0
- package/dist/lib/config-file-utils.d.ts +46 -0
- package/dist/lib/config-file-utils.d.ts.map +1 -0
- package/dist/lib/config-file-utils.js +194 -0
- package/dist/lib/config-file-utils.js.map +1 -0
- package/dist/lib/config-write-target.d.ts +28 -0
- package/dist/lib/config-write-target.d.ts.map +1 -0
- package/dist/lib/config-write-target.js +159 -0
- package/dist/lib/config-write-target.js.map +1 -0
- package/dist/lib/config.d.ts +119 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +1352 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/copilot.d.ts +78 -0
- package/dist/lib/copilot.d.ts.map +1 -0
- package/dist/lib/copilot.js +1111 -0
- package/dist/lib/copilot.js.map +1 -0
- package/dist/lib/cursor-detection.d.ts +18 -0
- package/dist/lib/cursor-detection.d.ts.map +1 -0
- package/dist/lib/cursor-detection.js +189 -0
- package/dist/lib/cursor-detection.js.map +1 -0
- package/dist/lib/cursor-pricing.d.ts +34 -0
- package/dist/lib/cursor-pricing.d.ts.map +1 -0
- package/dist/lib/cursor-pricing.js +235 -0
- package/dist/lib/cursor-pricing.js.map +1 -0
- package/dist/lib/cursor-usage.d.ts +33 -0
- package/dist/lib/cursor-usage.d.ts.map +1 -0
- package/dist/lib/cursor-usage.js +109 -0
- package/dist/lib/cursor-usage.js.map +1 -0
- package/dist/lib/dashboard-visibility.d.ts +13 -0
- package/dist/lib/dashboard-visibility.d.ts.map +1 -0
- package/dist/lib/dashboard-visibility.js +51 -0
- package/dist/lib/dashboard-visibility.js.map +1 -0
- package/dist/lib/deepseek-auth.d.ts +15 -0
- package/dist/lib/deepseek-auth.d.ts.map +1 -0
- package/dist/lib/deepseek-auth.js +28 -0
- package/dist/lib/deepseek-auth.js.map +1 -0
- package/dist/lib/deepseek.d.ts +40 -0
- package/dist/lib/deepseek.d.ts.map +1 -0
- package/dist/lib/deepseek.js +118 -0
- package/dist/lib/deepseek.js.map +1 -0
- package/dist/lib/display-sanitize.d.ts +20 -0
- package/dist/lib/display-sanitize.d.ts.map +1 -0
- package/dist/lib/display-sanitize.js +178 -0
- package/dist/lib/display-sanitize.js.map +1 -0
- package/dist/lib/entries.d.ts +367 -0
- package/dist/lib/entries.d.ts.map +1 -0
- package/dist/lib/entries.js +69 -0
- package/dist/lib/entries.js.map +1 -0
- package/dist/lib/env-template.d.ts +26 -0
- package/dist/lib/env-template.d.ts.map +1 -0
- package/dist/lib/env-template.js +36 -0
- package/dist/lib/env-template.js.map +1 -0
- package/dist/lib/format-utils.d.ts +89 -0
- package/dist/lib/format-utils.d.ts.map +1 -0
- package/dist/lib/format-utils.js +206 -0
- package/dist/lib/format-utils.js.map +1 -0
- package/dist/lib/format.d.ts +25 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +300 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/glm-coding-plan.d.ts +19 -0
- package/dist/lib/glm-coding-plan.d.ts.map +1 -0
- package/dist/lib/glm-coding-plan.js +81 -0
- package/dist/lib/glm-coding-plan.js.map +1 -0
- package/dist/lib/google-agy-companion.d.ts +8 -0
- package/dist/lib/google-agy-companion.d.ts.map +1 -0
- package/dist/lib/google-agy-companion.js +64 -0
- package/dist/lib/google-agy-companion.js.map +1 -0
- package/dist/lib/google-agy.d.ts +48 -0
- package/dist/lib/google-agy.d.ts.map +1 -0
- package/dist/lib/google-agy.js +572 -0
- package/dist/lib/google-agy.js.map +1 -0
- package/dist/lib/google-companion-credentials.d.ts +70 -0
- package/dist/lib/google-companion-credentials.d.ts.map +1 -0
- package/dist/lib/google-companion-credentials.js +315 -0
- package/dist/lib/google-companion-credentials.js.map +1 -0
- package/dist/lib/google-gemini-cli-companion.d.ts +8 -0
- package/dist/lib/google-gemini-cli-companion.d.ts.map +1 -0
- package/dist/lib/google-gemini-cli-companion.js +64 -0
- package/dist/lib/google-gemini-cli-companion.js.map +1 -0
- package/dist/lib/google-gemini-cli.d.ts +47 -0
- package/dist/lib/google-gemini-cli.d.ts.map +1 -0
- package/dist/lib/google-gemini-cli.js +481 -0
- package/dist/lib/google-gemini-cli.js.map +1 -0
- package/dist/lib/google-token-cache.d.ts +27 -0
- package/dist/lib/google-token-cache.d.ts.map +1 -0
- package/dist/lib/google-token-cache.js +52 -0
- package/dist/lib/google-token-cache.js.map +1 -0
- package/dist/lib/grouped-entry-normalization.d.ts +12 -0
- package/dist/lib/grouped-entry-normalization.d.ts.map +1 -0
- package/dist/lib/grouped-entry-normalization.js +124 -0
- package/dist/lib/grouped-entry-normalization.js.map +1 -0
- package/dist/lib/grouped-header-format.d.ts +5 -0
- package/dist/lib/grouped-header-format.d.ts.map +1 -0
- package/dist/lib/grouped-header-format.js +16 -0
- package/dist/lib/grouped-header-format.js.map +1 -0
- package/dist/lib/gui-config-target.d.ts +12 -0
- package/dist/lib/gui-config-target.d.ts.map +1 -0
- package/dist/lib/gui-config-target.js +88 -0
- package/dist/lib/gui-config-target.js.map +1 -0
- package/dist/lib/home-dir-display.d.ts +10 -0
- package/dist/lib/home-dir-display.d.ts.map +1 -0
- package/dist/lib/home-dir-display.js +108 -0
- package/dist/lib/home-dir-display.js.map +1 -0
- package/dist/lib/http.d.ts +19 -0
- package/dist/lib/http.d.ts.map +1 -0
- package/dist/lib/http.js +47 -0
- package/dist/lib/http.js.map +1 -0
- package/dist/lib/init-installer.d.ts +146 -0
- package/dist/lib/init-installer.d.ts.map +1 -0
- package/dist/lib/init-installer.js +1056 -0
- package/dist/lib/init-installer.js.map +1 -0
- package/dist/lib/jsonc.d.ts +17 -0
- package/dist/lib/jsonc.d.ts.map +1 -0
- package/dist/lib/jsonc.js +23 -0
- package/dist/lib/jsonc.js.map +1 -0
- package/dist/lib/kilo-config.d.ts +15 -0
- package/dist/lib/kilo-config.d.ts.map +1 -0
- package/dist/lib/kilo-config.js +27 -0
- package/dist/lib/kilo-config.js.map +1 -0
- package/dist/lib/kilo.d.ts +32 -0
- package/dist/lib/kilo.d.ts.map +1 -0
- package/dist/lib/kilo.js +265 -0
- package/dist/lib/kilo.js.map +1 -0
- package/dist/lib/kimi-auth.d.ts +49 -0
- package/dist/lib/kimi-auth.d.ts.map +1 -0
- package/dist/lib/kimi-auth.js +82 -0
- package/dist/lib/kimi-auth.js.map +1 -0
- package/dist/lib/kimi-endpoints.d.ts +10 -0
- package/dist/lib/kimi-endpoints.d.ts.map +1 -0
- package/dist/lib/kimi-endpoints.js +18 -0
- package/dist/lib/kimi-endpoints.js.map +1 -0
- package/dist/lib/kimi.d.ts +26 -0
- package/dist/lib/kimi.d.ts.map +1 -0
- package/dist/lib/kimi.js +230 -0
- package/dist/lib/kimi.js.map +1 -0
- package/dist/lib/maintainer-announcements.d.ts +46 -0
- package/dist/lib/maintainer-announcements.d.ts.map +1 -0
- package/dist/lib/maintainer-announcements.js +155 -0
- package/dist/lib/maintainer-announcements.js.map +1 -0
- package/dist/lib/map-with-concurrency.d.ts +2 -0
- package/dist/lib/map-with-concurrency.d.ts.map +1 -0
- package/dist/lib/map-with-concurrency.js +17 -0
- package/dist/lib/map-with-concurrency.js.map +1 -0
- package/dist/lib/markdown-table.d.ts +51 -0
- package/dist/lib/markdown-table.d.ts.map +1 -0
- package/dist/lib/markdown-table.js +179 -0
- package/dist/lib/markdown-table.js.map +1 -0
- package/dist/lib/mimo-config.d.ts +29 -0
- package/dist/lib/mimo-config.d.ts.map +1 -0
- package/dist/lib/mimo-config.js +146 -0
- package/dist/lib/mimo-config.js.map +1 -0
- package/dist/lib/mimo.d.ts +35 -0
- package/dist/lib/mimo.d.ts.map +1 -0
- package/dist/lib/mimo.js +236 -0
- package/dist/lib/mimo.js.map +1 -0
- package/dist/lib/minimax-auth.d.ts +62 -0
- package/dist/lib/minimax-auth.d.ts.map +1 -0
- package/dist/lib/minimax-auth.js +206 -0
- package/dist/lib/minimax-auth.js.map +1 -0
- package/dist/lib/minimax-endpoints.d.ts +10 -0
- package/dist/lib/minimax-endpoints.d.ts.map +1 -0
- package/dist/lib/minimax-endpoints.js +19 -0
- package/dist/lib/minimax-endpoints.js.map +1 -0
- package/dist/lib/modelsdev-pricing.d.ts +93 -0
- package/dist/lib/modelsdev-pricing.d.ts.map +1 -0
- package/dist/lib/modelsdev-pricing.js +674 -0
- package/dist/lib/modelsdev-pricing.js.map +1 -0
- package/dist/lib/nanogpt-config.d.ts +15 -0
- package/dist/lib/nanogpt-config.d.ts.map +1 -0
- package/dist/lib/nanogpt-config.js +31 -0
- package/dist/lib/nanogpt-config.js.map +1 -0
- package/dist/lib/nanogpt.d.ts +48 -0
- package/dist/lib/nanogpt.d.ts.map +1 -0
- package/dist/lib/nanogpt.js +251 -0
- package/dist/lib/nanogpt.js.map +1 -0
- package/dist/lib/ollama-cloud-config.d.ts +15 -0
- package/dist/lib/ollama-cloud-config.d.ts.map +1 -0
- package/dist/lib/ollama-cloud-config.js +27 -0
- package/dist/lib/ollama-cloud-config.js.map +1 -0
- package/dist/lib/ollama-cloud.d.ts +14 -0
- package/dist/lib/ollama-cloud.d.ts.map +1 -0
- package/dist/lib/ollama-cloud.js +186 -0
- package/dist/lib/ollama-cloud.js.map +1 -0
- package/dist/lib/openai.d.ts +68 -0
- package/dist/lib/openai.d.ts.map +1 -0
- package/dist/lib/openai.js +394 -0
- package/dist/lib/openai.js.map +1 -0
- package/dist/lib/opencode-auth-sqlite.d.ts +17 -0
- package/dist/lib/opencode-auth-sqlite.d.ts.map +1 -0
- package/dist/lib/opencode-auth-sqlite.js +105 -0
- package/dist/lib/opencode-auth-sqlite.js.map +1 -0
- package/dist/lib/opencode-auth.d.ts +146 -0
- package/dist/lib/opencode-auth.d.ts.map +1 -0
- package/dist/lib/opencode-auth.js +465 -0
- package/dist/lib/opencode-auth.js.map +1 -0
- package/dist/lib/opencode-config-editor.d.ts +62 -0
- package/dist/lib/opencode-config-editor.d.ts.map +1 -0
- package/dist/lib/opencode-config-editor.js +387 -0
- package/dist/lib/opencode-config-editor.js.map +1 -0
- package/dist/lib/opencode-config-providers.d.ts +24 -0
- package/dist/lib/opencode-config-providers.d.ts.map +1 -0
- package/dist/lib/opencode-config-providers.js +144 -0
- package/dist/lib/opencode-config-providers.js.map +1 -0
- package/dist/lib/opencode-config-read.d.ts +23 -0
- package/dist/lib/opencode-config-read.d.ts.map +1 -0
- package/dist/lib/opencode-config-read.js +30 -0
- package/dist/lib/opencode-config-read.js.map +1 -0
- package/dist/lib/opencode-console-auth.d.ts +96 -0
- package/dist/lib/opencode-console-auth.d.ts.map +1 -0
- package/dist/lib/opencode-console-auth.js +213 -0
- package/dist/lib/opencode-console-auth.js.map +1 -0
- package/dist/lib/opencode-db-path.d.ts +9 -0
- package/dist/lib/opencode-db-path.d.ts.map +1 -0
- package/dist/lib/opencode-db-path.js +16 -0
- package/dist/lib/opencode-db-path.js.map +1 -0
- package/dist/lib/opencode-go-auth.d.ts +16 -0
- package/dist/lib/opencode-go-auth.d.ts.map +1 -0
- package/dist/lib/opencode-go-auth.js +42 -0
- package/dist/lib/opencode-go-auth.js.map +1 -0
- package/dist/lib/opencode-go.d.ts +17 -0
- package/dist/lib/opencode-go.d.ts.map +1 -0
- package/dist/lib/opencode-go.js +284 -0
- package/dist/lib/opencode-go.js.map +1 -0
- package/dist/lib/opencode-runtime-paths.d.ts +17 -0
- package/dist/lib/opencode-runtime-paths.d.ts.map +1 -0
- package/dist/lib/opencode-runtime-paths.js +24 -0
- package/dist/lib/opencode-runtime-paths.js.map +1 -0
- package/dist/lib/opencode-sqlite.d.ts +11 -0
- package/dist/lib/opencode-sqlite.d.ts.map +1 -0
- package/dist/lib/opencode-sqlite.js +88 -0
- package/dist/lib/opencode-sqlite.js.map +1 -0
- package/dist/lib/opencode-storage.d.ts +306 -0
- package/dist/lib/opencode-storage.d.ts.map +1 -0
- package/dist/lib/opencode-storage.js +1269 -0
- package/dist/lib/opencode-storage.js.map +1 -0
- package/dist/lib/opencode-version.d.ts +6 -0
- package/dist/lib/opencode-version.d.ts.map +1 -0
- package/dist/lib/opencode-version.js +26 -0
- package/dist/lib/opencode-version.js.map +1 -0
- package/dist/lib/opencode-zen.d.ts +55 -0
- package/dist/lib/opencode-zen.d.ts.map +1 -0
- package/dist/lib/opencode-zen.js +348 -0
- package/dist/lib/opencode-zen.js.map +1 -0
- package/dist/lib/openrouter.d.ts +60 -0
- package/dist/lib/openrouter.d.ts.map +1 -0
- package/dist/lib/openrouter.js +215 -0
- package/dist/lib/openrouter.js.map +1 -0
- package/dist/lib/private-state-paths.d.ts +10 -0
- package/dist/lib/private-state-paths.d.ts.map +1 -0
- package/dist/lib/private-state-paths.js +28 -0
- package/dist/lib/private-state-paths.js.map +1 -0
- package/dist/lib/provider-add-command.d.ts +35 -0
- package/dist/lib/provider-add-command.d.ts.map +1 -0
- package/dist/lib/provider-add-command.js +204 -0
- package/dist/lib/provider-add-command.js.map +1 -0
- package/dist/lib/provider-add-json-v1-questionnaire.d.ts +32 -0
- package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +1 -0
- package/dist/lib/provider-add-json-v1-questionnaire.js +336 -0
- package/dist/lib/provider-add-json-v1-questionnaire.js.map +1 -0
- package/dist/lib/provider-add.d.ts +21 -0
- package/dist/lib/provider-add.d.ts.map +1 -0
- package/dist/lib/provider-add.js +219 -0
- package/dist/lib/provider-add.js.map +1 -0
- package/dist/lib/provider-availability.d.ts +13 -0
- package/dist/lib/provider-availability.d.ts.map +1 -0
- package/dist/lib/provider-availability.js +20 -0
- package/dist/lib/provider-availability.js.map +1 -0
- package/dist/lib/provider-metadata.d.ts +32 -0
- package/dist/lib/provider-metadata.d.ts.map +1 -0
- package/dist/lib/provider-metadata.js +90 -0
- package/dist/lib/provider-metadata.js.map +1 -0
- package/dist/lib/provider-model-matching.d.ts +12 -0
- package/dist/lib/provider-model-matching.d.ts.map +1 -0
- package/dist/lib/provider-model-matching.js +23 -0
- package/dist/lib/provider-model-matching.js.map +1 -0
- package/dist/lib/provider-registration.d.ts +321 -0
- package/dist/lib/provider-registration.d.ts.map +1 -0
- package/dist/lib/provider-registration.js +335 -0
- package/dist/lib/provider-registration.js.map +1 -0
- package/dist/lib/quota-accounting-projection.d.ts +9 -0
- package/dist/lib/quota-accounting-projection.d.ts.map +1 -0
- package/dist/lib/quota-accounting-projection.js +254 -0
- package/dist/lib/quota-accounting-projection.js.map +1 -0
- package/dist/lib/quota-columns.d.ts +38 -0
- package/dist/lib/quota-columns.d.ts.map +1 -0
- package/dist/lib/quota-columns.js +129 -0
- package/dist/lib/quota-columns.js.map +1 -0
- package/dist/lib/quota-command-format.d.ts +34 -0
- package/dist/lib/quota-command-format.d.ts.map +1 -0
- package/dist/lib/quota-command-format.js +240 -0
- package/dist/lib/quota-command-format.js.map +1 -0
- package/dist/lib/quota-dialog-command-specs.d.ts +63 -0
- package/dist/lib/quota-dialog-command-specs.d.ts.map +1 -0
- package/dist/lib/quota-dialog-command-specs.js +145 -0
- package/dist/lib/quota-dialog-command-specs.js.map +1 -0
- package/dist/lib/quota-dialog-commands.d.ts +75 -0
- package/dist/lib/quota-dialog-commands.d.ts.map +1 -0
- package/dist/lib/quota-dialog-commands.js +586 -0
- package/dist/lib/quota-dialog-commands.js.map +1 -0
- package/dist/lib/quota-entry-display.d.ts +7 -0
- package/dist/lib/quota-entry-display.d.ts.map +1 -0
- package/dist/lib/quota-entry-display.js +59 -0
- package/dist/lib/quota-entry-display.js.map +1 -0
- package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
- package/dist/lib/quota-exhaustion-projection.d.ts.map +1 -0
- package/dist/lib/quota-exhaustion-projection.js +105 -0
- package/dist/lib/quota-exhaustion-projection.js.map +1 -0
- package/dist/lib/quota-export-types.d.ts +96 -0
- package/dist/lib/quota-export-types.d.ts.map +1 -0
- package/dist/lib/quota-export-types.js +2 -0
- package/dist/lib/quota-export-types.js.map +1 -0
- package/dist/lib/quota-export.d.ts +44 -0
- package/dist/lib/quota-export.d.ts.map +1 -0
- package/dist/lib/quota-export.js +221 -0
- package/dist/lib/quota-export.js.map +1 -0
- package/dist/lib/quota-format-style.d.ts +21 -0
- package/dist/lib/quota-format-style.d.ts.map +1 -0
- package/dist/lib/quota-format-style.js +38 -0
- package/dist/lib/quota-format-style.js.map +1 -0
- package/dist/lib/quota-providers-local.d.ts +55 -0
- package/dist/lib/quota-providers-local.d.ts.map +1 -0
- package/dist/lib/quota-providers-local.js +327 -0
- package/dist/lib/quota-providers-local.js.map +1 -0
- package/dist/lib/quota-providers-remote.d.ts +27 -0
- package/dist/lib/quota-providers-remote.d.ts.map +1 -0
- package/dist/lib/quota-providers-remote.js +757 -0
- package/dist/lib/quota-providers-remote.js.map +1 -0
- package/dist/lib/quota-providers.d.ts +158 -0
- package/dist/lib/quota-providers.d.ts.map +1 -0
- package/dist/lib/quota-providers.js +1160 -0
- package/dist/lib/quota-providers.js.map +1 -0
- package/dist/lib/quota-render-data.d.ts +135 -0
- package/dist/lib/quota-render-data.d.ts.map +1 -0
- package/dist/lib/quota-render-data.js +462 -0
- package/dist/lib/quota-render-data.js.map +1 -0
- package/dist/lib/quota-report-message.d.ts +22 -0
- package/dist/lib/quota-report-message.d.ts.map +1 -0
- package/dist/lib/quota-report-message.js +36 -0
- package/dist/lib/quota-report-message.js.map +1 -0
- package/dist/lib/quota-reset-notifications.d.ts +20 -0
- package/dist/lib/quota-reset-notifications.d.ts.map +1 -0
- package/dist/lib/quota-reset-notifications.js +331 -0
- package/dist/lib/quota-reset-notifications.js.map +1 -0
- package/dist/lib/quota-retry-wait.d.ts +36 -0
- package/dist/lib/quota-retry-wait.d.ts.map +1 -0
- package/dist/lib/quota-retry-wait.js +67 -0
- package/dist/lib/quota-retry-wait.js.map +1 -0
- package/dist/lib/quota-runtime-context.d.ts +56 -0
- package/dist/lib/quota-runtime-context.d.ts.map +1 -0
- package/dist/lib/quota-runtime-context.js +113 -0
- package/dist/lib/quota-runtime-context.js.map +1 -0
- package/dist/lib/quota-state-codec.d.ts +16 -0
- package/dist/lib/quota-state-codec.d.ts.map +1 -0
- package/dist/lib/quota-state-codec.js +479 -0
- package/dist/lib/quota-state-codec.js.map +1 -0
- package/dist/lib/quota-state.d.ts +28 -0
- package/dist/lib/quota-state.d.ts.map +1 -0
- package/dist/lib/quota-state.js +473 -0
- package/dist/lib/quota-state.js.map +1 -0
- package/dist/lib/quota-stats-format.d.ts +29 -0
- package/dist/lib/quota-stats-format.d.ts.map +1 -0
- package/dist/lib/quota-stats-format.js +459 -0
- package/dist/lib/quota-stats-format.js.map +1 -0
- package/dist/lib/quota-stats.d.ts +174 -0
- package/dist/lib/quota-stats.d.ts.map +1 -0
- package/dist/lib/quota-stats.js +713 -0
- package/dist/lib/quota-stats.js.map +1 -0
- package/dist/lib/quota-status.d.ts +58 -0
- package/dist/lib/quota-status.d.ts.map +1 -0
- package/dist/lib/quota-status.js +865 -0
- package/dist/lib/quota-status.js.map +1 -0
- package/dist/lib/quota-surface-data.d.ts +21 -0
- package/dist/lib/quota-surface-data.d.ts.map +1 -0
- package/dist/lib/quota-surface-data.js +361 -0
- package/dist/lib/quota-surface-data.js.map +1 -0
- package/dist/lib/quota-telemetry.d.ts +45 -0
- package/dist/lib/quota-telemetry.d.ts.map +1 -0
- package/dist/lib/quota-telemetry.js +304 -0
- package/dist/lib/quota-telemetry.js.map +1 -0
- package/dist/lib/report-document.d.ts +90 -0
- package/dist/lib/report-document.d.ts.map +1 -0
- package/dist/lib/report-document.js +190 -0
- package/dist/lib/report-document.js.map +1 -0
- package/dist/lib/resolved-auth-identity.d.ts +36 -0
- package/dist/lib/resolved-auth-identity.d.ts.map +1 -0
- package/dist/lib/resolved-auth-identity.js +192 -0
- package/dist/lib/resolved-auth-identity.js.map +1 -0
- package/dist/lib/runtime-provider-ids.d.ts +4 -0
- package/dist/lib/runtime-provider-ids.d.ts.map +1 -0
- package/dist/lib/runtime-provider-ids.js +10 -0
- package/dist/lib/runtime-provider-ids.js.map +1 -0
- package/dist/lib/scoped-update-migration.d.ts +103 -0
- package/dist/lib/scoped-update-migration.d.ts.map +1 -0
- package/dist/lib/scoped-update-migration.js +348 -0
- package/dist/lib/scoped-update-migration.js.map +1 -0
- package/dist/lib/scoped-update.d.ts +78 -0
- package/dist/lib/scoped-update.d.ts.map +1 -0
- package/dist/lib/scoped-update.js +640 -0
- package/dist/lib/scoped-update.js.map +1 -0
- package/dist/lib/session-tokens-format.d.ts +36 -0
- package/dist/lib/session-tokens-format.d.ts.map +1 -0
- package/dist/lib/session-tokens-format.js +111 -0
- package/dist/lib/session-tokens-format.js.map +1 -0
- package/dist/lib/session-tokens.d.ts +27 -0
- package/dist/lib/session-tokens.d.ts.map +1 -0
- package/dist/lib/session-tokens.js +55 -0
- package/dist/lib/session-tokens.js.map +1 -0
- package/dist/lib/synthetic-config.d.ts +15 -0
- package/dist/lib/synthetic-config.d.ts.map +1 -0
- package/dist/lib/synthetic-config.js +28 -0
- package/dist/lib/synthetic-config.js.map +1 -0
- package/dist/lib/synthetic.d.ts +12 -0
- package/dist/lib/synthetic.d.ts.map +1 -0
- package/dist/lib/synthetic.js +173 -0
- package/dist/lib/synthetic.js.map +1 -0
- package/dist/lib/toast-format-grouped.d.ts +25 -0
- package/dist/lib/toast-format-grouped.d.ts.map +1 -0
- package/dist/lib/toast-format-grouped.js +296 -0
- package/dist/lib/toast-format-grouped.js.map +1 -0
- package/dist/lib/token-buckets.d.ts +24 -0
- package/dist/lib/token-buckets.d.ts.map +1 -0
- package/dist/lib/token-buckets.js +28 -0
- package/dist/lib/token-buckets.js.map +1 -0
- package/dist/lib/token-cost.d.ts +10 -0
- package/dist/lib/token-cost.d.ts.map +1 -0
- package/dist/lib/token-cost.js +16 -0
- package/dist/lib/token-cost.js.map +1 -0
- package/dist/lib/tui-compact-format.d.ts +10 -0
- package/dist/lib/tui-compact-format.d.ts.map +1 -0
- package/dist/lib/tui-compact-format.js +460 -0
- package/dist/lib/tui-compact-format.js.map +1 -0
- package/dist/lib/tui-panel-state.d.ts +15 -0
- package/dist/lib/tui-panel-state.d.ts.map +1 -0
- package/dist/lib/tui-panel-state.js +2 -0
- package/dist/lib/tui-panel-state.js.map +1 -0
- package/dist/lib/tui-prompt-bar-format.d.ts +25 -0
- package/dist/lib/tui-prompt-bar-format.d.ts.map +1 -0
- package/dist/lib/tui-prompt-bar-format.js +206 -0
- package/dist/lib/tui-prompt-bar-format.js.map +1 -0
- package/dist/lib/tui-sidebar-format.d.ts +13 -0
- package/dist/lib/tui-sidebar-format.d.ts.map +1 -0
- package/dist/lib/tui-sidebar-format.js +34 -0
- package/dist/lib/tui-sidebar-format.js.map +1 -0
- package/dist/lib/types.d.ts +738 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +85 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/usage-ownership.d.ts +47 -0
- package/dist/lib/usage-ownership.d.ts.map +1 -0
- package/dist/lib/usage-ownership.js +98 -0
- package/dist/lib/usage-ownership.js.map +1 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +33 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/lib/xai.d.ts +52 -0
- package/dist/lib/xai.d.ts.map +1 -0
- package/dist/lib/xai.js +253 -0
- package/dist/lib/xai.js.map +1 -0
- package/dist/lib/zai-auth.d.ts +15 -0
- package/dist/lib/zai-auth.d.ts.map +1 -0
- package/dist/lib/zai-auth.js +37 -0
- package/dist/lib/zai-auth.js.map +1 -0
- package/dist/lib/zai.d.ts +5 -0
- package/dist/lib/zai.d.ts.map +1 -0
- package/dist/lib/zai.js +14 -0
- package/dist/lib/zai.js.map +1 -0
- package/dist/lib/zhipu-auth.d.ts +15 -0
- package/dist/lib/zhipu-auth.d.ts.map +1 -0
- package/dist/lib/zhipu-auth.js +42 -0
- package/dist/lib/zhipu-auth.js.map +1 -0
- package/dist/lib/zhipu.d.ts +5 -0
- package/dist/lib/zhipu.d.ts.map +1 -0
- package/dist/lib/zhipu.js +13 -0
- package/dist/lib/zhipu.js.map +1 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +95 -0
- package/dist/plugin.js.map +1 -0
- package/dist/providers/accounting-decimal.d.ts +2 -0
- package/dist/providers/accounting-decimal.d.ts.map +1 -0
- package/dist/providers/accounting-decimal.js +23 -0
- package/dist/providers/accounting-decimal.js.map +1 -0
- package/dist/providers/alibaba-coding-plan.d.ts +3 -0
- package/dist/providers/alibaba-coding-plan.d.ts.map +1 -0
- package/dist/providers/alibaba-coding-plan.js +122 -0
- package/dist/providers/alibaba-coding-plan.js.map +1 -0
- package/dist/providers/alibaba-token-plan.d.ts +3 -0
- package/dist/providers/alibaba-token-plan.d.ts.map +1 -0
- package/dist/providers/alibaba-token-plan.js +90 -0
- package/dist/providers/alibaba-token-plan.js.map +1 -0
- package/dist/providers/anthropic.d.ts +9 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +236 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/cache-policies.d.ts +67 -0
- package/dist/providers/cache-policies.d.ts.map +1 -0
- package/dist/providers/cache-policies.js +263 -0
- package/dist/providers/cache-policies.js.map +1 -0
- package/dist/providers/chutes.d.ts +6 -0
- package/dist/providers/chutes.d.ts.map +1 -0
- package/dist/providers/chutes.js +50 -0
- package/dist/providers/chutes.js.map +1 -0
- package/dist/providers/copilot.d.ts +9 -0
- package/dist/providers/copilot.d.ts.map +1 -0
- package/dist/providers/copilot.js +323 -0
- package/dist/providers/copilot.js.map +1 -0
- package/dist/providers/cursor.d.ts +3 -0
- package/dist/providers/cursor.d.ts.map +1 -0
- package/dist/providers/cursor.js +182 -0
- package/dist/providers/cursor.js.map +1 -0
- package/dist/providers/deepseek.d.ts +9 -0
- package/dist/providers/deepseek.d.ts.map +1 -0
- package/dist/providers/deepseek.js +111 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/glm-coding-plan-provider.d.ts +56 -0
- package/dist/providers/glm-coding-plan-provider.d.ts.map +1 -0
- package/dist/providers/glm-coding-plan-provider.js +146 -0
- package/dist/providers/glm-coding-plan-provider.js.map +1 -0
- package/dist/providers/google-account-format.d.ts +7 -0
- package/dist/providers/google-account-format.d.ts.map +1 -0
- package/dist/providers/google-account-format.js +52 -0
- package/dist/providers/google-account-format.js.map +1 -0
- package/dist/providers/google-agy.d.ts +17 -0
- package/dist/providers/google-agy.d.ts.map +1 -0
- package/dist/providers/google-agy.js +256 -0
- package/dist/providers/google-agy.js.map +1 -0
- package/dist/providers/google-gemini-cli.d.ts +17 -0
- package/dist/providers/google-gemini-cli.d.ts.map +1 -0
- package/dist/providers/google-gemini-cli.js +228 -0
- package/dist/providers/google-gemini-cli.js.map +1 -0
- package/dist/providers/kilo.d.ts +6 -0
- package/dist/providers/kilo.d.ts.map +1 -0
- package/dist/providers/kilo.js +145 -0
- package/dist/providers/kilo.js.map +1 -0
- package/dist/providers/kimi-code.d.ts +4 -0
- package/dist/providers/kimi-code.d.ts.map +1 -0
- package/dist/providers/kimi-code.js +175 -0
- package/dist/providers/kimi-code.js.map +1 -0
- package/dist/providers/mimo.d.ts +3 -0
- package/dist/providers/mimo.d.ts.map +1 -0
- package/dist/providers/mimo.js +149 -0
- package/dist/providers/mimo.js.map +1 -0
- package/dist/providers/minimax-coding-plan.d.ts +26 -0
- package/dist/providers/minimax-coding-plan.d.ts.map +1 -0
- package/dist/providers/minimax-coding-plan.js +391 -0
- package/dist/providers/minimax-coding-plan.js.map +1 -0
- package/dist/providers/nanogpt.d.ts +6 -0
- package/dist/providers/nanogpt.d.ts.map +1 -0
- package/dist/providers/nanogpt.js +160 -0
- package/dist/providers/nanogpt.js.map +1 -0
- package/dist/providers/ollama-cloud.d.ts +9 -0
- package/dist/providers/ollama-cloud.d.ts.map +1 -0
- package/dist/providers/ollama-cloud.js +129 -0
- package/dist/providers/ollama-cloud.js.map +1 -0
- package/dist/providers/openai.d.ts +6 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +313 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/opencode-go.d.ts +4 -0
- package/dist/providers/opencode-go.d.ts.map +1 -0
- package/dist/providers/opencode-go.js +409 -0
- package/dist/providers/opencode-go.js.map +1 -0
- package/dist/providers/opencode-zen.d.ts +3 -0
- package/dist/providers/opencode-zen.d.ts.map +1 -0
- package/dist/providers/opencode-zen.js +288 -0
- package/dist/providers/opencode-zen.js.map +1 -0
- package/dist/providers/openrouter.d.ts +6 -0
- package/dist/providers/openrouter.d.ts.map +1 -0
- package/dist/providers/openrouter.js +94 -0
- package/dist/providers/openrouter.js.map +1 -0
- package/dist/providers/quota-providers.d.ts +6 -0
- package/dist/providers/quota-providers.d.ts.map +1 -0
- package/dist/providers/quota-providers.js +287 -0
- package/dist/providers/quota-providers.js.map +1 -0
- package/dist/providers/registry.d.ts +9 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +71 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/result-helpers.d.ts +61 -0
- package/dist/providers/result-helpers.d.ts.map +1 -0
- package/dist/providers/result-helpers.js +117 -0
- package/dist/providers/result-helpers.js.map +1 -0
- package/dist/providers/synthetic.d.ts +6 -0
- package/dist/providers/synthetic.d.ts.map +1 -0
- package/dist/providers/synthetic.js +79 -0
- package/dist/providers/synthetic.js.map +1 -0
- package/dist/providers/xai.d.ts +6 -0
- package/dist/providers/xai.d.ts.map +1 -0
- package/dist/providers/xai.js +122 -0
- package/dist/providers/xai.js.map +1 -0
- package/dist/providers/zai.d.ts +2 -0
- package/dist/providers/zai.d.ts.map +1 -0
- package/dist/providers/zai.js +24 -0
- package/dist/providers/zai.js.map +1 -0
- package/dist/providers/zhipu.d.ts +2 -0
- package/dist/providers/zhipu.d.ts.map +1 -0
- package/dist/providers/zhipu.js +21 -0
- package/dist/providers/zhipu.js.map +1 -0
- package/dist/rpc.d.ts +72 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +77 -0
- package/dist/rpc.js.map +1 -0
- package/dist/ui/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/ui/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/ui/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/ui/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/ui/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/ui/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/ui/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/ui/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/ui/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/ui/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/ui/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/ui/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/ui/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/ui/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/ui/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/ui/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/ui/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/ui/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/ui/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/ui/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/ui/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/ui/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/ui/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/ui/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/ui/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/ui/assets/index-CPEiQt-C.js +8 -0
- package/dist/ui/assets/index-D3-Yn_WA.css +1 -0
- package/dist/ui/index.html +13 -0
- package/package.json +123 -3
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local dashboard HTTP host (design spec §4.3, §5.3, §9; R8).
|
|
3
|
+
*
|
|
4
|
+
* Loopback-only (`127.0.0.1`), Host/Origin/Sec-Fetch-Site hardening, no CORS,
|
|
5
|
+
* JSON writes behind a streamed 64 KiB cap, static assets contained to
|
|
6
|
+
* `dist/ui` under the packaged extension allowlist, SSE on `/api/v1/events`,
|
|
7
|
+
* and one scrubbed log line per failure. `createDashboardServer` is the
|
|
8
|
+
* injectable seam: tests pass in-memory sources/stores and `port: 0`, while the
|
|
9
|
+
* production lifecycle factory wires the P3 source and P2 settings store and
|
|
10
|
+
* the default `4144` port.
|
|
11
|
+
*/
|
|
12
|
+
import { readFile, realpath, stat } from "node:fs/promises";
|
|
13
|
+
import { createServer } from "node:http";
|
|
14
|
+
import { extname, isAbsolute, relative, resolve } from "node:path";
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
16
|
+
import { BUILD_IDENTITY } from "../contracts/build-identity.js";
|
|
17
|
+
import { DASHBOARD_CONTRACT_VERSION, } from "../contracts/dashboard.js";
|
|
18
|
+
import { DEFAULT_RANGE_KEY, isRangeKey } from "../contracts/ranges.js";
|
|
19
|
+
import { GuiSettingsError } from "./config.js";
|
|
20
|
+
import { createGuiLogger } from "./log.js";
|
|
21
|
+
import { createSnapshotService } from "./snapshot-service.js";
|
|
22
|
+
import { createSseHub } from "./sse.js";
|
|
23
|
+
/** Status mapping from spec §5.3. */
|
|
24
|
+
export const DASHBOARD_ERROR_STATUS = {
|
|
25
|
+
"bad-request": 400,
|
|
26
|
+
"bad-host": 403,
|
|
27
|
+
"bad-origin": 403,
|
|
28
|
+
"unsupported-media-type": 415,
|
|
29
|
+
"body-too-large": 413,
|
|
30
|
+
"method-not-allowed": 405,
|
|
31
|
+
"not-found": 404,
|
|
32
|
+
"config-read-error": 409,
|
|
33
|
+
"config-changed": 409,
|
|
34
|
+
"config-target-error": 409,
|
|
35
|
+
"config-write-error": 500,
|
|
36
|
+
"unknown-setting": 422,
|
|
37
|
+
"invalid-setting": 422,
|
|
38
|
+
"project-not-found": 404,
|
|
39
|
+
"session-not-found": 404,
|
|
40
|
+
internal: 500,
|
|
41
|
+
};
|
|
42
|
+
const DASHBOARD_ERROR_MESSAGES = {
|
|
43
|
+
"bad-request": "Malformed request",
|
|
44
|
+
"bad-host": "Requests must target the dashboard loopback address",
|
|
45
|
+
"bad-origin": "Writes must originate from the dashboard page",
|
|
46
|
+
"unsupported-media-type": "Writes require application/json",
|
|
47
|
+
"body-too-large": "Request body exceeds the 64 KiB limit",
|
|
48
|
+
"method-not-allowed": "Method not allowed",
|
|
49
|
+
"not-found": "Not found",
|
|
50
|
+
"config-read-error": "The dashboard config file is not valid JSONC",
|
|
51
|
+
"config-changed": "Config changed since the last revision",
|
|
52
|
+
"config-target-error": "The dashboard config path is not writable",
|
|
53
|
+
"config-write-error": "Config write failed",
|
|
54
|
+
"unknown-setting": "Unknown setting",
|
|
55
|
+
"invalid-setting": "Invalid setting",
|
|
56
|
+
"project-not-found": "Project not found",
|
|
57
|
+
"session-not-found": "Session not found",
|
|
58
|
+
internal: "Internal dashboard error",
|
|
59
|
+
};
|
|
60
|
+
/** A controlled condition the source or a store wants surfaced verbatim-ish. */
|
|
61
|
+
export class DashboardHttpError extends Error {
|
|
62
|
+
code;
|
|
63
|
+
constructor(code) {
|
|
64
|
+
super(DASHBOARD_ERROR_MESSAGES[code]);
|
|
65
|
+
this.name = "DashboardHttpError";
|
|
66
|
+
this.code = code;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** Structured bind failure: terminal, no alternate port is ever attempted. */
|
|
70
|
+
export class DashboardBindError extends Error {
|
|
71
|
+
code = "unavailable";
|
|
72
|
+
port;
|
|
73
|
+
reason;
|
|
74
|
+
constructor(port, reason) {
|
|
75
|
+
super(`Dashboard server unavailable on 127.0.0.1:${port}${reason ? ` (${reason})` : ""}`);
|
|
76
|
+
this.name = "DashboardBindError";
|
|
77
|
+
this.port = port;
|
|
78
|
+
this.reason = reason;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const CSP = "default-src 'none'; script-src 'self'; style-src 'self'; style-src-attr 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
|
|
82
|
+
const BODY_LIMIT_BYTES = 64 * 1024;
|
|
83
|
+
const ASSET_CONTENT_TYPES = new Map([
|
|
84
|
+
[".html", "text/html; charset=utf-8"],
|
|
85
|
+
[".css", "text/css; charset=utf-8"],
|
|
86
|
+
[".js", "text/javascript; charset=utf-8"],
|
|
87
|
+
[".svg", "image/svg+xml"],
|
|
88
|
+
[".woff", "font/woff"],
|
|
89
|
+
[".woff2", "font/woff2"],
|
|
90
|
+
[".ttf", "font/ttf"],
|
|
91
|
+
]);
|
|
92
|
+
const SOURCE_ERROR_CODES = new Set([
|
|
93
|
+
"bad-request",
|
|
94
|
+
"project-not-found",
|
|
95
|
+
"session-not-found",
|
|
96
|
+
]);
|
|
97
|
+
/** The set above is the vocabulary; trust it as the membership proof. */
|
|
98
|
+
function isSourceErrorCode(value) {
|
|
99
|
+
return SOURCE_ERROR_CODES.has(value);
|
|
100
|
+
}
|
|
101
|
+
const TARGET_REASONS = new Set([
|
|
102
|
+
"dangling",
|
|
103
|
+
"loop",
|
|
104
|
+
"depth",
|
|
105
|
+
"non-regular",
|
|
106
|
+
"permission",
|
|
107
|
+
]);
|
|
108
|
+
const SETTING_KEY_RE = /^[A-Za-z][A-Za-z0-9]*(\.[A-Za-z][A-Za-z0-9]*)*$/;
|
|
109
|
+
const MAX_RESOURCE_ID_LENGTH = 256;
|
|
110
|
+
function envelope(code, details) {
|
|
111
|
+
const error = {
|
|
112
|
+
code,
|
|
113
|
+
message: DASHBOARD_ERROR_MESSAGES[code],
|
|
114
|
+
};
|
|
115
|
+
if (details)
|
|
116
|
+
error.details = details;
|
|
117
|
+
return {
|
|
118
|
+
status: DASHBOARD_ERROR_STATUS[code],
|
|
119
|
+
code,
|
|
120
|
+
body: { error },
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function sanitizedDetails(code, input) {
|
|
124
|
+
if (!input)
|
|
125
|
+
return undefined;
|
|
126
|
+
const details = {};
|
|
127
|
+
// `details.reason` is forwarded for `config-target-error` only, and only from
|
|
128
|
+
// the allowlisted target-reason vocabulary; other codes never carry it.
|
|
129
|
+
if (code === "config-target-error" &&
|
|
130
|
+
input.reason !== undefined &&
|
|
131
|
+
TARGET_REASONS.has(input.reason)) {
|
|
132
|
+
details.reason = input.reason;
|
|
133
|
+
}
|
|
134
|
+
if (input.key !== undefined && input.key.length <= 64 && SETTING_KEY_RE.test(input.key)) {
|
|
135
|
+
details.key = input.key;
|
|
136
|
+
}
|
|
137
|
+
return Object.keys(details).length > 0 ? details : undefined;
|
|
138
|
+
}
|
|
139
|
+
function structuralSourceCode(error) {
|
|
140
|
+
if (error === null || typeof error !== "object" || !("code" in error))
|
|
141
|
+
return undefined;
|
|
142
|
+
const code = error.code;
|
|
143
|
+
if (typeof code !== "string" || !isSourceErrorCode(code))
|
|
144
|
+
return undefined;
|
|
145
|
+
return code;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Raw exceptions never reach the wire: known controlled errors keep their code,
|
|
149
|
+
* everything else is a generic 500. GuiSettingsError messages are not
|
|
150
|
+
* serialized (the controlled message per code is).
|
|
151
|
+
*/
|
|
152
|
+
function mapError(error) {
|
|
153
|
+
if (error instanceof GuiSettingsError) {
|
|
154
|
+
return envelope(error.code, sanitizedDetails(error.code, error.details));
|
|
155
|
+
}
|
|
156
|
+
if (error instanceof DashboardHttpError) {
|
|
157
|
+
return envelope(error.code, undefined);
|
|
158
|
+
}
|
|
159
|
+
const sourceCode = structuralSourceCode(error);
|
|
160
|
+
if (sourceCode)
|
|
161
|
+
return envelope(sourceCode, undefined);
|
|
162
|
+
return envelope("internal", undefined);
|
|
163
|
+
}
|
|
164
|
+
/** Failures worth one scrubbed log line; client validation noise is not. */
|
|
165
|
+
function shouldLog(code) {
|
|
166
|
+
return (code.startsWith("config-") ||
|
|
167
|
+
code === "project-not-found" ||
|
|
168
|
+
code === "session-not-found" ||
|
|
169
|
+
code === "internal");
|
|
170
|
+
}
|
|
171
|
+
function isRecord(value) {
|
|
172
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
173
|
+
}
|
|
174
|
+
function hasExactKeys(record, keys) {
|
|
175
|
+
const actual = Object.keys(record);
|
|
176
|
+
return actual.length === keys.length && actual.every((key) => keys.includes(key));
|
|
177
|
+
}
|
|
178
|
+
function isJsonValue(value) {
|
|
179
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
180
|
+
return true;
|
|
181
|
+
if (Number.isFinite(value))
|
|
182
|
+
return true;
|
|
183
|
+
if (Array.isArray(value))
|
|
184
|
+
return value.every(isJsonValue);
|
|
185
|
+
if (isRecord(value))
|
|
186
|
+
return Object.values(value).every(isJsonValue);
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
function isStringArray(value) {
|
|
190
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
191
|
+
}
|
|
192
|
+
function isValidResourceId(value) {
|
|
193
|
+
return value.length > 0 && value.length <= MAX_RESOURCE_ID_LENGTH && !hasControlCharacters(value);
|
|
194
|
+
}
|
|
195
|
+
function sendJson(res, status, body) {
|
|
196
|
+
const payload = JSON.stringify(body);
|
|
197
|
+
res.statusCode = status;
|
|
198
|
+
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
199
|
+
res.setHeader("Content-Length", Buffer.byteLength(payload));
|
|
200
|
+
res.end(payload);
|
|
201
|
+
}
|
|
202
|
+
function sendError(res, code) {
|
|
203
|
+
const mapped = envelope(code);
|
|
204
|
+
sendJson(res, mapped.status, mapped.body);
|
|
205
|
+
}
|
|
206
|
+
function applyCommonHeaders(res) {
|
|
207
|
+
res.setHeader("X-Content-Type-Options", "nosniff");
|
|
208
|
+
res.setHeader("Referrer-Policy", "no-referrer");
|
|
209
|
+
res.setHeader("Content-Security-Policy", CSP);
|
|
210
|
+
res.setHeader("Cache-Control", "no-store");
|
|
211
|
+
}
|
|
212
|
+
function isAllowedHost(host, port) {
|
|
213
|
+
return host === `127.0.0.1:${port}` || host === `localhost:${port}`;
|
|
214
|
+
}
|
|
215
|
+
function isAllowedOrigin(origin, port) {
|
|
216
|
+
return (origin === undefined ||
|
|
217
|
+
origin === `http://127.0.0.1:${port}` ||
|
|
218
|
+
origin === `http://localhost:${port}`);
|
|
219
|
+
}
|
|
220
|
+
function headerValue(value) {
|
|
221
|
+
return Array.isArray(value) ? value[0] : value;
|
|
222
|
+
}
|
|
223
|
+
/** Streams the body with the 64 KiB cap; never buffers more than the cap. */
|
|
224
|
+
function readRawBody(req) {
|
|
225
|
+
return new Promise((resolve) => {
|
|
226
|
+
const chunks = [];
|
|
227
|
+
let size = 0;
|
|
228
|
+
let tooLarge = false;
|
|
229
|
+
let settled = false;
|
|
230
|
+
const settle = (outcome) => {
|
|
231
|
+
if (settled)
|
|
232
|
+
return;
|
|
233
|
+
settled = true;
|
|
234
|
+
resolve(outcome);
|
|
235
|
+
};
|
|
236
|
+
req.on("data", (chunk) => {
|
|
237
|
+
size += chunk.length;
|
|
238
|
+
if (size > BODY_LIMIT_BYTES) {
|
|
239
|
+
tooLarge = true;
|
|
240
|
+
chunks.length = 0;
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
chunks.push(chunk);
|
|
244
|
+
});
|
|
245
|
+
req.on("end", () => {
|
|
246
|
+
if (tooLarge || size > BODY_LIMIT_BYTES) {
|
|
247
|
+
settle({ ok: false, tooLarge: true, body: "" });
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
settle({ ok: true, tooLarge: false, body: Buffer.concat(chunks).toString("utf8") });
|
|
251
|
+
});
|
|
252
|
+
req.on("error", () => settle({ ok: false, tooLarge: false, body: "" }));
|
|
253
|
+
req.on("aborted", () => settle({ ok: false, tooLarge: false, body: "" }));
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function hasControlCharacters(value) {
|
|
257
|
+
for (const char of value) {
|
|
258
|
+
const code = char.codePointAt(0) ?? 0;
|
|
259
|
+
if (code < 0x20 || code === 0x7f)
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
function decodeSegments(pathname) {
|
|
265
|
+
const segments = [];
|
|
266
|
+
for (const part of pathname.split("/")) {
|
|
267
|
+
if (part === "")
|
|
268
|
+
continue;
|
|
269
|
+
let decoded;
|
|
270
|
+
try {
|
|
271
|
+
decoded = decodeURIComponent(part);
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
if (hasControlCharacters(decoded))
|
|
277
|
+
return undefined;
|
|
278
|
+
segments.push(decoded);
|
|
279
|
+
}
|
|
280
|
+
return segments;
|
|
281
|
+
}
|
|
282
|
+
/** Percent-decoded exactly once; traversal-shaped input is rejected. */
|
|
283
|
+
function decodeAssetRelative(rawPath) {
|
|
284
|
+
let decoded;
|
|
285
|
+
try {
|
|
286
|
+
decoded = decodeURIComponent(rawPath);
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
if (decoded.length === 0 ||
|
|
292
|
+
decoded.includes("\0") ||
|
|
293
|
+
decoded.includes("\\") ||
|
|
294
|
+
decoded.includes("..") ||
|
|
295
|
+
decoded.startsWith("/") ||
|
|
296
|
+
/^[A-Za-z]:/.test(decoded) ||
|
|
297
|
+
hasControlCharacters(decoded)) {
|
|
298
|
+
return undefined;
|
|
299
|
+
}
|
|
300
|
+
for (const segment of decoded.split("/")) {
|
|
301
|
+
if (segment === "" || segment === "." || segment === "..")
|
|
302
|
+
return undefined;
|
|
303
|
+
}
|
|
304
|
+
return decoded;
|
|
305
|
+
}
|
|
306
|
+
function parseRange(url) {
|
|
307
|
+
const raw = url.searchParams.get("range");
|
|
308
|
+
if (raw === null)
|
|
309
|
+
return DEFAULT_RANGE_KEY;
|
|
310
|
+
return isRangeKey(raw) ? raw : undefined;
|
|
311
|
+
}
|
|
312
|
+
/** Known UI paths only: never reinterpret an asset or malformed id as HTML. */
|
|
313
|
+
function isUiPath(pathname) {
|
|
314
|
+
if (["/", "/quota", "/analytics", "/settings"].includes(pathname))
|
|
315
|
+
return true;
|
|
316
|
+
const match = /^\/(?:project|session)\/([^/]+)$/.exec(pathname);
|
|
317
|
+
if (!match)
|
|
318
|
+
return false;
|
|
319
|
+
let id;
|
|
320
|
+
try {
|
|
321
|
+
id = decodeURIComponent(match[1] ?? "");
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
return (isValidResourceId(id) &&
|
|
327
|
+
!id.includes("\\") &&
|
|
328
|
+
!id.split("/").some((part) => part === "." || part === "..") &&
|
|
329
|
+
!/\.(?:html|css|js|map|svg|woff2?|ttf)\/*$/i.test(id));
|
|
330
|
+
}
|
|
331
|
+
function isErrnoCode(error) {
|
|
332
|
+
if (error === null || typeof error !== "object" || !("code" in error))
|
|
333
|
+
return false;
|
|
334
|
+
return typeof error.code === "string";
|
|
335
|
+
}
|
|
336
|
+
const DEFAULT_ASSET_ROOT = fileURLToPath(new URL("../../dist/ui/", import.meta.url));
|
|
337
|
+
export function createDashboardServer(options) {
|
|
338
|
+
const logger = options.logger ?? createGuiLogger();
|
|
339
|
+
const snapshots = createSnapshotService({
|
|
340
|
+
source: options.source,
|
|
341
|
+
minIntervalMs: options.minIntervalMs,
|
|
342
|
+
quotaIntervalMs: options.quotaIntervalMs,
|
|
343
|
+
analyticsIntervalMs: options.analyticsIntervalMs,
|
|
344
|
+
logger,
|
|
345
|
+
});
|
|
346
|
+
let releaseViewer;
|
|
347
|
+
const sse = createSseHub({
|
|
348
|
+
heartbeatMs: options.heartbeatMs,
|
|
349
|
+
logger,
|
|
350
|
+
onClientCountChange: (count) => {
|
|
351
|
+
if (count > 0 && !releaseViewer) {
|
|
352
|
+
releaseViewer = snapshots.addViewer();
|
|
353
|
+
}
|
|
354
|
+
else if (count === 0 && releaseViewer) {
|
|
355
|
+
releaseViewer();
|
|
356
|
+
releaseViewer = undefined;
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
});
|
|
360
|
+
const unsubscribe = snapshots.subscribe((event) => sse.broadcast(event));
|
|
361
|
+
const assetRootPath = resolve(options.assetRoot ?? DEFAULT_ASSET_ROOT);
|
|
362
|
+
let assetRootReal;
|
|
363
|
+
async function resolveAssetRoot() {
|
|
364
|
+
if (assetRootReal !== undefined)
|
|
365
|
+
return assetRootReal;
|
|
366
|
+
let resolved;
|
|
367
|
+
try {
|
|
368
|
+
resolved = await realpath(assetRootPath);
|
|
369
|
+
}
|
|
370
|
+
catch {
|
|
371
|
+
// Cache only a successful lookup: `dist/ui` may be built while the
|
|
372
|
+
// dashboard is already running, so a missing root must be retried.
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
assetRootReal = resolved;
|
|
376
|
+
return resolved;
|
|
377
|
+
}
|
|
378
|
+
async function serveAsset(res, rawRelativePath, headOnly) {
|
|
379
|
+
const decoded = decodeAssetRelative(rawRelativePath);
|
|
380
|
+
if (decoded === undefined) {
|
|
381
|
+
sendError(res, "not-found");
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
const root = await resolveAssetRoot();
|
|
385
|
+
if (root === null) {
|
|
386
|
+
sendError(res, "not-found");
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
const target = resolve(root, decoded);
|
|
390
|
+
const containedRelative = relative(root, target);
|
|
391
|
+
if (containedRelative.startsWith("..") || isAbsolute(containedRelative)) {
|
|
392
|
+
sendError(res, "not-found");
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
let realTarget;
|
|
396
|
+
try {
|
|
397
|
+
realTarget = await realpath(target);
|
|
398
|
+
}
|
|
399
|
+
catch {
|
|
400
|
+
sendError(res, "not-found");
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const realRelative = relative(root, realTarget);
|
|
404
|
+
if (realRelative.startsWith("..") || isAbsolute(realRelative)) {
|
|
405
|
+
sendError(res, "not-found");
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
let info;
|
|
409
|
+
try {
|
|
410
|
+
info = await stat(realTarget);
|
|
411
|
+
}
|
|
412
|
+
catch {
|
|
413
|
+
sendError(res, "not-found");
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if (!info.isFile()) {
|
|
417
|
+
sendError(res, "not-found");
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
const contentType = ASSET_CONTENT_TYPES.get(extname(realTarget).toLowerCase());
|
|
421
|
+
if (!contentType) {
|
|
422
|
+
sendError(res, "not-found");
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
res.statusCode = 200;
|
|
426
|
+
res.setHeader("Content-Type", contentType);
|
|
427
|
+
res.setHeader("Content-Length", info.size);
|
|
428
|
+
if (headOnly) {
|
|
429
|
+
res.end();
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
try {
|
|
433
|
+
res.end(await readFile(realTarget));
|
|
434
|
+
}
|
|
435
|
+
catch {
|
|
436
|
+
sendError(res, "not-found");
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
function requireMethods(req, res, methods) {
|
|
440
|
+
if (methods.includes(req.method ?? ""))
|
|
441
|
+
return true;
|
|
442
|
+
res.setHeader("Allow", methods.join(", "));
|
|
443
|
+
sendError(res, "method-not-allowed");
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
function writeGuards(req, res) {
|
|
447
|
+
if (!isAllowedOrigin(headerValue(req.headers.origin), actualPort)) {
|
|
448
|
+
sendError(res, "bad-origin");
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
const site = headerValue(req.headers["sec-fetch-site"]);
|
|
452
|
+
if (site !== undefined && site !== "same-origin" && site !== "none") {
|
|
453
|
+
sendError(res, "bad-origin");
|
|
454
|
+
return false;
|
|
455
|
+
}
|
|
456
|
+
const contentType = headerValue(req.headers["content-type"]);
|
|
457
|
+
if (contentType === undefined ||
|
|
458
|
+
contentType.split(";")[0]?.trim().toLowerCase() !== "application/json") {
|
|
459
|
+
sendError(res, "unsupported-media-type");
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
async function readWriteJson(req, res) {
|
|
465
|
+
if (!writeGuards(req, res))
|
|
466
|
+
return { ok: false };
|
|
467
|
+
const raw = await readRawBody(req);
|
|
468
|
+
if (!raw.ok) {
|
|
469
|
+
sendError(res, raw.tooLarge ? "body-too-large" : "bad-request");
|
|
470
|
+
return { ok: false };
|
|
471
|
+
}
|
|
472
|
+
try {
|
|
473
|
+
return { ok: true, value: JSON.parse(raw.body) };
|
|
474
|
+
}
|
|
475
|
+
catch {
|
|
476
|
+
sendError(res, "bad-request");
|
|
477
|
+
return { ok: false };
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
async function handleApi(req, res, url) {
|
|
481
|
+
const segments = decodeSegments(url.pathname);
|
|
482
|
+
if (!segments || segments[0] !== "api" || segments[1] !== "v1") {
|
|
483
|
+
sendError(res, "not-found");
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const rest = segments.slice(2);
|
|
487
|
+
const method = req.method ?? "GET";
|
|
488
|
+
if (rest.length === 1 && rest[0] === "health") {
|
|
489
|
+
if (!requireMethods(req, res, ["GET", "HEAD"]))
|
|
490
|
+
return;
|
|
491
|
+
sendJson(res, 200, {
|
|
492
|
+
app: "opencode-quota-gui",
|
|
493
|
+
version: BUILD_IDENTITY.version,
|
|
494
|
+
build: BUILD_IDENTITY.build,
|
|
495
|
+
contractVersion: DASHBOARD_CONTRACT_VERSION,
|
|
496
|
+
});
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
if (rest.length === 1 && rest[0] === "quota") {
|
|
500
|
+
if (!requireMethods(req, res, ["GET", "HEAD"]))
|
|
501
|
+
return;
|
|
502
|
+
// Inference only; an explicit PUT /api/v1/view signal wins.
|
|
503
|
+
snapshots.setViewScope("quota", "request");
|
|
504
|
+
sendJson(res, 200, await snapshots.quota());
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
if (rest.length === 1 && rest[0] === "home") {
|
|
508
|
+
if (!requireMethods(req, res, ["GET", "HEAD"]))
|
|
509
|
+
return;
|
|
510
|
+
const range = parseRange(url);
|
|
511
|
+
if (range === undefined) {
|
|
512
|
+
sendError(res, "bad-request");
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
snapshots.setViewScope("analytics", "request");
|
|
516
|
+
sendJson(res, 200, await snapshots.home({ range }));
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
if (rest.length === 2 && rest[0] === "projects") {
|
|
520
|
+
if (!requireMethods(req, res, ["GET", "HEAD"]))
|
|
521
|
+
return;
|
|
522
|
+
const projectId = rest[1] ?? "";
|
|
523
|
+
if (!isValidResourceId(projectId)) {
|
|
524
|
+
sendError(res, "bad-request");
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const range = parseRange(url);
|
|
528
|
+
if (range === undefined) {
|
|
529
|
+
sendError(res, "bad-request");
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
snapshots.setViewScope("analytics", "request");
|
|
533
|
+
sendJson(res, 200, await snapshots.project({ projectId, range }));
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
if (rest.length === 2 && rest[0] === "sessions") {
|
|
537
|
+
if (!requireMethods(req, res, ["GET", "HEAD"]))
|
|
538
|
+
return;
|
|
539
|
+
const sessionId = rest[1] ?? "";
|
|
540
|
+
if (!isValidResourceId(sessionId)) {
|
|
541
|
+
sendError(res, "bad-request");
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
snapshots.setViewScope("analytics", "request");
|
|
545
|
+
sendJson(res, 200, await snapshots.session({ sessionId }));
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
if (rest.length === 1 && rest[0] === "settings") {
|
|
549
|
+
if (!requireMethods(req, res, ["GET", "HEAD", "PUT"]))
|
|
550
|
+
return;
|
|
551
|
+
if (method === "PUT") {
|
|
552
|
+
const parsed = await readWriteJson(req, res);
|
|
553
|
+
if (!parsed.ok)
|
|
554
|
+
return;
|
|
555
|
+
const body = parsed.value;
|
|
556
|
+
if (!isRecord(body) ||
|
|
557
|
+
!hasExactKeys(body, ["patch", "expectedRevision"]) ||
|
|
558
|
+
!isRecord(body.patch) ||
|
|
559
|
+
typeof body.expectedRevision !== "string") {
|
|
560
|
+
sendError(res, "bad-request");
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
const patch = {};
|
|
564
|
+
for (const [key, value] of Object.entries(body.patch)) {
|
|
565
|
+
if (!isJsonValue(value)) {
|
|
566
|
+
sendError(res, "bad-request");
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
patch[key] = value;
|
|
570
|
+
}
|
|
571
|
+
const result = await options.settings.saveSettings({
|
|
572
|
+
patch,
|
|
573
|
+
expectedRevision: body.expectedRevision,
|
|
574
|
+
});
|
|
575
|
+
snapshots.notifySettingsChanged();
|
|
576
|
+
sendJson(res, 200, result);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
sendJson(res, 200, await options.settings.settings());
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
if (rest.length === 2 && rest[0] === "settings" && rest[1] === "import") {
|
|
583
|
+
if (!requireMethods(req, res, ["GET", "HEAD", "POST"]))
|
|
584
|
+
return;
|
|
585
|
+
if (method === "POST") {
|
|
586
|
+
const parsed = await readWriteJson(req, res);
|
|
587
|
+
if (!parsed.ok)
|
|
588
|
+
return;
|
|
589
|
+
const body = parsed.value;
|
|
590
|
+
if (!isRecord(body) ||
|
|
591
|
+
!hasExactKeys(body, ["expectedRevision"]) ||
|
|
592
|
+
typeof body.expectedRevision !== "string") {
|
|
593
|
+
sendError(res, "bad-request");
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
const result = await options.settings.importApply({
|
|
597
|
+
expectedRevision: body.expectedRevision,
|
|
598
|
+
});
|
|
599
|
+
snapshots.notifySettingsChanged();
|
|
600
|
+
sendJson(res, 200, result);
|
|
601
|
+
return;
|
|
602
|
+
}
|
|
603
|
+
sendJson(res, 200, await options.settings.importPreview());
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
if (rest.length === 2 && rest[0] === "settings" && rest[1] === "open") {
|
|
607
|
+
if (!requireMethods(req, res, ["POST"]))
|
|
608
|
+
return;
|
|
609
|
+
const parsed = await readWriteJson(req, res);
|
|
610
|
+
if (!parsed.ok)
|
|
611
|
+
return;
|
|
612
|
+
if (!isRecord(parsed.value) || !hasExactKeys(parsed.value, [])) {
|
|
613
|
+
sendError(res, "bad-request");
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
const open = options.settings.openSettingsFile;
|
|
617
|
+
if (!open) {
|
|
618
|
+
throw new GuiSettingsError("config-target-error", "Opening the settings file is not available");
|
|
619
|
+
}
|
|
620
|
+
await open();
|
|
621
|
+
sendJson(res, 200, { opened: true });
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
if (rest.length === 1 && rest[0] === "view") {
|
|
625
|
+
if (!requireMethods(req, res, ["PUT"]))
|
|
626
|
+
return;
|
|
627
|
+
const parsed = await readWriteJson(req, res);
|
|
628
|
+
if (!parsed.ok)
|
|
629
|
+
return;
|
|
630
|
+
const body = parsed.value;
|
|
631
|
+
if (!isRecord(body) ||
|
|
632
|
+
!hasExactKeys(body, ["scope"]) ||
|
|
633
|
+
(body.scope !== "quota" && body.scope !== "analytics")) {
|
|
634
|
+
sendError(res, "bad-request");
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
// The UI's active-surface signal; it stops analytics refresh while the
|
|
638
|
+
// quota view is open and resumes it on the analytics view.
|
|
639
|
+
snapshots.setViewScope(body.scope);
|
|
640
|
+
sendJson(res, 200, { scope: body.scope });
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (rest.length === 1 && rest[0] === "visibility") {
|
|
644
|
+
if (!requireMethods(req, res, ["PUT"]))
|
|
645
|
+
return;
|
|
646
|
+
const parsed = await readWriteJson(req, res);
|
|
647
|
+
if (!parsed.ok)
|
|
648
|
+
return;
|
|
649
|
+
const body = parsed.value;
|
|
650
|
+
if (!isRecord(body) ||
|
|
651
|
+
!hasExactKeys(body, ["hiddenCards", "hiddenRows", "expectedRevision"]) ||
|
|
652
|
+
!isStringArray(body.hiddenCards) ||
|
|
653
|
+
!isStringArray(body.hiddenRows) ||
|
|
654
|
+
typeof body.expectedRevision !== "string") {
|
|
655
|
+
sendError(res, "bad-request");
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
const result = await options.settings.saveVisibility({
|
|
659
|
+
hiddenCards: body.hiddenCards,
|
|
660
|
+
hiddenRows: body.hiddenRows,
|
|
661
|
+
expectedRevision: body.expectedRevision,
|
|
662
|
+
});
|
|
663
|
+
snapshots.notifySettingsChanged({ scope: "visibility" });
|
|
664
|
+
sendJson(res, 200, result);
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
if (rest.length === 1 && rest[0] === "events") {
|
|
668
|
+
if (!requireMethods(req, res, ["GET"]))
|
|
669
|
+
return;
|
|
670
|
+
sse.attach(res);
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
sendError(res, "not-found");
|
|
674
|
+
}
|
|
675
|
+
async function handleRequest(req, res) {
|
|
676
|
+
applyCommonHeaders(res);
|
|
677
|
+
try {
|
|
678
|
+
let url;
|
|
679
|
+
try {
|
|
680
|
+
url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
681
|
+
}
|
|
682
|
+
catch {
|
|
683
|
+
sendError(res, "bad-request");
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
if (!isAllowedHost(headerValue(req.headers.host), actualPort)) {
|
|
687
|
+
sendError(res, "bad-host");
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
const pathname = url.pathname;
|
|
691
|
+
if (pathname.startsWith("/api/")) {
|
|
692
|
+
await handleApi(req, res, url);
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
if (pathname.startsWith("/assets/")) {
|
|
696
|
+
if (!requireMethods(req, res, ["GET", "HEAD"]))
|
|
697
|
+
return;
|
|
698
|
+
// Serve relative to the static root so `/assets/x.js` maps to
|
|
699
|
+
// `<assetRoot>/assets/x.js` — the real `dist/ui` layout.
|
|
700
|
+
await serveAsset(res, pathname.slice(1), req.method === "HEAD");
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
// Check the raw request path too: WHATWG URL parsing normalizes dot
|
|
704
|
+
// segments and backslashes, which must not turn traversal into a UI route.
|
|
705
|
+
const rawPath = (req.url ?? "/").split("?")[0] ?? "/";
|
|
706
|
+
if (rawPath === pathname && isUiPath(pathname)) {
|
|
707
|
+
if (!requireMethods(req, res, ["GET", "HEAD"]))
|
|
708
|
+
return;
|
|
709
|
+
await serveAsset(res, "index.html", req.method === "HEAD");
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
sendError(res, "not-found");
|
|
713
|
+
}
|
|
714
|
+
catch (error) {
|
|
715
|
+
const mapped = mapError(error);
|
|
716
|
+
if (shouldLog(mapped.code)) {
|
|
717
|
+
logger.warn("dashboard request failed", `${mapped.status} ${mapped.code}`);
|
|
718
|
+
}
|
|
719
|
+
sendJson(res, mapped.status, mapped.body);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
const server = createServer((req, res) => {
|
|
723
|
+
void handleRequest(req, res);
|
|
724
|
+
});
|
|
725
|
+
let actualPort = options.port;
|
|
726
|
+
let closing;
|
|
727
|
+
let released;
|
|
728
|
+
/**
|
|
729
|
+
* Stops snapshot work and closes the optional source. Used by both the final
|
|
730
|
+
* server close and a terminal bind failure, so a worker/DB resource created
|
|
731
|
+
* by the source is never leaked. Idempotent and never rejects.
|
|
732
|
+
*/
|
|
733
|
+
function releaseResources() {
|
|
734
|
+
if (released)
|
|
735
|
+
return released;
|
|
736
|
+
try {
|
|
737
|
+
snapshots.close();
|
|
738
|
+
unsubscribe();
|
|
739
|
+
sse.close();
|
|
740
|
+
}
|
|
741
|
+
catch (error) {
|
|
742
|
+
logger.warn("dashboard release failed", isErrnoCode(error) ? error.code : "failed");
|
|
743
|
+
}
|
|
744
|
+
const closeSource = options.source.close;
|
|
745
|
+
released = closeSource
|
|
746
|
+
? Promise.resolve()
|
|
747
|
+
.then(() => closeSource())
|
|
748
|
+
.catch((error) => {
|
|
749
|
+
logger.warn("dashboard source close failed", isErrnoCode(error) ? error.code : "failed");
|
|
750
|
+
})
|
|
751
|
+
: Promise.resolve();
|
|
752
|
+
return released;
|
|
753
|
+
}
|
|
754
|
+
function close() {
|
|
755
|
+
if (closing)
|
|
756
|
+
return closing;
|
|
757
|
+
closing = (async () => {
|
|
758
|
+
const resources = releaseResources();
|
|
759
|
+
const killTimer = setTimeout(() => {
|
|
760
|
+
server.closeAllConnections();
|
|
761
|
+
}, 1000);
|
|
762
|
+
killTimer.unref();
|
|
763
|
+
await new Promise((resolve) => {
|
|
764
|
+
server.close(() => resolve());
|
|
765
|
+
server.closeIdleConnections();
|
|
766
|
+
});
|
|
767
|
+
clearTimeout(killTimer);
|
|
768
|
+
await resources;
|
|
769
|
+
})();
|
|
770
|
+
return closing;
|
|
771
|
+
}
|
|
772
|
+
return new Promise((resolve, reject) => {
|
|
773
|
+
const failBind = (reason) => {
|
|
774
|
+
logger.error("dashboard server unavailable", reason ?? "unknown");
|
|
775
|
+
// Terminal: no alternate port is attempted, and source resources created
|
|
776
|
+
// before the bind are released even though no handle was returned.
|
|
777
|
+
try {
|
|
778
|
+
server.close();
|
|
779
|
+
}
|
|
780
|
+
catch {
|
|
781
|
+
// The listener never started (bind error) or was already closed.
|
|
782
|
+
}
|
|
783
|
+
void releaseResources();
|
|
784
|
+
reject(new DashboardBindError(options.port, reason));
|
|
785
|
+
};
|
|
786
|
+
const onListenError = (error) => {
|
|
787
|
+
failBind(isErrnoCode(error) ? error.code : undefined);
|
|
788
|
+
};
|
|
789
|
+
server.once("error", onListenError);
|
|
790
|
+
try {
|
|
791
|
+
server.listen(options.port, "127.0.0.1", () => {
|
|
792
|
+
server.off("error", onListenError);
|
|
793
|
+
server.on("error", (error) => {
|
|
794
|
+
logger.error("dashboard server error", isErrnoCode(error) ? error.code : "unknown");
|
|
795
|
+
});
|
|
796
|
+
const address = server.address();
|
|
797
|
+
if (address === null || typeof address === "string") {
|
|
798
|
+
failBind("listen-failed");
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
actualPort = address.port;
|
|
802
|
+
resolve({
|
|
803
|
+
port: actualPort,
|
|
804
|
+
url: `http://127.0.0.1:${actualPort}`,
|
|
805
|
+
close,
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
catch (error) {
|
|
810
|
+
server.off("error", onListenError);
|
|
811
|
+
failBind(isErrnoCode(error) ? error.code : undefined);
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
//# sourceMappingURL=server.js.map
|