@openclaw/codex 2026.6.11 → 2026.7.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/{app-server-policy-BPTiVNsW.js → app-server-policy-B7hqD3Xj.js} +2 -2
  2. package/dist/{attempt-notifications-BYnndyFl.js → attempt-notifications-tqyQ_Tdn.js} +26 -2
  3. package/dist/{client-CLrtWgrD.js → client-IcTBKEqA.js} +5 -2
  4. package/dist/{client-factory-Bm6HsGob.js → client-factory-DfFu9JH_.js} +2 -5
  5. package/dist/{command-handlers-DEPTJYk0.js → command-handlers-C9K-KRU-.js} +25 -19
  6. package/dist/{compact-aQJ0ZKhe.js → compact-CILptrPS.js} +5 -5
  7. package/dist/{computer-use-ClrJwoFp.js → computer-use-CpurU-G9.js} +3 -3
  8. package/dist/{config-CszD0vP3.js → config-C_whBx3M.js} +8 -3
  9. package/dist/{conversation-binding-t0XMLz-j.js → conversation-binding-DOJtUxOy.js} +28 -15
  10. package/dist/harness.js +6 -6
  11. package/dist/index.js +27 -26
  12. package/dist/{media-understanding-provider-ZUQHN7gT.js → media-understanding-provider-BOeoBhEw.js} +6 -6
  13. package/dist/media-understanding-provider.js +1 -1
  14. package/dist/{models-CAmfBWRl.js → models-DpzY1xpp.js} +2 -2
  15. package/dist/{plugin-app-cache-key-C9ILt7bl.js → plugin-app-cache-key-BrZUG9jj.js} +8 -4
  16. package/dist/{protocol-validators-B19q5BIX.js → protocol-validators-CJiWigAJ.js} +107 -15
  17. package/dist/{provider-capabilities-D7hnTO76.js → provider-capabilities-wqedK49Z.js} +184 -16
  18. package/dist/provider-catalog.js +4 -2
  19. package/dist/{provider-B-OHpbD3.js → provider-nmtMDcGH.js} +53 -18
  20. package/dist/provider.js +2 -2
  21. package/dist/{request-Dcd452Nk.js → request-BQuSQF29.js} +2 -2
  22. package/dist/{run-attempt-CXxtFC9d.js → run-attempt-DikbXia_.js} +416 -105
  23. package/dist/{sandbox-guard-3tnjhjFb.js → sandbox-guard-pTY2COoC.js} +2 -0
  24. package/dist/{session-binding-HOuPt-E0.js → session-binding-Cm0Gg7Z1.js} +2 -1
  25. package/dist/{shared-client-Dtx5i7Ez.js → shared-client-rR6TDJA3.js} +98 -47
  26. package/dist/{side-question-C-DhgJOd.js → side-question-Ca9wqmd0.js} +12 -12
  27. package/dist/{thread-lifecycle-DtT3-ehU.js → thread-lifecycle-D6R40plk.js} +148 -42
  28. package/dist/{web-search-provider.runtime-CkwxrXQj.js → web-search-provider.runtime-B6eZEFmd.js} +2 -2
  29. package/npm-shrinkwrap.json +30 -30
  30. package/openclaw.plugin.json +3 -3
  31. package/package.json +5 -5
