@openclaw/codex 2026.5.16-beta.5 → 2026.5.16-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harness.js +2 -2
- package/dist/{run-attempt-Bssnu2uw.js → run-attempt-D6sdcUE0.js} +135 -26
- package/dist/{side-question-DgVgwmjR.js → side-question-BzVnOoBU.js} +1 -1
- package/dist/test-api.js +1 -1
- package/dist/{thread-lifecycle-BbriKhTq.js → thread-lifecycle-Cc_ljZLZ.js} +34 -10
- package/package.json +4 -4
package/dist/harness.js
CHANGED
|
@@ -18,14 +18,14 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
18
18
|
};
|
|
19
19
|
},
|
|
20
20
|
runAttempt: async (params) => {
|
|
21
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
21
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-D6sdcUE0.js");
|
|
22
22
|
return runCodexAppServerAttempt(params, {
|
|
23
23
|
pluginConfig: options?.pluginConfig,
|
|
24
24
|
nativeHookRelay: { enabled: true }
|
|
25
25
|
});
|
|
26
26
|
},
|
|
27
27
|
runSideQuestion: async (params) => {
|
|
28
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
28
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-BzVnOoBU.js");
|
|
29
29
|
return runCodexAppServerSideQuestion(params, {
|
|
30
30
|
pluginConfig: options?.pluginConfig,
|
|
31
31
|
nativeHookRelay: { enabled: true }
|
|
@@ -7,7 +7,7 @@ import { d as resolveCodexUsageLimitResetAtMs, f as shouldRefreshCodexRateLimits
|
|
|
7
7
|
import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, f as resolveCodexAppServerHomeDir, l as resolveCodexAppServerAuthProfileId, s as refreshCodexAppServerAuthTokens, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-DlvmoLBJ.js";
|
|
8
8
|
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
9
9
|
import { a as defaultCodexAppInventoryCache } from "./plugin-activation-B49xb7pI.js";
|
|
10
|
-
import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, _ as projectContextEngineAssemblyForCodex, b as createCodexDynamicToolBridge, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as shouldBuildCodexPluginThreadConfig, h as mergeCodexThreadConfigs, i as buildDeveloperInstructions, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfigInputFingerprint, p as buildCodexPluginThreadConfig, r as buildContextEngineBinding, s as buildTurnStartParams, t as areCodexDynamicToolFingerprintsCompatible, v as resolveCodexContextEngineProjectionMaxChars, w as normalizeCodexDynamicToolName, x as sanitizeCodexHistoryImagePayloads, y as resolveCodexContextEngineProjectionReserveTokens } from "./thread-lifecycle-
|
|
10
|
+
import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, _ as projectContextEngineAssemblyForCodex, b as createCodexDynamicToolBridge, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as shouldBuildCodexPluginThreadConfig, h as mergeCodexThreadConfigs, i as buildDeveloperInstructions, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfigInputFingerprint, p as buildCodexPluginThreadConfig, r as buildContextEngineBinding, s as buildTurnStartParams, t as areCodexDynamicToolFingerprintsCompatible, v as resolveCodexContextEngineProjectionMaxChars, w as normalizeCodexDynamicToolName, x as sanitizeCodexHistoryImagePayloads, y as resolveCodexContextEngineProjectionReserveTokens } from "./thread-lifecycle-Cc_ljZLZ.js";
|
|
11
11
|
import { t as defaultCodexAppServerClientFactory } from "./client-factory-9L6Ie1dC.js";
|
|
12
12
|
import { a as handleCodexAppServerElicitationRequest, i as buildCodexNativeHookRelayDisabledConfig, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as handleCodexAppServerApprovalRequest, r as buildCodexNativeHookRelayConfig, t as filterToolsForVisionInputs } from "./vision-tools-BX9YuTEK.js";
|
|
13
13
|
import { t as ensureCodexComputerUse } from "./computer-use-UJ3dxrXF.js";
|
|
@@ -535,6 +535,19 @@ const CODEX_PROMPT_TOTAL_INPUT_KEYS = [
|
|
|
535
535
|
];
|
|
536
536
|
const MAX_TOOL_OUTPUT_DELTA_MESSAGES_PER_ITEM = 20;
|
|
537
537
|
const TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS = 12e3;
|
|
538
|
+
const TRANSCRIPT_PROGRESS_SUPPRESSED_TOOL_NAMES = new Set([
|
|
539
|
+
"message",
|
|
540
|
+
"messages",
|
|
541
|
+
"reply",
|
|
542
|
+
"send",
|
|
543
|
+
"reaction",
|
|
544
|
+
"react",
|
|
545
|
+
"typing"
|
|
546
|
+
]);
|
|
547
|
+
function shouldEmitTranscriptToolProgress(toolName, args) {
|
|
548
|
+
const normalized = typeof toolName === "string" ? toolName.trim().toLowerCase() : "";
|
|
549
|
+
return Boolean(normalized && !TRANSCRIPT_PROGRESS_SUPPRESSED_TOOL_NAMES.has(normalized) && !isActivityLogCommandProgress(normalized, args));
|
|
550
|
+
}
|
|
538
551
|
var CodexAppServerEventProjector = class {
|
|
539
552
|
constructor(params, threadId, turnId, options = {}) {
|
|
540
553
|
this.params = params;
|
|
@@ -554,11 +567,15 @@ var CodexAppServerEventProjector = class {
|
|
|
554
567
|
this.toolResultSummaryItemIds = /* @__PURE__ */ new Set();
|
|
555
568
|
this.toolResultOutputItemIds = /* @__PURE__ */ new Set();
|
|
556
569
|
this.toolResultOutputStreamedItemIds = /* @__PURE__ */ new Set();
|
|
570
|
+
this.transcriptToolProgressSuppressedIds = /* @__PURE__ */ new Set();
|
|
571
|
+
this.toolTranscriptArgumentsById = /* @__PURE__ */ new Map();
|
|
557
572
|
this.toolResultOutputDeltaState = /* @__PURE__ */ new Map();
|
|
573
|
+
this.toolResultOutputTextByItem = /* @__PURE__ */ new Map();
|
|
558
574
|
this.toolMetas = /* @__PURE__ */ new Map();
|
|
559
575
|
this.toolTranscriptMessages = [];
|
|
560
576
|
this.toolTranscriptCallIds = /* @__PURE__ */ new Set();
|
|
561
577
|
this.toolTranscriptResultIds = /* @__PURE__ */ new Set();
|
|
578
|
+
this.transcriptToolProgressCallIds = /* @__PURE__ */ new Set();
|
|
562
579
|
this.nativeGeneratedMediaUrls = /* @__PURE__ */ new Set();
|
|
563
580
|
this.diagnosticToolStartedAtByItem = /* @__PURE__ */ new Map();
|
|
564
581
|
this.afterToolCallObservedItemIds = /* @__PURE__ */ new Set();
|
|
@@ -1030,7 +1047,10 @@ var CodexAppServerEventProjector = class {
|
|
|
1030
1047
|
handleOutputDelta(params, toolName) {
|
|
1031
1048
|
const itemId = readString$2(params, "itemId");
|
|
1032
1049
|
const delta = readString$2(params, "delta");
|
|
1033
|
-
if (!itemId || !delta
|
|
1050
|
+
if (!itemId || !delta) return;
|
|
1051
|
+
appendToolOutputDeltaText(this.toolResultOutputTextByItem, itemId, delta);
|
|
1052
|
+
if (!this.shouldEmitToolOutput()) return;
|
|
1053
|
+
if (this.transcriptToolProgressSuppressedIds.has(itemId) || !shouldEmitTranscriptToolProgress(toolName, this.toolTranscriptArgumentsById.get(itemId))) return;
|
|
1034
1054
|
const state = this.toolResultOutputDeltaState.get(itemId) ?? {
|
|
1035
1055
|
chars: 0,
|
|
1036
1056
|
messages: 0,
|
|
@@ -1153,9 +1173,8 @@ var CodexAppServerEventProjector = class {
|
|
|
1153
1173
|
if (!item || !shouldSynthesizeToolProgressForItem(item)) return;
|
|
1154
1174
|
const name = itemName(item);
|
|
1155
1175
|
if (!name) return;
|
|
1156
|
-
const meta = itemMeta(item, this.toolProgressDetailMode());
|
|
1157
|
-
const args = params.phase === "start" ? itemToolArgs(item) : void 0;
|
|
1158
1176
|
const status = params.phase === "result" ? itemStatus(item) : "running";
|
|
1177
|
+
const args = itemToolArgs(item);
|
|
1159
1178
|
this.recordToolTrajectoryEvent({
|
|
1160
1179
|
phase: params.phase,
|
|
1161
1180
|
item,
|
|
@@ -1169,6 +1188,11 @@ var CodexAppServerEventProjector = class {
|
|
|
1169
1188
|
name,
|
|
1170
1189
|
status
|
|
1171
1190
|
});
|
|
1191
|
+
if (!shouldEmitTranscriptToolProgress(name, args)) {
|
|
1192
|
+
if (params.phase === "result") this.emitAfterToolCallObservation(item);
|
|
1193
|
+
return;
|
|
1194
|
+
}
|
|
1195
|
+
const meta = itemMeta(item, this.toolProgressDetailMode());
|
|
1172
1196
|
this.emitAgentEvent({
|
|
1173
1197
|
stream: "tool",
|
|
1174
1198
|
data: {
|
|
@@ -1177,7 +1201,7 @@ var CodexAppServerEventProjector = class {
|
|
|
1177
1201
|
itemId: item.id,
|
|
1178
1202
|
toolCallId: item.id,
|
|
1179
1203
|
...meta ? { meta } : {},
|
|
1180
|
-
...args ? { args } : {},
|
|
1204
|
+
...params.phase === "start" && args ? { args } : {},
|
|
1181
1205
|
...params.phase === "result" ? {
|
|
1182
1206
|
status,
|
|
1183
1207
|
isError: isNonSuccessItemStatus(status),
|
|
@@ -1200,7 +1224,7 @@ var CodexAppServerEventProjector = class {
|
|
|
1200
1224
|
return;
|
|
1201
1225
|
}
|
|
1202
1226
|
const toolResult = itemToolResult(params.item).result;
|
|
1203
|
-
const output = itemOutputText(params.item);
|
|
1227
|
+
const output = itemOutputText(params.item, this.toolResultOutputTextByItem);
|
|
1204
1228
|
this.options.trajectoryRecorder?.recordEvent("tool.result", {
|
|
1205
1229
|
threadId: this.threadId,
|
|
1206
1230
|
turnId: this.turnId,
|
|
@@ -1257,7 +1281,7 @@ var CodexAppServerEventProjector = class {
|
|
|
1257
1281
|
if (status === "running") return;
|
|
1258
1282
|
this.afterToolCallObservedItemIds.add(item.id);
|
|
1259
1283
|
const result = itemToolResult(item).result;
|
|
1260
|
-
const error = itemToolError(item, status);
|
|
1284
|
+
const error = itemToolError(item, status, this.toolResultOutputTextByItem);
|
|
1261
1285
|
const startedAt = typeof item.durationMs === "number" ? Date.now() - Math.max(0, item.durationMs) : void 0;
|
|
1262
1286
|
const hookParams = {
|
|
1263
1287
|
toolName: name,
|
|
@@ -1286,6 +1310,7 @@ var CodexAppServerEventProjector = class {
|
|
|
1286
1310
|
if (this.toolResultSummaryItemIds.has(itemId)) return;
|
|
1287
1311
|
const toolName = itemName(item);
|
|
1288
1312
|
if (!toolName) return;
|
|
1313
|
+
if (!shouldEmitTranscriptToolProgress(toolName, itemToolArgs(item))) return;
|
|
1289
1314
|
this.toolResultSummaryItemIds.add(itemId);
|
|
1290
1315
|
const meta = itemMeta(item, this.toolProgressDetailMode());
|
|
1291
1316
|
this.emitToolResultMessage({
|
|
@@ -1299,8 +1324,9 @@ var CodexAppServerEventProjector = class {
|
|
|
1299
1324
|
if (this.toolResultOutputItemIds.has(itemId)) return;
|
|
1300
1325
|
if (this.toolResultOutputStreamedItemIds.has(itemId)) return;
|
|
1301
1326
|
const toolName = itemName(item);
|
|
1302
|
-
const output = itemOutputText(item);
|
|
1327
|
+
const output = itemOutputText(item, this.toolResultOutputTextByItem);
|
|
1303
1328
|
if (!toolName || !output) return;
|
|
1329
|
+
if (!shouldEmitTranscriptToolProgress(toolName, itemToolArgs(item))) return;
|
|
1304
1330
|
this.emitToolResultMessage({
|
|
1305
1331
|
itemId,
|
|
1306
1332
|
text: formatToolOutput(toolName, itemMeta(item, this.toolProgressDetailMode()), output),
|
|
@@ -1352,20 +1378,53 @@ var CodexAppServerEventProjector = class {
|
|
|
1352
1378
|
this.recordToolTranscriptResult({
|
|
1353
1379
|
id: item.id,
|
|
1354
1380
|
name,
|
|
1355
|
-
text: itemTranscriptResultText(item),
|
|
1381
|
+
text: itemTranscriptResultText(item, this.toolResultOutputTextByItem),
|
|
1356
1382
|
isError: isNonSuccessItemStatus(itemStatus(item))
|
|
1357
1383
|
});
|
|
1358
1384
|
}
|
|
1359
1385
|
recordToolTranscriptCall(params) {
|
|
1360
1386
|
if (!params.id || !params.name || this.toolTranscriptCallIds.has(params.id)) return;
|
|
1361
1387
|
this.toolTranscriptCallIds.add(params.id);
|
|
1388
|
+
this.toolTranscriptArgumentsById.set(params.id, params.arguments);
|
|
1389
|
+
if (!shouldEmitTranscriptToolProgress(params.name, params.arguments)) this.transcriptToolProgressSuppressedIds.add(params.id);
|
|
1390
|
+
else this.transcriptToolProgressSuppressedIds.delete(params.id);
|
|
1391
|
+
this.emitTranscriptToolCallProgress(params);
|
|
1362
1392
|
this.toolTranscriptMessages.push(attachCodexMirrorIdentity(this.createToolCallMessage(params), `${this.turnId}:tool:${params.id}:call`));
|
|
1363
1393
|
}
|
|
1364
1394
|
recordToolTranscriptResult(params) {
|
|
1365
1395
|
if (!params.id || !params.name || this.toolTranscriptResultIds.has(params.id)) return;
|
|
1366
1396
|
this.toolTranscriptResultIds.add(params.id);
|
|
1397
|
+
this.emitTranscriptToolResultProgress(params);
|
|
1367
1398
|
this.toolTranscriptMessages.push(attachCodexMirrorIdentity(this.createToolResultMessage(params), `${this.turnId}:tool:${params.id}:result`));
|
|
1368
1399
|
}
|
|
1400
|
+
emitTranscriptToolCallProgress(params) {
|
|
1401
|
+
if (!shouldEmitTranscriptToolProgress(params.name, params.arguments)) return;
|
|
1402
|
+
this.transcriptToolProgressCallIds.add(params.id);
|
|
1403
|
+
const args = normalizeToolTranscriptArguments(params.arguments);
|
|
1404
|
+
const meta = inferToolMetaFromArgs(params.name, args, { detailMode: this.toolProgressDetailMode() });
|
|
1405
|
+
if (!this.params.onToolResult || !this.shouldEmitToolResult() || this.toolResultSummaryItemIds.has(params.id) || this.toolResultOutputStreamedItemIds.has(params.id)) return;
|
|
1406
|
+
this.toolResultSummaryItemIds.add(params.id);
|
|
1407
|
+
this.emitToolResultMessage({
|
|
1408
|
+
itemId: params.id,
|
|
1409
|
+
text: formatToolSummary(params.name, meta)
|
|
1410
|
+
});
|
|
1411
|
+
}
|
|
1412
|
+
emitTranscriptToolResultProgress(params) {
|
|
1413
|
+
if (this.transcriptToolProgressSuppressedIds.has(params.id) || !shouldEmitTranscriptToolProgress(params.name, this.toolTranscriptArgumentsById.get(params.id))) return;
|
|
1414
|
+
if (!this.transcriptToolProgressCallIds.has(params.id)) this.emitTranscriptToolCallProgress({
|
|
1415
|
+
id: params.id,
|
|
1416
|
+
name: params.name,
|
|
1417
|
+
arguments: {}
|
|
1418
|
+
});
|
|
1419
|
+
if (!this.params.onToolResult || !this.shouldEmitToolOutput() || this.toolResultOutputItemIds.has(params.id) || this.toolResultOutputStreamedItemIds.has(params.id)) return;
|
|
1420
|
+
const text = params.text?.trim();
|
|
1421
|
+
if (!text) return;
|
|
1422
|
+
this.emitToolResultMessage({
|
|
1423
|
+
itemId: params.id,
|
|
1424
|
+
text: formatToolOutput(params.name, void 0, text),
|
|
1425
|
+
finalOutput: true
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1369
1428
|
formatCodexErrorMessage(params) {
|
|
1370
1429
|
const error = isJsonObject(params.error) ? params.error : void 0;
|
|
1371
1430
|
return formatCodexUsageLimitErrorMessage({
|
|
@@ -1715,10 +1774,10 @@ function itemFileChanges(item) {
|
|
|
1715
1774
|
kind: change.kind
|
|
1716
1775
|
})) : [];
|
|
1717
1776
|
}
|
|
1718
|
-
function itemToolError(item, status) {
|
|
1777
|
+
function itemToolError(item, status, outputTextByItem) {
|
|
1719
1778
|
if (status === "blocked") return "codex native tool blocked";
|
|
1720
1779
|
if (status !== "failed") return;
|
|
1721
|
-
return itemOutputText(item) ?? "codex native tool failed";
|
|
1780
|
+
return itemOutputText(item, outputTextByItem) ?? "codex native tool failed";
|
|
1722
1781
|
}
|
|
1723
1782
|
function itemMeta(item, detailMode = "explain") {
|
|
1724
1783
|
if (item.type === "commandExecution" && typeof item.command === "string") return inferToolMetaFromArgs("exec", {
|
|
@@ -1729,24 +1788,50 @@ function itemMeta(item, detailMode = "explain") {
|
|
|
1729
1788
|
const toolName = itemName(item);
|
|
1730
1789
|
if ((item.type === "dynamicToolCall" || item.type === "mcpToolCall") && toolName) return inferToolMetaFromArgs(toolName, item.arguments, { detailMode });
|
|
1731
1790
|
}
|
|
1732
|
-
function itemOutputText(item) {
|
|
1733
|
-
if (item.type === "commandExecution") return item.aggregatedOutput?.trim() || void 0;
|
|
1791
|
+
function itemOutputText(item, outputTextByItem) {
|
|
1792
|
+
if (item.type === "commandExecution") return item.aggregatedOutput?.trim() || outputTextByItem?.get(item.id)?.trim() || void 0;
|
|
1734
1793
|
if (item.type === "dynamicToolCall") return collectDynamicToolContentText(item.contentItems).trim() || void 0;
|
|
1735
1794
|
if (item.type === "mcpToolCall") {
|
|
1736
1795
|
if (item.error) return stringifyJsonValue(item.error);
|
|
1737
1796
|
return item.result ? stringifyJsonValue(item.result) : void 0;
|
|
1738
1797
|
}
|
|
1739
1798
|
}
|
|
1740
|
-
function itemTranscriptResultText(item) {
|
|
1741
|
-
const output = itemOutputText(item);
|
|
1799
|
+
function itemTranscriptResultText(item, outputTextByItem) {
|
|
1800
|
+
const output = itemOutputText(item, outputTextByItem);
|
|
1742
1801
|
if (output) return output;
|
|
1743
1802
|
const result = itemToolResult(item).result;
|
|
1744
1803
|
return result ? stringifyJsonValue(result) : itemStatus(item);
|
|
1745
1804
|
}
|
|
1805
|
+
function appendToolOutputDeltaText(outputTextByItem, itemId, delta) {
|
|
1806
|
+
const current = outputTextByItem.get(itemId) ?? "";
|
|
1807
|
+
if (current.length >= TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS) return;
|
|
1808
|
+
const remaining = TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS - current.length;
|
|
1809
|
+
const next = current + (delta.length > remaining ? delta.slice(0, remaining) : delta);
|
|
1810
|
+
outputTextByItem.set(itemId, next);
|
|
1811
|
+
}
|
|
1746
1812
|
function normalizeToolTranscriptArguments(value) {
|
|
1747
1813
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
1748
1814
|
return value;
|
|
1749
1815
|
}
|
|
1816
|
+
function isActivityLogCommandProgress(toolName, args) {
|
|
1817
|
+
if (toolName !== "bash" && toolName !== "exec" && toolName !== "shell") return false;
|
|
1818
|
+
const command = readToolCommandText(args);
|
|
1819
|
+
return Boolean(command && command.includes("log_activity.sh"));
|
|
1820
|
+
}
|
|
1821
|
+
function readToolCommandText(value) {
|
|
1822
|
+
if (typeof value === "string") return value;
|
|
1823
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return;
|
|
1824
|
+
const record = value;
|
|
1825
|
+
for (const key of [
|
|
1826
|
+
"command",
|
|
1827
|
+
"cmd",
|
|
1828
|
+
"shellCommand",
|
|
1829
|
+
"script"
|
|
1830
|
+
]) {
|
|
1831
|
+
const text = record[key];
|
|
1832
|
+
if (typeof text === "string" && text) return text;
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1750
1835
|
function collectDynamicToolContentText(contentItems) {
|
|
1751
1836
|
if (!Array.isArray(contentItems)) return "";
|
|
1752
1837
|
return contentItems.flatMap((entry) => {
|
|
@@ -2631,6 +2716,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2631
2716
|
disableTools: params.disableTools,
|
|
2632
2717
|
toolsAllow: params.toolsAllow
|
|
2633
2718
|
});
|
|
2719
|
+
const nativeToolSurfaceEnabled = shouldEnableCodexAppServerNativeToolSurface(params);
|
|
2634
2720
|
for (const diagnostic of bundleMcpThreadConfig.diagnostics) embeddedAgentLog.warn(`bundle-mcp: ${diagnostic.pluginId}: ${diagnostic.message}`);
|
|
2635
2721
|
const activeContextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
|
|
2636
2722
|
const hookChannelId = resolveCodexAppServerHookChannelId(params, sandboxSessionKey);
|
|
@@ -2852,7 +2938,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2852
2938
|
hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec
|
|
2853
2939
|
}) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0;
|
|
2854
2940
|
const threadConfig = mergeCodexThreadConfigs(bundleMcpThreadConfig?.configPatch);
|
|
2855
|
-
const
|
|
2941
|
+
const pluginThreadConfigRequired = !nativeToolSurfaceEnabled || shouldBuildCodexPluginThreadConfig(pluginConfig);
|
|
2942
|
+
const pluginThreadConfigPluginConfig = nativeToolSurfaceEnabled ? pluginConfig : disableCodexPluginThreadConfig(pluginConfig);
|
|
2856
2943
|
const pluginAppCacheKey = buildCodexPluginAppCacheKey({
|
|
2857
2944
|
appServer,
|
|
2858
2945
|
agentDir,
|
|
@@ -2860,11 +2947,11 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2860
2947
|
accountId: startupAuthAccountCacheKey,
|
|
2861
2948
|
envApiKeyFingerprint: startupEnvApiKeyCacheKey
|
|
2862
2949
|
});
|
|
2863
|
-
const pluginThreadConfigInputFingerprint =
|
|
2864
|
-
pluginConfig,
|
|
2950
|
+
const pluginThreadConfigInputFingerprint = pluginThreadConfigRequired ? buildCodexPluginThreadConfigInputFingerprint({
|
|
2951
|
+
pluginConfig: pluginThreadConfigPluginConfig,
|
|
2865
2952
|
appCacheKey: pluginAppCacheKey
|
|
2866
2953
|
}) : void 0;
|
|
2867
|
-
const resolvedPluginPolicy =
|
|
2954
|
+
const resolvedPluginPolicy = pluginThreadConfigRequired ? resolveCodexPluginsPolicy(pluginThreadConfigPluginConfig) : void 0;
|
|
2868
2955
|
const enabledPluginConfigKeys = resolvedPluginPolicy ? resolvedPluginPolicy.pluginPolicies.filter((plugin) => plugin.enabled).map((plugin) => plugin.configKey).toSorted() : void 0;
|
|
2869
2956
|
pluginAppServer = resolvedPluginPolicy?.enabled === true ? {
|
|
2870
2957
|
...appServer,
|
|
@@ -2895,15 +2982,17 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2895
2982
|
developerInstructions: promptBuild.developerInstructions,
|
|
2896
2983
|
config: threadConfig,
|
|
2897
2984
|
finalConfigPatch: nativeHookRelayConfig,
|
|
2985
|
+
nativeCodeModeEnabled: nativeToolSurfaceEnabled,
|
|
2986
|
+
userMcpServersEnabled: nativeToolSurfaceEnabled,
|
|
2898
2987
|
mcpServersFingerprint: bundleMcpThreadConfig.fingerprint,
|
|
2899
2988
|
mcpServersFingerprintEvaluated: bundleMcpThreadConfig.evaluated,
|
|
2900
2989
|
contextEngineProjection,
|
|
2901
|
-
pluginThreadConfig:
|
|
2990
|
+
pluginThreadConfig: pluginThreadConfigRequired ? {
|
|
2902
2991
|
enabled: true,
|
|
2903
2992
|
inputFingerprint: pluginThreadConfigInputFingerprint,
|
|
2904
2993
|
enabledPluginConfigKeys,
|
|
2905
2994
|
build: () => buildCodexPluginThreadConfig({
|
|
2906
|
-
pluginConfig,
|
|
2995
|
+
pluginConfig: pluginThreadConfigPluginConfig,
|
|
2907
2996
|
request: (method, requestParams) => startupClient.request(method, requestParams, {
|
|
2908
2997
|
timeoutMs: appServer.requestTimeoutMs,
|
|
2909
2998
|
signal: runAbortController.signal
|
|
@@ -3482,7 +3571,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3482
3571
|
});
|
|
3483
3572
|
const toolMeta = inferCodexDynamicToolMeta(call, resolveCodexToolProgressDetailMode(params.toolProgressDetail));
|
|
3484
3573
|
const toolArgs = sanitizeCodexToolArguments(call.arguments);
|
|
3485
|
-
|
|
3574
|
+
const shouldEmitDynamicToolProgress = shouldEmitTranscriptToolProgress(call.tool, toolArgs);
|
|
3575
|
+
if (shouldEmitDynamicToolProgress) emitCodexAppServerEvent(params, {
|
|
3486
3576
|
stream: "tool",
|
|
3487
3577
|
data: {
|
|
3488
3578
|
phase: "start",
|
|
@@ -3525,7 +3615,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3525
3615
|
success: response.success,
|
|
3526
3616
|
contentItems: response.contentItems
|
|
3527
3617
|
});
|
|
3528
|
-
emitCodexAppServerEvent(params, {
|
|
3618
|
+
if (shouldEmitDynamicToolProgress) emitCodexAppServerEvent(params, {
|
|
3529
3619
|
stream: "tool",
|
|
3530
3620
|
data: {
|
|
3531
3621
|
phase: "result",
|
|
@@ -4332,16 +4422,35 @@ async function buildDynamicTools(input) {
|
|
|
4332
4422
|
});
|
|
4333
4423
|
}
|
|
4334
4424
|
function includeForcedMessageToolAllow(toolsAllow, params) {
|
|
4335
|
-
if (!shouldForceMessageTool(params)) return toolsAllow;
|
|
4336
|
-
if (toolsAllow === void 0) return toolsAllow;
|
|
4425
|
+
if (!shouldForceMessageTool(params) || toolsAllow === void 0 || hasWildcardCodexToolsAllow(toolsAllow)) return toolsAllow;
|
|
4337
4426
|
if (toolsAllow.length === 0) return ["message"];
|
|
4338
4427
|
return new Set(toolsAllow.map((name) => normalizeCodexDynamicToolName(name))).has("message") ? toolsAllow : [...toolsAllow, "message"];
|
|
4339
4428
|
}
|
|
4429
|
+
function shouldEnableCodexAppServerNativeToolSurface(params) {
|
|
4430
|
+
const toolsAllow = includeForcedMessageToolAllow(params.toolsAllow, params);
|
|
4431
|
+
if (toolsAllow === void 0) return true;
|
|
4432
|
+
return hasWildcardCodexToolsAllow(toolsAllow);
|
|
4433
|
+
}
|
|
4434
|
+
function disableCodexPluginThreadConfig(pluginConfig) {
|
|
4435
|
+
const config = readCodexPluginConfig(pluginConfig);
|
|
4436
|
+
return {
|
|
4437
|
+
...config,
|
|
4438
|
+
codexPlugins: {
|
|
4439
|
+
...config.codexPlugins,
|
|
4440
|
+
enabled: false
|
|
4441
|
+
}
|
|
4442
|
+
};
|
|
4443
|
+
}
|
|
4340
4444
|
function filterCodexDynamicToolsForAllowlist(tools, toolsAllow) {
|
|
4341
|
-
if (!toolsAllow
|
|
4445
|
+
if (!toolsAllow) return tools;
|
|
4446
|
+
if (toolsAllow.length === 0) return [];
|
|
4447
|
+
if (hasWildcardCodexToolsAllow(toolsAllow)) return tools;
|
|
4342
4448
|
const allowSet = new Set(toolsAllow.map((name) => normalizeCodexDynamicToolName(name)).filter(Boolean));
|
|
4343
4449
|
return tools.filter((tool) => allowSet.has(normalizeCodexDynamicToolName(tool.name)));
|
|
4344
4450
|
}
|
|
4451
|
+
function hasWildcardCodexToolsAllow(toolsAllow) {
|
|
4452
|
+
return toolsAllow.some((name) => normalizeCodexDynamicToolName(name) === "*");
|
|
4453
|
+
}
|
|
4345
4454
|
function shouldForceMessageTool(params) {
|
|
4346
4455
|
return params.sourceReplyDeliveryMode === "message_tool_only";
|
|
4347
4456
|
}
|
|
@@ -5,7 +5,7 @@ import { r as isCodexAppServerApprovalRequest } from "./client-6FkrXfaz.js";
|
|
|
5
5
|
import { u as formatCodexUsageLimitErrorMessage } from "./command-formatters-BRW7_Nu7.js";
|
|
6
6
|
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-DlvmoLBJ.js";
|
|
7
7
|
import { i as readCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
8
|
-
import { S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, b as createCodexDynamicToolBridge, d as resolveReasoningEffort, h as mergeCodexThreadConfigs, n as buildCodexRuntimeThreadConfig, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-
|
|
8
|
+
import { S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, b as createCodexDynamicToolBridge, d as resolveReasoningEffort, h as mergeCodexThreadConfigs, n as buildCodexRuntimeThreadConfig, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-Cc_ljZLZ.js";
|
|
9
9
|
import { a as handleCodexAppServerElicitationRequest, i as buildCodexNativeHookRelayDisabledConfig, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as handleCodexAppServerApprovalRequest, r as buildCodexNativeHookRelayConfig, t as filterToolsForVisionInputs } from "./vision-tools-BX9YuTEK.js";
|
|
10
10
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
|
|
11
11
|
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
package/dist/test-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5pq6hEz.js";
|
|
2
|
-
import { S as filterCodexDynamicTools, a as buildThreadResumeParams, b as createCodexDynamicToolBridge, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams } from "./thread-lifecycle-
|
|
2
|
+
import { S as filterCodexDynamicTools, a as buildThreadResumeParams, b as createCodexDynamicToolBridge, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams } from "./thread-lifecycle-Cc_ljZLZ.js";
|
|
3
3
|
//#region extensions/codex/test-api.ts
|
|
4
4
|
function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
|
|
5
5
|
return resolveCodexAppServerRuntimeOptions({
|
|
@@ -569,7 +569,7 @@ function projectContextEngineAssemblyForCodex(params) {
|
|
|
569
569
|
CONTEXT_SAFETY_NOTE,
|
|
570
570
|
"",
|
|
571
571
|
CONTEXT_OPEN,
|
|
572
|
-
|
|
572
|
+
truncateOlderContext(renderedContext, maxRenderedContextChars),
|
|
573
573
|
CONTEXT_CLOSE,
|
|
574
574
|
"",
|
|
575
575
|
REQUEST_HEADER,
|
|
@@ -739,6 +739,17 @@ function resolveTextPartMaxChars(maxRenderedContextChars) {
|
|
|
739
739
|
function truncateText(text, maxChars) {
|
|
740
740
|
return text.length > maxChars ? `${text.slice(0, maxChars)}\n[truncated ${text.length - maxChars} chars]` : text;
|
|
741
741
|
}
|
|
742
|
+
function truncateOlderContext(text, maxChars) {
|
|
743
|
+
if (text.length <= maxChars) return text;
|
|
744
|
+
if (maxChars <= 0) return "";
|
|
745
|
+
const buildMarker = (omittedChars) => `[truncated ${omittedChars} chars from older context]\n`;
|
|
746
|
+
let marker = buildMarker(text.length - maxChars);
|
|
747
|
+
let tailChars = Math.max(0, maxChars - marker.length);
|
|
748
|
+
marker = buildMarker(text.length - tailChars);
|
|
749
|
+
if (marker.length >= maxChars) return marker.slice(0, maxChars);
|
|
750
|
+
tailChars = maxChars - marker.length;
|
|
751
|
+
return `${marker}${text.slice(text.length - tailChars).trimStart()}`;
|
|
752
|
+
}
|
|
742
753
|
//#endregion
|
|
743
754
|
//#region extensions/codex/src/app-server/plugin-thread-config.ts
|
|
744
755
|
const CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION = 1;
|
|
@@ -977,11 +988,15 @@ const CODEX_CODE_MODE_THREAD_CONFIG = {
|
|
|
977
988
|
"features.code_mode": true,
|
|
978
989
|
"features.code_mode_only": true
|
|
979
990
|
};
|
|
991
|
+
const CODEX_CODE_MODE_DISABLED_THREAD_CONFIG = {
|
|
992
|
+
"features.code_mode": false,
|
|
993
|
+
"features.code_mode_only": false
|
|
994
|
+
};
|
|
980
995
|
const CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG = { project_doc_max_bytes: 0 };
|
|
981
996
|
async function startOrResumeThread(params) {
|
|
982
997
|
const dynamicToolsFingerprint = fingerprintDynamicTools(params.dynamicTools);
|
|
983
998
|
const contextEngineBinding = buildContextEngineBinding(params.params, params.contextEngineProjection);
|
|
984
|
-
const userMcpServersConfigPatch = buildCodexUserMcpServersThreadConfigPatch(params.params.config, { agentId: params.agentId ?? params.params.agentId });
|
|
999
|
+
const userMcpServersConfigPatch = params.userMcpServersEnabled === false ? void 0 : buildCodexUserMcpServersThreadConfigPatch(params.params.config, { agentId: params.agentId ?? params.params.agentId });
|
|
985
1000
|
const userMcpServersFingerprint = fingerprintUserMcpServersConfigPatch(userMcpServersConfigPatch);
|
|
986
1001
|
let binding = await readCodexAppServerBinding(params.params.sessionFile, {
|
|
987
1002
|
authProfileStore: params.params.authProfileStore,
|
|
@@ -991,6 +1006,11 @@ async function startOrResumeThread(params) {
|
|
|
991
1006
|
let preserveExistingBinding = false;
|
|
992
1007
|
let rotatedContextEngineBinding = false;
|
|
993
1008
|
let prebuiltPluginThreadConfig;
|
|
1009
|
+
if (binding?.threadId && params.nativeCodeModeEnabled === false) {
|
|
1010
|
+
embeddedAgentLog.debug("codex app-server native tool surface disabled for turn; starting transient thread", { threadId: binding.threadId });
|
|
1011
|
+
preserveExistingBinding = true;
|
|
1012
|
+
binding = void 0;
|
|
1013
|
+
}
|
|
994
1014
|
if (binding?.threadId && (binding.contextEngine || contextEngineBinding)) {
|
|
995
1015
|
if (!contextEngineBinding || !isContextEngineBindingCompatible(binding.contextEngine, contextEngineBinding)) {
|
|
996
1016
|
embeddedAgentLog.debug("codex app-server context-engine binding changed; starting a new thread", {
|
|
@@ -1068,7 +1088,8 @@ async function startOrResumeThread(params) {
|
|
|
1068
1088
|
authProfileId,
|
|
1069
1089
|
appServer: params.appServer,
|
|
1070
1090
|
developerInstructions: params.developerInstructions,
|
|
1071
|
-
config: resumeConfig
|
|
1091
|
+
config: resumeConfig,
|
|
1092
|
+
nativeCodeModeEnabled: params.nativeCodeModeEnabled
|
|
1072
1093
|
})));
|
|
1073
1094
|
const boundAuthProfileId = authProfileId;
|
|
1074
1095
|
const fallbackModelProvider = resolveCodexAppServerModelProvider({
|
|
@@ -1135,7 +1156,8 @@ async function startOrResumeThread(params) {
|
|
|
1135
1156
|
dynamicTools: params.dynamicTools,
|
|
1136
1157
|
appServer: params.appServer,
|
|
1137
1158
|
developerInstructions: params.developerInstructions,
|
|
1138
|
-
config
|
|
1159
|
+
config,
|
|
1160
|
+
nativeCodeModeEnabled: params.nativeCodeModeEnabled
|
|
1139
1161
|
})));
|
|
1140
1162
|
const modelProvider = resolveCodexAppServerModelProvider({
|
|
1141
1163
|
provider: params.params.provider,
|
|
@@ -1276,7 +1298,8 @@ function buildThreadStartParams(params, options) {
|
|
|
1276
1298
|
sandbox: options.appServer.sandbox,
|
|
1277
1299
|
...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
|
|
1278
1300
|
serviceName: "OpenClaw",
|
|
1279
|
-
config: buildCodexRuntimeThreadConfigForRun(params, options.config),
|
|
1301
|
+
config: buildCodexRuntimeThreadConfigForRun(params, options.config, { nativeCodeModeEnabled: options.nativeCodeModeEnabled }),
|
|
1302
|
+
...options.nativeCodeModeEnabled === false ? { environments: [] } : {},
|
|
1280
1303
|
developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params),
|
|
1281
1304
|
dynamicTools: options.dynamicTools,
|
|
1282
1305
|
experimentalRawEvents: true,
|
|
@@ -1299,16 +1322,17 @@ function buildThreadResumeParams(params, options) {
|
|
|
1299
1322
|
approvalsReviewer: options.appServer.approvalsReviewer,
|
|
1300
1323
|
sandbox: options.appServer.sandbox,
|
|
1301
1324
|
...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
|
|
1302
|
-
config: buildCodexRuntimeThreadConfigForRun(params, options.config),
|
|
1325
|
+
config: buildCodexRuntimeThreadConfigForRun(params, options.config, { nativeCodeModeEnabled: options.nativeCodeModeEnabled }),
|
|
1303
1326
|
developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params),
|
|
1304
1327
|
persistExtendedHistory: true
|
|
1305
1328
|
};
|
|
1306
1329
|
}
|
|
1307
|
-
function buildCodexRuntimeThreadConfig(config) {
|
|
1308
|
-
|
|
1330
|
+
function buildCodexRuntimeThreadConfig(config, options = {}) {
|
|
1331
|
+
const codeModeConfig = options.nativeCodeModeEnabled === false ? CODEX_CODE_MODE_DISABLED_THREAD_CONFIG : CODEX_CODE_MODE_THREAD_CONFIG;
|
|
1332
|
+
return mergeCodexThreadConfigs(config, codeModeConfig) ?? { ...codeModeConfig };
|
|
1309
1333
|
}
|
|
1310
|
-
function buildCodexRuntimeThreadConfigForRun(params, config) {
|
|
1311
|
-
const runtimeConfig = buildCodexRuntimeThreadConfig(config);
|
|
1334
|
+
function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
|
|
1335
|
+
const runtimeConfig = buildCodexRuntimeThreadConfig(config, options);
|
|
1312
1336
|
if (params.bootstrapContextMode !== "lightweight") return runtimeConfig;
|
|
1313
1337
|
return mergeCodexThreadConfigs(runtimeConfig, CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG) ?? {
|
|
1314
1338
|
...runtimeConfig,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.16-beta.
|
|
3
|
+
"version": "2026.5.16-beta.6",
|
|
4
4
|
"description": "OpenClaw Codex harness and model provider plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"minHostVersion": ">=2026.5.1-beta.1"
|
|
28
28
|
},
|
|
29
29
|
"compat": {
|
|
30
|
-
"pluginApi": ">=2026.5.16-beta.
|
|
30
|
+
"pluginApi": ">=2026.5.16-beta.6"
|
|
31
31
|
},
|
|
32
32
|
"build": {
|
|
33
|
-
"openclawVersion": "2026.5.16-beta.
|
|
33
|
+
"openclawVersion": "2026.5.16-beta.6"
|
|
34
34
|
},
|
|
35
35
|
"release": {
|
|
36
36
|
"publishToClawHub": true,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"openclaw.plugin.json"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"openclaw": ">=2026.5.16-beta.
|
|
48
|
+
"openclaw": ">=2026.5.16-beta.6"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"openclaw": {
|