@bitkyc08/opencodex 2.55.0-preview.20260914 → 2.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gui/dist/assets/{index-DH2PUHqr.js → index-D4zuyIxQ.js} +1 -1
- package/gui/dist/index.html +1 -1
- package/package.json +2 -1
- package/src/adapters/base.ts +21 -0
- package/src/adapters/cursor/transport-retry.ts +46 -1
- package/src/adapters/cursor.ts +4 -0
- package/src/adapters/kiro/adapter.ts +42 -1
- package/src/adapters/kiro-retry.ts +23 -4
- package/src/adapters/openai-chat/errors.ts +116 -0
- package/src/adapters/openai-chat/messages.ts +346 -0
- package/src/adapters/openai-chat/passthrough.ts +146 -0
- package/src/adapters/openai-chat/response-events.ts +117 -0
- package/src/adapters/openai-chat/tool-call-validation.ts +200 -0
- package/src/adapters/openai-chat/tool-schema.ts +477 -0
- package/src/adapters/openai-chat/wire.ts +50 -0
- package/src/adapters/openai-chat.ts +33 -1445
- package/src/adapters/openai-responses/canonical-forward.ts +202 -0
- package/src/adapters/openai-responses/image-gen.ts +406 -0
- package/src/adapters/openai-responses/internal.ts +3 -0
- package/src/adapters/openai-responses/passthrough.ts +611 -0
- package/src/adapters/openai-responses/prompt-cache.ts +83 -0
- package/src/adapters/openai-responses/reasoning.ts +220 -0
- package/src/adapters/openai-responses/request-strips.ts +185 -0
- package/src/adapters/openai-responses/tool-output-recovery.ts +509 -0
- package/src/adapters/openai-responses/tool-schema.ts +293 -0
- package/src/adapters/openai-responses/web-search.ts +156 -0
- package/src/adapters/openai-responses.ts +4 -2625
- package/src/bridge/errors.ts +34 -0
- package/src/bridge/internal.ts +174 -0
- package/src/bridge/response-json.ts +624 -0
- package/src/bridge/sse.ts +1444 -0
- package/src/bridge.ts +5 -2204
- package/src/chat/inbound.ts +12 -1
- package/src/codex/account-lifecycle.ts +3 -0
- package/src/codex/account-store.ts +71 -9
- package/src/codex/auth-api/account-list.ts +507 -0
- package/src/codex/auth-api/http.ts +32 -0
- package/src/codex/auth-api/login-flow.ts +554 -0
- package/src/codex/auth-api/login-state.ts +64 -0
- package/src/codex/auth-api/main-account-probe.ts +331 -0
- package/src/codex/auth-api/pool-mode-gate.ts +274 -0
- package/src/codex/auth-api/pool-quota-probe.ts +512 -0
- package/src/codex/auth-api/reset-credit-service.ts +422 -0
- package/src/codex/auth-api/routes.ts +425 -0
- package/src/codex/auth-api/runtime-config.ts +48 -0
- package/src/codex/auth-api.ts +27 -3118
- package/src/codex/auth-context.ts +95 -28
- package/src/codex/catalog/auto-review.ts +507 -0
- package/src/codex/catalog/build-entries.ts +981 -0
- package/src/codex/catalog/combo-member.ts +375 -0
- package/src/codex/catalog/derive-entry.ts +229 -0
- package/src/codex/catalog/effort.ts +0 -1
- package/src/codex/catalog/gated-native-warn.ts +63 -0
- package/src/codex/catalog/gather-capture.ts +533 -0
- package/src/codex/catalog/model-hints.ts +691 -0
- package/src/codex/catalog/model-visibility.ts +304 -0
- package/src/codex/catalog/provider-fetch.ts +52 -2942
- package/src/codex/catalog/provider-models.ts +685 -0
- package/src/codex/catalog/restore.ts +132 -0
- package/src/codex/catalog/retained-sync.ts +706 -0
- package/src/codex/catalog/routed-gather.ts +858 -0
- package/src/codex/catalog/subagent-roster.ts +176 -0
- package/src/codex/catalog/sync.ts +52 -2698
- package/src/codex/inject/config-toml.ts +563 -0
- package/src/codex/inject/remove.ts +192 -0
- package/src/codex/inject/restore.ts +540 -0
- package/src/codex/inject/routing-classify.ts +109 -0
- package/src/codex/inject/routing-target.ts +125 -0
- package/src/codex/inject.ts +81 -1436
- package/src/codex/lineage.ts +458 -0
- package/src/codex/pool-refresh-backoff.ts +152 -0
- package/src/codex/routing/active-account.ts +194 -0
- package/src/codex/routing/cooldown-math.ts +275 -0
- package/src/codex/routing/health-store.ts +402 -0
- package/src/codex/routing/probe-lease.ts +358 -0
- package/src/codex/routing/selection.ts +703 -0
- package/src/codex/routing/thread-affinity.ts +538 -0
- package/src/codex/routing.ts +353 -2234
- package/src/codex/shim-fingerprint.ts +223 -0
- package/src/codex/shim-inspect.ts +175 -0
- package/src/codex/shim-probe.ts +367 -0
- package/src/codex/shim-restore-lock.ts +169 -0
- package/src/codex/shim-state-file.ts +151 -0
- package/src/codex/shim-templates.ts +265 -0
- package/src/codex/shim.ts +48 -1268
- package/src/config/diagnostics.ts +705 -0
- package/src/config/feature-flags.ts +55 -0
- package/src/config/live-reconcile.ts +403 -0
- package/src/config/load-degrade.ts +880 -0
- package/src/config/mutation-lock.ts +244 -0
- package/src/config/openai-tier-backup.ts +268 -0
- package/src/config/persist-unlocked.ts +92 -0
- package/src/config/proxy-env.ts +188 -0
- package/src/config/salvage.ts +244 -0
- package/src/config/schema/config-schema.ts +640 -0
- package/src/config/schema/leaf-validators.ts +855 -0
- package/src/config/warn-memo.ts +28 -0
- package/src/config.ts +234 -4481
- package/src/generated/compatibility-version.json +539 -39
- package/src/lib/request-execution-budget.ts +69 -20
- package/src/lib/spend-reservation-ledger.ts +940 -0
- package/src/lib/upstream-retry.ts +55 -11
- package/src/lib/workflow-budget.ts +553 -30
- package/src/providers/quota/account-cache.ts +441 -0
- package/src/providers/quota/antigravity.ts +295 -0
- package/src/providers/quota/report-cache.ts +320 -0
- package/src/providers/quota/vendor-probes-key.ts +1243 -0
- package/src/providers/quota/vendor-probes-oauth.ts +590 -0
- package/src/providers/quota.ts +324 -3079
- package/src/providers/registry/entries-core.ts +1221 -0
- package/src/providers/registry/entries-extended.ts +1204 -0
- package/src/providers/registry/model-seeds.ts +908 -0
- package/src/providers/registry/types.ts +352 -0
- package/src/providers/registry.ts +24 -3536
- package/src/responses/continuation-ownership.ts +29 -0
- package/src/responses/state/replay-fingerprint.ts +80 -0
- package/src/responses/state/snapshot-codec.ts +104 -0
- package/src/responses/state/spill-failure.ts +118 -0
- package/src/responses/state/spill-queue.ts +665 -0
- package/src/responses/state/temp-recovery.ts +257 -0
- package/src/responses/state.ts +82 -1143
- package/src/routing/identity-domains.ts +449 -0
- package/src/routing/probe-lease.ts +511 -0
- package/src/server/index/bounded-request.ts +88 -0
- package/src/server/index/live-sideband.ts +565 -0
- package/src/server/index/serve-options.ts +1766 -0
- package/src/server/index/startup-warnings.ts +213 -0
- package/src/server/index/websocket-handler.ts +335 -0
- package/src/server/index.ts +40 -2547
- package/src/server/management/route-registry.ts +26 -23
- package/src/server/management/shared.ts +8 -5
- package/src/server/management/workflow-budget-routes.ts +133 -0
- package/src/server/management-api.ts +12 -0
- package/src/server/request-log-conversation.ts +9 -7
- package/src/server/request-log.ts +245 -1
- package/src/server/responses/account-change-state.ts +233 -0
- package/src/server/responses/adapter-continuation.ts +514 -0
- package/src/server/responses/adapter-delivery.ts +214 -0
- package/src/server/responses/adapter-dispatch.ts +971 -0
- package/src/server/responses/compact.ts +59 -4
- package/src/server/responses/completion-policy.ts +33 -0
- package/src/server/responses/core-auth.ts +527 -0
- package/src/server/responses/core-codex-account.ts +859 -0
- package/src/server/responses/core-combo-failure.ts +210 -0
- package/src/server/responses/core-combo.ts +707 -0
- package/src/server/responses/core-errors.ts +152 -0
- package/src/server/responses/core-lifetime.ts +95 -0
- package/src/server/responses/core-normalize.ts +350 -0
- package/src/server/responses/core-opaque-recovery.ts +380 -0
- package/src/server/responses/core-options.ts +159 -0
- package/src/server/responses/core-replay.ts +225 -0
- package/src/server/responses/core.ts +192 -8893
- package/src/server/responses/passthrough-delivery.ts +856 -0
- package/src/server/responses/passthrough-dispatch.ts +1476 -0
- package/src/server/responses/passthrough-execution.ts +54 -0
- package/src/server/responses/request-prepare.ts +970 -0
- package/src/server/responses/request-send-budget.ts +164 -0
- package/src/server/responses/request-sidecar-auth.ts +149 -0
- package/src/server/responses/request-transport.ts +744 -0
- package/src/server/responses/response-effects.ts +157 -0
- package/src/server/responses/run-turn-execution.ts +448 -0
- package/src/server/responses/sidecar-execution.ts +469 -0
- package/src/server/responses-image-gen-repair.ts +1 -1
- package/src/server/workflow-refusal.ts +84 -0
- package/src/types/config.ts +30 -0
- package/src/usage/log.ts +146 -0
- package/src/usage/summary.ts +171 -21
|
@@ -139,7 +139,11 @@ export interface RetryBackoffOptions {
|
|
|
139
139
|
* first instead of silently lengthening every adapter's backoff.
|
|
140
140
|
*/
|
|
141
141
|
retryAfterIsLowerBound?: boolean;
|
|
142
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* The wait deadline a caller applies to an honoured `Retry-After`. The delay itself is
|
|
144
|
+
* never shortened: an instruction longer than the deadline is a reason to END with the
|
|
145
|
+
* upstream answer, not to send early. Kept for callers that still pass it.
|
|
146
|
+
*/
|
|
143
147
|
retryAfterCeilingMs?: number;
|
|
144
148
|
}
|
|
145
149
|
|
|
@@ -305,10 +309,10 @@ export function retryBackoffDelayMs(attempt: number, opts: RetryBackoffOptions):
|
|
|
305
309
|
// A provider that names a wait is stating when it will serve again; sending earlier is a
|
|
306
310
|
// request we already know will be refused, and refusing it twice is the retry storm the
|
|
307
311
|
// header exists to prevent. The local maximum bounds our OWN exponential backoff and has no
|
|
308
|
-
// business shortening someone else's instruction
|
|
309
|
-
//
|
|
310
|
-
|
|
311
|
-
return Math.
|
|
312
|
+
// business shortening someone else's instruction, so the instruction is returned in full.
|
|
313
|
+
// Whether the request can afford to wait that long is the caller's deadline decision --
|
|
314
|
+
// fetchWithTransientRetry ends with the upstream answer rather than retrying early.
|
|
315
|
+
return Math.max(retryAfter, jittered);
|
|
312
316
|
}
|
|
313
317
|
|
|
314
318
|
export function cancelResponseBodyBestEffort(res: Response): void {
|
|
@@ -353,17 +357,31 @@ export interface ResetRetryOptions {
|
|
|
353
357
|
label?: string;
|
|
354
358
|
/** Total upstream sends allowed, including the first one. Not a per-layer retry count. */
|
|
355
359
|
attempts?: number;
|
|
360
|
+
/**
|
|
361
|
+
* Reports how many upstream sends this call actually consumed, so a caller that spans
|
|
362
|
+
* several legs of one request (initial send, then a 429/account-recovery refetch) can
|
|
363
|
+
* keep them on ONE budget instead of handing each leg a fresh one.
|
|
364
|
+
*
|
|
365
|
+
* It lives on the RESET options, not on the transient ones, because every leg that falls
|
|
366
|
+
* back to reset-only retry -- the non-policy adapter initial send, and every
|
|
367
|
+
* `rebuildAndRefetch` recovery kind whose provider has no transient policy -- was not merely
|
|
368
|
+
* uncounted but UNCOUNTABLE: the callback existed on a type those call sites never reach.
|
|
369
|
+
*/
|
|
370
|
+
onSendsConsumed?: (sends: number) => void;
|
|
356
371
|
}
|
|
357
372
|
|
|
358
373
|
export interface TransientRetryOptions extends ResetRetryOptions {
|
|
359
374
|
/** Test seam: per-attempt slow budget override (defaults to TRANSIENT_RETRY_SLOW_ATTEMPT_MS). */
|
|
360
375
|
slowAttemptMs?: number;
|
|
361
376
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
377
|
+
* How long this caller can wait on an honoured `Retry-After`, defaulting to
|
|
378
|
+
* {@link RETRY_AFTER_CEILING_MS}. It is a deadline, never a clamp: an instruction inside it
|
|
379
|
+
* is slept in full, and an instruction past it ends the call with the upstream answer and
|
|
380
|
+
* its `Retry-After` intact rather than sending early at a provider that already said it
|
|
381
|
+
* would refuse. A caller with a shorter budget than a minute says so and is not parked past
|
|
382
|
+
* it; a caller that can genuinely wait longer says so and is not cut short.
|
|
365
383
|
*/
|
|
366
|
-
|
|
384
|
+
retryAfterCeilingMs?: number;
|
|
367
385
|
}
|
|
368
386
|
|
|
369
387
|
export type UpstreamSendRecovery = "connection-reset" | "transient-5xx";
|
|
@@ -442,6 +460,10 @@ export async function fetchWithResetRetry(
|
|
|
442
460
|
let sawReset = false;
|
|
443
461
|
for (let attempt = 0; attempt < attempts; attempt++) {
|
|
444
462
|
if (opts.abortSignal?.aborted) throw abortError(opts.abortSignal);
|
|
463
|
+
// Reported before the await, one physical send at a time: a send that rejects has still
|
|
464
|
+
// been made, and this helper leaves through four exits (return, reset give-up, non-reset
|
|
465
|
+
// rethrow, abort), so a per-send report is the only shape that is correct on all of them.
|
|
466
|
+
opts.onSendsConsumed?.(1);
|
|
445
467
|
try {
|
|
446
468
|
return await doFetch(attempt === 0 ? firstRecovery : "connection-reset");
|
|
447
469
|
} catch (err) {
|
|
@@ -504,13 +526,22 @@ export async function fetchWithTransientRetry(
|
|
|
504
526
|
// more send -- the loop condition alone was never enough, because every later recovery leg
|
|
505
527
|
// called this helper again and the floor funded each of them.
|
|
506
528
|
const remaining = () => Math.max(0, budget - sent);
|
|
529
|
+
// The inner reset layer now has its own `onSendsConsumed`, and these are the same physical
|
|
530
|
+
// sends `countedFetch` already counts. Forwarding the reporter down the `remaining()` path
|
|
531
|
+
// would report each of them twice, which is how a four-send cap becomes a two-send cap. One
|
|
532
|
+
// send is counted once, by the outermost layer that owns the budget.
|
|
533
|
+
const innerResetOptions = (): ResetRetryOptions => ({
|
|
534
|
+
...opts,
|
|
535
|
+
attempts: remaining(),
|
|
536
|
+
onSendsConsumed: undefined,
|
|
537
|
+
});
|
|
507
538
|
// Reported in `finally` rather than at each exit: this function returns from five places
|
|
508
539
|
// and throws from one, and a caller sharing the budget across request legs must be told the
|
|
509
540
|
// real count on every one of them.
|
|
510
541
|
try {
|
|
511
542
|
if (budget === 0) throw new SendBudgetExhaustedError(opts.label);
|
|
512
543
|
let attemptStart = Date.now();
|
|
513
|
-
let res = await fetchWithResetRetry(countedFetch,
|
|
544
|
+
let res = await fetchWithResetRetry(countedFetch, innerResetOptions());
|
|
514
545
|
for (let attempt = 0; sent < budget; attempt++) {
|
|
515
546
|
// A non-replayable gateway status was settled after the request body had already left
|
|
516
547
|
// for the origin; retrying it here is the automatic resend the marker exists to forbid.
|
|
@@ -519,6 +550,19 @@ export async function fetchWithTransientRetry(
|
|
|
519
550
|
// a response whose body we just cancelled.
|
|
520
551
|
if (opts.abortSignal?.aborted) return res;
|
|
521
552
|
if (Date.now() - attemptStart > slowAttemptMs) return res;
|
|
553
|
+
const instructedDelay = retryAfterDelayMs(res.headers);
|
|
554
|
+
// The deadline is the CALLER'S, not this module's default. Reading the constant directly
|
|
555
|
+
// broke it in both directions: a caller with a 30s budget slept the full 45s an upstream
|
|
556
|
+
// asked for, and a caller that could genuinely wait 120s was handed the error back for a
|
|
557
|
+
// 90s instruction it was willing to honour.
|
|
558
|
+
const waitDeadlineMs = opts.retryAfterCeilingMs ?? RETRY_AFTER_CEILING_MS;
|
|
559
|
+
if (instructedDelay !== undefined && instructedDelay > waitDeadlineMs) {
|
|
560
|
+
// Honouring the stated wait would park this request past the deadline it can commit
|
|
561
|
+
// to, and sleeping only up to the deadline is a send the provider already said it will
|
|
562
|
+
// refuse. End here instead: the caller receives the upstream answer with its
|
|
563
|
+
// Retry-After intact and applies its own policy, exactly as on the direct path.
|
|
564
|
+
return res;
|
|
565
|
+
}
|
|
522
566
|
console.warn(
|
|
523
567
|
`[upstream-retry] transient ${res.status}${opts.label ? ` (${opts.label})` : ""} — retrying (${sent + 1}/${budget})`,
|
|
524
568
|
);
|
|
@@ -535,7 +579,7 @@ export async function fetchWithTransientRetry(
|
|
|
535
579
|
attemptStart = Date.now();
|
|
536
580
|
transientStatuses.push(res.status);
|
|
537
581
|
try {
|
|
538
|
-
res = await fetchWithResetRetry(countedFetch,
|
|
582
|
+
res = await fetchWithResetRetry(countedFetch, innerResetOptions(), "transient-5xx");
|
|
539
583
|
} catch (err) {
|
|
540
584
|
// Keep the prior 5xx evidence attached: the origin already responded, so
|
|
541
585
|
// this rejection is not pre-connection and must not classify as neutral.
|