@openclaw/codex 2026.5.16-beta.6 → 2026.5.18-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.
package/dist/harness.js CHANGED
@@ -18,14 +18,14 @@ function createCodexAppServerAgentHarness(options) {
18
18
  };
19
19
  },
20
20
  runAttempt: async (params) => {
21
- const { runCodexAppServerAttempt } = await import("./run-attempt-D6sdcUE0.js");
21
+ const { runCodexAppServerAttempt } = await import("./run-attempt-DyLQRA61.js");
22
22
  return runCodexAppServerAttempt(params, {
23
23
  pluginConfig: options?.pluginConfig,
24
24
  nativeHookRelay: { enabled: true }
25
25
  });
26
26
  },
27
27
  runSideQuestion: async (params) => {
28
- const { runCodexAppServerSideQuestion } = await import("./side-question-BzVnOoBU.js");
28
+ const { runCodexAppServerSideQuestion } = await import("./side-question-CfRPUq5X.js");
29
29
  return runCodexAppServerSideQuestion(params, {
30
30
  pluginConfig: options?.pluginConfig,
31
31
  nativeHookRelay: { enabled: true }
@@ -7,7 +7,7 @@ import { d as resolveCodexUsageLimitResetAtMs, f as shouldRefreshCodexRateLimits
7
7
  import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, f as resolveCodexAppServerHomeDir, l as resolveCodexAppServerAuthProfileId, s as refreshCodexAppServerAuthTokens, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-DlvmoLBJ.js";
8
8
  import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
9
9
  import { a as defaultCodexAppInventoryCache } from "./plugin-activation-B49xb7pI.js";
10
- import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, _ as projectContextEngineAssemblyForCodex, b as createCodexDynamicToolBridge, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as shouldBuildCodexPluginThreadConfig, h as mergeCodexThreadConfigs, i as buildDeveloperInstructions, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfigInputFingerprint, p as buildCodexPluginThreadConfig, r as buildContextEngineBinding, s as buildTurnStartParams, t as areCodexDynamicToolFingerprintsCompatible, v as resolveCodexContextEngineProjectionMaxChars, w as normalizeCodexDynamicToolName, x as sanitizeCodexHistoryImagePayloads, y as resolveCodexContextEngineProjectionReserveTokens } from "./thread-lifecycle-Cc_ljZLZ.js";
10
+ import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, _ as projectContextEngineAssemblyForCodex, b as createCodexDynamicToolBridge, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as shouldBuildCodexPluginThreadConfig, h as mergeCodexThreadConfigs, i as buildDeveloperInstructions, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfigInputFingerprint, p as buildCodexPluginThreadConfig, r as buildContextEngineBinding, s as buildTurnStartParams, t as areCodexDynamicToolFingerprintsCompatible, v as resolveCodexContextEngineProjectionMaxChars, w as normalizeCodexDynamicToolName, x as sanitizeCodexHistoryImagePayloads, y as resolveCodexContextEngineProjectionReserveTokens } from "./thread-lifecycle-5SBrtWFl.js";
11
11
  import { t as defaultCodexAppServerClientFactory } from "./client-factory-9L6Ie1dC.js";
12
12
  import { a as handleCodexAppServerElicitationRequest, i as buildCodexNativeHookRelayDisabledConfig, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as handleCodexAppServerApprovalRequest, r as buildCodexNativeHookRelayConfig, t as filterToolsForVisionInputs } from "./vision-tools-BX9YuTEK.js";
13
13
  import { t as ensureCodexComputerUse } from "./computer-use-UJ3dxrXF.js";
@@ -21,7 +21,7 @@ import { markAuthProfileBlockedUntil, resolveAgentDir as resolveAgentDir$1 } fro
21
21
  import { appendRegularFile, pathExists } from "openclaw/plugin-sdk/security-runtime";
22
22
  import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
23
23
  import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
24
- import { createRunningTaskRun, finalizeTaskRunByRunId, recordTaskRunProgressByRunId } from "openclaw/plugin-sdk/codex-native-task-runtime";
24
+ import { CODEX_NATIVE_SUBAGENT_RUNTIME, CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX, CODEX_NATIVE_SUBAGENT_TASK_KIND, createRunningTaskRun, finalizeTaskRunByRunId, recordTaskRunProgressByRunId } from "openclaw/plugin-sdk/codex-native-task-runtime";
25
25
  import { buildSessionContext, migrateSessionEntries, parseSessionEntries } from "@earendil-works/pi-coding-agent";
26
26
  //#region extensions/codex/src/app-server/local-runtime-attribution.ts
27
27
  const OPENAI_PROVIDER_ID = "openai";
@@ -44,8 +44,6 @@ function resolveCodexLocalRuntimeAttribution(params) {
44
44
  }
45
45
  //#endregion
46
46
  //#region extensions/codex/src/app-server/native-subagent-task-mirror.ts
47
- const CODEX_NATIVE_SUBAGENT_RUNTIME = "subagent";
48
- const CODEX_NATIVE_SUBAGENT_TASK_KIND = "codex-native";
49
47
  const defaultRuntime = {
50
48
  createRunningTaskRun,
51
49
  recordTaskRunProgressByRunId,
@@ -239,7 +237,7 @@ var CodexNativeSubagentTaskMirror = class {
239
237
  }
240
238
  };
241
239
  function codexNativeSubagentRunId(threadId) {
242
- return `codex-thread:${threadId.trim()}`;
240
+ return `${CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX}${threadId.trim()}`;
243
241
  }
244
242
  function readSubagentThreadSpawnSource(source, parentThreadId) {
245
243
  if (!source || typeof source !== "object" || !("subAgent" in source)) return;
@@ -700,6 +698,7 @@ var CodexAppServerEventProjector = class {
700
698
  assistantTexts,
701
699
  toolMetas: [...this.toolMetas.values()],
702
700
  lastAssistant,
701
+ ...this.lastNativeToolError ? { lastToolError: this.lastNativeToolError } : {},
703
702
  didSendViaMessagingTool: toolTelemetry.didSendViaMessagingTool,
704
703
  messagingToolSentTexts: toolTelemetry.messagingToolSentTexts,
705
704
  messagingToolSentMediaUrls: toolTelemetry.messagingToolSentMediaUrls,
@@ -1175,6 +1174,7 @@ var CodexAppServerEventProjector = class {
1175
1174
  if (!name) return;
1176
1175
  const status = params.phase === "result" ? itemStatus(item) : "running";
1177
1176
  const args = itemToolArgs(item);
1177
+ const meta = itemMeta(item, this.toolProgressDetailMode());
1178
1178
  this.recordToolTrajectoryEvent({
1179
1179
  phase: params.phase,
1180
1180
  item,
@@ -1188,11 +1188,16 @@ var CodexAppServerEventProjector = class {
1188
1188
  name,
1189
1189
  status
1190
1190
  });
1191
+ if (params.phase === "result") this.recordNativeToolError({
1192
+ item,
1193
+ name,
1194
+ meta,
1195
+ status
1196
+ });
1191
1197
  if (!shouldEmitTranscriptToolProgress(name, args)) {
1192
1198
  if (params.phase === "result") this.emitAfterToolCallObservation(item);
1193
1199
  return;
1194
1200
  }
1195
- const meta = itemMeta(item, this.toolProgressDetailMode());
1196
1201
  this.emitAgentEvent({
1197
1202
  stream: "tool",
1198
1203
  data: {
@@ -1211,6 +1216,27 @@ var CodexAppServerEventProjector = class {
1211
1216
  });
1212
1217
  if (params.phase === "result") this.emitAfterToolCallObservation(item);
1213
1218
  }
1219
+ recordNativeToolError(params) {
1220
+ if (!isNonSuccessItemStatus(params.status)) {
1221
+ if (!this.lastNativeToolError) return;
1222
+ if (!this.lastNativeToolError.mutatingAction) {
1223
+ this.lastNativeToolError = void 0;
1224
+ return;
1225
+ }
1226
+ const actionFingerprint = nativeToolActionFingerprint(params.item);
1227
+ if (this.lastNativeToolError.actionFingerprint && actionFingerprint && this.lastNativeToolError.actionFingerprint === actionFingerprint) this.lastNativeToolError = void 0;
1228
+ return;
1229
+ }
1230
+ const error = itemToolError(params.item, params.status, this.toolResultOutputTextByItem);
1231
+ const actionFingerprint = nativeToolActionFingerprint(params.item);
1232
+ this.lastNativeToolError = {
1233
+ toolName: params.name,
1234
+ ...params.meta ? { meta: params.meta } : {},
1235
+ ...error ? { error } : {},
1236
+ ...isMutatingNativeToolItem(params.item) ? { mutatingAction: true } : {},
1237
+ ...actionFingerprint ? { actionFingerprint } : {}
1238
+ };
1239
+ }
1214
1240
  recordToolTrajectoryEvent(params) {
1215
1241
  if (params.phase === "start") {
1216
1242
  this.options.trajectoryRecorder?.recordEvent("tool.call", {
@@ -1728,6 +1754,20 @@ function shouldSynthesizeToolProgressForItem(item) {
1728
1754
  default: return false;
1729
1755
  }
1730
1756
  }
1757
+ function isMutatingNativeToolItem(item) {
1758
+ return item.type === "commandExecution" || item.type === "fileChange";
1759
+ }
1760
+ function nativeToolActionFingerprint(item) {
1761
+ if (item.type === "commandExecution" && typeof item.command === "string") return JSON.stringify({
1762
+ type: item.type,
1763
+ command: item.command,
1764
+ cwd: typeof item.cwd === "string" ? item.cwd : ""
1765
+ });
1766
+ if (item.type === "fileChange") return JSON.stringify({
1767
+ type: item.type,
1768
+ changes: itemFileChanges(item)
1769
+ });
1770
+ }
1731
1771
  function isNativePostToolUseRelayItem(item) {
1732
1772
  switch (item.type) {
1733
1773
  case "commandExecution":
@@ -2442,13 +2482,21 @@ function toCodexTextInput(text) {
2442
2482
  text_elements: []
2443
2483
  };
2444
2484
  }
2445
- function restrictCodexAppServerSandboxForOpenClawSandbox(appServer, sandbox) {
2446
- if (!sandbox?.enabled || appServer.sandbox !== "danger-full-access") return appServer;
2485
+ function resolveCodexAppServerSandboxPolicyForOpenClawSandbox(appServer, sandbox, cwd) {
2486
+ if (!sandbox?.enabled || appServer.sandbox === "read-only") return;
2487
+ const networkAccess = codexNetworkAccessForOpenClawSandbox(sandbox);
2447
2488
  return {
2448
- ...appServer,
2449
- sandbox: "workspace-write"
2489
+ type: "workspaceWrite",
2490
+ writableRoots: [cwd],
2491
+ networkAccess,
2492
+ excludeTmpdirEnvVar: false,
2493
+ excludeSlashTmp: false
2450
2494
  };
2451
2495
  }
2496
+ function codexNetworkAccessForOpenClawSandbox(sandbox) {
2497
+ if (!sandbox?.enabled || sandbox.backendId !== "docker") return true;
2498
+ return sandbox.docker.network.trim().toLowerCase() !== "none";
2499
+ }
2452
2500
  function resolveCodexAppServerForOpenClawToolPolicy(params) {
2453
2501
  if (!params.shouldPromote || !params.canUseUntrustedApprovalPolicy || params.appServer.approvalPolicy !== "never") return params.appServer;
2454
2502
  const explicitMode = params.pluginConfig.appServer?.mode !== void 0 || isCodexAppServerPolicyMode(params.env.OPENCLAW_CODEX_APP_SERVER_MODE);
@@ -2643,8 +2691,9 @@ async function runCodexAppServerAttempt(params, options = {}) {
2643
2691
  });
2644
2692
  const effectiveWorkspace = sandbox?.enabled ? sandbox.workspaceAccess === "rw" ? resolvedWorkspace : sandbox.workspaceDir : resolvedWorkspace;
2645
2693
  await fs.mkdir(effectiveWorkspace, { recursive: true });
2694
+ const codexSandboxPolicy = resolveCodexAppServerSandboxPolicyForOpenClawSandbox(configuredAppServer, sandbox, effectiveWorkspace);
2646
2695
  const appServer = resolveCodexAppServerForOpenClawToolPolicy({
2647
- appServer: restrictCodexAppServerSandboxForOpenClawSandbox(configuredAppServer, sandbox),
2696
+ appServer: configuredAppServer,
2648
2697
  pluginConfig,
2649
2698
  env: process.env,
2650
2699
  shouldPromote: hasBeforeToolCallPolicy(),
@@ -3726,7 +3775,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
3726
3775
  threadId: thread.threadId,
3727
3776
  cwd: effectiveWorkspace,
3728
3777
  appServer: pluginAppServer,
3729
- promptText: promptBuild.prompt
3778
+ promptText: promptBuild.prompt,
3779
+ sandboxPolicy: codexSandboxPolicy
3730
3780
  }), {
3731
3781
  timeoutMs: params.timeoutMs,
3732
3782
  signal: runAbortController.signal
@@ -4328,12 +4378,14 @@ function resolveCodexAppServerHookChannelId(params, sandboxSessionKey) {
4328
4378
  messageTo: params.messageTo
4329
4379
  }).channelId;
4330
4380
  }
4331
- function buildOpenClawCodingToolsOptions(input) {
4381
+ async function buildDynamicTools(input) {
4332
4382
  const { params } = input;
4383
+ if (params.disableTools || !supportsModelTools(params.model)) return [];
4333
4384
  const modelHasVision = params.model.input?.includes("image") ?? false;
4334
4385
  const agentDir = params.agentDir ?? resolveAgentDir$1(params.config ?? {}, input.sessionAgentId);
4386
+ const createOpenClawCodingTools = openClawCodingToolsFactoryForTests ?? (await import("openclaw/plugin-sdk/agent-harness")).createOpenClawCodingTools;
4335
4387
  const sessionKeys = resolveOpenClawCodingToolsSessionKeys(params, input.sandboxSessionKey);
4336
- return {
4388
+ const filteredTools = filterCodexDynamicToolsForAllowlist(filterToolsForVisionInputs(filterCodexDynamicTools(createOpenClawCodingTools({
4337
4389
  agentId: input.sessionAgentId,
4338
4390
  ...buildEmbeddedAttemptToolRunContext(params),
4339
4391
  exec: {
@@ -4398,15 +4450,8 @@ function buildOpenClawCodingToolsOptions(input) {
4398
4450
  });
4399
4451
  input.runAbortController.abort("sessions_yield");
4400
4452
  }
4401
- };
4402
- }
4403
- async function buildDynamicTools(input) {
4404
- const { params } = input;
4405
- if (params.disableTools || !supportsModelTools(params.model)) return [];
4406
- const createOpenClawCodingTools = openClawCodingToolsFactoryForTests ?? (await import("openclaw/plugin-sdk/agent-harness")).createOpenClawCodingTools;
4407
- const toolOptions = buildOpenClawCodingToolsOptions(input);
4408
- const filteredTools = filterCodexDynamicToolsForAllowlist(filterToolsForVisionInputs(filterCodexDynamicTools(createOpenClawCodingTools(toolOptions), input.pluginConfig), {
4409
- modelHasVision: toolOptions.modelHasVision ?? false,
4453
+ }), input.pluginConfig), {
4454
+ modelHasVision,
4410
4455
  hasInboundImages: (params.images?.length ?? 0) > 0
4411
4456
  }), includeForcedMessageToolAllow(params.toolsAllow, params));
4412
4457
  return normalizeAgentRuntimeTools({
@@ -5,7 +5,7 @@ import { r as isCodexAppServerApprovalRequest } from "./client-6FkrXfaz.js";
5
5
  import { u as formatCodexUsageLimitErrorMessage } from "./command-formatters-BRW7_Nu7.js";
6
6
  import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-DlvmoLBJ.js";
7
7
  import { i as readCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
8
- import { S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, b as createCodexDynamicToolBridge, d as resolveReasoningEffort, h as mergeCodexThreadConfigs, n as buildCodexRuntimeThreadConfig, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-Cc_ljZLZ.js";
8
+ import { S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, b as createCodexDynamicToolBridge, d as resolveReasoningEffort, h as mergeCodexThreadConfigs, n as buildCodexRuntimeThreadConfig, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-5SBrtWFl.js";
9
9
  import { a as handleCodexAppServerElicitationRequest, i as buildCodexNativeHookRelayDisabledConfig, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as handleCodexAppServerApprovalRequest, r as buildCodexNativeHookRelayConfig, t as filterToolsForVisionInputs } from "./vision-tools-BX9YuTEK.js";
10
10
  import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
11
11
  import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
package/dist/test-api.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5pq6hEz.js";
2
- import { S as filterCodexDynamicTools, a as buildThreadResumeParams, b as createCodexDynamicToolBridge, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams } from "./thread-lifecycle-Cc_ljZLZ.js";
2
+ import { S as filterCodexDynamicTools, a as buildThreadResumeParams, b as createCodexDynamicToolBridge, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams } from "./thread-lifecycle-5SBrtWFl.js";
3
3
  //#region extensions/codex/test-api.ts
4
4
  function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
5
5
  return resolveCodexAppServerRuntimeOptions({
@@ -986,7 +986,7 @@ function stableStringify(value) {
986
986
  //#region extensions/codex/src/app-server/thread-lifecycle.ts
987
987
  const CODEX_CODE_MODE_THREAD_CONFIG = {
988
988
  "features.code_mode": true,
989
- "features.code_mode_only": true
989
+ "features.code_mode_only": false
990
990
  };
991
991
  const CODEX_CODE_MODE_DISABLED_THREAD_CONFIG = {
992
992
  "features.code_mode": false,
@@ -1328,8 +1328,8 @@ function buildThreadResumeParams(params, options) {
1328
1328
  };
1329
1329
  }
1330
1330
  function buildCodexRuntimeThreadConfig(config, options = {}) {
1331
- const codeModeConfig = options.nativeCodeModeEnabled === false ? CODEX_CODE_MODE_DISABLED_THREAD_CONFIG : CODEX_CODE_MODE_THREAD_CONFIG;
1332
- return mergeCodexThreadConfigs(config, codeModeConfig) ?? { ...codeModeConfig };
1331
+ if (options.nativeCodeModeEnabled === false) return mergeCodexThreadConfigs(CODEX_CODE_MODE_THREAD_CONFIG, config, CODEX_CODE_MODE_DISABLED_THREAD_CONFIG) ?? { ...CODEX_CODE_MODE_DISABLED_THREAD_CONFIG };
1332
+ return mergeCodexThreadConfigs(CODEX_CODE_MODE_THREAD_CONFIG, config) ?? { ...CODEX_CODE_MODE_THREAD_CONFIG };
1333
1333
  }
1334
1334
  function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
1335
1335
  const runtimeConfig = buildCodexRuntimeThreadConfig(config, options);
@@ -1346,7 +1346,7 @@ function buildTurnStartParams(params, options) {
1346
1346
  cwd: options.cwd,
1347
1347
  approvalPolicy: options.appServer.approvalPolicy,
1348
1348
  approvalsReviewer: options.appServer.approvalsReviewer,
1349
- sandboxPolicy: codexSandboxPolicyForTurn(options.appServer.sandbox, options.cwd),
1349
+ sandboxPolicy: options.sandboxPolicy ?? codexSandboxPolicyForTurn(options.appServer.sandbox, options.cwd),
1350
1350
  model: params.modelId,
1351
1351
  ...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
1352
1352
  effort: resolveReasoningEffort(params.thinkLevel, params.modelId),
@@ -1424,6 +1424,7 @@ function compareJsonFingerprint(left, right) {
1424
1424
  function buildDeveloperInstructions(params) {
1425
1425
  return [
1426
1426
  "Running inside OpenClaw. Use dynamic tools for messaging, cron, sessions, media, gateway, and nodes when available.",
1427
+ "Use Codex native `spawn_agent` for Codex subagents. Use OpenClaw `sessions_spawn` only for OpenClaw or ACP delegation; if it is not already loaded, search for `sessions_spawn` in the `openclaw` dynamic tool namespace before calling it.",
1427
1428
  "Preserve channel/session context. Visible channel replies: use `message`, do not describe would-reply.",
1428
1429
  renderCodexRuntimePromptOverlay(params),
1429
1430
  params.extraSystemPrompt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/codex",
3
- "version": "2026.5.16-beta.6",
3
+ "version": "2026.5.18-beta.1",
4
4
  "description": "OpenClaw Codex harness and model provider plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "type": "module",
10
10
  "dependencies": {
11
- "@earendil-works/pi-coding-agent": "0.74.1",
11
+ "@earendil-works/pi-coding-agent": "0.75.1",
12
12
  "@openai/codex": "0.130.0",
13
13
  "ajv": "8.20.0",
14
14
  "ws": "8.20.1",
@@ -27,10 +27,10 @@
27
27
  "minHostVersion": ">=2026.5.1-beta.1"
28
28
  },
29
29
  "compat": {
30
- "pluginApi": ">=2026.5.16-beta.6"
30
+ "pluginApi": ">=2026.5.18-beta.1"
31
31
  },
32
32
  "build": {
33
- "openclawVersion": "2026.5.16-beta.6"
33
+ "openclawVersion": "2026.5.18-beta.1"
34
34
  },
35
35
  "release": {
36
36
  "publishToClawHub": true,
@@ -45,7 +45,7 @@
45
45
  "openclaw.plugin.json"
46
46
  ],
47
47
  "peerDependencies": {
48
- "openclaw": ">=2026.5.16-beta.6"
48
+ "openclaw": ">=2026.5.18-beta.1"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "openclaw": {