@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.
Files changed (158) hide show
  1. package/README.md +2 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-G348lY1q.mjs} +5 -5
  4. package/dist/.setup/{apply-DDOi8uNx.mjs → apply-Cqb-YoCS.mjs} +22 -36
  5. package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-B-S7ngS_.mjs} +128 -37
  6. package/dist/.setup/attempt-workspace-context-BJ5Z_olH.mjs +164 -0
  7. package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
  8. package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dnps4W4_.mjs} +36 -34
  9. package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
  10. package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
  11. package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
  13. package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-BNunZPtz.mjs} +15 -18
  14. package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
  15. package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-DIQ5O_-S.mjs} +1 -1
  16. package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
  17. package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-DRvx_wCC.mjs} +1 -1
  18. package/dist/.setup/{client-Cs08OXVQ.mjs → client-qyUBJlGZ.mjs} +138 -399
  19. package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-Btrs1D6f.mjs} +5 -8
  20. package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
  21. package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-DvlCHJch.mjs} +222 -343
  22. package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-skzRq4wD.mjs} +15 -18
  23. package/dist/.setup/compact-8ttks5U5.mjs +776 -0
  24. package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
  25. package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
  26. package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
  27. package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
  28. package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
  29. package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
  30. package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
  31. package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-74LaGGH-.mjs} +67 -90
  32. package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
  33. package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-OrN6zuaY.mjs} +8 -8
  34. package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
  35. package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
  36. package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-Db2sY5cZ.mjs} +2305 -2606
  37. package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-Bi6-SQ7i.mjs} +8 -17
  38. package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-DiCS1ijR.mjs} +3 -3
  39. package/dist/.setup/event-projector-assistant-message-MV_1dj-3.mjs +69 -0
  40. package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
  41. package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
  42. package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
  43. package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
  44. package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
  45. package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
  46. package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
  47. package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-D80IXfQF.mjs} +9 -12
  48. package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
  49. package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-DiC0Tkha.mjs} +11 -10
  50. package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
  51. package/dist/.setup/{models-KnqBv0hE.mjs → models-DfLmPV0k.mjs} +9 -18
  52. package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
  53. package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
  54. package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-BwkQXf9e.mjs} +4395 -3609
  55. package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
  56. package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
  57. package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
  58. package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
  59. package/dist/.setup/{plan-CN3VwfNU.mjs → plan-DPdMk1Oy.mjs} +49 -92
  60. package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
  61. package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
  62. package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
  63. package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
  64. package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-BRwtRct9.mjs} +116 -176
  65. package/dist/.setup/{provider-BOsxQHOM.mjs → provider-D6F_7p1I.mjs} +11 -14
  66. package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-DG5qbsUZ.mjs} +13 -18
  67. package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
  68. package/dist/.setup/{request-D2L0zMrq.mjs → request-BZOfsSXW.mjs} +7 -6
  69. package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
  70. package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
  71. package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-dYJhjZrp.mjs} +1035 -1023
  72. package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
  73. package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
  74. package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
  75. package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
  76. package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
  77. package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
  78. package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
  79. package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
  80. package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-BFafIiF6.mjs} +185 -350
  81. package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
  82. package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
  83. package/dist/.setup/session-catalog-events-BMCFMZw-.mjs +139 -0
  84. package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
  85. package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-DwJjnF5k.mjs} +126 -122
  86. package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
  87. package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
  88. package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
  89. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
  90. package/dist/.setup/session-catalog-native-projection-CuaFZuQE.mjs +178 -0
  91. package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
  92. package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
  93. package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
  94. package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
  95. package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-CGfzfP93.mjs} +6 -4
  96. package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
  97. package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-DlmBHYIe.mjs} +9 -22
  98. package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
  99. package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
  100. package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
  101. package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
  102. package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
  103. package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
  104. package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-LlYWBKTJ.mjs} +17 -17
  105. package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
  106. package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-DW9W3gza.mjs} +14 -10
  107. package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-CJCTeFpQ.mjs} +783 -412
  108. package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +153 -0
  109. package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-BLeGj7TQ.mjs} +79 -143
  110. package/dist/.setup/{source-CUzJq5WN.mjs → source-CJis_1EF.mjs} +80 -137
  111. package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-_bAbjedG.mjs} +294 -737
  112. package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-B6pPt21M.mjs} +45 -10
  113. package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
  114. package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-gNPzzpVp.mjs} +46 -7
  115. package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-OWGOiDaV.mjs} +199 -302
  116. package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-GOry0AYh.mjs} +6 -6
  117. package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
  118. package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
  119. package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
  120. package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
  121. package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
  122. package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
  123. package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
  124. package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-gkdRj2yH.mjs} +23 -23
  125. package/dist/.setup/{usage-BML0r-ua.mjs → usage-CApUvLOV.mjs} +4 -4
  126. package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-wSMQkbpV.mjs} +4 -19
  127. package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-UKgeiBUG.mjs} +8 -19
  128. package/dist/api.js +9 -11
  129. package/dist/catalog-page.worker.js +1 -1
  130. package/dist/cli-metadata.js +1 -1
  131. package/dist/doctor-contract-api.js +50 -8
  132. package/dist/harness.js +344 -1
  133. package/dist/index.js +193 -245
  134. package/dist/media-understanding-provider.js +9 -22
  135. package/dist/migration-provider-api.js +1 -1
  136. package/dist/provider-discovery.js +1 -1
  137. package/dist/session-history-worker-runtime.js +3 -3
  138. package/dist/session-history.worker.js +1 -1
  139. package/openclaw.plugin.json +14 -2
  140. package/package.json +7 -6
  141. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
  142. package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
  143. package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
  144. package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
  145. package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
  146. package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
  147. package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
  148. package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
  149. package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
  150. package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
  151. package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
  152. package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
  153. package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
  154. package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
  155. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
  156. package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
  157. package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
  158. package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
