very-happy-cli 0.2.182 → 0.2.184

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 (204) hide show
  1. package/dist/{AcpBackend-DLk3gMYH.mjs → AcpBackend-Csg7Sy2P.mjs} +3 -3
  2. package/dist/{AcpBackend-JA5eu8Y0.cjs → AcpBackend-DOzn74zn.cjs} +3 -3
  3. package/dist/{AcpSessionManager-OrCww-Qv.mjs → AcpSessionManager-BRK2F2yN.mjs} +10 -3
  4. package/dist/{AcpSessionManager-DjYidq4C.cjs → AcpSessionManager-CJXDNNtq.cjs} +10 -3
  5. package/dist/{BasePermissionHandler-u-neo-iN.mjs → BasePermissionHandler-BqYwrCra.mjs} +1 -1
  6. package/dist/{BasePermissionHandler-D3PMKLBS.cjs → BasePermissionHandler-CfrnkG3v.cjs} +1 -1
  7. package/dist/{acpSessionResume-Dxo8222T.cjs → acpSessionResume-DZ65DBeE.cjs} +1 -1
  8. package/dist/{acpSessionResume-u2TwX5Jd.mjs → acpSessionResume-Dz1myMbR.mjs} +1 -1
  9. package/dist/{agentHome-D3hNrnoA.mjs → agentHome-B_tu3tFJ.mjs} +4 -4
  10. package/dist/{agentHome-CP1tCBXz.cjs → agentHome-CKAXhc8P.cjs} +4 -4
  11. package/dist/{api-C_YSQnsi.mjs → api-BpTDU2BO.mjs} +79 -12
  12. package/dist/{api-CZWcG7uh.cjs → api-rw5xkzxo.cjs} +81 -11
  13. package/dist/{apiMachine-DPGrED5C.cjs → apiMachine-Bs1XXHKs.cjs} +14 -14
  14. package/dist/{apiMachine-C_GA5Bm-.mjs → apiMachine-wp0hWG3F.mjs} +14 -14
  15. package/dist/{attachmentContent-Ckzyb1Uy.mjs → attachmentContent-CWSSGMMo.mjs} +2 -2
  16. package/dist/{attachmentContent-I_dJIevE.cjs → attachmentContent-K_Up4InS.cjs} +2 -2
  17. package/dist/{auth-BKnE7uv7.cjs → auth-C4_mXYgj.cjs} +8 -8
  18. package/dist/{auth-DOXMI-xp.mjs → auth-CBESCCCn.mjs} +8 -8
  19. package/dist/{auth-CGgpiJ5-.mjs → auth-D6kSt2sR.mjs} +5 -5
  20. package/dist/{auth-Lw_utSMV.cjs → auth-gGryJImw.cjs} +5 -5
  21. package/dist/{auto-Z56mMZnH.mjs → auto-CEucVmFR.mjs} +32 -26
  22. package/dist/{auto-CIgFHIyQ.cjs → auto-Do43AOza.cjs} +32 -25
  23. package/dist/{bootstrap-DsXp74wv.cjs → bootstrap-BPz1iX77.cjs} +2 -2
  24. package/dist/{bootstrap-D3vlOROj.mjs → bootstrap-CodyCmGt.mjs} +2 -2
  25. package/dist/{browser-CUxGoATV.mjs → browser-CqMhj8Gm.mjs} +1 -1
  26. package/dist/{browser-CZlA9AkO.cjs → browser-D9D-1eqa.cjs} +1 -1
  27. package/dist/{claudeLocal-FnTUgwCi.mjs → claudeLocal-BgIRtT3Q.mjs} +5 -5
  28. package/dist/{claudeLocal-oELvwiZL.cjs → claudeLocal-Dywp8NKr.cjs} +5 -5
  29. package/dist/{claudeLocalLauncher-CO5YHCzi.mjs → claudeLocalLauncher-CaHjZ8HW.mjs} +10 -10
  30. package/dist/{claudeLocalLauncher-QsVXEVdE.cjs → claudeLocalLauncher-_TOL73g5.cjs} +10 -10
  31. package/dist/{claudeSessionFork-Cspr6QW0.mjs → claudeSessionFork-C9nB7fs5.mjs} +1 -1
  32. package/dist/{claudeSessionFork-BA4GE5AL.cjs → claudeSessionFork-jq-_WiAu.cjs} +1 -1
  33. package/dist/{client-CDuW4MS9.cjs → client-BFDji81N.cjs} +15 -7
  34. package/dist/{client-Ctbw05Xj.mjs → client-BdbVizjk.mjs} +15 -7
  35. package/dist/{client-xnWiHqdb.cjs → client-ByZFACEw.cjs} +18 -5
  36. package/dist/{client-DK8CzUry.cjs → client-C49zFRkX.cjs} +2 -2
  37. package/dist/{client-o-meK7-a.mjs → client-CX-_2myt.mjs} +2 -2
  38. package/dist/{client-BGfmSbWc.mjs → client-DwlYk8uJ.mjs} +18 -5
  39. package/dist/codex/happyMcpStdioBridge.cjs +16 -16
  40. package/dist/codex/happyMcpStdioBridge.mjs +16 -16
  41. package/dist/{codexAppServerClient-BlsOZLul.mjs → codexAppServerClient-CmOIqiNQ.mjs} +3 -3
  42. package/dist/{codexAppServerClient-DhNDTU_i.cjs → codexAppServerClient-DF12ZSw1.cjs} +3 -3
  43. package/dist/{codexCommand-BGx5NMQR.mjs → codexCommand-BN05uEyv.mjs} +94 -60
  44. package/dist/{codexCommand-DJDPfpIs.cjs → codexCommand-H-ObWTtx.cjs} +94 -60
  45. package/dist/{codexTermination-CVhhwHZU.mjs → codexTermination-Byohgj8h.mjs} +1 -1
  46. package/dist/{codexTermination-CqPMuokw.cjs → codexTermination-RwKa8pKk.cjs} +1 -1
  47. package/dist/{config-CWAe08-Q.mjs → config-ChHLh-hf.mjs} +3 -3
  48. package/dist/{config-CHpxzXBL.cjs → config-D_wNqwxX.cjs} +3 -3
  49. package/dist/{configuration-B-CugKJ3.cjs → configuration-C9Sx-Foo.cjs} +1 -1
  50. package/dist/{configuration-YXw_Dcsb.mjs → configuration-CVgUe2qN.mjs} +1 -1
  51. package/dist/{connect-BmHvMXH2.cjs → connect-B61xJDRq.cjs} +13 -13
  52. package/dist/{connect-CPeJXHha.mjs → connect-DJEQjS7C.mjs} +13 -13
  53. package/dist/{context-BtIVqHI5.cjs → context-Bf3BG7w8.cjs} +1 -1
  54. package/dist/{context-Drzs_Z38.mjs → context-CDPfhHTo.mjs} +1 -1
  55. package/dist/{controlClient-D0kGwKYx.cjs → controlClient-BLO1_pPx.cjs} +14 -3
  56. package/dist/{controlClient-BL4hb4l3.mjs → controlClient-DMCxtwq2.mjs} +14 -4
  57. package/dist/{createSessionMetadata-L499emJn.cjs → createSessionMetadata-5Mde6Dfh.cjs} +2 -2
  58. package/dist/{createSessionMetadata-DvGDsnsn.mjs → createSessionMetadata-BYroCdrU.mjs} +2 -2
  59. package/dist/daemonSupervisor-57JYYzMf.cjs +268 -0
  60. package/dist/daemonSupervisor-DfzrtNhM.mjs +245 -0
  61. package/dist/{defaultPermissionMode-MXpZlXud.cjs → defaultPermissionMode-B7mjHQKp.cjs} +2 -2
  62. package/dist/{defaultPermissionMode-BLfxu-Yz.mjs → defaultPermissionMode-CTdxUV_3.mjs} +2 -2
  63. package/dist/{deterministicJson-CfLkBRvU.cjs → deterministicJson-C1Z9MlDX.cjs} +569 -17
  64. package/dist/{deterministicJson-B_UAbmQ4.mjs → deterministicJson-C3QXOc1N.mjs} +572 -21
  65. package/dist/{doctor-DMvlzmnE.cjs → doctor-DRdV3thy.cjs} +7 -7
  66. package/dist/{doctor-bKScPtZu.mjs → doctor-OwNmTpYh.mjs} +7 -7
  67. package/dist/{downloadTarget-J9j37eFG.mjs → downloadTarget-CNtQ8rhV.mjs} +6 -6
  68. package/dist/{downloadTarget-D33BFvew.cjs → downloadTarget-Di5bf7r0.cjs} +6 -6
  69. package/dist/{ensureDaemonRunning-2IqWROJp.cjs → ensureDaemonRunning-CMY--T9Q.cjs} +5 -5
  70. package/dist/{ensureDaemonRunning-DLvwhpNg.mjs → ensureDaemonRunning-IRV-w0wH.mjs} +5 -5
  71. package/dist/{handleResumeCommand-CjtjQ_I7.mjs → handleResumeCommand-BO00SYjG.mjs} +5 -5
  72. package/dist/{handleResumeCommand-Dp2Y-p6V.cjs → handleResumeCommand-z7wY7QVM.cjs} +5 -5
  73. package/dist/{index-DYVIbhAJ.cjs → index-B4cyX2by.cjs} +40 -40
  74. package/dist/{index-B_aNaW9w.cjs → index-BsoUsrKS.cjs} +4 -4
  75. package/dist/{index-Cllzqoes.mjs → index-C7zgeuLP.mjs} +4 -4
  76. package/dist/{index-D_LvOWUN.mjs → index-CVUiytNq.mjs} +3 -3
  77. package/dist/{index-BOT0Tg5E.mjs → index-DZvi6_tB.mjs} +4 -4
  78. package/dist/{index-BI0h2Zks.mjs → index-DisBaRvM.mjs} +277 -77
  79. package/dist/{index-CZC7egJA.cjs → index-NhmqjrGv.cjs} +3 -3
  80. package/dist/{index-oh8XEozJ.cjs → index-Ub-5xbcU.cjs} +286 -76
  81. package/dist/{index-kA46KMxN.mjs → index-_LfuIz-O.mjs} +41 -41
  82. package/dist/{index-DymOv3kK.cjs → index-wYJu2yGc.cjs} +4 -4
  83. package/dist/index.cjs +2 -2
  84. package/dist/index.mjs +2 -2
  85. package/dist/{install-D2NCbeJ-.cjs → install-BATFlr_l.cjs} +2 -2
  86. package/dist/{install-BAa_Xmof.cjs → install-CGYDeYes.cjs} +3 -3
  87. package/dist/{install-C46mkr9a.mjs → install-DeUM6h8X.mjs} +3 -3
  88. package/dist/{install-D0inLCv-.mjs → install-F3rP8tBU.mjs} +2 -2
  89. package/dist/lib.cjs +12 -12
  90. package/dist/lib.d.cts +1 -1
  91. package/dist/lib.d.mts +1 -1
  92. package/dist/lib.mjs +12 -12
  93. package/dist/{lidState-DcPvwniz.cjs → lidState-C4YgPn6y.cjs} +1 -1
  94. package/dist/{lidState-D8Iuvjgl.mjs → lidState-CBjQEwTt.mjs} +1 -1
  95. package/dist/{localHappyAgentAuth-SD6GM97y.cjs → localHappyAgentAuth-BzCuIkzi.cjs} +1 -1
  96. package/dist/{localHappyAgentAuth-D3rQDRd9.mjs → localHappyAgentAuth-CcWGU_lS.mjs} +1 -1
  97. package/dist/{logger-DK1ytCz6.cjs → logger-CrtT0opS.cjs} +2 -2
  98. package/dist/{logger-DpqihN1f.mjs → logger-D2qd0mMg.mjs} +2 -2
  99. package/dist/{machineMetadata-D4E3qoIG.mjs → machineMetadata-B2czDiTd.mjs} +3 -3
  100. package/dist/{machineMetadata-IJc6_iyx.cjs → machineMetadata-D1hlm_oF.cjs} +3 -3
  101. package/dist/{main-CpUmw7hm.mjs → main-BNYWELul.mjs} +69 -56
  102. package/dist/{main-DUXh2rgW.cjs → main-BWgWN5d1.cjs} +69 -56
  103. package/dist/{mcp-D5f3Vd-z.cjs → mcp-C18unjs1.cjs} +15 -15
  104. package/dist/{mcp-66g1TJ8P.mjs → mcp-ColtiH23.mjs} +15 -15
  105. package/dist/{mirrorProtocol-DkWOcZh9.cjs → mirrorProtocol-D4CR5I5W.cjs} +3 -3
  106. package/dist/{mirrorProtocol-bsCUcaCY.mjs → mirrorProtocol-DTHWtAE5.mjs} +3 -3
  107. package/dist/{package-BfeqAzyJ.cjs → package-DczR1k0c.cjs} +7 -7
  108. package/dist/{package-CKj8zndE.mjs → package-Ek5FOyEo.mjs} +7 -7
  109. package/dist/{panels-r8LmaBs6.mjs → panels-BIQ7FrCB.mjs} +5 -5
  110. package/dist/{panels-2PXsw9-d.cjs → panels-DYSMHhdb.cjs} +5 -5
  111. package/dist/{peerTools-D_id4d41.mjs → peerTools-CABQ6iKd.mjs} +5 -5
  112. package/dist/{peerTools-BVp1z0T_.cjs → peerTools-Cufh4Qp_.cjs} +5 -5
  113. package/dist/{persistence-jOEuAFTS.mjs → persistence-DFtgQvr6.mjs} +2 -2
  114. package/dist/{persistence-BdpwWXKh.cjs → persistence-IYH6bAXY.cjs} +2 -2
  115. package/dist/{piRunnerArgs-68I5F_M1.mjs → piRunnerArgs-CIWprC1S.mjs} +1 -1
  116. package/dist/{piRunnerArgs-vxCHKnSA.cjs → piRunnerArgs-Dgjmj8KL.cjs} +1 -1
  117. package/dist/{piRuntime-C3Dg5uni.cjs → piRuntime-C_nX977w.cjs} +2 -2
  118. package/dist/{piRuntime-DgLIard1.mjs → piRuntime-K6o4GPZ9.mjs} +2 -2
  119. package/dist/{piTerminal-DJL0w-uA.mjs → piTerminal-CRl0EZc3.mjs} +18 -18
  120. package/dist/{piTerminal-C135BcLP.cjs → piTerminal-CYhcmkyi.cjs} +18 -18
  121. package/dist/providerBinding-B-Qbx9W2.cjs +140 -0
  122. package/dist/providerBinding-CYubGg-Z.mjs +132 -0
  123. package/dist/{pushNotifications-CyQVDThC.cjs → pushNotifications-BgQ_QTgS.cjs} +3 -3
  124. package/dist/{pushNotifications-CMmRsbKv.mjs → pushNotifications-gVJWGFBP.mjs} +3 -3
  125. package/dist/{query-CPXnDURZ.mjs → query-CGp9vY4e.mjs} +1 -1
  126. package/dist/{query-CK--1fbL.cjs → query-DFreaScb.cjs} +1 -1
  127. package/dist/{rateLimitWindows-DJxnNw-X.cjs → rateLimitWindows-CeogT1b6.cjs} +1 -1
  128. package/dist/{rateLimitWindows-Cqa4AGaB.mjs → rateLimitWindows-DM_gshI4.mjs} +1 -1
  129. package/dist/{registerCommonHandlers-DbNoM39q.cjs → registerCommonHandlers-CRqKXwQt.cjs} +2 -2
  130. package/dist/{registerCommonHandlers-K8dICQO2.mjs → registerCommonHandlers-CyAtDNvs.mjs} +2 -2
  131. package/dist/{registerKillSessionHandler-DiS_go8d.cjs → registerKillSessionHandler-CX49N52L.cjs} +6 -6
  132. package/dist/{registerKillSessionHandler-O1iriOMO.mjs → registerKillSessionHandler-DGWADNla.mjs} +6 -6
  133. package/dist/{remoteSessionClient-BlURPulk.mjs → remoteSessionClient-1nycIdrG.mjs} +5 -5
  134. package/dist/{remoteSessionClient-CtV9mDko.cjs → remoteSessionClient-CuAkp19e.cjs} +5 -5
  135. package/dist/{reportProgressTool-DlD_xjzU.cjs → reportProgressTool-BS7TkeEk.cjs} +4 -4
  136. package/dist/{reportProgressTool-nCExrHZH.mjs → reportProgressTool-CdSi-uSC.mjs} +4 -4
  137. package/dist/{resources-CH1iP6Cv.mjs → resources-CLdQfe3b.mjs} +1 -1
  138. package/dist/{resources-BPyN59Iv.cjs → resources-CqwHPhdK.cjs} +1 -1
  139. package/dist/{run-drtwHYkO.mjs → run-DqjEj8M2.mjs} +101 -248
  140. package/dist/{run-BBNrcCfI.cjs → run-gVwkplx0.cjs} +111 -259
  141. package/dist/{runClaude-B3KSeby4.cjs → runClaude-CtVoFstP.cjs} +39 -24
  142. package/dist/{runClaude-CFp27Tyi.mjs → runClaude-CuSjrZSf.mjs} +39 -24
  143. package/dist/{runClaudeDeps-C_C9TCI0.cjs → runClaudeDeps-DqOgRuKq.cjs} +49 -40
  144. package/dist/{runClaudeDeps-DMcv93lA.mjs → runClaudeDeps-eazOhb6g.mjs} +54 -45
  145. package/dist/{runGemini-DzdSBAr9.cjs → runGemini-81wkPvMv.cjs} +37 -35
  146. package/dist/{runGemini-Bc6SY-hd.mjs → runGemini-B4EqAd1U.mjs} +37 -35
  147. package/dist/{runOpenClaw-DN6rEVqC.cjs → runOpenClaw-BK7ZQEKj.cjs} +18 -18
  148. package/dist/{runOpenClaw-DI0qMlgF.mjs → runOpenClaw-Brb1KKAA.mjs} +18 -18
  149. package/dist/{sandbox-DtttPBMA.cjs → sandbox-DFD6an8o.cjs} +4 -4
  150. package/dist/{sandbox-v-ffe8LR.mjs → sandbox-t43Exd4t.mjs} +4 -4
  151. package/dist/{selfCheck-B-yy6bW3.cjs → selfCheck-Bel50SH3.cjs} +37 -36
  152. package/dist/selfCheck-CwpZepG-.mjs +86 -0
  153. package/dist/{send-DpBwSZuj.mjs → send-Co9jxmc4.mjs} +8 -8
  154. package/dist/{send-ShzXYPRu.cjs → send-IR5DnG9V.cjs} +8 -8
  155. package/dist/{server-CEzKrfKj.cjs → server-CAo6a3Vw.cjs} +6 -6
  156. package/dist/{server-DScgJXxa.mjs → server-KnIeKeTb.mjs} +4 -4
  157. package/dist/{sessionLock-Dc0fadGG.cjs → sessionLock-DNGDn9oj.cjs} +3 -3
  158. package/dist/{sessionLock-B6K4SBZD.mjs → sessionLock-ha9gsQEn.mjs} +3 -3
  159. package/dist/{sessionOps-D0BPWPoh.mjs → sessionOps-Di9MC0FP.mjs} +4 -4
  160. package/dist/{sessionOps-Dx7wARjI.cjs → sessionOps-hRqzcMXB.cjs} +4 -4
  161. package/dist/sessionProvider-4Nn6e9Kd.mjs +109 -0
  162. package/dist/sessionProvider-LqE7Y_cf.cjs +114 -0
  163. package/dist/{sessionScanner-BJ35TVG6.cjs → sessionScanner-BzEtrHB8.cjs} +3 -3
  164. package/dist/{sessionScanner-9Fpgaxtf.mjs → sessionScanner-DKFKDsrW.mjs} +3 -3
  165. package/dist/{sessions-TZGGAry1.cjs → sessions-CmLiagcb.cjs} +10 -10
  166. package/dist/{sessions-CFtDlyZd.mjs → sessions-DzgMNXo5.mjs} +10 -10
  167. package/dist/{setupOfflineReconnection-Biaus-0T.mjs → setupOfflineReconnection-D4NGi3Jf.mjs} +2 -2
  168. package/dist/{setupOfflineReconnection-B1GsVA8P.cjs → setupOfflineReconnection-Dq4N2Txp.cjs} +2 -2
  169. package/dist/{spawn-CsoQ-Ecz.mjs → spawn-C6CE5PsI.mjs} +14 -14
  170. package/dist/{spawn-BRTuypQ2.cjs → spawn-tmoekkOW.cjs} +14 -14
  171. package/dist/{spawnAgents-CG211IW7.cjs → spawnAgents-D15n6tAj.cjs} +1 -1
  172. package/dist/{spawnAgents-Co-SLcx-.mjs → spawnAgents-jXo9jIYo.mjs} +1 -1
  173. package/dist/{spawnHappyCLI-D1doCjkZ.mjs → spawnHappyCLI-66grqHO0.mjs} +1 -1
  174. package/dist/{spawnHappyCLI-D47kX6jg.cjs → spawnHappyCLI-8NcKgkuy.cjs} +1 -1
  175. package/dist/{specialCommands-xSmqT_Fu.mjs → specialCommands-BO8ipH0n.mjs} +3 -3
  176. package/dist/{specialCommands-Ch-Gvy-i.cjs → specialCommands-Dq0TmY1Z.cjs} +3 -3
  177. package/dist/{startFileWatcher-CCl2fFxT.mjs → startFileWatcher-BLDkieUW.mjs} +1 -1
  178. package/dist/{startFileWatcher-gKQTstR6.cjs → startFileWatcher-CjgKvec9.cjs} +1 -1
  179. package/dist/{startupSessionCreate-DlZc8yPl.mjs → startupSessionCreate-B60THeNz.mjs} +1 -1
  180. package/dist/{startupSessionCreate-BXqoUX30.cjs → startupSessionCreate-CXRVahaU.cjs} +1 -1
  181. package/dist/{streamRelay-B-J-4St1.cjs → streamRelay-CtTpf-Li.cjs} +1 -1
  182. package/dist/{streamRelay-DnJXsi36.mjs → streamRelay-GzHxvMem.mjs} +1 -1
  183. package/dist/{sync-BbjMC3sR.mjs → sync-DJvx7RbO.mjs} +1 -1
  184. package/dist/{sync-BxMdnZzz.cjs → sync-DKSZOi6w.cjs} +1 -1
  185. package/dist/{systemPrompt-C2KojRmK.cjs → systemPrompt-Duos1BtM.cjs} +2 -2
  186. package/dist/{systemPrompt-CmSDAoIx.mjs → systemPrompt-dOOpz8L7.mjs} +2 -2
  187. package/dist/{teams-DESdalox.cjs → teams-pO5rjvPO.cjs} +9 -9
  188. package/dist/{teams-lRy1MS0Z.mjs → teams-uWiMJEe1.mjs} +9 -9
  189. package/dist/{template-BaHAmH2K.cjs → template-BLJxflCH.cjs} +32 -2
  190. package/dist/{template-CiOPa2rd.mjs → template-YlpbYGeQ.mjs} +31 -3
  191. package/dist/{time-DNLeIRgR.cjs → time-D-8GFCE7.cjs} +1 -1
  192. package/dist/{time-Cfknl7xG.mjs → time-Du0scQeJ.mjs} +1 -1
  193. package/dist/{titleGenerator-ClnMSzwC.mjs → titleGenerator-DKYj8rLY.mjs} +1 -1
  194. package/dist/{titleGenerator-YNutaU88.cjs → titleGenerator-DnKygjBP.cjs} +2 -2
  195. package/dist/{todo-DS75Mboz.cjs → todo-BFDb7O8q.cjs} +6 -6
  196. package/dist/{todo-DZbK5POc.mjs → todo-Du5dAwnt.mjs} +6 -6
  197. package/dist/{tools-BgdU0dWp.mjs → tools-DHvMVL0a.mjs} +1 -1
  198. package/dist/{tools-ClYcb1YQ.cjs → tools-DK_x86Kl.cjs} +1 -1
  199. package/dist/{uninstall-bXenFevR.mjs → uninstall-CLDEXir0.mjs} +3 -3
  200. package/dist/{uninstall-Di1vPBLV.cjs → uninstall-c3zjum2o.cjs} +3 -3
  201. package/package.json +7 -7
  202. package/dist/daemonSupervisor-B-SPSqhs.cjs +0 -13
  203. package/dist/daemonSupervisor-C6urv3_8.mjs +0 -10
  204. package/dist/selfCheck-BDfTwxqB.mjs +0 -85
