abtars 0.2.1-alpha.8 → 0.2.1

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 (257) hide show
  1. package/README.md +98 -42
  2. package/bundle/{_registry.generated-ADOYFJJ4.js → _registry.generated-FNJOX7VV.js} +19 -16
  3. package/bundle/{_registry.generated-ADOYFJJ4.js.map → _registry.generated-FNJOX7VV.js.map} +1 -1
  4. package/bundle/abtars-browser.js +5 -6
  5. package/bundle/abtars-browser.js.map +2 -2
  6. package/bundle/abtars-cli.js +339 -271
  7. package/bundle/abtars-cli.js.map +4 -4
  8. package/bundle/abtars-restart.js +4 -4
  9. package/bundle/abtars-rss.js +25 -81
  10. package/bundle/abtars-rss.js.map +2 -2
  11. package/bundle/abtars-task.js +4 -5
  12. package/bundle/abtars-task.js.map +2 -2
  13. package/bundle/abtars-todo.js +133 -0
  14. package/bundle/abtars-todo.js.map +7 -0
  15. package/bundle/abtars.js +239 -155
  16. package/bundle/abtars.js.map +3 -3
  17. package/bundle/action-gate-DYV2XQBP.js +191 -0
  18. package/bundle/action-gate-DYV2XQBP.js.map +7 -0
  19. package/bundle/{agent-api-rate-limit-C25WGSFF.js → agent-api-rate-limit-R2OFAQ3N.js} +4 -4
  20. package/bundle/{agent-registry-SYUFNSVB.js → agent-registry-S2MNHQYQ.js} +8 -8
  21. package/bundle/{bridge-lock-transport-HO545SBK.js → bridge-lock-transport-N6OGDOSE.js} +5 -5
  22. package/bundle/{browse-delivery-VTLEAVYA.js → browse-delivery-DXGMDMXA.js} +8 -7
  23. package/bundle/{browser-REIXOJ6S.js → browser-QMYGSP5W.js} +11 -10
  24. package/bundle/{capability-ILW3D5HS.js → capability-733TLH4W.js} +6 -6
  25. package/bundle/{chunk-ZVDVNSXK.js → chunk-2SWKJX64.js} +7 -7
  26. package/bundle/{chunk-PZE3J7ER.js → chunk-3OXQWII3.js} +2 -2
  27. package/bundle/{chunk-R36WIOYX.js → chunk-3X6VGRL6.js} +33 -6
  28. package/bundle/chunk-3X6VGRL6.js.map +7 -0
  29. package/bundle/{chunk-4KJ76TTE.js → chunk-4XW7YA3K.js} +3 -3
  30. package/bundle/{chunk-Q62SXS73.js → chunk-BBDKU4EH.js} +9 -9
  31. package/bundle/{chunk-EX2SRTUE.js → chunk-CYSGXNBY.js} +2 -2
  32. package/bundle/{chunk-LYEAHE5V.js → chunk-DCY7DGMT.js} +2 -2
  33. package/bundle/chunk-DGS7J4P6.js +13 -0
  34. package/bundle/chunk-DGS7J4P6.js.map +7 -0
  35. package/bundle/{chunk-LDKSCXGL.js → chunk-DHPFI7OF.js} +8 -6
  36. package/bundle/{chunk-LDKSCXGL.js.map → chunk-DHPFI7OF.js.map} +1 -1
  37. package/bundle/{chunk-G6IXMYIO.js → chunk-DO4INSXE.js} +2 -2
  38. package/bundle/{chunk-VA5WKN3Z.js → chunk-EGA6JQVV.js} +4 -4
  39. package/bundle/chunk-EKHNWFEQ.js +85 -0
  40. package/bundle/chunk-EKHNWFEQ.js.map +7 -0
  41. package/bundle/{chunk-URAQLQ2U.js → chunk-F3HMZFIL.js} +4 -4
  42. package/bundle/{chunk-OOKLEC6V.js → chunk-FY3QUO2L.js} +7 -7
  43. package/bundle/{chunk-2BY6I4P5.js → chunk-GUTRAMK3.js} +2 -2
  44. package/bundle/{chunk-GPL57SRN.js → chunk-H7RX7UCR.js} +3 -3
  45. package/bundle/{chunk-BYDUMHXT.js → chunk-HAF2AFBW.js} +2 -2
  46. package/bundle/{chunk-A5OJYQNU.js → chunk-HCYENZAB.js} +49 -22
  47. package/bundle/chunk-HCYENZAB.js.map +7 -0
  48. package/bundle/{chunk-OZ4IZFV4.js → chunk-HJQZP5CK.js} +9 -9
  49. package/bundle/{chunk-OZ4IZFV4.js.map → chunk-HJQZP5CK.js.map} +2 -2
  50. package/bundle/{chunk-HEHD3GG5.js → chunk-ITB2K6LI.js} +6 -13
  51. package/bundle/{chunk-HEHD3GG5.js.map → chunk-ITB2K6LI.js.map} +3 -3
  52. package/bundle/{chunk-KSEIWT4T.js → chunk-JFKOPNKL.js} +10 -10
  53. package/bundle/chunk-JFKOPNKL.js.map +7 -0
  54. package/bundle/{chunk-4BUOO6WI.js → chunk-KL5QRHHK.js} +31 -11
  55. package/bundle/chunk-KL5QRHHK.js.map +7 -0
  56. package/bundle/{chunk-KFENC7BM.js → chunk-L33WNMCP.js} +2 -2
  57. package/bundle/{chunk-JRG4EFMP.js → chunk-LBMETTUP.js} +3 -3
  58. package/bundle/{chunk-TYVI3ZWA.js → chunk-LJAG2URA.js} +10 -7
  59. package/bundle/chunk-LJAG2URA.js.map +7 -0
  60. package/bundle/{chunk-RV54J75Q.js → chunk-MHK4UPM6.js} +13 -12
  61. package/bundle/chunk-MHK4UPM6.js.map +7 -0
  62. package/bundle/chunk-NIYVCGBC.js +330 -0
  63. package/bundle/chunk-NIYVCGBC.js.map +7 -0
  64. package/bundle/{chunk-P2BZSLJJ.js → chunk-OGZXYN6E.js} +392 -125
  65. package/bundle/chunk-OGZXYN6E.js.map +7 -0
  66. package/bundle/{chunk-TOUZC6NR.js → chunk-OKMN6J4Z.js} +3 -3
  67. package/bundle/{chunk-CELR236Q.js → chunk-Q7CH5DA3.js} +2 -2
  68. package/bundle/{chunk-XZSYMCLF.js → chunk-QIAFGDRL.js} +7 -7
  69. package/bundle/chunk-RITEGAW6.js +138 -0
  70. package/bundle/chunk-RITEGAW6.js.map +7 -0
  71. package/bundle/{chunk-UDZIZB5F.js → chunk-RTL7HO3N.js} +3 -3
  72. package/bundle/{chunk-ITG6XGBS.js → chunk-SA44ITVX.js} +10 -10
  73. package/bundle/{chunk-3MO2MDXJ.js → chunk-SA6YEFNG.js} +3 -3
  74. package/bundle/{chunk-GBBTK6H2.js → chunk-SRFEIZQT.js} +4 -4
  75. package/bundle/{chunk-ELRAH7VL.js → chunk-VXUVKC66.js} +3 -3
  76. package/bundle/{chunk-X5FBUA53.js → chunk-WLAVZSVZ.js} +69 -30
  77. package/bundle/chunk-WLAVZSVZ.js.map +7 -0
  78. package/bundle/{chunk-RSWUPUNA.js → chunk-WMWI3SJ7.js} +30 -6
  79. package/bundle/chunk-WMWI3SJ7.js.map +7 -0
  80. package/bundle/{chunk-MJ6PHMOK.js → chunk-WW5F2DCO.js} +11 -2
  81. package/bundle/chunk-WW5F2DCO.js.map +7 -0
  82. package/bundle/chunk-YWZPKBO6.js +22 -0
  83. package/bundle/chunk-YWZPKBO6.js.map +7 -0
  84. package/bundle/{chunk-KWBGYWDO.js → chunk-Z4SWEFIY.js} +12 -14
  85. package/bundle/chunk-Z4SWEFIY.js.map +7 -0
  86. package/bundle/chunk-ZAA7B5BN.js +22 -0
  87. package/bundle/chunk-ZAA7B5BN.js.map +7 -0
  88. package/bundle/{commands-WUGPBPHI.js → commands-AXW7L2MZ.js} +15 -14
  89. package/bundle/{config-DQIGDX4W.js → config-NDEYF4AQ.js} +7 -7
  90. package/bundle/{daemon-NPKYZ3CJ.js → daemon-WOQXCKNL.js} +4 -4
  91. package/bundle/{delegation-tools-6FICZQ5G.js → delegation-tools-Z5OM3TXS.js} +5 -5
  92. package/bundle/{deploy-lib-import-SBKXDD3F.js → deploy-lib-import-6VJTYXEG.js} +2 -2
  93. package/bundle/{deps-HN6CEXA4.js → deps-65V7XXG4.js} +4 -4
  94. package/bundle/{direct-api-transport-TRV45NO6.js → direct-api-transport-LSAUIP5S.js} +27 -15
  95. package/bundle/direct-api-transport-LSAUIP5S.js.map +7 -0
  96. package/bundle/{discord-adapter-WA2MFRK3.js → discord-adapter-LNWTIOUK.js} +27 -24
  97. package/bundle/discord-adapter-LNWTIOUK.js.map +7 -0
  98. package/bundle/{dns-wakeup-RYOCQ6GR.js → dns-wakeup-N46RPU5E.js} +3 -3
  99. package/bundle/{doctor-R54GZPKL.js → doctor-PIPSGI3H.js} +18 -7
  100. package/bundle/{doctor-R54GZPKL.js.map → doctor-PIPSGI3H.js.map} +2 -2
  101. package/bundle/{ensure-invariants-BJIEOSJ2.js → ensure-invariants-3NOBCYWS.js} +4 -4
  102. package/bundle/{env-schema-XCPAJ6IZ.js → env-schema-T43X43BU.js} +4 -4
  103. package/bundle/{hook-system-POI5VRIX.js → hook-system-ZCVOFFRD.js} +4 -4
  104. package/bundle/hotskills-DTROJY6G.js +17 -0
  105. package/bundle/{install-GEXWJYJC.js → install-FZT43PTH.js} +3 -3
  106. package/bundle/{install-manifest-QRWID3KZ.js → install-manifest-KBYD7SAY.js} +3 -3
  107. package/bundle/{irc-adapter-AIEP6OX6.js → irc-adapter-HXO5D4SW.js} +3 -3
  108. package/bundle/{irc-config-6VY67UPQ.js → irc-config-XN5VW2V4.js} +5 -5
  109. package/bundle/{lazy-require-UFYFFX2R.js → lazy-require-R3JYCV5M.js} +4 -4
  110. package/bundle/{media-utils-MOE36VWY.js → media-utils-W7XW3SVV.js} +4 -4
  111. package/bundle/{message-pipeline-2MBT44FO.js → message-pipeline-QX272U5X.js} +17 -14
  112. package/bundle/meta.json +2965 -2294
  113. package/bundle/{notification-U6F5ZBSG.js → notification-ULESRDHB.js} +7 -6
  114. package/bundle/{openrouter-credits-7XXO6QGQ.js → openrouter-credits-PLIKRY5D.js} +4 -4
  115. package/bundle/{paths-ZJYIDND2.js → paths-QQM74XYT.js} +4 -2
  116. package/bundle/{peer-client-T44VI7NB.js → peer-client-D2F5QWRV.js} +8 -8
  117. package/bundle/{peer-config-D5A4454H.js → peer-config-5SUIBJLG.js} +5 -5
  118. package/bundle/{phase-transport-FEZ4SIJJ.js → phase-transport-BSGROTHY.js} +10 -10
  119. package/bundle/restore-Z6MF54HS.js +151 -0
  120. package/bundle/restore-Z6MF54HS.js.map +7 -0
  121. package/bundle/{install-SH4UVUXQ.js → rollback-5RXXLUD6.js} +5 -7
  122. package/bundle/{self-healer-utils-7NFH22VJ.js → self-healer-utils-WPKOVXJD.js} +4 -4
  123. package/bundle/{skill-stats-IPVKMWN3.js → skill-stats-NHNH47QW.js} +5 -5
  124. package/bundle/{sleep-BPWX3FCN.js → sleep-K7EXAFGW.js} +8 -8
  125. package/bundle/{soul-bundle-BRIUDEQ2.js → soul-bundle-QTPWDJB2.js} +7 -7
  126. package/bundle/{soul-loader-GBXJ7EBH.js → soul-loader-LCPTN4PK.js} +8 -8
  127. package/bundle/{sse-parser-anthropic-H42TTLBD.js → sse-parser-anthropic-PYDJM3UC.js} +4 -4
  128. package/bundle/{sse-parser-responses-WG2LY2ML.js → sse-parser-responses-FYT7A5WT.js} +4 -4
  129. package/bundle/{ssrf-guard-E2KBBC5E.js → ssrf-guard-R4P5OCTO.js} +4 -4
  130. package/bundle/{start-CBVKNEAT.js → start-4DNURGIY.js} +1 -1
  131. package/bundle/{stt-CF3CPFDC.js → stt-YN77NND6.js} +5 -5
  132. package/bundle/{subagent-runtime-4MTYUBIZ.js → subagent-runtime-FQAT3564.js} +5 -5
  133. package/bundle/system-event-buffer-OEPPNUGK.js +17 -0
  134. package/bundle/system-event-buffer-OEPPNUGK.js.map +7 -0
  135. package/bundle/{system-message-TALP6GP2.js → system-message-BRU267FW.js} +3 -3
  136. package/bundle/{system-status-GLYXXDE3.js → system-status-7K2QTH3J.js} +58 -51
  137. package/bundle/system-status-7K2QTH3J.js.map +7 -0
  138. package/bundle/{hotskills-6ECHLXTJ.js → task-failure-buffer-DPM5MWZ5.js} +8 -7
  139. package/bundle/{task-store-LC7ZMS72.js → task-store-VCBHAB43.js} +5 -5
  140. package/bundle/{telegram-adapter-BJJYXN7J.js → telegram-adapter-LXLSG4SK.js} +51 -33
  141. package/bundle/telegram-adapter-LXLSG4SK.js.map +7 -0
  142. package/bundle/{tool-registry-T7XLTI2Q.js → tool-registry-5PXNSYOI.js} +12 -9
  143. package/bundle/{tool-sandbox-OZMXJZLQ.js → tool-sandbox-TLAL55QP.js} +5 -5
  144. package/bundle/{transport-config-G5NKQXPJ.js → transport-config-JIKHB7GT.js} +8 -8
  145. package/bundle/update-check-AJMIBQGQ.js +81 -0
  146. package/bundle/update-check-AJMIBQGQ.js.map +7 -0
  147. package/bundle/{user-registry-NUVNEHJU.js → user-registry-PEFDZ5AV.js} +5 -5
  148. package/core/skills/tools/rss/SKILL.md +51 -0
  149. package/install-manifest.json +4 -2
  150. package/package.json +4 -4
  151. package/scripts/build-and-deploy.sh +28 -0
  152. package/scripts/daily-backup.sh +1 -79
  153. package/scripts/doctor.sh +38 -0
  154. package/scripts/emergency-deploy.sh +95 -0
  155. package/scripts/watchdog.sh +51 -5
  156. package/bundle/chunk-4BUOO6WI.js.map +0 -7
  157. package/bundle/chunk-A5OJYQNU.js.map +0 -7
  158. package/bundle/chunk-JX3ZZU3O.js +0 -82
  159. package/bundle/chunk-JX3ZZU3O.js.map +0 -7
  160. package/bundle/chunk-KJOCXWJ5.js +0 -131
  161. package/bundle/chunk-KJOCXWJ5.js.map +0 -7
  162. package/bundle/chunk-KSEIWT4T.js.map +0 -7
  163. package/bundle/chunk-KWBGYWDO.js.map +0 -7
  164. package/bundle/chunk-MJ6PHMOK.js.map +0 -7
  165. package/bundle/chunk-P2BZSLJJ.js.map +0 -7
  166. package/bundle/chunk-R36WIOYX.js.map +0 -7
  167. package/bundle/chunk-RE3F3CFW.js +0 -300
  168. package/bundle/chunk-RE3F3CFW.js.map +0 -7
  169. package/bundle/chunk-RJJWPMUZ.js +0 -411
  170. package/bundle/chunk-RJJWPMUZ.js.map +0 -7
  171. package/bundle/chunk-RSWUPUNA.js.map +0 -7
  172. package/bundle/chunk-RV54J75Q.js.map +0 -7
  173. package/bundle/chunk-RVERPUHT.js +0 -289
  174. package/bundle/chunk-RVERPUHT.js.map +0 -7
  175. package/bundle/chunk-TYVI3ZWA.js.map +0 -7
  176. package/bundle/chunk-X5FBUA53.js.map +0 -7
  177. package/bundle/deploy-lib-import-HCMZCKZD.js +0 -50
  178. package/bundle/direct-api-transport-TRV45NO6.js.map +0 -7
  179. package/bundle/discord-adapter-WA2MFRK3.js.map +0 -7
  180. package/bundle/restore-ROJF22R2.js +0 -47
  181. package/bundle/restore-ROJF22R2.js.map +0 -7
  182. package/bundle/system-status-GLYXXDE3.js.map +0 -7
  183. package/bundle/telegram-adapter-BJJYXN7J.js.map +0 -7
  184. package/bundle/update-check-O5MS6B3L.js +0 -13
  185. package/bundle/user-registry-NUVNEHJU.js.map +0 -7
  186. /package/bundle/{agent-api-rate-limit-C25WGSFF.js.map → agent-api-rate-limit-R2OFAQ3N.js.map} +0 -0
  187. /package/bundle/{agent-registry-SYUFNSVB.js.map → agent-registry-S2MNHQYQ.js.map} +0 -0
  188. /package/bundle/{bridge-lock-transport-HO545SBK.js.map → bridge-lock-transport-N6OGDOSE.js.map} +0 -0
  189. /package/bundle/{browse-delivery-VTLEAVYA.js.map → browse-delivery-DXGMDMXA.js.map} +0 -0
  190. /package/bundle/{browser-REIXOJ6S.js.map → browser-QMYGSP5W.js.map} +0 -0
  191. /package/bundle/{capability-ILW3D5HS.js.map → capability-733TLH4W.js.map} +0 -0
  192. /package/bundle/{chunk-ZVDVNSXK.js.map → chunk-2SWKJX64.js.map} +0 -0
  193. /package/bundle/{chunk-PZE3J7ER.js.map → chunk-3OXQWII3.js.map} +0 -0
  194. /package/bundle/{chunk-4KJ76TTE.js.map → chunk-4XW7YA3K.js.map} +0 -0
  195. /package/bundle/{chunk-Q62SXS73.js.map → chunk-BBDKU4EH.js.map} +0 -0
  196. /package/bundle/{chunk-EX2SRTUE.js.map → chunk-CYSGXNBY.js.map} +0 -0
  197. /package/bundle/{chunk-LYEAHE5V.js.map → chunk-DCY7DGMT.js.map} +0 -0
  198. /package/bundle/{chunk-G6IXMYIO.js.map → chunk-DO4INSXE.js.map} +0 -0
  199. /package/bundle/{chunk-VA5WKN3Z.js.map → chunk-EGA6JQVV.js.map} +0 -0
  200. /package/bundle/{chunk-URAQLQ2U.js.map → chunk-F3HMZFIL.js.map} +0 -0
  201. /package/bundle/{chunk-OOKLEC6V.js.map → chunk-FY3QUO2L.js.map} +0 -0
  202. /package/bundle/{chunk-2BY6I4P5.js.map → chunk-GUTRAMK3.js.map} +0 -0
  203. /package/bundle/{chunk-GPL57SRN.js.map → chunk-H7RX7UCR.js.map} +0 -0
  204. /package/bundle/{chunk-BYDUMHXT.js.map → chunk-HAF2AFBW.js.map} +0 -0
  205. /package/bundle/{chunk-KFENC7BM.js.map → chunk-L33WNMCP.js.map} +0 -0
  206. /package/bundle/{chunk-JRG4EFMP.js.map → chunk-LBMETTUP.js.map} +0 -0
  207. /package/bundle/{chunk-TOUZC6NR.js.map → chunk-OKMN6J4Z.js.map} +0 -0
  208. /package/bundle/{chunk-CELR236Q.js.map → chunk-Q7CH5DA3.js.map} +0 -0
  209. /package/bundle/{chunk-XZSYMCLF.js.map → chunk-QIAFGDRL.js.map} +0 -0
  210. /package/bundle/{chunk-UDZIZB5F.js.map → chunk-RTL7HO3N.js.map} +0 -0
  211. /package/bundle/{chunk-ITG6XGBS.js.map → chunk-SA44ITVX.js.map} +0 -0
  212. /package/bundle/{chunk-3MO2MDXJ.js.map → chunk-SA6YEFNG.js.map} +0 -0
  213. /package/bundle/{chunk-GBBTK6H2.js.map → chunk-SRFEIZQT.js.map} +0 -0
  214. /package/bundle/{chunk-ELRAH7VL.js.map → chunk-VXUVKC66.js.map} +0 -0
  215. /package/bundle/{commands-WUGPBPHI.js.map → commands-AXW7L2MZ.js.map} +0 -0
  216. /package/bundle/{config-DQIGDX4W.js.map → config-NDEYF4AQ.js.map} +0 -0
  217. /package/bundle/{daemon-NPKYZ3CJ.js.map → daemon-WOQXCKNL.js.map} +0 -0
  218. /package/bundle/{delegation-tools-6FICZQ5G.js.map → delegation-tools-Z5OM3TXS.js.map} +0 -0
  219. /package/bundle/{deploy-lib-import-HCMZCKZD.js.map → deploy-lib-import-6VJTYXEG.js.map} +0 -0
  220. /package/bundle/{deps-HN6CEXA4.js.map → deps-65V7XXG4.js.map} +0 -0
  221. /package/bundle/{dns-wakeup-RYOCQ6GR.js.map → dns-wakeup-N46RPU5E.js.map} +0 -0
  222. /package/bundle/{ensure-invariants-BJIEOSJ2.js.map → ensure-invariants-3NOBCYWS.js.map} +0 -0
  223. /package/bundle/{deploy-lib-import-SBKXDD3F.js.map → env-schema-T43X43BU.js.map} +0 -0
  224. /package/bundle/{env-schema-XCPAJ6IZ.js.map → hook-system-ZCVOFFRD.js.map} +0 -0
  225. /package/bundle/{hook-system-POI5VRIX.js.map → hotskills-DTROJY6G.js.map} +0 -0
  226. /package/bundle/{hotskills-6ECHLXTJ.js.map → install-FZT43PTH.js.map} +0 -0
  227. /package/bundle/{install-manifest-QRWID3KZ.js.map → install-manifest-KBYD7SAY.js.map} +0 -0
  228. /package/bundle/{irc-adapter-AIEP6OX6.js.map → irc-adapter-HXO5D4SW.js.map} +0 -0
  229. /package/bundle/{irc-config-6VY67UPQ.js.map → irc-config-XN5VW2V4.js.map} +0 -0
  230. /package/bundle/{install-GEXWJYJC.js.map → lazy-require-R3JYCV5M.js.map} +0 -0
  231. /package/bundle/{media-utils-MOE36VWY.js.map → media-utils-W7XW3SVV.js.map} +0 -0
  232. /package/bundle/{install-SH4UVUXQ.js.map → message-pipeline-QX272U5X.js.map} +0 -0
  233. /package/bundle/{lazy-require-UFYFFX2R.js.map → notification-ULESRDHB.js.map} +0 -0
  234. /package/bundle/{openrouter-credits-7XXO6QGQ.js.map → openrouter-credits-PLIKRY5D.js.map} +0 -0
  235. /package/bundle/{message-pipeline-2MBT44FO.js.map → paths-QQM74XYT.js.map} +0 -0
  236. /package/bundle/{peer-client-T44VI7NB.js.map → peer-client-D2F5QWRV.js.map} +0 -0
  237. /package/bundle/{notification-U6F5ZBSG.js.map → peer-config-5SUIBJLG.js.map} +0 -0
  238. /package/bundle/{paths-ZJYIDND2.js.map → phase-transport-BSGROTHY.js.map} +0 -0
  239. /package/bundle/{peer-config-D5A4454H.js.map → rollback-5RXXLUD6.js.map} +0 -0
  240. /package/bundle/{self-healer-utils-7NFH22VJ.js.map → self-healer-utils-WPKOVXJD.js.map} +0 -0
  241. /package/bundle/{phase-transport-FEZ4SIJJ.js.map → skill-stats-NHNH47QW.js.map} +0 -0
  242. /package/bundle/{skill-stats-IPVKMWN3.js.map → sleep-K7EXAFGW.js.map} +0 -0
  243. /package/bundle/{sleep-BPWX3FCN.js.map → soul-bundle-QTPWDJB2.js.map} +0 -0
  244. /package/bundle/{soul-bundle-BRIUDEQ2.js.map → soul-loader-LCPTN4PK.js.map} +0 -0
  245. /package/bundle/{sse-parser-anthropic-H42TTLBD.js.map → sse-parser-anthropic-PYDJM3UC.js.map} +0 -0
  246. /package/bundle/{sse-parser-responses-WG2LY2ML.js.map → sse-parser-responses-FYT7A5WT.js.map} +0 -0
  247. /package/bundle/{ssrf-guard-E2KBBC5E.js.map → ssrf-guard-R4P5OCTO.js.map} +0 -0
  248. /package/bundle/{start-CBVKNEAT.js.map → start-4DNURGIY.js.map} +0 -0
  249. /package/bundle/{soul-loader-GBXJ7EBH.js.map → stt-YN77NND6.js.map} +0 -0
  250. /package/bundle/{stt-CF3CPFDC.js.map → subagent-runtime-FQAT3564.js.map} +0 -0
  251. /package/bundle/{system-message-TALP6GP2.js.map → system-message-BRU267FW.js.map} +0 -0
  252. /package/bundle/{subagent-runtime-4MTYUBIZ.js.map → task-failure-buffer-DPM5MWZ5.js.map} +0 -0
  253. /package/bundle/{task-store-LC7ZMS72.js.map → task-store-VCBHAB43.js.map} +0 -0
  254. /package/bundle/{tool-registry-T7XLTI2Q.js.map → tool-registry-5PXNSYOI.js.map} +0 -0
  255. /package/bundle/{tool-sandbox-OZMXJZLQ.js.map → tool-sandbox-TLAL55QP.js.map} +0 -0
  256. /package/bundle/{transport-config-G5NKQXPJ.js.map → transport-config-JIKHB7GT.js.map} +0 -0
  257. /package/bundle/{update-check-O5MS6B3L.js.map → user-registry-PEFDZ5AV.js.map} +0 -0
