@cortexkit/opencode-antigravity-auth 1.1.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +225 -569
- package/dist/cli.js +4017 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20742 -14586
- package/dist/index.js.map +4 -4
- package/dist/src/antigravity/oauth.d.ts +1 -1
- package/dist/src/antigravity/oauth.js +1 -1
- package/dist/src/cli.d.ts +21 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +237 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/cache.js +13 -13
- package/dist/src/hooks/auto-update-checker/cache.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/checker.d.ts +1 -1
- package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/checker.js +75 -51
- package/dist/src/hooks/auto-update-checker/checker.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/constants.js +12 -12
- package/dist/src/hooks/auto-update-checker/constants.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/index.d.ts +6 -6
- package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/index.js +17 -17
- package/dist/src/hooks/auto-update-checker/index.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/logging.js +2 -2
- package/dist/src/hooks/auto-update-checker/logging.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -1
- package/dist/src/plugin/account-access.d.ts +99 -0
- package/dist/src/plugin/account-access.d.ts.map +1 -0
- package/dist/src/plugin/account-access.js +480 -0
- package/dist/src/plugin/account-access.js.map +1 -0
- package/dist/src/plugin/account-command-oauth.d.ts +34 -0
- package/dist/src/plugin/account-command-oauth.d.ts.map +1 -0
- package/dist/src/plugin/account-command-oauth.js +156 -0
- package/dist/src/plugin/account-command-oauth.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +7 -256
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +31 -1367
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/agy-request-metadata.d.ts +1 -1
- package/dist/src/plugin/agy-request-metadata.js +1 -1
- package/dist/src/plugin/agy-transport.d.ts +1 -1
- package/dist/src/plugin/agy-transport.js +1 -1
- package/dist/src/plugin/auth-doctor.d.ts +6 -6
- package/dist/src/plugin/auth-doctor.d.ts.map +1 -1
- package/dist/src/plugin/auth-doctor.js +74 -66
- package/dist/src/plugin/auth-doctor.js.map +1 -1
- package/dist/src/plugin/auth-drift.d.ts +4 -4
- package/dist/src/plugin/auth-drift.d.ts.map +1 -1
- package/dist/src/plugin/auth-drift.js +15 -15
- package/dist/src/plugin/auth-drift.js.map +1 -1
- package/dist/src/plugin/auth-loader.d.ts +50 -0
- package/dist/src/plugin/auth-loader.d.ts.map +1 -0
- package/dist/src/plugin/auth-loader.js +225 -0
- package/dist/src/plugin/auth-loader.js.map +1 -0
- package/dist/src/plugin/auth.d.ts +1 -1
- package/dist/src/plugin/auth.js +1 -1
- package/dist/src/plugin/background-quota-refresh.d.ts +146 -0
- package/dist/src/plugin/background-quota-refresh.d.ts.map +1 -0
- package/dist/src/plugin/background-quota-refresh.js +347 -0
- package/dist/src/plugin/background-quota-refresh.js.map +1 -0
- package/dist/src/plugin/cache/index.d.ts +1 -1
- package/dist/src/plugin/cache/index.d.ts.map +1 -1
- package/dist/src/plugin/cache/index.js +1 -1
- package/dist/src/plugin/cache/index.js.map +1 -1
- package/dist/src/plugin/cache/signature-cache.d.ts +1 -1
- package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
- package/dist/src/plugin/cache/signature-cache.js +23 -24
- package/dist/src/plugin/cache/signature-cache.js.map +1 -1
- package/dist/src/plugin/cache.d.ts +6 -5
- package/dist/src/plugin/cache.d.ts.map +1 -1
- package/dist/src/plugin/cache.js +21 -7
- package/dist/src/plugin/cache.js.map +1 -1
- package/dist/src/plugin/catalog.d.ts +23 -0
- package/dist/src/plugin/catalog.d.ts.map +1 -0
- package/dist/src/plugin/catalog.js +60 -0
- package/dist/src/plugin/catalog.js.map +1 -0
- package/dist/src/plugin/cli.d.ts +7 -7
- package/dist/src/plugin/cli.d.ts.map +1 -1
- package/dist/src/plugin/cli.js +62 -55
- package/dist/src/plugin/cli.js.map +1 -1
- package/dist/src/plugin/command-data.d.ts +329 -0
- package/dist/src/plugin/command-data.d.ts.map +1 -0
- package/dist/src/plugin/command-data.js +517 -0
- package/dist/src/plugin/command-data.js.map +1 -0
- package/dist/src/plugin/commands.d.ts +154 -0
- package/dist/src/plugin/commands.d.ts.map +1 -0
- package/dist/src/plugin/commands.js +746 -0
- package/dist/src/plugin/commands.js.map +1 -0
- package/dist/src/plugin/config/index.d.ts +2 -2
- package/dist/src/plugin/config/index.d.ts.map +1 -1
- package/dist/src/plugin/config/index.js +2 -2
- package/dist/src/plugin/config/index.js.map +1 -1
- package/dist/src/plugin/config/loader.d.ts +1 -1
- package/dist/src/plugin/config/loader.d.ts.map +1 -1
- package/dist/src/plugin/config/loader.js +18 -16
- package/dist/src/plugin/config/loader.js.map +1 -1
- package/dist/src/plugin/config/models.d.ts +2 -2
- package/dist/src/plugin/config/models.d.ts.map +1 -1
- package/dist/src/plugin/config/models.js +1 -1
- package/dist/src/plugin/config/models.js.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.d.ts +29 -0
- package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -0
- package/dist/src/plugin/config/operator-settings-schema.js +28 -0
- package/dist/src/plugin/config/operator-settings-schema.js.map +1 -0
- package/dist/src/plugin/config/schema.d.ts +23 -2
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +109 -25
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/config/updater.d.ts.map +1 -1
- package/dist/src/plugin/config/updater.js +15 -15
- package/dist/src/plugin/config/updater.js.map +1 -1
- package/dist/src/plugin/config/writer.d.ts +34 -0
- package/dist/src/plugin/config/writer.d.ts.map +1 -0
- package/dist/src/plugin/config/writer.js +81 -0
- package/dist/src/plugin/config/writer.js.map +1 -0
- package/dist/src/plugin/core/streaming/index.d.ts +1 -1
- package/dist/src/plugin/core/streaming/index.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/index.js +1 -1
- package/dist/src/plugin/core/streaming/index.js.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.js +85 -44
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
- package/dist/src/plugin/core/streaming/types.d.ts.map +1 -1
- package/dist/src/plugin/debug.d.ts +10 -3
- package/dist/src/plugin/debug.d.ts.map +1 -1
- package/dist/src/plugin/debug.js +110 -47
- package/dist/src/plugin/debug.js.map +1 -1
- package/dist/src/plugin/dependencies.d.ts +129 -0
- package/dist/src/plugin/dependencies.d.ts.map +1 -0
- package/dist/src/plugin/dependencies.js +107 -0
- package/dist/src/plugin/dependencies.js.map +1 -0
- package/dist/src/plugin/errors.d.ts +27 -0
- package/dist/src/plugin/errors.d.ts.map +1 -1
- package/dist/src/plugin/errors.js +29 -3
- package/dist/src/plugin/errors.js.map +1 -1
- package/dist/src/plugin/event-handler.d.ts +53 -0
- package/dist/src/plugin/event-handler.d.ts.map +1 -0
- package/dist/src/plugin/event-handler.js +101 -0
- package/dist/src/plugin/event-handler.js.map +1 -0
- package/dist/src/plugin/fetch/retry-state.d.ts +61 -0
- package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -0
- package/dist/src/plugin/fetch/retry-state.js +248 -0
- package/dist/src/plugin/fetch/retry-state.js.map +1 -0
- package/dist/src/plugin/fetch/warmup.d.ts +30 -0
- package/dist/src/plugin/fetch/warmup.d.ts.map +1 -0
- package/dist/src/plugin/fetch/warmup.js +76 -0
- package/dist/src/plugin/fetch/warmup.js.map +1 -0
- package/dist/src/plugin/fetch-interceptor.d.ts +59 -0
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -0
- package/dist/src/plugin/fetch-interceptor.js +1399 -0
- package/dist/src/plugin/fetch-interceptor.js.map +1 -0
- package/dist/src/plugin/fetch-routing.d.ts +26 -0
- package/dist/src/plugin/fetch-routing.d.ts.map +1 -0
- package/dist/src/plugin/fetch-routing.js +99 -0
- package/dist/src/plugin/fetch-routing.js.map +1 -0
- package/dist/src/plugin/fingerprint.d.ts +1 -1
- package/dist/src/plugin/fingerprint.js +1 -1
- package/dist/src/plugin/gemini-dump.d.ts +5 -5
- package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/src/plugin/gemini-dump.js +109 -55
- package/dist/src/plugin/gemini-dump.js.map +1 -1
- package/dist/src/plugin/google-search-tool.d.ts +9 -0
- package/dist/src/plugin/google-search-tool.d.ts.map +1 -0
- package/dist/src/plugin/google-search-tool.js +56 -0
- package/dist/src/plugin/google-search-tool.js.map +1 -0
- package/dist/src/plugin/image-saver.d.ts.map +1 -1
- package/dist/src/plugin/image-saver.js +16 -16
- package/dist/src/plugin/image-saver.js.map +1 -1
- package/dist/src/plugin/index.d.ts +30 -0
- package/dist/src/plugin/index.d.ts.map +1 -0
- package/dist/src/plugin/index.js +411 -0
- package/dist/src/plugin/index.js.map +1 -0
- package/dist/src/plugin/killswitch.d.ts +94 -0
- package/dist/src/plugin/killswitch.d.ts.map +1 -0
- package/dist/src/plugin/killswitch.js +197 -0
- package/dist/src/plugin/killswitch.js.map +1 -0
- package/dist/src/plugin/lifecycle.d.ts +40 -0
- package/dist/src/plugin/lifecycle.d.ts.map +1 -0
- package/dist/src/plugin/lifecycle.js +73 -0
- package/dist/src/plugin/lifecycle.js.map +1 -0
- package/dist/src/plugin/logger.d.ts +10 -1
- package/dist/src/plugin/logger.d.ts.map +1 -1
- package/dist/src/plugin/logger.js +38 -12
- package/dist/src/plugin/logger.js.map +1 -1
- package/dist/src/plugin/logging-utils.d.ts +35 -1
- package/dist/src/plugin/logging-utils.d.ts.map +1 -1
- package/dist/src/plugin/logging-utils.js +98 -15
- package/dist/src/plugin/logging-utils.js.map +1 -1
- package/dist/src/plugin/model-registry.d.ts +1 -1
- package/dist/src/plugin/model-registry.js +1 -1
- package/dist/src/plugin/oauth-login.d.ts +22 -0
- package/dist/src/plugin/oauth-login.d.ts.map +1 -0
- package/dist/src/plugin/oauth-login.js +37 -0
- package/dist/src/plugin/oauth-login.js.map +1 -0
- package/dist/src/plugin/oauth-methods.d.ts +42 -0
- package/dist/src/plugin/oauth-methods.d.ts.map +1 -0
- package/dist/src/plugin/oauth-methods.js +1276 -0
- package/dist/src/plugin/oauth-methods.js.map +1 -0
- package/dist/src/plugin/operator-settings.d.ts +40 -0
- package/dist/src/plugin/operator-settings.d.ts.map +1 -0
- package/dist/src/plugin/operator-settings.js +148 -0
- package/dist/src/plugin/operator-settings.js.map +1 -0
- package/dist/src/plugin/persist-account-pool.d.ts +37 -0
- package/dist/src/plugin/persist-account-pool.d.ts.map +1 -0
- package/dist/src/plugin/persist-account-pool.js +142 -0
- package/dist/src/plugin/persist-account-pool.js.map +1 -0
- package/dist/src/plugin/project.d.ts +1 -1
- package/dist/src/plugin/project.js +1 -1
- package/dist/src/plugin/prompt-context.d.ts.map +1 -1
- package/dist/src/plugin/prompt-context.js +11 -11
- package/dist/src/plugin/prompt-context.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +138 -41
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +417 -285
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/recovery/constants.d.ts.map +1 -1
- package/dist/src/plugin/recovery/constants.js +24 -15
- package/dist/src/plugin/recovery/constants.js.map +1 -1
- package/dist/src/plugin/recovery/index.d.ts +3 -3
- package/dist/src/plugin/recovery/index.d.ts.map +1 -1
- package/dist/src/plugin/recovery/index.js +3 -3
- package/dist/src/plugin/recovery/index.js.map +1 -1
- package/dist/src/plugin/recovery/storage.d.ts +1 -1
- package/dist/src/plugin/recovery/storage.d.ts.map +1 -1
- package/dist/src/plugin/recovery/storage.js +31 -39
- package/dist/src/plugin/recovery/storage.js.map +1 -1
- package/dist/src/plugin/recovery/types.d.ts +12 -12
- package/dist/src/plugin/recovery/types.d.ts.map +1 -1
- package/dist/src/plugin/recovery.d.ts +3 -3
- package/dist/src/plugin/recovery.d.ts.map +1 -1
- package/dist/src/plugin/recovery.js +62 -58
- package/dist/src/plugin/recovery.js.map +1 -1
- package/dist/src/plugin/refresh-queue.d.ts +5 -2
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
- package/dist/src/plugin/refresh-queue.js +37 -15
- package/dist/src/plugin/refresh-queue.js.map +1 -1
- package/dist/src/plugin/request-helpers.d.ts +1 -1
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +451 -352
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts +7 -7
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +622 -384
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/rotation.d.ts +1 -168
- package/dist/src/plugin/rotation.d.ts.map +1 -1
- package/dist/src/plugin/rotation.js +1 -327
- package/dist/src/plugin/rotation.js.map +1 -1
- package/dist/src/plugin/search.d.ts.map +1 -1
- package/dist/src/plugin/search.js +39 -35
- package/dist/src/plugin/search.js.map +1 -1
- package/dist/src/plugin/server.d.ts +1 -1
- package/dist/src/plugin/server.d.ts.map +1 -1
- package/dist/src/plugin/server.js +42 -37
- package/dist/src/plugin/server.js.map +1 -1
- package/dist/src/plugin/session-context.d.ts +2 -1
- package/dist/src/plugin/session-context.d.ts.map +1 -1
- package/dist/src/plugin/session-context.js +11 -7
- package/dist/src/plugin/session-context.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +59 -120
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +140 -485
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/stores/signature-store.d.ts.map +1 -1
- package/dist/src/plugin/stores/signature-store.js.map +1 -1
- package/dist/src/plugin/thinking-recovery.d.ts.map +1 -1
- package/dist/src/plugin/thinking-recovery.js +35 -33
- package/dist/src/plugin/thinking-recovery.js.map +1 -1
- package/dist/src/plugin/token.d.ts +2 -2
- package/dist/src/plugin/token.d.ts.map +1 -1
- package/dist/src/plugin/token.js +30 -21
- package/dist/src/plugin/token.js.map +1 -1
- package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +1 -1
- package/dist/src/plugin/transform/cross-model-sanitizer.js +1 -1
- package/dist/src/plugin/transform/index.d.ts +1 -1
- package/dist/src/plugin/transform/index.js +1 -1
- package/dist/src/plugin/transform/model-resolver.d.ts +1 -1
- package/dist/src/plugin/transform/model-resolver.js +1 -1
- package/dist/src/plugin/transform/types.d.ts +1 -1
- package/dist/src/plugin/transform/types.js +1 -1
- package/dist/src/plugin/types.d.ts +25 -69
- package/dist/src/plugin/types.d.ts.map +1 -1
- package/dist/src/plugin/ui/ansi.d.ts.map +1 -1
- package/dist/src/plugin/ui/ansi.js.map +1 -1
- package/dist/src/plugin/ui/auth-menu.d.ts +1 -1
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
- package/dist/src/plugin/ui/auth-menu.js +84 -35
- package/dist/src/plugin/ui/auth-menu.js.map +1 -1
- package/dist/src/plugin/ui/confirm.d.ts.map +1 -1
- package/dist/src/plugin/ui/confirm.js.map +1 -1
- package/dist/src/plugin/ui/model-status.d.ts +3 -3
- package/dist/src/plugin/ui/model-status.d.ts.map +1 -1
- package/dist/src/plugin/ui/model-status.js +3 -3
- package/dist/src/plugin/ui/model-status.js.map +1 -1
- package/dist/src/plugin/ui/quota-status.d.ts +4 -4
- package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
- package/dist/src/plugin/ui/quota-status.js +49 -49
- package/dist/src/plugin/ui/quota-status.js.map +1 -1
- package/dist/src/plugin/ui/select.d.ts.map +1 -1
- package/dist/src/plugin/ui/select.js +22 -12
- package/dist/src/plugin/ui/select.js.map +1 -1
- package/dist/src/plugin/version.d.ts +1 -1
- package/dist/src/plugin/version.js +1 -1
- package/dist/src/rpc/notifications.d.ts +6 -0
- package/dist/src/rpc/notifications.d.ts.map +1 -0
- package/dist/src/rpc/notifications.js +46 -0
- package/dist/src/rpc/notifications.js.map +1 -0
- package/dist/src/rpc/port-file.d.ts +13 -0
- package/dist/src/rpc/port-file.d.ts.map +1 -0
- package/dist/src/rpc/port-file.js +109 -0
- package/dist/src/rpc/port-file.js.map +1 -0
- package/dist/src/rpc/protocol.d.ts +22 -0
- package/dist/src/rpc/protocol.d.ts.map +1 -0
- package/dist/src/rpc/protocol.js +1 -0
- package/dist/src/rpc/protocol.js.map +1 -0
- package/dist/src/rpc/rpc-client.d.ts +10 -0
- package/dist/src/rpc/rpc-client.d.ts.map +1 -0
- package/dist/src/rpc/rpc-client.js +58 -0
- package/dist/src/rpc/rpc-client.js.map +1 -0
- package/dist/src/rpc/rpc-dir.d.ts +4 -0
- package/dist/src/rpc/rpc-dir.d.ts.map +1 -0
- package/dist/src/rpc/rpc-dir.js +19 -0
- package/dist/src/rpc/rpc-dir.js.map +1 -0
- package/dist/src/rpc/rpc-server.d.ts +13 -0
- package/dist/src/rpc/rpc-server.d.ts.map +1 -0
- package/dist/src/rpc/rpc-server.js +231 -0
- package/dist/src/rpc/rpc-server.js.map +1 -0
- package/dist/src/sidebar-state.d.ts +357 -0
- package/dist/src/sidebar-state.d.ts.map +1 -0
- package/dist/src/sidebar-state.js +680 -0
- package/dist/src/sidebar-state.js.map +1 -0
- package/dist/src/tui/command-dialogs.d.ts +61 -0
- package/dist/src/tui/command-dialogs.d.ts.map +1 -0
- package/dist/src/tui/command-dialogs.js +595 -0
- package/dist/src/tui/command-dialogs.js.map +1 -0
- package/dist/src/tui/file-logger.d.ts +41 -0
- package/dist/src/tui/file-logger.d.ts.map +1 -0
- package/dist/src/tui/file-logger.js +114 -0
- package/dist/src/tui/file-logger.js.map +1 -0
- package/dist/src/tui-preferences.d.ts +40 -0
- package/dist/src/tui-preferences.d.ts.map +1 -0
- package/dist/src/tui-preferences.js +328 -0
- package/dist/src/tui-preferences.js.map +1 -0
- package/dist/src/tui.d.ts +68 -0
- package/dist/src/tui.d.ts.map +1 -0
- package/dist/src/tui.js +697 -0
- package/dist/src/tui.js.map +1 -0
- package/package.json +46 -22
- package/src/plugin/command-data.ts +931 -0
- package/src/rpc/port-file.ts +143 -0
- package/src/rpc/protocol.ts +31 -0
- package/src/rpc/rpc-client.ts +102 -0
- package/src/rpc/rpc-dir.ts +24 -0
- package/src/sidebar-state.ts +991 -0
- package/src/tui/command-dialogs.tsx +832 -0
- package/src/tui/entry.mjs +74 -0
- package/src/tui/file-logger.ts +145 -0
- package/src/tui-compiled/plugin/command-data.ts +931 -0
- package/src/tui-compiled/rpc/port-file.ts +143 -0
- package/src/tui-compiled/rpc/protocol.ts +31 -0
- package/src/tui-compiled/rpc/rpc-client.ts +102 -0
- package/src/tui-compiled/rpc/rpc-dir.ts +24 -0
- package/src/tui-compiled/sidebar-state.ts +991 -0
- package/src/tui-compiled/tui/command-dialogs.tsx +779 -0
- package/src/tui-compiled/tui/file-logger.ts +145 -0
- package/src/tui-compiled/tui-preferences.ts +416 -0
- package/src/tui-compiled/tui.tsx +1193 -0
- package/src/tui-preferences.ts +416 -0
- package/src/tui.tsx +1171 -0
- package/dist/src/plugin.d.ts +0 -48
- package/dist/src/plugin.d.ts.map +0 -1
- package/dist/src/plugin.js +0 -3311
- package/dist/src/plugin.js.map +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { parseOAuthCallbackInput } from './oauth-methods';
|
|
2
|
+
const OAUTH_PENDING_TTL_MS = 10 * 60 * 1_000;
|
|
3
|
+
const OAUTH_PENDING_CAP = 50;
|
|
4
|
+
export function createAccountCommandOAuthService(options) {
|
|
5
|
+
const pendingBySession = new Map();
|
|
6
|
+
const now = options.now ?? (() => Date.now());
|
|
7
|
+
const cleanupExpired = () => {
|
|
8
|
+
const current = now();
|
|
9
|
+
for (const [sessionId, entry] of pendingBySession) {
|
|
10
|
+
if (current - entry.createdAt > OAUTH_PENDING_TTL_MS) {
|
|
11
|
+
pendingBySession.delete(sessionId);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const takePending = (sessionId) => {
|
|
16
|
+
cleanupExpired();
|
|
17
|
+
const entry = pendingBySession.get(sessionId);
|
|
18
|
+
if (!entry || now() - entry.createdAt > OAUTH_PENDING_TTL_MS) {
|
|
19
|
+
pendingBySession.delete(sessionId);
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
// Consume the entry atomically with the take. A second concurrent
|
|
23
|
+
// `add-oauth-finish` call must observe "no pending entry" even
|
|
24
|
+
// before the first call's exchange completes — the previous
|
|
25
|
+
// peek-then-finally pattern allowed two finish() calls to both
|
|
26
|
+
// exchange and persist the same auth code.
|
|
27
|
+
pendingBySession.delete(sessionId);
|
|
28
|
+
return entry;
|
|
29
|
+
};
|
|
30
|
+
// Wrap listAccounts so a lock-contention or I/O failure in the error
|
|
31
|
+
// branches below does not replace the real OAuth failure text with a
|
|
32
|
+
// generic apply-error message. Mirrors the stage-4 guarded pattern.
|
|
33
|
+
const safeListAccounts = async () => {
|
|
34
|
+
try {
|
|
35
|
+
return await options.listAccounts();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
async start(sessionId) {
|
|
43
|
+
const authorization = await options.authorize();
|
|
44
|
+
const url = new URL(authorization.url);
|
|
45
|
+
const state = url.searchParams.get('state');
|
|
46
|
+
const redirectUri = url.searchParams.get('redirect_uri');
|
|
47
|
+
if (!state || !redirectUri) {
|
|
48
|
+
throw new Error('OAuth authorization URL is missing required state');
|
|
49
|
+
}
|
|
50
|
+
cleanupExpired();
|
|
51
|
+
if (pendingBySession.size >= OAUTH_PENDING_CAP) {
|
|
52
|
+
const oldest = [...pendingBySession.entries()].reduce((previous, current) => current[1].createdAt < previous[1].createdAt ? current : previous);
|
|
53
|
+
pendingBySession.delete(oldest[0]);
|
|
54
|
+
}
|
|
55
|
+
pendingBySession.set(sessionId, {
|
|
56
|
+
state,
|
|
57
|
+
verifier: authorization.verifier,
|
|
58
|
+
redirectUri,
|
|
59
|
+
createdAt: now(),
|
|
60
|
+
});
|
|
61
|
+
return { url: authorization.url, accounts: await safeListAccounts() };
|
|
62
|
+
},
|
|
63
|
+
async finish(sessionId, callbackInput, label) {
|
|
64
|
+
const pending = takePending(sessionId);
|
|
65
|
+
if (!pending) {
|
|
66
|
+
return {
|
|
67
|
+
text: 'OAuth session expired. Please start again.',
|
|
68
|
+
accounts: await safeListAccounts(),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// Stage 1: parse the callback URL/code. Failures here mean the
|
|
72
|
+
// user pasted a malformed callback — exchange has not started.
|
|
73
|
+
let callback;
|
|
74
|
+
try {
|
|
75
|
+
callback = parseOAuthCallbackInput(callbackInput, pending.state);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return {
|
|
79
|
+
text: 'OAuth authentication failed: could not parse the callback. Please start a new OAuth flow.',
|
|
80
|
+
accounts: await safeListAccounts(),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if ('error' in callback) {
|
|
84
|
+
return {
|
|
85
|
+
text: `OAuth authentication failed: ${callback.error}. Please start a new OAuth flow.`,
|
|
86
|
+
accounts: await safeListAccounts(),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Stage 2: exchange the auth code with Google. Failures here mean
|
|
90
|
+
// the network or token endpoint rejected the code — nothing has
|
|
91
|
+
// been persisted yet.
|
|
92
|
+
let result;
|
|
93
|
+
try {
|
|
94
|
+
result = await options.exchange(callback.code, callback.state);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return {
|
|
98
|
+
text: 'OAuth exchange failed due to a network error. Please start a new OAuth flow.',
|
|
99
|
+
accounts: await safeListAccounts(),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (result.type === 'failed') {
|
|
103
|
+
return {
|
|
104
|
+
text: 'OAuth authentication failed. Please start a new OAuth flow and try again.',
|
|
105
|
+
accounts: await safeListAccounts(),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// Stage 3: persist the new account to disk. A failure here means
|
|
109
|
+
// the account is NOT stored — surface the stage so the operator
|
|
110
|
+
// can retry without thinking the previous error already landed it.
|
|
111
|
+
const persisted = {
|
|
112
|
+
...result,
|
|
113
|
+
label: label || result.label,
|
|
114
|
+
};
|
|
115
|
+
try {
|
|
116
|
+
await options.persist(persisted);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return {
|
|
120
|
+
text: 'OAuth account could not be saved to disk. Please start a new OAuth flow.',
|
|
121
|
+
accounts: await safeListAccounts(),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
// Refresh the live AccountManager so routing sees the new account
|
|
125
|
+
// immediately instead of waiting for the next auth reload. Errors
|
|
126
|
+
// here are non-fatal — the on-disk write already landed.
|
|
127
|
+
try {
|
|
128
|
+
await options.onAfterPersist?.(persisted);
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// Best-effort refresh; swallow failures.
|
|
132
|
+
}
|
|
133
|
+
// Stage 4: re-list the account pool. If the post-persist read
|
|
134
|
+
// fails for any reason (lock contention, I/O) we still report the
|
|
135
|
+
// successful add — the dialog will refresh on its next open.
|
|
136
|
+
let accounts;
|
|
137
|
+
try {
|
|
138
|
+
accounts = await options.listAccounts();
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return {
|
|
142
|
+
text: 'OAuth account added.',
|
|
143
|
+
accounts: [],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
text: 'OAuth account added.',
|
|
148
|
+
accounts,
|
|
149
|
+
};
|
|
150
|
+
},
|
|
151
|
+
dispose() {
|
|
152
|
+
pendingBySession.clear();
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=account-command-oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-command-oauth.js","sourceRoot":"","sources":["../../../src/plugin/account-command-oauth.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AA8CzD,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAA;AAC5C,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAE5B,MAAM,UAAU,gCAAgC,CAC9C,OAA0C;IAE1C,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA6B,CAAA;IAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAE7C,MAAM,cAAc,GAAG,GAAS,EAAE;QAChC,MAAM,OAAO,GAAG,GAAG,EAAE,CAAA;QACrB,KAAK,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,gBAAgB,EAAE,CAAC;YAClD,IAAI,OAAO,GAAG,KAAK,CAAC,SAAS,GAAG,oBAAoB,EAAE,CAAC;gBACrD,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;YACpC,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IAED,MAAM,WAAW,GAAG,CAAC,SAAiB,EAAiC,EAAE;QACvE,cAAc,EAAE,CAAA;QAChB,MAAM,KAAK,GAAG,g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AO;oBACL,IAAI,EAAE,sBAAsB;oBAC5B,QAAQ,EAAE,EAAE;iBACb,CAAA;YACH,CAAC;YACD,OAAO;gBACL,IAAI,EAAE,sBAAsB;gBAC5B,QAAQ;aACT,CAAA;QACH,CAAC;QAED,OAAO;YACL,gBAAgB,CAAC,KAAK,EAAE,CAAA;QAC1B,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,259 +1,10 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export type RateLimitReason = "QUOTA_EXHAUSTED" | "RATE_LIMIT_EXCEEDED" | "MODEL_CAPACITY_EXHAUSTED" | "SERVER_ERROR" | "UNKNOWN";
|
|
9
|
-
export interface RateLimitBackoffResult {
|
|
10
|
-
backoffMs: number;
|
|
11
|
-
reason: RateLimitReason;
|
|
12
|
-
}
|
|
13
|
-
export declare function parseRateLimitReason(reason: string | undefined, message: string | undefined, status?: number): RateLimitReason;
|
|
14
|
-
export declare function calculateBackoffMs(reason: RateLimitReason, consecutiveFailures: number, retryAfterMs?: number | null): number;
|
|
15
|
-
export type BaseQuotaKey = "claude" | "gemini-antigravity" | "gemini-cli";
|
|
16
|
-
export type QuotaKey = BaseQuotaKey | `${BaseQuotaKey}:${string}`;
|
|
17
|
-
export interface ManagedAccount {
|
|
18
|
-
index: number;
|
|
19
|
-
email?: string;
|
|
20
|
-
addedAt: number;
|
|
21
|
-
lastUsed: number;
|
|
22
|
-
parts: RefreshParts;
|
|
23
|
-
access?: string;
|
|
24
|
-
expires?: number;
|
|
25
|
-
enabled: boolean;
|
|
26
|
-
rateLimitResetTimes: RateLimitStateV3;
|
|
27
|
-
lastSwitchReason?: "rate-limit" | "initial" | "rotation";
|
|
28
|
-
coolingDownUntil?: number;
|
|
29
|
-
cooldownReason?: CooldownReason;
|
|
30
|
-
touchedForQuota: Record<string, number>;
|
|
31
|
-
consecutiveFailures?: number;
|
|
32
|
-
/** Timestamp of last failure for TTL-based reset of consecutiveFailures */
|
|
33
|
-
lastFailureTime?: number;
|
|
34
|
-
/** Per-account device fingerprint for rate limit mitigation */
|
|
35
|
-
fingerprint?: import("./fingerprint").Fingerprint;
|
|
36
|
-
/** History of previous fingerprints for this account */
|
|
37
|
-
fingerprintHistory?: FingerprintVersion[];
|
|
38
|
-
/** Cached quota data from last checkAccountsQuota() call */
|
|
39
|
-
cachedQuota?: Partial<Record<QuotaGroup, QuotaGroupSummary>>;
|
|
40
|
-
cachedQuotaUpdatedAt?: number;
|
|
41
|
-
verificationRequired?: boolean;
|
|
42
|
-
verificationRequiredAt?: number;
|
|
43
|
-
verificationRequiredReason?: string;
|
|
44
|
-
verificationUrl?: string;
|
|
45
|
-
accountIneligible?: boolean;
|
|
46
|
-
accountIneligibleAt?: number;
|
|
47
|
-
accountIneligibleReason?: string;
|
|
48
|
-
eligibilityStateUpdatedAt?: number;
|
|
49
|
-
/** Daily request counts per model family */
|
|
50
|
-
dailyRequestCounts?: {
|
|
51
|
-
date: string;
|
|
52
|
-
claude: number;
|
|
53
|
-
gemini: number;
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Resolve the quota group for soft quota checks.
|
|
58
|
-
*
|
|
59
|
-
* When a model string is available, we can precisely determine the quota group.
|
|
60
|
-
* When model is null/undefined, we fall back based on family:
|
|
61
|
-
* - Claude → "claude" quota group
|
|
62
|
-
* - Gemini → "gemini-pro" (conservative fallback; may misclassify flash models)
|
|
63
|
-
*
|
|
64
|
-
* @param family - The model family ("claude" | "gemini")
|
|
65
|
-
* @param model - Optional model string for precise resolution
|
|
66
|
-
* @returns The QuotaGroup to use for soft quota checks
|
|
67
|
-
*/
|
|
68
|
-
export declare function resolveQuotaGroup(family: ModelFamily, model?: string | null): QuotaGroup;
|
|
69
|
-
export declare function computeSoftQuotaCacheTtlMs(ttlConfig: "auto" | number, refreshIntervalMinutes: number): number;
|
|
70
|
-
export interface AccountSessionIdentity {
|
|
71
|
-
id: string;
|
|
72
|
-
parentId?: string | null;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* In-memory multi-account manager with sticky account selection.
|
|
76
|
-
*
|
|
77
|
-
* Uses the same account until it hits a rate limit (429), then switches.
|
|
78
|
-
* Rate limits are tracked per-model-family (claude/gemini) so an account
|
|
79
|
-
* rate-limited for Claude can still be used for Gemini.
|
|
80
|
-
*
|
|
81
|
-
* Source of truth for the pool is `antigravity-accounts.json`.
|
|
82
|
-
*/
|
|
83
|
-
export declare class AccountManager {
|
|
84
|
-
private accounts;
|
|
85
|
-
private cursorByFamily;
|
|
86
|
-
private currentAccountIndexByFamily;
|
|
87
|
-
private sessionOffsetApplied;
|
|
88
|
-
private lastToastAccountIndex;
|
|
89
|
-
private lastToastTime;
|
|
90
|
-
private savePending;
|
|
91
|
-
private saveTimeout;
|
|
92
|
-
private savePromiseResolvers;
|
|
93
|
-
private sessionStartTime;
|
|
94
|
-
private sessionRequestCounts;
|
|
95
|
-
private sessionUsedAccounts;
|
|
96
|
-
private requestSessionStates;
|
|
1
|
+
import { type AccountManagerOptions, AccountManager as CoreAccountManager } from '@cortexkit/antigravity-auth-core';
|
|
2
|
+
import { loadAccounts } from './storage';
|
|
3
|
+
import type { OAuthAuthDetails } from './types';
|
|
4
|
+
export type { AccountModelFamily as ModelFamily, AccountSessionIdentity, CooldownReason, HeaderStyle, ManagedAccount, RateLimitReason, } from '@cortexkit/antigravity-auth-core';
|
|
5
|
+
export { calculateBackoffMs, computeSoftQuotaCacheTtlMs, parseRateLimitReason, resolveQuotaGroup, } from '@cortexkit/antigravity-auth-core';
|
|
6
|
+
export declare class AccountManager extends CoreAccountManager {
|
|
7
|
+
constructor(authFallback?: OAuthAuthDetails, stored?: Awaited<ReturnType<typeof loadAccounts>>, options?: Partial<AccountManagerOptions>);
|
|
97
8
|
static loadFromDisk(authFallback?: OAuthAuthDetails): Promise<AccountManager>;
|
|
98
|
-
constructor(authFallback?: OAuthAuthDetails, stored?: AccountStorageV4 | null);
|
|
99
|
-
getAccountCount(): number;
|
|
100
|
-
getTotalAccountCount(): number;
|
|
101
|
-
getEnabledAccounts(): ManagedAccount[];
|
|
102
|
-
private getEffectiveSoftQuotaThreshold;
|
|
103
|
-
getAccountsSnapshot(): ManagedAccount[];
|
|
104
|
-
private getRequestSessionState;
|
|
105
|
-
private pruneRequestSessionStates;
|
|
106
|
-
private getActiveIndex;
|
|
107
|
-
private setActiveIndex;
|
|
108
|
-
private getCursor;
|
|
109
|
-
private advanceCursor;
|
|
110
|
-
private getUsedAccounts;
|
|
111
|
-
private preferAccountOutsideParent;
|
|
112
|
-
deleteSessionState(sessionId: string): void;
|
|
113
|
-
getCurrentAccountForFamily(family: ModelFamily, identity?: AccountSessionIdentity): ManagedAccount | null;
|
|
114
|
-
markSwitched(account: ManagedAccount, reason: "rate-limit" | "initial" | "rotation", family: ModelFamily, identity?: AccountSessionIdentity): void;
|
|
115
|
-
/**
|
|
116
|
-
* Check if we should show an account switch toast.
|
|
117
|
-
* Debounces repeated toasts for the same account.
|
|
118
|
-
*/
|
|
119
|
-
shouldShowAccountToast(accountIndex: number, debounceMs?: number): boolean;
|
|
120
|
-
markToastShown(accountIndex: number): void;
|
|
121
|
-
getCurrentOrNextForFamily(family: ModelFamily, model?: string | null, strategy?: AccountSelectionStrategy, headerStyle?: HeaderStyle, pidOffsetEnabled?: boolean, softQuotaThresholdPercent?: number, softQuotaCacheTtlMs?: number, identity?: AccountSessionIdentity): ManagedAccount | null;
|
|
122
|
-
getNextForFamily(family: ModelFamily, model?: string | null, headerStyle?: HeaderStyle, softQuotaThresholdPercent?: number, softQuotaCacheTtlMs?: number, identity?: AccountSessionIdentity): ManagedAccount | null;
|
|
123
|
-
markRateLimited(account: ManagedAccount, retryAfterMs: number, family: ModelFamily, headerStyle?: HeaderStyle, model?: string | null): void;
|
|
124
|
-
/**
|
|
125
|
-
* Mark an account as used after a successful API request.
|
|
126
|
-
* This updates the lastUsed timestamp for freshness calculations.
|
|
127
|
-
* Should be called AFTER request completion, not during account selection.
|
|
128
|
-
*/
|
|
129
|
-
markAccountUsed(accountIndex: number): void;
|
|
130
|
-
recordSessionUsage(accountIndex: number, identity?: AccountSessionIdentity): void;
|
|
131
|
-
wasUsedInSession(accountIndex: number, identity?: AccountSessionIdentity): boolean;
|
|
132
|
-
shouldProactivelyRotate(family: ModelFamily, model: string | null | undefined, thresholdPercent: number, cacheTtlMs: number, identity?: AccountSessionIdentity): boolean;
|
|
133
|
-
proactivelyRotateForFamily(family: ModelFamily, model: string | null | undefined, headerStyle: HeaderStyle, softQuotaThresholdPercent: number, softQuotaCacheTtlMs: number, identity?: AccountSessionIdentity): ManagedAccount | null;
|
|
134
|
-
markRateLimitedWithReason(account: ManagedAccount, family: ModelFamily, headerStyle: HeaderStyle, model: string | null | undefined, reason: RateLimitReason, retryAfterMs?: number | null, failureTtlMs?: number): number;
|
|
135
|
-
markRequestSuccess(account: ManagedAccount): void;
|
|
136
|
-
clearAllRateLimitsForFamily(family: ModelFamily, model?: string | null): void;
|
|
137
|
-
shouldTryOptimisticReset(family: ModelFamily, model?: string | null): boolean;
|
|
138
|
-
markAccountCoolingDown(account: ManagedAccount, cooldownMs: number, reason: CooldownReason): void;
|
|
139
|
-
isAccountCoolingDown(account: ManagedAccount): boolean;
|
|
140
|
-
clearAccountCooldown(account: ManagedAccount): void;
|
|
141
|
-
getAccountCooldownReason(account: ManagedAccount): CooldownReason | undefined;
|
|
142
|
-
markTouchedForQuota(account: ManagedAccount, quotaKey: string): void;
|
|
143
|
-
isFreshForQuota(account: ManagedAccount, quotaKey: string): boolean;
|
|
144
|
-
getFreshAccountsForQuota(quotaKey: string, family: ModelFamily, model?: string | null): ManagedAccount[];
|
|
145
|
-
isRateLimitedForHeaderStyle(account: ManagedAccount, family: ModelFamily, headerStyle: HeaderStyle, model?: string | null): boolean;
|
|
146
|
-
getAvailableHeaderStyle(account: ManagedAccount, family: ModelFamily, model?: string | null): HeaderStyle | null;
|
|
147
|
-
/**
|
|
148
|
-
* Check if any OTHER account has antigravity quota available for the given family/model.
|
|
149
|
-
*
|
|
150
|
-
* Used to determine whether to switch accounts vs fall back to gemini-cli:
|
|
151
|
-
* - If true: Switch to another account (preserve antigravity priority)
|
|
152
|
-
* - If false: All accounts exhausted antigravity, safe to fall back to gemini-cli
|
|
153
|
-
*
|
|
154
|
-
* @param currentAccountIndex - Index of the current account (will be excluded from check)
|
|
155
|
-
* @param family - Model family ("gemini" or "claude")
|
|
156
|
-
* @param model - Optional model name for model-specific rate limits
|
|
157
|
-
* @returns true if any other enabled, non-cooling-down account has antigravity available
|
|
158
|
-
*/
|
|
159
|
-
hasOtherAccountWithAntigravityAvailable(currentAccountIndex: number, family: ModelFamily, model?: string | null): boolean;
|
|
160
|
-
setAccountEnabled(accountIndex: number, enabled: boolean): boolean;
|
|
161
|
-
markAccountVerificationRequired(accountIndex: number, reason?: string, verifyUrl?: string): boolean;
|
|
162
|
-
markAccountIneligible(accountIndex: number, reason?: string): boolean;
|
|
163
|
-
clearAccountAccessBlocks(accountIndex: number, enableAccount?: boolean): boolean;
|
|
164
|
-
removeAccountByIndex(accountIndex: number): boolean;
|
|
165
|
-
removeAccount(account: ManagedAccount): boolean;
|
|
166
|
-
updateFromAuth(account: ManagedAccount, auth: OAuthAuthDetails): void;
|
|
167
|
-
toAuthDetails(account: ManagedAccount): OAuthAuthDetails;
|
|
168
|
-
getMinWaitTimeForFamily(family: ModelFamily, model?: string | null, headerStyle?: HeaderStyle, strict?: boolean): number;
|
|
169
|
-
getAccounts(): ManagedAccount[];
|
|
170
|
-
private buildStorageSnapshot;
|
|
171
|
-
saveToDisk(): Promise<void>;
|
|
172
|
-
/**
|
|
173
|
-
* Persist via full-file replace (no merge). Required after destructive
|
|
174
|
-
* operations (account removal) so a deleted account is not resurrected by
|
|
175
|
-
* mergeAccountStorage re-reading it from disk.
|
|
176
|
-
*/
|
|
177
|
-
saveToDiskReplace(): Promise<void>;
|
|
178
|
-
requestSaveToDisk(): void;
|
|
179
|
-
flushSaveToDisk(): Promise<void>;
|
|
180
|
-
private executeSave;
|
|
181
|
-
/**
|
|
182
|
-
* Regenerate fingerprint for an account, saving the old one to history.
|
|
183
|
-
* @param accountIndex - Index of the account to regenerate fingerprint for
|
|
184
|
-
* @returns The new fingerprint, or null if account not found
|
|
185
|
-
*/
|
|
186
|
-
regenerateAccountFingerprint(accountIndex: number): Fingerprint | null;
|
|
187
|
-
/**
|
|
188
|
-
* Restore a fingerprint from history for an account.
|
|
189
|
-
* @param accountIndex - Index of the account
|
|
190
|
-
* @param historyIndex - Index in the fingerprint history to restore from (0 = most recent)
|
|
191
|
-
* @returns The restored fingerprint, or null if account/history not found
|
|
192
|
-
*/
|
|
193
|
-
restoreAccountFingerprint(accountIndex: number, historyIndex: number): Fingerprint | null;
|
|
194
|
-
/**
|
|
195
|
-
* Get fingerprint history for an account.
|
|
196
|
-
* @param accountIndex - Index of the account
|
|
197
|
-
* @returns Array of fingerprint versions, or empty array if not found
|
|
198
|
-
*/
|
|
199
|
-
getAccountFingerprintHistory(accountIndex: number): FingerprintVersion[];
|
|
200
|
-
updateQuotaCache(accountIndex: number, quotaGroups: Partial<Record<QuotaGroup, QuotaGroupSummary>>): void;
|
|
201
|
-
/**
|
|
202
|
-
* Record a successful API request for an account.
|
|
203
|
-
* Tracks per model family with daily reset.
|
|
204
|
-
*/
|
|
205
|
-
recordRequest(accountIndex: number, family: ModelFamily): void;
|
|
206
|
-
/**
|
|
207
|
-
* Get request counts for an account for today.
|
|
208
|
-
*/
|
|
209
|
-
getDailyRequestCounts(accountIndex: number): {
|
|
210
|
-
date: string;
|
|
211
|
-
claude: number;
|
|
212
|
-
gemini: number;
|
|
213
|
-
} | null;
|
|
214
|
-
/**
|
|
215
|
-
* Get total daily request counts across all accounts for a model family.
|
|
216
|
-
*/
|
|
217
|
-
getTotalDailyRequests(family: ModelFamily): number;
|
|
218
|
-
/**
|
|
219
|
-
* Get a summary of daily request distribution across accounts.
|
|
220
|
-
* Returns accounts sorted by request count (descending).
|
|
221
|
-
*/
|
|
222
|
-
getDailyRequestSummary(family: ModelFamily): Array<{
|
|
223
|
-
index: number;
|
|
224
|
-
email?: string;
|
|
225
|
-
count: number;
|
|
226
|
-
}>;
|
|
227
|
-
/**
|
|
228
|
-
* Record a request for the current session (in-memory only).
|
|
229
|
-
*/
|
|
230
|
-
recordSessionRequest(accountIndex: number, family: ModelFamily): void;
|
|
231
|
-
/**
|
|
232
|
-
* Get a summary of the current session's request usage.
|
|
233
|
-
*/
|
|
234
|
-
getSessionSummary(): {
|
|
235
|
-
durationMinutes: number;
|
|
236
|
-
totalClaude: number;
|
|
237
|
-
totalGemini: number;
|
|
238
|
-
requestsPerHour: number;
|
|
239
|
-
accountsUsed: number;
|
|
240
|
-
perAccount: Array<{
|
|
241
|
-
index: number;
|
|
242
|
-
email?: string;
|
|
243
|
-
claude: number;
|
|
244
|
-
gemini: number;
|
|
245
|
-
}>;
|
|
246
|
-
};
|
|
247
|
-
isAccountOverSoftQuota(account: ManagedAccount, family: ModelFamily, thresholdPercent: number, cacheTtlMs: number, model?: string | null): boolean;
|
|
248
|
-
getAccountsForQuotaCheck(): AccountMetadataV3[];
|
|
249
|
-
getOldestQuotaCacheAge(): number | null;
|
|
250
|
-
areAllAccountsOverSoftQuota(family: ModelFamily, thresholdPercent: number, cacheTtlMs: number, model?: string | null): boolean;
|
|
251
|
-
/**
|
|
252
|
-
* Get minimum wait time until any account's soft quota resets.
|
|
253
|
-
* Returns 0 if any account is available (not over threshold).
|
|
254
|
-
* Returns the minimum resetTime across all over-threshold accounts.
|
|
255
|
-
* Returns null if no resetTime data is available.
|
|
256
|
-
*/
|
|
257
|
-
getMinWaitTimeForSoftQuota(family: ModelFamily, thresholdPercent: number, cacheTtlMs: number, model?: string | null): number | null;
|
|
258
9
|
}
|
|
259
10
|
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/plugin/accounts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/plugin/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,cAAc,IAAI,kBAAkB,EACrC,MAAM,kCAAkC,CAAA;AAGzC,OAAO,EAEL,YAAY,EAGb,MAAM,WAAW,CAAA;AAClB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,YAAY,EACV,kBAAkB,IAAI,WAAW,EACjC,sBAAsB,EACtB,cAAc,EACd,WAAW,EACX,cAAc,EACd,eAAe,GAChB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,kCAAkC,CAAA;AAqBzC,qBAAa,cAAe,SAAQ,kBAAkB;gBAElD,YAAY,CAAC,EAAE,gBAAgB,EAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,EACjD,OAAO,GAAE,OAAO,CAAC,qBAAqB,CAAM;WAiBjC,YAAY,CACvB,YAAY,CAAC,EAAE,gBAAgB,GAC9B,OAAO,CAAC,cAAc,CAAC;CAG3B"}
|