@openclaw/codex 2026.7.2-beta.5 → 2026.7.2-beta.7

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 (42) hide show
  1. package/dist/{app-server-policy-BmDgseo_.js → app-server-policy-BSaO2JIT.js} +1 -1
  2. package/dist/{attempt-notifications-CMR2_fmR.js → attempt-notifications-AP-a-Q5k.js} +1 -1
  3. package/dist/{bounded-turn-FEbUXoYT.js → bounded-turn-D2ZAgZVz.js} +29 -22
  4. package/dist/{capabilities-BHRSI6Cn.js → capabilities-BFDTVYr4.js} +1 -1
  5. package/dist/cli-metadata.js +1 -1
  6. package/dist/{command-formatters-ico4ZFnk.js → command-formatters-C336eRVS.js} +2 -2
  7. package/dist/{command-handlers-CRmnwI2N.js → command-handlers-DAHUSry9.js} +12 -12
  8. package/dist/{compact-dEN49UH6.js → compact-D_uvHurS.js} +5 -5
  9. package/dist/{computer-use-BjGylO-E.js → computer-use-CYEc8U3w.js} +111 -113
  10. package/dist/{conversation-control-DE7d9DOj.js → conversation-control-xsIeXbo4.js} +6 -6
  11. package/dist/doctor-contract-api.js +1 -1
  12. package/dist/{dynamic-tools-LIt9ojep.js → dynamic-tools-D2gYkSBO.js} +438 -51
  13. package/dist/effective-mcp-catalog-Bbd98Inw.js +114 -0
  14. package/dist/{event-projector-usage-tvgb1NCX.js → event-projector-usage-Xp4AlR2k.js} +20 -3
  15. package/dist/harness.js +13 -9
  16. package/dist/index.js +131 -108
  17. package/dist/media-understanding-provider.js +1 -1
  18. package/dist/{models-BA01NEez.js → models-BBMKU4jA.js} +2 -2
  19. package/dist/{notification-correlation-Bj_Ak_jI.js → notification-correlation-CU6_AnOb.js} +3 -3
  20. package/dist/{plugin-app-cache-key-DSXX-rXO.js → plugin-app-cache-key-DztPafOA.js} +132 -39
  21. package/dist/{rate-limits-S_PXs0ul.js → rate-limits-CU-gVCCS.js} +1 -1
  22. package/dist/{request-CXpPennK.js → request-qKh331yu.js} +3 -3
  23. package/dist/{run-attempt-C5GTPJOE.js → run-attempt-CY9WlDLc.js} +677 -199
  24. package/dist/{runtime-artifact-C2ITXdhM.js → runtime-artifact-CmtG_t1L.js} +90 -24
  25. package/dist/{sandbox-guard-D1Wky__S.js → sandbox-guard-NuhpXmPB.js} +4 -0
  26. package/dist/{session-binding-DlVQ-Pxs.js → session-binding-BXpo9ymA.js} +60 -7
  27. package/dist/{session-catalog-CP2oCcEb.js → session-catalog-DyOgR4WH.js} +268 -44
  28. package/dist/{session-cli-CqZ0Fp2a.js → session-cli-2PZaFLRh.js} +1 -1
  29. package/dist/{session-upstream-marker-QE-m5QFG.js → session-upstream-marker-B6U7tLw5.js} +1 -1
  30. package/dist/{settled-turn-finalizer-CA_2QXIE.js → settled-turn-finalizer-CXY2Z9dT.js} +19 -6
  31. package/dist/{shared-client-BVKE40c-.js → shared-client-DTbvH-XV.js} +166 -49
  32. package/dist/{side-question-CO12sHxo.js → side-question-_ulBk1AL.js} +10 -10
  33. package/dist/{thread-lifecycle-DRg_FdzC.js → thread-lifecycle-DF53ogiA.js} +968 -214
  34. package/dist/{protocol-validators-Dm4eXZmt.js → transcript-mirror-DzsdNCf5.js} +589 -2
  35. package/dist/{upstream-session-fork-_Vrz4WJr.js → upstream-session-fork-Dy4Xvuoj.js} +3 -3
  36. package/dist/{usage-UpVbdX5G.js → usage-CQ6GhD5-.js} +3 -3
  37. package/dist/{web-search-provider.runtime-CaQMYDbp.js → web-search-provider.runtime-CCFhg2z5.js} +3 -3
  38. package/package.json +6 -7
  39. package/dist/attempt-client-cleanup-Ia52yRWc.js +0 -127
  40. package/dist/realtime-voice-api-BPcA1uN9.js +0 -494
  41. package/dist/realtime-voice-api.js +0 -2
  42. package/dist/transcript-mirror-uKA-A4tB.js +0 -550
