abtars 0.3.4-alpha.8 → 0.3.4

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 (335) hide show
  1. package/bundle/{_registry.generated-YP5GLSG7.js → _registry.generated-AVR7DK2A.js} +15 -15
  2. package/bundle/{abmind-lazy-7Z44NODV.js → abmind-lazy-E3YCFKQ5.js} +15 -5
  3. package/bundle/abtars-browser.js +4 -4
  4. package/bundle/abtars-cli.js +23 -13
  5. package/bundle/abtars-cli.js.map +2 -2
  6. package/bundle/abtars-restart.js +3 -3
  7. package/bundle/abtars-task.js +3 -3
  8. package/bundle/abtars.js +385 -466
  9. package/bundle/abtars.js.map +4 -4
  10. package/bundle/{acp-raw-client-E6FM45NC.js → acp-raw-client-UCNK3OTU.js} +2 -2
  11. package/bundle/{action-gate-G2V47NHW.js → action-gate-V4FCBHFB.js} +2 -2
  12. package/bundle/{agent-api-adapter-WRGEQ6DV.js → agent-api-adapter-7HEPYSIN.js} +3 -3
  13. package/bundle/{agent-api-rate-limit-WCFXJMGY.js → agent-api-rate-limit-RZSAM3SW.js} +4 -4
  14. package/bundle/{agent-registry-GHNG2PH3.js → agent-registry-46A2R5KP.js} +7 -7
  15. package/bundle/{bootstrap-PZIDBPEJ.js → bootstrap-MIHJJSWU.js} +2 -2
  16. package/bundle/{bridge-lock-transport-4ZH7QTJP.js → bridge-lock-transport-7RSN7OLJ.js} +4 -4
  17. package/bundle/{browser-D3LZV7ZK.js → browser-F6BCWJWW.js} +6 -6
  18. package/bundle/{budget-45QOBDWA.js → budget-WUM3SPKW.js} +3 -3
  19. package/bundle/{capability-JFWX3IQF.js → capability-QVRKGRFC.js} +5 -5
  20. package/bundle/{chunk-YSKCQH6E.js → chunk-2IYJ4I66.js} +2 -2
  21. package/bundle/{chunk-W2R2HFOQ.js → chunk-2NLUT5S2.js} +6 -6
  22. package/bundle/chunk-3BG3AIDP.js +191 -0
  23. package/bundle/chunk-3BG3AIDP.js.map +7 -0
  24. package/bundle/{chunk-OKAQICWY.js → chunk-3GQX34S2.js} +3 -3
  25. package/bundle/{chunk-QROWBWLL.js → chunk-3XZ773BS.js} +2 -2
  26. package/bundle/{chunk-DYBW4XXL.js → chunk-467SRLLR.js} +2 -2
  27. package/bundle/{chunk-374NCXFZ.js → chunk-4AILRHUI.js} +10 -8
  28. package/bundle/chunk-4AILRHUI.js.map +7 -0
  29. package/bundle/{chunk-GPZNXY2U.js → chunk-4S3H4OK7.js} +4 -4
  30. package/bundle/{chunk-NDCRWEEJ.js → chunk-4Y5MJQRE.js} +6 -6
  31. package/bundle/{chunk-FRKW6LWB.js → chunk-55UWKI5C.js} +3 -3
  32. package/bundle/{chunk-7JN2MMU7.js → chunk-5PNJFDSW.js} +8 -8
  33. package/bundle/{chunk-LUNA6PM5.js → chunk-5RVOEFGT.js} +4 -2
  34. package/bundle/{chunk-LUNA6PM5.js.map → chunk-5RVOEFGT.js.map} +2 -2
  35. package/bundle/{chunk-OXTSWQCX.js → chunk-5Y3FJ2Y7.js} +2 -2
  36. package/bundle/{chunk-TMUYFERL.js → chunk-6B5ZFUPD.js} +2 -2
  37. package/bundle/{chunk-65VCEC32.js → chunk-6PA5JBUU.js} +2 -2
  38. package/bundle/{chunk-C7K6VZNY.js → chunk-BNXV7SZI.js} +21 -12
  39. package/bundle/chunk-BNXV7SZI.js.map +7 -0
  40. package/bundle/{chunk-AFREM7FX.js → chunk-CK7YTA2F.js} +2 -2
  41. package/bundle/{chunk-NRUSRJXR.js → chunk-DZJ5QZFD.js} +2 -2
  42. package/bundle/{chunk-YRSMGJFP.js → chunk-E67KESEG.js} +2 -2
  43. package/bundle/{chunk-ZV4IWKDJ.js → chunk-E7XD5UGB.js} +3 -3
  44. package/bundle/{chunk-CXXU3HAU.js → chunk-EAX5ZZUL.js} +63 -39
  45. package/bundle/chunk-EAX5ZZUL.js.map +7 -0
  46. package/bundle/{chunk-PEDX56EL.js → chunk-EFGBM555.js} +2 -2
  47. package/bundle/{chunk-EQSG2CRM.js → chunk-FGYDIX54.js} +22 -15
  48. package/bundle/chunk-FGYDIX54.js.map +7 -0
  49. package/bundle/{chunk-YPAQEQSC.js → chunk-GF6NVNA7.js} +15 -5
  50. package/bundle/chunk-GF6NVNA7.js.map +7 -0
  51. package/bundle/{chunk-UNM3OXHB.js → chunk-HGSHCQ5F.js} +110 -72
  52. package/bundle/{chunk-UNM3OXHB.js.map → chunk-HGSHCQ5F.js.map} +2 -2
  53. package/bundle/{chunk-VXCETPZU.js → chunk-IMIGG5EO.js} +39 -39
  54. package/bundle/chunk-IMIGG5EO.js.map +7 -0
  55. package/bundle/{chunk-P2K2K6XL.js → chunk-ITOFPJAV.js} +44 -32
  56. package/bundle/chunk-ITOFPJAV.js.map +7 -0
  57. package/bundle/{chunk-75ATTOW4.js → chunk-IY6UKLPS.js} +3 -3
  58. package/bundle/{chunk-EUZDKV3C.js → chunk-J4RUFAPK.js} +3 -3
  59. package/bundle/{chunk-HZDLFLRP.js → chunk-J7DRPVMU.js} +35 -5
  60. package/bundle/chunk-J7DRPVMU.js.map +7 -0
  61. package/bundle/{chunk-EGL6UMAO.js → chunk-JG4BKXBN.js} +7 -1
  62. package/bundle/chunk-JG4BKXBN.js.map +7 -0
  63. package/bundle/{chunk-N4EB6LA7.js → chunk-JLWYPGWI.js} +5 -5
  64. package/bundle/{chunk-5QUTMUIK.js → chunk-JXYWDAHD.js} +12 -12
  65. package/bundle/{chunk-GRVWZO4C.js → chunk-KOSFXW2S.js} +24 -3
  66. package/bundle/{chunk-GRVWZO4C.js.map → chunk-KOSFXW2S.js.map} +1 -1
  67. package/bundle/{chunk-M3JEX6L4.js → chunk-L72RIPEC.js} +9 -9
  68. package/bundle/{chunk-TEFZ4JA4.js → chunk-NHPLD3C7.js} +2 -2
  69. package/bundle/{chunk-2KC5G3EA.js → chunk-OWUO5RS3.js} +5 -5
  70. package/bundle/{chunk-4MULJ5SS.js → chunk-OY4Q6AMY.js} +71 -49
  71. package/bundle/chunk-OY4Q6AMY.js.map +7 -0
  72. package/bundle/{chunk-WBTJ2E62.js → chunk-P3NODAHF.js} +2 -5
  73. package/bundle/{chunk-WBTJ2E62.js.map → chunk-P3NODAHF.js.map} +2 -2
  74. package/bundle/{chunk-SMPHE3ZM.js → chunk-PB5GF4FG.js} +215 -163
  75. package/bundle/chunk-PB5GF4FG.js.map +7 -0
  76. package/bundle/{chunk-WYHGNI56.js → chunk-PMD5BLFS.js} +6 -6
  77. package/bundle/{chunk-URQPDCK5.js → chunk-Q66LQMMZ.js} +3 -3
  78. package/bundle/{chunk-IHYKTDIP.js → chunk-SC2Y5NR2.js} +36 -119
  79. package/bundle/chunk-SC2Y5NR2.js.map +7 -0
  80. package/bundle/chunk-SFL4EPCZ.js +555 -0
  81. package/bundle/chunk-SFL4EPCZ.js.map +7 -0
  82. package/bundle/{chunk-LDUOOKQY.js → chunk-SJPUNDZ3.js} +5 -5
  83. package/bundle/{chunk-LDUOOKQY.js.map → chunk-SJPUNDZ3.js.map} +1 -1
  84. package/bundle/{chunk-JQDJPUHM.js → chunk-TWB2ZGVH.js} +2 -2
  85. package/bundle/{chunk-IJT4KWXT.js → chunk-U4U47YE7.js} +2 -2
  86. package/bundle/{chunk-2FAZIA37.js → chunk-W546CU3A.js} +3 -3
  87. package/bundle/chunk-WC5O5KOE.js +211 -0
  88. package/bundle/chunk-WC5O5KOE.js.map +7 -0
  89. package/bundle/{chunk-JNIHEDKF.js → chunk-XPWYDNWL.js} +2 -2
  90. package/bundle/{chunk-GWILHZPT.js → chunk-XRTXYN66.js} +10 -7
  91. package/bundle/{chunk-GWILHZPT.js.map → chunk-XRTXYN66.js.map} +2 -2
  92. package/bundle/{chunk-EFJVUJBE.js → chunk-Y5FEFKGM.js} +6 -6
  93. package/bundle/chunk-YJZE4OK3.js +169 -0
  94. package/bundle/chunk-YJZE4OK3.js.map +7 -0
  95. package/bundle/{chunk-GVM5YU5I.js → chunk-Z4FZPB42.js} +2 -2
  96. package/bundle/{chunk-7BSQ5UQO.js → chunk-ZSIDQ66D.js} +3 -3
  97. package/bundle/{chunk-XX6BGTPO.js → chunk-ZZZCJJEO.js} +4 -4
  98. package/bundle/{commands-OIISYHTD.js → commands-2ZW6CMLC.js} +17 -16
  99. package/bundle/{config-M3P5IOAI.js → config-YMY5YHKN.js} +6 -6
  100. package/bundle/{context-2RJHC2LE.js → context-CL2RSLII.js} +7 -5
  101. package/bundle/context-CL2RSLII.js.map +7 -0
  102. package/bundle/{daemon-TB23FFWY.js → daemon-D7SU63OY.js} +3 -3
  103. package/bundle/{delegation-tools-YATZFKYO.js → delegation-tools-WS7Z56KZ.js} +12 -12
  104. package/bundle/{deploy-T6R45OZJ.js → deploy-AMTVKIMU.js} +2 -2
  105. package/bundle/{deps-WVK553KF.js → deps-T63AVJKJ.js} +3 -3
  106. package/bundle/{direct-api-transport-S2RDH2I7.js → direct-api-transport-QNNY2WWP.js} +51 -32
  107. package/bundle/direct-api-transport-QNNY2WWP.js.map +7 -0
  108. package/bundle/{discord-adapter-UTXUWX3A.js → discord-adapter-ABAD56Y2.js} +21 -20
  109. package/bundle/{discord-adapter-UTXUWX3A.js.map → discord-adapter-ABAD56Y2.js.map} +1 -1
  110. package/bundle/{dns-wakeup-IDOJIXBX.js → dns-wakeup-V3LEFXPE.js} +9 -33
  111. package/bundle/dns-wakeup-V3LEFXPE.js.map +7 -0
  112. package/bundle/{doctor-probes-B54JFIW3.js → doctor-probes-O6YI6XSZ.js} +6 -2
  113. package/bundle/{env-schema-4JXQUOH4.js → env-schema-B5RB32DC.js} +3 -3
  114. package/bundle/{gossip-3C3BSNPN.js → gossip-SKRCPOBS.js} +9 -5
  115. package/bundle/{guardrails-DL7ZSWVN.js → guardrails-64GQ5Y5K.js} +4 -4
  116. package/bundle/{heartbeat-system-MVTRS4GP.js → heartbeat-system-X4MUTKJD.js} +6 -6
  117. package/bundle/{heartbeat-tier3-6KH45CL6.js → heartbeat-tier3-2PTPWEQQ.js} +53 -76
  118. package/bundle/heartbeat-tier3-2PTPWEQQ.js.map +7 -0
  119. package/bundle/{hook-system-M3POLUIB.js → hook-system-YB635OC4.js} +3 -3
  120. package/bundle/{hotskills-FWX4QI7V.js → hotskills-Q75D2DK3.js} +5 -5
  121. package/bundle/{install-OS3CU7NF.js → install-RFKKFSGS.js} +17 -30
  122. package/bundle/install-RFKKFSGS.js.map +7 -0
  123. package/bundle/{install-manifest-5PPWMD2W.js → install-manifest-J7ICPCJN.js} +2 -2
  124. package/bundle/{irc-adapter-PTTZD32W.js → irc-adapter-TVEV4R6H.js} +3 -3
  125. package/bundle/{irc-config-CP7ZMUOX.js → irc-config-M676FOFI.js} +4 -4
  126. package/bundle/{kanban-board-M326B2XJ.js → kanban-board-DLEJUCNN.js} +9 -7
  127. package/bundle/{kanban-channel-IJ52OMNA.js → kanban-channel-XOLUHJZJ.js} +6 -6
  128. package/bundle/kanban-delivery-C4QPBNPX.js +45 -0
  129. package/bundle/kanban-delivery-C4QPBNPX.js.map +7 -0
  130. package/bundle/{lazy-require-KCRVT4SI.js → lazy-require-JKQSALXN.js} +3 -3
  131. package/bundle/{logger-OWCSNYCA.js → logger-3EGHBD4R.js} +2 -2
  132. package/bundle/{main-chat-ZNUZCTNS.js → main-chat-3H63REKK.js} +4 -4
  133. package/bundle/{master-user-HSKM4ZFN.js → master-user-MUBUP3KD.js} +5 -5
  134. package/bundle/{media-utils-3ZYOD7SK.js → media-utils-HUUIALAJ.js} +3 -3
  135. package/bundle/{message-pipeline-AUIUNM5R.js → message-pipeline-GRDRWONR.js} +17 -16
  136. package/bundle/meta.json +2773 -2241
  137. package/bundle/{metrics-collector-L3VPEHII.js → metrics-collector-YMUGY3PI.js} +31 -2
  138. package/bundle/metrics-collector-YMUGY3PI.js.map +7 -0
  139. package/bundle/{model-health-registry-MLEIZSTV.js → model-health-registry-QADMFQFQ.js} +2 -2
  140. package/bundle/{nerve-IGSXBKZZ.js → nerve-QPAEBRKX.js} +3 -3
  141. package/bundle/{notification-BFSIEECG.js → notification-3JICGXWU.js} +6 -6
  142. package/bundle/{openrouter-credits-NTVZDRYM.js → openrouter-credits-7NEIPYJN.js} +3 -3
  143. package/bundle/{orc-tools-TOD4WHTM.js → orc-tools-UZVPONKY.js} +5 -3
  144. package/bundle/{peer-auth-QC4EF2PM.js → peer-auth-RI43DKJE.js} +24 -15
  145. package/bundle/{peer-client-RGEU5HOK.js → peer-client-UITTMWJ2.js} +34 -29
  146. package/bundle/peer-client-UITTMWJ2.js.map +7 -0
  147. package/bundle/{peer-config-TN55LFDC.js → peer-config-URM7DCW6.js} +9 -4
  148. package/bundle/{peer-transport-5VKK2I7P.js → peer-transport-SI7I72DB.js} +12 -10
  149. package/bundle/{phase-transport-FS6NL4A5.js → phase-transport-ESWWACZI.js} +17 -17
  150. package/bundle/{reconcile-CTFCLQRN.js → reconcile-GFDQYNBD.js} +3 -3
  151. package/bundle/{reconciler-NZ4O4BCP.js → reconciler-IEUJXJN2.js} +12 -12
  152. package/bundle/{restore-IFHPI7I7.js → restore-FARTGLQQ.js} +3 -3
  153. package/bundle/{rollback-ANRI3T5Z.js → rollback-GEWPZABG.js} +2 -2
  154. package/bundle/{sandbox-runtime-QROWHDCS.js → sandbox-runtime-DV6E25J6.js} +2 -2
  155. package/bundle/{self-healer-utils-IFAYOQO2.js → self-healer-utils-P4SKNNEM.js} +3 -3
  156. package/bundle/{sha-tracker-ZWBP6CIJ.js → sha-tracker-77SHLYNY.js} +3 -3
  157. package/bundle/{skill-session-VJXTKOKL.js → skill-session-5HSMXY54.js} +3 -3
  158. package/bundle/{skill-stats-JORH5DGM.js → skill-stats-MI3RSWWL.js} +4 -4
  159. package/bundle/{skill-watcher-E4MGLKLS.js → skill-watcher-5L7JE6TN.js} +4 -4
  160. package/bundle/{sleep-BEWAUFCL.js → sleep-I4JFASCY.js} +11 -11
  161. package/bundle/{soul-bundle-VWAVHCZ6.js → soul-bundle-522C3IRH.js} +9 -8
  162. package/bundle/{spin-E3ZDEDKT.js → spin-VHNGNWTD.js} +11 -11
  163. package/bundle/{spin-notifications-SE2HVZI7.js → spin-notifications-7NC5XZEM.js} +5 -5
  164. package/bundle/{spin-types-OIE67MJK.js → spin-types-C5KOQOPD.js} +7 -3
  165. package/bundle/{sse-parser-anthropic-A6R4Z2TB.js → sse-parser-anthropic-MMTVWHLI.js} +3 -3
  166. package/bundle/{sse-parser-responses-HSZY3QGJ.js → sse-parser-responses-3AOFN64C.js} +3 -3
  167. package/bundle/{ssrf-guard-O6SHIK6Q.js → ssrf-guard-U2JA72TC.js} +3 -3
  168. package/bundle/{start-7QZIWO3S.js → start-H5IUFAWF.js} +4 -2
  169. package/bundle/{start-7QZIWO3S.js.map → start-H5IUFAWF.js.map} +2 -2
  170. package/bundle/{stt-LGVPXMVR.js → stt-PSOPPBV4.js} +4 -4
  171. package/bundle/{system-status-FAVNIUFJ.js → system-status-4LYGOFNO.js} +38 -24
  172. package/bundle/system-status-4LYGOFNO.js.map +7 -0
  173. package/bundle/{task-store-W5BFIAIH.js → task-store-MNCW42BW.js} +4 -4
  174. package/bundle/{telegram-adapter-4TX7QWKC.js → telegram-adapter-O6KIZDY6.js} +62 -45
  175. package/bundle/telegram-adapter-O6KIZDY6.js.map +7 -0
  176. package/bundle/{tool-registry-7FK3OQGL.js → tool-registry-JJMWCQKZ.js} +26 -24
  177. package/bundle/{tool-sandbox-4UC6GAKA.js → tool-sandbox-CNL6V6IH.js} +4 -4
  178. package/bundle/{transport-config-KBF5W2DP.js → transport-config-6MB2K2XC.js} +7 -7
  179. package/bundle/tribe-GDTFYJTK.js +111 -0
  180. package/bundle/tribe-GDTFYJTK.js.map +7 -0
  181. package/bundle/{update-CKFP6LBE.js → update-HGQAOC5L.js} +3 -3
  182. package/bundle/{usage-tracker-NXD364VX.js → usage-tracker-SR4BI6ZT.js} +2 -2
  183. package/bundle/{user-registry-35BW4XKM.js → user-registry-4PACZJIJ.js} +4 -4
  184. package/bundle/wire-platform-KKPWNNNQ.js +88 -0
  185. package/bundle/wire-platform-KKPWNNNQ.js.map +7 -0
  186. package/bundle/ws-peer-client-U3NNPOK7.js +370 -0
  187. package/bundle/ws-peer-client-U3NNPOK7.js.map +7 -0
  188. package/package.json +1 -1
  189. package/scripts/abtars-watchdog.sh +1 -5
  190. package/scripts/emergency-deploy.sh +2 -2
  191. package/scripts/emergency-update.sh +36 -37
  192. package/bundle/chunk-374NCXFZ.js.map +0 -7
  193. package/bundle/chunk-4MULJ5SS.js.map +0 -7
  194. package/bundle/chunk-4S554KLW.js +0 -105
  195. package/bundle/chunk-4S554KLW.js.map +0 -7
  196. package/bundle/chunk-C7K6VZNY.js.map +0 -7
  197. package/bundle/chunk-CXXU3HAU.js.map +0 -7
  198. package/bundle/chunk-EGL6UMAO.js.map +0 -7
  199. package/bundle/chunk-EQSG2CRM.js.map +0 -7
  200. package/bundle/chunk-HT2BPTZY.js +0 -241
  201. package/bundle/chunk-HT2BPTZY.js.map +0 -7
  202. package/bundle/chunk-HZDLFLRP.js.map +0 -7
  203. package/bundle/chunk-IHYKTDIP.js.map +0 -7
  204. package/bundle/chunk-IKUZPMVA.js +0 -82
  205. package/bundle/chunk-IKUZPMVA.js.map +0 -7
  206. package/bundle/chunk-P2K2K6XL.js.map +0 -7
  207. package/bundle/chunk-PU5HSKWH.js +0 -257
  208. package/bundle/chunk-PU5HSKWH.js.map +0 -7
  209. package/bundle/chunk-RWRRGE4U.js +0 -72
  210. package/bundle/chunk-RWRRGE4U.js.map +0 -7
  211. package/bundle/chunk-SMPHE3ZM.js.map +0 -7
  212. package/bundle/chunk-VUIX5AGB.js +0 -65
  213. package/bundle/chunk-VUIX5AGB.js.map +0 -7
  214. package/bundle/chunk-VXCETPZU.js.map +0 -7
  215. package/bundle/chunk-YPAQEQSC.js.map +0 -7
  216. package/bundle/context-2RJHC2LE.js.map +0 -7
  217. package/bundle/direct-api-transport-S2RDH2I7.js.map +0 -7
  218. package/bundle/dns-wakeup-IDOJIXBX.js.map +0 -7
  219. package/bundle/heartbeat-tier3-6KH45CL6.js.map +0 -7
  220. package/bundle/install-OS3CU7NF.js.map +0 -7
  221. package/bundle/metrics-collector-L3VPEHII.js.map +0 -7
  222. package/bundle/peer-client-RGEU5HOK.js.map +0 -7
  223. package/bundle/peer-jwt-NCCPXJRX.js +0 -18
  224. package/bundle/stream-single-RFJNUTL6.js +0 -34
  225. package/bundle/stream-single-RFJNUTL6.js.map +0 -7
  226. package/bundle/system-status-FAVNIUFJ.js.map +0 -7
  227. package/bundle/telegram-adapter-4TX7QWKC.js.map +0 -7
  228. package/bundle/user-registry-35BW4XKM.js.map +0 -7
  229. package/bundle/ws-peer-client-AIXCXF7V.js +0 -173
  230. package/bundle/ws-peer-client-AIXCXF7V.js.map +0 -7
  231. /package/bundle/{_registry.generated-YP5GLSG7.js.map → _registry.generated-AVR7DK2A.js.map} +0 -0
  232. /package/bundle/{abmind-lazy-7Z44NODV.js.map → abmind-lazy-E3YCFKQ5.js.map} +0 -0
  233. /package/bundle/{acp-raw-client-E6FM45NC.js.map → acp-raw-client-UCNK3OTU.js.map} +0 -0
  234. /package/bundle/{action-gate-G2V47NHW.js.map → action-gate-V4FCBHFB.js.map} +0 -0
  235. /package/bundle/{agent-api-adapter-WRGEQ6DV.js.map → agent-api-adapter-7HEPYSIN.js.map} +0 -0
  236. /package/bundle/{agent-api-rate-limit-WCFXJMGY.js.map → agent-api-rate-limit-RZSAM3SW.js.map} +0 -0
  237. /package/bundle/{agent-registry-GHNG2PH3.js.map → agent-registry-46A2R5KP.js.map} +0 -0
  238. /package/bundle/{bootstrap-PZIDBPEJ.js.map → bootstrap-MIHJJSWU.js.map} +0 -0
  239. /package/bundle/{bridge-lock-transport-4ZH7QTJP.js.map → bridge-lock-transport-7RSN7OLJ.js.map} +0 -0
  240. /package/bundle/{browser-D3LZV7ZK.js.map → browser-F6BCWJWW.js.map} +0 -0
  241. /package/bundle/{budget-45QOBDWA.js.map → budget-WUM3SPKW.js.map} +0 -0
  242. /package/bundle/{capability-JFWX3IQF.js.map → capability-QVRKGRFC.js.map} +0 -0
  243. /package/bundle/{chunk-YSKCQH6E.js.map → chunk-2IYJ4I66.js.map} +0 -0
  244. /package/bundle/{chunk-W2R2HFOQ.js.map → chunk-2NLUT5S2.js.map} +0 -0
  245. /package/bundle/{chunk-OKAQICWY.js.map → chunk-3GQX34S2.js.map} +0 -0
  246. /package/bundle/{chunk-QROWBWLL.js.map → chunk-3XZ773BS.js.map} +0 -0
  247. /package/bundle/{chunk-DYBW4XXL.js.map → chunk-467SRLLR.js.map} +0 -0
  248. /package/bundle/{chunk-GPZNXY2U.js.map → chunk-4S3H4OK7.js.map} +0 -0
  249. /package/bundle/{chunk-NDCRWEEJ.js.map → chunk-4Y5MJQRE.js.map} +0 -0
  250. /package/bundle/{chunk-FRKW6LWB.js.map → chunk-55UWKI5C.js.map} +0 -0
  251. /package/bundle/{chunk-7JN2MMU7.js.map → chunk-5PNJFDSW.js.map} +0 -0
  252. /package/bundle/{chunk-OXTSWQCX.js.map → chunk-5Y3FJ2Y7.js.map} +0 -0
  253. /package/bundle/{chunk-TMUYFERL.js.map → chunk-6B5ZFUPD.js.map} +0 -0
  254. /package/bundle/{chunk-65VCEC32.js.map → chunk-6PA5JBUU.js.map} +0 -0
  255. /package/bundle/{chunk-AFREM7FX.js.map → chunk-CK7YTA2F.js.map} +0 -0
  256. /package/bundle/{chunk-NRUSRJXR.js.map → chunk-DZJ5QZFD.js.map} +0 -0
  257. /package/bundle/{chunk-YRSMGJFP.js.map → chunk-E67KESEG.js.map} +0 -0
  258. /package/bundle/{chunk-ZV4IWKDJ.js.map → chunk-E7XD5UGB.js.map} +0 -0
  259. /package/bundle/{chunk-PEDX56EL.js.map → chunk-EFGBM555.js.map} +0 -0
  260. /package/bundle/{chunk-75ATTOW4.js.map → chunk-IY6UKLPS.js.map} +0 -0
  261. /package/bundle/{chunk-EUZDKV3C.js.map → chunk-J4RUFAPK.js.map} +0 -0
  262. /package/bundle/{chunk-N4EB6LA7.js.map → chunk-JLWYPGWI.js.map} +0 -0
  263. /package/bundle/{chunk-5QUTMUIK.js.map → chunk-JXYWDAHD.js.map} +0 -0
  264. /package/bundle/{chunk-M3JEX6L4.js.map → chunk-L72RIPEC.js.map} +0 -0
  265. /package/bundle/{chunk-TEFZ4JA4.js.map → chunk-NHPLD3C7.js.map} +0 -0
  266. /package/bundle/{chunk-2KC5G3EA.js.map → chunk-OWUO5RS3.js.map} +0 -0
  267. /package/bundle/{chunk-WYHGNI56.js.map → chunk-PMD5BLFS.js.map} +0 -0
  268. /package/bundle/{chunk-URQPDCK5.js.map → chunk-Q66LQMMZ.js.map} +0 -0
  269. /package/bundle/{chunk-JQDJPUHM.js.map → chunk-TWB2ZGVH.js.map} +0 -0
  270. /package/bundle/{chunk-IJT4KWXT.js.map → chunk-U4U47YE7.js.map} +0 -0
  271. /package/bundle/{chunk-2FAZIA37.js.map → chunk-W546CU3A.js.map} +0 -0
  272. /package/bundle/{chunk-JNIHEDKF.js.map → chunk-XPWYDNWL.js.map} +0 -0
  273. /package/bundle/{chunk-EFJVUJBE.js.map → chunk-Y5FEFKGM.js.map} +0 -0
  274. /package/bundle/{chunk-GVM5YU5I.js.map → chunk-Z4FZPB42.js.map} +0 -0
  275. /package/bundle/{chunk-7BSQ5UQO.js.map → chunk-ZSIDQ66D.js.map} +0 -0
  276. /package/bundle/{chunk-XX6BGTPO.js.map → chunk-ZZZCJJEO.js.map} +0 -0
  277. /package/bundle/{commands-OIISYHTD.js.map → commands-2ZW6CMLC.js.map} +0 -0
  278. /package/bundle/{config-M3P5IOAI.js.map → config-YMY5YHKN.js.map} +0 -0
  279. /package/bundle/{daemon-TB23FFWY.js.map → daemon-D7SU63OY.js.map} +0 -0
  280. /package/bundle/{delegation-tools-YATZFKYO.js.map → delegation-tools-WS7Z56KZ.js.map} +0 -0
  281. /package/bundle/{deploy-T6R45OZJ.js.map → deploy-AMTVKIMU.js.map} +0 -0
  282. /package/bundle/{deps-WVK553KF.js.map → deps-T63AVJKJ.js.map} +0 -0
  283. /package/bundle/{doctor-probes-B54JFIW3.js.map → doctor-probes-O6YI6XSZ.js.map} +0 -0
  284. /package/bundle/{env-schema-4JXQUOH4.js.map → env-schema-B5RB32DC.js.map} +0 -0
  285. /package/bundle/{gossip-3C3BSNPN.js.map → gossip-SKRCPOBS.js.map} +0 -0
  286. /package/bundle/{guardrails-DL7ZSWVN.js.map → guardrails-64GQ5Y5K.js.map} +0 -0
  287. /package/bundle/{heartbeat-system-MVTRS4GP.js.map → heartbeat-system-X4MUTKJD.js.map} +0 -0
  288. /package/bundle/{hook-system-M3POLUIB.js.map → hook-system-YB635OC4.js.map} +0 -0
  289. /package/bundle/{hotskills-FWX4QI7V.js.map → hotskills-Q75D2DK3.js.map} +0 -0
  290. /package/bundle/{install-manifest-5PPWMD2W.js.map → install-manifest-J7ICPCJN.js.map} +0 -0
  291. /package/bundle/{irc-adapter-PTTZD32W.js.map → irc-adapter-TVEV4R6H.js.map} +0 -0
  292. /package/bundle/{irc-config-CP7ZMUOX.js.map → irc-config-M676FOFI.js.map} +0 -0
  293. /package/bundle/{kanban-board-M326B2XJ.js.map → kanban-board-DLEJUCNN.js.map} +0 -0
  294. /package/bundle/{kanban-channel-IJ52OMNA.js.map → kanban-channel-XOLUHJZJ.js.map} +0 -0
  295. /package/bundle/{lazy-require-KCRVT4SI.js.map → lazy-require-JKQSALXN.js.map} +0 -0
  296. /package/bundle/{logger-OWCSNYCA.js.map → logger-3EGHBD4R.js.map} +0 -0
  297. /package/bundle/{main-chat-ZNUZCTNS.js.map → main-chat-3H63REKK.js.map} +0 -0
  298. /package/bundle/{master-user-HSKM4ZFN.js.map → master-user-MUBUP3KD.js.map} +0 -0
  299. /package/bundle/{media-utils-3ZYOD7SK.js.map → media-utils-HUUIALAJ.js.map} +0 -0
  300. /package/bundle/{message-pipeline-AUIUNM5R.js.map → message-pipeline-GRDRWONR.js.map} +0 -0
  301. /package/bundle/{model-health-registry-MLEIZSTV.js.map → model-health-registry-QADMFQFQ.js.map} +0 -0
  302. /package/bundle/{nerve-IGSXBKZZ.js.map → nerve-QPAEBRKX.js.map} +0 -0
  303. /package/bundle/{notification-BFSIEECG.js.map → notification-3JICGXWU.js.map} +0 -0
  304. /package/bundle/{openrouter-credits-NTVZDRYM.js.map → openrouter-credits-7NEIPYJN.js.map} +0 -0
  305. /package/bundle/{orc-tools-TOD4WHTM.js.map → orc-tools-UZVPONKY.js.map} +0 -0
  306. /package/bundle/{peer-auth-QC4EF2PM.js.map → peer-auth-RI43DKJE.js.map} +0 -0
  307. /package/bundle/{peer-config-TN55LFDC.js.map → peer-config-URM7DCW6.js.map} +0 -0
  308. /package/bundle/{peer-jwt-NCCPXJRX.js.map → peer-transport-SI7I72DB.js.map} +0 -0
  309. /package/bundle/{peer-transport-5VKK2I7P.js.map → phase-transport-ESWWACZI.js.map} +0 -0
  310. /package/bundle/{phase-transport-FS6NL4A5.js.map → reconcile-GFDQYNBD.js.map} +0 -0
  311. /package/bundle/{reconciler-NZ4O4BCP.js.map → reconciler-IEUJXJN2.js.map} +0 -0
  312. /package/bundle/{restore-IFHPI7I7.js.map → restore-FARTGLQQ.js.map} +0 -0
  313. /package/bundle/{reconcile-CTFCLQRN.js.map → rollback-GEWPZABG.js.map} +0 -0
  314. /package/bundle/{sandbox-runtime-QROWHDCS.js.map → sandbox-runtime-DV6E25J6.js.map} +0 -0
  315. /package/bundle/{self-healer-utils-IFAYOQO2.js.map → self-healer-utils-P4SKNNEM.js.map} +0 -0
  316. /package/bundle/{rollback-ANRI3T5Z.js.map → sha-tracker-77SHLYNY.js.map} +0 -0
  317. /package/bundle/{skill-session-VJXTKOKL.js.map → skill-session-5HSMXY54.js.map} +0 -0
  318. /package/bundle/{sha-tracker-ZWBP6CIJ.js.map → skill-stats-MI3RSWWL.js.map} +0 -0
  319. /package/bundle/{skill-stats-JORH5DGM.js.map → skill-watcher-5L7JE6TN.js.map} +0 -0
  320. /package/bundle/{skill-watcher-E4MGLKLS.js.map → sleep-I4JFASCY.js.map} +0 -0
  321. /package/bundle/{sleep-BEWAUFCL.js.map → soul-bundle-522C3IRH.js.map} +0 -0
  322. /package/bundle/{soul-bundle-VWAVHCZ6.js.map → spin-VHNGNWTD.js.map} +0 -0
  323. /package/bundle/{spin-notifications-SE2HVZI7.js.map → spin-notifications-7NC5XZEM.js.map} +0 -0
  324. /package/bundle/{spin-E3ZDEDKT.js.map → spin-types-C5KOQOPD.js.map} +0 -0
  325. /package/bundle/{sse-parser-anthropic-A6R4Z2TB.js.map → sse-parser-anthropic-MMTVWHLI.js.map} +0 -0
  326. /package/bundle/{sse-parser-responses-HSZY3QGJ.js.map → sse-parser-responses-3AOFN64C.js.map} +0 -0
  327. /package/bundle/{ssrf-guard-O6SHIK6Q.js.map → ssrf-guard-U2JA72TC.js.map} +0 -0
  328. /package/bundle/{spin-types-OIE67MJK.js.map → stt-PSOPPBV4.js.map} +0 -0
  329. /package/bundle/{stt-LGVPXMVR.js.map → task-store-MNCW42BW.js.map} +0 -0
  330. /package/bundle/{task-store-W5BFIAIH.js.map → tool-registry-JJMWCQKZ.js.map} +0 -0
  331. /package/bundle/{tool-registry-7FK3OQGL.js.map → tool-sandbox-CNL6V6IH.js.map} +0 -0
  332. /package/bundle/{tool-sandbox-4UC6GAKA.js.map → transport-config-6MB2K2XC.js.map} +0 -0
  333. /package/bundle/{transport-config-KBF5W2DP.js.map → update-HGQAOC5L.js.map} +0 -0
  334. /package/bundle/{update-CKFP6LBE.js.map → usage-tracker-SR4BI6ZT.js.map} +0 -0
  335. /package/bundle/{usage-tracker-NXD364VX.js.map → user-registry-4PACZJIJ.js.map} +0 -0