@@ -135,6 +135,8 @@ const DIRECT_METHOD_POLICIES = new Map([
135
135
  ["account/read", "allowed-control-plane"],
136
136
  ["app/list", "allowed-control-plane"],
137
137
  ["config/mcpServer/reload", "allowed-control-plane"],
138
+ ["config/read", "allowed-control-plane"],
139
+ ["config/value/write", "allowed-control-plane"],
138
140
  ["environment/add", "allowed-control-plane"],
139
141
  ["experimentalFeature/enablement/set", "allowed-control-plane"],
140
142
  ["feedback/upload", "allowed-control-plane"],
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { l as normalizeCodexServiceTier } from "./config-CszD0vP3.js";
2
+ import { l as normalizeCodexServiceTier } from "./config-C_whBx3M.js";
3
3
  import fs from "node:fs/promises";
4
4
  import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
5
5
  import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -221,6 +221,7 @@ function readDestructiveApprovalMode(value, bindingSchemaVersion) {
221
221
  if (value === "deny") return "deny";
222
222
  if (value === "allow") return "allow";
223
223
  if (value === "auto") return bindingSchemaVersion === 1 ? "allow" : "auto";
224
+ if (value === "ask" && bindingSchemaVersion === 2) return "ask";
224
225
  if (value === "on-request" && bindingSchemaVersion === 1) return "auto";
225
226
  return "invalid";
226
227
  }
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { d as resolveCodexAppServerRuntimeOptions, r as codexAppServerStartOptionsKey } from "./config-CszD0vP3.js";
3
- import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-CLrtWgrD.js";
2
+ import { d as resolveCodexAppServerRuntimeOptions, r as codexAppServerStartOptionsKey } from "./config-C_whBx3M.js";
3
+ import { l as resolveCodexAppServerSpawnEnv, o as isUnsupportedCodexAppServerVersionError, s as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-IcTBKEqA.js";
4
4
  import { createRequire } from "node:module";
5
5
  import fs, { access } from "node:fs/promises";
6
6
  import path from "node:path";
@@ -511,6 +511,7 @@ function resolveChatgptAccountId(profileId, credential) {
511
511
  * the Codex plugin before stdio startup.
512
512
  */
513
513
  const CODEX_PLUGIN_ROOT = resolveDefaultCodexPluginRoot(path.dirname(fileURLToPath(import.meta.url)));
514
+ const MACOS_DESKTOP_CODEX_APP_SERVER_COMMAND = "/Applications/Codex.app/Contents/Resources/codex";
514
515
  /** Rewrites managed stdio start options to point at an executable Codex binary path. */
515
516
  async function resolveManagedCodexAppServerStartOptions(startOptions, options = {}) {
516
517
  if (startOptions.transport !== "stdio" || startOptions.commandSource !== "managed") return startOptions;
@@ -520,15 +521,18 @@ async function resolveManagedCodexAppServerStartOptions(startOptions, options =
520
521
  pluginRoot: options.pluginRoot
521
522
  });
522
523
  const pathExists = options.pathExists ?? commandPathExists;
523
- const commandPath = await findManagedCodexAppServerCommandPath({
524
+ const commandPaths = await findManagedCodexAppServerCommandPaths({
524
525
  candidateCommandPaths: paths.candidateCommandPaths,
525
526
  pathExists,
526
527
  platform
527
528
  });
529
+ const commandPath = commandPaths[0];
530
+ const managedFallbackCommandPaths = commandPaths.slice(1);
528
531
  return {
529
532
  ...startOptions,
530
533
  command: commandPath,
531
- commandSource: "resolved-managed"
534
+ commandSource: "resolved-managed",
535
+ ...managedFallbackCommandPaths.length > 0 ? { managedFallbackCommandPaths } : {}
532
536
  };
533
537
  }
534
538
  /** Returns the preferred and fallback managed Codex binary paths for a plugin root. */
@@ -544,7 +548,14 @@ function resolveManagedCodexAppServerCommandCandidates(pluginRoot, platform) {
544
548
  const pathApi = pathForPlatform(platform);
545
549
  const commandName = platform === "win32" ? "codex.cmd" : "codex";
546
550
  const roots = resolveManagedCodexAppServerCandidateRoots(pluginRoot, platform);
547
- return [...new Set([...roots.map((root) => pathApi.join(root, "node_modules", ".bin", commandName)), ...resolveManagedCodexPackageBinCandidates(roots, platform)])];
551
+ return [...new Set([
552
+ ...resolveDesktopCodexAppServerCommandCandidates(platform),
553
+ ...roots.map((root) => pathApi.join(root, "node_modules", ".bin", commandName)),
554
+ ...resolveManagedCodexPackageBinCandidates(roots, platform)
555
+ ])];
556
+ }
557
+ function resolveDesktopCodexAppServerCommandCandidates(platform) {
558
+ return platform === "darwin" ? [MACOS_DESKTOP_CODEX_APP_SERVER_COMMAND] : [];
548
559
  }
549
560
  function resolveDefaultCodexPluginRoot(moduleDir) {
550
561
  const moduleBaseName = path.basename(moduleDir);
@@ -610,8 +621,10 @@ function isDistExtensionRoot(pluginRoot, platform) {
610
621
  function pathForPlatform(platform) {
611
622
  return platform === "win32" ? path.win32 : path.posix;
612
623
  }
613
- async function findManagedCodexAppServerCommandPath(params) {
614
- for (const commandPath of params.candidateCommandPaths) if (await params.pathExists(commandPath, params.platform)) return commandPath;
624
+ async function findManagedCodexAppServerCommandPaths(params) {
625
+ const commandPaths = [];
626
+ for (const commandPath of params.candidateCommandPaths) if (await params.pathExists(commandPath, params.platform)) commandPaths.push(commandPath);
627
+ if (commandPaths.length > 0) return commandPaths;
615
628
  throw new Error([
616
629
  `Managed Codex app-server binary was not found for ${MANAGED_CODEX_APP_SERVER_PACKAGE}.`,
617
630
  "Reinstall or update OpenClaw, or run pnpm install in a source checkout.",
@@ -779,25 +792,21 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
779
792
  if (options.abandonSignal.aborted) abandon();
780
793
  }
781
794
  const sharedPromise = entry.promise ?? (entry.promise = (async () => {
782
- const client = CodexAppServerClient.start(startOptions);
795
+ const client = await startInitializedCodexAppServerClient({
796
+ startOptions,
797
+ agentDir,
798
+ authProfileId: usesNativeAuth ? null : authProfileId,
799
+ config: options?.config,
800
+ onStartedClient: (startedClient) => {
801
+ entry.client = startedClient;
802
+ startedClient.setActiveSharedLeaseCountProviderForUnscopedNotifications(() => entry.activeLeases);
803
+ options?.onStartedClient?.(startedClient);
804
+ }
805
+ });
783
806
  entry.client = client;
784
- options?.onStartedClient?.(client);
785
807
  client.setActiveSharedLeaseCountProviderForUnscopedNotifications(() => entry.activeLeases);
786
808
  client.addCloseHandler((closedClient) => clearSharedClientEntryIfCurrent(key, closedClient));
787
- try {
788
- await client.initialize();
789
- await applyCodexAppServerAuthProfile({
790
- client,
791
- agentDir,
792
- authProfileId: usesNativeAuth ? null : authProfileId,
793
- startOptions,
794
- config: options?.config
795
- });
796
- return client;
797
- } catch (error) {
798
- client.close();
799
- throw error;
800
- }
809
+ return client;
801
810
  })());
802
811
  try {
803
812
  const client = await withTimeout$1(sharedPromise, options?.timeoutMs ?? 0, "codex app-server initialize timed out");
@@ -819,33 +828,75 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
819
828
  /** Starts a non-shared Codex app-server client owned entirely by the caller. */
820
829
  async function createIsolatedCodexAppServerClient(options) {
821
830
  const { agentDir, usesNativeAuth, authProfileId, authProfileStore, startOptions } = await resolveCodexAppServerClientStartContext(options);
822
- const client = CodexAppServerClient.start(startOptions);
823
- if (authProfileId) client.addRequestHandler(async (request) => {
824
- if (request.method !== "account/chatgptAuthTokens/refresh") return;
825
- return await refreshCodexAppServerAuthTokens({
826
- agentDir,
827
- authProfileId,
828
- ...authProfileStore ? { authProfileStore } : {},
829
- config: options?.config
830
- });
831
+ return await startInitializedCodexAppServerClient({
832
+ startOptions,
833
+ agentDir,
834
+ authProfileId: usesNativeAuth ? null : authProfileId,
835
+ authProfileStore,
836
+ config: options?.config,
837
+ timeoutMs: options?.timeoutMs,
838
+ onStartedClient: options?.onStartedClient
831
839
  });
832
- const initialize = client.initialize();
833
- try {
834
- await withTimeout$1(initialize, options?.timeoutMs ?? 0, "codex app-server initialize timed out");
835
- await applyCodexAppServerAuthProfile({
836
- client,
837
- agentDir,
838
- authProfileId: usesNativeAuth ? null : authProfileId,
839
- startOptions,
840
- config: options?.config,
841
- ...authProfileStore ? { authProfileStore } : {}
840
+ }
841
+ async function startInitializedCodexAppServerClient(params) {
842
+ const startOptionsCandidates = resolveManagedFallbackStartOptions(params.startOptions);
843
+ for (let index = 0; index < startOptionsCandidates.length; index += 1) {
844
+ const startOptions = startOptionsCandidates[index];
845
+ const client = CodexAppServerClient.start(startOptions);
846
+ params.onStartedClient?.(client);
847
+ const initialize = client.initialize();
848
+ try {
849
+ await withTimeout$1(initialize, params.timeoutMs ?? 0, "codex app-server initialize timed out");
850
+ } catch (error) {
851
+ client.close();
852
+ initialize.catch(() => void 0);
853
+ if (shouldTryManagedFallbackStartOption(error, startOptions, index, startOptionsCandidates)) continue;
854
+ throw error;
855
+ }
856
+ if (params.authProfileId) client.addRequestHandler(async (request) => {
857
+ if (request.method !== "account/chatgptAuthTokens/refresh") return;
858
+ return await refreshCodexAppServerAuthTokens({
859
+ agentDir: params.agentDir,
860
+ authProfileId: params.authProfileId,
861
+ ...params.authProfileStore ? { authProfileStore: params.authProfileStore } : {},
862
+ config: params.config
863
+ });
842
864
  });
843
- return client;
844
- } catch (error) {
845
- client.close();
846
- initialize.catch(() => void 0);
847
- throw error;
865
+ try {
866
+ await applyCodexAppServerAuthProfile({
867
+ client,
868
+ agentDir: params.agentDir,
869
+ authProfileId: params.authProfileId,
870
+ startOptions,
871
+ config: params.config,
872
+ ...params.authProfileStore ? { authProfileStore: params.authProfileStore } : {}
873
+ });
874
+ return client;
875
+ } catch (error) {
876
+ client.close();
877
+ throw error;
878
+ }
848
879
  }
880
+ throw new Error("Managed Codex app-server fallback candidates were exhausted.");
881
+ }
882
+ function resolveManagedFallbackStartOptions(startOptions) {
883
+ const commands = [startOptions.command, ...startOptions.managedFallbackCommandPaths ?? []];
884
+ const candidates = [];
885
+ for (let index = 0; index < commands.length; index += 1) {
886
+ const command = commands[index];
887
+ const managedFallbackCommandPaths = commands.slice(index + 1);
888
+ const candidate = {
889
+ ...startOptions,
890
+ command
891
+ };
892
+ if (managedFallbackCommandPaths.length === 0) delete candidate.managedFallbackCommandPaths;
893
+ else candidate.managedFallbackCommandPaths = managedFallbackCommandPaths;
894
+ candidates.push(candidate);
895
+ }
896
+ return candidates;
897
+ }
898
+ function shouldTryManagedFallbackStartOption(error, startOptions, index, startOptionsCandidates) {
899
+ return startOptions.commandSource === "resolved-managed" && index < startOptionsCandidates.length - 1 && isUnsupportedCodexAppServerVersionError(error);
849
900
  }
850
901
  /** Clears and closes all shared clients for deterministic tests. */
851
902
  function resetSharedCodexAppServerClientForTests() {
@@ -1,14 +1,14 @@
1
1
  import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
- import { H as readCodexNotificationTurnId, N as mergeCodexThreadConfigs, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, V as readCodexNotificationThreadId, _ as resolveCodexWebSearchPlan, d as resolveCodexAppServerRequestModelSelection, m as resolveReasoningEffort, p as resolveCodexBindingModelProviderFallback, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-DtT3-ehU.js";
3
- import { d as resolveCodexAppServerRuntimeOptions, g as shouldAutoApproveCodexAppServerApprovals, h as resolveOpenClawExecPolicyForCodexAppServer, n as canUseCodexModelBackedApprovalsReviewerForModel, p as resolveCodexModelBackedReviewerPolicyContext, u as readCodexPluginConfig } from "./config-CszD0vP3.js";
4
- import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-B19q5BIX.js";
5
- import { i as formatCodexUsageLimitErrorMessage } from "./provider-B-OHpbD3.js";
6
- import { i as isCodexAppServerApprovalRequest } from "./client-CLrtWgrD.js";
7
- import { i as isCodexAppServerNativeAuthProfile, o as readCodexAppServerBinding } from "./session-binding-HOuPt-E0.js";
8
- import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-BPTiVNsW.js";
9
- import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, u as refreshCodexAppServerAuthTokens } from "./shared-client-Dtx5i7Ez.js";
10
- import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-3tnjhjFb.js";
11
- import { C as resolveCodexMessageToolProvider, O as filterToolsForVisionInputs, T as shouldEnableCodexAppServerNativeToolSurface, a as buildCodexNativeHookRelayConfig, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, h as emitDynamicToolTerminalDiagnostic, k as handleCodexAppServerApprovalRequest, m as emitDynamicToolStartedDiagnostic, n as resolveCodexProviderWebSearchSupportForClient, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, r as CODEX_NATIVE_HOOK_RELAY_EVENTS } from "./provider-capabilities-D7hnTO76.js";
2
+ import { H as readCodexNotificationThreadId, P as mergeCodexThreadConfigs, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, U as readCodexNotificationTurnId, _ as resolveCodexWebSearchPlan, d as resolveCodexAppServerRequestModelSelection, j as buildCodexPluginAppsConfigPatchFromPolicyContext, m as resolveReasoningEffort, p as resolveCodexBindingModelProviderFallback, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-D6R40plk.js";
3
+ import { d as resolveCodexAppServerRuntimeOptions, g as shouldAutoApproveCodexAppServerApprovals, h as resolveOpenClawExecPolicyForCodexAppServer, n as canUseCodexModelBackedApprovalsReviewerForModel, p as resolveCodexModelBackedReviewerPolicyContext, u as readCodexPluginConfig } from "./config-C_whBx3M.js";
4
+ import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-CJiWigAJ.js";
5
+ import { a as readCodexSupportedReasoningEfforts, s as formatCodexUsageLimitErrorMessage } from "./provider-nmtMDcGH.js";
6
+ import { i as isCodexAppServerApprovalRequest } from "./client-IcTBKEqA.js";
7
+ import { i as isCodexAppServerNativeAuthProfile, o as readCodexAppServerBinding } from "./session-binding-Cm0Gg7Z1.js";
8
+ import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-B7hqD3Xj.js";
9
+ import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, u as refreshCodexAppServerAuthTokens } from "./shared-client-rR6TDJA3.js";
10
+ import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-pTY2COoC.js";
11
+ import { C as resolveCodexMessageToolProvider, O as filterToolsForVisionInputs, T as shouldEnableCodexAppServerNativeToolSurface, a as buildCodexNativeHookRelayConfig, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, h as emitDynamicToolTerminalDiagnostic, k as handleCodexAppServerApprovalRequest, m as emitDynamicToolStartedDiagnostic, n as resolveCodexProviderWebSearchSupportForClient, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, r as CODEX_NATIVE_HOOK_RELAY_EVENTS } from "./provider-capabilities-wqedK49Z.js";
12
12
  import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-C7qmZ0Jh.js";
13
13
  import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
14
14
  import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -272,7 +272,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
272
272
  nativeCodeModeEnabled: nativeToolSurfaceEnabled,
273
273
  nativeCodeModeOnlyEnabled: appServer.codeModeOnly
274
274
  });
275
- const threadConfig = mergeCodexThreadConfigs(nativeHookRelayConfig, runtimeThreadConfig, modelScopedAppServer.networkProxy?.configPatch) ?? runtimeThreadConfig;
275
+ const threadConfig = mergeCodexThreadConfigs(nativeHookRelayConfig, runtimeThreadConfig, binding.pluginAppPolicyContext ? buildCodexPluginAppsConfigPatchFromPolicyContext(binding.pluginAppPolicyContext) : void 0, modelScopedAppServer.networkProxy?.configPatch) ?? runtimeThreadConfig;
276
276
  childThreadId = assertCodexThreadForkResponse(await forkCodexSideThread(client, {
277
277
  threadId: binding.threadId,
278
278
  model: modelSelection.model,
@@ -298,7 +298,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
298
298
  timeoutMs: appServer.requestTimeoutMs,
299
299
  signal: params.opts?.abortSignal
300
300
  });
301
- const effort = resolveReasoningEffort(params.resolvedThinkLevel ?? "off", modelSelection.model);
301
+ const effort = resolveReasoningEffort(params.resolvedThinkLevel ?? "off", modelSelection.model, readCodexSupportedReasoningEfforts(params.runtimeModel?.compat));
302
302
  turnId = assertCodexTurnStartResponse(await client.request("turn/start", {
303
303
  threadId: childThreadId,
304
304
  input: [{