@openclaw/codex 2026.9.3 → 2026.9.4

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 (97) hide show
  1. package/dist/api.js +26 -18
  2. package/dist/{apply-B6el6hdO.js → apply-CvT8tW5i.js} +11 -12
  3. package/dist/{attempt-client-cleanup-D6cR54TV.js → attempt-client-cleanup-DKHzbwt5.js} +8 -204
  4. package/dist/{attempt-context-AO4DSjE0.js → attempt-context-D44yeDII.js} +3 -3
  5. package/dist/{attempt-notifications--H8zXR5-.js → attempt-notifications-C9XufG6l.js} +1 -1
  6. package/dist/{auth-binding-Co2Vfcf_.js → auth-binding-CWlKVccJ.js} +1 -1
  7. package/dist/{auth-cache-key-Kq6oerr6.js → auth-cache-key-7orQae_j.js} +2 -2
  8. package/dist/{binding-connection-QqgcPCgk.js → binding-connection-D3udKbIE.js} +3 -3
  9. package/dist/{bounded-turn-lRpmZHFv.js → bounded-turn-C_Hneydj.js} +12 -12
  10. package/dist/{build-state-6RL6qohz.js → build-state-BCmg9-5p.js} +1 -1
  11. package/dist/{capabilities-BeqLPbtM.js → capabilities-8vx68WLH.js} +1 -1
  12. package/dist/cli-metadata.js +1 -1
  13. package/dist/{client-BEKu4yDx.js → client-B57KWPQx.js} +27 -5
  14. package/dist/{command-dispatch-CisT9Jqq.js → command-dispatch-BpduNGVf.js} +3 -3
  15. package/dist/{command-formatters-DeTfrapr.js → command-formatters-lxlkNZgU.js} +4 -3
  16. package/dist/{command-handlers-BfIsJEuA.js → command-handlers-tiL9iWj7.js} +783 -140
  17. package/dist/{command-rpc-BMqRQOFX.js → command-rpc-CR5EOEZX.js} +26 -19
  18. package/dist/{compact-CGJZ2rlb.js → compact-B_H3AOd7.js} +14 -14
  19. package/dist/{config-JDfTI4VI.js → config-oIORaQ5T.js} +4 -4
  20. package/dist/{config-options-jnIFvwxD.js → config-options-CXMq1T-C.js} +5 -5
  21. package/dist/{config-runtime-BWf6JLWG.js → config-runtime-D0zGNIHu.js} +1 -1
  22. package/dist/{config-utils-C57JiJrU.js → config-utils-DujwEnhg.js} +2 -4
  23. package/dist/{conversation-binding-CxOlHiix.js → conversation-binding-DsB4-O7U.js} +53 -42
  24. package/dist/{conversation-control-CUCrSIQI.js → conversation-control-CtUu1b3m.js} +8 -8
  25. package/dist/doctor-contract-api.js +1 -1
  26. package/dist/{dynamic-tools-D-JBoaLt.js → dynamic-tools-CmN5RAip.js} +76 -15
  27. package/dist/{effective-mcp-catalog-J_5Ep5Um.js → effective-mcp-catalog-Bd73bqA8.js} +3 -3
  28. package/dist/{ephemeral-turn-DSwzP8YY.js → ephemeral-turn-D78_VmzO.js} +5 -5
  29. package/dist/event-projector-items-5VhsECCO.js +200 -0
  30. package/dist/{event-projector-usage-CIyrYYid.js → event-projector-usage-BfXmpOec.js} +1 -1
  31. package/dist/{harness-FR6eQgyO.js → harness-C7rRa7bm.js} +33 -16
  32. package/dist/harness.js +1 -1
  33. package/dist/index.js +39 -84
  34. package/dist/inference-context-Dr_mzvk4.js +94 -0
  35. package/dist/inference-proxy-HGXKUIre.js +311 -0
  36. package/dist/{isolated-completion-DHBefrzg.js → isolated-completion-DWVb5U2J.js} +6 -6
  37. package/dist/{managed-binary-DrjjRRUD.js → managed-binary-D22rNEcR.js} +10 -1
  38. package/dist/media-understanding-provider.js +2 -2
  39. package/dist/migration-provider-api.js +2 -0
  40. package/dist/{model-catalog-B_6M04Wo.js → model-catalog-Dq2n8f_p.js} +6 -6
  41. package/dist/{models-P9k2qAof.js → models-PCKOim-h.js} +3 -3
  42. package/dist/native-subagent-history-DjtPloaU.js +140 -0
  43. package/dist/native-subagent-history-owner-Pcp7JuVF.js +34 -0
  44. package/dist/{native-subagent-monitor-BbCUKRwC.js → native-subagent-monitor-fQ7eIXEf.js} +52 -424
  45. package/dist/native-subagent-task-ids-BzTdT0Uw.js +387 -0
  46. package/dist/{node-cli-sessions-rj0ysJwM.js → node-cli-sessions-DKaOmVUh.js} +1 -1
  47. package/dist/{node-exec-server.runtime-BY_ctYnT.js → node-exec-server.runtime-Cl2vapEi.js} +3 -3
  48. package/dist/{plan-BMJdMOEF.js → plan-7uG-Fp36.js} +288 -52
  49. package/dist/{plugin-activation-BQK-f5sV.js → plugin-activation-BYQculil.js} +24 -19
  50. package/dist/{plugin-app-cache-key-CdSQzWyX.js → plugin-app-cache-key-d0eKxy7b.js} +1 -1
  51. package/dist/{plugin-approval-roundtrip-DeW95wB5.js → plugin-approval-roundtrip-Bz3FT8W5.js} +1 -1
  52. package/dist/{plugin-inventory-CoRCzWW4.js → plugin-inventory-oL4Na1ZG.js} +7 -4
  53. package/dist/{plugin-marketplace-discovery-3akBizzF.js → plugin-marketplace-discovery-P-Vndfqq.js} +18 -15
  54. package/dist/{plugin-metadata-cache-DgNfRAGA.js → plugin-metadata-cache-ClPJpRio.js} +13 -9
  55. package/dist/{protocol-CAAcVIKF.js → protocol-5bh1G-H7.js} +1 -1
  56. package/dist/provider-MQ8PVkuE.js +50 -0
  57. package/dist/{provider-capabilities-W4tfK5Y5.js → provider-capabilities-BvCUL69A.js} +2 -2
  58. package/dist/{rate-limits-Bqnx1N4z.js → rate-limits-CBMmWBr9.js} +1 -1
  59. package/dist/{request-CGvGOpeR.js → request-B7hEkBGq.js} +72 -58
  60. package/dist/rpc-error-ttN_QjEm.js +30 -0
  61. package/dist/{run-attempt-DwKds3DN.js → run-attempt-CvsAAGa0.js} +108 -37
  62. package/dist/{runtime-artifact-T-NwqeSH.js → runtime-artifact-BJ0rXBZ_.js} +1 -1
  63. package/dist/{sandbox-guard-BcT66fWy.js → sandbox-guard-BxgyoM8M.js} +2 -1
  64. package/dist/{session-binding-CKSepwIC.js → session-binding-CI8UuilT.js} +3 -3
  65. package/dist/{session-binding-record-CaZjYwNS.js → session-binding-record-Bcvslnhf.js} +1 -1
  66. package/dist/{session-catalog-adoption-BKLtSrwi.js → session-catalog-adoption-tcZi1IfX.js} +5 -5
  67. package/dist/{session-catalog-archive-D0i2pGj2.js → session-catalog-archive-CwKg8Xz2.js} +6 -6
  68. package/dist/{session-catalog-HaDcp7Sv.js → session-catalog-ct-AH01I.js} +31 -87
  69. package/dist/session-catalog-home-id-CwhLdC03.js +18 -0
  70. package/dist/{session-catalog-node-adoption-BUuDYY8R.js → session-catalog-node-adoption-B1tgDW-m.js} +2 -2
  71. package/dist/{session-catalog-node-continue-CBtc4wkI.js → session-catalog-node-continue-Ci-DXyJP.js} +4 -4
  72. package/dist/{session-catalog-provenance-DkJHo735.js → session-catalog-provenance-D-dIfRAH.js} +2 -30
  73. package/dist/{session-cli-CbgaHh0f.js → session-cli-DNN_jhGc.js} +2 -2
  74. package/dist/{session-history-import-DFN7sWRU.js → session-history-import-DwyijFI6.js} +4 -4
  75. package/dist/session-history-worker-runtime.js +1 -1
  76. package/dist/{session-history.worker-CNEvGaU5.js → session-history.worker-BeK1YOyT.js} +187 -83
  77. package/dist/session-history.worker.js +1 -1
  78. package/dist/{session-initialization-Jo86C60I.js → session-initialization-Ct0_Hzmg.js} +2 -2
  79. package/dist/{session-permission-policy-B22InTp_.js → session-permission-policy-BBmXA8Eg.js} +2 -2
  80. package/dist/{session-retirement-BSNG_mhf.js → session-retirement-B2YfbAAT.js} +5 -5
  81. package/dist/{settled-turn-finalizer-BuLUrZl2.js → settled-turn-finalizer-Dn91stmc.js} +5 -5
  82. package/dist/{shared-client-CVhez2Uo.js → shared-client-CscigXXL.js} +228 -30
  83. package/dist/{side-question-DLbr2vUU.js → side-question-BGMJQf4U.js} +18 -18
  84. package/dist/{source-Da-h6f7e.js → source-CElXU0Oy.js} +12 -12
  85. package/dist/{thread-archive-guard-D1bP04Tf.js → thread-archive-guard-DfpBr-Sz.js} +1 -1
  86. package/dist/{session-catalog-parsing-CdD3JhdM.js → thread-history-page-D0JIp48V.js} +83 -2
  87. package/dist/{thread-lifecycle-D1pzRwHB.js → thread-lifecycle-DXl1-I6b.js} +96 -44
  88. package/dist/{thread-ownership-D6oASVRu.js → thread-ownership-BsDRTsyp.js} +2 -2
  89. package/dist/{thread-policy-D8kI7yAO.js → thread-policy-BuEQfE0g.js} +3 -3
  90. package/dist/{thread-resume-T5cveyxA.js → thread-resume-DsDOZpFg.js} +5 -5
  91. package/dist/{session-catalog-home-id-D7-aLiNt.js → transcript-history-projection-v17wXgdK.js} +66 -18
  92. package/dist/{transcript-mirror-t5TOccct.js → transcript-mirror-C5CKgNy6.js} +1 -1
  93. package/dist/{upstream-session-fork-De-sLJ2r.js → upstream-session-fork-BZerMte_.js} +20 -20
  94. package/dist/{usage-CPPTmBvZ.js → usage-tCk-mg_x.js} +4 -4
  95. package/dist/{web-search-provider.runtime-CSVgQL0w.js → web-search-provider.runtime-B7bGbGWq.js} +3 -3
  96. package/openclaw.plugin.json +1 -0
  97. package/package.json +4 -4
