codex-multi-auth 2.3.0-beta.1 → 2.3.0-beta.3
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/.codex-plugin/plugin.json +2 -1
- package/README.md +4 -4
- package/config/schema/config.schema.json +268 -21
- package/dist/index.js +0 -1
- package/dist/lib/account-policy.d.ts.map +1 -1
- package/dist/lib/account-policy.js +2 -2
- package/dist/lib/accounts/rate-limits.js +0 -1
- package/dist/lib/accounts.d.ts +3 -8
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +2 -3
- package/dist/lib/audit.d.ts +0 -9
- package/dist/lib/audit.d.ts.map +1 -1
- package/dist/lib/audit.js +0 -1
- package/dist/lib/auth/auth.js +0 -1
- package/dist/lib/auth/browser.js +0 -1
- package/dist/lib/auth/device-auth.d.ts +1 -6
- package/dist/lib/auth/device-auth.d.ts.map +1 -1
- package/dist/lib/auth/device-auth.js +5 -6
- package/dist/lib/auth/index.js +0 -1
- package/dist/lib/auth/org-override.js +0 -1
- package/dist/lib/auth/server.js +0 -1
- package/dist/lib/auth/token-utils.js +0 -1
- package/dist/lib/auth-rate-limit.js +0 -1
- package/dist/lib/budget-guard.d.ts.map +1 -1
- package/dist/lib/budget-guard.js +2 -2
- package/dist/lib/capability-policy.js +0 -1
- package/dist/lib/circuit-breaker.js +0 -1
- package/dist/lib/cli.js +1 -2
- package/dist/lib/codex-cli/index.js +0 -1
- package/dist/lib/codex-cli/observability.js +0 -1
- package/dist/lib/codex-cli/state.js +0 -1
- package/dist/lib/codex-cli/sync.d.ts +2 -2
- package/dist/lib/codex-cli/sync.d.ts.map +1 -1
- package/dist/lib/codex-cli/sync.js +1 -2
- package/dist/lib/codex-cli/writer.d.ts.map +1 -1
- package/dist/lib/codex-cli/writer.js +2 -2
- package/dist/lib/codex-manager/account-credentials.d.ts +13 -0
- package/dist/lib/codex-manager/account-credentials.d.ts.map +1 -0
- package/dist/lib/codex-manager/account-credentials.js +55 -0
- package/dist/lib/codex-manager/account-manager-commands.js +0 -1
- package/dist/lib/codex-manager/account-pool-write.d.ts +1 -1
- package/dist/lib/codex-manager/account-pool-write.d.ts.map +1 -1
- package/dist/lib/codex-manager/account-pool-write.js +0 -1
- package/dist/lib/codex-manager/backend-category-entry.js +0 -1
- package/dist/lib/codex-manager/backend-category-helpers.js +0 -1
- package/dist/lib/codex-manager/backend-category-prompt.js +0 -1
- package/dist/lib/codex-manager/backend-settings-controller.js +0 -1
- package/dist/lib/codex-manager/backend-settings-entry.js +0 -1
- package/dist/lib/codex-manager/backend-settings-helpers.d.ts +0 -1
- package/dist/lib/codex-manager/backend-settings-helpers.d.ts.map +1 -1
- package/dist/lib/codex-manager/backend-settings-helpers.js +1 -2
- package/dist/lib/codex-manager/backend-settings-prompt.js +0 -1
- package/dist/lib/codex-manager/backend-settings-schema.js +0 -1
- package/dist/lib/codex-manager/behavior-settings-panel.d.ts +1 -20
- package/dist/lib/codex-manager/behavior-settings-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/behavior-settings-panel.js +0 -1
- package/dist/lib/codex-manager/commands/account.js +0 -1
- package/dist/lib/codex-manager/commands/best.d.ts +8 -0
- package/dist/lib/codex-manager/commands/best.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/best.js +64 -1
- package/dist/lib/codex-manager/commands/bridge.js +0 -1
- package/dist/lib/codex-manager/commands/budget.js +0 -1
- package/dist/lib/codex-manager/commands/check.js +0 -1
- package/dist/lib/codex-manager/commands/config-explain.js +0 -1
- package/dist/lib/codex-manager/commands/debug-bundle.js +0 -1
- package/dist/lib/codex-manager/commands/forecast.js +0 -1
- package/dist/lib/codex-manager/commands/init-config.js +0 -1
- package/dist/lib/codex-manager/commands/integrations.js +0 -1
- package/dist/lib/codex-manager/commands/models.js +0 -1
- package/dist/lib/codex-manager/commands/monitor.js +0 -1
- package/dist/lib/codex-manager/commands/report.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/report.js +2 -2
- package/dist/lib/codex-manager/commands/rotation.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/rotation.js +1 -4
- package/dist/lib/codex-manager/commands/status.js +0 -1
- package/dist/lib/codex-manager/commands/switch.js +0 -1
- package/dist/lib/codex-manager/commands/uninstall.d.ts +2 -2
- package/dist/lib/codex-manager/commands/uninstall.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/uninstall.js +3 -34
- package/dist/lib/codex-manager/commands/unpin.js +0 -1
- package/dist/lib/codex-manager/commands/usage.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/usage.js +2 -2
- package/dist/lib/codex-manager/commands/verify.d.ts +2 -2
- package/dist/lib/codex-manager/commands/verify.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/verify.js +0 -1
- package/dist/lib/codex-manager/commands/why-selected.d.ts +1 -22
- package/dist/lib/codex-manager/commands/why-selected.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/why-selected.js +0 -1
- package/dist/lib/codex-manager/commands/workspace.js +0 -1
- package/dist/lib/codex-manager/dashboard-display-panel.d.ts +1 -15
- package/dist/lib/codex-manager/dashboard-display-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/dashboard-display-panel.js +0 -1
- package/dist/lib/codex-manager/dashboard-formatters.js +0 -1
- package/dist/lib/codex-manager/dashboard-settings-controller.js +0 -1
- package/dist/lib/codex-manager/dashboard-settings-data.js +0 -1
- package/dist/lib/codex-manager/dashboard-settings-entry.js +0 -1
- package/dist/lib/codex-manager/experimental-settings-entry.js +0 -1
- package/dist/lib/codex-manager/experimental-settings-prompt.d.ts +2 -1
- package/dist/lib/codex-manager/experimental-settings-prompt.d.ts.map +1 -1
- package/dist/lib/codex-manager/experimental-settings-prompt.js +0 -1
- package/dist/lib/codex-manager/experimental-settings-schema.js +1 -2
- package/dist/lib/codex-manager/experimental-sync-target-entry.js +0 -1
- package/dist/lib/codex-manager/experimental-sync-target.js +0 -1
- package/dist/lib/codex-manager/forecast-report-commands.js +0 -1
- package/dist/lib/codex-manager/forecast-report-shared.d.ts +2 -2
- package/dist/lib/codex-manager/forecast-report-shared.d.ts.map +1 -1
- package/dist/lib/codex-manager/forecast-report-shared.js +5 -21
- package/dist/lib/codex-manager/formatters/account-formatters.d.ts +11 -0
- package/dist/lib/codex-manager/formatters/account-formatters.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/account-formatters.js +79 -0
- package/dist/lib/codex-manager/formatters/index.d.ts +5 -0
- package/dist/lib/codex-manager/formatters/index.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/index.js +4 -0
- package/dist/lib/codex-manager/formatters/model-formatters.d.ts +12 -0
- package/dist/lib/codex-manager/formatters/model-formatters.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/model-formatters.js +23 -0
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts +9 -0
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/quota-formatters.js +104 -0
- package/dist/lib/codex-manager/formatters/text-style.d.ts +14 -0
- package/dist/lib/codex-manager/formatters/text-style.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/text-style.js +111 -0
- package/dist/lib/codex-manager/health-check.d.ts +14 -0
- package/dist/lib/codex-manager/health-check.d.ts.map +1 -0
- package/dist/lib/codex-manager/health-check.js +278 -0
- package/dist/lib/codex-manager/help.d.ts +2 -1
- package/dist/lib/codex-manager/help.d.ts.map +1 -1
- package/dist/lib/codex-manager/help.js +0 -1
- package/dist/lib/codex-manager/login-action-panel.d.ts +4 -0
- package/dist/lib/codex-manager/login-action-panel.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-action-panel.js +238 -0
- package/dist/lib/codex-manager/login-flow.d.ts +17 -0
- package/dist/lib/codex-manager/login-flow.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-flow.js +387 -0
- package/dist/lib/codex-manager/login-menu-actions.d.ts +20 -0
- package/dist/lib/codex-manager/login-menu-actions.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-menu-actions.js +303 -0
- package/dist/lib/codex-manager/login-menu-data.d.ts +19 -0
- package/dist/lib/codex-manager/login-menu-data.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-menu-data.js +378 -0
- package/dist/lib/codex-manager/login-oauth.d.ts +55 -0
- package/dist/lib/codex-manager/login-oauth.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-oauth.js +345 -0
- package/dist/lib/codex-manager/manual-callback.js +0 -1
- package/dist/lib/codex-manager/persist-selected-account.d.ts +24 -0
- package/dist/lib/codex-manager/persist-selected-account.d.ts.map +1 -0
- package/dist/lib/codex-manager/persist-selected-account.js +107 -0
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts +18 -0
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts.map +1 -0
- package/dist/lib/codex-manager/quota-cache-helpers.js +112 -0
- package/dist/lib/codex-manager/rate-limit-markers.js +0 -1
- package/dist/lib/codex-manager/repair-commands.d.ts +0 -15
- package/dist/lib/codex-manager/repair-commands.d.ts.map +1 -1
- package/dist/lib/codex-manager/repair-commands.js +5 -6
- package/dist/lib/codex-manager/settings-hub/backend.d.ts +0 -5
- package/dist/lib/codex-manager/settings-hub/backend.d.ts.map +1 -1
- package/dist/lib/codex-manager/settings-hub/backend.js +2 -3
- package/dist/lib/codex-manager/settings-hub/dashboard.d.ts +1 -14
- package/dist/lib/codex-manager/settings-hub/dashboard.d.ts.map +1 -1
- package/dist/lib/codex-manager/settings-hub/dashboard.js +9 -10
- package/dist/lib/codex-manager/settings-hub/experimental.js +1 -2
- package/dist/lib/codex-manager/settings-hub/index.js +1 -2
- package/dist/lib/codex-manager/settings-hub/shared.js +0 -1
- package/dist/lib/codex-manager/settings-hub-entry.js +0 -1
- package/dist/lib/codex-manager/settings-hub-menu.js +0 -1
- package/dist/lib/codex-manager/settings-hub-prompt.js +0 -1
- package/dist/lib/codex-manager/settings-hub.js +0 -1
- package/dist/lib/codex-manager/settings-panels.js +0 -1
- package/dist/lib/codex-manager/settings-persist-utils.js +0 -1
- package/dist/lib/codex-manager/settings-preview.js +0 -1
- package/dist/lib/codex-manager/settings-write-queue.d.ts +0 -10
- package/dist/lib/codex-manager/settings-write-queue.d.ts.map +1 -1
- package/dist/lib/codex-manager/settings-write-queue.js +10 -11
- package/dist/lib/codex-manager/statusline-order.js +0 -1
- package/dist/lib/codex-manager/statusline-settings-panel.d.ts +3 -18
- package/dist/lib/codex-manager/statusline-settings-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/statusline-settings-panel.js +0 -1
- package/dist/lib/codex-manager/theme-settings-panel.d.ts +1 -14
- package/dist/lib/codex-manager/theme-settings-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/theme-settings-panel.js +0 -1
- package/dist/lib/codex-manager/unified-settings-controller.js +0 -1
- package/dist/lib/codex-manager/unified-settings-entry.js +0 -1
- package/dist/lib/codex-manager.d.ts +2 -4
- package/dist/lib/codex-manager.d.ts.map +1 -1
- package/dist/lib/codex-manager.js +219 -2570
- package/dist/lib/config-schema.d.ts +32 -0
- package/dist/lib/config-schema.d.ts.map +1 -0
- package/dist/lib/config-schema.js +96 -0
- package/dist/lib/config.d.ts +0 -13
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +82 -123
- package/dist/lib/constants.js +0 -1
- package/dist/lib/context-overflow.js +0 -1
- package/dist/lib/dashboard-settings.d.ts +3 -3
- package/dist/lib/dashboard-settings.d.ts.map +1 -1
- package/dist/lib/dashboard-settings.js +0 -2
- package/dist/lib/entitlement-cache.js +0 -1
- package/dist/lib/env-parsing.js +0 -1
- package/dist/lib/errors.d.ts +0 -1
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +0 -1
- package/dist/lib/forecast.d.ts +4 -3
- package/dist/lib/forecast.d.ts.map +1 -1
- package/dist/lib/forecast.js +0 -1
- package/dist/lib/fs-retry.d.ts +46 -3
- package/dist/lib/fs-retry.d.ts.map +1 -1
- package/dist/lib/fs-retry.js +77 -9
- package/dist/lib/health.js +0 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/integration-generators.js +0 -1
- package/dist/lib/live-account-sync.js +0 -1
- package/dist/lib/local-bridge.js +0 -1
- package/dist/lib/local-client-tokens.d.ts.map +1 -1
- package/dist/lib/local-client-tokens.js +2 -2
- package/dist/lib/logger.js +0 -1
- package/dist/lib/model-capability-matrix.js +0 -1
- package/dist/lib/named-backup-export.js +0 -1
- package/dist/lib/oc-chatgpt-import-adapter.d.ts +1 -1
- package/dist/lib/oc-chatgpt-import-adapter.d.ts.map +1 -1
- package/dist/lib/oc-chatgpt-import-adapter.js +0 -1
- package/dist/lib/oc-chatgpt-orchestrator.d.ts.map +1 -1
- package/dist/lib/oc-chatgpt-orchestrator.js +2 -2
- package/dist/lib/oc-chatgpt-target-detection.d.ts +1 -1
- package/dist/lib/oc-chatgpt-target-detection.d.ts.map +1 -1
- package/dist/lib/oc-chatgpt-target-detection.js +0 -1
- package/dist/lib/parallel-probe.js +0 -1
- package/dist/lib/policy/runtime-policy.js +0 -1
- package/dist/lib/preemptive-quota-scheduler.js +0 -1
- package/dist/lib/proactive-refresh.js +0 -1
- package/dist/lib/prompts/codex-host-bridge.d.ts +0 -8
- package/dist/lib/prompts/codex-host-bridge.d.ts.map +1 -1
- package/dist/lib/prompts/codex-host-bridge.js +0 -21
- package/dist/lib/prompts/codex.d.ts +3 -11
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +6 -13
- package/dist/lib/prompts/fetch-utils.d.ts +0 -2
- package/dist/lib/prompts/fetch-utils.d.ts.map +1 -1
- package/dist/lib/prompts/fetch-utils.js +2 -3
- package/dist/lib/prompts/host-codex-prompt.d.ts.map +1 -1
- package/dist/lib/prompts/host-codex-prompt.js +2 -2
- package/dist/lib/quota-cache.d.ts.map +1 -1
- package/dist/lib/quota-cache.js +17 -44
- package/dist/lib/quota-probe.js +0 -1
- package/dist/lib/quota-readiness.js +0 -1
- package/dist/lib/recovery/constants.js +0 -1
- package/dist/lib/recovery/index.js +0 -1
- package/dist/lib/recovery/storage.d.ts.map +1 -1
- package/dist/lib/recovery/storage.js +35 -54
- package/dist/lib/recovery/storage.js.map +1 -1
- package/dist/lib/recovery/types.d.ts +4 -12
- package/dist/lib/recovery/types.d.ts.map +1 -1
- package/dist/lib/recovery/types.js +0 -1
- package/dist/lib/recovery.d.ts +2 -2
- package/dist/lib/recovery.d.ts.map +1 -1
- package/dist/lib/recovery.js +0 -1
- package/dist/lib/refresh-guardian.js +0 -1
- package/dist/lib/refresh-lease.d.ts.map +1 -1
- package/dist/lib/refresh-lease.js +1 -4
- package/dist/lib/refresh-queue.js +0 -1
- package/dist/lib/request/error-classification.d.ts +75 -0
- package/dist/lib/request/error-classification.d.ts.map +1 -0
- package/dist/lib/request/error-classification.js +295 -0
- package/dist/lib/request/failover-config.js +0 -1
- package/dist/lib/request/failure-policy.js +0 -1
- package/dist/lib/request/fetch-helpers.d.ts +10 -114
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
- package/dist/lib/request/fetch-helpers.js +7 -589
- package/dist/lib/request/headers.d.ts +33 -0
- package/dist/lib/request/headers.d.ts.map +1 -0
- package/dist/lib/request/headers.js +64 -0
- package/dist/lib/request/helpers/input-utils.js +0 -1
- package/dist/lib/request/helpers/model-map.d.ts +10 -0
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
- package/dist/lib/request/helpers/model-map.js +11 -1
- package/dist/lib/request/helpers/tool-utils.js +0 -1
- package/dist/lib/request/index.js +0 -1
- package/dist/lib/request/rate-limit-backoff.js +0 -1
- package/dist/lib/request/rate-limit-decision.d.ts +28 -0
- package/dist/lib/request/rate-limit-decision.d.ts.map +1 -0
- package/dist/lib/request/rate-limit-decision.js +191 -0
- package/dist/lib/request/request-attempt-budget.js +0 -1
- package/dist/lib/request/request-init.js +0 -1
- package/dist/lib/request/request-resilience.js +0 -1
- package/dist/lib/request/request-transformer.js +0 -1
- package/dist/lib/request/response-compaction.d.ts +2 -1
- package/dist/lib/request/response-compaction.d.ts.map +1 -1
- package/dist/lib/request/response-compaction.js +0 -1
- package/dist/lib/request/response-handler.js +0 -1
- package/dist/lib/request/response-metadata.js +0 -1
- package/dist/lib/request/stream-failover-runtime.d.ts +8 -0
- package/dist/lib/request/stream-failover-runtime.d.ts.map +1 -0
- package/dist/lib/request/stream-failover-runtime.js +171 -0
- package/dist/lib/request/stream-failover.js +0 -1
- package/dist/lib/request/token-refresh.d.ts +30 -0
- package/dist/lib/request/token-refresh.d.ts.map +1 -0
- package/dist/lib/request/token-refresh.js +116 -0
- package/dist/lib/request/url-rewriting.d.ts +24 -0
- package/dist/lib/request/url-rewriting.d.ts.map +1 -0
- package/dist/lib/request/url-rewriting.js +153 -0
- package/dist/lib/request/wait-utils.js +0 -1
- package/dist/lib/rotation.d.ts +2 -4
- package/dist/lib/rotation.d.ts.map +1 -1
- package/dist/lib/rotation.js +1 -3
- package/dist/lib/routing-mutex.js +0 -1
- package/dist/lib/routing-profiles.d.ts.map +1 -1
- package/dist/lib/routing-profiles.js +2 -2
- package/dist/lib/runtime/account-check-helpers.js +0 -1
- package/dist/lib/runtime/account-check-types.js +0 -1
- package/dist/lib/runtime/account-check.js +0 -1
- package/dist/lib/runtime/account-health-check.js +0 -1
- package/dist/lib/runtime/account-manager-cache-entry.js +0 -1
- package/dist/lib/runtime/account-manager-cache.js +0 -1
- package/dist/lib/runtime/account-pool.js +0 -1
- package/dist/lib/runtime/account-scope.js +0 -1
- package/dist/lib/runtime/account-select-event.js +0 -1
- package/dist/lib/runtime/account-selection.js +0 -1
- package/dist/lib/runtime/account-state.js +0 -1
- package/dist/lib/runtime/account-status.js +0 -1
- package/dist/lib/runtime/account-storage-scope-entry.js +0 -1
- package/dist/lib/runtime/app-bind.js +0 -1
- package/dist/lib/runtime/auth-facade.js +0 -1
- package/dist/lib/runtime/browser-oauth-flow.js +0 -1
- package/dist/lib/runtime/capability-boost.js +0 -1
- package/dist/lib/runtime/config-toml.d.ts +0 -6
- package/dist/lib/runtime/config-toml.d.ts.map +1 -1
- package/dist/lib/runtime/config-toml.js +6 -7
- package/dist/lib/runtime/event-handler.d.ts +0 -31
- package/dist/lib/runtime/event-handler.d.ts.map +1 -1
- package/dist/lib/runtime/event-handler.js +0 -23
- package/dist/lib/runtime/first-run.d.ts +78 -0
- package/dist/lib/runtime/first-run.d.ts.map +1 -0
- package/dist/lib/runtime/first-run.js +327 -0
- package/dist/lib/runtime/flagged-verify-types.js +0 -1
- package/dist/lib/runtime/hydrate-emails.js +0 -1
- package/dist/lib/runtime/live-sync-entry.js +0 -1
- package/dist/lib/runtime/live-sync.js +0 -1
- package/dist/lib/runtime/loader-setup.js +0 -1
- package/dist/lib/runtime/login-menu-accounts.js +0 -1
- package/dist/lib/runtime/manual-oauth-flow.js +0 -1
- package/dist/lib/runtime/oauth-browser-flow.js +0 -1
- package/dist/lib/runtime/preemptive-quota.js +0 -1
- package/dist/lib/runtime/quota-headers.d.ts +1 -6
- package/dist/lib/runtime/quota-headers.d.ts.map +1 -1
- package/dist/lib/runtime/quota-headers.js +5 -6
- package/dist/lib/runtime/quota-probe.js +0 -1
- package/dist/lib/runtime/quota-settings.js +0 -1
- package/dist/lib/runtime/refresh-guardian-entry.js +0 -1
- package/dist/lib/runtime/refresh-guardian.js +0 -1
- package/dist/lib/runtime/request-init.js +0 -1
- package/dist/lib/runtime/rotation-account-selection.d.ts +38 -0
- package/dist/lib/runtime/rotation-account-selection.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-account-selection.js +172 -0
- package/dist/lib/runtime/rotation-proxy-state.d.ts +54 -0
- package/dist/lib/runtime/rotation-proxy-state.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-proxy-state.js +56 -0
- package/dist/lib/runtime/rotation-server-types.d.ts +57 -0
- package/dist/lib/runtime/rotation-server-types.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-server-types.js +1 -0
- package/dist/lib/runtime/rotation-storage-meta.d.ts +40 -0
- package/dist/lib/runtime/rotation-storage-meta.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-storage-meta.js +143 -0
- package/dist/lib/runtime/rotation-token-refresh.d.ts +25 -0
- package/dist/lib/runtime/rotation-token-refresh.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-token-refresh.js +99 -0
- package/dist/lib/runtime/runtime-current-account.d.ts +3 -3
- package/dist/lib/runtime/runtime-current-account.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-current-account.js +2 -5
- package/dist/lib/runtime/runtime-observability.d.ts +2 -2
- package/dist/lib/runtime/runtime-observability.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-observability.js +0 -5
- package/dist/lib/runtime/runtime-services.js +0 -1
- package/dist/lib/runtime/session-affinity-entry.js +0 -1
- package/dist/lib/runtime/session-affinity.js +0 -1
- package/dist/lib/runtime/session-recovery.js +0 -1
- package/dist/lib/runtime/status-marker.js +0 -1
- package/dist/lib/runtime/storage-scope.js +0 -1
- package/dist/lib/runtime/toast.js +0 -1
- package/dist/lib/runtime/ui-runtime-entry.js +0 -1
- package/dist/lib/runtime/ui-runtime.js +0 -1
- package/dist/lib/runtime/verify-flagged.js +0 -1
- package/dist/lib/runtime-constants.js +0 -1
- package/dist/lib/runtime-paths.js +0 -1
- package/dist/lib/runtime-rotation-proxy.d.ts +7 -124
- package/dist/lib/runtime-rotation-proxy.d.ts.map +1 -1
- package/dist/lib/runtime-rotation-proxy.js +618 -1356
- package/dist/lib/schemas.d.ts +5 -93
- package/dist/lib/schemas.d.ts.map +1 -1
- package/dist/lib/schemas.js +9 -10
- package/dist/lib/session-affinity.js +0 -1
- package/dist/lib/shutdown.js +0 -1
- package/dist/lib/storage/account-clear-entry.js +0 -1
- package/dist/lib/storage/account-clear.js +0 -1
- package/dist/lib/storage/account-match-utils.js +0 -1
- package/dist/lib/storage/account-persistence.d.ts +1 -1
- package/dist/lib/storage/account-persistence.d.ts.map +1 -1
- package/dist/lib/storage/account-persistence.js +0 -1
- package/dist/lib/storage/account-port.d.ts +1 -1
- package/dist/lib/storage/account-port.d.ts.map +1 -1
- package/dist/lib/storage/account-port.js +0 -1
- package/dist/lib/storage/account-save-entry.d.ts +1 -1
- package/dist/lib/storage/account-save-entry.d.ts.map +1 -1
- package/dist/lib/storage/account-save-entry.js +0 -1
- package/dist/lib/storage/account-save.d.ts +1 -1
- package/dist/lib/storage/account-save.d.ts.map +1 -1
- package/dist/lib/storage/account-save.js +0 -1
- package/dist/lib/storage/account-snapshot.js +0 -1
- package/dist/lib/storage/backup-metadata-builder.d.ts +1 -1
- package/dist/lib/storage/backup-metadata-builder.d.ts.map +1 -1
- package/dist/lib/storage/backup-metadata-builder.js +0 -1
- package/dist/lib/storage/backup-metadata.d.ts +13 -0
- package/dist/lib/storage/backup-metadata.d.ts.map +1 -1
- package/dist/lib/storage/backup-metadata.js +0 -1
- package/dist/lib/storage/backup-paths.js +0 -1
- package/dist/lib/storage/backup-restore.d.ts +1 -1
- package/dist/lib/storage/backup-restore.d.ts.map +1 -1
- package/dist/lib/storage/backup-restore.js +0 -1
- package/dist/lib/storage/cache-artifacts.js +0 -1
- package/dist/lib/storage/error-hints.js +0 -1
- package/dist/lib/storage/file-paths.d.ts +2 -2
- package/dist/lib/storage/file-paths.d.ts.map +1 -1
- package/dist/lib/storage/file-paths.js +2 -3
- package/dist/lib/storage/fixture-guards.d.ts +1 -1
- package/dist/lib/storage/fixture-guards.d.ts.map +1 -1
- package/dist/lib/storage/fixture-guards.js +0 -1
- package/dist/lib/storage/flagged-entry.js +0 -1
- package/dist/lib/storage/flagged-load-entry.d.ts +1 -1
- package/dist/lib/storage/flagged-load-entry.d.ts.map +1 -1
- package/dist/lib/storage/flagged-load-entry.js +0 -1
- package/dist/lib/storage/flagged-save-entry.d.ts +1 -1
- package/dist/lib/storage/flagged-save-entry.d.ts.map +1 -1
- package/dist/lib/storage/flagged-save-entry.js +0 -1
- package/dist/lib/storage/flagged-storage-file.d.ts +1 -1
- package/dist/lib/storage/flagged-storage-file.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage-file.js +0 -1
- package/dist/lib/storage/flagged-storage-io.d.ts +1 -1
- package/dist/lib/storage/flagged-storage-io.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage-io.js +2 -3
- package/dist/lib/storage/flagged-storage.d.ts +1 -1
- package/dist/lib/storage/flagged-storage.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage.js +15 -2
- package/dist/lib/storage/flagged-storage.js.map +1 -1
- package/dist/lib/storage/gitignore.js +0 -1
- package/dist/lib/storage/hash.js +0 -1
- package/dist/lib/storage/health.js +0 -1
- package/dist/lib/storage/identity.js +0 -1
- package/dist/lib/storage/import-export.d.ts +1 -1
- package/dist/lib/storage/import-export.d.ts.map +1 -1
- package/dist/lib/storage/import-export.js +2 -3
- package/dist/lib/storage/metadata-section.js +0 -1
- package/dist/lib/storage/migrations.d.ts +7 -49
- package/dist/lib/storage/migrations.d.ts.map +1 -1
- package/dist/lib/storage/migrations.js +5 -2
- package/dist/lib/storage/named-backup-entry.js +0 -1
- package/dist/lib/storage/named-backups-entry.d.ts +1 -1
- package/dist/lib/storage/named-backups-entry.d.ts.map +1 -1
- package/dist/lib/storage/named-backups-entry.js +0 -1
- package/dist/lib/storage/named-backups.js +0 -1
- package/dist/lib/storage/path-state.js +0 -1
- package/dist/lib/storage/paths.js +0 -1
- package/dist/lib/storage/project-migration.d.ts +1 -1
- package/dist/lib/storage/project-migration.d.ts.map +1 -1
- package/dist/lib/storage/project-migration.js +0 -1
- package/dist/lib/storage/public-types.d.ts +70 -0
- package/dist/lib/storage/public-types.d.ts.map +1 -0
- package/dist/lib/storage/public-types.js +6 -0
- package/dist/lib/storage/record-utils.js +0 -1
- package/dist/lib/storage/restore-assessment.d.ts +1 -1
- package/dist/lib/storage/restore-assessment.d.ts.map +1 -1
- package/dist/lib/storage/restore-assessment.js +0 -1
- package/dist/lib/storage/restore-backup-entry.d.ts +1 -1
- package/dist/lib/storage/restore-backup-entry.d.ts.map +1 -1
- package/dist/lib/storage/restore-backup-entry.js +0 -1
- package/dist/lib/storage/restore-metadata.d.ts +1 -1
- package/dist/lib/storage/restore-metadata.d.ts.map +1 -1
- package/dist/lib/storage/restore-metadata.js +0 -1
- package/dist/lib/storage/restore.d.ts +1 -1
- package/dist/lib/storage/restore.d.ts.map +1 -1
- package/dist/lib/storage/restore.js +0 -1
- package/dist/lib/storage/save-retry.d.ts +10 -0
- package/dist/lib/storage/save-retry.d.ts.map +1 -0
- package/dist/lib/storage/save-retry.js +26 -0
- package/dist/lib/storage/snapshot-inspectors.d.ts +1 -1
- package/dist/lib/storage/snapshot-inspectors.d.ts.map +1 -1
- package/dist/lib/storage/snapshot-inspectors.js +0 -1
- package/dist/lib/storage/storage-parser.d.ts +1 -1
- package/dist/lib/storage/storage-parser.d.ts.map +1 -1
- package/dist/lib/storage/storage-parser.js +0 -1
- package/dist/lib/storage/transactions.d.ts +1 -1
- package/dist/lib/storage/transactions.d.ts.map +1 -1
- package/dist/lib/storage/transactions.js +0 -1
- package/dist/lib/storage.d.ts +3 -24
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +47 -55
- package/dist/lib/table-formatter.js +0 -1
- package/dist/lib/temp-path.d.ts +26 -0
- package/dist/lib/temp-path.d.ts.map +1 -0
- package/dist/lib/temp-path.js +30 -0
- package/dist/lib/tools/hashline-tools.js +0 -1
- package/dist/lib/types.js +0 -1
- package/dist/lib/ui/ansi.js +0 -1
- package/dist/lib/ui/auth-menu-builder.d.ts +89 -0
- package/dist/lib/ui/auth-menu-builder.d.ts.map +1 -0
- package/dist/lib/ui/auth-menu-builder.js +350 -0
- package/dist/lib/ui/auth-menu.d.ts +2 -76
- package/dist/lib/ui/auth-menu.d.ts.map +1 -1
- package/dist/lib/ui/auth-menu.js +3 -349
- package/dist/lib/ui/confirm.js +0 -1
- package/dist/lib/ui/display-width.js +0 -1
- package/dist/lib/ui/format.js +0 -1
- package/dist/lib/ui/index.d.ts +10 -0
- package/dist/lib/ui/index.d.ts.map +1 -0
- package/dist/lib/ui/index.js +9 -0
- package/dist/lib/ui/runtime.js +0 -1
- package/dist/lib/ui/select.js +0 -1
- package/dist/lib/ui/theme.d.ts +3 -2
- package/dist/lib/ui/theme.d.ts.map +1 -1
- package/dist/lib/ui/theme.js +0 -1
- package/dist/lib/ui/ui-copy.d.ts +159 -0
- package/dist/lib/ui/ui-copy.d.ts.map +1 -0
- package/dist/lib/ui/ui-copy.js +163 -0
- package/dist/lib/unified-settings.d.ts.map +1 -1
- package/dist/lib/unified-settings.js +2 -2
- package/dist/lib/update-notice.d.ts.map +1 -1
- package/dist/lib/update-notice.js +2 -2
- package/dist/lib/usage/index.js +0 -1
- package/dist/lib/usage/ledger.js +0 -1
- package/dist/lib/usage/pricing.js +0 -1
- package/dist/lib/usage/redaction.js +0 -1
- package/dist/lib/usage/types.js +0 -1
- package/dist/lib/utils.js +0 -1
- package/package.json +8 -9
- package/scripts/postinstall.js +34 -265
- package/scripts/preuninstall.js +2 -2
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
2
|
+
import { createInterface } from "node:readline/promises";
|
|
3
|
+
import { ANSI } from "../ui/ansi.js";
|
|
4
|
+
import { UI_COPY } from "../ui/ui-copy.js";
|
|
5
|
+
import { stringifyLogArgs, stylePromptText, } from "./formatters/index.js";
|
|
6
|
+
import { isAbortError } from "./login-oauth.js";
|
|
7
|
+
async function waitForMenuReturn(options = {}) {
|
|
8
|
+
if (!input.isTTY || !output.isTTY) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const promptText = options.promptText ?? UI_COPY.returnFlow.continuePrompt;
|
|
12
|
+
const autoReturnMs = options.autoReturnMs ?? 0;
|
|
13
|
+
const pauseOnAnyKey = options.pauseOnAnyKey ?? true;
|
|
14
|
+
try {
|
|
15
|
+
let chunk;
|
|
16
|
+
do {
|
|
17
|
+
chunk = input.read();
|
|
18
|
+
} while (chunk !== null);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
// best effort buffer drain
|
|
22
|
+
}
|
|
23
|
+
const writeInlineStatus = (message) => {
|
|
24
|
+
output.write(`\r${ANSI.clearLine}${stylePromptText(message, "muted")}`);
|
|
25
|
+
};
|
|
26
|
+
const clearInlineStatus = () => {
|
|
27
|
+
output.write(`\r${ANSI.clearLine}`);
|
|
28
|
+
};
|
|
29
|
+
if (autoReturnMs > 0) {
|
|
30
|
+
if (!pauseOnAnyKey) {
|
|
31
|
+
await new Promise((resolve) => setTimeout(resolve, autoReturnMs));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const wasRaw = input.isRaw ?? false;
|
|
35
|
+
const endAt = Date.now() + autoReturnMs;
|
|
36
|
+
let lastShownSeconds = null;
|
|
37
|
+
const renderCountdown = () => {
|
|
38
|
+
const remainingMs = Math.max(0, endAt - Date.now());
|
|
39
|
+
const remainingSeconds = Math.max(1, Math.ceil(remainingMs / 1000));
|
|
40
|
+
if (lastShownSeconds === remainingSeconds)
|
|
41
|
+
return;
|
|
42
|
+
lastShownSeconds = remainingSeconds;
|
|
43
|
+
writeInlineStatus(UI_COPY.returnFlow.autoReturn(remainingSeconds));
|
|
44
|
+
};
|
|
45
|
+
renderCountdown();
|
|
46
|
+
const pinned = await new Promise((resolve) => {
|
|
47
|
+
let done = false;
|
|
48
|
+
const interval = setInterval(renderCountdown, 80);
|
|
49
|
+
let timeout = setTimeout(() => {
|
|
50
|
+
timeout = null;
|
|
51
|
+
if (!done) {
|
|
52
|
+
done = true;
|
|
53
|
+
cleanup();
|
|
54
|
+
resolve(false);
|
|
55
|
+
}
|
|
56
|
+
}, autoReturnMs);
|
|
57
|
+
const onData = () => {
|
|
58
|
+
if (done)
|
|
59
|
+
return;
|
|
60
|
+
done = true;
|
|
61
|
+
cleanup();
|
|
62
|
+
resolve(true);
|
|
63
|
+
};
|
|
64
|
+
const cleanup = () => {
|
|
65
|
+
clearInterval(interval);
|
|
66
|
+
if (timeout) {
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
timeout = null;
|
|
69
|
+
}
|
|
70
|
+
input.removeListener("data", onData);
|
|
71
|
+
try {
|
|
72
|
+
input.setRawMode(wasRaw);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// best effort restore
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
input.setRawMode(true);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// if raw mode fails, keep countdown behavior
|
|
83
|
+
}
|
|
84
|
+
input.on("data", onData);
|
|
85
|
+
input.resume();
|
|
86
|
+
});
|
|
87
|
+
clearInlineStatus();
|
|
88
|
+
if (!pinned) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const paused = stylePromptText(UI_COPY.returnFlow.paused, "muted");
|
|
92
|
+
writeInlineStatus(paused);
|
|
93
|
+
await new Promise((resolve) => {
|
|
94
|
+
const wasRaw = input.isRaw ?? false;
|
|
95
|
+
const onData = () => {
|
|
96
|
+
cleanup();
|
|
97
|
+
resolve();
|
|
98
|
+
};
|
|
99
|
+
const cleanup = () => {
|
|
100
|
+
input.removeListener("data", onData);
|
|
101
|
+
try {
|
|
102
|
+
input.setRawMode(wasRaw);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// best effort restore
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
try {
|
|
109
|
+
input.setRawMode(true);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// best effort fallback
|
|
113
|
+
}
|
|
114
|
+
input.on("data", onData);
|
|
115
|
+
input.resume();
|
|
116
|
+
});
|
|
117
|
+
clearInlineStatus();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const rl = createInterface({ input, output });
|
|
121
|
+
try {
|
|
122
|
+
const question = promptText.length > 0 ? `${stylePromptText(promptText, "muted")} ` : "";
|
|
123
|
+
output.write(`\r${ANSI.clearLine}`);
|
|
124
|
+
await rl.question(question);
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
if (!isAbortError(error)) {
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
rl.close();
|
|
133
|
+
clearInlineStatus();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/** @internal */
|
|
137
|
+
export async function runActionPanel(title, stage, action, settings) {
|
|
138
|
+
if (!input.isTTY || !output.isTTY) {
|
|
139
|
+
await action();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const spinnerFrames = ["-", "\\", "|", "/"];
|
|
143
|
+
let frame = 0;
|
|
144
|
+
let running = true;
|
|
145
|
+
let failed = null;
|
|
146
|
+
const captured = [];
|
|
147
|
+
const maxVisibleLines = Math.max(8, (output.rows ?? 24) - 8);
|
|
148
|
+
const previousLog = console.log;
|
|
149
|
+
const previousWarn = console.warn;
|
|
150
|
+
const previousError = console.error;
|
|
151
|
+
const capture = (prefix, args) => {
|
|
152
|
+
const line = stringifyLogArgs(args).trim();
|
|
153
|
+
if (!line)
|
|
154
|
+
return;
|
|
155
|
+
captured.push(prefix ? `${prefix}${line}` : line);
|
|
156
|
+
if (captured.length > 400) {
|
|
157
|
+
captured.splice(0, captured.length - 400);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const render = () => {
|
|
161
|
+
output.write(ANSI.clearScreen + ANSI.moveTo(1, 1));
|
|
162
|
+
const spinner = running
|
|
163
|
+
? `${spinnerFrames[frame % spinnerFrames.length] ?? "-"} `
|
|
164
|
+
: failed
|
|
165
|
+
? "x "
|
|
166
|
+
: "+ ";
|
|
167
|
+
const stageText = running
|
|
168
|
+
? `${spinner}${stage}`
|
|
169
|
+
: failed
|
|
170
|
+
? UI_COPY.returnFlow.failed
|
|
171
|
+
: UI_COPY.returnFlow.done;
|
|
172
|
+
previousLog(stylePromptText(title, "accent"));
|
|
173
|
+
previousLog(stylePromptText(stageText, failed ? "danger" : running ? "accent" : "success"));
|
|
174
|
+
previousLog("");
|
|
175
|
+
const lines = captured.slice(-maxVisibleLines);
|
|
176
|
+
for (const line of lines) {
|
|
177
|
+
previousLog(line);
|
|
178
|
+
}
|
|
179
|
+
const remainingLines = Math.max(0, maxVisibleLines - lines.length);
|
|
180
|
+
for (let i = 0; i < remainingLines; i += 1) {
|
|
181
|
+
previousLog("");
|
|
182
|
+
}
|
|
183
|
+
previousLog("");
|
|
184
|
+
if (running)
|
|
185
|
+
previousLog(stylePromptText(UI_COPY.returnFlow.working, "muted"));
|
|
186
|
+
frame += 1;
|
|
187
|
+
};
|
|
188
|
+
console.log = (...args) => {
|
|
189
|
+
capture("", args);
|
|
190
|
+
};
|
|
191
|
+
console.warn = (...args) => {
|
|
192
|
+
capture("! ", args);
|
|
193
|
+
};
|
|
194
|
+
console.error = (...args) => {
|
|
195
|
+
capture("x ", args);
|
|
196
|
+
};
|
|
197
|
+
output.write(ANSI.altScreenOn + ANSI.hide);
|
|
198
|
+
let timer = null;
|
|
199
|
+
try {
|
|
200
|
+
render();
|
|
201
|
+
timer = setInterval(() => {
|
|
202
|
+
if (!running)
|
|
203
|
+
return;
|
|
204
|
+
render();
|
|
205
|
+
}, 120);
|
|
206
|
+
await action();
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
failed = error;
|
|
210
|
+
capture("x ", [error instanceof Error ? error.message : String(error)]);
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
running = false;
|
|
214
|
+
if (timer) {
|
|
215
|
+
clearInterval(timer);
|
|
216
|
+
timer = null;
|
|
217
|
+
}
|
|
218
|
+
render();
|
|
219
|
+
console.log = previousLog;
|
|
220
|
+
console.warn = previousWarn;
|
|
221
|
+
console.error = previousError;
|
|
222
|
+
}
|
|
223
|
+
if (failed) {
|
|
224
|
+
await waitForMenuReturn({
|
|
225
|
+
promptText: UI_COPY.returnFlow.actionFailedPrompt,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
await waitForMenuReturn({
|
|
230
|
+
autoReturnMs: settings?.actionAutoReturnMs ?? 2_000,
|
|
231
|
+
pauseOnAnyKey: settings?.actionPauseOnKey ?? true,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
output.write(ANSI.altScreenOff + ANSI.show + ANSI.clearScreen + ANSI.moveTo(1, 1));
|
|
235
|
+
if (failed) {
|
|
236
|
+
throw failed;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type RepairCommandDeps } from "./repair-commands.js";
|
|
2
|
+
/**
|
|
3
|
+
* Interactive control loop for the `login` command: the account dashboard menu
|
|
4
|
+
* and the add-account/onboarding flow. Moved verbatim out of
|
|
5
|
+
* lib/codex-manager.ts (audit roadmap §4.1.1 phase 4); the menu quota-refresh
|
|
6
|
+
* bookkeeping that previously lived in closure-mutable variables is now an
|
|
7
|
+
* explicit {@link MenuQuotaRefreshState} created in runAuthLoginFlow and passed
|
|
8
|
+
* through.
|
|
9
|
+
*/
|
|
10
|
+
/** @internal */
|
|
11
|
+
export interface LoginFlowDeps {
|
|
12
|
+
runForecast(args: string[]): Promise<number>;
|
|
13
|
+
createRepairCommandDeps(): RepairCommandDeps;
|
|
14
|
+
}
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare function runAuthLogin(args: string[], deps: LoginFlowDeps): Promise<number>;
|
|
17
|
+
//# sourceMappingURL=login-flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-flow.d.ts","sourceRoot":"","sources":["../../../lib/codex-manager/login-flow.ts"],"names":[],"mappings":"AAmDA,OAAO,EACN,KAAK,iBAAiB,EAGtB,MAAM,sBAAsB,CAAC;AAM9B;;;;;;;GAOG;AAEH,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC7B,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,uBAAuB,IAAI,iBAAiB,CAAC;CAC7C;AAkCD,gBAAgB;AAChB,wBAAsB,YAAY,CACjC,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,EAAE,aAAa,GACjB,OAAO,CAAC,MAAM,CAAC,CAqBjB"}
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { isBrowserLaunchSuppressed } from "../auth/browser.js";
|
|
2
|
+
import { promptAddAnotherAccount, promptLoginMode } from "../cli.js";
|
|
3
|
+
import { ACCOUNT_LIMITS } from "../constants.js";
|
|
4
|
+
import { loadDashboardDisplaySettings } from "../dashboard-settings.js";
|
|
5
|
+
import { createLogger } from "../logger.js";
|
|
6
|
+
import { loadQuotaCache } from "../quota-cache.js";
|
|
7
|
+
import { resolveActiveIndex } from "../runtime/account-status.js";
|
|
8
|
+
import { clearAccounts, formatStorageErrorHint, getNamedBackups, loadAccounts, loadFlaggedAccounts, restoreAccountsFromBackup, setStoragePath, StorageError, } from "../storage.js";
|
|
9
|
+
import { UI_COPY } from "../ui/ui-copy.js";
|
|
10
|
+
import { confirm } from "../ui/confirm.js";
|
|
11
|
+
import { stylePromptText } from "./formatters/index.js";
|
|
12
|
+
import { runHealthCheck } from "./health-check.js";
|
|
13
|
+
import { parseAuthLoginArgs, printUsage, } from "./help.js";
|
|
14
|
+
import { runActionPanel } from "./login-action-panel.js";
|
|
15
|
+
import { handleManageAction, promptBackupRestoreMode, promptManualBackupSelection, promptOAuthSignInMode, } from "./login-menu-actions.js";
|
|
16
|
+
import { countMenuQuotaRefreshTargets, DEFAULT_MENU_QUOTA_REFRESH_TTL_MS, loadRuntimeCurrentSelectionForStorage, refreshQuotaCacheForMenu, syncCodexCliActiveSelectionIfDrifted, toExistingAccountInfo, } from "./login-menu-data.js";
|
|
17
|
+
import { isOAuthCancellation, persistAccountPool, resolveAccountSelection, runSignInFlow, syncSelectionToCodex, } from "./login-oauth.js";
|
|
18
|
+
import { persistAndSyncSelectedAccount } from "./persist-selected-account.js";
|
|
19
|
+
import { runFix as runRepairFix, runVerifyFlagged as runRepairVerifyFlagged, } from "./repair-commands.js";
|
|
20
|
+
import { applyUiThemeFromDashboardSettings, configureUnifiedSettings, } from "./settings-hub.js";
|
|
21
|
+
function clearMenuQuotaAutoRefreshSkip(state) {
|
|
22
|
+
state.skipNextMenuQuotaAutoRefresh = false;
|
|
23
|
+
state.menuQuotaRefreshGeneration += 1;
|
|
24
|
+
}
|
|
25
|
+
// The menu quota refresh runs fire-and-forget behind the dashboard. On the
|
|
26
|
+
// paths that leave the loop (add-account's storage write, process exit) an
|
|
27
|
+
// in-flight refresh must finish first so its cache save cannot race the
|
|
28
|
+
// account-pool write (Windows EBUSY/EPERM on sibling files) or be orphaned
|
|
29
|
+
// mid-write. The chain never rejects (it ends in .catch/.finally), and the
|
|
30
|
+
// wait is bounded by the per-probe HTTP timeouts.
|
|
31
|
+
async function drainPendingMenuQuotaRefresh(state) {
|
|
32
|
+
if (state.pendingMenuQuotaRefresh) {
|
|
33
|
+
await state.pendingMenuQuotaRefresh;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const log = createLogger("codex-manager");
|
|
37
|
+
async function clearAccountsAndReset() {
|
|
38
|
+
await clearAccounts();
|
|
39
|
+
}
|
|
40
|
+
/** @internal */
|
|
41
|
+
export async function runAuthLogin(args, deps) {
|
|
42
|
+
const parsedArgs = parseAuthLoginArgs(args);
|
|
43
|
+
if (!parsedArgs.ok) {
|
|
44
|
+
if (parsedArgs.reason === "error") {
|
|
45
|
+
console.error(parsedArgs.message);
|
|
46
|
+
printUsage();
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
const loginOptions = parsedArgs.options;
|
|
52
|
+
// `--org <id>` binds this login to a specific workspace/org so the same
|
|
53
|
+
// email's personal vs business/team workspace can be registered on demand
|
|
54
|
+
// (issue #491). The org is threaded explicitly into resolveAccountSelection
|
|
55
|
+
// (no process.env mutation), so concurrent re-entry (menu re-entry, a reused
|
|
56
|
+
// test worker) can never bind a login to a stale org via a shared global.
|
|
57
|
+
if (loginOptions.org) {
|
|
58
|
+
console.log(`Binding this login to workspace org id: ${loginOptions.org}`);
|
|
59
|
+
}
|
|
60
|
+
return runAuthLoginFlow(loginOptions, deps);
|
|
61
|
+
}
|
|
62
|
+
async function runLoginDashboardLoop(menuState, deps) {
|
|
63
|
+
while (true) {
|
|
64
|
+
const existingStorage = await loadAccounts();
|
|
65
|
+
if (!existingStorage || existingStorage.accounts.length === 0) {
|
|
66
|
+
await drainPendingMenuQuotaRefresh(menuState);
|
|
67
|
+
return "add-account";
|
|
68
|
+
}
|
|
69
|
+
const currentStorage = existingStorage;
|
|
70
|
+
const displaySettings = await loadDashboardDisplaySettings();
|
|
71
|
+
applyUiThemeFromDashboardSettings(displaySettings);
|
|
72
|
+
const quotaCache = await loadQuotaCache();
|
|
73
|
+
const shouldAutoFetchLimits = displaySettings.menuAutoFetchLimits ?? true;
|
|
74
|
+
const showFetchStatus = displaySettings.menuShowFetchStatus ?? true;
|
|
75
|
+
const quotaTtlMs = displaySettings.menuQuotaTtlMs ?? DEFAULT_MENU_QUOTA_REFRESH_TTL_MS;
|
|
76
|
+
const shouldSkipAutoFetchThisPass = !menuState.pendingMenuQuotaRefresh &&
|
|
77
|
+
menuState.skipNextMenuQuotaAutoRefresh;
|
|
78
|
+
if (shouldSkipAutoFetchThisPass) {
|
|
79
|
+
menuState.skipNextMenuQuotaAutoRefresh = false;
|
|
80
|
+
}
|
|
81
|
+
if (shouldAutoFetchLimits &&
|
|
82
|
+
!menuState.pendingMenuQuotaRefresh &&
|
|
83
|
+
!shouldSkipAutoFetchThisPass) {
|
|
84
|
+
const staleCount = countMenuQuotaRefreshTargets(currentStorage, quotaCache, quotaTtlMs);
|
|
85
|
+
if (staleCount > 0) {
|
|
86
|
+
if (showFetchStatus) {
|
|
87
|
+
menuState.menuQuotaRefreshStatus = `${UI_COPY.mainMenu.loadingLimits} [0/${staleCount}]`;
|
|
88
|
+
}
|
|
89
|
+
const refreshGeneration = menuState.menuQuotaRefreshGeneration;
|
|
90
|
+
menuState.pendingMenuQuotaRefresh = refreshQuotaCacheForMenu(currentStorage, quotaCache, quotaTtlMs, (current, total) => {
|
|
91
|
+
if (!showFetchStatus)
|
|
92
|
+
return;
|
|
93
|
+
menuState.menuQuotaRefreshStatus = `${UI_COPY.mainMenu.loadingLimits} [${current}/${total}]`;
|
|
94
|
+
})
|
|
95
|
+
.then(() => {
|
|
96
|
+
if (refreshGeneration === menuState.menuQuotaRefreshGeneration) {
|
|
97
|
+
menuState.skipNextMenuQuotaAutoRefresh = true;
|
|
98
|
+
}
|
|
99
|
+
return undefined;
|
|
100
|
+
})
|
|
101
|
+
.catch(() => undefined)
|
|
102
|
+
.finally(() => {
|
|
103
|
+
menuState.menuQuotaRefreshStatus = undefined;
|
|
104
|
+
menuState.pendingMenuQuotaRefresh = null;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const flaggedStorage = await loadFlaggedAccounts();
|
|
109
|
+
await syncCodexCliActiveSelectionIfDrifted(currentStorage);
|
|
110
|
+
const runtimeCurrent = await loadRuntimeCurrentSelectionForStorage(currentStorage);
|
|
111
|
+
const menuResult = await promptLoginMode(toExistingAccountInfo(currentStorage, quotaCache, displaySettings, runtimeCurrent), {
|
|
112
|
+
flaggedCount: flaggedStorage.accounts.length,
|
|
113
|
+
statusMessage: showFetchStatus
|
|
114
|
+
? () => menuState.menuQuotaRefreshStatus
|
|
115
|
+
: undefined,
|
|
116
|
+
});
|
|
117
|
+
if (menuResult.mode === "cancel") {
|
|
118
|
+
console.log("Cancelled.");
|
|
119
|
+
await drainPendingMenuQuotaRefresh(menuState);
|
|
120
|
+
return "exit";
|
|
121
|
+
}
|
|
122
|
+
if (menuResult.mode === "check") {
|
|
123
|
+
clearMenuQuotaAutoRefreshSkip(menuState);
|
|
124
|
+
await runActionPanel("Quick Check", "Checking local session + live status", async () => {
|
|
125
|
+
await runHealthCheck({ forceRefresh: false, liveProbe: true });
|
|
126
|
+
}, displaySettings);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (menuResult.mode === "deep-check") {
|
|
130
|
+
clearMenuQuotaAutoRefreshSkip(menuState);
|
|
131
|
+
await runActionPanel("Deep Check", "Refreshing and testing all accounts", async () => {
|
|
132
|
+
await runHealthCheck({ forceRefresh: true, liveProbe: true });
|
|
133
|
+
}, displaySettings);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (menuResult.mode === "forecast") {
|
|
137
|
+
clearMenuQuotaAutoRefreshSkip(menuState);
|
|
138
|
+
await runActionPanel("Best Account", "Comparing accounts", async () => {
|
|
139
|
+
await deps.runForecast(["--live"]);
|
|
140
|
+
}, displaySettings);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (menuResult.mode === "fix") {
|
|
144
|
+
clearMenuQuotaAutoRefreshSkip(menuState);
|
|
145
|
+
await runActionPanel("Auto-Fix", "Checking and fixing common issues", async () => {
|
|
146
|
+
await runRepairFix(["--live"], deps.createRepairCommandDeps());
|
|
147
|
+
}, displaySettings);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (menuResult.mode === "settings") {
|
|
151
|
+
clearMenuQuotaAutoRefreshSkip(menuState);
|
|
152
|
+
await configureUnifiedSettings(displaySettings);
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (menuResult.mode === "verify-flagged") {
|
|
156
|
+
clearMenuQuotaAutoRefreshSkip(menuState);
|
|
157
|
+
await runActionPanel("Problem Account Check", "Checking problem accounts", async () => {
|
|
158
|
+
await runRepairVerifyFlagged([], deps.createRepairCommandDeps());
|
|
159
|
+
}, displaySettings);
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (menuResult.mode === "fresh" && menuResult.deleteAll) {
|
|
163
|
+
clearMenuQuotaAutoRefreshSkip(menuState);
|
|
164
|
+
await runActionPanel("Reset Accounts", "Deleting all saved accounts", async () => {
|
|
165
|
+
await clearAccountsAndReset();
|
|
166
|
+
console.log("Cleared saved accounts from active storage. Recovery snapshots remain available.");
|
|
167
|
+
}, displaySettings);
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (menuResult.mode === "manage") {
|
|
171
|
+
clearMenuQuotaAutoRefreshSkip(menuState);
|
|
172
|
+
const requiresInteractiveOAuth = typeof menuResult.refreshAccountIndex === "number";
|
|
173
|
+
if (requiresInteractiveOAuth) {
|
|
174
|
+
await handleManageAction(currentStorage, menuResult);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
await runActionPanel("Applying Change", "Updating selected account", async () => {
|
|
178
|
+
await handleManageAction(currentStorage, menuResult);
|
|
179
|
+
}, displaySettings);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (menuResult.mode === "add") {
|
|
183
|
+
await drainPendingMenuQuotaRefresh(menuState);
|
|
184
|
+
return "add-account";
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async function runAuthLoginFlow(loginOptions, deps) {
|
|
189
|
+
setStoragePath(null);
|
|
190
|
+
const menuState = {
|
|
191
|
+
pendingMenuQuotaRefresh: null,
|
|
192
|
+
menuQuotaRefreshStatus: undefined,
|
|
193
|
+
skipNextMenuQuotaAutoRefresh: false,
|
|
194
|
+
menuQuotaRefreshGeneration: 0,
|
|
195
|
+
};
|
|
196
|
+
// When the user explicitly picks a sign-in transport on the command line
|
|
197
|
+
// (--device-auth, --manual, --no-browser), they want to add a new account
|
|
198
|
+
// directly. Skipping the dashboard menu keeps `login --device-auth`
|
|
199
|
+
// usable from scripts and matches the documented behavior of the help text.
|
|
200
|
+
const explicitSignInMode = loginOptions.deviceAuth || loginOptions.manual;
|
|
201
|
+
loginFlow: while (true) {
|
|
202
|
+
const existingStorage = await loadAccounts();
|
|
203
|
+
if (!explicitSignInMode &&
|
|
204
|
+
existingStorage &&
|
|
205
|
+
existingStorage.accounts.length > 0) {
|
|
206
|
+
const dashboardOutcome = await runLoginDashboardLoop(menuState, deps);
|
|
207
|
+
if (dashboardOutcome === "exit") {
|
|
208
|
+
return 0;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const refreshedStorage = await loadAccounts();
|
|
212
|
+
let existingCount = refreshedStorage?.accounts.length ?? 0;
|
|
213
|
+
let forceNewLogin = existingCount > 0;
|
|
214
|
+
let onboardingBackupDiscoveryWarning = null;
|
|
215
|
+
const loadNamedBackupsForOnboarding = async () => {
|
|
216
|
+
if (existingCount > 0) {
|
|
217
|
+
onboardingBackupDiscoveryWarning = null;
|
|
218
|
+
return [];
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
onboardingBackupDiscoveryWarning = null;
|
|
222
|
+
return await getNamedBackups();
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
const code = error.code;
|
|
226
|
+
log.debug("getNamedBackups failed, skipping restore option", {
|
|
227
|
+
code,
|
|
228
|
+
error: error instanceof Error ? error.message : String(error),
|
|
229
|
+
});
|
|
230
|
+
if (code && code !== "ENOENT") {
|
|
231
|
+
onboardingBackupDiscoveryWarning =
|
|
232
|
+
"Named backup discovery failed. Continuing with browser or manual sign-in only.";
|
|
233
|
+
console.warn(onboardingBackupDiscoveryWarning);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
onboardingBackupDiscoveryWarning = null;
|
|
237
|
+
}
|
|
238
|
+
return [];
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
let namedBackups = await loadNamedBackupsForOnboarding();
|
|
242
|
+
while (true) {
|
|
243
|
+
const latestNamedBackup = namedBackups[0] ?? null;
|
|
244
|
+
const preferManualMode = loginOptions.manual || isBrowserLaunchSuppressed();
|
|
245
|
+
const signInMode = loginOptions.deviceAuth
|
|
246
|
+
? "device"
|
|
247
|
+
: preferManualMode
|
|
248
|
+
? "manual"
|
|
249
|
+
: await promptOAuthSignInMode(latestNamedBackup, onboardingBackupDiscoveryWarning);
|
|
250
|
+
if (signInMode === "cancel") {
|
|
251
|
+
if (existingCount > 0) {
|
|
252
|
+
console.log(stylePromptText(UI_COPY.oauth.cancelledBackToMenu, "muted"));
|
|
253
|
+
continue loginFlow;
|
|
254
|
+
}
|
|
255
|
+
console.log("Cancelled.");
|
|
256
|
+
return 0;
|
|
257
|
+
}
|
|
258
|
+
if (signInMode === "restore-backup") {
|
|
259
|
+
const latestAvailableBackup = namedBackups[0] ?? null;
|
|
260
|
+
if (!latestAvailableBackup) {
|
|
261
|
+
namedBackups = await loadNamedBackupsForOnboarding();
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const restoreMode = await promptBackupRestoreMode(latestAvailableBackup);
|
|
265
|
+
if (restoreMode === "back") {
|
|
266
|
+
namedBackups = await loadNamedBackupsForOnboarding();
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const selectedBackup = restoreMode === "manual"
|
|
270
|
+
? await promptManualBackupSelection(namedBackups)
|
|
271
|
+
: latestAvailableBackup;
|
|
272
|
+
if (!selectedBackup) {
|
|
273
|
+
namedBackups = await loadNamedBackupsForOnboarding();
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
const confirmed = await confirm(UI_COPY.oauth.restoreBackupConfirm(selectedBackup.fileName, selectedBackup.accountCount));
|
|
277
|
+
if (!confirmed) {
|
|
278
|
+
namedBackups = await loadNamedBackupsForOnboarding();
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
const displaySettings = await loadDashboardDisplaySettings();
|
|
282
|
+
applyUiThemeFromDashboardSettings(displaySettings);
|
|
283
|
+
try {
|
|
284
|
+
await runActionPanel("Load Backup", `Loading ${selectedBackup.fileName}`, async () => {
|
|
285
|
+
const restoredStorage = await restoreAccountsFromBackup(selectedBackup.path, { persist: false });
|
|
286
|
+
const targetIndex = resolveActiveIndex(restoredStorage);
|
|
287
|
+
const { synced } = await persistAndSyncSelectedAccount({
|
|
288
|
+
storage: restoredStorage,
|
|
289
|
+
targetIndex,
|
|
290
|
+
parsed: targetIndex + 1,
|
|
291
|
+
switchReason: "restore",
|
|
292
|
+
preserveActiveIndexByFamily: true,
|
|
293
|
+
});
|
|
294
|
+
console.log(UI_COPY.oauth.restoreBackupLoaded(selectedBackup.fileName, restoredStorage.accounts.length));
|
|
295
|
+
if (!synced) {
|
|
296
|
+
console.warn(UI_COPY.oauth.restoreBackupSyncWarning);
|
|
297
|
+
}
|
|
298
|
+
}, displaySettings);
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
302
|
+
if (error instanceof StorageError) {
|
|
303
|
+
console.error(formatStorageErrorHint(error, selectedBackup.path));
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
console.error(`Backup restore failed: ${message}`);
|
|
307
|
+
}
|
|
308
|
+
const storageAfterRestoreAttempt = await loadAccounts().catch(() => null);
|
|
309
|
+
if ((storageAfterRestoreAttempt?.accounts.length ?? 0) > 0) {
|
|
310
|
+
continue loginFlow;
|
|
311
|
+
}
|
|
312
|
+
namedBackups = await loadNamedBackupsForOnboarding();
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
continue loginFlow;
|
|
316
|
+
}
|
|
317
|
+
if (signInMode !== "browser" &&
|
|
318
|
+
signInMode !== "manual" &&
|
|
319
|
+
signInMode !== "device") {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
const tokenResult = await runSignInFlow(forceNewLogin, signInMode);
|
|
323
|
+
if (tokenResult.type !== "success") {
|
|
324
|
+
if (isOAuthCancellation(tokenResult)) {
|
|
325
|
+
// In explicit-mode invocations the dashboard was bypassed,
|
|
326
|
+
// so falling back to it on cancel would re-enter the same
|
|
327
|
+
// transport flow and trap the user. Exit cleanly instead.
|
|
328
|
+
if (explicitSignInMode) {
|
|
329
|
+
console.log("Cancelled.");
|
|
330
|
+
return 0;
|
|
331
|
+
}
|
|
332
|
+
if (existingCount > 0) {
|
|
333
|
+
console.log(stylePromptText(UI_COPY.oauth.cancelledBackToMenu, "muted"));
|
|
334
|
+
continue loginFlow;
|
|
335
|
+
}
|
|
336
|
+
console.log("Cancelled.");
|
|
337
|
+
return 0;
|
|
338
|
+
}
|
|
339
|
+
console.error(`Login failed: ${tokenResult.message ?? tokenResult.reason ?? "unknown error"}`);
|
|
340
|
+
return 1;
|
|
341
|
+
}
|
|
342
|
+
const resolved = resolveAccountSelection(tokenResult, loginOptions.org);
|
|
343
|
+
const persistOutcome = await persistAccountPool([resolved], false);
|
|
344
|
+
await syncSelectionToCodex(resolved);
|
|
345
|
+
const latestStorage = await loadAccounts();
|
|
346
|
+
const count = latestStorage?.accounts.length ?? 1;
|
|
347
|
+
existingCount = count;
|
|
348
|
+
namedBackups = [];
|
|
349
|
+
onboardingBackupDiscoveryWarning = null;
|
|
350
|
+
// Only claim a new saved slot when one was actually appended. A
|
|
351
|
+
// same-email login that maps onto an existing entry updates or
|
|
352
|
+
// rebinds it instead of growing the pool (issue #512).
|
|
353
|
+
const outcomeMessage = persistOutcome === "rebound"
|
|
354
|
+
? `Rebound workspace for existing account. Total: ${count}`
|
|
355
|
+
: persistOutcome === "updated"
|
|
356
|
+
? `Updated existing account. Total: ${count}`
|
|
357
|
+
: `Added account. Total: ${count}`;
|
|
358
|
+
console.log(outcomeMessage);
|
|
359
|
+
console.log("Next steps:");
|
|
360
|
+
console.log(" codex-multi-auth status Check that the wrapper is active.");
|
|
361
|
+
console.log(" codex-multi-auth check Confirm your saved accounts look healthy.");
|
|
362
|
+
console.log(" codex-multi-auth list Review saved accounts before switching.");
|
|
363
|
+
if (count >= ACCOUNT_LIMITS.MAX_ACCOUNTS) {
|
|
364
|
+
console.log(`Reached maximum account limit (${ACCOUNT_LIMITS.MAX_ACCOUNTS}).`);
|
|
365
|
+
// Same reasoning as the addAnother=false branch below: in
|
|
366
|
+
// explicit mode the dashboard is bypassed, so falling out of
|
|
367
|
+
// the inner loop would re-enter loginFlow and silently start
|
|
368
|
+
// another sign-in session despite the cap.
|
|
369
|
+
if (explicitSignInMode) {
|
|
370
|
+
return 0;
|
|
371
|
+
}
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
const addAnother = await promptAddAnotherAccount(count);
|
|
375
|
+
if (!addAnother) {
|
|
376
|
+
// With an explicit transport flag the dashboard was bypassed,
|
|
377
|
+
// so falling back to it after declining would loop into a fresh
|
|
378
|
+
// sign-in instead of exiting. Return directly in that case.
|
|
379
|
+
if (explicitSignInMode) {
|
|
380
|
+
return 0;
|
|
381
|
+
}
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
forceNewLogin = true;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { promptLoginMode } from "../cli.js";
|
|
2
|
+
import { type AccountStorageV3, type NamedBackupSummary } from "../storage.js";
|
|
3
|
+
import { type OAuthSignInMode } from "./login-oauth.js";
|
|
4
|
+
/**
|
|
5
|
+
* Per-menu-item action handlers for the login dashboard: sign-in mode and
|
|
6
|
+
* backup-restore prompts plus the manage actions (switch/delete/toggle/refresh
|
|
7
|
+
* an account row). Moved verbatim out of lib/codex-manager.ts (audit roadmap
|
|
8
|
+
* §4.1.1 phase 4).
|
|
9
|
+
*/
|
|
10
|
+
/** @internal */
|
|
11
|
+
export type BackupRestoreMode = "latest" | "manual" | "back";
|
|
12
|
+
/** @internal */
|
|
13
|
+
export declare function promptOAuthSignInMode(backupOption: NamedBackupSummary | null, backupDiscoveryWarning?: string | null): Promise<OAuthSignInMode>;
|
|
14
|
+
/** @internal */
|
|
15
|
+
export declare function promptBackupRestoreMode(latestBackup: NamedBackupSummary): Promise<BackupRestoreMode>;
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare function promptManualBackupSelection(backups: NamedBackupSummary[]): Promise<NamedBackupSummary | null>;
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare function handleManageAction(storage: AccountStorageV3, menuResult: Awaited<ReturnType<typeof promptLoginMode>>): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=login-menu-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login-menu-actions.d.ts","sourceRoot":"","sources":["../../../lib/codex-manager/login-menu-actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAEN,KAAK,gBAAgB,EAGrB,KAAK,kBAAkB,EAGvB,MAAM,eAAe,CAAC;AASvB,OAAO,EACN,KAAK,eAAe,EAKpB,MAAM,kBAAkB,CAAC;AAG1B;;;;;GAKG;AAEH,gBAAgB;AAChB,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE7D,gBAAgB;AAChB,wBAAsB,qBAAqB,CAC1C,YAAY,EAAE,kBAAkB,GAAG,IAAI,EACvC,sBAAsB,GAAE,MAAM,GAAG,IAAW,GAC1C,OAAO,CAAC,eAAe,CAAC,CA6D1B;AAED,gBAAgB;AAChB,wBAAsB,uBAAuB,CAC5C,YAAY,EAAE,kBAAkB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CA0C5B;AAED,gBAAgB;AAChB,wBAAsB,2BAA2B,CAChD,OAAO,EAAE,kBAAkB,EAAE,GAC3B,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAkCpC;AA2GD,gBAAgB;AAChB,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,gBAAgB,EACzB,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC,CA8Gf"}
|