very-happy-cli 0.2.192 → 0.2.193

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 (208) hide show
  1. package/dist/{AcpBackend-CGHTDJd9.mjs → AcpBackend-B4PwjqHt.mjs} +3 -3
  2. package/dist/{AcpBackend-BQO4ShOy.cjs → AcpBackend-DtJCgftG.cjs} +3 -3
  3. package/dist/{AcpSessionManager-G0xD6Jbq.mjs → AcpSessionManager-BzKWgkdP.mjs} +2 -2
  4. package/dist/{AcpSessionManager-LlUMmcpB.cjs → AcpSessionManager-D4qshX_H.cjs} +2 -2
  5. package/dist/{BasePermissionHandler-N6Ip3tFt.cjs → BasePermissionHandler-5iG-cvA2.cjs} +1 -1
  6. package/dist/{BasePermissionHandler-BmTIg376.mjs → BasePermissionHandler-DV6UM6e9.mjs} +1 -1
  7. package/dist/{account-CCVT-HO_.mjs → account-Dco_nGT4.mjs} +84 -27
  8. package/dist/{account-DtaouikP.cjs → account-DvpA60oU.cjs} +84 -27
  9. package/dist/{accountService-Dd9uqde2.mjs → accountService-Cd7bnkfd.mjs} +369 -19
  10. package/dist/{accountService-Bddy0zwL.cjs → accountService-CuUSJDhP.cjs} +369 -19
  11. package/dist/{acpSessionResume-BnHDk5eD.cjs → acpSessionResume-Bk9mjXZ9.cjs} +1 -1
  12. package/dist/{acpSessionResume-BWEUxNtC.mjs → acpSessionResume-TQwN9ZZE.mjs} +1 -1
  13. package/dist/{agentHome-B0VnjkZW.mjs → agentHome-Bep8semY.mjs} +4 -4
  14. package/dist/{agentHome-CqQ29YY7.cjs → agentHome-c2dlgcw1.cjs} +4 -4
  15. package/dist/{api-hMDsC6Wg.cjs → api-CBE_a88I.cjs} +10 -10
  16. package/dist/{api-_LeBScjg.mjs → api-DUfunY3x.mjs} +10 -10
  17. package/dist/{apiMachine-CqW2m6Zr.cjs → apiMachine-BqtG0IWm.cjs} +19 -18
  18. package/dist/{apiMachine-CgRldeJ6.mjs → apiMachine-CU_bw5nV.mjs} +19 -18
  19. package/dist/{attachmentContent-BEeT2J5n.cjs → attachmentContent-B3AzuYqk.cjs} +2 -2
  20. package/dist/{attachmentContent-CyptLIfq.mjs → attachmentContent-KNIZxwlu.mjs} +2 -2
  21. package/dist/{auth-CFQikywl.mjs → auth-CZ7pKS-j.mjs} +8 -8
  22. package/dist/{auth-C9NvNHhL.cjs → auth-DCjxpI6Z.cjs} +5 -5
  23. package/dist/{auth-CA1OClsW.cjs → auth-SJ_dPw7H.cjs} +8 -8
  24. package/dist/{auth-DL8_J9vu.mjs → auth-jN5dNqTO.mjs} +5 -5
  25. package/dist/{auto-uQOxlxLp.cjs → auto-B_59RYH1.cjs} +23 -21
  26. package/dist/{auto-CKI05w1D.mjs → auto-DC0Sq-qB.mjs} +23 -21
  27. package/dist/{bootstrap-DaZ0Np7X.mjs → bootstrap-B3gMpU9e.mjs} +2 -2
  28. package/dist/{bootstrap-DsZGc69k.cjs → bootstrap-CoJu9VnB.cjs} +2 -2
  29. package/dist/{browser-BUIaSHK2.mjs → browser-LHW2hBH8.mjs} +1 -1
  30. package/dist/{browser-Ft0ASDm7.cjs → browser-v1pdPP1E.cjs} +1 -1
  31. package/dist/{claudeAccountEnv-ON24i0qv.mjs → claudeAccountEnv-BL1pR_37.mjs} +2 -1
  32. package/dist/{claudeAccountEnv-BOBpJ3k8.cjs → claudeAccountEnv-CEX_EMZr.cjs} +2 -1
  33. package/dist/{claudeLocal-B1ZVtryl.mjs → claudeLocal-BZUgA5G2.mjs} +5 -5
  34. package/dist/{claudeLocal-BMf9t4Fa.cjs → claudeLocal-BrzM2RBI.cjs} +5 -5
  35. package/dist/{claudeLocalLauncher-Bp8bqF4y.mjs → claudeLocalLauncher-A0AQyHFi.mjs} +10 -10
  36. package/dist/{claudeLocalLauncher-C8TeJcfF.cjs → claudeLocalLauncher-XAMpXUM7.cjs} +10 -10
  37. package/dist/{claudeSessionFork-YiktY55n.cjs → claudeSessionFork-Mhn2fYe_.cjs} +1 -1
  38. package/dist/{claudeSessionFork-8AA47z8Y.mjs → claudeSessionFork-_GwIlmMB.mjs} +1 -1
  39. package/dist/{client-Cxlp_D4I.mjs → client-7RnI9J0W.mjs} +2 -2
  40. package/dist/{client-Bm4oKvW7.mjs → client-Bde4QVIn.mjs} +4 -2
  41. package/dist/{client-D8XROyZc.cjs → client-CJr8Pjwm.cjs} +4 -2
  42. package/dist/{client-Crh8_cNx.cjs → client-D2GWkd-T.cjs} +2 -2
  43. package/dist/{client-CFHZfh9x.cjs → client-DLlnmAPL.cjs} +4 -4
  44. package/dist/{client-BmPaBnDK.mjs → client-DwbhrX6D.mjs} +4 -4
  45. package/dist/codex/happyMcpStdioBridge.cjs +16 -16
  46. package/dist/codex/happyMcpStdioBridge.mjs +16 -16
  47. package/dist/codexAccount-BDQjRbtI.cjs +1028 -0
  48. package/dist/codexAccount-NOX5pmQf.mjs +1015 -0
  49. package/dist/{codexAppServerClient-BWJbLCQn.mjs → codexAppServerClient-B3QJV6Ey.mjs} +18 -7
  50. package/dist/{codexAppServerClient-q8GHQhyC.cjs → codexAppServerClient-DWEsZUC4.cjs} +18 -7
  51. package/dist/{codexCommand-BgpGg-Zy.cjs → codexCommand-Bg8AmxVm.cjs} +187 -57
  52. package/dist/{codexCommand-BfXfRQr4.mjs → codexCommand-D1xlj4sT.mjs} +188 -58
  53. package/dist/{codexTermination-CVUF0X75.cjs → codexTermination-ByX9GcEJ.cjs} +1 -1
  54. package/dist/{codexTermination-s9fd1gkA.mjs → codexTermination-CaWAVQjZ.mjs} +1 -1
  55. package/dist/{config-BAjyTyYp.cjs → config-B2GGbiTv.cjs} +3 -3
  56. package/dist/{config-BF8XgLyc.mjs → config-C2XYEwXz.mjs} +3 -3
  57. package/dist/{configuration-CXEVKAyF.cjs → configuration-BBK0rmmj.cjs} +1 -1
  58. package/dist/{configuration-IhRiLDVe.mjs → configuration-ThKBP_zY.mjs} +1 -1
  59. package/dist/{connect-LZh1gr08.mjs → connect-BirnCl9q.mjs} +13 -13
  60. package/dist/{connect-rCS56arw.cjs → connect-C3tZs_NC.cjs} +13 -13
  61. package/dist/{context-DO6F5YwH.mjs → context-C0EFLnOg.mjs} +1 -1
  62. package/dist/{context-3_S_mWz9.cjs → context-wDp0aZBK.cjs} +1 -1
  63. package/dist/{controlClient-8ILulwjc.mjs → controlClient-Ckl8N1MS.mjs} +3 -3
  64. package/dist/{controlClient-j7p5p3_7.cjs → controlClient-DwWTns3A.cjs} +3 -3
  65. package/dist/{createSessionMetadata-DwdD_uVo.cjs → createSessionMetadata-DqZ6h02H.cjs} +2 -2
  66. package/dist/{createSessionMetadata-oyaTZm1b.mjs → createSessionMetadata-vug4Cv8z.mjs} +2 -2
  67. package/dist/{daemonAccounts-BCjDgoNt.cjs → daemonAccounts-CpGDY_4k.cjs} +4 -1
  68. package/dist/{daemonAccounts-BJgt6IJe.mjs → daemonAccounts-DwPwKxvv.mjs} +5 -2
  69. package/dist/{defaultPermissionMode-BFShzF55.cjs → defaultPermissionMode-BakXiqRr.cjs} +1 -1
  70. package/dist/{defaultPermissionMode-Lt3PUCwY.mjs → defaultPermissionMode-DF5AfeBb.mjs} +1 -1
  71. package/dist/{deterministicJson-Dfp-7wUZ.mjs → deterministicJson-BzX94gi3.mjs} +13 -13
  72. package/dist/{deterministicJson-DUN0v3St.cjs → deterministicJson-t33SsuRC.cjs} +13 -13
  73. package/dist/{doctor-FgUYTbAT.cjs → doctor-B9ug1LZb.cjs} +7 -7
  74. package/dist/{doctor-B_UwMcVT.mjs → doctor-C1zyOSXw.mjs} +7 -7
  75. package/dist/{downloadTarget-C0d6jRx-.mjs → downloadTarget-Baslc6jW.mjs} +6 -6
  76. package/dist/{downloadTarget-BrrQEDxg.cjs → downloadTarget-T1id2Gh6.cjs} +6 -6
  77. package/dist/{ensureDaemonRunning-KUMFfIil.mjs → ensureDaemonRunning-C6ERYK-O.mjs} +5 -5
  78. package/dist/{ensureDaemonRunning-Cq4FYI5Q.cjs → ensureDaemonRunning-CoAg11Zi.cjs} +5 -5
  79. package/dist/{handleResumeCommand-BGhVo3QH.mjs → handleResumeCommand-CrlqDuz7.mjs} +5 -5
  80. package/dist/{handleResumeCommand-Cl9GIL5F.cjs → handleResumeCommand-DPi-sPm7.cjs} +5 -5
  81. package/dist/{index-CZaLMmPC.cjs → index-B1swQJUS.cjs} +4 -4
  82. package/dist/{index-CQ_hLLCj.cjs → index-B2dJA8VG.cjs} +3 -3
  83. package/dist/{index-BzAYnYct.cjs → index-BUFrKZeQ.cjs} +198 -108
  84. package/dist/{index-JQDyJ3Li.mjs → index-BbdV2mzy.mjs} +3 -3
  85. package/dist/{index-BjXjMhGY.mjs → index-BcSPg3c5.mjs} +4 -4
  86. package/dist/{index-D8ODb0_U.cjs → index-Bkslzin5.cjs} +42 -42
  87. package/dist/{index-v5EmjT8l.mjs → index-Cn73rdtQ.mjs} +4 -4
  88. package/dist/{index-DYD3GM1m.mjs → index-D1YnIih6.mjs} +195 -109
  89. package/dist/{index-Ca1Tt96A.mjs → index-fZO4nF6e.mjs} +43 -43
  90. package/dist/{index-CRipkiqo.cjs → index-rocrvOYG.cjs} +4 -4
  91. package/dist/index.cjs +2 -2
  92. package/dist/index.mjs +2 -2
  93. package/dist/{install-ClUA9tbC.cjs → install-CArXjPfW.cjs} +3 -3
  94. package/dist/{install-D6EHRtAN.mjs → install-CChhyV2G.mjs} +3 -3
  95. package/dist/lib.cjs +12 -12
  96. package/dist/lib.d.cts +97 -25
  97. package/dist/lib.d.mts +97 -25
  98. package/dist/lib.mjs +12 -12
  99. package/dist/{lidState-CZOXXdzv.mjs → lidState-B6yYKjNK.mjs} +1 -1
  100. package/dist/{lidState-DqoN7zH4.cjs → lidState-B_v6qgfE.cjs} +1 -1
  101. package/dist/{localHappyAgentAuth-YHxDZ4x4.mjs → localHappyAgentAuth-KRlg_aI0.mjs} +1 -1
  102. package/dist/{localHappyAgentAuth-BnGCpHRX.cjs → localHappyAgentAuth-jJH0n67S.cjs} +1 -1
  103. package/dist/{logger-8su64lqR.cjs → logger-CX3x2eI4.cjs} +2 -2
  104. package/dist/{logger-Fd_rNvgd.mjs → logger-JV7-4Q_6.mjs} +2 -2
  105. package/dist/{machineMetadata-1HIIC7Bc.mjs → machineMetadata-D5-SW9kv.mjs} +3 -3
  106. package/dist/{machineMetadata-DYXt3p6u.cjs → machineMetadata-DhZuM0iB.cjs} +3 -3
  107. package/dist/{main-C_GrcYkn.cjs → main-1x1HGQEy.cjs} +47 -47
  108. package/dist/{main-BI6GIzUL.mjs → main-CFOdXbPD.mjs} +47 -47
  109. package/dist/{mcp-BycIv9oQ.cjs → mcp-BnKBSEh7.cjs} +18 -18
  110. package/dist/{mcp-XGoxywno.mjs → mcp-R6lMcFLO.mjs} +18 -18
  111. package/dist/{mirrorProtocol-DXT3rv7T.mjs → mirrorProtocol-CD4ntuZJ.mjs} +3 -3
  112. package/dist/{mirrorProtocol-DVnB8EO8.cjs → mirrorProtocol-DO-KtvAL.cjs} +3 -3
  113. package/dist/{package-6KkRAops.mjs → package-Bw3H6VLn.mjs} +7 -7
  114. package/dist/{package-iuLlSiSF.cjs → package-uzlvxa5S.cjs} +7 -7
  115. package/dist/{panels-B5Di2zb2.mjs → panels-BamhZCoZ.mjs} +5 -5
  116. package/dist/{panels-0C89q0Tu.cjs → panels-C46FxjmH.cjs} +5 -5
  117. package/dist/{peerTools-CANTX_mG.cjs → peerTools-D-VNNFw-.cjs} +5 -5
  118. package/dist/{peerTools-CKJ-IDM4.mjs → peerTools-WtRgTSqG.mjs} +5 -5
  119. package/dist/{persistence-DWcHe035.mjs → persistence-Cg4sfjQV.mjs} +2 -2
  120. package/dist/{persistence-B4ttN-fR.cjs → persistence-CsmAgN-C.cjs} +2 -2
  121. package/dist/{piRunnerArgs-Bl5GpBoN.mjs → piRunnerArgs-BbaAQvb4.mjs} +1 -1
  122. package/dist/{piRunnerArgs-BOkfxyak.cjs → piRunnerArgs-vnFygygF.cjs} +1 -1
  123. package/dist/{piRuntime-BhwxzdQf.mjs → piRuntime-Bid7TBf5.mjs} +1 -1
  124. package/dist/{piRuntime-DzrIiZU8.cjs → piRuntime-C2uj5Ucx.cjs} +1 -1
  125. package/dist/{piTerminal-BdS7ol7v.cjs → piTerminal-Ckpjfoqa.cjs} +20 -20
  126. package/dist/{piTerminal-DnA2CbGr.mjs → piTerminal-CqxgrI13.mjs} +20 -20
  127. package/dist/{pushNotifications-BqFoLye2.cjs → pushNotifications-BCg7YAiu.cjs} +3 -3
  128. package/dist/{pushNotifications-DkQ0yvFs.mjs → pushNotifications-BbE-qV9I.mjs} +3 -3
  129. package/dist/{query-BRJYSkb1.mjs → query-Bfr9O_62.mjs} +1 -1
  130. package/dist/{query-BQ4br3yn.cjs → query-vQ-HG394.cjs} +1 -1
  131. package/dist/{rateLimitReporter-DK5SQuCc.cjs → rateLimitReporter-BZ8x0-6-.cjs} +3 -3
  132. package/dist/{rateLimitReporter-BRbYkmuP.mjs → rateLimitReporter-CAz7VMw4.mjs} +3 -3
  133. package/dist/{rateLimitWindows-DBfiuYeg.cjs → rateLimitWindows-BZl6GMwQ.cjs} +1 -1
  134. package/dist/{rateLimitWindows-Da5AR-4u.mjs → rateLimitWindows-CRARnKaI.mjs} +1 -1
  135. package/dist/{registerCommonHandlers-m6pxxf2J.cjs → registerCommonHandlers-CZGmrPbT.cjs} +2 -2
  136. package/dist/{registerCommonHandlers-yQ7Ru-l0.mjs → registerCommonHandlers-Cj3Nl9y-.mjs} +2 -2
  137. package/dist/{registerKillSessionHandler-BDNpi7YO.mjs → registerKillSessionHandler-Bg9t45Ub.mjs} +6 -6
  138. package/dist/{registerKillSessionHandler-BAOIa_Fs.cjs → registerKillSessionHandler-C3EDnW4F.cjs} +6 -6
  139. package/dist/{remoteSessionClient-CZ7aaNgj.mjs → remoteSessionClient--0vfA7I5.mjs} +5 -5
  140. package/dist/{remoteSessionClient-iJMXRN_D.cjs → remoteSessionClient-CcSP24Zq.cjs} +5 -5
  141. package/dist/{reportProgressTool-DfQhPu0s.mjs → reportProgressTool-DVru7jc_.mjs} +3 -3
  142. package/dist/{reportProgressTool-DpFs7pSe.cjs → reportProgressTool-Ddg1yVq2.cjs} +3 -3
  143. package/dist/{run-p-xp1_HY.cjs → run-BTrIT_jU.cjs} +178 -847
  144. package/dist/{run-CwN28mcj.mjs → run-HtvH6BLi.mjs} +176 -845
  145. package/dist/{runClaude-DRKtAGTm.mjs → runClaude-DsHTk5Bu.mjs} +25 -25
  146. package/dist/{runClaude-D6U1Z575.cjs → runClaude-ipjwAHPI.cjs} +25 -25
  147. package/dist/{runClaudeDeps-Dkofokgb.cjs → runClaudeDeps-BKpwL6ln.cjs} +41 -41
  148. package/dist/{runClaudeDeps-BheVcIlD.mjs → runClaudeDeps-BV3vpeyY.mjs} +46 -46
  149. package/dist/{runGemini-C8q3YCc0.cjs → runGemini-B-G0_7Ab.cjs} +33 -33
  150. package/dist/{runGemini-owbvhFbi.mjs → runGemini-DhjK6_Fp.mjs} +33 -33
  151. package/dist/{runOpenClaw-Dky3-mjO.mjs → runOpenClaw-B6lawk8n.mjs} +18 -18
  152. package/dist/{runOpenClaw-DGeN66-t.cjs → runOpenClaw-BHIo8tkn.cjs} +18 -18
  153. package/dist/{sandbox-D2CPyoCA.cjs → sandbox-BAsO0ILe.cjs} +4 -4
  154. package/dist/{sandbox-sq_wy9Gl.mjs → sandbox-CKb7pCXg.mjs} +4 -4
  155. package/dist/selfCheck-CZ-t1Xzq.mjs +88 -0
  156. package/dist/{selfCheck-BgLvQKSt.cjs → selfCheck-D4VvVZNi.cjs} +39 -39
  157. package/dist/{send-Cd10YhXh.cjs → send-Cz5m39QR.cjs} +8 -8
  158. package/dist/{send-K9vg-8t-.mjs → send-D8ipLKMY.mjs} +8 -8
  159. package/dist/{server-De4W1zuK.mjs → server-CjvgT3N9.mjs} +4 -4
  160. package/dist/{server-DRrV64r0.cjs → server-CySyJKPH.cjs} +6 -6
  161. package/dist/{sessionLock-Dl6i7IgA.mjs → sessionLock-B73fhgQN.mjs} +3 -3
  162. package/dist/{sessionLock-BDtSzzKS.cjs → sessionLock-DdDCuNUs.cjs} +3 -3
  163. package/dist/{sessionOps-gU88-W9F.mjs → sessionOps-C65Iej_C.mjs} +50 -8
  164. package/dist/{sessionOps-DvnEH4PL.cjs → sessionOps-XSEjIqNq.cjs} +50 -8
  165. package/dist/{sessionProvider-CKcIo7KO.mjs → sessionProvider-CLVNkfji.mjs} +11 -9
  166. package/dist/{sessionProvider-CbSZeZrl.cjs → sessionProvider-Dgsty8z_.cjs} +11 -9
  167. package/dist/{sessionScanner-7RtcCeyD.cjs → sessionScanner-D8IVXMMH.cjs} +3 -3
  168. package/dist/{sessionScanner-DR32uSby.mjs → sessionScanner-MW1P9Pm9.mjs} +3 -3
  169. package/dist/{sessions-BvuMjgvJ.cjs → sessions-BKz7gZqg.cjs} +10 -10
  170. package/dist/{sessions-DTt2Eguk.mjs → sessions-Dtk_agUL.mjs} +10 -10
  171. package/dist/{setupOfflineReconnection-BGnvhRfb.mjs → setupOfflineReconnection-Bvdy-2xd.mjs} +2 -2
  172. package/dist/{setupOfflineReconnection-DduOsw6p.cjs → setupOfflineReconnection-DxMiW7OV.cjs} +2 -2
  173. package/dist/{spawn-DMB6rRPA.cjs → spawn-DiPkJcrQ.cjs} +26 -16
  174. package/dist/{spawn-CL3cUc7b.mjs → spawn-Dm4xsZBX.mjs} +26 -16
  175. package/dist/{spawnAgents-CClb7buD.cjs → spawnAgents-B9olJ8xn.cjs} +1 -1
  176. package/dist/{spawnAgents-CRMfOJhh.mjs → spawnAgents-I29H9nO8.mjs} +1 -1
  177. package/dist/{spawnHappyCLI-DJdhX_Qx.cjs → spawnHappyCLI-BYGOUda1.cjs} +1 -1
  178. package/dist/{spawnHappyCLI-Cj_6IICe.mjs → spawnHappyCLI-CnMwzjWX.mjs} +1 -1
  179. package/dist/{startFileWatcher-LnOmVW6H.cjs → startFileWatcher-D14W6gn-.cjs} +1 -1
  180. package/dist/{startFileWatcher-DikVa8kg.mjs → startFileWatcher-DePAY1T5.mjs} +1 -1
  181. package/dist/{startupSessionCreate-CDdaLaMq.mjs → startupSessionCreate-DoK0IvJG.mjs} +3 -3
  182. package/dist/{startupSessionCreate-B3ND-917.cjs → startupSessionCreate-rBHd4tc1.cjs} +3 -3
  183. package/dist/{store-DV__wCvP.cjs → store-CkNa6oj4.cjs} +46 -9
  184. package/dist/{store--XN-7MS0.mjs → store-Vej_738f.mjs} +46 -10
  185. package/dist/{streamRelay-DFdOaLOn.cjs → streamRelay-C0G1HOOd.cjs} +1 -1
  186. package/dist/{streamRelay-sABnxEXq.mjs → streamRelay-C5U-C4GS.mjs} +1 -1
  187. package/dist/{sync-JoEZKRo8.mjs → sync-BP6vnxVP.mjs} +1 -1
  188. package/dist/{sync-_2lsZ1U2.cjs → sync-WYBwkJvG.cjs} +1 -1
  189. package/dist/{systemPrompt-CJEvNCuW.cjs → systemPrompt-BkQlCk5_.cjs} +2 -2
  190. package/dist/{systemPrompt-Zq4HyrZ5.mjs → systemPrompt-aRqBmkpw.mjs} +2 -2
  191. package/dist/{teams-qz4LqKJ2.mjs → teams-CGmC4ygu.mjs} +7 -7
  192. package/dist/{teams-BNZafnrT.cjs → teams-phbpwAGD.cjs} +7 -7
  193. package/dist/{template-LgvBbOna.cjs → template-B9pLEP8v.cjs} +2 -2
  194. package/dist/{template-CJ8BWSsc.mjs → template-CL9EvQLQ.mjs} +2 -2
  195. package/dist/{time-CaUlWSNJ.cjs → time-BTLcO8jp.cjs} +1 -1
  196. package/dist/{time-bzmet4s5.mjs → time-Cw0liIqB.mjs} +1 -1
  197. package/dist/{titleGenerator-BuIIu_JP.cjs → titleGenerator-Y1_7ceJC.cjs} +3 -3
  198. package/dist/{titleGenerator-CbTtJ_1D.mjs → titleGenerator-h6TmFe-c.mjs} +2 -2
  199. package/dist/{todo-CQ_BTf9C.cjs → todo-BxiPiCvB.cjs} +6 -6
  200. package/dist/{todo-DIrVF_Ak.mjs → todo-OKcTC_VC.mjs} +6 -6
  201. package/dist/{tools-cLOjBvPn.mjs → tools-BR-drXZ8.mjs} +3 -2
  202. package/dist/{tools-BnmmFZji.cjs → tools-CcebYtLj.cjs} +3 -2
  203. package/dist/{uninstall-uEEGKB84.cjs → uninstall-CnDeCC-M.cjs} +3 -3
  204. package/dist/{uninstall-C5OuW6dE.mjs → uninstall-D3stWKD2.mjs} +3 -3
  205. package/dist/{wrapperAccount-DXlD3bsO.mjs → wrapperAccount-BkufO_9g.mjs} +5 -4
  206. package/dist/{wrapperAccount-DzoGqS2b.cjs → wrapperAccount-D2A4DuZy.cjs} +6 -3
  207. package/package.json +7 -7
  208. package/dist/selfCheck-vkfrgQ7X.mjs +0 -88