@@ -2,7 +2,10 @@
2
2
  import { createRequire as __bundleCreateRequire } from 'node:module'; import { fileURLToPath as __bundleFileURLToPath } from 'node:url'; import { dirname as __bundleDirname } from 'node:path'; const require = __bundleCreateRequire(import.meta.url); const __chunk_filename = __bundleFileURLToPath(import.meta.url); const __chunk_dirname = __bundleDirname(__chunk_filename);
3
3
  import {
4
4
  install
5
- } from "./chunk-4BUOO6WI.js";
5
+ } from "./chunk-KL5QRHHK.js";
6
+ import {
7
+ rollback
8
+ } from "./chunk-EKHNWFEQ.js";
6
9
  import {
7
10
  acquireLock,
8
11
  atomicSwap,
@@ -16,19 +19,19 @@ import {
16
19
  readSentinel,
17
20
  writeManifest,
18
21
  writeSentinel
19
- } from "./chunk-RSWUPUNA.js";
22
+ } from "./chunk-WMWI3SJ7.js";
20
23
  import {
21
24
  restart
22
- } from "./chunk-URAQLQ2U.js";
25
+ } from "./chunk-F3HMZFIL.js";
23
26
  import {
24
27
  init_log_and_swallow,
25
28
  logAndSwallow
26
- } from "./chunk-EX2SRTUE.js";
27
- import "./chunk-2BY6I4P5.js";
29
+ } from "./chunk-CYSGXNBY.js";
30
+ import "./chunk-GUTRAMK3.js";
28
31
  import {
29
32
  abtarsHome,
30
33
  init_paths
31
- } from "./chunk-MJ6PHMOK.js";
34
+ } from "./chunk-WW5F2DCO.js";
32
35
  import {
33
36
  __require
34
37
  } from "./chunk-7K2YZTLD.js";
