@openclaw/codex 2026.8.1-beta.3 → 2026.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +4 -5
- package/dist/{attempt-client-cleanup-URjUlCHg.js → attempt-client-cleanup-CVPvp9dL.js} +47 -5
- package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
- package/dist/{binding-connection-DAvZwp96.js → binding-connection-CCQFs8lf.js} +2 -2
- package/dist/{bounded-turn-4BjrZEwW.js → bounded-turn-rq5tiSXk.js} +13 -18
- package/dist/{capabilities-CH3K57v4.js → capabilities-CGm_94eL.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-D0nZ3qtd.js → command-formatters-C54Yg3eA.js} +2 -2
- package/dist/{command-handlers-DC86lgT4.js → command-handlers-BvOAHTrA.js} +89 -62
- package/dist/{compact-COqgBRny.js → compact-Hd7SAc0N.js} +8 -9
- package/dist/{config-CpNeo5AE.js → config-Cxw3Cl3k.js} +346 -286
- package/dist/doctor-contract-api.js +115 -14
- package/dist/{dynamic-tools-fJZhl4CE.js → dynamic-tools-BFoUcRdx.js} +147 -903
- package/dist/{effective-mcp-catalog-4YKn51aG.js → effective-mcp-catalog-BTJHnDSx.js} +2 -2
- package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
- package/dist/{event-projector-usage-CLwNEJqW.js → event-projector-usage-D3PHFFXh.js} +3 -3
- package/dist/{harness-DoKQcF8n.js → harness-DVfUQBlQ.js} +42 -52
- package/dist/harness.js +1 -1
- package/dist/index.js +278 -295
- package/dist/{isolated-completion-DPMtlH9r.js → isolated-completion-Cbbx_5Ed.js} +4 -4
- package/dist/launch-args-sXOAg0SX.js +84 -0
- package/dist/{managed-binary-By4FZC6i.js → managed-binary-ZkGodW19.js} +43 -7
- package/dist/media-understanding-provider.js +1 -1
- package/dist/model-catalog-o6Cgjoss.js +101 -0
- package/dist/{models-CZw1wClT.js → models-DgFWSuxA.js} +25 -28
- package/dist/{native-subagent-monitor-GGq3RnOo.js → native-subagent-monitor-CwFyoylz.js} +207 -30
- package/dist/{node-exec-server.runtime-Bsu1LdFZ.js → node-exec-server.runtime-DXrqpw1c.js} +8 -5
- package/dist/{plugin-approval-roundtrip-C75Yiiwc.js → plugin-approval-roundtrip-D80UZiJ_.js} +1 -1
- package/dist/{plugin-marketplace-discovery-CSWDkMrP.js → plugin-marketplace-discovery-mdmScYOj.js} +30 -39
- package/dist/{plugin-metadata-cache-BXH5NF-4.js → plugin-metadata-cache-CulOABwu.js} +162 -135
- package/dist/{protocol-validators-VAVyEnDp.js → protocol-validators-Bg5rpNxk.js} +148 -5
- package/dist/{rate-limits-BI1dMHDG.js → rate-limits-hFtzt2Up.js} +1 -1
- package/dist/{sandbox-guard-C1qEeZ5C.js → request-CCm4LaED.js} +183 -2
- package/dist/{run-attempt-BV3HzuCf.js → run-attempt-BwNQDH2u.js} +599 -361
- package/dist/{runtime-artifact-BvyT1uyd.js → runtime-artifact-DeBvleJw.js} +1 -1
- package/dist/{session-binding-BTrLf9Qm.js → session-binding-q2WSTVmC.js} +195 -122
- package/dist/{session-catalog-ezP_UcRM.js → session-catalog-C2Tae4rI.js} +229 -122
- package/dist/session-catalog-home-id-DAKUrm3C.js +112 -0
- package/dist/{session-cli-B1hKvfkI.js → session-cli-BuDjm5Ou.js} +1 -1
- package/dist/session-permission-policy-gLm40Vtq.js +160 -0
- package/dist/session-retirement-CdkI0bvb.js +90 -0
- package/dist/{session-upstream-marker-D_2npHlA.js → session-upstream-marker-Bcy33kam.js} +2 -3
- package/dist/{settled-turn-finalizer-Dx1onIqg.js → settled-turn-finalizer-B8JJcxCi.js} +7 -6
- package/dist/{shared-client-Dw-rzii0.js → shared-client-kNkljY-R.js} +1720 -786
- package/dist/{side-question-DbXkJZzg.js → side-question-GwD73tX6.js} +69 -39
- package/dist/{thread-lifecycle-DKdrnTMX.js → thread-lifecycle-Ss-uwnC4.js} +852 -359
- package/dist/{thread-ownership-i2NBwDUL.js → thread-ownership-CeYBqg_4.js} +18 -8
- package/dist/{plugin-app-cache-key-DMNQ8Zi8.js → thread-resume-DF54hagX.js} +52 -6
- package/dist/{transcript-mirror-BU0_LKAL.js → transcript-mirror-CkEQIna-.js} +112 -13
- package/dist/transport-stdio-C7-s9TLG.js +708 -0
- package/dist/{upstream-session-fork-BDVJCLAD.js → upstream-session-fork-BACGlOFa.js} +78 -86
- package/dist/{usage-9dKJCgcy.js → usage-C2l8Mils.js} +3 -3
- package/dist/{web-search-provider.runtime-DCdx4DGu.js → web-search-provider.runtime-B2XgRdFv.js} +3 -3
- package/openclaw.plugin.json +19 -1
- package/package.json +8 -8
- package/dist/app-server-policy-bg5QPSVP.js +0 -25
- package/dist/command-rpc-xUIIonsO.js +0 -90
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/model-catalog-CmGoqVKB.js +0 -48
- package/dist/request-DSK0W6YI.js +0 -157
- package/dist/session-catalog-home-id-BNwAJ9D7.js +0 -18
- package/dist/session-retirement-CE4iMiLh.js +0 -36
- package/dist/thread-resume-CdJk2Ehf.js +0 -30
- package/dist/transport-stdio-DhoGy33Z.js +0 -99
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
1
|
+
import { Ct as retainCodexAppServerLiveThread, Ht as isJsonObject, St as releaseCodexAppServerLiveThread, ht as claimCodexAppServerLiveThread } from "./shared-client-kNkljY-R.js";
|
|
2
|
+
import { A as shouldRecordNativeToolTranscript, C as isNonSuccessItemStatus, D as itemStatus, E as itemName, F as readHookOutputEntries, I as readItem, N as normalizeOptionalString$1, O as itemTitle, R as readNonEmptyString, S as isMutatingNativeToolItem, T as itemKind, V as readNullableString$1, b as auditNativeToolTerminalStatus, j as shouldSynthesizeToolProgressForItem, w as isSideEffectingNativeToolItem, z as readNonEmptyStringArray } from "./attempt-client-cleanup-CVPvp9dL.js";
|
|
3
3
|
import { t as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-CFmsKwr9.js";
|
|
4
4
|
import { n as sanitizeCodexHistoryImagePayloads } from "./image-payload-sanitizer-CnfoUPCE.js";
|
|
5
5
|
import { t as resolveCodexLocalRuntimeAttribution } from "./local-runtime-attribution-B_2mnqhb.js";
|
|
6
|
-
import { n as codexApprovalTimeoutText } from "./plugin-approval-roundtrip-
|
|
6
|
+
import { n as codexApprovalTimeoutText } from "./plugin-approval-roundtrip-D80UZiJ_.js";
|
|
7
7
|
import { asFiniteNumber, asNonArrayRecord, normalizeOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import fs from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
|
@@ -12,9 +12,9 @@ import { TOOL_PROGRESS_OUTPUT_MAX_CHARS, embeddedAgentLog, emitAgentEvent, forma
|
|
|
12
12
|
import { getSessionEntry, parseSqliteSessionFileMarker, resolveTranscriptSessionKeyBySessionId } from "openclaw/plugin-sdk/session-store-runtime";
|
|
13
13
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
14
14
|
import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
15
|
+
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
15
16
|
import { readCodexSessionTranscriptEventsBeforeAdmission } from "openclaw/plugin-sdk/codex-session-transcript-runtime";
|
|
16
17
|
import { readSessionTranscriptEvents } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
17
|
-
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
18
18
|
import { buildSessionContext, migrateSessionEntries, parseSessionEntries } from "openclaw/plugin-sdk/agent-sessions";
|
|
19
19
|
import { createAgentHarnessTaskRuntime, deliverAgentHarnessTaskCompletion, isDurableAgentHarnessCompletionDelivery } from "openclaw/plugin-sdk/agent-harness-task-runtime";
|
|
20
20
|
//#region extensions/codex/src/app-server/event-projector-tool-output.ts
|
|
@@ -570,7 +570,7 @@ var CodexToolProgressProjection = class {
|
|
|
570
570
|
const args = itemToolArgs(item);
|
|
571
571
|
if (!toolName || !shouldEmitTranscriptToolProgress(toolName, args)) return;
|
|
572
572
|
this.resultSummaryItemIds.add(item.id);
|
|
573
|
-
const meta = this.
|
|
573
|
+
const meta = this.shouldIncludeFormattedMeta(isCommandBearingToolItem(item, args)) ? itemMeta(item, this.toolProgressDetailMode()) : void 0;
|
|
574
574
|
this.emitToolResultMessage({
|
|
575
575
|
itemId: item.id,
|
|
576
576
|
text: formatToolSummary(toolName, meta)
|
|
@@ -582,9 +582,10 @@ var CodexToolProgressProjection = class {
|
|
|
582
582
|
const toolName = itemName(item);
|
|
583
583
|
const output = itemOutputText(item, this.output.textByItem);
|
|
584
584
|
if (!toolName || !output || !shouldEmitTranscriptToolProgress(toolName, itemToolArgs(item))) return;
|
|
585
|
+
const meta = this.shouldIncludeFormattedMeta(isCommandBearingToolItem(item, itemToolArgs(item))) ? itemMeta(item, this.toolProgressDetailMode()) : void 0;
|
|
585
586
|
this.emitToolResultMessage({
|
|
586
587
|
itemId: item.id,
|
|
587
|
-
text: formatToolOutput(toolName,
|
|
588
|
+
text: formatToolOutput(toolName, meta, output),
|
|
588
589
|
finalOutput: true,
|
|
589
590
|
isError: isNonSuccessItemStatus(itemStatus(item))
|
|
590
591
|
});
|
|
@@ -643,6 +644,7 @@ var CodexToolProgressProjection = class {
|
|
|
643
644
|
try {
|
|
644
645
|
Promise.resolve(this.params.onToolResult?.({
|
|
645
646
|
text,
|
|
647
|
+
...(this.params.messageChannel || this.params.messageProvider) && { channelData: { openclawToolProgressId: params.itemId } },
|
|
646
648
|
...params.isError === true ? { isError: true } : {}
|
|
647
649
|
})).catch(() => {});
|
|
648
650
|
} catch {}
|
|
@@ -653,11 +655,15 @@ var CodexToolProgressProjection = class {
|
|
|
653
655
|
shouldEmitToolOutput() {
|
|
654
656
|
return typeof this.params.shouldEmitToolOutput === "function" ? this.params.shouldEmitToolOutput() : this.params.verboseLevel === "full";
|
|
655
657
|
}
|
|
658
|
+
shouldIncludeFormattedMeta(commandBearing) {
|
|
659
|
+
const channel = this.params.messageChannel ?? this.params.messageProvider;
|
|
660
|
+
return !commandBearing || !channel && this.shouldEmitToolOutput();
|
|
661
|
+
}
|
|
656
662
|
emitTranscriptToolCallProgress(params) {
|
|
657
663
|
if (!shouldEmitTranscriptToolProgress(params.name, params.arguments)) return;
|
|
658
664
|
this.transcriptProgressCallIds.add(params.id);
|
|
659
665
|
const args = normalizeToolTranscriptArguments(params.arguments);
|
|
660
|
-
const meta = this.
|
|
666
|
+
const meta = this.shouldIncludeFormattedMeta(isCodexCommandBearingToolCall(params.name, args)) ? inferToolMetaFromArgs(params.name, args, { detailMode: this.toolProgressDetailMode() }) : void 0;
|
|
661
667
|
if (!this.params.onToolResult || !this.shouldEmitToolResult() || this.resultSummaryItemIds.has(params.id) || this.resultOutputStreamedItemIds.has(params.id)) return;
|
|
662
668
|
this.resultSummaryItemIds.add(params.id);
|
|
663
669
|
this.emitToolResultMessage({
|
|
@@ -866,6 +872,7 @@ var CodexToolTranscriptProjection = class {
|
|
|
866
872
|
this.nativeMcpAppResultDetailsAttempted = /* @__PURE__ */ new Set();
|
|
867
873
|
this.approvalReviewsByCallId = /* @__PURE__ */ new Map();
|
|
868
874
|
this.rawNativeToolOutputByCallId = /* @__PURE__ */ new Map();
|
|
875
|
+
this.pendingRawPatchOutputIds = /* @__PURE__ */ new Set();
|
|
869
876
|
this.codeModeNativePatchInputsByCallId = /* @__PURE__ */ new Map();
|
|
870
877
|
}
|
|
871
878
|
get transcriptMessages() {
|
|
@@ -969,14 +976,18 @@ var CodexToolTranscriptProjection = class {
|
|
|
969
976
|
} catch {
|
|
970
977
|
return;
|
|
971
978
|
}
|
|
972
|
-
if (args)
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
979
|
+
if (args) {
|
|
980
|
+
this.pendingRawPatchOutputIds.add(callId);
|
|
981
|
+
this.recordToolCall({
|
|
982
|
+
id: callId,
|
|
983
|
+
name: "apply_patch",
|
|
984
|
+
arguments: args
|
|
985
|
+
});
|
|
986
|
+
}
|
|
977
987
|
return;
|
|
978
988
|
}
|
|
979
989
|
if (type !== "custom_tool_call_output" && type !== "function_call_output" || this.namesById.get(callId) !== "apply_patch" && !this.codeModeNativePatchInputsByCallId.has(callId)) return;
|
|
990
|
+
this.pendingRawPatchOutputIds.delete(callId);
|
|
980
991
|
const text = typeof item.output === "string" ? item.output : Array.isArray(item.output) ? collectDynamicToolContentText(item.output) : "";
|
|
981
992
|
if (!text.trim()) return;
|
|
982
993
|
const codeModePatchInput = this.codeModeNativePatchInputsByCallId.get(callId);
|
|
@@ -1168,13 +1179,20 @@ var CodexToolTranscriptProjection = class {
|
|
|
1168
1179
|
this.callIds.add(params.id);
|
|
1169
1180
|
this.namesById.set(params.id, params.name);
|
|
1170
1181
|
this.progress.recordTranscriptCall(params);
|
|
1171
|
-
|
|
1182
|
+
const message = attachCodexMirrorIdentity(this.createToolCallMessage(params), `${this.turnId}:tool:${params.id}:call`);
|
|
1183
|
+
this.messages.push(message);
|
|
1184
|
+
this.options.checkpointMessage?.({ read: () => message });
|
|
1172
1185
|
}
|
|
1173
1186
|
recordToolResult(params) {
|
|
1174
1187
|
if (!params.id || !params.name || this.resultIds.has(params.id)) return;
|
|
1175
1188
|
this.resultIds.add(params.id);
|
|
1176
1189
|
this.progress.recordTranscriptResult(params);
|
|
1177
|
-
|
|
1190
|
+
const message = attachCodexMirrorIdentity(this.createToolResultMessage(params), `${this.turnId}:tool:${params.id}:result`);
|
|
1191
|
+
this.messages.push(message);
|
|
1192
|
+
this.options.checkpointMessage?.({
|
|
1193
|
+
read: () => message,
|
|
1194
|
+
ready: () => !this.pendingRawPatchOutputIds.has(params.id)
|
|
1195
|
+
});
|
|
1178
1196
|
}
|
|
1179
1197
|
recordMissingToolError(missingTranscriptIds, missingTrajectoryIds) {
|
|
1180
1198
|
const firstMissingId = missingTranscriptIds.find((id) => Boolean(this.namesById.get(id))) ?? missingTrajectoryIds.find((id) => Boolean(this.trajectoryNamesById.get(id) ?? this.namesById.get(id)));
|
|
@@ -1253,10 +1271,34 @@ function resolveStartedAtFromDurationMs(durationMs) {
|
|
|
1253
1271
|
}
|
|
1254
1272
|
//#endregion
|
|
1255
1273
|
//#region extensions/codex/src/app-server/event-projector-events.ts
|
|
1274
|
+
/** Downstream event consumers must never corrupt the canonical Codex turn projection. */
|
|
1275
|
+
function emitCodexAgentEvent(params, event) {
|
|
1276
|
+
try {
|
|
1277
|
+
emitAgentEvent({
|
|
1278
|
+
runId: params.runId,
|
|
1279
|
+
stream: event.stream,
|
|
1280
|
+
data: event.data,
|
|
1281
|
+
...params.sessionKey ? { sessionKey: params.sessionKey } : {}
|
|
1282
|
+
});
|
|
1283
|
+
} catch (error) {
|
|
1284
|
+
embeddedAgentLog.debug("codex app-server global agent event emit failed", { error });
|
|
1285
|
+
}
|
|
1286
|
+
try {
|
|
1287
|
+
const maybePromise = params.onAgentEvent?.(event);
|
|
1288
|
+
Promise.resolve(maybePromise).catch((error) => {
|
|
1289
|
+
embeddedAgentLog.debug("codex app-server agent event handler rejected", { error });
|
|
1290
|
+
});
|
|
1291
|
+
} catch (error) {
|
|
1292
|
+
embeddedAgentLog.debug("codex app-server agent event handler threw", { error });
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1256
1295
|
function guardianActionCommand(action) {
|
|
1257
1296
|
if (!action) return;
|
|
1258
|
-
const
|
|
1259
|
-
if (
|
|
1297
|
+
const directLabel = readStringField(action, "command") ?? readStringField(action, "target") ?? readStringField(action, "toolTitle") ?? readStringField(action, "reason");
|
|
1298
|
+
if (directLabel) return directLabel;
|
|
1299
|
+
const server = readStringField(action, "connectorName") ?? readStringField(action, "server");
|
|
1300
|
+
const tool = readStringField(action, "toolName");
|
|
1301
|
+
if (server && tool) return `${server}/${tool}`;
|
|
1260
1302
|
const argv = Array.isArray(action.argv) ? action.argv.filter((value) => typeof value === "string") : [];
|
|
1261
1303
|
return argv.length > 0 ? argv.join(" ") : readStringField(action, "program");
|
|
1262
1304
|
}
|
|
@@ -1264,6 +1306,7 @@ function normalizeApprovalReviewStatus(status) {
|
|
|
1264
1306
|
return status === "inProgress" ? "in_progress" : status === "timedOut" ? "timed_out" : status;
|
|
1265
1307
|
}
|
|
1266
1308
|
const GUARDIAN_TIMEOUT_WARNING = "Automatic approval review timed out while evaluating the requested approval.";
|
|
1309
|
+
const LOG_ONLY_CODEX_WARNING_PATTERNS = [/^Configured service tier `[^`\r\n]+` is not advertised as supported for model `[^`\r\n]+` and will be omitted from requests\.$/, /^Code Mode is enabled in configuration, but model `[^`\r\n]+` does not advertise Code Mode support\. This may degrade model performance\. Disable `features\.code_mode` and `features\.code_mode_only`, or select a model whose metadata enables Code Mode\.$/];
|
|
1267
1310
|
function projectNormalizedToolItem(params) {
|
|
1268
1311
|
const { item } = params;
|
|
1269
1312
|
if (!item || !shouldSynthesizeToolProgressForItem(item)) return;
|
|
@@ -1310,12 +1353,26 @@ var CodexEventProjection = class {
|
|
|
1310
1353
|
get guardianReviewCount() {
|
|
1311
1354
|
return this.reviewCount;
|
|
1312
1355
|
}
|
|
1356
|
+
emitCompactionEnd(itemId, completed) {
|
|
1357
|
+
this.emitAgentEvent({
|
|
1358
|
+
stream: "compaction",
|
|
1359
|
+
data: {
|
|
1360
|
+
phase: "end",
|
|
1361
|
+
backend: "codex-app-server",
|
|
1362
|
+
completed,
|
|
1363
|
+
threadId: this.threadId,
|
|
1364
|
+
turnId: this.turnId,
|
|
1365
|
+
itemId
|
|
1366
|
+
}
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1313
1369
|
handleGuardianReview(method, params) {
|
|
1314
1370
|
this.reviewCount += 1;
|
|
1315
1371
|
const review = isJsonObject(params.review) ? params.review : void 0;
|
|
1316
1372
|
const action = isJsonObject(params.action) ? params.action : void 0;
|
|
1317
1373
|
const reviewId = readStringField(params, "reviewId");
|
|
1318
1374
|
const targetItemId = readNullableString$1(params, "targetItemId");
|
|
1375
|
+
const command = guardianActionCommand(action);
|
|
1319
1376
|
const reviewStatus = review ? readStringField(review, "status") : void 0;
|
|
1320
1377
|
const status = normalizeApprovalReviewStatus(reviewStatus);
|
|
1321
1378
|
const riskLevel = review ? readStringField(review, "riskLevel") : void 0;
|
|
@@ -1324,11 +1381,22 @@ var CodexEventProjection = class {
|
|
|
1324
1381
|
const expectedWarning = status === "timed_out" ? GUARDIAN_TIMEOUT_WARNING : rationale && riskLevel && userAuthorization && (status === "approved" || status === "denied") ? `Automatic approval review ${status} (risk: ${riskLevel}, authorization: ${userAuthorization}): ${rationale}` : void 0;
|
|
1325
1382
|
if (Boolean(targetItemId) && Boolean(reviewId) && this.pendingGuardianWarning === expectedWarning) this.pendingGuardianWarning = void 0;
|
|
1326
1383
|
else this.flushPendingGuardianWarning();
|
|
1384
|
+
const threadId = readStringField(params, "threadId") ?? this.threadId;
|
|
1385
|
+
const turnId = readStringField(params, "turnId") ?? this.turnId;
|
|
1386
|
+
if (method.endsWith("/started")) this.activeGuardianReview = {
|
|
1387
|
+
reviewId,
|
|
1388
|
+
targetItemId,
|
|
1389
|
+
command,
|
|
1390
|
+
threadId,
|
|
1391
|
+
turnId
|
|
1392
|
+
};
|
|
1327
1393
|
this.emitAgentEvent({
|
|
1328
1394
|
stream: "codex_app_server.guardian",
|
|
1329
1395
|
data: {
|
|
1330
1396
|
method,
|
|
1331
1397
|
phase: method.endsWith("/started") ? "started" : "completed",
|
|
1398
|
+
threadId,
|
|
1399
|
+
turnId,
|
|
1332
1400
|
reviewId,
|
|
1333
1401
|
targetItemId,
|
|
1334
1402
|
decisionSource: readStringField(params, "decisionSource"),
|
|
@@ -1337,7 +1405,7 @@ var CodexEventProjection = class {
|
|
|
1337
1405
|
userAuthorization,
|
|
1338
1406
|
rationale,
|
|
1339
1407
|
actionType: action ? readStringField(action, "type") : void 0,
|
|
1340
|
-
command
|
|
1408
|
+
command
|
|
1341
1409
|
}
|
|
1342
1410
|
});
|
|
1343
1411
|
if (reviewId && targetItemId && status) {
|
|
@@ -1361,6 +1429,7 @@ var CodexEventProjection = class {
|
|
|
1361
1429
|
}
|
|
1362
1430
|
});
|
|
1363
1431
|
}
|
|
1432
|
+
if (method.endsWith("/completed") && this.activeGuardianReview?.reviewId === reviewId) this.activeGuardianReview = void 0;
|
|
1364
1433
|
}
|
|
1365
1434
|
handleGuardianWarning(params) {
|
|
1366
1435
|
this.flushPendingGuardianWarning();
|
|
@@ -1377,6 +1446,30 @@ var CodexEventProjection = class {
|
|
|
1377
1446
|
}
|
|
1378
1447
|
});
|
|
1379
1448
|
}
|
|
1449
|
+
handleWarning(params) {
|
|
1450
|
+
const message = [readStringField(params, "summary") ?? readStringField(params, "message"), readStringField(params, "details")].filter(Boolean).join("\n");
|
|
1451
|
+
if (LOG_ONLY_CODEX_WARNING_PATTERNS.some((pattern) => pattern.test(message))) embeddedAgentLog.warn(message);
|
|
1452
|
+
else if (message) this.emitAgentEvent({
|
|
1453
|
+
stream: "notice",
|
|
1454
|
+
data: {
|
|
1455
|
+
phase: "warning",
|
|
1456
|
+
message
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
handleModelRerouted(params) {
|
|
1461
|
+
const fromModel = readStringField(params, "fromModel");
|
|
1462
|
+
const toModel = readStringField(params, "toModel");
|
|
1463
|
+
const reason = readStringField(params, "reason");
|
|
1464
|
+
if (fromModel && toModel && fromModel !== toModel) this.emitAgentEvent({
|
|
1465
|
+
stream: "fallback",
|
|
1466
|
+
data: {
|
|
1467
|
+
fromModel,
|
|
1468
|
+
toModel,
|
|
1469
|
+
...reason ? { reason } : {}
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1380
1473
|
flushPendingGuardianWarning() {
|
|
1381
1474
|
const pending = this.pendingGuardianWarning;
|
|
1382
1475
|
if (!pending) return;
|
|
@@ -1389,6 +1482,21 @@ var CodexEventProjection = class {
|
|
|
1389
1482
|
}
|
|
1390
1483
|
});
|
|
1391
1484
|
}
|
|
1485
|
+
handleStrictReviewRequired(params) {
|
|
1486
|
+
this.emitAgentEvent({
|
|
1487
|
+
stream: "codex_app_server.guardian",
|
|
1488
|
+
data: {
|
|
1489
|
+
method: "autoApprovalReview/strictReviewRequired",
|
|
1490
|
+
phase: "strict_review_required",
|
|
1491
|
+
threadId: readStringField(params, "threadId") ?? this.activeGuardianReview?.threadId ?? this.threadId,
|
|
1492
|
+
turnId: readStringField(params, "turnId") ?? this.activeGuardianReview?.turnId ?? this.turnId,
|
|
1493
|
+
reviewId: this.activeGuardianReview?.reviewId,
|
|
1494
|
+
targetItemId: this.activeGuardianReview?.targetItemId,
|
|
1495
|
+
command: this.activeGuardianReview?.command,
|
|
1496
|
+
startedAtMs: asFiniteNumber(params.startedAtMs)
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1392
1500
|
handleHook(method, params) {
|
|
1393
1501
|
const run = isJsonObject(params.run) ? params.run : void 0;
|
|
1394
1502
|
if (!run) return;
|
|
@@ -1513,8 +1621,23 @@ function extractCodexNativeSubagentCompletionsFromText(text) {
|
|
|
1513
1621
|
}
|
|
1514
1622
|
const codexNativeSubagentNotifications = {
|
|
1515
1623
|
fromNotification: extractCodexNativeSubagentCompletions,
|
|
1516
|
-
fromText: extractCodexNativeSubagentCompletionsFromText
|
|
1624
|
+
fromText: extractCodexNativeSubagentCompletionsFromText,
|
|
1625
|
+
deliveredAgentPaths: readDeliveredNativeCompletionPaths
|
|
1517
1626
|
};
|
|
1627
|
+
/** Reads native delivery receipts, leaving status and result ownership with the child lifecycle. */
|
|
1628
|
+
function readDeliveredNativeCompletionPaths(notification) {
|
|
1629
|
+
if (notification.method !== "rawResponseItem/completed") return [];
|
|
1630
|
+
const params = isJsonObject(notification.params) ? notification.params : void 0;
|
|
1631
|
+
const item = isJsonObject(params?.item) ? params.item : void 0;
|
|
1632
|
+
if (!item || readStringField(item, "type") !== "agent_message") return extractCodexNativeSubagentCompletions(notification).map((completion) => completion.agentPath);
|
|
1633
|
+
const author = readStringField(item, "author");
|
|
1634
|
+
const recipient = readStringField(item, "recipient");
|
|
1635
|
+
const content = item.content;
|
|
1636
|
+
if (!author || !recipient || !Array.isArray(content) || content.length !== 1) return [];
|
|
1637
|
+
const part = content[0];
|
|
1638
|
+
if (!isJsonObject(part) || readStringField(part, "type") !== "input_text") return [];
|
|
1639
|
+
return readStringField(part, "text")?.startsWith(`Message Type: FINAL_ANSWER\nTask name: ${recipient}\nSender: ${author}\nPayload:\n`) ? [author] : [];
|
|
1640
|
+
}
|
|
1518
1641
|
function parseCodexNativeSubagentNotificationBody(body) {
|
|
1519
1642
|
let payload;
|
|
1520
1643
|
try {
|
|
@@ -2113,7 +2236,11 @@ var Monitor = class {
|
|
|
2113
2236
|
this.releaseRetainedClient();
|
|
2114
2237
|
for (const release of this.parentThreadRetentions.values()) release();
|
|
2115
2238
|
this.parentThreadRetentions.clear();
|
|
2116
|
-
for (const state of this.parentStates.values())
|
|
2239
|
+
for (const state of this.parentStates.values()) {
|
|
2240
|
+
state.owners.clear();
|
|
2241
|
+
state.turnIds.clear();
|
|
2242
|
+
this.deliverDetachedCompletions(state);
|
|
2243
|
+
}
|
|
2117
2244
|
this.pendingDirectSpawnEvidence.clear();
|
|
2118
2245
|
for (const [parentThreadId] of this.parentStates) if (![...this.childStates.values()].some((childState) => childState.parentThreadId === parentThreadId)) this.parentStates.delete(parentThreadId);
|
|
2119
2246
|
}
|
|
@@ -2126,7 +2253,9 @@ var Monitor = class {
|
|
|
2126
2253
|
if (!state) {
|
|
2127
2254
|
state = {
|
|
2128
2255
|
parentThreadId,
|
|
2129
|
-
owners: /* @__PURE__ */ new Map()
|
|
2256
|
+
owners: /* @__PURE__ */ new Map(),
|
|
2257
|
+
turnIds: /* @__PURE__ */ new Set(),
|
|
2258
|
+
nativeCompletionReceipts: /* @__PURE__ */ new Set()
|
|
2130
2259
|
};
|
|
2131
2260
|
this.parentStates.set(parentThreadId, state);
|
|
2132
2261
|
}
|
|
@@ -2156,6 +2285,7 @@ var Monitor = class {
|
|
|
2156
2285
|
const current = registeredState.owners.get(owner);
|
|
2157
2286
|
if (!current || [...registeredState.owners.values()].some((other) => other !== current && other.turnId === turnId)) return;
|
|
2158
2287
|
current.turnId = turnId;
|
|
2288
|
+
registeredState.turnIds.add(turnId);
|
|
2159
2289
|
this.drainPendingDirectSpawnEvidence(registeredState, current, turnId);
|
|
2160
2290
|
this.clearUnconsumablePendingDirectSpawnEvidence();
|
|
2161
2291
|
},
|
|
@@ -2164,8 +2294,15 @@ var Monitor = class {
|
|
|
2164
2294
|
registered = false;
|
|
2165
2295
|
const current = this.parentStates.get(parentThreadId);
|
|
2166
2296
|
if (current === registeredState) {
|
|
2297
|
+
const turnId = current.owners.get(owner)?.turnId;
|
|
2167
2298
|
current.owners.delete(owner);
|
|
2299
|
+
if (turnId) current.turnIds.delete(turnId);
|
|
2300
|
+
if (current.owners.size === 0) {
|
|
2301
|
+
current.turnIds.clear();
|
|
2302
|
+
current.nativeCompletionReceipts = /* @__PURE__ */ new Set();
|
|
2303
|
+
}
|
|
2168
2304
|
this.clearUnconsumablePendingDirectSpawnEvidence();
|
|
2305
|
+
this.deliverDetachedCompletions(current);
|
|
2169
2306
|
this.pruneParentIfUnused(current);
|
|
2170
2307
|
}
|
|
2171
2308
|
}
|
|
@@ -2203,6 +2340,11 @@ var Monitor = class {
|
|
|
2203
2340
|
const startedThread = isJsonObject(params?.thread) ? params.thread : void 0;
|
|
2204
2341
|
const threadId = readStringField(params, "threadId")?.trim() ?? readStringField(startedThread, "id")?.trim();
|
|
2205
2342
|
const threadStatus = isJsonObject(params?.status) ? normalizeIdentifier(readStringField(params.status, "type")) : void 0;
|
|
2343
|
+
const parent = threadId ? this.parentStates.get(threadId) : void 0;
|
|
2344
|
+
if (parent && parent.owners.size > 0 && notification.method === "turn/started") {
|
|
2345
|
+
const turnId = isJsonObject(params?.turn) ? readStringField(params.turn, "id") : void 0;
|
|
2346
|
+
if (turnId) parent.turnIds.add(turnId);
|
|
2347
|
+
}
|
|
2206
2348
|
const tracksRecoveryRevision = Boolean(threadId && this.threadStatusRevisions.has(threadId));
|
|
2207
2349
|
if (RECOVERY_REVISION_NOTIFICATION_METHODS.has(notification.method) && threadId && tracksRecoveryRevision) this.threadStatusRevisions.get(threadId).value += 1;
|
|
2208
2350
|
if (!state && (!threadId || !this.parentStates.has(threadId) && !this.childStates.has(threadId) && !tracksRecoveryRevision)) return;
|
|
@@ -2216,7 +2358,12 @@ var Monitor = class {
|
|
|
2216
2358
|
}
|
|
2217
2359
|
if (state) this.handleClosedChild(notification, state);
|
|
2218
2360
|
const childState = threadId ? this.childStates.get(threadId) : void 0;
|
|
2219
|
-
if (notification.method === "turn/started" && childState)
|
|
2361
|
+
if (notification.method === "turn/started" && childState) {
|
|
2362
|
+
childState.nativeCompletionDelivered = false;
|
|
2363
|
+
for (const key of childState.agentPathKeys) state?.nativeCompletionReceipts.delete(key);
|
|
2364
|
+
this.resumeChild(childState);
|
|
2365
|
+
}
|
|
2366
|
+
if (parent && parent.turnIds.has(readStringField(params, "turnId") ?? "")) this.recordNativeCompletionDelivery(parent, notification);
|
|
2220
2367
|
if (childState && !childState.terminal) this.emitChildTaskActivity(notification, childState);
|
|
2221
2368
|
this.captureChildAssistantMessage(notification);
|
|
2222
2369
|
await this.handleChildTurnCompletion(notification);
|
|
@@ -2528,6 +2675,7 @@ var Monitor = class {
|
|
|
2528
2675
|
this.unregisterChild(childState);
|
|
2529
2676
|
return false;
|
|
2530
2677
|
}
|
|
2678
|
+
if (recovery.agentPath) this.registerAgentPath(childState, recovery.agentPath);
|
|
2531
2679
|
if (recovery.threadState === "active") {
|
|
2532
2680
|
this.observeActiveChild(childState);
|
|
2533
2681
|
return false;
|
|
@@ -2593,6 +2741,7 @@ var Monitor = class {
|
|
|
2593
2741
|
}
|
|
2594
2742
|
return {
|
|
2595
2743
|
parentThreadId: readThreadParentThreadId(thread),
|
|
2744
|
+
agentPath: normalizeOptionalString(readStringField(readThreadSpawnSource(thread), "agent_path")),
|
|
2596
2745
|
completion,
|
|
2597
2746
|
fallbackCompletion,
|
|
2598
2747
|
resumable,
|
|
@@ -2624,6 +2773,10 @@ var Monitor = class {
|
|
|
2624
2773
|
this.unregisterChild(childState);
|
|
2625
2774
|
return;
|
|
2626
2775
|
}
|
|
2776
|
+
if (childState.nativeCompletionDelivered) {
|
|
2777
|
+
this.finishCompletionDelivery(state, childState);
|
|
2778
|
+
return;
|
|
2779
|
+
}
|
|
2627
2780
|
childState.pendingCompletion = completion;
|
|
2628
2781
|
state.taskRuntime?.setDetachedTaskDeliveryStatusByRunId({
|
|
2629
2782
|
runId: codexNativeSubagentRunId(completion.childThreadId),
|
|
@@ -2635,6 +2788,7 @@ var Monitor = class {
|
|
|
2635
2788
|
async deliverPendingCompletion(state, childState) {
|
|
2636
2789
|
const completion = childState.pendingCompletion;
|
|
2637
2790
|
if (!completion || !state.requesterSessionKey || !state.taskRuntimeScope) return;
|
|
2791
|
+
if (state.owners.size > 0) return;
|
|
2638
2792
|
if (childState.deliveringCompletion || childState.completionDeliveryTimer) return;
|
|
2639
2793
|
childState.deliveringCompletion = true;
|
|
2640
2794
|
try {
|
|
@@ -2652,13 +2806,7 @@ var Monitor = class {
|
|
|
2652
2806
|
});
|
|
2653
2807
|
if (this.childStates.get(childState.childThreadId) !== childState || this.parentStates.get(state.parentThreadId) !== state) return;
|
|
2654
2808
|
if (isDurableAgentHarnessCompletionDelivery(delivery)) {
|
|
2655
|
-
|
|
2656
|
-
childState.completionDeliveryAttempt = 0;
|
|
2657
|
-
state.taskRuntime?.setDetachedTaskDeliveryStatusByRunId({
|
|
2658
|
-
runId: codexNativeSubagentRunId(completion.childThreadId),
|
|
2659
|
-
deliveryStatus: "delivered"
|
|
2660
|
-
});
|
|
2661
|
-
this.unregisterChild(childState);
|
|
2809
|
+
this.finishCompletionDelivery(state, childState);
|
|
2662
2810
|
return;
|
|
2663
2811
|
}
|
|
2664
2812
|
const error = delivery.error ?? "completion delivery did not produce a parent response";
|
|
@@ -2686,6 +2834,29 @@ var Monitor = class {
|
|
|
2686
2834
|
childState.deliveringCompletion = false;
|
|
2687
2835
|
}
|
|
2688
2836
|
}
|
|
2837
|
+
recordNativeCompletionDelivery(state, notification) {
|
|
2838
|
+
for (const agentPath of codexNativeSubagentNotifications.deliveredAgentPaths(notification)) {
|
|
2839
|
+
const key = buildParentAgentPathKey(state.parentThreadId, agentPath);
|
|
2840
|
+
state.nativeCompletionReceipts.add(key);
|
|
2841
|
+
const childThreadId = this.childThreadIdsByAgentPath.get(key);
|
|
2842
|
+
const child = childThreadId ? this.childStates.get(childThreadId) : void 0;
|
|
2843
|
+
if (!child || child.parentThreadId !== state.parentThreadId) continue;
|
|
2844
|
+
child.nativeCompletionDelivered = true;
|
|
2845
|
+
if (child.pendingCompletion && !child.deliveringCompletion) this.finishCompletionDelivery(state, child);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
finishCompletionDelivery(state, child) {
|
|
2849
|
+
child.pendingCompletion = void 0;
|
|
2850
|
+
child.completionDeliveryAttempt = 0;
|
|
2851
|
+
state.taskRuntime?.setDetachedTaskDeliveryStatusByRunId({
|
|
2852
|
+
runId: codexNativeSubagentRunId(child.childThreadId),
|
|
2853
|
+
deliveryStatus: "delivered"
|
|
2854
|
+
});
|
|
2855
|
+
this.unregisterChild(child);
|
|
2856
|
+
}
|
|
2857
|
+
deliverDetachedCompletions(state) {
|
|
2858
|
+
for (const child of this.childStates.values()) if (child.parentThreadId === state.parentThreadId && child.pendingCompletion) this.deliverPendingCompletion(state, child);
|
|
2859
|
+
}
|
|
2689
2860
|
scheduleCompletionDeliveryRetry(childState, error) {
|
|
2690
2861
|
if (!childState.pendingCompletion || childState.completionDeliveryTimer || this.childStates.get(childState.childThreadId) !== childState) return;
|
|
2691
2862
|
if (childState.completionDeliveryAttempt >= this.completionDeliveryMaxRetries) {
|
|
@@ -2735,6 +2906,7 @@ var Monitor = class {
|
|
|
2735
2906
|
assistantMessagesByTurn: /* @__PURE__ */ new Map(),
|
|
2736
2907
|
recoveryAttempt: 0,
|
|
2737
2908
|
terminal: false,
|
|
2909
|
+
nativeCompletionDelivered: false,
|
|
2738
2910
|
settledWithoutCompletion: false,
|
|
2739
2911
|
completionDeliveryAttempt: 0,
|
|
2740
2912
|
deliveringCompletion: false
|
|
@@ -2821,6 +2993,7 @@ var Monitor = class {
|
|
|
2821
2993
|
}
|
|
2822
2994
|
this.childThreadIdsByAgentPath.set(key, childState.childThreadId);
|
|
2823
2995
|
childState.agentPathKeys.add(key);
|
|
2996
|
+
if (this.parentStates.get(childState.parentThreadId)?.nativeCompletionReceipts.has(key)) childState.nativeCompletionDelivered = true;
|
|
2824
2997
|
}
|
|
2825
2998
|
unregisterChild(childState, options = {}) {
|
|
2826
2999
|
this.releaseDirectChild(childState);
|
|
@@ -2970,6 +3143,7 @@ var Monitor = class {
|
|
|
2970
3143
|
const childThreadId = task.runId.slice(13).trim();
|
|
2971
3144
|
candidates.set(childThreadId, {
|
|
2972
3145
|
parentState: state,
|
|
3146
|
+
nativeCompletionReceipts: state.nativeCompletionReceipts,
|
|
2973
3147
|
requesterSessionKey: state.requesterSessionKey,
|
|
2974
3148
|
childThreadId,
|
|
2975
3149
|
recoveryAttempt: 0,
|
|
@@ -3046,6 +3220,8 @@ var Monitor = class {
|
|
|
3046
3220
|
state = {
|
|
3047
3221
|
parentThreadId,
|
|
3048
3222
|
owners: /* @__PURE__ */ new Map(),
|
|
3223
|
+
turnIds: /* @__PURE__ */ new Set(),
|
|
3224
|
+
nativeCompletionReceipts: /* @__PURE__ */ new Set(),
|
|
3049
3225
|
requesterSessionKey: candidate.requesterSessionKey,
|
|
3050
3226
|
taskRuntimeScope: candidate.taskRuntimeScope,
|
|
3051
3227
|
agentId: candidate.agentId,
|
|
@@ -3054,11 +3230,12 @@ var Monitor = class {
|
|
|
3054
3230
|
this.prepareParentTaskRuntime(state);
|
|
3055
3231
|
this.parentStates.set(parentThreadId, state);
|
|
3056
3232
|
}
|
|
3057
|
-
const childState = this.registerChildThread(state, candidate.childThreadId);
|
|
3233
|
+
const childState = this.registerChildThread(state, candidate.childThreadId, recovery.agentPath ? { agentPath: recovery.agentPath } : {});
|
|
3058
3234
|
if (!childState) {
|
|
3059
3235
|
this.pruneParentIfUnused(state);
|
|
3060
3236
|
return;
|
|
3061
3237
|
}
|
|
3238
|
+
if ([...childState.agentPathKeys].some((key) => candidate.nativeCompletionReceipts.has(key))) childState.nativeCompletionDelivered = true;
|
|
3062
3239
|
if (recovery.threadState === "active") this.observeActiveChild(childState);
|
|
3063
3240
|
if (recovery.threadState === "other") this.clearSystemErrorFallback(childState);
|
|
3064
3241
|
if (recovery.resumable) {
|
|
@@ -3222,4 +3399,4 @@ function unrefTimer(timer) {
|
|
|
3222
3399
|
if (typeof timer === "object" && timer && "unref" in timer) timer.unref();
|
|
3223
3400
|
}
|
|
3224
3401
|
//#endregion
|
|
3225
|
-
export {
|
|
3402
|
+
export { readCodexMirroredSessionHistoryMessages as a, inferCodexDynamicToolMeta as c, sanitizeCodexToolArguments as d, sanitizeCodexToolResponse as f, CodexToolTranscriptProjection as i, isCodexCommandBearingToolCall as l, CodexEventProjection as n, CodexToolProgressProjection as o, emitCodexAgentEvent as r, shouldEmitTranscriptToolProgress as s, codexNativeSubagentMonitorRuntime as t, resolveCodexToolProgressDetailMode as u };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createStdioTransport } from "./transport-stdio-
|
|
3
|
-
import { n as resolveManagedCodexAppServerStartOptions, r as resolveManagedCodexNativeCommand, t as isManagedCodexDesktopCommand } from "./managed-binary-By4FZC6i.js";
|
|
1
|
+
import { n as resolveManagedCodexAppServerStartOptions, r as resolveManagedCodexNativeCommand, t as isManagedCodexDesktopCommand } from "./managed-binary-ZkGodW19.js";
|
|
2
|
+
import { i as closeCodexAppServerTransportAndWait, t as createStdioTransport } from "./transport-stdio-C7-s9TLG.js";
|
|
4
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
4
|
import { mkdir } from "node:fs/promises";
|
|
6
5
|
import path from "node:path";
|
|
@@ -125,7 +124,8 @@ async function runCodexNodeExecServer(params) {
|
|
|
125
124
|
customAllowedPatterns: [NODE_EXEC_SERVER_PLATFORM_ENVIRONMENT]
|
|
126
125
|
}).allowed;
|
|
127
126
|
if (io.signal.aborted) throw nodeExecServerAbortError(io.signal);
|
|
128
|
-
|
|
127
|
+
params.assertExecAuthorized();
|
|
128
|
+
const child = await createStdioTransport({
|
|
129
129
|
transport: "stdio",
|
|
130
130
|
command: native,
|
|
131
131
|
commandSource: "resolved-managed",
|
|
@@ -138,7 +138,10 @@ async function runCodexNodeExecServer(params) {
|
|
|
138
138
|
...process.platform === "win32" ? { USERPROFILE: dir } : {}
|
|
139
139
|
},
|
|
140
140
|
clearEnv: ["NODE_OPTIONS"]
|
|
141
|
-
}, baseEnv)
|
|
141
|
+
}, baseEnv, () => {
|
|
142
|
+
if (io.signal.aborted) throw nodeExecServerAbortError(io.signal);
|
|
143
|
+
params.assertExecAuthorized();
|
|
144
|
+
});
|
|
142
145
|
child.stdin.on("error", (error) => {
|
|
143
146
|
rejectDisconnected(error);
|
|
144
147
|
});
|
package/dist/{plugin-approval-roundtrip-C75Yiiwc.js → plugin-approval-roundtrip-D80UZiJ_.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as resolveCodexGatewayTimeoutWithGraceMs } from "./shared-client-kNkljY-R.js";
|
|
2
2
|
import { isApprovalNotFoundError, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
3
3
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
4
4
|
//#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
|