@openclaw/codex 2026.7.2-beta.2 → 2026.7.2-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/{app-server-policy-Scc-Wevo.js → app-server-policy-DUMF2Xyr.js} +1 -1
  2. package/dist/{attempt-notifications-BFmNhqFl.js → attempt-notifications-Ecjyzufe.js} +1 -1
  3. package/dist/cli-metadata.js +1 -1
  4. package/dist/{command-formatters-Dq9InZUK.js → command-formatters-NCTL7A2q.js} +7 -3
  5. package/dist/{command-handlers-IgqmL_kv.js → command-handlers-DtFbZiba.js} +69 -11
  6. package/dist/{compact-DCTmg3id.js → compact-Kgy26gIM.js} +4 -4
  7. package/dist/{computer-use-CPcU8TjG.js → computer-use-C7x4ZaqR.js} +4 -4
  8. package/dist/{conversation-control-CGkBlfc5.js → conversation-control-B0s3aIjT.js} +5 -5
  9. package/dist/doctor-contract-api.js +1 -1
  10. package/dist/{dynamic-tools-C_1tEs34.js → dynamic-tools-D_vSVmv9.js} +253 -114
  11. package/dist/harness.js +8 -7
  12. package/dist/index.js +16 -16
  13. package/dist/{media-understanding-provider-D31dOJwb.js → media-understanding-provider-IPNNQre6.js} +6 -6
  14. package/dist/media-understanding-provider.js +1 -1
  15. package/dist/{models-uh26C8QU.js → models-DD5zBdX5.js} +1 -1
  16. package/dist/{notification-correlation-KmfV4EkP.js → notification-correlation-C8DVQ_Bq.js} +3 -3
  17. package/dist/{plugin-app-cache-key-Ceb-lm2c.js → plugin-app-cache-key-DJbhLYSK.js} +2 -2
  18. package/dist/{rate-limits-DyXaYAxU.js → rate-limits-CqhWQ2R9.js} +3 -1
  19. package/dist/{request-B_oQsCXy.js → request-9yf9pZjf.js} +1 -1
  20. package/dist/{run-attempt-MLzoMe_m.js → run-attempt-BIoO8ISr.js} +158 -76
  21. package/dist/{session-binding-h1mmCGnl.js → session-binding-Bmt20HfB.js} +2 -0
  22. package/dist/{session-catalog-CEvoXWHA.js → session-catalog-CA7R-hX2.js} +43 -22
  23. package/dist/{session-cli-XsEuWb_C.js → session-cli-Bxk3-Wqz.js} +2 -2
  24. package/dist/{shared-client-JiAnW6pc.js → shared-client-CSXLtCLE.js} +52 -3
  25. package/dist/{side-question-DqDvIwSU.js → side-question-DtzquMOb.js} +7 -7
  26. package/dist/{thread-lifecycle-CN_pPtPh.js → thread-lifecycle-CQ_9mAa1.js} +40 -9
  27. package/dist/{usage-D5Rohxoc.js → usage-CuPpFgTc.js} +3 -3
  28. package/dist/{web-search-provider.runtime-CKVBn3fP.js → web-search-provider.runtime-_x5XTeqh.js} +3 -3
  29. package/npm-shrinkwrap.json +30 -30
  30. package/openclaw.plugin.json +11 -1
  31. package/package.json +5 -5
@@ -1,11 +1,11 @@
1
- import { Y as CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE, Z as isJsonObject, _ as readCodexRateLimitsRevision, c as releaseLeasedSharedCodexAppServerClient, j as resolveCodexGatewayTimeoutWithGraceMs, v as readRecentCodexRateLimits, y as rememberCodexRateLimitsRead } from "./shared-client-JiAnW6pc.js";
2
- import { y as readCodexPluginConfig } from "./session-binding-h1mmCGnl.js";
1
+ import { Y as CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE, Z as isJsonObject, _ as readCodexRateLimitsRevision, c as releaseLeasedSharedCodexAppServerClient, j as resolveCodexGatewayTimeoutWithGraceMs, v as readRecentCodexRateLimits, y as rememberCodexRateLimitsRead } from "./shared-client-CSXLtCLE.js";
2
+ import { y as readCodexPluginConfig } from "./session-binding-Bmt20HfB.js";
3
3
  import { c as attachCodexMirrorIdentity, g as readCodexTurn, s as promptSnapshot } from "./transcript-mirror-D9rTxx2P.js";
