codex-multi-auth 2.8.1 → 2.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/README.md +3 -1
  3. package/dist/lib/accounts.d.ts +15 -0
  4. package/dist/lib/accounts.d.ts.map +1 -1
  5. package/dist/lib/accounts.js +126 -21
  6. package/dist/lib/codex-manager/account-pool-write.d.ts.map +1 -1
  7. package/dist/lib/codex-manager/account-pool-write.js +4 -0
  8. package/dist/lib/codex-manager/backend-settings-schema.js +1 -1
  9. package/dist/lib/codex-manager/commands/status.d.ts.map +1 -1
  10. package/dist/lib/codex-manager/commands/status.js +5 -1
  11. package/dist/lib/codex-manager/commands/uninstall.d.ts +1 -0
  12. package/dist/lib/codex-manager/commands/uninstall.d.ts.map +1 -1
  13. package/dist/lib/codex-manager/commands/uninstall.js +12 -1
  14. package/dist/lib/codex-manager/commands/why-selected.d.ts +1 -1
  15. package/dist/lib/codex-manager/commands/why-selected.d.ts.map +1 -1
  16. package/dist/lib/codex-manager/commands/why-selected.js +1 -1
  17. package/dist/lib/codex-manager/formatters/quota-formatters.d.ts.map +1 -1
  18. package/dist/lib/codex-manager/formatters/quota-formatters.js +32 -2
  19. package/dist/lib/codex-manager/health-check.d.ts.map +1 -1
  20. package/dist/lib/codex-manager/health-check.js +19 -3
  21. package/dist/lib/codex-manager/login-oauth.d.ts.map +1 -1
  22. package/dist/lib/codex-manager/login-oauth.js +13 -7
  23. package/dist/lib/codex-manager.d.ts +4 -0
  24. package/dist/lib/codex-manager.d.ts.map +1 -1
  25. package/dist/lib/codex-manager.js +50 -16
  26. package/dist/lib/config.d.ts +3 -1
  27. package/dist/lib/config.d.ts.map +1 -1
  28. package/dist/lib/config.js +3 -1
  29. package/dist/lib/forecast.d.ts.map +1 -1
  30. package/dist/lib/forecast.js +7 -1
  31. package/dist/lib/index.d.ts +1 -0
  32. package/dist/lib/index.d.ts.map +1 -1
  33. package/dist/lib/index.js +1 -0
  34. package/dist/lib/parallel-probe.d.ts.map +1 -1
  35. package/dist/lib/parallel-probe.js +3 -1
  36. package/dist/lib/policy/runtime-policy.d.ts +1 -0
  37. package/dist/lib/policy/runtime-policy.d.ts.map +1 -1
  38. package/dist/lib/policy/runtime-policy.js +7 -0
  39. package/dist/lib/preemptive-quota-scheduler.d.ts.map +1 -1
  40. package/dist/lib/preemptive-quota-scheduler.js +35 -15
  41. package/dist/lib/rotation.d.ts +4 -0
  42. package/dist/lib/rotation.d.ts.map +1 -1
  43. package/dist/lib/rotation.js +13 -6
  44. package/dist/lib/runtime/app-bind.d.ts +40 -0
  45. package/dist/lib/runtime/app-bind.d.ts.map +1 -1
  46. package/dist/lib/runtime/app-bind.js +550 -20
  47. package/dist/lib/runtime/rotation-account-selection.d.ts.map +1 -1
  48. package/dist/lib/runtime/rotation-account-selection.js +2 -0
  49. package/dist/lib/runtime/rotation-proxy-state.d.ts +2 -0
  50. package/dist/lib/runtime/rotation-proxy-state.d.ts.map +1 -1
  51. package/dist/lib/runtime/rotation-token-refresh.d.ts.map +1 -1
  52. package/dist/lib/runtime/rotation-token-refresh.js +3 -0
  53. package/dist/lib/runtime-constants.d.ts +2 -0
  54. package/dist/lib/runtime-constants.d.ts.map +1 -1
  55. package/dist/lib/runtime-constants.js +2 -0
  56. package/dist/lib/runtime-rotation-proxy.d.ts +8 -0
  57. package/dist/lib/runtime-rotation-proxy.d.ts.map +1 -1
  58. package/dist/lib/runtime-rotation-proxy.js +59 -5
  59. package/dist/lib/schemas.d.ts +15 -0
  60. package/dist/lib/schemas.d.ts.map +1 -1
  61. package/dist/lib/schemas.js +3 -0
  62. package/dist/lib/storage/flagged-storage.d.ts.map +1 -1
  63. package/dist/lib/storage/flagged-storage.js +15 -0
  64. package/dist/lib/storage/path-state.d.ts +1 -0
  65. package/dist/lib/storage/path-state.d.ts.map +1 -1
  66. package/dist/lib/storage/path-state.js +30 -3
  67. package/dist/lib/storage/public-types.d.ts +6 -0
  68. package/dist/lib/storage/public-types.d.ts.map +1 -1
  69. package/dist/lib/storage.d.ts.map +1 -1
  70. package/dist/lib/storage.js +17 -4
  71. package/package.json +198 -198
  72. package/scripts/codex-app-router.js +47 -3
  73. package/scripts/codex.js +165 -21
  74. package/scripts/install-codex-auth-utils.js +9 -2
  75. package/scripts/postinstall.js +2 -0
  76. package/scripts/preuninstall.js +11 -0