@@ -1,26 +1,26 @@
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-DXT3rv7T.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-CD4ntuZJ.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-Bl5GpBoN.mjs';
3
+ import { P as PI_ADAPTER_INSTALL_HINT, s as sanitizeSpawnModel } from './piRunnerArgs-BbaAQvb4.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, readSync, writeSync, ftruncateSync, utimesSync, realpathSync, promises, constants as constants$1, writeFileSync, mkdirSync, accessSync, rmdirSync } from 'node:fs';
9
9
  import { join, isAbsolute, resolve, dirname, sep, basename, relative } from 'node:path';
10
- import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-IhRiLDVe.mjs';
11
- import { T as TurnActivityTracker, A as ApiClient } from './api-_LeBScjg.mjs';
12
- import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-CRMfOJhh.mjs';
13
- import { l as logger } from './logger-Fd_rNvgd.mjs';
14
- import { p as pruneStaleCompileCaches } from './index-JQDyJ3Li.mjs';
15
- import { a as authAndSetupMachineIfNeeded } from './auth-DL8_J9vu.mjs';
10
+ import { f as ensurePrivateDirectorySync, w as writePrivateFileSync, c as configuration } from './configuration-ThKBP_zY.mjs';
11
+ import { T as TurnActivityTracker, A as ApiClient } from './api-DUfunY3x.mjs';
12
+ import { S as SPAWN_AGENTS, i as isSpawnAgent, s as sanitizeSpawnPermissionMode, r as resolveSpawnPermissionMode, a as resolveFirstMessageMeta, j as joinProject } from './spawnAgents-I29H9nO8.mjs';
13
+ import { l as logger } from './logger-JV7-4Q_6.mjs';
14
+ import { p as pruneStaleCompileCaches } from './index-BbdV2mzy.mjs';
15
+ import { a as authAndSetupMachineIfNeeded } from './auth-jN5dNqTO.mjs';
16
16
  import { spawn, execSync } from 'child_process';
