@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,517 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Privacy-safe data service for the data-first slash-command dialogs.
|
|
3
|
+
*
|
|
4
|
+
* `/antigravity-quota` (this task) and the future `/antigravity-account`
|
|
5
|
+
* dialogs (Tasks 10-11) read from a single shared service so they
|
|
6
|
+
* never touch raw account storage, never see the email PII field, and
|
|
7
|
+
* never run quota network I/O during the dialog's open path — the
|
|
8
|
+
* Refresh action is the only path that performs a live fetch.
|
|
9
|
+
*
|
|
10
|
+
* Why this is a separate module:
|
|
11
|
+
*
|
|
12
|
+
* - `commands.ts` owns the slash-command orchestration; mixing the row
|
|
13
|
+
* projection + quota refresh logic in there would balloon the surface
|
|
14
|
+
* for what is fundamentally a small read/refresh service.
|
|
15
|
+
* - The row type (`CommandAccountRow`) is the projection that crosses
|
|
16
|
+
* the PII firewall into the dialog payload. Defining it here (next
|
|
17
|
+
* to the code that constructs it) keeps the firewall reviewable.
|
|
18
|
+
* - Tests can pin the read-vs-refresh boundary, the email redaction, and
|
|
19
|
+
* the refresh-token-keyed persistence in one file rather than chasing
|
|
20
|
+
* them across the dispatcher + RPC + apply layers.
|
|
21
|
+
*
|
|
22
|
+
* Cache-only opening contract (Task 9 operator requirement):
|
|
23
|
+
*
|
|
24
|
+
* `listAccounts()` is a pure read of the live AccountManager view
|
|
25
|
+
* the auth-loader materialized at session start. It performs
|
|
26
|
+
* ZERO quota manager calls — opening the dialog must be instant even
|
|
27
|
+
* when the network is unreachable, and quota refresh must remain an
|
|
28
|
+
* explicit user-driven action so the cached percentages never quietly
|
|
29
|
+
* rewrite themselves behind the user's back.
|
|
30
|
+
*
|
|
31
|
+
* Refresh-token-keyed persistence (Task 9 plan trap):
|
|
32
|
+
*
|
|
33
|
+
* `refreshQuota()` runs the shared quota manager across every enabled
|
|
34
|
+
* account and folds the results back into the live AccountManager +
|
|
35
|
+
* storage. Concurrent OAuth can renumber the flat `accounts[]` array
|
|
36
|
+
* between read and write, so we re-read under the lock and key the
|
|
37
|
+
* update by `refreshToken` (the canonical identity) rather than the
|
|
38
|
+
* array index. This way a successful OAuth add that lands between
|
|
39
|
+
* the read and the write cannot cause the refresh to overwrite the
|
|
40
|
+
* wrong account.
|
|
41
|
+
*/
|
|
42
|
+
import { createHash } from 'node:crypto';
|
|
43
|
+
import { buildSidebarMachineStateFromAccounts, normalizeLegacyCachedQuota, setSidebarMachineState, toCapturedTier, } from '../sidebar-state';
|
|
44
|
+
/**
|
|
45
|
+
* Quota display label for each supported quota group. Kept here so the
|
|
46
|
+
* dialog and the quota manager agree on the same vocabulary.
|
|
47
|
+
*/
|
|
48
|
+
const QUOTA_GROUP_LABELS = {
|
|
49
|
+
gemini: 'Gemini',
|
|
50
|
+
'non-gemini': 'Non-Gemini',
|
|
51
|
+
};
|
|
52
|
+
const SUPPORTED_QUOTA_KEYS = [
|
|
53
|
+
'gemini',
|
|
54
|
+
'non-gemini',
|
|
55
|
+
];
|
|
56
|
+
function toCommandAccountRow(entry) {
|
|
57
|
+
// Stamp mismatch: the cached quota was captured for a different account
|
|
58
|
+
// (the refresh token changed, or an index shift placed another account's
|
|
59
|
+
// snapshot at this position). Drop the stale cache rather than rendering
|
|
60
|
+
// the wrong account's quota percentages.
|
|
61
|
+
const rawCached = entry.cachedQuotaAccountId &&
|
|
62
|
+
entry.cachedQuotaAccountId !== quotaAccountIdentity(entry.refreshToken)
|
|
63
|
+
? undefined
|
|
64
|
+
: entry.cachedQuota;
|
|
65
|
+
// Normalize legacy pool keys (gemini-pro, gemini-flash, claude, gpt-oss)
|
|
66
|
+
// to canonical keys before the SUPPORTED_QUOTA_KEYS loop. Without this
|
|
67
|
+
// a legacy snapshot produces empty quota rows, and writeSidebar would
|
|
68
|
+
// permanently re-emit legacy keys on every dialog open until the next
|
|
69
|
+
// real quota refresh rewrites the on-disk snapshot.
|
|
70
|
+
const cached = normalizeLegacyCachedQuota(rawCached);
|
|
71
|
+
const quota = [];
|
|
72
|
+
for (const key of SUPPORTED_QUOTA_KEYS) {
|
|
73
|
+
const cachedEntry = cached?.[key];
|
|
74
|
+
if (!cachedEntry)
|
|
75
|
+
continue;
|
|
76
|
+
const fraction = cachedEntry.remainingFraction;
|
|
77
|
+
const remainingPercent = typeof fraction === 'number' && Number.isFinite(fraction)
|
|
78
|
+
? Math.round(fraction * 100)
|
|
79
|
+
: null;
|
|
80
|
+
let resetAt;
|
|
81
|
+
if (typeof cachedEntry.resetTime === 'string' &&
|
|
82
|
+
cachedEntry.resetTime.length > 0) {
|
|
83
|
+
const parsed = Date.parse(cachedEntry.resetTime);
|
|
84
|
+
if (Number.isFinite(parsed))
|
|
85
|
+
resetAt = parsed;
|
|
86
|
+
}
|
|
87
|
+
// Carry per-window breakdown when the cache was populated from the
|
|
88
|
+
// windowed RUQS path — the sidebar writer projects through here.
|
|
89
|
+
const windows = cachedEntry.windows?.length
|
|
90
|
+
? cachedEntry.windows.map((w) => ({
|
|
91
|
+
window: w.window,
|
|
92
|
+
remainingPercent: Math.round(w.remainingFraction * 100),
|
|
93
|
+
resetAt: typeof w.resetTime === 'string' && w.resetTime.length > 0
|
|
94
|
+
? (() => {
|
|
95
|
+
const parsed = Date.parse(w.resetTime);
|
|
96
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
97
|
+
})()
|
|
98
|
+
: undefined,
|
|
99
|
+
}))
|
|
100
|
+
: undefined;
|
|
101
|
+
quota.push({
|
|
102
|
+
key,
|
|
103
|
+
label: QUOTA_GROUP_LABELS[key],
|
|
104
|
+
remainingPercent,
|
|
105
|
+
resetAt,
|
|
106
|
+
windows,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const label = `Account ${entry.index + 1}`;
|
|
110
|
+
return {
|
|
111
|
+
id: `acct-${entry.index}`,
|
|
112
|
+
index: entry.index,
|
|
113
|
+
label,
|
|
114
|
+
enabled: entry.enabled,
|
|
115
|
+
current: entry.active,
|
|
116
|
+
coolingDownUntil: entry.coolingDownUntil,
|
|
117
|
+
healthScore: entry.healthScore,
|
|
118
|
+
quota,
|
|
119
|
+
tier: toCapturedTier(entry),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Opaque identity derived from a refresh token. Antigravity refresh tokens
|
|
124
|
+
* are stable (they do not rotate), so this hash is a durable, prunable
|
|
125
|
+
* identity to detect a stale cached quota after an account-index shift.
|
|
126
|
+
*/
|
|
127
|
+
function quotaAccountIdentity(refreshToken) {
|
|
128
|
+
return createHash('sha256').update(refreshToken).digest('hex').slice(0, 16);
|
|
129
|
+
}
|
|
130
|
+
export function projectCommandAccountRows(storage) {
|
|
131
|
+
if (!storage)
|
|
132
|
+
return [];
|
|
133
|
+
const activeIndex = storage.activeIndexByFamily?.claude ?? storage.activeIndex;
|
|
134
|
+
return storage.accounts.map((entry, index) => toCommandAccountRow({
|
|
135
|
+
index,
|
|
136
|
+
refreshToken: entry.refreshToken,
|
|
137
|
+
label: entry.label,
|
|
138
|
+
enabled: entry.enabled !== false,
|
|
139
|
+
active: index === activeIndex,
|
|
140
|
+
cachedQuota: entry.cachedQuota,
|
|
141
|
+
cachedQuotaUpdatedAt: entry.cachedQuotaUpdatedAt,
|
|
142
|
+
cachedQuotaAccountId: entry.cachedQuotaAccountId,
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Build the data service.
|
|
147
|
+
*
|
|
148
|
+
* The factory form (instead of a module-level singleton) keeps the
|
|
149
|
+
* service unit-testable: each test constructs its own dependencies
|
|
150
|
+
* (storage stub, quota manager stub, fixed clock) without touching
|
|
151
|
+
* the production quota path.
|
|
152
|
+
*/
|
|
153
|
+
export function createCommandDataService(options) {
|
|
154
|
+
const { accountManagerView, quotaManager, sidebarStateFile, storage, now = () => Date.now(), } = options;
|
|
155
|
+
const projectRows = () => accountManagerView.getAccounts().map(toCommandAccountRow);
|
|
156
|
+
// Map a CommandAccountRow back to the SidebarAccountRedactionInput shape.
|
|
157
|
+
// Extracted to prevent the "sixth dropped field" pattern: every field in
|
|
158
|
+
// CommandAccountRow that must reach the sidebar lives here once, not as an
|
|
159
|
+
// inline literal that a future author has to remember to update in two places.
|
|
160
|
+
const toRedactionInput = (row) => {
|
|
161
|
+
const gemini = row.quota.find((q) => q.key === 'gemini');
|
|
162
|
+
const nonGemini = row.quota.find((q) => q.key === 'non-gemini');
|
|
163
|
+
// Map a CommandAccountRow quota entry to cachedQuota pool shape
|
|
164
|
+
// so projectQuotaPoolForSidebar (the canonical projection seam)
|
|
165
|
+
// carries the per-window breakdown into the sidebar state.
|
|
166
|
+
const toPool = (q) => {
|
|
167
|
+
if (!q || q.remainingPercent == null)
|
|
168
|
+
return undefined;
|
|
169
|
+
return {
|
|
170
|
+
remainingFraction: q.remainingPercent / 100,
|
|
171
|
+
resetTime: typeof q.resetAt === 'number' && Number.isFinite(q.resetAt)
|
|
172
|
+
? new Date(q.resetAt).toISOString()
|
|
173
|
+
: undefined,
|
|
174
|
+
windows: q.windows?.map((w) => ({
|
|
175
|
+
window: w.window,
|
|
176
|
+
remainingFraction: w.remainingPercent / 100,
|
|
177
|
+
resetTime: typeof w.resetAt === 'number' && Number.isFinite(w.resetAt)
|
|
178
|
+
? new Date(w.resetAt).toISOString()
|
|
179
|
+
: '',
|
|
180
|
+
})),
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
return {
|
|
184
|
+
index: row.index,
|
|
185
|
+
label: row.label,
|
|
186
|
+
enabled: row.enabled,
|
|
187
|
+
current: row.current,
|
|
188
|
+
healthScore: row.healthScore,
|
|
189
|
+
// Tier passes the redaction boundary unchanged (plan metadata, not PII).
|
|
190
|
+
// The stamp check was already done by toCommandAccountRow.
|
|
191
|
+
tier: row.tier,
|
|
192
|
+
cachedQuota: {
|
|
193
|
+
gemini: toPool(gemini),
|
|
194
|
+
'non-gemini': toPool(nonGemini),
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
const writeSidebar = (rows) => {
|
|
199
|
+
const accounts = rows.map(toRedactionInput);
|
|
200
|
+
// Fire-and-forget -- the sidebar writer is fenced by its own queue,
|
|
201
|
+
// so a transient lock contention cannot block the dialog response.
|
|
202
|
+
void setSidebarMachineState(buildSidebarMachineStateFromAccounts(accounts, { checkedAt: now() }), { stateFile: sidebarStateFile }).catch(() => {
|
|
203
|
+
// Sidebar writes are best-effort; the next command or quota refresh
|
|
204
|
+
// will publish the current snapshot.
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
return {
|
|
208
|
+
async listAccounts() {
|
|
209
|
+
return projectRows();
|
|
210
|
+
},
|
|
211
|
+
async refreshQuota() {
|
|
212
|
+
const accountsForQuota = accountManagerView.getAccountsForQuotaCheck();
|
|
213
|
+
if (accountsForQuota.length === 0) {
|
|
214
|
+
// Empty pool: still push a clean sidebar so the TUI drops any
|
|
215
|
+
// stale snapshot left over from a previous session.
|
|
216
|
+
writeSidebar([]);
|
|
217
|
+
return [];
|
|
218
|
+
}
|
|
219
|
+
const results = await quotaManager.refreshAccounts(accountsForQuota, {
|
|
220
|
+
indexFor: (account) => accountsForQuota.indexOf(account),
|
|
221
|
+
force: true,
|
|
222
|
+
});
|
|
223
|
+
const refreshedAt = now();
|
|
224
|
+
const updates = [];
|
|
225
|
+
for (const result of results) {
|
|
226
|
+
const refreshToken = result.updatedAccount?.refreshToken ??
|
|
227
|
+
accountsForQuota[result.index]?.refreshToken;
|
|
228
|
+
if (!refreshToken)
|
|
229
|
+
continue;
|
|
230
|
+
const groups = result.status === 'ok' && result.quota?.groups
|
|
231
|
+
? result.quota.groups
|
|
232
|
+
: undefined;
|
|
233
|
+
updates.push({ refreshToken, groups });
|
|
234
|
+
}
|
|
235
|
+
// Resolve live indexes only after the network request. Numeric indexes
|
|
236
|
+
// from the quota result refer to the original input array and may now
|
|
237
|
+
// identify a different account after a concurrent add/remove.
|
|
238
|
+
const liveIndexByRefreshToken = new Map();
|
|
239
|
+
for (const entry of accountManagerView.getAccounts()) {
|
|
240
|
+
liveIndexByRefreshToken.set(entry.refreshToken, entry.index);
|
|
241
|
+
}
|
|
242
|
+
let liveQuotaChanged = false;
|
|
243
|
+
for (const update of updates) {
|
|
244
|
+
const liveIndex = liveIndexByRefreshToken.get(update.refreshToken);
|
|
245
|
+
if (liveIndex === undefined || !update.groups)
|
|
246
|
+
continue;
|
|
247
|
+
accountManagerView.updateQuotaCache(liveIndex, update.groups, update.refreshToken);
|
|
248
|
+
liveQuotaChanged = true;
|
|
249
|
+
}
|
|
250
|
+
if (liveQuotaChanged)
|
|
251
|
+
accountManagerView.requestSaveToDisk();
|
|
252
|
+
// Persist by canonical refresh token against the latest locked snapshot.
|
|
253
|
+
// A removed account is skipped rather than falling back to its old index.
|
|
254
|
+
if (storage) {
|
|
255
|
+
const updateByRefreshToken = new Map(updates.map((update) => [update.refreshToken, update]));
|
|
256
|
+
const writeResult = storage.mutate((current) => ({
|
|
257
|
+
...current,
|
|
258
|
+
accounts: current.accounts.map((entry) => {
|
|
259
|
+
const update = updateByRefreshToken.get(entry.refreshToken);
|
|
260
|
+
if (!update)
|
|
261
|
+
return entry;
|
|
262
|
+
if (update.groups) {
|
|
263
|
+
return {
|
|
264
|
+
...entry,
|
|
265
|
+
cachedQuota: update.groups,
|
|
266
|
+
// Stamp the persisted quota with an opaque identity derived
|
|
267
|
+
// from the refresh token so a later projection can detect
|
|
268
|
+
// a stale snapshot after an account-index shift.
|
|
269
|
+
cachedQuotaAccountId: quotaAccountIdentity(entry.refreshToken),
|
|
270
|
+
cachedQuotaUpdatedAt: refreshedAt,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
// Error result keeps the previous cached percentage and only
|
|
274
|
+
// records that a refresh was attempted.
|
|
275
|
+
return {
|
|
276
|
+
...entry,
|
|
277
|
+
cachedQuotaUpdatedAt: refreshedAt,
|
|
278
|
+
};
|
|
279
|
+
}),
|
|
280
|
+
}));
|
|
281
|
+
await Promise.resolve(writeResult).catch(() => {
|
|
282
|
+
// The live AccountManager already carries successful refreshes; its
|
|
283
|
+
// next save can reconcile a transient storage-lock failure.
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
// Re-read the live view post-mutate so the rows reflect the
|
|
287
|
+
// freshly persisted percentages.
|
|
288
|
+
const rows = projectRows();
|
|
289
|
+
writeSidebar(rows);
|
|
290
|
+
return rows;
|
|
291
|
+
},
|
|
292
|
+
async refreshQuotaRespectingBackoff() {
|
|
293
|
+
const accountsForQuota = accountManagerView.getAccountsForQuotaCheck();
|
|
294
|
+
if (accountsForQuota.length === 0)
|
|
295
|
+
return;
|
|
296
|
+
// Non-forced: the quota manager's per-account backoff and dedup
|
|
297
|
+
// apply. Accounts that are fresh or in backoff are skipped. Unlike
|
|
298
|
+
// the earlier fire-and-forget path, successful results ARE folded
|
|
299
|
+
// into the live cache so the sidebar snapshot reflects fresh data
|
|
300
|
+
// immediately — the dialog renders ONLY from the sidebar file, and
|
|
301
|
+
// the quota manager's push path does not update AccountManager
|
|
302
|
+
// entries for this caller.
|
|
303
|
+
let results;
|
|
304
|
+
try {
|
|
305
|
+
results = await quotaManager.refreshAccounts(accountsForQuota, {
|
|
306
|
+
indexFor: (account) => accountsForQuota.indexOf(account),
|
|
307
|
+
force: false,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
catch {
|
|
311
|
+
// Non-critical: dialog open must never fail because a background
|
|
312
|
+
// refresh check encountered backoff or a transient error.
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
// Build updates akin to the forced refresh path — resolve live
|
|
316
|
+
// indexes after the network call (a concurrent add/remove may have
|
|
317
|
+
// shifted positions), fold successful results into the live cache,
|
|
318
|
+
// then push a sidebar snapshot.
|
|
319
|
+
const updates = [];
|
|
320
|
+
for (const result of results) {
|
|
321
|
+
const refreshToken = result.updatedAccount?.refreshToken ??
|
|
322
|
+
accountsForQuota[result.index]?.refreshToken;
|
|
323
|
+
if (!refreshToken)
|
|
324
|
+
continue;
|
|
325
|
+
const groups = result.status === 'ok' && result.quota?.groups
|
|
326
|
+
? result.quota.groups
|
|
327
|
+
: undefined;
|
|
328
|
+
updates.push({ refreshToken, groups });
|
|
329
|
+
}
|
|
330
|
+
if (updates.length === 0)
|
|
331
|
+
return;
|
|
332
|
+
const liveIndexByRefreshToken = new Map();
|
|
333
|
+
for (const entry of accountManagerView.getAccounts()) {
|
|
334
|
+
liveIndexByRefreshToken.set(entry.refreshToken, entry.index);
|
|
335
|
+
}
|
|
336
|
+
let liveQuotaChanged = false;
|
|
337
|
+
for (const update of updates) {
|
|
338
|
+
const liveIndex = liveIndexByRefreshToken.get(update.refreshToken);
|
|
339
|
+
if (liveIndex === undefined || !update.groups)
|
|
340
|
+
continue;
|
|
341
|
+
accountManagerView.updateQuotaCache(liveIndex, update.groups, update.refreshToken);
|
|
342
|
+
liveQuotaChanged = true;
|
|
343
|
+
}
|
|
344
|
+
if (liveQuotaChanged)
|
|
345
|
+
accountManagerView.requestSaveToDisk();
|
|
346
|
+
// Push a fresh sidebar snapshot — the live view now carries the
|
|
347
|
+
// just-refreshed quota plus any skipped (backoff/fresh) accounts
|
|
348
|
+
// whose cached percentages are unchanged.
|
|
349
|
+
const rows = projectRows();
|
|
350
|
+
writeSidebar(rows);
|
|
351
|
+
},
|
|
352
|
+
async setCurrentAccount(index) {
|
|
353
|
+
return mutateLiveAndStorage({ action: 'setCurrent', index });
|
|
354
|
+
},
|
|
355
|
+
async toggleAccountEnabled(index) {
|
|
356
|
+
return mutateLiveAndStorage({ action: 'toggleEnabled', index });
|
|
357
|
+
},
|
|
358
|
+
async removeAccount(index) {
|
|
359
|
+
return mutateLiveAndStorage({ action: 'remove', index });
|
|
360
|
+
},
|
|
361
|
+
};
|
|
362
|
+
async function mutateLiveAndStorage(args) {
|
|
363
|
+
const { index, action } = args;
|
|
364
|
+
const target = accountManagerView.getAccounts()[index];
|
|
365
|
+
if (!target)
|
|
366
|
+
return null;
|
|
367
|
+
const refreshToken = accountManagerView.getRefreshTokenAt(index) ?? target.refreshToken;
|
|
368
|
+
if (!refreshToken)
|
|
369
|
+
return null;
|
|
370
|
+
if (action === 'toggleEnabled' &&
|
|
371
|
+
target.enabled === false &&
|
|
372
|
+
target.accountIneligible === true) {
|
|
373
|
+
throw new Error('This account is ineligible and cannot be enabled until eligibility is rechecked.');
|
|
374
|
+
}
|
|
375
|
+
if (!storage) {
|
|
376
|
+
throw new Error('CommandDataService is missing a locked-storage adapter; account mutations are disabled.');
|
|
377
|
+
}
|
|
378
|
+
// Capture the live view's current-account identity per family BEFORE
|
|
379
|
+
// the storage mutation. The remove action must persist the index that
|
|
380
|
+
// the same account will occupy AFTER the removal — unconditionally
|
|
381
|
+
// resetting to 0 made a non-current removal promote whichever account
|
|
382
|
+
// shifted into slot 0 to "active" on the next restart. Each model's
|
|
383
|
+
// cursor is tracked independently, so collapse-tokens does not work
|
|
384
|
+
// here: a Claude-active account and a Gemini-active account can
|
|
385
|
+
// point at different rows.
|
|
386
|
+
const liveCurrentTokens = {};
|
|
387
|
+
if (action === 'remove') {
|
|
388
|
+
const liveAccounts = accountManagerView.getAccounts();
|
|
389
|
+
const liveIndexes = accountManagerView.getActiveIndexByFamily();
|
|
390
|
+
liveCurrentTokens.claude =
|
|
391
|
+
liveAccounts[liveIndexes.claude]?.refreshToken ?? undefined;
|
|
392
|
+
liveCurrentTokens.gemini =
|
|
393
|
+
liveAccounts[liveIndexes.gemini]?.refreshToken ?? undefined;
|
|
394
|
+
}
|
|
395
|
+
let foundInStorage = false;
|
|
396
|
+
let desiredEnabled;
|
|
397
|
+
let previousEnabled;
|
|
398
|
+
let nextActiveIndex = 0;
|
|
399
|
+
let nextActiveIndexByFamily = {
|
|
400
|
+
claude: 0,
|
|
401
|
+
gemini: 0,
|
|
402
|
+
};
|
|
403
|
+
await storage.mutate((current) => {
|
|
404
|
+
const tokenIdx = current.accounts.findIndex((entry) => entry.refreshToken === refreshToken);
|
|
405
|
+
if (tokenIdx === -1)
|
|
406
|
+
return current;
|
|
407
|
+
foundInStorage = true;
|
|
408
|
+
if (action === 'setCurrent') {
|
|
409
|
+
return {
|
|
410
|
+
...current,
|
|
411
|
+
activeIndex: tokenIdx,
|
|
412
|
+
activeIndexByFamily: { claude: tokenIdx, gemini: tokenIdx },
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
if (action === 'toggleEnabled') {
|
|
416
|
+
const entry = current.accounts[tokenIdx];
|
|
417
|
+
if (!entry)
|
|
418
|
+
return current;
|
|
419
|
+
previousEnabled = entry.enabled !== false;
|
|
420
|
+
desiredEnabled = entry.enabled === false;
|
|
421
|
+
if (desiredEnabled && entry.accountIneligible === true) {
|
|
422
|
+
throw new Error('This account is ineligible and cannot be enabled until eligibility is rechecked.');
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
...current,
|
|
426
|
+
accounts: current.accounts.map((account) => account.refreshToken === refreshToken
|
|
427
|
+
? { ...account, enabled: desiredEnabled }
|
|
428
|
+
: account),
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
// remove: build the post-removal account list, then resolve the
|
|
432
|
+
// current-account's NEW index in that list. If the removed
|
|
433
|
+
// account was the live current, the captured token falls out of
|
|
434
|
+
// the list — the live AccountManager leaves the numeric current
|
|
435
|
+
// cursor at the SAME index (now occupied by whichever account
|
|
436
|
+
// shifted in), so the persisted index must follow that numeric
|
|
437
|
+
// slot rather than resetting to 0.
|
|
438
|
+
const nextAccounts = current.accounts.filter((account) => account.refreshToken !== refreshToken);
|
|
439
|
+
const resolveNextIndex = (liveToken, legacyIndex) => {
|
|
440
|
+
if (!liveToken)
|
|
441
|
+
return Math.max(0, Math.min(legacyIndex, nextAccounts.length - 1));
|
|
442
|
+
const found = nextAccounts.findIndex((account) => account.refreshToken === liveToken);
|
|
443
|
+
if (found !== -1)
|
|
444
|
+
return found;
|
|
445
|
+
// The captured current token was the one removed. Mirror the
|
|
446
|
+
// core's in-memory semantics: keep the cursor at the removed
|
|
447
|
+
// slot when it still exists in the new array; when the removed
|
|
448
|
+
// slot was the last position and no longer exists, persist 0
|
|
449
|
+
// (the core's buildStorageSnapshot clamps negative sentinels
|
|
450
|
+
// to 0, and auth-doctor treats a negative activeIndex as
|
|
451
|
+
// corruption — cf. auth-doctor.ts:149-156).
|
|
452
|
+
//
|
|
453
|
+
// Use tokenIdx (the storage-snapshot position) rather than the
|
|
454
|
+
// outer-scope `index` (live-read position): a concurrent mutation
|
|
455
|
+
// between the live read and the lock can diverge the two, and the
|
|
456
|
+
// storage-level cursor must match the storage-level array.
|
|
457
|
+
return tokenIdx < nextAccounts.length ? tokenIdx : 0;
|
|
458
|
+
};
|
|
459
|
+
const legacyClaude = current.activeIndexByFamily?.claude ?? current.activeIndex;
|
|
460
|
+
const legacyGemini = current.activeIndexByFamily?.gemini ?? current.activeIndex;
|
|
461
|
+
nextActiveIndex = resolveNextIndex(liveCurrentTokens.claude, legacyClaude);
|
|
462
|
+
nextActiveIndexByFamily = {
|
|
463
|
+
claude: resolveNextIndex(liveCurrentTokens.claude, legacyClaude),
|
|
464
|
+
gemini: resolveNextIndex(liveCurrentTokens.gemini, legacyGemini),
|
|
465
|
+
};
|
|
466
|
+
return {
|
|
467
|
+
...current,
|
|
468
|
+
accounts: nextAccounts,
|
|
469
|
+
activeIndex: nextActiveIndex,
|
|
470
|
+
activeIndexByFamily: nextActiveIndexByFamily,
|
|
471
|
+
};
|
|
472
|
+
});
|
|
473
|
+
if (!foundInStorage)
|
|
474
|
+
return null;
|
|
475
|
+
// Re-resolve the live index by canonical identity after the awaited disk
|
|
476
|
+
// transaction. A concurrent OAuth add/remove may have shifted every index.
|
|
477
|
+
const liveIndex = accountManagerView
|
|
478
|
+
.getAccounts()
|
|
479
|
+
.findIndex((account) => account.refreshToken === refreshToken);
|
|
480
|
+
let applied = action === 'remove' && liveIndex === -1;
|
|
481
|
+
if (liveIndex !== -1) {
|
|
482
|
+
if (action === 'setCurrent') {
|
|
483
|
+
applied = accountManagerView.setAccountCurrent(liveIndex);
|
|
484
|
+
}
|
|
485
|
+
else if (action === 'toggleEnabled') {
|
|
486
|
+
applied = accountManagerView.setAccountEnabled(liveIndex, desiredEnabled === true);
|
|
487
|
+
if (!applied) {
|
|
488
|
+
applied =
|
|
489
|
+
accountManagerView.getAccounts()[liveIndex]?.enabled ===
|
|
490
|
+
desiredEnabled;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
applied = accountManagerView.removeAccountByIndex(liveIndex);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
if (!applied && action !== 'remove') {
|
|
498
|
+
if (action === 'toggleEnabled' && previousEnabled !== undefined) {
|
|
499
|
+
await storage.mutate((current) => ({
|
|
500
|
+
...current,
|
|
501
|
+
accounts: current.accounts.map((account) => account.refreshToken === refreshToken
|
|
502
|
+
? { ...account, enabled: previousEnabled }
|
|
503
|
+
: account),
|
|
504
|
+
}));
|
|
505
|
+
}
|
|
506
|
+
throw new Error('The account changed while the operation was being applied; reopen the dialog and try again.');
|
|
507
|
+
}
|
|
508
|
+
await accountManagerView.flushSaveToDisk().catch(() => {
|
|
509
|
+
// The locked storage mutation already committed; a later periodic flush
|
|
510
|
+
// can reconcile transient AccountManager lock contention.
|
|
511
|
+
});
|
|
512
|
+
const rows = projectRows();
|
|
513
|
+
writeSidebar(rows);
|
|
514
|
+
return rows;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
//# sourceMappingURL=command-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-data.js","sourceRoot":"","sources":["../../../src/plugin/command-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,EACL,oCAAoC,EACpC,0BAA0B,EAE1B,sBAAsB,EACtB,cAAc,GACf,MAAM,kBAAkB,CAAA;AAkHzB;;;GAGG;AACH,MAAM,kBAAkB,GAGpB;IACF,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,YAAY;CAC3B,CAAA;AAED,MAAM,oBAAoB,GAAG;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