@poncho-ai/cli 0.2.0
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/.turbo/turbo-build.log +19 -0
- package/.turbo/turbo-test.log +389 -0
- package/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/dist/chunk-22OMLQUR.js +1249 -0
- package/dist/chunk-24JFN5RM.js +1887 -0
- package/dist/chunk-24TAT3US.js +2137 -0
- package/dist/chunk-26YBLT7G.js +997 -0
- package/dist/chunk-2EJIC6UW.js +1893 -0
- package/dist/chunk-2JNCF37R.js +1156 -0
- package/dist/chunk-2LVMUHJX.js +1874 -0
- package/dist/chunk-2OVSD65B.js +1269 -0
- package/dist/chunk-2RQ45LI6.js +1251 -0
- package/dist/chunk-2SMIRDLI.js +1854 -0
- package/dist/chunk-2UXPHBFI.js +1862 -0
- package/dist/chunk-2VFM7SSZ.js +1135 -0
- package/dist/chunk-2ZAUADNG.js +1456 -0
- package/dist/chunk-2ZNUT5WA.js +1862 -0
- package/dist/chunk-33ZQ7WTP.js +1834 -0
- package/dist/chunk-34ARQX3O.js +1156 -0
- package/dist/chunk-3BEWSRFW.js +1893 -0
- package/dist/chunk-3DVE5AG6.js +1862 -0
- package/dist/chunk-3KE6MHO6.js +1608 -0
- package/dist/chunk-3MOLPB7Z.js +997 -0
- package/dist/chunk-3OZZOYAZ.js +1884 -0
- package/dist/chunk-3VJYNZEF.js +2181 -0
- package/dist/chunk-3W27LOUH.js +997 -0
- package/dist/chunk-3WMAW74D.js +1163 -0
- package/dist/chunk-3Z4AHBPF.js +1569 -0
- package/dist/chunk-43NK6MB4.js +1977 -0
- package/dist/chunk-4E5M2IGA.js +1300 -0
- package/dist/chunk-4FVI4LVI.js +1862 -0
- package/dist/chunk-4GNQQJUP.js +1156 -0
- package/dist/chunk-4PGZFTVC.js +1234 -0
- package/dist/chunk-4QE2HDNC.js +1355 -0
- package/dist/chunk-4S2EL4ED.js +1135 -0
- package/dist/chunk-536SSOJ3.js +1797 -0
- package/dist/chunk-5CNEGIC5.js +997 -0
- package/dist/chunk-5CWN43YL.js +1147 -0
- package/dist/chunk-5HZCYTUZ.js +997 -0
- package/dist/chunk-5ICNG6RX.js +1885 -0
- package/dist/chunk-5OUIRXMN.js +997 -0
- package/dist/chunk-5T34JOWH.js +1460 -0
- package/dist/chunk-5XBAIQX3.js +1862 -0
- package/dist/chunk-65AIX3CS.js +1441 -0
- package/dist/chunk-67NBW4NG.js +1355 -0
- package/dist/chunk-6AFIL35M.js +1414 -0
- package/dist/chunk-6B3XMBKA.js +1716 -0
- package/dist/chunk-6CEJO4OM.js +1242 -0
- package/dist/chunk-6DQZUP3B.js +1460 -0
- package/dist/chunk-6ET624OE.js +1441 -0
- package/dist/chunk-6I7WFMAU.js +1862 -0
- package/dist/chunk-6MOKAYCL.js +1449 -0
- package/dist/chunk-6RFUALWB.js +1845 -0
- package/dist/chunk-73E57JUS.js +1231 -0
- package/dist/chunk-73SU7GT4.js +816 -0
- package/dist/chunk-74IRETUF.js +997 -0
- package/dist/chunk-77BYFMUN.js +1924 -0
- package/dist/chunk-7DAC2XE5.js +1460 -0
- package/dist/chunk-7GBQ4YSB.js +1024 -0
- package/dist/chunk-7TOJGUQ5.js +1803 -0
- package/dist/chunk-7W7KPLEG.js +1163 -0
- package/dist/chunk-7Y7ZXEN2.js +817 -0
- package/dist/chunk-A5WKH7H2.js +852 -0
- package/dist/chunk-A775UYQB.js +1886 -0
- package/dist/chunk-AC4OGTSK.js +1313 -0
- package/dist/chunk-ACCRUQ6J.js +1271 -0
- package/dist/chunk-AEAZZFTT.js +1886 -0
- package/dist/chunk-AIAC5Z55.js +1147 -0
- package/dist/chunk-AN34PI2R.js +1238 -0
- package/dist/chunk-APIA7MHJ.js +1355 -0
- package/dist/chunk-AQGIIT7R.js +1347 -0
- package/dist/chunk-ATXKV2NH.js +2111 -0
- package/dist/chunk-AVBKQZYR.js +1010 -0
- package/dist/chunk-AWIXDCZF.js +1329 -0
- package/dist/chunk-AXFHQBKT.js +2128 -0
- package/dist/chunk-AYDSTU4P.js +1156 -0
- package/dist/chunk-AZ35PK7E.js +1271 -0
- package/dist/chunk-BE6HB4IO.js +2155 -0
- package/dist/chunk-BIX2FI3S.js +1625 -0
- package/dist/chunk-BPPM5YPG.js +997 -0
- package/dist/chunk-BRCIVYKE.js +1420 -0
- package/dist/chunk-BRK2KKTF.js +1236 -0
- package/dist/chunk-BU7R2TVT.js +1862 -0
- package/dist/chunk-BXJQ4G5F.js +1901 -0
- package/dist/chunk-C3KTCROR.js +1128 -0
- package/dist/chunk-C42IGDJW.js +1032 -0
- package/dist/chunk-CBRPO2FE.js +1886 -0
- package/dist/chunk-CDNITKC6.js +1163 -0
- package/dist/chunk-CDVWUDFM.js +1389 -0
- package/dist/chunk-CH2IE453.js +1147 -0
- package/dist/chunk-CIHC46FS.js +1010 -0
- package/dist/chunk-CIYO754K.js +1687 -0
- package/dist/chunk-CJFNJ7U3.js +918 -0
- package/dist/chunk-CJN66CJY.js +1024 -0
- package/dist/chunk-CLJFTDJQ.js +1667 -0
- package/dist/chunk-CLNCOQNI.js +997 -0
- package/dist/chunk-CN4AUQL4.js +1460 -0
- package/dist/chunk-CQYGUBY6.js +1854 -0
- package/dist/chunk-CRJUMKVB.js +1862 -0
- package/dist/chunk-CZHUYI2J.js +997 -0
- package/dist/chunk-DIBSIWSR.js +1256 -0
- package/dist/chunk-DJGC3R4O.js +1836 -0
- package/dist/chunk-DJR2PEAQ.js +1884 -0
- package/dist/chunk-DKE7NWBK.js +1862 -0
- package/dist/chunk-DXYDN2OS.js +1147 -0
- package/dist/chunk-DZ3FEUJ7.js +1147 -0
- package/dist/chunk-EC47SFY3.js +1113 -0
- package/dist/chunk-ECAALEAK.js +1239 -0
- package/dist/chunk-ECEYIAQZ.js +997 -0
- package/dist/chunk-EKX7AV7O.js +1024 -0
- package/dist/chunk-EN6CTYUN.js +634 -0
- package/dist/chunk-EXCH47WX.js +1460 -0
- package/dist/chunk-EY2JOCTM.js +1862 -0
- package/dist/chunk-EYHB3LTH.js +1818 -0
- package/dist/chunk-F2AC5PKU.js +1446 -0
- package/dist/chunk-F5RCUJ62.js +1156 -0
- package/dist/chunk-F6OM65VA.js +1460 -0
- package/dist/chunk-FAEJ5CQU.js +997 -0
- package/dist/chunk-FB7X4KBF.js +1460 -0
- package/dist/chunk-FBSEEW3H.js +1862 -0
- package/dist/chunk-FBYY3TE5.js +1862 -0
- package/dist/chunk-FEA3GBGG.js +997 -0
- package/dist/chunk-FHPRGTOJ.js +1131 -0
- package/dist/chunk-FLAY6YWY.js +1389 -0
- package/dist/chunk-FNXIVJ3B.js +997 -0
- package/dist/chunk-FWRVG7RM.js +2160 -0
- package/dist/chunk-G47UW452.js +916 -0
- package/dist/chunk-G6V5O5AV.js +997 -0
- package/dist/chunk-GACQBIOO.js +1613 -0
- package/dist/chunk-GBFHLBWT.js +881 -0
- package/dist/chunk-GLJLTQMZ.js +997 -0
- package/dist/chunk-GN7DDBAT.js +1872 -0
- package/dist/chunk-GPTI42MM.js +1355 -0
- package/dist/chunk-GPXGCPVY.js +1834 -0
- package/dist/chunk-GRASQSCU.js +1886 -0
- package/dist/chunk-GU2WWG5C.js +1314 -0
- package/dist/chunk-GW3SAYT3.js +1679 -0
- package/dist/chunk-GZ4F2VI5.js +1447 -0
- package/dist/chunk-GZYXND4U.js +1322 -0
- package/dist/chunk-H27BRPVI.js +1862 -0
- package/dist/chunk-H4JRTOW7.js +1862 -0
- package/dist/chunk-HDS72SRU.js +1138 -0
- package/dist/chunk-HEUGSUL5.js +757 -0
- package/dist/chunk-HMZN5GPS.js +1024 -0
- package/dist/chunk-HN5SVGQO.js +1163 -0
- package/dist/chunk-HN6VQ5FI.js +242 -0
- package/dist/chunk-HNTQ66EL.js +2054 -0
- package/dist/chunk-HSDL3YK5.js +1134 -0
- package/dist/chunk-HVMIMERW.js +997 -0
- package/dist/chunk-HVWCQS2B.js +1834 -0
- package/dist/chunk-HVYMSOXQ.js +2156 -0
- package/dist/chunk-HYQITTK3.js +1862 -0
- package/dist/chunk-I4CCYPAI.js +1239 -0
- package/dist/chunk-IDG3X4UL.js +1229 -0
- package/dist/chunk-IDVRTQJ3.js +1514 -0
- package/dist/chunk-IEER23NN.js +1862 -0
- package/dist/chunk-IKLRYA4W.js +785 -0
- package/dist/chunk-IQBUSFBY.js +1270 -0
- package/dist/chunk-IUXQDZIR.js +1862 -0
- package/dist/chunk-IV74RJFV.js +1862 -0
- package/dist/chunk-IVEMIXXO.js +1854 -0
- package/dist/chunk-J4PNCGSP.js +1460 -0
- package/dist/chunk-J7ULLJUI.js +1862 -0
- package/dist/chunk-J7WHTBOM.js +983 -0
- package/dist/chunk-JBN6D7EG.js +1757 -0
- package/dist/chunk-JDKSD54C.js +1366 -0
- package/dist/chunk-JGWTOS7A.js +1507 -0
- package/dist/chunk-JHJ6FMSI.js +1804 -0
- package/dist/chunk-JJSHCP32.js +1282 -0
- package/dist/chunk-JLMAMC3V.js +1625 -0
- package/dist/chunk-JMTF7VV5.js +1919 -0
- package/dist/chunk-JO56GKTV.js +1133 -0
- package/dist/chunk-JRN3P6CS.js +1441 -0
- package/dist/chunk-JTKPRRSM.js +1024 -0
- package/dist/chunk-JVTFCTGO.js +1868 -0
- package/dist/chunk-JXH452LK.js +956 -0
- package/dist/chunk-K4SW5SP4.js +1147 -0
- package/dist/chunk-KANVHOQK.js +1880 -0
- package/dist/chunk-KBJZJWPZ.js +1143 -0
- package/dist/chunk-KFC4ZVRH.js +1798 -0
- package/dist/chunk-KHG6MSLS.js +1885 -0
- package/dist/chunk-KJJE6V5N.js +1886 -0
- package/dist/chunk-KKLEILZP.js +1868 -0
- package/dist/chunk-KW5QXXEN.js +1641 -0
- package/dist/chunk-KWMTK4N7.js +1147 -0
- package/dist/chunk-KYOW6LIV.js +1231 -0
- package/dist/chunk-KYWIUH3M.js +1355 -0
- package/dist/chunk-KZEA3HJL.js +1833 -0
- package/dist/chunk-L3KONBJE.js +1355 -0
- package/dist/chunk-L47B3OMM.js +1156 -0
- package/dist/chunk-LCQFWI6S.js +997 -0
- package/dist/chunk-LFIUZUI5.js +1138 -0
- package/dist/chunk-LHSLPQR4.js +1854 -0
- package/dist/chunk-LJGVAOFP.js +647 -0
- package/dist/chunk-LKJDYQPA.js +1687 -0
- package/dist/chunk-LOY6PWTR.js +1336 -0
- package/dist/chunk-LPFN3GNV.js +1147 -0
- package/dist/chunk-LPM7AN7S.js +1147 -0
- package/dist/chunk-LU6ES63L.js +1249 -0
- package/dist/chunk-M73DE7AU.js +1389 -0
- package/dist/chunk-M7OJ52WK.js +1448 -0
- package/dist/chunk-MCSM3DAE.js +1024 -0
- package/dist/chunk-MEP7OYUL.js +1417 -0
- package/dist/chunk-MFH6MVWX.js +1441 -0
- package/dist/chunk-MIHU3TFJ.js +1156 -0
- package/dist/chunk-MIU5FMSV.js +1329 -0
- package/dist/chunk-MJQMHH7Z.js +1976 -0
- package/dist/chunk-MLR2HUUY.js +1255 -0
- package/dist/chunk-MSBZHMUV.js +997 -0
- package/dist/chunk-MV4DZQRB.js +1163 -0
- package/dist/chunk-MWBLZDYK.js +1854 -0
- package/dist/chunk-N2MEPDSA.js +675 -0
- package/dist/chunk-N36ATUZM.js +1863 -0
- package/dist/chunk-NEHLM4WN.js +1610 -0
- package/dist/chunk-NHOJZ7FZ.js +1138 -0
- package/dist/chunk-NLPQBHHH.js +1282 -0
- package/dist/chunk-NMY3FWV7.js +1236 -0
- package/dist/chunk-NN2WDNCO.js +1138 -0
- package/dist/chunk-NNC7LH2Y.js +1258 -0
- package/dist/chunk-NQRWXPJ5.js +1275 -0
- package/dist/chunk-NR3G3D6Q.js +1238 -0
- package/dist/chunk-NRUAFOL3.js +2121 -0
- package/dist/chunk-NSCG7F6H.js +1862 -0
- package/dist/chunk-NXHVG7ZI.js +1113 -0
- package/dist/chunk-NYKPTBXA.js +1258 -0
- package/dist/chunk-O4AE4MFX.js +920 -0
- package/dist/chunk-O7GTMG3C.js +1467 -0
- package/dist/chunk-OBUP5UIM.js +997 -0
- package/dist/chunk-ONI2DTTL.js +1156 -0
- package/dist/chunk-OQHLTSVD.js +1776 -0
- package/dist/chunk-OVV6SHTA.js +997 -0
- package/dist/chunk-PAPAMVNI.js +1156 -0
- package/dist/chunk-PH7OXFMJ.js +997 -0
- package/dist/chunk-PHFLPSZU.js +1608 -0
- package/dist/chunk-PTVSK5DV.js +1854 -0
- package/dist/chunk-PUHWX6PD.js +1156 -0
- package/dist/chunk-PYDU2HN2.js +1803 -0
- package/dist/chunk-Q2AMIXBY.js +1250 -0
- package/dist/chunk-Q2EARVB7.js +1414 -0
- package/dist/chunk-Q4HFSYSN.js +1024 -0
- package/dist/chunk-Q65PNALY.js +1024 -0
- package/dist/chunk-QBQNHCYH.js +1791 -0
- package/dist/chunk-QGI55HK3.js +1433 -0
- package/dist/chunk-QIAODEAT.js +1862 -0
- package/dist/chunk-QLRJ2X3B.js +1800 -0
- package/dist/chunk-QTLVBIBL.js +1147 -0
- package/dist/chunk-QUPLQ7O4.js +1862 -0
- package/dist/chunk-QZGUSWLN.js +1415 -0
- package/dist/chunk-R7N3T7YR.js +1130 -0
- package/dist/chunk-RFS3GC46.js +239 -0
- package/dist/chunk-RJA7HIQO.js +1823 -0
- package/dist/chunk-RJLU3F7G.js +1156 -0
- package/dist/chunk-RLBXW5AY.js +1156 -0
- package/dist/chunk-RMKHLIMU.js +1147 -0
- package/dist/chunk-RS7F3BLO.js +1255 -0
- package/dist/chunk-RYLDHQQT.js +997 -0
- package/dist/chunk-RYYTEAQ7.js +1147 -0
- package/dist/chunk-S2KNKYQJ.js +1815 -0
- package/dist/chunk-S5R5IZJH.js +2056 -0
- package/dist/chunk-S5S7OBDZ.js +1355 -0
- package/dist/chunk-S6YKNJQG.js +1868 -0
- package/dist/chunk-SBDVWSWM.js +1251 -0
- package/dist/chunk-SBXSREFV.js +1237 -0
- package/dist/chunk-SDZJV47M.js +1238 -0
- package/dist/chunk-SMBILO75.js +1024 -0
- package/dist/chunk-SUSLSP3P.js +1456 -0
- package/dist/chunk-T4GPZ2AG.js +1128 -0
- package/dist/chunk-TA7EDJXT.js +1460 -0
- package/dist/chunk-TAW2ISST.js +1024 -0
- package/dist/chunk-TB6KKWS2.js +1138 -0
- package/dist/chunk-TBZCEX5O.js +1355 -0
- package/dist/chunk-TDOPKFNW.js +756 -0
- package/dist/chunk-TGY3JSDQ.js +1460 -0
- package/dist/chunk-THOIGUSY.js +666 -0
- package/dist/chunk-TLSGQKLO.js +1836 -0
- package/dist/chunk-TQ2QEU3G.js +1460 -0
- package/dist/chunk-TRJODOZM.js +1232 -0
- package/dist/chunk-TSBMRYLQ.js +1717 -0
- package/dist/chunk-TUL3R6KB.js +1024 -0
- package/dist/chunk-TWCD6YPP.js +2129 -0
- package/dist/chunk-TWQDGVLI.js +1323 -0
- package/dist/chunk-TZQLWQTW.js +769 -0
- package/dist/chunk-U22K555L.js +1803 -0
- package/dist/chunk-U3VXLQTW.js +1707 -0
- package/dist/chunk-U5QM4SRB.js +2054 -0
- package/dist/chunk-UCZLOOAW.js +997 -0
- package/dist/chunk-UDA2OZLK.js +1242 -0
- package/dist/chunk-UDASJ4IC.js +1355 -0
- package/dist/chunk-UGU2KSOQ.js +1113 -0
- package/dist/chunk-UJHB3CLA.js +1130 -0
- package/dist/chunk-UNUTAECX.js +1238 -0
- package/dist/chunk-UUUJVWXA.js +1806 -0
- package/dist/chunk-UV4WM7Q5.js +2039 -0
- package/dist/chunk-UXPGPOQ3.js +2113 -0
- package/dist/chunk-UYVWNYFB.js +1434 -0
- package/dist/chunk-UYWI4MPU.js +1460 -0
- package/dist/chunk-V2FNBN3P.js +997 -0
- package/dist/chunk-V6CF5XXG.js +1862 -0
- package/dist/chunk-V6UUV2SZ.js +1156 -0
- package/dist/chunk-VARTDMWQ.js +1862 -0
- package/dist/chunk-VC7ZYKMP.js +1156 -0
- package/dist/chunk-VCJNX77B.js +2038 -0
- package/dist/chunk-VDE2I72J.js +650 -0
- package/dist/chunk-VEO7FKEL.js +1156 -0
- package/dist/chunk-VIJYIU7E.js +2124 -0
- package/dist/chunk-VJX4WETG.js +1136 -0
- package/dist/chunk-VO3QDFU2.js +1276 -0
- package/dist/chunk-VOX2Q2V2.js +1933 -0
- package/dist/chunk-W7J5XM2X.js +1862 -0
- package/dist/chunk-WONM6P4N.js +1862 -0
- package/dist/chunk-WW576PYD.js +1862 -0
- package/dist/chunk-XCZCCA2D.js +997 -0
- package/dist/chunk-XHQOG4X6.js +1871 -0
- package/dist/chunk-XIYLHBWA.js +1163 -0
- package/dist/chunk-XKZ6XWSE.js +1907 -0
- package/dist/chunk-XLHKOBSF.js +1815 -0
- package/dist/chunk-XMMFUBB5.js +1270 -0
- package/dist/chunk-XQLK777K.js +1442 -0
- package/dist/chunk-XRN47M65.js +997 -0
- package/dist/chunk-XVBKUEXA.js +1441 -0
- package/dist/chunk-XY4ISIAV.js +1639 -0
- package/dist/chunk-Y2SOII6F.js +1156 -0
- package/dist/chunk-Y5TJU6YZ.js +1163 -0
- package/dist/chunk-YBPCMSUU.js +1147 -0
- package/dist/chunk-YDAZ3YZT.js +1004 -0
- package/dist/chunk-YH2QPUWO.js +1621 -0
- package/dist/chunk-YJX4O5CY.js +1355 -0
- package/dist/chunk-YNJMS3VK.js +997 -0
- package/dist/chunk-YNRZMOC3.js +997 -0
- package/dist/chunk-YNUF5JNP.js +1163 -0
- package/dist/chunk-YO7TJ6SG.js +2135 -0
- package/dist/chunk-YTUUFYVS.js +1842 -0
- package/dist/chunk-YXCOG54V.js +997 -0
- package/dist/chunk-Z7V254BA.js +1432 -0
- package/dist/chunk-ZBHRR3RS.js +1256 -0
- package/dist/chunk-ZM47X5PT.js +1236 -0
- package/dist/chunk-ZO6JUCLC.js +917 -0
- package/dist/chunk-ZOF4ERNI.js +2039 -0
- package/dist/chunk-ZOTRZN3T.js +1238 -0
- package/dist/chunk-ZPBA4JGE.js +1234 -0
- package/dist/chunk-ZTKGRHNV.js +1138 -0
- package/dist/chunk-ZW2JM2OY.js +997 -0
- package/dist/chunk-ZXYHUC7C.js +1722 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +37 -0
- package/dist/run-interactive-ink-2CDKFV6C.js +783 -0
- package/dist/run-interactive-ink-2JULLCIS.js +461 -0
- package/dist/run-interactive-ink-2KIHEGXT.js +451 -0
- package/dist/run-interactive-ink-2LX2NZRL.js +737 -0
- package/dist/run-interactive-ink-2OH6AV3C.js +756 -0
- package/dist/run-interactive-ink-2PLJ5XST.js +423 -0
- package/dist/run-interactive-ink-2ZI75VMK.js +462 -0
- package/dist/run-interactive-ink-3BHGPZ4B.js +423 -0
- package/dist/run-interactive-ink-3IUV3456.js +777 -0
- package/dist/run-interactive-ink-3QZK5PWY.js +168 -0
- package/dist/run-interactive-ink-3VLL4FNN.js +423 -0
- package/dist/run-interactive-ink-47Y2KAFZ.js +668 -0
- package/dist/run-interactive-ink-4CBTS636.js +423 -0
- package/dist/run-interactive-ink-4CHDJRAK.js +423 -0
- package/dist/run-interactive-ink-4E6GM5ST.js +423 -0
- package/dist/run-interactive-ink-4EKHIHGU.js +462 -0
- package/dist/run-interactive-ink-4NO7O233.js +744 -0
- package/dist/run-interactive-ink-55IZU2EZ.js +741 -0
- package/dist/run-interactive-ink-5A7BER6J.js +423 -0
- package/dist/run-interactive-ink-5NEFKF3R.js +423 -0
- package/dist/run-interactive-ink-5TCBH3Z4.js +462 -0
- package/dist/run-interactive-ink-5WOLWMGH.js +747 -0
- package/dist/run-interactive-ink-66JFIG2P.js +462 -0
- package/dist/run-interactive-ink-6R77DKEV.js +744 -0
- package/dist/run-interactive-ink-7B6HI7XT.js +679 -0
- package/dist/run-interactive-ink-7ICZH4E3.js +423 -0
- package/dist/run-interactive-ink-7LWBJYQE.js +423 -0
- package/dist/run-interactive-ink-7Y7MVKPA.js +438 -0
- package/dist/run-interactive-ink-A264MR35.js +423 -0
- package/dist/run-interactive-ink-A3NCKFFM.js +423 -0
- package/dist/run-interactive-ink-A4FBMTZ5.js +563 -0
- package/dist/run-interactive-ink-A7YPXRXR.js +462 -0
- package/dist/run-interactive-ink-AAER2EXR.js +451 -0
- package/dist/run-interactive-ink-ADVQJ2GF.js +423 -0
- package/dist/run-interactive-ink-ALV34HZF.js +451 -0
- package/dist/run-interactive-ink-ARDK3CO6.js +462 -0
- package/dist/run-interactive-ink-AVMVDBQK.js +462 -0
- package/dist/run-interactive-ink-AWV7ZOTC.js +423 -0
- package/dist/run-interactive-ink-AWZLJJLH.js +423 -0
- package/dist/run-interactive-ink-B25V52JO.js +462 -0
- package/dist/run-interactive-ink-BC6RGDCH.js +451 -0
- package/dist/run-interactive-ink-BMWLPUEU.js +451 -0
- package/dist/run-interactive-ink-BRT2MMN6.js +423 -0
- package/dist/run-interactive-ink-CB42OWV4.js +572 -0
- package/dist/run-interactive-ink-COZSBQND.js +777 -0
- package/dist/run-interactive-ink-CQFV44HM.js +451 -0
- package/dist/run-interactive-ink-CQMG45KQ.js +462 -0
- package/dist/run-interactive-ink-CQP3B7JM.js +669 -0
- package/dist/run-interactive-ink-CUCLNJCF.js +451 -0
- package/dist/run-interactive-ink-DEEZYQK5.js +423 -0
- package/dist/run-interactive-ink-DF5P6WZX.js +423 -0
- package/dist/run-interactive-ink-DFITKRY4.js +423 -0
- package/dist/run-interactive-ink-DG6TTEQQ.js +462 -0
- package/dist/run-interactive-ink-DH7ECECB.js +438 -0
- package/dist/run-interactive-ink-DMTUJHP6.js +423 -0
- package/dist/run-interactive-ink-DNSBSWLT.js +451 -0
- package/dist/run-interactive-ink-DV3TZEM3.js +742 -0
- package/dist/run-interactive-ink-E4AYCUDK.js +451 -0
- package/dist/run-interactive-ink-E4GPBTSL.js +462 -0
- package/dist/run-interactive-ink-ECVTPOIE.js +462 -0
- package/dist/run-interactive-ink-ELPCCGT3.js +423 -0
- package/dist/run-interactive-ink-ELWVRJZS.js +451 -0
- package/dist/run-interactive-ink-ENBMPAV7.js +462 -0
- package/dist/run-interactive-ink-EOVWUC3C.js +451 -0
- package/dist/run-interactive-ink-EVHWEXM4.js +451 -0
- package/dist/run-interactive-ink-F7SBCWE3.js +423 -0
- package/dist/run-interactive-ink-FCHXZ3JW.js +423 -0
- package/dist/run-interactive-ink-G27WWB5V.js +423 -0
- package/dist/run-interactive-ink-GDFTNYRC.js +462 -0
- package/dist/run-interactive-ink-GHGZAYSM.js +533 -0
- package/dist/run-interactive-ink-GK4IVHVT.js +684 -0
- package/dist/run-interactive-ink-GNCZNR6W.js +423 -0
- package/dist/run-interactive-ink-GQ53M5SW.js +605 -0
- package/dist/run-interactive-ink-GT7R7X2P.js +762 -0
- package/dist/run-interactive-ink-GWZTEIEZ.js +462 -0
- package/dist/run-interactive-ink-HA45VNUD.js +703 -0
- package/dist/run-interactive-ink-HB44RGFJ.js +423 -0
- package/dist/run-interactive-ink-HCVGKG23.js +462 -0
- package/dist/run-interactive-ink-HYKJ4PZ3.js +462 -0
- package/dist/run-interactive-ink-IGEBXARA.js +423 -0
- package/dist/run-interactive-ink-IGU7UVL5.js +462 -0
- package/dist/run-interactive-ink-JNVKOJRV.js +462 -0
- package/dist/run-interactive-ink-JYON5JQQ.js +461 -0
- package/dist/run-interactive-ink-K47CRELE.js +423 -0
- package/dist/run-interactive-ink-KCHMEHVH.js +547 -0
- package/dist/run-interactive-ink-KEB6ENSZ.js +423 -0
- package/dist/run-interactive-ink-KEWSKPTE.js +451 -0
- package/dist/run-interactive-ink-KJUHMADH.js +423 -0
- package/dist/run-interactive-ink-KW5NPJ32.js +423 -0
- package/dist/run-interactive-ink-L3EDWKF6.js +687 -0
- package/dist/run-interactive-ink-L4BCC6WG.js +462 -0
- package/dist/run-interactive-ink-LQPEZ6PR.js +520 -0
- package/dist/run-interactive-ink-LQXS5GMO.js +253 -0
- package/dist/run-interactive-ink-M4SOBC5E.js +817 -0
- package/dist/run-interactive-ink-MJGAQA2R.js +423 -0
- package/dist/run-interactive-ink-MPJB6PCJ.js +451 -0
- package/dist/run-interactive-ink-MXWZBG3F.js +461 -0
- package/dist/run-interactive-ink-N4XIVCWV.js +562 -0
- package/dist/run-interactive-ink-ND3PWHDU.js +462 -0
- package/dist/run-interactive-ink-NJTAWS3L.js +462 -0
- package/dist/run-interactive-ink-OBWWSIZ5.js +423 -0
- package/dist/run-interactive-ink-OD7YJBYI.js +423 -0
- package/dist/run-interactive-ink-OE23JGIN.js +451 -0
- package/dist/run-interactive-ink-OJ4EUMR5.js +462 -0
- package/dist/run-interactive-ink-OOC74RCY.js +423 -0
- package/dist/run-interactive-ink-P2PHTOX6.js +462 -0
- package/dist/run-interactive-ink-PE3XWCVU.js +423 -0
- package/dist/run-interactive-ink-PJBWWQF3.js +423 -0
- package/dist/run-interactive-ink-PLLZW6BV.js +678 -0
- package/dist/run-interactive-ink-PTXNQZ57.js +451 -0
- package/dist/run-interactive-ink-PWN5Q6T6.js +423 -0
- package/dist/run-interactive-ink-PZK4RD77.js +423 -0
- package/dist/run-interactive-ink-QBSXVTCG.js +462 -0
- package/dist/run-interactive-ink-QHOQB55Q.js +727 -0
- package/dist/run-interactive-ink-QIAC6ZMT.js +451 -0
- package/dist/run-interactive-ink-QLLGPIUL.js +462 -0
- package/dist/run-interactive-ink-R5W3ZEMY.js +818 -0
- package/dist/run-interactive-ink-RHDW3EHS.js +462 -0
- package/dist/run-interactive-ink-RLRKPNTS.js +668 -0
- package/dist/run-interactive-ink-RORQKBWV.js +425 -0
- package/dist/run-interactive-ink-RS6OZ66I.js +423 -0
- package/dist/run-interactive-ink-RVGRYBNQ.js +684 -0
- package/dist/run-interactive-ink-S35BKUZB.js +423 -0
- package/dist/run-interactive-ink-SS6RAQDE.js +423 -0
- package/dist/run-interactive-ink-SVP37E33.js +451 -0
- package/dist/run-interactive-ink-T53KH7FU.js +423 -0
- package/dist/run-interactive-ink-TCQUCJVS.js +423 -0
- package/dist/run-interactive-ink-TLUBKTTN.js +423 -0
- package/dist/run-interactive-ink-U2BAAHUU.js +438 -0
- package/dist/run-interactive-ink-U2KXGJ5S.js +451 -0
- package/dist/run-interactive-ink-U73PEMAO.js +423 -0
- package/dist/run-interactive-ink-UFTOTXIX.js +669 -0
- package/dist/run-interactive-ink-UJNQ54ZU.js +451 -0
- package/dist/run-interactive-ink-V63D5IV5.js +423 -0
- package/dist/run-interactive-ink-VLBITT4H.js +451 -0
- package/dist/run-interactive-ink-VSAX3XFR.js +462 -0
- package/dist/run-interactive-ink-WBJOY622.js +729 -0
- package/dist/run-interactive-ink-WERR64KP.js +451 -0
- package/dist/run-interactive-ink-WHTQ5OV6.js +732 -0
- package/dist/run-interactive-ink-WJBK4XIO.js +423 -0
- package/dist/run-interactive-ink-WQLCJ34D.js +462 -0
- package/dist/run-interactive-ink-WRKQJIAG.js +733 -0
- package/dist/run-interactive-ink-XG3P25DM.js +423 -0
- package/dist/run-interactive-ink-XPVJ22HP.js +462 -0
- package/dist/run-interactive-ink-XS5I2CGI.js +423 -0
- package/dist/run-interactive-ink-XVK7DXPB.js +785 -0
- package/dist/run-interactive-ink-YB3USTSB.js +706 -0
- package/dist/run-interactive-ink-YCBRQCG2.js +423 -0
- package/dist/run-interactive-ink-YOPSMTYJ.js +423 -0
- package/dist/run-interactive-ink-YYPCL65X.js +665 -0
- package/dist/run-interactive-ink-YYZT5L4Z.js +462 -0
- package/dist/run-interactive-ink-ZBPYRTJK.js +462 -0
- package/dist/run-interactive-ink-ZCCKFR2A.js +451 -0
- package/dist/run-interactive-ink-ZKYQ4CJW.js +423 -0
- package/dist/run-interactive-ink-ZMO2352Q.js +685 -0
- package/dist/run-interactive-ink-ZTDQ773P.js +423 -0
- package/dist/run-interactive-ink-ZWH74XDY.js +674 -0
- package/package.json +50 -0
- package/src/cli.ts +4 -0
- package/src/index.ts +1800 -0
- package/src/init-feature-context.ts +153 -0
- package/src/init-onboarding.ts +529 -0
- package/src/interactive-ink.tsx +5 -0
- package/src/run-interactive-ink.ts +618 -0
- package/src/web-ui.ts +1975 -0
- package/test/cli.test.ts +587 -0
- package/test/init-onboarding.contract.test.ts +48 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,1441 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LoginRateLimiter,
|
|
3
|
+
SessionStore,
|
|
4
|
+
buildOnboardingFeatureGuidance,
|
|
5
|
+
consumeFirstRunIntro,
|
|
6
|
+
getRequestIp,
|
|
7
|
+
inferConversationTitle,
|
|
8
|
+
initializeOnboardingMarker,
|
|
9
|
+
isDefaultOnboardingConfig,
|
|
10
|
+
parseCookies,
|
|
11
|
+
renderIconSvg,
|
|
12
|
+
renderManifest,
|
|
13
|
+
renderServiceWorker,
|
|
14
|
+
renderWebUiHtml,
|
|
15
|
+
runInitOnboarding,
|
|
16
|
+
setCookie,
|
|
17
|
+
verifyPassphrase
|
|
18
|
+
} from "./chunk-XKZ6XWSE.js";
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
import { spawn } from "child_process";
|
|
22
|
+
import { access, cp, mkdir, readFile, writeFile } from "fs/promises";
|
|
23
|
+
import { existsSync } from "fs";
|
|
24
|
+
import {
|
|
25
|
+
createServer
|
|
26
|
+
} from "http";
|
|
27
|
+
import { dirname, relative, resolve } from "path";
|
|
28
|
+
import { createRequire } from "module";
|
|
29
|
+
import { fileURLToPath } from "url";
|
|
30
|
+
import {
|
|
31
|
+
AgentHarness,
|
|
32
|
+
TelemetryEmitter,
|
|
33
|
+
createConversationStore,
|
|
34
|
+
loadAgentlConfig,
|
|
35
|
+
resolveStateConfig
|
|
36
|
+
} from "@agentl/harness";
|
|
37
|
+
import { Command } from "commander";
|
|
38
|
+
import dotenv from "dotenv";
|
|
39
|
+
import YAML from "yaml";
|
|
40
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
41
|
+
var require2 = createRequire(import.meta.url);
|
|
42
|
+
var writeJson = (response, statusCode, payload) => {
|
|
43
|
+
response.writeHead(statusCode, { "Content-Type": "application/json" });
|
|
44
|
+
response.end(JSON.stringify(payload));
|
|
45
|
+
};
|
|
46
|
+
var writeHtml = (response, statusCode, payload) => {
|
|
47
|
+
response.writeHead(statusCode, { "Content-Type": "text/html; charset=utf-8" });
|
|
48
|
+
response.end(payload);
|
|
49
|
+
};
|
|
50
|
+
var readRequestBody = async (request) => {
|
|
51
|
+
const chunks = [];
|
|
52
|
+
for await (const chunk of request) {
|
|
53
|
+
chunks.push(Buffer.from(chunk));
|
|
54
|
+
}
|
|
55
|
+
const body = Buffer.concat(chunks).toString("utf8");
|
|
56
|
+
return body.length > 0 ? JSON.parse(body) : {};
|
|
57
|
+
};
|
|
58
|
+
var resolveHarnessEnvironment = () => {
|
|
59
|
+
const value = (process.env.AGENTL_ENV ?? process.env.NODE_ENV ?? "development").toLowerCase();
|
|
60
|
+
if (value === "production" || value === "staging") {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
return "development";
|
|
64
|
+
};
|
|
65
|
+
var listenOnAvailablePort = async (server, preferredPort) => await new Promise((resolveListen, rejectListen) => {
|
|
66
|
+
let currentPort = preferredPort;
|
|
67
|
+
const tryListen = () => {
|
|
68
|
+
const onListening = () => {
|
|
69
|
+
server.off("error", onError);
|
|
70
|
+
const address = server.address();
|
|
71
|
+
if (address && typeof address === "object" && typeof address.port === "number") {
|
|
72
|
+
resolveListen(address.port);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
resolveListen(currentPort);
|
|
76
|
+
};
|
|
77
|
+
const onError = (error) => {
|
|
78
|
+
server.off("listening", onListening);
|
|
79
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "EADDRINUSE") {
|
|
80
|
+
currentPort += 1;
|
|
81
|
+
if (currentPort > 65535) {
|
|
82
|
+
rejectListen(
|
|
83
|
+
new Error(
|
|
84
|
+
"No available ports found from the requested port up to 65535."
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
setImmediate(tryListen);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
rejectListen(error);
|
|
93
|
+
};
|
|
94
|
+
server.once("listening", onListening);
|
|
95
|
+
server.once("error", onError);
|
|
96
|
+
server.listen(currentPort);
|
|
97
|
+
};
|
|
98
|
+
tryListen();
|
|
99
|
+
});
|
|
100
|
+
var parseParams = (values) => {
|
|
101
|
+
const params = {};
|
|
102
|
+
for (const value of values) {
|
|
103
|
+
const [key, ...rest] = value.split("=");
|
|
104
|
+
if (!key) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
params[key] = rest.join("=");
|
|
108
|
+
}
|
|
109
|
+
return params;
|
|
110
|
+
};
|
|
111
|
+
var AGENT_SKILL_GUIDANCE = `## Skill Authoring Guidance
|
|
112
|
+
|
|
113
|
+
When asked to create or update a skill:
|
|
114
|
+
|
|
115
|
+
1. Inspect current skills under \`skills/\` first (\`list_directory\`, \`read_file\`).
|
|
116
|
+
2. Decide skill type before writing files:
|
|
117
|
+
- **Instruction skill (no tool code)** for summarization, rewriting, classification, translation, planning, and other pure language tasks.
|
|
118
|
+
- **Tool-backed skill** only when external I/O, deterministic transforms, side effects, or integrations are required.
|
|
119
|
+
3. If creating a tool-backed skill, create/update:
|
|
120
|
+
- \`skills/<skill-name>/SKILL.md\`
|
|
121
|
+
- \`skills/<skill-name>/tools/<tool-name>.ts\`
|
|
122
|
+
4. Keep tool names and schemas explicit and stable.
|
|
123
|
+
5. Never create placeholder tool handlers for tasks the model can already do directly.
|
|
124
|
+
6. After writing files, verify by listing/reading the created paths.
|
|
125
|
+
7. Ask the user to run \`agentl tools\` to confirm the new tool is discovered (when tools were added).
|
|
126
|
+
|
|
127
|
+
Skill file conventions:
|
|
128
|
+
- \`SKILL.md\` frontmatter should include \`name\`, \`description\`, and \`tools\`.
|
|
129
|
+
- Tool modules should export a default tool definition object with:
|
|
130
|
+
- \`name\`
|
|
131
|
+
- \`description\`
|
|
132
|
+
- \`inputSchema\`
|
|
133
|
+
- \`handler\``;
|
|
134
|
+
var AGENT_TEMPLATE = (name, options) => `---
|
|
135
|
+
name: ${name}
|
|
136
|
+
description: A helpful AgentL assistant
|
|
137
|
+
model:
|
|
138
|
+
provider: ${options.modelProvider}
|
|
139
|
+
name: ${options.modelName}
|
|
140
|
+
temperature: 0.2
|
|
141
|
+
limits:
|
|
142
|
+
maxSteps: 50
|
|
143
|
+
timeout: 300
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
# {{name}}
|
|
147
|
+
|
|
148
|
+
You are **{{name}}**, a helpful assistant built with AgentL.
|
|
149
|
+
|
|
150
|
+
Working directory: {{runtime.workingDir}}
|
|
151
|
+
Environment: {{runtime.environment}}
|
|
152
|
+
|
|
153
|
+
## Task Guidance
|
|
154
|
+
|
|
155
|
+
- Use tools when needed
|
|
156
|
+
- Explain your reasoning clearly
|
|
157
|
+
- Ask clarifying questions when requirements are ambiguous
|
|
158
|
+
- Never claim a file/tool change unless the corresponding tool call actually succeeded
|
|
159
|
+
|
|
160
|
+
## Default Capabilities in a Fresh Project
|
|
161
|
+
|
|
162
|
+
- Built-in tools: \`list_directory\` and \`read_file\`
|
|
163
|
+
- \`write_file\` is available in development, and disabled by default in production
|
|
164
|
+
- A starter local skill is included (\`starter-echo\`)
|
|
165
|
+
- Bash/shell commands are **not** available unless you install and enable a shell tool/skill
|
|
166
|
+
- Git operations are only available if a git-capable tool/skill is configured
|
|
167
|
+
|
|
168
|
+
${buildOnboardingFeatureGuidance()}
|
|
169
|
+
|
|
170
|
+
${AGENT_SKILL_GUIDANCE}
|
|
171
|
+
`;
|
|
172
|
+
var resolveLocalPackagesRoot = () => {
|
|
173
|
+
const candidate = resolve(__dirname, "..", "..", "harness", "package.json");
|
|
174
|
+
if (existsSync(candidate)) {
|
|
175
|
+
return resolve(__dirname, "..", "..");
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
};
|
|
179
|
+
var resolveCoreDeps = (projectDir) => {
|
|
180
|
+
const packagesRoot = resolveLocalPackagesRoot();
|
|
181
|
+
if (packagesRoot) {
|
|
182
|
+
const harnessAbs = resolve(packagesRoot, "harness");
|
|
183
|
+
const sdkAbs = resolve(packagesRoot, "sdk");
|
|
184
|
+
return {
|
|
185
|
+
harness: `link:${relative(projectDir, harnessAbs)}`,
|
|
186
|
+
sdk: `link:${relative(projectDir, sdkAbs)}`
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return { harness: "^0.1.0", sdk: "^0.1.0" };
|
|
190
|
+
};
|
|
191
|
+
var PACKAGE_TEMPLATE = (name, projectDir) => {
|
|
192
|
+
const deps = resolveCoreDeps(projectDir);
|
|
193
|
+
return JSON.stringify(
|
|
194
|
+
{
|
|
195
|
+
name,
|
|
196
|
+
private: true,
|
|
197
|
+
type: "module",
|
|
198
|
+
dependencies: {
|
|
199
|
+
"@agentl/harness": deps.harness,
|
|
200
|
+
"@agentl/sdk": deps.sdk
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
null,
|
|
204
|
+
2
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
var README_TEMPLATE = (name) => `# ${name}
|
|
208
|
+
|
|
209
|
+
An AI agent built with [AgentL](https://github.com/latitude-dev/agentl).
|
|
210
|
+
|
|
211
|
+
## Setup
|
|
212
|
+
|
|
213
|
+
\`\`\`bash
|
|
214
|
+
npm install
|
|
215
|
+
cp .env.example .env
|
|
216
|
+
# Edit .env and add your Anthropic API key
|
|
217
|
+
\`\`\`
|
|
218
|
+
|
|
219
|
+
## Development
|
|
220
|
+
|
|
221
|
+
\`\`\`bash
|
|
222
|
+
agentl dev
|
|
223
|
+
\`\`\`
|
|
224
|
+
|
|
225
|
+
Opens a local server at \`http://localhost:3000\` with a chat UI and API.
|
|
226
|
+
|
|
227
|
+
## Usage
|
|
228
|
+
|
|
229
|
+
\`\`\`bash
|
|
230
|
+
# Run a one-off task
|
|
231
|
+
agentl run "Your task here"
|
|
232
|
+
|
|
233
|
+
# Interactive REPL
|
|
234
|
+
agentl run --interactive
|
|
235
|
+
|
|
236
|
+
# Run tests
|
|
237
|
+
agentl test
|
|
238
|
+
\`\`\`
|
|
239
|
+
|
|
240
|
+
## Project Structure
|
|
241
|
+
|
|
242
|
+
\`\`\`
|
|
243
|
+
${name}/
|
|
244
|
+
\u251C\u2500\u2500 AGENT.md # Agent definition and system prompt
|
|
245
|
+
\u251C\u2500\u2500 agentl.config.js # Configuration (MCP servers, auth, etc.)
|
|
246
|
+
\u251C\u2500\u2500 package.json # Dependencies
|
|
247
|
+
\u251C\u2500\u2500 .env.example # Environment variables template
|
|
248
|
+
\u251C\u2500\u2500 tests/
|
|
249
|
+
\u2502 \u2514\u2500\u2500 basic.yaml # Test suite
|
|
250
|
+
\u2514\u2500\u2500 skills/
|
|
251
|
+
\u2514\u2500\u2500 starter/
|
|
252
|
+
\u251C\u2500\u2500 SKILL.md
|
|
253
|
+
\u2514\u2500\u2500 tools/
|
|
254
|
+
\u2514\u2500\u2500 starter-echo.ts
|
|
255
|
+
\`\`\`
|
|
256
|
+
|
|
257
|
+
## Deployment
|
|
258
|
+
|
|
259
|
+
\`\`\`bash
|
|
260
|
+
# Build for Vercel
|
|
261
|
+
agentl build vercel
|
|
262
|
+
cd .agentl-build/vercel && vercel deploy --prod
|
|
263
|
+
|
|
264
|
+
# Build for Docker
|
|
265
|
+
agentl build docker
|
|
266
|
+
docker build -t ${name} .
|
|
267
|
+
\`\`\`
|
|
268
|
+
|
|
269
|
+
See the [AgentL docs](https://github.com/latitude-dev/agentl) for more.
|
|
270
|
+
`;
|
|
271
|
+
var ENV_TEMPLATE = "ANTHROPIC_API_KEY=sk-ant-...\n";
|
|
272
|
+
var GITIGNORE_TEMPLATE = ".env\nnode_modules\ndist\n.agentl-build\n.agentl/\ninteractive-session.json\n";
|
|
273
|
+
var VERCEL_RUNTIME_DEPENDENCIES = {
|
|
274
|
+
"@anthropic-ai/sdk": "^0.74.0",
|
|
275
|
+
"@aws-sdk/client-dynamodb": "^3.988.0",
|
|
276
|
+
"@latitude-data/telemetry": "^2.0.2",
|
|
277
|
+
commander: "^12.0.0",
|
|
278
|
+
dotenv: "^16.4.0",
|
|
279
|
+
jiti: "^2.6.1",
|
|
280
|
+
mustache: "^4.2.0",
|
|
281
|
+
openai: "^6.3.0",
|
|
282
|
+
redis: "^5.10.0",
|
|
283
|
+
ws: "^8.18.0",
|
|
284
|
+
yaml: "^2.8.1"
|
|
285
|
+
};
|
|
286
|
+
var TEST_TEMPLATE = `tests:
|
|
287
|
+
- name: "Basic sanity"
|
|
288
|
+
task: "What is 2 + 2?"
|
|
289
|
+
expect:
|
|
290
|
+
contains: "4"
|
|
291
|
+
`;
|
|
292
|
+
var SKILL_TEMPLATE = `---
|
|
293
|
+
name: starter-skill
|
|
294
|
+
version: 1.0.0
|
|
295
|
+
description: Starter local skill template
|
|
296
|
+
tools:
|
|
297
|
+
- starter-echo
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
# Starter Skill
|
|
301
|
+
|
|
302
|
+
This is a starter local skill created by \`agentl init\`.
|
|
303
|
+
|
|
304
|
+
## Authoring Notes
|
|
305
|
+
|
|
306
|
+
- Keep the \`tools\` frontmatter list in sync with actual tool module names.
|
|
307
|
+
- Prefer narrow, explicit schemas for predictable tool calling.
|
|
308
|
+
- After edits, run \`agentl tools\` to confirm discovery.
|
|
309
|
+
`;
|
|
310
|
+
var SKILL_TOOL_TEMPLATE = `export default {
|
|
311
|
+
name: "starter-echo",
|
|
312
|
+
description: "Echoes a message for testing local skill wiring",
|
|
313
|
+
inputSchema: {
|
|
314
|
+
type: "object",
|
|
315
|
+
properties: {
|
|
316
|
+
message: { type: "string", description: "Message to echo" }
|
|
317
|
+
},
|
|
318
|
+
required: ["message"]
|
|
319
|
+
},
|
|
320
|
+
async handler(input) {
|
|
321
|
+
return { echoed: input.message };
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
`;
|
|
325
|
+
var ensureFile = async (path, content) => {
|
|
326
|
+
await mkdir(dirname(path), { recursive: true });
|
|
327
|
+
await writeFile(path, content, { encoding: "utf8", flag: "wx" });
|
|
328
|
+
};
|
|
329
|
+
var copyIfExists = async (sourcePath, destinationPath) => {
|
|
330
|
+
try {
|
|
331
|
+
await access(sourcePath);
|
|
332
|
+
} catch {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
await mkdir(dirname(destinationPath), { recursive: true });
|
|
336
|
+
await cp(sourcePath, destinationPath, { recursive: true });
|
|
337
|
+
};
|
|
338
|
+
var resolveCliEntrypoint = async () => {
|
|
339
|
+
const sourceEntrypoint = resolve(packageRoot, "src", "index.ts");
|
|
340
|
+
try {
|
|
341
|
+
await access(sourceEntrypoint);
|
|
342
|
+
return sourceEntrypoint;
|
|
343
|
+
} catch {
|
|
344
|
+
return resolve(packageRoot, "dist", "index.js");
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
var buildVercelHandlerBundle = async (outDir) => {
|
|
348
|
+
const { build: esbuild } = await import("esbuild");
|
|
349
|
+
const cliEntrypoint = await resolveCliEntrypoint();
|
|
350
|
+
const tempEntry = resolve(outDir, "api", "_entry.js");
|
|
351
|
+
await writeFile(
|
|
352
|
+
tempEntry,
|
|
353
|
+
`import { createRequestHandler } from ${JSON.stringify(cliEntrypoint)};
|
|
354
|
+
let handlerPromise;
|
|
355
|
+
export default async function handler(req, res) {
|
|
356
|
+
try {
|
|
357
|
+
if (!handlerPromise) {
|
|
358
|
+
handlerPromise = createRequestHandler({ workingDir: process.cwd() });
|
|
359
|
+
}
|
|
360
|
+
const requestHandler = await handlerPromise;
|
|
361
|
+
await requestHandler(req, res);
|
|
362
|
+
} catch (error) {
|
|
363
|
+
console.error("Handler error:", error);
|
|
364
|
+
if (!res.headersSent) {
|
|
365
|
+
res.writeHead(500, { "Content-Type": "application/json" });
|
|
366
|
+
res.end(JSON.stringify({ error: "Internal server error", message: error?.message || "Unknown error" }));
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
`,
|
|
371
|
+
"utf8"
|
|
372
|
+
);
|
|
373
|
+
await esbuild({
|
|
374
|
+
entryPoints: [tempEntry],
|
|
375
|
+
bundle: true,
|
|
376
|
+
platform: "node",
|
|
377
|
+
format: "esm",
|
|
378
|
+
target: "node20",
|
|
379
|
+
outfile: resolve(outDir, "api", "index.js"),
|
|
380
|
+
sourcemap: false,
|
|
381
|
+
legalComments: "none",
|
|
382
|
+
external: [
|
|
383
|
+
...Object.keys(VERCEL_RUNTIME_DEPENDENCIES),
|
|
384
|
+
"@anthropic-ai/sdk/*",
|
|
385
|
+
"child_process",
|
|
386
|
+
"fs",
|
|
387
|
+
"fs/promises",
|
|
388
|
+
"http",
|
|
389
|
+
"https",
|
|
390
|
+
"path",
|
|
391
|
+
"module",
|
|
392
|
+
"url",
|
|
393
|
+
"readline",
|
|
394
|
+
"readline/promises",
|
|
395
|
+
"crypto",
|
|
396
|
+
"stream",
|
|
397
|
+
"events",
|
|
398
|
+
"util",
|
|
399
|
+
"os",
|
|
400
|
+
"zlib",
|
|
401
|
+
"net",
|
|
402
|
+
"tls",
|
|
403
|
+
"dns",
|
|
404
|
+
"assert",
|
|
405
|
+
"buffer",
|
|
406
|
+
"timers",
|
|
407
|
+
"timers/promises",
|
|
408
|
+
"node:child_process",
|
|
409
|
+
"node:fs",
|
|
410
|
+
"node:fs/promises",
|
|
411
|
+
"node:http",
|
|
412
|
+
"node:https",
|
|
413
|
+
"node:path",
|
|
414
|
+
"node:module",
|
|
415
|
+
"node:url",
|
|
416
|
+
"node:readline",
|
|
417
|
+
"node:readline/promises",
|
|
418
|
+
"node:crypto",
|
|
419
|
+
"node:stream",
|
|
420
|
+
"node:events",
|
|
421
|
+
"node:util",
|
|
422
|
+
"node:os",
|
|
423
|
+
"node:zlib",
|
|
424
|
+
"node:net",
|
|
425
|
+
"node:tls",
|
|
426
|
+
"node:dns",
|
|
427
|
+
"node:assert",
|
|
428
|
+
"node:buffer",
|
|
429
|
+
"node:timers",
|
|
430
|
+
"node:timers/promises"
|
|
431
|
+
]
|
|
432
|
+
});
|
|
433
|
+
};
|
|
434
|
+
var renderConfigFile = (config) => `export default ${JSON.stringify(config, null, 2)}
|
|
435
|
+
`;
|
|
436
|
+
var writeConfigFile = async (workingDir, config) => {
|
|
437
|
+
const serialized = renderConfigFile(config);
|
|
438
|
+
await writeFile(resolve(workingDir, "agentl.config.js"), serialized, "utf8");
|
|
439
|
+
};
|
|
440
|
+
var gitInit = (cwd) => new Promise((resolve2) => {
|
|
441
|
+
const child = spawn("git", ["init"], { cwd, stdio: "ignore" });
|
|
442
|
+
child.on("error", () => resolve2(false));
|
|
443
|
+
child.on("close", (code) => resolve2(code === 0));
|
|
444
|
+
});
|
|
445
|
+
var initProject = async (projectName, options) => {
|
|
446
|
+
const baseDir = options?.workingDir ?? process.cwd();
|
|
447
|
+
const projectDir = resolve(baseDir, projectName);
|
|
448
|
+
await mkdir(projectDir, { recursive: true });
|
|
449
|
+
const onboardingOptions = options?.onboarding ?? {
|
|
450
|
+
mode: "light",
|
|
451
|
+
yes: true,
|
|
452
|
+
interactive: false
|
|
453
|
+
};
|
|
454
|
+
const onboarding = await runInitOnboarding(onboardingOptions);
|
|
455
|
+
await ensureFile(
|
|
456
|
+
resolve(projectDir, "AGENT.md"),
|
|
457
|
+
AGENT_TEMPLATE(projectName, {
|
|
458
|
+
modelProvider: onboarding.agentModel.provider,
|
|
459
|
+
modelName: onboarding.agentModel.name
|
|
460
|
+
})
|
|
461
|
+
);
|
|
462
|
+
await ensureFile(resolve(projectDir, "agentl.config.js"), renderConfigFile(onboarding.config));
|
|
463
|
+
await ensureFile(resolve(projectDir, "package.json"), PACKAGE_TEMPLATE(projectName, projectDir));
|
|
464
|
+
await ensureFile(resolve(projectDir, "README.md"), README_TEMPLATE(projectName));
|
|
465
|
+
await ensureFile(
|
|
466
|
+
resolve(projectDir, ".env.example"),
|
|
467
|
+
options?.envExampleOverride ?? onboarding.envExample ?? ENV_TEMPLATE
|
|
468
|
+
);
|
|
469
|
+
await ensureFile(resolve(projectDir, ".gitignore"), GITIGNORE_TEMPLATE);
|
|
470
|
+
await ensureFile(resolve(projectDir, "tests", "basic.yaml"), TEST_TEMPLATE);
|
|
471
|
+
await ensureFile(resolve(projectDir, "skills", "starter", "SKILL.md"), SKILL_TEMPLATE);
|
|
472
|
+
await ensureFile(
|
|
473
|
+
resolve(projectDir, "skills", "starter", "tools", "starter-echo.ts"),
|
|
474
|
+
SKILL_TOOL_TEMPLATE
|
|
475
|
+
);
|
|
476
|
+
await initializeOnboardingMarker(projectDir, {
|
|
477
|
+
allowIntro: !(onboardingOptions.yes ?? false) && isDefaultOnboardingConfig(onboarding.config)
|
|
478
|
+
});
|
|
479
|
+
try {
|
|
480
|
+
await runPnpmInstall(projectDir);
|
|
481
|
+
} catch {
|
|
482
|
+
process.stdout.write(
|
|
483
|
+
"Warning: could not install dependencies. Run `pnpm install` manually.\n"
|
|
484
|
+
);
|
|
485
|
+
}
|
|
486
|
+
const gitOk = await gitInit(projectDir);
|
|
487
|
+
if (gitOk) {
|
|
488
|
+
process.stdout.write(`Initialized git repository
|
|
489
|
+
`);
|
|
490
|
+
}
|
|
491
|
+
process.stdout.write(`Initialized AgentL project at ${projectDir}
|
|
492
|
+
`);
|
|
493
|
+
process.stdout.write(
|
|
494
|
+
"First run:\n- agentl dev (web UI) or agentl run --interactive (CLI)\n"
|
|
495
|
+
);
|
|
496
|
+
process.stdout.write(
|
|
497
|
+
"On first interactive session, the agent introduces available features and how to configure them by chat.\n"
|
|
498
|
+
);
|
|
499
|
+
};
|
|
500
|
+
var updateAgentGuidance = async (workingDir) => {
|
|
501
|
+
const agentPath = resolve(workingDir, "AGENT.md");
|
|
502
|
+
const content = await readFile(agentPath, "utf8");
|
|
503
|
+
const guidanceSectionPattern = /## Skill Authoring Guidance[\s\S]*?(?=\n## |\n# |$)/;
|
|
504
|
+
const normalized = content.replace(/\s+$/g, "");
|
|
505
|
+
const hasGuidance = guidanceSectionPattern.test(normalized);
|
|
506
|
+
const updated = hasGuidance ? normalized.replace(guidanceSectionPattern, AGENT_SKILL_GUIDANCE) : `${normalized}
|
|
507
|
+
|
|
508
|
+
${AGENT_SKILL_GUIDANCE}
|
|
509
|
+
`;
|
|
510
|
+
if (updated === normalized) {
|
|
511
|
+
process.stdout.write("AGENT.md guidance is already up to date.\n");
|
|
512
|
+
return false;
|
|
513
|
+
}
|
|
514
|
+
await writeFile(agentPath, updated, "utf8");
|
|
515
|
+
process.stdout.write("Updated AGENT.md with latest skill authoring guidance.\n");
|
|
516
|
+
return true;
|
|
517
|
+
};
|
|
518
|
+
var formatSseEvent = (event) => `event: ${event.type}
|
|
519
|
+
data: ${JSON.stringify(event)}
|
|
520
|
+
|
|
521
|
+
`;
|
|
522
|
+
var createRequestHandler = async (options) => {
|
|
523
|
+
const workingDir = options?.workingDir ?? process.cwd();
|
|
524
|
+
dotenv.config({ path: resolve(workingDir, ".env") });
|
|
525
|
+
const config = await loadAgentlConfig(workingDir);
|
|
526
|
+
let agentName = "Agent";
|
|
527
|
+
let agentModelProvider = "anthropic";
|
|
528
|
+
let agentModelName = "claude-opus-4-5";
|
|
529
|
+
try {
|
|
530
|
+
const agentMd = await readFile(resolve(workingDir, "AGENT.md"), "utf8");
|
|
531
|
+
const nameMatch = agentMd.match(/^name:\s*(.+)$/m);
|
|
532
|
+
const providerMatch = agentMd.match(/^\s{2}provider:\s*(.+)$/m);
|
|
533
|
+
const modelMatch = agentMd.match(/^\s{2}name:\s*(.+)$/m);
|
|
534
|
+
if (nameMatch?.[1]) {
|
|
535
|
+
agentName = nameMatch[1].trim().replace(/^["']|["']$/g, "");
|
|
536
|
+
}
|
|
537
|
+
if (providerMatch?.[1]) {
|
|
538
|
+
agentModelProvider = providerMatch[1].trim().replace(/^["']|["']$/g, "");
|
|
539
|
+
}
|
|
540
|
+
if (modelMatch?.[1]) {
|
|
541
|
+
agentModelName = modelMatch[1].trim().replace(/^["']|["']$/g, "");
|
|
542
|
+
}
|
|
543
|
+
} catch {
|
|
544
|
+
}
|
|
545
|
+
const harness = new AgentHarness({ workingDir });
|
|
546
|
+
await harness.initialize();
|
|
547
|
+
const telemetry = new TelemetryEmitter(config?.telemetry);
|
|
548
|
+
const conversationStore = createConversationStore(resolveStateConfig(config), { workingDir });
|
|
549
|
+
const sessionStore = new SessionStore();
|
|
550
|
+
const loginRateLimiter = new LoginRateLimiter();
|
|
551
|
+
const passphrase = process.env.AGENT_UI_PASSPHRASE ?? "";
|
|
552
|
+
const isProduction = resolveHarnessEnvironment() === "production";
|
|
553
|
+
const requireUiAuth = passphrase.length > 0;
|
|
554
|
+
const secureCookies = isProduction;
|
|
555
|
+
return async (request, response) => {
|
|
556
|
+
if (!request.url || !request.method) {
|
|
557
|
+
writeJson(response, 404, { error: "Not found" });
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
const [pathname] = request.url.split("?");
|
|
561
|
+
if (request.method === "GET" && (pathname === "/" || pathname.startsWith("/c/"))) {
|
|
562
|
+
writeHtml(response, 200, renderWebUiHtml({ agentName }));
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (pathname === "/manifest.json" && request.method === "GET") {
|
|
566
|
+
response.writeHead(200, { "Content-Type": "application/manifest+json" });
|
|
567
|
+
response.end(renderManifest({ agentName }));
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
if (pathname === "/sw.js" && request.method === "GET") {
|
|
571
|
+
response.writeHead(200, {
|
|
572
|
+
"Content-Type": "application/javascript",
|
|
573
|
+
"Service-Worker-Allowed": "/"
|
|
574
|
+
});
|
|
575
|
+
response.end(renderServiceWorker());
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
if (pathname === "/icon.svg" && request.method === "GET") {
|
|
579
|
+
response.writeHead(200, { "Content-Type": "image/svg+xml" });
|
|
580
|
+
response.end(renderIconSvg({ agentName }));
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
if ((pathname === "/icon-192.png" || pathname === "/icon-512.png") && request.method === "GET") {
|
|
584
|
+
response.writeHead(302, { Location: "/icon.svg" });
|
|
585
|
+
response.end();
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
if (pathname === "/health" && request.method === "GET") {
|
|
589
|
+
writeJson(response, 200, { status: "ok" });
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
const cookies = parseCookies(request);
|
|
593
|
+
const sessionId = cookies.agentl_session;
|
|
594
|
+
const session = sessionId ? sessionStore.get(sessionId) : void 0;
|
|
595
|
+
const ownerId = session?.ownerId ?? "local-owner";
|
|
596
|
+
const requiresCsrfValidation = request.method !== "GET" && request.method !== "HEAD" && request.method !== "OPTIONS";
|
|
597
|
+
if (pathname === "/api/auth/session" && request.method === "GET") {
|
|
598
|
+
if (!requireUiAuth) {
|
|
599
|
+
writeJson(response, 200, { authenticated: true, csrfToken: "" });
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (!session) {
|
|
603
|
+
writeJson(response, 200, { authenticated: false });
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
writeJson(response, 200, {
|
|
607
|
+
authenticated: true,
|
|
608
|
+
sessionId: session.sessionId,
|
|
609
|
+
ownerId: session.ownerId,
|
|
610
|
+
csrfToken: session.csrfToken
|
|
611
|
+
});
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
if (pathname === "/api/auth/login" && request.method === "POST") {
|
|
615
|
+
if (!requireUiAuth) {
|
|
616
|
+
writeJson(response, 200, { authenticated: true, csrfToken: "" });
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
const ip = getRequestIp(request);
|
|
620
|
+
const canAttempt = loginRateLimiter.canAttempt(ip);
|
|
621
|
+
if (!canAttempt.allowed) {
|
|
622
|
+
writeJson(response, 429, {
|
|
623
|
+
code: "AUTH_RATE_LIMIT",
|
|
624
|
+
message: "Too many failed login attempts. Try again later.",
|
|
625
|
+
retryAfterSeconds: canAttempt.retryAfterSeconds
|
|
626
|
+
});
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
const body = await readRequestBody(request);
|
|
630
|
+
const provided = body.passphrase ?? "";
|
|
631
|
+
if (!verifyPassphrase(provided, passphrase)) {
|
|
632
|
+
const failure = loginRateLimiter.registerFailure(ip);
|
|
633
|
+
writeJson(response, 401, {
|
|
634
|
+
code: "AUTH_ERROR",
|
|
635
|
+
message: "Invalid passphrase",
|
|
636
|
+
retryAfterSeconds: failure.retryAfterSeconds
|
|
637
|
+
});
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
loginRateLimiter.registerSuccess(ip);
|
|
641
|
+
const createdSession = sessionStore.create(ownerId);
|
|
642
|
+
setCookie(response, "agentl_session", createdSession.sessionId, {
|
|
643
|
+
httpOnly: true,
|
|
644
|
+
secure: secureCookies,
|
|
645
|
+
sameSite: "Lax",
|
|
646
|
+
path: "/",
|
|
647
|
+
maxAge: 60 * 60 * 8
|
|
648
|
+
});
|
|
649
|
+
writeJson(response, 200, {
|
|
650
|
+
authenticated: true,
|
|
651
|
+
csrfToken: createdSession.csrfToken
|
|
652
|
+
});
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
if (pathname === "/api/auth/logout" && request.method === "POST") {
|
|
656
|
+
if (session?.sessionId) {
|
|
657
|
+
sessionStore.delete(session.sessionId);
|
|
658
|
+
}
|
|
659
|
+
setCookie(response, "agentl_session", "", {
|
|
660
|
+
httpOnly: true,
|
|
661
|
+
secure: secureCookies,
|
|
662
|
+
sameSite: "Lax",
|
|
663
|
+
path: "/",
|
|
664
|
+
maxAge: 0
|
|
665
|
+
});
|
|
666
|
+
writeJson(response, 200, { ok: true });
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
if (pathname.startsWith("/api/")) {
|
|
670
|
+
if (requireUiAuth && !session) {
|
|
671
|
+
writeJson(response, 401, {
|
|
672
|
+
code: "AUTH_ERROR",
|
|
673
|
+
message: "Authentication required"
|
|
674
|
+
});
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (requireUiAuth && requiresCsrfValidation && pathname !== "/api/auth/login" && request.headers["x-csrf-token"] !== session?.csrfToken) {
|
|
678
|
+
writeJson(response, 403, {
|
|
679
|
+
code: "CSRF_ERROR",
|
|
680
|
+
message: "Invalid CSRF token"
|
|
681
|
+
});
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
if (pathname === "/api/conversations" && request.method === "GET") {
|
|
686
|
+
const conversations = await conversationStore.list(ownerId);
|
|
687
|
+
writeJson(response, 200, {
|
|
688
|
+
conversations: conversations.map((conversation) => ({
|
|
689
|
+
conversationId: conversation.conversationId,
|
|
690
|
+
title: conversation.title,
|
|
691
|
+
runtimeRunId: conversation.runtimeRunId,
|
|
692
|
+
ownerId: conversation.ownerId,
|
|
693
|
+
tenantId: conversation.tenantId,
|
|
694
|
+
createdAt: conversation.createdAt,
|
|
695
|
+
updatedAt: conversation.updatedAt,
|
|
696
|
+
messageCount: conversation.messages.length
|
|
697
|
+
}))
|
|
698
|
+
});
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
if (pathname === "/api/conversations" && request.method === "POST") {
|
|
702
|
+
const body = await readRequestBody(request);
|
|
703
|
+
const conversation = await conversationStore.create(ownerId, body.title);
|
|
704
|
+
const introMessage = await consumeFirstRunIntro(workingDir, {
|
|
705
|
+
agentName,
|
|
706
|
+
provider: agentModelProvider,
|
|
707
|
+
model: agentModelName,
|
|
708
|
+
config
|
|
709
|
+
});
|
|
710
|
+
if (introMessage) {
|
|
711
|
+
conversation.messages = [{ role: "assistant", content: introMessage }];
|
|
712
|
+
await conversationStore.update(conversation);
|
|
713
|
+
}
|
|
714
|
+
writeJson(response, 201, { conversation });
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
const conversationPathMatch = pathname.match(/^\/api\/conversations\/([^/]+)$/);
|
|
718
|
+
if (conversationPathMatch) {
|
|
719
|
+
const conversationId = decodeURIComponent(conversationPathMatch[1] ?? "");
|
|
720
|
+
const conversation = await conversationStore.get(conversationId);
|
|
721
|
+
if (!conversation || conversation.ownerId !== ownerId) {
|
|
722
|
+
writeJson(response, 404, {
|
|
723
|
+
code: "CONVERSATION_NOT_FOUND",
|
|
724
|
+
message: "Conversation not found"
|
|
725
|
+
});
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
if (request.method === "GET") {
|
|
729
|
+
writeJson(response, 200, { conversation });
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
if (request.method === "PATCH") {
|
|
733
|
+
const body = await readRequestBody(request);
|
|
734
|
+
if (!body.title || body.title.trim().length === 0) {
|
|
735
|
+
writeJson(response, 400, {
|
|
736
|
+
code: "VALIDATION_ERROR",
|
|
737
|
+
message: "title is required"
|
|
738
|
+
});
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
const updated = await conversationStore.rename(conversationId, body.title);
|
|
742
|
+
writeJson(response, 200, { conversation: updated });
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
if (request.method === "DELETE") {
|
|
746
|
+
await conversationStore.delete(conversationId);
|
|
747
|
+
writeJson(response, 200, { ok: true });
|
|
748
|
+
return;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
const conversationMessageMatch = pathname.match(/^\/api\/conversations\/([^/]+)\/messages$/);
|
|
752
|
+
if (conversationMessageMatch && request.method === "POST") {
|
|
753
|
+
const conversationId = decodeURIComponent(conversationMessageMatch[1] ?? "");
|
|
754
|
+
const conversation = await conversationStore.get(conversationId);
|
|
755
|
+
if (!conversation || conversation.ownerId !== ownerId) {
|
|
756
|
+
writeJson(response, 404, {
|
|
757
|
+
code: "CONVERSATION_NOT_FOUND",
|
|
758
|
+
message: "Conversation not found"
|
|
759
|
+
});
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
const body = await readRequestBody(request);
|
|
763
|
+
const messageText = body.message?.trim() ?? "";
|
|
764
|
+
if (!messageText) {
|
|
765
|
+
writeJson(response, 400, {
|
|
766
|
+
code: "VALIDATION_ERROR",
|
|
767
|
+
message: "message is required"
|
|
768
|
+
});
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
if (conversation.messages.length === 0 && (conversation.title === "New conversation" || conversation.title.trim().length === 0)) {
|
|
772
|
+
conversation.title = inferConversationTitle(messageText);
|
|
773
|
+
}
|
|
774
|
+
response.writeHead(200, {
|
|
775
|
+
"Content-Type": "text/event-stream",
|
|
776
|
+
"Cache-Control": "no-cache",
|
|
777
|
+
Connection: "keep-alive"
|
|
778
|
+
});
|
|
779
|
+
let latestRunId = conversation.runtimeRunId ?? "";
|
|
780
|
+
let assistantResponse = "";
|
|
781
|
+
const toolTimeline = [];
|
|
782
|
+
try {
|
|
783
|
+
const recallCorpus = (await conversationStore.list(ownerId)).filter((item) => item.conversationId !== conversationId).slice(0, 20).map((item) => ({
|
|
784
|
+
conversationId: item.conversationId,
|
|
785
|
+
title: item.title,
|
|
786
|
+
updatedAt: item.updatedAt,
|
|
787
|
+
content: item.messages.slice(-6).map((message) => `${message.role}: ${message.content}`).join("\n").slice(0, 2e3)
|
|
788
|
+
})).filter((item) => item.content.length > 0);
|
|
789
|
+
for await (const event of harness.run({
|
|
790
|
+
task: messageText,
|
|
791
|
+
parameters: {
|
|
792
|
+
...body.parameters ?? {},
|
|
793
|
+
__conversationRecallCorpus: recallCorpus,
|
|
794
|
+
__activeConversationId: conversationId
|
|
795
|
+
},
|
|
796
|
+
messages: conversation.messages
|
|
797
|
+
})) {
|
|
798
|
+
if (event.type === "run:started") {
|
|
799
|
+
latestRunId = event.runId;
|
|
800
|
+
}
|
|
801
|
+
if (event.type === "model:chunk") {
|
|
802
|
+
assistantResponse += event.content;
|
|
803
|
+
}
|
|
804
|
+
if (event.type === "tool:started") {
|
|
805
|
+
toolTimeline.push(`- start \`${event.tool}\``);
|
|
806
|
+
}
|
|
807
|
+
if (event.type === "tool:completed") {
|
|
808
|
+
toolTimeline.push(`- done \`${event.tool}\` (${event.duration}ms)`);
|
|
809
|
+
}
|
|
810
|
+
if (event.type === "tool:error") {
|
|
811
|
+
toolTimeline.push(`- error \`${event.tool}\`: ${event.error}`);
|
|
812
|
+
}
|
|
813
|
+
if (event.type === "tool:approval:required") {
|
|
814
|
+
toolTimeline.push(`- approval required \`${event.tool}\``);
|
|
815
|
+
}
|
|
816
|
+
if (event.type === "tool:approval:granted") {
|
|
817
|
+
toolTimeline.push(`- approval granted (${event.approvalId})`);
|
|
818
|
+
}
|
|
819
|
+
if (event.type === "tool:approval:denied") {
|
|
820
|
+
toolTimeline.push(`- approval denied (${event.approvalId})`);
|
|
821
|
+
}
|
|
822
|
+
if (event.type === "run:completed" && assistantResponse.length === 0 && event.result.response) {
|
|
823
|
+
assistantResponse = event.result.response;
|
|
824
|
+
}
|
|
825
|
+
await telemetry.emit(event);
|
|
826
|
+
response.write(formatSseEvent(event));
|
|
827
|
+
}
|
|
828
|
+
conversation.messages = [
|
|
829
|
+
...conversation.messages,
|
|
830
|
+
{ role: "user", content: messageText },
|
|
831
|
+
{
|
|
832
|
+
role: "assistant",
|
|
833
|
+
content: assistantResponse,
|
|
834
|
+
metadata: toolTimeline.length > 0 ? { toolActivity: toolTimeline } : void 0
|
|
835
|
+
}
|
|
836
|
+
];
|
|
837
|
+
conversation.runtimeRunId = latestRunId || conversation.runtimeRunId;
|
|
838
|
+
conversation.updatedAt = Date.now();
|
|
839
|
+
await conversationStore.update(conversation);
|
|
840
|
+
} catch (error) {
|
|
841
|
+
response.write(
|
|
842
|
+
formatSseEvent({
|
|
843
|
+
type: "run:error",
|
|
844
|
+
runId: latestRunId || "run_unknown",
|
|
845
|
+
error: {
|
|
846
|
+
code: "RUN_ERROR",
|
|
847
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
848
|
+
}
|
|
849
|
+
})
|
|
850
|
+
);
|
|
851
|
+
} finally {
|
|
852
|
+
response.end();
|
|
853
|
+
}
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
writeJson(response, 404, { error: "Not found" });
|
|
857
|
+
};
|
|
858
|
+
};
|
|
859
|
+
var startDevServer = async (port, options) => {
|
|
860
|
+
const handler = await createRequestHandler(options);
|
|
861
|
+
const server = createServer(handler);
|
|
862
|
+
const actualPort = await listenOnAvailablePort(server, port);
|
|
863
|
+
if (actualPort !== port) {
|
|
864
|
+
process.stdout.write(`Port ${port} is in use, switched to ${actualPort}.
|
|
865
|
+
`);
|
|
866
|
+
}
|
|
867
|
+
process.stdout.write(`AgentL dev server running at http://localhost:${actualPort}
|
|
868
|
+
`);
|
|
869
|
+
const shutdown = () => {
|
|
870
|
+
server.close();
|
|
871
|
+
server.closeAllConnections?.();
|
|
872
|
+
process.exit(0);
|
|
873
|
+
};
|
|
874
|
+
process.on("SIGINT", shutdown);
|
|
875
|
+
process.on("SIGTERM", shutdown);
|
|
876
|
+
return server;
|
|
877
|
+
};
|
|
878
|
+
var runOnce = async (task, options) => {
|
|
879
|
+
const workingDir = options.workingDir ?? process.cwd();
|
|
880
|
+
dotenv.config({ path: resolve(workingDir, ".env") });
|
|
881
|
+
const config = await loadAgentlConfig(workingDir);
|
|
882
|
+
const harness = new AgentHarness({ workingDir });
|
|
883
|
+
const telemetry = new TelemetryEmitter(config?.telemetry);
|
|
884
|
+
await harness.initialize();
|
|
885
|
+
const fileBlobs = await Promise.all(
|
|
886
|
+
options.filePaths.map(async (path) => {
|
|
887
|
+
const content = await readFile(resolve(workingDir, path), "utf8");
|
|
888
|
+
return `# File: ${path}
|
|
889
|
+
${content}`;
|
|
890
|
+
})
|
|
891
|
+
);
|
|
892
|
+
const input = {
|
|
893
|
+
task: fileBlobs.length > 0 ? `${task}
|
|
894
|
+
|
|
895
|
+
${fileBlobs.join("\n\n")}` : task,
|
|
896
|
+
parameters: options.params
|
|
897
|
+
};
|
|
898
|
+
if (options.json) {
|
|
899
|
+
const output = await harness.runToCompletion(input);
|
|
900
|
+
for (const event of output.events) {
|
|
901
|
+
await telemetry.emit(event);
|
|
902
|
+
}
|
|
903
|
+
process.stdout.write(`${JSON.stringify(output, null, 2)}
|
|
904
|
+
`);
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
for await (const event of harness.run(input)) {
|
|
908
|
+
await telemetry.emit(event);
|
|
909
|
+
if (event.type === "model:chunk") {
|
|
910
|
+
process.stdout.write(event.content);
|
|
911
|
+
}
|
|
912
|
+
if (event.type === "run:error") {
|
|
913
|
+
process.stderr.write(`
|
|
914
|
+
Error: ${event.error.message}
|
|
915
|
+
`);
|
|
916
|
+
}
|
|
917
|
+
if (event.type === "run:completed") {
|
|
918
|
+
process.stdout.write("\n");
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
var runInteractive = async (workingDir, params) => {
|
|
923
|
+
dotenv.config({ path: resolve(workingDir, ".env") });
|
|
924
|
+
const config = await loadAgentlConfig(workingDir);
|
|
925
|
+
let pendingApproval = null;
|
|
926
|
+
let onApprovalRequest = null;
|
|
927
|
+
const approvalHandler = async (request) => {
|
|
928
|
+
return new Promise((resolveApproval) => {
|
|
929
|
+
const req = {
|
|
930
|
+
tool: request.tool,
|
|
931
|
+
input: request.input,
|
|
932
|
+
approvalId: request.approvalId,
|
|
933
|
+
resolve: resolveApproval
|
|
934
|
+
};
|
|
935
|
+
pendingApproval = req;
|
|
936
|
+
if (onApprovalRequest) {
|
|
937
|
+
onApprovalRequest(req);
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
};
|
|
941
|
+
const harness = new AgentHarness({
|
|
942
|
+
workingDir,
|
|
943
|
+
environment: resolveHarnessEnvironment(),
|
|
944
|
+
approvalHandler
|
|
945
|
+
});
|
|
946
|
+
await harness.initialize();
|
|
947
|
+
try {
|
|
948
|
+
const { runInteractiveInk } = await import("./run-interactive-ink-BC6RGDCH.js");
|
|
949
|
+
await runInteractiveInk({
|
|
950
|
+
harness,
|
|
951
|
+
params,
|
|
952
|
+
workingDir,
|
|
953
|
+
config,
|
|
954
|
+
conversationStore: createConversationStore(resolveStateConfig(config), { workingDir }),
|
|
955
|
+
onSetApprovalCallback: (cb) => {
|
|
956
|
+
onApprovalRequest = cb;
|
|
957
|
+
if (pendingApproval) {
|
|
958
|
+
cb(pendingApproval);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
} finally {
|
|
963
|
+
await harness.shutdown();
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
var listTools = async (workingDir) => {
|
|
967
|
+
dotenv.config({ path: resolve(workingDir, ".env") });
|
|
968
|
+
const harness = new AgentHarness({ workingDir });
|
|
969
|
+
await harness.initialize();
|
|
970
|
+
const tools = harness.listTools();
|
|
971
|
+
if (tools.length === 0) {
|
|
972
|
+
process.stdout.write("No tools registered.\n");
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
process.stdout.write("Available tools:\n");
|
|
976
|
+
for (const tool of tools) {
|
|
977
|
+
process.stdout.write(`- ${tool.name}: ${tool.description}
|
|
978
|
+
`);
|
|
979
|
+
}
|
|
980
|
+
};
|
|
981
|
+
var runPnpmInstall = async (workingDir) => await new Promise((resolveInstall, rejectInstall) => {
|
|
982
|
+
const child = spawn("pnpm", ["install"], {
|
|
983
|
+
cwd: workingDir,
|
|
984
|
+
stdio: "inherit",
|
|
985
|
+
env: process.env
|
|
986
|
+
});
|
|
987
|
+
child.on("exit", (code) => {
|
|
988
|
+
if (code === 0) {
|
|
989
|
+
resolveInstall();
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
rejectInstall(new Error(`pnpm install failed with exit code ${code ?? -1}`));
|
|
993
|
+
});
|
|
994
|
+
});
|
|
995
|
+
var runInstallCommand = async (workingDir, packageNameOrPath) => await new Promise((resolveInstall, rejectInstall) => {
|
|
996
|
+
const child = spawn("pnpm", ["add", packageNameOrPath], {
|
|
997
|
+
cwd: workingDir,
|
|
998
|
+
stdio: "inherit",
|
|
999
|
+
env: process.env
|
|
1000
|
+
});
|
|
1001
|
+
child.on("exit", (code) => {
|
|
1002
|
+
if (code === 0) {
|
|
1003
|
+
resolveInstall();
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
rejectInstall(new Error(`pnpm add failed with exit code ${code ?? -1}`));
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
var resolveInstalledPackageName = (packageNameOrPath) => {
|
|
1010
|
+
if (packageNameOrPath.startsWith(".") || packageNameOrPath.startsWith("/")) {
|
|
1011
|
+
return null;
|
|
1012
|
+
}
|
|
1013
|
+
if (packageNameOrPath.startsWith("@")) {
|
|
1014
|
+
return packageNameOrPath;
|
|
1015
|
+
}
|
|
1016
|
+
if (packageNameOrPath.includes("/")) {
|
|
1017
|
+
return packageNameOrPath.split("/").pop() ?? packageNameOrPath;
|
|
1018
|
+
}
|
|
1019
|
+
return packageNameOrPath;
|
|
1020
|
+
};
|
|
1021
|
+
var resolveSkillRoot = (workingDir, packageNameOrPath) => {
|
|
1022
|
+
if (packageNameOrPath.startsWith(".") || packageNameOrPath.startsWith("/")) {
|
|
1023
|
+
return resolve(workingDir, packageNameOrPath);
|
|
1024
|
+
}
|
|
1025
|
+
const moduleName = resolveInstalledPackageName(packageNameOrPath) ?? packageNameOrPath;
|
|
1026
|
+
try {
|
|
1027
|
+
const packageJsonPath = require2.resolve(`${moduleName}/package.json`, {
|
|
1028
|
+
paths: [workingDir]
|
|
1029
|
+
});
|
|
1030
|
+
return resolve(packageJsonPath, "..");
|
|
1031
|
+
} catch {
|
|
1032
|
+
const candidate = resolve(workingDir, "node_modules", moduleName);
|
|
1033
|
+
if (existsSync(candidate)) {
|
|
1034
|
+
return candidate;
|
|
1035
|
+
}
|
|
1036
|
+
throw new Error(
|
|
1037
|
+
`Could not locate installed package "${moduleName}" in ${workingDir}`
|
|
1038
|
+
);
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
var findSkillManifest = async (dir, depth = 2) => {
|
|
1042
|
+
try {
|
|
1043
|
+
await access(resolve(dir, "SKILL.md"));
|
|
1044
|
+
return true;
|
|
1045
|
+
} catch {
|
|
1046
|
+
}
|
|
1047
|
+
if (depth <= 0) return false;
|
|
1048
|
+
try {
|
|
1049
|
+
const { readdir } = await import("fs/promises");
|
|
1050
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
1051
|
+
for (const entry of entries) {
|
|
1052
|
+
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
1053
|
+
const found = await findSkillManifest(resolve(dir, entry.name), depth - 1);
|
|
1054
|
+
if (found) return true;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
} catch {
|
|
1058
|
+
}
|
|
1059
|
+
return false;
|
|
1060
|
+
};
|
|
1061
|
+
var validateSkillPackage = async (workingDir, packageNameOrPath) => {
|
|
1062
|
+
const skillRoot = resolveSkillRoot(workingDir, packageNameOrPath);
|
|
1063
|
+
const hasSkill = await findSkillManifest(skillRoot);
|
|
1064
|
+
if (!hasSkill) {
|
|
1065
|
+
throw new Error(`Skill validation failed: no SKILL.md found in ${skillRoot}`);
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
var addSkill = async (workingDir, packageNameOrPath) => {
|
|
1069
|
+
await runInstallCommand(workingDir, packageNameOrPath);
|
|
1070
|
+
await validateSkillPackage(workingDir, packageNameOrPath);
|
|
1071
|
+
process.stdout.write(`Added skill: ${packageNameOrPath}
|
|
1072
|
+
`);
|
|
1073
|
+
};
|
|
1074
|
+
var runTests = async (workingDir, filePath) => {
|
|
1075
|
+
dotenv.config({ path: resolve(workingDir, ".env") });
|
|
1076
|
+
const testFilePath = filePath ?? resolve(workingDir, "tests", "basic.yaml");
|
|
1077
|
+
const content = await readFile(testFilePath, "utf8");
|
|
1078
|
+
const parsed = YAML.parse(content);
|
|
1079
|
+
const tests = parsed.tests ?? [];
|
|
1080
|
+
const harness = new AgentHarness({ workingDir });
|
|
1081
|
+
await harness.initialize();
|
|
1082
|
+
let passed = 0;
|
|
1083
|
+
let failed = 0;
|
|
1084
|
+
for (const testCase of tests) {
|
|
1085
|
+
try {
|
|
1086
|
+
const output = await harness.runToCompletion({ task: testCase.task });
|
|
1087
|
+
const response = output.result.response ?? "";
|
|
1088
|
+
const events = output.events;
|
|
1089
|
+
const expectation = testCase.expect ?? {};
|
|
1090
|
+
const checks = [];
|
|
1091
|
+
if (expectation.contains) {
|
|
1092
|
+
checks.push(response.includes(expectation.contains));
|
|
1093
|
+
}
|
|
1094
|
+
if (typeof expectation.maxSteps === "number") {
|
|
1095
|
+
checks.push(output.result.steps <= expectation.maxSteps);
|
|
1096
|
+
}
|
|
1097
|
+
if (typeof expectation.maxTokens === "number") {
|
|
1098
|
+
checks.push(
|
|
1099
|
+
output.result.tokens.input + output.result.tokens.output <= expectation.maxTokens
|
|
1100
|
+
);
|
|
1101
|
+
}
|
|
1102
|
+
if (expectation.refusal) {
|
|
1103
|
+
checks.push(
|
|
1104
|
+
response.toLowerCase().includes("can't") || response.toLowerCase().includes("cannot")
|
|
1105
|
+
);
|
|
1106
|
+
}
|
|
1107
|
+
if (expectation.toolCalled) {
|
|
1108
|
+
checks.push(
|
|
1109
|
+
events.some(
|
|
1110
|
+
(event) => event.type === "tool:started" && event.tool === expectation.toolCalled
|
|
1111
|
+
)
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1114
|
+
const ok = checks.length === 0 ? output.result.status === "completed" : checks.every(Boolean);
|
|
1115
|
+
if (ok) {
|
|
1116
|
+
passed += 1;
|
|
1117
|
+
process.stdout.write(`PASS ${testCase.name}
|
|
1118
|
+
`);
|
|
1119
|
+
} else {
|
|
1120
|
+
failed += 1;
|
|
1121
|
+
process.stdout.write(`FAIL ${testCase.name}
|
|
1122
|
+
`);
|
|
1123
|
+
}
|
|
1124
|
+
} catch (error) {
|
|
1125
|
+
failed += 1;
|
|
1126
|
+
process.stdout.write(
|
|
1127
|
+
`FAIL ${testCase.name} (${error instanceof Error ? error.message : "Unknown test error"})
|
|
1128
|
+
`
|
|
1129
|
+
);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
process.stdout.write(`
|
|
1133
|
+
Test summary: ${passed} passed, ${failed} failed
|
|
1134
|
+
`);
|
|
1135
|
+
return { passed, failed };
|
|
1136
|
+
};
|
|
1137
|
+
var buildTarget = async (workingDir, target) => {
|
|
1138
|
+
const outDir = resolve(workingDir, ".agentl-build", target);
|
|
1139
|
+
await mkdir(outDir, { recursive: true });
|
|
1140
|
+
const serverEntrypoint = `import { startDevServer } from "agentl";
|
|
1141
|
+
|
|
1142
|
+
const port = Number.parseInt(process.env.PORT ?? "3000", 10);
|
|
1143
|
+
await startDevServer(Number.isNaN(port) ? 3000 : port, { workingDir: process.cwd() });
|
|
1144
|
+
`;
|
|
1145
|
+
const runtimePackageJson = JSON.stringify(
|
|
1146
|
+
{
|
|
1147
|
+
name: "agentl-runtime-bundle",
|
|
1148
|
+
private: true,
|
|
1149
|
+
type: "module",
|
|
1150
|
+
scripts: {
|
|
1151
|
+
start: "node server.js"
|
|
1152
|
+
},
|
|
1153
|
+
dependencies: {
|
|
1154
|
+
agentl: "^0.1.0"
|
|
1155
|
+
}
|
|
1156
|
+
},
|
|
1157
|
+
null,
|
|
1158
|
+
2
|
|
1159
|
+
);
|
|
1160
|
+
if (target === "vercel") {
|
|
1161
|
+
await mkdir(resolve(outDir, "api"), { recursive: true });
|
|
1162
|
+
await copyIfExists(resolve(workingDir, "AGENT.md"), resolve(outDir, "AGENT.md"));
|
|
1163
|
+
await copyIfExists(
|
|
1164
|
+
resolve(workingDir, "agentl.config.js"),
|
|
1165
|
+
resolve(outDir, "agentl.config.js")
|
|
1166
|
+
);
|
|
1167
|
+
await copyIfExists(resolve(workingDir, "skills"), resolve(outDir, "skills"));
|
|
1168
|
+
await copyIfExists(resolve(workingDir, "tests"), resolve(outDir, "tests"));
|
|
1169
|
+
await writeFile(
|
|
1170
|
+
resolve(outDir, "vercel.json"),
|
|
1171
|
+
JSON.stringify(
|
|
1172
|
+
{
|
|
1173
|
+
version: 2,
|
|
1174
|
+
builds: [
|
|
1175
|
+
{
|
|
1176
|
+
src: "api/index.js",
|
|
1177
|
+
use: "@vercel/node@3.2.24",
|
|
1178
|
+
config: {
|
|
1179
|
+
includeFiles: [
|
|
1180
|
+
"AGENT.md",
|
|
1181
|
+
"agentl.config.js",
|
|
1182
|
+
"skills/**",
|
|
1183
|
+
"tests/**"
|
|
1184
|
+
],
|
|
1185
|
+
supportsResponseStreaming: true
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
],
|
|
1189
|
+
routes: [{ src: "/(.*)", dest: "/api/index.js" }]
|
|
1190
|
+
},
|
|
1191
|
+
null,
|
|
1192
|
+
2
|
|
1193
|
+
),
|
|
1194
|
+
"utf8"
|
|
1195
|
+
);
|
|
1196
|
+
await buildVercelHandlerBundle(outDir);
|
|
1197
|
+
await writeFile(
|
|
1198
|
+
resolve(outDir, "package.json"),
|
|
1199
|
+
JSON.stringify(
|
|
1200
|
+
{
|
|
1201
|
+
private: true,
|
|
1202
|
+
type: "module",
|
|
1203
|
+
engines: {
|
|
1204
|
+
node: "20.x"
|
|
1205
|
+
},
|
|
1206
|
+
dependencies: VERCEL_RUNTIME_DEPENDENCIES
|
|
1207
|
+
},
|
|
1208
|
+
null,
|
|
1209
|
+
2
|
|
1210
|
+
),
|
|
1211
|
+
"utf8"
|
|
1212
|
+
);
|
|
1213
|
+
} else if (target === "docker") {
|
|
1214
|
+
await writeFile(
|
|
1215
|
+
resolve(outDir, "Dockerfile"),
|
|
1216
|
+
`FROM node:20-slim
|
|
1217
|
+
WORKDIR /app
|
|
1218
|
+
COPY package.json package.json
|
|
1219
|
+
COPY AGENT.md AGENT.md
|
|
1220
|
+
COPY agentl.config.js agentl.config.js
|
|
1221
|
+
COPY skills skills
|
|
1222
|
+
COPY tests tests
|
|
1223
|
+
COPY .env.example .env.example
|
|
1224
|
+
RUN corepack enable && npm install -g agentl
|
|
1225
|
+
COPY server.js server.js
|
|
1226
|
+
EXPOSE 3000
|
|
1227
|
+
CMD ["node","server.js"]
|
|
1228
|
+
`,
|
|
1229
|
+
"utf8"
|
|
1230
|
+
);
|
|
1231
|
+
await writeFile(resolve(outDir, "server.js"), serverEntrypoint, "utf8");
|
|
1232
|
+
await writeFile(resolve(outDir, "package.json"), runtimePackageJson, "utf8");
|
|
1233
|
+
} else if (target === "lambda") {
|
|
1234
|
+
await writeFile(
|
|
1235
|
+
resolve(outDir, "lambda-handler.js"),
|
|
1236
|
+
`import { startDevServer } from "agentl";
|
|
1237
|
+
let serverPromise;
|
|
1238
|
+
export const handler = async (event = {}) => {
|
|
1239
|
+
if (!serverPromise) {
|
|
1240
|
+
serverPromise = startDevServer(0, { workingDir: process.cwd() });
|
|
1241
|
+
}
|
|
1242
|
+
const body = JSON.stringify({
|
|
1243
|
+
status: "ready",
|
|
1244
|
+
route: event.rawPath ?? event.path ?? "/",
|
|
1245
|
+
});
|
|
1246
|
+
return { statusCode: 200, headers: { "content-type": "application/json" }, body };
|
|
1247
|
+
};
|
|
1248
|
+
`,
|
|
1249
|
+
"utf8"
|
|
1250
|
+
);
|
|
1251
|
+
await writeFile(resolve(outDir, "package.json"), runtimePackageJson, "utf8");
|
|
1252
|
+
} else if (target === "fly") {
|
|
1253
|
+
await writeFile(
|
|
1254
|
+
resolve(outDir, "fly.toml"),
|
|
1255
|
+
`app = "agentl-app"
|
|
1256
|
+
[env]
|
|
1257
|
+
PORT = "3000"
|
|
1258
|
+
[http_service]
|
|
1259
|
+
internal_port = 3000
|
|
1260
|
+
force_https = true
|
|
1261
|
+
auto_start_machines = true
|
|
1262
|
+
auto_stop_machines = "stop"
|
|
1263
|
+
min_machines_running = 0
|
|
1264
|
+
`,
|
|
1265
|
+
"utf8"
|
|
1266
|
+
);
|
|
1267
|
+
await writeFile(
|
|
1268
|
+
resolve(outDir, "Dockerfile"),
|
|
1269
|
+
`FROM node:20-slim
|
|
1270
|
+
WORKDIR /app
|
|
1271
|
+
COPY package.json package.json
|
|
1272
|
+
COPY AGENT.md AGENT.md
|
|
1273
|
+
COPY agentl.config.js agentl.config.js
|
|
1274
|
+
COPY skills skills
|
|
1275
|
+
COPY tests tests
|
|
1276
|
+
RUN npm install -g agentl
|
|
1277
|
+
COPY server.js server.js
|
|
1278
|
+
EXPOSE 3000
|
|
1279
|
+
CMD ["node","server.js"]
|
|
1280
|
+
`,
|
|
1281
|
+
"utf8"
|
|
1282
|
+
);
|
|
1283
|
+
await writeFile(resolve(outDir, "server.js"), serverEntrypoint, "utf8");
|
|
1284
|
+
await writeFile(resolve(outDir, "package.json"), runtimePackageJson, "utf8");
|
|
1285
|
+
} else {
|
|
1286
|
+
throw new Error(`Unsupported build target: ${target}`);
|
|
1287
|
+
}
|
|
1288
|
+
process.stdout.write(`Build artifacts generated at ${outDir}
|
|
1289
|
+
`);
|
|
1290
|
+
};
|
|
1291
|
+
var normalizeMcpName = (entry) => entry.name ?? entry.url ?? `mcp_${Date.now()}`;
|
|
1292
|
+
var mcpAdd = async (workingDir, options) => {
|
|
1293
|
+
const config = await loadAgentlConfig(workingDir) ?? { mcp: [] };
|
|
1294
|
+
const mcp = [...config.mcp ?? []];
|
|
1295
|
+
if (!options.url) {
|
|
1296
|
+
throw new Error("Remote MCP only: provide --url for a remote MCP server.");
|
|
1297
|
+
}
|
|
1298
|
+
mcp.push({
|
|
1299
|
+
name: options.name ?? normalizeMcpName({ url: options.url }),
|
|
1300
|
+
url: options.url,
|
|
1301
|
+
env: options.envVars ?? []
|
|
1302
|
+
});
|
|
1303
|
+
await writeConfigFile(workingDir, { ...config, mcp });
|
|
1304
|
+
process.stdout.write("MCP server added.\n");
|
|
1305
|
+
};
|
|
1306
|
+
var mcpList = async (workingDir) => {
|
|
1307
|
+
const config = await loadAgentlConfig(workingDir);
|
|
1308
|
+
const mcp = config?.mcp ?? [];
|
|
1309
|
+
if (mcp.length === 0) {
|
|
1310
|
+
process.stdout.write("No MCP servers configured.\n");
|
|
1311
|
+
return;
|
|
1312
|
+
}
|
|
1313
|
+
process.stdout.write("Configured MCP servers:\n");
|
|
1314
|
+
for (const entry of mcp) {
|
|
1315
|
+
process.stdout.write(`- ${entry.name ?? entry.url} (remote: ${entry.url})
|
|
1316
|
+
`);
|
|
1317
|
+
}
|
|
1318
|
+
};
|
|
1319
|
+
var mcpRemove = async (workingDir, name) => {
|
|
1320
|
+
const config = await loadAgentlConfig(workingDir) ?? { mcp: [] };
|
|
1321
|
+
const before = config.mcp ?? [];
|
|
1322
|
+
const filtered = before.filter((entry) => normalizeMcpName(entry) !== name);
|
|
1323
|
+
await writeConfigFile(workingDir, { ...config, mcp: filtered });
|
|
1324
|
+
process.stdout.write(`Removed MCP server: ${name}
|
|
1325
|
+
`);
|
|
1326
|
+
};
|
|
1327
|
+
var buildCli = () => {
|
|
1328
|
+
const program = new Command();
|
|
1329
|
+
program.name("agentl").description("CLI for building and running AgentL agents").version("0.1.0");
|
|
1330
|
+
program.command("init").argument("<name>", "project name").option("--configure", "run full onboarding setup", false).option("--yes", "accept defaults and skip prompts", false).description("Scaffold a new AgentL project").action(async (name, options) => {
|
|
1331
|
+
await initProject(name, {
|
|
1332
|
+
onboarding: {
|
|
1333
|
+
mode: options.configure ? "full" : "light",
|
|
1334
|
+
yes: options.yes,
|
|
1335
|
+
interactive: !options.yes && process.stdin.isTTY === true && process.stdout.isTTY === true
|
|
1336
|
+
}
|
|
1337
|
+
});
|
|
1338
|
+
});
|
|
1339
|
+
program.command("dev").description("Run local development server").option("--port <port>", "server port", "3000").action(async (options) => {
|
|
1340
|
+
const port = Number.parseInt(options.port, 10);
|
|
1341
|
+
await startDevServer(Number.isNaN(port) ? 3e3 : port);
|
|
1342
|
+
});
|
|
1343
|
+
program.command("run").argument("[task]", "task to run").description("Execute the agent once").option("--param <keyValue>", "parameter key=value", (value, all) => {
|
|
1344
|
+
all.push(value);
|
|
1345
|
+
return all;
|
|
1346
|
+
}, []).option("--file <path>", "include file contents", (value, all) => {
|
|
1347
|
+
all.push(value);
|
|
1348
|
+
return all;
|
|
1349
|
+
}, []).option("--json", "output json", false).option("--interactive", "run in interactive mode", false).action(
|
|
1350
|
+
async (task, options) => {
|
|
1351
|
+
const params = parseParams(options.param);
|
|
1352
|
+
if (options.interactive) {
|
|
1353
|
+
await runInteractive(process.cwd(), params);
|
|
1354
|
+
return;
|
|
1355
|
+
}
|
|
1356
|
+
if (!task) {
|
|
1357
|
+
throw new Error("Task is required unless --interactive is used.");
|
|
1358
|
+
}
|
|
1359
|
+
await runOnce(task, {
|
|
1360
|
+
params,
|
|
1361
|
+
json: options.json,
|
|
1362
|
+
filePaths: options.file
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
);
|
|
1366
|
+
program.command("tools").description("List all tools available to the agent").action(async () => {
|
|
1367
|
+
await listTools(process.cwd());
|
|
1368
|
+
});
|
|
1369
|
+
program.command("add").argument("<packageOrPath>", "skill package name/path").description("Add a skill package and validate SKILL.md").action(async (packageOrPath) => {
|
|
1370
|
+
await addSkill(process.cwd(), packageOrPath);
|
|
1371
|
+
});
|
|
1372
|
+
program.command("update-agent").description("Backfill latest default guidance into AGENT.md").action(async () => {
|
|
1373
|
+
await updateAgentGuidance(process.cwd());
|
|
1374
|
+
});
|
|
1375
|
+
program.command("test").argument("[file]", "test file path (yaml)").description("Run yaml-defined agent tests").action(async (file) => {
|
|
1376
|
+
const testFile = file ? resolve(process.cwd(), file) : void 0;
|
|
1377
|
+
const result = await runTests(process.cwd(), testFile);
|
|
1378
|
+
if (result.failed > 0) {
|
|
1379
|
+
process.exitCode = 1;
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
program.command("build").argument("<target>", "vercel|docker|lambda|fly").description("Generate build artifacts for deployment target").action(async (target) => {
|
|
1383
|
+
await buildTarget(process.cwd(), target);
|
|
1384
|
+
});
|
|
1385
|
+
const mcpCommand = program.command("mcp").description("Manage MCP servers");
|
|
1386
|
+
mcpCommand.command("add").requiredOption("--url <url>", "remote MCP url").option("--name <name>", "server name").option("--env <name>", "env variable (repeatable)", (value, all) => {
|
|
1387
|
+
all.push(value);
|
|
1388
|
+
return all;
|
|
1389
|
+
}, []).action(
|
|
1390
|
+
async (options) => {
|
|
1391
|
+
await mcpAdd(process.cwd(), {
|
|
1392
|
+
url: options.url,
|
|
1393
|
+
name: options.name,
|
|
1394
|
+
envVars: options.env
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
);
|
|
1398
|
+
mcpCommand.command("list").description("List configured MCP servers").action(async () => {
|
|
1399
|
+
await mcpList(process.cwd());
|
|
1400
|
+
});
|
|
1401
|
+
mcpCommand.command("remove").argument("<name>", "server name").description("Remove an MCP server by name").action(async (name) => {
|
|
1402
|
+
await mcpRemove(process.cwd(), name);
|
|
1403
|
+
});
|
|
1404
|
+
return program;
|
|
1405
|
+
};
|
|
1406
|
+
var main = async (argv = process.argv) => {
|
|
1407
|
+
try {
|
|
1408
|
+
await buildCli().parseAsync(argv);
|
|
1409
|
+
} catch (error) {
|
|
1410
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "EADDRINUSE") {
|
|
1411
|
+
const message = "Port is already in use. Try `agentl dev --port 3001` or stop the process using port 3000.";
|
|
1412
|
+
process.stderr.write(`${message}
|
|
1413
|
+
`);
|
|
1414
|
+
process.exitCode = 1;
|
|
1415
|
+
return;
|
|
1416
|
+
}
|
|
1417
|
+
process.stderr.write(`${error instanceof Error ? error.message : "Unknown CLI error"}
|
|
1418
|
+
`);
|
|
1419
|
+
process.exitCode = 1;
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
var packageRoot = resolve(__dirname, "..");
|
|
1423
|
+
|
|
1424
|
+
export {
|
|
1425
|
+
initProject,
|
|
1426
|
+
updateAgentGuidance,
|
|
1427
|
+
createRequestHandler,
|
|
1428
|
+
startDevServer,
|
|
1429
|
+
runOnce,
|
|
1430
|
+
runInteractive,
|
|
1431
|
+
listTools,
|
|
1432
|
+
addSkill,
|
|
1433
|
+
runTests,
|
|
1434
|
+
buildTarget,
|
|
1435
|
+
mcpAdd,
|
|
1436
|
+
mcpList,
|
|
1437
|
+
mcpRemove,
|
|
1438
|
+
buildCli,
|
|
1439
|
+
main,
|
|
1440
|
+
packageRoot
|
|
1441
|
+
};
|