@openclaw/codex 2026.9.6 → 2026.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +2 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-DFhbh1zz.mjs} +5 -5
  4. package/dist/.setup/{apply-DDOi8uNx.mjs → apply-D3GcSoSa.mjs} +22 -36
  5. package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +128 -37
  6. package/dist/.setup/attempt-workspace-context-C5HigshI.mjs +164 -0
  7. package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
  8. package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dbvq-QgB.mjs} +36 -34
  9. package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
  10. package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
  11. package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
  13. package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-CbjoN2OW.mjs} +15 -18
  14. package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
  15. package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-Da1_z0kd.mjs} +1 -1
  16. package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
  17. package/dist/.setup/{client-Cs08OXVQ.mjs → client-N0JpgSzF.mjs} +138 -399
  18. package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-5HHLdcde.mjs} +1 -1
  19. package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-BeAoaovI.mjs} +5 -8
  20. package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
  21. package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-ylTMS00z.mjs} +222 -343
  22. package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-CGJGUQ6Y.mjs} +15 -18
  23. package/dist/.setup/compact-C2WamavS.mjs +776 -0
  24. package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
  25. package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
  26. package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
  27. package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
  28. package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
  29. package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
  30. package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
  31. package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-3Min8qvP.mjs} +67 -90
  32. package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
  33. package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-CEP8X5JC.mjs} +8 -8
  34. package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
  35. package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
  36. package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-DzlsLUuS.mjs} +2305 -2606
  37. package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
  38. package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-CDsPJOa2.mjs} +3 -3
  39. package/dist/.setup/event-projector-assistant-message-CigreO4K.mjs +69 -0
  40. package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
  41. package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
  42. package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
  43. package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
  44. package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
  45. package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
  46. package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
  47. package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-Dm3PzxJk.mjs} +9 -12
  48. package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
  49. package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-PAuZgJC6.mjs} +11 -10
  50. package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
  51. package/dist/.setup/{models-KnqBv0hE.mjs → models-DHXZtVVk.mjs} +9 -18
  52. package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
  53. package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
  54. package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-Dpsmf2wz.mjs} +4395 -3609
  55. package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
  56. package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
  57. package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
  58. package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
  59. package/dist/.setup/{plan-CN3VwfNU.mjs → plan-Y-QIvrKB.mjs} +49 -92
  60. package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
  61. package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
  62. package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
  63. package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
  64. package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-DsjsL1dr.mjs} +115 -175
  65. package/dist/.setup/{provider-BOsxQHOM.mjs → provider-DH8NSzGt.mjs} +11 -14
  66. package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-CAxoF-X1.mjs} +13 -18
  67. package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
  68. package/dist/.setup/{request-D2L0zMrq.mjs → request-BHZ1nz8d.mjs} +7 -6
  69. package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
  70. package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
  71. package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-D8RZUOzY.mjs} +1035 -1023
  72. package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
  73. package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
  74. package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
  75. package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
  76. package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
  77. package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
  78. package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
  79. package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
  80. package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-4sCdv5qx.mjs} +170 -324
  81. package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
  82. package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
  83. package/dist/.setup/session-catalog-events-DePDzzjc.mjs +139 -0
  84. package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
  85. package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-CZvDzC6z.mjs} +126 -122
  86. package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
  87. package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
  88. package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
  89. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
  90. package/dist/.setup/session-catalog-native-projection-DjhwGL6x.mjs +178 -0
  91. package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
  92. package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
  93. package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
  94. package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
  95. package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-Cr5qP5Dj.mjs} +6 -4
  96. package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
  97. package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-Cn_nCqfq.mjs} +9 -22
  98. package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
  99. package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
  100. package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
  101. package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
  102. package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
  103. package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
  104. package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-qMTxkNx2.mjs} +17 -17
  105. package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
  106. package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-BsvEabkw.mjs} +14 -10
  107. package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-DqyTMYug.mjs} +783 -412
  108. package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
  109. package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-C4kCmQy1.mjs} +79 -143
  110. package/dist/.setup/{source-CUzJq5WN.mjs → source-CS_7GFJZ.mjs} +80 -137
  111. package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-DPflntEJ.mjs} +294 -737
  112. package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
  113. package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-roNP0l1c.mjs} +45 -10
  114. package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-DTd-DtkX.mjs} +46 -7
  115. package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-B_bRnMGN.mjs} +199 -302
  116. package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-CdDaoc7T.mjs} +6 -6
  117. package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
  118. package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
  119. package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
  120. package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
  121. package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
  122. package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
  123. package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
  124. package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-CBeVjBpT.mjs} +23 -23
  125. package/dist/.setup/{usage-BML0r-ua.mjs → usage-BMzNxeR_.mjs} +4 -4
  126. package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-QXerDo3i.mjs} +4 -19
  127. package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-P77OUeoo.mjs} +8 -19
  128. package/dist/api.js +9 -11
  129. package/dist/catalog-page.worker.js +1 -1
  130. package/dist/cli-metadata.js +1 -1
  131. package/dist/doctor-contract-api.js +50 -8
  132. package/dist/harness.js +344 -1
  133. package/dist/index.js +193 -245
  134. package/dist/media-understanding-provider.js +9 -22
  135. package/dist/migration-provider-api.js +1 -1
  136. package/dist/provider-discovery.js +1 -1
  137. package/dist/session-history-worker-runtime.js +3 -3
  138. package/dist/session-history.worker.js +1 -1
  139. package/openclaw.plugin.json +14 -2
  140. package/package.json +7 -6
  141. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
  142. package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
  143. package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
  144. package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
  145. package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
  146. package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
  147. package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
  148. package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
  149. package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
  150. package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
  151. package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
  152. package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
  153. package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
  154. package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
  155. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
  156. package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
  157. package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
  158. package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
