@openclaw/codex 2026.8.1-beta.2 → 2026.8.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 (64) hide show
  1. package/dist/api.js +146 -0
  2. package/dist/{attempt-client-cleanup-DMLXUfa8.js → attempt-client-cleanup-CVPvp9dL.js} +47 -5
  3. package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
  4. package/dist/{binding-connection-I5Bo-AsX.js → binding-connection-CCQFs8lf.js} +15 -3
  5. package/dist/{bounded-turn-qgZmzy_4.js → bounded-turn-rq5tiSXk.js} +27 -26
  6. package/dist/{capabilities-CybGI1oz.js → capabilities-CGm_94eL.js} +1 -1
  7. package/dist/cli-metadata.js +1 -1
  8. package/dist/{command-formatters-B1AEz8ZA.js → command-formatters-C54Yg3eA.js} +2 -2
  9. package/dist/{command-handlers-Db8pu_ds.js → command-handlers-BvOAHTrA.js} +111 -67
  10. package/dist/{compact-LspQaGfl.js → compact-Hd7SAc0N.js} +35 -30
  11. package/dist/{session-binding-DPxIvMgE.js → config-Cxw3Cl3k.js} +361 -1161
  12. package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
  13. package/dist/doctor-contract-api.js +128 -26
  14. package/dist/{dynamic-tools-BVdyWkUD.js → dynamic-tools-BFoUcRdx.js} +1341 -1464
  15. package/dist/{effective-mcp-catalog-DIIhAtOZ.js → effective-mcp-catalog-BTJHnDSx.js} +2 -2
  16. package/dist/elicitation-input-DMkeki8d.js +71 -0
  17. package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
  18. package/dist/{event-projector-usage-e5huIQWu.js → event-projector-usage-D3PHFFXh.js} +18 -18
  19. package/dist/harness-DVfUQBlQ.js +248 -0
  20. package/dist/harness.js +2 -226
  21. package/dist/index.js +405 -299
  22. package/dist/{isolated-completion-C58NbL40.js → isolated-completion-Cbbx_5Ed.js} +4 -4
  23. package/dist/launch-args-sXOAg0SX.js +84 -0
  24. package/dist/managed-binary-ZkGodW19.js +248 -0
  25. package/dist/media-understanding-provider.js +2 -2
  26. package/dist/model-catalog-o6Cgjoss.js +101 -0
  27. package/dist/{models-BFlpn1Ex.js → models-DgFWSuxA.js} +25 -28
  28. package/dist/{native-subagent-monitor-DyTGmTUx.js → native-subagent-monitor-CwFyoylz.js} +385 -94
  29. package/dist/node-exec-server.runtime-DXrqpw1c.js +195 -0
  30. package/dist/plugin-approval-roundtrip-D80UZiJ_.js +95 -0
  31. package/dist/{plugin-marketplace-discovery-CzrGJdCR.js → plugin-marketplace-discovery-mdmScYOj.js} +60 -55
  32. package/dist/{plugin-metadata-cache-CNJPj4_b.js → plugin-metadata-cache-CulOABwu.js} +164 -134
  33. package/dist/{protocol-validators-B4F7L8Rf.js → protocol-validators-Bg5rpNxk.js} +203 -7
  34. package/dist/{rate-limits-DZXmOL8-.js → rate-limits-hFtzt2Up.js} +1 -1
  35. package/dist/{sandbox-guard-Cmwc9eIk.js → request-CCm4LaED.js} +207 -20
  36. package/dist/{run-attempt-P8BdxC1I.js → run-attempt-BwNQDH2u.js} +1506 -836
  37. package/dist/{runtime-artifact-BVSPdd6g.js → runtime-artifact-DeBvleJw.js} +4 -7
  38. package/dist/session-binding-q2WSTVmC.js +947 -0
  39. package/dist/{session-catalog-xwNi_SDM.js → session-catalog-C2Tae4rI.js} +1698 -1346
  40. package/dist/session-catalog-home-id-DAKUrm3C.js +112 -0
  41. package/dist/{session-cli-7hgXZDV7.js → session-cli-BuDjm5Ou.js} +20 -7
  42. package/dist/session-permission-policy-gLm40Vtq.js +160 -0
  43. package/dist/session-retirement-CdkI0bvb.js +90 -0
  44. package/dist/{session-upstream-marker-CrIFX06J.js → session-upstream-marker-Bcy33kam.js} +2 -3
  45. package/dist/{settled-turn-finalizer-BRWBO4MO.js → settled-turn-finalizer-B8JJcxCi.js} +27 -22
  46. package/dist/{shared-client-kIBbGjk4.js → shared-client-kNkljY-R.js} +2023 -607
  47. package/dist/{side-question-9HAL26l9.js → side-question-GwD73tX6.js} +109 -57
  48. package/dist/{thread-lifecycle-Bu1BTDXr.js → thread-lifecycle-Ss-uwnC4.js} +1208 -497
  49. package/dist/{thread-ownership-6kOQHlyC.js → thread-ownership-CeYBqg_4.js} +18 -8
  50. package/dist/{plugin-app-cache-key-C3H2CVp6.js → thread-resume-DF54hagX.js} +64 -6
  51. package/dist/{transcript-mirror-B9gGgnJS.js → transcript-mirror-CkEQIna-.js} +158 -41
  52. package/dist/transport-stdio-C7-s9TLG.js +708 -0
  53. package/dist/{upstream-prompt-provenance-ClRBije0.js → upstream-prompt-provenance-CFmsKwr9.js} +12 -14
  54. package/dist/{upstream-session-fork-CE-_LdnP.js → upstream-session-fork-BACGlOFa.js} +86 -88
  55. package/dist/{usage-CHlV0e-o.js → usage-C2l8Mils.js} +3 -3
  56. package/dist/{web-search-provider.runtime-DRw2Vl42.js → web-search-provider.runtime-B2XgRdFv.js} +3 -3
  57. package/openclaw.plugin.json +50 -2
  58. package/package.json +9 -8
  59. package/dist/app-server-policy-zcBDc1JU.js +0 -49
  60. package/dist/incognito-session-ET_ufDH-.js +0 -2
  61. package/dist/request-BRl5_UfX.js +0 -157
  62. package/dist/session-retirement-DoMMJFKm.js +0 -36
  63. package/dist/thread-resume-CPrJNQVM.js +0 -30
  64. package/dist/transport-stdio-DIImwDVS.js +0 -99
