@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
|
@@ -1,328 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Account Rotation System
|
|
3
|
-
*
|
|
4
|
-
* Implements advanced account selection algorithms:
|
|
5
|
-
* - Health Score: Track account wellness based on success/failure
|
|
6
|
-
* - LRU Selection: Prefer accounts with longest rest periods
|
|
7
|
-
* - Jitter: Add random variance to break predictable patterns
|
|
8
|
-
*
|
|
9
|
-
* Used by 'hybrid' strategy for improved ban prevention and load distribution.
|
|
10
|
-
*/
|
|
11
|
-
export const DEFAULT_HEALTH_SCORE_CONFIG = {
|
|
12
|
-
initial: 70,
|
|
13
|
-
successReward: 1,
|
|
14
|
-
rateLimitPenalty: -10,
|
|
15
|
-
failurePenalty: -20,
|
|
16
|
-
recoveryRatePerHour: 2,
|
|
17
|
-
minUsable: 50,
|
|
18
|
-
maxScore: 100,
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Tracks health scores for accounts.
|
|
22
|
-
* Higher score = healthier account = preferred for selection.
|
|
23
|
-
*/
|
|
24
|
-
export class HealthScoreTracker {
|
|
25
|
-
scores = new Map();
|
|
26
|
-
config;
|
|
27
|
-
constructor(config = {}) {
|
|
28
|
-
this.config = { ...DEFAULT_HEALTH_SCORE_CONFIG, ...config };
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get current health score for an account, applying time-based recovery.
|
|
32
|
-
*/
|
|
33
|
-
getScore(accountIndex) {
|
|
34
|
-
const state = this.scores.get(accountIndex);
|
|
35
|
-
if (!state) {
|
|
36
|
-
return this.config.initial;
|
|
37
|
-
}
|
|
38
|
-
// Apply passive recovery based on time since last update
|
|
39
|
-
const now = Date.now();
|
|
40
|
-
const hoursSinceUpdate = (now - state.lastUpdated) / (1000 * 60 * 60);
|
|
41
|
-
const recoveredPoints = Math.floor(hoursSinceUpdate * this.config.recoveryRatePerHour);
|
|
42
|
-
return Math.min(this.config.maxScore, state.score + recoveredPoints);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Record a successful request - improves health score.
|
|
46
|
-
*/
|
|
47
|
-
recordSuccess(accountIndex) {
|
|
48
|
-
const now = Date.now();
|
|
49
|
-
const current = this.getScore(accountIndex);
|
|
50
|
-
this.scores.set(accountIndex, {
|
|
51
|
-
score: Math.min(this.config.maxScore, current + this.config.successReward),
|
|
52
|
-
lastUpdated: now,
|
|
53
|
-
lastSuccess: now,
|
|
54
|
-
consecutiveFailures: 0,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Record a rate limit hit - moderate penalty.
|
|
59
|
-
*/
|
|
60
|
-
recordRateLimit(accountIndex) {
|
|
61
|
-
const now = Date.now();
|
|
62
|
-
const state = this.scores.get(accountIndex);
|
|
63
|
-
const current = this.getScore(accountIndex);
|
|
64
|
-
this.scores.set(accountIndex, {
|
|
65
|
-
score: Math.max(0, current + this.config.rateLimitPenalty),
|
|
66
|
-
lastUpdated: now,
|
|
67
|
-
lastSuccess: state?.lastSuccess ?? 0,
|
|
68
|
-
consecutiveFailures: (state?.consecutiveFailures ?? 0) + 1,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Record a failure (auth, network, etc.) - larger penalty.
|
|
73
|
-
*/
|
|
74
|
-
recordFailure(accountIndex) {
|
|
75
|
-
const now = Date.now();
|
|
76
|
-
const state = this.scores.get(accountIndex);
|
|
77
|
-
const current = this.getScore(accountIndex);
|
|
78
|
-
this.scores.set(accountIndex, {
|
|
79
|
-
score: Math.max(0, current + this.config.failurePenalty),
|
|
80
|
-
lastUpdated: now,
|
|
81
|
-
lastSuccess: state?.lastSuccess ?? 0,
|
|
82
|
-
consecutiveFailures: (state?.consecutiveFailures ?? 0) + 1,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Check if account is healthy enough to use.
|
|
87
|
-
*/
|
|
88
|
-
isUsable(accountIndex) {
|
|
89
|
-
return this.getScore(accountIndex) >= this.config.minUsable;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Get consecutive failure count for an account.
|
|
93
|
-
*/
|
|
94
|
-
getConsecutiveFailures(accountIndex) {
|
|
95
|
-
return this.scores.get(accountIndex)?.consecutiveFailures ?? 0;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Reset health state for an account (e.g., after removal).
|
|
99
|
-
*/
|
|
100
|
-
reset(accountIndex) {
|
|
101
|
-
this.scores.delete(accountIndex);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Get all scores for debugging/logging.
|
|
105
|
-
*/
|
|
106
|
-
getSnapshot() {
|
|
107
|
-
const result = new Map();
|
|
108
|
-
for (const [index] of this.scores) {
|
|
109
|
-
result.set(index, {
|
|
110
|
-
score: this.getScore(index),
|
|
111
|
-
consecutiveFailures: this.getConsecutiveFailures(index),
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// ============================================================================
|
|
118
|
-
// JITTER UTILITIES
|
|
119
|
-
// ============================================================================
|
|
120
|
-
/**
|
|
121
|
-
* Add random jitter to a delay value.
|
|
122
|
-
* Helps break predictable timing patterns.
|
|
123
|
-
*
|
|
124
|
-
* @param baseMs - Base delay in milliseconds
|
|
125
|
-
* @param jitterFactor - Fraction of base to vary (default: 0.3 = ±30%)
|
|
126
|
-
* @returns Jittered delay in milliseconds
|
|
127
|
-
*/
|
|
128
|
-
export function addJitter(baseMs, jitterFactor = 0.3) {
|
|
129
|
-
const jitterRange = baseMs * jitterFactor;
|
|
130
|
-
const jitter = (Math.random() * 2 - 1) * jitterRange; // -jitterRange to +jitterRange
|
|
131
|
-
return Math.max(0, Math.round(baseMs + jitter));
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Generate a random delay within a range.
|
|
135
|
-
*
|
|
136
|
-
* @param minMs - Minimum delay in milliseconds
|
|
137
|
-
* @param maxMs - Maximum delay in milliseconds
|
|
138
|
-
* @returns Random delay between min and max
|
|
139
|
-
*/
|
|
140
|
-
export function randomDelay(minMs, maxMs) {
|
|
141
|
-
return Math.round(minMs + Math.random() * (maxMs - minMs));
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Sort accounts by LRU (least recently used first) with health score tiebreaker.
|
|
145
|
-
*
|
|
146
|
-
* Priority:
|
|
147
|
-
* 1. Filter out rate-limited and cooling-down accounts
|
|
148
|
-
* 2. Filter out unhealthy accounts (score < minUsable)
|
|
149
|
-
* 3. Sort by lastUsed ascending (oldest first = most rested)
|
|
150
|
-
* 4. Tiebreaker: higher health score wins
|
|
151
|
-
*/
|
|
152
|
-
export function sortByLruWithHealth(accounts, minHealthScore = 50) {
|
|
153
|
-
return accounts
|
|
154
|
-
.filter(acc => !acc.isRateLimited && !acc.isCoolingDown && acc.healthScore >= minHealthScore)
|
|
155
|
-
.sort((a, b) => {
|
|
156
|
-
// Primary: LRU (oldest lastUsed first)
|
|
157
|
-
const lruDiff = a.lastUsed - b.lastUsed;
|
|
158
|
-
if (lruDiff !== 0)
|
|
159
|
-
return lruDiff;
|
|
160
|
-
// Tiebreaker: higher health score wins
|
|
161
|
-
return b.healthScore - a.healthScore;
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
/** Stickiness bonus added to current account's score to prevent unnecessary switching */
|
|
165
|
-
const STICKINESS_BONUS = 150;
|
|
166
|
-
/** Minimum score advantage required to switch away from current account */
|
|
167
|
-
const SWITCH_THRESHOLD = 100;
|
|
168
|
-
/**
|
|
169
|
-
* Select account using hybrid strategy with stickiness:
|
|
170
|
-
* 1. Filter available accounts (not rate-limited, not cooling down, healthy, has tokens)
|
|
171
|
-
* 2. Calculate priority score: health (2x) + tokens (5x) + freshness (0.1x)
|
|
172
|
-
* 3. Apply stickiness bonus to current account
|
|
173
|
-
* 4. Only switch if another account beats current by SWITCH_THRESHOLD
|
|
174
|
-
*
|
|
175
|
-
* @param accounts - All accounts with their metrics
|
|
176
|
-
* @param tokenTracker - Token bucket tracker for token balances
|
|
177
|
-
* @param currentAccountIndex - Currently active account index (for stickiness)
|
|
178
|
-
* @param minHealthScore - Minimum health score to be considered
|
|
179
|
-
* @returns Best account index, or null if none available
|
|
180
|
-
*/
|
|
181
|
-
export function selectHybridAccount(accounts, tokenTracker, currentAccountIndex = null, minHealthScore = 50) {
|
|
182
|
-
const candidates = accounts
|
|
183
|
-
.filter(acc => !acc.isRateLimited &&
|
|
184
|
-
!acc.isCoolingDown &&
|
|
185
|
-
acc.healthScore >= minHealthScore &&
|
|
186
|
-
tokenTracker.hasTokens(acc.index))
|
|
187
|
-
.map(acc => ({
|
|
188
|
-
...acc,
|
|
189
|
-
tokens: tokenTracker.getTokens(acc.index)
|
|
190
|
-
}));
|
|
191
|
-
if (candidates.length === 0) {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
const maxTokens = tokenTracker.getMaxTokens();
|
|
195
|
-
const scored = candidates
|
|
196
|
-
.map(acc => {
|
|
197
|
-
const baseScore = calculateHybridScore(acc, maxTokens);
|
|
198
|
-
// Apply stickiness bonus to current account
|
|
199
|
-
const stickinessBonus = acc.index === currentAccountIndex ? STICKINESS_BONUS : 0;
|
|
200
|
-
return {
|
|
201
|
-
index: acc.index,
|
|
202
|
-
baseScore,
|
|
203
|
-
score: baseScore + stickinessBonus,
|
|
204
|
-
isCurrent: acc.index === currentAccountIndex
|
|
205
|
-
};
|
|
206
|
-
})
|
|
207
|
-
.sort((a, b) => b.score - a.score);
|
|
208
|
-
const best = scored[0];
|
|
209
|
-
if (!best) {
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
// If current account is still a candidate, check if switch is warranted
|
|
213
|
-
const currentCandidate = scored.find(s => s.isCurrent);
|
|
214
|
-
if (currentCandidate && !best.isCurrent) {
|
|
215
|
-
// Only switch if best beats current's BASE score by threshold
|
|
216
|
-
// (compare base scores to avoid circular stickiness bonus comparison)
|
|
217
|
-
const advantage = best.baseScore - currentCandidate.baseScore;
|
|
218
|
-
if (advantage < SWITCH_THRESHOLD) {
|
|
219
|
-
return currentCandidate.index;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return best.index;
|
|
223
|
-
}
|
|
224
|
-
function calculateHybridScore(account, maxTokens) {
|
|
225
|
-
const healthComponent = account.healthScore * 2; // 0-200
|
|
226
|
-
const tokenComponent = (account.tokens / maxTokens) * 100 * 5; // 0-500
|
|
227
|
-
const secondsSinceUsed = (Date.now() - account.lastUsed) / 1000;
|
|
228
|
-
const freshnessComponent = Math.min(secondsSinceUsed, 3600) * 0.1; // 0-360
|
|
229
|
-
return Math.max(0, healthComponent + tokenComponent + freshnessComponent);
|
|
230
|
-
}
|
|
231
|
-
export const DEFAULT_TOKEN_BUCKET_CONFIG = {
|
|
232
|
-
maxTokens: 50,
|
|
233
|
-
regenerationRatePerMinute: 6,
|
|
234
|
-
initialTokens: 50,
|
|
235
|
-
};
|
|
236
|
-
/**
|
|
237
|
-
* Client-side rate limiting using Token Bucket algorithm.
|
|
238
|
-
* Helps prevent hitting server 429s by tracking "cost" of requests.
|
|
239
|
-
*/
|
|
240
|
-
export class TokenBucketTracker {
|
|
241
|
-
buckets = new Map();
|
|
242
|
-
config;
|
|
243
|
-
constructor(config = {}) {
|
|
244
|
-
this.config = { ...DEFAULT_TOKEN_BUCKET_CONFIG, ...config };
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Get current token balance for an account, applying regeneration.
|
|
248
|
-
*/
|
|
249
|
-
getTokens(accountIndex) {
|
|
250
|
-
const state = this.buckets.get(accountIndex);
|
|
251
|
-
if (!state) {
|
|
252
|
-
return this.config.initialTokens;
|
|
253
|
-
}
|
|
254
|
-
const now = Date.now();
|
|
255
|
-
const minutesSinceUpdate = (now - state.lastUpdated) / (1000 * 60);
|
|
256
|
-
const recoveredTokens = minutesSinceUpdate * this.config.regenerationRatePerMinute;
|
|
257
|
-
return Math.min(this.config.maxTokens, state.tokens + recoveredTokens);
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Check if account has enough tokens for a request.
|
|
261
|
-
* @param cost Cost of the request (default: 1)
|
|
262
|
-
*/
|
|
263
|
-
hasTokens(accountIndex, cost = 1) {
|
|
264
|
-
return this.getTokens(accountIndex) >= cost;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Consume tokens for a request.
|
|
268
|
-
* @returns true if tokens were consumed, false if insufficient
|
|
269
|
-
*/
|
|
270
|
-
consume(accountIndex, cost = 1) {
|
|
271
|
-
const current = this.getTokens(accountIndex);
|
|
272
|
-
if (current < cost) {
|
|
273
|
-
return false;
|
|
274
|
-
}
|
|
275
|
-
this.buckets.set(accountIndex, {
|
|
276
|
-
tokens: current - cost,
|
|
277
|
-
lastUpdated: Date.now(),
|
|
278
|
-
});
|
|
279
|
-
return true;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Refund tokens (e.g., if request wasn't actually sent).
|
|
283
|
-
*/
|
|
284
|
-
refund(accountIndex, amount = 1) {
|
|
285
|
-
const current = this.getTokens(accountIndex);
|
|
286
|
-
this.buckets.set(accountIndex, {
|
|
287
|
-
tokens: Math.min(this.config.maxTokens, current + amount),
|
|
288
|
-
lastUpdated: Date.now(),
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
getMaxTokens() {
|
|
292
|
-
return this.config.maxTokens;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
// ============================================================================
|
|
296
|
-
// SINGLETON TRACKERS
|
|
297
|
-
// ============================================================================
|
|
298
|
-
let globalTokenTracker = null;
|
|
299
|
-
export function getTokenTracker() {
|
|
300
|
-
if (!globalTokenTracker) {
|
|
301
|
-
globalTokenTracker = new TokenBucketTracker();
|
|
302
|
-
}
|
|
303
|
-
return globalTokenTracker;
|
|
304
|
-
}
|
|
305
|
-
export function initTokenTracker(config) {
|
|
306
|
-
globalTokenTracker = new TokenBucketTracker(config);
|
|
307
|
-
return globalTokenTracker;
|
|
308
|
-
}
|
|
309
|
-
let globalHealthTracker = null;
|
|
310
|
-
/**
|
|
311
|
-
* Get the global health score tracker instance.
|
|
312
|
-
* Creates one with default config if not initialized.
|
|
313
|
-
*/
|
|
314
|
-
export function getHealthTracker() {
|
|
315
|
-
if (!globalHealthTracker) {
|
|
316
|
-
globalHealthTracker = new HealthScoreTracker();
|
|
317
|
-
}
|
|
318
|
-
return globalHealthTracker;
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Initialize the global health tracker with custom config.
|
|
322
|
-
* Call this at plugin startup if custom config is needed.
|
|
323
|
-
*/
|
|
324
|
-
export function initHealthTracker(config) {
|
|
325
|
-
globalHealthTracker = new HealthScoreTracker(config);
|
|
326
|
-
return globalHealthTracker;
|
|
327
|
-
}
|
|
1
|
+
export * from '@cortexkit/antigravity-auth-core';
|
|
328
2
|
//# sourceMappingURL=rotation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rotation.js","sourceRoot":"","sources":["../../../src/plugin/rotation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"rotation.js","sourceRoot":"","sources":["../../../src/plugin/rotation.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/plugin/search.ts"],"names":[],"mappings":"AAsFA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/plugin/search.ts"],"names":[],"mappings":"AAsFA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC9C,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,aAAa,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACtD;AA0HD;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,UAAU,EAChB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,MAAM,CAAC,CAgGjB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import crypto from
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
2
|
/**
|
|
3
3
|
* Google Search Tool Implementation
|
|
4
4
|
*
|
|
@@ -6,11 +6,11 @@ import crypto from "node:crypto";
|
|
|
6
6
|
* cannot be combined with function declarations. This module implements a
|
|
7
7
|
* wrapper that makes separate API calls with only the grounding tools enabled.
|
|
8
8
|
*/
|
|
9
|
-
import { ANTIGRAVITY_ENDPOINT, SEARCH_MODEL,
|
|
10
|
-
import { fetchWithAgyCliTransport } from
|
|
11
|
-
import { buildFingerprintHeaders, getSessionFingerprint } from
|
|
12
|
-
import { createLogger } from
|
|
13
|
-
const log = createLogger(
|
|
9
|
+
import { ANTIGRAVITY_ENDPOINT, SEARCH_MODEL, SEARCH_SYSTEM_INSTRUCTION, SEARCH_TIMEOUT_MS, } from '../constants';
|
|
10
|
+
import { fetchWithAgyCliTransport } from './agy-transport';
|
|
11
|
+
import { buildFingerprintHeaders, getSessionFingerprint } from './fingerprint';
|
|
12
|
+
import { createLogger } from './logger';
|
|
13
|
+
const log = createLogger('search');
|
|
14
14
|
// ============================================================================
|
|
15
15
|
// Helper Functions
|
|
16
16
|
// ============================================================================
|
|
@@ -25,46 +25,46 @@ function getSessionId() {
|
|
|
25
25
|
}
|
|
26
26
|
function formatSearchResult(result) {
|
|
27
27
|
const lines = [];
|
|
28
|
-
lines.push(
|
|
28
|
+
lines.push('## Search Results\n');
|
|
29
29
|
lines.push(result.text);
|
|
30
|
-
lines.push(
|
|
30
|
+
lines.push('');
|
|
31
31
|
if (result.sources.length > 0) {
|
|
32
|
-
lines.push(
|
|
32
|
+
lines.push('### Sources');
|
|
33
33
|
for (const source of result.sources) {
|
|
34
34
|
lines.push(`- [${source.title}](${source.url})`);
|
|
35
35
|
}
|
|
36
|
-
lines.push(
|
|
36
|
+
lines.push('');
|
|
37
37
|
}
|
|
38
38
|
if (result.urlsRetrieved.length > 0) {
|
|
39
|
-
lines.push(
|
|
39
|
+
lines.push('### URLs Retrieved');
|
|
40
40
|
for (const url of result.urlsRetrieved) {
|
|
41
|
-
const status = url.status ===
|
|
41
|
+
const status = url.status === 'URL_RETRIEVAL_STATUS_SUCCESS' ? '✓' : '✗';
|
|
42
42
|
lines.push(`- ${status} ${url.url}`);
|
|
43
43
|
}
|
|
44
|
-
lines.push(
|
|
44
|
+
lines.push('');
|
|
45
45
|
}
|
|
46
46
|
if (result.searchQueries.length > 0) {
|
|
47
|
-
lines.push(
|
|
47
|
+
lines.push('### Search Queries Used');
|
|
48
48
|
for (const q of result.searchQueries) {
|
|
49
49
|
lines.push(`- "${q}"`);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
return lines.join(
|
|
52
|
+
return lines.join('\n');
|
|
53
53
|
}
|
|
54
54
|
function parseSearchResponse(data) {
|
|
55
55
|
const result = {
|
|
56
|
-
text:
|
|
56
|
+
text: '',
|
|
57
57
|
sources: [],
|
|
58
58
|
searchQueries: [],
|
|
59
59
|
urlsRetrieved: [],
|
|
60
60
|
};
|
|
61
61
|
const response = data.response;
|
|
62
|
-
if (!response
|
|
62
|
+
if (!response?.candidates || response.candidates.length === 0) {
|
|
63
63
|
if (data.error) {
|
|
64
|
-
result.text = `Error: ${data.error.message ??
|
|
64
|
+
result.text = `Error: ${data.error.message ?? 'Unknown error'}`;
|
|
65
65
|
}
|
|
66
66
|
else if (response?.error) {
|
|
67
|
-
result.text = `Error: ${response.error.message ??
|
|
67
|
+
result.text = `Error: ${response.error.message ?? 'Unknown error'}`;
|
|
68
68
|
}
|
|
69
69
|
return result;
|
|
70
70
|
}
|
|
@@ -75,9 +75,9 @@ function parseSearchResponse(data) {
|
|
|
75
75
|
// Extract text content
|
|
76
76
|
if (candidate.content?.parts) {
|
|
77
77
|
result.text = candidate.content.parts
|
|
78
|
-
.map((p) => p.text ??
|
|
78
|
+
.map((p) => p.text ?? '')
|
|
79
79
|
.filter(Boolean)
|
|
80
|
-
.join(
|
|
80
|
+
.join('\n');
|
|
81
81
|
}
|
|
82
82
|
// Extract grounding metadata
|
|
83
83
|
if (candidate.groundingMetadata) {
|
|
@@ -102,7 +102,7 @@ function parseSearchResponse(data) {
|
|
|
102
102
|
if (meta.retrieved_url) {
|
|
103
103
|
result.urlsRetrieved.push({
|
|
104
104
|
url: meta.retrieved_url,
|
|
105
|
-
status: meta.url_retrieval_status ??
|
|
105
|
+
status: meta.url_retrieval_status ?? 'UNKNOWN',
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -123,7 +123,7 @@ export async function executeSearch(args, accessToken, projectId, abortSignal) {
|
|
|
123
123
|
// Build prompt with optional URLs
|
|
124
124
|
let prompt = query;
|
|
125
125
|
if (urls && urls.length > 0) {
|
|
126
|
-
const urlList = urls.join(
|
|
126
|
+
const urlList = urls.join('\n');
|
|
127
127
|
prompt = `${query}\n\nURLs to analyze:\n${urlList}`;
|
|
128
128
|
}
|
|
129
129
|
// Build tools array - only grounding tools, no function declarations
|
|
@@ -138,7 +138,7 @@ export async function executeSearch(args, accessToken, projectId, abortSignal) {
|
|
|
138
138
|
},
|
|
139
139
|
contents: [
|
|
140
140
|
{
|
|
141
|
-
role:
|
|
141
|
+
role: 'user',
|
|
142
142
|
parts: [{ text: prompt }],
|
|
143
143
|
},
|
|
144
144
|
],
|
|
@@ -157,12 +157,12 @@ export async function executeSearch(args, accessToken, projectId, abortSignal) {
|
|
|
157
157
|
sessionId: getSessionId(),
|
|
158
158
|
},
|
|
159
159
|
model: SEARCH_MODEL,
|
|
160
|
-
userAgent:
|
|
161
|
-
requestType:
|
|
160
|
+
userAgent: 'antigravity',
|
|
161
|
+
requestType: 'agent',
|
|
162
162
|
};
|
|
163
163
|
// Use non-streaming endpoint for search
|
|
164
164
|
const url = `${ANTIGRAVITY_ENDPOINT}/v1internal:generateContent`;
|
|
165
|
-
log.debug(
|
|
165
|
+
log.debug('Executing search', {
|
|
166
166
|
query,
|
|
167
167
|
urlCount: urls?.length ?? 0,
|
|
168
168
|
thinking,
|
|
@@ -170,30 +170,34 @@ export async function executeSearch(args, accessToken, projectId, abortSignal) {
|
|
|
170
170
|
try {
|
|
171
171
|
const fingerprintHeaders = buildFingerprintHeaders(getSessionFingerprint());
|
|
172
172
|
const response = await fetchWithAgyCliTransport(url, {
|
|
173
|
-
method:
|
|
173
|
+
method: 'POST',
|
|
174
174
|
headers: {
|
|
175
|
-
|
|
175
|
+
'User-Agent': fingerprintHeaders['User-Agent'] ??
|
|
176
|
+
getSessionFingerprint().userAgent,
|
|
176
177
|
Authorization: `Bearer ${accessToken}`,
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
'Content-Type': 'application/json',
|
|
179
|
+
'Accept-Encoding': 'gzip',
|
|
179
180
|
},
|
|
180
181
|
body: JSON.stringify(wrappedBody),
|
|
181
182
|
}, { signal: abortSignal ?? AbortSignal.timeout(SEARCH_TIMEOUT_MS) });
|
|
182
183
|
if (!response.ok) {
|
|
183
184
|
const errorText = await response.text();
|
|
184
|
-
log.debug(
|
|
185
|
+
log.debug('Search API error', {
|
|
186
|
+
status: response.status,
|
|
187
|
+
error: errorText,
|
|
188
|
+
});
|
|
185
189
|
return `## Search Error\n\nFailed to execute search: ${response.status} ${response.statusText}\n\n${errorText}\n\nPlease try again with a different query.`;
|
|
186
190
|
}
|
|
187
191
|
const data = (await response.json());
|
|
188
|
-
log.debug(
|
|
192
|
+
log.debug('Search response received', { hasResponse: !!data.response });
|
|
189
193
|
const result = parseSearchResponse(data);
|
|
190
194
|
const formatted = formatSearchResult(result);
|
|
191
|
-
log.debug(
|
|
195
|
+
log.debug('Search response formatted', { resultLength: formatted.length });
|
|
192
196
|
return formatted;
|
|
193
197
|
}
|
|
194
198
|
catch (error) {
|
|
195
199
|
const message = error instanceof Error ? error.message : String(error);
|
|
196
|
-
log.debug(
|
|
200
|
+
log.debug('Search execution error', { error: message });
|
|
197
201
|
return `## Search Error\n\nFailed to execute search: ${message}. Please try again with a different query.`;
|
|
198
202
|
}
|
|
199
203
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/plugin/search.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/plugin/search.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC;;;;;;GAMG;AAEH,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;AA+ElC,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,IAAI,cAAc,GAAG,CAAC,CAAA;AACtB,MAAM,aAAa,GAAG,UAAU,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAA;AAEzD,SAAS,iBAAiB;IACxB,OAAO,SAAS,MAAM,CAAC,UAAU,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,MAAM,CAAC,UAAU,EAA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MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAA;QACxC,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAA;QAC5C,GAAG,CAAC,KAAK,CAAC,2BAA2B,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,MAAM,EAAE,CAAC,CAAA;QAC1E,OAAO,SAAS,CAAA;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACtE,GAAG,CAAC,KAAK,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;QACvD,OAAO,gDAAgD,OAAO,4CAA4C,CAAA;IAC5G,CAAC;AACH,CAAC"}
|
|
@@ -18,6 +18,6 @@ export interface OAuthListener {
|
|
|
18
18
|
* Starts a lightweight HTTP server that listens for the Antigravity OAuth redirect
|
|
19
19
|
* and resolves with the captured callback URL.
|
|
20
20
|
*/
|
|
21
|
-
export declare function startOAuthListener({ timeoutMs }?: OAuthListenerOptions): Promise<OAuthListener>;
|
|
21
|
+
export declare function startOAuthListener({ timeoutMs, }?: OAuthListenerOptions): Promise<OAuthListener>;
|
|
22
22
|
export {};
|
|
23
23
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/plugin/server.ts"],"names":[],"mappings":"AAKA,UAAU,oBAAoB;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/plugin/server.ts"],"names":[],"mappings":"AAKA,UAAU,oBAAoB;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;IAC/B;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB;AA0HD;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,SAAyB,GAC1B,GAAE,oBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,CAqOpD"}
|