@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
package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BI6UTDZT.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { m as sessionBindingIdentity } from "./session-binding-record-BGoz8wOK.mjs";
|
|
2
|
+
import { C as boundedCatalogString, L as requireBoundThread, v as CatalogParamsError } from "./session-catalog-native-projection-DowriLid.mjs";
|
|
3
3
|
import { n as codexUpstreamBaseline, t as codexLastTerminalTurnId } from "./session-upstream-marker-D15C9NHp.mjs";
|
|
4
|
-
import { i as reclaimCurrentCodexSessionGeneration } from "./session-binding-
|
|
5
|
-
import { adoptionSessionKeyRest, continueOperations, runSessionActionExclusive } from "./session-catalog-node-adoption-
|
|
4
|
+
import { i as reclaimCurrentCodexSessionGeneration } from "./session-binding-Cm0apEbd.mjs";
|
|
5
|
+
import { adoptionSessionKeyRest, continueOperations, runSessionActionExclusive } from "./session-catalog-node-adoption-ITddWx_X.mjs";
|
|
6
6
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { listSessionCatalogEntries, sessionCatalogAdoptedSessionKey, sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
|
|
8
8
|
//#region extensions/codex/src/session-catalog-adoption.ts
|
|
@@ -32,36 +32,68 @@ function readCodexSupervisionMarker(entry) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
async function listAdoptedSessionEntries(params) {
|
|
35
|
-
const
|
|
36
|
-
for (const { agentId, entry, sessionKey } of listSessionCatalogEntries({
|
|
35
|
+
const entries = listSessionCatalogEntries({
|
|
37
36
|
...params.agentId ? { agentId: params.agentId } : {},
|
|
38
37
|
config: params.config ?? {},
|
|
39
38
|
runtime: params.runtime,
|
|
40
39
|
sessionEntries: params.sessionEntries
|
|
41
|
-
})
|
|
40
|
+
});
|
|
41
|
+
const candidateForEntry = ({ agentId, entry, sessionKey }) => {
|
|
42
42
|
const sessionKeyRest = adoptionSessionKeyRest(sessionKey);
|
|
43
43
|
const marker = readCodexSupervisionMarker(entry);
|
|
44
|
-
if (!sessionKeyRest.startsWith(CODEX_SUPERVISION_SESSION_KEY_PREFIX) || !marker || entry.initializationPending === true || entry.agentHarnessId !== "codex" || entry.modelSelectionLocked !== true)
|
|
44
|
+
if (!sessionKeyRest.startsWith(CODEX_SUPERVISION_SESSION_KEY_PREFIX) || !marker || entry.initializationPending === true || entry.agentHarnessId !== "codex" || entry.modelSelectionLocked !== true) return;
|
|
45
45
|
const sessionId = entry.sessionId?.trim();
|
|
46
|
-
if (!sessionId)
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
if (!sessionId) return;
|
|
47
|
+
return {
|
|
48
|
+
agentId,
|
|
49
49
|
sessionKey,
|
|
50
|
-
|
|
51
|
-
}));
|
|
52
|
-
const sourceThreadId = binding?.supervisionSourceThreadId?.trim();
|
|
53
|
-
const boundThreadId = binding?.threadId.trim();
|
|
54
|
-
if (binding?.connectionScope !== "supervision" || !sourceThreadId || !boundThreadId || sessionKeyRest !== adoptionSessionKey(sourceThreadId, marker.sourceHomeId)) continue;
|
|
55
|
-
const sourceKey = sessionCatalogAdoptedSourceKey(marker.sourceHomeId ?? "gateway:local", sourceThreadId);
|
|
56
|
-
if (adopted.has(sourceKey)) throw new Error(`multiple OpenClaw sessions adopt Codex thread ${sourceThreadId} from the same home`);
|
|
57
|
-
adopted.set(sourceKey, {
|
|
58
|
-
key: sessionKey,
|
|
50
|
+
sessionKeyRest,
|
|
59
51
|
sessionId,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
marker,
|
|
53
|
+
identity: sessionBindingIdentity({
|
|
54
|
+
sessionId,
|
|
55
|
+
sessionKey,
|
|
56
|
+
config: params.config
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
function* candidates() {
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
const candidate = candidateForEntry(entry);
|
|
63
|
+
if (candidate) yield candidate;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const collect = (selected, readBinding = (identity) => params.bindingStore.read(identity)) => {
|
|
67
|
+
const adopted = /* @__PURE__ */ new Map();
|
|
68
|
+
for (const { agentId, sessionKey, sessionKeyRest, sessionId, marker, identity } of selected) {
|
|
69
|
+
const binding = readBinding(identity);
|
|
70
|
+
const sourceThreadId = binding?.supervisionSourceThreadId?.trim();
|
|
71
|
+
const boundThreadId = binding?.threadId.trim();
|
|
72
|
+
if (binding?.connectionScope !== "supervision" || !sourceThreadId || !boundThreadId || sessionKeyRest !== adoptionSessionKey(sourceThreadId, marker.sourceHomeId)) continue;
|
|
73
|
+
const sourceKey = sessionCatalogAdoptedSourceKey(marker.sourceHomeId ?? "gateway:local", sourceThreadId);
|
|
74
|
+
if (adopted.has(sourceKey)) throw new Error(`multiple OpenClaw sessions adopt Codex thread ${sourceThreadId} from the same home`);
|
|
75
|
+
adopted.set(sourceKey, {
|
|
76
|
+
key: sessionKey,
|
|
77
|
+
sessionId,
|
|
78
|
+
agentId,
|
|
79
|
+
boundThreadId
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return adopted;
|
|
83
|
+
};
|
|
84
|
+
if (!params.bindingStore.readMany) return collect(candidates());
|
|
85
|
+
let prepared;
|
|
86
|
+
try {
|
|
87
|
+
prepared = [...candidates()];
|
|
88
|
+
} catch {
|
|
89
|
+
return collect(candidates());
|
|
90
|
+
}
|
|
91
|
+
const bindings = params.bindingStore.readMany(prepared.map(({ identity }) => identity));
|
|
92
|
+
try {
|
|
93
|
+
return collect(prepared, () => bindings.next().value);
|
|
94
|
+
} finally {
|
|
95
|
+
bindings.return(void 0);
|
|
63
96
|
}
|
|
64
|
-
return adopted;
|
|
65
97
|
}
|
|
66
98
|
async function findAdoptedSessionEntry(params) {
|
|
67
99
|
const adopted = await listAdoptedSessionEntries(params);
|
|
@@ -119,7 +151,7 @@ async function createOrReuseAdoptedSession(params) {
|
|
|
119
151
|
sourceThreadId: params.sourceThread.id,
|
|
120
152
|
...params.sourceHomeId ? { sourceHomeId: params.sourceHomeId } : {}
|
|
121
153
|
};
|
|
122
|
-
const { createImportedCodexSession } = await import("./session-history-import-
|
|
154
|
+
const { createImportedCodexSession } = await import("./session-history-import-D-3wAgOP.mjs");
|
|
123
155
|
const created = await createImportedCodexSession({
|
|
124
156
|
runtime: params.api.runtime,
|
|
125
157
|
bindingStore: params.bindingStore,
|
package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-lHBqzhaO.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as assertCodexArchiveDescendantsUnowned } from "./thread-archive-guard-
|
|
4
|
-
import "./session-binding-
|
|
5
|
-
import { runSessionActionExclusive } from "./session-catalog-node-adoption-
|
|
6
|
-
import { isAdoptionSessionKeyForThread, requireIdleThread } from "./session-catalog-adoption-
|
|
1
|
+
import { m as sessionBindingIdentity } from "./session-binding-record-BGoz8wOK.mjs";
|
|
2
|
+
import { v as CatalogParamsError } from "./session-catalog-native-projection-DowriLid.mjs";
|
|
3
|
+
import { t as assertCodexArchiveDescendantsUnowned } from "./thread-archive-guard-C9frICzX.mjs";
|
|
4
|
+
import "./session-binding-Cm0apEbd.mjs";
|
|
5
|
+
import { runSessionActionExclusive } from "./session-catalog-node-adoption-ITddWx_X.mjs";
|
|
6
|
+
import { isAdoptionSessionKeyForThread, requireIdleThread } from "./session-catalog-adoption-BI6UTDZT.mjs";
|
|
7
7
|
import { listAgentIds } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
8
8
|
import { sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
|
|
9
9
|
//#region extensions/codex/src/session-catalog-archive.ts
|
package/dist/.setup/{session-catalog-events-jMcYfQyd.mjs → session-catalog-events-Bj6j94E_.mjs}
RENAMED
|
@@ -1,14 +1,116 @@
|
|
|
1
|
-
import { n as defineCodexBuildState } from "./build-state-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { n as defineCodexBuildState } from "./build-state-C7EnDVgr.mjs";
|
|
2
|
+
import { f as resolveCodexAppServerLocalHomeDir, r as inferCodexAppServerConnectionClass } from "./config-security-BEReZ6go.mjs";
|
|
3
|
+
import { C as boundedCatalogString, b as MAX_CWD_LENGTH, r as projectCodexCatalogNativeThread, s as codexCatalogSourceForClient, u as observeCodexCatalogEphemeralThreads } from "./session-catalog-native-projection-DowriLid.mjs";
|
|
4
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
5
|
+
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-B2CsSdnV.mjs";
|
|
5
6
|
import { createHash } from "node:crypto";
|
|
6
7
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
7
8
|
import fs from "node:fs";
|
|
8
9
|
import path from "node:path";
|
|
9
10
|
import fs$1 from "node:fs/promises";
|
|
10
|
-
import { createZstdDecompress } from "node:zlib";
|
|
11
11
|
import { root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
12
|
+
import { createZstdDecompress } from "node:zlib";
|
|
13
|
+
//#region extensions/codex/src/app-server/shared-client-lifecycle.ts
|
|
14
|
+
/** Client ownership and synchronous retirement, independent of startup/auth execution. */
|
|
15
|
+
const createCodexAppServerStartupLifetime = () => ({
|
|
16
|
+
controller: new AbortController(),
|
|
17
|
+
pending: /* @__PURE__ */ new Set()
|
|
18
|
+
});
|
|
19
|
+
const getSharedCodexAppServerClientState = defineCodexBuildState("openclaw.codexAppServerClientState", () => ({
|
|
20
|
+
clients: /* @__PURE__ */ new Map(),
|
|
21
|
+
liveClients: /* @__PURE__ */ new Set(),
|
|
22
|
+
isolatedClients: /* @__PURE__ */ new Set(),
|
|
23
|
+
entriesByClient: /* @__PURE__ */ new WeakMap(),
|
|
24
|
+
desktopGenerationDrainChecks: /* @__PURE__ */ new Set(),
|
|
25
|
+
startup: createCodexAppServerStartupLifetime(),
|
|
26
|
+
startMetadata: /* @__PURE__ */ new WeakMap()
|
|
27
|
+
}));
|
|
28
|
+
function hasActiveSharedCodexAppServerWork() {
|
|
29
|
+
const state = getSharedCodexAppServerClientState();
|
|
30
|
+
if (state.startup.pending.size > 0 || state.startup.controller.signal.aborted) return true;
|
|
31
|
+
for (const entry of state.clients.values()) if (entry.activeLeases > 0 || entry.pendingAcquires > 0) return true;
|
|
32
|
+
for (const client of state.liveClients) {
|
|
33
|
+
const entry = state.entriesByClient.get(client);
|
|
34
|
+
if (entry && (entry.activeLeases > 0 || entry.pendingAcquires > 0)) return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
function getCurrentSharedClientEntry(client) {
|
|
39
|
+
const state = getSharedCodexAppServerClientState();
|
|
40
|
+
const entry = client ? state.entriesByClient.get(client) : void 0;
|
|
41
|
+
return entry && entry.client === client && state.clients.get(entry.key) === entry ? entry : void 0;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Retires a matching shared client. Default is graceful: detach from the map
|
|
45
|
+
* (future acquisitions get a fresh client) and close once leases drain.
|
|
46
|
+
* `failActiveLeases` is for suspect clients only (timed-out turns): it closes
|
|
47
|
+
* the physical connection immediately so co-leased attempts hit the normal
|
|
48
|
+
* client-closed retry path, and pending acquires reject instead of leasing
|
|
49
|
+
* the poisoned process. Routine cleanup must NOT use it — it would abort
|
|
50
|
+
* healthy sibling turns on a working client.
|
|
51
|
+
*/
|
|
52
|
+
function retireSharedCodexAppServerClientIfCurrent(client, opts) {
|
|
53
|
+
if (!client) return;
|
|
54
|
+
const state = getSharedCodexAppServerClientState();
|
|
55
|
+
const currentEntry = getCurrentSharedClientEntry(client);
|
|
56
|
+
const entry = currentEntry ?? state.entriesByClient.get(client);
|
|
57
|
+
if (!entry || entry.client !== client && !entry.closeError) return;
|
|
58
|
+
if (currentEntry) {
|
|
59
|
+
state.clients.delete(entry.key);
|
|
60
|
+
entry.closeWhenIdle = true;
|
|
61
|
+
}
|
|
62
|
+
if (opts?.failActiveLeases && (currentEntry || !entry.closeError)) {
|
|
63
|
+
entry.closeError = /* @__PURE__ */ new Error("codex app-server client is closed");
|
|
64
|
+
return {
|
|
65
|
+
activeLeases: entry.activeLeases,
|
|
66
|
+
closed: closeRetiredSharedClientEntry(entry)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
activeLeases: entry.activeLeases,
|
|
71
|
+
closed: currentEntry ? closeRetiredSharedClientEntryIfIdle(entry) : false
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** Gracefully retires exact clients attached to an older desktop generation. */
|
|
75
|
+
function retireSharedCodexAppServerClientsBeforeDesktopGeneration(generation) {
|
|
76
|
+
const state = getSharedCodexAppServerClientState();
|
|
77
|
+
for (const entry of state.clients.values()) {
|
|
78
|
+
const client = entry.client;
|
|
79
|
+
const attached = client ? state.startMetadata.get(client) : void 0;
|
|
80
|
+
if (client && attached?.desktopGeneration && attached.desktopGeneration.epoch < generation.epoch) retireSharedCodexAppServerClientIfCurrent(client);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function closeRetiredSharedClientEntryIfIdle(entry) {
|
|
84
|
+
if (!entry.closeWhenIdle || entry.activeLeases > 0 || entry.pendingAcquires > 0 || !entry.client) return false;
|
|
85
|
+
entry.closeWhenIdle = false;
|
|
86
|
+
return closeRetiredSharedClientEntry(entry);
|
|
87
|
+
}
|
|
88
|
+
function closeRetiredSharedClientEntry(entry) {
|
|
89
|
+
const client = entry.client;
|
|
90
|
+
if (!client) return false;
|
|
91
|
+
entry.client = void 0;
|
|
92
|
+
client.close();
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region extensions/codex/src/session-catalog-home-id.ts
|
|
97
|
+
function canonicalCodexCatalogHome(value) {
|
|
98
|
+
const resolved = path.resolve(value);
|
|
99
|
+
try {
|
|
100
|
+
return fs.realpathSync.native(resolved);
|
|
101
|
+
} catch {
|
|
102
|
+
return resolved;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** One canonical identity for catalog discovery and durable ownership rows. */
|
|
106
|
+
function codexCatalogHomeId(codexHome) {
|
|
107
|
+
return codexCatalogHomeIdFromCanonicalPath(canonicalCodexCatalogHome(codexHome));
|
|
108
|
+
}
|
|
109
|
+
/** Hashes lifecycle-prepared paths without repeating filesystem discovery. */
|
|
110
|
+
function codexCatalogHomeIdFromCanonicalPath(codexHome) {
|
|
111
|
+
return createHash("sha256").update("openclaw:codex-session-catalog-home:v1\0").update(codexHome).digest("hex");
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
12
114
|
//#region extensions/codex/src/session-catalog-provenance.ts
|
|
13
115
|
const MAX_SESSION_META_BYTES = 1048576;
|
|
14
116
|
const SESSION_META_READ_CHUNK_BYTES = 65536;
|
|
@@ -108,24 +210,6 @@ async function isOpenClawManagedCodexThread(thread, localSessionsRoot, diagnosti
|
|
|
108
210
|
}
|
|
109
211
|
}
|
|
110
212
|
//#endregion
|
|
111
|
-
//#region extensions/codex/src/session-catalog-home-id.ts
|
|
112
|
-
function canonicalCodexCatalogHome(value) {
|
|
113
|
-
const resolved = path.resolve(value);
|
|
114
|
-
try {
|
|
115
|
-
return fs.realpathSync.native(resolved);
|
|
116
|
-
} catch {
|
|
117
|
-
return resolved;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
/** One canonical identity for catalog discovery and durable ownership rows. */
|
|
121
|
-
function codexCatalogHomeId(codexHome) {
|
|
122
|
-
return codexCatalogHomeIdFromCanonicalPath(canonicalCodexCatalogHome(codexHome));
|
|
123
|
-
}
|
|
124
|
-
/** Hashes lifecycle-prepared paths without repeating filesystem discovery. */
|
|
125
|
-
function codexCatalogHomeIdFromCanonicalPath(codexHome) {
|
|
126
|
-
return createHash("sha256").update("openclaw:codex-session-catalog-home:v1\0").update(codexHome).digest("hex");
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
213
|
//#region extensions/codex/src/session-catalog-events.ts
|
|
130
214
|
const getCatalogEvents = defineCodexBuildState("openclaw.codexCatalogEvents", () => ({
|
|
131
215
|
listeners: /* @__PURE__ */ new Map(),
|
|
@@ -143,6 +227,15 @@ const CATALOG_NOTIFICATION_METHODS = /* @__PURE__ */ new Set([
|
|
|
143
227
|
"thread/status/changed",
|
|
144
228
|
"thread/settings/updated"
|
|
145
229
|
]);
|
|
230
|
+
function notifyEphemeralThread(homeKey, rawId) {
|
|
231
|
+
const id = boundedCatalogString(rawId, 256);
|
|
232
|
+
if (!id) return;
|
|
233
|
+
for (const listener of getCatalogEvents().listeners.get(homeKey) ?? []) try {
|
|
234
|
+
listener.onEphemeralThread?.(id);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
embeddedAgentLog.warn("Codex catalog ephemeral observer failed", { error });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
146
239
|
/** Uses prepared local identity or resolves it once during client/index startup. */
|
|
147
240
|
async function codexCatalogResidentHomeKey(params) {
|
|
148
241
|
if (inferCodexAppServerConnectionClass(params.startOptions) === "remote") {
|
|
@@ -185,6 +278,7 @@ function observeCodexCatalogClient(client, params) {
|
|
|
185
278
|
});
|
|
186
279
|
if (client.getCloseError()) return;
|
|
187
280
|
const source = codexCatalogSourceForClient(client);
|
|
281
|
+
observeCodexCatalogEphemeralThreads(source, notifyEphemeralThread.bind(void 0, homeKey));
|
|
188
282
|
const notifyLifecycle = (callback) => {
|
|
189
283
|
for (const listener of state.listeners.get(homeKey) ?? []) try {
|
|
190
284
|
listener[callback]?.(source);
|
|
@@ -198,7 +292,10 @@ function observeCodexCatalogClient(client, params) {
|
|
|
198
292
|
const readThread = async (threadId) => (await client.request("thread/read", {
|
|
199
293
|
threadId,
|
|
200
294
|
includeTurns: false
|
|
201
|
-
}, {
|
|
295
|
+
}, {
|
|
296
|
+
timeoutMs: 6e4,
|
|
297
|
+
catalogPreview: true
|
|
298
|
+
})).thread;
|
|
202
299
|
const stopNotifications = client.addNotificationHandler((event) => {
|
|
203
300
|
if (!CATALOG_NOTIFICATION_METHODS.has(event.method)) return;
|
|
204
301
|
for (const listener of state.listeners.get(homeKey) ?? []) listener.notify(event, readThread, source);
|
|
@@ -247,4 +344,4 @@ async function publishPreparedResume(client, response) {
|
|
|
247
344
|
}
|
|
248
345
|
}
|
|
249
346
|
//#endregion
|
|
250
|
-
export {
|
|
347
|
+
export { isOpenClawManagedCodexThread as a, codexCatalogHomeIdFromCanonicalPath as c, createCodexAppServerStartupLifetime as d, getCurrentSharedClientEntry as f, retireSharedCodexAppServerClientsBeforeDesktopGeneration as g, retireSharedCodexAppServerClientIfCurrent as h, subscribeCodexCatalogEvents as i, closeRetiredSharedClientEntry as l, hasActiveSharedCodexAppServerWork as m, observeCodexCatalogClient as n, readCodexSessionMeta as o, getSharedCodexAppServerClientState as p, publishCodexCatalogResume as r, codexCatalogHomeId as s, codexCatalogResidentHomeKey as t, closeRetiredSharedClientEntryIfIdle as u };
|