@openclaw/codex 2026.6.5-beta.6 → 2026.6.6-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/{client-kMCtlApt.js → client-DovmVtbr.js} +3 -10
  2. package/dist/{client-factory-Bt49r45B.js → client-factory-XajDuvQ1.js} +1 -1
  3. package/dist/{command-handlers-DMn2M7W7.js → command-handlers-DIUFKqaF.js} +11 -9
  4. package/dist/{compact-CwnPeYnM.js → compact-BWiNkDSs.js} +96 -9
  5. package/dist/{computer-use-ClweWaMz.js → computer-use-D3pi5csE.js} +3 -2
  6. package/dist/{config-BT6SLiE6.js → config-DJXpBkGf.js} +214 -13
  7. package/dist/{conversation-binding-CzpvaBs1.js → conversation-binding-CMwrZrt7.js} +190 -65
  8. package/dist/harness.js +12 -5
  9. package/dist/index.js +11 -10
  10. package/dist/media-understanding-provider.js +6 -6
  11. package/dist/{models-DXorTaja.js → models-CQGfP7nG.js} +2 -2
  12. package/dist/{native-hook-relay-DHwz_ICg.js → native-hook-relay-CmUUO3Eu.js} +160 -4
  13. package/dist/notification-correlation-D-MYfJwV.js +382 -0
  14. package/dist/{request-D64BfplD.js → plugin-app-cache-key-NpzxEcSR.js} +4 -36
  15. package/dist/protocol-oeJQu4rs.js +9 -0
  16. package/dist/{protocol-validators-CIpP8IJ2.js → protocol-validators-B48C6S9O.js} +2296 -2273
  17. package/dist/provider-Cs6kWhDQ.js +584 -0
  18. package/dist/provider.js +1 -164
  19. package/dist/request-Dq0LUOqZ.js +36 -0
  20. package/dist/{run-attempt-BWdNnok4.js → run-attempt-DG9p9ReO.js} +374 -65
  21. package/dist/{session-binding-BgTv_YGm.js → session-binding-ElbcSq2o.js} +107 -44
  22. package/dist/{shared-client-xytpSKD0.js → shared-client-CflavQ_i.js} +3 -3
  23. package/dist/{side-question-BnvBQPqW.js → side-question-Ctu2VXAG.js} +82 -26
  24. package/dist/{thread-lifecycle-BJsazZ8j.js → thread-lifecycle-Cq1-IfZB.js} +115 -34
  25. package/npm-shrinkwrap.json +30 -30
  26. package/package.json +5 -5
  27. package/dist/notification-correlation-o8quHmTK.js +0 -656