@@ -1,25 +1,25 @@
1
- import { i as isClaudeSessionId, g as extractCompleteLines, h as decideBackfill, j as parseTerminalHookPayload, k as decideMirrorBinding, M as MIRROR_BACKFILL_LINES_DEFAULT, m as mirrorLineKey, n as mirrorLocalId, o as initializeOwnedWorktree, e as summarizeSpawnSessionForLog, q as startAgentVersionChecks, W as WORKTREE_CAPABILITY_VERSION, t as currentWorktreeService } from './mirrorProtocol-bsCUcaCY.mjs';
1
+ import { i as isClaudeSessionId, g as extractCompleteLines, h as decideBackfill, j as parseTerminalHookPayload, k as decideMirrorBinding, M as MIRROR_BACKFILL_LINES_DEFAULT, m as mirrorLineKey, n as mirrorLocalId, o as initializeOwnedWorktree, e as summarizeSpawnSessionForLog, q as startAgentVersionChecks, W as WORKTREE_CAPABILITY_VERSION, t as currentWorktreeService } from './mirrorProtocol-DTHWtAE5.mjs';
2
2
  import { F as FS_MKDIR_CAPABILITY_VERSION } from './fsMkdir-DumgLTzR.mjs';
3
- import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-68I5F_M1.mjs';
3
+ import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-CIWprC1S.mjs';
4
4
  import fs from 'fs/promises';
