@openclaw/codex 2026.9.5 → 2026.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-Eem_WGqY.mjs} +5 -5
  2. package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-DDOi8uNx.mjs} +22 -28
  3. package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-CEv1cKwF.mjs} +58 -43
  4. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
  5. package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-B2mpaI9D.mjs} +9 -81
  6. package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
  7. package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
  8. package/dist/.setup/{binding-connection-Bm38niE8.mjs → binding-connection-ThoatDcb.mjs} +1 -1
  9. package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-yoHrABt-.mjs} +4 -4
  10. package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-B2HScEgT.mjs} +138 -32
  11. package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-C7EnDVgr.mjs} +1 -1
  12. package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-CDXOOFdZ.mjs} +1 -1
  13. package/dist/.setup/{client-vXs2929Q.mjs → client-Cs08OXVQ.mjs} +583 -559
  14. package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
  15. package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-B4JuOsOk.mjs} +8 -4
  16. package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-Bmqvr9tO.mjs} +8 -4
  17. package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-DW7Lx9oH.mjs} +106 -172
  18. package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-DixIj3HW.mjs} +36 -21
  19. package/dist/.setup/{compact-C3i3qlzj.mjs → compact-Du5UvtxA.mjs} +14 -21
  20. package/dist/.setup/{config-CedDWjM-.mjs → config-BoTP_mrL.mjs} +3 -3
  21. package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-BvaRs51b.mjs} +46 -30
  22. package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C8Rw1m1m.mjs} +1 -1
  23. package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-BEReZ6go.mjs} +35 -120
  24. package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-DP-gMrBP.mjs} +21 -32
  25. package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-uK9Jomlc.mjs} +28 -67
  26. package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-BDXl-8Cw.mjs} +848 -578
  27. package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
  28. package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-poidXgek.mjs} +9 -6
  29. package/dist/.setup/{event-projector-assistant-message-DNUR1s0A.mjs → event-projector-assistant-message-BsruvNrH.mjs} +2 -4
  30. package/dist/.setup/{event-projector-items-DyTQ_XqL.mjs → event-projector-items-C6L_5ZiT.mjs} +42 -8
  31. package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-CnBS8Wa3.mjs} +1 -1
  32. package/dist/.setup/{harness-rxaaoN-o.mjs → harness-a_MsE4-_.mjs} +23 -17
  33. package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D96l9-ew.mjs} +1 -1
  34. package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
  35. package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-BIZFhTNG.mjs} +17 -10
  36. package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
  37. package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-BnshlFag.mjs} +13 -2
  38. package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-CfXJf9Ay.mjs} +9 -10
  39. package/dist/.setup/{models-BDFgm_G-.mjs → models-KnqBv0hE.mjs} +3 -3
  40. package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-rWbGbMn3.mjs} +4 -4
  41. package/dist/.setup/{native-subagent-history-YXaL6dMd.mjs → native-subagent-history-0nYYgo0k.mjs} +26 -13
  42. package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-D3filLY2.mjs} +145 -317
  43. package/dist/.setup/{native-subagent-task-ids-DsuOonKv.mjs → native-subagent-task-ids-wb8CKZGN.mjs} +69 -39
  44. package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-r3avj02l.mjs} +86 -68
  45. package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
  46. package/dist/.setup/{plan-xD7WKYTM.mjs → plan-CN3VwfNU.mjs} +74 -76
  47. package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-DT3MNtqj.mjs} +7 -16
  48. package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-B2CsSdnV.mjs} +4 -20
  49. package/dist/.setup/{plugin-approval-roundtrip-CjfzafAZ.mjs → plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
  50. package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-BoRei8Z4.mjs} +16 -7
  51. package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
  52. package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-Ctmo83k_.mjs} +224 -154
  53. package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
  54. package/dist/.setup/{provider-fFh_-VR3.mjs → provider-BOsxQHOM.mjs} +9 -5
  55. package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-BfE88FZ5.mjs} +31 -3
  56. package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-CMU3DUD0.mjs} +116 -137
  57. package/dist/.setup/{request-BioXJLYa.mjs → request-D2L0zMrq.mjs} +23 -15
  58. package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-BHu11r7h.mjs} +1197 -617
  59. package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-CLZ8udh-.mjs} +29 -45
  60. package/dist/.setup/{sandbox-guard-BBP-RbTf.mjs → sandbox-guard-C2sRMOEY.mjs} +1 -1
  61. package/dist/.setup/{session-binding-_0W_fHRr.mjs → session-binding-Cm0apEbd.mjs} +3 -32
  62. package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-BGoz8wOK.mjs} +22 -3
  63. package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-BlB5EvIS.mjs} +48 -45
  64. package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-Pno1xGcl.mjs} +482 -182
  65. package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BI6UTDZT.mjs} +57 -25
  66. package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-lHBqzhaO.mjs} +6 -6
  67. package/dist/.setup/{session-catalog-events-jMcYfQyd.mjs → session-catalog-events-Bj6j94E_.mjs} +122 -25
  68. package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-B9_VQIUz.mjs} +178 -78
  69. package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-hcdz07yN.mjs} +2 -2
  70. package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-Dgh8ORJm.mjs} +5 -2
  71. package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-native-projection-DowriLid.mjs} +30 -13
  72. package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-ITddWx_X.mjs} +24 -12
  73. package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-6g6qi4A9.mjs} +22 -13
  74. package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-zK_PUsiE.mjs} +13 -5
  75. package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-irrD-uo7.mjs} +4 -4
  76. package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-BrqhSCf9.mjs} +17 -22
  77. package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-D-3wAgOP.mjs} +4 -4
  78. package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-CaCh0xF_.mjs} +5 -18
  79. package/dist/.setup/{session-initialization-DH1z6fXn.mjs → session-initialization-rcgbZiid.mjs} +2 -2
  80. package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-BI1QK_98.mjs} +2 -2
  81. package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-BH-S6qkJ.mjs} +25 -6
  82. package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-DiAi6Kx6.mjs} +8 -8
  83. package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DA4VR4Eb.mjs} +59 -89
  84. package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-BJ1wSDcB.mjs} +147 -211
  85. package/dist/.setup/{source-Bjp4UQij.mjs → source-CUzJq5WN.mjs} +9 -9
  86. package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
  87. package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
  88. package/dist/.setup/{thread-history-page-BTx-4xsg.mjs → thread-history-page-DoVpnHim.mjs} +1 -1
  89. package/dist/.setup/{thread-lifecycle-Cik28qWn.mjs → thread-lifecycle-B3mfz1TG.mjs} +172 -2271
  90. package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-DcTtAcXj.mjs} +4 -2
  91. package/dist/.setup/{thread-policy-Cjs4B8xf.mjs → thread-policy-DGuQsuFC.mjs} +19 -3
  92. package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
  93. package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-DIBXwOpE.mjs} +6 -6
  94. package/dist/.setup/{timeout-DZF05XrR.mjs → timeout-C910MdAB.mjs} +19 -2
  95. package/dist/.setup/{transcript-history-projection-DHNBDhCU.mjs → transcript-history-projection-ZZpkFkJ_.mjs} +94 -64
  96. package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-BtHDBp1G.mjs} +218 -198
  97. package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-h2VHOskC.mjs} +135 -55
  98. package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-BUr4OUbC.mjs} +44 -36
  99. package/dist/.setup/{usage-BOgBEKso.mjs → usage-BML0r-ua.mjs} +5 -4
  100. package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-DUMbefVY.mjs} +4 -4
  101. package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
  102. package/dist/api.js +23 -12
  103. package/dist/catalog-page-worker-entrypoint.js +12 -0
  104. package/dist/catalog-page.worker.js +9 -0
  105. package/dist/cli-metadata.js +1 -1
  106. package/dist/doctor-contract-api.js +2 -2
  107. package/dist/harness.js +1 -1
  108. package/dist/index.js +221 -170
  109. package/dist/media-understanding-provider.js +2 -2
  110. package/dist/migration-provider-api.js +1 -1
  111. package/dist/provider-discovery.js +1 -1
  112. package/dist/session-history-worker-runtime.js +15 -32
  113. package/dist/session-history.worker.js +1 -1
  114. package/package.json +9 -6
  115. package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
  116. package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
  117. package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
  118. package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
  119. package/dist/.setup/version-CoqzXPgK.mjs +0 -12
  120. package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-umd0tgh4.mjs} +1 -1
