very-happy-cli 0.2.175 → 0.2.177

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 (185) hide show
  1. package/dist/{AcpBackend-Sb6N_HcB.cjs → AcpBackend-B-ny68XM.cjs} +188 -37
  2. package/dist/{AcpBackend-BZrLVcHb.mjs → AcpBackend-B0K0WrtW.mjs} +187 -38
  3. package/dist/{AcpSessionManager-C2MqOirs.cjs → AcpSessionManager-CjdJLofq.cjs} +1 -1
  4. package/dist/{AcpSessionManager-y1Iy1mzc.mjs → AcpSessionManager-DykjzBM4.mjs} +1 -1
  5. package/dist/{BasePermissionHandler-BbLYwd13.cjs → BasePermissionHandler-DR6nxuEn.cjs} +1 -1
  6. package/dist/{BasePermissionHandler-DriZLITp.mjs → BasePermissionHandler-hdY7kTqX.mjs} +1 -1
  7. package/dist/{agentHome-BoYfpemd.cjs → agentHome-BdTXEUPe.cjs} +4 -4
  8. package/dist/{agentHome-BtuRubHG.mjs → agentHome-GRN2VfHv.mjs} +4 -4
  9. package/dist/{api-KZmVqSKO.cjs → api-BWX10o97.cjs} +17 -10
  10. package/dist/{api-D08IEaWa.mjs → api-CKBViqI3.mjs} +18 -11
  11. package/dist/{apiMachine-Dct2GDAq.cjs → apiMachine-BYYFGgFs.cjs} +15 -14
  12. package/dist/{apiMachine-Cx9Zn-78.mjs → apiMachine-DttO4UFj.mjs} +15 -14
  13. package/dist/{attachmentContent-PrNJg8gG.mjs → attachmentContent-cPVF463_.mjs} +2 -2
  14. package/dist/{attachmentContent-4L9dO8E3.cjs → attachmentContent-kJKXpkMX.cjs} +2 -2
  15. package/dist/{attachmentLimits-BLbji11b.mjs → attachmentLimits-Di1Z93lN.mjs} +1 -1
  16. package/dist/{attachmentLimits-D6bT2jU1.cjs → attachmentLimits-DtFqqiwR.cjs} +1 -1
  17. package/dist/{auth-D1qHU-i_.mjs → auth-BmESeKuM.mjs} +5 -5
  18. package/dist/{auth-PY_HGlzz.mjs → auth-CKdXb9zp.mjs} +8 -8
  19. package/dist/{auth-BGmM3Vlm.cjs → auth-CTECt2Oz.cjs} +5 -5
  20. package/dist/{auth-BI0CsMcy.cjs → auth-DNxVmVbn.cjs} +8 -8
  21. package/dist/{auto-COMphIfD.mjs → auto-Ch3203qd.mjs} +17 -16
  22. package/dist/{auto-DM4_FeKb.cjs → auto-D1ypjjfx.cjs} +16 -15
  23. package/dist/{backgroundTaskActivity-8PdPxrvy.mjs → backgroundTaskActivity-BVwJBl02.mjs} +1 -1
  24. package/dist/{bootstrap-DTJ6-vYT.cjs → bootstrap-6OI698q9.cjs} +2 -2
  25. package/dist/{bootstrap-CWjpC5-J.mjs → bootstrap-C0s2bPFQ.mjs} +2 -2
  26. package/dist/{browser-xuW4fiHo.mjs → browser-BlLWZUMx.mjs} +1 -1
  27. package/dist/{browser-DmgVoopB.cjs → browser-DG6Uof5O.cjs} +1 -1
  28. package/dist/{claudeLocal-B0P-wVJJ.mjs → claudeLocal-CcWcKnoo.mjs} +5 -5
  29. package/dist/{claudeLocal-CtZVz3ee.cjs → claudeLocal-CemsIArT.cjs} +5 -5
  30. package/dist/{claudeLocalLauncher-D4vmjI3c.mjs → claudeLocalLauncher-7p6y88nj.mjs} +15 -18
  31. package/dist/{claudeLocalLauncher-Dnv4CH8r.cjs → claudeLocalLauncher-A4VuevIi.cjs} +15 -18
  32. package/dist/{claudeSessionFork-CxjOBoBh.mjs → claudeSessionFork-BtROOjqf.mjs} +1 -1
  33. package/dist/{claudeSessionFork-DQk5-dzR.cjs → claudeSessionFork-CbDfm8Fz.cjs} +1 -1
  34. package/dist/{client-eQjOvC55.mjs → client-BPMWutfs.mjs} +3 -3
  35. package/dist/{client-BhLhjj_x.cjs → client-COmgDDy0.cjs} +2 -2
  36. package/dist/{client-C4ddTzrD.mjs → client-DG5ndWLw.mjs} +2 -2
  37. package/dist/{client-BHZVyQwi.cjs → client-DyvBTYee.cjs} +3 -3
  38. package/dist/codex/happyMcpStdioBridge.cjs +15 -15
  39. package/dist/codex/happyMcpStdioBridge.mjs +16 -16
  40. package/dist/{codexAppServerClient-CppPl_R6.mjs → codexAppServerClient-D-Z8qSfI.mjs} +233 -24
  41. package/dist/{codexAppServerClient-D-9z-lWP.cjs → codexAppServerClient-R24WZZfg.cjs} +233 -24
  42. package/dist/{codexCommand-AgVJYnFU.cjs → codexCommand-6hW19gsq.cjs} +159 -84
  43. package/dist/{codexCommand-BdrBNbZu.mjs → codexCommand-CVTkZJ1o.mjs} +158 -83
  44. package/dist/{BaseReasoningProcessor-_S1PbSvH.cjs → codexTermination-BBU7e92y.cjs} +25 -1
  45. package/dist/{BaseReasoningProcessor-DnykPlPo.mjs → codexTermination-CCIfwzcx.mjs} +25 -2
  46. package/dist/{config-Cr3VUzbE.mjs → config-CvsNChKX.mjs} +3 -3
  47. package/dist/{config-D89sE3wK.cjs → config-DhdrvOLV.cjs} +3 -3
  48. package/dist/{configuration-BNGPXg07.mjs → configuration-D55F0t16.mjs} +1 -1
  49. package/dist/{configuration-UV4EE5ui.cjs → configuration-DZPy0T9Z.cjs} +1 -1
  50. package/dist/{connect-C0iLkCiY.mjs → connect-CwCXMRmD.mjs} +14 -14
  51. package/dist/{connect-B35YXbdZ.cjs → connect-Wz-XZYXW.cjs} +13 -13
  52. package/dist/{context-BmH2BKip.cjs → context-BKbrZ55r.cjs} +1 -1
  53. package/dist/{context-Ptdnlcv6.mjs → context-CCRpVXFo.mjs} +1 -1
  54. package/dist/{controlClient-DqtC0pq1.mjs → controlClient-C4xB5J6O.mjs} +4 -4
  55. package/dist/{controlClient-CtsQMw--.cjs → controlClient-SX8gSza2.cjs} +3 -3
  56. package/dist/{createSessionMetadata-2IuH5nlA.cjs → createSessionMetadata-BCFmYlBo.cjs} +2 -2
  57. package/dist/{createSessionMetadata-CtNMvfth.mjs → createSessionMetadata-Bi-m0Y_O.mjs} +2 -2
  58. package/dist/{defaultPermissionMode-Bn4HcU8S.cjs → defaultPermissionMode-DMBEnXll.cjs} +2 -2
  59. package/dist/{defaultPermissionMode-DYihjV2g.mjs → defaultPermissionMode-wBcbBezm.mjs} +2 -2
  60. package/dist/{deterministicJson-DF4xv6MH.mjs → deterministicJson-BkQETt8_.mjs} +9 -9
  61. package/dist/{deterministicJson-je21npNx.cjs → deterministicJson-ChGfQEF6.cjs} +9 -9
  62. package/dist/{doctor-Ba92L7-b.mjs → doctor-B9c2C9dF.mjs} +8 -8
  63. package/dist/{doctor-BXKcYVGU.cjs → doctor-BsN3JZJn.cjs} +7 -7
  64. package/dist/{downloadTarget-CUJg8iJV.mjs → downloadTarget-ByXzbDK4.mjs} +6 -6
  65. package/dist/{downloadTarget-JC7FZl7W.cjs → downloadTarget-Dj3WoVJa.cjs} +6 -6
  66. package/dist/{ensureDaemonRunning-JPA9tHNE.mjs → ensureDaemonRunning--HYzs5Ce.mjs} +5 -5
  67. package/dist/{ensureDaemonRunning-bIp6-vgi.cjs → ensureDaemonRunning-7Wb8M7Lv.cjs} +5 -5
  68. package/dist/{handleResumeCommand-B6lE5DtU.mjs → handleResumeCommand-DHddBkNJ.mjs} +5 -5
  69. package/dist/{handleResumeCommand-B6b9kIYf.cjs → handleResumeCommand-OmuUGYjQ.cjs} +5 -5
  70. package/dist/{index-B2KL0aPc.cjs → index-BRJzH4sc.cjs} +141 -87
  71. package/dist/{index-CjE4kBKx.mjs → index-BzJNDsJq.mjs} +143 -89
  72. package/dist/{index-B6UGRQ7h.mjs → index-CEjJnq05.mjs} +3 -0
  73. package/dist/{index-CZLwo1FS.mjs → index-CEm0MYiS.mjs} +3 -3
  74. package/dist/{index-B1ABQRrB.cjs → index-CrR4JISa.cjs} +4 -4
  75. package/dist/{index-D759ViMU.cjs → index-D9NoYc5I.cjs} +3 -3
  76. package/dist/{index-D3kI0hDR.cjs → index-DFPT4HOO.cjs} +3 -0
  77. package/dist/{index-boE-d8CM.mjs → index-DMy3OCBe.mjs} +8 -1
  78. package/dist/{index-BZdhwBKa.cjs → index-De8L5lFK.cjs} +8 -0
  79. package/dist/{index-DW1ONaGc.mjs → index-Dhl6_bw7.mjs} +4 -4
  80. package/dist/index.cjs +2 -2
  81. package/dist/index.mjs +2 -2
  82. package/dist/{install-KjIsK_EA.cjs → install-1qn-D9FS.cjs} +3 -3
  83. package/dist/{install-CmojqnLK.mjs → install-BDIUtPXi.mjs} +3 -3
  84. package/dist/lib.cjs +12 -12
  85. package/dist/lib.d.cts +7 -1
  86. package/dist/lib.d.mts +7 -1
  87. package/dist/lib.mjs +13 -13
  88. package/dist/{lidState-CL1NdKfQ.mjs → lidState-BqVsw7H1.mjs} +1 -1
  89. package/dist/{lidState-BmJp2pLt.cjs → lidState-DxbK0qfu.cjs} +1 -1
  90. package/dist/{localHappyAgentAuth-B7f4Ysn0.mjs → localHappyAgentAuth-Ce8kO2yc.mjs} +1 -1
  91. package/dist/{localHappyAgentAuth-9SP7hdiw.cjs → localHappyAgentAuth-D5tANdRD.cjs} +1 -1
  92. package/dist/{logger-D5EzMy30.mjs → logger-13cBr_ew.mjs} +2 -2
  93. package/dist/{logger-C7dRaCkE.cjs → logger-LvwVeATU.cjs} +2 -2
  94. package/dist/{machineMetadata-DYYuK_0c.cjs → machineMetadata-29h7vgf4.cjs} +3 -3
  95. package/dist/{machineMetadata-DqplCWue.mjs → machineMetadata-dMida2qq.mjs} +3 -3
  96. package/dist/{main-kgCQgknK.cjs → main-DpM5jaFH.cjs} +44 -44
  97. package/dist/{main-CnV62agu.mjs → main-x4nAhdH5.mjs} +44 -44
  98. package/dist/{mcp-bDPaj-tM.mjs → mcp-DMiFGYMT.mjs} +15 -15
  99. package/dist/{mcp-BV0vxHtz.cjs → mcp-DQv3caXs.cjs} +14 -14
  100. package/dist/{mirrorProtocol-BSHVZ8Nf.cjs → mirrorProtocol-BfrERW7Z.cjs} +3 -3
  101. package/dist/{mirrorProtocol-ClKhNXYe.mjs → mirrorProtocol-Bz8tEabR.mjs} +3 -3
  102. package/dist/{package-VqWv7EI5.cjs → package-Ch9WGDV_.cjs} +7 -7
  103. package/dist/{package-D0dxZ-W8.mjs → package-CjlsAaRe.mjs} +7 -7
  104. package/dist/{peerTools-B_eiNB3P.mjs → peerTools-CxmrKnfV.mjs} +4 -4
  105. package/dist/{peerTools-BktGmlpd.cjs → peerTools-DtGKWli5.cjs} +4 -4
  106. package/dist/{persistence-CIIhP0Uw.mjs → persistence-C_tYtOqK.mjs} +2 -2
  107. package/dist/{persistence-DweHi8xa.cjs → persistence-DXbKOHxl.cjs} +2 -2
  108. package/dist/{piRunnerArgs-BNzWTNRV.cjs → piRunnerArgs-BVRZe2AR.cjs} +1 -1
  109. package/dist/{piRunnerArgs-cQafsadv.mjs → piRunnerArgs-BpHc-JZl.mjs} +1 -1
  110. package/dist/{piRuntime-VZLSwW-4.cjs → piRuntime-D7eio8Ix.cjs} +1 -1
  111. package/dist/{piRuntime-Bel5lOLb.mjs → piRuntime-DOdGF395.mjs} +1 -1
  112. package/dist/{piTerminal-CS5SDi_H.mjs → piTerminal-dpxz4Q8D.mjs} +17 -17
  113. package/dist/{piTerminal-DkR8sPv-.cjs → piTerminal-y_PRo2NY.cjs} +16 -16
  114. package/dist/processTree-CMHWlVse.cjs +66 -0
  115. package/dist/processTree-CP5IvQ2Z.mjs +61 -0
  116. package/dist/{rateLimitWindows-Bp4T21RI.cjs → rateLimitWindows-DFnMU2Vt.cjs} +1 -1
  117. package/dist/{rateLimitWindows-Bo6XVnie.mjs → rateLimitWindows-DYHDGuzQ.mjs} +1 -1
  118. package/dist/{registerCommonHandlers-B7QZxkCL.cjs → registerCommonHandlers-60VuTkdg.cjs} +2 -2
  119. package/dist/{registerCommonHandlers-CR5jpiSx.mjs → registerCommonHandlers-D8OMpBbQ.mjs} +2 -2
  120. package/dist/{registerKillSessionHandler-DLiu24CQ.mjs → registerKillSessionHandler-Drhf7-Vz.mjs} +6 -6
  121. package/dist/{registerKillSessionHandler-CcX84g-T.cjs → registerKillSessionHandler-pqChBKwO.cjs} +6 -6
  122. package/dist/{remoteSessionClient-CL3akj0K.cjs → remoteSessionClient-B7NvjHD3.cjs} +5 -5
  123. package/dist/{remoteSessionClient-CUjw1COc.mjs → remoteSessionClient-D01Hso2-.mjs} +5 -5
  124. package/dist/{reportProgressTool-BLLwMQrN.mjs → reportProgressTool-B203EZCR.mjs} +2 -2
  125. package/dist/{reportProgressTool-DzMi4mvH.cjs → reportProgressTool-Du_zAK4h.cjs} +2 -2
  126. package/dist/{run-DGokR_6q.mjs → run-DX4Zs3Ug.mjs} +34 -34
  127. package/dist/{run-5pmOElaW.cjs → run-DZ5jU53c.cjs} +34 -34
  128. package/dist/{runClaude-BFlpZQds.mjs → runClaude-CgPHXP0L.mjs} +27 -23
  129. package/dist/{runClaude-EnYNvkV0.cjs → runClaude-ClRhHpwR.cjs} +26 -22
  130. package/dist/{runClaudeDeps-CUDebE9e.cjs → runClaudeDeps-D2v_WDSL.cjs} +387 -89
  131. package/dist/{runClaudeDeps-D1M1dzlZ.mjs → runClaudeDeps-Dz2iydq4.mjs} +393 -95
  132. package/dist/{runGemini-Bu69Zu1u.cjs → runGemini-BtZqGFkp.cjs} +208 -193
  133. package/dist/{runGemini-Bub8T5cM.mjs → runGemini-DBXxpoY8.mjs} +208 -193
  134. package/dist/{runOpenClaw-DVu73F_i.mjs → runOpenClaw-BOHpzCEU.mjs} +19 -19
  135. package/dist/{runOpenClaw-Cob5F3FC.cjs → runOpenClaw-D8q8G57u.cjs} +18 -18
  136. package/dist/{sandbox-9EKOFyQF.mjs → sandbox-C452Vrsc.mjs} +4 -4
  137. package/dist/{sandbox-GDqMagSF.cjs → sandbox-Cu9mMzjx.cjs} +4 -4
  138. package/dist/selfCheck-BAvqBwBR.mjs +84 -0
  139. package/dist/{selfCheck-DiNo34da.cjs → selfCheck-gKa3uVr1.cjs} +35 -35
  140. package/dist/{send-ThC80164.cjs → send-2Vb5eppI.cjs} +8 -8
  141. package/dist/{send-wgtHphq8.mjs → send-B8HARi7x.mjs} +9 -9
  142. package/dist/{server-Bb8v2fOj.mjs → server-BBWCIZyS.mjs} +4 -4
  143. package/dist/{server-bidHnstE.cjs → server-Db9Wuam3.cjs} +6 -6
  144. package/dist/{sessionLock-BWBcBZKh.cjs → sessionLock-6qL_N6Rn.cjs} +3 -3
  145. package/dist/{sessionLock-gb32sVPR.mjs → sessionLock-ZfvFVdUi.mjs} +3 -3
  146. package/dist/{sessionModeFile-C-fr1M1h.mjs → sessionModeFile-CWVq8AT9.mjs} +1 -1
  147. package/dist/{sessionModeFile-DhuTNcJr.cjs → sessionModeFile-CsLtn_PL.cjs} +1 -1
  148. package/dist/{sessionOps-ByZJbkMq.mjs → sessionOps-CdgbEJgf.mjs} +5 -5
  149. package/dist/{sessionOps-9MChM9Op.cjs → sessionOps-Dmt7WUUs.cjs} +4 -4
  150. package/dist/{sessionScanner-CxXPAVyS.mjs → sessionScanner-CNVaSNOn.mjs} +34 -4
  151. package/dist/{sessionScanner-BpegdnXK.cjs → sessionScanner-CQL_WSaC.cjs} +34 -3
  152. package/dist/{sessions-C1X4z_Lm.cjs → sessions-BJblG_Hx.cjs} +9 -9
  153. package/dist/{sessions-l-UgJGjV.mjs → sessions-DTomHfFg.mjs} +10 -10
  154. package/dist/{setupOfflineReconnection-CgtXlV74.mjs → setupOfflineReconnection-C5trsV-j.mjs} +2 -2
  155. package/dist/{setupOfflineReconnection-CS_8Da8R.cjs → setupOfflineReconnection-DVA0VpQL.cjs} +2 -2
  156. package/dist/{spawn-FyoHqYWo.mjs → spawn-CQJFgoOq.mjs} +15 -14
  157. package/dist/{spawn-D2BlNdZu.cjs → spawn-DRyNAqD8.cjs} +14 -13
  158. package/dist/{spawnAgents-BhsbJ253.mjs → spawnAgents-BjtmjBvP.mjs} +1 -1
  159. package/dist/{spawnAgents-CgMKuOhZ.cjs → spawnAgents-CCjJifAW.cjs} +1 -1
  160. package/dist/{spawnHappyCLI-DsC256j_.mjs → spawnHappyCLI-B_0RWxD4.mjs} +1 -1
  161. package/dist/{spawnHappyCLI-DByQcqEN.cjs → spawnHappyCLI-ChniczJ5.cjs} +1 -1
  162. package/dist/{specialCommands-DGUeZqdm.cjs → specialCommands-DbntVs0d.cjs} +3 -3
  163. package/dist/{specialCommands-DUUBqzvd.mjs → specialCommands-DkdFJi4N.mjs} +3 -3
  164. package/dist/{startFileWatcher-BtBaahTn.cjs → startFileWatcher-C292fhra.cjs} +1 -1
  165. package/dist/{startFileWatcher-CaYRObJu.mjs → startFileWatcher-UQyTSRAP.mjs} +1 -1
  166. package/dist/{streamRelay-DqPFsCgx.cjs → streamRelay-Cx01enfe.cjs} +1 -1
  167. package/dist/{streamRelay-C8zI7OnR.mjs → streamRelay-_qCd873P.mjs} +1 -1
  168. package/dist/{sync-D5YqUVjS.mjs → sync-C3p7-KLn.mjs} +1 -1
  169. package/dist/{sync-BK-IBkuB.cjs → sync-C7sxoUYG.cjs} +1 -1
  170. package/dist/{systemPrompt-e-qeag_h.mjs → systemPrompt-CdHOlyVW.mjs} +2 -2
  171. package/dist/{systemPrompt-DaTKLEb-.cjs → systemPrompt-DtibzbRU.cjs} +2 -2
  172. package/dist/{teams-D9xwa_d3.cjs → teams-D7O7TpVU.cjs} +6 -6
  173. package/dist/{teams-ClrppvKu.mjs → teams-ujXr3AFn.mjs} +6 -6
  174. package/dist/{time-0szhiPo4.cjs → time-Dg5tVB8S.cjs} +1 -1
  175. package/dist/{time-CvrpeD3S.mjs → time-yEL6wHUF.mjs} +1 -1
  176. package/dist/{titleGenerator-Dz5P7sE1.cjs → titleGenerator-BMEaDTwU.cjs} +2 -2
  177. package/dist/{titleGenerator-BZ5770wq.mjs → titleGenerator-Dr-BtjzO.mjs} +1 -1
  178. package/dist/{todo-CkmNJQey.cjs → todo-CUcFamGs.cjs} +6 -6
  179. package/dist/{todo-o-miKcN2.mjs → todo-CvJe4M2C.mjs} +6 -6
  180. package/dist/{tools-Cp0qJeBq.mjs → tools-BrM3bZW5.mjs} +1 -1
  181. package/dist/{tools-C77-Ssan.cjs → tools-DDKTB5aQ.cjs} +1 -1
  182. package/dist/{uninstall-DGUPERDX.cjs → uninstall-7oLuhYIu.cjs} +3 -3
  183. package/dist/{uninstall-jNJDCLD_.mjs → uninstall-CEcMMQGz.mjs} +3 -3
  184. package/package.json +7 -7
  185. package/dist/selfCheck-CNo4uzGB.mjs +0 -84
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var configuration = require('./configuration-UV4EE5ui.cjs');
4
- var persistence = require('./persistence-DweHi8xa.cjs');
3
+ var configuration = require('./configuration-DZPy0T9Z.cjs');
4
+ var persistence = require('./persistence-DXbKOHxl.cjs');
5
5
 
