@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,339 @@
|
|
|
1
|
+
// `sticky-balanced` routing: openai-auth's quota-weighted session placement
|
|
2
|
+
// and pin-break classification, judged over the quota projection rather than
|
|
3
|
+
// openai-auth's fixed primary/secondary snapshot.
|
|
4
|
+
import { budgetExhaustedResetAt, projectQuota, } from '../quota/projection.js';
|
|
5
|
+
import { admit, } from './admission.js';
|
|
6
|
+
import { isPinValid } from './pins.js';
|
|
7
|
+
export const QUOTA_STALENESS_MS = 15 * 60_000;
|
|
8
|
+
export const MIN_RESET_HOURS = 1 / 60;
|
|
9
|
+
export const MIN_WEIGHT = 1e-6;
|
|
10
|
+
/** The projection's time, else the caller's cache-entry time. */
|
|
11
|
+
export function snapshotCheckedAt(quota, entryCheckedAt) {
|
|
12
|
+
for (const checkedAt of [quota?.checkedAt, entryCheckedAt]) {
|
|
13
|
+
if (typeof checkedAt === 'number' && Number.isFinite(checkedAt)) {
|
|
14
|
+
return checkedAt;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The status rule used when the adapter supplies none, carried from
|
|
21
|
+
* openai-auth: 401 and 403 are permanent; no response, 0, a non-finite
|
|
22
|
+
* status, 429 and 5xx are transient; anything else leaves the row healthy.
|
|
23
|
+
* A provider whose 403 can mean an organisation or model policy rather than
|
|
24
|
+
* a dead account supplies its own classifier and can fall back to this one
|
|
25
|
+
* for the statuses it does not single out.
|
|
26
|
+
*/
|
|
27
|
+
export function defaultStickyStatusClass(status) {
|
|
28
|
+
if (status === 401 || status === 403)
|
|
29
|
+
return 'permanent';
|
|
30
|
+
if (status === undefined ||
|
|
31
|
+
status === 0 ||
|
|
32
|
+
!Number.isFinite(status) ||
|
|
33
|
+
(status >= 500 && status <= 599) ||
|
|
34
|
+
status === 429) {
|
|
35
|
+
return 'transient';
|
|
36
|
+
}
|
|
37
|
+
return 'healthy';
|
|
38
|
+
}
|
|
39
|
+
function windowReadings(quota) {
|
|
40
|
+
// Every reading is an independent constraint, so all of them are judged:
|
|
41
|
+
// a third window (for example a short window beside two weekly ones) can
|
|
42
|
+
// be the one that is nearly spent. Longest known window first, unknown
|
|
43
|
+
// lengths last, as openai-auth sorts, so a break decision with several
|
|
44
|
+
// spent windows names the longest. Tombstones and absence records carry no
|
|
45
|
+
// capacity figure and are left out.
|
|
46
|
+
return quota.limits
|
|
47
|
+
.filter((limit) => limit.kind === 'reading')
|
|
48
|
+
.sort((left, right) => {
|
|
49
|
+
const leftKnown = left.windowMinutes !== undefined;
|
|
50
|
+
const rightKnown = right.windowMinutes !== undefined;
|
|
51
|
+
if (leftKnown !== rightKnown)
|
|
52
|
+
return leftKnown ? -1 : 1;
|
|
53
|
+
if (leftKnown && rightKnown) {
|
|
54
|
+
return (right.windowMinutes ?? 0) - (left.windowMinutes ?? 0);
|
|
55
|
+
}
|
|
56
|
+
return 0;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** Classifies whether a pinned session should leave its row after a failure. */
|
|
60
|
+
export function decideStickyBreak(input) {
|
|
61
|
+
const statusClass = (input.classifyStatus ?? defaultStickyStatusClass)(input.status);
|
|
62
|
+
if (statusClass === 'permanent') {
|
|
63
|
+
return { action: 'migrate', reason: 'permanent' };
|
|
64
|
+
}
|
|
65
|
+
if (!input.quota)
|
|
66
|
+
return { action: 'retain', reason: 'unknown' };
|
|
67
|
+
const checkedAt = snapshotCheckedAt(input.quota, input.quotaCheckedAt);
|
|
68
|
+
if (checkedAt === undefined ||
|
|
69
|
+
!Number.isFinite(checkedAt) ||
|
|
70
|
+
input.now - checkedAt > QUOTA_STALENESS_MS) {
|
|
71
|
+
return { action: 'retain', reason: 'stale' };
|
|
72
|
+
}
|
|
73
|
+
// After the stale check, so a stale snapshot never judges the account on a
|
|
74
|
+
// reading the killswitch would consider below its floor.
|
|
75
|
+
if (input.killswitchPasses === false) {
|
|
76
|
+
return { action: 'migrate', reason: 'killswitch' };
|
|
77
|
+
}
|
|
78
|
+
for (const limit of windowReadings(input.quota)) {
|
|
79
|
+
const remaining = limit.remainingPercent;
|
|
80
|
+
if (typeof remaining === 'number' &&
|
|
81
|
+
Number.isFinite(remaining) &&
|
|
82
|
+
remaining <= 0) {
|
|
83
|
+
return {
|
|
84
|
+
action: 'migrate',
|
|
85
|
+
reason: 'exhausted',
|
|
86
|
+
window: { scope: limit.scope, label: limit.label },
|
|
87
|
+
...(typeof limit.resetsAt === 'string'
|
|
88
|
+
? { resetsAt: limit.resetsAt }
|
|
89
|
+
: {}),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// A reached credit budget is exhaustion on its own axis, judged by the same
|
|
94
|
+
// signal admission uses so the two never disagree on what "spent" means.
|
|
95
|
+
const budgetReset = budgetExhaustedResetAt(input.quota, input.now);
|
|
96
|
+
if (budgetReset) {
|
|
97
|
+
return {
|
|
98
|
+
action: 'migrate',
|
|
99
|
+
reason: 'exhausted',
|
|
100
|
+
resetsAt: budgetReset.resetsAt,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
return { action: 'retain', reason: statusClass };
|
|
104
|
+
}
|
|
105
|
+
export function sustainableWindowWeight(window, reservePercent, now) {
|
|
106
|
+
const spendable = Math.max(0, window.remainingPercent - reservePercent);
|
|
107
|
+
if (spendable <= 0)
|
|
108
|
+
return 0;
|
|
109
|
+
if (!window.resetsAt)
|
|
110
|
+
return spendable;
|
|
111
|
+
const resetMs = Date.parse(window.resetsAt);
|
|
112
|
+
// A lapsed reset cannot yield a spend rate: the divisor would clamp to
|
|
113
|
+
// MIN_RESET_HOURS and inflate the weight about sixty-fold on stale
|
|
114
|
+
// information, so the un-rate-adjusted spendable capacity is used instead.
|
|
115
|
+
if (!Number.isFinite(resetMs) || resetMs <= now)
|
|
116
|
+
return spendable;
|
|
117
|
+
const hours = Math.max((resetMs - now) / 3_600_000, MIN_RESET_HOURS);
|
|
118
|
+
return spendable / hours;
|
|
119
|
+
}
|
|
120
|
+
function compareAccountIds(left, right) {
|
|
121
|
+
if (left < right)
|
|
122
|
+
return -1;
|
|
123
|
+
if (left > right)
|
|
124
|
+
return 1;
|
|
125
|
+
return 0;
|
|
126
|
+
}
|
|
127
|
+
function candidateWeight(candidate, now) {
|
|
128
|
+
if (!candidate.quota)
|
|
129
|
+
return undefined;
|
|
130
|
+
const quotaCheckedAt = snapshotCheckedAt(candidate.quota, candidate.quotaCheckedAt);
|
|
131
|
+
if (quotaCheckedAt === undefined ||
|
|
132
|
+
now - quotaCheckedAt > QUOTA_STALENESS_MS) {
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
// Missing reserve data must leave a window usable rather than silently
|
|
136
|
+
// excluding its account.
|
|
137
|
+
// The account is as constrained as its tightest window, whichever it is.
|
|
138
|
+
const weights = windowReadings(candidate.quota).map((limit) => sustainableWindowWeight({
|
|
139
|
+
remainingPercent: limit.remainingPercent ?? Number.NaN,
|
|
140
|
+
...(limit.resetsAt === undefined ? {} : { resetsAt: limit.resetsAt }),
|
|
141
|
+
}, candidate.reservePercent[limit.label] ?? 0, now));
|
|
142
|
+
// The credit budget is a third pressure axis on its own reset clock. It has
|
|
143
|
+
// no configured reserve, and a malformed reading is ignored rather than
|
|
144
|
+
// allowed to zero the account's weight.
|
|
145
|
+
const budget = candidate.quota.budget;
|
|
146
|
+
if (budget &&
|
|
147
|
+
typeof budget.remainingPercent === 'number' &&
|
|
148
|
+
Number.isFinite(budget.remainingPercent)) {
|
|
149
|
+
weights.push(sustainableWindowWeight({
|
|
150
|
+
remainingPercent: budget.remainingPercent,
|
|
151
|
+
...(budget.resetsAt === undefined
|
|
152
|
+
? {}
|
|
153
|
+
: { resetsAt: budget.resetsAt }),
|
|
154
|
+
}, 0, now));
|
|
155
|
+
}
|
|
156
|
+
const weight = weights.length > 0 ? Math.min(...weights) : 0;
|
|
157
|
+
return weight > 0 ? { candidate, quotaCheckedAt, weight } : undefined;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Places a session: the lowest projected pressure among candidates with a
|
|
161
|
+
* fresh positive weight, else (`mode-fallback`) the first candidate in
|
|
162
|
+
* configured order, preferring one with an applicable reset credit.
|
|
163
|
+
*/
|
|
164
|
+
export function selectStickyCandidate(input) {
|
|
165
|
+
// A candidate killed by the killswitch is excluded from BOTH weighted
|
|
166
|
+
// placement and the fallback branch, which must never become a way to
|
|
167
|
+
// spend on a killed account.
|
|
168
|
+
const eligibleCandidates = input.candidates.filter((candidate) => candidate.killswitchPasses !== false);
|
|
169
|
+
if (input.candidates.length === 0) {
|
|
170
|
+
throw new Error('Cannot select a sticky candidate: input.candidates is empty');
|
|
171
|
+
}
|
|
172
|
+
if (eligibleCandidates.length === 0)
|
|
173
|
+
return undefined;
|
|
174
|
+
const weighted = eligibleCandidates
|
|
175
|
+
.map((candidate) => candidateWeight(candidate, input.now))
|
|
176
|
+
.filter((candidate) => candidate !== undefined);
|
|
177
|
+
if (weighted.length > 0) {
|
|
178
|
+
weighted.sort((left, right) => {
|
|
179
|
+
// MIN_WEIGHT only guards the division; every weight here is positive.
|
|
180
|
+
const leftScore = ((input.pendingBytes.get(left.candidate.accountId) ?? 0) +
|
|
181
|
+
input.requestBytes) /
|
|
182
|
+
Math.max(left.weight, MIN_WEIGHT);
|
|
183
|
+
const rightScore = ((input.pendingBytes.get(right.candidate.accountId) ?? 0) +
|
|
184
|
+
input.requestBytes) /
|
|
185
|
+
Math.max(right.weight, MIN_WEIGHT);
|
|
186
|
+
return (leftScore - rightScore ||
|
|
187
|
+
left.candidate.configuredOrder - right.candidate.configuredOrder ||
|
|
188
|
+
compareAccountIds(left.candidate.accountId, right.candidate.accountId));
|
|
189
|
+
});
|
|
190
|
+
const selected = weighted[0];
|
|
191
|
+
if (selected) {
|
|
192
|
+
return {
|
|
193
|
+
accountId: selected.candidate.accountId,
|
|
194
|
+
quotaCheckedAt: selected.quotaCheckedAt,
|
|
195
|
+
source: 'weighted',
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
input.onEmptyWeightedSet?.();
|
|
200
|
+
const fallback = [...eligibleCandidates].sort((left, right) => {
|
|
201
|
+
const leftHasCredits = (left.resetCreditsApplicable ?? 0) > 0 ? 1 : 0;
|
|
202
|
+
const rightHasCredits = (right.resetCreditsApplicable ?? 0) > 0 ? 1 : 0;
|
|
203
|
+
return (rightHasCredits - leftHasCredits ||
|
|
204
|
+
left.configuredOrder - right.configuredOrder ||
|
|
205
|
+
compareAccountIds(left.accountId, right.accountId));
|
|
206
|
+
})[0];
|
|
207
|
+
if (!fallback) {
|
|
208
|
+
throw new Error('Cannot select a sticky candidate: input.candidates is empty');
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
accountId: fallback.accountId,
|
|
212
|
+
quotaCheckedAt: snapshotCheckedAt(fallback.quota, fallback.quotaCheckedAt),
|
|
213
|
+
source: 'mode-fallback',
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Routes one request in `sticky-balanced` mode. A valid pin whose row is
|
|
218
|
+
* admitted, not excluded and not killed is dispatched as is. Otherwise
|
|
219
|
+
* selection runs over the non-excluded rows; each selected row admission
|
|
220
|
+
* refused is removed and selection re-runs, so the loop ends either on an
|
|
221
|
+
* admitted row or with no admissible account.
|
|
222
|
+
*/
|
|
223
|
+
export function routeSticky(input) {
|
|
224
|
+
const admission = admit(input);
|
|
225
|
+
const admitted = new Map(admission.admitted.map((row) => [row.id, row]));
|
|
226
|
+
const refusals = new Map(admission.refused.map((r) => [r.id, r]));
|
|
227
|
+
const excluded = new Set(admission.excluded.map((row) => row.id));
|
|
228
|
+
const validIds = new Set(input.rows.map((row) => row.id));
|
|
229
|
+
const pinValid = input.pin !== undefined &&
|
|
230
|
+
isPinValid(input.pin, validIds, input.identities?.get(input.pin.accountId));
|
|
231
|
+
if (pinValid && input.pin) {
|
|
232
|
+
const pinned = admitted.get(input.pin.accountId);
|
|
233
|
+
if (pinned && input.killswitch?.get(pinned.id) !== false) {
|
|
234
|
+
return {
|
|
235
|
+
outcome: 'dispatch',
|
|
236
|
+
accountId: pinned.id,
|
|
237
|
+
source: 'pin',
|
|
238
|
+
...(pinned.projection?.checkedAt === undefined
|
|
239
|
+
? {}
|
|
240
|
+
: { quotaCheckedAt: pinned.projection.checkedAt }),
|
|
241
|
+
pin: { action: 'retain' },
|
|
242
|
+
refusedSelections: [],
|
|
243
|
+
admission,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// A spent window with a future reset, a spent credit budget and a killswitch
|
|
248
|
+
// verdict all say the pinned row will not serve until some known later time,
|
|
249
|
+
// so the pin may move. A row refused for want of a usable reading, or
|
|
250
|
+
// excluded by a short rate-limit mark or refresh backoff, may serve again on
|
|
251
|
+
// the next reading, so its pin stays.
|
|
252
|
+
const pinRefusal = input.pin ? refusals.get(input.pin.accountId) : undefined;
|
|
253
|
+
const pinMoves = pinValid &&
|
|
254
|
+
input.pin !== undefined &&
|
|
255
|
+
input.refusedPinPolicy === 'move-on-confirmed-exhaustion' &&
|
|
256
|
+
(input.killswitch?.get(input.pin.accountId) === false ||
|
|
257
|
+
pinRefusal?.reason === 'exhausted' ||
|
|
258
|
+
pinRefusal?.reason === 'budget-spent');
|
|
259
|
+
const reserveFor = (row) => {
|
|
260
|
+
const perRow = typeof input.rowReservePercent === 'function'
|
|
261
|
+
? input.rowReservePercent(row)
|
|
262
|
+
: input.rowReservePercent?.get(row.id);
|
|
263
|
+
return perRow ?? input.reservePercent ?? {};
|
|
264
|
+
};
|
|
265
|
+
const scope = input.scope;
|
|
266
|
+
let candidates = input.rows
|
|
267
|
+
.map((row, configuredOrder) => ({ row, configuredOrder }))
|
|
268
|
+
.filter(({ row }) => !excluded.has(row.id))
|
|
269
|
+
.map(({ row, configuredOrder }) => {
|
|
270
|
+
const killswitchPasses = input.killswitch?.get(row.id);
|
|
271
|
+
const credits = input.resetCreditsApplicable?.get(row.id);
|
|
272
|
+
return {
|
|
273
|
+
accountId: row.id,
|
|
274
|
+
quota: row.kind === 'api-key'
|
|
275
|
+
? undefined
|
|
276
|
+
: (admitted.get(row.id)?.projection ??
|
|
277
|
+
projectQuota(row.quota, scope)),
|
|
278
|
+
reservePercent: reserveFor(row),
|
|
279
|
+
configuredOrder,
|
|
280
|
+
...(credits === undefined ? {} : { resetCreditsApplicable: credits }),
|
|
281
|
+
...(killswitchPasses === undefined ? {} : { killswitchPasses }),
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
const refusedSelections = [];
|
|
285
|
+
const unplaced = pinValid
|
|
286
|
+
? { action: 'retain' }
|
|
287
|
+
: input.pin
|
|
288
|
+
? { action: 'clear' }
|
|
289
|
+
: { action: 'none' };
|
|
290
|
+
while (candidates.length > 0) {
|
|
291
|
+
const selection = selectStickyCandidate({
|
|
292
|
+
candidates,
|
|
293
|
+
pendingBytes: input.pendingBytes ?? new Map(),
|
|
294
|
+
requestBytes: input.requestBytes,
|
|
295
|
+
now: input.now,
|
|
296
|
+
...(input.onEmptyWeightedSet
|
|
297
|
+
? { onEmptyWeightedSet: input.onEmptyWeightedSet }
|
|
298
|
+
: {}),
|
|
299
|
+
});
|
|
300
|
+
if (!selection)
|
|
301
|
+
break;
|
|
302
|
+
const refusal = refusals.get(selection.accountId);
|
|
303
|
+
if (refusal) {
|
|
304
|
+
refusedSelections.push(refusal);
|
|
305
|
+
candidates = candidates.filter((candidate) => candidate.accountId !== selection.accountId);
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
const identity = input.identities?.get(selection.accountId);
|
|
309
|
+
return {
|
|
310
|
+
outcome: 'dispatch',
|
|
311
|
+
accountId: selection.accountId,
|
|
312
|
+
source: selection.source,
|
|
313
|
+
...(selection.quotaCheckedAt === undefined
|
|
314
|
+
? {}
|
|
315
|
+
: { quotaCheckedAt: selection.quotaCheckedAt }),
|
|
316
|
+
pin: pinValid && !pinMoves
|
|
317
|
+
? { action: 'retain' }
|
|
318
|
+
: {
|
|
319
|
+
action: 'assign',
|
|
320
|
+
pin: {
|
|
321
|
+
accountId: selection.accountId,
|
|
322
|
+
inputBytes: input.requestBytes,
|
|
323
|
+
...(identity === undefined ? {} : { wireIdentity: identity }),
|
|
324
|
+
...(selection.quotaCheckedAt === undefined
|
|
325
|
+
? {}
|
|
326
|
+
: { quotaCheckedAt: selection.quotaCheckedAt }),
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
refusedSelections,
|
|
330
|
+
admission,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
outcome: 'no-admissible-account',
|
|
335
|
+
pin: unplaced,
|
|
336
|
+
refusedSelections,
|
|
337
|
+
admission,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './notifications.js';
|
|
2
|
+
export * from './port-file.js';
|
|
3
|
+
export * from './rpc-client.js';
|
|
4
|
+
export * from './rpc-server.js';
|
|
5
|
+
export * from './server-registry.js';
|
|
6
|
+
/** Pass methods bound to the caller’s logger channel; RPC uses no-op methods when no logger is supplied. */
|
|
7
|
+
export interface RpcLogChannel {
|
|
8
|
+
warn(message: string, data?: unknown): void;
|
|
9
|
+
debug(message: string, data?: unknown): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export interface ApplyRequest {
|
|
2
|
+
command: string;
|
|
3
|
+
arguments: string;
|
|
4
|
+
sessionId?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ApplyResult {
|
|
7
|
+
text: string;
|
|
8
|
+
knobs: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface OpenDialogPayload {
|
|
11
|
+
command: string;
|
|
12
|
+
text: string;
|
|
13
|
+
knobs: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface RpcNotification {
|
|
16
|
+
id: number;
|
|
17
|
+
type: 'open-dialog';
|
|
18
|
+
payload: OpenDialogPayload;
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface NotificationScope {
|
|
22
|
+
rpcRoot: string;
|
|
23
|
+
directoryPrefix: string;
|
|
24
|
+
registrationSessionId: string;
|
|
25
|
+
/**
|
|
26
|
+
* Strict session isolation. When true, `pushNotification` and
|
|
27
|
+
* `drainNotifications` refuse an absent or empty session id (throwing
|
|
28
|
+
* `RpcSessionRequiredError`) and a drain returns only that session's own
|
|
29
|
+
* notifications: no notification reaches every session. A strict scope is
|
|
30
|
+
* a separate queue from the same scope without the flag, so a lenient
|
|
31
|
+
* caller cannot push into it or drain it.
|
|
32
|
+
*
|
|
33
|
+
* Off by default: without it, a drain with no session returns every
|
|
34
|
+
* session's notifications and a push with no session reaches every
|
|
35
|
+
* session, which plugins that drain from one process-wide TUI rely on.
|
|
36
|
+
*/
|
|
37
|
+
requireSession?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* What a drain with no session id returns, and what it acknowledges.
|
|
40
|
+
*
|
|
41
|
+
* - `'all'` (default): every queued notification, broadcasts and every
|
|
42
|
+
* session's targeted ones; a sessionless acknowledgement removes
|
|
43
|
+
* nothing. A plugin that drains from one process-wide TUI relies on this.
|
|
44
|
+
* - `'broadcast-only'`: broadcasts only (notifications pushed without a
|
|
45
|
+
* session), never a session's targeted ones, for a TUI that polls before
|
|
46
|
+
* it knows its session. A sessionless acknowledgement removes the
|
|
47
|
+
* acknowledged broadcasts and leaves every targeted notification queued.
|
|
48
|
+
* It also answers `isTuiConnected(scope, undefined)`: true while any
|
|
49
|
+
* drain on the queue, with or without a session, happened within the
|
|
50
|
+
* connection window.
|
|
51
|
+
*
|
|
52
|
+
* The option governs each call made with this scope; it does not split the
|
|
53
|
+
* queue, so a push through a scope without it lands in the same queue.
|
|
54
|
+
*/
|
|
55
|
+
sessionlessDrain?: 'all' | 'broadcast-only';
|
|
56
|
+
}
|
|
57
|
+
/** A strict notification scope was used without a session id. */
|
|
58
|
+
export declare class RpcSessionRequiredError extends Error {
|
|
59
|
+
readonly operation: 'push' | 'drain';
|
|
60
|
+
constructor(operation: 'push' | 'drain');
|
|
61
|
+
}
|
|
62
|
+
/** True for a session id a strict scope accepts: a non-empty string. */
|
|
63
|
+
export declare function isSessionId(value: unknown): value is string;
|
|
64
|
+
export declare function pushNotification(scope: NotificationScope, payload: OpenDialogPayload, sessionId?: string): void;
|
|
65
|
+
export declare function drainNotifications(scope: NotificationScope, lastReceivedId?: number, sessionId?: string): RpcNotification[];
|
|
66
|
+
/**
|
|
67
|
+
* True when a TUI drained within the last 3000 ms. With a session id, that
|
|
68
|
+
* session drained. Without one, a broadcast-only scope answers whether any
|
|
69
|
+
* drain happened; a default scope answers false, since it only tracks
|
|
70
|
+
* sessions.
|
|
71
|
+
*/
|
|
72
|
+
export declare function isTuiConnected(scope: NotificationScope, sessionId: string | undefined): boolean;
|
|
73
|
+
export declare function resetNotificationsForTest(scope: NotificationScope): void;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** A strict notification scope was used without a session id. */
|
|
2
|
+
export class RpcSessionRequiredError extends Error {
|
|
3
|
+
operation;
|
|
4
|
+
constructor(operation) {
|
|
5
|
+
super(`a ${operation} on a strict notification scope needs a session id`);
|
|
6
|
+
this.name = 'RpcSessionRequiredError';
|
|
7
|
+
this.operation = operation;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/** True for a session id a strict scope accepts: a non-empty string. */
|
|
11
|
+
export function isSessionId(value) {
|
|
12
|
+
return typeof value === 'string' && value.length > 0;
|
|
13
|
+
}
|
|
14
|
+
const queues = new Map();
|
|
15
|
+
function state(scope) {
|
|
16
|
+
const key = JSON.stringify([
|
|
17
|
+
scope.rpcRoot,
|
|
18
|
+
scope.directoryPrefix,
|
|
19
|
+
scope.registrationSessionId,
|
|
20
|
+
...(scope.requireSession === true ? ['strict'] : []),
|
|
21
|
+
]);
|
|
22
|
+
let value = queues.get(key);
|
|
23
|
+
if (!value) {
|
|
24
|
+
value = {
|
|
25
|
+
queue: [],
|
|
26
|
+
nextId: 1,
|
|
27
|
+
lastDrainAtBySession: new Map(),
|
|
28
|
+
lastDrainAtAny: 0,
|
|
29
|
+
};
|
|
30
|
+
queues.set(key, value);
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
const QUEUE_CAP = 100;
|
|
35
|
+
const TUI_CONNECTED_WINDOW_MS = 3_000;
|
|
36
|
+
export function pushNotification(scope, payload, sessionId) {
|
|
37
|
+
if (scope.requireSession === true && !isSessionId(sessionId))
|
|
38
|
+
throw new RpcSessionRequiredError('push');
|
|
39
|
+
const value = state(scope);
|
|
40
|
+
value.queue.push({
|
|
41
|
+
id: value.nextId++,
|
|
42
|
+
type: 'open-dialog',
|
|
43
|
+
payload,
|
|
44
|
+
sessionId,
|
|
45
|
+
});
|
|
46
|
+
if (value.queue.length > QUEUE_CAP)
|
|
47
|
+
value.queue = value.queue.slice(-QUEUE_CAP);
|
|
48
|
+
}
|
|
49
|
+
export function drainNotifications(scope, lastReceivedId = 0, sessionId) {
|
|
50
|
+
// A strict queue holds only session-scoped notifications (its push refuses
|
|
51
|
+
// the rest), so the ordinary match below already gives a strict drain
|
|
52
|
+
// nothing but its own session's notifications.
|
|
53
|
+
if (scope.requireSession === true && !isSessionId(sessionId))
|
|
54
|
+
throw new RpcSessionRequiredError('drain');
|
|
55
|
+
const value = state(scope);
|
|
56
|
+
const now = Date.now();
|
|
57
|
+
value.lastDrainAtAny = now;
|
|
58
|
+
if (sessionId !== undefined)
|
|
59
|
+
value.lastDrainAtBySession.set(sessionId, now);
|
|
60
|
+
const broadcastOnly = scope.sessionlessDrain === 'broadcast-only';
|
|
61
|
+
const matches = (n) => sessionId === undefined
|
|
62
|
+
? !broadcastOnly || n.sessionId === undefined
|
|
63
|
+
: n.sessionId === undefined || n.sessionId === sessionId;
|
|
64
|
+
if (lastReceivedId > 0) {
|
|
65
|
+
value.queue = value.queue.filter((n) => {
|
|
66
|
+
if (n.id > lastReceivedId)
|
|
67
|
+
return true;
|
|
68
|
+
// A sessionless ack in broadcast-only mode consumes the broadcasts it
|
|
69
|
+
// was shown; in the default mode it consumes nothing, since it was
|
|
70
|
+
// shown targeted notifications other sessions still have to receive.
|
|
71
|
+
if (sessionId === undefined)
|
|
72
|
+
return !broadcastOnly || n.sessionId !== undefined;
|
|
73
|
+
return n.sessionId !== sessionId;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return value.queue.filter((n) => n.id > lastReceivedId && matches(n));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* True when a TUI drained within the last 3000 ms. With a session id, that
|
|
80
|
+
* session drained. Without one, a broadcast-only scope answers whether any
|
|
81
|
+
* drain happened; a default scope answers false, since it only tracks
|
|
82
|
+
* sessions.
|
|
83
|
+
*/
|
|
84
|
+
export function isTuiConnected(scope, sessionId) {
|
|
85
|
+
const now = Date.now();
|
|
86
|
+
const value = state(scope);
|
|
87
|
+
const at = sessionId !== undefined
|
|
88
|
+
? (value.lastDrainAtBySession.get(sessionId) ?? 0)
|
|
89
|
+
: scope.sessionlessDrain === 'broadcast-only'
|
|
90
|
+
? value.lastDrainAtAny
|
|
91
|
+
: 0;
|
|
92
|
+
return at > 0 && now - at < TUI_CONNECTED_WINDOW_MS;
|
|
93
|
+
}
|
|
94
|
+
export function resetNotificationsForTest(scope) {
|
|
95
|
+
const value = state(scope);
|
|
96
|
+
value.queue = [];
|
|
97
|
+
value.nextId = 1;
|
|
98
|
+
value.lastDrainAtBySession.clear();
|
|
99
|
+
value.lastDrainAtAny = 0;
|
|
100
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RpcLogChannel } from './index.js';
|
|
2
|
+
export interface PortFileEntry {
|
|
3
|
+
port: number;
|
|
4
|
+
token: string;
|
|
5
|
+
pid: number;
|
|
6
|
+
startedAt: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function createManagedRpcStateDirPredicate(directoryPrefix: string): (name: string) => boolean;
|
|
9
|
+
export declare function isManagedRpcStateDir(name: string, directoryPrefix: string): boolean;
|
|
10
|
+
export declare function getRpcDir(rpcRoot: string, directoryPrefix: string, projectDirectory: string): string;
|
|
11
|
+
export declare function writePortFile(dir: string, entry: {
|
|
12
|
+
port: number;
|
|
13
|
+
token: string;
|
|
14
|
+
pid: number;
|
|
15
|
+
}, options?: {
|
|
16
|
+
secureDir?: boolean;
|
|
17
|
+
beforeWrite?: () => void | Promise<void>;
|
|
18
|
+
/** Test seam for forcing staging-name collisions; defaults to randomUUID. */
|
|
19
|
+
stageName?: () => string;
|
|
20
|
+
}): Promise<string>;
|
|
21
|
+
export declare function sweepRpcState(root: string, activeDir: string, isManagedDir: (name: string) => boolean, log?: RpcLogChannel): Promise<void>;
|
|
22
|
+
export interface DiscoverPortFileOptions {
|
|
23
|
+
/**
|
|
24
|
+
* Return only the expected PID's entry, or null; never fall back to
|
|
25
|
+
* another live server. Without an expected PID nothing matches, so the
|
|
26
|
+
* result is null. Off by default, when a missing or unmatched expected PID
|
|
27
|
+
* falls back to the newest live entry.
|
|
28
|
+
*/
|
|
29
|
+
exactPid?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Internal cache validation: probe only the selected file and its PID. */
|
|
32
|
+
export declare function portFileIdentity(dir: string, entry: PortFileEntry): Promise<string | null>;
|
|
33
|
+
export declare function discoverPortFile(dir: string, expectedPid?: number, options?: DiscoverPortFileOptions): Promise<PortFileEntry | null>;
|