@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,1133 @@
|
|
|
1
|
+
// src/web-ui.ts
|
|
2
|
+
import { createHash, randomUUID, timingSafeEqual } from "crypto";
|
|
3
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
4
|
+
import { basename, dirname, resolve } from "path";
|
|
5
|
+
import { homedir } from "os";
|
|
6
|
+
var DEFAULT_OWNER = "local-owner";
|
|
7
|
+
var getStateDirectory = () => {
|
|
8
|
+
const isServerless = process.env.VERCEL === "1" || process.env.AWS_LAMBDA_FUNCTION_NAME !== void 0 || process.env.SERVERLESS === "1";
|
|
9
|
+
if (isServerless) {
|
|
10
|
+
return "/tmp/.agentl/state";
|
|
11
|
+
}
|
|
12
|
+
return resolve(homedir(), ".agentl", "state");
|
|
13
|
+
};
|
|
14
|
+
var FileConversationStore = class {
|
|
15
|
+
filePath;
|
|
16
|
+
conversations = /* @__PURE__ */ new Map();
|
|
17
|
+
loaded = false;
|
|
18
|
+
writing = Promise.resolve();
|
|
19
|
+
constructor(workingDir) {
|
|
20
|
+
const projectName = basename(workingDir).replace(/[^a-zA-Z0-9_-]+/g, "-") || "project";
|
|
21
|
+
const projectHash = createHash("sha256").update(workingDir).digest("hex").slice(0, 12);
|
|
22
|
+
this.filePath = resolve(
|
|
23
|
+
getStateDirectory(),
|
|
24
|
+
`${projectName}-${projectHash}-web-ui-state.json`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
async ensureLoaded() {
|
|
28
|
+
if (this.loaded) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
this.loaded = true;
|
|
32
|
+
try {
|
|
33
|
+
const content = await readFile(this.filePath, "utf8");
|
|
34
|
+
const parsed = JSON.parse(content);
|
|
35
|
+
for (const conversation of parsed.conversations ?? []) {
|
|
36
|
+
this.conversations.set(conversation.conversationId, conversation);
|
|
37
|
+
}
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async persist() {
|
|
42
|
+
const payload = {
|
|
43
|
+
conversations: Array.from(this.conversations.values())
|
|
44
|
+
};
|
|
45
|
+
this.writing = this.writing.then(async () => {
|
|
46
|
+
await mkdir(dirname(this.filePath), { recursive: true });
|
|
47
|
+
await writeFile(this.filePath, JSON.stringify(payload, null, 2), "utf8");
|
|
48
|
+
});
|
|
49
|
+
await this.writing;
|
|
50
|
+
}
|
|
51
|
+
async list(ownerId = DEFAULT_OWNER) {
|
|
52
|
+
await this.ensureLoaded();
|
|
53
|
+
return Array.from(this.conversations.values()).filter((conversation) => conversation.ownerId === ownerId).sort((a, b) => b.updatedAt - a.updatedAt);
|
|
54
|
+
}
|
|
55
|
+
async get(conversationId) {
|
|
56
|
+
await this.ensureLoaded();
|
|
57
|
+
return this.conversations.get(conversationId);
|
|
58
|
+
}
|
|
59
|
+
async create(ownerId = DEFAULT_OWNER, title) {
|
|
60
|
+
await this.ensureLoaded();
|
|
61
|
+
const now = Date.now();
|
|
62
|
+
const conversation = {
|
|
63
|
+
conversationId: randomUUID(),
|
|
64
|
+
title: title && title.trim().length > 0 ? title.trim() : "New conversation",
|
|
65
|
+
messages: [],
|
|
66
|
+
ownerId,
|
|
67
|
+
tenantId: null,
|
|
68
|
+
createdAt: now,
|
|
69
|
+
updatedAt: now
|
|
70
|
+
};
|
|
71
|
+
this.conversations.set(conversation.conversationId, conversation);
|
|
72
|
+
await this.persist();
|
|
73
|
+
return conversation;
|
|
74
|
+
}
|
|
75
|
+
async update(conversation) {
|
|
76
|
+
await this.ensureLoaded();
|
|
77
|
+
this.conversations.set(conversation.conversationId, {
|
|
78
|
+
...conversation,
|
|
79
|
+
updatedAt: Date.now()
|
|
80
|
+
});
|
|
81
|
+
await this.persist();
|
|
82
|
+
}
|
|
83
|
+
async rename(conversationId, title) {
|
|
84
|
+
await this.ensureLoaded();
|
|
85
|
+
const existing = this.conversations.get(conversationId);
|
|
86
|
+
if (!existing) {
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
const updated = {
|
|
90
|
+
...existing,
|
|
91
|
+
title: title.trim().length > 0 ? title.trim() : existing.title,
|
|
92
|
+
updatedAt: Date.now()
|
|
93
|
+
};
|
|
94
|
+
this.conversations.set(conversationId, updated);
|
|
95
|
+
await this.persist();
|
|
96
|
+
return updated;
|
|
97
|
+
}
|
|
98
|
+
async delete(conversationId) {
|
|
99
|
+
await this.ensureLoaded();
|
|
100
|
+
const removed = this.conversations.delete(conversationId);
|
|
101
|
+
if (removed) {
|
|
102
|
+
await this.persist();
|
|
103
|
+
}
|
|
104
|
+
return removed;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
var SessionStore = class {
|
|
108
|
+
sessions = /* @__PURE__ */ new Map();
|
|
109
|
+
ttlMs;
|
|
110
|
+
constructor(ttlMs = 1e3 * 60 * 60 * 8) {
|
|
111
|
+
this.ttlMs = ttlMs;
|
|
112
|
+
}
|
|
113
|
+
create(ownerId = DEFAULT_OWNER) {
|
|
114
|
+
const now = Date.now();
|
|
115
|
+
const session = {
|
|
116
|
+
sessionId: randomUUID(),
|
|
117
|
+
ownerId,
|
|
118
|
+
csrfToken: randomUUID(),
|
|
119
|
+
createdAt: now,
|
|
120
|
+
expiresAt: now + this.ttlMs,
|
|
121
|
+
lastSeenAt: now
|
|
122
|
+
};
|
|
123
|
+
this.sessions.set(session.sessionId, session);
|
|
124
|
+
return session;
|
|
125
|
+
}
|
|
126
|
+
get(sessionId) {
|
|
127
|
+
const session = this.sessions.get(sessionId);
|
|
128
|
+
if (!session) {
|
|
129
|
+
return void 0;
|
|
130
|
+
}
|
|
131
|
+
if (Date.now() > session.expiresAt) {
|
|
132
|
+
this.sessions.delete(sessionId);
|
|
133
|
+
return void 0;
|
|
134
|
+
}
|
|
135
|
+
session.lastSeenAt = Date.now();
|
|
136
|
+
return session;
|
|
137
|
+
}
|
|
138
|
+
delete(sessionId) {
|
|
139
|
+
this.sessions.delete(sessionId);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var LoginRateLimiter = class {
|
|
143
|
+
constructor(maxAttempts = 5, windowMs = 1e3 * 60 * 5, lockoutMs = 1e3 * 60 * 10) {
|
|
144
|
+
this.maxAttempts = maxAttempts;
|
|
145
|
+
this.windowMs = windowMs;
|
|
146
|
+
this.lockoutMs = lockoutMs;
|
|
147
|
+
}
|
|
148
|
+
attempts = /* @__PURE__ */ new Map();
|
|
149
|
+
canAttempt(key) {
|
|
150
|
+
const current = this.attempts.get(key);
|
|
151
|
+
if (!current) {
|
|
152
|
+
return { allowed: true };
|
|
153
|
+
}
|
|
154
|
+
if (current.lockedUntil && Date.now() < current.lockedUntil) {
|
|
155
|
+
return {
|
|
156
|
+
allowed: false,
|
|
157
|
+
retryAfterSeconds: Math.ceil((current.lockedUntil - Date.now()) / 1e3)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return { allowed: true };
|
|
161
|
+
}
|
|
162
|
+
registerFailure(key) {
|
|
163
|
+
const now = Date.now();
|
|
164
|
+
const current = this.attempts.get(key);
|
|
165
|
+
if (!current || now - current.firstFailureAt > this.windowMs) {
|
|
166
|
+
this.attempts.set(key, { count: 1, firstFailureAt: now });
|
|
167
|
+
return { locked: false };
|
|
168
|
+
}
|
|
169
|
+
const count = current.count + 1;
|
|
170
|
+
const next = {
|
|
171
|
+
...current,
|
|
172
|
+
count
|
|
173
|
+
};
|
|
174
|
+
if (count >= this.maxAttempts) {
|
|
175
|
+
next.lockedUntil = now + this.lockoutMs;
|
|
176
|
+
this.attempts.set(key, next);
|
|
177
|
+
return { locked: true, retryAfterSeconds: Math.ceil(this.lockoutMs / 1e3) };
|
|
178
|
+
}
|
|
179
|
+
this.attempts.set(key, next);
|
|
180
|
+
return { locked: false };
|
|
181
|
+
}
|
|
182
|
+
registerSuccess(key) {
|
|
183
|
+
this.attempts.delete(key);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
var parseCookies = (request) => {
|
|
187
|
+
const cookieHeader = request.headers.cookie ?? "";
|
|
188
|
+
const pairs = cookieHeader.split(";").map((part) => part.trim()).filter(Boolean);
|
|
189
|
+
const cookies = {};
|
|
190
|
+
for (const pair of pairs) {
|
|
191
|
+
const index = pair.indexOf("=");
|
|
192
|
+
if (index <= 0) {
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
const key = pair.slice(0, index);
|
|
196
|
+
const value = pair.slice(index + 1);
|
|
197
|
+
try {
|
|
198
|
+
cookies[key] = decodeURIComponent(value);
|
|
199
|
+
} catch {
|
|
200
|
+
cookies[key] = value;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return cookies;
|
|
204
|
+
};
|
|
205
|
+
var setCookie = (response, name, value, options) => {
|
|
206
|
+
const segments = [`${name}=${encodeURIComponent(value)}`];
|
|
207
|
+
segments.push(`Path=${options.path ?? "/"}`);
|
|
208
|
+
if (typeof options.maxAge === "number") {
|
|
209
|
+
segments.push(`Max-Age=${Math.max(0, Math.floor(options.maxAge))}`);
|
|
210
|
+
}
|
|
211
|
+
if (options.httpOnly) {
|
|
212
|
+
segments.push("HttpOnly");
|
|
213
|
+
}
|
|
214
|
+
if (options.secure) {
|
|
215
|
+
segments.push("Secure");
|
|
216
|
+
}
|
|
217
|
+
if (options.sameSite) {
|
|
218
|
+
segments.push(`SameSite=${options.sameSite}`);
|
|
219
|
+
}
|
|
220
|
+
const previous = response.getHeader("Set-Cookie");
|
|
221
|
+
const serialized = segments.join("; ");
|
|
222
|
+
if (!previous) {
|
|
223
|
+
response.setHeader("Set-Cookie", serialized);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (Array.isArray(previous)) {
|
|
227
|
+
response.setHeader("Set-Cookie", [...previous, serialized]);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
response.setHeader("Set-Cookie", [String(previous), serialized]);
|
|
231
|
+
};
|
|
232
|
+
var verifyPassphrase = (provided, expected) => {
|
|
233
|
+
const providedBuffer = Buffer.from(provided);
|
|
234
|
+
const expectedBuffer = Buffer.from(expected);
|
|
235
|
+
if (providedBuffer.length !== expectedBuffer.length) {
|
|
236
|
+
const zero = Buffer.alloc(expectedBuffer.length);
|
|
237
|
+
return timingSafeEqual(expectedBuffer, zero) && false;
|
|
238
|
+
}
|
|
239
|
+
return timingSafeEqual(providedBuffer, expectedBuffer);
|
|
240
|
+
};
|
|
241
|
+
var getRequestIp = (request) => {
|
|
242
|
+
return request.socket.remoteAddress ?? "unknown";
|
|
243
|
+
};
|
|
244
|
+
var inferConversationTitle = (text) => {
|
|
245
|
+
const normalized = text.trim().replace(/\s+/g, " ");
|
|
246
|
+
if (!normalized) {
|
|
247
|
+
return "New conversation";
|
|
248
|
+
}
|
|
249
|
+
return normalized.length <= 48 ? normalized : `${normalized.slice(0, 48)}...`;
|
|
250
|
+
};
|
|
251
|
+
var renderWebUiHtml = () => `<!doctype html>
|
|
252
|
+
<html lang="en">
|
|
253
|
+
<head>
|
|
254
|
+
<meta charset="utf-8">
|
|
255
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
256
|
+
<title>AgentL</title>
|
|
257
|
+
<style>
|
|
258
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
259
|
+
html, body { height: 100%; }
|
|
260
|
+
body {
|
|
261
|
+
font-family: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
|
|
262
|
+
background: #2f2f2f;
|
|
263
|
+
color: #e8e8e8;
|
|
264
|
+
font-size: 15px;
|
|
265
|
+
line-height: 1.5;
|
|
266
|
+
-webkit-font-smoothing: antialiased;
|
|
267
|
+
}
|
|
268
|
+
button, input, textarea { font: inherit; }
|
|
269
|
+
.hidden { display: none !important; }
|
|
270
|
+
|
|
271
|
+
/* Auth */
|
|
272
|
+
.auth {
|
|
273
|
+
min-height: 100vh;
|
|
274
|
+
display: grid;
|
|
275
|
+
place-items: center;
|
|
276
|
+
padding: 20px;
|
|
277
|
+
}
|
|
278
|
+
.auth-card {
|
|
279
|
+
width: min(360px, 90vw);
|
|
280
|
+
background: #242424;
|
|
281
|
+
border-radius: 16px;
|
|
282
|
+
padding: 24px;
|
|
283
|
+
display: grid;
|
|
284
|
+
gap: 16px;
|
|
285
|
+
}
|
|
286
|
+
.auth-title { font-size: 20px; font-weight: 600; }
|
|
287
|
+
.auth-text { color: #888; font-size: 14px; }
|
|
288
|
+
.auth-input {
|
|
289
|
+
width: 100%;
|
|
290
|
+
background: #1a1a1a;
|
|
291
|
+
border: 1px solid #3a3a3a;
|
|
292
|
+
border-radius: 8px;
|
|
293
|
+
color: #e8e8e8;
|
|
294
|
+
padding: 12px;
|
|
295
|
+
outline: none;
|
|
296
|
+
}
|
|
297
|
+
.auth-input:focus { border-color: #555; }
|
|
298
|
+
.auth-submit {
|
|
299
|
+
background: #fff;
|
|
300
|
+
color: #000;
|
|
301
|
+
border: 0;
|
|
302
|
+
border-radius: 8px;
|
|
303
|
+
padding: 12px;
|
|
304
|
+
font-weight: 600;
|
|
305
|
+
cursor: pointer;
|
|
306
|
+
}
|
|
307
|
+
.auth-submit:hover { opacity: 0.9; }
|
|
308
|
+
.error { color: #f87171; font-size: 13px; min-height: 16px; }
|
|
309
|
+
|
|
310
|
+
/* Layout */
|
|
311
|
+
.shell { min-height: 100vh; display: flex; }
|
|
312
|
+
.sidebar {
|
|
313
|
+
width: 260px;
|
|
314
|
+
background: #1a1a1a;
|
|
315
|
+
display: flex;
|
|
316
|
+
flex-direction: column;
|
|
317
|
+
padding: 8px;
|
|
318
|
+
}
|
|
319
|
+
.new-chat-btn {
|
|
320
|
+
background: transparent;
|
|
321
|
+
border: 0;
|
|
322
|
+
color: #e8e8e8;
|
|
323
|
+
border-radius: 8px;
|
|
324
|
+
height: 40px;
|
|
325
|
+
padding: 0 12px;
|
|
326
|
+
display: flex;
|
|
327
|
+
align-items: center;
|
|
328
|
+
gap: 10px;
|
|
329
|
+
font-size: 14px;
|
|
330
|
+
cursor: pointer;
|
|
331
|
+
}
|
|
332
|
+
.new-chat-btn:hover { background: #2a2a2a; }
|
|
333
|
+
.new-chat-btn svg { width: 16px; height: 16px; }
|
|
334
|
+
.conversation-list { flex: 1; overflow-y: auto; margin-top: 8px; }
|
|
335
|
+
.conversation-item {
|
|
336
|
+
padding: 10px 12px;
|
|
337
|
+
border-radius: 8px;
|
|
338
|
+
cursor: pointer;
|
|
339
|
+
font-size: 14px;
|
|
340
|
+
white-space: nowrap;
|
|
341
|
+
overflow: hidden;
|
|
342
|
+
text-overflow: ellipsis;
|
|
343
|
+
position: relative;
|
|
344
|
+
}
|
|
345
|
+
.conversation-item:hover { background: #2a2a2a; }
|
|
346
|
+
.conversation-item.active { background: #333; }
|
|
347
|
+
.conversation-item .menu-btn {
|
|
348
|
+
position: absolute;
|
|
349
|
+
right: 4px;
|
|
350
|
+
top: 50%;
|
|
351
|
+
transform: translateY(-50%);
|
|
352
|
+
opacity: 0;
|
|
353
|
+
background: transparent;
|
|
354
|
+
border: 0;
|
|
355
|
+
color: #888;
|
|
356
|
+
width: 24px;
|
|
357
|
+
height: 24px;
|
|
358
|
+
border-radius: 4px;
|
|
359
|
+
cursor: pointer;
|
|
360
|
+
}
|
|
361
|
+
.conversation-item:hover .menu-btn { opacity: 1; }
|
|
362
|
+
.conversation-menu {
|
|
363
|
+
position: absolute;
|
|
364
|
+
top: 100%;
|
|
365
|
+
right: 0;
|
|
366
|
+
background: #333;
|
|
367
|
+
border-radius: 8px;
|
|
368
|
+
overflow: hidden;
|
|
369
|
+
z-index: 10;
|
|
370
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
|
|
371
|
+
}
|
|
372
|
+
.conversation-menu button {
|
|
373
|
+
display: block;
|
|
374
|
+
width: 100%;
|
|
375
|
+
background: transparent;
|
|
376
|
+
border: 0;
|
|
377
|
+
color: #e8e8e8;
|
|
378
|
+
padding: 8px 16px;
|
|
379
|
+
text-align: left;
|
|
380
|
+
cursor: pointer;
|
|
381
|
+
font-size: 13px;
|
|
382
|
+
}
|
|
383
|
+
.conversation-menu button:hover { background: #444; }
|
|
384
|
+
.conversation-menu button.danger { color: #f87171; }
|
|
385
|
+
.sidebar-footer { margin-top: auto; padding-top: 8px; }
|
|
386
|
+
.logout-btn {
|
|
387
|
+
background: transparent;
|
|
388
|
+
border: 0;
|
|
389
|
+
color: #888;
|
|
390
|
+
width: 100%;
|
|
391
|
+
padding: 10px 12px;
|
|
392
|
+
text-align: left;
|
|
393
|
+
border-radius: 8px;
|
|
394
|
+
cursor: pointer;
|
|
395
|
+
font-size: 13px;
|
|
396
|
+
}
|
|
397
|
+
.logout-btn:hover { background: #2a2a2a; color: #e8e8e8; }
|
|
398
|
+
|
|
399
|
+
/* Main */
|
|
400
|
+
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
|
|
401
|
+
.topbar {
|
|
402
|
+
height: 48px;
|
|
403
|
+
display: flex;
|
|
404
|
+
align-items: center;
|
|
405
|
+
justify-content: center;
|
|
406
|
+
font-size: 14px;
|
|
407
|
+
color: #e8e8e8;
|
|
408
|
+
}
|
|
409
|
+
.topbar-title {
|
|
410
|
+
max-width: 400px;
|
|
411
|
+
overflow: hidden;
|
|
412
|
+
text-overflow: ellipsis;
|
|
413
|
+
white-space: nowrap;
|
|
414
|
+
}
|
|
415
|
+
.sidebar-toggle {
|
|
416
|
+
display: none;
|
|
417
|
+
position: absolute;
|
|
418
|
+
left: 12px;
|
|
419
|
+
background: transparent;
|
|
420
|
+
border: 0;
|
|
421
|
+
color: #888;
|
|
422
|
+
width: 32px;
|
|
423
|
+
height: 32px;
|
|
424
|
+
border-radius: 8px;
|
|
425
|
+
cursor: pointer;
|
|
426
|
+
}
|
|
427
|
+
.sidebar-toggle:hover { background: #444; }
|
|
428
|
+
.typing-indicator {
|
|
429
|
+
display: flex;
|
|
430
|
+
gap: 3px;
|
|
431
|
+
margin-left: 8px;
|
|
432
|
+
}
|
|
433
|
+
.typing-indicator span {
|
|
434
|
+
width: 6px;
|
|
435
|
+
height: 6px;
|
|
436
|
+
background: #ff4000;
|
|
437
|
+
border-radius: 50%;
|
|
438
|
+
animation: pulse 1s infinite;
|
|
439
|
+
}
|
|
440
|
+
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
|
|
441
|
+
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }
|
|
442
|
+
@keyframes pulse {
|
|
443
|
+
0%, 100% { opacity: 0.4; }
|
|
444
|
+
50% { opacity: 1; }
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/* Messages */
|
|
448
|
+
.messages { flex: 1; overflow-y: auto; padding: 16px 24px; }
|
|
449
|
+
.messages-column { max-width: 700px; margin: 0 auto; }
|
|
450
|
+
.message-row { margin-bottom: 20px; display: flex; }
|
|
451
|
+
.message-row.user { justify-content: flex-end; }
|
|
452
|
+
.assistant-wrap { display: flex; gap: 12px; }
|
|
453
|
+
.assistant-avatar {
|
|
454
|
+
width: 28px;
|
|
455
|
+
height: 28px;
|
|
456
|
+
background: #444;
|
|
457
|
+
border-radius: 50%;
|
|
458
|
+
display: grid;
|
|
459
|
+
place-items: center;
|
|
460
|
+
font-size: 12px;
|
|
461
|
+
font-weight: 600;
|
|
462
|
+
flex-shrink: 0;
|
|
463
|
+
}
|
|
464
|
+
.assistant-content { line-height: 1.6; }
|
|
465
|
+
.assistant-content p { margin: 0 0 12px; }
|
|
466
|
+
.assistant-content p:last-child { margin-bottom: 0; }
|
|
467
|
+
.assistant-content ul, .assistant-content ol { margin: 8px 0; padding-left: 20px; }
|
|
468
|
+
.assistant-content li { margin: 4px 0; }
|
|
469
|
+
.assistant-content strong { font-weight: 600; }
|
|
470
|
+
.assistant-content code {
|
|
471
|
+
background: #1a1a1a;
|
|
472
|
+
padding: 2px 6px;
|
|
473
|
+
border-radius: 4px;
|
|
474
|
+
font-family: ui-monospace, monospace;
|
|
475
|
+
font-size: 0.9em;
|
|
476
|
+
}
|
|
477
|
+
.assistant-content pre {
|
|
478
|
+
background: #1a1a1a;
|
|
479
|
+
padding: 12px;
|
|
480
|
+
border-radius: 8px;
|
|
481
|
+
overflow-x: auto;
|
|
482
|
+
margin: 12px 0;
|
|
483
|
+
}
|
|
484
|
+
.assistant-content pre code { background: none; padding: 0; }
|
|
485
|
+
.user-bubble {
|
|
486
|
+
background: #444;
|
|
487
|
+
padding: 10px 14px;
|
|
488
|
+
border-radius: 18px;
|
|
489
|
+
max-width: 70%;
|
|
490
|
+
}
|
|
491
|
+
.empty-state {
|
|
492
|
+
display: flex;
|
|
493
|
+
flex-direction: column;
|
|
494
|
+
align-items: center;
|
|
495
|
+
justify-content: center;
|
|
496
|
+
height: 100%;
|
|
497
|
+
gap: 12px;
|
|
498
|
+
color: #888;
|
|
499
|
+
}
|
|
500
|
+
.empty-state .assistant-avatar { width: 40px; height: 40px; font-size: 16px; }
|
|
501
|
+
.loading-spinner {
|
|
502
|
+
width: 20px;
|
|
503
|
+
height: 20px;
|
|
504
|
+
border: 2px solid #333;
|
|
505
|
+
border-top-color: #ff4000;
|
|
506
|
+
border-radius: 50%;
|
|
507
|
+
animation: spin 0.8s linear infinite;
|
|
508
|
+
}
|
|
509
|
+
@keyframes spin { to { transform: rotate(360deg); } }
|
|
510
|
+
|
|
511
|
+
/* Composer */
|
|
512
|
+
.composer { padding: 0 24px 20px; }
|
|
513
|
+
.composer-inner { max-width: 700px; margin: 0 auto; }
|
|
514
|
+
.composer-shell {
|
|
515
|
+
background: #424242;
|
|
516
|
+
border-radius: 24px;
|
|
517
|
+
display: flex;
|
|
518
|
+
align-items: flex-end;
|
|
519
|
+
padding: 4px 4px 4px 16px;
|
|
520
|
+
}
|
|
521
|
+
.composer-input {
|
|
522
|
+
flex: 1;
|
|
523
|
+
background: transparent;
|
|
524
|
+
border: 0;
|
|
525
|
+
outline: none;
|
|
526
|
+
color: #e8e8e8;
|
|
527
|
+
min-height: 40px;
|
|
528
|
+
max-height: 200px;
|
|
529
|
+
resize: none;
|
|
530
|
+
padding: 10px 0 8px;
|
|
531
|
+
}
|
|
532
|
+
.composer-input::placeholder { color: #888; }
|
|
533
|
+
.send-btn {
|
|
534
|
+
width: 32px;
|
|
535
|
+
height: 32px;
|
|
536
|
+
background: #fff;
|
|
537
|
+
border: 0;
|
|
538
|
+
border-radius: 50%;
|
|
539
|
+
color: #000;
|
|
540
|
+
cursor: pointer;
|
|
541
|
+
display: grid;
|
|
542
|
+
place-items: center;
|
|
543
|
+
}
|
|
544
|
+
.send-btn:disabled { opacity: 0.3; cursor: default; }
|
|
545
|
+
.disclaimer { text-align: center; color: #666; font-size: 12px; margin-top: 8px; }
|
|
546
|
+
|
|
547
|
+
/* Scrollbar */
|
|
548
|
+
::-webkit-scrollbar { width: 6px; }
|
|
549
|
+
::-webkit-scrollbar-track { background: transparent; }
|
|
550
|
+
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
|
|
551
|
+
|
|
552
|
+
/* Mobile */
|
|
553
|
+
@media (max-width: 768px) {
|
|
554
|
+
.sidebar {
|
|
555
|
+
position: fixed;
|
|
556
|
+
inset: 0 auto 0 0;
|
|
557
|
+
z-index: 100;
|
|
558
|
+
transform: translateX(-100%);
|
|
559
|
+
transition: transform 0.2s;
|
|
560
|
+
}
|
|
561
|
+
.shell.sidebar-open .sidebar { transform: translateX(0); }
|
|
562
|
+
.sidebar-toggle { display: grid; place-items: center; }
|
|
563
|
+
.sidebar-backdrop {
|
|
564
|
+
position: fixed;
|
|
565
|
+
inset: 0;
|
|
566
|
+
background: rgba(0,0,0,0.5);
|
|
567
|
+
z-index: 50;
|
|
568
|
+
}
|
|
569
|
+
.shell:not(.sidebar-open) .sidebar-backdrop { display: none; }
|
|
570
|
+
.messages { padding: 12px 16px; }
|
|
571
|
+
.composer { padding: 0 16px 16px; }
|
|
572
|
+
}
|
|
573
|
+
</style>
|
|
574
|
+
</head>
|
|
575
|
+
<body>
|
|
576
|
+
<div id="auth" class="auth hidden">
|
|
577
|
+
<form id="login-form" class="auth-card">
|
|
578
|
+
<h2 class="auth-title">AgentL</h2>
|
|
579
|
+
<p class="auth-text">Enter the passphrase to continue.</p>
|
|
580
|
+
<input id="passphrase" class="auth-input" type="password" placeholder="Passphrase" required>
|
|
581
|
+
<button class="auth-submit" type="submit">Sign in</button>
|
|
582
|
+
<div id="login-error" class="error"></div>
|
|
583
|
+
</form>
|
|
584
|
+
</div>
|
|
585
|
+
|
|
586
|
+
<div id="app" class="shell hidden">
|
|
587
|
+
<aside class="sidebar">
|
|
588
|
+
<button id="new-chat" class="new-chat-btn">
|
|
589
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 5v14M5 12h14"/></svg>
|
|
590
|
+
New chat
|
|
591
|
+
</button>
|
|
592
|
+
<div id="conversation-list" class="conversation-list"></div>
|
|
593
|
+
<div class="sidebar-footer">
|
|
594
|
+
<button id="logout" class="logout-btn">Log out</button>
|
|
595
|
+
</div>
|
|
596
|
+
</aside>
|
|
597
|
+
<div id="sidebar-backdrop" class="sidebar-backdrop"></div>
|
|
598
|
+
<main class="main">
|
|
599
|
+
<div class="topbar">
|
|
600
|
+
<button id="sidebar-toggle" class="sidebar-toggle">\u2630</button>
|
|
601
|
+
<div id="chat-title" class="topbar-title"></div>
|
|
602
|
+
<span id="connection-status" class="typing-indicator hidden"><span></span><span></span><span></span></span>
|
|
603
|
+
</div>
|
|
604
|
+
<div id="messages" class="messages">
|
|
605
|
+
<div class="empty-state">
|
|
606
|
+
<div class="assistant-avatar">A</div>
|
|
607
|
+
<div>How can I help you today?</div>
|
|
608
|
+
</div>
|
|
609
|
+
</div>
|
|
610
|
+
<form id="composer" class="composer">
|
|
611
|
+
<div class="composer-inner">
|
|
612
|
+
<div class="composer-shell">
|
|
613
|
+
<textarea id="prompt" class="composer-input" placeholder="Reply..." rows="1"></textarea>
|
|
614
|
+
<button id="send" class="send-btn" type="submit">\u2191</button>
|
|
615
|
+
</div>
|
|
616
|
+
<div class="disclaimer">AgentL can make mistakes. Check important info.</div>
|
|
617
|
+
</div>
|
|
618
|
+
</form>
|
|
619
|
+
</main>
|
|
620
|
+
</div>
|
|
621
|
+
|
|
622
|
+
<script>
|
|
623
|
+
const state = {
|
|
624
|
+
csrfToken: "",
|
|
625
|
+
conversations: [],
|
|
626
|
+
activeConversationId: null,
|
|
627
|
+
isStreaming: false,
|
|
628
|
+
openMenuConversationId: null
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
const $ = (id) => document.getElementById(id);
|
|
632
|
+
const elements = {
|
|
633
|
+
auth: $("auth"),
|
|
634
|
+
app: $("app"),
|
|
635
|
+
loginForm: $("login-form"),
|
|
636
|
+
passphrase: $("passphrase"),
|
|
637
|
+
loginError: $("login-error"),
|
|
638
|
+
list: $("conversation-list"),
|
|
639
|
+
newChat: $("new-chat"),
|
|
640
|
+
messages: $("messages"),
|
|
641
|
+
chatTitle: $("chat-title"),
|
|
642
|
+
logout: $("logout"),
|
|
643
|
+
composer: $("composer"),
|
|
644
|
+
prompt: $("prompt"),
|
|
645
|
+
send: $("send"),
|
|
646
|
+
connectionStatus: $("connection-status"),
|
|
647
|
+
shell: $("app"),
|
|
648
|
+
sidebarToggle: $("sidebar-toggle"),
|
|
649
|
+
sidebarBackdrop: $("sidebar-backdrop")
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
const mutatingMethods = new Set(["POST", "PATCH", "PUT", "DELETE"]);
|
|
653
|
+
|
|
654
|
+
const api = async (path, options = {}) => {
|
|
655
|
+
const method = (options.method || "GET").toUpperCase();
|
|
656
|
+
const headers = { ...(options.headers || {}) };
|
|
657
|
+
if (mutatingMethods.has(method) && state.csrfToken) {
|
|
658
|
+
headers["x-csrf-token"] = state.csrfToken;
|
|
659
|
+
}
|
|
660
|
+
if (options.body && !headers["Content-Type"]) {
|
|
661
|
+
headers["Content-Type"] = "application/json";
|
|
662
|
+
}
|
|
663
|
+
const response = await fetch(path, { credentials: "include", ...options, method, headers });
|
|
664
|
+
if (!response.ok) {
|
|
665
|
+
let payload = {};
|
|
666
|
+
try { payload = await response.json(); } catch {}
|
|
667
|
+
const error = new Error(payload.message || ("Request failed: " + response.status));
|
|
668
|
+
error.status = response.status;
|
|
669
|
+
error.payload = payload;
|
|
670
|
+
throw error;
|
|
671
|
+
}
|
|
672
|
+
const contentType = response.headers.get("content-type") || "";
|
|
673
|
+
if (contentType.includes("application/json")) {
|
|
674
|
+
return await response.json();
|
|
675
|
+
}
|
|
676
|
+
return await response.text();
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
const escapeHtml = (value) =>
|
|
680
|
+
String(value || "")
|
|
681
|
+
.replace(/&/g, "&")
|
|
682
|
+
.replace(/</g, "<")
|
|
683
|
+
.replace(/>/g, ">")
|
|
684
|
+
.replace(/"/g, """)
|
|
685
|
+
.replace(/'/g, "'");
|
|
686
|
+
|
|
687
|
+
const renderInlineMarkdown = (value) => {
|
|
688
|
+
let html = escapeHtml(value);
|
|
689
|
+
html = html.replace(/\\*\\*([^*]+)\\*\\*/g, "<strong>$1</strong>");
|
|
690
|
+
html = html.replace(/\\x60([^\\x60]+)\\x60/g, "<code>$1</code>");
|
|
691
|
+
return html;
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
const renderMarkdownBlock = (value) => {
|
|
695
|
+
const lines = String(value || "").split("\\n");
|
|
696
|
+
let html = "";
|
|
697
|
+
let inList = false;
|
|
698
|
+
|
|
699
|
+
for (const rawLine of lines) {
|
|
700
|
+
const line = rawLine.trimEnd();
|
|
701
|
+
const trimmed = line.trim();
|
|
702
|
+
const headingMatch = trimmed.match(/^(#{1,3})\\s+(.+)$/);
|
|
703
|
+
|
|
704
|
+
if (headingMatch) {
|
|
705
|
+
if (inList) {
|
|
706
|
+
html += "</ul>";
|
|
707
|
+
inList = false;
|
|
708
|
+
}
|
|
709
|
+
const level = Math.min(3, headingMatch[1].length);
|
|
710
|
+
const tag = level === 1 ? "h2" : level === 2 ? "h3" : "p";
|
|
711
|
+
html += "<" + tag + ">" + renderInlineMarkdown(headingMatch[2]) + "</" + tag + ">";
|
|
712
|
+
continue;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
if (/^\\s*-\\s+/.test(line)) {
|
|
716
|
+
if (!inList) {
|
|
717
|
+
html += "<ul>";
|
|
718
|
+
inList = true;
|
|
719
|
+
}
|
|
720
|
+
html += "<li>" + renderInlineMarkdown(line.replace(/^\\s*-\\s+/, "")) + "</li>";
|
|
721
|
+
continue;
|
|
722
|
+
}
|
|
723
|
+
if (inList) {
|
|
724
|
+
html += "</ul>";
|
|
725
|
+
inList = false;
|
|
726
|
+
}
|
|
727
|
+
if (trimmed.length === 0) {
|
|
728
|
+
continue;
|
|
729
|
+
}
|
|
730
|
+
html += "<p>" + renderInlineMarkdown(line) + "</p>";
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
if (inList) {
|
|
734
|
+
html += "</ul>";
|
|
735
|
+
}
|
|
736
|
+
return html;
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
const renderAssistantMarkdown = (value) => {
|
|
740
|
+
const source = String(value || "");
|
|
741
|
+
const fenceRegex = /\\x60\\x60\\x60([\\s\\S]*?)\\x60\\x60\\x60/g;
|
|
742
|
+
let html = "";
|
|
743
|
+
let lastIndex = 0;
|
|
744
|
+
let match;
|
|
745
|
+
|
|
746
|
+
while ((match = fenceRegex.exec(source))) {
|
|
747
|
+
const before = source.slice(lastIndex, match.index);
|
|
748
|
+
html += renderMarkdownBlock(before);
|
|
749
|
+
const codeText = String(match[1] || "").replace(/^\\n+|\\n+$/g, "");
|
|
750
|
+
html += "<pre><code>" + escapeHtml(codeText) + "</code></pre>";
|
|
751
|
+
lastIndex = match.index + match[0].length;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
html += renderMarkdownBlock(source.slice(lastIndex));
|
|
755
|
+
return html || "<p></p>";
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
const formatDate = (epoch) => {
|
|
759
|
+
try {
|
|
760
|
+
const date = new Date(epoch);
|
|
761
|
+
const now = new Date();
|
|
762
|
+
const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();
|
|
763
|
+
const startOfDate = new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
|
|
764
|
+
const dayDiff = Math.floor((startOfToday - startOfDate) / 86400000);
|
|
765
|
+
if (dayDiff === 0) {
|
|
766
|
+
return "Today";
|
|
767
|
+
}
|
|
768
|
+
if (dayDiff === 1) {
|
|
769
|
+
return "Yesterday";
|
|
770
|
+
}
|
|
771
|
+
if (dayDiff < 7 && dayDiff > 1) {
|
|
772
|
+
return date.toLocaleDateString(undefined, { weekday: "short" });
|
|
773
|
+
}
|
|
774
|
+
return date.toLocaleDateString(undefined, { month: "short", day: "numeric" });
|
|
775
|
+
} catch {
|
|
776
|
+
return "";
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
|
|
780
|
+
const isMobile = () => window.matchMedia("(max-width: 900px)").matches;
|
|
781
|
+
|
|
782
|
+
const setSidebarOpen = (open) => {
|
|
783
|
+
if (!isMobile()) {
|
|
784
|
+
elements.shell.classList.remove("sidebar-open");
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
elements.shell.classList.toggle("sidebar-open", open);
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
const closeConversationMenu = () => {
|
|
791
|
+
state.openMenuConversationId = null;
|
|
792
|
+
renderConversationList();
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
const renderConversationList = () => {
|
|
796
|
+
elements.list.innerHTML = "";
|
|
797
|
+
for (const c of state.conversations) {
|
|
798
|
+
const item = document.createElement("div");
|
|
799
|
+
item.className = "conversation-item" + (c.conversationId === state.activeConversationId ? " active" : "");
|
|
800
|
+
item.textContent = c.title;
|
|
801
|
+
|
|
802
|
+
const menuBtn = document.createElement("button");
|
|
803
|
+
menuBtn.className = "menu-btn";
|
|
804
|
+
menuBtn.textContent = "\u22EF";
|
|
805
|
+
menuBtn.onclick = (e) => {
|
|
806
|
+
e.stopPropagation();
|
|
807
|
+
state.openMenuConversationId = state.openMenuConversationId === c.conversationId ? null : c.conversationId;
|
|
808
|
+
renderConversationList();
|
|
809
|
+
};
|
|
810
|
+
item.appendChild(menuBtn);
|
|
811
|
+
|
|
812
|
+
item.onclick = async () => {
|
|
813
|
+
state.activeConversationId = c.conversationId;
|
|
814
|
+
state.openMenuConversationId = null;
|
|
815
|
+
renderConversationList();
|
|
816
|
+
await loadConversation(c.conversationId);
|
|
817
|
+
if (isMobile()) setSidebarOpen(false);
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
if (state.openMenuConversationId === c.conversationId) {
|
|
821
|
+
const menu = document.createElement("div");
|
|
822
|
+
menu.className = "conversation-menu";
|
|
823
|
+
const renameBtn = document.createElement("button");
|
|
824
|
+
renameBtn.textContent = "Rename";
|
|
825
|
+
renameBtn.onclick = async (e) => {
|
|
826
|
+
e.stopPropagation();
|
|
827
|
+
const title = prompt("Rename", c.title);
|
|
828
|
+
if (title) {
|
|
829
|
+
await api("/api/conversations/" + c.conversationId, { method: "PATCH", body: JSON.stringify({ title }) });
|
|
830
|
+
state.openMenuConversationId = null;
|
|
831
|
+
await loadConversations();
|
|
832
|
+
if (state.activeConversationId === c.conversationId) await loadConversation(c.conversationId);
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
deleteBtn.onclick = async (e) => {
|
|
836
|
+
e.stopPropagation();
|
|
837
|
+
if (confirm("Delete?")) {
|
|
838
|
+
await api("/api/conversations/" + c.conversationId, { method: "DELETE" });
|
|
839
|
+
if (state.activeConversationId === c.conversationId) {
|
|
840
|
+
state.activeConversationId = null;
|
|
841
|
+
elements.chatTitle.textContent = "";
|
|
842
|
+
renderMessages([]);
|
|
843
|
+
}
|
|
844
|
+
state.openMenuConversationId = null;
|
|
845
|
+
await loadConversations();
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
menu.appendChild(renameBtn);
|
|
849
|
+
menu.appendChild(deleteBtn);
|
|
850
|
+
item.appendChild(menu);
|
|
851
|
+
}
|
|
852
|
+
elements.list.appendChild(item);
|
|
853
|
+
}
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
const renderMessages = (messages, isStreaming = false) => {
|
|
857
|
+
elements.messages.innerHTML = "";
|
|
858
|
+
if (!messages || !messages.length) {
|
|
859
|
+
elements.messages.innerHTML = '<div class="empty-state"><div class="assistant-avatar">A</div><div>How can I help you today?</div></div>';
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
const col = document.createElement("div");
|
|
863
|
+
col.className = "messages-column";
|
|
864
|
+
messages.forEach((m, i) => {
|
|
865
|
+
const row = document.createElement("div");
|
|
866
|
+
row.className = "message-row " + m.role;
|
|
867
|
+
if (m.role === "assistant") {
|
|
868
|
+
const wrap = document.createElement("div");
|
|
869
|
+
wrap.className = "assistant-wrap";
|
|
870
|
+
wrap.innerHTML = '<div class="assistant-avatar">A</div>';
|
|
871
|
+
const content = document.createElement("div");
|
|
872
|
+
content.className = "assistant-content";
|
|
873
|
+
const text = String(m.content || "");
|
|
874
|
+
if (isStreaming && i === messages.length - 1 && !text) {
|
|
875
|
+
content.innerHTML = '<div class="loading-spinner"></div>';
|
|
876
|
+
} else {
|
|
877
|
+
content.innerHTML = renderAssistantMarkdown(text);
|
|
878
|
+
}
|
|
879
|
+
wrap.appendChild(content);
|
|
880
|
+
row.appendChild(wrap);
|
|
881
|
+
} else {
|
|
882
|
+
row.innerHTML = '<div class="user-bubble">' + escapeHtml(m.content) + '</div>';
|
|
883
|
+
}
|
|
884
|
+
col.appendChild(row);
|
|
885
|
+
});
|
|
886
|
+
elements.messages.appendChild(col);
|
|
887
|
+
elements.messages.scrollTop = elements.messages.scrollHeight;
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
const loadConversations = async () => {
|
|
891
|
+
const payload = await api("/api/conversations");
|
|
892
|
+
state.conversations = payload.conversations || [];
|
|
893
|
+
renderConversationList();
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
const loadConversation = async (conversationId) => {
|
|
897
|
+
const payload = await api("/api/conversations/" + encodeURIComponent(conversationId));
|
|
898
|
+
elements.chatTitle.textContent = payload.conversation.title;
|
|
899
|
+
renderMessages(payload.conversation.messages);
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
const createConversation = async (title) => {
|
|
903
|
+
const payload = await api("/api/conversations", {
|
|
904
|
+
method: "POST",
|
|
905
|
+
body: JSON.stringify(title ? { title } : {})
|
|
906
|
+
});
|
|
907
|
+
state.activeConversationId = payload.conversation.conversationId;
|
|
908
|
+
state.openMenuConversationId = null;
|
|
909
|
+
await loadConversations();
|
|
910
|
+
await loadConversation(state.activeConversationId);
|
|
911
|
+
return state.activeConversationId;
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
const parseSseChunk = (buffer, onEvent) => {
|
|
915
|
+
let rest = buffer;
|
|
916
|
+
while (true) {
|
|
917
|
+
const index = rest.indexOf("\\n\\n");
|
|
918
|
+
if (index < 0) {
|
|
919
|
+
return rest;
|
|
920
|
+
}
|
|
921
|
+
const raw = rest.slice(0, index);
|
|
922
|
+
rest = rest.slice(index + 2);
|
|
923
|
+
const lines = raw.split("\\n");
|
|
924
|
+
let eventName = "message";
|
|
925
|
+
let data = "";
|
|
926
|
+
for (const line of lines) {
|
|
927
|
+
if (line.startsWith("event:")) {
|
|
928
|
+
eventName = line.slice(6).trim();
|
|
929
|
+
} else if (line.startsWith("data:")) {
|
|
930
|
+
data += line.slice(5).trim();
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
if (data) {
|
|
934
|
+
try {
|
|
935
|
+
onEvent(eventName, JSON.parse(data));
|
|
936
|
+
} catch {}
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
|
|
941
|
+
const setStreaming = (value) => {
|
|
942
|
+
state.isStreaming = value;
|
|
943
|
+
elements.send.disabled = value;
|
|
944
|
+
elements.connectionStatus.classList.toggle("hidden", !value);
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
const autoResizePrompt = () => {
|
|
948
|
+
const el = elements.prompt;
|
|
949
|
+
el.style.height = "auto";
|
|
950
|
+
const scrollHeight = el.scrollHeight;
|
|
951
|
+
const nextHeight = Math.min(scrollHeight, 200);
|
|
952
|
+
el.style.height = nextHeight + "px";
|
|
953
|
+
el.style.overflowY = scrollHeight > 200 ? "auto" : "hidden";
|
|
954
|
+
};
|
|
955
|
+
|
|
956
|
+
const sendMessage = async (text) => {
|
|
957
|
+
const messageText = (text || "").trim();
|
|
958
|
+
if (!messageText || state.isStreaming) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
let conversationId = state.activeConversationId;
|
|
962
|
+
if (!conversationId) {
|
|
963
|
+
conversationId = await createConversation(messageText);
|
|
964
|
+
}
|
|
965
|
+
const existingPayload = await api("/api/conversations/" + encodeURIComponent(conversationId));
|
|
966
|
+
const localMessages = [...(existingPayload.conversation.messages || []), { role: "user", content: messageText }];
|
|
967
|
+
let assistantMessage = { role: "assistant", content: "" };
|
|
968
|
+
localMessages.push(assistantMessage);
|
|
969
|
+
renderMessages(localMessages, true);
|
|
970
|
+
setStreaming(true);
|
|
971
|
+
try {
|
|
972
|
+
const response = await fetch("/api/conversations/" + encodeURIComponent(conversationId) + "/messages", {
|
|
973
|
+
method: "POST",
|
|
974
|
+
credentials: "include",
|
|
975
|
+
headers: { "Content-Type": "application/json", "x-csrf-token": state.csrfToken },
|
|
976
|
+
body: JSON.stringify({ message: messageText })
|
|
977
|
+
});
|
|
978
|
+
if (!response.ok || !response.body) {
|
|
979
|
+
throw new Error("Failed to stream response");
|
|
980
|
+
}
|
|
981
|
+
const reader = response.body.getReader();
|
|
982
|
+
const decoder = new TextDecoder();
|
|
983
|
+
let buffer = "";
|
|
984
|
+
while (true) {
|
|
985
|
+
const { value, done } = await reader.read();
|
|
986
|
+
if (done) {
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
buffer += decoder.decode(value, { stream: true });
|
|
990
|
+
buffer = parseSseChunk(buffer, (eventName, payload) => {
|
|
991
|
+
if (eventName === "model:chunk") {
|
|
992
|
+
assistantMessage.content += String(payload.content || "");
|
|
993
|
+
renderMessages(localMessages, true);
|
|
994
|
+
}
|
|
995
|
+
if (eventName === "run:completed" && (!assistantMessage.content || assistantMessage.content.length === 0)) {
|
|
996
|
+
assistantMessage.content = String(payload.result?.response || "");
|
|
997
|
+
renderMessages(localMessages, false);
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
await loadConversations();
|
|
1002
|
+
await loadConversation(conversationId);
|
|
1003
|
+
} finally {
|
|
1004
|
+
setStreaming(false);
|
|
1005
|
+
elements.prompt.focus();
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
const requireAuth = async () => {
|
|
1010
|
+
try {
|
|
1011
|
+
const session = await api("/api/auth/session");
|
|
1012
|
+
if (!session.authenticated) {
|
|
1013
|
+
elements.auth.classList.remove("hidden");
|
|
1014
|
+
elements.app.classList.add("hidden");
|
|
1015
|
+
return false;
|
|
1016
|
+
}
|
|
1017
|
+
state.csrfToken = session.csrfToken || "";
|
|
1018
|
+
elements.auth.classList.add("hidden");
|
|
1019
|
+
elements.app.classList.remove("hidden");
|
|
1020
|
+
return true;
|
|
1021
|
+
} catch {
|
|
1022
|
+
elements.auth.classList.remove("hidden");
|
|
1023
|
+
elements.app.classList.add("hidden");
|
|
1024
|
+
return false;
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1028
|
+
elements.loginForm.addEventListener("submit", async (event) => {
|
|
1029
|
+
event.preventDefault();
|
|
1030
|
+
elements.loginError.textContent = "";
|
|
1031
|
+
try {
|
|
1032
|
+
const result = await api("/api/auth/login", {
|
|
1033
|
+
method: "POST",
|
|
1034
|
+
body: JSON.stringify({ passphrase: elements.passphrase.value || "" })
|
|
1035
|
+
});
|
|
1036
|
+
state.csrfToken = result.csrfToken || "";
|
|
1037
|
+
elements.passphrase.value = "";
|
|
1038
|
+
elements.auth.classList.add("hidden");
|
|
1039
|
+
elements.app.classList.remove("hidden");
|
|
1040
|
+
await loadConversations();
|
|
1041
|
+
if (state.conversations[0]) {
|
|
1042
|
+
state.activeConversationId = state.conversations[0].conversationId;
|
|
1043
|
+
await loadConversation(state.activeConversationId);
|
|
1044
|
+
}
|
|
1045
|
+
} catch (error) {
|
|
1046
|
+
elements.loginError.textContent = error.message || "Login failed";
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
elements.newChat.addEventListener("click", async () => {
|
|
1051
|
+
await createConversation();
|
|
1052
|
+
if (isMobile()) {
|
|
1053
|
+
setSidebarOpen(false);
|
|
1054
|
+
}
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
elements.prompt.addEventListener("input", () => {
|
|
1058
|
+
autoResizePrompt();
|
|
1059
|
+
});
|
|
1060
|
+
|
|
1061
|
+
elements.prompt.addEventListener("keydown", (event) => {
|
|
1062
|
+
if (event.key === "Enter" && !event.shiftKey) {
|
|
1063
|
+
event.preventDefault();
|
|
1064
|
+
elements.composer.requestSubmit();
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
elements.sidebarToggle.addEventListener("click", () => {
|
|
1069
|
+
if (isMobile()) setSidebarOpen(!elements.shell.classList.contains("sidebar-open"));
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
elements.sidebarBackdrop.addEventListener("click", () => setSidebarOpen(false));
|
|
1073
|
+
|
|
1074
|
+
elements.logout.addEventListener("click", async () => {
|
|
1075
|
+
await api("/api/auth/logout", { method: "POST" });
|
|
1076
|
+
state.activeConversationId = null;
|
|
1077
|
+
state.openMenuConversationId = null;
|
|
1078
|
+
state.conversations = [];
|
|
1079
|
+
state.csrfToken = "";
|
|
1080
|
+
await requireAuth();
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
elements.composer.addEventListener("submit", async (event) => {
|
|
1084
|
+
event.preventDefault();
|
|
1085
|
+
const value = elements.prompt.value;
|
|
1086
|
+
elements.prompt.value = "";
|
|
1087
|
+
autoResizePrompt();
|
|
1088
|
+
await sendMessage(value);
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
document.addEventListener("click", (event) => {
|
|
1092
|
+
if (!(event.target instanceof Node)) {
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
if (!event.target.closest(".conversation-item")) {
|
|
1096
|
+
if (state.openMenuConversationId) {
|
|
1097
|
+
closeConversationMenu();
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
window.addEventListener("resize", () => {
|
|
1103
|
+
setSidebarOpen(false);
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
(async () => {
|
|
1107
|
+
const authenticated = await requireAuth();
|
|
1108
|
+
if (!authenticated) {
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
await loadConversations();
|
|
1112
|
+
if (state.conversations[0]) {
|
|
1113
|
+
state.activeConversationId = state.conversations[0].conversationId;
|
|
1114
|
+
await loadConversation(state.activeConversationId);
|
|
1115
|
+
renderConversationList();
|
|
1116
|
+
}
|
|
1117
|
+
autoResizePrompt();
|
|
1118
|
+
})();
|
|
1119
|
+
</script>
|
|
1120
|
+
</body>
|
|
1121
|
+
</html>`;
|
|
1122
|
+
|
|
1123
|
+
export {
|
|
1124
|
+
FileConversationStore,
|
|
1125
|
+
SessionStore,
|
|
1126
|
+
LoginRateLimiter,
|
|
1127
|
+
parseCookies,
|
|
1128
|
+
setCookie,
|
|
1129
|
+
verifyPassphrase,
|
|
1130
|
+
getRequestIp,
|
|
1131
|
+
inferConversationTitle,
|
|
1132
|
+
renderWebUiHtml
|
|
1133
|
+
};
|