@cortexkit/opencode-antigravity-auth 2.2.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -92
- package/dist/cli.js +18476 -812
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +4100 -0
- package/dist/index.js +40602 -15857
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +6978 -0
- package/dist/server.js +51220 -0
- package/dist/server.js.map +7 -0
- package/dist/server.meta.json +7313 -0
- package/dist/src/cli.d.ts +46 -1
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +207 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/common-auth-embedded/NOTICE.txt +21 -0
- package/dist/src/common-auth-embedded/auth-menu/accounts.d.ts +97 -0
- package/dist/src/common-auth-embedded/auth-menu/accounts.js +387 -0
- package/dist/src/common-auth-embedded/auth-menu/ansi.d.ts +26 -0
- package/dist/src/common-auth-embedded/auth-menu/ansi.js +98 -0
- package/dist/src/common-auth-embedded/auth-menu/confirm.d.ts +7 -0
- package/dist/src/common-auth-embedded/auth-menu/confirm.js +21 -0
- package/dist/src/common-auth-embedded/auth-menu/doctor.d.ts +52 -0
- package/dist/src/common-auth-embedded/auth-menu/doctor.js +81 -0
- package/dist/src/common-auth-embedded/auth-menu/index.d.ts +17 -0
- package/dist/src/common-auth-embedded/auth-menu/index.js +12 -0
- package/dist/src/common-auth-embedded/auth-menu/login.d.ts +55 -0
- package/dist/src/common-auth-embedded/auth-menu/login.js +83 -0
- package/dist/src/common-auth-embedded/auth-menu/menu.d.ts +59 -0
- package/dist/src/common-auth-embedded/auth-menu/menu.js +73 -0
- package/dist/src/common-auth-embedded/auth-menu/opencode-v1.d.ts +49 -0
- package/dist/src/common-auth-embedded/auth-menu/opencode-v1.js +47 -0
- package/dist/src/common-auth-embedded/auth-menu/select.d.ts +21 -0
- package/dist/src/common-auth-embedded/auth-menu/select.js +159 -0
- package/dist/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
- package/dist/src/common-auth-embedded/auth-menu/terminal.js +19 -0
- package/dist/src/common-auth-embedded/claustrum/consumer.d.ts +102 -0
- package/dist/src/common-auth-embedded/claustrum/consumer.js +298 -0
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +175 -0
- package/dist/src/common-auth-embedded/claustrum/custody.js +354 -0
- package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +158 -0
- package/dist/src/common-auth-embedded/claustrum/enrollment.js +759 -0
- package/dist/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
- package/dist/src/common-auth-embedded/claustrum/errors.js +8 -0
- package/dist/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
- package/dist/src/common-auth-embedded/claustrum/host-slot.js +72 -0
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +18 -0
- package/dist/src/common-auth-embedded/claustrum/index.js +22 -0
- package/dist/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
- package/dist/src/common-auth-embedded/claustrum/interlock.js +29 -0
- package/dist/src/common-auth-embedded/claustrum/roster.d.ts +208 -0
- package/dist/src/common-auth-embedded/claustrum/roster.js +536 -0
- package/dist/src/common-auth-embedded/commands/builtins.d.ts +71 -0
- package/dist/src/common-auth-embedded/commands/builtins.js +534 -0
- package/dist/src/common-auth-embedded/commands/index.d.ts +10 -0
- package/dist/src/common-auth-embedded/commands/index.js +5 -0
- package/dist/src/common-auth-embedded/commands/menu.d.ts +61 -0
- package/dist/src/common-auth-embedded/commands/menu.js +300 -0
- package/dist/src/common-auth-embedded/commands/model.d.ts +238 -0
- package/dist/src/common-auth-embedded/commands/model.js +16 -0
- package/dist/src/common-auth-embedded/commands/pi.d.ts +23 -0
- package/dist/src/common-auth-embedded/commands/pi.js +206 -0
- package/dist/src/common-auth-embedded/commands/seam.d.ts +72 -0
- package/dist/src/common-auth-embedded/commands/seam.js +301 -0
- package/dist/src/common-auth-embedded/fs/atomic-write.d.ts +20 -0
- package/dist/src/common-auth-embedded/fs/atomic-write.js +80 -0
- package/dist/src/common-auth-embedded/fs/index.d.ts +7 -0
- package/dist/src/common-auth-embedded/fs/index.js +6 -0
- package/dist/src/common-auth-embedded/fs/lock-constants.d.ts +14 -0
- package/dist/src/common-auth-embedded/fs/lock-constants.js +14 -0
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +501 -0
- package/dist/src/common-auth-embedded/fs/with-lock.d.ts +33 -0
- package/dist/src/common-auth-embedded/fs/with-lock.js +48 -0
- package/dist/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
- package/dist/src/common-auth-embedded/logger/capture-sink.js +13 -0
- package/dist/src/common-auth-embedded/logger/engine.d.ts +100 -0
- package/dist/src/common-auth-embedded/logger/engine.js +246 -0
- package/dist/src/common-auth-embedded/logger/index.d.ts +6 -0
- package/dist/src/common-auth-embedded/logger/index.js +3 -0
- package/dist/src/common-auth-embedded/logger/redact.d.ts +11 -0
- package/dist/src/common-auth-embedded/logger/redact.js +83 -0
- package/dist/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
- package/dist/src/common-auth-embedded/opencode2/errors.js +15 -0
- package/dist/src/common-auth-embedded/opencode2/index.d.ts +8 -0
- package/dist/src/common-auth-embedded/opencode2/index.js +4 -0
- package/dist/src/common-auth-embedded/opencode2/install.d.ts +55 -0
- package/dist/src/common-auth-embedded/opencode2/install.js +886 -0
- package/dist/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
- package/dist/src/common-auth-embedded/opencode2/integration.js +143 -0
- package/dist/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
- package/dist/src/common-auth-embedded/opencode2/sse.js +60 -0
- package/dist/src/common-auth-embedded/opencode2/types.d.ts +413 -0
- package/dist/src/common-auth-embedded/pi-slot/index.d.ts +3 -0
- package/dist/src/common-auth-embedded/pi-slot/index.js +2 -0
- package/dist/src/common-auth-embedded/pi-slot/lock.js +212 -0
- package/dist/src/common-auth-embedded/pi-slot/slot.d.ts +49 -0
- package/dist/src/common-auth-embedded/pi-slot/slot.js +383 -0
- package/dist/src/common-auth-embedded/quota/codec.d.ts +11 -0
- package/dist/src/common-auth-embedded/quota/codec.js +12 -0
- package/dist/src/common-auth-embedded/quota/format.d.ts +46 -0
- package/dist/src/common-auth-embedded/quota/format.js +138 -0
- package/dist/src/common-auth-embedded/quota/index.d.ts +10 -0
- package/dist/src/common-auth-embedded/quota/index.js +5 -0
- package/dist/src/common-auth-embedded/quota/map.d.ts +63 -0
- package/dist/src/common-auth-embedded/quota/map.js +105 -0
- package/dist/src/common-auth-embedded/quota/merge.d.ts +48 -0
- package/dist/src/common-auth-embedded/quota/merge.js +162 -0
- package/dist/src/common-auth-embedded/quota/projection.d.ts +64 -0
- package/dist/src/common-auth-embedded/quota/projection.js +134 -0
- package/dist/src/common-auth-embedded/routing/admission.d.ts +93 -0
- package/dist/src/common-auth-embedded/routing/admission.js +142 -0
- package/dist/src/common-auth-embedded/routing/index.d.ts +8 -0
- package/dist/src/common-auth-embedded/routing/index.js +4 -0
- package/dist/src/common-auth-embedded/routing/ordered.d.ts +47 -0
- package/dist/src/common-auth-embedded/routing/ordered.js +58 -0
- package/dist/src/common-auth-embedded/routing/pins.d.ts +22 -0
- package/dist/src/common-auth-embedded/routing/pins.js +34 -0
- package/dist/src/common-auth-embedded/routing/sticky.d.ts +158 -0
- package/dist/src/common-auth-embedded/routing/sticky.js +339 -0
- package/dist/src/common-auth-embedded/rpc/client.d.ts +3 -0
- package/dist/src/common-auth-embedded/rpc/client.js +2 -0
- package/dist/src/common-auth-embedded/rpc/index.d.ts +10 -0
- package/dist/src/common-auth-embedded/rpc/index.js +5 -0
- package/dist/src/common-auth-embedded/rpc/notifications.d.ts +73 -0
- package/dist/src/common-auth-embedded/rpc/notifications.js +100 -0
- package/dist/src/common-auth-embedded/rpc/port-file.d.ts +33 -0
- package/dist/src/common-auth-embedded/rpc/port-file.js +217 -0
- package/dist/src/common-auth-embedded/rpc/rpc-client.d.ts +30 -0
- package/dist/src/common-auth-embedded/rpc/rpc-client.js +253 -0
- package/dist/src/common-auth-embedded/rpc/rpc-server.d.ts +58 -0
- package/dist/src/common-auth-embedded/rpc/rpc-server.js +311 -0
- package/dist/src/common-auth-embedded/rpc/server-registry.d.ts +11 -0
- package/dist/src/common-auth-embedded/rpc/server-registry.js +47 -0
- package/dist/src/common-auth-embedded/source-output.json +1326 -0
- package/dist/src/common-auth-embedded/store/attribution.d.ts +28 -0
- package/dist/src/common-auth-embedded/store/attribution.js +60 -0
- package/dist/src/common-auth-embedded/store/errors.d.ts +55 -0
- package/dist/src/common-auth-embedded/store/errors.js +38 -0
- package/dist/src/common-auth-embedded/store/hooks.d.ts +12 -0
- package/dist/src/common-auth-embedded/store/hooks.js +34 -0
- package/dist/src/common-auth-embedded/store/identity.d.ts +39 -0
- package/dist/src/common-auth-embedded/store/identity.js +79 -0
- package/dist/src/common-auth-embedded/store/index.d.ts +21 -0
- package/dist/src/common-auth-embedded/store/index.js +7 -0
- package/dist/src/common-auth-embedded/store/mutate.d.ts +189 -0
- package/dist/src/common-auth-embedded/store/mutate.js +500 -0
- package/dist/src/common-auth-embedded/store/pool.d.ts +196 -0
- package/dist/src/common-auth-embedded/store/pool.js +120 -0
- package/dist/src/common-auth-embedded/store/provider-state.d.ts +131 -0
- package/dist/src/common-auth-embedded/store/provider-state.js +226 -0
- package/dist/src/common-auth-embedded/store/publication.d.ts +47 -0
- package/dist/src/common-auth-embedded/store/publication.js +304 -0
- package/dist/src/common-auth-embedded/store/pull.d.ts +36 -0
- package/dist/src/common-auth-embedded/store/pull.js +143 -0
- package/dist/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
- package/dist/src/common-auth-embedded/store/refresh-lock.js +136 -0
- package/dist/src/common-auth-embedded/store/refresh.d.ts +72 -0
- package/dist/src/common-auth-embedded/store/refresh.js +225 -0
- package/dist/src/common-auth-embedded/store/reserved.js +13 -0
- package/dist/src/common-auth-embedded/store/rows.d.ts +313 -0
- package/dist/src/common-auth-embedded/store/rows.js +1258 -0
- package/dist/src/common-auth-embedded/store/runtime.d.ts +36 -0
- package/dist/src/common-auth-embedded/store/runtime.js +68 -0
- package/dist/src/common-auth-embedded/store/schema.d.ts +443 -0
- package/dist/src/common-auth-embedded/store/schema.js +754 -0
- package/dist/src/common-auth-embedded/store/settings.d.ts +63 -0
- package/dist/src/common-auth-embedded/store/settings.js +120 -0
- package/dist/src/common-auth-embedded/store/torn.d.ts +78 -0
- package/dist/src/common-auth-embedded/store/torn.js +294 -0
- package/dist/src/common-auth-embedded/tui/index.d.ts +8 -0
- package/dist/src/common-auth-embedded/tui/index.js +21 -0
- package/dist/src/common-auth-embedded/util/any-signal.js +42 -0
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +4 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/ga/proxy-guard.d.ts +120 -0
- package/dist/src/ga/proxy-guard.d.ts.map +1 -0
- package/dist/src/ga/proxy-guard.js +269 -0
- package/dist/src/ga/proxy-guard.js.map +1 -0
- package/dist/src/ga/rpc/protocol.d.ts +504 -0
- package/dist/src/ga/rpc/protocol.d.ts.map +1 -0
- package/dist/src/ga/rpc/protocol.js +1278 -0
- package/dist/src/ga/rpc/protocol.js.map +1 -0
- package/dist/src/ga/server/auth.d.ts +9 -0
- package/dist/src/ga/server/auth.d.ts.map +1 -0
- package/dist/src/ga/server/auth.js +37 -0
- package/dist/src/ga/server/auth.js.map +1 -0
- package/dist/src/ga/server/index.d.ts +576 -0
- package/dist/src/ga/server/index.d.ts.map +1 -0
- package/dist/src/ga/server/index.js +1012 -0
- package/dist/src/ga/server/index.js.map +1 -0
- package/dist/src/ga/tui/host-ga.d.ts +350 -0
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -0
- package/dist/src/ga/tui/host-ga.js +1242 -0
- package/dist/src/ga/tui/host-ga.js.map +1 -0
- package/dist/src/logging/provider-key-policy.d.ts +9 -0
- package/dist/src/logging/provider-key-policy.d.ts.map +1 -0
- package/dist/src/logging/provider-key-policy.js +11 -0
- package/dist/src/logging/provider-key-policy.js.map +1 -0
- package/dist/src/plugin/account-access.d.ts +130 -15
- package/dist/src/plugin/account-access.d.ts.map +1 -1
- package/dist/src/plugin/account-access.js +331 -129
- package/dist/src/plugin/account-access.js.map +1 -1
- package/dist/src/plugin/account-blocks.d.ts +102 -0
- package/dist/src/plugin/account-blocks.d.ts.map +1 -0
- package/dist/src/plugin/account-blocks.js +196 -0
- package/dist/src/plugin/account-blocks.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +85 -1
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +127 -3
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/auth-loader.d.ts +69 -5
- package/dist/src/plugin/auth-loader.d.ts.map +1 -1
- package/dist/src/plugin/auth-loader.js +355 -52
- package/dist/src/plugin/auth-loader.js.map +1 -1
- package/dist/src/plugin/background-quota-refresh.d.ts +54 -8
- package/dist/src/plugin/background-quota-refresh.d.ts.map +1 -1
- package/dist/src/plugin/background-quota-refresh.js +81 -24
- package/dist/src/plugin/background-quota-refresh.js.map +1 -1
- package/dist/src/plugin/cache/index.d.ts +1 -1
- package/dist/src/plugin/cache/index.d.ts.map +1 -1
- package/dist/src/plugin/cache/index.js +1 -1
- package/dist/src/plugin/cache/index.js.map +1 -1
- package/dist/src/plugin/cache/signature-cache.d.ts +55 -10
- package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
- package/dist/src/plugin/cache/signature-cache.js +100 -41
- package/dist/src/plugin/cache/signature-cache.js.map +1 -1
- package/dist/src/plugin/cache.d.ts +80 -16
- package/dist/src/plugin/cache.d.ts.map +1 -1
- package/dist/src/plugin/cache.js +339 -200
- package/dist/src/plugin/cache.js.map +1 -1
- package/dist/src/plugin/catalog.d.ts +4 -18
- package/dist/src/plugin/catalog.d.ts.map +1 -1
- package/dist/src/plugin/catalog.js +11 -41
- package/dist/src/plugin/catalog.js.map +1 -1
- package/dist/src/plugin/command-apply.d.ts +58 -0
- package/dist/src/plugin/command-apply.d.ts.map +1 -0
- package/dist/src/plugin/command-apply.js +168 -0
- package/dist/src/plugin/command-apply.js.map +1 -0
- package/dist/src/plugin/command-data.d.ts +1 -0
- package/dist/src/plugin/command-data.d.ts.map +1 -1
- package/dist/src/plugin/command-data.js +2 -0
- package/dist/src/plugin/command-data.js.map +1 -1
- package/dist/src/plugin/commands.d.ts +142 -132
- package/dist/src/plugin/commands.d.ts.map +1 -1
- package/dist/src/plugin/commands.js +214 -686
- package/dist/src/plugin/commands.js.map +1 -1
- package/dist/src/plugin/config/index.d.ts +1 -1
- package/dist/src/plugin/config/index.d.ts.map +1 -1
- package/dist/src/plugin/config/index.js +1 -1
- package/dist/src/plugin/config/index.js.map +1 -1
- package/dist/src/plugin/config/loader.d.ts +37 -1
- package/dist/src/plugin/config/loader.d.ts.map +1 -1
- package/dist/src/plugin/config/loader.js +64 -9
- package/dist/src/plugin/config/loader.js.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.d.ts +2 -2
- package/dist/src/plugin/config/schema.d.ts +2 -2
- package/dist/src/plugin/config/writer.d.ts +7 -0
- package/dist/src/plugin/config/writer.d.ts.map +1 -1
- package/dist/src/plugin/config/writer.js +10 -1
- package/dist/src/plugin/config/writer.js.map +1 -1
- package/dist/src/plugin/debug.d.ts +72 -29
- package/dist/src/plugin/debug.d.ts.map +1 -1
- package/dist/src/plugin/debug.js +353 -239
- package/dist/src/plugin/debug.js.map +1 -1
- package/dist/src/plugin/fetch/retry-state.d.ts +1 -1
- package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -1
- package/dist/src/plugin/fetch/retry-state.js.map +1 -1
- package/dist/src/plugin/fetch-interceptor.d.ts +66 -11
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -1
- package/dist/src/plugin/fetch-interceptor.js +228 -1352
- package/dist/src/plugin/fetch-interceptor.js.map +1 -1
- package/dist/src/plugin/fetch-routing.d.ts +7 -2
- package/dist/src/plugin/fetch-routing.d.ts.map +1 -1
- package/dist/src/plugin/fetch-routing.js +7 -4
- package/dist/src/plugin/fetch-routing.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts +389 -0
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -0
- package/dist/src/plugin/ga-location-services.js +1838 -0
- package/dist/src/plugin/ga-location-services.js.map +1 -0
- package/dist/src/plugin/gemini-dump.d.ts +37 -12
- package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/src/plugin/gemini-dump.js +42 -21
- package/dist/src/plugin/gemini-dump.js.map +1 -1
- package/dist/src/plugin/google-search-tool.d.ts +2 -1
- package/dist/src/plugin/google-search-tool.d.ts.map +1 -1
- package/dist/src/plugin/google-search-tool.js +4 -1
- package/dist/src/plugin/google-search-tool.js.map +1 -1
- package/dist/src/plugin/index.d.ts.map +1 -1
- package/dist/src/plugin/index.js +505 -141
- package/dist/src/plugin/index.js.map +1 -1
- package/dist/src/plugin/killswitch.d.ts +1 -2
- package/dist/src/plugin/killswitch.d.ts.map +1 -1
- package/dist/src/plugin/lifecycle.d.ts +24 -1
- package/dist/src/plugin/lifecycle.d.ts.map +1 -1
- package/dist/src/plugin/lifecycle.js +95 -8
- package/dist/src/plugin/lifecycle.js.map +1 -1
- package/dist/src/plugin/logger.d.ts +61 -10
- package/dist/src/plugin/logger.d.ts.map +1 -1
- package/dist/src/plugin/logger.js +134 -63
- package/dist/src/plugin/logger.js.map +1 -1
- package/dist/src/plugin/neutral-types.d.ts +42 -0
- package/dist/src/plugin/neutral-types.d.ts.map +1 -0
- package/dist/src/plugin/neutral-types.js +12 -0
- package/dist/src/plugin/neutral-types.js.map +1 -0
- package/dist/src/plugin/oauth-methods.d.ts +2 -1
- package/dist/src/plugin/oauth-methods.d.ts.map +1 -1
- package/dist/src/plugin/oauth-methods.js +173 -88
- package/dist/src/plugin/oauth-methods.js.map +1 -1
- package/dist/src/plugin/operator-settings.d.ts +34 -0
- package/dist/src/plugin/operator-settings.d.ts.map +1 -1
- package/dist/src/plugin/operator-settings.js +105 -2
- package/dist/src/plugin/operator-settings.js.map +1 -1
- package/dist/src/plugin/persist-account-pool.d.ts +63 -2
- package/dist/src/plugin/persist-account-pool.d.ts.map +1 -1
- package/dist/src/plugin/persist-account-pool.js +125 -2
- package/dist/src/plugin/persist-account-pool.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +335 -35
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +825 -95
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/refresh-queue.d.ts +35 -5
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
- package/dist/src/plugin/refresh-queue.js +50 -16
- package/dist/src/plugin/refresh-queue.js.map +1 -1
- package/dist/src/plugin/request-helpers.d.ts +30 -5
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +82 -17
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts +63 -15
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +229 -65
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/session-context.d.ts.map +1 -1
- package/dist/src/plugin/session-context.js +5 -2
- package/dist/src/plugin/session-context.js.map +1 -1
- package/dist/src/plugin/shared/local-grant.d.ts +26 -0
- package/dist/src/plugin/shared/local-grant.d.ts.map +1 -0
- package/dist/src/plugin/shared/local-grant.js +19 -0
- package/dist/src/plugin/shared/local-grant.js.map +1 -0
- package/dist/src/plugin/shared/request-cancellation.d.ts +12 -0
- package/dist/src/plugin/shared/request-cancellation.d.ts.map +1 -0
- package/dist/src/plugin/shared/request-cancellation.js +118 -0
- package/dist/src/plugin/shared/request-cancellation.js.map +1 -0
- package/dist/src/plugin/shared/request-services.d.ts +375 -0
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -0
- package/dist/src/plugin/shared/request-services.js +1752 -0
- package/dist/src/plugin/shared/request-services.js.map +1 -0
- package/dist/src/plugin/shared/runtime.d.ts +217 -0
- package/dist/src/plugin/shared/runtime.d.ts.map +1 -0
- package/dist/src/plugin/shared/runtime.js +345 -0
- package/dist/src/plugin/shared/runtime.js.map +1 -0
- package/dist/src/plugin/shared/source-sidebar.d.ts +15 -0
- package/dist/src/plugin/shared/source-sidebar.d.ts.map +1 -0
- package/dist/src/plugin/shared/source-sidebar.js +41 -0
- package/dist/src/plugin/shared/source-sidebar.js.map +1 -0
- package/dist/src/plugin/shared/vault-menu.d.ts +5 -0
- package/dist/src/plugin/shared/vault-menu.d.ts.map +1 -0
- package/dist/src/plugin/shared/vault-menu.js +49 -0
- package/dist/src/plugin/shared/vault-menu.js.map +1 -0
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +168 -0
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -0
- package/dist/src/plugin/shared/vault-request-credentials.js +485 -0
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -0
- package/dist/src/plugin/storage.d.ts +127 -1
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +188 -3
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/token.d.ts +23 -1
- package/dist/src/plugin/token.d.ts.map +1 -1
- package/dist/src/plugin/token.js +117 -58
- package/dist/src/plugin/token.js.map +1 -1
- package/dist/src/plugin/ui/quota-status.d.ts +1 -10
- package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
- package/dist/src/plugin/ui/quota-status.js +6 -42
- package/dist/src/plugin/ui/quota-status.js.map +1 -1
- package/dist/src/plugin/vault-activation.d.ts +11 -0
- package/dist/src/plugin/vault-activation.d.ts.map +1 -0
- package/dist/src/plugin/vault-activation.js +53 -0
- package/dist/src/plugin/vault-activation.js.map +1 -0
- package/dist/src/plugin/vault-custody.d.ts +131 -0
- package/dist/src/plugin/vault-custody.d.ts.map +1 -0
- package/dist/src/plugin/vault-custody.js +381 -0
- package/dist/src/plugin/vault-custody.js.map +1 -0
- package/dist/src/quota-presentation.d.ts +18 -0
- package/dist/src/quota-presentation.d.ts.map +1 -0
- package/dist/src/quota-presentation.js +58 -0
- package/dist/src/quota-presentation.js.map +1 -0
- package/dist/src/rpc/notifications.d.ts +2 -2
- package/dist/src/rpc/notifications.d.ts.map +1 -1
- package/dist/src/rpc/notifications.js +1 -1
- package/dist/src/rpc/notifications.js.map +1 -1
- package/dist/src/rpc/port-file.d.ts +2 -12
- package/dist/src/rpc/port-file.d.ts.map +1 -1
- package/dist/src/rpc/port-file.js +5 -107
- package/dist/src/rpc/port-file.js.map +1 -1
- package/dist/src/rpc/protocol.d.ts +47 -16
- package/dist/src/rpc/protocol.d.ts.map +1 -1
- package/dist/src/rpc/rpc-client.d.ts +27 -3
- package/dist/src/rpc/rpc-client.d.ts.map +1 -1
- package/dist/src/rpc/rpc-client.js +55 -45
- package/dist/src/rpc/rpc-client.js.map +1 -1
- package/dist/src/rpc/rpc-server.d.ts +13 -2
- package/dist/src/rpc/rpc-server.d.ts.map +1 -1
- package/dist/src/rpc/rpc-server.js +38 -212
- package/dist/src/rpc/rpc-server.js.map +1 -1
- package/dist/src/server.d.ts +30 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +29 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/sidebar-projection.d.ts +102 -0
- package/dist/src/sidebar-projection.d.ts.map +1 -0
- package/dist/src/sidebar-projection.js +146 -0
- package/dist/src/sidebar-projection.js.map +1 -0
- package/dist/src/sidebar-state.d.ts +13 -5
- package/dist/src/sidebar-state.d.ts.map +1 -1
- package/dist/src/sidebar-state.js +49 -16
- package/dist/src/sidebar-state.js.map +1 -1
- package/dist/src/tui/command-dialogs.d.ts +58 -52
- package/dist/src/tui/command-dialogs.d.ts.map +1 -1
- package/dist/src/tui/command-dialogs.js +379 -571
- package/dist/src/tui/command-dialogs.js.map +1 -1
- package/dist/src/tui/file-logger.d.ts +2 -3
- package/dist/src/tui/file-logger.d.ts.map +1 -1
- package/dist/src/tui/file-logger.js +21 -7
- package/dist/src/tui/file-logger.js.map +1 -1
- package/dist/src/tui/host-api.d.ts +196 -0
- package/dist/src/tui/host-api.d.ts.map +1 -0
- package/dist/src/tui/host-api.js +357 -0
- package/dist/src/tui/host-api.js.map +1 -0
- package/dist/src/tui/host-v1.d.ts +60 -0
- package/dist/src/tui/host-v1.d.ts.map +1 -0
- package/dist/src/tui/host-v1.js +147 -0
- package/dist/src/tui/host-v1.js.map +1 -0
- package/dist/src/tui/vault-setup.d.ts +98 -0
- package/dist/src/tui/vault-setup.d.ts.map +1 -0
- package/dist/src/tui/vault-setup.js +198 -0
- package/dist/src/tui/vault-setup.js.map +1 -0
- package/dist/src/tui.d.ts +4 -11
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +33 -75
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +380 -0
- package/dist/tui-ga-build-map.json +187 -0
- package/dist/types/src/antigravity/oauth.d.ts +2 -0
- package/dist/types/src/antigravity/oauth.d.ts.map +1 -0
- package/dist/types/src/cli.d.ts +66 -0
- package/dist/types/src/cli.d.ts.map +1 -0
- package/dist/types/src/common-auth-embedded/commands/builtins.d.ts +71 -0
- package/dist/types/src/common-auth-embedded/commands/index.d.ts +10 -0
- package/dist/types/src/common-auth-embedded/commands/menu.d.ts +61 -0
- package/dist/types/src/common-auth-embedded/commands/model.d.ts +238 -0
- package/dist/types/src/common-auth-embedded/commands/pi.d.ts +23 -0
- package/dist/types/src/common-auth-embedded/commands/seam.d.ts +72 -0
- package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
- package/dist/types/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
- package/dist/types/src/common-auth-embedded/logger/engine.d.ts +100 -0
- package/dist/types/src/common-auth-embedded/logger/index.d.ts +6 -0
- package/dist/types/src/common-auth-embedded/logger/redact.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/quota/codec.d.ts +11 -0
- package/dist/types/src/common-auth-embedded/quota/format.d.ts +46 -0
- package/dist/types/src/common-auth-embedded/quota/index.d.ts +10 -0
- package/dist/types/src/common-auth-embedded/quota/map.d.ts +63 -0
- package/dist/types/src/common-auth-embedded/quota/merge.d.ts +48 -0
- package/dist/types/src/common-auth-embedded/quota/projection.d.ts +64 -0
- package/dist/types/src/common-auth-embedded/store/attribution.d.ts +28 -0
- package/dist/types/src/common-auth-embedded/store/errors.d.ts +55 -0
- package/dist/types/src/common-auth-embedded/store/hooks.d.ts +12 -0
- package/dist/types/src/common-auth-embedded/store/identity.d.ts +39 -0
- package/dist/types/src/common-auth-embedded/store/index.d.ts +21 -0
- package/dist/types/src/common-auth-embedded/store/mutate.d.ts +189 -0
- package/dist/types/src/common-auth-embedded/store/pool.d.ts +196 -0
- package/dist/types/src/common-auth-embedded/store/provider-state.d.ts +131 -0
- package/dist/types/src/common-auth-embedded/store/publication.d.ts +47 -0
- package/dist/types/src/common-auth-embedded/store/pull.d.ts +36 -0
- package/dist/types/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
- package/dist/types/src/common-auth-embedded/store/refresh.d.ts +72 -0
- package/dist/types/src/common-auth-embedded/store/rows.d.ts +313 -0
- package/dist/types/src/common-auth-embedded/store/runtime.d.ts +36 -0
- package/dist/types/src/common-auth-embedded/store/schema.d.ts +443 -0
- package/dist/types/src/common-auth-embedded/store/settings.d.ts +63 -0
- package/dist/types/src/common-auth-embedded/store/torn.d.ts +78 -0
- package/dist/types/src/constants.d.ts +3 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/ga/proxy-guard.d.ts +120 -0
- package/dist/types/src/ga/proxy-guard.d.ts.map +1 -0
- package/dist/types/src/ga/rpc/protocol.d.ts +504 -0
- package/dist/types/src/ga/rpc/protocol.d.ts.map +1 -0
- package/dist/types/src/ga/server/auth.d.ts +9 -0
- package/dist/types/src/ga/server/auth.d.ts.map +1 -0
- package/dist/types/src/ga/server/index.d.ts +576 -0
- package/dist/types/src/ga/server/index.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/cache.d.ts +3 -0
- package/dist/types/src/hooks/auto-update-checker/cache.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/checker.d.ts +16 -0
- package/dist/types/src/hooks/auto-update-checker/checker.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/constants.d.ts +9 -0
- package/dist/types/src/hooks/auto-update-checker/constants.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/index.d.ts +34 -0
- package/dist/types/src/hooks/auto-update-checker/index.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/logging.d.ts +3 -0
- package/dist/types/src/hooks/auto-update-checker/logging.d.ts.map +1 -0
- package/dist/types/src/hooks/auto-update-checker/types.d.ts +25 -0
- package/dist/types/src/hooks/auto-update-checker/types.d.ts.map +1 -0
- package/dist/types/src/logging/provider-key-policy.d.ts +9 -0
- package/dist/types/src/logging/provider-key-policy.d.ts.map +1 -0
- package/dist/types/src/plugin/account-access.d.ts +214 -0
- package/dist/types/src/plugin/account-access.d.ts.map +1 -0
- package/dist/types/src/plugin/account-blocks.d.ts +102 -0
- package/dist/types/src/plugin/account-blocks.d.ts.map +1 -0
- package/dist/types/src/plugin/account-command-oauth.d.ts +34 -0
- package/dist/types/src/plugin/account-command-oauth.d.ts.map +1 -0
- package/dist/types/src/plugin/accounts.d.ts +94 -0
- package/dist/types/src/plugin/accounts.d.ts.map +1 -0
- package/dist/types/src/plugin/agy-request-metadata.d.ts +2 -0
- package/dist/types/src/plugin/agy-request-metadata.d.ts.map +1 -0
- package/dist/types/src/plugin/agy-transport.d.ts +2 -0
- package/dist/types/src/plugin/agy-transport.d.ts.map +1 -0
- package/dist/types/src/plugin/auth-doctor.d.ts +30 -0
- package/dist/types/src/plugin/auth-doctor.d.ts.map +1 -0
- package/dist/types/src/plugin/auth-drift.d.ts +13 -0
- package/dist/types/src/plugin/auth-drift.d.ts.map +1 -0
- package/dist/types/src/plugin/auth-loader.d.ts +114 -0
- package/dist/types/src/plugin/auth-loader.d.ts.map +1 -0
- package/dist/types/src/plugin/auth.d.ts +2 -0
- package/dist/types/src/plugin/auth.d.ts.map +1 -0
- package/dist/types/src/plugin/background-quota-refresh.d.ts +192 -0
- package/dist/types/src/plugin/background-quota-refresh.d.ts.map +1 -0
- package/dist/types/src/plugin/cache/signature-cache.d.ts +156 -0
- package/dist/types/src/plugin/cache/signature-cache.d.ts.map +1 -0
- package/dist/types/src/plugin/cache.d.ts +109 -0
- package/dist/types/src/plugin/cache.d.ts.map +1 -0
- package/dist/types/src/plugin/catalog.d.ts +9 -0
- package/dist/types/src/plugin/catalog.d.ts.map +1 -0
- package/dist/types/src/plugin/cli.d.ts +44 -0
- package/dist/types/src/plugin/cli.d.ts.map +1 -0
- package/dist/types/src/plugin/command-apply.d.ts +58 -0
- package/dist/types/src/plugin/command-apply.d.ts.map +1 -0
- package/dist/types/src/plugin/command-data.d.ts +330 -0
- package/dist/types/src/plugin/command-data.d.ts.map +1 -0
- package/dist/types/src/plugin/commands.d.ts +164 -0
- package/dist/types/src/plugin/commands.d.ts.map +1 -0
- package/dist/types/src/plugin/config/index.d.ts +16 -0
- package/dist/types/src/plugin/config/index.d.ts.map +1 -0
- package/dist/types/src/plugin/config/loader.d.ts +72 -0
- package/dist/types/src/plugin/config/loader.d.ts.map +1 -0
- package/dist/types/src/plugin/config/models.d.ts +3 -0
- package/dist/types/src/plugin/config/models.d.ts.map +1 -0
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts +29 -0
- package/dist/types/src/plugin/config/operator-settings-schema.d.ts.map +1 -0
- package/dist/types/src/plugin/config/schema.d.ts +162 -0
- package/dist/types/src/plugin/config/schema.d.ts.map +1 -0
- package/dist/types/src/plugin/config/updater.d.ts +55 -0
- package/dist/types/src/plugin/config/updater.d.ts.map +1 -0
- package/dist/types/src/plugin/config/writer.d.ts +41 -0
- package/dist/types/src/plugin/config/writer.d.ts.map +1 -0
- package/dist/types/src/plugin/core/streaming/index.d.ts +3 -0
- package/dist/types/src/plugin/core/streaming/index.d.ts.map +1 -0
- package/dist/types/src/plugin/core/streaming/transformer.d.ts +12 -0
- package/dist/types/src/plugin/core/streaming/transformer.d.ts.map +1 -0
- package/dist/types/src/plugin/core/streaming/types.d.ts +34 -0
- package/dist/types/src/plugin/core/streaming/types.d.ts.map +1 -0
- package/dist/types/src/plugin/debug.d.ts +144 -0
- package/dist/types/src/plugin/debug.d.ts.map +1 -0
- package/dist/types/src/plugin/dependencies.d.ts +129 -0
- package/dist/types/src/plugin/dependencies.d.ts.map +1 -0
- package/dist/types/src/plugin/errors.d.ts +55 -0
- package/dist/types/src/plugin/errors.d.ts.map +1 -0
- package/dist/types/src/plugin/event-handler.d.ts +53 -0
- package/dist/types/src/plugin/event-handler.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch/retry-state.d.ts +61 -0
- package/dist/types/src/plugin/fetch/retry-state.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch/warmup.d.ts +30 -0
- package/dist/types/src/plugin/fetch/warmup.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch-interceptor.d.ts +114 -0
- package/dist/types/src/plugin/fetch-interceptor.d.ts.map +1 -0
- package/dist/types/src/plugin/fetch-routing.d.ts +31 -0
- package/dist/types/src/plugin/fetch-routing.d.ts.map +1 -0
- package/dist/types/src/plugin/fingerprint.d.ts +2 -0
- package/dist/types/src/plugin/fingerprint.d.ts.map +1 -0
- package/dist/types/src/plugin/ga-location-services.d.ts +389 -0
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -0
- package/dist/types/src/plugin/gemini-dump.d.ts +72 -0
- package/dist/types/src/plugin/gemini-dump.d.ts.map +1 -0
- package/dist/types/src/plugin/google-search-tool.d.ts +10 -0
- package/dist/types/src/plugin/google-search-tool.d.ts.map +1 -0
- package/dist/types/src/plugin/image-saver.d.ts +6 -0
- package/dist/types/src/plugin/image-saver.d.ts.map +1 -0
- package/dist/types/src/plugin/index.d.ts +30 -0
- package/dist/types/src/plugin/index.d.ts.map +1 -0
- package/dist/types/src/plugin/killswitch.d.ts +93 -0
- package/dist/types/src/plugin/killswitch.d.ts.map +1 -0
- package/dist/types/src/plugin/lifecycle.d.ts +63 -0
- package/dist/types/src/plugin/lifecycle.d.ts.map +1 -0
- package/dist/types/src/plugin/logger.d.ts +83 -0
- package/dist/types/src/plugin/logger.d.ts.map +1 -0
- package/dist/types/src/plugin/logging-utils.d.ts +57 -0
- package/dist/types/src/plugin/logging-utils.d.ts.map +1 -0
- package/dist/types/src/plugin/model-registry.d.ts +2 -0
- package/dist/types/src/plugin/model-registry.d.ts.map +1 -0
- package/dist/types/src/plugin/neutral-types.d.ts +42 -0
- package/dist/types/src/plugin/neutral-types.d.ts.map +1 -0
- package/dist/types/src/plugin/oauth-login.d.ts +22 -0
- package/dist/types/src/plugin/oauth-login.d.ts.map +1 -0
- package/dist/types/src/plugin/oauth-methods.d.ts +43 -0
- package/dist/types/src/plugin/oauth-methods.d.ts.map +1 -0
- package/dist/types/src/plugin/operator-settings.d.ts +74 -0
- package/dist/types/src/plugin/operator-settings.d.ts.map +1 -0
- package/dist/types/src/plugin/persist-account-pool.d.ts +98 -0
- package/dist/types/src/plugin/persist-account-pool.d.ts.map +1 -0
- package/dist/types/src/plugin/project.d.ts +2 -0
- package/dist/types/src/plugin/project.d.ts.map +1 -0
- package/dist/types/src/plugin/prompt-context.d.ts +18 -0
- package/dist/types/src/plugin/prompt-context.d.ts.map +1 -0
- package/dist/types/src/plugin/quota.d.ts +441 -0
- package/dist/types/src/plugin/quota.d.ts.map +1 -0
- package/dist/types/src/plugin/recovery/constants.d.ts +22 -0
- package/dist/types/src/plugin/recovery/constants.d.ts.map +1 -0
- package/dist/types/src/plugin/recovery/storage.d.ts +24 -0
- package/dist/types/src/plugin/recovery/storage.d.ts.map +1 -0
- package/dist/types/src/plugin/recovery/types.d.ts +116 -0
- package/dist/types/src/plugin/recovery/types.d.ts.map +1 -0
- package/dist/types/src/plugin/recovery.d.ts +61 -0
- package/dist/types/src/plugin/recovery.d.ts.map +1 -0
- package/dist/types/src/plugin/refresh-queue.d.ts +133 -0
- package/dist/types/src/plugin/refresh-queue.d.ts.map +1 -0
- package/dist/types/src/plugin/request-helpers.d.ts +304 -0
- package/dist/types/src/plugin/request-helpers.d.ts.map +1 -0
- package/dist/types/src/plugin/request.d.ts +161 -0
- package/dist/types/src/plugin/request.d.ts.map +1 -0
- package/dist/types/src/plugin/rotation.d.ts +2 -0
- package/dist/types/src/plugin/rotation.d.ts.map +1 -0
- package/dist/types/src/plugin/search.d.ts +25 -0
- package/dist/types/src/plugin/search.d.ts.map +1 -0
- package/dist/types/src/plugin/server.d.ts +23 -0
- package/dist/types/src/plugin/server.d.ts.map +1 -0
- package/dist/types/src/plugin/session-context.d.ts +22 -0
- package/dist/types/src/plugin/session-context.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/local-grant.d.ts +26 -0
- package/dist/types/src/plugin/shared/local-grant.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-cancellation.d.ts +12 -0
- package/dist/types/src/plugin/shared/request-cancellation.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/request-services.d.ts +375 -0
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/runtime.d.ts +217 -0
- package/dist/types/src/plugin/shared/runtime.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/source-sidebar.d.ts +15 -0
- package/dist/types/src/plugin/shared/source-sidebar.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/vault-menu.d.ts +5 -0
- package/dist/types/src/plugin/shared/vault-menu.d.ts.map +1 -0
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +168 -0
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -0
- package/dist/types/src/plugin/storage.d.ts +221 -0
- package/dist/types/src/plugin/storage.d.ts.map +1 -0
- package/dist/types/src/plugin/stores/signature-store.d.ts +5 -0
- package/dist/types/src/plugin/stores/signature-store.d.ts.map +1 -0
- package/dist/types/src/plugin/thinking-recovery.d.ts +90 -0
- package/dist/types/src/plugin/thinking-recovery.d.ts.map +1 -0
- package/dist/types/src/plugin/token.d.ts +41 -0
- package/dist/types/src/plugin/token.d.ts.map +1 -0
- package/dist/types/src/plugin/transform/cross-model-sanitizer.d.ts +2 -0
- package/dist/types/src/plugin/transform/cross-model-sanitizer.d.ts.map +1 -0
- package/dist/types/src/plugin/transform/index.d.ts +2 -0
- package/dist/types/src/plugin/transform/index.d.ts.map +1 -0
- package/dist/types/src/plugin/transform/model-resolver.d.ts +2 -0
- package/dist/types/src/plugin/transform/model-resolver.d.ts.map +1 -0
- package/dist/types/src/plugin/transform/types.d.ts +2 -0
- package/dist/types/src/plugin/transform/types.d.ts.map +1 -0
- package/dist/types/src/plugin/types.d.ts +36 -0
- package/dist/types/src/plugin/types.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/ansi.d.ts +32 -0
- package/dist/types/src/plugin/ui/ansi.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/auth-menu.d.ts +59 -0
- package/dist/types/src/plugin/ui/auth-menu.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/confirm.d.ts +2 -0
- package/dist/types/src/plugin/ui/confirm.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/quota-status.d.ts +73 -0
- package/dist/types/src/plugin/ui/quota-status.d.ts.map +1 -0
- package/dist/types/src/plugin/ui/select.d.ts +23 -0
- package/dist/types/src/plugin/ui/select.d.ts.map +1 -0
- package/dist/types/src/plugin/vault-activation.d.ts +11 -0
- package/dist/types/src/plugin/vault-activation.d.ts.map +1 -0
- package/dist/types/src/plugin/vault-custody.d.ts +131 -0
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -0
- package/dist/types/src/plugin/version.d.ts +2 -0
- package/dist/types/src/plugin/version.d.ts.map +1 -0
- package/dist/types/src/quota-presentation.d.ts +18 -0
- package/dist/types/src/quota-presentation.d.ts.map +1 -0
- package/dist/types/src/rpc/notifications.d.ts +6 -0
- package/dist/types/src/rpc/notifications.d.ts.map +1 -0
- package/dist/types/src/rpc/protocol.d.ts +53 -0
- package/dist/types/src/rpc/protocol.d.ts.map +1 -0
- package/dist/types/src/rpc/rpc-dir.d.ts +4 -0
- package/dist/types/src/rpc/rpc-dir.d.ts.map +1 -0
- package/dist/types/src/rpc/rpc-server.d.ts +24 -0
- package/dist/types/src/rpc/rpc-server.d.ts.map +1 -0
- package/dist/types/src/server.d.ts +30 -0
- package/dist/types/src/server.d.ts.map +1 -0
- package/dist/types/src/sidebar-state.d.ts +365 -0
- package/dist/types/src/sidebar-state.d.ts.map +1 -0
- package/dist/types/src/tui/host-api.d.ts +196 -0
- package/dist/types/src/tui/host-api.d.ts.map +1 -0
- package/package.json +46 -19
- package/server.js +6 -0
- package/src/common-auth-embedded/NOTICE.txt +21 -0
- package/src/common-auth-embedded/auth-menu/accounts.d.ts +97 -0
- package/src/common-auth-embedded/auth-menu/accounts.js +387 -0
- package/src/common-auth-embedded/auth-menu/ansi.d.ts +26 -0
- package/src/common-auth-embedded/auth-menu/ansi.js +98 -0
- package/src/common-auth-embedded/auth-menu/confirm.d.ts +7 -0
- package/src/common-auth-embedded/auth-menu/confirm.js +21 -0
- package/src/common-auth-embedded/auth-menu/doctor.d.ts +52 -0
- package/src/common-auth-embedded/auth-menu/doctor.js +81 -0
- package/src/common-auth-embedded/auth-menu/index.d.ts +17 -0
- package/src/common-auth-embedded/auth-menu/index.js +12 -0
- package/src/common-auth-embedded/auth-menu/login.d.ts +55 -0
- package/src/common-auth-embedded/auth-menu/login.js +83 -0
- package/src/common-auth-embedded/auth-menu/menu.d.ts +59 -0
- package/src/common-auth-embedded/auth-menu/menu.js +73 -0
- package/src/common-auth-embedded/auth-menu/opencode-v1.d.ts +49 -0
- package/src/common-auth-embedded/auth-menu/opencode-v1.js +47 -0
- package/src/common-auth-embedded/auth-menu/select.d.ts +21 -0
- package/src/common-auth-embedded/auth-menu/select.js +159 -0
- package/src/common-auth-embedded/auth-menu/terminal.d.ts +43 -0
- package/src/common-auth-embedded/auth-menu/terminal.js +19 -0
- package/src/common-auth-embedded/claustrum/consumer.d.ts +102 -0
- package/src/common-auth-embedded/claustrum/consumer.js +298 -0
- package/src/common-auth-embedded/claustrum/custody.d.ts +175 -0
- package/src/common-auth-embedded/claustrum/custody.js +354 -0
- package/src/common-auth-embedded/claustrum/enrollment.d.ts +158 -0
- package/src/common-auth-embedded/claustrum/enrollment.js +759 -0
- package/src/common-auth-embedded/claustrum/errors.d.ts +16 -0
- package/src/common-auth-embedded/claustrum/errors.js +8 -0
- package/src/common-auth-embedded/claustrum/host-slot.d.ts +39 -0
- package/src/common-auth-embedded/claustrum/host-slot.js +72 -0
- package/src/common-auth-embedded/claustrum/index.d.ts +18 -0
- package/src/common-auth-embedded/claustrum/index.js +22 -0
- package/src/common-auth-embedded/claustrum/interlock.d.ts +27 -0
- package/src/common-auth-embedded/claustrum/interlock.js +29 -0
- package/src/common-auth-embedded/claustrum/roster.d.ts +208 -0
- package/src/common-auth-embedded/claustrum/roster.js +536 -0
- package/src/common-auth-embedded/commands/builtins.d.ts +71 -0
- package/src/common-auth-embedded/commands/builtins.js +534 -0
- package/src/common-auth-embedded/commands/index.d.ts +10 -0
- package/src/common-auth-embedded/commands/index.js +5 -0
- package/src/common-auth-embedded/commands/menu.d.ts +61 -0
- package/src/common-auth-embedded/commands/menu.js +300 -0
- package/src/common-auth-embedded/commands/model.d.ts +238 -0
- package/src/common-auth-embedded/commands/model.js +16 -0
- package/src/common-auth-embedded/commands/pi.d.ts +23 -0
- package/src/common-auth-embedded/commands/pi.js +206 -0
- package/src/common-auth-embedded/commands/seam.d.ts +72 -0
- package/src/common-auth-embedded/commands/seam.js +301 -0
- package/src/common-auth-embedded/fs/atomic-write.d.ts +20 -0
- package/src/common-auth-embedded/fs/atomic-write.js +80 -0
- package/src/common-auth-embedded/fs/index.d.ts +7 -0
- package/src/common-auth-embedded/fs/index.js +6 -0
- package/src/common-auth-embedded/fs/lock-constants.d.ts +14 -0
- package/src/common-auth-embedded/fs/lock-constants.js +14 -0
- package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +33 -0
- package/src/common-auth-embedded/fs/refresh-file-lock.js +501 -0
- package/src/common-auth-embedded/fs/with-lock.d.ts +33 -0
- package/src/common-auth-embedded/fs/with-lock.js +48 -0
- package/src/common-auth-embedded/logger/capture-sink.d.ts +14 -0
- package/src/common-auth-embedded/logger/capture-sink.js +13 -0
- package/src/common-auth-embedded/logger/engine.d.ts +100 -0
- package/src/common-auth-embedded/logger/engine.js +246 -0
- package/src/common-auth-embedded/logger/index.d.ts +6 -0
- package/src/common-auth-embedded/logger/index.js +3 -0
- package/src/common-auth-embedded/logger/redact.d.ts +11 -0
- package/src/common-auth-embedded/logger/redact.js +83 -0
- package/src/common-auth-embedded/opencode2/errors.d.ts +25 -0
- package/src/common-auth-embedded/opencode2/errors.js +15 -0
- package/src/common-auth-embedded/opencode2/index.d.ts +8 -0
- package/src/common-auth-embedded/opencode2/index.js +4 -0
- package/src/common-auth-embedded/opencode2/install.d.ts +55 -0
- package/src/common-auth-embedded/opencode2/install.js +886 -0
- package/src/common-auth-embedded/opencode2/integration.d.ts +112 -0
- package/src/common-auth-embedded/opencode2/integration.js +143 -0
- package/src/common-auth-embedded/opencode2/sse.d.ts +12 -0
- package/src/common-auth-embedded/opencode2/sse.js +60 -0
- package/src/common-auth-embedded/opencode2/types.d.ts +413 -0
- package/src/common-auth-embedded/pi-slot/index.d.ts +3 -0
- package/src/common-auth-embedded/pi-slot/index.js +2 -0
- package/src/common-auth-embedded/pi-slot/lock.js +212 -0
- package/src/common-auth-embedded/pi-slot/slot.d.ts +49 -0
- package/src/common-auth-embedded/pi-slot/slot.js +383 -0
- package/src/common-auth-embedded/quota/codec.d.ts +11 -0
- package/src/common-auth-embedded/quota/codec.js +12 -0
- package/src/common-auth-embedded/quota/format.d.ts +46 -0
- package/src/common-auth-embedded/quota/format.js +138 -0
- package/src/common-auth-embedded/quota/index.d.ts +10 -0
- package/src/common-auth-embedded/quota/index.js +5 -0
- package/src/common-auth-embedded/quota/map.d.ts +63 -0
- package/src/common-auth-embedded/quota/map.js +105 -0
- package/src/common-auth-embedded/quota/merge.d.ts +48 -0
- package/src/common-auth-embedded/quota/merge.js +162 -0
- package/src/common-auth-embedded/quota/projection.d.ts +64 -0
- package/src/common-auth-embedded/quota/projection.js +134 -0
- package/src/common-auth-embedded/routing/admission.d.ts +93 -0
- package/src/common-auth-embedded/routing/admission.js +142 -0
- package/src/common-auth-embedded/routing/index.d.ts +8 -0
- package/src/common-auth-embedded/routing/index.js +4 -0
- package/src/common-auth-embedded/routing/ordered.d.ts +47 -0
- package/src/common-auth-embedded/routing/ordered.js +58 -0
- package/src/common-auth-embedded/routing/pins.d.ts +22 -0
- package/src/common-auth-embedded/routing/pins.js +34 -0
- package/src/common-auth-embedded/routing/sticky.d.ts +158 -0
- package/src/common-auth-embedded/routing/sticky.js +339 -0
- package/src/common-auth-embedded/rpc/client.d.ts +3 -0
- package/src/common-auth-embedded/rpc/client.js +2 -0
- package/src/common-auth-embedded/rpc/index.d.ts +10 -0
- package/src/common-auth-embedded/rpc/index.js +5 -0
- package/src/common-auth-embedded/rpc/notifications.d.ts +73 -0
- package/src/common-auth-embedded/rpc/notifications.js +100 -0
- package/src/common-auth-embedded/rpc/port-file.d.ts +33 -0
- package/src/common-auth-embedded/rpc/port-file.js +217 -0
- package/src/common-auth-embedded/rpc/rpc-client.d.ts +30 -0
- package/src/common-auth-embedded/rpc/rpc-client.js +253 -0
- package/src/common-auth-embedded/rpc/rpc-server.d.ts +58 -0
- package/src/common-auth-embedded/rpc/rpc-server.js +311 -0
- package/src/common-auth-embedded/rpc/server-registry.d.ts +11 -0
- package/src/common-auth-embedded/rpc/server-registry.js +47 -0
- package/src/common-auth-embedded/source-output.json +1326 -0
- package/src/common-auth-embedded/store/attribution.d.ts +28 -0
- package/src/common-auth-embedded/store/attribution.js +60 -0
- package/src/common-auth-embedded/store/errors.d.ts +55 -0
- package/src/common-auth-embedded/store/errors.js +38 -0
- package/src/common-auth-embedded/store/hooks.d.ts +12 -0
- package/src/common-auth-embedded/store/hooks.js +34 -0
- package/src/common-auth-embedded/store/identity.d.ts +39 -0
- package/src/common-auth-embedded/store/identity.js +79 -0
- package/src/common-auth-embedded/store/index.d.ts +21 -0
- package/src/common-auth-embedded/store/index.js +7 -0
- package/src/common-auth-embedded/store/mutate.d.ts +189 -0
- package/src/common-auth-embedded/store/mutate.js +500 -0
- package/src/common-auth-embedded/store/pool.d.ts +196 -0
- package/src/common-auth-embedded/store/pool.js +120 -0
- package/src/common-auth-embedded/store/provider-state.d.ts +131 -0
- package/src/common-auth-embedded/store/provider-state.js +226 -0
- package/src/common-auth-embedded/store/publication.d.ts +47 -0
- package/src/common-auth-embedded/store/publication.js +304 -0
- package/src/common-auth-embedded/store/pull.d.ts +36 -0
- package/src/common-auth-embedded/store/pull.js +143 -0
- package/src/common-auth-embedded/store/refresh-lock.d.ts +63 -0
- package/src/common-auth-embedded/store/refresh-lock.js +136 -0
- package/src/common-auth-embedded/store/refresh.d.ts +72 -0
- package/src/common-auth-embedded/store/refresh.js +225 -0
- package/src/common-auth-embedded/store/reserved.js +13 -0
- package/src/common-auth-embedded/store/rows.d.ts +313 -0
- package/src/common-auth-embedded/store/rows.js +1258 -0
- package/src/common-auth-embedded/store/runtime.d.ts +36 -0
- package/src/common-auth-embedded/store/runtime.js +68 -0
- package/src/common-auth-embedded/store/schema.d.ts +443 -0
- package/src/common-auth-embedded/store/schema.js +754 -0
- package/src/common-auth-embedded/store/settings.d.ts +63 -0
- package/src/common-auth-embedded/store/settings.js +120 -0
- package/src/common-auth-embedded/store/torn.d.ts +78 -0
- package/src/common-auth-embedded/store/torn.js +294 -0
- package/src/common-auth-embedded/tui/index.d.ts +8 -0
- package/src/common-auth-embedded/tui/index.js +21 -0
- package/src/common-auth-embedded/util/any-signal.js +42 -0
- package/src/plugin/command-data.ts +3 -0
- package/src/rpc/port-file.ts +6 -140
- package/src/rpc/protocol.ts +59 -24
- package/src/rpc/rpc-client.ts +101 -71
- package/src/sidebar-state.ts +82 -24
- package/src/tui/command-dialogs.tsx +412 -776
- package/src/tui/entry.d.mts +17 -0
- package/src/tui/entry.mjs +34 -66
- package/src/tui/file-logger.ts +22 -7
- package/src/tui-compiled/common-auth-embedded/logger/capture-sink.js +13 -0
- package/src/tui-compiled/common-auth-embedded/logger/engine.js +246 -0
- package/src/tui-compiled/common-auth-embedded/logger/index.js +3 -0
- package/src/tui-compiled/common-auth-embedded/logger/redact.js +83 -0
- package/src/tui-compiled/common-auth-embedded/quota/codec.js +12 -0
- package/src/tui-compiled/common-auth-embedded/quota/format.js +138 -0
- package/src/tui-compiled/common-auth-embedded/quota/index.js +5 -0
- package/src/tui-compiled/common-auth-embedded/quota/map.js +105 -0
- package/src/tui-compiled/common-auth-embedded/quota/merge.js +162 -0
- package/src/tui-compiled/common-auth-embedded/quota/projection.js +134 -0
- package/src/tui-compiled/common-auth-embedded/rpc/client.js +2 -0
- package/src/tui-compiled/common-auth-embedded/rpc/port-file.js +217 -0
- package/src/tui-compiled/common-auth-embedded/rpc/rpc-client.js +253 -0
- package/src/tui-compiled/logging/provider-key-policy.js +3 -0
- package/src/tui-compiled/quota-presentation.js +42 -0
- package/src/tui-compiled/rpc/rpc-client.js +35 -0
- package/src/tui-compiled/rpc/rpc-dir.js +13 -0
- package/src/tui-compiled/selector.js +21 -0
- package/src/tui-compiled/sidebar-state.js +401 -0
- package/src/tui-compiled/tui/command-dialogs.js +424 -0
- package/src/tui-compiled/tui/file-logger.js +73 -0
- package/src/tui-compiled/tui/host-api.js +269 -0
- package/src/tui-compiled/tui/host-v1.js +228 -0
- package/src/tui-compiled/tui-preferences.js +230 -0
- package/src/tui-compiled/{tui.tsx → tui.js} +140 -231
- package/src/tui-ga-compiled/host-ga.js +1304 -0
- package/src/tui-ga-compiled/selector.js +21 -0
- package/src/tui-ga-compiled/shared/07365a7d2ccade4c-host-api.js +269 -0
- package/src/tui-ga-compiled/shared/0e19a88ff3535906-command-dialogs.js +424 -0
- package/src/tui-ga-compiled/shared/1ff34afa7c42d196-projection.js +134 -0
- package/src/tui-ga-compiled/shared/77138df80c7ae006-map.js +105 -0
- package/src/tui-ga-compiled/shared/8ae1927e5910ea81-sidebar-projection.js +112 -0
- package/src/tui-ga-compiled/shared/98cc0c186c46c42d-quota-presentation.js +42 -0
- package/src/tui-ga-compiled/shared/aef2402f8fc342f0-format.js +138 -0
- package/src/tui-ga-compiled/shared/bf17cbee28e58197-index.js +5 -0
- package/src/tui-ga-compiled/shared/ca21dc417b36dc5d-codec.js +12 -0
- package/src/tui-ga-compiled/shared/ecc214300932dfb6-merge.js +162 -0
- package/src/tui-ga-raw/host-ga.tsx +1740 -0
- package/src/tui-ga-raw/selector.js +21 -0
- package/src/tui-ga-raw/shared/07365a7d2ccade4c-host-api.js +269 -0
- package/src/tui-ga-raw/shared/0e19a88ff3535906-command-dialogs.tsx +468 -0
- package/src/tui-ga-raw/shared/1ff34afa7c42d196-projection.js +134 -0
- package/src/tui-ga-raw/shared/77138df80c7ae006-map.js +105 -0
- package/src/tui-ga-raw/shared/8ae1927e5910ea81-sidebar-projection.js +112 -0
- package/src/tui-ga-raw/shared/98cc0c186c46c42d-quota-presentation.js +42 -0
- package/src/tui-ga-raw/shared/aef2402f8fc342f0-format.js +138 -0
- package/src/tui-ga-raw/shared/bf17cbee28e58197-index.js +5 -0
- package/src/tui-ga-raw/shared/ca21dc417b36dc5d-codec.js +12 -0
- package/src/tui-ga-raw/shared/ecc214300932dfb6-merge.js +162 -0
- package/src/tui-raw/common-auth-embedded/logger/capture-sink.js +13 -0
- package/src/tui-raw/common-auth-embedded/logger/engine.js +246 -0
- package/src/tui-raw/common-auth-embedded/logger/index.js +3 -0
- package/src/tui-raw/common-auth-embedded/logger/redact.js +83 -0
- package/src/tui-raw/common-auth-embedded/quota/codec.js +12 -0
- package/src/tui-raw/common-auth-embedded/quota/format.js +138 -0
- package/src/tui-raw/common-auth-embedded/quota/index.js +5 -0
- package/src/tui-raw/common-auth-embedded/quota/map.js +105 -0
- package/src/tui-raw/common-auth-embedded/quota/merge.js +162 -0
- package/src/tui-raw/common-auth-embedded/quota/projection.js +134 -0
- package/src/tui-raw/common-auth-embedded/rpc/client.js +2 -0
- package/src/tui-raw/common-auth-embedded/rpc/port-file.js +217 -0
- package/src/tui-raw/common-auth-embedded/rpc/rpc-client.js +253 -0
- package/src/tui-raw/logging/provider-key-policy.js +3 -0
- package/src/tui-raw/quota-presentation.js +42 -0
- package/src/tui-raw/rpc/rpc-client.js +35 -0
- package/src/tui-raw/rpc/rpc-dir.js +13 -0
- package/src/tui-raw/selector.js +21 -0
- package/src/tui-raw/sidebar-state.js +401 -0
- package/src/tui-raw/tui/command-dialogs.tsx +468 -0
- package/src/tui-raw/tui/file-logger.js +73 -0
- package/src/tui-raw/tui/host-api.js +269 -0
- package/src/tui-raw/tui/host-v1.tsx +249 -0
- package/src/tui-raw/tui-preferences.js +230 -0
- package/src/tui-raw/tui.tsx +1088 -0
- package/src/tui.tsx +58 -141
- package/tui.js +6 -0
- package/src/tui-compiled/plugin/command-data.ts +0 -931
- package/src/tui-compiled/rpc/port-file.ts +0 -143
- package/src/tui-compiled/rpc/protocol.ts +0 -31
- package/src/tui-compiled/rpc/rpc-client.ts +0 -102
- package/src/tui-compiled/rpc/rpc-dir.ts +0 -24
- package/src/tui-compiled/sidebar-state.ts +0 -991
- package/src/tui-compiled/tui/command-dialogs.tsx +0 -779
- package/src/tui-compiled/tui/file-logger.ts +0 -145
- package/src/tui-compiled/tui-preferences.ts +0 -416
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `./tui` entry for both hosts. OpenCode 1 calls `tui(api, options,
|
|
3
|
+
* meta)`; OpenCode 2 (GA) calls `setup(context)` and receives the cleanup
|
|
4
|
+
* that stops everything the setup started.
|
|
5
|
+
*
|
|
6
|
+
* Parameters are typed `unknown` so this declaration imports neither host's
|
|
7
|
+
* SDK: each host's own plugin type accepts it (a function taking `unknown`
|
|
8
|
+
* accepts any argument), and a consumer on one host never needs the other
|
|
9
|
+
* host's SDK or renderer declarations.
|
|
10
|
+
*/
|
|
11
|
+
declare const plugin: {
|
|
12
|
+
readonly id: 'cortexkit.antigravity-auth'
|
|
13
|
+
readonly tui: (api: unknown, options: unknown, meta: unknown) => Promise<void>
|
|
14
|
+
readonly setup: (context: unknown) => Promise<() => Promise<void>>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default plugin
|
package/src/tui/entry.mjs
CHANGED
|
@@ -1,74 +1,42 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
// Bun resolves `@opentui/solid` to the node-exported JS and the host's
|
|
12
|
-
// pre-built `../tui-compiled/tui.tsx` file (which already references those
|
|
13
|
-
// virtual modules in its import graph) lines up correctly.
|
|
14
|
-
//
|
|
15
|
-
// Two import paths are tried, in order:
|
|
16
|
-
//
|
|
17
|
-
// 1. `../tui-compiled/tui.tsx` — the precompiled, virtual-runtime-aware
|
|
18
|
-
// bundle. Resolved successfully by hosts that ship a runtime module
|
|
19
|
-
// resolver + the precompiled tree.
|
|
20
|
-
// 2. `../tui.tsx` — the dev fallback. Local development with raw TSX
|
|
21
|
-
// runs through `@opentui/solid/preload`, which installs the Solid
|
|
22
|
-
// transform plugin so the same `/** @jsxImportSource @opentui/solid */`
|
|
23
|
-
// pragma is honoured on the fly.
|
|
24
|
-
//
|
|
25
|
-
// Errors raised while probing for the runtime module that indicate "module
|
|
26
|
-
// not found" are swallowed and the compiled tree is attempted next. Any
|
|
27
|
-
// other error (syntax error, runtime error in the compiled file, etc.) is
|
|
28
|
-
// re-thrown — those are real bugs, not configuration mismatches.
|
|
1
|
+
// The package's `./tui` entry for both hosts: `{ id, tui, setup }`.
|
|
2
|
+
// OpenCode 1 calls `tui(api, options, meta)`; OpenCode 2 (GA) calls
|
|
3
|
+
// `setup(context)`. Importing this module loads neither UI: each arm loads
|
|
4
|
+
// its own compiled root on first call, so the OpenCode 1 renderer never
|
|
5
|
+
// starts inside GA and the GA one never starts inside OpenCode 1.
|
|
6
|
+
// The public loadTui picks the compiled root when the host registers its
|
|
7
|
+
// runtime modules and the raw source otherwise (development only), and
|
|
8
|
+
// propagates every unrelated import error, so a missing installed root
|
|
9
|
+
// fails with ERR_MODULE_NOT_FOUND instead of falling back.
|
|
10
|
+
import { loadTui } from '../common-auth-embedded/tui/index.js'
|
|
29
11
|
|
|
30
|
-
|
|
31
|
-
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
12
|
+
const ID = 'cortexkit.antigravity-auth'
|
|
32
13
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const COMPILED_ENTRY = pathToFileURL(
|
|
36
|
-
resolve(ENTRY_DIR, '../tui-compiled/tui.tsx'),
|
|
37
|
-
).href
|
|
38
|
-
const RAW_ENTRY = pathToFileURL(resolve(ENTRY_DIR, '../tui.tsx')).href
|
|
14
|
+
let v1Root
|
|
15
|
+
let gaRoot
|
|
39
16
|
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const message = typeof error.message === 'string' ? error.message : ''
|
|
47
|
-
return /cannot find module|module not found|ENOENT/i.test(message)
|
|
17
|
+
function loadV1() {
|
|
18
|
+
v1Root ??= loadTui({
|
|
19
|
+
rawEntry: new URL('../tui-raw/tui.tsx', import.meta.url).href,
|
|
20
|
+
runtimeEntry: new URL('../tui-compiled/tui.js', import.meta.url).href,
|
|
21
|
+
})
|
|
22
|
+
return v1Root
|
|
48
23
|
}
|
|
49
24
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
25
|
+
function loadGa() {
|
|
26
|
+
gaRoot ??= loadTui({
|
|
27
|
+
rawEntry: new URL('../tui-ga-raw/host-ga.tsx', import.meta.url).href,
|
|
28
|
+
runtimeEntry: new URL('../tui-ga-compiled/host-ga.js', import.meta.url)
|
|
29
|
+
.href,
|
|
30
|
+
})
|
|
31
|
+
return gaRoot
|
|
58
32
|
}
|
|
59
33
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
}
|
|
65
|
-
|
|
34
|
+
export default {
|
|
35
|
+
id: ID,
|
|
36
|
+
async tui(api, options, meta) {
|
|
37
|
+
return (await loadV1()).tui(api, options, meta)
|
|
38
|
+
},
|
|
39
|
+
async setup(context) {
|
|
40
|
+
return (await loadGa()).setup(context)
|
|
41
|
+
},
|
|
66
42
|
}
|
|
67
|
-
|
|
68
|
-
const mod = await importWithFallback()
|
|
69
|
-
|
|
70
|
-
// Pass the wrapped plugin shape through unchanged. `tui.tsx` exports the
|
|
71
|
-
// fleet-shape `{ id, tui }` wrapper as its default export; this file just
|
|
72
|
-
// selects between the precompiled and the dev-TSX entry, it does not
|
|
73
|
-
// re-wrap.
|
|
74
|
-
export default mod?.default ?? mod?.tui ?? mod
|
package/src/tui/file-logger.ts
CHANGED
|
@@ -23,6 +23,8 @@ import {
|
|
|
23
23
|
} from 'node:fs'
|
|
24
24
|
import { homedir } from 'node:os'
|
|
25
25
|
import { dirname, join } from 'node:path'
|
|
26
|
+
import { createLoggerInstance } from '../common-auth-embedded/logger/index.js'
|
|
27
|
+
import { isProviderSecretKey } from '../logging/provider-key-policy'
|
|
26
28
|
|
|
27
29
|
export type TuiLogLevel = 'debug' | 'info' | 'warn' | 'error'
|
|
28
30
|
|
|
@@ -57,9 +59,8 @@ interface FileLoggerOptions {
|
|
|
57
59
|
* never touch a real user log file).
|
|
58
60
|
* - Otherwise write under `<xdg-state>/cortexkit/antigravity-auth/tui.log`.
|
|
59
61
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* it just drops the line.
|
|
62
|
+
* There is no temporary-file fallback. The writer silently drops lines when
|
|
63
|
+
* the resolved destination cannot be written.
|
|
63
64
|
*/
|
|
64
65
|
export function resolveTuiLogPath(): string {
|
|
65
66
|
const override = process.env.ANTIGRAVITY_AUTH_TUI_LOG_FILE
|
|
@@ -135,11 +136,25 @@ function createFileLogger(options: FileLoggerOptions): TuiLogger {
|
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
// Keep the immediate host writer, not the public logger's buffered file mode.
|
|
140
|
+
// Each TUI writer owns a separate sink-only engine with an explicit debug floor.
|
|
141
|
+
const instance = createLoggerInstance({
|
|
142
|
+
level: 'debug',
|
|
143
|
+
extraSecretKeys: isProviderSecretKey,
|
|
144
|
+
captureSink: ({ level, message, data }) => {
|
|
145
|
+
const extra =
|
|
146
|
+
data !== null && typeof data === 'object' && !Array.isArray(data)
|
|
147
|
+
? Object.fromEntries(Object.entries(data))
|
|
148
|
+
: undefined
|
|
149
|
+
write(level === 'trace' ? 'debug' : level, message, extra)
|
|
150
|
+
},
|
|
151
|
+
})
|
|
152
|
+
const channel = instance.createLogger('antigravity.tui')
|
|
138
153
|
return {
|
|
139
|
-
debug:
|
|
140
|
-
info:
|
|
141
|
-
warn:
|
|
142
|
-
error:
|
|
154
|
+
debug: channel.debug,
|
|
155
|
+
info: channel.info,
|
|
156
|
+
warn: channel.warn,
|
|
157
|
+
error: channel.error,
|
|
143
158
|
getLogPath: () => filePath,
|
|
144
159
|
}
|
|
145
160
|
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { appendFileSync, chmodSync, existsSync, renameSync, statSync, } from "node:fs";
|
|
2
|
+
import { createRedactor } from "./redact.js";
|
|
3
|
+
const ORDER = {
|
|
4
|
+
error: 0,
|
|
5
|
+
warn: 1,
|
|
6
|
+
info: 2,
|
|
7
|
+
debug: 3,
|
|
8
|
+
trace: 4,
|
|
9
|
+
};
|
|
10
|
+
const MAX_BYTES = 5 * 1024 * 1024;
|
|
11
|
+
const ROTATE_KEEP = 3;
|
|
12
|
+
function chmodPrivate(path) {
|
|
13
|
+
try {
|
|
14
|
+
chmodSync(path, 0o600);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
/* never throw */
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function rotateIfNeeded(f) {
|
|
21
|
+
try {
|
|
22
|
+
if (!(existsSync(f) && statSync(f).size >= MAX_BYTES))
|
|
23
|
+
return;
|
|
24
|
+
for (let i = ROTATE_KEEP - 1; i >= 1; i--) {
|
|
25
|
+
if (existsSync(`${f}.${i}`)) {
|
|
26
|
+
const rotated = `${f}.${i + 1}`;
|
|
27
|
+
renameSync(`${f}.${i}`, rotated);
|
|
28
|
+
chmodPrivate(rotated);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const rotated = `${f}.1`;
|
|
32
|
+
renameSync(f, rotated);
|
|
33
|
+
chmodPrivate(rotated);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
/* never throw */
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function safeSerialize(data) {
|
|
40
|
+
try {
|
|
41
|
+
return ` ${JSON.stringify(data)}`;
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return ' [unserializable]';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* One logger's settings and buffer.
|
|
49
|
+
*
|
|
50
|
+
* Where lines are written and the level floor start unset unless `options`
|
|
51
|
+
* supplies them. A host decides where its log lives (that decision reads host
|
|
52
|
+
* environment variables and host directories, neither of which belongs in
|
|
53
|
+
* shared code) and configures the logger before it runs any command. Until
|
|
54
|
+
* then every `log.*` call is a silent no-op: throwing would turn the first
|
|
55
|
+
* command a host forgot to wire into a crash, and buffering would hold
|
|
56
|
+
* credential-bearing lines for a configuration that may never arrive.
|
|
57
|
+
*/
|
|
58
|
+
function createEngine(options) {
|
|
59
|
+
let logFileSource;
|
|
60
|
+
let initLevelSource;
|
|
61
|
+
let runtimeLevel;
|
|
62
|
+
let redactor = createRedactor();
|
|
63
|
+
let captureSink;
|
|
64
|
+
let buffer = [];
|
|
65
|
+
let timer;
|
|
66
|
+
function configure(next) {
|
|
67
|
+
logFileSource = next.file;
|
|
68
|
+
initLevelSource = next.level;
|
|
69
|
+
redactor = createRedactor(next);
|
|
70
|
+
captureSink = next.captureSink;
|
|
71
|
+
}
|
|
72
|
+
function setLogLevel(l) {
|
|
73
|
+
if (l === undefined || l in ORDER)
|
|
74
|
+
runtimeLevel = l;
|
|
75
|
+
}
|
|
76
|
+
function logFilePath() {
|
|
77
|
+
if (logFileSource === undefined)
|
|
78
|
+
return undefined;
|
|
79
|
+
const resolved = typeof logFileSource === 'function' ? logFileSource() : logFileSource;
|
|
80
|
+
return resolved || undefined;
|
|
81
|
+
}
|
|
82
|
+
function configuredLevel() {
|
|
83
|
+
if (runtimeLevel)
|
|
84
|
+
return runtimeLevel;
|
|
85
|
+
const floor = typeof initLevelSource === 'function'
|
|
86
|
+
? initLevelSource()
|
|
87
|
+
: initLevelSource;
|
|
88
|
+
if (floor && floor in ORDER)
|
|
89
|
+
return floor;
|
|
90
|
+
return 'info';
|
|
91
|
+
}
|
|
92
|
+
function flushLogs() {
|
|
93
|
+
if (timer) {
|
|
94
|
+
clearTimeout(timer);
|
|
95
|
+
timer = undefined;
|
|
96
|
+
}
|
|
97
|
+
if (!buffer.length)
|
|
98
|
+
return;
|
|
99
|
+
let file;
|
|
100
|
+
try {
|
|
101
|
+
file = logFilePath();
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
buffer = [];
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const text = buffer.join('');
|
|
108
|
+
buffer = [];
|
|
109
|
+
if (!file)
|
|
110
|
+
return;
|
|
111
|
+
try {
|
|
112
|
+
rotateIfNeeded(file);
|
|
113
|
+
if (existsSync(file))
|
|
114
|
+
chmodPrivate(file);
|
|
115
|
+
appendFileSync(file, text, { encoding: 'utf8', mode: 0o600 });
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
/* never throw */
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function schedule() {
|
|
122
|
+
if (!timer)
|
|
123
|
+
timer = setTimeout(() => {
|
|
124
|
+
timer = undefined;
|
|
125
|
+
flushLogs();
|
|
126
|
+
}, 500);
|
|
127
|
+
}
|
|
128
|
+
function emit(channel, level, message, data) {
|
|
129
|
+
// Unconfigured (neither a file nor a sink) stays a silent no-op.
|
|
130
|
+
if (logFileSource === undefined && captureSink === undefined)
|
|
131
|
+
return;
|
|
132
|
+
try {
|
|
133
|
+
if (ORDER[level] > ORDER[configuredLevel()])
|
|
134
|
+
return;
|
|
135
|
+
const scrubbedMessage = redactor.redactStrings(message);
|
|
136
|
+
let scrubbedData;
|
|
137
|
+
try {
|
|
138
|
+
scrubbedData = redactor.redact(data);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
scrubbedData = '[unserializable]';
|
|
142
|
+
}
|
|
143
|
+
const line = `[${new Date().toISOString()}] ${level.toUpperCase()} [${channel}] ${scrubbedMessage}` +
|
|
144
|
+
(data === undefined ? '' : safeSerialize(scrubbedData)) +
|
|
145
|
+
'\n';
|
|
146
|
+
// A failing observer must not prevent file logging or escape into the host.
|
|
147
|
+
try {
|
|
148
|
+
captureSink?.({
|
|
149
|
+
channel,
|
|
150
|
+
level,
|
|
151
|
+
message: scrubbedMessage,
|
|
152
|
+
data: scrubbedData,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
catch { }
|
|
156
|
+
// A sink-only logger has no file to buffer lines for.
|
|
157
|
+
if (logFileSource === undefined)
|
|
158
|
+
return;
|
|
159
|
+
buffer.push(line);
|
|
160
|
+
if (buffer.length >= 50)
|
|
161
|
+
flushLogs();
|
|
162
|
+
else
|
|
163
|
+
schedule();
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// Provider and redaction failures must never turn diagnostics into a host crash.
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function createLogger(channel) {
|
|
170
|
+
return {
|
|
171
|
+
error: (m, d) => emit(channel, 'error', m, d),
|
|
172
|
+
warn: (m, d) => emit(channel, 'warn', m, d),
|
|
173
|
+
info: (m, d) => emit(channel, 'info', m, d),
|
|
174
|
+
debug: (m, d) => emit(channel, 'debug', m, d),
|
|
175
|
+
trace: (m, d) => emit(channel, 'trace', m, d),
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function reset() {
|
|
179
|
+
buffer = [];
|
|
180
|
+
if (timer) {
|
|
181
|
+
clearTimeout(timer);
|
|
182
|
+
timer = undefined;
|
|
183
|
+
}
|
|
184
|
+
logFileSource = undefined;
|
|
185
|
+
initLevelSource = undefined;
|
|
186
|
+
runtimeLevel = undefined;
|
|
187
|
+
redactor = createRedactor();
|
|
188
|
+
captureSink = undefined;
|
|
189
|
+
}
|
|
190
|
+
if (options)
|
|
191
|
+
configure(options);
|
|
192
|
+
return { configure, createLogger, setLogLevel, flushLogs, reset };
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* A logger instance of its own, configured with `options`. A plugin whose
|
|
196
|
+
* copy of this module may be shared with another plugin in the same process
|
|
197
|
+
* uses this instead of `initLogger`, so neither replaces the other's file,
|
|
198
|
+
* level, redaction or capture sink.
|
|
199
|
+
*/
|
|
200
|
+
export function createLoggerInstance(options) {
|
|
201
|
+
const { configure, createLogger, setLogLevel, flushLogs } = createEngine(options);
|
|
202
|
+
return { configure, createLogger, setLogLevel, flushLogs };
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The instance behind the module-level functions below, which keep the
|
|
206
|
+
* single-plugin API: one plugin per copy of this module calls `initLogger`
|
|
207
|
+
* and `createLogger` without holding an instance.
|
|
208
|
+
*/
|
|
209
|
+
const defaultEngine = createEngine();
|
|
210
|
+
/**
|
|
211
|
+
* Point the module's default logger at a host's file and level, and return
|
|
212
|
+
* it. Idempotent: calling it again replaces both. A runtime level installed
|
|
213
|
+
* by `setLogLevel` is deliberately left alone, because it is the operator's
|
|
214
|
+
* explicit choice and outranks the floor a host computed at start-up.
|
|
215
|
+
*/
|
|
216
|
+
export function initLogger(options) {
|
|
217
|
+
defaultEngine.configure(options);
|
|
218
|
+
const { configure, createLogger, setLogLevel, flushLogs } = defaultEngine;
|
|
219
|
+
return { configure, createLogger, setLogLevel, flushLogs };
|
|
220
|
+
}
|
|
221
|
+
export function setLogLevel(l) {
|
|
222
|
+
defaultEngine.setLogLevel(l);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Write whatever the default logger has buffered. Safe to call synchronously
|
|
226
|
+
* from a process-exit handler, which is how each host drains the buffer on
|
|
227
|
+
* shutdown.
|
|
228
|
+
*/
|
|
229
|
+
export function flushLogs() {
|
|
230
|
+
defaultEngine.flushLogs();
|
|
231
|
+
}
|
|
232
|
+
export function createLogger(channel) {
|
|
233
|
+
return defaultEngine.createLogger(channel);
|
|
234
|
+
}
|
|
235
|
+
export async function flushForTest() {
|
|
236
|
+
defaultEngine.flushLogs();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Return the default logger to its uninitialised state. Only a test needs
|
|
240
|
+
* this: a single process runs every test file, so a file path left over from
|
|
241
|
+
* one test would keep a later "logger was never initialised" case writing
|
|
242
|
+
* lines.
|
|
243
|
+
*/
|
|
244
|
+
export function resetLoggerForTest() {
|
|
245
|
+
defaultEngine.reset();
|
|
246
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const SECRET_KEY_EXACT = /^(authorization|x-api-key|cookie|set-cookie|refresh|access|token)$/i;
|
|
2
|
+
const TOKEN_VALUE = /\b(Bearer\s+[\w.-]+|sk-[\w-]+|eyJ[\w.-]+)\b|ckh_[A-Za-z0-9_-]{20,}/g;
|
|
3
|
+
const MASK = '***REDACTED***';
|
|
4
|
+
// How many errors deep a cause chain is followed. A chain this long is
|
|
5
|
+
// already unreadable in a log line, and an unbounded one (each cause a fresh
|
|
6
|
+
// object, so the cycle check never trips) must not grow the line forever.
|
|
7
|
+
const MAX_ERROR_DEPTH = 8;
|
|
8
|
+
// Error's own fields are non-enumerable, so a plain entry walk renders an
|
|
9
|
+
// Error as `{}` and the name, message and stack a plugin logged are lost.
|
|
10
|
+
// The tag check also recognises an Error from another realm (a worker or a
|
|
11
|
+
// vm context), whose prototype is not this realm's Error.
|
|
12
|
+
function isError(value) {
|
|
13
|
+
return (value instanceof Error ||
|
|
14
|
+
Object.prototype.toString.call(value) === '[object Error]');
|
|
15
|
+
}
|
|
16
|
+
export function createRedactor(options = {}) {
|
|
17
|
+
const patterns = [TOKEN_VALUE, ...(options.extraValuePatterns ?? [])].map((pattern) => new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : `${pattern.flags}g`));
|
|
18
|
+
function isSecretKey(key) {
|
|
19
|
+
const normalized = key.toLowerCase().replace(/[-_]/g, '');
|
|
20
|
+
return (SECRET_KEY_EXACT.test(key) ||
|
|
21
|
+
normalized.includes('apikey') ||
|
|
22
|
+
normalized.endsWith('secret') ||
|
|
23
|
+
normalized.endsWith('password') ||
|
|
24
|
+
(normalized.endsWith('token') && !normalized.endsWith('tokens')) ||
|
|
25
|
+
!!options.extraSecretKeys?.(normalized));
|
|
26
|
+
}
|
|
27
|
+
// The fields every log reader wants first, then whatever else the error
|
|
28
|
+
// carries as its own enumerable properties (which is all an Error rendered
|
|
29
|
+
// as before). Every entry goes through the same key and string scrubbing as
|
|
30
|
+
// any other object, so a token in a message or stack is still masked.
|
|
31
|
+
function errorEntries(error) {
|
|
32
|
+
const fields = error;
|
|
33
|
+
const entries = [
|
|
34
|
+
['name', error.name],
|
|
35
|
+
['message', error.message],
|
|
36
|
+
['stack', error.stack],
|
|
37
|
+
];
|
|
38
|
+
for (const key of ['code', 'status', 'cause'])
|
|
39
|
+
if (fields[key] !== undefined)
|
|
40
|
+
entries.push([key, fields[key]]);
|
|
41
|
+
const listed = new Set(entries.map(([key]) => key));
|
|
42
|
+
for (const entry of Object.entries(error))
|
|
43
|
+
if (!listed.has(entry[0]))
|
|
44
|
+
entries.push(entry);
|
|
45
|
+
return entries;
|
|
46
|
+
}
|
|
47
|
+
function walk(value, keys, seen, errorDepth = 0) {
|
|
48
|
+
if (typeof value === 'string') {
|
|
49
|
+
return patterns.reduce((text, pattern) => text.replace(pattern, MASK), value);
|
|
50
|
+
}
|
|
51
|
+
if (!value || typeof value !== 'object')
|
|
52
|
+
return value;
|
|
53
|
+
if (seen.has(value))
|
|
54
|
+
return '[Circular]';
|
|
55
|
+
seen.add(value);
|
|
56
|
+
try {
|
|
57
|
+
if (Array.isArray(value))
|
|
58
|
+
return value.map((item) => walk(item, keys, seen, errorDepth));
|
|
59
|
+
const error = isError(value);
|
|
60
|
+
if (error && errorDepth >= MAX_ERROR_DEPTH)
|
|
61
|
+
return '[Truncated]';
|
|
62
|
+
const childDepth = error ? errorDepth + 1 : errorDepth;
|
|
63
|
+
// Define own properties so a diagnostic __proto__ key cannot change the output prototype.
|
|
64
|
+
return Object.fromEntries((error ? errorEntries(value) : Object.entries(value)).map(([key, item]) => [
|
|
65
|
+
key,
|
|
66
|
+
keys && isSecretKey(key)
|
|
67
|
+
? MASK
|
|
68
|
+
: walk(item, keys, seen, childDepth),
|
|
69
|
+
]));
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
seen.delete(value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
redact: (value) => walk(value, true, new WeakSet()),
|
|
77
|
+
// Schema keys describe arguments, not credentials; only their string values are scrubbed.
|
|
78
|
+
redactStrings: (value) => walk(value, false, new WeakSet()),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const defaultRedactor = createRedactor();
|
|
82
|
+
export const redact = defaultRedactor.redact;
|
|
83
|
+
export const redactStrings = defaultRedactor.redactStrings;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isQuotaMap } from "./map.js";
|
|
2
|
+
import { mergeQuotaObservation } from "./merge.js";
|
|
3
|
+
/**
|
|
4
|
+
* The quota codec the account-pool store (the `/store` subpath) takes when it
|
|
5
|
+
* is opened: `validate` checks a stored per-row quota map and `merge` applies
|
|
6
|
+
* an observation to one, so the store persists the map without interpreting
|
|
7
|
+
* it.
|
|
8
|
+
*/
|
|
9
|
+
export const quotaCodec = Object.freeze({
|
|
10
|
+
validate: isQuotaMap,
|
|
11
|
+
merge: mergeQuotaObservation,
|
|
12
|
+
});
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// The one quota wording every surface shows: the command menu's dialogs on
|
|
2
|
+
// OpenCode and Pi, the terminal auth menu, and the plugins' sidebars. Each of
|
|
3
|
+
// them calls `formatQuota` (or `quotaTextParts` for one line per window), so
|
|
4
|
+
// the wording cannot drift between plugins or between a dialog and a sidebar.
|
|
5
|
+
//
|
|
6
|
+
// The rules: a window is named by its length (`5h`, `7d`), or, for a window
|
|
7
|
+
// that binds only one model family, by the label the plugin stored it under.
|
|
8
|
+
// Every figure is "% left". A window the provider did not report (an absence
|
|
9
|
+
// record or a retirement tombstone) is left out rather than written as "not
|
|
10
|
+
// reported". A reset is a short time from now (`resets 2h`). A reading older
|
|
11
|
+
// than fifteen minutes says how old it is (`checked 3h ago`).
|
|
12
|
+
//
|
|
13
|
+
// Like the rest of this module it reads no clock: `now` is a parameter.
|
|
14
|
+
import { ALL_SCOPE } from "./map.js";
|
|
15
|
+
/** A reading older than this is marked with its age. */
|
|
16
|
+
export const QUOTA_STALE_AFTER_MS = 15 * 60_000;
|
|
17
|
+
/** What `formatQuota` returns when there is no reading at all. */
|
|
18
|
+
export const NO_QUOTA_READING = 'no quota reading yet';
|
|
19
|
+
/**
|
|
20
|
+
* What `formatQuota` returns when the provider answered but reported no
|
|
21
|
+
* limit for any window (every window is an absence record or a tombstone).
|
|
22
|
+
*/
|
|
23
|
+
export const NO_LIMITS_REPORTED = 'no limits reported';
|
|
24
|
+
/**
|
|
25
|
+
* A length or a time span in its largest whole-ish unit: `45m`, `5h`, `3d`.
|
|
26
|
+
* Spans under an hour are minutes, under a day hours, otherwise days, each
|
|
27
|
+
* rounded to the nearest unit and never shown as zero.
|
|
28
|
+
*/
|
|
29
|
+
function shortSpan(ms) {
|
|
30
|
+
const minutes = Math.max(1, Math.round(ms / 60_000));
|
|
31
|
+
if (minutes < 60)
|
|
32
|
+
return `${minutes}m`;
|
|
33
|
+
const hours = Math.round(minutes / 60);
|
|
34
|
+
if (hours < 24)
|
|
35
|
+
return `${hours}h`;
|
|
36
|
+
return `${Math.max(1, Math.round(minutes / 1440))}d`;
|
|
37
|
+
}
|
|
38
|
+
/** A stored window length in minutes as its exact name: `5h`, `7d`, `90m`. */
|
|
39
|
+
function lengthName(minutes) {
|
|
40
|
+
if (minutes % 1440 === 0)
|
|
41
|
+
return `${minutes / 1440}d`;
|
|
42
|
+
if (minutes % 60 === 0)
|
|
43
|
+
return `${minutes / 60}h`;
|
|
44
|
+
return `${minutes}m`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The name a window is shown under. A general window (scope `all`) is named
|
|
48
|
+
* by its stored length; a model-scoped window keeps the label the plugin
|
|
49
|
+
* stored it under, which already names the model (`seven_day_opus`). A
|
|
50
|
+
* general window stored without a length (a snapshot from before lengths
|
|
51
|
+
* were recorded) falls back to its label.
|
|
52
|
+
*/
|
|
53
|
+
export function quotaWindowName(limit) {
|
|
54
|
+
if (limit.scope !== ALL_SCOPE || limit.windowMinutes === undefined)
|
|
55
|
+
return limit.label;
|
|
56
|
+
return lengthName(limit.windowMinutes);
|
|
57
|
+
}
|
|
58
|
+
function percentLeft(remaining) {
|
|
59
|
+
return `${Math.round(Math.min(100, Math.max(0, remaining)))}% left`;
|
|
60
|
+
}
|
|
61
|
+
function resetText(resetsAt, now) {
|
|
62
|
+
if (resetsAt === undefined)
|
|
63
|
+
return '';
|
|
64
|
+
const at = Date.parse(resetsAt);
|
|
65
|
+
// A reset already passed says nothing about the future; leave it out.
|
|
66
|
+
if (!Number.isFinite(at) || at <= now)
|
|
67
|
+
return '';
|
|
68
|
+
return `, resets ${shortSpan(at - now)}`;
|
|
69
|
+
}
|
|
70
|
+
/** Shortest window first, so `5h` reads before `7d`; unknown lengths last. */
|
|
71
|
+
function displayOrder(left, right) {
|
|
72
|
+
const l = left.windowMinutes;
|
|
73
|
+
const r = right.windowMinutes;
|
|
74
|
+
if (l !== undefined && r !== undefined && l !== r)
|
|
75
|
+
return l - r;
|
|
76
|
+
if ((l === undefined) !== (r === undefined))
|
|
77
|
+
return l === undefined ? 1 : -1;
|
|
78
|
+
if (left.scope !== right.scope) {
|
|
79
|
+
if (left.scope === ALL_SCOPE)
|
|
80
|
+
return -1;
|
|
81
|
+
if (right.scope === ALL_SCOPE)
|
|
82
|
+
return 1;
|
|
83
|
+
return left.scope < right.scope ? -1 : 1;
|
|
84
|
+
}
|
|
85
|
+
return left.label < right.label ? -1 : left.label > right.label ? 1 : 0;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The pieces of a quota text, in order: one per reported window
|
|
89
|
+
* (`5h 58% left, resets 2h`), then the credit budget when there is one, then
|
|
90
|
+
* `checked 3h ago` when the oldest piece shown is stale. Empty when nothing
|
|
91
|
+
* was reported; `formatQuota` turns that into a sentence. A caller printing
|
|
92
|
+
* one line per window (the terminal auth menu) uses these directly.
|
|
93
|
+
*/
|
|
94
|
+
export function quotaTextParts(quota, options) {
|
|
95
|
+
if (!quota)
|
|
96
|
+
return [];
|
|
97
|
+
const { now } = options;
|
|
98
|
+
const full = (options.form ?? 'full') === 'full';
|
|
99
|
+
const parts = [];
|
|
100
|
+
const times = [];
|
|
101
|
+
const readings = quota.limits
|
|
102
|
+
.filter((limit) => limit.kind === 'reading' && limit.remainingPercent !== undefined)
|
|
103
|
+
.sort(displayOrder);
|
|
104
|
+
for (const limit of readings) {
|
|
105
|
+
times.push(limit.checkedAt);
|
|
106
|
+
parts.push(`${quotaWindowName(limit)} ${percentLeft(limit.remainingPercent ?? 0)}${full ? resetText(limit.resetsAt, now) : ''}`);
|
|
107
|
+
}
|
|
108
|
+
const budget = quota.budget;
|
|
109
|
+
if (budget) {
|
|
110
|
+
times.push(budget.checkedAt);
|
|
111
|
+
const figure = budget.reached
|
|
112
|
+
? 'credits spent'
|
|
113
|
+
: budget.remainingPercent !== undefined
|
|
114
|
+
? `credits ${percentLeft(budget.remainingPercent)}`
|
|
115
|
+
: 'credits available';
|
|
116
|
+
parts.push(`${figure}${full ? resetText(budget.resetsAt, now) : ''}`);
|
|
117
|
+
}
|
|
118
|
+
if (times.length > 0) {
|
|
119
|
+
const age = now - Math.min(...times);
|
|
120
|
+
if (age > (options.staleAfterMs ?? QUOTA_STALE_AFTER_MS))
|
|
121
|
+
parts.push(`checked ${shortSpan(age)} ago`);
|
|
122
|
+
}
|
|
123
|
+
return parts;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A row's quota as one line: `5h 58% left · 7d 90% left` in the compact
|
|
127
|
+
* form, with `, resets 2h` after each window in the full form. With nothing
|
|
128
|
+
* reported it is `NO_QUOTA_READING`, or `NO_LIMITS_REPORTED` when the
|
|
129
|
+
* provider answered without a limit for any window.
|
|
130
|
+
*/
|
|
131
|
+
export function formatQuota(quota, options) {
|
|
132
|
+
const parts = quotaTextParts(quota, options);
|
|
133
|
+
if (parts.length > 0)
|
|
134
|
+
return parts.join(' · ');
|
|
135
|
+
return quota && quota.limits.length > 0
|
|
136
|
+
? NO_LIMITS_REPORTED
|
|
137
|
+
: NO_QUOTA_READING;
|
|
138
|
+
}
|