@cortexkit/opencode-antigravity-auth 3.0.5 → 3.0.6
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 +38 -352
- package/dist/cli.js +9199 -8799
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +1286 -1064
- package/dist/index.js +13641 -14559
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +1333 -1342
- package/dist/server.js +10618 -11080
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/auth-method-labels.d.ts +3 -0
- package/dist/src/auth-method-labels.d.ts.map +1 -0
- package/dist/src/auth-method-labels.js +5 -0
- package/dist/src/auth-method-labels.js.map +1 -0
- package/dist/src/cli.d.ts +3 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +98 -12
- package/dist/src/cli.js.map +1 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +33 -3
- package/dist/src/common-auth-embedded/claustrum/consumer.js +96 -1
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +4 -1
- package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
- package/dist/src/common-auth-embedded/claustrum/enrollment.js +6 -1
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +2 -1
- package/dist/src/common-auth-embedded/claustrum/index.js +5 -3
- package/dist/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/dist/src/common-auth-embedded/claustrum/insula.js +152 -0
- package/dist/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
- package/dist/src/common-auth-embedded/claustrum/roster.js +33 -3
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +20 -11
- package/dist/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/dist/src/common-auth-embedded/quota/codec.js +2 -1
- package/dist/src/common-auth-embedded/quota/format.d.ts +26 -0
- package/dist/src/common-auth-embedded/quota/format.js +78 -42
- package/dist/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/dist/src/common-auth-embedded/quota/index.js +2 -2
- package/dist/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/dist/src/common-auth-embedded/quota/map.js +36 -1
- package/dist/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/dist/src/common-auth-embedded/quota/merge.js +21 -5
- package/dist/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/dist/src/common-auth-embedded/quota/projection.js +3 -1
- package/dist/src/common-auth-embedded/setup/command-runner.js +49 -0
- package/dist/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/dist/src/common-auth-embedded/setup/command.js +215 -0
- package/dist/src/common-auth-embedded/setup/config-write.js +60 -0
- package/dist/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/dist/src/common-auth-embedded/setup/detect.js +224 -0
- package/dist/src/common-auth-embedded/setup/enroll.js +70 -0
- package/dist/src/common-auth-embedded/setup/index.d.ts +5 -0
- package/dist/src/common-auth-embedded/setup/index.js +4 -0
- package/dist/src/common-auth-embedded/setup/paths.js +33 -0
- package/dist/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/dist/src/common-auth-embedded/setup/process-fence.js +270 -0
- package/dist/src/common-auth-embedded/setup/prompts.js +26 -0
- package/dist/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/dist/src/common-auth-embedded/setup/register.js +130 -0
- package/dist/src/common-auth-embedded/setup/types.d.ts +136 -0
- package/dist/src/common-auth-embedded/source-output.json +228 -80
- package/dist/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/dist/src/common-auth-embedded/store/schema.js +3 -2
- package/dist/src/ga/rpc/protocol.d.ts +4 -7
- package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/src/ga/rpc/protocol.js +5 -13
- package/dist/src/ga/rpc/protocol.js.map +1 -1
- package/dist/src/ga/server/auth.d.ts +8 -3
- package/dist/src/ga/server/auth.d.ts.map +1 -1
- package/dist/src/ga/server/auth.js +25 -9
- package/dist/src/ga/server/auth.js.map +1 -1
- package/dist/src/ga/server/index.d.ts +39 -12
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +214 -53
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/ga/server/pool-login.d.ts +22 -0
- package/dist/src/ga/server/pool-login.d.ts.map +1 -0
- package/dist/src/ga/server/pool-login.js +150 -0
- package/dist/src/ga/server/pool-login.js.map +1 -0
- package/dist/src/ga/tui/host-ga.d.ts +2 -5
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +17 -49
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/accounts.d.ts +1 -1
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +1 -0
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.d.ts +2 -0
- package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js +125 -10
- package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
- package/dist/src/plugin/command-apply.d.ts +2 -2
- package/dist/src/plugin/command-apply.d.ts.map +1 -1
- package/dist/src/plugin/command-apply.js +3 -10
- package/dist/src/plugin/command-apply.js.map +1 -1
- package/dist/src/plugin/commands.d.ts +1 -0
- package/dist/src/plugin/commands.d.ts.map +1 -1
- package/dist/src/plugin/commands.js +2 -2
- package/dist/src/plugin/commands.js.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.d.ts +0 -4
- package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.js +0 -5
- package/dist/src/plugin/config/operator-settings-schema.js.map +1 -1
- package/dist/src/plugin/config/schema.d.ts +0 -7
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +0 -43
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/config/writer.d.ts +1 -1
- package/dist/src/plugin/config/writer.js +1 -1
- package/dist/src/plugin/fetch/retry-state.d.ts +19 -3
- package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
- package/dist/src/plugin/fetch/retry-state.js +0 -6
- package/dist/src/plugin/fetch/retry-state.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +0 -3
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/fetch-routing.d.ts +0 -16
- package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
- package/dist/src/plugin/fetch-routing.js +0 -49
- package/dist/src/plugin/fetch-routing.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +14 -9
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +120 -40
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/google-origin.d.ts +7 -0
- package/dist/src/plugin/google-origin.d.ts.map +1 -0
- package/dist/src/plugin/google-origin.js +14 -0
- package/dist/src/plugin/google-origin.js.map +1 -0
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +15 -4
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
- package/dist/src/plugin/oauth-methods.js +0 -33
- package/dist/src/plugin/oauth-methods.js.map +1 -1
- package/dist/src/plugin/operator-settings.d.ts +1 -1
- package/dist/src/plugin/operator-settings.d.ts.map +1 -1
- package/dist/src/plugin/operator-settings.js +1 -8
- package/dist/src/plugin/operator-settings.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +11 -7
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +128 -102
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/request.d.ts +5 -3
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +87 -168
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/server.d.ts.map +1 -1
- package/dist/src/plugin/server.js +60 -53
- package/dist/src/plugin/server.js.map +1 -1
- package/dist/src/plugin/shared/advisory-repository.d.ts +20 -0
- package/dist/src/plugin/shared/advisory-repository.d.ts.map +1 -0
- package/dist/src/plugin/shared/advisory-repository.js +91 -0
- package/dist/src/plugin/shared/advisory-repository.js.map +1 -0
- package/dist/src/plugin/shared/request-services.d.ts +19 -25
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +105 -188
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/runtime.js +4 -2
- package/dist/src/plugin/shared/runtime.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +4 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +41 -7
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +2 -2
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/vault-custody.js +147 -35
- package/dist/src/plugin/vault-custody.js.map +1 -1
- package/dist/src/plugin/vault-quota-outcome.d.ts +19 -0
- package/dist/src/plugin/vault-quota-outcome.d.ts.map +1 -0
- package/dist/src/plugin/vault-quota-outcome.js +47 -0
- package/dist/src/plugin/vault-quota-outcome.js.map +1 -0
- package/dist/src/quota-presentation.d.ts +29 -1
- package/dist/src/quota-presentation.d.ts.map +1 -1
- package/dist/src/quota-presentation.js +52 -17
- package/dist/src/quota-presentation.js.map +1 -1
- package/dist/src/setup.d.ts +15 -0
- package/dist/src/setup.d.ts.map +1 -0
- package/dist/src/setup.js +320 -0
- package/dist/src/setup.js.map +1 -0
- package/dist/src/sidebar-projection.d.ts +1 -1
- package/dist/src/sidebar-projection.d.ts.map +1 -1
- package/dist/src/sidebar-state.d.ts +1 -1
- package/dist/src/sidebar-state.d.ts.map +1 -1
- package/dist/src/sidebar-state.js +19 -1
- package/dist/src/sidebar-state.js.map +1 -1
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +205 -110
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +37 -37
- package/dist/tui-ga-build-map.json +33 -33
- package/dist/types/src/auth-method-labels.d.ts +3 -0
- package/dist/types/src/auth-method-labels.d.ts.map +1 -0
- package/dist/types/src/cli.d.ts +3 -1
- package/dist/types/src/cli.d.ts.map +1 -1
- package/dist/types/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +132 -0
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +178 -0
- package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +164 -0
- package/dist/types/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
- package/dist/types/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +19 -0
- package/dist/types/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/dist/types/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
- package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +221 -0
- package/dist/types/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
- package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +8 -0
- package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +55 -0
- package/dist/types/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
- package/dist/types/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
- package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +413 -0
- package/dist/types/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/dist/types/src/common-auth-embedded/quota/format.d.ts +26 -0
- package/dist/types/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/dist/types/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/dist/types/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/dist/types/src/common-auth-embedded/routing/admission.d.ts +93 -0
- package/dist/types/src/common-auth-embedded/routing/index.d.ts +8 -0
- package/dist/types/src/common-auth-embedded/routing/ordered.d.ts +47 -0
- package/dist/types/src/common-auth-embedded/routing/pins.d.ts +22 -0
- package/dist/types/src/common-auth-embedded/routing/sticky.d.ts +158 -0
- package/dist/types/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/dist/types/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/dist/types/src/common-auth-embedded/setup/index.d.ts +5 -0
- package/dist/types/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/dist/types/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/setup/types.d.ts +136 -0
- package/dist/types/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/dist/types/src/ga/rpc/protocol.d.ts +4 -7
- package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/types/src/ga/server/auth.d.ts +8 -3
- package/dist/types/src/ga/server/auth.d.ts.map +1 -1
- package/dist/types/src/ga/server/index.d.ts +39 -12
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/ga/server/pool-login.d.ts +22 -0
- package/dist/types/src/ga/server/pool-login.d.ts.map +1 -0
- package/dist/types/src/plugin/accounts.d.ts +1 -1
- package/dist/types/src/plugin/accounts.d.ts.map +1 -1
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts +2 -0
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
- package/dist/types/src/plugin/command-apply.d.ts +2 -2
- package/dist/types/src/plugin/command-apply.d.ts.map +1 -1
- package/dist/types/src/plugin/commands.d.ts +1 -0
- package/dist/types/src/plugin/commands.d.ts.map +1 -1
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts +0 -4
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
- package/dist/types/src/plugin/config/schema.d.ts +0 -7
- package/dist/types/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/types/src/plugin/config/writer.d.ts +1 -1
- package/dist/types/src/plugin/fetch/retry-state.d.ts +19 -3
- package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-routing.d.ts +0 -16
- package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +14 -9
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/google-origin.d.ts +7 -0
- package/dist/types/src/plugin/google-origin.d.ts.map +1 -0
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -1
- package/dist/types/src/plugin/operator-settings.d.ts +1 -1
- package/dist/types/src/plugin/operator-settings.d.ts.map +1 -1
- package/dist/types/src/plugin/quota.d.ts +11 -7
- package/dist/types/src/plugin/quota.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts +5 -3
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/server.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/advisory-repository.d.ts +20 -0
- package/dist/types/src/plugin/shared/advisory-repository.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts +19 -25
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +4 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/storage.d.ts +2 -2
- package/dist/types/src/plugin/storage.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-quota-outcome.d.ts +19 -0
- package/dist/types/src/plugin/vault-quota-outcome.d.ts.map +1 -0
- package/dist/types/src/setup.d.ts +15 -0
- package/dist/types/src/setup.d.ts.map +1 -0
- package/dist/types/src/sidebar-state.d.ts +1 -1
- package/dist/types/src/sidebar-state.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/common-auth-embedded/claustrum/consumer.d.ts +33 -3
- package/src/common-auth-embedded/claustrum/consumer.js +96 -1
- package/src/common-auth-embedded/claustrum/custody.d.ts +4 -1
- package/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
- package/src/common-auth-embedded/claustrum/enrollment.js +6 -1
- package/src/common-auth-embedded/claustrum/index.d.ts +2 -1
- package/src/common-auth-embedded/claustrum/index.js +5 -3
- package/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/src/common-auth-embedded/claustrum/insula.js +152 -0
- package/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
- package/src/common-auth-embedded/claustrum/roster.js +33 -3
- package/src/common-auth-embedded/fs/refresh-file-lock.js +20 -11
- package/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/src/common-auth-embedded/quota/codec.js +2 -1
- package/src/common-auth-embedded/quota/format.d.ts +26 -0
- package/src/common-auth-embedded/quota/format.js +78 -42
- package/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/src/common-auth-embedded/quota/index.js +2 -2
- package/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/src/common-auth-embedded/quota/map.js +36 -1
- package/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/src/common-auth-embedded/quota/merge.js +21 -5
- package/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/src/common-auth-embedded/quota/projection.js +3 -1
- package/src/common-auth-embedded/setup/command-runner.js +49 -0
- package/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/src/common-auth-embedded/setup/command.js +215 -0
- package/src/common-auth-embedded/setup/config-write.js +60 -0
- package/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/src/common-auth-embedded/setup/detect.js +224 -0
- package/src/common-auth-embedded/setup/enroll.js +70 -0
- package/src/common-auth-embedded/setup/index.d.ts +5 -0
- package/src/common-auth-embedded/setup/index.js +4 -0
- package/src/common-auth-embedded/setup/paths.js +33 -0
- package/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/src/common-auth-embedded/setup/process-fence.js +270 -0
- package/src/common-auth-embedded/setup/prompts.js +26 -0
- package/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/src/common-auth-embedded/setup/register.js +130 -0
- package/src/common-auth-embedded/setup/types.d.ts +136 -0
- package/src/common-auth-embedded/source-output.json +228 -80
- package/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/src/common-auth-embedded/store/schema.js +3 -2
- package/src/sidebar-state.ts +19 -2
- package/src/tui-compiled/common-auth-embedded/quota/codec.js +2 -1
- package/src/tui-compiled/common-auth-embedded/quota/format.js +78 -42
- package/src/tui-compiled/common-auth-embedded/quota/index.js +2 -2
- package/src/tui-compiled/common-auth-embedded/quota/map.js +36 -1
- package/src/tui-compiled/common-auth-embedded/quota/merge.js +21 -5
- package/src/tui-compiled/common-auth-embedded/quota/projection.js +3 -1
- package/src/tui-compiled/quota-presentation.js +42 -9
- package/src/tui-compiled/sidebar-state.js +15 -1
- package/src/tui-compiled/tui.js +516 -334
- package/src/tui-ga-compiled/host-ga.js +11 -38
- package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +3 -1
- package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +36 -1
- package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
- package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +78 -42
- package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +2 -2
- package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +2 -1
- package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +21 -5
- package/src/tui-ga-raw/host-ga.tsx +31 -62
- package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +3 -1
- package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +36 -1
- package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
- package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +78 -42
- package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +2 -2
- package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +2 -1
- package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +21 -5
- package/src/tui-raw/common-auth-embedded/quota/codec.js +2 -1
- package/src/tui-raw/common-auth-embedded/quota/format.js +78 -42
- package/src/tui-raw/common-auth-embedded/quota/index.js +2 -2
- package/src/tui-raw/common-auth-embedded/quota/map.js +36 -1
- package/src/tui-raw/common-auth-embedded/quota/merge.js +21 -5
- package/src/tui-raw/common-auth-embedded/quota/projection.js +3 -1
- package/src/tui-raw/quota-presentation.js +42 -9
- package/src/tui-raw/sidebar-state.js +15 -1
- package/src/tui-raw/tui.tsx +423 -218
- package/src/tui.tsx +423 -218
- package/dist/src/tui/vault-setup.d.ts +0 -98
- package/dist/src/tui/vault-setup.d.ts.map +0 -1
- package/dist/src/tui/vault-setup.js +0 -198
- package/dist/src/tui/vault-setup.js.map +0 -1
- package/dist/types/src/plugin/transform/model-resolver.d.ts +0 -2
- package/dist/types/src/plugin/transform/model-resolver.d.ts.map +0 -1
- package/dist/types/src/quota-presentation.d.ts +0 -18
- package/dist/types/src/quota-presentation.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared Antigravity request engine: account selection, retries, endpoint
|
|
3
|
-
*
|
|
3
|
+
* fallback, warmups and response handling for one plugin location.
|
|
4
4
|
*
|
|
5
5
|
* OpenCode 1's `createFetchInterceptor` and the GA location services both
|
|
6
6
|
* call `createRequestExecutor`, so there is exactly one retry loop. Every
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
* `RequestWire`, which `createRequestWire` binds to one location's signature
|
|
17
17
|
* cache, debug log and logger; the raw sender is called unchanged.
|
|
18
18
|
*/
|
|
19
|
-
import { accessTokenExpired, calculateBackoffMs, computeSoftQuotaCacheTtlMs, getPublicModelDefinitions, getResolverAliasMap, isClaudeThinkingModel, isImageGenerationModel, isRetiredAgyModel, parseRateLimitReason, preserveResponseMetadata, RETIRED_AGY_MODEL_MESSAGE, redactCredentialError, redactCredentialResponse, redactCredentialText, resolveQuotaGroup, VAULT_ACCOUNT_REMEDY, } from '@cortexkit/antigravity-auth-core';
|
|
20
|
-
import { ANTIGRAVITY_ENDPOINT_FALLBACKS
|
|
19
|
+
import { accessTokenExpired, calculateBackoffMs, computeSoftQuotaCacheTtlMs, getPublicModelDefinitions, getQuotaKey, getResolverAliasMap, isClaudeThinkingModel, isImageGenerationModel, isRetiredAgyModel, parseRateLimitReason, preserveResponseMetadata, RETIRED_AGY_MODEL_MESSAGE, redactCredentialError, redactCredentialResponse, redactCredentialText, resolveQuotaGroup, VAULT_ACCOUNT_REMEDY, } from '@cortexkit/antigravity-auth-core';
|
|
20
|
+
import { ANTIGRAVITY_ENDPOINT_FALLBACKS } from '../../constants';
|
|
21
21
|
import { AntigravityKillswitchError } from '../errors';
|
|
22
22
|
import { createRetryState, } from '../fetch/retry-state';
|
|
23
23
|
import { createWarmupState } from '../fetch/warmup';
|
|
24
|
-
import { extractModelFromUrl, getModelFamilyFromUrl, isCapacityRetryBudgetExhausted, MAX_TOTAL_CAPACITY_RETRIES,
|
|
24
|
+
import { extractModelFromUrl, getModelFamilyFromUrl, isCapacityRetryBudgetExhausted, MAX_TOTAL_CAPACITY_RETRIES, toUrlString, toWarmupStreamUrl, } from '../fetch-routing';
|
|
25
25
|
import { noteGeminiDumpResponse } from '../gemini-dump';
|
|
26
26
|
import { evaluateKillswitchForAccount, throwIfAllKilled } from '../killswitch';
|
|
27
27
|
import { createNativeGoogleErrorResponse, createSyntheticTextResponse, isEmptyResponseBody, } from '../request-helpers';
|
|
@@ -39,7 +39,7 @@ const FIRST_RETRY_DELAY_MS = 1000;
|
|
|
39
39
|
* `RequestWire.prepare`'s.
|
|
40
40
|
*/
|
|
41
41
|
export function prepareAgyWireRequest(wire, request) {
|
|
42
|
-
return wire.prepare(request.input, request.init, request.accessToken, request.projectId, request.endpoint, request.
|
|
42
|
+
return wire.prepare(request.input, request.init, request.accessToken, request.projectId, request.endpoint, request.forceThinkingRecovery ?? false, request.options);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* The model a title request is sent to when the host selected one this
|
|
@@ -61,6 +61,22 @@ export function routeTitleModel(url) {
|
|
|
61
61
|
return url;
|
|
62
62
|
return url.replace(`/models/${model}`, `/models/${TITLE_FALLBACK_MODEL}`);
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Return the retired-model error using only the model registry: callers need
|
|
66
|
+
* neither an initialized account store nor an available vault to reject it.
|
|
67
|
+
*/
|
|
68
|
+
export function retiredModelResponse(url) {
|
|
69
|
+
const model = extractModelFromUrl(url);
|
|
70
|
+
if (!model || !isRetiredAgyModel(model))
|
|
71
|
+
return undefined;
|
|
72
|
+
return new Response(JSON.stringify({
|
|
73
|
+
error: {
|
|
74
|
+
code: 412,
|
|
75
|
+
status: 'FAILED_PRECONDITION',
|
|
76
|
+
message: RETIRED_AGY_MODEL_MESSAGE,
|
|
77
|
+
},
|
|
78
|
+
}), { status: 412, headers: { 'Content-Type': 'application/json' } });
|
|
79
|
+
}
|
|
64
80
|
/**
|
|
65
81
|
* The AGY metadata key for a request: the host session for primary (and
|
|
66
82
|
* kind-less) requests, a separate per-kind key for every other kind.
|
|
@@ -174,7 +190,7 @@ function sleep(ms, signal) {
|
|
|
174
190
|
* dropped.
|
|
175
191
|
*/
|
|
176
192
|
export function createLocalQuotaRefresh(accountManager, quotaManager, log) {
|
|
177
|
-
return async function refreshQuotaAfterSuccess(account, intervalMinutes) {
|
|
193
|
+
return async function refreshQuotaAfterSuccess(account, intervalMinutes, signal) {
|
|
178
194
|
if (intervalMinutes <= 0)
|
|
179
195
|
return;
|
|
180
196
|
const accountIndex = accountManager.getAccounts().indexOf(account);
|
|
@@ -197,7 +213,11 @@ export function createLocalQuotaRefresh(accountManager, quotaManager, log) {
|
|
|
197
213
|
const expectedRefreshToken = singleAccount.refreshToken;
|
|
198
214
|
const result = await quotaManager.refreshAccount(singleAccount, {
|
|
199
215
|
index: accountIndex,
|
|
216
|
+
purpose: 'advisory',
|
|
217
|
+
...(signal ? { signal } : {}),
|
|
200
218
|
});
|
|
219
|
+
if (signal?.aborted)
|
|
220
|
+
return;
|
|
201
221
|
if (result.status === 'ok' && result.quota?.groups) {
|
|
202
222
|
// Re-resolve the selected row itself. If it was removed meanwhile,
|
|
203
223
|
// drop the reading rather than writing onto whichever row shifted
|
|
@@ -219,11 +239,13 @@ export function createLocalQuotaRefresh(accountManager, quotaManager, log) {
|
|
|
219
239
|
* warmup bookkeeping, so disposing it releases every counter.
|
|
220
240
|
*/
|
|
221
241
|
export function createRequestExecutor(deps) {
|
|
222
|
-
const { config, accounts: accountManager, credentials, sessions: agySessionRegistry, operatorSettings, transport: defaultTransport,
|
|
242
|
+
const { config, accounts: accountManager, credentials, sessions: agySessionRegistry, operatorSettings, transport: defaultTransport, wire, debug, dump, logger: log, trackers, classifyAccessError, notify, onRouting, } = deps;
|
|
223
243
|
const retryState = createRetryState();
|
|
224
244
|
const warmupState = createWarmupState();
|
|
225
245
|
const shutdown = new AbortController();
|
|
226
246
|
const inFlight = new Set();
|
|
247
|
+
const advisoryWork = new Set();
|
|
248
|
+
let advisoryClosing = false;
|
|
227
249
|
const bufferedOverflow = new WeakMap();
|
|
228
250
|
let retired = false;
|
|
229
251
|
let drainPromise;
|
|
@@ -295,18 +317,40 @@ export function createRequestExecutor(deps) {
|
|
|
295
317
|
});
|
|
296
318
|
}
|
|
297
319
|
}
|
|
320
|
+
let selectedVariant = options.variant;
|
|
298
321
|
if (kind === 'title') {
|
|
299
|
-
|
|
322
|
+
const routed = routeTitleModel(input);
|
|
323
|
+
// A variant belongs to its catalog model, not the replacement title model.
|
|
324
|
+
if (routed !== input)
|
|
325
|
+
selectedVariant = undefined;
|
|
326
|
+
input = routed;
|
|
300
327
|
}
|
|
328
|
+
const retired = retiredModelResponse(input);
|
|
329
|
+
if (retired)
|
|
330
|
+
return retired;
|
|
301
331
|
const selectedModel = extractModelFromUrl(input);
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
332
|
+
let variant;
|
|
333
|
+
if (selectedVariant !== undefined) {
|
|
334
|
+
const definitions = getPublicModelDefinitions();
|
|
335
|
+
const variants = selectedModel && Object.hasOwn(definitions, selectedModel)
|
|
336
|
+
? definitions[selectedModel]?.variants
|
|
337
|
+
: undefined;
|
|
338
|
+
const registered = variants && Object.hasOwn(variants, selectedVariant)
|
|
339
|
+
? variants[selectedVariant]
|
|
340
|
+
: undefined;
|
|
341
|
+
if (!registered || registered.disabled === true) {
|
|
342
|
+
return new Response(JSON.stringify({
|
|
343
|
+
error: {
|
|
344
|
+
code: 412,
|
|
345
|
+
status: 'FAILED_PRECONDITION',
|
|
346
|
+
message: 'This Antigravity thinking level is unavailable. Choose another thinking level.',
|
|
347
|
+
},
|
|
348
|
+
}), { status: 412, headers: { 'Content-Type': 'application/json' } });
|
|
349
|
+
}
|
|
350
|
+
variant = {
|
|
351
|
+
thinkingLevel: registered.thinkingLevel,
|
|
352
|
+
thinkingBudget: registered.thinkingConfig?.thinkingBudget,
|
|
353
|
+
};
|
|
310
354
|
}
|
|
311
355
|
// A host that sends each request through its own raw sender (the GA
|
|
312
356
|
// loopback bridge) supplies it per request; every send of this request,
|
|
@@ -367,16 +411,6 @@ export function createRequestExecutor(deps) {
|
|
|
367
411
|
};
|
|
368
412
|
const quietMode = config.quiet_mode;
|
|
369
413
|
const toastScope = config.toast_scope;
|
|
370
|
-
// Apply operator-controlled routing overrides live. The slash
|
|
371
|
-
// commands mutate these values through `applyCommand`; reading
|
|
372
|
-
// them per-request means a runtime flip takes effect on the next
|
|
373
|
-
// dispatched call without restarting the plugin.
|
|
374
|
-
const operatorRouting = operatorSettings?.get().routing;
|
|
375
|
-
const effectiveConfig = {
|
|
376
|
-
...config,
|
|
377
|
-
cli_first: operatorRouting?.cli_first ?? config.cli_first,
|
|
378
|
-
quota_style_fallback: operatorRouting?.quota_style_fallback ?? config.quota_style_fallback,
|
|
379
|
-
};
|
|
380
414
|
const showToast = async (message, variant) => {
|
|
381
415
|
log.debug('toast', {
|
|
382
416
|
message,
|
|
@@ -408,11 +442,6 @@ export function createRequestExecutor(deps) {
|
|
|
408
442
|
// TUI may not be available
|
|
409
443
|
}
|
|
410
444
|
};
|
|
411
|
-
const hasOtherAccountWithAntigravity = (currentAccount) => {
|
|
412
|
-
if (family !== 'gemini')
|
|
413
|
-
return false;
|
|
414
|
-
return accountManager.hasOtherAccountWithAntigravityAvailable(currentAccount.index, family, model);
|
|
415
|
-
};
|
|
416
445
|
let accountSwitchCount = 0;
|
|
417
446
|
const maxAccountSwitches = config.max_account_switches ?? 2;
|
|
418
447
|
let previousAccountIndex = -1;
|
|
@@ -422,8 +451,6 @@ export function createRequestExecutor(deps) {
|
|
|
422
451
|
await assertAdmission();
|
|
423
452
|
checkAborted();
|
|
424
453
|
const accountCount = accountManager.getAccountCount();
|
|
425
|
-
const routingDecision = resolveHeaderRoutingDecision(urlString, family, effectiveConfig);
|
|
426
|
-
const { preferredHeaderStyle, explicitQuota, allowQuotaFallback } = routingDecision;
|
|
427
454
|
if (accountCount === 0) {
|
|
428
455
|
// Mirror the no-account short-circuit inside the retry loop so callers
|
|
429
456
|
// that race with account removal still get a proper 401 instead of a
|
|
@@ -441,12 +468,6 @@ export function createRequestExecutor(deps) {
|
|
|
441
468
|
.getAccounts()
|
|
442
469
|
.filter((entry) => {
|
|
443
470
|
const decision = evaluateKillswitchForAccount(entry, family, {
|
|
444
|
-
routing: effectiveConfig.cli_first !== undefined
|
|
445
|
-
? {
|
|
446
|
-
cli_first: effectiveConfig.cli_first,
|
|
447
|
-
quota_style_fallback: !!effectiveConfig.quota_style_fallback,
|
|
448
|
-
}
|
|
449
|
-
: { cli_first: false, quota_style_fallback: false },
|
|
450
471
|
killswitch: operatorKillswitch,
|
|
451
472
|
log_level: 'info',
|
|
452
473
|
}, { now: Date.now(), model });
|
|
@@ -463,7 +484,6 @@ export function createRequestExecutor(deps) {
|
|
|
463
484
|
model: model ?? 'unknown',
|
|
464
485
|
accounts: accountManager.getAccounts(),
|
|
465
486
|
settings: {
|
|
466
|
-
routing: { cli_first: false, quota_style_fallback: false },
|
|
467
487
|
killswitch: operatorKillswitch ?? {
|
|
468
488
|
enabled: false,
|
|
469
489
|
minimum_remaining_percent: 0,
|
|
@@ -490,8 +510,7 @@ export function createRequestExecutor(deps) {
|
|
|
490
510
|
}
|
|
491
511
|
}
|
|
492
512
|
// The eligibility mask above is computed once for this selection
|
|
493
|
-
// pass and applies to
|
|
494
|
-
// fallback below. Selection does not re-evaluate quota, so a killed
|
|
513
|
+
// pass and applies to the account selection below. Selection does not re-evaluate quota, so a killed
|
|
495
514
|
// current account falls through to the next eligible account.
|
|
496
515
|
const killedIndexes = eligibleIndexes === null
|
|
497
516
|
? undefined
|
|
@@ -499,7 +518,7 @@ export function createRequestExecutor(deps) {
|
|
|
499
518
|
.getAccounts()
|
|
500
519
|
.map((entry) => entry.index)
|
|
501
520
|
.filter((index) => !eligibleIndexes.has(index)));
|
|
502
|
-
let account = accountManager.getCurrentOrNextForFamily(family, model, config.account_selection_strategy,
|
|
521
|
+
let account = accountManager.getCurrentOrNextForFamily(family, model, config.account_selection_strategy, config.pid_offset_enabled, config.soft_quota_threshold_percent, softQuotaCacheTtlMs, accountSessionIdentity, killedIndexes);
|
|
503
522
|
// The selected account must be inside the eligibility mask.
|
|
504
523
|
if (account &&
|
|
505
524
|
eligibleIndexes !== null &&
|
|
@@ -507,21 +526,6 @@ export function createRequestExecutor(deps) {
|
|
|
507
526
|
pushDebug(`killswitch-excluded idx=${account.index} (precomputed eligible set)`);
|
|
508
527
|
account = null;
|
|
509
528
|
}
|
|
510
|
-
if (!account && allowQuotaFallback) {
|
|
511
|
-
const alternateHeaderStyle = preferredHeaderStyle === 'antigravity' ? 'gemini-cli' : 'antigravity';
|
|
512
|
-
account = accountManager.getCurrentOrNextForFamily(family, model, config.account_selection_strategy, alternateHeaderStyle, config.pid_offset_enabled, config.soft_quota_threshold_percent, softQuotaCacheTtlMs, accountSessionIdentity, killedIndexes);
|
|
513
|
-
if (account) {
|
|
514
|
-
pushDebug(`selected-by-fallback idx=${account.index} preferred=${preferredHeaderStyle} alternate=${alternateHeaderStyle}`);
|
|
515
|
-
}
|
|
516
|
-
// The header-style fallback may not select an account outside the
|
|
517
|
-
// eligibility mask.
|
|
518
|
-
if (account &&
|
|
519
|
-
eligibleIndexes !== null &&
|
|
520
|
-
!eligibleIndexes.has(account.index)) {
|
|
521
|
-
pushDebug(`killswitch-excluded idx=${account.index} after fallback (precomputed eligible set)`);
|
|
522
|
-
account = null;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
529
|
if (!account) {
|
|
526
530
|
if (accountManager.areAllAccountsOverSoftQuota(family, config.soft_quota_threshold_percent, softQuotaCacheTtlMs, model)) {
|
|
527
531
|
const threshold = config.soft_quota_threshold_percent;
|
|
@@ -547,8 +551,7 @@ export function createRequestExecutor(deps) {
|
|
|
547
551
|
await sleep(softQuotaWaitMs, abortSignal);
|
|
548
552
|
continue;
|
|
549
553
|
}
|
|
550
|
-
const
|
|
551
|
-
const minWaitMs = accountManager.getMinWaitTimeForFamily(family, model, preferredHeaderStyle, strictWait);
|
|
554
|
+
const minWaitMs = accountManager.getMinWaitTimeForFamily(family, model);
|
|
552
555
|
const waitMs = minWaitMs || 60_000;
|
|
553
556
|
pushDebug(`all-rate-limited family=${family} accounts=${accountCount} waitMs=${waitMs}`);
|
|
554
557
|
if (debug.isDebugEnabled()) {
|
|
@@ -683,7 +686,7 @@ export function createRequestExecutor(deps) {
|
|
|
683
686
|
}
|
|
684
687
|
if (shouldCooldown) {
|
|
685
688
|
accountManager.markAccountCoolingDown(account, cooldownMs, 'auth-failure');
|
|
686
|
-
accountManager.markRateLimited(account, cooldownMs, family,
|
|
689
|
+
accountManager.markRateLimited(account, cooldownMs, family, model);
|
|
687
690
|
pushDebug(`token-refresh-failed: cooldown ${cooldownMs}ms after ${failures} failures`);
|
|
688
691
|
}
|
|
689
692
|
continue;
|
|
@@ -736,7 +739,7 @@ export function createRequestExecutor(deps) {
|
|
|
736
739
|
error instanceof Error ? error : new Error(String(error));
|
|
737
740
|
if (shouldCooldown) {
|
|
738
741
|
accountManager.markAccountCoolingDown(account, cooldownMs, 'auth-failure');
|
|
739
|
-
accountManager.markRateLimited(account, cooldownMs, family,
|
|
742
|
+
accountManager.markRateLimited(account, cooldownMs, family, model);
|
|
740
743
|
pushDebug(`token-refresh-error: cooldown ${cooldownMs}ms after ${failures} failures`);
|
|
741
744
|
}
|
|
742
745
|
continue;
|
|
@@ -765,7 +768,7 @@ export function createRequestExecutor(deps) {
|
|
|
765
768
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
766
769
|
if (shouldCooldown) {
|
|
767
770
|
accountManager.markAccountCoolingDown(account, cooldownMs, 'project-error');
|
|
768
|
-
accountManager.markRateLimited(account, cooldownMs, family,
|
|
771
|
+
accountManager.markRateLimited(account, cooldownMs, family, model);
|
|
769
772
|
pushDebug(`project-context-error: cooldown ${cooldownMs}ms after ${failures} failures`);
|
|
770
773
|
}
|
|
771
774
|
continue;
|
|
@@ -833,12 +836,10 @@ export function createRequestExecutor(deps) {
|
|
|
833
836
|
try {
|
|
834
837
|
pushDebug('thinking-warmup: start');
|
|
835
838
|
const warmupSend = await credentialForAuxiliarySend(warmupInit, projectId);
|
|
836
|
-
const warmupResponse =
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
})
|
|
841
|
-
: await upstreamFetch(warmupUrl, warmupSend.init);
|
|
839
|
+
const warmupResponse = await transport(warmupUrl, warmupSend.init, {
|
|
840
|
+
signal: abortSignal,
|
|
841
|
+
onDebug: pushDebug,
|
|
842
|
+
});
|
|
842
843
|
reportVault401(warmupSend.admission, warmupResponse.status);
|
|
843
844
|
const transformed = await wire.transformResponse(warmupResponse, true, warmupDebugContext, prepared.requestedModel, projectId, warmupUrl, prepared.effectiveModel, prepared.sessionId);
|
|
844
845
|
await transformed.text();
|
|
@@ -864,12 +865,10 @@ export function createRequestExecutor(deps) {
|
|
|
864
865
|
try {
|
|
865
866
|
pushDebug('cache-warmup-probe: start');
|
|
866
867
|
const probeSend = await credentialForAuxiliarySend({ ...prepared.init, method: 'POST', body: bodyStr }, prepared.projectId ?? '');
|
|
867
|
-
const probeResponse = prepared.
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
})
|
|
872
|
-
: await upstreamFetch(toUrlString(prepared.request), probeSend.init);
|
|
868
|
+
const probeResponse = await transport(toUrlString(prepared.request), probeSend.init, {
|
|
869
|
+
signal: abortSignal,
|
|
870
|
+
onDebug: pushDebug,
|
|
871
|
+
});
|
|
873
872
|
reportVault401(probeSend.admission, probeResponse.status);
|
|
874
873
|
if (probeResponse.body) {
|
|
875
874
|
const reader = probeResponse.body.getReader();
|
|
@@ -902,57 +901,11 @@ export function createRequestExecutor(deps) {
|
|
|
902
901
|
};
|
|
903
902
|
let apiRequestCount = 0;
|
|
904
903
|
let shouldSwitchAccount = false;
|
|
905
|
-
let headerStyle = preferredHeaderStyle;
|
|
906
|
-
pushDebug(`headerStyle=${headerStyle} explicit=${explicitQuota}`);
|
|
907
904
|
if (account.fingerprint) {
|
|
908
905
|
pushDebug(`fingerprint: deviceId=${account.fingerprint.deviceId.slice(0, 8)}...`);
|
|
909
906
|
}
|
|
910
|
-
if (accountManager.
|
|
911
|
-
|
|
912
|
-
family === 'gemini' &&
|
|
913
|
-
headerStyle === 'antigravity') {
|
|
914
|
-
if (accountManager.hasOtherAccountWithAntigravityAvailable(account.index, family, model)) {
|
|
915
|
-
pushDebug(`antigravity rate-limited on account ${account.index}, but available on other accounts. Switching.`);
|
|
916
|
-
shouldSwitchAccount = true;
|
|
917
|
-
}
|
|
918
|
-
else {
|
|
919
|
-
const alternateStyle = accountManager.getAvailableHeaderStyle(account, family, model);
|
|
920
|
-
const fallbackStyle = resolveQuotaFallbackHeaderStyle({
|
|
921
|
-
family,
|
|
922
|
-
headerStyle,
|
|
923
|
-
alternateStyle,
|
|
924
|
-
});
|
|
925
|
-
if (fallbackStyle) {
|
|
926
|
-
await showToast(`Antigravity quota exhausted on all accounts. Using Gemini CLI quota.`, 'warning');
|
|
927
|
-
headerStyle = fallbackStyle;
|
|
928
|
-
pushDebug(`all-accounts antigravity exhausted, quota fallback: ${headerStyle}`);
|
|
929
|
-
}
|
|
930
|
-
else {
|
|
931
|
-
shouldSwitchAccount = true;
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
else if (allowQuotaFallback && family === 'gemini') {
|
|
936
|
-
const alternateStyle = accountManager.getAvailableHeaderStyle(account, family, model);
|
|
937
|
-
const fallbackStyle = resolveQuotaFallbackHeaderStyle({
|
|
938
|
-
family,
|
|
939
|
-
headerStyle,
|
|
940
|
-
alternateStyle,
|
|
941
|
-
});
|
|
942
|
-
if (fallbackStyle) {
|
|
943
|
-
const quotaName = headerStyle === 'gemini-cli' ? 'Gemini CLI' : 'Antigravity';
|
|
944
|
-
const altQuotaName = fallbackStyle === 'gemini-cli' ? 'Gemini CLI' : 'Antigravity';
|
|
945
|
-
await showToast(`${quotaName} quota exhausted, using ${altQuotaName} quota`, 'warning');
|
|
946
|
-
headerStyle = fallbackStyle;
|
|
947
|
-
pushDebug(`quota fallback: ${headerStyle}`);
|
|
948
|
-
}
|
|
949
|
-
else {
|
|
950
|
-
shouldSwitchAccount = true;
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
else {
|
|
954
|
-
shouldSwitchAccount = true;
|
|
955
|
-
}
|
|
907
|
+
if (accountManager.isRateLimited(account, family, model)) {
|
|
908
|
+
shouldSwitchAccount = true;
|
|
956
909
|
}
|
|
957
910
|
let totalCapacityRetries = 0;
|
|
958
911
|
while (!shouldSwitchAccount) {
|
|
@@ -969,11 +922,6 @@ export function createRequestExecutor(deps) {
|
|
|
969
922
|
lastEndpointIndex = i;
|
|
970
923
|
}
|
|
971
924
|
const currentEndpoint = ANTIGRAVITY_ENDPOINT_FALLBACKS[i];
|
|
972
|
-
if (headerStyle === 'gemini-cli' &&
|
|
973
|
-
currentEndpoint !== 'https://cloudcode-pa.googleapis.com') {
|
|
974
|
-
pushDebug(`Skipping sandbox endpoint ${currentEndpoint} for gemini-cli headerStyle`);
|
|
975
|
-
continue;
|
|
976
|
-
}
|
|
977
925
|
let tokenConsumed = false;
|
|
978
926
|
let physicalAttemptStarted = false;
|
|
979
927
|
try {
|
|
@@ -1011,7 +959,6 @@ export function createRequestExecutor(deps) {
|
|
|
1011
959
|
accessToken: sendAccessToken,
|
|
1012
960
|
projectId: sendProjectId,
|
|
1013
961
|
endpoint: currentEndpoint,
|
|
1014
|
-
headerStyle,
|
|
1015
962
|
forceThinkingRecovery,
|
|
1016
963
|
options: {
|
|
1017
964
|
claudeToolHardening: config.claude_tool_hardening,
|
|
@@ -1019,6 +966,7 @@ export function createRequestExecutor(deps) {
|
|
|
1019
966
|
fingerprint: account.fingerprint,
|
|
1020
967
|
agySession: agyRequestSession,
|
|
1021
968
|
agyRequestTimestamp: agyRequestScope.timestamp,
|
|
969
|
+
variant,
|
|
1022
970
|
},
|
|
1023
971
|
});
|
|
1024
972
|
const originalUrl = toUrlString(input);
|
|
@@ -1081,9 +1029,7 @@ export function createRequestExecutor(deps) {
|
|
|
1081
1029
|
}
|
|
1082
1030
|
pushDebug(`dispatching request via ${prepared.headerStyle} transport`);
|
|
1083
1031
|
physicalAttemptStarted = true;
|
|
1084
|
-
const response = prepared.
|
|
1085
|
-
? await transport(toUrlString(prepared.request), prepared.init, { signal: abortSignal, onDebug: pushDebug })
|
|
1086
|
-
: await upstreamFetch(prepared.request, prepared.init);
|
|
1032
|
+
const response = await transport(toUrlString(prepared.request), prepared.init, { signal: abortSignal, onDebug: pushDebug });
|
|
1087
1033
|
apiRequestCount++;
|
|
1088
1034
|
accountManager.recordRequest(account.index, family);
|
|
1089
1035
|
const requestCounts = accountManager.getDailyRequestCounts(account.index);
|
|
@@ -1199,7 +1145,7 @@ export function createRequestExecutor(deps) {
|
|
|
1199
1145
|
continue;
|
|
1200
1146
|
}
|
|
1201
1147
|
}
|
|
1202
|
-
const quotaKey =
|
|
1148
|
+
const quotaKey = getQuotaKey(family, model);
|
|
1203
1149
|
const backoff = retryState.getRateLimitBackoff(account.index, quotaKey, serverRetryMs);
|
|
1204
1150
|
const smartBackoffMs = calculateBackoffMs(rateLimitReason, account.consecutiveFailures ?? 0, serverRetryMs);
|
|
1205
1151
|
const effectiveDelayMs = Math.max(backoff.delayMs, smartBackoffMs);
|
|
@@ -1223,7 +1169,7 @@ export function createRequestExecutor(deps) {
|
|
|
1223
1169
|
if (effectiveDelayMs <= maxCacheFirstWaitMs) {
|
|
1224
1170
|
pushDebug(`cache_first: waiting ${effectiveDelayMs}ms for same account to recover`);
|
|
1225
1171
|
await showToast(`⏳ Waiting ${Math.ceil(effectiveDelayMs / 1000)}s for same account (prompt cache preserved)...`, 'info');
|
|
1226
|
-
accountManager.markRateLimitedWithReason(account, family,
|
|
1172
|
+
accountManager.markRateLimitedWithReason(account, family, model, rateLimitReason, serverRetryMs);
|
|
1227
1173
|
await sleep(effectiveDelayMs, abortSignal);
|
|
1228
1174
|
i -= 1;
|
|
1229
1175
|
continue;
|
|
@@ -1231,59 +1177,16 @@ export function createRequestExecutor(deps) {
|
|
|
1231
1177
|
pushDebug(`cache_first: wait ${effectiveDelayMs}ms exceeds max ${maxCacheFirstWaitMs}ms, switching account`);
|
|
1232
1178
|
}
|
|
1233
1179
|
if (config.switch_on_first_rate_limit && accountCount > 1) {
|
|
1234
|
-
accountManager.markRateLimitedWithReason(account, family,
|
|
1180
|
+
accountManager.markRateLimitedWithReason(account, family, model, rateLimitReason, serverRetryMs, config.failure_ttl_seconds * 1000);
|
|
1235
1181
|
shouldSwitchAccount = true;
|
|
1236
1182
|
break;
|
|
1237
1183
|
}
|
|
1238
1184
|
i -= 1;
|
|
1239
1185
|
continue;
|
|
1240
1186
|
}
|
|
1241
|
-
accountManager.markRateLimitedWithReason(account, family,
|
|
1187
|
+
accountManager.markRateLimitedWithReason(account, family, model, rateLimitReason, serverRetryMs, config.failure_ttl_seconds * 1000);
|
|
1242
1188
|
accountManager.requestSaveToDisk();
|
|
1243
1189
|
const switchAccountDelayMs = config.switch_account_delay_ms ?? 500;
|
|
1244
|
-
if (family === 'gemini') {
|
|
1245
|
-
if (headerStyle === 'antigravity') {
|
|
1246
|
-
if (hasOtherAccountWithAntigravity(account)) {
|
|
1247
|
-
pushDebug(`antigravity exhausted on account ${account.index}, but available on others. Switching account.`);
|
|
1248
|
-
await showToast(`Rate limited again. Switching account in ${formatWaitTime(switchAccountDelayMs)}...`, 'warning');
|
|
1249
|
-
await sleep(switchAccountDelayMs, abortSignal);
|
|
1250
|
-
shouldSwitchAccount = true;
|
|
1251
|
-
break;
|
|
1252
|
-
}
|
|
1253
|
-
if (allowQuotaFallback) {
|
|
1254
|
-
const alternateStyle = accountManager.getAvailableHeaderStyle(account, family, model);
|
|
1255
|
-
const fallbackStyle = resolveQuotaFallbackHeaderStyle({
|
|
1256
|
-
family,
|
|
1257
|
-
headerStyle,
|
|
1258
|
-
alternateStyle,
|
|
1259
|
-
});
|
|
1260
|
-
if (fallbackStyle) {
|
|
1261
|
-
const safeModelName = model || 'this model';
|
|
1262
|
-
await showToast(`Antigravity quota exhausted for ${safeModelName}. Switching to Gemini CLI quota...`, 'warning');
|
|
1263
|
-
headerStyle = fallbackStyle;
|
|
1264
|
-
pushDebug(`quota fallback: ${headerStyle}`);
|
|
1265
|
-
continue;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
else if (headerStyle === 'gemini-cli') {
|
|
1270
|
-
if (allowQuotaFallback) {
|
|
1271
|
-
const alternateStyle = accountManager.getAvailableHeaderStyle(account, family, model);
|
|
1272
|
-
const fallbackStyle = resolveQuotaFallbackHeaderStyle({
|
|
1273
|
-
family,
|
|
1274
|
-
headerStyle,
|
|
1275
|
-
alternateStyle,
|
|
1276
|
-
});
|
|
1277
|
-
if (fallbackStyle) {
|
|
1278
|
-
const safeModelName = model || 'this model';
|
|
1279
|
-
await showToast(`Gemini CLI quota exhausted for ${safeModelName}. Switching to Antigravity quota...`, 'warning');
|
|
1280
|
-
headerStyle = fallbackStyle;
|
|
1281
|
-
pushDebug(`quota fallback: ${headerStyle}`);
|
|
1282
|
-
continue;
|
|
1283
|
-
}
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
1190
|
if (accountCount > 1) {
|
|
1288
1191
|
const quotaMsg = reasonInfo.quotaResetTime
|
|
1289
1192
|
? ` (quota resets ${reasonInfo.quotaResetTime})`
|
|
@@ -1303,7 +1206,7 @@ export function createRequestExecutor(deps) {
|
|
|
1303
1206
|
shouldSwitchAccount = true;
|
|
1304
1207
|
break;
|
|
1305
1208
|
}
|
|
1306
|
-
const quotaKey =
|
|
1209
|
+
const quotaKey = getQuotaKey(family, model);
|
|
1307
1210
|
retryState.resetRateLimitState(account.index, quotaKey);
|
|
1308
1211
|
retryState.resetAccountFailureState(account.index);
|
|
1309
1212
|
if (response.status === 403) {
|
|
@@ -1333,7 +1236,7 @@ export function createRequestExecutor(deps) {
|
|
|
1333
1236
|
const cooldownMs = 10 * 60 * 1000;
|
|
1334
1237
|
accountManager.markAccountVerificationRequired(account.index, verificationReason, extracted.verifyUrl);
|
|
1335
1238
|
accountManager.markAccountCoolingDown(account, cooldownMs, 'validation-required');
|
|
1336
|
-
accountManager.markRateLimited(account, cooldownMs, family,
|
|
1239
|
+
accountManager.markRateLimited(account, cooldownMs, family, model);
|
|
1337
1240
|
const label = account.email || `Account ${account.index + 1}`;
|
|
1338
1241
|
if (accountManager.shouldShowAccountToast(account.index, 60000)) {
|
|
1339
1242
|
await showToast(`⚠ ${label} needs verification. Run 'opencode auth login' and use Verify accounts.`, 'warning');
|
|
@@ -1358,17 +1261,28 @@ export function createRequestExecutor(deps) {
|
|
|
1358
1261
|
if (response.ok) {
|
|
1359
1262
|
account.consecutiveFailures = 0;
|
|
1360
1263
|
trackers.health.recordSuccess(account.index);
|
|
1361
|
-
|
|
1264
|
+
if (!advisoryClosing)
|
|
1265
|
+
accountManager.markAccountUsed(account.index);
|
|
1362
1266
|
if (credentials.domain === 'local' &&
|
|
1267
|
+
!advisoryClosing &&
|
|
1363
1268
|
credentials.refreshQuotaAfterSuccess) {
|
|
1364
|
-
|
|
1365
|
-
.
|
|
1366
|
-
.
|
|
1269
|
+
const quotaCancellation = createRequestCancellation(init?.signal
|
|
1270
|
+
? [init.signal, shutdown.signal]
|
|
1271
|
+
: [shutdown.signal]);
|
|
1272
|
+
const work = credentials
|
|
1273
|
+
.refreshQuotaAfterSuccess(account, config.quota_refresh_interval_minutes, quotaCancellation.signal)
|
|
1274
|
+
.catch(() => {
|
|
1275
|
+
log.debug('post-response-advisory-work-failed');
|
|
1276
|
+
})
|
|
1277
|
+
.finally(() => quotaCancellation.release());
|
|
1278
|
+
advisoryWork.add(work);
|
|
1279
|
+
void work.then(() => advisoryWork.delete(work), () => advisoryWork.delete(work));
|
|
1367
1280
|
}
|
|
1368
1281
|
const proactiveThreshold = config.proactive_rotation_threshold_percent ?? 20;
|
|
1369
|
-
if (
|
|
1282
|
+
if (!advisoryClosing &&
|
|
1283
|
+
proactiveThreshold > 0 &&
|
|
1370
1284
|
accountManager.shouldProactivelyRotate(family, model, proactiveThreshold, softQuotaCacheTtlMs, accountSessionIdentity)) {
|
|
1371
|
-
const rotated = accountManager.proactivelyRotateForFamily(family, model,
|
|
1285
|
+
const rotated = accountManager.proactivelyRotateForFamily(family, model, config.soft_quota_threshold_percent, softQuotaCacheTtlMs, accountSessionIdentity);
|
|
1372
1286
|
if (rotated) {
|
|
1373
1287
|
const remaining = account.cachedQuota?.[resolveQuotaGroup(family, model)]
|
|
1374
1288
|
?.remainingFraction;
|
|
@@ -1537,7 +1451,7 @@ export function createRequestExecutor(deps) {
|
|
|
1537
1451
|
error instanceof Error ? error : new Error(String(error));
|
|
1538
1452
|
if (shouldCooldown) {
|
|
1539
1453
|
accountManager.markAccountCoolingDown(account, cooldownMs, 'network-error');
|
|
1540
|
-
accountManager.markRateLimited(account, cooldownMs, family,
|
|
1454
|
+
accountManager.markRateLimited(account, cooldownMs, family, model);
|
|
1541
1455
|
pushDebug(`endpoint-error: cooldown ${cooldownMs}ms after ${failures} failures`);
|
|
1542
1456
|
}
|
|
1543
1457
|
shouldSwitchAccount = true;
|
|
@@ -1571,10 +1485,13 @@ export function createRequestExecutor(deps) {
|
|
|
1571
1485
|
// Waits for every admitted request and retained body, then releases the
|
|
1572
1486
|
// bookkeeping they use. Runs once, whether `retire` or `dispose` asks first.
|
|
1573
1487
|
function drain() {
|
|
1488
|
+
advisoryClosing = true;
|
|
1574
1489
|
drainPromise ??= (async () => {
|
|
1575
1490
|
// A refresh that already exchanged tokens must finish its owned store write.
|
|
1576
1491
|
while (inFlight.size > 0)
|
|
1577
1492
|
await Promise.allSettled([...inFlight]);
|
|
1493
|
+
while (advisoryWork.size > 0)
|
|
1494
|
+
await Promise.allSettled([...advisoryWork]);
|
|
1578
1495
|
retryState.dispose();
|
|
1579
1496
|
warmupState.dispose();
|
|
1580
1497
|
})();
|