5
5
  import os from 'os';
6
6
  import * as tmp from 'tmp';
7
7
  import axios from 'axios';
8
8
  import { readFileSync, openSync, fsyncSync, closeSync, renameSync, existsSync, readdirSync, statSync, unlinkSync, realpathSync, promises, writeFileSync, mkdirSync, accessSync, constants as constants$1, readSync, rmdirSync } from 'node:fs';
9
- import { join, isAbsolute, resolve, dirname, sep, basename, delimiter } from 'node:path';
10
- import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-YXw_Dcsb.mjs';
11
- import { T as TurnActivityTracker, A as ApiClient } from './api-C_YSQnsi.mjs';
12
- import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-Co-SLcx-.mjs';
13
- import { l as logger } from './logger-DpqihN1f.mjs';
14
- import { p as pruneStaleCompileCaches } from './index-D_LvOWUN.mjs';
15
- import { a as authAndSetupMachineIfNeeded } from './auth-CGgpiJ5-.mjs';
9
+ import { join, isAbsolute, resolve, dirname, sep, basename } from 'node:path';
10
+ import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-CVgUe2qN.mjs';
11
+ import { T as TurnActivityTracker, A as ApiClient } from './api-BpTDU2BO.mjs';
12
+ import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-jXo9jIYo.mjs';
13
+ import { l as logger } from './logger-D2qd0mMg.mjs';
14
+ import { p as pruneStaleCompileCaches } from './index-CVUiytNq.mjs';
15
+ import { a as authAndSetupMachineIfNeeded } from './auth-D6kSt2sR.mjs';
16
16
  import { spawn, execSync } from 'child_process';
