@openclaw/codex 2026.8.1-beta.2 → 2026.9.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/api.js +147 -0
  2. package/dist/{attempt-client-cleanup-DMLXUfa8.js → attempt-client-cleanup-bfsmcQ6m.js} +21 -2
  3. package/dist/{binding-connection-I5Bo-AsX.js → binding-connection-BMvPX73o.js} +15 -3
  4. package/dist/{bounded-turn-qgZmzy_4.js → bounded-turn-B7iBUcuP.js} +22 -16
  5. package/dist/{capabilities-CybGI1oz.js → capabilities-BRMh0aIq.js} +1 -1
  6. package/dist/cli-metadata.js +1 -1
  7. package/dist/{command-formatters-B1AEz8ZA.js → command-formatters-DEsIufkt.js} +2 -2
  8. package/dist/{command-handlers-Db8pu_ds.js → command-handlers-D_-1_qRp.js} +65 -37
  9. package/dist/command-rpc-CCeCkf_v.js +90 -0
  10. package/dist/{compact-LspQaGfl.js → compact-BglNFZrQ.js} +35 -29
  11. package/dist/{session-binding-DPxIvMgE.js → config-giW8X0QA.js} +108 -914
  12. package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
  13. package/dist/doctor-contract-api.js +23 -21
  14. package/dist/{dynamic-tools-BVdyWkUD.js → dynamic-tools-Dnlfa--w.js} +1345 -1424
  15. package/dist/{effective-mcp-catalog-DIIhAtOZ.js → effective-mcp-catalog-CTeGrnfO.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-Bk1I90Bg.js} +18 -18
  19. package/dist/harness-Csz0F-DK.js +258 -0
  20. package/dist/harness.js +2 -226
  21. package/dist/index.js +262 -181
  22. package/dist/{isolated-completion-C58NbL40.js → isolated-completion-Cv6FqygM.js} +4 -4
  23. package/dist/managed-binary-DFYK4DWq.js +248 -0
  24. package/dist/media-understanding-provider.js +2 -2
  25. package/dist/model-catalog-i9rNBthX.js +48 -0
  26. package/dist/{models-BFlpn1Ex.js → models-TS3HBU-q.js} +4 -3
  27. package/dist/{native-subagent-monitor-DyTGmTUx.js → native-subagent-monitor-4Mfq2HDs.js} +354 -83
  28. package/dist/node-exec-server.runtime-BpWqJO1V.js +192 -0
  29. package/dist/{plugin-app-cache-key-C3H2CVp6.js → plugin-app-cache-key-C1CAdfcP.js} +19 -4
  30. package/dist/plugin-approval-roundtrip-bUm777tR.js +95 -0
  31. package/dist/{plugin-marketplace-discovery-CzrGJdCR.js → plugin-marketplace-discovery-B9DvaAG-.js} +59 -54
  32. package/dist/{plugin-metadata-cache-CNJPj4_b.js → plugin-metadata-cache-CTCT3w5L.js} +164 -134
  33. package/dist/{protocol-validators-B4F7L8Rf.js → protocol-validators-VeJxxJ0U.js} +80 -5
  34. package/dist/{rate-limits-DZXmOL8-.js → rate-limits-C5_D8Gmb.js} +1 -1
  35. package/dist/{request-BRl5_UfX.js → request-DXXGHko0.js} +2 -2
  36. package/dist/{run-attempt-P8BdxC1I.js → run-attempt-DYc0QCBF.js} +1276 -765
  37. package/dist/{runtime-artifact-BVSPdd6g.js → runtime-artifact-BvyT1uyd.js} +4 -7
  38. package/dist/{sandbox-guard-Cmwc9eIk.js → sandbox-guard-kuWTn9C5.js} +25 -19
  39. package/dist/session-binding-Bcynfd-_.js +874 -0
  40. package/dist/{session-catalog-xwNi_SDM.js → session-catalog-DaLKVtpH.js} +1534 -1288
  41. package/dist/session-catalog-home-id-BNwAJ9D7.js +18 -0
  42. package/dist/{session-cli-7hgXZDV7.js → session-cli-DMc4oS2w.js} +20 -7
  43. package/dist/session-permission-policy-BrNH1bjy.js +160 -0
  44. package/dist/{session-retirement-DoMMJFKm.js → session-retirement-CcNC3YSY.js} +3 -3
  45. package/dist/{session-upstream-marker-CrIFX06J.js → session-upstream-marker-BIkusb95.js} +1 -1
  46. package/dist/{settled-turn-finalizer-BRWBO4MO.js → settled-turn-finalizer-Dc3ApjU4.js} +24 -20
  47. package/dist/{shared-client-kIBbGjk4.js → shared-client-DKz23hHY.js} +1632 -372
  48. package/dist/{side-question-9HAL26l9.js → side-question-DjA_jsNe.js} +105 -54
  49. package/dist/{thread-lifecycle-Bu1BTDXr.js → thread-lifecycle-L7oEkTlq.js} +1147 -114
  50. package/dist/{thread-ownership-6kOQHlyC.js → thread-ownership-DZeuKH1j.js} +2 -2
  51. package/dist/{thread-resume-CPrJNQVM.js → thread-resume-BE9qNEW0.js} +3 -3
  52. package/dist/{transcript-mirror-B9gGgnJS.js → transcript-mirror-DsCMWBca.js} +137 -38
  53. package/dist/{transport-stdio-DIImwDVS.js → transport-stdio-DhoGy33Z.js} +2 -2
  54. package/dist/{upstream-prompt-provenance-ClRBije0.js → upstream-prompt-provenance-CFmsKwr9.js} +12 -14
  55. package/dist/{upstream-session-fork-CE-_LdnP.js → upstream-session-fork-DlaHxSLC.js} +12 -6
  56. package/dist/{usage-CHlV0e-o.js → usage-ROIaW3wo.js} +3 -3
  57. package/dist/{web-search-provider.runtime-DRw2Vl42.js → web-search-provider.runtime-ClaNPV7N.js} +3 -3
  58. package/openclaw.plugin.json +49 -2
  59. package/package.json +9 -8
  60. package/dist/app-server-policy-zcBDc1JU.js +0 -49
