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
@@ -2,81 +2,82 @@ import { useStdout, useInput, Box, Text, render } from 'ink';
2
2
  import React, { useState, useRef, useEffect, useCallback } from 'react';
3
3
  import { randomUUID } from 'node:crypto';
4
4
  import { join } from 'node:path';
5
- import { c as connectionState, A as ApiClient } from './api-D08IEaWa.mjs';
6
- import { l as logger } from './logger-D5EzMy30.mjs';
7
- import { r as readSettings } from './persistence-CIIhP0Uw.mjs';
8
- import { c as createSessionMetadata } from './createSessionMetadata-CtNMvfth.mjs';
5
+ import { c as connectionState, A as ApiClient } from './api-CKBViqI3.mjs';
6
+ import { l as logger } from './logger-13cBr_ew.mjs';
7
+ import { r as readSettings } from './persistence-C_tYtOqK.mjs';
8
+ import { c as createSessionMetadata } from './createSessionMetadata-Bi-m0Y_O.mjs';
9
9
  import { e as errorLogMetadata, c as contentLogMetadata } from './contentLogMetadata-BlWI0egu.mjs';
10
- import { g as getInitialMachineMetadata } from './machineMetadata-DqplCWue.mjs';
11
- import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-DLiu24CQ.mjs';
12
- import { h as hashObject, s as startHappyServer } from './deterministicJson-DF4xv6MH.mjs';
10
+ import { g as getInitialMachineMetadata } from './machineMetadata-dMida2qq.mjs';
11
+ import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-Drhf7-Vz.mjs';
12
+ import { h as hashObject, s as startHappyServer } from './deterministicJson-BkQETt8_.mjs';
13
13
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
14
14
  import { M as MessageBuffer } from './messageBuffer-BWlGgR3A.mjs';
15
- import { n as notifyDaemonSessionStarted } from './controlClient-DqtC0pq1.mjs';
15
+ import { n as notifyDaemonSessionStarted } from './controlClient-C4xB5J6O.mjs';
16
16
  import { e as encodeBase64 } from './authRelay-DSAvg1uv.mjs';
17
- import { s as setupOfflineReconnection } from './setupOfflineReconnection-CgtXlV74.mjs';
18
- import { A as AcpBackend } from './AcpBackend-BZrLVcHb.mjs';
17
+ import { s as setupOfflineReconnection } from './setupOfflineReconnection-C5trsV-j.mjs';
18
+ import { A as AcpBackend, i as isAgentExitError } from './AcpBackend-B0K0WrtW.mjs';
19
19
  import { a as GEMINI_API_KEY_ENV, b as GOOGLE_API_KEY_ENV, G as GEMINI_MODEL_ENV, C as CHANGE_TITLE_INSTRUCTION } from './constants-BC4St0xd.mjs';
20
- import { readGeminiLocalConfig, determineGeminiModel, getGeminiModelSource, getInitialGeminiModel, saveGeminiModelToConfig } from './config-Cr3VUzbE.mjs';
21
- import { B as BasePermissionHandler } from './BasePermissionHandler-DriZLITp.mjs';
22
- import { B as BaseReasoningProcessor } from './BaseReasoningProcessor-DnykPlPo.mjs';
20
+ import { readGeminiLocalConfig, determineGeminiModel, getGeminiModelSource, getInitialGeminiModel, saveGeminiModelToConfig } from './config-CvsNChKX.mjs';
21
+ import { B as BasePermissionHandler } from './BasePermissionHandler-hdY7kTqX.mjs';
22
+ import { B as BaseReasoningProcessor, s as settleCodexSession } from './codexTermination-CCIfwzcx.mjs';
23
23
  import 'axios';
24
- import './lidState-CL1NdKfQ.mjs';
24
+ import './lidState-BqVsw7H1.mjs';
25
25
  import 'os';
26
26
  import 'child_process';
27
27
  import 'node:events';
28
28
  import 'socket.io-client';
29
- import './attachmentLimits-BLbji11b.mjs';
29
+ import './attachmentLimits-Di1Z93lN.mjs';
30
30
  import 'zod';
31
- import './index-boE-d8CM.mjs';
31
+ import './index-DMy3OCBe.mjs';
32
32
  import '@paralleldrive/cuid2';
33
33
  import './limits-DIo7rEBR.mjs';
34
- import './time-CvrpeD3S.mjs';
35
- import './configuration-BNGPXg07.mjs';
34
+ import './time-yEL6wHUF.mjs';
35
+ import './configuration-D55F0t16.mjs';
36
36
  import 'node:fs';
37
37
  import 'node:os';
38
- import './package-D0dxZ-W8.mjs';
38
+ import './package-CjlsAaRe.mjs';
39
39
  import 'node:fs/promises';
40
- import './registerCommonHandlers-CR5jpiSx.mjs';
40
+ import './registerCommonHandlers-D8OMpBbQ.mjs';
41
41
  import 'util';
