@openclaw/codex 2026.9.6 → 2026.9.8
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 +2 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-G348lY1q.mjs} +5 -5
- package/dist/.setup/{apply-DDOi8uNx.mjs → apply-Cqb-YoCS.mjs} +22 -36
- package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-B-S7ngS_.mjs} +128 -37
- package/dist/.setup/attempt-workspace-context-BJ5Z_olH.mjs +164 -0
- package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
- package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dnps4W4_.mjs} +36 -34
- package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
- package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
- package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
- package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-BNunZPtz.mjs} +15 -18
- package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
- package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-DIQ5O_-S.mjs} +1 -1
- package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
- package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-DRvx_wCC.mjs} +1 -1
- package/dist/.setup/{client-Cs08OXVQ.mjs → client-qyUBJlGZ.mjs} +138 -399
- package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-Btrs1D6f.mjs} +5 -8
- package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
- package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-DvlCHJch.mjs} +222 -343
- package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-skzRq4wD.mjs} +15 -18
- package/dist/.setup/compact-8ttks5U5.mjs +776 -0
- package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
- package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
- package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
- package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
- package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
- package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
- package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
- package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-74LaGGH-.mjs} +67 -90
- package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
- package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-OrN6zuaY.mjs} +8 -8
- package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
- package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-Db2sY5cZ.mjs} +2305 -2606
- package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-Bi6-SQ7i.mjs} +8 -17
- package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-DiCS1ijR.mjs} +3 -3
- package/dist/.setup/event-projector-assistant-message-MV_1dj-3.mjs +69 -0
- package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
- package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
- package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
- package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
- package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
- package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
- package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
- package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-D80IXfQF.mjs} +9 -12
- package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
- package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-DiC0Tkha.mjs} +11 -10
- package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
- package/dist/.setup/{models-KnqBv0hE.mjs → models-DfLmPV0k.mjs} +9 -18
- package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
- package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
- package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-BwkQXf9e.mjs} +4395 -3609
- package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
- package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
- package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
- package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
- package/dist/.setup/{plan-CN3VwfNU.mjs → plan-DPdMk1Oy.mjs} +49 -92
- package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
- package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
- package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
- package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
- package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-BRwtRct9.mjs} +116 -176
- package/dist/.setup/{provider-BOsxQHOM.mjs → provider-D6F_7p1I.mjs} +11 -14
- package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-DG5qbsUZ.mjs} +13 -18
- package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
- package/dist/.setup/{request-D2L0zMrq.mjs → request-BZOfsSXW.mjs} +7 -6
- package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
- package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-dYJhjZrp.mjs} +1035 -1023
- package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
- package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
- package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
- package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
- package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
- package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
- package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
- package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
- package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-BFafIiF6.mjs} +185 -350
- package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
- package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
- package/dist/.setup/session-catalog-events-BMCFMZw-.mjs +139 -0
- package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
- package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-DwJjnF5k.mjs} +126 -122
- package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
- package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
- package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
- package/dist/.setup/session-catalog-native-projection-CuaFZuQE.mjs +178 -0
- package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
- package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
- package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
- package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
- package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-CGfzfP93.mjs} +6 -4
- package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
- package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-DlmBHYIe.mjs} +9 -22
- package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
- package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
- package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
- package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
- package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
- package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
- package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-LlYWBKTJ.mjs} +17 -17
- package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-DW9W3gza.mjs} +14 -10
- package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-CJCTeFpQ.mjs} +783 -412
- package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +153 -0
- package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-BLeGj7TQ.mjs} +79 -143
- package/dist/.setup/{source-CUzJq5WN.mjs → source-CJis_1EF.mjs} +80 -137
- package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-_bAbjedG.mjs} +294 -737
- package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-B6pPt21M.mjs} +45 -10
- package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
- package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-gNPzzpVp.mjs} +46 -7
- package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-OWGOiDaV.mjs} +199 -302
- package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-GOry0AYh.mjs} +6 -6
- package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
- package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
- package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
- package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
- package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
- package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
- package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-gkdRj2yH.mjs} +23 -23
- package/dist/.setup/{usage-BML0r-ua.mjs → usage-CApUvLOV.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-wSMQkbpV.mjs} +4 -19
- package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-UKgeiBUG.mjs} +8 -19
- package/dist/api.js +9 -11
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +50 -8
- package/dist/harness.js +344 -1
- package/dist/index.js +193 -245
- package/dist/media-understanding-provider.js +9 -22
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +3 -3
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +14 -2
- package/package.json +7 -6
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
- package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
- package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
- package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
- package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
- package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
- package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
- package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
- package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
- package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
- package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
- package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
- package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
- package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs}
RENAMED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { T as requireBoundThread, d as boundedCatalogString, o as CatalogParamsError } from "./session-catalog-parsing-CPGaPYr-.mjs";
|
|
2
|
+
import { v as sessionBindingIdentity } from "./session-binding-record-Oe9L-CNY.mjs";
|
|
3
3
|
import { n as codexUpstreamBaseline, t as codexLastTerminalTurnId } from "./session-upstream-marker-D15C9NHp.mjs";
|
|
4
|
-
import { i as reclaimCurrentCodexSessionGeneration } from "./session-binding-
|
|
5
|
-
import { adoptionSessionKeyRest,
|
|
4
|
+
import { i as reclaimCurrentCodexSessionGeneration } from "./session-binding-DGCYAfvD.mjs";
|
|
5
|
+
import { adoptionSessionKeyRest, catalogSessionActions } from "./session-catalog-node-adoption-DgXvSGu0.mjs";
|
|
6
6
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { listSessionCatalogEntries, sessionCatalogAdoptedSessionKey, sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
|
|
8
8
|
//#region extensions/codex/src/session-catalog-adoption.ts
|
|
9
9
|
const CODEX_SUPERVISION_SESSION_KEY_PREFIX = "harness:codex:supervision:";
|
|
10
|
+
const continueOperations = /* @__PURE__ */ new Map();
|
|
10
11
|
const boundCatalogSessionId = (value) => boundedCatalogString(value, 256);
|
|
11
12
|
function requireIdleThread(thread, action) {
|
|
12
13
|
if (thread.status?.type === "idle" || action === "archive" && thread.status?.type === "notLoaded") return;
|
|
@@ -151,7 +152,7 @@ async function createOrReuseAdoptedSession(params) {
|
|
|
151
152
|
sourceThreadId: params.sourceThread.id,
|
|
152
153
|
...params.sourceHomeId ? { sourceHomeId: params.sourceHomeId } : {}
|
|
153
154
|
};
|
|
154
|
-
const { createImportedCodexSession } = await import("./session-history-import-
|
|
155
|
+
const { createImportedCodexSession } = await import("./session-history-import-WhX-X33a.mjs");
|
|
155
156
|
const created = await createImportedCodexSession({
|
|
156
157
|
runtime: params.api.runtime,
|
|
157
158
|
bindingStore: params.bindingStore,
|
|
@@ -271,7 +272,7 @@ async function continueLocalCodexSession(params) {
|
|
|
271
272
|
...params,
|
|
272
273
|
control
|
|
273
274
|
});
|
|
274
|
-
const operation =
|
|
275
|
+
const operation = catalogSessionActions.enqueue(sourceKey, async () => params.control.withPinnedConnection(run));
|
|
275
276
|
continueOperations.set(operationKey, operation);
|
|
276
277
|
try {
|
|
277
278
|
return await operation;
|
package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { v as
|
|
1
|
+
import { o as CatalogParamsError } from "./session-catalog-parsing-CPGaPYr-.mjs";
|
|
2
|
+
import { v as sessionBindingIdentity } from "./session-binding-record-Oe9L-CNY.mjs";
|
|
3
3
|
import { t as assertCodexArchiveDescendantsUnowned } from "./thread-archive-guard-C9frICzX.mjs";
|
|
4
|
-
import "./session-binding-
|
|
5
|
-
import {
|
|
6
|
-
import { isAdoptionSessionKeyForThread, requireIdleThread } from "./session-catalog-adoption-
|
|
4
|
+
import "./session-binding-DGCYAfvD.mjs";
|
|
5
|
+
import { catalogSessionActions } from "./session-catalog-node-adoption-DgXvSGu0.mjs";
|
|
6
|
+
import { isAdoptionSessionKeyForThread, requireIdleThread } from "./session-catalog-adoption-BU_pHWG7.mjs";
|
|
7
7
|
import { listAgentIds } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
8
8
|
import { sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
|
|
9
9
|
//#region extensions/codex/src/session-catalog-archive.ts
|
|
@@ -26,7 +26,7 @@ function assertNoPendingSupervisionBranch(params) {
|
|
|
26
26
|
}
|
|
27
27
|
/** Archives one inactive Gateway-local Codex thread after a fresh status read. */
|
|
28
28
|
async function archiveLocalCodexSession(params) {
|
|
29
|
-
return await
|
|
29
|
+
return await catalogSessionActions.enqueue(sessionCatalogAdoptedSourceKey(params.hostId ?? "gateway:local", params.threadId), async () => {
|
|
30
30
|
return await params.bindingStore.withThreadArchiveFence(async () => {
|
|
31
31
|
const run = async (control) => {
|
|
32
32
|
assertNoPendingSupervisionBranch(params);
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { c as MAX_CWD_LENGTH, d as boundedCatalogString } from "./session-catalog-parsing-CPGaPYr-.mjs";
|
|
2
|
+
import { n as defineCodexBuildState } from "./build-state-DIQ5O_-S.mjs";
|
|
3
|
+
import { r as inferCodexAppServerConnectionClass } from "./config-security-CE-FcGw9.mjs";
|
|
4
|
+
import { n as resolveCodexAppServerLocalHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
5
|
+
import { n as codexCatalogHomeIdFromCanonicalPath } from "./session-catalog-home-id-vlih0B_g.mjs";
|
|
6
|
+
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BL9B5H0L.mjs";
|
|
7
|
+
import { d as observeCodexCatalogEphemeralThreads, r as projectCodexCatalogNativeThread, s as codexCatalogSourceForClient } from "./session-catalog-native-projection-CuaFZuQE.mjs";
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import fs from "node:fs/promises";
|
|
12
|
+
//#region extensions/codex/src/session-catalog-events.ts
|
|
13
|
+
const getCatalogEvents = defineCodexBuildState("openclaw.codexCatalogEvents", () => ({
|
|
14
|
+
listeners: /* @__PURE__ */ new Map(),
|
|
15
|
+
clients: /* @__PURE__ */ new WeakMap()
|
|
16
|
+
}));
|
|
17
|
+
const CATALOG_NOTIFICATION_METHODS = /* @__PURE__ */ new Set([
|
|
18
|
+
"thread/started",
|
|
19
|
+
"turn/started",
|
|
20
|
+
"turn/completed",
|
|
21
|
+
"thread/archived",
|
|
22
|
+
"thread/deleted",
|
|
23
|
+
"thread/unarchived",
|
|
24
|
+
"thread/reverted",
|
|
25
|
+
"thread/name/updated",
|
|
26
|
+
"thread/status/changed",
|
|
27
|
+
"thread/settings/updated"
|
|
28
|
+
]);
|
|
29
|
+
function notifyEphemeralThread(homeKey, rawId) {
|
|
30
|
+
const id = boundedCatalogString(rawId, 256);
|
|
31
|
+
if (!id) return;
|
|
32
|
+
for (const listener of getCatalogEvents().listeners.get(homeKey) ?? []) try {
|
|
33
|
+
listener.onEphemeralThread?.(id);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
embeddedAgentLog.warn("Codex catalog ephemeral observer failed", { error });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Uses prepared local identity or resolves it once during client/index startup. */
|
|
39
|
+
async function codexCatalogResidentHomeKey(params) {
|
|
40
|
+
if (inferCodexAppServerConnectionClass(params.startOptions) === "remote") {
|
|
41
|
+
const fingerprint = buildCodexAppServerConnectionFingerprint({
|
|
42
|
+
start: params.startOptions,
|
|
43
|
+
connectionClass: "remote"
|
|
44
|
+
}, params.agentDir);
|
|
45
|
+
return `remote:${createHash("sha256").update(fingerprint).digest("hex")}`;
|
|
46
|
+
}
|
|
47
|
+
if (params.sourceHomeId) return params.sourceHomeId;
|
|
48
|
+
const home = path.resolve(params.runtimeIdentity?.codexHome ?? resolveCodexAppServerLocalHomeDir(params.startOptions, params.agentDir));
|
|
49
|
+
return codexCatalogHomeIdFromCanonicalPath(await fs.realpath(home).catch(() => home));
|
|
50
|
+
}
|
|
51
|
+
function subscribeCodexCatalogEvents(homeKey, listener, callbacks = {}) {
|
|
52
|
+
const { listeners } = getCatalogEvents();
|
|
53
|
+
let homeListeners = listeners.get(homeKey);
|
|
54
|
+
if (!homeListeners) {
|
|
55
|
+
homeListeners = /* @__PURE__ */ new Set();
|
|
56
|
+
listeners.set(homeKey, homeListeners);
|
|
57
|
+
}
|
|
58
|
+
const subscription = {
|
|
59
|
+
notify: listener,
|
|
60
|
+
...callbacks
|
|
61
|
+
};
|
|
62
|
+
homeListeners.add(subscription);
|
|
63
|
+
return () => {
|
|
64
|
+
homeListeners.delete(subscription);
|
|
65
|
+
if (homeListeners.size === 0 && listeners.get(homeKey) === homeListeners) listeners.delete(homeKey);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/** Observes physical clients without extending their lease or native thread lifetime. */
|
|
69
|
+
function observeCodexCatalogClient(client, params) {
|
|
70
|
+
const state = getCatalogEvents();
|
|
71
|
+
const existing = state.clients.get(client);
|
|
72
|
+
if (existing) return existing.then(() => void 0);
|
|
73
|
+
const observing = (async () => {
|
|
74
|
+
const homeKey = await codexCatalogResidentHomeKey({
|
|
75
|
+
...params,
|
|
76
|
+
runtimeIdentity: client.getRuntimeIdentity()
|
|
77
|
+
});
|
|
78
|
+
if (client.getCloseError()) return;
|
|
79
|
+
const source = codexCatalogSourceForClient(client);
|
|
80
|
+
observeCodexCatalogEphemeralThreads(source, notifyEphemeralThread.bind(void 0, homeKey));
|
|
81
|
+
const notifyLifecycle = (callback) => {
|
|
82
|
+
for (const listener of state.listeners.get(homeKey) ?? []) try {
|
|
83
|
+
listener[callback]?.(source);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
embeddedAgentLog.warn("Codex catalog lifecycle observer failed", {
|
|
86
|
+
callback,
|
|
87
|
+
error
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const readThread = async (threadId) => (await client.request("thread/read", {
|
|
92
|
+
threadId,
|
|
93
|
+
includeTurns: false
|
|
94
|
+
}, {
|
|
95
|
+
timeoutMs: 6e4,
|
|
96
|
+
catalogPreview: true
|
|
97
|
+
})).thread;
|
|
98
|
+
const stopNotifications = client.addNotificationHandler((event) => {
|
|
99
|
+
if (!CATALOG_NOTIFICATION_METHODS.has(event.method)) return;
|
|
100
|
+
for (const listener of state.listeners.get(homeKey) ?? []) listener.notify(event, readThread, source);
|
|
101
|
+
});
|
|
102
|
+
const stopClose = client.addCloseHandler(() => {
|
|
103
|
+
stopNotifications();
|
|
104
|
+
stopClose();
|
|
105
|
+
notifyLifecycle("onClose");
|
|
106
|
+
});
|
|
107
|
+
if (inferCodexAppServerConnectionClass(params.startOptions) === "remote") notifyLifecycle("onRemoteReady");
|
|
108
|
+
return {
|
|
109
|
+
homeKey,
|
|
110
|
+
source
|
|
111
|
+
};
|
|
112
|
+
})();
|
|
113
|
+
state.clients.set(client, observing);
|
|
114
|
+
return observing.then(() => void 0);
|
|
115
|
+
}
|
|
116
|
+
/** Acknowledged resume settings may differ from the response thread's persisted metadata. */
|
|
117
|
+
async function publishCodexCatalogResume(client, response, sanitize) {
|
|
118
|
+
try {
|
|
119
|
+
const prepared = {
|
|
120
|
+
thread: projectCodexCatalogNativeThread(response.thread, sanitize),
|
|
121
|
+
cwd: boundedCatalogString(response.cwd, MAX_CWD_LENGTH),
|
|
122
|
+
modelProvider: boundedCatalogString(response.modelProvider, 500, "truncate")
|
|
123
|
+
};
|
|
124
|
+
const state = getCatalogEvents();
|
|
125
|
+
const binding = await state.clients.get(client);
|
|
126
|
+
if (!binding || binding.source.closed) return;
|
|
127
|
+
await Promise.all(Array.from(state.listeners.get(binding.homeKey) ?? [], async (listener) => {
|
|
128
|
+
try {
|
|
129
|
+
await listener.onResume?.(prepared, binding.source);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
embeddedAgentLog.warn("Codex catalog resume observer failed", { error });
|
|
132
|
+
}
|
|
133
|
+
}));
|
|
134
|
+
} catch (error) {
|
|
135
|
+
embeddedAgentLog.warn("Codex catalog resume publication failed", { error });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
export { subscribeCodexCatalogEvents as i, observeCodexCatalogClient as n, publishCodexCatalogResume as r, codexCatalogResidentHomeKey as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
//#region extensions/codex/src/session-catalog-home-id.ts
|
|
5
|
+
function canonicalCodexCatalogHome(value) {
|
|
6
|
+
const resolved = path.resolve(value);
|
|
7
|
+
try {
|
|
8
|
+
return fs.realpathSync.native(resolved);
|
|
9
|
+
} catch {
|
|
10
|
+
return resolved;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** One canonical identity for catalog discovery and durable ownership rows. */
|
|
14
|
+
function codexCatalogHomeId(codexHome) {
|
|
15
|
+
return codexCatalogHomeIdFromCanonicalPath(canonicalCodexCatalogHome(codexHome));
|
|
16
|
+
}
|
|
17
|
+
/** Hashes lifecycle-prepared paths without repeating filesystem discovery. */
|
|
18
|
+
function codexCatalogHomeIdFromCanonicalPath(codexHome) {
|
|
19
|
+
return createHash("sha256").update("openclaw:codex-session-catalog-home:v1\0").update(codexHome).digest("hex");
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { codexCatalogHomeIdFromCanonicalPath as n, codexCatalogHomeId as t };
|
package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-DwJjnF5k.mjs}
RENAMED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { i as retainCodexCatalogRow, n as codexCatalogRowRecency, r as compareCodexCatalogRows, t as CodexCatalogOrdering } from "./session-catalog-index-order-
|
|
4
|
-
import { n as CodexCatalogPersistence, r as codexCatalogMetadataPage } from "./session-catalog-index-state-
|
|
5
|
-
import {
|
|
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-CPGaPYr-.mjs";
|
|
2
|
+
import { t as CODEX_CATALOG_MAX_ROWS } from "./session-catalog-limits-DDxOsQeC.mjs";
|
|
3
|
+
import { i as retainCodexCatalogRow, n as codexCatalogRowRecency, r as compareCodexCatalogRows, t as CodexCatalogOrdering } from "./session-catalog-index-order-BcQpHks3.mjs";
|
|
4
|
+
import { n as CodexCatalogPersistence, r as codexCatalogMetadataPage } from "./session-catalog-index-state-TeO7EyO-.mjs";
|
|
5
|
+
import { i as CodexCatalogAvailability, r as withCodexCatalogListRequest } from "./session-catalog-list-request-CvtxrYSe.mjs";
|
|
6
|
+
import { l as getCodexCatalogSource, p as setCodexCatalogSource, r as projectCodexCatalogNativeThread, u as hasLiveCodexCatalogSource } from "./session-catalog-native-projection-CuaFZuQE.mjs";
|
|
7
|
+
import { i as subscribeCodexCatalogEvents } from "./session-catalog-events-BMCFMZw-.mjs";
|
|
6
8
|
import { a as reportCodexCatalogSpawnFailure, n as findCodexAppServerSpawnError } from "./spawn-error-CL3n6MAa.mjs";
|
|
7
|
-
import { CodexCatalogProjectionCapacityError, CodexCatalogProjections, a as resolveCodexCatalogRolloutFingerprint, i as readCodexCatalogRollout, mergeCodexCatalogRolloutRow, n as indexCodexCatalogRowsByRollout, o as scanCodexCatalogRollouts, projectCodexCatalogThread, r as isCodexCatalogRolloutPathCovered, t as codexCatalogRolloutLogicalPath } from "./session-catalog-projection-
|
|
9
|
+
import { CodexCatalogProjectionCapacityError, CodexCatalogProjections, a as resolveCodexCatalogRolloutFingerprint, i as readCodexCatalogRollout, mergeCodexCatalogRolloutRow, n as indexCodexCatalogRowsByRollout, o as scanCodexCatalogRollouts, projectCodexCatalogThread, r as isCodexCatalogRolloutPathCovered, t as codexCatalogRolloutLogicalPath } from "./session-catalog-projection-CGfzfP93.mjs";
|
|
8
10
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
11
|
import { createHash } from "node:crypto";
|
|
10
12
|
import { isDeepStrictEqual } from "node:util";
|
|
11
13
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
12
|
-
import { setImmediate as setImmediate$1 } from "node:timers/promises";
|
|
13
14
|
import { coerceErrorMessage, toErrorObject } from "openclaw/plugin-sdk/error-runtime";
|
|
15
|
+
import { setImmediate as setImmediate$1 } from "node:timers/promises";
|
|
14
16
|
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
15
17
|
//#region extensions/codex/src/session-catalog-currency.ts
|
|
16
18
|
const SAFETY_INTERVAL_MS = 9e5;
|
|
@@ -24,7 +26,7 @@ var CodexCatalogCurrency = class {
|
|
|
24
26
|
this.nextFilesAt = 0;
|
|
25
27
|
}
|
|
26
28
|
hasActiveWork() {
|
|
27
|
-
return this.hydration !== void 0 || this.initial !== void 0 || this.running !== void 0;
|
|
29
|
+
return this.hydration !== void 0 || this.initial !== void 0 || this.running !== void 0 || this.safetyRefresh !== void 0;
|
|
28
30
|
}
|
|
29
31
|
assertRunnable() {
|
|
30
32
|
if (this.terminalFailure) throw this.terminalFailure;
|
|
@@ -54,6 +56,24 @@ var CodexCatalogCurrency = class {
|
|
|
54
56
|
requestNativeRefresh() {
|
|
55
57
|
this.nativeDirty = true;
|
|
56
58
|
}
|
|
59
|
+
/** Full safety walks serve catalog demand; an idle resident index does not start one. */
|
|
60
|
+
refreshNativeIfDue() {
|
|
61
|
+
if (this.closed || !this.timer || Date.now() < this.nextNativeAt) return Promise.resolve();
|
|
62
|
+
if (this.safetyRefresh) return this.safetyRefresh;
|
|
63
|
+
const refresh = async () => {
|
|
64
|
+
if (this.running) await this.running;
|
|
65
|
+
if (this.closed || Date.now() < this.nextNativeAt) return;
|
|
66
|
+
const run = () => this.options.reconcileNative(true);
|
|
67
|
+
await Promise.resolve().then(() => this.options.runBackground ? this.options.runBackground(run) : run()).catch((error) => {
|
|
68
|
+
this.options.report(new Error(`Codex catalog reconciliation failed; waiting for the next safety interval and catalog demand: ${coerceErrorMessage(error)}`, { cause: error }));
|
|
69
|
+
});
|
|
70
|
+
this.nextNativeAt = Date.now() + SAFETY_INTERVAL_MS;
|
|
71
|
+
};
|
|
72
|
+
this.safetyRefresh = refresh().finally(() => {
|
|
73
|
+
this.safetyRefresh = void 0;
|
|
74
|
+
});
|
|
75
|
+
return this.safetyRefresh;
|
|
76
|
+
}
|
|
57
77
|
start() {
|
|
58
78
|
if (this.closed || this.timer) return;
|
|
59
79
|
this.nextNativeAt = Date.now() + SAFETY_INTERVAL_MS;
|
|
@@ -61,19 +81,17 @@ var CodexCatalogCurrency = class {
|
|
|
61
81
|
this.timer = setInterval(() => {
|
|
62
82
|
if (this.running) return;
|
|
63
83
|
const startedAt = Date.now();
|
|
64
|
-
const full = startedAt >= this.nextNativeAt;
|
|
65
84
|
const filesDue = this.options.local && startedAt >= this.nextFilesAt;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.nativeDirty = false;
|
|
69
|
-
if (full) this.nextNativeAt = startedAt + SAFETY_INTERVAL_MS;
|
|
85
|
+
const nativeDue = this.nativeDirty && !this.safetyRefresh;
|
|
86
|
+
if (!filesDue && !nativeDue) return;
|
|
87
|
+
if (nativeDue) this.nativeDirty = false;
|
|
70
88
|
if (filesDue) this.nextFilesAt = startedAt + SAFETY_INTERVAL_MS;
|
|
71
89
|
const run = async () => {
|
|
72
90
|
if (filesDue) await this.options.reconcileFiles();
|
|
73
|
-
if (nativeDue) await this.options.reconcileNative(
|
|
91
|
+
if (nativeDue) await this.options.reconcileNative(false);
|
|
74
92
|
};
|
|
75
93
|
this.running = (this.options.runBackground ? this.options.runBackground(run) : run()).catch((error) => {
|
|
76
|
-
this.options.report(new Error(`Codex catalog reconciliation failed; waiting for new activity or the next safety cycle: ${coerceErrorMessage(error)}`, { cause: error }));
|
|
94
|
+
this.options.report(new Error(`Codex catalog reconciliation failed; waiting for new activity or the next file safety cycle: ${coerceErrorMessage(error)}`, { cause: error }));
|
|
77
95
|
}).finally(() => {
|
|
78
96
|
this.running = void 0;
|
|
79
97
|
});
|
|
@@ -94,7 +112,8 @@ var CodexCatalogCurrency = class {
|
|
|
94
112
|
this.timer = void 0;
|
|
95
113
|
clearTimeout(this.initial);
|
|
96
114
|
this.initial = void 0;
|
|
97
|
-
return this.running;
|
|
115
|
+
if (this.running && this.safetyRefresh) return Promise.allSettled([this.running, this.safetyRefresh]).then(() => {});
|
|
116
|
+
return this.running ?? this.safetyRefresh;
|
|
98
117
|
}
|
|
99
118
|
};
|
|
100
119
|
//#endregion
|
|
@@ -258,7 +277,7 @@ var CodexCatalogIndexEvents = class {
|
|
|
258
277
|
} catch (error) {
|
|
259
278
|
if (observedSource.closed) {
|
|
260
279
|
if (pending.source === observedSource) pending.dirty = false;
|
|
261
|
-
this.owner.report(new Error("Codex catalog observation interrupted by client closure; metadata refresh deferred to the current catalog owner", { cause: error }));
|
|
280
|
+
this.owner.report(new Error("Codex catalog observation interrupted by client closure; metadata refresh deferred to the current catalog owner", { cause: error }), "deferred");
|
|
262
281
|
} else this.owner.report(error);
|
|
263
282
|
}
|
|
264
283
|
}
|
|
@@ -386,6 +405,83 @@ var CodexCatalogObservations = class {
|
|
|
386
405
|
}
|
|
387
406
|
};
|
|
388
407
|
//#endregion
|
|
408
|
+
//#region extensions/codex/src/session-catalog-status.ts
|
|
409
|
+
function applyCodexCatalogLiveFields({ status: _storedStatus, activeFlags: _storedFlags, ...session }, live, settings) {
|
|
410
|
+
return {
|
|
411
|
+
...session,
|
|
412
|
+
...settings,
|
|
413
|
+
status: live?.status ?? "notLoaded",
|
|
414
|
+
...live?.activeFlags ? { activeFlags: [...live.activeFlags] } : {}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
const MAX_STATUS_SOURCE_WITNESSES = 64;
|
|
418
|
+
/** Equivalent broadcasts retain at most 64 source witnesses for each bounded resident row. */
|
|
419
|
+
var CodexCatalogStatusIndex = class {
|
|
420
|
+
constructor() {
|
|
421
|
+
this.values = new CodexCatalogField();
|
|
422
|
+
}
|
|
423
|
+
capture() {
|
|
424
|
+
return this.values.capture();
|
|
425
|
+
}
|
|
426
|
+
update(threadId, status, source) {
|
|
427
|
+
const next = this.next(threadId, status, source);
|
|
428
|
+
if (next) this.values.update(threadId, next);
|
|
429
|
+
}
|
|
430
|
+
observe(row, revision) {
|
|
431
|
+
const session = row.page.sessions[0];
|
|
432
|
+
const source = getCodexCatalogSource(row);
|
|
433
|
+
if (session && source) {
|
|
434
|
+
const next = this.next(row.threadId, {
|
|
435
|
+
status: session.status,
|
|
436
|
+
...session.activeFlags ? { activeFlags: session.activeFlags } : {}
|
|
437
|
+
}, source);
|
|
438
|
+
if (next) this.values.observe(row.threadId, next, revision);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
get(threadId) {
|
|
442
|
+
const current = this.values.get(threadId);
|
|
443
|
+
return current && hasLiveCodexCatalogSource(current.sources) ? current.status : void 0;
|
|
444
|
+
}
|
|
445
|
+
delete(threadId) {
|
|
446
|
+
this.values.delete(threadId);
|
|
447
|
+
}
|
|
448
|
+
invalidate(source) {
|
|
449
|
+
if (!source) {
|
|
450
|
+
this.values.invalidate();
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
this.values.deleteWhere((entry) => {
|
|
454
|
+
entry.sources.delete(source);
|
|
455
|
+
return !hasLiveCodexCatalogSource(entry.sources);
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
next(threadId, status, source) {
|
|
459
|
+
if (source.closed) return;
|
|
460
|
+
const current = this.values.get(threadId);
|
|
461
|
+
const sources = new Set([...current?.sources ?? []].filter((witness) => !witness.closed));
|
|
462
|
+
if (status.status === "notLoaded" && current && current.status.status !== "notLoaded" && sources.size) {
|
|
463
|
+
sources.delete(source);
|
|
464
|
+
if (sources.size) return {
|
|
465
|
+
status: current.status,
|
|
466
|
+
sources
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
const flags = status.activeFlags ?? [];
|
|
470
|
+
const previousFlags = current?.status.activeFlags ?? [];
|
|
471
|
+
if (current?.status.status === status.status && flags.length === previousFlags.length && flags.every((flag, index) => flag === previousFlags[index])) {
|
|
472
|
+
if (sources.size < MAX_STATUS_SOURCE_WITNESSES) sources.add(source);
|
|
473
|
+
return {
|
|
474
|
+
status,
|
|
475
|
+
sources
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
return {
|
|
479
|
+
status,
|
|
480
|
+
sources: /* @__PURE__ */ new Set([source])
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
//#endregion
|
|
389
485
|
//#region extensions/codex/src/session-catalog-index-query.ts
|
|
390
486
|
/** Keyset pagination remains valid when the anchor row is archived or deleted. */
|
|
391
487
|
function prepareCodexCatalogQuery(params, prepared) {
|
|
@@ -427,15 +523,7 @@ function prepareCodexCatalogQuery(params, prepared) {
|
|
|
427
523
|
continuation = frontier && (!last || compareCodexCatalogRows(frontier, last) > 0) ? frontier : last;
|
|
428
524
|
}
|
|
429
525
|
return {
|
|
430
|
-
sessions: page.flatMap((row) => row.page.sessions.map((
|
|
431
|
-
const live = liveStatus.get(row.threadId);
|
|
432
|
-
return {
|
|
433
|
-
...session,
|
|
434
|
-
...liveSettings.get(row.threadId),
|
|
435
|
-
status: live?.status ?? "notLoaded",
|
|
436
|
-
...live?.activeFlags ? { activeFlags: [...live.activeFlags] } : {}
|
|
437
|
-
};
|
|
438
|
-
})),
|
|
526
|
+
sessions: page.flatMap((row) => row.page.sessions.map((session) => applyCodexCatalogLiveFields(session, liveStatus.get(row.threadId), liveSettings.get(row.threadId)))),
|
|
439
527
|
...continuation ? { nextCursor: cursor(continuation, false) } : {},
|
|
440
528
|
...first && start > 0 ? { backwardsCursor: cursor(first, true) } : {}
|
|
441
529
|
};
|
|
@@ -542,13 +630,7 @@ var CodexCatalogNativePages = class {
|
|
|
542
630
|
}
|
|
543
631
|
rows = selected;
|
|
544
632
|
} else if (!position.cursor && !position.backwards) previous = void 0;
|
|
545
|
-
const projected = filterCatalogPageByTitle({ sessions: rows.flatMap((row) => row.page.sessions).map((
|
|
546
|
-
const live = this.status.get(session.threadId);
|
|
547
|
-
return Object.assign(session, this.settings.get(session.threadId), {
|
|
548
|
-
status: live?.status ?? "notLoaded",
|
|
549
|
-
...live?.activeFlags ? { activeFlags: [...live.activeFlags] } : {}
|
|
550
|
-
});
|
|
551
|
-
}).filter((session) => !cwd || session.cwd === cwd) }, params.searchTerm);
|
|
633
|
+
const projected = filterCatalogPageByTitle({ sessions: rows.flatMap((row) => row.page.sessions).map((session) => applyCodexCatalogLiveFields(session, this.status.get(session.threadId), this.settings.get(session.threadId))).filter((session) => !cwd || session.cwd === cwd) }, params.searchTerm);
|
|
552
634
|
const continuation = position.backwards ? previous : next;
|
|
553
635
|
if ((params.searchTerm || filterCwdLocally) && !projected.sessions.length && continuation) {
|
|
554
636
|
if (encodeCodexNativeCursor(continuation) === encodeCodexNativeCursor(position)) throw new CatalogParamsError("Codex catalog repeated a native continuation");
|
|
@@ -600,17 +682,10 @@ var CodexCatalogSettingsIndex = class {
|
|
|
600
682
|
}
|
|
601
683
|
get(threadId) {
|
|
602
684
|
const current = this.values.get(threadId);
|
|
603
|
-
|
|
604
|
-
for (const source of current.sources) if (!source.closed) return current.settings;
|
|
605
|
-
}
|
|
685
|
+
return current && hasLiveCodexCatalogSource(current.sources) ? current.settings : void 0;
|
|
606
686
|
}
|
|
607
687
|
hasLiveCwd() {
|
|
608
|
-
return this.values.some(({ settings, sources }) =>
|
|
609
|
-
if (settings.cwd) {
|
|
610
|
-
for (const source of sources) if (!source.closed) return true;
|
|
611
|
-
}
|
|
612
|
-
return false;
|
|
613
|
-
});
|
|
688
|
+
return this.values.some(({ settings, sources }) => Boolean(settings.cwd) && hasLiveCodexCatalogSource(sources));
|
|
614
689
|
}
|
|
615
690
|
delete(threadId) {
|
|
616
691
|
this.values.delete(threadId);
|
|
@@ -618,8 +693,7 @@ var CodexCatalogSettingsIndex = class {
|
|
|
618
693
|
withdraw(threadId, source) {
|
|
619
694
|
const current = this.values.get(threadId);
|
|
620
695
|
if (!current?.sources.delete(source)) return;
|
|
621
|
-
|
|
622
|
-
this.values.delete(threadId);
|
|
696
|
+
if (!hasLiveCodexCatalogSource(current.sources)) this.values.delete(threadId);
|
|
623
697
|
}
|
|
624
698
|
invalidate(source) {
|
|
625
699
|
if (!source) {
|
|
@@ -628,84 +702,11 @@ var CodexCatalogSettingsIndex = class {
|
|
|
628
702
|
}
|
|
629
703
|
this.values.deleteWhere((entry) => {
|
|
630
704
|
entry.sources.delete(source);
|
|
631
|
-
|
|
632
|
-
return true;
|
|
705
|
+
return !hasLiveCodexCatalogSource(entry.sources);
|
|
633
706
|
});
|
|
634
707
|
}
|
|
635
708
|
};
|
|
636
709
|
//#endregion
|
|
637
|
-
//#region extensions/codex/src/session-catalog-status.ts
|
|
638
|
-
const MAX_STATUS_SOURCE_WITNESSES = 64;
|
|
639
|
-
/** Equivalent broadcasts retain at most 64 source witnesses for each bounded resident row. */
|
|
640
|
-
var CodexCatalogStatusIndex = class {
|
|
641
|
-
constructor() {
|
|
642
|
-
this.values = new CodexCatalogField();
|
|
643
|
-
}
|
|
644
|
-
capture() {
|
|
645
|
-
return this.values.capture();
|
|
646
|
-
}
|
|
647
|
-
update(threadId, status, source) {
|
|
648
|
-
const next = this.next(threadId, status, source);
|
|
649
|
-
if (next) this.values.update(threadId, next);
|
|
650
|
-
}
|
|
651
|
-
observe(row, revision) {
|
|
652
|
-
const session = row.page.sessions[0];
|
|
653
|
-
const source = getCodexCatalogSource(row);
|
|
654
|
-
if (session && source) {
|
|
655
|
-
const next = this.next(row.threadId, {
|
|
656
|
-
status: session.status,
|
|
657
|
-
...session.activeFlags ? { activeFlags: session.activeFlags } : {}
|
|
658
|
-
}, source);
|
|
659
|
-
if (next) this.values.observe(row.threadId, next, revision);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
get(threadId) {
|
|
663
|
-
const current = this.values.get(threadId);
|
|
664
|
-
if (current) {
|
|
665
|
-
for (const source of current.sources) if (!source.closed) return current.status;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
delete(threadId) {
|
|
669
|
-
this.values.delete(threadId);
|
|
670
|
-
}
|
|
671
|
-
invalidate(source) {
|
|
672
|
-
if (!source) {
|
|
673
|
-
this.values.invalidate();
|
|
674
|
-
return;
|
|
675
|
-
}
|
|
676
|
-
this.values.deleteWhere((entry) => {
|
|
677
|
-
entry.sources.delete(source);
|
|
678
|
-
for (const witness of entry.sources) if (!witness.closed) return false;
|
|
679
|
-
return true;
|
|
680
|
-
});
|
|
681
|
-
}
|
|
682
|
-
next(threadId, status, source) {
|
|
683
|
-
if (source.closed) return;
|
|
684
|
-
const current = this.values.get(threadId);
|
|
685
|
-
const sources = new Set([...current?.sources ?? []].filter((witness) => !witness.closed));
|
|
686
|
-
if (status.status === "notLoaded" && current && current.status.status !== "notLoaded" && sources.size) {
|
|
687
|
-
sources.delete(source);
|
|
688
|
-
if (sources.size) return {
|
|
689
|
-
status: current.status,
|
|
690
|
-
sources
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
|
-
const flags = status.activeFlags ?? [];
|
|
694
|
-
const previousFlags = current?.status.activeFlags ?? [];
|
|
695
|
-
if (current?.status.status === status.status && flags.length === previousFlags.length && flags.every((flag, index) => flag === previousFlags[index])) {
|
|
696
|
-
if (sources.size < MAX_STATUS_SOURCE_WITNESSES) sources.add(source);
|
|
697
|
-
return {
|
|
698
|
-
status,
|
|
699
|
-
sources
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
return {
|
|
703
|
-
status,
|
|
704
|
-
sources: /* @__PURE__ */ new Set([source])
|
|
705
|
-
};
|
|
706
|
-
}
|
|
707
|
-
};
|
|
708
|
-
//#endregion
|
|
709
710
|
//#region extensions/codex/src/session-catalog-index.ts
|
|
710
711
|
/** One home owns resident queries and authoritative overflow discovery. */
|
|
711
712
|
var CodexCatalogIndex = class {
|
|
@@ -758,7 +759,7 @@ var CodexCatalogIndex = class {
|
|
|
758
759
|
this.currency.requestNativeRefresh();
|
|
759
760
|
this.remove(id);
|
|
760
761
|
},
|
|
761
|
-
report: (error) => this.report(error)
|
|
762
|
+
report: (error, disposition) => this.report(error, disposition)
|
|
762
763
|
});
|
|
763
764
|
this.unsubscribe = subscribeCodexCatalogEvents(options.homeId, (event, readThread, source) => this.events.handle(event, readThread, source), {
|
|
764
765
|
onEphemeralThread: (id) => this.remove(id),
|
|
@@ -789,8 +790,8 @@ var CodexCatalogIndex = class {
|
|
|
789
790
|
throw error;
|
|
790
791
|
}
|
|
791
792
|
}
|
|
792
|
-
report(error) {
|
|
793
|
-
if (!this.closed && !this.currency.stopForTerminalFailure(error)) embeddedAgentLog.warn("Codex resident catalog background update failed", { error });
|
|
793
|
+
report(error, disposition) {
|
|
794
|
+
if (!this.closed && !this.currency.stopForTerminalFailure(error)) embeddedAgentLog.warn(disposition === "deferred" ? "Codex resident catalog metadata refresh interrupted; deferred for automatic recovery" : "Codex resident catalog background update failed", { error });
|
|
794
795
|
}
|
|
795
796
|
withName(row) {
|
|
796
797
|
const known = this.names.get(row.threadId);
|
|
@@ -1135,7 +1136,10 @@ var CodexCatalogIndex = class {
|
|
|
1135
1136
|
const ordered = this.ordering.read(this.rows);
|
|
1136
1137
|
const page = query?.(ordered, this.liveStatus, this.liveSettings, this.availability);
|
|
1137
1138
|
if (cursor.kind === "native" || this.overflow && (params.cwd || params.searchTerm || page && !page.nextCursor)) return await this.nativePages.list(params, cursor, this.options, request);
|
|
1138
|
-
if (page)
|
|
1139
|
+
if (page) {
|
|
1140
|
+
this.currency.refreshNativeIfDue();
|
|
1141
|
+
return page;
|
|
1142
|
+
}
|
|
1139
1143
|
await this.availability.next(expiresAt);
|
|
1140
1144
|
}
|
|
1141
1145
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as CODEX_CATALOG_MAX_ROWS } from "./session-catalog-limits-DDxOsQeC.mjs";
|
|
2
2
|
//#region extensions/codex/src/session-catalog-index-order.ts
|
|
3
3
|
function codexCatalogRowRecency(row) {
|
|
4
4
|
return row.recencyAt ?? row.updatedAt ?? 0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { v as parseCatalogPage } from "./session-catalog-parsing-CPGaPYr-.mjs";
|
|
2
|
+
import { n as detachCodexCatalogString } from "./session-catalog-limits-DDxOsQeC.mjs";
|
|
3
|
+
import { i as retainCodexCatalogRow } from "./session-catalog-index-order-BcQpHks3.mjs";
|
|
3
4
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
5
6
|
import { setImmediate } from "node:timers/promises";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
|
|
2
|
+
//#region extensions/codex/src/session-catalog-limits.ts
|
|
3
|
+
var session_catalog_limits_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
CODEX_CATALOG_MAX_ROWS: () => CODEX_CATALOG_MAX_ROWS,
|
|
5
|
+
CODEX_CATALOG_MAX_STATE_KEY_BYTES: () => 512,
|
|
6
|
+
detachCodexCatalogString: () => detachCodexCatalogString
|
|
7
|
+
});
|
|
8
|
+
const CODEX_CATALOG_MAX_ROWS = 2e4;
|
|
9
|
+
/** Preserve UTF-16 code units without retaining an oversized source string. */
|
|
10
|
+
function detachCodexCatalogString(value) {
|
|
11
|
+
return Buffer.from(value, "utf16le").toString("utf16le");
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { detachCodexCatalogString as n, session_catalog_limits_exports as r, CODEX_CATALOG_MAX_ROWS as t };
|