@openclaw/codex 2026.10.8 → 2026.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-usage-runtime-lUj2JqSj.mjs → account-usage-runtime-DAt_3QG0.mjs} +1 -1
- package/dist/.setup/{apply-DjTVE_db.mjs → apply-DmhHTC5c.mjs} +4 -4
- package/dist/.setup/{attempt-client-cleanup-BmPBqnW3.mjs → attempt-client-cleanup-DQBa7iiq.mjs} +4 -4
- package/dist/.setup/{auth-cache-key-8VTsPn2f.mjs → auth-cache-key-KogLtj0t.mjs} +1 -1
- package/dist/.setup/{bounded-turn-DByEneJg.mjs → bounded-turn-B91suzbV.mjs} +7 -7
- package/dist/.setup/{build-state-vxQdf_74.mjs → build-state-CvGKuaeP.mjs} +1 -1
- package/dist/.setup/{client-BTWv2cJe.mjs → client-CafYfF2n.mjs} +306 -19
- package/dist/.setup/{command-dispatch-rxpyy4f6.mjs → command-dispatch-C2tNChTq.mjs} +1 -1
- package/dist/.setup/{command-handlers-D6utyBA8.mjs → command-handlers-yb5vwwrx.mjs} +10 -10
- package/dist/.setup/{command-rpc-CloxIlVK.mjs → command-rpc-CZmpQF4z.mjs} +6 -6
- package/dist/.setup/{compact-CIJFn4Bi.mjs → compact-CeD2d2_k.mjs} +9 -9
- package/dist/.setup/{computer-use-vLGHqSOu.mjs → computer-use-C4HhkAcj.mjs} +4 -4
- package/dist/.setup/{conversation-binding-BUw0IM5Z.mjs → conversation-binding-HX8U8A3K.mjs} +7 -7
- package/dist/.setup/{dynamic-tool-build-OWTT0wP-.mjs → dynamic-tool-build-BPkHfpul.mjs} +1 -1
- package/dist/.setup/{dynamic-tools-CygReZGj.mjs → dynamic-tools-CCezdz5n.mjs} +6 -6
- package/dist/.setup/{effective-mcp-catalog-B_4Dtkdg.mjs → effective-mcp-catalog-SjTJ-F2i.mjs} +4 -4
- package/dist/.setup/{ephemeral-turn-B1Na_xCj.mjs → ephemeral-turn-CgKjGBaW.mjs} +2 -2
- package/dist/.setup/{isolated-completion-DGCmR0Q8.mjs → isolated-completion-C5ifbI0F.mjs} +3 -3
- package/dist/.setup/{mcp-app-session-preparation-DFvoViz9.mjs → mcp-app-session-preparation-hnw_eGnR.mjs} +3 -3
- package/dist/.setup/{model-catalog-CCr0L7T4.mjs → model-catalog-BO573-NN.mjs} +5 -5
- package/dist/.setup/{models-CPdqFOZS.mjs → models-Dw0qUZl3.mjs} +3 -3
- package/dist/.setup/{native-hook-relay-VHeLdZXU.mjs → native-hook-relay-CwkDznGH.mjs} +3 -3
- package/dist/.setup/{native-mcp-app-ly1JuStw.mjs → native-mcp-app-B7N--ols.mjs} +4 -4
- package/dist/.setup/{native-skill-isolation--6M-3BWV.mjs → native-skill-isolation-0pEyxLRX.mjs} +2 -2
- package/dist/.setup/{native-subagent-monitor-CuNglHrq.mjs → native-subagent-monitor-D_tvjJxa.mjs} +6 -6
- package/dist/.setup/{plan-CqI4m0CC.mjs → plan-BE7gWwkn.mjs} +2 -2
- package/dist/.setup/{plugin-approval-roundtrip-DIE4DZ9S.mjs → plugin-approval-roundtrip-ts-2EU8i.mjs} +1 -1
- package/dist/.setup/{provider-CBlKf65x.mjs → provider-D8R-IBhv.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-BIyUe_cz.mjs → provider-capabilities-C4ENlstc.mjs} +1 -1
- package/dist/.setup/{request-6bus8ebp.mjs → request-ufWmJNN1.mjs} +1 -1
- package/dist/.setup/{run-attempt-BcePYT3A.mjs → run-attempt-CGHsrfPB.mjs} +22 -22
- package/dist/.setup/{session-catalog-events-C8i0HBz5.mjs → session-catalog-events-DnLfF9Xo.mjs} +3 -3
- package/dist/.setup/{session-catalog-index-zqaZhwr2.mjs → session-catalog-index-Bbph2EwS.mjs} +4 -4
- package/dist/.setup/{session-catalog-native-projection-C6KOqnIb.mjs → session-catalog-native-projection-CHtG8DwY.mjs} +1 -1
- package/dist/.setup/{session-catalog-projection-DD5m0grG.mjs → session-catalog-projection-BgENBUS2.mjs} +1 -1
- package/dist/.setup/{session-catalog-source-0x1LVwV-.mjs → session-catalog-source-qHe5r9i_.mjs} +1 -1
- package/dist/.setup/{session-retirement-BIFmgIgn.mjs → session-retirement-BdHruV7q.mjs} +5 -5
- package/dist/.setup/{settled-turn-finalizer-9WZ-Hnwo.mjs → settled-turn-finalizer-Ca_Qd_9g.mjs} +3 -3
- package/dist/.setup/{shared-client-Bo9MCCKj.mjs → shared-client-C0gEybHs.mjs} +5 -5
- package/dist/.setup/{side-question-GmfBHNHK.mjs → side-question-Nn6D01tP.mjs} +9 -9
- package/dist/.setup/{source-C4Al9cJx.mjs → source-CgYvv2h-.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-run-avZbRAjm.mjs → thread-lifecycle-run-BHM-L-56.mjs} +11 -11
- package/dist/.setup/{thread-ownership-C5Hpc-Q1.mjs → thread-ownership-BJpeo5Xk.mjs} +3 -3
- package/dist/.setup/{thread-policy-BFLbIpIt.mjs → thread-policy-BlzkKVno.mjs} +3 -3
- package/dist/.setup/{thread-resume-LBLXiIEh.mjs → thread-resume-BDd8b3E_.mjs} +4 -4
- package/dist/.setup/{turn-router-Ba0-h2NE.mjs → turn-router-8CkGlezp.mjs} +2 -2
- package/dist/.setup/{upstream-session-fork-C34T_h_K.mjs → upstream-session-fork-BW_UbivO.mjs} +8 -8
- package/dist/.setup/{usage-BHTnwsjV.mjs → usage-fX3ctGZb.mjs} +1 -1
- package/dist/.setup/{usage-limit-error-YNy7uINJ.mjs → usage-limit-error-DycN7mED.mjs} +1 -1
- package/dist/.setup/{web-search-provider.runtime-BOqY-zot.mjs → web-search-provider.runtime-DEBVJch2.mjs} +1 -1
- package/dist/.source-module-urls/0560e3825cf513bbe9e095a85951c1215dfced0c1e581c5f32b007a3e759636e.json +1 -0
- package/dist/.source-module-urls/61f8912a558f2bfc87dcddd651d7f5d3cf17ba02e1e5359b050bf670840c0e0e.json +1 -0
- package/dist/catalog-page.worker.js +340 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/harness.js +15 -15
- package/dist/index.js +24 -24
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/package.json +4 -4
- package/dist/.setup/client-catalog-response-CEZTmNz3.mjs +0 -310
- package/dist/.source-module-urls/a8ffe2b9525179f031f130700992add0f356b5fe3e562c8e70b2801696da5134.json +0 -1
- package/dist/.setup/{session-cli-B1f7NqXo.mjs → session-cli-CKzNw4c4.mjs} +1 -1
|
@@ -1,5 +1,344 @@
|
|
|
1
|
-
import { t as createCodexCatalogDecoder } from "./.setup/client-catalog-response-CEZTmNz3.mjs";
|
|
2
1
|
import { serveWorkerTasks } from "openclaw/plugin-sdk/worker-task-server";
|
|
2
|
+
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
3
|
+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
4
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import "openclaw/plugin-sdk/agent-harness-registration";
|
|
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/protocol.ts
|
|
12
|
+
function isJsonObject(value) {
|
|
13
|
+
return isRecord(value);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region extensions/codex/src/session-catalog-limits.ts
|
|
17
|
+
/** Preserve UTF-16 code units without retaining an oversized source string. */
|
|
18
|
+
function detachCodexCatalogString(value) {
|
|
19
|
+
return Buffer.from(value, "utf16le").toString("utf16le");
|
|
20
|
+
}
|
|
21
|
+
const MAX_CWD_LENGTH = 4096;
|
|
22
|
+
const MAX_SESSION_PREVIEW_LENGTH = 500;
|
|
23
|
+
const SESSION_PREVIEW_PREFIX_LENGTH = 2048;
|
|
24
|
+
function boundedCatalogString(value, maxLength, overflow = "omit") {
|
|
25
|
+
if (typeof value !== "string") return;
|
|
26
|
+
const normalized = value.trim();
|
|
27
|
+
if (!normalized) return;
|
|
28
|
+
if (normalized.length <= maxLength) return detachCodexCatalogString(normalized);
|
|
29
|
+
return overflow === "truncate" ? detachCodexCatalogString(truncateUtf16Safe(normalized, maxLength)) : void 0;
|
|
30
|
+
}
|
|
31
|
+
/** Select a bounded input only for the canonical terminal sanitizer. */
|
|
32
|
+
function selectCodexCatalogPreviewInput(value) {
|
|
33
|
+
if (value.length <= SESSION_PREVIEW_PREFIX_LENGTH) return value;
|
|
34
|
+
const prefix = value.slice(0, SESSION_PREVIEW_PREFIX_LENGTH).replace(/\s+/g, " ").trim();
|
|
35
|
+
return prefix.length > MAX_SESSION_PREVIEW_LENGTH && !/\p{Cc}/u.test(prefix) ? prefix : value;
|
|
36
|
+
}
|
|
37
|
+
/** Detach the small preview from V8's potentially large sliced-string backing store. */
|
|
38
|
+
function truncateCodexCatalogPreview(value, sanitize) {
|
|
39
|
+
const preview = typeof value === "string" ? boundedCatalogString(sanitize(value.replace(/\s+/g, " ")), MAX_SESSION_PREVIEW_LENGTH, "truncate") : void 0;
|
|
40
|
+
return Buffer.from(preview ?? "", "utf8").toString("utf8");
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region extensions/codex/package.json
|
|
44
|
+
var version = "2026.10.9";
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region extensions/codex/src/build-state.ts
|
|
47
|
+
/**
|
|
48
|
+
* Duplicate module copies share one immutable published version's state.
|
|
49
|
+
* In-process restarts retain old records and callbacks for their old owners.
|
|
50
|
+
* Local rebuilds without a version bump deliberately share the same state.
|
|
51
|
+
*/
|
|
52
|
+
function codexBuildSymbol(name) {
|
|
53
|
+
return Symbol.for(`${name}@${version}`);
|
|
54
|
+
}
|
|
55
|
+
function defineCodexBuildState(name, create) {
|
|
56
|
+
const key = codexBuildSymbol(name);
|
|
57
|
+
const globalState = globalThis;
|
|
58
|
+
return () => globalState[key] ??= create();
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region extensions/codex/src/session-catalog-source.ts
|
|
62
|
+
const getSources = defineCodexBuildState("openclaw.codexCatalogSources", () => ({
|
|
63
|
+
clients: /* @__PURE__ */ new WeakMap(),
|
|
64
|
+
values: /* @__PURE__ */ new WeakMap()
|
|
65
|
+
}));
|
|
66
|
+
defineCodexBuildState("openclaw.codexCatalogEphemeralObservers", () => /* @__PURE__ */ new WeakMap());
|
|
67
|
+
function getCodexCatalogSource(value) {
|
|
68
|
+
return value !== null && typeof value === "object" ? getSources().values.get(value) : void 0;
|
|
69
|
+
}
|
|
70
|
+
function setCodexCatalogSource(value, source) {
|
|
71
|
+
if (source) getSources().values.set(value, source);
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
/** Source attribution survives projection without becoming serialized row data. */
|
|
75
|
+
function copyCodexCatalogSource(from, to) {
|
|
76
|
+
return setCodexCatalogSource(to, getCodexCatalogSource(from));
|
|
77
|
+
}
|
|
78
|
+
const STRING_FIELDS = [
|
|
79
|
+
[
|
|
80
|
+
"name",
|
|
81
|
+
500,
|
|
82
|
+
"truncate"
|
|
83
|
+
],
|
|
84
|
+
[
|
|
85
|
+
"cwd",
|
|
86
|
+
MAX_CWD_LENGTH,
|
|
87
|
+
"omit"
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"modelProvider",
|
|
91
|
+
500,
|
|
92
|
+
"truncate"
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
"cliVersion",
|
|
96
|
+
500,
|
|
97
|
+
"truncate"
|
|
98
|
+
]
|
|
99
|
+
];
|
|
100
|
+
/** Drop unused native fields before catalog-owned asynchronous work can retain them. */
|
|
101
|
+
function projectCodexCatalogNativeThread(thread, sanitize, cachedPreview) {
|
|
102
|
+
if (!isJsonObject(thread)) throw new Error("Codex catalog response contains an invalid thread");
|
|
103
|
+
const id = boundedCatalogString(thread.id, 256);
|
|
104
|
+
if (!id) throw new Error("Codex catalog response contains an invalid thread id");
|
|
105
|
+
const row = {
|
|
106
|
+
id,
|
|
107
|
+
projectId: boundedCatalogString(thread.projectId, 256, "omit") ?? null
|
|
108
|
+
};
|
|
109
|
+
const sessionId = boundedCatalogString(thread.sessionId, 256, "omit");
|
|
110
|
+
if (sessionId) row.sessionId = sessionId;
|
|
111
|
+
if (thread.ephemeral === true) return copyCodexCatalogSource(thread, {
|
|
112
|
+
...row,
|
|
113
|
+
ephemeral: true
|
|
114
|
+
});
|
|
115
|
+
for (const [field, limit, overflow] of STRING_FIELDS) {
|
|
116
|
+
const value = thread[field];
|
|
117
|
+
const bounded = boundedCatalogString(value, limit, overflow);
|
|
118
|
+
if (value === null || bounded !== void 0) row[field] = bounded ?? null;
|
|
119
|
+
}
|
|
120
|
+
if (typeof thread.path === "string") {
|
|
121
|
+
if (thread.path.length > 4096) throw new Error("Codex catalog rollout path exceeds its length limit");
|
|
122
|
+
row.path = detachCodexCatalogString(thread.path);
|
|
123
|
+
} else if (thread.path === null) row.path = null;
|
|
124
|
+
if (typeof thread.originator === "string") row.originator = detachCodexCatalogString(truncateUtf16Safe(thread.originator, 500));
|
|
125
|
+
for (const field of [
|
|
126
|
+
"createdAt",
|
|
127
|
+
"updatedAt",
|
|
128
|
+
"recencyAt"
|
|
129
|
+
]) {
|
|
130
|
+
const value = thread[field];
|
|
131
|
+
if (value === null || typeof value === "number" && Number.isFinite(value)) row[field] = value;
|
|
132
|
+
}
|
|
133
|
+
const rawPreview = thread.preview;
|
|
134
|
+
const preview = reuseCodexCatalogPreview(row, typeof rawPreview === "string" ? Boolean(rawPreview) : void 0, cachedPreview);
|
|
135
|
+
if (preview !== void 0) row.preview = preview;
|
|
136
|
+
else if (typeof rawPreview === "string") row.preview = rawPreview ? truncateCodexCatalogPreview(selectCodexCatalogPreviewInput(rawPreview), sanitize) : "";
|
|
137
|
+
else if (rawPreview === null) row.preview = null;
|
|
138
|
+
const source = thread.source;
|
|
139
|
+
if (source === "cli" || source === "vscode" || source === "exec" || source === "appServer" || source === "unknown") row.source = source;
|
|
140
|
+
else if (isJsonObject(thread.source) && typeof thread.source.custom === "string" && thread.source.custom.length <= 500) row.source = { custom: detachCodexCatalogString(thread.source.custom) };
|
|
141
|
+
if (isJsonObject(thread.gitInfo)) {
|
|
142
|
+
const branch = boundedCatalogString(thread.gitInfo.branch, 500, "truncate");
|
|
143
|
+
if (branch !== void 0) row.gitInfo = { branch };
|
|
144
|
+
}
|
|
145
|
+
if (isJsonObject(thread.status)) {
|
|
146
|
+
const type = boundedCatalogString(thread.status.type, 64);
|
|
147
|
+
if (type === "active" || type === "idle" || type === "notLoaded" || type === "systemError") {
|
|
148
|
+
const activeFlags = type === "active" && Array.isArray(thread.status.activeFlags) ? thread.status.activeFlags.slice(0, 16).flatMap((flag) => {
|
|
149
|
+
const bounded = boundedCatalogString(flag, 128, "omit");
|
|
150
|
+
return bounded ? [bounded] : [];
|
|
151
|
+
}) : void 0;
|
|
152
|
+
row.status = type === "active" ? {
|
|
153
|
+
type,
|
|
154
|
+
...activeFlags ? { activeFlags } : {}
|
|
155
|
+
} : { type };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return copyCodexCatalogSource(thread, row);
|
|
159
|
+
}
|
|
160
|
+
/** Keep only the admitted prefix before an RPC promise retains its response. */
|
|
161
|
+
function projectCodexCatalogNativeResponse(response, sanitize, cachedPreview, remainingRows = 64) {
|
|
162
|
+
if (!Array.isArray(response.data) || response.data.length > 64) throw new Error("Codex catalog response exceeds its native page limit");
|
|
163
|
+
const limit = Number.isFinite(remainingRows) ? Math.max(0, Math.min(64, Math.floor(remainingRows))) : 0;
|
|
164
|
+
const page = { data: response.data.slice(0, limit).map((thread) => projectCodexCatalogNativeThread(thread, sanitize, cachedPreview)) };
|
|
165
|
+
for (const field of ["nextCursor", "backwardsCursor"]) {
|
|
166
|
+
const value = response[field];
|
|
167
|
+
if (value === null) page[field] = null;
|
|
168
|
+
else if (value !== void 0) {
|
|
169
|
+
if (typeof value !== "string" || value.length > 4096) throw new Error("Codex catalog response contains an invalid cursor");
|
|
170
|
+
page[field] = detachCodexCatalogString(value);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return page;
|
|
174
|
+
}
|
|
175
|
+
/** Reuse resident text without transferring a cache or an unbounded native preview. */
|
|
176
|
+
function reuseCodexCatalogPreview(thread, rawPreviewNonempty, cachedPreview) {
|
|
177
|
+
const preview = cachedPreview?.({
|
|
178
|
+
id: thread.id,
|
|
179
|
+
path: typeof thread.path === "string" ? thread.path : null,
|
|
180
|
+
updatedAt: typeof thread.updatedAt === "number" ? thread.updatedAt : null,
|
|
181
|
+
recencyAt: typeof thread.recencyAt === "number" ? thread.recencyAt : null
|
|
182
|
+
});
|
|
183
|
+
return preview !== void 0 && preview.length <= 500 && (rawPreviewNonempty === void 0 || rawPreviewNonempty === Boolean(preview)) ? preview : void 0;
|
|
184
|
+
}
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region extensions/codex/src/app-server/client-line-preview.ts
|
|
187
|
+
const CODEX_APP_SERVER_PARSE_LOG_MAX = 500;
|
|
188
|
+
function redactCodexAppServerLinePreview(value) {
|
|
189
|
+
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");
|
|
190
|
+
return redacted.length > CODEX_APP_SERVER_PARSE_LOG_MAX ? `${truncateUtf16Safe(redacted, CODEX_APP_SERVER_PARSE_LOG_MAX)}...` : redacted;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region extensions/codex/src/app-server/client-message-decoder.ts
|
|
194
|
+
const PARSE_BUFFER_MAX = 8388608;
|
|
195
|
+
const PARSE_BUFFER_MAX_LINES = 1e3;
|
|
196
|
+
const UNICODE_ESCAPE_QUAD = /^[\da-fA-F]{4}$/u;
|
|
197
|
+
/** Recovers the raw newlines observed inside native JSON string values. */
|
|
198
|
+
var CodexAppServerMessageDecoder = class {
|
|
199
|
+
constructor(reportError) {
|
|
200
|
+
this.reportError = reportError;
|
|
201
|
+
}
|
|
202
|
+
clear() {
|
|
203
|
+
this.pending = void 0;
|
|
204
|
+
}
|
|
205
|
+
get hasPending() {
|
|
206
|
+
return this.pending !== void 0;
|
|
207
|
+
}
|
|
208
|
+
parse(line) {
|
|
209
|
+
const rawLine = line.endsWith("\r") ? line.slice(0, -1) : line;
|
|
210
|
+
const pending = this.pending;
|
|
211
|
+
let candidate;
|
|
212
|
+
let withinBounds = true;
|
|
213
|
+
if (pending) {
|
|
214
|
+
pending.fragments.push(rawLine);
|
|
215
|
+
pending.length += 2 + rawLine.length;
|
|
216
|
+
withinBounds = pending.length <= PARSE_BUFFER_MAX && pending.fragments.length <= PARSE_BUFFER_MAX_LINES;
|
|
217
|
+
if (withinBounds && pending.inString && scanJsonString(rawLine, 0) === rawLine.length) return;
|
|
218
|
+
candidate = pending.fragments.join("\\n");
|
|
219
|
+
this.pending = void 0;
|
|
220
|
+
} else {
|
|
221
|
+
candidate = rawLine.trim();
|
|
222
|
+
if (!candidate) return;
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
return JSON.parse(candidate);
|
|
226
|
+
} catch (error) {
|
|
227
|
+
const text = pending ? candidate : rawLine.trimStart();
|
|
228
|
+
const inString = withinBounds ? recoverableJsonStringState(text, error) : void 0;
|
|
229
|
+
if (inString !== void 0) {
|
|
230
|
+
if (pending) pending.inString = inString;
|
|
231
|
+
this.pending = pending ?? {
|
|
232
|
+
fragments: [text],
|
|
233
|
+
length: text.length,
|
|
234
|
+
inString
|
|
235
|
+
};
|
|
236
|
+
} else this.reportError(candidate, error, pending?.fragments.length ?? 1);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
/** Undefined rejects malformed JSON; false retains a trailing escape for native parsing. */
|
|
241
|
+
function recoverableJsonStringState(value, error) {
|
|
242
|
+
if (!(error instanceof SyntaxError) || !value.startsWith("{") && !value.startsWith("[")) return;
|
|
243
|
+
const closers = [];
|
|
244
|
+
for (let index = 0; index < value.length; index++) {
|
|
245
|
+
const character = value[index];
|
|
246
|
+
if (character === "{" || character === "[") closers.push(character === "{" ? "}" : "]");
|
|
247
|
+
else if (character === "}" || character === "]") closers.pop();
|
|
248
|
+
if (character !== "\"") continue;
|
|
249
|
+
const end = scanJsonString(value, index + 1);
|
|
250
|
+
if (end < 0) return;
|
|
251
|
+
if (end >= value.length) {
|
|
252
|
+
const closing = closers.toReversed().join("");
|
|
253
|
+
for (const suffix of ["\"", "\":null"]) try {
|
|
254
|
+
JSON.parse(`${value}\\n${suffix}${closing}`);
|
|
255
|
+
return end === value.length;
|
|
256
|
+
} catch {}
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
index = end;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
/** Finds a closing quote; incomplete or invalid escapes require native parsing. */
|
|
263
|
+
function scanJsonString(value, start) {
|
|
264
|
+
for (let index = start; index < value.length; index++) {
|
|
265
|
+
const character = value[index];
|
|
266
|
+
if (character === "\"") return index;
|
|
267
|
+
if (value.charCodeAt(index) < 32) return -1;
|
|
268
|
+
if (character !== "\\") continue;
|
|
269
|
+
const escape = value[++index];
|
|
270
|
+
if (!escape) return value.length + 1;
|
|
271
|
+
else if (escape === "u") {
|
|
272
|
+
if (!UNICODE_ESCAPE_QUAD.test(value.slice(index + 1, index + 5))) return -1;
|
|
273
|
+
index += 4;
|
|
274
|
+
} else if (!"\"\\/bfnrt".includes(escape)) return -1;
|
|
275
|
+
}
|
|
276
|
+
return value.length;
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region extensions/codex/src/app-server/client-message-frames.ts
|
|
280
|
+
function codexCatalogResponseRoute(id) {
|
|
281
|
+
return typeof id === "number" && Number.isSafeInteger(id) && id >= 2 ** 52 ? {
|
|
282
|
+
id,
|
|
283
|
+
kind: id % 2 === 1 ? "list" : "thread"
|
|
284
|
+
} : void 0;
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region extensions/codex/src/app-server/client-catalog-response.ts
|
|
288
|
+
/** The worker retains recovery fragments, but never a completed native page. */
|
|
289
|
+
function createCodexCatalogDecoder() {
|
|
290
|
+
let failures = [];
|
|
291
|
+
const decoder = new CodexAppServerMessageDecoder((value, error, fragmentCount) => {
|
|
292
|
+
failures.push({
|
|
293
|
+
value: redactCodexAppServerLinePreview(value),
|
|
294
|
+
error,
|
|
295
|
+
fragmentCount
|
|
296
|
+
});
|
|
297
|
+
});
|
|
298
|
+
return (input) => {
|
|
299
|
+
failures = [];
|
|
300
|
+
const result = projectCodexCatalogMessage(decoder.parse(Buffer.from(input.bytes.buffer, input.bytes.byteOffset, input.bytes.byteLength).toString("utf8")), input);
|
|
301
|
+
result.pending = decoder.hasPending;
|
|
302
|
+
result.failures = failures;
|
|
303
|
+
return result;
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
function projectCodexCatalogMessage(parsed, input, cachedPreview) {
|
|
307
|
+
const result = {
|
|
308
|
+
pending: false,
|
|
309
|
+
failures: []
|
|
310
|
+
};
|
|
311
|
+
if (!isJsonObject(parsed)) return result;
|
|
312
|
+
result.message = parsed;
|
|
313
|
+
if (!isRpcResponse(parsed)) return result;
|
|
314
|
+
const message = parsed;
|
|
315
|
+
const route = codexCatalogResponseRoute(message.id);
|
|
316
|
+
if (message.error || !route) return result;
|
|
317
|
+
const remainingRows = input.route === "unresolved" ? input.catalogRows?.has(route.id) ? input.catalogRows.get(route.id) : 0 : input.remainingRows;
|
|
318
|
+
try {
|
|
319
|
+
if (!isJsonObject(message.result)) throw new Error("Codex catalog response contains an invalid result");
|
|
320
|
+
if (route.kind === "list") {
|
|
321
|
+
const raw = message.result;
|
|
322
|
+
message.result = projectCodexCatalogNativeResponse(raw, sanitizeTerminalText, cachedPreview, remainingRows);
|
|
323
|
+
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) : [];
|
|
324
|
+
} else {
|
|
325
|
+
const thread = message.result.thread;
|
|
326
|
+
message.result = { thread: {
|
|
327
|
+
...projectCodexCatalogNativeThread(thread, sanitizeTerminalText),
|
|
328
|
+
...isJsonObject(thread) && typeof thread.cwd === "string" ? { cwd: thread.cwd } : {},
|
|
329
|
+
...isJsonObject(thread) && (thread.historyMode === "paginated" || thread.historyMode === "legacy") ? { historyMode: thread.historyMode } : {}
|
|
330
|
+
} };
|
|
331
|
+
}
|
|
332
|
+
} catch (error) {
|
|
333
|
+
delete result.message;
|
|
334
|
+
result.projectionError = {
|
|
335
|
+
id: route.id,
|
|
336
|
+
error: error instanceof Error ? error : new Error("Codex catalog projection failed", { cause: error })
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
return result;
|
|
340
|
+
}
|
|
341
|
+
//#endregion
|
|
3
342
|
//#region extensions/codex/catalog-page.worker.ts
|
|
4
343
|
const decode = createCodexCatalogDecoder();
|
|
5
344
|
serveWorkerTasks((input) => {
|
package/dist/cli-metadata.js
CHANGED
|
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
2
2
|
//#region extensions/codex/cli-metadata.ts
|
|
3
3
|
function registerCodexCliMetadata(api) {
|
|
4
4
|
api.registerCli(async ({ program }) => {
|
|
5
|
-
const { registerCodexSessionCli } = await import("./.setup/session-cli-
|
|
5
|
+
const { registerCodexSessionCli } = await import("./.setup/session-cli-CKzNw4c4.mjs");
|
|
6
6
|
registerCodexSessionCli(program);
|
|
7
7
|
}, { descriptors: [{
|
|
8
8
|
name: "codex",
|
package/dist/harness.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CODEX_NATIVE_TOOL_REQUIREMENTS, CODEX_TOOL_POLICY_SAFE_DENY_NAMES } from "./native-tool-policy.js";
|
|
2
2
|
import { n as readCodexRuntimeModelId } from "./.setup/model-runtime-BdqzOMkU.mjs";
|
|
3
3
|
import { m as sessionBindingIdentity } from "./.setup/session-binding-record-O62ZRFhy.mjs";
|
|
4
|
-
import { t as codexBuildSymbol } from "./.setup/build-state-
|
|
4
|
+
import { t as codexBuildSymbol } from "./.setup/build-state-CvGKuaeP.mjs";
|
|
5
5
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
6
6
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
//#region extensions/codex/harness.ts
|
|
@@ -93,7 +93,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
93
93
|
executionEnvironment: "host-only",
|
|
94
94
|
upstreamKinds: ["codex-app-server"],
|
|
95
95
|
fork: async (params) => {
|
|
96
|
-
const { forkCodexUpstreamSession } = await import("./.setup/upstream-session-fork-
|
|
96
|
+
const { forkCodexUpstreamSession } = await import("./.setup/upstream-session-fork-BW_UbivO.mjs");
|
|
97
97
|
return await forkCodexUpstreamSession(params, {
|
|
98
98
|
bindingStore: options.bindingStore,
|
|
99
99
|
controlFactory: sessionCatalogControlFactory,
|
|
@@ -115,11 +115,11 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
115
115
|
return validateCodexAppServerRuntimeArtifact(binding, void 0, resolveCodexAppServerRuntimeOptions({ pluginConfig: resolveAttemptPluginConfig(options.resolveConfig?.()) }).start);
|
|
116
116
|
} },
|
|
117
117
|
fetchUsageSnapshot: async (ctx) => {
|
|
118
|
-
const { fetchCodexAppServerUsageSnapshot } = await import("./.setup/usage-
|
|
118
|
+
const { fetchCodexAppServerUsageSnapshot } = await import("./.setup/usage-fX3ctGZb.mjs");
|
|
119
119
|
return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
120
120
|
},
|
|
121
121
|
loadModelCatalog: async (params) => {
|
|
122
|
-
const { createCodexAppServerModelCatalog } = await import("./.setup/model-catalog-
|
|
122
|
+
const { createCodexAppServerModelCatalog } = await import("./.setup/model-catalog-BO573-NN.mjs");
|
|
123
123
|
if (disposed) return { entries: [] };
|
|
124
124
|
modelCatalog ??= createCodexAppServerModelCatalog(harnessRuntimeId);
|
|
125
125
|
return { entries: await modelCatalog.load(params, resolveAttemptPluginConfig(params.config)) };
|
|
@@ -129,7 +129,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
129
129
|
return asOptionalRecord(asOptionalRecord(resolveAttemptPluginConfig(config))?.appServer)?.enableUltrafast === false ? serviceTiers.filter((tier) => tier !== "ultrafast") : serviceTiers;
|
|
130
130
|
},
|
|
131
131
|
acquireMcpAppRuntime: async (params) => {
|
|
132
|
-
const { acquireCodexMcpAppRuntime } = await import("./.setup/effective-mcp-catalog-
|
|
132
|
+
const { acquireCodexMcpAppRuntime } = await import("./.setup/effective-mcp-catalog-SjTJ-F2i.mjs");
|
|
133
133
|
if (disposed) return;
|
|
134
134
|
params.assertCurrent();
|
|
135
135
|
return await acquireCodexMcpAppRuntime(params, {
|
|
@@ -138,7 +138,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
138
138
|
});
|
|
139
139
|
},
|
|
140
140
|
loadMcpToolCatalog: async (params) => {
|
|
141
|
-
const { loadCodexEffectiveMcpCatalog } = await import("./.setup/effective-mcp-catalog-
|
|
141
|
+
const { loadCodexEffectiveMcpCatalog } = await import("./.setup/effective-mcp-catalog-SjTJ-F2i.mjs");
|
|
142
142
|
return await loadCodexEffectiveMcpCatalog(params, { bindingStore: options.bindingStore });
|
|
143
143
|
},
|
|
144
144
|
supports: (ctx) => {
|
|
@@ -170,7 +170,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
170
170
|
};
|
|
171
171
|
},
|
|
172
172
|
runAttempt: async (params) => {
|
|
173
|
-
const { runCodexAppServerAttempt } = await import("./.setup/run-attempt-
|
|
173
|
+
const { runCodexAppServerAttempt } = await import("./.setup/run-attempt-CGHsrfPB.mjs");
|
|
174
174
|
const { planCodexCyberEscalation, readCodexCyberAttemptVerdict, recordCodexCyberTargetUnavailable, reserveCodexCyberProbe, resolveCodexCyberFailoverConfig } = await import("./.setup/cyber-failover-B-q6oT01.mjs");
|
|
175
175
|
const { emitCodexCyberNotice } = await import("./.setup/cyber-failover-notice-poL3Advd.mjs");
|
|
176
176
|
const pluginConfig = resolveAttemptPluginConfig(params.config);
|
|
@@ -236,7 +236,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
236
236
|
const { runHostPreparedIsolatedCompletion } = await import("openclaw/plugin-sdk/simple-completion-runtime");
|
|
237
237
|
return runHostPreparedIsolatedCompletion(params);
|
|
238
238
|
}
|
|
239
|
-
const { runCodexIsolatedCompletion } = await import("./.setup/isolated-completion-
|
|
239
|
+
const { runCodexIsolatedCompletion } = await import("./.setup/isolated-completion-C5ifbI0F.mjs");
|
|
240
240
|
return runCodexIsolatedCompletion(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
241
241
|
},
|
|
242
242
|
runIsolatedCompletion: async (params) => {
|
|
@@ -252,11 +252,11 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
252
252
|
});
|
|
253
253
|
},
|
|
254
254
|
finalizeSettledTurn: async (params) => {
|
|
255
|
-
const { runCodexSettledTurnFinalization } = await import("./.setup/settled-turn-finalizer-
|
|
255
|
+
const { runCodexSettledTurnFinalization } = await import("./.setup/settled-turn-finalizer-Ca_Qd_9g.mjs");
|
|
256
256
|
return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
257
257
|
},
|
|
258
258
|
runSideQuestion: async (params) => {
|
|
259
|
-
const { runCodexAppServerSideQuestion } = await import("./.setup/side-question-
|
|
259
|
+
const { runCodexAppServerSideQuestion } = await import("./.setup/side-question-Nn6D01tP.mjs");
|
|
260
260
|
return runCodexAppServerSideQuestion(params, {
|
|
261
261
|
bindingStore: options.bindingStore,
|
|
262
262
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
@@ -267,25 +267,25 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
267
267
|
},
|
|
268
268
|
compact: async (params) => {
|
|
269
269
|
const admittedParams = requireCodexCompactionCapabilities(params);
|
|
270
|
-
const { maybeCompactCodexAppServerSession } = await import("./.setup/compact-
|
|
270
|
+
const { maybeCompactCodexAppServerSession } = await import("./.setup/compact-CeD2d2_k.mjs");
|
|
271
271
|
return maybeCompactCodexAppServerSession(admittedParams, {
|
|
272
272
|
bindingStore: options.bindingStore,
|
|
273
273
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
|
|
274
274
|
});
|
|
275
275
|
},
|
|
276
276
|
withSessionDeletion: async (params, run) => {
|
|
277
|
-
const { withCodexAppServerSessionDeletion } = await import("./.setup/session-retirement-
|
|
277
|
+
const { withCodexAppServerSessionDeletion } = await import("./.setup/session-retirement-BdHruV7q.mjs");
|
|
278
278
|
params.assertCurrent();
|
|
279
279
|
return withCodexAppServerSessionDeletion(options.bindingStore, params, run);
|
|
280
280
|
},
|
|
281
281
|
withSessionContextReset: async (params, run) => {
|
|
282
|
-
const { withCodexAppServerSessionContextReset } = await import("./.setup/session-retirement-
|
|
282
|
+
const { withCodexAppServerSessionContextReset } = await import("./.setup/session-retirement-BdHruV7q.mjs");
|
|
283
283
|
params.assertCurrent();
|
|
284
284
|
return withCodexAppServerSessionContextReset(options.bindingStore, params, run);
|
|
285
285
|
},
|
|
286
286
|
reset: async (params) => {
|
|
287
287
|
if (params.sessionId && params.reason !== "deleted") {
|
|
288
|
-
const [{ reclaimCurrentCodexSessionGeneration }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-_RE7vtVN.mjs").then((n) => n.a), import("./.setup/session-retirement-
|
|
288
|
+
const [{ reclaimCurrentCodexSessionGeneration }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-_RE7vtVN.mjs").then((n) => n.a), import("./.setup/session-retirement-BdHruV7q.mjs")]);
|
|
289
289
|
const identity = sessionBindingIdentity({
|
|
290
290
|
agentId: params.agentId,
|
|
291
291
|
sessionId: params.sessionId,
|
|
@@ -318,7 +318,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
318
318
|
function createCodexAppServerNativeCompaction(options) {
|
|
319
319
|
return async (params) => {
|
|
320
320
|
const admittedParams = requireCodexCompactionCapabilities(params);
|
|
321
|
-
const { maybeCompactCodexAppServerSession } = await import("./.setup/compact-
|
|
321
|
+
const { maybeCompactCodexAppServerSession } = await import("./.setup/compact-CeD2d2_k.mjs");
|
|
322
322
|
return maybeCompactCodexAppServerSession(admittedParams, {
|
|
323
323
|
bindingStore: options.bindingStore,
|
|
324
324
|
pluginConfig: options.resolvePluginConfig?.() ?? options.pluginConfig,
|