42
42
  import 'fs/promises';
43
43
  import 'crypto';
44
44
  import 'path';
45
45
  import 'cross-spawn';
46
- import './sync-D5YqUVjS.mjs';
47
- import './backgroundTaskActivity-8PdPxrvy.mjs';
46
+ import './sync-C3p7-KLn.mjs';
47
+ import './backgroundTaskActivity-BVwJBl02.mjs';
48
48
  import 'chalk';
49
49
  import 'node:util';
50
50
  import './detectCLI-CSGMlV51.mjs';
51
51
  import 'fs';
52
- import './localHappyAgentAuth-B7f4Ysn0.mjs';
52
+ import './localHappyAgentAuth-Ce8kO2yc.mjs';
53
53
  import 'tweetnacl';
54
54
  import './types-CkqAACXx.mjs';
55
- import './client-eQjOvC55.mjs';
56
- import './context-Ptdnlcv6.mjs';
57
- import './sessionOps-ByZJbkMq.mjs';
55
+ import './client-BPMWutfs.mjs';
56
+ import './context-CCRpVXFo.mjs';
57
+ import './sessionOps-CdgbEJgf.mjs';
58
58
  import './resources-BdFBQi8r.mjs';
59
- import './tools-Cp0qJeBq.mjs';
60
- import './reportProgressTool-BLLwMQrN.mjs';
61
- import './client-C4ddTzrD.mjs';
59
+ import './tools-BrM3bZW5.mjs';
60
+ import './reportProgressTool-B203EZCR.mjs';
61
+ import './client-DG5ndWLw.mjs';
62
62
  import './precheckCompat-DeEbilbr.mjs';
63
63
  import './agentGuidance-BDYt2Qy2.mjs';
64
64
  import './trimIdent-BAjmv_TG.mjs';
65
- import './peerTools-B_eiNB3P.mjs';
65
+ import './peerTools-CxmrKnfV.mjs';
66
66
  import './ids-DU6sLx4C.mjs';
67
- import './remoteSessionClient-CUjw1COc.mjs';
67
+ import './remoteSessionClient-D01Hso2-.mjs';
68
68
  import '@modelcontextprotocol/sdk/server/mcp.js';
69
69
  import 'node:http';
70
70
  import '@modelcontextprotocol/sdk/server/streamableHttp.js';
71
- import './downloadTarget-CUJg8iJV.mjs';
71
+ import './downloadTarget-ByXzbDK4.mjs';
72
72
  import './terminals-Dlg0x3nY.mjs';
73
73
  import 'node:child_process';
74
74
  import './terminalTitleSuggest-CeKsX_V6.mjs';
75
75
  import './tmuxSocket-B8Yx20sT.mjs';
76
- import './bootstrap-CWjpC5-J.mjs';
76
+ import './bootstrap-C0s2bPFQ.mjs';
77
77
  import './previewPath-CXN4Vag0.mjs';
78
78
  import 'url';
79
79
  import '@agentclientprotocol/sdk';
80
+ import './processTree-CP5IvQ2Z.mjs';
80
81
 
81
82
  const GEMINI_TIMEOUTS = {
82
83
  /** Gemini CLI can be slow on first start (downloading models, etc.) */
@@ -891,6 +892,74 @@ ${formattedMessages}
891
892
  }
892
893
  }
893
894
 
