very-happy-cli 0.2.199 → 0.2.201

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 (217) hide show
  1. package/dist/{AcpBackend-Bo6bOamG.mjs → AcpBackend-BNinFMHZ.mjs} +3 -3
  2. package/dist/{AcpBackend-HhZ8nrIh.cjs → AcpBackend-CMFlng3C.cjs} +3 -3
  3. package/dist/{AcpSessionManager--7nDgA9S.cjs → AcpSessionManager-CPgoICjp.cjs} +2 -2
  4. package/dist/{AcpSessionManager-C-pkJKO2.mjs → AcpSessionManager-Dg6gKavf.mjs} +2 -2
  5. package/dist/{BasePermissionHandler-Ffp54Ntg.mjs → BasePermissionHandler-DwcfWUjr.mjs} +1 -1
  6. package/dist/{BasePermissionHandler-al7UXWRq.cjs → BasePermissionHandler-c-NaRa_E.cjs} +1 -1
  7. package/dist/{account-DCIz-iyL.cjs → account-D23SGj7p.cjs} +11 -11
  8. package/dist/{account-Bnk1yyGS.mjs → account-pzgzyIXW.mjs} +11 -11
  9. package/dist/{accountService-B59oKwa4.cjs → accountService-Cns8UYGI.cjs} +4 -4
  10. package/dist/{accountService-WPnOpkvs.mjs → accountService-DEpIq6CF.mjs} +4 -4
  11. package/dist/{acpSessionResume-CfogEHtT.cjs → acpSessionResume-DklOhwir.cjs} +1 -1
  12. package/dist/{acpSessionResume-BVroOlVN.mjs → acpSessionResume-urFpnGsk.mjs} +1 -1
  13. package/dist/{agentHome-Y3bMEtCp.cjs → agentHome-BTwMaYw1.cjs} +4 -4
  14. package/dist/{agentHome-CHTzSiu4.mjs → agentHome-DyrLqr8b.mjs} +4 -4
  15. package/dist/{api-DibgCucH.mjs → api-1CD4oRSW.mjs} +16 -10
  16. package/dist/{api-CgzfmyYS.cjs → api-KVVs-GkM.cjs} +16 -10
  17. package/dist/{apiMachine-DSI5mKlh.cjs → apiMachine-1sd5IVIB.cjs} +18 -18
  18. package/dist/{apiMachine-BUaFSi27.mjs → apiMachine-BDVE6MOn.mjs} +18 -18
  19. package/dist/{attachmentContent-D9wq3bok.mjs → attachmentContent-CeF54XeO.mjs} +2 -2
  20. package/dist/{attachmentContent-JWUS5uhH.cjs → attachmentContent-f3BbOKqz.cjs} +2 -2
  21. package/dist/{auth-DFMJQDNF.mjs → auth-CV2H-smf.mjs} +8 -8
  22. package/dist/{auth-B6H2wHTy.cjs → auth-CXCX-iJ-.cjs} +5 -5
  23. package/dist/{auth-BjWk9sHU.mjs → auth-WCd2S1zA.mjs} +5 -5
  24. package/dist/{auth-BXav16o0.cjs → auth-eielZ6Sc.cjs} +8 -8
  25. package/dist/{auto-CMO-VQYN.cjs → auto-49cRCADN.cjs} +17 -17
  26. package/dist/{auto-DOhQ2OU5.mjs → auto-BsCE_UHT.mjs} +17 -17
  27. package/dist/{bootstrap-CY7Db_VV.mjs → bootstrap-D_1MskAl.mjs} +2 -2
  28. package/dist/{bootstrap-Brd_jnA2.cjs → bootstrap-N1PY4ypX.cjs} +2 -2
  29. package/dist/{browser-BhncBLE4.cjs → browser-B0SEB6r3.cjs} +1 -1
  30. package/dist/{browser-BpwBEJDU.mjs → browser-DL3QIQLS.mjs} +1 -1
  31. package/dist/{claudeAccountEnv-z_ecsJAP.cjs → claudeAccountEnv-Btp39mfa.cjs} +1 -1
  32. package/dist/{claudeAccountEnv-CYwfvK1u.mjs → claudeAccountEnv-DowsOlDB.mjs} +1 -1
  33. package/dist/{claudeLocal-coKrsYmR.mjs → claudeLocal-DRMWkdCC.mjs} +5 -5
  34. package/dist/{claudeLocal-Co_DyW-D.cjs → claudeLocal-Ix69XJ1t.cjs} +5 -5
  35. package/dist/{claudeLocalLauncher-BFnLc0R-.mjs → claudeLocalLauncher-D4tU6R5n.mjs} +10 -10
  36. package/dist/{claudeLocalLauncher-CNDrO3b6.cjs → claudeLocalLauncher-rDojqNoa.cjs} +10 -10
  37. package/dist/{claudeSessionFork-BuDN5SkN.cjs → claudeSessionFork-C_X08LFh.cjs} +1 -1
  38. package/dist/{claudeSessionFork-dOOc9hpA.mjs → claudeSessionFork-H0ZVQALg.mjs} +1 -1
  39. package/dist/{client-B5uvkdLn.mjs → client-4YWjreN3.mjs} +2 -2
  40. package/dist/{client-DKPLBLvx.mjs → client-BgInTvr6.mjs} +2 -2
  41. package/dist/{client-KbhVRYjy.cjs → client-BoymtYLP.cjs} +2 -2
  42. package/dist/{client-Ng-oAhlX.mjs → client-CK-jvgM1.mjs} +4 -4
  43. package/dist/client-CMUlpYcy.mjs +114 -0
  44. package/dist/{client-CBbUzTcm.cjs → client-DGqnrSg4.cjs} +4 -4
  45. package/dist/client-DI8Rxsbw.cjs +120 -0
  46. package/dist/{client-BKyTA9Hf.cjs → client-P1VkI76z.cjs} +2 -2
  47. package/dist/codex/happyMcpStdioBridge.cjs +25 -16
  48. package/dist/codex/happyMcpStdioBridge.mjs +25 -16
  49. package/dist/{codexAccount-DeFAjaHW.mjs → codexAccount-CieIQLOX.mjs} +1 -1
  50. package/dist/{codexAccount-8Wv5enLR.cjs → codexAccount-D-OBY29W.cjs} +1 -1
  51. package/dist/{codexAppServerClient-6QmZ2Tn5.cjs → codexAppServerClient-BnMR-DRn.cjs} +3 -3
  52. package/dist/{codexAppServerClient-BAcU_XN8.mjs → codexAppServerClient-aDrsSyjS.mjs} +3 -3
  53. package/dist/{codexCommand-CCeaWZ-1.mjs → codexCommand-BCpJzf3q.mjs} +51 -46
  54. package/dist/{codexCommand-hJYa82Af.cjs → codexCommand-C3oEEpOa.cjs} +51 -46
  55. package/dist/{codexTermination-BX0sCNFy.mjs → codexTermination-B5haG5wJ.mjs} +1 -1
  56. package/dist/{codexTermination-DKjQcC3e.cjs → codexTermination-DXhw5Pzi.cjs} +1 -1
  57. package/dist/{config-171VOPLq.cjs → config-CdGiZZKy.cjs} +3 -3
  58. package/dist/{config-9iXYh_zS.mjs → config-D9wjo4oa.mjs} +3 -3
  59. package/dist/{configuration-D9k5yIzV.mjs → configuration-DhEqAYzz.mjs} +1 -1
  60. package/dist/{configuration-CAzuk0Xs.cjs → configuration-LWFmTxty.cjs} +1 -1
  61. package/dist/{connect-MlXU2FE3.cjs → connect-BZLD0aVm.cjs} +13 -13
  62. package/dist/{connect-BEhKtsEn.mjs → connect-CY_EMXQs.mjs} +13 -13
  63. package/dist/{context-CI9LnDu1.cjs → context-BbZ18lX0.cjs} +1 -1
  64. package/dist/{context-WVEuAdf2.mjs → context-UzqWaA7f.mjs} +1 -1
  65. package/dist/{controlClient-DhFAPGHz.mjs → controlClient-PaIiDxM6.mjs} +3 -3
  66. package/dist/{controlClient-Bb188cU0.cjs → controlClient-TVMpETsR.cjs} +3 -3
  67. package/dist/{createSessionMetadata-BIK0Xz31.mjs → createSessionMetadata-BWb81WZg.mjs} +3 -2
  68. package/dist/{createSessionMetadata-C2EQi_od.cjs → createSessionMetadata-hGZeo_nR.cjs} +3 -2
  69. package/dist/{daemonAccounts-DD5YBwku.mjs → daemonAccounts-D5shoCLt.mjs} +3 -3
  70. package/dist/{daemonAccounts-nLyHz8WB.cjs → daemonAccounts-ciidbU2h.cjs} +2 -2
  71. package/dist/{defaultPermissionMode-BA1fgIpW.cjs → defaultPermissionMode-Cs_Tv83b.cjs} +1 -1
  72. package/dist/{defaultPermissionMode-Dmw3lpdN.mjs → defaultPermissionMode-DgeiMMqy.mjs} +1 -1
  73. package/dist/{deterministicJson-DCzFgRiT.cjs → deterministicJson-BpDDS7c9.cjs} +121 -24
  74. package/dist/{deterministicJson-BJ7LY5-S.mjs → deterministicJson-Cg3z7uUX.mjs} +117 -20
  75. package/dist/{doctor-jAPeyoi6.mjs → doctor-BanQ3jQg.mjs} +7 -7
  76. package/dist/{doctor-CH_pTY3Q.cjs → doctor-DOzji0f7.cjs} +7 -7
  77. package/dist/{downloadTarget-BhMm1keb.mjs → downloadTarget-BCSXmPRE.mjs} +6 -6
  78. package/dist/{downloadTarget-CZS0BVu2.cjs → downloadTarget-BhIAhyEV.cjs} +6 -6
  79. package/dist/{ensureDaemonRunning-BjbC8PuJ.mjs → ensureDaemonRunning-BZGBE838.mjs} +5 -5
  80. package/dist/{ensureDaemonRunning-CTKaWMED.cjs → ensureDaemonRunning-DMOCzvQP.cjs} +5 -5
  81. package/dist/format-BxGkJUki.mjs +71 -0
  82. package/dist/format-CgiY6uup.cjs +75 -0
  83. package/dist/{handleResumeCommand-DbFTdwoc.mjs → handleResumeCommand-BRV-9h0o.mjs} +5 -5
  84. package/dist/{handleResumeCommand-DsaEUiax.cjs → handleResumeCommand-ChnR-12l.cjs} +5 -5
  85. package/dist/{index-BnT8yvlF.cjs → index-44o_qMvE.cjs} +72 -3
  86. package/dist/{index-DuoMPw0y.cjs → index-B7HlUXOX.cjs} +4 -4
  87. package/dist/{index-qVJYCmRA.cjs → index-BuOzDU17.cjs} +4 -4
  88. package/dist/{index-DcfbjaVL.mjs → index-C_Y9426m.mjs} +3 -3
  89. package/dist/{index-BQvPYTNM.mjs → index-CiRMvS73.mjs} +59 -4
  90. package/dist/{index-BEKb2cxz.mjs → index-D5abHQNL.mjs} +48 -43
  91. package/dist/{index-DL6ONx6v.cjs → index-DnEgpRo4.cjs} +3 -3
  92. package/dist/{index-DpQ9OLYi.mjs → index-Do1r62PF.mjs} +4 -4
  93. package/dist/{index-DdJRSpLB.cjs → index-DuOthh8V.cjs} +47 -42
  94. package/dist/{index-BAjoMeJi.mjs → index-HJFzeG0B.mjs} +4 -4
  95. package/dist/index.cjs +2 -2
  96. package/dist/index.mjs +2 -2
  97. package/dist/{install-CJcRTQVK.mjs → install-BurTXawL.mjs} +3 -3
  98. package/dist/{install-5nblS8vW.cjs → install-CUAUG3u4.cjs} +3 -3
  99. package/dist/issue-DpMsnOFm.mjs +229 -0
  100. package/dist/issue-feEUrjV0.cjs +237 -0
  101. package/dist/lib.cjs +12 -12
  102. package/dist/lib.d.cts +7 -0
  103. package/dist/lib.d.mts +7 -0
  104. package/dist/lib.mjs +12 -12
  105. package/dist/{localHappyAgentAuth-Bsk_VyUN.cjs → localHappyAgentAuth-DxlQgaer.cjs} +1 -1
  106. package/dist/{localHappyAgentAuth-CD896cy4.mjs → localHappyAgentAuth-kg2RFvOy.mjs} +1 -1
  107. package/dist/{logger-n9NOzHhK.mjs → logger-CFrzcRHD.mjs} +17 -3
  108. package/dist/{logger-LsJ3Cl5o.cjs → logger-Hyhy2boA.cjs} +17 -2
  109. package/dist/{machineMetadata-CUU2NSYl.cjs → machineMetadata-BLymhM03.cjs} +3 -3
  110. package/dist/{machineMetadata-Bc7FwngX.mjs → machineMetadata-DiStbYik.mjs} +3 -3
  111. package/dist/{main-CEu9zJ4x.cjs → main-7G17Noc3.cjs} +58 -48
  112. package/dist/{main-CzItRviV.mjs → main-D1rk-68I.mjs} +58 -48
  113. package/dist/{mcp-yK3ynz_E.mjs → mcp-C0DMPeTt.mjs} +18 -18
  114. package/dist/{mcp-CPW1yQdX.cjs → mcp-DUeAS-D6.cjs} +18 -18
  115. package/dist/{mirrorProtocol-5bgkr1Or.cjs → mirrorProtocol-YUoEuIYO.cjs} +3 -3
  116. package/dist/{mirrorProtocol-CoXxepvL.mjs → mirrorProtocol-dRyartIG.mjs} +3 -3
  117. package/dist/{package-D7V1BX2I.cjs → package-06cGlmeD.cjs} +7 -7
  118. package/dist/{package-CCF6FHr2.mjs → package-DxE8PttX.mjs} +7 -7
  119. package/dist/{panels-CF5n641F.mjs → panels-BUqmsRE0.mjs} +5 -5
  120. package/dist/{panels-9DdVhaxc.cjs → panels-D0GHfIJC.cjs} +5 -5
  121. package/dist/{peerTools-gR_3dwdA.mjs → peerTools-BiFpxXdf.mjs} +5 -5
  122. package/dist/{peerTools-Dv6bgHkW.cjs → peerTools-CTCyRdg2.cjs} +5 -5
  123. package/dist/{persistence-B5U9rC15.mjs → persistence-CF7oV1oH.mjs} +2 -2
  124. package/dist/{persistence-Dl3sBrCF.cjs → persistence-_W9tE-bW.cjs} +2 -2
  125. package/dist/{piRunnerArgs-DOV74xAt.mjs → piRunnerArgs-Cfc-F-FJ.mjs} +1 -1
  126. package/dist/{piRunnerArgs-rygeUdRz.cjs → piRunnerArgs-T2cAiaGW.cjs} +1 -1
  127. package/dist/{piRuntime-BvxCy9qQ.cjs → piRuntime-BzECTca4.cjs} +1 -1
  128. package/dist/{piRuntime-dtlRpOYa.mjs → piRuntime-CzYkZrYV.mjs} +1 -1
  129. package/dist/{piTerminal-Bx6c5Jyd.mjs → piTerminal-0tOAYsFm.mjs} +20 -20
  130. package/dist/{piTerminal-ClaMS-57.cjs → piTerminal-WF--dHaC.cjs} +20 -20
  131. package/dist/{pushNotifications-pHkbUkqT.mjs → pushNotifications-CxX10K6n.mjs} +3 -3
  132. package/dist/{pushNotifications-IZaTtVDG.cjs → pushNotifications-DdzTbrA3.cjs} +3 -3
  133. package/dist/{query-D_3rFFWe.mjs → query-Bkh7d52V.mjs} +1 -1
  134. package/dist/{query-BVqnfxlX.cjs → query-Cwx4pv91.cjs} +1 -1
  135. package/dist/{rateLimitWindows-DnLJ-gve.mjs → rateLimitWindows-DdUMUEoy.mjs} +1 -1
  136. package/dist/{rateLimitWindows-C7xi99Eb.cjs → rateLimitWindows-DjJjgjt4.cjs} +1 -1
  137. package/dist/{reconnectGate-CHI12y0Y.cjs → reconnectGate-DeDhtQJW.cjs} +1 -1
  138. package/dist/{reconnectGate-DPDXEkOX.mjs → reconnectGate-uTLj82tS.mjs} +1 -1
  139. package/dist/{registerCommonHandlers-BrTglZnC.mjs → registerCommonHandlers-BYrmi-A4.mjs} +2 -2
  140. package/dist/{registerCommonHandlers-CUCw-rad.cjs → registerCommonHandlers-BrEtSwNk.cjs} +2 -2
  141. package/dist/{registerKillSessionHandler-Bo697Mt0.cjs → registerKillSessionHandler-Bp3g11wW.cjs} +6 -6
  142. package/dist/{registerKillSessionHandler-BJSVT1iq.mjs → registerKillSessionHandler-Cuzq6ecP.mjs} +6 -6
  143. package/dist/{registerSideQuestionHandler-BFPCMrmC.mjs → registerSideQuestionHandler-BmEWWaZW.mjs} +4 -4
  144. package/dist/{registerSideQuestionHandler-HNpsU_20.cjs → registerSideQuestionHandler-ChIbHl_g.cjs} +4 -4
  145. package/dist/{remoteSessionClient-Blz-z9jM.mjs → remoteSessionClient-Dj2rV8Az.mjs} +5 -5
  146. package/dist/{remoteSessionClient-9NzkfL13.cjs → remoteSessionClient-DoxfnpnK.cjs} +5 -5
  147. package/dist/{reportProgressTool-CW9rSnwQ.cjs → reportProgressTool-DvZhaEiN.cjs} +113 -3
  148. package/dist/{reportProgressTool-B2-RFomn.mjs → reportProgressTool-qo0QIFNd.mjs} +111 -4
  149. package/dist/{run-9aB7U4BF.cjs → run-BqlWdDTL.cjs} +447 -50
  150. package/dist/{run-BXyfDvCk.mjs → run-mHeOSOEt.mjs} +447 -50
  151. package/dist/{runClaude-B4ohp5Dk.cjs → runClaude-MjIrNrxT.cjs} +28 -25
  152. package/dist/{runClaude-BKpWJdCX.mjs → runClaude-Z4BVFEdC.mjs} +28 -25
  153. package/dist/{runClaudeDeps-B0x5BCqC.mjs → runClaudeDeps-8RXtu0Zc.mjs} +49 -46
  154. package/dist/{runClaudeDeps-gqSYeQkl.cjs → runClaudeDeps-tPqwAl_m.cjs} +43 -40
  155. package/dist/{runGemini-BvV5k9b3.mjs → runGemini-DG3jIxWv.mjs} +36 -33
  156. package/dist/{runGemini-BMzDy7hY.cjs → runGemini-uc-fViXY.cjs} +36 -33
  157. package/dist/{runOpenClaw-UcIDMHm7.mjs → runOpenClaw-C4676Sdl.mjs} +18 -18
  158. package/dist/{runOpenClaw-3Cx3C2ww.cjs → runOpenClaw-DZtoCmSG.cjs} +18 -18
  159. package/dist/{sandbox-QJdxjmxr.cjs → sandbox-DS7uZ71y.cjs} +4 -4
  160. package/dist/{sandbox-BC-KbWe7.mjs → sandbox-r29ys6I4.mjs} +4 -4
  161. package/dist/selfCheck-BmT9ihpR.mjs +89 -0
  162. package/dist/{selfCheck-Be_M5coh.cjs → selfCheck-CSZ-wx1W.cjs} +40 -39
  163. package/dist/{send-x789D5ci.mjs → send-BGApHm-z.mjs} +8 -8
  164. package/dist/{send-DhWp8M8B.cjs → send-CrmLy9lW.cjs} +8 -8
  165. package/dist/{server-kPDtS-DX.cjs → server-CjwXsTKP.cjs} +6 -6
  166. package/dist/{server-D-aSnlWI.mjs → server-hutEAAn1.mjs} +4 -4
  167. package/dist/{sessionLock-JWBEd8g_.mjs → sessionLock-Dj9_lShU.mjs} +3 -3
  168. package/dist/{sessionLock-CuPN9xfW.cjs → sessionLock-unMOEniJ.cjs} +3 -3
  169. package/dist/sessionMetadata-B44cL4Xj.cjs +29 -0
  170. package/dist/sessionMetadata-C1eoAi89.mjs +25 -0
  171. package/dist/{sessionOps-VS1baPz_.mjs → sessionOps-BmhqmPPd.mjs} +4 -4
  172. package/dist/{sessionOps-CYNOycqT.cjs → sessionOps-SxZr9veq.cjs} +4 -4
  173. package/dist/{sessionProvider-iRLKuR9V.mjs → sessionProvider-CPlvR0nT.mjs} +10 -10
  174. package/dist/{sessionProvider-DksA6icp.cjs → sessionProvider-DLlqS4y6.cjs} +10 -10
  175. package/dist/{sessionScanner--X2Pzlra.cjs → sessionScanner-B7nZ1i40.cjs} +3 -3
  176. package/dist/{sessionScanner-CAxiFc_3.mjs → sessionScanner-DvVZpLHG.mjs} +3 -3
  177. package/dist/{sessions-Dca1UgiF.mjs → sessions-BIYm43CM.mjs} +10 -10
  178. package/dist/{sessions-BrnP53eO.cjs → sessions-CQQW7u6X.cjs} +10 -10
  179. package/dist/{setupOfflineReconnection-nguxOn4s.mjs → setupOfflineReconnection-BELrtMGG.mjs} +2 -2
  180. package/dist/{setupOfflineReconnection-Dwg6nHnP.cjs → setupOfflineReconnection-D7WJTAi_.cjs} +2 -2
  181. package/dist/{spawn-DDyMxQ7Z.cjs → spawn-CuWcPkkN.cjs} +14 -14
  182. package/dist/{spawn-BJMU9zbZ.mjs → spawn-DnPu7h2o.mjs} +14 -14
  183. package/dist/{spawnAgents-SeUX5gIq.mjs → spawnAgents-BclZYkov.mjs} +1 -1
  184. package/dist/{spawnAgents-B8GT4JQX.cjs → spawnAgents-DvbEDCIq.cjs} +1 -1
  185. package/dist/{spawnHappyCLI-Cvk2ZMYj.cjs → spawnHappyCLI-CI7Ax4mF.cjs} +1 -1
  186. package/dist/{spawnHappyCLI-DnT_QEdn.mjs → spawnHappyCLI-D6OcgFDR.mjs} +1 -1
  187. package/dist/{startFileWatcher-Djf0SdmK.mjs → startFileWatcher-BiWGhlGW.mjs} +1 -1
  188. package/dist/{startFileWatcher-DLfkP-IW.cjs → startFileWatcher-DBW14aP2.cjs} +1 -1
  189. package/dist/{startupSessionCreate-CxwJb5m9.cjs → startupSessionCreate-DFl54ozj.cjs} +3 -3
  190. package/dist/{startupSessionCreate-f1g6pp6E.mjs → startupSessionCreate-DbBpGQo9.mjs} +3 -3
  191. package/dist/{store-D41VdZcL.cjs → store-Cpb1LMNW.cjs} +1 -1
  192. package/dist/{store-DnaIrYLA.mjs → store-DWmjM4Ex.mjs} +1 -1
  193. package/dist/{streamRelay-BT9ew0Mk.cjs → streamRelay-4XiiNB3N.cjs} +1 -1
  194. package/dist/{streamRelay-DEBIU6Ak.mjs → streamRelay-DdGOsW8v.mjs} +1 -1
  195. package/dist/{sync-B-B5mc8Z.cjs → sync-C764ZzE6.cjs} +1 -1
  196. package/dist/{sync-Dfr1zgLx.mjs → sync-CcBrziWp.mjs} +1 -1
  197. package/dist/{systemPrompt-DAQq-bKB.mjs → systemPrompt-9i7bQypR.mjs} +2 -2
  198. package/dist/{systemPrompt-pxNDR5u8.cjs → systemPrompt-Xy3Dfj1l.cjs} +2 -2
  199. package/dist/{teams-BuXDbvzq.mjs → teams-BAWOVbdF.mjs} +7 -7
  200. package/dist/{teams-CBMB5SvT.cjs → teams-VlmzLDSs.cjs} +7 -7
  201. package/dist/{template-CB4gXtUX.cjs → template-3fV9bi0X.cjs} +1 -1
  202. package/dist/{template-DE9JMShn.mjs → template-CtRLg2PG.mjs} +1 -1
  203. package/dist/{time-DTaj0RVK.cjs → time-CDBZWYDb.cjs} +1 -1
  204. package/dist/{time-PqfO1O58.mjs → time-DJF2csbV.mjs} +1 -1
  205. package/dist/{titleGenerator-BP5gqicG.cjs → titleGenerator-BYP3fNFo.cjs} +3 -3
  206. package/dist/{titleGenerator-DVnEGxoB.mjs → titleGenerator-DR9evHBh.mjs} +2 -2
  207. package/dist/todo-BkFvwx_z.cjs +210 -0
  208. package/dist/{todo-DaJPxDVT.mjs → todo-DDDQdB-G.mjs} +103 -12
  209. package/dist/{tools-G3_fMSjb.cjs → tools-BjiRW_Rg.cjs} +1 -1
  210. package/dist/{tools-B4W8kWU8.mjs → tools-CDktvjWL.mjs} +1 -1
  211. package/dist/{uninstall-ByWgUWHg.mjs → uninstall-BcMGkwJ0.mjs} +3 -3
  212. package/dist/{uninstall-C0pua8G4.cjs → uninstall-D5INt3TC.cjs} +3 -3
  213. package/dist/{wrapperAccount-CsxMfnCK.cjs → wrapperAccount-nGGMJDBF.cjs} +2 -2
  214. package/dist/{wrapperAccount-BDeMsgbw.mjs → wrapperAccount-z8Swrd08.mjs} +2 -2
  215. package/package.json +7 -7
  216. package/dist/selfCheck-NWjxjpSx.mjs +0 -88
  217. package/dist/todo-BXsQ5-iD.cjs +0 -119
