@openclaw/codex 2026.8.1 → 2026.8.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.
Files changed (67) hide show
  1. package/dist/{attempt-client-cleanup-CVPvp9dL.js → .setup/attempt-client-cleanup-FBnDjmtX.mjs} +1 -1
  2. package/dist/{auth-binding-Ds_QVm-X.js → .setup/auth-binding-oyIUSaFi.mjs} +1 -1
  3. package/dist/{binding-connection-CCQFs8lf.js → .setup/binding-connection-BgiXAp29.mjs} +2 -2
  4. package/dist/{bounded-turn-rq5tiSXk.js → .setup/bounded-turn-kWYLbaDH.mjs} +12 -11
  5. package/dist/{capabilities-CGm_94eL.js → .setup/capabilities-oLHKpYRj.mjs} +1 -1
  6. package/dist/{command-formatters-C54Yg3eA.js → .setup/command-formatters-DylXEqck.mjs} +4 -3
  7. package/dist/{command-handlers-BvOAHTrA.js → .setup/command-handlers-PRe4WEmx.mjs} +42 -34
  8. package/dist/{compact-Hd7SAc0N.js → .setup/compact-K2iOmzQp.mjs} +14 -12
  9. package/dist/{config-Cxw3Cl3k.js → .setup/config-ClwHKKTN.mjs} +7 -5
  10. package/dist/{conversation-binding-data-CW2GuupV.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +3 -2
  11. package/dist/{dynamic-tools-BFoUcRdx.js → .setup/dynamic-tools-XNStyzzb.mjs} +105 -108
  12. package/dist/{effective-mcp-catalog-BTJHnDSx.js → .setup/effective-mcp-catalog-BHpifbgx.mjs} +2 -2
  13. package/dist/{event-projector-assistant-message-C5-Ds8mA.js → .setup/event-projector-assistant-message-BCnzlajn.mjs} +1 -1
  14. package/dist/{event-projector-usage-D3PHFFXh.js → .setup/event-projector-usage-h7P0Raok.mjs} +7 -12
  15. package/dist/{harness-DVfUQBlQ.js → .setup/harness-CawBdltH.mjs} +14 -14
  16. package/dist/{isolated-completion-Cbbx_5Ed.js → .setup/isolated-completion-rL3zrcAe.mjs} +4 -4
  17. package/dist/{managed-binary-ZkGodW19.js → .setup/managed-binary-DlGr2kYu.mjs} +1 -1
  18. package/dist/{model-catalog-o6Cgjoss.js → .setup/model-catalog--miA1cod.mjs} +5 -5
  19. package/dist/{models-DgFWSuxA.js → .setup/models-BNPc8Vr2.mjs} +5 -4
  20. package/dist/{native-subagent-monitor-CwFyoylz.js → .setup/native-subagent-monitor-mhFvLcPG.mjs} +25 -105
  21. package/dist/{node-exec-server.runtime-DXrqpw1c.js → .setup/node-exec-server.runtime-BmAZPmrd.mjs} +3 -3
  22. package/dist/{plugin-approval-roundtrip-D80UZiJ_.js → .setup/plugin-approval-roundtrip-Dlq4n0n8.mjs} +2 -1
  23. package/dist/{plugin-marketplace-discovery-mdmScYOj.js → .setup/plugin-marketplace-discovery-KyJdBtCC.mjs} +14 -13
  24. package/dist/{plugin-metadata-cache-CulOABwu.js → .setup/plugin-metadata-cache-RRQ_VJrs.mjs} +6 -6
  25. package/dist/{rate-limits-hFtzt2Up.js → .setup/rate-limits-CQUmEcUk.mjs} +3 -2
  26. package/dist/{request-CCm4LaED.js → .setup/request-fEUi95EK.mjs} +3 -3
  27. package/dist/{run-attempt-BwNQDH2u.js → .setup/run-attempt-BJ6tOQeE.mjs} +138 -187
  28. package/dist/{runtime-artifact-DeBvleJw.js → .setup/runtime-artifact-D0ssVSlz.mjs} +3 -3
  29. package/dist/{session-binding-q2WSTVmC.js → .setup/session-binding-Bd9dh1Er.mjs} +3 -3
  30. package/dist/{session-catalog-C2Tae4rI.js → .setup/session-catalog-eQhJDU41.mjs} +234 -206
  31. package/dist/{session-catalog-home-id-DAKUrm3C.js → .setup/session-catalog-home-id-CjyBDShn.mjs} +3 -3
  32. package/dist/{session-cli-BuDjm5Ou.js → .setup/session-cli-mJePHTAs.mjs} +1 -1
  33. package/dist/.setup/session-history-Cg8PzgeU.mjs +87 -0
  34. package/dist/{session-permission-policy-gLm40Vtq.js → .setup/session-permission-policy-C0bdhR_I.mjs} +1 -1
  35. package/dist/{session-retirement-CdkI0bvb.js → .setup/session-retirement-osjW6zy5.mjs} +4 -4
  36. package/dist/{session-upstream-marker-Bcy33kam.js → .setup/session-upstream-marker-CIgMzZku.mjs} +1 -1
  37. package/dist/.setup/settled-turn-context-OxoGQWJK.mjs +290 -0
  38. package/dist/.setup/settled-turn-finalizer-D9SoKTb-.mjs +104 -0
  39. package/dist/{shared-client-kNkljY-R.js → .setup/shared-client-DG1kAfGq.mjs} +37 -39
  40. package/dist/{side-question-GwD73tX6.js → .setup/side-question-Bi9chAvD.mjs} +25 -17
  41. package/dist/{thread-lifecycle-Ss-uwnC4.js → .setup/thread-lifecycle-Cc6I-gbl.mjs} +273 -232
  42. package/dist/{thread-ownership-CeYBqg_4.js → .setup/thread-ownership-B3vjUi0P.mjs} +2 -2
  43. package/dist/{thread-resume-DF54hagX.js → .setup/thread-resume-OMjvue9F.mjs} +8 -7
  44. package/dist/{transcript-mirror-CkEQIna-.js → .setup/transcript-mirror-DN-ed7Kf.mjs} +14 -7
  45. package/dist/{transport-stdio-C7-s9TLG.js → .setup/transport-stdio-Cu0xKDRo.mjs} +41 -25
  46. package/dist/{upstream-prompt-provenance-CFmsKwr9.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +8 -4
  47. package/dist/{upstream-session-fork-BACGlOFa.js → .setup/upstream-session-fork-DL7QQ1e_.mjs} +14 -20
  48. package/dist/{usage-C2l8Mils.js → .setup/usage-dsPLHd8O.mjs} +3 -3
  49. package/dist/{web-search-provider.runtime-B2XgRdFv.js → .setup/web-search-provider.runtime-BRH3ahFN.mjs} +3 -3
  50. package/dist/api.js +4 -4
  51. package/dist/cli-metadata.js +1 -1
  52. package/dist/doctor-contract-api.js +9 -5
  53. package/dist/harness.js +1 -1
  54. package/dist/index.js +60 -41
  55. package/dist/media-understanding-provider.js +1 -1
  56. package/dist/web-search-contract-api.js +1 -1
  57. package/package.json +6 -6
  58. package/dist/settled-turn-finalizer-B8JJcxCi.js +0 -329
  59. /package/dist/{context-compaction-activity-BOeJf7yo.js → .setup/context-compaction-activity-BOeJf7yo.mjs} +0 -0
  60. /package/dist/{elicitation-input-DMkeki8d.js → .setup/elicitation-input-DMkeki8d.mjs} +0 -0
  61. /package/dist/{image-payload-sanitizer-CnfoUPCE.js → .setup/image-payload-sanitizer-CnfoUPCE.mjs} +0 -0
  62. /package/dist/{launch-args-sXOAg0SX.js → .setup/launch-args-sXOAg0SX.mjs} +0 -0
  63. /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
  64. /package/dist/{protocol-validators-Bg5rpNxk.js → .setup/protocol-validators-Bg5rpNxk.mjs} +0 -0
  65. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  66. /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
  67. /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
@@ -1,5 +1,5 @@
1
- import { Ct as retainCodexAppServerLiveThread, St as releaseCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientByInstanceId, bt as isCodexAppServerLiveThreadClaimed } from "./shared-client-kNkljY-R.js";
2
- import { a as closeCodexStartupClientBestEffort, f as unsubscribeCodexThreadBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-CVPvp9dL.js";
1
+ import { Ct as retainCodexAppServerLiveThread, St as releaseCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientByInstanceId, bt as isCodexAppServerLiveThreadClaimed } from "./shared-client-DG1kAfGq.mjs";
2
+ import { a as closeCodexStartupClientBestEffort, f as unsubscribeCodexThreadBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-FBnDjmtX.mjs";
3
3
  import { isIncognitoSessionKey } from "openclaw/plugin-sdk/routing";
4
4
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
5
5
  //#region extensions/codex/src/app-server/thread-ownership.ts
@@ -1,8 +1,8 @@
1
- import { F as resolveCodexAppServerLocalHomeDir, I as resolveCodexAppServerUserHomeDir, P as resolveCodexAppServerHomeDir } from "./config-Cxw3Cl3k.js";
2
- import { $ as CodexAppServerRpcError, J as isCodexAppServerOverloadError, P as isCodexAppServerStartupError, Y as isCodexAppServerPrewriteRequestCancellationError, u as isCodexAppServerStartSelectionChangedError } from "./shared-client-kNkljY-R.js";
3
- import { o as assertCodexThreadResumeResponse } from "./protocol-validators-Bg5rpNxk.js";
4
- import { f as unsubscribeCodexThreadBestEffort, i as assertCodexThreadResumeSubscription, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-CVPvp9dL.js";
5
- import { t as CodexAppServerScopedRequestRejectedError } from "./request-CCm4LaED.js";
1
+ import { F as resolveCodexAppServerLocalHomeDir, I as resolveCodexAppServerUserHomeDir, P as resolveCodexAppServerHomeDir } from "./config-ClwHKKTN.mjs";
2
+ import { $ as CodexAppServerRpcError, J as isCodexAppServerOverloadError, P as isCodexAppServerStartupError, Y as isCodexAppServerPrewriteRequestCancellationError, u as isCodexAppServerStartSelectionChangedError } from "./shared-client-DG1kAfGq.mjs";
3
+ import { o as assertCodexThreadResumeResponse } from "./protocol-validators-Bg5rpNxk.mjs";
4
+ import { f as unsubscribeCodexThreadBestEffort, i as assertCodexThreadResumeSubscription, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-FBnDjmtX.mjs";
5
+ import { t as CodexAppServerScopedRequestRejectedError } from "./request-fEUi95EK.mjs";
6
6
  import { createRequire } from "node:module";
7
7
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { readPluginPackageVersion } from "openclaw/plugin-sdk/extension-shared";
@@ -16,7 +16,7 @@ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
16
16
  * identity and safe to refresh in the background.
17
17
  */
18
18
  /** Default app inventory cache freshness window. */
19
- const CODEX_APP_INVENTORY_CACHE_TTL_MS = 3600 * 1e3;
19
+ const CODEX_APP_INVENTORY_CACHE_TTL_MS = 36e5;
20
20
  const CODEX_APP_READ_BATCH_LIMIT = 100;
21
21
  const MAX_SERIALIZED_ERROR_MESSAGE_LENGTH = 500;
22
22
  /** In-memory app inventory cache with coalesced refreshes per key. */
@@ -337,7 +337,8 @@ function isSensitiveErrorDataKey(key) {
337
337
  * Builds stable Codex plugin/app inventory cache keys from app-server startup,
338
338
  * auth, account, and version inputs without storing secret material.
339
339
  */
340
- const CODEX_PLUGIN_VERSION = readPluginPackageVersion({ require: createRequire(import.meta.url) });
340
+ const require = createRequire(import.meta.url);
341
+ const CODEX_PLUGIN_VERSION = readPluginPackageVersion({ require });
341
342
  let catalogConnectionHomes = /* @__PURE__ */ new Map();
342
343
  function catalogConnectionHomeKey(fingerprint, agentDir) {
343
344
  return `${agentDir ?? ""}\0${fingerprint}`;
@@ -1,4 +1,4 @@
1
- import { i as readUpstreamUserText, n as attachUpstreamUserText, r as readMirrorIdentity, t as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-CFmsKwr9.js";
1
+ import { i as readUpstreamUserText, n as attachUpstreamUserText, r as readMirrorIdentity, t as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-LphB8slG.mjs";
2
2
  import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { deliverAgentHarnessUserInputPrompt, embeddedAgentLog, formatErrorMessage, projectAgentHarnessTranscriptMessageForDisplay, runAgentHarnessBeforeMessageWriteHook } from "openclaw/plugin-sdk/agent-harness-runtime";
4
4
  import { createHash } from "node:crypto";
@@ -8,8 +8,8 @@ import { publishSessionTranscriptUpdateByIdentity } from "openclaw/plugin-sdk/se
8
8
  import { Buffer } from "node:buffer";
9
9
  //#region extensions/codex/src/app-server/transcript-history-projection.ts
10
10
  const CODEX_HISTORY_IMPORT_MAX_MESSAGES = 200;
11
- const CODEX_HISTORY_IMPORT_MAX_BYTES = 512 * 1024;
12
- const CODEX_HISTORY_IMPORT_MAX_MESSAGE_BYTES = 64 * 1024;
11
+ const CODEX_HISTORY_IMPORT_MAX_BYTES = 524288;
12
+ const CODEX_HISTORY_IMPORT_MAX_MESSAGE_BYTES = 65536;
13
13
  const CODEX_HISTORY_TRUNCATION_SUFFIX = "\n\n[Message truncated during Codex history import.]";
14
14
  const CODEX_HISTORY_ASSISTANT_API = "openai-chatgpt-responses";
15
15
  const CODEX_HISTORY_ASSISTANT_PROVIDER = "openai";
@@ -34,7 +34,8 @@ function normalizeImportedHistoryText(value) {
34
34
  if (!text) return;
35
35
  if (Buffer.byteLength(text, "utf8") <= CODEX_HISTORY_IMPORT_MAX_MESSAGE_BYTES) return text;
36
36
  const suffixBytes = Buffer.byteLength(CODEX_HISTORY_TRUNCATION_SUFFIX, "utf8");
37
- return `${truncateUtf8Prefix(text, Math.max(0, CODEX_HISTORY_IMPORT_MAX_MESSAGE_BYTES - suffixBytes))}${CODEX_HISTORY_TRUNCATION_SUFFIX}`;
37
+ const contentLimitBytes = Math.max(0, CODEX_HISTORY_IMPORT_MAX_MESSAGE_BYTES - suffixBytes);
38
+ return `${truncateUtf8Prefix(text, contentLimitBytes)}${CODEX_HISTORY_TRUNCATION_SUFFIX}`;
38
39
  }
39
40
  function projectCodexUserItemText(item) {
40
41
  if (!Array.isArray(item.content)) return;
@@ -183,7 +184,8 @@ function applyCodexTranscriptTaint(message, state) {
183
184
  state.tainted = false;
184
185
  return message;
185
186
  }
186
- const metadata = asOptionalRecord(CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0);
187
+ const existing = CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0;
188
+ const metadata = asOptionalRecord(existing);
187
189
  state.tainted ||= metadata?.turnTainted === true || metadata?.resultContentSource === "network";
188
190
  return message.role === "assistant" && state.tainted ? {
189
191
  ...message,
@@ -206,7 +208,8 @@ function attachCodexMirrorAttestation(message, sourceFingerprint) {
206
208
  };
207
209
  }
208
210
  function attachCodexMirrorRunId(message, runId, terminal = false) {
209
- const { runTerminal: _staleTerminal, ...current } = asOptionalRecord(CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0) ?? {};
211
+ const existing = CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0;
212
+ const { runTerminal: _staleTerminal, ...current } = asOptionalRecord(existing) ?? {};
210
213
  return {
211
214
  ...message,
212
215
  [CODEX_META_KEY]: {
@@ -216,6 +219,10 @@ function attachCodexMirrorRunId(message, runId, terminal = false) {
216
219
  }
217
220
  };
218
221
  }
222
+ function hasCodexMirrorOrigin(message) {
223
+ const meta = CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0;
224
+ return asOptionalRecord(meta)?.[MIRROR_ORIGIN_META_KEY] === CODEX_APP_SERVER_MIRROR_ORIGIN;
225
+ }
219
226
  function readCodexMirrorSourceFingerprint(message) {
220
227
  const meta = CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0;
221
228
  if (!meta || typeof meta !== "object" || Array.isArray(meta)) return;
@@ -684,4 +691,4 @@ function resolveCodexMirrorTranscriptTarget(params) {
684
691
  };
685
692
  }
686
693
  //#endregion
687
- export { buildCodexUserPromptMessage as a, fingerprintCodexMirrorSourceMessage as c, projectBoundedCodexThreadHistory as d, projectBoundedCodexVisibleSessionHistory as f, mirrorPromptAtTurnStartBestEffort as i, readCodexMirrorSourceFingerprint as l, createCodexAppServerUserMessagePersistenceNotifier as n, promptSnapshot as o, projectCodexUserItemText as p, importCodexThreadHistoryToTranscript as r, applyCodexTranscriptTaint as s, codexTranscriptMirrorRuntime as t, serializeCodexMirrorSourceEvidence as u };
694
+ export { buildCodexUserPromptMessage as a, fingerprintCodexMirrorSourceMessage as c, serializeCodexMirrorSourceEvidence as d, projectBoundedCodexThreadHistory as f, mirrorPromptAtTurnStartBestEffort as i, hasCodexMirrorOrigin as l, projectCodexUserItemText as m, createCodexAppServerUserMessagePersistenceNotifier as n, promptSnapshot as o, projectBoundedCodexVisibleSessionHistory as p, importCodexThreadHistoryToTranscript as r, applyCodexTranscriptTaint as s, codexTranscriptMirrorRuntime as t, readCodexMirrorSourceFingerprint as u };
@@ -1,15 +1,16 @@
1
- import { t as normalizeCodexAppServerArgs } from "./launch-args-sXOAg0SX.js";
1
+ import { t as normalizeCodexAppServerArgs } from "./launch-args-sXOAg0SX.mjs";
2
2
  import { readFile, readdir } from "node:fs/promises";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
5
5
  import { z } from "zod";
6
6
  import { execFile, spawn } from "node:child_process";
7
7
  import { once } from "node:events";
8
+ import { setImmediate } from "node:timers/promises";
8
9
  import { finished } from "node:stream/promises";
9
10
  //#region extensions/codex/src/app-server/transport-process-snapshot.ts
10
11
  const PROCESS_COLUMNS = "pid=,ppid=,pgid=,stat=,lstart=";
11
12
  const MAX_PROCESS_CONTAINMENT_MS$1 = 2e3;
12
- const PROCESS_INSPECTION_MAX_BYTES = 8 * 1024 * 1024;
13
+ const PROCESS_INSPECTION_MAX_BYTES = 8388608;
13
14
  var ProcessInspectionError = class extends Error {
14
15
  constructor(reason) {
15
16
  const detail = {
@@ -46,24 +47,35 @@ async function readCodexAppServerProcess(pid, deadline) {
46
47
  String(pid)
47
48
  ], deadline)).find((row) => row.pid === pid);
48
49
  }
49
- async function readCodexAppServerProcessCommand(pid, deadline) {
50
+ async function readCodexAppServerProcessCommand(observed, deadline) {
50
51
  let output;
51
52
  if (process.platform === "linux") {
52
- const remainingMs = deadline - Date.now();
53
- if (remainingMs <= 0) throw new ProcessInspectionError("deadline");
54
- try {
55
- output = (await readFile(`/proc/${pid}/cmdline`, {
56
- encoding: "utf8",
57
- signal: AbortSignal.timeout(remainingMs)
58
- })).split("\0").join(" ").trim();
59
- } catch (error) {
60
- throw inspectionFailure(error);
61
- }
53
+ let pending = false;
54
+ do {
55
+ const remainingMs = deadline - Date.now();
56
+ if (remainingMs <= 0) throw new ProcessInspectionError("deadline");
57
+ let command;
58
+ try {
59
+ command = await readFile(`/proc/${observed.pid}/cmdline`, {
60
+ encoding: "utf8",
61
+ signal: AbortSignal.timeout(remainingMs)
62
+ });
63
+ } catch (error) {
64
+ throw inspectionFailure(error);
65
+ }
66
+ if (!command || pending) {
67
+ const current = await readCodexAppServerProcess(observed.pid, deadline);
68
+ if (!current || current.startedAt !== observed.startedAt || current.ppid !== observed.ppid || current.pgid !== observed.pgid || current.state.startsWith("Z")) throw new ProcessInspectionError("unavailable");
69
+ }
70
+ output = command.split("\0").join(" ").trim();
71
+ pending = command.length === 0;
72
+ if (pending) await setImmediate();
73
+ } while (pending);
62
74
  } else output = (await readProcessOutput([
63
75
  "-o",
64
76
  "command=",
65
77
  "-p",
66
- String(pid)
78
+ String(observed.pid)
67
79
  ], deadline)).split("\n")[0]?.trim() ?? "";
68
80
  if (Date.now() >= deadline) throw new ProcessInspectionError("deadline");
69
81
  if (!output) throw new ProcessInspectionError("unavailable");
@@ -253,13 +265,15 @@ async function containDescendants(child, expected, deadline = Date.now() + MAX_P
253
265
  }
254
266
  };
255
267
  } finally {
256
- if (resumeRootOnUnwind) if (expected) {
257
- const releaseDeadline = Date.now() + MAX_PROCESS_CONTAINMENT_MS;
258
- for (const descendant of stoppedDescendants.values()) await signalSameProcess(descendant, "SIGCONT", releaseDeadline);
259
- await signalSameRoot(root, "SIGCONT", releaseDeadline);
260
- } else {
261
- for (const descendant of stoppedDescendants.values()) signalProcess(descendant.pid, "SIGCONT");
262
- resumeTransportRoot(child, root, true);
268
+ if (resumeRootOnUnwind) {
269
+ if (expected) {
270
+ const releaseDeadline = Date.now() + MAX_PROCESS_CONTAINMENT_MS;
271
+ for (const descendant of stoppedDescendants.values()) await signalSameProcess(descendant, "SIGCONT", releaseDeadline);
272
+ await signalSameRoot(root, "SIGCONT", releaseDeadline);
273
+ } else {
274
+ for (const descendant of stoppedDescendants.values()) signalProcess(descendant.pid, "SIGCONT");
275
+ resumeTransportRoot(child, root, true);
276
+ }
263
277
  }
264
278
  }
265
279
  }
@@ -425,7 +439,7 @@ async function reapRegisteredCodexAppServerOrphans(requestedDeadline) {
425
439
  if (registration.child.commandFingerprint !== void 0 && child?.startedAt === registration.child.startedAt && !child.state.startsWith("Z")) {
426
440
  let command;
427
441
  try {
428
- command = await readCodexAppServerProcessCommand(registration.child.pid, deadline);
442
+ command = await readCodexAppServerProcessCommand(child, deadline);
429
443
  } catch (error) {
430
444
  if ((await readCodexAppServerProcessSnapshot(deadline, [registration.child.pid])).find((row) => row.pid === registration.child.pid)?.startedAt === registration.child.startedAt) throw error;
431
445
  }
@@ -467,7 +481,7 @@ async function prepareCodexAppServerProcessRegistration() {
467
481
  const parent = snapshot.find((row) => row.pid === process.pid);
468
482
  const spawned = snapshot.find((row) => row.pid === child.pid);
469
483
  if (!parent || !spawned || spawned.ppid !== process.pid) throw new Error("Cannot register the Codex child process: its direct-parent identity is unavailable. Retry.");
470
- const command = await readCodexAppServerProcessCommand(spawned.pid, Date.now() + 2e3);
484
+ const command = await readCodexAppServerProcessCommand(spawned, Date.now() + 2e3);
471
485
  if (child.exitCode !== null || child.signalCode !== null) throw new Error("Cannot register the Codex child process command: the child exited during inspection. Retry.");
472
486
  const key = randomUUID();
473
487
  store.register(key, {
@@ -622,13 +636,15 @@ const DEFAULT_SPAWN_RUNTIME = {
622
636
  /** Resolves the concrete command/argv/shell settings used to spawn Codex app-server. */
623
637
  function resolveCodexAppServerSpawnInvocation(options, runtime = DEFAULT_SPAWN_RUNTIME) {
624
638
  if (options.commandSource === "managed") throw new Error("Managed Codex app-server start options must be resolved before spawn.");
625
- const resolved = materializeWindowsSpawnProgram(resolveWindowsSpawnProgram({
639
+ const program = resolveWindowsSpawnProgram({
626
640
  command: options.command,
627
641
  platform: runtime.platform,
628
642
  env: runtime.env,
629
643
  execPath: runtime.execPath,
630
644
  packageName: "@openai/codex"
631
- }), normalizeCodexAppServerArgs(options.args));
645
+ });
646
+ const args = normalizeCodexAppServerArgs(options.args);
647
+ const resolved = materializeWindowsSpawnProgram(program, args);
632
648
  return {
633
649
  command: resolved.command,
634
650
  args: resolved.argv,
@@ -4,7 +4,8 @@ const UPSTREAM_USER_TEXT_META_KEY = "upstreamUserText";
4
4
  const MIRROR_IDENTITY_META_KEY = "mirrorIdentity";
5
5
  const CODEX_META_KEY = "__openclaw";
6
6
  function attachCodexMirrorIdentity(message, identity) {
7
- const baseMeta = asOptionalRecord(CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0) ?? {};
7
+ const existing = CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0;
8
+ const baseMeta = asOptionalRecord(existing) ?? {};
8
9
  return {
9
10
  ...message,
10
11
  __openclaw: {
@@ -14,13 +15,15 @@ function attachCodexMirrorIdentity(message, identity) {
14
15
  };
15
16
  }
16
17
  function readMirrorIdentity(message) {
17
- const record = asOptionalRecord(CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0);
18
+ const meta = CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0;
19
+ const record = asOptionalRecord(meta);
18
20
  if (!record) return;
19
21
  const id = record[MIRROR_IDENTITY_META_KEY];
20
22
  return typeof id === "string" && id ? id : void 0;
21
23
  }
22
24
  function attachUpstreamUserText(message, text) {
23
- const baseMeta = asOptionalRecord(CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0) ?? {};
25
+ const existing = CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0;
26
+ const baseMeta = asOptionalRecord(existing) ?? {};
24
27
  return {
25
28
  ...message,
26
29
  __openclaw: {
@@ -30,7 +33,8 @@ function attachUpstreamUserText(message, text) {
30
33
  };
31
34
  }
32
35
  function readUpstreamUserText(message) {
33
- const record = asOptionalRecord(message && CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0);
36
+ const meta = message && CODEX_META_KEY in message ? message[CODEX_META_KEY] : void 0;
37
+ const record = asOptionalRecord(meta);
34
38
  if (!record) return;
35
39
  const text = record[UPSTREAM_USER_TEXT_META_KEY];
36
40
  return typeof text === "string" && text ? text : void 0;
@@ -1,8 +1,8 @@
1
- import { d as sessionBindingIdentity } from "./session-binding-q2WSTVmC.js";
2
- import { a as assertCodexThreadForkResponse } from "./protocol-validators-Bg5rpNxk.js";
3
- import { i as readUpstreamUserText, r as readMirrorIdentity } from "./upstream-prompt-provenance-CFmsKwr9.js";
4
- import { c as fingerprintCodexMirrorSourceMessage, l as readCodexMirrorSourceFingerprint, p as projectCodexUserItemText } from "./transcript-mirror-CkEQIna-.js";
5
- import { i as createImportedCodexSession, n as codexUpstreamBaseline, t as codexLastTerminalTurnId } from "./session-upstream-marker-Bcy33kam.js";
1
+ import { d as sessionBindingIdentity } from "./session-binding-Bd9dh1Er.mjs";
2
+ import { a as assertCodexThreadForkResponse } from "./protocol-validators-Bg5rpNxk.mjs";
3
+ import { i as readUpstreamUserText, r as readMirrorIdentity } from "./upstream-prompt-provenance-LphB8slG.mjs";
4
+ import { c as fingerprintCodexMirrorSourceMessage, m as projectCodexUserItemText, u as readCodexMirrorSourceFingerprint } from "./transcript-mirror-DN-ed7Kf.mjs";
5
+ import { i as createImportedCodexSession, n as codexUpstreamBaseline, t as codexLastTerminalTurnId } from "./session-upstream-marker-CIgMzZku.mjs";
6
6
  import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import { readVisibleSessionTranscriptMessageEntries } from "openclaw/plugin-sdk/session-transcript-runtime";
8
8
  import { deleteSessionUpstreamLink, upsertSessionUpstreamLink } from "openclaw/plugin-sdk/session-catalog";
@@ -15,10 +15,7 @@ function failure(code, message) {
15
15
  message
16
16
  };
17
17
  }
18
- function asInputs(item) {
19
- return Array.isArray(item.content) ? item.content : [];
20
- }
21
- function localMessageText(content) {
18
+ function textOnlyMessage(content) {
22
19
  if (typeof content === "string") return content;
23
20
  if (!Array.isArray(content)) return;
24
21
  const texts = [];
@@ -39,22 +36,19 @@ function resolveCodexUpstreamForkBoundaryFromTurns(params) {
39
36
  if (item.type !== "userMessage") continue;
40
37
  const isSteer = userMessagesInTurn > 0;
41
38
  userMessagesInTurn += 1;
42
- if (asInputs(item).some((input) => input.type !== "text")) return failure("drift-mismatch", "A message before the fork point contains images or attachments that cannot be verified across OpenClaw and Codex. Fork from a text-only span instead.");
43
- const text = projectCodexUserItemText(item);
44
- if (!text) continue;
39
+ const nativeText = textOnlyMessage(item.content);
40
+ if (nativeText === void 0) return failure("drift-mismatch", "A message before the fork point contains images or attachments that cannot be verified across OpenClaw and Codex. Fork from a text-only span instead.");
45
41
  const local = params.localPrefix[localIndex];
42
+ const upstreamText = local && readUpstreamUserText(local.message);
43
+ const text = upstreamText ? nativeText : projectCodexUserItemText(item);
44
+ if (!text) continue;
46
45
  const identity = local && readMirrorIdentity(local.message);
47
46
  const matchesIdentity = identity === `${turn.id}:${item.id}` || !isSteer && identity === `${turn.id}:prompt`;
48
47
  if (!matchedPrefix && !matchesIdentity) continue;
49
48
  matchedPrefix = true;
50
- const localText = localMessageText(local && "content" in local.message ? local.message.content : void 0);
51
- const upstreamText = local && readUpstreamUserText(local.message);
49
+ const localText = textOnlyMessage(local && "content" in local.message ? local.message.content : void 0);
52
50
  const upstreamPromptVerified = !upstreamText || local?.message.role === "user" && readCodexMirrorSourceFingerprint(local.message) === fingerprintCodexMirrorSourceMessage(local.message);
53
- const expectedText = upstreamText ? projectCodexUserItemText({ content: [{
54
- type: "text",
55
- text: upstreamText
56
- }] }) : localText;
57
- if (!matchesIdentity || !upstreamPromptVerified || localText === void 0 || text !== expectedText) return failure("drift-mismatch", "The local conversation no longer matches the Codex thread. Refresh the session and try again.");
51
+ if (!matchesIdentity || !upstreamPromptVerified || localText === void 0 || text !== (upstreamText ?? localText)) return failure("drift-mismatch", "The local conversation no longer matches the Codex thread. Refresh the session and try again.");
58
52
  if (localIndex < params.localPrefix.length - 1) {
59
53
  localIndex += 1;
60
54
  continue;
@@ -118,7 +112,7 @@ async function resolveCodexUpstreamForkBoundary(params) {
118
112
  const target = localPrefix.at(-1)?.message;
119
113
  return resolved.ok ? {
120
114
  ...resolved,
121
- editorText: localMessageText(target && "content" in target ? target.content : void 0)
115
+ editorText: textOnlyMessage(target && "content" in target ? target.content : void 0)
122
116
  } : resolved;
123
117
  } catch {
124
118
  return failure("upstream-unavailable", "The Codex thread could not be read. Check that Codex is available, then try again.");
@@ -1,6 +1,6 @@
1
- import { i as resolveCodexAppServerRuntimeOptions } from "./config-Cxw3Cl3k.js";
2
- import { n as readCodexAppServerUsage } from "./request-CCm4LaED.js";
3
- import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-hFtzt2Up.js";
1
+ import { i as resolveCodexAppServerRuntimeOptions } from "./config-ClwHKKTN.mjs";
2
+ import { n as readCodexAppServerUsage } from "./request-fEUi95EK.mjs";
3
+ import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-CQUmEcUk.mjs";
4
4
  import { CODEX_APP_SERVER_AUTH_MARKER } from "openclaw/plugin-sdk/agent-runtime";
5
5
  //#region extensions/codex/src/app-server/usage.ts
6
6
  /** Handles the synthetic usage credential for a Codex-backed OpenAI route. */
@@ -1,6 +1,6 @@
1
- import { Ht as isJsonObject } from "./shared-client-kNkljY-R.js";
2
- import { b as buildCodexNativeWebSearchThreadConfig } from "./thread-lifecycle-Ss-uwnC4.js";
3
- import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-rq5tiSXk.js";
1
+ import { Ht as isJsonObject } from "./shared-client-DG1kAfGq.mjs";
2
+ import { S as buildCodexNativeWebSearchThreadConfig } from "./thread-lifecycle-Cc6I-gbl.mjs";
3
+ import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-kWYLbaDH.mjs";
4
4
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { readStringParam, resolveSearchTimeoutSeconds, wrapWebContent } from "openclaw/plugin-sdk/provider-web-search";
6
6
  //#region extensions/codex/src/web-search-provider.runtime.ts
package/dist/api.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as resolveCodexAppServerStartOptionsForAgent, i as resolveCodexAppServerRuntimeOptions } from "./config-Cxw3Cl3k.js";
2
- import { a as CODEX_APP_SERVER_VERSION, n as resolveManagedCodexAppServerStartOptions, r as resolveManagedCodexNativeCommand, t as isManagedCodexDesktopCommand } from "./managed-binary-ZkGodW19.js";
1
+ import { a as resolveCodexAppServerStartOptionsForAgent, i as resolveCodexAppServerRuntimeOptions } from "./.setup/config-ClwHKKTN.mjs";
2
+ import { a as CODEX_APP_SERVER_VERSION, n as resolveManagedCodexAppServerStartOptions, r as resolveManagedCodexNativeCommand, t as isManagedCodexDesktopCommand } from "./.setup/managed-binary-DlGr2kYu.mjs";
3
3
  import path from "node:path";
4
4
  import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";
5
5
  import { listAgentIds as listAgentIds$1, resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-scope-runtime";
@@ -9,7 +9,7 @@ import { resolveEffectiveAgentRuntime } from "openclaw/plugin-sdk/command-auth-n
9
9
  //#region extensions/codex/src/doctor.ts
10
10
  const CODEX_MANAGED_APP_SERVER_CHECK_ID = "codex/managed-app-server";
11
11
  const CODEX_VERSION_TIMEOUT_MS = 5e3;
12
- const CODEX_VERSION_MAX_BUFFER_BYTES = 64 * 1024;
12
+ const CODEX_VERSION_MAX_BUFFER_BYTES = 65536;
13
13
  function managedCodexFinding(params) {
14
14
  return {
15
15
  checkId: CODEX_MANAGED_APP_SERVER_CHECK_ID,
@@ -116,7 +116,7 @@ function createCodexManagedAppServerHealthCheck(params) {
116
116
  })];
117
117
  }
118
118
  const detectedVersion = parseCodexVersion(`${output.stdout}\n${output.stderr}`);
119
- if (detectedVersion !== "0.151.0") return [managedCodexFinding({
119
+ if (detectedVersion !== "0.156.1") return [managedCodexFinding({
120
120
  message: detectedVersion ? `Managed Codex app-server version mismatch: expected ${CODEX_APP_SERVER_VERSION}, detected ${detectedVersion}.` : `Managed Codex app-server did not report a parseable version; expected ${CODEX_APP_SERVER_VERSION}.`,
121
121
  path: nativeCommand,
122
122
  requirement: `the exact OpenClaw-pinned Codex version ${CODEX_APP_SERVER_VERSION}`,
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
2
2
  //#region extensions/codex/cli-metadata.ts
3
3
  function registerCodexCliMetadata(api) {
4
4
  api.registerCli(async ({ program }) => {
5
- const { registerCodexSessionCli } = await import("./session-cli-BuDjm5Ou.js");
5
+ const { registerCodexSessionCli } = await import("./.setup/session-cli-mJePHTAs.mjs");
6
6
  registerCodexSessionCli(program);
7
7
  }, { descriptors: [{
8
8
  name: "codex",
@@ -1,4 +1,4 @@
1
- import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.js";
1
+ import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./.setup/session-binding-meta-B7aEMU7g.mjs";
2
2
  import { asNullableRecord, asOptionalRecord, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
@@ -6,9 +6,9 @@ import { createHash } from "node:crypto";
6
6
  import { isDeepStrictEqual } from "node:util";
7
7
  import { pathExists } from "openclaw/plugin-sdk/security-runtime";
8
8
  import { listAgentIds, resolveAgentDir, resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
9
+ import { setImmediate } from "node:timers/promises";
9
10
  import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
10
11
  import { canonicalPathFromExistingAncestor, isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
11
- import { setImmediate } from "node:timers/promises";
12
12
  import { withFileLock } from "openclaw/plugin-sdk/file-lock";
13
13
  import { archiveLegacyStateSource, legacyStateFileExists } from "openclaw/plugin-sdk/runtime-doctor-migrations";
14
14
  //#region extensions/codex/src/migration/session-binding-orphans.ts
@@ -392,7 +392,7 @@ async function migrateSource(source, candidates, params, store) {
392
392
  return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
393
393
  const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
394
394
  const raw = JSON.parse(contents);
395
- const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-q2WSTVmC.js").then((n) => n.f), import("./conversation-binding-data-CW2GuupV.js").then((n) => n.t)]);
395
+ const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./.setup/session-binding-Bd9dh1Er.mjs").then((n) => n.f), import("./.setup/conversation-binding-data-CrcyZk6O.mjs").then((n) => n.t)]);
396
396
  const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
397
397
  const baseStored = createStoredCodexAppServerBinding(raw, {
398
398
  now: stat.mtime.toISOString(),
@@ -679,7 +679,8 @@ const legacyConfigRules = [
679
679
  * Removes retired Codex plugin config keys while preserving unrelated config.
680
680
  */
681
681
  function normalizeCompatibilityConfig({ cfg }) {
682
- const rawPluginConfig = asNullableRecord(asNullableRecord(cfg.plugins?.entries?.codex)?.config);
682
+ const rawEntry = asNullableRecord(cfg.plugins?.entries?.codex);
683
+ const rawPluginConfig = asNullableRecord(rawEntry?.config);
683
684
  const rawCodexPlugins = asNullableRecord(rawPluginConfig?.codexPlugins);
684
685
  const rawAppServer = asNullableRecord(rawPluginConfig?.appServer);
685
686
  const shouldRemoveDynamicToolsProfile = rawPluginConfig !== null && hasRetiredDynamicToolsProfile(rawPluginConfig);
@@ -690,7 +691,10 @@ function normalizeCompatibilityConfig({ cfg }) {
690
691
  changes: []
691
692
  };
692
693
  const nextConfig = structuredClone(cfg);
693
- const nextPluginConfig = asNullableRecord(asNullableRecord(asNullableRecord(asNullableRecord(nextConfig.plugins)?.entries)?.codex)?.config);
694
+ const nextPlugins = asNullableRecord(nextConfig.plugins);
695
+ const nextEntries = asNullableRecord(nextPlugins?.entries);
696
+ const nextEntry = asNullableRecord(nextEntries?.codex);
697
+ const nextPluginConfig = asNullableRecord(nextEntry?.config);
694
698
  if (!nextPluginConfig) return {
695
699
  config: cfg,
696
700
  changes: []
package/dist/harness.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./harness-DVfUQBlQ.js";
1
+ import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./.setup/harness-CawBdltH.mjs";
2
2
  export { createCodexAppServerAgentHarness, createCodexAppServerNativeCompaction };