17
- import { p as packageJson } from './package-CKj8zndE.mjs';
18
- import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-bKScPtZu.mjs';
19
- import { s as spawnHappyCLI } from './spawnHappyCLI-D1doCjkZ.mjs';
20
- import { c as readPersistedSessions, r as readSettings, l as latchKeepAwake, q as reportSignature, s as decideDaemonHibernation, t as nextCheckDelay, v as persistSession, d as readDaemonState, x as acquireDaemonLock, a as resolveCheckMs, y as resolveIdleMs, z as deletePersistedSessions, A as writeDaemonState, B as writeSettings, C as settingIdleMs, u as updateSettings, D as rewriteCredentialsForRelay, g as readCredentials, E as releaseDaemonLock } from './persistence-jOEuAFTS.mjs';
21
- import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, t as cleanupDaemonState } from './controlClient-BL4hb4l3.mjs';
22
- import { e as sendUserMessage, f as readSessionMetadata, r as readSessionTranscript, l as listAccountSessions, a as listSessions, M as MAX_READ_LIMIT, s as sessionWebUrl, g as waitForSessionKey, d as archiveSession, j as analyzeLatestTurn, k as readSessionLog, m as TURN_WINDOW, n as userPromptText } from './sessionOps-D0BPWPoh.mjs';
17
+ import { p as packageJson } from './package-Ek5FOyEo.mjs';
18
+ import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-OwNmTpYh.mjs';
19
+ import { s as spawnHappyCLI } from './spawnHappyCLI-66grqHO0.mjs';
20
+ import { c as readPersistedSessions, r as readSettings, l as latchKeepAwake, q as reportSignature, s as decideDaemonHibernation, t as nextCheckDelay, v as persistSession, d as readDaemonState, x as acquireDaemonLock, a as resolveCheckMs, y as resolveIdleMs, z as deletePersistedSessions, A as writeDaemonState, B as writeSettings, C as settingIdleMs, u as updateSettings, D as rewriteCredentialsForRelay, g as readCredentials, E as releaseDaemonLock } from './persistence-DFtgQvr6.mjs';
21
+ import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, u as cleanupDaemonState } from './controlClient-DMCxtwq2.mjs';
22
+ import { e as sendUserMessage, f as readSessionMetadata, r as readSessionTranscript, l as listAccountSessions, a as listSessions, M as MAX_READ_LIMIT, s as sessionWebUrl, g as waitForSessionKey, d as archiveSession, j as analyzeLatestTurn, k as readSessionLog, m as TURN_WINDOW, n as userPromptText } from './sessionOps-Di9MC0FP.mjs';
23
23
  import fastify from 'fastify';
24
24
  import { z } from 'zod';
25
25
  import { validatorCompiler, serializerCompiler } from 'fastify-type-provider-zod';
@@ -27,62 +27,62 @@ import { d as decodeBase64, s as sameRelay, e as encodeBase64, h as decrypt } fr
27
27
  import { randomBytes, createHash, timingSafeEqual, randomUUID } from 'node:crypto';
28
28
  import { c as checkPreviewPath } from './previewPath-CXN4Vag0.mjs';
29
29
  import { a as BACKGROUND_TASKS_MAX, d as BACKGROUND_TASK_DESCRIPTION_MAX, e as BackgroundTaskTracker } from './backgroundTaskActivity-8PdPxrvy.mjs';
30
- import { b as sanitizeRateLimitReport } from './rateLimitWindows-Cqa4AGaB.mjs';
31
- import { f as formatEditConflictNotice, b as SESSION_PEER_SENT_FROM, s as sendPeerMessage, l as listPeerSessions, C as CLI_PEER_SENDER_ID } from './peerTools-D_id4d41.mjs';
32
- import os$1, { hostname, homedir, userInfo, tmpdir } from 'node:os';
33
- import { c as RemoteCallBudget, e as REMOTE_WRITE_CALLS_PER_MINUTE, d as deliverToSession, g as guardRemoteSessionOpsRequest, h as remoteError, i as REMOTE_OP_DEADLINE_MS, j as formatRemoteAuditLine, k as REMOTE_SEND_COMMIT_DEADLINE_MS, m as REMOTE_RESUME_WAIT_MS, n as capRemoteTranscript, o as capRemoteText, p as REMOTE_ANSWER_MAX_BYTES, q as REMOTE_TITLE_MAX_BYTES } from './remoteSessionClient-BlURPulk.mjs';
34
- import { assistantHome, bootstrapAssistantHome } from './bootstrap-D3vlOROj.mjs';
35
- import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-Cllzqoes.mjs';
30
+ import { b as sanitizeRateLimitReport } from './rateLimitWindows-DM_gshI4.mjs';
31
+ import { f as formatEditConflictNotice, b as SESSION_PEER_SENT_FROM, s as sendPeerMessage, l as listPeerSessions, C as CLI_PEER_SENDER_ID } from './peerTools-CABQ6iKd.mjs';
32
+ import os$1, { hostname, homedir, tmpdir } from 'node:os';
33
+ import { c as RemoteCallBudget, e as REMOTE_WRITE_CALLS_PER_MINUTE, d as deliverToSession, g as guardRemoteSessionOpsRequest, h as remoteError, i as REMOTE_OP_DEADLINE_MS, j as formatRemoteAuditLine, k as REMOTE_SEND_COMMIT_DEADLINE_MS, m as REMOTE_RESUME_WAIT_MS, n as capRemoteTranscript, o as capRemoteText, p as REMOTE_ANSWER_MAX_BYTES, q as REMOTE_TITLE_MAX_BYTES } from './remoteSessionClient-1nycIdrG.mjs';
34
+ import { assistantHome, bootstrapAssistantHome } from './bootstrap-CodyCmGt.mjs';
35
+ import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-C7zgeuLP.mjs';
36
36
  import require$$0, { existsSync as existsSync$1, statSync as statSync$1, mkdtempSync, rmSync } from 'fs';
