hyperclaw 5.1.9 → 5.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 (526) hide show
  1. package/README.md +3 -3
  2. package/dist/a2ui-protocol-A2xow5Ch.js +75 -0
  3. package/dist/a2ui-protocol-dTomAnFE.js +75 -0
  4. package/dist/agents-routing-95_s2yea.js +6 -0
  5. package/dist/agents-routing-Bz3SstlK.js +398 -0
  6. package/dist/agents-routing-DHDK2axt.js +6 -0
  7. package/dist/agents-routing-DRMS8Ol-.js +6 -0
  8. package/dist/agents-routing-biXULPch.js +398 -0
  9. package/dist/agents-routing-iQmIOe3k.js +398 -0
  10. package/dist/api-key-validation-BeQ2MZAT.js +64 -0
  11. package/dist/api-key-validation-C2WQk1oM.js +64 -0
  12. package/dist/api-keys-guide-2cD5Rf-K.js +149 -0
  13. package/dist/api-keys-guide-BdT2lfX6.js +149 -0
  14. package/dist/api-keys-guide-BwCIj8qd.js +149 -0
  15. package/dist/audit-1Anq45mH.js +441 -0
  16. package/dist/audit-BAVTInWP.js +441 -0
  17. package/dist/audit-CV0gLGaL.js +444 -0
  18. package/dist/audit-Dnt0XgZD.js +441 -0
  19. package/dist/audit-DqNGdIKU.js +441 -0
  20. package/dist/bounty-tools-Cx7BXUfz.js +211 -0
  21. package/dist/bounty-tools-DWvW3yc-.js +211 -0
  22. package/dist/bounty-tools-FI7DHmsS.js +211 -0
  23. package/dist/bounty-tools-cjmA3Hgk.js +211 -0
  24. package/dist/browser-tools-BGPBCApQ.js +5 -0
  25. package/dist/browser-tools-Btu_vB2d.js +179 -0
  26. package/dist/browser-tools-DF2nQ1hi.js +5 -0
  27. package/dist/browser-tools-DYx4p13A.js +179 -0
  28. package/dist/chat-4ZistSKP.js +310 -0
  29. package/dist/chat-BQMPVq39.js +310 -0
  30. package/dist/chat-BqiMMQc4.js +324 -0
  31. package/dist/chat-BxxYzPaz.js +324 -0
  32. package/dist/chat-C0W8lwhh.js +324 -0
  33. package/dist/chat-CKBxDWAQ.js +324 -0
  34. package/dist/chat-CkCcCkVG.js +324 -0
  35. package/dist/chat-DCOKsydK.js +310 -0
  36. package/dist/chat-DGUj_NDO.js +310 -0
  37. package/dist/chat-DZcZ1Uli.js +310 -0
  38. package/dist/chat-DiIra4_i.js +324 -0
  39. package/dist/claw-tasks-CIkuuhga.js +80 -0
  40. package/dist/claw-tasks-CquRilLP.js +80 -0
  41. package/dist/claw-tasks-xXtZpeY0.js +80 -0
  42. package/dist/config-BEz4yNRx.js +261 -0
  43. package/dist/config-Br73VMLb.js +261 -0
  44. package/dist/config-CXqmvq_H.js +7 -0
  45. package/dist/config-D5vF0kvV.js +261 -0
  46. package/dist/config-D_6MxFk3.js +7 -0
  47. package/dist/config-b2HmFrBr.js +7 -0
  48. package/dist/connector-1H0OW1h8.js +419 -0
  49. package/dist/connector-1qpQ5L-T.js +173 -0
  50. package/dist/connector-2OVpYt0c.js +213 -0
  51. package/dist/connector-8cFkE3X4.js +552 -0
  52. package/dist/connector-B2bZD1id.js +181 -0
  53. package/dist/connector-B3W7quzD.js +568 -0
  54. package/dist/connector-B4FWhOzd.js +189 -0
  55. package/dist/connector-B5fqvoZL.js +239 -0
  56. package/dist/connector-BA8ZbhPt.js +162 -0
  57. package/dist/connector-BFl0XIwB.js +182 -0
  58. package/dist/connector-BIGRhSuN.js +419 -0
  59. package/dist/connector-BK0qVbvh.js +498 -0
  60. package/dist/connector-BMtA4KSF.js +194 -0
  61. package/dist/connector-BPIrifW-.js +218 -0
  62. package/dist/connector-BRNU-rJ4.js +225 -0
  63. package/dist/connector-BS7lvyLd.js +213 -0
  64. package/dist/connector-BZ_-UPUL.js +305 -0
  65. package/dist/connector-Bd0NZ5bT.js +189 -0
  66. package/dist/connector-BjsPwu-Y.js +531 -0
  67. package/dist/connector-BnSsjz1D.js +167 -0
  68. package/dist/connector-BrogAqVQ.js +239 -0
  69. package/dist/connector-BsVTG3U3.js +181 -0
  70. package/dist/connector-By9pLJgR.js +340 -0
  71. package/dist/connector-C7c1ASzT.js +192 -0
  72. package/dist/connector-CIj28thK.js +182 -0
  73. package/dist/connector-CJkuYNd1.js +280 -0
  74. package/dist/connector-CPcUmIHz.js +552 -0
  75. package/dist/connector-CUlP4He3.js +194 -0
  76. package/dist/connector-CZg2I8Tn.js +350 -0
  77. package/dist/connector-C_NtpthL.js +498 -0
  78. package/dist/connector-CddDB9IK.js +192 -0
  79. package/dist/connector-ChQMspky.js +167 -0
  80. package/dist/connector-ClHFpI56.js +425 -0
  81. package/dist/connector-CmhUVhMT.js +531 -0
  82. package/dist/connector-CnX7lwCt.js +425 -0
  83. package/dist/connector-D36oGwnK.js +162 -0
  84. package/dist/connector-DDJ7Nxkq.js +286 -0
  85. package/dist/connector-DDn2QDuf.js +167 -0
  86. package/dist/connector-DO_bzgJn.js +167 -0
  87. package/dist/connector-DVcRo21Y.js +568 -0
  88. package/dist/connector-DhWs2anT.js +189 -0
  89. package/dist/connector-DsY1IXMz.js +508 -0
  90. package/dist/connector-DwRF3CQg.js +218 -0
  91. package/dist/connector-HG61cV9h.js +340 -0
  92. package/dist/connector-HR28FwA5.js +181 -0
  93. package/dist/connector-K0QGRYh5.js +85 -0
  94. package/dist/connector-NliR7NZZ.js +508 -0
  95. package/dist/connector-VolY_hP4.js +350 -0
  96. package/dist/connector-Wjx9ih70.js +286 -0
  97. package/dist/connector-dfqk7NYD.js +181 -0
  98. package/dist/connector-e0W4Mpmq.js +189 -0
  99. package/dist/connector-eK6_phVW.js +280 -0
  100. package/dist/connector-l7UmCYaL.js +225 -0
  101. package/dist/connector-n2YnOJYZ.js +305 -0
  102. package/dist/connector-orobFcqE.js +531 -0
  103. package/dist/connector-r1SRYSqX.js +173 -0
  104. package/dist/connector-tZgn5_Fk.js +85 -0
  105. package/dist/connector-wm4Oe1DK.js +181 -0
  106. package/dist/cost-tracker-DHTv6zpR.js +103 -0
  107. package/dist/cost-tracker-DJ1tiKcx.js +103 -0
  108. package/dist/cost-tracker-jbK_AoIV.js +103 -0
  109. package/dist/credentials-store-C0R-pQM7.js +5 -0
  110. package/dist/credentials-store-C9HwQSY2.js +5 -0
  111. package/dist/credentials-store-D5Xw3F75.js +89 -0
  112. package/dist/credentials-store-DIPxVk51.js +86 -0
  113. package/dist/credentials-store-DU2cVTiY.js +7 -0
  114. package/dist/credentials-store-Djqi3oXC.js +5 -0
  115. package/dist/credentials-store-HwLJ3GS2.js +87 -0
  116. package/dist/credentials-store-z16XvFZ2.js +86 -0
  117. package/dist/cron-tasks-4my0PJce.js +85 -0
  118. package/dist/cron-tasks-CJkI0lo3.js +82 -0
  119. package/dist/cron-tasks-DN1YjYhK.js +82 -0
  120. package/dist/cron-tasks-DuNdK89e.js +82 -0
  121. package/dist/daemon-3xj3FVuw.js +5 -0
  122. package/dist/daemon-3zd_nupj.js +333 -0
  123. package/dist/daemon-B9-h7ryw.js +7 -0
  124. package/dist/daemon-BLC4AL9L.js +401 -0
  125. package/dist/daemon-BR1uU7jH.js +333 -0
  126. package/dist/daemon-BRdtCOoC.js +7 -0
  127. package/dist/daemon-BnmNBHY5.js +384 -0
  128. package/dist/daemon-CCxpXxSb.js +7 -0
  129. package/dist/daemon-CEUxN3SQ.js +7 -0
  130. package/dist/daemon-CHk9_ezz.js +403 -0
  131. package/dist/daemon-CgrsZ0d9.js +320 -0
  132. package/dist/daemon-DCm9RCEz.js +401 -0
  133. package/dist/daemon-DNzuDyu8.js +7 -0
  134. package/dist/daemon-DWFWCLvh.js +7 -0
  135. package/dist/daemon-DbWcGYXq.js +5 -0
  136. package/dist/daemon-DgBZaFyi.js +355 -0
  137. package/dist/daemon-DkdMP-kQ.js +316 -0
  138. package/dist/daemon-Dsyjad7g.js +7 -0
  139. package/dist/daemon-DxoPIGQG.js +333 -0
  140. package/dist/daemon-MXsEPeVa.js +7 -0
  141. package/dist/daemon-RoGBr7z8.js +316 -0
  142. package/dist/daemon-XtFu-VzD.js +5 -0
  143. package/dist/daemon-rpJ-J0bv.js +403 -0
  144. package/dist/daemon-sZVjFUoX.js +7 -0
  145. package/dist/delivery-8fo4GZ-j.js +95 -0
  146. package/dist/delivery-CkxNZIsF.js +95 -0
  147. package/dist/delivery-CtbHkJbB.js +95 -0
  148. package/dist/delivery-D1z3f3KW.js +4 -0
  149. package/dist/delivery-DKGpk5M4.js +4 -0
  150. package/dist/delivery-DReKOHyM.js +95 -0
  151. package/dist/delivery-Ddn-VajP.js +4 -0
  152. package/dist/delivery-DsoxcD2z.js +4 -0
  153. package/dist/destructive-gate-CEn4BsTd.js +101 -0
  154. package/dist/destructive-gate-CgCqfKuT.js +101 -0
  155. package/dist/destructive-gate-DcEpMEqP.js +101 -0
  156. package/dist/developer-keys-7rQ8M4Qo.js +127 -0
  157. package/dist/developer-keys-BeUpyenR.js +8 -0
  158. package/dist/developer-keys-CSmzA-dl.js +127 -0
  159. package/dist/developer-keys-KFGbGuZj.js +8 -0
  160. package/dist/device-auth-store-BDhzxuPc.js +5 -0
  161. package/dist/device-auth-store-Cjyn2XeY.js +86 -0
  162. package/dist/device-auth-store-DgSabRGa.js +7 -0
  163. package/dist/device-auth-store-LKgpU74c.js +88 -0
  164. package/dist/device-auth-store-UlkrF-9_.js +5 -0
  165. package/dist/device-auth-store-yvGLuYAl.js +86 -0
  166. package/dist/doctor-BcfmNAGV.js +233 -0
  167. package/dist/doctor-CEP3UQjn.js +227 -0
  168. package/dist/doctor-CmJh0JLr.js +6 -0
  169. package/dist/doctor-CtDvddSn.js +231 -0
  170. package/dist/doctor-DPoCaXsd.js +227 -0
  171. package/dist/doctor-DPvY68XB.js +6 -0
  172. package/dist/doctor-G6EMPukm.js +6 -0
  173. package/dist/doctor-tL9TXt9y.js +6 -0
  174. package/dist/engine-1fLMFUn2.js +7 -0
  175. package/dist/engine-7lSiOc0W.js +323 -0
  176. package/dist/engine-B83pxJM4.js +318 -0
  177. package/dist/engine-B8hxtYpN.js +323 -0
  178. package/dist/engine-BY0XLiQ1.js +7 -0
  179. package/dist/engine-BfQ-vNqE.js +321 -0
  180. package/dist/engine-BlpKw8D4.js +7 -0
  181. package/dist/engine-BmN7L0jl.js +7 -0
  182. package/dist/engine-CRagwas6.js +321 -0
  183. package/dist/engine-CaG7uwkg.js +305 -0
  184. package/dist/engine-Ccmpd_MH.js +305 -0
  185. package/dist/engine-CppTnNbG.js +7 -0
  186. package/dist/engine-CwAfDQbD.js +7 -0
  187. package/dist/engine-D5kY4hMJ.js +7 -0
  188. package/dist/engine-DQcMDIbU.js +305 -0
  189. package/dist/engine-DeQdDkFO.js +7 -0
  190. package/dist/engine-W1I8kkgV.js +305 -0
  191. package/dist/engine-mVrq_pfQ.js +7 -0
  192. package/dist/env-resolve-BeamD7l5.js +10 -0
  193. package/dist/env-resolve-C0otwkgN.js +10 -0
  194. package/dist/env-resolve-CC_po9t5.js +10 -0
  195. package/dist/env-resolve-COjiKYD8.js +147 -0
  196. package/dist/env-resolve-CYiFHLAi.js +145 -0
  197. package/dist/env-resolve-ClZcv5-B.js +145 -0
  198. package/dist/env-resolve-DS92g2fk.js +151 -0
  199. package/dist/env-resolve-DkBUmcI3.js +10 -0
  200. package/dist/extraction-tools-6PREYSAK.js +5 -0
  201. package/dist/extraction-tools-B8F3nsLR.js +5 -0
  202. package/dist/extraction-tools-BX5HGgko.js +91 -0
  203. package/dist/extraction-tools-Co11UJdZ.js +91 -0
  204. package/dist/form_data-DDfyO9B0.js +8657 -0
  205. package/dist/form_data-DgWnyuDn.js +8657 -0
  206. package/dist/gateway-BfHcLG6d.js +194 -0
  207. package/dist/gateway-CzI8dnlS.js +196 -0
  208. package/dist/gateway-DNv10FFg.js +194 -0
  209. package/dist/gateway-DRh5v1KI.js +4 -0
  210. package/dist/gateway-DroPtqyM.js +6 -0
  211. package/dist/gateway-DyWwV0Nu.js +4 -0
  212. package/dist/gmail-watch-setup-BV4r_lgb.js +40 -0
  213. package/dist/gmail-watch-setup-CW_5D9g-.js +40 -0
  214. package/dist/gmail-watch-setup-xG9GkPwr.js +42 -0
  215. package/dist/health-CBy1PfzC.js +152 -0
  216. package/dist/health-Cq_yE5Ln.js +6 -0
  217. package/dist/heartbeat-engine-7I0dZeea.js +83 -0
  218. package/dist/heartbeat-engine-BZUNOanp.js +84 -0
  219. package/dist/heartbeat-engine-DNm8ggAs.js +83 -0
  220. package/dist/heartbeat-engine-tgK7xXmt.js +83 -0
  221. package/dist/hub-CI4qcd1b.js +515 -0
  222. package/dist/hub-CNQaC4JI.js +515 -0
  223. package/dist/hub-Co1SbxLs.js +6 -0
  224. package/dist/hub-eUh89obm.js +6 -0
  225. package/dist/hyperclawbot-BD5gNWO8.js +505 -0
  226. package/dist/hyperclawbot-Bkncybig.js +508 -0
  227. package/dist/hyperclawbot-C37Unss3.js +505 -0
  228. package/dist/hyperclawbot-CFHXZr12.js +505 -0
  229. package/dist/hyperclawbot-D6cmZ6Bg.js +505 -0
  230. package/dist/hyperclawbot-DGou0MZ6.js +508 -0
  231. package/dist/hyperclawbot-DnPIyjox.js +508 -0
  232. package/dist/hyperclawbot-GYFaTEgC.js +505 -0
  233. package/dist/hyperclawbot-mcLnyJyM.js +505 -0
  234. package/dist/hyperclawbot-y0i_joQK.js +505 -0
  235. package/dist/inference-BvmMO9dq.js +8 -0
  236. package/dist/inference-C2HOfRf8.js +2848 -0
  237. package/dist/inference-CKvR5Ik5.js +2841 -0
  238. package/dist/inference-DVVmhQn5.js +2841 -0
  239. package/dist/inference-DoM_iai-.js +2848 -0
  240. package/dist/inference-DwgXrvBb.js +6 -0
  241. package/dist/inference-Go1G6tnF.js +8 -0
  242. package/dist/inference-_ptQe0oG.js +2841 -0
  243. package/dist/inference-gK62s15E.js +6 -0
  244. package/dist/inference-lLDvSTR9.js +6 -0
  245. package/dist/knowledge-graph-4SxFnwEm.js +131 -0
  246. package/dist/knowledge-graph-BsH-HoUJ.js +131 -0
  247. package/dist/knowledge-graph-BxrAiV2B.js +134 -0
  248. package/dist/knowledge-graph-DCa91Nz5.js +131 -0
  249. package/dist/loader-7fz2fb92.js +400 -0
  250. package/dist/loader-B2jZXMBu.js +6 -0
  251. package/dist/loader-CbS0tIrR.js +4 -0
  252. package/dist/loader-Ckvv7vHF.js +410 -0
  253. package/dist/loader-CwOXDhFQ.js +400 -0
  254. package/dist/loader-DpEOgWXZ.js +4 -0
  255. package/dist/loader-DpYgmaul.js +4 -0
  256. package/dist/loader-DtyQP7wL.js +400 -0
  257. package/dist/logger-B3AqfQWG.js +84 -0
  258. package/dist/logger-B_q8yqmA.js +84 -0
  259. package/dist/logger-BxJklsDv.js +84 -0
  260. package/dist/logger-ry2oCfdf.js +86 -0
  261. package/dist/manager-9zwhTeQ5.js +233 -0
  262. package/dist/manager-B1RbCW6C.js +31 -0
  263. package/dist/manager-B90HEHxe.js +6 -0
  264. package/dist/manager-B94UWcTs.js +233 -0
  265. package/dist/manager-BDvL_oPs.js +4 -0
  266. package/dist/manager-BEatAtIB.js +31 -0
  267. package/dist/manager-BQf9drst.js +120 -0
  268. package/dist/manager-Bau1mIqb.js +6 -0
  269. package/dist/manager-BkqHak_e.js +247 -0
  270. package/dist/manager-BoFdZm-l.js +233 -0
  271. package/dist/manager-C2bq0AXc.js +233 -0
  272. package/dist/manager-CBe3W3eG.js +117 -0
  273. package/dist/manager-CoHr8_eJ.js +117 -0
  274. package/dist/manager-CuS13QUO.js +6 -0
  275. package/dist/manager-DO0pK2OI.js +117 -0
  276. package/dist/manager-DVetfBCH.js +6 -0
  277. package/dist/manager-Jd0qSzVe.js +35 -0
  278. package/dist/manager-TxFgaHT9.js +31 -0
  279. package/dist/manager-Yo6ZAofG.js +250 -0
  280. package/dist/mcp-B_WJiTZz.js +139 -0
  281. package/dist/mcp-DVhPLprc.js +139 -0
  282. package/dist/mcp-GWnLTVi-.js +142 -0
  283. package/dist/mcp-loader-B6xz7ftt.js +94 -0
  284. package/dist/mcp-loader-BLanJREp.js +94 -0
  285. package/dist/mcp-loader-Bx7FFxAU.js +94 -0
  286. package/dist/mcp-loader-CbcyUzpM.js +94 -0
  287. package/dist/mcp-loader-Cr0LRQHE.js +93 -0
  288. package/dist/mcp-loader-D0rbtV3G.js +93 -0
  289. package/dist/memory-B47nvgOq.js +271 -0
  290. package/dist/memory-D-Py-cz5.js +273 -0
  291. package/dist/memory-D991eoj7.js +6 -0
  292. package/dist/memory-DoQoaHjo.js +4 -0
  293. package/dist/memory-auto-5aBZQJQY.js +5 -0
  294. package/dist/memory-auto-BTeOoLsb.js +306 -0
  295. package/dist/memory-auto-BvjfaflZ.js +5 -0
  296. package/dist/memory-auto-CSUt3aas.js +306 -0
  297. package/dist/memory-auto-CfpACu6s.js +306 -0
  298. package/dist/memory-auto-DI9Xpd-x.js +306 -0
  299. package/dist/memory-auto-D_mPVYqI.js +5 -0
  300. package/dist/memory-auto-PmKetZuo.js +5 -0
  301. package/dist/memory-auto-_Jv-Diw_.js +306 -0
  302. package/dist/memory-auto-rLBheyC0.js +5 -0
  303. package/dist/memory-integration-UFc6CdRA.js +91 -0
  304. package/dist/memory-integration-_NOy60Fj.js +91 -0
  305. package/dist/memory-integration-nbQ8esDu.js +91 -0
  306. package/dist/moltbook-B4znBD46.js +81 -0
  307. package/dist/moltbook-CGtA7Lb3.js +81 -0
  308. package/dist/moltbook-EZOfIwcN.js +81 -0
  309. package/dist/node-BvA5_2f_.js +222 -0
  310. package/dist/node-CRaZw_av.js +225 -0
  311. package/dist/node-CSOPY84m.js +222 -0
  312. package/dist/node-FPkFXYdU.js +225 -0
  313. package/dist/nodes-registry--DkZbn41.js +52 -0
  314. package/dist/nodes-registry-DYEH1aWn.js +52 -0
  315. package/dist/nodes-registry-jK7T0THg.js +52 -0
  316. package/dist/oauth-flow-B3S4T_SJ.js +147 -0
  317. package/dist/oauth-flow-CuQHP_RD.js +150 -0
  318. package/dist/oauth-flow-D_iqT6nr.js +150 -0
  319. package/dist/oauth-flow-Du2N6B2V.js +150 -0
  320. package/dist/oauth-provider-B2RBpiXg.js +111 -0
  321. package/dist/oauth-provider-C1qk9SI-.js +110 -0
  322. package/dist/oauth-provider-CDOMIZgF.js +110 -0
  323. package/dist/observability-4CyDqBWi.js +89 -0
  324. package/dist/observability-BfhV3r9r.js +89 -0
  325. package/dist/observability-DAnU8Ung.js +89 -0
  326. package/dist/onboard-0RpraIyZ.js +11 -0
  327. package/dist/onboard-3SoScSbC.js +11 -0
  328. package/dist/onboard-B8zjN52U.js +4149 -0
  329. package/dist/onboard-BAhuTUMO.js +4240 -0
  330. package/dist/onboard-BHKBzytX.js +13 -0
  331. package/dist/onboard-Bf3ht6ct.js +11 -0
  332. package/dist/onboard-Bmpa_pxc.js +3865 -0
  333. package/dist/onboard-BwFFnEDj.js +13 -0
  334. package/dist/onboard-C-0A7RKN.js +4211 -0
  335. package/dist/onboard-CCuETEUr.js +3865 -0
  336. package/dist/onboard-CDi3B996.js +13 -0
  337. package/dist/onboard-CGGZRH3J.js +4149 -0
  338. package/dist/onboard-CcXqOCHa.js +3862 -0
  339. package/dist/onboard-DU3acWAq.js +13 -0
  340. package/dist/onboard-DVEFIFRj.js +11 -0
  341. package/dist/onboard-DW8b3EUP.js +4250 -0
  342. package/dist/onboard-DiDTuD7m.js +13 -0
  343. package/dist/onboard-DqamkA0I.js +11 -0
  344. package/dist/onboard-DtDFU4lV.js +3865 -0
  345. package/dist/onboard-IdhgSexF.js +11 -0
  346. package/dist/onboard-Qh-qibLR.js +3861 -0
  347. package/dist/onboard-T54jLovz.js +13 -0
  348. package/dist/onboard-nQerZcpc.js +3862 -0
  349. package/dist/onboard-qXuXl5An.js +4250 -0
  350. package/dist/onboard-xgJmy17T.js +11 -0
  351. package/dist/onboard-xsSdyO6Y.js +3865 -0
  352. package/dist/onboard-yACJiQ6A.js +4215 -0
  353. package/dist/onboard-z1K8FTgh.js +13 -0
  354. package/dist/orchestrator-BIKrbOtx.js +6 -0
  355. package/dist/orchestrator-BeK8XyJY.js +6 -0
  356. package/dist/orchestrator-C71UI_0E.js +189 -0
  357. package/dist/orchestrator-CC6vuL6m.js +6 -0
  358. package/dist/orchestrator-CExmcac2.js +189 -0
  359. package/dist/orchestrator-CQm9v71d.js +6 -0
  360. package/dist/orchestrator-CSZnojZo.js +189 -0
  361. package/dist/orchestrator-Cc-gXExz.js +189 -0
  362. package/dist/orchestrator-Cj5XWVVe.js +189 -0
  363. package/dist/orchestrator-CxySH0n5.js +6 -0
  364. package/dist/orchestrator-Cybvh-J0.js +189 -0
  365. package/dist/orchestrator-D-9pExNB.js +189 -0
  366. package/dist/orchestrator-DG-RjZIu.js +6 -0
  367. package/dist/orchestrator-DvEjhiJR.js +6 -0
  368. package/dist/orchestrator-FFpXJwSV.js +189 -0
  369. package/dist/orchestrator-TsNkrbVG.js +6 -0
  370. package/dist/orchestrator-mPfwBFvX.js +6 -0
  371. package/dist/orchestrator-zS6Manjk.js +189 -0
  372. package/dist/osint-BIGH02i8.js +277 -0
  373. package/dist/osint-Cc2Ju-o4.js +277 -0
  374. package/dist/osint-Cg3-CYHx.js +278 -0
  375. package/dist/pairing-BRPzVXzQ.js +198 -0
  376. package/dist/pairing-Cm78Tsdx.js +4 -0
  377. package/dist/pairing-D4sA3-Ha.js +6 -0
  378. package/dist/pairing-ouc_v-OX.js +196 -0
  379. package/dist/pc-access-BZvlAXYN.js +819 -0
  380. package/dist/pc-access-CziyndiO.js +8 -0
  381. package/dist/pc-access-D5k6dAfU.js +819 -0
  382. package/dist/pc-access-DoPSPiAK.js +8 -0
  383. package/dist/pending-approval-BaKZ0b_s.js +22 -0
  384. package/dist/pending-approval-CBVZcFJn.js +22 -0
  385. package/dist/pending-approval-DiZ96D8v.js +22 -0
  386. package/dist/providers-Bk6Y_v9m.js +681 -0
  387. package/dist/providers-BvScOYvt.js +5 -0
  388. package/dist/providers-CFQC39vg.js +5 -0
  389. package/dist/providers-DEJ8Jtml.js +1089 -0
  390. package/dist/providers-DP8T0QCR.js +1089 -0
  391. package/dist/providers-EyJsZ-sr.js +5 -0
  392. package/dist/reminders-store-BSIw5Y5z.js +58 -0
  393. package/dist/reminders-store-Bus52SjO.js +58 -0
  394. package/dist/renderer-CmMjrkqN.js +225 -0
  395. package/dist/renderer-_Y9mEqMM.js +225 -0
  396. package/dist/renderer-h3ar94cf.js +228 -0
  397. package/dist/rules-D3GcY_lt.js +103 -0
  398. package/dist/rules-DFoset7W.js +103 -0
  399. package/dist/rules-eJw9i4RF.js +106 -0
  400. package/dist/run-main.js +460 -332
  401. package/dist/runner-C-syOqBr.js +1273 -0
  402. package/dist/runner-C73am--A.js +1273 -0
  403. package/dist/runner-DKLq9jhv.js +1273 -0
  404. package/dist/runner-Im-aCXhh.js +1273 -0
  405. package/dist/runner-NvAzKXbv.js +1273 -0
  406. package/dist/security-2DPBzs5F.js +4 -0
  407. package/dist/security-BhhX8wJx.js +73 -0
  408. package/dist/server-7tmTtdPU.js +4 -0
  409. package/dist/server-A38RPbRE.js +1291 -0
  410. package/dist/server-BErPWJZ5.js +4 -0
  411. package/dist/server-BKo-zifC.js +4 -0
  412. package/dist/server-Bav63Eqx.js +4 -0
  413. package/dist/server-BbWQWOH4.js +4 -0
  414. package/dist/server-BfHtA0Y2.js +1278 -0
  415. package/dist/server-BiYaxlFV.js +1287 -0
  416. package/dist/server-C6htB4FI.js +4 -0
  417. package/dist/server-CB7cjcj4.js +1278 -0
  418. package/dist/server-CNiOi5dN.js +1285 -0
  419. package/dist/server-CSC4npaT.js +1285 -0
  420. package/dist/server-CZfP2Poz.js +1278 -0
  421. package/dist/server-C_YVts3e.js +4 -0
  422. package/dist/server-CbQl0M21.js +1278 -0
  423. package/dist/server-CeZNKjAL.js +4 -0
  424. package/dist/server-Ct7Fl3SE.js +1285 -0
  425. package/dist/server-DBUnNWZY.js +1255 -0
  426. package/dist/server-DRc26z9e.js +4 -0
  427. package/dist/server-DT7JjjVD.js +4 -0
  428. package/dist/server-DUVnyXaR.js +1255 -0
  429. package/dist/server-DacRJyZn.js +4 -0
  430. package/dist/server-Dy7Q-YLx.js +4 -0
  431. package/dist/server-PCtHMXe2.js +1292 -0
  432. package/dist/session-store-7ZPOoB81.js +5 -0
  433. package/dist/session-store-BOa2y_EQ.js +5 -0
  434. package/dist/session-store-BYEr8j52.js +139 -0
  435. package/dist/session-store-Bx7lBD_a.js +141 -0
  436. package/dist/session-store-C13h7I2r.js +136 -0
  437. package/dist/session-store-CUHgJ0Xr.js +5 -0
  438. package/dist/session-store-cbtK6hx9.js +136 -0
  439. package/dist/session-store-eecMioKI.js +5 -0
  440. package/dist/sessions-tools-B5_ow-s7.js +5 -0
  441. package/dist/sessions-tools-CG2mvJo6.js +95 -0
  442. package/dist/sessions-tools-DVSejkNU.js +95 -0
  443. package/dist/sessions-tools-fOL1N3Zu.js +5 -0
  444. package/dist/skill-loader-99egKAGN.js +160 -0
  445. package/dist/skill-loader-Bl6pYxNN.js +160 -0
  446. package/dist/skill-loader-D4D5kfDu.js +7 -0
  447. package/dist/skill-loader-DwbmjEDa.js +7 -0
  448. package/dist/skill-runtime-1CrUOOGv.js +5 -0
  449. package/dist/skill-runtime-B-2O7Vgb.js +102 -0
  450. package/dist/skill-runtime-B7PutgyZ.js +5 -0
  451. package/dist/skill-runtime-BUhMkMzO.js +5 -0
  452. package/dist/skill-runtime-Bsf3CXxL.js +102 -0
  453. package/dist/skill-runtime-Bv7fCCx8.js +102 -0
  454. package/dist/skill-runtime-Bx2HHcta.js +102 -0
  455. package/dist/skill-runtime-C6HVvnmN.js +5 -0
  456. package/dist/skill-runtime-C_54rn66.js +5 -0
  457. package/dist/skill-runtime-CtSykP3r.js +102 -0
  458. package/dist/skill-runtime-DZ6uJXGW.js +102 -0
  459. package/dist/skill-runtime-DaLnq_Jm.js +5 -0
  460. package/dist/skill-runtime-Do7NLtoa.js +5 -0
  461. package/dist/skill-runtime-DpDbjL7y.js +102 -0
  462. package/dist/skill-runtime-acmnZSq7.js +102 -0
  463. package/dist/skill-runtime-dzuLMVSw.js +5 -0
  464. package/dist/skill-runtime-fDLfk3m3.js +102 -0
  465. package/dist/skill-runtime-wiVnzSoJ.js +5 -0
  466. package/dist/src-B5lCcPXX.js +63 -0
  467. package/dist/src-B7Kxqi35.js +20 -0
  468. package/dist/src-B8DEmVd6.js +458 -0
  469. package/dist/src-BqbwzQQj.js +63 -0
  470. package/dist/src-C63ECu1t.js +63 -0
  471. package/dist/src-C65-5rOW.js +458 -0
  472. package/dist/src-CQOQRIzS.js +458 -0
  473. package/dist/src-CbTAVbeI.js +20 -0
  474. package/dist/src-Cmnclt47.js +63 -0
  475. package/dist/src-D0kptBSa.js +458 -0
  476. package/dist/src-DQ9Q89FM.js +458 -0
  477. package/dist/src-DXaT-nxD.js +63 -0
  478. package/dist/src-DZtpIvWJ.js +63 -0
  479. package/dist/src-DjzS20TD.js +63 -0
  480. package/dist/src-DmPjS2Z4.js +458 -0
  481. package/dist/src-DmbIgW0O.js +63 -0
  482. package/dist/src-DrDuFPKq.js +63 -0
  483. package/dist/src-DsaXFru7.js +63 -0
  484. package/dist/src-Dt0TXI8r.js +458 -0
  485. package/dist/src-rktqvEBJ.js +458 -0
  486. package/dist/src-tI8EOp6-.js +458 -0
  487. package/dist/src-zWhGmJSN.js +458 -0
  488. package/dist/sub-agent-tools-9k60L5mn.js +39 -0
  489. package/dist/sub-agent-tools-BBJf8oPD.js +39 -0
  490. package/dist/sub-agent-tools-BVCARpnF.js +39 -0
  491. package/dist/sub-agent-tools-Bfk5uqJo.js +39 -0
  492. package/dist/sub-agent-tools-Cx5BB5IO.js +39 -0
  493. package/dist/sub-agent-tools-DMT7jjBc.js +39 -0
  494. package/dist/sub-agent-tools-XeiuvDg5.js +39 -0
  495. package/dist/sub-agent-tools-iBQiRKg6.js +39 -0
  496. package/dist/sub-agent-tools-kr921YOA.js +39 -0
  497. package/dist/theme-CLXvI6Hr.js +183 -0
  498. package/dist/theme-DdZT-Bq4.js +10 -0
  499. package/dist/theme-GEpjn_0G.js +180 -0
  500. package/dist/theme-hOlG-hDL.js +8 -0
  501. package/dist/tool-policy-D1zWYBKm.js +189 -0
  502. package/dist/tool-policy-TmXx_fpp.js +189 -0
  503. package/dist/tool-policy-YgysHf5s.js +189 -0
  504. package/dist/tts-elevenlabs-BT4WrEwy.js +61 -0
  505. package/dist/tts-elevenlabs-C62Wnnrg.js +61 -0
  506. package/dist/tts-elevenlabs-DmEFFeR8.js +61 -0
  507. package/dist/update-check-BeAPt4-f.js +98 -0
  508. package/dist/update-check-CaHNCDqe.js +6 -0
  509. package/dist/vision-B5DQ5hYa.js +121 -0
  510. package/dist/vision-XOSSQe4m.js +121 -0
  511. package/dist/vision-sIO3kwFy.js +121 -0
  512. package/dist/vision-tools-BHogJPuK.js +5 -0
  513. package/dist/vision-tools-BZhV8wg3.js +51 -0
  514. package/dist/vision-tools-BiDKd0UA.js +5 -0
  515. package/dist/vision-tools-CdRxilYR.js +5 -0
  516. package/dist/vision-tools-DnUjpQhI.js +51 -0
  517. package/dist/vision-tools-gtUq6d-x.js +51 -0
  518. package/dist/voice-transcription-5_iQE-0C.js +138 -0
  519. package/dist/voice-transcription-C3SuzK96.js +138 -0
  520. package/dist/voice-transcription-CYFj4Iv3.js +138 -0
  521. package/dist/voice-transcription-ygmlOkky.js +138 -0
  522. package/dist/website-watch-tools-BF-wR0UI.js +5 -0
  523. package/dist/website-watch-tools-CVh7RA5-.js +139 -0
  524. package/dist/website-watch-tools-CthBrGPP.js +5 -0
  525. package/dist/website-watch-tools-Oxf8Mv4j.js +139 -0
  526. package/package.json +1 -1