@@ -246,6 +246,14 @@ function readJsonField(file, field) {
246
246
  return void 0;
247
247
  }
248
248
  }
249
+ function inWatchdogServiceCgroup() {
250
+ if (process.platform === "darwin") return false;
251
+ try {
252
+ return readFileSync2("/proc/self/cgroup", "utf-8").includes("abtars-watchdog.service");
253
+ } catch {
254
+ return false;
255
+ }
256
+ }
249
257
  function syncSrcRepos(srcDir, names) {
250
258
  mkdirSync(srcDir, { recursive: true });
251
259
  for (const name of names) {
@@ -397,99 +405,129 @@ async function deployActivation(args) {
397
405
  writeFileSync2(join3(paths.home, "deploy.state"), JSON.stringify({ status: "deploying", version: staged.version, startedAt: (/* @__PURE__ */ new Date()).toISOString() }) + "\n");
398
406
  process.stdout.write(`\u2713 manifest updated
399
407
  `);
408
+ const inCgroup = inWatchdogServiceCgroup();
400
409
  if (!isFirstInstall) {
401
- if (process.platform === "darwin") {
402
- const uid = `gui/${process.getuid?.() ?? 501}`;
403
- try {
404
- execSync(`launchctl bootout ${uid}/com.abtars.watchdog 2>/dev/null`, { stdio: "ignore", timeout: 5e3 });
405
- } catch {
406
- }
407
- } else {
410
+ if (inCgroup) {
408
411
  try {
409
- execSync("systemctl --user stop abtars-watchdog", { stdio: "ignore", timeout: 5e3 });
412
+ rmSync(join3(paths.home, ".stopped"));
410
413
  } catch {
411
414
  }
412
- }
413
- writeFileSync2(join3(paths.home, ".start-reason"), `update:${staged.version}`);
414
- const wdPid = readJsonField(join3(paths.home, "bridge.lock"), "watchdogPid");
415
- if (wdPid && wdPid > 0) {
416
- try {
417
- process.kill(wdPid, "SIGTERM");
418
- } catch {
419
- }
420
- }
421
- const bridgePid = readJsonField(join3(paths.home, "bridge.lock"), "pid");
422
- if (bridgePid && bridgePid > 0) {
423
- try {
424
- process.kill(bridgePid, "SIGTERM");
425
- } catch {
426
- }
427
- process.stdout.write(` x Killing bridge (PID ${bridgePid})...
415
+ const bridgePid = readJsonField(join3(paths.home, "bridge.lock"), "pid");
416
+ if (bridgePid && bridgePid > 0) {
417
+ try {
418
+ process.kill(bridgePid, "SIGTERM");
419
+ } catch {
420
+ }
421
+ process.stdout.write(` x Killing bridge (PID ${bridgePid}) \u2014 L3 watchdog will respawn from new release...
428
422
  `);
429
- for (let i = 0; i < 10; i++) {
430
- await new Promise((r) => setTimeout(r, 500));
423
+ for (let i = 0; i < 10; i++) {
424
+ await new Promise((r) => setTimeout(r, 500));
425
+ try {
426
+ process.kill(bridgePid, 0);
427
+ } catch {
428
+ break;
429
+ }
430
+ }
431
+ }
432
+ } else {
433
+ if (process.platform === "darwin") {
434
+ const uid = `gui/${process.getuid?.() ?? 501}`;
435
+ try {
436
+ execSync(`launchctl bootout ${uid}/com.abtars.watchdog 2>/dev/null`, { stdio: "ignore", timeout: 5e3 });
437
+ } catch {
438
+ }
439
+ } else {
431
440
  try {
432
- process.kill(bridgePid, 0);
441
+ execSync("systemctl --user stop abtars-watchdog", { stdio: "ignore", timeout: 5e3 });
433
442
  } catch {
434
- break;
435
443
  }
436
444
  }
437
- }
438
- if (wdPid && wdPid > 0) {
439
- let wdAlive = false;
440
- for (let i = 0; i < 6; i++) {
445
+ writeFileSync2(join3(paths.home, ".start-reason"), `update:${staged.version}`);
446
+ const wdPid = readJsonField(join3(paths.home, "bridge.lock"), "watchdogPid");
447
+ if (wdPid && wdPid > 0) {
441
448
  try {
442
- process.kill(wdPid, 0);
443
- wdAlive = true;
449
+ process.kill(wdPid, "SIGTERM");
444
450
  } catch {
445
- wdAlive = false;
446
- break;
447
451
  }
448
- await new Promise((r) => setTimeout(r, 500));
449
452
  }
450
- if (wdAlive) {
453
+ const bridgePid = readJsonField(join3(paths.home, "bridge.lock"), "pid");
454
+ if (bridgePid && bridgePid > 0) {
451
455
  try {
452
- process.kill(wdPid, "SIGKILL");
456
+ process.kill(bridgePid, "SIGTERM");
453
457
  } catch {
454
458
  }
459
+ process.stdout.write(` x Killing bridge (PID ${bridgePid})...
460
+ `);
461
+ for (let i = 0; i < 10; i++) {
462
+ await new Promise((r) => setTimeout(r, 500));
463
+ try {
464
+ process.kill(bridgePid, 0);
465
+ } catch {
466
+ break;
467
+ }
468
+ }
469
+ }
470
+ if (wdPid && wdPid > 0) {
471
+ let wdAlive = false;
472
+ for (let i = 0; i < 6; i++) {
473
+ try {
474
+ process.kill(wdPid, 0);
475
+ wdAlive = true;
476
+ } catch {
477
+ wdAlive = false;
478
+ break;
479
+ }
480
+ await new Promise((r) => setTimeout(r, 500));
481
+ }
482
+ if (wdAlive) {
483
+ try {
484
+ process.kill(wdPid, "SIGKILL");
485
+ } catch {
486
+ }
487
+ }
488
+ }
489
+ try {
490
+ rmSync(join3(paths.home, ".stopped"));
491
+ } catch {
455
492
  }
456
- }
457
- try {
458
- rmSync(join3(paths.home, ".stopped"));
459
- } catch {
460
493
  }
461
494
  }
462
- writeFileSync2(join3(paths.home, ".start-reason"), "deploy-respawn");
463
495
  const manifest = await readManifest(paths.manifest);
464
496
  const mode = manifest?.installMode ?? "daemon";
465
497
  if (mode === "daemon") {
466
- if (process.platform === "darwin") {
467
- const plistPath = join3(homedir(), "Library/LaunchAgents/com.abtars.watchdog.plist");
468
- const uid = `gui/${process.getuid?.() ?? 501}`;
469
- try {
470
- execSync(`launchctl bootstrap ${uid} "${plistPath}"`, { stdio: "ignore", timeout: 5e3 });
471
- } catch {
472
- }
498
+ if (inCgroup) {
499
+ process.stdout.write(` Bridge killed \u2014 L3 watchdog respawning from new release
500
+ `);
473
501
  } else {
474
- try {
475
- execSync("systemctl --user daemon-reload", { stdio: "ignore", timeout: 5e3 });
476
- } catch {
477
- }
478
- try {
479
- execSync("systemctl --user unmask abtars-watchdog", { stdio: "ignore", timeout: 5e3 });
480
- } catch {
481
- }
482
- try {
483
- execSync("systemctl --user enable abtars-watchdog", { stdio: "ignore", timeout: 5e3 });
484
- } catch {
485
- }
486
- try {
487
- execSync("systemctl --user start abtars-watchdog", { stdio: "ignore", timeout: 5e3 });
488
- } catch {
502
+ writeFileSync2(join3(paths.home, ".start-reason"), "deploy-respawn");
503
+ if (process.platform === "darwin") {
504
+ const plistPath = join3(homedir(), "Library/LaunchAgents/com.abtars.watchdog.plist");
505
+ const uid = `gui/${process.getuid?.() ?? 501}`;
506
+ try {
507
+ execSync(`launchctl bootstrap ${uid} "${plistPath}"`, { stdio: "ignore", timeout: 5e3 });
508
+ } catch {
509
+ }
510
+ } else {
511
+ try {
512
+ execSync("systemctl --user daemon-reload", { stdio: "ignore", timeout: 5e3 });
513
+ } catch {
514
+ }
515
+ try {
516
+ execSync("systemctl --user unmask abtars-watchdog", { stdio: "ignore", timeout: 5e3 });
517
+ } catch {
518
+ }
519
+ try {
520
+ execSync("systemctl --user enable abtars-watchdog", { stdio: "ignore", timeout: 5e3 });
521
+ } catch {
522
+ }
523
+ try {
524
+ execSync("systemctl --user start abtars-watchdog", { stdio: "ignore", timeout: 5e3 });
525
+ } catch {
526
+ }
489
527
  }
490
- }
491
- process.stdout.write(` Daemon started
528
+ process.stdout.write(` Daemon started
492
529
  `);
530
+ }
493
531
  } else {
494
532
  process.stdout.write(` Deployed. Run 'abtars start' to launch the bridge.
495
533
  `);
@@ -510,8 +548,8 @@ async function deployActivation(args) {
510
548
  }
511
549
  async function refresh(paths, repoRoot) {
512
550
  await mkdir3(paths.bin, { recursive: true });
513
- const { writeWrapper } = await import("./install-OS3CU7NF.js");
514
- const { loadManifest } = await import("./install-manifest-5PPWMD2W.js");
551
+ const { writeWrapper } = await import("./install-RFKKFSGS.js");
552
+ const { loadManifest } = await import("./install-manifest-J7ICPCJN.js");
515
553
  const installManifest = loadManifest(paths.app);
516
554
  for (const name of installManifest.cliWrappers) {
517
555
  await writeWrapper(paths.bin, name, paths.app, false);
@@ -582,7 +620,7 @@ exec node "${target}" "$@"
582
620
  }
583
621
  }
584
622
  }
585
- const { reconcile, migrate } = await import("./reconcile-CTFCLQRN.js");
623
+ const { reconcile, migrate } = await import("./reconcile-GFDQYNBD.js");
586
624
  const templatesSrc = join3(paths.app, "templates");
587
625
  reconcile(templatesSrc, paths.home);
588
626
  migrate(paths.home);
@@ -597,4 +635,4 @@ export {
597
635
  deploy,
598
636
  deployActivationCli
599
637
  };
600
- //# sourceMappingURL=chunk-UNM3OXHB.js.map
638
+ //# sourceMappingURL=chunk-HGSHCQ5F.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/cli/deploy-lib/deploy.ts", "../src/cli/update-sources/dev.ts", "../src/cli/update-sources/npm.ts", "../src/cli/update-sources/registry-client.ts"],
4
- "sourcesContent": ["/**\n * Unified deploy flow. #1085 unified install+update; #1237 split into:\n * - obtain (sync + prepare + abmind) \u2014 fail-safe, may run as old code\n * - deployActivation() \u2014 brick-risk, runs fresh via __deploy\n * deploy() keeps the monolithic path (obtain+activate) for --local and tests.\n */\nimport { hostname, homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { existsSync, readFileSync, writeFileSync, rmSync, cpSync, mkdirSync, copyFileSync } from \"node:fs\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { execSync } from \"node:child_process\";\nimport { acquireLock, cleanStaleStaging, healthProbe, packagePaths, readManifest, writeManifest, emptyManifest } from \"../deploy-lib/index.js\";\nimport { resolveAbmindHome } from \"./paths.js\";\nimport { makeLocalBuildSource } from \"../update-sources/dev.js\";\nimport { makeNpmSource } from \"../update-sources/npm.js\";\nimport type { SourceName, StagedRelease } from \"../update-sources/types.js\";\n\nexport interface DeployOptions {\n readonly source: SourceName;\n readonly localDir?: string;\n readonly skipFreshness?: boolean;\n}\n\nfunction readJsonField(file: string, field: string): unknown {\n try { return JSON.parse(readFileSync(file, \"utf-8\"))[field]; } catch { return undefined; }\n}\n\n/**\n * Sync source repos into <releasesDir>/src \u2014 clone if missing, fetch+reset if\n * present, nuke+reclone on failure. Throws if a required repo (abtars) cannot\n * be synced. Obtain step \u2014 fail-safe (no release is swapped here).\n */\nexport function syncSrcRepos(srcDir: string, names: readonly string[]): void {\n mkdirSync(srcDir, { recursive: true });\n for (const name of names) {\n const dir = join(srcDir, name);\n try {\n if (existsSync(join(dir, \".git\"))) {\n execSync(\"git fetch --depth 1 origin dev && git reset --hard origin/dev\", { cwd: dir, stdio: \"pipe\", timeout: 30_000 });\n } else {\n rmSync(dir, { recursive: true, force: true });\n execSync(`git clone --depth 1 -b dev https://github.com/aksika/${name}.git`, { cwd: srcDir, stdio: \"pipe\", timeout: 120_000 });\n }\n } catch {\n try {\n rmSync(dir, { recursive: true, force: true });\n execSync(`git clone --depth 1 -b dev https://github.com/aksika/${name}.git`, { cwd: srcDir, stdio: \"pipe\", timeout: 120_000 });\n } catch (err) {\n process.stderr.write(`Failed to sync ${name}: ${err instanceof Error ? err.message : String(err)}\\n`);\n if (name === \"abtars\") throw err;\n }\n }\n }\n}\n\n// abmind is no longer built or bundled by abtars (#1243) \u2014 it ships as a\n// separate global package, discovered at runtime via import(\"abmind\").\n\n/**\n * Monolithic deploy: obtain (sync + prepare + abmind) then activate.\n * Used by `abtars update --local <dir>` and as the single-process path.\n * The bootstrap (#1237) instead obtains, then execs fresh `__deploy` which\n * calls deployActivation() directly.\n */\nexport async function deploy(opts: DeployOptions): Promise<number> {\n const paths = packagePaths(\"abtars\");\n\n if (!opts.localDir) {\n const srcDir = join(paths.releasesDir, \"src\");\n try { syncSrcRepos(srcDir, [\"abtars\"]); } catch { return 1; }\n }\n\n const repoRoot = opts.localDir ?? join(paths.releasesDir, \"src\", \"abtars\");\n if (!existsSync(join(repoRoot, \"package.json\"))) {\n process.stderr.write(`Source not found at ${repoRoot}\\nUse: abtars update --local <DIR>\\n`);\n return 1;\n }\n\n const { migrateIfNeeded } = await import(\"./migrate-layout.js\");\n migrateIfNeeded(paths.home);\n\n const release = await acquireLock(paths.lock, \"deploy\");\n try {\n cleanStaleStaging(paths.appStaging);\n cleanStaleStaging(join(paths.home, 'app.staging')); // legacy #1247 cleanup\n process.stdout.write(`Building from ${repoRoot}...\\n`);\n\n const source = opts.source === \"alpha\" || opts.source === \"stable\"\n ? makeNpmSource(\"abtars\", opts.source === \"alpha\" ? \"alpha\" : \"latest\")\n : makeLocalBuildSource({ repoRoot, allowStale: !!opts.skipFreshness });\n\n const staged = await source.prepare({ stagingDir: paths.appStaging, home: paths.home, allowStale: !!opts.skipFreshness });\n process.stdout.write(`\u2713 staged ${staged.version}\\n`);\n\n return await deployActivation({ staged, channel: opts.source, repoRoot });\n } finally {\n await release();\n }\n}\n\n/**\n * `__deploy` CLI entry \u2014 runs as FRESHLY-staged code (the bundle the bootstrap\n * just produced). Consumes a StagedRelease via flags and performs activation\n * only. Hidden command; stable, forward-compatible arg contract:\n * __deploy --staged <dir> --version <v> [--commit <c>] [--branch <b>]\n * [--channel dev|alpha|stable] [--package-lock-hash <h>] [--repo-root <dir>]\n * Unknown flags are ignored.\n */\nexport async function deployActivationCli(flags: ReadonlyMap<string, string | boolean>): Promise<number> {\n const str = (k: string): string | undefined => (typeof flags.get(k) === \"string\" ? (flags.get(k) as string) : undefined);\n const stagedPath = str(\"staged\");\n if (!stagedPath) {\n process.stderr.write(`__deploy: --staged <dir> is required\\n`);\n return 2;\n }\n const paths = packagePaths(\"abtars\");\n const channel = (str(\"channel\") ?? \"dev\") as SourceName;\n const staged: StagedRelease = {\n version: str(\"version\") ?? \"unknown\",\n stagedPath,\n commit: str(\"commit\") ?? null,\n branch: str(\"branch\") ?? null,\n packageLockHash: str(\"package-lock-hash\") ?? null,\n source: channel,\n };\n const repoRoot = str(\"repo-root\") ?? join(paths.releasesDir, \"src\", \"abtars\");\n\n const { migrateIfNeeded } = await import(\"./migrate-layout.js\");\n migrateIfNeeded(paths.home);\n\n const release = await acquireLock(paths.lock, \"deploy\");\n try {\n return await deployActivation({ staged, channel, repoRoot });\n } finally {\n await release();\n }\n}\n\n/**\n * Activation: stage \u2192 releases/<commit> \u2192 history \u2192 symlink \u2192 refresh \u2192\n * manifest \u2192 stop \u2192 respawn \u2192 healthProbe. BRICK-RISK \u2014 always runs fresh.\n * Caller MUST hold the deploy lock. Does not build/fetch (obtain is done).\n *\n * The stop/respawn sequence (Step 7/8) is FROZEN (abtars.md watchdog) \u2014 moved\n * verbatim from the previous monolithic deploy().\n *\n * BASH MIRROR: scripts/emergency-update.sh reimplements this activation in pure\n * shell as the zero-dependency last resort (no deployed binary needed). If this\n * stop/respawn sequence or the release path layout changes, update it too.\n */\nasync function deployActivation(args: { staged: StagedRelease; channel: SourceName; repoRoot: string }): Promise<number> {\n const { staged, channel, repoRoot } = args;\n const paths = packagePaths(\"abtars\");\n const isFirstInstall = !existsSync(paths.manifest);\n process.stdout.write(`[__deploy] activating ${staged.version} from ${staged.stagedPath}\\n`);\n\n // Validate entry point\n if (!existsSync(join(staged.stagedPath, \"bundle\", \"abtars.js\"))) {\n process.stderr.write(`x entry point not found\\n`);\n return 1;\n }\n\n // \u2500\u2500 Step 3: Deploy to releases dir + repoint symlink \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const { symlinkSync, unlinkSync: unlink } = await import(\"node:fs\");\n mkdirSync(paths.releasesDir, { recursive: true });\n const releaseDir = join(paths.releasesDir, staged.commit || staged.version);\n if (existsSync(releaseDir)) rmSync(releaseDir, { recursive: true, force: true });\n // Copy (not rename): the running __deploy CLI execs from staged.stagedPath;\n // moving it would break code-split dynamic imports. staged/ is reclaimed by\n // cleanStaleStaging on the next bootstrap.\n cpSync(staged.stagedPath, releaseDir, { recursive: true });\n\n // Update history.json (ordered array, max 4, deduped)\n // Dedup ensures history[1] is always a DIFFERENT commit than history[0],\n // so the circuit-breaker rollback target is never the just-deployed version.\n let history: string[] = [];\n try { history = JSON.parse(readFileSync(paths.releasesHistory, \"utf-8\")); } catch {}\n const newRef = staged.commit || staged.version;\n history = history.filter(h => h !== newRef);\n history.unshift(newRef);\n if (history.length > 4) {\n const dropped = history.pop()!;\n rmSync(join(paths.releasesDir, dropped), { recursive: true, force: true });\n }\n writeFileSync(paths.releasesHistory, JSON.stringify(history) + \"\\n\");\n\n // Repoint current symlink\n try { unlink(paths.releasesCurrentLink); } catch {}\n symlinkSync(releaseDir, paths.releasesCurrentLink);\n\n // Keep legacy app/ as symlink for backward compat (WD, bridge.lock paths)\n try { rmSync(paths.app, { recursive: true, force: true }); } catch {}\n symlinkSync(releaseDir, paths.app);\n\n process.stdout.write(`\u2713 deployed to releases/${staged.commit || staged.version}\\n`);\n\n // \u2500\u2500 Step 4: Bootstrap manifest if missing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (isFirstInstall) {\n await writeManifest(paths.manifest, {\n ...emptyManifest(\"abtars\", hostname()),\n installMode: \"daemon\",\n source: channel,\n } as any);\n }\n\n // \u2500\u2500 Step 5: Refresh \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n await refresh(paths, repoRoot);\n\n // \u2500\u2500 Step 6: Manifest + deploy.state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const prior = isFirstInstall ? null : await readManifest(paths.manifest);\n await writeManifest(paths.manifest, {\n ...(prior ?? emptyManifest(\"abtars\", hostname())),\n version: staged.version,\n commit: staged.commit,\n branch: staged.branch,\n packageLockHash: staged.packageLockHash,\n activatedAt: new Date().toISOString(),\n source: channel,\n previousVersion: prior?.version ?? null,\n previousCommit: prior?.commit ?? null,\n installMode: prior?.installMode ?? \"daemon\",\n repoRoot,\n } as any);\n writeFileSync(join(paths.home, \"deploy.state\"), JSON.stringify({ status: \"deploying\", version: staged.version, startedAt: new Date().toISOString() }) + \"\\n\");\n process.stdout.write(`\u2713 manifest updated\\n`);\n\n // \u2500\u2500 Step 7: Stop everything (FROZEN \u2014 abtars.md watchdog) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (!isFirstInstall) {\n // 7.1 Stop daemon service (tells WD to exit via service manager)\n if (process.platform === \"darwin\") {\n const uid = `gui/${process.getuid?.() ?? 501}`;\n try { execSync(`launchctl bootout ${uid}/com.abtars.watchdog 2>/dev/null`, { stdio: \"ignore\", timeout: 5000 }); } catch {}\n } else {\n try { execSync(\"systemctl --user stop abtars-watchdog\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n }\n\n // 7.2 Write .start-reason = \"update:X\" (safety net if WD survives service stop)\n writeFileSync(join(paths.home, \".start-reason\"), `update:${staged.version}`);\n\n // 7.3 Kill WD PID explicitly (belt)\n const wdPid = readJsonField(join(paths.home, \"bridge.lock\"), \"watchdogPid\") as number | undefined;\n if (wdPid && wdPid > 0) {\n try { process.kill(wdPid, \"SIGTERM\"); } catch {}\n }\n\n // 7.4 Kill bridge PID\n const bridgePid = readJsonField(join(paths.home, \"bridge.lock\"), \"pid\") as number | undefined;\n if (bridgePid && bridgePid > 0) {\n try { process.kill(bridgePid, \"SIGTERM\"); } catch {}\n process.stdout.write(` x Killing bridge (PID ${bridgePid})...\\n`);\n for (let i = 0; i < 10; i++) {\n await new Promise(r => setTimeout(r, 500));\n try { process.kill(bridgePid, 0); } catch { break; }\n }\n }\n\n // 7.5 Wait for WD to die (flock release). SIGKILL after 3s.\n if (wdPid && wdPid > 0) {\n let wdAlive = false;\n for (let i = 0; i < 6; i++) {\n try { process.kill(wdPid, 0); wdAlive = true; } catch { wdAlive = false; break; }\n await new Promise(r => setTimeout(r, 500));\n }\n if (wdAlive) { try { process.kill(wdPid, \"SIGKILL\"); } catch {} }\n }\n\n // 7.6 Clear .stopped sentinel\n try { rmSync(join(paths.home, \".stopped\")); } catch {}\n }\n\n // \u2500\u2500 Step 8: Respawn \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // 8.1 Write neutral .start-reason \u2014 new WD won't match any exit case\n writeFileSync(join(paths.home, \".start-reason\"), \"deploy-respawn\");\n\n const manifest = await readManifest(paths.manifest);\n const mode = manifest?.installMode ?? \"daemon\";\n\n // 8.2 Restart daemon service\n if (mode === \"daemon\") {\n if (process.platform === \"darwin\") {\n const plistPath = join(homedir(), \"Library/LaunchAgents/com.abtars.watchdog.plist\");\n const uid = `gui/${process.getuid?.() ?? 501}`;\n try { execSync(`launchctl bootstrap ${uid} \"${plistPath}\"`, { stdio: \"ignore\", timeout: 5000 }); } catch {}\n } else {\n try { execSync(\"systemctl --user daemon-reload\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n try { execSync(\"systemctl --user unmask abtars-watchdog\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n try { execSync(\"systemctl --user enable abtars-watchdog\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n try { execSync(\"systemctl --user start abtars-watchdog\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n }\n process.stdout.write(` Daemon started\\n`);\n } else {\n process.stdout.write(` Deployed. Run 'abtars start' to launch the bridge.\\n`);\n }\n\n // \u2500\u2500 Step 9: Health probe \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n process.stdout.write(`Waiting for bridge health...\\n`);\n const health = await healthProbe(paths.home, Date.now(), 180_000);\n if (health.healthy) {\n process.stdout.write(`\u2713 Bridge healthy (PID ${health.pid}, tick at ${new Date(health.heartbeat!).toISOString()})\\n`);\n writeFileSync(join(paths.home, \"deploy.state\"), JSON.stringify({ status: \"success\", version: staged.version, completedAt: new Date().toISOString() }) + \"\\n\");\n } else {\n process.stderr.write(`\u26A0 Bridge not healthy after 120s \u2014 check logs. Watchdog will keep trying.\\n`);\n writeFileSync(join(paths.home, \"deploy.state\"), JSON.stringify({ status: \"unhealthy\", version: staged.version, completedAt: new Date().toISOString() }) + \"\\n\");\n }\n\n return 0;\n}\n\n// \u2500\u2500 Refresh \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nasync function refresh(paths: ReturnType<typeof packagePaths>, repoRoot: string): Promise<void> {\n // CLI wrappers\n await mkdir(paths.bin, { recursive: true });\n const { writeWrapper } = await import(\"../commands/install.js\");\n const { loadManifest } = await import(\"../install-manifest.js\");\n const installManifest = loadManifest(paths.app);\n for (const name of installManifest.cliWrappers) {\n await writeWrapper(paths.bin, name, paths.app, false);\n }\n\n // abmind CLI wrappers \u2014 point at the bundled copy inside the release\n const abmindDist = join(paths.app, \"node_modules\", \"abmind\", \"dist\", \"cli\");\n if (existsSync(abmindDist)) {\n for (const name of [\"abmind\", \"abmind-embed\"]) {\n const cliFile = name === \"abmind\" ? \"abmind.js\" : `${name}.js`;\n const target = join(abmindDist, cliFile);\n const content = `#!/usr/bin/env bash\\nexport NODE_PATH=\"$HOME/.local/lib/node_modules:\\${NODE_PATH:-}\"\\nexec node \"${target}\" \"$@\"\\n`;\n const dest = join(paths.bin, name);\n try { rmSync(dest); } catch {}\n await writeFile(dest, content, { mode: 0o755 });\n }\n }\n\n process.stdout.write(`\u2713 wrappers refreshed (${installManifest.cliWrappers.length} files)\\n`);\n\n // One-time cleanup: remove stale binary dirs from data directories (#1134)\n const abmindHome = resolveAbmindHome();\n for (const stale of [join(abmindHome, \"bin\"), join(abmindHome, \"current\"), join(abmindHome, \"lib\"), join(paths.home, \"bin\"), join(paths.home, \"scripts\"), join(paths.releasesDir, \"deps\")]) {\n if (existsSync(stale)) {\n rmSync(stale, { recursive: true, force: true });\n process.stdout.write(`\u2713 removed stale ${stale}\\n`);\n }\n }\n\n // Reload plist/systemd if changed (scripts run from repoRoot directly)\n const repoScripts = join(repoRoot, \"scripts\");\n if (process.platform === \"darwin\") {\n const src = join(repoScripts, \"com.abtars.watchdog.plist\");\n const dst = join(homedir(), \"Library/LaunchAgents/com.abtars.watchdog.plist\");\n if (existsSync(src)) {\n let srcContent = readFileSync(src, \"utf-8\").replace(/\\{\\{HOME\\}\\}/g, homedir());\n const dstContent = existsSync(dst) ? readFileSync(dst, \"utf-8\") : \"\";\n if (srcContent !== dstContent) {\n writeFileSync(dst, srcContent);\n const uid = `gui/${process.getuid?.() ?? 501}`;\n try { execSync(`launchctl bootout ${uid}/com.abtars.watchdog 2>/dev/null`, { stdio: \"ignore\", timeout: 5000 }); } catch {}\n try { execSync(`launchctl bootstrap ${uid} \"${dst}\"`, { stdio: \"ignore\", timeout: 5000 }); } catch {}\n process.stdout.write(` \u2713 plist reloaded\\n`);\n }\n }\n } else {\n const src = join(repoScripts, \"abtars-watchdog.service\");\n const dst = join(homedir(), \".config/systemd/user/abtars-watchdog.service\");\n if (existsSync(src) && existsSync(dst)) {\n const srcContent = readFileSync(src, \"utf-8\");\n const dstContent = readFileSync(dst, \"utf-8\");\n if (srcContent !== dstContent) {\n copyFileSync(src, dst);\n try { execSync(\"systemctl --user daemon-reload\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n process.stdout.write(` \u2713 systemd unit reloaded\\n`);\n }\n }\n }\n\n // Reconcile runtime tree from templates\n const { reconcile, migrate } = await import(\"./reconcile.js\");\n const templatesSrc = join(paths.app, \"templates\");\n reconcile(templatesSrc, paths.home);\n migrate(paths.home);\n process.stdout.write(`\u2713 skills + prompts synced\\n`);\n}\n\n// abmind is no longer copied into the release (#1243) \u2014 it is discovered at\n// runtime from the global install. The legacy two-mode copy (sibling-repo\n// rebuild + registry tarball) lived here.\n", "/**\n * LocalBuildSource: the Phase 1 adapter. Builds the current working-tree\n * checkout and stages the output into releases/<version>/dist/.\n *\n * Staleness guard: runs `git fetch` and refuses to proceed if HEAD is behind\n * origin/<branch>, unless allowStale (--local) is passed. Handles the\n * detached-HEAD / no-upstream / unpushed edge cases with a friendly message.\n *\n * Version string: `<package-version>-<short-sha>`, e.g. `0.1.0-28f71ef`.\n * Uniqueness: if the same version is staged twice, the second stage\n * overwrites (rsync --delete semantics via rm + cp). Rare; only happens when\n * operator runs update twice without changing a commit or bumping version.\n */\n\nimport { spawnSync } from 'node:child_process';\nimport { existsSync, cpSync } from 'node:fs';\nimport { copyFile, cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { hashFile } from '../deploy-lib-import.js';\nimport type { PrepareContext, StagedRelease, UpdateSource } from './types.js';\n\nexport class LocalBuildError extends Error {\n constructor(\n message: string,\n public readonly hint?: string,\n ) {\n super(hint ? `${message}\\n\\n${hint}` : message);\n this.name = 'LocalBuildError';\n }\n}\n\nexport interface LocalBuildOptions {\n /** Repository root for the build (defaults to process.cwd()). */\n readonly repoRoot?: string;\n /** If true, skip the behind-origin guard. Operator opt-in. */\n readonly allowStale?: boolean;\n /** If true, skip `npm install` (assume node_modules is already current). */\n readonly skipInstall?: boolean;\n}\n\nfunction runCmd(cmd: string, args: readonly string[], cwd: string): string {\n const r = spawnSync(cmd, args, { cwd, encoding: 'utf-8' });\n if (r.error) throw new LocalBuildError(`${cmd} ${args.join(' ')} failed: ${r.error.message}`);\n if (r.status !== 0) {\n throw new LocalBuildError(\n `${cmd} ${args.join(' ')} exited with status ${r.status}`,\n r.stderr?.trim() || undefined,\n );\n }\n return r.stdout.trim();\n}\n\nfunction tryCmd(cmd: string, args: readonly string[], cwd: string): string | null {\n const r = spawnSync(cmd, args, { cwd, encoding: 'utf-8' });\n if (r.status !== 0) return null;\n return r.stdout.trim();\n}\n\nfunction checkStaleness(repoRoot: string, allowStale: boolean): { commit: string; branch: string | null } {\n const commit = runCmd('git', ['rev-parse', '--short', 'HEAD'], repoRoot);\n const branch = tryCmd('git', ['rev-parse', '--abbrev-ref', 'HEAD'], repoRoot);\n if (allowStale) return { commit, branch: branch === 'HEAD' ? null : branch };\n\n // Detached HEAD / no-branch case\n if (branch === 'HEAD' || branch === null) {\n throw new LocalBuildError(\n 'Working tree is in detached HEAD (no current branch).',\n 'Cannot check for staleness. Pass --local to proceed with the current tree.',\n );\n }\n\n // Fetch to refresh origin refs. Not --unshallow; caller may have a shallow clone intentionally.\n runCmd('git', ['fetch', '--quiet'], repoRoot);\n\n // Does the branch have an upstream?\n const upstream = tryCmd('git', ['rev-parse', '--abbrev-ref', `${branch}@{upstream}`], repoRoot);\n if (upstream === null) {\n throw new LocalBuildError(\n `Branch '${branch}' has no upstream configured.`,\n 'Cannot check for staleness. Push the branch, or pass --local to proceed with the current tree.',\n );\n }\n\n // How many commits is HEAD behind upstream?\n const behindStr = tryCmd('git', ['rev-list', '--count', `HEAD..${upstream}`], repoRoot);\n const behind = behindStr === null ? null : Number(behindStr);\n if (behind === null || !Number.isFinite(behind)) {\n throw new LocalBuildError(\n `Could not determine how far HEAD is behind ${upstream}.`,\n 'Pass --local to proceed anyway.',\n );\n }\n if (behind > 0) {\n throw new LocalBuildError(\n `Current branch: ${branch} (${commit})\\n${upstream} is ahead by ${behind} commit${behind === 1 ? '' : 's'}.`,\n `Run 'git pull' first, or pass --local to build from the current tree.`,\n );\n }\n\n // Enforce dev branch for deployments\n if (branch !== 'dev') {\n throw new LocalBuildError(\n `Current branch is '${branch}', but deployments must come from 'dev'.`,\n `Run 'git checkout dev && git pull', or pass --local to override.`,\n );\n }\n\n return { commit, branch };\n}\n\nasync function readPackageVersion(repoRoot: string): Promise<string> {\n const pkg = JSON.parse(await readFile(join(repoRoot, 'package.json'), 'utf-8')) as { version?: string };\n if (typeof pkg.version !== 'string') {\n throw new LocalBuildError('package.json has no version field.');\n }\n return pkg.version;\n}\n\nexport function makeLocalBuildSource(opts: LocalBuildOptions = {}): UpdateSource {\n const repoRoot = opts.repoRoot ?? process.cwd();\n const isNpmPackage = !existsSync(join(repoRoot, '.git'));\n\n return {\n name: 'dev',\n async prepare(ctx: PrepareContext): Promise<StagedRelease> {\n // npm package mode: no git, no build \u2014 just copy the pre-built bundle\n if (isNpmPackage) {\n const bundleDir = join(repoRoot, 'bundle');\n if (!existsSync(bundleDir)) {\n throw new Error(`No bundle/ found at ${repoRoot}. Run from the abtars npm package or a git checkout.`);\n }\n const pkgVersion = await readPackageVersion(repoRoot);\n const version = pkgVersion;\n const stagedPath = ctx.stagingDir;\n await rm(stagedPath, { recursive: true, force: true });\n await mkdir(stagedPath, { recursive: true });\n await cp(bundleDir, join(stagedPath, 'bundle'), { recursive: true });\n const templatesDir = join(repoRoot, 'templates');\n if (existsSync(templatesDir)) await cp(templatesDir, join(stagedPath, 'templates'), { recursive: true });\n const configSrc = join(repoRoot, 'config');\n if (existsSync(configSrc)) await cp(configSrc, join(stagedPath, 'config'), { recursive: true });\n const manifestSrc = join(repoRoot, 'install-manifest.json');\n if (existsSync(manifestSrc)) await copyFile(manifestSrc, join(stagedPath, 'install-manifest.json'));\n await writeFile(join(stagedPath, 'package.json'), JSON.stringify({ type: \"module\", name: \"abtars\", version }, null, 2) + \"\\n\");\n process.stdout.write(`\u2713 staged ${version} (from npm package)\\n`);\n return { version, stagedPath, commit: null, branch: null, packageLockHash: null, source: 'dev' };\n }\n\n // Git checkout mode: build from source\n const { commit, branch } = checkStaleness(repoRoot, opts.allowStale === true || ctx.allowStale);\n const pkgVersion = await readPackageVersion(repoRoot);\n const version = `${pkgVersion}-${commit}`;\n\n // Install deps into the repo (if not skipped). npm ci wipes node_modules\n // and installs from package-lock.json \u2014 also clears any stale pnpm store\n // (the .pnpm workspace: links that npm cannot parse). (#1234)\n if (opts.skipInstall !== true) {\n runCmd('npm', ['ci'], repoRoot);\n }\n\n // Bundle mode (esbuild) \u2014 build directly, skip npm run bundle (it requires ../abmind)\n runCmd('node', ['esbuild.config.js'], repoRoot);\n const publicSrc = join(repoRoot, 'src', 'components', 'dashboard', 'public');\n if (existsSync(publicSrc)) cpSync(publicSrc, join(repoRoot, 'bundle', 'public'), { recursive: true });\n const agentsSrc = join(repoRoot, 'agents');\n if (existsSync(agentsSrc)) cpSync(agentsSrc, join(repoRoot, 'bundle', 'agents'), { recursive: true });\n\n const stagedPath = ctx.stagingDir;\n await rm(stagedPath, { recursive: true, force: true });\n await mkdir(stagedPath, { recursive: true });\n await cp(join(repoRoot, 'bundle'), join(stagedPath, 'bundle'), { recursive: true });\n\n // Copy templates/ for reconcile (skills, prompts, config seeds, tasks)\n const templatesSrc = join(repoRoot, 'templates');\n if (existsSync(templatesSrc)) {\n await cp(templatesSrc, join(stagedPath, 'templates'), { recursive: true });\n }\n\n // Ensure ESM works\n await writeFile(join(stagedPath, 'package.json'), JSON.stringify({ type: \"module\", name: \"abtars\", version }, null, 2) + \"\\n\");\n\n // Copy install-manifest.json for doctor reconciliation\n await copyFile(join(repoRoot, 'install-manifest.json'), join(stagedPath, 'install-manifest.json'));\n\n const packageLockHash = await hashFile(join(repoRoot, 'package-lock.json'));\n return { version, stagedPath, commit, branch, packageLockHash, source: 'dev' };\n },\n };\n}\n", "/**\n * NpmSource: fetch latest published version directly from npm registry (#1176).\n * Pure HTTP fetch \u2014 no npm/pnpm CLI dependency.\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readFileSync, unlinkSync } from \"node:fs\";\nimport { mkdir, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { resolveVersion, downloadTarball } from \"./registry-client.js\";\nimport type { PrepareContext, StagedRelease, UpdateSource } from \"./types.js\";\n\nconst TAR_TIMEOUT_MS = 60_000;\n\nfunction run(cmd: string, args: string[], cwd: string): string {\n const r = spawnSync(cmd, args, { cwd, encoding: \"utf-8\", timeout: TAR_TIMEOUT_MS });\n if (r.error) throw new Error(`${cmd} ${args.join(\" \")}: ${r.error.message}`);\n if (r.status !== 0) throw new Error(`${cmd} ${args.join(\" \")} exited ${r.status}: ${r.stderr?.trim()}`);\n return r.stdout.trim();\n}\n\nfunction readLocalVersion(home: string): string | null {\n try {\n const pkg = JSON.parse(readFileSync(join(home, \"app\", \"package.json\"), \"utf-8\"));\n return pkg.version ?? null;\n } catch { return null; }\n}\n\nexport function makeNpmSource(packageName: string, tag?: string): UpdateSource {\n const distTag = tag ?? \"latest\";\n const sourceName = distTag === \"alpha\" ? \"alpha\" : \"stable\";\n return {\n name: sourceName,\n async prepare(ctx: PrepareContext): Promise<StagedRelease> {\n const { version, tarballUrl } = await resolveVersion(packageName, distTag);\n const current = readLocalVersion(ctx.home);\n if (version === current) {\n throw new Error(`Already at ${distTag} version (${version}). Nothing to update.`);\n }\n\n const stagedPath = ctx.stagingDir;\n await rm(stagedPath, { recursive: true, force: true });\n await mkdir(stagedPath, { recursive: true });\n\n // Download tarball directly from registry\n const tgzPath = join(stagedPath, `${packageName.replace(\"/\", \"-\")}-${version}.tgz`);\n await downloadTarball(tarballUrl, tgzPath);\n\n // Extract (strip package/ prefix)\n run(\"tar\", [\"-xzf\", tgzPath, \"--strip-components=1\"], stagedPath);\n\n // Cleanup tarball\n if (existsSync(tgzPath)) unlinkSync(tgzPath);\n\n // No dep install \u2014 native deps handled by #1191 (manifest-driven copy from deps/ dir)\n\n return { version, stagedPath, commit: null, branch: null, packageLockHash: null, source: sourceName };\n },\n };\n}\n", "/**\n * registry-client.ts \u2014 Direct npm registry HTTP fetch (#1176).\n * No npm/pnpm CLI dependency. Pure fetch() + tar.\n */\nimport { writeFileSync } from \"node:fs\";\n\nconst REGISTRY = \"https://registry.npmjs.org\";\nconst METADATA_TIMEOUT_MS = 30_000;\nconst TARBALL_TIMEOUT_MS = 120_000;\n\nexport interface ResolvedVersion {\n version: string;\n tarballUrl: string;\n}\n\n/** Resolve a dist-tag (alpha, latest) to a concrete version + tarball URL. */\nexport async function resolveVersion(packageName: string, tag: string): Promise<ResolvedVersion> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), METADATA_TIMEOUT_MS);\n try {\n const res = await fetch(`${REGISTRY}/${packageName}`, {\n headers: { Accept: \"application/vnd.npm.install-v1+json\" },\n signal: controller.signal,\n });\n if (!res.ok) throw new Error(`Registry returned ${res.status} for ${packageName}`);\n const data = await res.json() as { \"dist-tags\"?: Record<string, string>; versions?: Record<string, { dist?: { tarball?: string } }> };\n const version = data[\"dist-tags\"]?.[tag];\n if (!version) throw new Error(`No dist-tag '${tag}' for ${packageName}`);\n const tarballUrl = data.versions?.[version]?.dist?.tarball;\n if (!tarballUrl) throw new Error(`No tarball URL for ${packageName}@${version}`);\n return { version, tarballUrl };\n } finally {\n clearTimeout(timer);\n }\n}\n\n/** Download a tarball to a local file path. */\nexport async function downloadTarball(url: string, destPath: string): Promise<void> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), TARBALL_TIMEOUT_MS);\n try {\n const res = await fetch(url, { signal: controller.signal });\n if (!res.ok) throw new Error(`Tarball download failed: ${res.status} ${url}`);\n const buf = Buffer.from(await res.arrayBuffer());\n writeFileSync(destPath, buf);\n } finally {\n clearTimeout(timer);\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAMA,SAAS,UAAU,eAAe;AAClC,SAAS,QAAAA,aAAY;AACrB,SAAS,cAAAC,aAAY,gBAAAC,eAAc,iBAAAC,gBAAe,QAAQ,UAAAC,SAAQ,WAAW,oBAAoB;AACjG,SAAS,SAAAC,QAAO,aAAAC,kBAAiB;AACjC,SAAS,gBAAgB;AAEzB;;;ACEA,SAAS,iBAAiB;AAC1B,SAAS,YAAY,cAAc;A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GA,QAAM,EAAE,WAAW,QAAQ,IAAI,MAAM,OAAO,yBAAgB;AAC5D,QAAM,eAAeC,MAAK,MAAM,KAAK,WAAW;AAChD,YAAU,cAAc,MAAM,IAAI;AAClC,UAAQ,MAAM,IAAI;AAClB,UAAQ,OAAO,MAAM;AAAA,CAA6B;AACpD;",
4
+ "sourcesContent": ["/**\n * Unified deploy flow. #1085 unified install+update; #1237 split into:\n * - obtain (sync + prepare + abmind) \u2014 fail-safe, may run as old code\n * - deployActivation() \u2014 brick-risk, runs fresh via __deploy\n * deploy() keeps the monolithic path (obtain+activate) for --local and tests.\n */\nimport { hostname, homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { existsSync, readFileSync, writeFileSync, rmSync, cpSync, mkdirSync, copyFileSync } from \"node:fs\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { execSync } from \"node:child_process\";\nimport { acquireLock, cleanStaleStaging, healthProbe, packagePaths, readManifest, writeManifest, emptyManifest } from \"../deploy-lib/index.js\";\nimport { resolveAbmindHome } from \"./paths.js\";\nimport { makeLocalBuildSource } from \"../update-sources/dev.js\";\nimport { makeNpmSource } from \"../update-sources/npm.js\";\nimport type { SourceName, StagedRelease } from \"../update-sources/types.js\";\n\nexport interface DeployOptions {\n readonly source: SourceName;\n readonly localDir?: string;\n readonly skipFreshness?: boolean;\n}\n\nfunction readJsonField(file: string, field: string): unknown {\n try { return JSON.parse(readFileSync(file, \"utf-8\"))[field]; } catch { return undefined; }\n}\n\n/**\n * True when THIS process lives inside the abtars-watchdog.service cgroup (Linux).\n *\n * The `/update dev` bridge command spawns this deploy process detached \u2014 which on\n * Linux is a new session but the SAME cgroup (detached \u2260 new cgroup). The service\n * runs KillMode=control-group, so `systemctl stop`/restarting the unit or killing\n * the watchdog (\u2192 systemd restart \u2192 cgroup teardown) would SIGTERM this very\n * process before it finishes \u2192 nothing respawns (#1299 cgroup suicide).\n *\n * The manual `abtars update --dev` CLI and scripts/emergency-update.sh run from a\n * login shell (a different cgroup) \u2192 returns false \u2192 safe to stop/restart the\n * service (instant, and refreshes the watchdog). macOS has no such cgroup teardown.\n */\nfunction inWatchdogServiceCgroup(): boolean {\n if (process.platform === \"darwin\") return false;\n try {\n return readFileSync(\"/proc/self/cgroup\", \"utf-8\").includes(\"abtars-watchdog.service\");\n } catch {\n return false; // no /proc or unreadable \u2014 assume out-of-cgroup (safe path)\n }\n}\n\n/**\n * Sync source repos into <releasesDir>/src \u2014 clone if missing, fetch+reset if\n * present, nuke+reclone on failure. Throws if a required repo (abtars) cannot\n * be synced. Obtain step \u2014 fail-safe (no release is swapped here).\n */\nexport function syncSrcRepos(srcDir: string, names: readonly string[]): void {\n mkdirSync(srcDir, { recursive: true });\n for (const name of names) {\n const dir = join(srcDir, name);\n try {\n if (existsSync(join(dir, \".git\"))) {\n execSync(\"git fetch --depth 1 origin dev && git reset --hard origin/dev\", { cwd: dir, stdio: \"pipe\", timeout: 30_000 });\n } else {\n rmSync(dir, { recursive: true, force: true });\n execSync(`git clone --depth 1 -b dev https://github.com/aksika/${name}.git`, { cwd: srcDir, stdio: \"pipe\", timeout: 120_000 });\n }\n } catch {\n try {\n rmSync(dir, { recursive: true, force: true });\n execSync(`git clone --depth 1 -b dev https://github.com/aksika/${name}.git`, { cwd: srcDir, stdio: \"pipe\", timeout: 120_000 });\n } catch (err) {\n process.stderr.write(`Failed to sync ${name}: ${err instanceof Error ? err.message : String(err)}\\n`);\n if (name === \"abtars\") throw err;\n }\n }\n }\n}\n\n// abmind is no longer built or bundled by abtars (#1243) \u2014 it ships as a\n// separate global package, discovered at runtime via import(\"abmind\").\n\n/**\n * Monolithic deploy: obtain (sync + prepare + abmind) then activate.\n * Used by `abtars update --local <dir>` and as the single-process path.\n * The bootstrap (#1237) instead obtains, then execs fresh `__deploy` which\n * calls deployActivation() directly.\n */\nexport async function deploy(opts: DeployOptions): Promise<number> {\n const paths = packagePaths(\"abtars\");\n\n if (!opts.localDir) {\n const srcDir = join(paths.releasesDir, \"src\");\n try { syncSrcRepos(srcDir, [\"abtars\"]); } catch { return 1; }\n }\n\n const repoRoot = opts.localDir ?? join(paths.releasesDir, \"src\", \"abtars\");\n if (!existsSync(join(repoRoot, \"package.json\"))) {\n process.stderr.write(`Source not found at ${repoRoot}\\nUse: abtars update --local <DIR>\\n`);\n return 1;\n }\n\n const { migrateIfNeeded } = await import(\"./migrate-layout.js\");\n migrateIfNeeded(paths.home);\n\n const release = await acquireLock(paths.lock, \"deploy\");\n try {\n cleanStaleStaging(paths.appStaging);\n cleanStaleStaging(join(paths.home, 'app.staging')); // legacy #1247 cleanup\n process.stdout.write(`Building from ${repoRoot}...\\n`);\n\n const source = opts.source === \"alpha\" || opts.source === \"stable\"\n ? makeNpmSource(\"abtars\", opts.source === \"alpha\" ? \"alpha\" : \"latest\")\n : makeLocalBuildSource({ repoRoot, allowStale: !!opts.skipFreshness });\n\n const staged = await source.prepare({ stagingDir: paths.appStaging, home: paths.home, allowStale: !!opts.skipFreshness });\n process.stdout.write(`\u2713 staged ${staged.version}\\n`);\n\n return await deployActivation({ staged, channel: opts.source, repoRoot });\n } finally {\n await release();\n }\n}\n\n/**\n * `__deploy` CLI entry \u2014 runs as FRESHLY-staged code (the bundle the bootstrap\n * just produced). Consumes a StagedRelease via flags and performs activation\n * only. Hidden command; stable, forward-compatible arg contract:\n * __deploy --staged <dir> --version <v> [--commit <c>] [--branch <b>]\n * [--channel dev|alpha|stable] [--package-lock-hash <h>] [--repo-root <dir>]\n * Unknown flags are ignored.\n */\nexport async function deployActivationCli(flags: ReadonlyMap<string, string | boolean>): Promise<number> {\n const str = (k: string): string | undefined => (typeof flags.get(k) === \"string\" ? (flags.get(k) as string) : undefined);\n const stagedPath = str(\"staged\");\n if (!stagedPath) {\n process.stderr.write(`__deploy: --staged <dir> is required\\n`);\n return 2;\n }\n const paths = packagePaths(\"abtars\");\n const channel = (str(\"channel\") ?? \"dev\") as SourceName;\n const staged: StagedRelease = {\n version: str(\"version\") ?? \"unknown\",\n stagedPath,\n commit: str(\"commit\") ?? null,\n branch: str(\"branch\") ?? null,\n packageLockHash: str(\"package-lock-hash\") ?? null,\n source: channel,\n };\n const repoRoot = str(\"repo-root\") ?? join(paths.releasesDir, \"src\", \"abtars\");\n\n const { migrateIfNeeded } = await import(\"./migrate-layout.js\");\n migrateIfNeeded(paths.home);\n\n const release = await acquireLock(paths.lock, \"deploy\");\n try {\n return await deployActivation({ staged, channel, repoRoot });\n } finally {\n await release();\n }\n}\n\n/**\n * Activation: stage \u2192 releases/<commit> \u2192 history \u2192 symlink \u2192 refresh \u2192\n * manifest \u2192 stop \u2192 respawn \u2192 healthProbe. BRICK-RISK \u2014 always runs fresh.\n * Caller MUST hold the deploy lock. Does not build/fetch (obtain is done).\n *\n * The stop/respawn sequence (Step 7/8) is FROZEN (abtars.md watchdog) \u2014 moved\n * verbatim from the previous monolithic deploy().\n *\n * BASH MIRROR: scripts/emergency-update.sh reimplements this activation in pure\n * shell as the zero-dependency last resort (no deployed binary needed). If this\n * stop/respawn sequence or the release path layout changes, update it too.\n */\nasync function deployActivation(args: { staged: StagedRelease; channel: SourceName; repoRoot: string }): Promise<number> {\n const { staged, channel, repoRoot } = args;\n const paths = packagePaths(\"abtars\");\n const isFirstInstall = !existsSync(paths.manifest);\n process.stdout.write(`[__deploy] activating ${staged.version} from ${staged.stagedPath}\\n`);\n\n // Validate entry point\n if (!existsSync(join(staged.stagedPath, \"bundle\", \"abtars.js\"))) {\n process.stderr.write(`x entry point not found\\n`);\n return 1;\n }\n\n // \u2500\u2500 Step 3: Deploy to releases dir + repoint symlink \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const { symlinkSync, unlinkSync: unlink } = await import(\"node:fs\");\n mkdirSync(paths.releasesDir, { recursive: true });\n const releaseDir = join(paths.releasesDir, staged.commit || staged.version);\n if (existsSync(releaseDir)) rmSync(releaseDir, { recursive: true, force: true });\n // Copy (not rename): the running __deploy CLI execs from staged.stagedPath;\n // moving it would break code-split dynamic imports. staged/ is reclaimed by\n // cleanStaleStaging on the next bootstrap.\n cpSync(staged.stagedPath, releaseDir, { recursive: true });\n\n // Update history.json (ordered array, max 4, deduped)\n // Dedup ensures history[1] is always a DIFFERENT commit than history[0],\n // so the circuit-breaker rollback target is never the just-deployed version.\n let history: string[] = [];\n try { history = JSON.parse(readFileSync(paths.releasesHistory, \"utf-8\")); } catch {}\n const newRef = staged.commit || staged.version;\n history = history.filter(h => h !== newRef);\n history.unshift(newRef);\n if (history.length > 4) {\n const dropped = history.pop()!;\n rmSync(join(paths.releasesDir, dropped), { recursive: true, force: true });\n }\n writeFileSync(paths.releasesHistory, JSON.stringify(history) + \"\\n\");\n\n // Repoint current symlink\n try { unlink(paths.releasesCurrentLink); } catch {}\n symlinkSync(releaseDir, paths.releasesCurrentLink);\n\n // Keep legacy app/ as symlink for backward compat (WD, bridge.lock paths)\n try { rmSync(paths.app, { recursive: true, force: true }); } catch {}\n symlinkSync(releaseDir, paths.app);\n\n process.stdout.write(`\u2713 deployed to releases/${staged.commit || staged.version}\\n`);\n\n // \u2500\u2500 Step 4: Bootstrap manifest if missing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n if (isFirstInstall) {\n await writeManifest(paths.manifest, {\n ...emptyManifest(\"abtars\", hostname()),\n installMode: \"daemon\",\n source: channel,\n } as any);\n }\n\n // \u2500\u2500 Step 5: Refresh \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n await refresh(paths, repoRoot);\n\n // \u2500\u2500 Step 6: Manifest + deploy.state \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const prior = isFirstInstall ? null : await readManifest(paths.manifest);\n await writeManifest(paths.manifest, {\n ...(prior ?? emptyManifest(\"abtars\", hostname())),\n version: staged.version,\n commit: staged.commit,\n branch: staged.branch,\n packageLockHash: staged.packageLockHash,\n activatedAt: new Date().toISOString(),\n source: channel,\n previousVersion: prior?.version ?? null,\n previousCommit: prior?.commit ?? null,\n installMode: prior?.installMode ?? \"daemon\",\n repoRoot,\n } as any);\n writeFileSync(join(paths.home, \"deploy.state\"), JSON.stringify({ status: \"deploying\", version: staged.version, startedAt: new Date().toISOString() }) + \"\\n\");\n process.stdout.write(`\u2713 manifest updated\\n`);\n\n // \u2500\u2500 Step 7 + 8: Stop + respawn (FROZEN \u2014 abtars.md watchdog; #1299) \u2500\u2500\u2500\n // CGROUP DIVERGENCE (#1299): when this deploy process is inside the\n // abtars-watchdog.service cgroup (the `/update dev` bridge path \u2014 spawned\n // detached but same cgroup, KillMode=control-group), stopping the service or\n // killing the watchdog would SIGTERM THIS process before it finishes. So on\n // that path we touch NEITHER the service NOR the watchdog: we kill only the\n // bridge PID and let the live L3 watchdog (abtars-watchdog.sh poll loop)\n // detect process-gone and respawn the bridge from the freshly-repointed app/\n // symlink. Consequence: a changed abtars-watchdog.sh is NOT picked up on this\n // path \u2014 use scripts/emergency-update.sh (runs OUTSIDE the cgroup) or a manual\n // `abtars update --dev` for a full watchdog refresh.\n // The out-of-cgroup CLI/emergency path and macOS keep the full stop \u2192 kill \u2192\n // respawn sequence below (instant, and refreshes the watchdog).\n // DO NOT re-add `systemctl stop`/watchdog-kill to the in-cgroup branch \u2014 it\n // reintroduces the cgroup-suicide bug.\n const inCgroup = inWatchdogServiceCgroup();\n\n if (!isFirstInstall) {\n if (inCgroup) {\n // In-cgroup (Linux `/update dev`): kill ONLY the bridge; L3 respawns it.\n // No systemctl stop, no watchdog kill, and NO `update:` .start-reason \u2014\n // that would make the live watchdog exit 0 for a systemd restart that\n // tears down (and SIGTERMs) our own cgroup.\n try { rmSync(join(paths.home, \".stopped\")); } catch {}\n const bridgePid = readJsonField(join(paths.home, \"bridge.lock\"), \"pid\") as number | undefined;\n if (bridgePid && bridgePid > 0) {\n try { process.kill(bridgePid, \"SIGTERM\"); } catch {}\n process.stdout.write(` x Killing bridge (PID ${bridgePid}) \u2014 L3 watchdog will respawn from new release...\\n`);\n for (let i = 0; i < 10; i++) {\n await new Promise(r => setTimeout(r, 500));\n try { process.kill(bridgePid, 0); } catch { break; }\n }\n }\n } else {\n // Out-of-cgroup (macOS, or manual `abtars update --dev` from a login\n // shell): full stop sequence \u2014 safe here, and refreshes the watchdog.\n // 7.1 Stop daemon service (tells WD to exit via service manager)\n if (process.platform === \"darwin\") {\n const uid = `gui/${process.getuid?.() ?? 501}`;\n try { execSync(`launchctl bootout ${uid}/com.abtars.watchdog 2>/dev/null`, { stdio: \"ignore\", timeout: 5000 }); } catch {}\n } else {\n try { execSync(\"systemctl --user stop abtars-watchdog\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n }\n\n // 7.2 Write .start-reason = \"update:X\" (safety net if WD survives service stop)\n writeFileSync(join(paths.home, \".start-reason\"), `update:${staged.version}`);\n\n // 7.3 Kill WD PID explicitly (belt)\n const wdPid = readJsonField(join(paths.home, \"bridge.lock\"), \"watchdogPid\") as number | undefined;\n if (wdPid && wdPid > 0) {\n try { process.kill(wdPid, \"SIGTERM\"); } catch {}\n }\n\n // 7.4 Kill bridge PID\n const bridgePid = readJsonField(join(paths.home, \"bridge.lock\"), \"pid\") as number | undefined;\n if (bridgePid && bridgePid > 0) {\n try { process.kill(bridgePid, \"SIGTERM\"); } catch {}\n process.stdout.write(` x Killing bridge (PID ${bridgePid})...\\n`);\n for (let i = 0; i < 10; i++) {\n await new Promise(r => setTimeout(r, 500));\n try { process.kill(bridgePid, 0); } catch { break; }\n }\n }\n\n // 7.5 Wait for WD to die (flock release). SIGKILL after 3s.\n if (wdPid && wdPid > 0) {\n let wdAlive = false;\n for (let i = 0; i < 6; i++) {\n try { process.kill(wdPid, 0); wdAlive = true; } catch { wdAlive = false; break; }\n await new Promise(r => setTimeout(r, 500));\n }\n if (wdAlive) { try { process.kill(wdPid, \"SIGKILL\"); } catch {} }\n }\n\n // 7.6 Clear .stopped sentinel\n try { rmSync(join(paths.home, \".stopped\")); } catch {}\n }\n }\n\n // \u2500\u2500 Step 8: Respawn \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n const manifest = await readManifest(paths.manifest);\n const mode = manifest?.installMode ?? \"daemon\";\n\n if (mode === \"daemon\") {\n if (inCgroup) {\n // Nothing to start \u2014 the live L3 watchdog respawns the bridge from the\n // new app/ symlink after the process-gone kill above.\n process.stdout.write(` Bridge killed \u2014 L3 watchdog respawning from new release\\n`);\n } else {\n // 8.1 Write neutral .start-reason \u2014 new WD won't match any exit case\n writeFileSync(join(paths.home, \".start-reason\"), \"deploy-respawn\");\n // 8.2 Restart daemon service\n if (process.platform === \"darwin\") {\n const plistPath = join(homedir(), \"Library/LaunchAgents/com.abtars.watchdog.plist\");\n const uid = `gui/${process.getuid?.() ?? 501}`;\n try { execSync(`launchctl bootstrap ${uid} \"${plistPath}\"`, { stdio: \"ignore\", timeout: 5000 }); } catch {}\n } else {\n try { execSync(\"systemctl --user daemon-reload\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n try { execSync(\"systemctl --user unmask abtars-watchdog\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n try { execSync(\"systemctl --user enable abtars-watchdog\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n try { execSync(\"systemctl --user start abtars-watchdog\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n }\n process.stdout.write(` Daemon started\\n`);\n }\n } else {\n process.stdout.write(` Deployed. Run 'abtars start' to launch the bridge.\\n`);\n }\n\n // \u2500\u2500 Step 9: Health probe \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n process.stdout.write(`Waiting for bridge health...\\n`);\n const health = await healthProbe(paths.home, Date.now(), 180_000);\n if (health.healthy) {\n process.stdout.write(`\u2713 Bridge healthy (PID ${health.pid}, tick at ${new Date(health.heartbeat!).toISOString()})\\n`);\n writeFileSync(join(paths.home, \"deploy.state\"), JSON.stringify({ status: \"success\", version: staged.version, completedAt: new Date().toISOString() }) + \"\\n\");\n } else {\n process.stderr.write(`\u26A0 Bridge not healthy after 120s \u2014 check logs. Watchdog will keep trying.\\n`);\n writeFileSync(join(paths.home, \"deploy.state\"), JSON.stringify({ status: \"unhealthy\", version: staged.version, completedAt: new Date().toISOString() }) + \"\\n\");\n }\n\n return 0;\n}\n\n// \u2500\u2500 Refresh \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nasync function refresh(paths: ReturnType<typeof packagePaths>, repoRoot: string): Promise<void> {\n // CLI wrappers\n await mkdir(paths.bin, { recursive: true });\n const { writeWrapper } = await import(\"../commands/install.js\");\n const { loadManifest } = await import(\"../install-manifest.js\");\n const installManifest = loadManifest(paths.app);\n for (const name of installManifest.cliWrappers) {\n await writeWrapper(paths.bin, name, paths.app, false);\n }\n\n // abmind CLI wrappers \u2014 point at the bundled copy inside the release\n const abmindDist = join(paths.app, \"node_modules\", \"abmind\", \"dist\", \"cli\");\n if (existsSync(abmindDist)) {\n for (const name of [\"abmind\", \"abmind-embed\"]) {\n const cliFile = name === \"abmind\" ? \"abmind.js\" : `${name}.js`;\n const target = join(abmindDist, cliFile);\n const content = `#!/usr/bin/env bash\\nexport NODE_PATH=\"$HOME/.local/lib/node_modules:\\${NODE_PATH:-}\"\\nexec node \"${target}\" \"$@\"\\n`;\n const dest = join(paths.bin, name);\n try { rmSync(dest); } catch {}\n await writeFile(dest, content, { mode: 0o755 });\n }\n }\n\n process.stdout.write(`\u2713 wrappers refreshed (${installManifest.cliWrappers.length} files)\\n`);\n\n // One-time cleanup: remove stale binary dirs from data directories (#1134)\n const abmindHome = resolveAbmindHome();\n for (const stale of [join(abmindHome, \"bin\"), join(abmindHome, \"current\"), join(abmindHome, \"lib\"), join(paths.home, \"bin\"), join(paths.home, \"scripts\"), join(paths.releasesDir, \"deps\")]) {\n if (existsSync(stale)) {\n rmSync(stale, { recursive: true, force: true });\n process.stdout.write(`\u2713 removed stale ${stale}\\n`);\n }\n }\n\n // Reload plist/systemd if changed (scripts run from repoRoot directly)\n const repoScripts = join(repoRoot, \"scripts\");\n if (process.platform === \"darwin\") {\n const src = join(repoScripts, \"com.abtars.watchdog.plist\");\n const dst = join(homedir(), \"Library/LaunchAgents/com.abtars.watchdog.plist\");\n if (existsSync(src)) {\n let srcContent = readFileSync(src, \"utf-8\").replace(/\\{\\{HOME\\}\\}/g, homedir());\n const dstContent = existsSync(dst) ? readFileSync(dst, \"utf-8\") : \"\";\n if (srcContent !== dstContent) {\n writeFileSync(dst, srcContent);\n const uid = `gui/${process.getuid?.() ?? 501}`;\n try { execSync(`launchctl bootout ${uid}/com.abtars.watchdog 2>/dev/null`, { stdio: \"ignore\", timeout: 5000 }); } catch {}\n try { execSync(`launchctl bootstrap ${uid} \"${dst}\"`, { stdio: \"ignore\", timeout: 5000 }); } catch {}\n process.stdout.write(` \u2713 plist reloaded\\n`);\n }\n }\n } else {\n const src = join(repoScripts, \"abtars-watchdog.service\");\n const dst = join(homedir(), \".config/systemd/user/abtars-watchdog.service\");\n if (existsSync(src) && existsSync(dst)) {\n const srcContent = readFileSync(src, \"utf-8\");\n const dstContent = readFileSync(dst, \"utf-8\");\n if (srcContent !== dstContent) {\n copyFileSync(src, dst);\n try { execSync(\"systemctl --user daemon-reload\", { stdio: \"ignore\", timeout: 5000 }); } catch {}\n process.stdout.write(` \u2713 systemd unit reloaded\\n`);\n }\n }\n }\n\n // Reconcile runtime tree from templates\n const { reconcile, migrate } = await import(\"./reconcile.js\");\n const templatesSrc = join(paths.app, \"templates\");\n reconcile(templatesSrc, paths.home);\n migrate(paths.home);\n process.stdout.write(`\u2713 skills + prompts synced\\n`);\n}\n\n// abmind is no longer copied into the release (#1243) \u2014 it is discovered at\n// runtime from the global install. The legacy two-mode copy (sibling-repo\n// rebuild + registry tarball) lived here.\n", "/**\n * LocalBuildSource: the Phase 1 adapter. Builds the current working-tree\n * checkout and stages the output into releases/<version>/dist/.\n *\n * Staleness guard: runs `git fetch` and refuses to proceed if HEAD is behind\n * origin/<branch>, unless allowStale (--local) is passed. Handles the\n * detached-HEAD / no-upstream / unpushed edge cases with a friendly message.\n *\n * Version string: `<package-version>-<short-sha>`, e.g. `0.1.0-28f71ef`.\n * Uniqueness: if the same version is staged twice, the second stage\n * overwrites (rsync --delete semantics via rm + cp). Rare; only happens when\n * operator runs update twice without changing a commit or bumping version.\n */\n\nimport { spawnSync } from 'node:child_process';\nimport { existsSync, cpSync } from 'node:fs';\nimport { copyFile, cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { hashFile } from '../deploy-lib-import.js';\nimport type { PrepareContext, StagedRelease, UpdateSource } from './types.js';\n\nexport class LocalBuildError extends Error {\n constructor(\n message: string,\n public readonly hint?: string,\n ) {\n super(hint ? `${message}\\n\\n${hint}` : message);\n this.name = 'LocalBuildError';\n }\n}\n\nexport interface LocalBuildOptions {\n /** Repository root for the build (defaults to process.cwd()). */\n readonly repoRoot?: string;\n /** If true, skip the behind-origin guard. Operator opt-in. */\n readonly allowStale?: boolean;\n /** If true, skip `npm install` (assume node_modules is already current). */\n readonly skipInstall?: boolean;\n}\n\nfunction runCmd(cmd: string, args: readonly string[], cwd: string): string {\n const r = spawnSync(cmd, args, { cwd, encoding: 'utf-8' });\n if (r.error) throw new LocalBuildError(`${cmd} ${args.join(' ')} failed: ${r.error.message}`);\n if (r.status !== 0) {\n throw new LocalBuildError(\n `${cmd} ${args.join(' ')} exited with status ${r.status}`,\n r.stderr?.trim() || undefined,\n );\n }\n return r.stdout.trim();\n}\n\nfunction tryCmd(cmd: string, args: readonly string[], cwd: string): string | null {\n const r = spawnSync(cmd, args, { cwd, encoding: 'utf-8' });\n if (r.status !== 0) return null;\n return r.stdout.trim();\n}\n\nfunction checkStaleness(repoRoot: string, allowStale: boolean): { commit: string; branch: string | null } {\n const commit = runCmd('git', ['rev-parse', '--short', 'HEAD'], repoRoot);\n const branch = tryCmd('git', ['rev-parse', '--abbrev-ref', 'HEAD'], repoRoot);\n if (allowStale) return { commit, branch: branch === 'HEAD' ? null : branch };\n\n // Detached HEAD / no-branch case\n if (branch === 'HEAD' || branch === null) {\n throw new LocalBuildError(\n 'Working tree is in detached HEAD (no current branch).',\n 'Cannot check for staleness. Pass --local to proceed with the current tree.',\n );\n }\n\n // Fetch to refresh origin refs. Not --unshallow; caller may have a shallow clone intentionally.\n runCmd('git', ['fetch', '--quiet'], repoRoot);\n\n // Does the branch have an upstream?\n const upstream = tryCmd('git', ['rev-parse', '--abbrev-ref', `${branch}@{upstream}`], repoRoot);\n if (upstream === null) {\n throw new LocalBuildError(\n `Branch '${branch}' has no upstream configured.`,\n 'Cannot check for staleness. Push the branch, or pass --local to proceed with the current tree.',\n );\n }\n\n // How many commits is HEAD behind upstream?\n const behindStr = tryCmd('git', ['rev-list', '--count', `HEAD..${upstream}`], repoRoot);\n const behind = behindStr === null ? null : Number(behindStr);\n if (behind === null || !Number.isFinite(behind)) {\n throw new LocalBuildError(\n `Could not determine how far HEAD is behind ${upstream}.`,\n 'Pass --local to proceed anyway.',\n );\n }\n if (behind > 0) {\n throw new LocalBuildError(\n `Current branch: ${branch} (${commit})\\n${upstream} is ahead by ${behind} commit${behind === 1 ? '' : 's'}.`,\n `Run 'git pull' first, or pass --local to build from the current tree.`,\n );\n }\n\n // Enforce dev branch for deployments\n if (branch !== 'dev') {\n throw new LocalBuildError(\n `Current branch is '${branch}', but deployments must come from 'dev'.`,\n `Run 'git checkout dev && git pull', or pass --local to override.`,\n );\n }\n\n return { commit, branch };\n}\n\nasync function readPackageVersion(repoRoot: string): Promise<string> {\n const pkg = JSON.parse(await readFile(join(repoRoot, 'package.json'), 'utf-8')) as { version?: string };\n if (typeof pkg.version !== 'string') {\n throw new LocalBuildError('package.json has no version field.');\n }\n return pkg.version;\n}\n\nexport function makeLocalBuildSource(opts: LocalBuildOptions = {}): UpdateSource {\n const repoRoot = opts.repoRoot ?? process.cwd();\n const isNpmPackage = !existsSync(join(repoRoot, '.git'));\n\n return {\n name: 'dev',\n async prepare(ctx: PrepareContext): Promise<StagedRelease> {\n // npm package mode: no git, no build \u2014 just copy the pre-built bundle\n if (isNpmPackage) {\n const bundleDir = join(repoRoot, 'bundle');\n if (!existsSync(bundleDir)) {\n throw new Error(`No bundle/ found at ${repoRoot}. Run from the abtars npm package or a git checkout.`);\n }\n const pkgVersion = await readPackageVersion(repoRoot);\n const version = pkgVersion;\n const stagedPath = ctx.stagingDir;\n await rm(stagedPath, { recursive: true, force: true });\n await mkdir(stagedPath, { recursive: true });\n await cp(bundleDir, join(stagedPath, 'bundle'), { recursive: true });\n const templatesDir = join(repoRoot, 'templates');\n if (existsSync(templatesDir)) await cp(templatesDir, join(stagedPath, 'templates'), { recursive: true });\n const configSrc = join(repoRoot, 'config');\n if (existsSync(configSrc)) await cp(configSrc, join(stagedPath, 'config'), { recursive: true });\n const manifestSrc = join(repoRoot, 'install-manifest.json');\n if (existsSync(manifestSrc)) await copyFile(manifestSrc, join(stagedPath, 'install-manifest.json'));\n await writeFile(join(stagedPath, 'package.json'), JSON.stringify({ type: \"module\", name: \"abtars\", version }, null, 2) + \"\\n\");\n process.stdout.write(`\u2713 staged ${version} (from npm package)\\n`);\n return { version, stagedPath, commit: null, branch: null, packageLockHash: null, source: 'dev' };\n }\n\n // Git checkout mode: build from source\n const { commit, branch } = checkStaleness(repoRoot, opts.allowStale === true || ctx.allowStale);\n const pkgVersion = await readPackageVersion(repoRoot);\n const version = `${pkgVersion}-${commit}`;\n\n // Install deps into the repo (if not skipped). npm ci wipes node_modules\n // and installs from package-lock.json \u2014 also clears any stale pnpm store\n // (the .pnpm workspace: links that npm cannot parse). (#1234)\n if (opts.skipInstall !== true) {\n runCmd('npm', ['ci'], repoRoot);\n }\n\n // Bundle mode (esbuild) \u2014 build directly, skip npm run bundle (it requires ../abmind)\n runCmd('node', ['esbuild.config.js'], repoRoot);\n const publicSrc = join(repoRoot, 'src', 'components', 'dashboard', 'public');\n if (existsSync(publicSrc)) cpSync(publicSrc, join(repoRoot, 'bundle', 'public'), { recursive: true });\n const agentsSrc = join(repoRoot, 'agents');\n if (existsSync(agentsSrc)) cpSync(agentsSrc, join(repoRoot, 'bundle', 'agents'), { recursive: true });\n\n const stagedPath = ctx.stagingDir;\n await rm(stagedPath, { recursive: true, force: true });\n await mkdir(stagedPath, { recursive: true });\n await cp(join(repoRoot, 'bundle'), join(stagedPath, 'bundle'), { recursive: true });\n\n // Copy templates/ for reconcile (skills, prompts, config seeds, tasks)\n const templatesSrc = join(repoRoot, 'templates');\n if (existsSync(templatesSrc)) {\n await cp(templatesSrc, join(stagedPath, 'templates'), { recursive: true });\n }\n\n // Ensure ESM works\n await writeFile(join(stagedPath, 'package.json'), JSON.stringify({ type: \"module\", name: \"abtars\", version }, null, 2) + \"\\n\");\n\n // Copy install-manifest.json for doctor reconciliation\n await copyFile(join(repoRoot, 'install-manifest.json'), join(stagedPath, 'install-manifest.json'));\n\n const packageLockHash = await hashFile(join(repoRoot, 'package-lock.json'));\n return { version, stagedPath, commit, branch, packageLockHash, source: 'dev' };\n },\n };\n}\n", "/**\n * NpmSource: fetch latest published version directly from npm registry (#1176).\n * Pure HTTP fetch \u2014 no npm/pnpm CLI dependency.\n */\n\nimport { spawnSync } from \"node:child_process\";\nimport { existsSync, readFileSync, unlinkSync } from \"node:fs\";\nimport { mkdir, rm } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { resolveVersion, downloadTarball } from \"./registry-client.js\";\nimport type { PrepareContext, StagedRelease, UpdateSource } from \"./types.js\";\n\nconst TAR_TIMEOUT_MS = 60_000;\n\nfunction run(cmd: string, args: string[], cwd: string): string {\n const r = spawnSync(cmd, args, { cwd, encoding: \"utf-8\", timeout: TAR_TIMEOUT_MS });\n if (r.error) throw new Error(`${cmd} ${args.join(\" \")}: ${r.error.message}`);\n if (r.status !== 0) throw new Error(`${cmd} ${args.join(\" \")} exited ${r.status}: ${r.stderr?.trim()}`);\n return r.stdout.trim();\n}\n\nfunction readLocalVersion(home: string): string | null {\n try {\n const pkg = JSON.parse(readFileSync(join(home, \"app\", \"package.json\"), \"utf-8\"));\n return pkg.version ?? null;\n } catch { return null; }\n}\n\nexport function makeNpmSource(packageName: string, tag?: string): UpdateSource {\n const distTag = tag ?? \"latest\";\n const sourceName = distTag === \"alpha\" ? \"alpha\" : \"stable\";\n return {\n name: sourceName,\n async prepare(ctx: PrepareContext): Promise<StagedRelease> {\n const { version, tarballUrl } = await resolveVersion(packageName, distTag);\n const current = readLocalVersion(ctx.home);\n if (version === current) {\n throw new Error(`Already at ${distTag} version (${version}). Nothing to update.`);\n }\n\n const stagedPath = ctx.stagingDir;\n await rm(stagedPath, { recursive: true, force: true });\n await mkdir(stagedPath, { recursive: true });\n\n // Download tarball directly from registry\n const tgzPath = join(stagedPath, `${packageName.replace(\"/\", \"-\")}-${version}.tgz`);\n await downloadTarball(tarballUrl, tgzPath);\n\n // Extract (strip package/ prefix)\n run(\"tar\", [\"-xzf\", tgzPath, \"--strip-components=1\"], stagedPath);\n\n // Cleanup tarball\n if (existsSync(tgzPath)) unlinkSync(tgzPath);\n\n // No dep install \u2014 native deps handled by #1191 (manifest-driven copy from deps/ dir)\n\n return { version, stagedPath, commit: null, branch: null, packageLockHash: null, source: sourceName };\n },\n };\n}\n", "/**\n * registry-client.ts \u2014 Direct npm registry HTTP fetch (#1176).\n * No npm/pnpm CLI dependency. Pure fetch() + tar.\n */\nimport { writeFileSync } from \"node:fs\";\n\nconst REGISTRY = \"https://registry.npmjs.org\";\nconst METADATA_TIMEOUT_MS = 30_000;\nconst TARBALL_TIMEOUT_MS = 120_000;\n\nexport interface ResolvedVersion {\n version: string;\n tarballUrl: string;\n}\n\n/** Resolve a dist-tag (alpha, latest) to a concrete version + tarball URL. */\nexport async function resolveVersion(packageName: string, tag: string): Promise<ResolvedVersion> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), METADATA_TIMEOUT_MS);\n try {\n const res = await fetch(`${REGISTRY}/${packageName}`, {\n headers: { Accept: \"application/vnd.npm.install-v1+json\" },\n signal: controller.signal,\n });\n if (!res.ok) throw new Error(`Registry returned ${res.status} for ${packageName}`);\n const data = await res.json() as { \"dist-tags\"?: Record<string, string>; versions?: Record<string, { dist?: { tarball?: string } }> };\n const version = data[\"dist-tags\"]?.[tag];\n if (!version) throw new Error(`No dist-tag '${tag}' for ${packageName}`);\n const tarballUrl = data.versions?.[version]?.dist?.tarball;\n if (!tarballUrl) throw new Error(`No tarball URL for ${packageName}@${version}`);\n return { version, tarballUrl };\n } finally {\n clearTimeout(timer);\n }\n}\n\n/** Download a tarball to a local file path. */\nexport async function downloadTarball(url: string, destPath: string): Promise<void> {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), TARBALL_TIMEOUT_MS);\n try {\n const res = await fetch(url, { signal: controller.signal });\n if (!res.ok) throw new Error(`Tarball download failed: ${res.status} ${url}`);\n const buf = Buffer.from(await res.arrayBuffer());\n writeFileSync(destPath, buf);\n } finally {\n clearTimeout(timer);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAMA,SAAS,UAAU,eAAe;AAClC,SAAS,QAAAA,aAAY;AACrB,SAAS,cAAAC,aAAY,gBAAAC,eAAc,iBAAAC,gBAAe,QAAQ,UAAAC,SAAQ,WAAW,oBAAoB;AACjG,SAAS,SAAAC,QAAO,aAAAC,kBAAiB;AACjC,SAAS,gBAAgB;AAEzB;;;ACEA,SAAS,iBAAiB;AAC1B,SAAS,YAAY,cAAc;AACnC,SAAS,UAAU,IAAI,OAAO,UAAU,IAAI,iBAAiB;AAC7D,SAAS,YAAY;AAId,IAAM,kBAAN,cAA8B,MAAM;AAAA,EACzC,YACE,SACgB,MAChB;AACA,UAAM,OAAO,GAAG,OAAO;AAAA;AAAA,EAAO,IAAI,KAAK,OAAO;AAF9B;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;AAWA,SAAS,OAAO,KAAa,MAAyB,KAAqB;AACzE,QAAM,IAAI,UAAU,KAAK,MAAM,EAAE,KAAK,UAAU,QAAQ,CAAC;AACzD,MAAI,EAAE,MAAO,OAAM,IAAI,gBAAgB,GAAG,GAAG,IAAI,KAAK,KAAK,GAAG,CAAC,YAAY,EAAE,MAAM,OAAO,EAAE;AAC5F,MAAI,EAAE,WAAW,GAAG;AAClB,UAAM,IAAI;AAAA,MACR,GAAG,GAAG,IA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AW,GAAG,GAAG;AACtC,YAAM,aAAaF,cAAa,KAAK,OAAO;AAC5C,YAAM,aAAaA,cAAa,KAAK,OAAO;AAC5C,UAAI,eAAe,YAAY;AAC7B,qBAAa,KAAK,GAAG;AACrB,YAAI;AAAE,mBAAS,kCAAkC,EAAE,OAAO,UAAU,SAAS,IAAK,CAAC;AAAA,QAAG,QAAQ;AAAA,QAAC;AAC/F,gBAAQ,OAAO,MAAM;AAAA,CAA6B;AAAA,MACpD;AAAA,IACF;AAAA,EACF;AAGA,QAAM,EAAE,WAAW,QAAQ,IAAI,MAAM,OAAO,yBAAgB;AAC5D,QAAM,eAAeC,MAAK,MAAM,KAAK,WAAW;AAChD,YAAU,cAAc,MAAM,IAAI;AAClC,UAAQ,MAAM,IAAI;AAClB,UAAQ,OAAO,MAAM;AAAA,CAA6B;AACpD;",
6
6
  "names": ["join", "existsSync", "readFileSync", "writeFileSync", "cpSync", "mkdir", "writeFile", "pkgVersion", "version", "stagedPath", "spawnSync", "existsSync", "mkdir", "rm", "join", "spawnSync", "join", "rm", "mkdir", "existsSync", "readFileSync", "join", "existsSync", "cpSync", "writeFileSync", "mkdir", "writeFile"]
7
7
  }