4
- import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicToolsWithOpenClawShell, T as normalizeCodexDynamicToolName, a as sanitizeCodexHistoryImagePayloads, d as resolveCodexWebSearchPlan, i as invalidInlineImageText, o as sanitizeInlineImageDataUrl, w as isSystemAgentOnlyCodexDynamicToolAllowlist, x as filterCodexDynamicTools } from "./thread-lifecycle-CN_pPtPh.js";
5
- import { d as CODEX_CONTROL_METHODS, r as formatCodexDisplayText } from "./command-formatters-Dq9InZUK.js";
6
- import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-DyXaYAxU.js";
4
+ import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicToolsWithOpenClawShell, T as normalizeCodexDynamicToolName, a as sanitizeCodexHistoryImagePayloads, d as resolveCodexWebSearchPlan, i as invalidInlineImageText, o as sanitizeInlineImageDataUrl, w as isSystemAgentOnlyCodexDynamicToolAllowlist, x as filterCodexDynamicTools } from "./thread-lifecycle-CQ_9mAa1.js";
5
+ import { d as CODEX_CONTROL_METHODS, r as formatCodexDisplayText } from "./command-formatters-NCTL7A2q.js";
6
+ import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-CqhWQ2R9.js";
7
7
  import { a as resolveCodexNodeExecToolOverrides, i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-D1Wky__S.js";
8
- import { n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-KmfV4EkP.js";
8
+ import { n as readCodexNotificationThreadId, r as readCodexNotificationTurnId } from "./notification-correlation-C8DVQ_Bq.js";
9
9
  import fs from "node:fs/promises";
10
10
  import { addTimerTimeoutGraceMs, asDateTimestampMs, finiteSecondsToTimerSafeMilliseconds, parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
11
11
  import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
@@ -16,10 +16,11 @@ import { asOptionalRecord, isRecord, normalizeTrimmedStringList } from "openclaw
16
16
  import { HEARTBEAT_RESPONSE_TOOL_NAME, TOOL_PROGRESS_OUTPUT_MAX_CHARS, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, callGatewayTool, classifyAgentHarnessTerminalOutcome, consumeAdjustedParamsForToolCall, consumePreExecutionBlockedToolCall, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, emitAgentEvent, extractMessagingToolSend, extractMessagingToolSendResult, extractToolResultMediaArtifact, filterProviderNormalizableTools, filterToolResultMediaUrls, finalizeToolTerminalPresentation, formatApprovalDisplayPath, formatErrorMessage, formatToolAggregate, formatToolExecutionErrorMessage, formatToolProgressOutput, getBeforeToolCallFailureDisposition, getChannelAgentToolMeta, getPluginToolMeta, hasNativeHookRelayInvocation, inferToolMetaFromArgs, invokeNativeHookRelay, isDeliveredMessageToolOnlySourceReplyResult, isDeliveredMessagingToolResult, isHostScopedAgentToolActive, isMessagingTool, isMessagingToolSendAction, isReplaySafeToolCall, isSubagentSessionKey, isToolResultError, isToolWrappedWithBeforeToolCallHook, normalizeAgentRuntimeTools, normalizeHeartbeatToolResponse, normalizeUsage, projectRuntimeToolInputSchema, registerNativeHookRelay, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveNativeHookRelayDeferredToolApproval, resolveToolExecutionErrorKind, resolveToolResultFailureKind, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessBeforeCompactionHook, runBeforeToolCallHook, sanitizeToolResult, setBeforeToolCallDiagnosticsEnabled, supportsModelTools, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
17
17
  import { listSessionEntries, parseSqliteSessionFileMarker } from "openclaw/plugin-sdk/session-store-runtime";
18
18
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
19
- import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
19
+ import { redactSensitiveFieldValue, redactSensitiveText, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
20
20
  import { emitTrustedDiagnosticEvent, hasPendingInternalDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
21
21
  import { readSessionTranscriptEvents } from "openclaw/plugin-sdk/session-transcript-runtime";
22
22
  import { isToolAllowed } from "openclaw/plugin-sdk/sandbox";
23
+ import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
23
24
  import { buildSessionContext, migrateSessionEntries, parseSessionEntries } from "openclaw/plugin-sdk/agent-sessions";
24
25
  import { generatedImageAssetFromBase64 } from "openclaw/plugin-sdk/image-generation";
25
26
  import { saveMediaBuffer } from "openclaw/plugin-sdk/media-store";
@@ -178,6 +179,117 @@ function readItem(value) {
178
179
  return value;
179
180
  }
180
181
  //#endregion
182
+ //#region extensions/codex/src/app-server/event-projector-items.ts
183
+ function itemKind(item) {
184
+ switch (item.type) {
185
+ case "dynamicToolCall":
186
+ case "mcpToolCall": return "tool";
187
+ case "commandExecution": return "command";
188
+ case "fileChange": return "patch";
189
+ case "webSearch": return "search";
190
+ case "reasoning":
191
+ case "contextCompaction": return "analysis";
192
+ default: return;
193
+ }
194
+ }
195
+ function itemTitle(item) {
196
+ switch (item.type) {
197
+ case "commandExecution": return "Command";
198
+ case "fileChange": return "File change";
199
+ case "mcpToolCall": return "MCP tool";
200
+ case "dynamicToolCall": return "Tool";
201
+ case "webSearch": return "Web search";
202
+ case "contextCompaction": return "Context compaction";
203
+ case "reasoning": return "Reasoning";
204
+ default: return item.type;
205
+ }
206
+ }
207
+ function itemStatus(item) {
208
+ const status = readItemString(item, "status");
209
+ if (status === "failed" || status === "error") return "failed";
210
+ if (status === "declined") return "blocked";
211
+ if (status === "inProgress" || status === "in_progress" || status === "running") return "running";
212
+ return "completed";
213
+ }
214
+ function unknownItemStatus(item) {
215
+ const status = readItemString(item, "status");
216
+ switch (status) {
217
+ case void 0:
218
+ case "completed":
219
+ case "failed":
220
+ case "error":
221
+ case "declined":
222
+ case "inProgress":
223
+ case "in_progress":
224
+ case "running": return;
225
+ default: return status;
226
+ }
227
+ }
228
+ function auditNativeToolTerminalStatus(item) {
229
+ if (item.type === "imageView" || item.type === "sleep") return "completed";
230
+ const status = readItemString(item, "status");
231
+ if (status === "completed") return "completed";
232
+ if (status === "failed" || status === "error") return "failed";
233
+ if (status === "declined") return "blocked";
234
+ return "unknown";
235
+ }
236
+ function auditNativeToolUnfinishedStatus(item) {
237
+ return item.type === "webSearch" || item.type === "imageGeneration" ? "unknown" : "failed";
238
+ }
239
+ function isNonSuccessItemStatus(status) {
240
+ return status === "failed" || status === "blocked";
241
+ }
242
+ function itemName(item) {
243
+ if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
244
+ if (item.type === "mcpToolCall" && typeof item.tool === "string") {
245
+ const server = typeof item.server === "string" ? item.server : void 0;
246
+ return server ? `${server}.${item.tool}` : item.tool;
247
+ }
248
+ if (item.type === "commandExecution") return "bash";
249
+ if (item.type === "fileChange") return "apply_patch";
250
+ if (item.type === "webSearch") return "web_search";
251
+ }
252
+ function auditNativeToolName(item) {
253
+ if (item.type === "dynamicToolCall") return;
254
+ const progressName = itemName(item);
255
+ if (progressName) return progressName;
256
+ if (item.type === "collabAgentToolCall") return typeof item.tool === "string" && item.tool.trim() ? `collab.${item.tool.trim()}` : "collab_agent";
257
+ if (item.type === "imageGeneration") return "image_generation";
258
+ if (item.type === "imageView") return "image_view";
259
+ if (item.type === "sleep") return "sleep";
260
+ }
261
+ function isSideEffectingNativeToolItem(item) {
262
+ return itemStatus(item) !== "blocked" && (isMutatingNativeToolItem(item) || item.type === "mcpToolCall");
263
+ }
264
+ function shouldSynthesizeToolProgressForItem(item) {
265
+ switch (item.type) {
266
+ case "commandExecution":
267
+ case "fileChange":
268
+ case "webSearch":
269
+ case "mcpToolCall": return true;
270
+ default: return false;
271
+ }
272
+ }
273
+ function shouldRecordNativeToolTranscript(item) {
274
+ return shouldSynthesizeToolProgressForItem(item) && item.type !== "webSearch";
275
+ }
276
+ function isMutatingNativeToolItem(item) {
277
+ if (item.type === "commandExecution") return true;
278
+ return item.type === "fileChange" || item.type === "collabAgentToolCall" || item.type === "imageGeneration";
279
+ }
280
+ function shouldClearTerminalPresentationForNativeItem(item) {
281
+ switch (item.type) {
282
+ case "collabAgentToolCall":
283
+ case "commandExecution":
284
+ case "fileChange":
285
+ case "imageGeneration":
286
+ case "imageView":
287
+ case "mcpToolCall":
288
+ case "webSearch": return true;
289
+ default: return false;
290
+ }
291
+ }
292
+ //#endregion
181
293
  //#region extensions/codex/src/app-server/event-projector-assistant.ts
182
294
  var CodexAssistantProjection = class {
183
295
  constructor(params, emitAgentEvent, matchesToolProgressEcho) {
@@ -191,6 +303,7 @@ var CodexAssistantProjection = class {
191
303
  this.latestTerminalAssistantCandidateCanReleaseAfterToolHandoff = false;
192
304
  this.terminalAssistantCandidateEarlierActiveItemIds = /* @__PURE__ */ new Set();
193
305
  this.lastCommentaryProgressTextByItem = /* @__PURE__ */ new Map();
306
+ this.lastAnswerCandidateEventByItem = /* @__PURE__ */ new Map();
194
307
  this.pendingRawCommentaryEchoes = 0;
195
308
  this.rawPromotedAssistantItemIds = /* @__PURE__ */ new Set();
196
309
  this.assistantStarted = false;
@@ -238,6 +351,7 @@ var CodexAssistantProjection = class {
238
351
  });
239
352
  return;
240
353
  }
354
+ if (this.isFinalAnswerAssistantItem(itemId)) this.emitAnswerCandidate(itemId, "candidate");
241
355
  const knownFinalAnswer = this.shouldStreamAssistantPartial(itemId);
242
356
  const replace = this.streamedPartialAssistantItemId !== void 0 && this.streamedPartialAssistantItemId !== itemId;
243
357
  if (replace && (!knownFinalAnswer || this.streamedPartialAssistantItemReplaceable)) this.streamedPartialAssistantItemReplaceable = true;
@@ -288,7 +402,7 @@ var CodexAssistantProjection = class {
288
402
  text: item.text
289
403
  });
290
404
  this.pendingRawCommentaryEchoes += 1;
291
- }
405
+ } else if (item.text && this.isFinalAnswerAssistantItem(item.id)) this.emitAnswerCandidate(item.id, "candidate");
292
406
  }
293
407
  }
294
408
  recordSnapshotItem(item) {
@@ -342,6 +456,26 @@ var CodexAssistantProjection = class {
342
456
  const finalText = this.resolveFinalAssistantTextItem()?.text;
343
457
  return finalText ? [finalText] : [];
344
458
  }
459
+ finalizeAnswerCandidate(turn) {
460
+ if (turn.status !== "completed") {
461
+ this.supersedeVisibleAnswerCandidate();
462
+ return;
463
+ }
464
+ const turnItems = turn.items ?? [];
465
+ const authoritativeIndex = turnItems.findLastIndex((item) => item.type === "agentMessage" && readItemString(item, "phase") === "final_answer" && typeof item.text === "string" && item.text.trim().length > 0);
466
+ const authoritative = authoritativeIndex >= 0 ? turnItems[authoritativeIndex] : void 0;
467
+ if (turnItems.slice(authoritativeIndex + 1).some(shouldClearTerminalPresentationForNativeItem) || authoritative?.id === this.latestTerminalAssistantCandidateItemId && this.latestTerminalAssistantCandidateSuperseded) {
468
+ this.supersedeVisibleAnswerCandidate();
469
+ return;
470
+ }
471
+ const itemId = authoritative?.id ?? this.visibleAnswerCandidateItemId;
472
+ if (!itemId) return;
473
+ if (itemId !== this.visibleAnswerCandidateItemId) {
474
+ this.supersedeVisibleAnswerCandidate();
475
+ this.visibleAnswerCandidateItemId = itemId;
476
+ }
477
+ this.emitAnswerCandidate(itemId, "selected");
478
+ }
345
479
  hasAssistantItemTextForSynthesis() {
346
480
  for (let i = this.assistantItemOrder.length - 1; i >= 0; i -= 1) {
347
481
  const itemId = this.assistantItemOrder[i];
@@ -375,6 +509,9 @@ var CodexAssistantProjection = class {
375
509
  isCommentaryAssistantItem(itemId) {
376
510
  return this.assistantPhaseByItem.get(itemId) === "commentary";
377
511
  }
512
+ isFinalAnswerAssistantItem(itemId) {
513
+ return this.assistantPhaseByItem.get(itemId) === "final_answer";
514
+ }
378
515
  shouldStreamAssistantPartial(itemId) {
379
516
  return this.assistantPhaseByItem.get(itemId) === "final_answer";
380
517
  }
@@ -394,6 +531,36 @@ var CodexAssistantProjection = class {
394
531
  }
395
532
  });
396
533
  }
534
+ emitAnswerCandidate(itemId, status) {
535
+ const text = this.assistantTextByItem.get(itemId)?.trim();
536
+ if (!text) return;
537
+ if (status === "candidate" && this.visibleAnswerCandidateItemId !== itemId) {
538
+ this.supersedeVisibleAnswerCandidate();
539
+ this.visibleAnswerCandidateItemId = itemId;
540
+ }
541
+ const signature = `${status}\0${text}`;
542
+ if (this.lastAnswerCandidateEventByItem.get(itemId) === signature) return;
543
+ this.lastAnswerCandidateEventByItem.set(itemId, signature);
544
+ this.emitAgentEvent({
545
+ stream: "item",
546
+ data: {
547
+ itemId,
548
+ kind: "answer_candidate",
549
+ title: "Answer candidate",
550
+ phase: "update",
551
+ status,
552
+ progressText: text,
553
+ source: "codex-app-server",
554
+ hideFromChannelProgress: true
555
+ }
556
+ });
557
+ }
558
+ supersedeVisibleAnswerCandidate() {
559
+ const itemId = this.visibleAnswerCandidateItemId;
560
+ if (!itemId) return;
561
+ this.emitAnswerCandidate(itemId, "superseded");
562
+ this.visibleAnswerCandidateItemId = void 0;
563
+ }
397
564
  markLatestTerminalAssistantCandidate(itemId, activeItemIds, options) {
398
565
  this.latestTerminalAssistantCandidateItemId = itemId;
399
566
  this.latestTerminalAssistantCandidateSuperseded = false;
@@ -409,6 +576,7 @@ var CodexAssistantProjection = class {
409
576
  this.latestTerminalAssistantCandidateSuperseded = true;
410
577
  this.latestTerminalAssistantCandidateCanReleaseAfterToolHandoff = false;
411
578
  this.terminalAssistantCandidateEarlierActiveItemIds.clear();
579
+ this.supersedeVisibleAnswerCandidate();
412
580
  }
413
581
  resolveFinalAssistantTextItem() {
414
582
  for (let i = this.assistantItemOrder.length - 1; i >= 0; i -= 1) {
@@ -431,102 +599,52 @@ var CodexAssistantProjection = class {
431
599
  }
432
600
  };
433
601
  //#endregion
434
- //#region extensions/codex/src/app-server/event-projector-items.ts
435
- function itemKind(item) {
436
- switch (item.type) {
437
- case "dynamicToolCall":
438
- case "mcpToolCall": return "tool";
439
- case "commandExecution": return "command";
440
- case "fileChange": return "patch";
441
- case "webSearch": return "search";
442
- case "reasoning":
443
- case "contextCompaction": return "analysis";
444
- default: return;
445
- }
602
+ //#region extensions/codex/src/app-server/event-projector-diagnostics.ts
603
+ function redactCodexEventKind(method) {
604
+ return redactSensitiveText(sanitizeTerminalText(method));
446
605
  }
447
- function itemTitle(item) {
448
- switch (item.type) {
449
- case "commandExecution": return "Command";
450
- case "fileChange": return "File change";
451
- case "mcpToolCall": return "MCP tool";
452
- case "dynamicToolCall": return "Tool";
453
- case "webSearch": return "Web search";
454
- case "contextCompaction": return "Context compaction";
455
- case "reasoning": return "Reasoning";
456
- default: return item.type;
606
+ var CodexProjectionDiagnostics = class {
607
+ constructor(threadId, turnId) {
608
+ this.threadId = threadId;
609
+ this.turnId = turnId;
610
+ this.warningKeys = /* @__PURE__ */ new Set();
457
611
  }
458
- }
459
- function itemStatus(item) {
460
- const status = readItemString(item, "status");
461
- if (status === "failed" || status === "error") return "failed";
462
- if (status === "declined") return "blocked";
463
- if (status === "inProgress" || status === "in_progress" || status === "running") return "running";
464
- return "completed";
465
- }
466
- function auditNativeToolTerminalStatus(item) {
467
- if (item.type === "imageView" || item.type === "sleep") return "completed";
468
- const status = readItemString(item, "status");
469
- if (status === "completed") return "completed";
470
- if (status === "failed" || status === "error") return "failed";
471
- if (status === "declined") return "blocked";
472
- return "unknown";
473
- }
474
- function auditNativeToolUnfinishedStatus(item) {
475
- return item.type === "webSearch" || item.type === "imageGeneration" ? "unknown" : "failed";
476
- }
477
- function isNonSuccessItemStatus(status) {
478
- return status === "failed" || status === "blocked";
479
- }
480
- function itemName(item) {
481
- if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
482
- if (item.type === "mcpToolCall" && typeof item.tool === "string") {
483
- const server = typeof item.server === "string" ? item.server : void 0;
484
- return server ? `${server}.${item.tool}` : item.tool;
612
+ warnUnknownItemStatus(item) {
613
+ if (!item) return;
614
+ const status = unknownItemStatus(item);
615
+ if (!status) return;
616
+ const safeStatus = redactCodexEventKind(status);
617
+ const safeItemType = redactCodexEventKind(item.type);
618
+ this.warnOnce(JSON.stringify([
619
+ "status",
620
+ item.type,
621
+ status
622
+ ]), "codex app-server item reported unknown status; continuing projection", {
623
+ itemId: item.id,
624
+ itemType: safeItemType,
625
+ status: safeStatus
626
+ });
485
627
  }
486
- if (item.type === "commandExecution") return "bash";
487
- if (item.type === "fileChange") return "apply_patch";
488
- if (item.type === "webSearch") return "web_search";
489
- }
490
- function auditNativeToolName(item) {
491
- if (item.type === "dynamicToolCall") return;
492
- const progressName = itemName(item);
493
- if (progressName) return progressName;
494
- if (item.type === "collabAgentToolCall") return typeof item.tool === "string" && item.tool.trim() ? `collab.${item.tool.trim()}` : "collab_agent";
495
- if (item.type === "imageGeneration") return "image_generation";
496
- if (item.type === "imageView") return "image_view";
497
- if (item.type === "sleep") return "sleep";
498
- }
499
- function isSideEffectingNativeToolItem(item) {
500
- return itemStatus(item) !== "blocked" && (isMutatingNativeToolItem(item) || item.type === "mcpToolCall");
501
- }
502
- function shouldSynthesizeToolProgressForItem(item) {
503
- switch (item.type) {
504
- case "commandExecution":
505
- case "fileChange":
506
- case "webSearch":
507
- case "mcpToolCall": return true;
508
- default: return false;
628
+ warnUnknownEvent(notification, params) {
629
+ const notificationThreadId = readCodexNotificationThreadId(params);
630
+ const notificationTurnId = readCodexNotificationTurnId(params);
631
+ const eventKind = redactCodexEventKind(notification.method);
632
+ this.warnOnce(JSON.stringify(["method", notification.method]), `codex app-server projector received unknown event kind; continuing: ${eventKind}`, {
633
+ eventKind,
634
+ activeThreadId: this.threadId,
635
+ activeTurnId: this.turnId,
636
+ threadId: notificationThreadId,
637
+ turnId: notificationTurnId,
638
+ matchesActiveThread: notificationThreadId === this.threadId,
639
+ matchesActiveTurn: notificationTurnId === this.turnId
640
+ });
509
641
  }
510
- }
511
- function shouldRecordNativeToolTranscript(item) {
512
- return shouldSynthesizeToolProgressForItem(item) && item.type !== "webSearch";
513
- }
514
- function isMutatingNativeToolItem(item) {
515
- if (item.type === "commandExecution") return true;
516
- return item.type === "fileChange" || item.type === "collabAgentToolCall" || item.type === "imageGeneration";
517
- }
518
- function shouldClearTerminalPresentationForNativeItem(item) {
519
- switch (item.type) {
520
- case "collabAgentToolCall":
521
- case "commandExecution":
522
- case "fileChange":
523
- case "imageGeneration":
524
- case "imageView":
525
- case "mcpToolCall":
526
- case "webSearch": return true;
527
- default: return false;
642
+ warnOnce(key, message, context) {
643
+ if (this.warningKeys.has(key)) return;
644
+ this.warningKeys.add(key);
645
+ embeddedAgentLog.warn(message, context);
528
646
  }
529
- }
647
+ };
530
648
  //#endregion
531
649
  //#region extensions/codex/src/app-server/event-projector-tool-output.ts
532
650
  const TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS = 1e4;
@@ -2662,6 +2780,7 @@ var CodexReasoningProjection = class {
2662
2780
  });
2663
2781
  }
2664
2782
  handleTurnPlanUpdated(params) {
2783
+ const explanation = readNullableString(params, "explanation");
2665
2784
  const plan = Array.isArray(params.plan) ? params.plan.flatMap((entry) => {
2666
2785
  if (!entry || typeof entry !== "object" || Array.isArray(entry)) return [];
2667
2786
  const record = entry;
@@ -2672,8 +2791,10 @@ var CodexReasoningProjection = class {
2672
2791
  status: normalizePlanStepStatus(readString$3(record, "status"))
2673
2792
  }];
2674
2793
  }) : void 0;
2794
+ const planText = [explanation, ...(plan ?? []).map(({ step, status }) => `- [${status}] ${step}`)].filter((part) => Boolean(part)).join("\n");
2795
+ if (planText) this.turnPlanText = planText;
2675
2796
  this.emitPlanUpdate({
2676
- explanation: readNullableString(params, "explanation"),
2797
+ explanation,
2677
2798
  steps: plan
2678
2799
  });
2679
2800
  }
@@ -2698,7 +2819,7 @@ var CodexReasoningProjection = class {
2698
2819
  return collectReasoningTextValues(this.reasoningTextByGroup, this.reasoningItemOrder).join("\n\n");
2699
2820
  }
2700
2821
  planText() {
2701
- return [...this.planTextByItem.values()].filter((text) => text.trim().length > 0).join("\n\n");
2822
+ return this.turnPlanText ?? [...this.planTextByItem.values()].filter((text) => text.trim().length > 0).join("\n\n");
2702
2823
  }
2703
2824
  emitPlanUpdate(params) {
2704
2825
  if (!params.explanation && (!params.steps || params.steps.length === 0)) return;
@@ -2735,6 +2856,11 @@ function readTokenCount(record, key) {
2735
2856
  const value = readNonNegativeInteger(record, key);
2736
2857
  return value !== void 0 && Number.isSafeInteger(value) ? value : void 0;
2737
2858
  }
2859
+ function readCodexThreadTokenUsage(params) {
2860
+ const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
2861
+ const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
2862
+ return last ? normalizeCodexThreadTokenUsage(last) : void 0;
2863
+ }
2738
2864
  function normalizeCodexThreadTokenUsage(record) {
2739
2865
  const inputTokens = readNumber(record, "inputTokens");
2740
2866
  const cacheRead = readNumber(record, "cachedInputTokens");
@@ -2851,7 +2977,8 @@ async function refreshCodexUsageLimitError(params) {
2851
2977
  const message = formatCodexUsageLimitErrorMessage({
2852
2978
  message: params.source.message,
2853
2979
  codexErrorInfo: params.source.codexErrorInfo,
2854
- rateLimits
2980
+ rateLimits,
2981
+ rateLimitsAuthoritative: true
2855
2982
  }) ?? initialMessage;
2856
2983
  return message ? {
2857
2984
  message,
@@ -2930,6 +3057,7 @@ var CodexAppServerEventProjector = class {
2930
3057
  this.synthesizedMissingToolResultError = null;
2931
3058
  this.aborted = false;
2932
3059
  this.completedCompactionCount = 0;
3060
+ this.diagnostics = new CodexProjectionDiagnostics(threadId, turnId);
2933
3061
  this.nativeToolLifecycleProjector = new CodexNativeToolLifecycleProjector(params, threadId, turnId, { runAbortSignal: options.runAbortSignal });
2934
3062
  this.generatedMediaProjection = new CodexGeneratedMediaProjection(params.config);
2935
3063
  this.toolProgressProjection = new CodexToolProgressProjection(params);
@@ -3020,7 +3148,7 @@ var CodexAppServerEventProjector = class {
3020
3148
  this.eventProjection.handleHook(notification.method, params);
3021
3149
  break;
3022
3150
  case "thread/tokenUsage/updated":
3023
- this.handleTokenUsage(params);
3151
+ this.tokenUsage = readCodexThreadTokenUsage(params) ?? this.tokenUsage;
3024
3152
  break;
3025
3153
  case "turn/completed":
3026
3154
  await this.handleTurnCompleted(params);
@@ -3037,7 +3165,21 @@ var CodexAppServerEventProjector = class {
3037
3165
  this.promptError = this.formatCodexErrorMessage(params) ?? "codex app-server error";
3038
3166
  this.promptErrorSource = "prompt";
3039
3167
  break;
3040
- default: break;
3168
+ case "thread/compacted":
3169
+ case "turn/started":
3170
+ case "turn/diff/updated":
3171
+ case "item/reasoning/summaryPartAdded":
3172
+ case "item/commandExecution/terminalInteraction":
3173
+ case "item/fileChange/outputDelta":
3174
+ case "item/fileChange/patchUpdated":
3175
+ case "item/mcpToolCall/progress":
3176
+ case "model/rerouted":
3177
+ case "model/verification":
3178
+ case "turn/moderationMetadata":
3179
+ case "model/safetyBuffering/updated": break;
3180
+ default:
3181
+ this.diagnostics.warnUnknownEvent(notification, params);
3182
+ break;
3041
3183
  }
3042
3184
  }
3043
3185
  buildResult(toolTelemetry, options) {
@@ -3112,6 +3254,7 @@ var CodexAppServerEventProjector = class {
3112
3254
  successfulCronAdds: toolTelemetry.successfulCronAdds,
3113
3255
  cloudCodeAssistFormatError: false,
3114
3256
  attemptUsage: projectedUsage,
3257
+ ...this.completedCompactionCount > 0 ? { compactionCount: this.completedCompactionCount } : {},
3115
3258
  replayMetadata: {
3116
3259
  hadPotentialSideEffects,
3117
3260
  replaySafe: !hadPotentialSideEffects
@@ -3119,8 +3262,7 @@ var CodexAppServerEventProjector = class {
3119
3262
  itemLifecycle: {
3120
3263
  startedCount: this.activeItemIds.size + this.completedItemIds.size,
3121
3264
  completedCount: this.completedItemIds.size,
3122
- activeCount: this.activeItemIds.size,
3123
- ...this.completedCompactionCount > 0 ? { compactionCount: this.completedCompactionCount } : {}
3265
+ activeCount: this.activeItemIds.size
3124
3266
  },
3125
3267
  yieldDetected: options?.yieldDetected || false,
3126
3268
  didSendDeterministicApprovalPrompt: this.eventProjection.guardianReviewCount > 0 ? false : void 0
@@ -3200,6 +3342,7 @@ var CodexAppServerEventProjector = class {
3200
3342
  }
3201
3343
  async handleItemCompleted(params) {
3202
3344
  const item = readItem(params.item);
3345
+ this.diagnostics.warnUnknownItemStatus(item);
3203
3346
  this.recordNativeToolOutcome(item);
3204
3347
  this.clearTerminalPresentationForNativeItem(item);
3205
3348
  const itemId = item?.id ?? readString$3(params, "itemId");
@@ -3264,13 +3407,6 @@ var CodexAppServerEventProjector = class {
3264
3407
  }
3265
3408
  });
3266
3409
  }
3267
- handleTokenUsage(params) {
3268
- const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
3269
- const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
3270
- if (!last) return;
3271
- const usage = normalizeCodexThreadTokenUsage(last);
3272
- if (usage) this.tokenUsage = usage;
3273
- }
3274
3410
  handleRawResponseCompleted(params) {
3275
3411
  const usage = isJsonObject(params.usage) ? params.usage : void 0;
3276
3412
  this.responseUsage = usage ? normalizeCodexResponseTokenUsage(usage) : void 0;
@@ -3300,6 +3436,7 @@ var CodexAppServerEventProjector = class {
3300
3436
  }
3301
3437
  }
3302
3438
  for (const item of turnItems) {
3439
+ this.diagnostics.warnUnknownItemStatus(item);
3303
3440
  this.assistantProjection.recordSnapshotItem(item);
3304
3441
  this.reasoningProjection.recordItem(item);
3305
3442
  this.generatedMediaProjection.recordNative(item);
@@ -3312,6 +3449,7 @@ var CodexAppServerEventProjector = class {
3312
3449
  this.toolProgressProjection.emitToolResultSummary(item);
3313
3450
  this.toolProgressProjection.emitToolResultOutput(item);
3314
3451
  }
3452
+ this.assistantProjection.finalizeAnswerCandidate(turn);
3315
3453
  this.activeCompactionItemIds.clear();
3316
3454
  await this.reasoningProjection.maybeEndReasoning();
3317
3455
  }
@@ -3668,6 +3806,7 @@ async function buildDynamicTools(input) {
3668
3806
  modelCompat: params.model.compat && typeof params.model.compat === "object" ? params.model.compat : void 0,
3669
3807
  modelApi: params.model.api,
3670
3808
  modelContextWindowTokens: params.model.contextWindow,
3809
+ delegationCapability: params.delegationCapability,
3671
3810
  modelAuthMode: resolveModelAuthMode(params.model.provider, params.config, params.toolAuthProfileStore ?? params.authProfileStore, { workspaceDir: input.effectiveWorkspace }),
3672
3811
  suppressManagedWebSearch: false,
3673
3812
  currentChannelId: params.currentChannelId,
@@ -6552,4 +6691,4 @@ function isCronAddAction(args) {
6552
6691
  return typeof action === "string" && action.trim().toLowerCase() === "add";
6553
6692
  }
6554
6693
  //#endregion
6555
- export { resolveCodexToolProgressDetailMode as $, CODEX_NATIVE_HOOK_RELAY_EVENTS as A, hasPendingDynamicToolTerminalDiagnostic as B, CodexAppServerEventProjector as C, markCodexAuthProfileBlockedFromRateLimits as D, isCodexUsageLimitPromptError as E, emitCodexNativePreToolUseFailureDiagnostic as F, shouldBlockTerminalReleaseForNonTerminalDynamicToolResult as G, isMatchingDynamicToolTerminalDiagnostic as H, resolveCodexNativeHookRelayEvents as I, toCodexDynamicToolProtocolResponse as J, shouldReleaseTurnAfterTerminalDynamicTool as K, resolveCodexNativeHookRelayTtlMs as L, buildCodexNativeHookRelayConfig as M, buildCodexNativeHookRelayDisabledConfig as N, refreshCodexUsageLimitPromptError as O, createCodexNativeHookRelay as P, inferCodexDynamicToolMeta as Q, scheduleCodexNativeHookRelayUnregister as R, filterToolsForVisionInputs as S, formatCodexTurnStartUsageLimitError as T, resolveDynamicToolCallTimeoutMs as U, isDynamicToolTerminalDiagnosticEvent as V, resolveTerminalDynamicToolBatchAction as W, readCodexMirroredSessionHistoryMessages as X, resolveCodexToolAbortTerminalReason as Y, shouldEmitTranscriptToolProgress as Z, resolveCodexMessageToolProvider as _, emitDynamicToolStartedDiagnostic as a, shouldRequireCodexSandboxExecServerEnvironment as b, resolveCodexProviderWebSearchSupportForClient as c, createCodexDynamicToolBuildStageTracker as d, sanitizeCodexToolArguments as et, disableCodexPluginThreadConfig as f, resolveCodexExternalSandboxPolicyForOpenClawSandbox as g, resolveCodexAppServerHookChannelId as h, emitDynamicToolErrorDiagnostic as i, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as j, CodexNativeToolLifecycleProjector as k, settleCodexSourceReplyFinality as l, resolveCodexAppServerExecutionCwd as m, handleCodexAppServerApprovalRequest as n, resolveCodexLocalRuntimeAttribution as nt, emitDynamicToolTerminalDiagnostic as o, formatCodexDynamicToolBuildStageSummary as p, toCodexDynamicToolProgressResponse as q, handleCodexAppServerElicitationRequest as r, resolveCodexProviderWebSearchSupport as s, createCodexDynamicToolBridge as t, sanitizeCodexToolResponse as tt, buildDynamicTools as u, resolveCodexSandboxEnvironmentSelection as v, createCodexUsageLimitPromptError as w, shouldWarnCodexDynamicToolBuildStageSummary as x, shouldEnableCodexAppServerNativeToolSurface as y, handleDynamicToolCallWithTimeout as z };
6694
+ export { resolveCodexToolProgressDetailMode as $, CODEX_NATIVE_HOOK_RELAY_EVENTS as A, hasPendingDynamicToolTerminalDiagnostic as B, CodexAppServerEventProjector as C, markCodexAuthProfileBlockedFromRateLimits as D, isCodexUsageLimitPromptError as E, emitCodexNativePreToolUseFailureDiagnostic as F, shouldBlockTerminalReleaseForNonTerminalDynamicToolResult as G, isMatchingDynamicToolTerminalDiagnostic as H, resolveCodexNativeHookRelayEvents as I, toCodexDynamicToolProtocolResponse as J, shouldReleaseTurnAfterTerminalDynamicTool as K, resolveCodexNativeHookRelayTtlMs as L, buildCodexNativeHookRelayConfig as M, buildCodexNativeHookRelayDisabledConfig as N, refreshCodexUsageLimitPromptError as O, createCodexNativeHookRelay as P, inferCodexDynamicToolMeta as Q, scheduleCodexNativeHookRelayUnregister as R, filterToolsForVisionInputs as S, formatCodexTurnStartUsageLimitError as T, resolveDynamicToolCallTimeoutMs as U, isDynamicToolTerminalDiagnosticEvent as V, resolveTerminalDynamicToolBatchAction as W, readCodexMirroredSessionHistoryMessages as X, resolveCodexToolAbortTerminalReason as Y, shouldEmitTranscriptToolProgress as Z, resolveCodexMessageToolProvider as _, emitDynamicToolStartedDiagnostic as a, shouldRequireCodexSandboxExecServerEnvironment as b, resolveCodexProviderWebSearchSupportForClient as c, createCodexDynamicToolBuildStageTracker as d, sanitizeCodexToolArguments as et, disableCodexPluginThreadConfig as f, resolveCodexExternalSandboxPolicyForOpenClawSandbox as g, resolveCodexAppServerHookChannelId as h, emitDynamicToolErrorDiagnostic as i, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as j, CodexNativeToolLifecycleProjector as k, settleCodexSourceReplyFinality as l, resolveCodexAppServerExecutionCwd as m, handleCodexAppServerApprovalRequest as n, redactCodexEventKind as nt, emitDynamicToolTerminalDiagnostic as o, formatCodexDynamicToolBuildStageSummary as p, toCodexDynamicToolProgressResponse as q, handleCodexAppServerElicitationRequest as r, resolveCodexLocalRuntimeAttribution as rt, resolveCodexProviderWebSearchSupport as s, createCodexDynamicToolBridge as t, sanitizeCodexToolResponse as tt, buildDynamicTools as u, resolveCodexSandboxEnvironmentSelection as v, createCodexUsageLimitPromptError as w, shouldWarnCodexDynamicToolBuildStageSummary as x, shouldEnableCodexAppServerNativeToolSurface as y, handleDynamicToolCallWithTimeout as z };
package/dist/harness.js CHANGED
@@ -25,9 +25,10 @@ function createCodexAppServerAgentHarness(options) {
25
25
  return {
26
26
  id: harnessRuntimeId,
27
27
  label: options?.label ?? "Codex agent harness",
28
+ autoSelection: { providerIds: [...providerIds] },
28
29
  delegatedExecutionPluginIds: ["voice-call"],
29
30
  contextEngineHostCapabilities: CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES,
30
- deliveryDefaults: { sourceVisibleReplies: "message_tool" },
31
+ deliveryDefaults: { visibleReplies: "message_tool" },
31
32
  authBootstrap: "harness",
32
33
  authBinding: { fingerprint: async (params) => {
33
34
  const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-C1czuHPA.js").then((n) => n.t);
@@ -38,7 +39,7 @@ function createCodexAppServerAgentHarness(options) {
38
39
  return validateCodexAppServerRuntimeArtifact(binding);
39
40
  } },
40
41
  fetchUsageSnapshot: async (ctx) => {
41
- const { fetchCodexAppServerUsageSnapshot } = await import("./usage-D5Rohxoc.js");
42
+ const { fetchCodexAppServerUsageSnapshot } = await import("./usage-CuPpFgTc.js");
42
43
  return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
43
44
  },
44
45
  supports: (ctx) => {
@@ -79,7 +80,7 @@ function createCodexAppServerAgentHarness(options) {
79
80
  };
80
81
  },
81
82
  runAttempt: async (params) => {
82
- const { runCodexAppServerAttempt } = await import("./run-attempt-MLzoMe_m.js");
83
+ const { runCodexAppServerAttempt } = await import("./run-attempt-BIoO8ISr.js");
83
84
  return runCodexAppServerAttempt(params, {
84
85
  bindingStore: options.bindingStore,
85
86
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -87,7 +88,7 @@ function createCodexAppServerAgentHarness(options) {
87
88
  });
88
89
  },
89
90
  runSideQuestion: async (params) => {
90
- const { runCodexAppServerSideQuestion } = await import("./side-question-DqDvIwSU.js");
91
+ const { runCodexAppServerSideQuestion } = await import("./side-question-DtzquMOb.js");
91
92
  return runCodexAppServerSideQuestion(params, {
92
93
  bindingStore: options.bindingStore,
93
94
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -95,14 +96,14 @@ function createCodexAppServerAgentHarness(options) {
95
96
  });
96
97
  },
97
98
  compact: async (params) => {
98
- const { maybeCompactCodexAppServerSession } = await import("./compact-DCTmg3id.js");
99
+ const { maybeCompactCodexAppServerSession } = await import("./compact-Kgy26gIM.js");
99
100
  return maybeCompactCodexAppServerSession(params, {
100
101
  bindingStore: options.bindingStore,
101
102
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
102
103
  });
103
104
  },
104
105
  compactAfterContextEngine: async (params) => {
105
- const { maybeCompactCodexAppServerSession } = await import("./compact-DCTmg3id.js");
106
+ const { maybeCompactCodexAppServerSession } = await import("./compact-Kgy26gIM.js");
106
107
  return maybeCompactCodexAppServerSession(params, {
107
108
  bindingStore: options.bindingStore,
108
109
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
@@ -111,7 +112,7 @@ function createCodexAppServerAgentHarness(options) {
111
112
  },
112
113
  reset: async (params) => {
113
114
  if (params.sessionId) {
114
- const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-h1mmCGnl.js").then((n) => n.l);
115
+ const { reclaimCurrentCodexSessionGeneration, sessionBindingIdentity } = await import("./session-binding-Bmt20HfB.js").then((n) => n.l);
115
116
  const identity = sessionBindingIdentity({
116
117
  agentId: params.agentId,
117
118
  sessionId: params.sessionId,