@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
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { memo as _$memo } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
1
2
|
import { insert as _$insert } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
2
3
|
import { createComponent as _$createComponent } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
3
4
|
import { createTextNode as _$createTextNode } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
4
5
|
import { insertNode as _$insertNode } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
6
|
+
import { use as _$use } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
5
7
|
import { setProp as _$setProp } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
6
8
|
import { createElement as _$createElement } from "opentui:runtime-module:%40opentui%2Fsolid";
|
|
7
9
|
/** @jsxImportSource @opentui/solid */
|
|
@@ -51,6 +53,8 @@ import { createSignal, For, Show } from "opentui:runtime-module:solid-js";
|
|
|
51
53
|
import { projectAccount, projectSidebar } from "./shared/8ae1927e5910ea81-sidebar-projection.js";
|
|
52
54
|
import { MenuRefusedError, openAntigravityMenu } from "./shared/0e19a88ff3535906-command-dialogs.js";
|
|
53
55
|
import { ANTIGRAVITY_MENU_COMMAND, ANTIGRAVITY_MENU_TITLE } from "./shared/07365a7d2ccade4c-host-api.js";
|
|
56
|
+
import { ASSUMED_CONTENT_WIDTH, DEFAULT_QUOTA_APPEARANCE, QuotaAccountBlock } from "./shared/dd4c9e1a907f8ef0-quota-layout.js";
|
|
57
|
+
import { fitRouteParts } from "./shared/6ca47cd4ec33fe72-route-layout.js";
|
|
54
58
|
export const GA_TUI_ID = 'cortexkit.antigravity-auth';
|
|
55
59
|
export const GA_RPC_ID = 'antigravity-auth';
|
|
56
60
|
export const GA_RPC_VERSION = 1;
|
|
@@ -68,7 +72,7 @@ const MAX_PULLS_PER_TICK = 4;
|
|
|
68
72
|
// ── Wire shapes ─────────────────────────────────────────────────────────────
|
|
69
73
|
|
|
70
74
|
/** The dialog commands the server names in notifications and text applies. */
|
|
71
|
-
export const GA_COMMANDS = ['antigravity-quota', 'antigravity-account', 'antigravity-
|
|
75
|
+
export const GA_COMMANDS = ['antigravity-quota', 'antigravity-account', 'antigravity-killswitch', 'antigravity-dump', 'antigravity-logging'];
|
|
72
76
|
export const GA_LOG_LEVELS = ['error', 'warn', 'info', 'debug', 'trace'];
|
|
73
77
|
|
|
74
78
|
/** A redacted account plus the opaque selector that names its credential. */
|
|
@@ -236,7 +240,7 @@ function checkRoute(value, path, issues) {
|
|
|
236
240
|
if (value.modelFamily !== 'claude' && value.modelFamily !== 'gemini') {
|
|
237
241
|
issues.push(`${path}.modelFamily: unknown family`);
|
|
238
242
|
}
|
|
239
|
-
if (value.headerStyle !== 'antigravity'
|
|
243
|
+
if (value.headerStyle !== 'antigravity') {
|
|
240
244
|
issues.push(`${path}.headerStyle: unknown header style`);
|
|
241
245
|
}
|
|
242
246
|
if (value.strategy !== null && value.strategy !== 'sticky' && value.strategy !== 'round-robin' && value.strategy !== 'hybrid') {
|
|
@@ -285,16 +289,13 @@ function checkSettings(value, path, issues) {
|
|
|
285
289
|
issues.push(`${path}: expected settings`);
|
|
286
290
|
return;
|
|
287
291
|
}
|
|
288
|
-
keys(value, ['
|
|
292
|
+
keys(value, ['selectionStrategy', 'killswitch', 'logLevel', 'dump'], [], path, issues);
|
|
289
293
|
const {
|
|
290
|
-
routing,
|
|
291
294
|
killswitch,
|
|
292
295
|
dump
|
|
293
296
|
} = value;
|
|
294
|
-
if (!
|
|
295
|
-
|
|
296
|
-
checkBool(routing.cliFirst, `${path}.routing.cliFirst`, issues);
|
|
297
|
-
checkBool(routing.quotaStyleFallback, `${path}.routing.quotaStyleFallback`, issues);
|
|
297
|
+
if (!['sticky', 'round-robin', 'hybrid', 'vault'].includes(value.selectionStrategy)) {
|
|
298
|
+
issues.push(`${path}.selectionStrategy: expected an account selection strategy`);
|
|
298
299
|
}
|
|
299
300
|
if (!isRecord(killswitch)) issues.push(`${path}.killswitch: expected an object`);else {
|
|
300
301
|
keys(killswitch, ['enabled', 'minimumRemainingPercent'], [], `${path}.killswitch`, issues);
|
|
@@ -363,9 +364,6 @@ function checkCommandResult(value, path, issues) {
|
|
|
363
364
|
issues.push(`${path}.targetOutcome: unknown outcome`);
|
|
364
365
|
}
|
|
365
366
|
return;
|
|
366
|
-
case 'antigravity-routing':
|
|
367
|
-
keys(value, [...base, 'routing'], [], path, issues);
|
|
368
|
-
return;
|
|
369
367
|
case 'antigravity-killswitch':
|
|
370
368
|
keys(value, [...base, 'killswitch'], [], path, issues);
|
|
371
369
|
return;
|
|
@@ -631,7 +629,6 @@ export function createGaLocationClient(options) {
|
|
|
631
629
|
const SECTION_FOR_COMMAND = {
|
|
632
630
|
'antigravity-account': 'accounts',
|
|
633
631
|
'antigravity-quota': 'quota',
|
|
634
|
-
'antigravity-routing': 'routing',
|
|
635
632
|
'antigravity-killswitch': 'limits',
|
|
636
633
|
'antigravity-dump': 'diagnostics',
|
|
637
634
|
'antigravity-logging': 'diagnostics'
|
|
@@ -713,17 +710,13 @@ export function buildGaMenu(snapshot, now) {
|
|
|
713
710
|
id: 'routing',
|
|
714
711
|
slot: 'routing',
|
|
715
712
|
title: 'Routing',
|
|
716
|
-
lines: [
|
|
713
|
+
lines: settings.selectionStrategy === 'vault' ? ["Selection follows the vault's served accounts."] : [`Account selection strategy: ${settings.selectionStrategy}`, {
|
|
714
|
+
sticky: 'Keep the current account until it is unavailable.',
|
|
715
|
+
'round-robin': 'Rotate among available accounts for each request.',
|
|
716
|
+
hybrid: 'Choose available accounts using health and quota signals.'
|
|
717
|
+
}[settings.selectionStrategy], 'Configured in antigravity.json: account_selection_strategy'],
|
|
717
718
|
items: [],
|
|
718
|
-
actions: [
|
|
719
|
-
id: settings.routing.cliFirst ? 'cli-first-off' : 'cli-first-on',
|
|
720
|
-
label: `Turn Gemini CLI first ${settings.routing.cliFirst ? 'off' : 'on'}`,
|
|
721
|
-
knobs: []
|
|
722
|
-
}, {
|
|
723
|
-
id: settings.routing.quotaStyleFallback ? 'quota-fallback-off' : 'quota-fallback-on',
|
|
724
|
-
label: `Turn quota-style fallback ${settings.routing.quotaStyleFallback ? 'off' : 'on'}`,
|
|
725
|
-
knobs: []
|
|
726
|
-
}]
|
|
719
|
+
actions: []
|
|
727
720
|
}, {
|
|
728
721
|
id: 'limits',
|
|
729
722
|
slot: 'limits',
|
|
@@ -797,22 +790,6 @@ const TEXT_ACTIONS = {
|
|
|
797
790
|
command: 'antigravity-quota',
|
|
798
791
|
arguments: 'refresh'
|
|
799
792
|
},
|
|
800
|
-
'routing/cli-first-on': {
|
|
801
|
-
command: 'antigravity-routing',
|
|
802
|
-
arguments: 'cli_first=true'
|
|
803
|
-
},
|
|
804
|
-
'routing/cli-first-off': {
|
|
805
|
-
command: 'antigravity-routing',
|
|
806
|
-
arguments: 'cli_first=false'
|
|
807
|
-
},
|
|
808
|
-
'routing/quota-fallback-on': {
|
|
809
|
-
command: 'antigravity-routing',
|
|
810
|
-
arguments: 'quota_style_fallback=true'
|
|
811
|
-
},
|
|
812
|
-
'routing/quota-fallback-off': {
|
|
813
|
-
command: 'antigravity-routing',
|
|
814
|
-
arguments: 'quota_style_fallback=false'
|
|
815
|
-
},
|
|
816
793
|
'limits/killswitch-on': {
|
|
817
794
|
command: 'antigravity-killswitch',
|
|
818
795
|
arguments: 'enabled=true'
|
|
@@ -1046,6 +1023,13 @@ export async function pollGaOnce(options) {
|
|
|
1046
1023
|
|
|
1047
1024
|
// ── Sidebar ─────────────────────────────────────────────────────────────────
|
|
1048
1025
|
|
|
1026
|
+
// The GA context carries no theme, so the quota layout keeps the host's
|
|
1027
|
+
// default text color everywhere.
|
|
1028
|
+
const HOST_COLORS = {
|
|
1029
|
+
text: () => undefined,
|
|
1030
|
+
muted: () => undefined,
|
|
1031
|
+
tone: () => undefined
|
|
1032
|
+
};
|
|
1049
1033
|
function GaSidebar(props) {
|
|
1050
1034
|
// The route line belongs to one session; show it only in that session's
|
|
1051
1035
|
// sidebar, never another session's.
|
|
@@ -1054,85 +1038,101 @@ function GaSidebar(props) {
|
|
|
1054
1038
|
if (view === undefined || view.scope.kind !== 'session') return null;
|
|
1055
1039
|
return view.scope.sessionID === props.sessionID ? view.projected.route : null;
|
|
1056
1040
|
};
|
|
1041
|
+
const routeLine = () => {
|
|
1042
|
+
const value = route();
|
|
1043
|
+
if (value === null) return null;
|
|
1044
|
+
return `Route ${fitRouteParts('Route', value.split(' · '), contentWidth())}`;
|
|
1045
|
+
};
|
|
1046
|
+
// The quota rows are sized to the sidebar's width so none of them wraps.
|
|
1047
|
+
// Layout reports the width during a render pass, so the signal is updated
|
|
1048
|
+
// afterwards rather than rebuilding rows mid-pass.
|
|
1049
|
+
const [contentWidth, setContentWidth] = createSignal(ASSUMED_CONTENT_WIDTH);
|
|
1050
|
+
let titleRow;
|
|
1051
|
+
const measureContentWidth = () => {
|
|
1052
|
+
const width = titleRow?.width;
|
|
1053
|
+
if (typeof width !== 'number' || width <= 0) return;
|
|
1054
|
+
queueMicrotask(() => {
|
|
1055
|
+
if (width !== contentWidth()) setContentWidth(width);
|
|
1056
|
+
});
|
|
1057
|
+
};
|
|
1057
1058
|
return (() => {
|
|
1058
1059
|
var _el$ = _$createElement("box"),
|
|
1059
|
-
_el$2 = _$createElement("
|
|
1060
|
-
_el$3 = _$createElement("
|
|
1060
|
+
_el$2 = _$createElement("box"),
|
|
1061
|
+
_el$3 = _$createElement("text"),
|
|
1062
|
+
_el$4 = _$createElement("b");
|
|
1061
1063
|
_$insertNode(_el$, _el$2);
|
|
1062
1064
|
_$setProp(_el$, "flexDirection", 'column');
|
|
1063
1065
|
_$setProp(_el$, "width", '100%');
|
|
1064
1066
|
_$insertNode(_el$2, _el$3);
|
|
1065
|
-
_$
|
|
1067
|
+
_$use(element => {
|
|
1068
|
+
titleRow = element;
|
|
1069
|
+
}, _el$2);
|
|
1070
|
+
_$setProp(_el$2, "onSizeChange", measureContentWidth);
|
|
1071
|
+
_$setProp(_el$2, "width", '100%');
|
|
1072
|
+
_$setProp(_el$2, "flexDirection", 'row');
|
|
1073
|
+
_$insertNode(_el$3, _el$4);
|
|
1074
|
+
_$insertNode(_el$4, _$createTextNode(`Antigravity`));
|
|
1066
1075
|
_$insert(_el$, _$createComponent(Show, {
|
|
1067
1076
|
get when() {
|
|
1068
1077
|
return props.view();
|
|
1069
1078
|
},
|
|
1070
1079
|
get fallback() {
|
|
1071
1080
|
return (() => {
|
|
1072
|
-
var _el$
|
|
1073
|
-
_$insertNode(_el$
|
|
1074
|
-
return _el$
|
|
1081
|
+
var _el$6 = _$createElement("text");
|
|
1082
|
+
_$insertNode(_el$6, _$createTextNode(`connecting…`));
|
|
1083
|
+
return _el$6;
|
|
1075
1084
|
})();
|
|
1076
1085
|
},
|
|
1077
1086
|
children: view => [_$createComponent(For, {
|
|
1078
1087
|
get each() {
|
|
1079
1088
|
return view().projected.accounts;
|
|
1080
1089
|
},
|
|
1081
|
-
children: account => (
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
_$setProp(_el$7, "width", '100%');
|
|
1091
|
-
_$insertNode(_el$8, _el$9);
|
|
1092
|
-
_$insertNode(_el$8, _el$0);
|
|
1093
|
-
_$setProp(_el$8, "flexDirection", 'row');
|
|
1094
|
-
_$setProp(_el$8, "justifyContent", 'space-between');
|
|
1095
|
-
_$setProp(_el$8, "width", '100%');
|
|
1096
|
-
_$insert(_el$9, () => account.label);
|
|
1097
|
-
_$insert(_el$0, () => account.status);
|
|
1098
|
-
_$insert(_el$7, _$createComponent(For, {
|
|
1099
|
-
get each() {
|
|
1100
|
-
return account.quota;
|
|
1090
|
+
children: (account, index) => _$createComponent(Show, {
|
|
1091
|
+
get when() {
|
|
1092
|
+
return view().accounts[index()];
|
|
1093
|
+
},
|
|
1094
|
+
children: source => _$createComponent(QuotaAccountBlock, {
|
|
1095
|
+
palette: HOST_COLORS,
|
|
1096
|
+
appearance: DEFAULT_QUOTA_APPEARANCE,
|
|
1097
|
+
get account() {
|
|
1098
|
+
return source();
|
|
1101
1099
|
},
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1100
|
+
get status() {
|
|
1101
|
+
return account.status;
|
|
1102
|
+
},
|
|
1103
|
+
get statusTone() {
|
|
1104
|
+
return account.statusTone;
|
|
1105
|
+
},
|
|
1106
|
+
now: () => view().readAt,
|
|
1107
|
+
width: contentWidth,
|
|
1108
|
+
get marginTop() {
|
|
1109
|
+
return index() === 0 ? 0 : 1;
|
|
1110
|
+
},
|
|
1111
|
+
get children() {
|
|
1112
|
+
var _el$8 = _$createElement("text");
|
|
1113
|
+
_$insert(_el$8, () => ` ${account.health}`);
|
|
1114
|
+
return _el$8;
|
|
1115
|
+
}
|
|
1116
|
+
})
|
|
1117
|
+
})
|
|
1119
1118
|
}), _$createComponent(Show, {
|
|
1120
1119
|
get when() {
|
|
1121
|
-
return
|
|
1120
|
+
return routeLine();
|
|
1122
1121
|
},
|
|
1123
1122
|
children: line => (() => {
|
|
1124
|
-
var _el$
|
|
1125
|
-
_$
|
|
1126
|
-
|
|
1123
|
+
var _el$9 = _$createElement("text");
|
|
1124
|
+
_$setProp(_el$9, "wrapMode", 'none');
|
|
1125
|
+
_$insert(_el$9, line);
|
|
1126
|
+
return _el$9;
|
|
1127
1127
|
})()
|
|
1128
1128
|
}), _$createComponent(For, {
|
|
1129
1129
|
get each() {
|
|
1130
1130
|
return view().projected.notices;
|
|
1131
1131
|
},
|
|
1132
1132
|
children: notice => (() => {
|
|
1133
|
-
var _el$
|
|
1134
|
-
_$insert(_el$
|
|
1135
|
-
return _el$
|
|
1133
|
+
var _el$0 = _$createElement("text");
|
|
1134
|
+
_$insert(_el$0, notice);
|
|
1135
|
+
return _el$0;
|
|
1136
1136
|
})()
|
|
1137
1137
|
})]
|
|
1138
1138
|
}), null);
|
|
@@ -1180,14 +1180,17 @@ export function setupGaTui(context, options = {}) {
|
|
|
1180
1180
|
const latest = new Map();
|
|
1181
1181
|
const showSnapshot = snapshot => {
|
|
1182
1182
|
latest.set(scopeKey(snapshot.scope), snapshot);
|
|
1183
|
+
const readAt = now();
|
|
1183
1184
|
setView({
|
|
1184
1185
|
scope: snapshot.scope,
|
|
1186
|
+
accounts: snapshot.accounts,
|
|
1185
1187
|
projected: projectSidebar({
|
|
1186
1188
|
accounts: snapshot.accounts,
|
|
1187
1189
|
route: snapshot.route,
|
|
1188
1190
|
status: snapshot.status,
|
|
1189
|
-
now:
|
|
1190
|
-
})
|
|
1191
|
+
now: readAt
|
|
1192
|
+
}),
|
|
1193
|
+
readAt
|
|
1191
1194
|
});
|
|
1192
1195
|
};
|
|
1193
1196
|
|
|
@@ -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
|
}
|