@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,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { d as codexAppServerStartOptionsKey, h as resolveCodexComputerUseConfig, m as resolveCodexAppServerStartOptionsForAgent, o as isCodexAppServerNativeAuthProfile, p as resolveCodexAppServerRuntimeOptions, x as resolveCodexAppServerUserHomeDir } from "./session-binding-DlVQ-Pxs.js";
2
+ import { _ as resolveCodexAppServerStartOptionsForAgent, g as resolveCodexAppServerRuntimeOptions, o as isCodexAppServerNativeAuthProfile, p as codexAppServerStartOptionsKey, v as resolveCodexComputerUseConfig, w as resolveCodexAppServerUserHomeDir } from "./session-binding-BXpo9ymA.js";
3
3
  import { n as resolveCodexAppServerSpawnEnv, t as createStdioTransport } from "./transport-stdio-DXgGZ7Ib.js";
4
4
  import { createRequire } from "node:module";
5
5
  import fs, { access } from "node:fs/promises";
@@ -13,10 +13,10 @@ import fsSync, { constants, existsSync, readFileSync, realpathSync } from "node:
13
13
  import os from "node:os";
14
14
  import { isDeepStrictEqual } from "node:util";
15
15
  import { hasUsableOAuthCredential } from "openclaw/plugin-sdk/provider-auth";
16
+ import { readSecretFile } from "openclaw/plugin-sdk/secret-file";
16
17
  import { runExec } from "openclaw/plugin-sdk/process-runtime";
17
18
  import { createInterface } from "node:readline";
18
19
  import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
19
- import { parse } from "semver";
20
20
  import { EventEmitter } from "node:events";
21
21
  import net from "node:net";
22
22
  import { PassThrough, Writable } from "node:stream";
@@ -417,10 +417,7 @@ function isRpcResponse(message) {
417
417
  //#endregion
418
418
  //#region extensions/codex/src/app-server/auth-bridge.ts
419
419
  const CODEX_APP_SERVER_AUTH_PROVIDER = "openai";
420
- const OPENAI_CODEX_APP_SERVER_AUTH_PROVIDER = "openai-codex";
421
- const LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER = "codex-cli";
422
- const CODEX_APP_SERVER_EXTERNAL_CLI_PROVIDER_IDS = [CODEX_APP_SERVER_AUTH_PROVIDER, LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER];
423
- const OPENAI_PROVIDER = "openai";
420
+ const CODEX_APP_SERVER_EXTERNAL_CLI_PROVIDER_IDS = [CODEX_APP_SERVER_AUTH_PROVIDER];
424
421
  const OPENAI_CODEX_DEFAULT_PROFILE_ID = "openai:default";
425
422
  const CODEX_HOME_ENV_VAR = "CODEX_HOME";
426
423
  const HOME_ENV_VAR = "HOME";
@@ -454,8 +451,7 @@ async function bridgeCodexAppServerStartOptions(params) {
454
451
  authProfileId: params.authProfileId,
455
452
  store,
456
453
  config: params.config
457
- }),
458
- config: params.config
454
+ })
459
455
  }) ? withClearedEnvironmentVariables(scopedStartOptions, CODEX_APP_SERVER_API_KEY_ENV_VARS) : scopedStartOptions;
460
456
  }
461
457
  function resolveCodexAppServerAuthProfileId(params) {
@@ -512,7 +508,7 @@ async function resolveCodexAppServerPreparedAuthProfileSnapshot(params) {
512
508
  });
513
509
  if (!profileId) return;
514
510
  const credential = store.profiles[profileId];
