hyperclaw 5.2.0 → 5.2.2
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.
- package/README.md +227 -3
- package/dist/a2ui-protocol-A2xow5Ch.js +75 -0
- package/dist/a2ui-protocol-dTomAnFE.js +75 -0
- package/dist/agents-routing-95_s2yea.js +6 -0
- package/dist/agents-routing-Bz3SstlK.js +398 -0
- package/dist/agents-routing-DHDK2axt.js +6 -0
- package/dist/agents-routing-DRMS8Ol-.js +6 -0
- package/dist/agents-routing-biXULPch.js +398 -0
- package/dist/agents-routing-iQmIOe3k.js +398 -0
- package/dist/api-key-validation-BeQ2MZAT.js +64 -0
- package/dist/api-key-validation-C2WQk1oM.js +64 -0
- package/dist/api-keys-guide-2cD5Rf-K.js +149 -0
- package/dist/api-keys-guide-BdT2lfX6.js +149 -0
- package/dist/api-keys-guide-BwCIj8qd.js +149 -0
- package/dist/audit-1Anq45mH.js +441 -0
- package/dist/audit-BAVTInWP.js +441 -0
- package/dist/audit-CV0gLGaL.js +444 -0
- package/dist/audit-Dnt0XgZD.js +441 -0
- package/dist/audit-DqNGdIKU.js +441 -0
- package/dist/bounty-tools-Cx7BXUfz.js +211 -0
- package/dist/bounty-tools-DWvW3yc-.js +211 -0
- package/dist/bounty-tools-FI7DHmsS.js +211 -0
- package/dist/bounty-tools-cjmA3Hgk.js +211 -0
- package/dist/browser-tools-BGPBCApQ.js +5 -0
- package/dist/browser-tools-Btu_vB2d.js +179 -0
- package/dist/browser-tools-DF2nQ1hi.js +5 -0
- package/dist/browser-tools-DYx4p13A.js +179 -0
- package/dist/chat-4ZistSKP.js +310 -0
- package/dist/chat-BqiMMQc4.js +324 -0
- package/dist/chat-BxxYzPaz.js +324 -0
- package/dist/chat-C0W8lwhh.js +324 -0
- package/dist/chat-CKBxDWAQ.js +324 -0
- package/dist/chat-CkCcCkVG.js +324 -0
- package/dist/chat-DCOKsydK.js +310 -0
- package/dist/chat-DZcZ1Uli.js +310 -0
- package/dist/chat-DiIra4_i.js +324 -0
- package/dist/chat-R_NuOa1v.js +324 -0
- package/dist/claw-tasks-CIkuuhga.js +80 -0
- package/dist/claw-tasks-CquRilLP.js +80 -0
- package/dist/claw-tasks-xXtZpeY0.js +80 -0
- package/dist/config-BEz4yNRx.js +261 -0
- package/dist/config-Br73VMLb.js +261 -0
- package/dist/config-CXqmvq_H.js +7 -0
- package/dist/config-D5vF0kvV.js +261 -0
- package/dist/config-D_6MxFk3.js +7 -0
- package/dist/config-b2HmFrBr.js +7 -0
- package/dist/connector-1H0OW1h8.js +419 -0
- package/dist/connector-1qpQ5L-T.js +173 -0
- package/dist/connector-2OVpYt0c.js +213 -0
- package/dist/connector-8cFkE3X4.js +552 -0
- package/dist/connector-B2bZD1id.js +181 -0
- package/dist/connector-B3W7quzD.js +568 -0
- package/dist/connector-B4FWhOzd.js +189 -0
- package/dist/connector-B5fqvoZL.js +239 -0
- package/dist/connector-BA8ZbhPt.js +162 -0
- package/dist/connector-BFl0XIwB.js +182 -0
- package/dist/connector-BIGRhSuN.js +419 -0
- package/dist/connector-BK0qVbvh.js +498 -0
- package/dist/connector-BMtA4KSF.js +194 -0
- package/dist/connector-BPIrifW-.js +218 -0
- package/dist/connector-BRNU-rJ4.js +225 -0
- package/dist/connector-BS7lvyLd.js +213 -0
- package/dist/connector-BZ_-UPUL.js +305 -0
- package/dist/connector-Bd0NZ5bT.js +189 -0
- package/dist/connector-BjsPwu-Y.js +531 -0
- package/dist/connector-BnSsjz1D.js +167 -0
- package/dist/connector-BrogAqVQ.js +239 -0
- package/dist/connector-BsVTG3U3.js +181 -0
- package/dist/connector-By9pLJgR.js +340 -0
- package/dist/connector-C7c1ASzT.js +192 -0
- package/dist/connector-CIj28thK.js +182 -0
- package/dist/connector-CJkuYNd1.js +280 -0
- package/dist/connector-CPcUmIHz.js +552 -0
- package/dist/connector-CUlP4He3.js +194 -0
- package/dist/connector-CZg2I8Tn.js +350 -0
- package/dist/connector-C_NtpthL.js +498 -0
- package/dist/connector-CddDB9IK.js +192 -0
- package/dist/connector-ChQMspky.js +167 -0
- package/dist/connector-ClHFpI56.js +425 -0
- package/dist/connector-CmhUVhMT.js +531 -0
- package/dist/connector-CnX7lwCt.js +425 -0
- package/dist/connector-D36oGwnK.js +162 -0
- package/dist/connector-DDJ7Nxkq.js +286 -0
- package/dist/connector-DDn2QDuf.js +167 -0
- package/dist/connector-DO_bzgJn.js +167 -0
- package/dist/connector-DVcRo21Y.js +568 -0
- package/dist/connector-DhWs2anT.js +189 -0
- package/dist/connector-DsY1IXMz.js +508 -0
- package/dist/connector-DwRF3CQg.js +218 -0
- package/dist/connector-HG61cV9h.js +340 -0
- package/dist/connector-HR28FwA5.js +181 -0
- package/dist/connector-K0QGRYh5.js +85 -0
- package/dist/connector-NliR7NZZ.js +508 -0
- package/dist/connector-VolY_hP4.js +350 -0
- package/dist/connector-Wjx9ih70.js +286 -0
- package/dist/connector-dfqk7NYD.js +181 -0
- package/dist/connector-e0W4Mpmq.js +189 -0
- package/dist/connector-eK6_phVW.js +280 -0
- package/dist/connector-l7UmCYaL.js +225 -0
- package/dist/connector-n2YnOJYZ.js +305 -0
- package/dist/connector-orobFcqE.js +531 -0
- package/dist/connector-r1SRYSqX.js +173 -0
- package/dist/connector-tZgn5_Fk.js +85 -0
- package/dist/connector-wm4Oe1DK.js +181 -0
- package/dist/cost-tracker-DHTv6zpR.js +103 -0
- package/dist/cost-tracker-DJ1tiKcx.js +103 -0
- package/dist/cost-tracker-jbK_AoIV.js +103 -0
- package/dist/credentials-store-C0R-pQM7.js +5 -0
- package/dist/credentials-store-C9HwQSY2.js +5 -0
- package/dist/credentials-store-D5Xw3F75.js +89 -0
- package/dist/credentials-store-DIPxVk51.js +86 -0
- package/dist/credentials-store-DU2cVTiY.js +7 -0
- package/dist/credentials-store-Djqi3oXC.js +5 -0
- package/dist/credentials-store-HwLJ3GS2.js +87 -0
- package/dist/credentials-store-z16XvFZ2.js +86 -0
- package/dist/cron-tasks-4my0PJce.js +85 -0
- package/dist/cron-tasks-CJkI0lo3.js +82 -0
- package/dist/cron-tasks-DN1YjYhK.js +82 -0
- package/dist/cron-tasks-DuNdK89e.js +82 -0
- package/dist/daemon-3xj3FVuw.js +5 -0
- package/dist/daemon-3zd_nupj.js +333 -0
- package/dist/daemon-B9-h7ryw.js +7 -0
- package/dist/daemon-BLC4AL9L.js +401 -0
- package/dist/daemon-BR1uU7jH.js +333 -0
- package/dist/daemon-BRdtCOoC.js +7 -0
- package/dist/daemon-BnmNBHY5.js +384 -0
- package/dist/daemon-BwspQtiu.js +7 -0
- package/dist/daemon-Bx5HTGjk.js +404 -0
- package/dist/daemon-CCxpXxSb.js +7 -0
- package/dist/daemon-CEUxN3SQ.js +7 -0
- package/dist/daemon-CHk9_ezz.js +403 -0
- package/dist/daemon-CgrsZ0d9.js +320 -0
- package/dist/daemon-Cy7iD9au.js +7 -0
- package/dist/daemon-DCm9RCEz.js +401 -0
- package/dist/daemon-DNzuDyu8.js +7 -0
- package/dist/daemon-DWFWCLvh.js +7 -0
- package/dist/daemon-DgBZaFyi.js +355 -0
- package/dist/daemon-Dsyjad7g.js +7 -0
- package/dist/daemon-DwxPYrb6.js +404 -0
- package/dist/daemon-DxoPIGQG.js +333 -0
- package/dist/daemon-MXsEPeVa.js +7 -0
- package/dist/daemon-rpJ-J0bv.js +403 -0
- package/dist/daemon-sZVjFUoX.js +7 -0
- package/dist/delivery-8fo4GZ-j.js +95 -0
- package/dist/delivery-CkxNZIsF.js +95 -0
- package/dist/delivery-CtbHkJbB.js +95 -0
- package/dist/delivery-D1z3f3KW.js +4 -0
- package/dist/delivery-DKGpk5M4.js +4 -0
- package/dist/delivery-DReKOHyM.js +95 -0
- package/dist/delivery-Ddn-VajP.js +4 -0
- package/dist/delivery-DsoxcD2z.js +4 -0
- package/dist/destructive-gate-CEn4BsTd.js +101 -0
- package/dist/destructive-gate-CgCqfKuT.js +101 -0
- package/dist/destructive-gate-DcEpMEqP.js +101 -0
- package/dist/developer-keys-7rQ8M4Qo.js +127 -0
- package/dist/developer-keys-BeUpyenR.js +8 -0
- package/dist/developer-keys-CSmzA-dl.js +127 -0
- package/dist/developer-keys-KFGbGuZj.js +8 -0
- package/dist/device-auth-store-BDhzxuPc.js +5 -0
- package/dist/device-auth-store-Cjyn2XeY.js +86 -0
- package/dist/device-auth-store-DgSabRGa.js +7 -0
- package/dist/device-auth-store-LKgpU74c.js +88 -0
- package/dist/device-auth-store-UlkrF-9_.js +5 -0
- package/dist/device-auth-store-yvGLuYAl.js +86 -0
- package/dist/doctor-BcfmNAGV.js +233 -0
- package/dist/doctor-CEP3UQjn.js +227 -0
- package/dist/doctor-CmJh0JLr.js +6 -0
- package/dist/doctor-CtDvddSn.js +231 -0
- package/dist/doctor-DPoCaXsd.js +227 -0
- package/dist/doctor-DPvY68XB.js +6 -0
- package/dist/doctor-G6EMPukm.js +6 -0
- package/dist/doctor-tL9TXt9y.js +6 -0
- package/dist/engine-1fLMFUn2.js +7 -0
- package/dist/engine-7lSiOc0W.js +323 -0
- package/dist/engine-B83pxJM4.js +318 -0
- package/dist/engine-B8hxtYpN.js +323 -0
- package/dist/engine-BXqijc79.js +7 -0
- package/dist/engine-BfQ-vNqE.js +321 -0
- package/dist/engine-BlpKw8D4.js +7 -0
- package/dist/engine-BmN7L0jl.js +7 -0
- package/dist/engine-CRagwas6.js +321 -0
- package/dist/engine-CppTnNbG.js +7 -0
- package/dist/engine-CwAfDQbD.js +7 -0
- package/dist/engine-D5kY4hMJ.js +7 -0
- package/dist/engine-DJSfl_Hc.js +323 -0
- package/dist/engine-DQcMDIbU.js +305 -0
- package/dist/engine-W1I8kkgV.js +305 -0
- package/dist/engine-mVrq_pfQ.js +7 -0
- package/dist/env-resolve-BeamD7l5.js +10 -0
- package/dist/env-resolve-C0otwkgN.js +10 -0
- package/dist/env-resolve-CC_po9t5.js +10 -0
- package/dist/env-resolve-COjiKYD8.js +147 -0
- package/dist/env-resolve-CYiFHLAi.js +145 -0
- package/dist/env-resolve-ClZcv5-B.js +145 -0
- package/dist/env-resolve-DS92g2fk.js +151 -0
- package/dist/env-resolve-DkBUmcI3.js +10 -0
- package/dist/extraction-tools-6PREYSAK.js +5 -0
- package/dist/extraction-tools-B8F3nsLR.js +5 -0
- package/dist/extraction-tools-BX5HGgko.js +91 -0
- package/dist/extraction-tools-Co11UJdZ.js +91 -0
- package/dist/form_data-DDfyO9B0.js +8657 -0
- package/dist/form_data-DgWnyuDn.js +8657 -0
- package/dist/gateway-BfHcLG6d.js +194 -0
- package/dist/gateway-CzI8dnlS.js +196 -0
- package/dist/gateway-DNv10FFg.js +194 -0
- package/dist/gateway-DRh5v1KI.js +4 -0
- package/dist/gateway-DroPtqyM.js +6 -0
- package/dist/gateway-DyWwV0Nu.js +4 -0
- package/dist/gmail-watch-setup-BV4r_lgb.js +40 -0
- package/dist/gmail-watch-setup-CW_5D9g-.js +40 -0
- package/dist/gmail-watch-setup-xG9GkPwr.js +42 -0
- package/dist/health-CBy1PfzC.js +152 -0
- package/dist/health-Cq_yE5Ln.js +6 -0
- package/dist/heartbeat-engine-7I0dZeea.js +83 -0
- package/dist/heartbeat-engine-BZUNOanp.js +84 -0
- package/dist/heartbeat-engine-DNm8ggAs.js +83 -0
- package/dist/heartbeat-engine-tgK7xXmt.js +83 -0
- package/dist/hub-CI4qcd1b.js +515 -0
- package/dist/hub-CNQaC4JI.js +515 -0
- package/dist/hub-Co1SbxLs.js +6 -0
- package/dist/hub-eUh89obm.js +6 -0
- package/dist/hyperclawbot-Bkncybig.js +508 -0
- package/dist/hyperclawbot-C37Unss3.js +505 -0
- package/dist/hyperclawbot-CFHXZr12.js +505 -0
- package/dist/hyperclawbot-DGou0MZ6.js +508 -0
- package/dist/hyperclawbot-DnPIyjox.js +508 -0
- package/dist/hyperclawbot-GYFaTEgC.js +505 -0
- package/dist/hyperclawbot-mcLnyJyM.js +505 -0
- package/dist/hyperclawbot-xcastgTV.js +508 -0
- package/dist/hyperclawbot-y0i_joQK.js +505 -0
- package/dist/inference-BvmMO9dq.js +8 -0
- package/dist/inference-C2HOfRf8.js +2848 -0
- package/dist/inference-CKvR5Ik5.js +2841 -0
- package/dist/inference-DVVmhQn5.js +2841 -0
- package/dist/inference-DoM_iai-.js +2848 -0
- package/dist/inference-DwgXrvBb.js +6 -0
- package/dist/inference-Go1G6tnF.js +8 -0
- package/dist/inference-_ptQe0oG.js +2841 -0
- package/dist/inference-gK62s15E.js +6 -0
- package/dist/inference-lLDvSTR9.js +6 -0
- package/dist/knowledge-graph-4SxFnwEm.js +131 -0
- package/dist/knowledge-graph-BsH-HoUJ.js +131 -0
- package/dist/knowledge-graph-BxrAiV2B.js +134 -0
- package/dist/knowledge-graph-DCa91Nz5.js +131 -0
- package/dist/loader-7fz2fb92.js +400 -0
- package/dist/loader-B2jZXMBu.js +6 -0
- package/dist/loader-CbS0tIrR.js +4 -0
- package/dist/loader-Ckvv7vHF.js +410 -0
- package/dist/loader-CwOXDhFQ.js +400 -0
- package/dist/loader-DpEOgWXZ.js +4 -0
- package/dist/loader-DpYgmaul.js +4 -0
- package/dist/loader-DtyQP7wL.js +400 -0
- package/dist/logger-B3AqfQWG.js +84 -0
- package/dist/logger-B_q8yqmA.js +84 -0
- package/dist/logger-BxJklsDv.js +84 -0
- package/dist/logger-ry2oCfdf.js +86 -0
- package/dist/manager-9zwhTeQ5.js +233 -0
- package/dist/manager-B1RbCW6C.js +31 -0
- package/dist/manager-B90HEHxe.js +6 -0
- package/dist/manager-B94UWcTs.js +233 -0
- package/dist/manager-BDvL_oPs.js +4 -0
- package/dist/manager-BEatAtIB.js +31 -0
- package/dist/manager-BQf9drst.js +120 -0
- package/dist/manager-Bau1mIqb.js +6 -0
- package/dist/manager-BkqHak_e.js +247 -0
- package/dist/manager-BoFdZm-l.js +233 -0
- package/dist/manager-C2bq0AXc.js +233 -0
- package/dist/manager-CBe3W3eG.js +117 -0
- package/dist/manager-CoHr8_eJ.js +117 -0
- package/dist/manager-CuS13QUO.js +6 -0
- package/dist/manager-DO0pK2OI.js +117 -0
- package/dist/manager-DVetfBCH.js +6 -0
- package/dist/manager-Jd0qSzVe.js +35 -0
- package/dist/manager-TxFgaHT9.js +31 -0
- package/dist/manager-Yo6ZAofG.js +250 -0
- package/dist/mcp-B_WJiTZz.js +139 -0
- package/dist/mcp-DVhPLprc.js +139 -0
- package/dist/mcp-GWnLTVi-.js +142 -0
- package/dist/mcp-loader-B6xz7ftt.js +94 -0
- package/dist/mcp-loader-BLanJREp.js +94 -0
- package/dist/mcp-loader-Bx7FFxAU.js +94 -0
- package/dist/mcp-loader-CecsT-3O.js +93 -0
- package/dist/mcp-loader-Cr0LRQHE.js +93 -0
- package/dist/mcp-loader-D0rbtV3G.js +93 -0
- package/dist/memory-B47nvgOq.js +271 -0
- package/dist/memory-D-Py-cz5.js +273 -0
- package/dist/memory-D991eoj7.js +6 -0
- package/dist/memory-DoQoaHjo.js +4 -0
- package/dist/memory-auto-5aBZQJQY.js +5 -0
- package/dist/memory-auto-BTeOoLsb.js +306 -0
- package/dist/memory-auto-BvjfaflZ.js +5 -0
- package/dist/memory-auto-CSUt3aas.js +306 -0
- package/dist/memory-auto-CfpACu6s.js +306 -0
- package/dist/memory-auto-DI9Xpd-x.js +306 -0
- package/dist/memory-auto-D_mPVYqI.js +5 -0
- package/dist/memory-auto-PmKetZuo.js +5 -0
- package/dist/memory-auto-_Jv-Diw_.js +306 -0
- package/dist/memory-auto-rLBheyC0.js +5 -0
- package/dist/memory-integration-UFc6CdRA.js +91 -0
- package/dist/memory-integration-_NOy60Fj.js +91 -0
- package/dist/memory-integration-nbQ8esDu.js +91 -0
- package/dist/moltbook-B4znBD46.js +81 -0
- package/dist/moltbook-CGtA7Lb3.js +81 -0
- package/dist/moltbook-EZOfIwcN.js +81 -0
- package/dist/node-BvA5_2f_.js +222 -0
- package/dist/node-CRaZw_av.js +225 -0
- package/dist/node-CSOPY84m.js +222 -0
- package/dist/node-FPkFXYdU.js +225 -0
- package/dist/nodes-registry--DkZbn41.js +52 -0
- package/dist/nodes-registry-DYEH1aWn.js +52 -0
- package/dist/nodes-registry-jK7T0THg.js +52 -0
- package/dist/oauth-flow-B3S4T_SJ.js +147 -0
- package/dist/oauth-flow-CuQHP_RD.js +150 -0
- package/dist/oauth-flow-D_iqT6nr.js +150 -0
- package/dist/oauth-flow-Du2N6B2V.js +150 -0
- package/dist/oauth-provider-B2RBpiXg.js +111 -0
- package/dist/oauth-provider-C1qk9SI-.js +110 -0
- package/dist/oauth-provider-CDOMIZgF.js +110 -0
- package/dist/observability-4CyDqBWi.js +89 -0
- package/dist/observability-BfhV3r9r.js +89 -0
- package/dist/observability-DAnU8Ung.js +89 -0
- package/dist/onboard-3SoScSbC.js +11 -0
- package/dist/onboard-BAhuTUMO.js +4240 -0
- package/dist/onboard-BHKBzytX.js +13 -0
- package/dist/onboard-BVYo6E_l.js +3865 -0
- package/dist/onboard-Bf3ht6ct.js +11 -0
- package/dist/onboard-Bmpa_pxc.js +3865 -0
- package/dist/onboard-BwFFnEDj.js +13 -0
- package/dist/onboard-C-0A7RKN.js +4211 -0
- package/dist/onboard-CCuETEUr.js +3865 -0
- package/dist/onboard-CDi3B996.js +13 -0
- package/dist/onboard-CcXqOCHa.js +3862 -0
- package/dist/onboard-Cw85LmyN.js +13 -0
- package/dist/onboard-DU3acWAq.js +13 -0
- package/dist/onboard-DVEFIFRj.js +11 -0
- package/dist/onboard-DW8b3EUP.js +4250 -0
- package/dist/onboard-DfYWM7yN.js +13 -0
- package/dist/onboard-DiDTuD7m.js +13 -0
- package/dist/onboard-DqamkA0I.js +11 -0
- package/dist/onboard-DtDFU4lV.js +3865 -0
- package/dist/onboard-IdhgSexF.js +11 -0
- package/dist/onboard-Qh-qibLR.js +3861 -0
- package/dist/onboard-T54jLovz.js +13 -0
- package/dist/onboard-nQerZcpc.js +3862 -0
- package/dist/onboard-qXuXl5An.js +4250 -0
- package/dist/onboard-r2hLYfsL.js +3865 -0
- package/dist/onboard-xsSdyO6Y.js +3865 -0
- package/dist/onboard-yACJiQ6A.js +4215 -0
- package/dist/onboard-z1K8FTgh.js +13 -0
- package/dist/orchestrator-BIKrbOtx.js +6 -0
- package/dist/orchestrator-C71UI_0E.js +189 -0
- package/dist/orchestrator-C9I6EVhh.js +189 -0
- package/dist/orchestrator-CC6vuL6m.js +6 -0
- package/dist/orchestrator-CExmcac2.js +189 -0
- package/dist/orchestrator-CQm9v71d.js +6 -0
- package/dist/orchestrator-CSZnojZo.js +189 -0
- package/dist/orchestrator-Cc-gXExz.js +189 -0
- package/dist/orchestrator-CxySH0n5.js +6 -0
- package/dist/orchestrator-Cybvh-J0.js +189 -0
- package/dist/orchestrator-D-9pExNB.js +189 -0
- package/dist/orchestrator-DG-RjZIu.js +6 -0
- package/dist/orchestrator-DvEjhiJR.js +6 -0
- package/dist/orchestrator-FFpXJwSV.js +189 -0
- package/dist/orchestrator-f6IjivCr.js +6 -0
- package/dist/orchestrator-mPfwBFvX.js +6 -0
- package/dist/osint-BIGH02i8.js +277 -0
- package/dist/osint-Cc2Ju-o4.js +277 -0
- package/dist/osint-Cg3-CYHx.js +278 -0
- package/dist/pairing-BRPzVXzQ.js +198 -0
- package/dist/pairing-Cm78Tsdx.js +4 -0
- package/dist/pairing-D4sA3-Ha.js +6 -0
- package/dist/pairing-ouc_v-OX.js +196 -0
- package/dist/pc-access-BZvlAXYN.js +819 -0
- package/dist/pc-access-CziyndiO.js +8 -0
- package/dist/pc-access-D5k6dAfU.js +819 -0
- package/dist/pc-access-DoPSPiAK.js +8 -0
- package/dist/pending-approval-BaKZ0b_s.js +22 -0
- package/dist/pending-approval-CBVZcFJn.js +22 -0
- package/dist/pending-approval-DiZ96D8v.js +22 -0
- package/dist/providers-CFQC39vg.js +5 -0
- package/dist/providers-DP8T0QCR.js +1089 -0
- package/dist/reminders-store-BSIw5Y5z.js +58 -0
- package/dist/reminders-store-Bus52SjO.js +58 -0
- package/dist/renderer-CmMjrkqN.js +225 -0
- package/dist/renderer-_Y9mEqMM.js +225 -0
- package/dist/renderer-h3ar94cf.js +228 -0
- package/dist/rules-D3GcY_lt.js +103 -0
- package/dist/rules-DFoset7W.js +103 -0
- package/dist/rules-eJw9i4RF.js +106 -0
- package/dist/run-main.js +461 -333
- package/dist/runner-C-syOqBr.js +1273 -0
- package/dist/runner-C73am--A.js +1273 -0
- package/dist/runner-DKLq9jhv.js +1273 -0
- package/dist/runner-Im-aCXhh.js +1273 -0
- package/dist/runner-NvAzKXbv.js +1273 -0
- package/dist/security-2DPBzs5F.js +4 -0
- package/dist/security-BhhX8wJx.js +73 -0
- package/dist/server-7tmTtdPU.js +4 -0
- package/dist/server-A38RPbRE.js +1291 -0
- package/dist/server-B0k_pCt5.js +4 -0
- package/dist/server-BErPWJZ5.js +4 -0
- package/dist/server-BKo-zifC.js +4 -0
- package/dist/server-Bav63Eqx.js +4 -0
- package/dist/server-BbWQWOH4.js +4 -0
- package/dist/server-BfHtA0Y2.js +1278 -0
- package/dist/server-BiYaxlFV.js +1287 -0
- package/dist/server-C6htB4FI.js +4 -0
- package/dist/server-CB7cjcj4.js +1278 -0
- package/dist/server-CNiOi5dN.js +1285 -0
- package/dist/server-CSC4npaT.js +1285 -0
- package/dist/server-CZfP2Poz.js +1278 -0
- package/dist/server-C_YVts3e.js +4 -0
- package/dist/server-CbQl0M21.js +1278 -0
- package/dist/server-Cj45rxn-.js +1292 -0
- package/dist/server-Ct7Fl3SE.js +1285 -0
- package/dist/server-D9q-3mLF.js +1292 -0
- package/dist/server-DRc26z9e.js +4 -0
- package/dist/server-DT7JjjVD.js +4 -0
- package/dist/server-DacRJyZn.js +4 -0
- package/dist/server-PCtHMXe2.js +1292 -0
- package/dist/server-wXCH_TCU.js +4 -0
- package/dist/session-store-7ZPOoB81.js +5 -0
- package/dist/session-store-BOa2y_EQ.js +5 -0
- package/dist/session-store-BYEr8j52.js +139 -0
- package/dist/session-store-Bx7lBD_a.js +141 -0
- package/dist/session-store-C13h7I2r.js +136 -0
- package/dist/session-store-CUHgJ0Xr.js +5 -0
- package/dist/session-store-cbtK6hx9.js +136 -0
- package/dist/session-store-eecMioKI.js +5 -0
- package/dist/sessions-tools-B5_ow-s7.js +5 -0
- package/dist/sessions-tools-CG2mvJo6.js +95 -0
- package/dist/sessions-tools-DVSejkNU.js +95 -0
- package/dist/sessions-tools-fOL1N3Zu.js +5 -0
- package/dist/skill-loader-99egKAGN.js +160 -0
- package/dist/skill-loader-Bl6pYxNN.js +160 -0
- package/dist/skill-loader-D4D5kfDu.js +7 -0
- package/dist/skill-loader-DwbmjEDa.js +7 -0
- package/dist/skill-runtime-1CrUOOGv.js +5 -0
- package/dist/skill-runtime-B-2O7Vgb.js +102 -0
- package/dist/skill-runtime-B7PutgyZ.js +5 -0
- package/dist/skill-runtime-BGNtPD_L.js +102 -0
- package/dist/skill-runtime-BUhMkMzO.js +5 -0
- package/dist/skill-runtime-Bv7fCCx8.js +102 -0
- package/dist/skill-runtime-Bx2HHcta.js +102 -0
- package/dist/skill-runtime-C6HVvnmN.js +5 -0
- package/dist/skill-runtime-CtSykP3r.js +102 -0
- package/dist/skill-runtime-DUAt8JM_.js +5 -0
- package/dist/skill-runtime-DZ6uJXGW.js +102 -0
- package/dist/skill-runtime-DaLnq_Jm.js +5 -0
- package/dist/skill-runtime-DpDbjL7y.js +102 -0
- package/dist/skill-runtime-acmnZSq7.js +102 -0
- package/dist/skill-runtime-dzuLMVSw.js +5 -0
- package/dist/skill-runtime-wiVnzSoJ.js +5 -0
- package/dist/src-B5lCcPXX.js +63 -0
- package/dist/src-B7Kxqi35.js +20 -0
- package/dist/src-B8DEmVd6.js +458 -0
- package/dist/src-BqbwzQQj.js +63 -0
- package/dist/src-C63ECu1t.js +63 -0
- package/dist/src-C65-5rOW.js +458 -0
- package/dist/src-CbTAVbeI.js +20 -0
- package/dist/src-Cmnclt47.js +63 -0
- package/dist/src-D0kptBSa.js +458 -0
- package/dist/src-DZtpIvWJ.js +63 -0
- package/dist/src-DjzS20TD.js +63 -0
- package/dist/src-DmPjS2Z4.js +458 -0
- package/dist/src-DmbIgW0O.js +63 -0
- package/dist/src-DsaXFru7.js +63 -0
- package/dist/src-Dt0TXI8r.js +458 -0
- package/dist/src-PPagVWuK.js +63 -0
- package/dist/src-rktqvEBJ.js +458 -0
- package/dist/src-tI8EOp6-.js +458 -0
- package/dist/src-zUHOCQgl.js +458 -0
- package/dist/src-zWhGmJSN.js +458 -0
- package/dist/sub-agent-tools-9k60L5mn.js +39 -0
- package/dist/sub-agent-tools-BBJf8oPD.js +39 -0
- package/dist/sub-agent-tools-BVCARpnF.js +39 -0
- package/dist/sub-agent-tools-Cx5BB5IO.js +39 -0
- package/dist/sub-agent-tools-DMT7jjBc.js +39 -0
- package/dist/sub-agent-tools-F-04gxf8.js +39 -0
- package/dist/sub-agent-tools-iBQiRKg6.js +39 -0
- package/dist/sub-agent-tools-kr921YOA.js +39 -0
- package/dist/theme-CLXvI6Hr.js +183 -0
- package/dist/theme-DdZT-Bq4.js +10 -0
- package/dist/theme-GEpjn_0G.js +180 -0
- package/dist/theme-hOlG-hDL.js +8 -0
- package/dist/tool-policy-D1zWYBKm.js +189 -0
- package/dist/tool-policy-TmXx_fpp.js +189 -0
- package/dist/tool-policy-YgysHf5s.js +189 -0
- package/dist/tts-elevenlabs-BT4WrEwy.js +61 -0
- package/dist/tts-elevenlabs-C62Wnnrg.js +61 -0
- package/dist/tts-elevenlabs-DmEFFeR8.js +61 -0
- package/dist/update-check-BeAPt4-f.js +98 -0
- package/dist/update-check-CaHNCDqe.js +6 -0
- package/dist/vision-B5DQ5hYa.js +121 -0
- package/dist/vision-XOSSQe4m.js +121 -0
- package/dist/vision-sIO3kwFy.js +121 -0
- package/dist/vision-tools-BHogJPuK.js +5 -0
- package/dist/vision-tools-BZhV8wg3.js +51 -0
- package/dist/vision-tools-BiDKd0UA.js +5 -0
- package/dist/vision-tools-CdRxilYR.js +5 -0
- package/dist/vision-tools-DnUjpQhI.js +51 -0
- package/dist/vision-tools-gtUq6d-x.js +51 -0
- package/dist/voice-transcription-5_iQE-0C.js +138 -0
- package/dist/voice-transcription-C3SuzK96.js +138 -0
- package/dist/voice-transcription-CYFj4Iv3.js +138 -0
- package/dist/voice-transcription-ygmlOkky.js +138 -0
- package/dist/website-watch-tools-BF-wR0UI.js +5 -0
- package/dist/website-watch-tools-CVh7RA5-.js +139 -0
- package/dist/website-watch-tools-CthBrGPP.js +5 -0
- package/dist/website-watch-tools-Oxf8Mv4j.js +139 -0
- package/package.json +1 -1
|
@@ -0,0 +1,498 @@
|
|
|
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 crypto = require_chunk.__toESM(require("crypto"));
|
|
7
|
+
const http = require_chunk.__toESM(require("http"));
|
|
8
|
+
const https = require_chunk.__toESM(require("https"));
|
|
9
|
+
const events = require_chunk.__toESM(require("events"));
|
|
10
|
+
|
|
11
|
+
//#region extensions/matrix/src/connector.ts
|
|
12
|
+
const HC_DIR = path.default.join(os.default.homedir(), ".hyperclaw");
|
|
13
|
+
const CREDS_BASE = path.default.join(HC_DIR, "credentials", "matrix");
|
|
14
|
+
const STATE_BASE = path.default.join(HC_DIR, "matrix", "accounts");
|
|
15
|
+
const DEFAULT_CHUNK = 16e3;
|
|
16
|
+
function matrixReq(homeserver, token, method, apiPath, body, query = {}) {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
const url = new URL(homeserver);
|
|
19
|
+
const isHttps = url.protocol === "https:";
|
|
20
|
+
const mod = isHttps ? https.default : http.default;
|
|
21
|
+
const payload = body ? JSON.stringify(body) : null;
|
|
22
|
+
const qs = new URLSearchParams({
|
|
23
|
+
access_token: token,
|
|
24
|
+
...query
|
|
25
|
+
}).toString();
|
|
26
|
+
const reqPath = `/_matrix/client/v3${apiPath}?${qs}`;
|
|
27
|
+
const req = mod.request({
|
|
28
|
+
hostname: url.hostname,
|
|
29
|
+
port: url.port || (isHttps ? 443 : 80),
|
|
30
|
+
path: reqPath,
|
|
31
|
+
method,
|
|
32
|
+
headers: {
|
|
33
|
+
Authorization: `Bearer ${token}`,
|
|
34
|
+
...payload ? {
|
|
35
|
+
"Content-Type": "application/json",
|
|
36
|
+
"Content-Length": Buffer.byteLength(payload)
|
|
37
|
+
} : {}
|
|
38
|
+
}
|
|
39
|
+
}, (res) => {
|
|
40
|
+
let data = "";
|
|
41
|
+
res.on("data", (c) => data += c);
|
|
42
|
+
res.on("end", () => {
|
|
43
|
+
try {
|
|
44
|
+
const r = JSON.parse(data);
|
|
45
|
+
if (r.errcode) reject(new Error(r.error || r.errcode));
|
|
46
|
+
else resolve(r);
|
|
47
|
+
} catch {
|
|
48
|
+
reject(new Error("Matrix: invalid JSON response"));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
req.on("error", reject);
|
|
53
|
+
req.setTimeout(6e4, () => {
|
|
54
|
+
req.destroy();
|
|
55
|
+
reject(new Error("Matrix: request timeout"));
|
|
56
|
+
});
|
|
57
|
+
if (payload) req.write(payload);
|
|
58
|
+
req.end();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function matrixLogin(homeserver, userId, password, deviceName) {
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
const url = new URL(homeserver);
|
|
64
|
+
const isHttps = url.protocol === "https:";
|
|
65
|
+
const mod = isHttps ? https.default : http.default;
|
|
66
|
+
const body = JSON.stringify({
|
|
67
|
+
type: "m.login.password",
|
|
68
|
+
identifier: {
|
|
69
|
+
type: "m.id.user",
|
|
70
|
+
user: userId.replace(/^@/, "").split(":")[0]
|
|
71
|
+
},
|
|
72
|
+
password,
|
|
73
|
+
...deviceName ? { initial_device_display_name: deviceName } : {}
|
|
74
|
+
});
|
|
75
|
+
const req = mod.request({
|
|
76
|
+
hostname: url.hostname,
|
|
77
|
+
port: url.port || (isHttps ? 443 : 80),
|
|
78
|
+
path: "/_matrix/client/v3/login",
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: {
|
|
81
|
+
"Content-Type": "application/json",
|
|
82
|
+
"Content-Length": Buffer.byteLength(body)
|
|
83
|
+
}
|
|
84
|
+
}, (res) => {
|
|
85
|
+
let data = "";
|
|
86
|
+
res.on("data", (c) => data += c);
|
|
87
|
+
res.on("end", () => {
|
|
88
|
+
try {
|
|
89
|
+
resolve(JSON.parse(data));
|
|
90
|
+
} catch {
|
|
91
|
+
reject(new Error("Matrix login: invalid response"));
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
req.on("error", reject);
|
|
96
|
+
req.write(body);
|
|
97
|
+
req.end();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function chunkText(text, limit, mode) {
|
|
101
|
+
if (mode === "newline") {
|
|
102
|
+
const paragraphs = text.split(/\n\n+/);
|
|
103
|
+
const chunks$1 = [];
|
|
104
|
+
let current = "";
|
|
105
|
+
for (const p of paragraphs) if ((current + "\n\n" + p).length > limit && current) {
|
|
106
|
+
chunks$1.push(current.trim());
|
|
107
|
+
current = p;
|
|
108
|
+
} else current = current ? current + "\n\n" + p : p;
|
|
109
|
+
if (current) chunks$1.push(current.trim());
|
|
110
|
+
return chunks$1.filter(Boolean);
|
|
111
|
+
}
|
|
112
|
+
const chunks = [];
|
|
113
|
+
for (let i = 0; i < text.length; i += limit) chunks.push(text.slice(i, i + limit));
|
|
114
|
+
return chunks.length ? chunks : [""];
|
|
115
|
+
}
|
|
116
|
+
var MatrixAccount = class extends events.EventEmitter {
|
|
117
|
+
cfg;
|
|
118
|
+
accountId;
|
|
119
|
+
token = "";
|
|
120
|
+
userId = "";
|
|
121
|
+
running = false;
|
|
122
|
+
nextBatch = null;
|
|
123
|
+
/** room ID → true if it is a DM room (populated from m.direct account data) */
|
|
124
|
+
directRooms = /* @__PURE__ */ new Set();
|
|
125
|
+
/** resolved room alias → room ID cache */
|
|
126
|
+
aliasCache = /* @__PURE__ */ new Map();
|
|
127
|
+
constructor(accountId, cfg) {
|
|
128
|
+
super();
|
|
129
|
+
this.accountId = accountId;
|
|
130
|
+
this.cfg = {
|
|
131
|
+
groupPolicy: "allowlist",
|
|
132
|
+
groupAllowFrom: [],
|
|
133
|
+
groups: {},
|
|
134
|
+
rooms: {},
|
|
135
|
+
threadReplies: "inbound",
|
|
136
|
+
replyToMode: "off",
|
|
137
|
+
textChunkLimit: DEFAULT_CHUNK,
|
|
138
|
+
chunkMode: "length",
|
|
139
|
+
mediaMaxMb: 10,
|
|
140
|
+
autoJoin: "always",
|
|
141
|
+
autoJoinAllowlist: [],
|
|
142
|
+
encryption: false,
|
|
143
|
+
...cfg,
|
|
144
|
+
dm: {
|
|
145
|
+
policy: cfg.dm?.policy ?? "pairing",
|
|
146
|
+
allowFrom: cfg.dm?.allowFrom ?? []
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
async authenticate() {
|
|
151
|
+
const hs = this.cfg.homeserver;
|
|
152
|
+
const credsFile = path.default.join(CREDS_BASE, `${this.accountId}.json`);
|
|
153
|
+
if (this.cfg.accessToken) this.token = this.cfg.accessToken;
|
|
154
|
+
else if (this.cfg.password) {
|
|
155
|
+
let cached = false;
|
|
156
|
+
try {
|
|
157
|
+
const c = await fs_extra.default.readJson(credsFile);
|
|
158
|
+
if (c.homeserver === hs && c.userId === this.cfg.userId && c.accessToken) {
|
|
159
|
+
this.token = c.accessToken;
|
|
160
|
+
cached = true;
|
|
161
|
+
}
|
|
162
|
+
} catch {}
|
|
163
|
+
if (!cached) {
|
|
164
|
+
if (!this.cfg.userId) throw new Error(`Matrix [${this.accountId}]: userId required for password login`);
|
|
165
|
+
const res = await matrixLogin(hs, this.cfg.userId, this.cfg.password, this.cfg.deviceName);
|
|
166
|
+
if (!res.access_token) throw new Error(`Matrix [${this.accountId}]: login failed — ${JSON.stringify(res)}`);
|
|
167
|
+
this.token = res.access_token;
|
|
168
|
+
await fs_extra.default.ensureDir(path.default.dirname(credsFile));
|
|
169
|
+
await fs_extra.default.writeJson(credsFile, {
|
|
170
|
+
homeserver: hs,
|
|
171
|
+
userId: this.cfg.userId,
|
|
172
|
+
accessToken: this.token
|
|
173
|
+
}, { spaces: 2 });
|
|
174
|
+
}
|
|
175
|
+
} else throw new Error(`Matrix [${this.accountId}]: accessToken or (userId + password) required`);
|
|
176
|
+
const whoami = await matrixReq(hs, this.token, "GET", "/account/whoami");
|
|
177
|
+
this.userId = this.cfg.userId || whoami.user_id;
|
|
178
|
+
if (this.cfg.encryption) try {
|
|
179
|
+
const tokenHash = crypto.default.createHash("sha256").update(this.token).digest("hex").slice(0, 12);
|
|
180
|
+
const _cryptoDir = path.default.join(STATE_BASE, this.accountId, `${new URL(hs).hostname}__${this.userId.replace(/[^a-z0-9_.-]/gi, "_")}`, tokenHash, "crypto");
|
|
181
|
+
await import("@matrix-org/matrix-sdk-crypto-nodejs").catch(() => {
|
|
182
|
+
console.log(chalk.default.yellow(` ⚠ Matrix [${this.accountId}]: crypto module not available — E2EE disabled. Run: pnpm rebuild @matrix-org/matrix-sdk-crypto-nodejs`));
|
|
183
|
+
this.cfg.encryption = false;
|
|
184
|
+
});
|
|
185
|
+
} catch {
|
|
186
|
+
this.cfg.encryption = false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
stateFile() {
|
|
190
|
+
return path.default.join(STATE_BASE, this.accountId, "bot-storage.json");
|
|
191
|
+
}
|
|
192
|
+
async loadState() {
|
|
193
|
+
try {
|
|
194
|
+
const s = await fs_extra.default.readJson(this.stateFile());
|
|
195
|
+
this.nextBatch = s.nextBatch || null;
|
|
196
|
+
if (s.p) this.cfg.pendingPairings = s.p;
|
|
197
|
+
if (s.a) this.cfg.approvedPairings = s.a;
|
|
198
|
+
if (s.directRooms) this.directRooms = new Set(s.directRooms);
|
|
199
|
+
} catch {}
|
|
200
|
+
}
|
|
201
|
+
async saveState() {
|
|
202
|
+
await fs_extra.default.ensureDir(path.default.dirname(this.stateFile()));
|
|
203
|
+
await fs_extra.default.writeJson(this.stateFile(), {
|
|
204
|
+
nextBatch: this.nextBatch,
|
|
205
|
+
p: this.cfg.pendingPairings,
|
|
206
|
+
a: this.cfg.approvedPairings,
|
|
207
|
+
directRooms: [...this.directRooms]
|
|
208
|
+
}, { spaces: 2 });
|
|
209
|
+
}
|
|
210
|
+
async connect() {
|
|
211
|
+
await this.authenticate();
|
|
212
|
+
await this.loadState();
|
|
213
|
+
this.running = true;
|
|
214
|
+
console.log(chalk.default.green(` 🔷 Matrix [${this.accountId}]: ${this.userId} connected`));
|
|
215
|
+
this.emit("connected", {
|
|
216
|
+
userId: this.userId,
|
|
217
|
+
accountId: this.accountId
|
|
218
|
+
});
|
|
219
|
+
this.syncLoop();
|
|
220
|
+
}
|
|
221
|
+
disconnect() {
|
|
222
|
+
this.running = false;
|
|
223
|
+
}
|
|
224
|
+
async syncLoop() {
|
|
225
|
+
while (this.running) try {
|
|
226
|
+
const query = this.nextBatch ? {
|
|
227
|
+
since: this.nextBatch,
|
|
228
|
+
timeout: "30000"
|
|
229
|
+
} : { timeout: "0" };
|
|
230
|
+
const sync = await matrixReq(this.cfg.homeserver, this.token, "GET", "/sync", void 0, query);
|
|
231
|
+
this.nextBatch = sync.next_batch;
|
|
232
|
+
const directEvent = (sync.account_data?.events || []).find((e) => e.type === "m.direct");
|
|
233
|
+
if (directEvent?.content) for (const rooms of Object.values(directEvent.content)) for (const r of rooms) this.directRooms.add(r);
|
|
234
|
+
await this.saveState();
|
|
235
|
+
for (const [roomId] of Object.entries(sync.rooms?.invite || {})) await this.handleInvite(roomId);
|
|
236
|
+
const joinedRooms = sync.rooms?.join || {};
|
|
237
|
+
for (const [roomId, rd] of Object.entries(joinedRooms)) for (const event of rd.timeline?.events || []) {
|
|
238
|
+
if (event.sender === this.userId) continue;
|
|
239
|
+
await this.handleEvent(roomId, event, rd);
|
|
240
|
+
}
|
|
241
|
+
} catch (e) {
|
|
242
|
+
if (this.running) {
|
|
243
|
+
console.log(chalk.default.yellow(` ⚠ Matrix [${this.accountId}]: ${e.message}`));
|
|
244
|
+
await new Promise((r) => setTimeout(r, 5e3));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
async handleInvite(roomId) {
|
|
249
|
+
const autoJoin = this.cfg.autoJoin ?? "always";
|
|
250
|
+
if (autoJoin === "off") return;
|
|
251
|
+
if (autoJoin === "allowlist") {
|
|
252
|
+
const resolved = await this.resolveRoom(roomId);
|
|
253
|
+
const list = this.cfg.autoJoinAllowlist ?? [];
|
|
254
|
+
if (!list.includes(roomId) && !list.includes(resolved)) return;
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
await matrixReq(this.cfg.homeserver, this.token, "POST", `/rooms/${encodeURIComponent(roomId)}/join`, {});
|
|
258
|
+
} catch {}
|
|
259
|
+
}
|
|
260
|
+
async handleEvent(roomId, event, roomData) {
|
|
261
|
+
const isDM = this.directRooms.has(roomId);
|
|
262
|
+
const sender = event.sender || "";
|
|
263
|
+
if (!sender) return;
|
|
264
|
+
let text = "";
|
|
265
|
+
let eventThreadId;
|
|
266
|
+
switch (event.type) {
|
|
267
|
+
case "m.room.message": {
|
|
268
|
+
const msgtype = event.content?.msgtype || "";
|
|
269
|
+
const relatesTo = event.content?.["m.relates_to"];
|
|
270
|
+
eventThreadId = relatesTo?.rel_type === "m.thread" ? relatesTo.event_id : void 0;
|
|
271
|
+
switch (msgtype) {
|
|
272
|
+
case "m.text":
|
|
273
|
+
case "m.notice":
|
|
274
|
+
text = event.content?.body || "";
|
|
275
|
+
break;
|
|
276
|
+
case "m.image":
|
|
277
|
+
case "m.video":
|
|
278
|
+
case "m.audio":
|
|
279
|
+
case "m.file": {
|
|
280
|
+
const mxcUrl = event.content?.url || "";
|
|
281
|
+
const size = event.content?.info?.size || 0;
|
|
282
|
+
const maxBytes = (this.cfg.mediaMaxMb ?? 10) * 1024 * 1024;
|
|
283
|
+
if (size > maxBytes) return;
|
|
284
|
+
text = `[${msgtype.replace("m.", "")}:${mxcUrl}]`;
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case "m.location":
|
|
288
|
+
text = `[location:${event.content?.geo_uri || ""}]`;
|
|
289
|
+
break;
|
|
290
|
+
default: return;
|
|
291
|
+
}
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case "org.matrix.msc3381.poll.start":
|
|
295
|
+
case "m.poll.start": {
|
|
296
|
+
const q = event.content?.["org.matrix.msc3381.poll.start"]?.question?.body || event.content?.["m.poll"]?.question?.text || "";
|
|
297
|
+
if (!q) return;
|
|
298
|
+
text = `[poll] ${q}`;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
case "m.reaction": {
|
|
302
|
+
const key = event.content?.["m.relates_to"]?.key || "";
|
|
303
|
+
const reacted = event.content?.["m.relates_to"]?.event_id || "";
|
|
304
|
+
if (!key) return;
|
|
305
|
+
text = `[reaction:${key}:${reacted}]`;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
default: return;
|
|
309
|
+
}
|
|
310
|
+
if (!text) return;
|
|
311
|
+
if (isDM) {
|
|
312
|
+
const allowed = await this.checkDMPolicy(sender, text, roomId);
|
|
313
|
+
if (!allowed) return;
|
|
314
|
+
} else if (!this.checkGroupPolicy(roomId, sender, text, roomData)) return;
|
|
315
|
+
this.emit("message", {
|
|
316
|
+
channelId: "matrix",
|
|
317
|
+
accountId: this.accountId,
|
|
318
|
+
chatId: roomId,
|
|
319
|
+
from: sender,
|
|
320
|
+
text,
|
|
321
|
+
threadId: eventThreadId,
|
|
322
|
+
isDM,
|
|
323
|
+
timestamp: new Date(event.origin_server_ts || Date.now()).toISOString()
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
async checkDMPolicy(sender, text, roomId) {
|
|
327
|
+
const { policy, allowFrom } = this.cfg.dm;
|
|
328
|
+
switch (policy) {
|
|
329
|
+
case "disabled": return false;
|
|
330
|
+
case "open": return true;
|
|
331
|
+
case "allowlist":
|
|
332
|
+
if (allowFrom.includes(sender) || allowFrom.includes("*")) return true;
|
|
333
|
+
await this.sendMessage(roomId, "HyperClaw: Not on allowlist.");
|
|
334
|
+
return false;
|
|
335
|
+
case "pairing": {
|
|
336
|
+
if (this.cfg.approvedPairings.includes(sender)) return true;
|
|
337
|
+
const upper = text.trim().toUpperCase().match(/[A-Z0-9]{6}/)?.[0];
|
|
338
|
+
if (upper && this.cfg.pendingPairings[upper]) {
|
|
339
|
+
this.cfg.approvedPairings.push(sender);
|
|
340
|
+
delete this.cfg.pendingPairings[upper];
|
|
341
|
+
await this.saveState();
|
|
342
|
+
await this.sendMessage(roomId, "Paired!");
|
|
343
|
+
this.emit("pairing:approved", {
|
|
344
|
+
userId: sender,
|
|
345
|
+
channelId: "matrix",
|
|
346
|
+
accountId: this.accountId
|
|
347
|
+
});
|
|
348
|
+
return true;
|
|
349
|
+
}
|
|
350
|
+
const code = Array.from({ length: 6 }, () => "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"[Math.floor(Math.random() * 32)]).join("");
|
|
351
|
+
this.cfg.pendingPairings[code] = sender;
|
|
352
|
+
await this.saveState();
|
|
353
|
+
await this.sendMessage(roomId, `Pairing code: \`${code}\`\nApprove: hyperclaw pairing approve matrix ${code}`);
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return false;
|
|
358
|
+
}
|
|
359
|
+
checkGroupPolicy(roomId, sender, text, roomData) {
|
|
360
|
+
const policy = this.cfg.groupPolicy ?? "allowlist";
|
|
361
|
+
if (policy === "disabled") return false;
|
|
362
|
+
const allGroups = {
|
|
363
|
+
...this.cfg.rooms || {},
|
|
364
|
+
...this.cfg.groups || {}
|
|
365
|
+
};
|
|
366
|
+
const roomCfg = allGroups[roomId] || allGroups["*"] || {};
|
|
367
|
+
if (policy === "open" || roomCfg.allow === true) {
|
|
368
|
+
if (roomCfg.allowFrom?.length && !roomCfg.allowFrom.includes(sender)) return false;
|
|
369
|
+
const globalAllow$1 = this.cfg.groupAllowFrom ?? [];
|
|
370
|
+
if (globalAllow$1.length && !globalAllow$1.includes(sender)) return false;
|
|
371
|
+
if (roomCfg.requireMention !== false) {
|
|
372
|
+
const botMention = `${this.userId}`;
|
|
373
|
+
if (!text.includes(botMention) && !text.startsWith("!")) return false;
|
|
374
|
+
}
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
if (!allGroups[roomId] && !allGroups["*"]) return false;
|
|
378
|
+
if (roomCfg.allow === false) return false;
|
|
379
|
+
const globalAllow = this.cfg.groupAllowFrom ?? [];
|
|
380
|
+
if (globalAllow.length && !globalAllow.includes(sender)) return false;
|
|
381
|
+
if (roomCfg.allowFrom?.length && !roomCfg.allowFrom.includes(sender)) return false;
|
|
382
|
+
if (roomCfg.requireMention !== false) {
|
|
383
|
+
const botMention = this.userId;
|
|
384
|
+
if (!text.includes(botMention) && !text.startsWith("!")) return false;
|
|
385
|
+
}
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
async sendMessage(roomId, text, threadId) {
|
|
389
|
+
const limit = this.cfg.textChunkLimit ?? DEFAULT_CHUNK;
|
|
390
|
+
const mode = this.cfg.chunkMode ?? "length";
|
|
391
|
+
const chunks = chunkText(text, limit, mode);
|
|
392
|
+
const threadReplies = this.cfg.threadReplies ?? "inbound";
|
|
393
|
+
const useThread = threadId && (threadReplies === "inbound" || threadReplies === "always");
|
|
394
|
+
for (const chunk of chunks) {
|
|
395
|
+
const content = {
|
|
396
|
+
msgtype: "m.text",
|
|
397
|
+
body: chunk,
|
|
398
|
+
format: "org.matrix.custom.html",
|
|
399
|
+
formatted_body: chunk.replace(/\n/g, "<br/>")
|
|
400
|
+
};
|
|
401
|
+
if (useThread) content["m.relates_to"] = {
|
|
402
|
+
rel_type: "m.thread",
|
|
403
|
+
event_id: threadId,
|
|
404
|
+
is_falling_back: true
|
|
405
|
+
};
|
|
406
|
+
const txnId = `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
407
|
+
await matrixReq(this.cfg.homeserver, this.token, "PUT", `/rooms/${encodeURIComponent(roomId)}/send/m.room.message/${txnId}`, content);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async resolveRoom(idOrAlias) {
|
|
411
|
+
if (!idOrAlias.startsWith("#")) return idOrAlias;
|
|
412
|
+
if (this.aliasCache.has(idOrAlias)) return this.aliasCache.get(idOrAlias);
|
|
413
|
+
try {
|
|
414
|
+
const res = await matrixReq(this.cfg.homeserver, this.token, "GET", `/directory/room/${encodeURIComponent(idOrAlias)}`);
|
|
415
|
+
if (res.room_id) this.aliasCache.set(idOrAlias, res.room_id);
|
|
416
|
+
return res.room_id || idOrAlias;
|
|
417
|
+
} catch {
|
|
418
|
+
return idOrAlias;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
approvePairing(code) {
|
|
422
|
+
const upper = code.toUpperCase();
|
|
423
|
+
if (!this.cfg.pendingPairings[upper]) return false;
|
|
424
|
+
this.cfg.approvedPairings.push(this.cfg.pendingPairings[upper]);
|
|
425
|
+
delete this.cfg.pendingPairings[upper];
|
|
426
|
+
this.saveState();
|
|
427
|
+
return true;
|
|
428
|
+
}
|
|
429
|
+
isRunning() {
|
|
430
|
+
return this.running;
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
var MatrixConnector = class extends events.EventEmitter {
|
|
434
|
+
config;
|
|
435
|
+
accounts = [];
|
|
436
|
+
constructor(config) {
|
|
437
|
+
super();
|
|
438
|
+
this.config = config;
|
|
439
|
+
}
|
|
440
|
+
async connect() {
|
|
441
|
+
const sharedState = {
|
|
442
|
+
approvedPairings: this.config.approvedPairings ?? [],
|
|
443
|
+
pendingPairings: this.config.pendingPairings ?? {}
|
|
444
|
+
};
|
|
445
|
+
const accountEntries = Object.entries(this.config.accounts || {});
|
|
446
|
+
if (accountEntries.length === 0) {
|
|
447
|
+
const acct = new MatrixAccount("default", {
|
|
448
|
+
...this.config,
|
|
449
|
+
...sharedState
|
|
450
|
+
});
|
|
451
|
+
this.wire(acct);
|
|
452
|
+
await acct.connect();
|
|
453
|
+
this.accounts.push(acct);
|
|
454
|
+
} else for (const [id, acctCfg] of accountEntries) {
|
|
455
|
+
const merged = {
|
|
456
|
+
...this.config,
|
|
457
|
+
...acctCfg,
|
|
458
|
+
homeserver: acctCfg.homeserver || this.config.homeserver,
|
|
459
|
+
...sharedState
|
|
460
|
+
};
|
|
461
|
+
if (!merged.homeserver) {
|
|
462
|
+
console.error(`[matrix] Account "${id}" has no homeserver — skipping`);
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
const acct = new MatrixAccount(id, merged);
|
|
466
|
+
this.wire(acct);
|
|
467
|
+
try {
|
|
468
|
+
await acct.connect();
|
|
469
|
+
this.accounts.push(acct);
|
|
470
|
+
} catch (e) {
|
|
471
|
+
console.error(`[matrix] Account "${id}" failed: ${e.message}`);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
wire(acct) {
|
|
476
|
+
acct.on("message", (msg) => this.emit("message", msg));
|
|
477
|
+
acct.on("connected", (info) => this.emit("connected", info));
|
|
478
|
+
acct.on("pairing:approved", (info) => this.emit("pairing:approved", info));
|
|
479
|
+
}
|
|
480
|
+
async sendMessage(roomId, text, threadId) {
|
|
481
|
+
const acct = this.accounts[0];
|
|
482
|
+
if (!acct) throw new Error("Matrix: no connected account");
|
|
483
|
+
await acct.sendMessage(roomId, text, threadId);
|
|
484
|
+
}
|
|
485
|
+
disconnect() {
|
|
486
|
+
for (const a of this.accounts) a.disconnect();
|
|
487
|
+
this.accounts = [];
|
|
488
|
+
}
|
|
489
|
+
approvePairing(code) {
|
|
490
|
+
return this.accounts.some((a) => a.approvePairing(code));
|
|
491
|
+
}
|
|
492
|
+
isRunning() {
|
|
493
|
+
return this.accounts.some((a) => a.isRunning());
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
//#endregion
|
|
498
|
+
exports.MatrixConnector = MatrixConnector;
|
|
@@ -0,0 +1,194 @@
|
|
|
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/whatsapp/src/connector.ts
|
|
10
|
+
const STATE_FILE = path.default.join(os.default.homedir(), ".hyperclaw", "whatsapp-state.json");
|
|
11
|
+
const GRAPH_API = "graph.facebook.com";
|
|
12
|
+
const API_VERSION = "v18.0";
|
|
13
|
+
function graphReq(token, method, endpoint, body) {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const payload = body ? JSON.stringify(body) : null;
|
|
16
|
+
const req = https.default.request({
|
|
17
|
+
hostname: GRAPH_API,
|
|
18
|
+
port: 443,
|
|
19
|
+
path: `/${API_VERSION}${endpoint}`,
|
|
20
|
+
method,
|
|
21
|
+
headers: {
|
|
22
|
+
"Authorization": `Bearer ${token}`,
|
|
23
|
+
...payload ? {
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
"Content-Length": Buffer.byteLength(payload)
|
|
26
|
+
} : {}
|
|
27
|
+
}
|
|
28
|
+
}, (res) => {
|
|
29
|
+
let data = "";
|
|
30
|
+
res.on("data", (c) => data += c);
|
|
31
|
+
res.on("end", () => {
|
|
32
|
+
try {
|
|
33
|
+
const r = JSON.parse(data);
|
|
34
|
+
if (r.error) reject(new Error(`${r.error.code}: ${r.error.message}`));
|
|
35
|
+
else resolve(r);
|
|
36
|
+
} catch {
|
|
37
|
+
reject(new Error("Invalid JSON"));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
req.on("error", reject);
|
|
42
|
+
if (payload) req.write(payload);
|
|
43
|
+
req.end();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
var WhatsAppConnector = class extends events.EventEmitter {
|
|
47
|
+
config;
|
|
48
|
+
running = false;
|
|
49
|
+
constructor(config) {
|
|
50
|
+
super();
|
|
51
|
+
this.config = {
|
|
52
|
+
dmPolicy: "allowlist",
|
|
53
|
+
allowFrom: [],
|
|
54
|
+
approvedPairings: [],
|
|
55
|
+
pendingPairings: {},
|
|
56
|
+
...config
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async connect() {
|
|
60
|
+
const info = await graphReq(this.config.accessToken, "GET", `/${this.config.phoneNumberId}`);
|
|
61
|
+
await this.loadState();
|
|
62
|
+
this.running = true;
|
|
63
|
+
console.log(chalk.default.green(` 🦅 WhatsApp: ${info.display_phone_number || this.config.phoneNumberId} connected`));
|
|
64
|
+
this.emit("connected", {
|
|
65
|
+
phoneNumberId: this.config.phoneNumberId,
|
|
66
|
+
number: info.display_phone_number
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
disconnect() {
|
|
70
|
+
this.running = false;
|
|
71
|
+
}
|
|
72
|
+
verifyWebhook(mode, token, challenge) {
|
|
73
|
+
if (mode === "subscribe" && token === this.config.verifyToken) return challenge;
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
async handleWebhook(body) {
|
|
77
|
+
let payload;
|
|
78
|
+
try {
|
|
79
|
+
payload = JSON.parse(body);
|
|
80
|
+
} catch {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const entry = payload.entry?.[0];
|
|
84
|
+
const changes = entry?.changes?.[0];
|
|
85
|
+
const value = changes?.value;
|
|
86
|
+
if (!value?.messages) return;
|
|
87
|
+
for (const msg of value.messages) {
|
|
88
|
+
if (msg.type !== "text") continue;
|
|
89
|
+
const from = msg.from;
|
|
90
|
+
const text = msg.text?.body;
|
|
91
|
+
if (!text) continue;
|
|
92
|
+
await this.markRead(msg.id).catch(() => {});
|
|
93
|
+
const allowed = await this.checkDMPolicy(from, text);
|
|
94
|
+
if (!allowed) continue;
|
|
95
|
+
this.emit("message", {
|
|
96
|
+
id: msg.id,
|
|
97
|
+
channelId: "whatsapp",
|
|
98
|
+
from,
|
|
99
|
+
chatId: from,
|
|
100
|
+
text,
|
|
101
|
+
timestamp: new Date(parseInt(msg.timestamp) * 1e3).toISOString(),
|
|
102
|
+
isDM: true,
|
|
103
|
+
name: value.contacts?.[0]?.profile?.name
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async checkDMPolicy(from, text) {
|
|
108
|
+
if (this.config.dmPolicy === "none") return false;
|
|
109
|
+
if (this.config.dmPolicy === "open") return true;
|
|
110
|
+
if (this.config.dmPolicy === "allowlist") {
|
|
111
|
+
if (this.config.allowFrom.includes(from)) return true;
|
|
112
|
+
await this.sendMessage(from, "🦅 HyperClaw: You are not on the allowlist.");
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
if (this.config.dmPolicy === "pairing") {
|
|
116
|
+
if (this.config.approvedPairings.includes(from)) return true;
|
|
117
|
+
const upper = text.trim().toUpperCase();
|
|
118
|
+
if (this.config.pendingPairings[upper]) {
|
|
119
|
+
this.config.approvedPairings.push(from);
|
|
120
|
+
delete this.config.pendingPairings[upper];
|
|
121
|
+
await this.saveState();
|
|
122
|
+
await this.sendMessage(from, "🦅 *Paired!* You can now send messages.");
|
|
123
|
+
this.emit("pairing:approved", {
|
|
124
|
+
userId: from,
|
|
125
|
+
channelId: "whatsapp"
|
|
126
|
+
});
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
const code = Array.from({ length: 6 }, () => "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"[Math.floor(Math.random() * 32)]).join("");
|
|
130
|
+
this.config.pendingPairings[code] = from;
|
|
131
|
+
await this.saveState();
|
|
132
|
+
await this.sendMessage(from, `🦅 HyperClaw Pairing\n\nCode: *${code}*\nAsk owner: hyperclaw pairing approve whatsapp ${code}`);
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
async sendMessage(to, text) {
|
|
138
|
+
await graphReq(this.config.accessToken, "POST", `/${this.config.phoneNumberId}/messages`, {
|
|
139
|
+
messaging_product: "whatsapp",
|
|
140
|
+
to,
|
|
141
|
+
type: "text",
|
|
142
|
+
text: {
|
|
143
|
+
body: text.slice(0, 4096),
|
|
144
|
+
preview_url: false
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async markRead(messageId) {
|
|
149
|
+
await graphReq(this.config.accessToken, "POST", `/${this.config.phoneNumberId}/messages`, {
|
|
150
|
+
messaging_product: "whatsapp",
|
|
151
|
+
status: "read",
|
|
152
|
+
message_id: messageId
|
|
153
|
+
}).catch(() => {});
|
|
154
|
+
}
|
|
155
|
+
async sendTemplate(to, templateName, languageCode = "en_US") {
|
|
156
|
+
await graphReq(this.config.accessToken, "POST", `/${this.config.phoneNumberId}/messages`, {
|
|
157
|
+
messaging_product: "whatsapp",
|
|
158
|
+
to,
|
|
159
|
+
type: "template",
|
|
160
|
+
template: {
|
|
161
|
+
name: templateName,
|
|
162
|
+
language: { code: languageCode }
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
approvePairing(code) {
|
|
167
|
+
const upper = code.toUpperCase();
|
|
168
|
+
if (!this.config.pendingPairings[upper]) return false;
|
|
169
|
+
this.config.approvedPairings.push(this.config.pendingPairings[upper]);
|
|
170
|
+
delete this.config.pendingPairings[upper];
|
|
171
|
+
this.saveState();
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
async loadState() {
|
|
175
|
+
try {
|
|
176
|
+
const s = await fs_extra.default.readJson(STATE_FILE);
|
|
177
|
+
if (s.p) this.config.pendingPairings = s.p;
|
|
178
|
+
if (s.a) this.config.approvedPairings = s.a;
|
|
179
|
+
} catch {}
|
|
180
|
+
}
|
|
181
|
+
async saveState() {
|
|
182
|
+
await fs_extra.default.ensureDir(path.default.dirname(STATE_FILE));
|
|
183
|
+
await fs_extra.default.writeJson(STATE_FILE, {
|
|
184
|
+
p: this.config.pendingPairings,
|
|
185
|
+
a: this.config.approvedPairings
|
|
186
|
+
}, { spaces: 2 });
|
|
187
|
+
}
|
|
188
|
+
isRunning() {
|
|
189
|
+
return this.running;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
//#endregion
|
|
194
|
+
exports.WhatsAppConnector = WhatsAppConnector;
|