@@ -1,26 +1,27 @@
1
- import { i as isClaudeSessionId, h as extractCompleteLines, j as decideBackfill, k as parseTerminalHookPayload, m as decideMirrorBinding, M as MIRROR_BACKFILL_LINES_DEFAULT, n as mirrorLineKey, o as mirrorLocalId, q as initializeOwnedWorktree, f as summarizeSpawnSessionForLog, t as startAgentVersionChecks, W as WORKTREE_CAPABILITY_VERSION, u as currentWorktreeService } from './mirrorProtocol-CoXxepvL.mjs';
1
+ import { i as isClaudeSessionId, h as extractCompleteLines, j as decideBackfill, k as parseTerminalHookPayload, m as decideMirrorBinding, M as MIRROR_BACKFILL_LINES_DEFAULT, n as mirrorLineKey, o as mirrorLocalId, q as initializeOwnedWorktree, f as summarizeSpawnSessionForLog, t as startAgentVersionChecks, W as WORKTREE_CAPABILITY_VERSION, u as currentWorktreeService } from './mirrorProtocol-dRyartIG.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-DOV74xAt.mjs';
3
+ import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-Cfc-F-FJ.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
+ import { a as issueRelaunchEnv } from './sessionMetadata-C1eoAi89.mjs';
8
9
  import { readFileSync, openSync, fsyncSync, closeSync, renameSync, existsSync, readdirSync, statSync, unlinkSync, readSync, writeSync, ftruncateSync, utimesSync, realpathSync, promises, constants as constants$1, writeFileSync, mkdirSync, accessSync, rmdirSync } from 'node:fs';