@@ -1,91 +1,11 @@
1
- import { g as resolveCodexAppServerRuntimeOptions, v as resolveCodexComputerUseConfig } from "./session-binding-DPxIvMgE.js";
2
- import { M as isCodexAppServerConnectionClosedError, N as isCodexAppServerIndeterminateRequestCancellationError, P as isCodexAppServerIndeterminateTransportError, a as getLeasedSharedCodexAppServerClient, l as releaseLeasedSharedCodexAppServerClient, lt as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, u as resolveCodexNativeConfigFenceKey, v as acquireCodexNativeConfigFence } from "./shared-client-kIBbGjk4.js";
3
- import { n as describeControlFailure } from "./capabilities-CybGI1oz.js";
4
- import { r as requestCodexAppServerJson } from "./request-BRl5_UfX.js";
1
+ import { i as resolveCodexAppServerRuntimeOptions, o as resolveCodexComputerUseConfig } from "./config-giW8X0QA.js";
2
+ import { L as isCodexAppServerConnectionClosedError, R as isCodexAppServerIndeterminateRequestCancellationError, S as acquireCodexNativeConfigFence, b as waitForCodexAppServerClientDesktopGenerationDrain, bt as assertNotSymlink, c as isCodexAppServerStartSelectionChangedError, d as readCodexAppServerClientProcessIdentity, l as readCodexAppServerClientDesktopGeneration, m as resolveCodexNativeConfigFenceKey, o as getLeasedSharedCodexAppServerClient, p as releaseLeasedSharedCodexAppServerClient, st as reconcileCodexComputerUseStartArtifacts, t as assertCodexAppServerClientStartSelectionCurrent, xt as resolveCodexAppServerHomeDir, yt as resolveCodexManagedBundledMarketplacePath, z as isCodexAppServerIndeterminateTransportError } from "./shared-client-DKz23hHY.js";
3
+ import { l as resolveMacOSDesktopCodexBundledMarketplaceCandidates, s as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, t as isManagedCodexDesktopCommand } from "./managed-binary-DFYK4DWq.js";
4
+ import { n as describeControlFailure } from "./capabilities-BRMh0aIq.js";
5
+ import { r as requestCodexAppServerJson } from "./request-DXXGHko0.js";
6
+ import fs from "node:fs/promises";
7
+ import path from "node:path";
5
8
  import { existsSync } from "node:fs";
6
- import { runExec } from "openclaw/plugin-sdk/process-runtime";
7
- //#region extensions/codex/src/app-server/computer-use-process-repair.ts
8
- const COMPUTER_USE_PROCESS_LIST_TIMEOUT_MS = 2e3;
9
- const COMPUTER_USE_PROCESS_LIST_MAX_BUFFER_BYTES = 5 * 1024 * 1024;
10
- function scopedRepairUnavailableStatus() {
11
- return {
12
- attempted: false,
13
- killedPids: [],
14
- warnings: ["Computer Use auto-repair skipped because no scoped Codex app-server process was available."],
15
- message: "Computer Use stale child repair requires a scoped local app-server PID."
16
- };
17
- }
18
- async function killStaleComputerUseMcpChildren(options = {}) {
19
- if (process.platform !== "darwin") return {
20
- attempted: true,
21
- killedPids: [],
22
- warnings: [`Computer Use stale child repair is currently macOS-only, not ${process.platform}.`],
23
- message: "Computer Use stale child repair skipped on this platform."
24
- };
25
- if (!options.ancestorPid || !Number.isSafeInteger(options.ancestorPid) || options.ancestorPid <= 0) return scopedRepairUnavailableStatus();
26
- let stdout;
27
- try {
28
- stdout = (await runExec("/bin/ps", ["-axo", "pid=,ppid=,command="], {
29
- logOutput: false,
30
- maxBuffer: COMPUTER_USE_PROCESS_LIST_MAX_BUFFER_BYTES,
31
- timeoutMs: COMPUTER_USE_PROCESS_LIST_TIMEOUT_MS
32
- })).stdout;
33
- } catch (error) {
34
- return {
35
- attempted: true,
36
- killedPids: [],
37
- warnings: [`Could not list processes for Computer Use repair: ${describeControlFailure(error)}`],
38
- message: "Computer Use stale child repair could not inspect running processes."
39
- };
40
- }
41
- const killedPids = [];
42
- const warnings = [];
43
- const processInfos = parsePsOutput(stdout);
44
- for (const processInfo of processInfos) {
45
- if (!isStaleComputerUseMcpChild(processInfo.command)) continue;
46
- if (!isDescendantOfPid(processInfo.pid, options.ancestorPid, processInfos)) continue;
47
- try {
48
- process.kill(processInfo.pid, "SIGTERM");
49
- killedPids.push(processInfo.pid);
50
- } catch (error) {
51
- warnings.push(`Could not terminate stale Computer Use MCP child pid ${processInfo.pid}: ${describeControlFailure(error)}`);
52
- }
53
- }
54
- return {
55
- attempted: true,
56
- killedPids,
57
- warnings,
58
- message: killedPids.length === 0 ? "No stale Computer Use MCP children were found under the scoped Codex app-server process." : `Terminated ${killedPids.length} stale Computer Use MCP child process${killedPids.length === 1 ? "" : "es"} under the scoped Codex app-server process.`
59
- };
60
- }
61
- function parsePsOutput(stdout) {
62
- return stdout.split(/\r?\n/u).flatMap((line) => {
63
- const match = /^\s*(\d+)\s+(\d+)\s+(.+)$/u.exec(line);
64
- if (!match) return [];
65
- return [{
66
- pid: Number(match[1]),
67
- ppid: Number(match[2]),
68
- command: match[3] ?? ""
69
- }];
70
- }).filter((processInfo) => Number.isSafeInteger(processInfo.pid) && processInfo.pid > 0 && Number.isSafeInteger(processInfo.ppid) && processInfo.ppid >= 0);
71
- }
72
- function isStaleComputerUseMcpChild(command) {
73
- return command.includes("SkyComputerUseClient") && /(?:^|\s)mcp(?:\s|$)/u.test(command);
74
- }
75
- function isDescendantOfPid(pid, ancestorPid, processInfos) {
76
- const parents = new Map(processInfos.map((processInfo) => [processInfo.pid, processInfo.ppid]));
77
- const seen = /* @__PURE__ */ new Set();
78
- let current = pid;
79
- while (!seen.has(current)) {
80
- seen.add(current);
81
- const parent = parents.get(current);
82
- if (!parent || parent <= 0) return false;
83
- if (parent === ancestorPid) return true;
84
- current = parent;
85
- }
86
- return false;
87
- }
88
- //#endregion
89
9
  //#region extensions/codex/src/app-server/computer-use.ts
