@openclaw/codex 2026.10.5-beta.4 → 2026.10.10-beta.1

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 (156) hide show
  1. package/README.md +10 -3
  2. package/dist/.setup/{account-usage-runtime-CoVpNIlD.mjs → account-usage-runtime-DDCDkvtl.mjs} +15 -9
  3. package/dist/.setup/{app-server-policy-D_zv8J7V.mjs → app-server-policy-Cog6mm2i.mjs} +1 -1
  4. package/dist/.setup/{apply-BXDMd05l.mjs → apply-BVSXYkTV.mjs} +11 -11
  5. package/dist/.setup/{attempt-client-cleanup-zNuNTKVr.mjs → attempt-client-cleanup-6OcbMH46.mjs} +14 -8
  6. package/dist/.setup/attempt-terminal-sZutF0WY.mjs +1 -0
  7. package/dist/.setup/{attempt-workspace-context-CcwP3DA3.mjs → attempt-workspace-context-GYPLawX6.mjs} +2 -2
  8. package/dist/.setup/{auth-binding-BaxlhaNx.mjs → auth-binding-830RLAJW.mjs} +2 -2
  9. package/dist/.setup/{auth-cache-key-f8ODJ_OX.mjs → auth-cache-key-CVcYw8HD.mjs} +92 -80
  10. package/dist/.setup/{auth-profile-CgHQ8Vot.mjs → auth-profile-auwzSwwy.mjs} +14 -8
  11. package/dist/.setup/{auth-profile-health-oHizqgye.mjs → auth-profile-health-BVPZU9I8.mjs} +15 -8
  12. package/dist/.setup/{auth-profile-selection-hr8ocLtz.mjs → auth-profile-selection-Bp5PDk3W.mjs} +24 -7
  13. package/dist/.setup/{binding-connection-B7HAAZSI.mjs → binding-connection-GTgUj9pi.mjs} +2 -2
  14. package/dist/.setup/{binding-connection.runtime-DAXn7iFl.mjs → binding-connection.runtime-RcWR3vQu.mjs} +4 -3
  15. package/dist/.setup/{bounded-turn-isolation-BfDAo-qZ.mjs → bounded-turn-isolation-D8CDrAVX.mjs} +3 -3
  16. package/dist/.setup/{bounded-turn-DfIJtRlv.mjs → bounded-turn-mN_ekXYW.mjs} +18 -22
  17. package/dist/.setup/{build-state-Ds14X10-.mjs → build-state-VcujMRqP.mjs} +1 -1
  18. package/dist/.setup/{capabilities-DbOzOglY.mjs → capabilities-DAS-JX1z.mjs} +1 -1
  19. package/dist/.setup/{client-D93nbdB8.mjs → client-BS8X7HmG.mjs} +47 -317
  20. package/dist/.setup/{client-catalog-response-CuVLp4I0.mjs → client-catalog-response-jM38o5w1.mjs} +2 -2
  21. package/dist/.setup/client-initialize-CjgZcX61.mjs +165 -0
  22. package/dist/.setup/{command-dispatch-DxdH5a9-.mjs → command-dispatch-DzXbHqCn.mjs} +3 -3
  23. package/dist/.setup/{command-formatters-xW9KpoSZ.mjs → command-formatters-B_7-QZ1c.mjs} +2 -2
  24. package/dist/.setup/{command-handlers-fiYvYYq0.mjs → command-handlers-tfb5Uq-O.mjs} +539 -406
  25. package/dist/.setup/command-rpc-SXqLQukR.mjs +296 -0
  26. package/dist/.setup/compact-M-JxLcbZ.mjs +823 -0
  27. package/dist/.setup/{computer-use-DL2v3Kxq.mjs → computer-use-FqQ-Flbl.mjs} +21 -68
  28. package/dist/.setup/{config-C1YVVLEA.mjs → config-BfrAlTMT.mjs} +3 -3
  29. package/dist/.setup/{config-options-DDzeNQ8m.mjs → config-options-DMFZkd3X.mjs} +1 -1
  30. package/dist/.setup/{config-runtime-DWzK-k0n.mjs → config-runtime-BZRizyuG.mjs} +2 -2
  31. package/dist/.setup/{context-engine-projection-ps-yn_ci.mjs → context-engine-projection-PIeLSnR-.mjs} +16 -30
  32. package/dist/.setup/{conversation-binding-BieJZRRV.mjs → conversation-binding-C7MZy-Cx.mjs} +228 -116
  33. package/dist/.setup/{conversation-binding-data-UgLuTSQT.mjs → conversation-binding-data-khgW0n-o.mjs} +4 -2
  34. package/dist/.setup/{conversation-control-GXM3unE4.mjs → conversation-control-B2EpVZEb.mjs} +53 -23
  35. package/dist/.setup/{cyber-failover-D4dgNfFf.mjs → cyber-failover-CqEZoQsj.mjs} +1 -1
  36. package/dist/.setup/{cyber-failover-notice-ljgGGL0s.mjs → cyber-failover-notice-poL3Advd.mjs} +1 -1
  37. package/dist/.setup/{doctor-start-options-JjTAl-q_.mjs → doctor-start-options-8uIBXIzR.mjs} +8 -5
  38. package/dist/.setup/{dynamic-tool-build-DcaPmBlE.mjs → dynamic-tool-build-BjFAIG-f.mjs} +208 -218
  39. package/dist/.setup/{dynamic-tools-CnQFnNKH.mjs → dynamic-tools-XqWsVjcC.mjs} +344 -118
  40. package/dist/.setup/{effective-mcp-catalog-B5HKFZNK.mjs → effective-mcp-catalog-C3ta5hHc.mjs} +11 -9
  41. package/dist/.setup/{ephemeral-turn-De3qb8EQ.mjs → ephemeral-turn-1ZF17fUR.mjs} +5 -4
  42. package/dist/.setup/{event-projector-assistant-message-CLMKN4x-.mjs → event-projector-assistant-message-ChOAY7rW.mjs} +16 -11
  43. package/dist/.setup/{event-projector-usage-BpKfdoTm.mjs → event-projector-usage-CBY0Hkga.mjs} +2 -2
  44. package/dist/.setup/{event-projector-values-CLvG1Hil.mjs → event-projector-values-yf4us9Pf.mjs} +1 -1
  45. package/dist/.setup/experimental-features-uGnVDtp-.mjs +19 -0
  46. package/dist/.setup/inference-context-mv_dBpAL.mjs +209 -0
  47. package/dist/.setup/{inference-dispatch-CO6tTs4q.mjs → inference-dispatch-C2zVSnrr.mjs} +2 -2
  48. package/dist/.setup/{inference-metadata-DCvcG_N_.mjs → inference-metadata-CYFWLHVk.mjs} +3 -1
  49. package/dist/.setup/{inference-proxy-BDWV0djM.mjs → inference-proxy-yd3hr2dr.mjs} +8 -8
  50. package/dist/.setup/installed-probe-lVC1X5ve.mjs +185 -0
  51. package/dist/.setup/{isolated-completion-BPJdvk5F.mjs → isolated-completion-P-r8NRE4.mjs} +7 -7
  52. package/dist/.setup/managed-binary-DbKvGXKl.mjs +395 -0
  53. package/dist/.setup/{mcp-app-session-preparation-Dz2GOwyE.mjs → mcp-app-session-preparation-fnsnCovu.mjs} +18 -14
  54. package/dist/.setup/{model-catalog-ZNwltCKl.mjs → model-catalog-Y_esgRPY.mjs} +28 -17
  55. package/dist/.setup/{models-BHpbAuz8.mjs → models-BWLEUo2E.mjs} +3 -3
  56. package/dist/.setup/{native-auth-esN5MdIv.mjs → native-auth-DpZIaY8N.mjs} +7 -4
  57. package/dist/.setup/native-execution-policy-D09tLP-u.mjs +152 -0
  58. package/dist/.setup/{native-hook-relay-wq7jrNLk.mjs → native-hook-relay-C7aaLJaP.mjs} +45 -10
  59. package/dist/.setup/{native-mcp-app-DX3nyTtc.mjs → native-mcp-app-CsWj-v_x.mjs} +5 -5
  60. package/dist/.setup/{native-skill-isolation-DSBeF-Yy.mjs → native-skill-isolation-CMimsKYy.mjs} +7 -7
  61. package/dist/.setup/{native-subagent-monitor-DOLEIf9r.mjs → native-subagent-monitor-CFE7b4oC.mjs} +485 -239
  62. package/dist/.setup/{native-subagent-pending-assignments-DmVhedNs.mjs → native-subagent-pending-assignments-CTinVtjo.mjs} +1 -1
  63. package/dist/.setup/{native-task-assignments-DimsQ9Qa.mjs → native-task-assignments-YJopbaVO.mjs} +9 -5
  64. package/dist/.setup/{node-cli-sessions-CzKg2nGq.mjs → node-cli-sessions-BuJnBnEq.mjs} +7 -4
  65. package/dist/.setup/{node-exec-server.runtime-BWkULhBM.mjs → node-exec-server.runtime-CP7RC1Nd.mjs} +3 -3
  66. package/dist/.setup/{plan-41-YOBMq.mjs → plan-B4cHgqNv.mjs} +7 -20
  67. package/dist/.setup/{plugin-activation-D7WkJMvU.mjs → plugin-activation-CXPWe-hl.mjs} +4 -4
  68. package/dist/.setup/{plugin-app-cache-key-Bg9DbDI6.mjs → plugin-app-cache-key-DRb-niJc.mjs} +17 -55
  69. package/dist/.setup/{plugin-approval-roundtrip-CD88q3yx.mjs → plugin-approval-roundtrip-DIZHLbAM.mjs} +1 -1
  70. package/dist/.setup/{plugin-inventory-CYgdo14P.mjs → plugin-inventory-DE9wcaeH.mjs} +2 -2
  71. package/dist/.setup/{plugin-metadata-cache-Bi8TAPwX.mjs → plugin-metadata-cache-BqC-a6Fb.mjs} +2 -15
  72. package/dist/.setup/{project-doc-thread-config-BVcvnps8.mjs → project-doc-thread-config-B0UI3f1D.mjs} +6 -6
  73. package/dist/.setup/protocol-CaPAVwe9.mjs +12 -0
  74. package/dist/.setup/{provider-capabilities-Dn2WwH4P.mjs → provider-capabilities-DjcKunHS.mjs} +1 -1
  75. package/dist/.setup/{provider-LWKll6dV.mjs → provider-wj_LFJH3.mjs} +4 -4
  76. package/dist/.setup/{rate-limits-CI8pTPqL.mjs → rate-limits-BpfURnuy.mjs} +1 -1
  77. package/dist/.setup/{request-Bo0kKABI.mjs → request-ePeNJrOd.mjs} +132 -136
  78. package/dist/.setup/{responses-oauth-twnuTaAa.mjs → responses-oauth-CCV7aVYF.mjs} +6 -6
  79. package/dist/.setup/{rpc-error-C98SHchT.mjs → rpc-error-DemqqaxE.mjs} +7 -3
  80. package/dist/.setup/{run-attempt-ClU8MxhZ.mjs → run-attempt-BcWArowv.mjs} +595 -426
  81. package/dist/.setup/{run-attempt-lifecycle-KN4oh-7O.mjs → run-attempt-lifecycle-DN-ATDp9.mjs} +1 -1
  82. package/dist/.setup/{runtime-artifact-C13pR7tD.mjs → runtime-artifact-CmLWeyJB.mjs} +3 -3
  83. package/dist/.setup/{runtime-artifact-connection-jS5DeCok.mjs → runtime-artifact-connection-DpWlZ02e.mjs} +3 -3
  84. package/dist/.setup/{sandbox-guard-DIImwCy1.mjs → sandbox-guard-DneAfNye.mjs} +70 -30
  85. package/dist/.setup/{session-binding-JEHNMPsr.mjs → session-binding-BgsWcbdY.mjs} +25 -23
  86. package/dist/.setup/{session-binding-record-DU_0biMD.mjs → session-binding-record-C_THntMe.mjs} +27 -12
  87. package/dist/.setup/{session-binding-record-codec-BpH8u_G9.mjs → session-binding-record-codec-DvmOI7g_.mjs} +1 -0
  88. package/dist/.setup/{session-binding-sidecars-DD-enC8w.mjs → session-binding-sidecars-BNSS6WL4.mjs} +55 -63
  89. package/dist/.setup/session-cancellation-DLBSJO5n.mjs +43 -0
  90. package/dist/.setup/{session-catalog-adoption-Ca3OYGYM.mjs → session-catalog-adoption-ppsLlVLB.mjs} +24 -38
  91. package/dist/.setup/{session-catalog-archive-Bv6gV7x9.mjs → session-catalog-archive-CqLRHJ6z.mjs} +11 -13
  92. package/dist/.setup/{session-catalog-events-kR2Ot6nX.mjs → session-catalog-events-DK0opVp3.mjs} +5 -5
  93. package/dist/.setup/{session-catalog-index-CrnfVEnT.mjs → session-catalog-index-BfzfdtH7.mjs} +96 -271
  94. package/dist/.setup/{session-catalog-index-order-CTfoefow.mjs → session-catalog-index-order-0Zqng2u8.mjs} +1 -1
  95. package/dist/.setup/{session-catalog-limits-BynIoOYm.mjs → session-catalog-limits-Dc6E0BZz.mjs} +1 -1
  96. package/dist/.setup/{session-catalog-list-request-D4MYNgDB.mjs → session-catalog-list-request-CAjoWjaH.mjs} +3 -4
  97. package/dist/.setup/{session-catalog-native-projection-CWqCU1I_.mjs → session-catalog-native-projection-G3lSDYYG.mjs} +5 -5
  98. package/dist/.setup/{session-catalog-node-adoption-BdP9Zjqo.mjs → session-catalog-node-adoption-e9v8mGgx.mjs} +5 -5
  99. package/dist/.setup/{session-catalog-node-continue-CNJibO4_.mjs → session-catalog-node-continue-H7nrzcUD.mjs} +5 -5
  100. package/dist/.setup/{session-catalog-node-lookup-BH_DBGa9.mjs → session-catalog-node-lookup-BrZfDkA8.mjs} +2 -2
  101. package/dist/.setup/{session-catalog-parsing-DkeoVn60.mjs → session-catalog-parsing-V6jyFg9g.mjs} +2 -2
  102. package/dist/.setup/{session-catalog-projection-BzHiV818.mjs → session-catalog-projection-BjWE414G.mjs} +8 -7
  103. package/dist/.setup/{session-catalog-provenance-CmsOE5mh.mjs → session-catalog-provenance-Dg9s12z-.mjs} +50 -30
  104. package/dist/.setup/{session-catalog-source-DGuRdGvM.mjs → session-catalog-source-DqyuNxCe.mjs} +2 -6
  105. package/dist/.setup/{session-cli-GwU0izn-.mjs → session-cli-CBGKiqdv.mjs} +1 -1
  106. package/dist/.setup/{session-history-BO6i_pfk.mjs → session-history-7W0cgTXF.mjs} +11 -9
  107. package/dist/.setup/{session-history-import-CaO8s6ta.mjs → session-history-import-BwPKwcNi.mjs} +4 -4
  108. package/dist/.setup/{session-initialization-Bi_2DKhc.mjs → session-initialization-Dn3vveGv.mjs} +2 -2
  109. package/dist/.setup/{session-retirement-B3U5hpGJ.mjs → session-retirement-Ci_JvOfH.mjs} +8 -8
  110. package/dist/.setup/{session-history.worker-DJQfek5p.mjs → settled-turn-evidence--tRW6fSm.mjs} +2 -18
  111. package/dist/.setup/{settled-turn-finalizer-CYCVpTv2.mjs → settled-turn-finalizer-D3-KXsbP.mjs} +8 -8
  112. package/dist/.setup/{shared-client-BCx1wbyA.mjs → shared-client-CE_uY0A1.mjs} +380 -557
  113. package/dist/.setup/side-question-OM18H9WJ.mjs +998 -0
  114. package/dist/.setup/{source-DipMO9hL.mjs → source-uGKgKWm8.mjs} +5 -5
  115. package/dist/.setup/{thread-archive-guard-LKdwQKyr.mjs → thread-archive-guard-BWjSsA92.mjs} +1 -1
  116. package/dist/.setup/{thread-lifecycle-run-C_aYiYqk.mjs → thread-lifecycle-run-mLueY6pH.mjs} +172 -75
  117. package/dist/.setup/{thread-model-selection-DcVebr8N.mjs → thread-model-selection-DxposL4X.mjs} +9 -9
  118. package/dist/.setup/{thread-ownership-BoUd0i6L.mjs → thread-ownership-t6Y9fLQS.mjs} +7 -7
  119. package/dist/.setup/{thread-policy-B3wBRNph.mjs → thread-policy-Cy301Or8.mjs} +6 -6
  120. package/dist/.setup/{thread-requests-BgzJwJtS.mjs → thread-requests-BjawdIVV.mjs} +14 -14
  121. package/dist/.setup/{thread-resume-D-3bsr1j.mjs → thread-resume-BUbsUfgF.mjs} +6 -6
  122. package/dist/.setup/{transcript-history-projection-DfKcoZCB.mjs → transcript-history-projection-i-FVpyha.mjs} +1 -1
  123. package/dist/.setup/{transcript-mirror-Bee2o6jj.mjs → transcript-mirror-CEQJZlF3.mjs} +6 -9
  124. package/dist/.setup/{transport-stdio-CRWTkKOn.mjs → transport-stdio-Bq160Dhv.mjs} +63 -64
  125. package/dist/.setup/{transport-websocket-DIyPfkHo.mjs → transport-websocket-0YqiI_MH.mjs} +1 -1
  126. package/dist/.setup/{turn-router-DBVMToGo.mjs → turn-router-Dbw17k3K.mjs} +2 -2
  127. package/dist/.setup/{upstream-session-fork-p5fwKi7w.mjs → upstream-session-fork-_LYkh0nZ.mjs} +46 -219
  128. package/dist/.setup/{usage-limit-error-BQX8RHAd.mjs → usage-limit-error-DcOSH3J4.mjs} +4 -4
  129. package/dist/.setup/{usage-C2Kq7oej.mjs → usage-w_93wnnR.mjs} +4 -4
  130. package/dist/.setup/{web-search-item-CvokaZOo.mjs → web-search-item-DHVuNSqk.mjs} +1 -1
  131. package/dist/.setup/{web-search-provider.runtime-D89djc7e.mjs → web-search-provider.runtime-DMHxve5v.mjs} +3 -3
  132. package/dist/.setup/{workspace-write-sandbox-probe-BDWO2Qkh.mjs → workspace-write-sandbox-probe-DJxOXcF3.mjs} +2 -2
  133. package/dist/api.js +7 -28
  134. package/dist/catalog-page.worker.js +1 -1
  135. package/dist/cli-metadata.js +1 -1
  136. package/dist/client-version-api.js +25 -0
  137. package/dist/doctor-contract-api.js +5 -5
  138. package/dist/harness.js +59 -36
  139. package/dist/index.js +259 -295
  140. package/dist/media-understanding-provider.js +2 -2
  141. package/dist/migration-provider-api.js +1 -2
  142. package/dist/native-session-binding-api.js +1 -2
  143. package/dist/provider-discovery.js +1 -1
  144. package/dist/session-history-worker-entrypoint.js +12 -0
  145. package/dist/session-history-worker-runtime.js +7 -18
  146. package/dist/session-history.worker.js +18 -2
  147. package/openclaw.plugin.json +1 -1
  148. package/package.json +6 -6
  149. package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +0 -2
  150. package/dist/.setup/command-rpc-HIvsy3wS.mjs +0 -247
  151. package/dist/.setup/compact-ClZ7Ar7L.mjs +0 -808
  152. package/dist/.setup/inference-context-DNlGwzwy.mjs +0 -91
  153. package/dist/.setup/managed-binary-BtIjV7yN.mjs +0 -175
  154. package/dist/.setup/native-execution-policy-MXEe7PB3.mjs +0 -75
  155. package/dist/.setup/protocol-CANUwXJ3.mjs +0 -17
  156. package/dist/.setup/side-question-Bz2UQW0l.mjs +0 -826
