codex-multi-auth 2.3.0-beta.1 → 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/README.md +4 -4
- 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 +1 -1
- package/dist/lib/codex-manager/account-pool-write.d.ts.map +1 -1
- package/dist/lib/codex-manager/account-pool-write.js +0 -1
- package/dist/lib/codex-manager/backend-category-entry.js +0 -1
- package/dist/lib/codex-manager/backend-category-helpers.js +0 -1
- package/dist/lib/codex-manager/backend-category-prompt.js +0 -1
- package/dist/lib/codex-manager/backend-settings-controller.js +0 -1
- package/dist/lib/codex-manager/backend-settings-entry.js +0 -1
- package/dist/lib/codex-manager/backend-settings-helpers.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.js +0 -1
- package/dist/lib/codex-manager/persist-selected-account.d.ts +24 -0
- package/dist/lib/codex-manager/persist-selected-account.d.ts.map +1 -0
- package/dist/lib/codex-manager/persist-selected-account.js +107 -0
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts +18 -0
- package/dist/lib/codex-manager/quota-cache-helpers.d.ts.map +1 -0
- package/dist/lib/codex-manager/quota-cache-helpers.js +112 -0
- package/dist/lib/codex-manager/rate-limit-markers.js +0 -1
- package/dist/lib/codex-manager/repair-commands.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 -2570
- package/dist/lib/config-schema.d.ts +32 -0
- package/dist/lib/config-schema.d.ts.map +1 -0
- package/dist/lib/config-schema.js +96 -0
- package/dist/lib/config.d.ts.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/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
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Repo-relative path of the committed, generated schema file. */
|
|
2
|
+
export declare const CONFIG_SCHEMA_RELATIVE_PATH = "config/schema/config.schema.json";
|
|
3
|
+
type JsonObject = Record<string, unknown>;
|
|
4
|
+
/**
|
|
5
|
+
* Build the full JSON schema document for `config/schema/config.schema.json`.
|
|
6
|
+
*
|
|
7
|
+
* Structure:
|
|
8
|
+
* - Root keeps the original template metadata (`$schema` draft 2020-12, `$id`,
|
|
9
|
+
* `title`) and the template root keys (`plugin`, `provider`, `model`) that
|
|
10
|
+
* the shipped `config/*.json` templates reference via `$schema`.
|
|
11
|
+
* - The complete runtime plugin configuration surface is generated from
|
|
12
|
+
* `PluginConfigSchema` via zod v4's native `z.toJSONSchema()` and embedded
|
|
13
|
+
* as `$defs.pluginConfig`, referenced by the optional root `pluginConfig`
|
|
14
|
+
* property (the shape persisted in unified `settings.json`).
|
|
15
|
+
*
|
|
16
|
+
* `io: "input"` matches runtime semantics: `loadPluginConfig` tolerates and
|
|
17
|
+
* strips unknown keys instead of rejecting them, so the generated definition
|
|
18
|
+
* must not emit `additionalProperties: false`.
|
|
19
|
+
*
|
|
20
|
+
* Key order is the zod shape definition order, which is stable across runs,
|
|
21
|
+
* so output is deterministic.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildConfigJsonSchema(): JsonObject;
|
|
24
|
+
/**
|
|
25
|
+
* Serialize the generated schema exactly as it is committed on disk:
|
|
26
|
+
* 2-space indent (matching the previous handwritten file) plus a trailing
|
|
27
|
+
* newline. `JSON.stringify` preserves insertion order, so the output is
|
|
28
|
+
* byte-for-byte deterministic.
|
|
29
|
+
*/
|
|
30
|
+
export declare function renderConfigJsonSchema(): string;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=config-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-schema.d.ts","sourceRoot":"","sources":["../../lib/config-schema.ts"],"names":[],"mappings":"AAmBA,kEAAkE;AAClE,eAAO,MAAM,2BAA2B,qCAAqC,CAAC;AAE9E,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,IAAI,UAAU,CAmDlD;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single source of truth for `config/schema/config.schema.json`.
|
|
3
|
+
*
|
|
4
|
+
* The JSON schema shipped under `config/schema/` is GENERATED from the zod
|
|
5
|
+
* `PluginConfigSchema` in `lib/schemas.ts` so it cannot drift from the real
|
|
6
|
+
* runtime config surface (audit roadmap §4.5.2).
|
|
7
|
+
*
|
|
8
|
+
* - Regenerate the committed file with `npm run generate:schema`
|
|
9
|
+
* (see `scripts/generate-config-schema.mjs`).
|
|
10
|
+
* - Drift is a test failure: `test/config-schema-generated.test.ts`
|
|
11
|
+
* regenerates the schema in-memory and compares it to the committed file.
|
|
12
|
+
*
|
|
13
|
+
* @internal Generator/tooling module: deliberately NOT re-exported from
|
|
14
|
+
* lib/index.ts. Its only consumers are scripts/generate-config-schema.mjs
|
|
15
|
+
* (via the compiled dist output) and the drift-guard test.
|
|
16
|
+
*/
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
import { PluginConfigSchema } from "./schemas.js";
|
|
19
|
+
/** Repo-relative path of the committed, generated schema file. */
|
|
20
|
+
export const CONFIG_SCHEMA_RELATIVE_PATH = "config/schema/config.schema.json";
|
|
21
|
+
/**
|
|
22
|
+
* Build the full JSON schema document for `config/schema/config.schema.json`.
|
|
23
|
+
*
|
|
24
|
+
* Structure:
|
|
25
|
+
* - Root keeps the original template metadata (`$schema` draft 2020-12, `$id`,
|
|
26
|
+
* `title`) and the template root keys (`plugin`, `provider`, `model`) that
|
|
27
|
+
* the shipped `config/*.json` templates reference via `$schema`.
|
|
28
|
+
* - The complete runtime plugin configuration surface is generated from
|
|
29
|
+
* `PluginConfigSchema` via zod v4's native `z.toJSONSchema()` and embedded
|
|
30
|
+
* as `$defs.pluginConfig`, referenced by the optional root `pluginConfig`
|
|
31
|
+
* property (the shape persisted in unified `settings.json`).
|
|
32
|
+
*
|
|
33
|
+
* `io: "input"` matches runtime semantics: `loadPluginConfig` tolerates and
|
|
34
|
+
* strips unknown keys instead of rejecting them, so the generated definition
|
|
35
|
+
* must not emit `additionalProperties: false`.
|
|
36
|
+
*
|
|
37
|
+
* Key order is the zod shape definition order, which is stable across runs,
|
|
38
|
+
* so output is deterministic.
|
|
39
|
+
*/
|
|
40
|
+
export function buildConfigJsonSchema() {
|
|
41
|
+
const pluginConfigRaw = z.toJSONSchema(PluginConfigSchema, {
|
|
42
|
+
target: "draft-2020-12",
|
|
43
|
+
io: "input",
|
|
44
|
+
});
|
|
45
|
+
// Guard before mutating: a zod behavior change returning a non-object
|
|
46
|
+
// here should fail loudly, not via a confusing delete/??= throw below.
|
|
47
|
+
if (!pluginConfigRaw ||
|
|
48
|
+
typeof pluginConfigRaw !== "object" ||
|
|
49
|
+
Array.isArray(pluginConfigRaw)) {
|
|
50
|
+
throw new Error("z.toJSONSchema(PluginConfigSchema) returned a non-object");
|
|
51
|
+
}
|
|
52
|
+
const pluginConfig = pluginConfigRaw;
|
|
53
|
+
// The embedded definition inherits the root document's dialect; a nested
|
|
54
|
+
// `$schema` keyword would be redundant noise.
|
|
55
|
+
delete pluginConfig.$schema;
|
|
56
|
+
// ??= so a future .describe() on PluginConfigSchema wins over this default.
|
|
57
|
+
pluginConfig.description ??=
|
|
58
|
+
"Runtime plugin configuration (the `pluginConfig` section of unified settings.json, also accepted flat in CODEX_MULTI_AUTH_CONFIG_PATH overrides). Generated from PluginConfigSchema in lib/schemas.ts — do not edit by hand; run `npm run generate:schema`.";
|
|
59
|
+
return {
|
|
60
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
61
|
+
$id: "https://codex-multi-auth.local/schema/config.schema.json",
|
|
62
|
+
title: "codex-multi-auth config template",
|
|
63
|
+
description: "GENERATED FILE — do not edit by hand. Regenerate with `npm run generate:schema` (source: lib/config-schema.ts + PluginConfigSchema in lib/schemas.ts).",
|
|
64
|
+
type: "object",
|
|
65
|
+
properties: {
|
|
66
|
+
plugin: {
|
|
67
|
+
type: "array",
|
|
68
|
+
items: { type: "string" },
|
|
69
|
+
},
|
|
70
|
+
provider: {
|
|
71
|
+
type: "object",
|
|
72
|
+
additionalProperties: true,
|
|
73
|
+
},
|
|
74
|
+
model: {
|
|
75
|
+
type: "string",
|
|
76
|
+
},
|
|
77
|
+
pluginConfig: {
|
|
78
|
+
$ref: "#/$defs/pluginConfig",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
required: ["plugin", "provider"],
|
|
82
|
+
additionalProperties: true,
|
|
83
|
+
$defs: {
|
|
84
|
+
pluginConfig,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Serialize the generated schema exactly as it is committed on disk:
|
|
90
|
+
* 2-space indent (matching the previous handwritten file) plus a trailing
|
|
91
|
+
* newline. `JSON.stringify` preserves insertion order, so the output is
|
|
92
|
+
* byte-for-byte deterministic.
|
|
93
|
+
*/
|
|
94
|
+
export function renderConfigJsonSchema() {
|
|
95
|
+
return `${JSON.stringify(buildConfigJsonSchema(), null, 2)}\n`;
|
|
96
|
+
}
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../lib/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../lib/config.ts"],"names":[],"mappings":"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"}
|
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