6
6
  class AutomationsRequestError extends Error {
7
7
  constructor(status, code, runStatus) {
@@ -1,5 +1,5 @@
1
- import { c as configuration } from './configuration-BNGPXg07.mjs';
2
- import { c as readCredentialsForConfiguredRelay, r as readSettings } from './persistence-CIIhP0Uw.mjs';
1
+ import { c as configuration } from './configuration-D55F0t16.mjs';
2
+ import { c as readCredentialsForConfiguredRelay, r as readSettings } from './persistence-C_tYtOqK.mjs';
3
3
 
4
4
  class AutomationsRequestError extends Error {
5
5
  constructor(status, code, runStatus) {
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var configuration = require('./configuration-UV4EE5ui.cjs');
5
- var persistence = require('./persistence-DweHi8xa.cjs');
6
- var context = require('./context-BmH2BKip.cjs');
4
+ var configuration = require('./configuration-DZPy0T9Z.cjs');
5
+ var persistence = require('./persistence-DXbKOHxl.cjs');
6
+ var context = require('./context-BKbrZ55r.cjs');
7
7
 
8
8
  async function teamRequest(path, method, token, scoped, body) {
9
9
  const response = await fetch(`${configuration.configuration.serverUrl}${path}`, {
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var tools = require('../tools-C77-Ssan.cjs');
4
- var reportProgressTool = require('../reportProgressTool-DzMi4mvH.cjs');
5
- var peerTools = require('../peerTools-BktGmlpd.cjs');
3
+ var tools = require('../tools-DDKTB5aQ.cjs');
4
+ var reportProgressTool = require('../reportProgressTool-Du_zAK4h.cjs');
5
+ var peerTools = require('../peerTools-DtGKWli5.cjs');
6
6
  var agentGuidance = require('../agentGuidance-BtBx2xxE.cjs');
7
7
  var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
8
8
  var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
@@ -10,33 +10,33 @@ var index_js = require('@modelcontextprotocol/sdk/client/index.js');
10
10
  var streamableHttp_js = require('@modelcontextprotocol/sdk/client/streamableHttp.js');
11
11
  var z = require('zod');
12
12
  var limits = require('../limits-C-a7gr04.cjs');
13
- require('../client-BHZVyQwi.cjs');
13
+ require('../client-DyvBTYee.cjs');
14
14
  require('node:crypto');
15
- require('../configuration-UV4EE5ui.cjs');
15
+ require('../configuration-DZPy0T9Z.cjs');
16
16
  require('node:fs');
17
17
  require('node:os');
18
18
  require('node:path');
19
- require('../package-VqWv7EI5.cjs');
19
+ require('../package-Ch9WGDV_.cjs');
20
20
  require('node:fs/promises');
21
- require('../persistence-DweHi8xa.cjs');
21
+ require('../persistence-DXbKOHxl.cjs');
22
22
  require('../authRelay-BdYkC1Po.cjs');
23
23
  require('tweetnacl');
24
- require('../logger-C7dRaCkE.cjs');
24
+ require('../logger-LvwVeATU.cjs');
25
25
  require('chalk');
26
26
  require('node:util');
27
- require('../context-BmH2BKip.cjs');
28
- require('../index-BZdhwBKa.cjs');
27
+ require('../context-BKbrZ55r.cjs');
28
+ require('../index-De8L5lFK.cjs');
29
29
  require('@paralleldrive/cuid2');
30
- require('../client-BhLhjj_x.cjs');
30
+ require('../client-COmgDDy0.cjs');
31
31
  require('../precheckCompat-CWOi5c9L.cjs');
32
32
  require('../ids-B6ZC0HGt.cjs');
33
- require('../controlClient-CtsQMw--.cjs');
34
- require('../sessionOps-9MChM9Op.cjs');
33
+ require('../controlClient-SX8gSza2.cjs');
34
+ require('../sessionOps-Dmt7WUUs.cjs');
35
35
  require('axios');
36
- require('../time-0szhiPo4.cjs');
36
+ require('../time-Dg5tVB8S.cjs');
37
37
  require('socket.io-client');
38
38
  require('../backgroundTaskActivity-CBvUdj39.cjs');
39
- require('../remoteSessionClient-CL3akj0K.cjs');
39
+ require('../remoteSessionClient-B7NvjHD3.cjs');
40
40
  require('../trimIdent-4gvk9Wk6.cjs');
41
41
 
42
42
  function parseArgs(argv) {
@@ -1,6 +1,6 @@
1
- import { r as registerTeamsTools } from '../tools-Cp0qJeBq.mjs';
2
- import { r as registerAutomationTools, a as registerReportProgressTool } from '../reportProgressTool-BLLwMQrN.mjs';
3
- import { r as registerSessionPeerTools } from '../peerTools-B_eiNB3P.mjs';
1
+ import { r as registerTeamsTools } from '../tools-BrM3bZW5.mjs';
2
+ import { r as registerAutomationTools, a as registerReportProgressTool } from '../reportProgressTool-B203EZCR.mjs';
3
+ import { r as registerSessionPeerTools } from '../peerTools-CxmrKnfV.mjs';
4
4
  import { P as PREVIEW_TOOL_NAME, a as PREVIEW_TOOL_TITLE, b as PREVIEW_TOOL_DESCRIPTION, c as PREVIEW_DOWNLOAD_PARAM_DESCRIPTION, R as REPORT_PROGRESS_TOOL_NAME } from '../agentGuidance-BDYt2Qy2.mjs';
5
5
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
6
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -8,33 +8,33 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
8
8
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
9
9
  import { z } from 'zod';
10
10
  import { C as CLIPBOARD_TOOL_NAME, a as CLIPBOARD_TOOL_TITLE, b as CLIPBOARD_TOOL_DESCRIPTION } from '../limits-DIo7rEBR.mjs';
11
- import '../client-eQjOvC55.mjs';
11
+ import '../client-BPMWutfs.mjs';
12
12
  import 'node:crypto';
13
- import '../configuration-BNGPXg07.mjs';
13
+ import '../configuration-D55F0t16.mjs';
14
14
  import 'node:fs';
15
15
  import 'node:os';
16
16
  import 'node:path';
17
- import '../package-D0dxZ-W8.mjs';
17
+ import '../package-CjlsAaRe.mjs';
18
18
  import 'node:fs/promises';
19
- import '../persistence-CIIhP0Uw.mjs';
19
+ import '../persistence-C_tYtOqK.mjs';
20
20
  import '../authRelay-DSAvg1uv.mjs';
21
21
  import 'tweetnacl';
22
- import '../logger-D5EzMy30.mjs';
22
+ import '../logger-13cBr_ew.mjs';
23
23
  import 'chalk';
24
24
  import 'node:util';
25
- import '../context-Ptdnlcv6.mjs';
26
- import '../index-boE-d8CM.mjs';
25
+ import '../context-CCRpVXFo.mjs';
26
+ import '../index-DMy3OCBe.mjs';
27
27
  import '@paralleldrive/cuid2';
28
- import '../client-C4ddTzrD.mjs';
28
+ import '../client-DG5ndWLw.mjs';
29
29
  import '../precheckCompat-DeEbilbr.mjs';
30
30
  import '../ids-DU6sLx4C.mjs';
31
- import '../controlClient-DqtC0pq1.mjs';
32
- import '../sessionOps-ByZJbkMq.mjs';
31
+ import '../controlClient-C4xB5J6O.mjs';
32
+ import '../sessionOps-CdgbEJgf.mjs';
33
33
  import 'axios';
34
- import '../time-CvrpeD3S.mjs';
34
+ import '../time-yEL6wHUF.mjs';
35
35
  import 'socket.io-client';
36
- import '../backgroundTaskActivity-8PdPxrvy.mjs';
37
- import '../remoteSessionClient-CUjw1COc.mjs';
36
+ import '../backgroundTaskActivity-BVwJBl02.mjs';
37
+ import '../remoteSessionClient-D01Hso2-.mjs';
38
38
  import '../trimIdent-BAjmv_TG.mjs';
39
39
 
40
40
  function parseArgs(argv) {
@@ -1,12 +1,52 @@
1
1
  import { execSync } from 'node:child_process';
2
2
  import { spawn } from 'cross-spawn';
3
3
  import { createInterface } from 'node:readline';
4
- import { l as logger } from './logger-D5EzMy30.mjs';
4
+ import { l as logger } from './logger-13cBr_ew.mjs';
5
5
  import { e as errorLogMetadata, c as contentLogMetadata } from './contentLogMetadata-BlWI0egu.mjs';
6
6
  import { i as initializeSandbox, w as wrapForMcpTransport } from './manager-BEsI4qt3.mjs';
7
- import { p as packageJson } from './package-D0dxZ-W8.mjs';
8
- import { s as shouldReadCodexRateLimits, i as isUnsupportedCodexMethodError } from './rateLimitWindows-Bo6XVnie.mjs';
7
+ import { p as packageJson } from './package-CjlsAaRe.mjs';
8
+ import { s as shouldReadCodexRateLimits, i as isUnsupportedCodexMethodError } from './rateLimitWindows-DYHDGuzQ.mjs';
9
+ import { s as stopProcessGracefully, k as killProcessTree } from './processTree-CP5IvQ2Z.mjs';
9
10
 
11
+ const CODEX_HELPER_LABEL_MAX_CHARS = 80;
12
+ function codexHelperLabel(prompt) {
13
+ if (typeof prompt !== "string") return null;
14
+ const collapsed = prompt.replace(/\s+/g, " ").trim();
15
+ if (collapsed.length === 0) return null;
16
+ if (collapsed.length <= CODEX_HELPER_LABEL_MAX_CHARS) return collapsed;
17
+ const keep = CODEX_HELPER_LABEL_MAX_CHARS - 1;
18
+ const last = collapsed.charCodeAt(keep - 1);
19
+ const end = last >= 55296 && last <= 56319 ? keep - 1 : keep;
20
+ return `${collapsed.slice(0, end)}\u2026`;
21
+ }
22
+ function codexAgentPathSegments(agentPath) {
23
+ if (typeof agentPath !== "string") return [];
24
+ return agentPath.split("/").map((segment) => segment.trim()).filter((segment) => segment.length > 0);
25
+ }
26
+ function isRootAgentPath(segments) {
27
+ return segments.length === 1 && segments[0] === "root";
28
+ }
29
+ function codexChildAnnouncements(item) {
30
+ if (item.type === "subAgentActivity") {
31
+ const threadId = item.agentThreadId;
32
+ if (typeof threadId !== "string" || threadId.length === 0) return [];
33
+ const segments = codexAgentPathSegments(item.agentPath);
34
+ if (isRootAgentPath(segments)) return [];
35
+ const leaf = segments.at(-1);
36
+ return [{ threadId, label: leaf && leaf.length > 0 ? leaf : null }];
37
+ }
38
+ if (item.type === "collabAgentToolCall") {
39
+ const receivers = Array.isArray(item.receiverThreadIds) ? item.receiverThreadIds.filter((id) => typeof id === "string" && id.length > 0) : [];
40
+ const label = item.tool === "spawnAgent" ? codexHelperLabel(item.prompt) : null;
41
+ return [...new Set(receivers)].map((threadId) => ({ threadId, label }));
42
+ }
43
+ return [];
44
+ }
45
+
46
+ function jsonRpcErrorCodeOf(error) {
47
+ const code = error?.jsonRpcCode;
48
+ return typeof code === "number" ? code : null;
49
+ }
10
50
  function isAppServerAvailable() {
11
51
  try {
12
52
  const version = execSync("codex --version", { encoding: "utf8", windowsHide: true }).trim();
@@ -121,6 +161,18 @@ class CodexAppServerClient {
121
161
  // Approval / elicitation requests we are still answering: a human may take
122
162
  // longer than the watchdog to decide, and that is not Codex going silent.
123
163
  inflightServerRequests = 0;
164
+ // B-628: `turn/steer` — a message sent into the running turn (approach from Orca,
165
+ // src/main/codex/codex-structured-turn-start.ts). This app-server has no such
166
+ // method (-32601) until it is respawned; a refusal is per call (the turn it named
167
+ // ended or changed meanwhile, a review/compact turn).
168
+ steerUnsupported = false;
169
+ /** Steered inputs Codex has not echoed back as a `userMessage` item yet: clientId → turnId. */
170
+ steeredAwaitingEcho = /* @__PURE__ */ new Map();
171
+ /** Waiters for the pending turn to open (steerTurn); released when it opens or ends. */
172
+ turnOpenWaiters = [];
173
+ /** B-628: the names Codex gave the child threads it spawned (see codexChildThreads.ts). */
174
+ childThreadLabels = /* @__PURE__ */ new Map();
175
+ static MAX_CHILD_LABELS = 128;
124
176
  // Handlers set by the consumer (runCodex.ts)
125
177
  eventHandler = null;
126
178
  approvalHandler = null;
@@ -191,6 +243,58 @@ class CodexAppServerClient {
191
243
  const threadId = this.extractThreadId(params);
192
244
  return threadId === null || this._threadId === null || threadId === this._threadId;
193
245
  }
246
+ /** B-628: the child thread a frame belongs to, or null for the session's own. */
247
+ childThreadIdOf(params) {
248
+ return this.isOwnThreadFrame(params) ? null : this.extractThreadId(params);
249
+ }
250
+ /**
251
+ * B-628: what a child thread's item carries so the mapper files it under the child's
252
+ * card (`subagent` → the session protocol's sub-agent envelope, as a Claude Task's
253
+ * children are) instead of in the main conversation as the session's own work.
254
+ */
255
+ childItemFields(params) {
256
+ const child = this.childThreadIdOf(params);
257
+ if (!child) return {};
258
+ const label = this.childThreadLabels.get(child);
259
+ return { subagent: child, ...label ? { subagent_label: label } : {} };
260
+ }
261
+ rememberChildLabels(item) {
262
+ for (const { threadId, label } of codexChildAnnouncements(item)) {
263
+ if (!label || this.childThreadLabels.has(threadId)) continue;
264
+ if (this.childThreadLabels.size >= CodexAppServerClient.MAX_CHILD_LABELS) {
265
+ const oldest = this.childThreadLabels.keys().next().value;
266
+ if (oldest !== void 0) this.childThreadLabels.delete(oldest);
267
+ }
268
+ this.childThreadLabels.set(threadId, label);
269
+ }
270
+ }
271
+ /**
272
+ * B-628: steered inputs the ended turn never echoed. `report` = the turn did not complete
273
+ * (interrupted, failed, app-server gone, given up): Codex never read them, tell the runner.
274
+ * A turn that *completed* drains its pending input before it ends (core/src/session/turn.rs),
275
+ * so an unechoed input there is a codex that accepted the steer but echoes no `clientId` —
276
+ * forgotten silently, because a false「not delivered」on a message the model did read would
277
+ * be worse than today's silence.
278
+ */
279
+ dropUnechoedSteers(turnId, report) {
280
+ const dropped = [];
281
+ for (const [clientId, steeredTurn] of this.steeredAwaitingEcho) {
282
+ if (turnId === null || steeredTurn === turnId) {
283
+ dropped.push(clientId);
284
+ this.steeredAwaitingEcho.delete(clientId);
285
+ }
286
+ }
287
+ if (dropped.length === 0) return;
288
+ if (!report) {
289
+ logger.debug(`[CodexAppServer] ${dropped.length} steered message(s) completed without an echo; not reported`);
290
+ return;
291
+ }
292
+ this.eventHandler?.({
293
+ type: "steer_dropped",
294
+ client_ids: dropped,
295
+ ...turnId ? { turn_id: turnId } : {}
296
+ });
297
+ }
194
298
  /** Codex's last stderr lines, one line, for a message a person reads. */
195
299
  stderrTail() {
196
300
  return this.stderrRing.replace(/\x1b\[[0-9;]*m/g, "").replace(/\s+/g, " ").trim();
@@ -225,6 +329,7 @@ class CodexAppServerClient {
225
329
  this.completedTurnIds.add(turnId);
226
330
  if (failed) this.failedTurnIds.add(turnId);
227
331
  }
332
+ this.dropUnechoedSteers(turnId, aborted || failed);
228
333
  if (aborted) {
229
334
  this.eventHandler?.({
230
335
  type: "turn_aborted",
@@ -264,6 +369,11 @@ class CodexAppServerClient {
264
369
  if (method === "turn/completed") {
265
370
  if (!this.isOwnThreadFrame(params)) {
266
371
  logger.debug(`[CodexAppServer] Child thread ${this.extractThreadId(params)} ended a turn`);
372
+ this.eventHandler?.({
373
+ type: "subagent_turn_end",
374
+ ...this.childItemFields(params),
375
+ status: this.extractTurnStatus(params)
376
+ });
267
377
  return true;
268
378
  }
269
379
  this.emitRawTurnCompletion(
@@ -296,6 +406,7 @@ class CodexAppServerClient {
296
406
  return true;
297
407
  }
298
408
  if (method === "thread/tokenUsage/updated") {
409
+ if (!this.isOwnThreadFrame(params)) return true;
299
410
  const tokenUsage = params?.tokenUsage;
300
411
  if (tokenUsage && typeof tokenUsage === "object") {
301
412
  this.eventHandler?.({
@@ -309,8 +420,15 @@ class CodexAppServerClient {
309
420
  if (!item || typeof item !== "object") {
310
421
  return method.startsWith("item/");
311
422
  }
423
+ const child = this.childItemFields(params);
312
424
  if ((method === "item/started" || method === "item/completed") && (item.type === "collabAgentToolCall" || item.type === "subAgentActivity")) {
313
- this.eventHandler?.({ type: "collab_agent_item", item });
425
+ this.rememberChildLabels(item);
426
+ this.eventHandler?.({ type: "collab_agent_item", item, ...child });
427
+ return true;
428
+ }
429
+ if (method === "item/completed" && item.type === "userMessage") {
430
+ const clientId = typeof item.clientId === "string" ? item.clientId : null;
431
+ if (clientId && !child.subagent) this.steeredAwaitingEcho.delete(clientId);
314
432
  return true;
315
433
  }
316
434
  if (method === "item/started" && item.type === "commandExecution") {
@@ -321,7 +439,8 @@ class CodexAppServerClient {
321
439
  callId,
322
440
  command: item.command,
323
441
  cwd: item.cwd,
324
- description: item.command
442
+ description: item.command,
443
+ ...child
325
444
  });
326
445
  return true;
327
446
  }
@@ -336,7 +455,8 @@ class CodexAppServerClient {
336
455
  duration_ms: item.durationMs ?? null,
337
456
  status: item.status,
338
457
  cwd: item.cwd,
339
- command: item.command
458
+ command: item.command,
459
+ ...child
340
460
  });
341
461
  return true;
342
462
  }
@@ -351,7 +471,8 @@ class CodexAppServerClient {
351
471
  type: "patch_apply_begin",
352
472
  call_id: callId,
353
473
  callId,
354
- changes: changes ?? {}
474
+ changes: changes ?? {},
475
+ ...child
355
476
  });
356
477
  return true;
357
478
  }
@@ -360,7 +481,8 @@ class CodexAppServerClient {
360
481
  type: "patch_apply_end",
361
482
  call_id: callId,
362
483
  callId,
363
- status: item.status
484
+ status: item.status,
485
+ ...child
364
486
  });
365
487
  if (callId && (item.status === "completed" || item.status === "failed" || item.status === "declined")) {
366
488
  this.rawFileChangesByItemId.delete(callId);
@@ -375,7 +497,8 @@ class CodexAppServerClient {
375
497
  type: "agent_message",
376
498
  message: text,
377
499
  item_id: item.id,
378
- phase: item.phase
500
+ phase: item.phase,
501
+ ...child
379
502
  });
380
503
  }
381
504
  return true;
@@ -448,6 +571,7 @@ class CodexAppServerClient {
448
571
  }
449
572
  if (this.pendingTurnCompletion) {
450
573
  const turnId = this.pendingTurnCompletion.turnId ?? this._turnId;
574
+ this.dropUnechoedSteers(null, true);
451
575
  this.eventHandler?.({
452
576
  type: "turn_aborted",
453
577
  reason: "process-exit",
@@ -458,6 +582,9 @@ class CodexAppServerClient {
458
582
  this.resolvePendingTurn(true);
459
583
  });
460
584
  this.stderrRing = "";
585
+ this.steerUnsupported = false;
586
+ this.steeredAwaitingEcho.clear();
587
+ this.childThreadLabels.clear();
461
588
  proc.stderr?.on("data", (chunk) => {
462
589
  if (this.process !== proc || this.processEpoch !== epoch) return;
463
590
  const text = chunk.toString().trim();
@@ -496,20 +623,12 @@ ${text}`.slice(-400);
496
623
  logger.debug(`[CodexAppServer] Disconnecting; pid=${pid ?? "none"}`);
497
624
  this.readline?.close();
498
625
  this.readline = null;
499
- try {
500
- proc?.stdin?.end();
501
- proc?.kill("SIGTERM");
502
- } catch {
503
- }
504
- if (pid) {
505
- const killTimer = setTimeout(() => {
506
- try {
507
- process.kill(pid, 0);
508
- process.kill(pid, "SIGKILL");
509
- } catch {
510
- }
511
- }, 2e3);
512
- killTimer.unref();
626
+ if (proc) {
627
+ stopProcessGracefully(proc);
628
+ if (pid) {
629
+ const killTimer = setTimeout(() => killProcessTree(proc), CodexAppServerClient.FORCE_KILL_AFTER_MS);
630
+ killTimer.unref();
631
+ }
513
632
  }
514
633
  this.process = null;
515
634
  this.connected = false;
@@ -528,6 +647,7 @@ ${text}`.slice(-400);
528
647
  req.reject(new Error(`Codex process disconnected while waiting for ${req.method}`));
529
648
  this.pending.delete(id);
530
649
  }
650
+ this.dropUnechoedSteers(null, true);
531
651
  this.resolvePendingTurn(true);
532
652
  if (this.sandboxCleanup) {
533
653
  try {
@@ -731,6 +851,8 @@ ${text}`.slice(-400);
731
851
  // ─── Turn management ────────────────────────────────────────
732
852
  /** Default grace period after interrupt before forcing a restart (ms). */
733
853
  static ABORT_GRACE_MS = 3e3;
854
+ /** How long the graceful stop gets before the process tree is killed (disconnectInternal). */
855
+ static FORCE_KILL_AFTER_MS = 2e3;
734
856
  hasPendingTurnCompletion() {
735
857
  return this.pendingTurnCompletion !== null;
736
858
  }
@@ -740,6 +862,7 @@ ${text}`.slice(-400);
740
862
  this.clearThreadStopGrace();
741
863
  this.pendingTurnCompletion.resolve(aborted);
742
864
  this.pendingTurnCompletion = null;
865
+ this.releaseTurnOpenWaiters();
743
866
  }
744
867
  markPendingTurnStarted(turnId) {
745
868
  if (!this.pendingTurnCompletion) return;
@@ -747,6 +870,86 @@ ${text}`.slice(-400);
747
870
  if (turnId) {
748
871
  this.pendingTurnCompletion.turnId = turnId;
749
872
  }
873
+ this.releaseTurnOpenWaiters();
874
+ }
875
+ // ─── B-628: steering the running turn ───────────────────────
876
+ /** How long a steer waits for the pending turn to open before the message is queued instead. */
877
+ static STEER_OPEN_WAIT_MS = 5e3;
878
+ /** A turn Codex has reported running, under an id `turn/steer` can name. */
879
+ turnIsOpen() {
880
+ return this.pendingTurnCompletion?.opened === true && this._turnId !== null;
881
+ }
882
+ releaseTurnOpenWaiters() {
883
+ const waiters = this.turnOpenWaiters;
884
+ this.turnOpenWaiters = [];
885
+ for (const release of waiters) release();
886
+ }
887
+ /**
888
+ * Waits for the pending turn to open — `turn/start` is in flight, or the runner is still
889
+ * bringing a released app-server back before sending it (B-461) — as Orca's send does
890
+ * (codex-structured-turn-open-wait.ts, 5 s). Resolves early when the turn ends instead.
891
+ */
892
+ async waitForTurnOpen(timeoutMs) {
893
+ if (this.turnIsOpen()) return true;
894
+ if (timeoutMs <= 0) return false;
895
+ await new Promise((resolve) => {
896
+ const release = () => {
897
+ clearTimeout(timer);
898
+ resolve();
899
+ };
900
+ const timer = setTimeout(release, timeoutMs);
901
+ timer.unref();
902
+ this.turnOpenWaiters.push(release);
903
+ });
904
+ return this.turnIsOpen();
905
+ }
906
+ /**
907
+ * B-628: send a message into the turn running right now (`turn/steer`, codex ≥ 0.148 /
908
+ * app-server-protocol v2 `TurnSteerParams`). Codex appends it to that turn's pending input
909
+ * and the model reads it before its next call; the turn keeps its own model, approval
910
+ * policy and sandbox — the runner applies any change on the next `turn/start`. Codex
911
+ * refuses before taking any input (expectedTurnId is a precondition), so a non-`steered`
912
+ * outcome always means "queue it for the next turn as before": `no-turn` (nothing running,
913
+ * or it ended while we waited), `unsupported` (this app-server has no `turn/steer`,
914
+ * remembered until it is respawned), `refused` (Codex declined this one), `failed`
915
+ * (transport — the turn itself is reported through its own events).
916
+ */
917
+ async steerTurn(input, opts) {
918
+ if (this.steerUnsupported) return "unsupported";
919
+ if (this.pendingInterrupt) return "no-turn";
920
+ const opened = await this.waitForTurnOpen(opts?.waitForTurnMs ?? CodexAppServerClient.STEER_OPEN_WAIT_MS);
921
+ const threadId = this._threadId;
922
+ const turnId = this._turnId;
923
+ if (!opened || !threadId || !turnId || !this.connected || this.pendingInterrupt) return "no-turn";
924
+ const params = {
925
+ threadId,
926
+ expectedTurnId: turnId,
927
+ ...input.clientId ? { clientUserMessageId: input.clientId } : {},
928
+ input: [
929
+ { type: "text", text: input.text },
930
+ ...(input.images ?? []).map((path) => ({ type: "localImage", path }))
931
+ ]
932
+ };
933
+ try {
934
+ const result = await this.request("turn/steer", params);
935
+ const steeredTurnId = typeof result?.turnId === "string" && result.turnId.length > 0 ? result.turnId : turnId;
936
+ if (input.clientId) this.steeredAwaitingEcho.set(input.clientId, steeredTurnId);
937
+ logger.debug(`[CodexAppServer] Steered a message into turn ${steeredTurnId}`);
938
+ return "steered";
939
+ } catch (error) {
940
+ const code = jsonRpcErrorCodeOf(error);
941
+ if (code === -32601) {
942
+ this.steerUnsupported = true;
943
+ logger.debug("[CodexAppServer] turn/steer is not supported by this codex; queuing instead");
944
+ return "unsupported";
945
+ }
946
+ if (code !== null) {
947
+ logger.debug("[CodexAppServer] turn/steer refused:", errorLogMetadata(error));
948
+ return "refused";
949
+ }
950
+ logger.debug("[CodexAppServer] turn/steer failed:", errorLogMetadata(error));
951
+ return "failed";
952
+ }
750
953
  }
751
954
  /** Default wait for Codex's `turn/completed` after its thread reported idle/systemError. */
752
955
  static THREAD_STOP_GRACE_MS = 1500;
@@ -909,6 +1112,7 @@ ${text}`.slice(-400);
909
1112
  } catch (err) {
910
1113
  this.clearTurnWatchdog();
911
1114
  this.pendingTurnCompletion = null;
1115
+ this.releaseTurnOpenWaiters();
912
1116
  throw err;
913
1117
  }
914
1118
  const aborted = await completion;
@@ -926,6 +1130,7 @@ ${text}`.slice(-400);
926
1130
  }
927
1131
  logger.warn(`[CodexAppServer] No notification from Codex for ${timeoutMs}ms \u2014 giving the turn up as aborted`);
928
1132
  const turnId = this.pendingTurnCompletion.turnId ?? this._turnId;
1133
+ this.dropUnechoedSteers(turnId, true);
929
1134
  this.eventHandler?.({
930
1135
  type: "turn_aborted",
931
1136
  reason: "timeout",
@@ -976,6 +1181,7 @@ ${text}`.slice(-400);
976
1181
  logger.debug(
977
1182
  `[CodexAppServer] Clearing thread state: thread=${this._threadId ?? "none"} turn=${this._turnId ?? "none"}`
978
1183
  );
1184
+ this.dropUnechoedSteers(null, true);
979
1185
  this.resolvePendingTurn(true);
980
1186
  this._threadId = null;
981
1187
  this._turnId = null;
@@ -984,6 +1190,7 @@ ${text}`.slice(-400);
984
1190
  this.failedTurnIds.clear();
985
1191
  this.lastTurnError = null;
986
1192
  this.rawFileChangesByItemId.clear();
1193
+ this.childThreadLabels.clear();
987
1194
  }
988
1195
  // ─── JSON-RPC transport ─────────────────────────────────────
989
1196
  /** Default timeout for RPC requests (ms). */
@@ -1064,7 +1271,9 @@ ${text}`.slice(-400);
1064
1271
  }
1065
1272
  this.pending.delete(msg.id);
1066
1273
  if (msg.error) {
1067
- pending.reject(new Error(`${pending.method}: ${msg.error.message} (code=${msg.error.code})`));
1274
+ const error = new Error(`${pending.method}: ${msg.error.message} (code=${msg.error.code})`);
1275
+ if (typeof msg.error.code === "number") error.jsonRpcCode = msg.error.code;
1276
+ pending.reject(error);
1068
1277
  } else {
1069
1278
  pending.resolve(msg.result);
1070
1279
  }