@openclaw/codex 2026.5.24-beta.2 → 2026.5.26-beta.1

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 (27) hide show
  1. package/dist/{client-1sSy4p3z.js → client-BVK_jmHW.js} +10 -3
  2. package/dist/{client-factory-Bk6i4FnW.js → client-factory-CaOpX89B.js} +1 -1
  3. package/dist/{command-handlers-CcTABuem.js → command-handlers-D4C2y46B.js} +10 -23
  4. package/dist/compact-CRI0BEc_.js +155 -0
  5. package/dist/{computer-use-Hdq1WgTA.js → computer-use-CDDlIBhY.js} +2 -2
  6. package/dist/{config-DDMrwfJl.js → config-0-UN67Qg.js} +8 -4
  7. package/dist/{node-cli-sessions-9CAqnIaA.js → conversation-binding-BnnjOmgs.js} +426 -434
  8. package/dist/{dynamic-tools-Bq717oJR.js → dynamic-tools-BG9ICyU4.js} +20 -11
  9. package/dist/harness.js +5 -5
  10. package/dist/index.js +452 -18
  11. package/dist/media-understanding-provider.js +8 -6
  12. package/dist/{models-DtGLkqMP.js → models-ASKu9eOY.js} +4 -4
  13. package/dist/{notification-correlation-qKY_sgga.js → notification-correlation-YINts3PA.js} +26 -11
  14. package/dist/{protocol-validators-_gKDcd0x.js → protocol-validators-CSuFMLvY.js} +138 -29
  15. package/dist/provider.js +3 -3
  16. package/dist/{request-D93E78SA.js → request-DmBkYLPy.js} +3 -3
  17. package/dist/{run-attempt-CT1N__qp.js → run-attempt-CFBsGx1T.js} +488 -280
  18. package/dist/{session-binding-Bw_mfIW2.js → session-binding-UFjjws4k.js} +1 -1
  19. package/dist/{shared-client-CFCUGEVs.js → shared-client-Fou5nAyt.js} +66 -11
  20. package/dist/{side-question-CYFMTA1O.js → side-question-fq_T2d_x.js} +17 -12
  21. package/dist/test-api.js +3 -3
  22. package/dist/{thread-lifecycle-DGoaguJh.js → thread-lifecycle-BapIT9Qs.js} +113 -28
  23. package/dist/{vision-tools-DOnxzH2y.js → vision-tools-B30YCKRK.js} +16 -4
  24. package/npm-shrinkwrap.json +222 -305
  25. package/package.json +8 -8
  26. package/dist/compact-DnTgL6UT.js +0 -475
  27. package/dist/protocol-oeJQu4rs.js +0 -9
