@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,468 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `/antigravity` drawer: one renderer for the server's command menu,
|
|
3
|
+
* shared by the OpenCode 1 and OpenCode GA TUIs.
|
|
4
|
+
*
|
|
5
|
+
* The server builds the whole menu with the shared command menu of
|
|
6
|
+
* `@cortexkit/common-auth/commands`: Accounts, Quota, Routing, Limits
|
|
7
|
+
* (killswitch), Cache, Diagnostics (logging and wire dump) and the plugin's
|
|
8
|
+
* extras (vault setup), each with its read-only lines, its items, and its
|
|
9
|
+
* actions with their typed inputs and confirmations. This file only walks
|
|
10
|
+
* that payload through the host's dialogs and sends back which action the
|
|
11
|
+
* user chose, by the opaque section, item and action ids the server gave.
|
|
12
|
+
* It never builds an account target of its own, never looks an account up
|
|
13
|
+
* by position, and never retries a choice against a different target: an id
|
|
14
|
+
* the server no longer knows comes back as a refused apply and the user sees
|
|
15
|
+
* the server's message.
|
|
16
|
+
*
|
|
17
|
+
* Every redraw after an apply uses the menu that apply returned, which the
|
|
18
|
+
* server built fresh for that answer; settings shown here are never a
|
|
19
|
+
* replay of an earlier answer.
|
|
20
|
+
*
|
|
21
|
+
* The drawer talks to the host only through `MenuUi` (dialog primitives as
|
|
22
|
+
* promises) and `MenuApply` (the transport), so the same code runs on both
|
|
23
|
+
* hosts. Nothing here writes to the terminal or picks colors.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
type KnobValue,
|
|
28
|
+
MENU_REFUSED_TEXT,
|
|
29
|
+
type MenuAction,
|
|
30
|
+
type MenuApply,
|
|
31
|
+
type MenuApplyRequest,
|
|
32
|
+
type MenuApplyResult,
|
|
33
|
+
type MenuDialogPayload,
|
|
34
|
+
type MenuItem,
|
|
35
|
+
type MenuKnob,
|
|
36
|
+
type MenuModel,
|
|
37
|
+
type MenuSection,
|
|
38
|
+
type MenuSelectOption,
|
|
39
|
+
type MenuUi,
|
|
40
|
+
} from "./07365a7d2ccade4c-host-api.js"
|
|
41
|
+
|
|
42
|
+
const BACK = 'back'
|
|
43
|
+
|
|
44
|
+
/** Text longer than this, or with a line break, is shown in full, not toasted. */
|
|
45
|
+
const TOAST_MAX_LENGTH = 120
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Raised by a transport when an answer fails validation, so the drawer can
|
|
49
|
+
* tell a refused answer from an unreachable server.
|
|
50
|
+
*/
|
|
51
|
+
export class MenuRefusedError extends Error {
|
|
52
|
+
constructor(readonly issues: readonly string[]) {
|
|
53
|
+
super(MENU_REFUSED_TEXT)
|
|
54
|
+
this.name = 'MenuRefusedError'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function factLines(
|
|
59
|
+
facts: Readonly<Record<string, unknown>> | undefined,
|
|
60
|
+
): string[] {
|
|
61
|
+
return Object.entries(facts ?? {}).map(
|
|
62
|
+
([name, value]) =>
|
|
63
|
+
`${name}: ${typeof value === 'string' ? value : JSON.stringify(value)}`,
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** One option per section, in the order the menu gives them. */
|
|
68
|
+
export function sectionListOptions(menu: MenuModel): MenuSelectOption[] {
|
|
69
|
+
return menu.sections.map((section) => ({
|
|
70
|
+
title: section.title,
|
|
71
|
+
value: `section:${section.id}`,
|
|
72
|
+
...(section.lines[0] ? { description: section.lines[0] } : {}),
|
|
73
|
+
}))
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Status text is a group header; every option navigates or runs an action. */
|
|
77
|
+
export function sectionOptions(section: MenuSection): MenuSelectOption[] {
|
|
78
|
+
const header = [
|
|
79
|
+
...section.lines,
|
|
80
|
+
...factLines(section.facts),
|
|
81
|
+
...section.items
|
|
82
|
+
.filter((item) => item.actions.length === 0)
|
|
83
|
+
.map((item) =>
|
|
84
|
+
[
|
|
85
|
+
item.group,
|
|
86
|
+
[item.label, item.status].filter(Boolean).join(' · '),
|
|
87
|
+
item.detail,
|
|
88
|
+
...factLines(item.facts),
|
|
89
|
+
]
|
|
90
|
+
.filter(Boolean)
|
|
91
|
+
.join('\n'),
|
|
92
|
+
),
|
|
93
|
+
]
|
|
94
|
+
const options: MenuSelectOption[] = [
|
|
95
|
+
...section.items
|
|
96
|
+
.filter((item) => item.actions.length > 0)
|
|
97
|
+
.map((item) => ({
|
|
98
|
+
title: item.label,
|
|
99
|
+
value: `item:${item.id}`,
|
|
100
|
+
...(item.detail ? { description: item.detail } : {}),
|
|
101
|
+
...(item.group ? { category: item.group } : {}),
|
|
102
|
+
...(item.status ? { footer: item.status } : {}),
|
|
103
|
+
})),
|
|
104
|
+
...section.actions.map((action) => ({
|
|
105
|
+
title: action.label,
|
|
106
|
+
value: `action:${action.id}`,
|
|
107
|
+
...(action.description ? { description: action.description } : {}),
|
|
108
|
+
...(action.group ? { category: action.group } : {}),
|
|
109
|
+
})),
|
|
110
|
+
{ title: 'Back', value: BACK },
|
|
111
|
+
]
|
|
112
|
+
const first = options[0]
|
|
113
|
+
if (!first || header.length === 0) return options
|
|
114
|
+
const category = [...header, first.category].filter(Boolean).join('\n')
|
|
115
|
+
let firstGroup = true
|
|
116
|
+
return options.map((option) => {
|
|
117
|
+
if (option.category !== first.category) firstGroup = false
|
|
118
|
+
return firstGroup ? { ...option, category } : option
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Item context stays in descriptions, never in rows that cannot be acted on. */
|
|
123
|
+
export function itemOptions(item: MenuItem): MenuSelectOption[] {
|
|
124
|
+
const detail = [item.detail, ...factLines(item.facts)]
|
|
125
|
+
.filter(Boolean)
|
|
126
|
+
.join(' · ')
|
|
127
|
+
return [
|
|
128
|
+
...item.actions.map((action) => ({
|
|
129
|
+
title: action.label,
|
|
130
|
+
value: `action:${action.id}`,
|
|
131
|
+
...(detail || action.description
|
|
132
|
+
? {
|
|
133
|
+
description: [detail, action.description]
|
|
134
|
+
.filter(Boolean)
|
|
135
|
+
.join(' · '),
|
|
136
|
+
}
|
|
137
|
+
: {}),
|
|
138
|
+
...(action.group ? { category: action.group } : {}),
|
|
139
|
+
})),
|
|
140
|
+
{ title: 'Back', value: BACK },
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The value a typed `number` or `text` input sends. Empty is `null` (the
|
|
146
|
+
* action reads that as "leave unset"); a number input sends a number when
|
|
147
|
+
* the text parses as one and the text otherwise, so the server can say what
|
|
148
|
+
* is wrong with it.
|
|
149
|
+
*/
|
|
150
|
+
export function promptValue(knob: MenuKnob, raw: string): KnobValue {
|
|
151
|
+
const text = raw.trim()
|
|
152
|
+
if (text === '') return null
|
|
153
|
+
if (knob.kind === 'number') {
|
|
154
|
+
const number = Number(text)
|
|
155
|
+
return Number.isFinite(number) ? number : text
|
|
156
|
+
}
|
|
157
|
+
return raw
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function knobDefault(knob: MenuKnob): string {
|
|
161
|
+
if (knob.kind === 'toggle') return knob.value ? 'on' : 'off'
|
|
162
|
+
if (knob.kind === 'text' && knob.masked) return ''
|
|
163
|
+
return knob.value === undefined ? '' : String(knob.value)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** The first web link in a message, such as a sign-in URL. */
|
|
167
|
+
export function firstLink(text: string): string | undefined {
|
|
168
|
+
return /https?:\/\/\S+/.exec(text)?.[0]
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface DrawerOptions {
|
|
172
|
+
readonly ui: MenuUi
|
|
173
|
+
readonly apply: MenuApply
|
|
174
|
+
/**
|
|
175
|
+
* Copies text to the clipboard; returns false when the terminal cannot.
|
|
176
|
+
* Absent when the host offers no clipboard.
|
|
177
|
+
*/
|
|
178
|
+
readonly copy?: (text: string) => boolean
|
|
179
|
+
/** Receives drawer failures; must not write to the terminal. */
|
|
180
|
+
readonly onError?: (message: string, detail: Record<string, unknown>) => void
|
|
181
|
+
/** Opens on this section instead of the section list, when it exists. */
|
|
182
|
+
readonly startSection?: string
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Opens the drawer on a payload the server pushed for `/antigravity`. The
|
|
187
|
+
* returned promise settles when the user closes the drawer.
|
|
188
|
+
*/
|
|
189
|
+
export function openAntigravityMenu(
|
|
190
|
+
options: DrawerOptions,
|
|
191
|
+
payload: MenuDialogPayload,
|
|
192
|
+
): Promise<void> {
|
|
193
|
+
return new Drawer(options, payload.menu).start()
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const CANCEL = '\u0000cancel'
|
|
197
|
+
|
|
198
|
+
class Drawer {
|
|
199
|
+
private menu: MenuModel
|
|
200
|
+
|
|
201
|
+
constructor(
|
|
202
|
+
private readonly options: DrawerOptions,
|
|
203
|
+
menu: MenuModel,
|
|
204
|
+
) {
|
|
205
|
+
this.menu = menu
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
async start(): Promise<void> {
|
|
209
|
+
const start = this.options.startSection
|
|
210
|
+
if (start && this.menu.sections.some((section) => section.id === start)) {
|
|
211
|
+
await this.section(start)
|
|
212
|
+
return
|
|
213
|
+
}
|
|
214
|
+
const only =
|
|
215
|
+
this.menu.sections.length === 1 ? this.menu.sections[0] : undefined
|
|
216
|
+
if (only) {
|
|
217
|
+
await this.section(only.id)
|
|
218
|
+
return
|
|
219
|
+
}
|
|
220
|
+
await this.list()
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private async list(): Promise<void> {
|
|
224
|
+
const { ui } = this.options
|
|
225
|
+
const chosen = await ui.select({
|
|
226
|
+
title: this.menu.title,
|
|
227
|
+
options: sectionListOptions(this.menu),
|
|
228
|
+
})
|
|
229
|
+
if (chosen === undefined) return
|
|
230
|
+
await this.section(chosen.slice('section:'.length))
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private async closeOrList(): Promise<void> {
|
|
234
|
+
if (this.menu.sections.length === 1) {
|
|
235
|
+
this.options.ui.clear()
|
|
236
|
+
return
|
|
237
|
+
}
|
|
238
|
+
await this.list()
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private async section(sectionId: string): Promise<void> {
|
|
242
|
+
const { ui } = this.options
|
|
243
|
+
const section = this.menu.sections.find((entry) => entry.id === sectionId)
|
|
244
|
+
if (!section) {
|
|
245
|
+
ui.toast('That section is no longer offered.', 'warning')
|
|
246
|
+
await this.list()
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
const chosen = await ui.select({
|
|
250
|
+
title: section.title,
|
|
251
|
+
options: sectionOptions(section),
|
|
252
|
+
})
|
|
253
|
+
// Dismissing the dialog (Escape) closes the drawer; Back goes up a level.
|
|
254
|
+
if (chosen === undefined) return
|
|
255
|
+
if (chosen === BACK) {
|
|
256
|
+
await this.closeOrList()
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
if (chosen.startsWith('item:')) {
|
|
260
|
+
await this.item(section.id, chosen.slice('item:'.length))
|
|
261
|
+
return
|
|
262
|
+
}
|
|
263
|
+
if (chosen.startsWith('action:')) {
|
|
264
|
+
const action = section.actions.find(
|
|
265
|
+
(entry) => entry.id === chosen.slice('action:'.length),
|
|
266
|
+
)
|
|
267
|
+
if (action) {
|
|
268
|
+
await this.run(section, undefined, action)
|
|
269
|
+
return
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// A read-only line: redraw the same section.
|
|
273
|
+
await this.section(section.id)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private async item(sectionId: string, itemId: string): Promise<void> {
|
|
277
|
+
const { ui } = this.options
|
|
278
|
+
const section = this.menu.sections.find((entry) => entry.id === sectionId)
|
|
279
|
+
const item = section?.items.find((entry) => entry.id === itemId)
|
|
280
|
+
if (!section || !item) {
|
|
281
|
+
ui.toast('That entry is no longer offered.', 'warning')
|
|
282
|
+
if (section) await this.section(section.id)
|
|
283
|
+
else await this.list()
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
const chosen = await ui.select({
|
|
287
|
+
title: `${section.title}: ${item.label}`,
|
|
288
|
+
options: itemOptions(item),
|
|
289
|
+
})
|
|
290
|
+
if (chosen === undefined) return
|
|
291
|
+
if (chosen === BACK) {
|
|
292
|
+
await this.section(section.id)
|
|
293
|
+
return
|
|
294
|
+
}
|
|
295
|
+
if (chosen.startsWith('action:')) {
|
|
296
|
+
const action = item.actions.find(
|
|
297
|
+
(entry) => entry.id === chosen.slice('action:'.length),
|
|
298
|
+
)
|
|
299
|
+
if (action) {
|
|
300
|
+
await this.run(section, item, action)
|
|
301
|
+
return
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
await this.item(section.id, item.id)
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Asks for one input; resolves undefined when the user backs out. */
|
|
308
|
+
private async knob(
|
|
309
|
+
title: string,
|
|
310
|
+
knob: MenuKnob,
|
|
311
|
+
): Promise<KnobValue | undefined> {
|
|
312
|
+
const { ui } = this.options
|
|
313
|
+
if (knob.kind === 'choice' || knob.kind === 'toggle') {
|
|
314
|
+
const choices: MenuSelectOption[] =
|
|
315
|
+
knob.kind === 'choice'
|
|
316
|
+
? knob.choices.map((choice) => ({
|
|
317
|
+
title: choice.label,
|
|
318
|
+
value: choice.value,
|
|
319
|
+
}))
|
|
320
|
+
: [
|
|
321
|
+
{ title: 'On', value: 'on' },
|
|
322
|
+
{ title: 'Off', value: 'off' },
|
|
323
|
+
]
|
|
324
|
+
const chosen = await ui.select({
|
|
325
|
+
title: `${title}: ${knob.label}`,
|
|
326
|
+
current: knobDefault(knob),
|
|
327
|
+
options: [...choices, { title: 'Cancel', value: CANCEL }],
|
|
328
|
+
})
|
|
329
|
+
if (chosen === undefined || chosen === CANCEL) return undefined
|
|
330
|
+
return knob.kind === 'toggle' ? chosen === 'on' : chosen
|
|
331
|
+
}
|
|
332
|
+
const placeholder = knob.kind === 'text' ? knob.placeholder : undefined
|
|
333
|
+
const raw = await ui.prompt({
|
|
334
|
+
title: `${title}: ${knob.label}`,
|
|
335
|
+
...(placeholder ? { placeholder } : {}),
|
|
336
|
+
value: knobDefault(knob),
|
|
337
|
+
})
|
|
338
|
+
if (raw === undefined) return undefined
|
|
339
|
+
return promptValue(knob, raw)
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
private back(section: MenuSection, item: MenuItem | undefined) {
|
|
343
|
+
return item ? this.item(section.id, item.id) : this.section(section.id)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Collects an action's inputs, confirms it when it carries a confirmation,
|
|
348
|
+
* applies it and redraws from the refreshed menu.
|
|
349
|
+
*/
|
|
350
|
+
private async run(
|
|
351
|
+
section: MenuSection,
|
|
352
|
+
item: MenuItem | undefined,
|
|
353
|
+
action: MenuAction,
|
|
354
|
+
): Promise<void> {
|
|
355
|
+
const { ui } = this.options
|
|
356
|
+
const values: Record<string, KnobValue> = {}
|
|
357
|
+
for (const knob of action.knobs) {
|
|
358
|
+
const value = await this.knob(action.label, knob)
|
|
359
|
+
if (value === undefined) {
|
|
360
|
+
await this.back(section, item)
|
|
361
|
+
return
|
|
362
|
+
}
|
|
363
|
+
values[knob.id] = value
|
|
364
|
+
}
|
|
365
|
+
let confirmed = false
|
|
366
|
+
if (action.confirm) {
|
|
367
|
+
confirmed = await ui.confirm({
|
|
368
|
+
title: action.label,
|
|
369
|
+
message: action.confirm.message,
|
|
370
|
+
})
|
|
371
|
+
if (!confirmed) {
|
|
372
|
+
await this.back(section, item)
|
|
373
|
+
return
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
const request: MenuApplyRequest = {
|
|
377
|
+
command: this.menu.command,
|
|
378
|
+
sectionId: section.id,
|
|
379
|
+
...(item ? { itemId: item.id } : {}),
|
|
380
|
+
actionId: action.id,
|
|
381
|
+
values,
|
|
382
|
+
...(confirmed ? { confirmed: true as const } : {}),
|
|
383
|
+
}
|
|
384
|
+
let result = await this.send(request)
|
|
385
|
+
if (!result) {
|
|
386
|
+
await this.back(section, item)
|
|
387
|
+
return
|
|
388
|
+
}
|
|
389
|
+
if (result.needsConfirmation && !confirmed) {
|
|
390
|
+
const yes = await ui.confirm({
|
|
391
|
+
title: action.label,
|
|
392
|
+
message: result.text,
|
|
393
|
+
})
|
|
394
|
+
if (!yes) {
|
|
395
|
+
this.menu = result.menu
|
|
396
|
+
await this.section(section.id)
|
|
397
|
+
return
|
|
398
|
+
}
|
|
399
|
+
const again = await this.send({ ...request, confirmed: true })
|
|
400
|
+
if (!again) {
|
|
401
|
+
this.menu = result.menu
|
|
402
|
+
await this.back(section, item)
|
|
403
|
+
return
|
|
404
|
+
}
|
|
405
|
+
result = again
|
|
406
|
+
}
|
|
407
|
+
this.menu = result.menu
|
|
408
|
+
await this.finish(section.id, result)
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
private async send(
|
|
412
|
+
request: MenuApplyRequest,
|
|
413
|
+
): Promise<MenuApplyResult | undefined> {
|
|
414
|
+
const { ui, apply, onError } = this.options
|
|
415
|
+
try {
|
|
416
|
+
return await apply(request)
|
|
417
|
+
} catch (error) {
|
|
418
|
+
if (error instanceof MenuRefusedError) {
|
|
419
|
+
onError?.('menu-apply-refused', { issues: error.issues })
|
|
420
|
+
ui.toast(MENU_REFUSED_TEXT, 'error')
|
|
421
|
+
return undefined
|
|
422
|
+
}
|
|
423
|
+
onError?.('menu-apply-failed', {
|
|
424
|
+
error: error instanceof Error ? error.name : typeof error,
|
|
425
|
+
})
|
|
426
|
+
ui.toast('The action could not reach Antigravity auth.', 'error')
|
|
427
|
+
return undefined
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Shows the apply's message and returns to the section. A long message (a
|
|
433
|
+
* sign-in URL, a multi-line result) is shown in full; a link in it can be
|
|
434
|
+
* copied when the host has a clipboard. A short one is a toast.
|
|
435
|
+
*/
|
|
436
|
+
private async finish(sectionId: string, result: MenuApplyResult) {
|
|
437
|
+
const { ui, copy } = this.options
|
|
438
|
+
const kind = result.ok ? 'info' : 'warning'
|
|
439
|
+
const long =
|
|
440
|
+
result.text.includes('\n') || result.text.length > TOAST_MAX_LENGTH
|
|
441
|
+
const link = firstLink(result.text)
|
|
442
|
+
if (link && copy) {
|
|
443
|
+
const chosen = await ui.select({
|
|
444
|
+
title: result.ok ? 'Done' : 'Not done',
|
|
445
|
+
options: [
|
|
446
|
+
{ title: 'Copy link', value: 'copy', description: link },
|
|
447
|
+
{ title: 'Continue', value: 'continue', description: result.text },
|
|
448
|
+
],
|
|
449
|
+
})
|
|
450
|
+
if (chosen === 'copy') {
|
|
451
|
+
ui.toast(
|
|
452
|
+
copy(link)
|
|
453
|
+
? 'Link copied to the clipboard.'
|
|
454
|
+
: 'Copy is unavailable here; select the link to copy it.',
|
|
455
|
+
'info',
|
|
456
|
+
)
|
|
457
|
+
}
|
|
458
|
+
} else if (long) {
|
|
459
|
+
await ui.alert({
|
|
460
|
+
title: result.ok ? 'Done' : 'Not done',
|
|
461
|
+
message: result.text,
|
|
462
|
+
})
|
|
463
|
+
} else {
|
|
464
|
+
ui.toast(result.text, kind)
|
|
465
|
+
}
|
|
466
|
+
await this.section(sectionId)
|
|
467
|
+
}
|
|
468
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Projection of a keyed quota map onto one request scope.
|
|
2
|
+
//
|
|
3
|
+
// The selection primitives carried from openai-auth judge an account by a
|
|
4
|
+
// short list of windows; the keyed map can hold many (scope, label) keys. The
|
|
5
|
+
// projection resolves exactly one entry per window label for the request's
|
|
6
|
+
// scope, orders the result the way the primitives expect, and carries each
|
|
7
|
+
// entry's (scope, label) so a decision names the limit it judged rather than
|
|
8
|
+
// the position it occupied.
|
|
9
|
+
import { ALL_SCOPE, } from "./77138df80c7ae006-map.js";
|
|
10
|
+
function project(entry) {
|
|
11
|
+
if (entry.kind === 'retired') {
|
|
12
|
+
return {
|
|
13
|
+
scope: entry.scope,
|
|
14
|
+
label: entry.label,
|
|
15
|
+
kind: 'retired',
|
|
16
|
+
checkedAt: entry.retiredAt,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (entry.kind === 'absent') {
|
|
20
|
+
return {
|
|
21
|
+
scope: entry.scope,
|
|
22
|
+
label: entry.label,
|
|
23
|
+
kind: 'absent',
|
|
24
|
+
checkedAt: entry.checkedAt,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
scope: entry.scope,
|
|
29
|
+
label: entry.label,
|
|
30
|
+
kind: 'reading',
|
|
31
|
+
checkedAt: entry.checkedAt,
|
|
32
|
+
usedPercent: entry.usedPercent,
|
|
33
|
+
remainingPercent: 100 - entry.usedPercent,
|
|
34
|
+
...(entry.windowMinutes === undefined
|
|
35
|
+
? {}
|
|
36
|
+
: { windowMinutes: entry.windowMinutes }),
|
|
37
|
+
...(entry.resetsAt === undefined ? {} : { resetsAt: entry.resetsAt }),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function compareLimits(left, right) {
|
|
41
|
+
const leftKnown = left.windowMinutes !== undefined;
|
|
42
|
+
const rightKnown = right.windowMinutes !== undefined;
|
|
43
|
+
if (leftKnown !== rightKnown)
|
|
44
|
+
return leftKnown ? -1 : 1;
|
|
45
|
+
if (leftKnown && rightKnown && left.windowMinutes !== right.windowMinutes) {
|
|
46
|
+
return (right.windowMinutes ?? 0) - (left.windowMinutes ?? 0);
|
|
47
|
+
}
|
|
48
|
+
if (left.label !== right.label)
|
|
49
|
+
return left.label < right.label ? -1 : 1;
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
function projectBudget(budget) {
|
|
53
|
+
return {
|
|
54
|
+
checkedAt: budget.checkedAt,
|
|
55
|
+
reached: budget.reached,
|
|
56
|
+
...(budget.remainingPercent === undefined
|
|
57
|
+
? {}
|
|
58
|
+
: { remainingPercent: budget.remainingPercent }),
|
|
59
|
+
...(budget.resetsAt === undefined ? {} : { resetsAt: budget.resetsAt }),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolves `map` for a request in `scope` (`all` or a model family). A family
|
|
64
|
+
* request sees only its own family's keys and the `all` keys.
|
|
65
|
+
*
|
|
66
|
+
* The label decides how a family limit relates to a general one. Under the
|
|
67
|
+
* same label, the family reading replaces the `all` reading: use this only
|
|
68
|
+
* when the provider's family figure is a more specific view of the same cap.
|
|
69
|
+
* Under different labels both limits are projected and every consumer judges
|
|
70
|
+
* both, so a family cap that applies on top of a general cap must be stored
|
|
71
|
+
* under its own label; otherwise the general cap is hidden from a family
|
|
72
|
+
* request. A family tombstone or absence record says only that no
|
|
73
|
+
* family-specific limit exists, so it does not hide an `all` entry for the
|
|
74
|
+
* same label and is used only when there is none.
|
|
75
|
+
*/
|
|
76
|
+
export function projectQuota(map, scope = ALL_SCOPE) {
|
|
77
|
+
const byLabel = new Map();
|
|
78
|
+
for (const entry of map?.limits ?? []) {
|
|
79
|
+
if (entry.scope !== scope && entry.scope !== ALL_SCOPE)
|
|
80
|
+
continue;
|
|
81
|
+
const current = byLabel.get(entry.label);
|
|
82
|
+
if (current === undefined) {
|
|
83
|
+
byLabel.set(entry.label, entry);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const family = entry.scope === ALL_SCOPE ? current : entry;
|
|
87
|
+
const general = entry.scope === ALL_SCOPE ? entry : current;
|
|
88
|
+
byLabel.set(entry.label, family.kind === 'reading' ? family : general);
|
|
89
|
+
}
|
|
90
|
+
const limits = [...byLabel.values()].map(project).sort(compareLimits);
|
|
91
|
+
const readings = limits.filter((limit) => limit.kind === 'reading');
|
|
92
|
+
const stamped = readings.length > 0 ? readings : limits;
|
|
93
|
+
const checkedAt = stamped.length > 0
|
|
94
|
+
? Math.min(...stamped.map((limit) => limit.checkedAt))
|
|
95
|
+
: undefined;
|
|
96
|
+
const budget = map?.budget?.kind === 'reading' ? projectBudget(map.budget) : undefined;
|
|
97
|
+
return {
|
|
98
|
+
scope,
|
|
99
|
+
limits,
|
|
100
|
+
...(checkedAt === undefined ? {} : { checkedAt }),
|
|
101
|
+
...(budget === undefined ? {} : { budget }),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The credit budget's own exhaustion signal. Admission and the sticky
|
|
106
|
+
* routing decision to move a session off its pinned row both use it, so the
|
|
107
|
+
* two agree on what "spent" means. `reached` is the provider's
|
|
108
|
+
* verdict (the percentage is only a display value), and the check fails open
|
|
109
|
+
* on a missing, unparsable or already-passed reset.
|
|
110
|
+
*/
|
|
111
|
+
export function budgetExhaustedResetAt(quota, now) {
|
|
112
|
+
const budget = quota?.budget;
|
|
113
|
+
if (budget?.reached !== true || typeof budget.resetsAt !== 'string') {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
const resetAtMs = Date.parse(budget.resetsAt);
|
|
117
|
+
if (!Number.isFinite(resetAtMs) || resetAtMs <= now)
|
|
118
|
+
return undefined;
|
|
119
|
+
return { resetsAt: budget.resetsAt, resetAtMs };
|
|
120
|
+
}
|
|
121
|
+
/** True for a reading at or beyond its whole window. */
|
|
122
|
+
export function readsExhausted(limit) {
|
|
123
|
+
return (limit.kind === 'reading' &&
|
|
124
|
+
typeof limit.usedPercent === 'number' &&
|
|
125
|
+
Number.isFinite(limit.usedPercent) &&
|
|
126
|
+
limit.usedPercent >= 100);
|
|
127
|
+
}
|
|
128
|
+
/** The reset time of a limit when it parses and lies after `now`. */
|
|
129
|
+
export function futureResetAt(limit, now) {
|
|
130
|
+
if (typeof limit.resetsAt !== 'string')
|
|
131
|
+
return undefined;
|
|
132
|
+
const resetAtMs = Date.parse(limit.resetsAt);
|
|
133
|
+
return Number.isFinite(resetAtMs) && resetAtMs > now ? resetAtMs : undefined;
|
|
134
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// The per-row quota map: what the pool knows about one row's limits.
|
|
2
|
+
//
|
|
3
|
+
// A row's quota is a set of keyed limits. Each key is a (scope, window label)
|
|
4
|
+
// pair: the scope is `all` for a limit that binds every request, or a model
|
|
5
|
+
// family name for a limit that binds only that family; the label names the
|
|
6
|
+
// window the provider reports (for example `primary` or `secondary`). Each key
|
|
7
|
+
// holds one entry, which is either a reading, a retirement tombstone (the key
|
|
8
|
+
// held a reading until an authoritative observation stopped reporting it), or
|
|
9
|
+
// an absence record (an authoritative observation reported the key as having
|
|
10
|
+
// no limit before any reading was seen). Tombstones and absence records are
|
|
11
|
+
// evidence that the key is known to be unlimited; a missing key is unknown.
|
|
12
|
+
//
|
|
13
|
+
// Beside the limits sits the credit budget, a third pressure axis with its own
|
|
14
|
+
// reset clock. It is a tri-state: absent (never reported), a reading, or
|
|
15
|
+
// cleared (the provider reported that no budget exists).
|
|
16
|
+
//
|
|
17
|
+
// The map is plain JSON so the store can persist it without interpreting it.
|
|
18
|
+
/** The scope of a limit that binds every request regardless of model. */
|
|
19
|
+
export const ALL_SCOPE = 'all';
|
|
20
|
+
/** The window label required when an admission call supplies none. */
|
|
21
|
+
export const DEFAULT_REQUIRED_LABELS = Object.freeze([
|
|
22
|
+
'primary',
|
|
23
|
+
]);
|
|
24
|
+
export function emptyQuotaMap() {
|
|
25
|
+
return { limits: [] };
|
|
26
|
+
}
|
|
27
|
+
/** The time an entry speaks for: its reading, retirement or absence time. */
|
|
28
|
+
export function entryTime(entry) {
|
|
29
|
+
return entry.kind === 'retired' ? entry.retiredAt : entry.checkedAt;
|
|
30
|
+
}
|
|
31
|
+
export function limitKey(scope, label) {
|
|
32
|
+
// JSON-encoding the pair keeps keys unambiguous for any scope or label text.
|
|
33
|
+
return JSON.stringify([scope, label]);
|
|
34
|
+
}
|
|
35
|
+
function isRecord(value) {
|
|
36
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
37
|
+
}
|
|
38
|
+
function isFiniteNumber(value) {
|
|
39
|
+
return typeof value === 'number' && Number.isFinite(value);
|
|
40
|
+
}
|
|
41
|
+
function isName(value) {
|
|
42
|
+
return typeof value === 'string' && value.length > 0;
|
|
43
|
+
}
|
|
44
|
+
function optional(record, key, check) {
|
|
45
|
+
return record[key] === undefined || check(record[key]);
|
|
46
|
+
}
|
|
47
|
+
function isPositiveFinite(value) {
|
|
48
|
+
return isFiniteNumber(value) && value > 0;
|
|
49
|
+
}
|
|
50
|
+
function isString(value) {
|
|
51
|
+
return typeof value === 'string';
|
|
52
|
+
}
|
|
53
|
+
function isQuotaEntry(value) {
|
|
54
|
+
if (!isRecord(value) || !isName(value.scope) || !isName(value.label)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
switch (value.kind) {
|
|
58
|
+
case 'reading':
|
|
59
|
+
return (isFiniteNumber(value.checkedAt) &&
|
|
60
|
+
isFiniteNumber(value.usedPercent) &&
|
|
61
|
+
optional(value, 'resetsAt', isString) &&
|
|
62
|
+
optional(value, 'windowMinutes', isPositiveFinite));
|
|
63
|
+
case 'retired':
|
|
64
|
+
return isFiniteNumber(value.retiredAt);
|
|
65
|
+
case 'absent':
|
|
66
|
+
return isFiniteNumber(value.checkedAt);
|
|
67
|
+
default:
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function isCreditBudgetEntry(value) {
|
|
72
|
+
if (!isRecord(value) || !isFiniteNumber(value.checkedAt))
|
|
73
|
+
return false;
|
|
74
|
+
if (value.kind === 'cleared')
|
|
75
|
+
return true;
|
|
76
|
+
return (value.kind === 'reading' &&
|
|
77
|
+
typeof value.reached === 'boolean' &&
|
|
78
|
+
optional(value, 'remainingPercent', isFiniteNumber) &&
|
|
79
|
+
optional(value, 'usedPercent', isFiniteNumber) &&
|
|
80
|
+
optional(value, 'resetsAt', isString) &&
|
|
81
|
+
optional(value, 'limit', isFiniteNumber) &&
|
|
82
|
+
optional(value, 'used', isFiniteNumber) &&
|
|
83
|
+
optional(value, 'remaining', isFiniteNumber) &&
|
|
84
|
+
optional(value, 'unit', isString));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* True when `value` is a well-formed quota map. Unrecognised top-level keys
|
|
88
|
+
* are tolerated (and preserved by merge) so a newer writer's additions
|
|
89
|
+
* survive; a malformed entry, a duplicated (scope, label) key or a malformed
|
|
90
|
+
* budget makes the whole map invalid.
|
|
91
|
+
*/
|
|
92
|
+
export function isQuotaMap(value) {
|
|
93
|
+
if (!isRecord(value) || !Array.isArray(value.limits))
|
|
94
|
+
return false;
|
|
95
|
+
const seen = new Set();
|
|
96
|
+
for (const entry of value.limits) {
|
|
97
|
+
if (!isQuotaEntry(entry))
|
|
98
|
+
return false;
|
|
99
|
+
const key = limitKey(entry.scope, entry.label);
|
|
100
|
+
if (seen.has(key))
|
|
101
|
+
return false;
|
|
102
|
+
seen.add(key);
|
|
103
|
+
}
|
|
104
|
+
return optional(value, 'budget', isCreditBudgetEntry);
|
|
105
|
+
}
|