@cortexkit/opencode-antigravity-auth 1.0.1 → 2.0.0
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 +225 -553
- package/dist/cli.js +3790 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18951 -13145
- package/dist/index.js.map +4 -4
- package/dist/src/antigravity/oauth.d.ts +1 -1
- package/dist/src/antigravity/oauth.js +1 -1
- package/dist/src/cli.d.ts +21 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +237 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/hooks/auto-update-checker/cache.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/cache.js +13 -13
- package/dist/src/hooks/auto-update-checker/cache.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/checker.d.ts +1 -1
- package/dist/src/hooks/auto-update-checker/checker.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/checker.js +75 -51
- package/dist/src/hooks/auto-update-checker/checker.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/constants.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/constants.js +12 -12
- package/dist/src/hooks/auto-update-checker/constants.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/index.d.ts +6 -6
- package/dist/src/hooks/auto-update-checker/index.d.ts.map +1 -1
- package/dist/src/hooks/auto-update-checker/index.js +17 -17
- package/dist/src/hooks/auto-update-checker/index.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/logging.js +2 -2
- package/dist/src/hooks/auto-update-checker/logging.js.map +1 -1
- package/dist/src/hooks/auto-update-checker/types.d.ts.map +1 -1
- package/dist/src/plugin/account-access.d.ts +99 -0
- package/dist/src/plugin/account-access.d.ts.map +1 -0
- package/dist/src/plugin/account-access.js +480 -0
- package/dist/src/plugin/account-access.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +7 -236
- package/dist/src/plugin/accounts.d.ts.map +1 -1
- package/dist/src/plugin/accounts.js +31 -1166
- package/dist/src/plugin/accounts.js.map +1 -1
- package/dist/src/plugin/agy-request-metadata.d.ts +2 -0
- package/dist/src/plugin/agy-request-metadata.d.ts.map +1 -0
- package/dist/src/plugin/agy-request-metadata.js +2 -0
- package/dist/src/plugin/agy-request-metadata.js.map +1 -0
- package/dist/src/plugin/agy-transport.d.ts +1 -1
- package/dist/src/plugin/agy-transport.js +1 -1
- package/dist/src/plugin/auth-doctor.d.ts +6 -6
- package/dist/src/plugin/auth-doctor.d.ts.map +1 -1
- package/dist/src/plugin/auth-doctor.js +79 -62
- package/dist/src/plugin/auth-doctor.js.map +1 -1
- package/dist/src/plugin/auth-drift.d.ts +4 -4
- package/dist/src/plugin/auth-drift.d.ts.map +1 -1
- package/dist/src/plugin/auth-drift.js +15 -15
- package/dist/src/plugin/auth-drift.js.map +1 -1
- package/dist/src/plugin/auth-loader.d.ts +35 -0
- package/dist/src/plugin/auth-loader.d.ts.map +1 -0
- package/dist/src/plugin/auth-loader.js +144 -0
- package/dist/src/plugin/auth-loader.js.map +1 -0
- package/dist/src/plugin/auth.d.ts +1 -1
- package/dist/src/plugin/auth.js +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 +1 -1
- package/dist/src/plugin/cache/signature-cache.d.ts.map +1 -1
- package/dist/src/plugin/cache/signature-cache.js +23 -24
- package/dist/src/plugin/cache/signature-cache.js.map +1 -1
- package/dist/src/plugin/cache.d.ts +6 -5
- package/dist/src/plugin/cache.d.ts.map +1 -1
- package/dist/src/plugin/cache.js +21 -7
- package/dist/src/plugin/cache.js.map +1 -1
- package/dist/src/plugin/catalog.d.ts +23 -0
- package/dist/src/plugin/catalog.d.ts.map +1 -0
- package/dist/src/plugin/catalog.js +60 -0
- package/dist/src/plugin/catalog.js.map +1 -0
- package/dist/src/plugin/cli.d.ts +7 -7
- package/dist/src/plugin/cli.d.ts.map +1 -1
- package/dist/src/plugin/cli.js +62 -55
- package/dist/src/plugin/cli.js.map +1 -1
- package/dist/src/plugin/command-data.d.ts +276 -0
- package/dist/src/plugin/command-data.d.ts.map +1 -0
- package/dist/src/plugin/command-data.js +325 -0
- package/dist/src/plugin/command-data.js.map +1 -0
- package/dist/src/plugin/commands.d.ts +151 -0
- package/dist/src/plugin/commands.d.ts.map +1 -0
- package/dist/src/plugin/commands.js +639 -0
- package/dist/src/plugin/commands.js.map +1 -0
- package/dist/src/plugin/config/index.d.ts +2 -2
- package/dist/src/plugin/config/index.d.ts.map +1 -1
- package/dist/src/plugin/config/index.js +2 -2
- package/dist/src/plugin/config/index.js.map +1 -1
- package/dist/src/plugin/config/loader.d.ts +1 -1
- package/dist/src/plugin/config/loader.d.ts.map +1 -1
- package/dist/src/plugin/config/loader.js +18 -16
- package/dist/src/plugin/config/loader.js.map +1 -1
- package/dist/src/plugin/config/models.d.ts +2 -2
- package/dist/src/plugin/config/models.d.ts.map +1 -1
- package/dist/src/plugin/config/models.js +1 -1
- package/dist/src/plugin/config/models.js.map +1 -1
- package/dist/src/plugin/config/operator-settings-schema.d.ts +29 -0
- package/dist/src/plugin/config/operator-settings-schema.d.ts.map +1 -0
- package/dist/src/plugin/config/operator-settings-schema.js +28 -0
- package/dist/src/plugin/config/operator-settings-schema.js.map +1 -0
- package/dist/src/plugin/config/schema.d.ts +21 -2
- package/dist/src/plugin/config/schema.d.ts.map +1 -1
- package/dist/src/plugin/config/schema.js +85 -25
- package/dist/src/plugin/config/schema.js.map +1 -1
- package/dist/src/plugin/config/updater.d.ts.map +1 -1
- package/dist/src/plugin/config/updater.js +15 -15
- package/dist/src/plugin/config/updater.js.map +1 -1
- package/dist/src/plugin/config/writer.d.ts +34 -0
- package/dist/src/plugin/config/writer.d.ts.map +1 -0
- package/dist/src/plugin/config/writer.js +81 -0
- package/dist/src/plugin/config/writer.js.map +1 -0
- package/dist/src/plugin/core/streaming/index.d.ts +1 -1
- package/dist/src/plugin/core/streaming/index.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/index.js +1 -1
- package/dist/src/plugin/core/streaming/index.js.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.d.ts.map +1 -1
- package/dist/src/plugin/core/streaming/transformer.js +85 -44
- package/dist/src/plugin/core/streaming/transformer.js.map +1 -1
- package/dist/src/plugin/core/streaming/types.d.ts.map +1 -1
- package/dist/src/plugin/debug.d.ts +3 -3
- package/dist/src/plugin/debug.d.ts.map +1 -1
- package/dist/src/plugin/debug.js +85 -47
- package/dist/src/plugin/debug.js.map +1 -1
- package/dist/src/plugin/dependencies.d.ts +129 -0
- package/dist/src/plugin/dependencies.d.ts.map +1 -0
- package/dist/src/plugin/dependencies.js +107 -0
- package/dist/src/plugin/dependencies.js.map +1 -0
- package/dist/src/plugin/errors.d.ts +27 -0
- package/dist/src/plugin/errors.d.ts.map +1 -1
- package/dist/src/plugin/errors.js +29 -3
- package/dist/src/plugin/errors.js.map +1 -1
- package/dist/src/plugin/event-handler.d.ts +53 -0
- package/dist/src/plugin/event-handler.d.ts.map +1 -0
- package/dist/src/plugin/event-handler.js +101 -0
- package/dist/src/plugin/event-handler.js.map +1 -0
- package/dist/src/plugin/fetch/retry-state.d.ts +61 -0
- package/dist/src/plugin/fetch/retry-state.d.ts.map +1 -0
- package/dist/src/plugin/fetch/retry-state.js +248 -0
- package/dist/src/plugin/fetch/retry-state.js.map +1 -0
- package/dist/src/plugin/fetch/warmup.d.ts +30 -0
- package/dist/src/plugin/fetch/warmup.d.ts.map +1 -0
- package/dist/src/plugin/fetch/warmup.js +76 -0
- package/dist/src/plugin/fetch/warmup.js.map +1 -0
- package/dist/src/plugin/fetch-interceptor.d.ts +59 -0
- package/dist/src/plugin/fetch-interceptor.d.ts.map +1 -0
- package/dist/src/plugin/fetch-interceptor.js +1387 -0
- package/dist/src/plugin/fetch-interceptor.js.map +1 -0
- package/dist/src/plugin/fetch-routing.d.ts +26 -0
- package/dist/src/plugin/fetch-routing.d.ts.map +1 -0
- package/dist/src/plugin/fetch-routing.js +99 -0
- package/dist/src/plugin/fetch-routing.js.map +1 -0
- package/dist/src/plugin/fingerprint.d.ts +1 -1
- package/dist/src/plugin/fingerprint.js +1 -1
- package/dist/src/plugin/gemini-dump.d.ts +5 -5
- package/dist/src/plugin/gemini-dump.d.ts.map +1 -1
- package/dist/src/plugin/gemini-dump.js +109 -55
- package/dist/src/plugin/gemini-dump.js.map +1 -1
- package/dist/src/plugin/google-search-tool.d.ts +9 -0
- package/dist/src/plugin/google-search-tool.d.ts.map +1 -0
- package/dist/src/plugin/google-search-tool.js +56 -0
- package/dist/src/plugin/google-search-tool.js.map +1 -0
- package/dist/src/plugin/image-saver.d.ts +2 -21
- package/dist/src/plugin/image-saver.d.ts.map +1 -1
- package/dist/src/plugin/image-saver.js +22 -56
- package/dist/src/plugin/image-saver.js.map +1 -1
- package/dist/src/plugin/index.d.ts +23 -0
- package/dist/src/plugin/index.d.ts.map +1 -0
- package/dist/src/plugin/index.js +308 -0
- package/dist/src/plugin/index.js.map +1 -0
- package/dist/src/plugin/killswitch.d.ts +94 -0
- package/dist/src/plugin/killswitch.d.ts.map +1 -0
- package/dist/src/plugin/killswitch.js +194 -0
- package/dist/src/plugin/killswitch.js.map +1 -0
- package/dist/src/plugin/lifecycle.d.ts +40 -0
- package/dist/src/plugin/lifecycle.d.ts.map +1 -0
- package/dist/src/plugin/lifecycle.js +73 -0
- package/dist/src/plugin/lifecycle.js.map +1 -0
- package/dist/src/plugin/logger.d.ts +10 -1
- package/dist/src/plugin/logger.d.ts.map +1 -1
- package/dist/src/plugin/logger.js +38 -12
- package/dist/src/plugin/logger.js.map +1 -1
- package/dist/src/plugin/logging-utils.d.ts +35 -1
- package/dist/src/plugin/logging-utils.d.ts.map +1 -1
- package/dist/src/plugin/logging-utils.js +98 -15
- package/dist/src/plugin/logging-utils.js.map +1 -1
- package/dist/src/plugin/model-registry.d.ts +1 -1
- package/dist/src/plugin/model-registry.js +1 -1
- package/dist/src/plugin/oauth-login.d.ts +22 -0
- package/dist/src/plugin/oauth-login.d.ts.map +1 -0
- package/dist/src/plugin/oauth-login.js +37 -0
- package/dist/src/plugin/oauth-login.js.map +1 -0
- package/dist/src/plugin/oauth-methods.d.ts +42 -0
- package/dist/src/plugin/oauth-methods.d.ts.map +1 -0
- package/dist/src/plugin/oauth-methods.js +1284 -0
- package/dist/src/plugin/oauth-methods.js.map +1 -0
- package/dist/src/plugin/operator-settings.d.ts +40 -0
- package/dist/src/plugin/operator-settings.d.ts.map +1 -0
- package/dist/src/plugin/operator-settings.js +148 -0
- package/dist/src/plugin/operator-settings.js.map +1 -0
- package/dist/src/plugin/persist-account-pool.d.ts +37 -0
- package/dist/src/plugin/persist-account-pool.d.ts.map +1 -0
- package/dist/src/plugin/persist-account-pool.js +142 -0
- package/dist/src/plugin/persist-account-pool.js.map +1 -0
- package/dist/src/plugin/project.d.ts +1 -1
- package/dist/src/plugin/project.js +1 -1
- package/dist/src/plugin/prompt-context.d.ts.map +1 -1
- package/dist/src/plugin/prompt-context.js +11 -11
- package/dist/src/plugin/prompt-context.js.map +1 -1
- package/dist/src/plugin/quota.d.ts +97 -41
- package/dist/src/plugin/quota.d.ts.map +1 -1
- package/dist/src/plugin/quota.js +273 -285
- package/dist/src/plugin/quota.js.map +1 -1
- package/dist/src/plugin/recovery/constants.d.ts.map +1 -1
- package/dist/src/plugin/recovery/constants.js +24 -15
- package/dist/src/plugin/recovery/constants.js.map +1 -1
- package/dist/src/plugin/recovery/index.d.ts +3 -3
- package/dist/src/plugin/recovery/index.d.ts.map +1 -1
- package/dist/src/plugin/recovery/index.js +3 -3
- package/dist/src/plugin/recovery/index.js.map +1 -1
- package/dist/src/plugin/recovery/storage.d.ts +1 -1
- package/dist/src/plugin/recovery/storage.d.ts.map +1 -1
- package/dist/src/plugin/recovery/storage.js +31 -39
- package/dist/src/plugin/recovery/storage.js.map +1 -1
- package/dist/src/plugin/recovery/types.d.ts +12 -12
- package/dist/src/plugin/recovery/types.d.ts.map +1 -1
- package/dist/src/plugin/recovery.d.ts +3 -3
- package/dist/src/plugin/recovery.d.ts.map +1 -1
- package/dist/src/plugin/recovery.js +62 -58
- package/dist/src/plugin/recovery.js.map +1 -1
- package/dist/src/plugin/refresh-queue.d.ts +5 -2
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -1
- package/dist/src/plugin/refresh-queue.js +37 -15
- package/dist/src/plugin/refresh-queue.js.map +1 -1
- package/dist/src/plugin/request-helpers.d.ts +2 -1
- package/dist/src/plugin/request-helpers.d.ts.map +1 -1
- package/dist/src/plugin/request-helpers.js +458 -354
- package/dist/src/plugin/request-helpers.js.map +1 -1
- package/dist/src/plugin/request.d.ts +12 -6
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +801 -390
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/rotation.d.ts +1 -168
- package/dist/src/plugin/rotation.d.ts.map +1 -1
- package/dist/src/plugin/rotation.js +1 -327
- package/dist/src/plugin/rotation.js.map +1 -1
- package/dist/src/plugin/search.d.ts.map +1 -1
- package/dist/src/plugin/search.js +39 -35
- package/dist/src/plugin/search.js.map +1 -1
- package/dist/src/plugin/server.d.ts +1 -1
- package/dist/src/plugin/server.d.ts.map +1 -1
- package/dist/src/plugin/server.js +42 -37
- package/dist/src/plugin/server.js.map +1 -1
- package/dist/src/plugin/session-context.d.ts +22 -0
- package/dist/src/plugin/session-context.d.ts.map +1 -0
- package/dist/src/plugin/session-context.js +67 -0
- package/dist/src/plugin/session-context.js.map +1 -0
- package/dist/src/plugin/storage.d.ts +59 -114
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +140 -474
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/plugin/stores/signature-store.d.ts.map +1 -1
- package/dist/src/plugin/stores/signature-store.js.map +1 -1
- package/dist/src/plugin/thinking-recovery.d.ts.map +1 -1
- package/dist/src/plugin/thinking-recovery.js +35 -33
- package/dist/src/plugin/thinking-recovery.js.map +1 -1
- package/dist/src/plugin/token.d.ts +2 -2
- package/dist/src/plugin/token.d.ts.map +1 -1
- package/dist/src/plugin/token.js +30 -21
- package/dist/src/plugin/token.js.map +1 -1
- package/dist/src/plugin/transform/cross-model-sanitizer.d.ts +1 -1
- package/dist/src/plugin/transform/cross-model-sanitizer.js +1 -1
- package/dist/src/plugin/transform/index.d.ts +1 -1
- package/dist/src/plugin/transform/index.js +1 -1
- package/dist/src/plugin/transform/model-resolver.d.ts +1 -1
- package/dist/src/plugin/transform/model-resolver.js +1 -1
- package/dist/src/plugin/transform/types.d.ts +1 -1
- package/dist/src/plugin/transform/types.js +1 -1
- package/dist/src/plugin/types.d.ts +25 -69
- package/dist/src/plugin/types.d.ts.map +1 -1
- package/dist/src/plugin/ui/ansi.d.ts.map +1 -1
- package/dist/src/plugin/ui/ansi.js.map +1 -1
- package/dist/src/plugin/ui/auth-menu.d.ts +2 -2
- package/dist/src/plugin/ui/auth-menu.d.ts.map +1 -1
- package/dist/src/plugin/ui/auth-menu.js +84 -31
- package/dist/src/plugin/ui/auth-menu.js.map +1 -1
- package/dist/src/plugin/ui/confirm.d.ts.map +1 -1
- package/dist/src/plugin/ui/confirm.js.map +1 -1
- package/dist/src/plugin/ui/model-status.d.ts +3 -3
- package/dist/src/plugin/ui/model-status.d.ts.map +1 -1
- package/dist/src/plugin/ui/model-status.js +3 -3
- package/dist/src/plugin/ui/model-status.js.map +1 -1
- package/dist/src/plugin/ui/quota-status.d.ts +4 -4
- package/dist/src/plugin/ui/quota-status.d.ts.map +1 -1
- package/dist/src/plugin/ui/quota-status.js +51 -48
- package/dist/src/plugin/ui/quota-status.js.map +1 -1
- package/dist/src/plugin/ui/select.d.ts.map +1 -1
- package/dist/src/plugin/ui/select.js +22 -12
- package/dist/src/plugin/ui/select.js.map +1 -1
- package/dist/src/plugin/version.d.ts +1 -1
- package/dist/src/plugin/version.js +1 -1
- package/dist/src/rpc/notifications.d.ts +6 -0
- package/dist/src/rpc/notifications.d.ts.map +1 -0
- package/dist/src/rpc/notifications.js +46 -0
- package/dist/src/rpc/notifications.js.map +1 -0
- package/dist/src/rpc/port-file.d.ts +13 -0
- package/dist/src/rpc/port-file.d.ts.map +1 -0
- package/dist/src/rpc/port-file.js +109 -0
- package/dist/src/rpc/port-file.js.map +1 -0
- package/dist/src/rpc/protocol.d.ts +22 -0
- package/dist/src/rpc/protocol.d.ts.map +1 -0
- package/dist/src/rpc/protocol.js +1 -0
- package/dist/src/rpc/protocol.js.map +1 -0
- package/dist/src/rpc/rpc-client.d.ts +10 -0
- package/dist/src/rpc/rpc-client.d.ts.map +1 -0
- package/dist/src/rpc/rpc-client.js +58 -0
- package/dist/src/rpc/rpc-client.js.map +1 -0
- package/dist/src/rpc/rpc-dir.d.ts +4 -0
- package/dist/src/rpc/rpc-dir.d.ts.map +1 -0
- package/dist/src/rpc/rpc-dir.js +19 -0
- package/dist/src/rpc/rpc-dir.js.map +1 -0
- package/dist/src/rpc/rpc-server.d.ts +13 -0
- package/dist/src/rpc/rpc-server.d.ts.map +1 -0
- package/dist/src/rpc/rpc-server.js +231 -0
- package/dist/src/rpc/rpc-server.js.map +1 -0
- package/dist/src/sidebar-state.d.ts +240 -0
- package/dist/src/sidebar-state.d.ts.map +1 -0
- package/dist/src/sidebar-state.js +520 -0
- package/dist/src/sidebar-state.js.map +1 -0
- package/dist/src/tui/command-dialogs.d.ts +61 -0
- package/dist/src/tui/command-dialogs.d.ts.map +1 -0
- package/dist/src/tui/command-dialogs.js +497 -0
- package/dist/src/tui/command-dialogs.js.map +1 -0
- package/dist/src/tui/file-logger.d.ts +41 -0
- package/dist/src/tui/file-logger.d.ts.map +1 -0
- package/dist/src/tui/file-logger.js +114 -0
- package/dist/src/tui/file-logger.js.map +1 -0
- package/dist/src/tui-preferences.d.ts +40 -0
- package/dist/src/tui-preferences.d.ts.map +1 -0
- package/dist/src/tui-preferences.js +328 -0
- package/dist/src/tui-preferences.js.map +1 -0
- package/dist/src/tui.d.ts +68 -0
- package/dist/src/tui.d.ts.map +1 -0
- package/dist/src/tui.js +662 -0
- package/dist/src/tui.js.map +1 -0
- package/package.json +46 -22
- package/src/plugin/command-data.ts +651 -0
- package/src/rpc/port-file.ts +143 -0
- package/src/rpc/protocol.ts +31 -0
- package/src/rpc/rpc-client.ts +102 -0
- package/src/rpc/rpc-dir.ts +24 -0
- package/src/sidebar-state.ts +717 -0
- package/src/tui/command-dialogs.tsx +699 -0
- package/src/tui/entry.mjs +74 -0
- package/src/tui/file-logger.ts +145 -0
- package/src/tui-compiled/plugin/command-data.ts +651 -0
- package/src/tui-compiled/rpc/port-file.ts +143 -0
- package/src/tui-compiled/rpc/protocol.ts +31 -0
- package/src/tui-compiled/rpc/rpc-client.ts +102 -0
- package/src/tui-compiled/rpc/rpc-dir.ts +24 -0
- package/src/tui-compiled/sidebar-state.ts +717 -0
- package/src/tui-compiled/tui/command-dialogs.tsx +659 -0
- package/src/tui-compiled/tui/file-logger.ts +145 -0
- package/src/tui-compiled/tui-preferences.ts +416 -0
- package/src/tui-compiled/tui.tsx +1150 -0
- package/src/tui-preferences.ts +416 -0
- package/src/tui.tsx +1117 -0
- package/dist/src/plugin.d.ts +0 -32
- package/dist/src/plugin.d.ts.map +0 -1
- package/dist/src/plugin.js +0 -3151
- package/dist/src/plugin.js.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Host-aware loader for the Antigravity TUI.
|
|
2
|
+
//
|
|
3
|
+
// Production OpenTUI hosts compile plugin source through
|
|
4
|
+
// `@opentui/solid/scripts/solid-transform` and resolve module imports
|
|
5
|
+
// through a virtual runtime module identifier:
|
|
6
|
+
//
|
|
7
|
+
// opentui:runtime-module:<encodeURIComponent('@opentui/solid')>
|
|
8
|
+
//
|
|
9
|
+
// When the host has installed that virtual resolver, importing via it gives
|
|
10
|
+
// back the transformed runtime that the host's precompiler emitted; otherwise
|
|
11
|
+
// Bun resolves `@opentui/solid` to the node-exported JS and the host's
|
|
12
|
+
// pre-built `../tui-compiled/tui.tsx` file (which already references those
|
|
13
|
+
// virtual modules in its import graph) lines up correctly.
|
|
14
|
+
//
|
|
15
|
+
// Two import paths are tried, in order:
|
|
16
|
+
//
|
|
17
|
+
// 1. `../tui-compiled/tui.tsx` — the precompiled, virtual-runtime-aware
|
|
18
|
+
// bundle. Resolved successfully by hosts that ship a runtime module
|
|
19
|
+
// resolver + the precompiled tree.
|
|
20
|
+
// 2. `../tui.tsx` — the dev fallback. Local development with raw TSX
|
|
21
|
+
// runs through `@opentui/solid/preload`, which installs the Solid
|
|
22
|
+
// transform plugin so the same `/** @jsxImportSource @opentui/solid */`
|
|
23
|
+
// pragma is honoured on the fly.
|
|
24
|
+
//
|
|
25
|
+
// Errors raised while probing for the runtime module that indicate "module
|
|
26
|
+
// not found" are swallowed and the compiled tree is attempted next. Any
|
|
27
|
+
// other error (syntax error, runtime error in the compiled file, etc.) is
|
|
28
|
+
// re-thrown — those are real bugs, not configuration mismatches.
|
|
29
|
+
|
|
30
|
+
import { dirname, resolve } from 'node:path'
|
|
31
|
+
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
32
|
+
|
|
33
|
+
const RUNTIME_MODULE_ID = `opentui:runtime-module:${encodeURIComponent('@opentui/solid')}`
|
|
34
|
+
const ENTRY_DIR = dirname(fileURLToPath(import.meta.url))
|
|
35
|
+
const COMPILED_ENTRY = pathToFileURL(
|
|
36
|
+
resolve(ENTRY_DIR, '../tui-compiled/tui.tsx'),
|
|
37
|
+
).href
|
|
38
|
+
const RAW_ENTRY = pathToFileURL(resolve(ENTRY_DIR, '../tui.tsx')).href
|
|
39
|
+
|
|
40
|
+
function isMissingModuleError(error) {
|
|
41
|
+
if (!error) return false
|
|
42
|
+
const code =
|
|
43
|
+
typeof error === 'object' && 'code' in error ? error.code : undefined
|
|
44
|
+
if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND')
|
|
45
|
+
return true
|
|
46
|
+
const message = typeof error.message === 'string' ? error.message : ''
|
|
47
|
+
return /cannot find module|module not found|ENOENT/i.test(message)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function probeVirtualRuntime() {
|
|
51
|
+
try {
|
|
52
|
+
await import(RUNTIME_MODULE_ID)
|
|
53
|
+
return true
|
|
54
|
+
} catch (error) {
|
|
55
|
+
if (isMissingModuleError(error)) return false
|
|
56
|
+
throw error
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function importWithFallback() {
|
|
61
|
+
const compiledAvailable = await probeVirtualRuntime()
|
|
62
|
+
if (compiledAvailable) {
|
|
63
|
+
return import(COMPILED_ENTRY)
|
|
64
|
+
}
|
|
65
|
+
return import(RAW_ENTRY)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const mod = await importWithFallback()
|
|
69
|
+
|
|
70
|
+
// Pass the wrapped plugin shape through unchanged. `tui.tsx` exports the
|
|
71
|
+
// fleet-shape `{ id, tui }` wrapper as its default export; this file just
|
|
72
|
+
// selects between the precompiled and the dev-TSX entry, it does not
|
|
73
|
+
// re-wrap.
|
|
74
|
+
export default mod?.default ?? mod?.tui ?? mod
|
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
}
|