@@ -1,441 +0,0 @@
1
- import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
- import { T as readNonEmptyStringArray, c as itemName, h as unknownItemStatus, l as itemStatus, m as shouldSynthesizeToolProgressForItem, t as auditNativeToolName, v as normalizeOptionalString$1, w as readNonEmptyString } from "./event-projector-items-C6L_5ZiT.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, projectAgentToolActivity, sanitizeToolArgs } from "openclaw/plugin-sdk/agent-harness-runtime";
6
- //#region extensions/codex/src/app-server/event-projector-tool-output.ts
7
- const TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS = 1e4;
8
- const TOOL_PROGRESS_ECHO_PREFIX_MIN_CHARS = 1024;
9
- const TOOL_OUTPUT_TRUNCATION_NOTICE_PREFIX = "...(OpenClaw truncated Codex native tool output";
10
- var ToolOutputAccumulator = class {
11
- constructor() {
12
- this.prefixByItem = /* @__PURE__ */ new Map();
13
- this.originalLengthByItem = /* @__PURE__ */ new Map();
14
- this.trimStateByItem = /* @__PURE__ */ new Map();
15
- this.truncatedItemIds = /* @__PURE__ */ new Set();
16
- this.textByItem = /* @__PURE__ */ new Map();
17
- }
18
- isTruncated(itemId) {
19
- return this.truncatedItemIds.has(itemId);
20
- }
21
- append(itemId, delta) {
22
- const originalLength = (this.originalLengthByItem.get(itemId) ?? this.textByItem.get(itemId)?.length ?? 0) + delta.length;
23
- this.originalLengthByItem.set(itemId, originalLength);
24
- const normalizedLength = updateToolOutputTrimState(this.trimStateByItem, itemId, delta);
25
- const next = appendBoundedToolTranscriptText(this.prefixByItem.get(itemId) ?? this.textByItem.get(itemId) ?? "", this.truncatedItemIds.has(itemId) ? "" : delta, originalLength);
26
- this.prefixByItem.set(itemId, next.rawPrefix);
27
- this.textByItem.set(itemId, next.text);
28
- if (originalLength > 1e4) this.truncatedItemIds.add(itemId);
29
- return {
30
- text: next.text,
31
- originalLength,
32
- normalizedLength,
33
- rawPrefix: next.rawPrefix
34
- };
35
- }
36
- };
37
- function updateToolOutputTrimState(trimStateByItem, itemId, delta) {
38
- const state = trimStateByItem.get(itemId) ?? {
39
- totalLength: 0,
40
- leadingWhitespaceLength: 0,
41
- trailingWhitespaceLength: 0,
42
- sawNonWhitespace: false
43
- };
44
- state.totalLength += delta.length;
45
- const firstNonWhitespace = delta.search(/\S/u);
46
- if (firstNonWhitespace === -1) {
47
- if (!state.sawNonWhitespace) state.leadingWhitespaceLength += delta.length;
48
- state.trailingWhitespaceLength += delta.length;
49
- trimStateByItem.set(itemId, state);
50
- return state.sawNonWhitespace ? state.totalLength - state.leadingWhitespaceLength - state.trailingWhitespaceLength : 0;
51
- }
52
- if (!state.sawNonWhitespace) {
53
- state.leadingWhitespaceLength += firstNonWhitespace;
54
- state.sawNonWhitespace = true;
55
- }
56
- state.trailingWhitespaceLength = delta.match(/\s*$/u)?.[0].length ?? 0;
57
- trimStateByItem.set(itemId, state);
58
- return state.totalLength - state.leadingWhitespaceLength - state.trailingWhitespaceLength;
59
- }
60
- function toolOutputRawEchoSignature(text) {
61
- const trimmed = text.trim();
62
- if (!trimmed) return;
63
- return {
64
- rawLength: trimmed.length,
65
- rawPrefix: trimmed.slice(0, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS)
66
- };
67
- }
68
- function normalizeToolTranscriptArguments(value) {
69
- return asNonArrayRecord(value);
70
- }
71
- function collectDynamicToolContentText(contentItems) {
72
- if (!Array.isArray(contentItems)) return "";
73
- return contentItems.flatMap((entry) => {
74
- if (!isJsonObject(entry)) return [];
75
- const text = readStringField(entry, "text");
76
- return text ? [text] : [];
77
- }).join("\n");
78
- }
79
- function readCodexResponseOutput(item) {
80
- if (typeof item.output === "string") return item.output;
81
- if (!Array.isArray(item.output)) return;
82
- return JSON.stringify(item.output.map((part) => isJsonObject(part) && part.type === "input_text" && typeof part.text === "string" ? {
83
- type: part.type,
84
- text: part.text
85
- } : {
86
- type: isJsonObject(part) ? part.type : "unknown",
87
- omitted: true
88
- }), null, 2);
89
- }
90
- function appendBoundedToolTranscriptText(currentPrefix, delta, originalLength) {
91
- if (originalLength <= 1e4) {
92
- const rawPrefix = currentPrefix + delta;
93
- return {
94
- text: rawPrefix,
95
- rawPrefix
96
- };
97
- }
98
- const notice = toolTranscriptTruncationNotice(originalLength);
99
- if (notice.length >= 1e4) return {
100
- text: notice.slice(0, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS),
101
- rawPrefix: ""
102
- };
103
- const textBudget = TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS - notice.length;
104
- const remaining = Math.max(0, textBudget - currentPrefix.length);
105
- const prefix = remaining > 0 ? `${currentPrefix}${truncateUtf16Safe(delta, remaining)}` : currentPrefix;
106
- const rawPrefix = truncateUtf16Safe(prefix, textBudget);
107
- return {
108
- text: `${rawPrefix}${notice}`,
109
- rawPrefix
110
- };
111
- }
112
- function toolTranscriptTruncationNotice(originalLength) {
113
- return `\n${`${TOOL_OUTPUT_TRUNCATION_NOTICE_PREFIX}: original ${originalLength} chars, showing ${TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS}; rerun with narrower args.)`}`;
114
- }
115
- function truncateToolTranscriptText(text, originalLength = text.length) {
116
- if (originalLength <= 1e4 && text.length <= 1e4) return text;
117
- const notice = toolTranscriptTruncationNotice(originalLength);
118
- if (notice.length >= 1e4) return notice.slice(1, 10001);
119
- const textBudget = TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS - notice.length;
120
- return `${truncateUtf16Safe(text, textBudget)}${notice}`;
121
- }
122
- function formatToolSummary(toolName, meta) {
123
- const trimmedMeta = meta?.trim();
124
- return formatToolAggregate(toolName, trimmedMeta ? [trimmedMeta] : void 0, { markdown: true });
125
- }
126
- function formatToolOutput(toolName, meta, output) {
127
- const formattedOutput = formatToolProgressOutput(output);
128
- if (!formattedOutput) return formatToolSummary(toolName, meta);
129
- const fence = markdownFenceForText(formattedOutput);
130
- return `${formatToolSummary(toolName, meta)}\n${fence}txt\n${formattedOutput}\n${fence}`;
131
- }
132
- function markdownFenceForText(text) {
133
- return "`".repeat(Math.max(3, longestBacktickRun(text) + 1));
134
- }
135
- function longestBacktickRun(value) {
136
- let longest = 0;
137
- let current = 0;
138
- for (const char of value) {
139
- if (char === "`") {
140
- current += 1;
141
- longest = Math.max(longest, current);
142
- continue;
143
- }
144
- current = 0;
145
- }
146
- return longest;
147
- }
148
- //#endregion
149
- //#region extensions/codex/src/app-server/tool-progress-normalization.ts
150
- /**
151
- * Normalizes and sanitizes Codex dynamic-tool progress payloads before they are
152
- * emitted into OpenClaw events or logs.
153
- */
154
- /** Maps OpenClaw tool-progress config to the mode used by Codex progress metadata. */
155
- function resolveCodexToolProgressDetailMode(value) {
156
- return value === "raw" ? "raw" : "explain";
157
- }
158
- function isCodexCommandBearingToolCall(name, args) {
159
- const normalizedName = name?.trim().toLowerCase();
160
- return normalizedName === "exec" || normalizedName === "bash" || normalizedName === "shell" || typeof args?.command === "string" && args.command.trim().length > 0;
161
- }
162
- /** Sanitizes a record-shaped Codex agent event payload. */
163
- function sanitizeCodexAgentEventRecord(value) {
164
- return sanitizeToolArgs(value);
165
- }
166
- /** Sanitizes dynamic-tool arguments before diagnostic/event emission. */
167
- function sanitizeCodexToolArguments(value) {
168
- if (!isJsonObject(value)) return;
169
- return sanitizeCodexAgentEventRecord(value);
170
- }
171
- /** Sanitizes a Codex dynamic-tool response before diagnostic/event emission. */
172
- function sanitizeCodexToolResponse(response) {
173
- return sanitizeCodexAgentEventRecord({ ...response });
174
- }
175
- /** Infers compact human-readable tool metadata from Codex dynamic-tool arguments. */
176
- function inferCodexDynamicToolMeta(call, detailMode) {
177
- return inferToolMetaFromArgs(call.tool, call.arguments, { detailMode });
178
- }
179
- //#endregion
180
- //#region extensions/codex/src/app-server/event-projector-tool-items.ts
181
- const CODE_MODE_NATIVE_PATCH_SOURCE_RE = /^\s*(?:\/\/[^\r\n]*\r?\n\s*)?(?:const|let)\s+([A-Za-z_$][\w$]*)\s*=\s*await\s+tools\.apply_patch\(\s*("(?:\\[\s\S]|[^"\\])*")\s*\)\s*;?\s*text\(\s*\1\s*\)\s*;?\s*$/u;
182
- function readCodeModeNativePatchInput(source) {
183
- if (typeof source !== "string") return;
184
- const match = CODE_MODE_NATIVE_PATCH_SOURCE_RE.exec(source);
185
- if (!match?.[2]) return;
186
- try {
187
- const patch = JSON.parse(match[2]);
188
- return typeof patch === "string" && /^\*\*\* Begin Patch\r?\n[\s\S]*\r?\n\*\*\* End Patch(?:\r?\n)?$/u.test(patch) ? patch : void 0;
189
- } catch {
190
- return;
191
- }
192
- }
193
- function readInterceptedNativePatchInput(command) {
194
- if (typeof command !== "string") return;
195
- const lines = command.replace(/\r\n?/gu, "\n").split("\n");
196
- const patchStart = lines.indexOf("*** Begin Patch");
197
- const invocation = /^[\t ]*(?:cd[\t ]+(?:'([^'\n]+)'|([A-Za-z0-9_./-]+))[\t ]+&&[\t ]+)?apply_patch[\t ]*<<-?[\t ]*'([^'\n]+)'[\t ]*$/u.exec(lines[0] ?? "");
198
- if (!invocation || patchStart !== 1) return;
199
- const patchEnd = lines.indexOf("*** End Patch", patchStart + 1);
200
- const cwd = invocation[1] ?? invocation[2];
201
- const delimiter = invocation[3];
202
- if (patchEnd < 0 || lines[patchEnd + 1] !== delimiter || lines.slice(patchEnd + 2).some((line) => line.trim().length > 0)) return;
203
- return {
204
- input: `${lines.slice(patchStart, patchEnd + 1).join("\n")}\n`,
205
- ...cwd ? { cwd } : {}
206
- };
207
- }
208
- function projectCodexToolActivity(item, phase, meta) {
209
- const name = itemName(item) ?? auditNativeToolName(item);
210
- return name ? projectAgentToolActivity({
211
- toolCallId: item.id,
212
- name,
213
- phase,
214
- args: item.type === "dynamicToolCall" ? void 0 : itemToolArgs(item),
215
- meta,
216
- status: item.type === "collabAgentToolCall" && item.status === "interrupted" ? "failed" : unknownItemStatus(item) ? "unknown" : itemStatus(item),
217
- result: { details: itemToolResult(item).result },
218
- ...item.type === "collabAgentToolCall" && item.tool === "wait" ? { nativeOperation: "wait" } : {}
219
- }) : void 0;
220
- }
221
- function isNativePostToolUseRelayItem(item) {
222
- switch (item.type) {
223
- case "commandExecution":
224
- case "fileChange":
225
- case "mcpToolCall": return true;
226
- default: return false;
227
- }
228
- }
229
- function shouldSuppressChannelProgressForItem(item) {
230
- if (shouldSynthesizeToolProgressForItem(item)) return true;
231
- return item.type === "dynamicToolCall";
232
- }
233
- function itemToolArgs(item) {
234
- if (item.type === "commandExecution") return sanitizeCodexAgentEventRecord({
235
- command: item.command,
236
- ...typeof item.cwd === "string" ? { cwd: item.cwd } : {}
237
- });
238
- if (item.type === "fileChange") return sanitizeCodexAgentEventRecord({ changes: itemFileChangesForTranscript(item) });
239
- if (item.type === "webSearch") return webSearchToolArgs(item);
240
- if (item.type === "dynamicToolCall" || item.type === "mcpToolCall") return sanitizeCodexToolArguments(item.arguments);
241
- }
242
- function isCommandBearingToolItem(item, args) {
243
- if (item.type === "commandExecution") return true;
244
- return typeof args?.command === "string" && args.command.trim().length > 0;
245
- }
246
- function webSearchToolArgs(item) {
247
- const action = isJsonObject(item.action) ? item.action : void 0;
248
- const actionType = action ? readNonEmptyString(action, "type") : void 0;
249
- const queries = action && actionType === "search" ? readNonEmptyStringArray(action, "queries") : [];
250
- const query = normalizeOptionalString$1(item.query) ?? (action && actionType === "search" ? readNonEmptyString(action, "query") : void 0) ?? queries[0];
251
- const url = action ? readNonEmptyString(action, "url") : void 0;
252
- const pattern = action ? readNonEmptyString(action, "pattern") : void 0;
253
- const args = {};
254
- if (query) args.query = query;
255
- if (queries.length > 0) args.queries = queries;
256
- if (actionType && actionType !== "search") args.action = actionType;
257
- if (url) args.url = url;
258
- if (pattern) args.pattern = pattern;
259
- if (!query && !url && !pattern) args.queryUnavailable = true;
260
- return sanitizeCodexAgentEventRecord(args);
261
- }
262
- function itemToolResult(item) {
263
- if (item.type === "commandExecution") return { result: sanitizeCodexAgentEventRecord({
264
- status: item.status,
265
- exitCode: item.exitCode,
266
- durationMs: item.durationMs
267
- }) };
268
- if (item.type === "fileChange") return { result: sanitizeCodexAgentEventRecord({
269
- status: item.status,
270
- changes: itemFileChanges(item)
271
- }) };
272
- if (item.type === "mcpToolCall") return { result: sanitizeCodexAgentEventRecord({
273
- status: item.status,
274
- durationMs: item.durationMs,
275
- ...item.error ? { error: item.error } : {},
276
- ...item.result ? { result: item.result } : {}
277
- }) };
278
- if (item.type === "webSearch") return { result: webSearchToolResult(item) };
279
- return {};
280
- }
281
- function webSearchToolResult(item) {
282
- return sanitizeCodexAgentEventRecord({
283
- status: itemStatus(item),
284
- ...typeof item.durationMs === "number" ? { durationMs: item.durationMs } : {},
285
- ...webSearchToolArgs(item)
286
- });
287
- }
288
- function itemFileChangeRecords(item) {
289
- const changes = item.changes;
290
- return Array.isArray(changes) ? changes.filter(isJsonObject) : [];
291
- }
292
- function itemFileChanges(item) {
293
- return itemFileChangeRecords(item).flatMap((change) => {
294
- const path = normalizeOptionalString$1(change.path);
295
- if (!path || change.kind === void 0) return [];
296
- return [{
297
- path,
298
- kind: change.kind
299
- }];
300
- });
301
- }
302
- function fileChangeKindType(kind) {
303
- if (typeof kind === "string") return kind;
304
- return isJsonObject(kind) ? normalizeOptionalString$1(kind.type) : void 0;
305
- }
306
- function countFileContentLines(content) {
307
- if (!content) return 0;
308
- const lines = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
309
- if (lines.length > 1 && lines.at(-1) === "") lines.pop();
310
- return lines.length;
311
- }
312
- function fileChangeDiffStat(diff, kind) {
313
- const kindType = fileChangeKindType(kind);
314
- if (kindType === "add") return {
315
- added: countFileContentLines(diff),
316
- removed: 0
317
- };
318
- if (kindType === "delete") return {
319
- added: 0,
320
- removed: countFileContentLines(diff)
321
- };
322
- let added = 0;
323
- let removed = 0;
324
- let inHunk = false;
325
- for (const line of diff.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n")) {
326
- if (line.startsWith("@@")) {
327
- inHunk = true;
328
- continue;
329
- }
330
- if (!inHunk) continue;
331
- if (line.startsWith("+")) added += 1;
332
- else if (line.startsWith("-")) removed += 1;
333
- }
334
- return {
335
- added,
336
- removed
337
- };
338
- }
339
- function truncateFileChangeDiffAtLineBoundary(diff, maxChars) {
340
- if (diff.length <= maxChars) return { diff };
341
- if (maxChars <= 0) return { diffTruncated: true };
342
- const boundary = diff.lastIndexOf("\n", maxChars - 1);
343
- return boundary >= 0 ? {
344
- diff: diff.slice(0, boundary + 1),
345
- diffTruncated: true
346
- } : { diffTruncated: true };
347
- }
348
- function itemFileChangesForTranscript(item) {
349
- let remainingDiffChars = 1e4;
350
- return itemFileChangeRecords(item).flatMap((change) => {
351
- const path = normalizeOptionalString$1(change.path);
352
- if (!path || change.kind === void 0) return [];
353
- const result = {
354
- path,
355
- kind: change.kind
356
- };
357
- if (typeof change.diff !== "string") return [result];
358
- result.stat = fileChangeDiffStat(change.diff, change.kind);
359
- const bounded = truncateFileChangeDiffAtLineBoundary(change.diff, remainingDiffChars);
360
- if (bounded.diff !== void 0) {
361
- result.diff = bounded.diff;
362
- remainingDiffChars -= bounded.diff.length;
363
- }
364
- if (bounded.diffTruncated) result.diffTruncated = true;
365
- return [result];
366
- });
367
- }
368
- function itemToolError(item, status, outputTextByItem) {
369
- if (status === "blocked") return "codex native tool blocked";
370
- if (status !== "failed") return;
371
- return itemOutputText(item, outputTextByItem) ?? "codex native tool failed";
372
- }
373
- function itemMeta(item, detailMode = "explain") {
374
- if (item.type === "commandExecution" && typeof item.command === "string") return inferToolMetaFromArgs("exec", {
375
- command: item.command,
376
- cwd: typeof item.cwd === "string" ? item.cwd : void 0
377
- }, { detailMode });
378
- if (item.type === "webSearch") return inferToolMetaFromArgs("web_search", webSearchToolArgs(item), { detailMode });
379
- const toolName = itemName(item);
380
- if ((item.type === "dynamicToolCall" || item.type === "mcpToolCall") && toolName) return inferToolMetaFromArgs(toolName, item.arguments, { detailMode });
381
- }
382
- function itemOutputText(item, outputTextByItem) {
383
- const output = itemObservedOutputText(item, outputTextByItem)?.trim();
384
- return output ? truncateToolTranscriptText(output) : void 0;
385
- }
386
- function itemObservedOutputText(item, outputTextByItem) {
387
- if (item.type === "commandExecution") return item.aggregatedOutput ?? outputTextByItem?.get(item.id);
388
- if (item.type === "dynamicToolCall") return collectDynamicToolContentText(item.contentItems);
389
- if (item.type === "mcpToolCall") return item.error ? stringifyJsonValue(item.error) : item.result ? stringifyJsonValue(item.result) : void 0;
390
- }
391
- function itemTranscriptResultText(item, outputTextByItem) {
392
- const output = itemObservedOutputText(item, outputTextByItem);
393
- if (output !== void 0) return output;
394
- const result = itemToolResult(item).result;
395
- return (result ? stringifyJsonValue(result) : void 0) ?? itemStatus(item);
396
- }
397
- function stringifyJsonValue(value) {
398
- try {
399
- return JSON.stringify(value, null, 2);
400
- } catch {
401
- return;
402
- }
403
- }
404
- //#endregion
405
- //#region extensions/codex/src/app-server/native-subagent-task-ids.ts
406
- /** Task runtime namespace for Codex native subagent task rows. */
407
- const CODEX_NATIVE_SUBAGENT_RUNTIME = "subagent";
408
- /** Task kind used to distinguish native Codex subagents from other subagent runtimes. */
409
- const CODEX_NATIVE_SUBAGENT_TASK_KIND = "codex-native";
410
- /** Run id prefix for task rows keyed by Codex child thread ids. */
411
- const CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX = "codex-thread:";
412
- /** Initial tasks keep their shipped locator; later assignments belong to a native turn. */
413
- function codexNativeSubagentRunId(threadId, turnId) {
414
- return `${CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX}${threadId.trim()}${turnId ? `:turn:${turnId}` : ""}`;
415
- }
416
- function readCodexNativeSubagentRunId(runId) {
417
- if (!runId?.startsWith("codex-thread:")) return;
418
- const [threadId, turnId] = runId.slice(13).split(":turn:");
419
- return threadId?.trim() ? {
420
- threadId,
421
- ...turnId ? { turnId } : {}
422
- } : void 0;
423
- }
424
- function readNativeTaskAssignment(task) {
425
- const runId = task.runId;
426
- const identity = readCodexNativeSubagentRunId(runId);
427
- if (!runId || !identity) return;
428
- const storedTurnId = isJsonObject(task.detail) ? normalizeOptionalString(readStringField(task.detail, "nativeTurnId")) : void 0;
429
- return {
430
- runId,
431
- childThreadId: identity.threadId,
432
- nativeTurnId: storedTurnId ?? identity.turnId,
433
- initialTurnId: identity.turnId
434
- };
435
- }
436
- function readNativeSubagentThreadIds(value) {
437
- if (!Array.isArray(value)) return [];
438
- return value.filter((entry) => typeof entry === "string" && entry.trim() !== "");
439
- }
440
- //#endregion
441
- export { formatToolSummary as A, sanitizeCodexToolArguments as C, ToolOutputAccumulator as D, TOOL_TRANSCRIPT_OUTPUT_MAX_CHARS as E, readCodexResponseOutput as M, toolOutputRawEchoSignature as N, collectDynamicToolContentText as O, truncateToolTranscriptText as P, resolveCodexToolProgressDetailMode as S, TOOL_PROGRESS_ECHO_PREFIX_MIN_CHARS as T, readCodeModeNativePatchInput as _, readCodexNativeSubagentRunId as a, inferCodexDynamicToolMeta as b, isCommandBearingToolItem as c, itemOutputText as d, itemToolArgs as f, projectCodexToolActivity as g, itemTranscriptResultText as h, codexNativeSubagentRunId as i, normalizeToolTranscriptArguments as j, formatToolOutput 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, readInterceptedNativePatchInput as v, sanitizeCodexToolResponse as w, isCodexCommandBearingToolCall as x, shouldSuppressChannelProgressForItem as y };
@@ -1,122 +0,0 @@
1
- import { it as resolveCodexGatewayTimeoutWithGraceMs } from "./shared-client-DA4VR4Eb.mjs";
2
- import { isApprovalNotFoundError, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
3
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
4
- //#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
5
- const DEFAULT_CODEX_APPROVAL_TIMEOUT_MS = 12e4;
6
- const MAX_PLUGIN_APPROVAL_TITLE_LENGTH = 80;
7
- const MAX_PLUGIN_APPROVAL_DESCRIPTION_LENGTH = 512;
8
- const ANSI_OSC_SEQUENCE_RE = new RegExp(String.raw`(?:\u001b]|\u009d)[^\u001b\u009c\u0007]*(?:\u0007|\u001b\\|\u009c)`, "g");
9
- const ANSI_CONTROL_SEQUENCE_RE = new RegExp(String.raw`(?:\u001b\[[0-?]*[ -/]*[@-~]|\u009b[0-?]*[ -/]*[@-~]|\u001b[@-Z\\-_])`, "g");
10
- const CONTROL_CHARACTER_RE = new RegExp(String.raw`[\u0000-\u001f\u007f-\u009f]+`, "g");
11
- const INVISIBLE_FORMATTING_CONTROL_RE = new RegExp(String.raw`[\u00ad\u034f\u061c\u200b-\u200f\u202a-\u202e\u2060-\u206f\ufeff\ufe00-\ufe0f\u{e0100}-\u{e01ef}]`, "gu");
12
- const DANGLING_TERMINAL_SEQUENCE_SUFFIX_RE = new RegExp(String.raw`(?:\u001b\][^\u001b\u009c\u0007]*|\u009d[^\u001b\u009c\u0007]*|\u001b\[[0-?]*[ -/]*|\u009b[0-?]*[ -/]*|\u001b)$`);
13
- const CODEX_APPROVAL_TIMEOUT_SUBJECTS = {
14
- command: "Command approval",
15
- "file-change": "File change approval",
16
- permissions: "Permission approval",
17
- other: "Approval"
18
- };
19
- function codexApprovalTimeoutText(kind) {
20
- return `${CODEX_APPROVAL_TIMEOUT_SUBJECTS[kind]} timed out before an operator responded.`;
21
- }
22
- /** Starts a two-phase plugin approval request through the OpenClaw gateway. */
23
- async function requestPluginApproval(params) {
24
- const timeoutMs = DEFAULT_CODEX_APPROVAL_TIMEOUT_MS;
25
- return params.hostCapabilities.requestApproval({
26
- signal: params.signal,
27
- title: truncateCodexApprovalDisplayText(params.title, MAX_PLUGIN_APPROVAL_TITLE_LENGTH),
28
- description: truncateCodexApprovalDisplayText(params.description, MAX_PLUGIN_APPROVAL_DESCRIPTION_LENGTH),
29
- severity: params.severity,
30
- toolName: params.toolName,
31
- toolCallId: params.toolCallId,
32
- ...params.mcpTool ? {
33
- mcpTool: params.mcpTool,
34
- isMcpToolApprovalActive: params.isMcpToolApprovalActive
35
- } : {},
36
- timeoutMs,
37
- transportTimeoutMs: resolveCodexGatewayTimeoutWithGraceMs(timeoutMs),
38
- ...params.allowedDecisions ? { allowedDecisions: params.allowedDecisions } : {}
39
- });
40
- }
41
- /** Detects the gateway's explicit null-decision marker for unavailable approvals. */
42
- function approvalRequestExplicitlyUnavailable(result) {
43
- if (result === null || result === void 0 || typeof result !== "object") return false;
44
- let descriptor;
45
- try {
46
- descriptor = Object.getOwnPropertyDescriptor(result, "decision");
47
- } catch {
48
- return false;
49
- }
50
- return descriptor !== void 0 && "value" in descriptor && descriptor.value === null;
51
- }
52
- /** Waits for the gateway's final approval decision, respecting turn aborts. */
53
- async function waitForPluginApprovalDecision(params) {
54
- const timeoutMs = DEFAULT_CODEX_APPROVAL_TIMEOUT_MS;
55
- const waitPromise = params.hostCapabilities.waitForApproval({
56
- approvalId: params.approvalId,
57
- timeoutMs,
58
- transportTimeoutMs: resolveCodexGatewayTimeoutWithGraceMs(timeoutMs),
59
- signal: params.signal
60
- }).catch((error) => {
61
- if (isApprovalNotFoundError(error)) return;
62
- throw error;
63
- });
64
- if (!params.signal) return await waitPromise;
65
- let onAbort;
66
- const abortPromise = new Promise((_, reject) => {
67
- if (params.signal.aborted) {
68
- reject(toErrorObject(params.signal.reason, "Non-Error rejection"));
69
- return;
70
- }
71
- onAbort = () => reject(toErrorObject(params.signal.reason, "Non-Error rejection"));
72
- params.signal.addEventListener("abort", onAbort, { once: true });
73
- });
74
- try {
75
- return await Promise.race([waitPromise, abortPromise]);
76
- } finally {
77
- if (onAbort) params.signal.removeEventListener("abort", onAbort);
78
- }
79
- }
80
- /** Converts a gateway exec approval decision into the app-server approval outcome enum. */
81
- function mapExecDecisionToOutcome(decision) {
82
- switch (decision) {
83
- case "allow-once": return "approved-once";
84
- case "allow-always": return "approved-session";
85
- case "deny": return "denied";
86
- default: return "unavailable";
87
- }
88
- }
89
- /** Runs one complete host approval request and maps transport failures to a closed outcome. */
90
- async function requestPluginApprovalOutcome(params) {
91
- try {
92
- const requestResult = await requestPluginApproval({
93
- ...params,
94
- severity: "warning"
95
- });
96
- const approvalId = requestResult?.id;
97
- if (!approvalId) return "unavailable";
98
- const approvalResult = approvalRequestExplicitlyUnavailable(requestResult) ? void 0 : await waitForPluginApprovalDecision({
99
- hostCapabilities: params.hostCapabilities,
100
- approvalId,
101
- signal: params.signal
102
- });
103
- if (params.signal?.aborted) return "cancelled";
104
- if (approvalResult?.terminalReason === "timeout") return "timed-out";
105
- const decision = approvalResult?.decision;
106
- return mapExecDecisionToOutcome(decision === "allow-always" && params.allowedDecisions?.includes("allow-always") === false ? "allow-once" : decision);
107
- } catch {
108
- return params.signal?.aborted ? "cancelled" : "denied";
109
- }
110
- }
111
- function truncateCodexApprovalDisplayText(value, maxLength) {
112
- return value.length <= maxLength ? value : `${truncateUtf16Safe(value, maxLength - 3)}...`;
113
- }
114
- function stripDanglingCodexApprovalTerminalSequence(value) {
115
- return value.replace(DANGLING_TERMINAL_SEQUENCE_SUFFIX_RE, "");
116
- }
117
- function sanitizeCodexApprovalVisibleText(value, options = {}) {
118
- const terminalSafe = value.replace(ANSI_OSC_SEQUENCE_RE, "").replace(ANSI_CONTROL_SEQUENCE_RE, "");
119
- return (options.stripDanglingTerminalSequence ? stripDanglingCodexApprovalTerminalSequence(terminalSafe) : terminalSafe).replace(INVISIBLE_FORMATTING_CONTROL_RE, " ").replace(CONTROL_CHARACTER_RE, " ").replace(/\s+/g, " ").trim();
120
- }
121
- //#endregion
122
- export { requestPluginApprovalOutcome as a, truncateCodexApprovalDisplayText as c, requestPluginApproval as i, waitForPluginApprovalDecision as l, codexApprovalTimeoutText as n, sanitizeCodexApprovalVisibleText as o, mapExecDecisionToOutcome as r, stripDanglingCodexApprovalTerminalSequence as s, approvalRequestExplicitlyUnavailable as t };
@@ -1,14 +0,0 @@
1
- import "node:module";
2
- //#region \0rolldown/runtime.js
3
- var __defProp = Object.defineProperty;
4
- var __exportAll = (all, no_symbols) => {
5
- let target = {};
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: true
9
- });
10
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
11
- return target;
12
- };
13
- //#endregion
14
- export { __exportAll as t };