@openclaw/codex 2026.9.4 → 2026.9.6

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 (160) hide show
  1. package/assets/activity.svg +30 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/account-usage-runtime-Eem_WGqY.mjs +75 -0
  4. package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
  5. package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
  6. package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
  7. package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
  8. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
  9. package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
  10. package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-B2mpaI9D.mjs} +9 -81
  11. package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
  12. package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
  13. package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
  14. package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
  15. package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
  16. package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
  17. package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
  18. package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
  19. package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
  20. package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
  21. package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
  22. package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
  23. package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
  24. package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
  25. package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
  26. package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
  27. package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
  28. package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
  29. package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
  30. package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
  31. package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
  32. package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
  33. package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
  34. package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
  35. package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
  36. package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-BDXl-8Cw.mjs} +936 -620
  37. package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
  38. package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
  39. package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
  40. package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
  41. package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
  42. package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
  43. package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
  44. package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
  45. package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
  46. package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
  47. package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
  48. package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
  49. package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-CfXJf9Ay.mjs} +36 -12
  50. package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
  51. package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
  52. package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
  53. package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
  54. package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
  55. package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
  56. package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
  57. package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
  58. package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
  59. package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
  60. package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
  61. package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
  62. package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
  63. package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
  64. package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
  65. package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
  66. package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
  67. package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
  68. package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
  69. package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
  70. package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
  71. package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
  72. package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
  73. package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
  74. package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
  75. package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
  76. package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
  77. package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
  78. package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
  79. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
  80. package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
  81. package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
  82. package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
  83. package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
  84. package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
  85. package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
  86. package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
  87. package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
  88. package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
  89. package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.mjs} +4 -4
  90. package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
  91. package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CaCh0xF_.mjs} +10 -24
  92. package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
  93. package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
  94. package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
  95. package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
  96. package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-DiAi6Kx6.mjs} +12 -12
  97. package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
  98. package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
  99. package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
  100. package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
  101. package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
  102. package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
  103. package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
  104. package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
  105. package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
  106. package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
  107. package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
  108. package/dist/.setup/timeout-C910MdAB.mjs +80 -0
  109. package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
  110. package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
  111. package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
  112. package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-h2VHOskC.mjs} +274 -89
  113. package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
  114. package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
  115. package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
  116. package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
  117. package/dist/api.js +23 -12
  118. package/dist/catalog-page-worker-entrypoint.js +12 -0
  119. package/dist/catalog-page.worker.js +9 -0
  120. package/dist/cli-metadata.js +1 -1
  121. package/dist/doctor-contract-api.js +8 -528
  122. package/dist/harness.js +1 -1
  123. package/dist/index.js +306 -215
  124. package/dist/media-understanding-provider.js +3 -3
  125. package/dist/migration-provider-api.js +1 -1
  126. package/dist/native-tool-policy.js +12 -0
  127. package/dist/provider-discovery.js +18 -0
  128. package/dist/session-history-worker-runtime.js +36 -35
  129. package/dist/session-history.worker.js +2 -2
  130. package/dist/web-search-contract-api.js +1 -1
  131. package/openclaw.plugin.json +354 -69
  132. package/package.json +14 -8
  133. package/dist/attempt-context-D44yeDII.js +0 -636
  134. package/dist/binding-connection-D3udKbIE.js +0 -60
  135. package/dist/event-projector-usage-BfXmpOec.js +0 -102
  136. package/dist/inference-proxy-HGXKUIre.js +0 -311
  137. package/dist/launch-args-RXQwn8zV.js +0 -90
  138. package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
  139. package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
  140. package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
  141. package/dist/rpc-error-ttN_QjEm.js +0 -30
  142. package/dist/session-catalog-ct-AH01I.js +0 -1477
  143. package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
  144. package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
  145. package/dist/timeout-BVw8aaM1.js +0 -33
  146. package/dist/version-omm6IPI3.js +0 -12
  147. /package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
  148. /package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
  149. /package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
  150. /package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
  151. /package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
  152. /package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
  153. /package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
  154. /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
  155. /package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-umd0tgh4.mjs} +0 -0
  156. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  157. /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
  158. /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
  159. /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
  160. /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