@@ -0,0 +1,387 @@
1
+ import { o as isJsonObject } from "./protocol-5bh1G-H7.js";
2
+ import { C as readNonEmptyString, _ as normalizeOptionalString$1, c as itemName, l as itemStatus, m as shouldSynthesizeToolProgressForItem, w as readNonEmptyStringArray } from "./event-projector-items-5VhsECCO.js";
3
+ import { asNonArrayRecord, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
5
+ import { formatToolAggregate, formatToolProgressOutput, inferToolMetaFromArgs } from "openclaw/plugin-sdk/agent-harness-runtime";
6
+ import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
7
+ //#region extensions/codex/src/app-server/event-projector-tool-output.ts
8
+ const TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS = 1e4;
9
+ const TOOL_PROGRESS_ECHO_PREFIX_MIN_CHARS = 1024;
10
+ const TOOL_OUTPUT_TRUNCATION_NOTICE_PREFIX = "...(OpenClaw truncated Codex native tool output";
11
+ var ToolOutputAccumulator = class {
12
+ constructor() {
13
+ this.prefixByItem = /* @__PURE__ */ new Map();
14
+ this.originalLengthByItem = /* @__PURE__ */ new Map();
15
+ this.trimStateByItem = /* @__PURE__ */ new Map();
16
+ this.truncatedItemIds = /* @__PURE__ */ new Set();
17
+ this.textByItem = /* @__PURE__ */ new Map();
18
+ }
19
+ append(itemId, delta) {
20
+ const originalLength = (this.originalLengthByItem.get(itemId) ?? this.textByItem.get(itemId)?.length ?? 0) + delta.length;
21
+ this.originalLengthByItem.set(itemId, originalLength);
22
+ const normalizedLength = updateToolOutputTrimState(this.trimStateByItem, itemId, delta);
23
+ const next = appendBoundedToolTranscriptText(this.prefixByItem.get(itemId) ?? this.textByItem.get(itemId) ?? "", this.truncatedItemIds.has(itemId) ? "" : delta, originalLength);
24
+ this.prefixByItem.set(itemId, next.rawPrefix);
25
+ this.textByItem.set(itemId, next.text);
26
+ if (originalLength > 1e4) this.truncatedItemIds.add(itemId);
27
+ return {
28
+ text: next.text,
29
+ originalLength,
30
+ normalizedLength,
31
+ rawPrefix: next.rawPrefix
32
+ };
33
+ }
34
+ };
35
+ function updateToolOutputTrimState(trimStateByItem, itemId, delta) {
36
+ const state = trimStateByItem.get(itemId) ?? {
37
+ totalLength: 0,
38
+ leadingWhitespaceLength: 0,
39
+ trailingWhitespaceLength: 0,
40
+ sawNonWhitespace: false
41
+ };
42
+ state.totalLength += delta.length;
43
+ const firstNonWhitespace = delta.search(/\S/u);
44
+ if (firstNonWhitespace === -1) {
45
+ if (!state.sawNonWhitespace) state.leadingWhitespaceLength += delta.length;
46
+ state.trailingWhitespaceLength += delta.length;
47
+ trimStateByItem.set(itemId, state);
48
+ return state.sawNonWhitespace ? state.totalLength - state.leadingWhitespaceLength - state.trailingWhitespaceLength : 0;
49
+ }
50
+ if (!state.sawNonWhitespace) {
51
+ state.leadingWhitespaceLength += firstNonWhitespace;
52
+ state.sawNonWhitespace = true;
53
+ }
54
+ state.trailingWhitespaceLength = delta.match(/\s*$/u)?.[0].length ?? 0;
55
+ trimStateByItem.set(itemId, state);
56
+ return state.totalLength - state.leadingWhitespaceLength - state.trailingWhitespaceLength;
57
+ }
58
+ function toolOutputRawEchoSignature(text) {
59
+ const trimmed = text.trim();
60
+ if (!trimmed) return;
61
+ return {
62
+ rawLength: trimmed.length,
63
+ rawPrefix: trimmed.slice(0, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS)
64
+ };
65
+ }
66
+ function normalizeToolTranscriptArguments(value) {
67
+ return asNonArrayRecord(value);
68
+ }
69
+ function collectDynamicToolContentText(contentItems) {
70
+ if (!Array.isArray(contentItems)) return "";
71
+ return contentItems.flatMap((entry) => {
72
+ if (!isJsonObject(entry)) return [];
73
+ const text = readStringField(entry, "text");
74
+ return text ? [text] : [];
75
+ }).join("\n");
76
+ }
77
+ function appendBoundedToolTranscriptText(currentPrefix, delta, originalLength) {
78
+ if (originalLength <= 1e4) {
79
+ const rawPrefix = currentPrefix + delta;
80
+ return {
81
+ text: rawPrefix,
82
+ rawPrefix
83
+ };
84
+ }
85
+ const notice = toolTranscriptTruncationNotice(originalLength);
86
+ if (notice.length >= 1e4) return {
87
+ text: notice.slice(0, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS),
88
+ rawPrefix: ""
89
+ };
90
+ const textBudget = TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS - notice.length;
91
+ const remaining = Math.max(0, textBudget - currentPrefix.length);
92
+ const prefix = remaining > 0 ? `${currentPrefix}${truncateUtf16Safe(delta, remaining)}` : currentPrefix;
93
+ const rawPrefix = truncateUtf16Safe(prefix, textBudget);
94
+ return {
95
+ text: `${rawPrefix}${notice}`,
96
+ rawPrefix
97
+ };
98
+ }
99
+ function toolTranscriptTruncationNotice(originalLength) {
100
+ return `\n${`${TOOL_OUTPUT_TRUNCATION_NOTICE_PREFIX}: original ${originalLength} chars, showing ${TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS}; rerun with narrower args.)`}`;
101
+ }
102
+ function truncateToolTranscriptText(text, originalLength = text.length) {
103
+ if (originalLength <= 1e4 && text.length <= 1e4) return text;
104
+ const notice = toolTranscriptTruncationNotice(originalLength);
105
+ if (notice.length >= 1e4) return notice.slice(1, 10001);
106
+ const textBudget = TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS - notice.length;
107
+ return `${truncateUtf16Safe(text, textBudget)}${notice}`;
108
+ }
109
+ function formatToolSummary(toolName, meta) {
110
+ const trimmedMeta = meta?.trim();
111
+ return formatToolAggregate(toolName, trimmedMeta ? [trimmedMeta] : void 0, { markdown: true });
112
+ }
113
+ function formatToolOutput(toolName, meta, output) {
114
+ const formattedOutput = formatToolProgressOutput(output);
115
+ if (!formattedOutput) return formatToolSummary(toolName, meta);
116
+ const fence = markdownFenceForText(formattedOutput);
117
+ return `${formatToolSummary(toolName, meta)}\n${fence}txt\n${formattedOutput}\n${fence}`;
118
+ }
119
+ function markdownFenceForText(text) {
120
+ return "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
121
+ }
122
+ function longestBacktickRun(value) {
123
+ let longest = 0;
124
+ let current = 0;
125
+ for (const char of value) {
126
+ if (char === "`") {
127
+ current += 1;
128
+ longest = Math.max(longest, current);
129
+ continue;
130
+ }
131
+ current = 0;
132
+ }
133
+ return longest;
134
+ }
135
+ //#endregion
136
+ //#region extensions/codex/src/app-server/tool-progress-normalization.ts
137
+ /**
138
+ * Normalizes and sanitizes Codex dynamic-tool progress payloads before they are
139
+ * emitted into OpenClaw events or logs.
140
+ */
141
+ /** Maps OpenClaw tool-progress config to the mode used by Codex progress metadata. */
142
+ function resolveCodexToolProgressDetailMode(value) {
143
+ return value === "raw" ? "raw" : "explain";
144
+ }
145
+ function isCodexCommandBearingToolCall(name, args) {
146
+ const normalizedName = name?.trim().toLowerCase();
147
+ return normalizedName === "exec" || normalizedName === "bash" || normalizedName === "shell" || typeof args?.command === "string" && args.command.trim().length > 0;
148
+ }
149
+ /** Recursively redacts sensitive strings and handles circular values in event payloads. */
150
+ function sanitizeCodexAgentEventValue(value, seen = /* @__PURE__ */ new WeakSet()) {
151
+ if (typeof value === "string") return redactToolPayloadText(value);
152
+ if (Array.isArray(value)) {
153
+ if (seen.has(value)) return "[Circular]";
154
+ seen.add(value);
155
+ return value.map((entry) => sanitizeCodexAgentEventValue(entry, seen));
156
+ }
157
+ if (value && typeof value === "object") {
158
+ if (seen.has(value)) return "[Circular]";
159
+ seen.add(value);
160
+ const out = {};
161
+ for (const [key, child] of Object.entries(value)) out[key] = typeof child === "string" ? redactSensitiveFieldValue(key, child) : sanitizeCodexAgentEventValue(child, seen);
162
+ return out;
163
+ }
164
+ return value;
165
+ }
166
+ /** Sanitizes a record-shaped Codex agent event payload. */
167
+ function sanitizeCodexAgentEventRecord(value) {
168
+ return sanitizeCodexAgentEventValue(value);
169
+ }
170
+ /** Sanitizes dynamic-tool arguments before diagnostic/event emission. */
171
+ function sanitizeCodexToolArguments(value) {
172
+ if (!isJsonObject(value)) return;
173
+ return sanitizeCodexAgentEventRecord(value);
174
+ }
175
+ /** Sanitizes a Codex dynamic-tool response before diagnostic/event emission. */
176
+ function sanitizeCodexToolResponse(response) {
177
+ return sanitizeCodexAgentEventRecord({ ...response });
178
+ }
179
+ /** Infers compact human-readable tool metadata from Codex dynamic-tool arguments. */
180
+ function inferCodexDynamicToolMeta(call, detailMode) {
181
+ return inferToolMetaFromArgs(call.tool, call.arguments, { detailMode });
182
+ }
183
+ //#endregion
184
+ //#region extensions/codex/src/app-server/event-projector-tool-items.ts
185
+ function isNativePostToolUseRelayItem(item) {
186
+ switch (item.type) {
187
+ case "commandExecution":
188
+ case "fileChange":
189
+ case "mcpToolCall": return true;
190
+ default: return false;
191
+ }
192
+ }
193
+ function shouldSuppressChannelProgressForItem(item) {
194
+ if (shouldSynthesizeToolProgressForItem(item)) return true;
195
+ return item.type === "dynamicToolCall";
196
+ }
197
+ function itemToolArgs(item) {
198
+ if (item.type === "commandExecution") return sanitizeCodexAgentEventRecord({
199
+ command: item.command,
200
+ ...typeof item.cwd === "string" ? { cwd: item.cwd } : {}
201
+ });
202
+ if (item.type === "fileChange") return sanitizeCodexAgentEventRecord({ changes: itemFileChangesForTranscript(item) });
203
+ if (item.type === "webSearch") return webSearchToolArgs(item);
204
+ if (item.type === "dynamicToolCall" || item.type === "mcpToolCall") return sanitizeCodexToolArguments(item.arguments);
205
+ }
206
+ function isCommandBearingToolItem(item, args) {
207
+ if (item.type === "commandExecution") return true;
208
+ return typeof args?.command === "string" && args.command.trim().length > 0;
209
+ }
210
+ function webSearchToolArgs(item) {
211
+ const action = isJsonObject(item.action) ? item.action : void 0;
212
+ const actionType = action ? readNonEmptyString(action, "type") : void 0;
213
+ const queries = action && actionType === "search" ? readNonEmptyStringArray(action, "queries") : [];
214
+ const query = normalizeOptionalString$1(item.query) ?? (action && actionType === "search" ? readNonEmptyString(action, "query") : void 0) ?? queries[0];
215
+ const url = action ? readNonEmptyString(action, "url") : void 0;
216
+ const pattern = action ? readNonEmptyString(action, "pattern") : void 0;
217
+ const args = {};
218
+ if (query) args.query = query;
219
+ if (queries.length > 0) args.queries = queries;
220
+ if (actionType && actionType !== "search") args.action = actionType;
221
+ if (url) args.url = url;
222
+ if (pattern) args.pattern = pattern;
223
+ if (!query && !url && !pattern) args.queryUnavailable = true;
224
+ return sanitizeCodexAgentEventRecord(args);
225
+ }
226
+ function itemToolResult(item) {
227
+ if (item.type === "commandExecution") return { result: sanitizeCodexAgentEventRecord({
228
+ status: item.status,
229
+ exitCode: item.exitCode,
230
+ durationMs: item.durationMs
231
+ }) };
232
+ if (item.type === "fileChange") return { result: sanitizeCodexAgentEventRecord({
233
+ status: item.status,
234
+ changes: itemFileChanges(item)
235
+ }) };
236
+ if (item.type === "mcpToolCall") return { result: sanitizeCodexAgentEventRecord({
237
+ status: item.status,
238
+ durationMs: item.durationMs,
239
+ ...item.error ? { error: item.error } : {},
240
+ ...item.result ? { result: item.result } : {}
241
+ }) };
242
+ if (item.type === "webSearch") return { result: webSearchToolResult(item) };
243
+ return {};
244
+ }
245
+ function webSearchToolResult(item) {
246
+ return sanitizeCodexAgentEventRecord({
247
+ status: itemStatus(item),
248
+ ...typeof item.durationMs === "number" ? { durationMs: item.durationMs } : {},
249
+ ...webSearchToolArgs(item)
250
+ });
251
+ }
252
+ function itemFileChangeRecords(item) {
253
+ const changes = item.changes;
254
+ return Array.isArray(changes) ? changes.filter(isJsonObject) : [];
255
+ }
256
+ function itemFileChanges(item) {
257
+ return itemFileChangeRecords(item).flatMap((change) => {
258
+ const path = normalizeOptionalString$1(change.path);
259
+ if (!path || change.kind === void 0) return [];
260
+ return [{
261
+ path,
262
+ kind: change.kind
263
+ }];
264
+ });
265
+ }
266
+ function fileChangeKindType(kind) {
267
+ if (typeof kind === "string") return kind;
268
+ return isJsonObject(kind) ? normalizeOptionalString$1(kind.type) : void 0;
269
+ }
270
+ function countFileContentLines(content) {
271
+ if (!content) return 0;
272
+ const lines = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
273
+ if (lines.length > 1 && lines.at(-1) === "") lines.pop();
274
+ return lines.length;
275
+ }
276
+ function fileChangeDiffStat(diff, kind) {
277
+ const kindType = fileChangeKindType(kind);
278
+ if (kindType === "add") return {
279
+ added: countFileContentLines(diff),
280
+ removed: 0
281
+ };
282
+ if (kindType === "delete") return {
283
+ added: 0,
284
+ removed: countFileContentLines(diff)
285
+ };
286
+ let added = 0;
287
+ let removed = 0;
288
+ let inHunk = false;
289
+ for (const line of diff.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n")) {
290
+ if (line.startsWith("@@")) {
291
+ inHunk = true;
292
+ continue;
293
+ }
294
+ if (!inHunk) continue;
295
+ if (line.startsWith("+")) added += 1;
296
+ else if (line.startsWith("-")) removed += 1;
297
+ }
298
+ return {
299
+ added,
300
+ removed
301
+ };
302
+ }
303
+ function truncateFileChangeDiffAtLineBoundary(diff, maxChars) {
304
+ if (diff.length <= maxChars) return { diff };
305
+ if (maxChars <= 0) return { diffTruncated: true };
306
+ const boundary = diff.lastIndexOf("\n", maxChars - 1);
307
+ return boundary >= 0 ? {
308
+ diff: diff.slice(0, boundary + 1),
309
+ diffTruncated: true
310
+ } : { diffTruncated: true };
311
+ }
312
+ function itemFileChangesForTranscript(item) {
313
+ let remainingDiffChars = 1e4;
314
+ return itemFileChangeRecords(item).flatMap((change) => {
315
+ const path = normalizeOptionalString$1(change.path);
316
+ if (!path || change.kind === void 0) return [];
317
+ const result = {
318
+ path,
319
+ kind: change.kind
320
+ };
321
+ if (typeof change.diff !== "string") return [result];
322
+ result.stat = fileChangeDiffStat(change.diff, change.kind);
323
+ const bounded = truncateFileChangeDiffAtLineBoundary(change.diff, remainingDiffChars);
324
+ if (bounded.diff !== void 0) {
325
+ result.diff = bounded.diff;
326
+ remainingDiffChars -= bounded.diff.length;
327
+ }
328
+ if (bounded.diffTruncated) result.diffTruncated = true;
329
+ return [result];
330
+ });
331
+ }
332
+ function itemToolError(item, status, outputTextByItem) {
333
+ if (status === "blocked") return "codex native tool blocked";
334
+ if (status !== "failed") return;
335
+ return itemOutputText(item, outputTextByItem) ?? "codex native tool failed";
336
+ }
337
+ function itemMeta(item, detailMode = "explain") {
338
+ if (item.type === "commandExecution" && typeof item.command === "string") return inferToolMetaFromArgs("exec", {
339
+ command: item.command,
340
+ cwd: typeof item.cwd === "string" ? item.cwd : void 0
341
+ }, { detailMode });
342
+ if (item.type === "webSearch") return inferToolMetaFromArgs("web_search", webSearchToolArgs(item), { detailMode });
343
+ const toolName = itemName(item);
344
+ if ((item.type === "dynamicToolCall" || item.type === "mcpToolCall") && toolName) return inferToolMetaFromArgs(toolName, item.arguments, { detailMode });
345
+ }
346
+ function itemOutputText(item, outputTextByItem) {
347
+ if (item.type === "commandExecution") {
348
+ const output = item.aggregatedOutput?.trim() || outputTextByItem?.get(item.id)?.trim();
349
+ return output ? truncateToolTranscriptText(output) : void 0;
350
+ }
351
+ if (item.type === "dynamicToolCall") {
352
+ const output = collectDynamicToolContentText(item.contentItems).trim();
353
+ return output ? truncateToolTranscriptText(output) : void 0;
354
+ }
355
+ if (item.type === "mcpToolCall") {
356
+ const output = item.error ? stringifyJsonValue(item.error) : item.result ? stringifyJsonValue(item.result) : void 0;
357
+ return output ? truncateToolTranscriptText(output) : void 0;
358
+ }
359
+ }
360
+ function itemTranscriptResultText(item, outputTextByItem) {
361
+ const output = itemOutputText(item, outputTextByItem);
362
+ if (output) return output;
363
+ const result = itemToolResult(item).result;
364
+ const resultText = result ? stringifyJsonValue(result) : void 0;
365
+ return resultText ? truncateToolTranscriptText(resultText) : itemStatus(item);
366
+ }
367
+ function stringifyJsonValue(value) {
368
+ try {
369
+ return JSON.stringify(value, null, 2);
370
+ } catch {
371
+ return;
372
+ }
373
+ }
374
+ //#endregion
375
+ //#region extensions/codex/src/app-server/native-subagent-task-ids.ts
376
+ /**
377
+ * Shared identifiers for representing Codex native subagents as OpenClaw task
378
+ * runtime rows.
379
+ */
380
+ /** Task runtime namespace for Codex native subagent task rows. */
381
+ const CODEX_NATIVE_SUBAGENT_RUNTIME = "subagent";
382
+ /** Task kind used to distinguish native Codex subagents from other subagent runtimes. */
383
+ const CODEX_NATIVE_SUBAGENT_TASK_KIND = "codex-native";
384
+ /** Run id prefix for task rows keyed by Codex child thread ids. */
385
+ const CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX = "codex-thread:";
386
+ //#endregion
387
+ export { formatToolSummary as C, truncateToolTranscriptText as E, formatToolOutput as S, toolOutputRawEchoSignature as T, sanitizeCodexToolResponse as _, isNativePostToolUseRelayItem as a, ToolOutputAccumulator as b, itemToolArgs as c, itemTranscriptResultText as d, shouldSuppressChannelProgressForItem as f, sanitizeCodexToolArguments as g, resolveCodexToolProgressDetailMode as h, isCommandBearingToolItem as i, itemToolError as l, isCodexCommandBearingToolCall as m, CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX as n, itemMeta as o, inferCodexDynamicToolMeta as p, CODEX_NATIVE_SUBAGENT_TASK_KIND as r, itemOutputText as s, CODEX_NATIVE_SUBAGENT_RUNTIME as t, itemToolResult as u, TOOL_PROGRESS_ECHO_PREFIX_MIN_CHARS as v, normalizeToolTranscriptArguments as w, collectDynamicToolContentText as x, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS as y };
@@ -1,4 +1,4 @@
1
- import { a as formatCodexDisplayText } from "./command-formatters-DeTfrapr.js";
1
+ import { o as formatCodexDisplayText } from "./command-formatters-lxlkNZgU.js";
2
2
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
4
4
  import { runCommandBuffered } from "openclaw/plugin-sdk/process-runtime";
