@cortexkit/opencode-antigravity-auth 2.2.1 → 3.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 +100 -92
- package/dist/cli.js +18476 -812
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +4100 -0
- package/dist/index.js +40602 -15857
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +6978 -0
- package/dist/server.js +51220 -0
- package/dist/server.js.map +7 -0
- package/dist/server.meta.json +7313 -0
- package/dist/src/cli.d.ts +46 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +207 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/common-auth-embedded/NOTICE.txt +21 -0
- package/dist/src/common-auth-embedded/auth-menu/accounts.d.ts +97 -0
- package/dist/src/common-auth-embedded/auth-menu/accounts.js +387 -0
- package/dist/src/common-auth-embedded/auth-menu/ansi.d.ts +26 -0
- package/dist/src/common-auth-embedded/auth-menu/ansi.js +98 -0
- package/dist/src/common-auth-embedded/auth-menu/confirm.d.ts +7 -0
- package/dist/src/common-auth-embedded/auth-menu/confirm.js +21 -0
- package/dist/src/common-auth-embedded/auth-menu/doctor.d.ts +52 -0
- package/dist/src/common-auth-embedded/auth-menu/doctor.js +81 -0
- package/dist/src/common-auth-embedded/auth-menu/index.d.ts +17 -0
- package/dist/src/common-auth-embedded/auth-menu/index.js +12 -0
- package/dist/src/common-auth-embedded/auth-menu/login.d.ts +55 -0
- package/dist/src/common-auth-embedded/auth-menu/login.js +83 -0
- package/dist/src/common-auth-embedded/auth-menu/menu.d.ts +59 -0
- package/dist/src/common-auth-embedded/auth-menu/menu.js +73 -0
- package/dist/src/common-auth-embedded/auth-menu/opencode-v1.d.ts +49 -0
- package/dist/src/common-auth-embedded/auth-menu/opencode-v1.js +47 -0
- package/dist/src/common-auth-embedded/auth-menu/select.d.ts +21 -0
- package/dist/src/common-auth-embedded/auth-menu/select.js +159 -0
- package/dist/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
- package/dist/src/common-auth-embedded/auth-menu/terminal.js +19 -0
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +102 -0
- package/dist/src/common-auth-embedded/claustrum/consumer.js +298 -0
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +175 -0
- package/dist/src/common-auth-embedded/claustrum/custody.js +354 -0
- package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +158 -0
- package/dist/src/common-auth-embedded/claustrum/enrollment.js +759 -0
- package/dist/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
- package/dist/src/common-auth-embedded/claustrum/errors.js +8 -0
- package/dist/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
- package/dist/src/common-auth-embedded/claustrum/host-slot.js +72 -0
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +18 -0
- package/dist/src/common-auth-embedded/claustrum/index.js +22 -0
- package/dist/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
- package/dist/src/common-auth-embedded/claustrum/interlock.js +29 -0
- package/dist/src/common-auth-embedded/claustrum/roster.d.ts +208 -0
- package/dist/src/common-auth-embedded/claustrum/roster.js +536 -0
- package/dist/src/common-auth-embedded/commands/builtins.d.ts +71 -0
- package/dist/src/common-auth-embedded/commands/builtins.js +534 -0
- package/dist/src/common-auth-embedded/commands/index.d.ts +10 -0
- package/dist/src/common-auth-embedded/commands/index.js +5 -0
- package/dist/src/common-auth-embedded/commands/menu.d.ts +61 -0
- package/dist/src/common-auth-embedded/commands/menu.js +300 -0
- package/dist/src/common-auth-embedded/commands/model.d.ts +238 -0
- package/dist/src/common-auth-embedded/commands/model.js +16 -0
- package/dist/src/common-auth-embedded/commands/pi.d.ts +23 -0
- package/dist/src/common-auth-embedded/commands/pi.js +206 -0
- package/dist/src/common-auth-embedded/commands/seam.d.ts +72 -0
- package/dist/src/common-auth-embedded/commands/seam.js +301 -0
- package/dist/src/common-auth-embedded/fs/atomic-write.d.ts +20 -0
- package/dist/src/common-auth-embedded/fs/atomic-write.js +80 -0
- package/dist/src/common-auth-embedded/fs/index.d.ts +7 -0
- package/dist/src/common-auth-embedded/fs/index.js +6 -0
- package/dist/src/common-auth-embedded/fs/lock-constants.d.ts +14 -0
- package/dist/src/common-auth-embedded/fs/lock-constants.js +14 -0
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +501 -0
- package/dist/src/common-auth-embedded/fs/with-lock.d.ts +33 -0
- package/dist/src/common-auth-embedded/fs/with-lock.js +48 -0
- package/dist/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
- package/dist/src/common-auth-embedded/logger/capture-sink.js +13 -0
- package/dist/src/common-auth-embedded/logger/engine.d.ts +100 -0
- package/dist/src/common-auth-embedded/logger/engine.js +246 -0
- package/dist/src/common-auth-embedded/logger/index.d.ts +6 -0
- package/dist/src/common-auth-embedded/logger/index.js +3 -0
- package/dist/src/common-auth-embedded/logger/redact.d.ts +11 -0
- package/dist/src/common-auth-embedded/logger/redact.js +83 -0
- package/dist/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
- package/dist/src/common-auth-embedded/opencode2/errors.js +15 -0
- package/dist/src/common-auth-embedded/opencode2/index.d.ts +8 -0
- package/dist/src/common-auth-embedded/opencode2/index.js +4 -0
- package/dist/src/common-auth-embedded/opencode2/install.d.ts +55 -0
- package/dist/src/common-auth-embedded/opencode2/install.js +886 -0
- package/dist/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
- package/dist/src/common-auth-embedded/opencode2/integration.js +143 -0
- package/dist/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
- package/dist/src/common-auth-embedded/opencode2/sse.js +60 -0
- package/dist/src/common-auth-embedded/opencode2/types.d.ts +413 -0
- package/dist/src/common-auth-embedded/pi-slot/index.d.ts +3 -0
- package/dist/src/common-auth-embedded/pi-slot/index.js +2 -0
- package/dist/src/common-auth-embedded/pi-slot/lock.js +212 -0
- package/dist/src/common-auth-embedded/pi-slot/slot.d.ts +49 -0
- package/dist/src/common-auth-embedded/pi-slot/slot.js +383 -0
- package/dist/src/common-auth-embedded/quota/codec.d.ts +11 -0
- package/dist/src/common-auth-embedded/quota/codec.js +12 -0
- package/dist/src/common-auth-embedded/quota/format.d.ts +46 -0
- package/dist/src/common-auth-embedded/quota/format.js +138 -0
- package/dist/src/common-auth-embedded/quota/index.d.ts +10 -0
- package/dist/src/common-auth-embedded/quota/index.js +5 -0
- package/dist/src/common-auth-embedded/quota/map.d.ts +63 -0
- package/dist/src/common-auth-embedded/quota/map.js +105 -0
- package/dist/src/common-auth-embedded/quota/merge.d.ts +48 -0
- package/dist/src/common-auth-embedded/quota/merge.js +162 -0
- package/dist/src/common-auth-embedded/quota/projection.d.ts +64 -0
- package/dist/src/common-auth-embedded/quota/projection.js +134 -0
- package/dist/src/common-auth-embedded/routing/admission.d.ts +93 -0
- package/dist/src/common-auth-embedded/routing/admission.js +142 -0
- package/dist/src/common-auth-embedded/routing/index.d.ts +8 -0
- package/dist/src/common-auth-embedded/routing/index.js +4 -0
- package/dist/src/common-auth-embedded/routing/ordered.d.ts +47 -0
- package/dist/src/common-auth-embedded/routing/ordered.js +58 -0
- package/dist/src/common-auth-embedded/routing/pins.d.ts +22 -0
- package/dist/src/common-auth-embedded/routing/pins.js +34 -0
- package/dist/src/common-auth-embedded/routing/sticky.d.ts +158 -0
- package/dist/src/common-auth-embedded/routing/sticky.js +339 -0
- package/dist/src/common-auth-embedded/rpc/client.d.ts +3 -0
- package/dist/src/common-auth-embedded/rpc/client.js +2 -0
- package/dist/src/common-auth-embedded/rpc/index.d.ts +10 -0
- package/dist/src/common-auth-embedded/rpc/index.js +5 -0
- package/dist/src/common-auth-embedded/rpc/notifications.d.ts +73 -0
- package/dist/src/common-auth-embedded/rpc/notifications.js +100 -0
- package/dist/src/common-auth-embedded/rpc/port-file.d.ts +33 -0
- package/dist/src/common-auth-embedded/rpc/port-file.js +217 -0
- package/dist/src/common-auth-embedded/rpc/rpc-client.d.ts +30 -0
- package/dist/src/common-auth-embedded/rpc/rpc-client.js +253 -0
- package/dist/src/common-auth-embedded/rpc/rpc-server.d.ts +58 -0
- package/dist/src/common-auth-embedded/rpc/rpc-server.js +311 -0
- package/dist/src/common-auth-embedded/rpc/server-registry.d.ts +11 -0
- package/dist/src/common-auth-embedded/rpc/server-registry.js +47 -0
- package/dist/src/common-auth-embedded/source-output.json +1326 -0
- package/dist/src/common-auth-embedded/store/attribution.d.ts +28 -0
- package/dist/src/common-auth-embedded/store/attribution.js +60 -0
- package/dist/src/common-auth-embedded/store/errors.d.ts +55 -0
- package/dist/src/common-auth-embedded/store/errors.js +38 -0
- package/dist/src/common-auth-embedded/store/hooks.d.ts +12 -0
- package/dist/src/common-auth-embedded/store/hooks.js +34 -0
- package/dist/src/common-auth-embedded/store/identity.d.ts +39 -0
- package/dist/src/common-auth-embedded/store/identity.js +79 -0
- package/dist/src/common-auth-embedded/store/index.d.ts +21 -0
- package/dist/src/common-auth-embedded/store/index.js +7 -0
- package/dist/src/common-auth-embedded/store/mutate.d.ts +189 -0
- package/dist/src/common-auth-embedded/store/mutate.js +500 -0
- package/dist/src/common-auth-embedded/store/pool.d.ts +196 -0
- package/dist/src/common-auth-embedded/store/pool.js +120 -0
- package/dist/src/common-auth-embedded/store/provider-state.d.ts +131 -0
- package/dist/src/common-auth-embedded/store/provider-state.js +226 -0
- package/dist/src/common-auth-embedded/store/publication.d.ts +47 -0
- package/dist/src/common-auth-embedded/store/publication.js +304 -0
- package/dist/src/common-auth-embedded/store/pull.d.ts +36 -0
- package/dist/src/common-auth-embedded/store/pull.js +143 -0
- package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
- package/dist/src/common-auth-embedded/store/refresh-lock.js +136 -0
- package/dist/src/common-auth-embedded/store/refresh.d.ts +72 -0
- package/dist/src/common-auth-embedded/store/refresh.js +225 -0
- package/dist/src/common-auth-embedded/store/reserved.js +13 -0
- package/dist/src/common-auth-embedded/store/rows.d.ts +313 -0
- package/dist/src/common-auth-embedded/store/rows.js +1258 -0
- package/dist/src/common-auth-embedded/store/runtime.d.ts +36 -0
- package/dist/src/common-auth-embedded/store/runtime.js +68 -0
- package/dist/src/common-auth-embedded/store/schema.d.ts +443 -0
- package/dist/src/common-auth-embedded/store/schema.js +754 -0
- package/dist/src/common-auth-embedded/store/settings.d.ts +63 -0
- package/dist/src/common-auth-embedded/store/settings.js +120 -0
- package/dist/src/common-auth-embedded/store/torn.d.ts +78 -0
- package/dist/src/common-auth-embedded/store/torn.js +294 -0
- package/dist/src/common-auth-embedded/tui/index.d.ts +8 -0
- package/dist/src/common-auth-embedded/tui/index.js +21 -0
- package/dist/src/common-auth-embedded/util/any-signal.js +42 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +4 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/ga/proxy-guard.d.ts +120 -0
- package/dist/src/ga/proxy-guard.d.ts.map +1 -0
- package/dist/src/ga/proxy-guard.js +269 -0
- package/dist/src/ga/proxy-guard.js.map +1 -0
- package/dist/src/ga/rpc/protocol.d.ts +504 -0
- package/dist/src/ga/rpc/protocol.d.ts.map +1 -0
- package/dist/src/ga/rpc/protocol.js +1278 -0
- package/dist/src/ga/rpc/protocol.js.map +1 -0
- package/dist/src/ga/server/auth.d.ts +9 -0
- package/dist/src/ga/server/auth.d.ts.map +1 -0
- package/dist/src/ga/server/auth.js +37 -0
- package/dist/src/ga/server/auth.js.map +1 -0
- package/dist/src/ga/server/index.d.ts +576 -0
- package/dist/src/ga/server/index.d.ts.map +1 -0
- package/dist/src/ga/server/index.js +1012 -0
- package/dist/src/ga/server/index.js.map +1 -0
- package/dist/src/ga/tui/host-ga.d.ts +350 -0
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -0
- package/dist/src/ga/tui/host-ga.js +1242 -0
- package/dist/src/ga/tui/host-ga.js.map +1 -0
- package/dist/src/logging/provider-key-policy.d.ts +9 -0
- package/dist/src/logging/provider-key-policy.d.ts.map +1 -0
- package/dist/src/logging/provider-key-policy.js +11 -0
- package/dist/src/logging/provider-key-policy.js.map +1 -0
- package/dist/src/plugin/account-access.d.ts +130 -15
- package/dist/src/plugin/account-access.d.ts.map +1 -1
- package/dist/src/plugin/account-access.js +331 -129
- package/dist/src/plugin/account-access.js.map +1 -1
- package/dist/src/plugin/account-blocks.d.ts +102 -0
- package/dist/src/plugin/account-blocks.d.ts.map +1 -0
- package/dist/src/plugin/account-blocks.js +196 -0
- package/dist/src/plugin/account-blocks.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +85 -1
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +127 -3
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/auth-loader.d.ts +69 -5
- package/dist/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/src/plugin/auth-loader.js +355 -52
- package/dist/src/plugin/auth-loader.js.map +1 -1
- package/dist/src/plugin/background-quota-refresh.d.ts +54 -8
- package/dist/src/plugin/background-quota-refresh.d.ts.map +1 -1
- package/dist/src/plugin/background-quota-refresh.js +81 -24
- package/dist/src/plugin/background-quota-refresh.js.map +1 -1
- 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 +55 -10
- package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
- package/dist/src/plugin/cache/signature-cache.js +100 -41
- package/dist/src/plugin/cache/signature-cache.js.map +1 -1
- package/dist/src/plugin/cache.d.ts +80 -16
- package/dist/src/plugin/cache.d.ts.map +1 -1
- package/dist/src/plugin/cache.js +339 -200
- package/dist/src/plugin/cache.js.map +1 -1
- package/dist/src/plugin/catalog.d.ts +4 -18
- package/dist/src/plugin/catalog.d.ts.map +1 -1
- package/dist/src/plugin/catalog.js +11 -41
- package/dist/src/plugin/catalog.js.map +1 -1
- package/dist/src/plugin/command-apply.d.ts +58 -0
- package/dist/src/plugin/command-apply.d.ts.map +1 -0
- package/dist/src/plugin/command-apply.js +168 -0
- package/dist/src/plugin/command-apply.js.map +1 -0
- package/dist/src/plugin/command-data.d.ts +1 -0
- package/dist/src/plugin/command-data.d.ts.map +1 -1
- package/dist/src/plugin/command-data.js +2 -0
- package/dist/src/plugin/command-data.js.map +1 -1
- package/dist/src/plugin/commands.d.ts +142 -132
- package/dist/src/plugin/commands.d.ts.map +1 -1
- package/dist/src/plugin/commands.js +214 -686
- package/dist/src/plugin/commands.js.map +1 -1
- package/dist/src/plugin/config/index.d.ts +1 -1
- package/dist/src/plugin/config/index.d.ts.map +1 -1
- package/dist/src/plugin/config/index.js +1 -1
- package/dist/src/plugin/config/index.js.map +1 -1
- package/dist/src/plugin/config/loader.d.ts +37 -1
- package/dist/src/plugin/config/loader.d.ts.map +1 -1
- package/dist/src/plugin/config/loader.js +64 -9
- package/dist/src/plugin/config/loader.js.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.d.ts +2 -2
- package/dist/src/plugin/config/schema.d.ts +2 -2
- package/dist/src/plugin/config/writer.d.ts +7 -0
- package/dist/src/plugin/config/writer.d.ts.map +1 -1
- package/dist/src/plugin/config/writer.js +10 -1
- package/dist/src/plugin/config/writer.js.map +1 -1
- package/dist/src/plugin/debug.d.ts +72 -29
- package/dist/src/plugin/debug.d.ts.map +1 -1
- package/dist/src/plugin/debug.js +353 -239
- package/dist/src/plugin/debug.js.map +1 -1
- package/dist/src/plugin/fetch/retry-state.d.ts +1 -1
- package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
- package/dist/src/plugin/fetch/retry-state.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts +66 -11
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +228 -1352
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/fetch-routing.d.ts +7 -2
- package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
- package/dist/src/plugin/fetch-routing.js +7 -4
- package/dist/src/plugin/fetch-routing.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +389 -0
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -0
- package/dist/src/plugin/ga-location-services.js +1838 -0
- package/dist/src/plugin/ga-location-services.js.map +1 -0
- package/dist/src/plugin/gemini-dump.d.ts +37 -12
- package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/src/plugin/gemini-dump.js +42 -21
- package/dist/src/plugin/gemini-dump.js.map +1 -1
- package/dist/src/plugin/google-search-tool.d.ts +2 -1
- package/dist/src/plugin/google-search-tool.d.ts.map +1 -1
- package/dist/src/plugin/google-search-tool.js +4 -1
- package/dist/src/plugin/google-search-tool.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +505 -141
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/killswitch.d.ts +1 -2
- package/dist/src/plugin/killswitch.d.ts.map +1 -1
- package/dist/src/plugin/lifecycle.d.ts +24 -1
- package/dist/src/plugin/lifecycle.d.ts.map +1 -1
- package/dist/src/plugin/lifecycle.js +95 -8
- package/dist/src/plugin/lifecycle.js.map +1 -1
- package/dist/src/plugin/logger.d.ts +61 -10
- package/dist/src/plugin/logger.d.ts.map +1 -1
- package/dist/src/plugin/logger.js +134 -63
- package/dist/src/plugin/logger.js.map +1 -1
- package/dist/src/plugin/neutral-types.d.ts +42 -0
- package/dist/src/plugin/neutral-types.d.ts.map +1 -0
- package/dist/src/plugin/neutral-types.js +12 -0
- package/dist/src/plugin/neutral-types.js.map +1 -0
- package/dist/src/plugin/oauth-methods.d.ts +2 -1
- package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
- package/dist/src/plugin/oauth-methods.js +173 -88
- package/dist/src/plugin/oauth-methods.js.map +1 -1
- package/dist/src/plugin/operator-settings.d.ts +34 -0
- package/dist/src/plugin/operator-settings.d.ts.map +1 -1
- package/dist/src/plugin/operator-settings.js +105 -2
- package/dist/src/plugin/operator-settings.js.map +1 -1
- package/dist/src/plugin/persist-account-pool.d.ts +63 -2
- package/dist/src/plugin/persist-account-pool.d.ts.map +1 -1
- package/dist/src/plugin/persist-account-pool.js +125 -2
- package/dist/src/plugin/persist-account-pool.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +335 -35
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +825 -95
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/refresh-queue.d.ts +35 -5
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
- package/dist/src/plugin/refresh-queue.js +50 -16
- package/dist/src/plugin/refresh-queue.js.map +1 -1
- package/dist/src/plugin/request-helpers.d.ts +30 -5
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +82 -17
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts +63 -15
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +229 -65
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/session-context.d.ts.map +1 -1
- package/dist/src/plugin/session-context.js +5 -2
- package/dist/src/plugin/session-context.js.map +1 -1
- package/dist/src/plugin/shared/local-grant.d.ts +26 -0
- package/dist/src/plugin/shared/local-grant.d.ts.map +1 -0
- package/dist/src/plugin/shared/local-grant.js +19 -0
- package/dist/src/plugin/shared/local-grant.js.map +1 -0
- package/dist/src/plugin/shared/request-cancellation.d.ts +12 -0
- package/dist/src/plugin/shared/request-cancellation.d.ts.map +1 -0
- package/dist/src/plugin/shared/request-cancellation.js +118 -0
- package/dist/src/plugin/shared/request-cancellation.js.map +1 -0
- package/dist/src/plugin/shared/request-services.d.ts +375 -0
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -0
- package/dist/src/plugin/shared/request-services.js +1752 -0
- package/dist/src/plugin/shared/request-services.js.map +1 -0
- package/dist/src/plugin/shared/runtime.d.ts +217 -0
- package/dist/src/plugin/shared/runtime.d.ts.map +1 -0
- package/dist/src/plugin/shared/runtime.js +345 -0
- package/dist/src/plugin/shared/runtime.js.map +1 -0
- package/dist/src/plugin/shared/source-sidebar.d.ts +15 -0
- package/dist/src/plugin/shared/source-sidebar.d.ts.map +1 -0
- package/dist/src/plugin/shared/source-sidebar.js +41 -0
- package/dist/src/plugin/shared/source-sidebar.js.map +1 -0
- package/dist/src/plugin/shared/vault-menu.d.ts +5 -0
- package/dist/src/plugin/shared/vault-menu.d.ts.map +1 -0
- package/dist/src/plugin/shared/vault-menu.js +49 -0
- package/dist/src/plugin/shared/vault-menu.js.map +1 -0
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +168 -0
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -0
- package/dist/src/plugin/shared/vault-request-credentials.js +485 -0
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -0
- package/dist/src/plugin/storage.d.ts +127 -1
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +188 -3
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/token.d.ts +23 -1
- package/dist/src/plugin/token.d.ts.map +1 -1
- package/dist/src/plugin/token.js +117 -58
- package/dist/src/plugin/token.js.map +1 -1
- package/dist/src/plugin/ui/quota-status.d.ts +1 -10
- package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
- package/dist/src/plugin/ui/quota-status.js +6 -42
- package/dist/src/plugin/ui/quota-status.js.map +1 -1
- package/dist/src/plugin/vault-activation.d.ts +11 -0
- package/dist/src/plugin/vault-activation.d.ts.map +1 -0
- package/dist/src/plugin/vault-activation.js +53 -0
- package/dist/src/plugin/vault-activation.js.map +1 -0
- package/dist/src/plugin/vault-custody.d.ts +131 -0
- package/dist/src/plugin/vault-custody.d.ts.map +1 -0
- package/dist/src/plugin/vault-custody.js +381 -0
- package/dist/src/plugin/vault-custody.js.map +1 -0
- package/dist/src/quota-presentation.d.ts +18 -0
- package/dist/src/quota-presentation.d.ts.map +1 -0
- package/dist/src/quota-presentation.js +58 -0
- package/dist/src/quota-presentation.js.map +1 -0
- package/dist/src/rpc/notifications.d.ts +2 -2
- package/dist/src/rpc/notifications.d.ts.map +1 -1
- package/dist/src/rpc/notifications.js +1 -1
- package/dist/src/rpc/notifications.js.map +1 -1
- package/dist/src/rpc/port-file.d.ts +2 -12
- package/dist/src/rpc/port-file.d.ts.map +1 -1
- package/dist/src/rpc/port-file.js +5 -107
- package/dist/src/rpc/port-file.js.map +1 -1
- package/dist/src/rpc/protocol.d.ts +47 -16
- package/dist/src/rpc/protocol.d.ts.map +1 -1
- package/dist/src/rpc/rpc-client.d.ts +27 -3
- package/dist/src/rpc/rpc-client.d.ts.map +1 -1
- package/dist/src/rpc/rpc-client.js +55 -45
- package/dist/src/rpc/rpc-client.js.map +1 -1
- package/dist/src/rpc/rpc-server.d.ts +13 -2
- package/dist/src/rpc/rpc-server.d.ts.map +1 -1
- package/dist/src/rpc/rpc-server.js +38 -212
- package/dist/src/rpc/rpc-server.js.map +1 -1
- package/dist/src/server.d.ts +30 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +29 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/sidebar-projection.d.ts +102 -0
- package/dist/src/sidebar-projection.d.ts.map +1 -0
- package/dist/src/sidebar-projection.js +146 -0
- package/dist/src/sidebar-projection.js.map +1 -0
- package/dist/src/sidebar-state.d.ts +13 -5
- package/dist/src/sidebar-state.d.ts.map +1 -1
- package/dist/src/sidebar-state.js +49 -16
- package/dist/src/sidebar-state.js.map +1 -1
- package/dist/src/tui/command-dialogs.d.ts +58 -52
- package/dist/src/tui/command-dialogs.d.ts.map +1 -1
- package/dist/src/tui/command-dialogs.js +379 -571
- package/dist/src/tui/command-dialogs.js.map +1 -1
- package/dist/src/tui/file-logger.d.ts +2 -3
- package/dist/src/tui/file-logger.d.ts.map +1 -1
- package/dist/src/tui/file-logger.js +21 -7
- package/dist/src/tui/file-logger.js.map +1 -1
- package/dist/src/tui/host-api.d.ts +196 -0
- package/dist/src/tui/host-api.d.ts.map +1 -0
- package/dist/src/tui/host-api.js +357 -0
- package/dist/src/tui/host-api.js.map +1 -0
- package/dist/src/tui/host-v1.d.ts +60 -0
- package/dist/src/tui/host-v1.d.ts.map +1 -0
- package/dist/src/tui/host-v1.js +147 -0
- package/dist/src/tui/host-v1.js.map +1 -0
- package/dist/src/tui/vault-setup.d.ts +98 -0
- package/dist/src/tui/vault-setup.d.ts.map +1 -0
- package/dist/src/tui/vault-setup.js +198 -0
- package/dist/src/tui/vault-setup.js.map +1 -0
- package/dist/src/tui.d.ts +4 -11
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +33 -75
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +380 -0
- package/dist/tui-ga-build-map.json +187 -0
- package/dist/types/src/antigravity/oauth.d.ts +2 -0
- package/dist/types/src/antigravity/oauth.d.ts.map +1 -0
- package/dist/types/src/cli.d.ts +66 -0
- package/dist/types/src/cli.d.ts.map +1 -0
- package/dist/types/src/common-auth-embedded/commands/builtins.d.ts +71 -0
- package/dist/types/src/common-auth-embedded/commands/index.d.ts +10 -0
- package/dist/types/src/common-auth-embedded/commands/menu.d.ts +61 -0
- package/dist/types/src/common-auth-embedded/commands/model.d.ts +238 -0
- package/dist/types/src/common-auth-embedded/commands/pi.d.ts +23 -0
- package/dist/types/src/common-auth-embedded/commands/seam.d.ts +72 -0
- package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
- package/dist/types/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
- package/dist/types/src/common-auth-embedded/logger/engine.d.ts +100 -0
- package/dist/types/src/common-auth-embedded/logger/index.d.ts +6 -0
- package/dist/types/src/common-auth-embedded/logger/redact.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/quota/codec.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/quota/format.d.ts +46 -0
- package/dist/types/src/common-auth-embedded/quota/index.d.ts +10 -0
- package/dist/types/src/common-auth-embedded/quota/map.d.ts +63 -0
- package/dist/types/src/common-auth-embedded/quota/merge.d.ts +48 -0
- package/dist/types/src/common-auth-embedded/quota/projection.d.ts +64 -0
- package/dist/types/src/common-auth-embedded/store/attribution.d.ts +28 -0
- package/dist/types/src/common-auth-embedded/store/errors.d.ts +55 -0
- package/dist/types/src/common-auth-embedded/store/hooks.d.ts +12 -0
- package/dist/types/src/common-auth-embedded/store/identity.d.ts +39 -0
- package/dist/types/src/common-auth-embedded/store/index.d.ts +21 -0
- package/dist/types/src/common-auth-embedded/store/mutate.d.ts +189 -0
- package/dist/types/src/common-auth-embedded/store/pool.d.ts +196 -0
- package/dist/types/src/common-auth-embedded/store/provider-state.d.ts +131 -0
- package/dist/types/src/common-auth-embedded/store/publication.d.ts +47 -0
- package/dist/types/src/common-auth-embedded/store/pull.d.ts +36 -0
- package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
- package/dist/types/src/common-auth-embedded/store/refresh.d.ts +72 -0
- package/dist/types/src/common-auth-embedded/store/rows.d.ts +313 -0
- package/dist/types/src/common-auth-embedded/store/runtime.d.ts +36 -0
- package/dist/types/src/common-auth-embedded/store/schema.d.ts +443 -0
- package/dist/types/src/common-auth-embedded/store/settings.d.ts +63 -0
- package/dist/types/src/common-auth-embedded/store/torn.d.ts +78 -0
- package/dist/types/src/constants.d.ts +3 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/ga/proxy-guard.d.ts +120 -0
- package/dist/types/src/ga/proxy-guard.d.ts.map +1 -0
- package/dist/types/src/ga/rpc/protocol.d.ts +504 -0
- package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -0
- package/dist/types/src/ga/server/auth.d.ts +9 -0
- package/dist/types/src/ga/server/auth.d.ts.map +1 -0
- package/dist/types/src/ga/server/index.d.ts +576 -0
- package/dist/types/src/ga/server/index.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/cache.d.ts +3 -0
- package/dist/types/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/checker.d.ts +16 -0
- package/dist/types/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/constants.d.ts +9 -0
- package/dist/types/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/index.d.ts +34 -0
- package/dist/types/src/hooks/auto-update-checker/index.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/logging.d.ts +3 -0
- package/dist/types/src/hooks/auto-update-checker/logging.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/types.d.ts +25 -0
- package/dist/types/src/hooks/auto-update-checker/types.d.ts.map +1 -0
- package/dist/types/src/logging/provider-key-policy.d.ts +9 -0
- package/dist/types/src/logging/provider-key-policy.d.ts.map +1 -0
- package/dist/types/src/plugin/account-access.d.ts +214 -0
- package/dist/types/src/plugin/account-access.d.ts.map +1 -0
- package/dist/types/src/plugin/account-blocks.d.ts +102 -0
- package/dist/types/src/plugin/account-blocks.d.ts.map +1 -0
- package/dist/types/src/plugin/account-command-oauth.d.ts +34 -0
- package/dist/types/src/plugin/account-command-oauth.d.ts.map +1 -0
- package/dist/types/src/plugin/accounts.d.ts +94 -0
- package/dist/types/src/plugin/accounts.d.ts.map +1 -0
- package/dist/types/src/plugin/agy-request-metadata.d.ts +2 -0
- package/dist/types/src/plugin/agy-request-metadata.d.ts.map +1 -0
- package/dist/types/src/plugin/agy-transport.d.ts +2 -0
- package/dist/types/src/plugin/agy-transport.d.ts.map +1 -0
- package/dist/types/src/plugin/auth-doctor.d.ts +30 -0
- package/dist/types/src/plugin/auth-doctor.d.ts.map +1 -0
- package/dist/types/src/plugin/auth-drift.d.ts +13 -0
- package/dist/types/src/plugin/auth-drift.d.ts.map +1 -0
- package/dist/types/src/plugin/auth-loader.d.ts +114 -0
- package/dist/types/src/plugin/auth-loader.d.ts.map +1 -0
- package/dist/types/src/plugin/auth.d.ts +2 -0
- package/dist/types/src/plugin/auth.d.ts.map +1 -0
- package/dist/types/src/plugin/background-quota-refresh.d.ts +192 -0
- package/dist/types/src/plugin/background-quota-refresh.d.ts.map +1 -0
- package/dist/types/src/plugin/cache/signature-cache.d.ts +156 -0
- package/dist/types/src/plugin/cache/signature-cache.d.ts.map +1 -0
- package/dist/types/src/plugin/cache.d.ts +109 -0
- package/dist/types/src/plugin/cache.d.ts.map +1 -0
- package/dist/types/src/plugin/catalog.d.ts +9 -0
- package/dist/types/src/plugin/catalog.d.ts.map +1 -0
- package/dist/types/src/plugin/cli.d.ts +44 -0
- package/dist/types/src/plugin/cli.d.ts.map +1 -0
- package/dist/types/src/plugin/command-apply.d.ts +58 -0
- package/dist/types/src/plugin/command-apply.d.ts.map +1 -0
- package/dist/types/src/plugin/command-data.d.ts +330 -0
- package/dist/types/src/plugin/command-data.d.ts.map +1 -0
- package/dist/types/src/plugin/commands.d.ts +164 -0
- package/dist/types/src/plugin/commands.d.ts.map +1 -0
- package/dist/types/src/plugin/config/index.d.ts +16 -0
- package/dist/types/src/plugin/config/index.d.ts.map +1 -0
- package/dist/types/src/plugin/config/loader.d.ts +72 -0
- package/dist/types/src/plugin/config/loader.d.ts.map +1 -0
- package/dist/types/src/plugin/config/models.d.ts +3 -0
- package/dist/types/src/plugin/config/models.d.ts.map +1 -0
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts +29 -0
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -0
- package/dist/types/src/plugin/config/schema.d.ts +162 -0
- package/dist/types/src/plugin/config/schema.d.ts.map +1 -0
- package/dist/types/src/plugin/config/updater.d.ts +55 -0
- package/dist/types/src/plugin/config/updater.d.ts.map +1 -0
- package/dist/types/src/plugin/config/writer.d.ts +41 -0
- package/dist/types/src/plugin/config/writer.d.ts.map +1 -0
- package/dist/types/src/plugin/core/streaming/index.d.ts +3 -0
- package/dist/types/src/plugin/core/streaming/index.d.ts.map +1 -0
- package/dist/types/src/plugin/core/streaming/transformer.d.ts +12 -0
- package/dist/types/src/plugin/core/streaming/transformer.d.ts.map +1 -0
- package/dist/types/src/plugin/core/streaming/types.d.ts +34 -0
- package/dist/types/src/plugin/core/streaming/types.d.ts.map +1 -0
- package/dist/types/src/plugin/debug.d.ts +144 -0
- package/dist/types/src/plugin/debug.d.ts.map +1 -0
- package/dist/types/src/plugin/dependencies.d.ts +129 -0
- package/dist/types/src/plugin/dependencies.d.ts.map +1 -0
- package/dist/types/src/plugin/errors.d.ts +55 -0
- package/dist/types/src/plugin/errors.d.ts.map +1 -0
- package/dist/types/src/plugin/event-handler.d.ts +53 -0
- package/dist/types/src/plugin/event-handler.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch/retry-state.d.ts +61 -0
- package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch/warmup.d.ts +30 -0
- package/dist/types/src/plugin/fetch/warmup.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch-interceptor.d.ts +114 -0
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch-routing.d.ts +31 -0
- package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -0
- package/dist/types/src/plugin/fingerprint.d.ts +2 -0
- package/dist/types/src/plugin/fingerprint.d.ts.map +1 -0
- package/dist/types/src/plugin/ga-location-services.d.ts +389 -0
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -0
- package/dist/types/src/plugin/gemini-dump.d.ts +72 -0
- package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -0
- package/dist/types/src/plugin/google-search-tool.d.ts +10 -0
- package/dist/types/src/plugin/google-search-tool.d.ts.map +1 -0
- package/dist/types/src/plugin/image-saver.d.ts +6 -0
- package/dist/types/src/plugin/image-saver.d.ts.map +1 -0
- package/dist/types/src/plugin/index.d.ts +30 -0
- package/dist/types/src/plugin/index.d.ts.map +1 -0
- package/dist/types/src/plugin/killswitch.d.ts +93 -0
- package/dist/types/src/plugin/killswitch.d.ts.map +1 -0
- package/dist/types/src/plugin/lifecycle.d.ts +63 -0
- package/dist/types/src/plugin/lifecycle.d.ts.map +1 -0
- package/dist/types/src/plugin/logger.d.ts +83 -0
- package/dist/types/src/plugin/logger.d.ts.map +1 -0
- package/dist/types/src/plugin/logging-utils.d.ts +57 -0
- package/dist/types/src/plugin/logging-utils.d.ts.map +1 -0
- package/dist/types/src/plugin/model-registry.d.ts +2 -0
- package/dist/types/src/plugin/model-registry.d.ts.map +1 -0
- package/dist/types/src/plugin/neutral-types.d.ts +42 -0
- package/dist/types/src/plugin/neutral-types.d.ts.map +1 -0
- package/dist/types/src/plugin/oauth-login.d.ts +22 -0
- package/dist/types/src/plugin/oauth-login.d.ts.map +1 -0
- package/dist/types/src/plugin/oauth-methods.d.ts +43 -0
- package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -0
- package/dist/types/src/plugin/operator-settings.d.ts +74 -0
- package/dist/types/src/plugin/operator-settings.d.ts.map +1 -0
- package/dist/types/src/plugin/persist-account-pool.d.ts +98 -0
- package/dist/types/src/plugin/persist-account-pool.d.ts.map +1 -0
- package/dist/types/src/plugin/project.d.ts +2 -0
- package/dist/types/src/plugin/project.d.ts.map +1 -0
- package/dist/types/src/plugin/prompt-context.d.ts +18 -0
- package/dist/types/src/plugin/prompt-context.d.ts.map +1 -0
- package/dist/types/src/plugin/quota.d.ts +441 -0
- package/dist/types/src/plugin/quota.d.ts.map +1 -0
- package/dist/types/src/plugin/recovery/constants.d.ts +22 -0
- package/dist/types/src/plugin/recovery/constants.d.ts.map +1 -0
- package/dist/types/src/plugin/recovery/storage.d.ts +24 -0
- package/dist/types/src/plugin/recovery/storage.d.ts.map +1 -0
- package/dist/types/src/plugin/recovery/types.d.ts +116 -0
- package/dist/types/src/plugin/recovery/types.d.ts.map +1 -0
- package/dist/types/src/plugin/recovery.d.ts +61 -0
- package/dist/types/src/plugin/recovery.d.ts.map +1 -0
- package/dist/types/src/plugin/refresh-queue.d.ts +133 -0
- package/dist/types/src/plugin/refresh-queue.d.ts.map +1 -0
- package/dist/types/src/plugin/request-helpers.d.ts +304 -0
- package/dist/types/src/plugin/request-helpers.d.ts.map +1 -0
- package/dist/types/src/plugin/request.d.ts +161 -0
- package/dist/types/src/plugin/request.d.ts.map +1 -0
- package/dist/types/src/plugin/rotation.d.ts +2 -0
- package/dist/types/src/plugin/rotation.d.ts.map +1 -0
- package/dist/types/src/plugin/search.d.ts +25 -0
- package/dist/types/src/plugin/search.d.ts.map +1 -0
- package/dist/types/src/plugin/server.d.ts +23 -0
- package/dist/types/src/plugin/server.d.ts.map +1 -0
- package/dist/types/src/plugin/session-context.d.ts +22 -0
- package/dist/types/src/plugin/session-context.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/local-grant.d.ts +26 -0
- package/dist/types/src/plugin/shared/local-grant.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-cancellation.d.ts +12 -0
- package/dist/types/src/plugin/shared/request-cancellation.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts +375 -0
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/runtime.d.ts +217 -0
- package/dist/types/src/plugin/shared/runtime.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/source-sidebar.d.ts +15 -0
- package/dist/types/src/plugin/shared/source-sidebar.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/vault-menu.d.ts +5 -0
- package/dist/types/src/plugin/shared/vault-menu.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +168 -0
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -0
- package/dist/types/src/plugin/storage.d.ts +221 -0
- package/dist/types/src/plugin/storage.d.ts.map +1 -0
- package/dist/types/src/plugin/stores/signature-store.d.ts +5 -0
- package/dist/types/src/plugin/stores/signature-store.d.ts.map +1 -0
- package/dist/types/src/plugin/thinking-recovery.d.ts +90 -0
- package/dist/types/src/plugin/thinking-recovery.d.ts.map +1 -0
- package/dist/types/src/plugin/token.d.ts +41 -0
- package/dist/types/src/plugin/token.d.ts.map +1 -0
- package/dist/types/src/plugin/transform/cross-model-sanitizer.d.ts +2 -0
- package/dist/types/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
- package/dist/types/src/plugin/transform/index.d.ts +2 -0
- package/dist/types/src/plugin/transform/index.d.ts.map +1 -0
- package/dist/types/src/plugin/transform/model-resolver.d.ts +2 -0
- package/dist/types/src/plugin/transform/model-resolver.d.ts.map +1 -0
- package/dist/types/src/plugin/transform/types.d.ts +2 -0
- package/dist/types/src/plugin/transform/types.d.ts.map +1 -0
- package/dist/types/src/plugin/types.d.ts +36 -0
- package/dist/types/src/plugin/types.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/ansi.d.ts +32 -0
- package/dist/types/src/plugin/ui/ansi.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/auth-menu.d.ts +59 -0
- package/dist/types/src/plugin/ui/auth-menu.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/confirm.d.ts +2 -0
- package/dist/types/src/plugin/ui/confirm.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/quota-status.d.ts +73 -0
- package/dist/types/src/plugin/ui/quota-status.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/select.d.ts +23 -0
- package/dist/types/src/plugin/ui/select.d.ts.map +1 -0
- package/dist/types/src/plugin/vault-activation.d.ts +11 -0
- package/dist/types/src/plugin/vault-activation.d.ts.map +1 -0
- package/dist/types/src/plugin/vault-custody.d.ts +131 -0
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -0
- package/dist/types/src/plugin/version.d.ts +2 -0
- package/dist/types/src/plugin/version.d.ts.map +1 -0
- package/dist/types/src/quota-presentation.d.ts +18 -0
- package/dist/types/src/quota-presentation.d.ts.map +1 -0
- package/dist/types/src/rpc/notifications.d.ts +6 -0
- package/dist/types/src/rpc/notifications.d.ts.map +1 -0
- package/dist/types/src/rpc/protocol.d.ts +53 -0
- package/dist/types/src/rpc/protocol.d.ts.map +1 -0
- package/dist/types/src/rpc/rpc-dir.d.ts +4 -0
- package/dist/types/src/rpc/rpc-dir.d.ts.map +1 -0
- package/dist/types/src/rpc/rpc-server.d.ts +24 -0
- package/dist/types/src/rpc/rpc-server.d.ts.map +1 -0
- package/dist/types/src/server.d.ts +30 -0
- package/dist/types/src/server.d.ts.map +1 -0
- package/dist/types/src/sidebar-state.d.ts +365 -0
- package/dist/types/src/sidebar-state.d.ts.map +1 -0
- package/dist/types/src/tui/host-api.d.ts +196 -0
- package/dist/types/src/tui/host-api.d.ts.map +1 -0
- package/package.json +46 -19
- package/server.js +6 -0
- package/src/common-auth-embedded/NOTICE.txt +21 -0
- package/src/common-auth-embedded/auth-menu/accounts.d.ts +97 -0
- package/src/common-auth-embedded/auth-menu/accounts.js +387 -0
- package/src/common-auth-embedded/auth-menu/ansi.d.ts +26 -0
- package/src/common-auth-embedded/auth-menu/ansi.js +98 -0
- package/src/common-auth-embedded/auth-menu/confirm.d.ts +7 -0
- package/src/common-auth-embedded/auth-menu/confirm.js +21 -0
- package/src/common-auth-embedded/auth-menu/doctor.d.ts +52 -0
- package/src/common-auth-embedded/auth-menu/doctor.js +81 -0
- package/src/common-auth-embedded/auth-menu/index.d.ts +17 -0
- package/src/common-auth-embedded/auth-menu/index.js +12 -0
- package/src/common-auth-embedded/auth-menu/login.d.ts +55 -0
- package/src/common-auth-embedded/auth-menu/login.js +83 -0
- package/src/common-auth-embedded/auth-menu/menu.d.ts +59 -0
- package/src/common-auth-embedded/auth-menu/menu.js +73 -0
- package/src/common-auth-embedded/auth-menu/opencode-v1.d.ts +49 -0
- package/src/common-auth-embedded/auth-menu/opencode-v1.js +47 -0
- package/src/common-auth-embedded/auth-menu/select.d.ts +21 -0
- package/src/common-auth-embedded/auth-menu/select.js +159 -0
- package/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
- package/src/common-auth-embedded/auth-menu/terminal.js +19 -0
- package/src/common-auth-embedded/claustrum/consumer.d.ts +102 -0
- package/src/common-auth-embedded/claustrum/consumer.js +298 -0
- package/src/common-auth-embedded/claustrum/custody.d.ts +175 -0
- package/src/common-auth-embedded/claustrum/custody.js +354 -0
- package/src/common-auth-embedded/claustrum/enrollment.d.ts +158 -0
- package/src/common-auth-embedded/claustrum/enrollment.js +759 -0
- package/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
- package/src/common-auth-embedded/claustrum/errors.js +8 -0
- package/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
- package/src/common-auth-embedded/claustrum/host-slot.js +72 -0
- package/src/common-auth-embedded/claustrum/index.d.ts +18 -0
- package/src/common-auth-embedded/claustrum/index.js +22 -0
- package/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
- package/src/common-auth-embedded/claustrum/interlock.js +29 -0
- package/src/common-auth-embedded/claustrum/roster.d.ts +208 -0
- package/src/common-auth-embedded/claustrum/roster.js +536 -0
- package/src/common-auth-embedded/commands/builtins.d.ts +71 -0
- package/src/common-auth-embedded/commands/builtins.js +534 -0
- package/src/common-auth-embedded/commands/index.d.ts +10 -0
- package/src/common-auth-embedded/commands/index.js +5 -0
- package/src/common-auth-embedded/commands/menu.d.ts +61 -0
- package/src/common-auth-embedded/commands/menu.js +300 -0
- package/src/common-auth-embedded/commands/model.d.ts +238 -0
- package/src/common-auth-embedded/commands/model.js +16 -0
- package/src/common-auth-embedded/commands/pi.d.ts +23 -0
- package/src/common-auth-embedded/commands/pi.js +206 -0
- package/src/common-auth-embedded/commands/seam.d.ts +72 -0
- package/src/common-auth-embedded/commands/seam.js +301 -0
- package/src/common-auth-embedded/fs/atomic-write.d.ts +20 -0
- package/src/common-auth-embedded/fs/atomic-write.js +80 -0
- package/src/common-auth-embedded/fs/index.d.ts +7 -0
- package/src/common-auth-embedded/fs/index.js +6 -0
- package/src/common-auth-embedded/fs/lock-constants.d.ts +14 -0
- package/src/common-auth-embedded/fs/lock-constants.js +14 -0
- package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
- package/src/common-auth-embedded/fs/refresh-file-lock.js +501 -0
- package/src/common-auth-embedded/fs/with-lock.d.ts +33 -0
- package/src/common-auth-embedded/fs/with-lock.js +48 -0
- package/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
- package/src/common-auth-embedded/logger/capture-sink.js +13 -0
- package/src/common-auth-embedded/logger/engine.d.ts +100 -0
- package/src/common-auth-embedded/logger/engine.js +246 -0
- package/src/common-auth-embedded/logger/index.d.ts +6 -0
- package/src/common-auth-embedded/logger/index.js +3 -0
- package/src/common-auth-embedded/logger/redact.d.ts +11 -0
- package/src/common-auth-embedded/logger/redact.js +83 -0
- package/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
- package/src/common-auth-embedded/opencode2/errors.js +15 -0
- package/src/common-auth-embedded/opencode2/index.d.ts +8 -0
- package/src/common-auth-embedded/opencode2/index.js +4 -0
- package/src/common-auth-embedded/opencode2/install.d.ts +55 -0
- package/src/common-auth-embedded/opencode2/install.js +886 -0
- package/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
- package/src/common-auth-embedded/opencode2/integration.js +143 -0
- package/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
- package/src/common-auth-embedded/opencode2/sse.js +60 -0
- package/src/common-auth-embedded/opencode2/types.d.ts +413 -0
- package/src/common-auth-embedded/pi-slot/index.d.ts +3 -0
- package/src/common-auth-embedded/pi-slot/index.js +2 -0
- package/src/common-auth-embedded/pi-slot/lock.js +212 -0
- package/src/common-auth-embedded/pi-slot/slot.d.ts +49 -0
- package/src/common-auth-embedded/pi-slot/slot.js +383 -0
- package/src/common-auth-embedded/quota/codec.d.ts +11 -0
- package/src/common-auth-embedded/quota/codec.js +12 -0
- package/src/common-auth-embedded/quota/format.d.ts +46 -0
- package/src/common-auth-embedded/quota/format.js +138 -0
- package/src/common-auth-embedded/quota/index.d.ts +10 -0
- package/src/common-auth-embedded/quota/index.js +5 -0
- package/src/common-auth-embedded/quota/map.d.ts +63 -0
- package/src/common-auth-embedded/quota/map.js +105 -0
- package/src/common-auth-embedded/quota/merge.d.ts +48 -0
- package/src/common-auth-embedded/quota/merge.js +162 -0
- package/src/common-auth-embedded/quota/projection.d.ts +64 -0
- package/src/common-auth-embedded/quota/projection.js +134 -0
- package/src/common-auth-embedded/routing/admission.d.ts +93 -0
- package/src/common-auth-embedded/routing/admission.js +142 -0
- package/src/common-auth-embedded/routing/index.d.ts +8 -0
- package/src/common-auth-embedded/routing/index.js +4 -0
- package/src/common-auth-embedded/routing/ordered.d.ts +47 -0
- package/src/common-auth-embedded/routing/ordered.js +58 -0
- package/src/common-auth-embedded/routing/pins.d.ts +22 -0
- package/src/common-auth-embedded/routing/pins.js +34 -0
- package/src/common-auth-embedded/routing/sticky.d.ts +158 -0
- package/src/common-auth-embedded/routing/sticky.js +339 -0
- package/src/common-auth-embedded/rpc/client.d.ts +3 -0
- package/src/common-auth-embedded/rpc/client.js +2 -0
- package/src/common-auth-embedded/rpc/index.d.ts +10 -0
- package/src/common-auth-embedded/rpc/index.js +5 -0
- package/src/common-auth-embedded/rpc/notifications.d.ts +73 -0
- package/src/common-auth-embedded/rpc/notifications.js +100 -0
- package/src/common-auth-embedded/rpc/port-file.d.ts +33 -0
- package/src/common-auth-embedded/rpc/port-file.js +217 -0
- package/src/common-auth-embedded/rpc/rpc-client.d.ts +30 -0
- package/src/common-auth-embedded/rpc/rpc-client.js +253 -0
- package/src/common-auth-embedded/rpc/rpc-server.d.ts +58 -0
- package/src/common-auth-embedded/rpc/rpc-server.js +311 -0
- package/src/common-auth-embedded/rpc/server-registry.d.ts +11 -0
- package/src/common-auth-embedded/rpc/server-registry.js +47 -0
- package/src/common-auth-embedded/source-output.json +1326 -0
- package/src/common-auth-embedded/store/attribution.d.ts +28 -0
- package/src/common-auth-embedded/store/attribution.js +60 -0
- package/src/common-auth-embedded/store/errors.d.ts +55 -0
- package/src/common-auth-embedded/store/errors.js +38 -0
- package/src/common-auth-embedded/store/hooks.d.ts +12 -0
- package/src/common-auth-embedded/store/hooks.js +34 -0
- package/src/common-auth-embedded/store/identity.d.ts +39 -0
- package/src/common-auth-embedded/store/identity.js +79 -0
- package/src/common-auth-embedded/store/index.d.ts +21 -0
- package/src/common-auth-embedded/store/index.js +7 -0
- package/src/common-auth-embedded/store/mutate.d.ts +189 -0
- package/src/common-auth-embedded/store/mutate.js +500 -0
- package/src/common-auth-embedded/store/pool.d.ts +196 -0
- package/src/common-auth-embedded/store/pool.js +120 -0
- package/src/common-auth-embedded/store/provider-state.d.ts +131 -0
- package/src/common-auth-embedded/store/provider-state.js +226 -0
- package/src/common-auth-embedded/store/publication.d.ts +47 -0
- package/src/common-auth-embedded/store/publication.js +304 -0
- package/src/common-auth-embedded/store/pull.d.ts +36 -0
- package/src/common-auth-embedded/store/pull.js +143 -0
- package/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
- package/src/common-auth-embedded/store/refresh-lock.js +136 -0
- package/src/common-auth-embedded/store/refresh.d.ts +72 -0
- package/src/common-auth-embedded/store/refresh.js +225 -0
- package/src/common-auth-embedded/store/reserved.js +13 -0
- package/src/common-auth-embedded/store/rows.d.ts +313 -0
- package/src/common-auth-embedded/store/rows.js +1258 -0
- package/src/common-auth-embedded/store/runtime.d.ts +36 -0
- package/src/common-auth-embedded/store/runtime.js +68 -0
- package/src/common-auth-embedded/store/schema.d.ts +443 -0
- package/src/common-auth-embedded/store/schema.js +754 -0
- package/src/common-auth-embedded/store/settings.d.ts +63 -0
- package/src/common-auth-embedded/store/settings.js +120 -0
- package/src/common-auth-embedded/store/torn.d.ts +78 -0
- package/src/common-auth-embedded/store/torn.js +294 -0
- package/src/common-auth-embedded/tui/index.d.ts +8 -0
- package/src/common-auth-embedded/tui/index.js +21 -0
- package/src/common-auth-embedded/util/any-signal.js +42 -0
- package/src/plugin/command-data.ts +3 -0
- package/src/rpc/port-file.ts +6 -140
- package/src/rpc/protocol.ts +59 -24
- package/src/rpc/rpc-client.ts +101 -71
- package/src/sidebar-state.ts +82 -24
- package/src/tui/command-dialogs.tsx +412 -776
- package/src/tui/entry.d.mts +17 -0
- package/src/tui/entry.mjs +34 -66
- package/src/tui/file-logger.ts +22 -7
- package/src/tui-compiled/common-auth-embedded/logger/capture-sink.js +13 -0
- package/src/tui-compiled/common-auth-embedded/logger/engine.js +246 -0
- package/src/tui-compiled/common-auth-embedded/logger/index.js +3 -0
- package/src/tui-compiled/common-auth-embedded/logger/redact.js +83 -0
- package/src/tui-compiled/common-auth-embedded/quota/codec.js +12 -0
- package/src/tui-compiled/common-auth-embedded/quota/format.js +138 -0
- package/src/tui-compiled/common-auth-embedded/quota/index.js +5 -0
- package/src/tui-compiled/common-auth-embedded/quota/map.js +105 -0
- package/src/tui-compiled/common-auth-embedded/quota/merge.js +162 -0
- package/src/tui-compiled/common-auth-embedded/quota/projection.js +134 -0
- package/src/tui-compiled/common-auth-embedded/rpc/client.js +2 -0
- package/src/tui-compiled/common-auth-embedded/rpc/port-file.js +217 -0
- package/src/tui-compiled/common-auth-embedded/rpc/rpc-client.js +253 -0
- package/src/tui-compiled/logging/provider-key-policy.js +3 -0
- package/src/tui-compiled/quota-presentation.js +42 -0
- package/src/tui-compiled/rpc/rpc-client.js +35 -0
- package/src/tui-compiled/rpc/rpc-dir.js +13 -0
- package/src/tui-compiled/selector.js +21 -0
- package/src/tui-compiled/sidebar-state.js +401 -0
- package/src/tui-compiled/tui/command-dialogs.js +424 -0
- package/src/tui-compiled/tui/file-logger.js +73 -0
- package/src/tui-compiled/tui/host-api.js +269 -0
- package/src/tui-compiled/tui/host-v1.js +228 -0
- package/src/tui-compiled/tui-preferences.js +230 -0
- package/src/tui-compiled/{tui.tsx → tui.js} +140 -231
- package/src/tui-ga-compiled/host-ga.js +1304 -0
- package/src/tui-ga-compiled/selector.js +21 -0
- package/src/tui-ga-compiled/shared/07365a7d2ccade4c-host-api.js +269 -0
- package/src/tui-ga-compiled/shared/0e19a88ff3535906-command-dialogs.js +424 -0
- package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +134 -0
- package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +105 -0
- package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +112 -0
- package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -0
- package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +138 -0
- package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +5 -0
- package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +12 -0
- package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +162 -0
- package/src/tui-ga-raw/host-ga.tsx +1740 -0
- package/src/tui-ga-raw/selector.js +21 -0
- package/src/tui-ga-raw/shared/07365a7d2ccade4c-host-api.js +269 -0
- package/src/tui-ga-raw/shared/0e19a88ff3535906-command-dialogs.tsx +468 -0
- package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +134 -0
- package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +105 -0
- package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +112 -0
- package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -0
- package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +138 -0
- package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +5 -0
- package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +12 -0
- package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +162 -0
- package/src/tui-raw/common-auth-embedded/logger/capture-sink.js +13 -0
- package/src/tui-raw/common-auth-embedded/logger/engine.js +246 -0
- package/src/tui-raw/common-auth-embedded/logger/index.js +3 -0
- package/src/tui-raw/common-auth-embedded/logger/redact.js +83 -0
- package/src/tui-raw/common-auth-embedded/quota/codec.js +12 -0
- package/src/tui-raw/common-auth-embedded/quota/format.js +138 -0
- package/src/tui-raw/common-auth-embedded/quota/index.js +5 -0
- package/src/tui-raw/common-auth-embedded/quota/map.js +105 -0
- package/src/tui-raw/common-auth-embedded/quota/merge.js +162 -0
- package/src/tui-raw/common-auth-embedded/quota/projection.js +134 -0
- package/src/tui-raw/common-auth-embedded/rpc/client.js +2 -0
- package/src/tui-raw/common-auth-embedded/rpc/port-file.js +217 -0
- package/src/tui-raw/common-auth-embedded/rpc/rpc-client.js +253 -0
- package/src/tui-raw/logging/provider-key-policy.js +3 -0
- package/src/tui-raw/quota-presentation.js +42 -0
- package/src/tui-raw/rpc/rpc-client.js +35 -0
- package/src/tui-raw/rpc/rpc-dir.js +13 -0
- package/src/tui-raw/selector.js +21 -0
- package/src/tui-raw/sidebar-state.js +401 -0
- package/src/tui-raw/tui/command-dialogs.tsx +468 -0
- package/src/tui-raw/tui/file-logger.js +73 -0
- package/src/tui-raw/tui/host-api.js +269 -0
- package/src/tui-raw/tui/host-v1.tsx +249 -0
- package/src/tui-raw/tui-preferences.js +230 -0
- package/src/tui-raw/tui.tsx +1088 -0
- package/src/tui.tsx +58 -141
- package/tui.js +6 -0
- package/src/tui-compiled/plugin/command-data.ts +0 -931
- package/src/tui-compiled/rpc/port-file.ts +0 -143
- package/src/tui-compiled/rpc/protocol.ts +0 -31
- package/src/tui-compiled/rpc/rpc-client.ts +0 -102
- package/src/tui-compiled/rpc/rpc-dir.ts +0 -24
- package/src/tui-compiled/sidebar-state.ts +0 -991
- package/src/tui-compiled/tui/command-dialogs.tsx +0 -779
- package/src/tui-compiled/tui/file-logger.ts +0 -145
- package/src/tui-compiled/tui-preferences.ts +0 -416
|
@@ -0,0 +1,1012 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode 2 (2.0.22) server plugin. It sends the host's Google model
|
|
3
|
+
* requests for this plugin's models to Antigravity accounts through a
|
|
4
|
+
* loopback bridge, and serves the `antigravity-auth` v1 RPC with each
|
|
5
|
+
* location's account state and commands. `createGaAntigravityPlugin` is the
|
|
6
|
+
* plugin the host loads; `createGaPluginFromServices` builds one over a
|
|
7
|
+
* given location-services factory. Host SDK imports are type-only.
|
|
8
|
+
*/
|
|
9
|
+
import { randomUUID } from 'node:crypto';
|
|
10
|
+
import { createServer, } from 'node:http';
|
|
11
|
+
import { buildAntigravityHarnessUserAgent, fetchWithAgyCliTransport, getPublicModelDefinitions, loadCommonAuthCommands, } from '@cortexkit/antigravity-auth-core';
|
|
12
|
+
import { createGaLocationServices } from "../../plugin/ga-location-services.js";
|
|
13
|
+
import { createLocationRuntime, } from "../../plugin/shared/runtime.js";
|
|
14
|
+
import { redactAccountForSidebar, } from "../../sidebar-state.js";
|
|
15
|
+
import { assertLoopbackProxyGuard, } from "../proxy-guard.js";
|
|
16
|
+
import { ANTIGRAVITY_MENU_COMMAND_NAME, ANTIGRAVITY_RPC_DEFINITION, ANTIGRAVITY_RPC_LIMITS, ANTIGRAVITY_RPC_VERSION, AntigravityApplyInputSchema, AntigravityApplyOutputSchema, AntigravityApplyResultSchema, AntigravityNotificationPayloadSchema, AntigravityStateInputSchema, AntigravityStateOutputSchema, } from "../rpc/protocol.js";
|
|
17
|
+
import { registerGaVaultActivation } from "./auth.js";
|
|
18
|
+
// Raw request sender
|
|
19
|
+
/**
|
|
20
|
+
* How long a response body may stall with no bytes before the raw sender
|
|
21
|
+
* destroys the socket: five minutes, unchanged from the retired OpenCode 2
|
|
22
|
+
* beta adapter this plugin replaces.
|
|
23
|
+
*/
|
|
24
|
+
export const GA_RAW_IDLE_TIMEOUT_MS = 300_000;
|
|
25
|
+
/** The Antigravity streaming endpoint path appended to an endpoint origin. */
|
|
26
|
+
export const GA_STREAM_PATH = '/v1internal:streamGenerateContent?alt=sse';
|
|
27
|
+
/**
|
|
28
|
+
* Choose the dispatch for one activation. With a `send` override, requests
|
|
29
|
+
* go to it and the observer is never called. Otherwise each request builds
|
|
30
|
+
* one transport-options object, hands its `signal` property to the observer
|
|
31
|
+
* synchronously, and passes that same object to the unchanged production
|
|
32
|
+
* sender. The observer cannot change the dispatch: its result is ignored
|
|
33
|
+
* and a synchronous throw is swallowed.
|
|
34
|
+
*/
|
|
35
|
+
export function createGaRawSender(overrides = {}) {
|
|
36
|
+
const send = overrides.send;
|
|
37
|
+
if (send)
|
|
38
|
+
return (input) => send(input);
|
|
39
|
+
const observe = overrides.observeRawSenderSignal;
|
|
40
|
+
return (input) => {
|
|
41
|
+
const transportOptions = {
|
|
42
|
+
signal: input.signal,
|
|
43
|
+
idleTimeoutMs: GA_RAW_IDLE_TIMEOUT_MS,
|
|
44
|
+
};
|
|
45
|
+
if (observe) {
|
|
46
|
+
try {
|
|
47
|
+
observe(transportOptions.signal);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
// A diagnostic failure must not change or delay the dispatch.
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return fetchWithAgyCliTransport(`${input.endpoint}${GA_STREAM_PATH}`, {
|
|
54
|
+
method: 'POST',
|
|
55
|
+
headers: {
|
|
56
|
+
Authorization: `Bearer ${input.auth.access}`,
|
|
57
|
+
'Content-Type': 'application/json',
|
|
58
|
+
'Accept-Encoding': 'gzip',
|
|
59
|
+
'User-Agent': buildAntigravityHarnessUserAgent(),
|
|
60
|
+
},
|
|
61
|
+
body: JSON.stringify(input.envelope),
|
|
62
|
+
}, transportOptions);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// Loopback bridge
|
|
66
|
+
/**
|
|
67
|
+
* Native Google content requests the request hook may rewrite: POST to
|
|
68
|
+
* `…/models/<id>:generateContent` or `…:streamGenerateContent`.
|
|
69
|
+
*/
|
|
70
|
+
export const GA_GOOGLE_CONTENT_PATH = /^\/[^?#]*\/models\/[^/:]+:(generateContent|streamGenerateContent)$/;
|
|
71
|
+
const BRIDGE_HOST = '127.0.0.1';
|
|
72
|
+
/**
|
|
73
|
+
* Job ids are lowercase RFC 4122 UUIDs. End-to-end tests that measure how the
|
|
74
|
+
* host sends the rewritten request match its path against
|
|
75
|
+
* `^/agy/[0-9a-f-]{36}$` (`packages/e2e-tests/docker/ga-loopback-request-contract.ts`),
|
|
76
|
+
* so a different id format would no longer be recognised as a bridge job.
|
|
77
|
+
*/
|
|
78
|
+
const JOB_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
79
|
+
const JOB_PATH_PATTERN = /^\/agy\/([^/]+)$/;
|
|
80
|
+
/** A registered job the host never dispatched is dropped after this long. */
|
|
81
|
+
export const GA_UNCLAIMED_JOB_TTL_MS = 60_000;
|
|
82
|
+
export function isGaGoogleContentRequest(request) {
|
|
83
|
+
if (request.method !== 'POST')
|
|
84
|
+
return false;
|
|
85
|
+
try {
|
|
86
|
+
return GA_GOOGLE_CONTENT_PATH.test(new URL(request.url).pathname);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** The HTTP 502 answer for a terminal failure before upstream headers. */
|
|
93
|
+
export function gaPreHeaderFailureResponse(error) {
|
|
94
|
+
const message = error instanceof Error && error.message
|
|
95
|
+
? error.message
|
|
96
|
+
: 'Antigravity request failed before a response arrived';
|
|
97
|
+
return new Response(JSON.stringify({ error: { code: 502, message, status: 'UNAVAILABLE' } }), { status: 502, headers: { 'content-type': 'application/json' } });
|
|
98
|
+
}
|
|
99
|
+
export async function startGaLoopbackBridge(options) {
|
|
100
|
+
const queued = new Map();
|
|
101
|
+
const running = new Set();
|
|
102
|
+
const sockets = new Set();
|
|
103
|
+
// Post-header failures by job id, held until the job's adapted response
|
|
104
|
+
// reads them or the hold expires.
|
|
105
|
+
const failures = new Map();
|
|
106
|
+
const recordFailure = (id, error) => {
|
|
107
|
+
const timer = setTimeout(() => failures.delete(id), GA_UNCLAIMED_JOB_TTL_MS);
|
|
108
|
+
timer.unref?.();
|
|
109
|
+
failures.set(id, { error, timer });
|
|
110
|
+
};
|
|
111
|
+
const takeFailure = (id) => {
|
|
112
|
+
const entry = failures.get(id);
|
|
113
|
+
if (!entry)
|
|
114
|
+
return undefined;
|
|
115
|
+
clearTimeout(entry.timer);
|
|
116
|
+
failures.delete(id);
|
|
117
|
+
return entry.error;
|
|
118
|
+
};
|
|
119
|
+
let disposal = null;
|
|
120
|
+
const report = (message) => {
|
|
121
|
+
try {
|
|
122
|
+
options.onError?.(message);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// Reporting is best-effort.
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const server = createServer((request, response) => {
|
|
129
|
+
void handle(request, response).catch((error) => {
|
|
130
|
+
report(`bridge request failed: ${errorMessage(error)}`);
|
|
131
|
+
if (!response.headersSent) {
|
|
132
|
+
writeResponseHead(response, 500, 'application/json');
|
|
133
|
+
response.end(JSON.stringify({ error: { message: 'bridge failure' } }));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
response.destroy();
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
server.on('connection', (socket) => {
|
|
141
|
+
sockets.add(socket);
|
|
142
|
+
socket.once('close', () => sockets.delete(socket));
|
|
143
|
+
});
|
|
144
|
+
const handle = async (request, response) => {
|
|
145
|
+
const match = JOB_PATH_PATTERN.exec(new URL(request.url ?? '/', 'http://bridge').pathname);
|
|
146
|
+
const candidate = match?.[1];
|
|
147
|
+
const id = candidate !== undefined && isGaJobId(candidate) ? candidate : null;
|
|
148
|
+
const entry = id ? queued.get(id) : undefined;
|
|
149
|
+
// The body is always `{}`; read and ignore it so the socket stays usable.
|
|
150
|
+
request.resume();
|
|
151
|
+
if (request.method !== 'POST' || !id || !entry || disposal) {
|
|
152
|
+
writeResponseHead(response, 404, 'application/json');
|
|
153
|
+
response.end(JSON.stringify({ error: { message: 'unknown job' } }));
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// A job runs at most once.
|
|
157
|
+
queued.delete(id);
|
|
158
|
+
clearTimeout(entry.timer);
|
|
159
|
+
const controller = new AbortController();
|
|
160
|
+
running.add(controller);
|
|
161
|
+
response.once('close', () => {
|
|
162
|
+
if (!response.writableFinished) {
|
|
163
|
+
controller.abort(new Error('The host closed the loopback request'));
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
try {
|
|
167
|
+
let upstream;
|
|
168
|
+
try {
|
|
169
|
+
upstream = await options.execute(entry.job, {
|
|
170
|
+
signal: controller.signal,
|
|
171
|
+
send: options.send,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
upstream = gaPreHeaderFailureResponse(error);
|
|
176
|
+
}
|
|
177
|
+
await pipeResponse(upstream, response, (error) => recordFailure(id, error));
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
running.delete(controller);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
await new Promise((resolve, reject) => {
|
|
184
|
+
server.once('error', reject);
|
|
185
|
+
server.listen(0, BRIDGE_HOST, () => {
|
|
186
|
+
server.off('error', reject);
|
|
187
|
+
resolve();
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
// The bridge must never be what keeps an idle host process alive.
|
|
191
|
+
server.unref();
|
|
192
|
+
const address = server.address();
|
|
193
|
+
const origin = `http://${BRIDGE_HOST}:${address.port}`;
|
|
194
|
+
return {
|
|
195
|
+
port: address.port,
|
|
196
|
+
origin,
|
|
197
|
+
rewrite(original, job, env) {
|
|
198
|
+
if (disposal)
|
|
199
|
+
throw new Error('The Antigravity bridge is disposed');
|
|
200
|
+
const id = randomUUID();
|
|
201
|
+
const target = `${origin}/agy/${id}`;
|
|
202
|
+
assertLoopbackProxyGuard({ env, target });
|
|
203
|
+
const timer = setTimeout(() => {
|
|
204
|
+
queued.delete(id);
|
|
205
|
+
}, GA_UNCLAIMED_JOB_TTL_MS);
|
|
206
|
+
timer.unref?.();
|
|
207
|
+
queued.set(id, { job, timer });
|
|
208
|
+
return new Request(target, {
|
|
209
|
+
method: 'POST',
|
|
210
|
+
headers: { 'content-type': 'application/json' },
|
|
211
|
+
body: '{}',
|
|
212
|
+
signal: original.signal,
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
adaptResponse(request, response) {
|
|
216
|
+
let url;
|
|
217
|
+
try {
|
|
218
|
+
url = new URL(request.url);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
if (url.origin !== origin)
|
|
224
|
+
return null;
|
|
225
|
+
const candidate = JOB_PATH_PATTERN.exec(url.pathname)?.[1];
|
|
226
|
+
if (candidate === undefined || !isGaJobId(candidate))
|
|
227
|
+
return null;
|
|
228
|
+
const id = candidate;
|
|
229
|
+
const source = response.body;
|
|
230
|
+
if (!source)
|
|
231
|
+
return null;
|
|
232
|
+
const reader = source.getReader();
|
|
233
|
+
const body = new ReadableStream({
|
|
234
|
+
async pull(controller) {
|
|
235
|
+
try {
|
|
236
|
+
const { done, value } = await reader.read();
|
|
237
|
+
if (done) {
|
|
238
|
+
// The bridge ends a failed job's loopback body cleanly after
|
|
239
|
+
// its last byte and records the failure first, so the end of
|
|
240
|
+
// the body is where the genuine error is delivered.
|
|
241
|
+
const failure = takeFailure(id);
|
|
242
|
+
if (failure)
|
|
243
|
+
controller.error(failure);
|
|
244
|
+
else
|
|
245
|
+
controller.close();
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
controller.enqueue(value);
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
controller.error(takeFailure(id) ?? error);
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
cancel(reason) {
|
|
255
|
+
takeFailure(id);
|
|
256
|
+
return reader.cancel(reason);
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
return new Response(body, {
|
|
260
|
+
status: response.status,
|
|
261
|
+
statusText: response.statusText,
|
|
262
|
+
headers: response.headers,
|
|
263
|
+
});
|
|
264
|
+
},
|
|
265
|
+
pendingJobs: () => queued.size + running.size,
|
|
266
|
+
dispose() {
|
|
267
|
+
if (!disposal) {
|
|
268
|
+
disposal = (async () => {
|
|
269
|
+
for (const { timer } of queued.values())
|
|
270
|
+
clearTimeout(timer);
|
|
271
|
+
queued.clear();
|
|
272
|
+
for (const { timer } of failures.values())
|
|
273
|
+
clearTimeout(timer);
|
|
274
|
+
failures.clear();
|
|
275
|
+
const closed = new Promise((resolve) => {
|
|
276
|
+
server.close(() => resolve());
|
|
277
|
+
});
|
|
278
|
+
for (const controller of running) {
|
|
279
|
+
controller.abort(new Error('The Antigravity activation was disposed'));
|
|
280
|
+
}
|
|
281
|
+
for (const socket of sockets)
|
|
282
|
+
socket.destroy();
|
|
283
|
+
await closed;
|
|
284
|
+
})();
|
|
285
|
+
}
|
|
286
|
+
return disposal;
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/** Accept only job IDs produced by request rewrite. */
|
|
291
|
+
export function isGaJobId(value) {
|
|
292
|
+
return JOB_ID_PATTERN.test(value);
|
|
293
|
+
}
|
|
294
|
+
function writeResponseHead(response, status, contentType) {
|
|
295
|
+
response.writeHead(status, {
|
|
296
|
+
'content-type': contentType,
|
|
297
|
+
'cache-control': 'no-cache',
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Stream a Response to the loopback client. Bytes pass through unchanged,
|
|
302
|
+
* except that an event stream ending without its final blank line gets one,
|
|
303
|
+
* so the host's SSE reader sees the last frame.
|
|
304
|
+
*
|
|
305
|
+
* When the upstream body fails, the failure is handed to `onFailure` first,
|
|
306
|
+
* and then the loopback response is ended normally: the status, the headers
|
|
307
|
+
* and every byte already written still reach the host. The job's
|
|
308
|
+
* `http.response` adapter turns that end into the genuine error, so the host
|
|
309
|
+
* receives the real content followed by the original failure, and never a
|
|
310
|
+
* fabricated success. Setup registers that adapter before the request hook,
|
|
311
|
+
* so every rewritten job has it.
|
|
312
|
+
*
|
|
313
|
+
* The response is not destroyed on failure. Bun's `ServerResponse` calls a
|
|
314
|
+
* write's callback while the bytes are still in the response's own buffer
|
|
315
|
+
* (its `writableLength` has not dropped yet), and destroying it then
|
|
316
|
+
* discards those bytes and the unsent headers. The host's fetch would then
|
|
317
|
+
* fail with a connection reset before any response exists, and its
|
|
318
|
+
* `http.response` hook would never run.
|
|
319
|
+
*/
|
|
320
|
+
async function pipeResponse(upstream, response, onFailure) {
|
|
321
|
+
const contentType = upstream.headers.get('content-type') ?? 'application/octet-stream';
|
|
322
|
+
writeResponseHead(response, upstream.status, contentType);
|
|
323
|
+
if (!upstream.body) {
|
|
324
|
+
response.end();
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const eventStream = contentType.startsWith('text/event-stream');
|
|
328
|
+
const reader = upstream.body.getReader();
|
|
329
|
+
let tail = '';
|
|
330
|
+
let wroteAny = false;
|
|
331
|
+
try {
|
|
332
|
+
while (true) {
|
|
333
|
+
const { done, value } = await reader.read();
|
|
334
|
+
if (done)
|
|
335
|
+
break;
|
|
336
|
+
if (value.byteLength === 0)
|
|
337
|
+
continue;
|
|
338
|
+
wroteAny = true;
|
|
339
|
+
if (eventStream) {
|
|
340
|
+
tail = (tail + Buffer.from(value).toString('latin1')).slice(-2);
|
|
341
|
+
}
|
|
342
|
+
if (!response.write(value)) {
|
|
343
|
+
await new Promise((resolve) => {
|
|
344
|
+
response.once('drain', resolve);
|
|
345
|
+
response.once('close', resolve);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
if (response.destroyed) {
|
|
349
|
+
await reader.cancel().catch(() => { });
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
catch (caught) {
|
|
355
|
+
const error = caught instanceof Error ? caught : new Error(String(caught));
|
|
356
|
+
// The captured upstream body error is recorded before the loopback body
|
|
357
|
+
// ends, so the job's `http.response` hook adapter (`adaptResponse`) finds
|
|
358
|
+
// it when the host reads the end of the body and fails the read with it.
|
|
359
|
+
onFailure(error);
|
|
360
|
+
response.end();
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (eventStream && wroteAny && tail !== '\n\n') {
|
|
364
|
+
response.write(tail.endsWith('\n') ? '\n' : '\n\n');
|
|
365
|
+
}
|
|
366
|
+
response.end();
|
|
367
|
+
}
|
|
368
|
+
function errorMessage(error) {
|
|
369
|
+
return error instanceof Error ? error.message : String(error);
|
|
370
|
+
}
|
|
371
|
+
// Setup context check
|
|
372
|
+
/** Context capabilities setup requires, by property path. */
|
|
373
|
+
export const GA_REQUIRED_CONTEXT_CAPABILITIES = [
|
|
374
|
+
'location.directory',
|
|
375
|
+
'session.hook',
|
|
376
|
+
'rpc.register',
|
|
377
|
+
'provider.transform',
|
|
378
|
+
'command.transform',
|
|
379
|
+
];
|
|
380
|
+
export class GaSetupContextError extends Error {
|
|
381
|
+
missing;
|
|
382
|
+
name = 'GaSetupContextError';
|
|
383
|
+
constructor(missing) {
|
|
384
|
+
super(`OpenCode GA plugin context is missing: ${missing.join(', ')}. ` +
|
|
385
|
+
'The Antigravity GA plugin cannot start in this host.');
|
|
386
|
+
this.missing = missing;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Validate host setup capabilities before allocating resources. Only
|
|
391
|
+
* `session` and `location` are read before deciding:
|
|
392
|
+
* - neither present: `'legacy'`, an OpenCode 1 core loader; setup returns
|
|
393
|
+
* `undefined` with no side effect;
|
|
394
|
+
* - exactly one present, or both with a required capability missing: throws
|
|
395
|
+
* `GaSetupContextError` naming what is missing;
|
|
396
|
+
* - otherwise `'ga'`.
|
|
397
|
+
*/
|
|
398
|
+
export function classifyGaSetupContext(context) {
|
|
399
|
+
const record = context;
|
|
400
|
+
const session = record.session;
|
|
401
|
+
const location = record.location;
|
|
402
|
+
if (session === undefined && location === undefined)
|
|
403
|
+
return 'legacy';
|
|
404
|
+
const missing = [];
|
|
405
|
+
if (!isObject(location) || typeof location.directory !== 'string') {
|
|
406
|
+
missing.push('location.directory');
|
|
407
|
+
}
|
|
408
|
+
if (!isObject(session) || typeof session.hook !== 'function') {
|
|
409
|
+
missing.push('session.hook');
|
|
410
|
+
}
|
|
411
|
+
if (session !== undefined && location !== undefined && missing.length === 0) {
|
|
412
|
+
const rpc = record.rpc;
|
|
413
|
+
if ((!isObject(rpc) && typeof rpc !== 'function') ||
|
|
414
|
+
typeof Reflect.get(rpc, 'register') !== 'function') {
|
|
415
|
+
missing.push('rpc.register');
|
|
416
|
+
}
|
|
417
|
+
const provider = record.provider;
|
|
418
|
+
if (!isObject(provider) || typeof provider.transform !== 'function') {
|
|
419
|
+
missing.push('provider.transform');
|
|
420
|
+
}
|
|
421
|
+
const command = record.command;
|
|
422
|
+
if (!isObject(command) || typeof command.transform !== 'function') {
|
|
423
|
+
missing.push('command.transform');
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (missing.length > 0)
|
|
427
|
+
throw new GaSetupContextError(missing);
|
|
428
|
+
return 'ga';
|
|
429
|
+
}
|
|
430
|
+
function isObject(value) {
|
|
431
|
+
return typeof value === 'object' && value !== null;
|
|
432
|
+
}
|
|
433
|
+
// RPC store per activation
|
|
434
|
+
/**
|
|
435
|
+
* A new opaque generation token. Each activation gets its own, so a client
|
|
436
|
+
* still holding an older activation's token is detected and reset.
|
|
437
|
+
*/
|
|
438
|
+
export function createGaGeneration() {
|
|
439
|
+
return `g-${randomUUID()}`;
|
|
440
|
+
}
|
|
441
|
+
/** Raised for input that fails the portable schema; carries no input value. */
|
|
442
|
+
export class GaRpcInputError extends Error {
|
|
443
|
+
issues;
|
|
444
|
+
name = 'GaRpcInputError';
|
|
445
|
+
constructor(issues) {
|
|
446
|
+
super(`Invalid Antigravity RPC input: ${issues
|
|
447
|
+
.map((issue) => `${issue.path.join('.') || '(root)'} ${issue.message}`)
|
|
448
|
+
.join('; ')}`);
|
|
449
|
+
this.issues = issues;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/** Raised when a collaborator produced a value that fails the contract. */
|
|
453
|
+
export class GaRpcContractError extends Error {
|
|
454
|
+
name = 'GaRpcContractError';
|
|
455
|
+
}
|
|
456
|
+
const CONNECTION_TTL_MS = 3_000;
|
|
457
|
+
const DEFAULT_NOTIFICATIONS_PER_SCOPE = 100;
|
|
458
|
+
const DEFAULT_MAX_SCOPES = 256;
|
|
459
|
+
function scopeKey(scope) {
|
|
460
|
+
return scope.kind === 'session' ? `session:${scope.sessionID}` : 'sessionless';
|
|
461
|
+
}
|
|
462
|
+
function routeDto(entry) {
|
|
463
|
+
if (!entry)
|
|
464
|
+
return null;
|
|
465
|
+
return {
|
|
466
|
+
accountId: entry.accountId,
|
|
467
|
+
modelFamily: entry.modelFamily,
|
|
468
|
+
headerStyle: entry.headerStyle,
|
|
469
|
+
strategy: entry.strategy ?? null,
|
|
470
|
+
updatedAt: entry.updatedAt,
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
export function createGaRpcActivation(options) {
|
|
474
|
+
const generation = options.generation ?? createGaGeneration();
|
|
475
|
+
const now = options.now ?? Date.now;
|
|
476
|
+
const perScope = options.notificationsPerScope ?? DEFAULT_NOTIFICATIONS_PER_SCOPE;
|
|
477
|
+
const maxScopes = options.maxScopes ?? DEFAULT_MAX_SCOPES;
|
|
478
|
+
const scopes = new Map();
|
|
479
|
+
const running = new Set();
|
|
480
|
+
let lastReadSeq = 0;
|
|
481
|
+
let disposed = false;
|
|
482
|
+
let disposal = null;
|
|
483
|
+
const disposedOutput = () => ({
|
|
484
|
+
version: ANTIGRAVITY_RPC_VERSION,
|
|
485
|
+
kind: 'disposed',
|
|
486
|
+
generation,
|
|
487
|
+
});
|
|
488
|
+
const queueFor = (scope) => {
|
|
489
|
+
const key = scopeKey(scope);
|
|
490
|
+
let queue = scopes.get(key);
|
|
491
|
+
if (queue) {
|
|
492
|
+
// Refresh recency so the least recently used scope is evicted first.
|
|
493
|
+
scopes.delete(key);
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
queue = {
|
|
497
|
+
lastIssued: 0,
|
|
498
|
+
evictedThrough: 0,
|
|
499
|
+
notifications: [],
|
|
500
|
+
lastPullAt: 0,
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
scopes.set(key, queue);
|
|
504
|
+
while (scopes.size > maxScopes) {
|
|
505
|
+
const oldest = scopes.keys().next().value;
|
|
506
|
+
if (oldest === undefined)
|
|
507
|
+
break;
|
|
508
|
+
scopes.delete(oldest);
|
|
509
|
+
}
|
|
510
|
+
return queue;
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* Run one collaborator call that disposal aborts and waits for. The host
|
|
514
|
+
* call's own signal is forwarded, so a client that leaves aborts it too.
|
|
515
|
+
*/
|
|
516
|
+
const track = async (signal, run) => {
|
|
517
|
+
const controller = new AbortController();
|
|
518
|
+
const forward = () => controller.abort(signal?.reason);
|
|
519
|
+
if (signal?.aborted)
|
|
520
|
+
forward();
|
|
521
|
+
else
|
|
522
|
+
signal?.addEventListener('abort', forward, { once: true });
|
|
523
|
+
const done = run(controller.signal);
|
|
524
|
+
const entry = { controller, done };
|
|
525
|
+
running.add(entry);
|
|
526
|
+
try {
|
|
527
|
+
return await done;
|
|
528
|
+
}
|
|
529
|
+
finally {
|
|
530
|
+
running.delete(entry);
|
|
531
|
+
signal?.removeEventListener('abort', forward);
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
const accountsDto = (accounts) => {
|
|
535
|
+
if (accounts.kind === 'over-limit') {
|
|
536
|
+
return {
|
|
537
|
+
accountsStatus: {
|
|
538
|
+
kind: 'over-limit',
|
|
539
|
+
count: accounts.count,
|
|
540
|
+
limit: ANTIGRAVITY_RPC_LIMITS.accounts,
|
|
541
|
+
},
|
|
542
|
+
accounts: [],
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
// A complete read longer than the wire limit would have to be shortened;
|
|
546
|
+
// the source must report it as over the limit instead.
|
|
547
|
+
if (accounts.rows.length > ANTIGRAVITY_RPC_LIMITS.accounts) {
|
|
548
|
+
throw new GaRpcContractError('State source returned more accounts than the limit');
|
|
549
|
+
}
|
|
550
|
+
return {
|
|
551
|
+
accountsStatus: { kind: 'complete' },
|
|
552
|
+
accounts: accounts.rows.map(({ selector, row }) => ({
|
|
553
|
+
selector,
|
|
554
|
+
...redactAccountForSidebar(row),
|
|
555
|
+
})),
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
const state = async (input, signal) => {
|
|
559
|
+
const parsed = AntigravityStateInputSchema.parse(input);
|
|
560
|
+
if (!parsed.ok)
|
|
561
|
+
throw new GaRpcInputError(parsed.issues);
|
|
562
|
+
if (disposed)
|
|
563
|
+
return disposedOutput();
|
|
564
|
+
const request = parsed.value;
|
|
565
|
+
const read = await track(signal, (readSignal) => options.state.read({ scope: request.scope, signal: readSignal }));
|
|
566
|
+
// A read that finishes after disposal is not reported.
|
|
567
|
+
if (disposed)
|
|
568
|
+
return disposedOutput();
|
|
569
|
+
if (!Number.isSafeInteger(read.readSeq) || read.readSeq <= lastReadSeq) {
|
|
570
|
+
throw new GaRpcContractError('State source returned a stale readSeq');
|
|
571
|
+
}
|
|
572
|
+
lastReadSeq = read.readSeq;
|
|
573
|
+
const queue = queueFor(request.scope);
|
|
574
|
+
queue.lastPullAt = now();
|
|
575
|
+
let reset = null;
|
|
576
|
+
if (request.generation === null)
|
|
577
|
+
reset = 'initial';
|
|
578
|
+
else if (request.generation !== generation)
|
|
579
|
+
reset = 'generation-changed';
|
|
580
|
+
else if (request.cursor > queue.lastIssued)
|
|
581
|
+
reset = 'cursor-ahead';
|
|
582
|
+
const acknowledged = reset === null ? request.cursor : 0;
|
|
583
|
+
// Acknowledged notifications are no longer retained.
|
|
584
|
+
queue.notifications = queue.notifications.filter((notification) => notification.cursor > acknowledged);
|
|
585
|
+
const delivered = queue.notifications.slice(0, ANTIGRAVITY_RPC_LIMITS.notificationsPerState);
|
|
586
|
+
const last = delivered.at(-1);
|
|
587
|
+
const cursor = last
|
|
588
|
+
? last.cursor
|
|
589
|
+
: Math.max(acknowledged, queue.evictedThrough);
|
|
590
|
+
const output = {
|
|
591
|
+
version: ANTIGRAVITY_RPC_VERSION,
|
|
592
|
+
kind: 'snapshot',
|
|
593
|
+
generation,
|
|
594
|
+
scope: request.scope,
|
|
595
|
+
reset,
|
|
596
|
+
cursor,
|
|
597
|
+
dropped: Math.max(0, queue.evictedThrough - acknowledged),
|
|
598
|
+
more: queue.notifications.length > delivered.length,
|
|
599
|
+
notifications: delivered,
|
|
600
|
+
readSeq: read.readSeq,
|
|
601
|
+
...accountsDto(read.accounts),
|
|
602
|
+
route: request.scope.kind === 'session' ? routeDto(read.route) : null,
|
|
603
|
+
status: read.status,
|
|
604
|
+
settings: read.settings,
|
|
605
|
+
};
|
|
606
|
+
const checked = AntigravityStateOutputSchema.parse(output);
|
|
607
|
+
if (!checked.ok) {
|
|
608
|
+
throw new GaRpcContractError('State source produced an invalid snapshot');
|
|
609
|
+
}
|
|
610
|
+
return output;
|
|
611
|
+
};
|
|
612
|
+
const apply = async (input, signal) => {
|
|
613
|
+
const parsed = AntigravityApplyInputSchema.parse(input);
|
|
614
|
+
if (!parsed.ok)
|
|
615
|
+
throw new GaRpcInputError(parsed.issues);
|
|
616
|
+
if (disposed)
|
|
617
|
+
return disposedOutput();
|
|
618
|
+
const request = parsed.value;
|
|
619
|
+
if (request.generation !== generation) {
|
|
620
|
+
return {
|
|
621
|
+
version: ANTIGRAVITY_RPC_VERSION,
|
|
622
|
+
kind: 'stale-generation',
|
|
623
|
+
generation,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
const menuRequest = options.parseApplyRequest({
|
|
627
|
+
...request.request,
|
|
628
|
+
...(request.scope.kind === 'session'
|
|
629
|
+
? { sessionId: request.scope.sessionID }
|
|
630
|
+
: {}),
|
|
631
|
+
});
|
|
632
|
+
if (!menuRequest) {
|
|
633
|
+
throw new GaRpcInputError([
|
|
634
|
+
{ path: ['request'], message: 'not a menu action the menu accepts' },
|
|
635
|
+
]);
|
|
636
|
+
}
|
|
637
|
+
const result = await track(signal, (applySignal) => options.commands.apply({
|
|
638
|
+
request: menuRequest,
|
|
639
|
+
scope: request.scope,
|
|
640
|
+
signal: applySignal,
|
|
641
|
+
}));
|
|
642
|
+
// A completion that arrives after disposal is not reported as applied.
|
|
643
|
+
if (disposed)
|
|
644
|
+
return disposedOutput();
|
|
645
|
+
const checked = AntigravityApplyResultSchema.parse(result);
|
|
646
|
+
if (!checked.ok || result.command !== ANTIGRAVITY_MENU_COMMAND_NAME) {
|
|
647
|
+
throw new GaRpcContractError('Command service produced a result that is not a menu answer');
|
|
648
|
+
}
|
|
649
|
+
const output = {
|
|
650
|
+
version: ANTIGRAVITY_RPC_VERSION,
|
|
651
|
+
kind: 'applied',
|
|
652
|
+
generation,
|
|
653
|
+
scope: request.scope,
|
|
654
|
+
result,
|
|
655
|
+
};
|
|
656
|
+
if (!AntigravityApplyOutputSchema.parse(output).ok) {
|
|
657
|
+
throw new GaRpcContractError('Apply output failed the contract');
|
|
658
|
+
}
|
|
659
|
+
return output;
|
|
660
|
+
};
|
|
661
|
+
return {
|
|
662
|
+
generation,
|
|
663
|
+
handlers: { state, apply },
|
|
664
|
+
notify(scope, payload) {
|
|
665
|
+
if (disposed)
|
|
666
|
+
return null;
|
|
667
|
+
if (!AntigravityNotificationPayloadSchema.parse(payload).ok) {
|
|
668
|
+
throw new GaRpcContractError('Notification payload failed the contract');
|
|
669
|
+
}
|
|
670
|
+
const queue = queueFor(scope);
|
|
671
|
+
queue.lastIssued += 1;
|
|
672
|
+
const cursor = queue.lastIssued;
|
|
673
|
+
queue.notifications.push({ cursor, payload });
|
|
674
|
+
while (queue.notifications.length > perScope) {
|
|
675
|
+
const evicted = queue.notifications.shift();
|
|
676
|
+
if (evicted)
|
|
677
|
+
queue.evictedThrough = evicted.cursor;
|
|
678
|
+
}
|
|
679
|
+
try {
|
|
680
|
+
options.onChanged?.({ version: ANTIGRAVITY_RPC_VERSION, generation });
|
|
681
|
+
}
|
|
682
|
+
catch {
|
|
683
|
+
// The event is a wake-up hint; clients still pull on their timer.
|
|
684
|
+
}
|
|
685
|
+
return cursor;
|
|
686
|
+
},
|
|
687
|
+
isConnected(scope) {
|
|
688
|
+
if (disposed)
|
|
689
|
+
return false;
|
|
690
|
+
const queue = scopes.get(scopeKey(scope));
|
|
691
|
+
return (queue !== undefined &&
|
|
692
|
+
queue.lastPullAt > 0 &&
|
|
693
|
+
now() - queue.lastPullAt < CONNECTION_TTL_MS);
|
|
694
|
+
},
|
|
695
|
+
get disposed() {
|
|
696
|
+
return disposed;
|
|
697
|
+
},
|
|
698
|
+
dispose() {
|
|
699
|
+
if (!disposal) {
|
|
700
|
+
disposed = true;
|
|
701
|
+
disposal = (async () => {
|
|
702
|
+
scopes.clear();
|
|
703
|
+
const pending = [...running];
|
|
704
|
+
for (const entry of pending) {
|
|
705
|
+
entry.controller.abort(new Error('The Antigravity activation was disposed'));
|
|
706
|
+
}
|
|
707
|
+
await Promise.allSettled(pending.map((entry) => entry.done));
|
|
708
|
+
})();
|
|
709
|
+
}
|
|
710
|
+
return disposal;
|
|
711
|
+
},
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
// Host binding
|
|
715
|
+
/** The plugin id this adapter registers with the host. */
|
|
716
|
+
export const GA_PLUGIN_ID = 'cortexkit.antigravity-auth';
|
|
717
|
+
/** The host provider whose requests the hooks handle. */
|
|
718
|
+
export const GA_PROVIDER_ID = 'google';
|
|
719
|
+
const REQUEST_KIND_MATCHES_HOST = true;
|
|
720
|
+
void REQUEST_KIND_MATCHES_HOST;
|
|
721
|
+
/** Session headers the host sets on a model request. */
|
|
722
|
+
const PARENT_SESSION_HEADERS = [
|
|
723
|
+
'x-opencode-parent-session-id',
|
|
724
|
+
'x-parent-session-id',
|
|
725
|
+
];
|
|
726
|
+
/**
|
|
727
|
+
* Whether the plugin owns a Google request: every title request (the host
|
|
728
|
+
* may pick an off-catalog title model) and any request for a model this
|
|
729
|
+
* plugin registered. Everything else passes through untouched.
|
|
730
|
+
*/
|
|
731
|
+
export function isGaOwnedRequest(event, isRegisteredModel) {
|
|
732
|
+
// The hooks are registered for the Google provider only; the provider
|
|
733
|
+
// check repeats that scope so a host that widened it still passes other
|
|
734
|
+
// providers through untouched.
|
|
735
|
+
if (event.model.providerID !== GA_PROVIDER_ID)
|
|
736
|
+
return false;
|
|
737
|
+
return event.kind === 'title' || isRegisteredModel(event.model.id);
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Request hook body: record an owned Google content request as a bridge job
|
|
741
|
+
* and replace it with the bridge request. The original body is read from a
|
|
742
|
+
* clone, so the host's request is never consumed when the rewrite is
|
|
743
|
+
* refused. A proxy-guard refusal throws before any replacement; the host
|
|
744
|
+
* then records it as the request's error and dispatches nothing.
|
|
745
|
+
*/
|
|
746
|
+
export async function rewriteGaHttpRequest(event, input) {
|
|
747
|
+
if (!isGaOwnedRequest(event, input.isRegisteredModel))
|
|
748
|
+
return;
|
|
749
|
+
const original = event.request;
|
|
750
|
+
if (!isGaGoogleContentRequest(original))
|
|
751
|
+
return;
|
|
752
|
+
const job = {
|
|
753
|
+
sessionID: event.sessionID,
|
|
754
|
+
parentSessionID: headerValue(original, PARENT_SESSION_HEADERS),
|
|
755
|
+
kind: event.kind,
|
|
756
|
+
modelID: event.model.id,
|
|
757
|
+
variant: event.model.variant ?? null,
|
|
758
|
+
url: original.url,
|
|
759
|
+
body: await original.clone().text(),
|
|
760
|
+
};
|
|
761
|
+
event.request = input.bridge.rewrite(original, job, input.env);
|
|
762
|
+
}
|
|
763
|
+
/** Adapt only responses whose request belongs to a recognized bridge job. */
|
|
764
|
+
export function adaptGaHttpResponse(event, bridge) {
|
|
765
|
+
const adapted = bridge.adaptResponse(event.request, event.response);
|
|
766
|
+
if (adapted)
|
|
767
|
+
event.response = adapted;
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Retry hook body. The bridge's job runner rotates accounts and retries
|
|
771
|
+
* endpoints itself; a host retry on top would repeat that whole sequence.
|
|
772
|
+
* Only this plugin's registered models are affected.
|
|
773
|
+
*/
|
|
774
|
+
export function decideGaRetry(event, isRegisteredModel) {
|
|
775
|
+
if (event.model.providerID === GA_PROVIDER_ID &&
|
|
776
|
+
isRegisteredModel(event.model.id)) {
|
|
777
|
+
event.decision = { retry: false };
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
// Model registration
|
|
781
|
+
/**
|
|
782
|
+
* Convert one shared public catalog entry to the host's model record for the
|
|
783
|
+
* Google provider. Only enabled variants are offered; a variant carries only
|
|
784
|
+
* its id, which reaches the request hook as the model reference's `variant`
|
|
785
|
+
* and is resolved by the request pipeline, the same way the OpenCode 1
|
|
786
|
+
* adapter resolves variant suffixes. Title wire aliases are not catalog
|
|
787
|
+
* entries and are never registered.
|
|
788
|
+
*
|
|
789
|
+
* The host's branded id types are plain strings at runtime. This module
|
|
790
|
+
* loads no host schema code, so the brands are applied by type assertion on
|
|
791
|
+
* values taken from the shared catalog.
|
|
792
|
+
*/
|
|
793
|
+
export function toGaModelInfo(id, definition) {
|
|
794
|
+
const variants = Object.entries(definition.variants ?? {})
|
|
795
|
+
.filter(([, variant]) => variant.disabled !== true)
|
|
796
|
+
.map(([variantID]) => ({ id: variantID }));
|
|
797
|
+
const released = Date.parse(definition.release_date);
|
|
798
|
+
return {
|
|
799
|
+
id: id,
|
|
800
|
+
modelID: id,
|
|
801
|
+
providerID: GA_PROVIDER_ID,
|
|
802
|
+
name: definition.name,
|
|
803
|
+
capabilities: {
|
|
804
|
+
tools: definition.tool_call,
|
|
805
|
+
input: [...definition.modalities.input],
|
|
806
|
+
output: [...definition.modalities.output],
|
|
807
|
+
},
|
|
808
|
+
variants,
|
|
809
|
+
time: { released: Number.isFinite(released) ? released : 0 },
|
|
810
|
+
cost: [],
|
|
811
|
+
status: 'active',
|
|
812
|
+
enabled: true,
|
|
813
|
+
limit: {
|
|
814
|
+
context: definition.limit.context,
|
|
815
|
+
output: definition.limit.output,
|
|
816
|
+
},
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
/** The host records for every public catalog model, keyed by model id. */
|
|
820
|
+
export function gaCatalogModels() {
|
|
821
|
+
return new Map(Object.entries(getPublicModelDefinitions()).map(([id, definition]) => [
|
|
822
|
+
id,
|
|
823
|
+
toGaModelInfo(id, definition),
|
|
824
|
+
]));
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* Provider transform body: add the catalog models to the Google provider,
|
|
828
|
+
* keeping every model the provider already has under another id. When the
|
|
829
|
+
* host has no Google provider record, nothing is registered.
|
|
830
|
+
*/
|
|
831
|
+
export function registerGaModels(editor, catalog) {
|
|
832
|
+
const record = editor.get(GA_PROVIDER_ID);
|
|
833
|
+
if (!record)
|
|
834
|
+
return;
|
|
835
|
+
const kept = [...record.models.values()].filter((model) => !catalog.has(model.id));
|
|
836
|
+
editor.models.set(GA_PROVIDER_ID, [...kept, ...catalog.values()]);
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Writes a location's log records to stderr: the OpenCode 2 plugin context
|
|
840
|
+
* offers plugins no log sink.
|
|
841
|
+
*/
|
|
842
|
+
function stderrLogSink(record) {
|
|
843
|
+
try {
|
|
844
|
+
process.stderr.write(`[antigravity] ${record.level} ${record.service}: ${record.message}\n`);
|
|
845
|
+
}
|
|
846
|
+
catch {
|
|
847
|
+
// Logging must never break a request.
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
function headerValue(request, names) {
|
|
851
|
+
for (const name of names) {
|
|
852
|
+
const value = request.headers.get(name);
|
|
853
|
+
if (value)
|
|
854
|
+
return value;
|
|
855
|
+
}
|
|
856
|
+
return null;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Set up one activation. Returns `undefined` with no side effect for a
|
|
860
|
+
* legacy context without `session` and `location`, and throws
|
|
861
|
+
* `GaSetupContextError` for a partial one. Otherwise it builds the services,
|
|
862
|
+
* the location runtime, the RPC activation and the loopback bridge for the
|
|
863
|
+
* host-owned location directory; registers the `antigravity-auth` RPC, the
|
|
864
|
+
* public catalog models on the Google provider, the `http.request` rewrite,
|
|
865
|
+
* the `http.response` post-header error adapter and the registered-model
|
|
866
|
+
* retry policy (all scoped to the Google provider);
|
|
867
|
+
* and returns a Cleanup that removes only this activation's hooks and RPC
|
|
868
|
+
* and stops everything else: producers are stopped and awaited, queued
|
|
869
|
+
* quota snapshot writes drain, and then the remaining handles close.
|
|
870
|
+
*
|
|
871
|
+
* Any failure before the Cleanup is returned releases everything acquired
|
|
872
|
+
* so far before the error propagates, so a failed setup leaves no hook,
|
|
873
|
+
* port, timer or file handle behind.
|
|
874
|
+
*/
|
|
875
|
+
export async function setupGaActivation(context, factory, overrides = {}) {
|
|
876
|
+
if (classifyGaSetupContext(context) === 'legacy')
|
|
877
|
+
return undefined;
|
|
878
|
+
const directory = context.location.directory;
|
|
879
|
+
const send = createGaRawSender(overrides);
|
|
880
|
+
const services = await factory({
|
|
881
|
+
directory,
|
|
882
|
+
overrides,
|
|
883
|
+
...(context.integration && { connections: context.integration.connection }),
|
|
884
|
+
});
|
|
885
|
+
const runtime = await createLocationRuntime({
|
|
886
|
+
...services.runtime,
|
|
887
|
+
directory,
|
|
888
|
+
logSink: stderrLogSink,
|
|
889
|
+
}, services);
|
|
890
|
+
// Everything below is registered on the runtime scope as a producer. The
|
|
891
|
+
// scope stops producers newest first, so teardown runs: request, retry
|
|
892
|
+
// and response hooks, model registration, RPC, activation, bridge,
|
|
893
|
+
// quota and token-refresh tasks, then account services; queued snapshot
|
|
894
|
+
// writes drain and the runtime's files and handles close.
|
|
895
|
+
try {
|
|
896
|
+
if (context.integration?.transform) {
|
|
897
|
+
runtime.scope.add(await registerGaVaultActivation({
|
|
898
|
+
integration: { transform: context.integration.transform },
|
|
899
|
+
}), 'producer');
|
|
900
|
+
}
|
|
901
|
+
let serving = null;
|
|
902
|
+
const requireServing = () => {
|
|
903
|
+
if (!serving)
|
|
904
|
+
throw new Error('Antigravity services are not started');
|
|
905
|
+
return serving;
|
|
906
|
+
};
|
|
907
|
+
let rpcRegistration = null;
|
|
908
|
+
const commandsModule = await loadCommonAuthCommands();
|
|
909
|
+
const activation = createGaRpcActivation({
|
|
910
|
+
state: {
|
|
911
|
+
read: (input) => requireServing().state.read(input),
|
|
912
|
+
},
|
|
913
|
+
commands: {
|
|
914
|
+
apply: (request) => requireServing().commands.apply(request),
|
|
915
|
+
},
|
|
916
|
+
parseApplyRequest: commandsModule.parseApplyRequest,
|
|
917
|
+
onChanged: (event) => {
|
|
918
|
+
void rpcRegistration?.events.emit('changed', event).catch(() => {
|
|
919
|
+
// A missed changed notification delays the client's next state request.
|
|
920
|
+
});
|
|
921
|
+
},
|
|
922
|
+
});
|
|
923
|
+
serving = await services.start({
|
|
924
|
+
runtime,
|
|
925
|
+
generation: activation.generation,
|
|
926
|
+
send,
|
|
927
|
+
notify: activation.notify,
|
|
928
|
+
isConnected: activation.isConnected,
|
|
929
|
+
});
|
|
930
|
+
const started = serving;
|
|
931
|
+
const catalog = gaCatalogModels();
|
|
932
|
+
const isRegisteredModel = (modelID) => catalog.has(modelID);
|
|
933
|
+
const bridge = await startGaLoopbackBridge({
|
|
934
|
+
execute: started.execute,
|
|
935
|
+
send,
|
|
936
|
+
onError: (message) => runtime.logger.createLogger('bridge').warn(message),
|
|
937
|
+
});
|
|
938
|
+
runtime.scope.add(bridge, 'producer');
|
|
939
|
+
runtime.scope.add(activation, 'producer');
|
|
940
|
+
const handlers = {
|
|
941
|
+
state: (input, call) => activation.handlers.state(input, call.signal),
|
|
942
|
+
apply: (input, call) => activation.handlers.apply(input, call.signal),
|
|
943
|
+
};
|
|
944
|
+
rpcRegistration = await context.rpc.register(ANTIGRAVITY_RPC_DEFINITION, handlers);
|
|
945
|
+
runtime.scope.add(rpcRegistration, 'producer');
|
|
946
|
+
const modelRegistration = await context.provider.transform((editor) => registerGaModels(editor, catalog));
|
|
947
|
+
runtime.scope.add(modelRegistration, 'producer');
|
|
948
|
+
await context.provider.reload();
|
|
949
|
+
// The native `/antigravity` command opens the menu in the session that
|
|
950
|
+
// ran it. Its runs stop starting new work once the activation is torn
|
|
951
|
+
// down: the abort is registered before the command, so teardown (newest
|
|
952
|
+
// first) removes the command, then aborts what is still running.
|
|
953
|
+
const commandRuns = new AbortController();
|
|
954
|
+
runtime.scope.add({
|
|
955
|
+
dispose: async () => {
|
|
956
|
+
commandRuns.abort(new Error('The Antigravity activation was disposed'));
|
|
957
|
+
},
|
|
958
|
+
}, 'producer');
|
|
959
|
+
const commandRegistration = await context.command.transform((editor) => editor.add({
|
|
960
|
+
name: ANTIGRAVITY_MENU_COMMAND_NAME,
|
|
961
|
+
description: 'Open the Antigravity menu: accounts, quota, routing, limits and diagnostics.',
|
|
962
|
+
execute: ({ sessionID }) => started.commands.open({
|
|
963
|
+
scope: { kind: 'session', sessionID },
|
|
964
|
+
signal: commandRuns.signal,
|
|
965
|
+
}),
|
|
966
|
+
}));
|
|
967
|
+
runtime.scope.add(commandRegistration, 'producer');
|
|
968
|
+
await context.command.reload();
|
|
969
|
+
const responseHook = await context.session.hook('http.response', (event) => adaptGaHttpResponse(event, bridge), { providerID: GA_PROVIDER_ID });
|
|
970
|
+
runtime.scope.add(responseHook, 'producer');
|
|
971
|
+
const retryHook = await context.session.hook('retry', (event) => decideGaRetry(event, isRegisteredModel), { providerID: GA_PROVIDER_ID });
|
|
972
|
+
runtime.scope.add(retryHook, 'producer');
|
|
973
|
+
// The `http.request` hook, which rewrites requests to the bridge, is
|
|
974
|
+
// installed last, so every request it rewrites already has the
|
|
975
|
+
// `http.response` adapter and the retry policy in place. Teardown removes
|
|
976
|
+
// producers newest first, so this hook is removed first.
|
|
977
|
+
const requestHook = await context.session.hook('http.request', (event) => rewriteGaHttpRequest(event, {
|
|
978
|
+
bridge,
|
|
979
|
+
isRegisteredModel,
|
|
980
|
+
env: process.env,
|
|
981
|
+
}), { providerID: GA_PROVIDER_ID });
|
|
982
|
+
runtime.scope.add(requestHook, 'producer');
|
|
983
|
+
}
|
|
984
|
+
catch (error) {
|
|
985
|
+
await runtime.dispose().catch(() => {
|
|
986
|
+
// Preserve the initialization error if disposal also throws.
|
|
987
|
+
});
|
|
988
|
+
throw error;
|
|
989
|
+
}
|
|
990
|
+
let cleanup = null;
|
|
991
|
+
return () => {
|
|
992
|
+
cleanup ??= runtime.dispose();
|
|
993
|
+
return cleanup;
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
/** Build the OpenCode 2 plugin over the given services factory. */
|
|
997
|
+
export function createGaPluginFromServices(factory, overrides = {}) {
|
|
998
|
+
return {
|
|
999
|
+
id: GA_PLUGIN_ID,
|
|
1000
|
+
setup: (context) => setupGaActivation(context, factory, overrides),
|
|
1001
|
+
};
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* The plugin the OpenCode 2 host loads: setup over the production location
|
|
1005
|
+
* services (`createGaLocationServices`), which open the location's account
|
|
1006
|
+
* store, keep its quota snapshots in memory and run the shared request
|
|
1007
|
+
* pipeline. `overrides` exist for tests; the host passes none.
|
|
1008
|
+
*/
|
|
1009
|
+
export function createGaAntigravityPlugin(overrides = {}) {
|
|
1010
|
+
return createGaPluginFromServices(createGaLocationServices, overrides);
|
|
1011
|
+
}
|
|
1012
|
+
//# sourceMappingURL=index.js.map
|