package/dist/index.js CHANGED
@@ -1,44 +1,44 @@
1
1
  import { registerCodexCliMetadata } from "./cli-metadata.js";
2
- 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, j as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, 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 "./.setup/session-catalog-parsing-DkeoVn60.mjs";
3
- import { i as isJsonObject, n as assertCodexThreadForkParams } from "./.setup/protocol-CANUwXJ3.mjs";
4
- import { d as readCurrentCodexNativeSubagentSubmissions, f as readCurrentNativePendingAssignments, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, u as readCurrentCodexAppServerBindings } from "./.setup/session-binding-record-DU_0biMD.mjs";
5
- import { n as defineCodexBuildState } from "./.setup/build-state-Ds14X10-.mjs";
2
+ 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, j as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, 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 "./.setup/session-catalog-parsing-V6jyFg9g.mjs";
3
+ import { r as isJsonObject } from "./.setup/protocol-CaPAVwe9.mjs";
4
+ import { d as readCurrentCodexAppServerBindingAsync, f as readCurrentCodexAppServerBindings, g as sessionBindingIdentity, m as readCurrentNativePendingAssignments, n as assertCodexBindingMayBeReplaced, p as readCurrentCodexNativeSubagentSubmissions, u as readCurrentCodexAppServerBinding } from "./.setup/session-binding-record-C_THntMe.mjs";
5
+ import { n as defineCodexBuildState } from "./.setup/build-state-VcujMRqP.mjs";
6
6
  import { createCodexAppServerAgentHarness, createCodexAppServerNativeCompaction } from "./harness.js";
7
7
  import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
8
8
  import codexProviderDiscovery from "./provider-discovery.js";
9
- import { n as createCodexAuthProfileSelection } from "./.setup/auth-profile-selection-hr8ocLtz.mjs";
9
+ import { n as createCodexAuthProfileSelection } from "./.setup/auth-profile-selection-Bp5PDk3W.mjs";
10
10
  import { t as assertCodexAppServerConnectionSecurity } from "./.setup/config-security-clxAZYWX.mjs";
11
11
  import { d as readCodexPluginConfig } from "./.setup/config-parsing-DsWSCPHO.mjs";
12
12
  import { n as resolveCodexAppServerLocalHomeDir, r as resolveCodexAppServerUserHomeDir, t as resolveCodexAppServerHomeDir } from "./.setup/auth-start-options-BPIPeEX8.mjs";