90
10
  /**
91
11
  * Computer Use plugin/MCP readiness checks and optional install flow for Codex
@@ -99,8 +19,9 @@ var CodexComputerUseSetupError = class extends Error {
99
19
  }
100
20
  };
101
21
  const CURATED_MARKETPLACE_POLL_INTERVAL_MS = 2e3;
22
+ const BUNDLED_MARKETPLACE_NAME = "openai-bundled";
102
23
  const COMPUTER_USE_MARKETPLACE_NAME_PRIORITY = [
103
- "openai-bundled",
24
+ BUNDLED_MARKETPLACE_NAME,
104
25
  "openai-curated",
105
26
  "openai-api-curated",
106
27
  "openai-curated-remote",
@@ -172,71 +93,96 @@ async function installCodexComputerUse(params = {}) {
172
93
  }
173
94
  async function inspectCodexComputerUse(params) {
174
95
  if (!params.installPlugin) return await inspectCodexComputerUseWithoutFence(params);
175
- const runtime = params.client ? void 0 : resolveCodexAppServerRuntimeOptions({
96
+ const resolvedRuntime = resolveCodexAppServerRuntimeOptions({
176
97
  pluginConfig: params.pluginConfig,
177
98
  managedCommandOrder: "desktop-first"
178
99
  });
179
- const fenceKey = resolveCodexNativeConfigFenceKey({
180
- client: params.client,
181
- startOptions: runtime?.start,
182
- agentDir: params.agentDir,
183
- config: params.config
184
- });
185
- if (!fenceKey) return await inspectCodexComputerUseWithoutFence(params);
186
- const release = await acquireCodexNativeConfigFence(fenceKey, {
187
- signal: params.signal,
188
- timeoutMs: params.timeoutMs ?? runtime?.requestTimeoutMs,
189
- timeoutMessage: "Codex Computer Use install timed out waiting for native config",
190
- abortMessage: "Codex Computer Use install aborted waiting for native config"
191
- });
192
- let releaseFenceOnReturn = true;
100
+ const operationTimeoutMs = params.timeoutMs ?? resolvedRuntime.requestTimeoutMs;
101
+ const deadline = operationTimeoutMs > 0 ? Date.now() + operationTimeoutMs : void 0;
102
+ const remainingTimeoutMs = () => deadline === void 0 ? operationTimeoutMs : Math.max(1, deadline - Date.now());
193
103
  let leasedClient;
194
104
  try {
195
105
  let client = params.client;
196
106
  if (!client && !params.request) {
197
- if (!runtime) throw new Error("Computer Use install could not resolve its app-server runtime");
198
107
  client = await getLeasedSharedCodexAppServerClient({
199
- startOptions: runtime.start,
108
+ startOptions: resolvedRuntime.start,
200
109
  pluginConfig: params.pluginConfig,
201
- timeoutMs: params.timeoutMs ?? runtime.requestTimeoutMs,
110
+ timeoutMs: remainingTimeoutMs(),
202
111
  config: params.config,
203
112
  agentDir: params.agentDir,
204
113
  abandonSignal: params.signal
205
114
  });
206
115
  leasedClient = client;
207
116
  }
208
- try {
209
- return await inspectCodexComputerUseWithoutFence({
210
- ...params,
211
- ...client ? {
212
- client,
213
- timeoutMs: params.timeoutMs ?? runtime?.requestTimeoutMs
214
- } : {}
117
+ const explicitManagedInstall = client && !resolveCodexComputerUseConfig({ pluginConfig: params.pluginConfig }).autoInstall ? await resolveExplicitManagedComputerUseInstallContext({
118
+ ...params,
119
+ client
120
+ }) : void 0;
121
+ if (explicitManagedInstall) {
122
+ await waitForCodexAppServerClientDesktopGenerationDrain({
123
+ client: explicitManagedInstall.client,
124
+ timeoutMs: remainingTimeoutMs(),
125
+ ...params.signal ? { signal: params.signal } : {}
215
126
  });
216
- } catch (error) {
217
- if (client && (isCodexAppServerIndeterminateRequestCancellationError(error) || isCodexAppServerIndeterminateTransportError(error) || isCodexAppServerConnectionClosedError(error))) {
218
- releaseFenceOnReturn = false;
219
- await client.closeAndRunAfterExit(release, "Computer Use config mutation");
127
+ assertCodexAppServerClientStartSelectionCurrent({ client: explicitManagedInstall.client });
128
+ }
129
+ const inspectionParams = {
130
+ ...params,
131
+ ...client ? { client } : {},
132
+ timeoutMs: remainingTimeoutMs(),
133
+ ...explicitManagedInstall ? { explicitManagedInstall } : {}
134
+ };
135
+ const fenceKey = resolveCodexNativeConfigFenceKey({
136
+ client,
137
+ startOptions: resolvedRuntime.start,
138
+ agentDir: params.agentDir,
139
+ config: params.config
140
+ });
141
+ if (!fenceKey) return await inspectCodexComputerUseWithoutFence(inspectionParams);
142
+ const release = await acquireCodexNativeConfigFence(fenceKey, {
143
+ signal: params.signal,
144
+ timeoutMs: remainingTimeoutMs(),
145
+ timeoutMessage: "Codex Computer Use install timed out waiting for native config",
146
+ abortMessage: "Codex Computer Use install aborted waiting for native config"
147
+ });
148
+ let releaseFenceOnReturn = true;
149
+ try {
150
+ try {
151
+ return await inspectCodexComputerUseWithoutFence({
152
+ ...inspectionParams,
153
+ releaseNativeConfigFence: release
154
+ });
155
+ } catch (error) {
156
+ if (client && (isCodexAppServerIndeterminateRequestCancellationError(error) || isCodexAppServerIndeterminateTransportError(error) || isCodexAppServerConnectionClosedError(error))) {
157
+ releaseFenceOnReturn = false;
158
+ await client.closeAndRunAfterExit(release, "Computer Use config mutation");
159
+ }
160
+ throw error;
220
161
  }
221
- throw error;
222
162
  } finally {
223
- if (leasedClient) releaseLeasedSharedCodexAppServerClient(leasedClient);
163
+ if (releaseFenceOnReturn) release();
224
164
  }
225
165
  } finally {
226
- if (releaseFenceOnReturn) release();
166
+ if (leasedClient) releaseLeasedSharedCodexAppServerClient(leasedClient);
227
167
  }
228
168
  }
229
169
  async function inspectCodexComputerUseWithoutFence(params) {
230
170
  const request = createComputerUseRequest(params);
231
- const repairComputerUseMcpChildren = params.repairComputerUseMcpChildren ?? (params.client ? () => killStaleComputerUseMcpChildren({ ancestorPid: params.client?.getTransportPid() }) : void 0);
232
- if (params.installPlugin) await request("experimentalFeature/enablement/set", { enablement: { plugins: true } });
171
+ if (params.installPlugin) {
172
+ if (!resolveCodexComputerUseConfig({ pluginConfig: params.pluginConfig }).autoInstall) await prepareExplicitManagedComputerUseInstall(params);
173
+ await request("experimentalFeature/enablement/set", { enablement: { plugins: true } });
174
+ }
175
+ const managedMarketplacePath = await resolveClientManagedBundledMarketplacePath(params.client, params.agentDir);
176
+ const managedCodexHome = managedMarketplacePath ? params.client?.getRuntimeIdentity()?.codexHome : void 0;
177
+ if (params.installPlugin && managedCodexHome) await assertNotSymlink(path.join(managedCodexHome, "config.toml"), "Codex config");
233
178
  const marketplace = await resolveMarketplaceRef({
234
179
  request,
235
180
  config: params.computerUseConfig,
236
181
  allowAdd: params.installPlugin,
237
182
  signal: params.signal,
238
- defaultBundledMarketplacePath: params.defaultBundledMarketplacePath,
239
- defaultBundledMarketplacePathCandidates: params.defaultBundledMarketplacePathCandidates
183
+ defaultBundledMarketplacePath: params.defaultBundledMarketplacePath ?? managedMarketplacePath,
184
+ defaultBundledMarketplacePathCandidates: params.defaultBundledMarketplacePathCandidates,
185
+ managedCodexHome
240
186
  });
241
187
  if (!marketplace.marketplace) return unavailableStatus(params.computerUseConfig, "marketplace_missing", marketplace.message ?? `No Codex marketplace containing ${params.computerUseConfig.pluginName} is registered. Configure computerUse.marketplaceSource or computerUse.marketplacePath, then run /codex computer-use install.`);
242
188
  const pluginInspection = await ensureComputerUsePlugin({
@@ -251,9 +197,59 @@ async function inspectCodexComputerUseWithoutFence(params) {
251
197
  config: params.computerUseConfig,
252
198
  plugin: pluginInspection.plugin,
253
199
  installPlugin: params.installPlugin,
254
- repairComputerUseMcpChildren
200
+ releaseNativeConfigFence: params.releaseNativeConfigFence
255
201
  });
256
202
  }
203
+ async function prepareExplicitManagedComputerUseInstall(params) {
204
+ const context = params.explicitManagedInstall;
205
+ if (!context) return;
206
+ await reconcileCodexComputerUseStartArtifacts({
207
+ startOptions: {
208
+ transport: "stdio",
209
+ command: context.command,
210
+ commandSource: "resolved-managed",
211
+ args: ["app-server"],
212
+ headers: {},
213
+ env: { CODEX_HOME: context.codexHome }
214
+ },
215
+ agentDir: context.agentDir,
216
+ pluginConfig: { computerUse: {
217
+ ...params.computerUseConfig,
218
+ autoInstall: true
219
+ } },
220
+ ownsIsolatedCodexHome: true,
221
+ desktopGeneration: context.desktopGeneration,
222
+ forceCacheRefresh: true,
223
+ assertCurrent: () => assertCodexAppServerClientStartSelectionCurrent({ client: context.client })
224
+ });
225
+ }
226
+ async function resolveExplicitManagedComputerUseInstallContext(params) {
227
+ if (!params.agentDir) return;
228
+ const codexHome = params.client.getRuntimeIdentity()?.codexHome;
229
+ const processIdentity = readCodexAppServerClientProcessIdentity(params.client);
230
+ const command = processIdentity?.nativeCommand ?? (processIdentity && isManagedCodexDesktopCommand(processIdentity.command, "darwin") ? processIdentity.command : void 0);
231
+ if (!codexHome || !command) return;
232
+ const desktopGeneration = readCodexAppServerClientDesktopGeneration(params.client);
233
+ if (!desktopGeneration) throw new Error("Codex Computer Use install requires a desktop-generation-bound client; reconnect and retry.");
234
+ const expectedHome = resolveCodexAppServerHomeDir(params.agentDir);
235
+ const [actualRealHome, expectedRealHome] = await Promise.all([fs.realpath(codexHome).catch(() => void 0), fs.realpath(expectedHome).catch(() => void 0)]);
236
+ if (!actualRealHome || actualRealHome !== expectedRealHome) return;
237
+ return {
238
+ client: params.client,
239
+ agentDir: params.agentDir,
240
+ codexHome,
241
+ command,
242
+ desktopGeneration
243
+ };
244
+ }
245
+ async function resolveClientManagedBundledMarketplacePath(client, agentDir) {
246
+ const codexHome = client?.getRuntimeIdentity()?.codexHome;
247
+ if (!codexHome || !agentDir) return;
248
+ const [actualRealHome, expectedRealHome] = await Promise.all([fs.realpath(codexHome).catch(() => void 0), fs.realpath(resolveCodexAppServerHomeDir(agentDir)).catch(() => void 0)]);
249
+ if (!actualRealHome || actualRealHome !== expectedRealHome) return;
250
+ const managedPath = resolveCodexManagedBundledMarketplacePath(codexHome);
251
+ return existsSync(managedPath) ? managedPath : void 0;
252
+ }
257
253
  async function ensureComputerUsePlugin(params) {
258
254
  let plugin = await readComputerUsePlugin(params.request, params.marketplace, params.config.pluginName);
259
255
  if (!plugin.summary.installed || !plugin.summary.enabled) {
@@ -315,10 +311,10 @@ async function readComputerUseTools(params) {
315
311
  reason: "ready",
316
312
  message: "Computer Use is ready."
317
313
  });
314
+ params.releaseNativeConfigFence?.();
318
315
  const { liveTest, repair } = await runCodexComputerUseLiveTest({
319
316
  request: params.request,
320
- config: params.config,
321
- repairComputerUseMcpChildren: params.repairComputerUseMcpChildren
317
+ config: params.config
322
318
  });
323
319
  const compatibilityStartupAllowed = !liveTest.ok && !params.config.strictReadiness;
324
320
  return {
@@ -348,8 +344,6 @@ async function runCodexComputerUseLiveTest(params) {
348
344
  threadId = (await params.request("thread/start", {
349
345
  input: [],
350
346
  developerInstructions: COMPUTER_USE_LIVE_TEST_THREAD_NAME,
351
- sandbox: "danger-full-access",
352
- approvalPolicy: "never",
353
347
  ephemeral: true
354
348
  }, { timeoutMs: params.config.liveTestTimeoutMs })).thread.id;
355
349
  await params.request("mcpServer/tool/call", {
@@ -366,19 +360,19 @@ async function runCodexComputerUseLiveTest(params) {
366
360
  attempts: attempt + 1,
367
361
  timeoutMs: params.config.liveTestTimeoutMs,
368
362
  retried: attempt > 0,
369
- repaired: Boolean(repair?.attempted),
363
+ repaired: Boolean(repair?.attempted && repair.warnings.length === 0),
370
364
  durationMs: Math.max(0, Date.now() - startedAt),
371
365
  message: "Computer Use live test passed."
372
366
  },
373
367
  ...repair ? { repair } : {}
374
368
  };
375
369
  } catch (error) {
370
+ if (isCodexAppServerStartSelectionChangedError(error)) throw error;
376
371
  lastError = error;
377
- if (attempt >= COMPUTER_USE_LIVE_TEST_RETRY_COUNT) break;
378
- if (params.config.autoRepair) repair = params.repairComputerUseMcpChildren ? await params.repairComputerUseMcpChildren() : scopedRepairUnavailableStatus();
379
372
  } finally {
380
373
  if (threadId) await cleanupComputerUseProbeThread(params.request, threadId, params.config);
381
374
  }
375
+ if (attempt < COMPUTER_USE_LIVE_TEST_RETRY_COUNT && params.config.autoRepair) repair = await repairComputerUseMcpRuntime(params.request, params.config);
382
376
  }
383
377
  const errorMessage = describeControlFailure(lastError);
384
378
  return {
@@ -389,7 +383,7 @@ async function runCodexComputerUseLiveTest(params) {
389
383
  attempts: 2,
390
384
  timeoutMs: params.config.liveTestTimeoutMs,
391
385
  retried: true,
392
- repaired: Boolean(repair?.attempted),
386
+ repaired: Boolean(repair?.attempted && repair.warnings.length === 0),
393
387
  durationMs: Math.max(0, Date.now() - startedAt),
394
388
  message: `Computer Use live test failed after 2 attempts: ${errorMessage}`,
395
389
  error: errorMessage
@@ -397,6 +391,25 @@ async function runCodexComputerUseLiveTest(params) {
397
391
  ...repair ? { repair } : {}
398
392
  };
399
393
  }
394
+ async function repairComputerUseMcpRuntime(request, config) {
395
+ try {
396
+ await request("config/mcpServer/reload", void 0, { timeoutMs: config.liveTestTimeoutMs });
397
+ return {
398
+ attempted: true,
399
+ killedPids: [],
400
+ warnings: [],
401
+ message: "Reloaded Computer Use MCP servers through Codex app-server."
402
+ };
403
+ } catch (error) {
404
+ const message = `Could not reload Computer Use MCP servers: ${describeControlFailure(error)}`;
405
+ return {
406
+ attempted: true,
407
+ killedPids: [],
408
+ warnings: [message],
409
+ message
410
+ };
411
+ }
412
+ }
400
413
  async function cleanupComputerUseProbeThread(request, threadId, config) {
401
414
  await Promise.allSettled([request("thread/unsubscribe", { threadId }, { timeoutMs: config.liveTestTimeoutMs }), request("thread/archive", { threadId }, { timeoutMs: config.liveTestTimeoutMs })]);
402
415
  }
@@ -417,6 +430,12 @@ async function resolveMarketplaceRef(params) {
417
430
  let candidates = await listComputerUseMarketplaceCandidates(params.request, params.config);
418
431
  const bundledMarketplacePath = resolveBundledComputerUseMarketplacePath(params);
419
432
  if (candidates.length === 0 && bundledMarketplacePath && shouldAddBundledComputerUseMarketplace(params)) {
433
+ if (params.managedCodexHome) await migrateLegacyBundledMarketplaceSource({
434
+ request: params.request,
435
+ bundledMarketplacePath,
436
+ legacySources: params.defaultBundledMarketplacePathCandidates,
437
+ userConfigPath: path.join(params.managedCodexHome, "config.toml")
438
+ });
420
439
  const added = await params.request("marketplace/add", { source: bundledMarketplacePath });
421
440
  preferredMarketplaceName ??= added.marketplaceName;
422
441
  candidates = await listComputerUseMarketplaceCandidates(params.request, params.config);
@@ -441,6 +460,16 @@ async function resolveMarketplaceRef(params) {
441
460
  const marketplace = candidates[0];
442
461
  return marketplace ? { marketplace } : {};
443
462
  }
463
+ async function migrateLegacyBundledMarketplaceSource(params) {
464
+ const response = await params.request("config/read", { includeLayers: false });
465
+ const bundled = response.config.marketplaces?.[BUNDLED_MARKETPLACE_NAME];
466
+ const sourceOrigin = response.origins[`marketplaces.${BUNDLED_MARKETPLACE_NAME}.source`];
467
+ if (bundled?.source_type !== "local" || !bundled.source || sourceOrigin?.name.type !== "user" || sourceOrigin.name.profile !== null || path.resolve(sourceOrigin.name.file) !== path.resolve(params.userConfigPath)) return;
468
+ const configuredSource = path.resolve(bundled.source);
469
+ if (configuredSource === path.resolve(params.bundledMarketplacePath)) return;
470
+ if (!(params.legacySources ?? resolveMacOSDesktopCodexBundledMarketplaceCandidates()).some((source) => path.resolve(source) === configuredSource)) return;
471
+ await params.request("marketplace/remove", { marketplaceName: BUNDLED_MARKETPLACE_NAME });
472
+ }
444
473
  async function listComputerUseMarketplaceCandidates(request, config) {
445
474
  return findComputerUseMarketplaces(await request("plugin/list", { cwds: [] }), config.pluginName);
446
475
  }
@@ -453,6 +482,7 @@ function shouldAddBundledComputerUseMarketplace(params) {
453
482
  }
454
483
  function resolveBundledComputerUseMarketplacePath(params) {
455
484
  if (params.defaultBundledMarketplacePath) return existsSync(params.defaultBundledMarketplacePath) ? params.defaultBundledMarketplacePath : void 0;
485
+ if (!params.defaultBundledMarketplacePathCandidates) return;
456
486
  return resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath({ candidates: params.defaultBundledMarketplacePathCandidates });
457
487
  }
458
488
  function findComputerUseMarketplaces(listed, pluginName) {
@@ -790,4 +820,4 @@ function buildMetadataCacheEntryKey(appCacheKey, queryKind, requestParams, catal
790
820
  ]);
791
821
  }
792
822
  //#endregion
793
- export { runCodexComputerUseLiveTest as a, readCodexComputerUseStatus as i, ensureCodexComputerUse as n, killStaleComputerUseMcpChildren as o, installCodexComputerUse as r, defaultCodexPluginMetadataCache as t };
823
+ export { runCodexComputerUseLiveTest as a, readCodexComputerUseStatus as i, ensureCodexComputerUse as n, installCodexComputerUse as r, defaultCodexPluginMetadataCache as t };
@@ -89,6 +89,10 @@ var definitions = {
89
89
  "required": ["id"],
90
90
  "type": "object"
91
91
  },
92
+ "AgentMessageDelivery": {
93
+ "enum": ["async"],
94
+ "type": "string"
95
+ },
92
96
  "AgentPath": { "type": "string" },
93
97
  "ApprovalsReviewer": {
94
98
  "description": "Configures who approval requests are routed to for review. Examples include sandbox escapes, blocked network access, MCP approval prompts, and ARC escalations. Defaults to `user`. `auto_review` uses a carefully prompted subagent to gather relevant context and apply a risk-based decision framework before approving or denying the request. The legacy value `guardian_subagent` is accepted for compatibility.",
@@ -230,6 +234,7 @@ var definitions = {
230
234
  "usageLimitExceeded",
231
235
  "serverOverloaded",
232
236
  "cyberPolicy",
237
+ "misalignmentPolicyViolation",
233
238
  "internalServerError",
234
239
  "unauthorized",
235
240
  "badRequest",
@@ -267,7 +272,11 @@ var definitions = {
267
272
  "sendInput",
268
273
  "resumeAgent",
269
274
  "wait",
270
- "closeAgent"
275
+ "closeAgent",
276
+ "sendMessage",
277
+ "followupTask",
278
+ "interruptAgent",
279
+ "listAgents"
271
280
  ],
272
281
  "type": "string"
273
282
  },
@@ -275,7 +284,8 @@ var definitions = {
275
284
  "enum": [
276
285
  "inProgress",
277
286
  "completed",
278
- "failed"
287
+ "failed",
288
+ "interrupted"
279
289
  ],
280
290
  "type": "string"
281
291
  },
@@ -448,6 +458,23 @@ var definitions = {
448
458
  ],
449
459
  "type": "string"
450
460
  },
461
+ "ImageGenerationFailure": { "oneOf": [{
462
+ "properties": {
463
+ "limitId": { "type": "string" },
464
+ "resetsAt": {
465
+ "format": "int64",
466
+ "type": ["integer", "null"]
467
+ },
468
+ "type": {
469
+ "enum": ["usageLimitExceeded"],
470
+ "title": "UsageLimitExceededImageGenerationFailureType",
471
+ "type": "string"
472
+ }
473
+ },
474
+ "required": ["limitId", "type"],
475
+ "title": "UsageLimitExceededImageGenerationFailure",
476
+ "type": "object"
477
+ }] },
451
478
  "InputModality": {
452
479
  "description": "Canonical user-input modality tags advertised by a model.",
453
480
  "oneOf": [
@@ -584,6 +611,10 @@ var definitions = {
584
611
  "default": null,
585
612
  "type": ["string", "null"]
586
613
  },
614
+ "multiAgentVersion": {
615
+ "anyOf": [{ "$ref": "#/definitions/MultiAgentVersion" }, { "type": "null" }],
616
+ "description": "Multi-agent runtime declared by this model, when available."
617
+ },
587
618
  "serviceTiers": {
588
619
  "default": [],
589
620
  "items": { "$ref": "#/definitions/ModelServiceTier" },
@@ -635,6 +666,11 @@ var definitions = {
635
666
  "migrationMarkdown": { "type": ["string", "null"] },
636
667
  "model": { "type": "string" },
637
668
  "modelLink": { "type": ["string", "null"] },
669
+ "retirementAt": {
670
+ "description": "Informational Unix timestamp for this upgrade's scheduled retirement, if known.",
671
+ "format": "int64",
672
+ "type": ["integer", "null"]
673
+ },
638
674
  "upgradeCopy": { "type": ["string", "null"] }
639
675
  },
640
676
  "required": ["model"],
@@ -653,6 +689,15 @@ var definitions = {
653
689
  "type": "string"
654
690
  }]
655
691
  },
692
+ "MultiAgentVersion": {
693
+ "description": "Multi-agent runtime supported by a model.",
694
+ "enum": [
695
+ "disabled",
696
+ "v1",
697
+ "v2"
698
+ ],
699
+ "type": "string"
700
+ },
656
701
  "NetworkAccess": {
657
702
  "enum": ["restricted", "enabled"],
658
703
  "type": "string"
@@ -721,6 +766,8 @@ var definitions = {
721
766
  "enterprise_cbp_usage_based",
722
767
  "enterprise",
723
768
  "edu",
769
+ "edu_plus",
770
+ "edu_pro",
724
771
  "unknown"
725
772
  ],
726
773
  "type": "string"
@@ -841,7 +888,8 @@ var definitions = {
841
888
  "enum": [
842
889
  "started",
843
890
  "interacted",
844
- "interrupted"
891
+ "interrupted",
892
+ "completed"
845
893
  ],
846
894
  "type": "string"
847
895
  },
@@ -977,6 +1025,10 @@ var definitions = {
977
1025
  "description": "Usually the first user message in the thread, if available.",
978
1026
  "type": "string"
979
1027
  },
1028
+ "projectId": {
1029
+ "description": "Canonical project assignment owned by app-server, if any.",
1030
+ "type": ["string", "null"]
1031
+ },
980
1032
  "recencyAt": {
981
1033
  "description": "Unix timestamp (in seconds) used for thread recency ordering.",
982
1034
  "format": "int64",
@@ -1028,6 +1080,7 @@ var definitions = {
1028
1080
  "id",
1029
1081
  "modelProvider",
1030
1082
  "preview",
1083
+ "projectId",
1031
1084
  "sessionId",
1032
1085
  "source",
1033
1086
  "status",
@@ -1095,6 +1148,10 @@ var definitions = {
1095
1148
  },
1096
1149
  {
1097
1150
  "properties": {
1151
+ "delivery": {
1152
+ "anyOf": [{ "$ref": "#/definitions/AgentMessageDelivery" }, { "type": "null" }],
1153
+ "default": null
1154
+ },
1098
1155
  "id": { "type": "string" },
1099
1156
  "memoryCitation": {
1100
1157
  "anyOf": [{ "$ref": "#/definitions/MemoryCitation" }, { "type": "null" }],
@@ -1469,6 +1526,10 @@ var definitions = {
1469
1526
  },
1470
1527
  {
1471
1528
  "properties": {
1529
+ "failure": {
1530
+ "anyOf": [{ "$ref": "#/definitions/ImageGenerationFailure" }, { "type": "null" }],
1531
+ "default": null
1532
+ },
1472
1533
  "id": { "type": "string" },
1473
1534
  "result": { "type": "string" },
1474
1535
  "revisedPrompt": { "type": ["string", "null"] },
@@ -1546,6 +1607,11 @@ var definitions = {
1546
1607
  "ThreadSection": {
1547
1608
  "description": "An independently persisted, user-visible thread section.",
1548
1609
  "properties": {
1610
+ "appearance": {
1611
+ "anyOf": [{ "$ref": "#/definitions/ThreadSectionAppearance" }, { "type": "null" }],
1612
+ "default": null,
1613
+ "description": "Optional appearance synchronized across clients."
1614
+ },
1549
1615
  "id": {
1550
1616
  "description": "Opaque UUIDv7 identity that remains stable when the section is renamed.",
1551
1617
  "type": "string"
@@ -1558,6 +1624,14 @@ var definitions = {
1558
1624
  "required": ["id", "name"],
1559
1625
  "type": "object"
1560
1626
  },
1627
+ "ThreadSectionAppearance": {
1628
+ "description": "Extensible visual presentation for a custom thread section.",
1629
+ "properties": {
1630
+ "color": { "type": ["string", "null"] },
1631
+ "icon": { "type": ["string", "null"] }
1632
+ },
1633
+ "type": "object"
1634
+ },
1561
1635
  "ThreadSource": { "type": "string" },
1562
1636
  "ThreadStatus": { "oneOf": [
1563
1637
  {
@@ -1941,7 +2015,7 @@ var ThreadResumeResponse_default = {
1941
2015
  },
1942
2016
  "itemsBackwardsCursor": {
1943
2017
  "default": null,
1944
- "description": "Opaque head cursor for hydrating paginated items backwards.\n\nPass this as `cursor` to `thread/items/list` with `sortDirection: \"desc\"`. The first page includes the cursor's head item.",
2018
+ "description": "Opaque cursor for hydrating paginated items backwards.\n\nPass this as `cursor` to `thread/items/list` with `sortDirection: \"desc\"`. The first page includes the item identified by the cursor.",
1945
2019
  "type": ["string", "null"]
1946
2020
  },
1947
2021
  "model": { "type": "string" },
@@ -1966,7 +2040,7 @@ var ThreadResumeResponse_default = {
1966
2040
  "thread": { "$ref": "./CodexAppServerProtocolDefinitions.json#/definitions/Thread" },
1967
2041
  "turnsBackwardsCursor": {
1968
2042
  "default": null,
1969
- "description": "Opaque head cursor for hydrating paginated turns backwards.\n\nPass this as `cursor` to `thread/turns/list` with `sortDirection: \"desc\"`. The first page includes the cursor's head turn.",
2043
+ "description": "Opaque cursor for hydrating paginated turns backwards.\n\nPass this as `cursor` to `thread/turns/list` with `sortDirection: \"desc\"`. The first page includes the turn identified by the cursor.",
1970
2044
  "type": ["string", "null"]
1971
2045
  }
1972
2046
  },
@@ -2296,6 +2370,7 @@ function normalizeThreadItem(value) {
2296
2370
  switch (value.type) {
2297
2371
  case "agentMessage": return {
2298
2372
  phase: null,
2373
+ delivery: null,
2299
2374
  memoryCitation: null,
2300
2375
  ...value
2301
2376
  };
@@ -1,4 +1,4 @@
1
- import { ct as isJsonObject } from "./shared-client-kIBbGjk4.js";
1
+ import { vt as isJsonObject } from "./shared-client-DKz23hHY.js";
2
2
  import { asBoolean, asFiniteNumber, normalizeOptionalString, parseStrictFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { MAX_DATE_TIMESTAMP_MS, resolveExpiresAtMsFromEpochSeconds } from "openclaw/plugin-sdk/number-runtime";
4
4
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
@@ -1,5 +1,5 @@
1
- import { _ as withTimeout, a as getLeasedSharedCodexAppServerClient, i as createIsolatedCodexAppServerClient, l as releaseLeasedSharedCodexAppServerClient, p as retireSharedCodexAppServerClientIfCurrent, s as isCodexAppServerStartSelectionChangedError } from "./shared-client-kIBbGjk4.js";
2
- import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-Cmwc9eIk.js";
1
+ import { _ as retireSharedCodexAppServerClientIfCurrent, a as createIsolatedCodexAppServerClient, c as isCodexAppServerStartSelectionChangedError, o as getLeasedSharedCodexAppServerClient, p as releaseLeasedSharedCodexAppServerClient, rt as withTimeout } from "./shared-client-DKz23hHY.js";
2
+ import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-kuWTn9C5.js";
3
3
  //#region extensions/codex/src/app-server/request.ts
4
4
  /** Sends one guarded request over a client lease owned by the caller. */
5
5
  async function requestCodexAppServerClientJson(params) {