@@ -0,0 +1,285 @@
1
+ import { n as projectCodexCatalogNativeResponse, r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-DowriLid.mjs";
2
+ import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
3
+ import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
4
+ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
5
+ import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
6
+ //#region extensions/codex/src/app-server/protocol-json.ts
7
+ function isRpcResponse(message) {
8
+ return message !== null && typeof message === "object" && "id" in message && (typeof message.id === "number" || typeof message.id === "string") && !("method" in message);
9
+ }
10
+ //#endregion
11
+ //#region extensions/codex/src/app-server/client-line-preview.ts
12
+ const CODEX_APP_SERVER_PARSE_LOG_MAX = 500;
13
+ function redactCodexAppServerLinePreview(value) {
14
+ const redacted = value.replace(/\s+/g, " ").trim().replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+/gi, "$1<redacted>").replace(/("(?:api_?key|authorization|token|access_token|refresh_token)"\s*:\s*")([^"]+)(")/gi, "$1<redacted>$3").replace(/\b([a-z0-9_]*(?:api_?key|authorization|access_token|refresh_token|token))(\s*=\s*)(["']?)[^\s"']+(\3)/gi, "$1$2$3<redacted>$4");
15
+ return redacted.length > CODEX_APP_SERVER_PARSE_LOG_MAX ? `${truncateUtf16Safe(redacted, CODEX_APP_SERVER_PARSE_LOG_MAX)}...` : redacted;
16
+ }
17
+ //#endregion
18
+ //#region extensions/codex/src/app-server/client-message-decoder.ts
19
+ const PARSE_BUFFER_MAX = 8388608;
20
+ const PARSE_BUFFER_MAX_LINES = 1e3;
21
+ const UNICODE_ESCAPE_QUAD = /^[\da-fA-F]{4}$/u;
22
+ /** Recovers the raw newlines observed inside native JSON string values. */
23
+ var CodexAppServerMessageDecoder = class {
24
+ constructor(reportError) {
25
+ this.reportError = reportError;
26
+ }
27
+ clear() {
28
+ this.pending = void 0;
29
+ }
30
+ get hasPending() {
31
+ return this.pending !== void 0;
32
+ }
33
+ parse(line) {
34
+ const rawLine = line.endsWith("\r") ? line.slice(0, -1) : line;
35
+ if (this.pending) return this.parseContinuation(rawLine, this.pending);
36
+ const trimmed = rawLine.trim();
37
+ if (!trimmed) return;
38
+ try {
39
+ return JSON.parse(trimmed);
40
+ } catch (error) {
41
+ if (isRecoverableParseFailure(trimmed, error)) {
42
+ const text = rawLine.trimStart();
43
+ this.pending = {
44
+ fragments: [text],
45
+ length: text.length,
46
+ inString: endsInsideJsonString(text)
47
+ };
48
+ } else this.reportError(trimmed, error, 1);
49
+ }
50
+ }
51
+ parseContinuation(line, pending) {
52
+ pending.fragments.push(line);
53
+ pending.length += 2 + line.length;
54
+ const withinBounds = pending.length <= PARSE_BUFFER_MAX && pending.fragments.length <= PARSE_BUFFER_MAX_LINES;
55
+ if (withinBounds && pending.inString && scanJsonString(line, 0) === line.length) return;
56
+ const candidate = pending.fragments.join("\\n");
57
+ this.pending = void 0;
58
+ try {
59
+ return JSON.parse(candidate);
60
+ } catch (error) {
61
+ if (withinBounds && isRecoverableParseFailure(candidate, error)) {
62
+ pending.inString = endsInsideJsonString(candidate);
63
+ this.pending = pending;
64
+ } else this.reportError(candidate, error, pending.fragments.length);
65
+ }
66
+ }
67
+ };
68
+ function isRecoverableParseFailure(value, error) {
69
+ if (!value.startsWith("{") && !value.startsWith("[")) return false;
70
+ const message = coerceErrorMessage(error);
71
+ return message.includes("Unterminated string") || message.includes("Unexpected end of JSON input");
72
+ }
73
+ function endsInsideJsonString(value) {
74
+ for (let index = 0; index < value.length; index++) {
75
+ if (value[index] !== "\"") continue;
76
+ const end = scanJsonString(value, index + 1);
77
+ if (end < 0) return false;
78
+ if (end === value.length) return true;
79
+ index = end;
80
+ }
81
+ return false;
82
+ }
83
+ /** Finds a closing quote; incomplete or invalid escapes require native parsing. */
84
+ function scanJsonString(value, start) {
85
+ for (let index = start; index < value.length; index++) {
86
+ const character = value[index];
87
+ if (character === "\"") return index;
88
+ if (value.charCodeAt(index) < 32) return -1;
89
+ if (character !== "\\") continue;
90
+ const escape = value[++index];
91
+ if (escape === "u") {
92
+ if (!UNICODE_ESCAPE_QUAD.test(value.slice(index + 1, index + 5))) return -1;
93
+ index += 4;
94
+ } else if (!escape || !"\"\\/bfnrt".includes(escape)) return -1;
95
+ }
96
+ return value.length;
97
+ }
98
+ //#endregion
99
+ //#region extensions/codex/src/app-server/client-message-frames.ts
100
+ const UNPAIRED_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
101
+ /** One byte reader owns framing and stops at an asynchronous page decode. */
102
+ function listenCodexAppServerLines(input, onLine, onError) {
103
+ let fragments = [];
104
+ let length = 0;
105
+ let remainder;
106
+ let waiting = false;
107
+ let ended = false;
108
+ let closed = false;
109
+ const close = () => {
110
+ closed = true;
111
+ fragments = [];
112
+ remainder = void 0;
113
+ input.off("data", onData);
114
+ input.off("end", onEnd);
115
+ input.pause();
116
+ };
117
+ const deliver = (tail) => {
118
+ const line = fragments.length ? Buffer.concat([...fragments, tail], length + tail.length) : tail;
119
+ fragments = [];
120
+ length = 0;
121
+ const completion = onLine(line);
122
+ if (!completion) return true;
123
+ waiting = true;
124
+ input.pause();
125
+ completion.then(() => {
126
+ waiting = false;
127
+ if (!closed) {
128
+ drain();
129
+ if (!waiting && !ended && !closed) input.resume();
130
+ }
131
+ }).catch((error) => {
132
+ close();
133
+ onError(error);
134
+ });
135
+ return false;
136
+ };
137
+ const drain = () => {
138
+ try {
139
+ const chunk = remainder;
140
+ remainder = void 0;
141
+ if (chunk) {
142
+ let start = 0;
143
+ let end;
144
+ while ((end = chunk.indexOf(10, start)) !== -1) {
145
+ if (closed) return;
146
+ remainder = chunk.subarray(end + 1);
147
+ if (!deliver(chunk.subarray(start, end))) return;
148
+ remainder = void 0;
149
+ start = end + 1;
150
+ }
151
+ if (!closed && start < chunk.length) {
152
+ fragments.push(chunk.subarray(start));
153
+ length += chunk.length - start;
154
+ }
155
+ }
156
+ if (ended && !closed) {
157
+ if (length && !deliver(Buffer.alloc(0))) return;
158
+ close();
159
+ }
160
+ } catch (error) {
161
+ close();
162
+ onError(error);
163
+ }
164
+ };
165
+ const onData = (chunk) => {
166
+ remainder = chunk;
167
+ drain();
168
+ };
169
+ const onEnd = () => {
170
+ ended = true;
171
+ if (!waiting) drain();
172
+ };
173
+ input.on("data", onData);
174
+ input.once("end", onEnd);
175
+ return close;
176
+ }
177
+ function codexCatalogResponseRoute(id) {
178
+ return typeof id === "number" && Number.isSafeInteger(id) && id >= 2 ** 52 ? {
179
+ id,
180
+ kind: id % 2 === 1 ? "list" : "thread"
181
+ } : void 0;
182
+ }
183
+ /** Read bounded envelope keys and IDs; skip native payload strings as bytes. */
184
+ function readCodexCatalogDecodeRoute(line) {
185
+ let depth = 0;
186
+ let route;
187
+ let response = false;
188
+ for (let index = 0; index < line.length; index++) {
189
+ const byte = line[index];
190
+ if (byte === 123 || byte === 91) depth++;
191
+ else if (byte === 125 || byte === 93) depth--;
192
+ else if (byte === 34) {
193
+ const start = index;
194
+ for (;;) {
195
+ index = line.indexOf(34, index + 1);
196
+ if (index < 0) return "unresolved";
197
+ let slash = index - 1;
198
+ while (line[slash] === 92) slash--;
199
+ if ((index - slash) % 2 === 1) break;
200
+ }
201
+ if (depth !== 1 || index - start > 64) continue;
202
+ let colon = index + 1;
203
+ while (line[colon] === 32 || line[colon] === 9 || line[colon] === 13) colon++;
204
+ if (line[colon] !== 58) continue;
205
+ const token = line.toString("utf8", start, index + 1);
206
+ let key = token.slice(1, -1);
207
+ if (token.includes("\\")) try {
208
+ key = JSON.parse(token);
209
+ } catch {
210
+ return "unresolved";
211
+ }
212
+ if (key === "method") return;
213
+ if (key === "result" || key === "error") {
214
+ response = true;
215
+ if (route) return route;
216
+ }
217
+ if (key !== "id") continue;
218
+ const match = /^\s*:\s*(\d+)(?=\s*[,}])/u.exec(line.toString("utf8", index + 1, Math.min(index + 100, line.length)));
219
+ if (!match) continue;
220
+ route = codexCatalogResponseRoute(Number(match[1]));
221
+ if (!route || response) return route;
222
+ }
223
+ }
224
+ return response || route ? "unresolved" : void 0;
225
+ }
226
+ function stringifyCodexAppServerMessage(message) {
227
+ return JSON.stringify(message, (_key, value) => typeof value === "string" ? value.replace(UNPAIRED_SURROGATE_RE, "") : value) ?? "null";
228
+ }
229
+ //#endregion
230
+ //#region extensions/codex/src/app-server/client-catalog-response.ts
231
+ /** The worker retains recovery fragments, but never a completed native page. */
232
+ function createCodexCatalogDecoder() {
233
+ let failures = [];
234
+ const decoder = new CodexAppServerMessageDecoder((value, error, fragmentCount) => {
235
+ failures.push({
236
+ value: redactCodexAppServerLinePreview(value),
237
+ error,
238
+ fragmentCount
239
+ });
240
+ });
241
+ return (input) => {
242
+ failures = [];
243
+ const result = projectCodexCatalogMessage(decoder.parse(Buffer.from(input.bytes.buffer, input.bytes.byteOffset, input.bytes.byteLength).toString("utf8")), input);
244
+ result.pending = decoder.hasPending;
245
+ result.failures = failures;
246
+ return result;
247
+ };
248
+ }
249
+ function projectCodexCatalogMessage(parsed, input, cachedPreview) {
250
+ const result = {
251
+ pending: false,
252
+ failures: []
253
+ };
254
+ if (!isJsonObject(parsed)) return result;
255
+ result.message = parsed;
256
+ if (!isRpcResponse(parsed)) return result;
257
+ const message = parsed;
258
+ const route = codexCatalogResponseRoute(message.id);
259
+ if (message.error || !route) return result;
260
+ const remainingRows = input.route === "unresolved" ? input.catalogRows?.has(route.id) ? input.catalogRows.get(route.id) : 0 : input.remainingRows;
261
+ try {
262
+ if (!isJsonObject(message.result)) throw new Error("Codex catalog response contains an invalid result");
263
+ if (route.kind === "list") {
264
+ const raw = message.result;
265
+ message.result = projectCodexCatalogNativeResponse(raw, sanitizeTerminalText, cachedPreview, remainingRows);
266
+ if (!cachedPreview) result.previewStates = Array.isArray(raw.data) ? raw.data.slice(0, Array.isArray(message.result.data) ? message.result.data.length : 0).map((row) => isJsonObject(row) && typeof row.preview === "string" ? Boolean(row.preview) : void 0) : [];
267
+ } else {
268
+ const thread = message.result.thread;
269
+ message.result = { thread: {
270
+ ...projectCodexCatalogNativeThread(thread, sanitizeTerminalText),
271
+ ...isJsonObject(thread) && typeof thread.cwd === "string" ? { cwd: thread.cwd } : {},
272
+ ...isJsonObject(thread) && (thread.historyMode === "paginated" || thread.historyMode === "legacy") ? { historyMode: thread.historyMode } : {}
273
+ } };
274
+ }
275
+ } catch (error) {
276
+ delete result.message;
277
+ result.projectionError = {
278
+ id: route.id,
279
+ error: error instanceof Error ? error : new Error("Codex catalog projection failed", { cause: error })
280
+ };
281
+ }
282
+ return result;
283
+ }
284
+ //#endregion
285
+ export { stringifyCodexAppServerMessage as a, isRpcResponse as c, readCodexCatalogDecodeRoute as i, projectCodexCatalogMessage as n, CodexAppServerMessageDecoder as o, listenCodexAppServerLines as r, redactCodexAppServerLinePreview as s, createCodexCatalogDecoder as t };
@@ -1,11 +1,15 @@
1
- import { o as formatCodexDisplayText } from "./command-formatters-CGEkdawF.mjs";
2
- import { n as describeControlFailure } from "./capabilities-_vXcZGSx.mjs";
1
+ import { o as formatCodexDisplayText } from "./command-formatters-Bmqvr9tO.mjs";
2
+ import { n as describeControlFailure } from "./capabilities-CDXOOFdZ.mjs";
3
3
  //#region extensions/codex/src/command-dispatch.ts