@@ -1,4 +1,5 @@
1
- import { t as isJsonObject } from "./protocol-oeJQu4rs.js";
1
+ import { l as isJsonObject } from "./client-BVK_jmHW.js";
2
+ import { asFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
2
3
  //#region extensions/codex/src/app-server/rate-limits.ts
3
4
  const CODEX_LIMIT_ID = "codex";
4
5
  const LIMIT_WINDOW_KEYS = ["primary", "secondary"];
@@ -10,15 +11,24 @@ function formatCodexUsageLimitErrorMessage(params) {
10
11
  const message = normalizeText(params.message);
11
12
  if (!isCodexUsageLimitError(params.codexErrorInfo, message)) return;
12
13
  const nowMs = params.nowMs ?? Date.now();
13
- const nextReset = selectNextRateLimitReset(params.rateLimits, nowMs);
14
+ const usageSummary = summarizeCodexAccountUsage(params.rateLimits, nowMs);
15
+ const nextReset = selectBlockingRateLimitReset(params.rateLimits, nowMs) ?? (usageSummary?.blocked ? void 0 : selectNextRateLimitReset(params.rateLimits, nowMs));
14
16
  const parts = ["You've reached your Codex subscription usage limit."];
15
- if (nextReset) parts.push(`Next reset ${formatResetTime(nextReset.resetsAtMs, nowMs)}.`);
16
- else {
17
+ let recoveryAction = "Wait until Codex becomes available";
18
+ if (nextReset) {
19
+ parts.push(`Next reset ${formatResetTime(nextReset.resetsAtMs, nowMs)}.`);
20
+ recoveryAction = "Wait until the reset time";
21
+ } else {
17
22
  const codexRetryHint = extractCodexRetryHint(message);
18
- if (codexRetryHint) parts.push(`Codex says to try again ${codexRetryHint}.`);
19
- else parts.push("Codex did not return a reset time for this limit.");
23
+ if (codexRetryHint) {
24
+ parts.push(`Codex says to try again ${codexRetryHint}.`);
25
+ recoveryAction = "Wait until the retry time";
26
+ } else {
27
+ if (usageSummary?.blockingPeriod && usageSummary.blockingReason) parts.push(`Your ${usageSummary.blockingReason}.`);
28
+ parts.push("OpenClaw could not determine a reset time from Codex.");
29
+ }
20
30
  }
21
- parts.push("Run /codex account for current usage details.");
31
+ parts.push(`${recoveryAction}, use another Codex account if available, or switch to another configured model/provider.`);
22
32
  return parts.join(" ");
23
33
  }
24
34
  function shouldRefreshCodexRateLimitsForUsageLimitMessage(message) {
@@ -49,8 +59,9 @@ function summarizeCodexAccountUsage(value, nowMs = Date.now()) {
49
59
  const usageSnapshot = snapshots.find(isCodexLimitSnapshot) ?? snapshots[0];
50
60
  const blockedSnapshots = snapshots.filter(snapshotHasLimitBlock);
51
61
  const blockingSnapshot = blockedSnapshots.find(isCodexLimitSnapshot) ?? blockedSnapshots[0] ?? void 0;
52
- const blockingReset = blockingSnapshot ? selectSnapshotBlockingReset(blockingSnapshot, nowMs) : void 0;
53
- const blockingPeriod = formatBlockingLimitPeriod(blockingReset?.windowDurationMins);
62
+ const blockingWindow = blockingSnapshot ? selectSnapshotBlockingWindow(blockingSnapshot, nowMs) : void 0;
63
+ const blockingReset = blockingWindow && blockingWindow.resetsAtMs > nowMs ? blockingWindow : void 0;
64
+ const blockingPeriod = formatBlockingLimitPeriod(blockingWindow?.windowDurationMins);
54
65
  const blockedUntilText = blockingReset ? formatAccountResetTime(blockingReset.resetsAtMs, nowMs) : void 0;
55
66
  const blockedResetRelative = blockingReset ? `in ${formatRelativeDuration(blockingReset.resetsAtMs - nowMs)}` : void 0;
56
67
  const blockingReason = blockingPeriod ? `${blockingPeriod} Codex usage limit is reached` : blockingSnapshot ? "Codex usage limit is reached" : void 0;
@@ -191,6 +202,11 @@ function selectSnapshotBlockingReset(snapshot, nowMs) {
191
202
  const resetSort = exhaustedWindows.length > 0 ? (left, right) => right.resetsAtMs - left.resetsAtMs : (left, right) => left.resetsAtMs - right.resetsAtMs;
192
203
  return candidates.toSorted(resetSort)[0];
193
204
  }
205
+ function selectSnapshotBlockingWindow(snapshot, nowMs) {
206
+ const resetWindow = selectSnapshotBlockingReset(snapshot, nowMs);
207
+ if (resetWindow) return resetWindow;
208
+ return readWindowEntries(snapshot).map((entry) => entry.window).filter((window) => window.usedPercent !== void 0 && window.usedPercent >= 100).toSorted((left, right) => (right.windowDurationMins ?? 0) - (left.windowDurationMins ?? 0))[0];
209
+ }
194
210
  function readWindowEntries(snapshot) {
195
211
  return LIMIT_WINDOW_KEYS.flatMap((key) => {
196
212
  const window = readRateLimitWindow(snapshot, key);
@@ -288,8 +304,7 @@ function readNullableString(record, key) {
288
304
  return readString$2(record, key) ?? void 0;
289
305
  }
290
306
  function readNumber(record, key) {
291
- const value = record[key];
292
- return typeof value === "number" && Number.isFinite(value) ? value : void 0;
307
+ return asFiniteNumber(record[key]);
293
308
  }
294
309
  function normalizeText(value) {
295
310
  const text = value?.trim();
@@ -1,4 +1,4 @@
1
- import AjvPkg from "ajv";
1
+ import { Compile } from "typebox/compile";
2
2
  //#region extensions/codex/src/app-server/protocol-generated/json/DynamicToolCallParams.json
3
3
  var DynamicToolCallParams_default = {
4
4
  $schema: "http://json-schema.org/draft-07/schema#",
@@ -5856,52 +5856,158 @@ var TurnStartResponse_default = {
5856
5856
  };
5857
5857
  //#endregion
5858
5858
  //#region extensions/codex/src/app-server/protocol-validators.ts
5859
- const ajv = new AjvPkg({
5860
- allErrors: true,
5861
- strict: false,
5862
- useDefaults: true,
5863
- validateFormats: false
5864
- });
5865
- const validateDynamicToolCallParams = ajv.compile(DynamicToolCallParams_default);
5866
- const validateErrorNotification = ajv.compile(ErrorNotification_default);
5867
- const validateModelListResponse = ajv.compile(ModelListResponse_default);
5868
- const validateThreadResumeResponse = ajv.compile(ThreadResumeResponse_default);
5869
- const validateThreadStartResponse = ajv.compile(ThreadStartResponse_default);
5870
- const validateTurnCompletedNotification = ajv.compile(TurnCompletedNotification_default);
5871
- const validateTurnStartResponse = ajv.compile(TurnStartResponse_default);
5859
+ function compileCodexSchema(schema) {
5860
+ const validator = Compile(normalizeJsonSchemaNode(schema));
5861
+ return {
5862
+ check: (value) => validator.Check(value),
5863
+ errors: (value) => [...validator.Errors(value)]
5864
+ };
5865
+ }
5866
+ function isRecord(value) {
5867
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
5868
+ }
5869
+ const schemaMapKeywords = new Set([
5870
+ "$defs",
5871
+ "definitions",
5872
+ "dependentSchemas",
5873
+ "patternProperties",
5874
+ "properties"
5875
+ ]);
5876
+ const schemaValueKeywords = new Set([
5877
+ "additionalItems",
5878
+ "additionalProperties",
5879
+ "contains",
5880
+ "else",
5881
+ "if",
5882
+ "items",
5883
+ "not",
5884
+ "propertyNames",
5885
+ "then",
5886
+ "unevaluatedItems",
5887
+ "unevaluatedProperties"
5888
+ ]);
5889
+ const schemaArrayKeywords = new Set([
5890
+ "allOf",
5891
+ "anyOf",
5892
+ "oneOf",
5893
+ "prefixItems"
5894
+ ]);
5895
+ function schemaTypeIncludes(schema, type) {
5896
+ return schema.type === type || Array.isArray(schema.type) && schema.type.includes(type);
5897
+ }
5898
+ function normalizeSchemaMap(value) {
5899
+ if (!isRecord(value)) return value;
5900
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, normalizeJsonSchemaNode(entry)]));
5901
+ }
5902
+ function expandJsonSchemaTypeArray(schema) {
5903
+ const { type, ...rest } = schema;
5904
+ if (!Array.isArray(type)) return schema;
5905
+ return { anyOf: type.map((entry) => Object.assign({}, rest, { type: entry })) };
5906
+ }
5907
+ function normalizeJsonSchemaNode(schema) {
5908
+ if (Array.isArray(schema)) return schema.map((entry) => normalizeJsonSchemaNode(entry));
5909
+ if (!isRecord(schema)) return schema;
5910
+ const normalizedSchema = expandJsonSchemaTypeArray(schema);
5911
+ return Object.fromEntries(Object.entries(normalizedSchema).map(([key, value]) => {
5912
+ if (schemaMapKeywords.has(key)) return [key, normalizeSchemaMap(value)];
5913
+ if (schemaValueKeywords.has(key) || schemaArrayKeywords.has(key)) return [key, normalizeJsonSchemaNode(value)];
5914
+ return [key, value];
5915
+ }));
5916
+ }
5917
+ function readDefault(schema) {
5918
+ if (!isRecord(schema) || !Object.prototype.hasOwnProperty.call(schema, "default")) return;
5919
+ return structuredClone(schema.default);
5920
+ }
5921
+ function decodePointerSegment(segment) {
5922
+ return segment.replace(/~1/g, "/").replace(/~0/g, "~");
5923
+ }
5924
+ function resolveLocalRef(root, ref) {
5925
+ if (ref === "#") return root;
5926
+ if (!ref.startsWith("#/")) return;
5927
+ let current = root;
5928
+ for (const segment of ref.slice(2).split("/").map(decodePointerSegment)) {
5929
+ if (!isRecord(current)) return;
5930
+ current = current[segment];
5931
+ }
5932
+ return current;
5933
+ }
5934
+ function applySchemaDefaults(schema, value, root = schema, resolvingRefs = /* @__PURE__ */ new Set()) {
5935
+ if (value === void 0) {
5936
+ const defaultValue = readDefault(schema);
5937
+ if (defaultValue !== void 0) return defaultValue;
5938
+ }
5939
+ if (!isRecord(schema)) return value;
5940
+ let nextValue = value;
5941
+ if (typeof schema.$ref === "string" && !resolvingRefs.has(schema.$ref)) {
5942
+ const target = resolveLocalRef(root, schema.$ref);
5943
+ if (target !== void 0) {
5944
+ resolvingRefs.add(schema.$ref);
5945
+ nextValue = applySchemaDefaults(target, nextValue, root, resolvingRefs);
5946
+ resolvingRefs.delete(schema.$ref);
5947
+ }
5948
+ }
5949
+ for (const key of ["allOf"]) {
5950
+ const branches = schema[key];
5951
+ if (Array.isArray(branches)) for (const branch of branches) nextValue = applySchemaDefaults(branch, nextValue, root, resolvingRefs);
5952
+ }
5953
+ if (schemaTypeIncludes(schema, "object") && isRecord(nextValue) && isRecord(schema.properties)) {
5954
+ for (const [key, propertySchema] of Object.entries(schema.properties)) {
5955
+ const currentValue = nextValue[key];
5956
+ const defaultedValue = applySchemaDefaults(propertySchema, currentValue, root, resolvingRefs);
5957
+ if (defaultedValue !== void 0 && defaultedValue !== currentValue) nextValue[key] = defaultedValue;
5958
+ }
5959
+ if (isRecord(schema.additionalProperties)) for (const key of Object.keys(nextValue)) {
5960
+ if (Object.prototype.hasOwnProperty.call(schema.properties, key)) continue;
5961
+ nextValue[key] = applySchemaDefaults(schema.additionalProperties, nextValue[key], root, resolvingRefs);
5962
+ }
5963
+ }
5964
+ if (schemaTypeIncludes(schema, "array") && Array.isArray(nextValue) && isRecord(schema.items)) return nextValue.map((entry) => applySchemaDefaults(schema.items, entry, root, resolvingRefs));
5965
+ return nextValue;
5966
+ }
5967
+ function normalizeWithDefaults(schema, value) {
5968
+ if (value === void 0 || value === null) return value;
5969
+ return applySchemaDefaults(schema, structuredClone(value));
5970
+ }
5971
+ const validateDynamicToolCallParams = compileCodexSchema(DynamicToolCallParams_default);
5972
+ const validateErrorNotification = compileCodexSchema(ErrorNotification_default);
5973
+ const validateModelListResponse = compileCodexSchema(ModelListResponse_default);
5974
+ const validateThreadResumeResponse = compileCodexSchema(ThreadResumeResponse_default);
5975
+ const validateThreadStartResponse = compileCodexSchema(ThreadStartResponse_default);
5976
+ const validateTurnCompletedNotification = compileCodexSchema(TurnCompletedNotification_default);
5977
+ const validateTurnStartResponse = compileCodexSchema(TurnStartResponse_default);
5872
5978
  function assertCodexThreadStartResponse(value) {
5873
- return assertCodexShape(validateThreadStartResponse, normalizeThreadResponse(value), "thread/start response");
5979
+ return assertCodexShape(validateThreadStartResponse, normalizeWithDefaults(ThreadStartResponse_default, normalizeThreadResponse(value)), "thread/start response");
5874
5980
  }
5875
5981
  function assertCodexThreadForkResponse(value) {
5876
- return assertCodexShape(validateThreadStartResponse, normalizeThreadResponse(value), "thread/fork response");
5982
+ return assertCodexShape(validateThreadStartResponse, normalizeWithDefaults(ThreadStartResponse_default, normalizeThreadResponse(value)), "thread/fork response");
5877
5983
  }
5878
5984
  function assertCodexThreadResumeResponse(value) {
5879
- return assertCodexShape(validateThreadResumeResponse, normalizeThreadResponse(value), "thread/resume response");
5985
+ return assertCodexShape(validateThreadResumeResponse, normalizeWithDefaults(ThreadResumeResponse_default, normalizeThreadResponse(value)), "thread/resume response");
5880
5986
  }
5881
5987
  function assertCodexTurnStartResponse(value) {
5882
- return assertCodexShape(validateTurnStartResponse, normalizeTurnStartResponse(value), "turn/start response");
5988
+ return assertCodexShape(validateTurnStartResponse, normalizeWithDefaults(TurnStartResponse_default, normalizeTurnStartResponse(value)), "turn/start response");
5883
5989
  }
5884
5990
  function readCodexDynamicToolCallParams(value) {
5885
- return readCodexShape(validateDynamicToolCallParams, value);
5991
+ return readCodexShape(validateDynamicToolCallParams, normalizeWithDefaults(DynamicToolCallParams_default, value));
5886
5992
  }
5887
5993
  function readCodexErrorNotification(value) {
5888
- return readCodexShape(validateErrorNotification, value);
5994
+ return readCodexShape(validateErrorNotification, normalizeWithDefaults(ErrorNotification_default, value));
5889
5995
  }
5890
5996
  function readCodexModelListResponse(value) {
5891
- return readCodexShape(validateModelListResponse, value);
5997
+ return readCodexShape(validateModelListResponse, normalizeWithDefaults(ModelListResponse_default, value));
5892
5998
  }
5893
5999
  function readCodexTurn(value) {
5894
- return readCodexShape(validateTurnStartResponse, { turn: normalizeTurn(value) })?.turn;
6000
+ return readCodexShape(validateTurnStartResponse, normalizeWithDefaults(TurnStartResponse_default, { turn: normalizeTurn(value) }))?.turn;
5895
6001
  }
5896
6002
  function readCodexTurnCompletedNotification(value) {
5897
- return readCodexShape(validateTurnCompletedNotification, normalizeTurnCompletedNotification(value));
6003
+ return readCodexShape(validateTurnCompletedNotification, normalizeWithDefaults(TurnCompletedNotification_default, normalizeTurnCompletedNotification(value)));
5898
6004
  }
5899
6005
  function assertCodexShape(validate, value, label) {
5900
- if (validate(value)) return value;
5901
- throw new Error(`Invalid Codex app-server ${label}: ${formatAjvErrors(validate)}`);
6006
+ if (validate.check(value)) return value;
6007
+ throw new Error(`Invalid Codex app-server ${label}: ${formatValidationErrors(validate, value)}`);
5902
6008
  }
5903
6009
  function readCodexShape(validate, value) {
5904
- return validate(value) ? value : void 0;
6010
+ return validate.check(value) ? value : void 0;
5905
6011
  }
5906
6012
  function normalizeTurn(value) {
5907
6013
  if (!value || typeof value !== "object" || Array.isArray(value)) return value;
@@ -5979,10 +6085,13 @@ function normalizeTurnCompletedNotification(value) {
5979
6085
  turn: normalizeTurn(value.turn)
5980
6086
  };
5981
6087
  }
5982
- function formatAjvErrors(validate) {
5983
- const errors = validate.errors;
6088
+ function formatValidationErrors(validate, value) {
6089
+ const errors = validate.errors(value);
5984
6090
  if (!errors || errors.length === 0) return "schema validation failed";
5985
- return ajv.errorsText(errors, { separator: "; " });
6091
+ return errors.map((error) => {
6092
+ const message = error.message?.trim() || "schema validation failed";
6093
+ return error.instancePath ? `${error.instancePath} ${message}` : message;
6094
+ }).join("; ");
5986
6095
  }
5987
6096
  //#endregion
5988
6097
  export { readCodexDynamicToolCallParams as a, readCodexTurn as c, assertCodexTurnStartResponse as i, readCodexTurnCompletedNotification as l, assertCodexThreadResumeResponse as n, readCodexErrorNotification as o, assertCodexThreadStartResponse as r, readCodexModelListResponse as s, assertCodexThreadForkResponse as t };
package/dist/provider.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CODEX_APP_SERVER_AUTH_MARKER, CODEX_BASE_URL, CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS, buildCodexModelDefinition, buildCodexProviderConfig } from "./provider-catalog.js";
2
- import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions } from "./config-DDMrwfJl.js";
2
+ import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
3
3
  import { resolveCodexSystemPromptContribution } from "./prompt-overlay.js";
4
4
  import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
5
5
  import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-model-shared";
@@ -123,7 +123,7 @@ async function listModelsBestEffort(params) {
123
123
  }
124
124
  }
125
125
  async function listCodexAppServerModelsLazy(options) {
126
- const { listCodexAppServerModels } = await import("./models-DtGLkqMP.js").then((n) => n.r);
126
+ const { listCodexAppServerModels } = await import("./models-ASKu9eOY.js").then((n) => n.r);
127
127
  return listCodexAppServerModels(options);
128
128
  }
129
129
  function normalizeTimeoutMs(value) {
@@ -144,7 +144,7 @@ function isKnownXHighCodexModel(modelId) {
144
144
  }
145
145
  function isModernCodexModel(modelId) {
146
146
  const lower = modelId.trim().toLowerCase();
147
- return lower === "gpt-5.5" || lower === "gpt-5.4" || lower === "gpt-5.4-mini";
147
+ return lower === "gpt-5.5" || lower === "gpt-5.4" || lower === "gpt-5.4-mini" || lower === "gpt-5.3-codex-spark";
148
148
  }
149
149
  //#endregion
150
150
  export { buildCodexProvider, buildCodexProviderCatalog, isModernCodexModel };
@@ -1,6 +1,6 @@
1
- import { n as CodexAppServerRpcError } from "./client-1sSy4p3z.js";
2
- import { b as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-DGoaguJh.js";
3
- import { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-CFCUGEVs.js";
1
+ import { n as CodexAppServerRpcError } from "./client-BVK_jmHW.js";
2
+ import { S as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-BapIT9Qs.js";
3
+ import { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-Fou5nAyt.js";
4
4
  import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-CTnEWuor.js";
5
5
  import { createHash } from "node:crypto";
6
6
  //#region extensions/codex/src/app-server/capabilities.ts