@openclaw/codex 2026.9.8 → 2026.10.1-beta.1
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 +8 -0
- package/dist/.setup/{account-usage-runtime-G348lY1q.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-Cqb-YoCS.mjs → apply-D02fLpgN.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-BJ5Z_olH.mjs → attempt-workspace-context-CbSzT6V2.mjs} +11 -15
- package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
- package/dist/.setup/{auth-cache-key-Dnps4W4_.mjs → auth-cache-key-CEd9QlIs.mjs} +244 -82
- package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
- package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
- package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
- package/dist/.setup/{bounded-turn-BNunZPtz.mjs → bounded-turn-DlHlNTyS.mjs} +14 -13
- package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
- package/dist/.setup/{build-state-DIQ5O_-S.mjs → build-state-CIi3Ckqu.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-qyUBJlGZ.mjs → client-CBzEVDyb.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-Btrs1D6f.mjs → command-dispatch-BE_RdMou.mjs} +3 -3
- package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
- package/dist/.setup/{command-handlers-DvlCHJch.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
- package/dist/.setup/{command-rpc-skzRq4wD.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
- package/dist/.setup/{compact-8ttks5U5.mjs → compact-BLSAd-ru.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-BRwtRct9.mjs → computer-use-DpolvQHw.mjs} +65 -202
- package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
- package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
- package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
- package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
- package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
- package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
- package/dist/.setup/{conversation-binding-74LaGGH-.mjs → conversation-binding-CgSSD1Qz.mjs} +36 -48
- package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
- package/dist/.setup/{conversation-control-OrN6zuaY.mjs → conversation-control-tCg763cI.mjs} +19 -21
- package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
- package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
- package/dist/.setup/dynamic-tool-build-CVrx02cH.mjs +463 -0
- package/dist/.setup/{dynamic-tools-Db2sY5cZ.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-Bi6-SQ7i.mjs → effective-mcp-catalog-BysTBZCW.mjs} +83 -11
- package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
- package/dist/.setup/{ephemeral-turn-DiCS1ijR.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-MV_1dj-3.mjs → event-projector-assistant-message-YCL2wspu.mjs} +2 -2
- package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
- package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
- package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
- package/dist/.setup/{isolated-completion-D80IXfQF.mjs → isolated-completion-D5gbKm6k.mjs} +8 -8
- package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
- package/dist/.setup/mcp-app-session-preparation-CdqsXwZX.mjs +223 -0
- package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
- package/dist/.setup/{model-catalog-DiC0Tkha.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
- package/dist/.setup/{models-DfLmPV0k.mjs → models-Du_i5G_t.mjs} +10 -7
- package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
- package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
- package/dist/.setup/native-mcp-app-DV7VbfzF.mjs +310 -0
- package/dist/.setup/{native-subagent-monitor-BwkQXf9e.mjs → native-subagent-monitor-CCEFO6qK.mjs} +235 -318
- package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
- package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
- package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
- package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
- package/dist/.setup/{plan-DPdMk1Oy.mjs → plan-CUHSIOep.mjs} +67 -89
- package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
- package/dist/.setup/plugin-approval-roundtrip-uAR-oQfr.mjs +109 -0
- package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
- package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
- package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
- package/dist/.setup/plugin-thread-config-deadline-CdRzGJt4.mjs +124 -0
- package/dist/.setup/{provider-D6F_7p1I.mjs → provider-BP8ZaZqn.mjs} +4 -4
- package/dist/.setup/provider-capabilities-Z5ZbBxqP.mjs +50 -0
- package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
- package/dist/.setup/{request-BZOfsSXW.mjs → request-BH3FvYUE.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-dYJhjZrp.mjs → run-attempt-CgvFoW7R.mjs} +553 -727
- package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
- package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
- package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
- package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
- package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
- package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
- package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
- package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
- package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
- package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
- package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
- package/dist/.setup/{session-catalog-events-BMCFMZw-.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-DwJjnF5k.mjs → session-catalog-index-DPICGlxr.mjs} +361 -72
- package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
- package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
- package/dist/.setup/{session-catalog-native-projection-CuaFZuQE.mjs → session-catalog-native-projection-CTBd4EUm.mjs} +7 -6
- package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
- package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
- package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
- package/dist/.setup/{session-catalog-projection-CGfzfP93.mjs → session-catalog-projection-CE0_Hffi.mjs} +6 -122
- package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
- package/dist/.setup/{session-cli-DlmBHYIe.mjs → session-cli-kH4vuGod.mjs} +1 -2
- package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
- package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
- package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
- package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
- package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
- package/dist/.setup/{session-retirement-LlYWBKTJ.mjs → session-retirement-aC60o6P3.mjs} +14 -15
- package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
- package/dist/.setup/{settled-turn-finalizer-DW9W3gza.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
- package/dist/.setup/{shared-client-CJCTeFpQ.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-DG5qbsUZ.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
- package/dist/.setup/{side-question-BLeGj7TQ.mjs → side-question-B7T0_GEC.mjs} +99 -91
- package/dist/.setup/{source-CJis_1EF.mjs → source-DH70LqN0.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-_bAbjedG.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
- package/dist/.setup/{thread-ownership-B6pPt21M.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
- package/dist/.setup/{thread-policy-gNPzzpVp.mjs → thread-policy-CXZV97TS.mjs} +22 -21
- package/dist/.setup/{thread-requests-OWGOiDaV.mjs → thread-requests-COrRJcZb.mjs} +107 -98
- package/dist/.setup/{thread-resume-GOry0AYh.mjs → thread-resume-rx7J68Rx.mjs} +10 -18
- package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
- package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
- package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
- package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
- package/dist/.setup/{attempt-client-cleanup-B-S7ngS_.mjs → turn-router-CX1-EoCp.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-gkdRj2yH.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
- package/dist/.setup/{usage-CApUvLOV.mjs → usage-Dmx7B0W2.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-wSMQkbpV.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-UKgeiBUG.mjs → web-search-provider.runtime-CsVmqbFm.mjs} +4 -20
- package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
- package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
- package/dist/api.js +34 -54
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +15 -27
- package/dist/harness.js +37 -22
- package/dist/index.js +2880 -276
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +2 -0
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +33 -4
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +3 -3
- package/package.json +6 -6
- package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
- package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
- package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
- package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
- package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
- package/dist/.setup/session-catalog-BFafIiF6.mjs +0 -2599
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
- package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +0 -153
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { n as defineCodexBuildState } from "./build-state-
|
|
2
|
-
import { u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-
|
|
3
|
-
import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-
|
|
1
|
+
import { n as defineCodexBuildState } from "./build-state-CIi3Ckqu.mjs";
|
|
2
|
+
import { u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-C1VFoVPf.mjs";
|
|
3
|
+
import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-a0HDa2Mj.mjs";
|
|
4
|
+
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
5
6
|
import fs, { constants, existsSync, watch } from "node:fs";
|
|
6
7
|
import path from "node:path";
|
|
@@ -8,6 +9,7 @@ import os from "node:os";
|
|
|
8
9
|
import fs$1 from "node:fs/promises";
|
|
9
10
|
import { extractErrorCode } from "openclaw/plugin-sdk/error-runtime";
|
|
10
11
|
import { sha256File } from "openclaw/plugin-sdk/file-access-runtime";
|
|
12
|
+
import { sleepWithAbort } from "openclaw/plugin-sdk/retry-runtime";
|
|
11
13
|
import { readSecretFile } from "openclaw/plugin-sdk/secret-file";
|
|
12
14
|
//#region extensions/codex/src/app-server/desktop-generation-fingerprint.ts
|
|
13
15
|
const MAX_COMPUTER_USE_PLUGIN_TREE_ENTRIES = 4096;
|
|
@@ -139,7 +141,6 @@ function createCodexDesktopGenerationOwner(params) {
|
|
|
139
141
|
let invalidation = 0;
|
|
140
142
|
let dirty = false;
|
|
141
143
|
let refresh;
|
|
142
|
-
let stopped = false;
|
|
143
144
|
const markDirty = () => {
|
|
144
145
|
invalidation += 1;
|
|
145
146
|
dirty = true;
|
|
@@ -148,13 +149,13 @@ function createCodexDesktopGenerationOwner(params) {
|
|
|
148
149
|
if (refresh) return refresh;
|
|
149
150
|
refresh = (async () => {
|
|
150
151
|
for (;;) {
|
|
151
|
-
|
|
152
|
+
params.signal.throwIfAborted();
|
|
152
153
|
const observedInvalidation = invalidation;
|
|
153
154
|
const first = await params.readFingerprint();
|
|
154
|
-
await
|
|
155
|
-
|
|
155
|
+
await sleepWithAbort(SETTLE_DELAY_MS, params.signal, { ref: false });
|
|
156
|
+
params.signal.throwIfAborted();
|
|
156
157
|
const second = await params.readFingerprint();
|
|
157
|
-
|
|
158
|
+
params.signal.throwIfAborted();
|
|
158
159
|
if (observedInvalidation !== invalidation || first !== second) continue;
|
|
159
160
|
const previous = generation;
|
|
160
161
|
generation = previous?.fingerprint === second ? previous : {
|
|
@@ -178,17 +179,12 @@ function createCodexDesktopGenerationOwner(params) {
|
|
|
178
179
|
markDirty();
|
|
179
180
|
return reconcile();
|
|
180
181
|
},
|
|
181
|
-
isCurrent: (candidate) => Boolean(candidate && !dirty && generation && candidate.epoch === generation.epoch && candidate.fingerprint === generation.fingerprint),
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
isCurrent: (candidate) => Boolean(candidate && !params.signal.aborted && !dirty && generation && candidate.epoch === generation.epoch && candidate.fingerprint === generation.fingerprint),
|
|
183
|
+
waitForIdle: async () => {
|
|
184
|
+
await refresh?.catch(() => {});
|
|
184
185
|
}
|
|
185
186
|
};
|
|
186
187
|
}
|
|
187
|
-
function delay(ms) {
|
|
188
|
-
return new Promise((resolve) => {
|
|
189
|
-
setTimeout(resolve, ms);
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
188
|
//#endregion
|
|
193
189
|
//#region extensions/codex/src/app-server/desktop-generation.ts
|
|
194
190
|
/** Lifecycle-owned generation for managed macOS Codex desktop artifacts. */
|
|
@@ -210,6 +206,7 @@ function createCodexDesktopGenerationService(params, runtime = {
|
|
|
210
206
|
watchPath: (watchedPath, options, listener) => watch(watchedPath, options, listener)
|
|
211
207
|
}) {
|
|
212
208
|
return {
|
|
209
|
+
apiVersion: 2,
|
|
213
210
|
id: "codex-desktop-generation",
|
|
214
211
|
async start(ctx) {
|
|
215
212
|
if (runtime.platform !== "darwin") return;
|
|
@@ -217,6 +214,7 @@ function createCodexDesktopGenerationService(params, runtime = {
|
|
|
217
214
|
current.context = ctx;
|
|
218
215
|
current.runtime = { ...runtime };
|
|
219
216
|
current.owner = createCodexDesktopGenerationOwner({
|
|
217
|
+
signal: ctx.scheduler.signal,
|
|
220
218
|
readFingerprint: runtime.readFingerprint,
|
|
221
219
|
onGenerationChange: params.onGenerationChange,
|
|
222
220
|
initialGeneration: current.lastGeneration
|
|
@@ -226,46 +224,41 @@ function createCodexDesktopGenerationService(params, runtime = {
|
|
|
226
224
|
},
|
|
227
225
|
async stop() {
|
|
228
226
|
const current = state();
|
|
227
|
+
const owner = current.owner;
|
|
228
|
+
const scheduler = current.context?.scheduler;
|
|
229
|
+
scheduler?.beginClose();
|
|
229
230
|
current.lastGeneration = current.owner?.read() ?? current.lastGeneration;
|
|
230
|
-
current.owner?.stop();
|
|
231
231
|
current.owner = void 0;
|
|
232
232
|
current.armEpoch = (current.armEpoch ?? 0) + 1;
|
|
233
233
|
current.context = void 0;
|
|
234
234
|
current.runtime = void 0;
|
|
235
235
|
current.watchHealthy = void 0;
|
|
236
236
|
current.rearmDelayMs = void 0;
|
|
237
|
-
|
|
238
|
-
clearTimeout(current.rearmTimer);
|
|
239
|
-
current.rearmTimer = void 0;
|
|
240
|
-
}
|
|
237
|
+
current.rearmPending = false;
|
|
241
238
|
closeWatchers(current);
|
|
239
|
+
await Promise.all([scheduler?.stop(), owner?.waitForIdle()]);
|
|
242
240
|
}
|
|
243
241
|
};
|
|
244
242
|
}
|
|
245
243
|
function armWatchers(current) {
|
|
246
244
|
const owner = current.owner;
|
|
247
|
-
|
|
245
|
+
const runtime = current.runtime;
|
|
246
|
+
if (!owner || !runtime || current.watchers) return false;
|
|
248
247
|
const armEpoch = (current.armEpoch ?? 0) + 1;
|
|
249
248
|
current.armEpoch = armEpoch;
|
|
250
249
|
const watchers = /* @__PURE__ */ new Set();
|
|
251
250
|
current.watchers = watchers;
|
|
252
251
|
const candidateNames = new Set(resolveMacOSDesktopCodexAppPathCandidates("darwin").map((candidate) => candidate.appName));
|
|
253
252
|
let complete = true;
|
|
254
|
-
for (const watchedPath of
|
|
255
|
-
if (!
|
|
253
|
+
for (const watchedPath of runtime.resolveWatchPaths()) {
|
|
254
|
+
if (!runtime.pathExists(watchedPath)) continue;
|
|
256
255
|
try {
|
|
257
|
-
const watcher =
|
|
256
|
+
const watcher = runtime.watchPath(watchedPath, { recursive: watchedPath !== APPLICATIONS_PATH }, (_eventType, filename) => {
|
|
258
257
|
if (!isCurrentArm(current, owner, watchers, armEpoch)) return;
|
|
259
258
|
if (watchedPath === APPLICATIONS_PATH && filename && !candidateNames.has(filename.toString().split(path.sep)[0] ?? "")) return;
|
|
260
259
|
owner.markDirty();
|
|
261
260
|
scheduleRearm(current, owner);
|
|
262
261
|
});
|
|
263
|
-
if (!watcher) {
|
|
264
|
-
complete = false;
|
|
265
|
-
reportWatcherFailure(current, owner, /* @__PURE__ */ new Error(`Could not watch ${watchedPath}`));
|
|
266
|
-
scheduleRearm(current, owner);
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
262
|
watchers.add(watcher);
|
|
270
263
|
watcher.on("error", (error) => {
|
|
271
264
|
if (!isCurrentArm(current, owner, watchers, armEpoch)) return;
|
|
@@ -290,30 +283,31 @@ function reportWatcherFailure(current, owner, error) {
|
|
|
290
283
|
current.context?.logger.warn(`codex desktop generation watcher failed: ${String(error)}`);
|
|
291
284
|
}
|
|
292
285
|
function isCurrentArm(current, owner, watchers, armEpoch) {
|
|
293
|
-
return current.owner === owner && current.watchers === watchers && current.armEpoch === armEpoch;
|
|
286
|
+
return current.owner === owner && !current.context?.scheduler.signal.aborted && current.watchers === watchers && current.armEpoch === armEpoch;
|
|
294
287
|
}
|
|
295
288
|
function scheduleRearm(current, owner) {
|
|
296
|
-
if (current.
|
|
297
|
-
if (current.watchHealthy === false) return;
|
|
298
|
-
clearTimeout(current.rearmTimer);
|
|
299
|
-
}
|
|
289
|
+
if (current.rearmPending && current.watchHealthy === false) return;
|
|
300
290
|
const delayMs = current.watchHealthy === false ? current.rearmDelayMs ?? REARM_INITIAL_DELAY_MS : REARM_INITIAL_DELAY_MS;
|
|
301
291
|
if (current.watchHealthy === false) current.rearmDelayMs = Math.min(delayMs * 2, REARM_MAX_DELAY_MS);
|
|
302
|
-
current.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
292
|
+
current.rearmPending = true;
|
|
293
|
+
current.context?.scheduler.schedule({
|
|
294
|
+
id: "watcher-rearm",
|
|
295
|
+
delayMs,
|
|
296
|
+
run: async () => {
|
|
297
|
+
current.rearmPending = false;
|
|
298
|
+
if (current.owner !== owner || current.context?.scheduler.signal.aborted) return;
|
|
299
|
+
const wasUnhealthy = current.watchHealthy === false;
|
|
300
|
+
closeWatchers(current);
|
|
301
|
+
if (!armWatchers(current) || wasUnhealthy) owner.markDirty();
|
|
302
|
+
await refreshGeneration(current, owner, owner.wait());
|
|
303
|
+
}
|
|
304
|
+
});
|
|
311
305
|
}
|
|
312
306
|
function refreshGeneration(current, owner, refresh) {
|
|
313
|
-
refresh.then(() => {
|
|
314
|
-
if (current.owner === owner && current.watchHealthy) current.context?.serviceHealth?.clearFailure();
|
|
307
|
+
return refresh.then(() => {
|
|
308
|
+
if (current.owner === owner && !current.context?.scheduler.signal.aborted && current.watchHealthy) current.context?.serviceHealth?.clearFailure();
|
|
315
309
|
}).catch((error) => {
|
|
316
|
-
if (current.owner !== owner) return;
|
|
310
|
+
if (current.owner !== owner || current.context?.scheduler.signal.aborted) return;
|
|
317
311
|
current.context?.serviceHealth?.reportFailure(error);
|
|
318
312
|
current.context?.logger.warn(`codex desktop generation refresh failed: ${String(error)}`);
|
|
319
313
|
});
|
|
@@ -324,6 +318,198 @@ function closeWatchers(current) {
|
|
|
324
318
|
for (const watcher of watchers ?? []) watcher.close();
|
|
325
319
|
}
|
|
326
320
|
//#endregion
|
|
321
|
+
//#region extensions/codex/src/app-server/shared-client-lifecycle.ts
|
|
322
|
+
/** Client ownership and synchronous retirement, independent of startup/auth execution. */
|
|
323
|
+
function observeAcquire(options, observation) {
|
|
324
|
+
try {
|
|
325
|
+
options?.onAcquireObservation?.(observation);
|
|
326
|
+
} catch {}
|
|
327
|
+
}
|
|
328
|
+
function observeSharedClientAcquire(entry, options) {
|
|
329
|
+
const observer = (boundary) => observeAcquire(options, { boundary });
|
|
330
|
+
if (options?.onAcquireObservation) (entry.acquireBoundaryObservers ??= /* @__PURE__ */ new Set()).add(observer);
|
|
331
|
+
observeAcquire(options, {
|
|
332
|
+
boundary: entry.acquireBoundary ?? "entry-selection",
|
|
333
|
+
startup: entry.startup ? entry.acquireBoundary === "ready" ? "ready-cache-hit" : "joined-shared" : "created-shared"
|
|
334
|
+
});
|
|
335
|
+
return () => entry.acquireBoundaryObservers?.delete(observer);
|
|
336
|
+
}
|
|
337
|
+
function recordSharedClientAcquireBoundary(entry, boundary) {
|
|
338
|
+
entry.acquireBoundary = boundary;
|
|
339
|
+
for (const observer of entry.acquireBoundaryObservers ?? []) observer(boundary);
|
|
340
|
+
}
|
|
341
|
+
function getOrCreateSharedClientEntry(state, key) {
|
|
342
|
+
let entry = state.clients.get(key);
|
|
343
|
+
if (!entry) {
|
|
344
|
+
entry = {
|
|
345
|
+
key,
|
|
346
|
+
activeLeases: 0,
|
|
347
|
+
anonymousLeases: 0,
|
|
348
|
+
pendingAcquires: 0,
|
|
349
|
+
closeWhenIdle: false,
|
|
350
|
+
onStartedClientCallbacks: /* @__PURE__ */ new Set()
|
|
351
|
+
};
|
|
352
|
+
state.clients.set(key, entry);
|
|
353
|
+
}
|
|
354
|
+
return entry;
|
|
355
|
+
}
|
|
356
|
+
function closeSharedClientEntryIfUnclaimed(entry) {
|
|
357
|
+
if (entry.activeLeases > 0 || entry.pendingAcquires > 0) return false;
|
|
358
|
+
const state = getSharedCodexAppServerClientState();
|
|
359
|
+
if (state.clients.get(entry.key) !== entry) return false;
|
|
360
|
+
state.clients.delete(entry.key);
|
|
361
|
+
entry.client?.close();
|
|
362
|
+
return Boolean(entry.client);
|
|
363
|
+
}
|
|
364
|
+
const createCodexAppServerStartupLifetime = () => ({
|
|
365
|
+
controller: new AbortController(),
|
|
366
|
+
pending: /* @__PURE__ */ new Set()
|
|
367
|
+
});
|
|
368
|
+
function ownCodexStartup(lifetime, operation) {
|
|
369
|
+
lifetime.pending.add(operation);
|
|
370
|
+
const release = () => lifetime.pending.delete(operation);
|
|
371
|
+
operation.then(release, release);
|
|
372
|
+
return operation;
|
|
373
|
+
}
|
|
374
|
+
const getSharedCodexAppServerClientState = defineCodexBuildState("openclaw.codexAppServerClientState", () => ({
|
|
375
|
+
clients: /* @__PURE__ */ new Map(),
|
|
376
|
+
liveClients: /* @__PURE__ */ new Set(),
|
|
377
|
+
isolatedClients: /* @__PURE__ */ new Set(),
|
|
378
|
+
entriesByClient: /* @__PURE__ */ new WeakMap(),
|
|
379
|
+
desktopGenerationDrainChecks: /* @__PURE__ */ new Set(),
|
|
380
|
+
startup: createCodexAppServerStartupLifetime(),
|
|
381
|
+
startMetadata: /* @__PURE__ */ new WeakMap()
|
|
382
|
+
}));
|
|
383
|
+
function hasActiveSharedCodexAppServerWork() {
|
|
384
|
+
const state = getSharedCodexAppServerClientState();
|
|
385
|
+
if (state.startup.pending.size > 0 || state.startup.controller.signal.aborted) return true;
|
|
386
|
+
for (const entry of state.clients.values()) if (entry.activeLeases > 0 || entry.pendingAcquires > 0) return true;
|
|
387
|
+
for (const client of state.liveClients) {
|
|
388
|
+
const entry = state.entriesByClient.get(client);
|
|
389
|
+
if (entry && (entry.activeLeases > 0 || entry.pendingAcquires > 0)) return true;
|
|
390
|
+
}
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
function getCurrentSharedClientEntry(client) {
|
|
394
|
+
const state = getSharedCodexAppServerClientState();
|
|
395
|
+
const entry = client ? state.entriesByClient.get(client) : void 0;
|
|
396
|
+
return entry && entry.client === client && state.clients.get(entry.key) === entry ? entry : void 0;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Retires a matching shared client. Default is graceful: detach from the map
|
|
400
|
+
* (future acquisitions get a fresh client) and close once leases drain.
|
|
401
|
+
* `failActiveLeases` is for suspect clients only (timed-out turns): it closes
|
|
402
|
+
* the physical connection immediately so co-leased attempts hit the normal
|
|
403
|
+
* client-closed retry path, and pending acquires reject instead of leasing
|
|
404
|
+
* the poisoned process. Routine cleanup must NOT use it — it would abort
|
|
405
|
+
* healthy sibling turns on a working client.
|
|
406
|
+
*/
|
|
407
|
+
function retireSharedCodexAppServerClientIfCurrent(client, opts) {
|
|
408
|
+
if (!client) return;
|
|
409
|
+
const state = getSharedCodexAppServerClientState();
|
|
410
|
+
const currentEntry = getCurrentSharedClientEntry(client);
|
|
411
|
+
const entry = currentEntry ?? state.entriesByClient.get(client);
|
|
412
|
+
if (!entry || entry.client !== client && !entry.closeError) return;
|
|
413
|
+
if (currentEntry) {
|
|
414
|
+
state.clients.delete(entry.key);
|
|
415
|
+
entry.closeWhenIdle = true;
|
|
416
|
+
}
|
|
417
|
+
if (opts?.failActiveLeases && (currentEntry || !entry.closeError)) {
|
|
418
|
+
entry.closeError = /* @__PURE__ */ new Error("codex app-server client is closed");
|
|
419
|
+
return {
|
|
420
|
+
activeLeases: entry.activeLeases,
|
|
421
|
+
closed: closeRetiredSharedClientEntry(entry)
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
activeLeases: entry.activeLeases,
|
|
426
|
+
closed: currentEntry ? closeRetiredSharedClientEntryIfIdle(entry) : false
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
/** Gracefully retires exact clients attached to an older desktop generation. */
|
|
430
|
+
function retireSharedCodexAppServerClientsBeforeDesktopGeneration(generation) {
|
|
431
|
+
const state = getSharedCodexAppServerClientState();
|
|
432
|
+
for (const entry of state.clients.values()) {
|
|
433
|
+
const client = entry.client;
|
|
434
|
+
const attached = client ? state.startMetadata.get(client) : void 0;
|
|
435
|
+
if (client && attached?.desktopGeneration && attached.desktopGeneration.epoch < generation.epoch) retireSharedCodexAppServerClientIfCurrent(client);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
function closeRetiredSharedClientEntryIfIdle(entry) {
|
|
439
|
+
if (!entry.closeWhenIdle || entry.activeLeases > 0 || entry.pendingAcquires > 0 || !entry.client) return false;
|
|
440
|
+
entry.closeWhenIdle = false;
|
|
441
|
+
return closeRetiredSharedClientEntry(entry);
|
|
442
|
+
}
|
|
443
|
+
function closeRetiredSharedClientEntry(entry) {
|
|
444
|
+
const client = entry.client;
|
|
445
|
+
if (!client) return false;
|
|
446
|
+
entry.client = void 0;
|
|
447
|
+
client.close();
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
function retirePendingSharedClientEntryIfUnclaimed(entry) {
|
|
451
|
+
if (entry.activeLeases > 0 || entry.pendingAcquires > 0) return;
|
|
452
|
+
entry.startupAbort?.abort(/* @__PURE__ */ new Error("Codex app-server startup was abandoned"));
|
|
453
|
+
entry.closeWhenIdle = true;
|
|
454
|
+
const state = getSharedCodexAppServerClientState();
|
|
455
|
+
if (state.clients.get(entry.key) === entry) state.clients.delete(entry.key);
|
|
456
|
+
if (!entry.client) return;
|
|
457
|
+
closeRetiredSharedClientEntry(entry);
|
|
458
|
+
}
|
|
459
|
+
/** Failed final claimants join physical cleanup; healthy peers keep their startup. */
|
|
460
|
+
async function waitForUnclaimedSharedClientStartup(entry) {
|
|
461
|
+
if (!entry.startupTransport || entry.activeLeases > 0 || entry.pendingAcquires > 0) return;
|
|
462
|
+
await entry.startupTransport.then((client) => client.closeAndWait(), () => {});
|
|
463
|
+
}
|
|
464
|
+
/** Exit registration also observes transports that have already terminated. */
|
|
465
|
+
function waitForCodexAppServerClientExit(client) {
|
|
466
|
+
const metadata = getSharedCodexAppServerClientState().startMetadata.get(client);
|
|
467
|
+
const exited = metadata?.transportExit ?? new Promise((resolve) => {
|
|
468
|
+
client.addTransportExitHandler(() => resolve());
|
|
469
|
+
});
|
|
470
|
+
if (metadata) metadata.transportExit = exited;
|
|
471
|
+
return exited;
|
|
472
|
+
}
|
|
473
|
+
/** Acquire the recorded owner atomically, or join its exit before a replacement writes. */
|
|
474
|
+
async function retainSharedCodexAppServerClientByInstanceId(clientId) {
|
|
475
|
+
const id = clientId?.trim();
|
|
476
|
+
if (!id) return;
|
|
477
|
+
const state = getSharedCodexAppServerClientState();
|
|
478
|
+
for (const client of state.liveClients) {
|
|
479
|
+
if (client.getInstanceId() !== id) continue;
|
|
480
|
+
const entry = state.entriesByClient.get(client);
|
|
481
|
+
if (entry?.client !== client || entry.closeError || client.getCloseError()) {
|
|
482
|
+
await waitForCodexAppServerClientExit(client);
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
const release = retainSharedClientEntry(entry);
|
|
486
|
+
return {
|
|
487
|
+
client,
|
|
488
|
+
release: (waitForRetirement = false) => {
|
|
489
|
+
release();
|
|
490
|
+
return client.getCloseError() || waitForRetirement && entry.closeWhenIdle ? waitForCodexAppServerClientExit(client) : void 0;
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
function notifyDesktopGenerationDrainChecks(state) {
|
|
496
|
+
for (const check of state.desktopGenerationDrainChecks) check();
|
|
497
|
+
}
|
|
498
|
+
function retainSharedClientEntry(entry, counter = "activeLeases") {
|
|
499
|
+
let released = false;
|
|
500
|
+
entry[counter] += 1;
|
|
501
|
+
return () => {
|
|
502
|
+
if (released) return;
|
|
503
|
+
released = true;
|
|
504
|
+
releaseSharedClientEntry(entry, counter);
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
function releaseSharedClientEntry(entry, counter) {
|
|
508
|
+
entry[counter] -= 1;
|
|
509
|
+
closeRetiredSharedClientEntryIfIdle(entry);
|
|
510
|
+
notifyDesktopGenerationDrainChecks(getSharedCodexAppServerClientState());
|
|
511
|
+
}
|
|
512
|
+
//#endregion
|
|
327
513
|
//#region extensions/codex/src/app-server/auth-cache-key.ts
|
|
328
514
|
/** Auth cache identity and native CLI credential reads, without login or refresh. */
|
|
329
515
|
const CODEX_HOME_ENV_VAR = "CODEX_HOME";
|
|
@@ -331,21 +517,11 @@ const HOME_ENV_VAR = "HOME";
|
|
|
331
517
|
const CODEX_HOME_DIRNAME = ".codex";
|
|
332
518
|
const CODEX_AUTH_JSON_FILENAME = "auth.json";
|
|
333
519
|
const CODEX_APP_SERVER_API_KEY_ENV_VARS = ["CODEX_API_KEY", "OPENAI_API_KEY"];
|
|
334
|
-
function resolveCodexAppServerEnvApiKeyCacheKey(params) {
|
|
335
|
-
if (params.startOptions.transport !== "stdio") return;
|
|
336
|
-
const apiKey = readFirstNonEmptyEnvEntry(resolveCodexAppServerSpawnEnv(params.startOptions, params.baseEnv ?? process.env, params.platform ?? process.platform), CODEX_APP_SERVER_API_KEY_ENV_VARS);
|
|
337
|
-
if (!apiKey) return;
|
|
338
|
-
const hash = createHash("sha256");
|
|
339
|
-
hash.update("openclaw:codex:app-server-env-api-key:v1");
|
|
340
|
-
hash.update("\0");
|
|
341
|
-
hash.update(apiKey.key);
|
|
342
|
-
hash.update("\0");
|
|
343
|
-
hash.update(apiKey.value);
|
|
344
|
-
return `${apiKey.key}:sha256:${hash.digest("hex")}`;
|
|
345
|
-
}
|
|
346
520
|
function resolveCodexAppServerFallbackApiKeyCacheKey(params) {
|
|
347
521
|
if (params.startOptions.transport !== "stdio") return;
|
|
348
|
-
|
|
522
|
+
const apiKey = readFirstNonEmptyEnvEntry(resolveCodexAppServerSpawnEnv(params.startOptions, params.baseEnv ?? process.env, params.platform ?? process.platform), CODEX_APP_SERVER_API_KEY_ENV_VARS);
|
|
523
|
+
if (!apiKey) return resolveCodexCliAuthFileApiKeyCacheKey(params.baseEnv ?? process.env);
|
|
524
|
+
return fingerprintAuthCacheKey(apiKey.key, "env-api-key", apiKey.key, apiKey.value);
|
|
349
525
|
}
|
|
350
526
|
/** Secret-free cache identity for an API key already resolved by the runtime plan. */
|
|
351
527
|
function resolveCodexAppServerPreparedApiKeyCacheKey(apiKey) {
|
|
@@ -353,25 +529,13 @@ function resolveCodexAppServerPreparedApiKeyCacheKey(apiKey) {
|
|
|
353
529
|
return resolved ? fingerprintApiKeyAuthProfileCacheKey(resolved) : void 0;
|
|
354
530
|
}
|
|
355
531
|
function fingerprintApiKeyAuthProfileCacheKey(apiKey) {
|
|
356
|
-
|
|
357
|
-
hash.update("openclaw:codex:app-server-auth-profile-api-key:v1");
|
|
358
|
-
hash.update("\0");
|
|
359
|
-
hash.update(apiKey);
|
|
360
|
-
return `api_key:sha256:${hash.digest("hex")}`;
|
|
532
|
+
return fingerprintAuthCacheKey("api_key", "auth-profile-api-key", apiKey);
|
|
361
533
|
}
|
|
362
534
|
function fingerprintTokenAuthProfileCacheKey(accessToken) {
|
|
363
|
-
|
|
364
|
-
hash.update("openclaw:codex:app-server-auth-profile-token:v1");
|
|
365
|
-
hash.update("\0");
|
|
366
|
-
hash.update(accessToken);
|
|
367
|
-
return `token:sha256:${hash.digest("hex")}`;
|
|
535
|
+
return fingerprintAuthCacheKey("token", "auth-profile-token", accessToken);
|
|
368
536
|
}
|
|
369
|
-
function
|
|
370
|
-
|
|
371
|
-
hash.update("openclaw:codex:app-server-cli-auth-json-api-key:v1");
|
|
372
|
-
hash.update("\0");
|
|
373
|
-
hash.update(apiKey);
|
|
374
|
-
return `CODEX_AUTH_JSON:sha256:${hash.digest("hex")}`;
|
|
537
|
+
function fingerprintAuthCacheKey(prefix, domain, ...parts) {
|
|
538
|
+
return `${prefix}:sha256:${createHash("sha256").update(`openclaw:codex:app-server-${domain}:v1\0`).update(parts.join("\0")).digest("hex")}`;
|
|
375
539
|
}
|
|
376
540
|
function resolveCodexCliAuthFilePath(env) {
|
|
377
541
|
const configuredCodexHome = env[CODEX_HOME_ENV_VAR]?.trim();
|
|
@@ -393,9 +557,7 @@ function parseCodexCliAuthFileApiKey(raw) {
|
|
|
393
557
|
} catch {
|
|
394
558
|
return;
|
|
395
559
|
}
|
|
396
|
-
|
|
397
|
-
const apiKey = parsed.OPENAI_API_KEY;
|
|
398
|
-
return typeof apiKey === "string" && apiKey.trim() ? apiKey.trim() : void 0;
|
|
560
|
+
return isRecord(parsed) ? normalizeOptionalString(parsed.OPENAI_API_KEY) : void 0;
|
|
399
561
|
}
|
|
400
562
|
async function readCodexCliAuthFileApiKey(env) {
|
|
401
563
|
try {
|
|
@@ -407,7 +569,7 @@ async function readCodexCliAuthFileApiKey(env) {
|
|
|
407
569
|
function resolveCodexCliAuthFileApiKeyCacheKey(env) {
|
|
408
570
|
try {
|
|
409
571
|
const apiKey = parseCodexCliAuthFileApiKey(fs.readFileSync(resolveCodexCliAuthFilePath(env), "utf8"));
|
|
410
|
-
return apiKey ?
|
|
572
|
+
return apiKey ? fingerprintAuthCacheKey("CODEX_AUTH_JSON", "cli-auth-json-api-key", apiKey) : void 0;
|
|
411
573
|
} catch {
|
|
412
574
|
return;
|
|
413
575
|
}
|
|
@@ -425,4 +587,4 @@ function readFirstNonEmptyEnvEntry(env, keys) {
|
|
|
425
587
|
}
|
|
426
588
|
}
|
|
427
589
|
//#endregion
|
|
428
|
-
export { readCodexCliAuthFileApiKey as a, resolveCodexAppServerPreparedApiKeyCacheKey as c,
|
|
590
|
+
export { waitForCodexDesktopGeneration as A, retirePendingSharedClientEntryIfUnclaimed as C, waitForUnclaimedSharedClientStartup as D, waitForCodexAppServerClientExit as E, createCodexDesktopGenerationService as O, retainSharedCodexAppServerClientByInstanceId as S, retireSharedCodexAppServerClientsBeforeDesktopGeneration as T, observeSharedClientAcquire as _, readCodexCliAuthFileApiKey as a, releaseSharedClientEntry as b, resolveCodexAppServerPreparedApiKeyCacheKey as c, getCurrentSharedClientEntry as d, getOrCreateSharedClientEntry as f, observeAcquire as g, notifyDesktopGenerationDrainChecks as h, fingerprintTokenAuthProfileCacheKey as i, readCodexDesktopArtifactTreeFingerprint as j, isCodexDesktopGenerationCurrent as k, closeSharedClientEntryIfUnclaimed as l, hasActiveSharedCodexAppServerWork as m, CODEX_AUTH_JSON_FILENAME as n, readFirstNonEmptyEnv as o, getSharedCodexAppServerClientState as p, fingerprintApiKeyAuthProfileCacheKey as r, resolveCodexAppServerFallbackApiKeyCacheKey as s, CODEX_APP_SERVER_API_KEY_ENV_VARS as t, createCodexAppServerStartupLifetime as u, ownCodexStartup as v, retireSharedCodexAppServerClientIfCurrent as w, retainSharedClientEntry as x, recordSharedClientAcquireBoundary as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createCodexAuthProfileSelection } from "./auth-profile-selection-
|
|
1
|
+
import { n as createCodexAuthProfileSelection } from "./auth-profile-selection-hr8ocLtz.mjs";
|
|
2
2
|
import { embeddedAgentLog, resolveDefaultAgentDir } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
3
3
|
import { resolveProviderIdForAuth } from "openclaw/plugin-sdk/provider-auth-aliases";
|
|
4
4
|
import { ensureAuthProfileStore, resolveAuthProfileOrder } from "openclaw/plugin-sdk/provider-auth";
|
|
@@ -10,6 +10,7 @@ const { resolveCodexAppServerAuthProfileId, resolveCodexAppServerAuthProfileIdFo
|
|
|
10
10
|
ensureAuthProfileStore,
|
|
11
11
|
resolveAuthProfileOrder
|
|
12
12
|
});
|
|
13
|
+
/** Returns true when an auth profile uses native Codex/OpenAI app-server auth. */
|
|
13
14
|
function isCodexAppServerNativeAuthProfile(lookup) {
|
|
14
15
|
const authProfileId = lookup.authProfileId?.trim();
|
|
15
16
|
if (!authProfileId) return false;
|
package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs}
RENAMED
|
@@ -13,16 +13,14 @@ function createCodexAuthProfileSelection({ ensureAuthProfileStore, resolveAuthPr
|
|
|
13
13
|
})[0]?.trim();
|
|
14
14
|
}
|
|
15
15
|
function resolveCodexAppServerAuthProfileIdForAgent(params) {
|
|
16
|
+
const agentDir = params.agentDir?.trim() || resolveDefaultAgentDir(params.config ?? {});
|
|
16
17
|
const store = resolveCodexAppServerAuthProfileStore({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
authProfileStore: params.authProfileStore,
|
|
20
|
-
config: params.config
|
|
18
|
+
...params,
|
|
19
|
+
agentDir
|
|
21
20
|
});
|
|
22
21
|
return resolveCodexAppServerAuthProfileId({
|
|
23
|
-
|
|
24
|
-
store
|
|
25
|
-
config: params.config
|
|
22
|
+
...params,
|
|
23
|
+
store
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
26
|
function resolveCodexAppServerAuthProfileStore(params) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
1
|
+
import { t as __exportAll } from "./session-binding-sidecars-BrdV95Fg.mjs";
|
|
2
2
|
import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
3
3
|
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
4
4
|
//#region extensions/codex/src/app-server/binding-connection.ts
|
|
@@ -44,7 +44,7 @@ function requireCodexSupervisionModelSelection(binding) {
|
|
|
44
44
|
}
|
|
45
45
|
/** Registration publishes the resolver; connection policy loads only for an actual request. */
|
|
46
46
|
async function resolveCodexBindingAppServerConnection(params) {
|
|
47
|
-
return (await import("./binding-connection.runtime-
|
|
47
|
+
return (await import("./binding-connection.runtime-Dn2p-fdy.mjs")).resolveCodexBindingAppServerConnection(params, catalogHomes.tryGetRuntime());
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
export { setCodexCatalogConnectionHomeResolver as a, resolveCodexBindingAppServerConnection as i, binding_connection_exports as n, requireCodexSupervisionModelSelection as r, assertCodexSessionRuntimeOwnership as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as readCodexPluginConfig } from "./config-parsing-
|
|
1
|
+
import { d as readCodexPluginConfig } from "./config-parsing-BQq-CHTF.mjs";
|
|
2
2
|
import { n as resolveCodexAppServerLocalHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
3
|
-
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-
|
|
4
|
-
import { n as resolveCodexAppServerRuntimeOptions, r as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-runtime-
|
|
3
|
+
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BW8rd98k.mjs";
|
|
4
|
+
import { n as resolveCodexAppServerRuntimeOptions, r as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-runtime-cUYrqu_a.mjs";
|
|
5
5
|
//#region extensions/codex/src/app-server/binding-connection.runtime.ts
|
|
6
6
|
/** Resolves connection and auth ownership exclusively from the private thread binding. */
|
|
7
7
|
async function resolveCodexBindingAppServerConnection(params, discoverHomes) {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
2
|
import { a as resolveCodexPrivateLauncher, i as readCodexAppServerConfigOptions } from "./launch-args-DbFCehO7.mjs";
|
|
3
|
-
import { d as readCodexEffectiveConfig } from "./config-options-
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
3
|
+
import { d as readCodexEffectiveConfig } from "./config-options-HG_Rr3W_.mjs";
|
|
4
|
+
import { a as codexPrewriteRejectionCause } from "./rpc-error-hmWM21RB.mjs";
|
|
5
|
+
import "./config-0Gxk3_eq.mjs";
|
|
6
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-cUYrqu_a.mjs";
|
|
7
|
+
import { u as isCodexAppServerStartSelectionChangedError } from "./shared-client-DJJ3ljH2.mjs";
|
|
8
|
+
import { _ as assertCodexTurnStartResponse, b as readCodexErrorNotification, g as assertCodexThreadStartResponse, w as createCodexElicitationResponse } from "./client-CBzEVDyb.mjs";
|
|
9
|
+
import { o as closeCodexStartupClientBestEffort, s as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./attempt-client-cleanup-yLjGwbwT.mjs";
|
|
10
|
+
import { t as CodexEphemeralTurn } from "./ephemeral-turn-oPKxs3ia.mjs";
|
|
11
|
+
import { i as readModelListResult } from "./models-Du_i5G_t.mjs";
|
|
12
|
+
import { Ct as mergeCodexThreadConfigs, n as buildCodexRingZeroThreadConfigPatch, r as buildCodexRuntimeThreadConfig, t as assertCodexManagedRequirementsDoNotOverrideToolPolicy, u as readCodexInheritedMcpServerNames, z as attestCodexRestrictedToolSurfaceMcpServersDisabled } from "./thread-requests-COrRJcZb.mjs";
|
|
13
|
+
import { b as resolveCodexAppServerReasoningEffort } from "./thread-lifecycle-DkcoX9q-.mjs";
|
|
14
|
+
import { a as resolveCodexPromptError } from "./usage-limit-error-M8jVnITZ.mjs";
|
|
14
15
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
15
16
|
import { parse } from "smol-toml";
|
|
16
17
|
import path from "node:path";
|
|
@@ -144,7 +145,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
144
145
|
assertCurrent: params.assertCurrent,
|
|
145
146
|
...params.signal ? { abandonSignal: params.signal } : {}
|
|
146
147
|
};
|
|
147
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(clientOptions) : await import("./shared-client-
|
|
148
|
+
const client = params.options.clientFactory ? await params.options.clientFactory(clientOptions) : await import("./shared-client-DJJ3ljH2.mjs").then((n) => n.v).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
148
149
|
...clientOptions,
|
|
149
150
|
authProfileStore: params.authProfileStore
|
|
150
151
|
}));
|
|
@@ -271,7 +272,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
271
272
|
}
|
|
272
273
|
} catch (error) {
|
|
273
274
|
if (abortController.signal.aborted) throw resolveCodexBoundedTurnAbortError(abortController.signal, params.taskLabel, timeoutError);
|
|
274
|
-
if (!ownsClient || !isCodexAppServerStartSelectionChangedError(error) || selectionAttempt !== 0) throw error;
|
|
275
|
+
if (!ownsClient || !isCodexAppServerStartSelectionChangedError(error) || selectionAttempt !== 0) throw codexPrewriteRejectionCause(error);
|
|
275
276
|
} finally {
|
|
276
277
|
clearTimeout(timeout);
|
|
277
278
|
params.signal?.removeEventListener("abort", abortFromCaller);
|
package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as readCodexPluginConfig } from "./config-parsing-
|
|
1
|
+
import { d as readCodexPluginConfig } from "./config-parsing-BQq-CHTF.mjs";
|
|
2
2
|
import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
|
|
3
|
-
import { i as resolveCodexAppServerHomeScope } from "./config-options-
|
|
4
|
-
import "./config-
|
|
5
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-
|
|
3
|
+
import { i as resolveCodexAppServerHomeScope } from "./config-options-HG_Rr3W_.mjs";
|
|
4
|
+
import "./config-0Gxk3_eq.mjs";
|
|
5
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-cUYrqu_a.mjs";
|
|
6
6
|
//#region extensions/codex/src/app-server/bounded-turn-isolation.ts
|
|
7
7
|
function resolveCodexBoundedTurnIsolation(options) {
|
|
8
8
|
const pluginConfig = readCodexPluginConfig(options.pluginConfig);
|