4
4
  /** Dispatches a `/codex` command to the lazily loaded handler. */
5
5
  async function handleCodexCommand(ctx, options) {
6
+ const commandContext = {
7
+ ...ctx,
8
+ gatewayClientScopes: ctx.gatewayClientScopes?.slice()
9
+ };
6
10
  const { loadSubcommandHandler, resolvePluginConfig, ...subcommandOptions } = options;
7
11
  try {
8
- return await (loadSubcommandHandler ? await loadSubcommandHandler() : await loadDefaultCodexSubcommandHandler())(ctx, {
12
+ return await (loadSubcommandHandler ? await loadSubcommandHandler() : await loadDefaultCodexSubcommandHandler())(commandContext, {
9
13
  ...subcommandOptions,
10
14
  pluginConfig: resolvePluginConfig?.() ?? subcommandOptions.pluginConfig
11
15
  });
@@ -14,7 +18,7 @@ async function handleCodexCommand(ctx, options) {
14
18
  }
15
19
  }
16
20
  async function loadDefaultCodexSubcommandHandler() {
17
- const { handleCodexSubcommand } = await import("./command-handlers-BtAJEW1X.mjs");
21
+ const { handleCodexSubcommand } = await import("./command-handlers-DW7Lx9oH.mjs");
18
22
  return handleCodexSubcommand;
19
23
  }
20
24
  //#endregion
@@ -1,5 +1,5 @@
1
- import { m as isJsonObject } from "./config-security-BRQ2mgW9.mjs";
2
- import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-DOEGYRNs.mjs";
1
+ import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
+ import { c as summarizeCodexRateLimits, o as summarizeCodexAccountRateLimits, r as hasCodexRateLimitSnapshots } from "./rate-limits-CMU3DUD0.mjs";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/codex/src/command-formatters.ts
5
5
  /**
@@ -42,10 +42,14 @@ function formatThreads(response) {
42
42
  }
43
43
  /** Formats account and rate-limit output for `/codex account`. */
44
44
  function formatAccount(account, limits, authOverview) {
45
- if (authOverview) return formatAccountAuthOverview(authOverview);
45
+ if (authOverview?.rows.some((row) => row.active)) return formatAccountAuthOverview(authOverview);
46
46
  const formattedLimits = limits.ok ? formatCodexRateLimitDetails(limits.value) : formatCodexDisplayText(limits.error);
47
47
  const rateLimitBlock = formattedLimits.startsWith("Codex is ") ? formattedLimits : formattedLimits.includes("\n") ? `Rate limits:\n${formattedLimits}` : `Rate limits: ${formattedLimits}`;
48
- return [`Account: ${account.ok ? formatCodexAccountSummary(account.value) : formatCodexDisplayText(account.error)}`, rateLimitBlock].join("\n\n");
48
+ return [
49
+ `Account: ${account.ok ? formatCodexAccountSummary(account.value) : formatCodexDisplayText(account.error)}`,
50
+ rateLimitBlock,
51
+ ...authOverview ? [formatAccountAuthOverview(authOverview)] : []
52
+ ].join("\n\n");
49
53
  }
50
54
  function formatAccountAuthOverview(overview) {
51
55
  const lines = [];