package/dist/api.js ADDED
@@ -0,0 +1,146 @@
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";
3
+ import path from "node:path";
4
+ import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";
5
+ import { listAgentIds as listAgentIds$1, resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-scope-runtime";
6
+ import { execFile } from "node:child_process";
7
+ import { fileURLToPath } from "node:url";
8
+ import { resolveEffectiveAgentRuntime } from "openclaw/plugin-sdk/command-auth-native";
9
+ //#region extensions/codex/src/doctor.ts
10
+ const CODEX_MANAGED_APP_SERVER_CHECK_ID = "codex/managed-app-server";
11
+ const CODEX_VERSION_TIMEOUT_MS = 5e3;
12
+ const CODEX_VERSION_MAX_BUFFER_BYTES = 64 * 1024;
13
+ function managedCodexFinding(params) {
14
+ return {
15
+ checkId: CODEX_MANAGED_APP_SERVER_CHECK_ID,
16
+ severity: "error",
17
+ source: "codex",
18
+ message: params.message,
19
+ ...params.path ? { path: params.path } : {},
20
+ ...params.requirement ? { requirement: params.requirement } : {},
21
+ ...params.fixHint ? { fixHint: params.fixHint } : {}
22
+ };
23
+ }
24
+ function readErrorMessage(error) {
25
+ return error instanceof Error ? error.message : String(error);
26
+ }
27
+ function parseCodexVersion(output) {
28
+ return /(?:^|\s)(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:\s|$)/u.exec(output)?.[1];
29
+ }
30
+ function runVersionCommand(command) {
31
+ return new Promise((resolve, reject) => {
32
+ execFile(command, ["--version"], {
33
+ encoding: "utf8",
34
+ maxBuffer: CODEX_VERSION_MAX_BUFFER_BYTES,
35
+ timeout: CODEX_VERSION_TIMEOUT_MS,
36
+ windowsHide: true
37
+ }, (error, stdout, stderr) => {
38
+ if (error) {
39
+ reject(new Error(readErrorMessage(error), { cause: error }));
40
+ return;
41
+ }
42
+ resolve({
43
+ stdout,
44
+ stderr
45
+ });
46
+ });
47
+ });
48
+ }
49
+ function createCodexManagedAppServerHealthCheck(params) {
50
+ const resolveStartOptions = params.deps?.resolveStartOptions ?? resolveManagedCodexAppServerStartOptions;
51
+ const resolveAgentStartOptions = params.deps?.resolveAgentStartOptions ?? resolveCodexAppServerStartOptionsForAgent;
52
+ const isDesktopCommand = params.deps?.isDesktopCommand ?? isManagedCodexDesktopCommand;
53
+ const resolveNativeCommand = params.deps?.resolveNativeCommand ?? resolveManagedCodexNativeCommand;
54
+ const executeVersion = params.deps?.runVersionCommand ?? runVersionCommand;
55
+ return {
56
+ id: CODEX_MANAGED_APP_SERVER_CHECK_ID,
57
+ kind: "plugin",
58
+ description: "Verify the selected managed Codex app-server binary and pinned version.",
59
+ source: "codex",
60
+ defaultEnabled: false,
61
+ async detect(ctx) {
62
+ const pluginConfig = ctx.cfg.plugins?.entries?.codex?.config;
63
+ const start = resolveCodexAppServerRuntimeOptions({
64
+ pluginConfig,
65
+ env: ctx.env ?? process.env
66
+ }).start;
67
+ if (start.transport !== "stdio" || start.commandSource !== "managed") return [];
68
+ const env = ctx.env ?? process.env;
69
+ let resolved;
70
+ for (const agentId of listAgentIds$1(ctx.cfg)) {
71
+ const model = resolveDefaultModelForAgent({
72
+ cfg: ctx.cfg,
73
+ agentId
74
+ });
75
+ if (resolveEffectiveAgentRuntime({
76
+ cfg: ctx.cfg,
77
+ provider: model.provider,
78
+ modelId: model.model,
79
+ agentId
80
+ }) !== "codex") continue;
81
+ const agentStart = resolveAgentStartOptions({
82
+ startOptions: start,
83
+ agentDir: resolveAgentDir$1(ctx.cfg, agentId, env),
84
+ env
85
+ });
86
+ try {
87
+ resolved = await resolveStartOptions(agentStart, { pluginRoot: params.pluginRoot });
88
+ } catch (error) {
89
+ return [managedCodexFinding({
90
+ message: `Managed Codex app-server could not be resolved: ${readErrorMessage(error)}`,
91
+ path: params.pluginRoot,
92
+ requirement: `an executable Codex ${CODEX_APP_SERVER_VERSION} managed artifact`,
93
+ fixHint: "Reinstall the staged OpenClaw package with its @openai/codex platform dependency, then rerun the candidate check."
94
+ })];
95
+ }
96
+ if (!isDesktopCommand(resolved.command)) break;
97
+ resolved = void 0;
98
+ }
99
+ if (!resolved) return [];
100
+ const nativeCommand = resolveNativeCommand(resolved.command);
101
+ if (!nativeCommand) return [managedCodexFinding({
102
+ message: "Managed Codex app-server resolved a launcher without a native artifact.",
103
+ path: resolved.command,
104
+ requirement: `the platform-native Codex ${CODEX_APP_SERVER_VERSION} executable`,
105
+ fixHint: "Reinstall the staged OpenClaw package with the matching @openai/codex platform package, then rerun the candidate check."
106
+ })];
107
+ let output;
108
+ try {
109
+ output = await executeVersion(nativeCommand);
110
+ } catch (error) {
111
+ return [managedCodexFinding({
112
+ message: `Managed Codex app-server version check failed: ${readErrorMessage(error)}`,
113
+ path: nativeCommand,
114
+ requirement: `Codex ${CODEX_APP_SERVER_VERSION} must report its version within ${CODEX_VERSION_TIMEOUT_MS} ms`,
115
+ fixHint: "Repair or reinstall the staged OpenClaw package, then rerun the candidate check before cutover."
116
+ })];
117
+ }
118
+ const detectedVersion = parseCodexVersion(`${output.stdout}\n${output.stderr}`);
119
+ if (detectedVersion !== "0.151.0") return [managedCodexFinding({
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
+ path: nativeCommand,
122
+ requirement: `the exact OpenClaw-pinned Codex version ${CODEX_APP_SERVER_VERSION}`,
123
+ fixHint: "Reinstall the staged OpenClaw package so its managed @openai/codex dependency matches the pinned version, then rerun the candidate check."
124
+ })];
125
+ return [];
126
+ }
127
+ };
128
+ }
129
+ function registerCodexManagedAppServerDoctorChecks$1(host, deps) {
130
+ if (host.getHealthCheck("codex/managed-app-server")) return;
131
+ host.registerHealthCheck(createCodexManagedAppServerHealthCheck({
132
+ pluginRoot: host.pluginRoot,
133
+ deps
134
+ }));
135
+ }
136
+ //#endregion
137
+ //#region extensions/codex/api.ts
138
+ const CODEX_PLUGIN_ROOT = path.dirname(fileURLToPath(import.meta.url));
139
+ function registerCodexManagedAppServerDoctorChecks(host) {
140
+ registerCodexManagedAppServerDoctorChecks$1({
141
+ ...host,
142
+ pluginRoot: CODEX_PLUGIN_ROOT
143
+ });
144
+ }
145
+ //#endregion
146
+ export { CODEX_MANAGED_APP_SERVER_CHECK_ID, registerCodexManagedAppServerDoctorChecks };
@@ -1,4 +1,4 @@
1
- import { J as unsubscribeCodexAppServerLiveThread, ct as isJsonObject, p as retireSharedCodexAppServerClientIfCurrent, z as CodexAppServerRpcError } from "./shared-client-kIBbGjk4.js";
1
+ import { $ as CodexAppServerRpcError, Ht as isJsonObject, wt as unsubscribeCodexAppServerLiveThread, y as retireSharedCodexAppServerClientIfCurrent } from "./shared-client-kNkljY-R.js";
2
2
  import { asFiniteNumber, normalizeOptionalString, normalizeOptionalString as normalizeOptionalString$1, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
4
4
  import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -259,6 +259,7 @@ var CodexProjectionDiagnostics = class {
259
259
  //#region extensions/codex/src/app-server/turn-router.ts
260
260
  /** Keyed routing for all turn traffic on one shared Codex app-server client. */
261
261
  const DEFAULT_PREBIND_NOTIFICATION_LIMIT = 256;
262
+ const DEFAULT_GLOBAL_WARNING_LIMIT = 32;
262
263
  const CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS = 3e4;
263
264
  const routers = /* @__PURE__ */ new WeakMap();
264
265
  /** Returns the sole router installed on a physical app-server client. */
@@ -272,6 +273,7 @@ function getCodexAppServerTurnRouter(client) {
272
273
  var ClientTurnRouter = class {
273
274
  constructor(client) {
274
275
  this.routes = /* @__PURE__ */ new Map();
276
+ this.globalWarnings = [];
275
277
  this.nativeTurnCompletionWatchers = /* @__PURE__ */ new Map();
276
278
  this.disposed = false;
277
279
  client.addNotificationHandler((notification) => this.routeNotification(notification));
@@ -290,7 +292,11 @@ var ClientTurnRouter = class {
290
292
  ended: createDeferred(),
291
293
  activated: createDeferred(),
292
294
  gate: "open",
293
- pending: [],
295
+ pending: this.globalWarnings.map((notification) => ({
296
+ notification,
297
+ receivedAtMs: Date.now(),
298
+ scope: { threadId }
299
+ })),
294
300
  notificationTail: Promise.resolve(),
295
301
  completedNativeTurnIds: /* @__PURE__ */ new Set(),
296
302
  ignoredTurnNotificationKeys: /* @__PURE__ */ new Set()
@@ -412,6 +418,15 @@ var ClientTurnRouter = class {
412
418
  routeNotification(notification) {
413
419
  if (this.disposed) return;
414
420
  const scope = readScope(notification.params);
421
+ if (!scope.threadId && (notification.method === "configWarning" || notification.method === "warning")) {
422
+ if (this.globalWarnings.length === DEFAULT_GLOBAL_WARNING_LIMIT) this.globalWarnings.shift();
423
+ this.globalWarnings.push(notification);
424
+ for (const route of this.routes.values()) {
425
+ this.bufferNotification(route, notification, { threadId: route.threadId }, Date.now());
426
+ if (route.gate === "bound") this.flushNotifications(route);
427
+ }
428
+ return Promise.all([...this.routes.values()].map((route) => route.notificationTail)).then(() => void 0);
429
+ }
415
430
  const watchers = scope.threadId ? this.nativeTurnCompletionWatchers.get(scope.threadId) : void 0;
416
431
  const route = scope.threadId ? this.routes.get(scope.threadId) : void 0;
417
432
  if (!watchers && !route) return;
@@ -489,6 +504,10 @@ var ClientTurnRouter = class {
489
504
  const handler = route.handlers?.onNotification;
490
505
  if (!handler) return;
491
506
  for (const pending of route.pending.splice(0)) {
507
+ if (route.gate !== "bound" && (pending.notification.method === "configWarning" || pending.notification.method === "warning" && !readScope(pending.notification.params).threadId)) {
508
+ route.pending.push(pending);
509
+ continue;
510
+ }
492
511
  if (route.gate === "bound" && pending.scope.turnId && pending.scope.turnId !== route.turnId) {
493
512
  this.warnDroppedStaleTurnNotification(route, pending.notification, pending.scope);
494
513
  continue;
@@ -541,7 +560,7 @@ var ClientTurnRouter = class {
541
560
  await Promise.race([route.notificationTail, route.ended.promise]);
542
561
  }
543
562
  async drainNotifications(route) {
544
- await route.notificationTail;
563
+ await Promise.race([route.notificationTail, route.ended.promise]);
545
564
  }
546
565
  release(route, error = /* @__PURE__ */ new Error("codex app-server thread route is released")) {
547
566
  if (route.released) return;
@@ -677,12 +696,35 @@ async function interruptCodexTurnAndWaitBestEffort(client, params) {
677
696
  completion?.cancel();
678
697
  }
679
698
  }
699
+ /** Stops native terminals on the cancelled thread without retiring peer threads. */
700
+ async function terminateCodexBackgroundTerminals(client, threadId) {
701
+ const options = {
702
+ timeoutMs: CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS,
703
+ signal: AbortSignal.timeout(CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS)
704
+ };
705
+ try {
706
+ const { data } = await client.request("thread/backgroundTerminals/list", { threadId }, options);
707
+ for (const { processId } of data) await client.request("thread/backgroundTerminals/terminate", {
708
+ threadId,
709
+ processId
710
+ }, options);
711
+ if (data.length > 0) {
712
+ if ((await client.request("thread/backgroundTerminals/list", {
713
+ threadId,
714
+ limit: 1
715
+ }, options)).data.length > 0) throw new Error("native background terminals remain running");
716
+ }
717
+ } catch (cause) {
718
+ throw new Error("Codex background-terminal cleanup failed; inspect the thread's running terminals before starting more work.", { cause });
719
+ }
720
+ }
680
721
  /** Unsubscribes from a thread while swallowing cleanup-only failures. */
681
722
  async function unsubscribeCodexThreadBestEffort(client, params) {
682
723
  try {
683
- await unsubscribeCodexAppServerLiveThread(client, params.threadId, params.timeoutMs);
724
+ await unsubscribeCodexAppServerLiveThread(client, params.threadId, params.timeoutMs, params.assertCurrent);
684
725
  return true;
685
726
  } catch (error) {
727
+ params.assertCurrent?.();
686
728
  embeddedAgentLog.debug("codex app-server thread unsubscribe cleanup failed", {
687
729
  threadId: params.threadId,
688
730
  error
@@ -732,4 +774,4 @@ async function retireCodexAppServerClientAfterTimedOutTurn(client, params) {
732
774
  });
733
775
  }
734
776
  //#endregion
735
- export { shouldSynthesizeToolProgressForItem as A, readNullableString as B, isSideEffectingNativeToolItem as C, itemTitle as D, itemStatus as E, readItem as F, readItemString as I, readNonEmptyString as L, normalizeOptionalString$1 as M, readCodexErrorNotificationMessage as N, shouldClearTerminalPresentationForNativeItem as O, readHookOutputEntries as P, readNonEmptyStringArray as R, isNonSuccessItemStatus as S, itemName as T, splitPlanText as V, readCodexNotificationTurnId as _, closeCodexStartupClientBestEffort as a, auditNativeToolUnfinishedStatus as b, isCodexAppServerUnsafeSubscriptionError as c, unsubscribeCodexThreadBestEffort as d, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as f, readCodexNotificationThreadId as g, isCodexNotificationForTurn as h, assertCodexThreadResumeSubscription as i, extractRawAssistantText as j, shouldRecordNativeToolTranscript as k, retireCodexAppServerClientAfterTimedOutTurn as l, CodexProjectionDiagnostics as m, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as n, interruptCodexTurnAndWaitBestEffort as o, getCodexAppServerTurnRouter as p, CodexAppServerUnsafeSubscriptionError as r, isCodexAlreadyTerminalInterruptError as s, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as t, retireUnsafeCodexTurnClientBestEffort as u, auditNativeToolName as v, itemKind as w, isMutatingNativeToolItem as x, auditNativeToolTerminalStatus as y, readNonNegativeInteger as z };
777
+ export { shouldRecordNativeToolTranscript as A, readNonNegativeInteger as B, isNonSuccessItemStatus as C, itemStatus as D, itemName as E, readHookOutputEntries as F, splitPlanText as H, readItem as I, readItemString as L, extractRawAssistantText as M, normalizeOptionalString$1 as N, itemTitle as O, readCodexErrorNotificationMessage as P, readNonEmptyString as R, isMutatingNativeToolItem as S, itemKind as T, readNullableString as V, readCodexNotificationThreadId as _, closeCodexStartupClientBestEffort as a, auditNativeToolTerminalStatus as b, isCodexAppServerUnsafeSubscriptionError as c, terminateCodexBackgroundTerminals as d, unsubscribeCodexThreadBestEffort as f, isCodexNotificationForTurn as g, CodexProjectionDiagnostics as h, assertCodexThreadResumeSubscription as i, shouldSynthesizeToolProgressForItem as j, shouldClearTerminalPresentationForNativeItem as k, retireCodexAppServerClientAfterTimedOutTurn as l, getCodexAppServerTurnRouter as m, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as n, interruptCodexTurnAndWaitBestEffort as o, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as p, CodexAppServerUnsafeSubscriptionError as r, isCodexAlreadyTerminalInterruptError as s, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as t, retireUnsafeCodexTurnClientBestEffort as u, readCodexNotificationTurnId as v, isSideEffectingNativeToolItem as w, auditNativeToolUnfinishedStatus as x, auditNativeToolName as y, readNonEmptyStringArray as z };
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
2
  import { fingerprintResolvedAuthProfileCredential } from "openclaw/plugin-sdk/agent-harness-runtime";
3
3
  import { resolveApiKeyForProfile } from "openclaw/plugin-sdk/agent-runtime";
4
+ import { resolveOpenAICodexAuthIdentity } from "openclaw/plugin-sdk/provider-auth";
4
5
  //#region extensions/codex/src/app-server/auth-binding.ts
5
6
  var auth_binding_exports = /* @__PURE__ */ __exportAll({
6
7
  fingerprintCodexAppServerAuthBinding: () => fingerprintCodexAppServerAuthBinding,
@@ -26,14 +27,28 @@ function withMaterializedCredential(params) {
26
27
  /** Resolves one forwarded profile once so attestation and execution share exact material. */
27
28
  async function prepareCodexAppServerAuthBinding(params) {
28
29
  const credential = params.authProfileStore.profiles[params.authProfileId];
29
- if (!credential || credential.type === "oauth") return;
30
+ if (!credential) return;
31
+ if (credential.type === "oauth") {
32
+ const fingerprint = fingerprintResolvedAuthProfileCredential({
33
+ profileId: params.authProfileId,
34
+ credential: {
35
+ ...credential,
36
+ accountId: resolveOpenAICodexAuthIdentity(credential).accountId
37
+ },
38
+ resolvedAuth: void 0
39
+ });
40
+ return fingerprint ? {
41
+ fingerprint,
42
+ authProfileStore: structuredClone(params.authProfileStore)
43
+ } : void 0;
44
+ }
30
45
  const resolved = await resolveApiKeyForProfile({
31
46
  cfg: params.config,
32
47
  store: params.authProfileStore,
33
48
  profileId: params.authProfileId,
34
49
  agentDir: params.agentDir
35
50
  });
36
- if (!resolved?.apiKey) throw new Error(`Codex could not resolve auth profile "${params.authProfileId}".`);
51
+ if (!resolved?.apiKey) throw new Error(`Codex could not resolve auth profile "${params.authProfileId}". Repair or replace its credential or SecretRef, then retry.`);
37
52
  const fingerprint = fingerprintResolvedAuthProfileCredential({
38
53
  profileId: params.authProfileId,
39
54
  credential,
@@ -44,7 +59,7 @@ async function prepareCodexAppServerAuthBinding(params) {
44
59
  mode: credential.type === "api_key" ? "api-key" : "token"
45
60
  }
46
61
  });
47
- if (!fingerprint) throw new Error(`Codex could not attest auth profile "${params.authProfileId}".`);
62
+ if (!fingerprint) throw new Error(`Codex could not attest auth profile "${params.authProfileId}". Re-select the OpenAI profile and retry.`);
48
63
  return {
49
64
  fingerprint,
50
65
  authProfileStore: withMaterializedCredential({
@@ -1,5 +1,5 @@
1
- import { T as readCodexPluginConfig, g as resolveCodexAppServerRuntimeOptions, y as resolveCodexSupervisionAppServerRuntimeOptions } from "./session-binding-DPxIvMgE.js";
2
- import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-C3H2CVp6.js";
1
+ import { T as readCodexPluginConfig, i as resolveCodexAppServerRuntimeOptions, s as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-Cxw3Cl3k.js";
2
+ import { n as buildCodexAppServerConnectionFingerprint, o as resolveCodexCatalogConnectionHome } from "./thread-resume-DF54hagX.js";
3
3
  //#region extensions/codex/src/app-server/binding-connection.ts
4
4
  /** Requires the native model pair after a supervised pending branch has materialized. */
5
5
  function requireCodexSupervisionModelSelection(binding) {
@@ -16,9 +16,21 @@ function resolveCodexBindingAppServerConnection(params) {
16
16
  const { binding, authProfileId, ...runtimeParams } = params;
17
17
  const usesSupervisionConnection = binding?.connectionScope === "supervision";
18
18
  if (usesSupervisionConnection && readCodexPluginConfig(runtimeParams.pluginConfig).supervision?.enabled !== true) throw new Error("Codex supervision is disabled; refusing to open a native user-home supervised session");
19
- const appServer = (usesSupervisionConnection ? resolveCodexSupervisionAppServerRuntimeOptions : resolveCodexAppServerRuntimeOptions)(runtimeParams);
19
+ let appServer = (usesSupervisionConnection ? resolveCodexSupervisionAppServerRuntimeOptions : resolveCodexAppServerRuntimeOptions)(runtimeParams);
20
20
  if (usesSupervisionConnection) {
21
21
  const persistedFingerprint = binding.pendingSupervisionBranch?.connectionFingerprint ?? binding.appServerRuntimeFingerprint;
22
+ const catalogHome = persistedFingerprint ? resolveCodexCatalogConnectionHome(persistedFingerprint, runtimeParams.agentDir) : void 0;
23
+ if (catalogHome) appServer = {
24
+ ...appServer,
25
+ start: {
26
+ ...appServer.start,
27
+ homeScope: "user",
28
+ env: {
29
+ ...appServer.start.env,
30
+ CODEX_HOME: catalogHome
31
+ }
32
+ }
33
+ };
22
34
  const currentFingerprint = buildCodexAppServerConnectionFingerprint(appServer, runtimeParams.agentDir);
23
35
  if (!persistedFingerprint || persistedFingerprint !== currentFingerprint) throw new Error("Codex supervision connection changed; refusing to operate on its bound native thread");
24
36
  }
@@ -1,10 +1,11 @@
1
- import { g as resolveCodexAppServerRuntimeOptions } from "./session-binding-DPxIvMgE.js";
2
- import { ct as isJsonObject, s as isCodexAppServerStartSelectionChangedError } from "./shared-client-kIBbGjk4.js";
3
- import { _ as readCodexNotificationTurnId, a as closeCodexStartupClientBestEffort, o as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./attempt-client-cleanup-DMLXUfa8.js";
4
- import { b as isTerminalTurnStatus, n as normalizeCodexResponseTokenUsage, x as readCodexNotificationItem, y as isRetryableErrorNotification } from "./event-projector-usage-e5huIQWu.js";
5
- import { a as assertCodexThreadStartResponse, c as readCodexErrorNotification, o as assertCodexTurnStartResponse, u as readCodexTurnCompletedNotification } from "./protocol-validators-B4F7L8Rf.js";
6
- import { r as readModelListResult } from "./models-BFlpn1Ex.js";
7
- import { W as mergeCodexThreadConfigs, c as buildCodexRingZeroThreadConfigPatch, l as buildCodexRuntimeThreadConfig, o as assertCodexRestrictedToolSurfaceHasNoManagedHooks, s as attestCodexRestrictedToolSurfaceMcpServersDisabled, u as readCodexInheritedMcpServerNames } from "./thread-lifecycle-Bu1BTDXr.js";
1
+ import { n as readCodexAppServerConfigOptions } from "./launch-args-sXOAg0SX.js";
2
+ import { i as resolveCodexAppServerRuntimeOptions } from "./config-Cxw3Cl3k.js";
3
+ import { Ht as isJsonObject, et as createCodexElicitationResponse, u as isCodexAppServerStartSelectionChangedError } from "./shared-client-kNkljY-R.js";
4
+ import { c as assertCodexTurnStartResponse, f as readCodexTurnCompletedNotification, s as assertCodexThreadStartResponse, u as readCodexErrorNotification } from "./protocol-validators-Bg5rpNxk.js";
5
+ import { a as closeCodexStartupClientBestEffort, o as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS, v as readCodexNotificationTurnId } from "./attempt-client-cleanup-CVPvp9dL.js";
6
+ import { b as isTerminalTurnStatus, n as normalizeCodexResponseTokenUsage, x as readCodexNotificationItem, y as isRetryableErrorNotification } from "./event-projector-usage-D3PHFFXh.js";
7
+ import { r as readModelListResult } from "./models-DgFWSuxA.js";
8
+ import { _ as buildCodexRingZeroThreadConfigPatch, g as attestCodexRestrictedToolSurfaceMcpServersDisabled, h as assertCodexManagedRequirementsDoNotOverrideToolPolicy, ot as mergeCodexThreadConfigs, v as buildCodexRuntimeThreadConfig, y as readCodexInheritedMcpServerNames } from "./thread-lifecycle-Ss-uwnC4.js";
8
9
  import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
9
10
  import fs from "node:fs/promises";
10
11
  import path from "node:path";
@@ -65,11 +66,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
65
66
  const timeoutMs = deadline - Date.now();
66
67
  if (timeoutMs <= 0) throw timeoutError;
67
68
  const agentDir = params.agentDir?.trim() || void 0;
68
- const isolatedStartOptions = workspace.codexHome ? buildPrivateCodexAppServerStartOptions(appServer.start, workspace.codexHome) : appServer.start;
69
- const startOptions = workspace.codexHome && params.preparedAuth ? {
70
- ...isolatedStartOptions,
71
- homeScope: "agent"
72
- } : isolatedStartOptions;
69
+ const startOptions = workspace.codexHome ? buildPrivateCodexAppServerStartOptions(appServer.start, workspace.codexHome) : appServer.start;
73
70
  const ownsClient = !params.options.clientFactory;
74
71
  const authSelection = params.preparedAuth ? { preparedAuth: params.preparedAuth } : { authProfileId: params.profile };
75
72
  const client = params.options.clientFactory ? await params.options.clientFactory({
@@ -80,7 +77,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
80
77
  config: params.config,
81
78
  timeoutMs,
82
79
  ...params.signal ? { abandonSignal: params.signal } : {}
83
- }) : await import("./shared-client-kIBbGjk4.js").then((n) => n.m).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
80
+ }) : await import("./shared-client-kNkljY-R.js").then((n) => n.x).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
84
81
  startOptions,
85
82
  timeoutMs,
86
83
  ...authSelection,
@@ -115,7 +112,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
115
112
  timeout.unref?.();
116
113
  let retrySelection = false;
117
114
  try {
118
- const model = await resolveCodexBoundedTurnModel({
115
+ const modelSelection = await resolveCodexBoundedTurnModel({
119
116
  client,
120
117
  selection: params.model,
121
118
  requiredModalities: params.requiredModalities,
@@ -123,10 +120,10 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
123
120
  signal: abortController.signal
124
121
  });
125
122
  const inheritedMcpServerNames = params.requireNoExternalCapabilities ? await readCodexInheritedMcpServerNames(client, workspace.cwd, abortController.signal) : [];
126
- if (params.requireNoExternalCapabilities) await assertCodexRestrictedToolSurfaceHasNoManagedHooks(client, abortController.signal);
123
+ if (params.requireNoExternalCapabilities) await assertCodexManagedRequirementsDoNotOverrideToolPolicy(client, { restrictedToolSurface: true }, abortController.signal);
127
124
  const threadConfig = buildCodexRuntimeThreadConfig(resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames), { nativeCodeModeEnabled: false });
128
125
  const thread = assertCodexThreadStartResponse(await client.request("thread/start", {
129
- model,
126
+ model: modelSelection.runtimeModelId,
130
127
  ...params.modelProvider ? { modelProvider: params.modelProvider } : {},
131
128
  cwd: workspace.cwd,
132
129
  approvalPolicy: "on-request",
@@ -161,7 +158,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
161
158
  threadId: thread.thread.id,
162
159
  input: params.input,
163
160
  approvalPolicy: "on-request",
164
- model,
161
+ model: modelSelection.runtimeModelId,
165
162
  effort: "low"
166
163
  }, {
167
164
  timeoutMs,
@@ -174,7 +171,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
174
171
  signal: abortController.signal,
175
172
  timeoutError
176
173
  }),
177
- model
174
+ model: modelSelection.catalogId
178
175
  };
179
176
  } finally {
180
177
  await interruptPromise;
@@ -204,10 +201,7 @@ function resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames)
204
201
  return mergeCodexThreadConfigs(privateConfig, CODEX_SETTLED_FINALIZER_THREAD_CONFIG, buildCodexRingZeroThreadConfigPatch({ toolsAllow: ["openclaw"] }, true, inheritedMcpServerNames)) ?? privateConfig;
205
202
  }
206
203
  function buildPrivateCodexAppServerStartOptions(start, codexHome) {
207
- const providerArgs = start.args.flatMap((arg, index) => {
208
- const override = arg === "-c" || arg === "--config" ? start.args[index + 1] : arg.startsWith("--config=") ? arg.slice(9) : void 0;
209
- return override && /^\s*(?:openai_base_url|model_catalog_json)\s*=/u.test(override) ? ["-c", override] : [];
210
- });
204
+ const providerArgs = readCodexAppServerConfigOptions(start.args).flatMap(({ name, value }) => (name === "-c" || name === "--config") && value && /^\s*(?:openai_base_url|model_catalog_json)\s*=/u.test(value) ? ["-c", value] : []);
211
205
  const privateEnv = Object.fromEntries(Object.entries(start.env ?? {}).filter(([name]) => name.trim().toUpperCase() !== CODEX_APP_SERVER_ARGS_ENV_KEY));
212
206
  const clearEnv = (start.clearEnv ?? []).filter((name) => {
213
207
  const normalized = name.trim().toUpperCase();
@@ -215,6 +209,7 @@ function buildPrivateCodexAppServerStartOptions(start, codexHome) {
215
209
  });
216
210
  return {
217
211
  ...start,
212
+ homeScope: "agent",
218
213
  args: [
219
214
  "app-server",
220
215
  ...providerArgs,
@@ -242,14 +237,14 @@ function createCodexBoundedApprovalHandler(taskLabel) {
242
237
  decision: "decline",
243
238
  reason: `OpenClaw Codex ${taskLabel} does not grant native approvals.`
244
239
  };
245
- if (request.method === "mcpServer/elicitation/request") return { action: "decline" };
240
+ if (request.method === "mcpServer/elicitation/request") return createCodexElicitationResponse("decline", null, { message: `OpenClaw Codex ${taskLabel} does not support interactive input.` });
246
241
  };
247
242
  }
248
243
  async function resolveCodexBoundedTurnModel(params) {
249
244
  const listed = readModelListResult(await params.client.request("model/list", {
250
245
  limit: null,
251
246
  cursor: null,
252
- includeHidden: false
247
+ includeHidden: params.selection.mode === "required"
253
248
  }, {
254
249
  timeoutMs: Math.min(params.timeoutMs, 5e3),
255
250
  signal: params.signal
@@ -258,14 +253,20 @@ async function resolveCodexBoundedTurnModel(params) {
258
253
  const supported = listed.filter((entry) => params.requiredModalities.every((modality) => entry.inputModalities.includes(modality)));
259
254
  const selected = supported.find((entry) => entry.isDefault) ?? supported[0];
260
255
  if (!selected) throw new Error(`Codex app-server has no model supporting ${params.requiredModalities.join(" and ")} input.`);
261
- return selected.model;
256
+ return {
257
+ catalogId: selected.id,
258
+ runtimeModelId: selected.model
259
+ };
262
260
  }
263
261
  const model = params.selection.id;
264
262
  const match = listed.find((entry) => entry.model === model || entry.id === model);
265
263
  if (!match) throw new Error(`Codex app-server model not found: ${model}`);
266
264
  if (params.requiredModalities.includes("image") && !match.inputModalities.includes("image")) throw new Error(`Codex app-server model does not support images: ${model}`);
267
265
  if (params.requiredModalities.includes("text") && !match.inputModalities.includes("text")) throw new Error(`Codex app-server model does not support text: ${model}`);
268
- return model;
266
+ return {
267
+ catalogId: match.id,
268
+ runtimeModelId: match.model
269
+ };
269
270
  }
270
271
  function createCodexBoundedTurnCollector(threadId, taskLabel, allowEmptyText) {
271
272
  let turnId;
@@ -1,4 +1,4 @@
1
- import { z as CodexAppServerRpcError } from "./shared-client-kIBbGjk4.js";
1
+ import { $ as CodexAppServerRpcError } from "./shared-client-kNkljY-R.js";
2
2
  //#region extensions/codex/src/app-server/capabilities.ts
3
3
  /**
4
4
  * Capability helpers for optional Codex app-server control-plane methods.
@@ -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-7hgXZDV7.js");
5
+ const { registerCodexSessionCli } = await import("./session-cli-BuDjm5Ou.js");
6
6
  registerCodexSessionCli(program);
7
7
  }, { descriptors: [{
8
8
  name: "codex",
@@ -1,5 +1,5 @@
1
- import { ct as isJsonObject } from "./shared-client-kIBbGjk4.js";
2
- import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-DZXmOL8-.js";
1
+ import { Ht as isJsonObject } from "./shared-client-kNkljY-R.js";
2
+ import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-hFtzt2Up.js";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/codex/src/command-formatters.ts
5
5
  /**