17
- import { p as packageJson } from './package-6KkRAops.mjs';
18
- import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-B_UwMcVT.mjs';
19
- import { s as spawnHappyCLI } from './spawnHappyCLI-Cj_6IICe.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-DWcHe035.mjs';
21
- import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, w as cleanupDaemonState } from './controlClient-8ILulwjc.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, j as lineageOf, g as waitForSessionKey, d as archiveSession, k as analyzeLatestTurn, m as readSessionLog, n as TURN_WINDOW, p as userPromptText } from './sessionOps-gU88-W9F.mjs';
23
- import { G as AgentProfilesStateSchema, a6 as ServerMigrateNoticeSchema, a7 as isHarnessInstallId, a8 as MODEL_INTENT_CONFIG, j as AUTOMATION_SUMMARY_MAX_CHARS, a9 as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, aa as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, d as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, ab as AUTOMATION_CLAIM_MAX_RUNS, ac as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, ad as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, ae as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-DYD3GM1m.mjs';
17
+ import { p as packageJson } from './package-Bw3H6VLn.mjs';
18
+ import { a as globalPrefixForPackage, N as NPM_SAFE_ARG, g as getEnvironmentInfo } from './doctor-C1zyOSXw.mjs';
19
+ import { s as spawnHappyCLI } from './spawnHappyCLI-CnMwzjWX.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-Cg4sfjQV.mjs';
21
+ import { i as isDaemonRunningCurrentlyInstalledHappyVersion, s as stopDaemon, w as cleanupDaemonState } from './controlClient-Ckl8N1MS.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, j as lineageOf, g as waitForSessionKey, d as archiveSession, k as analyzeLatestTurn, m as readSessionLog, n as TURN_WINDOW, p as userPromptText } from './sessionOps-C65Iej_C.mjs';
23
+ import { E as AgentProfilesStateSchema, a9 as ServerMigrateNoticeSchema, aa as isHarnessInstallId, ab as agentProfileUnavailableReason, ac as MODEL_INTENT_CONFIG, j as AUTOMATION_SUMMARY_MAX_CHARS, ad as AUTOMATION_PRECHECK_OUTPUT_MAX_CHARS, ae as AUTOMATION_PRECHECK_DEFAULT_TIMEOUT_MS, d as AUTOMATION_PRECHECK_MAX_TIMEOUT_MS, af as AUTOMATION_CLAIM_MAX_RUNS, ag as AUTOMATION_DAEMON_CAPABILITY_PRECHECK, ah as AUTOMATION_DEFAULT_LEASE_MS, i as isAutomationRunTerminal, v as resolveLaunchAgentProfile, ai as HARNESS_INSTALL_CAPABILITY_VERSION } from './index-D1YnIih6.mjs';
24
24
  import fastify from 'fastify';
25
25
  import { z } from 'zod';
26
26
  import { validatorCompiler, serializerCompiler } from 'fastify-type-provider-zod';
@@ -28,67 +28,69 @@ import { d as decodeBase64, s as sameRelay, e as encodeBase64, h as decrypt } fr
28
28
  import { randomBytes, createHash, timingSafeEqual, randomUUID } from 'node:crypto';
29
29
  import { c as checkPreviewPath } from './previewPath-CXN4Vag0.mjs';
30
30
  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-Da5AR-4u.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-CKJ-IDM4.mjs';
31
+ import { b as sanitizeRateLimitReport } from './rateLimitWindows-CRARnKaI.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-WtRgTSqG.mjs';
33
33
  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-CZ7aaNgj.mjs';
35
- import { assistantHome, bootstrapAssistantHome } from './bootstrap-DaZ0Np7X.mjs';
36
- import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-v5EmjT8l.mjs';
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--0vfA7I5.mjs';
35
+ import { assistantHome, bootstrapAssistantHome } from './bootstrap-B3gMpU9e.mjs';
36
+ import { refreshAgentHomes, locateClaudeConversation, agentHomeSpawnEnv } from './index-Cn73rdtQ.mjs';
37
37
  import require$$0, { existsSync as existsSync$1, statSync as statSync$1, mkdtempSync, rmSync } from 'fs';
38
38
  import require$$1, { join as join$1 } from 'path';
39
39
  import { spawn as spawn$1, execFile, spawnSync } from 'node:child_process';
40
40
  import { p as projectPath } from './projectPath-BTBIMB57.mjs';
41
41
  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-1HIIC7Bc.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-D5-SW9kv.mjs';
43
43
  import { M as ModelConfigError, B as BackupStore, r as readConfigFile, s as sha256, a as atomicWriteFile } from './fileStore-5qpetZS0.mjs';
44
44
  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-NOX5pmQf.mjs';
45
46
  import require$$3 from 'crypto';
46
47
  import { c as commandOnPath } from './detectCLI-CSGMlV51.mjs';
47
- import { buildResumeLaunch } from './handleResumeCommand-BGhVo3QH.mjs';
48
+ import { buildResumeLaunch } from './handleResumeCommand-CrlqDuz7.mjs';
48
49
  import { n as normalizeWebPanels } from './webPanels-B2_C2-3g.mjs';
49
50
  import { access, symlink, readFile, rm, unlink, readlink, lstat, constants, rename, mkdir, copyFile, readdir, stat, open } from 'node:fs/promises';
50
51
  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-Bm4oKvW7.mjs';
52
- 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 terminateProcess, n as terminateProcessTree, o as AUTO_RESTARTED_ENV, q as encodeAutoRestarted, u as pendingUpgradeVersion, v as resolveQuietMs, x as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-Dl6i7IgA.mjs';
53
- import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-Cxlp_D4I.mjs';
52
+ import { P as ProjectsUnsupportedError, c as createProjectsClient } from './client-Bde4QVIn.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 terminateProcess, n as terminateProcessTree, o as AUTO_RESTARTED_ENV, q as encodeAutoRestarted, u as pendingUpgradeVersion, v as resolveQuietMs, x as AUTO_RESTART_RECHECK_CAP_MS } from './sessionLock-B73fhgQN.mjs';
54
+ import { c as createAutomationsClient, i as isAutomationsUnavailable, d as AutomationsRequestError } from './client-7RnI9J0W.mjs';
54
55
  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';
55
- import { A as AccountService } from './accountService-Dd9uqde2.mjs';
56
- import { spawnSetupTokenPty, watchAccountFiles } from './daemonAccounts-BJgt6IJe.mjs';
56
+ import { A as AccountService } from './accountService-Cd7bnkfd.mjs';
57
+ import { spawnSetupTokenPty, watchAccountFiles } from './daemonAccounts-DwPwKxvv.mjs';
57
58
  import { g as getProjectPath } from './path-D2wdaNSk.mjs';
58
59
  import { b as extractClaudeEditPaths } from './editPaths-BVfS_FFL.mjs';
59
- import { s as startFileWatcher } from './startFileWatcher-DikVa8kg.mjs';
60
- import { I as InvalidateSync } from './sync-JoEZKRo8.mjs';
60
+ import { s as startFileWatcher } from './startFileWatcher-DePAY1T5.mjs';
61
+ import { I as InvalidateSync } from './sync-BP6vnxVP.mjs';
61
62
  import { R as RawJSONLinesSchema } from './types-CkqAACXx.mjs';
62
63
  import { t as tmuxArgs, a as scrubTmuxClientEnv, s as shellescape } from './tmuxSocket-B8Yx20sT.mjs';
63
64
  import { findAllHappyProcesses } from './doctor-BPkYWSuq.mjs';
64
65
  import { T as TEAM_SKILL, a as TEAM_LEAD_PLAYBOOK, b as TEAM_MEMBER_RULES } from './resources-CLP_MpK4.mjs';
65
66
  import { promisify } from 'node:util';
66
- import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-CJ8BWSsc.mjs';
67
+ import { b as clipText, r as renderAction, c as clipAutomationReport, e as renderTemplate } from './template-CL9EvQLQ.mjs';
67
68
  import { d as describeAgentHome } from './loginShellEnv-Dw8M7tkI.mjs';
68
- import { S as SPAWN_ACCOUNT_ENV } from './store--XN-7MS0.mjs';
69
- import './acpSessionResume-BWEUxNtC.mjs';
70
- import './lidState-CZOXXdzv.mjs';
69
+ import { S as SPAWN_ACCOUNT_ENV } from './store-Vej_738f.mjs';
70
+ import './acpSessionResume-TQwN9ZZE.mjs';
71
+ import './lidState-B6yYKjNK.mjs';
71
72
  import 'node:events';
72
73
  import 'socket.io-client';
73
- import './pushNotifications-DkQ0yvFs.mjs';
74
+ import './pushNotifications-BbE-qV9I.mjs';
74
75
  import './contentLogMetadata-BlWI0egu.mjs';
75
76
  import './limits-DIo7rEBR.mjs';
76
- import './time-bzmet4s5.mjs';
77
- import './registerCommonHandlers-yQ7Ru-l0.mjs';
77
+ import './time-Cw0liIqB.mjs';
78
+ import './registerCommonHandlers-Cj3Nl9y-.mjs';
78
79
  import 'util';
79
80
  import 'cross-spawn';
80
81
  import '@paralleldrive/cuid2';
81
82
  import 'chalk';
82
83
  import 'node:module';
83
84
  import 'tweetnacl';
84
- import './browser-BUIaSHK2.mjs';
85
+ import './browser-LHW2hBH8.mjs';
85
86
  import 'open';
86
87
  import './specialCommands-MXUN0wfI.mjs';
87
88
  import './ids-DU6sLx4C.mjs';
88
89
  import 'url';
89
- import './localHappyAgentAuth-YHxDZ4x4.mjs';
90
+ import './localHappyAgentAuth-KRlg_aI0.mjs';
90
91
  import './processTreeSnapshot-CuLJDNC-.mjs';
91
- import './claudeAccountEnv-ON24i0qv.mjs';
92
+ import './claudeAccountEnv-BL1pR_37.mjs';
93
+ import 'node:readline';
92
94
  import 'node-pty';
93
95
  import 'ps-list';
94
96
 
@@ -2567,806 +2569,6 @@ const claudeAdapter = {
2567
2569
  }
2568
2570
  };