@@ -0,0 +1,30 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
2
+ <!--
3
+ Adapted from OpenClaw ui/public/provider-icons/ProviderIcon-codex.svg.
4
+ Source: https://github.com/steipete/CodexBar/blob/215efbd39ad58acb4b0cd637c407d63e6183bc8d/Sources/CodexBar/Resources/ProviderIcon-codex.svg
5
+
6
+ MIT License
7
+ Copyright (c) 2026 Peter Steinberger
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
26
+
27
+ Names and marks remain the property of their respective owners.
28
+ -->
29
+ <path fill="currentColor" stroke="none" d="M83.7733 42.8087C84.6678 40.1149 84.9771 37.2613 84.6807 34.4385C84.3843 31.6156 83.489 28.8885 82.0544 26.4394C77.6908 18.8436 68.9203 14.9365 60.3548 16.7725C57.9831 14.1344 54.9591 12.1668 51.5864 11.0673C48.2137 9.96772 44.611 9.77498 41.1402 10.5084C37.6694 11.2418 34.4527 12.8755 31.8132 15.2455C29.1736 17.6155 27.204 20.6383 26.1024 24.0103C23.3212 24.5806 20.6938 25.738 18.3958 27.405C16.0977 29.0721 14.1819 31.2104 12.7765 33.6772C8.36538 41.2609 9.3669 50.8267 15.2527 57.3327C14.3549 60.0251 14.0424 62.8782 14.3361 65.7012C14.6298 68.5241 15.523 71.2518 16.9558 73.7017C21.325 81.3002 30.1011 85.207 38.6712 83.3686C40.5554 85.4904 42.8707 87.1858 45.4623 88.3416C48.0539 89.4975 50.8622 90.0871 53.6999 90.0713C62.4793 90.079 70.2575 84.4114 72.9393 76.0515C75.7201 75.4802 78.347 74.3225 80.6449 72.6555C82.9427 70.9886 84.8587 68.8507 86.2649 66.3846C90.6227 58.8145 89.6172 49.3005 83.7733 42.8087ZM53.6999 84.8356C50.1955 84.8411 46.801 83.6129 44.1116 81.3661L44.5848 81.098L60.5123 71.9043C60.9087 71.6718 61.2379 71.3402 61.4674 70.942C61.6969 70.5439 61.8189 70.0929 61.8215 69.6333V47.1769L68.5553 51.072C68.6225 51.1063 68.6694 51.1707 68.6814 51.2456V69.854C68.6641 78.1208 61.9667 84.8183 53.6999 84.8356ZM21.4977 71.0843C19.7402 68.0497 19.1092 64.4925 19.7156 61.0386L20.1885 61.3225L36.1321 70.5165C36.5266 70.748 36.9757 70.87 37.4331 70.87C37.8905 70.87 38.3396 70.748 38.7341 70.5165L58.21 59.2883V67.0628C58.2081 67.1031 58.1973 67.1424 58.1782 67.1779C58.1591 67.2134 58.1322 67.2441 58.0996 67.2678L41.9671 76.5722C34.798 80.7022 25.6388 78.2463 21.4977 71.0843ZM17.3026 36.3898C19.0723 33.3357 21.8655 31.0062 25.1878 29.8138V48.7376C25.1818 49.1949 25.2986 49.6453 25.5261 50.042C25.7535 50.4387 26.0833 50.7671 26.4809 50.9928L45.8622 62.1739L39.1283 66.069C39.0919 66.0883 39.0513 66.0984 39.0101 66.0984C38.9689 66.0984 38.9283 66.0883 38.8919 66.069L22.7908 56.7809C15.6359 52.6337 13.1822 43.4816 17.3026 36.3112V36.3898ZM72.624 49.2426L53.1792 37.9512L59.8976 34.0718C59.9341 34.0524 59.9747 34.0423 60.016 34.0423C60.0573 34.0423 60.0979 34.0524 60.1344 34.0718L76.2355 43.3761C78.6973 44.7966 80.7043 46.8882 82.0221 49.4065C83.3398 51.9249 83.914 54.7661 83.6775 57.5985C83.4411 60.431 82.4038 63.1377 80.6867 65.4027C78.9696 67.6677 76.6436 69.3975 73.9803 70.3901V51.466C73.9663 51.0096 73.834 50.5647 73.5962 50.1749C73.3584 49.7851 73.0234 49.4638 72.624 49.2426ZM79.3261 39.1657L78.8529 38.8815L62.9411 29.6089C62.5442 29.376 62.0924 29.2532 61.6322 29.2532C61.172 29.2532 60.7202 29.376 60.3233 29.6089L40.8629 40.8374V33.0628C40.8587 33.0233 40.8654 32.9834 40.882 32.9473C40.8987 32.9113 40.9248 32.8803 40.9575 32.8579L57.0586 23.5692C59.5263 22.1476 62.3478 21.458 65.193 21.5811C68.0382 21.7042 70.7896 22.6348 73.1253 24.2642C75.461 25.8936 77.2845 28.1543 78.3825 30.782C79.4806 33.4097 79.8077 36.2957 79.3257 39.1025V39.1657H79.3261ZM37.1888 52.9484L30.455 49.069C30.4213 49.0487 30.3925 49.0212 30.3707 48.9884C30.3488 48.9557 30.3345 48.9186 30.3286 48.8797V30.3188C30.3323 27.4714 31.1466 24.6839 32.6761 22.2822C34.2057 19.8805 36.3874 17.9639 38.9661 16.7564C41.5448 15.549 44.4139 15.1005 47.2381 15.4636C50.0622 15.8267 52.7247 16.9862 54.9141 18.8067L54.4409 19.0748L38.5134 28.2686C38.117 28.5011 37.7879 28.8327 37.5584 29.2308C37.329 29.629 37.207 30.0799 37.2045 30.5395L37.1888 52.9487V52.9484ZM40.8472 45.0632L49.5209 40.0643L58.21 45.0635V55.0615L49.5523 60.0608L40.8632 55.0615L40.8472 45.0632Z" />
30
+ </svg>
Binary file
@@ -0,0 +1,75 @@
1
+ import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
2
+ import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-CMU3DUD0.mjs";
3
+ import { n as readCodexAppServerUsage } from "./request-D2L0zMrq.mjs";
4
+ import "./config-BoTP_mrL.mjs";
5
+ import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
6
+ import { a as resolveCodexAppServerAuthProfileStore } from "./auth-profile-WqZtZfXN.mjs";
7
+ import { isDeepStrictEqual } from "node:util";
8
+ import { listAgentIds, resolveAgentDir } from "openclaw/plugin-sdk/agent-scope-runtime";
9
+ import { z } from "zod";
10
+ import { ErrorCodes, errorShape } from "openclaw/plugin-sdk/gateway-runtime";
11
+ //#region extensions/codex/src/account-usage-runtime.ts
12
+ const paramsSchema = z.object({
13
+ agentId: z.string().min(1),
14
+ profileId: z.string().min(1)
15
+ }).strict();
16
+ async function handleCodexAccountUsage({ params, respond, context, signal, hasCurrentClientAuthority }) {
17
+ const parsed = paramsSchema.safeParse(params);
18
+ if (!parsed.success) {
19
+ respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "Expected agentId and profileId."));
20
+ return;
21
+ }
22
+ const { agentId, profileId } = parsed.data;
23
+ const config = context.getRuntimeConfig();
24
+ if (!listAgentIds(config).includes(agentId)) {
25
+ respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "Unknown agent."));
26
+ return;
27
+ }
28
+ try {
29
+ const agentDir = resolveAgentDir(config, agentId);
30
+ const readStore = () => resolveCodexAppServerAuthProfileStore({
31
+ agentDir,
32
+ authProfileId: profileId,
33
+ config
34
+ });
35
+ const store = structuredClone(readStore());
36
+ const credential = store.profiles[profileId];
37
+ if (!credential || credential.provider !== "openai" || credential.type === "api_key") {
38
+ respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, "Select a saved Codex subscription login."));
39
+ return;
40
+ }
41
+ const assertCurrent = () => {
42
+ if (signal?.aborted || hasCurrentClientAuthority?.() === false || context.getRuntimeConfig() !== config || !isDeepStrictEqual(readStore().profiles[profileId], store.profiles[profileId])) throw new Error("Account credentials changed. Refresh Models and try again.");
43
+ };
44
+ assertCurrent();
45
+ const { start } = resolveCodexAppServerRuntimeOptions({ pluginConfig: config.plugins?.entries?.codex?.config });
46
+ if (isCodexAppServerProxyLaunch(start.args)) throw new Error("Account usage is unavailable through a Codex proxy. Configure a direct app-server launch.");
47
+ const usage = await readCodexAppServerUsage({
48
+ agentDir,
49
+ config,
50
+ timeoutMs: 2e4,
51
+ preparedAuth: {
52
+ kind: "profile",
53
+ profileId,
54
+ store
55
+ },
56
+ authRequirement: "subscription",
57
+ assertCurrent,
58
+ startOptions: {
59
+ ...start,
60
+ transport: "stdio",
61
+ homeScope: "agent"
62
+ }
63
+ });
64
+ assertCurrent();
65
+ const snapshot = buildCodexAppServerUsageSnapshot(usage.rateLimits, { accountDetails: true });
66
+ respond(true, {
67
+ updatedAt: Date.now(),
68
+ providers: [snapshot]
69
+ });
70
+ } catch (error) {
71
+ respond(false, void 0, errorShape(ErrorCodes.UNAVAILABLE, error instanceof Error ? error.message : "Codex usage unavailable. Try refreshing the account."));
72
+ }
73
+ }
74
+ //#endregion
75
+ export { handleCodexAccountUsage };
@@ -1,21 +1,21 @@
1
- import { c as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-oL4Na1ZG.js";
2
- import { x as readCodexPluginConfig } from "./protocol-5bh1G-H7.js";
3
- import { s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-7orQae_j.js";
4
- import { r as buildCodexPluginAppCacheKey, s as defaultCodexAppInventoryCache } from "./plugin-app-cache-key-d0eKxy7b.js";
5
- import { i as requestCodexAppServerJson } from "./request-B7hEkBGq.js";
6
- import "./config-oIORaQ5T.js";
7
- import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-D0zGNIHu.js";
8
- import { i as resolveCodexAppServerAuthProfileIdForAgent } from "./auth-profile-CwzO4_RG.js";
9
- import { c as getLeasedSharedCodexAppServerClient, et as resolveCodexAppServerAuthAccountCacheKey, h as releaseLeasedSharedCodexAppServerClient, o as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-CscigXXL.js";
10
- import { t as ensureCodexPluginActivation } from "./plugin-activation-BYQculil.js";
11
- import { CODEX_PLUGIN_CONFIG_PATH, buildCodexMigrationPlan, buildCodexPluginsConfigValue, hasCodexPluginConfigConflict, n as applyCodexAuthItems, r as resolveCodexConfigPatchMode, readCodexPluginMigrationConfigEntry, t as resolveCodexMigrationTargets } from "./plan-7uG-Fp36.js";
1
+ import { c as CODEX_PLUGINS_MARKETPLACE_NAME, n as isOpenAiCuratedMarketplace } from "./plugin-inventory-BoRei8Z4.mjs";
2
+ import { d as readCodexPluginConfig } from "./config-parsing-CcB9iPoq.mjs";
3
+ import { s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-B2mpaI9D.mjs";
4
+ import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-B2CsSdnV.mjs";
5
+ import { i as requestCodexAppServerJson } from "./request-D2L0zMrq.mjs";
6
+ import "./config-BoTP_mrL.mjs";
7
+ import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
8
+ import { i as resolveCodexAppServerAuthProfileIdForAgent } from "./auth-profile-WqZtZfXN.mjs";
9
+ import { X as resolveCodexAppServerAuthAccountCacheKey, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient, o as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-DA4VR4Eb.mjs";
10
+ import { t as ensureCodexPluginActivation } from "./plugin-activation-DT3MNtqj.mjs";
11
+ import { CODEX_PLUGIN_CONFIG_PATH, buildCodexMigrationPlan, buildCodexPluginsConfigValue, hasCodexPluginConfigConflict, n as resolveCodexConfigPatchMode, readCodexPluginMigrationConfigEntry, t as createCodexAuthItemApplier } from "./plan-CN3VwfNU.mjs";
12
12
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
13
13
  import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
14
14
  import path from "node:path";
15
15
  import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
16
16
  import { sleep } from "openclaw/plugin-sdk/runtime-env";
17
17
  import { MIGRATION_REASON_TARGET_EXISTS, applyMigrationManualItem, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, resolveMigrationConfigRuntime, summarizeMigrationItems, writeMigrationConfigPath } from "openclaw/plugin-sdk/migration";
18
- import { archiveMigrationItem, copyMemoryMigrationFileItem, copyMigrationFileItem, withCachedMigrationConfigRuntime, writeMigrationReport } from "openclaw/plugin-sdk/migration-runtime";
18
+ import { archiveMigrationItem, copyMemoryMigrationFileItem, copyMigrationFileItem, resolvePlannedMigrationTargets, withCachedMigrationConfigRuntime, writeMigrationReport } from "openclaw/plugin-sdk/migration-runtime";
19
19
  //#region extensions/codex/src/migration/apply-report.ts
20
20
  function codexPluginActivationReportState(result) {
21
21
  switch (result.reason) {
@@ -69,7 +69,7 @@ function shouldReturnCodexPluginConfigPatch(ctx) {
69
69
  }
70
70
  function prepareTargetCodexAppServer(ctx) {
71
71
  const appServer = resolveTargetCodexAppServer(ctx);
72
- const targets = resolveCodexMigrationTargets(ctx);
72
+ const targets = resolvePlannedMigrationTargets(ctx);
73
73
  let warmedClient;
74
74
  const ready = getLeasedSharedCodexAppServerClient({
75
75
  startOptions: appServer.start,
@@ -92,7 +92,7 @@ async function applyCodexMigrationPlan(params) {
92
92
  const plan = params.plan ?? await buildCodexMigrationPlan(params.ctx);
93
93
  const reportDir = params.ctx.reportDir ?? path.join(params.ctx.stateDir, "migration", "codex");
94
94
  const items = [];
95
- const targets = resolveCodexMigrationTargets(params.ctx);
95
+ const targets = resolvePlannedMigrationTargets(params.ctx);
96
96
  const codexHome = typeof plan.metadata?.codexHome === "string" && plan.metadata.codexHome.trim() ? plan.metadata.codexHome : plan.source;
97
97
  const authSource = {
98
98
  codexHome,
@@ -104,18 +104,19 @@ async function applyCodexMigrationPlan(params) {
104
104
  ...params.ctx,
105
105
  runtime
106
106
  };
107
+ const applyAuthItem = createCodexAuthItemApplier({
108
+ ctx: applyCtx,
109
+ source: authSource,
110
+ targets,
111
+ items: plan.items
112
+ });
107
113
  for (const item of plan.items) {
108
114
  if (item.status !== "planned") {
109
115
  items.push(item);
110
116
  continue;
111
117
  }
112
118
  if (item.id === "config:codex-plugins") items.push(await applyCodexPluginConfigItem(applyCtx, item, items));
113
- else if (item.kind === "auth") items.push(...await applyCodexAuthItems({
114
- ctx: applyCtx,
115
- item,
116
- source: authSource,
117
- targets
118
- }));
119
+ else if (item.kind === "auth") items.push(...await applyAuthItem(item));
119
120
  else if (item.kind === "plugin" && item.action === "install") items.push(await applyCodexPluginInstallItem(applyCtx, item));
120
121
  else if (item.kind === "manual") items.push(applyMigrationManualItem(item));
121
122
  else if (item.action === "archive") items.push(await archiveMigrationItem(item, reportDir));
@@ -159,7 +160,7 @@ async function applyCodexPluginInstallItem(ctx, item) {
159
160
  requestParams,
160
161
  timeoutMs: 6e4,
161
162
  startOptions: appServer.start,
162
- agentDir: resolveCodexMigrationTargets(ctx).agentDir,
163
+ agentDir: resolvePlannedMigrationTargets(ctx).agentDir,
163
164
  config: ctx.config,
164
165
  isolated: false
165
166
  }),
@@ -241,26 +242,19 @@ async function requestTargetCodexAppServerJson(params) {
241
242
  const discoveryTimeoutMs = targetCodexMarketplaceDiscoveryTimeoutMs();
242
243
  const discoveryDeadline = Math.min(deadline, Date.now() + discoveryTimeoutMs);
243
244
  let lastResponse;
244
- let attempt = 0;
245
245
  do {
246
- attempt += 1;
247
246
  const remainingMs = Math.max(1, discoveryDeadline - Date.now());
248
247
  lastResponse = await requestCodexAppServerJson({
249
248
  ...params,
250
249
  timeoutMs: remainingMs
251
250
  });
252
- if (hasOpenAiCuratedMarketplace(lastResponse)) return lastResponse;
251
+ if (lastResponse.marketplaces.some(isOpenAiCuratedMarketplace)) return lastResponse;
253
252
  if (Date.now() >= discoveryDeadline) return lastResponse;
254
253
  const waitMs = Math.min(TARGET_CODEX_MARKETPLACE_DISCOVERY_POLL_MS, discoveryDeadline - Date.now());
255
254
  await sleep(waitMs);
256
255
  } while (Date.now() < discoveryDeadline);
257
256
  return lastResponse;
258
257
  }
259
- function hasOpenAiCuratedMarketplace(response) {
260
- if (!response || typeof response !== "object" || !("marketplaces" in response)) return false;
261
- const marketplaces = response.marketplaces;
262
- return Array.isArray(marketplaces) && marketplaces.some((marketplace) => marketplace && typeof marketplace === "object" && marketplace.name === "openai-curated");
263
- }
264
258
  function targetCodexMarketplaceDiscoveryTimeoutMs(env = process.env) {
265
259
  const configured = parseStrictNonNegativeInteger(env[TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_ENV]);
266
260
  if (configured !== void 0) return configured;
@@ -270,7 +264,7 @@ function isCodexPluginLoadWarningItem(item) {
270
264
  return item.kind === "plugin" && item.action === "install" && item.status === "warning" && item.details?.warningReason === CODEX_PLUGIN_LOAD_WARNING;
271
265
  }
272
266
  async function buildTargetCodexPluginAppCacheKey(ctx) {
273
- const targets = resolveCodexMigrationTargets(ctx);
267
+ const targets = resolvePlannedMigrationTargets(ctx);
274
268
  const appServer = resolveTargetCodexAppServer(ctx);
275
269
  const authProfileId = resolveCodexAppServerAuthProfileIdForAgent({
276
270
  agentDir: targets.agentDir,
@@ -0,0 +1,27 @@
1
+ import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
2
+ //#region extensions/codex/src/app-server/async-questions.ts
3
+ /** Keep unsupported question payloads on Codex's complete plain-text fallback. */
4
+ function readCodexAsyncQuestions(value) {
5
+ if (!Array.isArray(value) || value.length === 0 || value.length > 12) return;
6
+ const questions = [];
7
+ for (const entry of value) {
8
+ const question = asOptionalRecord(entry);
9
+ if (!question || !isQuestionText(question.title, 4096)) return;
10
+ const options = question.options;
11
+ if (options === void 0 || options === null) {
12
+ questions.push({ title: question.title });
13
+ continue;
14
+ }
15
+ if (!Array.isArray(options) || options.length === 0 || options.length > 4 || !options.every((option) => isQuestionText(option, 256))) return;
16
+ questions.push({
17
+ title: question.title,
18
+ options: [...options]
19
+ });
20
+ }
21
+ return questions;
22
+ }
23
+ function isQuestionText(value, maxLength) {
24
+ return typeof value === "string" && value.length <= maxLength && value.trim().length > 0;
25
+ }
26
+ //#endregion
27
+ export { readCodexAsyncQuestions as t };
@@ -1,15 +1,16 @@
1
- import { o as isJsonObject } from "./protocol-5bh1G-H7.js";
2
- import "./client-B57KWPQx.js";
3
- import { m as retireSharedCodexAppServerClientIfCurrent } from "./auth-cache-key-7orQae_j.js";
4
- import { t as CodexAppServerRpcError } from "./rpc-error-ttN_QjEm.js";
5
- import { h as unknownItemStatus } from "./event-projector-items-5VhsECCO.js";
6
- import { Y as unsubscribeCodexAppServerLiveThread } from "./shared-client-CscigXXL.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
3
+ import { h as retireSharedCodexAppServerClientIfCurrent } from "./session-catalog-events-Bj6j94E_.mjs";
4
+ import { n as waitForPromiseOrAbort, o as CodexAppServerRpcError, t as abortReason } from "./timeout-C910MdAB.mjs";
5
+ import { h as unknownItemStatus } from "./event-projector-items-C6L_5ZiT.mjs";
6
+ import { G as unsubscribeCodexAppServerLiveThread, rt as isCodexAppServerStartupError, u as isCodexAppServerStartSelectionChangedError } from "./shared-client-DA4VR4Eb.mjs";
7
+ import { T as readCodexTurnCompletedNotification, a as isCodexAppServerBrokenPipeError, d as isCodexAppServerRequestTimeoutError, l as isCodexAppServerOverloadError } from "./client-Cs08OXVQ.mjs";
7
8
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
8
- import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
9
- import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
10
9
  import { AsyncResource } from "node:async_hooks";
11
- import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
10
+ import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
12
11
  import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
12
+ import { AgentHarnessPreflightError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
13
+ import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
13
14
  //#region extensions/codex/src/app-server/notification-correlation.ts
14
15
  /**
15
16
  * Correlates Codex app-server notifications with the active thread/turn so
@@ -92,6 +93,9 @@ const DEFAULT_PREBIND_NOTIFICATION_LIMIT = 256;
92
93
  const DEFAULT_GLOBAL_WARNING_LIMIT = 32;
93
94
  const CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS = 3e4;
94
95
  const routers = /* @__PURE__ */ new WeakMap();
96
+ function hasCodexAppServerSiblingRouteWork(client, threadId) {
97
+ return routers.get(client)?.hasSiblingWork(threadId) ?? false;
98
+ }
95
99
  /** Returns the sole router installed on a physical app-server client. */
96
100
  function getCodexAppServerTurnRouter(client) {
97
101
  const existing = routers.get(client);
@@ -101,15 +105,18 @@ function getCodexAppServerTurnRouter(client) {
101
105
  return router;
102
106
  }
103
107
  var ClientTurnRouter = class {
108
+ hasSiblingWork(threadId) {
109
+ for (const routedThreadId of this.routes.keys()) if (routedThreadId !== threadId) return true;
110
+ for (const watchedThreadId of this.nativeTurnCompletionWatchers.keys()) if (watchedThreadId !== threadId) return true;
111
+ return false;
112
+ }
104
113
  constructor(client) {
105
114
  this.routes = /* @__PURE__ */ new Map();
106
115
  this.globalWarnings = [];
107
116
  this.nativeTurnCompletionWatchers = /* @__PURE__ */ new Map();
108
117
  client.addNotificationHandler((notification) => this.routeNotification(notification));
109
- client.addRequestHandler((request, signal) => this.routeRequest(request, signal));
110
- client.addCloseHandler((closedClient) => {
111
- this.dispose(closedClient.getCloseError());
112
- });
118
+ client.addRequestHandler((request, signal, setExecutionTimeoutMs) => this.routeRequest(request, signal, setExecutionTimeoutMs));
119
+ client.addCloseHandler((closedClient) => this.dispose(closedClient.getCloseError()));
113
120
  }
114
121
  reserveThread(options) {
115
122
  this.assertActive();
@@ -152,7 +159,7 @@ var ClientTurnRouter = class {
152
159
  armTurn: () => this.armTurn(route),
153
160
  bindTurn: (turnId, bindingOptions) => this.bindTurn(route, turnId, bindingOptions),
154
161
  cancelTurn: () => this.cancelTurn(route),
155
- drain: () => this.drainNotifications(route),
162
+ drain: () => this.waitForNotifications(route),
156
163
  release: () => this.release(route)
157
164
  };
158
165
  }
@@ -258,10 +265,22 @@ var ClientTurnRouter = class {
258
265
  if (route.gate !== "armed") throw new Error(`codex app-server thread route cannot bind from ${route.gate}`);
259
266
  route.gate = "bound";
260
267
  route.turnId = turnId;
268
+ if (options?.beforeNotifications) {
269
+ route.notificationPause = options.beforeNotifications.then(() => {
270
+ route.notificationPause = void 0;
271
+ this.flushNotifications(route);
272
+ }, (cause) => {
273
+ const error = new Error("codex app-server notification barrier failed", { cause });
274
+ this.release(route, error);
275
+ throw error;
276
+ });
277
+ route.notificationPause.catch(() => {});
278
+ }
261
279
  this.flushNotifications(route);
262
280
  route.binding?.resolve();
263
281
  await this.waitForNotifications(route);
264
282
  this.assertRoute(route, turnId);
283
+ await route.notificationPause;
265
284
  await route.notificationTail;
266
285
  }
267
286
  routeNotification(notification) {
@@ -274,13 +293,14 @@ var ClientTurnRouter = class {
274
293
  this.bufferNotification(route, notification, { threadId: route.threadId }, Date.now());
275
294
  if (route.gate === "bound") this.flushNotifications(route);
276
295
  }
277
- return Promise.all([...this.routes.values()].map((route) => route.notificationTail)).then(() => void 0);
296
+ return Promise.all([...this.routes.values()].map((route) => this.waitForNotifications(route))).then(() => void 0);
278
297
  }
279
298
  const watchers = scope.threadId ? this.nativeTurnCompletionWatchers.get(scope.threadId) : void 0;
280
299
  const route = scope.threadId ? this.routes.get(scope.threadId) : void 0;
281
300
  if (!watchers && !route) return;
301
+ const completedTurn = notification.method === "turn/completed" && readCodexTurnCompletedNotification(notification.params) !== void 0;
282
302
  if (scope.turnId && watchers) {
283
- for (const watcher of watchers) if (watcher.turnId === scope.turnId && notification.method === "turn/completed") watcher.finish(true);
303
+ for (const watcher of watchers) if (watcher.turnId === scope.turnId && completedTurn) watcher.finish(true);
284
304
  else if (watcher.turnId === scope.turnId && notification.method === "turn/started") watcher.onStarted?.();
285
305
  }
286
306
  if (!route) return;
@@ -296,7 +316,7 @@ var ClientTurnRouter = class {
296
316
  id: scope.turnId,
297
317
  completed: false
298
318
  };
299
- } else if (notification.method === "turn/completed") {
319
+ } else if (completedTurn) {
300
320
  if (route.gate === "bound") route.completedNativeTurnIds.clear();
301
321
  route.completedNativeTurnIds.add(scope.turnId);
302
322
  if (!route.observedNativeTurn || route.observedNativeTurn.completed || route.observedNativeTurn.id === scope.turnId) route.observedNativeTurn = {
@@ -315,7 +335,7 @@ var ClientTurnRouter = class {
315
335
  this.warnDroppedStaleTurnNotification(route, notification, routeScope);
316
336
  return;
317
337
  }
318
- if (route.gate === "armed") {
338
+ if (route.gate === "armed" || route.notificationPause) {
319
339
  this.bufferNotification(route, notification, routeScope, receivedAtMs);
320
340
  return;
321
341
  }
@@ -323,7 +343,7 @@ var ClientTurnRouter = class {
323
343
  this.enqueueNotification(route, handler, notification, routeScope);
324
344
  return route.notificationTail;
325
345
  }
326
- async routeRequest(request, signal = new AbortController().signal) {
346
+ async routeRequest(request, signal = new AbortController().signal, setExecutionTimeoutMs) {
327
347
  if (this.closeError || signal.aborted) return;
328
348
  const scope = readScope(request.params);
329
349
  if (!scope.threadId) return;
@@ -346,7 +366,9 @@ var ClientTurnRouter = class {
346
366
  const result = await handler(request, {
347
367
  threadId: scope.threadId,
348
368
  ...scope.turnId ? { turnId: scope.turnId } : {}
349
- }, requestSignal);
369
+ }, requestSignal, setExecutionTimeoutMs && ((timeoutMs) => {
370
+ if (!requestSignal.aborted) setExecutionTimeoutMs(timeoutMs);
371
+ }));
350
372
  return requestSignal.aborted ? void 0 : result;
351
373
  } catch (error) {
352
374
  if (requestSignal.aborted) return;
@@ -365,10 +387,16 @@ var ClientTurnRouter = class {
365
387
  this.warnDroppedStaleTurnNotification(route, pending.notification, pending.scope);
366
388
  continue;
367
389
  }
368
- route.handlers?.onNotificationReceived?.(pending.notification, pending.scope, pending.receivedAtMs);
369
- this.enqueueNotification(route, handler, pending.notification, pending.scope);
390
+ this.observeNotificationReceipt(route, pending);
391
+ if (route.notificationPause) route.pending.push(pending);
392
+ else this.enqueueNotification(route, handler, pending.notification, pending.scope);
370
393
  }
371
394
  }
395
+ observeNotificationReceipt(route, pending) {
396
+ if (pending.receiptObserved) return;
397
+ pending.receiptObserved = true;
398
+ route.handlers?.onNotificationReceived?.(pending.notification, pending.scope, pending.receivedAtMs);
399
+ }
372
400
  warnDroppedStaleTurnNotification(route, notification, scope) {
373
401
  if (notification.method === "turn/completed" || !scope.turnId || !route.turnId) return;
374
402
  const eventKind = redactCodexEventKind(notification.method);
@@ -386,12 +414,14 @@ var ClientTurnRouter = class {
386
414
  });
387
415
  }
388
416
  bufferNotification(route, notification, scope, receivedAtMs) {
417
+ const pending = {
418
+ notification,
419
+ receivedAtMs,
420
+ scope
421
+ };
422
+ if (route.gate === "bound") this.observeNotificationReceipt(route, pending);
389
423
  if (route.pending.length < DEFAULT_PREBIND_NOTIFICATION_LIMIT) {
390
- route.pending.push({
391
- notification,
392
- receivedAtMs,
393
- scope
394
- });
424
+ route.pending.push(pending);
395
425
  return;
396
426
  }
397
427
  const error = /* @__PURE__ */ new Error(`codex app-server pre-bind notification buffer exceeded ${DEFAULT_PREBIND_NOTIFICATION_LIMIT} entries for thread ${route.threadId}`);
@@ -410,9 +440,7 @@ var ClientTurnRouter = class {
410
440
  });
411
441
  }
412
442
  async waitForNotifications(route) {
413
- await Promise.race([route.notificationTail, route.ended.promise]);
414
- }
415
- async drainNotifications(route) {
443
+ if (route.notificationPause) await Promise.race([route.notificationPause, route.ended.promise]);
416
444
  await Promise.race([route.notificationTail, route.ended.promise]);
417
445
  }
418
446
  release(route, error = /* @__PURE__ */ new Error("codex app-server thread route is released")) {
@@ -436,23 +464,6 @@ var ClientTurnRouter = class {
436
464
  if (route.released && !this.canDrainClosedTurn(route, completedTurnId)) throw route.released;
437
465
  }
438
466
  };
439
- async function waitForPromiseOrAbort(promise, signal) {
440
- if (signal.aborted) return false;
441
- let removeAbort;
442
- try {
443
- return await Promise.race([promise.then(() => true), new Promise((resolve) => {
444
- const onAbort = () => resolve(false);
445
- signal.addEventListener("abort", onAbort, { once: true });
446
- removeAbort = () => signal.removeEventListener("abort", onAbort);
447
- if (signal.aborted) onAbort();
448
- })]);
449
- } finally {
450
- removeAbort?.();
451
- }
452
- }
453
- function abortReason(signal) {
454
- return signal.reason instanceof Error ? signal.reason : new Error(String(signal.reason ?? "codex app-server thread route aborted"));
455
- }
456
467
  function readScope(value) {
457
468
  if (!isJsonObject(value)) return {};
458
469
  const threadId = readCodexNotificationThreadId(value);
@@ -472,6 +483,20 @@ function requireId(value, label) {
472
483
  /**
473
484
  * Best-effort cleanup helpers for Codex app-server startup attempts and turns.
474
485
  */
486
+ var attempt_client_cleanup_exports = /* @__PURE__ */ __exportAll({
487
+ CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS: () => CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS,
488
+ CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS: () => CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS,
489
+ CodexAppServerUnsafeSubscriptionError: () => CodexAppServerUnsafeSubscriptionError,
490
+ assertCodexThreadResumeSubscription: () => assertCodexThreadResumeSubscription,
491
+ closeCodexStartupClientBestEffort: () => closeCodexStartupClientBestEffort,
492
+ interruptCodexTurnAndWaitBestEffort: () => interruptCodexTurnAndWaitBestEffort,
493
+ isCodexAppServerUnsafeSubscriptionError: () => isCodexAppServerUnsafeSubscriptionError,
494
+ isCodexNoActiveTurnInterruptError: () => isCodexNoActiveTurnInterruptError,
495
+ retireUnsafeCodexTurnClientBestEffort: () => retireUnsafeCodexTurnClientBestEffort,
496
+ shouldRetireCodexStartupClient: () => shouldRetireCodexStartupClient,
497
+ terminateCodexBackgroundTerminals: () => terminateCodexBackgroundTerminals,
498
+ unsubscribeCodexThreadBestEffort: () => unsubscribeCodexThreadBestEffort
499
+ });
475
500
  /** Timeout for best-effort app-server turn interruption during cleanup. */
476
501
  const CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS = 5e3;
477
502
  /** Timeout for best-effort thread unsubscribe during cleanup. */
@@ -568,7 +593,7 @@ async function interruptCodexTurnAndWaitBestEffort(client, params) {
568
593
  }
569
594
  }
570
595
  /** Stops native terminals on the cancelled thread without retiring peer threads. */
571
- async function terminateCodexBackgroundTerminals(client, threadId, oneShotCliRun = false) {
596
+ async function terminateCodexBackgroundTerminals(client, threadId, oneShotCliRun = false, waitForNativeItems) {
572
597
  const options = {
573
598
  timeoutMs: CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS,
574
599
  signal: AbortSignal.timeout(CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS)
@@ -586,6 +611,7 @@ async function terminateCodexBackgroundTerminals(client, threadId, oneShotCliRun
586
611
  }, options)).data.length > 0) throw new Error("native background terminals remain running");
587
612
  if (oneShotCliRun) throw new Error("native terminal termination did not confirm process cleanup");
588
613
  }
614
+ await waitForNativeItems?.(options.signal);
589
615
  } catch (cause) {
590
616
  throw new Error("Codex background-terminal cleanup failed; inspect the thread's running terminals before starting more work.", { cause });
591
617
  }
@@ -604,5 +630,9 @@ async function unsubscribeCodexThreadBestEffort(client, params) {
604
630
  return false;
605
631
  }
606
632
  }
633
+ function shouldRetireCodexStartupClient(error, spawnedBy, signal) {
634
+ if (signal.aborted || isCodexAppServerStartupError(error) || isCodexAppServerRequestTimeoutError(error)) return true;
635
+ return !isCodexAppServerStartSelectionChangedError(error) && !isCodexAppServerOverloadError(error) && !(error instanceof AgentHarnessPreflightError && error.scope === void 0) && (isCodexAppServerBrokenPipeError(error) || !spawnedBy);
636
+ }
607
637
  //#endregion
608
- export { readCodexNotificationTurnId as _, closeCodexStartupClientBestEffort as a, isCodexNoActiveTurnInterruptError as c, unsubscribeCodexThreadBestEffort as d, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as f, readCodexNotificationThreadId as g, isCodexNotificationForTurn as h, assertCodexThreadResumeSubscription as i, retireUnsafeCodexTurnClientBestEffort as l, CodexProjectionDiagnostics as m, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as n, interruptCodexTurnAndWaitBestEffort as o, getCodexAppServerTurnRouter as p, CodexAppServerUnsafeSubscriptionError as r, isCodexAppServerUnsafeSubscriptionError as s, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as t, terminateCodexBackgroundTerminals as u };
638
+ export { CodexProjectionDiagnostics as _, attempt_client_cleanup_exports as a, readCodexNotificationTurnId as b, isCodexAppServerUnsafeSubscriptionError as c, shouldRetireCodexStartupClient as d, terminateCodexBackgroundTerminals as f, hasCodexAppServerSiblingRouteWork as g, getCodexAppServerTurnRouter as h, assertCodexThreadResumeSubscription as i, isCodexNoActiveTurnInterruptError as l, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as m, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as n, closeCodexStartupClientBestEffort as o, unsubscribeCodexThreadBestEffort as p, CodexAppServerUnsafeSubscriptionError as r, interruptCodexTurnAndWaitBestEffort as s, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as t, retireUnsafeCodexTurnClientBestEffort as u, isCodexNotificationForTurn as v, readCodexNotificationThreadId as y };
@@ -0,0 +1,5 @@
1
+ import { agentHarnessAttemptTerminal } from "openclaw/plugin-sdk/agent-harness-runtime";
2
+ //#region extensions/codex/src/app-server/attempt-terminal.ts
3
+ const attemptTerminal = agentHarnessAttemptTerminal;
4
+ //#endregion
5
+ export { attemptTerminal as t };