codex-multi-auth 2.17.2 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +86 -425
- package/config/README.md +1 -1
- package/config/codex-legacy.json +12 -212
- package/config/codex-modern.json +4 -80
- package/config/minimal-codex.json +1 -1
- 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 +0 -1
- package/dist/lib/accounts.js +4 -5
- 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 +0 -1
- 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/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-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 +0 -1
- 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/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 +1 -2
- package/dist/lib/context-budget/model-context-windows.js +10 -13
- package/dist/lib/context-budget-guard.d.ts +0 -1
- package/dist/lib/context-budget-response.d.ts +0 -1
- package/dist/lib/context-overflow.d.ts +0 -1
- 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/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 +3 -3
- package/dist/lib/oc-chatgpt-target-detection.js +40 -13
- 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.d.ts +0 -1
- 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 +0 -1
- package/dist/lib/quota-cache.js +60 -36
- package/dist/lib/quota-probe.d.ts +0 -1
- package/dist/lib/quota-probe.js +5 -2
- package/dist/lib/quota-readiness.d.ts +0 -1
- 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/error-classification.js +41 -52
- 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/fetch-helpers.js +1 -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 +2 -3
- package/dist/lib/request/helpers/model-map.js +120 -78
- 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 +1 -2
- package/dist/lib/request/request-transformer.js +51 -26
- 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-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 +0 -1
- package/dist/lib/runtime/automatic-subscription-checks.d.ts +0 -1
- 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 +0 -1
- 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 +133 -0
- 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 +9 -3
- package/dist/lib/storage/pending-auth.js +30 -8
- 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 +0 -1
- 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 +1 -2
- package/dist/lib/ui/ui-copy.js +1 -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 +1 -2
- package/dist/lib/usage/pricing.js +41 -16
- 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/package.json +11 -5
- package/scripts/codex-bin-resolver.js +20 -1
- package/scripts/codex-multi-auth.js +7 -1
- package/scripts/codex.js +385 -89
- package/skills/codex-auth-setup/SKILL.md +73 -0
package/dist/lib/config.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { existsSync, promises as fs, readFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
2
|
+
import { join } from "node:path";
|
|
4
3
|
import { parseBooleanEnv } from "./env-parsing.js";
|
|
5
4
|
import { stripModelEffortSuffix } from "./constants.js";
|
|
6
5
|
import { withRetry, withRetrySync } from "./fs-retry.js";
|
|
@@ -8,8 +7,8 @@ import { logWarn } from "./logger.js";
|
|
|
8
7
|
import { StorageError } from "./errors.js";
|
|
9
8
|
import { getCodexHomeDir, getCodexMultiAuthDir, getLegacyCodexDir, } from "./runtime-paths.js";
|
|
10
9
|
import { getValidationErrors, PluginConfigSchema } from "./schemas.js";
|
|
10
|
+
import { getJsonStoreFileMtimeMs, withJsonStoreCasRetry, withJsonStoreFileLock, withJsonStoreWriteQueue, writeJsonStoreFileAtomicWithRetry, } from "./storage/json-store-lock.js";
|
|
11
11
|
import { getUnifiedSettingsPath, loadUnifiedPluginConfigSync, saveUnifiedPluginConfig, } from "./unified-settings.js";
|
|
12
|
-
import { tempPathFor } from "./temp-path.js";
|
|
13
12
|
const CONFIG_DIR = getCodexMultiAuthDir();
|
|
14
13
|
const CONFIG_PATH = join(CONFIG_DIR, "config.json");
|
|
15
14
|
const CODEX_HOME_DIR = getCodexHomeDir();
|
|
@@ -23,8 +22,6 @@ const TUI_COLOR_PROFILES = new Set(["truecolor", "ansi16", "ansi256"]);
|
|
|
23
22
|
const TUI_GLYPH_MODES = new Set(["ascii", "unicode", "auto"]);
|
|
24
23
|
const UNSUPPORTED_CODEX_POLICIES = new Set(["strict", "fallback"]);
|
|
25
24
|
const emittedConfigWarnings = new Set();
|
|
26
|
-
const configSaveQueues = new Map();
|
|
27
|
-
const RETRYABLE_FS_CODES = new Set(["EBUSY", "EPERM"]);
|
|
28
25
|
const RETRYABLE_CONFIG_READ_CODES = new Set(["EBUSY", "EPERM", "EAGAIN"]);
|
|
29
26
|
/**
|
|
30
27
|
* Synchronous readFileSync with bounded retry on transient FS-lock codes.
|
|
@@ -330,212 +327,14 @@ function stripUtf8Bom(content) {
|
|
|
330
327
|
function isRecord(value) {
|
|
331
328
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
332
329
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
// same backoff, 5 attempts). ENOENT still returns null immediately. On
|
|
342
|
-
// exhaustion the last failure surfaces so the caller treats it as a real
|
|
343
|
-
// save error rather than a phantom missing file.
|
|
344
|
-
return withRetry(async () => {
|
|
345
|
-
try {
|
|
346
|
-
return (await fs.stat(filePath)).mtimeMs;
|
|
347
|
-
}
|
|
348
|
-
catch (error) {
|
|
349
|
-
if (error?.code === "ENOENT") {
|
|
350
|
-
return null;
|
|
351
|
-
}
|
|
352
|
-
throw error;
|
|
353
|
-
}
|
|
354
|
-
}, {
|
|
355
|
-
maxAttempts: 5,
|
|
356
|
-
backoffMs: (attempt) => 10 * 2 ** (attempt - 1),
|
|
357
|
-
retryableCodes: RETRYABLE_CONFIG_READ_CODES,
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
async function writeJsonFileAtomicWithRetry(filePath, payload, options) {
|
|
361
|
-
const tempPath = tempPathFor(filePath);
|
|
362
|
-
await fs.mkdir(dirname(filePath), { recursive: true });
|
|
363
|
-
await fs.writeFile(tempPath, `${JSON.stringify(payload, null, 2)}\n`, "utf8");
|
|
364
|
-
let renamed = false;
|
|
365
|
-
try {
|
|
366
|
-
// Compare-and-swap guard: if a concurrent writer changed the target file
|
|
367
|
-
// since the caller read it (mtime mismatch), abort with ESTALE so the
|
|
368
|
-
// caller can re-read and merge instead of clobbering the other write.
|
|
369
|
-
if (options && "expectedMtimeMs" in options) {
|
|
370
|
-
const currentMtimeMs = await getConfigFileMtimeMs(filePath);
|
|
371
|
-
if (currentMtimeMs !== options.expectedMtimeMs) {
|
|
372
|
-
const staleError = new Error(`Config at ${filePath} changed on disk during save; retrying with latest state.`);
|
|
373
|
-
staleError.code = "ESTALE";
|
|
374
|
-
throw staleError;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
await withRetry(() => fs.rename(tempPath, filePath), {
|
|
378
|
-
maxAttempts: 5,
|
|
379
|
-
backoffMs: (attempt) => 10 * 2 ** (attempt - 1),
|
|
380
|
-
retryableCodes: RETRYABLE_FS_CODES,
|
|
381
|
-
});
|
|
382
|
-
renamed = true;
|
|
383
|
-
}
|
|
384
|
-
finally {
|
|
385
|
-
if (!renamed) {
|
|
386
|
-
try {
|
|
387
|
-
await fs.unlink(tempPath);
|
|
388
|
-
}
|
|
389
|
-
catch {
|
|
390
|
-
// Best-effort temp cleanup.
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
async function withConfigSaveLock(path, task) {
|
|
396
|
-
const previous = configSaveQueues.get(path) ?? Promise.resolve();
|
|
397
|
-
const queued = previous.catch(() => { }).then(task);
|
|
398
|
-
configSaveQueues.set(path, queued);
|
|
399
|
-
try {
|
|
400
|
-
await queued;
|
|
401
|
-
}
|
|
402
|
-
finally {
|
|
403
|
-
if (configSaveQueues.get(path) === queued) {
|
|
404
|
-
configSaveQueues.delete(path);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
// Cross-process config-save lock. withConfigSaveLock only serializes saves
|
|
409
|
-
// within THIS process (a per-path promise queue); it does nothing against a
|
|
410
|
-
// second process. The mtime CAS in writeJsonFileAtomicWithRetry narrows but does
|
|
411
|
-
// not close the read→check→merge→rename TOCTOU window (another process can still
|
|
412
|
-
// land a write between the CAS stat and the rename). This file lock provides the
|
|
413
|
-
// cross-process mutual exclusion that closes that window. It deliberately mirrors
|
|
414
|
-
// RefreshLeaseCoordinator (lib/refresh-lease.ts): exclusive `wx` lockfile create,
|
|
415
|
-
// JSON payload carrying pid + expiry, stale-takeover via expiry/mtime, and a
|
|
416
|
-
// best-effort retrying release in a finally. The mtime CAS stays as a second-line
|
|
417
|
-
// guard for any non-participating writer.
|
|
418
|
-
const CONFIG_LOCK_TTL_MS = 10_000;
|
|
419
|
-
const CONFIG_LOCK_WAIT_TIMEOUT_MS = 10_000;
|
|
420
|
-
const CONFIG_LOCK_POLL_MS = 50;
|
|
421
|
-
async function unlinkConfigLockWithRetry(lockPath) {
|
|
422
|
-
try {
|
|
423
|
-
await withRetry(() => fs.unlink(lockPath), {
|
|
424
|
-
maxAttempts: 5,
|
|
425
|
-
backoffMs: (attempt) => 10 * 2 ** (attempt - 1),
|
|
426
|
-
retryableCodes: RETRYABLE_FS_CODES,
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
catch {
|
|
430
|
-
// ENOENT (already released) or best-effort release failure: a leftover
|
|
431
|
-
// lockfile is recovered as stale by the next acquirer via its
|
|
432
|
-
// expiry/mtime, so never fail the save over this.
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
// Owner-safe release: only unlink the lockfile if it still carries OUR owner
|
|
436
|
-
// token. If a slow save was deemed stale and a second process stole the lock,
|
|
437
|
-
// the lockfile now holds the new owner's token — deleting it would reopen
|
|
438
|
-
// concurrent saves, so we leave it alone.
|
|
439
|
-
async function releaseConfigLockIfOwner(lockPath, owner) {
|
|
440
|
-
try {
|
|
441
|
-
const content = await fs.readFile(lockPath, "utf-8");
|
|
442
|
-
const parsed = JSON.parse(stripUtf8Bom(content));
|
|
443
|
-
if (parsed?.owner && parsed.owner !== owner) {
|
|
444
|
-
// Lock was taken over by another holder; do not delete their lock.
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
catch (error) {
|
|
449
|
-
const code = error?.code;
|
|
450
|
-
if (code === "ENOENT")
|
|
451
|
-
return;
|
|
452
|
-
// Unreadable/malformed: fall through and attempt our best-effort unlink.
|
|
453
|
-
}
|
|
454
|
-
await unlinkConfigLockWithRetry(lockPath);
|
|
455
|
-
}
|
|
456
|
-
async function isConfigLockStale(lockPath) {
|
|
457
|
-
try {
|
|
458
|
-
const content = await fs.readFile(lockPath, "utf-8");
|
|
459
|
-
const parsed = JSON.parse(stripUtf8Bom(content));
|
|
460
|
-
if (typeof parsed?.expiresAt === "number" &&
|
|
461
|
-
Number.isFinite(parsed.expiresAt)) {
|
|
462
|
-
return parsed.expiresAt <= Date.now();
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
catch (error) {
|
|
466
|
-
const code = error?.code;
|
|
467
|
-
if (code === "ENOENT")
|
|
468
|
-
return true;
|
|
469
|
-
// Unreadable/malformed payload: fall through to the mtime heuristic.
|
|
470
|
-
}
|
|
471
|
-
try {
|
|
472
|
-
const stat = await fs.stat(lockPath);
|
|
473
|
-
return Date.now() - stat.mtimeMs > CONFIG_LOCK_TTL_MS;
|
|
474
|
-
}
|
|
475
|
-
catch (error) {
|
|
476
|
-
const code = error?.code;
|
|
477
|
-
if (code === "ENOENT")
|
|
478
|
-
return true;
|
|
479
|
-
return false;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
async function withConfigFileLock(targetPath, task) {
|
|
483
|
-
const lockPath = `${targetPath}.lock`;
|
|
484
|
-
const owner = randomUUID();
|
|
485
|
-
await fs.mkdir(dirname(lockPath), { recursive: true });
|
|
486
|
-
const deadline = Date.now() + CONFIG_LOCK_WAIT_TIMEOUT_MS;
|
|
487
|
-
let acquired = false;
|
|
488
|
-
while (!acquired) {
|
|
489
|
-
try {
|
|
490
|
-
const now = Date.now();
|
|
491
|
-
const payload = {
|
|
492
|
-
pid: process.pid,
|
|
493
|
-
owner,
|
|
494
|
-
acquiredAt: now,
|
|
495
|
-
expiresAt: now + CONFIG_LOCK_TTL_MS,
|
|
496
|
-
};
|
|
497
|
-
const handle = await fs.open(lockPath, "wx", 0o600);
|
|
498
|
-
try {
|
|
499
|
-
await handle.writeFile(`${JSON.stringify(payload)}\n`, "utf8");
|
|
500
|
-
}
|
|
501
|
-
finally {
|
|
502
|
-
await handle.close();
|
|
503
|
-
}
|
|
504
|
-
acquired = true;
|
|
505
|
-
}
|
|
506
|
-
catch (error) {
|
|
507
|
-
const code = error?.code;
|
|
508
|
-
if (code !== "EEXIST") {
|
|
509
|
-
// A transient FS lock on the lockfile itself: retry until the deadline,
|
|
510
|
-
// matching the bounded backoff used elsewhere on the Windows save path.
|
|
511
|
-
if (typeof code === "string" &&
|
|
512
|
-
RETRYABLE_FS_CODES.has(code) &&
|
|
513
|
-
Date.now() < deadline) {
|
|
514
|
-
await sleep(CONFIG_LOCK_POLL_MS);
|
|
515
|
-
continue;
|
|
516
|
-
}
|
|
517
|
-
throw error;
|
|
518
|
-
}
|
|
519
|
-
// Lock is held. Take it over if the holder expired/crashed; otherwise wait.
|
|
520
|
-
if (await isConfigLockStale(lockPath)) {
|
|
521
|
-
await unlinkConfigLockWithRetry(lockPath);
|
|
522
|
-
continue;
|
|
523
|
-
}
|
|
524
|
-
if (Date.now() >= deadline) {
|
|
525
|
-
const timeoutError = new Error(`Timed out acquiring config save lock at ${lockPath}.`);
|
|
526
|
-
timeoutError.code = "ELOCKTIMEOUT";
|
|
527
|
-
throw timeoutError;
|
|
528
|
-
}
|
|
529
|
-
await sleep(CONFIG_LOCK_POLL_MS);
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
try {
|
|
533
|
-
return await task();
|
|
534
|
-
}
|
|
535
|
-
finally {
|
|
536
|
-
await releaseConfigLockIfOwner(lockPath, owner);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
330
|
+
// Cross-process save safety lives in lib/storage/json-store-lock.ts:
|
|
331
|
+
// withJsonStoreWriteQueue (per-path in-process queue), withJsonStoreFileLock
|
|
332
|
+
// (candidate-directory lock + dead-owner recovery), and the mtime CAS
|
|
333
|
+
// trio (getJsonStoreFileMtimeMs / writeJsonStoreFileAtomicWithRetry /
|
|
334
|
+
// withJsonStoreCasRetry). The file lock provides the cross-process mutual
|
|
335
|
+
// exclusion that closes the read→check→merge→rename TOCTOU window against
|
|
336
|
+
// OTHER processes; the mtime CAS stays on as a second-line guard for any
|
|
337
|
+
// non-participating writer.
|
|
539
338
|
/**
|
|
540
339
|
* Read and parse a JSON configuration file and return its top-level object when present and valid.
|
|
541
340
|
*
|
|
@@ -718,19 +517,19 @@ export async function savePluginConfig(configPatch) {
|
|
|
718
517
|
}
|
|
719
518
|
const envPath = (process.env.CODEX_MULTI_AUTH_CONFIG_PATH ?? "").trim();
|
|
720
519
|
if (envPath.length > 0) {
|
|
721
|
-
await
|
|
520
|
+
await withJsonStoreWriteQueue(envPath, async () => {
|
|
722
521
|
// In-process queue (above) is the cheap fast path; the cross-process file
|
|
723
522
|
// lock (below) closes the read→merge→rename TOCTOU window against OTHER
|
|
724
523
|
// processes. Acquire the file lock for the full critical section, then run
|
|
725
524
|
// the same mtime CAS retry as a second-line guard for any non-participating
|
|
726
525
|
// writer. Mirrors the unified-settings save path (writeSettingsRecordAsync
|
|
727
526
|
// CAS).
|
|
728
|
-
await
|
|
527
|
+
await withJsonStoreFileLock(envPath, async () => {
|
|
729
528
|
// CAS retry: ESTALE means the file's mtime moved between our stat and
|
|
730
529
|
// the write, so each attempt re-stats, re-reads, and re-merges against
|
|
731
530
|
// the latest on-disk state before writing again.
|
|
732
|
-
await
|
|
733
|
-
const expectedMtimeMs = await
|
|
531
|
+
await withJsonStoreCasRetry(async () => {
|
|
532
|
+
const expectedMtimeMs = await getJsonStoreFileMtimeMs(envPath);
|
|
734
533
|
const envConfigState = await readConfigRecordForSave(envPath);
|
|
735
534
|
if (envConfigState.status === "unreadable") {
|
|
736
535
|
throw unreadableConfigSaveError(envPath, envConfigState.errorMessage);
|
|
@@ -742,39 +541,45 @@ export async function savePluginConfig(configPatch) {
|
|
|
742
541
|
...(existingConfig ?? {}),
|
|
743
542
|
...sanitizedPatch,
|
|
744
543
|
};
|
|
745
|
-
await
|
|
544
|
+
await writeJsonStoreFileAtomicWithRetry(envPath, merged, {
|
|
746
545
|
expectedMtimeMs,
|
|
747
546
|
});
|
|
748
|
-
}
|
|
547
|
+
});
|
|
749
548
|
});
|
|
750
549
|
});
|
|
751
550
|
return;
|
|
752
551
|
}
|
|
753
552
|
const unifiedPath = getUnifiedSettingsPath();
|
|
754
|
-
await
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
553
|
+
await withJsonStoreWriteQueue(unifiedPath, async () => {
|
|
554
|
+
// Hold the same cross-process lockfile for the read→merge portion, not
|
|
555
|
+
// just the write: saveUnifiedPluginConfig re-acquires both primitives
|
|
556
|
+
// re-entrantly inside this critical section, so the merged pluginConfig
|
|
557
|
+
// cannot interleave with another process's write to the same file.
|
|
558
|
+
await withJsonStoreFileLock(unifiedPath, async () => {
|
|
559
|
+
const unifiedConfigState = await readConfigRecordForSave(unifiedPath);
|
|
560
|
+
if (unifiedConfigState.status === "unreadable") {
|
|
561
|
+
throw unreadableConfigSaveError(unifiedPath, unifiedConfigState.errorMessage);
|
|
562
|
+
}
|
|
563
|
+
const unifiedConfigRecord = unifiedConfigState.status === "ok"
|
|
564
|
+
? unifiedConfigState.record.pluginConfig
|
|
565
|
+
: loadUnifiedPluginConfigSync();
|
|
566
|
+
const unifiedConfig = sanitizeStoredPluginConfigRecord(unifiedConfigRecord);
|
|
567
|
+
const legacyPath = unifiedConfig === null ? resolvePluginConfigPath() : null;
|
|
568
|
+
const legacyConfigState = legacyPath
|
|
569
|
+
? await readConfigRecordForSave(legacyPath)
|
|
570
|
+
: null;
|
|
571
|
+
if (legacyConfigState?.status === "unreadable") {
|
|
572
|
+
throw unreadableConfigSaveError(legacyPath, legacyConfigState.errorMessage);
|
|
573
|
+
}
|
|
574
|
+
const legacyConfig = legacyConfigState?.status === "ok"
|
|
575
|
+
? sanitizeStoredPluginConfigRecord(legacyConfigState.record)
|
|
576
|
+
: null;
|
|
577
|
+
const merged = {
|
|
578
|
+
...(unifiedConfig ?? legacyConfig ?? {}),
|
|
579
|
+
...sanitizedPatch,
|
|
580
|
+
};
|
|
581
|
+
await saveUnifiedPluginConfig(merged);
|
|
582
|
+
});
|
|
778
583
|
});
|
|
779
584
|
}
|
|
780
585
|
function parseNumberEnv(value) {
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* behavior (see the v2.5.0 release notes) closely enough to launch that no
|
|
7
7
|
* estimate here has been reviewed for it yet.
|
|
8
8
|
*/
|
|
9
|
-
export declare const UNESTIMATED_ROUTABLE_MODELS: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "gpt-6-
|
|
9
|
+
export declare const UNESTIMATED_ROUTABLE_MODELS: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "gpt-6-sol", "gpt-6-luna", "gpt-6.1-sol", "gpt-daybreak-blue-latest", "gpt-daybreak-red-latest"];
|
|
10
10
|
export interface EffectiveContextWindow {
|
|
11
11
|
tokens: number;
|
|
12
12
|
source: "override" | "estimate";
|
|
@@ -22,4 +22,3 @@ export interface EffectiveContextWindow {
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function getEffectiveContextWindow(model: string | null | undefined, overrides: Record<string, number> | undefined): EffectiveContextWindow | null;
|
|
24
24
|
export declare function listEstimatedModelContextWindows(): Record<string, number>;
|
|
25
|
-
//# sourceMappingURL=model-context-windows.d.ts.map
|
|
@@ -23,14 +23,11 @@ import { getNormalizedModel } from "../request/helpers/model-map.js";
|
|
|
23
23
|
* it to UNESTIMATED_ROUTABLE_MODELS instead.
|
|
24
24
|
*/
|
|
25
25
|
//
|
|
26
|
-
// Retired models (`gpt-5.1` through `gpt-5.
|
|
27
|
-
// models) are deliberately absent. Their ids now route to a
|
|
28
|
-
// estimating the window from the retired name would
|
|
29
|
-
// a model it no longer runs on.
|
|
30
|
-
const ESTIMATED_MODEL_CONTEXT_WINDOWS = {
|
|
31
|
-
"gpt-5.5": 260_000,
|
|
32
|
-
"gpt-5.5-pro": 260_000,
|
|
33
|
-
};
|
|
26
|
+
// Retired models (`gpt-5.1` through `gpt-5.5-pro`, `gpt-5-mini`/`nano`, the
|
|
27
|
+
// codex models) are deliberately absent. Their ids now route to a
|
|
28
|
+
// replacement, and estimating the window from the retired name would
|
|
29
|
+
// evaluate a request against a model it no longer runs on.
|
|
30
|
+
const ESTIMATED_MODEL_CONTEXT_WINDOWS = {};
|
|
34
31
|
/**
|
|
35
32
|
* Routable models this guard consciously does not estimate a window for.
|
|
36
33
|
* `getEffectiveContextWindow` returns `null` for these absent an override,
|
|
@@ -52,11 +49,11 @@ export const UNESTIMATED_ROUTABLE_MODELS = [
|
|
|
52
49
|
// measured ceiling for this transport, so it stays unestimated too. Set
|
|
53
50
|
// `contextBudgetGuardModelWindowOverrides` once you know your real ceiling.
|
|
54
51
|
"gpt-6-astra",
|
|
55
|
-
|
|
56
|
-
//
|
|
57
|
-
// catalog as Astra, so the same reasoning keeps them unestimated.
|
|
52
|
+
// Sol, Luna and 6.1 Sol carry the same 272K Codex / 872K max split in the
|
|
53
|
+
// upstream catalog as Astra, so the same reasoning keeps them unestimated.
|
|
58
54
|
"gpt-6-sol",
|
|
59
55
|
"gpt-6-luna",
|
|
56
|
+
"gpt-6.1-sol",
|
|
60
57
|
"gpt-daybreak-blue-latest",
|
|
61
58
|
"gpt-daybreak-red-latest",
|
|
62
59
|
];
|
|
@@ -79,8 +76,8 @@ function normalizeModelName(model) {
|
|
|
79
76
|
* the way they type the model still wins, then the catalog's canonical id for
|
|
80
77
|
* it. `getNormalizedModel` is deliberately the exact/alias-only resolver —
|
|
81
78
|
* `resolveNormalizedModel` falls back to `DEFAULT_MODEL` for anything it does
|
|
82
|
-
* not recognize, which would hand an unknown model
|
|
83
|
-
* evaluate a real session against a fabricated number.
|
|
79
|
+
* not recognize, which would hand an unknown model the default model's
|
|
80
|
+
* window and evaluate a real session against a fabricated number.
|
|
84
81
|
*/
|
|
85
82
|
function windowLookupCandidates(model) {
|
|
86
83
|
const raw = normalizeModelName(model);
|
|
@@ -22,4 +22,3 @@ export declare function createContextBudgetPauseResponse(advisory: Extract<Conte
|
|
|
22
22
|
export declare function buildContextBudgetHeaders(advisory: Extract<ContextBudgetAdvisory, {
|
|
23
23
|
level: "soft" | "hard";
|
|
24
24
|
}>): Record<string, string>;
|
|
25
|
-
//# sourceMappingURL=context-budget-response.d.ts.map
|
|
@@ -18,4 +18,16 @@
|
|
|
18
18
|
* @returns `true`/`false` for recognised literals, otherwise `undefined`.
|
|
19
19
|
*/
|
|
20
20
|
export declare function parseBooleanEnv(value: string | undefined): boolean | undefined;
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Parses an integer environment-variable string.
|
|
23
|
+
*
|
|
24
|
+
* Returns `undefined` for `undefined` input, an empty/whitespace-only string,
|
|
25
|
+
* or any value that does not start with a parseable integer — letting callers
|
|
26
|
+
* fall back through nullish coalescing to their default. Matches the semantics
|
|
27
|
+
* of the local `parseEnvInt` copies in lib/refresh-lease.ts and
|
|
28
|
+
* lib/request/failover-config.ts.
|
|
29
|
+
*
|
|
30
|
+
* @param value - Raw env-variable value (or `undefined` when unset).
|
|
31
|
+
* @returns The parsed integer, otherwise `undefined`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseIntegerEnv(value: string | undefined): number | undefined;
|
package/dist/lib/env-parsing.js
CHANGED
|
@@ -31,3 +31,24 @@ export function parseBooleanEnv(value) {
|
|
|
31
31
|
return false;
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Parses an integer environment-variable string.
|
|
36
|
+
*
|
|
37
|
+
* Returns `undefined` for `undefined` input, an empty/whitespace-only string,
|
|
38
|
+
* or any value that does not start with a parseable integer — letting callers
|
|
39
|
+
* fall back through nullish coalescing to their default. Matches the semantics
|
|
40
|
+
* of the local `parseEnvInt` copies in lib/refresh-lease.ts and
|
|
41
|
+
* lib/request/failover-config.ts.
|
|
42
|
+
*
|
|
43
|
+
* @param value - Raw env-variable value (or `undefined` when unset).
|
|
44
|
+
* @returns The parsed integer, otherwise `undefined`.
|
|
45
|
+
*/
|
|
46
|
+
export function parseIntegerEnv(value) {
|
|
47
|
+
if (value === undefined)
|
|
48
|
+
return undefined;
|
|
49
|
+
const trimmed = value.trim();
|
|
50
|
+
if (trimmed.length === 0)
|
|
51
|
+
return undefined;
|
|
52
|
+
const parsed = Number.parseInt(trimmed, 10);
|
|
53
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
54
|
+
}
|
package/dist/lib/errors.d.ts
CHANGED
|
@@ -134,4 +134,3 @@ export declare class CodexUnavailableError extends CodexError {
|
|
|
134
134
|
* boundaries by also matching on the structural `code` marker.
|
|
135
135
|
*/
|
|
136
136
|
export declare function isCodexUnavailableError(error: unknown): error is CodexUnavailableError;
|
|
137
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/lib/forecast.d.ts
CHANGED
|
@@ -80,4 +80,3 @@ export declare function recommendForecastAccount(results: ForecastAccountResult[
|
|
|
80
80
|
export declare function summarizeForecast(results: ForecastAccountResult[]): ForecastSummary;
|
|
81
81
|
export declare function buildForecastExplanation(results: ForecastAccountResult[], recommendation: ForecastRecommendation): ForecastExplanation;
|
|
82
82
|
export {};
|
|
83
|
-
//# sourceMappingURL=forecast.d.ts.map
|
package/dist/lib/fs-retry.d.ts
CHANGED
|
@@ -47,4 +47,3 @@ export declare function withRetry<T>(operation: () => Promise<T> | T, options: R
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function withRetrySync<T>(operation: () => T, options: RetryOptions): T;
|
|
49
49
|
export declare function withFileOperationRetry<T>(operation: () => Promise<T>): Promise<T>;
|
|
50
|
-
//# sourceMappingURL=fs-retry.d.ts.map
|
package/dist/lib/health.d.ts
CHANGED
package/dist/lib/index.d.ts
CHANGED
|
@@ -11,4 +11,3 @@ export interface IntegrationSnippet {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function generateIntegrationSnippet(kind: IntegrationSnippetKind, input?: IntegrationSnippetInput): IntegrationSnippet;
|
|
13
13
|
export declare function generateIntegrationSnippets(kinds?: IntegrationSnippetKind[], input?: IntegrationSnippetInput): IntegrationSnippet[];
|
|
14
|
-
//# sourceMappingURL=integration-generators.d.ts.map
|
package/dist/lib/local-bridge.js
CHANGED
|
@@ -195,10 +195,13 @@ export async function startLocalBridge(options) {
|
|
|
195
195
|
throw new Error("Local bridge requires requireAuth=true when runtimeClientApiKey is configured.");
|
|
196
196
|
}
|
|
197
197
|
const app = new Hono();
|
|
198
|
+
// Deliberately minimal payload: /health is reachable without a bearer (it is
|
|
199
|
+
// the liveness probe), so it must not echo runtimeBaseUrl back — that value
|
|
200
|
+
// describes where the bridge forwards local client tokens and is internal
|
|
201
|
+
// routing detail, not something to hand unauthenticated callers.
|
|
198
202
|
app.get("/health", (context) => context.json({
|
|
199
203
|
ok: true,
|
|
200
204
|
service: "codex-multi-auth-local-bridge",
|
|
201
|
-
runtimeBaseUrl,
|
|
202
205
|
}));
|
|
203
206
|
const forward = async (request, targetPath) => {
|
|
204
207
|
const startedAt = Date.now();
|
|
@@ -34,4 +34,3 @@ export declare function rotateLocalClientToken(input: {
|
|
|
34
34
|
export declare function revokeLocalClientToken(id: string, now?: number): Promise<boolean>;
|
|
35
35
|
export declare function verifyLocalClientBearerToken(authorizationHeader: string | null, now?: number): Promise<LocalClientTokenRecord | null>;
|
|
36
36
|
export declare function resetLocalClientTokenWriteQueueForTests(): void;
|
|
37
|
-
//# sourceMappingURL=local-client-tokens.d.ts.map
|