opencode-quota-gui 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -34
- package/dist/contracts/analytics-entity.d.ts +6 -1
- package/dist/contracts/analytics-entity.js +27 -10
- package/dist/contracts/build-identity.js +1 -1
- package/dist/contracts/card-visibility.d.ts +21 -0
- package/dist/contracts/card-visibility.js +19 -0
- package/dist/contracts/dashboard.d.ts +35 -1
- package/dist/contracts/dashboard.js +2 -0
- package/dist/contracts/dto-guards.d.ts +24 -0
- package/dist/contracts/dto-guards.js +594 -0
- package/dist/contracts/openai-quota.d.ts +3 -0
- package/dist/contracts/openai-quota.js +3 -0
- package/dist/contracts/provider-failure.d.ts +18 -0
- package/dist/contracts/provider-failure.js +25 -0
- package/dist/data/modelsdev-temporal.min.json +57 -0
- package/dist/gui/config.d.ts +20 -3
- package/dist/gui/config.js +72 -4
- package/dist/gui/dashboard-errors.d.ts +32 -0
- package/dist/gui/dashboard-errors.js +97 -0
- package/dist/gui/lifecycle.d.ts +47 -12
- package/dist/gui/lifecycle.js +215 -37
- package/dist/gui/primary-quota-windows.d.ts +28 -0
- package/dist/gui/primary-quota-windows.js +149 -0
- package/dist/gui/provider-cards.d.ts +11 -3
- package/dist/gui/provider-cards.js +85 -33
- package/dist/gui/quota-notification-detector.d.ts +151 -0
- package/dist/gui/quota-notification-detector.js +318 -0
- package/dist/gui/quota-notification-observer.d.ts +54 -0
- package/dist/gui/quota-notification-observer.js +412 -0
- package/dist/gui/rpc.d.ts +61 -0
- package/dist/gui/rpc.js +310 -0
- package/dist/gui/server.d.ts +15 -27
- package/dist/gui/server.js +34 -123
- package/dist/gui/snapshot-service.d.ts +34 -5
- package/dist/gui/snapshot-service.js +301 -70
- package/dist/gui/sources.d.ts +1 -1
- package/dist/gui/sources.js +98 -56
- package/dist/gui-experimental.cjs +1761 -0
- package/dist/lib/accounting-format.js +8 -0
- package/dist/lib/alibaba-coding-plan-cli.d.ts +79 -0
- package/dist/lib/alibaba-coding-plan-cli.js +539 -0
- package/dist/lib/anthropic-auth.d.ts +2 -3
- package/dist/lib/anthropic-auth.js +2 -3
- package/dist/lib/anthropic.d.ts +53 -12
- package/dist/lib/anthropic.js +622 -270
- package/dist/lib/api-key-retry-after.d.ts +7 -0
- package/dist/lib/api-key-retry-after.js +62 -0
- package/dist/lib/atomic-json.d.ts +2 -0
- package/dist/lib/atomic-json.js +1 -0
- package/dist/lib/cache-observer-ingestion.d.ts +90 -0
- package/dist/lib/cache-observer-ingestion.js +981 -0
- package/dist/lib/cache-observer.d.ts +138 -0
- package/dist/lib/cache-observer.js +317 -0
- package/dist/lib/canonical-config-lock.d.ts +9 -0
- package/dist/lib/canonical-config-lock.js +36 -0
- package/dist/lib/chutes.js +63 -35
- package/dist/lib/claude-agent-transcript-ttl.d.ts +48 -0
- package/dist/lib/claude-agent-transcript-ttl.js +154 -0
- package/dist/lib/claude-agent-ttl-tracker.d.ts +21 -0
- package/dist/lib/claude-agent-ttl-tracker.js +152 -0
- package/dist/lib/cli-show.js +5 -3
- package/dist/lib/config-write-target.d.ts +1 -1
- package/dist/lib/config-write-target.js +5 -2
- package/dist/lib/config.d.ts +6 -1
- package/dist/lib/config.js +241 -2
- package/dist/lib/copilot.js +198 -85
- package/dist/lib/dashboard-web-policy.d.ts +35 -0
- package/dist/lib/dashboard-web-policy.js +24 -0
- package/dist/lib/deepseek.js +34 -11
- package/dist/lib/display-sanitize.js +3 -0
- package/dist/lib/entries.d.ts +26 -0
- package/dist/lib/entries.js +2 -0
- package/dist/lib/format-utils.d.ts +1 -1
- package/dist/lib/format-utils.js +2 -2
- package/dist/lib/glm-coding-plan.js +102 -68
- package/dist/lib/google-agy.js +147 -24
- package/dist/lib/google-gemini-cli.js +140 -23
- package/dist/lib/http.d.ts +4 -0
- package/dist/lib/http.js +16 -2
- package/dist/lib/init-installer.js +30 -7
- package/dist/lib/kilo.js +63 -55
- package/dist/lib/kimi.js +43 -14
- package/dist/lib/mimo.d.ts +4 -0
- package/dist/lib/mimo.js +45 -1
- package/dist/lib/nanogpt.d.ts +3 -0
- package/dist/lib/nanogpt.js +50 -6
- package/dist/lib/ollama-cloud.d.ts +1 -1
- package/dist/lib/ollama-cloud.js +51 -29
- package/dist/lib/openai.js +90 -40
- package/dist/lib/opencode-auth-sqlite.d.ts +2 -2
- package/dist/lib/opencode-auth-sqlite.js +2 -2
- package/dist/lib/opencode-auth.d.ts +3 -2
- package/dist/lib/opencode-auth.js +8 -1
- package/dist/lib/opencode-config-editor.d.ts +1 -0
- package/dist/lib/opencode-config-editor.js +6 -1
- package/dist/lib/opencode-go.js +53 -5
- package/dist/lib/opencode-version-core.d.ts +23 -0
- package/dist/lib/opencode-version-core.js +49 -0
- package/dist/lib/opencode-version.d.ts +4 -3
- package/dist/lib/opencode-version.js +15 -11
- package/dist/lib/opencode-zen.d.ts +12 -1
- package/dist/lib/opencode-zen.js +98 -12
- package/dist/lib/provider-add.js +5 -2
- package/dist/lib/provider-registration.d.ts +19 -9
- package/dist/lib/provider-registration.js +17 -6
- package/dist/lib/quota-command-format.js +1 -1
- package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
- package/dist/lib/quota-exhaustion-projection.js +25 -0
- package/dist/lib/quota-providers-remote.d.ts +4 -1
- package/dist/lib/quota-providers-remote.js +137 -22
- package/dist/lib/quota-providers.d.ts +1 -1
- package/dist/lib/quota-providers.js +12 -35
- package/dist/lib/quota-render-data.d.ts +6 -0
- package/dist/lib/quota-render-data.js +43 -17
- package/dist/lib/quota-reset-notifications.d.ts +17 -0
- package/dist/lib/quota-reset-notifications.js +11 -2
- package/dist/lib/quota-state-codec.js +19 -1
- package/dist/lib/quota-state.d.ts +7 -1
- package/dist/lib/quota-state.js +208 -34
- package/dist/lib/quota-stats.js +21 -0
- package/dist/lib/quota-status.js +3 -51
- package/dist/lib/scoped-update.d.ts +1 -1
- package/dist/lib/synthetic.js +67 -48
- package/dist/lib/types.d.ts +49 -1
- package/dist/lib/types.js +16 -0
- package/dist/lib/xai.js +64 -24
- package/dist/plugin.d.ts +4 -3
- package/dist/plugin.js +293 -16
- package/dist/provider-logos/NOTICE.md +1 -1
- package/dist/provider-logos/OPENCODE-NOTICE.md +4 -3
- package/dist/providers/alibaba-coding-plan.js +107 -102
- package/dist/providers/alibaba-token-plan.js +17 -0
- package/dist/providers/anthropic.d.ts +12 -3
- package/dist/providers/anthropic.js +71 -219
- package/dist/providers/cache-policies.d.ts +11 -4
- package/dist/providers/cache-policies.js +19 -13
- package/dist/providers/claude-agent.d.ts +19 -0
- package/dist/providers/claude-agent.js +196 -0
- package/dist/providers/copilot.js +12 -2
- package/dist/providers/glm-coding-plan-provider.d.ts +3 -0
- package/dist/providers/glm-coding-plan-provider.js +5 -1
- package/dist/providers/google-account-format.js +2 -0
- package/dist/providers/google-agy.d.ts +6 -5
- package/dist/providers/google-agy.js +55 -17
- package/dist/providers/google-gemini-cli.js +13 -2
- package/dist/providers/kilo.js +10 -1
- package/dist/providers/kimi-code.js +13 -6
- package/dist/providers/mimo.js +9 -2
- package/dist/providers/minimax-coding-plan.js +28 -5
- package/dist/providers/nanogpt.js +4 -0
- package/dist/providers/ollama-cloud.js +3 -0
- package/dist/providers/openai.js +1 -0
- package/dist/providers/opencode-go.js +11 -1
- package/dist/providers/opencode-zen.js +32 -3
- package/dist/providers/openrouter.js +4 -0
- package/dist/providers/quota-providers.js +46 -9
- package/dist/providers/registry.js +2 -0
- package/dist/providers/result-helpers.d.ts +6 -0
- package/dist/providers/result-helpers.js +18 -2
- package/dist/rpc.d.ts +440 -4
- package/dist/rpc.js +507 -2
- package/dist/ui/assets/{index-Cs-nrywz.css → index-BcueIm3Z.css} +1 -1
- package/dist/ui/assets/index-C6qRSoh8.js +10 -0
- package/dist/ui/assets/{popover-DKRrwr_K.js → popover-4bFSvRZ7.js} +1 -1
- package/dist/ui/assets/providers/claude-agent.svg +3 -0
- package/dist/ui/index.html +2 -2
- package/package.json +15 -7
- package/dist/bin/opencode-quota-gui.d.ts.map +0 -1
- package/dist/bin/opencode-quota-gui.js.map +0 -1
- package/dist/contracts/analytics-entity.d.ts.map +0 -1
- package/dist/contracts/analytics-entity.js.map +0 -1
- package/dist/contracts/analytics-temporal.d.ts.map +0 -1
- package/dist/contracts/analytics-temporal.js.map +0 -1
- package/dist/contracts/build-identity.d.ts.map +0 -1
- package/dist/contracts/card-order.d.ts.map +0 -1
- package/dist/contracts/card-order.js.map +0 -1
- package/dist/contracts/collision-safe-key.d.ts.map +0 -1
- package/dist/contracts/collision-safe-key.js.map +0 -1
- package/dist/contracts/dashboard.d.ts.map +0 -1
- package/dist/contracts/dashboard.js.map +0 -1
- package/dist/contracts/guards.d.ts.map +0 -1
- package/dist/contracts/guards.js.map +0 -1
- package/dist/contracts/identity.d.ts.map +0 -1
- package/dist/contracts/identity.js.map +0 -1
- package/dist/contracts/openai-quota.d.ts.map +0 -1
- package/dist/contracts/openai-quota.js.map +0 -1
- package/dist/contracts/ranges.d.ts.map +0 -1
- package/dist/contracts/ranges.js.map +0 -1
- package/dist/contracts/settings.d.ts.map +0 -1
- package/dist/contracts/settings.js.map +0 -1
- package/dist/contracts/temporal.d.ts.map +0 -1
- package/dist/contracts/temporal.js.map +0 -1
- package/dist/contracts/time-zone.d.ts.map +0 -1
- package/dist/contracts/time-zone.js.map +0 -1
- package/dist/gui/aggregation.d.ts.map +0 -1
- package/dist/gui/aggregation.js.map +0 -1
- package/dist/gui/analytics-bridge.d.ts.map +0 -1
- package/dist/gui/analytics-bridge.js.map +0 -1
- package/dist/gui/analytics-engine.d.ts.map +0 -1
- package/dist/gui/analytics-engine.js.map +0 -1
- package/dist/gui/analytics-indexes.d.ts.map +0 -1
- package/dist/gui/analytics-indexes.js.map +0 -1
- package/dist/gui/analytics-model.d.ts.map +0 -1
- package/dist/gui/analytics-model.js.map +0 -1
- package/dist/gui/analytics-pricing-revision.d.ts.map +0 -1
- package/dist/gui/analytics-pricing-revision.js.map +0 -1
- package/dist/gui/analytics-protocol.d.ts.map +0 -1
- package/dist/gui/analytics-protocol.js.map +0 -1
- package/dist/gui/analytics-reader.d.ts.map +0 -1
- package/dist/gui/analytics-reader.js.map +0 -1
- package/dist/gui/analytics-service.d.ts.map +0 -1
- package/dist/gui/analytics-service.js.map +0 -1
- package/dist/gui/analytics-state.d.ts.map +0 -1
- package/dist/gui/analytics-state.js.map +0 -1
- package/dist/gui/analytics-worker-runtime.d.ts.map +0 -1
- package/dist/gui/analytics-worker-runtime.js.map +0 -1
- package/dist/gui/analytics-worker.d.ts.map +0 -1
- package/dist/gui/analytics-worker.js.map +0 -1
- package/dist/gui/config.d.ts.map +0 -1
- package/dist/gui/config.js.map +0 -1
- package/dist/gui/identity.d.ts.map +0 -1
- package/dist/gui/identity.js.map +0 -1
- package/dist/gui/lifecycle.d.ts.map +0 -1
- package/dist/gui/lifecycle.js.map +0 -1
- package/dist/gui/log.d.ts.map +0 -1
- package/dist/gui/log.js.map +0 -1
- package/dist/gui/provider-cards.d.ts.map +0 -1
- package/dist/gui/provider-cards.js.map +0 -1
- package/dist/gui/server.d.ts.map +0 -1
- package/dist/gui/server.js.map +0 -1
- package/dist/gui/settings-file-opener.d.ts.map +0 -1
- package/dist/gui/settings-file-opener.js.map +0 -1
- package/dist/gui/snapshot-service.d.ts.map +0 -1
- package/dist/gui/snapshot-service.js.map +0 -1
- package/dist/gui/sources.d.ts.map +0 -1
- package/dist/gui/sources.js.map +0 -1
- package/dist/gui/sse.d.ts.map +0 -1
- package/dist/gui/sse.js.map +0 -1
- package/dist/gui/temporal-quota-policy-data.d.ts.map +0 -1
- package/dist/gui/temporal-quota-policy-data.js.map +0 -1
- package/dist/gui/temporal-quota-policy.d.ts.map +0 -1
- package/dist/gui/temporal-quota-policy.js.map +0 -1
- package/dist/gui/temporal-status.d.ts.map +0 -1
- package/dist/gui/temporal-status.js.map +0 -1
- package/dist/gui/time-zone.d.ts.map +0 -1
- package/dist/gui/time-zone.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/accounting-format.d.ts.map +0 -1
- package/dist/lib/accounting-format.js.map +0 -1
- package/dist/lib/alibaba-auth.d.ts.map +0 -1
- package/dist/lib/alibaba-auth.js.map +0 -1
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts +0 -47
- package/dist/lib/alibaba-coding-plan-local-quota.d.ts.map +0 -1
- package/dist/lib/alibaba-coding-plan-local-quota.js +0 -146
- package/dist/lib/alibaba-coding-plan-local-quota.js.map +0 -1
- package/dist/lib/alibaba-token-plan.d.ts.map +0 -1
- package/dist/lib/alibaba-token-plan.js.map +0 -1
- package/dist/lib/anthropic-auth.d.ts.map +0 -1
- package/dist/lib/anthropic-auth.js.map +0 -1
- package/dist/lib/anthropic.d.ts.map +0 -1
- package/dist/lib/anthropic.js.map +0 -1
- package/dist/lib/api-key-resolver.d.ts.map +0 -1
- package/dist/lib/api-key-resolver.js.map +0 -1
- package/dist/lib/atomic-json.d.ts.map +0 -1
- package/dist/lib/atomic-json.js.map +0 -1
- package/dist/lib/chutes-config.d.ts.map +0 -1
- package/dist/lib/chutes-config.js.map +0 -1
- package/dist/lib/chutes.d.ts.map +0 -1
- package/dist/lib/chutes.js.map +0 -1
- package/dist/lib/cli-reports.d.ts.map +0 -1
- package/dist/lib/cli-reports.js.map +0 -1
- package/dist/lib/cli-show.d.ts.map +0 -1
- package/dist/lib/cli-show.js.map +0 -1
- package/dist/lib/cli-status.d.ts.map +0 -1
- package/dist/lib/cli-status.js.map +0 -1
- package/dist/lib/command-parsing.d.ts.map +0 -1
- package/dist/lib/command-parsing.js.map +0 -1
- package/dist/lib/config-file-utils.d.ts.map +0 -1
- package/dist/lib/config-file-utils.js.map +0 -1
- package/dist/lib/config-write-target.d.ts.map +0 -1
- package/dist/lib/config-write-target.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/copilot.d.ts.map +0 -1
- package/dist/lib/copilot.js.map +0 -1
- package/dist/lib/cursor-detection.d.ts.map +0 -1
- package/dist/lib/cursor-detection.js.map +0 -1
- package/dist/lib/cursor-pricing.d.ts.map +0 -1
- package/dist/lib/cursor-pricing.js.map +0 -1
- package/dist/lib/cursor-usage.d.ts.map +0 -1
- package/dist/lib/cursor-usage.js.map +0 -1
- package/dist/lib/dashboard-visibility.d.ts.map +0 -1
- package/dist/lib/dashboard-visibility.js.map +0 -1
- package/dist/lib/deepseek-auth.d.ts.map +0 -1
- package/dist/lib/deepseek-auth.js.map +0 -1
- package/dist/lib/deepseek.d.ts.map +0 -1
- package/dist/lib/deepseek.js.map +0 -1
- package/dist/lib/display-sanitize.d.ts.map +0 -1
- package/dist/lib/display-sanitize.js.map +0 -1
- package/dist/lib/entries.d.ts.map +0 -1
- package/dist/lib/entries.js.map +0 -1
- package/dist/lib/env-template.d.ts.map +0 -1
- package/dist/lib/env-template.js.map +0 -1
- package/dist/lib/format-utils.d.ts.map +0 -1
- package/dist/lib/format-utils.js.map +0 -1
- package/dist/lib/format.d.ts.map +0 -1
- package/dist/lib/format.js.map +0 -1
- package/dist/lib/glm-coding-plan.d.ts.map +0 -1
- package/dist/lib/glm-coding-plan.js.map +0 -1
- package/dist/lib/google-agy-companion.d.ts.map +0 -1
- package/dist/lib/google-agy-companion.js.map +0 -1
- package/dist/lib/google-agy.d.ts.map +0 -1
- package/dist/lib/google-agy.js.map +0 -1
- package/dist/lib/google-companion-credentials.d.ts.map +0 -1
- package/dist/lib/google-companion-credentials.js.map +0 -1
- package/dist/lib/google-gemini-cli-companion.d.ts.map +0 -1
- package/dist/lib/google-gemini-cli-companion.js.map +0 -1
- package/dist/lib/google-gemini-cli.d.ts.map +0 -1
- package/dist/lib/google-gemini-cli.js.map +0 -1
- package/dist/lib/google-token-cache.d.ts.map +0 -1
- package/dist/lib/google-token-cache.js.map +0 -1
- package/dist/lib/grouped-entry-normalization.d.ts.map +0 -1
- package/dist/lib/grouped-entry-normalization.js.map +0 -1
- package/dist/lib/grouped-header-format.d.ts.map +0 -1
- package/dist/lib/grouped-header-format.js.map +0 -1
- package/dist/lib/gui-config-target.d.ts.map +0 -1
- package/dist/lib/gui-config-target.js.map +0 -1
- package/dist/lib/home-dir-display.d.ts.map +0 -1
- package/dist/lib/home-dir-display.js.map +0 -1
- package/dist/lib/http.d.ts.map +0 -1
- package/dist/lib/http.js.map +0 -1
- package/dist/lib/init-installer.d.ts.map +0 -1
- package/dist/lib/init-installer.js.map +0 -1
- package/dist/lib/jsonc.d.ts.map +0 -1
- package/dist/lib/jsonc.js.map +0 -1
- package/dist/lib/kilo-config.d.ts.map +0 -1
- package/dist/lib/kilo-config.js.map +0 -1
- package/dist/lib/kilo.d.ts.map +0 -1
- package/dist/lib/kilo.js.map +0 -1
- package/dist/lib/kimi-auth.d.ts.map +0 -1
- package/dist/lib/kimi-auth.js.map +0 -1
- package/dist/lib/kimi-endpoints.d.ts.map +0 -1
- package/dist/lib/kimi-endpoints.js.map +0 -1
- package/dist/lib/kimi.d.ts.map +0 -1
- package/dist/lib/kimi.js.map +0 -1
- package/dist/lib/maintainer-announcements.d.ts.map +0 -1
- package/dist/lib/maintainer-announcements.js.map +0 -1
- package/dist/lib/map-with-concurrency.d.ts.map +0 -1
- package/dist/lib/map-with-concurrency.js.map +0 -1
- package/dist/lib/markdown-table.d.ts.map +0 -1
- package/dist/lib/markdown-table.js.map +0 -1
- package/dist/lib/mimo-config.d.ts.map +0 -1
- package/dist/lib/mimo-config.js.map +0 -1
- package/dist/lib/mimo.d.ts.map +0 -1
- package/dist/lib/mimo.js.map +0 -1
- package/dist/lib/minimax-auth.d.ts.map +0 -1
- package/dist/lib/minimax-auth.js.map +0 -1
- package/dist/lib/minimax-endpoints.d.ts.map +0 -1
- package/dist/lib/minimax-endpoints.js.map +0 -1
- package/dist/lib/modelsdev-pricing.d.ts.map +0 -1
- package/dist/lib/modelsdev-pricing.js.map +0 -1
- package/dist/lib/modelsdev-temporal.d.ts.map +0 -1
- package/dist/lib/modelsdev-temporal.js.map +0 -1
- package/dist/lib/nanogpt-config.d.ts.map +0 -1
- package/dist/lib/nanogpt-config.js.map +0 -1
- package/dist/lib/nanogpt.d.ts.map +0 -1
- package/dist/lib/nanogpt.js.map +0 -1
- package/dist/lib/ollama-cloud-config.d.ts.map +0 -1
- package/dist/lib/ollama-cloud-config.js.map +0 -1
- package/dist/lib/ollama-cloud.d.ts.map +0 -1
- package/dist/lib/ollama-cloud.js.map +0 -1
- package/dist/lib/openai.d.ts.map +0 -1
- package/dist/lib/openai.js.map +0 -1
- package/dist/lib/opencode-auth-sqlite.d.ts.map +0 -1
- package/dist/lib/opencode-auth-sqlite.js.map +0 -1
- package/dist/lib/opencode-auth.d.ts.map +0 -1
- package/dist/lib/opencode-auth.js.map +0 -1
- package/dist/lib/opencode-config-editor.d.ts.map +0 -1
- package/dist/lib/opencode-config-editor.js.map +0 -1
- package/dist/lib/opencode-config-providers.d.ts.map +0 -1
- package/dist/lib/opencode-config-providers.js.map +0 -1
- package/dist/lib/opencode-config-read.d.ts.map +0 -1
- package/dist/lib/opencode-config-read.js.map +0 -1
- package/dist/lib/opencode-console-auth.d.ts.map +0 -1
- package/dist/lib/opencode-console-auth.js.map +0 -1
- package/dist/lib/opencode-db-path.d.ts.map +0 -1
- package/dist/lib/opencode-db-path.js.map +0 -1
- package/dist/lib/opencode-go-auth.d.ts.map +0 -1
- package/dist/lib/opencode-go-auth.js.map +0 -1
- package/dist/lib/opencode-go.d.ts.map +0 -1
- package/dist/lib/opencode-go.js.map +0 -1
- package/dist/lib/opencode-runtime-paths.d.ts.map +0 -1
- package/dist/lib/opencode-runtime-paths.js.map +0 -1
- package/dist/lib/opencode-sqlite.d.ts.map +0 -1
- package/dist/lib/opencode-sqlite.js.map +0 -1
- package/dist/lib/opencode-storage.d.ts.map +0 -1
- package/dist/lib/opencode-storage.js.map +0 -1
- package/dist/lib/opencode-version.d.ts.map +0 -1
- package/dist/lib/opencode-version.js.map +0 -1
- package/dist/lib/opencode-zen.d.ts.map +0 -1
- package/dist/lib/opencode-zen.js.map +0 -1
- package/dist/lib/openrouter.d.ts.map +0 -1
- package/dist/lib/openrouter.js.map +0 -1
- package/dist/lib/private-state-paths.d.ts.map +0 -1
- package/dist/lib/private-state-paths.js.map +0 -1
- package/dist/lib/provider-add-command.d.ts.map +0 -1
- package/dist/lib/provider-add-command.js.map +0 -1
- package/dist/lib/provider-add-json-v1-questionnaire.d.ts.map +0 -1
- package/dist/lib/provider-add-json-v1-questionnaire.js.map +0 -1
- package/dist/lib/provider-add.d.ts.map +0 -1
- package/dist/lib/provider-add.js.map +0 -1
- package/dist/lib/provider-availability.d.ts.map +0 -1
- package/dist/lib/provider-availability.js.map +0 -1
- package/dist/lib/provider-metadata.d.ts.map +0 -1
- package/dist/lib/provider-metadata.js.map +0 -1
- package/dist/lib/provider-model-matching.d.ts.map +0 -1
- package/dist/lib/provider-model-matching.js.map +0 -1
- package/dist/lib/provider-registration.d.ts.map +0 -1
- package/dist/lib/provider-registration.js.map +0 -1
- package/dist/lib/quota-accounting-projection.d.ts.map +0 -1
- package/dist/lib/quota-accounting-projection.js.map +0 -1
- package/dist/lib/quota-columns.d.ts.map +0 -1
- package/dist/lib/quota-columns.js.map +0 -1
- package/dist/lib/quota-command-format.d.ts.map +0 -1
- package/dist/lib/quota-command-format.js.map +0 -1
- package/dist/lib/quota-dialog-command-specs.d.ts.map +0 -1
- package/dist/lib/quota-dialog-command-specs.js.map +0 -1
- package/dist/lib/quota-dialog-commands.d.ts.map +0 -1
- package/dist/lib/quota-dialog-commands.js.map +0 -1
- package/dist/lib/quota-entry-display.d.ts.map +0 -1
- package/dist/lib/quota-entry-display.js.map +0 -1
- package/dist/lib/quota-exhaustion-projection.d.ts.map +0 -1
- package/dist/lib/quota-exhaustion-projection.js.map +0 -1
- package/dist/lib/quota-export-types.d.ts.map +0 -1
- package/dist/lib/quota-export-types.js.map +0 -1
- package/dist/lib/quota-export.d.ts.map +0 -1
- package/dist/lib/quota-export.js.map +0 -1
- package/dist/lib/quota-format-style.d.ts.map +0 -1
- package/dist/lib/quota-format-style.js.map +0 -1
- package/dist/lib/quota-providers-local.d.ts.map +0 -1
- package/dist/lib/quota-providers-local.js.map +0 -1
- package/dist/lib/quota-providers-remote.d.ts.map +0 -1
- package/dist/lib/quota-providers-remote.js.map +0 -1
- package/dist/lib/quota-providers.d.ts.map +0 -1
- package/dist/lib/quota-providers.js.map +0 -1
- package/dist/lib/quota-render-data.d.ts.map +0 -1
- package/dist/lib/quota-render-data.js.map +0 -1
- package/dist/lib/quota-report-message.d.ts.map +0 -1
- package/dist/lib/quota-report-message.js.map +0 -1
- package/dist/lib/quota-reset-notifications.d.ts.map +0 -1
- package/dist/lib/quota-reset-notifications.js.map +0 -1
- package/dist/lib/quota-retry-wait.d.ts.map +0 -1
- package/dist/lib/quota-retry-wait.js.map +0 -1
- package/dist/lib/quota-runtime-context.d.ts.map +0 -1
- package/dist/lib/quota-runtime-context.js.map +0 -1
- package/dist/lib/quota-state-codec.d.ts.map +0 -1
- package/dist/lib/quota-state-codec.js.map +0 -1
- package/dist/lib/quota-state.d.ts.map +0 -1
- package/dist/lib/quota-state.js.map +0 -1
- package/dist/lib/quota-stats-format.d.ts.map +0 -1
- package/dist/lib/quota-stats-format.js.map +0 -1
- package/dist/lib/quota-stats.d.ts.map +0 -1
- package/dist/lib/quota-stats.js.map +0 -1
- package/dist/lib/quota-status.d.ts.map +0 -1
- package/dist/lib/quota-status.js.map +0 -1
- package/dist/lib/quota-surface-data.d.ts.map +0 -1
- package/dist/lib/quota-surface-data.js.map +0 -1
- package/dist/lib/quota-telemetry.d.ts.map +0 -1
- package/dist/lib/quota-telemetry.js.map +0 -1
- package/dist/lib/report-document.d.ts.map +0 -1
- package/dist/lib/report-document.js.map +0 -1
- package/dist/lib/resolved-auth-identity.d.ts.map +0 -1
- package/dist/lib/resolved-auth-identity.js.map +0 -1
- package/dist/lib/runtime-provider-ids.d.ts.map +0 -1
- package/dist/lib/runtime-provider-ids.js.map +0 -1
- package/dist/lib/scoped-query-chunks.d.ts.map +0 -1
- package/dist/lib/scoped-query-chunks.js.map +0 -1
- package/dist/lib/scoped-update-migration.d.ts.map +0 -1
- package/dist/lib/scoped-update-migration.js.map +0 -1
- package/dist/lib/scoped-update.d.ts.map +0 -1
- package/dist/lib/scoped-update.js.map +0 -1
- package/dist/lib/session-tokens-format.d.ts.map +0 -1
- package/dist/lib/session-tokens-format.js.map +0 -1
- package/dist/lib/session-tokens.d.ts.map +0 -1
- package/dist/lib/session-tokens.js.map +0 -1
- package/dist/lib/synthetic-config.d.ts.map +0 -1
- package/dist/lib/synthetic-config.js.map +0 -1
- package/dist/lib/synthetic.d.ts.map +0 -1
- package/dist/lib/synthetic.js.map +0 -1
- package/dist/lib/toast-format-grouped.d.ts.map +0 -1
- package/dist/lib/toast-format-grouped.js.map +0 -1
- package/dist/lib/token-buckets.d.ts.map +0 -1
- package/dist/lib/token-buckets.js.map +0 -1
- package/dist/lib/token-cost.d.ts.map +0 -1
- package/dist/lib/token-cost.js.map +0 -1
- package/dist/lib/tui-compact-format.d.ts.map +0 -1
- package/dist/lib/tui-compact-format.js.map +0 -1
- package/dist/lib/tui-panel-state.d.ts.map +0 -1
- package/dist/lib/tui-panel-state.js.map +0 -1
- package/dist/lib/tui-prompt-bar-format.d.ts.map +0 -1
- package/dist/lib/tui-prompt-bar-format.js.map +0 -1
- package/dist/lib/tui-sidebar-format.d.ts.map +0 -1
- package/dist/lib/tui-sidebar-format.js.map +0 -1
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage-ownership.d.ts.map +0 -1
- package/dist/lib/usage-ownership.js.map +0 -1
- package/dist/lib/version.d.ts.map +0 -1
- package/dist/lib/version.js.map +0 -1
- package/dist/lib/xai.d.ts.map +0 -1
- package/dist/lib/xai.js.map +0 -1
- package/dist/lib/zai-auth.d.ts.map +0 -1
- package/dist/lib/zai-auth.js.map +0 -1
- package/dist/lib/zai.d.ts.map +0 -1
- package/dist/lib/zai.js.map +0 -1
- package/dist/lib/zhipu-auth.d.ts.map +0 -1
- package/dist/lib/zhipu-auth.js.map +0 -1
- package/dist/lib/zhipu.d.ts.map +0 -1
- package/dist/lib/zhipu.js.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js.map +0 -1
- package/dist/providers/accounting-decimal.d.ts.map +0 -1
- package/dist/providers/accounting-decimal.js.map +0 -1
- package/dist/providers/alibaba-coding-plan.d.ts.map +0 -1
- package/dist/providers/alibaba-coding-plan.js.map +0 -1
- package/dist/providers/alibaba-token-plan.d.ts.map +0 -1
- package/dist/providers/alibaba-token-plan.js.map +0 -1
- package/dist/providers/anthropic.d.ts.map +0 -1
- package/dist/providers/anthropic.js.map +0 -1
- package/dist/providers/cache-policies.d.ts.map +0 -1
- package/dist/providers/cache-policies.js.map +0 -1
- package/dist/providers/chutes.d.ts.map +0 -1
- package/dist/providers/chutes.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/cursor.d.ts.map +0 -1
- package/dist/providers/cursor.js.map +0 -1
- package/dist/providers/deepseek.d.ts.map +0 -1
- package/dist/providers/deepseek.js.map +0 -1
- package/dist/providers/glm-coding-plan-provider.d.ts.map +0 -1
- package/dist/providers/glm-coding-plan-provider.js.map +0 -1
- package/dist/providers/google-account-format.d.ts.map +0 -1
- package/dist/providers/google-account-format.js.map +0 -1
- package/dist/providers/google-agy.d.ts.map +0 -1
- package/dist/providers/google-agy.js.map +0 -1
- package/dist/providers/google-gemini-cli.d.ts.map +0 -1
- package/dist/providers/google-gemini-cli.js.map +0 -1
- package/dist/providers/kilo.d.ts.map +0 -1
- package/dist/providers/kilo.js.map +0 -1
- package/dist/providers/kimi-code.d.ts.map +0 -1
- package/dist/providers/kimi-code.js.map +0 -1
- package/dist/providers/mimo.d.ts.map +0 -1
- package/dist/providers/mimo.js.map +0 -1
- package/dist/providers/minimax-coding-plan.d.ts.map +0 -1
- package/dist/providers/minimax-coding-plan.js.map +0 -1
- package/dist/providers/nanogpt.d.ts.map +0 -1
- package/dist/providers/nanogpt.js.map +0 -1
- package/dist/providers/ollama-cloud.d.ts.map +0 -1
- package/dist/providers/ollama-cloud.js.map +0 -1
- package/dist/providers/openai.d.ts.map +0 -1
- package/dist/providers/openai.js.map +0 -1
- package/dist/providers/opencode-go.d.ts.map +0 -1
- package/dist/providers/opencode-go.js.map +0 -1
- package/dist/providers/opencode-zen.d.ts.map +0 -1
- package/dist/providers/opencode-zen.js.map +0 -1
- package/dist/providers/openrouter.d.ts.map +0 -1
- package/dist/providers/openrouter.js.map +0 -1
- package/dist/providers/quota-providers.d.ts.map +0 -1
- package/dist/providers/quota-providers.js.map +0 -1
- package/dist/providers/registry.d.ts.map +0 -1
- package/dist/providers/registry.js.map +0 -1
- package/dist/providers/result-helpers.d.ts.map +0 -1
- package/dist/providers/result-helpers.js.map +0 -1
- package/dist/providers/synthetic.d.ts.map +0 -1
- package/dist/providers/synthetic.js.map +0 -1
- package/dist/providers/xai.d.ts.map +0 -1
- package/dist/providers/xai.js.map +0 -1
- package/dist/providers/zai.d.ts.map +0 -1
- package/dist/providers/zai.js.map +0 -1
- package/dist/providers/zhipu.d.ts.map +0 -1
- package/dist/providers/zhipu.js.map +0 -1
- package/dist/rpc.d.ts.map +0 -1
- package/dist/rpc.js.map +0 -1
- package/dist/ui/assets/index-D9lFKhSN.js +0 -9
|
@@ -190,6 +190,11 @@ export function formatAccountingWindowLabel(window) {
|
|
|
190
190
|
export function formatAccountingComponentLabel(component) {
|
|
191
191
|
return COMPONENT_LABELS[component];
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Named metrics whose visible label is exact, not "<name> <result type>". Keyed by the semantic
|
|
195
|
+
* metric name, which stays unchanged so codecs and DTO guards keep their keys.
|
|
196
|
+
*/
|
|
197
|
+
const EXACT_NAMED_METRIC_LABELS = new Map([["Fable weekly", "Fable"]]);
|
|
193
198
|
export function formatAccountingSemanticLabel(resultType, semantic, entryKind) {
|
|
194
199
|
const resultLabel = RESULT_TYPE_LABELS[resultType];
|
|
195
200
|
const metric = semantic.metric;
|
|
@@ -205,6 +210,9 @@ export function formatAccountingSemanticLabel(resultType, semantic, entryKind) {
|
|
|
205
210
|
}
|
|
206
211
|
if (resultType === "status")
|
|
207
212
|
return metric.name;
|
|
213
|
+
const exactLabel = EXACT_NAMED_METRIC_LABELS.get(metric.name);
|
|
214
|
+
if (exactLabel !== undefined)
|
|
215
|
+
return exactLabel;
|
|
208
216
|
return `${metric.name} ${resultLabel.toLowerCase()}`;
|
|
209
217
|
}
|
|
210
218
|
export function getAccountingSemanticSortKey(entry) {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export declare const ALIBABA_CODING_PLAN_COMMAND = "bl";
|
|
2
|
+
export declare const ALIBABA_CODING_PLAN_ARGS: readonly ["usage", "coding-plan", "--output", "json"];
|
|
3
|
+
export declare const ALIBABA_CODING_PLAN_STDOUT_LIMIT_BYTES: number;
|
|
4
|
+
export declare const ALIBABA_CODING_PLAN_STDERR_LIMIT_BYTES: number;
|
|
5
|
+
export declare const ALIBABA_CODING_PLAN_KILL_GRACE_MS = 250;
|
|
6
|
+
export declare const ALIBABA_CODING_PLAN_AUTH_EXIT_CODE = 3;
|
|
7
|
+
export type AlibabaCodingPlanErrorKind = "unsupported_platform" | "executable_not_found" | "workspace_path_rejected" | "shell_launcher_rejected" | "spawn_failed" | "timeout" | "output_truncated" | "not_authenticated" | "nonzero_exit" | "invalid_json" | "invalid_schema" | "no_quota_data";
|
|
8
|
+
export interface AlibabaCodingPlanError {
|
|
9
|
+
kind: AlibabaCodingPlanErrorKind;
|
|
10
|
+
message: string;
|
|
11
|
+
retryable?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface AlibabaCodingPlanUsageWindow {
|
|
14
|
+
used?: number;
|
|
15
|
+
total?: number;
|
|
16
|
+
/** Provider-reported ratio of used quota to total quota, in [0, 1]. */
|
|
17
|
+
percentage?: number;
|
|
18
|
+
resetTimeIso?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AlibabaCodingPlanUsage {
|
|
21
|
+
instanceType?: string;
|
|
22
|
+
fiveHour?: AlibabaCodingPlanUsageWindow;
|
|
23
|
+
weekly?: AlibabaCodingPlanUsageWindow;
|
|
24
|
+
monthly?: AlibabaCodingPlanUsageWindow;
|
|
25
|
+
}
|
|
26
|
+
export type AlibabaCodingPlanQuotaResult = {
|
|
27
|
+
state: "success";
|
|
28
|
+
usage: AlibabaCodingPlanUsage;
|
|
29
|
+
} | {
|
|
30
|
+
state: "no-subscription";
|
|
31
|
+
} | {
|
|
32
|
+
state: "error";
|
|
33
|
+
error: AlibabaCodingPlanError;
|
|
34
|
+
};
|
|
35
|
+
export interface AlibabaCodingPlanSpawnRequest {
|
|
36
|
+
file: string;
|
|
37
|
+
args: readonly string[];
|
|
38
|
+
cwd: string;
|
|
39
|
+
env: NodeJS.ProcessEnv;
|
|
40
|
+
timeoutMs: number;
|
|
41
|
+
stdoutLimitBytes: number;
|
|
42
|
+
stderrLimitBytes: number;
|
|
43
|
+
stdin: "ignore";
|
|
44
|
+
shell: false;
|
|
45
|
+
/** Preserve the `/c` command string verbatim for the carefully quoted Windows shim. */
|
|
46
|
+
windowsVerbatimArguments?: boolean;
|
|
47
|
+
platform: NodeJS.Platform;
|
|
48
|
+
killGraceMs: number;
|
|
49
|
+
}
|
|
50
|
+
export interface AlibabaCodingPlanSpawnResult {
|
|
51
|
+
code: number | null;
|
|
52
|
+
stdout: Buffer;
|
|
53
|
+
stderr: Buffer;
|
|
54
|
+
timedOut: boolean;
|
|
55
|
+
truncated: boolean;
|
|
56
|
+
spawnErrorCode?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface AlibabaCodingPlanRuntime {
|
|
59
|
+
platform?: NodeJS.Platform;
|
|
60
|
+
cwd?: string;
|
|
61
|
+
pathEnv?: string;
|
|
62
|
+
env?: NodeJS.ProcessEnv;
|
|
63
|
+
homedir?: string;
|
|
64
|
+
tmpdir?: string;
|
|
65
|
+
spawn?: (request: AlibabaCodingPlanSpawnRequest) => Promise<AlibabaCodingPlanSpawnResult>;
|
|
66
|
+
}
|
|
67
|
+
/** Build the only allowed Windows shim command; the executable path is quoted and args are fixed. */
|
|
68
|
+
export declare function buildAlibabaCodingPlanWindowsShimInvocation(file: string, systemRoot: string | undefined): {
|
|
69
|
+
file: string;
|
|
70
|
+
args: readonly string[];
|
|
71
|
+
} | null;
|
|
72
|
+
/** Parse the flat JSON emitted by `bl usage coding-plan --output json`. */
|
|
73
|
+
export declare function parseAlibabaCodingPlanUsageJson(text: string): AlibabaCodingPlanQuotaResult;
|
|
74
|
+
export declare function runAlibabaCodingPlanProcess(request: AlibabaCodingPlanSpawnRequest): Promise<AlibabaCodingPlanSpawnResult>;
|
|
75
|
+
export declare function queryAlibabaCodingPlanQuota(options?: {
|
|
76
|
+
requestTimeoutMs?: number;
|
|
77
|
+
runtime?: AlibabaCodingPlanRuntime;
|
|
78
|
+
}): Promise<AlibabaCodingPlanQuotaResult>;
|
|
79
|
+
//# sourceMappingURL=alibaba-coding-plan-cli.d.ts.map
|
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
import { spawn as nodeSpawn } from "node:child_process";
|
|
2
|
+
import { lstat, realpath } from "node:fs/promises";
|
|
3
|
+
import { homedir, tmpdir } from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { REQUEST_TIMEOUT_MS } from "./types.js";
|
|
6
|
+
export const ALIBABA_CODING_PLAN_COMMAND = "bl";
|
|
7
|
+
export const ALIBABA_CODING_PLAN_ARGS = ["usage", "coding-plan", "--output", "json"];
|
|
8
|
+
export const ALIBABA_CODING_PLAN_STDOUT_LIMIT_BYTES = 256 * 1024;
|
|
9
|
+
export const ALIBABA_CODING_PLAN_STDERR_LIMIT_BYTES = 16 * 1024;
|
|
10
|
+
export const ALIBABA_CODING_PLAN_KILL_GRACE_MS = 250;
|
|
11
|
+
export const ALIBABA_CODING_PLAN_AUTH_EXIT_CODE = 3;
|
|
12
|
+
const MAX_CLI_TIMEOUT_MS = 15_000;
|
|
13
|
+
const MAX_DATE_MS = 8_640_000_000_000_000;
|
|
14
|
+
const SUPPORTED_PLATFORMS = new Set(["darwin", "linux", "win32"]);
|
|
15
|
+
const SHELL_LAUNCHER_NAMES = new Set([
|
|
16
|
+
"bash",
|
|
17
|
+
"cmd",
|
|
18
|
+
"dash",
|
|
19
|
+
"fish",
|
|
20
|
+
"powershell",
|
|
21
|
+
"pwsh",
|
|
22
|
+
"sh",
|
|
23
|
+
"zsh",
|
|
24
|
+
]);
|
|
25
|
+
const SHELL_LAUNCHER_EXTENSIONS = new Set([".bash", ".bat", ".cmd", ".ps1", ".sh", ".zsh"]);
|
|
26
|
+
const WINDOWS_SHIM_UNSAFE_PATH = /[%!^&|<>"\r\n]/u;
|
|
27
|
+
const ERROR_MESSAGES = {
|
|
28
|
+
unsupported_platform: "Alibaba Coding Plan usage is not supported on this platform.",
|
|
29
|
+
executable_not_found: 'Bailian CLI ("bl") was not found on the trusted PATH.',
|
|
30
|
+
workspace_path_rejected: "Bailian CLI from the project workspace was refused.",
|
|
31
|
+
shell_launcher_rejected: "Bailian CLI shell launcher could not be started safely.",
|
|
32
|
+
spawn_failed: "Unable to start the Bailian CLI Coding Plan usage command.",
|
|
33
|
+
timeout: "Bailian CLI Coding Plan usage timed out.",
|
|
34
|
+
output_truncated: "Bailian CLI Coding Plan usage output exceeded the allowed size.",
|
|
35
|
+
not_authenticated: 'Bailian CLI is not signed in to a Console account; run "bl auth login --console".',
|
|
36
|
+
nonzero_exit: "Bailian CLI Coding Plan usage command failed.",
|
|
37
|
+
invalid_json: "Bailian CLI returned invalid Coding Plan usage JSON.",
|
|
38
|
+
invalid_schema: "Bailian CLI returned malformed Coding Plan usage data.",
|
|
39
|
+
no_quota_data: "Bailian CLI returned no usable Coding Plan quota data.",
|
|
40
|
+
};
|
|
41
|
+
function fail(kind, retryable = false) {
|
|
42
|
+
return {
|
|
43
|
+
state: "error",
|
|
44
|
+
error: {
|
|
45
|
+
kind,
|
|
46
|
+
message: ERROR_MESSAGES[kind],
|
|
47
|
+
...(retryable ? { retryable: true } : {}),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function asRecord(value) {
|
|
52
|
+
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
53
|
+
? value
|
|
54
|
+
: null;
|
|
55
|
+
}
|
|
56
|
+
function isSupportedPlatform(platform) {
|
|
57
|
+
return SUPPORTED_PLATFORMS.has(platform);
|
|
58
|
+
}
|
|
59
|
+
function pathApi(platform) {
|
|
60
|
+
return platform === "win32" ? path.win32 : path.posix;
|
|
61
|
+
}
|
|
62
|
+
function isPathInside(parent, candidate, paths) {
|
|
63
|
+
const relative = paths.relative(parent, candidate);
|
|
64
|
+
return (relative === "" ||
|
|
65
|
+
(relative !== ".." && !relative.startsWith(`..${paths.sep}`) && !paths.isAbsolute(relative)));
|
|
66
|
+
}
|
|
67
|
+
function stripPathQuotes(value) {
|
|
68
|
+
const trimmed = value.trim();
|
|
69
|
+
if (trimmed.length >= 2 &&
|
|
70
|
+
((trimmed.startsWith('"') && trimmed.endsWith('"')) ||
|
|
71
|
+
(trimmed.startsWith("'") && trimmed.endsWith("'")))) {
|
|
72
|
+
return trimmed.slice(1, -1);
|
|
73
|
+
}
|
|
74
|
+
return trimmed;
|
|
75
|
+
}
|
|
76
|
+
function listTrustedPathDirectories(params) {
|
|
77
|
+
const paths = pathApi(params.platform);
|
|
78
|
+
const workspace = paths.resolve(params.cwd);
|
|
79
|
+
const projectFolder = workspace === paths.resolve(params.homedir) ? null : workspace;
|
|
80
|
+
const trusted = [];
|
|
81
|
+
const seen = new Set();
|
|
82
|
+
for (const rawEntry of (params.pathEnv ?? "").split(paths.delimiter)) {
|
|
83
|
+
const entry = stripPathQuotes(rawEntry);
|
|
84
|
+
if (!entry || entry === "." || entry === ".." || !paths.isAbsolute(entry))
|
|
85
|
+
continue;
|
|
86
|
+
const resolved = paths.resolve(entry);
|
|
87
|
+
if (projectFolder !== null && isPathInside(projectFolder, resolved, paths))
|
|
88
|
+
continue;
|
|
89
|
+
const deduplicationKey = params.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
90
|
+
if (seen.has(deduplicationKey))
|
|
91
|
+
continue;
|
|
92
|
+
seen.add(deduplicationKey);
|
|
93
|
+
trusted.push(resolved);
|
|
94
|
+
}
|
|
95
|
+
return trusted;
|
|
96
|
+
}
|
|
97
|
+
function isShellLauncherPath(file, platform) {
|
|
98
|
+
const paths = pathApi(platform);
|
|
99
|
+
const extension = paths.extname(file).toLowerCase();
|
|
100
|
+
if (platform === "win32" && (extension === ".cmd" || extension === ".bat"))
|
|
101
|
+
return false;
|
|
102
|
+
if (SHELL_LAUNCHER_EXTENSIONS.has(extension))
|
|
103
|
+
return true;
|
|
104
|
+
return SHELL_LAUNCHER_NAMES.has(paths.basename(file).toLowerCase());
|
|
105
|
+
}
|
|
106
|
+
async function fileLooksLikeFile(file) {
|
|
107
|
+
try {
|
|
108
|
+
const stats = await lstat(file);
|
|
109
|
+
if (stats.isSymbolicLink()) {
|
|
110
|
+
const target = await realpath(file);
|
|
111
|
+
return (await lstat(target)).isFile();
|
|
112
|
+
}
|
|
113
|
+
return stats.isFile();
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function candidateNames(platform) {
|
|
120
|
+
return platform === "win32" ? ["bl.exe", "bl.com", "bl.cmd", "bl.bat"] : ["bl"];
|
|
121
|
+
}
|
|
122
|
+
async function resolveExecutable(params) {
|
|
123
|
+
const { platform } = params;
|
|
124
|
+
if (!isSupportedPlatform(platform)) {
|
|
125
|
+
return {
|
|
126
|
+
ok: false,
|
|
127
|
+
error: { kind: "unsupported_platform", message: ERROR_MESSAGES.unsupported_platform },
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const paths = pathApi(platform);
|
|
131
|
+
const projectFolder = paths.resolve(params.cwd) === paths.resolve(params.homedir) ? null : paths.resolve(params.cwd);
|
|
132
|
+
const trustedDirectories = listTrustedPathDirectories(params);
|
|
133
|
+
let sawUnsafeShellLauncher = false;
|
|
134
|
+
for (const directory of trustedDirectories) {
|
|
135
|
+
for (const name of candidateNames(platform)) {
|
|
136
|
+
const candidate = paths.join(directory, name);
|
|
137
|
+
if (!(await fileLooksLikeFile(candidate)))
|
|
138
|
+
continue;
|
|
139
|
+
let resolved = candidate;
|
|
140
|
+
try {
|
|
141
|
+
resolved = await realpath(candidate);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
// The checked absolute candidate remains usable if realpath is unavailable.
|
|
145
|
+
}
|
|
146
|
+
const extension = paths.extname(candidate).toLowerCase();
|
|
147
|
+
const windowsShim = platform === "win32" && (extension === ".cmd" || extension === ".bat");
|
|
148
|
+
if (isShellLauncherPath(resolved, platform) && !windowsShim) {
|
|
149
|
+
sawUnsafeShellLauncher = true;
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (projectFolder !== null && isPathInside(projectFolder, resolved, paths)) {
|
|
153
|
+
return {
|
|
154
|
+
ok: false,
|
|
155
|
+
error: {
|
|
156
|
+
kind: "workspace_path_rejected",
|
|
157
|
+
message: ERROR_MESSAGES.workspace_path_rejected,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return { ok: true, file: resolved, kind: windowsShim ? "windows-shim" : "native" };
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const kind = sawUnsafeShellLauncher ? "shell_launcher_rejected" : "executable_not_found";
|
|
165
|
+
return { ok: false, error: { kind, message: ERROR_MESSAGES[kind] } };
|
|
166
|
+
}
|
|
167
|
+
/** Build the only allowed Windows shim command; the executable path is quoted and args are fixed. */
|
|
168
|
+
export function buildAlibabaCodingPlanWindowsShimInvocation(file, systemRoot) {
|
|
169
|
+
if (!path.win32.isAbsolute(file) ||
|
|
170
|
+
!systemRoot ||
|
|
171
|
+
!path.win32.isAbsolute(systemRoot) ||
|
|
172
|
+
WINDOWS_SHIM_UNSAFE_PATH.test(file) ||
|
|
173
|
+
WINDOWS_SHIM_UNSAFE_PATH.test(systemRoot)) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
file: path.win32.join(systemRoot, "System32", "cmd.exe"),
|
|
178
|
+
args: ["/d", "/s", "/c", `""${file}" usage coding-plan --output json"`],
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function resolveNonWorkspaceCwd(params) {
|
|
182
|
+
const paths = pathApi(params.platform);
|
|
183
|
+
const workspace = paths.resolve(params.cwd);
|
|
184
|
+
for (const candidate of [
|
|
185
|
+
params.tmpdir,
|
|
186
|
+
params.homedir,
|
|
187
|
+
params.platform === "win32" ? "C:\\" : "/",
|
|
188
|
+
]) {
|
|
189
|
+
const resolved = paths.resolve(candidate);
|
|
190
|
+
if (!isPathInside(workspace, resolved, paths))
|
|
191
|
+
return resolved;
|
|
192
|
+
}
|
|
193
|
+
return params.platform === "win32" ? "C:\\" : "/";
|
|
194
|
+
}
|
|
195
|
+
function readOptionalNumber(record, key) {
|
|
196
|
+
if (!Object.hasOwn(record, key))
|
|
197
|
+
return { valid: true };
|
|
198
|
+
const value = record[key];
|
|
199
|
+
return typeof value === "number" && Number.isFinite(value)
|
|
200
|
+
? { valid: true, value }
|
|
201
|
+
: { valid: false };
|
|
202
|
+
}
|
|
203
|
+
function parseWindow(value) {
|
|
204
|
+
const record = asRecord(value);
|
|
205
|
+
if (!record)
|
|
206
|
+
return "invalid";
|
|
207
|
+
const used = readOptionalNumber(record, "usedQuota");
|
|
208
|
+
const total = readOptionalNumber(record, "totalQuota");
|
|
209
|
+
const percentage = readOptionalNumber(record, "percentage");
|
|
210
|
+
const resetTime = readOptionalNumber(record, "resetTime");
|
|
211
|
+
if (!used.valid || !total.valid || !percentage.valid || !resetTime.valid)
|
|
212
|
+
return "invalid";
|
|
213
|
+
if ((used.value !== undefined && used.value < 0) ||
|
|
214
|
+
(total.value !== undefined && total.value < 0) ||
|
|
215
|
+
(percentage.value !== undefined && (percentage.value < 0 || percentage.value > 1)) ||
|
|
216
|
+
(resetTime.value !== undefined &&
|
|
217
|
+
(resetTime.value < 0 ||
|
|
218
|
+
resetTime.value > MAX_DATE_MS ||
|
|
219
|
+
!Number.isFinite(new Date(resetTime.value).valueOf())))) {
|
|
220
|
+
return "invalid";
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
...(used.value !== undefined ? { used: used.value } : {}),
|
|
224
|
+
...(total.value !== undefined ? { total: total.value } : {}),
|
|
225
|
+
...(percentage.value !== undefined
|
|
226
|
+
? { percentage: percentage.value }
|
|
227
|
+
: used.value !== undefined && total.value !== undefined && total.value > 0
|
|
228
|
+
? { percentage: used.value / total.value }
|
|
229
|
+
: {}),
|
|
230
|
+
...(resetTime.value !== undefined
|
|
231
|
+
? { resetTimeIso: new Date(resetTime.value).toISOString() }
|
|
232
|
+
: {}),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** Parse the flat JSON emitted by `bl usage coding-plan --output json`. */
|
|
236
|
+
export function parseAlibabaCodingPlanUsageJson(text) {
|
|
237
|
+
let payload;
|
|
238
|
+
try {
|
|
239
|
+
payload = JSON.parse(text);
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
return fail("invalid_json");
|
|
243
|
+
}
|
|
244
|
+
const record = asRecord(payload);
|
|
245
|
+
if (!record)
|
|
246
|
+
return fail("invalid_schema");
|
|
247
|
+
if (Object.keys(record).length === 0)
|
|
248
|
+
return { state: "no-subscription" };
|
|
249
|
+
const instanceType = record.instanceType;
|
|
250
|
+
if (instanceType !== undefined && (typeof instanceType !== "string" || !instanceType.trim())) {
|
|
251
|
+
return fail("invalid_schema");
|
|
252
|
+
}
|
|
253
|
+
const windows = [
|
|
254
|
+
["per5Hour", "fiveHour"],
|
|
255
|
+
["perWeek", "weekly"],
|
|
256
|
+
["perBillMonth", "monthly"],
|
|
257
|
+
];
|
|
258
|
+
const usage = {
|
|
259
|
+
...(typeof instanceType === "string" ? { instanceType: instanceType.trim() } : {}),
|
|
260
|
+
};
|
|
261
|
+
for (const [sourceKey, targetKey] of windows) {
|
|
262
|
+
if (!Object.hasOwn(record, sourceKey))
|
|
263
|
+
continue;
|
|
264
|
+
const window = parseWindow(record[sourceKey]);
|
|
265
|
+
if (window === "invalid")
|
|
266
|
+
return fail("invalid_schema");
|
|
267
|
+
usage[targetKey] = window;
|
|
268
|
+
}
|
|
269
|
+
if (windows.every(([key]) => !Object.hasOwn(record, key)))
|
|
270
|
+
return fail("invalid_schema");
|
|
271
|
+
return { state: "success", usage };
|
|
272
|
+
}
|
|
273
|
+
function takeBoundedChunk(chunks, currentSize, chunk, limit) {
|
|
274
|
+
const remaining = limit - currentSize;
|
|
275
|
+
if (remaining <= 0)
|
|
276
|
+
return { size: currentSize, overflowed: true };
|
|
277
|
+
if (chunk.length <= remaining) {
|
|
278
|
+
chunks.push(chunk);
|
|
279
|
+
return { size: currentSize + chunk.length, overflowed: false };
|
|
280
|
+
}
|
|
281
|
+
chunks.push(chunk.subarray(0, remaining));
|
|
282
|
+
return { size: limit, overflowed: true };
|
|
283
|
+
}
|
|
284
|
+
function signalChild(child, platform, signal) {
|
|
285
|
+
if (!child.pid)
|
|
286
|
+
return;
|
|
287
|
+
try {
|
|
288
|
+
if (platform !== "win32")
|
|
289
|
+
process.kill(-child.pid, signal);
|
|
290
|
+
else
|
|
291
|
+
child.kill(signal);
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
try {
|
|
295
|
+
child.kill(signal);
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
// The child may already have exited.
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function signalWindowsProcessTree(pid, onFailure) {
|
|
303
|
+
const systemRoot = process.env.SystemRoot ?? process.env.WINDIR;
|
|
304
|
+
if (!pid || !systemRoot || !path.win32.isAbsolute(systemRoot))
|
|
305
|
+
return false;
|
|
306
|
+
let treeKiller;
|
|
307
|
+
try {
|
|
308
|
+
treeKiller = nodeSpawn(path.win32.join(systemRoot, "System32", "taskkill.exe"), ["/PID", String(pid), "/T", "/F"], { shell: false, windowsHide: true, stdio: "ignore" });
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
let completed = false;
|
|
314
|
+
const fail = () => {
|
|
315
|
+
if (completed)
|
|
316
|
+
return;
|
|
317
|
+
completed = true;
|
|
318
|
+
onFailure();
|
|
319
|
+
};
|
|
320
|
+
treeKiller.once("error", fail);
|
|
321
|
+
treeKiller.once("close", (code) => {
|
|
322
|
+
if (code === 0)
|
|
323
|
+
completed = true;
|
|
324
|
+
else
|
|
325
|
+
fail();
|
|
326
|
+
});
|
|
327
|
+
treeKiller.unref();
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
export async function runAlibabaCodingPlanProcess(request) {
|
|
331
|
+
return await new Promise((resolve) => {
|
|
332
|
+
let child;
|
|
333
|
+
try {
|
|
334
|
+
child = nodeSpawn(request.file, [...request.args], {
|
|
335
|
+
cwd: request.cwd,
|
|
336
|
+
env: request.env,
|
|
337
|
+
argv0: request.file,
|
|
338
|
+
shell: false,
|
|
339
|
+
...(request.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),
|
|
340
|
+
windowsHide: true,
|
|
341
|
+
detached: request.platform !== "win32",
|
|
342
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
const spawnErrorCode = error && typeof error === "object" && "code" in error
|
|
347
|
+
? String(error.code)
|
|
348
|
+
: undefined;
|
|
349
|
+
resolve({
|
|
350
|
+
code: null,
|
|
351
|
+
stdout: Buffer.alloc(0),
|
|
352
|
+
stderr: Buffer.alloc(0),
|
|
353
|
+
timedOut: false,
|
|
354
|
+
truncated: false,
|
|
355
|
+
...(spawnErrorCode ? { spawnErrorCode } : {}),
|
|
356
|
+
});
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const stdoutChunks = [];
|
|
360
|
+
const stderrChunks = [];
|
|
361
|
+
let stdoutSize = 0;
|
|
362
|
+
let stderrSize = 0;
|
|
363
|
+
let timedOut = false;
|
|
364
|
+
let truncated = false;
|
|
365
|
+
let timeout;
|
|
366
|
+
let killTimer;
|
|
367
|
+
let settled = false;
|
|
368
|
+
let escalationStarted = false;
|
|
369
|
+
function clearTimers() {
|
|
370
|
+
if (timeout !== undefined)
|
|
371
|
+
clearTimeout(timeout);
|
|
372
|
+
if (killTimer !== undefined)
|
|
373
|
+
clearTimeout(killTimer);
|
|
374
|
+
timeout = undefined;
|
|
375
|
+
killTimer = undefined;
|
|
376
|
+
}
|
|
377
|
+
function escalate() {
|
|
378
|
+
if (settled || escalationStarted)
|
|
379
|
+
return;
|
|
380
|
+
escalationStarted = true;
|
|
381
|
+
const signalTerm = () => {
|
|
382
|
+
if (!settled)
|
|
383
|
+
signalChild(child, request.platform, "SIGTERM");
|
|
384
|
+
};
|
|
385
|
+
if (request.platform === "win32") {
|
|
386
|
+
if (!signalWindowsProcessTree(child.pid, signalTerm))
|
|
387
|
+
signalTerm();
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
signalTerm();
|
|
391
|
+
}
|
|
392
|
+
if (killTimer !== undefined)
|
|
393
|
+
clearTimeout(killTimer);
|
|
394
|
+
killTimer = setTimeout(() => {
|
|
395
|
+
killTimer = undefined;
|
|
396
|
+
signalChild(child, request.platform, "SIGKILL");
|
|
397
|
+
finish(null, undefined, true);
|
|
398
|
+
}, request.killGraceMs);
|
|
399
|
+
}
|
|
400
|
+
function finish(code, spawnErrorCode, destroyStreams = false) {
|
|
401
|
+
if (settled)
|
|
402
|
+
return;
|
|
403
|
+
settled = true;
|
|
404
|
+
clearTimers();
|
|
405
|
+
child.stdout?.removeListener("data", onStdoutData);
|
|
406
|
+
child.stderr?.removeListener("data", onStderrData);
|
|
407
|
+
child.removeListener("error", onError);
|
|
408
|
+
child.removeListener("close", onClose);
|
|
409
|
+
if (destroyStreams) {
|
|
410
|
+
child.stdout?.destroy();
|
|
411
|
+
child.stderr?.destroy();
|
|
412
|
+
}
|
|
413
|
+
resolve({
|
|
414
|
+
code,
|
|
415
|
+
stdout: Buffer.concat(stdoutChunks),
|
|
416
|
+
stderr: Buffer.concat(stderrChunks),
|
|
417
|
+
timedOut,
|
|
418
|
+
truncated,
|
|
419
|
+
...(spawnErrorCode ? { spawnErrorCode } : {}),
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function onStdoutData(chunk) {
|
|
423
|
+
const next = takeBoundedChunk(stdoutChunks, stdoutSize, Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk), request.stdoutLimitBytes);
|
|
424
|
+
stdoutSize = next.size;
|
|
425
|
+
if (next.overflowed && !truncated) {
|
|
426
|
+
truncated = true;
|
|
427
|
+
escalate();
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function onStderrData(chunk) {
|
|
431
|
+
const next = takeBoundedChunk(stderrChunks, stderrSize, Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk), request.stderrLimitBytes);
|
|
432
|
+
stderrSize = next.size;
|
|
433
|
+
if (next.overflowed && !truncated) {
|
|
434
|
+
truncated = true;
|
|
435
|
+
escalate();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
function errorCode(error) {
|
|
439
|
+
return error && typeof error === "object" && "code" in error
|
|
440
|
+
? String(error.code)
|
|
441
|
+
: undefined;
|
|
442
|
+
}
|
|
443
|
+
function onError(error) {
|
|
444
|
+
finish(null, errorCode(error));
|
|
445
|
+
}
|
|
446
|
+
function onClose(code) {
|
|
447
|
+
finish(code);
|
|
448
|
+
}
|
|
449
|
+
timeout = setTimeout(() => {
|
|
450
|
+
timedOut = true;
|
|
451
|
+
escalate();
|
|
452
|
+
}, request.timeoutMs);
|
|
453
|
+
child.stdout?.on("data", onStdoutData);
|
|
454
|
+
child.stderr?.on("data", onStderrData);
|
|
455
|
+
child.on("error", onError);
|
|
456
|
+
child.on("close", onClose);
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
function resultFromSpawn(result) {
|
|
460
|
+
if (result.truncated)
|
|
461
|
+
return fail("output_truncated");
|
|
462
|
+
if (result.timedOut)
|
|
463
|
+
return fail("timeout", true);
|
|
464
|
+
if (result.spawnErrorCode === "ENOENT")
|
|
465
|
+
return fail("executable_not_found");
|
|
466
|
+
if (result.spawnErrorCode)
|
|
467
|
+
return fail("spawn_failed", true);
|
|
468
|
+
if (result.code === ALIBABA_CODING_PLAN_AUTH_EXIT_CODE)
|
|
469
|
+
return fail("not_authenticated");
|
|
470
|
+
if (result.code !== 0)
|
|
471
|
+
return fail("nonzero_exit", result.code === null);
|
|
472
|
+
return parseAlibabaCodingPlanUsageJson(result.stdout.toString("utf8"));
|
|
473
|
+
}
|
|
474
|
+
function safeTimeout(value) {
|
|
475
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
476
|
+
return REQUEST_TIMEOUT_MS;
|
|
477
|
+
}
|
|
478
|
+
return Math.min(MAX_CLI_TIMEOUT_MS, Math.max(1, Math.trunc(value)));
|
|
479
|
+
}
|
|
480
|
+
export async function queryAlibabaCodingPlanQuota(options = {}) {
|
|
481
|
+
const runtime = options.runtime ?? {};
|
|
482
|
+
const platform = runtime.platform ?? process.platform;
|
|
483
|
+
if (!isSupportedPlatform(platform))
|
|
484
|
+
return fail("unsupported_platform");
|
|
485
|
+
const paths = pathApi(platform);
|
|
486
|
+
const cwd = paths.resolve(runtime.cwd ?? process.cwd());
|
|
487
|
+
const home = runtime.homedir ?? homedir();
|
|
488
|
+
const pathEnv = runtime.pathEnv ?? runtime.env?.PATH ?? process.env.PATH;
|
|
489
|
+
const resolved = await resolveExecutable({ pathEnv, cwd, homedir: home, platform });
|
|
490
|
+
if (!resolved.ok)
|
|
491
|
+
return { state: "error", error: resolved.error };
|
|
492
|
+
const trustedDirectories = listTrustedPathDirectories({
|
|
493
|
+
pathEnv,
|
|
494
|
+
cwd,
|
|
495
|
+
homedir: home,
|
|
496
|
+
platform,
|
|
497
|
+
});
|
|
498
|
+
const processCwd = resolveNonWorkspaceCwd({
|
|
499
|
+
cwd,
|
|
500
|
+
tmpdir: runtime.tmpdir ?? tmpdir(),
|
|
501
|
+
homedir: home,
|
|
502
|
+
platform,
|
|
503
|
+
});
|
|
504
|
+
const env = {
|
|
505
|
+
...(runtime.env ?? process.env),
|
|
506
|
+
PATH: trustedDirectories.join(paths.delimiter),
|
|
507
|
+
};
|
|
508
|
+
let file = resolved.file;
|
|
509
|
+
let args = ALIBABA_CODING_PLAN_ARGS;
|
|
510
|
+
if (resolved.kind === "windows-shim") {
|
|
511
|
+
const invocation = buildAlibabaCodingPlanWindowsShimInvocation(file, env.SystemRoot ?? env.WINDIR);
|
|
512
|
+
if (!invocation)
|
|
513
|
+
return fail("shell_launcher_rejected");
|
|
514
|
+
file = invocation.file;
|
|
515
|
+
args = invocation.args;
|
|
516
|
+
}
|
|
517
|
+
const request = {
|
|
518
|
+
file,
|
|
519
|
+
args,
|
|
520
|
+
cwd: processCwd,
|
|
521
|
+
env,
|
|
522
|
+
timeoutMs: safeTimeout(options.requestTimeoutMs),
|
|
523
|
+
stdoutLimitBytes: ALIBABA_CODING_PLAN_STDOUT_LIMIT_BYTES,
|
|
524
|
+
stderrLimitBytes: ALIBABA_CODING_PLAN_STDERR_LIMIT_BYTES,
|
|
525
|
+
stdin: "ignore",
|
|
526
|
+
shell: false,
|
|
527
|
+
...(resolved.kind === "windows-shim" ? { windowsVerbatimArguments: true } : {}),
|
|
528
|
+
platform,
|
|
529
|
+
killGraceMs: ALIBABA_CODING_PLAN_KILL_GRACE_MS,
|
|
530
|
+
};
|
|
531
|
+
try {
|
|
532
|
+
const result = await (runtime.spawn ?? runAlibabaCodingPlanProcess)(request);
|
|
533
|
+
return resultFromSpawn(result);
|
|
534
|
+
}
|
|
535
|
+
catch {
|
|
536
|
+
return fail("spawn_failed", true);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
//# sourceMappingURL=alibaba-coding-plan-cli.js.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenCode-managed Anthropic OAuth credentials.
|
|
3
3
|
*
|
|
4
|
-
* Reads the `anthropic` OAuth entry from OpenCode's own opencode.db
|
|
5
|
-
* credential
|
|
6
|
-
* usable even when a separately installed Claude Code has stale credentials.
|
|
4
|
+
* Reads the `anthropic` OAuth entry from OpenCode's own opencode.db for provider
|
|
5
|
+
* discovery. This credential is not used to report Claude subscription quota.
|
|
7
6
|
*/
|
|
8
7
|
import type { AuthData } from "./types.js";
|
|
9
8
|
export declare const DEFAULT_ANTHROPIC_AUTH_CACHE_MAX_AGE_MS = 5000;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenCode-managed Anthropic OAuth credentials.
|
|
3
3
|
*
|
|
4
|
-
* Reads the `anthropic` OAuth entry from OpenCode's own opencode.db
|
|
5
|
-
* credential
|
|
6
|
-
* usable even when a separately installed Claude Code has stale credentials.
|
|
4
|
+
* Reads the `anthropic` OAuth entry from OpenCode's own opencode.db for provider
|
|
5
|
+
* discovery. This credential is not used to report Claude subscription quota.
|
|
7
6
|
*/
|
|
8
7
|
import { readAuthFileCached } from "./opencode-auth.js";
|
|
9
8
|
export const DEFAULT_ANTHROPIC_AUTH_CACHE_MAX_AGE_MS = 5_000;
|