@kaitranntt/ccs 8.4.0 → 8.5.0-dev.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 +5 -2
- package/config/base-claude.settings.json +1 -1
- package/config/base-glm.settings.json +4 -4
- package/config/base-glmt.settings.json +4 -4
- package/config/base-km.settings.json +4 -4
- package/config/base-mm.settings.json +4 -4
- package/dist/api/services/cliproxy-profile-bridge.d.ts.map +1 -1
- package/dist/api/services/cliproxy-profile-bridge.js +20 -9
- package/dist/api/services/cliproxy-profile-bridge.js.map +1 -1
- package/dist/api/services/profile-lifecycle-validation.d.ts.map +1 -1
- package/dist/api/services/profile-lifecycle-validation.js +2 -0
- package/dist/api/services/profile-lifecycle-validation.js.map +1 -1
- package/dist/auth/commands/backup-command.d.ts.map +1 -1
- package/dist/auth/commands/backup-command.js +0 -1
- package/dist/auth/commands/backup-command.js.map +1 -1
- package/dist/auth/commands/create-command.d.ts.map +1 -1
- package/dist/auth/commands/create-command.js +4 -14
- package/dist/auth/commands/create-command.js.map +1 -1
- package/dist/auth/commands/default-command.d.ts.map +1 -1
- package/dist/auth/commands/default-command.js +0 -1
- package/dist/auth/commands/default-command.js.map +1 -1
- package/dist/auth/commands/index.d.ts +2 -1
- package/dist/auth/commands/index.d.ts.map +1 -1
- package/dist/auth/commands/index.js +0 -1
- package/dist/auth/commands/index.js.map +1 -1
- package/dist/auth/commands/remove-command.d.ts.map +1 -1
- package/dist/auth/commands/remove-command.js +0 -2
- package/dist/auth/commands/remove-command.js.map +1 -1
- package/dist/auth/commands/resources-command.d.ts.map +1 -1
- package/dist/auth/commands/resources-command.js +0 -1
- package/dist/auth/commands/resources-command.js.map +1 -1
- package/dist/auth/commands/show-command.d.ts.map +1 -1
- package/dist/auth/commands/show-command.js +0 -1
- package/dist/auth/commands/show-command.js.map +1 -1
- package/dist/auth/commands/types.d.ts.map +1 -1
- package/dist/auth/commands/types.js +0 -1
- package/dist/auth/commands/types.js.map +1 -1
- package/dist/auth/profile-registry.d.ts +3 -1
- package/dist/auth/profile-registry.d.ts.map +1 -1
- package/dist/auth/profile-registry.js +21 -15
- package/dist/auth/profile-registry.js.map +1 -1
- package/dist/ccs.js +27 -21
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/accounts/account-safety.d.ts.map +1 -1
- package/dist/cliproxy/accounts/account-safety.js +56 -56
- package/dist/cliproxy/accounts/account-safety.js.map +1 -1
- package/dist/cliproxy/auth/antigravity-responsibility.d.ts.map +1 -1
- package/dist/cliproxy/auth/antigravity-responsibility.js +15 -15
- package/dist/cliproxy/auth/antigravity-responsibility.js.map +1 -1
- package/dist/cliproxy/auth/auth-token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-token-manager.js +2 -1
- package/dist/cliproxy/auth/auth-token-manager.js.map +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-types.js +3 -2
- package/dist/cliproxy/auth/auth-types.js.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +16 -5
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts +2 -1
- package/dist/cliproxy/auth/provider-refreshers/index.d.ts.map +1 -1
- package/dist/cliproxy/auth/provider-refreshers/index.js +4 -2
- package/dist/cliproxy/auth/provider-refreshers/index.js.map +1 -1
- package/dist/cliproxy/auth/token-manager.d.ts +2 -1
- package/dist/cliproxy/auth/token-manager.d.ts.map +1 -1
- package/dist/cliproxy/auth/token-manager.js +2 -1
- package/dist/cliproxy/auth/token-manager.js.map +1 -1
- package/dist/cliproxy/binary/lifecycle.d.ts.map +1 -1
- package/dist/cliproxy/binary/lifecycle.js +3 -2
- package/dist/cliproxy/binary/lifecycle.js.map +1 -1
- package/dist/cliproxy/config/env-builder.d.ts +19 -2
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +58 -9
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/model-config.d.ts.map +1 -1
- package/dist/cliproxy/config/model-config.js +32 -32
- package/dist/cliproxy/config/model-config.js.map +1 -1
- package/dist/cliproxy/executor/arg-parser.d.ts.map +1 -1
- package/dist/cliproxy/executor/arg-parser.js +26 -26
- package/dist/cliproxy/executor/arg-parser.js.map +1 -1
- package/dist/cliproxy/executor/auth-coordinator.d.ts.map +1 -1
- package/dist/cliproxy/executor/auth-coordinator.js +15 -14
- package/dist/cliproxy/executor/auth-coordinator.js.map +1 -1
- package/dist/cliproxy/executor/browser-launch-setup.d.ts.map +1 -1
- package/dist/cliproxy/executor/browser-launch-setup.js +6 -2
- package/dist/cliproxy/executor/browser-launch-setup.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +27 -17
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/executor/lifecycle-manager.d.ts.map +1 -1
- package/dist/cliproxy/executor/lifecycle-manager.js +18 -16
- package/dist/cliproxy/executor/lifecycle-manager.js.map +1 -1
- package/dist/cliproxy/executor/model-warnings.d.ts.map +1 -1
- package/dist/cliproxy/executor/model-warnings.js +24 -13
- package/dist/cliproxy/executor/model-warnings.js.map +1 -1
- package/dist/cliproxy/executor/retry-handler.d.ts.map +1 -1
- package/dist/cliproxy/executor/retry-handler.js +13 -11
- package/dist/cliproxy/executor/retry-handler.js.map +1 -1
- package/dist/cliproxy/executor/session-bridge.d.ts.map +1 -1
- package/dist/cliproxy/executor/session-bridge.js +18 -10
- package/dist/cliproxy/executor/session-bridge.js.map +1 -1
- package/dist/cliproxy/management/remote-token-uploader.d.ts.map +1 -1
- package/dist/cliproxy/management/remote-token-uploader.js +11 -11
- package/dist/cliproxy/management/remote-token-uploader.js.map +1 -1
- package/dist/cliproxy/provider-capabilities.d.ts +6 -0
- package/dist/cliproxy/provider-capabilities.d.ts.map +1 -1
- package/dist/cliproxy/provider-capabilities.js +28 -3
- package/dist/cliproxy/provider-capabilities.js.map +1 -1
- package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts +5 -1
- package/dist/cliproxy/proxy/https-tunnel-proxy.d.ts.map +1 -1
- package/dist/cliproxy/proxy/https-tunnel-proxy.js +22 -10
- package/dist/cliproxy/proxy/https-tunnel-proxy.js.map +1 -1
- package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts +0 -12
- package/dist/cliproxy/proxy/tool-sanitization-proxy.d.ts.map +1 -1
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js +42 -72
- package/dist/cliproxy/proxy/tool-sanitization-proxy.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.d.ts +21 -0
- package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.js +154 -0
- package/dist/cliproxy/quota/quota-fetcher/account-quota-fetcher.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.d.ts +35 -0
- package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.js +98 -0
- package/dist/cliproxy/quota/quota-fetcher/all-accounts-fetcher.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.d.ts +22 -0
- package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.js +111 -0
- package/dist/cliproxy/quota/quota-fetcher/auth-file-reader.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.d.ts +17 -0
- package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.js +85 -0
- package/dist/cliproxy/quota/quota-fetcher/available-models-fetcher.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/constants.d.ts +25 -0
- package/dist/cliproxy/quota/quota-fetcher/constants.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/constants.js +31 -0
- package/dist/cliproxy/quota/quota-fetcher/constants.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/http-client.d.ts +29 -0
- package/dist/cliproxy/quota/quota-fetcher/http-client.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/http-client.js +199 -0
- package/dist/cliproxy/quota/quota-fetcher/http-client.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/project-lookup.d.ts +16 -0
- package/dist/cliproxy/quota/quota-fetcher/project-lookup.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/project-lookup.js +89 -0
- package/dist/cliproxy/quota/quota-fetcher/project-lookup.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/status-classifier.d.ts +29 -0
- package/dist/cliproxy/quota/quota-fetcher/status-classifier.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/status-classifier.js +168 -0
- package/dist/cliproxy/quota/quota-fetcher/status-classifier.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/types.d.ts +165 -0
- package/dist/cliproxy/quota/quota-fetcher/types.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher/types.js +9 -0
- package/dist/cliproxy/quota/quota-fetcher/types.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-claude.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-claude.js +14 -3
- package/dist/cliproxy/quota/quota-fetcher-claude.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-codex.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-codex.js +36 -9
- package/dist/cliproxy/quota/quota-fetcher-codex.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.d.ts +26 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.js +132 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/auth-file-discovery.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.d.ts +23 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.js +54 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/bucket-building.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.d.ts +26 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.js +29 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/constants.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.d.ts +61 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.js +259 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/error-parsing.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.d.ts +20 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.js +38 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/index.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.d.ts +82 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.js +263 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/managed-request.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.d.ts +46 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.js +188 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/quota-fetcher.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.d.ts +35 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.js +65 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/shared-utils.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.d.ts +37 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.js +117 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/supplementary-metadata.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.d.ts +31 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.js +77 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/token-parsing.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.d.ts +114 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.d.ts.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.js +10 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli/types.js.map +1 -0
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts +13 -58
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js +20 -819
- package/dist/cliproxy/quota/quota-fetcher-gemini-cli.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-ghcp.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher-ghcp.js +19 -4
- package/dist/cliproxy/quota/quota-fetcher-ghcp.js.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher.d.ts +12 -108
- package/dist/cliproxy/quota/quota-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-fetcher.js +23 -766
- package/dist/cliproxy/quota/quota-fetcher.js.map +1 -1
- package/dist/cliproxy/quota/quota-manager.d.ts.map +1 -1
- package/dist/cliproxy/quota/quota-manager.js +7 -3
- package/dist/cliproxy/quota/quota-manager.js.map +1 -1
- package/dist/cliproxy/routing/routing-strategy.d.ts.map +1 -1
- package/dist/cliproxy/routing/routing-strategy.js +11 -3
- package/dist/cliproxy/routing/routing-strategy.js.map +1 -1
- package/dist/commands/api-command/create-command.d.ts.map +1 -1
- package/dist/commands/api-command/create-command.js +17 -8
- package/dist/commands/api-command/create-command.js.map +1 -1
- package/dist/commands/bar/bar-server-probe.d.ts +16 -3
- package/dist/commands/bar/bar-server-probe.d.ts.map +1 -1
- package/dist/commands/bar/bar-server-probe.js +83 -18
- package/dist/commands/bar/bar-server-probe.js.map +1 -1
- package/dist/commands/bar/help-subcommand.d.ts.map +1 -1
- package/dist/commands/bar/help-subcommand.js +3 -2
- package/dist/commands/bar/help-subcommand.js.map +1 -1
- package/dist/commands/bar/index.d.ts.map +1 -1
- package/dist/commands/bar/index.js +1 -0
- package/dist/commands/bar/index.js.map +1 -1
- package/dist/commands/bar/install-subcommand.d.ts +4 -10
- package/dist/commands/bar/install-subcommand.d.ts.map +1 -1
- package/dist/commands/bar/install-subcommand.js +44 -53
- package/dist/commands/bar/install-subcommand.js.map +1 -1
- package/dist/commands/bar/launch-subcommand.d.ts +11 -1
- package/dist/commands/bar/launch-subcommand.d.ts.map +1 -1
- package/dist/commands/bar/launch-subcommand.js +82 -15
- package/dist/commands/bar/launch-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +5 -5
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/index.d.ts.map +1 -1
- package/dist/commands/cliproxy/index.js +7 -2
- package/dist/commands/cliproxy/index.js.map +1 -1
- package/dist/commands/cliproxy/pool-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/pool-subcommand.js +4 -2
- package/dist/commands/cliproxy/pool-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +13 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts +26 -0
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js +82 -0
- package/dist/commands/cliproxy/quota-subcommand/claude-window-helpers.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.d.ts +41 -0
- package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.js +202 -0
- package/dist/commands/cliproxy/quota-subcommand/codex-window-helpers.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/format-helpers.d.ts +32 -0
- package/dist/commands/cliproxy/quota-subcommand/format-helpers.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/format-helpers.js +90 -0
- package/dist/commands/cliproxy/quota-subcommand/format-helpers.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/handlers.d.ts +25 -0
- package/dist/commands/cliproxy/quota-subcommand/handlers.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/handlers.js +245 -0
- package/dist/commands/cliproxy/quota-subcommand/handlers.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/profile-args.d.ts +10 -0
- package/dist/commands/cliproxy/quota-subcommand/profile-args.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/profile-args.js +37 -0
- package/dist/commands/cliproxy/quota-subcommand/profile-args.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/provider-runtime.d.ts +12 -0
- package/dist/commands/cliproxy/quota-subcommand/provider-runtime.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/provider-runtime.js +64 -0
- package/dist/commands/cliproxy/quota-subcommand/provider-runtime.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.d.ts +27 -0
- package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.js +74 -0
- package/dist/commands/cliproxy/quota-subcommand/quota-failure-display.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.d.ts +10 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.js +46 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/antigravity.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts +14 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.js +68 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/claude.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/codex.d.ts +14 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/codex.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/codex.js +82 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/codex.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.d.ts +14 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.js +61 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/gemini-cli.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.d.ts +13 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.js +63 -0
- package/dist/commands/cliproxy/quota-subcommand/sections/ghcp.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/test-exports.d.ts +19 -0
- package/dist/commands/cliproxy/quota-subcommand/test-exports.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/test-exports.js +22 -0
- package/dist/commands/cliproxy/quota-subcommand/test-exports.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/types.d.ts +42 -0
- package/dist/commands/cliproxy/quota-subcommand/types.d.ts.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand/types.js +9 -0
- package/dist/commands/cliproxy/quota-subcommand/types.js.map +1 -0
- package/dist/commands/cliproxy/quota-subcommand.d.ts +14 -36
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +21 -872
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/command-catalog.js +1 -1
- package/dist/commands/command-catalog.js.map +1 -1
- package/dist/commands/config-channels-command.d.ts +1 -1
- package/dist/commands/config-channels-command.d.ts.map +1 -1
- package/dist/commands/config-channels-command.js +3 -3
- package/dist/commands/config-channels-command.js.map +1 -1
- package/dist/commands/config-command-options.d.ts.map +1 -1
- package/dist/commands/config-command-options.js +11 -2
- package/dist/commands/config-command-options.js.map +1 -1
- package/dist/commands/persist-command/arg-parsing.d.ts +14 -0
- package/dist/commands/persist-command/arg-parsing.d.ts.map +1 -0
- package/dist/commands/persist-command/arg-parsing.js +84 -0
- package/dist/commands/persist-command/arg-parsing.js.map +1 -0
- package/dist/commands/persist-command/backup-rotation.d.ts +23 -0
- package/dist/commands/persist-command/backup-rotation.d.ts.map +1 -0
- package/dist/commands/persist-command/backup-rotation.js +265 -0
- package/dist/commands/persist-command/backup-rotation.js.map +1 -0
- package/dist/commands/persist-command/handler.d.ts +10 -0
- package/dist/commands/persist-command/handler.d.ts.map +1 -0
- package/dist/commands/persist-command/handler.js +267 -0
- package/dist/commands/persist-command/handler.js.map +1 -0
- package/dist/commands/persist-command/help.d.ts +9 -0
- package/dist/commands/persist-command/help.d.ts.map +1 -0
- package/dist/commands/persist-command/help.js +86 -0
- package/dist/commands/persist-command/help.js.map +1 -0
- package/dist/commands/persist-command/receipt.d.ts +13 -0
- package/dist/commands/persist-command/receipt.d.ts.map +1 -0
- package/dist/commands/persist-command/receipt.js +102 -0
- package/dist/commands/persist-command/receipt.js.map +1 -0
- package/dist/commands/persist-command/secret-detection.d.ts +11 -0
- package/dist/commands/persist-command/secret-detection.d.ts.map +1 -0
- package/dist/commands/persist-command/secret-detection.js +54 -0
- package/dist/commands/persist-command/secret-detection.js.map +1 -0
- package/dist/commands/persist-command/secure-file.d.ts +21 -0
- package/dist/commands/persist-command/secure-file.d.ts.map +1 -0
- package/dist/commands/persist-command/secure-file.js +231 -0
- package/dist/commands/persist-command/secure-file.js.map +1 -0
- package/dist/commands/persist-command/types.d.ts +42 -0
- package/dist/commands/persist-command/types.d.ts.map +1 -0
- package/dist/commands/persist-command/types.js +34 -0
- package/dist/commands/persist-command/types.js.map +1 -0
- package/dist/commands/persist-command.d.ts +7 -2
- package/dist/commands/persist-command.d.ts.map +1 -1
- package/dist/commands/persist-command.js +17 -933
- package/dist/commands/persist-command.js.map +1 -1
- package/dist/commands/proxy-command.d.ts.map +1 -1
- package/dist/commands/proxy-command.js +7 -1
- package/dist/commands/proxy-command.js.map +1 -1
- package/dist/commands/setup-command.d.ts.map +1 -1
- package/dist/commands/setup-command.js +11 -1
- package/dist/commands/setup-command.js.map +1 -1
- package/dist/commands/tokens-command.d.ts.map +1 -1
- package/dist/commands/tokens-command.js +6 -0
- package/dist/commands/tokens-command.js.map +1 -1
- package/dist/config/config-loader-facade.d.ts +1 -1
- package/dist/config/config-loader-facade.d.ts.map +1 -1
- package/dist/config/config-loader-facade.js +3 -1
- package/dist/config/config-loader-facade.js.map +1 -1
- package/dist/config/loader/config-getters.d.ts +16 -0
- package/dist/config/loader/config-getters.d.ts.map +1 -1
- package/dist/config/loader/config-getters.js +33 -1
- package/dist/config/loader/config-getters.js.map +1 -1
- package/dist/config/loader/defaults-merger.d.ts.map +1 -1
- package/dist/config/loader/defaults-merger.js +4 -0
- package/dist/config/loader/defaults-merger.js.map +1 -1
- package/dist/config/loader/yaml-serializer.d.ts.map +1 -1
- package/dist/config/loader/yaml-serializer.js +13 -0
- package/dist/config/loader/yaml-serializer.js.map +1 -1
- package/dist/config/schemas/index.d.ts +2 -0
- package/dist/config/schemas/index.d.ts.map +1 -1
- package/dist/config/schemas/index.js +5 -1
- package/dist/config/schemas/index.js.map +1 -1
- package/dist/config/schemas/runtime.d.ts +57 -0
- package/dist/config/schemas/runtime.d.ts.map +1 -0
- package/dist/config/schemas/runtime.js +51 -0
- package/dist/config/schemas/runtime.js.map +1 -0
- package/dist/config/schemas/unified-config.d.ts +3 -0
- package/dist/config/schemas/unified-config.d.ts.map +1 -1
- package/dist/config/schemas/unified-config.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +1 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +25 -13
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/copilot/copilot-executor.js +25 -25
- package/dist/copilot/copilot-executor.js.map +1 -1
- package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon-entry.js +34 -9
- package/dist/cursor/cursor-daemon-entry.js.map +1 -1
- package/dist/cursor/cursor-daemon.d.ts.map +1 -1
- package/dist/cursor/cursor-daemon.js +1 -0
- package/dist/cursor/cursor-daemon.js.map +1 -1
- package/dist/cursor/cursor-profile-executor.d.ts.map +1 -1
- package/dist/cursor/cursor-profile-executor.js +18 -17
- package/dist/cursor/cursor-profile-executor.js.map +1 -1
- package/dist/delegation/delegation-handler.d.ts.map +1 -1
- package/dist/delegation/delegation-handler.js +29 -23
- package/dist/delegation/delegation-handler.js.map +1 -1
- package/dist/delegation/headless-executor.d.ts +1 -0
- package/dist/delegation/headless-executor.d.ts.map +1 -1
- package/dist/delegation/headless-executor.js +36 -15
- package/dist/delegation/headless-executor.js.map +1 -1
- package/dist/delegation/session-manager.d.ts.map +1 -1
- package/dist/delegation/session-manager.js +12 -4
- package/dist/delegation/session-manager.js.map +1 -1
- package/dist/dispatcher/cli-argument-parser.d.ts +1 -1
- package/dist/dispatcher/cli-argument-parser.d.ts.map +1 -1
- package/dist/dispatcher/cli-argument-parser.js +24 -23
- package/dist/dispatcher/cli-argument-parser.js.map +1 -1
- package/dist/dispatcher/flows/cliproxy-flow.d.ts.map +1 -1
- package/dist/dispatcher/flows/cliproxy-flow.js +12 -15
- package/dist/dispatcher/flows/cliproxy-flow.js.map +1 -1
- package/dist/dispatcher/flows/copilot-flow.js +1 -1
- package/dist/dispatcher/flows/copilot-flow.js.map +1 -1
- package/dist/dispatcher/flows/cursor-flow.js +1 -1
- package/dist/dispatcher/flows/cursor-flow.js.map +1 -1
- package/dist/dispatcher/flows/settings-flow.d.ts.map +1 -1
- package/dist/dispatcher/flows/settings-flow.js +32 -29
- package/dist/dispatcher/flows/settings-flow.js.map +1 -1
- package/dist/dispatcher/pre-dispatch.d.ts.map +1 -1
- package/dist/dispatcher/pre-dispatch.js +26 -10
- package/dist/dispatcher/pre-dispatch.js.map +1 -1
- package/dist/dispatcher/profile-resolver.d.ts +1 -1
- package/dist/dispatcher/profile-resolver.d.ts.map +1 -1
- package/dist/dispatcher/profile-resolver.js +36 -23
- package/dist/dispatcher/profile-resolver.js.map +1 -1
- package/dist/docker/supervisord-lifecycle.d.ts.map +1 -1
- package/dist/docker/supervisord-lifecycle.js +5 -1
- package/dist/docker/supervisord-lifecycle.js.map +1 -1
- package/dist/errors/error-types.d.ts +26 -22
- package/dist/errors/error-types.d.ts.map +1 -1
- package/dist/errors/error-types.js +15 -12
- package/dist/errors/error-types.js.map +1 -1
- package/dist/errors/exit-codes.d.ts +20 -13
- package/dist/errors/exit-codes.d.ts.map +1 -1
- package/dist/errors/exit-codes.js +32 -28
- package/dist/errors/exit-codes.js.map +1 -1
- package/dist/glmt/delta-accumulator.d.ts +1 -0
- package/dist/glmt/delta-accumulator.d.ts.map +1 -1
- package/dist/glmt/delta-accumulator.js +12 -4
- package/dist/glmt/delta-accumulator.js.map +1 -1
- package/dist/glmt/glmt-proxy.d.ts.map +1 -1
- package/dist/glmt/glmt-proxy.js +39 -10
- package/dist/glmt/glmt-proxy.js.map +1 -1
- package/dist/glmt/glmt-transformer.d.ts.map +1 -1
- package/dist/glmt/glmt-transformer.js +1 -4
- package/dist/glmt/glmt-transformer.js.map +1 -1
- package/dist/glmt/pipeline/request-transformer.d.ts.map +1 -1
- package/dist/glmt/pipeline/request-transformer.js +5 -1
- package/dist/glmt/pipeline/request-transformer.js.map +1 -1
- package/dist/glmt/pipeline/response-builder.d.ts.map +1 -1
- package/dist/glmt/pipeline/response-builder.js +7 -3
- package/dist/glmt/pipeline/response-builder.js.map +1 -1
- package/dist/glmt/pipeline/stream-parser.d.ts.map +1 -1
- package/dist/glmt/pipeline/stream-parser.js +11 -5
- package/dist/glmt/pipeline/stream-parser.js.map +1 -1
- package/dist/glmt/pipeline/tool-call-handler.d.ts.map +1 -1
- package/dist/glmt/pipeline/tool-call-handler.js +7 -1
- package/dist/glmt/pipeline/tool-call-handler.js.map +1 -1
- package/dist/glmt/sse-parser.d.ts +1 -0
- package/dist/glmt/sse-parser.d.ts.map +1 -1
- package/dist/glmt/sse-parser.js +7 -3
- package/dist/glmt/sse-parser.js.map +1 -1
- package/dist/management/checks/cliproxy-check.d.ts.map +1 -1
- package/dist/management/checks/cliproxy-check.js +15 -1
- package/dist/management/checks/cliproxy-check.js.map +1 -1
- package/dist/management/checks/config-check.d.ts.map +1 -1
- package/dist/management/checks/config-check.js +4 -1
- package/dist/management/checks/config-check.js.map +1 -1
- package/dist/management/checks/profile-check.d.ts.map +1 -1
- package/dist/management/checks/profile-check.js +10 -6
- package/dist/management/checks/profile-check.js.map +1 -1
- package/dist/management/doctor.d.ts +7 -0
- package/dist/management/doctor.d.ts.map +1 -1
- package/dist/management/doctor.js +31 -9
- package/dist/management/doctor.js.map +1 -1
- package/dist/management/shared-manager/fs-helpers.d.ts +69 -0
- package/dist/management/shared-manager/fs-helpers.d.ts.map +1 -0
- package/dist/management/shared-manager/fs-helpers.js +241 -0
- package/dist/management/shared-manager/fs-helpers.js.map +1 -0
- package/dist/management/shared-manager/migrations.d.ts +21 -0
- package/dist/management/shared-manager/migrations.d.ts.map +1 -0
- package/dist/management/shared-manager/migrations.js +187 -0
- package/dist/management/shared-manager/migrations.js.map +1 -0
- package/dist/management/shared-manager/orchestrator.d.ts +87 -0
- package/dist/management/shared-manager/orchestrator.d.ts.map +1 -0
- package/dist/management/shared-manager/orchestrator.js +161 -0
- package/dist/management/shared-manager/orchestrator.js.map +1 -0
- package/dist/management/shared-manager/plugin-layout-internals.d.ts +42 -0
- package/dist/management/shared-manager/plugin-layout-internals.d.ts.map +1 -0
- package/dist/management/shared-manager/plugin-layout-internals.js +192 -0
- package/dist/management/shared-manager/plugin-layout-internals.js.map +1 -0
- package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts +53 -0
- package/dist/management/shared-manager/plugin-metadata-normalizer.d.ts.map +1 -0
- package/dist/management/shared-manager/plugin-metadata-normalizer.js +253 -0
- package/dist/management/shared-manager/plugin-metadata-normalizer.js.map +1 -0
- package/dist/management/shared-manager/project-context-sync.d.ts +36 -0
- package/dist/management/shared-manager/project-context-sync.d.ts.map +1 -0
- package/dist/management/shared-manager/project-context-sync.js +204 -0
- package/dist/management/shared-manager/project-context-sync.js.map +1 -0
- package/dist/management/shared-manager/project-memory-sync.d.ts +21 -0
- package/dist/management/shared-manager/project-memory-sync.d.ts.map +1 -0
- package/dist/management/shared-manager/project-memory-sync.js +113 -0
- package/dist/management/shared-manager/project-memory-sync.js.map +1 -0
- package/dist/management/shared-manager/shared-dir-linker.d.ts +41 -0
- package/dist/management/shared-manager/shared-dir-linker.d.ts.map +1 -0
- package/dist/management/shared-manager/shared-dir-linker.js +227 -0
- package/dist/management/shared-manager/shared-dir-linker.js.map +1 -0
- package/dist/management/shared-manager/symlink-helpers.d.ts +61 -0
- package/dist/management/shared-manager/symlink-helpers.d.ts.map +1 -0
- package/dist/management/shared-manager/symlink-helpers.js +243 -0
- package/dist/management/shared-manager/symlink-helpers.js.map +1 -0
- package/dist/management/shared-manager/types.d.ts +45 -0
- package/dist/management/shared-manager/types.d.ts.map +1 -0
- package/dist/management/shared-manager/types.js +57 -0
- package/dist/management/shared-manager/types.js.map +1 -0
- package/dist/management/shared-manager.d.ts +13 -160
- package/dist/management/shared-manager.d.ts.map +1 -1
- package/dist/management/shared-manager.js +18 -1294
- package/dist/management/shared-manager.js.map +1 -1
- package/dist/proxy/proxy-daemon-entry.js +1 -1
- package/dist/proxy/proxy-daemon-entry.js.map +1 -1
- package/dist/proxy/server/messages-route.d.ts +10 -0
- package/dist/proxy/server/messages-route.d.ts.map +1 -1
- package/dist/proxy/server/messages-route.js +34 -7
- package/dist/proxy/server/messages-route.js.map +1 -1
- package/dist/proxy/server/proxy-server.d.ts.map +1 -1
- package/dist/proxy/server/proxy-server.js +1 -1
- package/dist/proxy/server/proxy-server.js.map +1 -1
- package/dist/proxy/transformers/sse-stream-transformer.d.ts.map +1 -1
- package/dist/proxy/transformers/sse-stream-transformer.js +12 -17
- package/dist/proxy/transformers/sse-stream-transformer.js.map +1 -1
- package/dist/services/logging/index.d.ts +1 -1
- package/dist/services/logging/index.d.ts.map +1 -1
- package/dist/services/logging/index.js +6 -1
- package/dist/services/logging/index.js.map +1 -1
- package/dist/services/logging/log-context.d.ts +27 -2
- package/dist/services/logging/log-context.d.ts.map +1 -1
- package/dist/services/logging/log-context.js +43 -4
- package/dist/services/logging/log-context.js.map +1 -1
- package/dist/services/logging/log-redaction.d.ts +9 -0
- package/dist/services/logging/log-redaction.d.ts.map +1 -1
- package/dist/services/logging/log-redaction.js +31 -3
- package/dist/services/logging/log-redaction.js.map +1 -1
- package/dist/services/logging/logger.js +2 -2
- package/dist/services/logging/logger.js.map +1 -1
- package/dist/shared/provider-preset-catalog.d.ts +1 -1
- package/dist/shared/provider-preset-catalog.d.ts.map +1 -1
- package/dist/shared/provider-preset-catalog.js +21 -7
- package/dist/shared/provider-preset-catalog.js.map +1 -1
- package/dist/targets/claude-adapter.d.ts.map +1 -1
- package/dist/targets/claude-adapter.js +5 -0
- package/dist/targets/claude-adapter.js.map +1 -1
- package/dist/targets/codex-adapter.d.ts.map +1 -1
- package/dist/targets/codex-adapter.js +11 -10
- package/dist/targets/codex-adapter.js.map +1 -1
- package/dist/targets/codex-detector.d.ts.map +1 -1
- package/dist/targets/codex-detector.js +14 -0
- package/dist/targets/codex-detector.js.map +1 -1
- package/dist/targets/droid-adapter.d.ts.map +1 -1
- package/dist/targets/droid-adapter.js +12 -12
- package/dist/targets/droid-adapter.js.map +1 -1
- package/dist/ui/assets/{Trans-RG_sMDEu.js → Trans-GYzYLs2D.js} +1 -1
- package/dist/ui/assets/{accounts-yTXURc-q.js → accounts-DC1QuyI9.js} +1 -1
- package/dist/ui/assets/{alert-dialog-DjvPgzFs.js → alert-dialog-6SiedqmE.js} +1 -1
- package/dist/ui/assets/{api-Ck1dtNEM.js → api-3s21dbNJ.js} +1 -1
- package/dist/ui/assets/{auth-section-DBnY_LPz.js → auth-section-XBfNgVN4.js} +1 -1
- package/dist/ui/assets/{backups-section-Ci-uL4Of.js → backups-section-BidiiVlq.js} +1 -1
- package/dist/ui/assets/{channels-BeS9O5q0.js → channels-pfgPUDGt.js} +1 -1
- package/dist/ui/assets/{checkbox-DFeFDZBp.js → checkbox-CJw_-nvC.js} +1 -1
- package/dist/ui/assets/{claude-extension-DS5qN19Z.js → claude-extension-BIIUOvTJ.js} +1 -1
- package/dist/ui/assets/{cliproxy-D7HJH4mZ.js → cliproxy-Cq8OX0Pu.js} +1 -1
- package/dist/ui/assets/{cliproxy-ai-providers-oJQZXrtc.js → cliproxy-ai-providers-DI760ZF0.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-2mRPEcRj.js → cliproxy-control-panel-CBqvpOqj.js} +1 -1
- package/dist/ui/assets/{codex-D0AUQ6jA.js → codex-DL4OLBUu.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-B37-CVuq.js → confirm-dialog-CC_Cc3EO.js} +1 -1
- package/dist/ui/assets/{copilot-KaaW-mko.js → copilot-D2kEhTXR.js} +1 -1
- package/dist/ui/assets/{cursor-BKiTgYi5.js → cursor-BashLrYk.js} +1 -1
- package/dist/ui/assets/{droid-DHdqGnFw.js → droid-DaKTINFL.js} +1 -1
- package/dist/ui/assets/{globalenv-section-SfZO97nU.js → globalenv-section-BQicL8L0.js} +1 -1
- package/dist/ui/assets/{health-CSRS9O0D.js → health-bRbE_ADg.js} +1 -1
- package/dist/ui/assets/{index-CGgavq2X.js → index-B2JEyN3d.js} +36 -36
- package/dist/ui/assets/{index-Cu_F55_O.js → index-BwZdl1HU.js} +1 -1
- package/dist/ui/assets/{index-DWUuSBUe.js → index-CgeAb1-K.js} +1 -1
- package/dist/ui/assets/{index-iQuEEGbH.js → index-DAQ0qIQ_.js} +1 -1
- package/dist/ui/assets/{index-ChTYEBCZ.js → index-O2x1grGh.js} +1 -1
- package/dist/ui/assets/{index-DycwEe96.js → index-WA7tK6np.js} +1 -1
- package/dist/ui/assets/{index-DJ66NrBH.js → index-mf2X1GwS.js} +1 -1
- package/dist/ui/assets/{logs-tiZ_51mo.js → logs-qrBHUJ0H.js} +1 -1
- package/dist/ui/assets/{masked-input-D9FVoeMA.js → masked-input-CXwQ4E-g.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-2k26d8pS.js → proxy-status-widget-DPz4nCzR.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-CguBh93H.js → raw-json-settings-editor-panel-CcvsWVh1.js} +1 -1
- package/dist/ui/assets/{searchable-select-C4wShshD.js → searchable-select-EXSjNCRu.js} +1 -1
- package/dist/ui/assets/{separator-mvGlDdEW.js → separator-D2CTfWBQ.js} +1 -1
- package/dist/ui/assets/{shared-Ck0yAwbs.js → shared-DpgzhFqe.js} +1 -1
- package/dist/ui/assets/{table-DrUJOxKL.js → table-DwbiGRYk.js} +1 -1
- package/dist/ui/assets/{updates-BVHBFcq8.js → updates-D8jfIb2y.js} +1 -1
- package/dist/ui/assets/{use-accounts-DLtuaniS.js → use-accounts-Bwtpnx-x.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/utils/bar-auth-token.d.ts +4 -0
- package/dist/utils/bar-auth-token.d.ts.map +1 -0
- package/dist/utils/bar-auth-token.js +60 -0
- package/dist/utils/bar-auth-token.js.map +1 -0
- package/dist/utils/browser/browser-settings.d.ts +3 -1
- package/dist/utils/browser/browser-settings.d.ts.map +1 -1
- package/dist/utils/browser/browser-settings.js +2 -2
- package/dist/utils/browser/browser-settings.js.map +1 -1
- package/dist/utils/browser/browser-setup.d.ts.map +1 -1
- package/dist/utils/browser/browser-setup.js +3 -1
- package/dist/utils/browser/browser-setup.js.map +1 -1
- package/dist/utils/browser/browser-status.d.ts.map +1 -1
- package/dist/utils/browser/browser-status.js +4 -2
- package/dist/utils/browser/browser-status.js.map +1 -1
- package/dist/utils/fetch-proxy-setup.d.ts +3 -2
- package/dist/utils/fetch-proxy-setup.d.ts.map +1 -1
- package/dist/utils/fetch-proxy-setup.js +10 -6
- package/dist/utils/fetch-proxy-setup.js.map +1 -1
- package/dist/utils/image-analysis/mcp-installer.d.ts.map +1 -1
- package/dist/utils/image-analysis/mcp-installer.js +16 -13
- package/dist/utils/image-analysis/mcp-installer.js.map +1 -1
- package/dist/utils/websearch/index.d.ts +1 -1
- package/dist/utils/websearch/index.d.ts.map +1 -1
- package/dist/utils/websearch/index.js +2 -1
- package/dist/utils/websearch/index.js.map +1 -1
- package/dist/utils/websearch/mcp-installer.d.ts +8 -0
- package/dist/utils/websearch/mcp-installer.d.ts.map +1 -1
- package/dist/utils/websearch/mcp-installer.js +34 -13
- package/dist/utils/websearch/mcp-installer.js.map +1 -1
- package/dist/utils/websearch-manager.d.ts +1 -1
- package/dist/utils/websearch-manager.d.ts.map +1 -1
- package/dist/utils/websearch-manager.js +2 -1
- package/dist/utils/websearch-manager.js.map +1 -1
- package/dist/web-server/middleware/request-logging-middleware.d.ts.map +1 -1
- package/dist/web-server/middleware/request-logging-middleware.js +14 -9
- package/dist/web-server/middleware/request-logging-middleware.js.map +1 -1
- package/dist/web-server/model-pricing.d.ts.map +1 -1
- package/dist/web-server/model-pricing.js +22 -2
- package/dist/web-server/model-pricing.js.map +1 -1
- package/dist/web-server/routes/bar-routes.d.ts +12 -1
- package/dist/web-server/routes/bar-routes.d.ts.map +1 -1
- package/dist/web-server/routes/bar-routes.js +22 -6
- package/dist/web-server/routes/bar-routes.js.map +1 -1
- package/dist/web-server/routes/claude-extension-routes.d.ts.map +1 -1
- package/dist/web-server/routes/claude-extension-routes.js +3 -2
- package/dist/web-server/routes/claude-extension-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts +1 -0
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +20 -5
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes/config-routes.d.ts +16 -0
- package/dist/web-server/routes/cliproxy-stats-routes/config-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/config-routes.js +219 -0
- package/dist/web-server/routes/cliproxy-stats-routes/config-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.d.ts +12 -0
- package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.js +153 -0
- package/dist/web-server/routes/cliproxy-stats-routes/error-log-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.d.ts +19 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.js +38 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-helpers.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.d.ts +13 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.js +195 -0
- package/dist/web-server/routes/cliproxy-stats-routes/quota-routes.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/restart-route.d.ts +17 -0
- package/dist/web-server/routes/cliproxy-stats-routes/restart-route.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/restart-route.js +34 -0
- package/dist/web-server/routes/cliproxy-stats-routes/restart-route.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/router.d.ts +10 -0
- package/dist/web-server/routes/cliproxy-stats-routes/router.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/router.js +245 -0
- package/dist/web-server/routes/cliproxy-stats-routes/router.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/shared.d.ts +35 -0
- package/dist/web-server/routes/cliproxy-stats-routes/shared.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/shared.js +59 -0
- package/dist/web-server/routes/cliproxy-stats-routes/shared.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.d.ts +44 -0
- package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.d.ts.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.js +66 -0
- package/dist/web-server/routes/cliproxy-stats-routes/version-helpers.js.map +1 -0
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts +16 -57
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +25 -926
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-sync-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-sync-routes.js +9 -2
- package/dist/web-server/routes/cliproxy-sync-routes.js.map +1 -1
- package/dist/web-server/routes/copilot-settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/copilot-settings-routes.js +2 -1
- package/dist/web-server/routes/copilot-settings-routes.js.map +1 -1
- package/dist/web-server/routes/cursor-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cursor-routes.js +3 -1
- package/dist/web-server/routes/cursor-routes.js.map +1 -1
- package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
- package/dist/web-server/routes/image-analysis-routes.js +2 -1
- package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +6 -0
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/routes/persist-routes.d.ts.map +1 -1
- package/dist/web-server/routes/persist-routes.js +8 -1
- package/dist/web-server/routes/persist-routes.js.map +1 -1
- package/dist/web-server/routes/proxy-routes.d.ts.map +1 -1
- package/dist/web-server/routes/proxy-routes.js +33 -5
- package/dist/web-server/routes/proxy-routes.js.map +1 -1
- package/dist/web-server/routes/route-helpers.d.ts.map +1 -1
- package/dist/web-server/routes/route-helpers.js +18 -6
- package/dist/web-server/routes/route-helpers.js.map +1 -1
- package/dist/web-server/routes/settings-routes.d.ts.map +1 -1
- package/dist/web-server/routes/settings-routes.js +7 -6
- package/dist/web-server/routes/settings-routes.js.map +1 -1
- package/dist/web-server/usage/aggregator.d.ts.map +1 -1
- package/dist/web-server/usage/aggregator.js +8 -8
- package/dist/web-server/usage/aggregator.js.map +1 -1
- package/dist/web-server/usage/bar-analytics.d.ts +21 -0
- package/dist/web-server/usage/bar-analytics.d.ts.map +1 -1
- package/dist/web-server/usage/bar-analytics.js +78 -9
- package/dist/web-server/usage/bar-analytics.js.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.d.ts.map +1 -1
- package/dist/web-server/usage/cliproxy-usage-transformer.js +9 -4
- package/dist/web-server/usage/cliproxy-usage-transformer.js.map +1 -1
- package/dist/web-server/usage/codex-local-quota-collector.d.ts +2 -2
- package/dist/web-server/usage/codex-local-quota-collector.d.ts.map +1 -1
- package/dist/web-server/usage/codex-local-quota-collector.js +39 -11
- package/dist/web-server/usage/codex-local-quota-collector.js.map +1 -1
- package/dist/web-server/usage/handlers.d.ts.map +1 -1
- package/dist/web-server/usage/handlers.js +1 -1
- package/dist/web-server/usage/handlers.js.map +1 -1
- package/dist/web-server/usage/native-quota-collector.d.ts +37 -9
- package/dist/web-server/usage/native-quota-collector.d.ts.map +1 -1
- package/dist/web-server/usage/native-quota-collector.js +226 -23
- package/dist/web-server/usage/native-quota-collector.js.map +1 -1
- package/package.json +1 -1
- package/scripts/ci-parity-gate.sh +31 -0
- package/scripts/generate-throw-error-baseline.js +103 -0
- package/scripts/github/stable-release-issue-cleanup-lib.mjs +51 -11
- package/scripts/hardening-inventory.js +62 -4
- package/scripts/maintainability-metrics.js +356 -0
|
@@ -1,828 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Quota Fetcher for Gemini CLI Accounts
|
|
3
|
+
* Quota Fetcher for Gemini CLI Accounts (barrel)
|
|
4
4
|
*
|
|
5
5
|
* Fetches quota information from Google Cloud Code internal API.
|
|
6
6
|
* Used for displaying bucket-based quotas grouped by model series.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.buildGeminiCliBuckets = exports.resolveGeminiCliProjectId = exports.__testExports = exports.fetchAllGeminiCliQuotas = exports.fetchGeminiCliQuota = void 0;
|
|
33
|
-
const fs = __importStar(require("node:fs"));
|
|
34
|
-
const path = __importStar(require("node:path"));
|
|
35
|
-
const config_generator_1 = require("../config/config-generator");
|
|
36
|
-
const account_manager_1 = require("../accounts/account-manager");
|
|
37
|
-
const auth_utils_1 = require("../auth/auth-utils");
|
|
38
|
-
const gemini_cli_quota_normalizer_1 = require("./gemini-cli-quota-normalizer");
|
|
39
|
-
const provider_capabilities_1 = require("../provider-capabilities");
|
|
40
|
-
const proxy_target_resolver_1 = require("../proxy/proxy-target-resolver");
|
|
41
|
-
const provider_entitlement_evidence_1 = require("../auth/provider-entitlement-evidence");
|
|
42
|
-
/** Google Cloud Code API endpoints */
|
|
43
|
-
const GEMINI_CLI_API_BASE = 'https://cloudcode-pa.googleapis.com';
|
|
44
|
-
const GEMINI_CLI_API_VERSION = 'v1internal';
|
|
45
|
-
const GEMINI_CLI_QUOTA_URL = `${GEMINI_CLI_API_BASE}/${GEMINI_CLI_API_VERSION}:retrieveUserQuota`;
|
|
46
|
-
const GEMINI_CLI_CODE_ASSIST_URL = `${GEMINI_CLI_API_BASE}/${GEMINI_CLI_API_VERSION}:loadCodeAssist`;
|
|
47
|
-
const GEMINI_CLI_ERROR_DETAIL_MAX_LENGTH = 320;
|
|
48
|
-
const GEMINI_CLI_ERROR_DETAIL_TRUNCATION_SUFFIX = '...[truncated]';
|
|
49
|
-
const GEMINI_CLI_G1_CREDIT_TYPE = 'GOOGLE_ONE_AI';
|
|
50
|
-
const MANAGEMENT_API_TIMEOUT_MS = 5000;
|
|
51
|
-
const SECONDARY_REQUEST_TIMEOUT_MS = 2000;
|
|
52
|
-
function getRemainingTimeoutMs(deadlineMs) {
|
|
53
|
-
return Math.max(1, deadlineMs - Date.now());
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Extract project ID from account field
|
|
57
|
-
* Input: "user@example.com (cloudaicompanion-abc-123)"
|
|
58
|
-
* Output: "cloudaicompanion-abc-123"
|
|
59
|
-
*/
|
|
60
|
-
function resolveGeminiCliProjectId(accountField) {
|
|
61
|
-
const regex = /\(([^()]+)\)/g;
|
|
62
|
-
let match;
|
|
63
|
-
let lastMatch = null;
|
|
64
|
-
while ((match = regex.exec(accountField)) !== null) {
|
|
65
|
-
lastMatch = match[1];
|
|
66
|
-
}
|
|
67
|
-
return lastMatch;
|
|
68
|
-
}
|
|
69
|
-
exports.resolveGeminiCliProjectId = resolveGeminiCliProjectId;
|
|
70
|
-
/**
|
|
71
|
-
* Extract access token from Gemini auth file data
|
|
72
|
-
* Handles both flat (access_token) and nested (token.access_token) structures
|
|
73
|
-
*/
|
|
74
|
-
function extractAccessToken(data) {
|
|
75
|
-
// Flat structure: { access_token: "..." }
|
|
76
|
-
if (typeof data.access_token === 'string') {
|
|
77
|
-
return data.access_token;
|
|
78
|
-
}
|
|
79
|
-
// Nested structure: { token: { access_token: "..." } }
|
|
80
|
-
if (data.token && typeof data.token === 'object') {
|
|
81
|
-
const token = data.token;
|
|
82
|
-
if (typeof token.access_token === 'string') {
|
|
83
|
-
return token.access_token;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Extract expiry from Gemini auth file data
|
|
90
|
-
* Handles both flat (expired) and nested (token.expiry) structures
|
|
91
|
-
*/
|
|
92
|
-
function extractExpiry(data) {
|
|
93
|
-
// Flat structure: { expired: "..." }
|
|
94
|
-
if (typeof data.expired === 'string') {
|
|
95
|
-
return data.expired;
|
|
96
|
-
}
|
|
97
|
-
if (typeof data.expired === 'number') {
|
|
98
|
-
return data.expired;
|
|
99
|
-
}
|
|
100
|
-
// Nested structure: { token: { expiry: "..." } }
|
|
101
|
-
if (data.token && typeof data.token === 'object') {
|
|
102
|
-
const token = data.token;
|
|
103
|
-
if (typeof token.expiry === 'string') {
|
|
104
|
-
return token.expiry;
|
|
105
|
-
}
|
|
106
|
-
if (typeof token.expiry === 'number') {
|
|
107
|
-
return token.expiry;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Check if file matches Gemini CLI auth file patterns
|
|
114
|
-
* Patterns: gemini-*.json OR *-gen-lang-client-*.json OR email@domain.com-*.json with type=gemini
|
|
115
|
-
*/
|
|
116
|
-
function isGeminiAuthFile(filename) {
|
|
117
|
-
if (!filename.endsWith('.json'))
|
|
118
|
-
return false;
|
|
119
|
-
// Legacy pattern: gemini-email.json
|
|
120
|
-
if (filename.startsWith('gemini-'))
|
|
121
|
-
return true;
|
|
122
|
-
// New pattern: email-gen-lang-client-projectId.json
|
|
123
|
-
if (filename.includes('-gen-lang-client-'))
|
|
124
|
-
return true;
|
|
125
|
-
// Check if contains @ (email pattern) - will verify type inside
|
|
126
|
-
if (filename.includes('@'))
|
|
127
|
-
return true;
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
function safeParseJson(bodyText) {
|
|
131
|
-
try {
|
|
132
|
-
return JSON.parse(bodyText);
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
async function readManagedResponse(response, viaManagement) {
|
|
139
|
-
const bodyText = await response.text();
|
|
140
|
-
return {
|
|
141
|
-
status: response.status,
|
|
142
|
-
bodyText,
|
|
143
|
-
json: safeParseJson(bodyText),
|
|
144
|
-
viaManagement,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function isGeminiAuthFileForAccount(file, accountId) {
|
|
148
|
-
const rawProvider = normalizeStringValue(file.provider ?? file.type);
|
|
149
|
-
if (!rawProvider || (0, provider_capabilities_1.mapExternalProviderName)(rawProvider) !== 'gemini') {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
const email = normalizeStringValue(file.email);
|
|
153
|
-
const normalizedAccountId = accountId.trim().toLowerCase();
|
|
154
|
-
if (email?.toLowerCase() === normalizedAccountId) {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
const normalizedName = normalizeStringValue(file.name);
|
|
158
|
-
if (!normalizedName) {
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
const normalizedFileName = normalizedName.toLowerCase();
|
|
162
|
-
const sanitizedAccount = (0, auth_utils_1.sanitizeEmail)(accountId).toLowerCase();
|
|
163
|
-
return (normalizedFileName === `gemini-${sanitizedAccount}.json` ||
|
|
164
|
-
normalizedFileName.startsWith(`${normalizedAccountId}-gen-lang-client-`) ||
|
|
165
|
-
normalizedFileName.includes(sanitizedAccount));
|
|
166
|
-
}
|
|
167
|
-
async function findManagedGeminiAuthIndex(accountId, timeoutMs) {
|
|
168
|
-
const target = (0, proxy_target_resolver_1.getProxyTarget)();
|
|
169
|
-
const controller = new AbortController();
|
|
170
|
-
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
171
|
-
try {
|
|
172
|
-
const response = await fetch((0, proxy_target_resolver_1.buildProxyUrl)(target, '/v0/management/auth-files'), {
|
|
173
|
-
signal: controller.signal,
|
|
174
|
-
headers: (0, proxy_target_resolver_1.buildManagementHeaders)(target),
|
|
175
|
-
});
|
|
176
|
-
clearTimeout(timeoutId);
|
|
177
|
-
if (!response.ok) {
|
|
178
|
-
return { authIndex: null, unavailable: true };
|
|
179
|
-
}
|
|
180
|
-
const data = (await response.json());
|
|
181
|
-
const match = data.files?.find((file) => isGeminiAuthFileForAccount(file, accountId));
|
|
182
|
-
return { authIndex: match?.auth_index ?? null, unavailable: false };
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
clearTimeout(timeoutId);
|
|
186
|
-
return { authIndex: null, unavailable: true };
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
async function getManagedGeminiAuthIndex(accountId, timeoutMs, context) {
|
|
190
|
-
if (!context) {
|
|
191
|
-
return await findManagedGeminiAuthIndex(accountId, timeoutMs);
|
|
192
|
-
}
|
|
193
|
-
context.authIndexLookupPromise ?? (context.authIndexLookupPromise = findManagedGeminiAuthIndex(accountId, timeoutMs));
|
|
194
|
-
return await context.authIndexLookupPromise;
|
|
195
|
-
}
|
|
196
|
-
class GeminiManagedAuthUnavailableError extends Error {
|
|
197
|
-
constructor() {
|
|
198
|
-
super('CLIProxy managed Gemini auth is temporarily unavailable');
|
|
199
|
-
this.name = 'GeminiManagedAuthUnavailableError';
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
async function performManagedGeminiRequest(accountId, url, body, timeoutMs, authContext) {
|
|
203
|
-
const deadlineMs = Date.now() + timeoutMs;
|
|
204
|
-
const lookupResult = await getManagedGeminiAuthIndex(accountId, getRemainingTimeoutMs(deadlineMs), authContext);
|
|
205
|
-
if (lookupResult.unavailable) {
|
|
206
|
-
return { response: null, unavailable: true };
|
|
207
|
-
}
|
|
208
|
-
const authIndex = lookupResult.authIndex;
|
|
209
|
-
if (authIndex === null || authIndex === undefined) {
|
|
210
|
-
return { response: null, unavailable: false };
|
|
211
|
-
}
|
|
212
|
-
const target = (0, proxy_target_resolver_1.getProxyTarget)();
|
|
213
|
-
const controller = new AbortController();
|
|
214
|
-
const timeoutId = setTimeout(() => controller.abort(), getRemainingTimeoutMs(deadlineMs));
|
|
215
|
-
try {
|
|
216
|
-
const response = await fetch((0, proxy_target_resolver_1.buildProxyUrl)(target, '/v0/management/api-call'), {
|
|
217
|
-
method: 'POST',
|
|
218
|
-
signal: controller.signal,
|
|
219
|
-
headers: (0, proxy_target_resolver_1.buildManagementHeaders)(target, {
|
|
220
|
-
'Content-Type': 'application/json',
|
|
221
|
-
}),
|
|
222
|
-
body: JSON.stringify({
|
|
223
|
-
auth_index: authIndex,
|
|
224
|
-
method: 'POST',
|
|
225
|
-
url,
|
|
226
|
-
header: {
|
|
227
|
-
Authorization: 'Bearer $TOKEN$',
|
|
228
|
-
'Content-Type': 'application/json',
|
|
229
|
-
},
|
|
230
|
-
data: body,
|
|
231
|
-
}),
|
|
232
|
-
});
|
|
233
|
-
clearTimeout(timeoutId);
|
|
234
|
-
if (!response.ok) {
|
|
235
|
-
return { response: null, unavailable: true };
|
|
236
|
-
}
|
|
237
|
-
const apiResponse = (await response.json());
|
|
238
|
-
const bodyText = typeof apiResponse.body === 'string' ? apiResponse.body : '';
|
|
239
|
-
return {
|
|
240
|
-
response: {
|
|
241
|
-
status: typeof apiResponse.status_code === 'number' ? apiResponse.status_code : 500,
|
|
242
|
-
bodyText,
|
|
243
|
-
json: safeParseJson(bodyText),
|
|
244
|
-
viaManagement: true,
|
|
245
|
-
},
|
|
246
|
-
unavailable: false,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
catch {
|
|
250
|
-
clearTimeout(timeoutId);
|
|
251
|
-
return { response: null, unavailable: true };
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
async function performGeminiCliRequest(accountId, accessToken, url, body, preferManagement = false, authContext) {
|
|
255
|
-
let managementAttempted = false;
|
|
256
|
-
let managementUnavailable = false;
|
|
257
|
-
if (preferManagement) {
|
|
258
|
-
managementAttempted = true;
|
|
259
|
-
const managedResult = await performManagedGeminiRequest(accountId, url, body, MANAGEMENT_API_TIMEOUT_MS, authContext);
|
|
260
|
-
managementUnavailable = managedResult.unavailable;
|
|
261
|
-
if (managedResult.response) {
|
|
262
|
-
return managedResult.response;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
const controller = new AbortController();
|
|
266
|
-
const timeoutId = setTimeout(() => controller.abort(), managementAttempted ? SECONDARY_REQUEST_TIMEOUT_MS : MANAGEMENT_API_TIMEOUT_MS);
|
|
267
|
-
try {
|
|
268
|
-
const response = await fetch(url, {
|
|
269
|
-
method: 'POST',
|
|
270
|
-
signal: controller.signal,
|
|
271
|
-
headers: {
|
|
272
|
-
Authorization: `Bearer ${accessToken}`,
|
|
273
|
-
'Content-Type': 'application/json',
|
|
274
|
-
},
|
|
275
|
-
body,
|
|
276
|
-
});
|
|
277
|
-
clearTimeout(timeoutId);
|
|
278
|
-
const directResult = await readManagedResponse(response, false);
|
|
279
|
-
if (directResult.status !== 401) {
|
|
280
|
-
return directResult;
|
|
281
|
-
}
|
|
282
|
-
if (managementAttempted) {
|
|
283
|
-
if (managementUnavailable) {
|
|
284
|
-
throw new GeminiManagedAuthUnavailableError();
|
|
285
|
-
}
|
|
286
|
-
return directResult;
|
|
287
|
-
}
|
|
288
|
-
const managedResult = await performManagedGeminiRequest(accountId, url, body, SECONDARY_REQUEST_TIMEOUT_MS, authContext);
|
|
289
|
-
if (managedResult.response) {
|
|
290
|
-
return managedResult.response;
|
|
291
|
-
}
|
|
292
|
-
if (managedResult.unavailable) {
|
|
293
|
-
throw new GeminiManagedAuthUnavailableError();
|
|
294
|
-
}
|
|
295
|
-
return directResult;
|
|
296
|
-
}
|
|
297
|
-
catch (error) {
|
|
298
|
-
clearTimeout(timeoutId);
|
|
299
|
-
throw error;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Read auth data from Gemini CLI auth file
|
|
304
|
-
* Supports multiple file naming conventions and JSON structures
|
|
305
|
-
*/
|
|
306
|
-
function readGeminiCliAuthData(accountId) {
|
|
307
|
-
const authDirs = [(0, config_generator_1.getAuthDir)(), (0, account_manager_1.getPausedDir)()];
|
|
308
|
-
const sanitizedId = (0, auth_utils_1.sanitizeEmail)(accountId);
|
|
309
|
-
const expectedFiles = [
|
|
310
|
-
`gemini-${sanitizedId}.json`, // Legacy format
|
|
311
|
-
`${accountId}-gen-lang-client-`, // New format prefix (partial match)
|
|
312
|
-
];
|
|
313
|
-
for (const authDir of authDirs) {
|
|
314
|
-
if (!fs.existsSync(authDir))
|
|
315
|
-
continue;
|
|
316
|
-
// Try exact legacy match first
|
|
317
|
-
const legacyPath = path.join(authDir, expectedFiles[0]);
|
|
318
|
-
if (fs.existsSync(legacyPath)) {
|
|
319
|
-
try {
|
|
320
|
-
const content = fs.readFileSync(legacyPath, 'utf-8');
|
|
321
|
-
const data = JSON.parse(content);
|
|
322
|
-
const accessToken = extractAccessToken(data);
|
|
323
|
-
if (accessToken) {
|
|
324
|
-
const projectId = typeof data.project_id === 'string'
|
|
325
|
-
? data.project_id
|
|
326
|
-
: resolveGeminiCliProjectId(String(data.account || ''));
|
|
327
|
-
const expiry = extractExpiry(data);
|
|
328
|
-
return {
|
|
329
|
-
accessToken,
|
|
330
|
-
projectId,
|
|
331
|
-
isExpired: (0, auth_utils_1.isTokenExpired)(expiry ?? undefined),
|
|
332
|
-
expiresAt: expiry,
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
catch {
|
|
337
|
-
// Continue to fallback
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
// Scan directory for matching files
|
|
341
|
-
const files = fs.readdirSync(authDir);
|
|
342
|
-
for (const file of files) {
|
|
343
|
-
if (!isGeminiAuthFile(file))
|
|
344
|
-
continue;
|
|
345
|
-
const candidatePath = path.join(authDir, file);
|
|
346
|
-
try {
|
|
347
|
-
const content = fs.readFileSync(candidatePath, 'utf-8');
|
|
348
|
-
const data = JSON.parse(content);
|
|
349
|
-
// Check if this file matches our account
|
|
350
|
-
const fileEmail = typeof data.email === 'string' ? data.email : null;
|
|
351
|
-
const fileType = typeof data.type === 'string' ? data.type : null;
|
|
352
|
-
const matchesEmail = fileEmail === accountId;
|
|
353
|
-
const matchesFilename = file.startsWith(`${accountId}-`) || file.includes(sanitizedId);
|
|
354
|
-
const isGeminiType = fileType === 'gemini' || fileType === 'gemini-cli';
|
|
355
|
-
// Must match account AND be gemini type (or legacy gemini- prefix)
|
|
356
|
-
if ((matchesEmail || matchesFilename) && (isGeminiType || file.startsWith('gemini-'))) {
|
|
357
|
-
const accessToken = extractAccessToken(data);
|
|
358
|
-
if (accessToken) {
|
|
359
|
-
const projectId = typeof data.project_id === 'string'
|
|
360
|
-
? data.project_id
|
|
361
|
-
: resolveGeminiCliProjectId(String(data.account || ''));
|
|
362
|
-
const expiry = extractExpiry(data);
|
|
363
|
-
return {
|
|
364
|
-
accessToken,
|
|
365
|
-
projectId,
|
|
366
|
-
isExpired: (0, auth_utils_1.isTokenExpired)(expiry ?? undefined),
|
|
367
|
-
expiresAt: expiry,
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
catch {
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
return null;
|
|
378
|
-
}
|
|
379
|
-
function normalizeStringValue(value) {
|
|
380
|
-
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null;
|
|
381
|
-
}
|
|
382
|
-
function normalizeNumberValue(value) {
|
|
383
|
-
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
384
|
-
return value;
|
|
385
|
-
}
|
|
386
|
-
if (typeof value === 'string' && value.trim().length > 0) {
|
|
387
|
-
const parsed = Number(value);
|
|
388
|
-
if (Number.isFinite(parsed)) {
|
|
389
|
-
return parsed;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
return null;
|
|
393
|
-
}
|
|
394
|
-
function resolveGeminiCliTierId(payload) {
|
|
395
|
-
if (!payload)
|
|
396
|
-
return null;
|
|
397
|
-
const currentTier = payload.currentTier ?? payload.current_tier;
|
|
398
|
-
const paidTier = payload.paidTier ?? payload.paid_tier;
|
|
399
|
-
const rawId = normalizeStringValue(paidTier?.id) ?? normalizeStringValue(currentTier?.id);
|
|
400
|
-
return rawId ? rawId.toLowerCase() : null;
|
|
401
|
-
}
|
|
402
|
-
function resolveGeminiCliTierLabel(payload) {
|
|
403
|
-
const tierId = resolveGeminiCliTierId(payload);
|
|
404
|
-
return (0, provider_entitlement_evidence_1.getProviderTierLabel)(tierId);
|
|
405
|
-
}
|
|
406
|
-
function resolveGeminiCliCreditBalance(payload) {
|
|
407
|
-
if (!payload)
|
|
408
|
-
return null;
|
|
409
|
-
const paidTier = payload.paidTier ?? payload.paid_tier;
|
|
410
|
-
const currentTier = payload.currentTier ?? payload.current_tier;
|
|
411
|
-
const tier = paidTier ?? currentTier;
|
|
412
|
-
if (!tier)
|
|
413
|
-
return null;
|
|
414
|
-
const credits = tier.availableCredits ?? tier.available_credits ?? [];
|
|
415
|
-
let total = 0;
|
|
416
|
-
let found = false;
|
|
417
|
-
for (const credit of credits) {
|
|
418
|
-
const creditType = normalizeStringValue(credit.creditType ?? credit.credit_type);
|
|
419
|
-
if (creditType !== GEMINI_CLI_G1_CREDIT_TYPE)
|
|
420
|
-
continue;
|
|
421
|
-
const amount = normalizeNumberValue(credit.creditAmount ?? credit.credit_amount);
|
|
422
|
-
if (amount !== null) {
|
|
423
|
-
total += amount;
|
|
424
|
-
found = true;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
return found ? total : null;
|
|
428
|
-
}
|
|
429
|
-
async function fetchGeminiCliSupplementary(accountId, accessToken, projectId, verbose, authContext) {
|
|
430
|
-
const requestBody = JSON.stringify({
|
|
431
|
-
cloudaicompanionProject: projectId,
|
|
432
|
-
metadata: {
|
|
433
|
-
ideType: 'IDE_UNSPECIFIED',
|
|
434
|
-
platform: 'PLATFORM_UNSPECIFIED',
|
|
435
|
-
pluginType: 'GEMINI',
|
|
436
|
-
duetProject: projectId,
|
|
437
|
-
},
|
|
438
|
-
});
|
|
439
|
-
try {
|
|
440
|
-
const response = await performGeminiCliRequest(accountId, accessToken, GEMINI_CLI_CODE_ASSIST_URL, requestBody, false, authContext);
|
|
441
|
-
if (response.status !== 200) {
|
|
442
|
-
if (verbose) {
|
|
443
|
-
const source = response.viaManagement ? 'managed' : 'direct';
|
|
444
|
-
console.error(`[i] Gemini CLI supplementary metadata unavailable via ${source}: HTTP ${response.status}`);
|
|
445
|
-
}
|
|
446
|
-
return { tierLabel: null, tierId: null, creditBalance: null, normalizedTier: 'unknown' };
|
|
447
|
-
}
|
|
448
|
-
const payload = response.json;
|
|
449
|
-
return {
|
|
450
|
-
tierLabel: resolveGeminiCliTierLabel(payload),
|
|
451
|
-
tierId: resolveGeminiCliTierId(payload),
|
|
452
|
-
creditBalance: resolveGeminiCliCreditBalance(payload),
|
|
453
|
-
normalizedTier: (0, provider_entitlement_evidence_1.normalizeProviderTierId)(resolveGeminiCliTierId(payload)),
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
catch (error) {
|
|
457
|
-
if (verbose) {
|
|
458
|
-
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
459
|
-
console.error(`[i] Gemini CLI supplementary metadata skipped: ${message}`);
|
|
460
|
-
}
|
|
461
|
-
return { tierLabel: null, tierId: null, creditBalance: null, normalizedTier: 'unknown' };
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
function buildGeminiCliFailureResult(accountId, projectId, options) {
|
|
465
|
-
return {
|
|
466
|
-
success: false,
|
|
467
|
-
buckets: [],
|
|
468
|
-
projectId,
|
|
469
|
-
tierLabel: null,
|
|
470
|
-
tierId: null,
|
|
471
|
-
creditBalance: null,
|
|
472
|
-
lastUpdated: Date.now(),
|
|
473
|
-
accountId,
|
|
474
|
-
error: options.error,
|
|
475
|
-
httpStatus: options.httpStatus,
|
|
476
|
-
errorCode: options.errorCode,
|
|
477
|
-
errorDetail: options.errorDetail,
|
|
478
|
-
actionHint: options.actionHint,
|
|
479
|
-
retryable: options.retryable,
|
|
480
|
-
needsReauth: options.needsReauth,
|
|
481
|
-
isForbidden: options.isForbidden,
|
|
482
|
-
entitlement: options.entitlement,
|
|
483
|
-
};
|
|
484
|
-
}
|
|
485
|
-
function sanitizeGeminiCliErrorDetail(bodyText) {
|
|
486
|
-
const trimmed = bodyText.trim();
|
|
487
|
-
if (!trimmed) {
|
|
488
|
-
return undefined;
|
|
489
|
-
}
|
|
490
|
-
if (/^<!doctype html/i.test(trimmed) || /^<html/i.test(trimmed) || /^<[^>]+>/.test(trimmed)) {
|
|
491
|
-
return '[HTML error response omitted]';
|
|
492
|
-
}
|
|
493
|
-
let sanitized = trimmed
|
|
494
|
-
.replace(/"(access[_-]?token|refresh[_-]?token|authorization|cookie|set-cookie|api[_-]?key|session[_-]?token|token)"\s*:\s*"[^"]*"/gi, '"$1":"[redacted]"')
|
|
495
|
-
.replace(/Bearer\s+[A-Za-z0-9._-]+/g, 'Bearer [redacted]')
|
|
496
|
-
.replace(/\s+/g, ' ');
|
|
497
|
-
if (sanitized.length > GEMINI_CLI_ERROR_DETAIL_MAX_LENGTH) {
|
|
498
|
-
sanitized = `${sanitized.slice(0, GEMINI_CLI_ERROR_DETAIL_MAX_LENGTH - GEMINI_CLI_ERROR_DETAIL_TRUNCATION_SUFFIX.length)}${GEMINI_CLI_ERROR_DETAIL_TRUNCATION_SUFFIX}`;
|
|
499
|
-
}
|
|
500
|
-
return sanitized;
|
|
501
|
-
}
|
|
502
|
-
function extractGeminiCliNestedMessage(value) {
|
|
503
|
-
if (Array.isArray(value)) {
|
|
504
|
-
for (const entry of value) {
|
|
505
|
-
const nested = extractGeminiCliNestedMessage(entry);
|
|
506
|
-
if (nested)
|
|
507
|
-
return nested;
|
|
508
|
-
}
|
|
509
|
-
return undefined;
|
|
510
|
-
}
|
|
511
|
-
if (!value || typeof value !== 'object') {
|
|
512
|
-
return undefined;
|
|
513
|
-
}
|
|
514
|
-
const record = value;
|
|
515
|
-
const directMessage = [
|
|
516
|
-
record.message,
|
|
517
|
-
record.localizedMessage,
|
|
518
|
-
record.description,
|
|
519
|
-
record.reason,
|
|
520
|
-
record.error,
|
|
521
|
-
].find((candidate) => typeof candidate === 'string' && candidate.trim().length > 0);
|
|
522
|
-
if (directMessage) {
|
|
523
|
-
return directMessage;
|
|
524
|
-
}
|
|
525
|
-
return undefined;
|
|
526
|
-
}
|
|
527
|
-
function parseGeminiCliErrorBody(bodyText) {
|
|
528
|
-
const trimmed = bodyText.trim();
|
|
529
|
-
if (!trimmed) {
|
|
530
|
-
return {};
|
|
531
|
-
}
|
|
532
|
-
const sanitizedDetail = sanitizeGeminiCliErrorDetail(trimmed);
|
|
533
|
-
try {
|
|
534
|
-
const parsed = JSON.parse(trimmed);
|
|
535
|
-
const topLevelMessage = [parsed.message, parsed.error].find((candidate) => typeof candidate === 'string' && candidate.trim().length > 0);
|
|
536
|
-
const topLevelCode = [parsed.code, parsed.status].find((candidate) => typeof candidate === 'string' && candidate.trim().length > 0);
|
|
537
|
-
if (parsed.error && typeof parsed.error === 'object') {
|
|
538
|
-
const error = parsed.error;
|
|
539
|
-
return {
|
|
540
|
-
errorCode: [error.status, error.code, topLevelCode].find((candidate) => typeof candidate === 'string' && candidate.trim().length > 0) || undefined,
|
|
541
|
-
errorDetail: sanitizedDetail,
|
|
542
|
-
message: [
|
|
543
|
-
error.message,
|
|
544
|
-
error.error,
|
|
545
|
-
extractGeminiCliNestedMessage(error.details),
|
|
546
|
-
topLevelMessage,
|
|
547
|
-
].find((candidate) => typeof candidate === 'string' && candidate.trim().length > 0) || undefined,
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
return {
|
|
551
|
-
errorCode: topLevelCode,
|
|
552
|
-
errorDetail: sanitizedDetail,
|
|
553
|
-
message: [topLevelMessage, extractGeminiCliNestedMessage(parsed.details)].find((candidate) => typeof candidate === 'string' && candidate.trim().length > 0) || undefined,
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
catch {
|
|
557
|
-
return {
|
|
558
|
-
errorDetail: sanitizedDetail,
|
|
559
|
-
message: sanitizedDetail === '[HTML error response omitted]' ? undefined : trimmed,
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
function buildGeminiCliForbiddenActionHint(parsed) {
|
|
564
|
-
const combined = `${parsed.message || ''} ${parsed.errorDetail || ''}`.toLowerCase();
|
|
565
|
-
if (combined.includes('verify') || combined.includes('verification')) {
|
|
566
|
-
return 'Complete the Google account verification mentioned above, then retry quota refresh.';
|
|
567
|
-
}
|
|
568
|
-
if (combined.includes('project')) {
|
|
569
|
-
return 'Confirm this Google project still has Gemini CLI quota access, then retry.';
|
|
570
|
-
}
|
|
571
|
-
return 'Check the Google account or workspace access shown above, then retry quota refresh.';
|
|
572
|
-
}
|
|
573
|
-
function buildGeminiCliHttpFailureResult(accountId, projectId, status, bodyText) {
|
|
574
|
-
const parsed = parseGeminiCliErrorBody(bodyText);
|
|
575
|
-
if (status === 401) {
|
|
576
|
-
return buildGeminiCliFailureResult(accountId, projectId, {
|
|
577
|
-
error: parsed.message || 'Token expired or invalid',
|
|
578
|
-
httpStatus: 401,
|
|
579
|
-
errorCode: parsed.errorCode || 'reauth_required',
|
|
580
|
-
errorDetail: parsed.errorDetail,
|
|
581
|
-
actionHint: 'Run ccs gemini --auth to reconnect this account.',
|
|
582
|
-
needsReauth: true,
|
|
583
|
-
retryable: false,
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
if (status === 403) {
|
|
587
|
-
return buildGeminiCliFailureResult(accountId, projectId, {
|
|
588
|
-
error: parsed.message || 'Quota access forbidden for this account',
|
|
589
|
-
httpStatus: 403,
|
|
590
|
-
errorCode: parsed.errorCode || 'quota_api_forbidden',
|
|
591
|
-
errorDetail: parsed.errorDetail,
|
|
592
|
-
actionHint: buildGeminiCliForbiddenActionHint(parsed),
|
|
593
|
-
isForbidden: true,
|
|
594
|
-
retryable: false,
|
|
595
|
-
entitlement: (0, provider_entitlement_evidence_1.buildProviderEntitlementEvidence)({
|
|
596
|
-
normalizedTier: 'unknown',
|
|
597
|
-
source: 'runtime_inference',
|
|
598
|
-
confidence: 'medium',
|
|
599
|
-
accessState: 'not_entitled',
|
|
600
|
-
capacityState: 'unknown',
|
|
601
|
-
}),
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
if (status === 429) {
|
|
605
|
-
if ((0, provider_entitlement_evidence_1.isModelCapacityExhausted)(parsed.message, parsed.errorDetail, parsed.errorCode)) {
|
|
606
|
-
return buildGeminiCliFailureResult(accountId, projectId, {
|
|
607
|
-
error: parsed.message || 'Model capacity exhausted for this account right now',
|
|
608
|
-
httpStatus: 429,
|
|
609
|
-
errorCode: 'capacity_exhausted',
|
|
610
|
-
errorDetail: parsed.errorDetail,
|
|
611
|
-
actionHint: 'Retry later or switch to another Gemini model. This indicates temporary model capacity, not an authentication failure.',
|
|
612
|
-
retryable: true,
|
|
613
|
-
entitlement: (0, provider_entitlement_evidence_1.buildProviderEntitlementEvidence)({
|
|
614
|
-
normalizedTier: 'unknown',
|
|
615
|
-
source: 'runtime_inference',
|
|
616
|
-
confidence: 'medium',
|
|
617
|
-
accessState: 'entitled',
|
|
618
|
-
capacityState: 'capacity_exhausted',
|
|
619
|
-
notes: 'Upstream returned MODEL_CAPACITY_EXHAUSTED for this model.',
|
|
620
|
-
}),
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
return buildGeminiCliFailureResult(accountId, projectId, {
|
|
624
|
-
error: parsed.message || 'Rate limited - try again later',
|
|
625
|
-
httpStatus: 429,
|
|
626
|
-
errorCode: parsed.errorCode || 'rate_limited',
|
|
627
|
-
errorDetail: parsed.errorDetail,
|
|
628
|
-
actionHint: 'Retry after a short delay.',
|
|
629
|
-
retryable: true,
|
|
630
|
-
entitlement: (0, provider_entitlement_evidence_1.buildProviderEntitlementEvidence)({
|
|
631
|
-
normalizedTier: 'unknown',
|
|
632
|
-
source: 'runtime_inference',
|
|
633
|
-
confidence: 'low',
|
|
634
|
-
accessState: 'unknown',
|
|
635
|
-
capacityState: 'rate_limited',
|
|
636
|
-
}),
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
if (status >= 500) {
|
|
640
|
-
return buildGeminiCliFailureResult(accountId, projectId, {
|
|
641
|
-
error: parsed.message || `Gemini quota service unavailable (HTTP ${status})`,
|
|
642
|
-
httpStatus: status,
|
|
643
|
-
errorCode: parsed.errorCode || 'provider_unavailable',
|
|
644
|
-
errorDetail: parsed.errorDetail,
|
|
645
|
-
actionHint: 'Retry later. This looks like a temporary Google upstream problem.',
|
|
646
|
-
retryable: true,
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
return buildGeminiCliFailureResult(accountId, projectId, {
|
|
650
|
-
error: parsed.message || `Gemini quota request failed (HTTP ${status})`,
|
|
651
|
-
httpStatus: status,
|
|
652
|
-
errorCode: parsed.errorCode || 'quota_request_failed',
|
|
653
|
-
errorDetail: parsed.errorDetail,
|
|
654
|
-
actionHint: 'Inspect the upstream response details and retry if appropriate.',
|
|
655
|
-
retryable: false,
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* Build GeminiCliBucket array from API response
|
|
660
|
-
* Groups buckets by model series and token type
|
|
661
|
-
*/
|
|
662
|
-
function buildGeminiCliBuckets(rawBuckets) {
|
|
663
|
-
const parsedBuckets = rawBuckets
|
|
664
|
-
.map((bucket) => {
|
|
665
|
-
const modelId = normalizeStringValue(bucket.model_id ?? bucket.modelId);
|
|
666
|
-
if (!modelId)
|
|
667
|
-
return null;
|
|
668
|
-
const tokenType = normalizeStringValue(bucket.token_type ?? bucket.tokenType);
|
|
669
|
-
const remainingFractionRaw = normalizeNumberValue(bucket.remaining_fraction ?? bucket.remainingFraction);
|
|
670
|
-
const remainingAmount = normalizeNumberValue(bucket.remaining_amount ?? bucket.remainingAmount);
|
|
671
|
-
const resetTime = normalizeStringValue(bucket.reset_time ?? bucket.resetTime);
|
|
672
|
-
let fallbackFraction = null;
|
|
673
|
-
if (remainingAmount !== null) {
|
|
674
|
-
fallbackFraction = remainingAmount <= 0 ? 0 : null;
|
|
675
|
-
}
|
|
676
|
-
else if (resetTime) {
|
|
677
|
-
fallbackFraction = 0;
|
|
678
|
-
}
|
|
679
|
-
return {
|
|
680
|
-
modelId,
|
|
681
|
-
tokenType,
|
|
682
|
-
remainingFraction: remainingFractionRaw ?? fallbackFraction ?? 1,
|
|
683
|
-
remainingAmount,
|
|
684
|
-
resetTime,
|
|
685
|
-
};
|
|
686
|
-
})
|
|
687
|
-
.filter((bucket) => bucket !== null);
|
|
688
|
-
return (0, gemini_cli_quota_normalizer_1.buildGeminiCliBucketsFromParsedBuckets)(parsedBuckets);
|
|
689
|
-
}
|
|
690
|
-
exports.buildGeminiCliBuckets = buildGeminiCliBuckets;
|
|
691
|
-
/**
|
|
692
|
-
* Internal helper: Fetch quota with validated auth data
|
|
693
|
-
* Extracted to support auto-refresh retry logic
|
|
694
|
-
*/
|
|
695
|
-
async function fetchWithAuthData(authData, accountId, verbose) {
|
|
696
|
-
if (!authData.projectId) {
|
|
697
|
-
const error = 'Cannot resolve project ID from auth file';
|
|
698
|
-
if (verbose)
|
|
699
|
-
console.error(`[!] Error: ${error}`);
|
|
700
|
-
return buildGeminiCliFailureResult(accountId, null, {
|
|
701
|
-
error,
|
|
702
|
-
errorCode: 'missing_project_id',
|
|
703
|
-
actionHint: 'Run ccs gemini --auth to reconnect this account and recover the project ID.',
|
|
704
|
-
retryable: false,
|
|
705
|
-
});
|
|
706
|
-
}
|
|
707
|
-
const authContext = {};
|
|
708
|
-
const supplementaryPromise = fetchGeminiCliSupplementary(accountId, authData.accessToken, authData.projectId, verbose, authContext);
|
|
709
|
-
const requestBody = JSON.stringify({ project: authData.projectId });
|
|
710
|
-
try {
|
|
711
|
-
const response = await performGeminiCliRequest(accountId, authData.accessToken, GEMINI_CLI_QUOTA_URL, requestBody, authData.isExpired, authContext);
|
|
712
|
-
if (verbose) {
|
|
713
|
-
const source = response.viaManagement ? 'managed' : 'direct';
|
|
714
|
-
console.error(`[i] Gemini CLI API status via ${source}: ${response.status}`);
|
|
715
|
-
}
|
|
716
|
-
if (response.status !== 200) {
|
|
717
|
-
return buildGeminiCliHttpFailureResult(accountId, authData.projectId, response.status, response.bodyText);
|
|
718
|
-
}
|
|
719
|
-
const data = response.json;
|
|
720
|
-
const rawBuckets = data?.buckets || [];
|
|
721
|
-
const buckets = buildGeminiCliBuckets(rawBuckets);
|
|
722
|
-
const supplementary = await supplementaryPromise;
|
|
723
|
-
if (verbose)
|
|
724
|
-
console.error(`[i] Gemini CLI buckets found: ${buckets.length}`);
|
|
725
|
-
if (supplementary.normalizedTier !== 'unknown') {
|
|
726
|
-
(0, account_manager_1.setAccountTier)('gemini', accountId, supplementary.normalizedTier);
|
|
727
|
-
}
|
|
728
|
-
return {
|
|
729
|
-
success: true,
|
|
730
|
-
buckets,
|
|
731
|
-
projectId: authData.projectId,
|
|
732
|
-
tierLabel: supplementary.tierLabel,
|
|
733
|
-
tierId: supplementary.tierId,
|
|
734
|
-
creditBalance: supplementary.creditBalance,
|
|
735
|
-
entitlement: (0, provider_entitlement_evidence_1.buildProviderEntitlementEvidence)({
|
|
736
|
-
normalizedTier: supplementary.normalizedTier,
|
|
737
|
-
rawTierId: supplementary.tierId,
|
|
738
|
-
rawTierLabel: supplementary.tierLabel,
|
|
739
|
-
source: supplementary.tierId ? 'runtime_api' : 'runtime_inference',
|
|
740
|
-
confidence: supplementary.tierId ? 'high' : 'medium',
|
|
741
|
-
accessState: 'entitled',
|
|
742
|
-
capacityState: 'available',
|
|
743
|
-
}),
|
|
744
|
-
lastUpdated: Date.now(),
|
|
745
|
-
accountId,
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
catch (err) {
|
|
749
|
-
if (err instanceof GeminiManagedAuthUnavailableError) {
|
|
750
|
-
return buildGeminiCliFailureResult(accountId, authData.projectId, {
|
|
751
|
-
error: 'Gemini delegated auth refresh is temporarily unavailable',
|
|
752
|
-
errorCode: 'managed_auth_unavailable',
|
|
753
|
-
errorDetail: err.message,
|
|
754
|
-
actionHint: 'Retry later. CLIProxy management could not refresh this Gemini account.',
|
|
755
|
-
retryable: true,
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
const errorMsg = err instanceof Error && err.name === 'AbortError'
|
|
759
|
-
? 'Request timeout'
|
|
760
|
-
: err instanceof Error
|
|
761
|
-
? err.message
|
|
762
|
-
: 'Unknown error';
|
|
763
|
-
if (verbose)
|
|
764
|
-
console.error(`[!] Gemini CLI quota error: ${errorMsg}`);
|
|
765
|
-
return buildGeminiCliFailureResult(accountId, authData.projectId, {
|
|
766
|
-
error: errorMsg,
|
|
767
|
-
errorCode: err instanceof Error && err.name === 'AbortError' ? 'network_timeout' : 'network_error',
|
|
768
|
-
actionHint: 'Retry later. This looks temporary.',
|
|
769
|
-
retryable: true,
|
|
770
|
-
httpStatus: err instanceof Error && err.name === 'AbortError' ? 408 : undefined,
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
/**
|
|
775
|
-
* Fetch quota for a single Gemini CLI account
|
|
776
7
|
*
|
|
777
|
-
*
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
const error = 'Auth file not found for Gemini account';
|
|
787
|
-
if (verbose)
|
|
788
|
-
console.error(`[!] Error: ${error}`);
|
|
789
|
-
return buildGeminiCliFailureResult(accountId, null, {
|
|
790
|
-
error,
|
|
791
|
-
errorCode: 'auth_file_missing',
|
|
792
|
-
actionHint: 'Run ccs gemini --auth to reconnect this account.',
|
|
793
|
-
retryable: false,
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
if (authData.isExpired && verbose) {
|
|
797
|
-
const expiresAt = (0, auth_utils_1.getTokenExpiryTimestamp)(authData.expiresAt);
|
|
798
|
-
const expiryLabel = expiresAt ? new Date(expiresAt).toISOString() : 'unknown';
|
|
799
|
-
console.error(`[i] Gemini access token is expired (${expiryLabel}); quota requests will defer to managed auth when available.`);
|
|
800
|
-
}
|
|
801
|
-
return await fetchWithAuthData(authData, accountId, verbose);
|
|
802
|
-
}
|
|
803
|
-
exports.fetchGeminiCliQuota = fetchGeminiCliQuota;
|
|
804
|
-
/**
|
|
805
|
-
* Fetch quota for all Gemini CLI accounts
|
|
8
|
+
* This file is a thin re-export barrel. The implementation has been split
|
|
9
|
+
* into focused submodules under `./quota-fetcher-gemini-cli/`:
|
|
10
|
+
* - token-parsing: access token / expiry / project-id extraction
|
|
11
|
+
* - auth-file-discovery: on-disk auth-file lookup and parsing
|
|
12
|
+
* - managed-request: managed (CLIProxy) + direct upstream HTTP paths
|
|
13
|
+
* - supplementary-metadata: tier / credit resolution (loadCodeAssist)
|
|
14
|
+
* - error-parsing: error-body sanitization and failure-result builders
|
|
15
|
+
* - bucket-building: raw bucket -> normalized GeminiCliBucket array
|
|
16
|
+
* - quota-fetcher: top-level fetchGeminiCliQuota orchestration
|
|
806
17
|
*
|
|
807
|
-
*
|
|
808
|
-
*
|
|
18
|
+
* Public surface is preserved exactly: every previously-importable symbol
|
|
19
|
+
* keeps its name and signature. Token values are never logged.
|
|
809
20
|
*/
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
})));
|
|
819
|
-
return results;
|
|
820
|
-
}
|
|
821
|
-
exports.fetchAllGeminiCliQuotas = fetchAllGeminiCliQuotas;
|
|
822
|
-
exports.__testExports = {
|
|
823
|
-
sanitizeGeminiCliErrorDetail,
|
|
824
|
-
extractGeminiCliNestedMessage,
|
|
825
|
-
parseGeminiCliErrorBody,
|
|
826
|
-
buildGeminiCliForbiddenActionHint,
|
|
827
|
-
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.__testExports = exports.buildGeminiCliBuckets = exports.resolveGeminiCliProjectId = exports.fetchAllGeminiCliQuotas = exports.fetchGeminiCliQuota = void 0;
|
|
23
|
+
var index_1 = require("./quota-fetcher-gemini-cli/index");
|
|
24
|
+
Object.defineProperty(exports, "fetchGeminiCliQuota", { enumerable: true, get: function () { return index_1.fetchGeminiCliQuota; } });
|
|
25
|
+
Object.defineProperty(exports, "fetchAllGeminiCliQuotas", { enumerable: true, get: function () { return index_1.fetchAllGeminiCliQuotas; } });
|
|
26
|
+
Object.defineProperty(exports, "resolveGeminiCliProjectId", { enumerable: true, get: function () { return index_1.resolveGeminiCliProjectId; } });
|
|
27
|
+
Object.defineProperty(exports, "buildGeminiCliBuckets", { enumerable: true, get: function () { return index_1.buildGeminiCliBuckets; } });
|
|
28
|
+
Object.defineProperty(exports, "__testExports", { enumerable: true, get: function () { return index_1.__testExports; } });
|
|
828
29
|
//# sourceMappingURL=quota-fetcher-gemini-cli.js.map
|