37
37
  import require$$1, { join as join$1 } from 'path';
38
38
  import { spawn as spawn$1, execFile, spawnSync } from 'node:child_process';
39
39
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
40
40
  import { d as daemonEndpointsMatch, r as resolveClaudeCredentialReadiness } from './doctorReadiness-C208SMN9.mjs';
41
- import { o as ownerRetryPending, c as consumeOwnerRetry, s as spawnGate, a as afterStartupFailure, b as startupFailureMessage, T as TEAM_SPAWN_MAX_ATTEMPTS, d as TEAM_CLEANUP_RETRY_MS, g as getInitialMachineMetadata, e as getStartupCliAvailability, f as TEAM_RETRY_CAPABILITY_VERSION, w as withRunningCliFacts } from './machineMetadata-D4E3qoIG.mjs';
41
+ import { o as ownerRetryPending, c as consumeOwnerRetry, s as spawnGate, a as afterStartupFailure, b as startupFailureMessage, T as TEAM_SPAWN_MAX_ATTEMPTS, d as TEAM_CLEANUP_RETRY_MS, g as getInitialMachineMetadata, e as getStartupCliAvailability, f as TEAM_RETRY_CAPABILITY_VERSION, w as withRunningCliFacts } from './machineMetadata-B2czDiTd.mjs';
42
42
  import { M as ModelConfigError, B as BackupStore, r as readConfigFile, s as sha256, a as atomicWriteFile } from './fileStore-5qpetZS0.mjs';
43
- import { c as collectSecretValues, a as parseJsonObject$1, b as childObject, s as setOrDelete, d as changedPaths, e as stringifyLike, f as fail, n as normalizeModelList, g as normalizeModelId, h as normalizeSecret, i as normalizeBaseUrl, u as uniq, j as baseUrlWarnings, m as maskSecret, k as getPath$1, l as normalizeProviderId, o as piAdapter, r as redactText } from './pi-CqyoZMjI.mjs';
43
+ import { c as collectSecretValues, a as parseJsonObject, b as childObject, s as setOrDelete, d as changedPaths, e as stringifyLike, f as fail, n as normalizeModelList, g as normalizeModelId, h as normalizeSecret, i as normalizeBaseUrl, u as uniq, j as baseUrlWarnings, m as maskSecret, k as getPath$1, l as normalizeProviderId, o as piAdapter, r as redactText } from './pi-CqyoZMjI.mjs';
44
44
  import require$$3 from 'crypto';
45
45
  import { c as commandOnPath } from './detectCLI-CSGMlV51.mjs';
46
- import { buildResumeLaunch } from './handleResumeCommand-CjtjQ_I7.mjs';
46
+ import { buildResumeLaunch } from './handleResumeCommand-BO00SYjG.mjs';
47
47
  import { n as normalizeWebPanels } from './webPanels-B2_C2-3g.mjs';