@@ -1,4 +1,4 @@
1
- import { b as canUseCodexModelBackedApprovalsReviewerForModel } from "./session-binding-DlVQ-Pxs.js";
1
+ import { C as canUseCodexModelBackedApprovalsReviewerForModel } from "./session-binding-BXpo9ymA.js";
2
2
  //#region extensions/codex/src/app-server/app-server-policy.ts
3
3
  /**
4
4
  * Policy promotion for Codex app-server runs that can safely use OpenClaw tool
@@ -1,4 +1,4 @@
1
- import { V as isJsonObject } from "./shared-client-BVKE40c-.js";
1
+ import { W as isJsonObject } from "./shared-client-DTbvH-XV.js";
2
2
  import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
3
3
  //#region extensions/codex/src/app-server/attempt-notifications.ts
4
4
  /**
@@ -1,11 +1,10 @@
1
- import { V as isJsonObject, s as isCodexAppServerStartSelectionChangedError } from "./shared-client-BVKE40c-.js";
2
- import { p as resolveCodexAppServerRuntimeOptions } from "./session-binding-DlVQ-Pxs.js";
3
- import { o as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./attempt-client-cleanup-Ia52yRWc.js";
4
- import { _ as readCodexNotificationItem, h as isRetryableErrorNotification } from "./attempt-notifications-CMR2_fmR.js";
5
- import { G as mergeCodexThreadConfigs, d as buildCodexRingZeroThreadConfigPatch, f as buildCodexRuntimeThreadConfig, l as assertCodexRingZeroHasNoManagedHooks, p as readCodexInheritedMcpServerNames, u as attestCodexRingZeroThreadHasNoMcpServers } from "./thread-lifecycle-DRg_FdzC.js";
6
- import { t as normalizeCodexResponseTokenUsage } from "./event-projector-usage-tvgb1NCX.js";
7
- import { a as assertCodexTurnStartResponse, i as assertCodexThreadStartResponse, s as readCodexErrorNotification, u as readCodexTurnCompletedNotification } from "./protocol-validators-Dm4eXZmt.js";
8
- import { r as readModelListResult } from "./models-BA01NEez.js";
1
+ import { W as isJsonObject, s as isCodexAppServerStartSelectionChangedError } from "./shared-client-DTbvH-XV.js";
2
+ import { g as resolveCodexAppServerRuntimeOptions } from "./session-binding-BXpo9ymA.js";
3
+ import { G as mergeCodexThreadConfigs, d as attestCodexRingZeroThreadHasNoMcpServers, f as buildCodexRingZeroThreadConfigPatch, m as readCodexInheritedMcpServerNames, mt as interruptCodexTurnAndWaitBestEffort, p as buildCodexRuntimeThreadConfig, u as assertCodexRingZeroHasNoManagedHooks, ut as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./thread-lifecycle-DF53ogiA.js";
4
+ import { _ as readCodexNotificationItem, h as isRetryableErrorNotification } from "./attempt-notifications-AP-a-Q5k.js";
5
+ import { n as normalizeCodexResponseTokenUsage } from "./event-projector-usage-Xp4AlR2k.js";
6
+ import { C as readCodexTurnCompletedNotification, _ as assertCodexThreadStartResponse, b as readCodexErrorNotification, v as assertCodexTurnStartResponse } from "./transcript-mirror-DzsdNCf5.js";
7
+ import { r as readModelListResult } from "./models-BBMKU4jA.js";
9
8
  import fs from "node:fs/promises";
10
9
  import path from "node:path";
11
10
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
@@ -33,6 +32,13 @@ const CODEX_SETTLED_FINALIZER_THREAD_CONFIG = {
33
32
  "skills.include_instructions": false,
34
33
  include_environment_context: false
35
34
  };
35
+ var CodexBoundedTurnTimeoutError = class extends Error {
36
+ constructor(taskLabel, timeoutMs) {
37
+ const bound = timeoutMs % 1e3 === 0 ? `${timeoutMs / 1e3}s` : `${timeoutMs}ms`;
38
+ super(`codex app-server ${taskLabel} turn timed out after ${bound}`);
39
+ this.name = "TimeoutError";
40
+ }
41
+ };
36
42
  async function runBoundedCodexAppServerTurn(params) {
37
43
  const appServer = resolveCodexAppServerRuntimeOptions({
38
44
  pluginConfig: params.options.pluginConfig,
@@ -55,9 +61,10 @@ async function runBoundedCodexAppServerTurn(params) {
55
61
  }
56
62
  async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, workspace, selectionAttempt = 0, timing) {
57
63
  const totalTimeoutMs = timing?.timeoutMs ?? resolveTimerTimeoutMs(params.timeoutMs, 100, 100);
64
+ const timeoutError = new CodexBoundedTurnTimeoutError(params.taskLabel, totalTimeoutMs);
58
65
  const deadline = timing?.deadline ?? Date.now() + totalTimeoutMs;
59
66
  const timeoutMs = deadline - Date.now();
60
- if (timeoutMs <= 0) throw new Error(`${params.taskLabel} timed out`);
67
+ if (timeoutMs <= 0) throw timeoutError;
61
68
  const agentDir = params.agentDir?.trim() || void 0;
62
69
  const startOptions = workspace.codexHome ? buildPrivateCodexAppServerStartOptions(appServer.start, workspace.codexHome) : appServer.start;
63
70
  const ownsClient = !params.options.clientFactory;
@@ -68,7 +75,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
68
75
  config: params.config,
69
76
  timeoutMs,
70
77
  ...params.signal ? { abandonSignal: params.signal } : {}
71
- }) : await import("./shared-client-BVKE40c-.js").then((n) => n.p).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
78
+ }) : await import("./shared-client-DTbvH-XV.js").then((n) => n.m).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
72
79
  startOptions,
73
80
  timeoutMs,
74
81
  authProfileId: params.profile,
@@ -97,8 +104,8 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
97
104
  if (params.signal?.aborted) abortFromCaller();
98
105
  else params.signal?.addEventListener("abort", abortFromCaller, { once: true });
99
106
  const remainingRunMs = deadline - Date.now();
100
- if (remainingRunMs <= 0) abortRun("timeout");
101
- const timeout = setTimeout(() => abortRun("timeout"), Math.max(1, remainingRunMs));
107
+ if (remainingRunMs <= 0) abortRun(timeoutError);
108
+ const timeout = setTimeout(() => abortRun(timeoutError), Math.max(1, remainingRunMs));
102
109
  timeout.unref?.();
103
110
  let retrySelection = false;
104
111
  try {
@@ -158,8 +165,8 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
158
165
  if (abortController.signal.aborted) requestInterrupt();
159
166
  return {
160
167
  ...await collector.collect(turn.turn, {
161
- timeoutMs,
162
- signal: abortController.signal
168
+ signal: abortController.signal,
169
+ timeoutError
163
170
  }),
164
171
  model
165
172
  };
@@ -168,6 +175,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
168
175
  cleanup();
169
176
  }
170
177
  } catch (error) {
178
+ if (abortController.signal.aborted) throw resolveCodexBoundedTurnAbortError(abortController.signal, params.taskLabel, timeoutError);
171
179
  if (ownsClient && isCodexAppServerStartSelectionChangedError(error) && selectionAttempt === 0) retrySelection = true;
172
180
  else throw error;
173
181
  } finally {
@@ -307,9 +315,9 @@ function createCodexBoundedTurnCollector(threadId, taskLabel) {
307
315
  for (const notification of pending.splice(0)) handleNotification(notification);
308
316
  if (!completedTurn && !promptError) await waitForTurnCompletion({
309
317
  completion,
310
- timeoutMs: options.timeoutMs,
311
318
  signal: options.signal,
312
- taskLabel
319
+ taskLabel,
320
+ timeoutError: options.timeoutError
313
321
  });
314
322
  if (promptError) throw new Error(promptError);
315
323
  if (completedTurn?.status === "failed") throw new Error(completedTurn.error?.message ?? `codex app-server ${taskLabel} turn failed`);
@@ -333,22 +341,21 @@ function collectCompletedItems(turnItems, notificationItems) {
333
341
  return [...items.values()];
334
342
  }
335
343
  async function waitForTurnCompletion(params) {
336
- if (params.signal.aborted) throw new Error(`codex app-server ${params.taskLabel} turn aborted`);
337
- let timeout;
344
+ if (params.signal.aborted) throw resolveCodexBoundedTurnAbortError(params.signal, params.taskLabel, params.timeoutError);
338
345
  let cleanupAbort;
339
346
  try {
340
347
  await Promise.race([params.completion, new Promise((_, reject) => {
341
- timeout = setTimeout(() => reject(/* @__PURE__ */ new Error(`codex app-server ${params.taskLabel} turn timed out`)), params.timeoutMs);
342
- timeout.unref?.();
343
- const abortListener = () => reject(/* @__PURE__ */ new Error(`codex app-server ${params.taskLabel} turn aborted`));
348
+ const abortListener = () => reject(resolveCodexBoundedTurnAbortError(params.signal, params.taskLabel, params.timeoutError));
344
349
  params.signal.addEventListener("abort", abortListener, { once: true });