13
- import { r as createCodexAppServerConfig, t as codexAppServerStartOptionsKey } from "./.setup/config-options-DDzeNQ8m.mjs";
14
- import { o as setManagedCodexPluginRoot } from "./.setup/managed-binary-BtIjV7yN.mjs";
15
- import { O as createCodexDesktopGenerationService, T as retireSharedCodexAppServerClientsBeforeDesktopGeneration, m as hasActiveSharedCodexAppServerWork, p as getSharedCodexAppServerClientState, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-f8ODJ_OX.mjs";
13
+ import { r as createCodexAppServerConfig, t as codexAppServerStartOptionsKey } from "./.setup/config-options-DMFZkd3X.mjs";
14
+ import { h as setManagedCodexPluginRoot } from "./.setup/managed-binary-DbKvGXKl.mjs";
15
+ import { O as retireSharedCodexAppServerClientsBeforeDesktopGeneration, h as hasActiveSharedCodexAppServerWork, j as createCodexDesktopGenerationService, m as getSharedCodexAppServerClientState, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-CVcYw8HD.mjs";
16
16
  import { i as CODEX_APP_SERVER_BINDING_NAMESPACE, r as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./.setup/session-binding-meta-Lkm5Lpf4.mjs";
17
- import { c as createCodexAppServerProcessReaperService } from "./.setup/transport-stdio-CRWTkKOn.mjs";
18
- import { n as codexNativeProfileRecoveryService } from "./.setup/auth-profile-health-oHizqgye.mjs";
17
+ import { c as createCodexAppServerProcessReaperService } from "./.setup/transport-stdio-Bq160Dhv.mjs";
18
+ import { n as codexNativeProfileRecoveryService } from "./.setup/auth-profile-health-BVPZU9I8.mjs";
19
19
  import { n as withCodexConversationThreadActivity } from "./.setup/thread-ownership-queue-CeyYScUC.mjs";
20
20
  import { a as canMutateCodexHost, r as CODEX_NATIVE_EXECUTION_AUTH_ERROR } from "./.setup/command-authorization-AikPDtcc.mjs";
21
- import { o as formatCodexDisplayText } from "./.setup/command-formatters-xW9KpoSZ.mjs";
22
- import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir } from "./.setup/conversation-binding-data-UgLuTSQT.mjs";
23
- import { t as buildCodexMigrationProvider } from "./.setup/provider-LWKll6dV.mjs";
24
- import { r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./.setup/rpc-error-C98SHchT.mjs";
25
- import { t as CODEX_CONTROL_METHODS } from "./.setup/capabilities-DbOzOglY.mjs";
21
+ import { o as formatCodexDisplayText } from "./.setup/command-formatters-B_7-QZ1c.mjs";
22
+ import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir } from "./.setup/conversation-binding-data-khgW0n-o.mjs";
23
+ import { t as buildCodexMigrationProvider } from "./.setup/provider-wj_LFJH3.mjs";
24
+ import { r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./.setup/rpc-error-DemqqaxE.mjs";
25
+ import { t as CODEX_CONTROL_METHODS } from "./.setup/capabilities-DAS-JX1z.mjs";
26
26
  import { n as filterCodexMarketplacePlugins, t as discoverCodexMarketplacePlugins } from "./.setup/plugin-marketplace-discovery-BblHM3DU.mjs";
27
- import { t as assertCodexArchiveDescendantsUnowned } from "./.setup/thread-archive-guard-LKdwQKyr.mjs";
28
- import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, s as listCodexCliSessionsOnNode } from "./.setup/node-cli-sessions-CzKg2nGq.mjs";
27
+ import { t as assertCodexArchiveDescendantsUnowned } from "./.setup/thread-archive-guard-BWjSsA92.mjs";
28
+ import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, s as listCodexCliSessionsOnNode } from "./.setup/node-cli-sessions-BuJnBnEq.mjs";
29
29
  import { n as codexCatalogHomeIdFromCanonicalPath } from "./.setup/session-catalog-home-id-vlih0B_g.mjs";
30
- import { t as CODEX_CATALOG_MAX_ROWS } from "./.setup/session-catalog-limits-BynIoOYm.mjs";
31
- import { a as CodexCatalogLoadingError, n as currentCodexCatalogListRequest, o as withCodexCatalogLoadingTimeout, r as withCodexCatalogListRequest, s as CODEX_CATALOG_STATE_NAMESPACE, t as CodexCatalogListRequest } from "./.setup/session-catalog-list-request-D4MYNgDB.mjs";
30
+ import { t as CODEX_CATALOG_MAX_ROWS } from "./.setup/session-catalog-limits-Dc6E0BZz.mjs";
31
+ import { a as CodexCatalogLoadingError, n as currentCodexCatalogListRequest, o as withCodexCatalogLoadingTimeout, r as withCodexCatalogListRequest, s as CODEX_CATALOG_STATE_NAMESPACE, t as CodexCatalogListRequest } from "./.setup/session-catalog-list-request-CAjoWjaH.mjs";
32
32
  import { i as withTimeout$1 } from "./.setup/timeout-D0mEWSGG.mjs";
33
- import { t as lookupNodeCodexCatalogRecord } from "./.setup/session-catalog-node-lookup-BH_DBGa9.mjs";
34
- import { r as projectCodexUserItemText } from "./.setup/transcript-history-projection-DfKcoZCB.mjs";
33
+ import { t as lookupNodeCodexCatalogRecord } from "./.setup/session-catalog-node-lookup-BrZfDkA8.mjs";
34
+ import { r as projectCodexUserItemText } from "./.setup/transcript-history-projection-i-FVpyha.mjs";
35
35
  import { r as codexUpstreamContinueResult } from "./.setup/session-upstream-marker-D15C9NHp.mjs";
36
- import { t as buildCodexAppServerConnectionFingerprint } from "./.setup/plugin-app-cache-key-Bg9DbDI6.mjs";
37
- import { n as readCodexSessionMeta } from "./.setup/session-catalog-provenance-CmsOE5mh.mjs";
38
- import { t as codexCatalogResidentHomeKey } from "./.setup/session-catalog-events-kR2Ot6nX.mjs";
39
- import { a as setCodexCatalogConnectionHomeResolver } from "./.setup/binding-connection-B7HAAZSI.mjs";
36
+ import { t as buildCodexAppServerConnectionFingerprint } from "./.setup/plugin-app-cache-key-DRb-niJc.mjs";
37
+ import { n as readCodexSessionMeta } from "./.setup/session-catalog-provenance-Dg9s12z-.mjs";
38
+ import { t as codexCatalogResidentHomeKey } from "./.setup/session-catalog-events-DK0opVp3.mjs";
39
+ import { a as setCodexCatalogConnectionHomeResolver } from "./.setup/binding-connection-GTgUj9pi.mjs";
40
40
  import { n as findCodexAppServerSpawnError } from "./.setup/spawn-error-CL3n6MAa.mjs";
41
- import { r as requestCodexAppServerJson } from "./.setup/request-Bo0kKABI.mjs";
41
+ import { r as requestCodexAppServerJson } from "./.setup/request-ePeNJrOd.mjs";
42
42
  import { t as createCodexWebSearchProviderBase } from "./.setup/web-search-provider.shared-BrZmlqyR.mjs";
43
43
  import { normalizePluginsConfig, resolveEffectiveEnableState, resolveLivePluginConfigObject, resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
44
44
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
@@ -52,6 +52,8 @@ import path from "node:path";
52
52
  import fs from "node:fs/promises";
53
53
  import { coerceErrorMessage, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
54
54
  import { canonicalPathFromExistingAncestor } from "openclaw/plugin-sdk/file-access-runtime";
55
+ import { decodeNodePtyResumeParams, decodeNodePtyStartParams, resolveNodeHostExecutable, runNodePtyCommand } from "openclaw/plugin-sdk/node-host";
56
+ import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
55
57
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
56
58
  import { scheduler } from "node:timers/promises";
57
59
  import { isIncognitoSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
@@ -64,13 +66,11 @@ import { isMainThread, threadId } from "node:worker_threads";
64
66
  import { areDiagnosticsEnabledForProcess, createSubsystemLogger } from "openclaw/plugin-sdk/diagnostic-runtime";
65
67
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
66
68
  import { publishSessionCatalogHost, sessionCatalogPaging } from "openclaw/plugin-sdk/session-catalog-paging";
67
- import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
68
- import { decodeNodePtyResumeParams, decodeNodePtyStartParams, resolveNodeHostExecutable, runNodePtyCommand } from "openclaw/plugin-sdk/node-host";
69
69
  import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
70
70
  //#region extensions/codex/src/account-usage.ts
71
71
  function registerCodexAccountUsage(api) {
72
72
  api.registerGatewayMethod("codex.accountUsage", async (options) => {
73
- const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-CoVpNIlD.mjs");
73
+ const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-DDCDkvtl.mjs");
74
74
  await handleCodexAccountUsage(options);
75
75
  }, { scope: "operator.admin" });
76
76
  }
@@ -82,7 +82,7 @@ function createCodexAppServerConnectionHealthService(options) {
82
82
  let abortController;
83
83
  let monitor;
84
84
  const run = async (ctx, signal) => {
85
- const { resolveCodexAppServerRuntimeOptions } = await import("./.setup/config-runtime-DWzK-k0n.mjs").then((n) => n.t);
85
+ const { resolveCodexAppServerRuntimeOptions } = await import("./.setup/config-runtime-BZRizyuG.mjs").then((n) => n.t);
86
86
  let consecutiveFailures = 0;
87
87
  while (!signal.aborted) {
88
88
  let pluginConfig;
@@ -98,9 +98,9 @@ function createCodexAppServerConnectionHealthService(options) {
98
98
  return;
99
99
  }
100
100
  if (runtime.start.transport !== "websocket") return;
101
- const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-BCx1wbyA.mjs").then((n) => n.v);
101
+ const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-CE_uY0A1.mjs").then((n) => n.m);
102
102
  const { sleepWithAbort } = await import("openclaw/plugin-sdk/runtime-env");
103
- const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-D93nbdB8.mjs").then((n) => n.n);
103
+ const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-BS8X7HmG.mjs").then((n) => n.n);
104
104
  if (signal.aborted) return;
105
105
  let leasedClient;
106
106
  try {
@@ -267,14 +267,15 @@ function createCodexManagedThreadStore(state) {
267
267
  /** Keeps lifecycle/auth loading behind mutations while sharing the canonical read codec. */
268
268
  function createLazyCodexAppServerBindingStore(state, managedThreadState) {
269
269
  let resolved;
270
- const store = () => resolved ??= import("./.setup/session-binding-JEHNMPsr.mjs").then((n) => n.a).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
270
+ const store = () => resolved ??= import("./.setup/session-binding-BgsWcbdY.mjs").then((n) => n.a).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
271
271
  const managedThreads = managedThreadState ? createCodexManagedThreadStore(managedThreadState) : void 0;
272
272
  return {
273
273
  ...managedThreads ? { managedThreads } : {},
274
274
  read: (identity) => readCurrentCodexAppServerBinding(state, identity),
275
+ readAsync: (identity) => readCurrentCodexAppServerBindingAsync(state.asyncReads, identity),
275
276
  readMany: (identities) => readCurrentCodexAppServerBindings(state.asyncReads, identities),
276
- readNativeSubagentAssignments: (identity, owner) => readCurrentNativePendingAssignments(state, identity, owner),
277
- readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state, identity, owner),
277
+ readNativeSubagentAssignments: (identity, owner) => readCurrentNativePendingAssignments(state.asyncReads, identity, owner),
278
+ readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state.asyncReads, identity, owner),
278
279
  hasOtherThreadOwner: async (threadId, currentIdentity) => (await store()).hasOtherThreadOwner(threadId, currentIdentity),
279
280
  mutate: async (identity, mutation, assertCurrent, authority) => (await store()).mutate(identity, mutation, assertCurrent, authority),
280
281
  prepareSessionGenerationReclaim: async (identity) => (await store()).prepareSessionGenerationReclaim(identity),
@@ -314,7 +315,7 @@ function createCodexCommand(options) {
314
315
  ...ctx,
315
316
  gatewayClientScopes: ctx.gatewayClientScopes?.slice()
316
317
  };
317
- const { handleCodexCommand } = await import("./.setup/command-dispatch-DxdH5a9-.mjs");
318
+ const { handleCodexCommand } = await import("./.setup/command-dispatch-DzXbHqCn.mjs");
318
319
  return handleCodexCommand(commandContext, options);
319
320
  }
320
321
  };
@@ -322,13 +323,14 @@ function createCodexCommand(options) {
322
323
  //#endregion
323
324
  //#region extensions/codex/src/conversation-binding-hooks.ts
324
325
  const getNodeConversationState = defineCodexBuildState("openclaw.codex.conversationBinding", () => ({ queue: new KeyedAsyncQueue() }));
325
- function isCurrentPublicBinding(binding, service) {
326
- return service.resolveByConversation({
326
+ function isCurrentPublicBinding(binding, inspect) {
327
+ const inspection = inspect({
327
328
  channel: binding.channel,
328
329
  accountId: binding.accountId,
329
330
  conversationId: binding.conversationId,
330
331
  ...binding.parentConversationId ? { parentConversationId: binding.parentConversationId } : {}
331
- })?.bindingId === binding.bindingId;
332
+ });
333
+ return inspection.status === "available" && inspection.binding?.bindingId === binding.bindingId;
332
334
  }
333
335
  async function handleCodexConversationInboundClaim(event, ctx, options) {
334
336
  const publicBinding = ctx.pluginBinding;
@@ -346,17 +348,19 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
346
348
  if (data.kind === "codex-cli-node-session") return {
347
349
  handled: true,
348
350
  reply: { text: await getNodeConversationState().queue.enqueue(`${data.nodeId}:${data.sessionId}`, async () => {
349
- const { resolveCodexNativeSandboxBlock } = await import("./.setup/sandbox-guard-DIImwCy1.mjs").then((n) => n.r);
350
- const blocked = resolveCodexNativeSandboxBlock({
351
+ const { prepareCodexNativeSandboxBlock } = await import("./.setup/sandbox-guard-DneAfNye.mjs").then((n) => n.a);
352
+ const sandbox = await prepareCodexNativeSandboxBlock({
351
353
  config: options.config,
352
354
  sessionKey,
353
355
  surface: "Codex CLI node conversation binding"
354
356
  });
355
- if (blocked) return blocked;
357
+ using cleanup = { [Symbol.dispose]: sandbox.release };
358
+ if (sandbox.block) return sandbox.block;
356
359
  const resume = options.resumeCodexCliSessionOnNode;
357
360
  if (!resume) return "Codex CLI node binding is unavailable because Gateway node runtime is not attached.";
358
- const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
359
- if (!isCurrentPublicBinding(publicBinding, getSessionBindingService())) return "This Codex conversation was detached or changed before its message could run.";
361
+ const { inspectConversationBinding } = await import("openclaw/plugin-sdk/conversation-binding-inspection-runtime");
362
+ await sandbox.assertCurrent();
363
+ if (!isCurrentPublicBinding(publicBinding, inspectConversationBinding)) return "This Codex conversation was detached or changed before its message could run.";
360
364
  return (await resume({
361
365
  nodeId: data.nodeId,
362
366
  sessionId: data.sessionId,
@@ -372,22 +376,16 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
372
376
  kind: "conversation",
373
377
  bindingId: data.bindingId
374
378
  };
375
- const expected = options.bindingStore.read(identity);
379
+ const pendingExpected = options.bindingStore.readAsync(identity);
380
+ pendingExpected.catch(() => {});
376
381
  return {
377
382
  handled: true,
378
383
  reply: await withCodexConversationThreadActivity(data.bindingId, async () => {
379
- const { resolveCodexNativeExecutionBlock } = await import("./.setup/sandbox-guard-DIImwCy1.mjs").then((n) => n.r);
380
- const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
381
- config: options.config,
382
- sessionKey,
383
- agentId: data.agentId,
384
- surface: "Codex app-server conversation binding"
385
- });
386
- if (nativeExecutionBlock) return { text: nativeExecutionBlock };
387
- const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
388
- const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-BieJZRRV.mjs");
389
- const current = options.bindingStore.read(identity);
390
- if (!isCurrentPublicBinding(publicBinding, getSessionBindingService()) || expected && (!current || current.threadId !== expected.threadId || current.conversationStartId !== expected.conversationStartId) || !expected && current && data.start?.id && current.conversationStartId !== data.start.id) return { text: "This Codex conversation was detached or changed before its message could run." };
384
+ const expected = await pendingExpected;
385
+ const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-C7MZy-Cx.mjs");
386
+ const { inspectConversationBinding } = await import("openclaw/plugin-sdk/conversation-binding-inspection-runtime");
387
+ const current = await options.bindingStore.readAsync(identity);
388
+ if (!isCurrentPublicBinding(publicBinding, inspectConversationBinding) || expected && (!current || current.threadId !== expected.threadId || current.conversationStartId !== expected.conversationStartId) || !expected && current && data.start?.id && current.conversationStartId !== data.start.id) return { text: "This Codex conversation was detached or changed before its message could run." };
391
389
  return await runBoundTurnWithMissingThreadRecovery({
392
390
  bindingStore: options.bindingStore,
393
391
  data,
@@ -416,10 +414,10 @@ async function handleCodexConversationBindingResolved(event, options) {
416
414
  kind: "conversation",
417
415
  bindingId: data.bindingId
418
416
  };
419
- const binding = options.bindingStore.read(identity);
417
+ const binding = await options.bindingStore.readAsync(identity);
420
418
  assertCodexBindingMayBeReplaced(binding, "clearing a denied conversation binding");
421
419
  if (binding && (!data.start?.id || binding.conversationStartId === data.start.id)) await withCodexConversationThreadActivity(identity.bindingId, async () => {
422
- const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-BoUd0i6L.mjs").then((n) => n.o);
420
+ const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-t6Y9fLQS.mjs").then((n) => n.o);
423
421
  return retireCodexConversationThreadBinding({
424
422
  bindingStore: options.bindingStore,
425
423
  identity,
@@ -454,7 +452,7 @@ function createCodexPluginsTool(options) {
454
452
  const query = typeof params.query === "string" ? params.query : "";
455
453
  const marketplace = typeof params.marketplace === "string" ? params.marketplace.trim() : void 0;
456
454
  const limit = typeof params.limit === "number" && Number.isInteger(params.limit) ? Math.max(1, Math.min(params.limit, 20)) : 12;
457
- const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-B7HAAZSI.mjs").then((n) => n.n);
455
+ const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-GTgUj9pi.mjs").then((n) => n.n);
458
456
  const pluginConfig = options.getPluginConfig();
459
457
  const config = runtimeConfig();
460
458
  const identity = options.context.sessionId ? sessionBindingIdentity({
@@ -464,14 +462,14 @@ function createCodexPluginsTool(options) {
464
462
  config
465
463
  }) : void 0;
466
464
  const readBinding = () => identity ? options.bindingStore.read(identity) : void 0;
467
- const binding = readBinding();
465
+ const binding = identity ? await options.bindingStore.readAsync(identity) : void 0;
468
466
  const selection = codexBindingConnectionSelection(binding);
469
467
  const assertCurrent = () => {
470
468
  options.context.assertInvocationCurrent?.();
471
469
  if (runtimeConfig() !== config || !isDeepStrictEqual(options.getPluginConfig(), pluginConfig) || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex plugin discovery ownership changed; retry the request.");
472
470
  };
473
471
  const workspaceDir = binding?.cwd?.trim() || options.context.workspaceDir?.trim() || resolveCodexDefaultWorkspaceDir(pluginConfig);
474
- const request = options.request ?? (await import("./.setup/command-rpc-HIvsy3wS.mjs").then((n) => n.n)).codexControlRequest;
472
+ const request = options.request ?? (await import("./.setup/command-rpc-SXqLQukR.mjs").then((n) => n.n)).codexControlRequest;
475
473
  const connection = await resolveCodexBindingAppServerConnection({
476
474
  binding,
477
475
  pluginConfig,
@@ -599,15 +597,20 @@ function createCodexThreadsTool(options) {
599
597
  description: "Manage native Codex threads: list, read, fork, rename, archive (confirm:true), unarchive. When supervision is enabled, raw transcript reads and every mutation require their matching supervision policy option.",
600
598
  parameters: CodexThreadsParamsSchema,
601
599
  async execute(_toolCallId, rawParams) {
600
+ const runtimeConfig = () => options.context.getRuntimeConfig?.() ?? options.context.runtimeConfig ?? options.context.config;
601
+ const context = options.context;
602
+ const sessionKey = context.sessionKey?.trim();
603
+ const config = runtimeConfig();
604
+ const agentId = sessionKey ? resolveSessionAgentIdsStrict({
605
+ config: config ?? {},
606
+ sessionKey,
607
+ agentId: context.agentId
608
+ }).sessionAgentId : void 0;
609
+ const storePath = agentId ? options.runtime.agent.session.resolveStorePath(config?.session?.store, { agentId }) : void 0;
610
+ let prepared;
602
611
  const currentSession = () => {
603
- const context = options.context;
604
- const sessionKey = context.sessionKey?.trim();
605
612
  if (!sessionKey) return;
606
- const entry = options.runtime.agent.session.getSessionEntry({
607
- agentId: context.agentId,
608
- sessionKey,
609
- readConsistency: "latest"
610
- });
613
+ const entry = prepared?.entry;
611
614
  const sessionId = context.sessionId?.trim() || entry?.sessionId?.trim();
612
615
  if (!sessionId) return;
613
616
  return {
@@ -615,7 +618,6 @@ function createCodexThreadsTool(options) {
615
618
  entry: entry ? { ...entry } : void 0
616
619
  };
617
620
  };
618
- const runtimeConfig = () => options.context.getRuntimeConfig?.() ?? options.context.runtimeConfig ?? options.context.config;
619
621
  const currentIdentity = (sessionId) => sessionBindingIdentity({
620
622
  sessionId,
621
623
  sessionKey: options.context.sessionKey,
@@ -634,27 +636,46 @@ function createCodexThreadsTool(options) {
634
636
  const mayReadRawTranscripts = supervision?.enabled !== true || supervision.allowRawTranscripts === true;
635
637
  const threadResult = (response) => jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
636
638
  if ((action === "fork" || action === "rename" || action === "archive" || action === "unarchive") && supervision?.enabled === true && supervision.allowWriteControls !== true) throw new Error("Codex native thread mutations are disabled for this codex plugin supervision config.");
637
- const run = async (archiveAdmission) => {
638
- const request = options.request ?? (await import("./.setup/command-rpc-HIvsy3wS.mjs").then((n) => n.n)).codexControlRequest;
639
+ const run = async (archiveThreadId) => {
640
+ const { captureSessionEntryCurrentCheckAsync, composeSessionEntryCommitGuards } = await import("openclaw/plugin-sdk/session-binding-runtime");
641
+ prepared = sessionKey && agentId ? await captureSessionEntryCurrentCheckAsync({
642
+ agentId,
643
+ sessionKey,
644
+ storePath,
645
+ fields: ["modelSelectionLocked"],
646
+ errorMessage: "Codex native thread ownership changed; retry the request."
647
+ }) : void 0;
648
+ using _ = { [Symbol.dispose]: () => prepared?.release() };
649
+ options.context.assertInvocationCurrent?.();
650
+ const archiveSession = archiveThreadId ? currentSession() : void 0;
651
+ if (archiveThreadId && !archiveSession) throw new Error("cannot safely archive a native Codex thread without a session identity");
652
+ const archiveAdmission = archiveThreadId && archiveSession ? {
653
+ threadId: archiveThreadId,
654
+ session: archiveSession,
655
+ identity: currentIdentity(archiveSession.sessionId)
656
+ } : void 0;
657
+ const request = options.request ?? (await import("./.setup/command-rpc-SXqLQukR.mjs").then((n) => n.n)).codexControlRequest;
639
658
  const { isModelSelectionLocked, ModelSelectionLockedError } = await import("openclaw/plugin-sdk/model-session-runtime");
640
- const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-B7HAAZSI.mjs").then((n) => n.n);
641
- const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("./.setup/config-runtime-DWzK-k0n.mjs").then((n) => n.t);
659
+ const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-GTgUj9pi.mjs").then((n) => n.n);
660
+ const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("./.setup/config-runtime-BZRizyuG.mjs").then((n) => n.t);
642
661
  const requestOptions = async () => {
643
662
  const base = {
663
+ agentId,
644
664
  agentDir: options.context.agentDir,
645
665
  config: runtimeConfig(),
646
666
  sessionId: options.context.sessionId,
647
- sessionKey: options.context.sessionKey
667
+ sessionKey: options.context.sessionKey,
668
+ storePath
648
669
  };
649
670
  const session = currentSession();
650
671
  const identity = session ? currentIdentity(session.sessionId) : void 0;
651
672
  const readBinding = () => identity ? options.bindingStore.read(identity) : void 0;
652
- const binding = readBinding();
673
+ const binding = identity ? await options.bindingStore.readAsync(identity) : void 0;
653
674
  const selection = codexBindingConnectionSelection(binding);
654
675
  const assertCurrent = () => {
655
676
  options.context.assertInvocationCurrent?.();
656
677
  const current = currentSession();
657
- if (runtimeConfig() !== base.config || !isDeepStrictEqual(options.getPluginConfig(), admissionConfig) || current?.sessionId !== session?.sessionId || current?.entry?.sessionId !== session?.entry?.sessionId || isModelSelectionLocked(current?.entry) !== isModelSelectionLocked(session?.entry) || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex native thread ownership changed; retry the request.");
678
+ if (runtimeConfig() !== base.config || !isDeepStrictEqual(options.getPluginConfig(), admissionConfig) || current?.sessionId !== session?.sessionId || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex native thread ownership changed; retry the request.");
658
679
  };
659
680
  if (binding?.connectionScope === "supervision" || admissionPlugin.appServer?.homeScope === "user") {
660
681
  const connection = await resolveCodexBindingAppServerConnection({
@@ -668,7 +689,8 @@ function createCodexThreadsTool(options) {
668
689
  ...base,
669
690
  startOptions: connection.appServer.start,
670
691
  authProfileId: connection.usesSupervisionConnection ? connection.clientAuthProfileId : null,
671
- assertCurrent
692
+ assertCurrent,
693
+ assertCurrentAsync: prepared?.assertCurrent
672
694
  };
673
695
  }
674
696
  if (supervision?.enabled !== true) throw new Error("Codex native thread access is disabled for this run.");
@@ -676,7 +698,8 @@ function createCodexThreadsTool(options) {
676
698
  ...base,
677
699
  startOptions: resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig: admissionConfig }).start,
678
700
  authProfileId: null,
679
- assertCurrent
701
+ assertCurrent,
702
+ assertCurrentAsync: prepared?.assertCurrent
680
703
  };
681
704
  };
682
705
  const scopedRequest = async (method, requestParams) => request(admissionConfig, method, requestParams, await requestOptions());
@@ -729,10 +752,10 @@ function createCodexThreadsTool(options) {
729
752
  return threadResult(response);
730
753
  }
731
754
  const session = archiveAdmission?.session ?? currentSession();
732
- const binding = currentBinding(session);
755
+ const binding = session ? await options.bindingStore.readAsync(currentIdentity(session.sessionId)) : void 0;
733
756
  if (archiveAdmission) {
734
757
  const { identity, session: admittedSession } = archiveAdmission;
735
- const archivedBinding = currentBinding(admittedSession);
758
+ const archivedBinding = binding;
736
759
  if (archivedBinding?.threadId === threadId) {
737
760
  if (isModelSelectionLocked(admittedSession.entry)) throw new ModelSelectionLockedError();
738
761
  assertCodexBindingMayBeReplaced(archivedBinding, "archiving its bound native thread");
@@ -755,7 +778,7 @@ function createCodexThreadsTool(options) {
755
778
  if (archivedBinding?.threadId === threadId) await options.bindingStore.mutate(identity, {
756
779
  kind: "clear",
757
780
  threadId
758
- }, options.context.assertInvocationCurrent);
781
+ }, composeSessionEntryCommitGuards([options.context.assertInvocationCurrent, prepared?.source]));
759
782
  return jsonResult({
760
783
  action,
761
784
  threadId
@@ -768,8 +791,8 @@ function createCodexThreadsTool(options) {
768
791
  const usesSupervisionConnection = binding?.connectionScope === "supervision" || admissionPlugin.appServer?.homeScope !== "user" && supervision?.enabled === true;
769
792
  if (attach && usesSupervisionConnection) throw new Error("Supervised Codex forks must stay detached; set attach=false.");
770
793
  const forkOptions = await requestOptions();
771
- const { retainCodexAppServerBindingSubscription, rollbackCodexAppServerBindingSubscription } = await import("./.setup/thread-ownership-BoUd0i6L.mjs").then((n) => n.o);
772
- const { closeCodexStartupClientBestEffort } = await import("./.setup/attempt-client-cleanup-zNuNTKVr.mjs").then((n) => n.a);
794
+ const { retainCodexAppServerBindingSubscription, rollbackCodexAppServerBindingSubscription } = await import("./.setup/thread-ownership-t6Y9fLQS.mjs").then((n) => n.o);
795
+ const { closeCodexStartupClientBestEffort } = await import("./.setup/attempt-client-cleanup-6OcbMH46.mjs").then((n) => n.a);
773
796
  if (attach) {
774
797
  assertCodexBindingMayBeReplaced(binding, "attaching a different native fork");
775
798
  assertThreadIdle(await request(admissionConfig, CODEX_CONTROL_METHODS.readThread, {
@@ -783,7 +806,7 @@ function createCodexThreadsTool(options) {
783
806
  excludeTurns: true
784
807
  }, {
785
808
  ...forkOptions,
786
- onResponse: async (value, client, { assertCurrent }) => {
809
+ onResponse: async (value, client, { assertCurrent, assertCurrentAsync, source }) => {
787
810
  if (!isJsonObject(value) || !isJsonObject(value.thread)) {
788
811
  await closeCodexStartupClientBestEffort(client);
789
812
  throw new Error("Codex app-server returned an invalid thread/fork response");
@@ -797,12 +820,13 @@ function createCodexThreadsTool(options) {
797
820
  let retained = false;
798
821
  let attached = false;
799
822
  try {
823
+ await assertCurrentAsync?.();
800
824
  assertCurrent();
801
825
  if (attach && session) {
802
826
  const identity = currentIdentity(session.sessionId);
803
827
  await options.bindingStore.withLease(identity, async () => {
828
+ await assertCurrentAsync?.();
804
829
  assertCurrent();
805
- if (currentSession()?.entry?.sessionId !== session.sessionId) throw new Error("Codex native thread ownership changed; retry the request.");
806
830
  assertCodexBindingMayBeReplaced(currentBinding(session), "attaching a different native fork");
807
831
  retained = await retainCodexAppServerBindingSubscription(client, forkThreadId);
808
832
  if (!retained) throw new Error("Codex fork lost its native subscription owner.");
@@ -817,7 +841,11 @@ function createCodexThreadsTool(options) {
817
841
  attached = await options.bindingStore.mutate(identity, {
818
842
  kind: "set",
819
843
  binding: nextBinding
820
- }, assertCurrent);
844
+ }, composeSessionEntryCommitGuards([
845
+ assertCurrent,
846
+ source,
847
+ prepared?.source
848
+ ]));
821
849
  if (!attached) throw new Error("Codex session binding changed before the fork could be attached");
822
850
  });
823
851
  }
@@ -837,14 +865,7 @@ function createCodexThreadsTool(options) {
837
865
  if (action === "archive") {
838
866
  const threadId = readThreadId(params);
839
867
  if (params.confirm !== true) throw new Error("confirm=true is required to archive a native Codex thread");
840
- const session = currentSession();
841
- if (!session) throw new Error("cannot safely archive a native Codex thread without a session identity");
842
- const identity = currentIdentity(session.sessionId);
843
- return options.bindingStore.withThreadArchiveFence(() => run({
844
- threadId,
845
- session,
846
- identity
847
- }));
868
+ return options.bindingStore.withThreadArchiveFence(() => run(threadId));
848
869
  }
849
870
  return run();
850
871
  }
@@ -893,7 +914,7 @@ function createCodexNodeExecServerCommand() {
893
914
  signal: AbortSignal.any([io.signal, context.signal])
894
915
  } : io;
895
916
  const assertExecAuthorized = context.prepareExecAuthorization(request.authorization);
896
- const { runCodexNodeExecServer } = await import("./.setup/node-exec-server.runtime-BWkULhBM.mjs");
917
+ const { runCodexNodeExecServer } = await import("./.setup/node-exec-server.runtime-CP7RC1Nd.mjs");
897
918
  runtimeIo.signal.throwIfAborted();
898
919
  const workspace = await context.acquireManagedWorkspaceAsync(workspaceRequest);
899
920
  try {
@@ -1261,56 +1282,36 @@ function startCodexCatalogControlRequestDiagnostics(page) {
1261
1282
  /** One query-compatible native page per node, owned by the registered catalog provider. */
1262
1283
  var CodexCatalogNodeSnapshots = class {
1263
1284
  constructor() {
1264
- this.generation = 0;
1265
- this.inventoryGeneration = 0;
1266
- this.configGeneration = 0;
1267
1285
  this.nodes = /* @__PURE__ */ new Map();
1268
1286
  }
1269
1287
  start(config) {
1270
1288
  if (this.config !== config) {
1271
1289
  this.nodes.clear();
1272
1290
  this.config = config;
1273
- this.configGeneration = this.generation + 1;
1274
- this.inventoryGeneration = this.configGeneration;
1275
1291
  }
1276
- return ++this.generation;
1277
1292
  }
1278
- observe(generation, nodes) {
1279
- if (generation < this.inventoryGeneration) return;
1280
- this.inventoryGeneration = generation;
1293
+ observe(nodes) {
1281
1294
  const connected = new Map(nodes.filter((node) => node.connected).map((node) => [node.nodeId, node]));
1282
1295
  for (const [nodeId, publication] of this.nodes) {
1283
1296
  const node = connected.get(nodeId);
1284
1297
  if (!node || node.connectedAtMs !== publication.connection) this.nodes.delete(nodeId);
1285
1298
  }
1286
- for (const node of connected.values()) if (!this.nodes.has(node.nodeId)) this.nodes.set(node.nodeId, {
1287
- connection: node.connectedAtMs,
1288
- generation: 0
1289
- });
1299
+ for (const node of connected.values()) if (!this.nodes.has(node.nodeId)) this.nodes.set(node.nodeId, { connection: node.connectedAtMs });
1290
1300
  }
1291
- forNode(node, generation, key) {
1301
+ forNode(node, key) {
1292
1302
  let publication = this.nodes.get(node.nodeId);
1293
1303
  if (!publication) {
1294
- publication = {
1295
- connection: node.connectedAtMs,
1296
- generation: 0
1297
- };
1298
- if (generation >= this.inventoryGeneration) this.nodes.set(node.nodeId, publication);
1304
+ publication = { connection: node.connectedAtMs };
1305
+ this.nodes.set(node.nodeId, publication);
1299
1306
  }
1300
- const valid = () => generation >= this.configGeneration && this.nodes.get(node.nodeId) === publication && publication.connection === node.connectedAtMs;
1301
1307
  return {
1302
- read: () => valid() && publication.snapshot?.key === key ? publication.snapshot : void 0,
1308
+ read: () => publication.snapshot?.key === key ? publication.snapshot : void 0,
1303
1309
  publish: (host) => {
1304
- if (!valid() || generation < publication.generation) return false;
1305
- publication.generation = generation;
1306
1310
  publication.snapshot = node.connected && host.connected ? {
1307
1311
  key,
1308
1312
  host
1309
1313
  } : void 0;
1310
- return true;
1311
- },
1312
- isCurrent: (snapshot) => valid() && publication.snapshot === snapshot,
1313
- valid
1314
+ }
1314
1315
  };
1315
1316
  }
1316
1317
  };
@@ -1336,16 +1337,12 @@ function createNodeHostPublication(publication, adopted, sourceKey, onHost, sign
1336
1337
  readPublished: () => publishedHost,
1337
1338
  publish: (host) => {
1338
1339
  if (signal?.aborted) return partial ? void 0 : onHost?.(project(host));
1339
- if (!publication.valid()) return;
1340
- if (publication.publish(host)) {
1341
- publishedSnapshot = publication.read();
1342
- return emit(host);
1343
- }
1344
- const latest = publication.read();
1345
- return emit(latest?.host ?? host);
1340
+ publication.publish(host);
1341
+ publishedSnapshot = publication.read();
1342
+ return emit(host);
1346
1343
  },
1347
1344
  publishCached: (snapshot) => {
1348
- if (signal?.aborted || snapshot === publishedSnapshot || !publication.isCurrent(snapshot)) return;
1345
+ if (signal?.aborted || snapshot === publishedSnapshot) return;
1349
1346
  const completion = createDeferred();
1350
1347
  completion.promise.catch(() => void 0);
1351
1348
  try {
@@ -1537,7 +1534,6 @@ var CodexCatalogVisiblePage = class {
1537
1534
  this.sessions = [];
1538
1535
  this.seenCursors = /* @__PURE__ */ new Set();
1539
1536
  this.pages = 0;
1540
- this.complete = false;
1541
1537
  this.request = new CodexCatalogListRequest();
1542
1538
  this.cursor = params.cursor;
1543
1539
  }
@@ -1553,11 +1549,9 @@ var CodexCatalogVisiblePage = class {
1553
1549
  }
1554
1550
  }
1555
1551
  close() {
1556
- this.complete = true;
1557
1552
  this.request.close();
1558
1553
  }
1559
1554
  async nextPage() {
1560
- if (this.complete) throw new Error("Codex catalog page is already complete");
1561
1555
  const params = this.params;
1562
1556
  params.signal?.throwIfAborted();
1563
1557
  const finishTiming = startCodexCatalogListTiming("controlWaitSumMs", "controlPageCalls");
@@ -1592,21 +1586,20 @@ var CodexCatalogVisiblePage = class {
1592
1586
  await params.onExcludedThread?.({ threadId: session.threadId });
1593
1587
  }
1594
1588
  const nextCursor = page.nextCursor;
1595
- if (!nextCursor || this.sessions.length >= params.limit || !excludedFromPage) this.complete = true;
1596
- else {
1589
+ if (nextCursor && this.sessions.length < params.limit && excludedFromPage) {
1597
1590
  if (this.seenCursors.has(nextCursor)) throw new Error("Codex session catalog returned a repeated exclusion cursor");
1598
1591
  this.seenCursors.add(nextCursor);
1599
1592
  this.cursor = nextCursor;
1600
- this.complete = this.pages >= 20 || !this.request.hasPages;
1593
+ if (this.pages < 20 && this.request.hasPages) return { done: false };
1601
1594
  }
1602
- return this.complete ? {
1595
+ return {
1603
1596
  done: true,
1604
1597
  page: {
1605
1598
  sessions: this.sessions.slice(0, params.limit),
1606
1599
  ...nextCursor ? { nextCursor } : {},
1607
1600
  ...this.backwardsCursor ? { backwardsCursor: this.backwardsCursor } : {}
1608
1601
  }
1609
- } : { done: false };
1602
+ };
1610
1603
  }
1611
1604
  };
1612
1605
  /** Node and direct callers finish the same bounded outer algorithm inline. */
@@ -1649,7 +1642,7 @@ function hostFailure(source, error) {
1649
1642
  }
1650
1643
  async function projectLocalHost(params, agentId, source, page) {
1651
1644
  params.signal?.throwIfAborted();
1652
- const { listAdoptedSessionEntries } = await import("./.setup/session-catalog-adoption-Ca3OYGYM.mjs");
1645
+ const { listAdoptedSessionEntries } = await import("./.setup/session-catalog-adoption-ppsLlVLB.mjs");
1653
1646
  const { sessionCatalogAdoptedSourceKey } = await import("openclaw/plugin-sdk/session-catalog");
1654
1647
  params.signal?.throwIfAborted();
1655
1648
  const finishTiming = startCodexCatalogListTiming("adoptionSumMs", "adoptionCalls");
@@ -1738,7 +1731,7 @@ var CodexCatalogListDriver = class {
1738
1731
  this.complete = false;
1739
1732
  this.params = params;
1740
1733
  this.nodeSnapshots = params.nodeSnapshots ?? new CodexCatalogNodeSnapshots();
1741
- this.nodeGeneration = this.nodeSnapshots.start(params.config);
1734
+ this.nodeSnapshots.start(params.config);
1742
1735
  }
1743
1736
  request() {
1744
1737
  if (!this.params) throw new Error("Codex catalog list operation is closed");
@@ -1870,9 +1863,9 @@ var CodexCatalogListDriver = class {
1870
1863
  return [host];
1871
1864
  }
1872
1865
  params.signal?.throwIfAborted();
1873
- this.nodeSnapshots.observe(this.nodeGeneration, inventory);
1874
- const { listNodeAdoptedSessionEntries, nodeAdoptedSourceKey } = await import("./.setup/session-catalog-node-adoption-BdP9Zjqo.mjs");
1875
- const { compareNodeLabels, listPairedNode, nodeLabel } = await import("./.setup/session-catalog-node-continue-CNJibO4_.mjs");
1866
+ this.nodeSnapshots.observe(inventory);
1867
+ const { listNodeAdoptedSessionEntries, nodeAdoptedSourceKey } = await import("./.setup/session-catalog-node-adoption-e9v8mGgx.mjs");
1868
+ const { compareNodeLabels, listPairedNode, nodeLabel } = await import("./.setup/session-catalog-node-continue-H7nrzcUD.mjs");
1876
1869
  params.signal?.throwIfAborted();
1877
1870
  const adopted = listNodeAdoptedSessionEntries({
1878
1871
  agentId,
@@ -1898,7 +1891,7 @@ var CodexCatalogListDriver = class {
1898
1891
  node.commands,
1899
1892
  node.invocableCommands
1900
1893
  ]);
1901
- const publication = this.nodeSnapshots.forNode(node, this.nodeGeneration, key);
1894
+ const publication = this.nodeSnapshots.forNode(node, key);
1902
1895
  const { project, publish, publishCached, readPublished } = createNodeHostPublication(publication, adopted, nodeAdoptedSourceKey, params.onHost, params.signal, partial, trackPublication);
1903
1896
  const cached = partial ? publication.read() : void 0;
1904
1897
  let result;
@@ -1908,7 +1901,7 @@ var CodexCatalogListDriver = class {
1908
1901
  publishCached(latest);
1909
1902
  return project(latest.host);
1910
1903
  }
1911
- return !partial ? result : publication.valid() ? readPublished() ?? result : void 0;
1904
+ return partial ? readPublished() ?? result : result;
1912
1905
  });
1913
1906
  if (cached) publishCached(cached);
1914
1907
  const nodeStarted = diagnostics ? performance.now() : 0;
@@ -2031,11 +2024,6 @@ async function runCatalogListInline(operation) {
2031
2024
  }
2032
2025
  //#endregion
2033
2026
  //#region extensions/codex/src/session-catalog-transcript-item.ts
2034
- const CODEX_MESSAGE_TYPES = /* @__PURE__ */ new Map([
2035
- ["userMessage", "userMessage"],
2036
- ["agentMessage", "agentMessage"],
2037
- ["reasoning", "reasoning"]
2038
- ]);
2039
2027
  const CODEX_TOOL_TYPES = /* @__PURE__ */ new Set([
2040
2028
  "commandExecution",
2041
2029
  "fileChange",
@@ -2047,9 +2035,9 @@ const CODEX_TOOL_TYPES = /* @__PURE__ */ new Set([
2047
2035
  "imageGeneration"
2048
2036
  ]);
2049
2037
  function toGenericTranscriptItem(item) {
2050
- let type = CODEX_MESSAGE_TYPES.get(item.type);
2051
- if (!type && CODEX_TOOL_TYPES.has(item.type)) type = item.result !== void 0 || Boolean(item.aggregatedOutput) ? "toolResult" : "toolCall";
2052
- type ??= "other";
2038
+ let type = "other";
2039
+ if (item.type === "userMessage" || item.type === "agentMessage" || item.type === "reasoning") type = item.type;
2040
+ else if (CODEX_TOOL_TYPES.has(item.type)) type = item.result !== void 0 || item.aggregatedOutput ? "toolResult" : "toolCall";
2053
2041
  const fallback = item.title ?? item.name ?? item.tool ?? item.command ?? item.query ?? void 0;
2054
2042
  const resultText = item.aggregatedOutput || (item.result === void 0 ? void 0 : JSON.stringify(item.result, null, 2));
2055
2043
  const changesText = Array.isArray(item.changes) ? item.changes.map((change) => `${change.kind}: ${change.path}`).join("\n") || void 0 : void 0;
@@ -2315,7 +2303,7 @@ async function readCodexSessionTranscript(params) {
2315
2303
  cursor,
2316
2304
  limit
2317
2305
  });
2318
- const { nodeLabel } = await import("./.setup/session-catalog-node-continue-CNJibO4_.mjs");
2306
+ const { nodeLabel } = await import("./.setup/session-catalog-node-continue-H7nrzcUD.mjs");
2319
2307
  return {
2320
2308
  hostId: params.hostId,
2321
2309
  label: nodeLabel(node),
@@ -2392,7 +2380,7 @@ async function checkCodexUpstreamActivity(probes, control, resolveThreadId) {
2392
2380
  const fingerprint = upstreamConnectionFingerprint(probe);
2393
2381
  if (probe.upstreamKind !== "codex-app-server" || !fingerprint || fingerprint !== pinned.connectionFingerprint) continue;
2394
2382
  try {
2395
- const threadId = resolveThreadId(probe);
2383
+ const threadId = await resolveThreadId(probe);
2396
2384
  const page = await pinned.listTurnPage({
2397
2385
  threadId,
2398
2386
  limit: CODEX_UPSTREAM_TURN_LIMIT,
@@ -2424,15 +2412,17 @@ async function checkCodexUpstreamActivity(probes, control, resolveThreadId) {
2424
2412
  });
2425
2413
  }
2426
2414
  function createChecker(params) {
2427
- const resolveThreadId = (probe) => {
2415
+ const resolveThreadId = async (probe) => {
2428
2416
  const config = params.getRuntimeConfig();
2429
- const sessionId = params.api.runtime.agent.session.getSessionEntry({
2417
+ const storePath = params.api.runtime.agent.session.resolveStorePath(config?.session?.store, { agentId: probe.agentId });
2418
+ const sessionId = (await params.api.runtime.agent.session.getSessionEntryAsync({
2430
2419
  agentId: probe.agentId,
2420
+ storePath,
2431
2421
  sessionKey: probe.sessionKey,
2432
2422
  readConsistency: "latest"
2433
- })?.sessionId?.trim();
2423
+ }))?.sessionId?.trim();
2434
2424
  if (!sessionId) return probe.threadId;
2435
- const binding = params.bindingStore.read(sessionBindingIdentity({
2425
+ const binding = await params.bindingStore.readAsync(sessionBindingIdentity({
2436
2426
  sessionId,
2437
2427
  sessionKey: probe.sessionKey,
2438
2428
  config
@@ -2479,8 +2469,8 @@ async function requireEligibleCodexThread(params) {
2479
2469
  remaining();
2480
2470
  if (thread.id !== threadId || thread.ephemeral === true || !isInteractiveThreadSource(thread.source)) throw unverified();
2481
2471
  if (!root) {
2482
- const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./.setup/session-catalog-native-projection-CWqCU1I_.mjs").then((n) => n.a);
2483
- const { CODEX_CATALOG_MAX_ROWS } = await import("./.setup/session-catalog-limits-BynIoOYm.mjs").then((n) => n.r);
2472
+ const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./.setup/session-catalog-native-projection-G3lSDYYG.mjs").then((n) => n.a);
2473
+ const { CODEX_CATALOG_MAX_ROWS } = await import("./.setup/session-catalog-limits-Dc6E0BZz.mjs").then((n) => n.r);
2484
2474
  let cursor;
2485
2475
  const seenCursors = /* @__PURE__ */ new Set();
2486
2476
  for (;;) {
@@ -2542,7 +2532,7 @@ function createCodexCatalogRequestSnapshot(requestTimeoutMs, request, index, beg
2542
2532
  listThreads: (params, timeoutMs, observation) => read(CODEX_CONTROL_METHODS.listThreads, params, timeoutMs, observation),
2543
2533
  listThreadTurns: (params) => read(CODEX_CONTROL_METHODS.listThreadTurns, params),
2544
2534
  listThreadItems: (params) => read(CODEX_CONTROL_METHODS.listThreadItems, params),
2545
- forkThread: (params, assertCurrent) => request(CODEX_CONTROL_METHODS.forkThread, assertCodexThreadForkParams(params), void 0, assertCurrent),
2535
+ forkThread: (params, assertCurrent) => request(CODEX_CONTROL_METHODS.forkThread, params, void 0, assertCurrent),
2546
2536
  readThread: async (threadId, includeTurns, timeoutMs) => (await read(CODEX_CONTROL_METHODS.readThread, {
2547
2537
  threadId,
2548
2538
  includeTurns
@@ -2684,7 +2674,6 @@ function createCodexCatalogHomeResolver(params) {
2684
2674
  });
2685
2675
  const prepareAgentHomes = async (snapshot, agentId, fleet) => {
2686
2676
  await scheduler.yield();
2687
- snapshot.assertCurrent();
2688
2677
  if (!agentIds(snapshot).includes(agentId)) return [];
2689
2678
  const ownerAgentDir = await homePath(snapshot, agentDir(snapshot, agentId));
2690
2679
  const base = params.resolveRuntimeOptions({
@@ -2713,7 +2702,6 @@ function createCodexCatalogHomeResolver(params) {
2713
2702
  });
2714
2703
  candidates.push(...await sharedCandidates(snapshot));
2715
2704
  }
2716
- snapshot.assertCurrent();
2717
2705
  const homes = [];
2718
2706
  const seen = /* @__PURE__ */ new Set();
2719
2707
  for (const candidate of candidates) {
@@ -2754,7 +2742,6 @@ function createCodexCatalogHomeResolver(params) {
2754
2742
  await scheduler.yield();
2755
2743
  if (agentDir(snapshot, id) === directory) return prepareAgentHomes(snapshot, id, true);
2756
2744
  }
2757
- snapshot.assertCurrent();
2758
2745
  return [];
2759
2746
  });
2760
2747
  return {
@@ -2776,7 +2763,6 @@ function createCodexCatalogHomeResolver(params) {
2776
2763
  };
2777
2764
  }
2778
2765
  const codexHome = await homePath(snapshot, resolveCodexAppServerUserHomeDir(env));
2779
- snapshot.assertCurrent();
2780
2766
  const appServer = params.resolveRuntimeOptions({
2781
2767
  pluginConfig: snapshot.pluginConfig,
2782
2768
  config: snapshot.config,
@@ -2833,10 +2819,9 @@ var CodexCatalogSourceBackoff = class {
2833
2819
  return {
2834
2820
  allowed: true,
2835
2821
  resolved: () => {
2836
- if (sources.get(key) === state) sources.set(key, {});
2822
+ sources.set(key, {});
2837
2823
  },
2838
2824
  rejected: (error) => {
2839
- if (sources.get(key) !== state) return;
2840
2825
  if (error instanceof CatalogParamsError || error instanceof Error && error.name === "AbortError" || error instanceof CodexAppServerRpcError && (error.code === -32600 || error.code === -32602)) {
2841
2826
  if (failure) failure.probing = false;
2842
2827
  return;
@@ -2850,7 +2835,7 @@ var CodexCatalogSourceBackoff = class {
2850
2835
  } });
2851
2836
  },
2852
2837
  abandoned: () => {
2853
- if (sources.get(key) === state && failure) failure.probing = false;
2838
+ if (failure) failure.probing = false;
2854
2839
  }
2855
2840
  };
2856
2841
  }
@@ -2881,24 +2866,15 @@ function createCodexSessionCatalogControl(params) {
2881
2866
  });
2882
2867
  const requestOptionsByConfig = /* @__PURE__ */ new WeakMap();
2883
2868
  const indexes = /* @__PURE__ */ new Map();
2884
- const retiringState = /* @__PURE__ */ new Map();
2885
2869
  const directHomes = /* @__PURE__ */ new Map();
2886
2870
  const residentRequests = /* @__PURE__ */ new Set();
2887
2871
  let generation = params.getRuntimeConfig();
2888
- let residentEpoch = 0;
2889
2872
  let closed = false;
2890
2873
  let runBackground = (run) => run();
2891
2874
  let retiring;
2892
2875
  const retireIndexes = () => {
2893
- residentEpoch++;
2894
2876
  const closing = [];
2895
- for (const [homeId, index] of indexes) {
2896
- const writes = index.retire().finally(() => {
2897
- if (retiringState.get(homeId) === writes) retiringState.delete(homeId);
2898
- });
2899
- retiringState.set(homeId, writes);
2900
- closing.push(writes, index.close());
2901
- }
2877
+ for (const index of indexes.values()) closing.push(index.close());
2902
2878
  indexes.clear();
2903
2879
  directHomes.clear();
2904
2880
  const drain = Promise.allSettled([retiring, ...closing]).then(() => {
@@ -2914,7 +2890,6 @@ function createCodexSessionCatalogControl(params) {
2914
2890
  generation = config;
2915
2891
  retireIndexes();
2916
2892
  }
2917
- const epoch = residentEpoch;
2918
2893
  const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig: params.getPluginConfig() });
2919
2894
  const requestOptions = resolveRequestOptions(runtime.start, agentId, source);
2920
2895
  const key = source?.sourceHomeId ?? agentId ?? "";
@@ -2928,13 +2903,10 @@ function createCodexSessionCatalogControl(params) {
2928
2903
  directHomes.set(key, home);
2929
2904
  }
2930
2905
  const homeId = await home;
2931
- await retiringState.get(homeId);
2932
- if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
2933
2906
  let index = indexes.get(homeId);
2934
2907
  if (!index) {
2935
- const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./.setup/session-catalog-index-CrnfVEnT.mjs"), import("./.setup/session-catalog-projection-BzHiV818.mjs")]);
2936
- source?.assertCurrent();
2937
- if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
2908
+ const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./.setup/session-catalog-index-BfzfdtH7.mjs"), import("./.setup/session-catalog-projection-BjWE414G.mjs")]);
2909
+ if (closed) throw new Error("Codex resident catalog is closed");
2938
2910
  index = indexes.get(homeId);
2939
2911
  if (index) return index;
2940
2912
  const root = source?.localSessionsRoot ?? (runtime.connectionClass !== "remote" ? path.join(resolveCodexAppServerLocalHomeDir(requestOptions.startOptions, requestOptions.agentDir, params.env), "sessions") : void 0);
@@ -2958,8 +2930,7 @@ function createCodexSessionCatalogControl(params) {
2958
2930
  }
2959
2931
  },
2960
2932
  assertCurrent: () => {
2961
- source?.assertCurrent();
2962
- if (closed || params.getRuntimeConfig() !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
2933
+ if (closed) throw new Error("Codex resident catalog is closed");
2963
2934
  },
2964
2935
  readNative: async (query, remainingRows, foreground) => {
2965
2936
  const requests = createRequestSnapshot(agentId, source, true, query.useStateDbOnly ? (thread) => {
@@ -3057,7 +3028,7 @@ function createCodexSessionCatalogControl(params) {
3057
3028
  const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
3058
3029
  const requestOptions = resolveRequestOptions(runtime.start, agentId, source);
3059
3030
  return createCodexCatalogRequestSnapshot(runtime.requestTimeoutMs, async (method, requestParams, timeoutMs, assertCurrent, observation) => {
3060
- const { codexControlRequest } = await import("./.setup/command-rpc-HIvsy3wS.mjs").then((n) => n.n);
3031
+ const { codexControlRequest } = await import("./.setup/command-rpc-SXqLQukR.mjs").then((n) => n.n);
3061
3032
  return await codexControlRequest(pluginConfig, method, requestParams, {
3062
3033
  ...requestOptions,
3063
3034
  authProfileId: null,
@@ -3079,9 +3050,9 @@ function createCodexSessionCatalogControl(params) {
3079
3050
  const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
3080
3051
  const { agentDir, config: runtimeConfig, startOptions } = resolveRequestOptions(runtime.start, agentId, source);
3081
3052
  let catalogIndex;
3082
- const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./.setup/shared-client-BCx1wbyA.mjs").then((n) => n.v);
3083
- const { resolveCodexAppServerClientInstanceId } = await import("./.setup/client-D93nbdB8.mjs").then((n) => n.n);
3084
- const { requestCodexAppServerClientJson } = await import("./.setup/request-Bo0kKABI.mjs").then((n) => n.i);
3053
+ const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./.setup/shared-client-CE_uY0A1.mjs").then((n) => n.m);
3054
+ const { resolveCodexAppServerClientInstanceId } = await import("./.setup/client-BS8X7HmG.mjs").then((n) => n.n);
3055
+ const { requestCodexAppServerClientJson } = await import("./.setup/request-ePeNJrOd.mjs").then((n) => n.i);
3085
3056
  const client = await getLeasedSharedCodexAppServerClient({
3086
3057
  agentDir,
3087
3058
  config: runtimeConfig,
@@ -3150,7 +3121,7 @@ function createCodexSessionCatalogControl(params) {
3150
3121
  await Promise.allSettled(residentRequests);
3151
3122
  const clients = getSharedCodexAppServerClientState();
3152
3123
  if (clients.liveClients.size > 0 || clients.startup.pending.size > 0) {
3153
- const { clearSharedCodexAppServerClientAndWait } = await import("./.setup/shared-client-BCx1wbyA.mjs").then((n) => n.v);
3124
+ const { clearSharedCodexAppServerClientAndWait } = await import("./.setup/shared-client-CE_uY0A1.mjs").then((n) => n.m);
3154
3125
  await clearSharedCodexAppServerClientAndWait();
3155
3126
  }
3156
3127
  },
@@ -3214,47 +3185,27 @@ function resolveLocalCatalogHomeForThread(params) {
3214
3185
  return exact;
3215
3186
  }
3216
3187
  function withCatalogListScope(initialize) {
3217
- let create = initialize;
3188
+ let initialization;
3218
3189
  let operation;
3219
3190
  let scope;
3220
- let running = false;
3221
3191
  let closed = false;
3222
3192
  let completed = false;
3223
3193
  return {
3224
3194
  async next() {
3225
- if (closed || running) throw new Error("Codex catalog list operation cannot advance");
3226
- running = true;
3227
- try {
3228
- scope ??= createCodexCatalogListScope();
3229
- return await scope.run(async () => {
3230
- if (create) {
3231
- const initializeOnce = create;
3232
- create = void 0;
3233
- operation = await initializeOnce();
3234
- }
3235
- if (!operation) throw new Error("Codex catalog list operation did not initialize");
3236
- const step = await operation.next();
3237
- completed ||= step.done;
3238
- return step;
3239
- });
3240
- } finally {
3241
- running = false;
3242
- }
3195
+ if (closed) throw new Error("Codex catalog list operation cannot advance");
3196
+ scope ??= createCodexCatalogListScope();
3197
+ return scope.run(async () => {
3198
+ operation ??= await (initialization ??= initialize());
3199
+ const step = await operation.next();
3200
+ completed ||= step.done;
3201
+ return step;
3202
+ });
3243
3203
  },
3244
3204
  close() {
3245
3205
  if (closed) return;
3246
- if (running) throw new Error("Cannot close an active Codex catalog list step");
3206
+ scope?.run(() => operation?.close());
3247
3207
  closed = true;
3248
- create = void 0;
3249
- const current = operation;
3250
- operation = void 0;
3251
- const currentScope = scope;
3252
- scope = void 0;
3253
- try {
3254
- if (currentScope) currentScope.run(() => current?.close());
3255
- } finally {
3256
- currentScope?.finish(completed ? "resolved" : "rejected");
3257
- }
3208
+ scope?.finish(completed ? "resolved" : "rejected");
3258
3209
  }
3259
3210
  };
3260
3211
  }
@@ -3395,7 +3346,7 @@ function registerCodexSessionCatalog(params) {
3395
3346
  if (!config) throw new Error("OpenClaw runtime config is unavailable");
3396
3347
  if (request.hostId.startsWith("node:")) {
3397
3348
  const agentId = resolveRequestAgentId(request.agentId);
3398
- const { continueNodeCodexSession } = await import("./.setup/session-catalog-node-continue-CNJibO4_.mjs");
3349
+ const { continueNodeCodexSession } = await import("./.setup/session-catalog-node-continue-H7nrzcUD.mjs");
3399
3350
  return await continueNodeCodexSession({
3400
3351
  agentId,
3401
3352
  api: params.api,
@@ -3410,7 +3361,7 @@ function registerCodexSessionCatalog(params) {
3410
3361
  const { agentId, source, control } = await bindLocalRequest(request);
3411
3362
  source.assertCurrent();
3412
3363
  let upstreamBaseline;
3413
- const { continueLocalCodexSession } = await import("./.setup/session-catalog-adoption-Ca3OYGYM.mjs");
3364
+ const { continueLocalCodexSession } = await import("./.setup/session-catalog-adoption-ppsLlVLB.mjs");
3414
3365
  const continued = await continueLocalCodexSession({
3415
3366
  agentId,
3416
3367
  api: params.api,
@@ -3439,7 +3390,7 @@ function registerCodexSessionCatalog(params) {
3439
3390
  if (!config) throw new Error("OpenClaw runtime config is unavailable");
3440
3391
  const { agentId, source, control } = await bindLocalRequest(request);
3441
3392
  source.assertCurrent();
3442
- const { archiveLocalCodexSession } = await import("./.setup/session-catalog-archive-Bv6gV7x9.mjs");
3393
+ const { archiveLocalCodexSession } = await import("./.setup/session-catalog-archive-CqLRHJ6z.mjs");
3443
3394
  await archiveLocalCodexSession({
3444
3395
  agentId,
3445
3396
  bindingStore: params.bindingStore,
@@ -3641,10 +3592,8 @@ function readLegacyEnvEndpoints(env) {
3641
3592
  }
3642
3593
  return raw.split(",").map(endpointFromToken).filter((entry) => Boolean(entry));
3643
3594
  }
3644
- function resolveEndpoints(pluginConfig, options) {
3595
+ function normalizeEndpoints(pluginConfig, options) {
3645
3596
  const env = options.env ?? process.env;
3646
- const runtimeConfig = options.getRuntimeConfig?.();
3647
- const { resolveAuthProfileId, resolveRuntimeOptions } = options;
3648
3597
  const configured = readCodexPluginConfig(pluginConfig).supervision?.endpoints;
3649
3598
  const endpoints = configured?.length ? configured : readLegacyEnvEndpoints(env);
3650
3599
  const normalized = endpoints ? endpoints.map((endpoint, index) => {
@@ -3661,14 +3610,20 @@ function resolveEndpoints(pluginConfig, options) {
3661
3610
  if (seen.has(endpoint.id)) throw new Error(`duplicate Codex supervisor endpoint id: ${endpoint.id}`);
3662
3611
  seen.add(endpoint.id);
3663
3612
  }
3664
- return normalized.map((endpoint) => Object.assign({}, endpoint, { connectionKey: supervisionEndpointConnectionKey({
3613
+ return normalized;
3614
+ }
3615
+ async function resolveEndpoints(pluginConfig, options) {
3616
+ const env = options.env ?? process.env;
3617
+ const runtimeConfig = options.getRuntimeConfig?.();
3618
+ const { resolveAuthProfileId, resolveRuntimeOptions } = options;
3619
+ return await Promise.all(normalizeEndpoints(pluginConfig, options).map(async (endpoint) => Object.assign({}, endpoint, { connectionKey: await supervisionEndpointConnectionKey({
3665
3620
  endpoint,
3666
3621
  pluginConfig,
3667
3622
  env,
3668
3623
  runtimeConfig,
3669
3624
  resolveAuthProfileId,
3670
3625
  resolveRuntimeOptions
3671
- }) }));
3626
+ }) })));
3672
3627
  }
3673
3628
  function resolveEndpointStartOptions(params) {
3674
3629
  const base = params.resolveRuntimeOptions({
@@ -3706,17 +3661,26 @@ function resolveEndpointStartOptions(params) {
3706
3661
  if (params.validateSecurity !== false) assertCodexAppServerConnectionSecurity(startOptions);
3707
3662
  return startOptions;
3708
3663
  }
3709
- function supervisionEndpointConnectionKey(params) {
3664
+ function endpointConnectionContext(params) {
3710
3665
  const startOptions = resolveEndpointStartOptions({
3711
3666
  ...params,
3712
3667
  validateSecurity: false
3713
3668
  });
3714
3669
  const usesNativeAuth = params.endpoint.configured !== void 0 || startOptions.homeScope === "user";
3715
- const agentDir = usesNativeAuth ? void 0 : resolveDefaultAgentDir(params.runtimeConfig ?? {});
3716
- const authProfileId = usesNativeAuth ? void 0 : params.resolveAuthProfileId({
3670
+ return {
3671
+ startOptions,
3672
+ usesNativeAuth,
3673
+ agentDir: usesNativeAuth ? void 0 : resolveDefaultAgentDir(params.runtimeConfig ?? {})
3674
+ };
3675
+ }
3676
+ async function supervisionEndpointConnectionKey(params) {
3677
+ const { startOptions, usesNativeAuth, agentDir } = endpointConnectionContext(params);
3678
+ return encodeEndpointConnectionKey(startOptions, agentDir, usesNativeAuth ? void 0 : await params.resolveAuthProfileId({
3717
3679
  agentDir,
3718
3680
  config: params.runtimeConfig
3719
- });
3681
+ }));
3682
+ }
3683
+ function encodeEndpointConnectionKey(startOptions, agentDir, authProfileId) {
3720
3684
  const fallbackApiKeyCacheKey = authProfileId ? void 0 : resolveCodexAppServerFallbackApiKeyCacheKey({ startOptions });
3721
3685
  return JSON.stringify({
3722
3686
  homeScope: startOptions.homeScope ?? null,
@@ -3729,7 +3693,7 @@ function supervisionEndpointConnectionKey(params) {
3729
3693
  }
3730
3694
  function createPolicyGuardedRequest(options, policy) {
3731
3695
  return async (endpoint, method, requestParams) => {
3732
- const currentEndpoint = requireCurrentEndpoint(options, policy, endpoint);
3696
+ const currentEndpoint = await requireCurrentEndpoint(options, policy, endpoint);
3733
3697
  if (options.request) return await options.request(currentEndpoint, method, requestParams);
3734
3698
  const pluginConfig = options.getPluginConfig();
3735
3699
  const env = options.env ?? process.env;
@@ -3750,7 +3714,7 @@ function createPolicyGuardedRequest(options, policy) {
3750
3714
  timeoutMs: runtime.requestTimeoutMs,
3751
3715
  startOptions,
3752
3716
  assertCurrent: () => {
3753
- requireCurrentEndpoint(options, policy, currentEndpoint);
3717
+ assertCurrentEndpointAtEffect(options, policy, currentEndpoint);
3754
3718
  },
3755
3719
  ...endpoint.configured || startOptions.homeScope === "user" ? { authProfileId: null } : {},
3756
3720
  ...config ? { config } : {}
@@ -3916,16 +3880,6 @@ async function resolveInProgressTurnId(params) {
3916
3880
  return;
3917
3881
  }
3918
3882
  }
3919
- function redactString(value) {
3920
- return value.replace(/\b(?:sk|glpat|xox[baprs])-[-_a-zA-Z0-9]{12,}\b/g, "[redacted]").replace(/\b(?:ghp|gho|ghu|ghs)_[-_a-zA-Z0-9]{12,}\b/g, "[redacted]").replace(/\bBearer\s+[-._~+/a-zA-Z0-9]+=*/g, "Bearer [redacted]");
3921
- }
3922
- /** Redacts secret-bearing fields before legacy tool results leave the plugin. */
3923
- function redactCodexSupervisionValue(value, key = "") {
3924
- if (typeof value === "string") return /authorization|password|secret|token|api[-_]?key/i.test(key) ? "[redacted]" : redactString(value);
3925
- if (Array.isArray(value)) return value.map((entry) => redactCodexSupervisionValue(entry));
3926
- if (!isRecord(value)) return value;
3927
- return Object.fromEntries(Object.entries(value).map(([entryKey, entryValue]) => [entryKey, redactCodexSupervisionValue(entryValue, entryKey)]));
3928
- }
3929
3883
  function redactEndpointUrl(value) {
3930
3884
  if (value.startsWith("unix://")) return "unix://";
3931
3885
  const url = URL.parse(value);
@@ -3948,47 +3902,65 @@ function endpointResult(endpoint, pluginConfig, env, resolveRuntimeOptions) {
3948
3902
  ...remote
3949
3903
  };
3950
3904
  }
3951
- function sanitizeSessionListResult(result, includeTranscriptDerivedFields) {
3905
+ function projectSessionListResult(result, includeTranscriptDerivedFields) {
3906
+ if (includeTranscriptDerivedFields) return result;
3952
3907
  return {
3953
- sessions: result.sessions.map((session) => {
3954
- const sanitized = redactCodexSupervisionValue(session);
3955
- if (!includeTranscriptDerivedFields) {
3956
- delete sanitized.preview;
3957
- delete sanitized.name;
3958
- }
3959
- return sanitized;
3960
- }),
3961
- errors: includeTranscriptDerivedFields ? redactCodexSupervisionValue(result.errors) : result.errors.map(({ endpointId, ok }) => ({
3908
+ sessions: result.sessions.map(({ preview: _preview, name: _name, ...session }) => session),
3909
+ errors: result.errors.map(({ endpointId, ok }) => ({
3962
3910
  endpointId,
3963
3911
  ok
3964
3912
  }))
3965
3913
  };
3966
3914
  }
3967
- function requireLiveToolPolicy(options, policy) {
3915
+ async function requireLiveToolPolicy(options, policy) {
3916
+ const pluginConfig = requireLiveToolPolicyConfig(options, policy);
3917
+ return {
3918
+ pluginConfig,
3919
+ endpoints: await resolveEndpoints(pluginConfig, options)
3920
+ };
3921
+ }
3922
+ function requireLiveToolPolicyConfig(options, policy) {
3968
3923
  options.assertInvocationCurrent?.();
3969
3924
  if (!options.senderIsOwner) throw new CodexSupervisionPolicyError("Codex supervision compatibility tools require an owner-authorized sender.");
3970
3925
  const pluginConfig = options.getPluginConfig();
3971
3926
  requireToolPolicy(pluginConfig, policy);
3972
- return {
3973
- pluginConfig,
3974
- endpoints: resolveEndpoints(pluginConfig, options)
3975
- };
3927
+ return pluginConfig;
3976
3928
  }
3977
3929
  function requireToolPolicy(pluginConfig, policy) {
3978
3930
  const config = readCodexPluginConfig(pluginConfig).supervision;
3979
3931
  const error = config?.enabled !== true ? "Codex supervision is disabled in the codex plugin config." : policy === "raw-transcripts" && config.allowRawTranscripts !== true ? "Codex session reads are disabled for this codex plugin supervision config." : policy === "write-controls" && config.allowWriteControls !== true ? "Codex write controls are disabled for this codex plugin supervision config." : void 0;
3980
3932
  if (error) throw new CodexSupervisionPolicyError(error);
3981
3933
  }
3982
- function requireCurrentEndpoint(options, policy, endpoint) {
3983
- const { endpoints } = requireLiveToolPolicy(options, policy);
3934
+ async function requireCurrentEndpoint(options, policy, endpoint) {
3935
+ const { endpoints } = await requireLiveToolPolicy(options, policy);
3984
3936
  const currentEndpoint = endpoints.find((candidate) => candidate.id === endpoint.id);
3985
3937
  if (!currentEndpoint || currentEndpoint.connectionKey !== endpoint.connectionKey) throw new CodexSupervisionPolicyError(`Codex supervision endpoint ${endpoint.id} was removed or changed during the request.`);
3986
3938
  return currentEndpoint;
3987
3939
  }
3940
+ function assertCurrentEndpointAtEffect(options, policy, endpoint) {
3941
+ const pluginConfig = requireLiveToolPolicyConfig(options, policy);
3942
+ const current = normalizeEndpoints(pluginConfig, options).find((candidate) => candidate.id === endpoint.id);
3943
+ if (!current) throw new CodexSupervisionPolicyError(`Codex supervision endpoint ${endpoint.id} was removed or changed during the request.`);
3944
+ const runtimeConfig = options.getRuntimeConfig?.();
3945
+ const { startOptions, usesNativeAuth, agentDir } = endpointConnectionContext({
3946
+ endpoint: current,
3947
+ pluginConfig,
3948
+ env: options.env ?? process.env,
3949
+ runtimeConfig,
3950
+ resolveAuthProfileId: options.resolveAuthProfileId,
3951
+ resolveRuntimeOptions: options.resolveRuntimeOptions
3952
+ });
3953
+ if (encodeEndpointConnectionKey(startOptions, agentDir, usesNativeAuth ? void 0 : options.resolveAuthProfileIdAtEffect({
3954
+ agentDir,
3955
+ config: runtimeConfig
3956
+ })) !== endpoint.connectionKey) throw new CodexSupervisionPolicyError(`Codex supervision endpoint ${endpoint.id} was removed or changed during the request.`);
3957
+ }
3988
3958
  function requireCurrentEndpointSet(options, expected) {
3989
- const current = requireLiveToolPolicy(options, "enabled");
3990
- if (!(current.endpoints.length === expected.length && expected.every((endpoint) => current.endpoints.some((candidate) => candidate.id === endpoint.id && candidate.connectionKey === endpoint.connectionKey)))) throw new CodexSupervisionPolicyError("Codex supervision endpoint configuration changed during the request.");
3991
- return { pluginConfig: current.pluginConfig };
3959
+ const pluginConfig = requireLiveToolPolicyConfig(options, "enabled");
3960
+ const current = normalizeEndpoints(pluginConfig, options);
3961
+ if (!(current.length === expected.length && expected.every((endpoint) => current.some((candidate) => candidate.id === endpoint.id)))) throw new CodexSupervisionPolicyError("Codex supervision endpoint configuration changed during the request.");
3962
+ for (const endpoint of expected) assertCurrentEndpointAtEffect(options, "enabled", endpoint);
3963
+ return { pluginConfig };
3992
3964
  }
3993
3965
  function idleContinuationError(threadId) {
3994
3966
  return /* @__PURE__ */ new Error(`Codex thread ${threadId} is idle. Continue it from Codex Sessions so OpenClaw can install the Codex harness approval and tool handlers before resume.`);
@@ -3999,7 +3971,7 @@ function createCodexSupervisionTools(options) {
3999
3971
  const writeRequest = createPolicyGuardedRequest(options, "write-controls");
4000
3972
  const current = () => requireLiveToolPolicy(options, "enabled");
4001
3973
  const controlActiveTurn = async (rawParams, action) => {
4002
- const { endpoints, pluginConfig } = current();
3974
+ const { endpoints, pluginConfig } = await current();
4003
3975
  requireToolPolicy(pluginConfig, "write-controls");
4004
3976
  const params = isRecord(rawParams) ? rawParams : {};
4005
3977
  const threadId = readStringParam(params, "thread_id", { required: true });
@@ -4024,7 +3996,7 @@ function createCodexSupervisionTools(options) {
4024
3996
  threadId,
4025
3997
  includeTurns: true
4026
3998
  });
4027
- requireCurrentEndpoint(options, "write-controls", endpoint);
3999
+ await requireCurrentEndpoint(options, "write-controls", endpoint);
4028
4000
  if (statusType(thread) !== "active") throw action === "steer" ? idleContinuationError(threadId) : /* @__PURE__ */ new Error(`Codex thread ${threadId} has no active turn to interrupt`);
4029
4001
  const turnId = (action === "interrupt" ? readStringParam(params, "turn_id") : void 0) ?? await resolveInProgressTurnId({
4030
4002
  request: writeRequest,
@@ -4059,7 +4031,7 @@ function createCodexSupervisionTools(options) {
4059
4031
  description: "Check configured Codex app-server endpoints.",
4060
4032
  parameters: EmptyParamsSchema,
4061
4033
  execute: async () => {
4062
- const { pluginConfig, endpoints } = current();
4034
+ const { endpoints } = await current();
4063
4035
  const health = [];
4064
4036
  for (const endpoint of endpoints) try {
4065
4037
  await request(endpoint, "thread/loaded/list", { limit: 1 });
@@ -4074,7 +4046,7 @@ function createCodexSupervisionTools(options) {
4074
4046
  ok: false
4075
4047
  });
4076
4048
  }
4077
- requireCurrentEndpointSet(options, endpoints);
4049
+ const { pluginConfig } = requireCurrentEndpointSet(options, endpoints);
4078
4050
  return jsonResult({
4079
4051
  summary: `codex endpoints: ${health.filter((entry) => entry.ok).length}/${health.length} ok`,
4080
4052
  endpoints: endpoints.map((endpoint) => endpointResult(endpoint, pluginConfig, options.env ?? process.env, options.resolveRuntimeOptions)),
@@ -4089,7 +4061,7 @@ function createCodexSupervisionTools(options) {
4089
4061
  parameters: SessionsListParamsSchema,
4090
4062
  execute: async (_toolCallId, rawParams) => {
4091
4063
  const params = isRecord(rawParams) ? rawParams : {};
4092
- const { endpoints } = current();
4064
+ const { endpoints } = await current();
4093
4065
  const result = await listSessionSnapshot({
4094
4066
  endpoints,
4095
4067
  request,
@@ -4099,7 +4071,7 @@ function createCodexSupervisionTools(options) {
4099
4071
  const { pluginConfig } = requireCurrentEndpointSet(options, endpoints);
4100
4072
  return jsonResult({
4101
4073
  summary: `codex sessions: ${result.sessions.length}`,
4102
- ...sanitizeSessionListResult(result, readCodexPluginConfig(pluginConfig).supervision?.allowRawTranscripts === true)
4074
+ ...projectSessionListResult(result, readCodexPluginConfig(pluginConfig).supervision?.allowRawTranscripts === true)
4103
4075
  });
4104
4076
  }
4105
4077
  },
@@ -4109,7 +4081,7 @@ function createCodexSupervisionTools(options) {
4109
4081
  description: "Read one Codex session transcript from app-server.",
4110
4082
  parameters: SessionReadParamsSchema,
4111
4083
  execute: async (_toolCallId, rawParams) => {
4112
- const { endpoints, pluginConfig } = current();
4084
+ const { endpoints, pluginConfig } = await current();
4113
4085
  requireToolPolicy(pluginConfig, "raw-transcripts");
4114
4086
  const params = isRecord(rawParams) ? rawParams : {};
4115
4087
  const threadId = readStringParam(params, "thread_id", { required: true });
@@ -4125,10 +4097,10 @@ function createCodexSupervisionTools(options) {
4125
4097
  threadId,
4126
4098
  includeTurns: params.include_turns === true
4127
4099
  });
4128
- requireCurrentEndpoint(options, "raw-transcripts", endpoint);
4100
+ assertCurrentEndpointAtEffect(options, "raw-transcripts", endpoint);
4129
4101
  return jsonResult({
4130
4102
  summary: `codex session: ${threadId}`,
4131
- response: redactCodexSupervisionValue({ thread })
4103
+ response: { thread }
4132
4104
  });
4133
4105
  }
4134
4106
  },
@@ -4150,7 +4122,7 @@ function createCodexSupervisionTools(options) {
4150
4122
  }
4151
4123
  //#endregion
4152
4124
  //#region extensions/codex/src/web-search-provider.ts
4153
- const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-D89djc7e.mjs"));
4125
+ const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-DMHxve5v.mjs"));
4154
4126
  const CodexWebSearchSchema = {
4155
4127
  type: "object",
4156
4128
  properties: { query: {
@@ -4227,26 +4199,17 @@ var codex_default = definePluginEntry({
4227
4199
  overflowPolicy: "reject-new"
4228
4200
  };
4229
4201
  const openBindingStateStore = () => bindingStateStore ??= api.runtime.state.openSyncKeyedStore(bindingStateOptions);
4230
- const openBindingMutationStore = () => bindingMutationStore ??= api.runtime.state.openKeyedStore(bindingStateOptions);
4202
+ const openBindingMutationStore = () => bindingMutationStore ??= api.runtime.state.openKeyedStoreV2(bindingStateOptions);
4231
4203
  const lazyBindingStateStore = {
4232
- deleteIf: (key, predicate) => openBindingStateStore().deleteIf(key, predicate),
4233
- entries: () => openBindingStateStore().entries(),
4234
4204
  lookup: (key) => openBindingStateStore().lookup(key),
4235
4205
  asyncReads: {
4236
4206
  lookup: (key) => openBindingMutationStore().lookup(key),
4237
- get lookupMany() {
4238
- const store = openBindingMutationStore();
4239
- return store.lookupMany?.bind(store);
4240
- }
4207
+ lookupMany: (keys) => openBindingMutationStore().lookupMany(keys),
4208
+ entries: () => openBindingMutationStore().entries()
4241
4209
  },
4242
- registerIfAbsent: (key, value, options) => openBindingStateStore().registerIfAbsent(key, value, options),
4243
- withCurrent: (authority) => {
4244
- const store = openBindingMutationStore();
4245
- if (!store.withCurrent) throw new Error("Codex bindings require action-bound plugin-state mutations");
4246
- return store.withCurrent(authority);
4247
- }
4210
+ withCurrent: (authority) => api.runtime.state.openKeyedStoreV2(bindingStateOptions, authority)
4248
4211
  };
4249
- const openManagedThreadStateStore = () => managedThreadStateStore ??= api.runtime.state.openKeyedStore({
4212
+ const openManagedThreadStateStore = () => managedThreadStateStore ??= api.runtime.state.openKeyedStoreV2({
4250
4213
  namespace: CODEX_MANAGED_THREAD_NAMESPACE,
4251
4214
  maxEntries: CODEX_MANAGED_THREAD_MAX_ENTRIES,
4252
4215
  overflowPolicy: "evict-oldest"
@@ -4263,7 +4226,7 @@ var codex_default = definePluginEntry({
4263
4226
  config: api.config,
4264
4227
  getPluginConfig: resolveCurrentPluginConfig,
4265
4228
  getRuntimeConfig: resolveCurrentConfig,
4266
- openResidentState: (homeId) => api.runtime.state.openKeyedStore({
4229
+ openResidentState: (homeId) => api.runtime.state.openKeyedStoreV2({
4267
4230
  namespace: `${CODEX_CATALOG_STATE_NAMESPACE}.${homeId.replaceAll(":", "-")}`,
4268
4231
  maxEntries: CODEX_CATALOG_MAX_ROWS + 1,
4269
4232
  overflowPolicy: "reject-new"
@@ -4288,7 +4251,7 @@ var codex_default = definePluginEntry({
4288
4251
  }
4289
4252
  for (const policy of createCodexSessionCatalogNodeInvokePolicies()) api.registerNodeInvokePolicy(policy);
4290
4253
  if (readCodexPluginConfig(resolveCurrentPluginConfig()).supervision?.enabled === true) {
4291
- const { resolveCodexAppServerAuthProfileIdForAgent } = createCodexAuthProfileSelection(api.runtime.modelAuth);
4254
+ const { resolveCodexAppServerAuthProfileIdForAgent, resolveCodexAppServerAuthProfileIdAtEffect } = createCodexAuthProfileSelection(api.runtime.modelAuth);
4292
4255
  api.registerTool({
4293
4256
  contextVersion: 2,
4294
4257
  create: (context) => {
@@ -4298,6 +4261,7 @@ var codex_default = definePluginEntry({
4298
4261
  getPluginConfig: () => resolvePluginConfig(resolveToolRuntimeConfig),
4299
4262
  getRuntimeConfig: resolveToolRuntimeConfig,
4300
4263
  resolveAuthProfileId: resolveCodexAppServerAuthProfileIdForAgent,
4264
+ resolveAuthProfileIdAtEffect: resolveCodexAppServerAuthProfileIdAtEffect,
4301
4265
  resolveRuntimeOptions: resolveCodexSupervisionAppServerRuntimeOptions,
4302
4266
  senderIsOwner: context.senderIsOwner,
4303
4267
  assertInvocationCurrent: context.assertInvocationCurrent
@@ -4415,7 +4379,7 @@ var codex_default = definePluginEntry({
4415
4379
  if (endedSessionKey && nextSessionKey && nextSessionKey !== endedSessionKey) return;
4416
4380
  if (event.nextSessionId?.trim() === event.sessionId.trim()) return;
4417
4381
  const config = resolveCurrentConfig();
4418
- const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-JEHNMPsr.mjs").then((n) => n.a), import("./.setup/session-retirement-B3U5hpGJ.mjs")]);
4382
+ const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-BgsWcbdY.mjs").then((n) => n.a), import("./.setup/session-retirement-Ci_JvOfH.mjs")]);
4419
4383
  await retireCodexAppServerSessionGeneration({
4420
4384
  bindingStore,
4421
4385
  identity: sessionBindingIdentity({