@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.
- package/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-Eem_WGqY.mjs} +5 -5
- package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-DDOi8uNx.mjs} +22 -28
- package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-CEv1cKwF.mjs} +58 -43
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-B2mpaI9D.mjs} +9 -81
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/{binding-connection-Bm38niE8.mjs → binding-connection-ThoatDcb.mjs} +1 -1
- package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-yoHrABt-.mjs} +4 -4
- package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-B2HScEgT.mjs} +138 -32
- package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-C7EnDVgr.mjs} +1 -1
- package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/.setup/{client-vXs2929Q.mjs → client-Cs08OXVQ.mjs} +583 -559
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-DW7Lx9oH.mjs} +106 -172
- package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-DixIj3HW.mjs} +36 -21
- package/dist/.setup/{compact-C3i3qlzj.mjs → compact-Du5UvtxA.mjs} +14 -21
- package/dist/.setup/{config-CedDWjM-.mjs → config-BoTP_mrL.mjs} +3 -3
- package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-BvaRs51b.mjs} +46 -30
- package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C8Rw1m1m.mjs} +1 -1
- package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-BEReZ6go.mjs} +35 -120
- package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-DP-gMrBP.mjs} +21 -32
- package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-uK9Jomlc.mjs} +28 -67
- package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-BDXl-8Cw.mjs} +848 -578
- package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-poidXgek.mjs} +9 -6
- package/dist/.setup/{event-projector-assistant-message-DNUR1s0A.mjs → event-projector-assistant-message-BsruvNrH.mjs} +2 -4
- package/dist/.setup/{event-projector-items-DyTQ_XqL.mjs → event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-CnBS8Wa3.mjs} +1 -1
- package/dist/.setup/{harness-rxaaoN-o.mjs → harness-a_MsE4-_.mjs} +23 -17
- package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-BIZFhTNG.mjs} +17 -10
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-BnshlFag.mjs} +13 -2
- package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-CfXJf9Ay.mjs} +9 -10
- package/dist/.setup/{models-BDFgm_G-.mjs → models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-rWbGbMn3.mjs} +4 -4
- package/dist/.setup/{native-subagent-history-YXaL6dMd.mjs → native-subagent-history-0nYYgo0k.mjs} +26 -13
- package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-D3filLY2.mjs} +145 -317
- package/dist/.setup/{native-subagent-task-ids-DsuOonKv.mjs → native-subagent-task-ids-wb8CKZGN.mjs} +69 -39
- package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/.setup/{plan-xD7WKYTM.mjs → plan-CN3VwfNU.mjs} +74 -76
- package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-B2CsSdnV.mjs} +4 -20
- package/dist/.setup/{plugin-approval-roundtrip-CjfzafAZ.mjs → plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-BoRei8Z4.mjs} +16 -7
- package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-Ctmo83k_.mjs} +224 -154
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/.setup/{provider-fFh_-VR3.mjs → provider-BOsxQHOM.mjs} +9 -5
- package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-CMU3DUD0.mjs} +116 -137
- package/dist/.setup/{request-BioXJLYa.mjs → request-D2L0zMrq.mjs} +23 -15
- package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-BHu11r7h.mjs} +1197 -617
- package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/.setup/{sandbox-guard-BBP-RbTf.mjs → sandbox-guard-C2sRMOEY.mjs} +1 -1
- package/dist/.setup/{session-binding-_0W_fHRr.mjs → session-binding-Cm0apEbd.mjs} +3 -32
- package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-BGoz8wOK.mjs} +22 -3
- package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-BlB5EvIS.mjs} +48 -45
- package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-Pno1xGcl.mjs} +482 -182
- package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BI6UTDZT.mjs} +57 -25
- package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-jMcYfQyd.mjs → session-catalog-events-Bj6j94E_.mjs} +122 -25
- package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-B9_VQIUz.mjs} +178 -78
- package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-hcdz07yN.mjs} +2 -2
- package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-Dgh8ORJm.mjs} +5 -2
- package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-native-projection-DowriLid.mjs} +30 -13
- package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-ITddWx_X.mjs} +24 -12
- package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-6g6qi4A9.mjs} +22 -13
- package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-zK_PUsiE.mjs} +13 -5
- package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-irrD-uo7.mjs} +4 -4
- package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-BrqhSCf9.mjs} +17 -22
- package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-CaCh0xF_.mjs} +5 -18
- package/dist/.setup/{session-initialization-DH1z6fXn.mjs → session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-BH-S6qkJ.mjs} +25 -6
- package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-DiAi6Kx6.mjs} +8 -8
- package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DA4VR4Eb.mjs} +59 -89
- package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-BJ1wSDcB.mjs} +147 -211
- package/dist/.setup/{source-Bjp4UQij.mjs → source-CUzJq5WN.mjs} +9 -9
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/{thread-history-page-BTx-4xsg.mjs → thread-history-page-DoVpnHim.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-Cik28qWn.mjs → thread-lifecycle-B3mfz1TG.mjs} +172 -2271
- package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-DcTtAcXj.mjs} +4 -2
- package/dist/.setup/{thread-policy-Cjs4B8xf.mjs → thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-DIBXwOpE.mjs} +6 -6
- package/dist/.setup/{timeout-DZF05XrR.mjs → timeout-C910MdAB.mjs} +19 -2
- package/dist/.setup/{transcript-history-projection-DHNBDhCU.mjs → transcript-history-projection-ZZpkFkJ_.mjs} +94 -64
- package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-BtHDBp1G.mjs} +218 -198
- package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-h2VHOskC.mjs} +135 -55
- package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-BUr4OUbC.mjs} +44 -36
- package/dist/.setup/{usage-BOgBEKso.mjs → usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-DUMbefVY.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
- package/dist/api.js +23 -12
- package/dist/catalog-page-worker-entrypoint.js +12 -0
- package/dist/catalog-page.worker.js +9 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +2 -2
- package/dist/harness.js +1 -1
- package/dist/index.js +221 -170
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +15 -32
- package/dist/session-history.worker.js +1 -1
- package/package.json +9 -6
- package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
- package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
- package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
- package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
- package/dist/.setup/version-CoqzXPgK.mjs +0 -12
- package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-umd0tgh4.mjs} +1 -1
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { r as normalizeCodexAppServerArgs } from "./launch-args-
|
|
1
|
+
import { r as normalizeCodexAppServerArgs } from "./launch-args-DbFCehO7.mjs";
|
|
2
|
+
import { i as resolveManagedCodexNativeCommand } from "./managed-binary-BnshlFag.mjs";
|
|
3
|
+
import { i as recordCodexAppServerSpawnFailure, r as getCodexAppServerSpawnFailure } from "./spawn-error-CL3n6MAa.mjs";
|
|
2
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
5
|
+
import { stripVTControlCharacters } from "node:util";
|
|
6
|
+
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
3
7
|
import { z } from "zod";
|
|
4
8
|
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
5
9
|
import { closeSync, constants, openSync, readSync } from "node:fs";
|
|
6
10
|
import path from "node:path";
|
|
7
11
|
import { readFile, readdir } from "node:fs/promises";
|
|
12
|
+
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
8
13
|
import { once } from "node:events";
|
|
14
|
+
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
15
|
+
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
9
16
|
import { execFile, spawn } from "node:child_process";
|
|
10
17
|
import { setImmediate } from "node:timers/promises";
|
|
11
18
|
import { finished } from "node:stream/promises";
|
|
@@ -302,6 +309,8 @@ const MAX_PROCESS_QUIESCE_PASSES = 16;
|
|
|
302
309
|
/** Discharges the registered root obligation, including an already-obsolete PID. */
|
|
303
310
|
async function terminateCodexAppServerOrphan(expected) {
|
|
304
311
|
const deadline = Date.now() + MAX_PROCESS_CONTAINMENT_MS;
|
|
312
|
+
const initial = (await readCodexAppServerProcessSnapshot(deadline, [expected.pid])).find((row) => row.pid === expected.pid);
|
|
313
|
+
if (!initial || !hasSameIdentity(initial, expected) || isDeadProcessState(initial.state)) return true;
|
|
305
314
|
const result = await terminateCodexAppServerDescendants({
|
|
306
315
|
pid: expected.pid,
|
|
307
316
|
kill: (signal) => signalProcess(expected.pid, signal ?? "SIGTERM")
|
|
@@ -314,7 +323,7 @@ async function terminateCodexAppServerOrphan(expected) {
|
|
|
314
323
|
if (current && isSameLiveRoot(current, contained.root, true)) signalProcess(current.pgid === current.pid ? -current.pid : current.pid, "SIGKILL");
|
|
315
324
|
}
|
|
316
325
|
while (Date.now() < deadline) {
|
|
317
|
-
const snapshot = await readCodexAppServerProcessSnapshot(deadline).catch(() => void 0);
|
|
326
|
+
const snapshot = await readCodexAppServerProcessSnapshot(deadline, [expected.pid]).catch(() => void 0);
|
|
318
327
|
if (!snapshot?.some((row) => row.pid === process.pid)) return false;
|
|
319
328
|
const current = snapshot.find((row) => row.pid === expected.pid);
|
|
320
329
|
if (!current || !hasSameIdentity(current, expected) || isDeadProcessState(current.state)) {
|
|
@@ -531,21 +540,37 @@ const registrationSchema = z.object({
|
|
|
531
540
|
parent: processIdentity,
|
|
532
541
|
child: childIdentity
|
|
533
542
|
}).strict();
|
|
543
|
+
const registrationCleanup = /* @__PURE__ */ new WeakMap();
|
|
544
|
+
const processReaper = resolveGlobalSingleton(Symbol.for("openclaw.codexAppServerProcessReaper"), () => new KeyedAsyncQueue());
|
|
545
|
+
/** Join bookkeeping after the transport owner has observed physical exit. */
|
|
546
|
+
async function waitForCodexAppServerProcessRegistrationCleanup(child) {
|
|
547
|
+
await registrationCleanup.get(child);
|
|
548
|
+
}
|
|
534
549
|
function fingerprintProcessCommand(command) {
|
|
535
550
|
return createHash("sha256").update(command).digest("hex");
|
|
536
551
|
}
|
|
537
552
|
async function openProcessRegistrationStore() {
|
|
538
|
-
const
|
|
539
|
-
|
|
553
|
+
const env = {
|
|
554
|
+
...process.env,
|
|
555
|
+
OPENCLAW_STATE_DIR: resolveStateDir()
|
|
556
|
+
};
|
|
557
|
+
const { createPluginStateKeyedStore } = await import("openclaw/plugin-sdk/plugin-state-store-runtime");
|
|
558
|
+
return createPluginStateKeyedStore("codex", {
|
|
540
559
|
namespace: "app-server-processes",
|
|
541
560
|
maxEntries: 512,
|
|
542
|
-
overflowPolicy: "reject-new"
|
|
561
|
+
overflowPolicy: "reject-new",
|
|
562
|
+
env
|
|
543
563
|
});
|
|
544
564
|
}
|
|
545
565
|
async function reapRegisteredCodexAppServerOrphans() {
|
|
546
566
|
const store = await openProcessRegistrationStore();
|
|
567
|
+
await processReaper.enqueue("orphans", () => sweepRegisteredCodexAppServerOrphans(store));
|
|
568
|
+
return store;
|
|
569
|
+
}
|
|
570
|
+
async function sweepRegisteredCodexAppServerOrphans(store) {
|
|
571
|
+
const entries = await store.entries();
|
|
547
572
|
const deadline = Date.now() + PROCESS_REGISTRATION_INSPECTION_MS;
|
|
548
|
-
for (const entry of
|
|
573
|
+
for (const entry of entries) {
|
|
549
574
|
if (Date.now() >= deadline) throw new Error("Codex orphan cleanup exceeded its startup budget. Retry to finish cleanup.");
|
|
550
575
|
const registration = registrationSchema.parse(entry.value);
|
|
551
576
|
const snapshot = await readCodexAppServerProcessSnapshot(deadline, [registration.parent.pid, registration.child.pid]);
|
|
@@ -557,29 +582,34 @@ async function reapRegisteredCodexAppServerOrphans() {
|
|
|
557
582
|
try {
|
|
558
583
|
command = await readCodexAppServerProcessCommand(child, deadline);
|
|
559
584
|
} catch (error) {
|
|
560
|
-
|
|
585
|
+
const current = (await readCodexAppServerProcessSnapshot(deadline, [registration.child.pid])).find((row) => row.pid === registration.child.pid);
|
|
586
|
+
if (current?.startedAt === registration.child.startedAt && !isDeadProcessState(current.state)) throw error;
|
|
561
587
|
}
|
|
562
588
|
if (command !== void 0 && fingerprintProcessCommand(command) !== registration.child.commandFingerprint) {
|
|
563
|
-
store.delete(entry.key);
|
|
589
|
+
await store.delete(entry.key);
|
|
564
590
|
continue;
|
|
565
591
|
}
|
|
566
592
|
}
|
|
567
593
|
if (!await terminateCodexAppServerOrphan(registration.child)) throw new Error(`Cannot reap registered Codex process ${registration.child.pid}. Stop it before retrying.`);
|
|
568
|
-
store.delete(entry.key);
|
|
594
|
+
await store.delete(entry.key);
|
|
569
595
|
}
|
|
570
596
|
}
|
|
571
597
|
function createCodexAppServerProcessReaperService() {
|
|
598
|
+
let pendingSweep;
|
|
572
599
|
return {
|
|
573
600
|
id: "codex-app-server-process-reaper",
|
|
574
601
|
start(ctx) {
|
|
575
602
|
if (process.platform === "win32") return;
|
|
576
|
-
(async () => {
|
|
603
|
+
pendingSweep = (async () => {
|
|
577
604
|
try {
|
|
578
605
|
await reapRegisteredCodexAppServerOrphans();
|
|
579
606
|
} catch (error) {
|
|
580
607
|
ctx.logger.warn(`Codex app-server orphan cleanup failed: ${String(error)}`);
|
|
581
608
|
}
|
|
582
609
|
})();
|
|
610
|
+
},
|
|
611
|
+
async stop() {
|
|
612
|
+
await pendingSweep;
|
|
583
613
|
}
|
|
584
614
|
};
|
|
585
615
|
}
|
|
@@ -588,8 +618,7 @@ async function prepareCodexAppServerProcessRegistration() {
|
|
|
588
618
|
if (process.platform === "win32") return async (child) => {
|
|
589
619
|
await once(child, "spawn");
|
|
590
620
|
};
|
|
591
|
-
await reapRegisteredCodexAppServerOrphans();
|
|
592
|
-
const store = await openProcessRegistrationStore();
|
|
621
|
+
const store = await reapRegisteredCodexAppServerOrphans();
|
|
593
622
|
return async (child) => {
|
|
594
623
|
await once(child, "spawn");
|
|
595
624
|
if (!child.pid) throw new ProcessInspectionError("unavailable");
|
|
@@ -601,21 +630,63 @@ async function prepareCodexAppServerProcessRegistration() {
|
|
|
601
630
|
const command = await readCodexAppServerProcessCommand(spawned, deadline);
|
|
602
631
|
if (child.exitCode !== null || child.signalCode !== null) throw new Error("Cannot register the Codex child process command: the child exited during inspection. Retry.");
|
|
603
632
|
const key = randomUUID();
|
|
604
|
-
|
|
633
|
+
const value = {
|
|
605
634
|
parent: processIdentity.parse(parent),
|
|
606
635
|
child: childIdentity.parse({
|
|
607
636
|
...spawned,
|
|
608
637
|
commandFingerprint: fingerprintProcessCommand(command)
|
|
609
638
|
})
|
|
639
|
+
};
|
|
640
|
+
const exited = new Promise((resolve) => {
|
|
641
|
+
child.once("exit", () => resolve());
|
|
610
642
|
});
|
|
611
|
-
|
|
643
|
+
const registered = store.register(key, value);
|
|
644
|
+
const cleanup = (async () => {
|
|
645
|
+
await exited;
|
|
646
|
+
await registered.catch(() => void 0);
|
|
612
647
|
try {
|
|
613
|
-
store.delete(key);
|
|
648
|
+
await store.delete(key);
|
|
614
649
|
} catch {}
|
|
615
|
-
});
|
|
650
|
+
})();
|
|
651
|
+
registrationCleanup.set(child, cleanup);
|
|
652
|
+
await registered;
|
|
653
|
+
if (child.exitCode !== null || child.signalCode !== null) {
|
|
654
|
+
await cleanup;
|
|
655
|
+
throw new Error("Cannot register the Codex child process: the child exited during registration. Retry.");
|
|
656
|
+
}
|
|
616
657
|
};
|
|
617
658
|
}
|
|
618
659
|
//#endregion
|
|
660
|
+
//#region extensions/codex/src/app-server/managed-launcher-failure.ts
|
|
661
|
+
/** The official npm launcher prints Node's native spawn error and exits before initialization. */
|
|
662
|
+
function observeManagedCodexLauncherFailure(child, nativeCommand) {
|
|
663
|
+
let prefix = "";
|
|
664
|
+
let launchCode;
|
|
665
|
+
const startupFailure = { complete() {
|
|
666
|
+
child.stderr.off("data", onData);
|
|
667
|
+
child.off("exit", onExit);
|
|
668
|
+
prefix = "";
|
|
669
|
+
} };
|
|
670
|
+
const onData = (chunk) => {
|
|
671
|
+
if (launchCode || prefix.length >= 16384) return;
|
|
672
|
+
prefix = (prefix + stripVTControlCharacters(chunk.toString())).slice(0, 16384);
|
|
673
|
+
if (/\bError: spawn\b/u.test(prefix) && /syscall: ['"]spawn(?: [^'"\r\n]*)?['"]/u.test(prefix)) launchCode = /\bcode: ['"](ENOENT|EACCES|EBADARCH|Unknown system error -86)['"]/u.exec(prefix)?.[1];
|
|
674
|
+
else if (/Error: Missing optional dependency @openai\/codex-[\w-]+\. Reinstall Codex:/u.test(prefix)) launchCode = "ENOENT";
|
|
675
|
+
};
|
|
676
|
+
const onExit = (code) => {
|
|
677
|
+
startupFailure.complete();
|
|
678
|
+
if (code !== 1 || !launchCode) return;
|
|
679
|
+
const described = recordCodexAppServerSpawnFailure(Object.assign(/* @__PURE__ */ new Error(`spawn ${launchCode}`), {
|
|
680
|
+
code: launchCode,
|
|
681
|
+
syscall: "spawn"
|
|
682
|
+
}), nativeCommand, nativeCommand);
|
|
683
|
+
if (described instanceof Error) startupFailure.error = described;
|
|
684
|
+
};
|
|
685
|
+
child.stderr.on("data", onData);
|
|
686
|
+
child.once("exit", onExit);
|
|
687
|
+
Object.assign(child, { startupFailure });
|
|
688
|
+
}
|
|
689
|
+
//#endregion
|
|
619
690
|
//#region extensions/codex/src/app-server/transport.ts
|
|
620
691
|
/**
|
|
621
692
|
* Shared transport lifecycle helpers for stdio and WebSocket Codex app-server
|
|
@@ -696,6 +767,7 @@ async function closeCodexAppServerTransportAndWait(child, options = {}) {
|
|
|
696
767
|
const closure = beginCodexAppServerTransportClose(child, options);
|
|
697
768
|
const containment = await closure.closing;
|
|
698
769
|
const settled = await waitForCodexAppServerTransportExit(child, options.exitTimeoutMs ?? 2e3, drained);
|
|
770
|
+
if (settled) await waitForCodexAppServerProcessRegistrationCleanup(child);
|
|
699
771
|
closure.naturalExit = containment === "natural" && settled;
|
|
700
772
|
if (options.drainStdio) {
|
|
701
773
|
child.stdout.destroy?.();
|
|
@@ -756,39 +828,29 @@ const RUNTIME_INJECTION_ENVIRONMENT_KEYS = /* @__PURE__ */ new Set([
|
|
|
756
828
|
"LD_PRELOAD"
|
|
757
829
|
]);
|
|
758
830
|
const QA_PARENT_PID_ENV = "OPENCLAW_QA_PARENT_PID";
|
|
759
|
-
const DEFAULT_SPAWN_RUNTIME = {
|
|
760
|
-
platform: process.platform,
|
|
761
|
-
env: process.env,
|
|
762
|
-
execPath: process.execPath,
|
|
763
|
-
isBun: typeof process.versions.bun === "string"
|
|
764
|
-
};
|
|
765
831
|
/** Resolves the concrete command/argv/shell settings used to spawn Codex app-server. */
|
|
766
|
-
function resolveCodexAppServerSpawnInvocation(options,
|
|
832
|
+
function resolveCodexAppServerSpawnInvocation(options, env) {
|
|
767
833
|
if (options.commandSource === "managed") throw new Error("Managed Codex app-server start options must be resolved before spawn.");
|
|
768
834
|
const program = resolveWindowsSpawnProgram({
|
|
769
835
|
command: options.command,
|
|
770
|
-
platform:
|
|
771
|
-
env
|
|
772
|
-
execPath:
|
|
836
|
+
platform: process.platform,
|
|
837
|
+
env,
|
|
838
|
+
execPath: process.execPath,
|
|
773
839
|
packageName: "@openai/codex"
|
|
774
840
|
});
|
|
775
841
|
const args = normalizeCodexAppServerArgs(options.args);
|
|
776
842
|
const resolved = materializeWindowsSpawnProgram(program, args);
|
|
777
|
-
if (
|
|
843
|
+
if (options.commandSource === "resolved-managed" && resolved.resolution === "direct" && [
|
|
778
844
|
".cjs",
|
|
779
845
|
".js",
|
|
780
846
|
".mjs"
|
|
781
847
|
].includes(path.extname(resolved.command).toLowerCase())) return {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
return {
|
|
787
|
-
command: resolved.command,
|
|
788
|
-
args: resolved.argv,
|
|
789
|
-
shell: resolved.shell,
|
|
790
|
-
windowsHide: resolved.windowsHide
|
|
848
|
+
...resolved,
|
|
849
|
+
command: process.execPath,
|
|
850
|
+
argv: [resolved.command, ...resolved.argv],
|
|
851
|
+
resolution: "node-entrypoint"
|
|
791
852
|
};
|
|
853
|
+
return resolved;
|
|
792
854
|
}
|
|
793
855
|
/** Merges app-server environment overrides while honoring clearEnv and unsafe key filtering. */
|
|
794
856
|
function resolveCodexAppServerSpawnEnv(options, baseEnv = process.env, platform = process.platform) {
|
|
@@ -828,27 +890,45 @@ function copySafeEnvironmentEntries(target, source) {
|
|
|
828
890
|
/** Spawns the Codex app-server process and returns the shared transport interface. */
|
|
829
891
|
async function createStdioTransport(options, baseEnv = process.env, assertCurrent, onSpawn) {
|
|
830
892
|
const env = resolveCodexAppServerSpawnEnv(options, baseEnv);
|
|
831
|
-
const invocation = resolveCodexAppServerSpawnInvocation(options,
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
893
|
+
const invocation = resolveCodexAppServerSpawnInvocation(options, env);
|
|
894
|
+
const nativeCommand = options.commandSource === "resolved-managed" ? resolveManagedCodexNativeCommand(options.command, { pathExists: () => true }) : void 0;
|
|
895
|
+
const launchKey = JSON.stringify([
|
|
896
|
+
invocation.command,
|
|
897
|
+
options.cwd ?? process.cwd(),
|
|
898
|
+
nativeCommand ?? null,
|
|
899
|
+
path.isAbsolute(invocation.command) ? null : env.PATH ?? env.Path
|
|
900
|
+
]);
|
|
901
|
+
const previousFailure = getCodexAppServerSpawnFailure(launchKey) ?? (nativeCommand ? getCodexAppServerSpawnFailure(nativeCommand) : void 0);
|
|
902
|
+
if (previousFailure) throw previousFailure;
|
|
837
903
|
const register = await prepareCodexAppServerProcessRegistration();
|
|
838
904
|
assertCurrent?.();
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
"pipe",
|
|
847
|
-
"pipe"
|
|
848
|
-
],
|
|
849
|
-
windowsHide: invocation.windowsHide
|
|
905
|
+
embeddedAgentLog.debug("Codex app-server spawn", {
|
|
906
|
+
command: invocation.command,
|
|
907
|
+
launcher: options.command,
|
|
908
|
+
...options.cwd ? { cwd: options.cwd } : {},
|
|
909
|
+
...nativeCommand ? { nativeCommand } : {},
|
|
910
|
+
platform: process.platform,
|
|
911
|
+
arch: process.arch
|
|
850
912
|
});
|
|
913
|
+
let child;
|
|
914
|
+
try {
|
|
915
|
+
child = spawn(invocation.command, invocation.argv, {
|
|
916
|
+
...options.cwd !== void 0 ? { cwd: options.cwd } : {},
|
|
917
|
+
env,
|
|
918
|
+
detached: resolveCodexAppServerDetachedMode(env),
|
|
919
|
+
shell: invocation.shell,
|
|
920
|
+
stdio: [
|
|
921
|
+
"pipe",
|
|
922
|
+
"pipe",
|
|
923
|
+
"pipe"
|
|
924
|
+
],
|
|
925
|
+
windowsHide: invocation.windowsHide
|
|
926
|
+
});
|
|
927
|
+
} catch (error) {
|
|
928
|
+
throw recordCodexAppServerSpawnFailure(error, invocation.command, launchKey);
|
|
929
|
+
}
|
|
851
930
|
try {
|
|
931
|
+
if (nativeCommand && invocation.resolution === "node-entrypoint") observeManagedCodexLauncherFailure(child, nativeCommand);
|
|
852
932
|
onSpawn?.(child);
|
|
853
933
|
await register(child);
|
|
854
934
|
assertCurrent?.();
|
|
@@ -856,8 +936,8 @@ async function createStdioTransport(options, baseEnv = process.env, assertCurren
|
|
|
856
936
|
} catch (error) {
|
|
857
937
|
await closeCodexAppServerTransportAndWait(child, { drainStdio: true });
|
|
858
938
|
assertCurrent?.();
|
|
859
|
-
throw error;
|
|
939
|
+
throw child.startupFailure?.error ?? recordCodexAppServerSpawnFailure(error, invocation.command, launchKey);
|
|
860
940
|
}
|
|
861
941
|
}
|
|
862
942
|
//#endregion
|
|
863
|
-
export {
|
|
943
|
+
export { closeCodexAppServerTransportAndWait as a, closeCodexAppServerTransport as i, resolveCodexAppServerSpawnEnv as n, hasCodexAppServerNaturalExit as o, resolveCodexAppServerSpawnInvocation as r, createCodexAppServerProcessReaperService as s, createStdioTransport as t };
|
package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-BUr4OUbC.mjs}
RENAMED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { m as isJsonObject, p as flattenCodexDynamicToolFunctions } from "./config-security-BRQ2mgW9.mjs";
|
|
1
|
+
import { m as sessionBindingIdentity } from "./session-binding-record-BGoz8wOK.mjs";
|
|
3
2
|
import { d as readCodexPluginConfig } from "./config-parsing-CcB9iPoq.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { s as assertCodexModelBackedReviewerEffectiveConfig } from "./config-options-
|
|
3
|
+
import { i as isJsonObject, r as flattenCodexDynamicToolFunctions } from "./protocol-CANUwXJ3.mjs";
|
|
4
|
+
import { s as assertCodexModelBackedReviewerEffectiveConfig } from "./config-options-BvaRs51b.mjs";
|
|
5
|
+
import { o as readCodexSessionMeta } from "./session-catalog-events-Bj6j94E_.mjs";
|
|
6
6
|
import { n as withCodexAppServerThreadMutation } from "./incognito-session-uhrBF6wJ.mjs";
|
|
7
7
|
import { i as readUpstreamUserText, r as readMirrorIdentity } from "./upstream-prompt-provenance-LphB8slG.mjs";
|
|
8
|
-
import { i as projectCodexUserItemText } from "./transcript-history-projection-
|
|
8
|
+
import { i as projectCodexUserItemText } from "./transcript-history-projection-ZZpkFkJ_.mjs";
|
|
9
9
|
import { n as codexUpstreamBaseline, t as codexLastTerminalTurnId } from "./session-upstream-marker-D15C9NHp.mjs";
|
|
10
|
-
import { r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { r as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-runtime-CeAhl_h4.mjs";
|
|
10
|
+
import { r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-B2CsSdnV.mjs";
|
|
11
|
+
import { t as CodexAppServerScopedRequestRejectedError } from "./request-D2L0zMrq.mjs";
|
|
12
|
+
import { n as resolveOpenClawExecPolicyForCodexAppServer } from "./config-BoTP_mrL.mjs";
|
|
13
|
+
import { r as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
15
14
|
import { a as fingerprintCodexMirrorSourceMessage, c as readCodexMirrorSourceFingerprint } from "./transcript-mirror-attestation-CzM-94NC.mjs";
|
|
16
|
-
import { I as hasCodexAppServerLiveThread, M as claimCodexAppServerLiveThread, f as readCodexAppServerClientDesktopGenerationFingerprint } from "./shared-client-
|
|
17
|
-
import {
|
|
18
|
-
import "./
|
|
19
|
-
import
|
|
20
|
-
import "./thread-
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
15
|
+
import { I as hasCodexAppServerLiveThread, M as claimCodexAppServerLiveThread, f as readCodexAppServerClientDesktopGenerationFingerprint } from "./shared-client-DA4VR4Eb.mjs";
|
|
16
|
+
import { l as isCodexAppServerOverloadError, u as isCodexAppServerPrewriteRequestCancellationError, v as assertCodexThreadAcceptsDirectInput, y as assertCodexThreadForkResponse } from "./client-Cs08OXVQ.mjs";
|
|
17
|
+
import { B as parseCodexNativeToolCatalog, Ct as shouldBuildCodexPluginThreadConfig, E as buildCodexNativeHookRelayConfig, F as checkCodexThreadAppAvailability, H as resolveCodexNativeSkillIsolation, K as codexDynamicToolsFingerprint, O as buildCodexNativeHookRelayId, T as assertCodexNativeHookRelayAllowed, V as applyCodexNativeSkillIsolation, X as fingerprintJsonObject, Z as fingerprintUserMcpServersConfigPatch, a as buildCodexThreadConfiguration, j as resolveCodexNativeHookRelayEvents, m as buildDeveloperInstructions, mt as buildCodexPluginThreadConfig, p as resolveCodexWebSearchPlan, xt as mergeCodexThreadConfigs } from "./thread-requests-BLvGkP2R.mjs";
|
|
18
|
+
import "./session-binding-Cm0apEbd.mjs";
|
|
19
|
+
import { a as refreshCodexThreadPolicy, n as CodexThreadPolicyHandoffError } from "./thread-policy-DGuQsuFC.mjs";
|
|
20
|
+
import "./thread-ownership-DcTtAcXj.mjs";
|
|
21
|
+
import { n as resolveCodexNativeExecutionPolicy } from "./native-execution-policy-umd0tgh4.mjs";
|
|
22
|
+
import { d as isCodexDynamicToolExcluded, n as resolveCodexProviderWebSearchSupportForClient } from "./provider-capabilities-BfE88FZ5.mjs";
|
|
23
|
+
import { u as prepareCodexWorkspaceDeveloperInstructions } from "./attempt-workspace-context-DUVEn_CS.mjs";
|
|
24
|
+
import { n as prepareCodexSessionInitialization } from "./session-initialization-rcgbZiid.mjs";
|
|
25
|
+
import { createImportedCodexSession } from "./session-history-import-D-3wAgOP.mjs";
|
|
26
26
|
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
27
27
|
import { randomUUID } from "node:crypto";
|
|
28
28
|
import { isDeepStrictEqual } from "node:util";
|
|
29
29
|
import path from "node:path";
|
|
30
30
|
import { lstat } from "node:fs/promises";
|
|
31
|
-
import { constants, createZstdDecompress } from "node:zlib";
|
|
32
31
|
import { root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
32
|
+
import { constants, createZstdDecompress } from "node:zlib";
|
|
33
33
|
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
34
34
|
import { loadCodexBundleMcpThreadConfig } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
35
35
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
@@ -259,7 +259,7 @@ async function prepareCanonicalCodexFork(params) {
|
|
|
259
259
|
const nativeSkillIsolation = await resolveCodexNativeSkillIsolation({
|
|
260
260
|
client: context.client,
|
|
261
261
|
cwd,
|
|
262
|
-
codexHome: appServer.start.env?.CODEX_HOME,
|
|
262
|
+
codexHome: appServer.start.codexHome ?? appServer.start.env?.CODEX_HOME,
|
|
263
263
|
home: appServer.start.env?.HOME,
|
|
264
264
|
userProfile: appServer.start.env?.USERPROFILE
|
|
265
265
|
});
|
|
@@ -375,15 +375,15 @@ function resolveCodexUpstreamForkBoundaryFromTurns(params) {
|
|
|
375
375
|
if (item.type !== "userMessage") continue;
|
|
376
376
|
const isSteer = userMessagesInTurn > 0;
|
|
377
377
|
userMessagesInTurn += 1;
|
|
378
|
+
const local = params.localPrefix[localIndex];
|
|
379
|
+
const identity = local && readMirrorIdentity(local.message);
|
|
380
|
+
const matchesIdentity = identity === `${turn.id}:${item.id}` || !isSteer && identity === `${turn.id}:prompt`;
|
|
381
|
+
if (!matchedPrefix && !matchesIdentity) continue;
|
|
378
382
|
const nativeText = textOnlyMessage(item.content);
|
|
379
383
|
if (nativeText === void 0) return failure("drift-mismatch", "A message before the fork point contains images or attachments that cannot be verified across OpenClaw and Codex. Fork from a text-only span instead.");
|
|
380
|
-
const local = params.localPrefix[localIndex];
|
|
381
384
|
const upstreamText = local && readUpstreamUserText(local.message);
|
|
382
385
|
const text = upstreamText ? nativeText : projectCodexUserItemText(item);
|
|
383
386
|
if (!text) continue;
|
|
384
|
-
const identity = local && readMirrorIdentity(local.message);
|
|
385
|
-
const matchesIdentity = identity === `${turn.id}:${item.id}` || !isSteer && identity === `${turn.id}:prompt`;
|
|
386
|
-
if (!matchedPrefix && !matchesIdentity) continue;
|
|
387
387
|
matchedPrefix = true;
|
|
388
388
|
const localText = textOnlyMessage(local && "content" in local.message ? local.message.content : void 0);
|
|
389
389
|
const upstreamPromptVerified = !upstreamText || local?.message.role === "user" && readCodexMirrorSourceFingerprint(local.message) === fingerprintCodexMirrorSourceMessage(local.message);
|
|
@@ -567,6 +567,7 @@ async function forkCanonicalCodexSession(params) {
|
|
|
567
567
|
}
|
|
568
568
|
});
|
|
569
569
|
const assertCurrent = () => {
|
|
570
|
+
fork.assertCurrent();
|
|
570
571
|
initialization.assertCurrent();
|
|
571
572
|
if (ownership && !subscriptionReleased) ownership.assertCurrent();
|
|
572
573
|
};
|
|
@@ -797,16 +798,23 @@ async function forkCodexUpstreamSession(params, options) {
|
|
|
797
798
|
code: precheck.code,
|
|
798
799
|
message: precheck.message
|
|
799
800
|
};
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
801
|
+
let response;
|
|
802
|
+
let threadId;
|
|
803
|
+
try {
|
|
804
|
+
const rawResponse = await control.forkThread({
|
|
805
|
+
threadId: sourceThreadId,
|
|
806
|
+
beforeTurnId: resolved.boundary.beforeTurnId,
|
|
807
|
+
...params.sandbox === "required" ? { sandbox: "workspace-write" } : {},
|
|
808
|
+
excludeTurns: true
|
|
809
|
+
}, params.assertCurrent);
|
|
810
|
+
response = assertCodexThreadForkResponse(rawResponse);
|
|
811
|
+
threadId = response.thread.id.trim();
|
|
812
|
+
if (!threadId) throw new Error("Codex thread/fork response did not include a thread id");
|
|
813
|
+
if (threadId === sourceThreadId || threadId === sourceBinding?.threadId) throw new Error("Codex thread/fork response reused the source thread id");
|
|
814
|
+
} catch (error) {
|
|
815
|
+
if (!(error instanceof CodexAppServerScopedRequestRejectedError) && !isCodexAppServerPrewriteRequestCancellationError(error) && !isCodexAppServerOverloadError(error)) control.retireConnection?.();
|
|
816
|
+
throw error;
|
|
817
|
+
}
|
|
810
818
|
const forkedThreadId = threadId;
|
|
811
819
|
try {
|
|
812
820
|
const connectionFingerprint = normalizeOptionalString(control.connectionFingerprint);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-
|
|
2
|
-
import { n as readCodexAppServerUsage } from "./request-
|
|
3
|
-
import "./config-
|
|
4
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-
|
|
1
|
+
import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-CMU3DUD0.mjs";
|
|
2
|
+
import { n as readCodexAppServerUsage } from "./request-D2L0zMrq.mjs";
|
|
3
|
+
import "./config-BoTP_mrL.mjs";
|
|
4
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
5
5
|
import { CODEX_APP_SERVER_AUTH_MARKER } from "openclaw/plugin-sdk/agent-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/usage.ts
|
|
7
7
|
/** Handles the synthetic usage credential for a Codex-backed OpenAI route. */
|
|
@@ -10,6 +10,7 @@ async function fetchCodexAppServerUsageSnapshot(ctx, options = {}) {
|
|
|
10
10
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: options.pluginConfig });
|
|
11
11
|
const usage = await (options.readUsage ?? readCodexAppServerUsage)({
|
|
12
12
|
timeoutMs: ctx.timeoutMs,
|
|
13
|
+
signal: ctx.signal,
|
|
13
14
|
agentDir: ctx.agentDir,
|
|
14
15
|
...ctx.authProfileId ? { authProfileId: ctx.authProfileId } : {},
|
|
15
16
|
config: ctx.config,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-
|
|
3
|
-
import { t as CODEX_CONTROL_METHODS } from "./capabilities-
|
|
4
|
-
import { J as rememberCodexRateLimitsRead, K as readCodexRateLimitsRevision, q as readRecentCodexRateLimits } from "./shared-client-
|
|
1
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
+
import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-CMU3DUD0.mjs";
|
|
3
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-CDXOOFdZ.mjs";
|
|
4
|
+
import { J as rememberCodexRateLimitsRead, K as readCodexRateLimitsRevision, q as readRecentCodexRateLimits } from "./shared-client-DA4VR4Eb.mjs";
|
|
5
5
|
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { markAuthProfileBlockedUntil } from "openclaw/plugin-sdk/agent-runtime";
|
|
7
7
|
import { embeddedAgentLog, formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
1
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
+
import { f as buildCodexNativeWebSearchThreadConfig } from "./thread-requests-BLvGkP2R.mjs";
|
|
3
|
+
import { runBoundedCodexAppServerTurn } from "./bounded-turn-B2HScEgT.mjs";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { readStringParam, resolveSearchTimeoutSeconds, wrapWebContent } from "openclaw/plugin-sdk/provider-web-search";
|
|
6
6
|
//#region extensions/codex/src/web-search-provider.runtime.ts
|
|
@@ -13,6 +13,7 @@ async function executeCodexWebSearchProviderTool(ctx, args, executionContext, op
|
|
|
13
13
|
modelProvider: "openai",
|
|
14
14
|
timeoutMs: resolveSearchTimeoutSeconds(ctx.searchConfig) * 1e3,
|
|
15
15
|
signal: executionContext?.signal,
|
|
16
|
+
assertCurrent: executionContext?.assertCurrent,
|
|
16
17
|
agentDir: ctx.agentDir,
|
|
17
18
|
options,
|
|
18
19
|
taskLabel: "hosted search",
|
package/dist/api.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./.setup/
|
|
5
|
-
import { n as
|
|
1
|
+
import { d as readCodexPluginConfig } from "./.setup/config-parsing-CcB9iPoq.mjs";
|
|
2
|
+
import { a as resolveCodexAppServerStartOptionsForAgent } from "./.setup/config-options-BvaRs51b.mjs";
|
|
3
|
+
import { i as resolveManagedCodexNativeCommand, r as resolveManagedCodexAppServerStartOptions, s as CODEX_APP_SERVER_VERSION, t as isManagedCodexDesktopCommand } from "./.setup/managed-binary-BnshlFag.mjs";
|
|
4
|
+
import { t as codexNativeProfileRecoveryHealthCheck } from "./.setup/auth-profile-health-oHizqgye.mjs";
|
|
5
|
+
import { n as findCodexAppServerSpawnError, t as describeCodexSpawnError } from "./.setup/spawn-error-CL3n6MAa.mjs";
|
|
6
|
+
import "./.setup/config-BoTP_mrL.mjs";
|
|
7
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./.setup/config-runtime-C8Rw1m1m.mjs";
|
|
6
8
|
import { listAgentIds, resolveAgentDir } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
7
9
|
import { runUtf8CommandWithTimeout } from "openclaw/plugin-sdk/process-runtime";
|
|
8
10
|
import path from "node:path";
|
|
@@ -67,7 +69,7 @@ function createCodexManagedAppServerHealthCheck(params) {
|
|
|
67
69
|
const isFinalization = ctx.mode === "fix" && env.OPENCLAW_UPDATE_POST_CORE === "1";
|
|
68
70
|
const versionFailureSeverity = isFinalization ? "warning" : "error";
|
|
69
71
|
const versionFailureHint = isFinalization ? "Codex readiness will be rechecked by its plugin after restart; inspect the Codex plugin if the warning persists." : void 0;
|
|
70
|
-
|
|
72
|
+
const candidates = [];
|
|
71
73
|
for (const agentId of listAgentIds(ctx.cfg)) {
|
|
72
74
|
const model = resolveDefaultModelForAgent({
|
|
73
75
|
cfg: ctx.cfg,
|
|
@@ -79,13 +81,20 @@ function createCodexManagedAppServerHealthCheck(params) {
|
|
|
79
81
|
modelId: model.model,
|
|
80
82
|
agentId
|
|
81
83
|
}) !== "codex") continue;
|
|
82
|
-
|
|
84
|
+
candidates.push(resolveAgentStartOptions({
|
|
83
85
|
startOptions: start,
|
|
84
86
|
agentDir: resolveAgentDir(ctx.cfg, agentId, env),
|
|
85
87
|
env
|
|
86
|
-
});
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
if (ctx.cfg.plugins?.entries?.codex?.enabled === true && readCodexPluginConfig(pluginConfig).sessionCatalog?.enabled !== false) candidates.push({
|
|
91
|
+
...start,
|
|
92
|
+
managedCommandOrder: "package-only"
|
|
93
|
+
});
|
|
94
|
+
let resolved;
|
|
95
|
+
for (const candidate of candidates) {
|
|
87
96
|
try {
|
|
88
|
-
resolved = await resolveStartOptions(
|
|
97
|
+
resolved = await resolveStartOptions(candidate, { pluginRoot: params.pluginRoot });
|
|
89
98
|
} catch (error) {
|
|
90
99
|
return [managedCodexFinding({
|
|
91
100
|
message: `Managed Codex app-server could not be resolved: ${readErrorMessage(error)}`,
|
|
@@ -109,16 +118,17 @@ function createCodexManagedAppServerHealthCheck(params) {
|
|
|
109
118
|
try {
|
|
110
119
|
output = await (params.deps?.runVersionCommand ? params.deps.runVersionCommand(nativeCommand) : runVersionCommand(nativeCommand, env));
|
|
111
120
|
} catch (error) {
|
|
121
|
+
const spawnFailure = findCodexAppServerSpawnError(describeCodexSpawnError(error, nativeCommand));
|
|
112
122
|
return [managedCodexFinding({
|
|
113
|
-
message: `Managed Codex app-server version check failed: ${readErrorMessage(error)}`,
|
|
114
|
-
severity: versionFailureSeverity,
|
|
123
|
+
message: spawnFailure?.message ?? `Managed Codex app-server version check failed: ${readErrorMessage(error)}`,
|
|
124
|
+
severity: spawnFailure && resolved.managedCommandOrder === "package-only" ? "warning" : versionFailureSeverity,
|
|
115
125
|
path: nativeCommand,
|
|
116
126
|
requirement: `Codex ${CODEX_APP_SERVER_VERSION} must report its version within ${CODEX_VERSION_TIMEOUT_MS} ms`,
|
|
117
127
|
fixHint: versionFailureHint ?? "Repair or reinstall the staged OpenClaw package, then rerun the candidate check before cutover."
|
|
118
128
|
})];
|
|
119
129
|
}
|
|
120
130
|
const detectedVersion = parseCodexVersion(`${output.stdout}\n${output.stderr}`);
|
|
121
|
-
if (detectedVersion !== "0.
|
|
131
|
+
if (detectedVersion !== "0.155.1") return [managedCodexFinding({
|
|
122
132
|
severity: versionFailureSeverity,
|
|
123
133
|
message: detectedVersion ? `Managed Codex app-server version mismatch: expected ${CODEX_APP_SERVER_VERSION}, detected ${detectedVersion}.` : `Managed Codex app-server did not report a parseable version; expected ${CODEX_APP_SERVER_VERSION}.`,
|
|
124
134
|
path: nativeCommand,
|
|
@@ -144,6 +154,7 @@ function registerCodexManagedAppServerDoctorChecks(host) {
|
|
|
144
154
|
...host,
|
|
145
155
|
pluginRoot: CODEX_PLUGIN_ROOT
|
|
146
156
|
});
|
|
157
|
+
if (!host.getHealthCheck(codexNativeProfileRecoveryHealthCheck.id)) host.registerHealthCheck(codexNativeProfileRecoveryHealthCheck);
|
|
147
158
|
}
|
|
148
159
|
//#endregion
|
|
149
160
|
export { CODEX_MANAGED_APP_SERVER_CHECK_ID, registerCodexManagedAppServerDoctorChecks };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region extensions/codex/catalog-page-worker-entrypoint.ts
|
|
2
|
+
const codexCatalogPageWorkerEntrypoint = {
|
|
3
|
+
currentModuleUrl: import.meta.url,
|
|
4
|
+
sourceWorkerName: "catalog-page.worker",
|
|
5
|
+
distWorkerPath: "extensions/codex/catalog-page.worker.js",
|
|
6
|
+
package: {
|
|
7
|
+
name: "@openclaw/codex",
|
|
8
|
+
distWorkerPath: "catalog-page.worker.js"
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { codexCatalogPageWorkerEntrypoint };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as createCodexCatalogDecoder } from "./.setup/client-catalog-response-BMgt_4q4.mjs";
|
|
2
|
+
import { serveWorkerTasks } from "openclaw/plugin-sdk/worker-task-server";
|
|
3
|
+
//#region extensions/codex/catalog-page.worker.ts
|
|
4
|
+
const decode = createCodexCatalogDecoder();
|
|
5
|
+
serveWorkerTasks((input) => {
|
|
6
|
+
return decode(input);
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export {};
|
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-irrD-uo7.mjs");
|
|
6
6
|
registerCodexSessionCli(program);
|
|
7
7
|
}, { descriptors: [{
|
|
8
8
|
name: "codex",
|
|
@@ -228,8 +228,8 @@ function normalizeCompatibilityConfig({ cfg }) {
|
|
|
228
228
|
const stateMigrations = [{
|
|
229
229
|
id: "codex-app-server-sidecars-to-plugin-state",
|
|
230
230
|
label: "Codex app-server thread bindings",
|
|
231
|
-
detectLegacyState: async (params) => (await import("./.setup/session-binding-sidecars-
|
|
232
|
-
migrateLegacyState: async (params) => (await import("./.setup/session-binding-sidecars-
|
|
231
|
+
detectLegacyState: async (params) => (await import("./.setup/session-binding-sidecars-BlB5EvIS.mjs")).detectLegacySessionBindingSidecars(params),
|
|
232
|
+
migrateLegacyState: async (params) => (await import("./.setup/session-binding-sidecars-BlB5EvIS.mjs")).migrateLegacySessionBindingSidecars(params)
|
|
233
233
|
}, codexOrphanedSessionBindingMigration];
|
|
234
234
|
//#endregion
|
|
235
235
|
export { legacyConfigRules, normalizeCompatibilityConfig, stateMigrations };
|