@openclaw/codex 2026.9.7 → 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-DFhbh1zz.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-D3GcSoSa.mjs → apply-D02fLpgN.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-C5HigshI.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-Dbvq-QgB.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-CbjoN2OW.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-Da1_z0kd.mjs → build-state-CIi3Ckqu.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-N0JpgSzF.mjs → client-CBzEVDyb.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-5HHLdcde.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-BeAoaovI.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-ylTMS00z.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
- package/dist/.setup/{command-rpc-CGJGUQ6Y.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
- package/dist/.setup/{compact-C2WamavS.mjs → compact-BLSAd-ru.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-DsjsL1dr.mjs → computer-use-DpolvQHw.mjs} +66 -203
- 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-3Min8qvP.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-CEP8X5JC.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-DzlsLUuS.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-CxUtC-xG.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-CDsPJOa2.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-CigreO4K.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-Dm3PzxJk.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-PAuZgJC6.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
- package/dist/.setup/{models-DHXZtVVk.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-Dpsmf2wz.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-Y-QIvrKB.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-DH8NSzGt.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-BHZ1nz8d.mjs → request-BH3FvYUE.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-D8RZUOzY.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-DePDzzjc.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-CZvDzC6z.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-DjhwGL6x.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-Cr5qP5Dj.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-Cn_nCqfq.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-qMTxkNx2.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-BsvEabkw.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
- package/dist/.setup/{shared-client-DqyTMYug.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-CAxoF-X1.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
- package/dist/.setup/{side-question-C4kCmQy1.mjs → side-question-B7T0_GEC.mjs} +99 -91
- package/dist/.setup/{source-CS_7GFJZ.mjs → source-DH70LqN0.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-DPflntEJ.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
- package/dist/.setup/{thread-ownership-roNP0l1c.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
- package/dist/.setup/{thread-policy-DTd-DtkX.mjs → thread-policy-CXZV97TS.mjs} +22 -21
- package/dist/.setup/{thread-requests-B_bRnMGN.mjs → thread-requests-COrRJcZb.mjs} +107 -98
- package/dist/.setup/{thread-resume-CdDaoc7T.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-DOP-cW5j.mjs → turn-router-CX1-EoCp.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-CBeVjBpT.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
- package/dist/.setup/{usage-BMzNxeR_.mjs → usage-Dmx7B0W2.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-QXerDo3i.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-P77OUeoo.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-4sCdv5qx.mjs +0 -2610
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +0 -153
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { o as CatalogParamsError } from "./session-catalog-parsing-CPGaPYr-.mjs";
|
|
2
|
-
import { r as compareCodexCatalogRows } from "./session-catalog-index-order-BcQpHks3.mjs";
|
|
3
|
-
import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
|
|
4
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
5
|
-
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
6
|
-
//#region extensions/codex/src/session-catalog-availability.ts
|
|
7
|
-
var CodexCatalogLoadingError = class extends Error {
|
|
8
|
-
constructor() {
|
|
9
|
-
super("Codex session catalog is still loading. Retry shortly.");
|
|
10
|
-
this.code = "APP_SERVER_UNAVAILABLE";
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
/** One generation promise wakes cold callers; native pages remain owned by the index. */
|
|
14
|
-
var CodexCatalogAvailability = class {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.complete = false;
|
|
17
|
-
this.changed = createDeferred();
|
|
18
|
-
}
|
|
19
|
-
begin() {
|
|
20
|
-
this.failure = void 0;
|
|
21
|
-
}
|
|
22
|
-
publish(frontier, complete = false) {
|
|
23
|
-
if (this.complete) return;
|
|
24
|
-
if (frontier && (!this.frontier || compareCodexCatalogRows(frontier, this.frontier) > 0)) {
|
|
25
|
-
const { threadId, updatedAt, recencyAt, sourceOrder } = frontier;
|
|
26
|
-
this.frontier = {
|
|
27
|
-
threadId,
|
|
28
|
-
updatedAt,
|
|
29
|
-
recencyAt,
|
|
30
|
-
sourceOrder
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
this.complete = complete;
|
|
34
|
-
this.notify();
|
|
35
|
-
}
|
|
36
|
-
fail(error) {
|
|
37
|
-
this.failure = { error };
|
|
38
|
-
this.notify();
|
|
39
|
-
}
|
|
40
|
-
notify() {
|
|
41
|
-
const previous = this.changed;
|
|
42
|
-
this.changed = createDeferred();
|
|
43
|
-
previous.resolve();
|
|
44
|
-
}
|
|
45
|
-
async until(promise, deadline) {
|
|
46
|
-
const remaining = deadline - performance.now();
|
|
47
|
-
if (remaining <= 0) throw new CodexCatalogLoadingError();
|
|
48
|
-
return await withTimeout(promise, remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
49
|
-
}
|
|
50
|
-
async next(deadline) {
|
|
51
|
-
if (this.failure) throw this.failure.error;
|
|
52
|
-
await this.until(this.changed.promise, deadline);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region extensions/codex/src/session-catalog-list-request.ts
|
|
57
|
-
const listRequest = new AsyncLocalStorage();
|
|
58
|
-
function currentCodexCatalogListRequest() {
|
|
59
|
-
return listRequest.getStore();
|
|
60
|
-
}
|
|
61
|
-
/** One foreground request owns its native read budget and source-health outcome. */
|
|
62
|
-
var CodexCatalogListRequest = class {
|
|
63
|
-
constructor() {
|
|
64
|
-
this.pages = 0;
|
|
65
|
-
this.closed = false;
|
|
66
|
-
this.attempts = /* @__PURE__ */ new Map();
|
|
67
|
-
}
|
|
68
|
-
get hasPages() {
|
|
69
|
-
return this.pages < 20;
|
|
70
|
-
}
|
|
71
|
-
deadline(timeoutMs) {
|
|
72
|
-
this.assertActive();
|
|
73
|
-
return this.deadlineAt ??= performance.now() + timeoutMs;
|
|
74
|
-
}
|
|
75
|
-
constrainDeadline(absolute) {
|
|
76
|
-
this.assertActive();
|
|
77
|
-
this.deadlineAt = Math.min(this.deadlineAt ?? absolute, absolute);
|
|
78
|
-
return this.deadlineAt;
|
|
79
|
-
}
|
|
80
|
-
remaining(timeoutMs) {
|
|
81
|
-
const remaining = Math.min(timeoutMs, this.deadline(timeoutMs) - performance.now());
|
|
82
|
-
if (remaining <= 0) throw new CodexCatalogLoadingError();
|
|
83
|
-
return remaining;
|
|
84
|
-
}
|
|
85
|
-
assertActive() {
|
|
86
|
-
if (this.closed) throw new DOMException("Codex session catalog request is closed", "AbortError");
|
|
87
|
-
if (this.deadlineAt !== void 0 && this.deadlineAt <= performance.now()) throw new CodexCatalogLoadingError();
|
|
88
|
-
}
|
|
89
|
-
async run(run) {
|
|
90
|
-
this.assertActive();
|
|
91
|
-
const pending = listRequest.run(this, run);
|
|
92
|
-
const remaining = this.deadlineAt === void 0 ? void 0 : this.deadlineAt - performance.now();
|
|
93
|
-
if (remaining !== void 0 && remaining <= 0) {
|
|
94
|
-
pending.catch(() => {});
|
|
95
|
-
throw new CodexCatalogLoadingError();
|
|
96
|
-
}
|
|
97
|
-
const result = remaining === void 0 ? await pending : await withTimeout(pending, remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
98
|
-
this.assertActive();
|
|
99
|
-
return result;
|
|
100
|
-
}
|
|
101
|
-
async read(timeoutMs, read) {
|
|
102
|
-
const remaining = this.remaining(timeoutMs);
|
|
103
|
-
if (!this.hasPages) throw new CatalogParamsError("Codex catalog native page budget is exhausted");
|
|
104
|
-
this.pages++;
|
|
105
|
-
try {
|
|
106
|
-
const result = await withTimeout(read(remaining), remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
107
|
-
this.assertActive();
|
|
108
|
-
return result;
|
|
109
|
-
} catch (error) {
|
|
110
|
-
if (!this.closed) this.failure ??= { error };
|
|
111
|
-
throw error;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
attempt(owner, key, start) {
|
|
115
|
-
this.assertActive();
|
|
116
|
-
let attempts = this.attempts.get(owner);
|
|
117
|
-
const existing = attempts?.get(key);
|
|
118
|
-
if (existing) return existing;
|
|
119
|
-
const attempt = start();
|
|
120
|
-
if (!attempts) {
|
|
121
|
-
attempts = /* @__PURE__ */ new Map();
|
|
122
|
-
this.attempts.set(owner, attempts);
|
|
123
|
-
}
|
|
124
|
-
attempts.set(key, attempt);
|
|
125
|
-
return attempt;
|
|
126
|
-
}
|
|
127
|
-
resolved() {
|
|
128
|
-
if (this.failure) {
|
|
129
|
-
this.rejected(this.failure.error);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
this.settle((attempt) => attempt.resolved());
|
|
133
|
-
}
|
|
134
|
-
rejected(error) {
|
|
135
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
136
|
-
this.close();
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const reason = this.failure?.error ?? error;
|
|
140
|
-
this.settle((attempt) => attempt.rejected(reason));
|
|
141
|
-
}
|
|
142
|
-
close() {
|
|
143
|
-
this.settle((attempt) => attempt.abandoned());
|
|
144
|
-
}
|
|
145
|
-
settle(settle) {
|
|
146
|
-
if (this.closed) return;
|
|
147
|
-
this.closed = true;
|
|
148
|
-
for (const attempts of this.attempts.values()) for (const attempt of attempts.values()) if (attempt.allowed) settle(attempt);
|
|
149
|
-
this.attempts.clear();
|
|
150
|
-
this.failure = void 0;
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
async function withCodexCatalogListRequest(run) {
|
|
154
|
-
const current = currentCodexCatalogListRequest();
|
|
155
|
-
if (current) {
|
|
156
|
-
current.assertActive();
|
|
157
|
-
return await run(current);
|
|
158
|
-
}
|
|
159
|
-
const scope = new CodexCatalogListRequest();
|
|
160
|
-
try {
|
|
161
|
-
const result = await scope.run(() => run(scope));
|
|
162
|
-
scope.resolved();
|
|
163
|
-
return result;
|
|
164
|
-
} catch (error) {
|
|
165
|
-
scope.rejected(error);
|
|
166
|
-
throw error;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
//#endregion
|
|
170
|
-
export { CodexCatalogLoadingError as a, CodexCatalogAvailability as i, currentCodexCatalogListRequest as n, withCodexCatalogListRequest as r, CodexCatalogListRequest as t };
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { n as defineCodexBuildState } from "./build-state-Da1_z0kd.mjs";
|
|
2
|
-
//#region extensions/codex/src/app-server/shared-client-lifecycle.ts
|
|
3
|
-
/** Client ownership and synchronous retirement, independent of startup/auth execution. */
|
|
4
|
-
const createCodexAppServerStartupLifetime = () => ({
|
|
5
|
-
controller: new AbortController(),
|
|
6
|
-
pending: /* @__PURE__ */ new Set()
|
|
7
|
-
});
|
|
8
|
-
function ownCodexStartup(lifetime, operation) {
|
|
9
|
-
lifetime.pending.add(operation);
|
|
10
|
-
const release = () => lifetime.pending.delete(operation);
|
|
11
|
-
operation.then(release, release);
|
|
12
|
-
return operation;
|
|
13
|
-
}
|
|
14
|
-
const getSharedCodexAppServerClientState = defineCodexBuildState("openclaw.codexAppServerClientState", () => ({
|
|
15
|
-
clients: /* @__PURE__ */ new Map(),
|
|
16
|
-
liveClients: /* @__PURE__ */ new Set(),
|
|
17
|
-
isolatedClients: /* @__PURE__ */ new Set(),
|
|
18
|
-
entriesByClient: /* @__PURE__ */ new WeakMap(),
|
|
19
|
-
desktopGenerationDrainChecks: /* @__PURE__ */ new Set(),
|
|
20
|
-
startup: createCodexAppServerStartupLifetime(),
|
|
21
|
-
startMetadata: /* @__PURE__ */ new WeakMap()
|
|
22
|
-
}));
|
|
23
|
-
function hasActiveSharedCodexAppServerWork() {
|
|
24
|
-
const state = getSharedCodexAppServerClientState();
|
|
25
|
-
if (state.startup.pending.size > 0 || state.startup.controller.signal.aborted) return true;
|
|
26
|
-
for (const entry of state.clients.values()) if (entry.activeLeases > 0 || entry.pendingAcquires > 0) return true;
|
|
27
|
-
for (const client of state.liveClients) {
|
|
28
|
-
const entry = state.entriesByClient.get(client);
|
|
29
|
-
if (entry && (entry.activeLeases > 0 || entry.pendingAcquires > 0)) return true;
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
function getCurrentSharedClientEntry(client) {
|
|
34
|
-
const state = getSharedCodexAppServerClientState();
|
|
35
|
-
const entry = client ? state.entriesByClient.get(client) : void 0;
|
|
36
|
-
return entry && entry.client === client && state.clients.get(entry.key) === entry ? entry : void 0;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Retires a matching shared client. Default is graceful: detach from the map
|
|
40
|
-
* (future acquisitions get a fresh client) and close once leases drain.
|
|
41
|
-
* `failActiveLeases` is for suspect clients only (timed-out turns): it closes
|
|
42
|
-
* the physical connection immediately so co-leased attempts hit the normal
|
|
43
|
-
* client-closed retry path, and pending acquires reject instead of leasing
|
|
44
|
-
* the poisoned process. Routine cleanup must NOT use it — it would abort
|
|
45
|
-
* healthy sibling turns on a working client.
|
|
46
|
-
*/
|
|
47
|
-
function retireSharedCodexAppServerClientIfCurrent(client, opts) {
|
|
48
|
-
if (!client) return;
|
|
49
|
-
const state = getSharedCodexAppServerClientState();
|
|
50
|
-
const currentEntry = getCurrentSharedClientEntry(client);
|
|
51
|
-
const entry = currentEntry ?? state.entriesByClient.get(client);
|
|
52
|
-
if (!entry || entry.client !== client && !entry.closeError) return;
|
|
53
|
-
if (currentEntry) {
|
|
54
|
-
state.clients.delete(entry.key);
|
|
55
|
-
entry.closeWhenIdle = true;
|
|
56
|
-
}
|
|
57
|
-
if (opts?.failActiveLeases && (currentEntry || !entry.closeError)) {
|
|
58
|
-
entry.closeError = /* @__PURE__ */ new Error("codex app-server client is closed");
|
|
59
|
-
return {
|
|
60
|
-
activeLeases: entry.activeLeases,
|
|
61
|
-
closed: closeRetiredSharedClientEntry(entry)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
activeLeases: entry.activeLeases,
|
|
66
|
-
closed: currentEntry ? closeRetiredSharedClientEntryIfIdle(entry) : false
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/** Gracefully retires exact clients attached to an older desktop generation. */
|
|
70
|
-
function retireSharedCodexAppServerClientsBeforeDesktopGeneration(generation) {
|
|
71
|
-
const state = getSharedCodexAppServerClientState();
|
|
72
|
-
for (const entry of state.clients.values()) {
|
|
73
|
-
const client = entry.client;
|
|
74
|
-
const attached = client ? state.startMetadata.get(client) : void 0;
|
|
75
|
-
if (client && attached?.desktopGeneration && attached.desktopGeneration.epoch < generation.epoch) retireSharedCodexAppServerClientIfCurrent(client);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function closeRetiredSharedClientEntryIfIdle(entry) {
|
|
79
|
-
if (!entry.closeWhenIdle || entry.activeLeases > 0 || entry.pendingAcquires > 0 || !entry.client) return false;
|
|
80
|
-
entry.closeWhenIdle = false;
|
|
81
|
-
return closeRetiredSharedClientEntry(entry);
|
|
82
|
-
}
|
|
83
|
-
function closeRetiredSharedClientEntry(entry) {
|
|
84
|
-
const client = entry.client;
|
|
85
|
-
if (!client) return false;
|
|
86
|
-
entry.client = void 0;
|
|
87
|
-
client.close();
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
function retirePendingSharedClientEntryIfUnclaimed(entry) {
|
|
91
|
-
if (entry.activeLeases > 0 || entry.pendingAcquires > 0) return;
|
|
92
|
-
entry.startupAbort?.abort(/* @__PURE__ */ new Error("Codex app-server startup was abandoned"));
|
|
93
|
-
entry.closeWhenIdle = true;
|
|
94
|
-
const state = getSharedCodexAppServerClientState();
|
|
95
|
-
if (state.clients.get(entry.key) === entry) state.clients.delete(entry.key);
|
|
96
|
-
if (!entry.client) return;
|
|
97
|
-
closeRetiredSharedClientEntry(entry);
|
|
98
|
-
}
|
|
99
|
-
/** Failed final claimants join physical cleanup; healthy peers keep their startup. */
|
|
100
|
-
async function waitForUnclaimedSharedClientStartup(entry) {
|
|
101
|
-
if (!entry.startupTransport || entry.activeLeases > 0 || entry.pendingAcquires > 0) return;
|
|
102
|
-
await entry.startupTransport.then((client) => client.closeAndWait(), () => {});
|
|
103
|
-
}
|
|
104
|
-
/** Exit registration also observes transports that have already terminated. */
|
|
105
|
-
function waitForCodexAppServerClientExit(client) {
|
|
106
|
-
const metadata = getSharedCodexAppServerClientState().startMetadata.get(client);
|
|
107
|
-
const exited = metadata?.transportExit ?? new Promise((resolve) => {
|
|
108
|
-
client.addTransportExitHandler(() => resolve());
|
|
109
|
-
});
|
|
110
|
-
if (metadata) metadata.transportExit = exited;
|
|
111
|
-
return exited;
|
|
112
|
-
}
|
|
113
|
-
/** Acquire the recorded owner atomically, or join its exit before a replacement writes. */
|
|
114
|
-
async function retainSharedCodexAppServerClientByInstanceId(clientId) {
|
|
115
|
-
const id = clientId?.trim();
|
|
116
|
-
if (!id) return;
|
|
117
|
-
const state = getSharedCodexAppServerClientState();
|
|
118
|
-
for (const client of state.liveClients) {
|
|
119
|
-
if (client.getInstanceId() !== id) continue;
|
|
120
|
-
const entry = state.entriesByClient.get(client);
|
|
121
|
-
if (entry?.client !== client || entry.closeError || client.getCloseError()) {
|
|
122
|
-
await waitForCodexAppServerClientExit(client);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const release = retainSharedClientEntry(entry);
|
|
126
|
-
return {
|
|
127
|
-
client,
|
|
128
|
-
release: (waitForRetirement = false) => {
|
|
129
|
-
release();
|
|
130
|
-
return client.getCloseError() || waitForRetirement && entry.closeWhenIdle ? waitForCodexAppServerClientExit(client) : void 0;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
function notifyDesktopGenerationDrainChecks(state) {
|
|
136
|
-
for (const check of state.desktopGenerationDrainChecks) check();
|
|
137
|
-
}
|
|
138
|
-
function retainSharedClientEntry(entry, counter = "activeLeases") {
|
|
139
|
-
let released = false;
|
|
140
|
-
entry[counter] += 1;
|
|
141
|
-
return () => {
|
|
142
|
-
if (released) return;
|
|
143
|
-
released = true;
|
|
144
|
-
releaseSharedClientEntry(entry, counter);
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function releaseSharedClientEntry(entry, counter) {
|
|
148
|
-
entry[counter] -= 1;
|
|
149
|
-
closeRetiredSharedClientEntryIfIdle(entry);
|
|
150
|
-
notifyDesktopGenerationDrainChecks(getSharedCodexAppServerClientState());
|
|
151
|
-
}
|
|
152
|
-
//#endregion
|
|
153
|
-
export { notifyDesktopGenerationDrainChecks as a, retainSharedClientEntry as c, retireSharedCodexAppServerClientIfCurrent as d, retireSharedCodexAppServerClientsBeforeDesktopGeneration as f, hasActiveSharedCodexAppServerWork as i, retainSharedCodexAppServerClientByInstanceId as l, waitForUnclaimedSharedClientStartup as m, getCurrentSharedClientEntry as n, ownCodexStartup as o, waitForCodexAppServerClientExit as p, getSharedCodexAppServerClientState as r, releaseSharedClientEntry as s, createCodexAppServerStartupLifetime as t, retirePendingSharedClientEntryIfUnclaimed as u };
|