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
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
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
+ import {
4
+ bootstrapIdentity,
5
+ deriveVerifyKey,
6
+ init_peer_config,
7
+ loadPeerConfig
8
+ } from "./chunk-3BG3AIDP.js";
9
+ import "./chunk-5RVOEFGT.js";
10
+ import "./chunk-WC5O5KOE.js";
11
+ import "./chunk-XRTXYN66.js";
12
+ import "./chunk-GALQBVKO.js";
13
+ import "./chunk-O7KQG6ME.js";
14
+ import "./chunk-7K2YZTLD.js";
15
+
16
+ // src/cli/commands/tribe.ts
17
+ init_peer_config();
18
+ async function tribe(args) {
19
+ const subcommand = args[0] ?? "status";
20
+ switch (subcommand) {
21
+ case "join":
22
+ case "invite":
23
+ return await tribeEnroll(args);
24
+ case "status":
25
+ return await tribeStatus();
26
+ default:
27
+ process.stderr.write(`Unknown tribe subcommand: ${subcommand}
28
+ Usage: abtars tribe join --peer <host:port>
29
+ abtars tribe invite --peer <host:port>
30
+ abtars tribe status
31
+ `);
32
+ return 2;
33
+ }
34
+ }
35
+ async function tribeEnroll(args) {
36
+ const peerIdx = args.indexOf("--peer");
37
+ if (peerIdx < 0 || !args[peerIdx + 1]) {
38
+ process.stderr.write("Usage: abtars tribe join --peer <host:port>\n");
39
+ return 1;
40
+ }
41
+ const peerArg = args[peerIdx + 1];
42
+ const colonIdx = peerArg.lastIndexOf(":");
43
+ if (colonIdx < 0) {
44
+ process.stderr.write(`Invalid peer address: ${peerArg} (expected host:port)
45
+ `);
46
+ return 1;
47
+ }
48
+ const host = peerArg.slice(0, colonIdx);
49
+ const port = parseInt(peerArg.slice(colonIdx + 1), 10);
50
+ if (!host || isNaN(port)) {
51
+ process.stderr.write(`Invalid peer address: ${peerArg}
52
+ `);
53
+ return 1;
54
+ }
55
+ bootstrapIdentity();
56
+ const config = loadPeerConfig();
57
+ const selfVerifyKey = deriveVerifyKey(config.self.signingKey);
58
+ process.stdout.write(`Enrolling with ${host}:${port}...
59
+ `);
60
+ const { WsPeerClient } = await import("./ws-peer-client-U3NNPOK7.js");
61
+ const client = new WsPeerClient("__enrolling__", { host, port, verifyKey: "" });
62
+ try {
63
+ await client.enroll(
64
+ config.self.tribeToken,
65
+ config.self.signingKey,
66
+ selfVerifyKey,
67
+ config.self.name
68
+ );
69
+ process.stdout.write(`+ Enrollment successful
70
+ `);
71
+ process.stdout.write(` Own verifyKey: ${selfVerifyKey}
72
+ `);
73
+ process.stdout.write(` Enrolled peer recorded at trust=1.
74
+ `);
75
+ return 0;
76
+ } catch (err) {
77
+ process.stderr.write(`x Enrollment failed: ${err instanceof Error ? err.message : String(err)}
78
+ `);
79
+ return 1;
80
+ }
81
+ }
82
+ async function tribeStatus() {
83
+ bootstrapIdentity();
84
+ const config = loadPeerConfig();
85
+ const verifyKey = deriveVerifyKey(config.self.signingKey);
86
+ process.stdout.write(`Self: ${config.self.name}
87
+ `);
88
+ process.stdout.write(`VerifyKey (share out-of-band for enrollment):
89
+ ${verifyKey}
90
+
91
+ `);
92
+ const peers = Object.entries(config.peers);
93
+ if (peers.length === 0) {
94
+ process.stdout.write("No enrolled peers.\n");
95
+ return 0;
96
+ }
97
+ process.stdout.write(`Enrolled peers (${peers.length}):
98
+ `);
99
+ for (const [name, entry] of peers) {
100
+ const trust = entry.trust ?? 0;
101
+ const trustLabel = trust === 0 ? "quarantine" : trust === 1 ? "enrolled" : trust === 2 ? "trusted" : `owner(${trust})`;
102
+ const transport = entry.transport ?? "http";
103
+ process.stdout.write(` ${name.padEnd(20)} ${entry.host}:${entry.port} trust=${trust}(${trustLabel}) transport=${transport}
104
+ `);
105
+ }
106
+ return 0;
107
+ }
108
+ export {
109
+ tribe
110
+ };
111
+ //# sourceMappingURL=tribe-GDTFYJTK.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/cli/commands/tribe.ts"],
4
+ "sourcesContent": ["/**\n * tribe.ts \u2014 abtars tribe CLI (#1293).\n *\n * Commands:\n * abtars tribe join --peer <host:port> \u2014 enroll with a remote peer (initiator)\n * abtars tribe invite --peer <host:port> \u2014 same (either side can dial; protocol is symmetric)\n * abtars tribe status \u2014 print own verifyKey + list enrolled peers\n */\n\nimport { loadPeerConfig, deriveVerifyKey, bootstrapIdentity } from \"../../components/peer-config.js\";\n\nexport async function tribe(args: string[]): Promise<number> {\n const subcommand = args[0] ?? \"status\";\n\n switch (subcommand) {\n case \"join\":\n case \"invite\":\n return await tribeEnroll(args);\n case \"status\":\n return await tribeStatus();\n default:\n process.stderr.write(`Unknown tribe subcommand: ${subcommand}\\nUsage: abtars tribe join --peer <host:port>\\n abtars tribe invite --peer <host:port>\\n abtars tribe status\\n`);\n return 2;\n }\n}\n\nasync function tribeEnroll(args: string[]): Promise<number> {\n // Parse --peer host:port\n const peerIdx = args.indexOf(\"--peer\");\n if (peerIdx < 0 || !args[peerIdx + 1]) {\n process.stderr.write(\"Usage: abtars tribe join --peer <host:port>\\n\");\n return 1;\n }\n const peerArg = args[peerIdx + 1]!;\n const colonIdx = peerArg.lastIndexOf(\":\");\n if (colonIdx < 0) {\n process.stderr.write(`Invalid peer address: ${peerArg} (expected host:port)\\n`);\n return 1;\n }\n const host = peerArg.slice(0, colonIdx);\n const port = parseInt(peerArg.slice(colonIdx + 1), 10);\n if (!host || isNaN(port)) {\n process.stderr.write(`Invalid peer address: ${peerArg}\\n`);\n return 1;\n }\n\n // Ensure identity exists\n bootstrapIdentity();\n const config = loadPeerConfig();\n const selfVerifyKey = deriveVerifyKey(config.self.signingKey);\n\n process.stdout.write(`Enrolling with ${host}:${port}...\\n`);\n\n const { WsPeerClient } = await import(\"../../components/peer-transport/ws-peer-client.js\");\n const client = new WsPeerClient(\"__enrolling__\", { host, port, verifyKey: \"\" });\n\n try {\n await client.enroll(\n config.self.tribeToken,\n config.self.signingKey,\n selfVerifyKey,\n config.self.name,\n );\n process.stdout.write(`+ Enrollment successful\\n`);\n process.stdout.write(` Own verifyKey: ${selfVerifyKey}\\n`);\n process.stdout.write(` Enrolled peer recorded at trust=1.\\n`);\n return 0;\n } catch (err) {\n process.stderr.write(`x Enrollment failed: ${err instanceof Error ? err.message : String(err)}\\n`);\n return 1;\n }\n}\n\nasync function tribeStatus(): Promise<number> {\n bootstrapIdentity();\n const config = loadPeerConfig();\n const verifyKey = deriveVerifyKey(config.self.signingKey);\n\n process.stdout.write(`Self: ${config.self.name}\\n`);\n process.stdout.write(`VerifyKey (share out-of-band for enrollment):\\n ${verifyKey}\\n\\n`);\n\n const peers = Object.entries(config.peers);\n if (peers.length === 0) {\n process.stdout.write(\"No enrolled peers.\\n\");\n return 0;\n }\n\n process.stdout.write(`Enrolled peers (${peers.length}):\\n`);\n for (const [name, entry] of peers) {\n const trust = entry.trust ?? 0;\n const trustLabel = trust === 0 ? \"quarantine\" : trust === 1 ? \"enrolled\" : trust === 2 ? \"trusted\" : `owner(${trust})`;\n const transport = entry.transport ?? \"http\";\n process.stdout.write(` ${name.padEnd(20)} ${entry.host}:${entry.port} trust=${trust}(${trustLabel}) transport=${transport}\\n`);\n }\n return 0;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AASA;AAEA,eAAsB,MAAM,MAAiC;AAC3D,QAAM,aAAa,KAAK,CAAC,KAAK;AAE9B,UAAQ,YAAY;AAAA,IAClB,KAAK;AAAA,IACL,KAAK;AACH,aAAO,MAAM,YAAY,IAAI;AAAA,IAC/B,KAAK;AACH,aAAO,MAAM,YAAY;AAAA,IAC3B;AACE,cAAQ,OAAO,MAAM,6BAA6B,UAAU;AAAA;AAAA;AAAA;AAAA,CAA4H;AACxL,aAAO;AAAA,EACX;AACF;AAEA,eAAe,YAAY,MAAiC;AAE1D,QAAM,UAAU,KAAK,QAAQ,QAAQ;AACrC,MAAI,UAAU,KAAK,CAAC,KAAK,UAAU,CAAC,GAAG;AACrC,YAAQ,OAAO,MAAM,+CAA+C;AACpE,WAAO;AAAA,EACT;AACA,QAAM,UAAU,KAAK,UAAU,CAAC;AAChC,QAAM,WAAW,QAAQ,YAAY,GAAG;AACxC,MAAI,WAAW,GAAG;AAChB,YAAQ,OAAO,MAAM,yBAAyB,OAAO;AAAA,CAAyB;AAC9E,WAAO;AAAA,EACT;AACA,QAAM,OAAO,QAAQ,MAAM,GAAG,QAAQ;AACtC,QAAM,OAAO,SAAS,QAAQ,MAAM,WAAW,CAAC,GAAG,EAAE;AACrD,MAAI,CAAC,QAAQ,MAAM,IAAI,GAAG;AACxB,YAAQ,OAAO,MAAM,yBAAyB,OAAO;AAAA,CAAI;AACzD,WAAO;AAAA,EACT;AAGA,oBAAkB;AAClB,QAAM,SAAS,eAAe;AAC9B,QAAM,gBAAgB,gBAAgB,OAAO,KAAK,UAAU;AAE5D,UAAQ,OAAO,MAAM,kBAAkB,IAAI,IAAI,IAAI;AAAA,CAAO;AAE1D,QAAM,EAAE,aAAa,IAAI,MAAM,OAAO,8BAAmD;AACzF,QAAM,SAAS,IAAI,aAAa,iBAAiB,EAAE,MAAM,MAAM,WAAW,GAAG,CAAC;AAE9E,MAAI;AACF,UAAM,OAAO;AAAA,MACX,OAAO,KAAK;AAAA,MACZ,OAAO,KAAK;AAAA,MACZ;AAAA,MACA,OAAO,KAAK;AAAA,IACd;AACA,YAAQ,OAAO,MAAM;AAAA,CAA2B;AAChD,YAAQ,OAAO,MAAM,oBAAoB,aAAa;AAAA,CAAI;AAC1D,YAAQ,OAAO,MAAM;AAAA,CAAwC;AAC7D,WAAO;AAAA,EACT,SAAS,KAAK;AACZ,YAAQ,OAAO,MAAM,wBAAwB,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,CAAI;AACjG,WAAO;AAAA,EACT;AACF;AAEA,eAAe,cAA+B;AAC5C,oBAAkB;AAClB,QAAM,SAAS,eAAe;AAC9B,QAAM,YAAY,gBAAgB,OAAO,KAAK,UAAU;AAExD,UAAQ,OAAO,MAAM,SAAS,OAAO,KAAK,IAAI;AAAA,CAAI;AAClD,UAAQ,OAAO,MAAM;AAAA,IAAoD,SAAS;AAAA;AAAA,CAAM;AAExF,QAAM,QAAQ,OAAO,QAAQ,OAAO,KAAK;AACzC,MAAI,MAAM,WAAW,GAAG;AACtB,YAAQ,OAAO,MAAM,sBAAsB;AAC3C,WAAO;AAAA,EACT;AAEA,UAAQ,OAAO,MAAM,mBAAmB,MAAM,MAAM;AAAA,CAAM;AAC1D,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO;AACjC,UAAM,QAAQ,MAAM,SAAS;AAC7B,UAAM,aAAa,UAAU,IAAI,eAAe,UAAU,IAAI,aAAa,UAAU,IAAI,YAAY,SAAS,KAAK;AACnH,UAAM,YAAY,MAAM,aAAa;AACrC,YAAQ,OAAO,MAAM,KAAK,KAAK,OAAO,EAAE,CAAC,IAAI,MAAM,IAAI,IAAI,MAAM,IAAI,WAAW,KAAK,IAAI,UAAU,gBAAgB,SAAS;AAAA,CAAI;AAAA,EAClI;AACA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -2,8 +2,8 @@
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
  update
5
- } from "./chunk-75ATTOW4.js";
6
- import "./chunk-UNM3OXHB.js";
5
+ } from "./chunk-IY6UKLPS.js";
6
+ import "./chunk-HGSHCQ5F.js";
7
7
  import "./chunk-YDY6QVWJ.js";