345
350
  cleanupAbort = () => params.signal.removeEventListener("abort", abortListener);
346
351
  })]);
347
352
  } finally {
348
- if (timeout) clearTimeout(timeout);
349
353
  cleanupAbort?.();
350
354
  }
351
355
  }
356
+ function resolveCodexBoundedTurnAbortError(signal, taskLabel, timeoutError) {
357
+ return signal.reason === timeoutError ? timeoutError : /* @__PURE__ */ new Error(`codex app-server ${taskLabel} turn aborted`);
358
+ }
352
359
  function collectAssistantTextFromItems(items) {
353
360
  return (items ?? []).filter((item) => item.type === "agentMessage").map((item) => item.text.trim()).filter(Boolean).join("\n\n").trim();
354
361
  }
@@ -1,4 +1,4 @@
1
- import { _ as CodexAppServerRpcError } from "./shared-client-BVKE40c-.js";
1
+ import { v as CodexAppServerRpcError } from "./shared-client-DTbvH-XV.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-CqZ0Fp2a.js");
5
+ const { registerCodexSessionCli } = await import("./session-cli-2PZaFLRh.js");
6
6
  registerCodexSessionCli(program);
7
7
  }, { descriptors: [{
8
8
  name: "codex",
@@ -1,5 +1,5 @@
1
- import { V as isJsonObject } from "./shared-client-BVKE40c-.js";
2
- import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-S_PXs0ul.js";
1
+ import { W as isJsonObject } from "./shared-client-DTbvH-XV.js";
2
+ import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-CU-gVCCS.js";
3
3
  //#region extensions/codex/src/command-formatters.ts
4
4
  /** Formats the combined `/codex status` probe result. */
5
5
  function formatCodexStatus(probes) {
@@ -1,16 +1,16 @@
1
- import { N as resolveCodexAppServerAuthProfileIdForAgent, V as isJsonObject } from "./shared-client-BVKE40c-.js";
2
- import { O as isCodexFastServiceTier, c as reclaimCurrentCodexSessionGeneration, i as createCodexSessionGenerationSupersededError, l as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-DlVQ-Pxs.js";
3
- import { r as assertCodexThreadResumeResponse } from "./protocol-validators-Dm4eXZmt.js";
4
- import { t as listAllCodexAppServerModels } from "./models-BA01NEez.js";
5
- import { t as CODEX_CONTROL_METHODS } from "./capabilities-BHRSI6Cn.js";
6
- import { s as summarizeCodexAccountUsage } from "./rate-limits-S_PXs0ul.js";
7
- import { a as formatComputerUseStatus, c as formatSkills, i as formatCodexStatus, l as formatThreads, n as formatAccount, o as formatList, r as formatCodexDisplayText, s as formatModels, t as buildHelp, u as readString$1 } from "./command-formatters-ico4ZFnk.js";
8
- import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-D1Wky__S.js";
9
- import { a as setCodexConversationFastMode, c as steerCodexConversationTurn, d as CODEX_NATIVE_EXECUTION_AUTH_ERROR, f as canMutateCodexHost, i as readCodexConversationActiveTurn, l as stopCodexConversationTurn, n as parseCodexFastModeArg, o as setCodexConversationModel, r as parseCodexPermissionsModeArg, s as setCodexConversationPermissions, t as formatPermissionsMode } from "./conversation-control-DE7d9DOj.js";
1
+ import { I as resolveCodexAppServerAuthProfileIdForAgent, W as isJsonObject } from "./shared-client-DTbvH-XV.js";
2
+ import { c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, i as createCodexSessionGenerationSupersededError, j as isCodexFastServiceTier, n as assertCodexBindingMayBeReplaced, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-BXpo9ymA.js";
3
+ import { g as assertCodexThreadResumeResponse } from "./transcript-mirror-DzsdNCf5.js";
4
+ import { t as listAllCodexAppServerModels } from "./models-BBMKU4jA.js";
5
+ import { t as CODEX_CONTROL_METHODS } from "./capabilities-BFDTVYr4.js";
6
+ import { s as summarizeCodexAccountUsage } from "./rate-limits-CU-gVCCS.js";
7
+ import { a as formatComputerUseStatus, c as formatSkills, i as formatCodexStatus, l as formatThreads, n as formatAccount, o as formatList, r as formatCodexDisplayText, s as formatModels, t as buildHelp, u as readString$1 } from "./command-formatters-C336eRVS.js";
8
+ import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-NuhpXmPB.js";
9
+ import { a as setCodexConversationFastMode, c as steerCodexConversationTurn, d as CODEX_NATIVE_EXECUTION_AUTH_ERROR, f as canMutateCodexHost, i as readCodexConversationActiveTurn, l as stopCodexConversationTurn, n as parseCodexFastModeArg, o as setCodexConversationModel, r as parseCodexPermissionsModeArg, s as setCodexConversationPermissions, t as formatPermissionsMode } from "./conversation-control-xsIeXbo4.js";
10
10
  import { i as readCodexConversationBindingData, n as createCodexCliNodeConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-BHRpYbX3.js";
11
- import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-Bj_Ak_jI.js";
12
- import { c as requestOptions, l as safeCodexControlRequest, o as codexControlRequest, p as formatCodexCliSessions, s as readCodexStatusProbes } from "./session-catalog-CP2oCcEb.js";
13
- import { i as readCodexComputerUseStatus, n as installCodexComputerUse } from "./computer-use-BjGylO-E.js";
11
+ import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-CU6_AnOb.js";
12
+ import { c as requestOptions, l as safeCodexControlRequest, o as codexControlRequest, p as formatCodexCliSessions, s as readCodexStatusProbes } from "./session-catalog-DyOgR4WH.js";
13
+ import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-CYEc8U3w.js";
14
14
  import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
15
15
  import crypto from "node:crypto";
16
16
  import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAgentDir, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveProfileUnusableUntilForDisplay, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
@@ -1,8 +1,8 @@
1
- import { V as isJsonObject, _ as CodexAppServerRpcError, a as getLeasedSharedCodexAppServerClient, l as releaseLeasedSharedCodexAppServerClient } from "./shared-client-BVKE40c-.js";
2
- import { l as sessionBindingIdentity, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-DlVQ-Pxs.js";
3
- import { _ as readCodexNotificationItem } from "./attempt-notifications-CMR2_fmR.js";
4
- import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-D1Wky__S.js";
5
- import { a as resolveCodexBindingAppServerConnection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-Bj_Ak_jI.js";
1
+ import { W as isJsonObject, a as getLeasedSharedCodexAppServerClient, l as releaseLeasedSharedCodexAppServerClient, v as CodexAppServerRpcError } from "./shared-client-DTbvH-XV.js";
2
+ import { d as sessionBindingIdentity, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-BXpo9ymA.js";
3
+ import { _ as readCodexNotificationItem } from "./attempt-notifications-AP-a-Q5k.js";
4
+ import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-NuhpXmPB.js";
5
+ import { a as resolveCodexBindingAppServerConnection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-CU6_AnOb.js";
6
6
  import { embeddedAgentLog, resolveCompactionTimeoutMs } from "openclaw/plugin-sdk/agent-harness-runtime";
7
7
  import { resolveAgentDir as resolveAgentDir$1, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
8
8
  //#region extensions/codex/src/app-server/compact.ts
@@ -1,9 +1,91 @@
1
- import { C as isCodexAppServerIndeterminateTransportError, H as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, S as isCodexAppServerIndeterminateRequestCancellationError, a as getLeasedSharedCodexAppServerClient, g as acquireCodexNativeConfigFence, l as releaseLeasedSharedCodexAppServerClient, u as resolveCodexNativeConfigFenceKey, x as isCodexAppServerConnectionClosedError } from "./shared-client-BVKE40c-.js";
2
- import { h as resolveCodexComputerUseConfig, p as resolveCodexAppServerRuntimeOptions } from "./session-binding-DlVQ-Pxs.js";
3
- import { n as describeControlFailure } from "./capabilities-BHRSI6Cn.js";
4
- import { r as requestCodexAppServerJson } from "./request-CXpPennK.js";
1
+ import { C as isCodexAppServerIndeterminateRequestCancellationError, G as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, S as isCodexAppServerConnectionClosedError, _ as acquireCodexNativeConfigFence, a as getLeasedSharedCodexAppServerClient, l as releaseLeasedSharedCodexAppServerClient, u as resolveCodexNativeConfigFenceKey, w as isCodexAppServerIndeterminateTransportError } from "./shared-client-DTbvH-XV.js";
2
+ import { g as resolveCodexAppServerRuntimeOptions, v as resolveCodexComputerUseConfig } from "./session-binding-BXpo9ymA.js";
3
+ import { n as describeControlFailure } from "./capabilities-BFDTVYr4.js";
4
+ import { r as requestCodexAppServerJson } from "./request-qKh331yu.js";
5
5
  import { existsSync } from "node:fs";
6
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
7
89
  //#region extensions/codex/src/app-server/computer-use.ts
8
90
  /**
9
91
  * Computer Use plugin/MCP readiness checks and optional install flow for Codex
@@ -20,6 +102,8 @@ const CURATED_MARKETPLACE_POLL_INTERVAL_MS = 2e3;
20
102
  const COMPUTER_USE_MARKETPLACE_NAME_PRIORITY = [
21
103
  "openai-bundled",
22
104
  "openai-curated",
105
+ "openai-api-curated",
106
+ "openai-curated-remote",
23
107
  "local"
24
108
  ];
25
109
  const COMPUTER_USE_LIVE_TEST_RETRY_COUNT = 1;
@@ -179,18 +263,8 @@ async function ensureComputerUsePlugin(params) {
179
263
  config: params.config,
180
264
  plugin,
181
265
  tools: [],
182
- reason: pluginSetupReason(plugin, params.marketplace),
183
- message: pluginSetupMessage(params.config, plugin, params.marketplace)
184
- })
185
- };
186
- if (params.marketplace.kind === "remote") return {
187
- ok: false,
188
- status: statusFromPlugin({
189
- config: params.config,
190
- plugin,
191
- tools: [],
192
- reason: "remote_install_unsupported",
193
- message: remoteInstallUnsupportedMessage(plugin, params.marketplace)
266
+ reason: pluginSetupReason(plugin),
267
+ message: pluginSetupMessage(params.config, plugin)
194
268
  })
195
269
  };
196
270
  await params.request("plugin/install", pluginRequestParams(params.marketplace, params.config.pluginName));
@@ -203,8 +277,8 @@ async function ensureComputerUsePlugin(params) {
203
277
  config: params.config,
204
278
  plugin,
205
279
  tools: [],
206
- reason: pluginSetupReason(plugin, params.marketplace),
207
- message: pluginSetupMessage(params.config, plugin, params.marketplace)
280
+ reason: pluginSetupReason(plugin),
281
+ message: pluginSetupMessage(params.config, plugin)
208
282
  })
209
283
  };
210
284
  return {
@@ -326,14 +400,6 @@ async function runCodexComputerUseLiveTest(params) {
326
400
  async function cleanupComputerUseProbeThread(request, threadId, config) {
327
401
  await Promise.allSettled([request("thread/unsubscribe", { threadId }, { timeoutMs: config.liveTestTimeoutMs }), request("thread/archive", { threadId }, { timeoutMs: config.liveTestTimeoutMs })]);
328
402
  }
329
- function scopedRepairUnavailableStatus() {
330
- return {
331
- attempted: false,
332
- killedPids: [],
333
- warnings: ["Computer Use auto-repair skipped because no scoped Codex app-server process was available."],
334
- message: "Computer Use stale child repair requires a scoped local app-server PID."
335
- };
336
- }
337
403
  async function resolveMarketplaceRef(params) {
338
404
  let preferredMarketplaceName = params.config.marketplaceName;
339
405
  if (params.config.marketplaceSource && params.allowAdd) {
@@ -390,17 +456,22 @@ function resolveBundledComputerUseMarketplacePath(params) {
390
456
  return resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath({ candidates: params.defaultBundledMarketplacePathCandidates });
391
457
  }
392
458
  function findComputerUseMarketplaces(listed, pluginName) {
393
- return listed.marketplaces.filter((marketplace) => marketplace.plugins.some((plugin) => plugin.name === pluginName || plugin.id === pluginName || plugin.id === `${pluginName}@${marketplace.name}`)).map((marketplace) => {
394
- if (marketplace.path) return {
459
+ return listed.marketplaces.flatMap((marketplace) => {
460
+ const plugin = marketplace.plugins.find((candidate) => candidate.name === pluginName || candidate.id === pluginName || candidate.id === `${pluginName}@${marketplace.name}`);
461
+ if (!plugin) return [];
462
+ if (marketplace.path) return [{
395
463
  kind: "local",
396
464
  name: marketplace.name,
397
465
  path: marketplace.path
398
- };
399
- return {
466
+ }];
467
+ const remotePluginId = plugin.remotePluginId?.trim();
468
+ if (!remotePluginId) return [];
469
+ return [{
400
470
  kind: "remote",
401
471
  name: marketplace.name,
402
- remoteMarketplaceName: marketplace.name
403
- };
472
+ remoteMarketplaceName: marketplace.name,
473
+ remotePluginId
474
+ }];
404
475
  });
405
476
  }
406
477
  function chooseKnownComputerUseMarketplace(candidates) {
@@ -452,25 +523,21 @@ async function reloadMcpServers(request) {
452
523
  await request("config/mcpServer/reload", void 0);
453
524
  }
454
525
  function pluginRequestParams(marketplace, pluginName) {
455
- return {
456
- ...marketplace.kind === "local" ? { marketplacePath: marketplace.path } : {},
457
- ...marketplace.kind === "remote" ? { remoteMarketplaceName: marketplace.remoteMarketplaceName } : {},
526
+ return marketplace.kind === "local" ? {
527
+ marketplacePath: marketplace.path,
458
528
  pluginName
529
+ } : {
530
+ remoteMarketplaceName: marketplace.remoteMarketplaceName,
531
+ pluginName: marketplace.remotePluginId
459
532
  };
460
533
  }
461
- function pluginSetupReason(plugin, marketplace) {
462
- if (marketplace.kind === "remote") return "remote_install_unsupported";
534
+ function pluginSetupReason(plugin) {
463
535
  return plugin.summary.installed ? "plugin_disabled" : "plugin_not_installed";
464
536
  }
465
- function pluginSetupMessage(config, plugin, marketplace) {
466
- if (marketplace.kind === "remote") return remoteInstallUnsupportedMessage(plugin, marketplace);
537
+ function pluginSetupMessage(config, plugin) {
467
538
  if (!plugin.summary.installed) return "Computer Use is available but not installed. Run /codex computer-use install or enable computerUse.autoInstall.";
468
539
  return `Computer Use is installed, but the ${config.pluginName} plugin is disabled. Run /codex computer-use install or enable computerUse.autoInstall to re-enable it.`;
469
540
  }
470
- function remoteInstallUnsupportedMessage(plugin, marketplace) {
471
- const marketplaceName = marketplace.name ?? plugin.marketplaceName;
472
- return `Computer Use is ${plugin.summary.installed ? "installed but disabled" : "available"} in remote Codex marketplace ${marketplaceName}, but Codex app-server does not support remote plugin install yet. Configure computerUse.marketplaceSource or computerUse.marketplacePath for a local marketplace, then run /codex computer-use install.`;
473
- }
474
541
  function statusFromPlugin(params) {
475
542
  return {
476
543
  enabled: true,
@@ -592,75 +659,6 @@ function pluginWarnings(plugin) {
592
659
  if (source && typeof source === "object" && "type" in source && source.type === "remote") warnings.push("Computer Use plugin is resolved from a remote marketplace; live local bundles are preferred.");
593
660
  return warnings;
594
661
  }
595
- async function killStaleComputerUseMcpChildren(options = {}) {
596
- if (process.platform !== "darwin") return {
597
- attempted: true,
598
- killedPids: [],
599
- warnings: [`Computer Use stale child repair is currently macOS-only, not ${process.platform}.`],
600
- message: "Computer Use stale child repair skipped on this platform."
601
- };
602
- if (!options.ancestorPid || !Number.isSafeInteger(options.ancestorPid) || options.ancestorPid <= 0) return scopedRepairUnavailableStatus();
603
- let stdout;
604
- try {
605
- stdout = (await runExec("/bin/ps", ["-axo", "pid=,ppid=,command="], {
606
- logOutput: false,
607
- maxBuffer: 5 * 1024 * 1024
608
- })).stdout;
609
- } catch (error) {
610
- return {
611
- attempted: true,
612
- killedPids: [],
613
- warnings: [`Could not list processes for Computer Use repair: ${describeControlFailure(error)}`],
614
- message: "Computer Use stale child repair could not inspect running processes."
615
- };
616
- }
617
- const killedPids = [];
618
- const warnings = [];
619
- const processInfos = parsePsOutput(stdout);
620
- for (const processInfo of processInfos) {
621
- if (!isStaleComputerUseMcpChild(processInfo.command)) continue;
622
- if (!isDescendantOfPid(processInfo.pid, options.ancestorPid, processInfos)) continue;
623
- try {
624
- process.kill(processInfo.pid, "SIGTERM");
625
- killedPids.push(processInfo.pid);
626
- } catch (error) {
627
- warnings.push(`Could not terminate stale Computer Use MCP child pid ${processInfo.pid}: ${describeControlFailure(error)}`);
628
- }
629
- }
630
- return {
631
- attempted: true,
632
- killedPids,
633
- warnings,
634
- 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.`
635
- };
636
- }
637
- function parsePsOutput(stdout) {
638
- return stdout.split(/\r?\n/u).flatMap((line) => {
639
- const match = /^\s*(\d+)\s+(\d+)\s+(.+)$/u.exec(line);
640
- if (!match) return [];
641
- return [{
642
- pid: Number(match[1]),
643
- ppid: Number(match[2]),
644
- command: match[3] ?? ""
645
- }];
646
- }).filter((processInfo) => Number.isSafeInteger(processInfo.pid) && processInfo.pid > 0 && Number.isSafeInteger(processInfo.ppid) && processInfo.ppid >= 0);
647
- }
648
- function isStaleComputerUseMcpChild(command) {
649
- return command.includes("SkyComputerUseClient") && /(?:^|\s)mcp(?:\s|$)/u.test(command);
650
- }
651
- function isDescendantOfPid(pid, ancestorPid, processInfos) {
652
- const parents = new Map(processInfos.map((processInfo) => [processInfo.pid, processInfo.ppid]));
653
- const seen = /* @__PURE__ */ new Set();
654
- let current = pid;
655
- while (!seen.has(current)) {
656
- seen.add(current);
657
- const parent = parents.get(current);
658
- if (!parent || parent <= 0) return false;
659
- if (parent === ancestorPid) return true;
660
- current = parent;
661
- }
662
- return false;
663
- }
664
662
  function createComputerUseRequest(params) {
665
663
  if (params.request) return params.request;
666
664
  if (params.client) return async (method, requestParams, options) => await params.client.request(method, requestParams, {
@@ -692,4 +690,4 @@ function resolveComputerUseConfig(params) {
692
690
  });
693
691
  }
694
692
  //#endregion
695
- export { runCodexComputerUseLiveTest as a, readCodexComputerUseStatus as i, installCodexComputerUse as n, killStaleComputerUseMcpChildren as r, ensureCodexComputerUse as t };
693
+ export { killStaleComputerUseMcpChildren as a, runCodexComputerUseLiveTest as i, installCodexComputerUse as n, readCodexComputerUseStatus as r, ensureCodexComputerUse as t };
@@ -1,9 +1,9 @@
1
- import { a as getLeasedSharedCodexAppServerClient, c as releaseCodexAppServerClientLease, l as releaseLeasedSharedCodexAppServerClient, m as withLeasedCodexAppServerClientStartSelectionRetry } from "./shared-client-BVKE40c-.js";
2
- import { O as isCodexFastServiceTier, S as resolveCodexModelBackedReviewerPolicyContext, o as isCodexAppServerNativeAuthProfile, p as resolveCodexAppServerRuntimeOptions, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-DlVQ-Pxs.js";
3
- import { x as resolveCodexBindingModelProviderFallback, y as resolveCodexAppServerRequestModelSelection } from "./thread-lifecycle-DRg_FdzC.js";
4
- import { t as CODEX_CONTROL_METHODS } from "./capabilities-BHRSI6Cn.js";
5
- import { r as formatCodexDisplayText } from "./command-formatters-ico4ZFnk.js";
6
- import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-Bj_Ak_jI.js";
1
+ import { a as getLeasedSharedCodexAppServerClient, c as releaseCodexAppServerClientLease, h as withLeasedCodexAppServerClientStartSelectionRetry, l as releaseLeasedSharedCodexAppServerClient } from "./shared-client-DTbvH-XV.js";
2
+ import { T as resolveCodexModelBackedReviewerPolicyContext, g as resolveCodexAppServerRuntimeOptions, j as isCodexFastServiceTier, o as isCodexAppServerNativeAuthProfile, r as bindingStoreKey, s as normalizeCodexAppServerBindingModelProvider } from "./session-binding-BXpo9ymA.js";
3
+ import { S as resolveCodexBindingModelProviderFallback, b as resolveCodexAppServerRequestModelSelection } from "./thread-lifecycle-DF53ogiA.js";
4
+ import { t as CODEX_CONTROL_METHODS } from "./capabilities-BFDTVYr4.js";
5
+ import { r as formatCodexDisplayText } from "./command-formatters-C336eRVS.js";
6
+ import { a as resolveCodexBindingAppServerConnection } from "./notification-correlation-CU6_AnOb.js";
7
7
  import { ModelSelectionLockedError } from "openclaw/plugin-sdk/model-session-runtime";
8
8
  //#region extensions/codex/src/command-authorization.ts
9
9
  const CODEX_NATIVE_EXECUTION_AUTH_ERROR = "Only an owner or operator.admin can control Codex native execution.";
@@ -276,7 +276,7 @@ async function migrateSource(source, candidates, params, store) {
276
276
  return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
277
277
  const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
278
278
  const raw = JSON.parse(contents);
279
- const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-DlVQ-Pxs.js").then((n) => n.u), import("./conversation-binding-data-BHRpYbX3.js").then((n) => n.t)]);
279
+ const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-BXpo9ymA.js").then((n) => n.f), import("./conversation-binding-data-BHRpYbX3.js").then((n) => n.t)]);
280
280
  const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
281
281
  const baseStored = createStoredCodexAppServerBinding(raw, {
282
282
  now: stat.mtime.toISOString(),