abtars 0.1.0-alpha.2 → 0.1.0-alpha.21
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/CHANGELOG.md +64 -0
- package/bundle/_registry.generated-KQODGKTQ.js +36 -0
- package/bundle/{_registry.generated-M4WY2MMI.js.map → _registry.generated-KQODGKTQ.js.map} +1 -1
- package/bundle/abtars-browser.js +8 -7
- package/bundle/abtars-browser.js.map +1 -1
- package/bundle/abtars-cli.js +646 -73
- package/bundle/abtars-cli.js.map +4 -4
- package/bundle/abtars-restart.js +7 -6
- package/bundle/abtars-rss.js +2 -1
- package/bundle/abtars-rss.js.map +1 -1
- package/bundle/abtars-task.js +9 -8
- package/bundle/abtars-task.js.map +1 -1
- package/bundle/abtars.js +103 -96
- package/bundle/abtars.js.map +2 -2
- package/bundle/{agent-api-rate-limit-OQNFMXTZ.js → agent-api-rate-limit-7R5TX2F2.js} +7 -6
- package/bundle/{agent-api-rate-limit-OQNFMXTZ.js.map → agent-api-rate-limit-7R5TX2F2.js.map} +1 -1
- package/bundle/agent-registry-5M77ZOMV.js +19 -0
- package/bundle/agent-registry-VJMNIQ5W.js +19 -0
- package/bundle/{anthropic-adapter-2APTH3LA.js → anthropic-adapter-IBY3NPXW.js} +4 -3
- package/bundle/{anthropic-adapter-2APTH3LA.js.map → anthropic-adapter-IBY3NPXW.js.map} +1 -1
- package/bundle/{bridge-lock-transport-4AC2G5G6.js → bridge-lock-transport-HO545SBK.js} +9 -8
- package/bundle/browse-delivery-64GQIUHG.js +18 -0
- package/bundle/browser-EXR5OQGK.js +19 -0
- package/bundle/capability-HIE7UGFU.js +18 -0
- package/bundle/{chunk-BUUVFUPO.js → chunk-2BY6I4P5.js} +5 -4
- package/bundle/{chunk-BUUVFUPO.js.map → chunk-2BY6I4P5.js.map} +1 -1
- package/bundle/{chunk-Y6XAEX2Q.js → chunk-2F6XKG7Y.js} +15 -9
- package/bundle/chunk-2F6XKG7Y.js.map +7 -0
- package/bundle/{chunk-V76TVMCM.js → chunk-3MO2MDXJ.js} +5 -4
- package/bundle/{chunk-V76TVMCM.js.map → chunk-3MO2MDXJ.js.map} +1 -1
- package/bundle/{chunk-6UCRKRWR.js → chunk-6XX4OAAM.js} +22 -21
- package/bundle/chunk-6XX4OAAM.js.map +7 -0
- package/bundle/{chunk-XREWVCUO.js → chunk-7CHLS36W.js} +16 -148
- package/bundle/chunk-7CHLS36W.js.map +7 -0
- package/bundle/{chunk-NWDBD4PA.js → chunk-7K2YZTLD.js} +3 -2
- package/bundle/{chunk-JCJS4ZIB.js → chunk-AQVOAQQI.js} +5 -4
- package/bundle/{chunk-JCJS4ZIB.js.map → chunk-AQVOAQQI.js.map} +1 -1
- package/bundle/chunk-AUQD2PKM.js +136 -0
- package/bundle/chunk-AUQD2PKM.js.map +7 -0
- package/bundle/{chunk-YOCTDKKL.js → chunk-BYDUMHXT.js} +4 -3
- package/bundle/{chunk-YOCTDKKL.js.map → chunk-BYDUMHXT.js.map} +1 -1
- package/bundle/{chunk-RVE2N7FA.js → chunk-CELR236Q.js} +5 -4
- package/bundle/{chunk-RVE2N7FA.js.map → chunk-CELR236Q.js.map} +1 -1
- package/bundle/{chunk-2XU2X4OI.js → chunk-CUQA2AJT.js} +3 -2
- package/bundle/{chunk-2XU2X4OI.js.map → chunk-CUQA2AJT.js.map} +1 -1
- package/bundle/chunk-DMPR5MYT.js +183 -0
- package/bundle/chunk-DMPR5MYT.js.map +7 -0
- package/bundle/{chunk-BHMZ4RCC.js → chunk-DY3R7LDW.js} +55 -54
- package/bundle/{chunk-BHMZ4RCC.js.map → chunk-DY3R7LDW.js.map} +1 -1
- package/bundle/{chunk-AR6GO6YC.js → chunk-ELRAH7VL.js} +5 -4
- package/bundle/{chunk-AR6GO6YC.js.map → chunk-ELRAH7VL.js.map} +1 -1
- package/bundle/{chunk-FMWKEPM7.js → chunk-EX2SRTUE.js} +5 -4
- package/bundle/{chunk-FMWKEPM7.js.map → chunk-EX2SRTUE.js.map} +1 -1
- package/bundle/{chunk-JW6RU47G.js → chunk-FVQGP5YO.js} +8 -7
- package/bundle/{chunk-JW6RU47G.js.map → chunk-FVQGP5YO.js.map} +1 -1
- package/bundle/{chunk-GRNENTPA.js → chunk-G6IXMYIO.js} +4 -3
- package/bundle/{chunk-GRNENTPA.js.map → chunk-G6IXMYIO.js.map} +1 -1
- package/bundle/{chunk-6NR3OHEW.js → chunk-H2RZ4NEJ.js} +6 -5
- package/bundle/{chunk-6NR3OHEW.js.map → chunk-H2RZ4NEJ.js.map} +1 -1
- package/bundle/chunk-HVKJN3AG.js +189 -0
- package/bundle/chunk-HVKJN3AG.js.map +7 -0
- package/bundle/{chunk-265TPOPC.js → chunk-HXJRZWKA.js} +3 -2
- package/bundle/{chunk-265TPOPC.js.map → chunk-HXJRZWKA.js.map} +1 -1
- package/bundle/chunk-IU3RI5E4.js +645 -0
- package/bundle/chunk-IU3RI5E4.js.map +7 -0
- package/bundle/{chunk-GST5T3WZ.js → chunk-J5YIMCLT.js} +6 -5
- package/bundle/{chunk-GST5T3WZ.js.map → chunk-J5YIMCLT.js.map} +1 -1
- package/bundle/chunk-JAJ3DUQ2.js +30 -0
- package/bundle/{chunk-OP7BTAWY.js.map → chunk-JAJ3DUQ2.js.map} +1 -1
- package/bundle/chunk-JHF25OOG.js +645 -0
- package/bundle/chunk-JHF25OOG.js.map +7 -0
- package/bundle/{chunk-MPX525QO.js → chunk-JRG4EFMP.js} +5 -4
- package/bundle/{chunk-MPX525QO.js.map → chunk-JRG4EFMP.js.map} +1 -1
- package/bundle/{chunk-VVEDVGCR.js → chunk-JU3UBWLN.js} +17 -16
- package/bundle/{chunk-VVEDVGCR.js.map → chunk-JU3UBWLN.js.map} +1 -1
- package/bundle/{chunk-QBGBT5QS.js → chunk-JX3ZZU3O.js} +5 -4
- package/bundle/{chunk-QBGBT5QS.js.map → chunk-JX3ZZU3O.js.map} +1 -1
- package/bundle/{chunk-6SETMHNN.js → chunk-K7P74UNQ.js} +8 -7
- package/bundle/{chunk-6SETMHNN.js.map → chunk-K7P74UNQ.js.map} +1 -1
- package/bundle/{chunk-AZJIODTQ.js → chunk-KED3G7HS.js} +6 -5
- package/bundle/{chunk-AZJIODTQ.js.map → chunk-KED3G7HS.js.map} +1 -1
- package/bundle/chunk-KI2ROWAH.js +3707 -0
- package/bundle/chunk-KI2ROWAH.js.map +7 -0
- package/bundle/{chunk-UHRP745J.js → chunk-L7YHV5DL.js} +6 -5
- package/bundle/{chunk-UHRP745J.js.map → chunk-L7YHV5DL.js.map} +1 -1
- package/bundle/{chunk-BSSBCSCL.js → chunk-LD5BMLHG.js} +11 -10
- package/bundle/{chunk-BSSBCSCL.js.map → chunk-LD5BMLHG.js.map} +1 -1
- package/bundle/{chunk-2UPU3OW6.js → chunk-LYEAHE5V.js} +5 -4
- package/bundle/{chunk-2UPU3OW6.js.map → chunk-LYEAHE5V.js.map} +1 -1
- package/bundle/{chunk-3B7BBE4F.js → chunk-MCGEXAG5.js} +8 -7
- package/bundle/{chunk-3B7BBE4F.js.map → chunk-MCGEXAG5.js.map} +1 -1
- package/bundle/{chunk-X76UX47U.js → chunk-MJ6PHMOK.js} +4 -3
- package/bundle/{chunk-X76UX47U.js.map → chunk-MJ6PHMOK.js.map} +1 -1
- package/bundle/{chunk-LSPKJQCI.js → chunk-MV6CJFWR.js} +3 -2
- package/bundle/{chunk-LSPKJQCI.js.map → chunk-MV6CJFWR.js.map} +1 -1
- package/bundle/chunk-MZWMYN4O.js +17 -0
- package/bundle/{chunk-M6VBAPNT.js.map → chunk-MZWMYN4O.js.map} +1 -1
- package/bundle/{chunk-HX7Y7EYP.js → chunk-NIRYBWUW.js} +4 -3
- package/bundle/{chunk-HX7Y7EYP.js.map → chunk-NIRYBWUW.js.map} +1 -1
- package/bundle/{chunk-3E545J66.js → chunk-OW64RUE5.js} +3 -2
- package/bundle/{chunk-3E545J66.js.map → chunk-OW64RUE5.js.map} +1 -1
- package/bundle/chunk-P56PLAIC.js +126 -0
- package/bundle/chunk-P56PLAIC.js.map +7 -0
- package/bundle/{chunk-TZHIDLDS.js → chunk-P6PN34XD.js} +5 -4
- package/bundle/{chunk-TZHIDLDS.js.map → chunk-P6PN34XD.js.map} +1 -1
- package/bundle/{chunk-2UENBO6M.js → chunk-PF5UQ64X.js} +9 -8
- package/bundle/{chunk-2UENBO6M.js.map → chunk-PF5UQ64X.js.map} +1 -1
- package/bundle/{chunk-6CPN4IGS.js → chunk-PQ62LZNA.js} +9 -8
- package/bundle/{chunk-6CPN4IGS.js.map → chunk-PQ62LZNA.js.map} +1 -1
- package/bundle/{chunk-UCQ2WC3B.js → chunk-PQW5QBPY.js} +15 -8
- package/bundle/chunk-PQW5QBPY.js.map +7 -0
- package/bundle/{chunk-D2DCBO6M.js → chunk-R36WIOYX.js} +3 -2
- package/bundle/{chunk-D2DCBO6M.js.map → chunk-R36WIOYX.js.map} +1 -1
- package/bundle/chunk-RB3X66KM.js +386 -0
- package/bundle/chunk-RB3X66KM.js.map +7 -0
- package/bundle/{chunk-GUQVJC3U.js → chunk-RE3F3CFW.js} +7 -6
- package/bundle/{chunk-GUQVJC3U.js.map → chunk-RE3F3CFW.js.map} +1 -1
- package/bundle/chunk-RWUINZUQ.js +19 -0
- package/bundle/chunk-RWUINZUQ.js.map +7 -0
- package/bundle/{chunk-NT3OBORC.js → chunk-S54DBUZ4.js} +10 -9
- package/bundle/{chunk-NT3OBORC.js.map → chunk-S54DBUZ4.js.map} +1 -1
- package/bundle/{chunk-CWOHNFUV.js → chunk-SY67HM2Y.js} +3 -2
- package/bundle/{chunk-CWOHNFUV.js.map → chunk-SY67HM2Y.js.map} +1 -1
- package/bundle/{chunk-BQ2L4GMG.js → chunk-TBLYGCPQ.js} +4 -3
- package/bundle/{chunk-BQ2L4GMG.js.map → chunk-TBLYGCPQ.js.map} +1 -1
- package/bundle/chunk-TCBMBX3Z.js +183 -0
- package/bundle/chunk-TCBMBX3Z.js.map +7 -0
- package/bundle/chunk-TXRWQIQQ.js +3707 -0
- package/bundle/chunk-TXRWQIQQ.js.map +7 -0
- package/bundle/chunk-U34CSHFS.js +645 -0
- package/bundle/chunk-U34CSHFS.js.map +7 -0
- package/bundle/{chunk-CEVRHKJY.js → chunk-UDZIZB5F.js} +6 -5
- package/bundle/{chunk-CEVRHKJY.js.map → chunk-UDZIZB5F.js.map} +1 -1
- package/bundle/{chunk-W6FAL35D.js → chunk-VA5WKN3Z.js} +7 -6
- package/bundle/{chunk-W6FAL35D.js.map → chunk-VA5WKN3Z.js.map} +1 -1
- package/bundle/{chunk-X6TERNVJ.js → chunk-WX7GHGFX.js} +10 -9
- package/bundle/{chunk-X6TERNVJ.js.map → chunk-WX7GHGFX.js.map} +1 -1
- package/bundle/{chunk-PNEDC45Y.js → chunk-XETTJVEU.js} +4 -3
- package/bundle/{chunk-PNEDC45Y.js.map → chunk-XETTJVEU.js.map} +1 -1
- package/bundle/{chunk-PLCY3GFH.js → chunk-XLLSPBBT.js} +5 -4
- package/bundle/{chunk-PLCY3GFH.js.map → chunk-XLLSPBBT.js.map} +1 -1
- package/bundle/{chunk-ZXPXCDA6.js → chunk-XOCP5BMO.js} +6 -5
- package/bundle/{chunk-ZXPXCDA6.js.map → chunk-XOCP5BMO.js.map} +1 -1
- package/bundle/chunk-ZEY6YZAB.js +138 -0
- package/bundle/chunk-ZEY6YZAB.js.map +7 -0
- package/bundle/{chunk-MW6WDLU7.js → chunk-ZZR3JZHR.js} +10 -9
- package/bundle/{chunk-MW6WDLU7.js.map → chunk-ZZR3JZHR.js.map} +1 -1
- package/bundle/commands-AIL4XOIZ.js +33 -0
- package/bundle/commands-K77NVSXZ.js +32 -0
- package/bundle/commands-V6RSVC4Y.js +32 -0
- package/bundle/completion-buffer-S3LXDZG2.js +14 -0
- package/bundle/config-C6VHRJQ7.js +20 -0
- package/bundle/{config-show-ERTATR6E.js → config-show-ZTXX27FW.js} +4 -3
- package/bundle/{config-show-ERTATR6E.js.map → config-show-ZTXX27FW.js.map} +1 -1
- package/bundle/{context-HCEGZNDC.js → context-OCS7HLJP.js} +5 -4
- package/bundle/{context-HCEGZNDC.js.map → context-OCS7HLJP.js.map} +1 -1
- package/bundle/daemon-NPKYZ3CJ.js +292 -0
- package/bundle/daemon-NPKYZ3CJ.js.map +7 -0
- package/bundle/delegation-tools-PF7RD2RW.js +28 -0
- package/bundle/{deploy-lib-import-32ZFKHWP.js → deploy-lib-import-ODLDL2DB.js} +5 -4
- package/bundle/digital-signature-PNY4TR2W.js +14 -0
- package/bundle/{direct-api-transport-YR7SXXNN.js → direct-api-transport-EADHM67Z.js} +21 -20
- package/bundle/{direct-api-transport-YR7SXXNN.js.map → direct-api-transport-EADHM67Z.js.map} +1 -1
- package/bundle/direct-api-transport-SLJ2Z6NX.js +861 -0
- package/bundle/direct-api-transport-SLJ2Z6NX.js.map +7 -0
- package/bundle/{discord-adapter-YYWVMPPU.js → discord-adapter-FBJOJSTW.js} +25 -24
- package/bundle/{discord-adapter-YYWVMPPU.js.map → discord-adapter-FBJOJSTW.js.map} +1 -1
- package/bundle/discord-adapter-IJISVHUE.js +585 -0
- package/bundle/discord-adapter-IJISVHUE.js.map +7 -0
- package/bundle/discord-adapter-UYOCKRDF.js +586 -0
- package/bundle/discord-adapter-UYOCKRDF.js.map +7 -0
- package/bundle/{dist-MTMKARCP.js → dist-J3T4XVKX.js} +4 -3
- package/bundle/{dist-MTMKARCP.js.map → dist-J3T4XVKX.js.map} +1 -1
- package/bundle/{dns-wakeup-27M7D2MR.js → dns-wakeup-RYOCQ6GR.js} +6 -5
- package/bundle/{dns-wakeup-27M7D2MR.js.map → dns-wakeup-RYOCQ6GR.js.map} +1 -1
- package/bundle/{doctor-QNUSDY73.js → doctor-R54GZPKL.js} +10 -9
- package/bundle/{doctor-QNUSDY73.js.map → doctor-R54GZPKL.js.map} +1 -1
- package/bundle/{ensure-invariants-NMXNS476.js → ensure-invariants-K2ZUZ6NR.js} +7 -6
- package/bundle/{ensure-invariants-NMXNS476.js.map → ensure-invariants-K2ZUZ6NR.js.map} +1 -1
- package/bundle/ensure-invariants-KUXIW73S.js +50 -0
- package/bundle/ensure-invariants-KUXIW73S.js.map +7 -0
- package/bundle/env-schema-DGD6QWPA.js +20 -0
- package/bundle/{esm-DDP6NCZG.js → esm-PFOJARXA.js} +5 -4
- package/bundle/{esm-DDP6NCZG.js.map → esm-PFOJARXA.js.map} +1 -1
- package/bundle/{fallback-policy-L4QV2PEJ.js → fallback-policy-SR6ED5I3.js} +4 -3
- package/bundle/{fallback-policy-L4QV2PEJ.js.map → fallback-policy-SR6ED5I3.js.map} +1 -1
- package/bundle/{health-check-SPA7NT6N.js → health-check-RJ2SUJYL.js} +4 -3
- package/bundle/{health-check-SPA7NT6N.js.map → health-check-RJ2SUJYL.js.map} +1 -1
- package/bundle/hook-system-POI5VRIX.js +18 -0
- package/bundle/hotskills-6ECHLXTJ.js +13 -0
- package/bundle/install-24XR5FO5.js +13 -0
- package/bundle/install-AJ7VW76P.js +13 -0
- package/bundle/{install-log-IAPHYKD4.js → install-log-Q6RUHKWC.js} +4 -3
- package/bundle/{install-log-IAPHYKD4.js.map → install-log-Q6RUHKWC.js.map} +1 -1
- package/bundle/{install-manifest-SPQRUNXL.js → install-manifest-MCJCAYSR.js} +9 -7
- package/bundle/install-manifest-MCJCAYSR.js.map +7 -0
- package/bundle/install-manifest-ZETY4AFS.js +104 -0
- package/bundle/install-manifest-ZETY4AFS.js.map +7 -0
- package/bundle/{install-validate-PVLZXYLQ.js → install-validate-H74LUCE2.js} +4 -3
- package/bundle/{install-validate-PVLZXYLQ.js.map → install-validate-H74LUCE2.js.map} +1 -1
- package/bundle/{irc-adapter-OI5UZSQF.js → irc-adapter-RKRUSZXB.js} +7 -6
- package/bundle/{irc-adapter-OI5UZSQF.js.map → irc-adapter-RKRUSZXB.js.map} +1 -1
- package/bundle/{irc-config-55YO6EGB.js → irc-config-6VY67UPQ.js} +8 -7
- package/bundle/{irc-config-55YO6EGB.js.map → irc-config-6VY67UPQ.js.map} +1 -1
- package/bundle/{logs-ZNYXX5PA.js → logs-EK4HYRKR.js} +4 -3
- package/bundle/{logs-ZNYXX5PA.js.map → logs-EK4HYRKR.js.map} +1 -1
- package/bundle/{media-utils-XNNDTYFI.js → media-utils-QBY5WBF3.js} +8 -7
- package/bundle/{media-utils-XNNDTYFI.js.map → media-utils-QBY5WBF3.js.map} +1 -1
- package/bundle/message-pipeline-ANSMPK5O.js +34 -0
- package/bundle/message-pipeline-HXZMRGXZ.js +34 -0
- package/bundle/message-pipeline-XUUTGPFH.js +35 -0
- package/bundle/meta.json +1828 -1650
- package/bundle/model-health-registry-7ECZFCW4.js +12 -0
- package/bundle/model-health-registry-LDC76RPP.js +12 -0
- package/bundle/notification-OJ4YE4VG.js +14 -0
- package/bundle/{openrouter-credits-EDY7ETAU.js → openrouter-credits-L45SYKT3.js} +7 -6
- package/bundle/{openrouter-credits-EDY7ETAU.js.map → openrouter-credits-L45SYKT3.js.map} +1 -1
- package/bundle/{passwd-RRFV4CC5.js → passwd-QSHZJ2CG.js} +4 -3
- package/bundle/{passwd-RRFV4CC5.js.map → passwd-QSHZJ2CG.js.map} +1 -1
- package/bundle/paths-ZJYIDND2.js +18 -0
- package/bundle/{peer-client-52XYMNI7.js → peer-client-T44VI7NB.js} +13 -12
- package/bundle/{peer-client-52XYMNI7.js.map → peer-client-T44VI7NB.js.map} +1 -1
- package/bundle/peer-config-D5A4454H.js +17 -0
- package/bundle/{peer-sessions-EAXTNQ36.js → peer-sessions-MY2YVXHC.js} +4 -3
- package/bundle/{peer-sessions-EAXTNQ36.js.map → peer-sessions-MY2YVXHC.js.map} +1 -1
- package/bundle/{pending-callback-RIMQZ7FJ.js → pending-callback-6KLBSHLX.js} +4 -3
- package/bundle/{pending-callback-RIMQZ7FJ.js.map → pending-callback-6KLBSHLX.js.map} +1 -1
- package/bundle/phase-transport-43NP5XBK.js +23 -0
- package/bundle/phase-transport-GNUZI6EW.js +23 -0
- package/bundle/phase-transport-Q7K6V3VZ.js +23 -0
- package/bundle/phase-transport-SLJXIAY5.js +23 -0
- package/bundle/{responses-adapter-AAQTY3K4.js → responses-adapter-DAV2JUL7.js} +4 -3
- package/bundle/{responses-adapter-AAQTY3K4.js.map → responses-adapter-DAV2JUL7.js.map} +1 -1
- package/bundle/{restore-ZE3SEPSS.js → restore-ROJF22R2.js} +5 -4
- package/bundle/{restore-ZE3SEPSS.js.map → restore-ROJF22R2.js.map} +1 -1
- package/bundle/{self-healer-utils-DMUUXC47.js → self-healer-utils-7NFH22VJ.js} +7 -6
- package/bundle/{self-healer-utils-DMUUXC47.js.map → self-healer-utils-7NFH22VJ.js.map} +1 -1
- package/bundle/skill-stats-IPVKMWN3.js +23 -0
- package/bundle/sleep-4NVWZHVN.js +20 -0
- package/bundle/soul-bundle-7EYTEKFE.js +15 -0
- package/bundle/soul-loader-7FN7WDHM.js +18 -0
- package/bundle/soul-loader-K237NP4T.js +17 -0
- package/bundle/soul-loader-K237NP4T.js.map +7 -0
- package/bundle/soul-loader-UVJ6HZM3.js +17 -0
- package/bundle/soul-loader-UVJ6HZM3.js.map +7 -0
- package/bundle/src-Z3WR7SRT.js +9 -0
- package/bundle/src-Z3WR7SRT.js.map +7 -0
- package/bundle/{sse-parser-anthropic-P7CE2MH2.js → sse-parser-anthropic-H42TTLBD.js} +7 -6
- package/bundle/{sse-parser-anthropic-P7CE2MH2.js.map → sse-parser-anthropic-H42TTLBD.js.map} +1 -1
- package/bundle/{sse-parser-responses-EQQA5FWN.js → sse-parser-responses-WG2LY2ML.js} +7 -6
- package/bundle/{sse-parser-responses-EQQA5FWN.js.map → sse-parser-responses-WG2LY2ML.js.map} +1 -1
- package/bundle/{ssrf-guard-FZCBYIVW.js → ssrf-guard-E2KBBC5E.js} +7 -6
- package/bundle/{ssrf-guard-FZCBYIVW.js.map → ssrf-guard-E2KBBC5E.js.map} +1 -1
- package/bundle/{start-FH3GRMJ4.js → start-4IWBKLWO.js} +4 -3
- package/bundle/{start-FH3GRMJ4.js.map → start-4IWBKLWO.js.map} +1 -1
- package/bundle/{stream-single-WSG4D53C.js → stream-single-RFJNUTL6.js} +4 -3
- package/bundle/{stream-single-WSG4D53C.js.map → stream-single-RFJNUTL6.js.map} +1 -1
- package/bundle/stt-CF3CPFDC.js +15 -0
- package/bundle/stt-CF3CPFDC.js.map +7 -0
- package/bundle/subagent-runtime-P7GCFBM3.js +13 -0
- package/bundle/subagent-runtime-P7GCFBM3.js.map +7 -0
- package/bundle/subagent-runtime-USNPO4WF.js +13 -0
- package/bundle/subagent-runtime-USNPO4WF.js.map +7 -0
- package/bundle/subagent-runtime-XS2ZXYOZ.js +13 -0
- package/bundle/subagent-runtime-XS2ZXYOZ.js.map +7 -0
- package/bundle/{system-message-T5R3EYYN.js → system-message-TALP6GP2.js} +6 -5
- package/bundle/{system-message-T5R3EYYN.js.map → system-message-TALP6GP2.js.map} +1 -1
- package/bundle/{system-status-KQ6KHFJ6.js → system-status-2CR5OUDY.js} +10 -9
- package/bundle/{system-status-KQ6KHFJ6.js.map → system-status-2CR5OUDY.js.map} +1 -1
- package/bundle/task-store-KIBFZL5A.js +23 -0
- package/bundle/task-store-KIBFZL5A.js.map +7 -0
- package/bundle/{telegram-adapter-2V3XUMT5.js → telegram-adapter-ISQRW7PN.js} +34 -33
- package/bundle/{telegram-adapter-2V3XUMT5.js.map → telegram-adapter-ISQRW7PN.js.map} +1 -1
- package/bundle/telegram-adapter-QCD7AG5D.js +1062 -0
- package/bundle/telegram-adapter-QCD7AG5D.js.map +7 -0
- package/bundle/telegram-adapter-Y3PVA25S.js +1061 -0
- package/bundle/telegram-adapter-Y3PVA25S.js.map +7 -0
- package/bundle/telegram-adapter-YAXSK2RT.js +1062 -0
- package/bundle/telegram-adapter-YAXSK2RT.js.map +7 -0
- package/bundle/tool-registry-DFCCGZCB.js +39 -0
- package/bundle/tool-registry-DFCCGZCB.js.map +7 -0
- package/bundle/tool-sandbox-OZMXJZLQ.js +21 -0
- package/bundle/tool-sandbox-OZMXJZLQ.js.map +7 -0
- package/bundle/{transport-config-YLXU33RO.js → transport-config-ANPS2RYT.js} +11 -10
- package/bundle/transport-config-ANPS2RYT.js.map +7 -0
- package/bundle/update-check-O5MS6B3L.js +13 -0
- package/bundle/update-check-O5MS6B3L.js.map +7 -0
- package/bundle/usage-tracker-S4Z2G2K5.js +18 -0
- package/bundle/usage-tracker-S4Z2G2K5.js.map +7 -0
- package/bundle/user-registry-GTAJIW6E.js +17 -0
- package/bundle/user-registry-GTAJIW6E.js.map +7 -0
- package/config/.env +2 -0
- package/config/auto-fix.json +14 -0
- package/config/irc.json.example +30 -0
- package/config/models.json.example +229 -0
- package/config/peers.json.example +12 -0
- package/config/schemas/irc.schema.json +42 -0
- package/config/schemas/models.schema.json +17 -0
- package/config/schemas/peers.schema.json +35 -0
- package/config/schemas/transport.schema.json +35 -0
- package/config/schemas/users.schema.json +22 -0
- package/config/transport.default.json +30 -0
- package/config/transport.json.example +102 -0
- package/config/users.json.example +11 -0
- package/install-manifest.json +148 -0
- package/package.json +4 -2
- package/scripts/abtars-daemon.service +1 -0
- package/scripts/watchdog.sh +1 -1
- package/bundle/_registry.generated-M4WY2MMI.js +0 -35
- package/bundle/agent-registry-LT4JNQH6.js +0 -18
- package/bundle/browse-delivery-JXBY36GK.js +0 -17
- package/bundle/browser-ELNDVPLC.js +0 -18
- package/bundle/capability-CIL3G4FI.js +0 -17
- package/bundle/chunk-5R2ANXQ7.js +0 -510
- package/bundle/chunk-5R2ANXQ7.js.map +0 -7
- package/bundle/chunk-6UCRKRWR.js.map +0 -7
- package/bundle/chunk-M6VBAPNT.js +0 -16
- package/bundle/chunk-OP7BTAWY.js +0 -29
- package/bundle/chunk-UCQ2WC3B.js.map +0 -7
- package/bundle/chunk-XREWVCUO.js.map +0 -7
- package/bundle/chunk-Y6XAEX2Q.js.map +0 -7
- package/bundle/commands-BHVUOU3V.js +0 -31
- package/bundle/completion-buffer-P253ONKF.js +0 -13
- package/bundle/config-RGSDAPZN.js +0 -19
- package/bundle/delegation-tools-GYTS2D6A.js +0 -27
- package/bundle/digital-signature-OFCGSHWO.js +0 -13
- package/bundle/env-schema-2KBHBDGN.js +0 -19
- package/bundle/hook-system-6Q5YTR53.js +0 -17
- package/bundle/hotskills-K7BM4YLB.js +0 -12
- package/bundle/install-6HRZVKUM.js +0 -15
- package/bundle/install-manifest-SPQRUNXL.js.map +0 -7
- package/bundle/message-pipeline-LLH5SYMO.js +0 -33
- package/bundle/model-health-registry-35LQNVQR.js +0 -11
- package/bundle/notification-Y5S5MMLV.js +0 -13
- package/bundle/paths-G33RZWZ7.js +0 -17
- package/bundle/peer-config-VK6EDLN5.js +0 -16
- package/bundle/phase-transport-KYERDL2O.js +0 -22
- package/bundle/skill-stats-LLEXEXLR.js +0 -22
- package/bundle/sleep-OYIUOVQD.js +0 -19
- package/bundle/soul-loader-54WCVNLJ.js +0 -16
- package/bundle/src-JL4PVO23.js +0 -8
- package/bundle/stt-2UH3RITX.js +0 -14
- package/bundle/subagent-runtime-LE2ZXH3G.js +0 -12
- package/bundle/task-store-K7CQDEPI.js +0 -22
- package/bundle/tool-registry-MU3OX4UI.js +0 -38
- package/bundle/tool-sandbox-VYOK4ZOA.js +0 -20
- package/bundle/update-QCW5LXRN.js +0 -13
- package/bundle/update-check-27KZSAP6.js +0 -12
- package/bundle/usage-tracker-OVVEVMOY.js +0 -17
- package/bundle/user-registry-D4SD73UV.js +0 -16
- /package/bundle/{agent-registry-LT4JNQH6.js.map → agent-registry-5M77ZOMV.js.map} +0 -0
- /package/bundle/{bridge-lock-transport-4AC2G5G6.js.map → agent-registry-VJMNIQ5W.js.map} +0 -0
- /package/bundle/{browse-delivery-JXBY36GK.js.map → bridge-lock-transport-HO545SBK.js.map} +0 -0
- /package/bundle/{browser-ELNDVPLC.js.map → browse-delivery-64GQIUHG.js.map} +0 -0
- /package/bundle/{capability-CIL3G4FI.js.map → browser-EXR5OQGK.js.map} +0 -0
- /package/bundle/{chunk-NWDBD4PA.js.map → capability-HIE7UGFU.js.map} +0 -0
- /package/bundle/{commands-BHVUOU3V.js.map → chunk-7K2YZTLD.js.map} +0 -0
- /package/bundle/{completion-buffer-P253ONKF.js.map → commands-AIL4XOIZ.js.map} +0 -0
- /package/bundle/{config-RGSDAPZN.js.map → commands-K77NVSXZ.js.map} +0 -0
- /package/bundle/{delegation-tools-GYTS2D6A.js.map → commands-V6RSVC4Y.js.map} +0 -0
- /package/bundle/{deploy-lib-import-32ZFKHWP.js.map → completion-buffer-S3LXDZG2.js.map} +0 -0
- /package/bundle/{digital-signature-OFCGSHWO.js.map → config-C6VHRJQ7.js.map} +0 -0
- /package/bundle/{env-schema-2KBHBDGN.js.map → delegation-tools-PF7RD2RW.js.map} +0 -0
- /package/bundle/{hook-system-6Q5YTR53.js.map → deploy-lib-import-ODLDL2DB.js.map} +0 -0
- /package/bundle/{hotskills-K7BM4YLB.js.map → digital-signature-PNY4TR2W.js.map} +0 -0
- /package/bundle/{install-6HRZVKUM.js.map → env-schema-DGD6QWPA.js.map} +0 -0
- /package/bundle/{message-pipeline-LLH5SYMO.js.map → hook-system-POI5VRIX.js.map} +0 -0
- /package/bundle/{model-health-registry-35LQNVQR.js.map → hotskills-6ECHLXTJ.js.map} +0 -0
- /package/bundle/{notification-Y5S5MMLV.js.map → install-24XR5FO5.js.map} +0 -0
- /package/bundle/{paths-G33RZWZ7.js.map → install-AJ7VW76P.js.map} +0 -0
- /package/bundle/{peer-config-VK6EDLN5.js.map → message-pipeline-ANSMPK5O.js.map} +0 -0
- /package/bundle/{phase-transport-KYERDL2O.js.map → message-pipeline-HXZMRGXZ.js.map} +0 -0
- /package/bundle/{skill-stats-LLEXEXLR.js.map → message-pipeline-XUUTGPFH.js.map} +0 -0
- /package/bundle/{sleep-OYIUOVQD.js.map → model-health-registry-7ECZFCW4.js.map} +0 -0
- /package/bundle/{soul-loader-54WCVNLJ.js.map → model-health-registry-LDC76RPP.js.map} +0 -0
- /package/bundle/{src-JL4PVO23.js.map → notification-OJ4YE4VG.js.map} +0 -0
- /package/bundle/{stt-2UH3RITX.js.map → paths-ZJYIDND2.js.map} +0 -0
- /package/bundle/{subagent-runtime-LE2ZXH3G.js.map → peer-config-D5A4454H.js.map} +0 -0
- /package/bundle/{task-store-K7CQDEPI.js.map → phase-transport-43NP5XBK.js.map} +0 -0
- /package/bundle/{tool-registry-MU3OX4UI.js.map → phase-transport-GNUZI6EW.js.map} +0 -0
- /package/bundle/{tool-sandbox-VYOK4ZOA.js.map → phase-transport-Q7K6V3VZ.js.map} +0 -0
- /package/bundle/{transport-config-YLXU33RO.js.map → phase-transport-SLJXIAY5.js.map} +0 -0
- /package/bundle/{update-QCW5LXRN.js.map → skill-stats-IPVKMWN3.js.map} +0 -0
- /package/bundle/{update-check-27KZSAP6.js.map → sleep-4NVWZHVN.js.map} +0 -0
- /package/bundle/{usage-tracker-OVVEVMOY.js.map → soul-bundle-7EYTEKFE.js.map} +0 -0
- /package/bundle/{user-registry-D4SD73UV.js.map → soul-loader-7FN7WDHM.js.map} +0 -0
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __bundleCreateRequire } from 'node:module'; import { fileURLToPath as __bundleFileURLToPath } from 'node:url'; import { dirname as __bundleDirname } from 'node:path'; const require = __bundleCreateRequire(import.meta.url); const __chunk_filename = __bundleFileURLToPath(import.meta.url); const __chunk_dirname = __bundleDirname(__chunk_filename);
|
|
3
|
+
import {
|
|
4
|
+
BOT_COMMANDS,
|
|
5
|
+
ResponseFormatter,
|
|
6
|
+
SecurityGate,
|
|
7
|
+
emojiToScore
|
|
8
|
+
} from "./chunk-R36WIOYX.js";
|
|
9
|
+
import {
|
|
10
|
+
require_src
|
|
11
|
+
} from "./chunk-P6PN34XD.js";
|
|
12
|
+
import {
|
|
13
|
+
formatReactionSignal,
|
|
14
|
+
handleInboundMessage
|
|
15
|
+
} from "./chunk-DY3R7LDW.js";
|
|
16
|
+
import "./chunk-NIRYBWUW.js";
|
|
17
|
+
import "./chunk-3MO2MDXJ.js";
|
|
18
|
+
import "./chunk-WX7GHGFX.js";
|
|
19
|
+
import "./chunk-RWUINZUQ.js";
|
|
20
|
+
import "./chunk-P56PLAIC.js";
|
|
21
|
+
import {
|
|
22
|
+
loadUsers
|
|
23
|
+
} from "./chunk-J5YIMCLT.js";
|
|
24
|
+
import "./chunk-JAJ3DUQ2.js";
|
|
25
|
+
import "./chunk-G6IXMYIO.js";
|
|
26
|
+
import "./chunk-UDZIZB5F.js";
|
|
27
|
+
import "./chunk-XLLSPBBT.js";
|
|
28
|
+
import "./chunk-MZWMYN4O.js";
|
|
29
|
+
import {
|
|
30
|
+
init_log_and_swallow,
|
|
31
|
+
logAndSwallow
|
|
32
|
+
} from "./chunk-EX2SRTUE.js";
|
|
33
|
+
import {
|
|
34
|
+
getEnv,
|
|
35
|
+
init_env_schema
|
|
36
|
+
} from "./chunk-AQVOAQQI.js";
|
|
37
|
+
import {
|
|
38
|
+
init_logger,
|
|
39
|
+
logDebug,
|
|
40
|
+
logError,
|
|
41
|
+
logInfo,
|
|
42
|
+
logWarn
|
|
43
|
+
} from "./chunk-2BY6I4P5.js";
|
|
44
|
+
import "./chunk-MJ6PHMOK.js";
|
|
45
|
+
import {
|
|
46
|
+
__toESM
|
|
47
|
+
} from "./chunk-7K2YZTLD.js";
|
|
48
|
+
|
|
49
|
+
// src/platforms/discord/discord-api.ts
|
|
50
|
+
init_log_and_swallow();
|
|
51
|
+
var import_discord = __toESM(require_src(), 1);
|
|
52
|
+
init_logger();
|
|
53
|
+
var TAG = "DiscordApi";
|
|
54
|
+
var DiscordApi = class {
|
|
55
|
+
client;
|
|
56
|
+
token;
|
|
57
|
+
ready = false;
|
|
58
|
+
constructor(botToken) {
|
|
59
|
+
this.token = botToken;
|
|
60
|
+
this.client = new import_discord.Client({
|
|
61
|
+
intents: [
|
|
62
|
+
import_discord.GatewayIntentBits.Guilds,
|
|
63
|
+
import_discord.GatewayIntentBits.GuildMessages,
|
|
64
|
+
import_discord.GatewayIntentBits.GuildMessageReactions,
|
|
65
|
+
import_discord.GatewayIntentBits.DirectMessages,
|
|
66
|
+
import_discord.GatewayIntentBits.MessageContent
|
|
67
|
+
],
|
|
68
|
+
partials: [import_discord.Partials.Channel, import_discord.Partials.Message, import_discord.Partials.Reaction]
|
|
69
|
+
});
|
|
70
|
+
this.client.on("clientReady", () => {
|
|
71
|
+
this.ready = true;
|
|
72
|
+
logInfo(TAG, `Connected as ${this.client.user?.tag ?? "unknown"}`);
|
|
73
|
+
});
|
|
74
|
+
this.client.on("error", (err) => {
|
|
75
|
+
logError(TAG, "Client error", err);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/** Connect to the Discord Gateway. Resolves when the client is ready. */
|
|
79
|
+
async connect() {
|
|
80
|
+
logInfo(TAG, "Connecting to Discord Gateway\u2026");
|
|
81
|
+
return new Promise((resolve, reject) => {
|
|
82
|
+
const onReady = () => {
|
|
83
|
+
cleanup();
|
|
84
|
+
resolve();
|
|
85
|
+
};
|
|
86
|
+
const onError = (err) => {
|
|
87
|
+
cleanup();
|
|
88
|
+
reject(err);
|
|
89
|
+
};
|
|
90
|
+
const cleanup = () => {
|
|
91
|
+
this.client.removeListener("clientReady", onReady);
|
|
92
|
+
this.client.removeListener("error", onError);
|
|
93
|
+
};
|
|
94
|
+
this.client.once("clientReady", onReady);
|
|
95
|
+
this.client.once("error", onError);
|
|
96
|
+
this.client.login(this.token).catch((err) => {
|
|
97
|
+
cleanup();
|
|
98
|
+
reject(err instanceof Error ? err : new Error(String(err)));
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/** Register a handler for MESSAGE_CREATE events. */
|
|
103
|
+
onMessage(handler) {
|
|
104
|
+
this.client.on("messageCreate", (message) => {
|
|
105
|
+
logDebug(TAG, `Message from ${message.author.tag} in #${message.channel.id}`);
|
|
106
|
+
try {
|
|
107
|
+
const result = handler(message);
|
|
108
|
+
if (result instanceof Promise) {
|
|
109
|
+
result.catch((err) => {
|
|
110
|
+
logError(TAG, "Message handler error", err);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
} catch (err) {
|
|
114
|
+
logError(TAG, "Message handler error", err);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/** Register a handler for MESSAGE_REACTION_ADD events. */
|
|
119
|
+
onReaction(handler) {
|
|
120
|
+
this.client.on("messageReactionAdd", async (reaction, user) => {
|
|
121
|
+
if (user.bot) return;
|
|
122
|
+
try {
|
|
123
|
+
if (reaction.partial) await reaction.fetch();
|
|
124
|
+
if (user.partial) await user.fetch();
|
|
125
|
+
} catch (err) {
|
|
126
|
+
logAndSwallow(TAG, "fetch reaction/user partial", err);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const result = handler(reaction, user);
|
|
131
|
+
if (result instanceof Promise) result.catch((err) => logError(TAG, "Reaction handler error", err));
|
|
132
|
+
} catch (err) {
|
|
133
|
+
logError(TAG, "Reaction handler error", err);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/** Register a handler for slash command interactions. */
|
|
138
|
+
onInteraction(handler) {
|
|
139
|
+
this.client.on("interactionCreate", async (interaction) => {
|
|
140
|
+
if (interaction.isChatInputCommand()) {
|
|
141
|
+
try {
|
|
142
|
+
const result = handler(interaction);
|
|
143
|
+
if (result instanceof Promise) result.catch((err) => logError(TAG, "Interaction handler error", err));
|
|
144
|
+
} catch (err) {
|
|
145
|
+
logError(TAG, "Interaction handler error", err);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (interaction.isStringSelectMenu()) {
|
|
149
|
+
this.selectMenuHandlers.get(interaction.customId)?.(interaction);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
selectMenuHandlers = /* @__PURE__ */ new Map();
|
|
154
|
+
onSelectMenu(customId, handler) {
|
|
155
|
+
this.selectMenuHandlers.set(customId, handler);
|
|
156
|
+
}
|
|
157
|
+
/** Register global application commands. Idempotent — Discord diffs and updates. */
|
|
158
|
+
async registerCommands(commands) {
|
|
159
|
+
if (!this.client.application) {
|
|
160
|
+
logWarn(TAG, "Cannot register commands \u2014 application not available");
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
await this.client.application.commands.set(commands.map((c) => ({ name: c.name, description: c.description, type: 1 })));
|
|
164
|
+
logInfo(TAG, `Registered ${commands.length} slash commands`);
|
|
165
|
+
}
|
|
166
|
+
/** Send a text message to a channel. Returns the sent message ID. */
|
|
167
|
+
async sendMessage(channelId, text) {
|
|
168
|
+
const channel = await this.client.channels.fetch(channelId);
|
|
169
|
+
if (!channel?.isTextBased()) {
|
|
170
|
+
throw new Error(`Channel ${channelId} is not a text channel`);
|
|
171
|
+
}
|
|
172
|
+
const sent = await channel.send(text);
|
|
173
|
+
logDebug(TAG, `Sent message ${sent.id} to channel ${channelId}`);
|
|
174
|
+
return sent.id;
|
|
175
|
+
}
|
|
176
|
+
/** Send typing indicator to a channel. */
|
|
177
|
+
async sendTyping(channelId) {
|
|
178
|
+
try {
|
|
179
|
+
const channel = await this.client.channels.fetch(channelId);
|
|
180
|
+
if (channel?.isTextBased()) await channel.sendTyping();
|
|
181
|
+
} catch (err) {
|
|
182
|
+
logAndSwallow("discord_api", "op", err);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/** Add or remove a reaction on a message. Empty emoji = remove bot's reactions. */
|
|
186
|
+
async setReaction(channelId, messageId, emoji) {
|
|
187
|
+
try {
|
|
188
|
+
const channel = await this.client.channels.fetch(channelId);
|
|
189
|
+
if (!channel?.isTextBased()) return;
|
|
190
|
+
const message = await channel.messages.fetch(messageId);
|
|
191
|
+
if (!emoji) {
|
|
192
|
+
const botId = this.client.user?.id;
|
|
193
|
+
if (botId) {
|
|
194
|
+
for (const reaction of message.reactions.cache.values()) {
|
|
195
|
+
await reaction.users.remove(botId).catch((err) => logAndSwallow(TAG, "remove bot reaction", err));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
await message.react(emoji);
|
|
200
|
+
}
|
|
201
|
+
} catch (err) {
|
|
202
|
+
logAndSwallow("discord_api", "op", err);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/** Edit a previously sent message. */
|
|
206
|
+
async editMessage(channelId, messageId, text) {
|
|
207
|
+
try {
|
|
208
|
+
const channel = await this.client.channels.fetch(channelId);
|
|
209
|
+
if (!channel?.isTextBased()) return;
|
|
210
|
+
const message = await channel.messages.fetch(messageId);
|
|
211
|
+
await message.edit(text);
|
|
212
|
+
} catch (err) {
|
|
213
|
+
logAndSwallow("discord_api", "op", err);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/** Gracefully close the Gateway connection. */
|
|
217
|
+
async disconnect() {
|
|
218
|
+
logInfo(TAG, "Disconnecting from Discord Gateway\u2026");
|
|
219
|
+
this.ready = false;
|
|
220
|
+
this.client.destroy();
|
|
221
|
+
}
|
|
222
|
+
/** Whether the client is connected and ready. */
|
|
223
|
+
get isReady() {
|
|
224
|
+
return this.ready;
|
|
225
|
+
}
|
|
226
|
+
/** Get the bot's own user ID (for filtering self-messages). */
|
|
227
|
+
get botUserId() {
|
|
228
|
+
return this.client.user?.id ?? null;
|
|
229
|
+
}
|
|
230
|
+
/** Fetch a specific message by channel + message ID. Returns null on failure. (#388) */
|
|
231
|
+
async fetchMessage(channelId, messageId) {
|
|
232
|
+
try {
|
|
233
|
+
const channel = await this.client.channels.fetch(channelId);
|
|
234
|
+
if (!channel?.isTextBased()) return null;
|
|
235
|
+
const msg = await channel.messages.fetch(messageId);
|
|
236
|
+
return msg ? { authorId: msg.author.id } : null;
|
|
237
|
+
} catch (err) {
|
|
238
|
+
logAndSwallow(TAG, "fetchMessage", err);
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// src/platforms/discord/discord-poller.ts
|
|
245
|
+
init_logger();
|
|
246
|
+
var TAG2 = "DiscordPoller";
|
|
247
|
+
var DiscordPoller = class {
|
|
248
|
+
api;
|
|
249
|
+
appId;
|
|
250
|
+
onMessage;
|
|
251
|
+
started = false;
|
|
252
|
+
constructor(api, appId, onMessage) {
|
|
253
|
+
this.api = api;
|
|
254
|
+
this.appId = appId;
|
|
255
|
+
this.onMessage = onMessage;
|
|
256
|
+
}
|
|
257
|
+
/** Connect to Gateway and start listening. */
|
|
258
|
+
async start() {
|
|
259
|
+
if (this.started) return;
|
|
260
|
+
this.started = true;
|
|
261
|
+
await this.api.connect();
|
|
262
|
+
this.api.onMessage((raw) => {
|
|
263
|
+
const selfId = this.api.botUserId ?? this.appId;
|
|
264
|
+
if (raw.author.id === selfId) {
|
|
265
|
+
logDebug(TAG2, `Ignoring self-message ${raw.id}`);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
const inbound = toDiscordInboundMessage(raw, this.appId);
|
|
269
|
+
logDebug(TAG2, `Dispatching message ${inbound.id} from ${inbound.authorUsername}`);
|
|
270
|
+
try {
|
|
271
|
+
const result = this.onMessage(inbound);
|
|
272
|
+
if (result instanceof Promise) {
|
|
273
|
+
result.catch((err) => {
|
|
274
|
+
logWarn(TAG2, `Error in message callback: ${err instanceof Error ? err.message : String(err)}`);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
} catch (err) {
|
|
278
|
+
logWarn(TAG2, `Error in message callback: ${err instanceof Error ? err.message : String(err)}`);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
logInfo(TAG2, "Started \u2014 listening for Discord messages");
|
|
282
|
+
}
|
|
283
|
+
/** Disconnect from Gateway cleanly. */
|
|
284
|
+
stop() {
|
|
285
|
+
if (!this.started) return;
|
|
286
|
+
this.started = false;
|
|
287
|
+
this.api.disconnect();
|
|
288
|
+
logInfo(TAG2, "Stopped");
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
function toDiscordInboundMessage(raw, botId) {
|
|
292
|
+
const parentId = "parentId" in raw.channel ? raw.channel.parentId ?? null : null;
|
|
293
|
+
const channelName = "name" in raw.channel ? raw.channel.name ?? null : null;
|
|
294
|
+
const mentionsBotId = botId ? raw.mentions.users.has(botId) || new RegExp(`<@!?${botId}>`).test(raw.content) : false;
|
|
295
|
+
const botMember = raw.guild?.members.me ?? null;
|
|
296
|
+
const botRoleIds = botMember ? /* @__PURE__ */ new Set([...botMember.roles.cache.keys()]) : /* @__PURE__ */ new Set();
|
|
297
|
+
const mentionsBotRole = botMember ? [...raw.mentions.roles.keys()].some((rid) => botRoleIds.has(rid)) : false;
|
|
298
|
+
logDebug(TAG2, `mentionsBotId=${mentionsBotId} mentionsBotRole=${mentionsBotRole} (appId=${botId}, mentions=${[...raw.mentions.users.keys()].join(",")}, content=${raw.content.slice(0, 60)})`);
|
|
299
|
+
return {
|
|
300
|
+
id: raw.id,
|
|
301
|
+
channelId: raw.channelId,
|
|
302
|
+
parentChannelId: parentId,
|
|
303
|
+
channelName,
|
|
304
|
+
isDM: !raw.guildId,
|
|
305
|
+
authorId: raw.author.id,
|
|
306
|
+
authorUsername: raw.author.username,
|
|
307
|
+
authorIsBot: raw.author.bot ?? false,
|
|
308
|
+
content: raw.content,
|
|
309
|
+
timestamp: raw.createdTimestamp,
|
|
310
|
+
mentionsBotId,
|
|
311
|
+
mentionsBotRole,
|
|
312
|
+
mentionsEveryone: raw.mentions.everyone,
|
|
313
|
+
hasUserMentions: raw.mentions.users.size > 0,
|
|
314
|
+
replyReferenceMessageId: raw.reference?.messageId ?? null,
|
|
315
|
+
attachments: raw.attachments.size > 0 ? [...raw.attachments.values()].map((a) => ({ url: a.url, filename: a.name ?? "file", contentType: a.contentType ?? void 0, size: a.size })) : void 0
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// src/platforms/discord/discord-adapter.ts
|
|
320
|
+
init_logger();
|
|
321
|
+
init_log_and_swallow();
|
|
322
|
+
init_env_schema();
|
|
323
|
+
var DISCORD_CAPABILITIES = { voice: false, reactions: true, typing: true, threads: true };
|
|
324
|
+
var TAG3 = "discord";
|
|
325
|
+
var DiscordAdapter = class {
|
|
326
|
+
name = "discord";
|
|
327
|
+
capabilities = DISCORD_CAPABILITIES;
|
|
328
|
+
api;
|
|
329
|
+
securityGate;
|
|
330
|
+
formatter = new ResponseFormatter();
|
|
331
|
+
config;
|
|
332
|
+
deps;
|
|
333
|
+
poller = null;
|
|
334
|
+
constructor(config, deps) {
|
|
335
|
+
this.api = new DiscordApi(config.botToken);
|
|
336
|
+
this.securityGate = new SecurityGate(loadUsers());
|
|
337
|
+
this.config = config;
|
|
338
|
+
this.deps = deps;
|
|
339
|
+
}
|
|
340
|
+
async start() {
|
|
341
|
+
this.poller = new DiscordPoller(this.api, this.config.appId, (m) => this.handleMessage(m));
|
|
342
|
+
this.api.onReaction((reaction, user) => this.handleReaction(reaction, user));
|
|
343
|
+
this.api.onInteraction((interaction) => this.handleInteraction(interaction));
|
|
344
|
+
await this.poller.start();
|
|
345
|
+
await this.api.registerCommands([...BOT_COMMANDS]).catch(
|
|
346
|
+
(err) => logWarn(TAG3, `Slash command registration failed: ${err instanceof Error ? err.message : String(err)}`)
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
/** Handle Discord slash command interactions. */
|
|
350
|
+
async handleInteraction(interaction) {
|
|
351
|
+
if (interaction.commandName === "model" || interaction.commandName === "models") {
|
|
352
|
+
await this.handleModelPicker(interaction);
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
await interaction.deferReply();
|
|
356
|
+
const registry = loadUsers();
|
|
357
|
+
const userEntry = registry.byPlatformId.get(`discord:${interaction.user.id}`);
|
|
358
|
+
if (!this.securityGate.authorizeById(interaction.user.id, interaction.channelId)) {
|
|
359
|
+
await interaction.editReply("\u26D4 Unauthorized.");
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const commandText = `/${interaction.commandName}`;
|
|
363
|
+
const userId = userEntry?.userId ?? "unknown";
|
|
364
|
+
const channelId = interaction.channelId;
|
|
365
|
+
let initialReplied = false;
|
|
366
|
+
const interactionAdapter = {
|
|
367
|
+
...this,
|
|
368
|
+
sendMessage: async (_ch, text) => {
|
|
369
|
+
if (!text?.trim()) return void 0;
|
|
370
|
+
const chunks = text.length <= 2e3 ? [text] : text.match(/.{1,2000}/gs) ?? [text];
|
|
371
|
+
let lastId;
|
|
372
|
+
for (const chunk of chunks) {
|
|
373
|
+
if (!initialReplied) {
|
|
374
|
+
initialReplied = true;
|
|
375
|
+
const sent = await interaction.editReply(chunk);
|
|
376
|
+
lastId = sent.id;
|
|
377
|
+
} else {
|
|
378
|
+
const sent = await interaction.followUp(chunk);
|
|
379
|
+
lastId = sent.id;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return lastId;
|
|
383
|
+
},
|
|
384
|
+
editMessage: async (_ch, _messageId, text) => {
|
|
385
|
+
await interaction.editReply(text);
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
const msg = {
|
|
389
|
+
text: commandText,
|
|
390
|
+
channelId,
|
|
391
|
+
userId,
|
|
392
|
+
senderId: interaction.user.id,
|
|
393
|
+
senderName: interaction.user.username ?? "unknown",
|
|
394
|
+
platform: "discord",
|
|
395
|
+
timestamp: Date.now(),
|
|
396
|
+
isGroup: !!interaction.guildId,
|
|
397
|
+
isVoice: false
|
|
398
|
+
};
|
|
399
|
+
await handleInboundMessage(msg, interactionAdapter, this.deps.pipeline);
|
|
400
|
+
}
|
|
401
|
+
/** Interactive model picker — ephemeral select menus. */
|
|
402
|
+
async handleModelPicker(interaction) {
|
|
403
|
+
const { ActionRowBuilder, StringSelectMenuBuilder } = await import("./src-Z3WR7SRT.js");
|
|
404
|
+
const { loadTransport } = await import("./transport-config-ANPS2RYT.js");
|
|
405
|
+
const tc = loadTransport();
|
|
406
|
+
if (!tc) {
|
|
407
|
+
await interaction.reply({ content: "No transport config.", ephemeral: true });
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const providers = Object.entries(tc.providers).map(([id, p]) => ({ id, name: p.name ?? id }));
|
|
411
|
+
if (providers.length === 0) {
|
|
412
|
+
await interaction.reply({ content: "No providers configured.", ephemeral: true });
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
const menu = new StringSelectMenuBuilder().setCustomId("model_picker_provider").setPlaceholder("Select provider").addOptions(providers.slice(0, 25).map((p) => ({ label: p.name, value: p.id })));
|
|
416
|
+
const row = new ActionRowBuilder().addComponents(menu);
|
|
417
|
+
await interaction.reply({ content: "\u{1F527} Select provider:", components: [row], ephemeral: true });
|
|
418
|
+
this.api.onSelectMenu("model_picker_provider", async (selectInteraction) => {
|
|
419
|
+
const providerId = selectInteraction.values[0];
|
|
420
|
+
const provider = tc.providers[providerId];
|
|
421
|
+
if (!provider) {
|
|
422
|
+
await selectInteraction.update({ content: "Provider not found.", components: [] });
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const { getModelsForProvider } = await import("./transport-config-ANPS2RYT.js");
|
|
426
|
+
const models = getModelsForProvider(providerId).filter((m) => m.entry.status === "alive" || !m.entry.status).slice(0, 25);
|
|
427
|
+
if (models.length === 0) {
|
|
428
|
+
await selectInteraction.update({ content: `No models for ${providerId}.`, components: [] });
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
const modelMenu = new StringSelectMenuBuilder().setCustomId("model_picker_model").setPlaceholder("Select model").addOptions(models.map((m) => ({ label: m.id, value: m.id })));
|
|
432
|
+
const modelRow = new ActionRowBuilder().addComponents(modelMenu);
|
|
433
|
+
await selectInteraction.update({ content: `Provider: **${providerId}**
|
|
434
|
+
Select model:`, components: [modelRow] });
|
|
435
|
+
this.api.onSelectMenu("model_picker_model", async (modelInteraction) => {
|
|
436
|
+
const modelId = modelInteraction.values[0];
|
|
437
|
+
await modelInteraction.update({ content: `\u2705 Switching to **${providerId}/${modelId}**...`, components: [] });
|
|
438
|
+
const msg = {
|
|
439
|
+
text: `/model ${providerId} ${modelId}`,
|
|
440
|
+
channelId: modelInteraction.channelId,
|
|
441
|
+
userId: interaction.user.id,
|
|
442
|
+
senderId: interaction.user.id,
|
|
443
|
+
senderName: interaction.user.username ?? "unknown",
|
|
444
|
+
platform: "discord",
|
|
445
|
+
timestamp: Date.now(),
|
|
446
|
+
isGroup: !!interaction.guildId,
|
|
447
|
+
isVoice: false
|
|
448
|
+
};
|
|
449
|
+
await handleInboundMessage(msg, this, this.deps.pipeline);
|
|
450
|
+
});
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
stop() {
|
|
454
|
+
this.poller?.stop();
|
|
455
|
+
this.poller = null;
|
|
456
|
+
}
|
|
457
|
+
authorize(msg) {
|
|
458
|
+
return this.securityGate.authorizeById(msg.senderId, msg.channelId);
|
|
459
|
+
}
|
|
460
|
+
async sendMessage(channelId, text, _opts) {
|
|
461
|
+
const id = await this.api.sendMessage(channelId, text);
|
|
462
|
+
return id || void 0;
|
|
463
|
+
}
|
|
464
|
+
async sendTyping(channelId) {
|
|
465
|
+
await this.api.sendTyping(channelId);
|
|
466
|
+
}
|
|
467
|
+
async setReaction(channelId, messageId, emoji) {
|
|
468
|
+
await this.api.setReaction(channelId, String(messageId), emoji);
|
|
469
|
+
}
|
|
470
|
+
async editMessage(channelId, messageId, text) {
|
|
471
|
+
await this.api.editMessage(channelId, String(messageId), text);
|
|
472
|
+
}
|
|
473
|
+
chunkResponse(text) {
|
|
474
|
+
return this.formatter.chunkForPlatform(text, "discord");
|
|
475
|
+
}
|
|
476
|
+
injectMessage(msg) {
|
|
477
|
+
handleInboundMessage(msg, this, this.deps.pipeline).catch((err) => {
|
|
478
|
+
logWarn(TAG3, `Failed to replay queued message: ${err instanceof Error ? err.message : String(err)}`);
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
// --- Internal: Discord message handler ---
|
|
482
|
+
async handleMessage(message) {
|
|
483
|
+
logDebug(TAG3, `Message from ${message.authorUsername} in ${message.channelId}`);
|
|
484
|
+
const effectiveChannelId = message.parentChannelId ?? message.channelId;
|
|
485
|
+
if (!this.securityGate.authorizeById(message.authorId, effectiveChannelId)) {
|
|
486
|
+
logDebug(TAG3, `Unauthorized user=${message.authorId} channel=${effectiveChannelId}`);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const rawText = message.content.trim();
|
|
490
|
+
if (!rawText && !message.attachments?.length) return;
|
|
491
|
+
let text = rawText.replace(new RegExp(`<@!?${this.config.appId}>`, "g"), "").replace(/\s{2,}/g, " ").trim();
|
|
492
|
+
let mediaPath;
|
|
493
|
+
if (message.attachments?.length) {
|
|
494
|
+
try {
|
|
495
|
+
const { saveInboundMedia } = await import("./media-utils-QBY5WBF3.js");
|
|
496
|
+
const att = message.attachments[0];
|
|
497
|
+
const res = await fetch(att.url);
|
|
498
|
+
if (res.ok) {
|
|
499
|
+
const buf = Buffer.from(await res.arrayBuffer());
|
|
500
|
+
const extHint = att.filename ? "." + (att.filename.split(".").pop() ?? "") : void 0;
|
|
501
|
+
const saved = await saveInboundMedia(buf, message.channelId, { extHint, claimedMime: att.contentType });
|
|
502
|
+
if (saved) {
|
|
503
|
+
mediaPath = saved.path;
|
|
504
|
+
if (!text) text = `User sent a ${saved.isImage ? "photo" : "file"}.`;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
} catch (err) {
|
|
508
|
+
logWarn(TAG3, `Attachment download failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
if (!text) return;
|
|
512
|
+
const isDM = message.isDM;
|
|
513
|
+
if (!isDM) {
|
|
514
|
+
const mentionMode = getEnv().discordGroupMentions;
|
|
515
|
+
if (mentionMode === "optional") {
|
|
516
|
+
if (message.hasUserMentions && !message.mentionsBotId && !message.mentionsBotRole && !message.mentionsEveryone) {
|
|
517
|
+
logDebug(TAG3, `Skipped \u2014 mentions another user (optional mode, channel=${effectiveChannelId})`);
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
} else {
|
|
521
|
+
let isReplyToBot = false;
|
|
522
|
+
if (message.replyReferenceMessageId && this.config.appId) {
|
|
523
|
+
try {
|
|
524
|
+
const referenced = await this.api.fetchMessage(message.channelId, message.replyReferenceMessageId);
|
|
525
|
+
isReplyToBot = referenced?.authorId === this.config.appId;
|
|
526
|
+
} catch (err) {
|
|
527
|
+
logAndSwallow(TAG3, "fetchMessage reply ref", err);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
const addressed = message.mentionsBotId || message.mentionsBotRole || isReplyToBot;
|
|
531
|
+
if (!addressed) {
|
|
532
|
+
logDebug(TAG3, `Skipped \u2014 not addressed (channel=${effectiveChannelId})`);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
const channelLabel = message.parentChannelId ? message.channelName ?? "thread" : message.channelName ?? "DM";
|
|
538
|
+
const senderPrefix = isDM ? "" : `[${message.authorUsername}${message.authorIsBot ? " (bot)" : ""}] in #${channelLabel}: `;
|
|
539
|
+
const inbound = {
|
|
540
|
+
platform: "discord",
|
|
541
|
+
channelId: message.channelId,
|
|
542
|
+
userId: loadUsers().byPlatformId.get("discord:" + message.authorId)?.userId ?? "unknown",
|
|
543
|
+
senderId: message.authorId,
|
|
544
|
+
senderName: message.authorUsername,
|
|
545
|
+
text: senderPrefix + text,
|
|
546
|
+
timestamp: message.timestamp,
|
|
547
|
+
isGroup: !isDM,
|
|
548
|
+
isVoice: false,
|
|
549
|
+
mediaPath,
|
|
550
|
+
rawPlatformData: message
|
|
551
|
+
};
|
|
552
|
+
if (text.startsWith("/") && !text.startsWith("//")) {
|
|
553
|
+
handleInboundMessage(inbound, this, this.deps.pipeline).catch((err) => logAndSwallow(TAG3, "handleInboundMessage command", err));
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
await handleInboundMessage(inbound, this, this.deps.pipeline);
|
|
557
|
+
}
|
|
558
|
+
async handleReaction(reaction, user) {
|
|
559
|
+
const channelId = reaction.message.channelId;
|
|
560
|
+
const messageId = Number(reaction.message.id);
|
|
561
|
+
const emoji = reaction.emoji.name ?? "";
|
|
562
|
+
if (!emoji) return;
|
|
563
|
+
const isAuthorized = this.securityGate.authorizeById(user.id, channelId);
|
|
564
|
+
const senderName = user.username || `id:${user.id}`;
|
|
565
|
+
logInfo(TAG3, `Reaction ${emoji} from ${senderName} on msg ${reaction.message.id}`);
|
|
566
|
+
if (isAuthorized && this.deps.memory) {
|
|
567
|
+
const score = emojiToScore(emoji);
|
|
568
|
+
const resolvedUserId = loadUsers().byPlatformId.get("discord:" + user.id)?.userId ?? "unknown";
|
|
569
|
+
const updated = this.deps.memory.updateEmotionByPlatformId(resolvedUserId, messageId, score);
|
|
570
|
+
if (updated) logDebug(TAG3, `Emotion score ${score} set on msg ${reaction.message.id}`);
|
|
571
|
+
}
|
|
572
|
+
if (!isAuthorized) {
|
|
573
|
+
logDebug(TAG3, `Unauthorized reaction from ${user.id}, discarding`);
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
const signal = formatReactionSignal(senderName, [emoji]);
|
|
577
|
+
const bufKey = `discord:${channelId}`;
|
|
578
|
+
this.deps.conversationBuffer.push(bufKey, senderName, signal);
|
|
579
|
+
logDebug(TAG3, `Buffered reaction signal for channel ${channelId}`);
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
export {
|
|
583
|
+
DISCORD_CAPABILITIES,
|
|
584
|
+
DiscordAdapter
|
|
585
|
+
};
|
|
586
|
+
//# sourceMappingURL=discord-adapter-UYOCKRDF.js.map
|