codex-multi-auth 2.17.0 → 2.17.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 +9 -9
- package/LICENSE +21 -21
- package/README.md +142 -484
- package/assets/codex-multi-auth-icon.svg +39 -39
- package/assets/readme-hero.svg +31 -31
- package/config/README.md +31 -31
- package/config/codex-legacy.json +1221 -1221
- package/config/codex-modern.json +423 -423
- package/config/minimal-codex.json +15 -15
- package/dist/index.d.ts +0 -1
- package/dist/lib/account-policy.d.ts +18 -2
- package/dist/lib/account-policy.js +97 -40
- package/dist/lib/accounts/rate-limits.d.ts +0 -1
- package/dist/lib/accounts.d.ts +1 -8
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +7 -19
- package/dist/lib/api-route-store.d.ts +0 -1
- package/dist/lib/audit.d.ts +0 -1
- package/dist/lib/audit.js +43 -12
- package/dist/lib/auth/account-access.d.ts +0 -1
- package/dist/lib/auth/account-access.js +5 -1
- package/dist/lib/auth/auth.d.ts +4 -3
- package/dist/lib/auth/auth.js +220 -28
- package/dist/lib/auth/browser.d.ts +0 -1
- package/dist/lib/auth/callback-guidance.d.ts +0 -1
- package/dist/lib/auth/device-auth.d.ts +0 -1
- package/dist/lib/auth/index.d.ts +0 -1
- package/dist/lib/auth/org-override.d.ts +0 -1
- package/dist/lib/auth/server.d.ts +1 -2
- package/dist/lib/auth/server.js +100 -53
- package/dist/lib/auth/token-utils.d.ts +0 -1
- package/dist/lib/auth-rate-limit.d.ts +0 -1
- package/dist/lib/budget-guard.d.ts +16 -2
- package/dist/lib/budget-guard.js +123 -43
- package/dist/lib/capability-policy.d.ts +0 -1
- package/dist/lib/circuit-breaker.d.ts +20 -1
- package/dist/lib/circuit-breaker.js +24 -5
- package/dist/lib/cli.d.ts +0 -1
- package/dist/lib/codex-cli/index.d.ts +0 -1
- package/dist/lib/codex-cli/observability.d.ts +0 -1
- package/dist/lib/codex-cli/state.d.ts +0 -1
- package/dist/lib/codex-cli/sync.d.ts +0 -1
- package/dist/lib/codex-cli/writer.d.ts +0 -1
- package/dist/lib/codex-manager/account-credentials.d.ts +0 -1
- package/dist/lib/codex-manager/account-manager-commands.d.ts +0 -1
- package/dist/lib/codex-manager/account-pool-write.d.ts +0 -1
- package/dist/lib/codex-manager/active-account-sync.d.ts +6 -0
- package/dist/lib/codex-manager/active-account-sync.js +336 -0
- package/dist/lib/codex-manager/api-login-menu.d.ts +0 -1
- package/dist/lib/codex-manager/backend-category-entry.d.ts +0 -1
- package/dist/lib/codex-manager/backend-category-helpers.d.ts +0 -1
- package/dist/lib/codex-manager/backend-category-prompt.d.ts +0 -1
- package/dist/lib/codex-manager/backend-settings-controller.d.ts +0 -1
- package/dist/lib/codex-manager/backend-settings-entry.d.ts +0 -1
- package/dist/lib/codex-manager/backend-settings-helpers.d.ts +0 -1
- package/dist/lib/codex-manager/backend-settings-prompt.d.ts +0 -1
- package/dist/lib/codex-manager/backend-settings-schema.d.ts +0 -1
- package/dist/lib/codex-manager/behavior-settings-panel.d.ts +0 -1
- package/dist/lib/codex-manager/commands/account.d.ts +8 -3
- package/dist/lib/codex-manager/commands/account.js +46 -34
- package/dist/lib/codex-manager/commands/best.d.ts +0 -1
- package/dist/lib/codex-manager/commands/bridge.d.ts +0 -1
- package/dist/lib/codex-manager/commands/budget.d.ts +8 -3
- package/dist/lib/codex-manager/commands/budget.js +6 -4
- package/dist/lib/codex-manager/commands/check.d.ts +0 -1
- package/dist/lib/codex-manager/commands/config-explain.d.ts +0 -1
- package/dist/lib/codex-manager/commands/debug-bundle.d.ts +0 -1
- package/dist/lib/codex-manager/commands/forecast.d.ts +1 -2
- package/dist/lib/codex-manager/commands/forecast.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/forecast.js +2 -2
- package/dist/lib/codex-manager/commands/history.d.ts +0 -1
- package/dist/lib/codex-manager/commands/init-config.d.ts +0 -1
- package/dist/lib/codex-manager/commands/integrations.d.ts +0 -1
- package/dist/lib/codex-manager/commands/limits.d.ts +0 -1
- package/dist/lib/codex-manager/commands/models.d.ts +0 -1
- package/dist/lib/codex-manager/commands/monitor.d.ts +0 -1
- package/dist/lib/codex-manager/commands/report.d.ts +0 -1
- package/dist/lib/codex-manager/commands/resets.d.ts +0 -1
- package/dist/lib/codex-manager/commands/resets.js +9 -1
- package/dist/lib/codex-manager/commands/rotation.d.ts +0 -1
- package/dist/lib/codex-manager/commands/status.d.ts +0 -1
- package/dist/lib/codex-manager/commands/switch.d.ts +0 -1
- package/dist/lib/codex-manager/commands/uninstall.d.ts +0 -1
- package/dist/lib/codex-manager/commands/unpin.d.ts +0 -1
- package/dist/lib/codex-manager/commands/usage.d.ts +0 -1
- package/dist/lib/codex-manager/commands/verify.d.ts +0 -1
- package/dist/lib/codex-manager/commands/why-selected.d.ts +0 -1
- package/dist/lib/codex-manager/commands/workspace.d.ts +0 -1
- package/dist/lib/codex-manager/dashboard-display-panel.d.ts +0 -1
- package/dist/lib/codex-manager/dashboard-formatters.d.ts +0 -1
- package/dist/lib/codex-manager/dashboard-settings-controller.d.ts +0 -1
- package/dist/lib/codex-manager/dashboard-settings-data.d.ts +0 -1
- package/dist/lib/codex-manager/dashboard-settings-entry.d.ts +0 -1
- package/dist/lib/codex-manager/experimental-settings-entry.d.ts +0 -1
- package/dist/lib/codex-manager/experimental-settings-prompt.d.ts +0 -1
- package/dist/lib/codex-manager/experimental-settings-schema.d.ts +0 -1
- package/dist/lib/codex-manager/experimental-sync-target-entry.d.ts +0 -1
- package/dist/lib/codex-manager/experimental-sync-target.d.ts +0 -1
- package/dist/lib/codex-manager/forecast-report-shared.d.ts +0 -1
- package/dist/lib/codex-manager/formatters/account-formatters.d.ts +0 -1
- package/dist/lib/codex-manager/formatters/index.d.ts +0 -1
- package/dist/lib/codex-manager/formatters/model-formatters.d.ts +0 -1
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts +0 -1
- package/dist/lib/codex-manager/formatters/text-style.d.ts +0 -1
- package/dist/lib/codex-manager/health-check.d.ts +0 -1
- package/dist/lib/codex-manager/health-check.js +1 -1
- package/dist/lib/codex-manager/help.d.ts +0 -1
- package/dist/lib/codex-manager/login-action-panel.d.ts +0 -1
- package/dist/lib/codex-manager/login-flow.d.ts +0 -1
- package/dist/lib/codex-manager/login-menu-actions.d.ts +0 -1
- package/dist/lib/codex-manager/login-menu-data.d.ts +0 -1
- package/dist/lib/codex-manager/login-menu-data.d.ts.map +1 -1
- package/dist/lib/codex-manager/login-menu-data.js +7 -3
- package/dist/lib/codex-manager/login-oauth.d.ts +0 -1
- package/dist/lib/codex-manager/login-workspace-choice.d.ts +0 -1
- package/dist/lib/codex-manager/manual-callback.d.ts +0 -1
- package/dist/lib/codex-manager/persist-selected-account.d.ts +0 -1
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts +7 -2
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts.map +1 -1
- package/dist/lib/codex-manager/quota-cache-helpers.js +34 -19
- package/dist/lib/codex-manager/rate-limit-markers.d.ts +0 -1
- package/dist/lib/codex-manager/repair-commands.d.ts +0 -1
- package/dist/lib/codex-manager/repair-commands.js +1 -1
- package/dist/lib/codex-manager/settings-hub/backend.d.ts +0 -1
- package/dist/lib/codex-manager/settings-hub/dashboard.d.ts +0 -1
- package/dist/lib/codex-manager/settings-hub/experimental.d.ts +0 -1
- package/dist/lib/codex-manager/settings-hub/index.d.ts +0 -1
- package/dist/lib/codex-manager/settings-hub/shared.d.ts +0 -1
- package/dist/lib/codex-manager/settings-hub-entry.d.ts +0 -1
- package/dist/lib/codex-manager/settings-hub-menu.d.ts +0 -1
- package/dist/lib/codex-manager/settings-hub-prompt.d.ts +0 -1
- package/dist/lib/codex-manager/settings-hub.d.ts +0 -1
- package/dist/lib/codex-manager/settings-panels.d.ts +0 -1
- package/dist/lib/codex-manager/settings-persist-utils.d.ts +0 -1
- package/dist/lib/codex-manager/settings-preview.d.ts +0 -1
- package/dist/lib/codex-manager/settings-write-queue.d.ts +0 -1
- package/dist/lib/codex-manager/statusline-settings-panel.d.ts +0 -1
- package/dist/lib/codex-manager/theme-settings-panel.d.ts +0 -1
- package/dist/lib/codex-manager/unified-settings-controller.d.ts +0 -1
- package/dist/lib/codex-manager/unified-settings-entry.d.ts +0 -1
- package/dist/lib/codex-manager.d.ts +1 -2
- package/dist/lib/codex-manager.js +5 -95
- package/dist/lib/concurrency.d.ts +0 -1
- package/dist/lib/config-schema.d.ts +0 -1
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +46 -241
- package/dist/lib/constants.d.ts +0 -1
- package/dist/lib/context-budget/model-context-windows.d.ts +0 -1
- package/dist/lib/context-budget-guard.d.ts +0 -1
- package/dist/lib/context-budget-response.d.ts +0 -1
- package/dist/lib/context-budget-response.js +8 -8
- package/dist/lib/context-overflow.d.ts +0 -1
- package/dist/lib/context-overflow.js +10 -10
- package/dist/lib/dashboard-settings.d.ts +0 -1
- package/dist/lib/entitlement-cache.d.ts +0 -1
- package/dist/lib/env-parsing.d.ts +13 -1
- package/dist/lib/env-parsing.js +21 -0
- package/dist/lib/errors.d.ts +0 -1
- package/dist/lib/forecast.d.ts +0 -1
- package/dist/lib/fs-retry.d.ts +0 -1
- package/dist/lib/health.d.ts +0 -1
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/integration-generators.d.ts +0 -1
- package/dist/lib/live-account-sync.d.ts +0 -1
- package/dist/lib/local-bridge.d.ts +0 -1
- package/dist/lib/local-bridge.js +4 -1
- package/dist/lib/local-client-tokens.d.ts +0 -1
- package/dist/lib/local-client-tokens.js +125 -30
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +11 -1
- package/dist/lib/model-capability-matrix.d.ts +0 -1
- package/dist/lib/model-route-policy.d.ts +1 -2
- package/dist/lib/named-backup-export.d.ts +0 -1
- package/dist/lib/oauth-success.html +125 -125
- package/dist/lib/oc-chatgpt-import-adapter.d.ts +0 -1
- package/dist/lib/oc-chatgpt-orchestrator.d.ts +0 -1
- package/dist/lib/oc-chatgpt-target-detection.d.ts +0 -1
- package/dist/lib/parallel-probe.d.ts +0 -1
- package/dist/lib/policy/runtime-policy-cache.d.ts +80 -0
- package/dist/lib/policy/runtime-policy-cache.js +310 -0
- package/dist/lib/policy/runtime-policy.d.ts +1 -2
- package/dist/lib/policy/runtime-policy.js +46 -19
- package/dist/lib/preemptive-quota-scheduler.d.ts +0 -1
- package/dist/lib/proactive-refresh.d.ts +0 -1
- package/dist/lib/prompts/codex-host-bridge.d.ts +0 -1
- package/dist/lib/prompts/codex-host-bridge.js +138 -138
- package/dist/lib/prompts/codex.d.ts +0 -1
- package/dist/lib/prompts/codex.js +79 -79
- package/dist/lib/prompts/fetch-utils.d.ts +0 -1
- package/dist/lib/prompts/host-codex-prompt.d.ts +0 -1
- package/dist/lib/quota-cache.d.ts +7 -4
- package/dist/lib/quota-cache.d.ts.map +1 -1
- package/dist/lib/quota-cache.js +117 -61
- package/dist/lib/quota-probe.d.ts +0 -1
- package/dist/lib/quota-probe.js +5 -2
- package/dist/lib/quota-readiness.d.ts +7 -3
- package/dist/lib/quota-readiness.d.ts.map +1 -1
- package/dist/lib/quota-readiness.js +25 -4
- package/dist/lib/recovery/constants.d.ts +0 -1
- package/dist/lib/recovery/storage.d.ts +0 -1
- package/dist/lib/recovery/types.d.ts +0 -1
- package/dist/lib/recovery.d.ts +0 -1
- package/dist/lib/redaction.d.ts +0 -1
- package/dist/lib/refresh-guardian.d.ts +0 -1
- package/dist/lib/refresh-lease.d.ts +0 -1
- package/dist/lib/refresh-queue.d.ts +0 -1
- package/dist/lib/request/client-cancellation.d.ts +0 -1
- package/dist/lib/request/error-classification.d.ts +0 -1
- package/dist/lib/request/failover-config.d.ts +0 -1
- package/dist/lib/request/failure-policy.d.ts +0 -1
- package/dist/lib/request/fetch-helpers.d.ts +0 -1
- package/dist/lib/request/headers.d.ts +0 -1
- package/dist/lib/request/helpers/input-utils.d.ts +0 -1
- package/dist/lib/request/helpers/input-utils.js +88 -34
- package/dist/lib/request/helpers/model-map.d.ts +0 -1
- package/dist/lib/request/helpers/tool-utils.d.ts +0 -1
- package/dist/lib/request/helpers/tool-utils.js +421 -4
- package/dist/lib/request/index.d.ts +0 -1
- package/dist/lib/request/rate-limit-backoff.d.ts +0 -1
- package/dist/lib/request/rate-limit-decision.d.ts +0 -1
- package/dist/lib/request/request-attempt-budget.d.ts +0 -1
- package/dist/lib/request/request-init.d.ts +0 -1
- package/dist/lib/request/request-resilience.d.ts +0 -1
- package/dist/lib/request/request-transformer.d.ts +0 -1
- package/dist/lib/request/request-transformer.js +50 -25
- package/dist/lib/request/response-compaction.d.ts +0 -1
- package/dist/lib/request/response-handler.d.ts +0 -1
- package/dist/lib/request/response-metadata.d.ts +0 -1
- package/dist/lib/request/response-outcome.d.ts +0 -1
- package/dist/lib/request/stream-failover-runtime.d.ts +0 -1
- package/dist/lib/request/stream-failover.d.ts +0 -1
- package/dist/lib/request/stream-failover.js +28 -4
- package/dist/lib/request/token-refresh.d.ts +0 -1
- package/dist/lib/request/url-rewriting.d.ts +0 -1
- package/dist/lib/request/wait-utils.d.ts +0 -1
- package/dist/lib/rotation.d.ts +0 -1
- package/dist/lib/routing-mutex.d.ts +0 -1
- package/dist/lib/routing-profiles.d.ts +16 -2
- package/dist/lib/routing-profiles.js +119 -44
- package/dist/lib/runtime/account-check-helpers.d.ts +0 -1
- package/dist/lib/runtime/account-check-types.d.ts +0 -1
- package/dist/lib/runtime/account-check.d.ts +0 -1
- package/dist/lib/runtime/account-manager-cache-entry.d.ts +0 -1
- package/dist/lib/runtime/account-manager-cache.d.ts +0 -1
- package/dist/lib/runtime/account-model-catalog.d.ts +1 -2
- package/dist/lib/runtime/account-pool.d.ts +0 -1
- package/dist/lib/runtime/account-reset-credits.d.ts +0 -1
- package/dist/lib/runtime/account-reset-credits.js +8 -2
- package/dist/lib/runtime/account-scope.d.ts +0 -1
- package/dist/lib/runtime/account-select-event.d.ts +0 -1
- package/dist/lib/runtime/account-selection.d.ts +0 -1
- package/dist/lib/runtime/account-state.d.ts +0 -1
- package/dist/lib/runtime/account-status.d.ts +0 -1
- package/dist/lib/runtime/account-storage-scope-entry.d.ts +0 -1
- package/dist/lib/runtime/api-model-capabilities.d.ts +0 -1
- package/dist/lib/runtime/api-model-runtime.d.ts +0 -1
- package/dist/lib/runtime/app-bind.d.ts +0 -1
- package/dist/lib/runtime/app-bind.d.ts.map +1 -1
- package/dist/lib/runtime/app-bind.js +10 -2
- package/dist/lib/runtime/app-helper-selection.d.ts +0 -1
- package/dist/lib/runtime/auth-facade.d.ts +0 -1
- package/dist/lib/runtime/automatic-account-checks.d.ts +5 -2
- package/dist/lib/runtime/automatic-account-checks.d.ts.map +1 -1
- package/dist/lib/runtime/automatic-account-checks.js +29 -2
- package/dist/lib/runtime/automatic-subscription-checks.d.ts +1 -2
- package/dist/lib/runtime/automatic-subscription-checks.d.ts.map +1 -1
- package/dist/lib/runtime/automatic-subscription-checks.js +13 -16
- package/dist/lib/runtime/browser-oauth-flow.d.ts +0 -1
- package/dist/lib/runtime/capability-boost.d.ts +0 -1
- package/dist/lib/runtime/catalog-capabilities.d.ts +0 -1
- package/dist/lib/runtime/config-toml.d.ts +0 -1
- package/dist/lib/runtime/context-budget-settings.d.ts +0 -1
- package/dist/lib/runtime/event-handler.d.ts +0 -1
- package/dist/lib/runtime/first-run.d.ts +0 -1
- package/dist/lib/runtime/flagged-verify-types.d.ts +0 -1
- package/dist/lib/runtime/hydrate-emails.d.ts +0 -1
- package/dist/lib/runtime/inference-activity.d.ts +0 -1
- package/dist/lib/runtime/live-sync-entry.d.ts +0 -1
- package/dist/lib/runtime/live-sync.d.ts +0 -1
- package/dist/lib/runtime/loader-setup.d.ts +0 -1
- package/dist/lib/runtime/login-menu-accounts.d.ts +0 -1
- package/dist/lib/runtime/manual-oauth-flow.d.ts +0 -1
- package/dist/lib/runtime/model-discovery-status.d.ts +2 -3
- package/dist/lib/runtime/native-account-storage.d.ts +0 -1
- package/dist/lib/runtime/native-account-sync.d.ts +0 -1
- package/dist/lib/runtime/native-binding-lock.d.ts +0 -1
- package/dist/lib/runtime/native-client-auth.d.ts +0 -1
- package/dist/lib/runtime/native-provider-config.d.ts +0 -1
- package/dist/lib/runtime/native-rate-limits.d.ts +2 -1
- package/dist/lib/runtime/native-rate-limits.js +23 -6
- package/dist/lib/runtime/preemptive-quota.d.ts +0 -1
- package/dist/lib/runtime/quota-headers.d.ts +0 -1
- package/dist/lib/runtime/quota-probe.d.ts +0 -1
- package/dist/lib/runtime/quota-settings.d.ts +0 -1
- package/dist/lib/runtime/refresh-guardian-entry.d.ts +0 -1
- package/dist/lib/runtime/refresh-guardian.d.ts +0 -1
- package/dist/lib/runtime/request-init.d.ts +0 -1
- package/dist/lib/runtime/reset-credit-routing.d.ts +0 -1
- package/dist/lib/runtime/reset-credits.d.ts +0 -1
- package/dist/lib/runtime/response-output-history.d.ts +0 -1
- package/dist/lib/runtime/responses-websocket.d.ts +0 -1
- package/dist/lib/runtime/resume-picker.d.ts +0 -1
- package/dist/lib/runtime/rotation-account-selection.d.ts +0 -1
- package/dist/lib/runtime/rotation-proxy-state.d.ts +0 -1
- package/dist/lib/runtime/rotation-server-types.d.ts +0 -1
- package/dist/lib/runtime/rotation-storage-meta.d.ts +0 -1
- package/dist/lib/runtime/rotation-token-refresh.d.ts +0 -1
- package/dist/lib/runtime/runtime-capability-failures.d.ts +0 -1
- package/dist/lib/runtime/runtime-current-account.d.ts +0 -1
- package/dist/lib/runtime/runtime-observability.d.ts +0 -1
- package/dist/lib/runtime/runtime-services.d.ts +0 -1
- package/dist/lib/runtime/session-affinity-entry.d.ts +0 -1
- package/dist/lib/runtime/session-recovery.d.ts +0 -1
- package/dist/lib/runtime/status-marker.d.ts +0 -1
- package/dist/lib/runtime/storage-scope.d.ts +0 -1
- package/dist/lib/runtime/subscription-first-use.d.ts +0 -1
- package/dist/lib/runtime/subscription-quota-event.d.ts +0 -1
- package/dist/lib/runtime/subscription-quota-order.d.ts +0 -1
- package/dist/lib/runtime/toast.d.ts +0 -1
- package/dist/lib/runtime/ui-runtime-entry.d.ts +0 -1
- package/dist/lib/runtime/ui-runtime.d.ts +0 -1
- package/dist/lib/runtime/verify-flagged.d.ts +0 -1
- package/dist/lib/runtime/workspace-model-scopes.d.ts +0 -1
- package/dist/lib/runtime-constants.d.ts +0 -1
- package/dist/lib/runtime-paths.d.ts +0 -1
- package/dist/lib/runtime-rotation-proxy.d.ts +1 -1
- package/dist/lib/runtime-rotation-proxy.js +136 -3
- package/dist/lib/schemas.d.ts +35 -13
- package/dist/lib/schemas.js +19 -2
- package/dist/lib/session-affinity.d.ts +0 -1
- package/dist/lib/shutdown.d.ts +0 -1
- package/dist/lib/storage/account-clear-entry.d.ts +0 -1
- package/dist/lib/storage/account-clear.d.ts +0 -1
- package/dist/lib/storage/account-match-utils.d.ts +0 -1
- package/dist/lib/storage/account-persistence.d.ts +0 -1
- package/dist/lib/storage/account-port.d.ts +0 -1
- package/dist/lib/storage/account-save-entry.d.ts +0 -1
- package/dist/lib/storage/account-save.d.ts +9 -2
- package/dist/lib/storage/account-save.js +4 -1
- package/dist/lib/storage/account-snapshot.d.ts +0 -1
- package/dist/lib/storage/backup-metadata-builder.d.ts +0 -1
- package/dist/lib/storage/backup-metadata.d.ts +0 -1
- package/dist/lib/storage/backup-paths.d.ts +0 -1
- package/dist/lib/storage/backup-restore.d.ts +0 -1
- package/dist/lib/storage/cache-artifacts.d.ts +0 -1
- package/dist/lib/storage/credential-sidecars.d.ts +0 -1
- package/dist/lib/storage/error-hints.d.ts +0 -1
- package/dist/lib/storage/file-lock.d.ts +0 -1
- package/dist/lib/storage/file-lock.js +33 -1
- package/dist/lib/storage/file-paths.d.ts +0 -1
- package/dist/lib/storage/fixture-guards.d.ts +0 -1
- package/dist/lib/storage/flagged-entry.d.ts +0 -1
- package/dist/lib/storage/flagged-load-entry.d.ts +0 -1
- package/dist/lib/storage/flagged-save-entry.d.ts +0 -1
- package/dist/lib/storage/flagged-storage-file.d.ts +0 -1
- package/dist/lib/storage/flagged-storage-io.d.ts +0 -1
- package/dist/lib/storage/flagged-storage.d.ts +0 -1
- package/dist/lib/storage/gitignore.d.ts +0 -1
- package/dist/lib/storage/hash.d.ts +0 -1
- package/dist/lib/storage/health.d.ts +0 -1
- package/dist/lib/storage/identity.d.ts +0 -1
- package/dist/lib/storage/import-export.d.ts +0 -1
- package/dist/lib/storage/json-store-lock.d.ts +105 -0
- package/dist/lib/storage/json-store-lock.js +259 -0
- package/dist/lib/storage/metadata-section.d.ts +0 -1
- package/dist/lib/storage/migrations.d.ts +0 -1
- package/dist/lib/storage/migrations.js +31 -18
- package/dist/lib/storage/named-backup-entry.d.ts +0 -1
- package/dist/lib/storage/named-backups-entry.d.ts +0 -1
- package/dist/lib/storage/named-backups.d.ts +0 -1
- package/dist/lib/storage/path-state.d.ts +0 -1
- package/dist/lib/storage/paths.d.ts +0 -1
- package/dist/lib/storage/pending-auth.d.ts +10 -3
- package/dist/lib/storage/pending-auth.d.ts.map +1 -1
- package/dist/lib/storage/pending-auth.js +33 -9
- package/dist/lib/storage/project-migration.d.ts +0 -1
- package/dist/lib/storage/public-types.d.ts +0 -1
- package/dist/lib/storage/record-identity.d.ts +15 -0
- package/dist/lib/storage/record-identity.d.ts.map +1 -0
- package/dist/lib/storage/record-identity.js +16 -0
- package/dist/lib/storage/record-utils.d.ts +0 -1
- package/dist/lib/storage/restore-assessment.d.ts +0 -1
- package/dist/lib/storage/restore-backup-entry.d.ts +0 -1
- package/dist/lib/storage/restore-metadata.d.ts +0 -1
- package/dist/lib/storage/save-retry.d.ts +0 -1
- package/dist/lib/storage/snapshot-inspectors.d.ts +0 -1
- package/dist/lib/storage/snapshot-merge.d.ts +0 -1
- package/dist/lib/storage/storage-parser.d.ts +2 -1
- package/dist/lib/storage/storage-parser.js +10 -2
- package/dist/lib/storage/transactions.d.ts +0 -1
- package/dist/lib/storage.d.ts +15 -2
- package/dist/lib/storage.js +612 -25
- package/dist/lib/synthetic-response.d.ts +0 -1
- package/dist/lib/table-formatter.d.ts +0 -1
- package/dist/lib/temp-path.d.ts +0 -1
- package/dist/lib/tools/hashline-tools.d.ts +0 -1
- package/dist/lib/types.d.ts +0 -1
- package/dist/lib/ui/ansi.d.ts +0 -1
- package/dist/lib/ui/auth-menu-builder.d.ts +0 -1
- package/dist/lib/ui/auth-menu.d.ts +0 -1
- package/dist/lib/ui/check-progress.d.ts +0 -1
- package/dist/lib/ui/confirm.d.ts +0 -1
- package/dist/lib/ui/display-width.d.ts +0 -1
- package/dist/lib/ui/format.d.ts +0 -1
- package/dist/lib/ui/index.d.ts +0 -1
- package/dist/lib/ui/runtime.d.ts +0 -1
- package/dist/lib/ui/select.d.ts +0 -1
- package/dist/lib/ui/theme.d.ts +0 -1
- package/dist/lib/ui/ui-copy.d.ts +0 -1
- package/dist/lib/unified-settings.d.ts +13 -11
- package/dist/lib/unified-settings.js +22 -14
- package/dist/lib/update-notice.d.ts +0 -1
- package/dist/lib/usage/index.d.ts +0 -1
- package/dist/lib/usage/ledger.d.ts +0 -1
- package/dist/lib/usage/pricing.d.ts +0 -1
- package/dist/lib/usage/redaction.d.ts +0 -1
- package/dist/lib/usage/stream-usage-deferral.d.ts +0 -1
- package/dist/lib/usage/types.d.ts +0 -1
- package/dist/lib/usage/usage-extraction.d.ts +0 -1
- package/dist/lib/utils.d.ts +21 -1
- package/dist/lib/utils.js +31 -0
- package/dist/lib/wsl.d.ts +0 -1
- package/node_modules/@codex-ai/plugin/dist/index.d.ts +2 -2
- package/node_modules/@codex-ai/plugin/dist/index.js +2 -2
- package/node_modules/@codex-ai/plugin/dist/tool.d.ts +42 -42
- package/node_modules/@codex-ai/plugin/dist/tool.js +29 -29
- package/node_modules/@codex-ai/plugin/package.json +9 -9
- package/node_modules/@codex-ai/sdk/dist/index.d.ts +4 -4
- package/node_modules/@codex-ai/sdk/dist/index.js +2 -2
- package/node_modules/@codex-ai/sdk/package.json +8 -8
- package/package.json +206 -200
- package/scripts/codex-app-launcher.js +653 -653
- package/scripts/codex-app-router.js +373 -373
- package/scripts/codex-bin-resolver.js +332 -313
- package/scripts/codex-multi-auth.js +65 -59
- package/scripts/codex-routing.js +62 -62
- package/scripts/codex.js +6923 -6642
- package/scripts/install-codex-auth-utils.js +213 -213
- package/scripts/mcodex.js +367 -367
- package/scripts/postinstall.js +114 -114
- package/scripts/preuninstall.js +265 -265
- package/skills/codex-auth-setup/SKILL.md +73 -0
- package/vendor/codex-ai-plugin/dist/index.d.ts +2 -2
- package/vendor/codex-ai-plugin/dist/index.js +2 -2
- package/vendor/codex-ai-plugin/dist/tool.d.ts +42 -42
- package/vendor/codex-ai-plugin/dist/tool.js +29 -29
- package/vendor/codex-ai-plugin/package.json +9 -9
- package/vendor/codex-ai-sdk/dist/index.d.ts +4 -4
- package/vendor/codex-ai-sdk/dist/index.js +2 -2
- package/vendor/codex-ai-sdk/package.json +8 -8
package/scripts/preuninstall.js
CHANGED
|
@@ -1,265 +1,265 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// @ts-check
|
|
4
|
-
|
|
5
|
-
import { readFile, writeFile, rm } from "node:fs/promises";
|
|
6
|
-
import { resolve } from "node:path";
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
8
|
-
import process from "node:process";
|
|
9
|
-
import {
|
|
10
|
-
isCiEnvironment,
|
|
11
|
-
resolveInstallPaths,
|
|
12
|
-
removePluginFromList,
|
|
13
|
-
withFileOperationRetry,
|
|
14
|
-
} from "./install-codex-auth-utils.js";
|
|
15
|
-
|
|
16
|
-
async function loadAppBindModule() {
|
|
17
|
-
try {
|
|
18
|
-
return await import("../dist/lib/runtime/app-bind.js");
|
|
19
|
-
} catch (error) {
|
|
20
|
-
if (
|
|
21
|
-
error &&
|
|
22
|
-
typeof error === "object" &&
|
|
23
|
-
"code" in error &&
|
|
24
|
-
error.code === "ERR_MODULE_NOT_FOUND"
|
|
25
|
-
) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
throw error;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function defaultPreuninstallLog(message) {
|
|
33
|
-
console.error(`codex-multi-auth: ${message}`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @param {{
|
|
38
|
-
* unbindCodexApp?: (dryRun: boolean) => Promise<void>,
|
|
39
|
-
* removeLauncher?: (options: { dryRun: boolean, log: (m: string) => void }) => Promise<void>,
|
|
40
|
-
* removePluginFromConfig?: (dryRun: boolean, log: (m: string) => void) => Promise<{ bunLockState: "safe" | "uncertain" }>,
|
|
41
|
-
* clearCache?: (dryRun: boolean, log: (m: string) => void, bunLockSafe: boolean) => Promise<void>,
|
|
42
|
-
* log?: (message: string) => void,
|
|
43
|
-
* env?: NodeJS.ProcessEnv,
|
|
44
|
-
* home?: string,
|
|
45
|
-
* dryRun?: boolean,
|
|
46
|
-
* }} [deps]
|
|
47
|
-
*/
|
|
48
|
-
export async function runPreuninstallCleanup(deps = {}) {
|
|
49
|
-
const log = deps.log ?? defaultPreuninstallLog;
|
|
50
|
-
const env = deps.env ?? process.env;
|
|
51
|
-
const home =
|
|
52
|
-
deps.home ??
|
|
53
|
-
(deps.env
|
|
54
|
-
? env.HOME || env.USERPROFILE || ""
|
|
55
|
-
: undefined);
|
|
56
|
-
const dryRun = deps.dryRun ?? process.argv.includes("--dry-run");
|
|
57
|
-
|
|
58
|
-
if (isCiEnvironment(env)) {
|
|
59
|
-
return 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/** @type {"safe" | "uncertain"} */
|
|
63
|
-
let bunLockState = "uncertain";
|
|
64
|
-
|
|
65
|
-
// Unbind Codex app runtime rotation (reverses install-time/first-run bind)
|
|
66
|
-
try {
|
|
67
|
-
if (deps.unbindCodexApp) {
|
|
68
|
-
await deps.unbindCodexApp(dryRun);
|
|
69
|
-
} else {
|
|
70
|
-
const appBindModule = await loadAppBindModule();
|
|
71
|
-
if (
|
|
72
|
-
appBindModule &&
|
|
73
|
-
typeof appBindModule.unbindCodexAppRuntimeRotation === "function"
|
|
74
|
-
) {
|
|
75
|
-
if (dryRun) {
|
|
76
|
-
log("[dry-run] Would unbind Codex app runtime rotation");
|
|
77
|
-
} else {
|
|
78
|
-
await appBindModule.unbindCodexAppRuntimeRotation();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
} catch (error) {
|
|
83
|
-
log(
|
|
84
|
-
`app unbind skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Remove OS-level launcher (reverses install-time/first-run launcher install)
|
|
89
|
-
try {
|
|
90
|
-
if (deps.removeLauncher) {
|
|
91
|
-
await deps.removeLauncher({ dryRun, log });
|
|
92
|
-
} else {
|
|
93
|
-
const launcherModule = await import("./codex-app-launcher.js");
|
|
94
|
-
if (typeof launcherModule.installCodexAppLauncher === "function") {
|
|
95
|
-
await launcherModule.installCodexAppLauncher({ remove: true, dryRun, log });
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
} catch (error) {
|
|
99
|
-
log(
|
|
100
|
-
`launcher removal skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Remove plugin entry from Codex.json and track whether we're certain that
|
|
105
|
-
// no other plugins remain. bun.lock is shared across all Codex plugins, so
|
|
106
|
-
// it's only safe to delete when:
|
|
107
|
-
// - File ENOENT → safe (nothing to protect)
|
|
108
|
-
// - Parse error / read fail → uncertain (be conservative)
|
|
109
|
-
// - File ok, no plugins[] → uncertain (we don't know what's installed)
|
|
110
|
-
// - File ok, plugins[]=[] → safe
|
|
111
|
-
// - File ok, plugins[]≠[] → uncertain
|
|
112
|
-
try {
|
|
113
|
-
if (deps.removePluginFromConfig) {
|
|
114
|
-
const result = await deps.removePluginFromConfig(dryRun, log);
|
|
115
|
-
if (result && typeof result === "object" && "bunLockState" in result) {
|
|
116
|
-
bunLockState = result.bunLockState === "safe" ? "safe" : "uncertain";
|
|
117
|
-
}
|
|
118
|
-
} else {
|
|
119
|
-
const paths = resolveInstallPaths(
|
|
120
|
-
process.platform,
|
|
121
|
-
env,
|
|
122
|
-
home || undefined,
|
|
123
|
-
);
|
|
124
|
-
try {
|
|
125
|
-
const raw = await withFileOperationRetry(() =>
|
|
126
|
-
readFile(paths.configPath, "utf8"),
|
|
127
|
-
);
|
|
128
|
-
const config = JSON.parse(raw);
|
|
129
|
-
if (Array.isArray(config.plugins)) {
|
|
130
|
-
const next = removePluginFromList(config.plugins);
|
|
131
|
-
bunLockState = next.length === 0 ? "safe" : "uncertain";
|
|
132
|
-
if (dryRun) {
|
|
133
|
-
log(
|
|
134
|
-
`[dry-run] Would remove codex-multi-auth from ${paths.configPath}`,
|
|
135
|
-
);
|
|
136
|
-
} else {
|
|
137
|
-
config.plugins = next;
|
|
138
|
-
await withFileOperationRetry(() =>
|
|
139
|
-
writeFile(
|
|
140
|
-
paths.configPath,
|
|
141
|
-
JSON.stringify(config, null, "\t") + "\n",
|
|
142
|
-
"utf8",
|
|
143
|
-
),
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
} else if (dryRun) {
|
|
147
|
-
log(
|
|
148
|
-
`[dry-run] Would remove codex-multi-auth from ${paths.configPath}`,
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
} catch (fileError) {
|
|
152
|
-
const code =
|
|
153
|
-
fileError &&
|
|
154
|
-
typeof fileError === "object" &&
|
|
155
|
-
"code" in fileError
|
|
156
|
-
? fileError.code
|
|
157
|
-
: undefined;
|
|
158
|
-
if (code === "ENOENT") {
|
|
159
|
-
bunLockState = "safe";
|
|
160
|
-
if (dryRun) {
|
|
161
|
-
log(
|
|
162
|
-
`[dry-run] Would remove codex-multi-auth from ${paths.configPath}`,
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
} else {
|
|
166
|
-
log(
|
|
167
|
-
`config cleanup skipped: ${fileError instanceof Error ? fileError.message : String(fileError)}`,
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
} catch (error) {
|
|
173
|
-
log(
|
|
174
|
-
`config cleanup skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const bunLockSafe = bunLockState === "safe";
|
|
179
|
-
|
|
180
|
-
// Clear plugin cache dirs
|
|
181
|
-
try {
|
|
182
|
-
if (deps.clearCache) {
|
|
183
|
-
await deps.clearCache(dryRun, log, bunLockSafe);
|
|
184
|
-
} else {
|
|
185
|
-
const paths = resolveInstallPaths(
|
|
186
|
-
process.platform,
|
|
187
|
-
env,
|
|
188
|
-
home || undefined,
|
|
189
|
-
);
|
|
190
|
-
if (dryRun) {
|
|
191
|
-
log(`[dry-run] Would remove ${paths.cacheNodeModules}`);
|
|
192
|
-
if (paths.cacheLegacyNodeModules) {
|
|
193
|
-
log(`[dry-run] Would remove ${paths.cacheLegacyNodeModules}`);
|
|
194
|
-
}
|
|
195
|
-
if (bunLockSafe) {
|
|
196
|
-
log(`[dry-run] Would remove ${paths.cacheBunLock}`);
|
|
197
|
-
} else {
|
|
198
|
-
log(
|
|
199
|
-
`[dry-run] Would skip ${paths.cacheBunLock} (other plugins still installed)`,
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
try {
|
|
204
|
-
await withFileOperationRetry(() =>
|
|
205
|
-
rm(paths.cacheNodeModules, { recursive: true, force: true }),
|
|
206
|
-
);
|
|
207
|
-
if (paths.cacheLegacyNodeModules) {
|
|
208
|
-
await withFileOperationRetry(() =>
|
|
209
|
-
rm(paths.cacheLegacyNodeModules, {
|
|
210
|
-
recursive: true,
|
|
211
|
-
force: true,
|
|
212
|
-
}),
|
|
213
|
-
);
|
|
214
|
-
}
|
|
215
|
-
if (bunLockSafe) {
|
|
216
|
-
await withFileOperationRetry(() =>
|
|
217
|
-
rm(paths.cacheBunLock, { force: true }),
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
} catch (error) {
|
|
221
|
-
log(
|
|
222
|
-
`cache clear skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
223
|
-
);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
} catch (error) {
|
|
228
|
-
log(
|
|
229
|
-
`cache clear skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
async function main() {
|
|
237
|
-
return runPreuninstallCleanup();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function normalizeExitCode(exitCode) {
|
|
241
|
-
return Number.isInteger(exitCode) && exitCode >= 0 && exitCode <= 255
|
|
242
|
-
? exitCode
|
|
243
|
-
: 0;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const isDirectRun = (() => {
|
|
247
|
-
try {
|
|
248
|
-
return resolve(process.argv[1] ?? "") === fileURLToPath(import.meta.url);
|
|
249
|
-
} catch {
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
})();
|
|
253
|
-
|
|
254
|
-
if (isDirectRun) {
|
|
255
|
-
main()
|
|
256
|
-
.then((exitCode) => {
|
|
257
|
-
process.exitCode = normalizeExitCode(exitCode);
|
|
258
|
-
})
|
|
259
|
-
.catch((error) => {
|
|
260
|
-
defaultPreuninstallLog(
|
|
261
|
-
`preuninstall cleanup skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
262
|
-
);
|
|
263
|
-
process.exitCode = 0;
|
|
264
|
-
});
|
|
265
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// @ts-check
|
|
4
|
+
|
|
5
|
+
import { readFile, writeFile, rm } from "node:fs/promises";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import process from "node:process";
|
|
9
|
+
import {
|
|
10
|
+
isCiEnvironment,
|
|
11
|
+
resolveInstallPaths,
|
|
12
|
+
removePluginFromList,
|
|
13
|
+
withFileOperationRetry,
|
|
14
|
+
} from "./install-codex-auth-utils.js";
|
|
15
|
+
|
|
16
|
+
async function loadAppBindModule() {
|
|
17
|
+
try {
|
|
18
|
+
return await import("../dist/lib/runtime/app-bind.js");
|
|
19
|
+
} catch (error) {
|
|
20
|
+
if (
|
|
21
|
+
error &&
|
|
22
|
+
typeof error === "object" &&
|
|
23
|
+
"code" in error &&
|
|
24
|
+
error.code === "ERR_MODULE_NOT_FOUND"
|
|
25
|
+
) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function defaultPreuninstallLog(message) {
|
|
33
|
+
console.error(`codex-multi-auth: ${message}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {{
|
|
38
|
+
* unbindCodexApp?: (dryRun: boolean) => Promise<void>,
|
|
39
|
+
* removeLauncher?: (options: { dryRun: boolean, log: (m: string) => void }) => Promise<void>,
|
|
40
|
+
* removePluginFromConfig?: (dryRun: boolean, log: (m: string) => void) => Promise<{ bunLockState: "safe" | "uncertain" }>,
|
|
41
|
+
* clearCache?: (dryRun: boolean, log: (m: string) => void, bunLockSafe: boolean) => Promise<void>,
|
|
42
|
+
* log?: (message: string) => void,
|
|
43
|
+
* env?: NodeJS.ProcessEnv,
|
|
44
|
+
* home?: string,
|
|
45
|
+
* dryRun?: boolean,
|
|
46
|
+
* }} [deps]
|
|
47
|
+
*/
|
|
48
|
+
export async function runPreuninstallCleanup(deps = {}) {
|
|
49
|
+
const log = deps.log ?? defaultPreuninstallLog;
|
|
50
|
+
const env = deps.env ?? process.env;
|
|
51
|
+
const home =
|
|
52
|
+
deps.home ??
|
|
53
|
+
(deps.env
|
|
54
|
+
? env.HOME || env.USERPROFILE || ""
|
|
55
|
+
: undefined);
|
|
56
|
+
const dryRun = deps.dryRun ?? process.argv.includes("--dry-run");
|
|
57
|
+
|
|
58
|
+
if (isCiEnvironment(env)) {
|
|
59
|
+
return 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** @type {"safe" | "uncertain"} */
|
|
63
|
+
let bunLockState = "uncertain";
|
|
64
|
+
|
|
65
|
+
// Unbind Codex app runtime rotation (reverses install-time/first-run bind)
|
|
66
|
+
try {
|
|
67
|
+
if (deps.unbindCodexApp) {
|
|
68
|
+
await deps.unbindCodexApp(dryRun);
|
|
69
|
+
} else {
|
|
70
|
+
const appBindModule = await loadAppBindModule();
|
|
71
|
+
if (
|
|
72
|
+
appBindModule &&
|
|
73
|
+
typeof appBindModule.unbindCodexAppRuntimeRotation === "function"
|
|
74
|
+
) {
|
|
75
|
+
if (dryRun) {
|
|
76
|
+
log("[dry-run] Would unbind Codex app runtime rotation");
|
|
77
|
+
} else {
|
|
78
|
+
await appBindModule.unbindCodexAppRuntimeRotation();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} catch (error) {
|
|
83
|
+
log(
|
|
84
|
+
`app unbind skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Remove OS-level launcher (reverses install-time/first-run launcher install)
|
|
89
|
+
try {
|
|
90
|
+
if (deps.removeLauncher) {
|
|
91
|
+
await deps.removeLauncher({ dryRun, log });
|
|
92
|
+
} else {
|
|
93
|
+
const launcherModule = await import("./codex-app-launcher.js");
|
|
94
|
+
if (typeof launcherModule.installCodexAppLauncher === "function") {
|
|
95
|
+
await launcherModule.installCodexAppLauncher({ remove: true, dryRun, log });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
} catch (error) {
|
|
99
|
+
log(
|
|
100
|
+
`launcher removal skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Remove plugin entry from Codex.json and track whether we're certain that
|
|
105
|
+
// no other plugins remain. bun.lock is shared across all Codex plugins, so
|
|
106
|
+
// it's only safe to delete when:
|
|
107
|
+
// - File ENOENT → safe (nothing to protect)
|
|
108
|
+
// - Parse error / read fail → uncertain (be conservative)
|
|
109
|
+
// - File ok, no plugins[] → uncertain (we don't know what's installed)
|
|
110
|
+
// - File ok, plugins[]=[] → safe
|
|
111
|
+
// - File ok, plugins[]≠[] → uncertain
|
|
112
|
+
try {
|
|
113
|
+
if (deps.removePluginFromConfig) {
|
|
114
|
+
const result = await deps.removePluginFromConfig(dryRun, log);
|
|
115
|
+
if (result && typeof result === "object" && "bunLockState" in result) {
|
|
116
|
+
bunLockState = result.bunLockState === "safe" ? "safe" : "uncertain";
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
const paths = resolveInstallPaths(
|
|
120
|
+
process.platform,
|
|
121
|
+
env,
|
|
122
|
+
home || undefined,
|
|
123
|
+
);
|
|
124
|
+
try {
|
|
125
|
+
const raw = await withFileOperationRetry(() =>
|
|
126
|
+
readFile(paths.configPath, "utf8"),
|
|
127
|
+
);
|
|
128
|
+
const config = JSON.parse(raw);
|
|
129
|
+
if (Array.isArray(config.plugins)) {
|
|
130
|
+
const next = removePluginFromList(config.plugins);
|
|
131
|
+
bunLockState = next.length === 0 ? "safe" : "uncertain";
|
|
132
|
+
if (dryRun) {
|
|
133
|
+
log(
|
|
134
|
+
`[dry-run] Would remove codex-multi-auth from ${paths.configPath}`,
|
|
135
|
+
);
|
|
136
|
+
} else {
|
|
137
|
+
config.plugins = next;
|
|
138
|
+
await withFileOperationRetry(() =>
|
|
139
|
+
writeFile(
|
|
140
|
+
paths.configPath,
|
|
141
|
+
JSON.stringify(config, null, "\t") + "\n",
|
|
142
|
+
"utf8",
|
|
143
|
+
),
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
} else if (dryRun) {
|
|
147
|
+
log(
|
|
148
|
+
`[dry-run] Would remove codex-multi-auth from ${paths.configPath}`,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
} catch (fileError) {
|
|
152
|
+
const code =
|
|
153
|
+
fileError &&
|
|
154
|
+
typeof fileError === "object" &&
|
|
155
|
+
"code" in fileError
|
|
156
|
+
? fileError.code
|
|
157
|
+
: undefined;
|
|
158
|
+
if (code === "ENOENT") {
|
|
159
|
+
bunLockState = "safe";
|
|
160
|
+
if (dryRun) {
|
|
161
|
+
log(
|
|
162
|
+
`[dry-run] Would remove codex-multi-auth from ${paths.configPath}`,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
log(
|
|
167
|
+
`config cleanup skipped: ${fileError instanceof Error ? fileError.message : String(fileError)}`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
} catch (error) {
|
|
173
|
+
log(
|
|
174
|
+
`config cleanup skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const bunLockSafe = bunLockState === "safe";
|
|
179
|
+
|
|
180
|
+
// Clear plugin cache dirs
|
|
181
|
+
try {
|
|
182
|
+
if (deps.clearCache) {
|
|
183
|
+
await deps.clearCache(dryRun, log, bunLockSafe);
|
|
184
|
+
} else {
|
|
185
|
+
const paths = resolveInstallPaths(
|
|
186
|
+
process.platform,
|
|
187
|
+
env,
|
|
188
|
+
home || undefined,
|
|
189
|
+
);
|
|
190
|
+
if (dryRun) {
|
|
191
|
+
log(`[dry-run] Would remove ${paths.cacheNodeModules}`);
|
|
192
|
+
if (paths.cacheLegacyNodeModules) {
|
|
193
|
+
log(`[dry-run] Would remove ${paths.cacheLegacyNodeModules}`);
|
|
194
|
+
}
|
|
195
|
+
if (bunLockSafe) {
|
|
196
|
+
log(`[dry-run] Would remove ${paths.cacheBunLock}`);
|
|
197
|
+
} else {
|
|
198
|
+
log(
|
|
199
|
+
`[dry-run] Would skip ${paths.cacheBunLock} (other plugins still installed)`,
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
try {
|
|
204
|
+
await withFileOperationRetry(() =>
|
|
205
|
+
rm(paths.cacheNodeModules, { recursive: true, force: true }),
|
|
206
|
+
);
|
|
207
|
+
if (paths.cacheLegacyNodeModules) {
|
|
208
|
+
await withFileOperationRetry(() =>
|
|
209
|
+
rm(paths.cacheLegacyNodeModules, {
|
|
210
|
+
recursive: true,
|
|
211
|
+
force: true,
|
|
212
|
+
}),
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
if (bunLockSafe) {
|
|
216
|
+
await withFileOperationRetry(() =>
|
|
217
|
+
rm(paths.cacheBunLock, { force: true }),
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
} catch (error) {
|
|
221
|
+
log(
|
|
222
|
+
`cache clear skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} catch (error) {
|
|
228
|
+
log(
|
|
229
|
+
`cache clear skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return 0;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async function main() {
|
|
237
|
+
return runPreuninstallCleanup();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function normalizeExitCode(exitCode) {
|
|
241
|
+
return Number.isInteger(exitCode) && exitCode >= 0 && exitCode <= 255
|
|
242
|
+
? exitCode
|
|
243
|
+
: 0;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const isDirectRun = (() => {
|
|
247
|
+
try {
|
|
248
|
+
return resolve(process.argv[1] ?? "") === fileURLToPath(import.meta.url);
|
|
249
|
+
} catch {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
})();
|
|
253
|
+
|
|
254
|
+
if (isDirectRun) {
|
|
255
|
+
main()
|
|
256
|
+
.then((exitCode) => {
|
|
257
|
+
process.exitCode = normalizeExitCode(exitCode);
|
|
258
|
+
})
|
|
259
|
+
.catch((error) => {
|
|
260
|
+
defaultPreuninstallLog(
|
|
261
|
+
`preuninstall cleanup skipped: ${error instanceof Error ? error.message : String(error)}`,
|
|
262
|
+
);
|
|
263
|
+
process.exitCode = 0;
|
|
264
|
+
});
|
|
265
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-auth-setup
|
|
3
|
+
description: Install or refresh codex-multi-auth for the official Codex CLI, run first login, and verify account health and routing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# codex-auth-setup
|
|
7
|
+
|
|
8
|
+
Use this skill when the user wants to install, reinstall, upgrade, or troubleshoot `codex-multi-auth` for the official `@openai/codex` CLI.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm i -g @openai/codex
|
|
14
|
+
npm i -g codex-multi-auth
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If the old scoped prerelease package is still installed:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm uninstall -g @ndycode/codex-multi-auth
|
|
21
|
+
npm i -g codex-multi-auth
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## First login
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
codex-multi-auth login
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Default flow:
|
|
31
|
+
|
|
32
|
+
1. Open the account menu.
|
|
33
|
+
2. Choose the browser-first OAuth path.
|
|
34
|
+
3. Complete the official OAuth flow.
|
|
35
|
+
4. Return to the terminal and confirm the account was saved.
|
|
36
|
+
|
|
37
|
+
## Verify health and routing
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
codex-multi-auth status
|
|
41
|
+
codex-multi-auth list
|
|
42
|
+
codex-multi-auth check
|
|
43
|
+
codex-multi-auth forecast --live
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Use these next when managing multiple accounts:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
codex-multi-auth switch 2
|
|
50
|
+
codex-multi-auth verify-flagged
|
|
51
|
+
codex-multi-auth doctor --fix
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Alternate login paths
|
|
55
|
+
|
|
56
|
+
Use these when browser launch is blocked or the shell is headless:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
codex-multi-auth login --manual
|
|
60
|
+
CODEX_AUTH_NO_BROWSER=1 codex-multi-auth login
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Troubleshooting
|
|
64
|
+
|
|
65
|
+
- Run `where codex-multi-auth` if `codex-multi-auth` is not recognized.
|
|
66
|
+
- Free port `1455` and retry if the OAuth callback server cannot bind.
|
|
67
|
+
- Re-run `codex-multi-auth login` if the active account is stale or the wrong account was selected.
|
|
68
|
+
- Use `codex-multi-auth doctor --fix` followed by `codex-multi-auth check` for a fast recovery loop.
|
|
69
|
+
- See `docs/getting-started.md`, `docs/configuration.md`, `docs/troubleshooting.md`, and `docs/reference/commands.md` for the full command and config docs.
|
|
70
|
+
|
|
71
|
+
## Usage boundaries
|
|
72
|
+
|
|
73
|
+
This project is for personal development use. For production or commercial workloads, use the OpenAI Platform API.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type PluginInput = any;
|
|
2
|
-
export type Plugin = any;
|
|
1
|
+
export type PluginInput = any;
|
|
2
|
+
export type Plugin = any;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
|