@@ -301,112 +304,203 @@ async function uninstall(opts) {
301
304
 
302
305
  // src/cli/commands/backup.ts
303
306
  init_paths();
304
- import { existsSync as existsSync3, mkdirSync, readdirSync as readdirSync2, statSync, renameSync, unlinkSync as unlinkSync3, copyFileSync } from "node:fs";
305
- import { join as join4, dirname } from "node:path";
307
+ import { existsSync as existsSync3, mkdirSync, readdirSync as readdirSync2, statSync, unlinkSync as unlinkSync3, renameSync, readFileSync as readFileSync2, writeFileSync } from "node:fs";
308
+ import { join as join4, dirname, basename } from "node:path";
306
309
  import { spawnSync } from "node:child_process";
307
- var AB_SAVE = ["config", "secret", "tasks", "logo", "workspace", "skills/custom", "skills/self"];
310
+ import { createCipheriv, hkdfSync, randomBytes } from "node:crypto";
308
311
  var DEFAULT_PRUNE_DAYS = 7;
309
- async function backup(outputDir, pruneDays) {
312
+ var ABTARS_EXCLUDE = [
313
+ "releases",
314
+ "current",
315
+ "bin",
316
+ "app",
317
+ "app.prev*",
318
+ "app.staging",
319
+ "app.broken",
320
+ "logs",
321
+ "node_modules",
322
+ "overflow",
323
+ "browser-socket",
324
+ "src",
325
+ "bridge.lock",
326
+ "watchdog.lock",
327
+ "browse-spawn.sock",
328
+ "manifest.json",
329
+ "*.sock"
330
+ ];
331
+ var ABMIND_EXCLUDE = [
332
+ "memory/memory.db",
333
+ "lib",
334
+ "node_modules",
335
+ "backups",
336
+ "*.sock",
337
+ "*.db-wal",
338
+ "*.db-shm"
339
+ ];
340
+ var CONFIG_DIRS = ["config", "secret", "tasks", "skills", "core", "agents"];
341
+ async function backup(opts = {}) {
310
342
  const abHome = abtarsHome();
343
+ const abmindHome = process.env["ABMIND_HOME"] ?? join4(dirname(abHome), ".abmind");
311
344
  const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
312
- const destDir = outputDir ?? join4(dirname(abHome), ".backup-abtars");
345
+ const destDir = opts.outputDir ?? join4(dirname(abHome), ".backup-abtars");
313
346
  mkdirSync(destDir, { recursive: true });
314
- const abmindPaths = [
315
- join4(dirname(abHome), ".abmind", "lib", "node_modules", "abmind", "dist", "cli", "abmind-backup.js"),
316
- join4(dirname(abHome), "workspace", "ab", "abmind", "dist", "cli", "abmind-backup.js")
317
- ];
318
- const abmindBin = abmindPaths.find((p) => existsSync3(p));
319
- let abmResult;
320
- if (abmindBin) {
321
- abmResult = spawnSync("node", [abmindBin], { encoding: "utf-8", env: { ...process.env } });
347
+ const isConfig = opts.config === true;
348
+ const prefix = isConfig ? `abtars-config-${date}` : `abtars-${date}`;
349
+ const zipExcludes = [];
350
+ if (isConfig) {
322
351
  } else {
323
- abmResult = spawnSync("abmind", ["backup"], { encoding: "utf-8", env: { ...process.env } });
324
- }
325
- if (abmResult.status !== 0) {
326
- process.stderr.write(`\u26A0\uFE0F abmind backup failed: ${abmResult.stderr || abmResult.stdout}
327
- `);
328
- return 1;
329
- }
330
- const abmindBackupsDir = join4(dirname(abHome), ".abmind", "backups");
331
- let abmFile;
332
- if (existsSync3(abmindBackupsDir)) {
333
- const abmFiles = readdirSync2(abmindBackupsDir).filter((f) => f.endsWith(".abm")).sort().reverse();
334
- if (abmFiles.length > 0) abmFile = abmFiles[0];
335
- }
336
- if (abmFile) {
337
- const src = join4(abmindBackupsDir, abmFile);
338
- const dest = join4(destDir, `abmind-${date}.abm`);
339
- renameSync(src, dest);
340
- const size = (statSync(dest).size / 1024).toFixed(0);
341
- process.stdout.write(`\u2713 abmind-${date}.abm (${size}KB, encrypted)
342
- `);
343
- } else {
344
- process.stderr.write(`\u26A0\uFE0F abmind backup produced no .abm file
345
- `);
346
- }
347
- const files = [];
348
- for (const dir of AB_SAVE) {
349
- const abs = join4(abHome, dir);
350
- if (existsSync3(abs)) collectDir(abs, dir, files);
351
- }
352
- if (files.length === 0) {
353
- process.stderr.write("Nothing to zip from abtars.\n");
354
- return 1;
355
- }
356
- const tmpDir = join4(process.env["TMPDIR"] ?? "/tmp", `abtars-backup-${Date.now()}`);
357
- mkdirSync(tmpDir, { recursive: true });
358
- for (const f of files) {
359
- const dest = join4(tmpDir, f.zipPath);
360
- mkdirSync(dirname(dest), { recursive: true });
361
- copyFileSync(f.absPath, dest);
352
+ for (const ex of ABTARS_EXCLUDE) {
353
+ zipExcludes.push(`${ex}/*`, ex);
354
+ }
355
+ zipExcludes.push("*.db-wal", "*.db-shm", "*.sock");
362
356
  }
363
- const zipPath = join4(destDir, `abtars-${date}.zip`);
364
357
  const has7z = spawnSync("which", ["7z"], { encoding: "utf-8" }).status === 0;
358
+ const zipExt = has7z ? ".7z" : ".zip";
359
+ let zipPath = join4(destDir, prefix + zipExt);
365
360
  let zipOk;
366
- if (has7z) {
367
- const r = spawnSync("7z", ["a", zipPath.replace(/\.zip$/, ".7z"), "."], { cwd: tmpDir, encoding: "utf-8" });
368
- zipOk = r.status === 0;
361
+ if (isConfig) {
362
+ const existingDirs = CONFIG_DIRS.filter((d) => existsSync3(join4(abHome, d)));
363
+ if (existingDirs.length === 0) {
364
+ process.stderr.write("Nothing to backup \u2014 no config dirs found\n");
365
+ return 1;
366
+ }
367
+ if (has7z) {
368
+ const r = spawnSync("7z", ["a", zipPath, ...existingDirs], { cwd: abHome, encoding: "utf-8" });
369
+ zipOk = r.status === 0;
370
+ } else {
371
+ const r = spawnSync("zip", ["-qr", zipPath, ...existingDirs], { cwd: abHome, encoding: "utf-8" });
372
+ zipOk = r.status === 0;
373
+ }
369
374
  } else {
370
- const r = spawnSync("zip", ["-r", zipPath, "."], { cwd: tmpDir, encoding: "utf-8" });
371
- zipOk = r.status === 0;
375
+ if (has7z) {
376
+ const excludeArgs = ABTARS_EXCLUDE.flatMap((ex) => ["-xr!" + ex]);
377
+ excludeArgs.push("-xr!*.db-wal", "-xr!*.db-shm", "-xr!*.sock");
378
+ const r = spawnSync("7z", ["a", zipPath, ".", ...excludeArgs], { cwd: abHome, encoding: "utf-8" });
379
+ zipOk = r.status === 0;
380
+ } else {
381
+ const excludeArgs = ABTARS_EXCLUDE.flatMap((ex) => ["-x", `${ex}/*`, "-x", ex]);
382
+ excludeArgs.push("-x", "*.db-wal", "-x", "*.db-shm", "-x", "*.sock");
383
+ const r = spawnSync("zip", ["-qr", zipPath, ".", ...excludeArgs], { cwd: abHome, encoding: "utf-8" });
384
+ zipOk = r.status === 0;
385
+ }
386
+ if (zipOk && existsSync3(abmindHome)) {
387
+ if (has7z) {
388
+ const excludeArgs = ABMIND_EXCLUDE.flatMap((ex) => ["-xr!" + ex]);
389
+ const r = spawnSync("7z", ["a", zipPath, ".", ...excludeArgs], { cwd: abmindHome, encoding: "utf-8" });
390
+ zipOk = r.status === 0;
391
+ } else {
392
+ const excludeArgs = ABMIND_EXCLUDE.flatMap((ex) => ["-x", `${ex}/*`, "-x", ex]);
393
+ const r = spawnSync("zip", ["-qr", zipPath, "-g", ".", ...excludeArgs], { cwd: abmindHome, encoding: "utf-8" });
394
+ zipOk = r.status === 0;
395
+ }
396
+ }
397
+ const dbPath = join4(abmindHome, "memory", "memory.db");
398
+ if (zipOk && existsSync3(dbPath)) {
399
+ const tmpDb = join4(process.env["TMPDIR"] ?? "/tmp", `abtars-backup-memory-${Date.now()}.db`);
400
+ const sqliteResult = spawnSync("sqlite3", [dbPath, `.backup '${tmpDb}'`], { encoding: "utf-8" });
401
+ if (sqliteResult.status === 0 && existsSync3(tmpDb)) {
402
+ if (has7z) {
403
+ spawnSync("7z", ["a", zipPath, tmpDb], { encoding: "utf-8" });
404
+ } else {
405
+ spawnSync("zip", ["-qj", zipPath, tmpDb], { encoding: "utf-8" });
406
+ }
407
+ try {
408
+ unlinkSync3(tmpDb);
409
+ } catch {
410
+ }
411
+ }
412
+ }
372
413
  }
373
- spawnSync("rm", ["-rf", tmpDir]);
374
414
  if (!zipOk) {
375
- process.stderr.write(`\u26A0\uFE0F zip/7z failed
376
- `);
415
+ process.stderr.write("Backup zip failed\n");
377
416
  return 1;
378
417
  }
379
- const actualZip = has7z ? zipPath.replace(/\.zip$/, ".7z") : zipPath;
380
- const sizeMb = (statSync(actualZip).size / 1024 / 1024).toFixed(1);
381
- process.stdout.write(`\u2713 ${actualZip.split("/").pop()} (${sizeMb}MB, ${files.length} files)
418
+ if (!isConfig) {
419
+ const actual = statSync(zipPath).size;
420
+ if (actual < 1e5) {
421
+ process.stderr.write(`\u26A0\uFE0F Backup suspiciously small (${actual} bytes)
382
422
  `);
383
- const maxAge = (pruneDays ?? DEFAULT_PRUNE_DAYS) * 864e5;
384
- const now = Date.now();
385
- for (const f of readdirSync2(destDir)) {
386
- if (!(f.startsWith("abtars-") || f.startsWith("abmind-"))) continue;
387
- if (!(f.endsWith(".zip") || f.endsWith(".7z") || f.endsWith(".abm"))) continue;
388
- const fPath = join4(destDir, f);
389
- try {
390
- if (now - statSync(fPath).mtimeMs > maxAge) {
391
- unlinkSync3(fPath);
392
- process.stdout.write(` \u{1F5D1} pruned ${f}
423
+ }
424
+ }
425
+ const zipSize = (statSync(zipPath).size / 1024 / 1024).toFixed(1);
426
+ process.stdout.write(`\u2713 ${basename(zipPath)} (${zipSize}MB)
427
+ `);
428
+ if (opts.encrypt) {
429
+ const encPath = zipPath + ".enc";
430
+ const ok = encryptFile(zipPath, encPath, abmindHome);
431
+ if (!ok) return 1;
432
+ unlinkSync3(zipPath);
433
+ zipPath = encPath;
434
+ process.stdout.write(`\u2713 encrypted \u2192 ${basename(encPath)}
435
+ `);
436
+ }
437
+ if (!isConfig) {
438
+ const abmResult = runAbmindBackup(abHome, abmindHome);
439
+ if (abmResult) {
440
+ const dest = join4(destDir, `abmind-${date}.abm`);
441
+ renameSync(abmResult, dest);
442
+ const size = (statSync(dest).size / 1024).toFixed(0);
443
+ process.stdout.write(`\u2713 abmind-${date}.abm (${size}KB, encrypted)
444
+ `);
445
+ } else {
446
+ process.stderr.write("\u26A0\uFE0F abmind backup failed or produced no .abm\n");
447
+ }
448
+ }
449
+ const pruneDays = opts.pruneDays ?? DEFAULT_PRUNE_DAYS;
450
+ if (pruneDays > 0) {
451
+ const maxAge = pruneDays * 864e5;
452
+ const now = Date.now();
453
+ for (const f of readdirSync2(destDir)) {
454
+ if (!(f.startsWith("abtars-") || f.startsWith("abmind-"))) continue;
455
+ if (!(f.endsWith(".zip") || f.endsWith(".7z") || f.endsWith(".abm") || f.endsWith(".enc"))) continue;
456
+ const fPath = join4(destDir, f);
457
+ try {
458
+ if (now - statSync(fPath).mtimeMs > maxAge) {
459
+ unlinkSync3(fPath);
460
+ process.stdout.write(` \u{1F5D1} pruned ${f}
393
461
  `);
462
+ }
463
+ } catch {
394
464
  }
395
- } catch {
396
465
  }
397
466
  }
398
467
  return 0;
399
468
  }
400
- function collectDir(dir, prefix, out) {
401
- for (const entry of readdirSync2(dir, { withFileTypes: true })) {
402
- const abs = join4(dir, entry.name);
403
- const rel = `${prefix}/${entry.name}`;
404
- if (entry.isDirectory()) {
405
- collectDir(abs, rel, out);
406
- } else if (entry.isFile()) {
407
- out.push({ absPath: abs, zipPath: rel });
408
- }
469
+ function runAbmindBackup(abHome, abmindHome) {
470
+ const abmindPaths = [
471
+ join4(dirname(abHome), "workspace", "ab", "abmind", "dist", "cli", "abmind-backup.js"),
472
+ join4(abmindHome, "lib", "node_modules", "abmind", "dist", "cli", "abmind-backup.js")
473
+ ];
474
+ const abmindBin = abmindPaths.find((p) => existsSync3(p));
475
+ let result;
476
+ if (abmindBin) {
477
+ result = spawnSync("node", [abmindBin], { encoding: "utf-8", env: { ...process.env } });
478
+ } else {
479
+ result = spawnSync("abmind", ["backup"], { encoding: "utf-8", env: { ...process.env } });
409
480
  }
481
+ if (result.status !== 0) return null;
482
+ const backupsDir = join4(abmindHome, "backups");
483
+ if (!existsSync3(backupsDir)) return null;
484
+ const abmFiles = readdirSync2(backupsDir).filter((f) => f.endsWith(".abm")).sort().reverse();
485
+ return abmFiles[0] ? join4(backupsDir, abmFiles[0]) : null;
486
+ }
487
+ function encryptFile(inputPath, outputPath, abmindHome) {
488
+ const keyPath = join4(abmindHome, "secret", "abmind.key");
489
+ if (!existsSync3(keyPath)) {
490
+ process.stderr.write(`\u26A0\uFE0F --encrypt requires ${keyPath}
491
+ `);
492
+ return false;
493
+ }
494
+ const master = Buffer.from(readFileSync2(keyPath, "utf-8").trim(), "hex");
495
+ const key = Buffer.from(hkdfSync("sha256", master, "", "abtars-backup-v1", 32));
496
+ const iv = randomBytes(12);
497
+ const cipher = createCipheriv("aes-256-gcm", key, iv);
498
+ const input = readFileSync2(inputPath);
499
+ const encrypted = Buffer.concat([cipher.update(input), cipher.final()]);
500
+ const tag = cipher.getAuthTag();
501
+ const out = Buffer.concat([iv, encrypted, tag]);
502
+ writeFileSync(outputPath, out);
503
+ return true;
410
504
  }
411
505
 
412
506
  // src/cli/commands/onboard.ts
@@ -417,7 +511,7 @@ import { homedir as homedir2 } from "node:os";
417
511
  import { fileURLToPath } from "node:url";
418
512
 
419
513
  // src/components/hints.ts
420
- import { existsSync as existsSync4, readFileSync as readFileSync2, writeFileSync, renameSync as renameSync2 } from "node:fs";
514
+ import { existsSync as existsSync4, readFileSync as readFileSync3, writeFileSync as writeFileSync2, renameSync as renameSync2 } from "node:fs";
421
515
  import { join as join5 } from "node:path";
422
516
  function manifestPath() {
423
517
  const home = process.env["ABTARS_HOME"] ?? join5(process.env["HOME"] ?? "", ".abtars");
@@ -427,7 +521,7 @@ function readManifest2() {
427
521
  const path = manifestPath();
428
522
  if (!existsSync4(path)) return {};
429
523
  try {
430
- return JSON.parse(readFileSync2(path, "utf-8"));
524
+ return JSON.parse(readFileSync3(path, "utf-8"));
431
525
  } catch {
432
526
  return {};
433
527
  }
@@ -435,7 +529,7 @@ function readManifest2() {
435
529
  function writeManifestAtomic(data) {
436
530
  const path = manifestPath();
437
531
  const tmp = path + ".tmp";
438
- writeFileSync(tmp, JSON.stringify(data, null, 2) + "\n");
532
+ writeFileSync2(tmp, JSON.stringify(data, null, 2) + "\n");
439
533
  renameSync2(tmp, path);
440
534
  }
441
535
  function showHintOnce(id, text) {
@@ -488,7 +582,7 @@ async function runInteractive(existing) {
488
582
  const { intro, outro, text, select, confirm: confirm2, isCancel, cancel } = await import("./dist-J3T4XVKX.js");
489
583
  intro("abtars onboard \u2014 first-time setup");
490
584
  const noteEmpty = "press Enter to skip";
491
- const { packagePaths: pp, readManifest: rm3 } = await import("./deploy-lib-import-SBKXDD3F.js");
585
+ const { packagePaths: pp, readManifest: rm3 } = await import("./deploy-lib-import-6VJTYXEG.js");
492
586
  const mfPaths = pp("abtars");
493
587
  const mf = await rm3(mfPaths.manifest);
494
588
  const installMode = mf?.installMode ?? "supervised";
@@ -924,7 +1018,7 @@ async function onboard(opts) {
924
1018
  }
925
1019
  if (secrets.length > 0) process.stdout.write(`\u2713 ${secrets.length} secrets \u2192 ${secretDirPath}
926
1020
  `);
927
- const { writeManifest: writeManifest2 } = await import("./deploy-lib-import-SBKXDD3F.js");
1021
+ const { writeManifest: writeManifest2 } = await import("./deploy-lib-import-6VJTYXEG.js");
928
1022
  const mf = await readManifest(paths.manifest);
929
1023
  if (mf) await writeManifest2(paths.manifest, { ...mf, installMode: answers.installMode });
930
1024
  process.stdout.write(`\u2713 install mode: ${answers.installMode}
@@ -1055,8 +1149,8 @@ Next: 'abtars update' to build, then start the bridge.
1055
1149
  `);
1056
1150
  return 0;
1057
1151
  }
1058
- const { existsSync: existsSync10 } = await import("node:fs");
1059
- const hasRelease = existsSync10(join6(paths.home, "current"));
1152
+ const { existsSync: existsSync9 } = await import("node:fs");
1153
+ const hasRelease = existsSync9(join6(paths.home, "current"));
1060
1154
  if (!hasRelease) {
1061
1155
  process.stdout.write(`
1062
1156
  Next: run 'abtars update' to stage the release, then start the bridge.
@@ -1076,9 +1170,9 @@ Next: start the bridge
1076
1170
  return 0;
1077
1171
  }
1078
1172
  async function seedDefaultTasks(chatId, abtarsHome4) {
1079
- const { existsSync: existsSync10 } = await import("node:fs");
1173
+ const { existsSync: existsSync9 } = await import("node:fs");
1080
1174
  const tasksJson = join6(abtarsHome4, "tasks", "tasks.json");
1081
- if (existsSync10(tasksJson)) {
1175
+ if (existsSync9(tasksJson)) {
1082
1176
  process.stdout.write(`\u2022 tasks.json exists \u2014 skipping default-task seed
1083
1177
  `);
1084
1178
  return;
@@ -1091,7 +1185,7 @@ async function seedDefaultTasks(chatId, abtarsHome4) {
1091
1185
  ];
1092
1186
  let templatePath = null;
1093
1187
  for (const p of candidates) {
1094
- if (existsSync10(p)) {
1188
+ if (existsSync9(p)) {
1095
1189
  templatePath = p;
1096
1190
  break;
1097
1191
  }
@@ -1147,70 +1241,10 @@ async function seedDefaultTasks(chatId, abtarsHome4) {
1147
1241
  }
1148
1242
  }
1149
1243
 
1150
- // src/cli/commands/rollback.ts
1151
- import { existsSync as existsSync5, renameSync as renameSync3, rmSync as rmSync2 } from "node:fs";
1152
- import { join as join7 } from "node:path";
1153
- async function rollback() {
1154
- const paths = packagePaths("abtars");
1155
- const manifest = await readManifest(paths.manifest);
1156
- if (!existsSync5(paths.appPrev)) {
1157
- process.stderr.write(`Nothing to roll back to (no app.prev/ found).
1158
- `);
1159
- return 2;
1160
- }
1161
- if (!manifest?.version) {
1162
- process.stderr.write(`No active release in manifest; nothing to roll back.
1163
- `);
1164
- return 2;
1165
- }
1166
- const release = await acquireLock(paths.lock, "rollback");
1167
- try {
1168
- const brokenDir = join7(paths.home, "app.broken");
1169
- rmSync2(brokenDir, { recursive: true, force: true });
1170
- renameSync3(paths.app, brokenDir);
1171
- renameSync3(paths.appPrev, paths.app);
1172
- rmSync2(brokenDir, { recursive: true, force: true });
1173
- process.stdout.write(`\u2713 rolled back: app.prev/ \u2192 app/
1174
- `);
1175
- if (manifest.previousVersion) {
1176
- await writeManifest(paths.manifest, {
1177
- ...manifest,
1178
- version: manifest.previousVersion,
1179
- commit: manifest.previousCommit,
1180
- activatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1181
- previousVersion: manifest.version,
1182
- previousCommit: manifest.commit
1183
- });
1184
- process.stdout.write(`\u2713 manifest: ${manifest.version} \u2192 ${manifest.previousVersion}
1185
- `);
1186
- }
1187
- const restartTs = Date.now();
1188
- const { restart: restart2 } = await import("./abtars-restart.js");
1189
- process.stdout.write(`\u267B\uFE0F Restarting bridge...
1190
- `);
1191
- await restart2({ cold: true }).catch(() => {
1192
- });
1193
- const health = await healthProbe(paths.home, restartTs, 6e4);
1194
- if (health.healthy) {
1195
- process.stdout.write(`\u2713 Bridge healthy (PID ${health.pid})
1196
- `);
1197
- } else {
1198
- process.stderr.write(`\u26A0\uFE0F Bridge may not have started. Check logs.
1199
- `);
1200
- }
1201
- process.stdout.write(`
1202
- Rollback complete.
1203
- `);
1204
- return 0;
1205
- } finally {
1206
- await release();
1207
- }
1208
- }
1209
-
1210
1244
  // src/cli/commands/status.ts
1211
- import { existsSync as existsSync6 } from "node:fs";
1212
- import { readFileSync as readFileSync3 } from "node:fs";
1213
- import { join as join8 } from "node:path";
1245
+ import { existsSync as existsSync5 } from "node:fs";
1246
+ import { readFileSync as readFileSync4 } from "node:fs";
1247
+ import { join as join7 } from "node:path";
1214
1248
  async function status() {
1215
1249
  const paths = packagePaths("abtars");
1216
1250
  const manifest = await readManifest(paths.manifest);
@@ -1222,8 +1256,8 @@ Run 'abtars install' to set up.
1222
1256
  );
1223
1257
  return 1;
1224
1258
  }
1225
- const appExists = existsSync6(paths.app);
1226
- const appPrevExists = existsSync6(paths.appPrev);
1259
+ const appExists = existsSync5(paths.app);
1260
+ const appPrevExists = existsSync5(paths.appPrev);
1227
1261
  const lines = [
1228
1262
  `abtars status`,
1229
1263
  ` home: ${paths.home}`,
@@ -1239,7 +1273,7 @@ Run 'abtars install' to set up.
1239
1273
  ` host: ${manifest.host}`
1240
1274
  ];
1241
1275
  try {
1242
- const bridgeLock = JSON.parse(readFileSync3(join8(paths.home, "bridge.lock"), "utf-8"));
1276
+ const bridgeLock = JSON.parse(readFileSync4(join7(paths.home, "bridge.lock"), "utf-8"));
1243
1277
  if (bridgeLock.pid) {
1244
1278
  const alive = (() => {
1245
1279
  try {
@@ -1279,16 +1313,16 @@ Run 'abtars install' to set up.
1279
1313
 
1280
1314
  // src/cli/commands/update.ts
1281
1315
  import { hostname } from "node:os";
1282
- import { join as join11 } from "node:path";
1283
- import { readFileSync as readFileSync5, existsSync as existsSync9 } from "node:fs";
1316
+ import { join as join10 } from "node:path";
1317
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync3, existsSync as existsSync8 } from "node:fs";
1284
1318
  import { copyFile as copyFile2, mkdir as mkdir4, chmod, readdir } from "node:fs/promises";
1285
- import { rmSync as rmSync3, cpSync, readdirSync as readdirSync3, mkdirSync as mkdirSync2 } from "node:fs";
1319
+ import { rmSync as rmSync2, cpSync, readdirSync as readdirSync3, mkdirSync as mkdirSync2 } from "node:fs";
1286
1320
 
1287
1321
  // src/cli/update-sources/local.ts
1288
1322
  import { spawnSync as spawnSync2 } from "node:child_process";
1289
- import { existsSync as existsSync7 } from "node:fs";
1323
+ import { existsSync as existsSync6 } from "node:fs";
1290
1324
  import { copyFile, cp, mkdir as mkdir2, readFile as readFile2, rm, writeFile as writeFile2 } from "node:fs/promises";
1291
- import { join as join9 } from "node:path";
1325
+ import { join as join8 } from "node:path";
1292
1326
  var LocalBuildError = class extends Error {
1293
1327
  constructor(message, hint) {
1294
1328
  super(hint ? `${message}
@@ -1350,7 +1384,7 @@ ${upstream} is ahead by ${behind} commit${behind === 1 ? "" : "s"}.`,
1350
1384
  return { commit, branch };
1351
1385
  }
1352
1386
  async function readPackageVersion(repoRoot) {
1353
- const pkg = JSON.parse(await readFile2(join9(repoRoot, "package.json"), "utf-8"));
1387
+ const pkg = JSON.parse(await readFile2(join8(repoRoot, "package.json"), "utf-8"));
1354
1388
  if (typeof pkg.version !== "string") {
1355
1389
  throw new LocalBuildError("package.json has no version field.");
1356
1390
  }
@@ -1358,13 +1392,13 @@ async function readPackageVersion(repoRoot) {
1358
1392
  }
1359
1393
  function makeLocalBuildSource(opts = {}) {
1360
1394
  const repoRoot = opts.repoRoot ?? process.cwd();
1361
- const isNpmPackage = !existsSync7(join9(repoRoot, ".git"));
1395
+ const isNpmPackage = !existsSync6(join8(repoRoot, ".git"));
1362
1396
  return {
1363
1397
  name: "local",
1364
1398
  async prepare(ctx) {
1365
1399
  if (isNpmPackage) {
1366
- const bundleDir = join9(repoRoot, "bundle");
1367
- if (!existsSync7(bundleDir)) {
1400
+ const bundleDir = join8(repoRoot, "bundle");
1401
+ if (!existsSync6(bundleDir)) {
1368
1402
  throw new Error(`No bundle/ found at ${repoRoot}. Run from the abtars npm package or a git checkout.`);
1369
1403
  }
1370
1404
  const pkgVersion2 = await readPackageVersion(repoRoot);
@@ -1372,16 +1406,16 @@ function makeLocalBuildSource(opts = {}) {
1372
1406
  const stagedPath2 = ctx.stagingDir;
1373
1407
  await rm(stagedPath2, { recursive: true, force: true });
1374
1408
  await mkdir2(stagedPath2, { recursive: true });
1375
- await cp(bundleDir, join9(stagedPath2, "bundle"), { recursive: true });
1376
- const coreDir = join9(repoRoot, "core");
1377
- if (existsSync7(coreDir)) await cp(coreDir, join9(stagedPath2, "core"), { recursive: true });
1378
- const scriptsSrc = join9(repoRoot, "scripts");
1379
- if (existsSync7(scriptsSrc)) await cp(scriptsSrc, join9(stagedPath2, "scripts"), { recursive: true });
1380
- const configSrc = join9(repoRoot, "config");
1381
- if (existsSync7(configSrc)) await cp(configSrc, join9(stagedPath2, "config"), { recursive: true });
1382
- const manifestSrc = join9(repoRoot, "install-manifest.json");
1383
- if (existsSync7(manifestSrc)) await copyFile(manifestSrc, join9(stagedPath2, "install-manifest.json"));
1384
- await writeFile2(join9(stagedPath2, "package.json"), JSON.stringify({ type: "module", name: "abtars", version: version2 }, null, 2) + "\n");
1409
+ await cp(bundleDir, join8(stagedPath2, "bundle"), { recursive: true });
1410
+ const coreDir = join8(repoRoot, "core");
1411
+ if (existsSync6(coreDir)) await cp(coreDir, join8(stagedPath2, "core"), { recursive: true });
1412
+ const scriptsSrc = join8(repoRoot, "scripts");
1413
+ if (existsSync6(scriptsSrc)) await cp(scriptsSrc, join8(stagedPath2, "scripts"), { recursive: true });
1414
+ const configSrc = join8(repoRoot, "config");
1415
+ if (existsSync6(configSrc)) await cp(configSrc, join8(stagedPath2, "config"), { recursive: true });
1416
+ const manifestSrc = join8(repoRoot, "install-manifest.json");
1417
+ if (existsSync6(manifestSrc)) await copyFile(manifestSrc, join8(stagedPath2, "install-manifest.json"));
1418
+ await writeFile2(join8(stagedPath2, "package.json"), JSON.stringify({ type: "module", name: "abtars", version: version2 }, null, 2) + "\n");
1385
1419
  process.stdout.write(`\u2713 staged ${version2} (from npm package)
1386
1420
  `);
1387
1421
  return { version: version2, stagedPath: stagedPath2, commit: null, branch: null, packageLockHash: null, source: "local" };
@@ -1396,14 +1430,14 @@ function makeLocalBuildSource(opts = {}) {
1396
1430
  const stagedPath = ctx.stagingDir;
1397
1431
  await rm(stagedPath, { recursive: true, force: true });
1398
1432
  await mkdir2(stagedPath, { recursive: true });
1399
- await cp(join9(repoRoot, "bundle"), join9(stagedPath, "bundle"), { recursive: true });
1400
- const coreSkillsSrc = join9(repoRoot, "core", "skills");
1401
- if (existsSync7(coreSkillsSrc)) {
1402
- await cp(coreSkillsSrc, join9(stagedPath, "core", "skills"), { recursive: true });
1433
+ await cp(join8(repoRoot, "bundle"), join8(stagedPath, "bundle"), { recursive: true });
1434
+ const coreSkillsSrc = join8(repoRoot, "core", "skills");
1435
+ if (existsSync6(coreSkillsSrc)) {
1436
+ await cp(coreSkillsSrc, join8(stagedPath, "core", "skills"), { recursive: true });
1403
1437
  }
1404
- await writeFile2(join9(stagedPath, "package.json"), JSON.stringify({ type: "module", name: "abtars", version }, null, 2) + "\n");
1405
- await copyFile(join9(repoRoot, "install-manifest.json"), join9(stagedPath, "install-manifest.json"));
1406
- const packageLockHash = await hashFile(join9(repoRoot, "package-lock.json"));
1438
+ await writeFile2(join8(stagedPath, "package.json"), JSON.stringify({ type: "module", name: "abtars", version }, null, 2) + "\n");
1439
+ await copyFile(join8(repoRoot, "install-manifest.json"), join8(stagedPath, "install-manifest.json"));
1440
+ const packageLockHash = await hashFile(join8(repoRoot, "package-lock.json"));
1407
1441
  return { version, stagedPath, commit, branch, packageLockHash, source: "local" };
1408
1442
  }
1409
1443
  };
@@ -1411,9 +1445,9 @@ function makeLocalBuildSource(opts = {}) {
1411
1445
 
1412
1446
  // src/cli/update-sources/npm.ts
1413
1447
  import { spawnSync as spawnSync3 } from "node:child_process";
1414
- import { existsSync as existsSync8, readFileSync as readFileSync4, unlinkSync as unlinkSync4 } from "node:fs";
1448
+ import { existsSync as existsSync7, readFileSync as readFileSync5, unlinkSync as unlinkSync4 } from "node:fs";
1415
1449
  import { mkdir as mkdir3, rm as rm2 } from "node:fs/promises";
1416
- import { join as join10 } from "node:path";
1450
+ import { join as join9 } from "node:path";
1417
1451
  var TIMEOUT_MS = 6e4;
1418
1452
  function run(cmd, args, cwd) {
1419
1453
  const r = spawnSync3(cmd, args, { cwd, encoding: "utf-8", timeout: TIMEOUT_MS });
@@ -1423,7 +1457,7 @@ function run(cmd, args, cwd) {
1423
1457
  }
1424
1458
  function readLocalVersion(home) {
1425
1459
  try {
1426
- const pkg = JSON.parse(readFileSync4(join10(home, "app", "package.json"), "utf-8"));
1460
+ const pkg = JSON.parse(readFileSync5(join9(home, "app", "package.json"), "utf-8"));
1427
1461
  return pkg.version ?? null;
1428
1462
  } catch {
1429
1463
  return null;
@@ -1443,9 +1477,9 @@ function makeNpmSource(packageName) {
1443
1477
  await mkdir3(stagedPath, { recursive: true });
1444
1478
  run("npm", ["pack", `${packageName}@${latest}`, "--pack-destination", stagedPath], stagedPath);
1445
1479
  const tgzName = `${packageName}-${latest}.tgz`.replace("@", "").replace("/", "-");
1446
- const tgzPath = join10(stagedPath, tgzName);
1480
+ const tgzPath = join9(stagedPath, tgzName);
1447
1481
  run("tar", ["-xzf", tgzPath, "--strip-components=1"], stagedPath);
1448
- if (existsSync8(tgzPath)) unlinkSync4(tgzPath);
1482
+ if (existsSync7(tgzPath)) unlinkSync4(tgzPath);
1449
1483
  run("npm", ["install", "--omit=dev", "--no-audit", "--no-fund"], stagedPath);
1450
1484
  return { version: latest, stagedPath, commit: null, branch: null, packageLockHash: null, source: "npm" };
1451
1485
  }
@@ -1455,7 +1489,7 @@ function makeNpmSource(packageName) {
1455
1489
  // src/cli/commands/update.ts
1456
1490
  function readJsonField2(file, field) {
1457
1491
  try {
1458
- return JSON.parse(readFileSync5(file, "utf-8"))[field];
1492
+ return JSON.parse(readFileSync6(file, "utf-8"))[field];
1459
1493
  } catch {
1460
1494
  return void 0;
1461
1495
  }
@@ -1483,8 +1517,8 @@ Use --source local (default) or --source npm.
1483
1517
  try {
1484
1518
  cleanStaleStaging(paths.appStaging);
1485
1519
  const cleanupHandler = () => {
1486
- if (existsSync9(paths.appStaging) && existsSync9(paths.app)) {
1487
- rmSync3(paths.appStaging, { recursive: true, force: true });
1520
+ if (existsSync8(paths.appStaging) && existsSync8(paths.app)) {
1521
+ rmSync2(paths.appStaging, { recursive: true, force: true });
1488
1522
  }
1489
1523
  };
1490
1524
  process.on("SIGHUP", () => {
@@ -1496,12 +1530,12 @@ Use --source local (default) or --source npm.
1496
1530
  process.exit(143);
1497
1531
  });
1498
1532
  let repoRoot = opts.repoRoot ?? process.cwd();
1499
- if (!opts.repoRoot && !existsSync9(join11(repoRoot, ".git"))) {
1533
+ if (!opts.repoRoot && !existsSync8(join10(repoRoot, ".git"))) {
1500
1534
  const { realpathSync } = await import("node:fs");
1501
1535
  const scriptPath = realpathSync(process.argv[1] ?? "");
1502
1536
  const { dirname: dirname3 } = await import("node:path");
1503
- const candidate = join11(dirname3(scriptPath), "..");
1504
- if (existsSync9(join11(candidate, "bundle"))) repoRoot = candidate;
1537
+ const candidate = join10(dirname3(scriptPath), "..");
1538
+ if (existsSync8(join10(candidate, "bundle"))) repoRoot = candidate;
1505
1539
  }
1506
1540
  const source = opts.source === "npm" ? makeNpmSource("abtars") : makeLocalBuildSource({ repoRoot, allowStale: opts.fromLocal });
1507
1541
  if (opts.fromLocal) {
@@ -1520,14 +1554,14 @@ Use --source local (default) or --source npm.
1520
1554
  process.stdout.write(`\u2713 staged ${staged.version}
1521
1555
  `);
1522
1556
  {
1523
- const pkgPath = join11(staged.stagedPath, "package.json");
1557
+ const pkgPath = join10(staged.stagedPath, "package.json");
1524
1558
  try {
1525
- const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
1559
+ const pkg = JSON.parse(readFileSync6(pkgPath, "utf-8"));
1526
1560
  const externals = { patchright: "^1.59.4", "rettiwt-api": "^4.1.3" };
1527
1561
  pkg.dependencies = { ...pkg.dependencies, ...externals };
1528
1562
  if (pkg.dependencies?.abmind?.startsWith("file:")) delete pkg.dependencies.abmind;
1529
- const { writeFileSync: writeFileSync2 } = await import("node:fs");
1530
- writeFileSync2(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
1563
+ const { writeFileSync: writeFileSync4 } = await import("node:fs");
1564
+ writeFileSync4(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
1531
1565
  const { execSync } = await import("node:child_process");
1532
1566
  execSync("npm install --omit=dev --ignore-scripts 2>/dev/null", { cwd: staged.stagedPath, timeout: 6e4 });
1533
1567
  process.stdout.write(`\u2713 external deps installed
@@ -1538,8 +1572,8 @@ Use --source local (default) or --source npm.
1538
1572
  }
1539
1573
  }
1540
1574
  await copyAbmind(staged.stagedPath, repoRoot);
1541
- const entryPoint = join11(staged.stagedPath, "bundle", "abtars.js");
1542
- if (!existsSync9(entryPoint)) {
1575
+ const entryPoint = join10(staged.stagedPath, "bundle", "abtars.js");
1576
+ if (!existsSync8(entryPoint)) {
1543
1577
  process.stderr.write(`\u274C Entry point not found: ${entryPoint}
1544
1578
  `);
1545
1579
  return 1;
@@ -1547,10 +1581,6 @@ Use --source local (default) or --source npm.
1547
1581
  configSnapshot(paths.config);
1548
1582
  process.stdout.write(`\u2713 config snapshot (3-slot rotation)
1549
1583
  `);
1550
- atomicSwap(paths.app, paths.appPrev, paths.appStaging);
1551
- process.stdout.write(`\u2713 atomic swap: app.staging/ \u2192 app/
1552
- `);
1553
- await postSwapHousekeeping(paths, repoRoot, staged);
1554
1584
  const prior = await readManifest(paths.manifest);
1555
1585
  const sentinelData = {
1556
1586
  version: staged.version,
@@ -1559,6 +1589,10 @@ Use --source local (default) or --source npm.
1559
1589
  status: "pending"
1560
1590
  };
1561
1591
  writeSentinel(paths.home, sentinelData);
1592
+ atomicSwap(paths.app, paths.appPrev, paths.appStaging);
1593
+ process.stdout.write(`\u2713 atomic swap: app.staging/ \u2192 app/
1594
+ `);
1595
+ await postSwapHousekeeping(paths, repoRoot, staged);
1562
1596
  await writeManifest(paths.manifest, {
1563
1597
  ...prior ?? emptyManifest("abtars", hostname()),
1564
1598
  version: staged.version,
@@ -1568,7 +1602,9 @@ Use --source local (default) or --source npm.
1568
1602
  activatedAt: (/* @__PURE__ */ new Date()).toISOString(),
1569
1603
  source: "local",
1570
1604
  previousVersion: prior?.version ?? null,
1571
- previousCommit: prior?.commit ?? null
1605
+ previousCommit: prior?.commit ?? null,
1606
+ installMode: prior?.installMode ?? "supervised",
1607
+ repoRoot
1572
1608
  });
1573
1609
  process.stdout.write(`\u2713 manifest updated
1574
1610
  `);
@@ -1590,18 +1626,18 @@ Use --source local (default) or --source npm.
1590
1626
  }
1591
1627
  process.stderr.write(`\u274C Bridge unhealthy after 60s. Auto-rolling back...
1592
1628
  `);
1593
- if (!existsSync9(paths.appPrev)) {
1594
- process.stderr.write(`\u274C No app.prev/ to roll back to. Manual intervention required.
1629
+ if (!existsSync8(paths.appPrev1)) {
1630
+ process.stderr.write(`\u274C No app.prev.1/ to roll back to. Manual intervention required.
1595
1631
  `);
1596
1632
  process.stderr.write(` Check: ~/.abtars/logs/bridge.log
1597
1633
  `);
1598
1634
  return 2;
1599
1635
  }
1600
- const brokenDir = join11(paths.home, "app.broken");
1601
- rmSync3(brokenDir, { recursive: true, force: true });
1602
- const { renameSync: renameSync4 } = await import("node:fs");
1603
- renameSync4(paths.app, brokenDir);
1604
- renameSync4(paths.appPrev, paths.app);
1636
+ const brokenDir = join10(paths.home, "app.broken");
1637
+ rmSync2(brokenDir, { recursive: true, force: true });
1638
+ const { renameSync: renameSync3 } = await import("node:fs");
1639
+ renameSync3(paths.app, brokenDir);
1640
+ renameSync3(paths.appPrev1, paths.app);
1605
1641
  if (prior) {
1606
1642
  await writeManifest(paths.manifest, prior);
1607
1643
  }
@@ -1611,7 +1647,7 @@ Use --source local (default) or --source npm.
1611
1647
  if (rollbackHealth.healthy) {
1612
1648
  process.stderr.write(`\u26A0\uFE0F Rolled back to previous version. Investigate ${brokenDir} for the failure.
1613
1649
  `);
1614
- rmSync3(brokenDir, { recursive: true, force: true });
1650
+ rmSync2(brokenDir, { recursive: true, force: true });
1615
1651
  return 1;
1616
1652
  }
1617
1653
  process.stderr.write(`\u274C Rollback also failed. Manual intervention required.
@@ -1628,17 +1664,27 @@ Use --source local (default) or --source npm.
1628
1664
  async function copyAbmind(stagedPath, repoRoot) {
1629
1665
  const candidates = [
1630
1666
  process.env["ABMIND_REPO"],
1631
- join11(repoRoot, "..", "abmind"),
1632
- join11(process.env["HOME"] ?? "", "abmind")
1667
+ join10(repoRoot, "..", "abmind"),
1668
+ join10(process.env["HOME"] ?? "", "abmind")
1633
1669
  ].filter(Boolean);
1634
1670
  for (const src of candidates) {
1635
- const distDir = join11(src, "dist");
1636
- if (existsSync9(distDir)) {
1637
- const dest = join11(stagedPath, "node_modules", "abmind");
1671
+ const distDir = join10(src, "dist");
1672
+ if (existsSync8(distDir)) {
1673
+ const dest = join10(stagedPath, "bundle", "node_modules", "abmind");
1638
1674
  mkdirSync2(dest, { recursive: true });
1639
- cpSync(distDir, join11(dest, "dist"), { recursive: true });
1640
- if (existsSync9(join11(src, "package.json"))) cpSync(join11(src, "package.json"), join11(dest, "package.json"));
1641
- if (existsSync9(join11(src, "prompts"))) cpSync(join11(src, "prompts"), join11(dest, "prompts"), { recursive: true });
1675
+ cpSync(distDir, join10(dest, "dist"), { recursive: true });
1676
+ if (existsSync8(join10(src, "package.json"))) cpSync(join10(src, "package.json"), join10(dest, "package.json"));
1677
+ if (existsSync8(join10(src, "prompts"))) cpSync(join10(src, "prompts"), join10(dest, "prompts"), { recursive: true });
1678
+ const stalePath = join10(stagedPath, "node_modules", "abmind");
1679
+ if (existsSync8(stalePath)) rmSync2(stalePath, { recursive: true });
1680
+ try {
1681
+ const pkg = JSON.parse(readFileSync6(join10(dest, "package.json"), "utf-8"));
1682
+ const abmindHome = process.env["ABMIND_HOME"] ?? join10(process.env["HOME"] ?? "", ".abmind");
1683
+ mkdirSync2(abmindHome, { recursive: true });
1684
+ const manifest = { version: pkg.version, activatedAt: (/* @__PURE__ */ new Date()).toISOString(), source: "local" };
1685
+ writeFileSync3(join10(abmindHome, "manifest.json"), JSON.stringify(manifest, null, 2) + "\n");
1686
+ } catch {
1687
+ }
1642
1688
  process.stdout.write(`\u2713 abmind copied from ${src}
1643
1689
  `);
1644
1690
  return;
@@ -1648,32 +1694,32 @@ async function copyAbmind(stagedPath, repoRoot) {
1648
1694
  `);
1649
1695
  }
1650
1696
  async function postSwapHousekeeping(paths, repoRoot, _staged) {
1651
- const { loadManifest } = await import("./install-manifest-QRWID3KZ.js");
1697
+ const { loadManifest } = await import("./install-manifest-KBYD7SAY.js");
1652
1698
  const installManifest = loadManifest(paths.app);
1653
- const repoScripts = join11(repoRoot, "scripts");
1654
- const destScripts = join11(paths.home, "scripts");
1699
+ const repoScripts = join10(repoRoot, "scripts");
1700
+ const destScripts = join10(paths.home, "scripts");
1655
1701
  await mkdir4(destScripts, { recursive: true });
1656
1702
  const allScriptFiles = await readdir(repoScripts).catch(() => []);
1657
1703
  const matchesInclude = (name) => installManifest.scripts.include.some((pattern) => name.endsWith(pattern.replace("*", "")));
1658
1704
  const scriptFiles = allScriptFiles.filter(matchesInclude);
1659
1705
  const isExecutable = (name) => name.endsWith(installManifest.scripts.executable.replace("*", ""));
1660
1706
  for (const name of scriptFiles) {
1661
- await copyFile2(join11(repoScripts, name), join11(destScripts, name));
1662
- if (isExecutable(name)) await chmod(join11(destScripts, name), 493);
1707
+ await copyFile2(join10(repoScripts, name), join10(destScripts, name));
1708
+ if (isExecutable(name)) await chmod(join10(destScripts, name), 493);
1663
1709
  }
1664
1710
  process.stdout.write(`\u2713 scripts refreshed (${scriptFiles.length} files)
1665
1711
  `);
1666
- const { writeWrapper } = await import("./install-SH4UVUXQ.js");
1712
+ const { writeWrapper } = await import("./install-FZT43PTH.js");
1667
1713
  await mkdir4(paths.bin, { recursive: true });
1668
1714
  for (const name of installManifest.cliWrappers) {
1669
1715
  await writeWrapper(paths.bin, name, paths.app, false);
1670
1716
  }
1671
1717
  process.stdout.write(`\u2713 wrappers refreshed (${installManifest.cliWrappers.length} files)
1672
1718
  `);
1673
- const skillsCoreSrc = join11(paths.app, "core", "skills");
1674
- const skillsCoreDst = join11(paths.home, "skills", "core");
1675
- if (existsSync9(skillsCoreSrc)) {
1676
- rmSync3(skillsCoreDst, { recursive: true, force: true });
1719
+ const skillsCoreSrc = join10(paths.app, "core", "skills");
1720
+ const skillsCoreDst = join10(paths.home, "skills", "core");
1721
+ if (existsSync8(skillsCoreSrc)) {
1722
+ rmSync2(skillsCoreDst, { recursive: true, force: true });
1677
1723
  cpSync(skillsCoreSrc, skillsCoreDst, { recursive: true });
1678
1724
  const files = readdirSync3(skillsCoreDst, { recursive: true });
1679
1725
  const count = files.filter((f) => f.endsWith("SKILL.md")).length;
@@ -1681,26 +1727,26 @@ async function postSwapHousekeeping(paths, repoRoot, _staged) {
1681
1727
  `);
1682
1728
  }
1683
1729
  for (const d of ["custom", "downloaded", "self"]) {
1684
- await mkdir4(join11(paths.home, "skills", d), { recursive: true });
1730
+ await mkdir4(join10(paths.home, "skills", d), { recursive: true });
1685
1731
  }
1686
- const releaseConfig = join11(paths.app, "config");
1687
- const destConfig = join11(paths.home, "config");
1688
- if (existsSync9(releaseConfig)) {
1732
+ const releaseConfig = join10(paths.app, "config");
1733
+ const destConfig = join10(paths.home, "config");
1734
+ if (existsSync8(releaseConfig)) {
1689
1735
  for (const f of readdirSync3(releaseConfig)) {
1690
- const src = join11(releaseConfig, f);
1736
+ const src = join10(releaseConfig, f);
1691
1737
  if (f.endsWith(".example")) {
1692
- cpSync(src, join11(destConfig, f));
1693
- const target = join11(destConfig, f.replace(".example", ""));
1694
- if (!existsSync9(target)) cpSync(src, target);
1738
+ cpSync(src, join10(destConfig, f));
1739
+ const target = join10(destConfig, f.replace(".example", ""));
1740
+ if (!existsSync8(target)) cpSync(src, target);
1695
1741
  }
1696
1742
  }
1697
- const defaultTransport = join11(releaseConfig, "transport.default.json");
1698
- if (existsSync9(defaultTransport)) cpSync(defaultTransport, join11(destConfig, "transport.default.json"));
1743
+ const defaultTransport = join10(releaseConfig, "transport.default.json");
1744
+ if (existsSync8(defaultTransport)) cpSync(defaultTransport, join10(destConfig, "transport.default.json"));
1699
1745
  }
1700
- const transportJson = join11(paths.home, "config", "transport.json");
1701
- if (existsSync9(transportJson)) {
1746
+ const transportJson = join10(paths.home, "config", "transport.json");
1747
+ if (existsSync8(transportJson)) {
1702
1748
  try {
1703
- const tc = JSON.parse(readFileSync5(transportJson, "utf-8"));
1749
+ const tc = JSON.parse(readFileSync6(transportJson, "utf-8"));
1704
1750
  let cleared = false;
1705
1751
  for (const agent of Object.values(tc.agents ?? {})) {
1706
1752
  if (agent.demoted) {
@@ -1719,14 +1765,14 @@ async function postSwapHousekeeping(paths, repoRoot, _staged) {
1719
1765
  }
1720
1766
  }
1721
1767
  if (cleared) {
1722
- const { writeFileSync: writeFileSync2 } = await import("node:fs");
1723
- writeFileSync2(transportJson, JSON.stringify(tc, null, 2) + "\n");
1768
+ const { writeFileSync: writeFileSync4 } = await import("node:fs");
1769
+ writeFileSync4(transportJson, JSON.stringify(tc, null, 2) + "\n");
1724
1770
  }
1725
1771
  } catch {
1726
1772
  }
1727
1773
  }
1728
- const doctorPath = join11(paths.home, "scripts", "doctor.sh");
1729
- if (existsSync9(doctorPath)) {
1774
+ const doctorPath = join10(paths.home, "scripts", "doctor.sh");
1775
+ if (existsSync8(doctorPath)) {
1730
1776
  process.stdout.write("\n\u{1FA7A} Health check...\n");
1731
1777
  try {
1732
1778
  const { execSync } = await import("node:child_process");
@@ -1736,7 +1782,7 @@ async function postSwapHousekeeping(paths, repoRoot, _staged) {
1736
1782
  `);
1737
1783
  }
1738
1784
  }
1739
- const { ensureInstallInvariants } = await import("./ensure-invariants-BJIEOSJ2.js");
1785
+ const { ensureInstallInvariants } = await import("./ensure-invariants-3NOBCYWS.js");
1740
1786
  const invariantResults = await ensureInstallInvariants(process.cwd(), paths.home);
1741
1787
  if (invariantResults.length > 0) {
1742
1788
  process.stdout.write(`\u2713 invariants: ${invariantResults.join(", ")}
@@ -1753,7 +1799,7 @@ async function restartBridge(paths) {
1753
1799
  }
1754
1800
  if (mode === "supervised-daemon" || mode === "supervised") {
1755
1801
  process.stdout.write("\n\u267B\uFE0F Restarting bridge via watchdog...\n");
1756
- const wdLock = join11(paths.home, "watchdog.lock");
1802
+ const wdLock = join10(paths.home, "watchdog.lock");
1757
1803
  const wdPid = readJsonField2(wdLock, "pid");
1758
1804
  if (wdPid && wdPid > 0) {
1759
1805
  try {
@@ -1785,7 +1831,7 @@ function printDryRun(paths, repoRoot, opts) {
1785
1831
  const { spawnSync: spawnSync4 } = __require("node:child_process");
1786
1832
  const commit = spawnSync4("git", ["rev-parse", "--short", "HEAD"], { cwd: repoRoot, encoding: "utf-8" }).stdout?.trim() ?? "?";
1787
1833
  const branch = spawnSync4("git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd: repoRoot, encoding: "utf-8" }).stdout?.trim() ?? "?";
1788
- const wdLock = join11(paths.home, "watchdog.lock");
1834
+ const wdLock = join10(paths.home, "watchdog.lock");
1789
1835
  const wdPid = readJsonField2(wdLock, "pid");
1790
1836
  process.stdout.write(`
1791
1837
  Dry run \u2014 no changes will be made.
@@ -1801,7 +1847,7 @@ Dry run \u2014 no changes will be made.
1801
1847
  }
1802
1848
  async function checkForUpdates(home, opts) {
1803
1849
  const repoRoot = opts.repoRoot ?? process.cwd();
1804
- if (!existsSync9(join11(repoRoot, ".git"))) {
1850
+ if (!existsSync8(join10(repoRoot, ".git"))) {
1805
1851
  process.stderr.write("Not a git repository. --check requires a git checkout.\n");
1806
1852
  return 2;
1807
1853
  }
@@ -1809,7 +1855,7 @@ async function checkForUpdates(home, opts) {
1809
1855
  spawnSync4("git", ["fetch", "--quiet"], { cwd: repoRoot });
1810
1856
  const result = spawnSync4("git", ["rev-list", "--count", "HEAD..origin/dev"], { cwd: repoRoot, encoding: "utf-8" });
1811
1857
  const ahead = parseInt(result.stdout?.trim() ?? "0", 10);
1812
- const manifest = await readManifest(join11(home, "manifest.json"));
1858
+ const manifest = await readManifest(join10(home, "manifest.json"));
1813
1859
  process.stdout.write(`Current: ${manifest?.version ?? "unknown"} (deployed ${manifest?.activatedAt ?? "never"})
1814
1860
  `);
1815
1861
  if (ahead === 0) {
@@ -1858,8 +1904,8 @@ Usage:
1858
1904
  abtars uninstall [--yes]
1859
1905
  abtars update [--source local|npm|github] [--from-local]
1860
1906
  abtars rollback [--to <version>]
1861
- abtars backup
1862
- abtars restore <file.zip|.7z>
1907
+ abtars backup [--config] [--encrypt] [--output <dir>] [--prune-days N]
1908
+ abtars restore <file.zip|.7z|.abm|.enc> [--config] [--passphrase <p>]
1863
1909
  abtars doctor [<args passed to doctor.sh>...]
1864
1910
  abtars onboard [--non-interactive --accept-risk --telegram-token ... --telegram-chat-id ...]
1865
1911
  abtars restart [--cold]
@@ -1872,6 +1918,20 @@ Usage:
1872
1918
  );
1873
1919
  }
1874
1920
  async function main(argv) {
1921
+ if (argv[0] === "--version" || argv[0] === "-v" || argv[0] === "version") {
1922
+ const { readFileSync: readFileSync7 } = await import("node:fs");
1923
+ const { join: join11, dirname: dirname3 } = await import("node:path");
1924
+ const { fileURLToPath: fileURLToPath2 } = await import("node:url");
1925
+ const here = dirname3(fileURLToPath2(import.meta.url));
1926
+ try {
1927
+ const pkg = JSON.parse(readFileSync7(join11(here, "..", "package.json"), "utf-8"));
1928
+ process.stdout.write(`${pkg.version}
1929
+ `);
1930
+ } catch {
1931
+ process.stdout.write("unknown\n");
1932
+ }
1933
+ return 0;
1934
+ }
1875
1935
  const { command, flags } = parseArgs(argv);
1876
1936
  try {
1877
1937
  switch (command) {
@@ -1891,12 +1951,20 @@ async function main(argv) {
1891
1951
  allowAbmindMismatch: flags.get("allow-abmind-mismatch") === true
1892
1952
  });
1893
1953
  case "rollback":
1894
- return await rollback();
1954
+ return await rollback({ to: typeof flags.get("to") === "string" ? Number(flags.get("to")) : void 0 });
1895
1955
  case "backup":
1896
- return await backup(typeof flags.get("output") === "string" ? flags.get("output") : void 0);
1956
+ return await backup({
1957
+ config: flags.get("config") === true,
1958
+ encrypt: flags.get("encrypt") === true,
1959
+ outputDir: typeof flags.get("output") === "string" ? flags.get("output") : void 0,
1960
+ pruneDays: typeof flags.get("prune-days") === "string" ? Number(flags.get("prune-days")) : void 0
1961
+ });
1897
1962
  case "restore": {
1898
- const { restore } = await import("./restore-ROJF22R2.js");
1899
- return await restore(argv[1] ?? "");
1963
+ const { restore } = await import("./restore-Z6MF54HS.js");
1964
+ return await restore(argv[1] ?? "", {
1965
+ config: flags.get("config") === true,
1966
+ passphrase: typeof flags.get("passphrase") === "string" ? flags.get("passphrase") : void 0
1967
+ });
1900
1968
  }
1901
1969
  case "doctor":
1902
1970
  return await doctor(argv.slice(1).filter((a) => a !== ""));
@@ -1919,15 +1987,15 @@ async function main(argv) {
1919
1987
  case "stop":
1920
1988
  return await stop({ force: flags.get("force") === true });
1921
1989
  case "start": {
1922
- const { start: startCmd } = await import("./start-CBVKNEAT.js");
1990
+ const { start: startCmd } = await import("./start-4DNURGIY.js");
1923
1991
  return await startCmd();
1924
1992
  }
1925
1993
  case "daemon": {
1926
- const { daemon: daemonCmd } = await import("./daemon-NPKYZ3CJ.js");
1994
+ const { daemon: daemonCmd } = await import("./daemon-WOQXCKNL.js");
1927
1995
  return await daemonCmd(argv.slice(1));
1928
1996
  }
1929
1997
  case "deps": {
1930
- const { deps: depsCmd } = await import("./deps-HN6CEXA4.js");
1998
+ const { deps: depsCmd } = await import("./deps-65V7XXG4.js");
1931
1999
  return await depsCmd(argv.slice(1));
1932
2000
  }
1933
2001
  case "logs": {