8
8
  import "./chunk-5NY2YULC.js";
9
9
  import "./chunk-O7KQG6ME.js";
@@ -11,4 +11,4 @@ import "./chunk-7K2YZTLD.js";
11
11
  export {
12
12
  update
13
13
  };
14
- //# sourceMappingURL=update-CKFP6LBE.js.map
14
+ //# sourceMappingURL=update-HGQAOC5L.js.map
@@ -7,7 +7,7 @@ import {
7
7
  readUsage,
8
8
  recordUsage,
9
9
  resetUsage
10
- } from "./chunk-TMUYFERL.js";
10
+ } from "./chunk-6B5ZFUPD.js";
11
11
  import "./chunk-7K2YZTLD.js";
12
12
  export {
13
13
  flushUsage,
@@ -17,4 +17,4 @@ export {
17
17
  recordUsage,
18
18
  resetUsage
19
19
  };
20
- //# sourceMappingURL=usage-tracker-NXD364VX.js.map
20
+ //# sourceMappingURL=usage-tracker-SR4BI6ZT.js.map
@@ -5,9 +5,9 @@ import {
5
5
  init_user_registry,
6
6
  loadUsers,
7
7
  setUserRegistryOverride
8
- } from "./chunk-ZV4IWKDJ.js";
9
- import "./chunk-65VCEC32.js";
10
- import "./chunk-GWILHZPT.js";
8
+ } from "./chunk-E7XD5UGB.js";
9
+ import "./chunk-6PA5JBUU.js";
10
+ import "./chunk-XRTXYN66.js";
11
11
  import "./chunk-GALQBVKO.js";
