very-happy-cli 0.2.174 → 0.2.175

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 (168) hide show
  1. package/dist/{AcpBackend-CS8TSaaH.mjs → AcpBackend-BZrLVcHb.mjs} +3 -3
  2. package/dist/{AcpBackend-MMfGUkmp.cjs → AcpBackend-Sb6N_HcB.cjs} +3 -3
  3. package/dist/{BasePermissionHandler-CJQPjMEa.cjs → BasePermissionHandler-BbLYwd13.cjs} +1 -1
  4. package/dist/{BasePermissionHandler-BiWdGyL1.mjs → BasePermissionHandler-DriZLITp.mjs} +1 -1
  5. package/dist/{BaseReasoningProcessor-2sLuoRYw.mjs → BaseReasoningProcessor-DnykPlPo.mjs} +1 -1
  6. package/dist/{BaseReasoningProcessor-BY9a3RTU.cjs → BaseReasoningProcessor-_S1PbSvH.cjs} +1 -1
  7. package/dist/{agentHome-BeAq0X3o.cjs → agentHome-BoYfpemd.cjs} +4 -4
  8. package/dist/{agentHome-CK6SbAVu.mjs → agentHome-BtuRubHG.mjs} +4 -4
  9. package/dist/{api-rOLB1-sV.mjs → api-D08IEaWa.mjs} +8 -8
  10. package/dist/{api-Cy_Mbe8W.cjs → api-KZmVqSKO.cjs} +8 -8
  11. package/dist/{apiMachine-VBkOChth.mjs → apiMachine-Cx9Zn-78.mjs} +13 -13
  12. package/dist/{apiMachine-A9n14NN1.cjs → apiMachine-Dct2GDAq.cjs} +13 -13
  13. package/dist/{attachmentContent-ULnsMsIL.cjs → attachmentContent-4L9dO8E3.cjs} +1 -1
  14. package/dist/{attachmentContent-CSGb8uDJ.mjs → attachmentContent-PrNJg8gG.mjs} +1 -1
  15. package/dist/{auth-BD2z4MCH.cjs → auth-BGmM3Vlm.cjs} +5 -5
  16. package/dist/{auth--YSQ1-dG.cjs → auth-BI0CsMcy.cjs} +8 -8
  17. package/dist/{auth-CiZfkTkd.mjs → auth-D1qHU-i_.mjs} +5 -5
  18. package/dist/{auth-EnJQu_vf.mjs → auth-PY_HGlzz.mjs} +8 -8
  19. package/dist/{auto-D_hKBFAY.mjs → auto-COMphIfD.mjs} +13 -13
  20. package/dist/{auto-CobMGmFM.cjs → auto-DM4_FeKb.cjs} +13 -13
  21. package/dist/{bootstrap-D1RRCJdQ.mjs → bootstrap-CWjpC5-J.mjs} +2 -2
  22. package/dist/{bootstrap-BYrt5zUv.cjs → bootstrap-DTJ6-vYT.cjs} +2 -2
  23. package/dist/{browser-i45hmvWw.cjs → browser-DmgVoopB.cjs} +1 -1
  24. package/dist/{browser-IVfX6PQT.mjs → browser-xuW4fiHo.mjs} +1 -1
  25. package/dist/{claudeLocal-DnPoeXP2.mjs → claudeLocal-B0P-wVJJ.mjs} +4 -4
  26. package/dist/{claudeLocal-Cg8Qn4tF.cjs → claudeLocal-CtZVz3ee.cjs} +4 -4
  27. package/dist/{claudeLocalLauncher-BAavVhU8.mjs → claudeLocalLauncher-D4vmjI3c.mjs} +9 -9
  28. package/dist/{claudeLocalLauncher-CFlsscqX.cjs → claudeLocalLauncher-Dnv4CH8r.cjs} +9 -9
  29. package/dist/{claudeSessionFork-bp8LeRZ9.mjs → claudeSessionFork-CxjOBoBh.mjs} +1 -1
  30. package/dist/{claudeSessionFork-DmwPXMmz.cjs → claudeSessionFork-DQk5-dzR.cjs} +1 -1
  31. package/dist/{client-QtWC3yii.cjs → client-BHZVyQwi.cjs} +3 -3
  32. package/dist/{client-B6H6ZROd.cjs → client-BhLhjj_x.cjs} +2 -2
  33. package/dist/{client-Bi1DOVy9.mjs → client-C4ddTzrD.mjs} +2 -2
  34. package/dist/{client-DbqP92Fy.mjs → client-eQjOvC55.mjs} +3 -3
  35. package/dist/codex/happyMcpStdioBridge.cjs +14 -14
  36. package/dist/codex/happyMcpStdioBridge.mjs +14 -14
  37. package/dist/{codexAppServerClient-pnCpJlD8.mjs → codexAppServerClient-CppPl_R6.mjs} +150 -23
  38. package/dist/{codexAppServerClient-BWB1267F.cjs → codexAppServerClient-D-9z-lWP.cjs} +150 -23
  39. package/dist/{codexCommand-u4m_X8VA.cjs → codexCommand-AgVJYnFU.cjs} +44 -39
  40. package/dist/{codexCommand-BmtdCu-D.mjs → codexCommand-BdrBNbZu.mjs} +44 -39
  41. package/dist/{config-Czc1tQDn.mjs → config-Cr3VUzbE.mjs} +3 -3
  42. package/dist/{config-BaJCpLzN.cjs → config-D89sE3wK.cjs} +3 -3
  43. package/dist/{configuration-zOfO2qdB.mjs → configuration-BNGPXg07.mjs} +1 -1
  44. package/dist/{configuration-Btwt68O2.cjs → configuration-UV4EE5ui.cjs} +1 -1
  45. package/dist/{connect-DQaDa6i7.cjs → connect-B35YXbdZ.cjs} +11 -11
  46. package/dist/{connect-D21OhdsD.mjs → connect-C0iLkCiY.mjs} +11 -11
  47. package/dist/{context-BknomZTq.cjs → context-BmH2BKip.cjs} +1 -1
  48. package/dist/{context-BTX3YYdt.mjs → context-Ptdnlcv6.mjs} +1 -1
  49. package/dist/{controlClient-CEpaptre.cjs → controlClient-CtsQMw--.cjs} +3 -3
  50. package/dist/{controlClient-CbmWgWJW.mjs → controlClient-DqtC0pq1.mjs} +3 -3
  51. package/dist/{createSessionMetadata-Cgfcg0WZ.cjs → createSessionMetadata-2IuH5nlA.cjs} +2 -2
  52. package/dist/{createSessionMetadata-CM7ErnPh.mjs → createSessionMetadata-CtNMvfth.mjs} +2 -2
  53. package/dist/{defaultPermissionMode-DqdkzYUY.cjs → defaultPermissionMode-Bn4HcU8S.cjs} +2 -2
  54. package/dist/{defaultPermissionMode-CmgCDVpL.mjs → defaultPermissionMode-DYihjV2g.mjs} +2 -2
  55. package/dist/{deterministicJson-DVvfcibH.mjs → deterministicJson-DF4xv6MH.mjs} +8 -8
  56. package/dist/{deterministicJson-B3V5Ss2l.cjs → deterministicJson-je21npNx.cjs} +8 -8
  57. package/dist/{doctor-C_Xfs8Bs.cjs → doctor-BXKcYVGU.cjs} +7 -7
  58. package/dist/{doctor-CidhGBde.mjs → doctor-Ba92L7-b.mjs} +7 -7
  59. package/dist/{downloadTarget-C-18yOBz.mjs → downloadTarget-CUJg8iJV.mjs} +6 -6
  60. package/dist/{downloadTarget-DJKG6wVj.cjs → downloadTarget-JC7FZl7W.cjs} +6 -6
  61. package/dist/{ensureDaemonRunning-CWo9yDAC.mjs → ensureDaemonRunning-JPA9tHNE.mjs} +5 -5
  62. package/dist/{ensureDaemonRunning-Dk1yo6aK.cjs → ensureDaemonRunning-bIp6-vgi.cjs} +5 -5
  63. package/dist/{handleResumeCommand-DvFAI68O.cjs → handleResumeCommand-B6b9kIYf.cjs} +5 -5
  64. package/dist/{handleResumeCommand-ApqydtLf.mjs → handleResumeCommand-B6lE5DtU.mjs} +5 -5
  65. package/dist/{index-azi2eHdp.cjs → index-B1ABQRrB.cjs} +4 -4
  66. package/dist/{index-CXCoTvVd.cjs → index-B2KL0aPc.cjs} +32 -32
  67. package/dist/{index-D0IWz-WE.mjs → index-CZLwo1FS.mjs} +3 -3
  68. package/dist/{index-BVC5vBcc.mjs → index-CjE4kBKx.mjs} +33 -33
  69. package/dist/{index-CjFzrcin.cjs → index-D759ViMU.cjs} +3 -3
  70. package/dist/{index-CMeZ7WcS.mjs → index-DW1ONaGc.mjs} +4 -4
  71. package/dist/index.cjs +2 -2
  72. package/dist/index.mjs +2 -2
  73. package/dist/{install-BOPmEeSo.mjs → install-CmojqnLK.mjs} +3 -3
  74. package/dist/{install-DayuanHz.cjs → install-KjIsK_EA.cjs} +3 -3
  75. package/dist/lib.cjs +10 -10
  76. package/dist/lib.mjs +10 -10
  77. package/dist/{lidState-7uLoa43a.cjs → lidState-BmJp2pLt.cjs} +1 -1
  78. package/dist/{lidState-Bv862v_R.mjs → lidState-CL1NdKfQ.mjs} +1 -1
  79. package/dist/{localHappyAgentAuth-CfILduPd.cjs → localHappyAgentAuth-9SP7hdiw.cjs} +1 -1
  80. package/dist/{localHappyAgentAuth-CLP3CBMK.mjs → localHappyAgentAuth-B7f4Ysn0.mjs} +1 -1
  81. package/dist/{logger-XjIS0lU7.cjs → logger-C7dRaCkE.cjs} +2 -2
  82. package/dist/{logger-CUxbqfrp.mjs → logger-D5EzMy30.mjs} +2 -2
  83. package/dist/{machineMetadata-DTxYqMdE.cjs → machineMetadata-DYYuK_0c.cjs} +3 -3
  84. package/dist/{machineMetadata-QfdvKIrL.mjs → machineMetadata-DqplCWue.mjs} +3 -3
  85. package/dist/{main-DcfU9Axf.mjs → main-CnV62agu.mjs} +44 -44
  86. package/dist/{main-BpC52KlL.cjs → main-kgCQgknK.cjs} +44 -44
  87. package/dist/{mcp-EEwHzYYU.cjs → mcp-BV0vxHtz.cjs} +14 -14
  88. package/dist/{mcp-BhUNcpoX.mjs → mcp-bDPaj-tM.mjs} +14 -14
  89. package/dist/{mirrorProtocol-WfE5yd3v.cjs → mirrorProtocol-BSHVZ8Nf.cjs} +2 -2
  90. package/dist/{mirrorProtocol-BoBu65cj.mjs → mirrorProtocol-ClKhNXYe.mjs} +2 -2
  91. package/dist/{package-DkI3yDe0.mjs → package-D0dxZ-W8.mjs} +7 -7
  92. package/dist/{package-DFQUF2in.cjs → package-VqWv7EI5.cjs} +7 -7
  93. package/dist/{peerTools-zfe59JAw.mjs → peerTools-B_eiNB3P.mjs} +4 -4
  94. package/dist/{peerTools-DbI6tEk1.cjs → peerTools-BktGmlpd.cjs} +4 -4
  95. package/dist/{persistence-CBToZ0R6.mjs → persistence-CIIhP0Uw.mjs} +2 -2
  96. package/dist/{persistence-BO7AS2NK.cjs → persistence-DweHi8xa.cjs} +2 -2
  97. package/dist/{piRunnerArgs-CICVlVem.cjs → piRunnerArgs-BNzWTNRV.cjs} +1 -1
  98. package/dist/{piRunnerArgs-C2us7__q.mjs → piRunnerArgs-cQafsadv.mjs} +1 -1
  99. package/dist/{piRuntime-BYHZYbw6.mjs → piRuntime-Bel5lOLb.mjs} +1 -1
  100. package/dist/{piRuntime-CTezrTNw.cjs → piRuntime-VZLSwW-4.cjs} +1 -1
  101. package/dist/{piTerminal-YCRkoVWF.mjs → piTerminal-CS5SDi_H.mjs} +16 -16
  102. package/dist/{piTerminal-CeiWEB-T.cjs → piTerminal-DkR8sPv-.cjs} +16 -16
  103. package/dist/{rateLimitWindows-i2-530Zt.mjs → rateLimitWindows-Bo6XVnie.mjs} +1 -1
  104. package/dist/{rateLimitWindows-U7NsRvIa.cjs → rateLimitWindows-Bp4T21RI.cjs} +1 -1
  105. package/dist/{registerCommonHandlers-DTeuk3Hw.cjs → registerCommonHandlers-B7QZxkCL.cjs} +2 -2
  106. package/dist/{registerCommonHandlers-C_KbP5Mq.mjs → registerCommonHandlers-CR5jpiSx.mjs} +2 -2
  107. package/dist/{registerKillSessionHandler-B_FqygY4.cjs → registerKillSessionHandler-CcX84g-T.cjs} +4 -4
  108. package/dist/{registerKillSessionHandler-B7zpuzvS.mjs → registerKillSessionHandler-DLiu24CQ.mjs} +4 -4
  109. package/dist/{remoteSessionClient-D79ci1L8.cjs → remoteSessionClient-CL3akj0K.cjs} +5 -5
  110. package/dist/{remoteSessionClient-Bk1Qzb5I.mjs → remoteSessionClient-CUjw1COc.mjs} +5 -5
  111. package/dist/{reportProgressTool-DujvMncK.mjs → reportProgressTool-BLLwMQrN.mjs} +1 -1
  112. package/dist/{reportProgressTool-oJMMqzKb.cjs → reportProgressTool-DzMi4mvH.cjs} +1 -1
  113. package/dist/{run-CyiUjBZK.cjs → run-5pmOElaW.cjs} +31 -31
  114. package/dist/{run-DVE2Gq-E.mjs → run-DGokR_6q.mjs} +30 -30
  115. package/dist/{runClaude-BcpBew2h.mjs → runClaude-BFlpZQds.mjs} +19 -19
  116. package/dist/{runClaude-CmAHAR3N.cjs → runClaude-EnYNvkV0.cjs} +19 -19
  117. package/dist/{runClaudeDeps-Z_RVvcuG.cjs → runClaudeDeps-CUDebE9e.cjs} +32 -32
  118. package/dist/{runClaudeDeps-C2fTmXoo.mjs → runClaudeDeps-D1M1dzlZ.mjs} +37 -37
  119. package/dist/{runGemini-Bv4nVBfj.cjs → runGemini-Bu69Zu1u.cjs} +30 -30
  120. package/dist/{runGemini-BYmVfC3b.mjs → runGemini-Bub8T5cM.mjs} +30 -30
  121. package/dist/{runOpenClaw-D5suaSgY.cjs → runOpenClaw-Cob5F3FC.cjs} +15 -15
  122. package/dist/{runOpenClaw-msp2nzW8.mjs → runOpenClaw-DVu73F_i.mjs} +15 -15
  123. package/dist/{sandbox-CH7xLX1-.mjs → sandbox-9EKOFyQF.mjs} +4 -4
  124. package/dist/{sandbox-CSnsdXId.cjs → sandbox-GDqMagSF.cjs} +4 -4
  125. package/dist/selfCheck-CNo4uzGB.mjs +84 -0
  126. package/dist/{selfCheck-B4mCW5Em.cjs → selfCheck-DiNo34da.cjs} +34 -34
  127. package/dist/{send-DzRwXl8a.cjs → send-ThC80164.cjs} +8 -8
  128. package/dist/{send-lrV7t7dr.mjs → send-wgtHphq8.mjs} +8 -8
  129. package/dist/{server-DBHPW2gs.mjs → server-Bb8v2fOj.mjs} +4 -4
  130. package/dist/{server-BAwRC79P.cjs → server-bidHnstE.cjs} +6 -6
  131. package/dist/{sessionLock-ClIuWFru.cjs → sessionLock-BWBcBZKh.cjs} +3 -3
  132. package/dist/{sessionLock-D_-T15Y-.mjs → sessionLock-gb32sVPR.mjs} +3 -3
  133. package/dist/{sessionModeFile-BP1s4On2.mjs → sessionModeFile-C-fr1M1h.mjs} +1 -1
  134. package/dist/{sessionModeFile-BFejyKn5.cjs → sessionModeFile-DhuTNcJr.cjs} +1 -1
  135. package/dist/{sessionOps-C7wI8Ll6.cjs → sessionOps-9MChM9Op.cjs} +4 -4
  136. package/dist/{sessionOps-DfAtoDD5.mjs → sessionOps-ByZJbkMq.mjs} +4 -4
  137. package/dist/{sessionScanner-BJFPUwar.cjs → sessionScanner-BpegdnXK.cjs} +3 -3
  138. package/dist/{sessionScanner-1-ANJdrm.mjs → sessionScanner-CxXPAVyS.mjs} +3 -3
  139. package/dist/{sessions-Bi13Rn0K.cjs → sessions-C1X4z_Lm.cjs} +9 -9
  140. package/dist/{sessions-Dp_X8vP2.mjs → sessions-l-UgJGjV.mjs} +9 -9
  141. package/dist/{setupOfflineReconnection-BJCXuFad.cjs → setupOfflineReconnection-CS_8Da8R.cjs} +2 -2
  142. package/dist/{setupOfflineReconnection-D51KXWAP.mjs → setupOfflineReconnection-CgtXlV74.mjs} +2 -2
  143. package/dist/{spawn-BiYYv0J7.cjs → spawn-D2BlNdZu.cjs} +11 -11
  144. package/dist/{spawn-DeXPOMMC.mjs → spawn-FyoHqYWo.mjs} +11 -11
  145. package/dist/{spawnHappyCLI-CrKdy_rv.cjs → spawnHappyCLI-DByQcqEN.cjs} +1 -1
  146. package/dist/{spawnHappyCLI-CYS23qZY.mjs → spawnHappyCLI-DsC256j_.mjs} +1 -1
  147. package/dist/{specialCommands-Dkg5wrXd.cjs → specialCommands-DGUeZqdm.cjs} +3 -3
  148. package/dist/{specialCommands-BbNlcS3G.mjs → specialCommands-DUUBqzvd.mjs} +3 -3
  149. package/dist/{startFileWatcher-BJ4vTfRp.cjs → startFileWatcher-BtBaahTn.cjs} +1 -1
  150. package/dist/{startFileWatcher-CgH0PknF.mjs → startFileWatcher-CaYRObJu.mjs} +1 -1
  151. package/dist/{sync-CGVTRg-R.cjs → sync-BK-IBkuB.cjs} +1 -1
  152. package/dist/{sync-MTpgBfV2.mjs → sync-D5YqUVjS.mjs} +1 -1
  153. package/dist/{systemPrompt-DRCJdhNo.cjs → systemPrompt-DaTKLEb-.cjs} +1 -1
  154. package/dist/{systemPrompt-BMGFnaRU.mjs → systemPrompt-e-qeag_h.mjs} +1 -1
  155. package/dist/{teams-H_F3UZkh.mjs → teams-ClrppvKu.mjs} +6 -6
  156. package/dist/{teams-0d4XG2_h.cjs → teams-D9xwa_d3.cjs} +6 -6
  157. package/dist/{time-ChuhR6SU.cjs → time-0szhiPo4.cjs} +1 -1
  158. package/dist/{time-7iVn8KLQ.mjs → time-CvrpeD3S.mjs} +1 -1
  159. package/dist/{titleGenerator-CLdAiwN1.mjs → titleGenerator-BZ5770wq.mjs} +1 -1
  160. package/dist/{titleGenerator-CozWnU-t.cjs → titleGenerator-Dz5P7sE1.cjs} +2 -2
  161. package/dist/{todo-BeIYBXws.cjs → todo-CkmNJQey.cjs} +5 -5
  162. package/dist/{todo-7mtNKrxn.mjs → todo-o-miKcN2.mjs} +5 -5
  163. package/dist/{tools-9hPR5-u8.cjs → tools-C77-Ssan.cjs} +1 -1
  164. package/dist/{tools-BSlqfWAq.mjs → tools-Cp0qJeBq.mjs} +1 -1
  165. package/dist/{uninstall-Bf5MardO.cjs → uninstall-DGUPERDX.cjs} +3 -3
  166. package/dist/{uninstall-Uei9RnVT.mjs → uninstall-jNJDCLD_.mjs} +3 -3
  167. package/package.json +7 -7
  168. package/dist/selfCheck-WbfDqlfQ.mjs +0 -84
