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/rpc.js
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed dashboard RPC transport (Stage 3).
|
|
3
|
+
*
|
|
4
|
+
* This adapter attaches to the host-owned `SnapshotService` and settings store
|
|
5
|
+
* from `lifecycle.ts`. It never constructs a source, snapshot service, worker or
|
|
6
|
+
* poller, so native-only, web-only, both and neither all share one runtime.
|
|
7
|
+
* Inputs are validated by the RPC definition; failures are mapped to the fixed
|
|
8
|
+
* transport error vocabulary without raw messages or private paths. No method
|
|
9
|
+
* accepts a filesystem path, credential, or workspace override: reads execute
|
|
10
|
+
* through the host's active owner and its configured workspace.
|
|
11
|
+
*
|
|
12
|
+
* Authorization is the host's: OpenCode applies its server-wide
|
|
13
|
+
* `Authorization` middleware to the RPC route (the normal CLI defaults to
|
|
14
|
+
* loopback plus a generated password; embedded/passwordless hosts rely on their
|
|
15
|
+
* embedder). No caller identity or per-method permission is exposed to a
|
|
16
|
+
* handler (2.0.16 `RpcCallContext` has only `signal` and `error`), so this
|
|
17
|
+
* transport does not invent a second permission model. Settings writes keep
|
|
18
|
+
* their optimistic `expectedRevision` guard but rely on the host's server-level
|
|
19
|
+
* access control.
|
|
20
|
+
*/
|
|
21
|
+
import { BUILD_IDENTITY } from "../contracts/build-identity.js";
|
|
22
|
+
import { DASHBOARD_HEALTH, DashboardRpc, } from "../rpc.js";
|
|
23
|
+
import { GuiSettingsError } from "./config.js";
|
|
24
|
+
import { DASHBOARD_ERROR_MESSAGES, isDashboardSourceErrorCode, sanitizeDashboardErrorDetails, } from "./dashboard-errors.js";
|
|
25
|
+
import { createGuiLogger } from "./log.js";
|
|
26
|
+
/**
|
|
27
|
+
* Collision-safe transport key for the full location. JSON array encoding keeps
|
|
28
|
+
* the two components distinct even when a directory or id contains separators,
|
|
29
|
+
* and distinguishes an absent workspace from a present one.
|
|
30
|
+
*/
|
|
31
|
+
function locationKey(location) {
|
|
32
|
+
return location === undefined
|
|
33
|
+
? "none"
|
|
34
|
+
: JSON.stringify([location.directory, location.workspaceID ?? null]);
|
|
35
|
+
}
|
|
36
|
+
const SHARED_REGISTRY_KEY = Symbol.for("opencode-quota-gui/dashboard-rpc-registry/v3");
|
|
37
|
+
/**
|
|
38
|
+
* Process-wide (and module-graph-wide) sharing of the snapshot subscription per
|
|
39
|
+
* host snapshot owner and location. The lifecycle already shares the source,
|
|
40
|
+
* settings store and `SnapshotService`; each lease receives a fresh runtime
|
|
41
|
+
* wrapper around those objects, so the snapshot service is the stable identity.
|
|
42
|
+
*/
|
|
43
|
+
function sharedRegistry() {
|
|
44
|
+
const globalState = globalThis;
|
|
45
|
+
const existing = globalState[SHARED_REGISTRY_KEY];
|
|
46
|
+
if (existing)
|
|
47
|
+
return existing;
|
|
48
|
+
const registry = new WeakMap();
|
|
49
|
+
globalState[SHARED_REGISTRY_KEY] = registry;
|
|
50
|
+
return registry;
|
|
51
|
+
}
|
|
52
|
+
const SETTINGS_ERROR_CODES = new Set([
|
|
53
|
+
"config-read-error",
|
|
54
|
+
"config-changed",
|
|
55
|
+
"config-target-error",
|
|
56
|
+
"config-write-error",
|
|
57
|
+
"unknown-setting",
|
|
58
|
+
"invalid-setting",
|
|
59
|
+
]);
|
|
60
|
+
function controlledCode(error) {
|
|
61
|
+
if (error === null || typeof error !== "object" || !("code" in error))
|
|
62
|
+
return undefined;
|
|
63
|
+
return typeof error.code === "string" ? error.code : undefined;
|
|
64
|
+
}
|
|
65
|
+
function errorDetails(error) {
|
|
66
|
+
if (error === null || typeof error !== "object" || !("details" in error))
|
|
67
|
+
return undefined;
|
|
68
|
+
const details = error.details;
|
|
69
|
+
if (details === null || typeof details !== "object")
|
|
70
|
+
return undefined;
|
|
71
|
+
const result = {};
|
|
72
|
+
if ("key" in details && typeof details.key === "string")
|
|
73
|
+
result.key = details.key;
|
|
74
|
+
if ("reason" in details && typeof details.reason === "string")
|
|
75
|
+
result.reason = details.reason;
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
/** Maps a controlled or unexpected failure to the RPC error vocabulary. */
|
|
79
|
+
function mapRpcError(error) {
|
|
80
|
+
const code = error instanceof GuiSettingsError ? error.code : controlledCode(error);
|
|
81
|
+
if (code !== undefined && (isDashboardSourceErrorCode(code) || SETTINGS_ERROR_CODES.has(code))) {
|
|
82
|
+
// SAFETY: both membership checks above only admit codes from the shared
|
|
83
|
+
// dashboard error vocabulary, all of which the RPC map declares.
|
|
84
|
+
const safeCode = code;
|
|
85
|
+
return {
|
|
86
|
+
// SAFETY: every code admitted above is one of the dashboard RPC error keys.
|
|
87
|
+
code: safeCode,
|
|
88
|
+
message: DASHBOARD_ERROR_MESSAGES[safeCode],
|
|
89
|
+
details: sanitizeDashboardErrorDetails(safeCode, errorDetails(error)) ?? {},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
code: "internal",
|
|
94
|
+
message: DASHBOARD_ERROR_MESSAGES.internal,
|
|
95
|
+
details: {},
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The error factory is typed per method, but every dashboard method declares
|
|
100
|
+
* the same controlled vocabulary. The safety assertion only narrows the
|
|
101
|
+
* already-validated shared code to that method's error-name union.
|
|
102
|
+
*/
|
|
103
|
+
function failure(context, error) {
|
|
104
|
+
const mapped = mapRpcError(error);
|
|
105
|
+
// SAFETY: every dashboard method declares the shared error map, so its
|
|
106
|
+
// factory accepts exactly the controlled code/message/details triple below.
|
|
107
|
+
const factory = context.error;
|
|
108
|
+
return factory(mapped.code, mapped.message, mapped.details);
|
|
109
|
+
}
|
|
110
|
+
async function guard(context, run) {
|
|
111
|
+
try {
|
|
112
|
+
return await run();
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
return failure(context, error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function waitForAbort(signal, onStop) {
|
|
119
|
+
return new Promise((resolve) => {
|
|
120
|
+
let settled = false;
|
|
121
|
+
const finish = () => {
|
|
122
|
+
if (settled)
|
|
123
|
+
return;
|
|
124
|
+
settled = true;
|
|
125
|
+
signal.removeEventListener("abort", finish);
|
|
126
|
+
resolve();
|
|
127
|
+
};
|
|
128
|
+
onStop(finish);
|
|
129
|
+
if (signal.aborted)
|
|
130
|
+
finish();
|
|
131
|
+
else
|
|
132
|
+
signal.addEventListener("abort", finish, { once: true });
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function createHandlers(runtime, heldWatches) {
|
|
136
|
+
async function watch(input, context) {
|
|
137
|
+
return guard(context, async () => {
|
|
138
|
+
const viewer = runtime.snapshots.addScopedViewer(input.scope);
|
|
139
|
+
let stopped = false;
|
|
140
|
+
let stop = () => { };
|
|
141
|
+
await waitForAbort(context.signal, (finish) => {
|
|
142
|
+
stop = () => {
|
|
143
|
+
if (stopped)
|
|
144
|
+
return;
|
|
145
|
+
stopped = true;
|
|
146
|
+
heldWatches.delete(stop);
|
|
147
|
+
finish();
|
|
148
|
+
viewer.release();
|
|
149
|
+
};
|
|
150
|
+
heldWatches.add(stop);
|
|
151
|
+
});
|
|
152
|
+
stop();
|
|
153
|
+
return { active: false };
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const handlers = {
|
|
157
|
+
health: async () => ({
|
|
158
|
+
...DASHBOARD_HEALTH,
|
|
159
|
+
version: BUILD_IDENTITY.version,
|
|
160
|
+
build: BUILD_IDENTITY.build,
|
|
161
|
+
}),
|
|
162
|
+
quota: (_input, context) => guard(context, () => runtime.snapshots.quota()),
|
|
163
|
+
home: (input, context) => guard(context, () => runtime.snapshots.home(input)),
|
|
164
|
+
groups: (input, context) => guard(context, () => runtime.snapshots.groups(input)),
|
|
165
|
+
project: (input, context) => guard(context, () => runtime.snapshots.project(input)),
|
|
166
|
+
session: (input, context) => guard(context, () => runtime.snapshots.session(input)),
|
|
167
|
+
settings: (_input, context) => guard(context, () => runtime.settings.settings()),
|
|
168
|
+
saveSettings: (input, context) => guard(context, async () => {
|
|
169
|
+
const result = await runtime.settings.saveSettings(input);
|
|
170
|
+
runtime.snapshots.notifySettingsChanged();
|
|
171
|
+
return result;
|
|
172
|
+
}),
|
|
173
|
+
saveVisibility: (input, context) => guard(context, async () => {
|
|
174
|
+
const result = await runtime.settings.saveVisibility(input);
|
|
175
|
+
runtime.snapshots.notifySettingsChanged({ scope: "visibility" });
|
|
176
|
+
return result;
|
|
177
|
+
}),
|
|
178
|
+
importPreview: (_input, context) => guard(context, () => runtime.settings.importPreview()),
|
|
179
|
+
importApply: (input, context) => guard(context, async () => {
|
|
180
|
+
const result = await runtime.settings.importApply(input);
|
|
181
|
+
runtime.snapshots.notifySettingsChanged();
|
|
182
|
+
return result;
|
|
183
|
+
}),
|
|
184
|
+
openSettingsFile: (_input, context) => guard(context, async () => {
|
|
185
|
+
const open = runtime.settings.openSettingsFile;
|
|
186
|
+
if (!open) {
|
|
187
|
+
throw new GuiSettingsError("config-target-error", "Opening the settings file is not available");
|
|
188
|
+
}
|
|
189
|
+
await open();
|
|
190
|
+
return { opened: true };
|
|
191
|
+
}),
|
|
192
|
+
watch,
|
|
193
|
+
};
|
|
194
|
+
return handlers;
|
|
195
|
+
}
|
|
196
|
+
/** Adds a setup's registration to the shared entry, creating its subscription once. */
|
|
197
|
+
function joinSharedEntry(snapshots, key, member, notifications) {
|
|
198
|
+
const registry = sharedRegistry();
|
|
199
|
+
let byKey = registry.get(snapshots);
|
|
200
|
+
if (!byKey) {
|
|
201
|
+
byKey = new Map();
|
|
202
|
+
registry.set(snapshots, byKey);
|
|
203
|
+
}
|
|
204
|
+
const existing = byKey.get(key);
|
|
205
|
+
if (existing) {
|
|
206
|
+
existing.members.push(member);
|
|
207
|
+
attachNotificationSubscription(existing, notifications);
|
|
208
|
+
return existing;
|
|
209
|
+
}
|
|
210
|
+
let entry;
|
|
211
|
+
const unsubscribe = snapshots.subscribe((event) => {
|
|
212
|
+
if (entry)
|
|
213
|
+
emitInvalidation(entry, event);
|
|
214
|
+
});
|
|
215
|
+
entry = { members: [member], unsubscribe };
|
|
216
|
+
byKey.set(key, entry);
|
|
217
|
+
attachNotificationSubscription(entry, notifications);
|
|
218
|
+
return entry;
|
|
219
|
+
}
|
|
220
|
+
function attachNotificationSubscription(entry, notifications) {
|
|
221
|
+
if (!notifications || entry.unsubscribeNotifications)
|
|
222
|
+
return;
|
|
223
|
+
entry.unsubscribeNotifications = notifications.subscribe((data) => {
|
|
224
|
+
emitQuotaNotification(entry, data);
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/** Delivers one invalidation through the first registration this setup owns. */
|
|
228
|
+
function emitInvalidation(entry, event) {
|
|
229
|
+
const member = entry.members.find((candidate) => candidate.alive);
|
|
230
|
+
if (member === undefined)
|
|
231
|
+
return;
|
|
232
|
+
const data = { topic: event.topic, at: event.at };
|
|
233
|
+
if (event.scope !== undefined)
|
|
234
|
+
data.scope = event.scope;
|
|
235
|
+
// Events are live-only; a disconnected client re-subscribes and refetches.
|
|
236
|
+
// A disposed SDK emitter still publishes, so this does not branch on failure.
|
|
237
|
+
void member.registration.events.emit("invalidated", data).catch(() => undefined);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Delivers one safe quota notification on its own event. One emission is enough:
|
|
241
|
+
* the host event bus fans it out to every app window, each with the same id.
|
|
242
|
+
*/
|
|
243
|
+
function emitQuotaNotification(entry, data) {
|
|
244
|
+
const member = entry.members.find((candidate) => candidate.alive);
|
|
245
|
+
if (member === undefined)
|
|
246
|
+
return;
|
|
247
|
+
void member.registration.events.emit("quotaNotification", data).catch(() => undefined);
|
|
248
|
+
}
|
|
249
|
+
/** Releases one setup's held viewers and, on the last member, the subscription. */
|
|
250
|
+
function leaveSharedEntry(snapshots, key, entry, member) {
|
|
251
|
+
if (!member.alive)
|
|
252
|
+
return;
|
|
253
|
+
member.alive = false;
|
|
254
|
+
const index = entry.members.indexOf(member);
|
|
255
|
+
if (index >= 0)
|
|
256
|
+
entry.members.splice(index, 1);
|
|
257
|
+
for (const stop of Array.from(member.heldWatches))
|
|
258
|
+
stop();
|
|
259
|
+
member.heldWatches.clear();
|
|
260
|
+
if (entry.members.length > 0)
|
|
261
|
+
return;
|
|
262
|
+
entry.unsubscribe();
|
|
263
|
+
entry.unsubscribeNotifications?.();
|
|
264
|
+
entry.unsubscribeNotifications = undefined;
|
|
265
|
+
const byKey = sharedRegistry().get(snapshots);
|
|
266
|
+
if (byKey?.get(key) === entry)
|
|
267
|
+
byKey.delete(key);
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Registers one setup's dashboard contract in that setup's SDK scope and joins
|
|
271
|
+
* the shared snapshot subscription for its location. Duplicate setups with the
|
|
272
|
+
* same host runtime and location still produce one invalidation per snapshot
|
|
273
|
+
* change, but each owns its registration, so an SDK scope finalizer can dispose
|
|
274
|
+
* one setup without affecting the others. The returned lease releases its own
|
|
275
|
+
* viewers and registration; the final lease releases the shared subscription.
|
|
276
|
+
*/
|
|
277
|
+
export async function registerDashboardRpc(rpc, runtime, options = {}) {
|
|
278
|
+
const logger = options.logger ?? createGuiLogger();
|
|
279
|
+
const key = locationKey(options.location);
|
|
280
|
+
const heldWatches = new Set();
|
|
281
|
+
const registration = await rpc.register(DashboardRpc, createHandlers(runtime, heldWatches));
|
|
282
|
+
const member = { registration, heldWatches, alive: true };
|
|
283
|
+
const entry = joinSharedEntry(runtime.snapshots, key, member, runtime.quotaNotifications);
|
|
284
|
+
let disposed = false;
|
|
285
|
+
return {
|
|
286
|
+
events: registration.events,
|
|
287
|
+
dispose: async () => {
|
|
288
|
+
if (disposed)
|
|
289
|
+
return;
|
|
290
|
+
disposed = true;
|
|
291
|
+
leaveSharedEntry(runtime.snapshots, key, entry, member);
|
|
292
|
+
try {
|
|
293
|
+
await registration.dispose();
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
logger.warn("dashboard RPC registration dispose failed", "failed");
|
|
297
|
+
throw error;
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=rpc.js.map
|
package/dist/gui/server.d.ts
CHANGED
|
@@ -4,30 +4,30 @@
|
|
|
4
4
|
* Loopback-only (`127.0.0.1`), Host/Origin/Sec-Fetch-Site hardening, no CORS,
|
|
5
5
|
* JSON writes behind a streamed 64 KiB cap, static assets contained to
|
|
6
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
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* and one scrubbed log line per failure. `createDashboardServer` is the web
|
|
8
|
+
* transport only: it receives the host-scoped `SnapshotService` and settings
|
|
9
|
+
* store from the lifecycle/runtime and never constructs or closes them. Tests
|
|
10
|
+
* pass in-memory dependencies and `port: 0`; production wires the P3 source,
|
|
11
|
+
* one per-host snapshot service and the P2 settings store on the default
|
|
12
|
+
* `4144` port.
|
|
11
13
|
*/
|
|
12
14
|
import { type GuiSettingsStore } from "../contracts/dashboard.js";
|
|
15
|
+
import { DASHBOARD_ERROR_STATUS, type DashboardErrorCode, type DashboardErrorDetails, DashboardHttpError } from "./dashboard-errors.js";
|
|
13
16
|
import { type GuiLogger } from "./log.js";
|
|
14
|
-
import {
|
|
17
|
+
import type { SnapshotService } from "./snapshot-service.js";
|
|
18
|
+
export { DASHBOARD_ERROR_STATUS, DashboardHttpError, type DashboardErrorCode, type DashboardErrorDetails, };
|
|
15
19
|
export interface DashboardServerOptions {
|
|
16
20
|
/** `0` binds an ephemeral port (tests); production passes the configured port. */
|
|
17
21
|
port: number;
|
|
18
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The host-scoped shared snapshot service. The lifecycle/runtime owns its
|
|
24
|
+
* cache, pollers and final close; the HTTP transport only attaches viewers
|
|
25
|
+
* and reads it.
|
|
26
|
+
*/
|
|
27
|
+
snapshots: SnapshotService;
|
|
19
28
|
settings: GuiSettingsStore;
|
|
20
29
|
/** Static root; defaults to `<package>/dist/ui` derived from this module. */
|
|
21
30
|
assetRoot?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Existing quota poll interval (positive config value, no new floor) or a
|
|
24
|
-
* getter re-read on settings changes. Analytics has its own interval below.
|
|
25
|
-
*/
|
|
26
|
-
minIntervalMs?: number | (() => number);
|
|
27
|
-
/** Explicit quota interval; wins over `minIntervalMs`. */
|
|
28
|
-
quotaIntervalMs?: number | (() => number);
|
|
29
|
-
/** Analytics poll interval; defaults to 600000ms. */
|
|
30
|
-
analyticsIntervalMs?: number | (() => number);
|
|
31
31
|
/** SSE heartbeat override (test seam; default 20 s). */
|
|
32
32
|
heartbeatMs?: number;
|
|
33
33
|
logger?: GuiLogger;
|
|
@@ -37,18 +37,6 @@ export interface DashboardServerHandle {
|
|
|
37
37
|
url: string;
|
|
38
38
|
close(): Promise<void>;
|
|
39
39
|
}
|
|
40
|
-
export type DashboardErrorCode = "bad-request" | "bad-host" | "bad-origin" | "unsupported-media-type" | "body-too-large" | "method-not-allowed" | "not-found" | "config-read-error" | "config-changed" | "config-target-error" | "config-write-error" | "unknown-setting" | "invalid-setting" | "project-not-found" | "session-not-found" | "internal";
|
|
41
|
-
export interface DashboardErrorDetails {
|
|
42
|
-
reason?: string;
|
|
43
|
-
key?: string;
|
|
44
|
-
}
|
|
45
|
-
/** Status mapping from spec §5.3. */
|
|
46
|
-
export declare const DASHBOARD_ERROR_STATUS: Readonly<Record<DashboardErrorCode, number>>;
|
|
47
|
-
/** A controlled condition the source or a store wants surfaced verbatim-ish. */
|
|
48
|
-
export declare class DashboardHttpError extends Error {
|
|
49
|
-
readonly code: DashboardErrorCode;
|
|
50
|
-
constructor(code: DashboardErrorCode);
|
|
51
|
-
}
|
|
52
40
|
/** Structured bind failure: terminal, no alternate port is ever attempted. */
|
|
53
41
|
export declare class DashboardBindError extends Error {
|
|
54
42
|
readonly code = "unavailable";
|
package/dist/gui/server.js
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* Loopback-only (`127.0.0.1`), Host/Origin/Sec-Fetch-Site hardening, no CORS,
|
|
5
5
|
* JSON writes behind a streamed 64 KiB cap, static assets contained to
|
|
6
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
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* and one scrubbed log line per failure. `createDashboardServer` is the web
|
|
8
|
+
* transport only: it receives the host-scoped `SnapshotService` and settings
|
|
9
|
+
* store from the lifecycle/runtime and never constructs or closes them. Tests
|
|
10
|
+
* pass in-memory dependencies and `port: 0`; production wires the P3 source,
|
|
11
|
+
* one per-host snapshot service and the P2 settings store on the default
|
|
12
|
+
* `4144` port.
|
|
11
13
|
*/
|
|
12
14
|
import { readFile, realpath, stat } from "node:fs/promises";
|
|
13
15
|
import { createServer } from "node:http";
|
|
@@ -18,55 +20,10 @@ import { BUILD_IDENTITY } from "../contracts/build-identity.js";
|
|
|
18
20
|
import { DASHBOARD_CONTRACT_VERSION, } from "../contracts/dashboard.js";
|
|
19
21
|
import { DEFAULT_RANGE_KEY, isRangeKey } from "../contracts/ranges.js";
|
|
20
22
|
import { GuiSettingsError } from "./config.js";
|
|
23
|
+
import { DASHBOARD_ERROR_MESSAGES, DASHBOARD_ERROR_STATUS, DashboardHttpError, sanitizeDashboardErrorDetails, structuralDashboardSourceCode, } from "./dashboard-errors.js";
|
|
21
24
|
import { createGuiLogger } from "./log.js";
|
|
22
|
-
import { createSnapshotService } from "./snapshot-service.js";
|
|
23
25
|
import { createSseHub } from "./sse.js";
|
|
24
|
-
|
|
25
|
-
export const DASHBOARD_ERROR_STATUS = {
|
|
26
|
-
"bad-request": 400,
|
|
27
|
-
"bad-host": 403,
|
|
28
|
-
"bad-origin": 403,
|
|
29
|
-
"unsupported-media-type": 415,
|
|
30
|
-
"body-too-large": 413,
|
|
31
|
-
"method-not-allowed": 405,
|
|
32
|
-
"not-found": 404,
|
|
33
|
-
"config-read-error": 409,
|
|
34
|
-
"config-changed": 409,
|
|
35
|
-
"config-target-error": 409,
|
|
36
|
-
"config-write-error": 500,
|
|
37
|
-
"unknown-setting": 422,
|
|
38
|
-
"invalid-setting": 422,
|
|
39
|
-
"project-not-found": 404,
|
|
40
|
-
"session-not-found": 404,
|
|
41
|
-
internal: 500,
|
|
42
|
-
};
|
|
43
|
-
const DASHBOARD_ERROR_MESSAGES = {
|
|
44
|
-
"bad-request": "Malformed request",
|
|
45
|
-
"bad-host": "Requests must target the dashboard loopback address",
|
|
46
|
-
"bad-origin": "Writes must originate from the dashboard page",
|
|
47
|
-
"unsupported-media-type": "Writes require application/json",
|
|
48
|
-
"body-too-large": "Request body exceeds the 64 KiB limit",
|
|
49
|
-
"method-not-allowed": "Method not allowed",
|
|
50
|
-
"not-found": "Not found",
|
|
51
|
-
"config-read-error": "The dashboard config file is not valid JSONC",
|
|
52
|
-
"config-changed": "Config changed since the last revision",
|
|
53
|
-
"config-target-error": "The dashboard config path is not writable",
|
|
54
|
-
"config-write-error": "Config write failed",
|
|
55
|
-
"unknown-setting": "Unknown setting",
|
|
56
|
-
"invalid-setting": "Invalid setting",
|
|
57
|
-
"project-not-found": "Project not found",
|
|
58
|
-
"session-not-found": "Session not found",
|
|
59
|
-
internal: "Internal dashboard error",
|
|
60
|
-
};
|
|
61
|
-
/** A controlled condition the source or a store wants surfaced verbatim-ish. */
|
|
62
|
-
export class DashboardHttpError extends Error {
|
|
63
|
-
code;
|
|
64
|
-
constructor(code) {
|
|
65
|
-
super(DASHBOARD_ERROR_MESSAGES[code]);
|
|
66
|
-
this.name = "DashboardHttpError";
|
|
67
|
-
this.code = code;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
26
|
+
export { DASHBOARD_ERROR_STATUS, DashboardHttpError, };
|
|
70
27
|
/** Structured bind failure: terminal, no alternate port is ever attempted. */
|
|
71
28
|
export class DashboardBindError extends Error {
|
|
72
29
|
code = "unavailable";
|
|
@@ -90,23 +47,6 @@ const ASSET_CONTENT_TYPES = new Map([
|
|
|
90
47
|
[".woff2", "font/woff2"],
|
|
91
48
|
[".ttf", "font/ttf"],
|
|
92
49
|
]);
|
|
93
|
-
const SOURCE_ERROR_CODES = new Set([
|
|
94
|
-
"bad-request",
|
|
95
|
-
"project-not-found",
|
|
96
|
-
"session-not-found",
|
|
97
|
-
]);
|
|
98
|
-
/** The set above is the vocabulary; trust it as the membership proof. */
|
|
99
|
-
function isSourceErrorCode(value) {
|
|
100
|
-
return SOURCE_ERROR_CODES.has(value);
|
|
101
|
-
}
|
|
102
|
-
const TARGET_REASONS = new Set([
|
|
103
|
-
"dangling",
|
|
104
|
-
"loop",
|
|
105
|
-
"depth",
|
|
106
|
-
"non-regular",
|
|
107
|
-
"permission",
|
|
108
|
-
]);
|
|
109
|
-
const SETTING_KEY_RE = /^[A-Za-z][A-Za-z0-9]*(\.[A-Za-z][A-Za-z0-9]*)*$/;
|
|
110
50
|
const MAX_RESOURCE_ID_LENGTH = 256;
|
|
111
51
|
function envelope(code, details) {
|
|
112
52
|
const error = {
|
|
@@ -121,30 +61,6 @@ function envelope(code, details) {
|
|
|
121
61
|
body: { error },
|
|
122
62
|
};
|
|
123
63
|
}
|
|
124
|
-
function sanitizedDetails(code, input) {
|
|
125
|
-
if (!input)
|
|
126
|
-
return undefined;
|
|
127
|
-
const details = {};
|
|
128
|
-
// `details.reason` is forwarded for `config-target-error` only, and only from
|
|
129
|
-
// the allowlisted target-reason vocabulary; other codes never carry it.
|
|
130
|
-
if (code === "config-target-error" &&
|
|
131
|
-
input.reason !== undefined &&
|
|
132
|
-
TARGET_REASONS.has(input.reason)) {
|
|
133
|
-
details.reason = input.reason;
|
|
134
|
-
}
|
|
135
|
-
if (input.key !== undefined && input.key.length <= 64 && SETTING_KEY_RE.test(input.key)) {
|
|
136
|
-
details.key = input.key;
|
|
137
|
-
}
|
|
138
|
-
return Object.keys(details).length > 0 ? details : undefined;
|
|
139
|
-
}
|
|
140
|
-
function structuralSourceCode(error) {
|
|
141
|
-
if (error === null || typeof error !== "object" || !("code" in error))
|
|
142
|
-
return undefined;
|
|
143
|
-
const code = error.code;
|
|
144
|
-
if (typeof code !== "string" || !isSourceErrorCode(code))
|
|
145
|
-
return undefined;
|
|
146
|
-
return code;
|
|
147
|
-
}
|
|
148
64
|
/**
|
|
149
65
|
* Raw exceptions never reach the wire: known controlled errors keep their code,
|
|
150
66
|
* everything else is a generic 500. GuiSettingsError messages are not
|
|
@@ -152,12 +68,12 @@ function structuralSourceCode(error) {
|
|
|
152
68
|
*/
|
|
153
69
|
function mapError(error) {
|
|
154
70
|
if (error instanceof GuiSettingsError) {
|
|
155
|
-
return envelope(error.code,
|
|
71
|
+
return envelope(error.code, sanitizeDashboardErrorDetails(error.code, error.details));
|
|
156
72
|
}
|
|
157
73
|
if (error instanceof DashboardHttpError) {
|
|
158
74
|
return envelope(error.code, undefined);
|
|
159
75
|
}
|
|
160
|
-
const sourceCode =
|
|
76
|
+
const sourceCode = structuralDashboardSourceCode(error);
|
|
161
77
|
if (sourceCode)
|
|
162
78
|
return envelope(sourceCode, undefined);
|
|
163
79
|
return envelope("internal", undefined);
|
|
@@ -355,13 +271,7 @@ function isErrnoCode(error) {
|
|
|
355
271
|
const DEFAULT_ASSET_ROOT = fileURLToPath(new URL("../../dist/ui/", import.meta.url));
|
|
356
272
|
export function createDashboardServer(options) {
|
|
357
273
|
const logger = options.logger ?? createGuiLogger();
|
|
358
|
-
const snapshots =
|
|
359
|
-
source: options.source,
|
|
360
|
-
minIntervalMs: options.minIntervalMs,
|
|
361
|
-
quotaIntervalMs: options.quotaIntervalMs,
|
|
362
|
-
analyticsIntervalMs: options.analyticsIntervalMs,
|
|
363
|
-
logger,
|
|
364
|
-
});
|
|
274
|
+
const snapshots = options.snapshots;
|
|
365
275
|
let releaseViewer;
|
|
366
276
|
const sse = createSseHub({
|
|
367
277
|
heartbeatMs: options.heartbeatMs,
|
|
@@ -786,38 +696,30 @@ export function createDashboardServer(options) {
|
|
|
786
696
|
});
|
|
787
697
|
let actualPort = options.port;
|
|
788
698
|
let closing;
|
|
789
|
-
let released;
|
|
699
|
+
let released = false;
|
|
790
700
|
/**
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
* by the
|
|
701
|
+
* Detaches this transport: stop broadcasting to the shared service and end
|
|
702
|
+
* SSE clients (releasing the viewer). The snapshot service and source are
|
|
703
|
+
* caller-owned and are released by the lifecycle when the last lease disposes,
|
|
704
|
+
* including after a terminal bind failure. Idempotent and never rejects.
|
|
794
705
|
*/
|
|
795
706
|
function releaseResources() {
|
|
796
707
|
if (released)
|
|
797
|
-
return
|
|
708
|
+
return;
|
|
709
|
+
released = true;
|
|
798
710
|
try {
|
|
799
|
-
snapshots.close();
|
|
800
711
|
unsubscribe();
|
|
801
712
|
sse.close();
|
|
802
713
|
}
|
|
803
714
|
catch (error) {
|
|
804
715
|
logger.warn("dashboard release failed", isErrnoCode(error) ? error.code : "failed");
|
|
805
716
|
}
|
|
806
|
-
const closeSource = options.source.close;
|
|
807
|
-
released = closeSource
|
|
808
|
-
? Promise.resolve()
|
|
809
|
-
.then(() => closeSource())
|
|
810
|
-
.catch((error) => {
|
|
811
|
-
logger.warn("dashboard source close failed", isErrnoCode(error) ? error.code : "failed");
|
|
812
|
-
})
|
|
813
|
-
: Promise.resolve();
|
|
814
|
-
return released;
|
|
815
717
|
}
|
|
816
718
|
function close() {
|
|
817
719
|
if (closing)
|
|
818
720
|
return closing;
|
|
819
721
|
closing = (async () => {
|
|
820
|
-
|
|
722
|
+
releaseResources();
|
|
821
723
|
const killTimer = setTimeout(() => {
|
|
822
724
|
server.closeAllConnections();
|
|
823
725
|
}, 1000);
|
|
@@ -827,22 +729,22 @@ export function createDashboardServer(options) {
|
|
|
827
729
|
server.closeIdleConnections();
|
|
828
730
|
});
|
|
829
731
|
clearTimeout(killTimer);
|
|
830
|
-
await resources;
|
|
831
732
|
})();
|
|
832
733
|
return closing;
|
|
833
734
|
}
|
|
834
735
|
return new Promise((resolve, reject) => {
|
|
835
736
|
const failBind = (reason) => {
|
|
836
737
|
logger.error("dashboard server unavailable", reason ?? "unknown");
|
|
837
|
-
// Terminal: no alternate port is attempted
|
|
838
|
-
//
|
|
738
|
+
// Terminal: no alternate port is attempted. This transport detaches its
|
|
739
|
+
// SSE subscriber; the lifecycle keeps the shared snapshot service and
|
|
740
|
+
// sources alive for its remaining leases.
|
|
839
741
|
try {
|
|
840
742
|
server.close();
|
|
841
743
|
}
|
|
842
744
|
catch {
|
|
843
745
|
// The listener never started (bind error) or was already closed.
|
|
844
746
|
}
|
|
845
|
-
|
|
747
|
+
releaseResources();
|
|
846
748
|
reject(new DashboardBindError(options.port, reason));
|
|
847
749
|
};
|
|
848
750
|
const onListenError = (error) => {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Owns computation, caching, single-flight, viewer-scoped polling and
|
|
5
5
|
* invalidation. Cache keys are `(kind, resourceId, range)`; quota is its own
|
|
6
6
|
* key. Failures serve the last good snapshot with `stale: true` when one
|
|
7
|
-
* exists. Pollers run only while at least one
|
|
8
|
-
* never overlap within a kind.
|
|
7
|
+
* exists. Pollers run only while at least one transport viewer (SSE or RPC) is
|
|
8
|
+
* attached and ticks never overlap within a kind.
|
|
9
9
|
*
|
|
10
10
|
* Quota and analytics poll on independent timers: quota uses the existing
|
|
11
11
|
* positive `minIntervalMs` configuration (default 60000), analytics defaults
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
* newer one). A load on a closed service still computes for its caller but
|
|
33
33
|
* never touches tracking, registration, or cache.
|
|
34
34
|
*
|
|
35
|
+
* An owner/source handoff uses a source generation: entries retain the
|
|
36
|
+
* generation that produced them and old entries are last-good only. A
|
|
37
|
+
* pre-handoff result is marked stale when the DTO supports it, or failed when
|
|
38
|
+
* it does not (`SessionSnapshot`), so the previous owner's data is never
|
|
39
|
+
* presented as fresh.
|
|
40
|
+
*
|
|
35
41
|
* No TTL, sequence, watermark, or budget machinery exists (R9).
|
|
36
42
|
*/
|
|
37
43
|
import type { AnalyticsGroupQuery, AnalyticsGroupSnapshot, DashboardDataSource, DashboardEvent, HomeSnapshot, ProjectSnapshot, QuotaSnapshot, SessionSnapshot } from "../contracts/dashboard.js";
|
|
@@ -59,7 +65,7 @@ export declare const MAX_TRACKED_PAGES = 16;
|
|
|
59
65
|
* optional at this seam so older injected mocks keep compiling; production
|
|
60
66
|
* always provides it and `/api/v1/quota` returns a controlled 500 otherwise.
|
|
61
67
|
* `refreshAnalytics` is an optional shared worker refresh seam, and `close` is
|
|
62
|
-
* closed by the
|
|
68
|
+
* closed by the lifecycle when the last lease disposes, not by this service.
|
|
63
69
|
*/
|
|
64
70
|
export type SnapshotSource = Pick<DashboardDataSource, "home" | "project" | "session"> & {
|
|
65
71
|
quota?: DashboardDataSource["quota"];
|
|
@@ -92,6 +98,10 @@ export interface SnapshotServiceOptions {
|
|
|
92
98
|
* to `analytics` so clients that never signal keep the previous behaviour.
|
|
93
99
|
*/
|
|
94
100
|
export type SnapshotViewScope = "analytics" | "quota";
|
|
101
|
+
/** One viewer that carries its own active-surface scope. */
|
|
102
|
+
export interface SnapshotViewer {
|
|
103
|
+
release(): void;
|
|
104
|
+
}
|
|
95
105
|
export interface SnapshotService {
|
|
96
106
|
home(input: {
|
|
97
107
|
range: RangeKey;
|
|
@@ -107,8 +117,17 @@ export interface SnapshotService {
|
|
|
107
117
|
groups(query: AnalyticsGroupQuery): Promise<AnalyticsGroupSnapshot>;
|
|
108
118
|
/** Invalidations broadcast over SSE (three topics, never raw snapshots). */
|
|
109
119
|
subscribe(listener: (event: DashboardEvent) => void): () => void;
|
|
110
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Registers a legacy unscoped viewer (HTTP/SSE); the returned disposer
|
|
122
|
+
* detaches it. Its active surface comes from `setViewScope`.
|
|
123
|
+
*/
|
|
111
124
|
addViewer(): () => void;
|
|
125
|
+
/**
|
|
126
|
+
* Registers a viewer that carries its own active-surface scope (RPC/native).
|
|
127
|
+
* Concurrent viewers aggregate: analytics refresh runs while any viewer needs
|
|
128
|
+
* analytics, regardless of other viewers' quota signals.
|
|
129
|
+
*/
|
|
130
|
+
addScopedViewer(scope: SnapshotViewScope): SnapshotViewer;
|
|
112
131
|
/**
|
|
113
132
|
* A settings write: clears quota/home/project caches and broadcasts
|
|
114
133
|
* `settings.changed`. `scope: "visibility"` only broadcasts (no invalidation,
|
|
@@ -124,6 +143,14 @@ export interface SnapshotService {
|
|
|
124
143
|
* while the scope is `quota`, analytics refresh/derivation is skipped.
|
|
125
144
|
*/
|
|
126
145
|
setViewScope(scope: SnapshotViewScope, origin?: "signal" | "request"): void;
|
|
146
|
+
/**
|
|
147
|
+
* The host's active source identity changed (owner handoff in the lifecycle).
|
|
148
|
+
* Cached pages belong to the previous owner, so they are marked stale; any
|
|
149
|
+
* pre-handoff in-flight result is never presented as fresh (stale-marked when
|
|
150
|
+
* the DTO supports it, otherwise failed), and both data topics are emitted so
|
|
151
|
+
* connected clients refetch through the new source.
|
|
152
|
+
*/
|
|
153
|
+
sourceChanged(): void;
|
|
127
154
|
close(): void;
|
|
128
155
|
}
|
|
129
156
|
export declare function createSnapshotService(options: SnapshotServiceOptions): SnapshotService;
|