@openclaw/codex 2026.7.2-beta.7 → 2026.7.33
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 +3 -27
- package/dist/{command-formatters-C336eRVS.js → .setup/app-server-policy-C_qTMEMy.mjs} +51 -9
- package/dist/{attempt-notifications-AP-a-Q5k.js → .setup/attempt-notifications-F8krwWL4.mjs} +6 -3
- package/dist/{command-handlers-DAHUSry9.js → .setup/command-handlers-DSRFfor4.mjs} +1156 -1319
- package/dist/.setup/command-rpc-BvYsfQ7G.mjs +786 -0
- package/dist/{compact-D_uvHurS.js → .setup/compact-BNgh7I4t.mjs} +10 -40
- package/dist/.setup/computer-use-C3QkmSO3.mjs +377 -0
- package/dist/.setup/config-CYEDnLJ2.mjs +1138 -0
- package/dist/{conversation-binding-data-BHRpYbX3.js → .setup/conversation-binding-data-CrRxtDBu.mjs} +1 -1
- package/dist/{bounded-turn-D2ZAgZVz.js → .setup/media-understanding-provider-EbJCyDqe.mjs} +203 -109
- package/dist/{models-BBMKU4jA.js → .setup/models-C_aZk03A.mjs} +11 -6
- package/dist/.setup/notification-correlation-iYs4WieS.mjs +35 -0
- package/dist/.setup/plugin-app-cache-key-DR8jV9oS.mjs +99 -0
- package/dist/.setup/protocol-2POPqAY4.mjs +13 -0
- package/dist/{transcript-mirror-DzsdNCf5.js → .setup/protocol-validators-dZQ-UTOa.mjs} +112 -922
- package/dist/{rate-limits-CU-gVCCS.js → .setup/provider-DGxDs6g8.mjs} +269 -13
- package/dist/{dynamic-tools-D2gYkSBO.js → .setup/provider-capabilities-DS2N_zc1.mjs} +5632 -3953
- package/dist/.setup/request-DFR0JyoV.mjs +36 -0
- package/dist/.setup/run-attempt-C7xEKFVB.mjs +8180 -0
- package/dist/{sandbox-guard-NuhpXmPB.js → .setup/sandbox-guard-DA2TQfZW.mjs} +1 -14
- package/dist/.setup/session-binding-DuihlMJc.mjs +628 -0
- package/dist/.setup/shared-client-B2KmLPRw.mjs +1854 -0
- package/dist/{side-question-_ulBk1AL.js → .setup/side-question-Cv6JXWCS.mjs} +84 -159
- package/dist/.setup/thread-lifecycle-u6CZdOOH.mjs +2593 -0
- package/dist/{web-search-provider.runtime-CCFhg2z5.js → .setup/web-search-provider.runtime-Ce2zOHxW.mjs} +3 -3
- package/dist/doctor-contract-api.js +122 -88
- package/dist/harness.js +20 -89
- package/dist/index.js +436 -1615
- package/dist/media-understanding-provider.js +1 -173
- package/dist/prompt-overlay.js +15 -0
- package/dist/provider-catalog.js +79 -0
- package/dist/provider-discovery.js +34 -0
- package/dist/provider.js +2 -0
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +178 -221
- package/package.json +8 -9
- package/dist/app-server-policy-BSaO2JIT.js +0 -49
- package/dist/auth-binding-B4FfbcCg.js +0 -62
- package/dist/capabilities-BFDTVYr4.js +0 -36
- package/dist/cli-metadata.js +0 -20
- package/dist/computer-use-CYEc8U3w.js +0 -693
- package/dist/conversation-control-xsIeXbo4.js +0 -287
- package/dist/effective-mcp-catalog-Bbd98Inw.js +0 -114
- package/dist/event-projector-assistant-message-DTgnPPVF.js +0 -101
- package/dist/event-projector-usage-Xp4AlR2k.js +0 -86
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/notification-correlation-CU6_AnOb.js +0 -67
- package/dist/plugin-app-cache-key-DztPafOA.js +0 -408
- package/dist/request-qKh331yu.js +0 -157
- package/dist/run-attempt-CY9WlDLc.js +0 -12413
- package/dist/runtime-artifact-CmtG_t1L.js +0 -554
- package/dist/session-binding-BXpo9ymA.js +0 -2214
- package/dist/session-catalog-DyOgR4WH.js +0 -2668
- package/dist/session-cli-2PZaFLRh.js +0 -175
- package/dist/session-upstream-marker-B6U7tLw5.js +0 -82
- package/dist/settled-turn-finalizer-CXY2Z9dT.js +0 -316
- package/dist/shared-client-DTbvH-XV.js +0 -3069
- package/dist/thread-lifecycle-DF53ogiA.js +0 -3987
- package/dist/transport-stdio-DXgGZ7Ib.js +0 -88
- package/dist/upstream-session-fork-Dy4Xvuoj.js +0 -320
- package/dist/usage-CQ6GhD5-.js +0 -25
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CODEX_APP_SERVER_AUTH_MARKER, CODEX_BASE_URL, CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS, buildCodexModelDefinition, buildCodexProviderConfig } from "../provider-catalog.js";
|
|
2
|
+
import { r as isJsonObject } from "./protocol-2POPqAY4.mjs";
|
|
3
|
+
import { d as resolveCodexAppServerRuntimeOptions, u as readCodexPluginConfig } from "./config-CYEDnLJ2.mjs";
|
|
4
|
+
import { resolveCodexSystemPromptContribution } from "../prompt-overlay.js";
|
|
5
|
+
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
2
6
|
import { MAX_DATE_TIMESTAMP_MS, resolveExpiresAtMsFromEpochSeconds } from "openclaw/plugin-sdk/number-runtime";
|
|
3
7
|
import { asFiniteNumber, parseStrictFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import {
|
|
8
|
+
import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-model-shared";
|
|
9
|
+
import { createSubsystemLogger } from "openclaw/plugin-sdk/core";
|
|
5
10
|
import { PROVIDER_LABELS, clampPercent } from "openclaw/plugin-sdk/provider-usage";
|
|
6
11
|
//#region extensions/codex/src/app-server/rate-limits.ts
|
|
7
12
|
/**
|
|
@@ -17,17 +22,14 @@ const ONE_DAY_MS = 24 * ONE_HOUR_MS;
|
|
|
17
22
|
const DAY_WINDOW_MINUTES = 1440;
|
|
18
23
|
const WEEKLY_WINDOW_MINUTES = 7 * DAY_WINDOW_MINUTES;
|
|
19
24
|
const WEEKLY_RESET_GAP_MS = 3 * ONE_DAY_MS;
|
|
20
|
-
const CODEX_USAGE_LIMIT_MESSAGE_PREFIX = "You've reached your Codex subscription usage limit.";
|
|
21
|
-
const CODEX_USAGE_LIMIT_STATE_MISMATCH_MESSAGE = "Codex rejected the request with a usage-limit error, but its current account usage does not report an exhausted limit.";
|
|
22
25
|
/** Enriches Codex usage-limit failures with reset timing and recovery guidance. */
|
|
23
26
|
function formatCodexUsageLimitErrorMessage(params) {
|
|
24
27
|
const message = normalizeText(params.message);
|
|
25
|
-
if (!isCodexUsageLimitError(params.codexErrorInfo)) return;
|
|
28
|
+
if (!isCodexUsageLimitError(params.codexErrorInfo, message)) return;
|
|
26
29
|
const nowMs = params.nowMs ?? Date.now();
|
|
27
30
|
const usageSummary = summarizeCodexAccountUsage(params.rateLimits, nowMs);
|
|
28
|
-
if (params.rateLimitsAuthoritative && hasCodexRateLimitSnapshots(params.rateLimits) && !usageSummary?.blocked) return [CODEX_USAGE_LIMIT_STATE_MISMATCH_MESSAGE, "Retry the request, use another Codex account if available, or switch to another configured model/provider."].join(" ");
|
|
29
31
|
const nextReset = selectBlockingRateLimitReset(params.rateLimits, nowMs) ?? (usageSummary?.blocked ? void 0 : selectNextRateLimitReset(params.rateLimits, nowMs));
|
|
30
|
-
const parts = [
|
|
32
|
+
const parts = ["You've reached your Codex subscription usage limit."];
|
|
31
33
|
let recoveryAction = "Wait until Codex becomes available";
|
|
32
34
|
if (nextReset) {
|
|
33
35
|
parts.push(`Next reset ${formatResetTime(nextReset.resetsAtMs, nowMs)}.`);
|
|
@@ -48,7 +50,7 @@ function formatCodexUsageLimitErrorMessage(params) {
|
|
|
48
50
|
/** Detects usage-limit messages that need a fresh rate-limit query before display. */
|
|
49
51
|
function shouldRefreshCodexRateLimitsForUsageLimitMessage(message) {
|
|
50
52
|
const text = normalizeText(message);
|
|
51
|
-
return Boolean(text?.
|
|
53
|
+
return Boolean(text?.includes("You've reached your Codex subscription usage limit.") && !text.includes("Next reset "));
|
|
52
54
|
}
|
|
53
55
|
/** Formats compact summaries for raw Codex rate-limit snapshot payloads. */
|
|
54
56
|
function summarizeCodexRateLimits(value, nowMs = Date.now()) {
|
|
@@ -76,7 +78,7 @@ function resolveCodexUsageLimitResetAtMs(value, nowMs = Date.now()) {
|
|
|
76
78
|
function summarizeCodexAccountUsage(value, nowMs = Date.now()) {
|
|
77
79
|
const snapshots = collectCodexRateLimitSnapshots(value).filter(snapshotHasDisplayableData);
|
|
78
80
|
if (snapshots.length === 0) return;
|
|
79
|
-
const usageSnapshot = snapshots.find(isCodexLimitSnapshot) ??
|
|
81
|
+
const usageSnapshot = snapshots.find(isCodexLimitSnapshot) ?? snapshots[0];
|
|
80
82
|
const blockedSnapshots = snapshots.filter(snapshotHasLimitBlock);
|
|
81
83
|
const blockingSnapshot = blockedSnapshots.find(isCodexLimitSnapshot) ?? blockedSnapshots[0] ?? void 0;
|
|
82
84
|
const blockingEntries = blockingSnapshot ? readWindowEntries(blockingSnapshot) : [];
|
|
@@ -109,12 +111,12 @@ function buildCodexAppServerUsageSnapshot(value) {
|
|
|
109
111
|
...snapshot ? { plan: resolveCodexProviderUsagePlan(snapshot) } : {}
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
|
-
function isCodexUsageLimitError(codexErrorInfo) {
|
|
114
|
+
function isCodexUsageLimitError(codexErrorInfo, message) {
|
|
113
115
|
if (codexErrorInfo === "usageLimitExceeded") return true;
|
|
114
116
|
if (typeof codexErrorInfo === "string") {
|
|
115
117
|
if (codexErrorInfo.replace(/[_\s-]/gu, "").toLowerCase() === "usagelimitexceeded") return true;
|
|
116
118
|
}
|
|
117
|
-
return
|
|
119
|
+
return Boolean(message?.toLowerCase().includes("usage limit"));
|
|
118
120
|
}
|
|
119
121
|
function selectNextRateLimitReset(value, nowMs) {
|
|
120
122
|
const futureWindows = collectCodexRateLimitSnapshots(value).flatMap((snapshot) => LIMIT_WINDOW_KEYS.flatMap((key) => readRateLimitWindow(snapshot, key) ?? [])).filter((window) => window.resetsAtMs > nowMs);
|
|
@@ -186,8 +188,9 @@ function isRateLimitSnapshot(value) {
|
|
|
186
188
|
function readRateLimitWindow(snapshot, key) {
|
|
187
189
|
const window = snapshot[key];
|
|
188
190
|
if (!isJsonObject(window)) return;
|
|
191
|
+
const resetsAt = readNumber(window, "resetsAt") ?? readNumber(window, "resets_at");
|
|
189
192
|
return {
|
|
190
|
-
resetsAtMs: resolveExpiresAtMsFromEpochSeconds(
|
|
193
|
+
resetsAtMs: resolveExpiresAtMsFromEpochSeconds(resetsAt, { maxMs: MAX_DATE_TIMESTAMP_MS }) ?? 0,
|
|
191
194
|
...readOptionalNumberField(window, "usedPercent", "used_percent"),
|
|
192
195
|
...readOptionalNumberField(window, "windowDurationMins", "window_duration_mins", "windowMinutes", "window_minutes")
|
|
193
196
|
};
|
|
@@ -398,4 +401,257 @@ function normalizeText(value) {
|
|
|
398
401
|
return text ? text : void 0;
|
|
399
402
|
}
|
|
400
403
|
//#endregion
|
|
401
|
-
|
|
404
|
+
//#region extensions/codex/provider.ts
|
|
405
|
+
/**
|
|
406
|
+
* Codex provider plugin and live app-server model catalog discovery.
|
|
407
|
+
*/
|
|
408
|
+
const DEFAULT_DISCOVERY_TIMEOUT_MS = 2500;
|
|
409
|
+
const LIVE_DISCOVERY_ENV = "OPENCLAW_CODEX_DISCOVERY_LIVE";
|
|
410
|
+
const MODEL_DISCOVERY_PAGE_LIMIT = 100;
|
|
411
|
+
const CODEX_APP_SERVER_SETUP_METHOD_ID = "app-server";
|
|
412
|
+
const CODEX_DEFAULT_MODEL_REF = `${CODEX_PROVIDER_ID}/${FALLBACK_CODEX_MODELS[0].id}`;
|
|
413
|
+
const codexCatalogLog = createSubsystemLogger("codex/catalog");
|
|
414
|
+
const CODEX_REASONING_EFFORTS = [
|
|
415
|
+
"minimal",
|
|
416
|
+
"low",
|
|
417
|
+
"medium",
|
|
418
|
+
"high",
|
|
419
|
+
"xhigh",
|
|
420
|
+
"max",
|
|
421
|
+
"ultra"
|
|
422
|
+
];
|
|
423
|
+
const GPT_56_MAX_REASONING_EFFORTS = [
|
|
424
|
+
"low",
|
|
425
|
+
"medium",
|
|
426
|
+
"high",
|
|
427
|
+
"xhigh",
|
|
428
|
+
"max"
|
|
429
|
+
];
|
|
430
|
+
const GPT_56_ULTRA_REASONING_EFFORTS = [...GPT_56_MAX_REASONING_EFFORTS, "ultra"];
|
|
431
|
+
const GPT_56_ULTRA_MODEL_IDS = /* @__PURE__ */ new Set(["gpt-5.6-sol", "gpt-5.6-terra"]);
|
|
432
|
+
const GPT_56_MAX_MODEL_IDS = /* @__PURE__ */ new Set([...GPT_56_ULTRA_MODEL_IDS, "gpt-5.6-luna"]);
|
|
433
|
+
const GPT_56_DEFAULT_REASONING_EFFORTS = /* @__PURE__ */ new Map([
|
|
434
|
+
["gpt-5.6-sol", "low"],
|
|
435
|
+
["gpt-5.6-terra", "medium"],
|
|
436
|
+
["gpt-5.6-luna", "medium"]
|
|
437
|
+
]);
|
|
438
|
+
const GPT_5_PRO_REASONING_EFFORTS = [
|
|
439
|
+
"medium",
|
|
440
|
+
"high",
|
|
441
|
+
"xhigh"
|
|
442
|
+
];
|
|
443
|
+
/**
|
|
444
|
+
* Builds the Codex provider plugin, including setup metadata, catalog discovery,
|
|
445
|
+
* dynamic model resolution, and prompt/thinking hooks.
|
|
446
|
+
*/
|
|
447
|
+
function buildCodexProvider(options = {}) {
|
|
448
|
+
return {
|
|
449
|
+
id: CODEX_PROVIDER_ID,
|
|
450
|
+
label: "Codex",
|
|
451
|
+
docsPath: "/providers/models",
|
|
452
|
+
auth: [{
|
|
453
|
+
id: CODEX_APP_SERVER_SETUP_METHOD_ID,
|
|
454
|
+
label: "Codex app-server",
|
|
455
|
+
hint: "Use the Codex app-server runtime and managed model catalog.",
|
|
456
|
+
kind: "custom",
|
|
457
|
+
wizard: {
|
|
458
|
+
choiceId: CODEX_PROVIDER_ID,
|
|
459
|
+
choiceLabel: "Codex app-server",
|
|
460
|
+
choiceHint: "Use the Codex app-server runtime and managed model catalog.",
|
|
461
|
+
assistantPriority: -40,
|
|
462
|
+
groupId: CODEX_PROVIDER_ID,
|
|
463
|
+
groupLabel: "Codex",
|
|
464
|
+
groupHint: "Codex app-server model provider",
|
|
465
|
+
onboardingScopes: ["text-inference"]
|
|
466
|
+
},
|
|
467
|
+
run: async () => ({
|
|
468
|
+
profiles: [],
|
|
469
|
+
defaultModel: CODEX_DEFAULT_MODEL_REF
|
|
470
|
+
})
|
|
471
|
+
}],
|
|
472
|
+
catalog: {
|
|
473
|
+
order: "late",
|
|
474
|
+
run: async (ctx) => {
|
|
475
|
+
const pluginConfig = resolvePluginConfigObject(ctx.config, "codex") ?? (ctx.config ? void 0 : options.pluginConfig);
|
|
476
|
+
return await buildCodexProviderCatalog({
|
|
477
|
+
env: ctx.env,
|
|
478
|
+
pluginConfig,
|
|
479
|
+
listModels: options.listModels
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
staticCatalog: {
|
|
484
|
+
order: "late",
|
|
485
|
+
run: async () => ({ provider: buildCodexProviderConfig(FALLBACK_CODEX_MODELS) })
|
|
486
|
+
},
|
|
487
|
+
resolveDynamicModel: (ctx) => resolveCodexDynamicModel(ctx.modelId),
|
|
488
|
+
resolveSyntheticAuth: () => ({
|
|
489
|
+
apiKey: CODEX_APP_SERVER_AUTH_MARKER,
|
|
490
|
+
source: "codex-app-server",
|
|
491
|
+
mode: "token"
|
|
492
|
+
}),
|
|
493
|
+
fetchUsageSnapshot: async (ctx) => {
|
|
494
|
+
if (ctx.token !== "codex-app-server") return null;
|
|
495
|
+
const pluginConfig = resolvePluginConfigObject(ctx.config, "codex") ?? (ctx.config ? void 0 : options.pluginConfig);
|
|
496
|
+
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
497
|
+
return buildCodexAppServerUsageSnapshot(await (options.readRateLimits ?? requestCodexAppServerRateLimitsLazy)({
|
|
498
|
+
timeoutMs: ctx.timeoutMs,
|
|
499
|
+
agentDir: ctx.agentDir,
|
|
500
|
+
...ctx.authProfileId ? { authProfileId: ctx.authProfileId } : {},
|
|
501
|
+
config: ctx.config,
|
|
502
|
+
startOptions: appServer.start
|
|
503
|
+
}));
|
|
504
|
+
},
|
|
505
|
+
resolveThinkingProfile: ({ modelId, compat }) => {
|
|
506
|
+
const efforts = resolveCodexThinkingEfforts({
|
|
507
|
+
modelId,
|
|
508
|
+
supportedReasoningEfforts: readCodexSupportedReasoningEfforts(compat)
|
|
509
|
+
});
|
|
510
|
+
const defaultLevel = GPT_56_DEFAULT_REASONING_EFFORTS.get(modelId.trim().toLowerCase());
|
|
511
|
+
return {
|
|
512
|
+
levels: [{ id: "off" }, ...efforts.map((id) => ({ id }))],
|
|
513
|
+
...defaultLevel && efforts.includes(defaultLevel) ? { defaultLevel } : {}
|
|
514
|
+
};
|
|
515
|
+
},
|
|
516
|
+
resolveSystemPromptContribution: ({ config, modelId }) => resolveCodexSystemPromptContribution({
|
|
517
|
+
config,
|
|
518
|
+
modelId
|
|
519
|
+
}),
|
|
520
|
+
isModernModelRef: ({ modelId }) => isModernCodexModel(modelId)
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Builds the Codex model catalog from live app-server discovery, falling back
|
|
525
|
+
* to built-in model records when discovery is disabled or unavailable.
|
|
526
|
+
*/
|
|
527
|
+
async function buildCodexProviderCatalog(options = {}) {
|
|
528
|
+
const config = readCodexPluginConfig(options.pluginConfig);
|
|
529
|
+
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: options.pluginConfig });
|
|
530
|
+
const timeoutMs = normalizeTimeoutMs(config.discovery?.timeoutMs);
|
|
531
|
+
let discovered = [];
|
|
532
|
+
if (config.discovery?.enabled !== false && !shouldSkipLiveDiscovery(options.env)) discovered = await listModelsBestEffort({
|
|
533
|
+
listModels: options.listModels ?? listCodexAppServerModelsLazy,
|
|
534
|
+
timeoutMs,
|
|
535
|
+
startOptions: appServer.start,
|
|
536
|
+
onDiscoveryFailure: options.onDiscoveryFailure
|
|
537
|
+
});
|
|
538
|
+
return { provider: buildCodexProviderConfig(discovered.length > 0 ? discovered : FALLBACK_CODEX_MODELS) };
|
|
539
|
+
}
|
|
540
|
+
function resolveCodexDynamicModel(modelId) {
|
|
541
|
+
const id = modelId.trim();
|
|
542
|
+
if (!id) return;
|
|
543
|
+
const fallbackModel = FALLBACK_CODEX_MODELS.find((model) => model.id === id);
|
|
544
|
+
return normalizeModelCompat({
|
|
545
|
+
...buildCodexModelDefinition({
|
|
546
|
+
id,
|
|
547
|
+
model: id,
|
|
548
|
+
inputModalities: fallbackModel?.inputModalities ?? ["text"],
|
|
549
|
+
supportedReasoningEfforts: fallbackModel?.supportedReasoningEfforts
|
|
550
|
+
}),
|
|
551
|
+
provider: CODEX_PROVIDER_ID,
|
|
552
|
+
baseUrl: CODEX_BASE_URL
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
async function listModelsBestEffort(params) {
|
|
556
|
+
try {
|
|
557
|
+
const models = [];
|
|
558
|
+
let cursor;
|
|
559
|
+
do {
|
|
560
|
+
const result = await params.listModels({
|
|
561
|
+
timeoutMs: params.timeoutMs,
|
|
562
|
+
limit: MODEL_DISCOVERY_PAGE_LIMIT,
|
|
563
|
+
cursor,
|
|
564
|
+
startOptions: params.startOptions,
|
|
565
|
+
sharedClient: false
|
|
566
|
+
});
|
|
567
|
+
models.push(...result.models.filter((model) => !model.hidden));
|
|
568
|
+
cursor = result.nextCursor;
|
|
569
|
+
} while (cursor);
|
|
570
|
+
return models;
|
|
571
|
+
} catch (error) {
|
|
572
|
+
params.onDiscoveryFailure?.(error);
|
|
573
|
+
codexCatalogLog.debug("codex model discovery failed; using fallback catalog", { error: error instanceof Error ? error.message : String(error) });
|
|
574
|
+
return [];
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
async function listCodexAppServerModelsLazy(options) {
|
|
578
|
+
const { listCodexAppServerModels } = await import("./models-C_aZk03A.mjs").then((n) => n.r);
|
|
579
|
+
return listCodexAppServerModels(options);
|
|
580
|
+
}
|
|
581
|
+
async function requestCodexAppServerRateLimitsLazy(options) {
|
|
582
|
+
const { requestCodexAppServerJson } = await import("./request-DFR0JyoV.mjs").then((n) => n.n);
|
|
583
|
+
return await requestCodexAppServerJson({
|
|
584
|
+
method: "account/rateLimits/read",
|
|
585
|
+
timeoutMs: options.timeoutMs,
|
|
586
|
+
agentDir: options.agentDir,
|
|
587
|
+
...options.authProfileId ? { authProfileId: options.authProfileId } : {},
|
|
588
|
+
config: options.config,
|
|
589
|
+
startOptions: options.startOptions,
|
|
590
|
+
isolated: true
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
function normalizeTimeoutMs(value) {
|
|
594
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : DEFAULT_DISCOVERY_TIMEOUT_MS;
|
|
595
|
+
}
|
|
596
|
+
function shouldSkipLiveDiscovery(env = process.env) {
|
|
597
|
+
const override = env[LIVE_DISCOVERY_ENV]?.trim().toLowerCase();
|
|
598
|
+
if (override === "0" || override === "false") return true;
|
|
599
|
+
return Boolean(env.VITEST) && override !== "1";
|
|
600
|
+
}
|
|
601
|
+
function isKnownXHighCodexModel(modelId) {
|
|
602
|
+
const lower = modelId.trim().toLowerCase();
|
|
603
|
+
return lower.startsWith("gpt-5") || lower.startsWith("o3") || lower.startsWith("o4") || lower.includes("codex");
|
|
604
|
+
}
|
|
605
|
+
function normalizeCodexReasoningEfforts(efforts) {
|
|
606
|
+
if (!efforts) return [];
|
|
607
|
+
const supported = new Set(efforts.map((effort) => effort.trim().toLowerCase()));
|
|
608
|
+
return CODEX_REASONING_EFFORTS.filter((effort) => supported.has(effort));
|
|
609
|
+
}
|
|
610
|
+
/** Read app-server reasoning metadata from a runtime model compat union. */
|
|
611
|
+
function readCodexSupportedReasoningEfforts(compat) {
|
|
612
|
+
if (!compat || typeof compat !== "object" || Array.isArray(compat)) return;
|
|
613
|
+
const efforts = compat.supportedReasoningEfforts;
|
|
614
|
+
if (!Array.isArray(efforts)) return;
|
|
615
|
+
const strings = efforts.filter((effort) => typeof effort === "string");
|
|
616
|
+
return strings.some((effort) => effort.trim().toLowerCase() === "none") ? void 0 : strings;
|
|
617
|
+
}
|
|
618
|
+
function resolveCodexThinkingEfforts(params) {
|
|
619
|
+
if (params.supportedReasoningEfforts) return normalizeCodexReasoningEfforts(params.supportedReasoningEfforts);
|
|
620
|
+
const fallbackEfforts = resolveCodexFallbackReasoningEfforts(params.modelId);
|
|
621
|
+
if (fallbackEfforts) return [...fallbackEfforts];
|
|
622
|
+
return [
|
|
623
|
+
"minimal",
|
|
624
|
+
"low",
|
|
625
|
+
"medium",
|
|
626
|
+
"high",
|
|
627
|
+
...isKnownXHighCodexModel(params.modelId) ? ["xhigh"] : [],
|
|
628
|
+
...isMaxReasoningCodexModel(params.modelId) ? ["max"] : []
|
|
629
|
+
];
|
|
630
|
+
}
|
|
631
|
+
/** Map a requested effort onto the authoritative app-server model contract. */
|
|
632
|
+
function resolveCodexSupportedReasoningEffort(params) {
|
|
633
|
+
const supported = normalizeCodexReasoningEfforts(params.supportedReasoningEfforts);
|
|
634
|
+
if (supported.includes(params.requested)) return params.requested;
|
|
635
|
+
const fallbackEfforts = params.requested === "ultra" ? supported : supported.filter((effort) => effort !== "ultra");
|
|
636
|
+
const requestedRank = CODEX_REASONING_EFFORTS.indexOf(params.requested);
|
|
637
|
+
return fallbackEfforts.find((effort) => CODEX_REASONING_EFFORTS.indexOf(effort) >= requestedRank) ?? fallbackEfforts.at(-1);
|
|
638
|
+
}
|
|
639
|
+
/** Return the known effort contract when app-server model metadata is unavailable. */
|
|
640
|
+
function resolveCodexFallbackReasoningEfforts(modelId) {
|
|
641
|
+
const normalized = modelId.trim().toLowerCase();
|
|
642
|
+
if (GPT_56_ULTRA_MODEL_IDS.has(normalized)) return GPT_56_ULTRA_REASONING_EFFORTS;
|
|
643
|
+
if (normalized === "gpt-5.6-luna") return GPT_56_MAX_REASONING_EFFORTS;
|
|
644
|
+
if (normalized === "gpt-5.5-pro" || normalized === "gpt-5.4-pro") return GPT_5_PRO_REASONING_EFFORTS;
|
|
645
|
+
}
|
|
646
|
+
/** Return whether the model uses the modern Codex reasoning profile. */
|
|
647
|
+
function isModernCodexModel(modelId) {
|
|
648
|
+
const lower = modelId.trim().toLowerCase();
|
|
649
|
+
return GPT_56_MAX_MODEL_IDS.has(lower) || lower === "gpt-5.5" || lower === "gpt-5.5-pro" || lower === "gpt-5.4" || lower === "gpt-5.4-pro" || lower === "gpt-5.4-mini" || lower === "gpt-5.3-codex-spark";
|
|
650
|
+
}
|
|
651
|
+
/** Return whether Codex accepts the preview GPT-5.6 `max` reasoning effort. */
|
|
652
|
+
function isMaxReasoningCodexModel(modelId) {
|
|
653
|
+
const lower = modelId.trim().toLowerCase();
|
|
654
|
+
return GPT_56_MAX_MODEL_IDS.has(lower);
|
|
655
|
+
}
|
|
656
|
+
//#endregion
|
|
657
|
+
export { readCodexSupportedReasoningEfforts as a, formatCodexUsageLimitErrorMessage as c, shouldRefreshCodexRateLimitsForUsageLimitMessage as d, summarizeCodexAccountRateLimits as f, isModernCodexModel as i, hasCodexRateLimitSnapshots as l, summarizeCodexRateLimits as m, buildCodexProviderCatalog as n, resolveCodexFallbackReasoningEfforts as o, summarizeCodexAccountUsage as p, isMaxReasoningCodexModel as r, resolveCodexSupportedReasoningEffort as s, buildCodexProvider as t, resolveCodexUsageLimitResetAtMs as u };
|