@@ -3,11 +3,11 @@
3
3
  var node_child_process = require('node:child_process');
4
4
  var spawn = require('cross-spawn');
5
5
  var node_readline = require('node:readline');
6
- var logger = require('./logger-XjIS0lU7.cjs');
6
+ var logger = require('./logger-C7dRaCkE.cjs');
7
7
  var contentLogMetadata = require('./contentLogMetadata-ZSFk_NjQ.cjs');
8
8
  var manager = require('./manager-HrEj442o.cjs');
9
- var _package = require('./package-DFQUF2in.cjs');
10
- var rateLimitWindows = require('./rateLimitWindows-U7NsRvIa.cjs');
9
+ var _package = require('./package-VqWv7EI5.cjs');
10
+ var rateLimitWindows = require('./rateLimitWindows-Bp4T21RI.cjs');
11
11
 
12
12
  function isAppServerAvailable() {
13
13
  try {
@@ -91,7 +91,6 @@ class CodexAppServerClient {
91
91
  _turnId = null;
92
92
  threadDefaults = null;
93
93
  // Turn completion tracking for the currently active sendTurnAndWait call.
94
- // A completion event only resolves once we have seen task_started for this turn.
95
94
  pendingTurnCompletion = null;
96
95
  // Tracks in-flight interruptTurn() RPCs so sendTurnAndWait can wait for them
97
96
  // before starting a new turn (prevents stale turn/interrupt from aborting the next turn).
@@ -101,6 +100,22 @@ class CodexAppServerClient {
101
100
  idleRelease = null;
102
101
  notificationProtocol = "unknown";
103
102
  completedTurnIds = /* @__PURE__ */ new Set();
103
+ /** B-625: turns whose failure has already been forwarded, so a second failed frame is not. */
104
+ failedTurnIds = /* @__PURE__ */ new Set();
105
+ // B-625: the app-server speaks for every thread it hosts — the session's own and the
106
+ // children `spawn_agent` opens — so a lifecycle frame (turn/started, turn/completed,
107
+ // thread/status/changed, error, thread/closed) is the session's only when its `threadId`
108
+ // is ours; a frame naming no thread belongs to the thread it was asked on (Orca's rule,
109
+ // src/main/codex/codex-structured-turn-open-wait.ts). Before this, a child's
110
+ // `turn/completed` ended the parent's turn in the UI and a child's `turn/started`
111
+ // retargeted `turn/interrupt` at the child.
112
+ /** The own thread's last turn-ending `error` (willRetry=false), for a turn end that arrives without a verdict. */
113
+ lastTurnError = null;
114
+ /** Own thread reported idle/systemError while a turn was pending: Codex's `turn/completed`
115
+ * follows within a millisecond; this ends the turn if it does not (see armThreadStopGrace). */
116
+ threadStopGrace = null;
117
+ /** Last few hundred chars of the app-server's stderr: Codex's own last words when it dies. */
118
+ stderrRing = "";
104
119
  rawFileChangesByItemId = /* @__PURE__ */ new Map();
105
120
  // B-622: inactivity watchdog for the pending turn — re-armed by every
106
121
  // notification, never a cap on how long a turn may run (see sendTurnAndWait).
@@ -169,8 +184,21 @@ class CodexAppServerClient {
169
184
  const status = params?.turn?.status ?? params?.status ?? null;
170
185
  return typeof status === "string" && status.length > 0 ? status : null;
171
186
  }
187
+ extractThreadId(params) {
188
+ const threadId = params?.threadId ?? params?.thread_id ?? params?.thread?.id ?? null;
189
+ return typeof threadId === "string" && threadId.length > 0 ? threadId : null;
190
+ }
191
+ /** B-625: whether a lifecycle frame is about the session's own thread (see the field comment). */
192
+ isOwnThreadFrame(params) {
193
+ const threadId = this.extractThreadId(params);
194
+ return threadId === null || this._threadId === null || threadId === this._threadId;
195
+ }
196
+ /** Codex's last stderr lines, one line, for a message a person reads. */
197
+ stderrTail() {
198
+ return this.stderrRing.replace(/\x1b\[[0-9;]*m/g, "").replace(/\s+/g, " ").trim();
199
+ }
172
200
  shouldHandleRawNotification(method) {
173
- const isRawNotification = method === "thread/started" || method === "turn/started" || method === "turn/completed" || method === "thread/status/changed" || method === "thread/tokenUsage/updated" || method.startsWith("item/");
201
+ const isRawNotification = method === "thread/started" || method === "turn/started" || method === "turn/completed" || method === "thread/status/changed" || method === "thread/closed" || method === "thread/tokenUsage/updated" || method.startsWith("item/");
174
202
  if (!isRawNotification) {
175
203
  return false;
176
204
  }
@@ -185,14 +213,19 @@ class CodexAppServerClient {
185
213
  emitRawTurnCompletion(turnId, status, error, source) {
186
214
  const aborted = status === "cancelled" || status === "canceled" || status === "aborted" || status === "interrupted";
187
215
  const failed = status === "failed" || error !== void 0 && error !== null;
216
+ this.clearThreadStopGrace();
188
217
  this.tryResolvePendingTurn(aborted, turnId, source);
189
218
  this._turnId = null;
190
219
  this.maybeRefreshRateLimits();
220
+ if (this.lastTurnError && (!turnId || !this.lastTurnError.turnId || this.lastTurnError.turnId === turnId)) {
221
+ this.lastTurnError = null;
222
+ }
191
223
  if (turnId && this.completedTurnIds.has(turnId)) {
192
- if (!failed) return;
224
+ if (!failed || this.failedTurnIds.has(turnId)) return;
193
225
  }
194
226
  if (turnId) {
195
227
  this.completedTurnIds.add(turnId);
228
+ if (failed) this.failedTurnIds.add(turnId);
196
229
  }
197
230
  if (aborted) {
198
231
  this.eventHandler?.({
@@ -215,6 +248,10 @@ class CodexAppServerClient {
215
248
  return false;
216
249
  }
217
250
  if (method === "turn/started") {
251
+ if (!this.isOwnThreadFrame(params)) {
252
+ logger.logger.debug(`[CodexAppServer] Child thread ${this.extractThreadId(params)} started a turn`);
253
+ return true;
254
+ }
218
255
  const turnId = this.extractTurnId(params);
219
256
  if (turnId) {
220
257
  this._turnId = turnId;
@@ -227,6 +264,10 @@ class CodexAppServerClient {
227
264
  return true;
228
265
  }
229
266
  if (method === "turn/completed") {
267
+ if (!this.isOwnThreadFrame(params)) {
268
+ logger.logger.debug(`[CodexAppServer] Child thread ${this.extractThreadId(params)} ended a turn`);
269
+ return true;
270
+ }
230
271
  this.emitRawTurnCompletion(
231
272
  this.extractTurnId(params),
232
273
  this.extractTurnStatus(params),
@@ -236,9 +277,23 @@ class CodexAppServerClient {
236
277
  return true;
237
278
  }
238
279
  if (method === "thread/status/changed") {
280
+ if (!this.isOwnThreadFrame(params)) return true;
239
281
  const statusType = params?.status?.type;
240
- if (statusType === "idle" && this.pendingTurnCompletion) {
241
- this.emitRawTurnCompletion(this._turnId, "completed", null, method);
282
+ if ((statusType === "idle" || statusType === "systemError") && this.pendingTurnCompletion?.opened) {
283
+ this.armThreadStopGrace(statusType);
284
+ } else if (statusType === "active") {
285
+ this.clearThreadStopGrace();
286
+ }
287
+ return true;
288
+ }
289
+ if (method === "thread/closed") {
290
+ if (this.isOwnThreadFrame(params) && this.pendingTurnCompletion) {
291
+ this.emitRawTurnCompletion(
292
+ this.pendingTurnCompletion.turnId ?? this._turnId,
293
+ "aborted",
294
+ { message: "Codex closed the thread before the turn ended." },
295
+ method
296
+ );
242
297
  }
243
298
  return true;
244
299
  }
@@ -384,17 +439,35 @@ class CodexAppServerClient {
384
439
  return;
385
440
  }
386
441
  this.connected = false;
442
+ const tail = this.stderrTail();
443
+ const exited = `Codex process exited (code=${code ?? "null"}${signal ? `, signal=${signal}` : ""})`;
387
444
  for (const [id, req] of this.pending) {
388
445
  if (req.epoch !== epoch) continue;
389
- req.reject(new Error(`Codex process exited (code=${code}) while waiting for ${req.method}`));
446
+ const error = new Error(`${exited} while waiting for ${req.method}`);
447
+ error.codexStderrTail = tail;
448
+ req.reject(error);
390
449
  this.pending.delete(id);
391
450
  }
451
+ if (this.pendingTurnCompletion) {
452
+ const turnId = this.pendingTurnCompletion.turnId ?? this._turnId;
453
+ this.eventHandler?.({
454
+ type: "turn_aborted",
455
+ reason: "process-exit",
456
+ ...turnId ? { turn_id: turnId } : {},
457
+ error: { message: `${exited}${tail ? `: ${tail}` : ""}` }
458
+ });
459
+ }
392
460
  this.resolvePendingTurn(true);
393
461
  });
462
+ this.stderrRing = "";
394
463
  proc.stderr?.on("data", (chunk) => {
395
464
  if (this.process !== proc || this.processEpoch !== epoch) return;
396
465
  const text = chunk.toString().trim();
397
- if (text) logger.logger.debug("[CodexAppServer:stderr]", contentLogMetadata.contentLogMetadata(text));
466
+ if (text) {
467
+ logger.logger.debug("[CodexAppServer:stderr]", contentLogMetadata.contentLogMetadata(text));
468
+ this.stderrRing = `${this.stderrRing}
469
+ ${text}`.slice(-400);
470
+ }
398
471
  });
399
472
  this.readline = node_readline.createInterface({ input: proc.stdout });
400
473
  this.readline.on("line", (line) => {
@@ -445,6 +518,9 @@ class CodexAppServerClient {
445
518
  this._turnId = null;
446
519
  this.notificationProtocol = "unknown";
447
520
  this.completedTurnIds.clear();
521
+ this.failedTurnIds.clear();
522
+ this.lastTurnError = null;
523
+ this.clearThreadStopGrace();
448
524
  if (!opts?.preserveThreadState) {
449
525
  this._threadId = null;
450
526
  this.threadDefaults = null;
@@ -663,15 +739,49 @@ class CodexAppServerClient {
663
739
  resolvePendingTurn(aborted) {
664
740
  if (!this.pendingTurnCompletion) return;
665
741
  this.clearTurnWatchdog();
742
+ this.clearThreadStopGrace();
666
743
  this.pendingTurnCompletion.resolve(aborted);
667
744
  this.pendingTurnCompletion = null;
668
745
  }
669
746
  markPendingTurnStarted(turnId) {
670
747
  if (!this.pendingTurnCompletion) return;
748
+ this.pendingTurnCompletion.opened = true;
671
749
  if (turnId) {
672
750
  this.pendingTurnCompletion.turnId = turnId;
673
751
  }
674
752
  }
753
+ /** Default wait for Codex's `turn/completed` after its thread reported idle/systemError. */
754
+ static THREAD_STOP_GRACE_MS = 1500;
755
+ /**
756
+ * B-625: the own thread stopped (idle / systemError) while a turn was pending and
757
+ * had opened. Codex's `turn/completed` follows at once in every probed release
758
+ * (0.154.0: 1 ms); this is the net under a release that does not send it, so the
759
+ * session never waits on the silence watchdog for a turn Codex has already left.
760
+ */
761
+ armThreadStopGrace(statusType) {
762
+ this.clearThreadStopGrace();
763
+ const graceMs = this.pendingTurnCompletion?.threadStopGraceMs ?? CodexAppServerClient.THREAD_STOP_GRACE_MS;
764
+ this.threadStopGrace = setTimeout(() => {
765
+ this.threadStopGrace = null;
766
+ const pending = this.pendingTurnCompletion;
767
+ if (!pending) return;
768
+ const turnId = pending.turnId ?? this._turnId;
769
+ const lastError = this.lastTurnError && (!turnId || !this.lastTurnError.turnId || this.lastTurnError.turnId === turnId) ? this.lastTurnError.error : null;
770
+ logger.logger.warn(`[CodexAppServer] Thread went ${statusType} and no turn/completed followed for turn ${turnId ?? "?"}; ending the turn`);
771
+ const failed = statusType === "systemError" || lastError !== null;
772
+ this.emitRawTurnCompletion(
773
+ turnId,
774
+ failed ? "failed" : "completed",
775
+ lastError ?? (failed ? { message: "Codex reported a system error and ended the turn without a verdict." } : null),
776
+ `thread/status/changed:${statusType}`
777
+ );
778
+ }, graceMs);
779
+ }
780
+ clearThreadStopGrace() {
781
+ if (!this.threadStopGrace) return;
782
+ clearTimeout(this.threadStopGrace);
783
+ this.threadStopGrace = null;
784
+ }
675
785
  tryResolvePendingTurn(aborted, turnId, source) {
676
786
  const pending = this.pendingTurnCompletion;
677
787
  if (!pending) return;
@@ -773,6 +883,8 @@ class CodexAppServerClient {
773
883
  }
774
884
  /** Default timeout for waiting on turn completion (ms). 10 minutes. */
775
885
  static TURN_TIMEOUT_MS = 10 * 60 * 1e3;
886
+ /** How much of the app-server's stderr is kept for its exit message. */
887
+ static STDERR_TAIL_CHARS = 400;
776
888
  /**
777
889
  * Send a user turn and wait for it to complete (task_complete or turn_aborted).
778
890
  * Returns { aborted: true } if the turn was aborted (user cancel, permission reject, etc.).
@@ -787,8 +899,11 @@ class CodexAppServerClient {
787
899
  const completion = new Promise((resolve) => {
788
900
  this.pendingTurnCompletion = {
789
901
  resolve,
790
- turnId: null
902
+ turnId: null,
903
+ opened: false,
904
+ threadStopGraceMs: opts?.threadStopGraceMs ?? CodexAppServerClient.THREAD_STOP_GRACE_MS
791
905
  };
906
+ this.lastTurnError = null;
792
907
  this.armTurnWatchdog(timeoutMs);
793
908
  });
794
909
  try {
@@ -868,6 +983,8 @@ class CodexAppServerClient {
868
983
  this._turnId = null;
869
984
  this.threadDefaults = null;
870
985
  this.completedTurnIds.clear();
986
+ this.failedTurnIds.clear();
987
+ this.lastTurnError = null;
871
988
  this.rawFileChangesByItemId.clear();
872
989
  }
873
990
  // ─── JSON-RPC transport ─────────────────────────────────────
@@ -1136,6 +1253,7 @@ class CodexAppServerClient {
1136
1253
  }
1137
1254
  if (method === "thread/started" || method === "turn/started" || method === "turn/completed" || method === "thread/status/changed") {
1138
1255
  logger.logger.debug(`[CodexAppServer] Lifecycle notification: ${method}`);
1256
+ if (!this.isOwnThreadFrame(params)) return;
1139
1257
  if (method === "turn/started") {
1140
1258
  const turnId = this.extractTurnId(params);
1141
1259
  if (turnId) {
@@ -1162,19 +1280,28 @@ class CodexAppServerClient {
1162
1280
  logger.logger.debug(`[CodexAppServer] mcpServer startup status:`, params);
1163
1281
  return;
1164
1282
  }
1165
- if (method === "error" && params?.willRetry === true) {
1283
+ if (method === "error") {
1284
+ if (!this.isOwnThreadFrame(params)) return;
1166
1285
  const error = params?.error ?? {};
1167
- const message = typeof error.message === "string" ? error.message : "";
1168
- const info = error.codexErrorInfo;
1169
- const httpStatus = info && typeof info === "object" ? info.responseStreamDisconnected?.httpStatusCode ?? info.httpStatusCode ?? null : null;
1170
- const turnId = typeof params?.turnId === "string" ? params.turnId : null;
1171
- this.eventHandler?.({
1172
- type: "turn_retry",
1173
- message,
1174
- ...typeof httpStatus === "number" ? { http_status: httpStatus } : {},
1175
- ...turnId ? { turn_id: turnId } : {},
1176
- ...typeof error.additionalDetails === "string" ? { details: error.additionalDetails } : {}
1177
- });
1286
+ const turnId = typeof params?.turnId === "string" && params.turnId.length > 0 ? params.turnId : null;
1287
+ if (params?.willRetry === true) {
1288
+ const message = typeof error.message === "string" ? error.message : "";
1289
+ const info = error.codexErrorInfo;
1290
+ const httpStatus = info && typeof info === "object" ? info.responseStreamDisconnected?.httpStatusCode ?? info.httpStatusCode ?? null : null;
1291
+ this.eventHandler?.({
1292
+ type: "turn_retry",
1293
+ message,
1294
+ ...typeof httpStatus === "number" ? { http_status: httpStatus } : {},
1295
+ ...turnId ? { turn_id: turnId } : {},
1296
+ ...typeof error.additionalDetails === "string" ? { details: error.additionalDetails } : {}
1297
+ });
1298
+ return;
1299
+ }
1300
+ this.lastTurnError = { turnId, error };
1301
+ const pending = this.pendingTurnCompletion;
1302
+ if (pending && !pending.opened && (turnId === null || pending.turnId === null || pending.turnId === turnId)) {
1303
+ this.emitRawTurnCompletion(turnId ?? pending.turnId, "failed", error, "error:unopened-turn");
1304
+ }
1178
1305
  return;
1179
1306
  }
1180
1307
  logger.logger.debug(`[CodexAppServer] Notification: ${method}`);
@@ -1,61 +1,61 @@
1
1
  'use strict';
2
2
 
3
- var auth = require('./auth-BD2z4MCH.cjs');
3
+ var auth = require('./auth-BGmM3Vlm.cjs');
4
4
  var index = require('./index-BZdhwBKa.cjs');
5
5
  var forkBackfill = require('./forkBackfill-8eLDeS73.cjs');
6
6
  var node_crypto = require('node:crypto');
7
7
  var cuid2 = require('@paralleldrive/cuid2');
8
8
  var agentAttachments = require('./agentAttachments-Dbw8iMCZ.cjs');
9
- var attachmentContent = require('./attachmentContent-ULnsMsIL.cjs');
9
+ var attachmentContent = require('./attachmentContent-4L9dO8E3.cjs');
10
10
  var ink = require('ink');
11
- var sessionLock = require('./sessionLock-ClIuWFru.cjs');
11
+ var sessionLock = require('./sessionLock-BWBcBZKh.cjs');
12
12
  var React = require('react');
13
- var api = require('./api-Cy_Mbe8W.cjs');
14
- var codexAppServerClient = require('./codexAppServerClient-BWB1267F.cjs');
15
- var specialCommands = require('./specialCommands-Dkg5wrXd.cjs');
16
- var logger = require('./logger-XjIS0lU7.cjs');
17
- var BasePermissionHandler = require('./BasePermissionHandler-CJQPjMEa.cjs');
18
- var BaseReasoningProcessor = require('./BaseReasoningProcessor-BY9a3RTU.cjs');
13
+ var api = require('./api-KZmVqSKO.cjs');
14
+ var codexAppServerClient = require('./codexAppServerClient-D-9z-lWP.cjs');
15
+ var specialCommands = require('./specialCommands-DGUeZqdm.cjs');
16
+ var logger = require('./logger-C7dRaCkE.cjs');
17
+ var BasePermissionHandler = require('./BasePermissionHandler-BbLYwd13.cjs');
18
+ var BaseReasoningProcessor = require('./BaseReasoningProcessor-_S1PbSvH.cjs');
19
19
  var node_child_process = require('node:child_process');
20
- var persistence = require('./persistence-BO7AS2NK.cjs');
21
- var machineMetadata = require('./machineMetadata-DTxYqMdE.cjs');
22
- var configuration = require('./configuration-Btwt68O2.cjs');
23
- var registerKillSessionHandler = require('./registerKillSessionHandler-B_FqygY4.cjs');
20
+ var persistence = require('./persistence-DweHi8xa.cjs');
21
+ var machineMetadata = require('./machineMetadata-DYYuK_0c.cjs');
22
+ var configuration = require('./configuration-UV4EE5ui.cjs');
23
+ var registerKillSessionHandler = require('./registerKillSessionHandler-CcX84g-T.cjs');
24
24
  var projectPath = require('./projectPath-ChLhdOyt.cjs');
25
25
  var path = require('node:path');
26
- var createSessionMetadata = require('./createSessionMetadata-Cgfcg0WZ.cjs');
27
- var deterministicJson = require('./deterministicJson-B3V5Ss2l.cjs');
26
+ var createSessionMetadata = require('./createSessionMetadata-2IuH5nlA.cjs');
27
+ var deterministicJson = require('./deterministicJson-je21npNx.cjs');
28
28
  var messageBuffer = require('./messageBuffer-fJMH6uY8.cjs');
29
- var controlClient = require('./controlClient-CEpaptre.cjs');
30
- var defaultPermissionMode = require('./defaultPermissionMode-DqdkzYUY.cjs');
29
+ var controlClient = require('./controlClient-CtsQMw--.cjs');
30
+ var defaultPermissionMode = require('./defaultPermissionMode-Bn4HcU8S.cjs');
31
31
  var authRelay = require('./authRelay-BdYkC1Po.cjs');
32
- var setupOfflineReconnection = require('./setupOfflineReconnection-BJCXuFad.cjs');
32
+ var setupOfflineReconnection = require('./setupOfflineReconnection-CS_8Da8R.cjs');
33
33
  var trimIdent = require('./trimIdent-4gvk9Wk6.cjs');
34
34
  var constants = require('./constants-VJ0N6WuG.cjs');
35
35
  var editPaths = require('./editPaths-Bqp4OFPw.cjs');
36
- var ensureDaemonRunning = require('./ensureDaemonRunning-Dk1yo6aK.cjs');
36
+ var ensureDaemonRunning = require('./ensureDaemonRunning-bIp6-vgi.cjs');
37
37
  require('tweetnacl');
38
38
  require('axios');
39
- require('./time-ChuhR6SU.cjs');
40
- require('./browser-i45hmvWw.cjs');
39
+ require('./time-0szhiPo4.cjs');
40
+ require('./browser-DmgVoopB.cjs');
41
41
  require('open');
42
42
  require('zod');
43
43
  require('node:fs/promises');
44
44
  require('./attachmentLimits-D6bT2jU1.cjs');
45
45
  require('node:fs');
46
- require('./lidState-7uLoa43a.cjs');
46
+ require('./lidState-BmJp2pLt.cjs');
47
47
  require('os');
48
48
  require('child_process');
49
49
  require('node:events');
50
50
  require('socket.io-client');
51
51
  require('./limits-C-a7gr04.cjs');
52
- require('./registerCommonHandlers-DTeuk3Hw.cjs');
52
+ require('./registerCommonHandlers-B7QZxkCL.cjs');
53
53
  require('util');
54
54
  require('fs/promises');
55
55
  require('crypto');
56
56
  require('path');
57
57
  require('cross-spawn');
58
- require('./sync-CGVTRg-R.cjs');
58
+ require('./sync-BK-IBkuB.cjs');
59
59
  require('./backgroundTaskActivity-CBvUdj39.cjs');
60
60
  require('./contentLogMetadata-ZSFk_NjQ.cjs');
61
61
  require('chalk');
@@ -63,36 +63,36 @@ require('node:readline');
63
63
  require('./manager-HrEj442o.cjs');
64
64
  require('@anthropic-ai/sandbox-runtime');
65
65
  require('node:os');
66
- require('./package-DFQUF2in.cjs');
67
- require('./rateLimitWindows-U7NsRvIa.cjs');
66
+ require('./package-VqWv7EI5.cjs');
67
+ require('./rateLimitWindows-Bp4T21RI.cjs');
68
68
  require('node:util');
69
69
  require('./detectCLI-DR9ZaN6B.cjs');
70
70
  require('fs');
71
- require('./localHappyAgentAuth-CfILduPd.cjs');
71
+ require('./localHappyAgentAuth-9SP7hdiw.cjs');
72
72
  require('./types-CRS-srZK.cjs');
73
73
  require('url');
74
- require('./client-QtWC3yii.cjs');
75
- require('./context-BknomZTq.cjs');
76
- require('./sessionOps-C7wI8Ll6.cjs');
74
+ require('./client-BHZVyQwi.cjs');
75
+ require('./context-BmH2BKip.cjs');
76
+ require('./sessionOps-9MChM9Op.cjs');
77
77
  require('./resources-JDPugcDq.cjs');
78
- require('./tools-9hPR5-u8.cjs');
79
- require('./reportProgressTool-oJMMqzKb.cjs');
80
- require('./client-B6H6ZROd.cjs');
78
+ require('./tools-C77-Ssan.cjs');
79
+ require('./reportProgressTool-DzMi4mvH.cjs');
80
+ require('./client-BhLhjj_x.cjs');
81
81
  require('./precheckCompat-CWOi5c9L.cjs');
82
82
  require('./agentGuidance-BtBx2xxE.cjs');
83
- require('./peerTools-DbI6tEk1.cjs');
83
+ require('./peerTools-BktGmlpd.cjs');
84
84
  require('./ids-B6ZC0HGt.cjs');
85
- require('./remoteSessionClient-D79ci1L8.cjs');
85
+ require('./remoteSessionClient-CL3akj0K.cjs');
86
86
  require('@modelcontextprotocol/sdk/server/mcp.js');
87
87
  require('node:http');
88
88
  require('@modelcontextprotocol/sdk/server/streamableHttp.js');
89
- require('./downloadTarget-DJKG6wVj.cjs');
89
+ require('./downloadTarget-JC7FZl7W.cjs');
90
90
  require('./terminals-B_bfC9c2.cjs');
91
91
  require('./terminalTitleSuggest-DhvRFX3H.cjs');
92
92
  require('./tmuxSocket-D-Xt6Vn-.cjs');
93
- require('./bootstrap-BYrt5zUv.cjs');
93
+ require('./bootstrap-DTJ6-vYT.cjs');
94
94
  require('./previewPath-B0rBdhy1.cjs');
95
- require('./spawnHappyCLI-CrKdy_rv.cjs');
95
+ require('./spawnHappyCLI-DByQcqEN.cjs');
96
96
  require('./doctorReadiness-BCZGcN0a.cjs');
97
97
 
98
98
  function getStartedSubagents(state) {
@@ -1081,6 +1081,10 @@ function describeCodexRetry(msg) {
1081
1081
  const cause = status ? `HTTP ${status} from the model API` : "a model API error";
1082
1082
  return message ? `Codex is retrying after ${cause} (${message})` : `Codex is retrying after ${cause}`;
1083
1083
  }
1084
+ function codexStderrTailOf(error) {
1085
+ const tail = error?.codexStderrTail;
1086
+ return typeof tail === "string" && tail.trim() ? tail.trim() : null;
1087
+ }
1084
1088
  const TRANSPORT_LOSS = /^Codex process (exited|disconnected)\b|stdin not writable| timed out after \d+ms/;
1085
1089
  function describeThrownTurnError(error) {
1086
1090
  const message = error instanceof Error ? error.message : typeof error === "string" ? error : "";
@@ -2086,8 +2090,9 @@ async function runCodex(opts) {
2086
2090
  messageBuffer$1.addMessage(`Task failed: ${reason}`, "status");
2087
2091
  session.sendSessionEvent({ type: "message", message: `Codex error: ${reason}` });
2088
2092
  } else {
2093
+ const tail = codexStderrTailOf(error);
2089
2094
  messageBuffer$1.addMessage("Process exited unexpectedly", "status");
2090
- session.sendSessionEvent({ type: "message", message: "Process exited unexpectedly" });
2095
+ session.sendSessionEvent({ type: "message", message: tail ? `Process exited unexpectedly: ${tail}` : "Process exited unexpectedly" });
2091
2096
  }
2092
2097
  } finally {
2093
2098
  permissionHandler.reset();
@@ -1,59 +1,59 @@
1
- import { a as authAndSetupMachineIfNeeded } from './auth-CiZfkTkd.mjs';
1
+ import { a as authAndSetupMachineIfNeeded } from './auth-D1qHU-i_.mjs';
2
2
  import { c as createEnvelope, o as BUILTIN_TODO_DISCOVERY, P as PROMPT_QUEUE_CAPABILITY } from './index-boE-d8CM.mjs';
3
3
  import { p as publishForkBackfillWhenCommitted, F as FORK_BACKFILL_CAPABILITY } from './forkBackfill-DYIjlN1Z.mjs';
4
4
  import { randomUUID } from 'node:crypto';
5
5
  import { createId } from '@paralleldrive/cuid2';
6
6
  import { r as registerAgentAttachmentDownloads } from './agentAttachments-M_B5qEF2.mjs';
7
- import { C as CLAUDE_ATTACHMENT_KINDS, a as stageClaudeAttachments, b as appendStagedAttachmentsToPrompt } from './attachmentContent-CSGb8uDJ.mjs';
7
+ import { C as CLAUDE_ATTACHMENT_KINDS, a as stageClaudeAttachments, b as appendStagedAttachmentsToPrompt } from './attachmentContent-PrNJg8gG.mjs';
8
8
  import { useStdout, useInput, Box, Text, render } from 'ink';
9
- import { c as claimSessionOrExit, a as applyServerSnapshot, b as applyHibernationReplay, w as withoutServerSnapshot, m as mergeReconnectMetadata } from './sessionLock-D_-T15Y-.mjs';
9
+ import { c as claimSessionOrExit, a as applyServerSnapshot, b as applyHibernationReplay, w as withoutServerSnapshot, m as mergeReconnectMetadata } from './sessionLock-gb32sVPR.mjs';
10
10
  import React, { useState, useRef, useEffect, useCallback } from 'react';
11
- import { c as connectionState, A as ApiClient } from './api-rOLB1-sV.mjs';
12
- import { C as CodexAppServerClient } from './codexAppServerClient-pnCpJlD8.mjs';
13
- import { p as parseSpecialCommand, w as wrapperRateLimitReporter } from './specialCommands-BbNlcS3G.mjs';
14
- import { l as logger } from './logger-CUxbqfrp.mjs';
15
- import { B as BasePermissionHandler } from './BasePermissionHandler-BiWdGyL1.mjs';
16
- import { B as BaseReasoningProcessor } from './BaseReasoningProcessor-2sLuoRYw.mjs';
11
+ import { c as connectionState, A as ApiClient } from './api-D08IEaWa.mjs';
12
+ import { C as CodexAppServerClient } from './codexAppServerClient-CppPl_R6.mjs';
13
+ import { p as parseSpecialCommand, w as wrapperRateLimitReporter } from './specialCommands-DUUBqzvd.mjs';
14
+ import { l as logger } from './logger-D5EzMy30.mjs';
15
+ import { B as BasePermissionHandler } from './BasePermissionHandler-DriZLITp.mjs';
16
+ import { B as BaseReasoningProcessor } from './BaseReasoningProcessor-DnykPlPo.mjs';
17
17
  import { execSync } from 'node:child_process';
18
- import { r as readSettings, l as latchKeepAwake, e as evaluateWrapperIdle, a as resolveCheckMs, H as HIBERNATION_CAPABILITY } from './persistence-CBToZ0R6.mjs';
19
- import { g as getInitialMachineMetadata } from './machineMetadata-QfdvKIrL.mjs';
20
- import { c as configuration } from './configuration-zOfO2qdB.mjs';
21
- import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-B7zpuzvS.mjs';
18
+ import { r as readSettings, l as latchKeepAwake, e as evaluateWrapperIdle, a as resolveCheckMs, H as HIBERNATION_CAPABILITY } from './persistence-CIIhP0Uw.mjs';
19
+ import { g as getInitialMachineMetadata } from './machineMetadata-DqplCWue.mjs';
20
+ import { c as configuration } from './configuration-BNGPXg07.mjs';
21
+ import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-DLiu24CQ.mjs';
22
22
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
23
23
  import { join } from 'node:path';
24
- import { c as createSessionMetadata } from './createSessionMetadata-CM7ErnPh.mjs';
25
- import { h as hashObject, s as startHappyServer } from './deterministicJson-DVvfcibH.mjs';
24
+ import { c as createSessionMetadata } from './createSessionMetadata-CtNMvfth.mjs';
25
+ import { h as hashObject, s as startHappyServer } from './deterministicJson-DF4xv6MH.mjs';
26
26
  import { M as MessageBuffer } from './messageBuffer-BWlGgR3A.mjs';
27
- import { n as notifyDaemonSessionStarted, j as reportSessionEditToDaemon, c as checkDaemonHibernation } from './controlClient-CbmWgWJW.mjs';
28
- import { a as HibernationExitLatch, H as HibernationProbe, c as commitHibernation, b as DEFAULT_CODEX_PERMISSION_MODE } from './defaultPermissionMode-CmgCDVpL.mjs';
27
+ import { n as notifyDaemonSessionStarted, j as reportSessionEditToDaemon, c as checkDaemonHibernation } from './controlClient-DqtC0pq1.mjs';
28
+ import { a as HibernationExitLatch, H as HibernationProbe, c as commitHibernation, b as DEFAULT_CODEX_PERMISSION_MODE } from './defaultPermissionMode-DYihjV2g.mjs';
29
29
  import { d as decodeBase64, e as encodeBase64 } from './authRelay-DSAvg1uv.mjs';
30
- import { s as setupOfflineReconnection } from './setupOfflineReconnection-D51KXWAP.mjs';
30
+ import { s as setupOfflineReconnection } from './setupOfflineReconnection-CgtXlV74.mjs';
31
31
  import { t as trimIdent } from './trimIdent-BAjmv_TG.mjs';
32
32
  import { C as CHANGE_TITLE_INSTRUCTION } from './constants-BC4St0xd.mjs';
33
33
  import { E as EditReportThrottle, a as extractCodexPatchPaths } from './editPaths-BVfS_FFL.mjs';
34
- import { a as extractNoSandboxFlag, e as ensureDaemonRunning } from './ensureDaemonRunning-CWo9yDAC.mjs';
34
+ import { a as extractNoSandboxFlag, e as ensureDaemonRunning } from './ensureDaemonRunning-JPA9tHNE.mjs';
35
35
  import 'tweetnacl';
36
36
  import 'axios';
37
- import './time-7iVn8KLQ.mjs';
38
- import './browser-IVfX6PQT.mjs';
37
+ import './time-CvrpeD3S.mjs';
38
+ import './browser-xuW4fiHo.mjs';
39
39
  import 'open';
40
40
  import 'zod';
41
41
  import 'node:fs/promises';
42
42
  import './attachmentLimits-BLbji11b.mjs';
43
43
  import 'node:fs';
44
- import './lidState-Bv862v_R.mjs';
44
+ import './lidState-CL1NdKfQ.mjs';
45
45
  import 'os';
46
46
  import 'child_process';
47
47
  import 'node:events';
48
48
  import 'socket.io-client';
49
49
  import './limits-DIo7rEBR.mjs';
50
- import './registerCommonHandlers-C_KbP5Mq.mjs';
50
+ import './registerCommonHandlers-CR5jpiSx.mjs';
51
51
  import 'util';
52
52
  import 'fs/promises';
53
53
  import 'crypto';
54
54
  import 'path';
55
55
  import 'cross-spawn';
56
- import './sync-MTpgBfV2.mjs';
56
+ import './sync-D5YqUVjS.mjs';
57
57
  import './backgroundTaskActivity-8PdPxrvy.mjs';
58
58
  import './contentLogMetadata-BlWI0egu.mjs';
59
59
  import 'chalk';
@@ -61,36 +61,36 @@ import 'node:readline';
61
61
  import './manager-BEsI4qt3.mjs';
62
62
  import '@anthropic-ai/sandbox-runtime';
63
63
  import 'node:os';
64
- import './package-DkI3yDe0.mjs';
65
- import './rateLimitWindows-i2-530Zt.mjs';
64
+ import './package-D0dxZ-W8.mjs';
65
+ import './rateLimitWindows-Bo6XVnie.mjs';
66
66
  import 'node:util';
67
67
  import './detectCLI-CSGMlV51.mjs';
68
68
  import 'fs';
69
- import './localHappyAgentAuth-CLP3CBMK.mjs';
69
+ import './localHappyAgentAuth-B7f4Ysn0.mjs';
70
70
  import './types-CkqAACXx.mjs';
71
71
  import 'url';
72
- import './client-DbqP92Fy.mjs';
73
- import './context-BTX3YYdt.mjs';
74
- import './sessionOps-DfAtoDD5.mjs';
72
+ import './client-eQjOvC55.mjs';
73
+ import './context-Ptdnlcv6.mjs';
74
+ import './sessionOps-ByZJbkMq.mjs';
75
75
  import './resources-BdFBQi8r.mjs';
76
- import './tools-BSlqfWAq.mjs';
77
- import './reportProgressTool-DujvMncK.mjs';
78
- import './client-Bi1DOVy9.mjs';
76
+ import './tools-Cp0qJeBq.mjs';
77
+ import './reportProgressTool-BLLwMQrN.mjs';
78
+ import './client-C4ddTzrD.mjs';
79
79
  import './precheckCompat-DeEbilbr.mjs';
80
80
  import './agentGuidance-BDYt2Qy2.mjs';
81
- import './peerTools-zfe59JAw.mjs';
81
+ import './peerTools-B_eiNB3P.mjs';
82
82
  import './ids-DU6sLx4C.mjs';
83
- import './remoteSessionClient-Bk1Qzb5I.mjs';
83
+ import './remoteSessionClient-CUjw1COc.mjs';
84
84
  import '@modelcontextprotocol/sdk/server/mcp.js';
85
85
  import 'node:http';
86
86
  import '@modelcontextprotocol/sdk/server/streamableHttp.js';
87
- import './downloadTarget-C-18yOBz.mjs';
87
+ import './downloadTarget-CUJg8iJV.mjs';
88
88
  import './terminals-Dlg0x3nY.mjs';
89
89
  import './terminalTitleSuggest-CeKsX_V6.mjs';
90
90
  import './tmuxSocket-B8Yx20sT.mjs';
91
- import './bootstrap-D1RRCJdQ.mjs';
91
+ import './bootstrap-CWjpC5-J.mjs';
92
92
  import './previewPath-CXN4Vag0.mjs';
93
- import './spawnHappyCLI-CYS23qZY.mjs';
93
+ import './spawnHappyCLI-DsC256j_.mjs';
94
94
  import './doctorReadiness-C208SMN9.mjs';
95
95
 
96
96
  function getStartedSubagents(state) {
@@ -1079,6 +1079,10 @@ function describeCodexRetry(msg) {
1079
1079
  const cause = status ? `HTTP ${status} from the model API` : "a model API error";
1080
1080
  return message ? `Codex is retrying after ${cause} (${message})` : `Codex is retrying after ${cause}`;
1081
1081
  }
1082
+ function codexStderrTailOf(error) {
1083
+ const tail = error?.codexStderrTail;
1084
+ return typeof tail === "string" && tail.trim() ? tail.trim() : null;
1085
+ }
1082
1086
  const TRANSPORT_LOSS = /^Codex process (exited|disconnected)\b|stdin not writable| timed out after \d+ms/;
1083
1087
  function describeThrownTurnError(error) {
1084
1088
  const message = error instanceof Error ? error.message : typeof error === "string" ? error : "";
@@ -2084,8 +2088,9 @@ async function runCodex(opts) {
2084
2088
  messageBuffer.addMessage(`Task failed: ${reason}`, "status");
2085
2089
  session.sendSessionEvent({ type: "message", message: `Codex error: ${reason}` });
2086
2090
  } else {
2091
+ const tail = codexStderrTailOf(error);
2087
2092
  messageBuffer.addMessage("Process exited unexpectedly", "status");
2088
- session.sendSessionEvent({ type: "message", message: "Process exited unexpectedly" });
2093
+ session.sendSessionEvent({ type: "message", message: tail ? `Process exited unexpectedly: ${tail}` : "Process exited unexpectedly" });
2089
2094
  }
2090
2095
  } finally {
2091
2096
  permissionHandler.reset();
@@ -2,15 +2,15 @@ import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
2
2
  import { join } from 'path';
3
3
  import { homedir } from 'os';
4
4
  import { execSync } from 'child_process';
5
- import { l as logger } from './logger-CUxbqfrp.mjs';
5
+ import { l as logger } from './logger-D5EzMy30.mjs';
6
6
  import { D as DEFAULT_GEMINI_MODEL, G as GEMINI_MODEL_ENV } from './constants-BC4St0xd.mjs';
7
7
  import 'chalk';
8
8
  import 'node:util';
9
- import './configuration-zOfO2qdB.mjs';
9
+ import './configuration-BNGPXg07.mjs';
10
10
  import 'node:fs';
11
11
  import 'node:os';
12
12
  import 'node:path';
13
- import './package-DkI3yDe0.mjs';
13
+ import './package-D0dxZ-W8.mjs';
14
14
  import 'node:fs/promises';
15
15
  import './trimIdent-BAjmv_TG.mjs';
16
16