@openclaw/codex 2026.9.6 → 2026.9.7
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-DFhbh1zz.mjs} +5 -5
- package/dist/.setup/{apply-DDOi8uNx.mjs → apply-D3GcSoSa.mjs} +22 -36
- package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +128 -37
- package/dist/.setup/attempt-workspace-context-C5HigshI.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-Dbvq-QgB.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-CbjoN2OW.mjs} +15 -18
- package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
- package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-Da1_z0kd.mjs} +1 -1
- package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
- package/dist/.setup/{client-Cs08OXVQ.mjs → client-N0JpgSzF.mjs} +138 -399
- package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-5HHLdcde.mjs} +1 -1
- package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-BeAoaovI.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-ylTMS00z.mjs} +222 -343
- package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-CGJGUQ6Y.mjs} +15 -18
- package/dist/.setup/compact-C2WamavS.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-3Min8qvP.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-CEP8X5JC.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-DzlsLUuS.mjs} +2305 -2606
- package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
- package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-CDsPJOa2.mjs} +3 -3
- package/dist/.setup/event-projector-assistant-message-CigreO4K.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-Dm3PzxJk.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-PAuZgJC6.mjs} +11 -10
- package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
- package/dist/.setup/{models-KnqBv0hE.mjs → models-DHXZtVVk.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-Dpsmf2wz.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-Y-QIvrKB.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-DsjsL1dr.mjs} +115 -175
- package/dist/.setup/{provider-BOsxQHOM.mjs → provider-DH8NSzGt.mjs} +11 -14
- package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-CAxoF-X1.mjs} +13 -18
- package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
- package/dist/.setup/{request-D2L0zMrq.mjs → request-BHZ1nz8d.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-D8RZUOzY.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-4sCdv5qx.mjs} +170 -324
- 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-DePDzzjc.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-CZvDzC6z.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-DjhwGL6x.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-Cr5qP5Dj.mjs} +6 -4
- package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
- package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-Cn_nCqfq.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-qMTxkNx2.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-BsvEabkw.mjs} +14 -10
- package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-DqyTMYug.mjs} +783 -412
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
- package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-C4kCmQy1.mjs} +79 -143
- package/dist/.setup/{source-CUzJq5WN.mjs → source-CS_7GFJZ.mjs} +80 -137
- package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-DPflntEJ.mjs} +294 -737
- package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
- package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-roNP0l1c.mjs} +45 -10
- package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-DTd-DtkX.mjs} +46 -7
- package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-B_bRnMGN.mjs} +199 -302
- package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-CdDaoc7T.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-CBeVjBpT.mjs} +23 -23
- package/dist/.setup/{usage-BML0r-ua.mjs → usage-BMzNxeR_.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-QXerDo3i.mjs} +4 -19
- package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-P77OUeoo.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
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as resolveCodexAppServerHomeDir, f as resolveCodexAppServerLocalHomeDir, p as resolveCodexAppServerUserHomeDir } from "./config-security-BEReZ6go.mjs";
|
|
3
|
-
import { d as readCodexPluginConfig } from "./config-parsing-CcB9iPoq.mjs";
|
|
4
|
-
import { A as parseCatalogPage, D as filterCatalogPageByTitle, F as readGatewayParams, H as unwrapNodeInvokePayload, I as readPageParams, M as parseTranscriptPage, N as readBoundedOptionalString, O as isInteractiveThreadSource, P as readControlCursor, R as requireOnlyKeys, S as NODE_INVOKE_TIMEOUT_MS, _ as CODEX_LOCAL_SESSION_HOST_ID, g as CODEX_CATALOG_TRANSCRIPT_READ_COMMAND, h as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, j as parseJsonParams, m as CODEX_APP_SERVER_THREADS_LIST_COMMAND, p as CODEX_APP_SERVER_THREADS_CAPABILITY, v as CatalogParamsError, w as catalogError, x as MAX_TRANSCRIPT_PAGE_BYTES, y as MAX_CURSOR_LENGTH } from "./session-catalog-native-projection-DowriLid.mjs";
|
|
1
|
+
import { A as unwrapNodeInvokePayload, C as readGatewayParams, E as requireOnlyKeys, S as readControlCursor, _ as normalizeLimit, a as CODEX_LOCAL_SESSION_HOST_ID, b as parseTranscriptPage, f as catalogError, g as isInteractiveThreadSource, h as filterCatalogPageByTitle, i as CODEX_CATALOG_TRANSCRIPT_READ_COMMAND, l as MAX_TRANSCRIPT_PAGE_BYTES, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, r as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, s as MAX_CURSOR_LENGTH, t as CODEX_APP_SERVER_THREADS_CAPABILITY, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage, w as readPageParams, x as readBoundedOptionalString, y as parseJsonParams } from "./session-catalog-parsing-CPGaPYr-.mjs";
|
|
5
2
|
import { n as assertCodexThreadForkParams } from "./protocol-CANUwXJ3.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { r as
|
|
10
|
-
import { n as
|
|
11
|
-
import {
|
|
3
|
+
import { v as sessionBindingIdentity } from "./session-binding-record-Oe9L-CNY.mjs";
|
|
4
|
+
import { d as readCodexPluginConfig } from "./config-parsing-b088LyhT.mjs";
|
|
5
|
+
import { n as resolveCodexAppServerLocalHomeDir, r as resolveCodexAppServerUserHomeDir, t as resolveCodexAppServerHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
|
|
6
|
+
import { i as hasActiveSharedCodexAppServerWork, r as getSharedCodexAppServerClientState } from "./shared-client-lifecycle-DJIgqgMw.mjs";
|
|
7
|
+
import { n as CodexAppServerRpcError, r as isCodexThreadReadMissingError } from "./rpc-error-BlD2vuzn.mjs";
|
|
8
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-B3WEZl4e.mjs";
|
|
9
|
+
import { n as codexCatalogHomeIdFromCanonicalPath } from "./session-catalog-home-id-vlih0B_g.mjs";
|
|
10
|
+
import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
|
|
11
|
+
import { a as CodexCatalogLoadingError, n as currentCodexCatalogListRequest, r as withCodexCatalogListRequest, t as CodexCatalogListRequest } from "./session-catalog-list-request-CvtxrYSe.mjs";
|
|
12
|
+
import { t as lookupNodeCodexCatalogRecord } from "./session-catalog-node-lookup-CtAXI5W5.mjs";
|
|
13
|
+
import { r as projectCodexUserItemText } from "./transcript-history-projection-DRSifI-1.mjs";
|
|
12
14
|
import { r as codexUpstreamContinueResult } from "./session-upstream-marker-D15C9NHp.mjs";
|
|
13
|
-
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-
|
|
15
|
+
import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BL9B5H0L.mjs";
|
|
14
16
|
import { n as findCodexAppServerSpawnError } from "./spawn-error-CL3n6MAa.mjs";
|
|
15
|
-
import {
|
|
17
|
+
import { n as readCodexSessionMeta } from "./session-catalog-provenance-DoAvktcj.mjs";
|
|
18
|
+
import { t as codexCatalogResidentHomeKey } from "./session-catalog-events-DePDzzjc.mjs";
|
|
19
|
+
import { a as setCodexCatalogConnectionHomeResolver } from "./binding-connection-DTtN1KrX.mjs";
|
|
16
20
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
17
21
|
import { randomUUID } from "node:crypto";
|
|
18
22
|
import { embeddedAgentLog, resolveDefaultAgentDir } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
@@ -204,6 +208,14 @@ function currentCodexCatalogListDiagnostics() {
|
|
|
204
208
|
const observation = listScope.getStore();
|
|
205
209
|
return observation?.closed ? void 0 : observation;
|
|
206
210
|
}
|
|
211
|
+
function startCodexCatalogListTiming(field, counter) {
|
|
212
|
+
const observation = currentCodexCatalogListDiagnostics();
|
|
213
|
+
const started = observation ? performance.now() : 0;
|
|
214
|
+
if (observation && counter) observation.fields[counter]++;
|
|
215
|
+
return () => {
|
|
216
|
+
if (observation && !observation.closed) observation.fields[field] = (observation.fields[field] ?? 0) + performance.now() - started;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
207
219
|
/** One logical list scope survives admission pauses; finishing drops its captured context. */
|
|
208
220
|
function createCodexCatalogListScope() {
|
|
209
221
|
const observation = start("list phases", {
|
|
@@ -290,56 +302,6 @@ function startCodexCatalogControlRequestDiagnostics(page) {
|
|
|
290
302
|
return observation;
|
|
291
303
|
}
|
|
292
304
|
//#endregion
|
|
293
|
-
//#region extensions/codex/src/session-catalog-availability.ts
|
|
294
|
-
var CodexCatalogLoadingError = class extends Error {
|
|
295
|
-
constructor() {
|
|
296
|
-
super("Codex session catalog is still loading. Retry shortly.");
|
|
297
|
-
this.code = "APP_SERVER_UNAVAILABLE";
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
/** One generation promise wakes cold callers; native pages remain owned by the index. */
|
|
301
|
-
var CodexCatalogAvailability = class {
|
|
302
|
-
constructor() {
|
|
303
|
-
this.complete = false;
|
|
304
|
-
this.changed = createDeferred();
|
|
305
|
-
}
|
|
306
|
-
begin() {
|
|
307
|
-
this.failure = void 0;
|
|
308
|
-
}
|
|
309
|
-
publish(frontier, complete = false) {
|
|
310
|
-
if (this.complete) return;
|
|
311
|
-
if (frontier && (!this.frontier || compareCodexCatalogRows(frontier, this.frontier) > 0)) {
|
|
312
|
-
const { threadId, updatedAt, recencyAt, sourceOrder } = frontier;
|
|
313
|
-
this.frontier = {
|
|
314
|
-
threadId,
|
|
315
|
-
updatedAt,
|
|
316
|
-
recencyAt,
|
|
317
|
-
sourceOrder
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
this.complete = complete;
|
|
321
|
-
this.notify();
|
|
322
|
-
}
|
|
323
|
-
fail(error) {
|
|
324
|
-
this.failure = { error };
|
|
325
|
-
this.notify();
|
|
326
|
-
}
|
|
327
|
-
notify() {
|
|
328
|
-
const previous = this.changed;
|
|
329
|
-
this.changed = createDeferred();
|
|
330
|
-
previous.resolve();
|
|
331
|
-
}
|
|
332
|
-
async until(promise, deadline) {
|
|
333
|
-
const remaining = deadline - performance.now();
|
|
334
|
-
if (remaining <= 0) throw new CodexCatalogLoadingError();
|
|
335
|
-
return await withTimeout(promise, remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
336
|
-
}
|
|
337
|
-
async next(deadline) {
|
|
338
|
-
if (this.failure) throw this.failure.error;
|
|
339
|
-
await this.until(this.changed.promise, deadline);
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
//#endregion
|
|
343
305
|
//#region extensions/codex/src/session-catalog-node-snapshot.ts
|
|
344
306
|
/** One query-compatible native page per node, owned by the registered catalog provider. */
|
|
345
307
|
var CodexCatalogNodeSnapshots = class {
|
|
@@ -444,58 +406,6 @@ function createNodeHostPublication(publication, adopted, sourceKey, onHost, sign
|
|
|
444
406
|
};
|
|
445
407
|
}
|
|
446
408
|
//#endregion
|
|
447
|
-
//#region extensions/codex/src/session-catalog-node-lookup.ts
|
|
448
|
-
async function lookupNodeCodexCatalogRecord(params) {
|
|
449
|
-
const deadline = performance.now() + NODE_INVOKE_TIMEOUT_MS;
|
|
450
|
-
const unverified = () => new CatalogParamsError("Codex session eligibility could not be verified");
|
|
451
|
-
const remaining = () => {
|
|
452
|
-
const timeoutMs = Math.ceil(deadline - performance.now());
|
|
453
|
-
if (timeoutMs <= 0) throw unverified();
|
|
454
|
-
return timeoutMs;
|
|
455
|
-
};
|
|
456
|
-
let cursor;
|
|
457
|
-
let sourceHomeId = params.sourceHomeId;
|
|
458
|
-
let firstPage = true;
|
|
459
|
-
const seenCursors = /* @__PURE__ */ new Set();
|
|
460
|
-
for (;;) {
|
|
461
|
-
const timeoutMs = remaining();
|
|
462
|
-
const raw = await withTimeout(params.runtime.nodes.invoke({
|
|
463
|
-
nodeId: params.nodeId,
|
|
464
|
-
command: CODEX_APP_SERVER_THREADS_LIST_COMMAND,
|
|
465
|
-
params: {
|
|
466
|
-
agentId: params.agentId,
|
|
467
|
-
...sourceHomeId ? { sourceHomeId } : {},
|
|
468
|
-
limit: 100,
|
|
469
|
-
...cursor ? { cursor } : {}
|
|
470
|
-
},
|
|
471
|
-
timeoutMs,
|
|
472
|
-
scopes: ["operator.write"]
|
|
473
|
-
}), timeoutMs, "Codex session eligibility could not be verified", unverified);
|
|
474
|
-
remaining();
|
|
475
|
-
const page = parseCatalogPage(unwrapNodeInvokePayload(raw));
|
|
476
|
-
if ((!firstPage || sourceHomeId !== void 0) && page.sourceHomeId !== sourceHomeId) throw new CatalogParamsError("Codex session source home changed; refresh the catalog and retry");
|
|
477
|
-
sourceHomeId = page.sourceHomeId;
|
|
478
|
-
firstPage = false;
|
|
479
|
-
const record = page.sessions.find((candidate) => candidate.threadId === params.threadId);
|
|
480
|
-
if (record) return {
|
|
481
|
-
kind: "found",
|
|
482
|
-
record,
|
|
483
|
-
sourceHomeId,
|
|
484
|
-
canContinueCodex: page.canContinueCodex
|
|
485
|
-
};
|
|
486
|
-
const nextCursor = page.nextCursor?.trim();
|
|
487
|
-
if (!nextCursor) break;
|
|
488
|
-
if (seenCursors.has(nextCursor)) return { kind: "cursor-cycle" };
|
|
489
|
-
seenCursors.add(nextCursor);
|
|
490
|
-
if (seenCursors.size > 2e4) {
|
|
491
|
-
const oldest = seenCursors.values().next().value;
|
|
492
|
-
if (oldest !== void 0) seenCursors.delete(oldest);
|
|
493
|
-
}
|
|
494
|
-
cursor = nextCursor;
|
|
495
|
-
}
|
|
496
|
-
return { kind: "missing" };
|
|
497
|
-
}
|
|
498
|
-
//#endregion
|
|
499
409
|
//#region extensions/codex/src/session-catalog-terminal.ts
|
|
500
410
|
const CODEX_TERMINAL_RESUME_COMMAND = "codex.terminal.resume.v1";
|
|
501
411
|
const CODEX_TERMINAL_START_COMMAND = "codex.terminal.start.v1";
|
|
@@ -665,120 +575,6 @@ async function startCodexCatalogTerminal(params) {
|
|
|
665
575
|
};
|
|
666
576
|
}
|
|
667
577
|
//#endregion
|
|
668
|
-
//#region extensions/codex/src/session-catalog-list-request.ts
|
|
669
|
-
const listRequest = new AsyncLocalStorage();
|
|
670
|
-
function currentCodexCatalogListRequest() {
|
|
671
|
-
return listRequest.getStore();
|
|
672
|
-
}
|
|
673
|
-
/** One foreground request owns its native read budget and source-health outcome. */
|
|
674
|
-
var CodexCatalogListRequest = class {
|
|
675
|
-
constructor() {
|
|
676
|
-
this.pages = 0;
|
|
677
|
-
this.closed = false;
|
|
678
|
-
this.attempts = /* @__PURE__ */ new Map();
|
|
679
|
-
}
|
|
680
|
-
get hasPages() {
|
|
681
|
-
return this.pages < 20;
|
|
682
|
-
}
|
|
683
|
-
deadline(timeoutMs) {
|
|
684
|
-
this.assertActive();
|
|
685
|
-
return this.deadlineAt ??= performance.now() + timeoutMs;
|
|
686
|
-
}
|
|
687
|
-
constrainDeadline(absolute) {
|
|
688
|
-
this.assertActive();
|
|
689
|
-
this.deadlineAt = Math.min(this.deadlineAt ?? absolute, absolute);
|
|
690
|
-
return this.deadlineAt;
|
|
691
|
-
}
|
|
692
|
-
remaining(timeoutMs) {
|
|
693
|
-
const remaining = Math.min(timeoutMs, this.deadline(timeoutMs) - performance.now());
|
|
694
|
-
if (remaining <= 0) throw new CodexCatalogLoadingError();
|
|
695
|
-
return remaining;
|
|
696
|
-
}
|
|
697
|
-
assertActive() {
|
|
698
|
-
if (this.closed) throw new DOMException("Codex session catalog request is closed", "AbortError");
|
|
699
|
-
if (this.deadlineAt !== void 0 && this.deadlineAt <= performance.now()) throw new CodexCatalogLoadingError();
|
|
700
|
-
}
|
|
701
|
-
async run(run) {
|
|
702
|
-
this.assertActive();
|
|
703
|
-
const pending = listRequest.run(this, run);
|
|
704
|
-
const remaining = this.deadlineAt === void 0 ? void 0 : this.deadlineAt - performance.now();
|
|
705
|
-
if (remaining !== void 0 && remaining <= 0) {
|
|
706
|
-
pending.catch(() => {});
|
|
707
|
-
throw new CodexCatalogLoadingError();
|
|
708
|
-
}
|
|
709
|
-
const result = remaining === void 0 ? await pending : await withTimeout(pending, remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
710
|
-
this.assertActive();
|
|
711
|
-
return result;
|
|
712
|
-
}
|
|
713
|
-
async read(timeoutMs, read) {
|
|
714
|
-
const remaining = this.remaining(timeoutMs);
|
|
715
|
-
if (!this.hasPages) throw new CatalogParamsError("Codex catalog native page budget is exhausted");
|
|
716
|
-
this.pages++;
|
|
717
|
-
try {
|
|
718
|
-
const result = await withTimeout(read(remaining), remaining, "Codex session catalog is still loading", () => new CodexCatalogLoadingError());
|
|
719
|
-
this.assertActive();
|
|
720
|
-
return result;
|
|
721
|
-
} catch (error) {
|
|
722
|
-
if (!this.closed) this.failure ??= { error };
|
|
723
|
-
throw error;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
attempt(owner, key, start) {
|
|
727
|
-
this.assertActive();
|
|
728
|
-
let attempts = this.attempts.get(owner);
|
|
729
|
-
const existing = attempts?.get(key);
|
|
730
|
-
if (existing) return existing;
|
|
731
|
-
const attempt = start();
|
|
732
|
-
if (!attempts) {
|
|
733
|
-
attempts = /* @__PURE__ */ new Map();
|
|
734
|
-
this.attempts.set(owner, attempts);
|
|
735
|
-
}
|
|
736
|
-
attempts.set(key, attempt);
|
|
737
|
-
return attempt;
|
|
738
|
-
}
|
|
739
|
-
resolved() {
|
|
740
|
-
if (this.failure) {
|
|
741
|
-
this.rejected(this.failure.error);
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
this.settle((attempt) => attempt.resolved());
|
|
745
|
-
}
|
|
746
|
-
rejected(error) {
|
|
747
|
-
if (error instanceof Error && error.name === "AbortError") {
|
|
748
|
-
this.close();
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
const reason = this.failure?.error ?? error;
|
|
752
|
-
this.settle((attempt) => attempt.rejected(reason));
|
|
753
|
-
}
|
|
754
|
-
close() {
|
|
755
|
-
this.settle((attempt) => attempt.abandoned());
|
|
756
|
-
}
|
|
757
|
-
settle(settle) {
|
|
758
|
-
if (this.closed) return;
|
|
759
|
-
this.closed = true;
|
|
760
|
-
for (const attempts of this.attempts.values()) for (const attempt of attempts.values()) if (attempt.allowed) settle(attempt);
|
|
761
|
-
this.attempts.clear();
|
|
762
|
-
this.failure = void 0;
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
async function withCodexCatalogListRequest(run) {
|
|
766
|
-
const current = currentCodexCatalogListRequest();
|
|
767
|
-
if (current) {
|
|
768
|
-
current.assertActive();
|
|
769
|
-
return await run(current);
|
|
770
|
-
}
|
|
771
|
-
const scope = new CodexCatalogListRequest();
|
|
772
|
-
try {
|
|
773
|
-
const result = await scope.run(() => run(scope));
|
|
774
|
-
scope.resolved();
|
|
775
|
-
return result;
|
|
776
|
-
} catch (error) {
|
|
777
|
-
scope.rejected(error);
|
|
778
|
-
throw error;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
//#endregion
|
|
782
578
|
//#region extensions/codex/src/session-catalog-visible-page.ts
|
|
783
579
|
/** Fill exclusions from bounded resident pages. */
|
|
784
580
|
var CodexCatalogVisiblePage = class {
|
|
@@ -810,9 +606,7 @@ var CodexCatalogVisiblePage = class {
|
|
|
810
606
|
if (this.complete) throw new Error("Codex catalog page is already complete");
|
|
811
607
|
const params = this.params;
|
|
812
608
|
params.signal?.throwIfAborted();
|
|
813
|
-
const
|
|
814
|
-
const started = diagnostics ? performance.now() : 0;
|
|
815
|
-
if (diagnostics) diagnostics.fields.controlPageCalls++;
|
|
609
|
+
const finishTiming = startCodexCatalogListTiming("controlWaitSumMs", "controlPageCalls");
|
|
816
610
|
let rawPage;
|
|
817
611
|
try {
|
|
818
612
|
rawPage = await params.control.listPage({
|
|
@@ -822,7 +616,7 @@ var CodexCatalogVisiblePage = class {
|
|
|
822
616
|
...params.cwd ? { cwd: params.cwd } : {}
|
|
823
617
|
});
|
|
824
618
|
} finally {
|
|
825
|
-
|
|
619
|
+
finishTiming();
|
|
826
620
|
}
|
|
827
621
|
this.request.assertActive();
|
|
828
622
|
params.signal?.throwIfAborted();
|
|
@@ -908,12 +702,10 @@ function hostFailure(source, error) {
|
|
|
908
702
|
}
|
|
909
703
|
async function projectLocalHost(params, agentId, source, page) {
|
|
910
704
|
params.signal?.throwIfAborted();
|
|
911
|
-
const { listAdoptedSessionEntries } = await import("./session-catalog-adoption-
|
|
705
|
+
const { listAdoptedSessionEntries } = await import("./session-catalog-adoption-BU_pHWG7.mjs");
|
|
912
706
|
const { sessionCatalogAdoptedSourceKey } = await import("openclaw/plugin-sdk/session-catalog");
|
|
913
707
|
params.signal?.throwIfAborted();
|
|
914
|
-
const
|
|
915
|
-
const started = diagnostics ? performance.now() : 0;
|
|
916
|
-
if (diagnostics) diagnostics.fields.adoptionCalls++;
|
|
708
|
+
const finishTiming = startCodexCatalogListTiming("adoptionSumMs", "adoptionCalls");
|
|
917
709
|
let adopted;
|
|
918
710
|
try {
|
|
919
711
|
adopted = await listAdoptedSessionEntries({
|
|
@@ -924,7 +716,7 @@ async function projectLocalHost(params, agentId, source, page) {
|
|
|
924
716
|
sessionEntries: params.sessionEntries
|
|
925
717
|
});
|
|
926
718
|
} finally {
|
|
927
|
-
|
|
719
|
+
finishTiming();
|
|
928
720
|
}
|
|
929
721
|
const hostId = source?.hostId ?? "gateway:local";
|
|
930
722
|
const sourceHomeId = source?.sourceHomeId ?? "gateway:local";
|
|
@@ -950,9 +742,7 @@ async function projectLocalHost(params, agentId, source, page) {
|
|
|
950
742
|
function managedMarker(store, sourceHomeId, managed) {
|
|
951
743
|
return async ({ threadId, rolloutPath }) => {
|
|
952
744
|
if (managed?.has(threadId)) return;
|
|
953
|
-
const
|
|
954
|
-
const started = diagnostics ? performance.now() : 0;
|
|
955
|
-
if (diagnostics) diagnostics.fields.exclusionMarkCalls++;
|
|
745
|
+
const finishTiming = startCodexCatalogListTiming("exclusionMarkSumMs", "exclusionMarkCalls");
|
|
956
746
|
try {
|
|
957
747
|
await store.mark({
|
|
958
748
|
sourceHomeId,
|
|
@@ -960,7 +750,7 @@ function managedMarker(store, sourceHomeId, managed) {
|
|
|
960
750
|
...rolloutPath ? { rolloutPath } : {}
|
|
961
751
|
});
|
|
962
752
|
} finally {
|
|
963
|
-
|
|
753
|
+
finishTiming();
|
|
964
754
|
}
|
|
965
755
|
};
|
|
966
756
|
}
|
|
@@ -1135,8 +925,8 @@ var CodexCatalogListDriver = class {
|
|
|
1135
925
|
}
|
|
1136
926
|
params.signal?.throwIfAborted();
|
|
1137
927
|
this.nodeSnapshots.observe(this.nodeGeneration, inventory);
|
|
1138
|
-
const { listNodeAdoptedSessionEntries, nodeAdoptedSourceKey } = await import("./session-catalog-node-adoption-
|
|
1139
|
-
const { compareNodeLabels, listPairedNode, nodeLabel } = await import("./session-catalog-node-continue-
|
|
928
|
+
const { listNodeAdoptedSessionEntries, nodeAdoptedSourceKey } = await import("./session-catalog-node-adoption-DgXvSGu0.mjs");
|
|
929
|
+
const { compareNodeLabels, listPairedNode, nodeLabel } = await import("./session-catalog-node-continue-DjKXHBbi.mjs");
|
|
1140
930
|
params.signal?.throwIfAborted();
|
|
1141
931
|
const adopted = listNodeAdoptedSessionEntries({
|
|
1142
932
|
agentId,
|
|
@@ -1206,7 +996,7 @@ var CodexCatalogListDriver = class {
|
|
|
1206
996
|
});
|
|
1207
997
|
});
|
|
1208
998
|
try {
|
|
1209
|
-
return
|
|
999
|
+
return await Promise.all(pendingHosts);
|
|
1210
1000
|
} catch (error) {
|
|
1211
1001
|
await Promise.allSettled(pendingHosts);
|
|
1212
1002
|
throw error;
|
|
@@ -1299,6 +1089,87 @@ async function listCodexSessionCatalog(params) {
|
|
|
1299
1089
|
return { hosts: await runCatalogListInline(createCodexSessionCatalogListOperation(params)) };
|
|
1300
1090
|
}
|
|
1301
1091
|
//#endregion
|
|
1092
|
+
//#region extensions/codex/src/app-server/thread-history-page.ts
|
|
1093
|
+
const TURN_ITEM_CURSOR_PREFIX = "turn-item:";
|
|
1094
|
+
function encodeTurnItemCursor(turnCursor, itemId) {
|
|
1095
|
+
return TURN_ITEM_CURSOR_PREFIX + Buffer.from(JSON.stringify([turnCursor, itemId])).toString("base64url");
|
|
1096
|
+
}
|
|
1097
|
+
function decodeTurnItemCursor(cursor) {
|
|
1098
|
+
if (!cursor?.startsWith(TURN_ITEM_CURSOR_PREFIX)) return { turnCursor: cursor };
|
|
1099
|
+
let value;
|
|
1100
|
+
try {
|
|
1101
|
+
value = JSON.parse(Buffer.from(cursor.slice(10), "base64url").toString());
|
|
1102
|
+
} catch {
|
|
1103
|
+
throw new CatalogParamsError("invalid Codex transcript item cursor");
|
|
1104
|
+
}
|
|
1105
|
+
if (!Array.isArray(value) || value.length !== 2 || typeof value[0] !== "string" || !value[0] || typeof value[1] !== "string" || !value[1]) throw new CatalogParamsError("invalid Codex transcript item cursor");
|
|
1106
|
+
return {
|
|
1107
|
+
turnCursor: value[0],
|
|
1108
|
+
itemId: value[1]
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
/** Legacy stores expose only turn cursors; an item identity preserves paging across appends. */
|
|
1112
|
+
async function readLegacyCodexHistoryPage(readTurns, request, projection) {
|
|
1113
|
+
const { turnCursor, itemId } = decodeTurnItemCursor(request.cursor);
|
|
1114
|
+
const page = parseTranscriptPage(await readTurns({
|
|
1115
|
+
threadId: request.threadId,
|
|
1116
|
+
limit: 1,
|
|
1117
|
+
sortDirection: "desc",
|
|
1118
|
+
itemsView: "full",
|
|
1119
|
+
...turnCursor ? { cursor: turnCursor } : {}
|
|
1120
|
+
}));
|
|
1121
|
+
const source = page.data.flatMap(({ items, ...turn }) => items.toReversed().map((item) => ({
|
|
1122
|
+
turnId: turn.id,
|
|
1123
|
+
item,
|
|
1124
|
+
turn
|
|
1125
|
+
})));
|
|
1126
|
+
const anchorIndex = itemId ? source.findIndex(({ item }) => item.id === itemId) : -1;
|
|
1127
|
+
if (itemId && anchorIndex < 0) throw new CatalogParamsError("Codex transcript changed; refresh the session before loading older items");
|
|
1128
|
+
const remaining = source.slice(anchorIndex + 1);
|
|
1129
|
+
const items = projection.project(remaining.slice(0, request.limit), request.limit);
|
|
1130
|
+
const result = () => {
|
|
1131
|
+
const lastSource = remaining[items.length - 1];
|
|
1132
|
+
const partial = lastSource !== void 0 && items.length < remaining.length;
|
|
1133
|
+
const nativeCursor = partial ? page.backwardsCursor : page.nextCursor;
|
|
1134
|
+
const cursor = nativeCursor ? partial ? encodeTurnItemCursor(nativeCursor, lastSource.item.id) : nativeCursor : void 0;
|
|
1135
|
+
if (partial && !cursor) throw new Error("Codex app-server did not provide a transcript continuation anchor");
|
|
1136
|
+
return {
|
|
1137
|
+
items,
|
|
1138
|
+
...cursor ? { nextCursor: cursor } : {}
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
let bounded = result();
|
|
1142
|
+
while (!projection.fits(bounded)) {
|
|
1143
|
+
if (items.length <= 1) throw new Error("Codex transcript item exceeds the safe response size");
|
|
1144
|
+
items.pop();
|
|
1145
|
+
bounded = result();
|
|
1146
|
+
}
|
|
1147
|
+
return bounded;
|
|
1148
|
+
}
|
|
1149
|
+
/** Callers authorize the thread; this reader owns native cursor and response-size semantics. */
|
|
1150
|
+
async function readCodexThreadHistoryPage(control, thread, request, projection) {
|
|
1151
|
+
if (thread.historyMode !== "paginated") return readLegacyCodexHistoryPage((params) => control.listTurnPage(params), request, projection);
|
|
1152
|
+
let limit = request.limit;
|
|
1153
|
+
for (;;) {
|
|
1154
|
+
const page = await control.listItemPage({
|
|
1155
|
+
threadId: request.threadId,
|
|
1156
|
+
limit,
|
|
1157
|
+
sortDirection: "desc",
|
|
1158
|
+
...request.cursor ? { cursor: request.cursor } : {}
|
|
1159
|
+
});
|
|
1160
|
+
const nextCursor = readControlCursor(page.nextCursor, "transcript next response");
|
|
1161
|
+
const items = projection.project(page.data, limit);
|
|
1162
|
+
const result = {
|
|
1163
|
+
items,
|
|
1164
|
+
...nextCursor ? { nextCursor } : {}
|
|
1165
|
+
};
|
|
1166
|
+
const fittingCount = items.length - (projection.fits(result) ? 0 : 1);
|
|
1167
|
+
if (fittingCount === page.data.length) return result;
|
|
1168
|
+
if (fittingCount < 1) throw new Error("Codex transcript item exceeds the safe response size");
|
|
1169
|
+
limit = fittingCount;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
//#endregion
|
|
1302
1173
|
//#region extensions/codex/src/session-catalog-transcript-item.ts
|
|
1303
1174
|
const CODEX_MESSAGE_TYPES = /* @__PURE__ */ new Map([
|
|
1304
1175
|
["userMessage", "userMessage"],
|
|
@@ -1352,8 +1223,8 @@ const transcriptPageSchema = z.strictObject({
|
|
|
1352
1223
|
function parseCodexCatalogTranscriptPage(value) {
|
|
1353
1224
|
return transcriptPageSchema.parse(value);
|
|
1354
1225
|
}
|
|
1355
|
-
function projectTranscriptPage(
|
|
1356
|
-
const projected =
|
|
1226
|
+
function projectTranscriptPage(entries, limit) {
|
|
1227
|
+
const projected = entries.map(({ item }) => toGenericTranscriptItem(item));
|
|
1357
1228
|
const page = sessionCatalogPaging.boundTranscriptPage(projected.toReversed(), limit, 0).items;
|
|
1358
1229
|
for (const [index, item] of page.entries()) if (item.text !== projected[index]?.text && projected[index]?.text) item.truncated = true;
|
|
1359
1230
|
return page;
|
|
@@ -1364,15 +1235,14 @@ function pageFitsNodeTransport(page) {
|
|
|
1364
1235
|
/** The legacy API can anchor a turn, but cannot continue within that turn. */
|
|
1365
1236
|
async function readLegacyCodexTranscriptPage(readTurns, request) {
|
|
1366
1237
|
return readLegacyCodexHistoryPage(readTurns, request, {
|
|
1367
|
-
project:
|
|
1238
|
+
project: projectTranscriptPage,
|
|
1368
1239
|
fits: pageFitsNodeTransport
|
|
1369
1240
|
});
|
|
1370
1241
|
}
|
|
1371
1242
|
/** Uses the native store's item cursor whenever that store supports item history. */
|
|
1372
1243
|
async function readCodexCatalogTranscriptPage(control, request) {
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
project: (entries, limit) => projectTranscriptPage(entries.map(({ item }) => item), limit),
|
|
1244
|
+
return readCodexThreadHistoryPage(control, await control.requireEligibleThread(request.threadId), request, {
|
|
1245
|
+
project: projectTranscriptPage,
|
|
1376
1246
|
fits: pageFitsNodeTransport
|
|
1377
1247
|
});
|
|
1378
1248
|
}
|
|
@@ -1396,6 +1266,23 @@ function createCodexSessionCatalogNodeHostCommands(controlFactory, bindingStore)
|
|
|
1396
1266
|
paramsJSON: JSON.stringify(request)
|
|
1397
1267
|
};
|
|
1398
1268
|
};
|
|
1269
|
+
const transcriptCommand = (command, read) => ({
|
|
1270
|
+
command,
|
|
1271
|
+
cap: CODEX_APP_SERVER_THREADS_CAPABILITY,
|
|
1272
|
+
dangerous: false,
|
|
1273
|
+
hasActiveWork: controlFactory.hasActiveWork,
|
|
1274
|
+
onDisconnect: controlFactory.disconnect,
|
|
1275
|
+
handle: async (paramsJSON) => {
|
|
1276
|
+
const request = await bindRequest(paramsJSON);
|
|
1277
|
+
const action = readNodeTranscriptParams(request.params);
|
|
1278
|
+
try {
|
|
1279
|
+
return JSON.stringify(await read(request.control, action));
|
|
1280
|
+
} catch (error) {
|
|
1281
|
+
if (error instanceof CatalogParamsError) throw error;
|
|
1282
|
+
throw new Error("Codex app-server transcript is unavailable", { cause: error });
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1399
1286
|
const commands = [
|
|
1400
1287
|
{
|
|
1401
1288
|
command: CODEX_APP_SERVER_THREADS_LIST_COMMAND,
|
|
@@ -1435,48 +1322,17 @@ function createCodexSessionCatalogNodeHostCommands(controlFactory, bindingStore)
|
|
|
1435
1322
|
}
|
|
1436
1323
|
}
|
|
1437
1324
|
},
|
|
1438
|
-
{
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
const page = parseTranscriptPage(await request.control.listTurnPage({
|
|
1450
|
-
threadId: action.threadId,
|
|
1451
|
-
limit: action.limit,
|
|
1452
|
-
sortDirection: "desc",
|
|
1453
|
-
itemsView: "full",
|
|
1454
|
-
...action.cursor ? { cursor: action.cursor } : {}
|
|
1455
|
-
}));
|
|
1456
|
-
return JSON.stringify(page);
|
|
1457
|
-
} catch (error) {
|
|
1458
|
-
if (error instanceof CatalogParamsError) throw error;
|
|
1459
|
-
throw new Error("Codex app-server transcript is unavailable", { cause: error });
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
},
|
|
1463
|
-
{
|
|
1464
|
-
command: CODEX_CATALOG_TRANSCRIPT_READ_COMMAND,
|
|
1465
|
-
cap: CODEX_APP_SERVER_THREADS_CAPABILITY,
|
|
1466
|
-
dangerous: false,
|
|
1467
|
-
hasActiveWork: controlFactory.hasActiveWork,
|
|
1468
|
-
onDisconnect: controlFactory.disconnect,
|
|
1469
|
-
handle: async (paramsJSON) => {
|
|
1470
|
-
const request = await bindRequest(paramsJSON);
|
|
1471
|
-
const action = readNodeTranscriptParams(request.params);
|
|
1472
|
-
try {
|
|
1473
|
-
return JSON.stringify(await readCodexCatalogTranscriptPage(request.control, action));
|
|
1474
|
-
} catch (error) {
|
|
1475
|
-
if (error instanceof CatalogParamsError) throw error;
|
|
1476
|
-
throw new Error("Codex app-server transcript is unavailable", { cause: error });
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
},
|
|
1325
|
+
transcriptCommand(CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, async (control, action) => {
|
|
1326
|
+
await control.requireEligibleThread(action.threadId);
|
|
1327
|
+
return parseTranscriptPage(await control.listTurnPage({
|
|
1328
|
+
threadId: action.threadId,
|
|
1329
|
+
limit: action.limit,
|
|
1330
|
+
sortDirection: "desc",
|
|
1331
|
+
itemsView: "full",
|
|
1332
|
+
...action.cursor ? { cursor: action.cursor } : {}
|
|
1333
|
+
}));
|
|
1334
|
+
}),
|
|
1335
|
+
transcriptCommand(CODEX_CATALOG_TRANSCRIPT_READ_COMMAND, readCodexCatalogTranscriptPage),
|
|
1480
1336
|
createCodexTerminalNodeHostCommand(bindRequest),
|
|
1481
1337
|
createCodexTerminalStartNodeHostCommand()
|
|
1482
1338
|
];
|
|
@@ -1494,19 +1350,14 @@ function readNodeTranscriptParams(value) {
|
|
|
1494
1350
|
const cursor = readBoundedOptionalString(value, "cursor", MAX_CURSOR_LENGTH);
|
|
1495
1351
|
return {
|
|
1496
1352
|
threadId,
|
|
1497
|
-
limit:
|
|
1353
|
+
limit: normalizeLimit(value.limit, "limit", 20, 50),
|
|
1498
1354
|
...cursor ? { cursor } : {}
|
|
1499
1355
|
};
|
|
1500
1356
|
}
|
|
1501
|
-
function readBoundedLimit(value, key, fallback, max) {
|
|
1502
|
-
if (value === void 0) return fallback;
|
|
1503
|
-
if (!Number.isInteger(value) || value < 1 || value > max) throw new CatalogParamsError(`${key} must be an integer from 1 to ${max}`);
|
|
1504
|
-
return value;
|
|
1505
|
-
}
|
|
1506
1357
|
/** Reads the persisted transcript for a Gateway-local or paired-node Codex session. */
|
|
1507
1358
|
async function readCodexSessionTranscript(params) {
|
|
1508
1359
|
const cursor = readControlCursor(params.cursor, "transcript request");
|
|
1509
|
-
const limit =
|
|
1360
|
+
const limit = normalizeLimit(params.limit, "limit", 20, 50);
|
|
1510
1361
|
if (params.source || params.hostId === "gateway:local") {
|
|
1511
1362
|
const page = await readCodexCatalogTranscriptPage(params.control, {
|
|
1512
1363
|
threadId: params.threadId,
|
|
@@ -1546,7 +1397,7 @@ async function readCodexSessionTranscript(params) {
|
|
|
1546
1397
|
cursor,
|
|
1547
1398
|
limit
|
|
1548
1399
|
});
|
|
1549
|
-
const { nodeLabel } = await import("./session-catalog-node-continue-
|
|
1400
|
+
const { nodeLabel } = await import("./session-catalog-node-continue-DjKXHBbi.mjs");
|
|
1550
1401
|
return {
|
|
1551
1402
|
hostId: params.hostId,
|
|
1552
1403
|
label: nodeLabel(node),
|
|
@@ -1562,7 +1413,7 @@ function readMarker(probe) {
|
|
|
1562
1413
|
const turnId = probe.marker.turnId;
|
|
1563
1414
|
if (turnId !== null && typeof turnId !== "string") return;
|
|
1564
1415
|
const count = probe.marker.userMessageCount;
|
|
1565
|
-
if (count !== void 0 && (!Number.isSafeInteger(count) || count < 0)) return;
|
|
1416
|
+
if (count !== void 0 && (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0)) return;
|
|
1566
1417
|
return {
|
|
1567
1418
|
turnId,
|
|
1568
1419
|
...count === void 0 ? {} : { userMessageCount: count }
|
|
@@ -1578,7 +1429,7 @@ function classifyCodexUpstreamTurns(params) {
|
|
|
1578
1429
|
if (!newest?.id) return;
|
|
1579
1430
|
const markerIndex = marker.turnId === null ? -1 : params.turns.findIndex((turn) => turn.id === marker.turnId);
|
|
1580
1431
|
const candidateTurns = markerIndex < 0 ? params.turns : params.turns.slice(0, markerIndex + 1);
|
|
1581
|
-
const newestUserMessageCount =
|
|
1432
|
+
const newestUserMessageCount = newest.items.filter((item) => item.type === "userMessage").length;
|
|
1582
1433
|
if (!(marker.turnId !== newest.id || marker.userMessageCount === void 0 || newestUserMessageCount > marker.userMessageCount)) return;
|
|
1583
1434
|
const ownTexts = new Set(params.probe.ownRecentUserTexts);
|
|
1584
1435
|
let humanTurns = 0;
|
|
@@ -1611,9 +1462,6 @@ function classifyCodexUpstreamTurns(params) {
|
|
|
1611
1462
|
} : {}
|
|
1612
1463
|
};
|
|
1613
1464
|
}
|
|
1614
|
-
function countUserMessages(turn) {
|
|
1615
|
-
return turn.items.filter((item) => item.type === "userMessage").length;
|
|
1616
|
-
}
|
|
1617
1465
|
function normalizeUserMessageTexts(item) {
|
|
1618
1466
|
const typed = item;
|
|
1619
1467
|
const contentTexts = typed.content?.filter((input) => input.type === "text").map((input) => input.text.trim().replace(/\s+/g, " ")).filter(Boolean);
|
|
@@ -1713,8 +1561,8 @@ async function requireEligibleCodexThread(params) {
|
|
|
1713
1561
|
remaining();
|
|
1714
1562
|
if (thread.id !== threadId || thread.ephemeral === true || !isInteractiveThreadSource(thread.source)) throw unverified();
|
|
1715
1563
|
if (!root) {
|
|
1716
|
-
const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./session-catalog-native-projection-
|
|
1717
|
-
const { CODEX_CATALOG_MAX_ROWS } = await import("./session-catalog-
|
|
1564
|
+
const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./session-catalog-native-projection-DjhwGL6x.mjs").then((n) => n.a);
|
|
1565
|
+
const { CODEX_CATALOG_MAX_ROWS } = await import("./session-catalog-limits-DDxOsQeC.mjs").then((n) => n.r);
|
|
1718
1566
|
let cursor;
|
|
1719
1567
|
const seenCursors = /* @__PURE__ */ new Set();
|
|
1720
1568
|
for (;;) {
|
|
@@ -2096,7 +1944,6 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2096
1944
|
const now = params.now ?? Date.now;
|
|
2097
1945
|
const sourceBackoff = new CodexCatalogSourceBackoff(now);
|
|
2098
1946
|
const noConfig = {};
|
|
2099
|
-
const getPluginConfig = () => params.getPluginConfig();
|
|
2100
1947
|
const resolveRuntimeOptions = (options) => {
|
|
2101
1948
|
const runtime = params.resolveRuntimeOptions(options);
|
|
2102
1949
|
return runtime.start.transport === "stdio" && runtime.start.commandSource === "managed" ? {
|
|
@@ -2151,7 +1998,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2151
1998
|
retireIndexes();
|
|
2152
1999
|
}
|
|
2153
2000
|
const epoch = residentEpoch;
|
|
2154
|
-
const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig: getPluginConfig() });
|
|
2001
|
+
const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig: params.getPluginConfig() });
|
|
2155
2002
|
const requestOptions = resolveRequestOptions(runtime.start, agentId, source);
|
|
2156
2003
|
const key = source?.sourceHomeId ?? agentId ?? "";
|
|
2157
2004
|
let home = directHomes.get(key);
|
|
@@ -2168,7 +2015,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2168
2015
|
if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
|
|
2169
2016
|
let index = indexes.get(homeId);
|
|
2170
2017
|
if (!index) {
|
|
2171
|
-
const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./session-catalog-index-
|
|
2018
|
+
const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./session-catalog-index-CZvDzC6z.mjs"), import("./session-catalog-projection-Cr5qP5Dj.mjs")]);
|
|
2172
2019
|
source?.assertCurrent();
|
|
2173
2020
|
if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
|
|
2174
2021
|
index = indexes.get(homeId);
|
|
@@ -2289,11 +2136,11 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2289
2136
|
return resolved;
|
|
2290
2137
|
};
|
|
2291
2138
|
const createRequestSnapshot = (agentId, source, catalogPreview, catalogPreviewCache, catalogRows) => {
|
|
2292
|
-
const pluginConfig = getPluginConfig();
|
|
2139
|
+
const pluginConfig = params.getPluginConfig();
|
|
2293
2140
|
const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
|
|
2294
2141
|
const requestOptions = resolveRequestOptions(runtime.start, agentId, source);
|
|
2295
2142
|
return createCodexCatalogRequestSnapshot(runtime.requestTimeoutMs, async (method, requestParams, timeoutMs, assertCurrent, observation) => {
|
|
2296
|
-
const { codexControlRequest } = await import("./command-rpc-
|
|
2143
|
+
const { codexControlRequest } = await import("./command-rpc-CGJGUQ6Y.mjs").then((n) => n.n);
|
|
2297
2144
|
return await codexControlRequest(pluginConfig, method, requestParams, {
|
|
2298
2145
|
...requestOptions,
|
|
2299
2146
|
authProfileId: null,
|
|
@@ -2311,13 +2158,13 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2311
2158
|
const forRequest = (agentId, source) => {
|
|
2312
2159
|
source?.assertCurrent();
|
|
2313
2160
|
const withPinnedConnection = async (run) => {
|
|
2314
|
-
const pluginConfig = getPluginConfig();
|
|
2161
|
+
const pluginConfig = params.getPluginConfig();
|
|
2315
2162
|
const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
|
|
2316
2163
|
const { agentDir, config: runtimeConfig, startOptions } = resolveRequestOptions(runtime.start, agentId, source);
|
|
2317
2164
|
let catalogIndex;
|
|
2318
|
-
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./shared-client-
|
|
2319
|
-
const { resolveCodexAppServerClientInstanceId } = await import("./client-
|
|
2320
|
-
const { requestCodexAppServerClientJson } = await import("./request-
|
|
2165
|
+
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./shared-client-DqyTMYug.mjs").then((n) => n.v);
|
|
2166
|
+
const { resolveCodexAppServerClientInstanceId } = await import("./client-N0JpgSzF.mjs").then((n) => n.n);
|
|
2167
|
+
const { requestCodexAppServerClientJson } = await import("./request-BHZ1nz8d.mjs").then((n) => n.a);
|
|
2321
2168
|
const client = await getLeasedSharedCodexAppServerClient({
|
|
2322
2169
|
agentDir,
|
|
2323
2170
|
config: runtimeConfig,
|
|
@@ -2386,7 +2233,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2386
2233
|
await Promise.allSettled(residentRequests);
|
|
2387
2234
|
const clients = getSharedCodexAppServerClientState();
|
|
2388
2235
|
if (clients.liveClients.size > 0 || clients.startup.pending.size > 0) {
|
|
2389
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
2236
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-DqyTMYug.mjs").then((n) => n.v);
|
|
2390
2237
|
await clearSharedCodexAppServerClientAndWait();
|
|
2391
2238
|
}
|
|
2392
2239
|
},
|
|
@@ -2548,8 +2395,7 @@ function withCatalogListScope(initialize) {
|
|
|
2548
2395
|
}
|
|
2549
2396
|
function catalogHostMapper(localTerminalAvailable, localHomes) {
|
|
2550
2397
|
return (host) => {
|
|
2551
|
-
const
|
|
2552
|
-
const started = diagnostics ? performance.now() : 0;
|
|
2398
|
+
const finishTiming = startCodexCatalogListTiming("mappingMs");
|
|
2553
2399
|
try {
|
|
2554
2400
|
const localSourceAvailable = localTerminalAvailable && localHomes.some((home) => home.hostId === host.hostId && home.appServer.start.transport === "stdio");
|
|
2555
2401
|
return {
|
|
@@ -2557,7 +2403,7 @@ function catalogHostMapper(localTerminalAvailable, localHomes) {
|
|
|
2557
2403
|
canStartTerminal: host.kind === "gateway" ? localSourceAvailable && host.hostId === "gateway:local" : host.canStartTerminal === true
|
|
2558
2404
|
};
|
|
2559
2405
|
} finally {
|
|
2560
|
-
|
|
2406
|
+
finishTiming();
|
|
2561
2407
|
}
|
|
2562
2408
|
};
|
|
2563
2409
|
}
|
|
@@ -2749,16 +2595,16 @@ const codexSessionCatalogRuntime = {
|
|
|
2749
2595
|
archiveLocal: archiveLocalCodexSession
|
|
2750
2596
|
};
|
|
2751
2597
|
async function continueLocalCodexSession(...args) {
|
|
2752
|
-
const { continueLocalCodexSession: run } = await import("./session-catalog-adoption-
|
|
2598
|
+
const { continueLocalCodexSession: run } = await import("./session-catalog-adoption-BU_pHWG7.mjs");
|
|
2753
2599
|
return run(...args);
|
|
2754
2600
|
}
|
|
2755
2601
|
async function archiveLocalCodexSession(...args) {
|
|
2756
|
-
const { archiveLocalCodexSession: run } = await import("./session-catalog-archive-
|
|
2602
|
+
const { archiveLocalCodexSession: run } = await import("./session-catalog-archive-spHfihri.mjs");
|
|
2757
2603
|
return run(...args);
|
|
2758
2604
|
}
|
|
2759
2605
|
async function continueNodeCodexSession(...args) {
|
|
2760
|
-
const { continueNodeCodexSession: run } = await import("./session-catalog-node-continue-
|
|
2606
|
+
const { continueNodeCodexSession: run } = await import("./session-catalog-node-continue-DjKXHBbi.mjs");
|
|
2761
2607
|
return run(...args);
|
|
2762
2608
|
}
|
|
2763
2609
|
//#endregion
|
|
2764
|
-
export {
|
|
2610
|
+
export { createCodexSessionCatalogNodeHostCommands as i, createCodexSessionCatalogNodeInvokePolicies as n, createCodexSessionCatalogControl as r, codexSessionCatalogRuntime as t };
|