@cortexkit/opencode-antigravity-auth 2.2.1 → 3.0.0
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 +95 -89
- package/dist/cli.js +18469 -810
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +4079 -0
- package/dist/index.js +40914 -16441
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +6949 -0
- package/dist/server.js +50948 -0
- package/dist/server.js.map +7 -0
- package/dist/server.meta.json +7284 -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 +190 -60
- 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 +1743 -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 +45 -18
- 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,1304 @@
|
|
|
1
|
+
import { insert as _$insert } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
2
|
+
import { createComponent as _$createComponent } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
3
|
+
import { createTextNode as _$createTextNode } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
4
|
+
import { insertNode as _$insertNode } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
5
|
+
import { setProp as _$setProp } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
6
|
+
import { createElement as _$createElement } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
7
|
+
/** @jsxImportSource @opentui/solid */
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* OpenCode GA adapter for the shared `/antigravity` drawer and sidebar.
|
|
11
|
+
*
|
|
12
|
+
* Everything goes through the host's native location RPC: the server plugin
|
|
13
|
+
* registers `antigravity-auth` (version 1) with the methods `state` and
|
|
14
|
+
* `apply` at its location, and this adapter calls them with the host
|
|
15
|
+
* client's `rpc.call`, naming the location explicitly. There is no port
|
|
16
|
+
* file, no PID discovery, no private HTTP port and no sidebar file here.
|
|
17
|
+
*
|
|
18
|
+
* Contract rules this client keeps (the server enforces the same ones):
|
|
19
|
+
*
|
|
20
|
+
* - Generation: the first `state` sends `generation: null`; every later call
|
|
21
|
+
* sends the generation the server last answered with. When the server
|
|
22
|
+
* answers with a different one (`reset: 'generation-changed'`) the client
|
|
23
|
+
* rebinds: every scope's cursor restarts at 0. An `apply` answered with
|
|
24
|
+
* `stale-generation` or `disposed` changed nothing; the drawer says so and
|
|
25
|
+
* the next `state` rebinds.
|
|
26
|
+
* - Scope: the current session (`{ kind: 'session', sessionID }`) or the
|
|
27
|
+
* sessionless scope on the home screen. Each scope has its own cursor. A
|
|
28
|
+
* drawer applies in the scope its menu arrived in, never the scope that
|
|
29
|
+
* happens to be current when the user chooses.
|
|
30
|
+
* - Cursor: the client sends the highest cursor it has handled; the answer
|
|
31
|
+
* holds the next notifications and the cursor to send next.
|
|
32
|
+
* - Disposal: after cleanup, or after the client rebinds, an answer to a
|
|
33
|
+
* request sent earlier is dropped unread, so a late completion can never
|
|
34
|
+
* open a dialog, show a toast or change the sidebar.
|
|
35
|
+
*
|
|
36
|
+
* Every answer is validated field by field before use; an answer that does
|
|
37
|
+
* not match is refused and logged by field name only.
|
|
38
|
+
*
|
|
39
|
+
* The wire shapes mirror the facade's `ga/rpc/protocol.ts` (clean v1:
|
|
40
|
+
* accounts carry opaque `selector`s, typed account actions name accounts
|
|
41
|
+
* only by selector, every snapshot carries the location's settings). GA
|
|
42
|
+
* notifications name a dialog command only, so this host builds the
|
|
43
|
+
* `/antigravity` menu from the latest snapshot and the shared drawer renders
|
|
44
|
+
* it; after every apply the menu is rebuilt from a fresh `state` read.
|
|
45
|
+
*
|
|
46
|
+
* Nothing here imports account storage, tokens, OAuth, the vault client or
|
|
47
|
+
* server code, and nothing writes to the terminal or forces a theme.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
import { createSignal, For, Show } from "opentui:runtime-module:solid-js";
|
|
51
|
+
import { projectAccount, projectSidebar } from "./shared/8ae1927e5910ea81-sidebar-projection.js";
|
|
52
|
+
import { MenuRefusedError, openAntigravityMenu } from "./shared/0e19a88ff3535906-command-dialogs.js";
|
|
53
|
+
import { ANTIGRAVITY_MENU_COMMAND, ANTIGRAVITY_MENU_TITLE } from "./shared/07365a7d2ccade4c-host-api.js";
|
|
54
|
+
export const GA_TUI_ID = 'cortexkit.antigravity-auth';
|
|
55
|
+
export const GA_RPC_ID = 'antigravity-auth';
|
|
56
|
+
export const GA_RPC_VERSION = 1;
|
|
57
|
+
|
|
58
|
+
/** How often the TUI pulls state and notifications from its location. */
|
|
59
|
+
export const GA_SIDEBAR_PULL_MS = 1_000;
|
|
60
|
+
|
|
61
|
+
/** Pulls in one tick while the server reports more notifications waiting. */
|
|
62
|
+
const MAX_PULLS_PER_TICK = 4;
|
|
63
|
+
|
|
64
|
+
// ── Host surface (structural subset of the GA TUI context) ─────────────────
|
|
65
|
+
|
|
66
|
+
/** The parts of the GA TUI `Context` this adapter uses. */
|
|
67
|
+
|
|
68
|
+
// ── Wire shapes ─────────────────────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
/** The dialog commands the server names in notifications and text applies. */
|
|
71
|
+
export const GA_COMMANDS = ['antigravity-quota', 'antigravity-account', 'antigravity-routing', 'antigravity-killswitch', 'antigravity-dump', 'antigravity-logging'];
|
|
72
|
+
export const GA_LOG_LEVELS = ['error', 'warn', 'info', 'debug', 'trace'];
|
|
73
|
+
|
|
74
|
+
/** A redacted account plus the opaque selector that names its credential. */
|
|
75
|
+
|
|
76
|
+
/** The location's operator settings, read fresh for every `state` answer. */
|
|
77
|
+
|
|
78
|
+
/** A typed account action; accounts are named only by selector. */
|
|
79
|
+
|
|
80
|
+
/** What the client sends besides version, generation and scope. */
|
|
81
|
+
|
|
82
|
+
/** The command result fields this TUI reads; the rest are validated only. */
|
|
83
|
+
|
|
84
|
+
const GENERATION = /^[A-Za-z0-9_-]{1,64}$/;
|
|
85
|
+
const SESSION_ID = /^[\x21-\x7e]{1,256}$/;
|
|
86
|
+
const ACCOUNT_ID = /^acct-(0|[1-9][0-9]{0,5})$/;
|
|
87
|
+
const ACCOUNT_LABEL = /^Account [1-9][0-9]{0,5}$/;
|
|
88
|
+
const SELECTOR = /^sel-[A-Za-z0-9_-]{32}$/;
|
|
89
|
+
const TARGET_OUTCOMES = ['applied', 'stale-target', 'unknown-target', 'unsupported-index-action', 'failed'];
|
|
90
|
+
function isRecord(value) {
|
|
91
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const proto = Object.getPrototypeOf(value);
|
|
95
|
+
return proto === Object.prototype || proto === null;
|
|
96
|
+
}
|
|
97
|
+
function keys(record, required, optional, path, issues) {
|
|
98
|
+
for (const key of Object.keys(record)) {
|
|
99
|
+
if (!required.includes(key) && !optional.includes(key)) {
|
|
100
|
+
issues.push(`${path}.${key}: unexpected field`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (const key of required) {
|
|
104
|
+
if (!(key in record)) issues.push(`${path}.${key}: missing`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function isCursor(value) {
|
|
108
|
+
return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0 && !Object.is(value, -0);
|
|
109
|
+
}
|
|
110
|
+
function isTime(value) {
|
|
111
|
+
return typeof value === 'number' && Number.isFinite(value) && value >= 0;
|
|
112
|
+
}
|
|
113
|
+
function checkVersion(record, path, issues) {
|
|
114
|
+
if (record.version !== GA_RPC_VERSION) issues.push(`${path}.version: unsupported`);
|
|
115
|
+
}
|
|
116
|
+
function checkGeneration(value, path, issues) {
|
|
117
|
+
if (typeof value !== 'string' || !GENERATION.test(value)) {
|
|
118
|
+
issues.push(`${path}: expected a generation token`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function checkScope(value, path, issues) {
|
|
122
|
+
if (!isRecord(value)) {
|
|
123
|
+
issues.push(`${path}: expected a scope`);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (value.kind === 'sessionless') {
|
|
127
|
+
keys(value, ['kind'], [], path, issues);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (value.kind === 'session') {
|
|
131
|
+
keys(value, ['kind', 'sessionID'], [], path, issues);
|
|
132
|
+
if (typeof value.sessionID !== 'string' || !SESSION_ID.test(value.sessionID)) {
|
|
133
|
+
issues.push(`${path}.sessionID: expected a session id`);
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
issues.push(`${path}.kind: unknown scope`);
|
|
138
|
+
}
|
|
139
|
+
function checkPercent(value, path, issues) {
|
|
140
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > 100) {
|
|
141
|
+
issues.push(`${path}: expected a percentage`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function checkQuotaEntry(value, path, issues) {
|
|
145
|
+
if (value === undefined) return;
|
|
146
|
+
if (!isRecord(value)) {
|
|
147
|
+
issues.push(`${path}: expected a quota reading`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
keys(value, ['remainingPercent'], ['resetAt', 'windows', 'checkedAt'], path, issues);
|
|
151
|
+
checkPercent(value.remainingPercent, `${path}.remainingPercent`, issues);
|
|
152
|
+
if (value.resetAt !== undefined && !isTime(value.resetAt)) {
|
|
153
|
+
issues.push(`${path}.resetAt: expected a time`);
|
|
154
|
+
}
|
|
155
|
+
if (value.checkedAt !== undefined && !isTime(value.checkedAt)) issues.push(`${path}.checkedAt: expected a time`);
|
|
156
|
+
if (value.windows === undefined) return;
|
|
157
|
+
if (!Array.isArray(value.windows) || value.windows.length > 4) {
|
|
158
|
+
issues.push(`${path}.windows: expected at most four windows`);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
value.windows.forEach((window, index) => {
|
|
162
|
+
const at = `${path}.windows.${index}`;
|
|
163
|
+
if (!isRecord(window)) {
|
|
164
|
+
issues.push(`${at}: expected a window`);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
keys(window, ['window', 'remainingPercent'], ['resetAt', 'checkedAt'], at, issues);
|
|
168
|
+
if (window.window !== 'weekly' && window.window !== '5h') {
|
|
169
|
+
issues.push(`${at}.window: unknown window`);
|
|
170
|
+
}
|
|
171
|
+
if (window.checkedAt !== undefined && !isTime(window.checkedAt)) issues.push(`${at}.checkedAt: expected a time`);
|
|
172
|
+
checkPercent(window.remainingPercent, `${at}.remainingPercent`, issues);
|
|
173
|
+
if (window.resetAt !== undefined && !isTime(window.resetAt)) {
|
|
174
|
+
issues.push(`${at}.resetAt: expected a time`);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* One redacted account. The field list is closed: an email, token, project
|
|
181
|
+
* id or fingerprint arrives as an unexpected field and the whole answer is
|
|
182
|
+
* refused.
|
|
183
|
+
*/
|
|
184
|
+
function checkAccount(value, path, issues) {
|
|
185
|
+
if (!isRecord(value)) {
|
|
186
|
+
issues.push(`${path}: expected an account`);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
keys(value, ['selector', 'id', 'label', 'enabled', 'health', 'current', 'quota'], ['cooldownUntil', 'tier'], path, issues);
|
|
190
|
+
if (typeof value.selector !== 'string' || !SELECTOR.test(value.selector)) {
|
|
191
|
+
issues.push(`${path}.selector: expected an opaque selector`);
|
|
192
|
+
}
|
|
193
|
+
if (typeof value.id !== 'string' || !ACCOUNT_ID.test(value.id)) {
|
|
194
|
+
issues.push(`${path}.id: expected an ordinal account id`);
|
|
195
|
+
}
|
|
196
|
+
if (typeof value.label !== 'string' || !ACCOUNT_LABEL.test(value.label)) {
|
|
197
|
+
issues.push(`${path}.label: expected an ordinal account label`);
|
|
198
|
+
}
|
|
199
|
+
if (typeof value.enabled !== 'boolean') issues.push(`${path}.enabled: expected true/false`);
|
|
200
|
+
if (typeof value.current !== 'boolean') issues.push(`${path}.current: expected true/false`);
|
|
201
|
+
checkPercent(value.health, `${path}.health`, issues);
|
|
202
|
+
if (value.cooldownUntil !== undefined && !isTime(value.cooldownUntil)) {
|
|
203
|
+
issues.push(`${path}.cooldownUntil: expected a time`);
|
|
204
|
+
}
|
|
205
|
+
if (!isRecord(value.quota)) {
|
|
206
|
+
issues.push(`${path}.quota: expected quota readings`);
|
|
207
|
+
} else {
|
|
208
|
+
keys(value.quota, [], ['gemini', 'non-gemini'], `${path}.quota`, issues);
|
|
209
|
+
checkQuotaEntry(value.quota.gemini, `${path}.quota.gemini`, issues);
|
|
210
|
+
checkQuotaEntry(value.quota['non-gemini'], `${path}.quota.non-gemini`, issues);
|
|
211
|
+
}
|
|
212
|
+
if (value.tier !== undefined) {
|
|
213
|
+
const tier = value.tier;
|
|
214
|
+
if (!isRecord(tier)) {
|
|
215
|
+
issues.push(`${path}.tier: expected a plan tier`);
|
|
216
|
+
} else {
|
|
217
|
+
keys(tier, ['id', 'capturedAt'], ['paidId'], `${path}.tier`, issues);
|
|
218
|
+
if (typeof tier.id !== 'string') issues.push(`${path}.tier.id: expected text`);
|
|
219
|
+
if (tier.paidId !== undefined && typeof tier.paidId !== 'string') {
|
|
220
|
+
issues.push(`${path}.tier.paidId: expected text`);
|
|
221
|
+
}
|
|
222
|
+
if (!isTime(tier.capturedAt)) issues.push(`${path}.tier.capturedAt: expected a time`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function checkRoute(value, path, issues) {
|
|
227
|
+
if (value === null) return;
|
|
228
|
+
if (!isRecord(value)) {
|
|
229
|
+
issues.push(`${path}: expected a route`);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
keys(value, ['accountId', 'modelFamily', 'headerStyle', 'strategy', 'updatedAt'], [], path, issues);
|
|
233
|
+
if (typeof value.accountId !== 'string' || !ACCOUNT_ID.test(value.accountId)) {
|
|
234
|
+
issues.push(`${path}.accountId: expected an ordinal account id`);
|
|
235
|
+
}
|
|
236
|
+
if (value.modelFamily !== 'claude' && value.modelFamily !== 'gemini') {
|
|
237
|
+
issues.push(`${path}.modelFamily: unknown family`);
|
|
238
|
+
}
|
|
239
|
+
if (value.headerStyle !== 'antigravity' && value.headerStyle !== 'gemini-cli') {
|
|
240
|
+
issues.push(`${path}.headerStyle: unknown header style`);
|
|
241
|
+
}
|
|
242
|
+
if (value.strategy !== null && value.strategy !== 'sticky' && value.strategy !== 'round-robin' && value.strategy !== 'hybrid') {
|
|
243
|
+
issues.push(`${path}.strategy: unknown strategy`);
|
|
244
|
+
}
|
|
245
|
+
if (!isTime(value.updatedAt)) issues.push(`${path}.updatedAt: expected a time`);
|
|
246
|
+
}
|
|
247
|
+
function checkStatus(value, path, issues) {
|
|
248
|
+
if (!isRecord(value)) {
|
|
249
|
+
issues.push(`${path}: expected a status`);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
keys(value, ['checkedAt', 'quotaBackoffUntil', 'routingAuthoritative'], [], path, issues);
|
|
253
|
+
if (value.checkedAt !== null && !isTime(value.checkedAt)) {
|
|
254
|
+
issues.push(`${path}.checkedAt: expected a time or null`);
|
|
255
|
+
}
|
|
256
|
+
if (value.quotaBackoffUntil !== null && !isTime(value.quotaBackoffUntil)) {
|
|
257
|
+
issues.push(`${path}.quotaBackoffUntil: expected a time or null`);
|
|
258
|
+
}
|
|
259
|
+
if (typeof value.routingAuthoritative !== 'boolean') {
|
|
260
|
+
issues.push(`${path}.routingAuthoritative: expected true/false`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function checkNotification(value, path, issues) {
|
|
264
|
+
if (!isRecord(value)) {
|
|
265
|
+
issues.push(`${path}: expected a notification`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
keys(value, ['cursor', 'type', 'command', 'text'], [], path, issues);
|
|
269
|
+
if (!isCursor(value.cursor) || value.cursor < 1) {
|
|
270
|
+
issues.push(`${path}.cursor: expected a positive cursor`);
|
|
271
|
+
}
|
|
272
|
+
if (value.type !== 'open-dialog') {
|
|
273
|
+
issues.push(`${path}.type: unknown notification type`);
|
|
274
|
+
}
|
|
275
|
+
if (!GA_COMMANDS.includes(value.command)) {
|
|
276
|
+
issues.push(`${path}.command: unknown command`);
|
|
277
|
+
}
|
|
278
|
+
if (typeof value.text !== 'string') issues.push(`${path}.text: expected text`);
|
|
279
|
+
}
|
|
280
|
+
function checkBool(value, path, issues) {
|
|
281
|
+
if (typeof value !== 'boolean') issues.push(`${path}: expected true/false`);
|
|
282
|
+
}
|
|
283
|
+
function checkSettings(value, path, issues) {
|
|
284
|
+
if (!isRecord(value)) {
|
|
285
|
+
issues.push(`${path}: expected settings`);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
keys(value, ['routing', 'killswitch', 'logLevel', 'dump'], [], path, issues);
|
|
289
|
+
const {
|
|
290
|
+
routing,
|
|
291
|
+
killswitch,
|
|
292
|
+
dump
|
|
293
|
+
} = value;
|
|
294
|
+
if (!isRecord(routing)) issues.push(`${path}.routing: expected an object`);else {
|
|
295
|
+
keys(routing, ['cliFirst', 'quotaStyleFallback'], [], `${path}.routing`, issues);
|
|
296
|
+
checkBool(routing.cliFirst, `${path}.routing.cliFirst`, issues);
|
|
297
|
+
checkBool(routing.quotaStyleFallback, `${path}.routing.quotaStyleFallback`, issues);
|
|
298
|
+
}
|
|
299
|
+
if (!isRecord(killswitch)) issues.push(`${path}.killswitch: expected an object`);else {
|
|
300
|
+
keys(killswitch, ['enabled', 'minimumRemainingPercent'], [], `${path}.killswitch`, issues);
|
|
301
|
+
checkBool(killswitch.enabled, `${path}.killswitch.enabled`, issues);
|
|
302
|
+
checkPercent(killswitch.minimumRemainingPercent, `${path}.killswitch.minimumRemainingPercent`, issues);
|
|
303
|
+
}
|
|
304
|
+
if (!GA_LOG_LEVELS.includes(value.logLevel)) {
|
|
305
|
+
issues.push(`${path}.logLevel: unknown level`);
|
|
306
|
+
}
|
|
307
|
+
if (!isRecord(dump)) issues.push(`${path}.dump: expected an object`);else {
|
|
308
|
+
keys(dump, ['enabled'], [], `${path}.dump`, issues);
|
|
309
|
+
checkBool(dump.enabled, `${path}.dump.enabled`, issues);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function checkAccountsStatus(value, path, issues) {
|
|
313
|
+
if (!isRecord(value)) {
|
|
314
|
+
issues.push(`${path}: expected an accounts status`);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
if (value.kind === 'complete') {
|
|
318
|
+
keys(value, ['kind'], [], path, issues);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (value.kind === 'over-limit') {
|
|
322
|
+
keys(value, ['kind', 'count', 'limit'], [], path, issues);
|
|
323
|
+
if (!isCursor(value.count)) issues.push(`${path}.count: expected a count`);
|
|
324
|
+
if (value.limit !== 64) issues.push(`${path}.limit: unexpected limit`);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
issues.push(`${path}.kind: unknown accounts status`);
|
|
328
|
+
}
|
|
329
|
+
function checkAccountList(value, path, issues) {
|
|
330
|
+
if (value === null) return;
|
|
331
|
+
if (!Array.isArray(value) || value.length > 64) {
|
|
332
|
+
issues.push(`${path}: expected at most 64 accounts`);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
value.forEach((entry, index) => {
|
|
336
|
+
checkAccount(entry, `${path}.${index}`, issues);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** One command result, with the closed field list of its command. */
|
|
341
|
+
function checkCommandResult(value, path, issues) {
|
|
342
|
+
if (!isRecord(value)) {
|
|
343
|
+
issues.push(`${path}: expected a command result`);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const base = ['command', 'status', 'text'];
|
|
347
|
+
if (value.status !== 'applied' && value.status !== 'rejected' && value.status !== 'failed') {
|
|
348
|
+
issues.push(`${path}.status: unknown status`);
|
|
349
|
+
}
|
|
350
|
+
if (typeof value.text !== 'string') issues.push(`${path}.text: expected text`);
|
|
351
|
+
switch (value.command) {
|
|
352
|
+
case 'antigravity-quota':
|
|
353
|
+
keys(value, [...base, 'accounts'], [], path, issues);
|
|
354
|
+
checkAccountList(value.accounts, `${path}.accounts`, issues);
|
|
355
|
+
return;
|
|
356
|
+
case 'antigravity-account':
|
|
357
|
+
keys(value, [...base, 'accounts', 'authorizationUrl', 'targetOutcome'], [], path, issues);
|
|
358
|
+
checkAccountList(value.accounts, `${path}.accounts`, issues);
|
|
359
|
+
if (value.authorizationUrl !== null && !(typeof value.authorizationUrl === 'string' && /^https:\/\//.test(value.authorizationUrl) && value.authorizationUrl.length <= 4096)) {
|
|
360
|
+
issues.push(`${path}.authorizationUrl: expected an https link or null`);
|
|
361
|
+
}
|
|
362
|
+
if (value.targetOutcome !== null && !TARGET_OUTCOMES.includes(value.targetOutcome)) {
|
|
363
|
+
issues.push(`${path}.targetOutcome: unknown outcome`);
|
|
364
|
+
}
|
|
365
|
+
return;
|
|
366
|
+
case 'antigravity-routing':
|
|
367
|
+
keys(value, [...base, 'routing'], [], path, issues);
|
|
368
|
+
return;
|
|
369
|
+
case 'antigravity-killswitch':
|
|
370
|
+
keys(value, [...base, 'killswitch'], [], path, issues);
|
|
371
|
+
return;
|
|
372
|
+
case 'antigravity-dump':
|
|
373
|
+
keys(value, [...base, 'dump'], [], path, issues);
|
|
374
|
+
return;
|
|
375
|
+
case 'antigravity-logging':
|
|
376
|
+
keys(value, [...base, 'logLevel'], [], path, issues);
|
|
377
|
+
return;
|
|
378
|
+
default:
|
|
379
|
+
issues.push(`${path}.command: unknown command`);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** Unwraps the host's `{ output }` answer. */
|
|
384
|
+
function unwrap(raw, issues) {
|
|
385
|
+
if (!isRecord(raw)) {
|
|
386
|
+
issues.push('answer: expected an object');
|
|
387
|
+
return undefined;
|
|
388
|
+
}
|
|
389
|
+
keys(raw, ['output'], [], 'answer', issues);
|
|
390
|
+
return raw.output;
|
|
391
|
+
}
|
|
392
|
+
function finish(value, issues) {
|
|
393
|
+
return issues.length === 0 ? {
|
|
394
|
+
ok: true,
|
|
395
|
+
value: value
|
|
396
|
+
} : {
|
|
397
|
+
ok: false,
|
|
398
|
+
issues
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** Validates a `state` answer (the host's `{ output }` wrapper included). */
|
|
403
|
+
export function parseGaStateAnswer(raw) {
|
|
404
|
+
const issues = [];
|
|
405
|
+
const output = unwrap(raw, issues);
|
|
406
|
+
if (issues.length > 0) return {
|
|
407
|
+
ok: false,
|
|
408
|
+
issues
|
|
409
|
+
};
|
|
410
|
+
if (!isRecord(output)) return {
|
|
411
|
+
ok: false,
|
|
412
|
+
issues: ['output: expected an object']
|
|
413
|
+
};
|
|
414
|
+
checkVersion(output, 'output', issues);
|
|
415
|
+
if (output.kind === 'disposed') {
|
|
416
|
+
keys(output, ['version', 'kind', 'generation'], [], 'output', issues);
|
|
417
|
+
checkGeneration(output.generation, 'output.generation', issues);
|
|
418
|
+
return finish(output, issues);
|
|
419
|
+
}
|
|
420
|
+
if (output.kind !== 'snapshot') {
|
|
421
|
+
return {
|
|
422
|
+
ok: false,
|
|
423
|
+
issues: ['output.kind: unknown answer']
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
keys(output, ['version', 'kind', 'generation', 'scope', 'reset', 'cursor', 'dropped', 'more', 'notifications', 'readSeq', 'accountsStatus', 'accounts', 'route', 'status', 'settings'], [], 'output', issues);
|
|
427
|
+
if (!isCursor(output.readSeq)) issues.push('output.readSeq: expected a count');
|
|
428
|
+
checkAccountsStatus(output.accountsStatus, 'output.accountsStatus', issues);
|
|
429
|
+
checkSettings(output.settings, 'output.settings', issues);
|
|
430
|
+
checkGeneration(output.generation, 'output.generation', issues);
|
|
431
|
+
checkScope(output.scope, 'output.scope', issues);
|
|
432
|
+
if (output.reset !== null && output.reset !== 'initial' && output.reset !== 'generation-changed' && output.reset !== 'cursor-ahead') {
|
|
433
|
+
issues.push('output.reset: unknown reset');
|
|
434
|
+
}
|
|
435
|
+
if (!isCursor(output.cursor)) issues.push('output.cursor: expected a cursor');
|
|
436
|
+
if (!isCursor(output.dropped)) issues.push('output.dropped: expected a count');
|
|
437
|
+
if (typeof output.more !== 'boolean') issues.push('output.more: expected true/false');
|
|
438
|
+
if (!Array.isArray(output.notifications) || output.notifications.length > 32) {
|
|
439
|
+
issues.push('output.notifications: expected at most 32 notifications');
|
|
440
|
+
} else {
|
|
441
|
+
output.notifications.forEach((entry, index) => {
|
|
442
|
+
checkNotification(entry, `output.notifications.${index}`, issues);
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
if (!Array.isArray(output.accounts) || output.accounts.length > 64) {
|
|
446
|
+
issues.push('output.accounts: expected at most 64 accounts');
|
|
447
|
+
} else {
|
|
448
|
+
output.accounts.forEach((entry, index) => {
|
|
449
|
+
checkAccount(entry, `output.accounts.${index}`, issues);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
checkRoute(output.route, 'output.route', issues);
|
|
453
|
+
checkStatus(output.status, 'output.status', issues);
|
|
454
|
+
return finish(output, issues);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** Validates an `apply` answer (the host's `{ output }` wrapper included). */
|
|
458
|
+
export function parseGaApplyAnswer(raw) {
|
|
459
|
+
const issues = [];
|
|
460
|
+
const output = unwrap(raw, issues);
|
|
461
|
+
if (issues.length > 0) return {
|
|
462
|
+
ok: false,
|
|
463
|
+
issues
|
|
464
|
+
};
|
|
465
|
+
if (!isRecord(output)) return {
|
|
466
|
+
ok: false,
|
|
467
|
+
issues: ['output: expected an object']
|
|
468
|
+
};
|
|
469
|
+
checkVersion(output, 'output', issues);
|
|
470
|
+
if (output.kind === 'stale-generation' || output.kind === 'disposed') {
|
|
471
|
+
keys(output, ['version', 'kind', 'generation'], [], 'output', issues);
|
|
472
|
+
checkGeneration(output.generation, 'output.generation', issues);
|
|
473
|
+
return finish(output, issues);
|
|
474
|
+
}
|
|
475
|
+
if (output.kind !== 'applied') {
|
|
476
|
+
return {
|
|
477
|
+
ok: false,
|
|
478
|
+
issues: ['output.kind: unknown answer']
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
keys(output, ['version', 'kind', 'generation', 'scope', 'result'], [], 'output', issues);
|
|
482
|
+
checkGeneration(output.generation, 'output.generation', issues);
|
|
483
|
+
checkScope(output.scope, 'output.scope', issues);
|
|
484
|
+
checkCommandResult(output.result, 'output.result', issues);
|
|
485
|
+
return finish(output, issues);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// ── Location client ─────────────────────────────────────────────────────────
|
|
489
|
+
|
|
490
|
+
/** The server restarted or was disposed; the action did nothing. */
|
|
491
|
+
export class GaStaleError extends Error {
|
|
492
|
+
constructor(reason) {
|
|
493
|
+
super(reason === 'not-bound' ? 'Antigravity auth is not connected at this location yet.' : 'Antigravity auth restarted; nothing was changed. Reopen /antigravity.');
|
|
494
|
+
this.reason = reason;
|
|
495
|
+
this.name = 'GaStaleError';
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/** This client was disposed; its answers are no longer read. */
|
|
500
|
+
export class GaClientDisposedError extends Error {
|
|
501
|
+
constructor() {
|
|
502
|
+
super('Antigravity TUI client disposed');
|
|
503
|
+
this.name = 'GaClientDisposedError';
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
export function scopeKey(scope) {
|
|
507
|
+
return scope.kind === 'session' ? `session:${scope.sessionID}` : 'sessionless';
|
|
508
|
+
}
|
|
509
|
+
export function createGaLocationClient(options) {
|
|
510
|
+
let generation = null;
|
|
511
|
+
const cursors = new Map();
|
|
512
|
+
let isDisposed = false;
|
|
513
|
+
// Bumped on every rebind and on disposal. A request remembers the epoch
|
|
514
|
+
// it was sent in; an answer from an older epoch is dropped unread.
|
|
515
|
+
let epoch = 0;
|
|
516
|
+
const call = (method, input) => options.call({
|
|
517
|
+
rpcID: GA_RPC_ID,
|
|
518
|
+
method,
|
|
519
|
+
...(options.location ? {
|
|
520
|
+
location: options.location
|
|
521
|
+
} : {}),
|
|
522
|
+
input
|
|
523
|
+
});
|
|
524
|
+
const rebind = next => {
|
|
525
|
+
if (next === generation) return;
|
|
526
|
+
generation = next;
|
|
527
|
+
cursors.clear();
|
|
528
|
+
epoch += 1;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
// State pulls run one at a time, so two pulls can never send the same
|
|
532
|
+
// cursor and hand the same notification over twice.
|
|
533
|
+
let pullChain = Promise.resolve();
|
|
534
|
+
const pullNow = async scope => {
|
|
535
|
+
if (isDisposed) throw new GaClientDisposedError();
|
|
536
|
+
const sentEpoch = epoch;
|
|
537
|
+
const key = scopeKey(scope);
|
|
538
|
+
const raw = await call('state', {
|
|
539
|
+
version: GA_RPC_VERSION,
|
|
540
|
+
generation,
|
|
541
|
+
scope,
|
|
542
|
+
cursor: cursors.get(key) ?? 0
|
|
543
|
+
});
|
|
544
|
+
if (isDisposed || sentEpoch !== epoch) return {
|
|
545
|
+
kind: 'dropped'
|
|
546
|
+
};
|
|
547
|
+
const parsed = parseGaStateAnswer(raw);
|
|
548
|
+
if (!parsed.ok) {
|
|
549
|
+
options.logger?.warn('ga-state-refused', {
|
|
550
|
+
issues: parsed.issues
|
|
551
|
+
});
|
|
552
|
+
throw new MenuRefusedError(parsed.issues);
|
|
553
|
+
}
|
|
554
|
+
const output = parsed.value;
|
|
555
|
+
if (output.kind === 'disposed') {
|
|
556
|
+
// The activation we were bound to is gone; the next pull binds to
|
|
557
|
+
// whichever one the location runs now.
|
|
558
|
+
rebind(null);
|
|
559
|
+
return {
|
|
560
|
+
kind: 'server-disposed'
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
if (scopeKey(output.scope) !== key) {
|
|
564
|
+
options.logger?.warn('ga-state-scope-mismatch', {});
|
|
565
|
+
throw new MenuRefusedError(['output.scope: not the requested scope']);
|
|
566
|
+
}
|
|
567
|
+
if (output.generation !== generation) {
|
|
568
|
+
rebind(output.generation);
|
|
569
|
+
}
|
|
570
|
+
cursors.set(key, output.cursor);
|
|
571
|
+
return {
|
|
572
|
+
kind: 'snapshot',
|
|
573
|
+
snapshot: output
|
|
574
|
+
};
|
|
575
|
+
};
|
|
576
|
+
return {
|
|
577
|
+
generation: () => generation,
|
|
578
|
+
cursor: scope => cursors.get(scopeKey(scope)) ?? 0,
|
|
579
|
+
disposed: () => isDisposed,
|
|
580
|
+
dispose() {
|
|
581
|
+
isDisposed = true;
|
|
582
|
+
epoch += 1;
|
|
583
|
+
},
|
|
584
|
+
pull(scope) {
|
|
585
|
+
const run = pullChain.then(() => pullNow(scope));
|
|
586
|
+
pullChain = run.catch(() => undefined);
|
|
587
|
+
return run;
|
|
588
|
+
},
|
|
589
|
+
async apply(scope, body) {
|
|
590
|
+
if (isDisposed) throw new GaClientDisposedError();
|
|
591
|
+
const bound = generation;
|
|
592
|
+
if (bound === null) throw new GaStaleError('not-bound');
|
|
593
|
+
const sentEpoch = epoch;
|
|
594
|
+
const raw = await call('apply', {
|
|
595
|
+
version: GA_RPC_VERSION,
|
|
596
|
+
generation: bound,
|
|
597
|
+
scope,
|
|
598
|
+
...body
|
|
599
|
+
});
|
|
600
|
+
if (isDisposed) throw new GaClientDisposedError();
|
|
601
|
+
const parsed = parseGaApplyAnswer(raw);
|
|
602
|
+
if (!parsed.ok) {
|
|
603
|
+
options.logger?.warn('ga-apply-refused', {
|
|
604
|
+
issues: parsed.issues
|
|
605
|
+
});
|
|
606
|
+
throw new MenuRefusedError(parsed.issues);
|
|
607
|
+
}
|
|
608
|
+
const output = parsed.value;
|
|
609
|
+
if (output.kind === 'stale-generation' || output.kind === 'disposed') {
|
|
610
|
+
if (sentEpoch === epoch) rebind(null);
|
|
611
|
+
throw new GaStaleError(output.kind);
|
|
612
|
+
}
|
|
613
|
+
if (output.generation !== bound || scopeKey(output.scope) !== scopeKey(scope)) {
|
|
614
|
+
throw new MenuRefusedError(['output: answered for another activation or scope']);
|
|
615
|
+
}
|
|
616
|
+
return output.result;
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// ── Menu over the native state ──────────────────────────────────────────────
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* GA notifications name only a dialog command, so this host builds the
|
|
625
|
+
* `/antigravity` menu itself from the latest `state` answer: the accounts
|
|
626
|
+
* with their opaque selectors and the location's settings, both read fresh
|
|
627
|
+
* for that answer. The shared drawer renders it like the OpenCode 1 menu.
|
|
628
|
+
* Each item and action id encodes what the action sends; an account is named
|
|
629
|
+
* only by its selector, never by position or `acct-<n>` id.
|
|
630
|
+
*/
|
|
631
|
+
const SECTION_FOR_COMMAND = {
|
|
632
|
+
'antigravity-account': 'accounts',
|
|
633
|
+
'antigravity-quota': 'quota',
|
|
634
|
+
'antigravity-routing': 'routing',
|
|
635
|
+
'antigravity-killswitch': 'limits',
|
|
636
|
+
'antigravity-dump': 'diagnostics',
|
|
637
|
+
'antigravity-logging': 'diagnostics'
|
|
638
|
+
};
|
|
639
|
+
export function sectionForCommand(command) {
|
|
640
|
+
return SECTION_FOR_COMMAND[command];
|
|
641
|
+
}
|
|
642
|
+
const ACCOUNT_ITEM_PREFIX = 'account:';
|
|
643
|
+
function onOff(value) {
|
|
644
|
+
return value ? 'on' : 'off';
|
|
645
|
+
}
|
|
646
|
+
function quotaLine(account, now) {
|
|
647
|
+
const projected = projectSidebar({
|
|
648
|
+
accounts: [account],
|
|
649
|
+
route: null,
|
|
650
|
+
status: {
|
|
651
|
+
checkedAt: 0,
|
|
652
|
+
quotaBackoffUntil: null
|
|
653
|
+
},
|
|
654
|
+
now
|
|
655
|
+
}).accounts[0];
|
|
656
|
+
const pools = (projected?.quota ?? []).map(row => `${row.label} ${row.figure}${row.reset ? ` · ${row.reset}` : ''}`).join(' · ');
|
|
657
|
+
return `${account.label}: ${pools}`;
|
|
658
|
+
}
|
|
659
|
+
export function buildGaMenu(snapshot, now) {
|
|
660
|
+
const {
|
|
661
|
+
settings
|
|
662
|
+
} = snapshot;
|
|
663
|
+
const overLimit = snapshot.accountsStatus.kind === 'over-limit';
|
|
664
|
+
const accountLines = overLimit ? [`${snapshot.accountsStatus.kind === 'over-limit' ? snapshot.accountsStatus.count : 0} accounts; more than this view can list. Manage them from the command line.`] : [snapshot.accounts.length === 0 ? 'No accounts yet.' : `${snapshot.accounts.length} account${snapshot.accounts.length === 1 ? '' : 's'}`];
|
|
665
|
+
const sections = [{
|
|
666
|
+
id: 'accounts',
|
|
667
|
+
slot: 'accounts',
|
|
668
|
+
title: 'Accounts',
|
|
669
|
+
lines: accountLines,
|
|
670
|
+
items: snapshot.accounts.map(account => {
|
|
671
|
+
const projected = projectAccount(account, now);
|
|
672
|
+
const use = (id, label, description) => ({
|
|
673
|
+
id,
|
|
674
|
+
label,
|
|
675
|
+
description,
|
|
676
|
+
knobs: []
|
|
677
|
+
});
|
|
678
|
+
return {
|
|
679
|
+
id: `${ACCOUNT_ITEM_PREFIX}${account.selector}`,
|
|
680
|
+
label: account.label,
|
|
681
|
+
detail: `${projected.status} · ${projected.health}`,
|
|
682
|
+
actions: [account.enabled ? use('disable', 'Disable', 'Stop routing requests to this account.') : use('enable', 'Enable', 'Route requests to this account again.'), use('select-active', 'Use for all models', 'Make this the current account.'), use('select-claude', 'Use for Claude', 'Make this the current Claude account.'), use('select-gemini', 'Use for Gemini', 'Make this the current Gemini account.'), {
|
|
683
|
+
id: 'remove',
|
|
684
|
+
label: 'Remove',
|
|
685
|
+
description: 'Delete this account from this machine.',
|
|
686
|
+
knobs: [],
|
|
687
|
+
confirm: {
|
|
688
|
+
message: `Remove ${account.label}? This cannot be undone.`,
|
|
689
|
+
irreversible: true
|
|
690
|
+
}
|
|
691
|
+
}]
|
|
692
|
+
};
|
|
693
|
+
}),
|
|
694
|
+
actions: [{
|
|
695
|
+
id: 'add',
|
|
696
|
+
label: 'Add account',
|
|
697
|
+
description: 'Sign in with Google in your browser.',
|
|
698
|
+
knobs: []
|
|
699
|
+
}]
|
|
700
|
+
}, {
|
|
701
|
+
id: 'quota',
|
|
702
|
+
slot: 'quota',
|
|
703
|
+
title: 'Quota',
|
|
704
|
+
lines: overLimit ? ['Quota is not listed while the account list is over the limit.'] : snapshot.accounts.length === 0 ? ['No accounts yet.'] : snapshot.accounts.map(account => quotaLine(account, now)),
|
|
705
|
+
items: [],
|
|
706
|
+
actions: [{
|
|
707
|
+
id: 'refresh',
|
|
708
|
+
label: 'Check quota now',
|
|
709
|
+
description: 'Ask Google for every account’s current quota.',
|
|
710
|
+
knobs: []
|
|
711
|
+
}]
|
|
712
|
+
}, {
|
|
713
|
+
id: 'routing',
|
|
714
|
+
slot: 'routing',
|
|
715
|
+
title: 'Routing',
|
|
716
|
+
lines: [`Gemini CLI first: ${onOff(settings.routing.cliFirst)}`, `Quota-style fallback: ${onOff(settings.routing.quotaStyleFallback)}`],
|
|
717
|
+
items: [],
|
|
718
|
+
actions: [{
|
|
719
|
+
id: settings.routing.cliFirst ? 'cli-first-off' : 'cli-first-on',
|
|
720
|
+
label: `Turn Gemini CLI first ${settings.routing.cliFirst ? 'off' : 'on'}`,
|
|
721
|
+
knobs: []
|
|
722
|
+
}, {
|
|
723
|
+
id: settings.routing.quotaStyleFallback ? 'quota-fallback-off' : 'quota-fallback-on',
|
|
724
|
+
label: `Turn quota-style fallback ${settings.routing.quotaStyleFallback ? 'off' : 'on'}`,
|
|
725
|
+
knobs: []
|
|
726
|
+
}]
|
|
727
|
+
}, {
|
|
728
|
+
id: 'limits',
|
|
729
|
+
slot: 'limits',
|
|
730
|
+
title: 'Limits',
|
|
731
|
+
lines: [`Killswitch: ${onOff(settings.killswitch.enabled)}`, `Minimum remaining quota: ${settings.killswitch.minimumRemainingPercent}%`],
|
|
732
|
+
items: [],
|
|
733
|
+
actions: [{
|
|
734
|
+
id: settings.killswitch.enabled ? 'killswitch-off' : 'killswitch-on',
|
|
735
|
+
label: `Turn killswitch ${settings.killswitch.enabled ? 'off' : 'on'}`,
|
|
736
|
+
description: 'Skip accounts whose quota is below the minimum.',
|
|
737
|
+
knobs: []
|
|
738
|
+
}, {
|
|
739
|
+
id: 'killswitch-minimum',
|
|
740
|
+
label: 'Set minimum remaining quota',
|
|
741
|
+
knobs: [{
|
|
742
|
+
kind: 'number',
|
|
743
|
+
id: 'percent',
|
|
744
|
+
label: 'Percent (0-100)',
|
|
745
|
+
value: settings.killswitch.minimumRemainingPercent,
|
|
746
|
+
min: 0,
|
|
747
|
+
max: 100,
|
|
748
|
+
required: true
|
|
749
|
+
}]
|
|
750
|
+
}]
|
|
751
|
+
}, {
|
|
752
|
+
id: 'diagnostics',
|
|
753
|
+
slot: 'diagnostics',
|
|
754
|
+
title: 'Diagnostics',
|
|
755
|
+
lines: [`Logging: ${settings.logLevel}`, `Wire dump: ${onOff(settings.dump.enabled)}`],
|
|
756
|
+
items: [],
|
|
757
|
+
actions: [{
|
|
758
|
+
id: 'log-level',
|
|
759
|
+
label: 'Set log level',
|
|
760
|
+
knobs: [{
|
|
761
|
+
kind: 'choice',
|
|
762
|
+
id: 'level',
|
|
763
|
+
label: 'Level',
|
|
764
|
+
value: settings.logLevel,
|
|
765
|
+
choices: GA_LOG_LEVELS.map(level => ({
|
|
766
|
+
value: level,
|
|
767
|
+
label: level
|
|
768
|
+
}))
|
|
769
|
+
}]
|
|
770
|
+
}, {
|
|
771
|
+
id: settings.dump.enabled ? 'dump-off' : 'dump-on',
|
|
772
|
+
label: `Turn wire dump ${settings.dump.enabled ? 'off' : 'on'}`,
|
|
773
|
+
description: 'Write request and response bodies to the dump folder.',
|
|
774
|
+
knobs: []
|
|
775
|
+
}]
|
|
776
|
+
}];
|
|
777
|
+
return {
|
|
778
|
+
command: ANTIGRAVITY_MENU_COMMAND,
|
|
779
|
+
title: ANTIGRAVITY_MENU_TITLE,
|
|
780
|
+
sections
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/** Why a drawer choice could not be turned into a native apply. */
|
|
785
|
+
export class GaMenuChoiceError extends Error {
|
|
786
|
+
constructor(message) {
|
|
787
|
+
super(message);
|
|
788
|
+
this.name = 'GaMenuChoiceError';
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
const TEXT_ACTIONS = {
|
|
792
|
+
'accounts/add': {
|
|
793
|
+
command: 'antigravity-account',
|
|
794
|
+
arguments: 'add-oauth-start'
|
|
795
|
+
},
|
|
796
|
+
'quota/refresh': {
|
|
797
|
+
command: 'antigravity-quota',
|
|
798
|
+
arguments: 'refresh'
|
|
799
|
+
},
|
|
800
|
+
'routing/cli-first-on': {
|
|
801
|
+
command: 'antigravity-routing',
|
|
802
|
+
arguments: 'cli_first=true'
|
|
803
|
+
},
|
|
804
|
+
'routing/cli-first-off': {
|
|
805
|
+
command: 'antigravity-routing',
|
|
806
|
+
arguments: 'cli_first=false'
|
|
807
|
+
},
|
|
808
|
+
'routing/quota-fallback-on': {
|
|
809
|
+
command: 'antigravity-routing',
|
|
810
|
+
arguments: 'quota_style_fallback=true'
|
|
811
|
+
},
|
|
812
|
+
'routing/quota-fallback-off': {
|
|
813
|
+
command: 'antigravity-routing',
|
|
814
|
+
arguments: 'quota_style_fallback=false'
|
|
815
|
+
},
|
|
816
|
+
'limits/killswitch-on': {
|
|
817
|
+
command: 'antigravity-killswitch',
|
|
818
|
+
arguments: 'enabled=true'
|
|
819
|
+
},
|
|
820
|
+
'limits/killswitch-off': {
|
|
821
|
+
command: 'antigravity-killswitch',
|
|
822
|
+
arguments: 'enabled=false'
|
|
823
|
+
},
|
|
824
|
+
'diagnostics/dump-on': {
|
|
825
|
+
command: 'antigravity-dump',
|
|
826
|
+
arguments: 'on'
|
|
827
|
+
},
|
|
828
|
+
'diagnostics/dump-off': {
|
|
829
|
+
command: 'antigravity-dump',
|
|
830
|
+
arguments: 'off'
|
|
831
|
+
}
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* The native apply for one drawer choice. Explicit target values are sent
|
|
836
|
+
* ("turn on"), never a toggle, so a repeated or late choice cannot flip a
|
|
837
|
+
* setting back. An account item sends its selector exactly as the server
|
|
838
|
+
* issued it; a malformed one is refused here rather than guessed at.
|
|
839
|
+
*/
|
|
840
|
+
export function gaApplyBody(request) {
|
|
841
|
+
const key = `${request.sectionId}/${request.actionId}`;
|
|
842
|
+
if (request.sectionId === 'accounts' && request.itemId !== undefined) {
|
|
843
|
+
if (!request.itemId.startsWith(ACCOUNT_ITEM_PREFIX)) {
|
|
844
|
+
throw new GaMenuChoiceError('That account entry is not valid.');
|
|
845
|
+
}
|
|
846
|
+
const selector = request.itemId.slice(ACCOUNT_ITEM_PREFIX.length);
|
|
847
|
+
if (!SELECTOR.test(selector)) {
|
|
848
|
+
throw new GaMenuChoiceError('That account entry is not valid.');
|
|
849
|
+
}
|
|
850
|
+
const action = request.actionId === 'enable' ? {
|
|
851
|
+
kind: 'enable',
|
|
852
|
+
selector
|
|
853
|
+
} : request.actionId === 'disable' ? {
|
|
854
|
+
kind: 'disable',
|
|
855
|
+
selector
|
|
856
|
+
} : request.actionId === 'remove' ? {
|
|
857
|
+
kind: 'remove',
|
|
858
|
+
selector
|
|
859
|
+
} : request.actionId === 'select-active' ? {
|
|
860
|
+
kind: 'select',
|
|
861
|
+
selector,
|
|
862
|
+
target: 'active'
|
|
863
|
+
} : request.actionId === 'select-claude' ? {
|
|
864
|
+
kind: 'select',
|
|
865
|
+
selector,
|
|
866
|
+
target: 'claude'
|
|
867
|
+
} : request.actionId === 'select-gemini' ? {
|
|
868
|
+
kind: 'select',
|
|
869
|
+
selector,
|
|
870
|
+
target: 'gemini'
|
|
871
|
+
} : undefined;
|
|
872
|
+
if (!action) throw new GaMenuChoiceError('Unknown account action.');
|
|
873
|
+
if (action.kind === 'remove' && request.confirmed !== true) {
|
|
874
|
+
throw new GaMenuChoiceError('Removing an account needs a confirmation.');
|
|
875
|
+
}
|
|
876
|
+
return {
|
|
877
|
+
command: 'antigravity-account',
|
|
878
|
+
action
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
if (request.itemId !== undefined) {
|
|
882
|
+
throw new GaMenuChoiceError('Unknown menu entry.');
|
|
883
|
+
}
|
|
884
|
+
const fixed = TEXT_ACTIONS[key];
|
|
885
|
+
if (fixed) return fixed;
|
|
886
|
+
if (key === 'limits/killswitch-minimum') {
|
|
887
|
+
const percent = request.values.percent;
|
|
888
|
+
if (typeof percent !== 'number' || !Number.isInteger(percent) || percent < 0 || percent > 100) {
|
|
889
|
+
throw new GaMenuChoiceError('The minimum must be a whole number from 0 to 100.');
|
|
890
|
+
}
|
|
891
|
+
return {
|
|
892
|
+
command: 'antigravity-killswitch',
|
|
893
|
+
arguments: `minimum_remaining_percent=${percent}`
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
if (key === 'diagnostics/log-level') {
|
|
897
|
+
const level = request.values.level;
|
|
898
|
+
if (!GA_LOG_LEVELS.includes(level)) {
|
|
899
|
+
throw new GaMenuChoiceError('Unknown log level.');
|
|
900
|
+
}
|
|
901
|
+
return {
|
|
902
|
+
command: 'antigravity-logging',
|
|
903
|
+
arguments: String(level)
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
throw new GaMenuChoiceError('Unknown menu action.');
|
|
907
|
+
}
|
|
908
|
+
const TARGET_TEXT = {
|
|
909
|
+
'stale-target': 'That account changed since the list was shown; nothing was changed. Choose it again from the refreshed list.',
|
|
910
|
+
'unknown-target': 'That account is no longer known; nothing was changed. Choose it again from the refreshed list.',
|
|
911
|
+
'unsupported-index-action': 'Accounts can only be chosen from the list; nothing was changed.',
|
|
912
|
+
failed: 'The account action did not complete.'
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* Turns a native command result into the drawer's result. `ok` is true only
|
|
917
|
+
* when the command applied and, for an account action, its target applied.
|
|
918
|
+
* A sign-in link is shown in full: on GA the browser returns to this
|
|
919
|
+
* machine's sign-in listener, so there is nothing to paste.
|
|
920
|
+
*/
|
|
921
|
+
export function gaMenuResult(result, menu) {
|
|
922
|
+
const outcome = result.targetOutcome ?? null;
|
|
923
|
+
const ok = result.status === 'applied' && (outcome === null || outcome === 'applied');
|
|
924
|
+
let text = result.text;
|
|
925
|
+
if (outcome !== null && outcome !== 'applied') {
|
|
926
|
+
text = `${TARGET_TEXT[outcome]}`;
|
|
927
|
+
}
|
|
928
|
+
if (result.authorizationUrl) {
|
|
929
|
+
text = `Open ${result.authorizationUrl} in your browser and sign in.\nThe account is added when the browser returns here; there is nothing to paste.`;
|
|
930
|
+
}
|
|
931
|
+
return {
|
|
932
|
+
command: ANTIGRAVITY_MENU_COMMAND,
|
|
933
|
+
ok,
|
|
934
|
+
text,
|
|
935
|
+
...(ok ? {} : {
|
|
936
|
+
code: outcome ?? result.status
|
|
937
|
+
}),
|
|
938
|
+
menu
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// ── Dialogs ─────────────────────────────────────────────────────────────────
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* `MenuUi` over the GA dialog API. After `isActive()` turns false every call
|
|
946
|
+
* is inert: a select resolves as dismissed and nothing is shown.
|
|
947
|
+
*/
|
|
948
|
+
export function createGaMenuUi(context, isActive) {
|
|
949
|
+
const {
|
|
950
|
+
dialog,
|
|
951
|
+
toast
|
|
952
|
+
} = context.ui;
|
|
953
|
+
return {
|
|
954
|
+
async select(input) {
|
|
955
|
+
if (!isActive()) return undefined;
|
|
956
|
+
dialog.set({
|
|
957
|
+
size: 'xlarge'
|
|
958
|
+
});
|
|
959
|
+
const chosen = await dialog.select({
|
|
960
|
+
title: input.title,
|
|
961
|
+
options: input.options.map(option => ({
|
|
962
|
+
...option
|
|
963
|
+
})),
|
|
964
|
+
...(input.current === undefined ? {} : {
|
|
965
|
+
current: input.current
|
|
966
|
+
})
|
|
967
|
+
});
|
|
968
|
+
return isActive() ? chosen : undefined;
|
|
969
|
+
},
|
|
970
|
+
async prompt(input) {
|
|
971
|
+
if (!isActive()) return undefined;
|
|
972
|
+
dialog.set({
|
|
973
|
+
size: 'xlarge'
|
|
974
|
+
});
|
|
975
|
+
const value = await dialog.prompt({
|
|
976
|
+
...input
|
|
977
|
+
});
|
|
978
|
+
return isActive() ? value : undefined;
|
|
979
|
+
},
|
|
980
|
+
async confirm(input) {
|
|
981
|
+
if (!isActive()) return false;
|
|
982
|
+
const yes = await dialog.confirm({
|
|
983
|
+
...input
|
|
984
|
+
});
|
|
985
|
+
return isActive() && yes === true;
|
|
986
|
+
},
|
|
987
|
+
async alert(input) {
|
|
988
|
+
if (!isActive()) return;
|
|
989
|
+
await dialog.alert({
|
|
990
|
+
...input
|
|
991
|
+
});
|
|
992
|
+
},
|
|
993
|
+
toast(message, kind = 'info') {
|
|
994
|
+
if (isActive()) toast.show({
|
|
995
|
+
message,
|
|
996
|
+
variant: kind
|
|
997
|
+
});
|
|
998
|
+
},
|
|
999
|
+
clear() {
|
|
1000
|
+
if (isActive()) dialog.clear();
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// ── Poller ──────────────────────────────────────────────────────────────────
|
|
1006
|
+
|
|
1007
|
+
export function currentScope(route) {
|
|
1008
|
+
return route.type === 'session' ? {
|
|
1009
|
+
kind: 'session',
|
|
1010
|
+
sessionID: route.sessionID
|
|
1011
|
+
} : {
|
|
1012
|
+
kind: 'sessionless'
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* One poll tick: pull the current scope, hand every new notification over in
|
|
1017
|
+
* cursor order, and keep pulling (bounded) while the server says more are
|
|
1018
|
+
* waiting. Never throws; a failed pull is logged and the next tick retries.
|
|
1019
|
+
*/
|
|
1020
|
+
export async function pollGaOnce(options) {
|
|
1021
|
+
const scope = options.scope();
|
|
1022
|
+
for (let pulls = 0; pulls < MAX_PULLS_PER_TICK; pulls += 1) {
|
|
1023
|
+
let result;
|
|
1024
|
+
try {
|
|
1025
|
+
result = await options.client.pull(scope);
|
|
1026
|
+
} catch (error) {
|
|
1027
|
+
if (!(error instanceof GaClientDisposedError)) {
|
|
1028
|
+
options.logger?.warn('ga-pull-failed', {
|
|
1029
|
+
error: error instanceof Error ? error.name : typeof error
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
return;
|
|
1033
|
+
}
|
|
1034
|
+
if (result.kind !== 'snapshot') return;
|
|
1035
|
+
const {
|
|
1036
|
+
snapshot
|
|
1037
|
+
} = result;
|
|
1038
|
+
options.onSnapshot(snapshot);
|
|
1039
|
+
for (const notification of [...snapshot.notifications].sort((a, b) => a.cursor - b.cursor)) {
|
|
1040
|
+
if (options.client.disposed()) return;
|
|
1041
|
+
options.onNotification(notification, snapshot.scope);
|
|
1042
|
+
}
|
|
1043
|
+
if (!snapshot.more) return;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
// ── Sidebar ─────────────────────────────────────────────────────────────────
|
|
1048
|
+
|
|
1049
|
+
function GaSidebar(props) {
|
|
1050
|
+
// The route line belongs to one session; show it only in that session's
|
|
1051
|
+
// sidebar, never another session's.
|
|
1052
|
+
const route = () => {
|
|
1053
|
+
const view = props.view();
|
|
1054
|
+
if (view === undefined || view.scope.kind !== 'session') return null;
|
|
1055
|
+
return view.scope.sessionID === props.sessionID ? view.projected.route : null;
|
|
1056
|
+
};
|
|
1057
|
+
return (() => {
|
|
1058
|
+
var _el$ = _$createElement("box"),
|
|
1059
|
+
_el$2 = _$createElement("text"),
|
|
1060
|
+
_el$3 = _$createElement("b");
|
|
1061
|
+
_$insertNode(_el$, _el$2);
|
|
1062
|
+
_$setProp(_el$, "flexDirection", 'column');
|
|
1063
|
+
_$setProp(_el$, "width", '100%');
|
|
1064
|
+
_$insertNode(_el$2, _el$3);
|
|
1065
|
+
_$insertNode(_el$3, _$createTextNode(`Antigravity`));
|
|
1066
|
+
_$insert(_el$, _$createComponent(Show, {
|
|
1067
|
+
get when() {
|
|
1068
|
+
return props.view();
|
|
1069
|
+
},
|
|
1070
|
+
get fallback() {
|
|
1071
|
+
return (() => {
|
|
1072
|
+
var _el$5 = _$createElement("text");
|
|
1073
|
+
_$insertNode(_el$5, _$createTextNode(`connecting…`));
|
|
1074
|
+
return _el$5;
|
|
1075
|
+
})();
|
|
1076
|
+
},
|
|
1077
|
+
children: view => [_$createComponent(For, {
|
|
1078
|
+
get each() {
|
|
1079
|
+
return view().projected.accounts;
|
|
1080
|
+
},
|
|
1081
|
+
children: account => (() => {
|
|
1082
|
+
var _el$7 = _$createElement("box"),
|
|
1083
|
+
_el$8 = _$createElement("box"),
|
|
1084
|
+
_el$9 = _$createElement("text"),
|
|
1085
|
+
_el$0 = _$createElement("text"),
|
|
1086
|
+
_el$1 = _$createElement("text");
|
|
1087
|
+
_$insertNode(_el$7, _el$8);
|
|
1088
|
+
_$insertNode(_el$7, _el$1);
|
|
1089
|
+
_$setProp(_el$7, "flexDirection", 'column');
|
|
1090
|
+
_$setProp(_el$7, "width", '100%');
|
|
1091
|
+
_$insertNode(_el$8, _el$9);
|
|
1092
|
+
_$insertNode(_el$8, _el$0);
|
|
1093
|
+
_$setProp(_el$8, "flexDirection", 'row');
|
|
1094
|
+
_$setProp(_el$8, "justifyContent", 'space-between');
|
|
1095
|
+
_$setProp(_el$8, "width", '100%');
|
|
1096
|
+
_$insert(_el$9, () => account.label);
|
|
1097
|
+
_$insert(_el$0, () => account.status);
|
|
1098
|
+
_$insert(_el$7, _$createComponent(For, {
|
|
1099
|
+
get each() {
|
|
1100
|
+
return account.quota;
|
|
1101
|
+
},
|
|
1102
|
+
children: row => (() => {
|
|
1103
|
+
var _el$10 = _$createElement("box"),
|
|
1104
|
+
_el$11 = _$createElement("text"),
|
|
1105
|
+
_el$12 = _$createElement("text");
|
|
1106
|
+
_$insertNode(_el$10, _el$11);
|
|
1107
|
+
_$insertNode(_el$10, _el$12);
|
|
1108
|
+
_$setProp(_el$10, "flexDirection", 'row');
|
|
1109
|
+
_$setProp(_el$10, "justifyContent", 'space-between');
|
|
1110
|
+
_$setProp(_el$10, "width", '100%');
|
|
1111
|
+
_$insert(_el$11, () => `${row.label.padEnd(6)}${row.figure}`);
|
|
1112
|
+
_$insert(_el$12, () => row.reset);
|
|
1113
|
+
return _el$10;
|
|
1114
|
+
})()
|
|
1115
|
+
}), _el$1);
|
|
1116
|
+
_$insert(_el$1, () => ` ${account.health}`);
|
|
1117
|
+
return _el$7;
|
|
1118
|
+
})()
|
|
1119
|
+
}), _$createComponent(Show, {
|
|
1120
|
+
get when() {
|
|
1121
|
+
return route();
|
|
1122
|
+
},
|
|
1123
|
+
children: line => (() => {
|
|
1124
|
+
var _el$13 = _$createElement("text");
|
|
1125
|
+
_$insert(_el$13, () => `Route ${line()}`);
|
|
1126
|
+
return _el$13;
|
|
1127
|
+
})()
|
|
1128
|
+
}), _$createComponent(For, {
|
|
1129
|
+
get each() {
|
|
1130
|
+
return view().projected.notices;
|
|
1131
|
+
},
|
|
1132
|
+
children: notice => (() => {
|
|
1133
|
+
var _el$14 = _$createElement("text");
|
|
1134
|
+
_$insert(_el$14, notice);
|
|
1135
|
+
return _el$14;
|
|
1136
|
+
})()
|
|
1137
|
+
})]
|
|
1138
|
+
}), null);
|
|
1139
|
+
return _el$;
|
|
1140
|
+
})();
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
// ── Plugin setup ────────────────────────────────────────────────────────────
|
|
1144
|
+
|
|
1145
|
+
function defaultSchedule(tick, intervalMs) {
|
|
1146
|
+
const timer = setInterval(tick, intervalMs);
|
|
1147
|
+
return () => clearInterval(timer);
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/**
|
|
1151
|
+
* GA TUI setup: claims the sidebar, starts the location poller and opens the
|
|
1152
|
+
* drawer for every menu the server pushes. Returns the cleanup that stops
|
|
1153
|
+
* all of it; after cleanup no answer, dialog or toast from this setup
|
|
1154
|
+
* reaches the host.
|
|
1155
|
+
*/
|
|
1156
|
+
export function setupGaTui(context, options = {}) {
|
|
1157
|
+
const logger = options.logger;
|
|
1158
|
+
const now = options.now ?? Date.now;
|
|
1159
|
+
const client = createGaLocationClient({
|
|
1160
|
+
call: input => context.client.rpc.call(input),
|
|
1161
|
+
location: context.location,
|
|
1162
|
+
...(logger ? {
|
|
1163
|
+
logger
|
|
1164
|
+
} : {})
|
|
1165
|
+
});
|
|
1166
|
+
const active = () => !client.disposed();
|
|
1167
|
+
const ui = createGaMenuUi(context, active);
|
|
1168
|
+
const [view, setView] = createSignal(undefined);
|
|
1169
|
+
const releaseSlot = context.ui.slot({
|
|
1170
|
+
append: 'sidebar.content',
|
|
1171
|
+
render: input => _$createComponent(GaSidebar, {
|
|
1172
|
+
view: view,
|
|
1173
|
+
get sessionID() {
|
|
1174
|
+
return input.sessionID;
|
|
1175
|
+
}
|
|
1176
|
+
})
|
|
1177
|
+
});
|
|
1178
|
+
|
|
1179
|
+
// The latest snapshot per scope; the drawer's menu is built from it.
|
|
1180
|
+
const latest = new Map();
|
|
1181
|
+
const showSnapshot = snapshot => {
|
|
1182
|
+
latest.set(scopeKey(snapshot.scope), snapshot);
|
|
1183
|
+
setView({
|
|
1184
|
+
scope: snapshot.scope,
|
|
1185
|
+
projected: projectSidebar({
|
|
1186
|
+
accounts: snapshot.accounts,
|
|
1187
|
+
route: snapshot.route,
|
|
1188
|
+
status: snapshot.status,
|
|
1189
|
+
now: now()
|
|
1190
|
+
})
|
|
1191
|
+
});
|
|
1192
|
+
};
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* Pulls fresh state for `scope` and returns the menu built from it. Any
|
|
1196
|
+
* notifications the pull carries are handled like a poll tick's.
|
|
1197
|
+
*/
|
|
1198
|
+
const freshMenu = async scope => {
|
|
1199
|
+
let fresh;
|
|
1200
|
+
await pollGaOnce({
|
|
1201
|
+
client,
|
|
1202
|
+
scope: () => scope,
|
|
1203
|
+
onSnapshot: snapshot => {
|
|
1204
|
+
fresh = snapshot;
|
|
1205
|
+
showSnapshot(snapshot);
|
|
1206
|
+
},
|
|
1207
|
+
onNotification,
|
|
1208
|
+
...(logger ? {
|
|
1209
|
+
logger
|
|
1210
|
+
} : {})
|
|
1211
|
+
});
|
|
1212
|
+
return fresh ? buildGaMenu(fresh, now()) : undefined;
|
|
1213
|
+
};
|
|
1214
|
+
const applyChoice = async (scope, request, shown) => {
|
|
1215
|
+
const refused = async (text, code) => ({
|
|
1216
|
+
command: ANTIGRAVITY_MENU_COMMAND,
|
|
1217
|
+
ok: false,
|
|
1218
|
+
text,
|
|
1219
|
+
code,
|
|
1220
|
+
menu: (await freshMenu(scope)) ?? shown()
|
|
1221
|
+
});
|
|
1222
|
+
let body;
|
|
1223
|
+
try {
|
|
1224
|
+
body = gaApplyBody(request);
|
|
1225
|
+
} catch (error) {
|
|
1226
|
+
if (error instanceof GaMenuChoiceError) return refused(error.message, 'invalid-choice');
|
|
1227
|
+
throw error;
|
|
1228
|
+
}
|
|
1229
|
+
let result;
|
|
1230
|
+
try {
|
|
1231
|
+
result = await client.apply(scope, body);
|
|
1232
|
+
} catch (error) {
|
|
1233
|
+
if (error instanceof GaStaleError) return refused(error.message, error.reason);
|
|
1234
|
+
throw error;
|
|
1235
|
+
}
|
|
1236
|
+
// Settings and accounts shown next come from a fresh read, not from the
|
|
1237
|
+
// apply's answer.
|
|
1238
|
+
const menu = (await freshMenu(scope)) ?? shown();
|
|
1239
|
+
return gaMenuResult(result, menu);
|
|
1240
|
+
};
|
|
1241
|
+
function onNotification(notification, scope) {
|
|
1242
|
+
const snapshot = latest.get(scopeKey(scope));
|
|
1243
|
+
if (!snapshot) return;
|
|
1244
|
+
let shown = buildGaMenu(snapshot, now());
|
|
1245
|
+
void openAntigravityMenu({
|
|
1246
|
+
ui,
|
|
1247
|
+
apply: async request => {
|
|
1248
|
+
const result = await applyChoice(scope, request, () => shown);
|
|
1249
|
+
shown = result.menu;
|
|
1250
|
+
return result;
|
|
1251
|
+
},
|
|
1252
|
+
...(context.renderer?.copyToClipboardOSC52 ? {
|
|
1253
|
+
copy: text => context.renderer?.copyToClipboardOSC52?.(text) === true
|
|
1254
|
+
} : {}),
|
|
1255
|
+
onError: (message, detail) => logger?.warn(message, detail),
|
|
1256
|
+
startSection: sectionForCommand(notification.command)
|
|
1257
|
+
}, {
|
|
1258
|
+
command: ANTIGRAVITY_MENU_COMMAND,
|
|
1259
|
+
menu: shown
|
|
1260
|
+
}).catch(error => {
|
|
1261
|
+
logger?.warn('menu-drawer-failed', {
|
|
1262
|
+
error: error instanceof Error ? error.name : typeof error
|
|
1263
|
+
});
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
let inFlight = false;
|
|
1267
|
+
const tick = () => {
|
|
1268
|
+
if (inFlight || !active()) return;
|
|
1269
|
+
inFlight = true;
|
|
1270
|
+
void pollGaOnce({
|
|
1271
|
+
client,
|
|
1272
|
+
scope: () => currentScope(context.ui.router.current()),
|
|
1273
|
+
onSnapshot: showSnapshot,
|
|
1274
|
+
onNotification,
|
|
1275
|
+
...(logger ? {
|
|
1276
|
+
logger
|
|
1277
|
+
} : {})
|
|
1278
|
+
}).finally(() => {
|
|
1279
|
+
inFlight = false;
|
|
1280
|
+
});
|
|
1281
|
+
};
|
|
1282
|
+
const stop = (options.schedule ?? defaultSchedule)(tick, GA_SIDEBAR_PULL_MS);
|
|
1283
|
+
tick();
|
|
1284
|
+
let cleaned = false;
|
|
1285
|
+
return async () => {
|
|
1286
|
+
if (cleaned) return;
|
|
1287
|
+
cleaned = true;
|
|
1288
|
+
stop();
|
|
1289
|
+
client.dispose();
|
|
1290
|
+
releaseSlot();
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* The GA TUI plugin definition (`{ id, setup }`, the 2.0.22 TUI plugin
|
|
1296
|
+
* shape). Importing this module starts nothing; `setup` binds to the
|
|
1297
|
+
* context's location and returns the cleanup that stops everything it
|
|
1298
|
+
* started.
|
|
1299
|
+
*/
|
|
1300
|
+
const gaTuiPlugin = {
|
|
1301
|
+
id: GA_TUI_ID,
|
|
1302
|
+
setup: context => setupGaTui(context)
|
|
1303
|
+
};
|
|
1304
|
+
export default gaTuiPlugin;
|