@@ -1 +1 @@
1
- {"version":3,"file":"rotation-account-selection.d.ts","sourceRoot":"","sources":["../../../lib/runtime/rotation-account-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACrC,cAAc,EAAE,cAAc,CAAC;IAC/B,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACrC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;CAC7C,GAAG,cAAc,GAAG,IAAI,CAsJxB"}
1
+ {"version":3,"file":"rotation-account-selection.d.ts","sourceRoot":"","sources":["../../../lib/runtime/rotation-account-selection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE;IACrC,cAAc,EAAE,cAAc,CAAC;IAC/B,oBAAoB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAClD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACrC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;CAC7C,GAAG,cAAc,GAAG,IAAI,CAwJxB"}
@@ -101,6 +101,8 @@ export function chooseAccount(params) {
101
101
  ...(policy?.scoreBoostByAccount ?? {}),
102
102
  ...(stickyBoostByAccount ?? {}),
103
103
  },
104
+ blockedAccountIndexes: policy?.blockedAccountIndexes,
105
+ blockedReasonByAccount: policy?.blockedAccountReasons,
104
106
  // accounts-05: carry the PID-offset distribution into the default-on proxy
105
107
  // path too (index.ts already does). Without it, parallel proxy processes can
106
108
  // stampede the same account instead of spreading across the pool.
@@ -1,4 +1,5 @@
1
1
  import { AccountManager } from "../accounts.js";
2
+ import type { PreemptiveQuotaScheduler } from "../preemptive-quota-scheduler.js";
2
3
  import type { RuntimeRotationProxyStatus } from "./rotation-server-types.js";
3
4
  import type { SessionAffinityStore } from "../session-affinity.js";
4
5
  /**
@@ -27,6 +28,7 @@ export interface RotationProxyStateInit {
27
28
  maxRuntimeAccountAttempts: number;
28
29
  maxRequestBodyBytes: number;
29
30
  quotaRemainingPercentThreshold: number;
31
+ preemptiveQuotaScheduler: PreemptiveQuotaScheduler;
30
32
  sessionAffinityStore: SessionAffinityStore | null;
31
33
  lastObservedAffinityGeneration: number;
32
34
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"rotation-proxy-state.d.ts","sourceRoot":"","sources":["../../../lib/runtime/rotation-proxy-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKhD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACtC,oBAAoB,EAAE,cAAc,CAAC;IACrC,gBAAgB,EAAE,SAAS,GAAG,QAAQ,CAAC;IACvC,kBAAkB,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC5C,SAAS,EAAE,OAAO,KAAK,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC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IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,GAC1D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAC1D,CAgEA"}
1
+ {"version":3,"file":"rotation-token-refresh.d.ts","sourceRoot":"","sources":["../../../lib/runtime/rotation-token-refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAQvD,gBAAgB;AAChB,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAMvD,gBAAgB;AAChB,wBAAgB,0BAA0B,CACzC,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,MAAM,GAChB,IAAI,CAUN;AA6CD,gBAAgB;AAChB,wBAAsB,sBAAsB,CAAC,MAAM,EAAE;IACpD,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2BAA2B,EAAE,MAAM,CAAC;CACpC,GAAG,OAAO,CACR;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,GAC1D;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAC1D,CAmEA"}
@@ -61,6 +61,9 @@ export async function ensureFreshAccessToken(params) {
61
61
  // the long cooldown and signal to the caller to stop rotating rather than
62
62
  // presenting other accounts' tokens from the same IP.
63
63
  const invalidated = isTokenInvalidationError(refreshResult.message ?? "");
64
+ if (invalidated) {
65
+ accountManager.markAuthInvalidated(account);
66
+ }
64
67
  applyMonotonicAuthCooldown(accountManager, account, invalidated ? tokenInvalidationCooldownMs : DEFAULT_AUTH_FAILURE_COOLDOWN_MS);
65
68
  accountManager.saveToDiskDebounced();
66
69
  return { ok: false, retryable: isTokenRefreshRetryable(refreshResult), invalidated };
@@ -1,3 +1,5 @@
1
1
  export declare const RUNTIME_ROTATION_PROXY_PROVIDER_ID: "codex-multi-auth-runtime-proxy";
2
2
  export declare const APP_RUNTIME_HELPER_STATUS_FILE: "runtime-rotation-app-helper.json";
3
+ /** Immutable launcher metadata used to verify ownership before stopping a helper. */
4
+ export declare const APP_RUNTIME_HELPER_OWNER_FILE: "runtime-rotation-app-helper-owner.json";
3
5
  //# sourceMappingURL=runtime-constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-constants.d.ts","sourceRoot":"","sources":["../../lib/runtime-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kCAAkC,EAC9C,gCAAyC,CAAC;AAE3C,eAAO,MAAM,8BAA8B,EAC1C,kCAA2C,CAAC"}
1
+ {"version":3,"file":"runtime-constants.d.ts","sourceRoot":"","sources":["../../lib/runtime-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kCAAkC,EAC9C,gCAAyC,CAAC;AAE3C,eAAO,MAAM,8BAA8B,EAC1C,kCAA2C,CAAC;AAE7C,qFAAqF;AACrF,eAAO,MAAM,6BAA6B,EACzC,wCAAiD,CAAC"}
@@ -1,2 +1,4 @@
1
1
  export const RUNTIME_ROTATION_PROXY_PROVIDER_ID = "codex-multi-auth-runtime-proxy";
2
2
  export const APP_RUNTIME_HELPER_STATUS_FILE = "runtime-rotation-app-helper.json";
3
+ /** Immutable launcher metadata used to verify ownership before stopping a helper. */
4
+ export const APP_RUNTIME_HELPER_OWNER_FILE = "runtime-rotation-app-helper-owner.json";
@@ -1,3 +1,5 @@
1
+ import { type ManagedAccount } from "./accounts.js";
2
+ import { type ModelFamily } from "./prompts/codex.js";
1
3
  import type { RuntimeRotationProxyOptions, RuntimeRotationProxyServer } from "./runtime/rotation-server-types.js";
2
4
  export type { RuntimeRotationProxyOptions, RuntimeRotationProxyServer, RuntimeRotationProxyStatus, } from "./runtime/rotation-server-types.js";
3
5
  export { buildPinnedUnavailableErrorBody, buildTokenInvalidationBody, } from "./request/rate-limit-decision.js";
@@ -5,6 +7,12 @@ export type { PinnedUnavailableErrorBody } from "./request/rate-limit-decision.j
5
7
  export { chooseAccount } from "./runtime/rotation-account-selection.js";
6
8
  export { maybeInvalidateAffinityFromDisk, readPinnedAccountIndexFromDisk, readStorageMetaFromDisk, resetPinCacheForTesting, } from "./runtime/rotation-storage-meta.js";
7
9
  export type { StorageMeta } from "./runtime/rotation-storage-meta.js";
10
+ /** @internal Stable identity key for in-memory quota snapshots across reloads. */
11
+ export declare function buildQuotaScheduleKey(account: Pick<ManagedAccount, "accountId" | "email" | "refreshToken"> & {
12
+ /** Stable per-record discriminator retained across token/account-id updates. */
13
+ addedAt?: number;
14
+ recordId?: string;
15
+ }, family: ModelFamily, model?: string | null): string;
8
16
  /**
9
17
  * Coerce a forced-account pin from an option (number) or the launcher's env
10
18
  * string into a normalized 0-based index, or null when absent/invalid. Invalid
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-rotation-proxy.d.ts","sourceRoot":"","sources":["../../lib/runtime-rotation-proxy.ts"],"names":[],"mappings":"AAwEA,OAAO,KAAK,EAKX,2BAA2B,EAC3B,0BAA0B,EAE1B,MAAM,oCAAoC,CAAC;AAe5C,YAAY,EACX,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,+BAA+B,EAC/B,0BAA0B,GAC1B,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,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EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB,EACD,MAAM,EAAE,WAAW,EACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GACnB,MAAM,CAmBR;AA8bD;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAC1C,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GACvC,MAAM,GAAG,IAAI,CAUf;AAED,wBAAsB,yBAAyB,CAC9C,OAAO,EAAE,2BAA2B,GAClC,OAAO,CAAC,0BAA0B,CAAC,CAwKrC"}
@@ -1,17 +1,19 @@
1
- import { randomUUID, timingSafeEqual } from "node:crypto";
1
+ import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
2
2
  import { createServer } from "node:http";
3
3
  import { AccountManager, extractAccountId, } from "./accounts.js";
4
4
  import { withRoutingMutex } from "./routing-mutex.js";
5
- import { getFetchTimeoutMs, getNetworkErrorCooldownMs, getRetryAllAccountsMaxRetries, getServerErrorCooldownMs, getSessionAffinity, getSessionAffinityMaxEntries, getSessionAffinityTtlMs, getStreamStallTimeoutMs, getMinRotationIntervalMs, getTokenInvalidationCooldownMs, getTokenRefreshSkewMs, getPidOffsetEnabled, getRoutingMutexMode, getSchedulingStrategy, loadPluginConfig, } from "./config.js";
5
+ import { getFetchTimeoutMs, getNetworkErrorCooldownMs, getRetryAllAccountsMaxRetries, getServerErrorCooldownMs, getSessionAffinity, getSessionAffinityMaxEntries, getSessionAffinityTtlMs, getStreamStallTimeoutMs, getMinRotationIntervalMs, getTokenInvalidationCooldownMs, getTokenRefreshSkewMs, getPidOffsetEnabled, getPreemptiveQuotaEnabled, getPreemptiveQuotaMaxDeferralMs, getPreemptiveQuotaRemainingPercent5h, getPreemptiveQuotaRemainingPercent7d, getRoutingMutexMode, getSchedulingStrategy, loadPluginConfig, } from "./config.js";
6
6
  import { CODEX_BASE_URL, HTTP_STATUS, OPENAI_HEADERS, OPENAI_HEADER_VALUES, URL_PATHS, } from "./constants.js";
7
7
  import { getModelFamily } from "./prompts/codex.js";
8
8
  import { CURRENT_CODEX_MODEL } from "./request/helpers/model-map.js";
9
9
  import { mutateRuntimeObservabilitySnapshot, recordRuntimeAccountRecovery, recordRuntimePoolExhaustion, } from "./runtime/runtime-observability.js";
10
10
  import { createRuntimeUsageRecorder, evaluateRuntimePolicy, loadRuntimePolicyState, } from "./policy/runtime-policy.js";
11
11
  import { isWorkspaceDisabledError } from "./request/fetch-helpers.js";
12
+ import { PreemptiveQuotaScheduler, readQuotaSchedulerSnapshot, } from "./preemptive-quota-scheduler.js";
12
13
  import { createLogger, maskString, runWithCorrelationId } from "./logger.js";
13
14
  import { CodexValidationError } from "./errors.js";
14
- import { buildPinnedUnavailableErrorBody, buildTokenInvalidationBody, extractErrorCodeFromBody, getQuotaNearExhaustionWaitMs, isTokenInvalidationError, normalizeExhaustionStatus, parseRetryAfterBodyMs, parseRetryAfterHeaderMs, } from "./request/rate-limit-decision.js";
15
+ import { normalizeEmailKey } from "./storage/identity.js";
16
+ import { buildPinnedUnavailableErrorBody, buildTokenInvalidationBody, extractErrorCodeFromBody, isTokenInvalidationError, normalizeExhaustionStatus, parseRetryAfterBodyMs, parseRetryAfterHeaderMs, } from "./request/rate-limit-decision.js";
15
17
  import { forwardStreamingResponse, HOP_BY_HOP_HEADERS, readErrorBody, responseHeadersForClient, withTimeout, } from "./request/stream-failover-runtime.js";
16
18
  import { chooseAccount } from "./runtime/rotation-account-selection.js";
17
19
  import { createRotationProxyState, recoverStaleRuntimeState, } from "./runtime/rotation-proxy-state.js";
@@ -61,6 +63,26 @@ function toUrlHost(host) {
61
63
  // level-gated and carry the per-request correlation id set in handleRequest.
62
64
  const proxyLog = createLogger("runtime-proxy");
63
65
  const DEFAULT_QUOTA_REMAINING_THRESHOLD = 10;
66
+ /** @internal Stable identity key for in-memory quota snapshots across reloads. */
67
+ export function buildQuotaScheduleKey(account, family, model) {
68
+ const emailKey = normalizeEmailKey(account.email);
69
+ const accountId = account.accountId?.trim();
70
+ const refreshToken = account.refreshToken?.trim() ?? "";
71
+ const recordId = account.recordId?.trim();
72
+ const recordDiscriminator = typeof account.addedAt === "number" &&
73
+ Number.isFinite(account.addedAt) &&
74
+ account.addedAt > 0
75
+ ? `:added:${Math.floor(account.addedAt)}`
76
+ : "";
77
+ const accountIdentity = recordId
78
+ ? `record:${recordId}`
79
+ : emailKey
80
+ ? `email:${emailKey}${recordDiscriminator}`
81
+ : accountId
82
+ ? `id:${accountId}${recordDiscriminator}`
83
+ : `refresh:${createHash("sha256").update(refreshToken).digest("hex")}${recordDiscriminator}`;
84
+ return `account:${accountIdentity}:${model ?? family}`;
85
+ }
64
86
  const DEFAULT_MAX_RUNTIME_ACCOUNT_ATTEMPTS = 4;
65
87
  const MAX_REQUEST_BODY_BYTES = 64 * 1024 * 1024;
66
88
  const MAX_THREAD_GOAL_FALLBACKS = 512;
@@ -499,6 +521,14 @@ export async function startRuntimeRotationProxy(options) {
499
521
  : DEFAULT_MAX_RUNTIME_ACCOUNT_ATTEMPTS;
500
522
  const maxRequestBodyBytes = options.maxRequestBodyBytes ?? MAX_REQUEST_BODY_BYTES;
501
523
  const quotaRemainingPercentThreshold = options.quotaRemainingPercentThreshold ?? DEFAULT_QUOTA_REMAINING_THRESHOLD;
524
+ const preemptiveQuotaScheduler = new PreemptiveQuotaScheduler({
525
+ enabled: getPreemptiveQuotaEnabled(pluginConfig),
526
+ remainingPercentThresholdPrimary: options.quotaRemainingPercentThreshold ??
527
+ getPreemptiveQuotaRemainingPercent5h(pluginConfig),
528
+ remainingPercentThresholdSecondary: options.quotaRemainingPercentThreshold ??
529
+ getPreemptiveQuotaRemainingPercent7d(pluginConfig),
530
+ maxDeferralMs: getPreemptiveQuotaMaxDeferralMs(pluginConfig),
531
+ });
502
532
  const sessionAffinityStore = getSessionAffinity(pluginConfig)
503
533
  ? new SessionAffinityStore({
504
534
  ttlMs: getSessionAffinityTtlMs(pluginConfig),
@@ -528,6 +558,7 @@ export async function startRuntimeRotationProxy(options) {
528
558
  maxRuntimeAccountAttempts,
529
559
  maxRequestBodyBytes,
530
560
  quotaRemainingPercentThreshold,
561
+ preemptiveQuotaScheduler,
531
562
  sessionAffinityStore,
532
563
  lastObservedAffinityGeneration,
533
564
  forcedAccountIndex,
@@ -799,6 +830,17 @@ async function handleRequestInner(state, req, res, traceId) {
799
830
  break;
800
831
  }
801
832
  attemptedIndexes.add(selected.index);
833
+ const quotaScheduleKey = buildQuotaScheduleKey(selected, context.family, context.model);
834
+ const preemptiveDeferral = state.preemptiveQuotaScheduler.getDeferral(quotaScheduleKey, state.now());
835
+ if (preemptiveDeferral.defer && preemptiveDeferral.waitMs > 0) {
836
+ accountSkipReasons.set(selected.index, preemptiveDeferral.reason ?? "quota-near-exhaustion");
837
+ exhaustionReason = "rate-limit";
838
+ accountManager.markRateLimitedWithReason(selected, preemptiveDeferral.waitMs, context.family, "quota", context.model);
839
+ accountManager.recordRateLimit(selected, context.family, context.model);
840
+ accountManager.saveToDiskDebounced();
841
+ state.status.rotations += 1;
842
+ continue;
843
+ }
802
844
  if (!accountManager.consumeToken(selected, context.family, context.model)) {
803
845
  accountSkipReasons.set(selected.index, "token-exhausted");
804
846
  exhaustionReason = "rate-limit";
@@ -889,11 +931,16 @@ async function handleRequestInner(state, req, res, traceId) {
889
931
  state.status.rotations += 1;
890
932
  continue;
891
933
  }
934
+ const quotaSnapshot = readQuotaSchedulerSnapshot(upstream.headers, upstream.status, state.now());
935
+ if (quotaSnapshot) {
936
+ state.preemptiveQuotaScheduler.update(quotaScheduleKey, quotaSnapshot);
937
+ }
892
938
  if (upstream.status === HTTP_STATUS.TOO_MANY_REQUESTS) {
893
939
  const bodyText = await readErrorBody(upstream, state.streamStallTimeoutMs);
894
940
  const retryAfterMs = parseRetryAfterHeaderMs(upstream.headers, state.now()) ??
895
941
  parseRetryAfterBodyMs(bodyText, state.now()) ??
896
942
  60_000;
943
+ state.preemptiveQuotaScheduler.markRateLimited(quotaScheduleKey, retryAfterMs, state.now());
897
944
  // A 429 is the upstream quota signal for the attempted account, so
898
945
  // keep the consumed runtime token drained.
899
946
  accountManager.recordRateLimit(refreshed.account, context.family, context.model);
@@ -999,9 +1046,13 @@ async function handleRequestInner(state, req, res, traceId) {
999
1046
  // account's token from the same IP triggers OpenAI's anti-abuse
1000
1047
  // detection and invalidates them in sequence. Return the 401 directly
1001
1048
  // rather than rotating so the client can prompt for re-login.
1049
+ accountManager.markAuthInvalidated(refreshed.account, extractErrorCodeFromBody(bodyText) ?? "token_invalidated");
1002
1050
  applyMonotonicAuthCooldown(accountManager, refreshed.account, state.tokenInvalidationCooldownMs);
1003
1051
  state.sessionAffinityStore?.forgetSession(context.sessionKey);
1004
- accountManager.saveToDiskDebounced();
1052
+ // The invalidation marker must be durable before returning the 401.
1053
+ // A delayed save would allow a proxy restart to reload and route the
1054
+ // revoked account again.
1055
+ await accountManager.saveToDisk();
1005
1056
  // Emit the same machine-readable shape as the refresh-failure path
1006
1057
  // (code: "token_invalidated") instead of forwarding the raw upstream
1007
1058
  // body, so the client contract is consistent across both vectors.
@@ -1067,7 +1118,10 @@ async function handleRequestInner(state, req, res, traceId) {
1067
1118
  // the forecast keeps reporting this working account as unavailable.
1068
1119
  // No-op when no reason is recorded, so the hot path stays write-free.
1069
1120
  recordRuntimeAccountRecovery(refreshed.account.index);
1070
- const nearExhaustionWaitMs = getQuotaNearExhaustionWaitMs(upstream.headers, state.quotaRemainingPercentThreshold, state.now());
1121
+ const quotaDeferral = state.preemptiveQuotaScheduler.getDeferral(quotaScheduleKey, state.now());
1122
+ const nearExhaustionWaitMs = quotaDeferral.defer
1123
+ ? quotaDeferral.waitMs
1124
+ : 0;
1071
1125
  if (nearExhaustionWaitMs > 0) {
1072
1126
  accountManager.markRateLimitedWithReason(refreshed.account, nearExhaustionWaitMs, context.family, "quota", context.model);
1073
1127
  state.sessionAffinityStore?.forgetSession(context.sessionKey);
@@ -107,6 +107,7 @@ export type PersistedSwitchReason = z.infer<typeof PersistedSwitchReasonSchema>;
107
107
  * Account metadata V3 - current storage format.
108
108
  */
109
109
  export declare const AccountMetadataV3Schema: z.ZodObject<{
110
+ recordId: z.ZodOptional<z.ZodString>;
110
111
  accountId: z.ZodOptional<z.ZodString>;
111
112
  accountIdSource: z.ZodOptional<z.ZodEnum<{
112
113
  token: "token";
@@ -138,6 +139,8 @@ export declare const AccountMetadataV3Schema: z.ZodObject<{
138
139
  "server-error": "server-error";
139
140
  "rate-limit": "rate-limit";
140
141
  }>>;
142
+ authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
143
+ authInvalidationErrorCode: z.ZodOptional<z.ZodString>;
141
144
  workspaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
142
145
  id: z.ZodString;
143
146
  name: z.ZodOptional<z.ZodString>;
@@ -153,6 +156,7 @@ export declare const AccountMetadataV3Schema: z.ZodObject<{
153
156
  export declare const AccountStorageV3Schema: z.ZodObject<{
154
157
  version: z.ZodLiteral<3>;
155
158
  accounts: z.ZodArray<z.ZodObject<{
159
+ recordId: z.ZodOptional<z.ZodString>;
156
160
  accountId: z.ZodOptional<z.ZodString>;
157
161
  accountIdSource: z.ZodOptional<z.ZodEnum<{
158
162
  token: "token";
@@ -184,6 +188,8 @@ export declare const AccountStorageV3Schema: z.ZodObject<{
184
188
  "server-error": "server-error";
185
189
  "rate-limit": "rate-limit";
186
190
  }>>;
191
+ authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
192
+ authInvalidationErrorCode: z.ZodOptional<z.ZodString>;
187
193
  workspaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
188
194
  id: z.ZodString;
189
195
  name: z.ZodOptional<z.ZodString>;
@@ -287,6 +293,7 @@ export declare const AnyAccountStorageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
287
293
  }, z.core.$strip>, z.ZodObject<{
288
294
  version: z.ZodLiteral<3>;
289
295
  accounts: z.ZodArray<z.ZodObject<{
296
+ recordId: z.ZodOptional<z.ZodString>;
290
297
  accountId: z.ZodOptional<z.ZodString>;
291
298
  accountIdSource: z.ZodOptional<z.ZodEnum<{
292
299
  token: "token";
@@ -318,6 +325,8 @@ export declare const AnyAccountStorageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
318
325
  "server-error": "server-error";
319
326
  "rate-limit": "rate-limit";
320
327
  }>>;
328
+ authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
329
+ authInvalidationErrorCode: z.ZodOptional<z.ZodString>;
321
330
  workspaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
322
331
  id: z.ZodString;
323
332
  name: z.ZodOptional<z.ZodString>;
@@ -345,6 +354,7 @@ export type AnyAccountStorageFromSchema = z.infer<typeof AnyAccountStorageSchema
345
354
  * Uses `passthrough` so V3-compatible extra fields (workspaces, etc.) survive.
346
355
  */
347
356
  export declare const FlaggedAccountMetadataV1Schema: z.ZodObject<{
357
+ recordId: z.ZodOptional<z.ZodString>;
348
358
  accountId: z.ZodOptional<z.ZodString>;
349
359
  accountIdSource: z.ZodOptional<z.ZodEnum<{
350
360
  token: "token";
@@ -376,6 +386,8 @@ export declare const FlaggedAccountMetadataV1Schema: z.ZodObject<{
376
386
  "server-error": "server-error";
377
387
  "rate-limit": "rate-limit";
378
388
  }>>;
389
+ authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
390
+ authInvalidationErrorCode: z.ZodOptional<z.ZodString>;
379
391
  workspaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
380
392
  id: z.ZodString;
381
393
  name: z.ZodOptional<z.ZodString>;
@@ -394,6 +406,7 @@ export declare const FlaggedAccountMetadataV1Schema: z.ZodObject<{
394
406
  export declare const FlaggedAccountStorageV1Schema: z.ZodObject<{
395
407
  version: z.ZodLiteral<1>;
396
408
  accounts: z.ZodArray<z.ZodObject<{
409
+ recordId: z.ZodOptional<z.ZodString>;
397
410
  accountId: z.ZodOptional<z.ZodString>;
398
411
  accountIdSource: z.ZodOptional<z.ZodEnum<{
399
412
  token: "token";
@@ -425,6 +438,8 @@ export declare const FlaggedAccountStorageV1Schema: z.ZodObject<{
425
438
  "server-error": "server-error";
426
439
  "rate-limit": "rate-limit";
427
440
  }>>;
441
+ authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
442
+ authInvalidationErrorCode: z.ZodOptional<z.ZodString>;
428
443
  workspaces: z.ZodOptional<z.ZodArray<z.ZodObject<{
429
444
  id: z.ZodString;
430
445
  name: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../lib/schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyD7B,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAMxE;;GAEG;AACH,QAAA,MAAM,qBAAqB;;;;;EAKzB,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAwB9E;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;;;;;EAKtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAwBhF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBlC,CAAC;AAkBH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOjC,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;A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BAAwB,CAC/B,CAAC;AAMF;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,IAAI,EAAE,OAAO,GACX,sBAAsB,GAAG,IAAI,CAM/B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,OAAO,GACX,2BAA2B,GAAG,IAAI,CAMpC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,OAAO,GACX,0BAA0B,GAAG,IAAI,CAMnC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,OAAO,GACX,qBAAqB,GAAG,IAAI,CAM9B;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAC1C,IAAI,EAAE,OAAO,GACX,4BAA4B,GAAG,IAAI,CAMrC;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAC/C,IAAI,EAAE,OAAO,GACX,iCAAiC,GAAG,IAAI,CAM1C;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC5C,IAAI,EAAE,OAAO,GACX,8BAA8B,GAAG,IAAI,CAMvC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC9B,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,SAAkB,GACvB,CAAC,GAAG,IAAI,CA8BV;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,CAAC,CAAC,OAAO,EACjB,IAAI,EAAE,OAAO,GACX,MAAM,EAAE,CASV"}
@@ -143,6 +143,7 @@ const WorkspaceSchema = z.object({
143
143
  * Account metadata V3 - current storage format.
144
144
  */
145
145
  export const AccountMetadataV3Schema = z.object({
146
+ recordId: z.string().min(1).optional(),
146
147
  accountId: z.string().optional(),
147
148
  accountIdSource: AccountIdSourceSchema.optional(),
148
149
  accountLabel: z.string().optional(),
@@ -157,6 +158,8 @@ export const AccountMetadataV3Schema = z.object({
157
158
  rateLimitResetTimes: RateLimitStateV3Schema.optional(),
158
159
  coolingDownUntil: z.number().optional(),
159
160
  cooldownReason: CooldownReasonSchema.optional(),
161
+ authInvalidatedAt: z.number().finite().positive().optional(),
162
+ authInvalidationErrorCode: z.string().min(1).optional(),
160
163
  // Multi-workspace support (#491): without these here, the strict z.object
161
164
  // strips workspace tracking on every load, so login-captured workspaces
162
165
  // silently vanish after one read/write round-trip.
@@ -1 +1 @@
1
- {"version":3,"file":"flagged-storage.d.ts","sourceRoot":"","sources":["../../../lib/storage/flagged-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,uBAAuB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,OAAO,EACb,IAAI,EAAE;IACL,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/D,GAAG,EAAE,MAAM,MAAM,CAAC;CAClB,GACC,uBAAuB,CAuIzB"}
1
+ {"version":3,"file":"flagged-storage.d.ts","sourceRoot":"","sources":["../../../lib/storage/flagged-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,uBAAuB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,uBAAuB,CACtC,IAAI,EAAE,OAAO,EACb,IAAI,EAAE;IACL,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/D,GAAG,EAAE,MAAM,MAAM,CAAC;CAClB,GACC,uBAAuB,CAyJzB"}
@@ -51,7 +51,20 @@ export function normalizeFlaggedStorage(data, deps) {
51
51
  const cooldownReason = isCooldownReason(rawAccount.cooldownReason)
52
52
  ? rawAccount.cooldownReason
53
53
  : undefined;
54
+ const authInvalidatedAt = typeof rawAccount.authInvalidatedAt === "number" &&
55
+ Number.isFinite(rawAccount.authInvalidatedAt) &&
56
+ rawAccount.authInvalidatedAt > 0
57
+ ? rawAccount.authInvalidatedAt
58
+ : undefined;
59
+ const authInvalidationErrorCode = authInvalidatedAt !== undefined &&
60
+ typeof rawAccount.authInvalidationErrorCode === "string" &&
61
+ rawAccount.authInvalidationErrorCode.trim().length > 0
62
+ ? rawAccount.authInvalidationErrorCode.trim()
63
+ : undefined;
54
64
  const normalized = {
65
+ recordId: typeof rawAccount.recordId === "string" && rawAccount.recordId.trim()
66
+ ? rawAccount.recordId.trim()
67
+ : undefined,
55
68
  refreshToken,
56
69
  addedAt: typeof rawAccount.addedAt === "number" ? rawAccount.addedAt : flaggedAt,
57
70
  lastUsed: typeof rawAccount.lastUsed === "number"
@@ -80,6 +93,8 @@ export function normalizeFlaggedStorage(data, deps) {
80
93
  ? rawAccount.coolingDownUntil
81
94
  : undefined,
82
95
  cooldownReason,
96
+ authInvalidatedAt,
97
+ authInvalidationErrorCode,
83
98
  workspaces: Array.isArray(rawAccount.workspaces)
84
99
  ? rawAccount.workspaces
85
100
  : undefined,
@@ -6,5 +6,6 @@ export type StoragePathState = {
6
6
  };
7
7
  export declare function getStoragePathState(): StoragePathState;
8
8
  export declare function setStoragePathState(state: StoragePathState): void;
9
+ export declare function setStoragePathDirectState(state: StoragePathState): void;
9
10
  export declare function runWithStoragePathState<T>(state: StoragePathState, fn: () => T | Promise<T>): Promise<T>;
10
11
  //# sourceMappingURL=path-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"path-state.d.ts","sourceRoot":"","sources":["../../../lib/storage/path-state.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG;IAC9B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,+BAA+B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,gCAAgC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAWF,wBAAgB,mBAAmB,IAAI,gBAAgB,CAMtD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAGjE;AAED,wBAAsB,uBAAuB,CAAC,CAAC,EAC9C,KAAK,EAAE,gBAAgB,EACvB,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,CAAC,CAAC,CAEZ"}
1
+ {"version":3,"file":"path-state.d.ts","sourceRoot":"","sources":["../../../lib/storage/path-state.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG;IAC9B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,+BAA+B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,gCAAgC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAwBF,wBAAgB,mBAAmB,IAAI,gBAAgB,CAatD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAOjE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAQvE;AAED,wBAAsB,uBAAuB,CAAC,CAAC,EAC9C,KAAK,EAAE,gBAAgB,EACvB,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,CAAC,CAAC,CAKZ"}
@@ -1,5 +1,12 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
2
  const storagePathStateContext = new AsyncLocalStorage();
3
+ // `setStoragePathDirect` is an explicit override used by callers that need a
4
+ // path to win over an async context created before the override. Keep its
5
+ // generation separate so a stale context cannot replace the direct path when
6
+ // control returns to a previously-created async resource. Scoped contexts
7
+ // created after the override still win while they are active.
8
+ let directStorageStateOverride;
9
+ let directStorageGeneration = 0;
3
10
  let currentStorageState = {
4
11
  currentStoragePath: null,
5
12
  currentLegacyProjectStoragePath: null,
@@ -7,16 +14,36 @@ let currentStorageState = {
7
14
  currentProjectRoot: null,
8
15
  };
9
16
  export function getStoragePathState() {
17
+ const context = storagePathStateContext.getStore();
18
+ if (directStorageStateOverride !== undefined) {
19
+ if (context?.directGeneration === directStorageGeneration) {
20
+ return context.state;
21
+ }
22
+ return directStorageStateOverride;
23
+ }
10
24
  // Keep the last synchronously assigned state as a fallback until enterWith()
11
25
  // has propagated through the current async chain. This is intentionally a
12
26
  // best-effort bridge for immediate reads; callers should still set state
13
27
  // before spawning child work and treat AsyncLocalStorage as the source of truth.
14
- return storagePathStateContext.getStore() ?? currentStorageState;
28
+ return context?.state ?? currentStorageState;
15
29
  }
16
30
  export function setStoragePathState(state) {
17
31
  currentStorageState = state;
18
- storagePathStateContext.enterWith(state);
32
+ directStorageStateOverride = undefined;
33
+ storagePathStateContext.enterWith({
34
+ state,
35
+ directGeneration: directStorageGeneration,
36
+ });
37
+ }
38
+ export function setStoragePathDirectState(state) {
39
+ currentStorageState = state;
40
+ directStorageStateOverride = state;
41
+ directStorageGeneration += 1;
42
+ storagePathStateContext.enterWith({
43
+ state,
44
+ directGeneration: directStorageGeneration,
45
+ });
19
46
  }
20
47
  export async function runWithStoragePathState(state, fn) {
21
- return await storagePathStateContext.run(state, fn);
48
+ return await storagePathStateContext.run({ state, directGeneration: directStorageGeneration }, fn);
22
49
  }
@@ -17,6 +17,8 @@ export interface RateLimitStateV3 {
17
17
  [key: string]: number | undefined;
18
18
  }
19
19
  export interface AccountMetadataV3 {
20
+ /** Stable per-record identity used for runtime quota state. */
21
+ recordId?: string;
20
22
  accountId?: string;
21
23
  accountIdSource?: AccountIdSource;
22
24
  accountLabel?: string;
@@ -33,6 +35,10 @@ export interface AccountMetadataV3 {
33
35
  rateLimitResetTimes?: RateLimitStateV3;
34
36
  coolingDownUntil?: number;
35
37
  cooldownReason?: CooldownReason;
38
+ /** Timestamp of the last explicit upstream OAuth-token invalidation. */
39
+ authInvalidatedAt?: number;
40
+ /** Stable provider/client error code associated with the invalidation. */
41
+ authInvalidationErrorCode?: string;
36
42
  workspaces?: Workspace[];
37
43
  currentWorkspaceIndex?: number;
38
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"public-types.d.ts","sourceRoot":"","sources":["../../../lib/storage/public-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,cAAc,GAAG,YAAY,CAAC;AAE9F,MAAM,WAAW,gBAAgB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EACd,YAAY,GACZ,SAAS,GACT,UAAU,GACV,MAAM,GACN,SAAS,GACT,QAAQ,CAAC;IACZ,mBAAmB,CAAC,EAAE,gBAAgB,CAAC;IACvC,gBAAgB,CAAC,EAAE,M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,CAAC,GACb,OAAO,CAAC,CAAC,CAAC,CAgDZ;AAED,wBAAsB,6BAA6B,CAAC,CAAC,EACpD,OAAO,EAAE,CACR,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,KACxD,OAAO,CAAC,CAAC,CAAC,GACb,OAAO,CAAC,CAAC,CAAC,CAiCZ;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAM3E;AAED;;;GAGG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAcnD;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAgD5E;AAyBD,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,uBAAuB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAa1D;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CACnC,QAAQ,EAAE,MAAM,EAChB,KAAK,UAAO,EACZ,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAC3D,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CACnC,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAe/D"}
@@ -41,7 +41,7 @@ import { migrateV1ToV3, } from "./storage/migrations.js";
41
41
  import { exportNamedBackupEntry } from "./storage/named-backup-entry.js";
42
42
  import { collectNamedBackups, } from "./storage/named-backups.js";
43
43
  import { getNamedBackupsEntry } from "./storage/named-backups-entry.js";
44
- import { getStoragePathState, setStoragePathState, } from "./storage/path-state.js";
44
+ import { getStoragePathState, setStoragePathDirectState, setStoragePathState, } from "./storage/path-state.js";
45
45
  import { findProjectRoot, getConfigDir, getProjectConfigDir, getProjectGlobalConfigDir, resolvePath, resolveProjectStorageIdentityRoot, } from "./storage/paths.js";
46
46
  import { loadNormalizedStorageFromPath, mergeStorageForMigration, } from "./storage/project-migration.js";
47
47
  import { AccountsJournalEntrySchema, AnyAccountStorageSchema, safeParseJson, } from "./schemas.js";
@@ -412,7 +412,7 @@ export function setStoragePath(projectPath) {
412
412
  }
413
413
  }
414
414
  export function setStoragePathDirect(path) {
415
- setStoragePathState({
415
+ setStoragePathDirectState({
416
416
  currentStoragePath: path,
417
417
  currentLegacyProjectStoragePath: null,
418
418
  currentLegacyWorktreeStoragePath: null,
@@ -833,9 +833,22 @@ export function normalizeAccountStorage(data) {
833
833
  // transforms — most importantly the scalar `rateLimitResetTime` -> map
834
834
  // `rateLimitResetTimes` conversion — so a rate-limited V1 account would be
835
835
  // treated as immediately available on upgrade and burst 429s (stress audit M3).
836
- const validAccounts = baseStorage.accounts.filter((account) => isRecord(account) &&
836
+ const validAccounts = baseStorage.accounts
837
+ .filter((account) => isRecord(account) &&
837
838
  typeof account.refreshToken === "string" &&
838
- !!account.refreshToken.trim());
839
+ !!account.refreshToken.trim())
840
+ .map((account) => {
841
+ const invalidationTimestamp = account.authInvalidatedAt;
842
+ if (typeof invalidationTimestamp === "number" &&
843
+ Number.isFinite(invalidationTimestamp) &&
844
+ invalidationTimestamp > 0) {
845
+ return account;
846
+ }
847
+ const normalized = { ...account };
848
+ delete normalized.authInvalidatedAt;
849
+ delete normalized.authInvalidationErrorCode;
850
+ return normalized;
851
+ });
839
852
  const deduplicatedAccounts = deduplicateAccounts(validAccounts);
840
853
  const activeIndex = (() => {
841
854
  if (deduplicatedAccounts.length === 0)