@openclaw/codex 2026.6.8 → 2026.6.9-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 (34) hide show
  1. package/dist/{notification-correlation-BGoG0N90.js → app-server-policy-KpyUye2D.js} +15 -74
  2. package/dist/attempt-notifications-Meja3TX6.js +249 -0
  3. package/dist/{client-factory-C71Xdb6z.js → client-factory-CPuoOOx6.js} +3 -2
  4. package/dist/{client-DovmVtbr.js → client-m7XiCQpO.js} +24 -2
  5. package/dist/{command-handlers-DHecBkuc.js → command-handlers-CqS0Kv3Z.js} +17 -13
  6. package/dist/{compact-GEKusemL.js → compact-CMVlldii.js} +5 -5
  7. package/dist/{computer-use-D1qxvTE_.js → computer-use-qLm7Gf35.js} +3 -3
  8. package/dist/{config-DJXpBkGf.js → config-BksX0T33.js} +160 -20
  9. package/dist/{conversation-binding-CbnMilVW.js → conversation-binding-DBof5w9J.js} +166 -58
  10. package/dist/doctor-contract-api.js +37 -3
  11. package/dist/harness.js +6 -6
  12. package/dist/index.js +108 -27
  13. package/dist/media-understanding-provider-CiwPkR58.js +463 -0
  14. package/dist/media-understanding-provider.js +1 -355
  15. package/dist/{models-DRKnOpzF.js → models-BsyV1Psm.js} +2 -2
  16. package/dist/{plugin-app-cache-key-kIqpGTQj.js → plugin-app-cache-key-CN9zBiCG.js} +17 -6
  17. package/dist/{protocol-oeJQu4rs.js → protocol-dh-ETiNd.js} +4 -1
  18. package/dist/{protocol-validators-B48C6S9O.js → protocol-validators-B19q5BIX.js} +210 -16
  19. package/dist/{native-hook-relay-C3i3FYtc.js → provider-capabilities-BOvTfMhF.js} +803 -78
  20. package/dist/{provider-C5P6352f.js → provider-qJygHQx4.js} +4 -4
  21. package/dist/provider.js +1 -1
  22. package/dist/{request-BxZ40QKY.js → request-DTIEyUrA.js} +2 -2
  23. package/dist/{run-attempt-D_q-VrpR.js → run-attempt-DRhB6bTc.js} +421 -774
  24. package/dist/{sandbox-guard-C-Yv9uwY.js → sandbox-guard-3tnjhjFb.js} +37 -10
  25. package/dist/{session-binding-ElbcSq2o.js → session-binding-BRUi8y6E.js} +27 -8
  26. package/dist/{shared-client-jFMumCOe.js → shared-client-Bg5d7VV9.js} +4 -4
  27. package/dist/{side-question-DqKLfWMB.js → side-question-BdYL4kj1.js} +106 -42
  28. package/dist/{thread-lifecycle-cban34w3.js → thread-lifecycle-CbJqqnEw.js} +912 -616
  29. package/dist/web-search-contract-api.js +10 -0
  30. package/dist/web-search-provider.runtime-DrpQ8Cyd.js +74 -0
  31. package/dist/web-search-provider.shared-BrZmlqyR.js +32 -0
  32. package/npm-shrinkwrap.json +2 -2
  33. package/openclaw.plugin.json +129 -4
  34. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