@@ -0,0 +1,425 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const chalk = require_chunk.__toESM(require("chalk"));
3
+ const fs_extra = require_chunk.__toESM(require("fs-extra"));
4
+ const path = require_chunk.__toESM(require("path"));
5
+ const os = require_chunk.__toESM(require("os"));
6
+ const https = require_chunk.__toESM(require("https"));
7
+ const events = require_chunk.__toESM(require("events"));
8
+
9
+ //#region extensions/zalo/src/connector.ts
10
+ const STATE_BASE = path.default.join(os.default.homedir(), ".hyperclaw");
11
+ const BOT_API_HOST = "bot.zaloplatforms.com";
12
+ const BOT_API_BASE = "/v3";
13
+ const TEXT_CHUNK = 2e3;
14
+ const DEFAULT_MEDIA_MB = 5;
15
+ const PAIRING_TTL_MS = 60 * 60 * 1e3;
16
+ const DEDUP_TTL_MS = 6e4;
17
+ function zaloApi(token, method, apiPath, body) {
18
+ return new Promise((resolve, reject) => {
19
+ const payload = body ? JSON.stringify(body) : null;
20
+ const qs = method === "GET" && !body ? "" : "";
21
+ const req = https.default.request({
22
+ hostname: BOT_API_HOST,
23
+ port: 443,
24
+ path: `${BOT_API_BASE}${apiPath}${qs}`,
25
+ method,
26
+ headers: {
27
+ Authorization: `Bot ${token}`,
28
+ Accept: "application/json",
29
+ ...payload ? {
30
+ "Content-Type": "application/json",
31
+ "Content-Length": Buffer.byteLength(payload)
32
+ } : {}
33
+ }
34
+ }, (res) => {
35
+ let data = "";
36
+ res.on("data", (c) => data += c);
37
+ res.on("end", () => {
38
+ try {
39
+ const r = JSON.parse(data);
40
+ if (r.error && r.error !== 0) reject(new Error(r.message || `Zalo error ${r.error}`));
41
+ else resolve(r);
42
+ } catch {
43
+ reject(new Error("Zalo: invalid JSON"));
44
+ }
45
+ });
46
+ });
47
+ req.on("error", reject);
48
+ req.setTimeout(35e3, () => {
49
+ req.destroy();
50
+ reject(new Error("Zalo API timeout"));
51
+ });
52
+ if (payload) req.write(payload);
53
+ req.end();
54
+ });
55
+ }
56
+ function zaloApiQuery(token, apiPath, params) {
57
+ return new Promise((resolve, reject) => {
58
+ const qs = new URLSearchParams(Object.fromEntries(Object.entries(params).map(([k, v]) => [k, String(v)]))).toString();
59
+ const req = https.default.request({
60
+ hostname: BOT_API_HOST,
61
+ port: 443,
62
+ path: `${BOT_API_BASE}${apiPath}?${qs}`,
63
+ method: "GET",
64
+ headers: {
65
+ Authorization: `Bot ${token}`,
66
+ Accept: "application/json"
67
+ }
68
+ }, (res) => {
69
+ let data = "";
70
+ res.on("data", (c) => data += c);
71
+ res.on("end", () => {
72
+ try {
73
+ const r = JSON.parse(data);
74
+ if (r.error && r.error !== 0) reject(new Error(r.message || `Zalo error ${r.error}`));
75
+ else resolve(r);
76
+ } catch {
77
+ reject(new Error("Zalo: invalid JSON"));
78
+ }
79
+ });
80
+ });
81
+ req.on("error", reject);
82
+ req.setTimeout(4e4, () => {
83
+ req.destroy();
84
+ reject(new Error("Zalo poll timeout"));
85
+ });
86
+ req.end();
87
+ });
88
+ }
89
+ var ZaloAccount = class extends events.EventEmitter {
90
+ cfg;
91
+ accountId;
92
+ token = "";
93
+ running = false;
94
+ offset = 0;
95
+ mediaMaxMb;
96
+ /** Dedup set: "eventName:messageId" → expiry timestamp */
97
+ dedupMap = /* @__PURE__ */ new Map();
98
+ constructor(accountId, cfg) {
99
+ super();
100
+ this.accountId = accountId;
101
+ this.cfg = {
102
+ dmPolicy: "pairing",
103
+ allowFrom: [],
104
+ groupPolicy: "allowlist",
105
+ groupAllowFrom: [],
106
+ mediaMaxMb: DEFAULT_MEDIA_MB,
107
+ pendingPairingTs: {},
108
+ ...cfg
109
+ };
110
+ this.cfg.approvedPairings = this.cfg.approvedPairings ?? [];
111
+ this.cfg.pendingPairings = this.cfg.pendingPairings ?? {};
112
+ this.mediaMaxMb = this.cfg.mediaMaxMb ?? DEFAULT_MEDIA_MB;
113
+ }
114
+ async resolveToken() {
115
+ this.token = this.cfg.botToken || (this.cfg.tokenFile ? (await fs_extra.default.readFile(this.cfg.tokenFile, "utf8")).trim() : "");
116
+ if (!this.token) throw new Error(`Zalo [${this.accountId}]: botToken or tokenFile is required`);
117
+ }
118
+ async connect() {
119
+ await this.resolveToken();
120
+ await this.loadState();
121
+ this.running = true;
122
+ const useWebhook = !!this.cfg.webhookUrl;
123
+ if (useWebhook) {
124
+ await this.registerWebhook();
125
+ console.log(chalk.default.green(` 🔵 Zalo [${this.accountId}]: webhook mode — ${this.cfg.webhookUrl}`));
126
+ } else {
127
+ console.log(chalk.default.green(` 🔵 Zalo [${this.accountId}]: long-polling started`));
128
+ this.pollLoop();
129
+ }
130
+ this.emit("connected", {
131
+ accountId: this.accountId,
132
+ mode: useWebhook ? "webhook" : "polling"
133
+ });
134
+ }
135
+ disconnect() {
136
+ this.running = false;
137
+ }
138
+ async registerWebhook() {
139
+ if (!this.cfg.webhookUrl || !this.cfg.webhookSecret) return;
140
+ try {
141
+ await zaloApi(this.token, "POST", "/webhook", {
142
+ url: this.cfg.webhookUrl,
143
+ secret_token: this.cfg.webhookSecret
144
+ });
145
+ } catch (e) {
146
+ console.log(chalk.default.yellow(` ⚠ Zalo [${this.accountId}]: webhook registration: ${e.message}`));
147
+ }
148
+ }
149
+ async pollLoop() {
150
+ while (this.running) try {
151
+ const resp = await zaloApiQuery(this.token, "/event", {
152
+ timeout: 30,
153
+ offset: this.offset
154
+ });
155
+ const events$1 = Array.isArray(resp?.updates) ? resp.updates : Array.isArray(resp?.result) ? resp.result : Array.isArray(resp) ? resp : [];
156
+ for (const event of events$1) {
157
+ const id = event.update_id ?? event.id;
158
+ if (id != null && id >= this.offset) this.offset = id + 1;
159
+ await this.handleEvent(event);
160
+ }
161
+ } catch (e) {
162
+ if (this.running) {
163
+ console.log(chalk.default.yellow(` ⚠ Zalo [${this.accountId}] poll: ${e.message}`));
164
+ await new Promise((r) => setTimeout(r, 5e3));
165
+ }
166
+ }
167
+ }
168
+ async handleWebhook(rawBody, secretHeader) {
169
+ if (!this.verifyWebhookSecret(secretHeader)) {
170
+ console.log(chalk.default.yellow(` ⚠ Zalo [${this.accountId}]: invalid webhook secret`));
171
+ return;
172
+ }
173
+ let event;
174
+ try {
175
+ event = JSON.parse(rawBody);
176
+ } catch {
177
+ return;
178
+ }
179
+ await this.handleEvent(event);
180
+ }
181
+ verifyWebhookSecret(headerValue) {
182
+ if (!this.cfg.webhookSecret) return true;
183
+ return headerValue === this.cfg.webhookSecret;
184
+ }
185
+ async handleEvent(event) {
186
+ if (!event) return;
187
+ const eventName = event.event_name || event.type || "";
188
+ const messageId = String(event.message?.msg_id || event.message_id || event.id || "");
189
+ if (messageId) {
190
+ const key = `${eventName}:${messageId}`;
191
+ const now = Date.now();
192
+ if (this.dedupMap.has(key)) return;
193
+ this.dedupMap.set(key, now + DEDUP_TTL_MS);
194
+ if (this.dedupMap.size > 1e3) {
195
+ for (const [k, exp] of this.dedupMap) if (exp < now) this.dedupMap.delete(k);
196
+ }
197
+ }
198
+ const sender = event.sender?.id || event.from?.id || event.user_id || "";
199
+ const groupId = event.message?.group_id || event.group_id || "";
200
+ const isGroup = !!groupId;
201
+ let text = "";
202
+ switch (eventName) {
203
+ case "user_send_text":
204
+ case "message":
205
+ text = event.message?.text || event.text || "";
206
+ break;
207
+ case "user_send_image":
208
+ case "message_image": {
209
+ const url = event.message?.attachments?.[0]?.payload?.url || event.image_url || "";
210
+ const size = event.message?.attachments?.[0]?.payload?.filesize || 0;
211
+ const maxBytes = this.mediaMaxMb * 1024 * 1024;
212
+ if (size > maxBytes) return;
213
+ text = url ? `[image:${url}]` : "[image]";
214
+ break;
215
+ }
216
+ case "user_send_sticker":
217
+ case "message_sticker": return;
218
+ default: return;
219
+ }
220
+ if (!text || !sender) return;
221
+ if (isGroup) {
222
+ if (!this.checkGroupPolicy(groupId, sender)) return;
223
+ this.emit("message", {
224
+ channelId: "zalo",
225
+ accountId: this.accountId,
226
+ chatId: groupId,
227
+ from: sender,
228
+ text,
229
+ isDM: false
230
+ });
231
+ } else {
232
+ const allowed = await this.checkDMPolicy(sender, text);
233
+ if (!allowed) return;
234
+ this.emit("message", {
235
+ channelId: "zalo",
236
+ accountId: this.accountId,
237
+ chatId: sender,
238
+ from: sender,
239
+ text,
240
+ isDM: true
241
+ });
242
+ }
243
+ }
244
+ async checkDMPolicy(from, text) {
245
+ const policy = this.cfg.dmPolicy ?? "pairing";
246
+ const allowFrom = this.cfg.allowFrom ?? [];
247
+ this.pruneExpiredCodes();
248
+ switch (policy) {
249
+ case "disabled": return false;
250
+ case "open": return true;
251
+ case "allowlist":
252
+ if (allowFrom.includes(from) || allowFrom.includes("*")) return true;
253
+ await this.sendText(from, "HyperClaw: Not on allowlist.");
254
+ return false;
255
+ case "pairing": {
256
+ if (this.cfg.approvedPairings.includes(from)) return true;
257
+ const upper = text.trim().toUpperCase().match(/[A-Z0-9]{6}/)?.[0];
258
+ if (upper && this.cfg.pendingPairings[upper]) {
259
+ this.cfg.approvedPairings.push(from);
260
+ delete this.cfg.pendingPairings[upper];
261
+ delete this.cfg.pendingPairingTs[upper];
262
+ await this.saveState();
263
+ await this.sendText(from, "Paired!");
264
+ this.emit("pairing:approved", {
265
+ userId: from,
266
+ channelId: "zalo",
267
+ accountId: this.accountId
268
+ });
269
+ return true;
270
+ }
271
+ const code = Array.from({ length: 6 }, () => "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"[Math.floor(Math.random() * 32)]).join("");
272
+ this.cfg.pendingPairings[code] = from;
273
+ this.cfg.pendingPairingTs[code] = Date.now();
274
+ await this.saveState();
275
+ await this.sendText(from, `Pairing code: ${code}\nApprove: hyperclaw pairing approve zalo ${code}\n(expires in 1 hour)`);
276
+ return false;
277
+ }
278
+ }
279
+ return false;
280
+ }
281
+ pruneExpiredCodes() {
282
+ const now = Date.now();
283
+ const ts = this.cfg.pendingPairingTs;
284
+ for (const code of Object.keys(ts)) if (now - ts[code] > PAIRING_TTL_MS) {
285
+ delete this.cfg.pendingPairings[code];
286
+ delete ts[code];
287
+ }
288
+ }
289
+ checkGroupPolicy(groupId, userId) {
290
+ const policy = this.cfg.groupPolicy ?? "allowlist";
291
+ if (policy === "disabled") return false;
292
+ if (policy === "open") {
293
+ const list$1 = this.cfg.groupAllowFrom ?? this.cfg.allowFrom ?? [];
294
+ return list$1.length === 0 || list$1.includes(userId);
295
+ }
296
+ const list = this.cfg.groupAllowFrom?.length ? this.cfg.groupAllowFrom : this.cfg.allowFrom ?? [];
297
+ return list.includes(groupId) || list.includes(userId);
298
+ }
299
+ async sendMessage(chatId, text) {
300
+ const chunks = [];
301
+ for (let i = 0; i < text.length; i += TEXT_CHUNK) chunks.push(text.slice(i, i + TEXT_CHUNK));
302
+ for (const chunk of chunks) await this.sendText(chatId, chunk);
303
+ }
304
+ async sendText(to, text) {
305
+ await zaloApi(this.token, "POST", "/message/sendtext", {
306
+ to,
307
+ text
308
+ }).catch((e) => console.error(`[zalo:${this.accountId}] sendText: ${e.message}`));
309
+ }
310
+ async sendPhoto(to, imageUrl, caption) {
311
+ await zaloApi(this.token, "POST", "/message/sendimage", {
312
+ to,
313
+ image_url: imageUrl,
314
+ ...caption ? { caption } : {}
315
+ }).catch((e) => console.error(`[zalo:${this.accountId}] sendPhoto: ${e.message}`));
316
+ }
317
+ approvePairing(code) {
318
+ const upper = code.toUpperCase();
319
+ if (!this.cfg.pendingPairings[upper]) return false;
320
+ this.cfg.approvedPairings.push(this.cfg.pendingPairings[upper]);
321
+ delete this.cfg.pendingPairings[upper];
322
+ delete this.cfg.pendingPairingTs[upper];
323
+ this.saveState();
324
+ return true;
325
+ }
326
+ stateFile() {
327
+ return path.default.join(STATE_BASE, `zalo-bot-state-${this.accountId}.json`);
328
+ }
329
+ async loadState() {
330
+ try {
331
+ const s = await fs_extra.default.readJson(this.stateFile());
332
+ this.offset = s.offset || 0;
333
+ if (s.p) this.cfg.pendingPairings = s.p;
334
+ if (s.a) this.cfg.approvedPairings = s.a;
335
+ if (s.pts) this.cfg.pendingPairingTs = s.pts;
336
+ } catch {}
337
+ }
338
+ async saveState() {
339
+ await fs_extra.default.ensureDir(STATE_BASE);
340
+ await fs_extra.default.writeJson(this.stateFile(), {
341
+ offset: this.offset,
342
+ p: this.cfg.pendingPairings,
343
+ a: this.cfg.approvedPairings,
344
+ pts: this.cfg.pendingPairingTs
345
+ }, { spaces: 2 });
346
+ }
347
+ isRunning() {
348
+ return this.running;
349
+ }
350
+ };
351
+ var ZaloConnector = class extends events.EventEmitter {
352
+ config;
353
+ accounts = [];
354
+ constructor(config) {
355
+ super();
356
+ this.config = config;
357
+ }
358
+ async connect() {
359
+ const sharedState = {
360
+ approvedPairings: this.config.approvedPairings ?? [],
361
+ pendingPairings: this.config.pendingPairings ?? {},
362
+ pendingPairingTs: this.config.pendingPairingTs ?? {}
363
+ };
364
+ const accountEntries = Object.entries(this.config.accounts || {});
365
+ if (accountEntries.length === 0) {
366
+ const acct = new ZaloAccount("default", {
367
+ ...this.config,
368
+ ...sharedState
369
+ });
370
+ this.wire(acct);
371
+ await acct.connect();
372
+ this.accounts.push(acct);
373
+ } else for (const [id, acctCfg] of accountEntries) {
374
+ if (acctCfg.enabled === false) continue;
375
+ const merged = {
376
+ ...this.config,
377
+ ...acctCfg,
378
+ mediaMaxMb: this.config.mediaMaxMb,
379
+ ...sharedState
380
+ };
381
+ if (!merged.botToken && !merged.tokenFile) {
382
+ console.error(`[zalo] Account "${id}" has no botToken or tokenFile — skipping`);
383
+ continue;
384
+ }
385
+ const acct = new ZaloAccount(id, merged);
386
+ this.wire(acct);
387
+ try {
388
+ await acct.connect();
389
+ this.accounts.push(acct);
390
+ } catch (e) {
391
+ console.error(`[zalo] Account "${id}" failed: ${e.message}`);
392
+ }
393
+ }
394
+ }
395
+ wire(acct) {
396
+ acct.on("message", (msg) => this.emit("message", msg));
397
+ acct.on("connected", (info) => this.emit("connected", info));
398
+ acct.on("pairing:approved", (info) => this.emit("pairing:approved", info));
399
+ }
400
+ async sendMessage(chatId, text) {
401
+ const acct = this.accounts[0];
402
+ if (!acct) throw new Error("Zalo: no connected account");
403
+ await acct.sendMessage(chatId, text);
404
+ }
405
+ /** Called by gateway webhook handler for webhook mode accounts. */
406
+ async handleWebhook(rawBody, secretHeader) {
407
+ for (const acct of this.accounts) if (acct.verifyWebhookSecret(secretHeader)) {
408
+ await acct.handleWebhook(rawBody, secretHeader);
409
+ return;
410
+ }
411
+ }
412
+ approvePairing(code) {
413
+ return this.accounts.some((a) => a.approvePairing(code));
414
+ }
415
+ disconnect() {
416
+ for (const a of this.accounts) a.disconnect();
417
+ this.accounts = [];
418
+ }
419
+ isRunning() {
420
+ return this.accounts.some((a) => a.isRunning());
421
+ }
422
+ };
423
+
424
+ //#endregion
425
+ exports.ZaloConnector = ZaloConnector;
@@ -0,0 +1,162 @@
1
+ const require_chunk = require('./chunk-jS-bbMI5.js');
2
+ const chalk = require_chunk.__toESM(require("chalk"));
3
+ const fs_extra = require_chunk.__toESM(require("fs-extra"));
4
+ const path = require_chunk.__toESM(require("path"));
5
+ const os = require_chunk.__toESM(require("os"));
6
+ const https = require_chunk.__toESM(require("https"));
7
+ const events = require_chunk.__toESM(require("events"));
8
+
9
+ //#region extensions/instagram/src/connector.ts
10
+ const STATE_FILE = path.default.join(os.default.homedir(), ".hyperclaw", "instagram-state.json");
11
+ function igReq(token, method, endpoint, body) {
12
+ return new Promise((resolve, reject) => {
13
+ const payload = body ? JSON.stringify(body) : null;
14
+ const req = https.default.request({
15
+ hostname: "graph.facebook.com",
16
+ port: 443,
17
+ path: `/v18.0${endpoint}`,
18
+ method,
19
+ headers: {
20
+ "Authorization": `Bearer ${token}`,
21
+ ...payload ? {
22
+ "Content-Type": "application/json",
23
+ "Content-Length": Buffer.byteLength(payload)
24
+ } : {}
25
+ }
26
+ }, (res) => {
27
+ let data = "";
28
+ res.on("data", (c) => data += c);
29
+ res.on("end", () => {
30
+ try {
31
+ const r = JSON.parse(data);
32
+ if (r.error) reject(new Error(r.error.message));
33
+ else resolve(r);
34
+ } catch {
35
+ reject(new Error("Invalid JSON"));
36
+ }
37
+ });
38
+ });
39
+ req.on("error", reject);
40
+ if (payload) req.write(payload);
41
+ req.end();
42
+ });
43
+ }
44
+ var InstagramConnector = class extends events.EventEmitter {
45
+ config;
46
+ running = false;
47
+ processedIds = /* @__PURE__ */ new Set();
48
+ constructor(config) {
49
+ super();
50
+ this.config = {
51
+ dmPolicy: "allowlist",
52
+ allowFrom: [],
53
+ approvedPairings: [],
54
+ pendingPairings: {},
55
+ ...config
56
+ };
57
+ }
58
+ async connect() {
59
+ const info = await igReq(this.config.pageAccessToken, "GET", `/${this.config.instagramAccountId}?fields=name,username`);
60
+ await this.loadState();
61
+ this.running = true;
62
+ console.log(chalk.default.green(` 🦅 Instagram: @${info.username || info.name} connected`));
63
+ this.emit("connected", {
64
+ accountId: this.config.instagramAccountId,
65
+ username: info.username
66
+ });
67
+ }
68
+ disconnect() {
69
+ this.running = false;
70
+ }
71
+ verifyWebhook(mode, token, challenge) {
72
+ return mode === "subscribe" && token === this.config.verifyToken ? challenge : null;
73
+ }
74
+ async handleWebhook(body) {
75
+ let payload;
76
+ try {
77
+ payload = JSON.parse(body);
78
+ } catch {
79
+ return;
80
+ }
81
+ for (const entry of payload.entry || []) for (const messaging of entry.messaging || []) {
82
+ if (!messaging.message || messaging.message.is_echo) continue;
83
+ const msgId = messaging.message.mid;
84
+ if (this.processedIds.has(msgId)) continue;
85
+ this.processedIds.add(msgId);
86
+ const senderId = messaging.sender.id;
87
+ const text = messaging.message.text;
88
+ if (!text) continue;
89
+ const allowed = await this.checkDMPolicy(senderId, text);
90
+ if (!allowed) continue;
91
+ this.emit("message", {
92
+ id: msgId,
93
+ channelId: "instagram",
94
+ from: senderId,
95
+ chatId: senderId,
96
+ text,
97
+ timestamp: new Date(messaging.timestamp).toISOString(),
98
+ isDM: true
99
+ });
100
+ }
101
+ }
102
+ async checkDMPolicy(from, text) {
103
+ if (this.config.dmPolicy === "none") return false;
104
+ if (this.config.dmPolicy === "open") return true;
105
+ if (this.config.dmPolicy === "allowlist") {
106
+ if (this.config.allowFrom.includes(from)) return true;
107
+ await this.sendMessage(from, "🦅 HyperClaw: You are not on the allowlist.");
108
+ return false;
109
+ }
110
+ if (this.config.dmPolicy === "pairing") {
111
+ if (this.config.approvedPairings.includes(from)) return true;
112
+ const upper = text.trim().toUpperCase();
113
+ if (this.config.pendingPairings[upper]) {
114
+ this.config.approvedPairings.push(from);
115
+ delete this.config.pendingPairings[upper];
116
+ await this.saveState();
117
+ await this.sendMessage(from, "🦅 Paired! You can now send messages.");
118
+ return true;
119
+ }
120
+ const code = Array.from({ length: 6 }, () => "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"[Math.floor(Math.random() * 32)]).join("");
121
+ this.config.pendingPairings[code] = from;
122
+ await this.saveState();
123
+ await this.sendMessage(from, `🦅 HyperClaw Pairing\nCode: ${code}\nApprove: hyperclaw pairing approve instagram ${code}`);
124
+ return false;
125
+ }
126
+ return false;
127
+ }
128
+ async sendMessage(recipientId, text) {
129
+ await igReq(this.config.pageAccessToken, "POST", `/${this.config.instagramAccountId}/messages`, {
130
+ recipient: { id: recipientId },
131
+ message: { text: text.slice(0, 2e3) }
132
+ });
133
+ }
134
+ approvePairing(code) {
135
+ const upper = code.toUpperCase();
136
+ if (!this.config.pendingPairings[upper]) return false;
137
+ this.config.approvedPairings.push(this.config.pendingPairings[upper]);
138
+ delete this.config.pendingPairings[upper];
139
+ this.saveState();
140
+ return true;
141
+ }
142
+ async loadState() {
143
+ try {
144
+ const s = await fs_extra.default.readJson(STATE_FILE);
145
+ if (s.p) this.config.pendingPairings = s.p;
146
+ if (s.a) this.config.approvedPairings = s.a;
147
+ } catch {}
148
+ }
149
+ async saveState() {
150
+ await fs_extra.default.ensureDir(path.default.dirname(STATE_FILE));
151
+ await fs_extra.default.writeJson(STATE_FILE, {
152
+ p: this.config.pendingPairings,
153
+ a: this.config.approvedPairings
154
+ }, { spaces: 2 });
155
+ }
156
+ isRunning() {
157
+ return this.running;
158
+ }
159
+ };
160
+
161
+ //#endregion
162
+ exports.InstagramConnector = InstagramConnector;