@@ -1,21 +1,25 @@
1
- import { m as sessionBindingIdentity } from "./session-binding-record-BGoz8wOK.mjs";
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 { c as codexCatalogHomeIdFromCanonicalPath, m as hasActiveSharedCodexAppServerWork, o as readCodexSessionMeta, p as getSharedCodexAppServerClientState, t as codexCatalogResidentHomeKey } from "./session-catalog-events-Bj6j94E_.mjs";
7
- import { i as withTimeout, o as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./timeout-C910MdAB.mjs";
8
- import { t as CODEX_CONTROL_METHODS } from "./capabilities-CDXOOFdZ.mjs";
9
- import { r as compareCodexCatalogRows } from "./session-catalog-index-order-hcdz07yN.mjs";
10
- import { n as readLegacyCodexHistoryPage, t as readCodexThreadHistoryPage } from "./thread-history-page-DoVpnHim.mjs";
11
- import { i as projectCodexUserItemText } from "./transcript-history-projection-ZZpkFkJ_.mjs";
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-7xgtlo15.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-B2CsSdnV.mjs";
15
+ import { t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BL9B5H0L.mjs";
16
+ import { n as readCodexSessionMeta } from "./session-catalog-provenance-DoAvktcj.mjs";
17
+ import { t as codexCatalogResidentHomeKey } from "./session-catalog-events-BMCFMZw-.mjs";
18
+ import { a as setCodexCatalogConnectionHomeResolver } from "./binding-connection-DTtN1KrX.mjs";
14
19
  import { n as findCodexAppServerSpawnError } from "./spawn-error-CL3n6MAa.mjs";
15
- import { a as setCodexCatalogConnectionHomeResolver } from "./binding-connection-ThoatDcb.mjs";
16
20
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
17
21
  import { randomUUID } from "node:crypto";
18
- import { embeddedAgentLog, resolveDefaultAgentDir } from "openclaw/plugin-sdk/agent-harness-registration";
22
+ import { resolveDefaultAgentDir } from "openclaw/plugin-sdk/agent-harness-registration";
19
23
  import { listAgentIds, resolveAgentDir, resolveDefaultAgentId, resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
20
24
  import { z } from "zod";
21
25
  import path from "node:path";
@@ -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 diagnostics = currentCodexCatalogListDiagnostics();
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
- if (diagnostics && !diagnostics.closed) diagnostics.fields.controlWaitSumMs = (diagnostics.fields.controlWaitSumMs ?? 0) + performance.now() - started;
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-BI6UTDZT.mjs");
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 diagnostics = currentCodexCatalogListDiagnostics();
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
- if (diagnostics && !diagnostics.closed) diagnostics.fields.adoptionSumMs = (diagnostics.fields.adoptionSumMs ?? 0) + performance.now() - started;
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 diagnostics = currentCodexCatalogListDiagnostics();
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
- if (diagnostics && !diagnostics.closed) diagnostics.fields.exclusionMarkSumMs = (diagnostics.fields.exclusionMarkSumMs ?? 0) + performance.now() - started;
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-ITddWx_X.mjs");
1139
- const { compareNodeLabels, listPairedNode, nodeLabel } = await import("./session-catalog-node-continue-6g6qi4A9.mjs");
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 (await Promise.all(pendingHosts)).filter((host) => host !== void 0);
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(items, limit) {
1356
- const projected = items.map(toGenericTranscriptItem);
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: (entries, limit) => projectTranscriptPage(entries.map(({ item }) => item), limit),
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
- const thread = await control.requireEligibleThread(request.threadId);
1374
- return readCodexThreadHistoryPage(control, thread, request, {
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
- command: CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND,
1440
- cap: CODEX_APP_SERVER_THREADS_CAPABILITY,
1441
- dangerous: false,
1442
- hasActiveWork: controlFactory.hasActiveWork,
1443
- onDisconnect: controlFactory.disconnect,
1444
- handle: async (paramsJSON) => {
1445
- const request = await bindRequest(paramsJSON);
1446
- const action = readNodeTranscriptParams(request.params);
1447
- try {
1448
- await request.control.requireEligibleThread(action.threadId);
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: readBoundedLimit(value.limit, "limit", 20, 50),
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 = readBoundedLimit(params.limit, "limit", 20, 50);
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-6g6qi4A9.mjs");
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 = countUserMessages(newest);
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-DowriLid.mjs").then((n) => n.a);
1717
- const { CODEX_CATALOG_MAX_ROWS } = await import("./session-catalog-native-projection-DowriLid.mjs").then((n) => n.G);
1564
+ const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./session-catalog-native-projection-CuaFZuQE.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" ? {
@@ -2121,7 +1968,6 @@ function createCodexSessionCatalogControl(params) {
2121
1968
  const residentRequests = /* @__PURE__ */ new Set();
2122
1969
  let generation = params.getRuntimeConfig();
2123
1970
  let residentEpoch = 0;
2124
- let starting = 0;
2125
1971
  let closed = false;
2126
1972
  let runBackground = (run) => run();
2127
1973
  let retiring;
@@ -2151,7 +1997,7 @@ function createCodexSessionCatalogControl(params) {
2151
1997
  retireIndexes();
2152
1998
  }
2153
1999
  const epoch = residentEpoch;
2154
- const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig: getPluginConfig() });
2000
+ const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig: params.getPluginConfig() });
2155
2001
  const requestOptions = resolveRequestOptions(runtime.start, agentId, source);
2156
2002
  const key = source?.sourceHomeId ?? agentId ?? "";
2157
2003
  let home = directHomes.get(key);
@@ -2168,7 +2014,7 @@ function createCodexSessionCatalogControl(params) {
2168
2014
  if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
2169
2015
  let index = indexes.get(homeId);
2170
2016
  if (!index) {
2171
- const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./session-catalog-index-B9_VQIUz.mjs"), import("./session-catalog-projection-zK_PUsiE.mjs")]);
2017
+ const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./session-catalog-index-DwJjnF5k.mjs"), import("./session-catalog-projection-CGfzfP93.mjs")]);
2172
2018
  source?.assertCurrent();
2173
2019
  if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
2174
2020
  index = indexes.get(homeId);
@@ -2272,28 +2118,31 @@ function createCodexSessionCatalogControl(params) {
2272
2118
  config: void 0,
2273
2119
  startOptions: structuredClone(resolvedStartOptions)
2274
2120
  };
2275
- let byAgent = requestOptionsByConfig.get(runtimeConfig);
2121
+ let snapshot = requestOptionsByConfig.get(runtimeConfig);
2276
2122
  const cacheKey = `${agentId ?? ""}\0${source?.sourceHomeId ?? ""}`;
2277
- const cached = byAgent?.get(cacheKey);
2123
+ const cached = snapshot?.byAgent.get(cacheKey);
2278
2124
  if (cached) return cached;
2125
+ if (!snapshot) {
2126
+ snapshot = {
2127
+ config: structuredClone(runtimeConfig),
2128
+ byAgent: /* @__PURE__ */ new Map()
2129
+ };
2130
+ requestOptionsByConfig.set(runtimeConfig, snapshot);
2131
+ }
2279
2132
  const resolved = {
2280
2133
  agentDir,
2281
- config: structuredClone(runtimeConfig),
2134
+ config: snapshot.config,
2282
2135
  startOptions: structuredClone(resolvedStartOptions)
2283
2136
  };
2284
- if (!byAgent) {
2285
- byAgent = /* @__PURE__ */ new Map();
2286
- requestOptionsByConfig.set(runtimeConfig, byAgent);
2287
- }
2288
- byAgent.set(cacheKey, resolved);
2137
+ snapshot.byAgent.set(cacheKey, resolved);
2289
2138
  return resolved;
2290
2139
  };
2291
2140
  const createRequestSnapshot = (agentId, source, catalogPreview, catalogPreviewCache, catalogRows) => {
2292
- const pluginConfig = getPluginConfig();
2141
+ const pluginConfig = params.getPluginConfig();
2293
2142
  const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
2294
2143
  const requestOptions = resolveRequestOptions(runtime.start, agentId, source);
2295
2144
  return createCodexCatalogRequestSnapshot(runtime.requestTimeoutMs, async (method, requestParams, timeoutMs, assertCurrent, observation) => {
2296
- const { codexControlRequest } = await import("./command-rpc-DixIj3HW.mjs").then((n) => n.n);
2145
+ const { codexControlRequest } = await import("./command-rpc-skzRq4wD.mjs").then((n) => n.n);
2297
2146
  return await codexControlRequest(pluginConfig, method, requestParams, {
2298
2147
  ...requestOptions,
2299
2148
  authProfileId: null,
@@ -2311,13 +2160,13 @@ function createCodexSessionCatalogControl(params) {
2311
2160
  const forRequest = (agentId, source) => {
2312
2161
  source?.assertCurrent();
2313
2162
  const withPinnedConnection = async (run) => {
2314
- const pluginConfig = getPluginConfig();
2163
+ const pluginConfig = params.getPluginConfig();
2315
2164
  const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
2316
2165
  const { agentDir, config: runtimeConfig, startOptions } = resolveRequestOptions(runtime.start, agentId, source);
2317
2166
  let catalogIndex;
2318
- const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./shared-client-DA4VR4Eb.mjs").then((n) => n.y);
2319
- const { resolveCodexAppServerClientInstanceId } = await import("./client-Cs08OXVQ.mjs").then((n) => n.n);
2320
- const { requestCodexAppServerClientJson } = await import("./request-D2L0zMrq.mjs").then((n) => n.a);
2167
+ const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./shared-client-CJCTeFpQ.mjs").then((n) => n.v);
2168
+ const { resolveCodexAppServerClientInstanceId } = await import("./client-qyUBJlGZ.mjs").then((n) => n.n);
2169
+ const { requestCodexAppServerClientJson } = await import("./request-BZOfsSXW.mjs").then((n) => n.a);
2321
2170
  const client = await getLeasedSharedCodexAppServerClient({
2322
2171
  agentDir,
2323
2172
  config: runtimeConfig,
@@ -2380,32 +2229,19 @@ function createCodexSessionCatalogControl(params) {
2380
2229
  return source ? forRequest(agentId, source) : void 0;
2381
2230
  };
2382
2231
  return {
2383
- hasActiveWork: () => starting > 0 || residentRequests.size > 0 || retiring !== void 0 || hasActiveSharedCodexAppServerWork() || [...indexes.values()].some((index) => index.hasActiveWork()),
2232
+ hasActiveWork: () => residentRequests.size > 0 || retiring !== void 0 || hasActiveSharedCodexAppServerWork() || [...indexes.values()].some((index) => index.hasActiveWork()),
2384
2233
  async disconnect() {
2385
2234
  await retireIndexes();
2386
2235
  await Promise.allSettled(residentRequests);
2387
2236
  const clients = getSharedCodexAppServerClientState();
2388
2237
  if (clients.liveClients.size > 0 || clients.startup.pending.size > 0) {
2389
- const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-DA4VR4Eb.mjs").then((n) => n.y);
2238
+ const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-CJCTeFpQ.mjs").then((n) => n.v);
2390
2239
  await clearSharedCodexAppServerClientAndWait();
2391
2240
  }
2392
2241
  },
2393
2242
  async start() {
2394
- const epoch = residentEpoch;
2395
- starting++;
2396
- try {
2397
- const serviceScope = AsyncLocalStorage.snapshot();
2398
- runBackground = (run) => serviceScope(run);
2399
- for (const agentId of listAgentIds(params.getRuntimeConfig() ?? params.config ?? {})) for (const source of await homeResolver.forAgent(agentId)) {
2400
- if (closed || residentEpoch !== epoch) return;
2401
- if (source.usesProcessHomeFallback) continue;
2402
- forRequest(agentId, source).initialize().catch((error) => {
2403
- if (!findCodexAppServerSpawnError(error)) embeddedAgentLog.warn("Codex catalog hydration failed", { error });
2404
- });
2405
- }
2406
- } finally {
2407
- starting--;
2408
- }
2243
+ const serviceScope = AsyncLocalStorage.snapshot();
2244
+ runBackground = (run) => serviceScope(run);
2409
2245
  },
2410
2246
  async stop() {
2411
2247
  closed = true;
@@ -2548,8 +2384,7 @@ function withCatalogListScope(initialize) {
2548
2384
  }
2549
2385
  function catalogHostMapper(localTerminalAvailable, localHomes) {
2550
2386
  return (host) => {
2551
- const diagnostics = currentCodexCatalogListDiagnostics();
2552
- const started = diagnostics ? performance.now() : 0;
2387
+ const finishTiming = startCodexCatalogListTiming("mappingMs");
2553
2388
  try {
2554
2389
  const localSourceAvailable = localTerminalAvailable && localHomes.some((home) => home.hostId === host.hostId && home.appServer.start.transport === "stdio");
2555
2390
  return {
@@ -2557,7 +2392,7 @@ function catalogHostMapper(localTerminalAvailable, localHomes) {
2557
2392
  canStartTerminal: host.kind === "gateway" ? localSourceAvailable && host.hostId === "gateway:local" : host.canStartTerminal === true
2558
2393
  };
2559
2394
  } finally {
2560
- if (diagnostics && !diagnostics.closed) diagnostics.fields.mappingMs = (diagnostics.fields.mappingMs ?? 0) + performance.now() - started;
2395
+ finishTiming();
2561
2396
  }
2562
2397
  };
2563
2398
  }
@@ -2749,16 +2584,16 @@ const codexSessionCatalogRuntime = {
2749
2584
  archiveLocal: archiveLocalCodexSession
2750
2585
  };
2751
2586
  async function continueLocalCodexSession(...args) {
2752
- const { continueLocalCodexSession: run } = await import("./session-catalog-adoption-BI6UTDZT.mjs");
2587
+ const { continueLocalCodexSession: run } = await import("./session-catalog-adoption-BU_pHWG7.mjs");
2753
2588
  return run(...args);
2754
2589
  }
2755
2590
  async function archiveLocalCodexSession(...args) {
2756
- const { archiveLocalCodexSession: run } = await import("./session-catalog-archive-lHBqzhaO.mjs");
2591
+ const { archiveLocalCodexSession: run } = await import("./session-catalog-archive-spHfihri.mjs");
2757
2592
  return run(...args);
2758
2593
  }
2759
2594
  async function continueNodeCodexSession(...args) {
2760
- const { continueNodeCodexSession: run } = await import("./session-catalog-node-continue-6g6qi4A9.mjs");
2595
+ const { continueNodeCodexSession: run } = await import("./session-catalog-node-continue-DjKXHBbi.mjs");
2761
2596
  return run(...args);
2762
2597
  }
2763
2598
  //#endregion
2764
- export { withCodexCatalogListRequest as a, createCodexSessionCatalogNodeHostCommands as i, createCodexSessionCatalogNodeInvokePolicies as n, lookupNodeCodexCatalogRecord as o, createCodexSessionCatalogControl as r, CodexCatalogAvailability as s, codexSessionCatalogRuntime as t };
2599
+ export { createCodexSessionCatalogNodeHostCommands as i, createCodexSessionCatalogNodeInvokePolicies as n, createCodexSessionCatalogControl as r, codexSessionCatalogRuntime as t };