@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,21 +1,21 @@
1
- import { i as isJsonObject, r as flattenCodexDynamicToolFunctions, t as CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE } from "./protocol-CANUwXJ3.mjs";
2
- import { n as codexSandboxPolicyForTurn } from "./config-options-DDzeNQ8m.mjs";
3
- import { o as formatCodexDisplayText } from "./command-formatters-xW9KpoSZ.mjs";
4
- import { o as readItem } from "./event-projector-values-CLvG1Hil.mjs";
5
- import { s as codexAppIdentityKey } from "./plugin-app-cache-key-Bg9DbDI6.mjs";
6
- import "./config-C1YVVLEA.mjs";
1
+ import { n as flattenCodexDynamicToolFunctions, r as isJsonObject, t as CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE } from "./protocol-CaPAVwe9.mjs";
2
+ import { n as codexSandboxPolicyForTurn } from "./config-options-DMFZkd3X.mjs";
3
+ import { o as formatCodexDisplayText } from "./command-formatters-B_7-QZ1c.mjs";
4
+ import { o as readItem } from "./event-projector-values-yf4us9Pf.mjs";
5
+ import { s as codexAppIdentityKey } from "./plugin-app-cache-key-DRb-niJc.mjs";
6
+ import "./config-BfrAlTMT.mjs";
7
7
  import { r as invalidInlineImageText } from "./session-history-read-BI_2jRED.mjs";
8
- import { o as neutralizeCodexExplicitMentionSigils } from "./context-engine-projection-ps-yn_ci.mjs";
9
- import { W as protectCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientIfCurrent } from "./shared-client-CCz9ldpr.mjs";
10
- import { A as createFailedDynamicToolResponse, j as failedToolResult, k as resolveCodexToolAbortTerminalReason, l as CodexServerRequestResolvedError, w as createCodexElicitationResponse, x as readCodexTurnCompletedNotification } from "./client-aPKNc4Ii.mjs";
8
+ import { o as neutralizeCodexExplicitMentionSigils } from "./context-engine-projection-PIeLSnR-.mjs";
9
+ import { I as protectCodexAppServerLiveThread, p as retainSharedCodexAppServerClientIfCurrent } from "./shared-client-CE_uY0A1.mjs";
10
+ import { A as failedToolResult, C as createCodexElicitationResponse, O as resolveCodexToolAbortTerminalReason, b as readCodexTurnCompletedNotification, c as CodexServerRequestResolvedError, k as createFailedDynamicToolResponse } from "./client-BS8X7HmG.mjs";
11
11
  import { t as codexWebSocketDataToBuffer } from "./websocket-data-XlRvt8Ys.mjs";
12
- import { S as shouldClearTerminalPresentationForNativeItem, _ as itemName, a as isCodexNotificationForTurn, c as readCodexNotificationTurnId, d as auditNativeToolUnfinishedStatus, l as auditNativeToolName, s as readCodexNotificationThreadId, u as auditNativeToolTerminalStatus, v as itemStatus } from "./turn-router-CSJl3yYQ.mjs";
12
+ import { S as shouldClearTerminalPresentationForNativeItem, _ as itemName, a as isCodexNotificationForTurn, c as readCodexNotificationTurnId, d as auditNativeToolUnfinishedStatus, l as auditNativeToolName, s as readCodexNotificationThreadId, u as auditNativeToolTerminalStatus, v as itemStatus } from "./turn-router-Dbw17k3K.mjs";
13
13
  import { n as resolveCodexAppServerReasoningEffort, t as readCodexSupportedReasoningEfforts } from "./reasoning-effort-CS9kKWB9.mjs";