2569
2571
 
2570
- /*!
2571
- * Copyright (c) Squirrel Chat et al., All rights reserved.
2572
- * SPDX-License-Identifier: BSD-3-Clause
2573
- *
2574
- * Redistribution and use in source and binary forms, with or without
2575
- * modification, are permitted provided that the following conditions are met:
2576
- *
2577
- * 1. Redistributions of source code must retain the above copyright notice, this
2578
- * list of conditions and the following disclaimer.
2579
- * 2. Redistributions in binary form must reproduce the above copyright notice,
2580
- * this list of conditions and the following disclaimer in the
2581
- * documentation and/or other materials provided with the distribution.
2582
- * 3. Neither the name of the copyright holder nor the names of its contributors
2583
- * may be used to endorse or promote products derived from this software without
2584
- * specific prior written permission.
2585
- *
2586
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2587
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2588
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2589
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
2590
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2591
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2592
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2593
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2594
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2595
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2596
- */
2597
- function getLineColFromPtr(string, ptr) {
2598
- let lines = string.slice(0, ptr).split(/\r?\n/);
2599
- return [lines.length, lines.pop().length + 1];
2600
- }
2601
- function makeCodeBlock(string, line, column) {
2602
- let lines = string.split(/\r?\n/);
2603
- let codeblock = "";
2604
- let numberLen = (Math.log10(line + 1) | 0) + 1;
2605
- for (let i = line - 1; i <= line + 1; i++) {
2606
- let l = lines[i - 1];
2607
- if (!l)
2608
- continue;
2609
- codeblock += i.toString().padEnd(numberLen, " ");
2610
- codeblock += ": ";
2611
- codeblock += l;
2612
- codeblock += "\n";
2613
- if (i === line) {
2614
- codeblock += " ".repeat(numberLen + column + 2);
2615
- codeblock += "^\n";
2616
- }
2617
- }
2618
- return codeblock;
2619
- }
2620
- class TomlError extends Error {
2621
- line;
2622
- column;
2623
- codeblock;
2624
- constructor(message, options) {
2625
- const [line, column] = getLineColFromPtr(options.toml, options.ptr);
2626
- const codeblock = makeCodeBlock(options.toml, line, column);
2627
- super(`Invalid TOML document: ${message}
2628
-
2629
- ${codeblock}`, options);
2630
- this.line = line;
2631
- this.column = column;
2632
- this.codeblock = codeblock;
2633
- }
2634
- /** @internal */
2635
- static x(message, ctx, ptr) {
2636
- throw new TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
2637
- }
2638
- }
2639
-
2640
- function parseString(ctx) {
2641
- let startPtr = ctx.p;
2642
- let c = ctx.s.charCodeAt(ctx.p++);
2643
- let first = c;
2644
- let isLiteral = c === 39;
2645
- let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
2646
- if (isMultiline) {
2647
- if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
2648
- ctx.p++;
2649
- else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
2650
- ctx.p += 2;
2651
- }
2652
- let parsed = "";
2653
- let sliceStart = ctx.p;
2654
- let state = 0;
2655
- for (; ctx.p < ctx.s.length; ctx.p++) {
2656
- c = ctx.s.charCodeAt(ctx.p);
2657
- if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
2658
- state = state && 3;
2659
- } else if (c < 32 && c !== 9 || c === 127) {
2660
- TomlError.x("control characters are not allowed in strings", ctx);
2661
- } else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
2662
- if (isMultiline) {
2663
- if (ctx.s.charCodeAt(ctx.p + 3) === first)
2664
- ctx.p++;
2665
- if (ctx.s.charCodeAt(ctx.p + 3) === first)
2666
- ctx.p++;
2667
- }
2668
- if (!state) {
2669
- let s = ctx.s.slice(sliceStart, ctx.p);
2670
- parsed = parsed ? parsed + s : s;
2671
- }
2672
- ctx.p += isMultiline ? 3 : 1;
2673
- return parsed;
2674
- } else if (!state) {
2675
- if (!isLiteral && c === 92) {
2676
- parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
2677
- state = 1;
2678
- }
2679
- } else if (state === 1) {
2680
- if (c === 120 || c === 117 || c === 85) {
2681
- let errPtr = ctx.p++ - 1;
2682
- let value = 0;
2683
- let len = c === 120 ? 2 : c === 117 ? 4 : 8;
2684
- for (let j = 0; j < len; j++, ctx.p++) {
2685
- let hex = ctx.s.charCodeAt(ctx.p);
2686
- let digit = (
2687
- /* 0-9 */
2688
- hex >= 48 && hex <= 57 ? hex - 48 : (
2689
- /* A-F */
2690
- hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
2691
- /* a-f */
2692
- hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
2693
- )
2694
- )
2695
- );
2696
- if (digit < 0)
2697
- TomlError.x("invalid non-hex character in unicode escape", ctx);
2698
- value = value << 4 | digit;
2699
- }
2700
- if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
2701
- TomlError.x("invalid unicode escape", ctx, errPtr);
2702
- }
2703
- parsed += String.fromCodePoint(value);
2704
- sliceStart = ctx.p--;
2705
- state = 0;
2706
- } else if (isMultiline && (c === 32 || c === 9)) {
2707
- state = 2;
2708
- } else {
2709
- if (c === 98)
2710
- parsed += "\b";
2711
- else if (c === 116)
2712
- parsed += " ";
2713
- else if (c === 110)
2714
- parsed += "\n";
2715
- else if (c === 102)
2716
- parsed += "\f";
2717
- else if (c === 114)
2718
- parsed += "\r";
2719
- else if (c === 101)
2720
- parsed += "\x1B";
2721
- else if (c === 34)
2722
- parsed += '"';
2723
- else if (c === 92)
2724
- parsed += "\\";
2725
- else
2726
- TomlError.x("unrecognised escape sequence", ctx);
2727
- sliceStart = ctx.p + 1;
2728
- state = 0;
2729
- }
2730
- } else if (c !== 32 && c !== 9) {
2731
- if (state === 2)
2732
- TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
2733
- state = !isLiteral && c === 92 ? 1 : 0;
2734
- sliceStart = ctx.p;
2735
- }
2736
- }
2737
- TomlError.x("unfinished string", ctx, startPtr);
2738
- }
2739
-
2740
- /*!
2741
- * Copyright (c) Squirrel Chat et al., All rights reserved.
2742
- * SPDX-License-Identifier: BSD-3-Clause
2743
- *
2744
- * Redistribution and use in source and binary forms, with or without
2745
- * modification, are permitted provided that the following conditions are met:
2746
- *
2747
- * 1. Redistributions of source code must retain the above copyright notice, this
2748
- * list of conditions and the following disclaimer.
2749
- * 2. Redistributions in binary form must reproduce the above copyright notice,
2750
- * this list of conditions and the following disclaimer in the
2751
- * documentation and/or other materials provided with the distribution.
2752
- * 3. Neither the name of the copyright holder nor the names of its contributors
2753
- * may be used to endorse or promote products derived from this software without
2754
- * specific prior written permission.
2755
- *
2756
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2757
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2758
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2759
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
2760
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2761
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2762
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2763
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2764
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2765
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2766
- */
2767
- let DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
2768
- class TomlDate extends Date {
2769
- #hasDate = false;
2770
- #hasTime = false;
2771
- #offset = null;
2772
- constructor(date, fasttype, unsafeDelim) {
2773
- let hasDate = true;
2774
- let hasTime = true;
2775
- let offset = "Z";
2776
- let c;
2777
- if (typeof date === "string") {
2778
- if (fasttype)
2779
- prep: {
2780
- if (fasttype < 3) {
2781
- if (+date.slice(11, 13) > 23) {
2782
- date = "";
2783
- break prep;
2784
- }
2785
- if (fasttype === 2) {
2786
- offset = null;
2787
- date += "Z";
2788
- } else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
2789
- offset = date.slice(date.length - 6);
2790
- }
2791
- if (unsafeDelim)
2792
- date = date.slice(0, 10) + "T" + date.slice(11);
2793
- } else if (fasttype === 4) {
2794
- date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
2795
- }
2796
- hasDate = fasttype !== 4;
2797
- hasTime = fasttype !== 3;
2798
- }
2799
- else {
2800
- let match = date.match(DATE_TIME_RE);
2801
- if (match) {
2802
- if (!match[1]) {
2803
- hasDate = false;
2804
- date = `0000-01-01T${date}`;
2805
- }
2806
- hasTime = !!match[2];
2807
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
2808
- if (match[2] && +match[2] > 23) {
2809
- date = "";
2810
- } else {
2811
- offset = match[3] || null;
2812
- if (!offset && hasTime)
2813
- date += "Z";
2814
- }
2815
- } else {
2816
- date = "";
2817
- }
2818
- }
2819
- }
2820
- super(date);
2821
- if (!isNaN(this.getTime())) {
2822
- this.#hasDate = hasDate;
2823
- this.#hasTime = hasTime;
2824
- this.#offset = offset;
2825
- }
2826
- }
2827
- isDateTime() {
2828
- return this.#hasDate && this.#hasTime;
2829
- }
2830
- isLocal() {
2831
- return !this.#hasDate || !this.#hasTime || !this.#offset;
2832
- }
2833
- isDate() {
2834
- return this.#hasDate && !this.#hasTime;
2835
- }
2836
- isTime() {
2837
- return this.#hasTime && !this.#hasDate;
2838
- }
2839
- isValid() {
2840
- return this.#hasDate || this.#hasTime;
2841
- }
2842
- toISOString() {
2843
- let iso = super.toISOString();
2844
- if (this.isDate())
2845
- return iso.slice(0, 10);
2846
- if (this.isTime())
2847
- return iso.slice(11, 23);
2848
- if (this.#offset === null)
2849
- return iso.slice(0, -1);
2850
- if (this.#offset === "Z" || this.#offset === "z")
2851
- return iso;
2852
- let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
2853
- offset = this.#offset[0] === "-" ? offset : -offset;
2854
- let offsetDate = new Date(this.getTime() - offset * 6e4);
2855
- return offsetDate.toISOString().slice(0, -1) + this.#offset;
2856
- }
2857
- static wrapAsOffsetDateTime(jsDate, offset = "Z") {
2858
- let date = new TomlDate(jsDate);
2859
- date.#offset = offset;
2860
- return date;
2861
- }
2862
- static wrapAsLocalDateTime(jsDate) {
2863
- let date = new TomlDate(jsDate);
2864
- date.#offset = null;
2865
- return date;
2866
- }
2867
- static wrapAsLocalDate(jsDate) {
2868
- let date = new TomlDate(jsDate);
2869
- date.#hasTime = false;
2870
- date.#offset = null;
2871
- return date;
2872
- }
2873
- static wrapAsLocalTime(jsDate) {
2874
- let date = new TomlDate(jsDate);
2875
- date.#hasDate = false;
2876
- date.#offset = null;
2877
- return date;
2878
- }
2879
- }
2880
-
2881
- function isDigit(char, base = 10) {
2882
- return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
2883
- }
2884
- function isEndOfValue(char, delim) {
2885
- return char === 32 || char === 9 || char === 10 || char === 13 || // Structure end or next value delimiter
2886
- delim && (char === delim || char === 44) || // Comment
2887
- char === 35;
2888
- }
2889
- function extractValue(ctx, end) {
2890
- let errPtr = ctx.p;
2891
- let c = ctx.s.charCodeAt(ctx.p);
2892
- if (c === 91 || c === 123) {
2893
- ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
2894
- let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
2895
- ctx.d++;
2896
- return value;
2897
- }
2898
- if (c === 34 || c === 39) {
2899
- return parseString(ctx);
2900
- }
2901
- if (c === 116) {
2902
- if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
2903
- TomlError.x("invalid value", ctx, errPtr);
2904
- return ctx.p++, true;
2905
- }
2906
- if (c === 102) {
2907
- if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
2908
- TomlError.x("invalid value", ctx, errPtr);
2909
- return ctx.p++, false;
2910
- }
2911
- if (c === 43 || c === 45) {
2912
- return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
2913
- }
2914
- if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
2915
- return parseDate(ctx, c, end);
2916
- }
2917
- if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
2918
- return parseTime(ctx, c, end);
2919
- }
2920
- return parseNumber(ctx, ctx.p, c, 0, end);
2921
- }
2922
- function parseNumber(ctx, startPtr, startChr, sign, endChr) {
2923
- let c = startChr;
2924
- let state = 0;
2925
- let hasUnderscores = false;
2926
- if (c === 105) {
2927
- if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
2928
- TomlError.x("invalid value", ctx, startPtr);
2929
- return ctx.p++, (sign || 1) / 0;
2930
- }
2931
- if (c === 110) {
2932
- if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
2933
- TomlError.x("invalid value", ctx, startPtr);
2934
- return ctx.p++, NaN;
2935
- }
2936
- if (c === 48) {
2937
- if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
2938
- return ctx.bi === true ? 0n : 0;
2939
- if (!sign) {
2940
- if (c === 120)
2941
- return parseIntegerBaseN(ctx, startPtr, 16, endChr);
2942
- else if (c === 98)
2943
- return parseIntegerBaseN(ctx, startPtr, 2, endChr);
2944
- else if (c === 111)
2945
- return parseIntegerBaseN(ctx, startPtr, 8, endChr);
2946
- }
2947
- if (c === 46)
2948
- state = 2;
2949
- else if (c === 101 || c === 69)
2950
- state = 4;
2951
- else
2952
- TomlError.x("illegal leading zero", ctx, startPtr);
2953
- } else if (!isDigit(c))
2954
- TomlError.x("invalid value", ctx, startPtr);
2955
- while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
2956
- if (!state)
2957
- state = 1;
2958
- if (c === 95) {
2959
- if (!(state & 1))
2960
- TomlError.x("illegal underscore", ctx);
2961
- state += 11;
2962
- hasUnderscores = true;
2963
- } else if (state === 1 && c === 46)
2964
- state = 2;
2965
- else if ((state === 1 || state === 3) && (c === 101 || c === 69))
2966
- state = 4;
2967
- else if (state === 4 && (c === 43 || c === 45)) ; else if (!isDigit(c))
2968
- TomlError.x(`illegal character in numeric literal`, ctx);
2969
- else if (state > 9)
2970
- state -= 11;
2971
- else if (!(state & 1))
2972
- state++;
2973
- }
2974
- if (!state) {
2975
- let val = (startChr - 48) * (sign || 1);
2976
- return ctx.bi === true ? BigInt(val) : val;
2977
- }
2978
- if (!(state & 1))
2979
- TomlError.x("unfinished numeric value", ctx, startPtr);
2980
- let str = ctx.s.slice(startPtr, ctx.p);
2981
- if (hasUnderscores)
2982
- str = str.replaceAll("_", "");
2983
- return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
2984
- }
2985
- function parseIntegerBaseN(ctx, startPtr, base, endChr) {
2986
- let c, underscore = 1;
2987
- while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
2988
- if (c === 95) {
2989
- if (underscore & 1)
2990
- TomlError.x("illegal underscore", ctx);
2991
- underscore = 3;
2992
- } else if (!isDigit(c, base))
2993
- TomlError.x(`illegal character in numeric literal`, ctx);
2994
- else if (underscore & 1)
2995
- underscore--;
2996
- }
2997
- if (underscore & 1)
2998
- TomlError.x("unfinished numeric value", ctx);
2999
- let str = ctx.s.slice(startPtr + 2, ctx.p);
3000
- if (underscore)
3001
- str = str.replaceAll("_", "");
3002
- return parseInteger(ctx, str, base, startPtr);
3003
- }
3004
- function parseInteger(ctx, str, base, startPtr) {
3005
- if (ctx.bi !== true)
3006
- int: {
3007
- let val = parseInt(str, base);
3008
- if (!Number.isSafeInteger(val)) {
3009
- if (ctx.bi)
3010
- break int;
3011
- TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
3012
- }
3013
- return val;
3014
- }
3015
- return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
3016
- }
3017
- function parseDate(ctx, c, endChr) {
3018
- let startPtr = ctx.p++, unsafeSeparator;
3019
- if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
3020
- return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
3021
- }
3022
- ctx.p += 5;
3023
- if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
3024
- TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
3025
- if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
3026
- let t2 = ctx.s.slice(startPtr, ctx.p);
3027
- return readDate(ctx, t2, 3, false, startPtr);
3028
- }
3029
- if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
3030
- TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
3031
- if (ctx.s.charCodeAt(ctx.p += 3) === 58)
3032
- ctx.p += 3;
3033
- if (ctx.s.charCodeAt(ctx.p) === 46)
3034
- while (isDigit(ctx.s.charCodeAt(++ctx.p)))
3035
- ;
3036
- if (c = ctx.s.charCodeAt(ctx.p)) {
3037
- if (c === 90 || c === 122) {
3038
- let t2 = ctx.s.slice(startPtr, ++ctx.p);
3039
- return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
3040
- }
3041
- if (c === 43 || c === 45) {
3042
- let t2 = ctx.s.slice(startPtr, ctx.p += 6);
3043
- return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
3044
- }
3045
- }
3046
- let t = ctx.s.slice(startPtr, ctx.p);
3047
- return readDate(ctx, t, 2, unsafeSeparator, startPtr);
3048
- }
3049
- function parseTime(ctx, c, endChr) {
3050
- let start = ctx.p;
3051
- if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
3052
- return parseNumber(ctx, --ctx.p, c, 0, endChr);
3053
- }
3054
- if (ctx.s.charCodeAt(ctx.p += 4) === 58)
3055
- ctx.p += 3;
3056
- if (ctx.s.charCodeAt(ctx.p) === 46)
3057
- while (isDigit(ctx.s.charCodeAt(++ctx.p)))
3058
- ;
3059
- let t = ctx.s.slice(start, ctx.p);
3060
- return readDate(ctx, t, 4, false, start);
3061
- }
3062
- function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
3063
- if (ctx.ld) {
3064
- let date = new TomlDate(str, type, unsafeDelim);
3065
- if (!date.isValid())
3066
- TomlError.x("invalid date", ctx, errPtr);
3067
- return date;
3068
- }
3069
- try {
3070
- if (temporalSuffix)
3071
- str += temporalSuffix;
3072
- switch (type) {
3073
- case 1:
3074
- return Temporal.ZonedDateTime.from(str);
3075
- case 2:
3076
- return Temporal.PlainDateTime.from(str);
3077
- case 3:
3078
- return Temporal.PlainDate.from(str);
3079
- case 4:
3080
- return Temporal.PlainTime.from(str);
3081
- }
3082
- } catch (e) {
3083
- TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
3084
- }
3085
- }
3086
-
3087
- function skipComment(ctx) {
3088
- for (; ctx.p < ctx.s.length; ctx.p++) {
3089
- let c = ctx.s.charCodeAt(ctx.p);
3090
- if (c === 10)
3091
- break;
3092
- if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
3093
- ctx.p++;
3094
- break;
3095
- }
3096
- if (c < 32 && c !== 9 || c === 127) {
3097
- TomlError.x("control characters are not allowed in comments", ctx);
3098
- }
3099
- }
3100
- }
3101
- function skipVoid(ctx, banNewLines, banComments) {
3102
- let c;
3103
- while (ctx.p < ctx.s.length) {
3104
- while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
3105
- ctx.p++;
3106
- if (banComments || c !== 35)
3107
- break;
3108
- skipComment(ctx);
3109
- }
3110
- }
3111
-
3112
- function parseKey(ctx, end = 61) {
3113
- let startPtr;
3114
- let state = 0;
3115
- let parsed = [];
3116
- let sliceStart;
3117
- let c = ctx.s.charCodeAt(startPtr = ctx.p);
3118
- do {
3119
- if (c === end) {
3120
- if (!state)
3121
- TomlError.x("unexpected end of key", ctx);
3122
- if (state === 1)
3123
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
3124
- return ctx.p++, parsed;
3125
- } else if (c === 46) {
3126
- if (!state)
3127
- TomlError.x("illegal empty bare key", ctx);
3128
- if (state === 1)
3129
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
3130
- state = 0;
3131
- } else if (!state && (c === 34 || c === 39)) {
3132
- if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
3133
- TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
3134
- parsed.push(parseString(ctx));
3135
- state = 2;
3136
- ctx.p--;
3137
- } else if (c === 32 || c === 9) {
3138
- if (state === 1) {
3139
- parsed.push(ctx.s.slice(sliceStart, ctx.p));
3140
- state = 2;
3141
- }
3142
- } else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
3143
- TomlError.x("illegal character in key", ctx);
3144
- } else if (!state) {
3145
- state = 1;
3146
- sliceStart = ctx.p;
3147
- }
3148
- } while (c = ctx.s.charCodeAt(++ctx.p));
3149
- TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
3150
- }
3151
- function parseInlineTable(ctx) {
3152
- let startPtr = ctx.p++;
3153
- let res = /* @__PURE__ */ Object.create(null);
3154
- let seen = /* @__PURE__ */ new Set();
3155
- let c;
3156
- while (ctx.p < ctx.s.length) {
3157
- skipVoid(ctx);
3158
- if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
3159
- ctx.p++;
3160
- return res;
3161
- }
3162
- let k;
3163
- let t = res;
3164
- let hasOwn = false;
3165
- let errPtr = ctx.p;
3166
- let key = parseKey(ctx);
3167
- for (let i = 0; i < key.length; i++) {
3168
- if (i)
3169
- t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
3170
- k = key[i];
3171
- if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
3172
- TomlError.x("trying to redefine an already defined value", ctx, errPtr);
3173
- }
3174
- let unsafe = k === "__proto__";
3175
- if (ctx.uk && (unsafe || k === "constructor")) {
3176
- t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
3177
- break;
3178
- }
3179
- if (!hasOwn && unsafe) {
3180
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
3181
- }
3182
- }
3183
- if (hasOwn) {
3184
- TomlError.x("trying to redefine an already defined value", ctx, errPtr);
3185
- }
3186
- skipVoid(ctx, true, true);
3187
- let value = extractValue(
3188
- ctx,
3189
- 125
3190
- /* } */
3191
- );
3192
- if (t && typeof (t[k] = value) === "object")
3193
- seen.add(value);
3194
- skipVoid(ctx);
3195
- if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
3196
- return res;
3197
- }
3198
- if (c !== 44)
3199
- TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
3200
- }
3201
- TomlError.x("unfinished table", ctx, startPtr);
3202
- }
3203
- function parseArray(ctx) {
3204
- let startPtr = ctx.p++;
3205
- let res = [];
3206
- let c;
3207
- while (ctx.p < ctx.s.length) {
3208
- skipVoid(ctx);
3209
- if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
3210
- ctx.p++;
3211
- return res;
3212
- }
3213
- res.push(extractValue(
3214
- ctx,
3215
- 93
3216
- /* ] */
3217
- ));
3218
- skipVoid(ctx);
3219
- if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
3220
- return res;
3221
- }
3222
- if (c !== 44)
3223
- TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
3224
- }
3225
- TomlError.x("unfinished array", ctx, startPtr);
3226
- }
3227
-
3228
- function peekTable(ctx, key, table, meta, type) {
3229
- let t = table;
3230
- let m = meta;
3231
- let k;
3232
- let hasOwn = false;
3233
- let state;
3234
- for (let i = 0; i < key.length; i++) {
3235
- if (i) {
3236
- t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
3237
- m = (state = m[k]).c;
3238
- if (type === 0 && (state.t === 1 || state.t === 2)) {
3239
- return null;
3240
- }
3241
- if (state.t === 2) {
3242
- let l = t.length - 1;
3243
- t = t[l];
3244
- m = m[l].c;
3245
- }
3246
- }
3247
- k = key[i];
3248
- if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
3249
- return null;
3250
- }
3251
- if (!hasOwn) {
3252
- let unsafe = k === "__proto__";
3253
- if (ctx.uk && (unsafe || k === "constructor"))
3254
- return false;
3255
- if (unsafe) {
3256
- Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
3257
- Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
3258
- }
3259
- m[k] = {
3260
- t: i < key.length - 1 && type === 2 ? 3 : type,
3261
- d: false,
3262
- i: 0,
3263
- c: /* @__PURE__ */ Object.create(null)
3264
- };
3265
- }
3266
- }
3267
- state = m[k];
3268
- if (state.t !== type && !(type === 1 && state.t === 3)) {
3269
- return null;
3270
- }
3271
- if (type === 2) {
3272
- if (!state.d) {
3273
- state.d = true;
3274
- t[k] = [];
3275
- }
3276
- t[k].push(t = /* @__PURE__ */ Object.create(null));
3277
- state.c[state.i++] = state = { t: 1, d: false, i: 0, c: /* @__PURE__ */ Object.create(null) };
3278
- }
3279
- if (state.d) {
3280
- return null;
3281
- }
3282
- state.d = true;
3283
- if (type === 1) {
3284
- t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
3285
- } else if (type === 0 && hasOwn) {
3286
- return null;
3287
- }
3288
- return [k, t, state.c];
3289
- }
3290
- function validateTablePeek(ctx, peek, ptr) {
3291
- if (peek === null || ctx.uk === 2)
3292
- TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
3293
- }
3294
- function parse(toml, options = {}) {
3295
- let ctx = {
3296
- s: toml,
3297
- p: 0,
3298
- d: options.maxDepth ?? 1e3,
3299
- bi: options.integersAsBigInt ?? false,
3300
- ld: options.useLegacyDate ?? true,
3301
- uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
3302
- };
3303
- let res = /* @__PURE__ */ Object.create(null);
3304
- let meta = /* @__PURE__ */ Object.create(null);
3305
- let tmp;
3306
- let skipping = false;
3307
- let tbl = res;
3308
- let m = meta;
3309
- if (toml.charCodeAt(0) === 65279)
3310
- ctx.p++;
3311
- skipVoid(ctx);
3312
- while (ctx.p < toml.length) {
3313
- if (toml.charCodeAt(ctx.p) === 91) {
3314
- let isTableArray = toml.charCodeAt(++ctx.p) === 91;
3315
- tmp = ctx.p += +isTableArray;
3316
- skipping = false;
3317
- let k = parseKey(
3318
- ctx,
3319
- 93
3320
- /* ] */
3321
- );
3322
- if (isTableArray) {
3323
- if (toml.charCodeAt(ctx.p) !== 93) {
3324
- TomlError.x("expected end of table array declaration", ctx);
3325
- }
3326
- ctx.p++;
3327
- }
3328
- let p = peekTable(
3329
- ctx,
3330
- k,
3331
- res,
3332
- meta,
3333
- isTableArray ? 2 : 1
3334
- /* Type.EXPLICIT */
3335
- );
3336
- if (!p) {
3337
- validateTablePeek(ctx, p, tmp);
3338
- skipping = true;
3339
- } else {
3340
- m = p[2];
3341
- tbl = p[1];
3342
- }
3343
- } else {
3344
- tmp = ctx.p;
3345
- let k = parseKey(ctx);
3346
- let p = peekTable(
3347
- ctx,
3348
- k,
3349
- tbl,
3350
- m,
3351
- 0
3352
- /* Type.DOTTED */
3353
- );
3354
- if (!p && !skipping)
3355
- validateTablePeek(ctx, p, tmp);
3356
- skipVoid(ctx, true, true);
3357
- let v = extractValue(ctx, void 0);
3358
- if (p && !skipping)
3359
- p[1][p[0]] = v;
3360
- }
3361
- skipVoid(ctx, true);
3362
- if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
3363
- TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
3364
- }
3365
- skipVoid(ctx);
3366
- }
3367
- return res;
3368
- }
3369
-
3370
2572
  const BARE_KEY = /^[A-Za-z0-9_-]+$/;
