@openclaw/codex 2026.9.2 → 2026.9.4
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/README.md +2 -0
- package/dist/api.js +29 -26
- package/dist/apply-CvT8tW5i.js +356 -0
- package/dist/{attempt-client-cleanup-Bp1ZOnk2.js → attempt-client-cleanup-DKHzbwt5.js} +38 -214
- package/dist/{attempt-context-CSazkWns.js → attempt-context-D44yeDII.js} +9 -7
- package/dist/{event-projector-usage-ZqEVbAEY.js → attempt-notifications-C9XufG6l.js} +3 -106
- package/dist/{auth-binding-Ds_QVm-X.js → auth-binding-CWlKVccJ.js} +2 -2
- package/dist/auth-cache-key-7orQae_j.js +498 -0
- package/dist/auth-profile-CwzO4_RG.js +43 -0
- package/dist/auth-profile-selection-DFu9e167.js +45 -0
- package/dist/binding-connection-D3udKbIE.js +60 -0
- package/dist/{bounded-turn-DxGJRYbY.js → bounded-turn-C_Hneydj.js} +28 -125
- package/dist/build-state-BCmg9-5p.js +19 -0
- package/dist/{capabilities-B1mgvpP8.js → capabilities-8vx68WLH.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-B57KWPQx.js +4005 -0
- package/dist/command-dispatch-BpduNGVf.js +21 -0
- package/dist/{command-formatters-DSbGMXA0.js → command-formatters-lxlkNZgU.js} +4 -3
- package/dist/{command-handlers-DOJvGv6-.js → command-handlers-tiL9iWj7.js} +788 -135
- package/dist/command-rpc-CR5EOEZX.js +233 -0
- package/dist/{compact-Y_xBqrHN.js → compact-B_H3AOd7.js} +19 -14
- package/dist/config-oIORaQ5T.js +106 -0
- package/dist/{config-CyapYSji.js → config-options-CXMq1T-C.js} +205 -593
- package/dist/config-runtime-D0zGNIHu.js +11 -0
- package/dist/{config-utils-C57JiJrU.js → config-utils-DujwEnhg.js} +2 -4
- package/dist/conversation-binding-DsB4-O7U.js +900 -0
- package/dist/{plugin-marketplace-discovery-B7gHXJ3d.js → conversation-control-CtUu1b3m.js} +11 -143
- package/dist/doctor-contract-api.js +5 -5
- package/dist/{dynamic-tools-BwpvTxaX.js → dynamic-tools-CmN5RAip.js} +133 -76
- package/dist/{effective-mcp-catalog-CY9Jn4bA.js → effective-mcp-catalog-Bd73bqA8.js} +3 -3
- package/dist/{elicitation-input-DMkeki8d.js → elicitation-input-DPoK8F7w.js} +8 -22
- package/dist/ephemeral-turn-D78_VmzO.js +101 -0
- package/dist/{event-projector-assistant-message-B9kp6iGC.js → event-projector-assistant-message-BmBM4qBV.js} +12 -25
- package/dist/event-projector-items-5VhsECCO.js +200 -0
- package/dist/event-projector-usage-BfXmpOec.js +102 -0
- package/dist/{harness-Czh2Sdoc.js → harness-C7rRa7bm.js} +48 -24
- package/dist/harness.js +1 -1
- package/dist/history-rejection-B4nOXNXF.js +13 -0
- package/dist/incognito-session-uhrBF6wJ.js +15 -0
- package/dist/index.js +406 -2915
- package/dist/inference-context-Dr_mzvk4.js +94 -0
- package/dist/inference-proxy-HGXKUIre.js +311 -0
- package/dist/{isolated-completion-CRh-51AK.js → isolated-completion-DWVb5U2J.js} +7 -4
- package/dist/launch-args-RXQwn8zV.js +90 -0
- package/dist/{managed-binary-DcpnJF9x.js → managed-binary-D22rNEcR.js} +13 -103
- package/dist/managed-thread-store-D1t5jh3G.js +66 -0
- package/dist/media-understanding-provider.js +4 -1
- package/dist/migration-provider-api.js +2 -0
- package/dist/{model-catalog-DT5vo6qo.js → model-catalog-Dq2n8f_p.js} +6 -5
- package/dist/{models-CcrgSMQR.js → models-PCKOim-h.js} +3 -3
- package/dist/native-execution-policy-umd0tgh4.js +128 -0
- package/dist/native-subagent-history-DjtPloaU.js +140 -0
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +34 -0
- package/dist/{native-subagent-monitor-B3bvQGcg.js → native-subagent-monitor-fQ7eIXEf.js} +115 -460
- package/dist/native-subagent-task-ids-BzTdT0Uw.js +387 -0
- package/dist/node-cli-sessions-DKaOmVUh.js +527 -0
- package/dist/{node-exec-server.runtime-nfbUOtUB.js → node-exec-server.runtime-Cl2vapEi.js} +55 -24
- package/dist/plan-7uG-Fp36.js +947 -0
- package/dist/plugin-activation-BYQculil.js +138 -0
- package/dist/{thread-resume-BLgqkUc1.js → plugin-app-cache-key-d0eKxy7b.js} +4 -52
- package/dist/{plugin-approval-roundtrip-aQVdyL5g.js → plugin-approval-roundtrip-Bz3FT8W5.js} +1 -1
- package/dist/plugin-inventory-oL4Na1ZG.js +328 -0
- package/dist/plugin-marketplace-discovery-P-Vndfqq.js +137 -0
- package/dist/{plugin-metadata-cache-BwCLTY_U.js → plugin-metadata-cache-ClPJpRio.js} +17 -9
- package/dist/protocol-5bh1G-H7.js +275 -0
- package/dist/provider-MQ8PVkuE.js +50 -0
- package/dist/{provider-capabilities-BpG9Ltc5.js → provider-capabilities-BvCUL69A.js} +2 -2
- package/dist/{rate-limits-Fx_l4eNa.js → rate-limits-CBMmWBr9.js} +1 -1
- package/dist/request-B7hEkBGq.js +212 -0
- package/dist/rpc-error-ttN_QjEm.js +30 -0
- package/dist/{run-attempt-BzthFQSM.js → run-attempt-CvsAAGa0.js} +664 -377
- package/dist/{runtime-artifact-Bh_gf6-t.js → runtime-artifact-BJ0rXBZ_.js} +27 -27
- package/dist/sandbox-guard-BxgyoM8M.js +166 -0
- package/dist/{session-binding-4Ki04sW-.js → session-binding-CI8UuilT.js} +30 -48
- package/dist/{session-binding-record-CyaXZvTe.js → session-binding-record-Bcvslnhf.js} +12 -26
- package/dist/session-catalog-adoption-tcZi1IfX.js +251 -0
- package/dist/session-catalog-archive-CwKg8Xz2.js +56 -0
- package/dist/session-catalog-ct-AH01I.js +1477 -0
- package/dist/session-catalog-home-id-CwhLdC03.js +18 -0
- package/dist/session-catalog-node-adoption-B1tgDW-m.js +182 -0
- package/dist/session-catalog-node-continue-Ci-DXyJP.js +238 -0
- package/dist/session-catalog-provenance-D-dIfRAH.js +96 -0
- package/dist/{session-cli-BjLhpmS1.js → session-cli-DNN_jhGc.js} +3 -2
- package/dist/{session-history-DWmMqiqW.js → session-history-Cz-tOOYj.js} +6 -3
- package/dist/{session-upstream-marker-DReTpGz6.js → session-history-import-DwyijFI6.js} +5 -50
- package/dist/{session-history-read-LHldwvyh.js → session-history-read-cxPUxyVV.js} +21 -7
- package/dist/session-history-worker-runtime.js +18 -6
- package/dist/session-history.worker-BeK1YOyT.js +378 -0
- package/dist/session-history.worker.js +1 -1
- package/dist/{session-initialization-BCFVnLL4.js → session-initialization-Ct0_Hzmg.js} +2 -2
- package/dist/{session-permission-policy-BaueHmSj.js → session-permission-policy-BBmXA8Eg.js} +4 -7
- package/dist/{session-retirement-DNdmYdFc.js → session-retirement-B2YfbAAT.js} +6 -5
- package/dist/session-upstream-marker-D15C9NHp.js +46 -0
- package/dist/{settled-turn-context-BOM3Y1pl.js → settled-turn-context-Du6gdUDd.js} +9 -9
- package/dist/{settled-turn-finalizer-BI-b1sry.js → settled-turn-finalizer-Dn91stmc.js} +8 -7
- package/dist/shared-client-CscigXXL.js +3109 -0
- package/dist/{side-question-B6DWAw1A.js → side-question-BGMJQf4U.js} +65 -170
- package/dist/source-CElXU0Oy.js +518 -0
- package/dist/thread-archive-guard-DfpBr-Sz.js +53 -0
- package/dist/thread-history-page-D0JIp48V.js +361 -0
- package/dist/{thread-lifecycle-DPK30jad.js → thread-lifecycle-DXl1-I6b.js} +187 -639
- package/dist/{thread-ownership-CbucAmmp.js → thread-ownership-BsDRTsyp.js} +13 -15
- package/dist/thread-policy-BuEQfE0g.js +54 -0
- package/dist/thread-resume-DsDOZpFg.js +52 -0
- package/dist/timeout-BVw8aaM1.js +33 -0
- package/dist/transcript-history-projection-v17wXgdK.js +238 -0
- package/dist/{transcript-mirror-_njEB84z.js → transcript-mirror-C5CKgNy6.js} +50 -260
- package/dist/{transcript-mirror-attestation-Byl34PC-.js → transcript-mirror-attestation-DibE0krH.js} +17 -4
- package/dist/{transport-stdio-CzTngV0j.js → transport-stdio-BGjHoYLr.js} +73 -43
- package/dist/{upstream-session-fork-1fwbNKzQ.js → upstream-session-fork-BZerMte_.js} +27 -19
- package/dist/{usage-i9fv5-4m.js → usage-tCk-mg_x.js} +4 -3
- package/dist/version-omm6IPI3.js +12 -0
- package/dist/{web-search-provider.runtime-DKQn67A7.js → web-search-provider.runtime-B7bGbGWq.js} +3 -3
- package/openclaw.plugin.json +23 -1
- package/package.json +4 -4
- package/dist/request-C8H22rPi.js +0 -475
- package/dist/session-catalog-B47uwekb.js +0 -3272
- package/dist/session-history.worker-zZVcx0ME.js +0 -267
- package/dist/shared-client-CKhX2kFt.js +0 -7505
- package/dist/thread-policy-CTalhWFy.js +0 -105
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { o as isJsonObject } from "./protocol-5bh1G-H7.js";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
//#region extensions/codex/src/app-server/inference-context.ts
|
|
4
|
+
const MAX_CONTEXT_BYTES = 262144;
|
|
5
|
+
const MAX_ACTIVE_ROOTS = 64;
|
|
6
|
+
const CODEX_INFERENCE_GENERATION_KEY = "openclaw_inference_generation";
|
|
7
|
+
/** One physical inference transport owns these confidential, nonpersistent snapshots. */
|
|
8
|
+
function createCodexInferenceContext(assertClientCurrent) {
|
|
9
|
+
const roots = /* @__PURE__ */ new Map();
|
|
10
|
+
let closed = false;
|
|
11
|
+
const assertOpen = () => {
|
|
12
|
+
if (closed) throw new Error("Codex parent-local inference transport is closed");
|
|
13
|
+
assertClientCurrent();
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
register(params) {
|
|
17
|
+
assertOpen();
|
|
18
|
+
params.signal.throwIfAborted();
|
|
19
|
+
params.assertCurrent();
|
|
20
|
+
if (Buffer.byteLength(params.text) > MAX_CONTEXT_BYTES) throw new Error("Codex parent-local context exceeds the 256 KiB inference limit");
|
|
21
|
+
if (!roots.has(params.threadId) && roots.size >= MAX_ACTIVE_ROOTS) throw new Error("Codex parent-local inference root limit reached");
|
|
22
|
+
roots.get(params.threadId)?.release();
|
|
23
|
+
const controller = new AbortController();
|
|
24
|
+
const registration = {
|
|
25
|
+
generation: randomUUID(),
|
|
26
|
+
text: params.text,
|
|
27
|
+
controller,
|
|
28
|
+
assertCurrent: () => {
|
|
29
|
+
assertOpen();
|
|
30
|
+
controller.signal.throwIfAborted();
|
|
31
|
+
params.signal.throwIfAborted();
|
|
32
|
+
params.assertCurrent();
|
|
33
|
+
if (roots.get(params.threadId) !== registration) throw new Error("Codex parent-local inference generation was replaced");
|
|
34
|
+
},
|
|
35
|
+
release: () => {
|
|
36
|
+
if (roots.get(params.threadId) === registration) roots.delete(params.threadId);
|
|
37
|
+
registration.text = "";
|
|
38
|
+
controller.abort();
|
|
39
|
+
params.signal.removeEventListener("abort", registration.release);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
roots.set(params.threadId, registration);
|
|
43
|
+
params.signal.addEventListener("abort", registration.release, { once: true });
|
|
44
|
+
return {
|
|
45
|
+
generation: registration.generation,
|
|
46
|
+
release: registration.release
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
/** Caller must authenticate its private transport before parsing any model request. */
|
|
50
|
+
prepare(body) {
|
|
51
|
+
assertOpen();
|
|
52
|
+
const metadata = isJsonObject(body.client_metadata) ? body.client_metadata : void 0;
|
|
53
|
+
const raw = metadata?.["x-codex-turn-metadata"];
|
|
54
|
+
if (typeof raw !== "string" || Buffer.byteLength(raw) > 1048576) throw new Error("Codex inference request is missing bounded native metadata");
|
|
55
|
+
const value = JSON.parse(raw);
|
|
56
|
+
if (!isJsonObject(value)) throw new Error("Codex inference request has invalid native metadata");
|
|
57
|
+
const threadId = value.thread_id;
|
|
58
|
+
if (metadata?.thread_id != null && threadId != null && metadata.thread_id !== threadId) throw new Error("Codex inference thread metadata disagrees");
|
|
59
|
+
const child = Boolean(value.parent_thread_id || value.subagent_kind || metadata?.["x-openai-subagent"] || metadata?.["x-codex-parent-thread-id"]);
|
|
60
|
+
const kind = value.request_kind;
|
|
61
|
+
if (child || kind === "compaction" || kind === "memory") return {
|
|
62
|
+
body,
|
|
63
|
+
assertCurrent: assertOpen,
|
|
64
|
+
signal: void 0
|
|
65
|
+
};
|
|
66
|
+
if (kind !== "turn" && kind !== "prewarm") throw new Error("Codex inference request has an unsupported native purpose");
|
|
67
|
+
const registration = typeof threadId === "string" ? roots.get(threadId) : void 0;
|
|
68
|
+
const generation = value[CODEX_INFERENCE_GENERATION_KEY];
|
|
69
|
+
if (kind === "prewarm" && body.generate === false && generation == null) return {
|
|
70
|
+
body,
|
|
71
|
+
assertCurrent: assertOpen,
|
|
72
|
+
signal: void 0
|
|
73
|
+
};
|
|
74
|
+
if (!registration || generation !== registration.generation) throw new Error("Codex inference has no current admitted parent generation");
|
|
75
|
+
registration.assertCurrent();
|
|
76
|
+
const instructions = body.instructions;
|
|
77
|
+
if (instructions !== void 0 && typeof instructions !== "string") throw new Error("Codex inference request has invalid top-level instructions");
|
|
78
|
+
return {
|
|
79
|
+
body: registration.text ? {
|
|
80
|
+
...body,
|
|
81
|
+
instructions: instructions === void 0 ? registration.text : instructions + "\n\n" + registration.text
|
|
82
|
+
} : body,
|
|
83
|
+
assertCurrent: registration.assertCurrent,
|
|
84
|
+
signal: registration.controller.signal
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
close() {
|
|
88
|
+
closed = true;
|
|
89
|
+
for (const registration of roots.values()) registration.release();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { createCodexInferenceContext as n, CODEX_INFERENCE_GENERATION_KEY as t };
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { o as isJsonObject } from "./protocol-5bh1G-H7.js";
|
|
2
|
+
import { n as createCodexInferenceContext } from "./inference-context-Dr_mzvk4.js";
|
|
3
|
+
import { zstdCompress, zstdDecompress } from "node:zlib";
|
|
4
|
+
import { promisify } from "node:util";
|
|
5
|
+
import { Writable } from "node:stream";
|
|
6
|
+
import WebSocket, { WebSocketServer } from "ws";
|
|
7
|
+
import { createServer } from "node:http";
|
|
8
|
+
import { createNodeProxyAgent } from "openclaw/plugin-sdk/fetch-runtime";
|
|
9
|
+
import { generateSecureToken } from "openclaw/plugin-sdk/secure-random-runtime";
|
|
10
|
+
import { fetchWithSsrFGuard, isBlockedHostnameOrIp, resolvePinnedHostnameWithPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
11
|
+
//#region extensions/codex/src/app-server/inference-proxy.ts
|
|
12
|
+
const MAX_BODY_BYTES = 33554432;
|
|
13
|
+
const MAX_ERROR_BODY_BYTES = 1048576;
|
|
14
|
+
const MAX_CONNECTIONS = 16;
|
|
15
|
+
const compress = promisify(zstdCompress);
|
|
16
|
+
const decompress = promisify(zstdDecompress);
|
|
17
|
+
const HOP_HEADERS = /* @__PURE__ */ new Set([
|
|
18
|
+
"connection",
|
|
19
|
+
"keep-alive",
|
|
20
|
+
"proxy-authenticate",
|
|
21
|
+
"proxy-authorization",
|
|
22
|
+
"te",
|
|
23
|
+
"trailer",
|
|
24
|
+
"transfer-encoding",
|
|
25
|
+
"upgrade",
|
|
26
|
+
"host",
|
|
27
|
+
"content-length"
|
|
28
|
+
]);
|
|
29
|
+
const FAILURE = "Codex parent-local inference transport failed; retry on a fresh connection.";
|
|
30
|
+
/** Private, fixed-destination relay. No upstream credentials or model content are retained. */
|
|
31
|
+
async function createCodexInferenceProxy(params) {
|
|
32
|
+
const upstream = new URL(params.upstream);
|
|
33
|
+
if (upstream.protocol !== "https:" || upstream.username || upstream.password || upstream.hash) throw new Error("Codex inference requires a credential-free HTTPS upstream URL");
|
|
34
|
+
const lifetime = new AbortController();
|
|
35
|
+
const assertCurrent = () => {
|
|
36
|
+
lifetime.signal.throwIfAborted();
|
|
37
|
+
params.assertCurrent();
|
|
38
|
+
};
|
|
39
|
+
const context = createCodexInferenceContext(assertCurrent);
|
|
40
|
+
const pathPrefix = "/" + generateSecureToken({
|
|
41
|
+
bytes: 32,
|
|
42
|
+
redact: true
|
|
43
|
+
}) + upstream.pathname.replace(/\/$/, "");
|
|
44
|
+
const active = /* @__PURE__ */ new Set();
|
|
45
|
+
const sockets = /* @__PURE__ */ new Set();
|
|
46
|
+
const wss = new WebSocketServer({
|
|
47
|
+
noServer: true,
|
|
48
|
+
maxPayload: MAX_BODY_BYTES,
|
|
49
|
+
perMessageDeflate: false
|
|
50
|
+
});
|
|
51
|
+
const handshakeHeaders = /* @__PURE__ */ new WeakMap();
|
|
52
|
+
wss.on("headers", (headers, request) => {
|
|
53
|
+
for (const [key, value] of Object.entries(handshakeHeaders.get(request) ?? {})) if (!key.startsWith("sec-websocket-")) headers.push(key + ": " + value);
|
|
54
|
+
handshakeHeaders.delete(request);
|
|
55
|
+
});
|
|
56
|
+
const resolveTarget = (request) => {
|
|
57
|
+
assertCurrent();
|
|
58
|
+
if (request.headers.origin || !request.url?.startsWith(pathPrefix + "/") || isBlockedHostnameOrIp(upstream.hostname)) throw new Error(FAILURE);
|
|
59
|
+
const suffix = request.url.slice(pathPrefix.length);
|
|
60
|
+
if (suffix.startsWith("//") || suffix.includes("\\") || /%2e|%2f|%5c|(?:^|\/)\.\.?(?:\/|\?|$)/i.test(suffix)) throw new Error(FAILURE);
|
|
61
|
+
const target = new URL(upstream);
|
|
62
|
+
const incoming = new URL(suffix, "http://localhost");
|
|
63
|
+
target.pathname = upstream.pathname.replace(/\/$/, "") + incoming.pathname;
|
|
64
|
+
for (const [key, value] of incoming.searchParams) target.searchParams.append(key, value);
|
|
65
|
+
return {
|
|
66
|
+
target,
|
|
67
|
+
sampling: incoming.pathname === "/responses"
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
const prepare = (bytes, sampling) => {
|
|
71
|
+
assertCurrent();
|
|
72
|
+
if (!sampling) return {
|
|
73
|
+
bytes,
|
|
74
|
+
assertCurrent,
|
|
75
|
+
signal: void 0
|
|
76
|
+
};
|
|
77
|
+
const value = JSON.parse(bytes.toString("utf8"));
|
|
78
|
+
if (!isJsonObject(value)) throw new Error(FAILURE);
|
|
79
|
+
const prepared = context.prepare(value);
|
|
80
|
+
const rewritten = Buffer.from(JSON.stringify(prepared.body));
|
|
81
|
+
if (rewritten.length > MAX_BODY_BYTES) throw new Error(FAILURE);
|
|
82
|
+
return {
|
|
83
|
+
...prepared,
|
|
84
|
+
bytes: rewritten
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const server = createServer((req, res) => {
|
|
88
|
+
const controller = new AbortController();
|
|
89
|
+
let guarded;
|
|
90
|
+
const abort = () => controller.abort();
|
|
91
|
+
req.once("aborted", abort);
|
|
92
|
+
res.once("close", abort);
|
|
93
|
+
(async () => {
|
|
94
|
+
try {
|
|
95
|
+
const { target, sampling } = resolveTarget(req);
|
|
96
|
+
if (req.method !== "POST" || active.size >= MAX_CONNECTIONS) throw new Error(FAILURE);
|
|
97
|
+
active.add(controller);
|
|
98
|
+
const wire = await readProxyBody(req, MAX_BODY_BYTES);
|
|
99
|
+
const encoding = req.headers["content-encoding"];
|
|
100
|
+
if (encoding && encoding !== "identity" && encoding !== "zstd") throw new Error(FAILURE);
|
|
101
|
+
const decoded = encoding === "zstd" ? await decompress(wire, { maxOutputLength: MAX_BODY_BYTES }) : wire;
|
|
102
|
+
assertCurrent();
|
|
103
|
+
const prepared = prepare(decoded, sampling);
|
|
104
|
+
const body = Buffer.from(encoding === "zstd" ? await compress(prepared.bytes) : prepared.bytes);
|
|
105
|
+
prepared.assertCurrent();
|
|
106
|
+
const signal = AbortSignal.any([
|
|
107
|
+
lifetime.signal,
|
|
108
|
+
controller.signal,
|
|
109
|
+
...prepared.signal ? [prepared.signal] : []
|
|
110
|
+
]);
|
|
111
|
+
guarded = await fetchWithSsrFGuard({
|
|
112
|
+
url: target.toString(),
|
|
113
|
+
init: {
|
|
114
|
+
method: "POST",
|
|
115
|
+
headers: relayHeaders(req.headers),
|
|
116
|
+
body,
|
|
117
|
+
signal
|
|
118
|
+
},
|
|
119
|
+
signal,
|
|
120
|
+
beforeRequest: prepared.assertCurrent,
|
|
121
|
+
requireHttps: true,
|
|
122
|
+
maxRedirects: 0,
|
|
123
|
+
capture: false,
|
|
124
|
+
mode: "trusted_env_proxy",
|
|
125
|
+
auditContext: "codex-parent-local-inference"
|
|
126
|
+
});
|
|
127
|
+
prepared.assertCurrent();
|
|
128
|
+
const headers = Object.fromEntries(guarded.response.headers);
|
|
129
|
+
delete headers["content-encoding"];
|
|
130
|
+
res.writeHead(guarded.response.status, relayHeaders(headers));
|
|
131
|
+
if (!guarded.response.body) res.end();
|
|
132
|
+
else await guarded.response.body.pipeTo(Writable.toWeb(res), { signal });
|
|
133
|
+
} catch {
|
|
134
|
+
if (!res.headersSent && !res.destroyed) res.writeHead(502, { "content-type": "text/plain" }).end(FAILURE);
|
|
135
|
+
else res.destroy();
|
|
136
|
+
} finally {
|
|
137
|
+
active.delete(controller);
|
|
138
|
+
req.off("aborted", abort);
|
|
139
|
+
res.off("close", abort);
|
|
140
|
+
await guarded?.release().catch(() => void 0);
|
|
141
|
+
}
|
|
142
|
+
})();
|
|
143
|
+
});
|
|
144
|
+
server.maxConnections = MAX_CONNECTIONS;
|
|
145
|
+
server.requestTimeout = 3e4;
|
|
146
|
+
server.headersTimeout = 1e4;
|
|
147
|
+
server.on("upgrade", (req, socket, head) => {
|
|
148
|
+
(async () => {
|
|
149
|
+
let remote;
|
|
150
|
+
let local;
|
|
151
|
+
let proxyAgent;
|
|
152
|
+
const controller = new AbortController();
|
|
153
|
+
const close = () => {
|
|
154
|
+
controller.abort();
|
|
155
|
+
active.delete(controller);
|
|
156
|
+
remote?.terminate();
|
|
157
|
+
local?.terminate();
|
|
158
|
+
proxyAgent?.destroy();
|
|
159
|
+
if (remote) sockets.delete(remote);
|
|
160
|
+
if (local) sockets.delete(local);
|
|
161
|
+
socket.destroy();
|
|
162
|
+
};
|
|
163
|
+
try {
|
|
164
|
+
const { target, sampling } = resolveTarget(req);
|
|
165
|
+
if (!sampling || active.size >= MAX_CONNECTIONS) throw new Error(FAILURE);
|
|
166
|
+
active.add(controller);
|
|
167
|
+
socket.once("close", close);
|
|
168
|
+
socket.once("error", close);
|
|
169
|
+
const signal = AbortSignal.any([lifetime.signal, controller.signal]);
|
|
170
|
+
proxyAgent = createNodeProxyAgent({
|
|
171
|
+
mode: "env",
|
|
172
|
+
targetUrl: target.href
|
|
173
|
+
});
|
|
174
|
+
const lookup = proxyAgent ? void 0 : (await resolvePinnedHostnameWithPolicy(target.hostname, { signal })).lookup;
|
|
175
|
+
assertCurrent();
|
|
176
|
+
signal.throwIfAborted();
|
|
177
|
+
target.protocol = "wss:";
|
|
178
|
+
const headers = relayHeaders(req.headers);
|
|
179
|
+
for (const key of Object.keys(headers)) if (key.startsWith("sec-websocket-")) delete headers[key];
|
|
180
|
+
remote = new WebSocket(target, {
|
|
181
|
+
headers,
|
|
182
|
+
...proxyAgent ? { agent: proxyAgent } : { lookup },
|
|
183
|
+
followRedirects: false,
|
|
184
|
+
perMessageDeflate: false,
|
|
185
|
+
maxPayload: MAX_BODY_BYTES,
|
|
186
|
+
handshakeTimeout: 1e4
|
|
187
|
+
});
|
|
188
|
+
sockets.add(remote);
|
|
189
|
+
remote.once("upgrade", (response) => {
|
|
190
|
+
handshakeHeaders.set(req, relayHeaders(response.headers));
|
|
191
|
+
});
|
|
192
|
+
remote.once("error", close);
|
|
193
|
+
remote.once("close", close);
|
|
194
|
+
remote.once("unexpected-response", (_request, response) => {
|
|
195
|
+
(async () => {
|
|
196
|
+
try {
|
|
197
|
+
const body = await readProxyBody(response, MAX_ERROR_BODY_BYTES);
|
|
198
|
+
assertCurrent();
|
|
199
|
+
signal.throwIfAborted();
|
|
200
|
+
const failureHeaders = Object.entries(relayHeaders(response.headers)).map(([key, value]) => key + ": " + value);
|
|
201
|
+
failureHeaders.push("Connection: close", "Content-Length: " + body.length);
|
|
202
|
+
const status = "HTTP/1.1 " + response.statusCode + " " + (response.statusMessage ?? "Upstream refused");
|
|
203
|
+
socket.end(Buffer.concat([Buffer.from(status + "\r\n" + failureHeaders.join("\r\n") + "\r\n\r\n"), body]), close);
|
|
204
|
+
} catch {
|
|
205
|
+
close();
|
|
206
|
+
}
|
|
207
|
+
})();
|
|
208
|
+
});
|
|
209
|
+
remote.once("open", () => {
|
|
210
|
+
try {
|
|
211
|
+
assertCurrent();
|
|
212
|
+
signal.throwIfAborted();
|
|
213
|
+
wss.handleUpgrade(req, socket, head, (accepted) => {
|
|
214
|
+
local = accepted;
|
|
215
|
+
sockets.add(accepted);
|
|
216
|
+
accepted.once("error", close);
|
|
217
|
+
accepted.once("close", close);
|
|
218
|
+
let releaseFrame = () => {};
|
|
219
|
+
accepted.on("message", (data, binary) => {
|
|
220
|
+
try {
|
|
221
|
+
if (binary) throw new Error(FAILURE);
|
|
222
|
+
const prepared = prepare(rawBytes(data), true);
|
|
223
|
+
prepared.assertCurrent();
|
|
224
|
+
releaseFrame();
|
|
225
|
+
const onAbort = () => close();
|
|
226
|
+
prepared.signal?.addEventListener("abort", onAbort, { once: true });
|
|
227
|
+
releaseFrame = () => prepared.signal?.removeEventListener("abort", onAbort);
|
|
228
|
+
if (!remote || remote.readyState !== WebSocket.OPEN || remote.bufferedAmount + prepared.bytes.length > MAX_BODY_BYTES) throw new Error(FAILURE);
|
|
229
|
+
remote.send(prepared.bytes, { binary: false }, (error) => {
|
|
230
|
+
if (error) close();
|
|
231
|
+
});
|
|
232
|
+
} catch {
|
|
233
|
+
close();
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
accepted.once("close", () => releaseFrame());
|
|
237
|
+
remote.on("message", (data, binary) => {
|
|
238
|
+
if (accepted.readyState !== WebSocket.OPEN || accepted.bufferedAmount + rawBytes(data).length > MAX_BODY_BYTES) {
|
|
239
|
+
close();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
accepted.send(data, { binary }, (error) => {
|
|
243
|
+
if (error) close();
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
} catch {
|
|
248
|
+
close();
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
} catch {
|
|
252
|
+
close();
|
|
253
|
+
}
|
|
254
|
+
})();
|
|
255
|
+
});
|
|
256
|
+
const close = () => {
|
|
257
|
+
lifetime.abort();
|
|
258
|
+
context.close();
|
|
259
|
+
for (const controller of active) controller.abort();
|
|
260
|
+
for (const socket of sockets) socket.terminate();
|
|
261
|
+
server.close();
|
|
262
|
+
server.closeAllConnections();
|
|
263
|
+
wss.close();
|
|
264
|
+
};
|
|
265
|
+
try {
|
|
266
|
+
await new Promise((resolve, reject) => {
|
|
267
|
+
server.once("error", reject);
|
|
268
|
+
server.listen(0, "127.0.0.1", () => {
|
|
269
|
+
server.off("error", reject);
|
|
270
|
+
resolve();
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
assertCurrent();
|
|
274
|
+
server.on("error", close);
|
|
275
|
+
const address = server.address();
|
|
276
|
+
if (!address || typeof address === "string") throw new Error(FAILURE);
|
|
277
|
+
return {
|
|
278
|
+
context,
|
|
279
|
+
upstream: upstream.toString(),
|
|
280
|
+
baseUrl: "http://127.0.0.1:" + address.port + pathPrefix,
|
|
281
|
+
assertCurrent,
|
|
282
|
+
close
|
|
283
|
+
};
|
|
284
|
+
} catch (error) {
|
|
285
|
+
close();
|
|
286
|
+
throw error;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
async function readProxyBody(stream, maxBytes) {
|
|
290
|
+
const chunks = [];
|
|
291
|
+
let size = 0;
|
|
292
|
+
for await (const chunk of stream) {
|
|
293
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
294
|
+
size += bytes.length;
|
|
295
|
+
if (size > maxBytes) throw new Error(FAILURE);
|
|
296
|
+
chunks.push(bytes);
|
|
297
|
+
}
|
|
298
|
+
return Buffer.concat(chunks);
|
|
299
|
+
}
|
|
300
|
+
function rawBytes(data) {
|
|
301
|
+
return Array.isArray(data) ? Buffer.concat(data) : Buffer.isBuffer(data) ? data : Buffer.from(data);
|
|
302
|
+
}
|
|
303
|
+
function relayHeaders(input) {
|
|
304
|
+
const excluded = new Set(HOP_HEADERS);
|
|
305
|
+
for (const token of (input.connection ?? "").split(",")) excluded.add(token.trim().toLowerCase());
|
|
306
|
+
const output = {};
|
|
307
|
+
for (const [key, value] of Object.entries(input)) if (value !== void 0 && !excluded.has(key.toLowerCase())) output[key.toLowerCase()] = Array.isArray(value) ? value.join(", ") : value;
|
|
308
|
+
return output;
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
export { createCodexInferenceProxy };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { i as resolveCodexAppServerHomeScope } from "./config-options-CXMq1T-C.js";
|
|
2
|
+
import { x as readCodexPluginConfig } from "./protocol-5bh1G-H7.js";
|
|
3
|
+
import { g as assertCodexPassiveTurnItems } from "./client-B57KWPQx.js";
|
|
4
|
+
import "./config-oIORaQ5T.js";
|
|
5
|
+
import { tt as resolveCodexAppServerPreparedAuthHandoff } from "./shared-client-CscigXXL.js";
|
|
6
|
+
import { runBoundedCodexAppServerTurn } from "./bounded-turn-C_Hneydj.js";
|
|
7
|
+
import { a as createAttributedCodexAssistantMessage } from "./event-projector-assistant-message-BmBM4qBV.js";
|
|
5
8
|
//#region extensions/codex/src/app-server/isolated-completion.ts
|
|
6
9
|
/** Runs prompt-only Codex inference on an ephemeral, ring-zero native thread. */
|
|
7
10
|
async function runCodexIsolatedCompletion(params, options) {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/launch-args.ts
|
|
2
|
+
const CODEX_VALUE_OPTIONS = /* @__PURE__ */ new Set([
|
|
3
|
+
"-m",
|
|
4
|
+
"--model",
|
|
5
|
+
"--local-provider",
|
|
6
|
+
"-p",
|
|
7
|
+
"--profile",
|
|
8
|
+
"-s",
|
|
9
|
+
"--sandbox",
|
|
10
|
+
"-a",
|
|
11
|
+
"--ask-for-approval",
|
|
12
|
+
"-C",
|
|
13
|
+
"--cd",
|
|
14
|
+
"--add-dir",
|
|
15
|
+
"--remote",
|
|
16
|
+
"--remote-auth-token-env",
|
|
17
|
+
"-c",
|
|
18
|
+
"--config",
|
|
19
|
+
"--enable",
|
|
20
|
+
"--disable",
|
|
21
|
+
"--listen",
|
|
22
|
+
"--code-mode-host",
|
|
23
|
+
"--ws-auth",
|
|
24
|
+
"--ws-token-file",
|
|
25
|
+
"--ws-token-sha256",
|
|
26
|
+
"--ws-shared-secret-file",
|
|
27
|
+
"--ws-issuer",
|
|
28
|
+
"--ws-audience",
|
|
29
|
+
"--ws-max-clock-skew-seconds"
|
|
30
|
+
]);
|
|
31
|
+
/** One tokenization owner for launch, turn policy, reviewer trust, and private turns. */
|
|
32
|
+
function readCodexArgs(args) {
|
|
33
|
+
const tokens = [];
|
|
34
|
+
let nativeSubcommand = false;
|
|
35
|
+
let end = 0;
|
|
36
|
+
for (const [index, arg] of args.entries()) {
|
|
37
|
+
if (index < end) continue;
|
|
38
|
+
end = index + 1;
|
|
39
|
+
const attached = /^(--[^=]+)=([\s\S]*)$/u.exec(arg) ?? /^(-[cmpisaC])=?([\s\S]+)$/u.exec(arg);
|
|
40
|
+
const name = attached?.[1] ?? arg;
|
|
41
|
+
let value = attached?.[2];
|
|
42
|
+
if (name === "-i" || name === "--image") while (args[end]?.startsWith("-") === false) end += 1;
|
|
43
|
+
else if (!attached && CODEX_VALUE_OPTIONS.has(name)) {
|
|
44
|
+
value = args[end];
|
|
45
|
+
if (value !== void 0) end += 1;
|
|
46
|
+
}
|
|
47
|
+
tokens.push({
|
|
48
|
+
index,
|
|
49
|
+
end,
|
|
50
|
+
name,
|
|
51
|
+
value
|
|
52
|
+
});
|
|
53
|
+
if (name === "app-server") nativeSubcommand = true;
|
|
54
|
+
if (name === "--" && nativeSubcommand) break;
|
|
55
|
+
}
|
|
56
|
+
return tokens;
|
|
57
|
+
}
|
|
58
|
+
function readCodexAppServerConfigOptions(args) {
|
|
59
|
+
return readCodexArgs(args).filter(({ name }) => name === "-c" || name === "--config" || name === "-p" || name === "--profile");
|
|
60
|
+
}
|
|
61
|
+
/** The stdio proxy forwards to an external server; it does not own that runtime. */
|
|
62
|
+
function isCodexAppServerProxyLaunch(args) {
|
|
63
|
+
const tokens = readCodexArgs(args);
|
|
64
|
+
const server = tokens.findLastIndex(({ name }) => name === "app-server");
|
|
65
|
+
return server >= 0 && tokens.slice(server + 1).find(({ name }) => !name.startsWith("-"))?.name === "proxy";
|
|
66
|
+
}
|
|
67
|
+
/** Keeps Codex overrides in one CLI scope without rewriting raw TOML or wrapper prefixes. */
|
|
68
|
+
function normalizeCodexAppServerArgs(rawArgs, enforcedOverride) {
|
|
69
|
+
const tokens = readCodexArgs(rawArgs);
|
|
70
|
+
const subcommandIndex = tokens.findLast(({ name }) => name === "app-server")?.index ?? -1;
|
|
71
|
+
const prefix = subcommandIndex < 0 ? [...rawArgs] : rawArgs.slice(0, subcommandIndex);
|
|
72
|
+
const suffix = [];
|
|
73
|
+
if (subcommandIndex >= 0) for (const token of tokens) {
|
|
74
|
+
if (token.index <= subcommandIndex) continue;
|
|
75
|
+
if (token.name === "--") {
|
|
76
|
+
suffix.push(...rawArgs.slice(token.index));
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
(token.name === "-c" || token.name === "--config" ? prefix : suffix).push(...rawArgs.slice(token.index, token.end));
|
|
80
|
+
}
|
|
81
|
+
if (enforcedOverride && !(prefix.at(-2) === "-c" && prefix.at(-1) === enforcedOverride)) prefix.push("-c", enforcedOverride);
|
|
82
|
+
const normalized = subcommandIndex < 0 ? prefix : [
|
|
83
|
+
...prefix,
|
|
84
|
+
"app-server",
|
|
85
|
+
...suffix
|
|
86
|
+
];
|
|
87
|
+
return normalized.length === rawArgs.length && normalized.every((arg, index) => arg === rawArgs[index]) ? rawArgs : normalized;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { normalizeCodexAppServerArgs as n, readCodexAppServerConfigOptions as r, isCodexAppServerProxyLaunch as t };
|
|
@@ -1,98 +1,11 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
+
import { n as MANAGED_CODEX_APP_SERVER_PACKAGE } from "./version-omm6IPI3.js";
|
|
1
3
|
import { createRequire } from "node:module";
|
|
2
|
-
import { access } from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
4
|
import { constants, existsSync, realpathSync } from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { access } from "node:fs/promises";
|
|
5
7
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
6
8
|
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
7
|
-
//#region extensions/codex/src/app-server/launch-args.ts
|
|
8
|
-
const CODEX_VALUE_OPTIONS = /* @__PURE__ */ new Set([
|
|
9
|
-
"-m",
|
|
10
|
-
"--model",
|
|
11
|
-
"--local-provider",
|
|
12
|
-
"-p",
|
|
13
|
-
"--profile",
|
|
14
|
-
"-s",
|
|
15
|
-
"--sandbox",
|
|
16
|
-
"-a",
|
|
17
|
-
"--ask-for-approval",
|
|
18
|
-
"-C",
|
|
19
|
-
"--cd",
|
|
20
|
-
"--add-dir",
|
|
21
|
-
"--remote",
|
|
22
|
-
"--remote-auth-token-env",
|
|
23
|
-
"-c",
|
|
24
|
-
"--config",
|
|
25
|
-
"--enable",
|
|
26
|
-
"--disable",
|
|
27
|
-
"--listen",
|
|
28
|
-
"--code-mode-host",
|
|
29
|
-
"--ws-auth",
|
|
30
|
-
"--ws-token-file",
|
|
31
|
-
"--ws-token-sha256",
|
|
32
|
-
"--ws-shared-secret-file",
|
|
33
|
-
"--ws-issuer",
|
|
34
|
-
"--ws-audience",
|
|
35
|
-
"--ws-max-clock-skew-seconds"
|
|
36
|
-
]);
|
|
37
|
-
/** One tokenization owner for launch, turn policy, reviewer trust, and private turns. */
|
|
38
|
-
function readCodexArgs(args) {
|
|
39
|
-
const tokens = [];
|
|
40
|
-
let nativeSubcommand = false;
|
|
41
|
-
let end = 0;
|
|
42
|
-
for (const [index, arg] of args.entries()) {
|
|
43
|
-
if (index < end) continue;
|
|
44
|
-
end = index + 1;
|
|
45
|
-
const attached = /^(--[^=]+)=([\s\S]*)$/u.exec(arg) ?? /^(-[cmpisaC])=?([\s\S]+)$/u.exec(arg);
|
|
46
|
-
const name = attached?.[1] ?? arg;
|
|
47
|
-
let value = attached?.[2];
|
|
48
|
-
if (name === "-i" || name === "--image") while (args[end]?.startsWith("-") === false) end += 1;
|
|
49
|
-
else if (!attached && CODEX_VALUE_OPTIONS.has(name)) {
|
|
50
|
-
value = args[end];
|
|
51
|
-
if (value !== void 0) end += 1;
|
|
52
|
-
}
|
|
53
|
-
tokens.push({
|
|
54
|
-
index,
|
|
55
|
-
end,
|
|
56
|
-
name,
|
|
57
|
-
value
|
|
58
|
-
});
|
|
59
|
-
if (name === "app-server") nativeSubcommand = true;
|
|
60
|
-
if (name === "--" && nativeSubcommand) break;
|
|
61
|
-
}
|
|
62
|
-
return tokens;
|
|
63
|
-
}
|
|
64
|
-
function readCodexAppServerConfigOptions(args) {
|
|
65
|
-
return readCodexArgs(args).filter(({ name }) => name === "-c" || name === "--config" || name === "-p" || name === "--profile");
|
|
66
|
-
}
|
|
67
|
-
/** The stdio proxy forwards to an external server; it does not own that runtime. */
|
|
68
|
-
function isCodexAppServerProxyLaunch(args) {
|
|
69
|
-
const tokens = readCodexArgs(args);
|
|
70
|
-
const server = tokens.findLastIndex(({ name }) => name === "app-server");
|
|
71
|
-
return server >= 0 && tokens.slice(server + 1).find(({ name }) => !name.startsWith("-"))?.name === "proxy";
|
|
72
|
-
}
|
|
73
|
-
/** Keeps Codex overrides in one CLI scope without rewriting raw TOML or wrapper prefixes. */
|
|
74
|
-
function normalizeCodexAppServerArgs(rawArgs, enforcedOverride) {
|
|
75
|
-
const tokens = readCodexArgs(rawArgs);
|
|
76
|
-
const subcommandIndex = tokens.findLast(({ name }) => name === "app-server")?.index ?? -1;
|
|
77
|
-
const prefix = subcommandIndex < 0 ? [...rawArgs] : rawArgs.slice(0, subcommandIndex);
|
|
78
|
-
const suffix = [];
|
|
79
|
-
if (subcommandIndex >= 0) for (const token of tokens) {
|
|
80
|
-
if (token.index <= subcommandIndex) continue;
|
|
81
|
-
if (token.name === "--") {
|
|
82
|
-
suffix.push(...rawArgs.slice(token.index));
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
(token.name === "-c" || token.name === "--config" ? prefix : suffix).push(...rawArgs.slice(token.index, token.end));
|
|
86
|
-
}
|
|
87
|
-
if (enforcedOverride && !(prefix.at(-2) === "-c" && prefix.at(-1) === enforcedOverride)) prefix.push("-c", enforcedOverride);
|
|
88
|
-
const normalized = subcommandIndex < 0 ? prefix : [
|
|
89
|
-
...prefix,
|
|
90
|
-
"app-server",
|
|
91
|
-
...suffix
|
|
92
|
-
];
|
|
93
|
-
return normalized.length === rawArgs.length && normalized.every((arg, index) => arg === rawArgs[index]) ? rawArgs : normalized;
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
9
|
//#region extensions/codex/src/app-server/desktop-app-paths.ts
|
|
97
10
|
/** Shared path candidates for Codex's macOS desktop app bundle. */
|
|
98
11
|
const MACOS_DESKTOP_CODEX_APP_PATH_CANDIDATES = [{
|
|
@@ -130,22 +43,19 @@ function resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath(params = {}
|
|
|
130
43
|
return candidates.find((candidate) => pathExists(candidate));
|
|
131
44
|
}
|
|
132
45
|
//#endregion
|
|
133
|
-
//#region extensions/codex/src/app-server/version.ts
|
|
134
|
-
/**
|
|
135
|
-
* Version and package pins for the managed Codex app-server runtime.
|
|
136
|
-
*/
|
|
137
|
-
/** Exact Codex app-server version shipped by the OpenClaw Codex bridge. */
|
|
138
|
-
const CODEX_APP_SERVER_VERSION = "0.153.4";
|
|
139
|
-
/** Inclusive runtime compatibility floor for external app-server binaries. */
|
|
140
|
-
const MIN_SUPPORTED_CODEX_APP_SERVER_VERSION = "0.149.0";
|
|
141
|
-
/** npm package name for the managed Codex app-server binary. */
|
|
142
|
-
const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
|
|
143
|
-
//#endregion
|
|
144
46
|
//#region extensions/codex/src/app-server/managed-binary.ts
|
|
145
47
|
/**
|
|
146
48
|
* Resolves the managed Codex app-server binary shipped with or installed beside
|
|
147
49
|
* the Codex plugin before stdio startup.
|
|
148
50
|
*/
|
|
51
|
+
var managed_binary_exports = /* @__PURE__ */ __exportAll({
|
|
52
|
+
isManagedCodexDesktopCommand: () => isManagedCodexDesktopCommand,
|
|
53
|
+
resolveManagedCodexAppServerStartOptions: () => resolveManagedCodexAppServerStartOptions,
|
|
54
|
+
resolveManagedCodexNativeCommand: () => resolveManagedCodexNativeCommand,
|
|
55
|
+
resolveManagedCodexPackageEntrypoint: () => resolveManagedCodexPackageEntrypoint,
|
|
56
|
+
resolvePackagedCodexNativeCommand: () => resolvePackagedCodexNativeCommand,
|
|
57
|
+
setManagedCodexPluginRoot: () => setManagedCodexPluginRoot
|
|
58
|
+
});
|
|
149
59
|
const registeredCodexPlugin = resolveGlobalSingleton(Symbol.for("openclaw.codexManagedPluginRoot"), () => ({}));
|
|
150
60
|
/** Records the process-stable plugin root prepared by OpenClaw's plugin loader. */
|
|
151
61
|
function setManagedCodexPluginRoot(pluginRoot) {
|
|
@@ -282,4 +192,4 @@ async function commandPathExists(filePath, platform) {
|
|
|
282
192
|
}
|
|
283
193
|
}
|
|
284
194
|
//#endregion
|
|
285
|
-
export {
|
|
195
|
+
export { resolvePackagedCodexNativeCommand as a, resolveMacOSDesktopCodexAppPathCandidates as c, resolveManagedCodexNativeCommand as i, resolveMacOSDesktopCodexBundledMarketplaceCandidates as l, managed_binary_exports as n, setManagedCodexPluginRoot as o, resolveManagedCodexAppServerStartOptions as r, resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath as s, isManagedCodexDesktopCommand as t, resolveMacOSDesktopCodexComputerUseServiceAppCandidates as u };
|