- import { n as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-DJXpBkGf.js";
2
- import { t as isJsonObject } from "./protocol-oeJQu4rs.js";
3
- import { a as hasCodexRateLimitSnapshots, c as summarizeCodexAccountRateLimits, u as summarizeCodexRateLimits } from "./provider-C5P6352f.js";
1
+ import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
+ import { n as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-BksX0T33.js";
3
+ import { a as hasCodexRateLimitSnapshots, c as summarizeCodexAccountRateLimits, u as summarizeCodexRateLimits } from "./provider-qJygHQx4.js";
4
4
  //#region extensions/codex/src/command-formatters.ts
5
5
  /** Formats the combined `/codex status` probe result. */
6
6
  function formatCodexStatus(probes) {
@@ -26,12 +26,12 @@ function formatThreads(response) {
26
26
  if (threads.length === 0) return "No Codex threads returned.";
27
27
  return ["Codex threads:", ...threads.slice(0, 10).map((thread) => {
28
28
  const record = isJsonObject(thread) ? thread : {};
29
- const id = readString$1(record, "threadId") ?? readString$1(record, "id") ?? "<unknown>";
30
- const title = readString$1(record, "title") ?? readString$1(record, "name") ?? readString$1(record, "summary");
29
+ const id = readString(record, "threadId") ?? readString(record, "id") ?? "<unknown>";
30
+ const title = readString(record, "title") ?? readString(record, "name") ?? readString(record, "summary");
31
31
  const details = [
32
- readString$1(record, "model"),
33
- readString$1(record, "cwd"),
34
- readString$1(record, "updatedAt") ?? readString$1(record, "lastUpdatedAt")
32
+ readString(record, "model"),
33
+ readString(record, "cwd"),
34
+ readString(record, "updatedAt") ?? readString(record, "lastUpdatedAt")
35
35
  ].filter((value) => Boolean(value));
36
36
  return `- ${formatCodexDisplayText(id)}${title ? ` - ${formatCodexDisplayText(title)}` : ""}${details.length > 0 ? ` (${details.map(formatCodexDisplayText).join(", ")})` : ""}\n Resume: ${formatCodexResumeHint(id)}`;
37
37
  })].join("\n");
@@ -81,7 +81,7 @@ function formatList(response, label) {
81
81
  if (entries.length === 0) return `${label}: none returned.`;
82
82
  return [`${label}:`, ...entries.slice(0, 25).map((entry) => {
83
83
  const record = isJsonObject(entry) ? entry : {};
84
- return `- ${formatCodexDisplayText(readString$1(record, "name") ?? readString$1(record, "id") ?? JSON.stringify(entry))}`;
84
+ return `- ${formatCodexDisplayText(readString(record, "name") ?? readString(record, "id") ?? JSON.stringify(entry))}`;
85
85
  })].join("\n");
86
86
  }
87
87
  /** Formats Codex skills grouped by scope, omitting disabled entries. */
@@ -109,7 +109,7 @@ function formatSkills(response) {
109
109
  return lines.join("\n");
110
110
  }
111
111
  function formatCodexSkillEntry(entry) {
112
- return `\`${formatCodexDisplayText(readString$1(isJsonObject(entry) ? entry : {}, "name") ?? "<unknown>")}\``;
112
+ return `\`${formatCodexDisplayText(readString(isJsonObject(entry) ? entry : {}, "name") ?? "<unknown>")}\``;
113
113
  }
114
114
  const CODEX_RESUME_SAFE_THREAD_ID_PATTERN = /^[A-Za-z0-9._:-]+$/;
115
115
  function formatCodexResumeHint(threadId) {
@@ -195,8 +195,8 @@ function buildHelp() {
195
195
  function summarizeAccount(value) {
196
196
  if (!isJsonObject(value)) return "unavailable";
197
197
  const account = isJsonObject(value.account) ? value.account : value;
198
- if (readString$1(account, "type") === "amazonBedrock") return "Amazon Bedrock";
199
- return readString$1(account, "email") ?? readString$1(account, "accountEmail") ?? readString$1(account, "planType") ?? readString$1(account, "id") ?? "available";
198
+ if (readString(account, "type") === "amazonBedrock") return "Amazon Bedrock";
199
+ return readString(account, "email") ?? readString(account, "accountEmail") ?? readString(account, "planType") ?? readString(account, "id") ?? "available";
200
200
  }
201
201
  function summarizeArrayLike(value) {
202
202
  const entries = extractArray(value);
@@ -244,7 +244,7 @@ function summarizeRateLimits(value) {
244
244
  }
245
245
  function isMeaningfulRateLimitSnapshot(value) {
246
246
  if (!isJsonObject(value)) return false;
247
- if (readString$1(value, "rateLimitReachedType") ?? readString$1(value, "rate_limit_reached_type")) return true;
247
+ if (readString(value, "rateLimitReachedType") ?? readString(value, "rate_limit_reached_type")) return true;
248
248
  return ["primary", "secondary"].some((key) => {
249
249
  const window = value[key];
250
250
  return isJsonObject(window) && Object.values(window).some((entry) => entry != null);
@@ -268,7 +268,7 @@ function extractArray(value) {
268
268
  return [];
269
269
  }
270
270
  /** Reads and trims a non-empty string field from a JSON object. */
271
- function readString$1(record, key) {
271
+ function readString(record, key) {
272
272
  const value = record[key];
273
273
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
274
274
  }
@@ -320,63 +320,4 @@ function normalizeModelBackedReviewerProvider(provider) {
320
320
  return provider?.trim().toLowerCase() || void 0;
321
321
  }
322
322
  //#endregion
323
- //#region extensions/codex/src/app-server/notification-correlation.ts
324
- /**
325
- * Correlates Codex app-server notifications with the active thread/turn so
326
- * projectors can ignore global or stale events without losing diagnostics.
327
- */
328
- /** Returns true when a notification payload belongs to the exact active thread and turn. */
329
- function isCodexNotificationForTurn(value, threadId, turnId) {
330
- if (!isJsonObject(value)) return false;
331
- return readCodexNotificationThreadId(value) === threadId && readCodexNotificationTurnId(value) === turnId;
332
- }
333
- /** Reads a thread id from either top-level notification params or nested turn payloads. */
334
- function readCodexNotificationThreadId(record) {
335
- return readNestedTurnThreadId(record) ?? readString(record, "threadId");
336
- }
337
- /** Reads a turn id from either top-level notification params or nested turn payloads. */
338
- function readCodexNotificationTurnId(record) {
339
- return readNestedTurnId(record) ?? readString(record, "turnId");
340
- }
341
- /** Builds structured correlation details for logs when notification routing is ambiguous. */
342
- function describeCodexNotificationCorrelation(notification, active) {
343
- const params = isJsonObject(notification.params) ? notification.params : void 0;
344
- const turn = params && isJsonObject(params.turn) ? params.turn : void 0;
345
- const threadId = params ? readString(params, "threadId") : void 0;
346
- const turnId = params ? readString(params, "turnId") : void 0;
347
- const nestedTurnThreadId = turn ? readString(turn, "threadId") : void 0;
348
- const nestedTurnId = turn ? readString(turn, "id") : void 0;
349
- const resolvedThreadId = params ? readCodexNotificationThreadId(params) : void 0;
350
- const resolvedTurnId = params ? readCodexNotificationTurnId(params) : void 0;
351
- const matchesActiveThread = resolvedThreadId === active.threadId;
352
- const matchesActiveTurn = active.turnId ? matchesActiveThread && resolvedTurnId === active.turnId : void 0;
353
- const items = turn?.items;
354
- return {
355
- method: notification.method,
356
- ...params ? { paramsKeys: Object.keys(params).toSorted() } : {},
357
- activeThreadId: active.threadId,
358
- ...active.turnId ? { activeTurnId: active.turnId } : {},
359
- ...threadId ? { threadId } : {},
360
- ...turnId ? { turnId } : {},
361
- ...nestedTurnThreadId ? { nestedTurnThreadId } : {},
362
- ...nestedTurnId ? { nestedTurnId } : {},
363
- ...turn ? { turnStatus: readString(turn, "status") } : {},
364
- ...Array.isArray(items) ? { turnItemCount: items.length } : {},
365
- matchesActiveThread,
366
- ...matchesActiveTurn === void 0 ? {} : { matchesActiveTurn }
367
- };
368
- }
369
- function readNestedTurnId(record) {
370
- const turn = record.turn;
371
- return isJsonObject(turn) ? readString(turn, "id") : void 0;
372
- }
373
- function readNestedTurnThreadId(record) {
374
- const turn = record.turn;
375
- return isJsonObject(turn) ? readString(turn, "threadId") : void 0;
376
- }
377
- function readString(record, key) {
378
- const value = record[key];
379
- return typeof value === "string" && value.trim() ? value.trim() : void 0;
380
- }
381
- //#endregion
382
- export { resolveCodexAppServerForModelProvider as a, formatAccount as c, formatComputerUseStatus as d, formatList as f, readString$1 as g, formatThreads as h, readCodexNotificationTurnId as i, formatCodexDisplayText as l, formatSkills as m, isCodexNotificationForTurn as n, resolveCodexAppServerForOpenClawToolPolicy as o, formatModels as p, readCodexNotificationThreadId as r, buildHelp as s, describeCodexNotificationCorrelation as t, formatCodexStatus as u };
323
+ export { formatCodexDisplayText as a, formatList as c, formatThreads as d, readString as f, formatAccount as i, formatModels as l, resolveCodexAppServerForOpenClawToolPolicy as n, formatCodexStatus as o, buildHelp as r, formatComputerUseStatus as s, resolveCodexAppServerForModelProvider as t, formatSkills as u };
@@ -0,0 +1,249 @@
1
+ import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
+ import { z as isCodexNotificationForTurn } from "./thread-lifecycle-CbJqqnEw.js";
3
+ import { asBoolean } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ //#region extensions/codex/src/app-server/attempt-notifications.ts
5
+ /**
6
+ * Predicates and readers for Codex app-server notification envelopes.
7
+ */
8
+ const CODEX_TURN_ABORT_MARKER_START = "<turn_aborted>";
9
+ const CODEX_TURN_ABORT_MARKER_END = "</turn_aborted>";
10
+ const CODEX_INTERRUPTED_USER_GUIDANCE = "The user interrupted the previous turn on purpose. Any running unified exec processes may still be running in the background. If any tools/commands were aborted, they may have partially executed.";
11
+ const CODEX_INTERRUPTED_DEVELOPER_GUIDANCE = "The previous turn was interrupted on purpose. Any running unified exec processes may still be running in the background. If any tools/commands were aborted, they may have partially executed.";
12
+ /** Builds compact activity metadata for watchdog and diagnostic updates. */
13
+ function describeNotificationActivity(notification) {
14
+ if (!isJsonObject(notification.params)) return { lastNotificationMethod: notification.method };
15
+ if (notification.method !== "rawResponseItem/completed") return { lastNotificationMethod: notification.method };
16
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
17
+ if (!item) return { lastNotificationMethod: notification.method };
18
+ return {
19
+ lastNotificationMethod: notification.method,
20
+ lastNotificationItemId: readString(item, "id"),
21
+ lastNotificationItemType: readString(item, "type"),
22
+ lastNotificationItemRole: readString(item, "role"),
23
+ lastAssistantTextPreview: readRawAssistantTextPreview(item)
24
+ };
25
+ }
26
+ /** Tracks active app-server item ids from item start/completion notifications. */
27
+ function updateActiveTurnItemIds(notification, activeItemIds) {
28
+ if (notification.method !== "item/started" && notification.method !== "item/completed") return;
29
+ const itemId = readNotificationItemId(notification);
30
+ if (!itemId) return;
31
+ if (notification.method === "item/started") {
32
+ activeItemIds.add(itemId);
33
+ return;
34
+ }
35
+ activeItemIds.delete(itemId);
36
+ }
37
+ function isCompletedAssistantNotification(notification) {
38
+ if (!isJsonObject(notification.params)) return false;
39
+ if (notification.method !== "item/completed") return false;
40
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
41
+ return Boolean(item && readString(item, "type") === "agentMessage" && readString(item, "phase") !== "commentary");
42
+ }
43
+ /** Returns true for completed app-server reasoning items. */
44
+ function isReasoningItemCompletionNotification(notification) {
45
+ if (!isJsonObject(notification.params) || notification.method !== "item/completed") return false;
46
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
47
+ return item ? readString(item, "type") === "reasoning" : false;
48
+ }
49
+ /** Returns true for completed assistant commentary items. */
50
+ function isAssistantCommentaryCompletionNotification(notification) {
51
+ if (!isJsonObject(notification.params) || notification.method !== "item/completed") return false;
52
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
53
+ return Boolean(item && readString(item, "type") === "agentMessage" && readString(item, "phase") === "commentary");
54
+ }
55
+ /** Returns true for completed raw response reasoning items. */
56
+ function isRawReasoningCompletionNotification(notification) {
57
+ if (!isJsonObject(notification.params) || notification.method !== "rawResponseItem/completed") return false;
58
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
59
+ return item ? readString(item, "type") === "reasoning" : false;
60
+ }
61
+ /** Returns true for streamed app-server reasoning progress. */
62
+ function isReasoningProgressNotification(notification) {
63
+ return notification.method === "item/reasoning/textDelta" || notification.method === "item/reasoning/summaryTextDelta" || notification.method === "item/reasoning/summaryPartAdded";
64
+ }
65
+ /** Returns true when assistant completion can release the short idle watch. */
66
+ function isAssistantCompletionReleaseNotification(notification, turnCrossedToolHandoff) {
67
+ if (isCompletedAssistantNotification(notification)) return true;
68
+ return !turnCrossedToolHandoff && isRawAssistantCompletionNotification(notification);
69
+ }
70
+ /** Returns true when a notification proves assistant output is still active. */
71
+ function shouldDisarmAssistantCompletionIdleWatch(notification) {
72
+ if (!isJsonObject(notification.params)) return false;
73
+ if (notification.method === "item/started") return true;
74
+ if (notification.method === "item/agentMessage/delta") return true;
75
+ return false;
76
+ }
77
+ /** Reads an item id from supported notification envelope shapes. */
78
+ function readNotificationItemId(notification) {
79
+ if (!isJsonObject(notification.params)) return;
80
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
81
+ return (item ? readString(item, "id") : void 0) ?? readString(notification.params, "itemId") ?? readString(notification.params, "id");
82
+ }
83
+ /** Detects completion for an OpenClaw dynamic tool result still awaited by Codex. */
84
+ function isPendingOpenClawDynamicToolCompletionNotification(notification, pendingOpenClawDynamicToolCompletionIds) {
85
+ if (notification.method !== "item/completed" || !isJsonObject(notification.params)) return false;
86
+ const itemId = readNotificationItemId(notification);
87
+ if (!itemId || !pendingOpenClawDynamicToolCompletionIds.has(itemId)) return false;
88
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
89
+ const itemType = item ? readString(item, "type") : void 0;
90
+ return itemType === void 0 || itemType === "dynamicToolCall";
91
+ }
92
+ /** Returns true for raw response tool-output completion notifications. */
93
+ function isRawToolOutputCompletionNotification(notification) {
94
+ if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
95
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
96
+ return item ? readString(item, "type") === "custom_tool_call_output" : false;
97
+ }
98
+ /** Returns true for progress on Codex-native tool item types. */
99
+ function isNativeToolProgressNotification(notification) {
100
+ if (notification.method !== "item/started" && notification.method !== "item/completed" && notification.method !== "item/updated") return false;
101
+ if (!isJsonObject(notification.params)) return false;
102
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
103
+ switch (item ? readString(item, "type") : void 0) {
104
+ case "commandExecution":
105
+ case "fileChange":
106
+ case "mcpToolCall":
107
+ case "webSearch": return true;
108
+ default: return false;
109
+ }
110
+ }
111
+ /** Returns true for raw native response stream delta events. */
112
+ function isNativeResponseStreamDeltaNotification(notification) {
113
+ return notification.method.startsWith("response.") && notification.method.endsWith(".delta");
114
+ }
115
+ /** Returns true for file-change patch update notifications. */
116
+ function isFileChangePatchUpdatedNotification(notification) {
117
+ return notification.method === "item/fileChange/patchUpdated" && isJsonObject(notification.params);
118
+ }
119
+ /** Returns true for raw assistant message progress with readable text. */
120
+ function isRawAssistantProgressNotification(notification) {
121
+ if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
122
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
123
+ return Boolean(item && readString(item, "type") === "message" && readString(item, "role") === "assistant" && readRawAssistantTextPreview(item));
124
+ }
125
+ /** Returns true for raw assistant completion outside commentary phase. */
126
+ function isRawAssistantCompletionNotification(notification) {
127
+ if (!isRawAssistantProgressNotification(notification) || !isJsonObject(notification.params)) return false;
128
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
129
+ return Boolean(item && readString(item, "phase") !== "commentary");
130
+ }
131
+ function readRawAssistantTextPreview(item) {
132
+ if (readString(item, "role") !== "assistant" || !Array.isArray(item.content)) return;
133
+ const text = item.content.flatMap((content) => {
134
+ if (!isJsonObject(content)) return [];
135
+ const contentText = readString(content, "text");
136
+ return contentText ? [contentText] : [];
137
+ }).join("\n").trim();
138
+ if (!text) return;
139
+ return text.length > 240 ? `${text.slice(0, 237)}...` : text;
140
+ }
141
+ /** Returns true when notification params correlate to a specific thread/turn. */
142
+ function isTurnNotification(value, threadId, turnId) {
143
+ return isCodexNotificationForTurn(value, threadId, turnId);
144
+ }
145
+ /** Returns true when a correlated notification belongs to another active run. */
146
+ function isCodexNotificationOutsideActiveRun(correlation) {
147
+ if (!Boolean(correlation.threadId || correlation.nestedTurnThreadId)) return false;
148
+ if (!correlation.matchesActiveThread) return true;
149
+ return Boolean(correlation.turnId || correlation.nestedTurnId) && correlation.matchesActiveTurn === false;
150
+ }
151
+ /** Checks request params that must contain the current thread and turn ids. */
152
+ function isCurrentThreadTurnRequestParams(value, threadId, turnId) {
153
+ if (!isJsonObject(value)) return false;
154
+ return readString(value, "threadId") === threadId && readString(value, "turnId") === turnId;
155
+ }
156
+ /** Checks approval request params, accepting `conversationId` as thread id. */
157
+ function isCurrentApprovalTurnRequestParams(value, threadId, turnId) {
158
+ if (!isJsonObject(value)) return false;
159
+ return (readString(value, "threadId") ?? readString(value, "conversationId")) === threadId && readString(value, "turnId") === turnId;
160
+ }
161
+ /** Checks request params where `turnId` may be omitted or null for the thread. */
162
+ function isCurrentThreadOptionalTurnRequestParams(value, threadId, turnId) {
163
+ if (!isJsonObject(value) || readString(value, "threadId") !== threadId) return false;
164
+ const requestTurnId = value.turnId;
165
+ return requestTurnId === null || requestTurnId === void 0 || requestTurnId === turnId;
166
+ }
167
+ /** Returns true for app-server error notifications that will retry. */
168
+ function isRetryableErrorNotification(value) {
169
+ if (!isJsonObject(value)) return false;
170
+ return readBoolean(value, "willRetry") === true || readBoolean(value, "will_retry") === true;
171
+ }
172
+ /** Returns true for terminal app-server thread status strings. */
173
+ function isTerminalTurnStatus(status) {
174
+ return status === "completed" || status === "interrupted" || status === "failed";
175
+ }
176
+ /**
177
+ * Detects Codex's synthetic interrupted-turn marker while ignoring the current
178
+ * user prompt echoed through raw response events.
179
+ */
180
+ function isCodexTurnAbortMarkerNotification(notification, options = {}) {
181
+ if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
182
+ const item = notification.params.item;
183
+ const role = isJsonObject(item) ? readString(item, "role") : void 0;
184
+ if (!isJsonObject(item) || role !== "user" && role !== "developer") return false;
185
+ const text = extractRawResponseItemText(item).trim();
186
+ const currentPromptTexts = [options.currentPromptText, ...options.currentPromptTexts ?? []].filter(isNonEmptyString).map((prompt) => prompt.trim());
187
+ if (role === "user" && currentPromptTexts.includes(text)) return false;
188
+ const markerBody = readCodexTurnAbortMarkerBody(text);
189
+ return markerBody === CODEX_INTERRUPTED_USER_GUIDANCE || markerBody === CODEX_INTERRUPTED_DEVELOPER_GUIDANCE;
190
+ }
191
+ function readCodexTurnAbortMarkerBody(text) {
192
+ if (!text.startsWith(CODEX_TURN_ABORT_MARKER_START) || !text.endsWith(CODEX_TURN_ABORT_MARKER_END)) return;
193
+ return text.slice(14, -15).trim();
194
+ }
195
+ function extractRawResponseItemText(item) {
196
+ const content = item.content;
197
+ if (!Array.isArray(content)) return "";
198
+ return content.flatMap((entry) => {
199
+ if (!isJsonObject(entry)) return [];
200
+ const type = readString(entry, "type");
201
+ if (type !== "input_text" && type !== "text") return [];
202
+ const text = readString(entry, "text");
203
+ return text ? [text] : [];
204
+ }).join("");
205
+ }
206
+ function readString(record, key) {
207
+ const value = record[key];
208
+ return typeof value === "string" ? value : void 0;
209
+ }
210
+ function readBoolean(record, key) {
211
+ return asBoolean(record[key]);
212
+ }
213
+ /** Reads a typed Codex item from notification params when id/type are present. */
214
+ function readCodexNotificationItem(params) {
215
+ if (!isJsonObject(params) || !isJsonObject(params.item)) return;
216
+ const item = params.item;
217
+ return typeof item.id === "string" && typeof item.type === "string" ? item : void 0;
218
+ }
219
+ /** Reads the stable call id from a model-emitted raw tool item. */
220
+ function readRawResponseToolCallId(notification) {
221
+ if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return;
222
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
223
+ if (!item) return;
224
+ switch (readString(item, "type")) {
225
+ case "custom_tool_call":
226
+ case "function_call":
227
+ case "local_shell_call":
228
+ case "tool_search_call": return readString(item, "call_id");
229
+ case "image_generation_call":
230
+ case "web_search_call": return readString(item, "id");
231
+ default: return;
232
+ }
233
+ }
234
+ /** Maps Codex item types to the tool name shown in execution progress. */
235
+ function codexExecutionToolName(item) {
236
+ if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
237
+ if (item.type === "mcpToolCall" && typeof item.tool === "string") {
238
+ const server = typeof item.server === "string" && item.server ? item.server : void 0;
239
+ return server ? `${server}.${item.tool}` : item.tool;
240
+ }
241
+ if (item.type === "commandExecution") return "bash";
242
+ if (item.type === "fileChange") return "apply_patch";
243
+ if (item.type === "webSearch") return "web_search";
244
+ }
245
+ function isNonEmptyString(value) {
246
+ return typeof value === "string" && value.length > 0;
247
+ }
248
+ //#endregion
249
+ export { readNotificationItemId as C, updateActiveTurnItemIds as E, readCodexNotificationItem as S, shouldDisarmAssistantCompletionIdleWatch as T, isReasoningItemCompletionNotification as _, isCodexNotificationOutsideActiveRun as a, isTerminalTurnStatus as b, isCurrentThreadOptionalTurnRequestParams as c, isNativeResponseStreamDeltaNotification as d, isNativeToolProgressNotification as f, isRawToolOutputCompletionNotification as g, isRawReasoningCompletionNotification as h, isAssistantCompletionReleaseNotification as i, isCurrentThreadTurnRequestParams as l, isRawAssistantProgressNotification as m, describeNotificationActivity as n, isCodexTurnAbortMarkerNotification as o, isPendingOpenClawDynamicToolCompletionNotification as p, isAssistantCommentaryCompletionNotification as r, isCurrentApprovalTurnRequestParams as s, codexExecutionToolName as t, isFileChangePatchUpdatedNotification as u, isReasoningProgressNotification as v, readRawResponseToolCallId as w, isTurnNotification as x, isRetryableErrorNotification as y };
@@ -1,7 +1,7 @@
1
1
  //#region extensions/codex/src/app-server/client-factory.ts
2
2
  let sharedClientModulePromise = null;
3
3
  const loadSharedClientModule = async () => {
4
- sharedClientModulePromise ??= import("./shared-client-jFMumCOe.js").then((n) => n.c);
4
+ sharedClientModulePromise ??= import("./shared-client-Bg5d7VV9.js").then((n) => n.c);
5
5
  return await sharedClientModulePromise;
6
6
  };
7
7
  /** Returns a leased shared client so startup can release ownership explicitly. */
@@ -11,7 +11,8 @@ const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, a
11
11
  agentDir,
12
12
  config,
13
13
  onStartedClient: options?.onStartedClient,
14
- abandonSignal: options?.abandonSignal
14
+ abandonSignal: options?.abandonSignal,
15
+ timeoutMs: options?.timeoutMs
15
16
  }));
16
17
  //#endregion
17
18
  export { defaultLeasedCodexAppServerClientFactory as t };
@@ -1,5 +1,5 @@
1
- import { d as resolveCodexAppServerRuntimeOptions } from "./config-DJXpBkGf.js";
2
- import { n as isRpcResponse } from "./protocol-oeJQu4rs.js";
1
+ import { r as isRpcResponse } from "./protocol-dh-ETiNd.js";
2
+ import { d as resolveCodexAppServerRuntimeOptions } from "./config-BksX0T33.js";
3
3
  import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
4
4
  import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
5
5
  import { createInterface } from "node:readline";
@@ -318,6 +318,7 @@ var CodexAppServerClient = class CodexAppServerClient {
318
318
  capabilities: { experimentalApi: true }
319
319
  });
320
320
  this.serverVersion = assertSupportedCodexAppServerVersion(response);
321
+ this.runtimeIdentity = buildCodexAppServerRuntimeIdentity(response, this.serverVersion);
321
322
  this.notify("initialized");
322
323
  this.initialized = true;
323
324
  }
@@ -325,6 +326,10 @@ var CodexAppServerClient = class CodexAppServerClient {
325
326
  getServerVersion() {
326
327
  return this.serverVersion;
327
328
  }
329
+ /** Returns runtime metadata detected during initialize. */
330
+ getRuntimeIdentity() {
331
+ return this.runtimeIdentity ? { ...this.runtimeIdentity } : void 0;
332
+ }
328
333
  request(method, params, optionsInput) {
329
334
  let options = optionsInput;
330
335
  options ??= {};
@@ -632,6 +637,23 @@ function assertSupportedCodexAppServerVersion(response) {
632
637
  if (compareCodexAppServerVersions(detectedVersion, "0.125.0") < 0) throw new Error(`Codex app-server ${MIN_CODEX_APP_SERVER_VERSION} or newer is required, but detected ${detectedVersion}. Update the configured Codex app-server binary, or remove custom command overrides to use the managed binary.`);
633
638
  return detectedVersion;
634
639
  }
640
+ function buildCodexAppServerRuntimeIdentity(response, serverVersion) {
641
+ const userAgent = readNonEmptyInitializeString(response.userAgent);
642
+ const codexHome = readNonEmptyInitializeString(response.codexHome);
643
+ const platformFamily = readNonEmptyInitializeString(response.platformFamily);
644
+ const platformOs = readNonEmptyInitializeString(response.platformOs);
645
+ return {
646
+ serverVersion,
647
+ ...userAgent ? { userAgent } : {},
648
+ ...codexHome ? { codexHome } : {},
649
+ ...platformFamily ? { platformFamily } : {},
650
+ ...platformOs ? { platformOs } : {}
651
+ };
652
+ }
653
+ function readNonEmptyInitializeString(value) {
654
+ const trimmed = value?.trim();
655
+ return trimmed ? trimmed : void 0;
656
+ }
635
657
  /** Extracts the Codex version from the app-server initialize user-agent field. */
636
658
  function readCodexVersionFromUserAgent(userAgent) {
637
659
  return (userAgent?.match(/^[^/]+\/(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)(?:[\s(]|$)/))?.[1];
@@ -1,19 +1,19 @@
1
- import { d as resolveCodexAppServerRuntimeOptions, o as isCodexFastServiceTier } from "./config-DJXpBkGf.js";
2
- import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-DRKnOpzF.js";
3
- import { t as isJsonObject } from "./protocol-oeJQu4rs.js";
4
- import { l as summarizeCodexAccountUsage } from "./provider-C5P6352f.js";
5
- import { l as writeCodexAppServerBinding, n as clearCodexAppServerBinding, o as readCodexAppServerBinding } from "./session-binding-ElbcSq2o.js";
6
- import { n as CODEX_CONTROL_METHODS, r as describeControlFailure } from "./plugin-app-cache-key-kIqpGTQj.js";
7
- import { c as formatAccount, d as formatComputerUseStatus, f as formatList, g as readString$1, h as formatThreads, l as formatCodexDisplayText, m as formatSkills, p as formatModels, s as buildHelp, u as formatCodexStatus } from "./notification-correlation-BGoG0N90.js";
8
- import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-C-Yv9uwY.js";
9
- import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-CbnMilVW.js";
10
- import { t as requestCodexAppServerJson } from "./request-BxZ40QKY.js";
11
- import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-D1qxvTE_.js";
1
+ import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
+ import { d as resolveCodexAppServerRuntimeOptions, o as isCodexFastServiceTier } from "./config-BksX0T33.js";
3
+ import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-BsyV1Psm.js";
4
+ import { l as summarizeCodexAccountUsage } from "./provider-qJygHQx4.js";
5
+ import { l as writeCodexAppServerBinding, n as clearCodexAppServerBinding, o as readCodexAppServerBinding } from "./session-binding-BRUi8y6E.js";
6
+ import { i as describeControlFailure, r as CODEX_CONTROL_METHODS } from "./plugin-app-cache-key-CN9zBiCG.js";
7
+ import { a as formatCodexDisplayText, c as formatList, d as formatThreads, f as readString$1, i as formatAccount, l as formatModels, o as formatCodexStatus, r as buildHelp, s as formatComputerUseStatus, u as formatSkills } from "./app-server-policy-KpyUye2D.js";
8
+ import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-3tnjhjFb.js";
9
+ import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-DBof5w9J.js";
10
+ import { t as requestCodexAppServerJson } from "./request-DTIEyUrA.js";
11
+ import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-qLm7Gf35.js";
12
12
  import { n as rememberCodexRateLimits } from "./rate-limit-cache-C7qmZ0Jh.js";
13
13
  import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
14
+ import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
14
15
  import crypto from "node:crypto";
15
16
  import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAgentDir, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveDefaultAgentDir, resolveProfileUnusableUntilForDisplay, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
16
- import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
17
17
  //#region extensions/codex/src/command-account.ts
18
18
  const OPENAI_PROVIDER_ID = "openai";
19
19
  const OPENAI_CODEX_PROVIDER_ID = OPENAI_PROVIDER_ID;
@@ -864,6 +864,7 @@ async function bindConversation(deps, ctx, pluginConfig, args) {
864
864
  workspaceDir,
865
865
  agentDir: scope.agentDir,
866
866
  sessionKey: ctx.sessionKey,
867
+ agentId: scope.sessionAgentId,
867
868
  threadId: parsed.threadId,
868
869
  model: parsed.model,
869
870
  modelProvider: parsed.provider
@@ -1078,7 +1079,10 @@ function resolveCodexConversationControlScope(ctx) {
1078
1079
  sessionKey: ctx.sessionKey,
1079
1080
  config: ctx.config
1080
1081
  });
1081
- return { agentDir: resolveAgentDir(ctx.config, sessionAgentId) };
1082
+ return {
1083
+ agentDir: resolveAgentDir(ctx.config, sessionAgentId),
1084
+ sessionAgentId
1085
+ };
1082
1086
  }
1083
1087
  async function handleCodexDiagnosticsFeedback(deps, ctx, pluginConfig, args, commandPrefix) {
1084
1088
  if (ctx.senderIsOwner !== true) return { text: "Only an owner can send Codex diagnostics." };
@@ -1,8 +1,8 @@
1
- import { d as resolveCodexAppServerRuntimeOptions } from "./config-DJXpBkGf.js";
2
- import { c as withCodexAppServerBindingLock, l as writeCodexAppServerBinding, o as readCodexAppServerBinding, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-ElbcSq2o.js";
3
- import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-jFMumCOe.js";
4
- import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-C-Yv9uwY.js";
5
- import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-C71Xdb6z.js";
1
+ import { d as resolveCodexAppServerRuntimeOptions } from "./config-BksX0T33.js";
2
+ import { c as withCodexAppServerBindingLock, l as writeCodexAppServerBinding, o as readCodexAppServerBinding, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-BRUi8y6E.js";
3
+ import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-Bg5d7VV9.js";
4
+ import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-3tnjhjFb.js";
5
+ import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-CPuoOOx6.js";
6
6
  import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
7
7
  //#region extensions/codex/src/app-server/compact.ts
8
8
  /**
@@ -1,6 +1,6 @@
1
- import { d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig } from "./config-DJXpBkGf.js";
2
- import { r as describeControlFailure } from "./plugin-app-cache-key-kIqpGTQj.js";
3
- import { t as requestCodexAppServerJson } from "./request-BxZ40QKY.js";
1
+ import { d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig } from "./config-BksX0T33.js";
2
+ import { i as describeControlFailure } from "./plugin-app-cache-key-CN9zBiCG.js";
3
+ import { t as requestCodexAppServerJson } from "./request-DTIEyUrA.js";
4
4
  import { existsSync } from "node:fs";
5
5
  //#region extensions/codex/src/app-server/computer-use.ts
6
6
  /**