3371
2573
  function formatTomlKey(key) {
3372
2574
  return BARE_KEY.test(key) ? key : JSON.stringify(key);
@@ -5887,6 +5089,28 @@ class ClaudeAuthService {
5887
5089
  }
5888
5090
  }
5889
5091
 
5092
+ function forkSpawnAccount(requested, parentSessionId, parentAccount) {
5093
+ if (requested !== void 0) return requested;
5094
+ if (!parentSessionId) return void 0;
5095
+ return parentAccount(parentSessionId);
5096
+ }
5097
+ const REASON_TEXT = {
5098
+ "missing": "does not exist on this machine",
5099
+ "missing-secret": "has no key / token on this machine",
5100
+ "expired": "sign-in has expired",
5101
+ "invalid": "key was rejected",
5102
+ "agent-mismatch": "is for a different agent"
5103
+ };
5104
+ function accountUnavailableError(error, scope) {
5105
+ const reason = agentProfileUnavailableReason(error);
5106
+ if (!reason) return null;
5107
+ const detail = error.replace(/^agent-profile-unavailable:[a-z-]+:?\s*/, "");
5108
+ return `Account unavailable (${reason}): ${detail ? `${detail} \u2014 ` : ""}${accountUnavailableHint(reason, scope)}`;
5109
+ }
5110
+ function accountUnavailableHint(reason, scope) {
5111
+ return `${REASON_TEXT[reason] ?? reason}. Not run on the machine login. Fix: sign in again (Settings \u2192 Models & accounts, or \`very-happy account login\` / \`very-happy account test\`), or choose another account for this ${scope}.`;
5112
+ }
5113
+
5890
5114
  const INTERNAL_CLAUDE_EVENT_TYPES = /* @__PURE__ */ new Set(["file-history-snapshot", "change", "queue-operation"]);
