@openclaw/codex 2026.9.3 → 2026.9.5
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/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/account-usage-runtime-C2MOIvfq.mjs +75 -0
- package/dist/{apply-B6el6hdO.js → .setup/apply-CJ0ZfmBG.mjs} +12 -13
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-D6cR54TV.js → .setup/attempt-client-cleanup-BpYKdTA0.mjs} +30 -211
- package/dist/{attempt-context-AO4DSjE0.js → .setup/attempt-context-VXVwTCfS.mjs} +6 -6
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
- package/dist/{auth-binding-Co2Vfcf_.js → .setup/auth-binding-DhLWa_7K.mjs} +2 -2
- package/dist/{auth-cache-key-Kq6oerr6.js → .setup/auth-cache-key-QirmgiCo.mjs} +3 -3
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/binding-connection-Bm38niE8.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-CnRMC0ta.mjs +48 -0
- package/dist/{bounded-turn-lRpmZHFv.js → .setup/bounded-turn-BtlZcivC.mjs} +19 -14
- package/dist/{build-state-6RL6qohz.js → .setup/build-state-Xx9ybZqa.mjs} +1 -1
- package/dist/{capabilities-BeqLPbtM.js → .setup/capabilities-_vXcZGSx.mjs} +1 -1
- package/dist/{client-BEKu4yDx.js → .setup/client-vXs2929Q.mjs} +355 -164
- package/dist/{command-dispatch-CisT9Jqq.js → .setup/command-dispatch-naHIZwwF.mjs} +3 -3
- package/dist/{command-formatters-DeTfrapr.js → .setup/command-formatters-CGEkdawF.mjs} +4 -3
- package/dist/{command-handlers-BfIsJEuA.js → .setup/command-handlers-BtAJEW1X.mjs} +812 -152
- package/dist/{command-rpc-BMqRQOFX.js → .setup/command-rpc-DHFpn4le.mjs} +37 -21
- package/dist/{compact-CGJZ2rlb.js → .setup/compact-C3i3qlzj.mjs} +28 -43
- package/dist/{config-JDfTI4VI.js → .setup/config-CedDWjM-.mjs} +5 -4
- package/dist/{config-options-jnIFvwxD.js → .setup/config-options-BsanJ8QG.mjs} +9 -421
- package/dist/{protocol-CAAcVIKF.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-BWf6JLWG.js → .setup/config-runtime-CeAhl_h4.mjs} +2 -2
- package/dist/.setup/config-security-BRQ2mgW9.mjs +465 -0
- package/dist/{config-utils-C57JiJrU.js → .setup/config-utils-DujwEnhg.mjs} +2 -4
- package/dist/{conversation-binding-CxOlHiix.js → .setup/conversation-binding-DhzrpTM6.mjs} +60 -47
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CUCrSIQI.js → .setup/conversation-control-DN53ns41.mjs} +17 -13
- package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
- package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
- package/dist/{dynamic-tools-D-JBoaLt.js → .setup/dynamic-tools-D16lOp67.mjs} +168 -61
- package/dist/{effective-mcp-catalog-J_5Ep5Um.js → .setup/effective-mcp-catalog-K6kLCN8X.mjs} +3 -3
- package/dist/{ephemeral-turn-DSwzP8YY.js → .setup/ephemeral-turn-R1gA8Sn6.mjs} +4 -5
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-DNUR1s0A.mjs} +6 -3
- package/dist/.setup/event-projector-items-DyTQ_XqL.mjs +200 -0
- package/dist/{attempt-notifications--H8zXR5-.js → .setup/event-projector-usage-C7Ntzs-f.mjs} +102 -9
- package/dist/{harness-FR6eQgyO.js → .setup/harness-rxaaoN-o.mjs} +90 -19
- package/dist/.setup/inference-context-fulhZuz8.mjs +94 -0
- package/dist/.setup/inference-proxy-CC15HuSi.mjs +311 -0
- package/dist/{isolated-completion-DHBefrzg.js → .setup/isolated-completion-B6srt48J.mjs} +7 -7
- package/dist/{launch-args-RXQwn8zV.js → .setup/launch-args-DnMak49W.mjs} +22 -1
- package/dist/{managed-binary-DrjjRRUD.js → .setup/managed-binary-DP6Rib3P.mjs} +11 -2
- package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
- package/dist/{model-catalog-B_6M04Wo.js → .setup/model-catalog-DkvUuBey.mjs} +35 -10
- package/dist/{models-P9k2qAof.js → .setup/models-BDFgm_G-.mjs} +3 -3
- package/dist/.setup/native-auth-BLZGqFjw.mjs +57 -0
- package/dist/.setup/native-subagent-history-YXaL6dMd.mjs +135 -0
- package/dist/.setup/native-subagent-monitor-B1hxzIOy.mjs +5031 -0
- package/dist/.setup/native-subagent-task-ids-DsuOonKv.mjs +411 -0
- package/dist/{node-cli-sessions-rj0ysJwM.js → .setup/node-cli-sessions-Cl8b2ZF3.mjs} +1 -1
- package/dist/{node-exec-server.runtime-BY_ctYnT.js → .setup/node-exec-server.runtime-BaViBKNz.mjs} +5 -5
- package/dist/{plan-BMJdMOEF.js → .setup/plan-xD7WKYTM.mjs} +331 -79
- package/dist/{plugin-activation-BQK-f5sV.js → .setup/plugin-activation-r8nq5Jzp.mjs} +24 -19
- package/dist/{plugin-app-cache-key-CdSQzWyX.js → .setup/plugin-app-cache-key-BOxKP7db.mjs} +29 -25
- package/dist/{plugin-approval-roundtrip-DeW95wB5.js → .setup/plugin-approval-roundtrip-CjfzafAZ.mjs} +1 -1
- package/dist/{plugin-inventory-CoRCzWW4.js → .setup/plugin-inventory-DUle8DLz.mjs} +12 -8
- package/dist/{plugin-marketplace-discovery-3akBizzF.js → .setup/plugin-marketplace-discovery-P-Vndfqq.mjs} +18 -15
- package/dist/{plugin-metadata-cache-DgNfRAGA.js → .setup/plugin-metadata-cache-DsS5buNa.mjs} +33 -14
- package/dist/{provider-capabilities-W4tfK5Y5.js → .setup/provider-capabilities-B8J4Dy-O.mjs} +2 -2
- package/dist/.setup/provider-fFh_-VR3.mjs +50 -0
- package/dist/{rate-limits-Bqnx1N4z.js → .setup/rate-limits-DOEGYRNs.mjs} +90 -46
- package/dist/.setup/request-BioXJLYa.mjs +292 -0
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{run-attempt-DwKds3DN.js → .setup/run-attempt-rlA07pUv.mjs} +644 -491
- package/dist/{runtime-artifact-T-NwqeSH.js → .setup/runtime-artifact-Dy38Z5iU.mjs} +2 -2
- package/dist/{sandbox-guard-BcT66fWy.js → .setup/sandbox-guard-BBP-RbTf.mjs} +4 -3
- package/dist/{session-binding-CKSepwIC.js → .setup/session-binding-_0W_fHRr.mjs} +45 -63
- package/dist/{session-binding-record-CaZjYwNS.js → .setup/session-binding-record-TH3xA0zj.mjs} +181 -3
- package/dist/.setup/session-binding-sidecars-CKYEcfNn.mjs +543 -0
- package/dist/{session-catalog-adoption-BKLtSrwi.js → .setup/session-catalog-adoption-CR_whkEW.mjs} +6 -6
- package/dist/{session-catalog-archive-D0i2pGj2.js → .setup/session-catalog-archive-CwZaPacf.mjs} +6 -6
- package/dist/.setup/session-catalog-events-jMcYfQyd.mjs +250 -0
- package/dist/.setup/session-catalog-fUdWDx-U.mjs +2464 -0
- package/dist/.setup/session-catalog-index-B141u15s.mjs +1070 -0
- package/dist/.setup/session-catalog-index-order-Cc5BzlQr.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-BAuDztHN.mjs +180 -0
- package/dist/{session-catalog-parsing-CdD3JhdM.js → .setup/session-catalog-native-projection-ChV3cCtm.mjs} +213 -21
- package/dist/{session-catalog-node-adoption-BUuDYY8R.js → .setup/session-catalog-node-adoption-BVRsYOSh.mjs} +3 -3
- package/dist/{session-catalog-node-continue-CBtc4wkI.js → .setup/session-catalog-node-continue-Dowv8osw.mjs} +7 -7
- package/dist/.setup/session-catalog-projection-C1Bj9Jl-.mjs +414 -0
- package/dist/{session-cli-CbgaHh0f.js → .setup/session-cli-DIj-IE-E.mjs} +4 -4
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-C--SrLI8.mjs} +10 -5
- package/dist/{session-history-import-DFN7sWRU.js → .setup/session-history-import-JHXT5Xfi.mjs} +4 -4
- package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
- package/dist/{session-history.worker-CNEvGaU5.js → .setup/session-history.worker-CpNj7H_P.mjs} +192 -89
- package/dist/{session-initialization-Jo86C60I.js → .setup/session-initialization-DH1z6fXn.mjs} +2 -2
- package/dist/{session-permission-policy-B22InTp_.js → .setup/session-permission-policy-DhurXY0l.mjs} +2 -2
- package/dist/{session-retirement-BSNG_mhf.js → .setup/session-retirement-CU87AOg9.mjs} +6 -6
- package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
- package/dist/{settled-turn-finalizer-BuLUrZl2.js → .setup/settled-turn-finalizer-CiY2bLFK.mjs} +10 -10
- package/dist/{shared-client-CVhez2Uo.js → .setup/shared-client-BpTtuLQ5.mjs} +495 -156
- package/dist/{side-question-DLbr2vUU.js → .setup/side-question-DSCZyoBD.mjs} +64 -47
- package/dist/{source-Da-h6f7e.js → .setup/source-Bjp4UQij.mjs} +15 -14
- package/dist/{thread-archive-guard-D1bP04Tf.js → .setup/thread-archive-guard-jmecf6OJ.mjs} +1 -1
- package/dist/.setup/thread-history-page-BTx-4xsg.mjs +83 -0
- package/dist/{thread-lifecycle-D1pzRwHB.js → .setup/thread-lifecycle-Cik28qWn.mjs} +330 -150
- package/dist/{thread-ownership-D6oASVRu.js → .setup/thread-ownership-skomxnIt.mjs} +4 -4
- package/dist/{thread-policy-D8kI7yAO.js → .setup/thread-policy-Cjs4B8xf.mjs} +3 -3
- package/dist/{thread-resume-T5cveyxA.js → .setup/thread-resume-BkNpj9Pz.mjs} +8 -5
- package/dist/.setup/timeout-DZF05XrR.mjs +63 -0
- package/dist/{session-catalog-home-id-D7-aLiNt.js → .setup/transcript-history-projection-DHNBDhCU.mjs} +73 -20
- package/dist/{transcript-mirror-t5TOccct.js → .setup/transcript-mirror-D4qp_leP.mjs} +15 -6
- package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
- package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-Cmx94Oiy.mjs} +149 -44
- package/dist/{upstream-session-fork-De-sLJ2r.js → .setup/upstream-session-fork-D3UKxgVD.mjs} +27 -26
- package/dist/{usage-CPPTmBvZ.js → .setup/usage-BOgBEKso.mjs} +4 -4
- package/dist/.setup/usage-limit-error-C0ow7DOc.mjs +166 -0
- package/dist/{version-omm6IPI3.js → .setup/version-CoqzXPgK.mjs} +1 -1
- package/dist/{web-search-provider.runtime-CSVgQL0w.js → .setup/web-search-provider.runtime-CTGuJt6i.mjs} +3 -3
- package/dist/api.js +28 -20
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +8 -528
- package/dist/harness.js +1 -1
- package/dist/index.js +130 -135
- package/dist/media-understanding-provider.js +3 -3
- package/dist/migration-provider-api.js +2 -0
- package/dist/native-tool-policy.js +12 -0
- package/dist/provider-discovery.js +18 -0
- package/dist/session-history-worker-runtime.js +23 -5
- package/dist/session-history.worker.js +2 -2
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +354 -68
- package/package.json +11 -8
- package/dist/binding-connection-QqgcPCgk.js +0 -60
- package/dist/event-projector-usage-CIyrYYid.js +0 -102
- package/dist/native-subagent-monitor-BbCUKRwC.js +0 -3350
- package/dist/request-CGvGOpeR.js +0 -198
- package/dist/session-catalog-HaDcp7Sv.js +0 -1533
- package/dist/session-catalog-provenance-DkJHo735.js +0 -124
- package/dist/timeout-BVw8aaM1.js +0 -33
- package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
- package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
- package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
- package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
- package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
- package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
- package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
- package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-YBMHSzC4.mjs} +1 -1
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
- /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { m as isJsonObject } from "./config-security-BRQ2mgW9.mjs";
|
|
2
|
+
import { C as readNonEmptyString, _ as normalizeOptionalString$1, c as itemName, l as itemStatus, m as shouldSynthesizeToolProgressForItem, w as readNonEmptyStringArray } from "./event-projector-items-DyTQ_XqL.mjs";
|
|
3
|
+
import { asNonArrayRecord, normalizeOptionalString, 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
|
+
/** Task runtime namespace for Codex native subagent task rows. */
|
|
377
|
+
const CODEX_NATIVE_SUBAGENT_RUNTIME = "subagent";
|
|
378
|
+
/** Task kind used to distinguish native Codex subagents from other subagent runtimes. */
|
|
379
|
+
const CODEX_NATIVE_SUBAGENT_TASK_KIND = "codex-native";
|
|
380
|
+
/** Run id prefix for task rows keyed by Codex child thread ids. */
|
|
381
|
+
const CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX = "codex-thread:";
|
|
382
|
+
/** Initial tasks keep their shipped locator; later assignments belong to a native turn. */
|
|
383
|
+
function codexNativeSubagentRunId(threadId, turnId) {
|
|
384
|
+
return `${CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX}${threadId.trim()}${turnId ? `:turn:${turnId}` : ""}`;
|
|
385
|
+
}
|
|
386
|
+
function readCodexNativeSubagentRunId(runId) {
|
|
387
|
+
if (!runId?.startsWith("codex-thread:")) return;
|
|
388
|
+
const [threadId, turnId] = runId.slice(13).split(":turn:");
|
|
389
|
+
return threadId?.trim() ? {
|
|
390
|
+
threadId,
|
|
391
|
+
...turnId ? { turnId } : {}
|
|
392
|
+
} : void 0;
|
|
393
|
+
}
|
|
394
|
+
function readNativeTaskAssignment(task) {
|
|
395
|
+
const runId = task.runId;
|
|
396
|
+
const identity = readCodexNativeSubagentRunId(runId);
|
|
397
|
+
if (!runId || !identity) return;
|
|
398
|
+
const storedTurnId = isJsonObject(task.detail) ? normalizeOptionalString(readStringField(task.detail, "nativeTurnId")) : void 0;
|
|
399
|
+
return {
|
|
400
|
+
runId,
|
|
401
|
+
childThreadId: identity.threadId,
|
|
402
|
+
nativeTurnId: storedTurnId ?? identity.turnId,
|
|
403
|
+
initialTurnId: identity.turnId
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function readNativeSubagentThreadIds(value) {
|
|
407
|
+
if (!Array.isArray(value)) return [];
|
|
408
|
+
return value.filter((entry) => typeof entry === "string" && entry.trim() !== "");
|
|
409
|
+
}
|
|
410
|
+
//#endregion
|
|
411
|
+
export { truncateToolTranscriptText as A, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS as C, formatToolSummary as D, formatToolOutput as E, normalizeToolTranscriptArguments as O, TOOL_PROGRESS_ECHO_PREFIX_MIN_CHARS as S, collectDynamicToolContentText as T, inferCodexDynamicToolMeta as _, readCodexNativeSubagentRunId as a, sanitizeCodexToolArguments as b, isCommandBearingToolItem as c, itemOutputText as d, itemToolArgs as f, shouldSuppressChannelProgressForItem as g, itemTranscriptResultText as h, codexNativeSubagentRunId as i, toolOutputRawEchoSignature as k, isNativePostToolUseRelayItem as l, itemToolResult as m, CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX as n, readNativeSubagentThreadIds as o, itemToolError as p, CODEX_NATIVE_SUBAGENT_TASK_KIND as r, readNativeTaskAssignment as s, CODEX_NATIVE_SUBAGENT_RUNTIME as t, itemMeta as u, isCodexCommandBearingToolCall as v, ToolOutputAccumulator as w, sanitizeCodexToolResponse as x, resolveCodexToolProgressDetailMode as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as formatCodexDisplayText } from "./command-formatters-CGEkdawF.mjs";
|
|
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";
|
package/dist/{node-exec-server.runtime-BY_ctYnT.js → .setup/node-exec-server.runtime-BaViBKNz.mjs}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as closeCodexAppServerTransportAndWait, t as createStdioTransport } from "./transport-stdio-
|
|
1
|
+
import { i as resolveManagedCodexNativeCommand, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand } from "./managed-binary-DP6Rib3P.mjs";
|
|
2
|
+
import { i as closeCodexAppServerTransportAndWait, t as createStdioTransport } from "./transport-stdio-Cmx94Oiy.mjs";
|
|
3
3
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
+
import { stripVTControlCharacters } from "node:util";
|
|
4
5
|
import { killProcessTree } from "openclaw/plugin-sdk/process-runtime";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import { mkdir } from "node:fs/promises";
|
|
7
8
|
import { once } from "node:events";
|
|
8
9
|
import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
|
|
9
10
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
10
|
-
import { stripVTControlCharacters } from "node:util";
|
|
11
11
|
import { StringDecoder } from "node:string_decoder";
|
|
12
12
|
import { sanitizeEnvVars } from "openclaw/plugin-sdk/sandbox";
|
|
13
13
|
//#region extensions/codex/src/node-exec-server.runtime.ts
|
|
@@ -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, () => {
|