9
10
  import { join, isAbsolute, resolve, dirname, sep, basename, relative } from 'node:path';
10
- import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-D9k5yIzV.mjs';
11
- import { T as TurnActivityTracker, A as ApiClient } from './api-DibgCucH.mjs';
12
- import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-SeUX5gIq.mjs';
13
- import { l as logger } from './logger-n9NOzHhK.mjs';
14
- import { p as pruneStaleCompileCaches } from './index-DcfbjaVL.mjs';
15
- import { a as authAndSetupMachineIfNeeded } from './auth-BjWk9sHU.mjs';
11
+ import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-DhEqAYzz.mjs';
12
+ import { T as TurnActivityTracker, A as ApiClient } from './api-1CD4oRSW.mjs';
13
+ import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-BclZYkov.mjs';
14
+ import { l as logger } from './logger-CFrzcRHD.mjs';
15
+ import { p as pruneStaleCompileCaches } from './index-C_Y9426m.mjs';
16
+ import { a as authAndSetupMachineIfNeeded } from './auth-WCd2S1zA.mjs';
16
17
  import { spawn, execSync } from 'child_process';
17
- import { p as packageJson } from './package-CCF6FHr2.mjs';
18
- import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-jAPeyoi6.mjs';
19
- import { s as spawnHappyCLI } from './spawnHappyCLI-DnT_QEdn.mjs';
20
- import { c as readPersistedSessions, r as readSettings, l as latchKeepAwake, s as reportSignature, t as decideDaemonHibernation, v as nextCheckDelay, x as persistSession, d as readDaemonState, y as acquireDaemonLock, a as resolveCheckMs, z as resolveIdleMs, A as deletePersistedSessions, B as writeDaemonState, C as writeSettings, D as settingIdleMs, u as updateSettings, E as rewriteCredentialsForRelay, g as readCredentials, F as releaseDaemonLock } from './persistence-B5U9rC15.mjs';
21
- import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, w as cleanupDaemonState } from './controlClient-DhFAPGHz.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, n as lineageOf, g as waitForSessionKey, d as archiveSession, h as analyzeLatestTurn, i as readSessionLog, j as TURN_WINDOW, p as userPromptText } from './sessionOps-VS1baPz_.mjs';
23
- import { Q as AgentProfilesStateSchema, ab as ServerMigrateNoticeSchema, ac as isHarnessInstallId, ad as agentProfileUnavailableReason, ae as MODEL_INTENT_CONFIG, j as AUTOMATION_SUMMARY_MAX_CHARS, af as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, ag as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, d as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, ah as AUTOMATION_CLAIM_MAX_RUNS, ai as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, aj as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, v as resolveLaunchAgentProfile, ak as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-BQvPYTNM.mjs';
18
+ import { p as packageJson } from './package-DxE8PttX.mjs';
19
+ import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-BanQ3jQg.mjs';
20
+ import { s as spawnHappyCLI } from './spawnHappyCLI-D6OcgFDR.mjs';
21
+ import { c as readPersistedSessions, r as readSettings, l as latchKeepAwake, s as reportSignature, t as decideDaemonHibernation, v as nextCheckDelay, x as persistSession, d as readDaemonState, y as acquireDaemonLock, a as resolveCheckMs, z as resolveIdleMs, A as deletePersistedSessions, B as writeDaemonState, C as writeSettings, D as settingIdleMs, u as updateSettings, E as rewriteCredentialsForRelay, g as readCredentials, F as releaseDaemonLock } from './persistence-CF7oV1oH.mjs';
22
+ import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, w as cleanupDaemonState } from './controlClient-PaIiDxM6.mjs';
23
+ import { e as sendUserMessage, f as readSessionMetadata, r as readSessionTranscript, l as listAccountSessions, a as listSessions, M as MAX_READ_LIMIT, s as sessionWebUrl, n as lineageOf, g as waitForSessionKey, d as archiveSession, h as analyzeLatestTurn, i as readSessionLog, j as TURN_WINDOW, p as userPromptText } from './sessionOps-BmhqmPPd.mjs';
24
+ import { a2 as AgentProfilesStateSchema, an as ServerMigrateNoticeSchema, ao as isHarnessInstallId, ap as agentProfileUnavailableReason, aq as MODEL_INTENT_CONFIG, q as AUTOMATION_SUMMARY_MAX_CHARS, ar as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, as as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, d as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, at as AUTOMATION_CLAIM_MAX_RUNS, au as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, av as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, D as resolveLaunchAgentProfile, aw as ISSUE_SENT_FROM, ax as ISSUE_DISPATCH_LOCAL_ID_PREFIX, f as ISSUE_ASSIGNABLE_AGENTS, ay as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-CiRMvS73.mjs';
24
25
  import fastify from 'fastify';
25
26
  import { z } from 'zod';
26
27
  import { validatorCompiler, serializerCompiler } from 'fastify-type-provider-zod';
@@ -28,68 +29,69 @@ import { d as decodeBase64, s as sameRelay, e as encodeBase64, h as decrypt } fr
28
29
  import { randomBytes, createHash, timingSafeEqual, randomUUID } from 'node:crypto';
29
30
  import { c as checkPreviewPath } from './previewPath-CXN4Vag0.mjs';
30
31
  import { a as BACKGROUND_TASKS_MAX, d as BACKGROUND_TASK_DESCRIPTION_MAX, e as BackgroundTaskTracker } from './backgroundTaskActivity-8PdPxrvy.mjs';
31
- import { b as sanitizeRateLimitReport } from './rateLimitWindows-DnLJ-gve.mjs';
32
- import { f as formatEditConflictNotice, b as SESSION_PEER_SENT_FROM, s as sendPeerMessage, l as listPeerSessions, C as CLI_PEER_SENDER_ID } from './peerTools-gR_3dwdA.mjs';
32
+ import { b as sanitizeRateLimitReport } from './rateLimitWindows-DdUMUEoy.mjs';
33
+ import { f as formatEditConflictNotice, b as SESSION_PEER_SENT_FROM, s as sendPeerMessage, l as listPeerSessions, C as CLI_PEER_SENDER_ID } from './peerTools-BiFpxXdf.mjs';
33
34
  import os$1, { hostname, homedir, tmpdir } from 'node:os';
34
- 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-Blz-z9jM.mjs';
35
- import { assistantHome, bootstrapAssistantHome } from './bootstrap-CY7Db_VV.mjs';
36
- import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-BAjoMeJi.mjs';
35
+ 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-Dj2rV8Az.mjs';
36
+ import { assistantHome, bootstrapAssistantHome } from './bootstrap-D_1MskAl.mjs';
37
+ import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-HJFzeG0B.mjs';
37
38
  import require$$0, { existsSync as existsSync$1, statSync as statSync$1, mkdtempSync, rmSync } from 'fs';
38
39
  import require$$1, { join as join$1 } from 'path';
39
40
  import { spawn as spawn$1, execFile, spawnSync } from 'node:child_process';
40
41
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
41
42
  import { d as daemonEndpointsMatch, r as resolveClaudeCredentialReadiness } from './doctorReadiness-C208SMN9.mjs';
42
- 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-Bc7FwngX.mjs';
43
+ 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-DiStbYik.mjs';
43
44
  import { M as ModelConfigError, B as BackupStore, r as readConfigFile, s as sha256, a as atomicWriteFile } from './fileStore-5qpetZS0.mjs';
44
45
  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';
45
- import { p as parse } from './codexAccount-DeFAjaHW.mjs';
46
+ import { p as parse } from './codexAccount-CieIQLOX.mjs';
46
47
  import require$$3 from 'crypto';
47
48
  import { c as commandOnPath } from './detectCLI-CSGMlV51.mjs';
48
- import { buildResumeLaunch } from './handleResumeCommand-DbFTdwoc.mjs';
49
+ import { buildResumeLaunch } from './handleResumeCommand-BRV-9h0o.mjs';
49
50
  import { n as normalizeWebPanels } from './webPanels-B2_C2-3g.mjs';
50
51
  import { access, symlink, readFile, rm, unlink, readlink, lstat, constants, rename, mkdir, copyFile, readdir, stat, open } from 'node:fs/promises';
51
52
  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';
52
- import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-DKPLBLvx.mjs';
53
- import { d as wrapperReportsIdle, f as decideAutoRestart, s as statusFromVerdict, g as autoRestartNextCheck, h as wrapperStaleness, r as recordAttempt, i as AUTO_RESTART_MAX_ATTEMPTS, j as AUTO_RESTART_MIN_GAP_MS, p as processIdentityFields, k as readSessionLock, l as AUTO_RESTARTED_ENV, n as encodeAutoRestarted, o as pendingUpgradeVersion, q as resolveQuietMs, u as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-JWBEd8g_.mjs';
54
- import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-B5uvkdLn.mjs';
53
+ import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-BgInTvr6.mjs';
54
+ import { d as wrapperReportsIdle, f as decideAutoRestart, s as statusFromVerdict, g as autoRestartNextCheck, h as wrapperStaleness, r as recordAttempt, i as AUTO_RESTART_MAX_ATTEMPTS, j as AUTO_RESTART_MIN_GAP_MS, p as processIdentityFields, k as readSessionLock, l as AUTO_RESTARTED_ENV, n as encodeAutoRestarted, o as pendingUpgradeVersion, q as resolveQuietMs, u as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-Dj9_lShU.mjs';
55
+ import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-4YWjreN3.mjs';
55
56
  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, o as probeSystemdKillMode, q as wrappersSurviveHandover, t as handoverWaitsForSessions } from './daemonSupervisor-BxohggqN.mjs';
56
- import { A as AccountService } from './accountService-WPnOpkvs.mjs';
57
- import { spawnSetupTokenPty, watchAccountFiles } from './daemonAccounts-DD5YBwku.mjs';
57
+ import { A as AccountService } from './accountService-DEpIq6CF.mjs';
58
+ import { spawnSetupTokenPty, watchAccountFiles } from './daemonAccounts-D5shoCLt.mjs';
58
59
  import { g as getProjectPath } from './path-D2wdaNSk.mjs';
59
60
  import { b as extractClaudeEditPaths } from './editPaths-BVfS_FFL.mjs';
60
- import { s as startFileWatcher } from './startFileWatcher-Djf0SdmK.mjs';
61
- import { I as InvalidateSync } from './sync-Dfr1zgLx.mjs';
61
+ import { s as startFileWatcher } from './startFileWatcher-BiWGhlGW.mjs';
62
+ import { I as InvalidateSync } from './sync-CcBrziWp.mjs';
62
63
  import { R as RawJSONLinesSchema } from './types-CkqAACXx.mjs';
63
64
  import { t as tmuxArgs, a as scrubTmuxClientEnv, s as shellescape } from './tmuxSocket-BmZyixRM.mjs';
64
65
  import { i as isProcessAlive, t as terminateProcessTree } from './processTermination-ChJG5SLW.mjs';
65
66
  import { findAllHappyProcesses } from './doctor-GN5mPOn5.mjs';
66
67
  import { T as TEAM_SKILL, a as TEAM_LEAD_PLAYBOOK, b as TEAM_MEMBER_RULES } from './resources-CLP_MpK4.mjs';
67
68
  import { promisify } from 'node:util';
68
- import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-DE9JMShn.mjs';
69
+ import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-CtRLg2PG.mjs';
70
+ import { I as IssuesUnsupportedError, a as IssueRequestError, c as createIssuesClient } from './client-CMUlpYcy.mjs';
69
71
  import { d as describeAgentHome } from './loginShellEnv-Dw8M7tkI.mjs';
70
- import { S as SPAWN_ACCOUNT_ENV } from './store-DnaIrYLA.mjs';
71
- import './acpSessionResume-BVroOlVN.mjs';
72
- import './pushNotifications-pHkbUkqT.mjs';
72
+ import { S as SPAWN_ACCOUNT_ENV } from './store-DWmjM4Ex.mjs';
73
+ import './acpSessionResume-urFpnGsk.mjs';
74
+ import './pushNotifications-CxX10K6n.mjs';
73
75
  import './contentLogMetadata-BlWI0egu.mjs';
74
- import './reconnectGate-DPDXEkOX.mjs';
76
+ import './reconnectGate-uTLj82tS.mjs';
75
77
  import 'node:events';
76
78
  import 'socket.io-client';
77
79
  import './limits-DIo7rEBR.mjs';
78
- import './time-PqfO1O58.mjs';
79
- import './registerCommonHandlers-BrTglZnC.mjs';
80
+ import './time-DJF2csbV.mjs';
81
+ import './registerCommonHandlers-BYrmi-A4.mjs';
80
82
  import 'util';
81
83
  import 'cross-spawn';
82
84
  import '@paralleldrive/cuid2';
83
85
  import 'chalk';
84
86
  import 'node:module';
85
87
  import 'tweetnacl';
86
- import './browser-BpwBEJDU.mjs';
88
+ import './browser-DL3QIQLS.mjs';
87
89
  import 'open';
88
90
  import './specialCommands-MXUN0wfI.mjs';
89
91
  import './ids-DU6sLx4C.mjs';
90
92
  import 'url';
91
- import './localHappyAgentAuth-CD896cy4.mjs';
92
- import './claudeAccountEnv-CYwfvK1u.mjs';
93
+ import './localHappyAgentAuth-kg2RFvOy.mjs';
94
+ import './claudeAccountEnv-DowsOlDB.mjs';
93
95
  import 'node:readline';
94
96
  import 'node-pty';
95
97
  import './processTreeSnapshot-fuwxC0fr.mjs';
@@ -7007,6 +7009,375 @@ ${action.prompt}`, { localId: `automation-${run.id}`, ...meta });
7007
7009
  };
7008
7010
  }
7009
7011
 
7012
+ const ID = /^[A-Za-z0-9_-]{1,128}$/;
7013
+ const ISSUE_RECEIPT_TTL_MS = 7 * 24 * 36e5;
7014
+ function dir(home) {
7015
+ return join(home, "issues", "receipts");
7016
+ }
7017
+ function readIssueReceipt(home, dispatchId) {
7018
+ if (!ID.test(dispatchId)) return null;
7019
+ try {
7020
+ return JSON.parse(readFileSync(join(dir(home), `${dispatchId}.json`), "utf8"));
7021
+ } catch {
7022
+ return null;
7023
+ }
7024
+ }
7025
+ function writeIssueReceipt(home, receipt) {
7026
+ if (!ID.test(receipt.dispatchId)) throw new Error("Invalid dispatch id");
7027
+ ensurePrivateDirectorySync(dir(home));
7028
+ writePrivateFileSync(join(dir(home), `${receipt.dispatchId}.json`), JSON.stringify({ ...receipt, updatedAt: Date.now() }));
7029
+ }
7030
+ function listIssueReceipts(home, now = Date.now()) {
7031
+ let files;
7032
+ try {
7033
+ files = readdirSync(dir(home));
7034
+ } catch {
7035
+ return [];
7036
+ }
7037
+ const out = [];
7038
+ for (const file of files) {
7039
+ if (!file.endsWith(".json")) continue;
7040
+ const path = join(dir(home), file);
7041
+ try {
7042
+ const receipt = JSON.parse(readFileSync(path, "utf8"));
7043
+ const at = typeof receipt.updatedAt === "number" ? receipt.updatedAt : statSync(path).mtimeMs;
7044
+ if (now - at > ISSUE_RECEIPT_TTL_MS) {
7045
+ unlinkSync(path);
7046
+ continue;
7047
+ }
7048
+ out.push(receipt);
7049
+ } catch {
7050
+ }
7051
+ }
7052
+ return out;
7053
+ }
7054
+
7055
+ const ISSUE_POLL_MS = 5e3;
7056
+ const ISSUE_SPAWNED_BY = "issue";
7057
+ const ISSUE_SPAWN_UNKNOWN_GRACE_MS = 6e4;
7058
+ const FIRST_MESSAGE_KEY_WAIT_MS = 1e4;
7059
+ function issueKeyFromPrompt(prompt) {
7060
+ return /^You are assigned issue ([A-Z]+-\d{1,9}):/.exec(prompt)?.[1] ?? null;
7061
+ }
7062
+ function issueSpawnAccount(spawn) {
7063
+ if (spawn.agentProfile === void 0) return void 0;
7064
+ return spawn.agentProfile === null ? null : spawn.agentProfile.id;
7065
+ }
7066
+ function issueAccountRefusal(resolve, agent, requested) {
7067
+ if (!resolve) return null;
7068
+ if (agent !== "claude" && agent !== "codex") return typeof requested === "string" ? `Account unavailable (agent-mismatch): accounts are not supported for ${agent} yet` : null;
7069
+ try {
7070
+ resolve(agent, requested);
7071
+ return null;
7072
+ } catch (error) {
7073
+ const message = error instanceof Error ? error.message : String(error);
7074
+ return accountUnavailableError(message, "issue");
7075
+ }
7076
+ }
7077
+ function issueExitEvent(exit) {
7078
+ if (!exit) return "exited";
7079
+ if (exit.signal) return ["SIGTERM", "SIGINT", "SIGHUP"].includes(exit.signal) ? "exited" : "crashed";
7080
+ return exit.code === 0 || exit.code === null || exit.code === 130 || exit.code === 143 ? "exited" : "crashed";
7081
+ }
7082
+ function persistedRunSessions(runId) {
7083
+ return Object.entries(readPersistedSessions()).filter(([, entry]) => entry.metadata?.issue?.runId === runId).map(([sessionId]) => sessionId);
7084
+ }
7085
+ function httpCode(error) {
7086
+ return error instanceof IssueRequestError ? error.code : null;
7087
+ }
7088
+ function createIssueWorker(deps) {
7089
+ const home = deps.home ?? configuration.happyHomeDir;
7090
+ const client = deps.client;
7091
+ const send = deps.send ?? (async (sessionId, text, options) => {
7092
+ const key = await waitForSessionKey(sessionId, FIRST_MESSAGE_KEY_WAIT_MS);
7093
+ await sendUserMessage(sessionId, key, text, "issue", options);
7094
+ });
7095
+ const capabilities = deps.capabilities ?? ((sessionId) => readPersistedSessions()[sessionId]?.metadata?.capabilities ?? null);
7096
+ let running = false;
7097
+ let closed = false;
7098
+ let retryAt = 0;
7099
+ const runBySession = /* @__PURE__ */ new Map();
7100
+ const lastEvent = /* @__PURE__ */ new Map();
7101
+ const events = [];
7102
+ for (const r of listIssueReceipts(home)) {
7103
+ if (r.kind === "spawn" && r.sessionId && !r.ended && (r.phase === "delivered" || r.phase === "completed")) runBySession.set(r.sessionId, r.runId);
7104
+ }
7105
+ const save = (receipt) => {
7106
+ writeIssueReceipt(home, receipt);
7107
+ return receipt;
7108
+ };
7109
+ const now = deps.now ?? Date.now;
7110
+ const unknownSpawns = /* @__PURE__ */ new Map();
7111
+ async function fail(receipt, error) {
7112
+ await client.fail(receipt.dispatchId, { machineId: deps.machineId, claimId: receipt.claimId, error: error.slice(0, 4e3) });
7113
+ save({ ...receipt, phase: "failed" });
7114
+ deps.log(`Issue dispatch ${receipt.dispatchId} failed`);
7115
+ }
7116
+ function holdUnknown(view, receipt, reason) {
7117
+ const held = unknownSpawns.get(view.id);
7118
+ unknownSpawns.set(view.id, { view, receipt, reason, deadline: held?.deadline ?? now() + ISSUE_SPAWN_UNKNOWN_GRACE_MS });
7119
+ deps.log(`Issue dispatch ${view.id} spawn outcome unknown; re-checking`);
7120
+ }
7121
+ async function recheckUnknown() {
7122
+ for (const [id, held] of [...unknownSpawns]) {
7123
+ if (closed) return;
7124
+ const matches = persistedRunSessions(held.view.runId);
7125
+ try {
7126
+ if (matches.length === 1) {
7127
+ unknownSpawns.delete(id);
7128
+ await afterSpawn(held.view, save({ ...held.receipt, sessionId: matches[0], phase: "spawned" }));
7129
+ } else if (matches.length > 1 || now() >= held.deadline) {
7130
+ unknownSpawns.delete(id);
7131
+ await fail(held.receipt, matches.length > 1 ? `Spawn produced ${matches.length} sessions for this run; stop the extra ones and retry` : `Session did not start within ${Math.round(ISSUE_SPAWN_UNKNOWN_GRACE_MS / 1e3)} s (${held.reason}); check the machine before retrying`);
7132
+ }
7133
+ } catch (error) {
7134
+ if (httpCode(error) === "issue_dispatch_claim_mismatch" || error instanceof IssuesUnsupportedError) unknownSpawns.delete(id);
7135
+ deps.log(`Issue dispatch ${id} remains pending${error instanceof IssueRequestError && error.code ? ` (${error.code})` : ""}`);
7136
+ }
7137
+ }
7138
+ }
7139
+ async function complete(receipt) {
7140
+ let lastError;
7141
+ for (let attempt = 0; attempt < 3; attempt++) {
7142
+ try {
7143
+ await client.complete(receipt.dispatchId, { machineId: deps.machineId, claimId: receipt.claimId, sessionId: receipt.sessionId });
7144
+ save({ ...receipt, phase: "completed" });
7145
+ return;
7146
+ } catch (error) {
7147
+ lastError = error;
7148
+ if (httpCode(error) === "issue_dispatch_claim_mismatch" || error instanceof IssuesUnsupportedError) break;
7149
+ await new Promise((resolve) => setTimeout(resolve, 500 * (attempt + 1)));
7150
+ }
7151
+ }
7152
+ throw lastError;
7153
+ }
7154
+ async function runSpawn(view, receipt) {
7155
+ const spawn = view.spawn;
7156
+ if (receipt.phase === "failed") {
7157
+ await fail(receipt, "This dispatch already failed on this machine");
7158
+ return;
7159
+ }
7160
+ if (!spawn) {
7161
+ await fail(receipt, "Dispatch has no spawn payload");
7162
+ return;
7163
+ }
7164
+ const agent = spawn.agent;
7165
+ if (receipt.phase === "claimed") {
7166
+ if (!ISSUE_ASSIGNABLE_AGENTS.includes(agent)) {
7167
+ await fail(receipt, `Agent "${agent}" cannot run issues on this machine`);
7168
+ return;
7169
+ }
7170
+ if (!isAbsolute(spawn.directory)) {
7171
+ await fail(receipt, `Directory must be absolute: ${spawn.directory}`);
7172
+ return;
7173
+ }
7174
+ const account = issueSpawnAccount(spawn);
7175
+ const refusal = issueAccountRefusal(deps.resolveAccount, agent, account);
7176
+ if (refusal) {
7177
+ await fail(receipt, refusal);
7178
+ return;
7179
+ }
7180
+ const mode = sanitizeSpawnPermissionMode(spawn.permissionMode ?? void 0);
7181
+ const permissionMode = resolveSpawnPermissionMode(agent, mode ?? void 0);
7182
+ const key = issueKeyFromPrompt(spawn.prompt);
7183
+ receipt = save({ ...receipt, phase: "spawning" });
7184
+ const spawned = await deps.spawn({
7185
+ directory: spawn.directory,
7186
+ agent,
7187
+ permissionMode,
7188
+ spawnedBy: ISSUE_SPAWNED_BY,
7189
+ environmentVariables: { VH_ISSUE_ID: view.issueId, VH_ISSUE_RUN_ID: view.runId, ...key ? { VH_ISSUE_KEY: key } : {} },
7190
+ ...account !== void 0 ? { agentProfileId: account } : {}
7191
+ });
7192
+ if (spawned.type === "error" && agentProfileUnavailableReason(spawned.errorMessage)) {
7193
+ await fail({ ...receipt, phase: "claimed" }, accountUnavailableError(spawned.errorMessage, "issue") ?? spawned.errorMessage);
7194
+ return;
7195
+ }
7196
+ if (spawned.type === "error" && (spawned.startupExit?.exited || spawned.notStarted)) {
7197
+ await fail(receipt, `Session failed to start: ${spawned.errorMessage}`);
7198
+ return;
7199
+ }
7200
+ if (spawned.type === "requestToApproveDirectoryCreation") {
7201
+ await fail(receipt, `Directory does not exist on this machine: ${spawn.directory}`);
7202
+ return;
7203
+ }
7204
+ if (spawned.type !== "success") {
7205
+ const matches = persistedRunSessions(view.runId);
7206
+ if (matches.length !== 1) {
7207
+ holdUnknown(view, receipt, spawned.errorMessage);
7208
+ return;
7209
+ }
7210
+ receipt = save({ ...receipt, sessionId: matches[0], phase: "spawned" });
7211
+ } else {
7212
+ receipt = save({ ...receipt, sessionId: spawned.sessionId, phase: "spawned" });
7213
+ }
7214
+ } else if (receipt.phase === "spawning") {
7215
+ const matches = persistedRunSessions(view.runId);
7216
+ if (matches.length !== 1) {
7217
+ holdUnknown(view, receipt, "the spawn was interrupted by a daemon restart");
7218
+ return;
7219
+ }
7220
+ receipt = save({ ...receipt, sessionId: matches[0], phase: "spawned" });
7221
+ } else {
7222
+ if (receipt.sessionId && !receipt.ended) runBySession.set(receipt.sessionId, view.runId);
7223
+ await deliverAndComplete(view, receipt);
7224
+ return;
7225
+ }
7226
+ await afterSpawn(view, receipt);
7227
+ }
7228
+ async function afterSpawn(view, receipt) {
7229
+ runBySession.set(receipt.sessionId, view.runId);
7230
+ const projectId = view.spawn?.projectId;
7231
+ if (projectId && deps.joinProject) await deps.joinProject(receipt.sessionId, projectId).catch(() => void 0);
7232
+ await deliverAndComplete(view, receipt);
7233
+ }
7234
+ async function deliverAndComplete(view, receipt) {
7235
+ const spawn = view.spawn;
7236
+ const agent = spawn.agent;
7237
+ if (receipt.phase === "spawned") {
7238
+ const sessionId = receipt.sessionId;
7239
+ const mode = sanitizeSpawnPermissionMode(spawn.permissionMode ?? void 0);
7240
+ const permissionMode = resolveSpawnPermissionMode(agent, mode ?? void 0);
7241
+ const meta = resolveFirstMessageMeta({ agent, permissionMode, explicitModel: spawn.model ?? void 0, capabilities: capabilities(sessionId) });
7242
+ try {
7243
+ await send(sessionId, spawn.prompt, { localId: `${ISSUE_DISPATCH_LOCAL_ID_PREFIX}${view.id}`, sentFrom: ISSUE_SENT_FROM, ...meta });
7244
+ } catch (error) {
7245
+ await fail(receipt, `First message failed: ${error instanceof Error ? error.message : String(error)}`);
7246
+ return;
7247
+ }
7248
+ receipt = save({ ...receipt, phase: "delivered" });
7249
+ }
7250
+ if (receipt.phase === "delivered" || receipt.phase === "completed") {
7251
+ await complete(receipt);
7252
+ lastEvent.set(receipt.sessionId, "running");
7253
+ }
7254
+ }
7255
+ async function runMessage(view, receipt) {
7256
+ const message = view.message;
7257
+ if (receipt.phase === "failed") {
7258
+ await fail(receipt, "Session is not running on this machine");
7259
+ return;
7260
+ }
7261
+ if (!message) {
7262
+ await fail(receipt, "Dispatch has no message payload");
7263
+ return;
7264
+ }
7265
+ if (receipt.phase === "claimed") {
7266
+ if (!deps.live(message.sessionId)) {
7267
+ await fail(receipt, "Session is not running on this machine");
7268
+ return;
7269
+ }
7270
+ try {
7271
+ await send(message.sessionId, message.text, { localId: `${ISSUE_DISPATCH_LOCAL_ID_PREFIX}${view.id}`, sentFrom: ISSUE_SENT_FROM });
7272
+ } catch (error) {
7273
+ await fail(receipt, `Message delivery failed: ${error instanceof Error ? error.message : String(error)}`);
7274
+ return;
7275
+ }
7276
+ receipt = save({ ...receipt, sessionId: message.sessionId, phase: "delivered" });
7277
+ }
7278
+ await complete({ ...receipt, sessionId: receipt.sessionId ?? message.sessionId });
7279
+ }
7280
+ async function execute(polled) {
7281
+ let claimed;
7282
+ try {
7283
+ claimed = (await client.claim(polled.id, deps.machineId)).dispatch;
7284
+ } catch (error) {
7285
+ const code = httpCode(error);
7286
+ if (code === "issue_dispatch_claim_mismatch" || code === "issue_run_not_current" || code === "issue_dispatch_not_found") return;
7287
+ throw error;
7288
+ }
7289
+ if (!claimed.claimId) throw new Error("Dispatch claim did not return a claim id");
7290
+ const prior = readIssueReceipt(home, claimed.id);
7291
+ const receipt = save(prior ? { ...prior, claimId: claimed.claimId } : { dispatchId: claimed.id, kind: claimed.kind === "message" ? "message" : "spawn", runId: claimed.runId, issueId: claimed.issueId, claimId: claimed.claimId, phase: "claimed", updatedAt: Date.now() });
7292
+ if (claimed.kind === "message") await runMessage(claimed, receipt);
7293
+ else if (claimed.kind === "spawn") await runSpawn(claimed, receipt);
7294
+ else await fail(receipt, `Unknown dispatch kind "${claimed.kind}"`);
7295
+ }
7296
+ let flushing = false;
7297
+ async function flushEvents() {
7298
+ if (flushing) return;
7299
+ flushing = true;
7300
+ try {
7301
+ await drainEvents();
7302
+ } finally {
7303
+ flushing = false;
7304
+ }
7305
+ }
7306
+ async function drainEvents() {
7307
+ while (events.length && !closed) {
7308
+ const next = events[0];
7309
+ try {
7310
+ await client.sessionEvent(next.runId, { machineId: deps.machineId, sessionId: next.sessionId, event: next.event });
7311
+ } catch (error) {
7312
+ const code = httpCode(error);
7313
+ if (!(error instanceof IssuesUnsupportedError) && code !== "issue_run_not_found" && !(error instanceof IssueRequestError && error.status < 500 && error.status !== 429)) return;
7314
+ }
7315
+ events.shift();
7316
+ if (next.event === "exited" || next.event === "crashed") {
7317
+ runBySession.delete(next.sessionId);
7318
+ lastEvent.delete(next.sessionId);
7319
+ for (const r of listIssueReceipts(home)) if (r.sessionId === next.sessionId && r.kind === "spawn") save({ ...r, ended: true });
7320
+ }
7321
+ }
7322
+ }
7323
+ async function tick() {
7324
+ if (running || closed || Date.now() < retryAt) return;
7325
+ running = true;
7326
+ try {
7327
+ await recheckUnknown();
7328
+ let dispatches;
7329
+ try {
7330
+ dispatches = (await client.poll(deps.machineId)).dispatches ?? [];
7331
+ } catch (error) {
7332
+ if (!(error instanceof IssuesUnsupportedError)) {
7333
+ retryAt = Date.now() + 3e4;
7334
+ deps.log(`Issue dispatch poll unavailable${error instanceof IssueRequestError ? ` (${error.status}${error.code ? ` ${error.code}` : ""})` : ""}`);
7335
+ }
7336
+ return;
7337
+ }
7338
+ for (const dispatch of dispatches) {
7339
+ if (closed) break;
7340
+ try {
7341
+ await execute(dispatch);
7342
+ } catch (error) {
7343
+ deps.log(`Issue dispatch ${dispatch.id} remains pending${error instanceof IssueRequestError && error.code ? ` (${error.code})` : ""}`);
7344
+ }
7345
+ }
7346
+ await flushEvents();
7347
+ } finally {
7348
+ running = false;
7349
+ }
7350
+ }
7351
+ let timer;
7352
+ if (deps.autoStart !== false) {
7353
+ timer = setInterval(() => {
7354
+ void tick();
7355
+ }, ISSUE_POLL_MS);
7356
+ timer.unref();
7357
+ void tick();
7358
+ }
7359
+ return {
7360
+ tick,
7361
+ hasSession: (sessionId) => runBySession.has(sessionId),
7362
+ /** Daemon hooks (turn start/end, wrapper exit) → run session event; deduplicated per session. */
7363
+ report(sessionId, event) {
7364
+ const runId = runBySession.get(sessionId);
7365
+ if (!runId || closed || lastEvent.get(sessionId) === event) return;
7366
+ lastEvent.set(sessionId, event);
7367
+ events.push({ sessionId, runId, event });
7368
+ if (events.length > 500) events.splice(0, events.length - 500);
7369
+ void flushEvents();
7370
+ },
7371
+ get busy() {
7372
+ return running;
7373
+ },
7374
+ stop: () => {
7375
+ closed = true;
7376
+ if (timer) clearInterval(timer);
7377
+ }
7378
+ };
7379
+ }
7380
+
7010
7381
  function daemonExitCode(source) {
7011
7382
  return source === "exception" ? 1 : 0;
7012
7383
  }
@@ -7162,6 +7533,7 @@ async function startDaemon() {
7162
7533
  logger.debug("[DAEMON RUN] Auth and machine setup complete");
7163
7534
  const pidToTrackedSession = /* @__PURE__ */ new Map();
7164
7535
  const turnActivity = new TurnActivityTracker();
7536
+ turnActivity.onEvent((sessionId, event) => issueWorker?.report(sessionId, event === "turn_started" ? "running" : "idle"));
7165
7537
  const backgroundTasks = new BackgroundTaskTracker();
7166
7538
  const peerCoordinator = createPeerCoordinator({ getChildren: () => Array.from(pidToTrackedSession.values()) });
7167
7539
  const hibernationAutomations = createAutomationsClient({ serverUrl: configuration.serverUrl, token: credentials.token, client: "daemon-hibernate" });
@@ -7197,6 +7569,7 @@ async function startDaemon() {
7197
7569
  let autoRestart;
7198
7570
  let bundleReplacedSeen = false;
7199
7571
  let automationRunner;
7572
+ let issueWorker;
7200
7573
  let projectPresence;
7201
7574
  const persisted = readPersistedSessions();
7202
7575
  const liveHappyProcesses = await findAllHappyProcesses();
@@ -7433,7 +7806,8 @@ async function startDaemon() {
7433
7806
  logger.debug(`[DAEMON RUN] Directory creation failed: ${errorMessage}`);
7434
7807
  return {
7435
7808
  type: "error",
7436
- errorMessage
7809
+ errorMessage,
7810
+ notStarted: true
7437
7811
  };
7438
7812
  }
7439
7813
  }
@@ -7492,11 +7866,11 @@ async function startDaemon() {
7492
7866
  const requested = forkSpawnAccount(options.agentProfileId, options.parentSessionId, (id) => accountServiceRef.sessionAccount(id));
7493
7867
  spawnAccountId = accountServiceRef.resolveSpawnAccount(accountAgent, requested);
7494
7868
  } catch (error) {
7495
- return { type: "error", errorMessage: error instanceof Error ? error.message : String(error) };
7869
+ return { type: "error", errorMessage: error instanceof Error ? error.message : String(error), notStarted: true };
7496
7870
  }
7497
7871
  if (spawnAccountId) extraEnv[SPAWN_ACCOUNT_ENV] = spawnAccountId;
7498
7872
  } else if (options.agentProfileId) {
7499
- return { type: "error", errorMessage: `agent-profile-unavailable:agent-mismatch: accounts are not supported for ${options.agent} yet` };
7873
+ return { type: "error", errorMessage: `agent-profile-unavailable:agent-mismatch: accounts are not supported for ${options.agent} yet`, notStarted: true };
7500
7874
  }
7501
7875
  const claudeAuthStatus = claudeAuthServiceRef?.current()?.status;
7502
7876
  if ((options.agent ?? "claude") === "claude" && claudeAuthStatus && !spawnAccountId) {
@@ -7523,7 +7897,8 @@ async function startDaemon() {
7523
7897
  logger.warn(`[DAEMON RUN] ${errorMessage}`);
7524
7898
  return {
7525
7899
  type: "error",
7526
- errorMessage
7900
+ errorMessage,
7901
+ notStarted: true
7527
7902
  };
7528
7903
  }
7529
7904
  let tmuxSessionName = extraEnv.TMUX_SESSION_NAME;
@@ -7544,7 +7919,8 @@ async function startDaemon() {
7544
7919
  if (!isSpawnAgent(agent)) {
7545
7920
  return {
7546
7921
  type: "error",
7547
- errorMessage: `Unsupported agent type: '${options.agent}'. Please update your CLI to the latest version.`
7922
+ errorMessage: `Unsupported agent type: '${options.agent}'. Please update your CLI to the latest version.`,
7923
+ notStarted: true
7548
7924
  };
7549
7925
  }
7550
7926
  const resumeId = agent === "claude" ? options.resumeClaudeSessionId : agent === "codex" ? options.resumeCodexThreadId : void 0;
@@ -7630,7 +8006,8 @@ async function startDaemon() {
7630
8006
  default:
7631
8007
  return {
7632
8008
  type: "error",
7633
- errorMessage: `Unsupported agent type: '${options.agent}'. Please update your CLI to the latest version.`
8009
+ errorMessage: `Unsupported agent type: '${options.agent}'. Please update your CLI to the latest version.`,
8010
+ notStarted: true
7634
8011
  };
7635
8012
  }
7636
8013
  const args = [
@@ -7700,7 +8077,8 @@ async function startDaemon() {
7700
8077
  logger.debug("[DAEMON RUN] Failed to spawn process - no PID returned");
7701
8078
  return Promise.resolve({
7702
8079
  type: "error",
7703
- errorMessage: "Failed to spawn Happy process - no PID returned"
8080
+ errorMessage: "Failed to spawn Happy process - no PID returned",
8081
+ notStarted: true
7704
8082
  });
7705
8083
  }
7706
8084
  timer?.mark("spawned");
@@ -7718,7 +8096,7 @@ async function startDaemon() {
7718
8096
  happyProcess.on("exit", (code, signal) => {
7719
8097
  logger.debug(`[DAEMON RUN] Child PID ${happyProcess.pid} exited with code ${code}, signal ${signal}`);
7720
8098
  if (happyProcess.pid) {
7721
- onChildExited(happyProcess.pid);
8099
+ onChildExited(happyProcess.pid, { code, signal });
7722
8100
  }
7723
8101
  });
7724
8102
  happyProcess.on("error", (error) => {
@@ -7926,7 +8304,9 @@ async function startDaemon() {
7926
8304
  HAPPY_RECONNECT_SEQ: String(tracked.encryption.seq),
7927
8305
  HAPPY_RECONNECT_METADATA_VERSION: String(tracked.encryption.metadataVersion),
7928
8306
  HAPPY_RECONNECT_AGENT_STATE_VERSION: String(tracked.encryption.agentStateVersion),
7929
- ...teamEnv
8307
+ ...teamEnv,
8308
+ // B-874c: an issue run's binding rides every relaunch (digest, MCP context).
8309
+ ...issueRelaunchEnv(metadata)
7930
8310
  }
7931
8311
  });
7932
8312
  if (result.type === "success") {
@@ -8068,6 +8448,8 @@ async function startDaemon() {
8068
8448
  HAPPY_RECONNECT_METADATA_VERSION: String(tracked.encryption.metadataVersion),
8069
8449
  HAPPY_RECONNECT_AGENT_STATE_VERSION: String(tracked.encryption.agentStateVersion),
8070
8450
  ...teamEnv,
8451
+ // B-874c: see resumeSessionImpl.
8452
+ ...issueRelaunchEnv(metadata),
8071
8453
  ...options?.auto ? { [AUTO_RESTARTED_ENV]: encodeAutoRestarted(options.auto.kind, options.auto.target) } : {}
8072
8454
  }
8073
8455
  });
@@ -8109,8 +8491,11 @@ async function startDaemon() {
8109
8491
  logger.debug(`[DAEMON RUN] Session ${sessionId} not found`);
8110
8492
  return false;
8111
8493
  };
8112
- const onChildExited = (pid) => {
8494
+ const onChildExited = (pid, exit) => {
8113
8495
  const session = pidToTrackedSession.get(pid);
8496
+ if (session?.happySessionId && !autoRestartExits.has(session.happySessionId) && issueWorker?.hasSession(session.happySessionId)) {
8497
+ issueWorker.report(session.happySessionId, daemonHibernation.pendingExit(session.happySessionId) ? "idle" : issueExitEvent(exit));
8498
+ }
8114
8499
  if (session?.happySessionId && !autoRestartExits.has(session.happySessionId) && (session.spawnedBy === "teams" || teamWorker?.hasSession(session.happySessionId))) teamWorker?.report(session.happySessionId, "exited");
8115
8500
  if (session?.happySessionId && automationRunner?.hasSession(session.happySessionId)) automationRunner.report(session.happySessionId, "exited");
8116
8501
  if (session?.happySessionId) turnActivity.forget(session.happySessionId);
@@ -8640,6 +9025,7 @@ async function startDaemon() {
8640
9025
  const sessionsHold = () => handoverWaitsForSessions({ bundleReplaced, relayMove: !!relayMove, sparesWrappers: handoverSparesWrappers }) && (turnActivity.hasActiveTurn() || backgroundTasks.hasAny());
8641
9026
  if ((bundleReplaced || relayMove) && !teamWorker?.busy && !automationRunner?.busy && !updateController.isRunning() && !harnessInstaller?.isRunning() && !sessionsHold()) {
8642
9027
  const preflight = bundleReplaced ? await preflightNewBundle(bundlePath) : { action: "proceed" };
9028
+ if (issueWorker?.busy) return;
8643
9029
  if (preflight.action === "hold") {
8644
9030
  if (lastHandoverHold !== preflight.reason) {
8645
9031
  lastHandoverHold = preflight.reason;
@@ -8653,6 +9039,7 @@ async function startDaemon() {
8653
9039
  logger.debug(relayMove ? `[DAEMON RUN] Relay moved to ${relayMove.serverUrl}; handing off to a new daemon on the new settings` : "[DAEMON RUN] Daemon bundle replaced on disk and verified, handing off to new daemon");
8654
9040
  teamWorker?.stop();
8655
9041
  automationRunner?.stop();
9042
+ issueWorker?.stop();
8656
9043
  projectPresence?.stop();
8657
9044
  clearInterval(restartOnStaleVersionAndHeartbeat);
8658
9045
  clearInterval(cliUpdateInterval);
@@ -8749,6 +9136,15 @@ async function startDaemon() {
8749
9136
  } : {},
8750
9137
  log: (message) => logger.debug(`[DAEMON RUN] ${message}`)
8751
9138
  });
9139
+ issueWorker = createIssueWorker({
9140
+ machineId,
9141
+ client: createIssuesClient({ token: async () => credentials.token }),
9142
+ spawn: spawnSession,
9143
+ live: (id) => [...pidToTrackedSession.values()].some((s) => s.happySessionId === id && isPidAlive(s.pid)),
9144
+ ...accountServiceRef ? { resolveAccount: (agent, requested) => accountServiceRef.resolveSpawnAccount(agent, requested) } : {},
9145
+ joinProject: (sessionId, projectId) => joinProject(projectsClient, sessionId, { kind: "explicit", projectId }, { via: "issue" }),
9146
+ log: (message) => logger.debug(`[DAEMON RUN] ${message}`)
9147
+ });
8752
9148
  projectPresence = createProjectPresenceReporter({
8753
9149
  machineId,
8754
9150
  client: projectsClient,
@@ -8782,6 +9178,7 @@ async function startDaemon() {
8782
9178
  const scrollbackFlush = apiMachine.flushTerminalScrollback();
8783
9179
  teamWorker?.stop();
8784
9180
  automationRunner?.stop({ killScripts: true });
9181
+ issueWorker?.stop();
8785
9182
  projectPresence?.stop();
8786
9183
  currentWorktreeService()?.stopAll();
8787
9184
  if (restartOnStaleVersionAndHeartbeat) {