@openclaw/codex 2026.5.12 → 2026.5.14-beta.2

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 (24) hide show
  1. package/dist/{client-iRf11BEu.js → client-CoctX13d.js} +5 -1
  2. package/dist/client-factory-Be6RD28K.js +9 -0
  3. package/dist/{command-formatters-Ttwc_kgX.js → command-formatters-DRJaVHhN.js} +32 -7
  4. package/dist/{command-handlers-BYf_veEb.js → command-handlers-CXxykxjq.js} +139 -11
  5. package/dist/{compact-Bl8jRPk4.js → compact-DWa8cylR.js} +2 -6
  6. package/dist/{computer-use-Ct3ngNBt.js → computer-use-DsJxRRtm.js} +1 -1
  7. package/dist/harness.js +4 -4
  8. package/dist/index.js +147 -32
  9. package/dist/media-understanding-provider.js +2 -2
  10. package/dist/{models-BmLfrDci.js → models-GCYf5s8J.js} +1 -1
  11. package/dist/{conversation-binding-CKofEetY.js → node-cli-sessions-CiexDHeV.js} +518 -6
  12. package/dist/{plugin-activation-PXGqUjwY.js → plugin-activation-aQOmRQwA.js} +6 -2
  13. package/dist/provider.js +1 -1
  14. package/dist/{plugin-app-cache-key-B7eU8fNZ.js → request-CKYiRqsN.js} +46 -3
  15. package/dist/{run-attempt-4t06MuNr.js → run-attempt-DG9NQab2.js} +95 -39
  16. package/dist/{shared-client-Cr6W-a2G.js → shared-client-BwUqd3lh.js} +5 -12
  17. package/dist/{side-question-DV7KYIB8.js → side-question-CVWPOkY-.js} +6 -6
  18. package/dist/test-api.js +1 -1
  19. package/dist/{thread-lifecycle-CJppEyYT.js → thread-lifecycle-DrbViNpf.js} +50 -7
  20. package/dist/{vision-tools-DHyuabWn.js → vision-tools-CzTdigBu.js} +1 -1
  21. package/package.json +5 -5
  22. package/dist/client-factory-DfnbdQv7.js +0 -19
  23. package/dist/request-ohCy5ASa.js +0 -45
  24. /package/dist/{rate-limit-cache-BFi-50LG.js → rate-limit-cache-dvhq-4pi.js} +0 -0
@@ -201,6 +201,7 @@ const CODEX_APP_SERVER_PARSE_BUFFER_MAX = 1e6;
201
201
  const CODEX_APP_SERVER_PARSE_BUFFER_MAX_LINES = 1e3;
202
202
  const CODEX_DYNAMIC_TOOL_SERVER_REQUEST_TIMEOUT_MS = 6e5;
203
203
  const CODEX_APP_SERVER_STDERR_TAIL_MAX = 2e3;