@@ -1,24 +1,24 @@
1
- import { a as isCodexFastServiceTier, f as resolveOpenClawExecPolicyForCodexAppServer, l as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-BT6SLiE6.js";
2
- import { l as isJsonObject } from "./client-kMCtlApt.js";
3
- import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-BJsazZ8j.js";
4
- import { a as readCodexAppServerBinding, i as normalizeCodexAppServerBindingModelProvider, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BgTv_YGm.js";
5
- import { r as CODEX_CONTROL_METHODS } from "./request-D64BfplD.js";
6
- import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-o8quHmTK.js";
7
- import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-xytpSKD0.js";
1
+ import { d as resolveCodexAppServerRuntimeOptions, h as resolveOpenClawExecPolicyForCodexAppServer, i as codexSandboxPolicyForTurn, n as canUseCodexModelBackedApprovalsReviewerForModel, o as isCodexFastServiceTier, p as resolveCodexModelBackedReviewerPolicyContext } from "./config-DJXpBkGf.js";
2
+ import { t as isJsonObject } from "./protocol-oeJQu4rs.js";
3
+ import { d as resolveCodexAppServerRequestModelSelection, f as resolveCodexBindingModelProviderFallback, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-Cq1-IfZB.js";
4
+ import { a as normalizeCodexAppServerBindingModelProvider, i as isCodexAppServerNativeAuthProfile, l as writeCodexAppServerBinding, n as clearCodexAppServerBinding, o as readCodexAppServerBinding } from "./session-binding-ElbcSq2o.js";
5
+ import { n as CODEX_CONTROL_METHODS } from "./plugin-app-cache-key-NpzxEcSR.js";
6
+ import { a as resolveCodexAppServerForModelProvider, i as readCodexNotificationTurnId, l as formatCodexDisplayText, r as readCodexNotificationThreadId } from "./notification-correlation-D-MYfJwV.js";
7
+ import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-CflavQ_i.js";
8
8
  import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-C-Yv9uwY.js";
9
9
  import { resolveTimerTimeoutMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
10
10
  import os from "node:os";
11
+ import path from "node:path";
12
+ import { resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
11
13
  import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
12
14
  import { asOptionalRecord, isRecord, normalizeSingleOrTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
13
15
  import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
14
16
  import { formatErrorMessage, resolveSandboxContext } from "openclaw/plugin-sdk/agent-harness-runtime";
15
17
  import { spawn } from "node:child_process";
16
18
  import fs from "node:fs/promises";
17
- import path from "node:path";
18
- import { resolveSessionAgentIds as resolveSessionAgentIds$1 } from "openclaw/plugin-sdk/agent-runtime";
19
19
  import { loadSessionStore, resolveSessionStoreEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
20
20
  import { fileURLToPath } from "node:url";
21
- import process from "node:process";
21
+ import process$1 from "node:process";
22
22
  import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
23
23
  //#region extensions/codex/src/conversation-binding-data.ts
24
24
  const BINDING_DATA_VERSION = 1;
@@ -64,12 +64,12 @@ function readCodexConversationBindingDataRecord(data) {
64
64
  kind: "codex-app-server-session",
65
65
  version: BINDING_DATA_VERSION,
66
66
  sessionFile: data.sessionFile,
67
- workspaceDir: typeof data.workspaceDir === "string" && data.workspaceDir.trim() ? data.workspaceDir : process.cwd(),
67
+ workspaceDir: typeof data.workspaceDir === "string" && data.workspaceDir.trim() ? data.workspaceDir : process$1.cwd(),
68
68
  agentDir: typeof data.agentDir === "string" && data.agentDir.trim() ? data.agentDir : void 0
69
69
  };
70
70
  }
71
71
  function resolveCodexDefaultWorkspaceDir(pluginConfig) {
72
- return readString$1(asOptionalRecord(asOptionalRecord(pluginConfig)?.appServer), "defaultWorkspaceDir") ?? process.cwd();
72
+ return readString$1(asOptionalRecord(asOptionalRecord(pluginConfig)?.appServer), "defaultWorkspaceDir") ?? process$1.cwd();
73
73
  }
74
74
  function readString$1(record, key) {
75
75
  const value = record?.[key];
@@ -164,19 +164,48 @@ async function setCodexConversationModel(params) {
164
164
  if (!model) return "Usage: /codex model <model>";
165
165
  const lookup = buildBindingLookup(params);
166
166
  const binding = await requireThreadBinding(params.sessionFile, lookup);
167
- const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
168
- const response = await resumeThreadWithOverrides({
167
+ const reviewerPolicyContext = resolveCodexModelBackedReviewerPolicyContext({
168
+ provider: "codex",
169
+ model,
170
+ bindingModelProvider: binding.modelProvider,
171
+ bindingModel: binding.model,
172
+ nativeAuthProfile: isCodexAppServerNativeAuthProfile({
173
+ authProfileId: binding.authProfileId,
174
+ ...lookup
175
+ })
176
+ });
177
+ const runtime = resolveCodexAppServerRuntimeOptions({
169
178
  pluginConfig: params.pluginConfig,
179
+ modelProvider: reviewerPolicyContext.modelProvider,
180
+ model: reviewerPolicyContext.model,
181
+ config: params.config,
182
+ agentDir: params.agentDir
183
+ });
184
+ const modelSelection = resolveCodexAppServerRequestModelSelection({
185
+ model,
186
+ modelProvider: resolveConversationControlModelProvider({
187
+ authProfileId: binding.authProfileId,
188
+ bindingModel: binding.model,
189
+ bindingModelProvider: binding.modelProvider,
190
+ currentModel: model,
191
+ ...lookup
192
+ }),
193
+ authProfileId: binding.authProfileId,
194
+ ...lookup
195
+ });
196
+ const response = await resumeThreadWithOverrides({
197
+ runtime,
170
198
  threadId: binding.threadId,
171
199
  authProfileId: binding.authProfileId,
172
200
  ...lookup,
173
- model
201
+ model: modelSelection.model,
202
+ modelProvider: modelSelection.modelProvider
174
203
  });
175
204
  await writeCodexAppServerBinding(params.sessionFile, {
176
205
  ...binding,
177
206
  cwd: response.thread.cwd ?? binding.cwd,
178
- model: response.model ?? model,
179
- modelProvider: response.modelProvider ?? binding.modelProvider,
207
+ model: response.model ?? modelSelection.model,
208
+ modelProvider: response.modelProvider ?? modelSelection.modelProvider,
180
209
  approvalPolicy: binding.approvalPolicy,
181
210
  sandbox: binding.sandbox,
182
211
  serviceTier: binding.serviceTier ?? runtime.serviceTier
@@ -227,7 +256,7 @@ async function requireThreadBinding(sessionFile, lookup = {}) {
227
256
  return binding;
228
257
  }
229
258
  async function resumeThreadWithOverrides(params) {
230
- const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.pluginConfig });
259
+ const runtime = params.runtime;
231
260
  const client = await getLeasedSharedCodexAppServerClient({
232
261
  startOptions: runtime.start,
233
262
  timeoutMs: runtime.requestTimeoutMs,
@@ -238,6 +267,7 @@ async function resumeThreadWithOverrides(params) {
238
267
  return await client.request(CODEX_CONTROL_METHODS.resumeThread, {
239
268
  threadId: params.threadId,
240
269
  ...params.model ? { model: params.model } : {},
270
+ ...params.modelProvider ? { modelProvider: params.modelProvider } : {},
241
271
  approvalPolicy: params.approvalPolicy ?? runtime.approvalPolicy,
242
272
  sandbox: params.sandbox ?? runtime.sandbox,
243
273
  approvalsReviewer: runtime.approvalsReviewer,
@@ -255,6 +285,16 @@ function buildBindingLookup(params) {
255
285
  ...params.config ? { config: params.config } : {}
256
286
  };
257
287
  }
288
+ function resolveConversationControlModelProvider(params) {
289
+ const modelProvider = resolveCodexBindingModelProviderFallback({
290
+ currentModel: params.currentModel,
291
+ bindingModel: params.bindingModel,
292
+ bindingModelProvider: params.bindingModelProvider
293
+ })?.trim();
294
+ if (!modelProvider || modelProvider.toLowerCase() === "codex") return;
295
+ if (isCodexAppServerNativeAuthProfile(params) && modelProvider.toLowerCase() === "openai") return;
296
+ return modelProvider.toLowerCase() === "openai" ? "openai" : modelProvider;
297
+ }
258
298
  function permissionsForMode(mode) {
259
299
  return mode === "yolo" ? {
260
300
  approvalPolicy: "never",
@@ -467,9 +507,9 @@ const DEFAULT_RESUME_TIMEOUT_MS = 20 * 6e4;
467
507
  const SESSION_ID_PATTERN = /^[A-Za-z0-9._:-]{1,128}$/;
468
508
  const activeResumeSessions = /* @__PURE__ */ new Set();
469
509
  const DEFAULT_RESUME_SPAWN_RUNTIME = {
470
- platform: process.platform,
471
- env: process.env,
472
- execPath: process.execPath
510
+ platform: process$1.platform,
511
+ env: process$1.env,
512
+ execPath: process$1.execPath
473
513
  };
474
514
  function createCodexCliSessionNodeHostCommands() {
475
515
  return [{
@@ -613,18 +653,18 @@ async function runCodexExecResume(params) {
613
653
  params.sessionId,
614
654
  "-"
615
655
  ], {
616
- platform: process.platform,
617
- env: process.env,
618
- execPath: process.execPath
656
+ platform: process$1.platform,
657
+ env: process$1.env,
658
+ execPath: process$1.execPath
619
659
  });
620
660
  const child = spawn(invocation.command, invocation.args, {
621
- cwd: params.cwd || process.cwd(),
661
+ cwd: params.cwd || process$1.cwd(),
622
662
  stdio: [
623
663
  "pipe",
624
664
  "pipe",
625
665
  "pipe"
626
666
  ],
627
- env: process.env,
667
+ env: process$1.env,
628
668
  shell: invocation.shell,
629
669
  windowsHide: invocation.windowsHide
630
670
  });
@@ -872,7 +912,7 @@ function readRecordParam(paramsJSON) {
872
912
  }
873
913
  }
874
914
  function resolveCodexHome() {
875
- return process.env.CODEX_HOME?.trim() || path.join(os.homedir(), ".codex");
915
+ return process$1.env.CODEX_HOME?.trim() || path.join(os.homedir(), ".codex");
876
916
  }
877
917
  async function readFileIfExists(file) {
878
918
  try {
@@ -929,18 +969,17 @@ async function resolveConversationAppServerRuntime(params) {
929
969
  sessionKey: params.sessionKey,
930
970
  workspaceDir: params.workspaceDir
931
971
  }) : void 0;
932
- const runtime = resolveCodexAppServerRuntimeOptions({
933
- pluginConfig: params.pluginConfig,
934
- execPolicy,
935
- openClawSandboxActive: Boolean(sandboxForPolicy?.enabled)
936
- });
937
- assertNativeConversationApprovalPolicySupported({
938
- execPolicy,
939
- runtime
940
- });
941
972
  return {
942
973
  execPolicy,
943
- runtime
974
+ runtime: resolveCodexAppServerRuntimeOptions({
975
+ pluginConfig: params.pluginConfig,
976
+ execPolicy,
977
+ modelProvider: params.modelProvider,
978
+ model: params.model,
979
+ config: params.config,
980
+ agentDir: params.agentDir,
981
+ openClawSandboxActive: Boolean(sandboxForPolicy?.enabled)
982
+ })
944
983
  };
945
984
  }
946
985
  const CODEX_CONVERSATION_GLOBAL_STATE = Symbol.for("openclaw.codex.conversationBinding");
@@ -1068,32 +1107,69 @@ async function handleCodexConversationBindingResolved(event) {
1068
1107
  await clearCodexAppServerBinding(data.sessionFile);
1069
1108
  }
1070
1109
  async function resolveThreadBindingRuntime(params) {
1110
+ const agentLookup = buildAgentLookup({
1111
+ agentDir: params.agentDir,
1112
+ config: params.config
1113
+ });
1114
+ const modelProvider = resolveThreadRequestModelProvider({
1115
+ authProfileId: params.authProfileId,
1116
+ modelProvider: params.modelProvider,
1117
+ ...agentLookup
1118
+ });
1119
+ const modelSelection = resolveOptionalThreadRequestModelSelection({
1120
+ model: params.model,
1121
+ modelProvider,
1122
+ authProfileId: params.authProfileId,
1123
+ ...agentLookup
1124
+ });
1125
+ const reviewerModelProvider = resolveModelBackedReviewerPolicyProvider({
1126
+ authProfileId: params.authProfileId,
1127
+ modelProvider: params.modelProvider,
1128
+ ...agentLookup
1129
+ });
1071
1130
  const { execPolicy, runtime } = await resolveConversationAppServerRuntime({
1072
1131
  pluginConfig: params.pluginConfig,
1073
1132
  config: params.config,
1074
1133
  agentId: params.agentId,
1075
1134
  sessionKey: params.sessionKey,
1076
- workspaceDir: params.workspaceDir
1135
+ workspaceDir: params.workspaceDir,
1136
+ modelProvider: reviewerModelProvider,
1137
+ model: params.model,
1138
+ agentDir: params.agentDir
1077
1139
  });
1078
- const agentLookup = buildAgentLookup({
1079
- agentDir: params.agentDir,
1080
- config: params.config
1140
+ const modelScopedRuntime = resolveCodexAppServerForModelProvider({
1141
+ appServer: runtime,
1142
+ provider: reviewerModelProvider,
1143
+ model: params.model,
1144
+ config: params.config,
1145
+ env: process.env,
1146
+ agentDir: params.agentDir
1147
+ });
1148
+ assertNativeConversationApprovalPolicySupported({
1149
+ execPolicy,
1150
+ approvalPolicy: execPolicy?.touched ? modelScopedRuntime.approvalPolicy : params.approvalPolicy ?? modelScopedRuntime.approvalPolicy,
1151
+ approvalsReviewer: modelScopedRuntime.approvalsReviewer,
1152
+ modelBackedApprovalsReviewerUnavailable: !canUseCodexModelBackedApprovalsReviewerForModel({
1153
+ modelProvider: reviewerModelProvider,
1154
+ model: params.model,
1155
+ config: params.config,
1156
+ env: process.env,
1157
+ agentDir: params.agentDir
1158
+ })
1159
+ });
1160
+ const client = await getLeasedSharedCodexAppServerClient({
1161
+ startOptions: runtime.start,
1162
+ timeoutMs: runtime.requestTimeoutMs,
1163
+ authProfileId: params.authProfileId,
1164
+ ...agentLookup
1081
1165
  });
1082
1166
  return {
1083
1167
  execPolicy,
1084
- runtime,
1168
+ runtime: modelScopedRuntime,
1085
1169
  agentLookup,
1086
- modelProvider: resolveThreadRequestModelProvider({
1087
- authProfileId: params.authProfileId,
1088
- modelProvider: params.modelProvider,
1089
- ...agentLookup
1090
- }),
1091
- client: await getLeasedSharedCodexAppServerClient({
1092
- startOptions: runtime.start,
1093
- timeoutMs: runtime.requestTimeoutMs,
1094
- authProfileId: params.authProfileId,
1095
- ...agentLookup
1096
- })
1170
+ model: modelSelection?.model,
1171
+ modelProvider: modelSelection?.modelProvider ?? modelProvider,
1172
+ client
1097
1173
  };
1098
1174
  }
1099
1175
  function buildThreadRequestRuntimeOptions(params, resolved) {
@@ -1111,10 +1187,10 @@ async function writeThreadBindingFromResponse(params, resolved, response) {
1111
1187
  threadId: response.thread.id,
1112
1188
  cwd: response.thread.cwd ?? params.workspaceDir,
1113
1189
  authProfileId: params.authProfileId,
1114
- model: response.model ?? params.model,
1190
+ model: response.model ?? resolved.model ?? params.model,
1115
1191
  modelProvider: normalizeCodexAppServerBindingModelProvider({
1116
1192
  authProfileId: params.authProfileId,
1117
- modelProvider: response.modelProvider ?? params.modelProvider,
1193
+ modelProvider: response.modelProvider ?? resolved.modelProvider ?? params.modelProvider,
1118
1194
  ...resolved.agentLookup
1119
1195
  }),
1120
1196
  approvalPolicy: resolved.execPolicy?.touched ? runtimeApprovalPolicy : params.approvalPolicy ?? runtimeApprovalPolicy,
@@ -1127,7 +1203,7 @@ async function attachExistingThread(params) {
1127
1203
  try {
1128
1204
  await writeThreadBindingFromResponse(params, resolved, await resolved.client.request(CODEX_CONTROL_METHODS.resumeThread, {
1129
1205
  threadId: params.threadId,
1130
- ...params.model ? { model: params.model } : {},
1206
+ ...resolved.model ? { model: resolved.model } : {},
1131
1207
  ...resolved.modelProvider ? { modelProvider: resolved.modelProvider } : {},
1132
1208
  personality: CODEX_NATIVE_PERSONALITY_NONE,
1133
1209
  ...buildThreadRequestRuntimeOptions(params, resolved),
@@ -1142,7 +1218,7 @@ async function createThread(params) {
1142
1218
  try {
1143
1219
  await writeThreadBindingFromResponse(params, resolved, await resolved.client.request("thread/start", {
1144
1220
  cwd: params.workspaceDir,
1145
- ...params.model ? { model: params.model } : {},
1221
+ ...resolved.model ? { model: resolved.model } : {},
1146
1222
  ...resolved.modelProvider ? { modelProvider: resolved.modelProvider } : {},
1147
1223
  personality: CODEX_NATIVE_PERSONALITY_NONE,
1148
1224
  ...buildThreadRequestRuntimeOptions(params, resolved),
@@ -1163,16 +1239,50 @@ async function runBoundTurn(params) {
1163
1239
  const threadId = binding?.threadId;
1164
1240
  if (!threadId) throw new Error("bound Codex conversation has no thread binding");
1165
1241
  const workspaceDir = binding.cwd || params.data.workspaceDir;
1242
+ const reviewerModelProvider = resolveModelBackedReviewerPolicyProvider({
1243
+ authProfileId: binding.authProfileId,
1244
+ modelProvider: binding.modelProvider,
1245
+ ...agentLookup
1246
+ });
1166
1247
  const { execPolicy, runtime } = await resolveConversationAppServerRuntime({
1167
1248
  pluginConfig: params.pluginConfig,
1168
1249
  config: params.config,
1169
1250
  sessionKey: params.sessionKey,
1170
- workspaceDir
1251
+ workspaceDir,
1252
+ modelProvider: reviewerModelProvider,
1253
+ model: binding.model,
1254
+ agentDir: params.data.agentDir
1255
+ });
1256
+ const modelScopedRuntime = resolveCodexAppServerForModelProvider({
1257
+ appServer: runtime,
1258
+ provider: reviewerModelProvider,
1259
+ model: binding.model,
1260
+ config: params.config,
1261
+ env: process.env,
1262
+ agentDir: params.data.agentDir
1171
1263
  });
1264
+ const modelBackedApprovalsReviewerUnavailable = !canUseCodexModelBackedApprovalsReviewerForModel({
1265
+ modelProvider: reviewerModelProvider,
1266
+ model: binding.model,
1267
+ config: params.config,
1268
+ env: process.env,
1269
+ agentDir: params.data.agentDir
1270
+ });
1271
+ const useModelScopedPolicy = execPolicy?.touched === true || modelBackedApprovalsReviewerUnavailable;
1272
+ const approvalPolicy = useModelScopedPolicy ? modelScopedRuntime.approvalPolicy : binding.approvalPolicy ?? modelScopedRuntime.approvalPolicy;
1273
+ const sandbox = useModelScopedPolicy ? modelScopedRuntime.sandbox : binding.sandbox ?? modelScopedRuntime.sandbox;
1172
1274
  assertNativeConversationApprovalPolicySupported({
1173
1275
  execPolicy,
1174
- runtime
1276
+ approvalPolicy,
1277
+ approvalsReviewer: modelScopedRuntime.approvalsReviewer,
1278
+ modelBackedApprovalsReviewerUnavailable
1175
1279
  });
1280
+ const modelSelection = binding.model ? resolveCodexAppServerRequestModelSelection({
1281
+ model: binding.model,
1282
+ modelProvider: binding.modelProvider,
1283
+ authProfileId: binding.authProfileId,
1284
+ ...agentLookup
1285
+ }) : void 0;
1176
1286
  const client = await getLeasedSharedCodexAppServerClient({
1177
1287
  startOptions: runtime.start,
1178
1288
  timeoutMs: runtime.requestTimeoutMs,
@@ -1210,10 +1320,10 @@ async function runBoundTurn(params) {
1210
1320
  event: params.event
1211
1321
  }),
1212
1322
  cwd: workspaceDir,
1213
- approvalPolicy: execPolicy?.touched ? runtime.approvalPolicy : binding.approvalPolicy ?? runtime.approvalPolicy,
1214
- approvalsReviewer: runtime.approvalsReviewer,
1215
- sandboxPolicy: codexSandboxPolicyForTurn(execPolicy?.touched ? runtime.sandbox : binding.sandbox ?? runtime.sandbox, workspaceDir),
1216
- ...binding.model ? { model: binding.model } : {},
1323
+ approvalPolicy,
1324
+ approvalsReviewer: modelScopedRuntime.approvalsReviewer,
1325
+ sandboxPolicy: codexSandboxPolicyForTurn(sandbox, workspaceDir),
1326
+ ...modelSelection?.model ? { model: modelSelection.model } : {},
1217
1327
  personality: CODEX_NATIVE_PERSONALITY_NONE,
1218
1328
  ...binding.serviceTier ?? runtime.serviceTier ? { serviceTier: binding.serviceTier ?? runtime.serviceTier } : {}
1219
1329
  }, { timeoutMs: runtime.requestTimeoutMs })).turn.id;
@@ -1231,7 +1341,7 @@ async function runBoundTurn(params) {
1231
1341
  }
1232
1342
  }
1233
1343
  function assertNativeConversationApprovalPolicySupported(params) {
1234
- if (params.execPolicy?.touched === true && params.runtime.approvalPolicy !== "never") throw new Error(NATIVE_CONVERSATION_INTERACTIVE_APPROVALS_UNAVAILABLE);
1344
+ if (params.approvalPolicy !== "never" && (params.execPolicy?.touched === true || params.modelBackedApprovalsReviewerUnavailable && params.approvalsReviewer === "user")) throw new Error(NATIVE_CONVERSATION_INTERACTIVE_APPROVALS_UNAVAILABLE);
1235
1345
  }
1236
1346
  async function runBoundTurnWithMissingThreadRecovery(params) {
1237
1347
  try {
@@ -1265,7 +1375,7 @@ async function runBoundTurnWithMissingThreadRecovery(params) {
1265
1375
  }
1266
1376
  }
1267
1377
  function resolveConversationExecPolicy(params) {
1268
- const agentId = params.agentId ?? (params.config ? resolveSessionAgentIds$1({
1378
+ const agentId = params.agentId ?? (params.config ? resolveSessionAgentIds({
1269
1379
  sessionKey: params.sessionKey,
1270
1380
  config: params.config
1271
1381
  }).sessionAgentId : void 0);
@@ -1313,6 +1423,21 @@ function resolveThreadRequestModelProvider(params) {
1313
1423
  if (isCodexAppServerNativeAuthProfile(params) && modelProvider.toLowerCase() === "openai") return;
1314
1424
  return modelProvider.toLowerCase() === "openai" ? "openai" : modelProvider;
1315
1425
  }
1426
+ function resolveOptionalThreadRequestModelSelection(params) {
1427
+ if (!params.model?.trim()) return;
1428
+ return resolveCodexAppServerRequestModelSelection({
1429
+ model: params.model,
1430
+ modelProvider: params.modelProvider,
1431
+ authProfileId: params.authProfileId,
1432
+ agentDir: params.agentDir,
1433
+ config: params.config
1434
+ });
1435
+ }
1436
+ function resolveModelBackedReviewerPolicyProvider(params) {
1437
+ const modelProvider = params.modelProvider?.trim();
1438
+ if (modelProvider && modelProvider.toLowerCase() !== "codex") return modelProvider.toLowerCase() === "openai" ? "openai" : modelProvider;
1439
+ return isCodexAppServerNativeAuthProfile(params) ? "openai" : void 0;
1440
+ }
1316
1441
  function buildAgentLookup(params) {
1317
1442
  const agentDir = params.agentDir?.trim();
1318
1443
  return {
package/dist/harness.js CHANGED
@@ -32,31 +32,38 @@ function createCodexAppServerAgentHarness(options) {
32
32
  };
33
33
  },
34
34
  runAttempt: async (params) => {
35
- const { runCodexAppServerAttempt } = await import("./run-attempt-BWdNnok4.js");
35
+ const { runCodexAppServerAttempt } = await import("./run-attempt-DG9p9ReO.js");
36
36
  return runCodexAppServerAttempt(params, {
37
37
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
38
38
  nativeHookRelay: { enabled: true }
39
39
  });
40
40
  },
41
41
  runSideQuestion: async (params) => {
42
- const { runCodexAppServerSideQuestion } = await import("./side-question-BnvBQPqW.js");
42
+ const { runCodexAppServerSideQuestion } = await import("./side-question-Ctu2VXAG.js");
43
43
  return runCodexAppServerSideQuestion(params, {
44
44
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
45
45
  nativeHookRelay: { enabled: true }
46
46
  });
47
47
  },
48
48
  compact: async (params) => {
49
- const { maybeCompactCodexAppServerSession } = await import("./compact-CwnPeYnM.js");
49
+ const { maybeCompactCodexAppServerSession } = await import("./compact-BWiNkDSs.js");
50
50
  return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
51
51
  },
52
+ compactAfterContextEngine: async (params) => {
53
+ const { maybeCompactCodexAppServerSession } = await import("./compact-BWiNkDSs.js");
54
+ return maybeCompactCodexAppServerSession(params, {
55
+ pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
56
+ allowNonManualNativeRequest: true
57
+ });
58
+ },
52
59
  reset: async (params) => {
53
60
  if (params.sessionFile) {
54
- const { clearCodexAppServerBinding } = await import("./session-binding-BgTv_YGm.js").then((n) => n.o);
61
+ const { clearCodexAppServerBinding } = await import("./session-binding-ElbcSq2o.js").then((n) => n.s);
55
62
  await clearCodexAppServerBinding(params.sessionFile);
56
63
  }
57
64
  },
58
65
  dispose: async () => {
59
- const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-xytpSKD0.js").then((n) => n.c);
66
+ const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-CflavQ_i.js").then((n) => n.c);
60
67
  await clearSharedCodexAppServerClientAndWait();
61
68
  }
62
69
  };
package/dist/index.js CHANGED
@@ -1,21 +1,22 @@
1
1
  import { createCodexAppServerAgentHarness } from "./harness.js";
2
- import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-BT6SLiE6.js";
3
- import { buildCodexProvider } from "./provider.js";
4
- import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-BJsazZ8j.js";
2
+ import { d as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME, u as readCodexPluginConfig } from "./config-DJXpBkGf.js";
3
+ import { t as buildCodexProvider } from "./provider-Cs6kWhDQ.js";
4
+ import { C as defaultCodexAppInventoryCache, b as ensureCodexPluginActivation, x as pluginReadParams } from "./thread-lifecycle-Cq1-IfZB.js";
5
5
  import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
6
- import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-D64BfplD.js";
7
- import { s as formatCodexDisplayText } from "./notification-correlation-o8quHmTK.js";
8
- import { a as getLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthAccountCacheKey, m as resolveCodexAppServerFallbackApiKeyCacheKey, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, r as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-xytpSKD0.js";
9
- import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-CzpvaBs1.js";
6
+ import { r as describeControlFailure, t as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-NpzxEcSR.js";
7
+ import { l as formatCodexDisplayText } from "./notification-correlation-D-MYfJwV.js";
8
+ import { a as getLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthAccountCacheKey, m as resolveCodexAppServerFallbackApiKeyCacheKey, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, r as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-CflavQ_i.js";
9
+ import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-CMwrZrt7.js";
10
+ import { t as requestCodexAppServerJson } from "./request-Dq0LUOqZ.js";
10
11
  import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
11
12
  import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
12
13
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
13
14
  import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
14
15
  import os from "node:os";
15
- import { asBoolean, isRecord, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
16
- import fs from "node:fs/promises";
17
16
  import path from "node:path";
18
17
  import { loadAuthProfileStoreWithoutExternalProfiles, resolveAgentConfig, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
18
+ import { asBoolean, isRecord, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
19
+ import fs from "node:fs/promises";
19
20
  import { pathExists } from "openclaw/plugin-sdk/security-runtime";
20
21
  import { MIGRATION_REASON_TARGET_EXISTS, applyMigrationManualItem, createMigrationItem, createMigrationManualItem, hasMigrationConfigPatchConflict, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, readMigrationConfigPath, summarizeMigrationItems, writeMigrationConfigPath } from "openclaw/plugin-sdk/migration";
21
22
  import { archiveMigrationItem, copyMigrationFileItem, withCachedMigrationConfigRuntime, writeMigrationReport } from "openclaw/plugin-sdk/migration-runtime";
@@ -50,7 +51,7 @@ async function handleCodexCommand(ctx, options = {}) {
50
51
  }
51
52
  }
52
53
  async function loadDefaultCodexSubcommandHandler() {
53
- const { handleCodexSubcommand } = await import("./command-handlers-DMn2M7W7.js");
54
+ const { handleCodexSubcommand } = await import("./command-handlers-DIUFKqaF.js");
54
55
  return handleCodexSubcommand;
55
56
  }
56
57
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
2
- import { l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.js";
3
- import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-CIpP8IJ2.js";
4
- import { i as readModelListResult } from "./models-DXorTaja.js";
5
- import { l as isJsonObject } from "./client-kMCtlApt.js";
6
- import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-BJsazZ8j.js";
2
+ import { d as resolveCodexAppServerRuntimeOptions } from "./config-DJXpBkGf.js";
3
+ import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-B48C6S9O.js";
4
+ import { i as readModelListResult } from "./models-CQGfP7nG.js";
5
+ import { t as isJsonObject } from "./protocol-oeJQu4rs.js";
6
+ import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-Cq1-IfZB.js";
7
7
  import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
8
8
  import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
9
9
  //#region extensions/codex/media-understanding-provider.ts
@@ -72,7 +72,7 @@ async function runBoundedCodexVisionTurn(params) {
72
72
  const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
73
73
  const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, 100, 100);
74
74
  const ownsClient = !params.options.clientFactory;
75
- const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-xytpSKD0.js").then((n) => n.c).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
75
+ const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-CflavQ_i.js").then((n) => n.c).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
76
76
  startOptions: appServer.start,
77
77
  timeoutMs,
78
78
  authProfileId: params.profile
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { s as readCodexModelListResponse } from "./protocol-validators-CIpP8IJ2.js";
2
+ import { s as readCodexModelListResponse } from "./protocol-validators-B48C6S9O.js";
3
3
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/codex/src/app-server/models.ts
5
5
  /**
@@ -46,7 +46,7 @@ async function listAllCodexAppServerModels(options = {}) {
46
46
  async function withCodexAppServerModelClient(options, run) {
47
47
  const timeoutMs = options.timeoutMs ?? 2500;
48
48
  const useSharedClient = options.sharedClient !== false;
49
- const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-xytpSKD0.js").then((n) => n.c);
49
+ const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-CflavQ_i.js").then((n) => n.c);
50
50
  const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
51
51
  startOptions: options.startOptions,
52
52
  timeoutMs,