14
- import { V as joinPresentSections } from "./thread-requests-BgzJwJtS.mjs";
15
- import { r as resolveCodexAppServerRequestModelSelection, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-model-selection-DcVebr8N.mjs";
16
- import { a as requestPluginApprovalOutcome, c as truncateCodexApprovalDisplayText, i as requestPluginApproval, l as waitForPluginApprovalDecision, n as codexApprovalTimeoutText, o as sanitizeCodexApprovalVisibleText, r as mapExecDecisionToOutcome, s as stripDanglingCodexApprovalTerminalSequence, t as approvalRequestExplicitlyUnavailable } from "./plugin-approval-roundtrip-68FoMlaZ.mjs";
17
- import { d as isCodexPassThroughMediaSource, f as mapCodexAppServerLocalWorkspacePath, p as mapCodexAppServerRemoteWorkspacePath } from "./dynamic-tool-build-DKko0Jjw.mjs";
18
- import { c as emitCodexNativePreToolUseFailureDiagnostic } from "./native-hook-relay-DQzvuJ-W.mjs";
14
+ import { V as joinPresentSections } from "./thread-requests-BjawdIVV.mjs";
15
+ import { r as resolveCodexAppServerRequestModelSelection, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-model-selection-DxposL4X.mjs";
16
+ import { a as requestPluginApprovalOutcome, c as truncateCodexApprovalDisplayText, i as requestPluginApproval, l as waitForPluginApprovalDecision, n as codexApprovalTimeoutText, o as sanitizeCodexApprovalVisibleText, r as mapExecDecisionToOutcome, s as stripDanglingCodexApprovalTerminalSequence, t as approvalRequestExplicitlyUnavailable } from "./plugin-approval-roundtrip-DIZHLbAM.mjs";
17
+ import { d as isCodexPassThroughMediaSource, f as mapCodexAppServerLocalWorkspacePath, p as mapCodexAppServerRemoteWorkspacePath } from "./dynamic-tool-build-BjFAIG-f.mjs";
18
+ import { c as emitCodexNativePreToolUseFailureDiagnostic } from "./native-hook-relay-C7aaLJaP.mjs";
19
19
  import { createRequire } from "node:module";
20
20
  import { asNonArrayRecord, asOptionalRecord, filterStringEntries, isRecord, normalizeOptionalString, normalizeTrimmedStringList, readNonBlankString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
21
21
  import { createHash, randomUUID } from "node:crypto";
@@ -26,19 +26,19 @@ import { DEFAULT_MAX_LIVE_TOOL_RESULT_CHARS, estimateToolResultTextChars, resolv
26
26
  import path, { posix } from "node:path";
27
27
  import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
28
28
  import { createBoundedRemoteFileReader, isPathStrictlyInside, root } from "openclaw/plugin-sdk/file-access-runtime";
29
+ import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
29
30
  import { once } from "node:events";
30
31
  import { spawn } from "node:child_process";
31
32
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
32
33
  import { emitTrustedDiagnosticEvent, hasPendingInternalDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
33
34
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
34
- import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
35
35
  import { fileURLToPath, pathToFileURL } from "node:url";
36
36
  import { buildHarnessVisibleReplyGuidance, buildTemporalContextText, captureToolAuthoredSourceReply, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractMessagingToolSend, extractMessagingToolSendResult, finalizeAgentToolAvailability, finalizeToolTerminalPresentation, formatApprovalDisplayPath, formatToolExecutionErrorMessage, getBeforeToolCallFailureDisposition, getChannelAgentToolMeta, getPluginToolMeta, getPluginToolSideEffectOwnerKey, hasNativeHookRelayInvocation, invokeNativeHookRelay, isDeliveredMessageToolOnlySourceReplyResult, isDeliveredMessagingToolResult, isDeliveredMessagingToolSendToCurrentSource, isMessagingTool, isReplaySafeToolCall, isToolResultError, isToolWrappedWithBeforeToolCallHook, projectPluginMessageDeliveryFact, projectRuntimeToolInputSchema, readEmbeddedMessageDeliveryFact, readToolOperatorHint, resolveNativeHookRelayDeferredToolApproval, resolveToolExecutionErrorKind, runAgentHarnessAfterToolCallHook, sanitizeToolResult, setBeforeToolCallDiagnosticsEnabled, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
37
37
  import { sanitizeInlineImageDataUrl } from "openclaw/plugin-sdk/inline-image-data-url-runtime";
38
- import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
39
- import { formatErrorMessage as formatErrorMessage$2, redactSensitiveText as redactSensitiveText$1 } from "openclaw/plugin-sdk/security-runtime";
38
+ import { formatErrorMessage as formatErrorMessage$2, redactSensitiveText } from "openclaw/plugin-sdk/security-runtime";
40
39
  import { collectAgentHarnessMessagingMediaUrls, copyInternalToolResultState, createAgentHarnessToolExecutionBoundaryRegistry, extractMessagingToolSourceReplyPayload, getCoreTtsToolResultMediaUrls, mapAgentHarnessMessagingMediaValues, normalizeAcceptedSessionSpawnResult, recordAgentHarnessToolResultTelemetry, runAgentHarnessToolInvocation } from "openclaw/plugin-sdk/agent-harness-tool-runtime";
41
40
  import { isIP } from "node:net";
41
+ import { redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
42
42
  import { SANDBOX_COMMAND_MAX_BUFFER_BYTES, buildRemoteCommand, prepareSandboxProcessCleanup, sanitizeEnvVars } from "openclaw/plugin-sdk/sandbox";
43
43
  import { formatMcpCodexApprovalRemedy, requiresMcpCodexToolApproval, resolveProjectedMcpCodexToolApprovalMode } from "openclaw/plugin-sdk/codex-mcp-projection";
44
44
  import { SsrFBlockedError, isBlockedHostnameOrIp } from "openclaw/plugin-sdk/ssrf-runtime";
@@ -423,6 +423,13 @@ function invalidateCodexComputerFrame(contextEpoch) {
423
423
  delete contextEpoch.frameToolCallId;
424
424
  delete contextEpoch.frameImageIdentity;
425
425
  }
426
+ function computerFrameImageIdentity(content) {
427
+ if (!Array.isArray(content)) return;
428
+ const images = content.filter((block) => block.type === "image");
429
+ if (images.length !== 1) return;
430
+ const image = expectDefined(images[0], "single Codex computer frame image");
431
+ return createHash("sha256").update(JSON.stringify([image.mimeType, image.data])).digest("hex");
432
+ }
426
433
  //#endregion
427
434
  //#region extensions/codex/src/app-server/user-input.ts
428
435
  /** Builds ordered Codex user input for both new turns and same-turn steering. */
@@ -765,8 +772,8 @@ function buildCodexHistoryProvenancePrefix(params) {
765
772
  const sender = readCodexCurrentSender(params);
766
773
  return sender?.id ? neutralizeCodexExplicitMentionSigils(`[OpenClaw conversation info: sender=${JSON.stringify(sender)}]\n`) : void 0;
767
774
  }
768
- function buildTurnStartParams(params, options) {
769
- const modelSelection = options.preserveNativeTurnSettings ? void 0 : resolveCodexAppServerRequestModelSelection({
775
+ async function buildTurnStartParams(params, options) {
776
+ const modelSelection = options.preserveNativeTurnSettings ? void 0 : await resolveCodexAppServerRequestModelSelection({
770
777
  homeScope: options.appServer.start.homeScope,
771
778
  model: options.model ?? params.modelId,
772
779
  modelProvider: options.modelProvider,
@@ -926,7 +933,7 @@ var CodexNodeExecServerDisconnectedError = class extends Error {
926
933
  };
927
934
  /** Produces the bounded, redacted terminal failure shared by pending and claimed node leases. */
928
935
  function createCodexNodeExecServerDisconnectError(reason, cause) {
929
- return new CodexNodeExecServerDisconnectedError(`Codex execution node disconnected; start a fresh attempt. (${reason}${cause === void 0 ? "" : `: ${truncateUtf16Safe(redactSensitiveText$1(formatErrorMessage$2(cause), { mode: "tools" }), CODEX_NODE_EXEC_SERVER_MAX_FAILURE_DETAIL_CHARS)}`})`);
936
+ return new CodexNodeExecServerDisconnectedError(`Codex execution node disconnected; start a fresh attempt. (${reason}${cause === void 0 ? "" : `: ${truncateUtf16Safe(redactSensitiveText(formatErrorMessage$2(cause), { mode: "tools" }), CODEX_NODE_EXEC_SERVER_MAX_FAILURE_DETAIL_CHARS)}`})`);
930
937
  }
931
938
  /** Relays one authorized, single-use Codex exec-server channel without interpreting its protocol. */
932
939
  async function startCodexNodeExecServerRelay(params) {
@@ -1193,6 +1200,9 @@ const sandboxExecServerRegistry = {
1193
1200
  lease.channel.close();
1194
1201
  }
1195
1202
  server.node.leases.clear();
1203
+ } else {
1204
+ for (const { unsubscribe } of server.processAuthorities?.values() ?? []) unsubscribe();
1205
+ server.processAuthorities?.clear();
1196
1206
  }
1197
1207
  for (const client of server.server.clients) client.close(1001, "shutdown");
1198
1208
  await new Promise((resolve) => {
@@ -1352,7 +1362,7 @@ function resolveFsSandboxEntry(entry, cwd) {
1352
1362
  return {
1353
1363
  kind: "glob",
1354
1364
  pattern: absolutePattern,
1355
- matcher: compileSandboxGlobPattern(absolutePattern),
1365
+ matcher: compileSandboxGlobMatcher(absolutePattern),
1356
1366
  literalPrefix: sandboxGlobLiteralPrefix(absolutePattern),
1357
1367
  access
1358
1368
  };
@@ -1386,7 +1396,7 @@ function resolveFsAccess(policy, rawPath) {
1386
1396
  const target = normalizeSandboxAbsolutePath(rawPath, "fs path");
1387
1397
  let selected;
1388
1398
  for (const entry of policy.entries) {
1389
- if (!(entry.kind === "path" ? pathContains(entry.path, target) : entry.matcher.test(target))) continue;
1399
+ if (!(entry.kind === "path" ? pathContains(entry.path, target) : entry.matcher(target))) continue;
1390
1400
  const candidate = {
1391
1401
  specificity: (entry.kind === "path" ? entry.path : entry.literalPrefix).split("/").filter(Boolean).length,
1392
1402
  rank: FS_ACCESS_RANK[entry.access],
@@ -1423,27 +1433,285 @@ function normalizeSandboxGlobPattern(pattern) {
1423
1433
  if (!pattern || pattern.includes("\0") || !pattern.startsWith("/")) throw new Error("fs sandbox glob pattern must be absolute.");
1424
1434
  return pattern.replace(/\/{2,}/gu, "/");
1425
1435
  }
1426
- function compileSandboxGlobPattern(pattern) {
1427
- let source = "^";
1436
+ function compileSandboxGlobLiteral(text) {
1437
+ const points = Array.from(text);
1438
+ const fallback = Array.from({ length: points.length }, () => 0);
1439
+ let matched = 0;
1440
+ for (let index = 1; index < points.length; index += 1) {
1441
+ while (matched > 0 && points[index] !== points[matched]) matched = fallback[matched - 1] ?? 0;
1442
+ if (points[index] === points[matched]) matched += 1;
1443
+ fallback[index] = matched;
1444
+ }
1445
+ return {
1446
+ kind: "literal",
1447
+ points,
1448
+ fallback
1449
+ };
1450
+ }
1451
+ function tokenizeSandboxGlobPattern(pattern) {
1452
+ const tokens = [];
1453
+ let literal = "";
1454
+ const flushLiteral = () => {
1455
+ if (literal) {
1456
+ tokens.push(compileSandboxGlobLiteral(literal));
1457
+ literal = "";
1458
+ }
1459
+ };
1428
1460
  for (let index = 0; index < pattern.length; index += 1) {
1429
1461
  const char = pattern[index];
1430
1462
  const next = pattern[index + 1];
1431
1463
  if (char === "*" && next === "*" && pattern[index + 2] === "/") {
1432
- source += "(?:.*/)?";
1464
+ flushLiteral();
1465
+ tokens.push({ kind: "globstarSlash" });
1433
1466
  index += 2;
1434
1467
  } else if (char === "*" && next === "*") {
1435
- source += ".*";
1468
+ flushLiteral();
1469
+ tokens.push({ kind: "globstar" });
1436
1470
  index += 1;
1437
- } else if (char === "*") source += "[^/]*";
1438
- else if (char === "?") source += "[^/]";
1439
- else if (char === "[") {
1471
+ } else if (char === "*") {
1472
+ flushLiteral();
1473
+ tokens.push({ kind: "star" });
1474
+ } else if (char === "?") {
1475
+ flushLiteral();
1476
+ tokens.push({
1477
+ kind: "single",
1478
+ matches: (targetChar) => targetChar !== "/"
1479
+ });
1480
+ } else if (char === "[") {
1481
+ flushLiteral();
1440
1482
  const compiledClass = compileSandboxGlobCharacterClass(pattern, index);
1441
- source += compiledClass.source;
1483
+ const classPattern = new RegExp(compiledClass.source, "u");
1484
+ tokens.push({
1485
+ kind: "single",
1486
+ matches: (targetChar) => classPattern.test(targetChar)
1487
+ });
1442
1488
  index = compiledClass.endIndex;
1443
- } else source += char?.replace(/[\\^$+?.()|[\]{}]/gu, "\\$&") ?? "";
1489
+ } else literal += char ?? "";
1490
+ }
1491
+ flushLiteral();
1492
+ return tokens;
1493
+ }
1494
+ function isSandboxGlobLineTerminator(point) {
1495
+ return point === "\n" || point === "\r" || point === "\u2028" || point === "\u2029";
1496
+ }
1497
+ function firstLineTerminatorAtOrAfter(target, index) {
1498
+ let low = 0;
1499
+ let high = target.lineTerminators.length;
1500
+ while (low < high) {
1501
+ const mid = low + high >> 1;
1502
+ if ((target.lineTerminators[mid] ?? 0) < index) low = mid + 1;
1503
+ else high = mid;
1504
+ }
1505
+ return low < target.lineTerminators.length ? target.lineTerminators[low] ?? 0 : target.points.length;
1506
+ }
1507
+ function createSandboxGlobTarget(url) {
1508
+ const points = Array.from(url);
1509
+ const slashFollows = [];
1510
+ const lineTerminators = [];
1511
+ for (let index = 0; index < points.length; index += 1) {
1512
+ const point = points[index] ?? "";
1513
+ if (point === "/") slashFollows.push(index + 1);
1514
+ else if (isSandboxGlobLineTerminator(point)) lineTerminators.push(index);
1515
+ }
1516
+ const slashFollowRanges = [];
1517
+ for (const follow of slashFollows) {
1518
+ const last = slashFollowRanges.at(-1);
1519
+ if (last !== void 0 && follow === last.end + 1) last.end = follow;
1520
+ else slashFollowRanges.push({
1521
+ start: follow,
1522
+ end: follow
1523
+ });
1444
1524
  }
1445
- source += "$";
1446
- return new RegExp(source, "u");
1525
+ return {
1526
+ points,
1527
+ slashFollowRanges,
1528
+ lineTerminators
1529
+ };
1530
+ }
1531
+ function mergeSortedSandboxGlobRanges(left, right) {
1532
+ const merged = [];
1533
+ let leftIndex = 0;
1534
+ let rightIndex = 0;
1535
+ while (leftIndex < left.length || rightIndex < right.length) {
1536
+ const leftRange = left[leftIndex];
1537
+ const rightRange = right[rightIndex];
1538
+ const range = rightRange === void 0 || leftRange !== void 0 && (leftRange.start < rightRange.start || leftRange.start === rightRange.start && leftRange.end <= rightRange.end) ? leftRange : rightRange;
1539
+ if (range === void 0) break;
1540
+ if (range === leftRange) leftIndex += 1;
1541
+ else rightIndex += 1;
1542
+ const last = merged.at(-1);
1543
+ if (last !== void 0 && range.start <= last.end + 1) {
1544
+ if (range.end > last.end) last.end = range.end;
1545
+ } else merged.push({
1546
+ start: range.start,
1547
+ end: range.end
1548
+ });
1549
+ }
1550
+ return merged;
1551
+ }
1552
+ function mergeSandboxGlobRanges(ranges) {
1553
+ if (ranges.length === 0) return [];
1554
+ const sorted = ranges.toSorted((left, right) => left.start - right.start || left.end - right.end);
1555
+ const merged = [];
1556
+ for (const range of sorted) {
1557
+ const last = merged.at(-1);
1558
+ if (last !== void 0 && range.start <= last.end + 1) {
1559
+ if (range.end > last.end) last.end = range.end;
1560
+ continue;
1561
+ }
1562
+ merged.push({
1563
+ start: range.start,
1564
+ end: range.end
1565
+ });
1566
+ }
1567
+ return merged;
1568
+ }
1569
+ function literalSandboxGlobRanges(target, literal, ranges) {
1570
+ const next = [];
1571
+ const first = ranges[0];
1572
+ const last = ranges.at(-1);
1573
+ if (!first || !last) return next;
1574
+ const limit = Math.min(target.points.length, last.end + literal.points.length);
1575
+ let matched = 0;
1576
+ let rangeIndex = 0;
1577
+ for (let pos = first.start; pos < limit; pos += 1) {
1578
+ const point = target.points[pos];
1579
+ while (matched > 0 && point !== literal.points[matched]) matched = literal.fallback[matched - 1] ?? 0;
1580
+ if (point === literal.points[matched]) matched += 1;
1581
+ if (matched !== literal.points.length) continue;
1582
+ const start = pos + 1 - matched;
1583
+ matched = literal.fallback[matched - 1] ?? 0;
1584
+ while (rangeIndex < ranges.length && (ranges[rangeIndex]?.end ?? -1) < start) rangeIndex += 1;
1585
+ const range = ranges[rangeIndex];
1586
+ if (!range || start < range.start) continue;
1587
+ const previous = next.at(-1);
1588
+ if (previous && previous.end === pos) previous.end = pos + 1;
1589
+ else next.push({
1590
+ start: pos + 1,
1591
+ end: pos + 1
1592
+ });
1593
+ }
1594
+ return next;
1595
+ }
1596
+ function starSandboxGlobRanges(points, ranges) {
1597
+ const next = [];
1598
+ let coveredThrough = -1;
1599
+ for (const range of mergeSandboxGlobRanges(ranges.map((item) => ({
1600
+ start: item.start,
1601
+ end: item.end
1602
+ })))) {
1603
+ let cursor = range.start;
1604
+ if (cursor <= coveredThrough) cursor = coveredThrough + 1;
1605
+ while (cursor <= range.end) {
1606
+ let far = cursor;
1607
+ while (far < points.length && points[far] !== "/") far += 1;
1608
+ next.push({
1609
+ start: cursor,
1610
+ end: far
1611
+ });
1612
+ coveredThrough = far;
1613
+ if (far >= range.end) break;
1614
+ cursor = far + 1;
1615
+ }
1616
+ }
1617
+ return mergeSandboxGlobRanges(next);
1618
+ }
1619
+ function globstarSandboxGlobRanges(target, ranges) {
1620
+ const next = [];
1621
+ for (const range of ranges) next.push({
1622
+ start: range.start,
1623
+ end: firstLineTerminatorAtOrAfter(target, range.end)
1624
+ });
1625
+ return mergeSandboxGlobRanges(next);
1626
+ }
1627
+ function globstarSlashSandboxGlobRanges(target, ranges) {
1628
+ const follows = target.slashFollowRanges;
1629
+ const next = [];
1630
+ const emitted = [];
1631
+ let followIndex = 0;
1632
+ const sortedRanges = ranges.toSorted((left, right) => left.start - right.start || left.end - right.end);
1633
+ for (const range of sortedRanges) {
1634
+ next.push({
1635
+ start: range.start,
1636
+ end: range.end
1637
+ });
1638
+ const bound = firstLineTerminatorAtOrAfter(target, range.end);
1639
+ while (followIndex < follows.length) {
1640
+ const follow = follows[followIndex];
1641
+ if (follow === void 0 || follow.start > range.start) break;
1642
+ followIndex += 1;
1643
+ }
1644
+ while (followIndex < follows.length) {
1645
+ const follow = follows[followIndex];
1646
+ if (follow === void 0 || follow.start > bound) break;
1647
+ emitted.push({
1648
+ start: follow.start,
1649
+ end: follow.end
1650
+ });
1651
+ followIndex += 1;
1652
+ }
1653
+ }
1654
+ return mergeSortedSandboxGlobRanges(next, emitted);
1655
+ }
1656
+ function singleSandboxGlobRanges(points, ranges, matches) {
1657
+ const next = [];
1658
+ for (const range of ranges) {
1659
+ let runStart = -1;
1660
+ let runEnd = -1;
1661
+ const last = Math.min(range.end, points.length - 1);
1662
+ for (let pos = range.start; pos <= last; pos += 1) {
1663
+ const point = points[pos];
1664
+ if (point === void 0 || !matches(point)) continue;
1665
+ const at = pos + 1;
1666
+ if (runStart < 0) {
1667
+ runStart = at;
1668
+ runEnd = at;
1669
+ } else if (at === runEnd + 1) runEnd = at;
1670
+ else {
1671
+ next.push({
1672
+ start: runStart,
1673
+ end: runEnd
1674
+ });
1675
+ runStart = at;
1676
+ runEnd = at;
1677
+ }
1678
+ }
1679
+ if (runStart >= 0) next.push({
1680
+ start: runStart,
1681
+ end: runEnd
1682
+ });
1683
+ }
1684
+ return mergeSandboxGlobRanges(next);
1685
+ }
1686
+ function matchSandboxGlobTokens(url, tokens) {
1687
+ const target = createSandboxGlobTarget(url);
1688
+ let ranges = [{
1689
+ start: 0,
1690
+ end: 0
1691
+ }];
1692
+ for (let index = 0; index < tokens.length; index += 1) {
1693
+ const token = tokens[index];
1694
+ if (token === void 0) break;
1695
+ if (token.kind === "literal") ranges = literalSandboxGlobRanges(target, token, ranges);
1696
+ else if (token.kind === "star") ranges = starSandboxGlobRanges(target.points, ranges);
1697
+ else if (token.kind === "globstar") ranges = globstarSandboxGlobRanges(target, ranges);
1698
+ else if (token.kind === "globstarSlash") {
1699
+ ranges = globstarSlashSandboxGlobRanges(target, ranges);
1700
+ while (tokens[index + 1]?.kind === "globstarSlash") index += 1;
1701
+ } else ranges = singleSandboxGlobRanges(target.points, ranges, token.matches);
1702
+ if (ranges.length === 0) return false;
1703
+ }
1704
+ return ranges.some((range) => range.start <= target.points.length && target.points.length <= range.end);
1705
+ }
1706
+ /**
1707
+ * Compiles a Codex sandbox glob into a linear matcher. The sandbox context is
1708
+ * model-session output and the target path is model-requested, so the matcher
1709
+ * must stay free of catastrophic backtracking: each token advances cursor
1710
+ * ranges in one pass instead of letting a regex retry overlapping quantifiers.
1711
+ */
1712
+ function compileSandboxGlobMatcher(pattern) {
1713
+ const tokens = tokenizeSandboxGlobPattern(pattern);
1714
+ return (target) => matchSandboxGlobTokens(target, tokens);
1447
1715
  }
1448
1716
  function compileSandboxGlobCharacterClass(pattern, startIndex) {
1449
1717
  let index = startIndex + 1;
@@ -2881,8 +3149,14 @@ async function ensureCodexSandboxExecServerEnvironment(params) {
2881
3149
  if (processAuthority && !("node" in execServer)) {
2882
3150
  const authorities = execServer.processAuthorities ??= /* @__PURE__ */ new Map();
2883
3151
  if (!authorities.has(processAuthority.authPath)) {
2884
- authorities.set(processAuthority.authPath, processAuthority);
2885
- params.client.addCloseHandler(() => authorities.delete(processAuthority.authPath));
3152
+ const unsubscribe = params.client.addCloseHandler(() => {
3153
+ unsubscribe();
3154
+ authorities.delete(processAuthority.authPath);
3155
+ });
3156
+ authorities.set(processAuthority.authPath, {
3157
+ authority: processAuthority,
3158
+ unsubscribe
3159
+ });
2886
3160
  }
2887
3161
  }
2888
3162
  const environmentId = nodeLease ? `openclaw-node-${nodeLease.id}` : processAuthority ? `${execServer.environmentId}-${processAuthority.id}` : execServer.environmentId;
@@ -3058,7 +3332,7 @@ async function startOpenClawExecServer(sandbox) {
3058
3332
  handleNodeConnection(execServer, socket, requestUrl);
3059
3333
  return;
3060
3334
  }
3061
- handleConnection(execServer, socket, execServer.processAuthorities?.get(requestUrl.pathname));
3335
+ handleConnection(execServer, socket, execServer.processAuthorities?.get(requestUrl.pathname)?.authority);
3062
3336
  });
3063
3337
  embeddedAgentLog.info("codex sandbox exec-server started", {
3064
3338
  environmentId,
@@ -4480,29 +4754,7 @@ function createCodexDynamicToolSpecs(params) {
4480
4754
  function projectCodexDynamicTools(tools) {
4481
4755
  const projectedTools = [];
4482
4756
  const quarantinedTools = [];
4483
- let length;
4484
- try {
4485
- length = tools.length;
4486
- } catch {
4487
- return {
4488
- tools: [],
4489
- quarantinedTools: [{
4490
- tool: "tool[0]",
4491
- violations: ["tool[0] is unreadable"]
4492
- }]
4493
- };
4494
- }
4495
- for (let toolIndex = 0; toolIndex < length; toolIndex += 1) {
4496
- let tool;
4497
- try {
4498
- tool = tools[toolIndex];
4499
- } catch {
4500
- quarantinedTools.push({
4501
- tool: `tool[${toolIndex}]`,
4502
- violations: [`tool[${toolIndex}] is unreadable`]
4503
- });
4504
- continue;
4505
- }
4757
+ for (const [toolIndex, tool] of tools.entries()) {
4506
4758
  const descriptor = readCodexDynamicToolDescriptor(tool, toolIndex);
4507
4759
  if ("diagnostic" in descriptor) {
4508
4760
  quarantinedTools.push(descriptor.diagnostic);
@@ -4608,38 +4860,10 @@ function finalizeCodexToolAvailability(entries) {
4608
4860
  //#region extensions/codex/src/app-server/dynamic-tool-content.ts
4609
4861
  function enforceWholeSkillResult(toolName, result, maxChars) {
4610
4862
  if (toolName !== "skills_read" || isToolResultError(result)) return result;
4611
- return sanitizeToolTextRuns(result.content).reduce((total, item) => total + (item.type === "text" ? estimateToolResultTextChars(item.text) : 0), 0) <= maxChars ? result : failedToolResult(`This Codex turn cannot deliver the whole skill within its ${maxChars}-character weighted output budget. No instructions were returned; use a harness with a larger instruction budget.`);
4612
- }
4613
- function sanitizeToolTextRuns(rawContent) {
4614
- const content = [];
4615
- for (let index = 0; index < rawContent.length;) {
4616
- const item = rawContent[index];
4617
- if (item.type !== "text") {
4618
- content.push(item);
4619
- index += 1;
4620
- continue;
4621
- }
4622
- const textRun = [];
4623
- while (index < rawContent.length) {
4624
- const next = rawContent[index];
4625
- if (next.type !== "text") break;
4626
- textRun.push(next);
4627
- index += 1;
4628
- }
4629
- const sanitizedText = sanitizeToolResult(textRun.map((entry) => entry.text).join(""));
4630
- let offset = 0;
4631
- content.push(...textRun.map((entry, runIndex) => {
4632
- const targetEnd = runIndex === textRun.length - 1 ? sanitizedText.length : Math.min(sanitizedText.length, offset + entry.text.length);
4633
- const text = sliceUtf16Safe(sanitizedText, offset, targetEnd);
4634
- const sanitized = Object.assign({}, entry, { text });
4635
- offset += text.length;
4636
- return sanitized;
4637
- }));
4638
- }
4639
- return content;
4863
+ return result.content.reduce((total, item) => total + (item.type === "text" ? estimateToolResultTextChars(item.text) : 0), 0) <= maxChars ? result : failedToolResult(`This Codex turn cannot deliver the whole skill within its ${maxChars}-character weighted output budget. No instructions were returned; use a harness with a larger instruction budget.`);
4640
4864
  }
4641
4865
  function convertToolContents(rawContent, maxChars) {
4642
- const content = sanitizeToolTextRuns(rawContent);
4866
+ const content = rawContent;
4643
4867
  const totalTextChars = content.reduce((total, item) => total + (item.type === "text" ? item.text.length : 0), 0);
4644
4868
  if (content.reduce((total, item) => total + (item.type === "text" ? estimateToolResultTextChars(item.text) : 0), 0) <= maxChars) return content.map(convertToolContent);
4645
4869
  const noticeText = `...(OpenClaw truncated dynamic tool result: original ${totalTextChars} chars, weighted budget ${maxChars}; rerun with narrower args.)`;
@@ -4723,31 +4947,44 @@ function projectCodexExecutableDynamicToolSurface(tools, hookContext) {
4723
4947
  }
4724
4948
  //#endregion
4725
4949
  //#region extensions/codex/src/app-server/dynamic-tool-source-reply.ts
4950
+ function applyCurrentMessageProvider(toolName, args, currentProvider) {
4951
+ const hasProvider = typeof args.provider === "string" && args.provider.trim().length > 0 || typeof args.channel === "string" && args.channel.trim().length > 0;
4952
+ const provider = currentProvider?.trim();
4953
+ if (toolName !== "message" || hasProvider || !provider) return args;
4954
+ return {
4955
+ ...args,
4956
+ provider
4957
+ };
4958
+ }
4726
4959
  /**
4727
4960
  * Resolves the source-reply facts of one Codex dynamic tool result and records whether
4728
4961
  * it ends the Codex turn on `response`. A final reply
4729
4962
  * authored by a `canDeliverSourceReply` tool, read from the result after middleware and
4730
- * extensions, is appended to `payloads`; the host delivers it and writes its transcript
4731
- * row after the send. Only calls in the model-only namespace qualify: Codex never
4732
- * exposes that namespace to Code Mode programs, so a program's intermediate call
4963
+ * extensions, stays on the response until batch settlement. The host delivers it
4964
+ * and writes its transcript row after the send. Only calls in the model-only
4965
+ * namespace qualify: Codex never exposes that namespace to Code Mode programs,
4966
+ * so a program's intermediate call
4733
4967
  * cannot end the turn or reach the conversation.
4734
4968
  */
4735
4969
  function resolveCodexToolResultSourceReply(params) {
4736
- const messageToolOnly = params.sourceReplyDeliveryMode === "message_tool_only" && params.toolName === "message";
4737
- const toolConfirmed = messageToolOnly && !params.resultIsError && (params.rawResult.terminate === true || params.result.terminate === true);
4738
- const confirmed = messageToolOnly && (toolConfirmed || params.deliveredSourceReply);
4970
+ const messageTool = params.toolName === "message";
4971
+ const toolConfirmed = messageTool && !params.resultIsError && (params.rawResult.terminate === true || params.result.terminate === true);
4972
+ const confirmed = messageTool && (toolConfirmed || params.deliveredSourceReply);
4739
4973
  const final = confirmed ? params.executedArgs.final !== false : void 0;
4740
4974
  const payload = params.canDeliverSourceReply === true && !params.resultIsError && params.call.namespace === "openclaw_direct" ? captureToolAuthoredSourceReply({
4741
4975
  result: params.result,
4742
4976
  toolCallId: params.call.callId,
4743
4977
  idempotencyScope: params.runId ?? params.call.turnId
4744
4978
  }) : void 0;
4745
- if (payload) params.payloads.push(payload);
4746
4979
  const toolAuthoredFinal = Boolean(payload);
4747
4980
  const continuesSourceReplyProgress = confirmed && final === false;
4748
4981
  const terminate = toolAuthoredFinal || (params.rawResult.terminate === true || params.result.terminate === true) && !continuesSourceReplyProgress || [params.rawResult, params.result].some(({ details }) => isRecord(details) && typeof details.status === "string" && details.status.trim().toLowerCase() === "yielded") || confirmed && final === true || void 0;
4749
4982
  params.response.terminate = terminate;
4750
- if (toolAuthoredFinal) params.response.toolAuthoredFinalReply = true;
4983
+ params.response.finalSourceReplyDelivered = params.deliveredSourceReply && final === true || void 0;
4984
+ if (payload) params.response.toolAuthoredSourceReply = {
4985
+ ...payload,
4986
+ toolAuthoredForTurnId: params.call.turnId
4987
+ };
4751
4988
  return {
4752
4989
  toolConfirmed,
4753
4990
  final,
@@ -4775,22 +5012,6 @@ function assertCodexDynamicToolInputMatchesSchema(params) {
4775
5012
  const omittedSuffix = omitted > 0 ? `; ${omitted} more violation(s) omitted` : "";
4776
5013
  throw new Error(`Invalid arguments for tool "${params.toolName}": ${details}${omittedSuffix}.`);
4777
5014
  }
4778
- function applyCurrentMessageProvider(toolName, args, currentProvider) {
4779
- const hasProvider = typeof args.provider === "string" && args.provider.trim().length > 0 || typeof args.channel === "string" && args.channel.trim().length > 0;
4780
- const provider = currentProvider?.trim();
4781
- if (toolName !== "message" || hasProvider || !provider) return args;
4782
- return {
4783
- ...args,
4784
- provider
4785
- };
4786
- }
4787
- function computerFrameImageIdentity(content) {
4788
- if (!Array.isArray(content)) return;
4789
- const images = content.filter((block) => block.type === "image");
4790
- if (images.length !== 1) return;
4791
- const image = expectDefined(images[0], "single Codex computer frame image");
4792
- return createHash("sha256").update(JSON.stringify([image.mimeType, image.data])).digest("hex");
4793
- }
4794
5015
  function createCodexDynamicToolBridge(params) {
4795
5016
  const toolResultHookContext = toToolResultHookContext(params.hookContext);
4796
5017
  const contextWindowTokens = params.hookContext?.contextWindowTokens;
@@ -4919,6 +5140,7 @@ function createCodexDynamicToolBridge(params) {
4919
5140
  let messagingFacts;
4920
5141
  let executedArgsForPresentation = args;
4921
5142
  let rawIsErrorForPresentation = false;
5143
+ let finalSourceReplyDelivered = false;
4922
5144
  let telemetryRawResultForPresentation;
4923
5145
  let presentationIsError = false;
4924
5146
  return runAgentHarnessToolInvocation({
@@ -4933,6 +5155,7 @@ function createCodexDynamicToolBridge(params) {
4933
5155
  runId: toolResultHookContext.runId,
4934
5156
  startedAt: invocationStartedAt,
4935
5157
  signal,
5158
+ assertCurrent: params.assertCurrent,
4936
5159
  boundaries: executionBoundaries,
4937
5160
  retainExecutionSnapshot: options?.retainExecutionSnapshot,
4938
5161
  initialArguments: args,
@@ -4951,7 +5174,8 @@ function createCodexDynamicToolBridge(params) {
4951
5174
  });
4952
5175
  return toolArgsRecord;
4953
5176
  },
4954
- beforeExecute: () => {
5177
+ beforeExecute: async () => {
5178
+ await params.assertCurrentAsync?.();
4955
5179
  messagingContext = {
4956
5180
  config: params.hookContext?.config,
4957
5181
  currentChannelId: params.hookContext?.currentChannelId,
@@ -5001,6 +5225,8 @@ function createCodexDynamicToolBridge(params) {
5001
5225
  deliveredPayload: rawResult
5002
5226
  })
5003
5227
  });
5228
+ finalSourceReplyDelivered = deliveredSourceReply && executedArgs.final !== false;
5229
+ telemetry.finalSourceReplyDelivered ||= finalSourceReplyDelivered || void 0;
5004
5230
  if (toolName === "message" && messageDelivery?.sourceReplyDelivered) telemetry.sourceReplyDelivered = true;
5005
5231
  messagingFacts = {
5006
5232
  messagingDelivered,
@@ -5063,7 +5289,6 @@ function createCodexDynamicToolBridge(params) {
5063
5289
  transcriptDetails: asOptionalRecord(sanitizeToolResult(result))?.details
5064
5290
  };
5065
5291
  const sourceReply = resolveCodexToolResultSourceReply({
5066
- sourceReplyDeliveryMode: params.hookContext?.sourceReplyDeliveryMode,
5067
5292
  canDeliverSourceReply: toolEntry.tool.canDeliverSourceReply,
5068
5293
  toolName,
5069
5294
  call,
@@ -5073,7 +5298,6 @@ function createCodexDynamicToolBridge(params) {
5073
5298
  deliveredSourceReply,
5074
5299
  executedArgs,
5075
5300
  runId: toolResultHookContext.runId,
5076
- payloads: telemetry.messagingToolSourceReplyPayloads,
5077
5301
  response
5078
5302
  });
5079
5303
  const autoDeliveryTtsMediaUrls = getCoreTtsToolResultMediaUrls(rawResult);
@@ -5137,7 +5361,9 @@ function createCodexDynamicToolBridge(params) {
5137
5361
  executedArguments: executedArgs,
5138
5362
  executionStarted: executionBoundary.executionStarted,
5139
5363
  replaySafe,
5140
- sideEffectEvidence: executionBoundary.didStartExecution && !replaySafe || void 0
5364
+ sideEffectEvidence: executionBoundary.didStartExecution && !replaySafe || void 0,
5365
+ terminate: finalSourceReplyDelivered || void 0,
5366
+ finalSourceReplyDelivered: finalSourceReplyDelivered || void 0
5141
5367
  };
5142
5368
  }
5143
5369
  });