codex-multi-auth 2.3.0-beta.0 → 2.3.0-beta.2
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 +4 -3
- package/config/schema/config.schema.json +268 -21
- package/dist/index.js +0 -1
- package/dist/lib/account-policy.js +0 -1
- package/dist/lib/accounts/rate-limits.js +0 -1
- package/dist/lib/accounts.d.ts +3 -8
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +2 -3
- package/dist/lib/audit.js +0 -1
- package/dist/lib/auth/auth.js +0 -1
- package/dist/lib/auth/browser.js +0 -1
- package/dist/lib/auth/device-auth.js +0 -1
- package/dist/lib/auth/index.js +0 -1
- package/dist/lib/auth/org-override.js +0 -1
- package/dist/lib/auth/server.js +0 -1
- package/dist/lib/auth/token-utils.js +0 -1
- package/dist/lib/auth-rate-limit.js +0 -1
- package/dist/lib/budget-guard.js +0 -1
- package/dist/lib/capability-policy.js +0 -1
- package/dist/lib/circuit-breaker.js +0 -1
- package/dist/lib/cli.js +1 -2
- package/dist/lib/codex-cli/index.js +0 -1
- package/dist/lib/codex-cli/observability.js +0 -1
- package/dist/lib/codex-cli/state.js +0 -1
- package/dist/lib/codex-cli/sync.d.ts +2 -2
- package/dist/lib/codex-cli/sync.d.ts.map +1 -1
- package/dist/lib/codex-cli/sync.js +1 -2
- package/dist/lib/codex-cli/writer.js +0 -1
- package/dist/lib/codex-manager/account-credentials.d.ts +13 -0
- package/dist/lib/codex-manager/account-credentials.d.ts.map +1 -0
- package/dist/lib/codex-manager/account-credentials.js +55 -0
- package/dist/lib/codex-manager/account-manager-commands.js +0 -1
- package/dist/lib/codex-manager/account-pool-write.d.ts +95 -0
- package/dist/lib/codex-manager/account-pool-write.d.ts.map +1 -0
- package/dist/lib/codex-manager/account-pool-write.js +165 -0
- package/dist/lib/codex-manager/account-pool-write.js.map +1 -0
- package/dist/lib/codex-manager/backend-category-entry.js +0 -1
- package/dist/lib/codex-manager/backend-category-helpers.js +0 -1
- package/dist/lib/codex-manager/backend-category-prompt.js +0 -1
- package/dist/lib/codex-manager/backend-settings-controller.js +0 -1
- package/dist/lib/codex-manager/backend-settings-entry.js +0 -1
- package/dist/lib/codex-manager/backend-settings-helpers.js +0 -1
- package/dist/lib/codex-manager/backend-settings-prompt.js +0 -1
- package/dist/lib/codex-manager/backend-settings-schema.js +0 -1
- package/dist/lib/codex-manager/behavior-settings-panel.d.ts +1 -1
- package/dist/lib/codex-manager/behavior-settings-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/behavior-settings-panel.js +0 -1
- package/dist/lib/codex-manager/commands/account.js +0 -1
- package/dist/lib/codex-manager/commands/best.d.ts +8 -0
- package/dist/lib/codex-manager/commands/best.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/best.js +64 -1
- package/dist/lib/codex-manager/commands/bridge.js +0 -1
- package/dist/lib/codex-manager/commands/budget.js +0 -1
- package/dist/lib/codex-manager/commands/check.js +0 -1
- package/dist/lib/codex-manager/commands/config-explain.js +0 -1
- package/dist/lib/codex-manager/commands/debug-bundle.js +0 -1
- package/dist/lib/codex-manager/commands/forecast.js +0 -1
- package/dist/lib/codex-manager/commands/init-config.js +0 -1
- package/dist/lib/codex-manager/commands/integrations.js +0 -1
- package/dist/lib/codex-manager/commands/models.js +0 -1
- package/dist/lib/codex-manager/commands/monitor.js +0 -1
- package/dist/lib/codex-manager/commands/report.js +0 -1
- package/dist/lib/codex-manager/commands/rotation.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/rotation.js +1 -4
- package/dist/lib/codex-manager/commands/status.js +0 -1
- package/dist/lib/codex-manager/commands/switch.js +0 -1
- package/dist/lib/codex-manager/commands/uninstall.d.ts.map +1 -1
- package/dist/lib/codex-manager/commands/uninstall.js +2 -33
- package/dist/lib/codex-manager/commands/unpin.js +0 -1
- package/dist/lib/codex-manager/commands/usage.js +0 -1
- package/dist/lib/codex-manager/commands/verify.js +0 -1
- package/dist/lib/codex-manager/commands/why-selected.js +0 -1
- package/dist/lib/codex-manager/commands/workspace.js +0 -1
- package/dist/lib/codex-manager/dashboard-display-panel.d.ts +1 -1
- package/dist/lib/codex-manager/dashboard-display-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/dashboard-display-panel.js +0 -1
- package/dist/lib/codex-manager/dashboard-formatters.js +0 -1
- package/dist/lib/codex-manager/dashboard-settings-controller.js +0 -1
- package/dist/lib/codex-manager/dashboard-settings-data.js +0 -1
- package/dist/lib/codex-manager/dashboard-settings-entry.js +0 -1
- package/dist/lib/codex-manager/experimental-settings-entry.js +0 -1
- package/dist/lib/codex-manager/experimental-settings-prompt.js +0 -1
- package/dist/lib/codex-manager/experimental-settings-schema.js +1 -2
- package/dist/lib/codex-manager/experimental-sync-target-entry.js +0 -1
- package/dist/lib/codex-manager/experimental-sync-target.js +0 -1
- package/dist/lib/codex-manager/forecast-report-commands.js +0 -1
- package/dist/lib/codex-manager/forecast-report-shared.d.ts +2 -2
- package/dist/lib/codex-manager/forecast-report-shared.d.ts.map +1 -1
- package/dist/lib/codex-manager/forecast-report-shared.js +5 -21
- package/dist/lib/codex-manager/formatters/account-formatters.d.ts +11 -0
- package/dist/lib/codex-manager/formatters/account-formatters.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/account-formatters.js +79 -0
- package/dist/lib/codex-manager/formatters/index.d.ts +5 -0
- package/dist/lib/codex-manager/formatters/index.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/index.js +4 -0
- package/dist/lib/codex-manager/formatters/model-formatters.d.ts +12 -0
- package/dist/lib/codex-manager/formatters/model-formatters.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/model-formatters.js +23 -0
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts +11 -0
- package/dist/lib/codex-manager/formatters/quota-formatters.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/quota-formatters.js +104 -0
- package/dist/lib/codex-manager/formatters/text-style.d.ts +14 -0
- package/dist/lib/codex-manager/formatters/text-style.d.ts.map +1 -0
- package/dist/lib/codex-manager/formatters/text-style.js +111 -0
- package/dist/lib/codex-manager/health-check.d.ts +14 -0
- package/dist/lib/codex-manager/health-check.d.ts.map +1 -0
- package/dist/lib/codex-manager/health-check.js +278 -0
- package/dist/lib/codex-manager/help.js +0 -1
- package/dist/lib/codex-manager/login-action-panel.d.ts +4 -0
- package/dist/lib/codex-manager/login-action-panel.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-action-panel.js +238 -0
- package/dist/lib/codex-manager/login-flow.d.ts +17 -0
- package/dist/lib/codex-manager/login-flow.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-flow.js +387 -0
- package/dist/lib/codex-manager/login-menu-actions.d.ts +20 -0
- package/dist/lib/codex-manager/login-menu-actions.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-menu-actions.js +303 -0
- package/dist/lib/codex-manager/login-menu-data.d.ts +19 -0
- package/dist/lib/codex-manager/login-menu-data.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-menu-data.js +378 -0
- package/dist/lib/codex-manager/login-oauth.d.ts +55 -0
- package/dist/lib/codex-manager/login-oauth.d.ts.map +1 -0
- package/dist/lib/codex-manager/login-oauth.js +345 -0
- package/dist/lib/codex-manager/manual-callback.d.ts +33 -0
- package/dist/lib/codex-manager/manual-callback.d.ts.map +1 -0
- package/dist/lib/codex-manager/manual-callback.js +30 -0
- package/dist/lib/codex-manager/manual-callback.js.map +1 -0
- package/dist/lib/codex-manager/persist-selected-account.d.ts +24 -0
- package/dist/lib/codex-manager/persist-selected-account.d.ts.map +1 -0
- package/dist/lib/codex-manager/persist-selected-account.js +107 -0
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts +18 -0
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts.map +1 -0
- package/dist/lib/codex-manager/quota-cache-helpers.js +112 -0
- package/dist/lib/codex-manager/rate-limit-markers.js +0 -1
- package/dist/lib/codex-manager/repair-commands.js +0 -1
- package/dist/lib/codex-manager/settings-hub/backend.js +1 -2
- package/dist/lib/codex-manager/settings-hub/dashboard.js +1 -2
- package/dist/lib/codex-manager/settings-hub/experimental.js +1 -2
- package/dist/lib/codex-manager/settings-hub/index.js +1 -2
- package/dist/lib/codex-manager/settings-hub/shared.js +0 -1
- package/dist/lib/codex-manager/settings-hub-entry.js +0 -1
- package/dist/lib/codex-manager/settings-hub-menu.js +0 -1
- package/dist/lib/codex-manager/settings-hub-prompt.js +0 -1
- package/dist/lib/codex-manager/settings-hub.js +0 -1
- package/dist/lib/codex-manager/settings-panels.js +0 -1
- package/dist/lib/codex-manager/settings-persist-utils.js +0 -1
- package/dist/lib/codex-manager/settings-preview.js +0 -1
- package/dist/lib/codex-manager/settings-write-queue.js +0 -1
- package/dist/lib/codex-manager/statusline-order.js +0 -1
- package/dist/lib/codex-manager/statusline-settings-panel.d.ts +1 -1
- package/dist/lib/codex-manager/statusline-settings-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/statusline-settings-panel.js +0 -1
- package/dist/lib/codex-manager/theme-settings-panel.d.ts +1 -1
- package/dist/lib/codex-manager/theme-settings-panel.d.ts.map +1 -1
- package/dist/lib/codex-manager/theme-settings-panel.js +0 -1
- package/dist/lib/codex-manager/unified-settings-controller.js +0 -1
- package/dist/lib/codex-manager/unified-settings-entry.js +0 -1
- package/dist/lib/codex-manager.d.ts +2 -4
- package/dist/lib/codex-manager.d.ts.map +1 -1
- package/dist/lib/codex-manager.js +219 -2578
- package/dist/lib/codex-manager.js.map +1 -1
- package/dist/lib/config-schema.d.ts +32 -0
- package/dist/lib/config-schema.d.ts.map +1 -0
- package/dist/lib/config-schema.js +96 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +60 -104
- package/dist/lib/constants.js +0 -1
- package/dist/lib/context-overflow.js +0 -1
- package/dist/lib/dashboard-settings.js +0 -1
- package/dist/lib/entitlement-cache.js +0 -1
- package/dist/lib/env-parsing.js +0 -1
- package/dist/lib/errors.js +0 -1
- package/dist/lib/forecast.js +0 -1
- package/dist/lib/fs-retry.d.ts +46 -0
- package/dist/lib/fs-retry.d.ts.map +1 -1
- package/dist/lib/fs-retry.js +74 -6
- package/dist/lib/health.js +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/integration-generators.js +0 -1
- package/dist/lib/live-account-sync.js +0 -1
- package/dist/lib/local-bridge.js +0 -1
- package/dist/lib/local-client-tokens.js +0 -1
- package/dist/lib/logger.js +0 -1
- package/dist/lib/model-capability-matrix.js +0 -1
- package/dist/lib/named-backup-export.js +0 -1
- package/dist/lib/oc-chatgpt-import-adapter.js +0 -1
- package/dist/lib/oc-chatgpt-orchestrator.js +0 -1
- package/dist/lib/oc-chatgpt-target-detection.js +0 -1
- package/dist/lib/parallel-probe.js +0 -1
- package/dist/lib/policy/runtime-policy.js +0 -1
- package/dist/lib/preemptive-quota-scheduler.js +0 -1
- package/dist/lib/proactive-refresh.js +0 -1
- package/dist/lib/prompts/codex-host-bridge.js +0 -1
- package/dist/lib/prompts/codex.d.ts +3 -11
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +4 -12
- package/dist/lib/prompts/fetch-utils.js +0 -1
- package/dist/lib/prompts/host-codex-prompt.js +0 -1
- package/dist/lib/quota-cache.d.ts.map +1 -1
- package/dist/lib/quota-cache.js +15 -43
- package/dist/lib/quota-probe.js +0 -1
- package/dist/lib/quota-readiness.js +0 -1
- package/dist/lib/recovery/constants.js +0 -1
- package/dist/lib/recovery/index.js +0 -1
- package/dist/lib/recovery/storage.d.ts.map +1 -1
- package/dist/lib/recovery/storage.js +30 -51
- package/dist/lib/recovery/storage.js.map +1 -1
- package/dist/lib/recovery/types.js +0 -1
- package/dist/lib/recovery.js +0 -1
- package/dist/lib/refresh-guardian.js +0 -1
- package/dist/lib/refresh-lease.d.ts.map +1 -1
- package/dist/lib/refresh-lease.js +1 -4
- package/dist/lib/refresh-queue.js +0 -1
- package/dist/lib/request/error-classification.d.ts +75 -0
- package/dist/lib/request/error-classification.d.ts.map +1 -0
- package/dist/lib/request/error-classification.js +295 -0
- package/dist/lib/request/failover-config.js +0 -1
- package/dist/lib/request/failure-policy.js +0 -1
- package/dist/lib/request/fetch-helpers.d.ts +10 -114
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
- package/dist/lib/request/fetch-helpers.js +7 -589
- package/dist/lib/request/headers.d.ts +33 -0
- package/dist/lib/request/headers.d.ts.map +1 -0
- package/dist/lib/request/headers.js +64 -0
- package/dist/lib/request/helpers/input-utils.js +0 -1
- package/dist/lib/request/helpers/model-map.d.ts +10 -0
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
- package/dist/lib/request/helpers/model-map.js +11 -1
- package/dist/lib/request/helpers/tool-utils.js +0 -1
- package/dist/lib/request/index.js +0 -1
- package/dist/lib/request/rate-limit-backoff.js +0 -1
- package/dist/lib/request/rate-limit-decision.d.ts +28 -0
- package/dist/lib/request/rate-limit-decision.d.ts.map +1 -0
- package/dist/lib/request/rate-limit-decision.js +191 -0
- package/dist/lib/request/request-attempt-budget.js +0 -1
- package/dist/lib/request/request-init.js +0 -1
- package/dist/lib/request/request-resilience.js +0 -1
- package/dist/lib/request/request-transformer.js +0 -1
- package/dist/lib/request/response-compaction.js +0 -1
- package/dist/lib/request/response-handler.js +0 -1
- package/dist/lib/request/response-metadata.js +0 -1
- package/dist/lib/request/stream-failover-runtime.d.ts +8 -0
- package/dist/lib/request/stream-failover-runtime.d.ts.map +1 -0
- package/dist/lib/request/stream-failover-runtime.js +149 -0
- package/dist/lib/request/stream-failover.js +0 -1
- package/dist/lib/request/token-refresh.d.ts +30 -0
- package/dist/lib/request/token-refresh.d.ts.map +1 -0
- package/dist/lib/request/token-refresh.js +116 -0
- package/dist/lib/request/url-rewriting.d.ts +24 -0
- package/dist/lib/request/url-rewriting.d.ts.map +1 -0
- package/dist/lib/request/url-rewriting.js +153 -0
- package/dist/lib/request/wait-utils.js +0 -1
- package/dist/lib/rotation.d.ts +1 -1
- package/dist/lib/rotation.d.ts.map +1 -1
- package/dist/lib/rotation.js +0 -1
- package/dist/lib/routing-mutex.js +0 -1
- package/dist/lib/routing-profiles.js +0 -1
- package/dist/lib/runtime/account-check-helpers.js +0 -1
- package/dist/lib/runtime/account-check-types.js +0 -1
- package/dist/lib/runtime/account-check.js +0 -1
- package/dist/lib/runtime/account-health-check.js +0 -1
- package/dist/lib/runtime/account-manager-cache-entry.js +0 -1
- package/dist/lib/runtime/account-manager-cache.js +0 -1
- package/dist/lib/runtime/account-pool.js +0 -1
- package/dist/lib/runtime/account-scope.js +0 -1
- package/dist/lib/runtime/account-select-event.js +0 -1
- package/dist/lib/runtime/account-selection.js +0 -1
- package/dist/lib/runtime/account-state.js +0 -1
- package/dist/lib/runtime/account-status.js +0 -1
- package/dist/lib/runtime/account-storage-scope-entry.js +0 -1
- package/dist/lib/runtime/app-bind.js +0 -1
- package/dist/lib/runtime/auth-facade.js +0 -1
- package/dist/lib/runtime/browser-oauth-flow.js +0 -1
- package/dist/lib/runtime/capability-boost.js +0 -1
- package/dist/lib/runtime/config-toml.js +0 -1
- package/dist/lib/runtime/event-handler.js +0 -1
- package/dist/lib/runtime/first-run.d.ts +80 -0
- package/dist/lib/runtime/first-run.d.ts.map +1 -0
- package/dist/lib/runtime/first-run.js +327 -0
- package/dist/lib/runtime/flagged-verify-types.js +0 -1
- package/dist/lib/runtime/hydrate-emails.js +0 -1
- package/dist/lib/runtime/live-sync-entry.js +0 -1
- package/dist/lib/runtime/live-sync.js +0 -1
- package/dist/lib/runtime/loader-setup.js +0 -1
- package/dist/lib/runtime/login-menu-accounts.js +0 -1
- package/dist/lib/runtime/manual-oauth-flow.js +0 -1
- package/dist/lib/runtime/oauth-browser-flow.js +0 -1
- package/dist/lib/runtime/preemptive-quota.js +0 -1
- package/dist/lib/runtime/quota-headers.js +0 -1
- package/dist/lib/runtime/quota-probe.js +0 -1
- package/dist/lib/runtime/quota-settings.js +0 -1
- package/dist/lib/runtime/refresh-guardian-entry.js +0 -1
- package/dist/lib/runtime/refresh-guardian.js +0 -1
- package/dist/lib/runtime/request-init.js +0 -1
- package/dist/lib/runtime/rotation-account-selection.d.ts +38 -0
- package/dist/lib/runtime/rotation-account-selection.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-account-selection.js +172 -0
- package/dist/lib/runtime/rotation-proxy-state.d.ts +54 -0
- package/dist/lib/runtime/rotation-proxy-state.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-proxy-state.js +56 -0
- package/dist/lib/runtime/rotation-server-types.d.ts +57 -0
- package/dist/lib/runtime/rotation-server-types.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-server-types.js +1 -0
- package/dist/lib/runtime/rotation-storage-meta.d.ts +40 -0
- package/dist/lib/runtime/rotation-storage-meta.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-storage-meta.js +143 -0
- package/dist/lib/runtime/rotation-token-refresh.d.ts +25 -0
- package/dist/lib/runtime/rotation-token-refresh.d.ts.map +1 -0
- package/dist/lib/runtime/rotation-token-refresh.js +99 -0
- package/dist/lib/runtime/runtime-current-account.d.ts.map +1 -1
- package/dist/lib/runtime/runtime-current-account.js +1 -4
- package/dist/lib/runtime/runtime-observability.js +0 -1
- package/dist/lib/runtime/runtime-services.js +0 -1
- package/dist/lib/runtime/session-affinity-entry.js +0 -1
- package/dist/lib/runtime/session-affinity.js +0 -1
- package/dist/lib/runtime/session-recovery.js +0 -1
- package/dist/lib/runtime/status-marker.js +0 -1
- package/dist/lib/runtime/storage-scope.js +0 -1
- package/dist/lib/runtime/toast.js +0 -1
- package/dist/lib/runtime/ui-runtime-entry.js +0 -1
- package/dist/lib/runtime/ui-runtime.js +0 -1
- package/dist/lib/runtime/verify-flagged.js +0 -1
- package/dist/lib/runtime-constants.js +0 -1
- package/dist/lib/runtime-paths.js +0 -1
- package/dist/lib/runtime-rotation-proxy.d.ts +7 -124
- package/dist/lib/runtime-rotation-proxy.d.ts.map +1 -1
- package/dist/lib/runtime-rotation-proxy.js +614 -1353
- package/dist/lib/schemas.d.ts +3 -3
- package/dist/lib/schemas.js +1 -2
- package/dist/lib/session-affinity.js +0 -1
- package/dist/lib/shutdown.js +0 -1
- package/dist/lib/storage/account-clear-entry.js +0 -1
- package/dist/lib/storage/account-clear.js +0 -1
- package/dist/lib/storage/account-match-utils.js +0 -1
- package/dist/lib/storage/account-persistence.d.ts +1 -1
- package/dist/lib/storage/account-persistence.d.ts.map +1 -1
- package/dist/lib/storage/account-persistence.js +0 -1
- package/dist/lib/storage/account-port.d.ts +1 -1
- package/dist/lib/storage/account-port.d.ts.map +1 -1
- package/dist/lib/storage/account-port.js +0 -1
- package/dist/lib/storage/account-save-entry.d.ts +1 -1
- package/dist/lib/storage/account-save-entry.d.ts.map +1 -1
- package/dist/lib/storage/account-save-entry.js +0 -1
- package/dist/lib/storage/account-save.d.ts +1 -1
- package/dist/lib/storage/account-save.d.ts.map +1 -1
- package/dist/lib/storage/account-save.js +0 -1
- package/dist/lib/storage/account-snapshot.js +0 -1
- package/dist/lib/storage/backup-metadata-builder.d.ts +1 -1
- package/dist/lib/storage/backup-metadata-builder.d.ts.map +1 -1
- package/dist/lib/storage/backup-metadata-builder.js +0 -1
- package/dist/lib/storage/backup-metadata.d.ts +13 -0
- package/dist/lib/storage/backup-metadata.d.ts.map +1 -1
- package/dist/lib/storage/backup-metadata.js +0 -1
- package/dist/lib/storage/backup-paths.js +0 -1
- package/dist/lib/storage/backup-restore.d.ts +1 -1
- package/dist/lib/storage/backup-restore.d.ts.map +1 -1
- package/dist/lib/storage/backup-restore.js +0 -1
- package/dist/lib/storage/cache-artifacts.js +0 -1
- package/dist/lib/storage/error-hints.js +0 -1
- package/dist/lib/storage/file-paths.js +0 -1
- package/dist/lib/storage/fixture-guards.d.ts +1 -1
- package/dist/lib/storage/fixture-guards.d.ts.map +1 -1
- package/dist/lib/storage/fixture-guards.js +0 -1
- package/dist/lib/storage/flagged-entry.js +0 -1
- package/dist/lib/storage/flagged-load-entry.d.ts +1 -1
- package/dist/lib/storage/flagged-load-entry.d.ts.map +1 -1
- package/dist/lib/storage/flagged-load-entry.js +0 -1
- package/dist/lib/storage/flagged-save-entry.d.ts +1 -1
- package/dist/lib/storage/flagged-save-entry.d.ts.map +1 -1
- package/dist/lib/storage/flagged-save-entry.js +0 -1
- package/dist/lib/storage/flagged-storage-file.d.ts +1 -1
- package/dist/lib/storage/flagged-storage-file.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage-file.js +0 -1
- package/dist/lib/storage/flagged-storage-io.d.ts +1 -1
- package/dist/lib/storage/flagged-storage-io.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage-io.js +0 -1
- package/dist/lib/storage/flagged-storage.d.ts +1 -1
- package/dist/lib/storage/flagged-storage.d.ts.map +1 -1
- package/dist/lib/storage/flagged-storage.js +15 -2
- package/dist/lib/storage/flagged-storage.js.map +1 -1
- package/dist/lib/storage/gitignore.js +0 -1
- package/dist/lib/storage/hash.js +0 -1
- package/dist/lib/storage/health.js +0 -1
- package/dist/lib/storage/identity.js +0 -1
- package/dist/lib/storage/import-export.d.ts +1 -1
- package/dist/lib/storage/import-export.d.ts.map +1 -1
- package/dist/lib/storage/import-export.js +0 -1
- package/dist/lib/storage/metadata-section.js +0 -1
- package/dist/lib/storage/migrations.d.ts +5 -48
- package/dist/lib/storage/migrations.d.ts.map +1 -1
- package/dist/lib/storage/migrations.js +5 -2
- package/dist/lib/storage/named-backup-entry.js +0 -1
- package/dist/lib/storage/named-backups-entry.d.ts +1 -1
- package/dist/lib/storage/named-backups-entry.d.ts.map +1 -1
- package/dist/lib/storage/named-backups-entry.js +0 -1
- package/dist/lib/storage/named-backups.js +0 -1
- package/dist/lib/storage/path-state.js +0 -1
- package/dist/lib/storage/paths.js +0 -1
- package/dist/lib/storage/project-migration.d.ts +1 -1
- package/dist/lib/storage/project-migration.d.ts.map +1 -1
- package/dist/lib/storage/project-migration.js +0 -1
- package/dist/lib/storage/public-types.d.ts +70 -0
- package/dist/lib/storage/public-types.d.ts.map +1 -0
- package/dist/lib/storage/public-types.js +6 -0
- package/dist/lib/storage/record-utils.js +0 -1
- package/dist/lib/storage/restore-assessment.d.ts +1 -1
- package/dist/lib/storage/restore-assessment.d.ts.map +1 -1
- package/dist/lib/storage/restore-assessment.js +0 -1
- package/dist/lib/storage/restore-backup-entry.d.ts +1 -1
- package/dist/lib/storage/restore-backup-entry.d.ts.map +1 -1
- package/dist/lib/storage/restore-backup-entry.js +0 -1
- package/dist/lib/storage/restore-metadata.d.ts +1 -1
- package/dist/lib/storage/restore-metadata.d.ts.map +1 -1
- package/dist/lib/storage/restore-metadata.js +0 -1
- package/dist/lib/storage/restore.d.ts +1 -1
- package/dist/lib/storage/restore.d.ts.map +1 -1
- package/dist/lib/storage/restore.js +0 -1
- package/dist/lib/storage/save-retry.d.ts +10 -0
- package/dist/lib/storage/save-retry.d.ts.map +1 -0
- package/dist/lib/storage/save-retry.js +26 -0
- package/dist/lib/storage/snapshot-inspectors.d.ts +1 -1
- package/dist/lib/storage/snapshot-inspectors.d.ts.map +1 -1
- package/dist/lib/storage/snapshot-inspectors.js +0 -1
- package/dist/lib/storage/storage-parser.d.ts +1 -1
- package/dist/lib/storage/storage-parser.d.ts.map +1 -1
- package/dist/lib/storage/storage-parser.js +0 -1
- package/dist/lib/storage/transactions.d.ts +1 -1
- package/dist/lib/storage/transactions.d.ts.map +1 -1
- package/dist/lib/storage/transactions.js +0 -1
- package/dist/lib/storage.d.ts +3 -24
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +17 -32
- package/dist/lib/table-formatter.js +0 -1
- package/dist/lib/tools/hashline-tools.js +0 -1
- package/dist/lib/types.js +0 -1
- package/dist/lib/ui/ansi.js +0 -1
- package/dist/lib/ui/auth-menu-builder.d.ts +89 -0
- package/dist/lib/ui/auth-menu-builder.d.ts.map +1 -0
- package/dist/lib/ui/auth-menu-builder.js +350 -0
- package/dist/lib/ui/auth-menu.d.ts +2 -76
- package/dist/lib/ui/auth-menu.d.ts.map +1 -1
- package/dist/lib/ui/auth-menu.js +3 -349
- package/dist/lib/ui/confirm.js +0 -1
- package/dist/lib/ui/copy.d.ts +2 -0
- package/dist/lib/ui/copy.d.ts.map +1 -1
- package/dist/lib/ui/copy.js +2 -0
- package/dist/lib/ui/copy.js.map +1 -1
- package/dist/lib/ui/display-width.js +0 -1
- package/dist/lib/ui/format.js +0 -1
- package/dist/lib/ui/index.d.ts +10 -0
- package/dist/lib/ui/index.d.ts.map +1 -0
- package/dist/lib/ui/index.js +9 -0
- package/dist/lib/ui/runtime.js +0 -1
- package/dist/lib/ui/select.js +0 -1
- package/dist/lib/ui/theme.js +0 -1
- package/dist/lib/ui/ui-copy.d.ts +159 -0
- package/dist/lib/ui/ui-copy.d.ts.map +1 -0
- package/dist/lib/ui/ui-copy.js +163 -0
- package/dist/lib/unified-settings.js +0 -1
- package/dist/lib/update-notice.js +0 -1
- package/dist/lib/usage/index.js +0 -1
- package/dist/lib/usage/ledger.js +0 -1
- package/dist/lib/usage/pricing.js +0 -1
- package/dist/lib/usage/redaction.js +0 -1
- package/dist/lib/usage/types.js +0 -1
- package/dist/lib/utils.js +0 -1
- package/package.json +8 -8
- package/scripts/postinstall.js +34 -265
- package/scripts/preuninstall.js +2 -2
package/dist/lib/config.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, promises as fs, readFileSync } from "node:fs";
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { parseBooleanEnv } from "./env-parsing.js";
|
|
5
|
+
import { withRetry, withRetrySync } from "./fs-retry.js";
|
|
5
6
|
import { logWarn } from "./logger.js";
|
|
6
7
|
import { getCodexHomeDir, getCodexMultiAuthDir, getLegacyCodexDir, } from "./runtime-paths.js";
|
|
7
8
|
import { getValidationErrors, PluginConfigSchema } from "./schemas.js";
|
|
@@ -32,33 +33,19 @@ const RETRYABLE_CONFIG_READ_CODES = new Set(["EBUSY", "EPERM", "EAGAIN"]);
|
|
|
32
33
|
* attempts). ENOENT and SyntaxError are not retryable and propagate unchanged.
|
|
33
34
|
*/
|
|
34
35
|
function readFileSyncWithConfigRetry(configPath) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
for
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// synchronous and runs on startup, so the previous Atomics.wait froze
|
|
49
|
-
// the entire event loop for up to ~150ms on a transient Windows AV /
|
|
50
|
-
// indexer lock. An immediate re-read costs microseconds and a brief
|
|
51
|
-
// exclusive lock is typically released by the next attempt; if it
|
|
52
|
-
// genuinely persists we fail fast (the caller falls back to defaults)
|
|
53
|
-
// rather than stalling the process.
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
throw error;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
// Exhausted attempts on a retryable code: surface the last error so the caller
|
|
60
|
-
// classifies it (unreadable) instead of silently returning stale/empty content.
|
|
61
|
-
throw lastError;
|
|
36
|
+
// Immediate retry (backoffMs: 0) — NOT a blocking sleep. loadPluginConfig()
|
|
37
|
+
// is synchronous and runs on startup, so the previous Atomics.wait froze the
|
|
38
|
+
// entire event loop for up to ~150ms on a transient Windows AV / indexer
|
|
39
|
+
// lock. An immediate re-read costs microseconds and a brief exclusive lock
|
|
40
|
+
// is typically released by the next attempt; if it genuinely persists we
|
|
41
|
+
// fail fast (the caller falls back to defaults) rather than stalling the
|
|
42
|
+
// process. On exhaustion the last error surfaces so the caller classifies it
|
|
43
|
+
// (unreadable) instead of silently returning stale/empty content.
|
|
44
|
+
return withRetrySync(() => readFileSync(configPath, "utf-8"), {
|
|
45
|
+
maxAttempts: 5,
|
|
46
|
+
backoffMs: 0,
|
|
47
|
+
retryableCodes: RETRYABLE_CONFIG_READ_CODES,
|
|
48
|
+
});
|
|
62
49
|
}
|
|
63
50
|
function logConfigWarnOnce(message) {
|
|
64
51
|
if (emittedConfigWarnings.has(message)) {
|
|
@@ -332,10 +319,6 @@ function stripUtf8Bom(content) {
|
|
|
332
319
|
function isRecord(value) {
|
|
333
320
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
334
321
|
}
|
|
335
|
-
function isRetryableFsError(error) {
|
|
336
|
-
const code = error?.code;
|
|
337
|
-
return typeof code === "string" && RETRYABLE_FS_CODES.has(code);
|
|
338
|
-
}
|
|
339
322
|
function sleep(ms) {
|
|
340
323
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
341
324
|
}
|
|
@@ -344,30 +327,24 @@ async function getConfigFileMtimeMs(filePath) {
|
|
|
344
327
|
// run on the Windows-sensitive save path, where a transient EBUSY/EPERM/EAGAIN
|
|
345
328
|
// from an AV/indexer lock on a single fs.stat would abort the entire save.
|
|
346
329
|
// Mirror readConfigRecordForSave's bounded transient-FS retry (same code set,
|
|
347
|
-
// same backoff, 5 attempts). ENOENT still returns null immediately.
|
|
348
|
-
|
|
349
|
-
|
|
330
|
+
// same backoff, 5 attempts). ENOENT still returns null immediately. On
|
|
331
|
+
// exhaustion the last failure surfaces so the caller treats it as a real
|
|
332
|
+
// save error rather than a phantom missing file.
|
|
333
|
+
return withRetry(async () => {
|
|
350
334
|
try {
|
|
351
335
|
return (await fs.stat(filePath)).mtimeMs;
|
|
352
336
|
}
|
|
353
337
|
catch (error) {
|
|
354
|
-
|
|
355
|
-
if (code === "ENOENT") {
|
|
338
|
+
if (error?.code === "ENOENT") {
|
|
356
339
|
return null;
|
|
357
340
|
}
|
|
358
|
-
lastError = error;
|
|
359
|
-
if (typeof code === "string" &&
|
|
360
|
-
RETRYABLE_CONFIG_READ_CODES.has(code) &&
|
|
361
|
-
attempt < 4) {
|
|
362
|
-
await sleep(10 * 2 ** attempt);
|
|
363
|
-
continue;
|
|
364
|
-
}
|
|
365
341
|
throw error;
|
|
366
342
|
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
343
|
+
}, {
|
|
344
|
+
maxAttempts: 5,
|
|
345
|
+
backoffMs: (attempt) => 10 * 2 ** (attempt - 1),
|
|
346
|
+
retryableCodes: RETRYABLE_CONFIG_READ_CODES,
|
|
347
|
+
});
|
|
371
348
|
}
|
|
372
349
|
async function writeJsonFileAtomicWithRetry(filePath, payload, options) {
|
|
373
350
|
const tempPath = `${filePath}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2, 8)}.tmp`;
|
|
@@ -386,19 +363,12 @@ async function writeJsonFileAtomicWithRetry(filePath, payload, options) {
|
|
|
386
363
|
throw staleError;
|
|
387
364
|
}
|
|
388
365
|
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
catch (error) {
|
|
396
|
-
if (!isRetryableFsError(error) || attempt >= 4) {
|
|
397
|
-
throw error;
|
|
398
|
-
}
|
|
399
|
-
await sleep(10 * 2 ** attempt);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
366
|
+
await withRetry(() => fs.rename(tempPath, filePath), {
|
|
367
|
+
maxAttempts: 5,
|
|
368
|
+
backoffMs: (attempt) => 10 * 2 ** (attempt - 1),
|
|
369
|
+
retryableCodes: RETRYABLE_FS_CODES,
|
|
370
|
+
});
|
|
371
|
+
renamed = true;
|
|
402
372
|
}
|
|
403
373
|
finally {
|
|
404
374
|
if (!renamed) {
|
|
@@ -438,25 +408,17 @@ const CONFIG_LOCK_TTL_MS = 10_000;
|
|
|
438
408
|
const CONFIG_LOCK_WAIT_TIMEOUT_MS = 10_000;
|
|
439
409
|
const CONFIG_LOCK_POLL_MS = 50;
|
|
440
410
|
async function unlinkConfigLockWithRetry(lockPath) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
attempt < 4) {
|
|
453
|
-
await sleep(10 * 2 ** attempt);
|
|
454
|
-
continue;
|
|
455
|
-
}
|
|
456
|
-
// Best-effort release: a leftover lockfile is recovered as stale by the
|
|
457
|
-
// next acquirer via its expiry/mtime, so never fail the save over this.
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
411
|
+
try {
|
|
412
|
+
await withRetry(() => fs.unlink(lockPath), {
|
|
413
|
+
maxAttempts: 5,
|
|
414
|
+
backoffMs: (attempt) => 10 * 2 ** (attempt - 1),
|
|
415
|
+
retryableCodes: RETRYABLE_FS_CODES,
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
catch {
|
|
419
|
+
// ENOENT (already released) or best-effort release failure: a leftover
|
|
420
|
+
// lockfile is recovered as stale by the next acquirer via its
|
|
421
|
+
// expiry/mtime, so never fail the save over this.
|
|
460
422
|
}
|
|
461
423
|
}
|
|
462
424
|
// Owner-safe release: only unlink the lockfile if it still carries OUR owner
|
|
@@ -596,8 +558,8 @@ async function readConfigRecordForSave(configPath) {
|
|
|
596
558
|
if (!existsSync(configPath)) {
|
|
597
559
|
return { status: "missing" };
|
|
598
560
|
}
|
|
599
|
-
|
|
600
|
-
|
|
561
|
+
try {
|
|
562
|
+
return await withRetry(async () => {
|
|
601
563
|
const fileContent = await fs.readFile(configPath, "utf-8");
|
|
602
564
|
const normalizedFileContent = stripUtf8Bom(fileContent);
|
|
603
565
|
const parsed = JSON.parse(normalizedFileContent);
|
|
@@ -607,32 +569,27 @@ async function readConfigRecordForSave(configPath) {
|
|
|
607
569
|
return { status: "invalid", errorMessage };
|
|
608
570
|
}
|
|
609
571
|
return { status: "ok", record: parsed };
|
|
572
|
+
}, {
|
|
573
|
+
maxAttempts: 5,
|
|
574
|
+
backoffMs: (attempt) => 10 * 2 ** (attempt - 1),
|
|
575
|
+
retryableCodes: RETRYABLE_CONFIG_READ_CODES,
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
catch (error) {
|
|
579
|
+
const code = error?.code;
|
|
580
|
+
if (code === "ENOENT") {
|
|
581
|
+
return { status: "missing" };
|
|
610
582
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
return { status: "missing" };
|
|
615
|
-
}
|
|
616
|
-
if (typeof code === "string" &&
|
|
617
|
-
RETRYABLE_CONFIG_READ_CODES.has(code) &&
|
|
618
|
-
attempt < 4) {
|
|
619
|
-
await sleep(10 * 2 ** attempt);
|
|
620
|
-
continue;
|
|
621
|
-
}
|
|
622
|
-
const errorMessage = `Failed to read config from ${configPath}: ${error instanceof Error ? error.message : String(error)}`;
|
|
623
|
-
logConfigWarnOnce(errorMessage);
|
|
624
|
-
if (error instanceof SyntaxError) {
|
|
625
|
-
return { status: "invalid", errorMessage };
|
|
626
|
-
}
|
|
627
|
-
if (typeof code === "string") {
|
|
628
|
-
return { status: "unreadable", errorMessage };
|
|
629
|
-
}
|
|
583
|
+
const errorMessage = `Failed to read config from ${configPath}: ${error instanceof Error ? error.message : String(error)}`;
|
|
584
|
+
logConfigWarnOnce(errorMessage);
|
|
585
|
+
if (error instanceof SyntaxError) {
|
|
630
586
|
return { status: "invalid", errorMessage };
|
|
631
587
|
}
|
|
588
|
+
if (typeof code === "string") {
|
|
589
|
+
return { status: "unreadable", errorMessage };
|
|
590
|
+
}
|
|
591
|
+
return { status: "invalid", errorMessage };
|
|
632
592
|
}
|
|
633
|
-
const errorMessage = `Failed to read config from ${configPath}.`;
|
|
634
|
-
logConfigWarnOnce(errorMessage);
|
|
635
|
-
return { status: "unreadable", errorMessage };
|
|
636
593
|
}
|
|
637
594
|
function resolveStoredPluginConfigRecord() {
|
|
638
595
|
// config-01: mirror loadPluginConfig()'s precedence exactly. loadPluginConfig
|
|
@@ -1728,4 +1685,3 @@ export function getPluginConfigExplainReport() {
|
|
|
1728
1685
|
entries,
|
|
1729
1686
|
};
|
|
1730
1687
|
}
|
|
1731
|
-
//# sourceMappingURL=config.js.map
|
package/dist/lib/constants.js
CHANGED
package/dist/lib/env-parsing.js
CHANGED
package/dist/lib/errors.js
CHANGED
package/dist/lib/forecast.js
CHANGED
package/dist/lib/fs-retry.d.ts
CHANGED
|
@@ -3,5 +3,51 @@ export declare const FILE_RETRY_MAX_ATTEMPTS = 6;
|
|
|
3
3
|
export declare const FILE_RETRY_BASE_DELAY_MS = 25;
|
|
4
4
|
export declare const FILE_RETRY_JITTER_MS = 20;
|
|
5
5
|
export declare function shouldRetryFileOperation(error: unknown): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Options for {@link withRetry} / {@link withRetrySync}.
|
|
8
|
+
*
|
|
9
|
+
* The shape is deliberately wide enough to express every hand-rolled
|
|
10
|
+
* file-retry loop in the codebase without changing any call site's behavior:
|
|
11
|
+
* per-site attempt counts, exponential/linear backoff schedules, optional
|
|
12
|
+
* jitter, and per-site retryable code sets are all preserved exactly.
|
|
13
|
+
*/
|
|
14
|
+
export interface RetryOptions {
|
|
15
|
+
/** Total number of attempts (including the first one). Must be >= 1. */
|
|
16
|
+
maxAttempts: number;
|
|
17
|
+
/**
|
|
18
|
+
* Delay before the next attempt, either a fixed number of milliseconds or
|
|
19
|
+
* a function of the 1-based index of the attempt that just failed (so the
|
|
20
|
+
* delay after the first failure is `backoffMs(1)`). A computed delay <= 0
|
|
21
|
+
* retries immediately without scheduling a timer.
|
|
22
|
+
*/
|
|
23
|
+
backoffMs: number | ((attempt: number) => number);
|
|
24
|
+
/**
|
|
25
|
+
* Optional jitter: adds `Math.floor(Math.random() * jitterMs)` to each
|
|
26
|
+
* computed backoff delay.
|
|
27
|
+
*/
|
|
28
|
+
jitterMs?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Error codes considered transient. Defaults to {@link FILE_RETRY_CODES}.
|
|
31
|
+
* An error retries only when it carries a string `code` in this set;
|
|
32
|
+
* everything else is rethrown immediately.
|
|
33
|
+
*/
|
|
34
|
+
retryableCodes?: ReadonlySet<string> | readonly string[];
|
|
35
|
+
/** Invoked after each retryable failure, before the backoff delay. */
|
|
36
|
+
onRetry?: (error: unknown, attempt: number) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Run `operation`, retrying on transient filesystem error codes with a
|
|
40
|
+
* per-call backoff schedule. Non-retryable errors are rethrown immediately;
|
|
41
|
+
* once `maxAttempts` is exhausted the error from the final attempt is
|
|
42
|
+
* rethrown unchanged. No delay is scheduled after the final attempt.
|
|
43
|
+
*/
|
|
44
|
+
export declare function withRetry<T>(operation: () => Promise<T> | T, options: RetryOptions): Promise<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Synchronous variant of {@link withRetry} for callers that cannot await
|
|
47
|
+
* (e.g. the synchronous recovery storage paths). Delays use a bounded
|
|
48
|
+
* busy-wait, so keep per-site schedules short; a computed delay <= 0 retries
|
|
49
|
+
* immediately without spinning.
|
|
50
|
+
*/
|
|
51
|
+
export declare function withRetrySync<T>(operation: () => T, options: RetryOptions): T;
|
|
6
52
|
export declare function withFileOperationRetry<T>(operation: () => Promise<T>): Promise<T>;
|
|
7
53
|
//# sourceMappingURL=fs-retry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs-retry.d.ts","sourceRoot":"","sources":["../../lib/fs-retry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,aAM3B,CAAC;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAMvC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOhE;AAED,wBAAsB,sBAAsB,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"fs-retry.d.ts","sourceRoot":"","sources":["../../lib/fs-retry.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,aAM3B,CAAC;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAMvC,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAOhE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC5B,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,MAAM,EAAE,CAAC;IACzD,sEAAsE;IACtE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACpD;AAgCD;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAChC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAC/B,OAAO,EAAE,YAAY,GACnB,OAAO,CAAC,CAAC,CAAC,CAkBZ;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,GAAG,CAAC,CAqB7E;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EACvC,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACzB,OAAO,CAAC,CAAC,CAAC,CAOZ"}
|
package/dist/lib/fs-retry.js
CHANGED
|
@@ -17,19 +17,87 @@ export function shouldRetryFileOperation(error) {
|
|
|
17
17
|
typeof error.code === "string" &&
|
|
18
18
|
FILE_RETRY_CODES.has(error.code));
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
function getErrorCode(error) {
|
|
21
|
+
if (typeof error !== "object" || error === null)
|
|
22
|
+
return undefined;
|
|
23
|
+
const code = error.code;
|
|
24
|
+
return typeof code === "string" ? code : undefined;
|
|
25
|
+
}
|
|
26
|
+
function isRetryableError(error, retryableCodes) {
|
|
27
|
+
const code = getErrorCode(error);
|
|
28
|
+
if (code === undefined)
|
|
29
|
+
return false;
|
|
30
|
+
if (retryableCodes === undefined)
|
|
31
|
+
return FILE_RETRY_CODES.has(code);
|
|
32
|
+
return Array.isArray(retryableCodes)
|
|
33
|
+
? retryableCodes.includes(code)
|
|
34
|
+
: retryableCodes.has(code);
|
|
35
|
+
}
|
|
36
|
+
function computeDelayMs(options, attempt) {
|
|
37
|
+
const base = typeof options.backoffMs === "function"
|
|
38
|
+
? options.backoffMs(attempt)
|
|
39
|
+
: options.backoffMs;
|
|
40
|
+
const jitter = options.jitterMs !== undefined && options.jitterMs > 0
|
|
41
|
+
? Math.floor(Math.random() * options.jitterMs)
|
|
42
|
+
: 0;
|
|
43
|
+
return base + jitter;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Run `operation`, retrying on transient filesystem error codes with a
|
|
47
|
+
* per-call backoff schedule. Non-retryable errors are rethrown immediately;
|
|
48
|
+
* once `maxAttempts` is exhausted the error from the final attempt is
|
|
49
|
+
* rethrown unchanged. No delay is scheduled after the final attempt.
|
|
50
|
+
*/
|
|
51
|
+
export async function withRetry(operation, options) {
|
|
21
52
|
for (let attempt = 1;; attempt += 1) {
|
|
22
53
|
try {
|
|
23
54
|
return await operation();
|
|
24
55
|
}
|
|
25
56
|
catch (error) {
|
|
26
|
-
if (!
|
|
57
|
+
if (!isRetryableError(error, options.retryableCodes) ||
|
|
58
|
+
attempt >= options.maxAttempts) {
|
|
27
59
|
throw error;
|
|
28
60
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
61
|
+
options.onRetry?.(error, attempt);
|
|
62
|
+
const delayMs = computeDelayMs(options, attempt);
|
|
63
|
+
if (delayMs > 0) {
|
|
64
|
+
await sleep(delayMs);
|
|
65
|
+
}
|
|
32
66
|
}
|
|
33
67
|
}
|
|
34
68
|
}
|
|
35
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Synchronous variant of {@link withRetry} for callers that cannot await
|
|
71
|
+
* (e.g. the synchronous recovery storage paths). Delays use a bounded
|
|
72
|
+
* busy-wait, so keep per-site schedules short; a computed delay <= 0 retries
|
|
73
|
+
* immediately without spinning.
|
|
74
|
+
*/
|
|
75
|
+
export function withRetrySync(operation, options) {
|
|
76
|
+
for (let attempt = 1;; attempt += 1) {
|
|
77
|
+
try {
|
|
78
|
+
return operation();
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
if (!isRetryableError(error, options.retryableCodes) ||
|
|
82
|
+
attempt >= options.maxAttempts) {
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
options.onRetry?.(error, attempt);
|
|
86
|
+
const delayMs = computeDelayMs(options, attempt);
|
|
87
|
+
if (delayMs > 0) {
|
|
88
|
+
const waitUntil = Date.now() + delayMs;
|
|
89
|
+
while (Date.now() < waitUntil) {
|
|
90
|
+
// Busy-wait within the bounded per-attempt budget.
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export function withFileOperationRetry(operation) {
|
|
97
|
+
return withRetry(operation, {
|
|
98
|
+
maxAttempts: FILE_RETRY_MAX_ATTEMPTS,
|
|
99
|
+
backoffMs: (attempt) => FILE_RETRY_BASE_DELAY_MS * 2 ** (attempt - 1),
|
|
100
|
+
jitterMs: FILE_RETRY_JITTER_MS,
|
|
101
|
+
retryableCodes: FILE_RETRY_CODES,
|
|
102
|
+
});
|
|
103
|
+
}
|
package/dist/lib/health.js
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -90,4 +90,3 @@ export function generateIntegrationSnippet(kind, input = {}) {
|
|
|
90
90
|
export function generateIntegrationSnippets(kinds = ["opencode", "openclaw", "python", "curl", "env"], input = {}) {
|
|
91
91
|
return kinds.map((kind) => generateIntegrationSnippet(kind, input));
|
|
92
92
|
}
|
|
93
|
-
//# sourceMappingURL=integration-generators.js.map
|
package/dist/lib/local-bridge.js
CHANGED
package/dist/lib/logger.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ModelFamily } from "../request/helpers/model-map.js";
|
|
2
2
|
/**
|
|
3
3
|
* Clear the memory cache - exposed for testing
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
6
|
export declare function __clearCacheForTesting(): void;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Maps to different system prompts in the Codex CLI
|
|
10
|
-
*/
|
|
11
|
-
export type ModelFamily = PromptModelFamily;
|
|
12
|
-
/**
|
|
13
|
-
* All supported model families
|
|
14
|
-
* Used for per-family account rotation and rate limit tracking
|
|
15
|
-
*/
|
|
16
|
-
export declare const MODEL_FAMILIES: readonly ModelFamily[];
|
|
7
|
+
export { MODEL_FAMILIES } from "../request/helpers/model-map.js";
|
|
8
|
+
export type { ModelFamily } from "../request/helpers/model-map.js";
|
|
17
9
|
/**
|
|
18
10
|
* Determine the prompt family based on the effective model name.
|
|
19
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../lib/prompts/codex.ts"],"names":[],"mappings":"AAOA,OAAO,EAAkC,KAAK,
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../lib/prompts/codex.ts"],"names":[],"mappings":"AAOA,OAAO,EAAkC,KAAK,WAAW,EAAE,MAAM,iCAAiC,CAAC;AA2EnG;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAI7C;AAcD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAyBnE;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,MAAM,GAAG,WAAW,CAEnE;AA4ED;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACzC,eAAe,SAAgB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAkHjB;AA6GD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,GAAE,MAAM,EAAO,GAAG,IAAI,CAiBpE;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,ozGA+EV,CAAC"}
|
|
@@ -77,17 +77,10 @@ function setCacheEntry(key, value) {
|
|
|
77
77
|
}
|
|
78
78
|
memoryCache.set(key, value);
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
export const MODEL_FAMILIES = [
|
|
85
|
-
"gpt-5-codex",
|
|
86
|
-
"codex-max",
|
|
87
|
-
"codex",
|
|
88
|
-
"gpt-5.2",
|
|
89
|
-
"gpt-5.1",
|
|
90
|
-
];
|
|
80
|
+
// ModelFamily/MODEL_FAMILIES live in the leaf model-map module so low-level
|
|
81
|
+
// modules (schemas, storage types) can use them without importing this file.
|
|
82
|
+
// Re-exported here to preserve the historical import surface.
|
|
83
|
+
export { MODEL_FAMILIES } from "../request/helpers/model-map.js";
|
|
91
84
|
/**
|
|
92
85
|
* Prompt file mapping for each model family
|
|
93
86
|
* Based on codex-rs/core/src/model_family.rs logic
|
|
@@ -465,4 +458,3 @@ When hashline_read is available:
|
|
|
465
458
|
- Never call \`request_user_input\` unless collaboration mode is explicitly Plan mode.
|
|
466
459
|
</safety_rules>
|
|
467
460
|
</user_instructions>`;
|
|
468
|
-
//# sourceMappingURL=codex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quota-cache.d.ts","sourceRoot":"","sources":["../../lib/quota-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"quota-cache.d.ts","sourceRoot":"","sources":["../../lib/quota-cache.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACzC;AAsGD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,cAAc,CAAC,CA4B9D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA4DxE"}
|