@openclaw/codex 2026.10.5-beta.4 → 2026.10.10-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 +10 -3
- package/dist/.setup/{account-usage-runtime-CoVpNIlD.mjs → account-usage-runtime-BVO-lpvn.mjs} +15 -9
- package/dist/.setup/{app-server-policy-D_zv8J7V.mjs → app-server-policy-Cog6mm2i.mjs} +1 -1
- package/dist/.setup/{apply-BXDMd05l.mjs → apply-tJl5mopa.mjs} +11 -11
- package/dist/.setup/{attempt-client-cleanup-zNuNTKVr.mjs → attempt-client-cleanup-DMJWXGxM.mjs} +14 -8
- package/dist/.setup/attempt-terminal-sZutF0WY.mjs +1 -0
- package/dist/.setup/{attempt-workspace-context-CcwP3DA3.mjs → attempt-workspace-context-GYPLawX6.mjs} +2 -2
- package/dist/.setup/{auth-binding-BaxlhaNx.mjs → auth-binding-830RLAJW.mjs} +2 -2
- package/dist/.setup/{auth-cache-key-f8ODJ_OX.mjs → auth-cache-key-BW1YeaIk.mjs} +92 -80
- package/dist/.setup/{auth-profile-CgHQ8Vot.mjs → auth-profile-auwzSwwy.mjs} +14 -8
- package/dist/.setup/{auth-profile-health-oHizqgye.mjs → auth-profile-health-BVPZU9I8.mjs} +15 -8
- package/dist/.setup/{auth-profile-selection-hr8ocLtz.mjs → auth-profile-selection-Bp5PDk3W.mjs} +24 -7
- package/dist/.setup/{binding-connection-B7HAAZSI.mjs → binding-connection-GTgUj9pi.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-DAXn7iFl.mjs → binding-connection.runtime-RcWR3vQu.mjs} +4 -3
- package/dist/.setup/{bounded-turn-DfIJtRlv.mjs → bounded-turn-BQkmyyjB.mjs} +18 -22
- package/dist/.setup/{bounded-turn-isolation-BfDAo-qZ.mjs → bounded-turn-isolation-D8CDrAVX.mjs} +3 -3
- package/dist/.setup/{build-state-Ds14X10-.mjs → build-state-CjLCC0wm.mjs} +1 -1
- package/dist/.setup/{capabilities-DbOzOglY.mjs → capabilities-DAS-JX1z.mjs} +1 -1
- package/dist/.setup/{client-D93nbdB8.mjs → client--P8jwXvA.mjs} +47 -317
- package/dist/.setup/{client-catalog-response-CuVLp4I0.mjs → client-catalog-response-CsDxVVOZ.mjs} +2 -2
- package/dist/.setup/client-initialize-CjgZcX61.mjs +165 -0
- package/dist/.setup/{command-dispatch-DxdH5a9-.mjs → command-dispatch-DqaVBeR3.mjs} +3 -3
- package/dist/.setup/{command-formatters-xW9KpoSZ.mjs → command-formatters-B_7-QZ1c.mjs} +2 -2
- package/dist/.setup/{command-handlers-fiYvYYq0.mjs → command-handlers-i6mEjvfo.mjs} +539 -406
- package/dist/.setup/command-rpc-B65jEc0r.mjs +296 -0
- package/dist/.setup/compact-AO2H4RJe.mjs +823 -0
- package/dist/.setup/{computer-use-DL2v3Kxq.mjs → computer-use-YUnu0JVx.mjs} +21 -68
- package/dist/.setup/{config-C1YVVLEA.mjs → config-BfrAlTMT.mjs} +3 -3
- package/dist/.setup/{config-options-DDzeNQ8m.mjs → config-options-DMFZkd3X.mjs} +1 -1
- package/dist/.setup/{config-runtime-DWzK-k0n.mjs → config-runtime-BZRizyuG.mjs} +2 -2
- package/dist/.setup/{context-engine-projection-ps-yn_ci.mjs → context-engine-projection-PIeLSnR-.mjs} +16 -30
- package/dist/.setup/{conversation-binding-BieJZRRV.mjs → conversation-binding-CfnUR-IM.mjs} +228 -116
- package/dist/.setup/{conversation-binding-data-UgLuTSQT.mjs → conversation-binding-data-khgW0n-o.mjs} +4 -2
- package/dist/.setup/{conversation-control-GXM3unE4.mjs → conversation-control-B2EpVZEb.mjs} +53 -23
- package/dist/.setup/{cyber-failover-D4dgNfFf.mjs → cyber-failover-CqEZoQsj.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-ljgGGL0s.mjs → cyber-failover-notice-poL3Advd.mjs} +1 -1
- package/dist/.setup/{doctor-start-options-JjTAl-q_.mjs → doctor-start-options-8uIBXIzR.mjs} +8 -5
- package/dist/.setup/{dynamic-tool-build-DcaPmBlE.mjs → dynamic-tool-build-DOub3CB5.mjs} +208 -218
- package/dist/.setup/{dynamic-tools-CnQFnNKH.mjs → dynamic-tools-Us5mvq_N.mjs} +344 -118
- package/dist/.setup/{effective-mcp-catalog-B5HKFZNK.mjs → effective-mcp-catalog-DfUUoeeM.mjs} +11 -9
- package/dist/.setup/{ephemeral-turn-De3qb8EQ.mjs → ephemeral-turn-B2z0RIeF.mjs} +5 -4
- package/dist/.setup/{event-projector-assistant-message-CLMKN4x-.mjs → event-projector-assistant-message-ChOAY7rW.mjs} +16 -11
- package/dist/.setup/{event-projector-usage-BpKfdoTm.mjs → event-projector-usage-CBY0Hkga.mjs} +2 -2
- package/dist/.setup/{event-projector-values-CLvG1Hil.mjs → event-projector-values-yf4us9Pf.mjs} +1 -1
- package/dist/.setup/experimental-features-uGnVDtp-.mjs +19 -0
- package/dist/.setup/inference-context-HRw3PDwn.mjs +209 -0
- package/dist/.setup/{inference-dispatch-CO6tTs4q.mjs → inference-dispatch-C2zVSnrr.mjs} +2 -2
- package/dist/.setup/{inference-metadata-DCvcG_N_.mjs → inference-metadata-CYFWLHVk.mjs} +3 -1
- package/dist/.setup/{inference-proxy-BDWV0djM.mjs → inference-proxy-CiLbHMLf.mjs} +8 -8
- package/dist/.setup/installed-probe-lVC1X5ve.mjs +185 -0
- package/dist/.setup/{isolated-completion-BPJdvk5F.mjs → isolated-completion-CybgD6uU.mjs} +7 -7
- package/dist/.setup/managed-binary-DbKvGXKl.mjs +395 -0
- package/dist/.setup/{mcp-app-session-preparation-Dz2GOwyE.mjs → mcp-app-session-preparation-zUgpDLWR.mjs} +18 -14
- package/dist/.setup/{model-catalog-ZNwltCKl.mjs → model-catalog-CWY3wo0B.mjs} +28 -17
- package/dist/.setup/{models-BHpbAuz8.mjs → models-CmOBxsKF.mjs} +3 -3
- package/dist/.setup/{native-auth-esN5MdIv.mjs → native-auth-DpZIaY8N.mjs} +7 -4
- package/dist/.setup/native-execution-policy-D09tLP-u.mjs +152 -0
- package/dist/.setup/{native-hook-relay-wq7jrNLk.mjs → native-hook-relay-CocOW9YS.mjs} +45 -10
- package/dist/.setup/{native-mcp-app-DX3nyTtc.mjs → native-mcp-app-DrQeLxXj.mjs} +5 -5
- package/dist/.setup/{native-skill-isolation-DSBeF-Yy.mjs → native-skill-isolation-DL4-PQa4.mjs} +7 -7
- package/dist/.setup/{native-subagent-monitor-DOLEIf9r.mjs → native-subagent-monitor-C3CIIaZG.mjs} +485 -239
- package/dist/.setup/{native-subagent-pending-assignments-DmVhedNs.mjs → native-subagent-pending-assignments-CTinVtjo.mjs} +1 -1
- package/dist/.setup/{native-task-assignments-DimsQ9Qa.mjs → native-task-assignments-YJopbaVO.mjs} +9 -5
- package/dist/.setup/{node-cli-sessions-CzKg2nGq.mjs → node-cli-sessions-BuJnBnEq.mjs} +7 -4
- package/dist/.setup/{node-exec-server.runtime-BWkULhBM.mjs → node-exec-server.runtime-CP7RC1Nd.mjs} +3 -3
- package/dist/.setup/{plan-41-YOBMq.mjs → plan-Bqj6VQvQ.mjs} +7 -20
- package/dist/.setup/{plugin-activation-D7WkJMvU.mjs → plugin-activation-CXPWe-hl.mjs} +4 -4
- package/dist/.setup/{plugin-app-cache-key-Bg9DbDI6.mjs → plugin-app-cache-key-DRb-niJc.mjs} +17 -55
- package/dist/.setup/{plugin-approval-roundtrip-CD88q3yx.mjs → plugin-approval-roundtrip-CGEiG7hG.mjs} +1 -1
- package/dist/.setup/{plugin-inventory-CYgdo14P.mjs → plugin-inventory-DE9wcaeH.mjs} +2 -2
- package/dist/.setup/{plugin-metadata-cache-Bi8TAPwX.mjs → plugin-metadata-cache-BqC-a6Fb.mjs} +2 -15
- package/dist/.setup/{project-doc-thread-config-BVcvnps8.mjs → project-doc-thread-config-B0UI3f1D.mjs} +6 -6
- package/dist/.setup/protocol-CaPAVwe9.mjs +12 -0
- package/dist/.setup/{provider-LWKll6dV.mjs → provider-C_1fMsyD.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-Dn2WwH4P.mjs → provider-capabilities-C7pYYpvh.mjs} +1 -1
- package/dist/.setup/{rate-limits-CI8pTPqL.mjs → rate-limits-BpfURnuy.mjs} +1 -1
- package/dist/.setup/{request-Bo0kKABI.mjs → request-C6U8q2uz.mjs} +132 -136
- package/dist/.setup/{responses-oauth-twnuTaAa.mjs → responses-oauth-CCV7aVYF.mjs} +6 -6
- package/dist/.setup/{rpc-error-C98SHchT.mjs → rpc-error-DemqqaxE.mjs} +7 -3
- package/dist/.setup/{run-attempt-ClU8MxhZ.mjs → run-attempt-BhuXanLv.mjs} +595 -426
- package/dist/.setup/{run-attempt-lifecycle-KN4oh-7O.mjs → run-attempt-lifecycle-DN-ATDp9.mjs} +1 -1
- package/dist/.setup/{runtime-artifact-C13pR7tD.mjs → runtime-artifact-CmLWeyJB.mjs} +3 -3
- package/dist/.setup/{runtime-artifact-connection-jS5DeCok.mjs → runtime-artifact-connection-DpWlZ02e.mjs} +3 -3
- package/dist/.setup/{sandbox-guard-DIImwCy1.mjs → sandbox-guard-DneAfNye.mjs} +70 -30
- package/dist/.setup/{session-binding-JEHNMPsr.mjs → session-binding-BgsWcbdY.mjs} +25 -23
- package/dist/.setup/{session-binding-record-DU_0biMD.mjs → session-binding-record-C_THntMe.mjs} +27 -12
- package/dist/.setup/{session-binding-record-codec-BpH8u_G9.mjs → session-binding-record-codec-DvmOI7g_.mjs} +1 -0
- package/dist/.setup/{session-binding-sidecars-DD-enC8w.mjs → session-binding-sidecars-BNSS6WL4.mjs} +55 -63
- package/dist/.setup/session-cancellation-DCN1FcBZ.mjs +43 -0
- package/dist/.setup/{session-catalog-adoption-Ca3OYGYM.mjs → session-catalog-adoption-ppsLlVLB.mjs} +24 -38
- package/dist/.setup/{session-catalog-archive-Bv6gV7x9.mjs → session-catalog-archive-CqLRHJ6z.mjs} +11 -13
- package/dist/.setup/{session-catalog-events-kR2Ot6nX.mjs → session-catalog-events-CEi6SuLQ.mjs} +5 -5
- package/dist/.setup/{session-catalog-index-order-CTfoefow.mjs → session-catalog-index-order-0Zqng2u8.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-CrnfVEnT.mjs → session-catalog-index-qt4UWBua.mjs} +96 -271
- package/dist/.setup/{session-catalog-limits-BynIoOYm.mjs → session-catalog-limits-Dc6E0BZz.mjs} +1 -1
- package/dist/.setup/{session-catalog-list-request-D4MYNgDB.mjs → session-catalog-list-request-CAjoWjaH.mjs} +3 -4
- package/dist/.setup/{session-catalog-native-projection-CWqCU1I_.mjs → session-catalog-native-projection-BqBYi6kV.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-adoption-BdP9Zjqo.mjs → session-catalog-node-adoption-e9v8mGgx.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-continue-CNJibO4_.mjs → session-catalog-node-continue-H7nrzcUD.mjs} +5 -5
- package/dist/.setup/{session-catalog-node-lookup-BH_DBGa9.mjs → session-catalog-node-lookup-BrZfDkA8.mjs} +2 -2
- package/dist/.setup/{session-catalog-parsing-DkeoVn60.mjs → session-catalog-parsing-V6jyFg9g.mjs} +2 -2
- package/dist/.setup/{session-catalog-projection-BzHiV818.mjs → session-catalog-projection-CNyhjZze.mjs} +8 -7
- package/dist/.setup/{session-catalog-provenance-CmsOE5mh.mjs → session-catalog-provenance-Dg9s12z-.mjs} +50 -30
- package/dist/.setup/{session-catalog-source-DGuRdGvM.mjs → session-catalog-source-z_mNyQdX.mjs} +2 -6
- package/dist/.setup/{session-cli-GwU0izn-.mjs → session-cli-CBGKiqdv.mjs} +1 -1
- package/dist/.setup/{session-history-BO6i_pfk.mjs → session-history-7W0cgTXF.mjs} +11 -9
- package/dist/.setup/{session-history-import-CaO8s6ta.mjs → session-history-import-BwPKwcNi.mjs} +4 -4
- package/dist/.setup/{session-initialization-Bi_2DKhc.mjs → session-initialization-Dn3vveGv.mjs} +2 -2
- package/dist/.setup/{session-retirement-B3U5hpGJ.mjs → session-retirement-RZStisKb.mjs} +8 -8
- package/dist/.setup/{session-history.worker-DJQfek5p.mjs → settled-turn-evidence--tRW6fSm.mjs} +2 -18
- package/dist/.setup/{settled-turn-finalizer-CYCVpTv2.mjs → settled-turn-finalizer-gioXygEX.mjs} +8 -8
- package/dist/.setup/{shared-client-BCx1wbyA.mjs → shared-client-CkyTrNB8.mjs} +380 -557
- package/dist/.setup/side-question-DHPWKgO3.mjs +998 -0
- package/dist/.setup/{source-DipMO9hL.mjs → source-63MLSmLJ.mjs} +5 -5
- package/dist/.setup/{thread-archive-guard-LKdwQKyr.mjs → thread-archive-guard-BWjSsA92.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-run-C_aYiYqk.mjs → thread-lifecycle-run-zCXYFW8W.mjs} +172 -75
- package/dist/.setup/{thread-model-selection-DcVebr8N.mjs → thread-model-selection-DxposL4X.mjs} +9 -9
- package/dist/.setup/{thread-ownership-BoUd0i6L.mjs → thread-ownership-Bmk5a2Gu.mjs} +7 -7
- package/dist/.setup/{thread-policy-B3wBRNph.mjs → thread-policy-DYtvZ5Ay.mjs} +6 -6
- package/dist/.setup/{thread-requests-BgzJwJtS.mjs → thread-requests-BjawdIVV.mjs} +14 -14
- package/dist/.setup/{thread-resume-D-3bsr1j.mjs → thread-resume-vBShG3-o.mjs} +6 -6
- package/dist/.setup/{transcript-history-projection-DfKcoZCB.mjs → transcript-history-projection-i-FVpyha.mjs} +1 -1
- package/dist/.setup/{transcript-mirror-Bee2o6jj.mjs → transcript-mirror-CEQJZlF3.mjs} +6 -9
- package/dist/.setup/{transport-stdio-CRWTkKOn.mjs → transport-stdio-Bq160Dhv.mjs} +63 -64
- package/dist/.setup/{transport-websocket-DIyPfkHo.mjs → transport-websocket-0YqiI_MH.mjs} +1 -1
- package/dist/.setup/{turn-router-DBVMToGo.mjs → turn-router-BGj67FMK.mjs} +2 -2
- package/dist/.setup/{upstream-session-fork-p5fwKi7w.mjs → upstream-session-fork-CWKjpdtW.mjs} +46 -219
- package/dist/.setup/{usage-C2Kq7oej.mjs → usage-AhrLFxZP.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-BQX8RHAd.mjs → usage-limit-error-BdNbGJC3.mjs} +4 -4
- package/dist/.setup/{web-search-item-CvokaZOo.mjs → web-search-item-DHVuNSqk.mjs} +1 -1
- package/dist/.setup/{web-search-provider.runtime-D89djc7e.mjs → web-search-provider.runtime-Yk6lnJBG.mjs} +3 -3
- package/dist/.setup/{workspace-write-sandbox-probe-BDWO2Qkh.mjs → workspace-write-sandbox-probe-DJxOXcF3.mjs} +2 -2
- package/dist/api.js +7 -28
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-version-api.js +25 -0
- package/dist/doctor-contract-api.js +5 -5
- package/dist/harness.js +59 -36
- package/dist/index.js +259 -295
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -2
- package/dist/native-session-binding-api.js +1 -2
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-entrypoint.js +12 -0
- package/dist/session-history-worker-runtime.js +7 -18
- package/dist/session-history.worker.js +18 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -6
- package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +0 -2
- package/dist/.setup/command-rpc-HIvsy3wS.mjs +0 -247
- package/dist/.setup/compact-ClZ7Ar7L.mjs +0 -808
- package/dist/.setup/inference-context-DNlGwzwy.mjs +0 -91
- package/dist/.setup/managed-binary-BtIjV7yN.mjs +0 -175
- package/dist/.setup/native-execution-policy-MXEe7PB3.mjs +0 -75
- package/dist/.setup/protocol-CANUwXJ3.mjs +0 -17
- package/dist/.setup/side-question-Bz2UQW0l.mjs +0 -826
package/dist/.setup/{session-catalog-index-CrnfVEnT.mjs → session-catalog-index-qt4UWBua.mjs}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { S as readControlCursor, _ as normalizeLimit, c as MAX_CWD_LENGTH, d as boundedCatalogString, h as filterCatalogPageByTitle, m as codexCatalogThreadStatus, o as CatalogParamsError, p as codexCatalogThreadName } from "./session-catalog-parsing-
|
|
2
|
-
import { n as detachCodexCatalogString, t as CODEX_CATALOG_MAX_ROWS } from "./session-catalog-limits-
|
|
3
|
-
import { i as retainCodexCatalogRow, n as codexCatalogRowRecency, r as compareCodexCatalogRows, t as CodexCatalogOrdering } from "./session-catalog-index-order-
|
|
4
|
-
import { c as CodexCatalogPersistence, i as CodexCatalogAvailability, l as codexCatalogMetadataPage, r as withCodexCatalogListRequest } from "./session-catalog-list-request-
|
|
5
|
-
import {
|
|
6
|
-
import { r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-
|
|
7
|
-
import { i as subscribeCodexCatalogEvents } from "./session-catalog-events-
|
|
1
|
+
import { S as readControlCursor, _ as normalizeLimit, c as MAX_CWD_LENGTH, d as boundedCatalogString, h as filterCatalogPageByTitle, m as codexCatalogThreadStatus, o as CatalogParamsError, p as codexCatalogThreadName } from "./session-catalog-parsing-V6jyFg9g.mjs";
|
|
2
|
+
import { n as detachCodexCatalogString, t as CODEX_CATALOG_MAX_ROWS } from "./session-catalog-limits-Dc6E0BZz.mjs";
|
|
3
|
+
import { i as retainCodexCatalogRow, n as codexCatalogRowRecency, r as compareCodexCatalogRows, t as CodexCatalogOrdering } from "./session-catalog-index-order-0Zqng2u8.mjs";
|
|
4
|
+
import { c as CodexCatalogPersistence, i as CodexCatalogAvailability, l as codexCatalogMetadataPage, r as withCodexCatalogListRequest } from "./session-catalog-list-request-CAjoWjaH.mjs";
|
|
5
|
+
import { i as getCodexCatalogSource, s as setCodexCatalogSource } from "./session-catalog-source-z_mNyQdX.mjs";
|
|
6
|
+
import { r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-BqBYi6kV.mjs";
|
|
7
|
+
import { i as subscribeCodexCatalogEvents } from "./session-catalog-events-CEi6SuLQ.mjs";
|
|
8
8
|
import { a as reportCodexCatalogSpawnFailure, n as findCodexAppServerSpawnError } from "./spawn-error-CL3n6MAa.mjs";
|
|
9
|
-
import { CodexCatalogProjectionCapacityError, CodexCatalogProjections, mergeCodexCatalogRolloutRow, n as readCodexCatalogRollout, projectCodexCatalogPage, r as resolveCodexCatalogRolloutFingerprint, t as codexCatalogRolloutLogicalPath } from "./session-catalog-projection-
|
|
9
|
+
import { CodexCatalogProjectionCapacityError, CodexCatalogProjections, mergeCodexCatalogRolloutRow, n as readCodexCatalogRollout, projectCodexCatalogPage, r as resolveCodexCatalogRolloutFingerprint, t as codexCatalogRolloutLogicalPath } from "./session-catalog-projection-CNyhjZze.mjs";
|
|
10
10
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
11
|
import { createHash } from "node:crypto";
|
|
12
12
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -108,15 +108,14 @@ var CodexCatalogCurrency = class {
|
|
|
108
108
|
this.initial.unref();
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
close() {
|
|
111
|
+
async close() {
|
|
112
112
|
this.closed = true;
|
|
113
113
|
this.cancelHydration();
|
|
114
114
|
clearInterval(this.timer);
|
|
115
115
|
this.timer = void 0;
|
|
116
116
|
clearTimeout(this.initial);
|
|
117
117
|
this.initial = void 0;
|
|
118
|
-
|
|
119
|
-
return this.running ?? this.safetyRefresh;
|
|
118
|
+
await Promise.allSettled([this.running, this.safetyRefresh]);
|
|
120
119
|
}
|
|
121
120
|
};
|
|
122
121
|
//#endregion
|
|
@@ -185,7 +184,7 @@ function encodeCodexNativeCursor(cursor) {
|
|
|
185
184
|
}
|
|
186
185
|
//#endregion
|
|
187
186
|
//#region extensions/codex/src/session-catalog-index-events.ts
|
|
188
|
-
/**
|
|
187
|
+
/** Coalesces metadata refreshes while the index owns row publication. */
|
|
189
188
|
var CodexCatalogIndexEvents = class {
|
|
190
189
|
constructor(owner) {
|
|
191
190
|
this.owner = owner;
|
|
@@ -239,7 +238,7 @@ var CodexCatalogIndexEvents = class {
|
|
|
239
238
|
}
|
|
240
239
|
if (event.method === "turn/started" || event.method === "turn/completed" || event.method === "thread/unarchived" || event.method === "thread/reverted") {
|
|
241
240
|
if (event.method !== "thread/unarchived" && this.owner.get(id)?.archived) return;
|
|
242
|
-
this.enqueueRefresh(id, readThread,
|
|
241
|
+
this.enqueueRefresh(id, readThread, event.method === "turn/started" ? this.owner.reserveTurnStartOrder() : void 0);
|
|
243
242
|
}
|
|
244
243
|
}
|
|
245
244
|
hasCapacity() {
|
|
@@ -247,12 +246,11 @@ var CodexCatalogIndexEvents = class {
|
|
|
247
246
|
this.owner.report(/* @__PURE__ */ new Error("Codex catalog event queue reached its resident row limit"));
|
|
248
247
|
return false;
|
|
249
248
|
}
|
|
250
|
-
enqueueRefresh(id, readThread,
|
|
249
|
+
enqueueRefresh(id, readThread, sourceOrder) {
|
|
251
250
|
this.owner.requestNativeRefresh();
|
|
252
251
|
const existing = this.pending.get(id);
|
|
253
252
|
if (existing) {
|
|
254
253
|
existing.readThread = readThread;
|
|
255
|
-
existing.source = source;
|
|
256
254
|
existing.dirty = true;
|
|
257
255
|
existing.sourceOrder = sourceOrder ?? existing.sourceOrder;
|
|
258
256
|
return;
|
|
@@ -260,7 +258,6 @@ var CodexCatalogIndexEvents = class {
|
|
|
260
258
|
if (!this.hasCapacity()) return;
|
|
261
259
|
const pending = {
|
|
262
260
|
readThread,
|
|
263
|
-
source,
|
|
264
261
|
dirty: true,
|
|
265
262
|
sourceOrder,
|
|
266
263
|
promise: Promise.resolve()
|
|
@@ -271,17 +268,11 @@ var CodexCatalogIndexEvents = class {
|
|
|
271
268
|
while (!this.closed && pending.dirty) {
|
|
272
269
|
pending.dirty = false;
|
|
273
270
|
const observedSourceOrder = pending.sourceOrder;
|
|
274
|
-
const observedSource = pending.source;
|
|
275
271
|
try {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
if (published && pending.sourceOrder === observedSourceOrder) pending.sourceOrder = void 0;
|
|
279
|
-
else if (!published && pending.sourceOrder !== void 0) pending.dirty = true;
|
|
272
|
+
await this.owner.refresh(id, pending.readThread, observedSourceOrder);
|
|
273
|
+
if (pending.sourceOrder === observedSourceOrder) pending.sourceOrder = void 0;
|
|
280
274
|
} catch (error) {
|
|
281
|
-
|
|
282
|
-
if (pending.source === observedSource) pending.dirty = false;
|
|
283
|
-
this.owner.report(new Error("Codex catalog observation interrupted by client closure; metadata refresh deferred to the current catalog owner", { cause: error }), "deferred");
|
|
284
|
-
} else this.owner.report(error);
|
|
275
|
+
this.owner.report(error);
|
|
285
276
|
}
|
|
286
277
|
}
|
|
287
278
|
} finally {
|
|
@@ -296,45 +287,28 @@ var CodexCatalogIndexEvents = class {
|
|
|
296
287
|
};
|
|
297
288
|
//#endregion
|
|
298
289
|
//#region extensions/codex/src/session-catalog-index-field.ts
|
|
299
|
-
/**
|
|
290
|
+
/** Bounded display observations; later publications replace earlier ones. */
|
|
300
291
|
var CodexCatalogField = class {
|
|
301
292
|
constructor() {
|
|
302
|
-
this.revision = 0;
|
|
303
|
-
this.minimumCapture = 0;
|
|
304
293
|
this.entries = /* @__PURE__ */ new Map();
|
|
305
294
|
}
|
|
306
|
-
capture() {
|
|
307
|
-
return ++this.revision;
|
|
308
|
-
}
|
|
309
295
|
update(threadId, value) {
|
|
310
|
-
this.put(threadId,
|
|
311
|
-
revision: ++this.revision,
|
|
312
|
-
value
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
observe(threadId, value, capturedRevision) {
|
|
316
|
-
if (capturedRevision < this.minimumCapture || (this.entries.get(threadId)?.revision ?? 0) > capturedRevision) return false;
|
|
317
|
-
this.put(threadId, {
|
|
318
|
-
revision: capturedRevision,
|
|
319
|
-
value
|
|
320
|
-
});
|
|
321
|
-
return true;
|
|
296
|
+
this.put(threadId, value);
|
|
322
297
|
}
|
|
323
298
|
get(threadId) {
|
|
324
|
-
return this.entries.get(threadId)
|
|
299
|
+
return this.entries.get(threadId);
|
|
325
300
|
}
|
|
326
301
|
some(predicate) {
|
|
327
|
-
for (const entry of this.entries.values()) if (
|
|
302
|
+
for (const entry of this.entries.values()) if (predicate(entry)) return true;
|
|
328
303
|
return false;
|
|
329
304
|
}
|
|
330
305
|
delete(threadId) {
|
|
331
|
-
this.
|
|
306
|
+
this.entries.delete(threadId);
|
|
332
307
|
}
|
|
333
308
|
deleteWhere(predicate) {
|
|
334
|
-
for (const [threadId, entry] of this.entries) if (
|
|
309
|
+
for (const [threadId, entry] of this.entries) if (predicate(entry)) this.delete(threadId);
|
|
335
310
|
}
|
|
336
311
|
invalidate() {
|
|
337
|
-
this.minimumCapture = ++this.revision;
|
|
338
312
|
this.entries.clear();
|
|
339
313
|
}
|
|
340
314
|
put(threadId, entry) {
|
|
@@ -342,26 +316,17 @@ var CodexCatalogField = class {
|
|
|
342
316
|
if (!id) return;
|
|
343
317
|
this.entries.delete(id);
|
|
344
318
|
this.entries.set(id, entry);
|
|
345
|
-
if (this.entries.size > 2e4)
|
|
346
|
-
const oldest = this.entries.entries().next().value;
|
|
347
|
-
if (oldest) {
|
|
348
|
-
this.minimumCapture = Math.max(this.minimumCapture, oldest[1].revision);
|
|
349
|
-
this.entries.delete(oldest[0]);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
319
|
+
if (this.entries.size > 2e4) this.entries.delete(this.entries.keys().next().value);
|
|
352
320
|
}
|
|
353
321
|
};
|
|
354
|
-
/** Live field values
|
|
322
|
+
/** Live field values retain source-lifetime invalidation. */
|
|
355
323
|
var CodexCatalogLiveField = class {
|
|
356
324
|
constructor() {
|
|
357
325
|
this.values = new CodexCatalogField();
|
|
358
326
|
}
|
|
359
|
-
capture() {
|
|
360
|
-
return this.values.capture();
|
|
361
|
-
}
|
|
362
327
|
get(threadId) {
|
|
363
328
|
const current = this.values.get(threadId);
|
|
364
|
-
return current &&
|
|
329
|
+
return current && !current.source.closed ? current.value : void 0;
|
|
365
330
|
}
|
|
366
331
|
delete(threadId) {
|
|
367
332
|
this.values.delete(threadId);
|
|
@@ -371,10 +336,7 @@ var CodexCatalogLiveField = class {
|
|
|
371
336
|
this.values.invalidate();
|
|
372
337
|
return;
|
|
373
338
|
}
|
|
374
|
-
this.values.deleteWhere((entry) =>
|
|
375
|
-
entry.sources.delete(source);
|
|
376
|
-
return !hasLiveCodexCatalogSource(entry.sources);
|
|
377
|
-
});
|
|
339
|
+
this.values.deleteWhere((entry) => entry.source === source);
|
|
378
340
|
}
|
|
379
341
|
};
|
|
380
342
|
//#endregion
|
|
@@ -463,7 +425,12 @@ var CodexCatalogRolloutScanner = class {
|
|
|
463
425
|
const running = (async () => {
|
|
464
426
|
await previous?.catch(() => void 0);
|
|
465
427
|
await setImmediate$1();
|
|
466
|
-
|
|
428
|
+
try {
|
|
429
|
+
return await this.walk(trackedPaths);
|
|
430
|
+
} catch (error) {
|
|
431
|
+
for (const cached of this.directories.values()) cached.dirty = true;
|
|
432
|
+
throw error;
|
|
433
|
+
}
|
|
467
434
|
})();
|
|
468
435
|
this.running = running;
|
|
469
436
|
return running.finally(() => {
|
|
@@ -485,12 +452,12 @@ var CodexCatalogRolloutScanner = class {
|
|
|
485
452
|
const cached = {
|
|
486
453
|
watcher,
|
|
487
454
|
stat,
|
|
488
|
-
|
|
455
|
+
dirty: true,
|
|
489
456
|
armAt: process.platform === "darwin" ? performance.now() + DARWIN_WATCH_ARM_MS : 0,
|
|
490
457
|
files: /* @__PURE__ */ new Map()
|
|
491
458
|
};
|
|
492
459
|
watcher.on("change", () => {
|
|
493
|
-
cached.
|
|
460
|
+
cached.dirty = true;
|
|
494
461
|
});
|
|
495
462
|
const withdraw = () => {
|
|
496
463
|
if (this.directories.get(directory) === cached) this.forget(directory);
|
|
@@ -503,13 +470,11 @@ var CodexCatalogRolloutScanner = class {
|
|
|
503
470
|
return;
|
|
504
471
|
}
|
|
505
472
|
}
|
|
506
|
-
async walk(trackedPaths
|
|
473
|
+
async walk(trackedPaths) {
|
|
507
474
|
if (this.closed) throw new Error("Codex catalog rollout scanner is closed");
|
|
508
475
|
const present = /* @__PURE__ */ new Set();
|
|
509
476
|
const unvisited = new Set(this.directories.keys());
|
|
510
477
|
const candidates = new NewestRolloutCandidates();
|
|
511
|
-
const reused = /* @__PURE__ */ new Map();
|
|
512
|
-
let cacheWithdrawn = false;
|
|
513
478
|
let processed = 0;
|
|
514
479
|
const offer = (file, fingerprint) => {
|
|
515
480
|
if (trackedPaths.has(codexCatalogRolloutLogicalPath(file))) present.add(codexCatalogRolloutLogicalPath(file));
|
|
@@ -528,29 +493,16 @@ var CodexCatalogRolloutScanner = class {
|
|
|
528
493
|
this.forget(directory);
|
|
529
494
|
cached = void 0;
|
|
530
495
|
}
|
|
531
|
-
if (
|
|
532
|
-
const revision = cached.revision;
|
|
533
|
-
reused.set(directory, {
|
|
534
|
-
cached,
|
|
535
|
-
revision
|
|
536
|
-
});
|
|
496
|
+
if (cached && !cached.dirty) {
|
|
537
497
|
for (const [file, fingerprint] of cached.files) {
|
|
538
498
|
offer(file, fingerprint);
|
|
539
|
-
if (++processed % SCAN_BATCH_SIZE === 0)
|
|
540
|
-
await setImmediate$1();
|
|
541
|
-
if (this.directories.get(directory) !== cached || cached.revision !== revision) {
|
|
542
|
-
cacheWithdrawn = true;
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
499
|
+
if (++processed % SCAN_BATCH_SIZE === 0) await setImmediate$1();
|
|
546
500
|
}
|
|
547
501
|
return;
|
|
548
502
|
}
|
|
549
503
|
cached ??= this.watch(directory, stat);
|
|
550
504
|
}
|
|
551
|
-
if (cached) cached.
|
|
552
|
-
const revision = cached?.revision;
|
|
553
|
-
const armed = cached && performance.now() >= cached.armAt;
|
|
505
|
+
if (cached) cached.dirty = performance.now() < cached.armAt;
|
|
554
506
|
const retained = cached ? /* @__PURE__ */ new Map() : void 0;
|
|
555
507
|
let cacheable = true;
|
|
556
508
|
const entries = await unlessMissing(fs$1.opendir(directory));
|
|
@@ -559,7 +511,6 @@ var CodexCatalogRolloutScanner = class {
|
|
|
559
511
|
return;
|
|
560
512
|
}
|
|
561
513
|
for await (const entry of entries) {
|
|
562
|
-
if (cacheWithdrawn) return;
|
|
563
514
|
if (this.closed) throw new Error("Codex catalog rollout scanner is closed");
|
|
564
515
|
if (++processed % SCAN_BATCH_SIZE === 0) await setImmediate$1();
|
|
565
516
|
const file = path.join(directory, entry.name);
|
|
@@ -590,12 +541,10 @@ var CodexCatalogRolloutScanner = class {
|
|
|
590
541
|
}
|
|
591
542
|
}
|
|
592
543
|
if (cached && retained && stat) {
|
|
593
|
-
|
|
594
|
-
if (cacheable && !this.closed && this.directories.get(directory) === cached && current?.isDirectory() && sameDirectory(stat, current)) {
|
|
544
|
+
if (cacheable && !this.closed && this.directories.get(directory) === cached) {
|
|
595
545
|
this.cachedFiles += retained.size - cached.files.size;
|
|
596
546
|
cached.files = retained;
|
|
597
547
|
cached.stat = stat;
|
|
598
|
-
cached.scannedRevision = armed && cached.revision === revision ? revision : void 0;
|
|
599
548
|
} else this.forget(directory);
|
|
600
549
|
}
|
|
601
550
|
};
|
|
@@ -604,7 +553,6 @@ var CodexCatalogRolloutScanner = class {
|
|
|
604
553
|
const rootReal = await unlessMissing(fs$1.realpath(this.sessionsRoot));
|
|
605
554
|
if (rootReal) await scan(rootReal, 0, rootReal);
|
|
606
555
|
}
|
|
607
|
-
if (cacheWithdrawn || [...reused].some(([directory, { cached, revision }]) => this.directories.get(directory) !== cached || cached.revision !== revision)) return this.walk(trackedPaths, false);
|
|
608
556
|
for (const directory of unvisited) this.forget(directory);
|
|
609
557
|
return {
|
|
610
558
|
files: candidates.finish(),
|
|
@@ -619,7 +567,7 @@ var CodexCatalogRolloutScanner = class {
|
|
|
619
567
|
//#endregion
|
|
620
568
|
//#region extensions/codex/src/session-catalog-index-files.ts
|
|
621
569
|
/** Plan file reconciliation; the index retains every publication and lifetime decision. */
|
|
622
|
-
async function reconcileCodexCatalogFiles(root,
|
|
570
|
+
async function reconcileCodexCatalogFiles(root, owner) {
|
|
623
571
|
const byPath = /* @__PURE__ */ new Map();
|
|
624
572
|
let processed = 0;
|
|
625
573
|
for (const row of owner.rows.values()) {
|
|
@@ -656,7 +604,6 @@ async function reconcileCodexCatalogFiles(root, isCurrent, owner) {
|
|
|
656
604
|
observed.set(file, fingerprint);
|
|
657
605
|
continue;
|
|
658
606
|
}
|
|
659
|
-
if (!isCurrent(thread.id)) continue;
|
|
660
607
|
const existing = owner.rows.get(thread.id);
|
|
661
608
|
if (existing?.rolloutPath && codexCatalogRolloutLogicalPath(existing.rolloutPath) !== codexCatalogRolloutLogicalPath(file)) {
|
|
662
609
|
observed.set(file, fingerprint);
|
|
@@ -672,11 +619,9 @@ async function reconcileCodexCatalogFiles(root, isCurrent, owner) {
|
|
|
672
619
|
sanitize: sanitizeTerminalText
|
|
673
620
|
});
|
|
674
621
|
owner.assertCurrent();
|
|
675
|
-
if (!isCurrent(thread.id)) continue;
|
|
676
622
|
observed.set(file, fingerprint);
|
|
677
623
|
const row = projected.rows[0];
|
|
678
624
|
if (!row) continue;
|
|
679
|
-
owner.mark(row.threadId);
|
|
680
625
|
owner.put(mergeCodexCatalogRolloutRow(row, existing, fingerprint));
|
|
681
626
|
await setImmediate$1();
|
|
682
627
|
}
|
|
@@ -706,49 +651,6 @@ function applyCodexCatalogName(row, name) {
|
|
|
706
651
|
};
|
|
707
652
|
}
|
|
708
653
|
//#endregion
|
|
709
|
-
//#region extensions/codex/src/session-catalog-index-observations.ts
|
|
710
|
-
/** Fences asynchronous observations against later catalog mutations. */
|
|
711
|
-
var CodexCatalogObservations = class {
|
|
712
|
-
constructor() {
|
|
713
|
-
this.revision = 0;
|
|
714
|
-
this.minimumCapture = 0;
|
|
715
|
-
this.mutations = /* @__PURE__ */ new Map();
|
|
716
|
-
this.observations = /* @__PURE__ */ new Map();
|
|
717
|
-
}
|
|
718
|
-
hasActiveWork() {
|
|
719
|
-
return this.observations.size > 0;
|
|
720
|
-
}
|
|
721
|
-
mark(threadId) {
|
|
722
|
-
this.revision++;
|
|
723
|
-
if (this.observations.size) {
|
|
724
|
-
const id = boundedCatalogString(threadId, 256);
|
|
725
|
-
if (!id) return;
|
|
726
|
-
this.mutations.delete(id);
|
|
727
|
-
this.mutations.set(id, this.revision);
|
|
728
|
-
if (this.mutations.size > 2e4) {
|
|
729
|
-
const oldest = this.mutations.entries().next().value;
|
|
730
|
-
this.minimumCapture = Math.max(this.minimumCapture, oldest[1]);
|
|
731
|
-
this.mutations.delete(oldest[0]);
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
async observe(read) {
|
|
736
|
-
const token = Symbol("catalog observation");
|
|
737
|
-
const revision = this.revision;
|
|
738
|
-
this.observations.set(token, revision);
|
|
739
|
-
try {
|
|
740
|
-
return await read((id) => revision >= this.minimumCapture && (this.mutations.get(id) ?? 0) <= revision);
|
|
741
|
-
} finally {
|
|
742
|
-
this.observations.delete(token);
|
|
743
|
-
const oldest = this.observations.values().next().value ?? Infinity;
|
|
744
|
-
for (const [id, changed] of this.mutations) {
|
|
745
|
-
if (changed > oldest) break;
|
|
746
|
-
this.mutations.delete(id);
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
//#endregion
|
|
752
654
|
//#region extensions/codex/src/session-catalog-status.ts
|
|
753
655
|
function applyCodexCatalogLiveFields({ status: _storedStatus, activeFlags: _storedFlags, ...session }, live, settings) {
|
|
754
656
|
return {
|
|
@@ -758,48 +660,24 @@ function applyCodexCatalogLiveFields({ status: _storedStatus, activeFlags: _stor
|
|
|
758
660
|
...live?.activeFlags ? { activeFlags: [...live.activeFlags] } : {}
|
|
759
661
|
};
|
|
760
662
|
}
|
|
761
|
-
|
|
762
|
-
/** Equivalent broadcasts retain at most 64 source witnesses for each bounded resident row. */
|
|
663
|
+
/** One latest display observation; native actions verify their own current state. */
|
|
763
664
|
var CodexCatalogStatusIndex = class extends CodexCatalogLiveField {
|
|
764
665
|
update(threadId, status, source) {
|
|
765
|
-
const next = this.next(threadId, status, source);
|
|
766
|
-
if (next) this.values.update(threadId, next);
|
|
767
|
-
}
|
|
768
|
-
observe(row, revision) {
|
|
769
|
-
const session = row.page.sessions[0];
|
|
770
|
-
const source = getCodexCatalogSource(row);
|
|
771
|
-
if (session && source) {
|
|
772
|
-
const next = this.next(row.threadId, {
|
|
773
|
-
status: session.status,
|
|
774
|
-
...session.activeFlags ? { activeFlags: session.activeFlags } : {}
|
|
775
|
-
}, source);
|
|
776
|
-
if (next) this.values.observe(row.threadId, next, revision);
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
next(threadId, status, source) {
|
|
780
666
|
if (source.closed) return;
|
|
781
667
|
const current = this.values.get(threadId);
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
sources.delete(source);
|
|
785
|
-
if (sources.size) return {
|
|
786
|
-
value: current.value,
|
|
787
|
-
sources
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
const flags = status.activeFlags ?? [];
|
|
791
|
-
const previousFlags = current?.value.activeFlags ?? [];
|
|
792
|
-
if (current?.value.status === status.status && flags.length === previousFlags.length && flags.every((flag, index) => flag === previousFlags[index])) {
|
|
793
|
-
if (sources.size < MAX_STATUS_SOURCE_WITNESSES) sources.add(source);
|
|
794
|
-
return {
|
|
795
|
-
value: status,
|
|
796
|
-
sources
|
|
797
|
-
};
|
|
798
|
-
}
|
|
799
|
-
return {
|
|
668
|
+
if (status.status === "notLoaded" && current && !current.source.closed && current.source !== source) return;
|
|
669
|
+
this.values.update(threadId, {
|
|
800
670
|
value: status,
|
|
801
|
-
|
|
802
|
-
};
|
|
671
|
+
source
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
observe(row) {
|
|
675
|
+
const session = row.page.sessions[0];
|
|
676
|
+
const source = getCodexCatalogSource(row);
|
|
677
|
+
if (session && source) this.update(row.threadId, {
|
|
678
|
+
status: session.status,
|
|
679
|
+
...session.activeFlags ? { activeFlags: session.activeFlags } : {}
|
|
680
|
+
}, source);
|
|
803
681
|
}
|
|
804
682
|
};
|
|
805
683
|
//#endregion
|
|
@@ -927,7 +805,6 @@ var CodexCatalogNativePages = class {
|
|
|
927
805
|
const filterCwdLocally = Boolean(cwd && this.settings.hasLiveCwd());
|
|
928
806
|
const ascending = position.backwards && !position.anchorThreadId;
|
|
929
807
|
const pageLimit = position.anchorThreadId ? 64 : limit;
|
|
930
|
-
const statusRevision = this.status.capture();
|
|
931
808
|
const page = await request.read(Number.POSITIVE_INFINITY, () => options.readNative({
|
|
932
809
|
archived: false,
|
|
933
810
|
modelProviders: [],
|
|
@@ -939,7 +816,7 @@ var CodexCatalogNativePages = class {
|
|
|
939
816
|
...position.cursor ? { cursor: position.cursor } : {}
|
|
940
817
|
}, pageLimit, request));
|
|
941
818
|
options.assertCurrent();
|
|
942
|
-
for (const row of page.rows) this.status.observe(row
|
|
819
|
+
for (const row of page.rows) this.status.observe(row);
|
|
943
820
|
if (cwd && !filterCwdLocally && this.settings.hasLiveCwd()) continue;
|
|
944
821
|
let rows = ascending ? page.rows.toReversed() : page.rows;
|
|
945
822
|
let next = (ascending ? page.backwardsCursor : page.nextCursor) ? at(ascending ? page.backwardsCursor : page.nextCursor, false) : void 0;
|
|
@@ -993,7 +870,6 @@ var CodexCatalogNativePages = class {
|
|
|
993
870
|
};
|
|
994
871
|
//#endregion
|
|
995
872
|
//#region extensions/codex/src/session-catalog-settings.ts
|
|
996
|
-
const MAX_SETTINGS_SOURCE_WITNESSES = 64;
|
|
997
873
|
/** Live settings overlay native stored metadata only while a supporting source stays open. */
|
|
998
874
|
var CodexCatalogSettingsIndex = class extends CodexCatalogLiveField {
|
|
999
875
|
update(threadId, settings, source) {
|
|
@@ -1005,24 +881,16 @@ var CodexCatalogSettingsIndex = class extends CodexCatalogLiveField {
|
|
|
1005
881
|
...cwd ? { cwd } : {},
|
|
1006
882
|
...modelProvider ? { modelProvider } : {}
|
|
1007
883
|
};
|
|
1008
|
-
const current = this.values.get(threadId);
|
|
1009
|
-
const sources = /* @__PURE__ */ new Set();
|
|
1010
|
-
if (current && current.value.cwd === bounded.cwd && current.value.modelProvider === bounded.modelProvider) {
|
|
1011
|
-
for (const witness of current.sources) if (!witness.closed) sources.add(witness);
|
|
1012
|
-
}
|
|
1013
|
-
if (sources.size < MAX_SETTINGS_SOURCE_WITNESSES) sources.add(source);
|
|
1014
884
|
this.values.update(threadId, {
|
|
1015
885
|
value: bounded,
|
|
1016
|
-
|
|
886
|
+
source
|
|
1017
887
|
});
|
|
1018
888
|
}
|
|
1019
889
|
hasLiveCwd() {
|
|
1020
|
-
return this.values.some(({ value,
|
|
890
|
+
return this.values.some(({ value, source }) => Boolean(value.cwd) && !source.closed);
|
|
1021
891
|
}
|
|
1022
892
|
withdraw(threadId, source) {
|
|
1023
|
-
|
|
1024
|
-
if (!current?.sources.delete(source)) return;
|
|
1025
|
-
if (!hasLiveCodexCatalogSource(current.sources)) this.values.delete(threadId);
|
|
893
|
+
if (this.values.get(threadId)?.source === source) this.values.delete(threadId);
|
|
1026
894
|
}
|
|
1027
895
|
};
|
|
1028
896
|
//#endregion
|
|
@@ -1045,9 +913,7 @@ var CodexCatalogIndex = class {
|
|
|
1045
913
|
this.projections = new CodexCatalogProjections();
|
|
1046
914
|
this.observedFiles = /* @__PURE__ */ new Map();
|
|
1047
915
|
this.obsoleteStoredKeys = /* @__PURE__ */ new Set();
|
|
1048
|
-
this.sourceRevision = 0;
|
|
1049
916
|
this.ordering = new CodexCatalogOrdering();
|
|
1050
|
-
this.observations = new CodexCatalogObservations();
|
|
1051
917
|
this.rolloutScanner = options.localSessionsRoot ? new CodexCatalogRolloutScanner(options.localSessionsRoot) : void 0;
|
|
1052
918
|
this.currency = new CodexCatalogCurrency({
|
|
1053
919
|
local: Boolean(options.localSessionsRoot),
|
|
@@ -1079,7 +945,7 @@ var CodexCatalogIndex = class {
|
|
|
1079
945
|
this.currency.requestNativeRefresh();
|
|
1080
946
|
this.remove(id);
|
|
1081
947
|
},
|
|
1082
|
-
report: (error
|
|
948
|
+
report: (error) => this.report(error)
|
|
1083
949
|
});
|
|
1084
950
|
this.unsubscribe = subscribeCodexCatalogEvents(options.homeId, (event, readThread, source) => this.events.handle(event, readThread, source), {
|
|
1085
951
|
onEphemeralThread: (id) => this.remove(id),
|
|
@@ -1093,7 +959,6 @@ var CodexCatalogIndex = class {
|
|
|
1093
959
|
},
|
|
1094
960
|
onRemoteReady: () => {
|
|
1095
961
|
if (this.closed || options.localSessionsRoot) return;
|
|
1096
|
-
this.sourceRevision++;
|
|
1097
962
|
if (!this.initializing) {
|
|
1098
963
|
this.initialized = false;
|
|
1099
964
|
this.scheduleHydration();
|
|
@@ -1110,8 +975,8 @@ var CodexCatalogIndex = class {
|
|
|
1110
975
|
throw error;
|
|
1111
976
|
}
|
|
1112
977
|
}
|
|
1113
|
-
report(error
|
|
1114
|
-
if (!this.closed && !this.currency.stopForTerminalFailure(error)) embeddedAgentLog.warn(
|
|
978
|
+
report(error) {
|
|
979
|
+
if (!this.closed && !this.currency.stopForTerminalFailure(error)) embeddedAgentLog.warn("Codex resident catalog background update failed", { error });
|
|
1115
980
|
}
|
|
1116
981
|
withName(row) {
|
|
1117
982
|
const known = this.names.get(row.threadId);
|
|
@@ -1145,7 +1010,6 @@ var CodexCatalogIndex = class {
|
|
|
1145
1010
|
this.persistence.remove(threadId);
|
|
1146
1011
|
}
|
|
1147
1012
|
remove(threadId) {
|
|
1148
|
-
this.observations.mark(threadId);
|
|
1149
1013
|
this.evict(threadId);
|
|
1150
1014
|
this.liveStatus.delete(threadId);
|
|
1151
1015
|
this.liveSettings.delete(threadId);
|
|
@@ -1158,40 +1022,32 @@ var CodexCatalogIndex = class {
|
|
|
1158
1022
|
if (this.initialized && !this.needsNativeRefresh) return;
|
|
1159
1023
|
if (!this.initializing) {
|
|
1160
1024
|
this.availability.begin();
|
|
1161
|
-
const sourceRevision = this.sourceRevision;
|
|
1162
1025
|
this.initializing = (async () => {
|
|
1163
1026
|
await this.restore();
|
|
1164
1027
|
await this.persistence.pruneObsolete(this.obsoleteStoredKeys, this.rows.values());
|
|
1165
1028
|
this.obsoleteStoredKeys.clear();
|
|
1166
1029
|
await this.reconcilingNative?.catch((error) => this.report(error));
|
|
1167
|
-
if (!this.initialized)
|
|
1168
|
-
|
|
1169
|
-
do
|
|
1170
|
-
observedRevision = await this.hydrate(this.availability.complete);
|
|
1171
|
-
while (observedRevision !== this.sourceRevision);
|
|
1172
|
-
} else if (this.needsNativeRefresh) {
|
|
1030
|
+
if (!this.initialized) await this.hydrate(this.availability.complete);
|
|
1031
|
+
else if (this.needsNativeRefresh) {
|
|
1173
1032
|
await this.reconcile();
|
|
1174
1033
|
await this.reconcileNative();
|
|
1175
1034
|
}
|
|
1176
1035
|
this.needsNativeRefresh = false;
|
|
1177
1036
|
this.initialized = true;
|
|
1178
|
-
this.failure = void 0;
|
|
1179
1037
|
this.currency.start();
|
|
1180
1038
|
})().catch((error) => {
|
|
1181
|
-
this.failure = { error };
|
|
1182
1039
|
this.availability.fail(error);
|
|
1183
1040
|
this.currency.stopForTerminalFailure(error);
|
|
1184
1041
|
throw error;
|
|
1185
1042
|
}).finally(() => {
|
|
1186
1043
|
this.initializing = void 0;
|
|
1187
|
-
if (this.failure && sourceRevision !== this.sourceRevision) this.scheduleHydration();
|
|
1188
1044
|
});
|
|
1189
1045
|
}
|
|
1190
1046
|
return this.initializing;
|
|
1191
1047
|
}
|
|
1192
1048
|
async restore() {
|
|
1193
1049
|
if (this.restored) return;
|
|
1194
|
-
this.restoring ??=
|
|
1050
|
+
this.restoring ??= (async () => {
|
|
1195
1051
|
try {
|
|
1196
1052
|
const snapshot = await this.persistence.readSnapshot();
|
|
1197
1053
|
this.assertCurrent();
|
|
@@ -1203,19 +1059,17 @@ var CodexCatalogIndex = class {
|
|
|
1203
1059
|
await setImmediate$1();
|
|
1204
1060
|
this.assertCurrent();
|
|
1205
1061
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
this.ordering.restore(row);
|
|
1218
|
-
}
|
|
1062
|
+
const restored = row.rolloutPath ? {
|
|
1063
|
+
...row,
|
|
1064
|
+
rolloutPath: codexCatalogRolloutLogicalPath(row.rolloutPath)
|
|
1065
|
+
} : row;
|
|
1066
|
+
const patched = this.withName(restored);
|
|
1067
|
+
if (patched !== restored) this.persistence.put(patched);
|
|
1068
|
+
const previous = this.rows.get(patched.threadId);
|
|
1069
|
+
const evicted = retainCodexCatalogRow(this.rows, patched);
|
|
1070
|
+
if (evicted) this.evict(evicted.threadId, evicted);
|
|
1071
|
+
if (evicted !== patched) this.ordering.put(patched, previous);
|
|
1072
|
+
this.ordering.restore(row);
|
|
1219
1073
|
}
|
|
1220
1074
|
this.overflow ||= snapshot.overflow || this.rows.size >= 2e4;
|
|
1221
1075
|
if (snapshot.complete) {
|
|
@@ -1228,24 +1082,19 @@ var CodexCatalogIndex = class {
|
|
|
1228
1082
|
this.persistence.invalidate(error);
|
|
1229
1083
|
}
|
|
1230
1084
|
this.restored = true;
|
|
1231
|
-
});
|
|
1085
|
+
})();
|
|
1232
1086
|
await this.restoring;
|
|
1233
1087
|
}
|
|
1234
1088
|
scheduleHydration() {
|
|
1235
1089
|
if (this.initialized && !this.needsNativeRefresh || this.initializing || this.closed) return;
|
|
1236
1090
|
this.currency.scheduleHydration(() => this.initialize());
|
|
1237
1091
|
}
|
|
1238
|
-
|
|
1239
|
-
return {
|
|
1240
|
-
status: this.liveStatus.capture(),
|
|
1241
|
-
name: this.names.capture()
|
|
1242
|
-
};
|
|
1243
|
-
}
|
|
1244
|
-
observeFields(row, revision) {
|
|
1092
|
+
observeFields(row) {
|
|
1245
1093
|
const session = row.page.sessions[0];
|
|
1246
1094
|
if (!session) return;
|
|
1247
|
-
this.liveStatus.observe(row
|
|
1248
|
-
if (session.name !== void 0
|
|
1095
|
+
this.liveStatus.observe(row);
|
|
1096
|
+
if (session.name !== void 0) {
|
|
1097
|
+
this.names.update(row.threadId, session.name);
|
|
1249
1098
|
const current = this.rows.get(row.threadId);
|
|
1250
1099
|
if (current && current.page.sessions[0]?.name !== session.name) this.put(current);
|
|
1251
1100
|
}
|
|
@@ -1258,32 +1107,25 @@ var CodexCatalogIndex = class {
|
|
|
1258
1107
|
return this.reconcilingNative;
|
|
1259
1108
|
}
|
|
1260
1109
|
hydrate(useStateDbOnly = false, incremental = false) {
|
|
1261
|
-
const run = () => this.
|
|
1110
|
+
const run = () => this.hydratePages(useStateDbOnly, incremental);
|
|
1262
1111
|
return this.options.runNativeWalk?.(run) ?? run();
|
|
1263
1112
|
}
|
|
1264
|
-
async hydratePages(
|
|
1113
|
+
async hydratePages(useStateDbOnly, incremental) {
|
|
1265
1114
|
this.assertCurrent();
|
|
1266
1115
|
const files = this.rolloutScanner && !useStateDbOnly ? (await this.rolloutScanner.scan(/* @__PURE__ */ new Set())).files : /* @__PURE__ */ new Map();
|
|
1267
1116
|
this.assertCurrent();
|
|
1268
|
-
let observedRevision;
|
|
1269
1117
|
let frontier;
|
|
1270
1118
|
const batchOrder = this.ordering.captureBatch(this.availability.complete);
|
|
1271
1119
|
const remaining = incremental ? void 0 : new Map(this.rows);
|
|
1272
1120
|
const pages = readCodexCatalogHydrationPages(async (params, remainingRows) => {
|
|
1273
1121
|
this.assertCurrent();
|
|
1274
|
-
|
|
1275
|
-
return {
|
|
1276
|
-
...await this.options.readNative(params, remainingRows),
|
|
1277
|
-
fieldRevision,
|
|
1278
|
-
sourceRevision: this.sourceRevision
|
|
1279
|
-
};
|
|
1122
|
+
return await this.options.readNative(params, remainingRows);
|
|
1280
1123
|
}, useStateDbOnly);
|
|
1281
1124
|
for await (const page of pages) {
|
|
1282
1125
|
this.assertCurrent();
|
|
1283
|
-
observedRevision ??= page.sourceRevision;
|
|
1284
1126
|
let sourceOrder = page.offset;
|
|
1285
1127
|
let changed = false;
|
|
1286
|
-
for (const id of page.excludedThreadIds ?? [])
|
|
1128
|
+
for (const id of page.excludedThreadIds ?? []) {
|
|
1287
1129
|
changed ||= this.rows.has(id);
|
|
1288
1130
|
this.remove(id);
|
|
1289
1131
|
}
|
|
@@ -1292,13 +1134,8 @@ var CodexCatalogIndex = class {
|
|
|
1292
1134
|
if (position >= 2e4) continue;
|
|
1293
1135
|
remaining?.delete(row.threadId);
|
|
1294
1136
|
const previous = this.rows.get(row.threadId);
|
|
1295
|
-
this.observeFields(row
|
|
1296
|
-
if (!isCurrent(row.threadId)) {
|
|
1297
|
-
changed = true;
|
|
1298
|
-
continue;
|
|
1299
|
-
}
|
|
1137
|
+
this.observeFields(row);
|
|
1300
1138
|
const fingerprint = resolveCodexCatalogRolloutFingerprint(row.rolloutPath, useStateDbOnly ? previous : void 0, files);
|
|
1301
|
-
this.observations.mark(row.threadId);
|
|
1302
1139
|
this.put({
|
|
1303
1140
|
...row,
|
|
1304
1141
|
sourceOrder: batchOrder(row, previous, position),
|
|
@@ -1315,30 +1152,28 @@ var CodexCatalogIndex = class {
|
|
|
1315
1152
|
}
|
|
1316
1153
|
}
|
|
1317
1154
|
if (remaining && (!useStateDbOnly || !this.options.localSessionsRoot)) {
|
|
1318
|
-
for (const [id, row] of remaining) if (
|
|
1155
|
+
for (const [id, row] of remaining) if (this.rows.get(id) === row) this.remove(id);
|
|
1319
1156
|
}
|
|
1320
1157
|
this.availability.publish(frontier, true);
|
|
1321
1158
|
await this.persistence.finishHydration(this.overflow);
|
|
1322
|
-
return observedRevision ?? this.sourceRevision;
|
|
1323
1159
|
}
|
|
1324
1160
|
reconcile() {
|
|
1325
|
-
if (!this.reconciling) this.reconciling = this.
|
|
1161
|
+
if (!this.reconciling) this.reconciling = this.reconcileFiles().finally(() => {
|
|
1326
1162
|
this.reconciling = void 0;
|
|
1327
1163
|
});
|
|
1328
1164
|
return this.reconciling;
|
|
1329
1165
|
}
|
|
1330
|
-
async reconcileFiles(
|
|
1166
|
+
async reconcileFiles() {
|
|
1331
1167
|
const root = this.options.localSessionsRoot;
|
|
1332
1168
|
if (!root || !this.rolloutScanner || !this.initialized || this.closed) return;
|
|
1333
1169
|
this.assertCurrent();
|
|
1334
|
-
this.observedFiles = await reconcileCodexCatalogFiles(root,
|
|
1170
|
+
this.observedFiles = await reconcileCodexCatalogFiles(root, {
|
|
1335
1171
|
rows: this.rows,
|
|
1336
1172
|
observedFiles: this.observedFiles,
|
|
1337
1173
|
scanner: this.rolloutScanner,
|
|
1338
1174
|
assertCurrent: () => this.assertCurrent(),
|
|
1339
1175
|
requestNativeRefresh: () => this.currency.requestNativeRefresh(),
|
|
1340
1176
|
report: (error) => this.report(error),
|
|
1341
|
-
mark: (id) => this.observations.mark(id),
|
|
1342
1177
|
put: (row) => this.put(row),
|
|
1343
1178
|
remove: (id) => this.remove(id)
|
|
1344
1179
|
});
|
|
@@ -1353,11 +1188,7 @@ var CodexCatalogIndex = class {
|
|
|
1353
1188
|
try {
|
|
1354
1189
|
this.currency.requestNativeRefresh();
|
|
1355
1190
|
const prepared = projectCodexCatalogNativeThread(thread, sanitizeTerminalText);
|
|
1356
|
-
return this.projections.run(() => {
|
|
1357
|
-
this.observations.mark(prepared.id);
|
|
1358
|
-
const fields = this.captureFields();
|
|
1359
|
-
return this.observations.observe((isCurrent) => this.projectThread(prepared, isCurrent, fields));
|
|
1360
|
-
}).then(() => void 0).catch((error) => {
|
|
1191
|
+
return this.projections.run(() => this.projectThread(prepared)).catch((error) => {
|
|
1361
1192
|
if (!(error instanceof CodexCatalogProjectionCapacityError)) throw error;
|
|
1362
1193
|
this.report(error);
|
|
1363
1194
|
});
|
|
@@ -1367,40 +1198,34 @@ var CodexCatalogIndex = class {
|
|
|
1367
1198
|
}
|
|
1368
1199
|
refreshThread(id, readThread, sourceOrder) {
|
|
1369
1200
|
this.assertCurrent();
|
|
1370
|
-
this.
|
|
1371
|
-
const fields = this.captureFields();
|
|
1372
|
-
return this.projections.run(() => this.observations.observe((isCurrent) => readThread(id).then((thread) => {
|
|
1201
|
+
return this.projections.run(() => readThread(id).then((thread) => {
|
|
1373
1202
|
const prepared = projectCodexCatalogNativeThread(thread, sanitizeTerminalText);
|
|
1374
1203
|
if (prepared.id !== id) throw new Error("Codex catalog refresh returned a different thread");
|
|
1375
|
-
return this.closed ?
|
|
1376
|
-
}))
|
|
1204
|
+
return this.closed ? void 0 : this.projectThread(prepared, sourceOrder);
|
|
1205
|
+
}));
|
|
1377
1206
|
}
|
|
1378
|
-
async projectThread(thread,
|
|
1207
|
+
async projectThread(thread, sourceOrder) {
|
|
1379
1208
|
const projected = await projectCodexCatalogPage({ data: [thread] }, {
|
|
1380
1209
|
localSessionsRoot: this.options.localSessionsRoot,
|
|
1381
1210
|
sanitize: sanitizeTerminalText
|
|
1382
1211
|
});
|
|
1383
|
-
if (this.closed) return
|
|
1212
|
+
if (this.closed) return;
|
|
1384
1213
|
const row = projected.rows[0];
|
|
1385
|
-
if (row) this.observeFields(row
|
|
1386
|
-
if (!isCurrent(thread.id)) return false;
|
|
1214
|
+
if (row) this.observeFields(row);
|
|
1387
1215
|
if (projected.excludedThreadIds?.includes(thread.id)) this.remove(thread.id);
|
|
1388
1216
|
if (row) {
|
|
1389
1217
|
const previous = this.rows.get(thread.id);
|
|
1390
1218
|
const fingerprint = resolveCodexCatalogRolloutFingerprint(row.rolloutPath, previous);
|
|
1391
|
-
this.observations.mark(thread.id);
|
|
1392
1219
|
this.put({
|
|
1393
1220
|
...row,
|
|
1394
1221
|
...sourceOrder !== void 0 ? { sourceOrder } : {},
|
|
1395
1222
|
...fingerprint ? { fingerprint } : {}
|
|
1396
1223
|
});
|
|
1397
1224
|
}
|
|
1398
|
-
return true;
|
|
1399
1225
|
}
|
|
1400
1226
|
archive(threadId) {
|
|
1401
1227
|
if (this.closed) return;
|
|
1402
1228
|
this.currency.requestNativeRefresh();
|
|
1403
|
-
this.observations.mark(threadId);
|
|
1404
1229
|
this.liveStatus.delete(threadId);
|
|
1405
1230
|
this.liveSettings.delete(threadId);
|
|
1406
1231
|
this.names.delete(threadId);
|
|
@@ -1415,7 +1240,7 @@ var CodexCatalogIndex = class {
|
|
|
1415
1240
|
return this.rows.get(threadId);
|
|
1416
1241
|
}
|
|
1417
1242
|
hasActiveWork() {
|
|
1418
|
-
return Boolean(this.initializing || !this.restored && this.restoring || this.reconciling || this.reconcilingNative || this.
|
|
1243
|
+
return Boolean(this.initializing || !this.restored && this.restoring || this.reconciling || this.reconcilingNative || this.projections.hasActiveWork() || this.currency.hasActiveWork() || this.events.hasActiveWork() || this.persistence.hasActiveWork());
|
|
1419
1244
|
}
|
|
1420
1245
|
async list(params, deadline = performance.now() + (this.options.requestTimeoutMs ?? 6e4)) {
|
|
1421
1246
|
return await withCodexCatalogListRequest(async (request) => {
|