515
- if (!credential || !isCodexAppServerAuthProfileCredential(credential, params.config)) return;
511
+ if (!credential || !isCodexAppServerAuthProfileCredential(credential)) return;
516
512
  const loginParams = await resolveCodexAppServerAuthProfileLoginParamsInternal({
517
513
  agentDir,
518
514
  authProfileId: profileId,
@@ -586,7 +582,7 @@ async function resolveCodexAppServerAuthAccountCacheKey(params) {
586
582
  });
587
583
  if (!profileId) return;
588
584
  const credential = store.profiles[profileId];
589
- if (!credential || !isCodexAppServerAuthProfileCredential(credential, params.config)) return;
585
+ if (!credential || !isCodexAppServerAuthProfileCredential(credential)) return;
590
586
  if (credential.type === "api_key") {
591
587
  const apiKey = (await resolveApiKeyForProfile({
592
588
  store,
@@ -697,10 +693,7 @@ async function applyCodexAppServerAuthProfile(params) {
697
693
  return;
698
694
  }
699
695
  if (params.authProfileId === null) {
700
- if (params.authRequirement === "subscription") {
701
- const response = await params.client.request("account/read", { refreshToken: false });
702
- if (!isJsonObject$1(response.account) || response.account.type !== "chatgpt") throw createCodexAppServerAuthError("Codex subscription auth profile could not produce login credentials.");
703
- }
696
+ await assertNativeCodexAccountMatchesRoute(params.client, params.authRequirement);
704
697
  return;
705
698
  }
706
699
  let loginParams;
@@ -730,6 +723,23 @@ async function applyCodexAppServerAuthProfile(params) {
730
723
  }
731
724
  await params.client.request("account/login/start", loginParams);
732
725
  }
726
+ /**
727
+ * Native-home connections are verified, never logged into. Both directions of the
728
+ * check protect the same billing boundary: a subscription route cannot run without
729
+ * ChatGPT tokens, and a Platform route must not silently spend the operator's
730
+ * ChatGPT plan. An absent account is left alone because the native home may serve a
731
+ * custom model provider that reports no OpenAI account at all.
732
+ */
733
+ async function assertNativeCodexAccountMatchesRoute(client, authRequirement) {
734
+ if (!authRequirement) return;
735
+ const response = await client.request("account/read", { refreshToken: false });
736
+ const accountType = isJsonObject$1(response.account) ? response.account.type : void 0;
737
+ if (authRequirement === "subscription") {
738
+ if (accountType !== "chatgpt") throw createCodexAppServerAuthError("Codex subscription auth profile could not produce login credentials.");
739
+ return;
740
+ }
741
+ if (accountType === "chatgpt") throw createCodexAppServerAuthError("Codex Platform route requires an API-key account, but the native Codex home is signed in with a ChatGPT subscription. Sign that home in with `codex login --with-api-key`, or set appServer.homeScope=\"agent\" so OpenClaw can inject its own key.");
742
+ }
733
743
  function createCodexAppServerAuthError(message, cause) {
734
744
  const error = cause === void 0 ? new Error(message) : new Error(message, { cause });
735
745
  return Object.assign(error, { status: 401 });
@@ -744,7 +754,7 @@ async function resolveCodexAppServerAuthProfileLoginParams(params) {
744
754
  });
745
755
  const profile = profileId ? store.profiles[profileId] : void 0;
746
756
  if (profileId && !profile) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" was not found.`);
747
- if (profileId && profile && !isCodexAppServerAuthProfileCredential(profile, params.config)) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" must be OpenAI Codex auth or an OpenAI API-key backup.`);
757
+ if (profileId && profile && !isCodexAppServerAuthProfileCredential(profile)) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" must use the canonical OpenAI auth provider; run "openclaw doctor --fix" to migrate legacy provider IDs.`);
748
758
  return await resolveCodexAppServerAuthProfileLoginParamsInternal({
749
759
  ...params,
750
760
  authProfileStore: store
@@ -777,7 +787,7 @@ async function resolveCodexAppServerAuthProfileLoginParamsInternal(params) {
777
787
  if (!profileId) return;
778
788
  const credential = store.profiles[profileId];
779
789
  if (!credential) throw new Error(`Codex app-server auth profile "${profileId}" was not found.`);
780
- if (!isCodexAppServerAuthProfileCredential(credential, params.config)) throw new Error(`Codex app-server auth profile "${profileId}" must be OpenAI Codex auth or an OpenAI API-key backup.`);
790
+ if (!isCodexAppServerAuthProfileCredential(credential)) throw new Error(`Codex app-server auth profile "${profileId}" must use the canonical OpenAI auth provider; run "openclaw doctor --fix" to migrate legacy provider IDs.`);
781
791
  const loginParams = await resolveLoginParamsForCredential(profileId, credential, {
782
792
  agentDir: params.agentDir,
783
793
  store,
@@ -823,7 +833,7 @@ function parseCodexCliAuthFileApiKey(raw) {
823
833
  }
824
834
  async function readCodexCliAuthFileApiKey(env) {
825
835
  try {
826
- return parseCodexCliAuthFileApiKey(await fs.readFile(resolveCodexCliAuthFilePath(env), "utf8"));
836
+ return parseCodexCliAuthFileApiKey(await readSecretFile(resolveCodexCliAuthFilePath(env), "Codex CLI auth file"));
827
837
  } catch {
828
838
  return;
829
839
  }
@@ -888,9 +898,9 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
888
898
  authProfileId: profileId,
889
899
  config: params.config
890
900
  });
891
- const persistedOAuthCredential = !useScopedCredential && persistedCredential?.type === "oauth" && isCodexAppServerAuthProvider(persistedCredential.provider, params.config) ? persistedCredential : void 0;
901
+ const persistedOAuthCredential = !useScopedCredential && persistedCredential?.type === "oauth" && isCodexAppServerAuthProvider(persistedCredential.provider) ? persistedCredential : void 0;
892
902
  const ownerCredential = store.profiles[profileId];
893
- const overlaidOAuthCredential = ownerCredential?.type === "oauth" && isCodexAppServerAuthProvider(ownerCredential.provider, params.config) ? ownerCredential : void 0;
903
+ const overlaidOAuthCredential = ownerCredential?.type === "oauth" && isCodexAppServerAuthProvider(ownerCredential.provider) ? ownerCredential : void 0;
894
904
  if (useScopedCredential && overlaidOAuthCredential) return await resolveScopedOAuthCredential({
895
905
  store,
896
906
  profileId,
@@ -910,10 +920,10 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
910
920
  forceRefresh: params.forceRefresh && Boolean(persistedOAuthCredential)
911
921
  });
912
922
  const refreshed = useScopedCredential ? void 0 : loadAuthProfileStoreForSecretsRuntime(ownerAgentDir).profiles[profileId];
913
- const refreshedOAuthCredential = refreshed?.type === "oauth" && isCodexAppServerAuthProvider(refreshed.provider, params.config) ? refreshed : void 0;
923
+ const refreshedOAuthCredential = refreshed?.type === "oauth" && isCodexAppServerAuthProvider(refreshed.provider) ? refreshed : void 0;
914
924
  if (refreshedOAuthCredential && isDeepStrictEqual(params.store.profiles[profileId], credential)) params.store.profiles[profileId] = refreshedOAuthCredential;
915
925
  const storedCredential = store.profiles[profileId];
916
- const candidate = refreshedOAuthCredential ? refreshedOAuthCredential : storedCredential?.type === "oauth" && isCodexAppServerAuthProvider(storedCredential.provider, params.config) ? storedCredential : credential;
926
+ const candidate = refreshedOAuthCredential ? refreshedOAuthCredential : storedCredential?.type === "oauth" && isCodexAppServerAuthProvider(storedCredential.provider) ? storedCredential : credential;
917
927
  return resolved?.apiKey ? {
918
928
  ...candidate,
919
929
  access: resolved.apiKey
@@ -957,22 +967,18 @@ async function resolveScopedOAuthCredential(params) {
957
967
  if (storeRefreshes.get(params.profileId) === refresh) storeRefreshes.delete(params.profileId);
958
968
  }
959
969
  }
960
- function isCodexAppServerAuthProvider(provider, config) {
961
- const resolvedProvider = resolveProviderIdForAuth(provider, { config });
962
- return resolvedProvider === CODEX_APP_SERVER_AUTH_PROVIDER || resolvedProvider === OPENAI_CODEX_APP_SERVER_AUTH_PROVIDER || resolvedProvider === LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER;
963
- }
964
- function isOpenAIApiKeyBackupCredential(credential, config) {
965
- return credential.type === "api_key" && resolveProviderIdForAuth(credential.provider, { config }) === OPENAI_PROVIDER;
970
+ function isCodexAppServerAuthProvider(provider) {
971
+ return provider.trim().toLowerCase() === CODEX_APP_SERVER_AUTH_PROVIDER;
966
972
  }
967
- function isCodexAppServerAuthProfileCredential(credential, config) {
968
- return isCodexAppServerAuthProvider(credential.provider, config) || isOpenAIApiKeyBackupCredential(credential, config);
973
+ function isCodexAppServerAuthProfileCredential(credential) {
974
+ return isCodexAppServerAuthProvider(credential.provider);
969
975
  }
970
976
  function shouldClearOpenAiApiKeyForCodexAuthProfile(params) {
971
977
  const profileId = params.authProfileId?.trim();
972
- return isCodexSubscriptionCredential(profileId ? params.store.profiles[profileId] : params.store.profiles[OPENAI_CODEX_DEFAULT_PROFILE_ID], params.config);
978
+ return isCodexSubscriptionCredential(profileId ? params.store.profiles[profileId] : params.store.profiles[OPENAI_CODEX_DEFAULT_PROFILE_ID]);
973
979
  }
974
- function isCodexSubscriptionCredential(credential, config) {
975
- if (!credential || !isCodexAppServerAuthProvider(credential.provider, config)) return false;
980
+ function isCodexSubscriptionCredential(credential) {
981
+ if (!credential || !isCodexAppServerAuthProvider(credential.provider)) return false;
976
982
  return credential.type === "oauth" || credential.type === "token";
977
983
  }
978
984
  function withClearedEnvironmentVariables(startOptions, envVars) {
@@ -1144,6 +1150,39 @@ function ensureCodexAppServerClientRuntime(client, context) {
1144
1150
  if (notification.method === "account/rateLimits/updated") mergeCodexRateLimitsUpdate(client, notification.params);
1145
1151
  });
1146
1152
  }
1153
+ /** Keep at most one idle, still-subscribed thread on a physical Codex client. */
1154
+ async function retainCodexAppServerLiveThread(client, threadId, releasePreviousThread, configFingerprint) {
1155
+ const runtime = configuredClients.get(client);
1156
+ if (!runtime) return;
1157
+ if (runtime.retainedThreadRelease) await runtime.retainedThreadRelease;
1158
+ const previousThreadId = runtime.retainedThreadId;
1159
+ if (previousThreadId && previousThreadId !== threadId && releasePreviousThread) {
1160
+ const release = releasePreviousThread(previousThreadId);
1161
+ runtime.retainedThreadRelease = release;
1162
+ try {
1163
+ await release;
1164
+ } catch (error) {
1165
+ runtime.retainedThreadId = void 0;
1166
+ runtime.retainedThreadConfigFingerprint = void 0;
1167
+ throw error;
1168
+ } finally {
1169
+ if (runtime.retainedThreadRelease === release) runtime.retainedThreadRelease = void 0;
1170
+ }
1171
+ }
1172
+ runtime.retainedThreadId = threadId;
1173
+ runtime.retainedThreadConfigFingerprint = configFingerprint;
1174
+ return previousThreadId ? { previousThreadId } : {};
1175
+ }
1176
+ /** A warm turn can skip resume only when this exact subscription was retained. */
1177
+ async function consumeCodexAppServerLiveThread(client, threadId, configFingerprint) {
1178
+ const runtime = configuredClients.get(client);
1179
+ if (!runtime) return false;
1180
+ if (runtime.retainedThreadRelease) await runtime.retainedThreadRelease;
1181
+ if (runtime.retainedThreadId !== threadId || configFingerprint !== void 0 && runtime.retainedThreadConfigFingerprint !== configFingerprint) return false;
1182
+ runtime.retainedThreadId = void 0;
1183
+ runtime.retainedThreadConfigFingerprint = void 0;
1184
+ return true;
1185
+ }
1147
1186
  //#endregion
1148
1187
  //#region extensions/codex/src/app-server/transport-websocket.ts
1149
1188
  /**
@@ -1309,10 +1348,8 @@ function signalCodexAppServerTransport(child, signal) {
1309
1348
  /**
1310
1349
  * Version and package pins for the managed Codex app-server runtime.
1311
1350
  */
1312
- /** Minimum Codex app-server version supported by the OpenClaw Codex bridge. */
1313
- const MIN_CODEX_APP_SERVER_VERSION = "0.143.0";
1314
- /** Newest Codex app-server version validated by the OpenClaw Codex bridge. */
1315
- const MAX_CODEX_APP_SERVER_VERSION = "0.145.0";
1351
+ /** Exact Codex app-server version shipped and supported by the OpenClaw Codex bridge. */
1352
+ const CODEX_APP_SERVER_VERSION = "0.146.0";
1316
1353
  /** npm package name for the managed Codex app-server binary. */
1317
1354
  const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
1318
1355
  //#endregion
@@ -1321,7 +1358,6 @@ const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
1321
1358
  * JSON-RPC client for Codex app-server transports, including request/response
1322
1359
  * routing, notification fanout, server request handlers, and version checks.
1323
1360
  */
1324
- /** Minimum supported Codex app-server version exported for callers/tests. */
1325
1361
  const CODEX_APP_SERVER_PARSE_LOG_MAX = 500;
1326
1362
  const CODEX_APP_SERVER_PARSE_BUFFER_MAX = 8 * 1024 * 1024;
1327
1363
  const CODEX_APP_SERVER_PARSE_BUFFER_MAX_LINES = 1e3;
@@ -1491,6 +1527,10 @@ var CodexAppServerClient = class CodexAppServerClient {
1491
1527
  getRuntimeIdentity() {
1492
1528
  return this.runtimeIdentity ? { ...this.runtimeIdentity } : void 0;
1493
1529
  }
1530
+ /** Returns a bounded, redacted stderr diagnostic from the app-server process. */
1531
+ getStderrDiagnostic() {
1532
+ return redactCodexAppServerLinePreview(this.stderrTail) || void 0;
1533
+ }
1494
1534
  /** Stable generation id for this exact physical client instance. */
1495
1535
  getInstanceId() {
1496
1536
  return this.instanceId;
@@ -1876,9 +1916,13 @@ var CodexAppServerClient = class CodexAppServerClient {
1876
1916
  }
1877
1917
  }
1878
1918
  handleNotification(notification) {
1879
- for (const handler of this.notificationHandlers) Promise.resolve(handler(notification)).catch((error) => {
1919
+ for (const handler of this.notificationHandlers) try {
1920
+ Promise.resolve(handler(notification)).catch((error) => {
1921
+ embeddedAgentLog.warn("codex app-server notification handler failed", { error });
1922
+ });
1923
+ } catch (error) {
1880
1924
  embeddedAgentLog.warn("codex app-server notification handler failed", { error });
1881
- });
1925
+ }
1882
1926
  }
1883
1927
  closeWithError(error) {
1884
1928
  if (this.markClosed(error)) closeCodexAppServerTransport(this.child);
@@ -1934,15 +1978,14 @@ function timeoutServerRequestResponse(request) {
1934
1978
  var CodexAppServerVersionError = class extends Error {
1935
1979
  constructor(detectedVersion) {
1936
1980
  const detected = detectedVersion ? `detected ${detectedVersion}` : "OpenClaw could not determine the running Codex version";
1937
- super(`A stable Codex app-server from ${MIN_CODEX_APP_SERVER_VERSION} through ${MAX_CODEX_APP_SERVER_VERSION} is required, but ${detected}. Update the configured Codex app-server binary, or remove custom command overrides to use the managed binary.`);
1981
+ super(`Codex app-server ${CODEX_APP_SERVER_VERSION} is required, but ${detected}. Update the configured Codex app-server binary, or remove custom command overrides to use the managed binary.`);
1938
1982
  this.name = "CodexAppServerVersionError";
1939
1983
  this.detectedVersion = detectedVersion;
1940
1984
  }
1941
1985
  };
1942
1986
  function assertSupportedCodexAppServerVersion(response) {
1943
1987
  const detectedVersion = readCodexVersionFromUserAgent(response.userAgent);
1944
- const parsedVersion = parse(detectedVersion ?? "");
1945
- if (!detectedVersion || !parsedVersion || parsedVersion.compare("0.143.0") < 0 || parsedVersion.compare("0.145.0") > 0 || parsedVersion.prerelease.length > 0 || parsedVersion.build.length > 0) throw new CodexAppServerVersionError(detectedVersion);
1988
+ if (detectedVersion !== "0.146.0") throw new CodexAppServerVersionError(detectedVersion);
1946
1989
  return detectedVersion;
1947
1990
  }
1948
1991
  function isUnsupportedCodexAppServerVersionError(error) {
@@ -2309,10 +2352,12 @@ var shared_client_exports = /* @__PURE__ */ __exportAll({
2309
2352
  releaseLeasedSharedCodexAppServerClient: () => releaseLeasedSharedCodexAppServerClient,
2310
2353
  resolveCodexAppServerSpawnIdentity: () => resolveCodexAppServerSpawnIdentity,
2311
2354
  resolveCodexNativeConfigFenceKey: () => resolveCodexNativeConfigFenceKey,
2355
+ retainSharedCodexAppServerClientByInstanceId: () => retainSharedCodexAppServerClientByInstanceId,
2312
2356
  retainSharedCodexAppServerClientIfCurrent: () => retainSharedCodexAppServerClientIfCurrent,
2313
2357
  retireSharedCodexAppServerClientIfCurrent: () => retireSharedCodexAppServerClientIfCurrent,
2314
2358
  withLeasedCodexAppServerClientStartSelectionRetry: () => withLeasedCodexAppServerClientStartSelectionRetry
2315
2359
  });
2360
+ const CODEX_APP_SERVER_INITIALIZE_TIMEOUT_MESSAGE = "codex app-server initialize timed out";
2316
2361
  const suspectClosedClients = /* @__PURE__ */ new WeakSet();
2317
2362
  const SHARED_CODEX_APP_SERVER_CLIENT_STATE = Symbol.for("openclaw.codexAppServerClientState");
2318
2363
  const SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER = Symbol.for("openclaw.codexAppServerClientDisposer");
@@ -2444,6 +2489,44 @@ async function resolveCodexAppServerClientStartContext(options) {
2444
2489
  })
2445
2490
  };
2446
2491
  }
2492
+ function resolveWarmSharedCodexAppServerClientIdentity(options) {
2493
+ if (!options?.config || typeof options.config !== "object" || !options.startOptions || options.pluginConfig !== void 0 || options.authProfileStore !== void 0 || options.preparedAuth !== void 0 || options.runtimeArtifactMode !== void 0 || options.expectedRuntimeArtifact !== void 0) return;
2494
+ const authProfileSelector = options.authProfileId === null ? ["native"] : options.authProfileId === void 0 ? ["implicit"] : ["profile", options.authProfileId];
2495
+ return {
2496
+ config: options.config,
2497
+ startOptions: options.startOptions,
2498
+ selectorKey: JSON.stringify([
2499
+ options.agentDir ?? resolveDefaultAgentDir(options.config),
2500
+ authProfileSelector,
2501
+ options.authBindingFingerprint ?? null,
2502
+ options.authRequirement ?? null
2503
+ ])
2504
+ };
2505
+ }
2506
+ function readWarmSharedCodexAppServerClient(state, identity) {
2507
+ const aliases = state.warmClientsByConfig?.get(identity.config)?.get(identity.startOptions);
2508
+ const warm = aliases?.get(identity.selectorKey);
2509
+ if (!warm) return;
2510
+ if (state.clients.get(warm.key) !== warm.entry || warm.entry.client !== warm.client || warm.entry.closeWhenIdle || warm.entry.closeError) {
2511
+ aliases?.delete(identity.selectorKey);
2512
+ return;
2513
+ }
2514
+ return warm;
2515
+ }
2516
+ function rememberWarmSharedCodexAppServerClient(state, identity, warm) {
2517
+ state.warmClientsByConfig ??= /* @__PURE__ */ new WeakMap();
2518
+ let byStartOptions = state.warmClientsByConfig.get(identity.config);
2519
+ if (!byStartOptions) {
2520
+ byStartOptions = /* @__PURE__ */ new WeakMap();
2521
+ state.warmClientsByConfig.set(identity.config, byStartOptions);
2522
+ }
2523
+ let aliases = byStartOptions.get(identity.startOptions);
2524
+ if (!aliases) {
2525
+ aliases = /* @__PURE__ */ new Map();
2526
+ byStartOptions.set(identity.startOptions, aliases);
2527
+ }
2528
+ aliases.set(identity.selectorKey, warm);
2529
+ }
2447
2530
  /** Gets or starts a shared Codex app-server client without retaining a lease. */
2448
2531
  async function getSharedCodexAppServerClient(options) {
2449
2532
  return (await acquireSharedCodexAppServerClient(options)).client;
@@ -2513,6 +2596,17 @@ async function withLeasedCodexAppServerClientStartSelectionRetry(params) {
2513
2596
  }
2514
2597
  async function acquireSharedCodexAppServerClient(options, leaseOptions) {
2515
2598
  if (options?.abandonSignal?.aborted) throw new CodexAppServerStartupError("aborted", "codex app-server initialize aborted");
2599
+ const state = getSharedCodexAppServerClientState();
2600
+ const warmIdentity = resolveWarmSharedCodexAppServerClientIdentity(options);
2601
+ const warmClient = warmIdentity ? readWarmSharedCodexAppServerClient(state, warmIdentity) : void 0;
2602
+ if (warmClient) {
2603
+ options?.onStartedClient?.(warmClient.client);
2604
+ const release = leaseOptions?.leased ? retainSharedClientEntry(warmClient.entry) : void 0;
2605
+ return release ? {
2606
+ client: warmClient.client,
2607
+ release
2608
+ } : { client: warmClient.client };
2609
+ }
2516
2610
  const acquireStartedAt = Date.now();
2517
2611
  const timeoutMs = options?.timeoutMs ?? 0;
2518
2612
  const { agentDir, usesNativeAuth, authProfileId, authProfileStore, preparedAuth, authRequirement, requestedStartOptions, startOptions } = await withCodexAppServerAcquireDeadline(timeoutMs, resolveCodexAppServerClientStartContext(options), options?.abandonSignal);
@@ -2527,7 +2621,7 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
2527
2621
  const runtimeArtifactMode = options?.runtimeArtifactMode ?? (options?.expectedRuntimeArtifact ? "capture" : void 0);
2528
2622
  const expectedRuntimeArtifactKey = options?.expectedRuntimeArtifact ? createHash("sha256").update(options.expectedRuntimeArtifact.id).update("\0").update(options.expectedRuntimeArtifact.fingerprint).digest("hex") : "mint";
2529
2623
  const key = runtimeArtifactMode ? `${baseKey}\0runtime-artifact:capture-v1:${expectedRuntimeArtifactKey}` : baseKey;
2530
- const entry = getOrCreateSharedClientEntry(getSharedCodexAppServerClientState(), key);
2624
+ const entry = getOrCreateSharedClientEntry(state, key);
2531
2625
  if (runtimeArtifactMode) entry.runtimeArtifactStartupAbort ??= new AbortController();
2532
2626
  entry.closeWhenIdle = false;
2533
2627
  const releasePendingAcquire = retainPendingSharedClientAcquire(entry);
@@ -2566,7 +2660,7 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
2566
2660
  config: options?.config
2567
2661
  }));
2568
2662
  try {
2569
- await withCodexAppServerAcquireDeadline(remainingTimeoutMs, startup.initialized, options?.abandonSignal);
2663
+ await withCodexAppServerAcquireDeadline(remainingTimeoutMs, startup.initialized, options?.abandonSignal, CODEX_APP_SERVER_INITIALIZE_TIMEOUT_MESSAGE, () => buildCodexAppServerInitializeTimeoutError(entry.client));
2570
2664
  const client = await withCodexAppServerAcquireDeadline(timeoutMs, startup.ready, options?.abandonSignal, "codex app-server authentication timed out");
2571
2665
  if (entry.closeError) throw entry.closeError;
2572
2666
  ensureCodexAppServerClientRuntime(client, {
@@ -2577,6 +2671,11 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
2577
2671
  config: options?.config
2578
2672
  });
2579
2673
  const release = leaseOptions?.leased ? retainSharedClientEntry(entry) : void 0;
2674
+ if (warmIdentity) rememberWarmSharedCodexAppServerClient(state, warmIdentity, {
2675
+ key,
2676
+ entry,
2677
+ client
2678
+ });
2580
2679
  return release ? {
2581
2680
  client,
2582
2681
  release
@@ -2591,9 +2690,9 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
2591
2690
  releasePendingAcquire();
2592
2691
  }
2593
2692
  }
2594
- async function withCodexAppServerAcquireDeadline(timeoutMs, promise, signal, timeoutMessage = "codex app-server initialize timed out") {
2693
+ async function withCodexAppServerAcquireDeadline(timeoutMs, promise, signal, timeoutMessage = CODEX_APP_SERVER_INITIALIZE_TIMEOUT_MESSAGE, timeoutErrorFactory) {
2595
2694
  if (signal?.aborted) throw new CodexAppServerStartupError("aborted", "codex app-server initialize aborted");
2596
- const timed = withTimeout$1(promise, timeoutMs, timeoutMessage, () => new CodexAppServerStartupError("timed_out", timeoutMessage));
2695
+ const timed = withTimeout$1(promise, timeoutMs, timeoutMessage, () => timeoutErrorFactory?.() ?? new CodexAppServerStartupError("timed_out", timeoutMessage));
2597
2696
  if (!signal) return await timed;
2598
2697
  return await new Promise((resolve, reject) => {
2599
2698
  const onAbort = () => reject(new CodexAppServerStartupError("aborted", "codex app-server initialize aborted"));
@@ -2601,6 +2700,10 @@ async function withCodexAppServerAcquireDeadline(timeoutMs, promise, signal, tim
2601
2700
  timed.then(resolve, reject).finally(() => signal.removeEventListener("abort", onAbort));
2602
2701
  });
2603
2702
  }
2703
+ function buildCodexAppServerInitializeTimeoutError(client) {
2704
+ const stderr = client?.getStderrDiagnostic();
2705
+ return new CodexAppServerStartupError("timed_out", stderr ? `${CODEX_APP_SERVER_INITIALIZE_TIMEOUT_MESSAGE}; stderr=${JSON.stringify(stderr)}` : CODEX_APP_SERVER_INITIALIZE_TIMEOUT_MESSAGE);
2706
+ }
2604
2707
  function resolveRemainingAcquireTimeout(timeoutMs, startedAt) {
2605
2708
  if (!(timeoutMs > 0)) return timeoutMs;
2606
2709
  const remaining = timeoutMs - (Date.now() - startedAt);
@@ -2669,7 +2772,7 @@ async function startInitializedCodexAppServerClient(params) {
2669
2772
  const timeoutMs = params.timeoutMs ?? 0;
2670
2773
  const startOptionsCandidates = resolveManagedFallbackStartOptions(params.startOptions);
2671
2774
  for (const [index, startOptions] of startOptionsCandidates.entries()) {
2672
- const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-C2ITXdhM.js") : void 0;
2775
+ const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-CmtG_t1L.js") : void 0;
2673
2776
  const nativeCommandBeforeStart = startOptions.commandSource === "resolved-managed" ? resolveManagedCodexNativeCommand(startOptions.command) : void 0;
2674
2777
  const runtimeArtifactBeforeStart = runtimeArtifactModule ? await runtimeArtifactModule.captureCodexAppServerRuntimeArtifactBeforeStart({
2675
2778
  startOptions,
@@ -2684,7 +2787,7 @@ async function startInitializedCodexAppServerClient(params) {
2684
2787
  params.onStartedClient?.(client);
2685
2788
  let initialize;
2686
2789
  try {
2687
- await withCodexAppServerAcquireDeadline(resolveRemainingAcquireTimeout(timeoutMs, acquireStartedAt), initialize = client.initialize(), params.abandonSignal);
2790
+ await withCodexAppServerAcquireDeadline(resolveRemainingAcquireTimeout(timeoutMs, acquireStartedAt), initialize = client.initialize(), params.abandonSignal, CODEX_APP_SERVER_INITIALIZE_TIMEOUT_MESSAGE, () => buildCodexAppServerInitializeTimeoutError(client));
2688
2791
  } catch (error) {
2689
2792
  client.close();
2690
2793
  initialize?.catch(() => void 0);
@@ -2789,6 +2892,19 @@ function retainSharedCodexAppServerClientIfCurrent(client) {
2789
2892
  const state = getSharedCodexAppServerClientState();
2790
2893
  for (const entry of state.clients.values()) if (entry.client === client) return retainSharedClientEntry(entry);
2791
2894
  }
2895
+ /** Retains the live shared client whose initialized instance id matches a thread binding. */
2896
+ function retainSharedCodexAppServerClientByInstanceId(clientId) {
2897
+ const normalizedClientId = clientId?.trim();
2898
+ if (!normalizedClientId) return;
2899
+ for (const entry of getSharedCodexAppServerClientState().clients.values()) {
2900
+ const client = entry.client;
2901
+ if (client?.getInstanceId() !== normalizedClientId || entry.closeWhenIdle || entry.closeError) continue;
2902
+ return {
2903
+ client,
2904
+ release: retainSharedClientEntry(entry)
2905
+ };
2906
+ }
2907
+ }
2792
2908
  /**
2793
2909
  * Retires a matching shared client. Default is graceful: detach from the map
2794
2910
  * (future acquisitions get a fresh client) and close once leases drain.
@@ -2851,6 +2967,7 @@ async function clearSharedCodexAppServerClientAndWait(options) {
2851
2967
  const state = getSharedCodexAppServerClientState();
2852
2968
  const clients = collectSharedClients(state);
2853
2969
  state.clients.clear();
2970
+ state.warmClientsByConfig = /* @__PURE__ */ new WeakMap();
2854
2971
  await Promise.all(clients.map((client) => client.closeAndWait(options)));
2855
2972
  }
2856
2973
  globalThis[SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER] = clearSharedCodexAppServerClientAndWait;
@@ -2949,4 +3066,4 @@ function collectSharedClients(state) {
2949
3066
  return [...new Set([...state.clients.values()].map((entry) => entry.client).filter((client) => Boolean(client)))];
2950
3067
  }
2951
3068
  //#endregion
2952
- export { withCodexStartupTimeout as $, rememberCodexRateLimitsRead as A, flattenCodexDynamicToolFunctions as B, isCodexAppServerIndeterminateTransportError as C, ensureCodexAppServerClientRuntime as D, resolveCodexAppServerClientInstanceId as E, resolveCodexAppServerPreparedApiKeyCacheKey as F, CodexAppServerStartupError as G, resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath as H, resolveCodexAppServerPreparedAuthHandoff as I, resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs as J, isCodexAppServerStartupError as K, CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES as L, resolveCodexAppServerAuthProfileId as M, resolveCodexAppServerAuthProfileIdForAgent as N, readCodexRateLimitsRevision as O, resolveCodexAppServerFallbackApiKeyCacheKey as P, resolveCodexTurnTerminalIdleTimeoutMs as Q, CODEX_INTERACTIVE_THREAD_SOURCE_KINDS as R, isCodexAppServerIndeterminateRequestCancellationError as S, isCodexAppServerRequestTimeoutError as T, resolveCodexAppServerHomeDir as U, isJsonObject$1 as V, CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS as W, resolveCodexTurnAssistantCompletionIdleTimeoutMs as X, resolveCodexStartupTimeoutMs as Y, resolveCodexTurnCompletionIdleTimeoutMs as Z, CodexAppServerRpcError as _, getLeasedSharedCodexAppServerClient as a, isCodexAppServerBrokenPipeError as b, releaseCodexAppServerClientLease as c, retainSharedCodexAppServerClientIfCurrent as d, retireSharedCodexAppServerClientIfCurrent as f, acquireCodexNativeConfigFence as g, withTimeout$1 as h, createIsolatedCodexAppServerClient as i, resolveCodexAppServerAuthAccountCacheKey as j, readRecentCodexRateLimits as k, releaseLeasedSharedCodexAppServerClient as l, withLeasedCodexAppServerClientStartSelectionRetry as m, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as n, getSharedCodexAppServerClient as o, shared_client_exports as p, resolveCodexGatewayTimeoutWithGraceMs as q, clearSharedCodexAppServerClientIfCurrentAndWait as r, isCodexAppServerStartSelectionChangedError as s, clearSharedCodexAppServerClientIfCurrent as t, resolveCodexNativeConfigFenceKey as u, getCodexAppServerClientInstanceId as v, isCodexAppServerPrewriteRequestCancellationError as w, isCodexAppServerConnectionClosedError as x, isCodexAppServerApprovalRequest as y, CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE as z };
3069
+ export { resolveCodexTurnAssistantCompletionIdleTimeoutMs as $, retainCodexAppServerLiveThread as A, CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES as B, isCodexAppServerIndeterminateRequestCancellationError as C, resolveCodexAppServerClientInstanceId as D, isCodexAppServerRequestTimeoutError as E, resolveCodexAppServerAuthProfileId as F, resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath as G, CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE as H, resolveCodexAppServerAuthProfileIdForAgent as I, CodexAppServerStartupError as J, resolveCodexAppServerHomeDir as K, resolveCodexAppServerFallbackApiKeyCacheKey as L, readRecentCodexRateLimits as M, rememberCodexRateLimitsRead as N, consumeCodexAppServerLiveThread as O, resolveCodexAppServerAuthAccountCacheKey as P, resolveCodexStartupTimeoutMs as Q, resolveCodexAppServerPreparedApiKeyCacheKey as R, isCodexAppServerConnectionClosedError as S, isCodexAppServerPrewriteRequestCancellationError as T, flattenCodexDynamicToolFunctions as U, CODEX_INTERACTIVE_THREAD_SOURCE_KINDS as V, isJsonObject$1 as W, resolveCodexGatewayTimeoutWithGraceMs as X, isCodexAppServerStartupError as Y, resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs as Z, acquireCodexNativeConfigFence as _, getLeasedSharedCodexAppServerClient as a, isCodexAppServerApprovalRequest as b, releaseCodexAppServerClientLease as c, retainSharedCodexAppServerClientByInstanceId as d, resolveCodexTurnCompletionIdleTimeoutMs as et, retainSharedCodexAppServerClientIfCurrent as f, withTimeout$1 as g, withLeasedCodexAppServerClientStartSelectionRetry as h, createIsolatedCodexAppServerClient as i, readCodexRateLimitsRevision as j, ensureCodexAppServerClientRuntime as k, releaseLeasedSharedCodexAppServerClient as l, shared_client_exports as m, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as n, withCodexStartupTimeout as nt, getSharedCodexAppServerClient as o, retireSharedCodexAppServerClientIfCurrent as p, CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS as q, clearSharedCodexAppServerClientIfCurrentAndWait as r, isCodexAppServerStartSelectionChangedError as s, clearSharedCodexAppServerClientIfCurrent as t, resolveCodexTurnTerminalIdleTimeoutMs as tt, resolveCodexNativeConfigFenceKey as u, CodexAppServerRpcError as v, isCodexAppServerIndeterminateTransportError as w, isCodexAppServerBrokenPipeError as x, getCodexAppServerClientInstanceId as y, resolveCodexAppServerPreparedAuthHandoff as z };
@@ -1,12 +1,12 @@
1
- import { D as ensureCodexAppServerClientRuntime, I as resolveCodexAppServerPreparedAuthHandoff, V as isJsonObject, a as getLeasedSharedCodexAppServerClient, c as releaseCodexAppServerClientLease, k as readRecentCodexRateLimits, m as withLeasedCodexAppServerClientStartSelectionRetry, y as isCodexAppServerApprovalRequest } from "./shared-client-BVKE40c-.js";
2
- import { D as resolveOpenClawExecPolicyForCodexAppServer, S as resolveCodexModelBackedReviewerPolicyContext, T as readCodexPluginConfig, b as canUseCodexModelBackedApprovalsReviewerForModel, l as sessionBindingIdentity, v as shouldAutoApproveCodexAppServerApprovals } from "./session-binding-DlVQ-Pxs.js";
3
- import { A as resolveCodexDynamicToolsLoading, C as readCodexSupportedReasoningEfforts, G as mergeCodexThreadConfigs, S as resolveReasoningEffort, T as filterCodexDynamicTools, V as buildCodexPluginAppsConfigPatchFromPolicyContext, _ as CODEX_NATIVE_PERSONALITY_NONE, f as buildCodexRuntimeThreadConfig, h as resolveCodexWebSearchPlan, v as resolveCodexAppServerModelProvider, x as resolveCodexBindingModelProviderFallback, y as resolveCodexAppServerRequestModelSelection } from "./thread-lifecycle-DRg_FdzC.js";
4
- import { a as assertCodexTurnStartResponse, l as readCodexTurn, n as assertCodexThreadForkResponse, o as readCodexDynamicToolCallParams } from "./protocol-validators-Dm4eXZmt.js";
5
- import { n as formatCodexUsageLimitErrorMessage } from "./rate-limits-S_PXs0ul.js";
6
- import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-BmDgseo_.js";
7
- import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-D1Wky__S.js";
8
- import { a as resolveCodexBindingAppServerConnection, i as requireCodexSupervisionModelSelection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-Bj_Ak_jI.js";
9
- import { C as CodexNativeToolLifecycleProjector, D as buildCodexNativeHookRelayDisabledConfig, E as buildCodexNativeHookRelayConfig, L as resolveDynamicToolCallTimeoutMs, N as handleDynamicToolCallWithTimeout, S as filterToolsForVisionInputs, U as resolveCodexToolAbortTerminalReason, _ as resolveCodexMessageToolProvider, a as emitDynamicToolStartedDiagnostic, c as resolveCodexProviderWebSearchSupportForClient, i as emitDynamicToolErrorDiagnostic, k as emitCodexNativePreToolUseFailureDiagnostic, n as handleCodexAppServerApprovalRequest, o as emitDynamicToolTerminalDiagnostic, r as handleCodexAppServerElicitationRequest, t as createCodexDynamicToolBridge, w as CODEX_NATIVE_HOOK_RELAY_EVENTS, y as shouldEnableCodexAppServerNativeToolSurface } from "./dynamic-tools-LIt9ojep.js";
1
+ import { M as readRecentCodexRateLimits, W as isJsonObject, a as getLeasedSharedCodexAppServerClient, b as isCodexAppServerApprovalRequest, c as releaseCodexAppServerClientLease, h as withLeasedCodexAppServerClientStartSelectionRetry, k as ensureCodexAppServerClientRuntime, z as resolveCodexAppServerPreparedAuthHandoff } from "./shared-client-DTbvH-XV.js";
2
+ import { A as resolveOpenClawExecPolicyForCodexAppServer, C as canUseCodexModelBackedApprovalsReviewerForModel, O as readCodexPluginConfig, T as resolveCodexModelBackedReviewerPolicyContext, d as sessionBindingIdentity, h as resolveCodexAppServerHomeScope, x as shouldAutoApproveCodexAppServerApprovals } from "./session-binding-BXpo9ymA.js";
3
+ import { A as resolveCodexDynamicToolsLoading, C as resolveReasoningEffort, G as mergeCodexThreadConfigs, S as resolveCodexBindingModelProviderFallback, T as filterCodexDynamicTools, V as buildCodexPluginAppsConfigPatchFromPolicyContext, b as resolveCodexAppServerRequestModelSelection, g as resolveCodexWebSearchPlan, p as buildCodexRuntimeThreadConfig, v as CODEX_NATIVE_PERSONALITY_NONE, w as readCodexSupportedReasoningEfforts, y as resolveCodexAppServerModelProvider } from "./thread-lifecycle-DF53ogiA.js";
4
+ import { S as readCodexTurn, h as assertCodexThreadForkResponse, v as assertCodexTurnStartResponse, y as readCodexDynamicToolCallParams } from "./transcript-mirror-DzsdNCf5.js";
5
+ import { n as formatCodexUsageLimitErrorMessage } from "./rate-limits-CU-gVCCS.js";
6
+ import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-BSaO2JIT.js";
7
+ import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-NuhpXmPB.js";
8
+ import { a as resolveCodexBindingAppServerConnection, i as requireCodexSupervisionModelSelection, n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-CU6_AnOb.js";
9
+ import { C as filterToolsForVisionInputs, E as CODEX_NATIVE_HOOK_RELAY_EVENTS, F as handleDynamicToolCallWithTimeout, G as resolveCodexToolAbortTerminalReason, O as buildCodexNativeHookRelayConfig, T as CodexNativeToolLifecycleProjector, a as emitDynamicToolStartedDiagnostic, b as shouldEnableCodexAppServerNativeToolSurface, c as resolveCodexProviderWebSearchSupportForClient, i as emitDynamicToolErrorDiagnostic, j as emitCodexNativePreToolUseFailureDiagnostic, k as buildCodexNativeHookRelayDisabledConfig, n as handleCodexAppServerApprovalRequest, o as emitDynamicToolTerminalDiagnostic, r as handleCodexAppServerElicitationRequest, t as createCodexDynamicToolBridge, v as resolveCodexMessageToolProvider, z as resolveDynamicToolCallTimeoutMs } from "./dynamic-tools-D2gYkSBO.js";
10
10
  import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
11
11
  import { randomUUID } from "node:crypto";
12
12
  import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
@@ -78,7 +78,7 @@ async function runCodexAppServerSideQuestion(params, options) {
78
78
  authProfileId: preparedRuntimeAuth.plan.forwardedAuthProfileId,
79
79
  authProfileStore: preparedRuntimeAuth.authProfileStore,
80
80
  agentDir: params.agentDir,
81
- ...pluginConfig.appServer?.homeScope ? { homeScope: pluginConfig.appServer.homeScope } : {},
81
+ homeScope: resolveCodexAppServerHomeScope({ appServer: pluginConfig.appServer }),
82
82
  config: params.cfg,
83
83
  subscriptionProfileRequiredError: "Prepared Codex subscription route requires a scoped native OAuth or token profile.",
84
84
  subscriptionProfileUnusableError: `Prepared Codex auth profile "${preparedRuntimeAuth.plan.forwardedAuthProfileId}" is unusable.`