48
- import { x as ServerMigrateNoticeSchema, y as isHarnessInstallId, z as AUTOMATION_SUMMARY_MAX_CHARS, D as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, E as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, b as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, F as AUTOMATION_CLAIM_MAX_RUNS, G as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, H as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, I as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-BI0h2Zks.mjs';
48
+ import { K as ServerMigrateNoticeSchema, L as isHarnessInstallId, e as AUTOMATION_SUMMARY_MAX_CHARS, M as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, N as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, b as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, Q as AUTOMATION_CLAIM_MAX_RUNS, T as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, U as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, V as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-DisBaRvM.mjs';
49
49
  import { access, symlink, readFile, rm, unlink, readlink, lstat, constants, stat, open } from 'node:fs/promises';
50
50
  import { p as parseExactVersion, c as compareExactVersions, f as fetchCliUpdateState, r as resolveCliUpdateCheckInterval, D as DEFAULT_CLI_UPDATE_CHECK_INTERVAL_MS } from './cliUpdate-Y34VGe9Y.mjs';
51
- import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-o-meK7-a.mjs';
52
- import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-Ctbw05Xj.mjs';
53
- import { createRequire } from 'node:module';
51
+ import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-CX-_2myt.mjs';
52
+ import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-BdbVizjk.mjs';
53
+ import { w as withKeychainOffPath, a as keychainIdentityFor, i as interpretSecurityRead, s as securityReadArgs, b as securityDeleteArgs, c as keychainOffShimDir, d as interpretCredentialsFile, C as CREDENTIALS_REJECTED_DETAIL, e as buildClaudeAuthState, f as claudeAuthStateChanged, r as resolveSdkClaudeBinary, g as classifyAuthStatus, h as diagnoseStores, p as parseLaunchctlPid, H as HAPPY_DAEMON_LAUNCHD_LABEL, j as classifyLineage, l as probeLaunchdJob, m as detectDaemonSupervisor, n as daemonLineage } from './daemonSupervisor-DfzrtNhM.mjs';
54
54
  import { g as getProjectPath } from './path-D2wdaNSk.mjs';
55
55
  import { b as extractClaudeEditPaths } from './editPaths-BVfS_FFL.mjs';
56
- import { s as startFileWatcher } from './startFileWatcher-CCl2fFxT.mjs';
57
- import { I as InvalidateSync } from './sync-BbjMC3sR.mjs';
56
+ import { s as startFileWatcher } from './startFileWatcher-BLDkieUW.mjs';
57
+ import { I as InvalidateSync } from './sync-DJvx7RbO.mjs';
58
58
  import { R as RawJSONLinesSchema } from './types-CkqAACXx.mjs';
59
59
  import { t as tmuxArgs, a as scrubTmuxClientEnv, s as shellescape } from './tmuxSocket-B8Yx20sT.mjs';
60
- import { p as processIdentityFields, r as readSessionLock, t as terminateProcess, d as terminateProcessTree } from './sessionLock-B6K4SBZD.mjs';
60
+ import { p as processIdentityFields, r as readSessionLock, t as terminateProcess, d as terminateProcessTree } from './sessionLock-ha9gsQEn.mjs';
61
61
  import { findAllHappyProcesses } from './doctor-BPkYWSuq.mjs';
62
- import { T as TEAM_SKILL, a as TEAM_LEAD_PLAYBOOK, b as TEAM_MEMBER_RULES } from './resources-CH1iP6Cv.mjs';
62
+ import { T as TEAM_SKILL, a as TEAM_LEAD_PLAYBOOK, b as TEAM_MEMBER_RULES } from './resources-CLdQfe3b.mjs';
63
63
  import { promisify } from 'node:util';
64
- import { c as clipText, r as renderAction, b as renderTemplate } from './template-CiOPa2rd.mjs';
65
- import { d as detectDaemonSupervisor } from './daemonSupervisor-C6urv3_8.mjs';
64
+ import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-YlpbYGeQ.mjs';
66
65
  import { d as describeAgentHome } from './loginShellEnv-Dw8M7tkI.mjs';
67
- import './acpSessionResume-u2TwX5Jd.mjs';
68
- import './lidState-D8Iuvjgl.mjs';
66
+ import './acpSessionResume-Dz1myMbR.mjs';
67
+ import './lidState-CBjQEwTt.mjs';
69
68
  import 'node:events';
70
69
  import 'socket.io-client';
71
- import './pushNotifications-CMmRsbKv.mjs';
70
+ import './pushNotifications-gVJWGFBP.mjs';
72
71
  import './contentLogMetadata-BlWI0egu.mjs';
73
72
  import './limits-DIo7rEBR.mjs';
74
- import './time-Cfknl7xG.mjs';
75
- import './registerCommonHandlers-K8dICQO2.mjs';
73
+ import './time-Du0scQeJ.mjs';
74
+ import './registerCommonHandlers-CyAtDNvs.mjs';
76
75
  import 'util';
77
76
  import 'cross-spawn';
78
77
  import '@paralleldrive/cuid2';
79
78
  import 'chalk';
79
+ import 'node:module';
80
80
  import 'tweetnacl';
81
- import './browser-CUxGoATV.mjs';
81
+ import './browser-CqMhj8Gm.mjs';
82
82
  import 'open';
83
83
  import './ids-DU6sLx4C.mjs';
84
84
  import 'url';
85
- import './localHappyAgentAuth-D3rQDRd9.mjs';
85
+ import './localHappyAgentAuth-CcWGU_lS.mjs';
86
86
  import './processTreeSnapshot-CuLJDNC-.mjs';
87
87
  import 'ps-list';
88
88
 
@@ -572,6 +572,7 @@ function startDaemonControlServer({
572
572
  stopSession,
573
573
  spawnSession,
574
574
  resumeSession,
575
+ restartSession,
575
576
  requestShutdown,
576
577
  onHappySessionWebhook,
577
578
  onSessionStateEvent,
@@ -868,6 +869,34 @@ function startDaemonControlServer({
868
869
  return { success: false, error: result.errorMessage };
869
870
  }
870
871
  });
872
+ typed.post("/restart-session", {
873
+ schema: {
874
+ body: z.object({ sessionId: z.string().min(1).max(200) }),
875
+ response: {
876
+ 200: z.object({ success: z.boolean(), sessionId: z.string().optional(), error: z.string().optional() }),
877
+ 500: z.object({ success: z.boolean(), error: z.string().optional() }),
878
+ 503: z.object({ success: z.boolean(), error: z.string().optional() })
879
+ }
880
+ }
881
+ }, async (request, reply) => {
882
+ const { sessionId } = request.body;
883
+ if (!restartSession) {
884
+ reply.code(503);
885
+ return { success: false, error: "daemon is still starting up" };
886
+ }
887
+ logger.debug(`[CONTROL SERVER] Restart session request: ${sessionId}`);
888
+ const result = await restartSession(sessionId, { keepPublishedPermissionMode: true });
889
+ switch (result.type) {
890
+ case "success":
891
+ return { success: true, sessionId: result.sessionId };
892
+ case "requestToApproveDirectoryCreation":
893
+ reply.code(500);
894
+ return { success: false, error: `Cannot restart: working directory ${result.directory} needs to be created first` };
895
+ case "error":
896
+ reply.code(500);
897
+ return { success: false, error: result.errorMessage };
898
+ }
899
+ });
871
900
  typed.post("/terminal-hook", {
872
901
  schema: {
873
902
  body: z.any(),
@@ -2361,14 +2390,14 @@ const claudeAdapter = {
2361
2390
  binary: "claude",
2362
2391
  files: (ctx) => [{ role: ROLE$1, path: claudeSettingsPath(ctx) }],
2363
2392
  view(files, ctx) {
2364
- const settings = parseJsonObject$1(files[ROLE$1].content, "settings.json");
2393
+ const settings = parseJsonObject(files[ROLE$1].content, "settings.json");
2365
2394
  const current = currentOf$2(settings, ctx);
2366
2395
  return { current, pickerModels: pickerModelsOf(current), warnings: warningsOf$2(settings, current, ctx) };
2367
2396
  },
2368
2397
  plan(files, raw, ctx) {
2369
2398
  const patch = parsePatch$1(raw);
2370
2399
  const original = files[ROLE$1].content;
2371
- const before = parseJsonObject$1(original, "settings.json");
2400
+ const before = parseJsonObject(original, "settings.json");
2372
2401
  const settings = structuredClone(before);
2373
2402
  const hadEnv = settings.env !== void 0;
2374
2403
  const env = childObject(settings, "env", "settings");
@@ -2429,7 +2458,7 @@ const claudeAdapter = {
2429
2458
  },
2430
2459
  secretsIn(_role, content) {
2431
2460
  try {
2432
- return collectSecretValues(parseJsonObject$1(content, "settings.json"));
2461
+ return collectSecretValues(parseJsonObject(content, "settings.json"));
2433
2462
  } catch {
2434
2463
  return /* @__PURE__ */ new Set();
2435
2464
  }
@@ -3979,7 +4008,7 @@ const geminiAdapter = {
3979
4008
  binary: "gemini",
3980
4009
  files: (ctx) => [{ role: SETTINGS, path: join(geminiDir(ctx), "settings.json") }, { role: ENV, path: join(geminiDir(ctx), ".env") }],
3981
4010
  view(files, ctx) {
3982
- const settings = parseJsonObject$1(files[SETTINGS].content, "settings.json");
4011
+ const settings = parseJsonObject(files[SETTINGS].content, "settings.json");
3983
4012
  const current = currentOf(settings, parseDotenv(files[ENV].content), ctx);
3984
4013
  return { current, pickerModels: uniq([current.model]), warnings: warningsOf(settings, current) };
3985
4014
  },
@@ -3989,7 +4018,7 @@ const geminiAdapter = {
3989
4018
  const apiKey = normalizeSecret(p.apiKey, ["keep", "clear", "literal"]);
3990
4019
  const model = normalizeModelId(p.model);
3991
4020
  const settingsText = files[SETTINGS].content;
3992
- const before = parseJsonObject$1(settingsText, "settings.json");
4021
+ const before = parseJsonObject(settingsText, "settings.json");
3993
4022
  const settings = structuredClone(before);
3994
4023
  const changedKeys = [];
3995
4024
  let settingsOut;
@@ -4020,7 +4049,7 @@ const geminiAdapter = {
4020
4049
  },
4021
4050
  secretsIn(role, content) {
4022
4051
  try {
4023
- return role === ENV ? collectSecretValues(parseDotenv(content)) : collectSecretValues(parseJsonObject$1(content, "settings.json"));
4052
+ return role === ENV ? collectSecretValues(parseDotenv(content)) : collectSecretValues(parseJsonObject(content, "settings.json"));
4024
4053
  } catch {
4025
4054
  return /* @__PURE__ */ new Set();
4026
4055
  }
@@ -5093,196 +5122,6 @@ async function waitForSessionLive(sessionId, live, timeoutMs = AUTOMATION_WAKE_T
5093
5122
  return true;
5094
5123
  }
5095
5124
 
5096
- const CLAUDE_KEYCHAIN_SERVICE_PREFIX = "Claude Code";
5097
- function keychainIdentity(env = process.env, deps = {}) {
5098
- const home = deps.home ?? homedir();
5099
- const secureDir = env.CLAUDE_SECURESTORAGE_CONFIG_DIR?.trim();
5100
- const configDirEnv = env.CLAUDE_CONFIG_DIR?.trim();
5101
- const configDir = secureDir || configDirEnv || join(home, ".claude");
5102
- const hasCustomDir = Boolean(secureDir || configDirEnv);
5103
- const dirSuffix = hasCustomDir ? "-" + createHash("sha256").update(configDir.normalize("NFC")).digest("hex").slice(0, 8) : "";
5104
- const oauthSuffix = env.CLAUDE_CODE_OAUTH_CLIENT_ID?.trim() ? "-custom-oauth" : "";
5105
- const rawAccount = env.USER || safeUsername(deps.username);
5106
- const account = /^[a-zA-Z0-9._-]+$/.test(rawAccount) ? rawAccount : "claude-code-user";
5107
- return {
5108
- service: `${CLAUDE_KEYCHAIN_SERVICE_PREFIX}${oauthSuffix}-credentials${dirSuffix}`,
5109
- account,
5110
- configDir,
5111
- credentialsPath: join(configDir, ".credentials.json")
5112
- };
5113
- }
5114
- function safeUsername(provider) {
5115
- try {
5116
- return provider ? provider() : userInfo().username;
5117
- } catch {
5118
- return "";
5119
- }
5120
- }
5121
-
5122
- const CLAUDE_AUTH_PROBE_VERSION = 1;
5123
- const LOCAL_CREDENTIAL_SOURCE = "Claude local credentials";
5124
- function classifyAuthStatus(run, credentialSource) {
5125
- const localSource = credentialSource === void 0 || credentialSource === LOCAL_CREDENTIAL_SOURCE;
5126
- if (run.spawnError) {
5127
- return { status: "error", diagnosis: "probe-crash", detail: `could not run claude auth status: ${run.spawnError}` };
5128
- }
5129
- if (run.timedOut) {
5130
- return { status: "error", diagnosis: "probe-timeout", detail: "claude auth status did not answer within the timeout" };
5131
- }
5132
- const parsed = parseJsonObject(run.stdout);
5133
- if (!parsed) {
5134
- if (!localSource) return { status: "unknown", authMethod: credentialSource, detail: `auth status unparseable under ${credentialSource}` };
5135
- return { status: "error", diagnosis: "probe-crash", detail: `claude auth status returned no JSON (exit ${run.exitCode ?? "null"})` };
5136
- }
5137
- const authMethod = typeof parsed.authMethod === "string" ? parsed.authMethod : void 0;
5138
- const subscriptionType = typeof parsed.subscriptionType === "string" ? parsed.subscriptionType : void 0;
5139
- if (parsed.loggedIn === true) {
5140
- return { status: "ok", authMethod: localSource ? authMethod : credentialSource, subscriptionType };
5141
- }
5142
- if (!localSource) {
5143
- return { status: "unknown", authMethod: credentialSource, detail: `Claude Code reports loggedIn=false under ${credentialSource}; not a local-credential failure` };
5144
- }
5145
- return { status: "not-logged-in", authMethod, subscriptionType, detail: "Claude Code in the daemon context reports it is not logged in" };
5146
- }
5147
- function parseJsonObject(text) {
5148
- const trimmed = text.trim();
5149
- if (!trimmed) return null;
5150
- const start = trimmed.indexOf("{");
5151
- if (start < 0) return null;
5152
- try {
5153
- const value = JSON.parse(trimmed.slice(start));
5154
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
5155
- } catch {
5156
- return null;
5157
- }
5158
- }
5159
- function resolveSdkClaudeBinary(platform = process.platform, arch = process.arch, resolver = (s) => createRequire(import.meta.url).resolve(s)) {
5160
- const platformArch = `${platform}-${arch}`;
5161
- const candidates = [
5162
- `@anthropic-ai/claude-agent-sdk-${platformArch}/claude`,
5163
- `@anthropic-ai/claude-agent-sdk-${platformArch}/claude.exe`
5164
- ];
5165
- for (const candidate of candidates) {
5166
- try {
5167
- return resolver(candidate);
5168
- } catch {
5169
- }
5170
- }
5171
- return null;
5172
- }
5173
- function interpretSecurityRead(result) {
5174
- if (result.error === "ENOENT") return { kind: "unsupported" };
5175
- if (result.error === "timeout") return { kind: "error", detail: "security timed out" };
5176
- if (result.exitCode === 44) return { kind: "absent" };
5177
- if (result.exitCode === 36) return { kind: "unreadable" };
5178
- if (result.exitCode !== 0) return { kind: "error", detail: `security exited ${result.exitCode ?? "null"}` };
5179
- const raw = result.stdout.trim();
5180
- if (!raw) return { kind: "absent" };
5181
- const parsed = parseJsonObject(raw);
5182
- const oauth = parsed && typeof parsed.claudeAiOauth === "object" && parsed.claudeAiOauth ? parsed.claudeAiOauth : null;
5183
- if (!oauth) return { kind: "present", accessToken: "", refreshToken: "", raw };
5184
- return {
5185
- kind: "present",
5186
- accessToken: typeof oauth.accessToken === "string" ? oauth.accessToken : "",
5187
- refreshToken: typeof oauth.refreshToken === "string" ? oauth.refreshToken : "",
5188
- raw
5189
- };
5190
- }
5191
- function interpretCredentialsFile(text) {
5192
- if (text === null) return { exists: false, hasTokens: false, refreshToken: "" };
5193
- const parsed = parseJsonObject(text);
5194
- const oauth = parsed && typeof parsed.claudeAiOauth === "object" && parsed.claudeAiOauth ? parsed.claudeAiOauth : null;
5195
- const access = oauth && typeof oauth.accessToken === "string" ? oauth.accessToken : "";
5196
- const refresh = oauth && typeof oauth.refreshToken === "string" ? oauth.refreshToken : "";
5197
- return { exists: true, hasTokens: access.length > 0 && refresh.length > 0, refreshToken: refresh };
5198
- }
5199
- function tokenTail(token) {
5200
- return token ? createHash("sha256").update(token).digest("hex").slice(-6) : "";
5201
- }
5202
- const CREDENTIALS_REJECTED_DETAIL = "Credentials exist but Claude Code rejects them in the daemon context \u2014 the refresh token has most likely been rotated away by another store or another machine using the same credentials. Log in again with `claude` on this machine.";
5203
- function diagnoseStores(input) {
5204
- const { status, keychain, file } = input;
5205
- if (keychain.kind === "present") {
5206
- const empty = keychain.accessToken.length === 0 && keychain.refreshToken.length === 0;
5207
- if (empty && file.hasTokens && status === "not-logged-in") {
5208
- return {
5209
- diagnosis: "keychain-empty-item",
5210
- repairable: "delete-empty-keychain-item",
5211
- keychainRaw: keychain.raw,
5212
- detail: "The login keychain holds a Claude Code credentials item with empty tokens; Claude Code prefers it over the valid ~/.claude/.credentials.json and reports not logged in."
5213
- };
5214
- }
5215
- if (!empty && file.hasTokens && tokenTail(keychain.refreshToken) !== tokenTail(file.refreshToken)) {
5216
- return {
5217
- diagnosis: "store-divergence",
5218
- detail: "Keychain and ~/.claude/.credentials.json hold different refresh tokens; one of them will stop working at its next refresh. Treat the daemon-context login as canonical, or pin credentialStore=file."
5219
- };
5220
- }
5221
- return {};
5222
- }
5223
- if ((keychain.kind === "absent" || keychain.kind === "unreadable" || keychain.kind === "unsupported") && !file.hasTokens) {
5224
- return { diagnosis: "no-credentials", detail: "No Claude Code credentials found for this daemon context; log in with `claude` on this machine." };
5225
- }
5226
- if (keychain.kind === "unreadable" && file.hasTokens && status === "not-logged-in") {
5227
- return { diagnosis: "credentials-rejected", detail: CREDENTIALS_REJECTED_DETAIL };
5228
- }
5229
- if (keychain.kind === "error") {
5230
- return { detail: `keychain check failed: ${keychain.detail}` };
5231
- }
5232
- return {};
5233
- }
5234
- function securityReadArgs(identity) {
5235
- return ["find-generic-password", "-s", identity.service, "-a", identity.account, "-w"];
5236
- }
5237
- function securityDeleteArgs(identity) {
5238
- return ["delete-generic-password", "-s", identity.service, "-a", identity.account];
5239
- }
5240
- const HAPPY_DAEMON_LAUNCHD_LABEL = "com.mereith.happy-daemon";
5241
- function classifyLineage(input) {
5242
- if (input.platform !== "darwin") return "other";
5243
- const label = input.label ?? HAPPY_DAEMON_LAUNCHD_LABEL;
5244
- if (input.env.XPC_SERVICE_NAME !== label) return "other";
5245
- if (input.launchdJobPid !== null && input.ancestorPids.includes(input.launchdJobPid)) return "launchd";
5246
- return "inherited-env";
5247
- }
5248
- function parseLaunchctlPid(printOutput) {
5249
- const match = /^\s*pid\s*=\s*(\d+)/m.exec(printOutput);
5250
- return match ? Number(match[1]) : null;
5251
- }
5252
- function keychainOffShimDir(happyLibDir) {
5253
- return join(happyLibDir, "scripts", "shims", "keychain-off");
5254
- }
5255
- function withKeychainOffPath(path, shimDir) {
5256
- const parts = (path ?? "").split(delimiter).filter((p) => p && p !== shimDir);
5257
- return [shimDir, ...parts].join(delimiter);
5258
- }
5259
- function buildClaudeAuthState(input) {
5260
- const { classification, diagnosis } = input;
5261
- const detail = (diagnosis?.detail ?? classification.detail)?.slice(0, 200);
5262
- const state = {
5263
- probeVersion: CLAUDE_AUTH_PROBE_VERSION,
5264
- daemonPid: input.daemonPid,
5265
- status: classification.status,
5266
- context: { platform: input.platform, lineage: input.lineage, credentialStore: input.credentialStore },
5267
- checkedAt: input.now ?? Date.now()
5268
- };
5269
- if (classification.authMethod) state.authMethod = classification.authMethod;
5270
- if (classification.subscriptionType) state.subscriptionType = classification.subscriptionType;
5271
- const diag = diagnosis?.diagnosis ?? classification.diagnosis;
5272
- if (diag) state.diagnosis = diag;
5273
- if (detail) state.detail = detail;
5274
- if (diagnosis?.repairable) state.repairable = diagnosis.repairable;
5275
- return state;
5276
- }
5277
- function claudeAuthStateChanged(prev, next) {
5278
- if (!prev) return true;
5279
- const strip = ({ checkedAt: _c, ...rest }) => JSON.stringify(rest);
5280
- return strip(prev) !== strip(next);
5281
- }
5282
- function keychainIdentityFor(env) {
5283
- return keychainIdentity(env);
5284
- }
5285
-
5286
5125
  const CLAUDE_AUTH_PROBE_INTERVAL_MS = 10 * 60 * 1e3;
5287
5126
  const CLAUDE_AUTH_REFRESH_INTERVAL_MS = 30 * 60 * 1e3;
5288
5127
  const PROBE_TIMEOUT_MS = 8e3;
@@ -5293,6 +5132,7 @@ class ClaudeAuthService {
5293
5132
  this.opts = opts;
5294
5133
  this.env = opts.env ?? process.env;
5295
5134
  this.platform = opts.platform ?? process.platform;
5135
+ this.lineage = opts.lineage ?? null;
5296
5136
  }
5297
5137
  timer = null;
5298
5138
  signalTimer = null;
@@ -6356,6 +6196,10 @@ async function removeTeamWorktree(resource) {
6356
6196
  if (ownBranch) await git(repository, ["branch", "-D", branch]);
6357
6197
  }
6358
6198
 
6199
+ function refusalCode(error) {
6200
+ const code = axios.isAxiosError(error) ? error.response?.data?.error : void 0;
6201
+ return typeof code === "string" && /^[a-z_]{1,64}$/.test(code) ? ` (${code})` : "";
6202
+ }
6359
6203
  function persistedSpawnMatches(operationId) {
6360
6204
  return Object.entries(readPersistedSessions()).filter(([, entry]) => entry.metadata?.teamOperationId === operationId);
6361
6205
  }
@@ -6390,6 +6234,7 @@ function createTeamWorker(deps) {
6390
6234
  writeReceipt$1(home, receipt);
6391
6235
  }
6392
6236
  if (receipt.phase === "completed") return;
6237
+ let sessionStopped = false;
6393
6238
  try {
6394
6239
  if (op.type === "spawn") {
6395
6240
  if (ownerRetryPending(op, receipt) && (receipt.phase === "prepared" || receipt.phase === "spawning" && persistedSpawnMatches(op.id).length === 0)) {
@@ -6486,10 +6331,11 @@ function createTeamWorker(deps) {
6486
6331
  return;
6487
6332
  }
6488
6333
  const bot = team.bots.find((candidate) => candidate.id === op.botId);
6489
- if (!bot || bot.generation !== op.generation || bot.sessionId !== op.sessionId) throw new Error("Worker binding changed; preserve resources for reconciliation");
6334
+ if (!bot || op.sessionId && bot.transferredTo?.sessionId === op.sessionId) throw new Error("Worker binding changed; preserve resources for reconciliation");
6490
6335
  if (op.sessionId) {
6491
6336
  await deps.stopAndWait(op.sessionId);
6492
6337
  await archiveSession(op.sessionId);
6338
+ sessionStopped = true;
6493
6339
  }
6494
6340
  if (team.archivedAt !== void 0) {
6495
6341
  await complete(op, receipt);
@@ -6512,7 +6358,7 @@ function createTeamWorker(deps) {
6512
6358
  } catch {
6513
6359
  }
6514
6360
  }
6515
- await action(op.teamId, `failure-${op.id}-${receipt.phase}-${createHash("sha256").update(detail).digest("hex").slice(0, 12)}`, { type: "fail-operation", operationId: op.id, machineId: deps.machineId, claimId: receipt.claimId, error: detail.slice(0, 1e3), unknown }).catch(() => {
6361
+ await action(op.teamId, `failure-${op.id}-${receipt.phase}-${createHash("sha256").update(detail).digest("hex").slice(0, 12)}${sessionStopped ? "-stopped" : ""}`, { type: "fail-operation", operationId: op.id, machineId: deps.machineId, claimId: receipt.claimId, error: detail.slice(0, 1e3), unknown, ...sessionStopped ? { sessionStopped: true } : {} }).catch(() => {
6516
6362
  });
6517
6363
  deps.log(`Teams operation ${op.id} ${unknown ? "needs reconciliation" : "will retry"}`);
6518
6364
  }
@@ -6592,8 +6438,8 @@ Use the teams tools to inspect current task state before acting. This message is
6592
6438
  if (closed) break;
6593
6439
  try {
6594
6440
  await execute(op);
6595
- } catch {
6596
- deps.log(`Teams operation ${op.id} remains pending`);
6441
+ } catch (error) {
6442
+ deps.log(`Teams operation ${op.id} remains pending${refusalCode(error)}`);
6597
6443
  }
6598
6444
  }
6599
6445
  await flushEvents(data.teams ?? []);
@@ -6931,7 +6777,9 @@ function createAutomationRunner(deps) {
6931
6777
  function persist(receipt) {
6932
6778
  writeReceipt(home, receipt, now());
6933
6779
  }
6934
- async function finish(item, report2) {
6780
+ async function finish(item, input) {
6781
+ const { report: report2, clipped } = clipAutomationReport(input);
6782
+ if (clipped.length) deps.log(`Automation run ${item.runId} report clipped: ${clipped.map((c) => `${c.field} ${c.from}\u2192${c.to}`).join(", ")}`);
6935
6783
  try {
6936
6784
  await client.report(item.runId, report2);
6937
6785
  } catch (error) {
@@ -8368,7 +8216,7 @@ async function startDaemon() {
8368
8216
  }
8369
8217
  const model = sanitizeResumeModel(options?.model);
8370
8218
  if (model) args.push("--model", model);
8371
- const permissionMode = sanitizeSpawnPermissionMode(options?.permissionMode);
8219
+ const permissionMode = sanitizeSpawnPermissionMode(options?.permissionMode ?? (options?.keepPublishedPermissionMode ? publishedRelaunchPermissionMode(metadata) : void 0));
8372
8220
  if (permissionMode) args.push("--permission-mode", permissionMode);
8373
8221
  restartCounts.set(happySessionId, recordRestartAttempt(prior));
8374
8222
  const teamEnv = await teamRelaunchEnvFor(happySessionId, metadata);
@@ -8527,6 +8375,8 @@ async function startDaemon() {
8527
8375
  spawnSession,
8528
8376
  resumeSession,
8529
8377
  // B-501: `very-happy send --resume`
8378
+ restartSession,
8379
+ // B-794: `very-happy session provider`
8530
8380
  requestShutdown: () => requestShutdown("happy-cli"),
8531
8381
  onHappySessionWebhook,
8532
8382
  onSessionStateEvent,
@@ -8571,8 +8421,10 @@ async function startDaemon() {
8571
8421
  }
8572
8422
  });
8573
8423
  const daemonClaudeCredentials = resolveClaudeCredentialReadiness();
8574
- const daemonSupervisor = detectDaemonSupervisor(process.env);
8575
- logger.debug(`[DAEMON RUN] Supervisor: ${daemonSupervisor}`);
8424
+ const launchdJob = process.platform === "darwin" ? await probeLaunchdJob() : null;
8425
+ const daemonSupervisor = detectDaemonSupervisor(process.env, process.platform, launchdJob);
8426
+ const lineage = daemonLineage(daemonSupervisor, process.env, process.platform, launchdJob);
8427
+ logger.debug(`[DAEMON RUN] Supervisor: ${daemonSupervisor} (lineage ${lineage}${launchdJob ? `, launchd job pid ${launchdJob.jobPid ?? "-"}` : ""})`);
8576
8428
  let fileState = {
8577
8429
  pid: process.pid,
8578
8430
  httpPort: controlPort,
@@ -8655,7 +8507,8 @@ async function startDaemon() {
8655
8507
  await writeSettings({ ...settings, claudeCredentialStore: store });
8656
8508
  claudeCredentialStoreSetting = store;
8657
8509
  },
8658
- publish: (state) => apiMachine.setClaudeAuthState(state)
8510
+ publish: (state) => apiMachine.setClaudeAuthState(state),
8511
+ lineage
8659
8512
  });
8660
8513
  claudeAuthServiceRef = claudeAuthService;
8661
8514
  apiMachine.setClaudeAuthHandlers({
@@ -8832,8 +8685,8 @@ async function startDaemon() {
8832
8685
  await cleanupDaemonState();
8833
8686
  await releaseDaemonLock(daemonLockHandle);
8834
8687
  await stopCaffeinate();
8835
- if (daemonSupervisor === "systemd") {
8836
- logger.debug(`[DAEMON RUN] systemd-supervised: exiting ${HANDOVER_EXIT_CODE} for the unit to restart on the new bundle`);
8688
+ if (daemonSupervisor !== "none") {
8689
+ logger.debug(`[DAEMON RUN] ${daemonSupervisor}-supervised: exiting ${HANDOVER_EXIT_CODE} for the supervisor to restart on the new bundle`);
8837
8690
  process.exit(HANDOVER_EXIT_CODE);
8838
8691
  }
8839
8692
  try {