@@ -1,4 +1,4 @@
1
- import { n as resolveManagedCodexAppServerStartOptions, r as resolveManagedCodexNativeCommand, t as isManagedCodexDesktopCommand } from "./managed-binary-DrjjRRUD.js";
1
+ import { i as resolveManagedCodexNativeCommand, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand } from "./managed-binary-D22rNEcR.js";
2
2
  import { i as closeCodexAppServerTransportAndWait, t as createStdioTransport } from "./transport-stdio-BGjHoYLr.js";
3
3
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { killProcessTree } from "openclaw/plugin-sdk/process-runtime";
@@ -145,10 +145,10 @@ async function runCodexNodeExecServer(params) {
145
145
  headers: {},
146
146
  cwd,
147
147
  env: {
148
- HOME: dir,
148
+ HOME: params.homeDir ?? dir,
149
149
  CODEX_HOME: codexHome,
150
150
  RUST_LOG: "error,opentelemetry_sdk=off,opentelemetry_otlp=off,codex_exec_server::server::transport=info",
151
- ...process.platform === "win32" ? { USERPROFILE: dir } : {}
151
+ ...process.platform === "win32" ? { USERPROFILE: params.homeDir ?? dir } : {}
152
152
  },
153
153
  clearEnv: ["NODE_OPTIONS"]
154
154
  }, baseEnv, () => {