@cortexkit/opencode-antigravity-auth 3.0.5 → 3.0.7
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 +38 -352
- package/dist/cli.js +13757 -12857
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +1362 -1056
- package/dist/index.js +16038 -16162
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +1447 -1375
- package/dist/server.js +11254 -10921
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/auth-method-labels.d.ts +3 -0
- package/dist/src/auth-method-labels.d.ts.map +1 -0
- package/dist/src/auth-method-labels.js +5 -0
- package/dist/src/auth-method-labels.js.map +1 -0
- package/dist/src/cli.d.ts +3 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +98 -12
- package/dist/src/cli.js.map +1 -1
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +44 -4
- package/dist/src/common-auth-embedded/claustrum/consumer.js +134 -2
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +33 -1
- package/dist/src/common-auth-embedded/claustrum/custody.js +17 -0
- package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
- package/dist/src/common-auth-embedded/claustrum/enrollment.js +6 -1
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +3 -2
- package/dist/src/common-auth-embedded/claustrum/index.js +5 -3
- package/dist/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/dist/src/common-auth-embedded/claustrum/insula.js +152 -0
- package/dist/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
- package/dist/src/common-auth-embedded/claustrum/roster.js +33 -3
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +26 -12
- package/dist/src/common-auth-embedded/pi-slot/lock.js +7 -3
- package/dist/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/dist/src/common-auth-embedded/quota/codec.js +2 -1
- package/dist/src/common-auth-embedded/quota/format.d.ts +40 -3
- package/dist/src/common-auth-embedded/quota/format.js +196 -43
- package/dist/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/dist/src/common-auth-embedded/quota/index.js +2 -2
- package/dist/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/dist/src/common-auth-embedded/quota/map.js +36 -1
- package/dist/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/dist/src/common-auth-embedded/quota/merge.js +21 -5
- package/dist/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/dist/src/common-auth-embedded/quota/projection.js +3 -1
- package/dist/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/dist/src/common-auth-embedded/setup/command-error.js +79 -0
- package/dist/src/common-auth-embedded/setup/command-runner.js +143 -0
- package/dist/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/dist/src/common-auth-embedded/setup/command.js +271 -0
- package/dist/src/common-auth-embedded/setup/config-write.js +60 -0
- package/dist/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/dist/src/common-auth-embedded/setup/detect.js +224 -0
- package/dist/src/common-auth-embedded/setup/enroll.js +82 -0
- package/dist/src/common-auth-embedded/setup/index.d.ts +6 -0
- package/dist/src/common-auth-embedded/setup/index.js +5 -0
- package/dist/src/common-auth-embedded/setup/paths.js +33 -0
- package/dist/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/dist/src/common-auth-embedded/setup/process-fence.js +270 -0
- package/dist/src/common-auth-embedded/setup/prompts.js +26 -0
- package/dist/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/dist/src/common-auth-embedded/setup/register.js +136 -0
- package/dist/src/common-auth-embedded/setup/types.d.ts +150 -0
- package/dist/src/common-auth-embedded/source-output.json +265 -101
- package/dist/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/dist/src/common-auth-embedded/store/pool.js +0 -1
- package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/dist/src/common-auth-embedded/store/refresh-lock.js +0 -1
- package/dist/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/dist/src/common-auth-embedded/store/schema.js +3 -2
- package/dist/src/ga/rpc/protocol.d.ts +4 -7
- package/dist/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/src/ga/rpc/protocol.js +5 -13
- package/dist/src/ga/rpc/protocol.js.map +1 -1
- package/dist/src/ga/server/auth.d.ts +8 -3
- package/dist/src/ga/server/auth.d.ts.map +1 -1
- package/dist/src/ga/server/auth.js +25 -9
- package/dist/src/ga/server/auth.js.map +1 -1
- package/dist/src/ga/server/index.d.ts +39 -12
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +218 -55
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/ga/server/pool-login.d.ts +22 -0
- package/dist/src/ga/server/pool-login.d.ts.map +1 -0
- package/dist/src/ga/server/pool-login.js +150 -0
- package/dist/src/ga/server/pool-login.js.map +1 -0
- package/dist/src/ga/tui/host-ga.d.ts +2 -5
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +54 -52
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/accounts.d.ts +1 -1
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +1 -0
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.d.ts +2 -0
- package/dist/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
- package/dist/src/plugin/background-vault-quota-refresh.js +125 -10
- package/dist/src/plugin/background-vault-quota-refresh.js.map +1 -1
- package/dist/src/plugin/command-apply.d.ts +2 -2
- package/dist/src/plugin/command-apply.d.ts.map +1 -1
- package/dist/src/plugin/command-apply.js +3 -10
- package/dist/src/plugin/command-apply.js.map +1 -1
- package/dist/src/plugin/commands.d.ts +1 -0
- package/dist/src/plugin/commands.d.ts.map +1 -1
- package/dist/src/plugin/commands.js +2 -2
- package/dist/src/plugin/commands.js.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.d.ts +0 -4
- package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.js +0 -5
- package/dist/src/plugin/config/operator-settings-schema.js.map +1 -1
- package/dist/src/plugin/config/schema.d.ts +0 -7
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +2 -44
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/config/writer.d.ts +1 -1
- package/dist/src/plugin/config/writer.js +1 -1
- package/dist/src/plugin/fetch/retry-state.d.ts +19 -3
- package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
- package/dist/src/plugin/fetch/retry-state.js +0 -6
- package/dist/src/plugin/fetch/retry-state.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +0 -3
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/fetch-routing.d.ts +0 -16
- package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
- package/dist/src/plugin/fetch-routing.js +0 -49
- package/dist/src/plugin/fetch-routing.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +14 -9
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +124 -43
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/src/plugin/gemini-dump.js +2 -5
- package/dist/src/plugin/gemini-dump.js.map +1 -1
- package/dist/src/plugin/google-origin.d.ts +7 -0
- package/dist/src/plugin/google-origin.d.ts.map +1 -0
- package/dist/src/plugin/google-origin.js +14 -0
- package/dist/src/plugin/google-origin.js.map +1 -0
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +18 -7
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/logging-utils.d.ts.map +1 -1
- package/dist/src/plugin/logging-utils.js +2 -5
- package/dist/src/plugin/logging-utils.js.map +1 -1
- package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
- package/dist/src/plugin/oauth-methods.js +0 -33
- package/dist/src/plugin/oauth-methods.js.map +1 -1
- package/dist/src/plugin/operator-settings.d.ts +1 -1
- package/dist/src/plugin/operator-settings.d.ts.map +1 -1
- package/dist/src/plugin/operator-settings.js +1 -8
- package/dist/src/plugin/operator-settings.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +11 -7
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +128 -102
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/request.d.ts +6 -5
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +95 -180
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/server.d.ts.map +1 -1
- package/dist/src/plugin/server.js +60 -53
- package/dist/src/plugin/server.js.map +1 -1
- package/dist/src/plugin/shared/advisory-repository.d.ts +20 -0
- package/dist/src/plugin/shared/advisory-repository.d.ts.map +1 -0
- package/dist/src/plugin/shared/advisory-repository.js +91 -0
- package/dist/src/plugin/shared/advisory-repository.js.map +1 -0
- package/dist/src/plugin/shared/request-services.d.ts +27 -26
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +244 -245
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/runtime.js +4 -2
- package/dist/src/plugin/shared/runtime.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +16 -4
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +44 -7
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +2 -2
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/vault-custody.d.ts +14 -1
- package/dist/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/vault-custody.js +203 -44
- package/dist/src/plugin/vault-custody.js.map +1 -1
- package/dist/src/plugin/vault-quota-outcome.d.ts +19 -0
- package/dist/src/plugin/vault-quota-outcome.d.ts.map +1 -0
- package/dist/src/plugin/vault-quota-outcome.js +47 -0
- package/dist/src/plugin/vault-quota-outcome.js.map +1 -0
- package/dist/src/quota-presentation.d.ts +29 -1
- package/dist/src/quota-presentation.d.ts.map +1 -1
- package/dist/src/quota-presentation.js +52 -17
- package/dist/src/quota-presentation.js.map +1 -1
- package/dist/src/setup.d.ts +15 -0
- package/dist/src/setup.d.ts.map +1 -0
- package/dist/src/setup.js +320 -0
- package/dist/src/setup.js.map +1 -0
- package/dist/src/sidebar-projection.d.ts +5 -1
- package/dist/src/sidebar-projection.d.ts.map +1 -1
- package/dist/src/sidebar-projection.js +6 -2
- package/dist/src/sidebar-projection.js.map +1 -1
- package/dist/src/sidebar-state.d.ts +1 -1
- package/dist/src/sidebar-state.d.ts.map +1 -1
- package/dist/src/sidebar-state.js +19 -1
- package/dist/src/sidebar-state.js.map +1 -1
- package/dist/src/tui/quota-layout.d.ts +94 -0
- package/dist/src/tui/quota-layout.d.ts.map +1 -0
- package/dist/src/tui/quota-layout.js +139 -0
- package/dist/src/tui/quota-layout.js.map +1 -0
- package/dist/src/tui/route-layout.d.ts +8 -0
- package/dist/src/tui/route-layout.d.ts.map +1 -0
- package/dist/src/tui/route-layout.js +36 -0
- package/dist/src/tui/route-layout.js.map +1 -0
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +120 -127
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +66 -37
- package/dist/tui-ga-build-map.json +66 -37
- package/dist/types/src/auth-method-labels.d.ts +3 -0
- package/dist/types/src/auth-method-labels.d.ts.map +1 -0
- package/dist/types/src/cli.d.ts +3 -1
- package/dist/types/src/cli.d.ts.map +1 -1
- package/dist/types/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
- package/dist/types/src/common-auth-embedded/claustrum/consumer.d.ts +142 -0
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +207 -0
- package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +164 -0
- package/dist/types/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
- package/dist/types/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +19 -0
- package/dist/types/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/dist/types/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
- package/dist/types/src/common-auth-embedded/claustrum/roster.d.ts +221 -0
- package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/dist/types/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
- package/dist/types/src/common-auth-embedded/opencode2/index.d.ts +8 -0
- package/dist/types/src/common-auth-embedded/opencode2/install.d.ts +55 -0
- package/dist/types/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
- package/dist/types/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
- package/dist/types/src/common-auth-embedded/opencode2/types.d.ts +413 -0
- package/dist/types/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/dist/types/src/common-auth-embedded/quota/format.d.ts +40 -3
- package/dist/types/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/dist/types/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/dist/types/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/dist/types/src/common-auth-embedded/routing/admission.d.ts +93 -0
- package/dist/types/src/common-auth-embedded/routing/index.d.ts +8 -0
- package/dist/types/src/common-auth-embedded/routing/ordered.d.ts +47 -0
- package/dist/types/src/common-auth-embedded/routing/pins.d.ts +22 -0
- package/dist/types/src/common-auth-embedded/routing/sticky.d.ts +158 -0
- package/dist/types/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/dist/types/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/dist/types/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/dist/types/src/common-auth-embedded/setup/index.d.ts +6 -0
- package/dist/types/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/dist/types/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/setup/types.d.ts +150 -0
- package/dist/types/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/dist/types/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/dist/types/src/ga/rpc/protocol.d.ts +4 -7
- package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -1
- package/dist/types/src/ga/server/auth.d.ts +8 -3
- package/dist/types/src/ga/server/auth.d.ts.map +1 -1
- package/dist/types/src/ga/server/index.d.ts +39 -12
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/dist/types/src/ga/server/pool-login.d.ts +22 -0
- package/dist/types/src/ga/server/pool-login.d.ts.map +1 -0
- package/dist/types/src/plugin/accounts.d.ts +1 -1
- package/dist/types/src/plugin/accounts.d.ts.map +1 -1
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts +2 -0
- package/dist/types/src/plugin/background-vault-quota-refresh.d.ts.map +1 -1
- package/dist/types/src/plugin/command-apply.d.ts +2 -2
- package/dist/types/src/plugin/command-apply.d.ts.map +1 -1
- package/dist/types/src/plugin/commands.d.ts +1 -0
- package/dist/types/src/plugin/commands.d.ts.map +1 -1
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts +0 -4
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -1
- package/dist/types/src/plugin/config/schema.d.ts +0 -7
- package/dist/types/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/types/src/plugin/config/writer.d.ts +1 -1
- package/dist/types/src/plugin/fetch/retry-state.d.ts +19 -3
- package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/types/src/plugin/fetch-routing.d.ts +0 -16
- package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +14 -9
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/types/src/plugin/google-origin.d.ts +7 -0
- package/dist/types/src/plugin/google-origin.d.ts.map +1 -0
- package/dist/types/src/plugin/index.d.ts.map +1 -1
- package/dist/types/src/plugin/logging-utils.d.ts.map +1 -1
- package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -1
- package/dist/types/src/plugin/operator-settings.d.ts +1 -1
- package/dist/types/src/plugin/operator-settings.d.ts.map +1 -1
- package/dist/types/src/plugin/quota.d.ts +11 -7
- package/dist/types/src/plugin/quota.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts +6 -5
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/server.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/advisory-repository.d.ts +20 -0
- package/dist/types/src/plugin/shared/advisory-repository.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts +27 -26
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +16 -4
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/storage.d.ts +2 -2
- package/dist/types/src/plugin/storage.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-custody.d.ts +14 -1
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/types/src/plugin/vault-quota-outcome.d.ts +19 -0
- package/dist/types/src/plugin/vault-quota-outcome.d.ts.map +1 -0
- package/dist/types/src/setup.d.ts +15 -0
- package/dist/types/src/setup.d.ts.map +1 -0
- package/dist/types/src/sidebar-state.d.ts +1 -1
- package/dist/types/src/sidebar-state.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/common-auth-embedded/claustrum/consumer.d.ts +44 -4
- package/src/common-auth-embedded/claustrum/consumer.js +134 -2
- package/src/common-auth-embedded/claustrum/custody.d.ts +33 -1
- package/src/common-auth-embedded/claustrum/custody.js +17 -0
- package/src/common-auth-embedded/claustrum/enrollment.d.ts +6 -1
- package/src/common-auth-embedded/claustrum/enrollment.js +6 -1
- package/src/common-auth-embedded/claustrum/index.d.ts +3 -2
- package/src/common-auth-embedded/claustrum/index.js +5 -3
- package/src/common-auth-embedded/claustrum/insula.d.ts +69 -0
- package/src/common-auth-embedded/claustrum/insula.js +152 -0
- package/src/common-auth-embedded/claustrum/roster.d.ts +13 -0
- package/src/common-auth-embedded/claustrum/roster.js +33 -3
- package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +8 -2
- package/src/common-auth-embedded/fs/refresh-file-lock.js +26 -12
- package/src/common-auth-embedded/pi-slot/lock.js +7 -3
- package/src/common-auth-embedded/quota/codec.d.ts +2 -0
- package/src/common-auth-embedded/quota/codec.js +2 -1
- package/src/common-auth-embedded/quota/format.d.ts +40 -3
- package/src/common-auth-embedded/quota/format.js +196 -43
- package/src/common-auth-embedded/quota/index.d.ts +4 -4
- package/src/common-auth-embedded/quota/index.js +2 -2
- package/src/common-auth-embedded/quota/map.d.ts +11 -0
- package/src/common-auth-embedded/quota/map.js +36 -1
- package/src/common-auth-embedded/quota/merge.d.ts +3 -1
- package/src/common-auth-embedded/quota/merge.js +21 -5
- package/src/common-auth-embedded/quota/projection.d.ts +2 -1
- package/src/common-auth-embedded/quota/projection.js +3 -1
- package/src/common-auth-embedded/setup/command-error.d.ts +32 -0
- package/src/common-auth-embedded/setup/command-error.js +79 -0
- package/src/common-auth-embedded/setup/command-runner.js +143 -0
- package/src/common-auth-embedded/setup/command.d.ts +3 -0
- package/src/common-auth-embedded/setup/command.js +271 -0
- package/src/common-auth-embedded/setup/config-write.js +60 -0
- package/src/common-auth-embedded/setup/detect.d.ts +6 -0
- package/src/common-auth-embedded/setup/detect.js +224 -0
- package/src/common-auth-embedded/setup/enroll.js +82 -0
- package/src/common-auth-embedded/setup/index.d.ts +6 -0
- package/src/common-auth-embedded/setup/index.js +5 -0
- package/src/common-auth-embedded/setup/paths.js +33 -0
- package/src/common-auth-embedded/setup/process-fence.d.ts +43 -0
- package/src/common-auth-embedded/setup/process-fence.js +270 -0
- package/src/common-auth-embedded/setup/prompts.js +26 -0
- package/src/common-auth-embedded/setup/register.d.ts +11 -0
- package/src/common-auth-embedded/setup/register.js +136 -0
- package/src/common-auth-embedded/setup/types.d.ts +150 -0
- package/src/common-auth-embedded/source-output.json +265 -101
- package/src/common-auth-embedded/store/pool.d.ts +1 -1
- package/src/common-auth-embedded/store/pool.js +0 -1
- package/src/common-auth-embedded/store/refresh-lock.d.ts +0 -1
- package/src/common-auth-embedded/store/refresh-lock.js +0 -1
- package/src/common-auth-embedded/store/schema.d.ts +2 -0
- package/src/common-auth-embedded/store/schema.js +3 -2
- package/src/sidebar-state.ts +19 -2
- package/src/tui-compiled/common-auth-embedded/quota/codec.js +2 -1
- package/src/tui-compiled/common-auth-embedded/quota/format.js +196 -43
- package/src/tui-compiled/common-auth-embedded/quota/index.js +2 -2
- package/src/tui-compiled/common-auth-embedded/quota/map.js +36 -1
- package/src/tui-compiled/common-auth-embedded/quota/merge.js +21 -5
- package/src/tui-compiled/common-auth-embedded/quota/projection.js +3 -1
- package/src/tui-compiled/quota-presentation.js +42 -9
- package/src/tui-compiled/sidebar-state.js +15 -1
- package/src/tui-compiled/tui/quota-layout.js +378 -0
- package/src/tui-compiled/tui/route-layout.js +30 -0
- package/src/tui-compiled/tui.js +271 -371
- package/src/tui-ga-compiled/host-ga.js +93 -90
- package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +3 -1
- package/src/tui-ga-compiled/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
- package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +36 -1
- package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
- package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
- package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +196 -43
- package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +2 -2
- package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +2 -1
- package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +378 -0
- package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +21 -5
- package/src/tui-ga-raw/host-ga.tsx +102 -92
- package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +3 -1
- package/src/tui-ga-raw/shared/6ca47cd4ec33fe72-route-layout.js +30 -0
- package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +36 -1
- package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +2 -2
- package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -9
- package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +196 -43
- package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +2 -2
- package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +2 -1
- package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +391 -0
- package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +21 -5
- package/src/tui-raw/common-auth-embedded/quota/codec.js +2 -1
- package/src/tui-raw/common-auth-embedded/quota/format.js +196 -43
- package/src/tui-raw/common-auth-embedded/quota/index.js +2 -2
- package/src/tui-raw/common-auth-embedded/quota/map.js +36 -1
- package/src/tui-raw/common-auth-embedded/quota/merge.js +21 -5
- package/src/tui-raw/common-auth-embedded/quota/projection.js +3 -1
- package/src/tui-raw/quota-presentation.js +42 -9
- package/src/tui-raw/sidebar-state.js +15 -1
- package/src/tui-raw/tui/quota-layout.tsx +391 -0
- package/src/tui-raw/tui/route-layout.js +30 -0
- package/src/tui-raw/tui.tsx +218 -272
- package/src/tui.tsx +218 -272
- package/dist/src/tui/vault-setup.d.ts +0 -98
- package/dist/src/tui/vault-setup.d.ts.map +0 -1
- package/dist/src/tui/vault-setup.js +0 -198
- package/dist/src/tui/vault-setup.js.map +0 -1
- package/dist/types/src/plugin/transform/model-resolver.d.ts +0 -2
- package/dist/types/src/plugin/transform/model-resolver.d.ts.map +0 -1
- package/dist/types/src/quota-presentation.d.ts +0 -18
- package/dist/types/src/quota-presentation.d.ts.map +0 -1
|
@@ -65,6 +65,13 @@ import {
|
|
|
65
65
|
type MenuSection,
|
|
66
66
|
type MenuUi,
|
|
67
67
|
} from "./shared/07365a7d2ccade4c-host-api.js"
|
|
68
|
+
import {
|
|
69
|
+
ASSUMED_CONTENT_WIDTH,
|
|
70
|
+
DEFAULT_QUOTA_APPEARANCE,
|
|
71
|
+
QuotaAccountBlock,
|
|
72
|
+
type QuotaPalette,
|
|
73
|
+
} from "./shared/dd4c9e1a907f8ef0-quota-layout.tsx"
|
|
74
|
+
import { fitRouteParts } from "./shared/6ca47cd4ec33fe72-route-layout.js"
|
|
68
75
|
|
|
69
76
|
export const GA_TUI_ID = 'cortexkit.antigravity-auth' as const
|
|
70
77
|
export const GA_RPC_ID = 'antigravity-auth' as const
|
|
@@ -170,7 +177,6 @@ export type GaScope =
|
|
|
170
177
|
export const GA_COMMANDS = [
|
|
171
178
|
'antigravity-quota',
|
|
172
179
|
'antigravity-account',
|
|
173
|
-
'antigravity-routing',
|
|
174
180
|
'antigravity-killswitch',
|
|
175
181
|
'antigravity-dump',
|
|
176
182
|
'antigravity-logging',
|
|
@@ -200,10 +206,7 @@ export interface GaAccount extends ProjectionAccount {
|
|
|
200
206
|
|
|
201
207
|
/** The location's operator settings, read fresh for every `state` answer. */
|
|
202
208
|
export interface GaSettings {
|
|
203
|
-
readonly
|
|
204
|
-
readonly cliFirst: boolean
|
|
205
|
-
readonly quotaStyleFallback: boolean
|
|
206
|
-
}
|
|
209
|
+
readonly selectionStrategy: 'sticky' | 'round-robin' | 'hybrid' | 'vault'
|
|
207
210
|
readonly killswitch: {
|
|
208
211
|
readonly enabled: boolean
|
|
209
212
|
readonly minimumRemainingPercent: number
|
|
@@ -516,10 +519,7 @@ function checkRoute(value: unknown, path: string, issues: Issues) {
|
|
|
516
519
|
if (value.modelFamily !== 'claude' && value.modelFamily !== 'gemini') {
|
|
517
520
|
issues.push(`${path}.modelFamily: unknown family`)
|
|
518
521
|
}
|
|
519
|
-
if (
|
|
520
|
-
value.headerStyle !== 'antigravity' &&
|
|
521
|
-
value.headerStyle !== 'gemini-cli'
|
|
522
|
-
) {
|
|
522
|
+
if (value.headerStyle !== 'antigravity') {
|
|
523
523
|
issues.push(`${path}.headerStyle: unknown header style`)
|
|
524
524
|
}
|
|
525
525
|
if (
|
|
@@ -584,22 +584,21 @@ function checkSettings(value: unknown, path: string, issues: Issues) {
|
|
|
584
584
|
issues.push(`${path}: expected settings`)
|
|
585
585
|
return
|
|
586
586
|
}
|
|
587
|
-
keys(
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
587
|
+
keys(
|
|
588
|
+
value,
|
|
589
|
+
['selectionStrategy', 'killswitch', 'logLevel', 'dump'],
|
|
590
|
+
[],
|
|
591
|
+
path,
|
|
592
|
+
issues,
|
|
593
|
+
)
|
|
594
|
+
const { killswitch, dump } = value
|
|
595
|
+
if (
|
|
596
|
+
!['sticky', 'round-robin', 'hybrid', 'vault'].includes(
|
|
597
|
+
value.selectionStrategy as string,
|
|
597
598
|
)
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
`${path}.routing.quotaStyleFallback`,
|
|
602
|
-
issues,
|
|
599
|
+
) {
|
|
600
|
+
issues.push(
|
|
601
|
+
`${path}.selectionStrategy: expected an account selection strategy`,
|
|
603
602
|
)
|
|
604
603
|
}
|
|
605
604
|
if (!isRecord(killswitch))
|
|
@@ -704,9 +703,6 @@ function checkCommandResult(value: unknown, path: string, issues: Issues) {
|
|
|
704
703
|
issues.push(`${path}.targetOutcome: unknown outcome`)
|
|
705
704
|
}
|
|
706
705
|
return
|
|
707
|
-
case 'antigravity-routing':
|
|
708
|
-
keys(value, [...base, 'routing'], [], path, issues)
|
|
709
|
-
return
|
|
710
706
|
case 'antigravity-killswitch':
|
|
711
707
|
keys(value, [...base, 'killswitch'], [], path, issues)
|
|
712
708
|
return
|
|
@@ -1017,7 +1013,6 @@ export function createGaLocationClient(options: {
|
|
|
1017
1013
|
const SECTION_FOR_COMMAND: Readonly<Record<GaCommand, string>> = {
|
|
1018
1014
|
'antigravity-account': 'accounts',
|
|
1019
1015
|
'antigravity-quota': 'quota',
|
|
1020
|
-
'antigravity-routing': 'routing',
|
|
1021
1016
|
'antigravity-killswitch': 'limits',
|
|
1022
1017
|
'antigravity-dump': 'diagnostics',
|
|
1023
1018
|
'antigravity-logging': 'diagnostics',
|
|
@@ -1150,25 +1145,22 @@ export function buildGaMenu(snapshot: GaSnapshot, now: number): MenuModel {
|
|
|
1150
1145
|
id: 'routing',
|
|
1151
1146
|
slot: 'routing',
|
|
1152
1147
|
title: 'Routing',
|
|
1153
|
-
lines:
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1148
|
+
lines:
|
|
1149
|
+
settings.selectionStrategy === 'vault'
|
|
1150
|
+
? ["Selection follows the vault's served accounts."]
|
|
1151
|
+
: [
|
|
1152
|
+
`Account selection strategy: ${settings.selectionStrategy}`,
|
|
1153
|
+
{
|
|
1154
|
+
sticky: 'Keep the current account until it is unavailable.',
|
|
1155
|
+
'round-robin':
|
|
1156
|
+
'Rotate among available accounts for each request.',
|
|
1157
|
+
hybrid:
|
|
1158
|
+
'Choose available accounts using health and quota signals.',
|
|
1159
|
+
}[settings.selectionStrategy],
|
|
1160
|
+
'Configured in antigravity.json: account_selection_strategy',
|
|
1161
|
+
],
|
|
1157
1162
|
items: [],
|
|
1158
|
-
actions: [
|
|
1159
|
-
{
|
|
1160
|
-
id: settings.routing.cliFirst ? 'cli-first-off' : 'cli-first-on',
|
|
1161
|
-
label: `Turn Gemini CLI first ${settings.routing.cliFirst ? 'off' : 'on'}`,
|
|
1162
|
-
knobs: [],
|
|
1163
|
-
},
|
|
1164
|
-
{
|
|
1165
|
-
id: settings.routing.quotaStyleFallback
|
|
1166
|
-
? 'quota-fallback-off'
|
|
1167
|
-
: 'quota-fallback-on',
|
|
1168
|
-
label: `Turn quota-style fallback ${settings.routing.quotaStyleFallback ? 'off' : 'on'}`,
|
|
1169
|
-
knobs: [],
|
|
1170
|
-
},
|
|
1171
|
-
],
|
|
1163
|
+
actions: [],
|
|
1172
1164
|
},
|
|
1173
1165
|
{
|
|
1174
1166
|
id: 'limits',
|
|
@@ -1259,22 +1251,6 @@ const TEXT_ACTIONS: Readonly<Record<string, GaApplyBody>> = {
|
|
|
1259
1251
|
arguments: 'add-oauth-start',
|
|
1260
1252
|
},
|
|
1261
1253
|
'quota/refresh': { command: 'antigravity-quota', arguments: 'refresh' },
|
|
1262
|
-
'routing/cli-first-on': {
|
|
1263
|
-
command: 'antigravity-routing',
|
|
1264
|
-
arguments: 'cli_first=true',
|
|
1265
|
-
},
|
|
1266
|
-
'routing/cli-first-off': {
|
|
1267
|
-
command: 'antigravity-routing',
|
|
1268
|
-
arguments: 'cli_first=false',
|
|
1269
|
-
},
|
|
1270
|
-
'routing/quota-fallback-on': {
|
|
1271
|
-
command: 'antigravity-routing',
|
|
1272
|
-
arguments: 'quota_style_fallback=true',
|
|
1273
|
-
},
|
|
1274
|
-
'routing/quota-fallback-off': {
|
|
1275
|
-
command: 'antigravity-routing',
|
|
1276
|
-
arguments: 'quota_style_fallback=false',
|
|
1277
|
-
},
|
|
1278
1254
|
'limits/killswitch-on': {
|
|
1279
1255
|
command: 'antigravity-killswitch',
|
|
1280
1256
|
arguments: 'enabled=true',
|
|
@@ -1497,7 +1473,19 @@ export async function pollGaOnce(options: GaPollerOptions): Promise<void> {
|
|
|
1497
1473
|
|
|
1498
1474
|
interface SidebarView {
|
|
1499
1475
|
readonly scope: GaScope
|
|
1476
|
+
/** The snapshot's accounts; the quota layout reads their stored windows. */
|
|
1477
|
+
readonly accounts: readonly ProjectionAccount[]
|
|
1500
1478
|
readonly projected: ProjectedSidebar
|
|
1479
|
+
/** The clock reading the projection was made at; the quota rows use it too. */
|
|
1480
|
+
readonly readAt: number
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
// The GA context carries no theme, so the quota layout keeps the host's
|
|
1484
|
+
// default text color everywhere.
|
|
1485
|
+
const HOST_COLORS: QuotaPalette = {
|
|
1486
|
+
text: () => undefined,
|
|
1487
|
+
muted: () => undefined,
|
|
1488
|
+
tone: () => undefined,
|
|
1501
1489
|
}
|
|
1502
1490
|
|
|
1503
1491
|
function GaSidebar(props: {
|
|
@@ -1513,43 +1501,62 @@ function GaSidebar(props: {
|
|
|
1513
1501
|
? view.projected.route
|
|
1514
1502
|
: null
|
|
1515
1503
|
}
|
|
1504
|
+
const routeLine = () => {
|
|
1505
|
+
const value = route()
|
|
1506
|
+
if (value === null) return null
|
|
1507
|
+
return `Route ${fitRouteParts('Route', value.split(' · '), contentWidth())}`
|
|
1508
|
+
}
|
|
1509
|
+
// The quota rows are sized to the sidebar's width so none of them wraps.
|
|
1510
|
+
// Layout reports the width during a render pass, so the signal is updated
|
|
1511
|
+
// afterwards rather than rebuilding rows mid-pass.
|
|
1512
|
+
const [contentWidth, setContentWidth] = createSignal(ASSUMED_CONTENT_WIDTH)
|
|
1513
|
+
let titleRow: { width: number } | undefined
|
|
1514
|
+
const measureContentWidth = (): void => {
|
|
1515
|
+
const width = titleRow?.width
|
|
1516
|
+
if (typeof width !== 'number' || width <= 0) return
|
|
1517
|
+
queueMicrotask(() => {
|
|
1518
|
+
if (width !== contentWidth()) setContentWidth(width)
|
|
1519
|
+
})
|
|
1520
|
+
}
|
|
1516
1521
|
return (
|
|
1517
1522
|
<box flexDirection='column' width='100%'>
|
|
1518
|
-
<
|
|
1519
|
-
|
|
1520
|
-
|
|
1523
|
+
<box
|
|
1524
|
+
ref={(element) => {
|
|
1525
|
+
titleRow = element
|
|
1526
|
+
}}
|
|
1527
|
+
onSizeChange={measureContentWidth}
|
|
1528
|
+
width='100%'
|
|
1529
|
+
flexDirection='row'
|
|
1530
|
+
>
|
|
1531
|
+
<text>
|
|
1532
|
+
<b>Antigravity</b>
|
|
1533
|
+
</text>
|
|
1534
|
+
</box>
|
|
1521
1535
|
<Show when={props.view()} fallback={<text>connecting…</text>}>
|
|
1522
1536
|
{(view) => (
|
|
1523
1537
|
<>
|
|
1524
1538
|
<For each={view().projected.accounts}>
|
|
1525
|
-
{(account) => (
|
|
1526
|
-
<
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
<text>{`${row.label.padEnd(6)}${row.figure}`}</text>
|
|
1543
|
-
<text>{row.reset}</text>
|
|
1544
|
-
</box>
|
|
1545
|
-
)}
|
|
1546
|
-
</For>
|
|
1547
|
-
<text>{` ${account.health}`}</text>
|
|
1548
|
-
</box>
|
|
1539
|
+
{(account, index) => (
|
|
1540
|
+
<Show when={view().accounts[index()]}>
|
|
1541
|
+
{(source) => (
|
|
1542
|
+
<QuotaAccountBlock
|
|
1543
|
+
palette={HOST_COLORS}
|
|
1544
|
+
appearance={DEFAULT_QUOTA_APPEARANCE}
|
|
1545
|
+
account={source()}
|
|
1546
|
+
status={account.status}
|
|
1547
|
+
statusTone={account.statusTone}
|
|
1548
|
+
now={() => view().readAt}
|
|
1549
|
+
width={contentWidth}
|
|
1550
|
+
marginTop={index() === 0 ? 0 : 1}
|
|
1551
|
+
>
|
|
1552
|
+
<text>{` ${account.health}`}</text>
|
|
1553
|
+
</QuotaAccountBlock>
|
|
1554
|
+
)}
|
|
1555
|
+
</Show>
|
|
1549
1556
|
)}
|
|
1550
1557
|
</For>
|
|
1551
|
-
<Show when={
|
|
1552
|
-
{(line) => <text>{
|
|
1558
|
+
<Show when={routeLine()}>
|
|
1559
|
+
{(line) => <text wrapMode='none'>{line()}</text>}
|
|
1553
1560
|
</Show>
|
|
1554
1561
|
<For each={view().projected.notices}>
|
|
1555
1562
|
{(notice) => <text>{notice}</text>}
|
|
@@ -1606,14 +1613,17 @@ export function setupGaTui(
|
|
|
1606
1613
|
|
|
1607
1614
|
const showSnapshot = (snapshot: GaSnapshot) => {
|
|
1608
1615
|
latest.set(scopeKey(snapshot.scope), snapshot)
|
|
1616
|
+
const readAt = now()
|
|
1609
1617
|
setView({
|
|
1610
1618
|
scope: snapshot.scope,
|
|
1619
|
+
accounts: snapshot.accounts,
|
|
1611
1620
|
projected: projectSidebar({
|
|
1612
1621
|
accounts: snapshot.accounts,
|
|
1613
1622
|
route: snapshot.route,
|
|
1614
1623
|
status: snapshot.status,
|
|
1615
|
-
now:
|
|
1624
|
+
now: readAt,
|
|
1616
1625
|
}),
|
|
1626
|
+
readAt,
|
|
1617
1627
|
})
|
|
1618
1628
|
}
|
|
1619
1629
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// scope, orders the result the way the primitives expect, and carries each
|
|
7
7
|
// entry's (scope, label) so a decision names the limit it judged rather than
|
|
8
8
|
// the position it occupied.
|
|
9
|
-
import { ALL_SCOPE, } from "./77138df80c7ae006-map.js";
|
|
9
|
+
import { ALL_SCOPE, readQuotaCounters, } from "./77138df80c7ae006-map.js";
|
|
10
10
|
function project(entry) {
|
|
11
11
|
if (entry.kind === 'retired') {
|
|
12
12
|
return {
|
|
@@ -94,11 +94,13 @@ export function projectQuota(map, scope = ALL_SCOPE) {
|
|
|
94
94
|
? Math.min(...stamped.map((limit) => limit.checkedAt))
|
|
95
95
|
: undefined;
|
|
96
96
|
const budget = map?.budget?.kind === 'reading' ? projectBudget(map.budget) : undefined;
|
|
97
|
+
const counters = readQuotaCounters(map?.counters);
|
|
97
98
|
return {
|
|
98
99
|
scope,
|
|
99
100
|
limits,
|
|
100
101
|
...(checkedAt === undefined ? {} : { checkedAt }),
|
|
101
102
|
...(budget === undefined ? {} : { budget }),
|
|
103
|
+
...(counters === undefined ? {} : { counters }),
|
|
102
104
|
};
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function routeLineFits(label, value, width) {
|
|
2
|
+
return label.length + 1 + value.length <= width;
|
|
3
|
+
}
|
|
4
|
+
function fitPrimaryPart(value, maxWidth) {
|
|
5
|
+
if (value.length <= maxWidth)
|
|
6
|
+
return value;
|
|
7
|
+
if (maxWidth <= 0)
|
|
8
|
+
return "";
|
|
9
|
+
let fitted = "";
|
|
10
|
+
for (const word of value.trim().split(/\s+/)) {
|
|
11
|
+
const candidate = fitted ? `${fitted} ${word}` : word;
|
|
12
|
+
if (candidate.length > maxWidth) {
|
|
13
|
+
const marked = fitted ? `${fitted}\u2026` : "\u2026";
|
|
14
|
+
return marked.length <= maxWidth ? marked : fitted;
|
|
15
|
+
}
|
|
16
|
+
fitted = candidate;
|
|
17
|
+
}
|
|
18
|
+
return fitted;
|
|
19
|
+
}
|
|
20
|
+
export function fitRouteParts(label, parts, width) {
|
|
21
|
+
const [primary = "", ...optional] = parts;
|
|
22
|
+
let value = fitPrimaryPart(primary, width - label.length - 1);
|
|
23
|
+
for (const part of optional) {
|
|
24
|
+
const candidate = `${value} \xB7 ${part}`;
|
|
25
|
+
if (!routeLineFits(label, candidate, width))
|
|
26
|
+
break;
|
|
27
|
+
value = candidate;
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
@@ -83,6 +83,40 @@ export function isCreditBudgetEntry(value) {
|
|
|
83
83
|
optional(value, 'remaining', isFiniteNumber) &&
|
|
84
84
|
optional(value, 'unit', isString));
|
|
85
85
|
}
|
|
86
|
+
function isQuotaCounter(value) {
|
|
87
|
+
return (isRecord(value) &&
|
|
88
|
+
isFiniteNumber(value.value) &&
|
|
89
|
+
Number.isInteger(value.value) &&
|
|
90
|
+
value.value >= 0 &&
|
|
91
|
+
isFiniteNumber(value.checkedAt));
|
|
92
|
+
}
|
|
93
|
+
export function isQuotaCounters(value) {
|
|
94
|
+
return isRecord(value) && Object.values(value).every(isQuotaCounter);
|
|
95
|
+
}
|
|
96
|
+
/** Keep usable counters without letting one malformed count hide a quota map. */
|
|
97
|
+
export function readQuotaCounters(value) {
|
|
98
|
+
if (!isRecord(value))
|
|
99
|
+
return undefined;
|
|
100
|
+
const entries = Object.entries(value).filter(([, entry]) => isQuotaCounter(entry));
|
|
101
|
+
return entries.length === 0
|
|
102
|
+
? undefined
|
|
103
|
+
: Object.fromEntries(entries);
|
|
104
|
+
}
|
|
105
|
+
/** Decode persisted quota, dropping malformed counters but not limit evidence. */
|
|
106
|
+
export function decodeQuotaMap(value) {
|
|
107
|
+
// A valid map is returned as the same object, so stored quota keeps the
|
|
108
|
+
// identity it had before counters existed; only a map with a malformed
|
|
109
|
+
// counter is copied without it.
|
|
110
|
+
if (isQuotaMap(value))
|
|
111
|
+
return value;
|
|
112
|
+
if (!isRecord(value))
|
|
113
|
+
return undefined;
|
|
114
|
+
const { counters: rawCounters, ...rest } = value;
|
|
115
|
+
if (!isQuotaMap(rest))
|
|
116
|
+
return undefined;
|
|
117
|
+
const counters = readQuotaCounters(rawCounters);
|
|
118
|
+
return { ...rest, ...(counters === undefined ? {} : { counters }) };
|
|
119
|
+
}
|
|
86
120
|
/**
|
|
87
121
|
* True when `value` is a well-formed quota map. Unrecognised top-level keys
|
|
88
122
|
* are tolerated (and preserved by merge) so a newer writer's additions
|
|
@@ -101,5 +135,6 @@ export function isQuotaMap(value) {
|
|
|
101
135
|
return false;
|
|
102
136
|
seen.add(key);
|
|
103
137
|
}
|
|
104
|
-
return optional(value, 'budget', isCreditBudgetEntry)
|
|
138
|
+
return (optional(value, 'budget', isCreditBudgetEntry) &&
|
|
139
|
+
optional(value, 'counters', isQuotaCounters));
|
|
105
140
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { quotaReadingParts } from "./98cc0c186c46c42d-quota-presentation.js";
|
|
2
2
|
export const QUOTA_POOL_LABELS = {
|
|
3
|
-
gemini: "
|
|
4
|
-
"non-gemini": "
|
|
3
|
+
gemini: "Gemini",
|
|
4
|
+
"non-gemini": "Other models"
|
|
5
5
|
};
|
|
6
6
|
const POOL_ORDER = ["gemini", "non-gemini"];
|
|
7
7
|
function clamp(value) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatQuota,
|
|
3
3
|
NO_QUOTA_READING,
|
|
4
|
-
|
|
5
|
-
quotaWindowName
|
|
4
|
+
quotaWindowParts
|
|
6
5
|
} from "./bf17cbee28e58197-index.js";
|
|
7
6
|
|
|
8
7
|
export { NO_QUOTA_READING };
|
|
@@ -23,20 +22,54 @@ function projectReading(label, reading) {
|
|
|
23
22
|
export function formatQuotaReading(label, reading, now) {
|
|
24
23
|
return formatQuota(projectReading(label, reading), { now });
|
|
25
24
|
}
|
|
25
|
+
export function quotaWindowText(reading, now) {
|
|
26
|
+
const part = quotaWindowParts(projectReading("", reading), {
|
|
27
|
+
now,
|
|
28
|
+
form: "full",
|
|
29
|
+
staleAfterMs: Number.POSITIVE_INFINITY
|
|
30
|
+
}).windows[0];
|
|
31
|
+
if (!part)
|
|
32
|
+
return {
|
|
33
|
+
name: "",
|
|
34
|
+
figure: NO_QUOTA_READING,
|
|
35
|
+
reset: "",
|
|
36
|
+
remaining: null,
|
|
37
|
+
resetSinceReading: !1
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
name: part.name,
|
|
41
|
+
figure: part.figure,
|
|
42
|
+
reset: part.resetIn ?? "",
|
|
43
|
+
remaining: part.remainingPercent ?? null,
|
|
44
|
+
resetSinceReading: part.resetSinceReading
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function quotaReadingAge(readings, now) {
|
|
48
|
+
const limits = readings.flatMap((reading, index) => projectReading(`reading ${index}`, reading)?.limits ?? []);
|
|
49
|
+
if (limits.length === 0)
|
|
50
|
+
return "";
|
|
51
|
+
return quotaWindowParts({
|
|
52
|
+
scope: "all",
|
|
53
|
+
limits,
|
|
54
|
+
checkedAt: Math.min(...limits.map((limit) => limit.checkedAt))
|
|
55
|
+
}, { now, form: "compact" }).age ?? "";
|
|
56
|
+
}
|
|
26
57
|
export function quotaReadingParts(label, reading, now) {
|
|
27
|
-
const
|
|
28
|
-
|
|
58
|
+
const parts = quotaWindowParts(projectReading(label, reading), {
|
|
59
|
+
now,
|
|
60
|
+
form: "full"
|
|
61
|
+
}), part = parts.windows[0];
|
|
62
|
+
if (!part)
|
|
29
63
|
return {
|
|
30
64
|
name: label,
|
|
31
65
|
figure: NO_QUOTA_READING,
|
|
32
66
|
detail: "",
|
|
33
67
|
remaining: null
|
|
34
68
|
};
|
|
35
|
-
const full = quotaTextParts(projected, { now }), compact = quotaTextParts(projected, { now, form: "compact" }), name = quotaWindowName(limit), first = compact[0] ?? "", figure = first.startsWith(`${name} `) ? first.slice(name.length + 1) : first, reset = (full[0] ?? "").slice(first.length).replace(/^, /, "");
|
|
36
69
|
return {
|
|
37
|
-
name,
|
|
38
|
-
figure,
|
|
39
|
-
detail: [
|
|
40
|
-
remaining:
|
|
70
|
+
name: part.name,
|
|
71
|
+
figure: part.figure,
|
|
72
|
+
detail: [part.resetIn ? `resets ${part.resetIn}` : "", parts.age].filter(Boolean).join(" \xB7 "),
|
|
73
|
+
remaining: part.remainingPercent ?? null
|
|
41
74
|
};
|
|
42
75
|
}
|