5891
5115
  function parseLines(lines) {
5892
5116
  const out = [];
@@ -6707,6 +5931,27 @@ async function removeTeamWorktree(resource) {
6707
5931
  function teamInitialModelMeta(model) {
6708
5932
  return model ? { model, modelIntent: model } : { modelIntent: MODEL_INTENT_CONFIG };
6709
5933
  }
5934
+ function teamOperationAccount(op) {
5935
+ if (op.agentProfile === void 0) return void 0;
5936
+ return op.agentProfile === null ? null : op.agentProfile.id;
5937
+ }
5938
+ function teamAccountRefusal(resolve, op) {
5939
+ const agent = op.assistant === "claude" || op.assistant === "codex" ? op.assistant : null;
5940
+ const requested = teamOperationAccount(op);
5941
+ if (!resolve) return null;
5942
+ if (!agent) return typeof requested === "string" ? `agent-profile-unavailable:agent-mismatch: accounts are not supported for ${op.assistant} yet` : null;
5943
+ try {
5944
+ resolve(agent, requested);
5945
+ return null;
5946
+ } catch (error) {
5947
+ const message = error instanceof Error ? error.message : String(error);
5948
+ return agentProfileUnavailableReason(message) ? teamAccountError(message) : null;
5949
+ }
5950
+ }
5951
+ function teamAccountError(raw) {
5952
+ const reason = agentProfileUnavailableReason(raw);
5953
+ return `${raw}${reason ? ` \u2014 ${accountUnavailableHint(reason, "team member")}` : ""}`.slice(0, 1e3);
5954
+ }
6710
5955
  function refusalCode(error) {
6711
5956
  const code = axios.isAxiosError(error) ? error.response?.data?.error : void 0;
6712
5957
  return typeof code === "string" && /^[a-z_]{1,64}$/.test(code) ? ` (${code})` : "";
@@ -6727,6 +5972,14 @@ function createTeamWorker(deps) {
6727
5972
  await action(op.teamId, `complete-${op.id}`, { type: "complete-operation", operationId: op.id, machineId: deps.machineId, claimId: receipt.claimId, ...receipt.sessionId ? { sessionId: receipt.sessionId } : {}, ...op.type === "spawn" && receipt.directory ? { workingDirectory: receipt.directory } : {} });
6728
5973
  writeReceipt$1(home, { ...receipt, phase: "completed" });
6729
5974
  }
5975
+ async function refuseForAccount(op, receipt, error) {
5976
+ const { retryAt: _retryAt, sessionId: _sessionId, ...rest } = receipt;
5977
+ const next = { ...rest, phase: "prepared", spawnFailures: (receipt.spawnFailures ?? 0) + 1 };
5978
+ writeReceipt$1(home, next);
5979
+ await action(op.teamId, `account-refused-${op.id}-${receipt.retryConsumed ?? 0}`, { type: "fail-operation", operationId: op.id, machineId: deps.machineId, claimId: receipt.claimId, error }).catch(() => {
5980
+ });
5981
+ deps.log(`Teams operation ${op.id} refused: account unavailable`);
5982
+ }
6730
5983
  async function execute(op) {
6731
5984
  let receipt = readReceipt(home, op.id);
6732
5985
  let credential;
@@ -6766,6 +6019,11 @@ function createTeamWorker(deps) {
6766
6019
  return;
6767
6020
  }
6768
6021
  if (!op.directory) throw new Error("No repository selected for worker");
6022
+ const refusal = teamAccountRefusal(deps.resolveAccount, op);
6023
+ if (refusal) {
6024
+ await refuseForAccount(op, receipt, refusal);
6025
+ return;
6026
+ }
6769
6027
  let resource;
6770
6028
  try {
6771
6029
  const repository = await resolveTeamRepository(home, op.directory, (id) => {
@@ -6792,7 +6050,12 @@ function createTeamWorker(deps) {
6792
6050
  writePrivateFileSync(scopeFile, JSON.stringify({ serverUrl: server, scopeToken: credential.token, teamId: op.teamId, botId: op.botId, taskId: op.taskId, attemptId: op.attemptId }));
6793
6051
  receipt = { ...receipt, ...resource, scopeFile, phase: "spawning" };
6794
6052
  writeReceipt$1(home, receipt);
6795
- const spawned = await deps.spawn({ directory: resource.directory, agent: op.assistant === "pi-acp" ? "pi" : op.assistant, permissionMode: op.permissionMode === "bypassPermissions" ? "bypassPermissions" : "default", spawnedBy: "teams", environmentVariables: { VH_TEAM_SCOPE_FILE: scopeFile, VH_TEAM_OPERATION_ID: op.id } });
6053
+ const account = teamOperationAccount(op);
6054
+ const spawned = await deps.spawn({ directory: resource.directory, agent: op.assistant === "pi-acp" ? "pi" : op.assistant, permissionMode: op.permissionMode === "bypassPermissions" ? "bypassPermissions" : "default", spawnedBy: "teams", environmentVariables: { VH_TEAM_SCOPE_FILE: scopeFile, VH_TEAM_OPERATION_ID: op.id }, ...account !== void 0 ? { agentProfileId: account } : {} });
6055
+ if (spawned.type === "error" && agentProfileUnavailableReason(spawned.errorMessage)) {
6056
+ await refuseForAccount(op, receipt, teamAccountError(spawned.errorMessage));
6057
+ return;
6058
+ }
6796
6059
  if (spawned.type === "error" && spawned.startupExit?.exited) {
6797
6060
  const now = Date.now();
6798
6061
  receipt = afterStartupFailure(receipt, now);
@@ -7239,6 +6502,30 @@ const AUTOMATION_LOG_READ_MS = 3e4;
7239
6502
  const AUTOMATION_UNAVAILABLE_LOG_MS = 10 * 6e4;
7240
6503
  const AUTOMATION_MAX_CONCURRENT = AUTOMATION_CLAIM_MAX_RUNS;
7241
6504
  const AUTOMATION_SPAWNED_BY = "automation";
6505
+ const AUTOMATION_ACCOUNT_UNAVAILABLE = "account_unavailable";
6506
+ const AUTOMATION_ACCOUNT_HISTORY_REJECTED = "account_history_rejected";
6507
+ function turnFailureReason(turn) {
6508
+ if (turn.refusal === "agent-profile-unavailable") return AUTOMATION_ACCOUNT_UNAVAILABLE;
6509
+ if (turn.refusal === "agent-profile-history-rejected") return AUTOMATION_ACCOUNT_HISTORY_REJECTED;
6510
+ return `turn_${turn.status}`;
6511
+ }
6512
+ async function alignStickyAccount(accounts, agent, sessionId, requested) {
6513
+ const current = accounts.sessionAccount(sessionId);
6514
+ let target;
6515
+ try {
6516
+ target = accounts.resolve(agent, requested !== void 0 ? requested : current);
6517
+ } catch (error) {
6518
+ const message = error instanceof Error ? error.message : String(error);
6519
+ return { error: accountUnavailableError(message, "automation") ?? message, reason: AUTOMATION_ACCOUNT_UNAVAILABLE };
6520
+ }
6521
+ if (target === current) return null;
6522
+ try {
6523
+ await accounts.rebind(sessionId, target);
6524
+ } catch (error) {
6525
+ return { error: `Could not move the sticky session to the run's account: ${error instanceof Error ? error.message : String(error)}`, reason: "send_failed" };
6526
+ }
6527
+ return null;
6528
+ }
7242
6529
  function automationPromptHeader(name, runId) {
7243
6530
  return `[Very Happy automation "${name}" run ${runId}; finish with automation_report (runId ${runId}) or \`very-happy auto report --run ${runId}\`]`;
7244
6531
  }
@@ -7402,6 +6689,7 @@ function createAutomationRunner(deps) {
7402
6689
  function wakeThenSend(claimed, sessionId, text, stickyKey) {
7403
6690
  const { run, automation } = claimed;
7404
6691
  const item = track(claimed, "send", sessionId);
6692
+ if (stickyKey) item.stickyKey = stickyKey;
7405
6693
  item.waking = true;
7406
6694
  gating++;
7407
6695
  void (async () => {
@@ -7486,8 +6774,17 @@ ${action.prompt}`, { localId: `automation-${run.id}` });
7486
6774
  }
7487
6775
  const permissionMode = resolveSpawnPermissionMode(agent, action.permissionMode ?? void 0);
7488
6776
  const stickyKey = action.sticky ? renderTemplate(action.sticky.key, context) : void 0;
6777
+ const requestedAccount = resolveLaunchAgentProfile({ explicit: action.agentProfile, project: claimed.projectAgentProfiles, agent, machineId: deps.machineId }).agentProfileId;
6778
+ const accountAgent = agent === "claude" || agent === "codex" ? agent : null;
7489
6779
  if (stickyKey) {
7490
6780
  const bound = claimed.stickies.find((sticky) => sticky.key === stickyKey);
6781
+ if (bound && (wakeable(bound.sessionId) || deps.live(bound.sessionId)) && deps.accounts && accountAgent) {
6782
+ const problem = await alignStickyAccount(deps.accounts, accountAgent, bound.sessionId, requestedAccount);
6783
+ if (problem) {
6784
+ await failNow(claimed, "send", problem.error, problem.reason, bound.sessionId);
6785
+ return;
6786
+ }
6787
+ }
7491
6788
  if (bound && wakeable(bound.sessionId)) {
7492
6789
  wakeThenSend(claimed, bound.sessionId, `${header}
7493
6790
  ${action.prompt}`, stickyKey);
@@ -7502,7 +6799,9 @@ ${action.prompt}`, { localId: `automation-${run.id}` });
7502
6799
  await failNow(claimed, "send", `Sticky session delivery failed: ${error instanceof Error ? error.message : String(error)}`, "send_failed", bound.sessionId);
7503
6800
  return;
7504
6801
  }
7505
- await reportRunning(track(claimed, "send", bound.sessionId), bound.sessionId, stickyKey);
6802
+ const item2 = track(claimed, "send", bound.sessionId);
6803
+ item2.stickyKey = stickyKey;
6804
+ await reportRunning(item2, bound.sessionId, stickyKey);
7506
6805
  return;
7507
6806
  }
7508
6807
  if (bound) await client.deleteSticky(automation.id, stickyKey).catch(() => deps.log(`Automation ${automation.name}: stale sticky ${stickyKey} not cleared`));
@@ -7521,8 +6820,13 @@ ${action.prompt}`, { localId: `automation-${run.id}` });
7521
6820
  }
7522
6821
  }
7523
6822
  persist({ runId: run.id, automationId: automation.id, kind: "spawn", phase: "starting", claimId: run.claimId, stickyKey, ...action.worktree ? { directory } : {} });
7524
- const spawned = await deps.spawn({ directory, agent, permissionMode, spawnedBy: AUTOMATION_SPAWNED_BY, environmentVariables: stickyKey ? { ...env, VH_AUTOMATION_STICKY: "1" } : env });
6823
+ const spawned = await deps.spawn({ directory, agent, permissionMode, spawnedBy: AUTOMATION_SPAWNED_BY, environmentVariables: stickyKey ? { ...env, VH_AUTOMATION_STICKY: "1" } : env, ...requestedAccount !== void 0 ? { agentProfileId: requestedAccount } : {} });
7525
6824
  if (spawned.type !== "success") {
6825
+ const accountError = spawned.type === "error" ? accountUnavailableError(spawned.errorMessage, "automation") : null;
6826
+ if (accountError) {
6827
+ await failNow(claimed, "spawn", accountError, AUTOMATION_ACCOUNT_UNAVAILABLE);
6828
+ return;
6829
+ }
7526
6830
  await failNow(claimed, "spawn", spawned.type === "error" ? spawned.errorMessage : "Directory approval required", "spawn_failed");
7527
6831
  return;
7528
6832
  }
@@ -7571,7 +6875,11 @@ ${action.prompt}`, { localId: `automation-${run.id}`, ...meta });
7571
6875
  continue;
7572
6876
  }
7573
6877
  item.waitingOnBackground = false;
7574
- if (turn.status === "failed" || turn.status === "cancelled") await finish(item, { claimId: item.claimId, status: "failed", sessionId, error: turn.error ?? `Turn ${turn.status}`, needsAttention: true, attentionReason: `turn_${turn.status}` });
6878
+ const reason = turn.status === "failed" || turn.status === "cancelled" ? turnFailureReason(turn) : null;
6879
+ if (reason === AUTOMATION_ACCOUNT_HISTORY_REJECTED && item.stickyKey) {
6880
+ await client.deleteSticky(item.automationId, item.stickyKey).catch(() => deps.log(`Automation run ${item.runId}: sticky ${item.stickyKey} not cleared`));
6881
+ }
6882
+ if (reason) await finish(item, { claimId: item.claimId, status: "failed", sessionId, error: turn.error ?? `Turn ${turn.status}`, needsAttention: true, attentionReason: reason });
7575
6883
  else await finish(item, { claimId: item.claimId, status: "done", sessionId, summary: clipText(turn.answer, AUTOMATION_SUMMARY_MAX_CHARS) });
7576
6884
  }
7577
6885
  }
@@ -8190,9 +7498,11 @@ async function startDaemon() {
8190
7498
  }
8191
7499
  let spawnAccountId = null;
8192
7500
  delete extraEnv[SPAWN_ACCOUNT_ENV];
8193
- if ((options.agent ?? "claude") === "claude" && accountServiceRef) {
7501
+ const accountAgent = (options.agent ?? "claude") === "claude" ? "claude" : options.agent === "codex" ? "codex" : null;
7502
+ if (accountAgent && accountServiceRef) {
8194
7503
  try {
8195
- spawnAccountId = accountServiceRef.resolveSpawnAccount("claude", options.agentProfileId);
7504
+ const requested = forkSpawnAccount(options.agentProfileId, options.parentSessionId, (id) => accountServiceRef.sessionAccount(id));
7505
+ spawnAccountId = accountServiceRef.resolveSpawnAccount(accountAgent, requested);
8196
7506
  } catch (error) {
8197
7507
  return { type: "error", errorMessage: error instanceof Error ? error.message : String(error) };
8198
7508
  }
@@ -9193,6 +8503,15 @@ async function startDaemon() {
9193
8503
  },
9194
8504
  onChanged: () => {
9195
8505
  void apiMachine.publishAgentProfiles();
8506
+ },
8507
+ // B-850b: a Codex account never binds to a Claude session and vice versa.
8508
+ sessionAgent: (sessionId) => {
8509
+ for (const tracked of pidToTrackedSession.values()) {
8510
+ if (tracked.happySessionId !== sessionId) continue;
8511
+ const flavor = tracked.happySessionMetadataFromLocalWebhook?.flavor ?? "claude";
8512
+ return flavor === "codex" ? "codex" : flavor === "claude" ? "claude" : flavor;
8513
+ }
8514
+ return void 0;
9196
8515
  }
9197
8516
  });
9198
8517
  accountServiceRef = accountService;
@@ -9415,6 +8734,7 @@ async function startDaemon() {
9415
8734
  if (remaining.some(isPidAlive)) throw new Error("Worker still running; cleanup retained");
9416
8735
  },
9417
8736
  live: (id) => [...pidToTrackedSession.values()].some((s) => s.happySessionId === id && isPidAlive(s.pid)),
8737
+ ...accountServiceRef ? { resolveAccount: (agent, requested) => accountServiceRef.resolveSpawnAccount(agent, requested) } : {},
9418
8738
  log: (message) => logger.debug(`[DAEMON RUN] ${message}`)
9419
8739
  });
9420
8740
  automationRunner = createAutomationRunner({
@@ -9436,6 +8756,17 @@ async function startDaemon() {
9436
8756
  return waitForSessionLive(id, (sid) => [...pidToTrackedSession.values()].some((s) => s.happySessionId === sid && isPidAlive(s.pid)));
9437
8757
  },
9438
8758
  joinProject: (sessionId, projectId) => joinProject(projectsClient, sessionId, { kind: "explicit", projectId }, { via: "automation" }),
8759
+ // B-850d: sticky sessions follow the run's account; unusable → refused.
8760
+ ...accountServiceRef ? {
8761
+ accounts: {
8762
+ sessionAccount: (id) => accountServiceRef.sessionAccount(id),
8763
+ resolve: (agent, requested) => accountServiceRef.resolveSpawnAccount(agent, requested),
8764
+ rebind: async (sessionId, accountId) => {
8765
+ const result = await accountServiceRef.bind({ sessionId, accountId });
8766
+ if (result.restart === "failed") throw new Error(result.error ?? "restart failed");
8767
+ }
8768
+ }
8769
+ } : {},
9439
8770
  log: (message) => logger.debug(`[DAEMON RUN] ${message}`)
9440
8771
  });
9441
8772
  projectPresence = createProjectPresenceReporter({