204
+ const UNPAIRED_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
204
205
  var CodexAppServerRpcError = class extends Error {
205
206
  constructor(error, method) {
206
207
  super(formatCodexAppServerRpcErrorMessage(error, method));
@@ -370,7 +371,7 @@ var CodexAppServerClient = class CodexAppServerClient {
370
371
  if (this.closed) return;
371
372
  const id = "id" in message ? message.id : void 0;
372
373
  const method = "method" in message ? message.method : void 0;
373
- this.child.stdin.write(`${JSON.stringify(message)}\n`, (error) => {
374
+ this.child.stdin.write(`${stringifyCodexAppServerMessage(message)}\n`, (error) => {
374
375
  if (error) embeddedAgentLog.warn("codex app-server write failed", {
375
376
  error,
376
377
  id,
@@ -551,6 +552,9 @@ function defaultServerRequestResponse(request) {
551
552
  if (request.method === "mcpServer/elicitation/request") return { action: "decline" };
552
553
  return {};
553
554
  }
555
+ function stringifyCodexAppServerMessage(message) {
556
+ return JSON.stringify(message, (_key, value) => typeof value === "string" ? value.replace(UNPAIRED_SURROGATE_RE, "") : value) ?? "null";
557
+ }
554
558
  function timeoutServerRequestResponse(request) {
555
559
  if (request.method !== "item/tool/call") return;
556
560
  return {
@@ -0,0 +1,9 @@
1
+ //#region extensions/codex/src/app-server/client-factory.ts
2
+ const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-BwUqd3lh.js").then((n) => n.a).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
3
+ startOptions,
4
+ authProfileId,
5
+ agentDir,
6
+ config
7
+ }));
8
+ //#endregion
9
+ export { defaultCodexAppServerClientFactory as t };
@@ -2,6 +2,7 @@ import { t as isJsonObject } from "./protocol-C9UWI98H.js";
2
2
  //#region extensions/codex/src/app-server/rate-limits.ts
3
3
  const CODEX_LIMIT_ID = "codex";
4
4
  const LIMIT_WINDOW_KEYS = ["primary", "secondary"];
5
+ const ONE_SECOND_MS = 1e3;
5
6
  const ONE_MINUTE_MS = 6e4;
6
7
  const ONE_HOUR_MS = 60 * ONE_MINUTE_MS;
7
8
  const ONE_DAY_MS = 24 * ONE_HOUR_MS;
@@ -25,9 +26,13 @@ function shouldRefreshCodexRateLimitsForUsageLimitMessage(message) {
25
26
  return Boolean(text?.includes("You've reached your Codex subscription usage limit.") && !text.includes("Next reset "));
26
27
  }
27
28
  function summarizeCodexRateLimits(value, nowMs = Date.now()) {
28
- const snapshots = collectCodexRateLimitSnapshots(value);
29
+ const snapshots = collectCodexRateLimitSnapshots(value).filter(snapshotHasDisplayableData);
29
30
  if (snapshots.length === 0) return;
30
- return snapshots.slice(0, 4).map((snapshot) => summarizeRateLimitSnapshot(snapshot, nowMs)).join("; ");
31
+ const summaries = snapshots.slice(0, 4).map((snapshot) => summarizeRateLimitSnapshot(snapshot, nowMs)).filter((summary) => summary !== void 0);
32
+ return summaries.length > 0 ? summaries.join("; ") : void 0;
33
+ }
34
+ function hasCodexRateLimitSnapshots(value) {
35
+ return collectCodexRateLimitSnapshots(value).length > 0;
31
36
  }
32
37
  function summarizeCodexAccountRateLimits(value, nowMs = Date.now()) {
33
38
  const summary = summarizeCodexAccountUsage(value, nowMs);
@@ -39,7 +44,7 @@ function resolveCodexUsageLimitResetAtMs(value, nowMs = Date.now()) {
39
44
  return selectBlockingRateLimitReset(value, nowMs)?.resetsAtMs;
40
45
  }
41
46
  function summarizeCodexAccountUsage(value, nowMs = Date.now()) {
42
- const snapshots = collectCodexRateLimitSnapshots(value);
47
+ const snapshots = collectCodexRateLimitSnapshots(value).filter(snapshotHasDisplayableData);
43
48
  if (snapshots.length === 0) return;
44
49
  const usageSnapshot = snapshots.find(isCodexLimitSnapshot) ?? snapshots[0];
45
50
  const blockedSnapshots = snapshots.filter(snapshotHasLimitBlock);
@@ -85,7 +90,8 @@ function summarizeRateLimitSnapshot(snapshot, nowMs) {
85
90
  });
86
91
  const reachedType = readString$1(snapshot, "rateLimitReachedType") ?? readString$1(snapshot, "rate_limit_reached_type");
87
92
  const suffix = reachedType ? ` (${formatReachedType(reachedType)})` : "";
88
- return `${label}: ${windows.join(", ") || "available"}${suffix}`;
93
+ if (windows.length > 0) return `${label}: ${windows.join(" · ")}${suffix}`;
94
+ if (reachedType) return `${label}: ${formatReachedType(reachedType)}`;
89
95
  }
90
96
  function collectCodexRateLimitSnapshots(value) {
91
97
  const snapshots = [];
@@ -142,6 +148,10 @@ function readRateLimitWindow(snapshot, key) {
142
148
  ...readOptionalNumberField(window, "windowDurationMins", "window_duration_mins", "windowMinutes", "window_minutes")
143
149
  };
144
150
  }
151
+ function snapshotHasDisplayableData(snapshot) {
152
+ if (readString$1(snapshot, "rateLimitReachedType") ?? readString$1(snapshot, "rate_limit_reached_type")) return true;
153
+ return readWindowEntries(snapshot).some((entry) => entry.window.usedPercent !== void 0 || entry.window.resetsAtMs > 0);
154
+ }
145
155
  function readOptionalNumberField(record, ...keys) {
146
156
  const value = keys.map((key) => readNumber(record, key)).find((entry) => entry !== void 0);
147
157
  if (value === void 0) return {};
@@ -151,7 +161,7 @@ function formatRateLimitWindow(key, window, nowMs) {
151
161
  return `${key} ${formatRateLimitWindowDetails(window, nowMs)}`;
152
162
  }
153
163
  function formatRateLimitWindowDetails(window, nowMs) {
154
- return `${window.usedPercent === void 0 ? "usage unknown" : `${Math.round(window.usedPercent)}%`}${window.resetsAtMs > nowMs ? `, resets ${formatResetTime(window.resetsAtMs, nowMs)}` : ""}`;
164
+ return `${window.usedPercent === void 0 ? "usage unknown" : `${Math.max(0, 100 - Math.round(window.usedPercent))}% left`}${window.resetsAtMs > nowMs ? ` ⏱${formatResetDuration(window.resetsAtMs, nowMs)}` : ""}`;
155
165
  }
156
166
  function formatLimitLabel(snapshot) {
157
167
  const label = readNullableString(snapshot, "limitName") ?? readNullableString(snapshot, "limit_name") ?? readNullableString(snapshot, "limitId") ?? readNullableString(snapshot, "limit_id");
@@ -249,6 +259,17 @@ function formatRelativeDuration(durationMs) {
249
259
  const days = Math.ceil(safeMs / ONE_DAY_MS);
250
260
  return `${days} ${days === 1 ? "day" : "days"}`;
251
261
  }
262
+ function formatResetDuration(resetsAtMs, nowMs) {
263
+ const durationMs = Math.round(Math.max(ONE_SECOND_MS, resetsAtMs - nowMs) / ONE_SECOND_MS) * ONE_SECOND_MS;
264
+ const days = Math.floor(durationMs / ONE_DAY_MS);
265
+ const hours = Math.floor(durationMs % ONE_DAY_MS / ONE_HOUR_MS);
266
+ const minutes = Math.floor(durationMs % ONE_HOUR_MS / ONE_MINUTE_MS);
267
+ const seconds = Math.floor(durationMs % ONE_MINUTE_MS / ONE_SECOND_MS);
268
+ if (days > 0) return hours > 0 ? `${days}d ${hours}h` : `${days}d`;
269
+ if (hours > 0) return minutes > 0 ? `${hours}h ${minutes}m` : `${hours}h`;
270
+ if (minutes > 0) return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
271
+ return `${seconds}s`;
272
+ }
252
273
  function formatWindowSignature(value) {
253
274
  if (!isJsonObject(value)) return "";
254
275
  return `${readNumber(value, "usedPercent") ?? readNumber(value, "used_percent") ?? ""}:${readNumber(value, "resetsAt") ?? readNumber(value, "resets_at") ?? ""}`;
@@ -410,7 +431,9 @@ function buildHelp() {
410
431
  "- /codex status",
411
432
  "- /codex models",
412
433
  "- /codex threads [filter]",
434
+ "- /codex sessions --host <node> [filter]",
413
435
  "- /codex resume <thread-id>",
436
+ "- /codex resume <session-id> --host <node> --bind here",
414
437
  "- /codex bind [thread-id] [--cwd <path>] [--model <model>] [--provider <provider>]",
415
438
  "- /codex binding",
416
439
  "- /codex stop",
@@ -440,11 +463,13 @@ function summarizeArrayLike(value) {
440
463
  return `${entries.length}`;
441
464
  }
442
465
  function formatCodexRateLimitSummary(value) {
443
- return formatCodexDisplayText(summarizeCodexRateLimits(value) ?? summarizeRateLimits(value));
466
+ const summary = summarizeCodexRateLimits(value);
467
+ if (summary) return formatCodexDisplayText(summary);
468
+ return formatCodexDisplayText(hasCodexRateLimitSnapshots(value) ? "none returned" : summarizeRateLimits(value));
444
469
  }
445
470
  function formatCodexRateLimitDetails(value) {
446
471
  const lines = summarizeCodexAccountRateLimits(value);
447
- if (!lines) return formatCodexDisplayText(summarizeRateLimits(value));
472
+ if (!lines) return formatCodexDisplayText(hasCodexRateLimitSnapshots(value) ? "none returned" : summarizeRateLimits(value));
448
473
  return lines.map(formatCodexDisplayText).join("\n");
449
474
  }
450
475
  function summarizeRateLimits(value) {
@@ -1,12 +1,12 @@
1
1
  import { i as isCodexFastServiceTier, s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
2
- import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-BmLfrDci.js";
2
+ import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-GCYf5s8J.js";
3
3
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
4
- import { n as CODEX_CONTROL_METHODS, r as describeControlFailure, t as requestCodexAppServerJson } from "./request-ohCy5ASa.js";
5
- import { a as formatComputerUseStatus, c as formatThreads, i as formatCodexStatus, l as readString$1, n as formatAccount, o as formatList, p as summarizeCodexAccountUsage, r as formatCodexDisplayText, s as formatModels, t as buildHelp } from "./command-formatters-Ttwc_kgX.js";
4
+ import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-CKYiRqsN.js";
5
+ import { a as formatComputerUseStatus, c as formatThreads, i as formatCodexStatus, l as readString$1, n as formatAccount, o as formatList, p as summarizeCodexAccountUsage, r as formatCodexDisplayText, s as formatModels, t as buildHelp } from "./command-formatters-DRJaVHhN.js";
6
6
  import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
7
- import { a as parseCodexFastModeArg, c as setCodexConversationFastMode, d as steerCodexConversationTurn, f as stopCodexConversationTurn, i as formatPermissionsMode, l as setCodexConversationModel, m as resolveCodexDefaultWorkspaceDir, o as parseCodexPermissionsModeArg, p as readCodexConversationBindingData, r as startCodexConversationThread, s as readCodexConversationActiveTurn, u as setCodexConversationPermissions } from "./conversation-binding-CKofEetY.js";
8
- import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-Ct3ngNBt.js";
9
- import { n as rememberCodexRateLimits } from "./rate-limit-cache-BFi-50LG.js";
7
+ import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, l as startCodexConversationThread, m as setCodexConversationFastMode, p as readCodexConversationActiveTurn, r as formatCodexCliSessions, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./node-cli-sessions-CiexDHeV.js";
8
+ import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-DsJxRRtm.js";
9
+ import { n as rememberCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
10
10
  import crypto from "node:crypto";
11
11
  import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveDefaultAgentDir, resolveProfileUnusableUntilForDisplay } from "openclaw/plugin-sdk/agent-runtime";
12
12
  //#region extensions/codex/src/command-account.ts
@@ -366,7 +366,13 @@ const defaultCodexCommandDeps = {
366
366
  setCodexConversationModel,
367
367
  setCodexConversationPermissions,
368
368
  steerCodexConversationTurn,
369
- stopCodexConversationTurn
369
+ stopCodexConversationTurn,
370
+ listCodexCliSessionsOnNode: async () => {
371
+ throw new Error("Codex CLI node sessions require Gateway node runtime.");
372
+ },
373
+ resolveCodexCliSessionForBindingOnNode: async () => {
374
+ throw new Error("Codex CLI node sessions require Gateway node runtime.");
375
+ }
370
376
  };
371
377
  const CODEX_DIAGNOSTICS_SOURCE = "openclaw-diagnostics";
372
378
  const CODEX_DIAGNOSTICS_REASON_MAX_CHARS = 2048;
@@ -400,6 +406,7 @@ async function handleCodexSubcommand(ctx, options) {
400
406
  return { text: formatModels(await deps.listCodexAppServerModels(deps.requestOptions(options.pluginConfig, 100, ctx.config))) };
401
407
  }
402
408
  if (normalized === "threads") return { text: await buildThreads(deps, options.pluginConfig, rest.join(" ")) };
409
+ if (normalized === "sessions") return { text: await buildCodexCliSessions(deps, rest) };
403
410
  if (normalized === "resume") return { text: await resumeThread(deps, ctx, options.pluginConfig, rest) };
404
411
  if (normalized === "bind") return await bindConversation(deps, ctx, options.pluginConfig, rest);
405
412
  if (normalized === "detach" || normalized === "unbind") {
@@ -493,7 +500,7 @@ async function bindConversation(deps, ctx, pluginConfig, args) {
493
500
  async function detachConversation(deps, ctx) {
494
501
  const data = readCodexConversationBindingData(await ctx.getCurrentConversationBinding());
495
502
  const detached = await ctx.detachConversationBinding();
496
- if (data) await deps.clearCodexAppServerBinding(data.sessionFile);
503
+ if (data?.kind === "codex-app-server-session") await deps.clearCodexAppServerBinding(data.sessionFile);
497
504
  else if (ctx.sessionFile) await deps.clearCodexAppServerBinding(ctx.sessionFile);
498
505
  return detached.removed ? "Detached this conversation from Codex." : "No Codex conversation binding was attached.";
499
506
  }
@@ -501,6 +508,14 @@ async function describeConversationBinding(deps, ctx) {
501
508
  const current = await ctx.getCurrentConversationBinding();
502
509
  const data = readCodexConversationBindingData(current);
503
510
  if (!current || !data) return "No Codex conversation binding is attached.";
511
+ if (data.kind === "codex-cli-node-session") return [
512
+ "Codex conversation binding:",
513
+ "- Mode: Codex CLI node session",
514
+ `- Node: ${formatCodexDisplayText(data.nodeId)}`,
515
+ `- Session: ${formatCodexDisplayText(data.sessionId)}`,
516
+ `- Workspace: ${formatCodexDisplayText(data.cwd ?? "unknown")}`,
517
+ "- Active run: not tracked"
518
+ ].join("\n");
504
519
  const threadBinding = await deps.readCodexAppServerBinding(data.sessionFile);
505
520
  const active = deps.readCodexConversationActiveTurn(data.sessionFile);
506
521
  return [
@@ -520,9 +535,20 @@ async function buildThreads(deps, pluginConfig, filter) {
520
535
  ...filter.trim() ? { searchTerm: filter.trim() } : {}
521
536
  }));
522
537
  }
538
+ async function buildCodexCliSessions(deps, args) {
539
+ const parsed = parseCodexCliSessionsArgs(args);
540
+ if (parsed.help || !parsed.host) return "Usage: /codex sessions --host <node> [filter] [--limit <n>]";
541
+ return formatCodexCliSessions(await deps.listCodexCliSessionsOnNode({
542
+ requestedNode: parsed.host,
543
+ filter: parsed.filter,
544
+ limit: parsed.limit
545
+ }));
546
+ }
523
547
  async function resumeThread(deps, ctx, pluginConfig, args) {
524
- const [threadId] = args;
525
- const normalizedThreadId = threadId?.trim();
548
+ const parsed = parseResumeArgs(args);
549
+ const normalizedThreadId = parsed.threadId?.trim();
550
+ if (parsed.help) return args.includes("--help") || args.includes("-h") || parsed.host ? "Usage: /codex resume <thread-id>\nUsage: /codex resume <session-id> --host <node> --bind here" : "Usage: /codex resume <thread-id>";
551
+ if (parsed.host) return await bindCodexCliNodeSession(deps, ctx, parsed);
526
552
  if (!normalizedThreadId || args.length !== 1) return "Usage: /codex resume <thread-id>";
527
553
  if (!ctx.sessionFile) return "Cannot attach a Codex thread because this command did not include an OpenClaw session file.";
528
554
  const response = await deps.codexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.resumeThread, {
@@ -539,6 +565,30 @@ async function resumeThread(deps, ctx, pluginConfig, args) {
539
565
  });
540
566
  return `Attached this OpenClaw session to Codex thread ${formatCodexDisplayText(effectiveThreadId)}.`;
541
567
  }
568
+ async function bindCodexCliNodeSession(deps, ctx, parsed) {
569
+ if (!parsed.threadId || !parsed.host || parsed.bindHere !== true) return "Usage: /codex resume <session-id> --host <node> --bind here";
570
+ const resolved = await deps.resolveCodexCliSessionForBindingOnNode({
571
+ requestedNode: parsed.host,
572
+ sessionId: parsed.threadId
573
+ });
574
+ if (!resolved.session) return `No Codex CLI session ${formatCodexDisplayText(parsed.threadId)} was found on ${formatCodexDisplayText(parsed.host)}.`;
575
+ const nodeId = resolved.node.nodeId;
576
+ if (!nodeId) return "Cannot bind Codex CLI session because the selected node did not include a node id.";
577
+ const data = createCodexCliNodeConversationBindingData({
578
+ nodeId,
579
+ sessionId: parsed.threadId,
580
+ cwd: resolved.session?.cwd
581
+ });
582
+ const summary = `Codex CLI session ${formatCodexDisplayText(parsed.threadId)} on ${formatCodexDisplayText(nodeId)}`;
583
+ const request = await ctx.requestConversationBinding({
584
+ summary,
585
+ detachHint: "/codex detach",
586
+ data
587
+ });
588
+ if (request.status === "bound") return `Bound this conversation to Codex CLI session ${formatCodexDisplayText(parsed.threadId)} on ${formatCodexDisplayText(nodeId)}.`;
589
+ if (request.status === "pending") return request.reply.text ?? "Codex CLI session binding is pending approval.";
590
+ return formatCodexDisplayText(request.message);
591
+ }
542
592
  async function stopConversationTurn(deps, ctx, pluginConfig) {
543
593
  const sessionFile = await resolveControlSessionFile(ctx);
544
594
  if (!sessionFile) return "Cannot stop Codex because this command did not include an OpenClaw session file.";
@@ -599,7 +649,8 @@ async function setConversationPermissions(deps, ctx, pluginConfig, args) {
599
649
  });
600
650
  }
601
651
  async function resolveControlSessionFile(ctx) {
602
- return readCodexConversationBindingData(await ctx.getCurrentConversationBinding())?.sessionFile ?? ctx.sessionFile;
652
+ const data = readCodexConversationBindingData(await ctx.getCurrentConversationBinding());
653
+ return data?.kind === "codex-app-server-session" ? data.sessionFile : ctx.sessionFile;
603
654
  }
604
655
  async function handleCodexDiagnosticsFeedback(deps, ctx, pluginConfig, args, commandPrefix) {
605
656
  if (ctx.senderIsOwner !== true) return { text: "Only an owner can send Codex diagnostics." };
@@ -1175,6 +1226,83 @@ function parseBindArgs(args) {
1175
1226
  parsed.provider = normalizeOptionalString(parsed.provider);
1176
1227
  return parsed;
1177
1228
  }
1229
+ function parseCodexCliSessionsArgs(args) {
1230
+ const parsed = { filter: "" };
1231
+ const filter = [];
1232
+ for (let index = 0; index < args.length; index += 1) {
1233
+ const arg = args[index];
1234
+ if (arg === "--help" || arg === "-h") {
1235
+ parsed.help = true;
1236
+ continue;
1237
+ }
1238
+ if (arg === "--host" || arg === "--node") {
1239
+ const value = readRequiredOptionValue(args, index);
1240
+ if (!value || parsed.host !== void 0) {
1241
+ parsed.help = true;
1242
+ continue;
1243
+ }
1244
+ parsed.host = value;
1245
+ index += 1;
1246
+ continue;
1247
+ }
1248
+ if (arg === "--limit") {
1249
+ const value = readRequiredOptionValue(args, index);
1250
+ const parsedLimit = value ? Number.parseInt(value, 10) : NaN;
1251
+ if (!Number.isFinite(parsedLimit) || parsedLimit <= 0) {
1252
+ parsed.help = true;
1253
+ continue;
1254
+ }
1255
+ parsed.limit = parsedLimit;
1256
+ index += 1;
1257
+ continue;
1258
+ }
1259
+ if (arg.startsWith("-")) {
1260
+ parsed.help = true;
1261
+ continue;
1262
+ }
1263
+ filter.push(arg);
1264
+ }
1265
+ parsed.host = normalizeOptionalString(parsed.host);
1266
+ parsed.filter = filter.join(" ").trim();
1267
+ return parsed;
1268
+ }
1269
+ function parseResumeArgs(args) {
1270
+ const parsed = {};
1271
+ for (let index = 0; index < args.length; index += 1) {
1272
+ const arg = args[index];
1273
+ if (arg === "--help" || arg === "-h") {
1274
+ parsed.help = true;
1275
+ continue;
1276
+ }
1277
+ if (arg === "--host" || arg === "--node") {
1278
+ const value = readRequiredOptionValue(args, index);
1279
+ if (!value || parsed.host !== void 0) {
1280
+ parsed.help = true;
1281
+ continue;
1282
+ }
1283
+ parsed.host = value;
1284
+ index += 1;
1285
+ continue;
1286
+ }
1287
+ if (arg === "--bind") {
1288
+ if (readRequiredOptionValue(args, index) !== "here" || parsed.bindHere !== void 0) {
1289
+ parsed.help = true;
1290
+ continue;
1291
+ }
1292
+ parsed.bindHere = true;
1293
+ index += 1;
1294
+ continue;
1295
+ }
1296
+ if (!arg.startsWith("-") && !parsed.threadId) {
1297
+ parsed.threadId = arg;
1298
+ continue;
1299
+ }
1300
+ parsed.help = true;
1301
+ }
1302
+ parsed.threadId = normalizeOptionalString(parsed.threadId);
1303
+ parsed.host = normalizeOptionalString(parsed.host);
1304
+ return parsed;
1305
+ }
1178
1306
  function parseComputerUseArgs(args) {
1179
1307
  const parsed = {
1180
1308
  action: "status",
@@ -1,11 +1,10 @@
1
1
  import { s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
2
2
  import { t as isJsonObject } from "./protocol-C9UWI98H.js";
3
3
  import { i as readCodexAppServerBinding } from "./session-binding-CMTXuyoz.js";
4
- import { n as defaultCodexAppServerClientFactory, t as createCodexAppServerClientFactoryTestHooks } from "./client-factory-DfnbdQv7.js";
4
+ import { t as defaultCodexAppServerClientFactory } from "./client-factory-Be6RD28K.js";
5
5
  import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, runHarnessContextEngineMaintenance } from "openclaw/plugin-sdk/agent-harness-runtime";
6
6
  //#region extensions/codex/src/app-server/compact.ts
7
7
  const DEFAULT_CODEX_COMPACTION_WAIT_TIMEOUT_MS = 300 * 1e3;
8
- let clientFactory = defaultCodexAppServerClientFactory;
9
8
  async function maybeCompactCodexAppServerSession(params, options = {}) {
10
9
  const activeContextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
11
10
  if (activeContextEngine?.info.ownsCompaction) {
@@ -77,7 +76,7 @@ async function compactCodexNativeThread(params, options = {}) {
77
76
  compacted: false,
78
77
  reason: "auth profile mismatch for session binding"
79
78
  };
80
- const client = await clientFactory(appServer.start, requestedAuthProfileId ?? binding.authProfileId, params.agentDir, params.config);
79
+ const client = await (options.clientFactory ?? defaultCodexAppServerClientFactory)(appServer.start, requestedAuthProfileId ?? binding.authProfileId, params.agentDir, params.config);
81
80
  const waiter = createCodexNativeCompactionWaiter(client, binding.threadId);
82
81
  let completion;
83
82
  try {
@@ -253,8 +252,5 @@ function formatCompactionError(error) {
253
252
  if (error instanceof Error) return error.message;
254
253
  return String(error);
255
254
  }
256
- createCodexAppServerClientFactoryTestHooks((factory) => {
257
- clientFactory = factory;
258
- });
259
255
  //#endregion
260
256
  export { maybeCompactCodexAppServerSession };
@@ -1,5 +1,5 @@
1
1
  import { c as resolveCodexComputerUseConfig, s as resolveCodexAppServerRuntimeOptions } from "./config-0rd3LnKg.js";
2
- import { r as describeControlFailure, t as requestCodexAppServerJson } from "./request-ohCy5ASa.js";
2
+ import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-CKYiRqsN.js";
3
3
  import { existsSync } from "node:fs";
4
4
  //#region extensions/codex/src/app-server/computer-use.ts
5
5
  var CodexComputerUseSetupError = class extends Error {
package/dist/harness.js CHANGED
@@ -18,15 +18,15 @@ function createCodexAppServerAgentHarness(options) {
18
18
  };
19
19
  },
20
20
  runAttempt: async (params) => {
21
- const { runCodexAppServerAttempt } = await import("./run-attempt-4t06MuNr.js");
21
+ const { runCodexAppServerAttempt } = await import("./run-attempt-DG9NQab2.js");
22
22
  return runCodexAppServerAttempt(params, { pluginConfig: options?.pluginConfig });
23
23
  },
24
24
  runSideQuestion: async (params) => {
25
- const { runCodexAppServerSideQuestion } = await import("./side-question-DV7KYIB8.js");
25
+ const { runCodexAppServerSideQuestion } = await import("./side-question-CVWPOkY-.js");
26
26
  return runCodexAppServerSideQuestion(params, { pluginConfig: options?.pluginConfig });
27
27
  },
28
28
  compact: async (params) => {
29
- const { maybeCompactCodexAppServerSession } = await import("./compact-Bl8jRPk4.js");
29
+ const { maybeCompactCodexAppServerSession } = await import("./compact-DWa8cylR.js");
30
30
  return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.pluginConfig });
31
31
  },
32
32
  reset: async (params) => {
@@ -36,7 +36,7 @@ function createCodexAppServerAgentHarness(options) {
36
36
  }
37
37
  },
38
38
  dispose: async () => {
39
- const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-Cr6W-a2G.js").then((n) => n.i);
39
+ const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-BwUqd3lh.js").then((n) => n.a);
40
40
  await clearSharedCodexAppServerClientAndWait();
41
41
  }
42
42
  };