@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.
Files changed (151) hide show
  1. package/README.md +8 -0
  2. package/dist/.setup/{account-usage-runtime-G348lY1q.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
  3. package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
  4. package/dist/.setup/{apply-Cqb-YoCS.mjs → apply-D02fLpgN.mjs} +48 -39
  5. package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
  6. package/dist/.setup/{attempt-workspace-context-BJ5Z_olH.mjs → attempt-workspace-context-CbSzT6V2.mjs} +11 -15
  7. package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
  8. package/dist/.setup/{auth-cache-key-Dnps4W4_.mjs → auth-cache-key-CEd9QlIs.mjs} +244 -82
  9. package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
  10. package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
  11. package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
  13. package/dist/.setup/{bounded-turn-BNunZPtz.mjs → bounded-turn-DlHlNTyS.mjs} +14 -13
  14. package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
  15. package/dist/.setup/{build-state-DIQ5O_-S.mjs → build-state-CIi3Ckqu.mjs} +1 -1
  16. package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
  17. package/dist/.setup/{client-qyUBJlGZ.mjs → client-CBzEVDyb.mjs} +438 -160
  18. package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
  19. package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
  20. package/dist/.setup/{command-dispatch-Btrs1D6f.mjs → command-dispatch-BE_RdMou.mjs} +3 -3
  21. package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
  22. package/dist/.setup/{command-handlers-DvlCHJch.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
  23. package/dist/.setup/{command-rpc-skzRq4wD.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
  24. package/dist/.setup/{compact-8ttks5U5.mjs → compact-BLSAd-ru.mjs} +117 -65
  25. package/dist/.setup/{plugin-metadata-cache-BRwtRct9.mjs → computer-use-DpolvQHw.mjs} +65 -202
  26. package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
  27. package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
  28. package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
  29. package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
  30. package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
  31. package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
  32. package/dist/.setup/{conversation-binding-74LaGGH-.mjs → conversation-binding-CgSSD1Qz.mjs} +36 -48
  33. package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
  34. package/dist/.setup/{conversation-control-OrN6zuaY.mjs → conversation-control-tCg763cI.mjs} +19 -21
  35. package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
  36. package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
  37. package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
  38. package/dist/.setup/dynamic-tool-build-CVrx02cH.mjs +463 -0
  39. package/dist/.setup/{dynamic-tools-Db2sY5cZ.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
  40. package/dist/.setup/{effective-mcp-catalog-Bi6-SQ7i.mjs → effective-mcp-catalog-BysTBZCW.mjs} +83 -11
  41. package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
  42. package/dist/.setup/{ephemeral-turn-DiCS1ijR.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
  43. package/dist/.setup/{event-projector-assistant-message-MV_1dj-3.mjs → event-projector-assistant-message-YCL2wspu.mjs} +2 -2
  44. package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
  45. package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
  46. package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
  47. package/dist/.setup/{isolated-completion-D80IXfQF.mjs → isolated-completion-D5gbKm6k.mjs} +8 -8
  48. package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
  49. package/dist/.setup/mcp-app-session-preparation-CdqsXwZX.mjs +223 -0
  50. package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
  51. package/dist/.setup/{model-catalog-DiC0Tkha.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
  52. package/dist/.setup/{models-DfLmPV0k.mjs → models-Du_i5G_t.mjs} +10 -7
  53. package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
  54. package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
  55. package/dist/.setup/native-mcp-app-DV7VbfzF.mjs +310 -0
  56. package/dist/.setup/{native-subagent-monitor-BwkQXf9e.mjs → native-subagent-monitor-CCEFO6qK.mjs} +235 -318
  57. package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
  58. package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
  59. package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
  60. package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
  61. package/dist/.setup/{plan-DPdMk1Oy.mjs → plan-CUHSIOep.mjs} +67 -89
  62. package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
  63. package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
  64. package/dist/.setup/plugin-approval-roundtrip-uAR-oQfr.mjs +109 -0
  65. package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
  66. package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
  67. package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
  68. package/dist/.setup/plugin-thread-config-deadline-CdRzGJt4.mjs +124 -0
  69. package/dist/.setup/{provider-D6F_7p1I.mjs → provider-BP8ZaZqn.mjs} +4 -4
  70. package/dist/.setup/provider-capabilities-Z5ZbBxqP.mjs +50 -0
  71. package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
  72. package/dist/.setup/{request-BZOfsSXW.mjs → request-BH3FvYUE.mjs} +189 -49
  73. package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
  74. package/dist/.setup/{run-attempt-dYJhjZrp.mjs → run-attempt-CgvFoW7R.mjs} +553 -727
  75. package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
  76. package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
  77. package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
  78. package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
  79. package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
  80. package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
  81. package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
  82. package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
  83. package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
  84. package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
  85. package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
  86. package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
  87. package/dist/.setup/{session-catalog-events-BMCFMZw-.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
  88. package/dist/.setup/{session-catalog-index-DwJjnF5k.mjs → session-catalog-index-DPICGlxr.mjs} +361 -72
  89. package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
  90. package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
  91. package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
  92. package/dist/.setup/{session-catalog-native-projection-CuaFZuQE.mjs → session-catalog-native-projection-CTBd4EUm.mjs} +7 -6
  93. package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
  94. package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
  95. package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
  96. package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
  97. package/dist/.setup/{session-catalog-projection-CGfzfP93.mjs → session-catalog-projection-CE0_Hffi.mjs} +6 -122
  98. package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
  99. package/dist/.setup/{session-cli-DlmBHYIe.mjs → session-cli-kH4vuGod.mjs} +1 -2
  100. package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
  101. package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
  102. package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
  103. package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
  104. package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
  105. package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
  106. package/dist/.setup/{session-retirement-LlYWBKTJ.mjs → session-retirement-aC60o6P3.mjs} +14 -15
  107. package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
  108. package/dist/.setup/{settled-turn-finalizer-DW9W3gza.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
  109. package/dist/.setup/{shared-client-CJCTeFpQ.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
  110. package/dist/.setup/{provider-capabilities-DG5qbsUZ.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
  111. package/dist/.setup/{side-question-BLeGj7TQ.mjs → side-question-B7T0_GEC.mjs} +99 -91
  112. package/dist/.setup/{source-CJis_1EF.mjs → source-DH70LqN0.mjs} +24 -40
  113. package/dist/.setup/{thread-lifecycle-_bAbjedG.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
  114. package/dist/.setup/{thread-ownership-B6pPt21M.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
  115. package/dist/.setup/{thread-policy-gNPzzpVp.mjs → thread-policy-CXZV97TS.mjs} +22 -21
  116. package/dist/.setup/{thread-requests-OWGOiDaV.mjs → thread-requests-COrRJcZb.mjs} +107 -98
  117. package/dist/.setup/{thread-resume-GOry0AYh.mjs → thread-resume-rx7J68Rx.mjs} +10 -18
  118. package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
  119. package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
  120. package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
  121. package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
  122. package/dist/.setup/{attempt-client-cleanup-B-S7ngS_.mjs → turn-router-CX1-EoCp.mjs} +75 -170
  123. package/dist/.setup/{upstream-session-fork-gkdRj2yH.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
  124. package/dist/.setup/{usage-CApUvLOV.mjs → usage-Dmx7B0W2.mjs} +4 -4
  125. package/dist/.setup/{usage-limit-error-wSMQkbpV.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
  126. package/dist/.setup/{web-search-provider.runtime-UKgeiBUG.mjs → web-search-provider.runtime-CsVmqbFm.mjs} +4 -20
  127. package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
  128. package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
  129. package/dist/api.js +34 -54
  130. package/dist/catalog-page.worker.js +1 -1
  131. package/dist/cli-metadata.js +1 -1
  132. package/dist/doctor-contract-api.js +15 -27
  133. package/dist/harness.js +37 -22
  134. package/dist/index.js +2880 -276
  135. package/dist/media-understanding-provider.js +2 -2
  136. package/dist/migration-provider-api.js +1 -1
  137. package/dist/native-session-binding-api.js +2 -0
  138. package/dist/provider-discovery.js +1 -1
  139. package/dist/session-history-worker-runtime.js +33 -4
  140. package/dist/session-history.worker.js +1 -1
  141. package/openclaw.plugin.json +3 -3
  142. package/package.json +6 -6
  143. package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
  144. package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
  145. package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
  146. package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
  147. package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
  148. package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
  149. package/dist/.setup/session-catalog-BFafIiF6.mjs +0 -2599
  150. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
  151. package/dist/.setup/shared-client-lifecycle-7xgtlo15.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-DIQ5O_-S.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 };