@openclaw/codex 2026.5.5-beta.2 → 2026.5.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.
package/dist/harness.js CHANGED
@@ -18,7 +18,7 @@ function createCodexAppServerAgentHarness(options) {
18
18
  };
19
19
  },
20
20
  runAttempt: async (params) => {
21
- const { runCodexAppServerAttempt } = await import("./run-attempt-CFL1BFBl.js");
21
+ const { runCodexAppServerAttempt } = await import("./run-attempt-BaT_FcTv.js");
22
22
  return runCodexAppServerAttempt(params, { pluginConfig: options?.pluginConfig });
23
23
  },
24
24
  compact: async (params) => {
@@ -15,6 +15,7 @@ import path from "node:path";
15
15
  import nodeFs from "node:fs";
16
16
  import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
17
17
  import { buildSessionContext, migrateSessionEntries, parseSessionEntries } from "@mariozechner/pi-coding-agent";
18
+ import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/text-runtime";
18
19
  import { resolveUserPath as resolveUserPath$1 } from "openclaw/plugin-sdk/agent-harness";
19
20
  //#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
20
21
  const DEFAULT_CODEX_APPROVAL_TIMEOUT_MS = 12e4;
@@ -961,6 +962,40 @@ async function readCodexMirroredSessionHistoryMessages(sessionFile) {
961
962
  }
962
963
  }
963
964
  //#endregion
965
+ //#region extensions/codex/src/app-server/tool-progress-normalization.ts
966
+ function resolveCodexToolProgressDetailMode(value) {
967
+ return value === "raw" ? "raw" : "explain";
968
+ }
969
+ function sanitizeCodexAgentEventValue(value, seen = /* @__PURE__ */ new WeakSet()) {
970
+ if (typeof value === "string") return redactToolPayloadText(value);
971
+ if (Array.isArray(value)) {
972
+ if (seen.has(value)) return "[Circular]";
973
+ seen.add(value);
974
+ return value.map((entry) => sanitizeCodexAgentEventValue(entry, seen));
975
+ }
976
+ if (value && typeof value === "object") {
977
+ if (seen.has(value)) return "[Circular]";
978
+ seen.add(value);
979
+ const out = {};
980
+ for (const [key, child] of Object.entries(value)) out[key] = typeof child === "string" ? redactSensitiveFieldValue(key, child) : sanitizeCodexAgentEventValue(child, seen);
981
+ return out;
982
+ }
983
+ return value;
984
+ }
985
+ function sanitizeCodexAgentEventRecord(value) {
986
+ return sanitizeCodexAgentEventValue(value);
987
+ }
988
+ function sanitizeCodexToolArguments(value) {
989
+ if (!isJsonObject(value)) return;
990
+ return sanitizeCodexAgentEventRecord(value);
991
+ }
992
+ function sanitizeCodexToolResponse(response) {
993
+ return sanitizeCodexAgentEventRecord(response);
994
+ }
995
+ function inferCodexDynamicToolMeta(call, detailMode) {
996
+ return inferToolMetaFromArgs(call.tool, call.arguments, { detailMode });
997
+ }
998
+ //#endregion
964
999
  //#region extensions/codex/src/app-server/transcript-mirror.ts
965
1000
  const MIRROR_IDENTITY_META_KEY = "mirrorIdentity";
