@openclaw/codex 2026.10.5-beta.3 → 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-CBR8imwK.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-CfWD3Bk6.mjs → apply-BVSXYkTV.mjs} +11 -11
  5. package/dist/.setup/{attempt-client-cleanup-D3YvP0N7.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-BzYrcgwJ.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-BmChqNaK.mjs → bounded-turn-mN_ekXYW.mjs} +18 -22
  17. package/dist/.setup/{build-state-sjOWPg_o.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-aPKNc4Ii.mjs → client-BS8X7HmG.mjs} +47 -317
  20. package/dist/.setup/{client-catalog-response-Du2GmrOV.mjs → client-catalog-response-jM38o5w1.mjs} +2 -2
  21. package/dist/.setup/client-initialize-CjgZcX61.mjs +165 -0
  22. package/dist/.setup/{command-dispatch-CF6mgl3u.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-DlycReQg.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-C6yYfm6-.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-CP_mK17t.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-DKko0Jjw.mjs → dynamic-tool-build-BjFAIG-f.mjs} +208 -218
  39. package/dist/.setup/{dynamic-tools-8hqa1jVc.mjs → dynamic-tools-XqWsVjcC.mjs} +344 -118
  40. package/dist/.setup/{effective-mcp-catalog-uIZ4w7Nh.mjs → effective-mcp-catalog-C3ta5hHc.mjs} +11 -9
  41. package/dist/.setup/{ephemeral-turn-DAlEbytF.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-BWEjVHBf.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-CJR8ib5s.mjs → mcp-app-session-preparation-fnsnCovu.mjs} +18 -14
  54. package/dist/.setup/{model-catalog-Ben3FsFp.mjs → model-catalog-Y_esgRPY.mjs} +28 -17
  55. package/dist/.setup/{models-BB0l-gUb.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-DQzvuJ-W.mjs → native-hook-relay-C7aaLJaP.mjs} +45 -10
  59. package/dist/.setup/{native-mcp-app-UkwXOBfS.mjs → native-mcp-app-CsWj-v_x.mjs} +5 -5
  60. package/dist/.setup/{native-skill-isolation-DoRxgQPX.mjs → native-skill-isolation-CMimsKYy.mjs} +7 -7
  61. package/dist/.setup/{native-subagent-monitor-DC4clzAD.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-DFVngccH.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-68FoMlaZ.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-DWH29sy3.mjs → provider-capabilities-DjcKunHS.mjs} +1 -1
  75. package/dist/.setup/{provider-BCXRBKEb.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-DInueZ2q.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-BN-0TO0P.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-DujfzcAY.mjs → session-catalog-events-DK0opVp3.mjs} +5 -5
  93. package/dist/.setup/{session-catalog-index-DQ9_sj42.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-BY2zMkMO.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-BTXOyzl_.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-yQpy2Y6b.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-CIDqLMII.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-C6tjH8RJ.mjs → settled-turn-finalizer-D3-KXsbP.mjs} +8 -8
  112. package/dist/.setup/{shared-client-CCz9ldpr.mjs → shared-client-CE_uY0A1.mjs} +380 -557
  113. package/dist/.setup/side-question-OM18H9WJ.mjs +998 -0
  114. package/dist/.setup/{source-DsubBCYm.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-CxVfnkG-.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-_2e1sjfi.mjs → thread-ownership-t6Y9fLQS.mjs} +7 -7
  119. package/dist/.setup/{thread-policy-CLTwg3ZA.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-C6qsk8_o.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-CSJl3yYQ.mjs → turn-router-Dbw17k3K.mjs} +2 -2
  127. package/dist/.setup/{upstream-session-fork-BC45E4Pe.mjs → upstream-session-fork-_LYkh0nZ.mjs} +46 -219
  128. package/dist/.setup/{usage-limit-error-CJoJ_F8V.mjs → usage-limit-error-DcOSH3J4.mjs} +4 -4
  129. package/dist/.setup/{usage-1eNaNDM2.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-Qq_wUrvv.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-CUy4Bo-0.mjs +0 -247
  151. package/dist/.setup/compact-BCCjM_cb.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-COaYBoON.mjs +0 -826
@@ -1,4 +1,4 @@
1
- import { t as attemptTerminal } from "./attempt-terminal-jO5IMj9K.mjs";
1
+ import { t as attemptTerminal } from "./attempt-terminal-sZutF0WY.mjs";
2
2
  import path from "node:path";
3
3
  import fs from "node:fs/promises";
4
4
  import { awaitAgentEndSideEffects, embeddedAgentLog, formatErrorMessage, runAgentCleanupStep, runAgentEndSideEffectsAsync } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -1,7 +1,7 @@
1
1
  import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
2
- import { a as resolvePackagedCodexNativeCommand } from "./managed-binary-BtIjV7yN.mjs";
3
- import { n as resolveCodexAppServerSpawnEnv, r as resolveCodexAppServerSpawnInvocation } from "./transport-stdio-CRWTkKOn.mjs";
4
- import { captureCodexConfiguredConnection, finalizeCodexConfiguredConnection, isCodexConfiguredConnectionArtifact, validateCodexConfiguredConnectionCapture } from "./runtime-artifact-connection-jS5DeCok.mjs";
2
+ import { p as resolvePackagedCodexNativeCommand } from "./managed-binary-DbKvGXKl.mjs";
3
+ import { n as resolveCodexAppServerSpawnEnv, r as resolveCodexAppServerSpawnInvocation } from "./transport-stdio-Bq160Dhv.mjs";
4
+ import { captureCodexConfiguredConnection, finalizeCodexConfiguredConnection, isCodexConfiguredConnectionArtifact, validateCodexConfiguredConnectionCapture } from "./runtime-artifact-connection-DpWlZ02e.mjs";
5
5
  import { createHash } from "node:crypto";
6
6
  import { resolveWindowsExecutablePath } from "openclaw/plugin-sdk/windows-spawn";
7
7
  import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
@@ -1,6 +1,6 @@
1
- import { t as codexAppServerStartOptionsKey } from "./config-options-DDzeNQ8m.mjs";
2
- import "./config-runtime-DWzK-k0n.mjs";
3
- import { r as resolveCodexAppServerUnixSocketPath } from "./transport-websocket-DIyPfkHo.mjs";
1
+ import { t as codexAppServerStartOptionsKey } from "./config-options-DMFZkd3X.mjs";
2
+ import "./config-runtime-BZRizyuG.mjs";
3
+ import { r as resolveCodexAppServerUnixSocketPath } from "./transport-websocket-0YqiI_MH.mjs";
4
4
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { createHash } from "node:crypto";
6
6
  import path from "node:path";
@@ -1,16 +1,13 @@
1
1
  import { l as isCodexRemoteExecPlacementSandbox } from "./config-parsing-DsWSCPHO.mjs";
2
- import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-MXEe7PB3.mjs";
3
- import { t as __exportAll } from "./session-binding-sidecars-DD-enC8w.mjs";
2
+ import { n as prepareCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-D09tLP-u.mjs";
3
+ import { t as __exportAll } from "./session-binding-sidecars-BNSS6WL4.mjs";
4
4
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
5
- import { tryResolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
6
- import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
7
- import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
8
5
  //#region extensions/codex/src/app-server/sandbox-guard.ts
9
- /**
10
- * Blocks direct Codex app-server requests that would bypass OpenClaw sandbox or
11
- * node-exec routing guarantees.
12
- */
13
6
  var sandbox_guard_exports = /* @__PURE__ */ __exportAll({
7
+ assertNativeConversationApprovalPolicySupported: () => assertNativeConversationApprovalPolicySupported,
8
+ prepareCodexAppServerDirectSandboxBypassBlock: () => prepareCodexAppServerDirectSandboxBypassBlock,
9
+ prepareCodexNativeExecutionBlock: () => prepareCodexNativeExecutionBlock,
10
+ prepareCodexNativeSandboxBlock: () => prepareCodexNativeSandboxBlock,
14
11
  resolveCodexAppServerDirectSandboxBypassBlock: () => resolveCodexAppServerDirectSandboxBypassBlock,
15
12
  resolveCodexNativeExecutionBlock: () => resolveCodexNativeExecutionBlock,
16
13
  resolveCodexNativeSandboxBlock: () => resolveCodexNativeSandboxBlock
@@ -59,6 +56,10 @@ function resolveCodexAppServerDirectSandboxBypassBlock(params) {
59
56
  config: params.config,
60
57
  sessionKey: params.sessionKey,
61
58
  sessionId: params.sessionId,
59
+ agentId: params.agentId,
60
+ storePath: params.storePath,
61
+ sessionTarget: params.sessionTarget,
62
+ executionPolicy: params.executionPolicy,
62
63
  surface: `app-server method \`${params.method}\``
63
64
  });
64
65
  if (nodeExecBlock) return nodeExecBlock;
@@ -67,13 +68,63 @@ function resolveCodexAppServerDirectSandboxBypassBlock(params) {
67
68
  const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
68
69
  if (!sessionKey) return;
69
70
  const sandboxBlock = resolveCodexNativeSandboxBlock({
70
- config: params.config,
71
+ ...params,
71
72
  sessionKey,
72
- sandbox: params.sandbox,
73
73
  surface: `app-server method \`${params.method}\``
74
74
  });
75
75
  return sandboxBlock && params.method === "thread/start" && hasOpenClawSandboxEnvironmentSelection(params.requestParams) ? void 0 : sandboxBlock;
76
76
  }
77
+ /** Resolve policy before yielding to client acquisition and recheck it at each write. */
78
+ async function prepareCodexAppServerDirectSandboxBypassBlock(params) {
79
+ if (ALLOWED_CONTROL_PLANE_METHODS.has(params.method) && params.method !== "config/mcpServer/reload") return {
80
+ block: void 0,
81
+ async assertCurrent() {},
82
+ release() {}
83
+ };
84
+ const selected = await prepareCodexNativeExecutionPolicy({
85
+ ...params,
86
+ readRuntimeSessionEntry: true
87
+ });
88
+ return {
89
+ block: resolveCodexAppServerDirectSandboxBypassBlock({
90
+ ...params,
91
+ executionPolicy: selected.policy
92
+ }),
93
+ assertCurrent: selected.assertCurrent,
94
+ source: selected.source,
95
+ release: selected.release
96
+ };
97
+ }
98
+ async function prepareCodexNativeExecutionBlock(params) {
99
+ const selected = await prepareCodexNativeExecutionPolicy({
100
+ ...params,
101
+ readRuntimeSessionEntry: true
102
+ });
103
+ return {
104
+ block: resolveCodexNativeExecutionBlock({
105
+ ...params,
106
+ executionPolicy: selected.policy
107
+ }),
108
+ assertCurrent: selected.assertCurrent,
109
+ source: selected.source,
110
+ release: selected.release
111
+ };
112
+ }
113
+ async function prepareCodexNativeSandboxBlock(params) {
114
+ const selected = await prepareCodexNativeExecutionPolicy({
115
+ ...params,
116
+ readRuntimeSessionEntry: true
117
+ });
118
+ return {
119
+ block: resolveCodexNativeSandboxBlock({
120
+ ...params,
121
+ executionPolicy: selected.policy
122
+ }),
123
+ assertCurrent: selected.assertCurrent,
124
+ source: selected.source,
125
+ release: selected.release
126
+ };
127
+ }
77
128
  /** Resolves the generic native-execution block for sandboxed or node-hosted sessions. */
78
129
  function resolveCodexNativeExecutionBlock(params) {
79
130
  return resolveCodexNativeSandboxBlock(params) ?? resolveCodexNativeNodeExecBlock(params);
@@ -81,18 +132,9 @@ function resolveCodexNativeExecutionBlock(params) {
81
132
  /** Returns a block message when native Codex execution cannot honor active sandboxing. */
82
133
  function resolveCodexNativeSandboxBlock(params) {
83
134
  if (params.sandboxEnvironmentSelected) return;
84
- const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
85
- if (!sessionKey) return;
135
+ if (!(params.sessionKey?.trim() || params.sessionId?.trim())) return;
86
136
  if (isCodexRemoteExecPlacementSandbox(params.sandbox) || params.sandbox?.enabled === true) return formatCodexNativeSandboxBlock({ surface: params.surface });
87
- const sandboxAgentId = parseAgentSessionKey(sessionKey)?.agentId ?? params.agentId ?? tryResolveDefaultAgentId(params.config ?? {});
88
- if (!sandboxAgentId) return;
89
- if (!resolveSandboxRuntimeStatus({
90
- cfg: params.config,
91
- sessionKey,
92
- agentId: sandboxAgentId,
93
- classificationAgentId: sandboxAgentId
94
- }).sandboxed) return;
95
- return formatCodexNativeSandboxBlock({ surface: params.surface });
137
+ return params.executionPolicy.sandboxed ? formatCodexNativeSandboxBlock({ surface: params.surface }) : void 0;
96
138
  }
97
139
  function hasOpenClawSandboxEnvironmentSelection(value) {
98
140
  if (!isRecord(value)) return false;
@@ -107,18 +149,16 @@ function formatCodexNativeSandboxBlock(params) {
107
149
  ].join(" ");
108
150
  }
109
151
  function resolveCodexNativeNodeExecBlock(params) {
110
- const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
111
- const policy = resolveCodexNativeExecutionPolicy({
112
- config: params.config,
113
- sessionKey,
114
- agentId: params.agentId,
115
- readRuntimeSessionEntry: Boolean(sessionKey)
116
- });
152
+ const policy = params.executionPolicy;
117
153
  if (policy.nativeToolSurfaceAllowed) return;
118
154
  return formatCodexNativeNodeExecBlock({
119
155
  surface: params.surface,
120
156
  reason: policy.blockReason
121
157
  });
122
158
  }
159
+ const NATIVE_CONVERSATION_INTERACTIVE_APPROVALS_UNAVAILABLE = "OpenClaw native Codex conversation binding cannot route interactive approvals yet; use the Codex harness or explicit /acp spawn codex for that workflow.";
160
+ function assertNativeConversationApprovalPolicySupported(runtime) {
161
+ if (runtime.approvalPolicy !== "never" && runtime.approvalsReviewer === "user") throw new Error(NATIVE_CONVERSATION_INTERACTIVE_APPROVALS_UNAVAILABLE);
162
+ }
123
163
  //#endregion
124
- export { resolveCodexNativeSandboxBlock as n, sandbox_guard_exports as r, resolveCodexNativeExecutionBlock as t };
164
+ export { sandbox_guard_exports as a, resolveCodexNativeExecutionBlock as i, prepareCodexNativeExecutionBlock as n, prepareCodexNativeSandboxBlock as r, assertNativeConversationApprovalPolicySupported as t };
@@ -1,13 +1,13 @@
1
- import { i as adoptCodexNativeSubagentSubmissions, n as mutateNativePendingAssignments, o as mutateCodexNativeSubagentSubmissions } from "./native-subagent-pending-assignments-DmVhedNs.mjs";
2
- import { a as readStoredCodexAppServerBinding, i as readCodexBindingTimestamp, n as matchesPendingSupervisionBranch, o as stripUndefinedBinding, r as readCodexAppServerThreadBinding, s as validateBindingForWrite } from "./session-binding-record-codec-BpH8u_G9.mjs";
3
- import { a as ownsStoredSessionGeneration, c as preserveNativeTaskImport, d as readCurrentCodexNativeSubagentSubmissions, f as readCurrentNativePendingAssignments, i as matchesCodexNativeSubagentSubmissionBinding, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, o as preserveCodexNativeSubagentSubmissions, p as readPluginAppPolicyContext, r as bindingStoreKey, s as preserveNativePendingAssignments, t as CodexSupervisionBindingReplacementError, u as readCurrentCodexAppServerBindings } from "./session-binding-record-DU_0biMD.mjs";
1
+ import { i as adoptCodexNativeSubagentSubmissions, n as mutateNativePendingAssignments, o as mutateCodexNativeSubagentSubmissions } from "./native-subagent-pending-assignments-CTinVtjo.mjs";
2
+ import { a as readStoredCodexAppServerBinding, i as readCodexBindingTimestamp, n as matchesPendingSupervisionBranch, o as stripUndefinedBinding, r as readCodexAppServerThreadBinding, s as validateBindingForWrite } from "./session-binding-record-codec-DvmOI7g_.mjs";
3
+ import { a as ownsStoredSessionGeneration, c as preserveNativeTaskImport, d as readCurrentCodexAppServerBindingAsync, f as readCurrentCodexAppServerBindings, g as sessionBindingIdentity, h as readPluginAppPolicyContext, i as matchesCodexNativeSubagentSubmissionBinding, l as preservedSessionGeneration, m as readCurrentNativePendingAssignments, n as assertCodexBindingMayBeReplaced, o as preserveCodexNativeSubagentSubmissions, p as readCurrentCodexNativeSubagentSubmissions, r as bindingStoreKey, s as preserveNativePendingAssignments, t as CodexSupervisionBindingReplacementError, u as readCurrentCodexAppServerBinding, v as storedSessionGeneration } from "./session-binding-record-C_THntMe.mjs";
4
4
  import { a as PHYSICAL_SESSION_RETIRE_TTL_MS, i as CODEX_APP_SERVER_BINDING_NAMESPACE, n as CODEX_APP_SERVER_BINDING_LEASE, r as CODEX_APP_SERVER_BINDING_MAX_ENTRIES, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-meta-Lkm5Lpf4.mjs";
5
- import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-CgHQ8Vot.mjs";
6
- import { t as __exportAll } from "./session-binding-sidecars-DD-enC8w.mjs";
5
+ import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-auwzSwwy.mjs";
6
+ import { t as __exportAll } from "./session-binding-sidecars-BNSS6WL4.mjs";
7
7
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
8
8
  import { createHash } from "node:crypto";
9
9
  import { AgentHarnessSessionSupersededError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
10
- import { combineNativeSessionBindingAuthority as combineCodexBindingAuthority, createNativeSessionBindingLifecycle, reclaimNativeSessionGenerationWithAuthority, resolveNativeSessionBindingWithAuthority } from "openclaw/plugin-sdk/agent-harness-session-runtime";
10
+ import { combinePreparedNativeSessionBindingAuthority as combineCodexBindingAuthority, createNativeSessionBindingLifecycleV2, reclaimNativeSessionGenerationWithAuthority, resolvePreparedNativeSessionBinding } from "openclaw/plugin-sdk/agent-harness-session-runtime";
11
11
  //#region extensions/codex/src/app-server/session-binding-native-mutations.ts
12
12
  /** The caller supplies the transaction's freshly parsed row and current-authority closure. */
13
13
  function mutateNativeSubagentBinding({ identity, current, mutation, assertCurrent }) {
@@ -64,7 +64,7 @@ function normalizeStoredCodexAppServerBindingFingerprints(value) {
64
64
  });
65
65
  }
66
66
  /** Encodes a migrated sidecar binding as one canonical plugin-state row. */
67
- function createStoredCodexAppServerBinding(value, options = {}) {
67
+ async function createStoredCodexAppServerBinding(value, options = {}) {
68
68
  const rawRecord = asOptionalRecord(value);
69
69
  if (!rawRecord) return;
70
70
  const record = normalizeLegacyBindingFingerprints(rawRecord);
@@ -74,7 +74,7 @@ function createStoredCodexAppServerBinding(value, options = {}) {
74
74
  const authProfileId = typeof record.authProfileId === "string" ? record.authProfileId : void 0;
75
75
  const binding = readCodexAppServerThreadBinding({
76
76
  ...record,
77
- modelProvider: normalizeCodexAppServerBindingModelProvider({
77
+ modelProvider: await normalizeCodexAppServerBindingModelProvider({
78
78
  ...options.lookup,
79
79
  authProfileId,
80
80
  modelProvider: typeof record.modelProvider === "string" ? record.modelProvider : void 0
@@ -141,13 +141,13 @@ async function reclaimCurrentCodexSessionGeneration(params) {
141
141
  /** Resolve continuity before selecting native queues, catalogs, or connections. */
142
142
  async function resolveCodexSessionBinding(params) {
143
143
  const identity = params.identity;
144
- return await resolveNativeSessionBindingWithAuthority({
144
+ return await resolvePreparedNativeSessionBinding({
145
145
  ...params,
146
146
  ...identity.kind === "session" ? {
147
147
  target: identity,
148
148
  generation: codexSessionGenerationOperations(params.bindingStore, identity)
149
149
  } : {},
150
- readBinding: (sessionId) => params.bindingStore.read(sessionId && identity.kind === "session" ? {
150
+ readBinding: (sessionId) => params.bindingStore.readAsync(sessionId && identity.kind === "session" ? {
151
151
  ...identity,
152
152
  sessionId
153
153
  } : identity),
@@ -156,7 +156,16 @@ async function resolveCodexSessionBinding(params) {
156
156
  }
157
157
  /** Creates the single binding facade owned by the Codex plugin runtime. */
158
158
  function createCodexAppServerBindingStore(state) {
159
- const lifecycle = createNativeSessionBindingLifecycle(state, {
159
+ const lifecycle = createNativeSessionBindingLifecycleV2({
160
+ lookup: (key) => state.asyncReads.lookup(key),
161
+ assertLeaseCurrent: (key, token) => {
162
+ const raw = state.lookup(key);
163
+ const current = readStoredCodexAppServerBinding(raw);
164
+ if (raw !== void 0 && !current) throw new Error(`Invalid Codex app-server binding row: ${key}`);
165
+ if (current?.lease?.token !== token || current.lease.expiresAt <= Date.now()) throw bindingLeaseLostError(key);
166
+ },
167
+ withCurrent: (authority) => state.withCurrent(authority)
168
+ }, {
160
169
  workerCodec: "codex",
161
170
  readRecord: readStoredCodexAppServerBinding,
162
171
  lease: CODEX_APP_SERVER_BINDING_LEASE,
@@ -224,12 +233,13 @@ function createCodexAppServerBindingStore(state) {
224
233
  };
225
234
  return {
226
235
  read: (identity) => readCurrentCodexAppServerBinding(state, identity),
236
+ readAsync: (identity) => readCurrentCodexAppServerBindingAsync(state.asyncReads, identity),
227
237
  readMany: (identities) => readCurrentCodexAppServerBindings(state.asyncReads, identities),
228
- readNativeSubagentAssignments: (identity, owner) => readCurrentNativePendingAssignments(state, identity, owner),
229
- readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state, identity, owner),
238
+ readNativeSubagentAssignments: (identity, owner) => readCurrentNativePendingAssignments(state.asyncReads, identity, owner),
239
+ readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state.asyncReads, identity, owner),
230
240
  async hasOtherThreadOwner(threadId, currentIdentity) {
231
241
  const currentKey = currentIdentity ? bindingStoreKey(currentIdentity) : void 0;
232
- return state.entries().some(({ key, value }) => {
242
+ return (await state.asyncReads.entries()).some(({ key, value }) => {
233
243
  const stored = readStoredCodexAppServerBinding(value);
234
244
  if (!stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
235
245
  const isCurrentOwner = currentIdentity !== void 0 && key === currentKey && (currentIdentity.kind === "conversation" || stored.sessionId === currentIdentity.sessionId.trim());
@@ -238,7 +248,7 @@ function createCodexAppServerBindingStore(state) {
238
248
  },
239
249
  async prepareSessionGenerationReclaim(identity) {
240
250
  const key = bindingStoreKey(identity);
241
- const raw = state.lookup(key);
251
+ const raw = await state.asyncReads.lookup(key);
242
252
  const current = readStoredCodexAppServerBinding(raw);
243
253
  if (raw !== void 0 && !current) throw new Error(`Invalid Codex app-server binding row: ${key}`);
244
254
  if (!current) return {
@@ -394,13 +404,5 @@ function codexSessionGenerationOperations(store, identity) {
394
404
  function isSameSupervisionOwner(current, replacement) {
395
405
  return replacement.connectionScope === "supervision" && replacement.threadId === current.threadId && replacement.supervisionSourceThreadId === current.supervisionSourceThreadId;
396
406
  }
397
- function storedSessionGeneration(identity, current) {
398
- if (identity.kind === "session") return { sessionId: identity.sessionId };
399
- return current?.sessionId ? { sessionId: current.sessionId } : {};
400
- }
401
- function preservedSessionGeneration(identity, current) {
402
- if (current?.sessionId) return { sessionId: current.sessionId };
403
- return storedSessionGeneration(identity, current);
404
- }
405
407
  //#endregion
406
408
  export { session_binding_exports as a, resolveCodexSessionBinding as i, createCodexSessionGenerationSupersededError as n, hashCodexAppServerBindingFingerprint as o, reclaimCurrentCodexSessionGeneration as r, clearCodexBindingForClient as t };
@@ -1,6 +1,6 @@
1
- import { a as matchesCodexNativeSubagentSubmissionOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, s as readCodexNativeSubagentSubmissions, t as matchesNativeAssignmentLifecycle } from "./native-subagent-pending-assignments-DmVhedNs.mjs";
2
- import { a as readStoredCodexAppServerBinding, t as legacyAppPolicyEntrySchema } from "./session-binding-record-codec-BpH8u_G9.mjs";
3
- import { t as __exportAll } from "./session-binding-sidecars-DD-enC8w.mjs";
1
+ import { a as matchesCodexNativeSubagentSubmissionOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, s as readCodexNativeSubagentSubmissions, t as matchesNativeAssignmentLifecycle } from "./native-subagent-pending-assignments-CTinVtjo.mjs";
2
+ import { a as readStoredCodexAppServerBinding, t as legacyAppPolicyEntrySchema } from "./session-binding-record-codec-DvmOI7g_.mjs";
3
+ import { t as __exportAll } from "./session-binding-sidecars-BNSS6WL4.mjs";
4
4
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { createHash } from "node:crypto";
6
6
  import { isDeepStrictEqual } from "node:util";
@@ -17,13 +17,16 @@ var session_binding_record_exports = /* @__PURE__ */ __exportAll({
17
17
  preserveCodexNativeSubagentSubmissions: () => preserveCodexNativeSubagentSubmissions,
18
18
  preserveNativePendingAssignments: () => preserveNativePendingAssignments,
19
19
  preserveNativeTaskImport: () => preserveNativeTaskImport,
20
+ preservedSessionGeneration: () => preservedSessionGeneration,
20
21
  readCurrentCodexAppServerBinding: () => readCurrentCodexAppServerBinding,
22
+ readCurrentCodexAppServerBindingAsync: () => readCurrentCodexAppServerBindingAsync,
21
23
  readCurrentCodexAppServerBindings: () => readCurrentCodexAppServerBindings,
22
24
  readCurrentCodexNativeSubagentSubmissions: () => readCurrentCodexNativeSubagentSubmissions,
23
25
  readCurrentNativePendingAssignments: () => readCurrentNativePendingAssignments,
24
26
  readPluginAppPolicyContext: () => readPluginAppPolicyContext,
25
27
  readStoredCodexAppServerBinding: () => readStoredCodexAppServerBinding,
26
- sessionBindingIdentity: () => sessionBindingIdentity
28
+ sessionBindingIdentity: () => sessionBindingIdentity,
29
+ storedSessionGeneration: () => storedSessionGeneration
27
30
  });
28
31
  /** Resolves the same agent scope OpenClaw uses for transcript/session ownership. */
29
32
  function sessionBindingIdentity(params) {
@@ -55,11 +58,15 @@ function bindingStoreKey(identity) {
55
58
  function ownsStoredSessionGeneration(identity, current) {
56
59
  return identity.kind !== "session" || !current?.sessionId || current.sessionId === identity.sessionId;
57
60
  }
58
- /** The same physical-generation check serves execution and read-only projections. */
61
+ /** Final effect guards retain the live row until raw SDK binding writers retire. */
59
62
  function readCurrentCodexAppServerBinding(state, identity) {
60
63
  const key = bindingStoreKey(identity);
61
64
  return decodeCurrentCodexAppServerBinding(key, state.lookup(key), identity);
62
65
  }
66
+ async function readCurrentCodexAppServerBindingAsync(state, identity) {
67
+ const key = bindingStoreKey(identity);
68
+ return decodeCurrentCodexAppServerBinding(key, await state.lookup(key), identity);
69
+ }
63
70
  function decodeCurrentCodexAppServerBinding(key, raw, identity) {
64
71
  const stored = readStoredCodexAppServerBinding(raw);
65
72
  if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
@@ -96,19 +103,19 @@ function matchesCodexNativeSubagentSubmissionBinding(binding, owner) {
96
103
  function preserveCodexNativeSubagentSubmissions(currentBinding, nextBinding, value) {
97
104
  return currentBinding.threadId === nextBinding.threadId ? preserveNativePendingAssignments(currentBinding, nextBinding, value) : void 0;
98
105
  }
99
- function readCurrentCodexNativeSubagentSubmissions(state, identity, owner) {
100
- const stored = readCurrentNativeSubagentBinding(state, identity, owner);
106
+ async function readCurrentCodexNativeSubagentSubmissions(state, identity, owner) {
107
+ const stored = await readCurrentNativeSubagentBinding(state, identity, owner);
101
108
  if (!stored) return [];
102
109
  const submissions = readCodexNativeSubagentSubmissions(stored.nativeSubagentSubmissions);
103
110
  return submissions && matchesCodexNativeSubagentSubmissionOwner(submissions.owner, owner) ? submissions.receipts : [];
104
111
  }
105
- function readCurrentNativePendingAssignments(state, identity, owner) {
106
- const stored = readCurrentNativeSubagentBinding(state, identity, owner);
112
+ async function readCurrentNativePendingAssignments(state, identity, owner) {
113
+ const stored = await readCurrentNativeSubagentBinding(state, identity, owner);
107
114
  return (readNativePendingAssignments(stored?.nativeSubagentAssignments)?.assignments ?? []).filter((entry) => matchesNativeAssignmentLifecycle(entry.owner, owner));
108
115
  }
109
- function readCurrentNativeSubagentBinding(state, identity, owner) {
116
+ async function readCurrentNativeSubagentBinding(state, identity, owner) {
110
117
  const key = bindingStoreKey(identity);
111
- const raw = state.lookup(key);
118
+ const raw = await state.lookup(key);
112
119
  const stored = readStoredCodexAppServerBinding(raw);
113
120
  if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
114
121
  if (stored?.state !== "active" || !ownsStoredSessionGeneration(identity, stored) || identity.kind === "session" && owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(stored.binding, owner)) return;
@@ -175,5 +182,13 @@ function readPluginAppPolicyContext(value) {
175
182
  pluginAppIds: parsedPluginAppIds
176
183
  };
177
184
  }
185
+ function storedSessionGeneration(identity, current) {
186
+ if (identity.kind === "session") return { sessionId: identity.sessionId };
187
+ return current?.sessionId ? { sessionId: current.sessionId } : {};
188
+ }
189
+ function preservedSessionGeneration(identity, current) {
190
+ if (current?.sessionId) return { sessionId: current.sessionId };
191
+ return storedSessionGeneration(identity, current);
192
+ }
178
193
  //#endregion
179
- export { ownsStoredSessionGeneration as a, preserveNativeTaskImport as c, readCurrentCodexNativeSubagentSubmissions as d, readCurrentNativePendingAssignments as f, session_binding_record_exports as h, matchesCodexNativeSubagentSubmissionBinding as i, readCurrentCodexAppServerBinding as l, sessionBindingIdentity as m, assertCodexBindingMayBeReplaced as n, preserveCodexNativeSubagentSubmissions as o, readPluginAppPolicyContext as p, bindingStoreKey as r, preserveNativePendingAssignments as s, CodexSupervisionBindingReplacementError as t, readCurrentCodexAppServerBindings as u };
194
+ export { session_binding_record_exports as _, ownsStoredSessionGeneration as a, preserveNativeTaskImport as c, readCurrentCodexAppServerBindingAsync as d, readCurrentCodexAppServerBindings as f, sessionBindingIdentity as g, readPluginAppPolicyContext as h, matchesCodexNativeSubagentSubmissionBinding as i, preservedSessionGeneration as l, readCurrentNativePendingAssignments as m, assertCodexBindingMayBeReplaced as n, preserveCodexNativeSubagentSubmissions as o, readCurrentCodexNativeSubagentSubmissions as p, bindingStoreKey as r, preserveNativePendingAssignments as s, CodexSupervisionBindingReplacementError as t, readCurrentCodexAppServerBinding as u, storedSessionGeneration as v };
@@ -111,6 +111,7 @@ const threadBindingSchema = z.object({
111
111
  contextEngine: contextEngineSchema.optional().catch(void 0),
112
112
  environmentSelectionFingerprint: optionalStringSchema,
113
113
  conversationStartId: optionalStringSchema,
114
+ conversationIncognito: z.literal(true).optional(),
114
115
  conversationSourceTransferComplete: z.literal(true).optional().catch(void 0),
115
116
  historyCoveredThrough: optionalTimestampSchema,
116
117
  continuityCalibration: z.object({
@@ -246,6 +246,16 @@ function isSafeLegacySessionId(value) {
246
246
  const trimmed = value.trim();
247
247
  return trimmed.length > 0 && trimmed.length <= 255 && /^[A-Za-z0-9][A-Za-z0-9._:@-]*$/.test(trimmed);
248
248
  }
249
+ async function resolveLegacySessionFileLocator(sessionsDir, entry, sessionId) {
250
+ const base = path.resolve(sessionsDir);
251
+ const fallback = path.join(base, `${sessionId}.jsonl`);
252
+ const sessionFile = entry.sessionFile?.trim();
253
+ if (!sessionFile) return fallback;
254
+ const candidate = path.resolve(base, sessionFile);
255
+ const [canonicalBase, canonicalCandidate] = await Promise.all([canonicalPathFromExistingAncestor(base), canonicalPathFromExistingAncestor(candidate)]);
256
+ if (!isPathInside(canonicalBase, canonicalCandidate)) throw new Error("legacy session file locator escapes its session directory");
257
+ return candidate;
258
+ }
249
259
  //#endregion
250
260
  //#region extensions/codex/src/migration/session-binding-sidecars.ts
251
261
  const LEGACY_BINDING_SUFFIX = ".codex-app-server.json";
@@ -410,7 +420,7 @@ async function collectBindingOwners(sources, surfaces, params) {
410
420
  storePath,
411
421
  transcriptPath: legacyTranscriptPath,
412
422
  ...entry.lifecycleRevision ? { lifecycleRevision: entry.lifecycleRevision } : {},
413
- ...entry.agentHarnessId?.trim() ? { agentHarnessId: entry.agentHarnessId.trim() } : {},
423
+ agentHarnessId: entry.agentHarnessId?.trim(),
414
424
  ...entry.updatedAt !== void 0 ? { updatedAt: entry.updatedAt } : {}
415
425
  };
416
426
  const candidates = owners.get(canonicalLegacyTranscriptPath) ?? /* @__PURE__ */ new Map();
@@ -428,16 +438,6 @@ async function collectBindingOwners(sources, surfaces, params) {
428
438
  failures
429
439
  };
430
440
  }
431
- async function resolveLegacySessionFileLocator(sessionsDir, entry, sessionId) {
432
- const base = path.resolve(sessionsDir);
433
- const fallback = path.join(base, `${sessionId}.jsonl`);
434
- const sessionFile = entry.sessionFile?.trim();
435
- if (!sessionFile) return fallback;
436
- const candidate = path.resolve(base, sessionFile);
437
- const [canonicalBase, canonicalCandidate] = await Promise.all([canonicalPathFromExistingAncestor(base), canonicalPathFromExistingAncestor(candidate)]);
438
- if (!isPathInside(canonicalBase, canonicalCandidate)) throw new Error("legacy session file locator escapes its session directory");
439
- return candidate;
440
- }
441
441
  function tryResolveLegacyBindingOwnerAgentId(params) {
442
442
  if (params.sessionKey.trim().toLowerCase().startsWith("agent:")) return resolveSessionAgentIdsStrict({
443
443
  sessionKey: params.sessionKey,
@@ -482,9 +482,9 @@ async function migrateSource(source, candidates, params, store) {
482
482
  return await withFileLock(source.sidecarPath, LEGACY_BINDING_LOCK_OPTIONS, async () => {
483
483
  const [contents, stat] = await Promise.all([fs.readFile(source.sidecarPath, "utf8"), fs.stat(source.sidecarPath)]);
484
484
  const raw = JSON.parse(contents);
485
- const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-JEHNMPsr.mjs").then((n) => n.a), import("./conversation-binding-data-UgLuTSQT.mjs").then((n) => n.t)]);
485
+ const [{ bindingStoreKey, createStoredCodexAppServerBinding, normalizeStoredCodexAppServerBindingFingerprints, readStoredCodexAppServerBinding }, { legacyCodexConversationBindingId }] = await Promise.all([import("./session-binding-BgsWcbdY.mjs").then((n) => n.a), import("./conversation-binding-data-khgW0n-o.mjs").then((n) => n.t)]);
486
486
  const agentId = owner?.agentId ?? (source.agentIds.size === 1 ? [...source.agentIds][0] : void 0);
487
- const baseStored = createStoredCodexAppServerBinding(raw, {
487
+ const baseStored = await createStoredCodexAppServerBinding(raw, {
488
488
  now: stat.mtime.toISOString(),
489
489
  lookup: {
490
490
  config: params.config,
@@ -493,6 +493,7 @@ async function migrateSource(source, candidates, params, store) {
493
493
  });
494
494
  if (!baseStored) return retain("its binding is invalid");
495
495
  if (candidates.length > 1) return retain(`${candidates.length} matching session owners make ownership ambiguous`);
496
+ if (owner?.agentHarnessId === "") return retain("its session owner changed before Codex ownership could be recorded", "notice");
496
497
  if (owner?.agentHarnessId && owner.agentHarnessId !== CODEX_AGENT_HARNESS_ID) return retain(`its session is owned by agent harness ${owner.agentHarnessId}`, "notice");
497
498
  const readEvidence = params.context.readSessionIdentityEvidenceBatch;
498
499
  const canonicalOwner = owner && readEvidence ? (await readEvidence([{
@@ -511,20 +512,22 @@ async function migrateSource(source, candidates, params, store) {
511
512
  const current = await store.lookup(key);
512
513
  if (current === void 0) return;
513
514
  const parsed = readStoredCodexAppServerBinding(current);
514
- if (!parsed) return `canonical plugin state is invalid at ${key}`;
515
+ if (!parsed) return `current plugin state is invalid at ${key}`;
515
516
  const normalized = normalizeStoredCodexAppServerBindingFingerprints(parsed);
516
- if (!normalized) return `canonical plugin state is invalid at ${key}`;
517
+ if (!normalized) return `current plugin state is invalid at ${key}`;
517
518
  if (isDeepStrictEqual(parsed, normalized)) return parsed;
518
- if (parsed.lease && parsed.lease.expiresAt > Date.now()) return `canonical plugin state is leased at ${key}`;
519
- const update = store.update;
520
- if (!update) return `canonical plugin state could not be normalized at ${key}`;
521
- await update(key, (candidate) => {
522
- const candidateParsed = readStoredCodexAppServerBinding(candidate);
523
- if (!candidateParsed || !isDeepStrictEqual(candidateParsed, parsed)) return;
524
- return normalized;
519
+ if (parsed.lease && parsed.lease.expiresAt > Date.now()) return `current plugin state is leased at ${key}`;
520
+ const { observe, compareAndApply } = store;
521
+ if (!observe || !compareAndApply) return `current plugin state could not be normalized at ${key}`;
522
+ const observation = await observe(key);
523
+ const candidateParsed = readStoredCodexAppServerBinding(observation.value);
524
+ if (candidateParsed && isDeepStrictEqual(candidateParsed, parsed)) await compareAndApply(key, observation.comparison, {
525
+ operation: "update",
526
+ action: "set",
527
+ value: normalized
525
528
  });
526
529
  const persisted = readStoredCodexAppServerBinding(await store.lookup(key));
527
- if (!persisted || !isDeepStrictEqual(persisted, normalized)) return `canonical plugin state changed at ${key}`;
530
+ if (!persisted || !isDeepStrictEqual(persisted, normalized)) return `current plugin state changed at ${key}`;
528
531
  importedKeys++;
529
532
  return normalized;
530
533
  };
@@ -557,37 +560,38 @@ async function migrateSource(source, candidates, params, store) {
557
560
  for (const entry of entries) {
558
561
  const current = await readNormalizedRow(entry.key);
559
562
  if (typeof current === "string") return retain(current);
560
- if (current && !hasExpected(current, entry.value)) return retain(`canonical plugin state changed at ${entry.key}`);
563
+ if (current && !hasExpected(current, entry.value)) return retain(`current plugin state changed at ${entry.key}`);
561
564
  }
562
565
  for (const entry of entries) {
563
566
  if (await store.registerIfAbsent(entry.key, entry.value)) importedKeys++;
564
- if (!hasExpected(await store.lookup(entry.key), entry.value)) return retain(`canonical plugin state changed at ${entry.key}`);
567
+ if (!hasExpected(await store.lookup(entry.key), entry.value)) return retain(`current plugin state changed at ${entry.key}`);
565
568
  }
566
569
  if (owner) {
567
570
  const ownershipResult = await recordSessionOwner(owner, params.env, {
568
571
  canCreateOwner,
569
572
  readEvidence
570
573
  });
571
- const ownershipWarning = typeof ownershipResult === "string" ? ownershipResult : ownershipResult ? "its canonical session was deleted" : void 0;
574
+ const ownershipWarning = typeof ownershipResult === "string" ? ownershipResult : ownershipResult ? "its saved session was deleted" : void 0;
572
575
  if (ownershipWarning) {
573
576
  if (sessionEntry?.value.state === "active") {
574
- const update = store.update;
575
- if (!update) return retain(`${ownershipWarning}; its stale session binding could not be retired`);
576
- await update(sessionEntry.key, (current) => {
577
- const parsed = readStoredCodexAppServerBinding(current);
578
- if (parsed?.lease && parsed.lease.expiresAt > Date.now()) return;
579
- if (!hasExpected(current, sessionEntry.value)) return;
580
- return {
577
+ const { observe, compareAndApply } = store;
578
+ if (!observe || !compareAndApply) return retain(`${ownershipWarning}; its stale session binding could not be retired`);
579
+ const observation = await observe(sessionEntry.key);
580
+ const parsed = readStoredCodexAppServerBinding(observation.value);
581
+ if (!(parsed?.lease && parsed.lease.expiresAt > Date.now()) && hasExpected(observation.value, sessionEntry.value)) await compareAndApply(sessionEntry.key, observation.comparison, {
582
+ operation: "update",
583
+ action: "set",
584
+ value: {
581
585
  version: 1,
582
586
  state: "cleared",
583
587
  sessionId: owner.sessionId,
584
588
  retired: true
585
- };
589
+ }
586
590
  });
587
591
  if (hasExpected(await store.lookup(sessionEntry.key), sessionEntry.value)) return retain(`${ownershipWarning}; its stale session binding could not be retired`);
588
592
  }
589
593
  if (typeof ownershipResult === "string") return retain(ownershipWarning, "notice");
590
- } else for (const entry of entries) if (!hasExpected(await store.lookup(entry.key), entry.value)) return retain(`canonical plugin state changed at ${entry.key}`);
594
+ } else for (const entry of entries) if (!hasExpected(await store.lookup(entry.key), entry.value)) return retain(`current plugin state changed at ${entry.key}`);
591
595
  }
592
596
  const archiveWarnings = [];
593
597
  await (0, runtime_doctor_migrations_exports.archiveLegacyStateSource)({
@@ -611,29 +615,15 @@ async function migrateSource(source, candidates, params, store) {
611
615
  }
612
616
  }
613
617
  async function recordSessionOwner(owner, env, options) {
614
- const { patchSessionEntry } = await import("openclaw/plugin-sdk/session-store-runtime");
615
- const currentIndex = await readLegacySessionIndex(owner.storePath);
616
- if ("failure" in currentIndex) return "its legacy session owner could not be revalidated";
617
- const currentOwner = currentIndex.entries.find(({ sessionKey }) => sessionKey === owner.sessionKey);
618
- if (!currentOwner || currentOwner.entry.sessionId !== owner.sessionId) return "its session owner changed before Codex ownership could be recorded";
619
- let currentTranscriptPath;
620
- try {
621
- currentTranscriptPath = await resolveLegacySessionFileLocator(path.dirname(owner.storePath), currentOwner.entry, currentOwner.entry.sessionId);
622
- } catch {
623
- return "its session owner changed before Codex ownership could be recorded";
624
- }
625
- if (await canonicalPathFromExistingAncestor(currentTranscriptPath) !== await canonicalPathFromExistingAncestor(owner.transcriptPath) || currentOwner.entry.lifecycleRevision !== owner.lifecycleRevision) return "its session owner changed before Codex ownership could be recorded";
626
- const legacyHarnessId = currentOwner.entry.agentHarnessId?.trim();
627
- if (currentOwner.entry.agentHarnessId !== void 0 && !legacyHarnessId) return "its session owner changed before Codex ownership could be recorded";
628
- if (legacyHarnessId && legacyHarnessId !== CODEX_AGENT_HARNESS_ID) return `its session is owned by agent harness ${legacyHarnessId}`;
629
- let observedForeignHarness;
618
+ const { prepareSessionEntryPatch } = await import("openclaw/plugin-sdk/session-store-runtime");
619
+ let ownershipRefusal;
630
620
  let observedCanonicalEntry = false;
631
- const updated = await patchSessionEntry({
621
+ if (!await prepareSessionEntryPatch({
632
622
  agentId: owner.agentId,
633
623
  env,
634
624
  ...options.canCreateOwner ? { fallbackEntry: {
635
625
  sessionId: owner.sessionId,
636
- updatedAt: currentOwner.entry.updatedAt ?? owner.updatedAt ?? 0,
626
+ updatedAt: owner.updatedAt ?? 0,
637
627
  ...owner.lifecycleRevision ? { lifecycleRevision: owner.lifecycleRevision } : {}
638
628
  } } : {},
639
629
  preserveActivity: true,
@@ -641,30 +631,32 @@ async function recordSessionOwner(owner, env, options) {
641
631
  skipMaintenance: true,
642
632
  storePath: owner.storePath,
643
633
  sessionKey: owner.sessionKey,
644
- update: (entry, { existingEntry }) => {
634
+ prepare: (entry, { existingEntry }) => {
645
635
  observedCanonicalEntry = existingEntry !== void 0;
646
- if (entry.sessionId.trim() !== owner.sessionId || entry.lifecycleRevision !== owner.lifecycleRevision) return null;
636
+ if (entry.sessionId.trim() !== owner.sessionId || entry.lifecycleRevision !== owner.lifecycleRevision) {
637
+ ownershipRefusal = "its session owner changed before Codex ownership could be recorded";
638
+ return null;
639
+ }
647
640
  const harnessId = typeof entry.agentHarnessId === "string" ? entry.agentHarnessId.trim() : void 0;
648
- if (entry.agentHarnessId !== void 0 && !harnessId) return null;
641
+ if (entry.agentHarnessId !== void 0 && !harnessId) {
642
+ ownershipRefusal = "Codex harness ownership could not be recorded on its session";
643
+ return null;
644
+ }
649
645
  if (harnessId && harnessId !== CODEX_AGENT_HARNESS_ID) {
650
- observedForeignHarness = harnessId;
646
+ ownershipRefusal = `its session is owned by agent harness ${harnessId}`;
651
647
  return null;
652
648
  }
653
649
  return { agentHarnessId: CODEX_AGENT_HARNESS_ID };
654
650
  }
655
- });
656
- if (!updated) {
651
+ }) || ownershipRefusal) {
657
652
  if (!options.canCreateOwner && !observedCanonicalEntry && options.readEvidence) {
658
653
  if ((await options.readEvidence([{
659
654
  agentId: owner.agentId,
660
655
  sessionId: owner.sessionId
661
656
  }]))[0]?.state === "absent") return { deleted: true };
662
657
  }
663
- return observedForeignHarness ? `its session is owned by agent harness ${observedForeignHarness}` : "its session owner changed before Codex ownership could be recorded";
658
+ return ownershipRefusal ?? "its session owner changed before Codex ownership could be recorded";
664
659
  }
665
- if (updated.sessionId.trim() !== owner.sessionId || updated.lifecycleRevision !== owner.lifecycleRevision) return "its session owner changed before Codex ownership could be recorded";
666
- const harnessId = updated.agentHarnessId?.trim();
667
- return harnessId === CODEX_AGENT_HARNESS_ID ? void 0 : harnessId ? `its session is owned by agent harness ${harnessId}` : "Codex harness ownership could not be recorded on its session";
668
660
  }
669
661
  async function readDirectoryEntries(directory) {
670
662
  try {