895
+ function factsOf(error) {
896
+ if (error instanceof Error) {
897
+ const record = error;
898
+ const details = typeof record.data?.details === "string" ? record.data.details : typeof record.details === "string" ? record.details : "";
899
+ return { code: record.code, details, message: error.message, whole: `${details} ${error.message}`, empty: false };
900
+ }
901
+ if (error && typeof error === "object") {
902
+ const record = error;
903
+ const details = typeof record.data?.details === "string" ? record.data.details : typeof record.details === "string" ? record.details : "";
904
+ const message = typeof record.message === "string" ? record.message : typeof record.error?.message === "string" ? record.error.message : "";
905
+ let whole = `${details} ${message}`;
906
+ try {
907
+ whole += ` ${JSON.stringify(error)}`;
908
+ } catch {
909
+ }
910
+ return { code: record.code ?? record.status ?? record.response?.status, details, message, whole, empty: Object.keys(error).length === 0 };
911
+ }
912
+ return { code: void 0, details: "", message: String(error), whole: String(error), empty: false };
913
+ }
914
+ function quotaResetSuffix(text) {
915
+ const match = text.match(/reset after (\d+h)?(\d+m)?(\d+s)?/i);
916
+ if (!match) return "";
917
+ const parts = match.slice(1).filter(Boolean).join("");
918
+ return parts ? ` Quota resets in ${parts}.` : "";
919
+ }
920
+ const EMPTY_RESPONSE = /empty response|Model stream ended/i;
921
+ const TRANSIENT = /overloaded|UNAVAILABLE|\b503\b|ECONNRESET|socket hang up|ETIMEDOUT/i;
922
+ function isRetryableGeminiError(error) {
923
+ if (isAgentExitError(error)) return false;
924
+ const facts = factsOf(error);
925
+ if (/exhausted|quota|capacity/i.test(facts.whole)) return false;
926
+ return EMPTY_RESPONSE.test(facts.whole) || TRANSIENT.test(facts.whole);
927
+ }
928
+ function describeGeminiFailure(error, ctx) {
929
+ if (isAgentExitError(error)) {
930
+ return { kind: "exited", message: `Process exited unexpectedly: ${error.message}` };
931
+ }
932
+ const f = factsOf(error);
933
+ if (f.code === 404 || /notFound|\b404\b/.test(f.details) || /not found|\b404\b/.test(f.message)) {
934
+ return { kind: "not-found", message: `Gemini error: model "${ctx.model}" not found. Available models: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite` };
935
+ }
936
+ if (EMPTY_RESPONSE.test(f.whole)) {
937
+ return { kind: "empty", message: "Gemini error: the API returned an empty response after retries. This is usually temporary \u2014 please try again." };
938
+ }
939
+ if (f.code === 429 || /\b429\b|rateLimitExceeded|RESOURCE_EXHAUSTED|Rate limit exceeded|Resource exhausted/i.test(f.whole)) {
940
+ return { kind: "rate-limit", message: "Gemini error: API rate limit exceeded. Please wait a moment and try again." };
941
+ }
942
+ if (/quota|exhausted|capacity/i.test(f.whole)) {
943
+ return { kind: "quota", message: `Gemini error: quota exceeded.${quotaResetSuffix(f.whole)} Try another model (gemini-2.5-flash-lite) or wait for the quota to reset.` };
944
+ }
945
+ if (f.code === -32e3 || /Authentication required/i.test(f.whole)) {
946
+ return {
947
+ kind: "auth",
948
+ message: "Gemini error: authentication required. For Google Workspace accounts set a Google Cloud project: `very-happy gemini project set <your-project-id>`; or use another Google account: `very-happy connect gemini`. Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca"
949
+ };
950
+ }
951
+ if (f.empty) {
952
+ return { kind: "not-installed", message: 'Gemini error: failed to start Gemini. Is the "gemini" CLI installed? Run: npm install -g @google/gemini-cli' };
953
+ }
954
+ const text = (f.details || f.message || "process error occurred").replace(/\s+/g, " ").trim();
955
+ return { kind: "other", message: `Gemini error: ${text.length > 400 ? `${text.slice(0, 399)}\u2026` : text}` };
956
+ }
957
+ function describeGeminiRetry(attempt, maxAttempts, error) {
958
+ const f = factsOf(error);
959
+ const why = EMPTY_RESPONSE.test(f.whole) ? "an empty response" : "a transient API error";
960
+ return `Gemini is retrying after ${why} (attempt ${attempt}/${maxAttempts})`;
961
+ }
962
+
894
963
  async function runGemini(opts) {
895
964
  const sessionTag = randomUUID();
896
965
  connectionState.setBackend("Gemini");
@@ -1095,8 +1164,12 @@ async function runGemini(opts) {
1095
1164
  let geminiBackend = null;
1096
1165
  let acpSessionId = null;
1097
1166
  let wasSessionCreated = false;
1167
+ let turnEnding = "completed";
1168
+ const turnAborted = () => turnEnding === "aborted";
1169
+ let backendGone = null;
1098
1170
  async function handleAbort() {
1099
1171
  logger.debug("[Gemini] Abort requested - stopping current task");
1172
+ turnEnding = "aborted";
1100
1173
  session.sendAgentMessage("gemini", {
1101
1174
  type: "turn_aborted",
1102
1175
  id: randomUUID()
@@ -1104,6 +1177,7 @@ async function runGemini(opts) {
1104
1177
  reasoningProcessor.abort();
1105
1178
  diffProcessor.reset();
1106
1179
  try {
1180
+ permissionHandler.abortAll();
1107
1181
  abortController.abort();
1108
1182
  messageQueue.reset();
1109
1183
  if (geminiBackend && acpSessionId) {
@@ -1116,22 +1190,13 @@ async function runGemini(opts) {
1116
1190
  abortController = new AbortController();
1117
1191
  }
1118
1192
  }
1119
- const handleKillSession = async () => {
1120
- logger.debug("[Gemini] Kill session requested - terminating process");
1193
+ const handleKillSession = async (intent = "archive") => {
1194
+ logger.debug(`[Gemini] Kill session requested (${intent}) - terminating process`);
1121
1195
  await handleAbort();
1122
1196
  logger.debug("[Gemini] Abort completed, proceeding with termination");
1123
1197
  try {
1124
1198
  if (session) {
1125
- session.updateMetadata((currentMetadata) => ({
1126
- ...currentMetadata,
1127
- lifecycleState: "archived",
1128
- lifecycleStateSince: Date.now(),
1129
- archivedBy: "cli",
1130
- archiveReason: "User terminated"
1131
- }));
1132
- session.sendSessionDeath();
1133
- await session.flush();
1134
- await session.close();
1199
+ await settleCodexSession(session, intent, (id) => api.deactivateSession(id), (m, e) => logger.debug(m, e));
1135
1200
  }
1136
1201
  happyServer.stop();
1137
1202
  if (geminiBackend) {
@@ -1145,7 +1210,7 @@ async function runGemini(opts) {
1145
1210
  }
1146
1211
  };
1147
1212
  session.rpcHandlerManager.registerHandler("abort", handleAbort);
1148
- registerKillSessionHandler(session.rpcHandlerManager, handleKillSession, session);
1213
+ registerKillSessionHandler(session.rpcHandlerManager, () => handleKillSession("archive"), session, { processSignals: true, onSignal: () => handleKillSession("offline") });
1149
1214
  const messageBuffer = new MessageBuffer();
1150
1215
  const hasTTY = process.stdout.isTTY && process.stdin.isTTY;
1151
1216
  let inkInstance = null;
@@ -1248,10 +1313,9 @@ async function runGemini(opts) {
1248
1313
  });
1249
1314
  if (msg.status === "error") {
1250
1315
  logger.debug("[gemini] Error status received:", contentLogMetadata(statusDetail));
1251
- session.sendAgentMessage("gemini", {
1252
- type: "turn_aborted",
1253
- id: randomUUID()
1254
- });
1316
+ }
1317
+ if (msg.status === "stopped") {
1318
+ backendGone = new Error(statusDetail || "gemini process exited");
1255
1319
  }
1256
1320
  if (msg.status === "running") {
1257
1321
  thinking = true;
@@ -1266,31 +1330,6 @@ async function runGemini(opts) {
1266
1330
  messageBuffer.addMessage("Thinking...", "system");
1267
1331
  } else if (msg.status === "idle" || msg.status === "stopped") {
1268
1332
  reasoningProcessor.complete();
1269
- } else if (msg.status === "error") {
1270
- thinking = false;
1271
- session.keepAlive(thinking, "remote");
1272
- accumulatedResponse = "";
1273
- isResponseInProgress = false;
1274
- let errorMessage = "Unknown error";
1275
- if (msg.detail) {
1276
- if (typeof msg.detail === "object") {
1277
- const detailObj = msg.detail;
1278
- errorMessage = detailObj.message || detailObj.details || JSON.stringify(detailObj);
1279
- } else {
1280
- errorMessage = String(msg.detail);
1281
- }
1282
- }
1283
- if (errorMessage.includes("Authentication required")) {
1284
- errorMessage = `Authentication required.
1285
- For Google Workspace accounts, run: very-happy gemini project set <project-id>
1286
- Or use a different Google account: very-happy connect gemini
1287
- Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1288
- }
1289
- messageBuffer.addMessage(`Error: ${errorMessage}`, "status");
1290
- session.sendAgentMessage("gemini", {
1291
- type: "message",
1292
- message: `Error: ${errorMessage}`
1293
- });
1294
1333
  }
1295
1334
  break;
1296
1335
  case "tool-call":
@@ -1483,55 +1522,68 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1483
1522
  if (!message) {
1484
1523
  break;
1485
1524
  }
1486
- let injectHistoryContext = false;
1487
- if (wasSessionCreated && currentModeHash && message.hash !== currentModeHash) {
1488
- logger.debug("[Gemini] Mode changed \u2013 restarting Gemini session");
1489
- messageBuffer.addMessage("\u2550".repeat(40), "status");
1490
- if (conversationHistory.hasHistory()) {
1491
- messageBuffer.addMessage(`Switching model (preserving ${conversationHistory.size()} messages of context)...`, "status");
1492
- injectHistoryContext = true;
1493
- logger.debug("[Gemini] Will inject conversation history");
1494
- } else {
1495
- messageBuffer.addMessage("Starting new Gemini session (mode changed)...", "status");
1496
- }
1497
- permissionHandler.reset();
1498
- reasoningProcessor.abort();
1499
- if (geminiBackend) {
1500
- await geminiBackend.dispose();
1501
- geminiBackend = null;
1502
- }
1503
- const modelToUse = message.mode?.model === void 0 ? void 0 : message.mode.model || null;
1504
- const backendResult = createGeminiBackend({
1505
- cwd: process.cwd(),
1506
- mcpServers,
1507
- permissionHandler,
1508
- cloudToken,
1509
- currentUserEmail,
1510
- // Pass model from message - if undefined, will use local config/env/default
1511
- // If explicitly null, will skip local config and use env/default
1512
- model: modelToUse
1513
- });
1514
- geminiBackend = backendResult.backend;
1515
- setupGeminiMessageHandler(geminiBackend);
1516
- const actualModel = backendResult.model;
1517
- logger.debug(`[gemini] Model change - modelToUse=${modelToUse}, actualModel=${actualModel} (from ${backendResult.modelSource})`);
1518
- conversationHistory.setCurrentModel(actualModel);
1519
- logger.debug("[gemini] Starting new ACP session with model:", actualModel);
1520
- const { sessionId } = await geminiBackend.startSession();
1521
- acpSessionId = sessionId;
1522
- logger.debug(`[gemini] New ACP session started: ${acpSessionId}`);
1523
- logger.debug(`[gemini] Calling updateDisplayedModel with: ${actualModel}`);
1524
- updateDisplayedModel(actualModel, false);
1525
- updatePermissionMode(message.mode.permissionMode);
1526
- wasSessionCreated = true;
1527
- currentModeHash = message.hash;
1528
- first = false;
1525
+ if (!thinking) {
1526
+ thinking = true;
1527
+ session.keepAlive(thinking, "remote");
1529
1528
  }
1529
+ turnEnding = "completed";
1530
+ let injectHistoryContext = false;
1531
+ let restartAfterExit = false;
1530
1532
  currentModeHash = message.hash;
1531
1533
  const userMessageToShow = message.mode?.originalUserMessage || message.message;
1532
1534
  messageBuffer.addMessage(userMessageToShow, "user");
1533
1535
  isProcessingMessage = true;
1534
1536
  try {
1537
+ restartAfterExit = backendGone !== null;
1538
+ if (restartAfterExit) {
1539
+ logger.debug(`[Gemini] Restarting Gemini after it exited: ${backendGone?.message ?? "unknown"}`);
1540
+ backendGone = null;
1541
+ session.sendSessionEvent({ type: "message", message: `Gemini was restarted after its process exited; the conversation so far is re-sent to it as context.` });
1542
+ }
1543
+ if (restartAfterExit || wasSessionCreated && currentModeHash && message.hash !== currentModeHash) {
1544
+ logger.debug("[Gemini] Mode changed or process gone \u2013 restarting Gemini session");
1545
+ messageBuffer.addMessage("\u2550".repeat(40), "status");
1546
+ if (conversationHistory.hasHistory()) {
1547
+ messageBuffer.addMessage(`${restartAfterExit ? "Restarting Gemini" : "Switching model"} (preserving ${conversationHistory.size()} messages of context)...`, "status");
1548
+ injectHistoryContext = true;
1549
+ logger.debug("[Gemini] Will inject conversation history");
1550
+ } else {
1551
+ messageBuffer.addMessage(restartAfterExit ? "Restarting Gemini..." : "Starting new Gemini session (mode changed)...", "status");
1552
+ }
1553
+ permissionHandler.reset();
1554
+ reasoningProcessor.abort();
1555
+ if (geminiBackend) {
1556
+ await geminiBackend.dispose();
1557
+ geminiBackend = null;
1558
+ }
1559
+ acpSessionId = null;
1560
+ const modelToUse = message.mode?.model === void 0 ? void 0 : message.mode.model || null;
1561
+ const backendResult = createGeminiBackend({
1562
+ cwd: process.cwd(),
1563
+ mcpServers,
1564
+ permissionHandler,
1565
+ cloudToken,
1566
+ currentUserEmail,
1567
+ // Pass model from message - if undefined, will use local config/env/default
1568
+ // If explicitly null, will skip local config and use env/default
1569
+ model: modelToUse
1570
+ });
1571
+ geminiBackend = backendResult.backend;
1572
+ setupGeminiMessageHandler(geminiBackend);
1573
+ const actualModel = backendResult.model;
1574
+ logger.debug(`[gemini] Model change - modelToUse=${modelToUse}, actualModel=${actualModel} (from ${backendResult.modelSource})`);
1575
+ conversationHistory.setCurrentModel(actualModel);
1576
+ logger.debug("[gemini] Starting new ACP session with model:", actualModel);
1577
+ const { sessionId } = await geminiBackend.startSession();
1578
+ acpSessionId = sessionId;
1579
+ logger.debug(`[gemini] New ACP session started: ${acpSessionId}`);
1580
+ logger.debug(`[gemini] Calling updateDisplayedModel with: ${actualModel}`);
1581
+ updateDisplayedModel(actualModel, false);
1582
+ updatePermissionMode(message.mode.permissionMode);
1583
+ wasSessionCreated = true;
1584
+ currentModeHash = message.hash;
1585
+ first = false;
1586
+ }
1535
1587
  if (first || !wasSessionCreated) {
1536
1588
  if (!geminiBackend) {
1537
1589
  const modelToUse = message.mode?.model === void 0 ? void 0 : message.mode.model || null;
@@ -1585,49 +1637,37 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1585
1637
  logger.debug("[gemini] Sending prompt to Gemini:", contentLogMetadata(promptToSend));
1586
1638
  const MAX_RETRIES = 3;
1587
1639
  const RETRY_DELAY_MS = 2e3;
1588
- let lastError = null;
1589
1640
  for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
1590
1641
  try {
1591
- await geminiBackend.sendPrompt(acpSessionId, promptToSend);
1592
- logger.debug("[gemini] Prompt sent successfully");
1593
- if (geminiBackend.waitForResponseComplete) {
1594
- await geminiBackend.waitForResponseComplete(12e4);
1595
- logger.debug("[gemini] Response complete");
1642
+ accumulatedResponse = "";
1643
+ isResponseInProgress = false;
1644
+ const outcome = await geminiBackend.sendPrompt(acpSessionId, promptToSend);
1645
+ const stopReason = outcome && typeof outcome === "object" ? outcome.stopReason : void 0;
1646
+ logger.debug(`[gemini] Prompt answered (stopReason=${stopReason ?? "none"})`);
1647
+ if (stopReason === "cancelled") {
1648
+ if (!turnAborted()) {
1649
+ turnEnding = "aborted";
1650
+ session.sendAgentMessage("gemini", { type: "turn_aborted", id: randomUUID() });
1651
+ }
1652
+ } else if (stopReason === "error") {
1653
+ throw new Error("the turn ended with an error reported by the agent");
1654
+ } else if (stopReason && stopReason !== "end_turn") {
1655
+ session.sendSessionEvent({ type: "message", message: `Gemini stopped the turn: ${stopReason}` });
1596
1656
  }
1597
1657
  break;
1598
1658
  } catch (promptError) {
1599
- lastError = promptError;
1600
- const errObj = promptError;
1601
- const errorDetails = errObj?.data?.details || errObj?.details || errObj?.message || "";
1602
- const errorCode = errObj?.code;
1603
- const isQuotaError = errorDetails.includes("exhausted") || errorDetails.includes("quota") || errorDetails.includes("capacity");
1604
- if (isQuotaError) {
1605
- const resetTimeMatch = errorDetails.match(/reset after (\d+h)?(\d+m)?(\d+s)?/i);
1606
- let resetTimeMsg = "";
1607
- if (resetTimeMatch) {
1608
- const parts = resetTimeMatch.slice(1).filter(Boolean).join("");
1609
- resetTimeMsg = ` Quota resets in ${parts}.`;
1610
- }
1611
- const quotaMsg = `Gemini quota exceeded.${resetTimeMsg} Try using a different model (gemini-2.5-flash-lite) or wait for quota reset.`;
1612
- messageBuffer.addMessage(quotaMsg, "status");
1613
- session.sendAgentMessage("gemini", { type: "message", message: quotaMsg });
1614
- throw promptError;
1615
- }
1616
- const isEmptyResponseError = errorDetails.includes("empty response") || errorDetails.includes("Model stream ended");
1617
- const isInternalError = errorCode === -32603;
1618
- const isRetryable = isEmptyResponseError || isInternalError;
1619
- if (isRetryable && attempt < MAX_RETRIES) {
1620
- logger.debug(`[gemini] Retryable error on attempt ${attempt}/${MAX_RETRIES}:`, contentLogMetadata(errorDetails));
1621
- messageBuffer.addMessage(`Gemini returned empty response, retrying (${attempt}/${MAX_RETRIES})...`, "status");
1659
+ if (isRetryableGeminiError(promptError) && attempt < MAX_RETRIES) {
1660
+ const notice = describeGeminiRetry(attempt, MAX_RETRIES, promptError);
1661
+ logger.debug(`[gemini] Retryable error on attempt ${attempt}/${MAX_RETRIES}:`, errorLogMetadata(promptError));
1662
+ messageBuffer.addMessage(notice, "status");
1663
+ session.sendSessionEvent({ type: "message", message: notice });
1622
1664
  await new Promise((resolve2) => setTimeout(resolve2, RETRY_DELAY_MS * attempt));
1665
+ if (turnAborted()) throw promptError;
1623
1666
  continue;
1624
1667
  }
1625
1668
  throw promptError;
1626
1669
  }
1627
1670
  }
1628
- if (lastError && MAX_RETRIES > 1) {
1629
- logger.debug("[gemini] Prompt succeeded after retries");
1630
- }
1631
1671
  if (first) {
1632
1672
  first = false;
1633
1673
  }
@@ -1635,49 +1675,22 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1635
1675
  logger.debug("[gemini] Error in gemini session:", errorLogMetadata(error));
1636
1676
  const isAbortError = error instanceof Error && error.name === "AbortError";
1637
1677
  if (isAbortError) {
1678
+ turnEnding = "aborted";
1638
1679
  messageBuffer.addMessage("Aborted by user", "status");
1639
1680
  session.sendSessionEvent({ type: "message", message: "Aborted by user" });
1640
1681
  } else {
1641
- let errorMsg = "Process error occurred";
1642
- if (typeof error === "object" && error !== null) {
1643
- const errObj = error;
1644
- const errorDetails = errObj.data?.details || errObj.details || "";
1645
- const errorCode = errObj.code || errObj.status || errObj.response?.status;
1646
- const errorMessage = errObj.message || errObj.error?.message || "";
1647
- const errorString = String(error);
1648
- if (errorCode === 404 || errorDetails.includes("notFound") || errorDetails.includes("404") || errorMessage.includes("not found") || errorMessage.includes("404")) {
1649
- const currentModel2 = displayedModel || "gemini-2.5-pro";
1650
- errorMsg = `Model "${currentModel2}" not found. Available models: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite`;
1651
- } else if (errorCode === -32603 || errorDetails.includes("empty response") || errorDetails.includes("Model stream ended")) {
1652
- errorMsg = "Gemini API returned empty response after retries. This is a temporary issue - please try again.";
1653
- } else if (errorCode === 429 || errorDetails.includes("429") || errorMessage.includes("429") || errorString.includes("429") || errorDetails.includes("rateLimitExceeded") || errorDetails.includes("RESOURCE_EXHAUSTED") || errorMessage.includes("Rate limit exceeded") || errorMessage.includes("Resource exhausted") || errorString.includes("rateLimitExceeded") || errorString.includes("RESOURCE_EXHAUSTED")) {
1654
- errorMsg = "Gemini API rate limit exceeded. Please wait a moment and try again. The API will retry automatically.";
1655
- } else if (errorDetails.includes("quota") || errorMessage.includes("quota") || errorString.includes("quota") || errorDetails.includes("exhausted") || errorDetails.includes("capacity")) {
1656
- const resetTimeMatch = (errorDetails + errorMessage + errorString).match(/reset after (\d+h)?(\d+m)?(\d+s)?/i);
1657
- let resetTimeMsg = "";
1658
- if (resetTimeMatch) {
1659
- const parts = resetTimeMatch.slice(1).filter(Boolean).join("");
1660
- resetTimeMsg = ` Quota resets in ${parts}.`;
1661
- }
1662
- errorMsg = `Gemini quota exceeded.${resetTimeMsg} Try using a different model (gemini-2.5-flash-lite) or wait for quota reset.`;
1663
- } else if (errorMessage.includes("Authentication required") || errorDetails.includes("Authentication required") || errorCode === -32e3) {
1664
- errorMsg = `Authentication required. For Google Workspace accounts, you need to set a Google Cloud Project:
1665
- very-happy gemini project set <your-project-id>
1666
- Or use a different Google account: very-happy connect gemini
1667
- Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1668
- } else if (Object.keys(error).length === 0) {
1669
- errorMsg = 'Failed to start Gemini. Is "gemini" CLI installed? Run: npm install -g @google/gemini-cli';
1670
- } else if (errObj.message || errorMessage) {
1671
- errorMsg = errorDetails || errorMessage || errObj.message;
1672
- }
1673
- } else if (error instanceof Error) {
1674
- errorMsg = error.message;
1682
+ const failure = describeGeminiFailure(error, { model: displayedModel || "gemini-2.5-pro" });
1683
+ if (failure.kind === "exited" && error instanceof Error) {
1684
+ backendGone = error;
1685
+ } else if (restartAfterExit && !acpSessionId && error instanceof Error) {
1686
+ backendGone = error;
1687
+ }
1688
+ messageBuffer.addMessage(failure.message, "status");
1689
+ session.sendSessionEvent({ type: "message", message: failure.message });
1690
+ if (!turnAborted()) {
1691
+ turnEnding = "failed";
1692
+ session.sendAgentMessage("gemini", { type: "turn_aborted", id: randomUUID() });
1675
1693
  }
1676
- messageBuffer.addMessage(errorMsg, "status");
1677
- session.sendAgentMessage("gemini", {
1678
- type: "message",
1679
- message: errorMsg
1680
- });
1681
1694
  }
1682
1695
  } finally {
1683
1696
  permissionHandler.reset();
@@ -1705,10 +1718,12 @@ Guide: https://goo.gle/gemini-cli-auth-docs#workspace-gca`;
1705
1718
  accumulatedResponse = "";
1706
1719
  isResponseInProgress = false;
1707
1720
  }
1708
- session.sendAgentMessage("gemini", {
1709
- type: "task_complete",
1710
- id: randomUUID()
1711
- });
1721
+ if (turnEnding === "completed") {
1722
+ session.sendAgentMessage("gemini", {
1723
+ type: "task_complete",
1724
+ id: randomUUID()
1725
+ });
1726
+ }
1712
1727
  hadToolCallInTurn = false;
1713
1728
  pendingChangeTitle = false;
1714
1729
  changeTitleCompleted = false;
@@ -3,34 +3,34 @@ import { execFileSync } from 'node:child_process';
3
3
  import os from 'node:os';
4
4
  import { existsSync, readFileSync } from 'node:fs';
5
5
  import { join } from 'node:path';
6
- import { c as connectionState, A as ApiClient } from './api-D08IEaWa.mjs';
7
- import { A as AcpSessionManager } from './AcpSessionManager-y1Iy1mzc.mjs';
8
- import { l as logger } from './logger-D5EzMy30.mjs';
9
- import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-DLiu24CQ.mjs';
10
- import { r as readSettings } from './persistence-CIIhP0Uw.mjs';
11
- import { g as getInitialMachineMetadata } from './machineMetadata-DqplCWue.mjs';
12
- import { c as createSessionMetadata } from './createSessionMetadata-CtNMvfth.mjs';
13
- import { s as setupOfflineReconnection } from './setupOfflineReconnection-CgtXlV74.mjs';
14
- import { n as notifyDaemonSessionStarted } from './controlClient-DqtC0pq1.mjs';
6
+ import { c as connectionState, A as ApiClient } from './api-CKBViqI3.mjs';
7
+ import { A as AcpSessionManager } from './AcpSessionManager-DykjzBM4.mjs';
8
+ import { l as logger } from './logger-13cBr_ew.mjs';
9
+ import { M as MessageQueue2, r as registerKillSessionHandler } from './registerKillSessionHandler-Drhf7-Vz.mjs';
10
+ import { r as readSettings } from './persistence-C_tYtOqK.mjs';
11
+ import { g as getInitialMachineMetadata } from './machineMetadata-dMida2qq.mjs';
12
+ import { c as createSessionMetadata } from './createSessionMetadata-Bi-m0Y_O.mjs';
13
+ import { s as setupOfflineReconnection } from './setupOfflineReconnection-C5trsV-j.mjs';
14
+ import { n as notifyDaemonSessionStarted } from './controlClient-C4xB5J6O.mjs';
15
15
  import { e as encodeBase64 } from './authRelay-DSAvg1uv.mjs';
16
16
  import WebSocket from 'ws';
17
17
  import * as ed from '@noble/ed25519';
18
18
  import { sha512 } from '@noble/hashes/sha2.js';
19
- import { f as ensurePrivateDirectorySync, a as hardenPrivateFileSync, w as writePrivateFileSync, c as configuration } from './configuration-BNGPXg07.mjs';
19
+ import { f as ensurePrivateDirectorySync, a as hardenPrivateFileSync, w as writePrivateFileSync, c as configuration } from './configuration-D55F0t16.mjs';
20
20
  import { e as errorLogMetadata, c as contentLogMetadata } from './contentLogMetadata-BlWI0egu.mjs';
21
21
  import 'axios';
22
- import './lidState-CL1NdKfQ.mjs';
22
+ import './lidState-BqVsw7H1.mjs';
23
23
  import 'os';
24
24
  import 'child_process';
25
25
  import 'node:events';
26
26
  import 'socket.io-client';
27
- import './attachmentLimits-BLbji11b.mjs';
27
+ import './attachmentLimits-Di1Z93lN.mjs';
28
28
  import 'zod';
29
- import './index-boE-d8CM.mjs';
29
+ import './index-DMy3OCBe.mjs';
30
30
  import '@paralleldrive/cuid2';
31
31
  import './limits-DIo7rEBR.mjs';
32
- import './time-CvrpeD3S.mjs';
33
- import './registerCommonHandlers-CR5jpiSx.mjs';
32
+ import './time-yEL6wHUF.mjs';
33
+ import './registerCommonHandlers-D8OMpBbQ.mjs';
34
34
  import 'util';
35
35
  import 'fs/promises';
36
36
  import 'crypto';
@@ -38,17 +38,17 @@ import 'path';
38
38
  import 'cross-spawn';
39
39
  import './projectPath-BTBIMB57.mjs';
40
40
  import 'url';
41
- import './sync-D5YqUVjS.mjs';
42
- import './backgroundTaskActivity-8PdPxrvy.mjs';
41
+ import './sync-C3p7-KLn.mjs';
42
+ import './backgroundTaskActivity-BVwJBl02.mjs';
43
43
  import 'chalk';
44
44
  import 'node:util';
45
45
  import 'tweetnacl';
46
46
  import './types-CkqAACXx.mjs';
47
47
  import 'node:fs/promises';
48
- import './package-D0dxZ-W8.mjs';
48
+ import './package-CjlsAaRe.mjs';
49
49
  import './detectCLI-CSGMlV51.mjs';
50
50
  import 'fs';
51
- import './localHappyAgentAuth-B7f4Ysn0.mjs';
51
+ import './localHappyAgentAuth-Ce8kO2yc.mjs';
52
52
 
53
53
  ed.hashes.sha512 = (message) => sha512(message);
54
54
  const { getPublicKeyAsync, signAsync, utils } = ed;