12
12
  import "./chunk-O7KQG6ME.js";
13
13
  import "./chunk-7K2YZTLD.js";
@@ -17,4 +17,4 @@ export {
17
17
  loadUsers,
18
18
  setUserRegistryOverride
19
19
  };
20
- //# sourceMappingURL=user-registry-35BW4XKM.js.map
20
+ //# sourceMappingURL=user-registry-4PACZJIJ.js.map
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
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
+ import {
4
+ init_logger,
5
+ logInfo,
6
+ logWarn
7
+ } from "./chunk-XRTXYN66.js";
8
+ import "./chunk-GALQBVKO.js";
9
+ import "./chunk-O7KQG6ME.js";
10
+ import "./chunk-7K2YZTLD.js";
11
+
12
+ // src/boot/wire-platform.ts
13
+ init_logger();
14
+ var TAG = "boot";
15
+ async function wireTelegram(ctx) {
16
+ const adapter = ctx.telegramAdapter;
17
+ if (!adapter || !ctx.pipelineDeps || !ctx.transport) return;
18
+ adapter.setMessageHandler({
19
+ pipeline: ctx.pipelineDeps,
20
+ conversationBuffer: ctx.conversationBuffer,
21
+ transport: ctx.transport,
22
+ memory: ctx.memory,
23
+ sessionManager: ctx.sessionManager,
24
+ actionGate: ctx.actionGate
25
+ });
26
+ const mainChatId = ctx.config.mainChatId;
27
+ if (mainChatId) {
28
+ const { setSendDocument } = await import("./tool-registry-JJMWCQKZ.js");
29
+ setSendDocument((path, caption) => adapter.sendDocument(String(mainChatId), path, caption));
30
+ if (ctx.actionGate) {
31
+ const api = adapter.api;
32
+ const chatId = String(mainChatId);
33
+ ctx.actionGate.setNotify(async (text, buttons) => {
34
+ const opts = {};
35
+ if (buttons.length > 0) {
36
+ opts["reply_markup"] = { inline_keyboard: [buttons.map((b) => ({ text: b.text, callback_data: b.data }))] };
37
+ }
38
+ await api.sendMessage(chatId, text, opts);
39
+ });
40
+ }
41
+ }
42
+ logInfo(TAG, "Telegram: full pipeline wired");
43
+ }
44
+ async function wireDiscord(ctx) {
45
+ const adapter = ctx.discordAdapter;
46
+ if (!adapter || !ctx.pipelineDeps || !ctx.transport) return;
47
+ adapter.setMessageHandler({
48
+ pipeline: ctx.pipelineDeps,
49
+ transport: ctx.transport,
50
+ memory: ctx.memory,
51
+ conversationBuffer: ctx.conversationBuffer
52
+ });
53
+ logInfo(TAG, "Discord: full pipeline wired");
54
+ }
55
+ async function wireIrc(ctx) {
56
+ const adapter = ctx.platformAdapters.get("irc");
57
+ if (!adapter || !ctx.pipelineDeps) return;
58
+ const pipelineDeps = ctx.pipelineDeps;
59
+ if ("setMessageHandler" in adapter) {
60
+ const { handleInboundMessage } = await import("./message-pipeline-GRDRWONR.js");
61
+ adapter.setMessageHandler((msg) => {
62
+ void handleInboundMessage(msg, adapter, pipelineDeps);
63
+ });
64
+ const { setIrcSend } = await import("./tool-registry-JJMWCQKZ.js");
65
+ setIrcSend((channel, message) => {
66
+ adapter.sendMessage(channel, message);
67
+ });
68
+ logInfo(TAG, "IRC: full pipeline wired");
69
+ }
70
+ }
71
+ async function drainRecoveryQueue(ctx) {
72
+ const queue = ctx._recoveryQueue;
73
+ if (!queue?.length || !ctx.pipelineDeps) return;
74
+ const pipelineDeps = ctx.pipelineDeps;
75
+ const { handleInboundMessage } = await import("./message-pipeline-GRDRWONR.js");
76
+ logInfo(TAG, `Draining ${queue.length} queued message(s) from recovery handler`);
77
+ for (const { msg, adapter } of queue) {
78
+ handleInboundMessage(msg, adapter, pipelineDeps).catch((err) => logWarn(TAG, `Drain error: ${err}`));
79
+ }
80
+ queue.length = 0;
81
+ }
82
+ export {
83
+ drainRecoveryQueue,
84
+ wireDiscord,
85
+ wireIrc,
86
+ wireTelegram
87
+ };
88
+ //# sourceMappingURL=wire-platform-KKPWNNNQ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/boot/wire-platform.ts"],
4
+ "sourcesContent": ["/**\n * wire-platform.ts \u2014 idempotent per-platform pipeline wiring (#1306).\n *\n * Called from two sites:\n * 1. phasePipelineDeps (boot path) \u2014 after ctx.pipelineDeps is set.\n * 2. factory.create() in phasePlatformsConnect (retry path) \u2014 when a new\n * adapter instance is created after phasePipelineDeps already completed.\n *\n * Each function is a no-op when its prerequisite (adapter + pipelineDeps) is\n * absent, so it is safe to call unconditionally from both paths.\n */\n\nimport { logInfo, logWarn } from \"../components/logger.js\";\nimport type { BootCtx } from \"./context.js\";\n\nconst TAG = \"boot\";\n\n/** Wire the full Telegram pipeline onto ctx.telegramAdapter. Idempotent. */\nexport async function wireTelegram(ctx: BootCtx): Promise<void> {\n const adapter = ctx.telegramAdapter;\n if (!adapter || !ctx.pipelineDeps || !ctx.transport) return;\n\n adapter.setMessageHandler({\n pipeline: ctx.pipelineDeps,\n conversationBuffer: ctx.conversationBuffer,\n transport: ctx.transport,\n memory: ctx.memory,\n sessionManager: ctx.sessionManager,\n actionGate: ctx.actionGate,\n });\n\n // Re-bind send_document tool + ActionGate notify to THIS adapter instance.\n // These are stateful globals that must always point to the live instance.\n const mainChatId = ctx.config.mainChatId;\n if (mainChatId) {\n const { setSendDocument } = await import(\"../components/transport/tool-registry.js\");\n setSendDocument((path, caption) => adapter.sendDocument(String(mainChatId), path, caption));\n if (ctx.actionGate) {\n const api = (adapter as unknown as { api: { sendMessage(chatId: string, text: string, opts?: unknown): Promise<unknown> } }).api;\n const chatId = String(mainChatId);\n ctx.actionGate.setNotify(async (text: string, buttons: Array<{ text: string; data: string }>) => {\n const opts: Record<string, unknown> = {};\n if (buttons.length > 0) {\n opts[\"reply_markup\"] = { inline_keyboard: [buttons.map(b => ({ text: b.text, callback_data: b.data }))] };\n }\n await api.sendMessage(chatId, text, opts);\n });\n }\n }\n\n logInfo(TAG, \"Telegram: full pipeline wired\");\n}\n\n/** Wire the full Discord pipeline onto ctx.discordAdapter. Idempotent. */\nexport async function wireDiscord(ctx: BootCtx): Promise<void> {\n const adapter = ctx.discordAdapter;\n if (!adapter || !ctx.pipelineDeps || !ctx.transport) return;\n\n adapter.setMessageHandler({\n pipeline: ctx.pipelineDeps,\n transport: ctx.transport,\n memory: ctx.memory,\n conversationBuffer: ctx.conversationBuffer,\n });\n\n logInfo(TAG, \"Discord: full pipeline wired\");\n}\n\n/** Wire the full IRC pipeline + send tool onto the IRC adapter. Idempotent. */\nexport async function wireIrc(ctx: BootCtx): Promise<void> {\n const adapter = ctx.platformAdapters.get(\"irc\");\n if (!adapter || !ctx.pipelineDeps) return;\n\n const pipelineDeps = ctx.pipelineDeps;\n\n if (\"setMessageHandler\" in adapter) {\n const { handleInboundMessage } = await import(\"../components/message-pipeline.js\");\n (adapter as unknown as { setMessageHandler(cb: (msg: unknown) => void): void })\n .setMessageHandler((msg) => { void handleInboundMessage(msg as never, adapter as never, pipelineDeps); });\n\n const { setIrcSend } = await import(\"../components/transport/tool-registry.js\");\n setIrcSend((channel, message) => { adapter.sendMessage(channel, message); });\n\n logInfo(TAG, \"IRC: full pipeline wired\");\n }\n}\n\n/** Drain messages queued by the recovery handler while the pipeline was down. */\nexport async function drainRecoveryQueue(ctx: BootCtx): Promise<void> {\n const queue = (ctx as unknown as { _recoveryQueue?: Array<{ msg: unknown; adapter: unknown }> })._recoveryQueue;\n if (!queue?.length || !ctx.pipelineDeps) return;\n\n const pipelineDeps = ctx.pipelineDeps;\n const { handleInboundMessage } = await import(\"../components/message-pipeline.js\");\n\n logInfo(TAG, `Draining ${queue.length} queued message(s) from recovery handler`);\n for (const { msg, adapter } of queue) {\n handleInboundMessage(msg as never, adapter as never, pipelineDeps)\n .catch(err => logWarn(TAG, `Drain error: ${err}`));\n }\n queue.length = 0;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAGA,IAAM,MAAM;AAGZ,eAAsB,aAAa,KAA6B;AAC9D,QAAM,UAAU,IAAI;AACpB,MAAI,CAAC,WAAW,CAAC,IAAI,gBAAgB,CAAC,IAAI,UAAW;AAErD,UAAQ,kBAAkB;AAAA,IACxB,UAAU,IAAI;AAAA,IACd,oBAAoB,IAAI;AAAA,IACxB,WAAW,IAAI;AAAA,IACf,QAAQ,IAAI;AAAA,IACZ,gBAAgB,IAAI;AAAA,IACpB,YAAY,IAAI;AAAA,EAClB,CAAC;AAID,QAAM,aAAa,IAAI,OAAO;AAC9B,MAAI,YAAY;AACd,UAAM,EAAE,gBAAgB,IAAI,MAAM,OAAO,6BAA0C;AACnF,oBAAgB,CAAC,MAAM,YAAY,QAAQ,aAAa,OAAO,UAAU,GAAG,MAAM,OAAO,CAAC;AAC1F,QAAI,IAAI,YAAY;AAClB,YAAM,MAAO,QAAgH;AAC7H,YAAM,SAAS,OAAO,UAAU;AAChC,UAAI,WAAW,UAAU,OAAO,MAAc,YAAmD;AAC/F,cAAM,OAAgC,CAAC;AACvC,YAAI,QAAQ,SAAS,GAAG;AACtB,eAAK,cAAc,IAAI,EAAE,iBAAiB,CAAC,QAAQ,IAAI,QAAM,EAAE,MAAM,EAAE,MAAM,eAAe,EAAE,KAAK,EAAE,CAAC,EAAE;AAAA,QAC1G;AACA,cAAM,IAAI,YAAY,QAAQ,MAAM,IAAI;AAAA,MAC1C,CAAC;AAAA,IACH;AAAA,EACF;AAEA,UAAQ,KAAK,+BAA+B;AAC9C;AAGA,eAAsB,YAAY,KAA6B;AAC7D,QAAM,UAAU,IAAI;AACpB,MAAI,CAAC,WAAW,CAAC,IAAI,gBAAgB,CAAC,IAAI,UAAW;AAErD,UAAQ,kBAAkB;AAAA,IACxB,UAAU,IAAI;AAAA,IACd,WAAW,IAAI;AAAA,IACf,QAAQ,IAAI;AAAA,IACZ,oBAAoB,IAAI;AAAA,EAC1B,CAAC;AAED,UAAQ,KAAK,8BAA8B;AAC7C;AAGA,eAAsB,QAAQ,KAA6B;AACzD,QAAM,UAAU,IAAI,iBAAiB,IAAI,KAAK;AAC9C,MAAI,CAAC,WAAW,CAAC,IAAI,aAAc;AAEnC,QAAM,eAAe,IAAI;AAEzB,MAAI,uBAAuB,SAAS;AAClC,UAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,gCAAmC;AACjF,IAAC,QACE,kBAAkB,CAAC,QAAQ;AAAE,WAAK,qBAAqB,KAAc,SAAkB,YAAY;AAAA,IAAG,CAAC;AAE1G,UAAM,EAAE,WAAW,IAAI,MAAM,OAAO,6BAA0C;AAC9E,eAAW,CAAC,SAAS,YAAY;AAAE,cAAQ,YAAY,SAAS,OAAO;AAAA,IAAG,CAAC;AAE3E,YAAQ,KAAK,0BAA0B;AAAA,EACzC;AACF;AAGA,eAAsB,mBAAmB,KAA6B;AACpE,QAAM,QAAS,IAAkF;AACjG,MAAI,CAAC,OAAO,UAAU,CAAC,IAAI,aAAc;AAEzC,QAAM,eAAe,IAAI;AACzB,QAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,gCAAmC;AAEjF,UAAQ,KAAK,YAAY,MAAM,MAAM,0CAA0C;AAC/E,aAAW,EAAE,KAAK,QAAQ,KAAK,OAAO;AACpC,yBAAqB,KAAc,SAAkB,YAAY,EAC9D,MAAM,SAAO,QAAQ,KAAK,gBAAgB,GAAG,EAAE,CAAC;AAAA,EACrD;AACA,QAAM,SAAS;AACjB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,370 @@
1
+ #!/usr/bin/env node
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
+ import {
4
+ init_wrapper,
5
+ wrapper_default
6
+ } from "./chunk-ZT5ZBGWS.js";
7
+ import "./chunk-R76K6L6H.js";
8
+ import {
9
+ init_peer_config,
10
+ loadPeerConfig
11
+ } from "./chunk-3BG3AIDP.js";
12
+ import "./chunk-5RVOEFGT.js";
13
+ import {
14
+ init_peer_auth,
15
+ signRequest,
16
+ verifyServerCert
17
+ } from "./chunk-WC5O5KOE.js";
18
+ import {
19
+ init_logger,
20
+ logDebug,
21
+ logInfo,
22
+ logWarn
23
+ } from "./chunk-XRTXYN66.js";
24
+ import {
25
+ abtarsHome,
26
+ init_paths
27
+ } from "./chunk-GALQBVKO.js";
28
+ import "./chunk-O7KQG6ME.js";
29
+ import {
30
+ __esm,
31
+ __require
32
+ } from "./chunk-7K2YZTLD.js";
33
+
34
+ // src/components/peer-transport/ws-peer-client.ts
35
+ import { randomUUID } from "node:crypto";
36
+ import { existsSync, readFileSync, writeFileSync, unlinkSync } from "node:fs";
37
+ import { join } from "node:path";
38
+ var TAG, MAX_BACKOFF_MS, REQUEST_TIMEOUT_MS, QUEUE_MAX, WsPeerClient;
39
+ var init_ws_peer_client = __esm({
40
+ "src/components/peer-transport/ws-peer-client.ts"() {
41
+ init_wrapper();
42
+ init_peer_auth();
43
+ init_peer_config();
44
+ init_logger();
45
+ init_paths();
46
+ TAG = "ws-peer";
47
+ MAX_BACKOFF_MS = 3e4;
48
+ REQUEST_TIMEOUT_MS = 3e4;
49
+ QUEUE_MAX = 200;
50
+ WsPeerClient = class {
51
+ ws = null;
52
+ peerName;
53
+ entry;
54
+ backoff = 1e3;
55
+ reconnectTimer = null;
56
+ pushHandler = null;
57
+ pending = /* @__PURE__ */ new Map();
58
+ destroyed = false;
59
+ /** Durable outbound queue: pending messages while disconnected. */
60
+ _queue = [];
61
+ queuePath;
62
+ constructor(peerName, entry) {
63
+ this.peerName = peerName;
64
+ this.entry = entry;
65
+ this.queuePath = join(abtarsHome(), `ws-queue-${peerName}.json`);
66
+ this.loadQueue();
67
+ }
68
+ onPush(handler) {
69
+ this.pushHandler = handler;
70
+ }
71
+ connect() {
72
+ if (this.destroyed) return;
73
+ if (this.ws && (this.ws.readyState === wrapper_default.OPEN || this.ws.readyState === wrapper_default.CONNECTING)) {
74
+ return;
75
+ }
76
+ const config = loadPeerConfig();
77
+ if (!this.entry.verifyKey) {
78
+ logWarn(TAG, `Cannot connect to ${this.peerName}: no verifyKey (not enrolled)`);
79
+ return;
80
+ }
81
+ const url = `wss://${this.entry.host}:${this.entry.port}/v1/ws`;
82
+ const sigHeaders = signRequest("GET", "/v1/ws", "", config.self.signingKey, config.self.name);
83
+ this.ws = new wrapper_default(url, {
84
+ headers: sigHeaders,
85
+ minVersion: "TLSv1.3",
86
+ rejectUnauthorized: true,
87
+ checkServerIdentity: (_host, cert) => {
88
+ if (!cert.raw) return new Error("No cert from peer");
89
+ try {
90
+ const { createPublicKey } = __require("node:crypto");
91
+ const keyObj = createPublicKey({ key: cert.raw, format: "der", type: "spki" });
92
+ const certDerB64 = cert.raw.toString("base64");
93
+ const certPemBlock = `-----BEGIN CERTIFICATE-----
94
+ ${certDerB64.match(/.{1,64}/g).join("\n")}
95
+ -----END CERTIFICATE-----
96
+ `;
97
+ if (!verifyServerCert(certPemBlock, this.entry.verifyKey)) {
98
+ return new Error(`${this.peerName} cert key != enrolled verifyKey`);
99
+ }
100
+ } catch (e) {
101
+ return new Error(`Cert verify: ${e instanceof Error ? e.message : String(e)}`);
102
+ }
103
+ return void 0;
104
+ }
105
+ });
106
+ this.ws.on("open", () => {
107
+ logInfo(TAG, `Connected to ${this.peerName}`);
108
+ this.backoff = 1e3;
109
+ this.ws._socket?.setKeepAlive(true, 2e4);
110
+ this.drainQueue();
111
+ });
112
+ this.ws.on("message", (data) => this.handleMessage(data.toString()));
113
+ this.ws.on("close", () => {
114
+ this.cleanup();
115
+ if (!this.destroyed) this.scheduleReconnect();
116
+ });
117
+ this.ws.on("error", (err) => {
118
+ logDebug(TAG, `WS error (${this.peerName}): ${err.message}`);
119
+ this.ws?.close();
120
+ });
121
+ }
122
+ /**
123
+ * Send a message over the WS. If disconnected, enqueues it for delivery on reconnect.
124
+ */
125
+ async send(method, payload) {
126
+ if (!this.ws || this.ws.readyState !== wrapper_default.OPEN) {
127
+ return this.enqueue(method, payload);
128
+ }
129
+ return this.sendNow(method, payload);
130
+ }
131
+ get connected() {
132
+ return this.ws?.readyState === wrapper_default.OPEN;
133
+ }
134
+ destroy() {
135
+ this.destroyed = true;
136
+ if (this.reconnectTimer) clearTimeout(this.reconnectTimer);
137
+ this.cleanup();
138
+ this.ws?.close();
139
+ this.clearPersistedQueue();
140
+ }
141
+ async sendNow(method, payload) {
142
+ if (!this.ws || this.ws.readyState !== wrapper_default.OPEN) {
143
+ throw new Error(`WS not connected to ${this.peerName}`);
144
+ }
145
+ const id = randomUUID();
146
+ const config = loadPeerConfig();
147
+ const payloadStr = JSON.stringify(payload);
148
+ const sigHeaders = signRequest("POST", `/${method}`, payloadStr, config.self.signingKey, config.self.name);
149
+ return new Promise((resolve, reject) => {
150
+ const timer = setTimeout(() => {
151
+ this.pending.delete(id);
152
+ reject(new Error(`WS request timeout (${this.peerName}/${method})`));
153
+ }, REQUEST_TIMEOUT_MS);
154
+ this.pending.set(id, { resolve, reject, timer });
155
+ this.ws.send(JSON.stringify({ type: "request", id, method, payload, ...sigHeaders }));
156
+ });
157
+ }
158
+ enqueue(method, payload) {
159
+ return new Promise((resolve, reject) => {
160
+ if (this._queue.length >= QUEUE_MAX) {
161
+ const dropped = this._queue.shift();
162
+ logWarn(TAG, `[warn] ws queue for ${this.peerName} full, dropping oldest (${dropped.method})`);
163
+ }
164
+ const entry = { method, payload, id: randomUUID() };
165
+ this._queue.push(entry);
166
+ this.persistQueue();
167
+ resolve({ queued: true, id: entry.id });
168
+ });
169
+ }
170
+ drainQueue() {
171
+ if (this._queue.length === 0) return;
172
+ logInfo(TAG, `Draining ${this._queue.length} queued message(s) for ${this.peerName}`);
173
+ const queue = this._queue.splice(0);
174
+ this.clearPersistedQueue();
175
+ for (const entry of queue) {
176
+ this.sendNow(entry.method, entry.payload).catch((err) => {
177
+ logWarn(TAG, `Queue drain failed for ${this.peerName}/${entry.method}: ${err.message}`);
178
+ });
179
+ }
180
+ }
181
+ persistQueue() {
182
+ try {
183
+ writeFileSync(this.queuePath, JSON.stringify(this._queue), { encoding: "utf-8", mode: 384 });
184
+ } catch {
185
+ }
186
+ }
187
+ clearPersistedQueue() {
188
+ try {
189
+ if (existsSync(this.queuePath)) unlinkSync(this.queuePath);
190
+ } catch {
191
+ }
192
+ }
193
+ loadQueue() {
194
+ try {
195
+ if (existsSync(this.queuePath)) {
196
+ const data = readFileSync(this.queuePath, "utf-8");
197
+ const parsed = JSON.parse(data);
198
+ if (Array.isArray(parsed)) {
199
+ this._queue = parsed.slice(0, QUEUE_MAX);
200
+ if (this._queue.length > 0) {
201
+ logInfo(TAG, `Loaded ${this._queue.length} queued message(s) for ${this.peerName} from disk`);
202
+ }
203
+ }
204
+ }
205
+ } catch {
206
+ }
207
+ }
208
+ handleMessage(raw) {
209
+ try {
210
+ const msg = JSON.parse(raw);
211
+ if (msg.type === "response" && msg.id && this.pending.has(msg.id)) {
212
+ const p = this.pending.get(msg.id);
213
+ this.pending.delete(msg.id);
214
+ clearTimeout(p.timer);
215
+ p.resolve(msg.payload);
216
+ } else if (msg.type === "push") {
217
+ this.pushHandler?.(msg.method, msg.payload);
218
+ }
219
+ } catch {
220
+ }
221
+ }
222
+ cleanup() {
223
+ for (const [, p] of this.pending) {
224
+ clearTimeout(p.timer);
225
+ p.reject(new Error("WS connection closed"));
226
+ }
227
+ this.pending.clear();
228
+ }
229
+ scheduleReconnect() {
230
+ const jitter = this.backoff * (0.8 + Math.random() * 0.4);
231
+ logDebug(TAG, `Reconnecting to ${this.peerName} in ${Math.round(jitter)}ms`);
232
+ this.reconnectTimer = setTimeout(() => {
233
+ this.reconnectTimer = null;
234
+ this.connect();
235
+ }, jitter);
236
+ this.backoff = Math.min(this.backoff * 2, MAX_BACKOFF_MS);
237
+ }
238
+ /**
239
+ * Dialer-side enrollment handshake over /v1/enroll-ws.
240
+ * Called by `abtars tribe join`.
241
+ */
242
+ async enroll(tribeToken, selfSigningKey, selfVerifyKey, selfName) {
243
+ const { randomBytes } = await import("node:crypto");
244
+ const {
245
+ macTribe,
246
+ signEnroll,
247
+ verifyAck
248
+ } = await import("./peer-auth-RI43DKJE.js");
249
+ const { clearPeerConfigCache } = await import("./peer-config-URM7DCW6.js");
250
+ const { writeFileSync: writeFileSync2, existsSync: exSync, mkdirSync } = await import("node:fs");
251
+ const enrollUrl = `wss://${this.entry.host}:${this.entry.port}/v1/enroll-ws`;
252
+ const nonceI = randomBytes(16).toString("hex");
253
+ const tsNow = Math.floor(Date.now() / 1e3);
254
+ return new Promise((resolve, reject) => {
255
+ const enrollWs = new wrapper_default(enrollUrl, {
256
+ minVersion: "TLSv1.3",
257
+ rejectUnauthorized: false
258
+ // Can't pin yet — cert is verified via MAC binding in step B
259
+ });
260
+ let stage = 0;
261
+ let nonceR = "";
262
+ let pubKeyR = "";
263
+ enrollWs.on("open", () => {
264
+ enrollWs.send(JSON.stringify({
265
+ pubKey_i: selfVerifyKey,
266
+ nonce_i: nonceI,
267
+ ts: tsNow
268
+ }));
269
+ stage = 1;
270
+ });
271
+ enrollWs.on("message", async (rawData) => {
272
+ try {
273
+ const msg = JSON.parse(rawData.toString());
274
+ if (stage === 1) {
275
+ const { pubKey_r, nonce_r, ts, mac_r } = msg;
276
+ if (!pubKey_r || !nonce_r || !mac_r) {
277
+ reject(new Error("Invalid challenge"));
278
+ enrollWs.close();
279
+ return;
280
+ }
281
+ const expectedMacR = macTribe(tribeToken, pubKey_r + nonceI);
282
+ if (mac_r !== expectedMacR) {
283
+ reject(new Error("tribe token mismatch \u2014 not same tribe"));
284
+ enrollWs.close();
285
+ return;
286
+ }
287
+ nonceR = nonce_r;
288
+ pubKeyR = pubKey_r;
289
+ stage = 2;
290
+ const macI = macTribe(tribeToken, selfVerifyKey + nonceR);
291
+ const selfSig = signEnroll(selfSigningKey, selfVerifyKey, nonceR, selfName);
292
+ enrollWs.send(JSON.stringify({
293
+ mac_i: macI,
294
+ name: selfName,
295
+ nonce_r: nonceR,
296
+ ts: Math.floor(Date.now() / 1e3),
297
+ selfSig
298
+ }));
299
+ return;
300
+ }
301
+ if (stage === 2) {
302
+ const { name_r, pubKey_r: pubKeyRd, ackSig } = msg;
303
+ if (!ackSig || !name_r) {
304
+ reject(new Error("Invalid ack"));
305
+ enrollWs.close();
306
+ return;
307
+ }
308
+ if (!verifyAck(ackSig, pubKeyRd, name_r, pubKeyRd, nonceR)) {
309
+ reject(new Error("Invalid ack signature"));
310
+ enrollWs.close();
311
+ return;
312
+ }
313
+ const peersPath = join(abtarsHome(), "config", "peers.json");
314
+ let raw = {};
315
+ if (exSync(peersPath)) {
316
+ try {
317
+ raw = JSON.parse(__require("fs").readFileSync(peersPath, "utf-8"));
318
+ } catch {
319
+ raw = {};
320
+ }
321
+ }
322
+ if (!raw.peers || typeof raw.peers !== "object") raw.peers = {};
323
+ raw.peers[name_r] = {
324
+ host: this.entry.host,
325
+ port: this.entry.port,
326
+ verifyKey: pubKeyRd,
327
+ trust: 1,
328
+ transport: "ws-outbound"
329
+ };
330
+ writeFileSync2(peersPath, JSON.stringify(raw, null, 2) + "\n", { encoding: "utf-8" });
331
+ clearPeerConfigCache();
332
+ logInfo(TAG, `Enrolled with '${name_r}' at trust=1`);
333
+ this.ws = enrollWs;
334
+ enrollWs.removeAllListeners("message");
335
+ enrollWs.on("message", (data) => this.handleMessage(data.toString()));
336
+ enrollWs.on("close", () => {
337
+ this.cleanup();
338
+ if (!this.destroyed) this.scheduleReconnect();
339
+ });
340
+ enrollWs.on("error", (err) => {
341
+ logDebug(TAG, `WS error (${this.peerName}): ${err.message}`);
342
+ this.ws?.close();
343
+ });
344
+ resolve();
345
+ }
346
+ } catch (err) {
347
+ reject(err);
348
+ enrollWs.close();
349
+ }
350
+ });
351
+ enrollWs.on("error", (err) => reject(new Error(`Enrollment WS error: ${err.message}`)));
352
+ enrollWs.on("close", (code, reason) => {
353
+ if (stage < 2) reject(new Error(`Enrollment WS closed early: ${code} ${reason}`));
354
+ });
355
+ setTimeout(() => {
356
+ if (stage < 2) {
357
+ reject(new Error("Enrollment timeout"));
358
+ enrollWs.close();
359
+ }
360
+ }, 3e4);
361
+ });
362
+ }
363
+ };
364
+ }
365
+ });
366
+ init_ws_peer_client();
367
+ export {
368
+ WsPeerClient
369
+ };
370
+ //# sourceMappingURL=ws-peer-client-U3NNPOK7.js.map