@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
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File-backed logger for the OpenTUI sidebar tree.
|
|
3
|
-
*
|
|
4
|
-
* The TUI renders directly into the host terminal. Any stray write to the
|
|
5
|
-
* terminal from inside the render path (or any module it imports) corrupts
|
|
6
|
-
* the frame buffer — a single byte out of place shoves every subsequent
|
|
7
|
-
* cell right and breaks the sidebar.
|
|
8
|
-
*
|
|
9
|
-
* This logger writes to a rotating file under the host's log directory and
|
|
10
|
-
* never touches stdout/stderr. The plugin already wires up the same kind of
|
|
11
|
-
* file logger via `debug.ts`; the sidebar gets its own file so log lines
|
|
12
|
-
* from this tree are easy to attribute.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
appendFileSync,
|
|
17
|
-
chmodSync,
|
|
18
|
-
existsSync,
|
|
19
|
-
mkdirSync,
|
|
20
|
-
readFileSync,
|
|
21
|
-
statSync,
|
|
22
|
-
writeFileSync,
|
|
23
|
-
} from 'node:fs'
|
|
24
|
-
import { homedir } from 'node:os'
|
|
25
|
-
import { dirname, join } from 'node:path'
|
|
26
|
-
|
|
27
|
-
export type TuiLogLevel = 'debug' | 'info' | 'warn' | 'error'
|
|
28
|
-
|
|
29
|
-
export interface TuiLogger {
|
|
30
|
-
debug(message: string, extra?: Record<string, unknown>): void
|
|
31
|
-
info(message: string, extra?: Record<string, unknown>): void
|
|
32
|
-
warn(message: string, extra?: Record<string, unknown>): void
|
|
33
|
-
error(message: string, extra?: Record<string, unknown>): void
|
|
34
|
-
/** Resolve the path the logger writes to. `undefined` when file logging is disabled. */
|
|
35
|
-
getLogPath(): string | undefined
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const LOG_PREFIX = '[opencode-antigravity-auth/tui]'
|
|
39
|
-
const DEFAULT_MAX_BYTES = 1_000_000
|
|
40
|
-
const MAX_KEEP_LINES = 200
|
|
41
|
-
/**
|
|
42
|
-
* Owner-read/write only — matches the rest of the plugin's on-disk
|
|
43
|
-
* sensitive state (account storage, signature cache). Windows ignores
|
|
44
|
-
* POSIX mode bits so the assertion in the test is best-effort there.
|
|
45
|
-
*/
|
|
46
|
-
const FILE_MODE = 0o600
|
|
47
|
-
|
|
48
|
-
interface FileLoggerOptions {
|
|
49
|
-
filePath: string
|
|
50
|
-
maxBytes?: number
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Resolve the on-disk path for the TUI's log file.
|
|
55
|
-
*
|
|
56
|
-
* - `ANTIGRAVITY_AUTH_TUI_LOG_FILE` wins when set (used by tests so they
|
|
57
|
-
* never touch a real user log file).
|
|
58
|
-
* - Otherwise write under `<xdg-state>/cortexkit/antigravity-auth/tui.log`.
|
|
59
|
-
*
|
|
60
|
-
* Falls back to a temp file when the host path cannot be resolved (e.g. no
|
|
61
|
-
* home directory on a hostile CI box); the file logger itself never throws,
|
|
62
|
-
* it just drops the line.
|
|
63
|
-
*/
|
|
64
|
-
export function resolveTuiLogPath(): string {
|
|
65
|
-
const override = process.env.ANTIGRAVITY_AUTH_TUI_LOG_FILE
|
|
66
|
-
if (override && override.trim().length > 0) return override
|
|
67
|
-
const base = process.env.XDG_STATE_HOME || join(homedir(), '.local', 'state')
|
|
68
|
-
return join(base, 'cortexkit', 'antigravity-auth', 'tui.log')
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function createTuiFileLogger(
|
|
72
|
-
options?: Partial<FileLoggerOptions>,
|
|
73
|
-
): TuiLogger {
|
|
74
|
-
const filePath = options?.filePath ?? resolveTuiLogPath()
|
|
75
|
-
const maxBytes = options?.maxBytes ?? DEFAULT_MAX_BYTES
|
|
76
|
-
return createFileLogger({ filePath, maxBytes })
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function createFileLogger(options: FileLoggerOptions): TuiLogger {
|
|
80
|
-
const { filePath, maxBytes = DEFAULT_MAX_BYTES } = options
|
|
81
|
-
|
|
82
|
-
const rotateIfNeeded = (): void => {
|
|
83
|
-
try {
|
|
84
|
-
if (!existsSync(filePath)) return
|
|
85
|
-
const stat = statSync(filePath)
|
|
86
|
-
if (stat.size < maxBytes) return
|
|
87
|
-
// Tail-truncate: keep the last MAX_KEEP_LINES, drop the rest. Cheap,
|
|
88
|
-
// bounded, and good enough for a sidecar debug stream.
|
|
89
|
-
const text = readFileSync(filePath, 'utf-8')
|
|
90
|
-
const lines = text.split('\n')
|
|
91
|
-
const keepFrom = Math.max(0, lines.length - MAX_KEEP_LINES)
|
|
92
|
-
const tail = lines.slice(keepFrom).join('\n')
|
|
93
|
-
writeFileSync(filePath, tail, 'utf-8')
|
|
94
|
-
// `writeFileSync` over an existing file keeps its mode; we rotate
|
|
95
|
-
// the file specifically to enforce owner-only access, so re-assert
|
|
96
|
-
// the mode after the truncation.
|
|
97
|
-
chmodSync(filePath, FILE_MODE)
|
|
98
|
-
} catch {
|
|
99
|
-
// Best-effort; ignore rotation errors.
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const write = (
|
|
104
|
-
level: TuiLogLevel,
|
|
105
|
-
message: string,
|
|
106
|
-
extra?: Record<string, unknown>,
|
|
107
|
-
): void => {
|
|
108
|
-
try {
|
|
109
|
-
rotateIfNeeded()
|
|
110
|
-
// Enforce 0o700 on the parent directory even when it already
|
|
111
|
-
// exists — `mkdirSync({ recursive: true, mode })` only sets the
|
|
112
|
-
// mode on the leaf directory it creates, so an existing leaky
|
|
113
|
-
// directory would keep its old mode. The post-hoc chmodSync
|
|
114
|
-
// closes the gap.
|
|
115
|
-
mkdirSync(dirname(filePath), { recursive: true, mode: 0o700 })
|
|
116
|
-
chmodSync(dirname(filePath), 0o700)
|
|
117
|
-
const payload: Record<string, unknown> = {
|
|
118
|
-
ts: Date.now(),
|
|
119
|
-
level,
|
|
120
|
-
message,
|
|
121
|
-
}
|
|
122
|
-
if (extra && Object.keys(extra).length > 0) payload.extra = extra
|
|
123
|
-
// `mode: 0o600` so the log file is owner-only — the same default the
|
|
124
|
-
// plugin's account storage applies. `appendFileSync` only honours the
|
|
125
|
-
// mode flag when the file is created, so existing files keep whatever
|
|
126
|
-
// mode they had. `chmodSync` below re-asserts the mode after every
|
|
127
|
-
// append so a leaked-permissions file is repaired on the next write.
|
|
128
|
-
appendFileSync(filePath, `${LOG_PREFIX} ${JSON.stringify(payload)}\n`, {
|
|
129
|
-
encoding: 'utf-8',
|
|
130
|
-
mode: FILE_MODE,
|
|
131
|
-
})
|
|
132
|
-
chmodSync(filePath, FILE_MODE)
|
|
133
|
-
} catch {
|
|
134
|
-
// Drop the line — file logging must never throw into the render path.
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return {
|
|
139
|
-
debug: (message, extra) => write('debug', message, extra),
|
|
140
|
-
info: (message, extra) => write('info', message, extra),
|
|
141
|
-
warn: (message, extra) => write('warn', message, extra),
|
|
142
|
-
error: (message, extra) => write('error', message, extra),
|
|
143
|
-
getLogPath: () => filePath,
|
|
144
|
-
}
|
|
145
|
-
}
|
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto'
|
|
2
|
-
import { watch } from 'node:fs'
|
|
3
|
-
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises'
|
|
4
|
-
import { homedir } from 'node:os'
|
|
5
|
-
import { basename, dirname, join } from 'node:path'
|
|
6
|
-
import {
|
|
7
|
-
clearTimeout as nativeClearTimeout,
|
|
8
|
-
setTimeout as nativeSetTimeout,
|
|
9
|
-
} from 'node:timers'
|
|
10
|
-
import { acquireFencedFileLock } from '@cortexkit/antigravity-auth-core/file-lock'
|
|
11
|
-
import { applyEdits, modify, type ParseError, parse } from 'jsonc-parser'
|
|
12
|
-
|
|
13
|
-
export const TUI_PREFS_FILE_ENV = 'OPENCODE_TUI_PREFERENCES_FILE'
|
|
14
|
-
const FILE_NAME = 'tui-preferences.jsonc'
|
|
15
|
-
const PREFERENCES_LOCK_NAME = 'preferences'
|
|
16
|
-
const PREFERENCES_LOCK_TTL_MS = 10_000
|
|
17
|
-
const PREFERENCES_LOCK_TIMEOUT_MS = 2_000
|
|
18
|
-
const PREFERENCES_LOCK_RETRY_MS = 25
|
|
19
|
-
|
|
20
|
-
// Shared preferences file for opencode TUI plugins. One top-level key per
|
|
21
|
-
// plugin (short name, e.g. "antigravity-auth"). The file is optional: every
|
|
22
|
-
// reader must fall back to defaults when it is missing or malformed.
|
|
23
|
-
export function getTuiPreferencesFile(): string {
|
|
24
|
-
const override = process.env[TUI_PREFS_FILE_ENV]
|
|
25
|
-
if (override) return override
|
|
26
|
-
const configDir =
|
|
27
|
-
process.env.OPENCODE_CONFIG_DIR ||
|
|
28
|
-
join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'opencode')
|
|
29
|
-
return join(configDir, FILE_NAME)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
33
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Tolerant read: missing file, parse errors, or a non-object root all resolve
|
|
37
|
-
// to {} so the sidebar never crashes on user-edited content. jsonc-parser's
|
|
38
|
-
// fault-tolerant parse can still hand back a partial object for an
|
|
39
|
-
// unterminated/bracketed file or trailing garbage, so we collect errors and
|
|
40
|
-
// treat any reported fault as malformed.
|
|
41
|
-
export async function readTuiPreferencesFile(): Promise<
|
|
42
|
-
Record<string, unknown>
|
|
43
|
-
> {
|
|
44
|
-
try {
|
|
45
|
-
const raw = await readFile(getTuiPreferencesFile(), 'utf8')
|
|
46
|
-
const errors: ParseError[] = []
|
|
47
|
-
const root: unknown = parse(raw, errors, { allowTrailingComma: true })
|
|
48
|
-
if (errors.length > 0) return {}
|
|
49
|
-
return isRecord(root) ? root : {}
|
|
50
|
-
} catch {
|
|
51
|
-
return {}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const PLUGIN_KEY = 'antigravity-auth'
|
|
56
|
-
export const DEFAULT_SLOT_ORDER = 160
|
|
57
|
-
|
|
58
|
-
export interface AntigravityAuthTuiPrefs {
|
|
59
|
-
forceToTop: boolean
|
|
60
|
-
order: number
|
|
61
|
-
startCollapsed: boolean
|
|
62
|
-
rememberCollapsed: boolean
|
|
63
|
-
// null = never persisted; seed the UI from startCollapsed instead.
|
|
64
|
-
collapsed: boolean | null
|
|
65
|
-
pollMs: number
|
|
66
|
-
refreshDebounceMs: number
|
|
67
|
-
header: {
|
|
68
|
-
label: string
|
|
69
|
-
showVersion: boolean
|
|
70
|
-
}
|
|
71
|
-
sections: {
|
|
72
|
-
quota: boolean
|
|
73
|
-
fallbackAccounts: boolean
|
|
74
|
-
routing: boolean
|
|
75
|
-
health: boolean
|
|
76
|
-
}
|
|
77
|
-
appearance: {
|
|
78
|
-
barWidth: number
|
|
79
|
-
barFilledChar: string
|
|
80
|
-
barEmptyChar: string
|
|
81
|
-
warnThreshold: number
|
|
82
|
-
errorThreshold: number
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type AppearancePrefs = AntigravityAuthTuiPrefs['appearance']
|
|
87
|
-
|
|
88
|
-
export const DEFAULT_PREFS: AntigravityAuthTuiPrefs = {
|
|
89
|
-
forceToTop: false,
|
|
90
|
-
order: DEFAULT_SLOT_ORDER,
|
|
91
|
-
startCollapsed: false,
|
|
92
|
-
rememberCollapsed: true,
|
|
93
|
-
collapsed: null,
|
|
94
|
-
pollMs: 1500,
|
|
95
|
-
refreshDebounceMs: 200,
|
|
96
|
-
header: { label: 'ANTIGRAVITY', showVersion: true },
|
|
97
|
-
sections: {
|
|
98
|
-
quota: true,
|
|
99
|
-
fallbackAccounts: true,
|
|
100
|
-
routing: true,
|
|
101
|
-
health: true,
|
|
102
|
-
},
|
|
103
|
-
appearance: {
|
|
104
|
-
barWidth: 10,
|
|
105
|
-
barFilledChar: '█',
|
|
106
|
-
barEmptyChar: '░',
|
|
107
|
-
warnThreshold: 50,
|
|
108
|
-
errorThreshold: 80,
|
|
109
|
-
},
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function bool(value: unknown, fallback: boolean): boolean {
|
|
113
|
-
return typeof value === 'boolean' ? value : fallback
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function int(
|
|
117
|
-
value: unknown,
|
|
118
|
-
fallback: number,
|
|
119
|
-
min: number,
|
|
120
|
-
max: number,
|
|
121
|
-
): number {
|
|
122
|
-
if (typeof value !== 'number' || !Number.isFinite(value)) return fallback
|
|
123
|
-
return Math.min(Math.max(Math.round(value), min), max)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function label(value: unknown, fallback: string, maxLength: number): string {
|
|
127
|
-
if (typeof value !== 'string' || value.length === 0) return fallback
|
|
128
|
-
return value.slice(0, maxLength)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function char(value: unknown, fallback: string): string {
|
|
132
|
-
if (typeof value !== 'string') return fallback
|
|
133
|
-
const first = [...value][0]
|
|
134
|
-
return first ?? fallback
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Per-key validation: every value is independently clamped/defaulted so one
|
|
138
|
-
// bad entry never poisons the rest. Never throws.
|
|
139
|
-
//
|
|
140
|
-
// Antigravity reads the thresholds as remaining-percent: healthy when the
|
|
141
|
-
// remaining is above `warnThreshold`, warn between `errorThreshold` and
|
|
142
|
-
// `warnThreshold`, error below `errorThreshold`. So `errorThreshold` is the
|
|
143
|
-
// smaller number (the danger floor) and must stay strictly below `warnThreshold`.
|
|
144
|
-
export function resolveAntigravityAuthPrefs(
|
|
145
|
-
root: Record<string, unknown>,
|
|
146
|
-
): AntigravityAuthTuiPrefs {
|
|
147
|
-
const entry = root[PLUGIN_KEY]
|
|
148
|
-
if (!isRecord(entry)) return structuredClone(DEFAULT_PREFS)
|
|
149
|
-
|
|
150
|
-
const d = DEFAULT_PREFS
|
|
151
|
-
const header = isRecord(entry.header) ? entry.header : {}
|
|
152
|
-
const sections = isRecord(entry.sections) ? entry.sections : {}
|
|
153
|
-
const appearance = isRecord(entry.appearance) ? entry.appearance : {}
|
|
154
|
-
|
|
155
|
-
const configuredWarnThreshold = int(
|
|
156
|
-
appearance.warnThreshold,
|
|
157
|
-
d.appearance.warnThreshold,
|
|
158
|
-
0,
|
|
159
|
-
99,
|
|
160
|
-
)
|
|
161
|
-
const configuredErrorThreshold = int(
|
|
162
|
-
appearance.errorThreshold,
|
|
163
|
-
d.appearance.errorThreshold,
|
|
164
|
-
0,
|
|
165
|
-
100,
|
|
166
|
-
)
|
|
167
|
-
// Older preferences stored remaining-percent thresholds, whose error value
|
|
168
|
-
// was lower than warn. Convert that shape while accepting the fleet's new
|
|
169
|
-
// used-percent ordering without a preferences schema migration.
|
|
170
|
-
const [warnThreshold, errorThreshold] =
|
|
171
|
-
configuredErrorThreshold < configuredWarnThreshold
|
|
172
|
-
? [100 - configuredWarnThreshold, 100 - configuredErrorThreshold]
|
|
173
|
-
: [
|
|
174
|
-
configuredWarnThreshold,
|
|
175
|
-
Math.max(
|
|
176
|
-
configuredErrorThreshold,
|
|
177
|
-
Math.min(configuredWarnThreshold + 1, 100),
|
|
178
|
-
),
|
|
179
|
-
]
|
|
180
|
-
|
|
181
|
-
return {
|
|
182
|
-
forceToTop: bool(entry.forceToTop, d.forceToTop),
|
|
183
|
-
order: int(entry.order, d.order, -10000, 10000),
|
|
184
|
-
startCollapsed: bool(entry.startCollapsed, d.startCollapsed),
|
|
185
|
-
rememberCollapsed: bool(entry.rememberCollapsed, d.rememberCollapsed),
|
|
186
|
-
collapsed: typeof entry.collapsed === 'boolean' ? entry.collapsed : null,
|
|
187
|
-
pollMs: int(entry.pollMs, d.pollMs, 500, 30000),
|
|
188
|
-
refreshDebounceMs: int(
|
|
189
|
-
entry.refreshDebounceMs,
|
|
190
|
-
d.refreshDebounceMs,
|
|
191
|
-
50,
|
|
192
|
-
5000,
|
|
193
|
-
),
|
|
194
|
-
header: {
|
|
195
|
-
label: label(header.label, d.header.label, 20),
|
|
196
|
-
showVersion: bool(header.showVersion, d.header.showVersion),
|
|
197
|
-
},
|
|
198
|
-
sections: {
|
|
199
|
-
quota: bool(sections.quota, d.sections.quota),
|
|
200
|
-
fallbackAccounts: bool(
|
|
201
|
-
sections.fallbackAccounts,
|
|
202
|
-
d.sections.fallbackAccounts,
|
|
203
|
-
),
|
|
204
|
-
routing: bool(sections.routing, d.sections.routing),
|
|
205
|
-
health: bool(sections.health, d.sections.health),
|
|
206
|
-
},
|
|
207
|
-
appearance: {
|
|
208
|
-
barWidth: int(appearance.barWidth, d.appearance.barWidth, 4, 40),
|
|
209
|
-
barFilledChar: char(appearance.barFilledChar, d.appearance.barFilledChar),
|
|
210
|
-
barEmptyChar: char(appearance.barEmptyChar, d.appearance.barEmptyChar),
|
|
211
|
-
warnThreshold,
|
|
212
|
-
errorThreshold,
|
|
213
|
-
},
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const FORCE_TOP_BASE = -100000
|
|
218
|
-
|
|
219
|
-
// Shared forceToTop convention: forced plugins sort below FORCE_TOP_BASE,
|
|
220
|
-
// ordered among themselves by their top-level key's position in the file, so
|
|
221
|
-
// users reprioritize by reordering keys. The user-facing `order` knob clamps
|
|
222
|
-
// to -10000..10000, strictly above the forced band, so a manual order can
|
|
223
|
-
// never beat forceToTop. Host slots render ascending by order; opencode's
|
|
224
|
-
// built-ins occupy 100-500.
|
|
225
|
-
//
|
|
226
|
-
// Key-naming requirement: plugin keys must be non-integer-like short names
|
|
227
|
-
// (e.g. "antigravity-auth"). JavaScript object key iteration order hoists
|
|
228
|
-
// integer-like keys ("0", "1", "42") ahead of any string keys, which would
|
|
229
|
-
// skew the indexOf-based ordering of forced plugins. The shared
|
|
230
|
-
// `tui-preferences.jsonc` convention requires non-numeric names, so this
|
|
231
|
-
// implementation does not paper over the JS quirk.
|
|
232
|
-
export function computeEffectiveOrder(
|
|
233
|
-
root: Record<string, unknown>,
|
|
234
|
-
pluginKey: string,
|
|
235
|
-
defaultOrder: number,
|
|
236
|
-
): number {
|
|
237
|
-
const entry = root[pluginKey]
|
|
238
|
-
if (!isRecord(entry)) return defaultOrder
|
|
239
|
-
if (entry.forceToTop === true) {
|
|
240
|
-
return FORCE_TOP_BASE + Object.keys(root).indexOf(pluginKey)
|
|
241
|
-
}
|
|
242
|
-
return int(entry.order, defaultOrder, -10000, 10000)
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const TEMPLATE = `// Shared preferences for opencode TUI plugins.
|
|
246
|
-
// One top-level key per plugin (short name). See each plugin's README for
|
|
247
|
-
// its supported settings. This file is safe to hand-edit; plugins update
|
|
248
|
-
// individual keys in place and preserve comments.
|
|
249
|
-
{}
|
|
250
|
-
`
|
|
251
|
-
|
|
252
|
-
type JsonValue = string | number | boolean | null
|
|
253
|
-
|
|
254
|
-
async function acquirePreferencesLock(file: string) {
|
|
255
|
-
const deadline = Date.now() + PREFERENCES_LOCK_TIMEOUT_MS
|
|
256
|
-
for (;;) {
|
|
257
|
-
const lock = await acquireFencedFileLock({
|
|
258
|
-
path: file,
|
|
259
|
-
name: PREFERENCES_LOCK_NAME,
|
|
260
|
-
ttlMs: PREFERENCES_LOCK_TTL_MS,
|
|
261
|
-
renew: true,
|
|
262
|
-
})
|
|
263
|
-
if (lock) return lock
|
|
264
|
-
if (Date.now() >= deadline) {
|
|
265
|
-
throw new Error(`Timed out acquiring TUI preferences lock: ${file}`)
|
|
266
|
-
}
|
|
267
|
-
await new Promise<void>((resolve) =>
|
|
268
|
-
nativeSetTimeout(resolve, PREFERENCES_LOCK_RETRY_MS),
|
|
269
|
-
)
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
async function writePreference(
|
|
274
|
-
pluginKey: string,
|
|
275
|
-
path: string[],
|
|
276
|
-
value: JsonValue,
|
|
277
|
-
): Promise<void> {
|
|
278
|
-
const file = getTuiPreferencesFile()
|
|
279
|
-
await mkdir(dirname(file), { recursive: true })
|
|
280
|
-
const lock = await acquirePreferencesLock(file)
|
|
281
|
-
const tmp = `${file}.${process.pid}.${randomUUID()}.tmp`
|
|
282
|
-
try {
|
|
283
|
-
let text: string
|
|
284
|
-
try {
|
|
285
|
-
text = await readFile(file, 'utf8')
|
|
286
|
-
} catch {
|
|
287
|
-
text = ''
|
|
288
|
-
}
|
|
289
|
-
if (text.trim() === '') text = TEMPLATE
|
|
290
|
-
const edits = modify(text, [pluginKey, ...path], value, {
|
|
291
|
-
formattingOptions: { insertSpaces: true, tabSize: 2 },
|
|
292
|
-
})
|
|
293
|
-
const next = applyEdits(text, edits)
|
|
294
|
-
await writeFile(tmp, next, { encoding: 'utf8', mode: 0o600 })
|
|
295
|
-
await lock.assertOwned()
|
|
296
|
-
await rename(tmp, file)
|
|
297
|
-
} finally {
|
|
298
|
-
await rm(tmp, { force: true }).catch(() => {})
|
|
299
|
-
await lock.release()
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
let writeChain: Promise<void> = Promise.resolve()
|
|
304
|
-
|
|
305
|
-
// Writes are serialized on a promise chain: each update re-reads the file,
|
|
306
|
-
// applies a minimal comment-preserving edit to one property, and replaces the
|
|
307
|
-
// file atomically (temp + rename in the same directory). Best-effort by
|
|
308
|
-
// design — preferences are never worth crashing the TUI over.
|
|
309
|
-
export function queueTuiPreferenceUpdate(
|
|
310
|
-
pluginKey: string,
|
|
311
|
-
path: string[],
|
|
312
|
-
value: JsonValue,
|
|
313
|
-
): Promise<void> {
|
|
314
|
-
writeChain = writeChain
|
|
315
|
-
.then(() => writePreference(pluginKey, path, value))
|
|
316
|
-
.catch(() => {})
|
|
317
|
-
return writeChain
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const WATCH_DEBOUNCE_MS = 150
|
|
321
|
-
const WATCH_POLL_MS = 100
|
|
322
|
-
|
|
323
|
-
// Watches the directory rather than the file: editors and our own atomic
|
|
324
|
-
// writes replace the file via rename, which kills file-level watchers.
|
|
325
|
-
//
|
|
326
|
-
// Filtering is two-stage:
|
|
327
|
-
// 1. Filename pre-filter: only debounce events for the preferences file
|
|
328
|
-
// name, or our atomic-write temp file. This is a cheap first pass that
|
|
329
|
-
// drops the common case (unrelated sibling files).
|
|
330
|
-
// 2. Content check inside the debounce: after the timer fires, re-read
|
|
331
|
-
// the file and compare it against the last seen content. Only fire
|
|
332
|
-
// `onChange` when the content actually changed. This is the authority.
|
|
333
|
-
// Some platforms (notably macOS FSEvents and a few inotify backends)
|
|
334
|
-
// can misattribute a rename of an unrelated sibling file to the
|
|
335
|
-
// real preferences filename in addition to emitting the sibling's
|
|
336
|
-
// own event, so a name-only filter still produces a stray callback.
|
|
337
|
-
// A content comparison is robust against that, against coalesced
|
|
338
|
-
// events, and against mtime granularity.
|
|
339
|
-
//
|
|
340
|
-
// Returns a disposer; never throws.
|
|
341
|
-
export function watchTuiPreferences(onChange: () => void): () => void {
|
|
342
|
-
const file = getTuiPreferencesFile()
|
|
343
|
-
const name = basename(file)
|
|
344
|
-
let timer: ReturnType<typeof nativeSetTimeout> | null = null
|
|
345
|
-
let lastSeen: string | null = null
|
|
346
|
-
let observedEvent = false
|
|
347
|
-
let disposed = false
|
|
348
|
-
|
|
349
|
-
const checkForChange = async () => {
|
|
350
|
-
const text = await readFile(file, 'utf8').catch(() => null)
|
|
351
|
-
if (disposed || text === null) return
|
|
352
|
-
if (text === lastSeen) return
|
|
353
|
-
lastSeen = text
|
|
354
|
-
onChange()
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
const scheduleCheck = () => {
|
|
358
|
-
observedEvent = true
|
|
359
|
-
if (timer) nativeClearTimeout(timer)
|
|
360
|
-
timer = nativeSetTimeout(() => {
|
|
361
|
-
timer = null
|
|
362
|
-
void checkForChange()
|
|
363
|
-
}, WATCH_DEBOUNCE_MS)
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// Seed asynchronously. If a real file event arrives before the read resolves,
|
|
367
|
-
// do not let the seed overwrite that pending change; the debounced re-read
|
|
368
|
-
// will compare against the previous value and fire.
|
|
369
|
-
void readFile(file, 'utf8')
|
|
370
|
-
.then((text) => {
|
|
371
|
-
if (!observedEvent && lastSeen === null) lastSeen = text
|
|
372
|
-
})
|
|
373
|
-
.catch(() => {})
|
|
374
|
-
|
|
375
|
-
try {
|
|
376
|
-
const watcher = watch(dirname(file), (_event, filename) => {
|
|
377
|
-
// Exact match against the preferences file name, plus the temp file
|
|
378
|
-
// we use for atomic writes (carrying our pid + `.tmp`).
|
|
379
|
-
const isOurs =
|
|
380
|
-
filename === name ||
|
|
381
|
-
(filename?.startsWith(`${name}.`) && filename.endsWith('.tmp'))
|
|
382
|
-
if (filename != null && !isOurs) return
|
|
383
|
-
scheduleCheck()
|
|
384
|
-
})
|
|
385
|
-
|
|
386
|
-
// Bun's fs.watch can miss atomic temp-file rename updates on some
|
|
387
|
-
// backends, so keep a low-cost polling loop as the correctness path.
|
|
388
|
-
// Use recursive timers instead of fs.watchFile because watchFile can keep
|
|
389
|
-
// Bun test processes alive long after unwatchFile().
|
|
390
|
-
let pollTimer: ReturnType<typeof nativeSetTimeout> | null = null
|
|
391
|
-
let pollInFlight = false
|
|
392
|
-
const schedulePoll = () => {
|
|
393
|
-
if (disposed || pollTimer) return
|
|
394
|
-
pollTimer = nativeSetTimeout(() => {
|
|
395
|
-
pollTimer = null
|
|
396
|
-
if (disposed || pollInFlight) return
|
|
397
|
-
pollInFlight = true
|
|
398
|
-
void checkForChange().finally(() => {
|
|
399
|
-
pollInFlight = false
|
|
400
|
-
schedulePoll()
|
|
401
|
-
})
|
|
402
|
-
}, WATCH_POLL_MS)
|
|
403
|
-
pollTimer.unref?.()
|
|
404
|
-
}
|
|
405
|
-
schedulePoll()
|
|
406
|
-
|
|
407
|
-
return () => {
|
|
408
|
-
disposed = true
|
|
409
|
-
if (timer) nativeClearTimeout(timer)
|
|
410
|
-
if (pollTimer) nativeClearTimeout(pollTimer)
|
|
411
|
-
watcher.close()
|
|
412
|
-
}
|
|
413
|
-
} catch {
|
|
414
|
-
return () => {}
|
|
415
|
-
}
|
|
416
|
-
}
|