966
1001
  /**
@@ -1334,6 +1369,10 @@ var CodexAppServerEventProjector = class {
1334
1369
  phase: "start",
1335
1370
  item
1336
1371
  });
1372
+ this.emitNormalizedToolItemEvent({
1373
+ phase: "start",
1374
+ item
1375
+ });
1337
1376
  this.emitToolResultSummary(item);
1338
1377
  this.emitAgentEvent({
1339
1378
  stream: "codex_app_server.item",
@@ -1396,6 +1435,10 @@ var CodexAppServerEventProjector = class {
1396
1435
  phase: "end",
1397
1436
  item
1398
1437
  });
1438
+ this.emitNormalizedToolItemEvent({
1439
+ phase: "result",
1440
+ item
1441
+ });
1399
1442
  this.emitToolResultSummary(item);
1400
1443
  this.emitToolResultOutput(item);
1401
1444
  this.emitAgentEvent({
@@ -1558,6 +1601,7 @@ var CodexAppServerEventProjector = class {
1558
1601
  const kind = itemKind(item);
1559
1602
  if (!kind) return;
1560
1603
  const meta = itemMeta(item, this.toolProgressDetailMode());
1604
+ const suppressChannelProgress = shouldSuppressChannelProgressForItem(item);
1561
1605
  this.emitAgentEvent({
1562
1606
  stream: "item",
1563
1607
  data: {
@@ -1567,7 +1611,33 @@ var CodexAppServerEventProjector = class {
1567
1611
  title: itemTitle(item),
1568
1612
  status: params.phase === "start" ? "running" : itemStatus(item),
1569
1613
  ...itemName(item) ? { name: itemName(item) } : {},
1570
- ...meta ? { meta } : {}
1614
+ ...meta ? { meta } : {},
1615
+ ...suppressChannelProgress ? { suppressChannelProgress: true } : {}
1616
+ }
1617
+ });
1618
+ }
1619
+ emitNormalizedToolItemEvent(params) {
1620
+ const { item } = params;
1621
+ if (!item || !shouldSynthesizeToolProgressForItem(item)) return;
1622
+ const name = itemName(item);
1623
+ if (!name) return;
1624
+ const meta = itemMeta(item, this.toolProgressDetailMode());
1625
+ const args = params.phase === "start" ? itemToolArgs(item) : void 0;
1626
+ const status = params.phase === "result" ? itemStatus(item) : "running";
1627
+ this.emitAgentEvent({
1628
+ stream: "tool",
1629
+ data: {
1630
+ phase: params.phase,
1631
+ name,
1632
+ itemId: item.id,
1633
+ toolCallId: item.id,
1634
+ ...meta ? { meta } : {},
1635
+ ...args ? { args } : {},
1636
+ ...params.phase === "result" ? {
1637
+ status,
1638
+ isError: isNonSuccessItemStatus(status),
1639
+ ...itemToolResult(item)
1640
+ } : {}
1571
1641
  }
1572
1642
  });
1573
1643
  }
@@ -1611,7 +1681,7 @@ var CodexAppServerEventProjector = class {
1611
1681
  return typeof this.params.shouldEmitToolOutput === "function" ? this.params.shouldEmitToolOutput() : this.params.verboseLevel === "full";
1612
1682
  }
1613
1683
  toolProgressDetailMode() {
1614
- return this.params.toolProgressDetail === "raw" ? "raw" : "explain";
1684
+ return resolveCodexToolProgressDetailMode(this.params.toolProgressDetail);
1615
1685
  }
1616
1686
  recordToolMeta(item) {
1617
1687
  if (!item) return;
@@ -1856,9 +1926,13 @@ function itemTitle(item) {
1856
1926
  function itemStatus(item) {
1857
1927
  const status = readItemString(item, "status");
1858
1928
  if (status === "failed") return "failed";
1929
+ if (status === "declined") return "blocked";
1859
1930
  if (status === "inProgress" || status === "running") return "running";
1860
1931
  return "completed";
1861
1932
  }
1933
+ function isNonSuccessItemStatus(status) {
1934
+ return status === "failed" || status === "blocked";
1935
+ }
1862
1936
  function itemName(item) {
1863
1937
  if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
1864
1938
  if (item.type === "mcpToolCall" && typeof item.tool === "string") {
@@ -1869,6 +1943,49 @@ function itemName(item) {
1869
1943
  if (item.type === "fileChange") return "apply_patch";
1870
1944
  if (item.type === "webSearch") return "web_search";
1871
1945
  }
1946
+ function shouldSynthesizeToolProgressForItem(item) {
1947
+ switch (item.type) {
1948
+ case "commandExecution":
1949
+ case "fileChange":
1950
+ case "webSearch":
1951
+ case "mcpToolCall": return true;
1952
+ default: return false;
1953
+ }
1954
+ }
1955
+ function shouldSuppressChannelProgressForItem(item) {
1956
+ if (shouldSynthesizeToolProgressForItem(item)) return true;
1957
+ return item.type === "dynamicToolCall";
1958
+ }
1959
+ function itemToolArgs(item) {
1960
+ if (item.type === "commandExecution") return sanitizeCodexAgentEventRecord({
1961
+ command: item.command,
1962
+ ...typeof item.cwd === "string" ? { cwd: item.cwd } : {}
1963
+ });
1964
+ if (item.type === "webSearch" && typeof item.query === "string") return sanitizeCodexAgentEventRecord({ query: item.query });
1965
+ if (item.type === "mcpToolCall") return sanitizeCodexToolArguments(item.arguments);
1966
+ }
1967
+ function itemToolResult(item) {
1968
+ if (item.type === "commandExecution") return { result: sanitizeCodexAgentEventRecord({
1969
+ status: item.status,
1970
+ exitCode: item.exitCode,
1971
+ durationMs: item.durationMs
1972
+ }) };
1973
+ if (item.type === "fileChange") return { result: sanitizeCodexAgentEventRecord({
1974
+ status: item.status,
1975
+ changes: item.changes.map((change) => ({
1976
+ path: change.path,
1977
+ kind: change.kind
1978
+ }))
1979
+ }) };
1980
+ if (item.type === "mcpToolCall") return { result: sanitizeCodexAgentEventRecord({
1981
+ status: item.status,
1982
+ durationMs: item.durationMs,
1983
+ ...item.error ? { error: item.error } : {},
1984
+ ...item.result ? { result: item.result } : {}
1985
+ }) };
1986
+ if (item.type === "webSearch") return { result: sanitizeCodexAgentEventRecord({ status: "completed" }) };
1987
+ return {};
1988
+ }
1872
1989
  function itemMeta(item, detailMode = "explain") {
1873
1990
  if (item.type === "commandExecution" && typeof item.command === "string") return inferToolMetaFromArgs("exec", {
1874
1991
  command: item.command,
@@ -2417,6 +2534,7 @@ const CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS = 30 * 6e4;
2417
2534
  const CODEX_STEER_ALL_DEBOUNCE_MS = 500;
2418
2535
  const LOG_FIELD_MAX_LENGTH = 160;
2419
2536
  const CODEX_NATIVE_PROJECT_DOC_BASENAMES = new Set(["agents.md"]);
2537
+ const CODEX_NATIVE_HOOK_RELAY_EVENTS_WITH_APP_SERVER_APPROVALS = CODEX_NATIVE_HOOK_RELAY_EVENTS.filter((event) => event !== "permission_request");
2420
2538
  const CODEX_BOOTSTRAP_CONTEXT_ORDER = new Map([
2421
2539
  ["soul.md", 10],
2422
2540
  ["identity.md", 20],
@@ -2567,6 +2685,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
2567
2685
  const attemptClientFactory = clientFactory;
2568
2686
  const pluginConfig = readCodexPluginConfig(options.pluginConfig);
2569
2687
  const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig });
2688
+ const nativeHookRelayEvents = resolveCodexNativeHookRelayEvents({
2689
+ configuredEvents: options.nativeHookRelay?.events,
2690
+ appServer
2691
+ });
2570
2692
  const resolvedWorkspace = resolveUserPath(params.workspaceDir);
2571
2693
  await fs.mkdir(resolvedWorkspace, { recursive: true });
2572
2694
  const sandboxSessionKey = params.sandboxSessionKey?.trim() || params.sessionKey?.trim() || params.sessionId;
@@ -2735,6 +2857,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
2735
2857
  });
2736
2858
  nativeHookRelay = createCodexNativeHookRelay({
2737
2859
  options: options.nativeHookRelay,
2860
+ events: nativeHookRelayEvents,
2738
2861
  agentId: sessionAgentId,
2739
2862
  sessionId: params.sessionId,
2740
2863
  sessionKey: sandboxSessionKey,
@@ -2744,7 +2867,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
2744
2867
  });
2745
2868
  const threadConfig = mergeCodexConfigInstructions(nativeHookRelay ? buildCodexNativeHookRelayConfig({
2746
2869
  relay: nativeHookRelay,
2747
- events: options.nativeHookRelay?.events,
2870
+ events: nativeHookRelayEvents,
2748
2871
  hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec
2749
2872
  }) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0, workspaceBootstrapInstructions);
2750
2873
  ({client, thread} = await withCodexStartupTimeout({
@@ -3057,6 +3180,18 @@ async function runCodexAppServerAttempt(params, options = {}) {
3057
3180
  name: call.tool,
3058
3181
  arguments: call.arguments
3059
3182
  });
3183
+ const toolMeta = inferCodexDynamicToolMeta(call, resolveCodexToolProgressDetailMode(params.toolProgressDetail));
3184
+ const toolArgs = sanitizeCodexToolArguments(call.arguments);
3185
+ emitCodexAppServerEvent(params, {
3186
+ stream: "tool",
3187
+ data: {
3188
+ phase: "start",
3189
+ name: call.tool,
3190
+ toolCallId: call.callId,
3191
+ ...toolMeta ? { meta: toolMeta } : {},
3192
+ ...toolArgs ? { args: toolArgs } : {}
3193
+ }
3194
+ });
3060
3195
  const response = await handleDynamicToolCallWithTimeout({
3061
3196
  call,
3062
3197
  toolBridge,
@@ -3080,6 +3215,17 @@ async function runCodexAppServerAttempt(params, options = {}) {
3080
3215
  success: response.success,
3081
3216
  contentItems: response.contentItems
3082
3217
  });
3218
+ emitCodexAppServerEvent(params, {
3219
+ stream: "tool",
3220
+ data: {
3221
+ phase: "result",
3222
+ name: call.tool,
3223
+ toolCallId: call.callId,
3224
+ ...toolMeta ? { meta: toolMeta } : {},
3225
+ isError: !response.success,
3226
+ result: sanitizeCodexToolResponse(response)
3227
+ }
3228
+ });
3083
3229
  return response;
3084
3230
  } finally {
3085
3231
  activeAppServerTurnRequests = Math.max(0, activeAppServerTurnRequests - 1);
@@ -3446,12 +3592,16 @@ function createCodexNativeHookRelay(params) {
3446
3592
  ...params.sessionKey ? { sessionKey: params.sessionKey } : {},
3447
3593
  ...params.config ? { config: params.config } : {},
3448
3594
  runId: params.runId,
3449
- allowedEvents: params.options?.events ?? CODEX_NATIVE_HOOK_RELAY_EVENTS,
3595
+ allowedEvents: params.events,
3450
3596
  ttlMs: params.options?.ttlMs,
3451
3597
  signal: params.signal,
3452
3598
  command: { timeoutMs: params.options?.gatewayTimeoutMs }
3453
3599
  });
3454
3600
  }
3601
+ function resolveCodexNativeHookRelayEvents(params) {
3602
+ if (params.configuredEvents?.length) return params.configuredEvents;
3603
+ return params.appServer.approvalPolicy === "never" ? CODEX_NATIVE_HOOK_RELAY_EVENTS : CODEX_NATIVE_HOOK_RELAY_EVENTS_WITH_APP_SERVER_APPROVALS;
3604
+ }
3455
3605
  function buildCodexNativeHookRelayId(params) {
3456
3606
  const hash = createHash("sha256");
3457
3607
  hash.update("openclaw:codex:native-hook-relay:v1");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/codex",
3
- "version": "2026.5.5-beta.2",
3
+ "version": "2026.5.6-beta.1",
4
4
  "description": "OpenClaw Codex harness and model provider plugin",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,10 +27,10 @@
27
27
  "minHostVersion": ">=2026.5.1-beta.1"
28
28
  },
29
29
  "compat": {
30
- "pluginApi": ">=2026.5.5-beta.2"
30
+ "pluginApi": ">=2026.5.6-beta.1"
31
31
  },
32
32
  "build": {
33
- "openclawVersion": "2026.5.5-beta.2"
33
+ "openclawVersion": "2026.5.6-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.5-beta.2"
48
+ "openclaw": ">=2026.5.6-beta.1"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "openclaw": {