@openclaw/codex 2026.9.8 → 2026.10.1-beta.2
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-DGqFpAud.mjs} +5 -5
- package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
- package/dist/.setup/{apply-Cqb-YoCS.mjs → apply-CXTudl9p.mjs} +48 -39
- package/dist/.setup/attempt-client-cleanup-BH0hW2xU.mjs +155 -0
- package/dist/.setup/{attempt-workspace-context-BJ5Z_olH.mjs → attempt-workspace-context-BY0jprWJ.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-CGm0UJOr.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-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
- package/dist/.setup/{bounded-turn-BNunZPtz.mjs → bounded-turn-pGsfXcmH.mjs} +14 -13
- package/dist/.setup/{build-state-DIQ5O_-S.mjs → build-state-CqQnsg7T.mjs} +1 -1
- package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
- package/dist/.setup/{client-qyUBJlGZ.mjs → client-C8lgBOoO.mjs} +438 -160
- package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-Bqp7WG51.mjs} +57 -25
- package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
- package/dist/.setup/{command-dispatch-Btrs1D6f.mjs → command-dispatch-DhBbFIQ5.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-ztOOzm6O.mjs} +82 -144
- package/dist/.setup/{command-rpc-skzRq4wD.mjs → command-rpc-CuC5fPom.mjs} +23 -31
- package/dist/.setup/{compact-8ttks5U5.mjs → compact-tUb9AYfH.mjs} +117 -65
- package/dist/.setup/{plugin-metadata-cache-BRwtRct9.mjs → computer-use-BBN9y326.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-B3MNMVzb.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-CYsMlCuE.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-C8xGEXmR.mjs +463 -0
- package/dist/.setup/{dynamic-tools-Db2sY5cZ.mjs → dynamic-tools-DyERJnR6.mjs} +238 -878
- package/dist/.setup/{effective-mcp-catalog-Bi6-SQ7i.mjs → effective-mcp-catalog-C26Mio5l.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-D8VcDTNo.mjs} +2 -2
- package/dist/.setup/{event-projector-assistant-message-MV_1dj-3.mjs → event-projector-assistant-message-BN7CNUB5.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-C0jrcplS.mjs} +8 -8
- package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
- package/dist/.setup/mcp-app-session-preparation-BxN0_CYe.mjs +223 -0
- package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
- package/dist/.setup/{model-catalog-DiC0Tkha.mjs → model-catalog-DZyNeDKG.mjs} +7 -7
- package/dist/.setup/{models-DfLmPV0k.mjs → models-DSseKSMg.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-CqcPVmhH.mjs +310 -0
- package/dist/.setup/{native-subagent-monitor-BwkQXf9e.mjs → native-subagent-monitor-BUYOUp9X.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-BJ37d2Og.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-CuahdPLC.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-B8LGaZNW.mjs +124 -0
- package/dist/.setup/{provider-D6F_7p1I.mjs → provider-BnwHVD_z.mjs} +4 -4
- package/dist/.setup/provider-capabilities-D68Whix6.mjs +50 -0
- package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
- package/dist/.setup/{request-BZOfsSXW.mjs → request-jSbhc1sg.mjs} +189 -49
- package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
- package/dist/.setup/{run-attempt-dYJhjZrp.mjs → run-attempt-BLDZeYLD.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-Bdjw9HEn.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-DwJjnF5k.mjs → session-catalog-index-DufISKJ6.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-D6IiLtMb.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-8aHNwzWD.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-Czbchv_O.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-DjZsIwbZ.mjs} +8 -8
- package/dist/.setup/{shared-client-CJCTeFpQ.mjs → shared-client-qhyYWbew.mjs} +291 -272
- package/dist/.setup/{provider-capabilities-DG5qbsUZ.mjs → shell-dynamic-tools-D3Brj3g9.mjs} +16 -55
- package/dist/.setup/{side-question-BLeGj7TQ.mjs → side-question-D3NJlgbl.mjs} +99 -91
- package/dist/.setup/{source-CJis_1EF.mjs → source-BYu0T780.mjs} +24 -40
- package/dist/.setup/{thread-lifecycle-_bAbjedG.mjs → thread-lifecycle-Cbz_7ySv.mjs} +262 -305
- package/dist/.setup/{thread-ownership-B6pPt21M.mjs → thread-ownership-DwuSrt3s.mjs} +10 -8
- package/dist/.setup/{thread-policy-gNPzzpVp.mjs → thread-policy-DoNxbhqt.mjs} +22 -21
- package/dist/.setup/{thread-requests-OWGOiDaV.mjs → thread-requests-CL1e8Wmx.mjs} +107 -98
- package/dist/.setup/{thread-resume-GOry0AYh.mjs → thread-resume-BT6NHMkM.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-sS69wYnI.mjs} +75 -170
- package/dist/.setup/{upstream-session-fork-gkdRj2yH.mjs → upstream-session-fork-ChSld66u.mjs} +35 -46
- package/dist/.setup/{usage-CApUvLOV.mjs → usage-D8e8Xiqf.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-wSMQkbpV.mjs → usage-limit-error-GbT-5NcW.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-UKgeiBUG.mjs → web-search-provider.runtime-dL2GD1Kl.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,9 +1,12 @@
|
|
|
1
|
-
import { v as parseCatalogPage } from "./session-catalog-parsing-
|
|
2
|
-
import { n as detachCodexCatalogString } from "./session-catalog-limits-
|
|
3
|
-
import { i as retainCodexCatalogRow } from "./session-catalog-index-order-
|
|
1
|
+
import { o as CatalogParamsError, v as parseCatalogPage } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
|
+
import { n as detachCodexCatalogString } from "./session-catalog-limits-DEU36Qlo.mjs";
|
|
3
|
+
import { i as retainCodexCatalogRow, r as compareCodexCatalogRows } from "./session-catalog-index-order-nhyO0wdW.mjs";
|
|
4
|
+
import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
|
|
4
5
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
6
|
import { createHash } from "node:crypto";
|
|
6
7
|
import { setImmediate } from "node:timers/promises";
|
|
8
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
|
+
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
7
10
|
//#region extensions/codex/src/session-catalog-index-state.ts
|
|
8
11
|
const CODEX_CATALOG_STATE_NAMESPACE = "session-catalog-resident";
|
|
9
12
|
/** Durable metadata never asserts that a native process is still running. */
|
|
@@ -58,7 +61,9 @@ async function readCodexCatalogSnapshot(state) {
|
|
|
58
61
|
};
|
|
59
62
|
let complete = false;
|
|
60
63
|
let overflow = false;
|
|
64
|
+
let processed = 0;
|
|
61
65
|
for (const entry of entries) {
|
|
66
|
+
if (++processed % 128 === 0) await setImmediate();
|
|
62
67
|
if (Buffer.byteLength(entry.key) > 512) {
|
|
63
68
|
valid = false;
|
|
64
69
|
discard(entry.key);
|
|
@@ -85,7 +90,10 @@ async function readCodexCatalogSnapshot(state) {
|
|
|
85
90
|
complete &&= valid;
|
|
86
91
|
if (!complete) {
|
|
87
92
|
rows.clear();
|
|
88
|
-
for (const entry of entries)
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
if (++processed % 128 === 0) await setImmediate();
|
|
95
|
+
discard(entry.key);
|
|
96
|
+
}
|
|
89
97
|
if (entries.length) obsolete.add("complete");
|
|
90
98
|
}
|
|
91
99
|
return {
|
|
@@ -132,8 +140,10 @@ var CodexCatalogPersistence = class {
|
|
|
132
140
|
this.queue(this.key(threadId), void 0);
|
|
133
141
|
}
|
|
134
142
|
async pruneObsolete(keys, currentRows) {
|
|
143
|
+
const obsolete = new Set(keys);
|
|
144
|
+
if (!obsolete.size) return;
|
|
135
145
|
const currentKeys = new Set(Array.from(currentRows, (row) => this.key(row.threadId)));
|
|
136
|
-
for (const key of
|
|
146
|
+
for (const key of obsolete) if (!currentKeys.has(key)) this.queue(key, void 0);
|
|
137
147
|
await this.drain();
|
|
138
148
|
}
|
|
139
149
|
async finishHydration(overflow = false) {
|
|
@@ -181,4 +191,168 @@ var CodexCatalogPersistence = class {
|
|
|
181
191
|
}
|
|
182
192
|
};
|
|
183
193
|
//#endregion
|
|
184
|
-
|
|
194
|
+
//#region extensions/codex/src/session-catalog-availability.ts
|
|
195
|
+
var CodexCatalogLoadingError = class extends Error {
|
|
196
|
+
constructor() {
|
|
197
|
+
super("Codex session catalog is still loading. Retry shortly.");
|
|
198
|
+
this.code = "APP_SERVER_UNAVAILABLE";
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
/** One generation promise wakes cold callers; native pages remain owned by the index. */
|
|
202
|
+
var CodexCatalogAvailability = class {
|
|
203
|
+
constructor() {
|
|
204
|
+
this.complete = false;
|
|
205
|
+
this.changed = createDeferred();
|
|
206
|
+
}
|
|
207
|
+
begin() {
|
|
208
|
+
this.failure = void 0;
|
|
209
|
+
}
|
|
210
|
+
publish(frontier, complete = false) {
|
|
211
|
+
if (this.complete) return;
|
|
212
|
+
if (frontier && (!this.frontier || compareCodexCatalogRows(frontier, this.frontier) > 0)) {
|
|
213
|
+
const { threadId, updatedAt, recencyAt, sourceOrder } = frontier;
|
|
214
|
+
this.frontier = {
|
|
215
|
+
threadId,
|
|
216
|
+
updatedAt,
|
|
217
|
+
recencyAt,
|
|
218
|
+
sourceOrder
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
this.complete = complete;
|
|
222
|
+
this.notify();
|
|
223
|
+
}
|
|
224
|
+
fail(error) {
|
|
225
|
+
this.failure = { error };
|
|
226
|
+
this.notify();
|
|
227
|
+
}
|
|
228
|
+
notify() {
|
|
229
|
+
const previous = this.changed;
|
|
230
|
+
this.changed = createDeferred();
|
|
231
|
+
previous.resolve();
|
|
232
|
+
}
|
|
233
|
+
async until(promise, deadline) {
|
|
234
|
+
const remaining = deadline - performance.now();
|
|
235
|
+
if (remaining <= 0) throw new CodexCatalogLoadingError();
|
|
236
|
+
return await withTimeout(promise, remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
237
|
+
}
|
|
238
|
+
async next(deadline) {
|
|
239
|
+
if (this.failure) throw this.failure.error;
|
|
240
|
+
await this.until(this.changed.promise, deadline);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region extensions/codex/src/session-catalog-list-request.ts
|
|
245
|
+
const listRequest = new AsyncLocalStorage();
|
|
246
|
+
function currentCodexCatalogListRequest() {
|
|
247
|
+
return listRequest.getStore();
|
|
248
|
+
}
|
|
249
|
+
/** One foreground request owns its native read budget and source-health outcome. */
|
|
250
|
+
var CodexCatalogListRequest = class {
|
|
251
|
+
constructor() {
|
|
252
|
+
this.pages = 0;
|
|
253
|
+
this.closed = false;
|
|
254
|
+
this.attempts = /* @__PURE__ */ new Map();
|
|
255
|
+
}
|
|
256
|
+
get hasPages() {
|
|
257
|
+
return this.pages < 20;
|
|
258
|
+
}
|
|
259
|
+
deadline(timeoutMs) {
|
|
260
|
+
this.assertActive();
|
|
261
|
+
return this.deadlineAt ??= performance.now() + timeoutMs;
|
|
262
|
+
}
|
|
263
|
+
constrainDeadline(absolute) {
|
|
264
|
+
this.assertActive();
|
|
265
|
+
this.deadlineAt = Math.min(this.deadlineAt ?? absolute, absolute);
|
|
266
|
+
return this.deadlineAt;
|
|
267
|
+
}
|
|
268
|
+
remaining(timeoutMs) {
|
|
269
|
+
const remaining = Math.min(timeoutMs, this.deadline(timeoutMs) - performance.now());
|
|
270
|
+
if (remaining <= 0) throw new CodexCatalogLoadingError();
|
|
271
|
+
return remaining;
|
|
272
|
+
}
|
|
273
|
+
assertActive() {
|
|
274
|
+
if (this.closed) throw new DOMException("Codex session catalog request is closed", "AbortError");
|
|
275
|
+
if (this.deadlineAt !== void 0 && this.deadlineAt <= performance.now()) throw new CodexCatalogLoadingError();
|
|
276
|
+
}
|
|
277
|
+
async run(run) {
|
|
278
|
+
this.assertActive();
|
|
279
|
+
const pending = listRequest.run(this, run);
|
|
280
|
+
const remaining = this.deadlineAt === void 0 ? void 0 : this.deadlineAt - performance.now();
|
|
281
|
+
if (remaining !== void 0 && remaining <= 0) {
|
|
282
|
+
pending.catch(() => {});
|
|
283
|
+
throw new CodexCatalogLoadingError();
|
|
284
|
+
}
|
|
285
|
+
const result = remaining === void 0 ? await pending : await withTimeout(pending, remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
286
|
+
this.assertActive();
|
|
287
|
+
return result;
|
|
288
|
+
}
|
|
289
|
+
async read(timeoutMs, read) {
|
|
290
|
+
const remaining = this.remaining(timeoutMs);
|
|
291
|
+
if (!this.hasPages) throw new CatalogParamsError("Codex catalog native page budget is exhausted");
|
|
292
|
+
this.pages++;
|
|
293
|
+
try {
|
|
294
|
+
const result = await withTimeout(read(remaining), remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
295
|
+
this.assertActive();
|
|
296
|
+
return result;
|
|
297
|
+
} catch (error) {
|
|
298
|
+
if (!this.closed) this.failure ??= { error };
|
|
299
|
+
throw error;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
attempt(owner, key, start) {
|
|
303
|
+
this.assertActive();
|
|
304
|
+
let attempts = this.attempts.get(owner);
|
|
305
|
+
const existing = attempts?.get(key);
|
|
306
|
+
if (existing) return existing;
|
|
307
|
+
const attempt = start();
|
|
308
|
+
if (!attempts) {
|
|
309
|
+
attempts = /* @__PURE__ */ new Map();
|
|
310
|
+
this.attempts.set(owner, attempts);
|
|
311
|
+
}
|
|
312
|
+
attempts.set(key, attempt);
|
|
313
|
+
return attempt;
|
|
314
|
+
}
|
|
315
|
+
resolved() {
|
|
316
|
+
if (this.failure) {
|
|
317
|
+
this.rejected(this.failure.error);
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
this.settle((attempt) => attempt.resolved());
|
|
321
|
+
}
|
|
322
|
+
rejected(error) {
|
|
323
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
324
|
+
this.close();
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
const reason = this.failure?.error ?? error;
|
|
328
|
+
this.settle((attempt) => attempt.rejected(reason));
|
|
329
|
+
}
|
|
330
|
+
close() {
|
|
331
|
+
this.settle((attempt) => attempt.abandoned());
|
|
332
|
+
}
|
|
333
|
+
settle(settle) {
|
|
334
|
+
if (this.closed) return;
|
|
335
|
+
this.closed = true;
|
|
336
|
+
for (const attempts of this.attempts.values()) for (const attempt of attempts.values()) if (attempt.allowed) settle(attempt);
|
|
337
|
+
this.attempts.clear();
|
|
338
|
+
this.failure = void 0;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
async function withCodexCatalogListRequest(run) {
|
|
342
|
+
const current = currentCodexCatalogListRequest();
|
|
343
|
+
if (current) {
|
|
344
|
+
current.assertActive();
|
|
345
|
+
return await run(current);
|
|
346
|
+
}
|
|
347
|
+
const scope = new CodexCatalogListRequest();
|
|
348
|
+
try {
|
|
349
|
+
const result = await scope.run(() => run(scope));
|
|
350
|
+
scope.resolved();
|
|
351
|
+
return result;
|
|
352
|
+
} catch (error) {
|
|
353
|
+
scope.rejected(error);
|
|
354
|
+
throw error;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
//#endregion
|
|
358
|
+
export { CodexCatalogLoadingError as a, codexCatalogMetadataPage as c, CodexCatalogAvailability as i, currentCodexCatalogListRequest as n, CODEX_CATALOG_STATE_NAMESPACE as o, withCodexCatalogListRequest as r, CodexCatalogPersistence as s, CodexCatalogListRequest as t };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { D as selectCodexCatalogPreviewInput, c as MAX_CWD_LENGTH, d as boundedCatalogString, k as truncateCodexCatalogPreview } from "./session-catalog-parsing-
|
|
1
|
+
import { D as selectCodexCatalogPreviewInput, c as MAX_CWD_LENGTH, d as boundedCatalogString, k as truncateCodexCatalogPreview } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
2
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
3
|
-
import { n as defineCodexBuildState } from "./build-state-
|
|
4
|
-
import { n as detachCodexCatalogString } from "./session-catalog-limits-
|
|
5
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
3
|
+
import { n as defineCodexBuildState } from "./build-state-CqQnsg7T.mjs";
|
|
4
|
+
import { n as detachCodexCatalogString } from "./session-catalog-limits-DEU36Qlo.mjs";
|
|
5
|
+
import { t as __exportAll } from "./session-binding-sidecars-BrdV95Fg.mjs";
|
|
6
|
+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
7
|
//#region extensions/codex/src/session-catalog-source.ts
|
|
7
8
|
function hasLiveCodexCatalogSource(sources) {
|
|
8
9
|
for (const source of sources) if (!source.closed) return true;
|
|
@@ -113,7 +114,7 @@ function projectCodexCatalogNativeThread(thread, sanitize, cachedPreview) {
|
|
|
113
114
|
if (thread.path.length > 4096) throw new Error("Codex catalog rollout path exceeds its length limit");
|
|
114
115
|
row.path = detachCodexCatalogString(thread.path);
|
|
115
116
|
} else if (thread.path === null) row.path = null;
|
|
116
|
-
if (typeof thread.originator === "string") row.originator = detachCodexCatalogString(thread.originator
|
|
117
|
+
if (typeof thread.originator === "string") row.originator = detachCodexCatalogString(truncateUtf16Safe(thread.originator, 500));
|
|
117
118
|
for (const field of [
|
|
118
119
|
"createdAt",
|
|
119
120
|
"updatedAt",
|
|
@@ -127,7 +128,7 @@ function projectCodexCatalogNativeThread(thread, sanitize, cachedPreview) {
|
|
|
127
128
|
if (preview !== void 0) row.preview = preview;
|
|
128
129
|
else if (typeof rawPreview === "string") row.preview = rawPreview ? truncateCodexCatalogPreview(selectCodexCatalogPreviewInput(rawPreview), sanitize) : "";
|
|
129
130
|
else if (rawPreview === null) row.preview = null;
|
|
130
|
-
const source =
|
|
131
|
+
const source = thread.source;
|
|
131
132
|
if (source === "cli" || source === "vscode" || source === "exec" || source === "appServer" || source === "unknown") row.source = source;
|
|
132
133
|
else if (isJsonObject(thread.source) && typeof thread.source.custom === "string" && thread.source.custom.length <= 500) row.source = { custom: detachCodexCatalogString(thread.source.custom) };
|
|
133
134
|
if (isJsonObject(thread.gitInfo)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as CatalogParamsError } from "./session-catalog-parsing-
|
|
1
|
+
import { o as CatalogParamsError } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
2
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
4
4
|
import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
@@ -34,7 +34,11 @@ function readNodeSessionMarker(entry) {
|
|
|
34
34
|
...marker.initializing === true ? { initializing: true } : {}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
const nodeAdoptionsByRevision = /* @__PURE__ */ new WeakMap();
|
|
37
38
|
function listNodeAdoptedSessionEntries(params) {
|
|
39
|
+
const revision = params.sessionEntries?.revision;
|
|
40
|
+
const cached = revision ? nodeAdoptionsByRevision.get(revision) : void 0;
|
|
41
|
+
if (cached && cached.config === params.config && cached.agentId === params.agentId && cached.includeInitializing === params.includeInitializing) return cached.adopted;
|
|
38
42
|
const adopted = /* @__PURE__ */ new Map();
|
|
39
43
|
for (const { agentId, entry, sessionKey } of listSessionCatalogEntries({
|
|
40
44
|
...params.agentId ? { agentId: params.agentId } : {},
|
|
@@ -54,6 +58,12 @@ function listNodeAdoptedSessionEntries(params) {
|
|
|
54
58
|
...marker.initializing === true ? { initializing: true } : {}
|
|
55
59
|
});
|
|
56
60
|
}
|
|
61
|
+
if (revision) nodeAdoptionsByRevision.set(revision, {
|
|
62
|
+
config: params.config,
|
|
63
|
+
agentId: params.agentId,
|
|
64
|
+
includeInitializing: params.includeInitializing,
|
|
65
|
+
adopted
|
|
66
|
+
});
|
|
57
67
|
return adopted;
|
|
58
68
|
}
|
|
59
69
|
function findNodeAdoptedSessionEntry(params) {
|
|
@@ -146,7 +156,7 @@ async function createOrReuseNodeAdoptedSession(params) {
|
|
|
146
156
|
},
|
|
147
157
|
afterCreate: async (entry) => {
|
|
148
158
|
const storePath = resolveStorePath(params.config.session?.store, { agentId: entry.agentId });
|
|
149
|
-
const { importCodexThreadHistoryToTranscript } = await import("./transcript-mirror-
|
|
159
|
+
const { importCodexThreadHistoryToTranscript } = await import("./transcript-mirror-BfLRARNL.mjs").then((n) => n.a);
|
|
150
160
|
await importCodexThreadHistoryToTranscript({
|
|
151
161
|
thread: params.history.thread,
|
|
152
162
|
throughTurnId: params.history.throughTurnId,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as unwrapNodeInvokePayload, b as parseTranscriptPage, d as boundedCatalogString, f as catalogError, g as isInteractiveThreadSource, h as filterCatalogPageByTitle, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, r as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage } from "./session-catalog-parsing-
|
|
2
|
-
import { n as createCodexCliNodeConversationBindingData } from "./conversation-binding-data-
|
|
3
|
-
import { r as CODEX_CLI_SESSION_SOURCE_UPGRADE_MESSAGE, t as CODEX_CLI_SESSION_RESUME_COMMAND } from "./node-cli-sessions-
|
|
1
|
+
import { A as unwrapNodeInvokePayload, b as parseTranscriptPage, d as boundedCatalogString, f as catalogError, g as isInteractiveThreadSource, h as filterCatalogPageByTitle, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, r as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
|
+
import { n as createCodexCliNodeConversationBindingData } from "./conversation-binding-data-DJ4ix-W5.mjs";
|
|
3
|
+
import { r as CODEX_CLI_SESSION_SOURCE_UPGRADE_MESSAGE, t as CODEX_CLI_SESSION_RESUME_COMMAND } from "./node-cli-sessions-B5oNDkUS.mjs";
|
|
4
4
|
import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
|
|
5
|
-
import { t as lookupNodeCodexCatalogRecord } from "./session-catalog-node-lookup-
|
|
5
|
+
import { t as lookupNodeCodexCatalogRecord } from "./session-catalog-node-lookup-Uufckwcm.mjs";
|
|
6
6
|
import { t as codexLastTerminalTurnId } from "./session-upstream-marker-D15C9NHp.mjs";
|
|
7
|
-
import { catalogSessionActions, createOrReuseNodeAdoptedSession, finalizeNodeAdoptedSession, findNodeAdoptedSessionEntry, nodeAdoptedSourceKey, nodeSessionMarker } from "./session-catalog-node-adoption-
|
|
7
|
+
import { catalogSessionActions, createOrReuseNodeAdoptedSession, finalizeNodeAdoptedSession, findNodeAdoptedSessionEntry, nodeAdoptedSourceKey, nodeSessionMarker } from "./session-catalog-node-adoption-7-WEQTB1.mjs";
|
|
8
8
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
9
9
|
import { createSessionCatalogAdoptionCoordinator, publishSessionCatalogHost, sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
|
|
10
10
|
//#region extensions/codex/src/session-catalog-node-continue.ts
|
|
@@ -99,17 +99,11 @@ async function listPairedNode(params) {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
async function requireNodeForCodexContinue(params) {
|
|
102
|
-
const
|
|
103
|
-
if (!nodeId || params.hostId !== `node:${nodeId}`) throw new CatalogParamsError("Codex session catalog hostId is invalid");
|
|
104
|
-
const node = (await params.runtime.nodes.list()).nodes.find((candidate) => candidate.nodeId === nodeId);
|
|
102
|
+
const node = (await params.runtime.nodes.list()).nodes.find((candidate) => candidate.nodeId === params.nodeId);
|
|
105
103
|
if (!node || !canContinueCodexOnNode(node)) {
|
|
106
104
|
if (node?.connected && !node.caps?.includes("codex-cli-session-source")) throw new CatalogParamsError(CODEX_CLI_SESSION_SOURCE_UPGRADE_MESSAGE);
|
|
107
105
|
throw new CatalogParamsError("paired node does not permit Codex session continuation");
|
|
108
106
|
}
|
|
109
|
-
return {
|
|
110
|
-
node,
|
|
111
|
-
nodeId
|
|
112
|
-
};
|
|
113
107
|
}
|
|
114
108
|
function requireContinuableNodeRecord(record) {
|
|
115
109
|
if (record.archived) throw new CatalogParamsError("Codex session is archived on the paired node");
|
|
@@ -145,9 +139,10 @@ async function readNodeCodexHistory(params) {
|
|
|
145
139
|
};
|
|
146
140
|
}
|
|
147
141
|
async function continueNodeCodexSessionInner(params) {
|
|
148
|
-
const { nodeId } =
|
|
142
|
+
const { nodeId } = params;
|
|
143
|
+
await requireNodeForCodexContinue({
|
|
149
144
|
runtime: params.api.runtime,
|
|
150
|
-
|
|
145
|
+
nodeId
|
|
151
146
|
});
|
|
152
147
|
const lookup = await lookupNodeCodexCatalogRecord({
|
|
153
148
|
agentId: params.agentId,
|
|
@@ -236,7 +231,8 @@ async function continueNodeCodexSession(params) {
|
|
|
236
231
|
findExisting: () => void 0,
|
|
237
232
|
create: () => catalogSessionActions.enqueue(sourceKey, async () => continueNodeCodexSessionInner({
|
|
238
233
|
...params,
|
|
239
|
-
agentId
|
|
234
|
+
agentId,
|
|
235
|
+
nodeId
|
|
240
236
|
})),
|
|
241
237
|
complete: async (continued) => continued
|
|
242
238
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as unwrapNodeInvokePayload, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage } from "./session-catalog-parsing-
|
|
2
|
-
import "./session-catalog-limits-
|
|
1
|
+
import { A as unwrapNodeInvokePayload, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
|
+
import "./session-catalog-limits-DEU36Qlo.mjs";
|
|
3
3
|
import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
|
|
4
4
|
//#region extensions/codex/src/session-catalog-node-lookup.ts
|
|
5
5
|
async function lookupNodeCodexCatalogRecord(params) {
|
package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { n as detachCodexCatalogString } from "./session-catalog-limits-
|
|
2
|
+
import { n as detachCodexCatalogString } from "./session-catalog-limits-DEU36Qlo.mjs";
|
|
3
3
|
import { asFiniteNumber, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
5
|
//#region extensions/codex/src/app-server/protocol-session-source.ts
|
|
@@ -194,6 +194,53 @@ function parseOptionalCatalogString(value, field, maxLength) {
|
|
|
194
194
|
if (typeof value !== "string" || value.length > maxLength) throw new Error(`Codex session catalog returned an invalid ${field}`);
|
|
195
195
|
return detachCodexCatalogString(value);
|
|
196
196
|
}
|
|
197
|
+
const CATALOG_SESSION_STRINGS = [
|
|
198
|
+
[
|
|
199
|
+
"sessionId",
|
|
200
|
+
"session id",
|
|
201
|
+
256
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"name",
|
|
205
|
+
"session name",
|
|
206
|
+
MAX_SESSION_NAME_LENGTH
|
|
207
|
+
],
|
|
208
|
+
[
|
|
209
|
+
"fallbackName",
|
|
210
|
+
"session fallback name",
|
|
211
|
+
MAX_SESSION_PREVIEW_LENGTH
|
|
212
|
+
],
|
|
213
|
+
[
|
|
214
|
+
"cwd",
|
|
215
|
+
"cwd",
|
|
216
|
+
MAX_CWD_LENGTH
|
|
217
|
+
],
|
|
218
|
+
[
|
|
219
|
+
"source",
|
|
220
|
+
"source",
|
|
221
|
+
MAX_METADATA_LENGTH
|
|
222
|
+
],
|
|
223
|
+
[
|
|
224
|
+
"modelProvider",
|
|
225
|
+
"model provider",
|
|
226
|
+
MAX_METADATA_LENGTH
|
|
227
|
+
],
|
|
228
|
+
[
|
|
229
|
+
"cliVersion",
|
|
230
|
+
"CLI version",
|
|
231
|
+
MAX_METADATA_LENGTH
|
|
232
|
+
],
|
|
233
|
+
[
|
|
234
|
+
"gitBranch",
|
|
235
|
+
"Git branch",
|
|
236
|
+
MAX_METADATA_LENGTH
|
|
237
|
+
],
|
|
238
|
+
[
|
|
239
|
+
"sessionKey",
|
|
240
|
+
"OpenClaw session key",
|
|
241
|
+
MAX_SESSION_KEY_LENGTH
|
|
242
|
+
]
|
|
243
|
+
];
|
|
197
244
|
function parseCatalogSession(value, options = {}) {
|
|
198
245
|
if (!isRecord(value) || typeof value.threadId !== "string" || !value.threadId.trim() || value.threadId.length > 256 || value.archived !== false) throw new Error("Codex session catalog returned an invalid session");
|
|
199
246
|
const status = parseOptionalCatalogString(value.status, "status", 64);
|
|
@@ -205,36 +252,31 @@ function parseCatalogSession(value, options = {}) {
|
|
|
205
252
|
if (flag === void 0) throw new Error("Codex session catalog returned an invalid active flag");
|
|
206
253
|
return flag;
|
|
207
254
|
}) : void 0;
|
|
208
|
-
const
|
|
209
|
-
const name = value.name === null ? null : parseOptionalCatalogString(value.name, "session name", MAX_SESSION_NAME_LENGTH);
|
|
210
|
-
const fallbackName = parseOptionalCatalogString(value.fallbackName, "session fallback name", MAX_SESSION_PREVIEW_LENGTH);
|
|
211
|
-
const cwd = parseOptionalCatalogString(value.cwd, "cwd", MAX_CWD_LENGTH);
|
|
212
|
-
const source = parseOptionalCatalogString(value.source, "source", MAX_METADATA_LENGTH);
|
|
213
|
-
const modelProvider = parseOptionalCatalogString(value.modelProvider, "model provider", MAX_METADATA_LENGTH);
|
|
214
|
-
const cliVersion = parseOptionalCatalogString(value.cliVersion, "CLI version", MAX_METADATA_LENGTH);
|
|
215
|
-
const gitBranch = parseOptionalCatalogString(value.gitBranch, "Git branch", MAX_METADATA_LENGTH);
|
|
216
|
-
const sessionKey = options.allowSessionKey ? parseOptionalCatalogString(value.sessionKey, "OpenClaw session key", MAX_SESSION_KEY_LENGTH) : void 0;
|
|
217
|
-
const createdAt = asFiniteNumber(value.createdAt);
|
|
218
|
-
const updatedAt = asFiniteNumber(value.updatedAt);
|
|
219
|
-
const recencyAt = value.recencyAt === null ? null : asFiniteNumber(value.recencyAt);
|
|
220
|
-
return {
|
|
255
|
+
const session = {
|
|
221
256
|
threadId: detachCodexCatalogString(value.threadId),
|
|
222
257
|
status,
|
|
223
|
-
archived: value.archived
|
|
224
|
-
...sessionId !== void 0 ? { sessionId } : {},
|
|
225
|
-
...name !== void 0 ? { name } : {},
|
|
226
|
-
...fallbackName !== void 0 ? { fallbackName } : {},
|
|
227
|
-
...cwd !== void 0 ? { cwd } : {},
|
|
228
|
-
...activeFlags && activeFlags.length > 0 ? { activeFlags } : {},
|
|
229
|
-
...createdAt !== void 0 ? { createdAt } : {},
|
|
230
|
-
...updatedAt !== void 0 ? { updatedAt } : {},
|
|
231
|
-
...recencyAt !== void 0 ? { recencyAt } : {},
|
|
232
|
-
...source !== void 0 ? { source } : {},
|
|
233
|
-
...modelProvider !== void 0 ? { modelProvider } : {},
|
|
234
|
-
...cliVersion !== void 0 ? { cliVersion } : {},
|
|
235
|
-
...gitBranch !== void 0 ? { gitBranch } : {},
|
|
236
|
-
...sessionKey !== void 0 ? { sessionKey } : {}
|
|
258
|
+
archived: value.archived
|
|
237
259
|
};
|
|
260
|
+
for (const [key, label, limit] of CATALOG_SESSION_STRINGS) {
|
|
261
|
+
if (key === "sessionKey" && !options.allowSessionKey) continue;
|
|
262
|
+
if (key === "name" && value.name === null) {
|
|
263
|
+
session.name = null;
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const parsed = parseOptionalCatalogString(value[key], label, limit);
|
|
267
|
+
if (parsed !== void 0) session[key] = parsed;
|
|
268
|
+
}
|
|
269
|
+
if (activeFlags?.length) session.activeFlags = activeFlags;
|
|
270
|
+
for (const key of [
|
|
271
|
+
"createdAt",
|
|
272
|
+
"updatedAt",
|
|
273
|
+
"recencyAt"
|
|
274
|
+
]) {
|
|
275
|
+
const parsed = asFiniteNumber(value[key]);
|
|
276
|
+
if (parsed !== void 0) session[key] = parsed;
|
|
277
|
+
else if (key === "recencyAt" && value.recencyAt === null) session.recencyAt = null;
|
|
278
|
+
}
|
|
279
|
+
return session;
|
|
238
280
|
}
|
|
239
281
|
function parseCatalogPage(value, options = {}) {
|
|
240
282
|
if (!isRecord(value) || !Array.isArray(value.sessions) || value.sessions.length > 100) throw new Error("Codex session catalog returned an invalid page");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { D as selectCodexCatalogPreviewInput, O as toCatalogSession, S as readControlCursor, d as boundedCatalogString, k as truncateCodexCatalogPreview } from "./session-catalog-parsing-
|
|
2
|
-
import { n as detachCodexCatalogString } from "./session-catalog-limits-
|
|
3
|
-
import { n as codexCatalogRowRecency } from "./session-catalog-index-order-
|
|
4
|
-
import { t as isOpenClawManagedCodexThread } from "./session-catalog-provenance-
|
|
5
|
-
import { c as copyCodexCatalogSource, l as getCodexCatalogSource, p as setCodexCatalogSource, r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-
|
|
1
|
+
import { D as selectCodexCatalogPreviewInput, O as toCatalogSession, S as readControlCursor, d as boundedCatalogString, k as truncateCodexCatalogPreview } from "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
2
|
+
import { n as detachCodexCatalogString } from "./session-catalog-limits-DEU36Qlo.mjs";
|
|
3
|
+
import { n as codexCatalogRowRecency } from "./session-catalog-index-order-nhyO0wdW.mjs";
|
|
4
|
+
import { t as isOpenClawManagedCodexThread } from "./session-catalog-provenance-CmsOE5mh.mjs";
|
|
5
|
+
import { c as copyCodexCatalogSource, l as getCodexCatalogSource, p as setCodexCatalogSource, r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-D6IiLtMb.mjs";
|
|
6
6
|
import { asFiniteNumber, isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import fs from "node:fs/promises";
|
|
@@ -12,12 +12,6 @@ import { constants, createZstdDecompress } from "node:zlib";
|
|
|
12
12
|
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
13
13
|
//#region extensions/codex/src/session-catalog-rollouts.ts
|
|
14
14
|
const WINDOW_BYTES = 131072;
|
|
15
|
-
const DIRECTORY_PARTS = [
|
|
16
|
-
/^\d{4}$/,
|
|
17
|
-
/^(?:0[1-9]|1[0-2])$/,
|
|
18
|
-
/^(?:0[1-9]|[12]\d|3[01])$/
|
|
19
|
-
];
|
|
20
|
-
const ROLLOUT_FILE_NAME = /\.jsonl(?:\.zst)?$/;
|
|
21
15
|
const ROLLOUT_SOURCE_DENIAL_CODES = /* @__PURE__ */ new Set([
|
|
22
16
|
"symlink",
|
|
23
17
|
"hardlink",
|
|
@@ -27,51 +21,6 @@ const ROLLOUT_SOURCE_DENIAL_CODES = /* @__PURE__ */ new Set([
|
|
|
27
21
|
"not-file",
|
|
28
22
|
"path-alias"
|
|
29
23
|
]);
|
|
30
|
-
function compareRolloutCandidates(left, right) {
|
|
31
|
-
return left[1].mtimeMs - right[1].mtimeMs || (left[0] < right[0] ? -1 : left[0] > right[0] ? 1 : 0);
|
|
32
|
-
}
|
|
33
|
-
/** Retain only the newest fingerprints while streaming an arbitrarily large home. */
|
|
34
|
-
var NewestRolloutCandidates = class {
|
|
35
|
-
constructor() {
|
|
36
|
-
this.heap = [];
|
|
37
|
-
}
|
|
38
|
-
offer(candidate) {
|
|
39
|
-
if (this.heap.length < 2e4) {
|
|
40
|
-
let childIndex = this.heap.length;
|
|
41
|
-
this.heap.push(candidate);
|
|
42
|
-
while (childIndex > 0) {
|
|
43
|
-
const parentIndex = Math.floor((childIndex - 1) / 2);
|
|
44
|
-
const parent = this.heap[parentIndex];
|
|
45
|
-
if (!parent || compareRolloutCandidates(parent, candidate) <= 0) break;
|
|
46
|
-
this.heap[childIndex] = parent;
|
|
47
|
-
childIndex = parentIndex;
|
|
48
|
-
}
|
|
49
|
-
this.heap[childIndex] = candidate;
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
const oldest = this.heap[0];
|
|
53
|
-
if (!oldest || compareRolloutCandidates(candidate, oldest) <= 0) return;
|
|
54
|
-
let parentIndex = 0;
|
|
55
|
-
while (true) {
|
|
56
|
-
let childIndex = parentIndex * 2 + 1;
|
|
57
|
-
let child = this.heap[childIndex];
|
|
58
|
-
if (!child) break;
|
|
59
|
-
const right = this.heap[childIndex + 1];
|
|
60
|
-
if (right && compareRolloutCandidates(right, child) < 0) {
|
|
61
|
-
child = right;
|
|
62
|
-
childIndex++;
|
|
63
|
-
}
|
|
64
|
-
if (compareRolloutCandidates(candidate, child) <= 0) break;
|
|
65
|
-
this.heap[parentIndex] = child;
|
|
66
|
-
parentIndex = childIndex;
|
|
67
|
-
}
|
|
68
|
-
this.heap[parentIndex] = candidate;
|
|
69
|
-
}
|
|
70
|
-
finish() {
|
|
71
|
-
this.heap.sort((left, right) => compareRolloutCandidates(right, left));
|
|
72
|
-
return new Map(this.heap);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
24
|
/** Codex returns the plain logical path for either rollout representation. */
|
|
76
25
|
function codexCatalogRolloutLogicalPath(rolloutPath) {
|
|
77
26
|
return rolloutPath.replace(/\.zst$/u, "");
|
|
@@ -81,71 +30,6 @@ function resolveCodexCatalogRolloutFingerprint(rolloutPath, previous, files) {
|
|
|
81
30
|
if (!logicalPath) return;
|
|
82
31
|
return files?.get(logicalPath) ?? files?.get(`${logicalPath}.zst`) ?? (previous?.rolloutPath && codexCatalogRolloutLogicalPath(previous.rolloutPath) === logicalPath ? previous.fingerprint : void 0);
|
|
83
32
|
}
|
|
84
|
-
function indexCodexCatalogRowsByRollout(rows) {
|
|
85
|
-
return new Map([...rows].flatMap((row) => row.rolloutPath ? [[codexCatalogRolloutLogicalPath(row.rolloutPath), row]] : []));
|
|
86
|
-
}
|
|
87
|
-
/** Absence is meaningful only inside the layout visited by the currency scan. */
|
|
88
|
-
function isCodexCatalogRolloutPathCovered(sessionsRoot, rolloutPath) {
|
|
89
|
-
const directories = path.relative(sessionsRoot, rolloutPath).split(path.sep);
|
|
90
|
-
const fileName = directories.pop();
|
|
91
|
-
return fileName !== void 0 && ROLLOUT_FILE_NAME.test(fileName) && directories.length === DIRECTORY_PARTS.length && directories.every((part, index) => DIRECTORY_PARTS[index]?.test(part) === true);
|
|
92
|
-
}
|
|
93
|
-
async function unlessMissing(operation) {
|
|
94
|
-
try {
|
|
95
|
-
return await operation;
|
|
96
|
-
} catch (error) {
|
|
97
|
-
if (isRecord(error) && error.code === "ENOENT") return;
|
|
98
|
-
throw error;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/** Stat-only currency scan. Content is read separately, only for changed fingerprints. */
|
|
102
|
-
async function scanCodexCatalogRollouts(sessionsRoot, trackedPaths) {
|
|
103
|
-
const present = /* @__PURE__ */ new Set();
|
|
104
|
-
const rootStat = await unlessMissing(fs.lstat(sessionsRoot));
|
|
105
|
-
if (!rootStat?.isDirectory() || rootStat.isSymbolicLink()) return {
|
|
106
|
-
files: /* @__PURE__ */ new Map(),
|
|
107
|
-
present
|
|
108
|
-
};
|
|
109
|
-
const rootReal = await unlessMissing(fs.realpath(sessionsRoot));
|
|
110
|
-
if (!rootReal) return {
|
|
111
|
-
files: /* @__PURE__ */ new Map(),
|
|
112
|
-
present
|
|
113
|
-
};
|
|
114
|
-
const candidates = new NewestRolloutCandidates();
|
|
115
|
-
const scan = async (directory, depth) => {
|
|
116
|
-
if (await unlessMissing(fs.realpath(directory)) !== directory) return;
|
|
117
|
-
const entries = await unlessMissing(fs.opendir(directory));
|
|
118
|
-
if (!entries) return;
|
|
119
|
-
const directoryPattern = DIRECTORY_PARTS[depth];
|
|
120
|
-
for await (const entry of entries) {
|
|
121
|
-
const file = path.join(directory, entry.name);
|
|
122
|
-
if (directoryPattern) {
|
|
123
|
-
if (entry.isDirectory() && directoryPattern.test(entry.name)) await scan(file, depth + 1);
|
|
124
|
-
} else if (entry.isFile() && ROLLOUT_FILE_NAME.test(entry.name)) {
|
|
125
|
-
const stat = await unlessMissing(fs.lstat(file));
|
|
126
|
-
if (stat?.isFile() && stat.nlink === 1) {
|
|
127
|
-
const physicalPath = path.join(sessionsRoot, path.relative(rootReal, file));
|
|
128
|
-
if (physicalPath.length > 4096) continue;
|
|
129
|
-
const logicalPath = codexCatalogRolloutLogicalPath(physicalPath);
|
|
130
|
-
if (trackedPaths.has(logicalPath)) present.add(logicalPath);
|
|
131
|
-
if (physicalPath !== logicalPath) {
|
|
132
|
-
const plain = await unlessMissing(fs.lstat(codexCatalogRolloutLogicalPath(file)));
|
|
133
|
-
if (plain?.isFile() && plain.nlink === 1) continue;
|
|
134
|
-
}
|
|
135
|
-
candidates.offer([detachCodexCatalogString(physicalPath), {
|
|
136
|
-
mtimeMs: stat.mtimeMs,
|
|
137
|
-
size: stat.size
|
|
138
|
-
}]);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
await scan(rootReal, 0);
|
|
144
|
-
return {
|
|
145
|
-
files: candidates.finish(),
|
|
146
|
-
present
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
33
|
function records(bytes, skipFirst) {
|
|
150
34
|
const text = bytes.toString("utf8");
|
|
151
35
|
const lines = text.slice(0, text.lastIndexOf("\n") + 1).split("\n");
|
|
@@ -421,4 +305,4 @@ function mergeCodexCatalogRolloutRow(row, existing, fingerprint) {
|
|
|
421
305
|
return merged;
|
|
422
306
|
}
|
|
423
307
|
//#endregion
|
|
424
|
-
export { CodexCatalogProjectionCapacityError, CodexCatalogProjections,
|
|
308
|
+
export { CodexCatalogProjectionCapacityError, CodexCatalogProjections, canReuseCodexCatalogPreview, mergeCodexCatalogRolloutRow, readCodexCatalogRollout as n, projectCodexCatalogDeltaPage, projectCodexCatalogPage, projectCodexCatalogThread, resolveCodexCatalogRolloutFingerprint as r, codexCatalogRolloutLogicalPath as t };
|
|
@@ -36,7 +36,12 @@ async function readCodexSessionMeta(sessionsRoot, rolloutPath, threadId) {
|
|
|
36
36
|
autoClose: false,
|
|
37
37
|
highWaterMark: SESSION_META_READ_CHUNK_BYTES
|
|
38
38
|
});
|
|
39
|
-
const
|
|
39
|
+
const decoder = candidate.endsWith(".zst") ? createZstdDecompress() : void 0;
|
|
40
|
+
if (decoder) {
|
|
41
|
+
input.on("error", (error) => decoder.destroy(error));
|
|
42
|
+
input.pipe(decoder);
|
|
43
|
+
}
|
|
44
|
+
const reader = decoder ?? input;
|
|
40
45
|
try {
|
|
41
46
|
const chunks = [];
|
|
42
47
|
let bytesReadTotal = 0;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import "./session-catalog-parsing-
|
|
2
|
-
import "./session-catalog-BFafIiF6.mjs";
|
|
1
|
+
import "./session-catalog-parsing-B-qWJh2x.mjs";
|
|
3
2
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
3
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
5
4
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as readCodexNativeHistory, t as consumeCodexHistory } from "./session-history-read-
|
|
1
|
+
import { n as readCodexNativeHistory, t as consumeCodexHistory } from "./session-history-read-CNN8zwbD.mjs";
|
|
2
2
|
import { resolveAgentHarnessHistoryLimits } from "openclaw/plugin-sdk/agent-harness-attempt-runtime";
|
|
3
3
|
import { SessionManager } from "openclaw/plugin-sdk/agent-sessions";
|
|
4
4
|
import { getSessionEntry, parseSqliteSessionFileMarker, resolveTranscriptSessionKeyBySessionId } from "openclaw/plugin-sdk/session-store-runtime";
|