@testmuai/kane-cli 0.10.0-rc.3 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatSurface-FIYDTZSI.js +2 -0
- package/dist/{ChromeProfilePicker-M4WXOB5O.js → ChromeProfilePicker-Q6FIGVYU.js} +1 -1
- package/dist/{CliFeedbackPrompt-6MJA7DF6.js → CliFeedbackPrompt-2NV2G65E.js} +1 -1
- package/dist/{CliUploadProgress-6NLS7XHH.js → CliUploadProgress-JZ5FXODE.js} +1 -1
- package/dist/{ConfigView-O4WKZ5PU.js → ConfigView-TZ4YINOE.js} +1 -1
- package/dist/EvidenceViewOffer-LKPN5BHX.js +2 -0
- package/dist/FolderPicker-H5K74PCH.js +2 -0
- package/dist/InfoBox-DNSOAK5L.js +2 -0
- package/dist/{LinksBox-DXP66H3H.js → LinksBox-32TZOANP.js} +1 -1
- package/dist/{ProfilesView-TWOY5PVC.js → ProfilesView-UC4MPM54.js} +1 -1
- package/dist/ProjectPicker-ZJ5RW6XL.js +2 -0
- package/dist/SaveSessionPrompt-F327WC7A.js +2 -0
- package/dist/SingleShotApp-OMLRYOSI.js +2 -0
- package/dist/{SummaryBox-IA2KS6GT.js → SummaryBox-XGFO5X76.js} +1 -1
- package/dist/TestMdRunView-ZZ77QTAQ.js +2 -0
- package/dist/TestrunEvidenceTable-G7MPF55X.js +2 -0
- package/dist/{WhoamiView-SNL75TEF.js → WhoamiView-4XIJXMTU.js} +1 -1
- package/dist/{app-download-UI4ABEIX.js → app-download-XEDO3EMV.js} +1 -1
- package/dist/{assurance-job-FFSSS4XV.js → assurance-job-MD65GQLC.js} +1 -1
- package/dist/{auth-7Z54TMQQ.js → auth-WBIEHHDS.js} +1 -1
- package/dist/{binary-THPLXCOD.js → binary-NVYLR36K.js} +1 -1
- package/dist/bind-H3ALI2NG.js +2 -0
- package/dist/bootstrap-JEVSVPQ2.js +2 -0
- package/dist/bridge-2UHJOVLX.js +2 -0
- package/dist/{catalog-MYPS2BXY.js → catalog-5UYBWA4W.js} +1 -1
- package/dist/catalog-client-VVKV4JKW.js +2 -0
- package/dist/{changelog-SU674BVE.js → changelog-FPWJXERY.js} +1 -1
- package/dist/chat-committer-ZKEKJA2R.js +2 -0
- package/dist/chat-controller-FXRJXUG3.js +2 -0
- package/dist/child-JHYENXE7.js +2 -0
- package/dist/chunk-226AGYHB.js +87 -0
- package/dist/{chunk-MNBGG4H3.js → chunk-23DKB2MT.js} +1 -1
- package/dist/{chunk-EECDDDSB.js → chunk-2COXO5LQ.js} +1 -1
- package/dist/{chunk-LUR7JFPP.js → chunk-2GEAKFAV.js} +1 -1
- package/dist/{chunk-7SY34IIL.js → chunk-2QKBXRLI.js} +1 -1
- package/dist/{chunk-AVSMXDTX.js → chunk-2ULYGALF.js} +1 -1
- package/dist/{chunk-JNSWKGTB.js → chunk-32HED7X2.js} +1 -1
- package/dist/{chunk-GRURFGBP.js → chunk-32MFECUA.js} +1 -1
- package/dist/{chunk-MYVKUJGS.js → chunk-35BG2EMW.js} +1 -1
- package/dist/{chunk-3GXN6VF6.js → chunk-3KY7HHQU.js} +1 -1
- package/dist/{chunk-7NPTL66J.js → chunk-3V4J65GN.js} +1 -1
- package/dist/{chunk-457Y5TEC.js → chunk-3YIA3DSL.js} +1 -1
- package/dist/{chunk-36N3EHW5.js → chunk-44SIFDNY.js} +1 -1
- package/dist/{chunk-MEKPGQAM.js → chunk-45NM23EQ.js} +2 -2
- package/dist/{chunk-I2MC6VVX.js → chunk-4C7WVQOD.js} +1 -1
- package/dist/{chunk-TU42YZOJ.js → chunk-4HARMERK.js} +1 -1
- package/dist/{chunk-ICLUC44J.js → chunk-4HYPMGDF.js} +1 -1
- package/dist/{chunk-7KX2BHKG.js → chunk-4KCYNP2K.js} +1 -1
- package/dist/{chunk-IJ2AHSWW.js → chunk-4LGQHTXM.js} +1 -1
- package/dist/{chunk-ETZMFRD6.js → chunk-4NEPHIAO.js} +1 -1
- package/dist/{chunk-3E4ZO73O.js → chunk-54NJJVG5.js} +1 -1
- package/dist/{chunk-734ORT6O.js → chunk-5F44KH3R.js} +1 -1
- package/dist/{chunk-E6KSRQXL.js → chunk-5F5IVART.js} +1 -1
- package/dist/{chunk-EBPRPNSA.js → chunk-5KJU4MG4.js} +1 -1
- package/dist/{chunk-JZP3Y4ZM.js → chunk-5MFPQYW3.js} +1 -1
- package/dist/{chunk-QENCC2ZS.js → chunk-5WLXAQ4H.js} +1 -1
- package/dist/{chunk-RFEON5GN.js → chunk-5XVWT6UK.js} +1 -1
- package/dist/{chunk-W4QSZNMB.js → chunk-6CS23F3E.js} +1 -1
- package/dist/{chunk-DZOYYWOW.js → chunk-6JUS2ULI.js} +1 -1
- package/dist/chunk-6K5BEEAJ.js +2 -0
- package/dist/{chunk-4QFTHUJA.js → chunk-6LEHGRRG.js} +1 -1
- package/dist/{chunk-LSDJOVWW.js → chunk-6SD4XTYC.js} +1 -1
- package/dist/{chunk-TW5AA5A7.js → chunk-6SWHEBPR.js} +1 -1
- package/dist/{chunk-URH4FX3H.js → chunk-6YBH3WUW.js} +1 -1
- package/dist/{chunk-ZAFJQ3SM.js → chunk-73HMW2WA.js} +1 -1
- package/dist/{chunk-NXAJBSIF.js → chunk-75FF7J5R.js} +1 -1
- package/dist/{chunk-P3JXJ4BW.js → chunk-7DLDADQR.js} +1 -1
- package/dist/{chunk-7NCJMWFX.js → chunk-7LYLJ75Z.js} +1 -1
- package/dist/chunk-7O2FIZB7.js +9 -0
- package/dist/chunk-7PCLHURF.js +101 -0
- package/dist/{chunk-PUVMC4PX.js → chunk-7V34ZMMS.js} +1 -1
- package/dist/{chunk-AEWNWAXW.js → chunk-7XJNYLQW.js} +2 -2
- package/dist/{chunk-WEIPY3CI.js → chunk-7ZR5CQY3.js} +1 -1
- package/dist/{chunk-2DYHAP4E.js → chunk-A474TUCE.js} +1 -1
- package/dist/chunk-A4ZV2SHL.js +5 -0
- package/dist/chunk-A7IMHUFY.js +27 -0
- package/dist/{chunk-XLEGGC4Y.js → chunk-ABMM37L2.js} +1 -1
- package/dist/{chunk-NIVFEACM.js → chunk-AUSLHNXQ.js} +1 -1
- package/dist/{chunk-YPFQ4UGF.js → chunk-B226SFOV.js} +1 -1
- package/dist/{chunk-DJC7NTLA.js → chunk-B57ZRHEQ.js} +1 -1
- package/dist/{chunk-CGITGJ3I.js → chunk-BHQIH2FE.js} +1 -1
- package/dist/{chunk-FWUPJORV.js → chunk-BJT6PZXL.js} +1 -1
- package/dist/{chunk-VX657KIK.js → chunk-C6P6YUCR.js} +1 -1
- package/dist/chunk-CB344EDO.js +2 -0
- package/dist/chunk-CCOD4GQJ.js +2 -0
- package/dist/{chunk-ZFM77AQU.js → chunk-CQDCNP7V.js} +1 -1
- package/dist/{chunk-VUFIL5VR.js → chunk-D4QXYAYA.js} +2 -2
- package/dist/{chunk-Y7E5L42F.js → chunk-DLP5S3TO.js} +1 -1
- package/dist/{chunk-35ECWCCK.js → chunk-DXIQVBMI.js} +1 -1
- package/dist/chunk-DXLZCJH5.js +7 -0
- package/dist/{chunk-OJ33Q6DU.js → chunk-E4GIGM5V.js} +1 -1
- package/dist/{chunk-I4WXALQR.js → chunk-EAWU2TOG.js} +1 -1
- package/dist/{chunk-ACMBMZDQ.js → chunk-EEOAU43D.js} +1 -1
- package/dist/{chunk-MYZHOBS4.js → chunk-EHB55V23.js} +1 -1
- package/dist/{chunk-UYDHOHSZ.js → chunk-ENRFXGID.js} +1 -1
- package/dist/{chunk-RTVHJ23A.js → chunk-ET5EK2CM.js} +1 -1
- package/dist/{chunk-EF47KRUK.js → chunk-EZMRWXRT.js} +1 -1
- package/dist/chunk-FAMQ4DHU.js +2 -0
- package/dist/{chunk-C2RUDJ46.js → chunk-FI2DVNRT.js} +1 -1
- package/dist/{chunk-AUJSC7PU.js → chunk-FNUGDPTS.js} +1 -1
- package/dist/{chunk-VLDCHFXF.js → chunk-FOLUB336.js} +1 -1
- package/dist/{chunk-NZ6AV2TA.js → chunk-FYPIF3BE.js} +1 -1
- package/dist/{chunk-HHW6MRU3.js → chunk-G4K3TP2I.js} +1 -1
- package/dist/{chunk-P2ZQDQDB.js → chunk-GAKBHNC4.js} +1 -1
- package/dist/{chunk-DPGOAFKF.js → chunk-GBQ4K25P.js} +1 -1
- package/dist/{chunk-O3HHTKZ5.js → chunk-GEZVC4S3.js} +1 -1
- package/dist/chunk-GJ7MO2FW.js +9 -0
- package/dist/{chunk-EZN7CF45.js → chunk-GJXO6FF7.js} +1 -1
- package/dist/{chunk-QDFY5GGO.js → chunk-GLM5UGTF.js} +1 -1
- package/dist/{chunk-HK62JVQM.js → chunk-GQARXS6F.js} +1 -1
- package/dist/{chunk-I4RVVBG3.js → chunk-GT3JDX5H.js} +1 -1
- package/dist/{chunk-YLXWAY7D.js → chunk-GZQAETB2.js} +1 -1
- package/dist/{chunk-7HMSMAUG.js → chunk-H4TIVILC.js} +5 -5
- package/dist/{chunk-VXGN3IV7.js → chunk-HG2ILWCE.js} +1 -1
- package/dist/{chunk-M43WH5DQ.js → chunk-HHOVANJ7.js} +1 -1
- package/dist/{chunk-CM4CHYSN.js → chunk-HM6LZ2KM.js} +1 -1
- package/dist/{chunk-QDXKEOKI.js → chunk-HNF3PWF3.js} +6 -6
- package/dist/{chunk-R7KXAISS.js → chunk-HVOXMCKE.js} +1 -1
- package/dist/{chunk-D7U2M26S.js → chunk-HWPWCCEV.js} +1 -1
- package/dist/{chunk-XRNQSXOM.js → chunk-HX5OLRKU.js} +2 -2
- package/dist/{chunk-4I7YN6YY.js → chunk-HYJVYYAZ.js} +2 -2
- package/dist/{chunk-CUXY6KQ2.js → chunk-I52NWH4U.js} +1 -1
- package/dist/{chunk-IGEAET7M.js → chunk-IB5WG5YY.js} +1 -1
- package/dist/{chunk-LAOTVZHV.js → chunk-IH73ZCBB.js} +1 -1
- package/dist/{chunk-TU7TVFBK.js → chunk-IT5JVCZN.js} +1 -1
- package/dist/{chunk-54XA5MZH.js → chunk-IZ66FKPC.js} +1 -1
- package/dist/{chunk-44B6THYK.js → chunk-JNPFEBUR.js} +1 -1
- package/dist/{chunk-RX6776AI.js → chunk-JTNEF5ZP.js} +1 -1
- package/dist/{chunk-QBYENBMB.js → chunk-JUVY6PHY.js} +1 -1
- package/dist/{chunk-5AKJPYUW.js → chunk-K4K2BGQC.js} +3 -3
- package/dist/{chunk-HJMCXSUJ.js → chunk-K75WIRI5.js} +1 -1
- package/dist/{chunk-FSYOTRMC.js → chunk-KKLCXRW6.js} +1 -1
- package/dist/{chunk-7YT4TTKL.js → chunk-KN7GZWKK.js} +1 -1
- package/dist/{chunk-ZTHYAHDN.js → chunk-L3BUPFAQ.js} +4 -4
- package/dist/{chunk-7XBNMOH4.js → chunk-LLQWEGXD.js} +1 -1
- package/dist/chunk-LTPOMMAB.js +2 -0
- package/dist/{chunk-CCP4X75B.js → chunk-LWCP4GLY.js} +1 -1
- package/dist/chunk-LXCTV75T.js +12 -0
- package/dist/{chunk-RDP7GWSY.js → chunk-LZGAFKYH.js} +1 -1
- package/dist/{chunk-3QICDXY5.js → chunk-LZPYIFHZ.js} +1 -1
- package/dist/{chunk-3OQW2GTA.js → chunk-M3TFOFUQ.js} +1 -1
- package/dist/{chunk-V7USCQWO.js → chunk-M7Y5GGVJ.js} +1 -1
- package/dist/{chunk-SMTBOSEJ.js → chunk-MEMXFTLD.js} +1 -1
- package/dist/{chunk-D756UWY2.js → chunk-MINDIQET.js} +1 -1
- package/dist/{chunk-ZTRRFG52.js → chunk-MP6NCJFE.js} +1 -1
- package/dist/{chunk-GXKY5A46.js → chunk-MSYRAPDK.js} +1 -1
- package/dist/{chunk-HJLMH7ZM.js → chunk-MUX2A37P.js} +1 -1
- package/dist/{chunk-YHFZFV3A.js → chunk-NCP54AIQ.js} +9 -9
- package/dist/{chunk-ZU4W2QGM.js → chunk-NVD2MXHQ.js} +1 -1
- package/dist/{chunk-FWDUVFS6.js → chunk-O2Y46A3G.js} +17 -17
- package/dist/{chunk-XZGEN4NU.js → chunk-O3TXAMFW.js} +1 -1
- package/dist/{chunk-YGRULEZY.js → chunk-O5KTMDTH.js} +1 -1
- package/dist/{chunk-PAWQ4AKN.js → chunk-OK6NLITG.js} +1 -1
- package/dist/{chunk-7AET4JKQ.js → chunk-OKA6FPJM.js} +1 -1
- package/dist/{chunk-3YTCKCBG.js → chunk-OVNTCBNS.js} +1 -1
- package/dist/{chunk-YQ5C6UDG.js → chunk-P4VFC6HO.js} +1 -1
- package/dist/{chunk-LQQNPMOD.js → chunk-PC22QRIY.js} +1 -1
- package/dist/{chunk-XQMWHPZI.js → chunk-PEUIHME2.js} +1 -1
- package/dist/{chunk-UEE3RZN4.js → chunk-PI7OXS62.js} +1 -1
- package/dist/{chunk-D7TKE7LK.js → chunk-POA336CU.js} +1 -1
- package/dist/{chunk-WZXPF3BI.js → chunk-PR5EGLEI.js} +1 -1
- package/dist/{chunk-YIKF4ERQ.js → chunk-PRBWZXFA.js} +2 -2
- package/dist/{chunk-XZYA7DNH.js → chunk-PVN64537.js} +1 -1
- package/dist/{chunk-VSVWNRI2.js → chunk-PWNYTIVA.js} +1 -1
- package/dist/chunk-Q4JV4U65.js +161 -0
- package/dist/{chunk-LUZBGTYB.js → chunk-Q5AKIQIE.js} +1 -1
- package/dist/{chunk-6EB5VRAN.js → chunk-QB77LRF4.js} +1 -1
- package/dist/{chunk-GQRU3B54.js → chunk-QUNIY6NN.js} +1 -1
- package/dist/{chunk-KODJVOCN.js → chunk-QVMXL675.js} +1 -1
- package/dist/{chunk-LCSJ7GOG.js → chunk-R6TFRAMZ.js} +1 -1
- package/dist/{chunk-4YW767UV.js → chunk-RAVAJZV2.js} +7 -7
- package/dist/{chunk-DDZLCAEO.js → chunk-RDAIOJCR.js} +1 -1
- package/dist/{chunk-RPRXRKKR.js → chunk-RQKMSNEU.js} +1 -1
- package/dist/{chunk-ECPFI75W.js → chunk-RRKYHUOD.js} +1 -1
- package/dist/{chunk-3RJHXOZH.js → chunk-S7XCOBYD.js} +1 -1
- package/dist/{chunk-Q3C6NDGI.js → chunk-SALZ6WSF.js} +1 -1
- package/dist/{chunk-ZFMRQ57Y.js → chunk-SIHX5FW5.js} +1 -1
- package/dist/{chunk-FIP5L6LV.js → chunk-SSOUYKVG.js} +1 -1
- package/dist/{chunk-TNORODUF.js → chunk-SVIIUKJ2.js} +1 -1
- package/dist/{chunk-7RWP4Y3H.js → chunk-T77LTLAD.js} +1 -1
- package/dist/{chunk-NLZZLANH.js → chunk-TAY7J5VS.js} +1 -1
- package/dist/chunk-TD6GCEIK.js +2 -0
- package/dist/{chunk-LKQFG4RW.js → chunk-TM6VLC6V.js} +1 -1
- package/dist/{chunk-YAW6JW6D.js → chunk-TMH4TPMB.js} +1 -1
- package/dist/{chunk-OFSDB7B4.js → chunk-TU2KPOW2.js} +2 -2
- package/dist/{chunk-3BSYOCSW.js → chunk-U2VYTVKV.js} +1 -1
- package/dist/{chunk-LIGTP3A3.js → chunk-UCVP7ZY4.js} +1 -1
- package/dist/{chunk-RHGW7B5Q.js → chunk-UICJ2KLJ.js} +1 -1
- package/dist/chunk-UJLULWSR.js +21 -0
- package/dist/{chunk-OCDBTAYS.js → chunk-UMNCM4RJ.js} +2 -2
- package/dist/{chunk-WOSANGV6.js → chunk-UWPG5MWM.js} +1 -1
- package/dist/{chunk-W6HZF56M.js → chunk-V3OZJO7Y.js} +1 -1
- package/dist/{chunk-3F5FMH76.js → chunk-VE4HLIGA.js} +1 -1
- package/dist/{chunk-RF37IJNN.js → chunk-W2HRX3DR.js} +1 -1
- package/dist/{chunk-NXRF7FFS.js → chunk-W54BX6HC.js} +1 -1
- package/dist/{chunk-IZ65ZPWY.js → chunk-W5HFUBXD.js} +1 -1
- package/dist/{chunk-HAW5WEKT.js → chunk-WEJR2V7R.js} +1 -1
- package/dist/{chunk-F5NHG7VB.js → chunk-X3A4QPA3.js} +1 -1
- package/dist/{chunk-AVI5H4UM.js → chunk-X52YIWGG.js} +1 -1
- package/dist/{chunk-72RC7JSA.js → chunk-X6FCXBXU.js} +1 -1
- package/dist/{chunk-PZA3BSOE.js → chunk-X7S7IGCV.js} +1 -1
- package/dist/{chunk-6DZX5HLZ.js → chunk-XCUF5AVM.js} +1 -1
- package/dist/{chunk-F22K3RRX.js → chunk-XHFU5TGS.js} +1 -1
- package/dist/chunk-XNXJXGVB.js +4 -0
- package/dist/{chunk-C62QWG4B.js → chunk-XZ6J3Y2W.js} +1 -1
- package/dist/{chunk-JGRXMTME.js → chunk-YDB72F4K.js} +1 -1
- package/dist/{chunk-7DFBOVUB.js → chunk-YJAQZMJT.js} +1 -1
- package/dist/chunk-YO6SNXBJ.js +2 -0
- package/dist/{chunk-AZLNLHUA.js → chunk-Z24SD2EJ.js} +1 -1
- package/dist/{chunk-HQ2E2XCU.js → chunk-Z36KVIRR.js} +1 -1
- package/dist/{chunk-WAOUE7MP.js → chunk-Z6SI7YNV.js} +1 -1
- package/dist/{chunk-6NFOH4AC.js → chunk-ZAQGIC33.js} +1 -1
- package/dist/{chunk-6UVIY56J.js → chunk-ZCL7XIVS.js} +1 -1
- package/dist/{chunk-UUJIGOEO.js → chunk-ZDCXWEQG.js} +1 -1
- package/dist/{chunk-SGPAM5DZ.js → chunk-ZDQYGLCZ.js} +1 -1
- package/dist/{chunk-42PALMW2.js → chunk-ZHAMVLQZ.js} +1 -1
- package/dist/{chunk-W7FLXW6Q.js → chunk-ZMWTRXFH.js} +1 -1
- package/dist/{chunk-KXHJMAZU.js → chunk-ZO3ZAMUU.js} +2 -2
- package/dist/{chunk-L5DALV5N.js → chunk-ZZZGTDYE.js} +1 -1
- package/dist/commands-R5AYK6XM.js +2 -0
- package/dist/{committer-JGY66PFM.js → committer-UO3B3S5Y.js} +1 -1
- package/dist/{config-754B73XK.js → config-YMHI3H3Y.js} +1 -1
- package/dist/cover-cmd-DVQIGFDY.js +2 -0
- package/dist/{credentials-F7DYLVWY.js → credentials-BCR73VGS.js} +1 -1
- package/dist/{deps-bundle-PW3WEQJ7.js → deps-bundle-6WLX44OA.js} +1 -1
- package/dist/{deps-resolve-SQYVN76L.js → deps-resolve-DSAKPZ3T.js} +1 -1
- package/dist/{design-chat-F3OEZPNJ.js → design-chat-YUI2JPO6.js} +1 -1
- package/dist/design-committer-7YIPFKMO.js +2 -0
- package/dist/design-headless-KIP6R7UV.js +2 -0
- package/dist/{design-remote-2BEGCVCX.js → design-remote-XMSHDDUX.js} +2 -2
- package/dist/device-env-K7J5NN66.js +2 -0
- package/dist/dispatch-BV6XMCN3.js +2 -0
- package/dist/{doctor-XY26Z35T.js → doctor-PGTNOMSP.js} +1 -1
- package/dist/{docx-convert-6IZO5P5K.js → docx-convert-DO5AQYD3.js} +1 -1
- package/dist/{dossier-NROC2MCY.js → dossier-5XKNAK6Q.js} +1 -1
- package/dist/evidence-RO3RDZXO.js +2 -0
- package/dist/evidence-presentation-LSFOZGLH.js +2 -0
- package/dist/evolve-cmd-U2ALVGMT.js +2 -0
- package/dist/evolve-remote-K2MCCVMM.js +2 -0
- package/dist/{exit-manager-EDHCETUN.js → exit-manager-EGWAZHCR.js} +1 -1
- package/dist/{explain-cmd-VYAANFFZ.js → explain-cmd-KNDORU2D.js} +1 -1
- package/dist/{explain-cmd-OP5I5W3O.js → explain-cmd-UWK5YVXG.js} +1 -1
- package/dist/explore-S2BGQUIF.js +2 -0
- package/dist/{explore-context-tty-RZ7D2TBV.js → explore-context-tty-WJHUSP3A.js} +1 -1
- package/dist/{explore-entry-EKXJ67BD.js → explore-entry-3EX2T3NS.js} +4 -4
- package/dist/{explore-live-2YVRAQZO.js → explore-live-TRY5A2ME.js} +1 -1
- package/dist/{explore-run-tty-D47FGPX7.js → explore-run-tty-ZV5XFKZA.js} +2 -2
- package/dist/{extract-bind-W2NET364.js → extract-bind-TXUBMK3T.js} +3 -3
- package/dist/extract-chat-VPYDGQKO.js +2 -0
- package/dist/{extract-cmd-FTFLETOP.js → extract-cmd-YUOYMVF5.js} +2 -2
- package/dist/extract-headless-UWTAPOET.js +2 -0
- package/dist/{feeder-NY45UFJK.js → feeder-NGWIPZ26.js} +1 -1
- package/dist/folder-flags-WV7UV3JG.js +2 -0
- package/dist/gaps-cmd-PFV3FZCM.js +3 -0
- package/dist/gate-7ALXLCNB.js +2 -0
- package/dist/gate-NB5CJMTN.js +2 -0
- package/dist/{generate-headless-RURIEKVS.js → generate-headless-KMBBZTLS.js} +2 -2
- package/dist/hold-passthrough-JGHWMYDM.js +2 -0
- package/dist/impact-cmd-PW33L5RF.js +11 -0
- package/dist/index.js +4150 -180
- package/dist/ingest-ZHHHBUXR.js +2 -0
- package/dist/{ingest-cmd-4G2AK4Y2.js → ingest-cmd-MXYILQLV.js} +3 -3
- package/dist/ingest-remote-2EEJP6ML.js +2 -0
- package/dist/install-7J34AYB6.js +2 -0
- package/dist/{interactive-bind-SI2ZS55Q.js → interactive-bind-FDWJUTI6.js} +4 -4
- package/dist/{interactive-remote-J56EWJGA.js → interactive-remote-O2Q2FNOH.js} +2 -2
- package/dist/lane-CNGO7LH5.js +2 -0
- package/dist/lattice-auth-TXNDLHM6.js +2 -0
- package/dist/{lifecycle-cmd-HJ37LTXE.js → lifecycle-cmd-GFHDBRXX.js} +1 -1
- package/dist/{list-cmd-6XL2FYLQ.js → list-cmd-RR75PMPE.js} +1 -1
- package/dist/list-commands-3QGZWJ5P.js +2 -0
- package/dist/{list-remote-LXPQNXYN.js → list-remote-AA3VSWOI.js} +1 -1
- package/dist/{locks-cmd-JJ2QNTNY.js → locks-cmd-AZKCSGHI.js} +1 -1
- package/dist/{logical-ids-RXAQJZ3T.js → logical-ids-74PLU3VR.js} +1 -1
- package/dist/login-flow-ZQ6UFTS2.js +2 -0
- package/dist/{maintenance-cmd-BXXHP36K.js → maintenance-cmd-OHGVARQ2.js} +1 -1
- package/dist/{mobile-prompts-CECJ5UY2.js → mobile-prompts-FZRKLLTN.js} +1 -1
- package/dist/{objective-variable-gate-3Z7DNVVC.js → objective-variable-gate-V5HHFOUS.js} +1 -1
- package/dist/{onboarding-PDVYMTY5.js → onboarding-NXGMV3VG.js} +1 -1
- package/dist/open-provider-XDJKT3W3.js +2 -0
- package/dist/pdf-convert-YB6PJFMI.js +2 -0
- package/dist/persist-recorded-session-INFN4JZT.js +3 -0
- package/dist/phase-seed-ZZSJME7M.js +2 -0
- package/dist/pipeline-MVZRI6YZ.js +2 -0
- package/dist/policy-commands-3YJ6YCDN.js +8 -0
- package/dist/prepare-target-DII5WZCX.js +2 -0
- package/dist/{pull-cmd-UPFQYUND.js → pull-cmd-XZN53XFZ.js} +1 -1
- package/dist/pull-route-R33BVADE.js +2 -0
- package/dist/readmodel-TRV4E3MW.js +2 -0
- package/dist/real-device-run-DGENHGUV.js +2 -0
- package/dist/{reconcile-cmd-JBH365JL.js → reconcile-cmd-KFPRCCJB.js} +4 -4
- package/dist/reconcile-deps-UDQBWSLE.js +2 -0
- package/dist/{reconcile-remote-BCX6SWFC.js → reconcile-remote-6WISFGRG.js} +2 -2
- package/dist/{recording-banner-YKBAL6UB.js → recording-banner-XOX2CDCF.js} +1 -1
- package/dist/registry-NV3EMDMK.js +2 -0
- package/dist/remote-entry-BCTFT643.js +2 -0
- package/dist/remote-mode-4HN27MD4.js +4 -0
- package/dist/{remote-words-YVB66R3F.js → remote-words-LFDYKIZ7.js} +1 -1
- package/dist/{require-project-folder-MLMEQJYP.js → require-project-folder-ZK4JJCDB.js} +1 -1
- package/dist/{resolve-run-intent-PC7TQZUL.js → resolve-run-intent-LYLVNNDZ.js} +1 -1
- package/dist/{resolver-EID34LQE.js → resolver-RMHGGYRP.js} +1 -1
- package/dist/revert-QKHPCRT6.js +2 -0
- package/dist/{review-cmd-EUHFLFMY.js → review-cmd-UGF2FC5Y.js} +1 -1
- package/dist/run-CSYGVV3D.js +2 -0
- package/dist/run-YUHHD54J.js +2 -0
- package/dist/{run-channel-63SVP5OI.js → run-channel-IIIYXOIW.js} +1 -1
- package/dist/run-remote-BGKQDAOA.js +2 -0
- package/dist/{run-startup-gate-YO66G6LS.js → run-startup-gate-4XE73OON.js} +1 -1
- package/dist/run-test-md-G6U3RU2Q.js +19 -0
- package/dist/session-worker.js +2 -2
- package/dist/{sessions-CFV7FOIT.js → sessions-NH2EG7BP.js} +1 -1
- package/dist/{sessions-cmd-S7WZBUCN.js → sessions-cmd-CABAX7BO.js} +2 -2
- package/dist/{sessions-remote-IWHWIQ2T.js → sessions-remote-Y4FTZL7Y.js} +1 -1
- package/dist/{skill-installer-MAVQY6GW.js → skill-installer-FS2AV7GX.js} +1 -1
- package/dist/spawner-MQ4XEHIX.js +2 -0
- package/dist/{store-MSA7KASS.js → store-PLKJZTGC.js} +1 -1
- package/dist/store-choice-UAB6Z4AL.js +2 -0
- package/dist/store-guard-DUN2X3SR.js +2 -0
- package/dist/{store-site-KA2DNBGY.js → store-site-K5NHLI7D.js} +1 -1
- package/dist/stream-warnings-GM7YEOVG.js +2 -0
- package/dist/sync-cmd-AGTOGPYM.js +2 -0
- package/dist/{sync-setup-RBRDUV7Q.js → sync-setup-4KIY3PDO.js} +1 -1
- package/dist/tcg-generate-CUY4AZ2V.js +2 -0
- package/dist/{test-definition-VRI4YIYL.js → test-definition-53XNBEDE.js} +1 -1
- package/dist/testmd-actions-UD6PAWUX.js +2 -0
- package/dist/{testmd-sync-UPAA5UMD.js → testmd-sync-EEJ7GPLR.js} +1 -1
- package/dist/tms-client-XWCR7O7J.js +2 -0
- package/dist/token-refresh-K6PVBBFE.js +2 -0
- package/dist/{trust-gate-AT2XBWN4.js → trust-gate-674C2NZS.js} +1 -1
- package/dist/{turn-preflight-LHYLRL7G.js → turn-preflight-R4PU6NYY.js} +1 -1
- package/dist/{use-case-ref-NE4X4MZN.js → use-case-ref-44BPIP4N.js} +1 -1
- package/dist/{validate-basic-M5JHHNZA.js → validate-basic-3JZRZL45.js} +1 -1
- package/dist/{variable-receipt-BXSZO36E.js → variable-receipt-7PRKDTRJ.js} +1 -1
- package/dist/verdicts-PVB7TV5S.js +2 -0
- package/dist/{version-check-Q737BE65.js → version-check-IY3YSQIP.js} +1 -1
- package/dist/{view-cmd-XSNL5DGI.js → view-cmd-WUIGTRFX.js} +1 -1
- package/dist/{walk-session-SHGYLFRB.js → walk-session-EH7227WR.js} +1 -1
- package/dist/with-telemetry-7JMZUBUZ.js +2 -0
- package/package.json +17 -17
- package/dist/ChatSurface-6NZGMNHL.js +0 -2
- package/dist/EvidenceViewOffer-WIEWCZUP.js +0 -2
- package/dist/FolderPicker-AF7ZMV3M.js +0 -2
- package/dist/InfoBox-D7GGZJU4.js +0 -2
- package/dist/ProjectPicker-OBYHJJLU.js +0 -2
- package/dist/SaveSessionPrompt-7XSHS4NL.js +0 -2
- package/dist/SingleShotApp-XQUDR36R.js +0 -2
- package/dist/TestMdRunView-LS2QUFWR.js +0 -2
- package/dist/TestrunEvidenceTable-HNDVJDIF.js +0 -2
- package/dist/bind-4XWK3DG2.js +0 -2
- package/dist/bootstrap-6ACT4ALI.js +0 -2
- package/dist/bridge-T6QMYKED.js +0 -2
- package/dist/chat-committer-ZCSRJEUB.js +0 -2
- package/dist/chat-controller-XINCDH6Z.js +0 -2
- package/dist/child-G2GCW73X.js +0 -2
- package/dist/chunk-34R7BNZ2.js +0 -2
- package/dist/chunk-65VANXOF.js +0 -147
- package/dist/chunk-C6HI6Y3S.js +0 -2
- package/dist/chunk-D36V5OX6.js +0 -2
- package/dist/chunk-HCJ2N3XB.js +0 -12
- package/dist/chunk-IUQOG7Z5.js +0 -5
- package/dist/chunk-KF4DKXSS.js +0 -2
- package/dist/chunk-NC7D7GOM.js +0 -21
- package/dist/chunk-OGFU4YY4.js +0 -2
- package/dist/chunk-R4JUKTDO.js +0 -2
- package/dist/chunk-VZ4A6WMK.js +0 -97
- package/dist/chunk-W54OT2FU.js +0 -9
- package/dist/chunk-W72ACCFL.js +0 -27
- package/dist/chunk-WXJCJL5L.js +0 -7
- package/dist/cover-cmd-NBNZCR6C.js +0 -2
- package/dist/design-committer-TRYP3LOZ.js +0 -2
- package/dist/design-headless-OTHYOX3E.js +0 -2
- package/dist/device-env-CHFRRV6W.js +0 -2
- package/dist/dispatch-DVQ3H7EJ.js +0 -2
- package/dist/evidence-P6FFKC7B.js +0 -2
- package/dist/evidence-presentation-YYTIDCBS.js +0 -2
- package/dist/evolve-cmd-WWOB3QJR.js +0 -2
- package/dist/evolve-remote-WLVY3QID.js +0 -2
- package/dist/explore-K5YBGHK6.js +0 -2
- package/dist/extract-chat-M65NWGUK.js +0 -2
- package/dist/extract-headless-G6W6JQ27.js +0 -2
- package/dist/folder-flags-KKIH654K.js +0 -2
- package/dist/gaps-cmd-OIDDLRYL.js +0 -3
- package/dist/gate-7AKRPRMK.js +0 -2
- package/dist/gate-WISOUTHQ.js +0 -2
- package/dist/hold-passthrough-IOWPVB4W.js +0 -2
- package/dist/ingest-PDGS5ZTL.js +0 -2
- package/dist/ingest-remote-SSLUHQVG.js +0 -2
- package/dist/install-ZVBHPXGP.js +0 -2
- package/dist/lane-AQYRIW24.js +0 -2
- package/dist/lattice-auth-6FEVSR7E.js +0 -2
- package/dist/list-commands-5DCCKU3L.js +0 -2
- package/dist/login-flow-WEK3E476.js +0 -2
- package/dist/open-provider-OZAG6WZS.js +0 -2
- package/dist/pdf-convert-447ACUB3.js +0 -2
- package/dist/persist-recorded-session-A3ID7JFA.js +0 -3
- package/dist/phase-seed-LCJ4WSYV.js +0 -2
- package/dist/pipeline-GX3LKPI5.js +0 -2
- package/dist/prepare-target-FMT6QFHZ.js +0 -2
- package/dist/pull-route-FWBXJMR7.js +0 -2
- package/dist/readmodel-INMP6MNW.js +0 -2
- package/dist/real-device-run-X7JJWOIK.js +0 -2
- package/dist/reconcile-deps-TWJ3FTSU.js +0 -2
- package/dist/registry-VQC757MJ.js +0 -2
- package/dist/remote-entry-X6JMPC2K.js +0 -2
- package/dist/remote-mode-FDPA7EWG.js +0 -4
- package/dist/revert-FHOBLZWF.js +0 -2
- package/dist/run-5RQUCNYP.js +0 -2
- package/dist/run-PC5YO4AS.js +0 -2
- package/dist/run-remote-SJCRTL7O.js +0 -2
- package/dist/run-test-md-BLNBK4MH.js +0 -17
- package/dist/spawner-C7NLLM4F.js +0 -2
- package/dist/store-choice-3OJCV26J.js +0 -2
- package/dist/store-guard-OOSDLMEC.js +0 -2
- package/dist/stream-warnings-GEQKKJU7.js +0 -2
- package/dist/sync-cmd-RDFDMVKQ.js +0 -2
- package/dist/tcg-generate-KIECTZ2C.js +0 -2
- package/dist/testmd-actions-CMAG6HWI.js +0 -2
- package/dist/tms-client-NXAB6VJD.js +0 -2
- package/dist/token-refresh-KP3AYMYK.js +0 -2
- package/dist/verdicts-XK3GAUX3.js +0 -2
- package/dist/with-telemetry-PM2HVN2B.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as ne}from"./chunk-WMGKUERB.js";import{a as y,b as ie,c as oe,d as le,e as ae}from"./chunk-
|
|
2
|
+
import{b as ne}from"./chunk-WMGKUERB.js";import{a as y,b as ie,c as oe,d as le,e as ae}from"./chunk-UWPG5MWM.js";import{a as F,b as x,c as D,d as ee,f as re,h as de,i as pe}from"./chunk-GJXO6FF7.js";import{a as se,d as te}from"./chunk-ZCIWQHCO.js";import{a as X,c as Y,d as Z}from"./chunk-CQDCNP7V.js";import{Ba as B,Ea as v,Ja as Q,Pa as w,Va as U,Xa as $,Ya as O,Za as b,_a as G,ab as J,fb as H,i as _,jb as z,kb as W,mb as R,nb as K,ob as T,t as I}from"./chunk-PI7OXS62.js";import{a as C}from"./chunk-YJAQZMJT.js";import{existsSync as Se,readFileSync as Ee}from"fs";import{join as Me}from"path";import{mkdirSync as be,readFileSync as Re,renameSync as Fe,writeFileSync as Ae}from"fs";import{dirname as A,join as M}from"path";function E(r,o){be(A(r),{recursive:!0});let s=M(A(r),`.${process.pid}.tmp`);Ae(s,o),Fe(s,r)}function ue(r){try{return JSON.parse(Re(r,"utf8"))}catch{return null}}function ce(r){let o=s=>M(A(y(r,s)),"verdicts.json");return{read:s=>ue(y(r,s)),write:(s,i)=>E(y(r,s),JSON.stringify(i,null,2)+`
|
|
3
3
|
`),writeReview:(s,i)=>E(M(A(y(r,s)),"review.json"),JSON.stringify(i,null,2)+`
|
|
4
4
|
`),verdicts:s=>ue(o(s))??{verdicts:{}},saveVerdicts:(s,i)=>E(o(s),JSON.stringify(i,null,2)+`
|
|
5
5
|
`)}}import{appendFileSync as fe,closeSync as qe,existsSync as V,openSync as Pe,readdirSync as Oe,readFileSync as ge,renameSync as Te,writeFileSync as he}from"fs";import{join as q}from"path";var me=".pending-facts.bad";function ye(r){let o=q(r,ie);return{quarantinePath:q(r,me),park:(s,i)=>{let l=null;try{l=w(r,{deadlineMs:i.deadlineMs})}catch{l=null}try{if(l)return fe(o,s+`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as O,d as S}from"./chunk-
|
|
2
|
+
import{b as O,d as S}from"./chunk-P4VFC6HO.js";import{c as L}from"./chunk-RFHMDQXZ.js";import{n as P,o as R}from"./chunk-UJLULWSR.js";import{a as y}from"./chunk-HCBYKLMW.js";import{a as E,b as o,i as h}from"./chunk-33DWJV67.js";import{a as B}from"./chunk-6YGTRKDT.js";import{z as s}from"./chunk-FAMQ4DHU.js";import{e as d}from"./chunk-UR6MHSHU.js";var n=d(B(),1);import{basename as D}from"path";var r=d(y(),1),U="evidence-view-server";function Q({packPath:m,viewerBase:w,onDone:V,openUrl:k}){let[t,a]=(0,n.useState)("ask"),[g,b]=(0,n.useState)(null),[l,p]=(0,n.useState)(null),f=(0,n.useRef)(null),u=(0,n.useRef)(!1),x=async()=>{let e=f.current;f.current=null,e&&(R(U),await e.close())},v=()=>{u.current||(u.current=!0,V())};return h((e,i)=>{u.current||(t==="ask"?e==="y"||e==="Y"?a("starting"):(e==="n"||e==="N"||i.return||i.escape)&&v():t==="serving"&&(e==="q"||e==="Q"||i.escape)&&x().then(v))}),(0,n.useEffect)(()=>{if(t!=="starting")return;let e=!1;return(async()=>{try{let i=D(m),c=await O({packs:new Map([[i,m]]),allowedOrigins:[new URL(w).origin]});if(e){await c.close();return}f.current=c,P(U,()=>{c.close()});let T=S(c.urlFor(i),w);b(T);try{await(k??(q=>L(q)))(T)}catch{p("could not open browser \u2014 open the URL manually")}a("serving")}catch(i){p(`evidence view failed \u2014 ${i.message}`),a("failed")}})(),()=>{e=!0}},[t]),(0,n.useEffect)(()=>{if(t!=="failed")return;let e=setTimeout(v,0);return()=>clearTimeout(e)},[t]),(0,n.useEffect)(()=>()=>{x()},[]),t==="ask"?(0,r.jsxs)(o,{children:["View evidence in browser? ",(0,r.jsx)(o,{color:s.dim,children:"(y/N)"})]}):t==="serving"||t==="starting"?(0,r.jsxs)(E,{flexDirection:"column",children:[g?(0,r.jsxs)(o,{children:["viewer ",(0,r.jsx)(o,{color:s.orange,children:g})]}):(0,r.jsx)(o,{color:s.dim,children:"starting\u2026"}),l?(0,r.jsx)(o,{color:"yellow",children:l}):null,t==="serving"?(0,r.jsx)(o,{color:s.dim,children:"Press q when done"}):null]}):l?(0,r.jsx)(o,{color:"yellow",children:l}):null}export{Q as a};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as U,e as F}from"./chunk-4JOD47QI.js";import{d as W}from"./chunk-GMTHZUZ3.js";import{a as H}from"./chunk-
|
|
3
|
-
`));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var K=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*K)return null;let t=Math.min(ct,Math.floor(i/K)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function L(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:h}=await e.read();if(c)break;h&&(n.push(h),r+=h.length,t?.(h.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var z=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,h=null,b=!1;try{await Promise.all(e.map(async(f,M)=>{let P=0,V=d=>{P+=d,a+=d,n?.(a)},T=()=>{a=Math.max(0,a-P),P=0},R=null;for(let d=0;d<z;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${f.start}-${f.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,M===0?h=await L(p,I=>{$(),V(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=f.end-f.start+1,E=await L(p,I=>{$(),V(I)});if(E.length!==D)throw new Error(`range ${f.start}-${f.end} returned ${E.length} bytes (expected ${D})`);o.set(E,f.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;T(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${f.start}-${f.end} failed after ${z} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --target <emulator|simulator> --install\`.`)}))}catch(f){throw c.abort(),f}return h||(b?null:o)}async function ht(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return L(o,e&&(c=>{a+=c,e(a)}))}function ft(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function A(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:H,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-
|
|
2
|
+
import{d as U,e as F}from"./chunk-4JOD47QI.js";import{d as W}from"./chunk-GMTHZUZ3.js";import{a as H}from"./chunk-FAMQ4DHU.js";import{createHash as Y}from"crypto";import{access as Q,mkdir as S,mkdtemp as Z,readdir as O,readFile as y,rename as N,rm as v,writeFile as x}from"fs/promises";import{homedir as tt}from"os";import{arch as et,platform as st}from"process";import{dirname as C,isAbsolute as nt,join as l,relative as X,resolve as rt,sep as it}from"path";var q=1,ot={emulator:"emulator",simulator:"simulator"};function Pt(i){return ot[i.kind]??null}var j=class extends Error{constructor(s,e,n){super([`Managed mobile dependencies for ${s} are not installed.`,`- kaneai-mobile-deps ${s} ${e.bundleVersion}: ${e.url} (${_(e.bytes)})`,`Destination: ${n}`,`Run \`kane-cli doctor --target ${s} --install\` to download it.`].join(`
|
|
3
|
+
`));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var K=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*K)return null;let t=Math.min(ct,Math.floor(i/K)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function L(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:h}=await e.read();if(c)break;h&&(n.push(h),r+=h.length,t?.(h.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var z=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,h=null,b=!1;try{await Promise.all(e.map(async(f,M)=>{let P=0,V=d=>{P+=d,a+=d,n?.(a)},T=()=>{a=Math.max(0,a-P),P=0},R=null;for(let d=0;d<z;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${f.start}-${f.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,M===0?h=await L(p,I=>{$(),V(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=f.end-f.start+1,E=await L(p,I=>{$(),V(I)});if(E.length!==D)throw new Error(`range ${f.start}-${f.end} returned ${E.length} bytes (expected ${D})`);o.set(E,f.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;T(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${f.start}-${f.end} failed after ${z} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --target <emulator|simulator> --install\`.`)}))}catch(f){throw c.abort(),f}return h||(b?null:o)}async function ht(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return L(o,e&&(c=>{a+=c,e(a)}))}function ft(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function A(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:H,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-DSAKPZ3T.js")).controllerResolveBundle()(i),exec:U,now:()=>new Date,wait:F,processAlive:i=>{try{return process.kill(i,0),!0}catch{return!1}}}}var B=class extends Error{constructor(s,e,n){super(`No managed mobile dependencies are published for ${s} (kane-cli ${e}).
|
|
4
4
|
This is a packaging gap, not something to install locally \u2014 report it, or pass --appium-url to use an Appium server you manage yourself.`);this.coordinate=s;this.cause=n;this.name="NoPublishedBundleError"}},J=class i{deps;constructor(t={}){this.deps={...wt(),...t}}mobileRoot(){return l(this.deps.home,".testmuai","kaneai","mobile")}depsRoot(){return l(this.mobileRoot(),"deps")}classRoot(t,s){return l(this.depsRoot(),s,t)}resolveCacheFile(){return l(this.depsRoot(),"resolve-cache.json")}resolveCacheKey(t){return`${this.deps.cliVersion}|${this.deps.os}-${this.deps.arch}-${t}`}static RESOLVE_CACHE_TTL_MS=1440*60*1e3;async readCachedWantedVersion(t){try{let e=JSON.parse(await y(this.resolveCacheFile(),"utf8"))[this.resolveCacheKey(t)];if(!e?.bundleVersion||!e.fetchedAt)return null;let n=this.deps.now().getTime()-new Date(e.fetchedAt).getTime();return n>=0&&n<i.RESOLVE_CACHE_TTL_MS?e.bundleVersion:null}catch{return null}}async writeResolveCache(t,s){try{let e={};try{e=JSON.parse(await y(this.resolveCacheFile(),"utf8"))}catch{}e[this.resolveCacheKey(t)]={bundleVersion:s,fetchedAt:this.deps.now().toISOString()},await S(this.depsRoot(),{recursive:!0}),await x(this.resolveCacheFile(),`${JSON.stringify(e,null,2)}
|
|
5
5
|
`)}catch{}}async warmResolveCache(t){if(await this.readCachedWantedVersion(t)===null)try{await this.resolveOrExplain(t)}catch{}}paths(t,s){let e=this.classRoot(t,s);return{root:e,appium:l(e,"appium"),appiumHome:l(e,"appium-home"),platformTools:l(e,"platform-tools"),wdaDir:l(e,"wda","Build","Products","Debug-iphonesimulator"),iwdpBinDir:l(e,"bin"),installManifest:l(e,"install-manifest.json")}}async status(t,s){s||(s=await this.readCachedWantedVersion(t)??void 0);let e=[];try{e=await O(this.depsRoot())}catch{}s&&(e=e.filter(c=>c===s));let n=null;for(let c of e){let h=this.classRoot(t,c),b=null;try{b=JSON.parse(await y(l(h,"install-manifest.json"),"utf8"))}catch{continue}b.schemaVersion===q&&(!s&&b.cliVersion!==this.deps.cliVersion||(!n||b.installedAt>n.manifest.installedAt)&&(n={manifest:b,root:h}))}if(!n)return{class:t,installed:!1};let r=this.paths(t,n.manifest.bundleVersion),o=[l(r.appium,"node_modules","appium","index.js")];t==="emulator"&&o.push(l(r.platformTools,this.deps.os==="win32"?"adb.exe":"adb")),t==="simulator"&&o.push(l(r.wdaDir,"WebDriverAgentRunner-Runner.app"));for(let c of o)if(!await A(c))return{class:t,installed:!1,version:n.manifest.bundleVersion,root:n.root,corrupt:`a bundle component is missing from disk (${X(n.root,c)})`};let a=await this.postInstallDrifted(r);return{class:t,installed:!0,version:n.manifest.bundleVersion,root:n.root,...a?{needsRepair:a}:{}}}async postInstallDrifted(t){let s=l(t.appiumHome,"node_modules",".cache","appium","extensions.yaml");if(!await A(s))return!1;let e=await y(s,"utf8");for(let n of e.split(`
|
|
6
6
|
`)){let r=/^\s*installPath:\s*(.+?)\s*$/.exec(n);if(r&&!r[1].startsWith(t.appiumHome))return!0}return!1}async environment(t){let s=await this.status(t);if(!s.installed||!s.version)return{dirs:[]};let e=this.paths(t,s.version),n=[],r={dirs:n,appiumHome:e.appiumHome};return t!=="simulator"&&(n.push(e.platformTools),r.platformToolsDir=e.platformTools),n.push(l(e.appium,"node_modules",".bin")),t==="simulator"&&(n.push(e.iwdpBinDir),r.wdaDir=e.wdaDir,r.wdaRoot=l(e.root,"wda"),r.iwdpBinDir=e.iwdpBinDir),r}async ensure(t,s){let e,n;try{e=await this.resolveOrExplain(t)}catch(a){n=a}let r=await this.status(t,e?.bundleVersion);if(r.installed&&!r.needsRepair)return e&&r.version&&await this.adoptInstall(t,r.version),r;if(!e)throw n;if(r.installed&&r.needsRepair&&r.version){let a=this.paths(t,r.version);return await this.withInstallLock(async()=>{await this.postInstall(a.root,a,s.onProgress)}),await this.adoptInstall(t,r.version),this.status(t,e.bundleVersion)}let o=e;if(!s.automatic&&!s.approved)throw new j(t,o,this.classRoot(t,o.bundleVersion));return await this.withInstallLock(async()=>{(await this.status(t,o.bundleVersion)).installed||await this.install(t,o,s.onProgress)}),this.status(t,o.bundleVersion)}async adoptInstall(t,s){try{let e=this.paths(t,s).installManifest,n=JSON.parse(await y(e,"utf8"));if(n.cliVersion===this.deps.cliVersion)return;n.cliVersion=this.deps.cliVersion;let r=l(C(e),`install-manifest-${process.pid}.json`);await x(r,`${JSON.stringify(n,null,2)}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
function l(e){return{command:(t,n)=>e.commands[t](n),text:(t,n)=>e.texts[t](n)}}function
|
|
3
|
-
hint: check the network connection and the sign-in`,"note.assurance_unsupported":()=>"error: this environment does not support assurance sessions yet (404) \u2014 contact support if the problem persists","note.credentials_rejected":({env:e})=>`error: your credentials were rejected (401) \u2014 sign in again (active environment: ${e})`,"note.key_recycled":({source_id:e,what:t})=>`source '${e}' was ingested from a different ${t} that used this key \u2014 the key was recycled; ${g}`,"note.kind_taken":({source_id:e,backing:t,kind:n})=>`source '${e}' is already backed by ${t}, not ${n} \u2014 ${g}`,"note.site_moved":({source_id:e,previous:t,site:n})=>`source '${e}' was ingested from ${t}, but this read serves ${n} \u2014 ${g}`,"note.web_url_changed":({source_id:e,previous:t})=>`source '${e}' was ingested from ${t} \u2014 adopt the new URL as its next version, or add it under another id`,"note.web_id_taken":({url:e})=>`skipped ${e} \u2014 add it under another id to keep both pages`,"note.web_login":()=>"your credentials were rejected \u2014 sign in again and retry","note.web_projection_unknown":({kind:e})=>`unknown web projection kind '${e}' \u2014 this source needs a newer engine to read it`,LIS_AUTH:()=>"credentials rejected \u2014 sign in again and retry",MULTI_SOURCE_RESUME:({sid:e,sources:t})=>`error: session ${e} spans ${t} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (extract anything remaining again)`,CHANGE_BASIS_MOVED:({source_id:e,sid:t})=>`error: ${e} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; review the current version instead (session ${t} is defunct and can be ignored)`,PROPOSAL_UNREADABLE:({proposal:e})=>`proposal ${e} is unreadable \u2014 review the source's changes again`,SOURCE_UNRESOLVED:({source_id:e})=>`the source ${e} no longer resolves \u2014 cannot verify this changeset is current; review the source's changes again`,SOURCE_MOVED:({source_id:e})=>`the source ${e} moved again while this review was open \u2014 review its changes again to refresh the changeset`,ARCHIVE_UNRESOLVED:({use_case:e})=>`its archive op no longer resolves to ${e} \u2014 review the source's changes again`,POSTURE_IN_CHAT:({sid:e})=>`error: session ${e} is a held reconcile review \u2014 resumed in the chat its changes would commit without verdicts; give its cards their verdicts in the review`,SOURCE_MISSING:({sid:e,sources:t})=>`error: resumed session's paused source (${t}) is no longer in the corpus \u2014 add it again and resume session ${e}, or abandon that session`,BLOB_MISSING:({source_id:e})=>`error: ${e}: its stored content is missing \u2014 add the file again [BLOB_MISSING]`,"AGENT_FAILED.invalid_proposal":({source_id:e})=>`error: the agent could not produce a valid proposal for ${e} \u2014 extract it again to retry`,UC_UNREVIEWED:({use_case:e})=>`${e} is unreviewed \u2014 approve it first, or design it unreviewed`,"UC_UNREVIEWED.merge_target":({temp_ref:e,target:t})=>`${e}: merge target ${t} is unreviewed (derived) \u2014 approve it first and re-propose the merge`,UC_HELD:({use_case:e,owner_sid:t,stopped:n})=>`design: ${e} is being designed by another session`+(n?` \u2014 that session looks stopped; resume session ${t??"<session>"}`:"")+" \u2014 pick another use-case or wait for it to finish",GENERATION_LIVE:({use_case:e,gen:t})=>`${e} already has a live design generation (gen ${t}) \u2014 redesign it, with a reason, to supersede it`,MESSAGE_TOO_LARGE:({bytes:e,max:t})=>`error: the opening statement is ${e} bytes and the agent takes at most ${t} per message (it would drop it silently) \u2014 give a shorter reason (it replaces the generated stale reason)`,REASON_TOO_LARGE:()=>"nothing was started: that reason is too long; run it again with a sentence or two",SESSION_V1:({sid:e})=>`session ${e} predates durable checkpoints \u2014 this build cannot resume it; abandon it and start a fresh run (committed work is untouched)`,WRONG_VERB:({sid:e,verb:t})=>`error: session ${e} is a ${t} session \u2014 resume it as one`,"HELD_CITES_STALE.moved":()=>`the source moved after this plan staged \u2014 its quotes no longer verify against the current head; ${h}`,"HELD_CITES_STALE.predates_images":({where:e,anchor:t})=>`${e}: this plan predates image-part staging \u2014 ${t} cannot be verified against the version it staged under; ${h}`,"HELD_CITES_STALE.no_image":({where:e,anchor:t})=>`${e}: ${t} names no decodable image of the staged version \u2014 ${h}`,"HELD_CITES_STALE.image_moved":({where:e,anchor:t,gone:n})=>`${e}: the image behind ${t} is ${n?"no longer in":"ambiguous in"} the current head \u2014 ${h}`}});var
|
|
2
|
+
function l(e){return{command:(t,n)=>e.commands[t](n),text:(t,n)=>e.texts[t](n)}}function w(e,t,n){let s=n?(i,a)=>n[i](a):e.header;return{command:e.command,text:(i,a)=>{let u=t[i];return u?u(a):e.text(i,a)},...s?{header:s}:{}}}function x(e,t){let n=e.command("next.resume_session",t),s=e.command("next.resume_with_message",t);return{...n!==null?{resume:n}:{},...s!==null?{resumeMessage:s}:{}}}function y(e,t,n,s){let i=e.command(t,n);return i!==null?{cmd:i,...s}:{code:t,facts:n,...s}}import{getEnvironmentData as _,setEnvironmentData as v}from"worker_threads";var d=(e,t)=>e?`${e} ${t}${e>1?"s":""}`:null,p={"chat.added_use_cases":({minted:e,matched:t})=>e===0&&t>0?`all ${t} matched existing \u2014 nothing new to save`:`saved ${e} use-case${e===1?"":"s"} as drafts`+(t>0?` \xB7 ${t} matched existing`:""),"chat.added_design":({acs:e,scenarios:t,tests:n,gaps:s})=>`saved ${[d(e,"AC"),d(t,"scenario"),d(n,"test"),d(s,"gap")].filter(Boolean).join(" \xB7 ")||"judgements/wiring"} as drafts`,"chat.proposal_refused":()=>"proposal failed validation \u2014 nothing landed","chat.commit_failed":()=>"commit failed \u2014 nothing landed","chat.approved":({count:e})=>`${e} change${e===1?"":"s"} applied`,"chat.stales":({count:e})=>`stales ${e}`,"chat.held_degraded":({held:e})=>`held ${e} item(s) for review \u2014 semantic dedup ran degraded (embeddings unavailable); nothing saved this turn`,"chat.child_back":({drafts:e})=>`${e} draft${e===1?"":"s"} saved`,"chat.refine_hint":()=>'chat to refine ("looks good" approves; /done finishes)',"chat.repair_sent":()=>"that couldn't be saved as it was \u2014 the agent is fixing it","chat.updates_held":({count:e})=>`${e} update(s) held for review`,"note.dedup_reduced":()=>"note: duplicate detection is running in a reduced mode this run \u2014 new items will be held for your review instead of committed","note.chain_recovered":({sid:e})=>`session ${e}: checkpoint chain present with no pointer \u2014 recovering from the chain`,"note.chain_truncated":({sid:e,at:t,lost:n})=>`session ${e}: chain truncated to checkpoint ${t} \u2014 ${n} turn(s) lost to a corrupt record`,"note.turns_unrecorded":({detail:e})=>`this chat's turns are not being saved to its conversation (${e}) \u2014 your messages still reach the agent, but a resume cannot send them again`,"note.receipt_unbuilt":({detail:e})=>`a saved change's receipt for the agent could not be built (${e}) \u2014 the change is saved, but the agent is not told what it saved`,"note.tests_await_approval":({tests:e,criteria:t,criterion:n})=>{let s=e===1?"1 test checks":`${e} tests check`;return t===1&&n!==null?`note: ${s} a criterion not approved yet \u2014 say "approve ${n}"`:`note: ${s} criteria not approved yet \u2014 say "approve the criteria"`},"note.phase_unchanged":()=>"this phase matched what's already there \u2014 nothing new added","warning.variables_unwritten":({message:e})=>`warning: the design was saved, but its variable stubs could not be written (${e})`};var r=()=>null,c=e=>`resume session ${e}, which holds it`,h="review the current version again",g="retire it first, or add this under another id",m=l({commands:{"next.resume_session":r,"next.resume_with_message":r,"next.resume_child":r,"next.design_use_case":r,"next.review_use_case":r,"next.design_unreviewed":r,"next.view_design":r,"next.evolve_design":r,"next.redesign":r,"next.design_phase":r,"next.answer_evolve":r,"next.abandon_session":r,"next.review_held_changeset":r,"next.show_session":r,"next.review_source":r},texts:{...p,"note.paused":({sid:e})=>`paused: session ${e} saved and can be resumed`,"note.crashed":({sid:e,seq:t})=>`agent crashed \u2014 session ${e} can be resumed from its checkpoint ${t} (at most the in-flight turn lost)`,"note.model_unavailable_kept":({sid:e,detail:t})=>`the model service did not answer (${t}) \u2014 session ${e} is kept and can be resumed once it answers`,"note.model_retry":({seconds:e})=>`the model service is not answering; trying again in ${e}s`,"note.held_for_review":({sid:e,held:t})=>`paused: ${t} held item(s) await review in session ${e}`,"note.already_extracted":({source_id:e})=>`${e} already extracted \u2014 skipped`,"note.conversation_source_skipped":({source_id:e})=>`skipped ${e} \u2014 a conversation source is extracted only when it is named`,"note.reconcile_plan_pending":({source_id:e,pending:t})=>`note: a reconcile plan for ${e} is pending (${t} item(s))`,"note.nothing_to_extract":({sources:e,count:t})=>`extract: nothing to do \u2014 ${e} ${t===1?"is":"are all"} already extracted at the current snapshot`,"note.only_conversation_sources":()=>"extract: nothing to do \u2014 only conversation sources here, and each is extracted only when it is named","note.all_extracted":()=>"extract: nothing to do \u2014 every ingested source is already extracted","note.changeset_held_for_review":({sid:e,held:t})=>`paused: ${t} held change(s) await your verdicts in session ${e}`,"note.session_kept":({sid:e,seq:t,ts:n})=>`session ${e} kept its last checkpoint (seq ${t}, ${n}) and can be resumed`,"note.assumed_defaults":({sid:e,count:t})=>`note: ${t} default(s) were assumed while you were away \u2014 session ${e} lists them`,"note.landed_changed":({source_id:e})=>`note: ${e} changed after it was added \u2014 skipping its extraction this run; extract it again to pick up the newer version`,"note.landed_older_queued":({source_id:e})=>`note: an older version of ${e} is already queued this run \u2014 the newly landed version is not extracted; extract it again to pick it up`,"note.reingest_binary":({source_id:e,kind:t})=>`skipping ${e}: binary ${t} ingested before image support \u2014 add it again to extract from it`,"note.schedule_refused":()=>"this run holds items for review, so its extraction is not scheduled \u2014 it runs after the review","note.not_reached":()=>"run ended before its turn \u2014 extracting again runs it","note.nothing_committed":({source_id:e,remaining:t})=>`done \u2014 nothing committed for ${e} (no finalize before the session ended)`+(t>0?`; stopping here \u2014 ${t} remaining source(s) not extracted (extract them again to continue)`:""),"note.landed_not_extracted":({count:e,sources:t})=>`note: ${e} source(s) landed this session (${t}) were not extracted \u2014 the session ended first; extracting again runs them`,"note.evidence_not_attached":({count:e})=>`note: ${e} unchanged match(es) target unreviewed (or no-longer-resolving) item(s) \u2014 evidence not attached (review them; a later reconcile attaches)`,"note.sources_failed":({failed:e,total:t,sources:n})=>`${e} of ${t} source(s) failed \u2014 extract them again to retry (${n})`,"note.already_designed":({use_case:e,version:t})=>`'${e}' is already designed @ v${t} \u2014 current; redesign it to replace that design`,"note.design_stale":({use_case:e,designed:t,current:n})=>`'${e}' was designed @ ${t} \u2014 the use-case is now @ v${n} (STALE); evolve or redesign it`,"note.view_design":({use_case:e})=>`view the existing design of ${e}`,"note.evolve_first":({use_case:e})=>`refresh it first: evolve ${e}`,"note.nothing_executed":()=>"nothing executed","note.tests_await_approval_command":({tests:e,criteria:t,criterion:n})=>{let s=e===1?"1 test checks":`${e} tests check`;return t===1&&n!==null?`note: ${s} a criterion not approved yet; approve ${n}`:`note: ${s} criteria not approved yet; approve them`},"note.links_await_approval":({count:e})=>`warning: ${e} test link(s) refer to items still awaiting approval \u2014 saved anyway; review and approve those items`,"note.no_design_skipped":({use_case:e})=>`note: ${e} has no design output \u2014 nothing to evolve; design it first`,"note.no_design":({use_case:e})=>`nothing to evolve \u2014 design ${e} first (no design output)`,"note.design_paused":({use_case:e})=>`design session for ${e} paused \u2014 resume it, then evolve again for the diff`,"note.nothing_changed":({ref:e})=>`nothing changed underneath ${e} \u2014 its sources and requirements are current; give a reason to re-design anyway`,"note.source_changed_skipped":({use_case:e})=>`${e} is left out: it's out of date because its source changed \u2014 review its source's change first`,"note.source_changed":({use_case:e})=>`${e} is out of date because its source changed, and an update can't change that \u2014 review its source's change first`,"note.source_changed_after":({use_case:e})=>`${e} is still out of date because its source changed \u2014 review its source's change`,"note.checkpoint_not_saved":({error:e,chain_unverified:t})=>`warning: couldn't save the session checkpoint \u2014 ${e}; asking the agent to pause`+(t?". The store's record chain fails verification.":""),"note.held_no_event_id":({sid:e})=>`this held row has no durable event id \u2014 ${c(e)}, to drop it`,"note.held_no_provenance":({sid:e})=>`this held row carries no committable provenance \u2014 ${c(e)}, to apply it`,"note.held_no_citable_text":({sid:e,source_id:t,source_cid:n})=>`the pinned source ${t} (${n.slice(0,19)}) has no citable text to verify this held row against \u2014 ${c(e)}`,"note.held_unverified":({sid:e,errors:t})=>`held provenance does not verify against the pinned source (${t}) \u2014 ${c(e)}`,"note.controller_unreachable":({base:e,error:t})=>`error: cannot reach the controller at ${e} (${t})
|
|
3
|
+
hint: check the network connection and the sign-in`,"note.assurance_unsupported":()=>"error: this environment does not support assurance sessions yet (404) \u2014 contact support if the problem persists","note.credentials_rejected":({env:e})=>`error: your credentials were rejected (401) \u2014 sign in again (active environment: ${e})`,"note.key_recycled":({source_id:e,what:t})=>`source '${e}' was ingested from a different ${t} that used this key \u2014 the key was recycled; ${g}`,"note.kind_taken":({source_id:e,backing:t,kind:n})=>`source '${e}' is already backed by ${t}, not ${n} \u2014 ${g}`,"note.site_moved":({source_id:e,previous:t,site:n})=>`source '${e}' was ingested from ${t}, but this read serves ${n} \u2014 ${g}`,"note.web_url_changed":({source_id:e,previous:t})=>`source '${e}' was ingested from ${t} \u2014 adopt the new URL as its next version, or add it under another id`,"note.web_id_taken":({url:e})=>`skipped ${e} \u2014 add it under another id to keep both pages`,"note.web_login":()=>"your credentials were rejected \u2014 sign in again and retry","note.web_projection_unknown":({kind:e})=>`unknown web projection kind '${e}' \u2014 this source needs a newer engine to read it`,LIS_AUTH:()=>"credentials rejected \u2014 sign in again and retry",MULTI_SOURCE_RESUME:({sid:e,sources:t})=>`error: session ${e} spans ${t} sources \u2014 multi-source resume isn't supported yet; committed work is preserved (extract anything remaining again)`,CHANGE_BASIS_MOVED:({source_id:e,sid:t})=>`error: ${e} moved while this reconcile extraction was paused \u2014 its recorded change context no longer matches; review the current version instead (session ${t} is defunct and can be ignored)`,PROPOSAL_UNREADABLE:({proposal:e})=>`proposal ${e} is unreadable \u2014 review the source's changes again`,SOURCE_UNRESOLVED:({source_id:e})=>`the source ${e} no longer resolves \u2014 cannot verify this changeset is current; review the source's changes again`,SOURCE_MOVED:({source_id:e})=>`the source ${e} moved again while this review was open \u2014 review its changes again to refresh the changeset`,ARCHIVE_UNRESOLVED:({use_case:e})=>`its archive op no longer resolves to ${e} \u2014 review the source's changes again`,POSTURE_IN_CHAT:({sid:e})=>`error: session ${e} is a held reconcile review \u2014 resumed in the chat its changes would commit without verdicts; give its cards their verdicts in the review`,SOURCE_MISSING:({sid:e,sources:t})=>`error: resumed session's paused source (${t}) is no longer in the corpus \u2014 add it again and resume session ${e}, or abandon that session`,BLOB_MISSING:({source_id:e})=>`error: ${e}: its stored content is missing \u2014 add the file again [BLOB_MISSING]`,"AGENT_FAILED.invalid_proposal":({source_id:e})=>`error: the agent could not produce a valid proposal for ${e} \u2014 extract it again to retry`,UC_UNREVIEWED:({use_case:e})=>`${e} is unreviewed \u2014 approve it first, or design it unreviewed`,"UC_UNREVIEWED.merge_target":({temp_ref:e,target:t})=>`${e}: merge target ${t} is unreviewed (derived) \u2014 approve it first and re-propose the merge`,UC_HELD:({use_case:e,owner_sid:t,stopped:n})=>`design: ${e} is being designed by another session`+(n?` \u2014 that session looks stopped; resume session ${t??"<session>"}`:"")+" \u2014 pick another use-case or wait for it to finish",GENERATION_LIVE:({use_case:e,gen:t})=>`${e} already has a live design generation (gen ${t}) \u2014 redesign it, with a reason, to supersede it`,MESSAGE_TOO_LARGE:({bytes:e,max:t})=>`error: the opening statement is ${e} bytes and the agent takes at most ${t} per message (it would drop it silently) \u2014 give a shorter reason (it replaces the generated stale reason)`,REASON_TOO_LARGE:()=>"nothing was started: that reason is too long; run it again with a sentence or two",SESSION_V1:({sid:e})=>`session ${e} predates durable checkpoints \u2014 this build cannot resume it; abandon it and start a fresh run (committed work is untouched)`,WRONG_VERB:({sid:e,verb:t})=>`error: session ${e} is a ${t} session \u2014 resume it as one`,"HELD_CITES_STALE.moved":()=>`the source moved after this plan staged \u2014 its quotes no longer verify against the current head; ${h}`,"HELD_CITES_STALE.predates_images":({where:e,anchor:t})=>`${e}: this plan predates image-part staging \u2014 ${t} cannot be verified against the version it staged under; ${h}`,"HELD_CITES_STALE.no_image":({where:e,anchor:t})=>`${e}: ${t} names no decodable image of the staged version \u2014 ${h}`,"HELD_CITES_STALE.image_moved":({where:e,anchor:t,gone:n})=>`${e}: the image behind ${t} is ${n?"no longer in":"ambiguous in"} the current head \u2014 ${h}`}});var f="kane-context:flushToDisk",o=null;function A(e){o=e,e.flushToDisk!==void 0&&v(f,e.flushToDisk)}function I(){if(!o)throw new Error("engine config not set; the host must call setEngineConfig before any engine call");return o}function O(){return o?.writersFenced===!0}function L(){return(o?.flushToDisk??_(f))!==!1}function H(){return o?.warn}function W(){return o?.userSessionId?.()??null}var $="kane-context:pythonTrustFile";function R(e){v($,e??void 0)}function D(){let e=_($);return typeof e=="string"?e:null}function F(){return o?.version??null}function N(){return o?.wording??m}export{l as a,w as b,x as c,y as d,p as e,A as f,I as g,O as h,L as i,H as j,W as k,R as l,D as m,F as n,N as o};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as ae}from"./chunk-MMBBQ4OZ.js";import{j as R}from"./chunk-
|
|
2
|
+
import{a as ae}from"./chunk-MMBBQ4OZ.js";import{j as R}from"./chunk-HX5OLRKU.js";import{c as ie,e as ne,i as re,j as K}from"./chunk-Z7S3IWUX.js";import{d as $,e as oe}from"./chunk-4JOD47QI.js";import{a as se}from"./chunk-RZ4F3BHX.js";import{spawn as ze}from"child_process";import{closeSync as Xe,existsSync as Ge,mkdirSync as We,openSync as Ye,readFileSync as Ze,rmSync as Qe}from"fs";import{homedir as ge}from"os";import{dirname as X,join as S}from"path";import{access as Re,mkdir as de,readFile as Le}from"fs/promises";import{homedir as Ce}from"os";import{arch as Fe,platform as Be}from"process";import{join as M}from"path";var Ue=35,qe="google_apis",Ve="KaneCLI_Pixel_API35",He="KaneAI_Pixel_API35";function Ht(t){return t===He?Ve:t}var je=1;function Ke(t,e){return t==="darwin"&&e==="arm64"?"arm64-v8a":"x86_64"}function Je(){return{home:Ce(),os:Be,arch:Fe}}async function le(t){try{return await Re(t),!0}catch{return!1}}var J=class{deps;constructor(e={}){this.deps={...Je(),...e}}paths(){let e=M(this.deps.home,".testmuai","kaneai","mobile"),r=M(e,"android-sdk");return{root:r,emulatorDir:M(r,"emulator"),systemImageDir:M(r,"system-images",`android-${Ue}`,qe,Ke(this.deps.os,this.deps.arch)),avdHome:M(e,"avd"),manifest:M(r,"sdk-manifest.json")}}environment(){let e=this.paths();return{ANDROID_HOME:e.root,ANDROID_SDK_ROOT:e.root,ANDROID_AVD_HOME:e.avdHome}}async ensureSdkRootMarkers(){let e=this.paths().root;await de(M(e,"platforms"),{recursive:!0}),await de(M(e,"platform-tools"),{recursive:!0})}async status(){let e=this.paths(),r=null;try{r=JSON.parse(await Le(e.manifest,"utf8"))}catch{}if(!r||r.schemaVersion!==je)return{emulator:!1,systemImage:!1};let o=this.deps.os==="win32"?"emulator.exe":"emulator";return{emulator:!!r.components.emulator&&await le(M(e.emulatorDir,o)),systemImage:!!r.components.systemImage&&await le(M(e.systemImageDir,"system.img"))}}},ue;function B(){return ue??=new J,ue}var G="android",et="http://127.0.0.1:4723/status",tt=2e3,z=(()=>{let t=Number(process.env.KANE_CLI_EMULATOR_BOOT_TIMEOUT_MS);return Number.isFinite(t)&&t>=3e4?t:3e5})(),it=1e3,nt=3e5;var rt=5,ce="Run `kane-cli doctor --target emulator --install` to install the managed Appium tree.",st={device:"ready",unauthorized:"unauthorized",offline:"offline"};function ot(t){let e={};for(let r of t){let o=r.indexOf(":");o<=0||(e[r.slice(0,o)]=r.slice(o+1))}return e}function at(t){let e=[];for(let r of t.split(`
|
|
3
3
|
`)){let o=r.trim();if(!o||o.startsWith("*"))continue;let u=o.toLowerCase();if(u.startsWith("list of devices")||u.startsWith("adb server"))continue;let g=o.split(/\s+/),p=g[0],w=g[1];if(!p||!w)continue;let v=ot(g.slice(2)),x=/^(localhost|127\.0\.0\.1):\d{1,5}$/.test(p),P=/^[A-Za-z0-9._-]+:\d{1,5}$/.test(p),C=/^sdk_/.test(v.product??"")||/^sdk_/.test(v.model??"")||/^emu/.test(v.device??"");if(!p.startsWith("emulator-")&&!x&&!(P&&C))continue;let l=v.model?v.model.replace(/_/g," "):void 0;e.push({platform:G,kind:"emulator",id:p,displayName:l??p,state:st[w]??"offline"})}return e}function me(t){let e=[];for(let r of t.split(`
|
|
4
4
|
`)){let o=r.trim();o&&/^[A-Za-z0-9._-]+$/.test(o)&&(e.includes(o)||e.push(o))}return e}function dt(t){for(let e of t.split(`
|
|
5
5
|
`)){let r=e.trim();if(!(!r||r==="OK"))return r}}function lt(t){let e=/^Version\s+(\S+)/m.exec(t);return e?.[1]?e[1].split("-")[0]:/Android Debug Bridge version\s+(\S+)/.exec(t)?.[1]}function ut(t){let e=[];for(let r of t.split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as f,d as l}from"./chunk-
|
|
2
|
+
import{b as f,d as l}from"./chunk-I52NWH4U.js";import{a as p}from"./chunk-TZXXJWHA.js";function d(t,e,o){return{id:`${t}.internal`,label:e,required:!0,status:"fail",detail:o instanceof Error?o.message:String(o)}}async function k(t,e={}){let o=p();if(!o.supported)return{sections:[{platform:"host",checks:[{id:"host.platform",label:"host",required:!0,status:"fail",detail:o.reason}]}]};let n=t?f().filter(r=>r.toLowerCase()===t.toLowerCase()):f(),{managedDeps:i}=await import("./deps-bundle-6WLX44OA.js"),s=n.flatMap(r=>r==="android"?["emulator"]:r==="ios"?["simulator"]:[]);await Promise.allSettled(s.map(r=>i().warmResolveCache(r)));let c=[];for(let r of n){let u=l(r);if(!u)continue;let a;try{a=await u.checks(e)}catch(h){a=[d(r,"toolchain check",h)]}c.push({platform:r,checks:a})}return{sections:c}}function m(t){return t==="pass"?"\u2713":t==="fail"?"\u2717":"\u2139"}function x(t){return t.charAt(0).toUpperCase()+t.slice(1)}function C(t){let e=[];if(t.sections.length===0)return"No mobile platforms are supported on this host.";for(let o of t.sections){e.length>0&&e.push(""),e.push(`${x(o.platform)} toolchain`);let n=o.checks.filter(s=>s.status!=="info"),i=new Set;for(let s of n){let c=s.detail?` \u2014 ${s.detail}`:"";if(e.push(` ${m(s.status)} ${s.label}${c}`),s.status==="fail"&&s.fixText&&!i.has(s.fixText)){i.add(s.fixText);for(let r of s.fixText.split(`
|
|
3
3
|
`))e.push(` fix: ${r}`)}}}return e.join(`
|
|
4
4
|
`)}function w(t){return t.sections.length===0?!0:t.sections.every(e=>e.checks.some(o=>o.required&&o.status==="fail"&&!o.fixedByBundle))}function b(t){for(let e of t.sections)for(let o of e.checks)if(o.required&&o.status!=="pass")return 2;return 0}export{k as a,C as b,w as c,b as d};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as g,d as u}from"./chunk-
|
|
2
|
+
import{c as g,d as u}from"./chunk-DLP5S3TO.js";import{a as f}from"./chunk-72KYMWQ5.js";import{readFileSync as E}from"fs";var p=/\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/g;function h(a){let e=[];for(let o of a){let r=o.trim();if(r){if(r.startsWith("@")){let n=r.slice(1).trim(),t;try{t=E(n,"utf8")}catch(l){throw new Error(`--deps @${n}: ${l.message}`)}let s=t.trim();s&&e.push(s);continue}e.push(r)}}return e.join(`
|
|
3
3
|
|
|
4
4
|
`)}function y(a,e){let o=a.prompt.trim(),r=a.deps.trim(),n=[["--prompt",o],["--deps",r]];if(!n.some(([,i])=>p.test(i)))return p.lastIndex=0,{prompt:o,deps:r,variables:{},secretNames:[]};p.lastIndex=0;let t=u({objective:[o,r].join(`
|
|
5
5
|
`),globalDir:e.globalDir,localDir:e.localDir,file:e.file,inline:e.inline,onLoadError:e.onLoadError});for(let[i,x]of n)for(let v of x.matchAll(p)){let c=v[1],b=c.replace(/^(global\.|secrets\.user\.)/,"");if(!(c in t.raw)&&!(b in t.raw))return{error:`${i} uses {{${c}}} but no variable "${b}" is defined (variables files, --variables-file or --variables)`}}let s=o?f(t.raw,o).objective:"",l=r?f(t.raw,r).objective:"",m=g(t.auteur,[s,l].join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as x}from"./chunk-
|
|
2
|
+
import{b as x}from"./chunk-6JUS2ULI.js";import{a as l}from"./chunk-HCBYKLMW.js";import{a as i,b as r}from"./chunk-33DWJV67.js";import{e}from"./chunk-UR6MHSHU.js";var o=e(l(),1);function m({title:c,state:t,rows:n}){return(0,o.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,o.jsxs)(r,{children:[(0,o.jsx)(r,{bold:!0,children:c}),t?(0,o.jsx)(r,{color:t.color,children:` \u25CF ${t.text}`}):null]}),(0,o.jsx)(x,{rows:n,minWidth:20})]})}export{m as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{L as N,a as k,pa as S,r as w}from"./chunk-
|
|
2
|
+
import{L as N,a as k,pa as S,r as w}from"./chunk-PI7OXS62.js";import{f as _,h as $}from"./chunk-KU3YHPWZ.js";var T=3,F={edit:"edit",reject:"mistake",dedup_dropped:"mistake",approve:"usage",enhance:"directed-edit",add:"directed-edit",default_accepted:"usage",default_overridden:"edit",gap_resolution:"usage",dedup_kept:"usage"};function P(m){let{store:u,graph:s,watermark:v,by:f}=m,{signals:b}=u.signals().snapshot(v),E=b.filter(e=>e.event_id===void 0||s.appliedEvents.has(e.event_id)),n=new Map;for(let e of E){let t=e.event_id??`${e.ts}|${e.id}|${e.verdict}|${e.polarity}`;n.has(`${t}|${e.polarity}|${e.verdict}`)||n.set(`${t}|${e.polarity}|${e.verdict}`,e)}let j=[...n.values()].sort((e,t)=>(e.event_id??e.ts)<(t.event_id??t.ts)?-1:1),i=new Map;for(let e of j){let t=`${e.verdict}|${e.tag??""}`,r=i.get(t)??{verdict:e.verdict,tag:e.tag,events:new Set};r.events.add(e.event_id??e.ts),i.set(t,r)}let d=[],a=[],g=new Set,c=[],y=0;for(let[,e]of[...i.entries()].sort(([t],[r])=>t<r?-1:1)){if(e.events.size<T)continue;let r={derived:!0,statement:`${e.verdict}${e.tag?`/${e.tag}`:""} recurs (${e.events.size} distinct events) \u2014 bias future proposals ${e.verdict==="approve"?"toward":"away from"} this pattern`,learned_from_kind:F[e.verdict]??"usage",learned_from:[...e.events].sort()},h=$("stylenote",r);if(h.length>0)return{record:null,errors:h.map(o=>({code:o.code,detail:o.detail})),minted:0};let p=k("stylenote",r);if(s.hasNode(p))continue;d.push({cid:p,label:_.STYLENOTE,content:r});for(let o of r.learned_from)c.includes(o)||c.push(o);let l=S("stylenote",o=>g.has(o),s.names.keys());l!==null&&(g.add(l),a.push({cid:p,slug:l,by:f})),y+=1}return d.length===0?{record:null,errors:null,minted:0}:{record:N(u,{ts:new Date().toISOString(),proposal_id:null,nodes:d,edges:[],review:[],supersessions:[],source_head_moves:{},...a.length>0?{names:a}:{}},{graph:s,expectPrev:s.latestHash,intent:{v:1,verb:"distill",args:w({watermark:v,by:f}),pins:{events:c}},provenance:m.provenance}).record,errors:null,minted:y}}export{P as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as g}from"./chunk-
|
|
2
|
+
import{b as g}from"./chunk-ZMWTRXFH.js";import{g as d}from"./chunk-MINDIQET.js";import{a as c}from"./chunk-3KY7HHQU.js";var p=["grounding","acs","scenarios","wiring","tests"];function P(i){let t=p.filter(e=>e!=="grounding"),n=0;for(let e of i)n=Math.max(n,t.indexOf(e)+1);return n}var x={acs:"acceptance criteria",scenarios:"scenarios",wiring:"acceptance criteria + exercises",tests:"tests + gaps"};function l(i,t,n){let e=t.resolve(n);if(e===null)return[];let s=c(t,e.cid),a=d(i.recordsSince(null),s),r=a.reduce((o,m)=>Math.max(o,m.generation),0);return a.filter(o=>o.generation===r)}function S(i,t,n,e){let s=p;if(!s.includes(e))return{ok:!1,code:"UNKNOWN_PHASE",message:`--phase must be one of ${s.join(" | ")}, got '${e}'`,valid:[...s]};let a=new Set(l(i,t,n).map(o=>o.phase)),r=s.slice(0,s.indexOf(e)).filter(o=>o!=="grounding"&&!a.has(o));return r.length===0?{ok:!0,phase:e}:{ok:!1,code:"PHASE_ORDER",message:`--phase ${e} needs ${r.join(" + ")} committed first (nothing recorded for ${r.join(", ")})`,missing:r,earliest:r[0]}}function E(i,t,n,e){let s=l(i,t,n),a=t.resolve(n);if(a===null)return{priorDesign:void 0,phaseLadder:s};let r=g(t,a.tip);return{priorDesign:r.scenarios.length===0&&r.tests.length===0&&r.acs.length===0?void 0:r,phaseLadder:s}}export{p as a,P as b,x as c,l as d,S as e,E as f};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as Oe}from"./chunk-BWXLZS5O.js";import{a as De,b as Me}from"./chunk-63EKRZKI.js";import{a as qe,c as Ne}from"./chunk-3JLEDSG5.js";import{b as $e,f as de,i as Ee}from"./chunk-42PALMW2.js";import{A as Ae,D as ae,na as Ie,z as Te}from"./chunk-UEE3RZN4.js";import{d as Re}from"./chunk-KU3YHPWZ.js";import{m as $}from"./chunk-4I7YN6YY.js";var Qe=new Set(["approve","edit","reject"]),Le=new Set(["approve","edit","reject","add","enhance","retract"]);function Fe(i,t){return t?`chatop:${t}:${i}`:`chatop:${i}`}function Ue(i,t,y,w){let k=`${t}:${i.target??"new"}:${i.op}:${i.seq}`,l=i.payload;switch(i.op){case"approve":return{kind:"approve",target:i.target,expectedCid:i.expected_cid,eventId:k};case"edit":{let{reason:C,...a}=l;return{kind:"edit",target:i.target,expectedCid:i.expected_cid,edit:a,reason:C,eventId:k}}case"enhance":return{kind:"enhance",target:i.target,expectedCid:i.expected_cid,edges:l.edges??[],eventId:k};case"retract":{let C=typeof l.reason=="string"?l.reason.trim():"";if(!C)throw new Error("INVALID_RETRACT: a retract needs a non-empty reason");let a=l.edge_ecid!==void 0&&l.edge_ecid!==null,d=l.edge!==void 0&&l.edge!==null;if(a&&d)throw new Error("INVALID_RETRACT: both edge_ecid and edge were sent \u2014 give exactly one");if(!a&&!d)throw new Error("INVALID_RETRACT: neither edge {type, dst, src?} (display refs) nor edge_ecid was sent \u2014 give exactly one");let g={kind:"retract",target:i.target,expectedCid:i.expected_cid,reason:C};if(a){if(typeof l.edge_ecid!="string"||!l.edge_ecid)throw new Error("INVALID_RETRACT: edge_ecid must be a non-empty string");return{...g,edgeEcid:l.edge_ecid,eventId:`${t}:${i.target}:retract:e:${l.edge_ecid}:${i.seq}`}}let f=l.edge;if(typeof f!="object"||typeof f.type!="string"||!f.type||typeof f.dst!="string"||!f.dst)throw new Error("INVALID_RETRACT: edge needs {type, dst} (src optional), all display refs");if(f.src!==void 0&&f.src!==null&&(typeof f.src!="string"||!f.src))throw new Error("INVALID_RETRACT: edge.src, when given, must be a non-empty display ref");let v=typeof f.src=="string"?f.src:void 0;return{...g,edgeRef:{type:f.type,dst:f.dst,...v!==void 0?{src:v}:{}},eventId:`${t}:${i.target}:retract:t:${f.type}:${f.dst}:${v??"-"}:${i.seq}`}}case"reject":return{kind:"reject",target:i.target,expectedCid:i.expected_cid,reason:l.reason??"",redirectTo:l.redirect_to,eventId:k};case"add":{let C=l.proposal_item??{},a=String(C.label??"");if(!y.mint_gate.includes(a))throw new Error(`GATED_LABEL: cannot mint "${a}" (gate: ${y.mint_gate.join(", ")})`);let d=C.cite??{},g=C.conv_source_id??w;if(!g||typeof d.turn!="number"||!d.quote)throw new Error("INVALID_ADD: a chat add requires a conversation cite {turn, quote} and conv_source_id");let f=C.content,v=f&&typeof f=="object"&&!Array.isArray(f)&&Object.keys(f).length>0?f:null,A=new Set(["label","cite","conv_source_id","content","rationale","edges"]),S=v??Object.fromEntries(Object.entries(C).filter(([N])=>!A.has(N)));return{kind:"add",label:a,content:S,cite:{turn:d.turn,quote:d.quote},convSourceId:g,rationale:C.rationale,eventId:k}}}}function je(i,t,y={}){let w=y.turn??0,k=[],l=[];for(let[d,g]of i.entries()){let f=Te(g,`ops[${d}]`);if(f!==null)throw new Error(`NUL_IN_TEXT: ${Ae(f)}`)}for(let d of i){if(!Le.has(d.op))throw new Error(`UNKNOWN_OP: "${d.op}" is not a chat op (accepted: ${[...Le].join(", ")})`);if(d.op!=="add"&&!d.target)throw new Error(`MISSING_TARGET: a ${d.op} op needs a target ref`)}for(let d of i)(d.op==="add"||d.op==="enhance"||d.op==="retract")&&l.push(d);let C=new Map;for(let d of i){if(!Qe.has(d.op)||!d.target)continue;let g=C.get(d.target)??[];g.push(d),C.set(d.target,g)}for(let[d,g]of C){let f=Math.max(...g.map(A=>A.seq)),v=g.filter(A=>A.seq===f);if(v.length>1){k.push({target:d,seq:f,kinds:v.map(A=>A.op)});continue}l.push(v[0])}return{chatOps:l.sort((d,g)=>d.seq-g.seq).map(d=>Ue(d,y.prefix??Fe(w,y.session),t,y.convSourceId)),ambiguous:k}}function Pe(i,t){return i.map(y=>{let w=y.data?.tip;if(y.code!=="EXPECTED_CID_MOVED"||typeof w!="string")return{code:y.code};let k=t?.getNode(w)?.content??{},l=typeof k.title=="string"?k.title:typeof k.text=="string"?k.text:void 0,C=t?.displayNameOf(w)??(typeof y.data?.target=="string"?y.data.target:void 0);return{code:y.code,moved:y.data?.moved===!0,...C?{ref:C}:{},...l?{title:l}:{}}})}function He(i){let t=[];return i.questions.forEach((y,w)=>{if(i.resolution[w])return;let k=y.recommended_index!=null?y.options[y.recommended_index]?.label:void 0;k!=null&&t.push(y.risk==="high"?`${B(k)} \u203C`:B(k))}),t.length>3?`${t.slice(0,3).join(" \xB7 ")} \xB7 +${t.length-3} more`:t.join(" \xB7 ")}function B(i){return i.replace(/\s*\(recommended\)\s*$/i,"")}function Be(i){let t=i.text.replace(/\?+\s*$/,"");return t.length<=36?t:`${t.slice(0,33)}\u2026`}function ze(i,t){let y=new Set;for(let w=t;w&&!y.has(w);w=i.superseded.get(w)){if(i.trust.get(w)==="archived")return!0;y.add(w)}return!1}function Ve(i){return i.use_cases??[]}var Ke={acs:"acceptance criteria",scenarios:"scenarios",exercises:"exercises",tests:"tests",gaps:"gaps"};function Xe(i){let t=[],y=[],w=(a,d)=>{d.length!==0&&(y.push(a),t.push(...d))},k=a=>typeof a=="string"&&/^[a-z]{1,4}\d{1,4}$/i.test(a)?a:null,l=a=>{let d=k(a.automates)??"1 scenario",g=a.verifies??[],f=g.map(k).filter(S=>S!==null).slice(0,2),v=g.length-f.length,A=f.length?`${f.join(" ")}${v>0?` +${v}`:""}`:`${g.length} ACs`;return`covers ${d} \xB7 verifies ${A}`};w("acs",(i.acs??[]).map(a=>({temp_ref:a.temp_ref,title:a.text,kind:"ac",badge:String(a.kind),extra:{...a.expected_answer?{expects:`${String(a.expected_answer.operator??"")} \xB7 ${String(a.expected_answer.operand??"")}`}:{},"scoped to":a.scoped_to??"(use-case)"}}))),w("scenarios",(i.scenarios??[]).map(a=>({temp_ref:a.temp_ref,title:a.title,kind:"scenario",badge:a.case_type,why:a.intent,depends_on_hint:a.depends_on??[],extra:{technique:a.technique_notes}}))),w("exercises",(i.exercises??[]).map(a=>({temp_ref:k(a.scenario)??"wiring",title:`${k(a.scenario)??"scenario"} exercises ${k(a.ac)??"1 AC"}`,kind:"exercise",badge:"wires",why:a.rationale}))),w("tests",(i.tests??[]).map(a=>({temp_ref:a.temp_ref,title:a.title,kind:"test",why:l(a),depends_on_hint:a.reuses??[],extra:{automates:String(a.automates??"?"),verifies:(a.verifies??[]).join(", "),check:a.check?`${String(a.check.kind)} vs ${String(a.check.verified_against)}`:"?"}})));let C={high:"high",medium:"med",med:"med",low:"low"};return w("gaps",(i.gaps??[]).map(a=>{let d=a.question??{};return{temp_ref:a.temp_ref??a.ref??"?",title:String(d.header??a.kind),kind:"gap",badge:C[String(a.risk??"").trim().toLowerCase()]??"",why:d.prompt??d.text??"",question:String(d.prompt??d.text??d.header??""),rationale:String(a.risk_rationale??"")}})),{items:t,heading:y.join(" + ")||"design"}}function ut(i={}){let t={turns:[],thinking:De(),pending:null,confirm:null,status:"idle",ledger:[],activeTurn:null,stream:null,checkpoint:!1},y=e=>{let n=[],r=e.minted.map(u=>u.slug).filter(Boolean);r.length&&n.push(`added ${r.join(", ")}`);let s=e.applied.length-e.minted.length;s>0&&n.push(`${s} change${s===1?"":"s"} applied`);let o=e.staleDelta.length?$().text("chat.stales",{count:e.staleDelta.length}):"";return o&&n.push(o),n.join(" \xB7 ")||"no changes"},w=(e,n)=>{let r=i.refreshGraph?.()??i.graph;return!r?.nodeLabel||n.applied.length===0||n.minted.length>0||n.staleDelta.length>0?!1:e.every(s=>{if(s.kind!=="approve"||!s.target)return!1;let o=r.resolve(s.target);return o!==null&&r.nodeLabel.get(r.tipOf(o.cid))==="usecase"})},k=[];i.onRender&&k.push(i.onRender);let l=0,C=new Map,a=e=>{let n=C.get(e);if(n===void 0){let r=`chatop:${e}:`;n=0;for(let s of(i.refreshGraph?.()??i.graph)?.appliedEvents??[]){if(!s.startsWith(r))continue;let o=Number(s.slice(r.length).split(":")[0]);Number.isInteger(o)&&o>n&&(n=o)}C.set(e,n)}return n},d=0,g=null,f=null,v=null,A=null,S=[],N=null,ee=!1,G=0,te=null,M=null,ne=0,ue=0,le=!1,ce=!1,ge=e=>(le||(le=!0,m({kind:"note",text:$().text("note.turns_unrecorded",{detail:e})}),p()),null),pe=(e,n)=>{if(!v||!i.store||!e.trim())return null;try{let r=i.refreshGraph?.()??i.graph;if(!r)return null;let s=Ee({store:i.store,graph:r,sourceId:v,text:e,speaker:n,by:i.by??{kind:"human",id:"owner"}});return s.errors?ge(s.errors.map(o=>o.detail).join("; ")):s.record!==null?$e(v,s.turn):null}catch(r){return ge(r instanceof Error?r.message:String(r))}},Ge=e=>{if(!v||!i.store)return;let n=i.refreshGraph?.()??i.graph,r=n?.heads.get(v),s=n?.convChains.get(v);if(!n||typeof r!="string"||!s)return;let o=n.getNode(r)?.content?.blob,u=typeof o=="string"?i.store.getBlob(o)?.toString("utf8")??"":"";if(u)for(let h of e){if(h.kind!=="add"||h.convSourceId!==v)continue;let _=de(u,h.cite.turn);if(!(_!==null&&ae(h.cite.quote,_)))for(let R=s.turns;R>=1;R--){let b=de(u,R);if(b!==null&&ae(h.cite.quote,b)){h.cite={...h.cite,turn:R};break}}}},T={startedAt:null,thinkMs:0,toolCalls:0,tools:new Map},W=()=>{T.startedAt??=Date.now()},D=()=>{if(T.toolCalls>0){let e=T.startedAt!=null?Math.max(1,Math.round((Date.now()-T.startedAt)/1e3)):Math.max(1,Math.round(T.thinkMs/1e3));m({kind:"worked",durS:e,toolCalls:T.toolCalls,tools:[...T.tools.entries()].map(([n,r])=>({name:n,n:r}))})}T.startedAt=null,T.thinkMs=0,T.toolCalls=0,T.tools.clear()},Q=null,re=new Map,fe=e=>JSON.stringify([e.id,e.text,e.options.map(n=>n.label)]),F=null,me=new Map,ie=new Map,U=new Map,he=null,p=()=>{H&&(clearTimeout(H),H=null),ke();for(let e of k)e()},ke=()=>{G>0&&g!=null&&g!==te?t.nestedAgent=!0:delete t.nestedAgent},H=null,be=()=>{H||(H=setTimeout(()=>{H=null,ke();for(let e of k)e()},80))},Y=0,m=e=>{e.kind==="childClose"&&Y>0&&(Y-=1),Y>0&&e.kind!=="childOpen"&&e.kind!=="childBack"&&(e.era=Y),e.kind==="childOpen"&&(Y+=1),t.ledger.push(e)},z=null,Z=!1,se=0,V=(e=!1)=>{if(z)m({kind:"agent",text:z});else if(e&&Z){let r=([...t.turns].reverse().find(s=>s.role==="agent")?.items??[]).filter(s=>!s.matches_existing).length;m({kind:"note",text:$().text("chat.refine_hint",{added:r,held:se})})}z=null,Z=!1,se=0,delete t.committing},We=()=>{z=null,Z=!1,delete t.committing},E=null,oe=(e,n=!1,r)=>{if(!E)return;if(e)for(let o of E.items){let u=e.get(o.temp_ref);u&&(o.logical_id=u)}if(r)for(let o of E.items)r.has(o.temp_ref)&&(o.sessionAdded=!0);let s=E.items.filter(o=>o.kind==="test");if(s.length>0){let o;try{o=i.refreshGraph?.()??i.graph}catch{o=i.graph}let u=h=>{if(Ie.test(h))return h;let _=e?.get(h);if(_)return _;let R=h.startsWith("sha256:")?h:U.get(h);return(R?o?.displayNameOf(R):null)??null};for(let h of s){let _=h.extra??{},R=_.verifies?_.verifies.split(", "):[];h.links={covers:_.automates&&_.automates!=="?"?u(_.automates):null,verifies:R.map(u).filter(b=>b!==null),verifiesTotal:R.length}}}if(n)for(let o of E.items)o.logical_id||(o.held=!0);m({kind:"turn",...E}),E=null},ye=()=>{let e=i.refreshGraph?.()??i.graph;if(!i.commitChatTurn||!e?.trust)return!0;let n=[];for(let{item:b}of Oe(t.turns).entries){if(!b.logical_id||b.turnedDown||b.matches_existing||(b.kind??"use-case")!=="use-case")continue;let I=e.names?.get(b.logical_id)??U.get(b.temp_ref);if(!I)continue;let c=e.tipOf(I);e.trust.get(c)==="derived"&&!n.includes(c)&&n.push(c)}let r=new Set(i.addedBefore?.()??[]);for(let b of r){let I=e.tipOf(b);r.has(I)&&e.trust.get(I)==="derived"&&!n.includes(I)&&n.push(I)}if(n.length===0)return!0;l+=1;let s=v||i.session?.state?.sid,o=l+(s?a(s):0),u=s?`chatop:${s}:${o}`:`chatop:${o}`,h=n.map((b,I)=>({kind:"approve",target:b,expectedCid:b,eventId:`${u}:${b}:approve:${I}`})),_;try{_=i.commitChatTurn({graph:e,ops:h,by:i.by??{kind:"human",id:"owner"},...i.descriptor?.mint_gate?{mintable:i.descriptor.mint_gate}:{},...i.session?.state?.sid?{sid:i.session.state.sid}:{}})}catch(b){_={record:null,errors:[{code:"COMMIT_THREW",detail:b instanceof Error?b.message:String(b)}]}}if(_.errors)return t.error=_.errors.map(b=>b.detail).join("; "),m({kind:"commit",ok:!1,line:$().text("chat.commit_failed",{}),warnings:_.errors.map(b=>`${b.code}: ${b.detail}`),refused:Pe(_.errors,e),person:!0}),p(),!1;_.applied.length>0&&i.session?.markApplied(_.applied),m({kind:"commit",ok:!0,line:$().text("chat.approved",{count:_.applied.length})});let R=i.refreshGraph?.();return R&&f&&f(R),xe(R??i.graph),!0},xe=e=>{if(!(!e?.trust||!e.superseded))for(let n of t.turns)for(let r of n.items??[]){let s=r.logical_id&&e.names?.get(r.logical_id)||U.get(r.temp_ref);s&&(ze(e,s)?r.turnedDown=!0:delete r.turnedDown)}},q=()=>{oe(),delete t.committing,t.activeTurn&&(t.activeTurn=null)},ve=(e,n)=>{let r=n.selected_index!=null?e.options[n.selected_index]?.label:void 0;return n.choice||(r!=null?B(r):"?")},K=()=>{let e=t.pending;if(!e)return;if(!e.resolution.every(Boolean)){e.cursor=e.resolution.findIndex(s=>s===null);return}let n=e.questions.map((s,o)=>{let u=e.resolution[o];return u.form==="deferred"?{id:s.id,selected_index:null,free_text:null}:{id:s.id,selected_index:u.selected_index,free_text:u.free_text}});t.pending=null,t.status=t.status==="pausing"?"pausing":"streaming",t.status==="streaming"&&(t.busySince=Date.now());let r=Q;Q=null,r?.(n)},L=(e,n)=>{let r=t.pending,s=r.questions[e],o=r.resolution[e];r.resolution[e]=n;let u=Be(s);o?m({kind:"answer",receipt:{form:"changed",qNum:e+1,stub:u,choice:ve(s,n),prev:o.choice}}):n.form==="deferred"?m({kind:"answer",receipt:{form:"deferred",qNum:e+1,stub:u}}):m({kind:"answer",receipt:{form:n.form,qNum:e+1,stub:u,choice:ve(s,n)}})},we=()=>{let e=t.pending;e&&(e.questions.forEach((n,r)=>{e.resolution[r]||L(r,{form:"deferred",selected_index:null,free_text:null,choice:""})}),K())},X=new Map,_e=e=>{X.clear();let n={high:0,med:1,low:2};return e=e.map((r,s)=>({q:r,i:s})).sort((r,s)=>(n[r.q.risk]??3)-(n[s.q.risk]??3)||r.i-s.i).map(({q:r})=>r),{questions:e,cursor:0,resolution:e.map(()=>null)}},Ce=(e,n)=>{if(t.confirm&&(t.confirm=null),t.pending)return;let r=n==="kane"?{kind:"note",text:$().text("chat.repair_sent",{})}:{kind:"user",text:e};if(!g){t.turns.push({role:"user",text:e}),m(r),t.notice="the agent isn't running \u2014 nothing sent",p();return}t.notice=void 0,ee=!1,t.checkpoint=!1,delete t.resumedParked,V(),t.turns.push({role:"user",text:e}),m(r);let s=pe(e,n);for(t.status="streaming",t.busySince=Date.now(),W(),t.error=void 0,d+=1;S.length>0;)d+=1,g({type:"user_message",message_id:`u${d}-receipt`,text:S.shift()},{by:"kane",receipt:!0});g({type:"user_message",message_id:s??`u${d}`,text:e},{by:n}),p()};return{state:t,explainLines(e){if(!i.explain||!i.graph||!i.store)return null;let n=i.explain(i.store,i.graph,e);return n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(r=>` [${r.kind}] ${r.rationale??r.detail}`)]:null},explainRef(e){if(!i.explain||!i.graph||!i.store){m({kind:"note",text:"explain isn't available here"}),p();return}let n=i.explain(i.store,i.graph,e),r=n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(s=>` [${s.kind}] ${s.rationale??s.detail}`)].join(`
|
|
2
|
+
import{c as Oe}from"./chunk-BWXLZS5O.js";import{a as De,b as Me}from"./chunk-63EKRZKI.js";import{a as qe,c as Ne}from"./chunk-3JLEDSG5.js";import{b as $e,f as de,i as Ee}from"./chunk-ZHAMVLQZ.js";import{A as Ae,D as ae,na as Ie,z as Te}from"./chunk-PI7OXS62.js";import{d as Re}from"./chunk-KU3YHPWZ.js";import{o as $}from"./chunk-HYJVYYAZ.js";var Qe=new Set(["approve","edit","reject"]),Le=new Set(["approve","edit","reject","add","enhance","retract"]);function Fe(i,t){return t?`chatop:${t}:${i}`:`chatop:${i}`}function Ue(i,t,y,w){let k=`${t}:${i.target??"new"}:${i.op}:${i.seq}`,l=i.payload;switch(i.op){case"approve":return{kind:"approve",target:i.target,expectedCid:i.expected_cid,eventId:k};case"edit":{let{reason:C,...a}=l;return{kind:"edit",target:i.target,expectedCid:i.expected_cid,edit:a,reason:C,eventId:k}}case"enhance":return{kind:"enhance",target:i.target,expectedCid:i.expected_cid,edges:l.edges??[],eventId:k};case"retract":{let C=typeof l.reason=="string"?l.reason.trim():"";if(!C)throw new Error("INVALID_RETRACT: a retract needs a non-empty reason");let a=l.edge_ecid!==void 0&&l.edge_ecid!==null,d=l.edge!==void 0&&l.edge!==null;if(a&&d)throw new Error("INVALID_RETRACT: both edge_ecid and edge were sent \u2014 give exactly one");if(!a&&!d)throw new Error("INVALID_RETRACT: neither edge {type, dst, src?} (display refs) nor edge_ecid was sent \u2014 give exactly one");let g={kind:"retract",target:i.target,expectedCid:i.expected_cid,reason:C};if(a){if(typeof l.edge_ecid!="string"||!l.edge_ecid)throw new Error("INVALID_RETRACT: edge_ecid must be a non-empty string");return{...g,edgeEcid:l.edge_ecid,eventId:`${t}:${i.target}:retract:e:${l.edge_ecid}:${i.seq}`}}let f=l.edge;if(typeof f!="object"||typeof f.type!="string"||!f.type||typeof f.dst!="string"||!f.dst)throw new Error("INVALID_RETRACT: edge needs {type, dst} (src optional), all display refs");if(f.src!==void 0&&f.src!==null&&(typeof f.src!="string"||!f.src))throw new Error("INVALID_RETRACT: edge.src, when given, must be a non-empty display ref");let v=typeof f.src=="string"?f.src:void 0;return{...g,edgeRef:{type:f.type,dst:f.dst,...v!==void 0?{src:v}:{}},eventId:`${t}:${i.target}:retract:t:${f.type}:${f.dst}:${v??"-"}:${i.seq}`}}case"reject":return{kind:"reject",target:i.target,expectedCid:i.expected_cid,reason:l.reason??"",redirectTo:l.redirect_to,eventId:k};case"add":{let C=l.proposal_item??{},a=String(C.label??"");if(!y.mint_gate.includes(a))throw new Error(`GATED_LABEL: cannot mint "${a}" (gate: ${y.mint_gate.join(", ")})`);let d=C.cite??{},g=C.conv_source_id??w;if(!g||typeof d.turn!="number"||!d.quote)throw new Error("INVALID_ADD: a chat add requires a conversation cite {turn, quote} and conv_source_id");let f=C.content,v=f&&typeof f=="object"&&!Array.isArray(f)&&Object.keys(f).length>0?f:null,A=new Set(["label","cite","conv_source_id","content","rationale","edges"]),S=v??Object.fromEntries(Object.entries(C).filter(([N])=>!A.has(N)));return{kind:"add",label:a,content:S,cite:{turn:d.turn,quote:d.quote},convSourceId:g,rationale:C.rationale,eventId:k}}}}function je(i,t,y={}){let w=y.turn??0,k=[],l=[];for(let[d,g]of i.entries()){let f=Te(g,`ops[${d}]`);if(f!==null)throw new Error(`NUL_IN_TEXT: ${Ae(f)}`)}for(let d of i){if(!Le.has(d.op))throw new Error(`UNKNOWN_OP: "${d.op}" is not a chat op (accepted: ${[...Le].join(", ")})`);if(d.op!=="add"&&!d.target)throw new Error(`MISSING_TARGET: a ${d.op} op needs a target ref`)}for(let d of i)(d.op==="add"||d.op==="enhance"||d.op==="retract")&&l.push(d);let C=new Map;for(let d of i){if(!Qe.has(d.op)||!d.target)continue;let g=C.get(d.target)??[];g.push(d),C.set(d.target,g)}for(let[d,g]of C){let f=Math.max(...g.map(A=>A.seq)),v=g.filter(A=>A.seq===f);if(v.length>1){k.push({target:d,seq:f,kinds:v.map(A=>A.op)});continue}l.push(v[0])}return{chatOps:l.sort((d,g)=>d.seq-g.seq).map(d=>Ue(d,y.prefix??Fe(w,y.session),t,y.convSourceId)),ambiguous:k}}function Pe(i,t){return i.map(y=>{let w=y.data?.tip;if(y.code!=="EXPECTED_CID_MOVED"||typeof w!="string")return{code:y.code};let k=t?.getNode(w)?.content??{},l=typeof k.title=="string"?k.title:typeof k.text=="string"?k.text:void 0,C=t?.displayNameOf(w)??(typeof y.data?.target=="string"?y.data.target:void 0);return{code:y.code,moved:y.data?.moved===!0,...C?{ref:C}:{},...l?{title:l}:{}}})}function He(i){let t=[];return i.questions.forEach((y,w)=>{if(i.resolution[w])return;let k=y.recommended_index!=null?y.options[y.recommended_index]?.label:void 0;k!=null&&t.push(y.risk==="high"?`${B(k)} \u203C`:B(k))}),t.length>3?`${t.slice(0,3).join(" \xB7 ")} \xB7 +${t.length-3} more`:t.join(" \xB7 ")}function B(i){return i.replace(/\s*\(recommended\)\s*$/i,"")}function Be(i){let t=i.text.replace(/\?+\s*$/,"");return t.length<=36?t:`${t.slice(0,33)}\u2026`}function ze(i,t){let y=new Set;for(let w=t;w&&!y.has(w);w=i.superseded.get(w)){if(i.trust.get(w)==="archived")return!0;y.add(w)}return!1}function Ve(i){return i.use_cases??[]}var Ke={acs:"acceptance criteria",scenarios:"scenarios",exercises:"exercises",tests:"tests",gaps:"gaps"};function Xe(i){let t=[],y=[],w=(a,d)=>{d.length!==0&&(y.push(a),t.push(...d))},k=a=>typeof a=="string"&&/^[a-z]{1,4}\d{1,4}$/i.test(a)?a:null,l=a=>{let d=k(a.automates)??"1 scenario",g=a.verifies??[],f=g.map(k).filter(S=>S!==null).slice(0,2),v=g.length-f.length,A=f.length?`${f.join(" ")}${v>0?` +${v}`:""}`:`${g.length} ACs`;return`covers ${d} \xB7 verifies ${A}`};w("acs",(i.acs??[]).map(a=>({temp_ref:a.temp_ref,title:a.text,kind:"ac",badge:String(a.kind),extra:{...a.expected_answer?{expects:`${String(a.expected_answer.operator??"")} \xB7 ${String(a.expected_answer.operand??"")}`}:{},"scoped to":a.scoped_to??"(use-case)"}}))),w("scenarios",(i.scenarios??[]).map(a=>({temp_ref:a.temp_ref,title:a.title,kind:"scenario",badge:a.case_type,why:a.intent,depends_on_hint:a.depends_on??[],extra:{technique:a.technique_notes}}))),w("exercises",(i.exercises??[]).map(a=>({temp_ref:k(a.scenario)??"wiring",title:`${k(a.scenario)??"scenario"} exercises ${k(a.ac)??"1 AC"}`,kind:"exercise",badge:"wires",why:a.rationale}))),w("tests",(i.tests??[]).map(a=>({temp_ref:a.temp_ref,title:a.title,kind:"test",why:l(a),depends_on_hint:a.reuses??[],extra:{automates:String(a.automates??"?"),verifies:(a.verifies??[]).join(", "),check:a.check?`${String(a.check.kind)} vs ${String(a.check.verified_against)}`:"?"}})));let C={high:"high",medium:"med",med:"med",low:"low"};return w("gaps",(i.gaps??[]).map(a=>{let d=a.question??{};return{temp_ref:a.temp_ref??a.ref??"?",title:String(d.header??a.kind),kind:"gap",badge:C[String(a.risk??"").trim().toLowerCase()]??"",why:d.prompt??d.text??"",question:String(d.prompt??d.text??d.header??""),rationale:String(a.risk_rationale??"")}})),{items:t,heading:y.join(" + ")||"design"}}function ut(i={}){let t={turns:[],thinking:De(),pending:null,confirm:null,status:"idle",ledger:[],activeTurn:null,stream:null,checkpoint:!1},y=e=>{let n=[],r=e.minted.map(u=>u.slug).filter(Boolean);r.length&&n.push(`added ${r.join(", ")}`);let s=e.applied.length-e.minted.length;s>0&&n.push(`${s} change${s===1?"":"s"} applied`);let o=e.staleDelta.length?$().text("chat.stales",{count:e.staleDelta.length}):"";return o&&n.push(o),n.join(" \xB7 ")||"no changes"},w=(e,n)=>{let r=i.refreshGraph?.()??i.graph;return!r?.nodeLabel||n.applied.length===0||n.minted.length>0||n.staleDelta.length>0?!1:e.every(s=>{if(s.kind!=="approve"||!s.target)return!1;let o=r.resolve(s.target);return o!==null&&r.nodeLabel.get(r.tipOf(o.cid))==="usecase"})},k=[];i.onRender&&k.push(i.onRender);let l=0,C=new Map,a=e=>{let n=C.get(e);if(n===void 0){let r=`chatop:${e}:`;n=0;for(let s of(i.refreshGraph?.()??i.graph)?.appliedEvents??[]){if(!s.startsWith(r))continue;let o=Number(s.slice(r.length).split(":")[0]);Number.isInteger(o)&&o>n&&(n=o)}C.set(e,n)}return n},d=0,g=null,f=null,v=null,A=null,S=[],N=null,ee=!1,G=0,te=null,M=null,ne=0,ue=0,le=!1,ce=!1,ge=e=>(le||(le=!0,m({kind:"note",text:$().text("note.turns_unrecorded",{detail:e})}),p()),null),pe=(e,n)=>{if(!v||!i.store||!e.trim())return null;try{let r=i.refreshGraph?.()??i.graph;if(!r)return null;let s=Ee({store:i.store,graph:r,sourceId:v,text:e,speaker:n,by:i.by??{kind:"human",id:"owner"}});return s.errors?ge(s.errors.map(o=>o.detail).join("; ")):s.record!==null?$e(v,s.turn):null}catch(r){return ge(r instanceof Error?r.message:String(r))}},Ge=e=>{if(!v||!i.store)return;let n=i.refreshGraph?.()??i.graph,r=n?.heads.get(v),s=n?.convChains.get(v);if(!n||typeof r!="string"||!s)return;let o=n.getNode(r)?.content?.blob,u=typeof o=="string"?i.store.getBlob(o)?.toString("utf8")??"":"";if(u)for(let h of e){if(h.kind!=="add"||h.convSourceId!==v)continue;let _=de(u,h.cite.turn);if(!(_!==null&&ae(h.cite.quote,_)))for(let R=s.turns;R>=1;R--){let b=de(u,R);if(b!==null&&ae(h.cite.quote,b)){h.cite={...h.cite,turn:R};break}}}},T={startedAt:null,thinkMs:0,toolCalls:0,tools:new Map},W=()=>{T.startedAt??=Date.now()},D=()=>{if(T.toolCalls>0){let e=T.startedAt!=null?Math.max(1,Math.round((Date.now()-T.startedAt)/1e3)):Math.max(1,Math.round(T.thinkMs/1e3));m({kind:"worked",durS:e,toolCalls:T.toolCalls,tools:[...T.tools.entries()].map(([n,r])=>({name:n,n:r}))})}T.startedAt=null,T.thinkMs=0,T.toolCalls=0,T.tools.clear()},Q=null,re=new Map,fe=e=>JSON.stringify([e.id,e.text,e.options.map(n=>n.label)]),F=null,me=new Map,ie=new Map,U=new Map,he=null,p=()=>{H&&(clearTimeout(H),H=null),ke();for(let e of k)e()},ke=()=>{G>0&&g!=null&&g!==te?t.nestedAgent=!0:delete t.nestedAgent},H=null,be=()=>{H||(H=setTimeout(()=>{H=null,ke();for(let e of k)e()},80))},Y=0,m=e=>{e.kind==="childClose"&&Y>0&&(Y-=1),Y>0&&e.kind!=="childOpen"&&e.kind!=="childBack"&&(e.era=Y),e.kind==="childOpen"&&(Y+=1),t.ledger.push(e)},z=null,Z=!1,se=0,V=(e=!1)=>{if(z)m({kind:"agent",text:z});else if(e&&Z){let r=([...t.turns].reverse().find(s=>s.role==="agent")?.items??[]).filter(s=>!s.matches_existing).length;m({kind:"note",text:$().text("chat.refine_hint",{added:r,held:se})})}z=null,Z=!1,se=0,delete t.committing},We=()=>{z=null,Z=!1,delete t.committing},E=null,oe=(e,n=!1,r)=>{if(!E)return;if(e)for(let o of E.items){let u=e.get(o.temp_ref);u&&(o.logical_id=u)}if(r)for(let o of E.items)r.has(o.temp_ref)&&(o.sessionAdded=!0);let s=E.items.filter(o=>o.kind==="test");if(s.length>0){let o;try{o=i.refreshGraph?.()??i.graph}catch{o=i.graph}let u=h=>{if(Ie.test(h))return h;let _=e?.get(h);if(_)return _;let R=h.startsWith("sha256:")?h:U.get(h);return(R?o?.displayNameOf(R):null)??null};for(let h of s){let _=h.extra??{},R=_.verifies?_.verifies.split(", "):[];h.links={covers:_.automates&&_.automates!=="?"?u(_.automates):null,verifies:R.map(u).filter(b=>b!==null),verifiesTotal:R.length}}}if(n)for(let o of E.items)o.logical_id||(o.held=!0);m({kind:"turn",...E}),E=null},ye=()=>{let e=i.refreshGraph?.()??i.graph;if(!i.commitChatTurn||!e?.trust)return!0;let n=[];for(let{item:b}of Oe(t.turns).entries){if(!b.logical_id||b.turnedDown||b.matches_existing||(b.kind??"use-case")!=="use-case")continue;let I=e.names?.get(b.logical_id)??U.get(b.temp_ref);if(!I)continue;let c=e.tipOf(I);e.trust.get(c)==="derived"&&!n.includes(c)&&n.push(c)}let r=new Set(i.addedBefore?.()??[]);for(let b of r){let I=e.tipOf(b);r.has(I)&&e.trust.get(I)==="derived"&&!n.includes(I)&&n.push(I)}if(n.length===0)return!0;l+=1;let s=v||i.session?.state?.sid,o=l+(s?a(s):0),u=s?`chatop:${s}:${o}`:`chatop:${o}`,h=n.map((b,I)=>({kind:"approve",target:b,expectedCid:b,eventId:`${u}:${b}:approve:${I}`})),_;try{_=i.commitChatTurn({graph:e,ops:h,by:i.by??{kind:"human",id:"owner"},...i.descriptor?.mint_gate?{mintable:i.descriptor.mint_gate}:{},...i.session?.state?.sid?{sid:i.session.state.sid}:{}})}catch(b){_={record:null,errors:[{code:"COMMIT_THREW",detail:b instanceof Error?b.message:String(b)}]}}if(_.errors)return t.error=_.errors.map(b=>b.detail).join("; "),m({kind:"commit",ok:!1,line:$().text("chat.commit_failed",{}),warnings:_.errors.map(b=>`${b.code}: ${b.detail}`),refused:Pe(_.errors,e),person:!0}),p(),!1;_.applied.length>0&&i.session?.markApplied(_.applied),m({kind:"commit",ok:!0,line:$().text("chat.approved",{count:_.applied.length})});let R=i.refreshGraph?.();return R&&f&&f(R),xe(R??i.graph),!0},xe=e=>{if(!(!e?.trust||!e.superseded))for(let n of t.turns)for(let r of n.items??[]){let s=r.logical_id&&e.names?.get(r.logical_id)||U.get(r.temp_ref);s&&(ze(e,s)?r.turnedDown=!0:delete r.turnedDown)}},q=()=>{oe(),delete t.committing,t.activeTurn&&(t.activeTurn=null)},ve=(e,n)=>{let r=n.selected_index!=null?e.options[n.selected_index]?.label:void 0;return n.choice||(r!=null?B(r):"?")},K=()=>{let e=t.pending;if(!e)return;if(!e.resolution.every(Boolean)){e.cursor=e.resolution.findIndex(s=>s===null);return}let n=e.questions.map((s,o)=>{let u=e.resolution[o];return u.form==="deferred"?{id:s.id,selected_index:null,free_text:null}:{id:s.id,selected_index:u.selected_index,free_text:u.free_text}});t.pending=null,t.status=t.status==="pausing"?"pausing":"streaming",t.status==="streaming"&&(t.busySince=Date.now());let r=Q;Q=null,r?.(n)},L=(e,n)=>{let r=t.pending,s=r.questions[e],o=r.resolution[e];r.resolution[e]=n;let u=Be(s);o?m({kind:"answer",receipt:{form:"changed",qNum:e+1,stub:u,choice:ve(s,n),prev:o.choice}}):n.form==="deferred"?m({kind:"answer",receipt:{form:"deferred",qNum:e+1,stub:u}}):m({kind:"answer",receipt:{form:n.form,qNum:e+1,stub:u,choice:ve(s,n)}})},we=()=>{let e=t.pending;e&&(e.questions.forEach((n,r)=>{e.resolution[r]||L(r,{form:"deferred",selected_index:null,free_text:null,choice:""})}),K())},X=new Map,_e=e=>{X.clear();let n={high:0,med:1,low:2};return e=e.map((r,s)=>({q:r,i:s})).sort((r,s)=>(n[r.q.risk]??3)-(n[s.q.risk]??3)||r.i-s.i).map(({q:r})=>r),{questions:e,cursor:0,resolution:e.map(()=>null)}},Ce=(e,n)=>{if(t.confirm&&(t.confirm=null),t.pending)return;let r=n==="kane"?{kind:"note",text:$().text("chat.repair_sent",{})}:{kind:"user",text:e};if(!g){t.turns.push({role:"user",text:e}),m(r),t.notice="the agent isn't running \u2014 nothing sent",p();return}t.notice=void 0,ee=!1,t.checkpoint=!1,delete t.resumedParked,V(),t.turns.push({role:"user",text:e}),m(r);let s=pe(e,n);for(t.status="streaming",t.busySince=Date.now(),W(),t.error=void 0,d+=1;S.length>0;)d+=1,g({type:"user_message",message_id:`u${d}-receipt`,text:S.shift()},{by:"kane",receipt:!0});g({type:"user_message",message_id:s??`u${d}`,text:e},{by:n}),p()};return{state:t,explainLines(e){if(!i.explain||!i.graph||!i.store)return null;let n=i.explain(i.store,i.graph,e);return n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(r=>` [${r.kind}] ${r.rationale??r.detail}`)]:null},explainRef(e){if(!i.explain||!i.graph||!i.store){m({kind:"note",text:"explain isn't available here"}),p();return}let n=i.explain(i.store,i.graph,e),r=n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(s=>` [${s.kind}] ${s.rationale??s.detail}`)].join(`
|
|
3
3
|
`):`unknown ref: ${e}`;m({kind:"note",text:r}),p()},subscribe(e){return k.push(e),()=>{let n=k.indexOf(e);n>=0&&k.splice(n,1)}},submit(e){Ce(e,"person")},repair(e){Ce(e,"kane")},attachSender(e){let n=g;return g=e,()=>{g=n}},attachOnCommitted(e){f=e},attachConversationSource(e){v=e},opIdPrefix(e){A=e},attachSession(e){i.session=e},enterNested(e){if(G+=1,G>1)return()=>{G-=1};let n={checkpoint:t.checkpoint,receipts:S.splice(0,S.length)};te=g,M=t.credits?.total??0,t.checkpoint=!1,t.status==="idle"&&(t.status="working",t.workingLabel=e,t.busySince=Date.now()),p();let r=!1;return()=>{r||(r=!0,G-=1,te=null,M!==null&&(ne+=Math.max(0,(t.credits?.total??M)-M)),M=null,S.splice(0,S.length,...n.receipts),t.checkpoint=n.checkpoint,t.status==="working"&&(t.status="idle",t.workingLabel=void 0,t.busySince=void 0),p())}},holdReceipt(e,n){S.push(e),n?.checkIn!==!1&&(t.checkpoint=!0),p()},drainHeldReceipts(){return S.splice(0,S.length)},peekHeldReceipts(){return[...S]},submitAnswer(e,n){let r=t.pending,s=r?.questions[e],o=s?.options[n]?.label;!r||!s||o==null||(L(e,{form:"answered",selected_index:n,free_text:null,choice:B(o)}),K(),p())},submitFreeText(e,n){let r=t.pending,s=r?.questions[e],o=n.trim();!r||!s||!o||(L(e,{form:"answered",selected_index:null,free_text:o,choice:o}),K(),p())},deferBatch(e){let n=t.pending;if(!n||!Q)return;n.questions.forEach((s,o)=>{let u=n.resolution[o];u&&u.form==="answered"&&re.set(fe(s),u)}),t.pending=null,t.status=t.status==="pausing"?"pausing":"streaming",t.status==="streaming"&&(t.busySince=Date.now()),m({kind:"note",text:`questions set aside \u2014 source ${e.source_id} landed; the agent reads it next`});let r=Q;Q=null,r({deferred:!0,ingested:e}),p()},submitAnswerWithText(e,n,r){let s=t.pending,o=s?.questions[e],u=o?.options[n]?.label;if(!s||!o||u==null)return;let h=r.trim();L(e,{form:"answered",selected_index:n,free_text:h||null,choice:h?`${B(u)} \u2014 ${h}`:B(u)}),K(),p()},toggleOption(e,n){let r=t.pending?.questions[e];if(!r||r.options[n]==null)return;let s=X.get(e)??new Set;s.has(n)?s.delete(n):s.add(n),X.set(e,s),p()},multiSelection(e){return[...X.get(e)??[]].sort((n,r)=>n-r)},confirmMulti(e){let n=t.pending,r=n?.questions[e];if(!n||!r)return;let s=[...X.get(e)??[]].sort((u,h)=>u-h).map(u=>r.options[u]?.label).filter(u=>u!=null);if(s.length===0)return;X.delete(e);let o=s.join(", ");L(e,{form:"answered",selected_index:null,free_text:o,choice:o}),K(),p()},goWithRecommendations(){let e=t.pending;if(!e)return{picks:""};let n=He(e),r=null;return e.questions.forEach((s,o)=>{if(e.resolution[o])return;let u=s.recommended_index,h=u!=null?s.options[u]?.label:void 0;if(h==null){r===null&&(r=o);return}L(o,{form:"assumed",selected_index:u,free_text:null,choice:B(h)})}),r!==null?(e.cursor=r,p(),{blocked:r}):(K(),p(),{picks:n})},reopenQuestion(){let e=t.pending;if(!e)return;let n=e.cursor<0?e.questions.length:e.cursor;for(let r=n-1;r>=0;r--)if(e.resolution[r]){e.cursor=r,p();return}},continueParked(){if(g&&!(G>0&&g===te)){for(t.checkpoint=!1,m({kind:"continued"});S.length>0;)d+=1,g({type:"user_message",message_id:`u${d}-receipt`,text:S.shift()},{by:"kane",receipt:!0});d+=1,g({type:"user_message",message_id:`u${d}`,text:"continue"},{by:"person",continued:!0}),t.status="streaming",t.busySince=Date.now(),W(),p()}},note(e){m({kind:"note",text:e}),p()},finalizeForExit(){q(),D(),V(),t.stream=null,p()},aliasOf(e){return U.get(e)},guardOps(e){return N=e,ee=!1,()=>{N===e&&(N=null)}},registerAliases(e,n){for(let r of e)U.set(r.ref,r.cid);if(n?.unchanged){E=null,p();return}oe(new Map(e.filter(r=>r.id).map(r=>[r.ref,r.id])),!1,new Set(e.filter(r=>r.own).map(r=>r.ref))),p()},endUnstartedTurn(){t.status!=="streaming"&&t.status!=="working"||(t.status="idle",t.workingLabel=void 0,t.busySince=void 0,p())},answersHeld(e){ie=new Map(e.map(n=>[n.id,n.digest]))},resumedParked(){t.status="idle",t.workingLabel=void 0,t.busySince=void 0,t.resumedParked=!0,p()},restoreCheckIn(){let e=i.resumedCheckIn?.()??null;e!==null&&(t.resumed=e,t.checkpoint=!0,p())},setWorking(e){if(e!=null){if(t.status!=="idle"&&t.status!=="working")return;t.status==="idle"&&(t.busySince=Date.now()),W(),t.status="working",t.workingLabel=e}else{if(t.status!=="working")return;t.status="idle",t.workingLabel=void 0,t.busySince=void 0}p()},narrated(e,n){q(),t.stream=null,t.busySince=void 0,D(),n&&m(n),e&&m({kind:"agent",text:e}),(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0,p()},ledger(e){if(e.kind==="commit"&&(oe(void 0,e.held===!0),se+=e.heldChanges??0),e.kind==="error"&&(q(),D(),V()),e.kind==="commit"&&(e.notes!==void 0||e.quiet)){let{notes:n,quiet:r,...s}=e;m(r?{kind:"note",text:s.line}:s);for(let o of n??[])m({kind:"note",text:o})}else m(e);e.kind==="commit"&&(e.ok?V(!0):We()),p()},senderAlive(){return g!=null},approveAdded(){let e=ye();return p(),e},completeSession(e){e?.approveAdded&&!ye()||(we(),g?.({type:"session_complete"}),t.status="idle",t.busySince=void 0,p())},requestPause(){we(),t.status="pausing",t.busySince=void 0;let e=g;Promise.resolve().then(()=>e?.({type:"pause"})),p()},ask(e){t.pending=_e(e),me=new Map(e.map((r,s)=>[r.id,s+1])),t.status="awaiting-input",t.busySince=void 0;let n=new Promise(r=>{Q=r});if(re.size>0){let r=0;e.forEach((s,o)=>{let u=fe(s),h=re.get(u);h&&(re.delete(u),L(o,{...h}),r+=1)}),r>0&&m({kind:"note",text:`your earlier answer${r>1?"s are":" is"} pre-filled \u2014 press enter to send, or pick a different answer`})}return p(),n},attachIngest(e){let n=F;return F=e,()=>{F===e&&(F=n)}},canIngest(){return F!==null},async ingestAttach(e){let n=F,r=e.trim();if(!n||!r)return;let s;try{s=await n(r)}catch(o){s={ok:!1,error:o instanceof Error?o.message:String(o)}}s.ok||(m({kind:"note",text:s.error??"the source could not be ingested"}),p())},noteCoercion(e,n){m({kind:"answer",receipt:{form:"assumed",qNum:me.get(e.id)??0,stub:Be(e),choice:n,note:"your typed answer couldn't be used here"}}),p()},nothingCommitted(){t.committing&&(delete t.committing,p())},creditsCarriedIn(e){e<=0||(t.credits={turn:t.credits?.turn??0,total:(t.credits?.total??0)+e},ne+=e,p())},creditsSoFar(e,n){if(!(e<=0)){if(M!==null){t.credits={turn:0,total:M+e},p();return}t.credits||(t.credits={turn:0,total:e},n!==void 0&&n>0&&(ne=n),p())}},onAgentEvent(e){switch(e.type){case"reasoning_delta":case"reasoning_done":case"tool_activity":case"decision_activity":{let n=t.thinking;if(t.thinking=Me(n,e),t.thinking!==n&&(e.type==="reasoning_done"&&e.present?(W(),T.thinkMs+=e.took_ms):e.type==="tool_activity"&&e.status!=="started"&&(W(),T.toolCalls+=1,T.tools.set(e.name,(T.tools.get(e.name)??0)+1))),e.type==="reasoning_delta"){be();return}break}case"usage":t.credits={turn:e.credits,total:(M??ne)+e.total_credits};break;case"text_delta":{let n=he;if(n&&(e.turn_id<n.turn_id||e.turn_id===n.turn_id&&e.attempt<n.attempt))return;(!n||n.turn_id!==e.turn_id||n.attempt!==e.attempt)&&(he={turn_id:e.turn_id,attempt:e.attempt},t.stream={text:""}),t.stream={text:(t.stream?.text??"")+e.text},be();return}case"progress":break;case"proposal":{l+=1,q(),t.stream=null,t.busySince=void 0,D();let n=Ve(e.proposal),r=i.dedupFlags?.(e.proposal);if(r)for(let o of n){let u=r.get(o.temp_ref);u&&(o.matches_existing=u)}let s=i.refreshGraph?.()??i.graph;if(s)for(let o of n){let u=o.matches_existing?.cid,h=typeof u=="string"?s.displayNameOf(u):null;h&&(o.matched_id=h)}t.turns.push({role:"agent",turnIndex:l,items:n,text:e.narrative}),z=e.narrative??null,Z=!0,t.committing=!0,t.activeTurn={turnIndex:l,heading:"use-cases",items:n},E={turnIndex:l,heading:"use-cases",items:n},(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0;break}case"design":{l+=1,q(),t.stream=null,t.busySince=void 0,D();let{items:n,heading:r}=Xe(e.design),s=e.design.phase==="wiring"?"acceptance criteria + exercises":r.split(" + ").map(o=>Ke[o]??o).join(" + ");m({kind:"banner",text:`designing: ${s}`}),t.turns.push({role:"agent",turnIndex:l,items:n,itemsHeading:r,text:e.narrative}),z=e.narrative??null,Z=!0,t.committing=!0,t.activeTurn={turnIndex:l,heading:r,items:n},E={turnIndex:l,heading:r,items:n},(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0;break}case"ask_user":if(D(),e.questions.length>0&&e.questions.every(n=>ie.get(n.id)===Ne(n))){for(let n of e.questions)ie.delete(n.id);break}t.pending=_e(e.questions),t.status="awaiting-input",t.busySince=void 0;break;case"chat_ops":{l+=1,q(),D(),t.stream=null,(t.status==="streaming"||t.status==="working")&&(t.status="idle",t.busySince=void 0,t.workingLabel=void 0);let n=e.chat_ops??e,r=Array.isArray(n.ops)?n.ops:[],s=n.text??e.text??"",o=i.refreshGraph?.()??i.graph,u=c=>U.get(c)??c,h=r.map(c=>{if(!c.target)return c;let x=u(c.target),O=c.expected_cid;if(O==null&&o){let Se=o.resolve(x);Se&&(O=o.tipOf(Se.cid))}let j=c.payload?.redirect_to,P=j&&u(j);return x===c.target&&O===c.expected_cid&&P===j?c:{...c,target:x,expected_cid:O,...P!==j?{payload:{...c.payload,redirect_to:P}}:{}}}),_;try{if(!Array.isArray(n.ops))throw new Error("the agent sent an unreadable change set (no ops array) \u2014 say it again in different words");let c=v||i.session?.state?.sid,x=A;A=null,_=je(h,i.descriptor??{mint_gate:[]},{turn:l+(c?a(c):0),...c?{session:c}:{},...x?{prefix:x}:{},...v?{convSourceId:v}:{}})}catch(c){t.error=c instanceof Error?c.message:String(c),t.turns.push({role:"agent",turnIndex:l,text:s,narration:t.error}),s&&m({kind:"agent",text:s}),m({kind:"error",title:t.error,detail:[]}),S.push(`OPS REJECTED (did not compile) \u2014 nothing landed; do not assume any of your last ops applied.
|
|
4
4
|
- `+t.error);break}let{chatOps:R,ambiguous:b}=_;if(b.length>0){let c=b[0];t.confirm={kind:"ambiguity-confirm",prompt:`did you mean edit or ${c.kinds.filter(x=>x!=="edit").join("/")} on ${c.target}?`},t.turns.push({role:"agent",turnIndex:l,text:s}),s&&m({kind:"agent",text:s});break}Ge(R);let I=R.length>0&&N?N(R):null;if(I){if(t.turns.push({role:"agent",turnIndex:l,text:s}),S.push(I),g&&!ee)for(ee=!0,t.status="streaming",t.busySince=Date.now(),W();S.length>0;)d+=1,g({type:"user_message",message_id:`u${d}-receipt`,text:S.shift()},{by:"kane",receipt:!0});break}if(i.commitChatTurn&&R.length>0){let c;try{c=i.commitChatTurn({graph:i.refreshGraph?.()??i.graph,ops:R,by:i.by??{kind:"human",id:"owner"},...i.descriptor?.mint_gate?{mintable:i.descriptor.mint_gate}:{},...i.session?.state?.sid?{sid:i.session.state.sid}:{}})}catch(x){c={record:null,errors:[{code:"COMMIT_THREW",detail:x instanceof Error?x.message:String(x)}]}}if(c.errors)t.error=c.errors.map(x=>x.detail).join("; "),t.turns.push({role:"agent",turnIndex:l,text:s}),m({kind:"commit",ok:!1,line:$().text("chat.commit_failed",{}),warnings:c.errors.map(x=>`${x.code}: ${x.detail}`),refused:Pe(c.errors,o)}),S.push(["COMMIT FAILED (chat turn) \u2014 nothing landed; do not assume any of your last ops applied.",...c.errors.map(x=>`- ${x.code}: ${x.detail}${x.code==="EXPECTED_CID_MOVED"&&typeof x.data?.tip=="string"?`; its current cid is ${x.data.tip}`:""}`),...c.errors.some(x=>x.code==="UNKNOWN_FIELD")?["If you were changing citations or matched-existing content, that is proposal territory (approve/re-propose) \u2014 a chat edit can only replace a node's own schema fields."]:[]].join(`
|
|
5
5
|
`)),s&&m({kind:"agent",text:s});else{c.applied.length>0&&i.session?.markApplied(c.applied);let x=w(R,c)?$().text("chat.approved",{count:c.applied.length}):y(c);t.turns.push({role:"agent",turnIndex:l,text:s,narration:x}),m({kind:"commit",ok:!0,line:x});let O=i.refreshGraph?.();if(O&&f&&f(O),xe(O??i.graph),O)try{ue+=1;let J=i.descriptor?.mint_gate?.includes("usecase")?"extract":"design",j=qe({verb:J,commitN:ue,phase:"chat",committed:c.minted.map(P=>({cid:P.cid,...P.slug?{logical_id:P.slug}:{}})),...Re(i.templateVersion?.()??null)>=8?{typedBlockers:!0,...i.ucRef?{ucRef:i.ucRef}:{}}:{},...(i.pendingForceScope?.()??[]).length?{ignoreGaps:new Set(i.pendingForceScope())}:{}},O);S.push(j.text)}catch(J){ce||(ce=!0,m({kind:"note",text:$().text("note.receipt_unbuilt",{detail:J instanceof Error?J.message:String(J)})}))}s&&m({kind:"agent",text:s})}}else t.turns.push({role:"agent",turnIndex:l,text:s}),s&&m({kind:"agent",text:s});pe(s,"agent");break}case"done":case"session_complete":q(),D(),V(),t.status="idle",t.busySince=void 0,g=null;break;case"error":q(),D(),V(),t.stream=null,t.status="idle",t.busySince=void 0,t.error=e.message,g=null,m({kind:"error",title:e.message,detail:[]});break;case"session_paused":break;case"turn_retry":m({kind:"note",text:$().text("note.model_retry",{seconds:Math.round(e.wait_s)})});break;default:break}p()}}}export{He as a,B as b,Be as c,ut as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as S}from"./chunk-
|
|
2
|
+
import{a as S}from"./chunk-XHFU5TGS.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as b,b as c,j as x}from"./chunk-33DWJV67.js";import{a as $}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-FAMQ4DHU.js";import{e as y}from"./chunk-UR6MHSHU.js";var T=y($(),1);var n=y(R(),1);function k(e){return e.caseTc!==void 0&&!e.anyAuthorStepRan&&!e.degradedReadonly&&!e.lockHeld}function A(e){let t=e.decisions.filter(a=>a.kind==="replay").length,l=e.decisions.filter(a=>a.kind==="author").length,p=e.outcomes.filter(a=>a.status==="passed").length,f=e.outcomes.filter(a=>a.status==="failed").length,h=e.outcomes.filter(a=>a.status==="skipped").length,s=o.green,u;e.cancelled||e.overallStatus==="interrupted"?(s=o.orange,u="CANCELLED"):e.overallStatus==="failed"?(s=o.red,u="FAILED"):u="PASSED";let r=`${u} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${p} passed, ${f} failed, ${h} skipped)`,C=`${t} replay \xB7 ${l} author`,v=e.retryTriggered,_="yes \u2014 healed after a replay miss",i,m=o.dim;if(e.cancelled)i="\u2013 not committed (cancellation)";else if(e.uploadResult?.notSaved)i=e.caseTc?`\u2717 not pushed to ${e.caseTc}`:"\u2717 not pushed",m=o.red;else if(e.overallStatus==="failed")i="\u2013 not committed (run failed)",m=o.red;else if(!e.shouldCommit)e.isFirstRun?i="\u2013 not committed (first run skipped commit)":k(e)?i=`\u2013 ${e.caseTc} unchanged: every step replayed`:e.lockHeld?i="\u2013 not committed":i="\u2013 not committed (readonly fallback / no lock)";else if(e.committed===!1&&!e.uploadResult?.testcaseId)i="\u2013 not committed (commit did not land)",m=o.red;else{let a=e.uploadResult?.testcaseId;i=e.caseTc?`\u2713 pushed to ${e.caseTc}`:a?`\u2713 pushed (testcase=${a})`:"\u2713 pushed",m=o.green}let D=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",d,g=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success||e.uploadResult?.notSaved?(d="\u2713 TMS",g=o.green):e.uploadResult?(d=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,g=o.red):d="\u2013 not run":d="\u2013 skipped (--local or no auth)",{resultLine:{color:s,text:r},breakdown:C,showRetries:v,retriesText:_,commitText:i,commitColor:m,artifactsText:D,uploadText:d,uploadColor:g}}function O(e){let t=e.decisions.filter(r=>r.kind==="replay").length,l=e.decisions.filter(r=>r.kind==="author").length,p=e.outcomes.filter(r=>r.status==="passed").length,f=e.outcomes.filter(r=>r.status==="failed").length,h=e.outcomes.filter(r=>r.status==="skipped").length,s,u=!1;return e.cancelled?s="cancellation":e.overallStatus==="failed"?s="run_failed":e.shouldCommit&&(e.committed===!0||e.uploadResult?.testcaseId)?(s="ok",u=!0):!e.shouldCommit&&!e.isFirstRun&&k(e)?s="unchanged":!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?s="readonly_fallback":s="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:p,failed:f,skipped:h,replay_decisions:t,author_decisions:l},adaptive_heal:{triggered:e.retryTriggered},commit:{committed:u,reason:s,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled,...e.imports&&e.imports.length>0?{imports:e.imports}:{}}}function B({data:e}){let t=A(e),l=[{label:"result",value:(0,n.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,n.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&l.push({label:"adaptive heal",value:(0,n.jsx)(c,{color:o.orange,children:t.retriesText})}),l.push({label:"commit",value:(0,n.jsx)(c,{color:t.commitColor,children:t.commitText})}),l.push({label:"artifacts",value:(0,n.jsx)(c,{color:o.dim,children:t.artifactsText})}),l.push({label:"upload",value:(0,n.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,n.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:l})}function U({data:e}){let{exit:t}=x();return(0,T.useEffect)(()=>{let l=setTimeout(()=>t(),50);return()=>clearTimeout(l)},[t]),(0,n.jsx)(b,{flexDirection:"column",children:(0,n.jsx)(B,{data:e})})}export{A as a,O as b,B as c,U as d};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as V,e as P,f as Ve,k as He}from"./chunk-
|
|
2
|
+
import{d as V,e as P,f as Ve,k as He}from"./chunk-S7XCOBYD.js";import{b as Pe}from"./chunk-HM6LZ2KM.js";import{j as Oe,k as X}from"./chunk-LXCTV75T.js";import{h as Y}from"./chunk-NVD2MXHQ.js";import{e as Re}from"./chunk-VE4HLIGA.js";import{e as ge,i as he}from"./chunk-XMPTFXPW.js";import{a as ee,b as Se,c as _e}from"./chunk-32HED7X2.js";import{a as Me,b as Ue,c as De,d as te,g as Ce,m as ne,n as G,o as Ae,p as se,q as Be,r as je,s as re,t as Fe,u as Ge}from"./chunk-3YIA3DSL.js";import{e as Te}from"./chunk-3V4J65GN.js";import{c as Ne,h as Ee}from"./chunk-ZDCXWEQG.js";import{j as Le,k as $e}from"./chunk-L3BUPFAQ.js";import{f as xe,g as q,j as Z,n as ve}from"./chunk-Z24SD2EJ.js";import{j as ke}from"./chunk-REKHAN53.js";import{b as F}from"./chunk-CQDCNP7V.js";import{b as Q}from"./chunk-W2HRX3DR.js";import{B as we,Ha as m,f as pe,p as Ie,w as be}from"./chunk-H4TIVILC.js";import{a as E,e as ye}from"./chunk-4C7WVQOD.js";import{j as J}from"./chunk-PI7OXS62.js";import{d as j}from"./chunk-DBMW3VUN.js";import{a as me}from"./chunk-FOJHSG5M.js";import{existsSync as oe,readFileSync as ae,statSync as H}from"fs";import{basename as de,extname as K}from"path";var ie=1024*1024,qe=1e3,Ze=e=>12e4+Math.ceil(e/ie)*1e3,v=e=>e>=ie?`${(e/ie).toFixed(1).replace(/\.0$/,"")} MB`:`${Math.max(1,Math.round(e/1024))} KB`,et=e=>new Promise(i=>setTimeout(i,e)),tt=e=>/^[a-z][a-z0-9+.-]*:/i.test(e)&&!oe(e);async function Ke(e,i,s,l){let o=new Map(l.map(a=>[a.sourceId,a.head])),d=[];for(let a of s){let r=o.get(a.sourceId);(r?await e.mainNode(i,r).then(f=>f.content.blob,()=>null):null)!==F(a.bytes)&&d.push(a)}return d}var nt=new Set(["KIND_MISMATCH","SITE_MOVED","UUID_MOVED","WEB_URL_CHANGED"]);function T(e){let i=e.code==="PLUGIN_HOOK_FAILED"||e.code==="PLUGIN_HOOK_TIMEOUT";return{refusal:{code:e.code,message:e.message,remedy:e.remedy??"check the source, then run the command again",...i?{support:!0}:{}},exit:i?1:2}}async function st(e,i,s){let l=i.plugin.manifest.id,o=ee(e),d;try{d=await _e(i.plugin,"claim",j.hookMs,()=>i.plugin.claim({ref:i.ref,named:i.named,isFile:o}))}catch(t){if(t instanceof Ne)return T(t.refusal);throw t}if(d==null)return T({code:"PLUGIN_NOT_CLAIMED",message:`plugin ${l} does not read ${i.ref}`,remedy:i.named?`drop the ${l}: prefix, or name the plugin that reads it`:"ingest it as a file of a built-in kind"});let a=d.sourceId;if(typeof a!="string")return T({code:"PLUGIN_HOOK_FAILED",message:`plugin ${l} answered claim with something that is not a claim`});let r=s??a;if(!Se(r))return T({code:"PLUGIN_SOURCE_ID_INVALID",message:`${JSON.stringify(r)} is not an id a source may have: it starts with a letter or digit and holds letters, digits and . _ -, at most 128 characters`,remedy:s===void 0?"give the source an id with --as <id>":"give another id with --as <id>"});let y={id:l,ref:i.ref,named:i.named,isFile:o},f=v(j.contentBytes);if(!o)return{item:{kind:"file",path:e,node:`ref:${e}`,file:e,bytes:Buffer.alloc(0),sourceId:r,limit:f,plugin:y}};let I=de(e),c;try{c=ae(e)}catch{return{refusal:m.ingestCantOpen(I),exit:2}}if(c.byteLength>j.contentBytes)return{refusal:m.ingestTooLarge(I,v(c.byteLength),f),exit:2};let{dev:u,ino:p}=H(e);return{item:{kind:"file",path:e,node:`${u}:${p}`,file:I,bytes:c,sourceId:r,limit:f,plugin:y}}}var S=e=>e.kind==="file"?e.path:e.address;function We(e){if(e.provider.name==="web")return`web|${e.sourceId}`;let i=new URL(e.address),s=e.provider.name.startsWith("linear")?`${i.host}/${i.pathname.split("/")[1]??""}`:i.host;return`${e.provider.name}|${s.toLowerCase()}|${e.sourceId}`}var rt=(e,i)=>e.kind==="file"?i.kind==="file"&&e.node===i.node:i.kind==="link"&&We(e)===We(i);async function it(e,i,s){let l=new Map;for(let t of e)l.set(t.sourceId,[...l.get(t.sourceId)??[],t]);let o=[...l.values()].filter(t=>t.length>1);if(o.length===0)return null;let d=i?.map(t=>t.sourceId)??null,a=new Set(o.flatMap(t=>t.slice(1))),r=new Set([...l.keys(),...d??[]]),y=t=>{if(d===null)return null;let R=2;for(;r.has(`${t}-${R}`);)R++;return r.add(`${t}-${R}`),`${t}-${R}`},f=t=>t.kind==="file"?t.path:te(t.provider.name,t.address),I=new Set(i?.filter(t=>t.head!==null).map(t=>t.sourceId)),c=e.filter(t=>!a.has(t)&&I.has(t.sourceId)),u=await s(c.flatMap(t=>t.kind==="file"?[t]:[])),p=e.filter(t=>!a.has(t)&&!u.includes(t));return je(o.map(t=>({names:t.map(f),id:t[0].sourceId})),p.map(S),e.filter(t=>a.has(t)).map(t=>({ref:S(t),as:y(t.sourceId),place:l.get(t.sourceId).indexOf(t)+1})),{reviews:u.flatMap(t=>t.kind==="file"?[{name:t.file,ref:t.path,id:t.sourceId}]:[]),link:c.some(t=>t.kind==="link"),firstTwin:p.some(t=>l.get(t.sourceId).length>1)})}async function Ft(e){try{return await ot(e)}finally{await be()}}async function ot(e){let i=e.mode==="agent",s=n=>i?ke(ge("ndjson",n,e.testing?.agentLines?{stdout:e.testing.agentLines,stderr:()=>{}}:void 0),{atQuestionsOnly:!0}):null,l=s("extract");l&&e.choice.onboarded&&l.event({type:"folder_linked",project_id:e.choice.projectId,project:e.choice.projectName});let o=(n,h,g=!1,O=l)=>O?(O.event({type:"error",code:n.code,message:n.message,...we(n),...n.notAdded?{not_added:n.notAdded}:{}}),O.done(h,"refused")):(g&&e.choice.onboarded?process.stdout.write(`${Oe(e.choice.projectName)}
|
|
3
3
|
`):e.mode==="interactive"&&process.stdout.write(`
|
|
4
4
|
`),X(n),process.stdout.write(`
|
|
5
|
-
`),h),d=(n,h)=>o(n,h,!0),a=(n,h)=>h.length>0?{...n,detail:Fe(h.map(g=>g.name)),notAdded:h.map(g=>g.ref)}:n;if(e.opts.plan)return d(m.notYet("context ingest --plan"),2);if(e.opts.as!==void 0&&e.paths.length>1)return d(Be(e.paths),2);let r=[],y=n=>{r.some(h=>rt(h,n))||r.push(n)},f=q.flatMap(n=>n.extensions).join(" ");for(let n of e.paths){let h=r.map(k=>({name:k.kind==="file"?k.file:te(k.provider.name,k.address),ref:S(k)})),g=(k,Ye)=>d(a(k,h),Ye),O=Ee().route(n,ee);if(O!==null){let k=await st(n,O,e.opts.as);if("refusal"in k)return g(k.refusal,k.exit);y(k.item);continue}if(Le(n)){let k=$e(n);if(!k?.fetch)return g(se(n),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);y({kind:"link",address:n,provider:k,sourceId:e.opts.as??k.sourceIdFor(n)??n});continue}if(tt(n))return g(se(n),2);let w=de(n),L=Z(n);if(!L.ok)return g(m.ingestUnsupported(`${w} is a file type kane can't ingest (${K(n)||"no extension"}) \u2014 supported: ${f}`),2);if(!oe(n)||!H(n).isFile())return g(m.ingestNoFile(n),2);let D;try{D=ae(n)}catch{return g(m.ingestCantOpen(w),2)}if(D.byteLength>L.media.maxBytes)return g(m.ingestTooLarge(w,v(D.byteLength),v(L.media.maxBytes)),2);if(L.media.sniff&&!L.media.sniff(D))return g(m.ingestNotItsType(w,K(n).slice(1)),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);let fe;try{fe=e.opts.as??ve(n)}catch{return g(m.ingestNoSourceId(w),2)}let{dev:Je,ino:Qe}=H(n);y({kind:"file",path:n,node:`${Je}:${Qe}`,file:w,bytes:D,sourceId:fe,limit:v(L.media.maxBytes)})}let I=r[0],c;try{c=e.testing?.basicAuth??await Re()}catch(n){if(!(n instanceof he))throw n;return d({code:n.code,message:n.message,...n.remedy?{remedy:n.remedy}:{}},2)}let u=pe({url:e.choice.latticeUrl,basicAuth:c,...e.testing?.run?.fetch?{fetch:e.testing.run.fetch}:{}}),p=e.choice.projectId,t=null,R=null;try{t=await u.sources(p)}catch(n){n instanceof E&&(n.code==="NO_CONTEXT"||n.code==="NOT_FOUND")?t=[]:R=n}let b=await it(r,t,n=>Ke(u,p,n,t??[]));if(b)return d(b,2);if(t===null){let{exit:n,...h}=Pe(R,e.choice,null);return d(h,n)}let x=new Set(t.filter(n=>n.head!==null).map(n=>n.sourceId)),$=r.filter(n=>x.has(n.sourceId)),N=$.flatMap(n=>n.kind==="file"?[n]:[]);if(r.length>1&&N.length>0&&N.length===$.length){let n=await Ke(u,p,N,t);if(n.length>0){let h=n.map(g=>({name:g.file,ref:S(g),id:g.sourceId}));return d(re(h,r.filter(g=>!n.includes(g)).map(S),e.choice.projectName),2)}}let M=r.length===1?$[0]:void 0;if(M){let{reviewNewVersion:n}=await import("./reconcile-remote-
|
|
6
|
-
`);let g=s("reconcile");return n({choice:e.choice,person:u,basicAuth:c,item:M,...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,mode:e.mode==="agent"?"agent":h?"interactive":"ci",io:g,refuse:(O,w=2)=>o(O,w,!1,g),projectLine:h,nothing:(O,w)=>`${h?` ${me.green("\u2714")} `:""}${O} is already in "${w}", unchanged`,...e.testing?{testing:e.testing}:{}})}let C=e.testing?.run?.retryDeadlineMs??12e4,ze=dt(e.testing?.remoteDeps),le=[],_=r.map((n,h)=>{let g=at({person:u,choice:e.choice,item:n,first:h===0,then:e.mode==="ci"?"pause":"extract",...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,retryMs:C,remoteDeps:ze,refusal:O=>a(O,_.slice(0,h).map(w=>({name:w.name??w.file,ref:w.path??w.file}))),alone:O=>re(O.map(w=>{let L=_[w].remote;return{name:_[w].name??_[w].file,ref:S(r[w]),id:r[w].sourceId,...L?{shown:Te({source:r[w].sourceId,page:Ce({...L,address:L.origin.url})})}:{}}}),r.filter((w,L)=>!O.includes(L)).map(S),e.choice.projectName),...e.testing?{testing:e.testing}:{}});return le.push(g.ended),g.step}),ce={verb:"extract",choice:e.choice,start:{kind:"new",body:{projectId:p,verb:"extract",mode:e.mode==="interactive"?"interactive":"agent",sourceId:I.sourceId}},run:{source:I.sourceId,...e.opts.force?{force:!0}:{},...e.opts.trust!==void 0?{trust:e.opts.trust}:{}}},A=e.testing?.remoteDeps?{...e.testing.run,remoteDeps:e.testing.remoteDeps}:e.testing?.run,U;if(e.mode==="interactive"){let{runInteractiveRemote:n}=await import("./interactive-remote-
|
|
5
|
+
`),h),d=(n,h)=>o(n,h,!0),a=(n,h)=>h.length>0?{...n,detail:Fe(h.map(g=>g.name)),notAdded:h.map(g=>g.ref)}:n;if(e.opts.plan)return d(m.notYet("context ingest --plan"),2);if(e.opts.as!==void 0&&e.paths.length>1)return d(Be(e.paths),2);let r=[],y=n=>{r.some(h=>rt(h,n))||r.push(n)},f=q.flatMap(n=>n.extensions).join(" ");for(let n of e.paths){let h=r.map(k=>({name:k.kind==="file"?k.file:te(k.provider.name,k.address),ref:S(k)})),g=(k,Ye)=>d(a(k,h),Ye),O=Ee().route(n,ee);if(O!==null){let k=await st(n,O,e.opts.as);if("refusal"in k)return g(k.refusal,k.exit);y(k.item);continue}if(Le(n)){let k=$e(n);if(!k?.fetch)return g(se(n),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);y({kind:"link",address:n,provider:k,sourceId:e.opts.as??k.sourceIdFor(n)??n});continue}if(tt(n))return g(se(n),2);let w=de(n),L=Z(n);if(!L.ok)return g(m.ingestUnsupported(`${w} is a file type kane can't ingest (${K(n)||"no extension"}) \u2014 supported: ${f}`),2);if(!oe(n)||!H(n).isFile())return g(m.ingestNoFile(n),2);let D;try{D=ae(n)}catch{return g(m.ingestCantOpen(w),2)}if(D.byteLength>L.media.maxBytes)return g(m.ingestTooLarge(w,v(D.byteLength),v(L.media.maxBytes)),2);if(L.media.sniff&&!L.media.sniff(D))return g(m.ingestNotItsType(w,K(n).slice(1)),2);if(e.opts.as!==void 0&&!J(e.opts.as))return g(m.ingestBadSourceId(e.opts.as),2);let fe;try{fe=e.opts.as??ve(n)}catch{return g(m.ingestNoSourceId(w),2)}let{dev:Je,ino:Qe}=H(n);y({kind:"file",path:n,node:`${Je}:${Qe}`,file:w,bytes:D,sourceId:fe,limit:v(L.media.maxBytes)})}let I=r[0],c;try{c=e.testing?.basicAuth??await Re()}catch(n){if(!(n instanceof he))throw n;return d({code:n.code,message:n.message,...n.remedy?{remedy:n.remedy}:{}},2)}let u=pe({url:e.choice.latticeUrl,basicAuth:c,...e.testing?.run?.fetch?{fetch:e.testing.run.fetch}:{}}),p=e.choice.projectId,t=null,R=null;try{t=await u.sources(p)}catch(n){n instanceof E&&(n.code==="NO_CONTEXT"||n.code==="NOT_FOUND")?t=[]:R=n}let b=await it(r,t,n=>Ke(u,p,n,t??[]));if(b)return d(b,2);if(t===null){let{exit:n,...h}=Pe(R,e.choice,null);return d(h,n)}let x=new Set(t.filter(n=>n.head!==null).map(n=>n.sourceId)),$=r.filter(n=>x.has(n.sourceId)),N=$.flatMap(n=>n.kind==="file"?[n]:[]);if(r.length>1&&N.length>0&&N.length===$.length){let n=await Ke(u,p,N,t);if(n.length>0){let h=n.map(g=>({name:g.file,ref:S(g),id:g.sourceId}));return d(re(h,r.filter(g=>!n.includes(g)).map(S),e.choice.projectName),2)}}let M=r.length===1?$[0]:void 0;if(M){let{reviewNewVersion:n}=await import("./reconcile-remote-6WISFGRG.js"),h=e.mode==="interactive";h&&!e.choice.onboarded&&process.stdout.write(`using project "${e.choice.projectName}", shared with your team
|
|
6
|
+
`);let g=s("reconcile");return n({choice:e.choice,person:u,basicAuth:c,item:M,...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,mode:e.mode==="agent"?"agent":h?"interactive":"ci",io:g,refuse:(O,w=2)=>o(O,w,!1,g),projectLine:h,nothing:(O,w)=>`${h?` ${me.green("\u2714")} `:""}${O} is already in "${w}", unchanged`,...e.testing?{testing:e.testing}:{}})}let C=e.testing?.run?.retryDeadlineMs??12e4,ze=dt(e.testing?.remoteDeps),le=[],_=r.map((n,h)=>{let g=at({person:u,choice:e.choice,item:n,first:h===0,then:e.mode==="ci"?"pause":"extract",...e.opts.as!==void 0?{as:e.opts.as}:{},supported:f,retryMs:C,remoteDeps:ze,refusal:O=>a(O,_.slice(0,h).map(w=>({name:w.name??w.file,ref:w.path??w.file}))),alone:O=>re(O.map(w=>{let L=_[w].remote;return{name:_[w].name??_[w].file,ref:S(r[w]),id:r[w].sourceId,...L?{shown:Te({source:r[w].sourceId,page:Ce({...L,address:L.origin.url})})}:{}}}),r.filter((w,L)=>!O.includes(L)).map(S),e.choice.projectName),...e.testing?{testing:e.testing}:{}});return le.push(g.ended),g.step}),ce={verb:"extract",choice:e.choice,start:{kind:"new",body:{projectId:p,verb:"extract",mode:e.mode==="interactive"?"interactive":"agent",sourceId:I.sourceId}},run:{source:I.sourceId,...e.opts.force?{force:!0}:{},...e.opts.trust!==void 0?{trust:e.opts.trust}:{}}},A=e.testing?.remoteDeps?{...e.testing.run,remoteDeps:e.testing.remoteDeps}:e.testing?.run,U;if(e.mode==="interactive"){let{runInteractiveRemote:n}=await import("./interactive-remote-O2Q2FNOH.js");U=await n({...ce,subject:I.kind==="link"?De(I.provider.name,I.address):I.sourceId,ingest:_,testing:{basicAuth:c,...e.testing?.check?{check:e.testing.check}:{},...A?{run:A}:{},...e.testing?.mount?{mount:e.testing.mount}:{},...e.testing?.onController?{onController:e.testing.onController}:{}}})}else U=await He({...ce,mode:"agent",basicAuth:c,io:l,check:e.testing?.check??Ve,onProgress:()=>{},ingest:_,signals:!0,onRefusal:n=>{X(n),process.stdout.write(`
|
|
7
7
|
`)},...A?{testing:A}:{}});let W=le.map(n=>n()),B=[...W].reverse().find(n=>n.sid!==null)?.sid??null,ue=W.flatMap(n=>n.added!==null?[{name:n.name,status:n.added}]:[]),z=W.find(n=>n.refused!==null)?.refused??null;if(z!==null)return o(z.refusal,z.exit);if(e.mode==="ci"&&ue.length>0&&B!==null){let n=ue.map(({name:h,status:g})=>g==="unchanged"?`${h} is already in "${e.choice.projectName}", unchanged`:g==="versioned"?`added a new version of ${h} to session ${B}, not saved yet`:`added ${h} to session ${B}, not saved yet`);return process.stdout.write(`${n.join(`
|
|
8
8
|
`)}
|
|
9
9
|
extract: kane-cli context extract --resume ${B}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as g}from"./chunk-
|
|
2
|
+
import{b as g}from"./chunk-FAMQ4DHU.js";import{readFileSync as o,writeFileSync as h,mkdirSync as u,readdirSync as a,unlinkSync as s,existsSync as l,chmodSync as f}from"fs";import{join as n,dirname as P}from"path";var d=class{baseDir;profilesDir;configFile;constructor(t=g){this.baseDir=t,this.profilesDir=n(t,"profiles"),this.configFile=n(t,"config.json")}readConfig(){try{return JSON.parse(o(this.configFile,"utf-8"))}catch{return{}}}writeConfig(t){u(this.baseDir,{recursive:!0,mode:448}),h(this.configFile,JSON.stringify(t,null,2)+`
|
|
3
3
|
`),f(this.configFile,384)}getActiveProfile(){return this.readConfig().active_profile??null}setActiveProfile(t){let i=this.readConfig();i.active_profile=t,this.writeConfig(i)}getDefaultEnv(){return this.readConfig().default_env??"prod"}setDefaultEnv(t){let i=this.readConfig();i.default_env=t,this.writeConfig(i)}credentialsPath(t,i){return n(this.profilesDir,t,i,"credentials")}clientPath(t,i){return n(this.profilesDir,t,i,"client.json")}basicAuthPath(t,i){return n(this.profilesDir,t,i,"basic-auth")}profileConfigPath(t,i){return n(this.profilesDir,t,i,"profile-config.json")}saveProfileConfig(t,i,r){let e=this.loadProfileConfig(t,i)??{};this.writeSecure(this.profileConfigPath(t,i),{...e,...r})}loadProfileConfig(t,i){try{return JSON.parse(o(this.profileConfigPath(t,i),"utf-8"))}catch{return null}}writeSecure(t,i){try{u(P(t),{recursive:!0,mode:448}),h(t,JSON.stringify(i,null,2)+`
|
|
4
4
|
`),f(t,384)}catch(r){let e=r instanceof Error?r.message:String(r);process.stderr.write(`[auth] Failed to save credentials: ${e}
|
|
5
5
|
`)}}saveCredentials(t,i,r){this.writeSecure(this.credentialsPath(t,i),r)}loadCredentials(t,i){try{return JSON.parse(o(this.credentialsPath(t,i),"utf-8"))}catch{return null}}saveClient(t,i,r){this.writeSecure(this.clientPath(t,i),r)}loadClient(t,i){try{return JSON.parse(o(this.clientPath(t,i),"utf-8"))}catch{return null}}getActiveCredentials(){let t=this.getActiveProfile();if(!t)return{credentials:null,profile:null,env:null};let i=this.getDefaultEnv();return{credentials:this.loadCredentials(t,i),profile:t,env:i}}saveBasicAuth(t,i,r){this.writeSecure(this.basicAuthPath(t,i),r)}loadBasicAuth(t,i){try{return JSON.parse(o(this.basicAuthPath(t,i),"utf-8"))}catch{return null}}deleteBasicAuth(t,i){try{s(this.basicAuthPath(t,i))}catch{}}resolveAuth(){let t=this.getActiveProfile();if(!t)return null;let i=this.getDefaultEnv(),r=this.loadBasicAuth(t,i);return r?{method:"basic",...r,profile:t,env:i}:this.loadCredentials(t,i)?{method:"oauth",profile:t,env:i}:null}listProfiles(){let t=[];try{for(let i of a(this.profilesDir)){let r=n(this.profilesDir,i);try{for(let e of a(r)){let c=n(r,e),v=l(n(c,"credentials")),p=l(n(c,"client.json")),y=l(n(c,"basic-auth"));(v||p||y)&&t.push({profile:i,env:e})}}catch{}}}catch{}return t}deleteProfile(t,i){try{s(this.credentialsPath(t,i))}catch{}if(this.getActiveProfile()===t){let r=this.readConfig();delete r.active_profile,this.writeConfig(r)}}deleteProfileFull(t,i){if(i){try{s(this.credentialsPath(t,i))}catch{}try{s(this.clientPath(t,i))}catch{}try{s(this.basicAuthPath(t,i))}catch{}try{s(this.profileConfigPath(t,i))}catch{}}else try{let r=n(this.profilesDir,t);for(let e of a(r)){try{s(n(r,e,"credentials"))}catch{}try{s(n(r,e,"client.json"))}catch{}try{s(n(r,e,"basic-auth"))}catch{}try{s(n(r,e,"profile-config.json"))}catch{}}}catch{}}};export{d as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as ke,b as we,c as H,d as b,m as N,n as J,o as _e,p as be}from"./chunk-OFSDB7B4.js";import{a as ye}from"./chunk-RTVWQK7I.js";import{b as pe,c as fe,e as ge}from"./chunk-HAW5WEKT.js";import{a as me}from"./chunk-VZJ6LUXX.js";import{n as ve}from"./chunk-35ECWCCK.js";import{b as he}from"./chunk-IZ65ZPWY.js";import{M as D}from"./chunk-UEE3RZN4.js";import{e as K}from"./chunk-HHW6MRU3.js";import{m as ue}from"./chunk-4I7YN6YY.js";var Ce=4;function He(t){return{ucRef:t.key,force:t.kind==="evolve",verb:t.kind}}function L(t,o,C){for(let{sid:R}of t.sessions().list()){if(C&&!C(R))continue;let p;try{p=t.sessions().peek(R)}catch{continue}if(!p?.reconcile||K(p,new Date)||(H(t,p.reconcile),b(t,p.reconcile.proposal_id).resolved))continue;let A=p.change_basis?.source_id??Object.keys(p.read_basis)[0]??"";if(!(o!==void 0&&A!==o))return{sid:p.sid,proposalId:p.reconcile.proposal_id,source:A,...p.change_basis?{changeBasis:{source_id:p.change_basis.source_id,to_cid:p.change_basis.new_head}}:{}}}return null}function V(t,o,C){let R=[];for(let{sid:p}of t.sessions().list()){if(C&&!C(p))continue;let h;try{h=t.sessions().peek(p)}catch{continue}if(!h?.reconcile||K(h,new Date))continue;let A=h.change_basis?.source_id??Object.keys(h.read_basis)[0]??"";o!==void 0&&A!==o||(H(t,h.reconcile),R.push(h.reconcile.proposal_id))}return R}var xe=80;function Pe(t){return{kind:t.kind,ref:t.display,title:t.kind==="ADD"?t.title:`${t.display} \xB7 ${t.title}`,why:t.changeLine,origin:"content-change",...t.tier!==void 0?{tier:t.tier}:{},...t.diffSummary==null&&t.diff.length>0?{diff:t.diff}:{},...t.diffSummary!=null?{diffSummary:t.diffSummary,viewDiff:!0}:{},...t.cites.length>0?{citeLines:t.cites.map(o=>`cite ${o.source_id??"conversation"} ${o.anchor} \u2014 "${o.quote.slice(0,xe)}"`)}:{},...t.impact?{impact:{stale_refs:Array(t.impact.stale).fill("\xB7"),...t.impact.direct.length>0?{direct_refs:t.impact.direct}:{}}}:{}}}function Ne(t){let o=t.store,C=t.changeSince?{since:t.changeSince}:{},R=he(),p=t.by??{kind:"human",id:"owner"},h=n=>t.emit?.(n),A=t.emitWalkSignal??((n,e,r)=>o.signals().append({ts:new Date().toISOString(),command:"reconcile-walk",id:n,verdict:e,polarity:"preference",by:p,target:n,...r!==void 0?{reason:r}:{}})),j=new Set(t.sessionId?[t.sessionId]:[]),y=t.sessionId?n=>j.has(n)||[...t.children?.()??[]].includes(n):void 0,g=o.proposals(),k=t.changeContext?.source_id,$=new Map;t.changeContext&&$.set(t.changeContext.source_id,t.changeContext.old_head);let Re=n=>{let e=$.get(n);if(e)return e;try{let r=ge(o,n,C);return r&&$.set(n,r.old_head),r?.old_head}catch{return}},X=n=>{let e=g.read(n);if(!e)return[];let r=N(e,D(o)),s=b(o,n);return J(r,s.verdicts)},Z=new Set,Se=()=>{let n=D(o);for(let{sid:e}of o.sessions().list()){if(y&&!y(e))continue;let r;try{r=o.sessions().peek(e)}catch{continue}if(!r||K(r,new Date))continue;let s=(r.ingest_schedule??[]).filter(i=>{if(i.status!=="skipped"||!(i.note??"").includes("review"))return!1;let a=n.heads.get(i.source_id);return typeof a!="string"||!n.extractedSourceCids.has(a)?!0:(Z.has(i.source_id)||(Z.add(i.source_id),t.note?.(`the new version of ${i.source_id} that waited for review has been extracted since, so its changes are not read again`)),!1)});if(s.length>0)return{source:s[0].source_id,count:s.length}}return null},ee=async(n,e,r,s)=>{let i=await Y(r,(d,l)=>(d(n),G({resume:n,...s!==null?{message:s}:{},mode:W},l))),a=null;try{a=o.sessions().peek(n)}catch{a=null}if(a?.reconcile&&a.reconcile.proposal_id!==e)H(o,a.reconcile);else{let d=g.verdicts(e);d.steer&&(delete d.steer,g.saveVerdicts(e,d))}return i},W=t.ask?"interactive":"override",q=!1,_=null,M=null,B=null,te={paused:!0},ne=t.ask,re=ne?n=>q?Promise.resolve(te):new Promise((e,r)=>{B=()=>e(te),ne(n).then(e,r)}).finally(()=>{B=null}):void 0,G=async(n,e)=>{let[{runExtract:r},{runAgent:s},{resolveAgentAuthEnv:i},{preflightTurn:a}]=await Promise.all([import("./run-5RQUCNYP.js"),import("./bridge-T6QMYKED.js"),import("./spawner-C7NLLM4F.js"),import("./turn-preflight-LHYLRL7G.js")]),d=t.auth??await i(t.credentials),l=!1,c=!1;M=null;let u=t.parentLock?.()??null,S={...n,...t.changeSince?{changeSince:t.changeSince}:{}},Q=await r(u?{...S,underLock:u}:S,{...t.nested?{nested:!0}:{},...t.by?{by:t.by}:{},reviewsHeld:!0,...t.telemetry?{telemetry:t.telemetry}:{},...t.tracePath?{tracePath:t.tracePath}:{},...t.narrate?{narrate:t.narrate}:{},emit:f=>{f.type==="held"&&(c=!0),f.type==="error"&&(M={code:String(f.code??"ERROR"),message:String(f.message??"the run failed")});let m=me(f);m&&_===null&&(_=m);let P=f.type==="session_paused"?f.cause:void 0;P&&typeof P.code=="string"&&_===null&&(_={code:P.code,final:!1}),t.emit&&e(f)},agent:t.agent??s,store:o,credentials:t.credentials,onIngestRefusal:t.onIngestRefusal,preflightTurn:t.preflightTurn??(()=>a(d)),...t.probe?{probe:t.probe}:{},...t.matchUnreviewed?{matchUnreviewed:!0}:{},ask:re?async f=>{let m=await re(f);return!Array.isArray(m)&&"paused"in m&&(l=!0),m}:async f=>f.map(m=>({id:m.id,selected_index:m.recommended_index,free_text:null})),review:async f=>new Map(f.map(m=>[m.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:f=>t.note?.(f),progress:()=>{},isTTY:t.ask!==void 0,auth:d});return q=!1,Q!==3||c?Q:l?Ce:1},Y=async(n,e)=>{let r=null,s,i=[],a=u=>ye(u,{verb:"extract",...s!==void 0?{id:s}:{}}),d=u=>{r===null?i.push(u):t.emit?.(a(u))},l=u=>{r=Date.now(),s=u,h({type:"child_start",child:"extract",subject:n,...u?{session_id:u}:{}});for(let S of i.splice(0))t.emit?.(a(S))},c=1;try{return c=await e(l,d),c}finally{if(r!==null){let u=Math.round((Date.now()-r)/1e3);h({type:"child_end",child:"extract",ok:c===0||c===3||c===Ce,dur_s:u,exit_code:c})}else for(let u of i.splice(0))t.emit?.(a(u))}},ie=async n=>{let e=null;try{e=o.sessions().peek(n)}catch{return}if(!e?.reconcile?.pending)return;let r;try{r=o.sessions().resume(n)}catch{return}try{let s=r.state.reconcile;if(!s?.pending)return;let i=g.read(s.proposal_id);if(i){let[{extractProtocolCtx:l},{landHoldPassthrough:c}]=await Promise.all([import("./run-5RQUCNYP.js"),import("./hold-passthrough-IOWPVB4W.js")]);if(!(await c({store:o,ctx:l(o,n,t.credentials,{probe:t.probe,runAuth:t.auth,similarity:R}),graph:D(o),sid:n,proposalId:s.proposal_id,proposal:i,by:p,durable:!0,...t.matchUnreviewed?{matchUnreviewed:!0}:{}})).ok)return}let{pending:a,...d}=s;r.save({reconcile:d})}finally{r.release()}},De=async(n,e)=>{let r=null;try{r=o.sessions().peek(e)}catch{r=null}if(!r)return F.startReview(n);if(o.sessions().isLive(e))return t.note?.(`session ${e} is running \u2014 it is not resumed here`),_={code:"SESSION_LOCKED",final:!1},2;if(r.reconcile?.pending&&await ie(e),r.reconcile&&g.read(r.reconcile.proposal_id)){let s=g.verdicts(r.reconcile.proposal_id).steer;if(!s)return 3;j.add(e);let i=(r.checkpoint?.seq??0)>s.seq;return ee(e,r.reconcile.proposal_id,n,i?null:s.text)}if(ve(r,o.sessions().hasBase(e))){try{o.sessions().resume(e).complete({ended:"failed",code:"SESSION_KEPT_NOTHING"})}catch{}return F.startReview(n)}return j.add(e),Y(n,(s,i)=>(s(e),G({resume:e,mode:W},i)))},se=n=>{if(o.sessions().isLive(n))return!1;let e=null;try{e=o.sessions().peek(n)}catch{e=null}return!e?.checkpoint&&!o.sessions().hasBase(n)&&o.sessions().appliedEvents(n).length===0},F={lastReadError(){return M},pending(){let n=L(o,k,y);if(n){let r=X(n.proposalId).length;return r>0?{source:n.source,count:r,kind:"cards"}:null}let e=Se();return e?{source:e.source,count:e.count,kind:"needs-run"}:null},loadCards(){let n=L(o,k,y);if(!n)return[];let e=X(n.proposalId),r=e.filter(d=>d.kind==="ADD"||d.ref!=null),s=e.filter(d=>d.kind!=="ADD"&&d.ref==null);for(let d of s)t.note?.(`dropped: [${d.kind}] ${d.title} \u2014 its target was retired while the review was open; nothing lands`);let i=g.verdicts(n.proposalId),a=r.map(d=>{let l=we(i.verdicts[d.key]);return l==="another session"&&t.note?.(`saving: [${d.kind}] ${d.title} \u2014 another session is saving its verdict; it comes back here if that save does not land`),{key:d.key,card:Pe(d),viewLines:d.diff,...l?{saving:l}:{}}});return h({type:"review_cards",source:n.source,cards:a.map(d=>({key:d.key,card:d.card})),dropped:s.map(d=>({kind:d.kind,title:d.title}))}),a},async applyVerdict(n,e,r){let s=L(o,k,y);s&&await ie(s.sid);let i=L(o,k,y),a=(v,ae)=>{let le=i?.source??k;return h({type:"card_refused",...le?{source:le}:{},key:n,verdict:e,code:v,refusal:ae}),{ok:!1,refusal:ae,code:v}};if(!i)return a("HOLD_GONE","the held changeset is gone \u2014 nothing to verdict");let d=g.read(i.proposalId);if(!d)return a("PROPOSAL_UNREADABLE",ue().text("PROPOSAL_UNREADABLE",{proposal:i.proposalId}));if(n in b(o,i.proposalId).verdicts)return a("ALREADY_VERDICTED","that change was already verdicted (another surface?) \u2014 refresh the review");let l=D(o),c=N(d,l).find(v=>v.key===n);if(!c)return a("CARD_GONE","that change no longer builds a card \u2014 the set may have moved; re-open the review");let u=Re(i.source),S=i.changeBasis?{source_id:i.changeBasis.source_id,...u?{from_cid:u}:{},...i.changeBasis.to_cid?{to_cid:i.changeBasis.to_cid}:{}}:void 0,f=`${e==="approve"?c.kind==="ARCHIVE"?"retired":"approved":e==="reject"?"rejected":"deferred"} change \xB7 [${c.kind}] ${c.display}${c.kind==="ADD"?"":` ${c.title}`} (you)`,m={verdict:e,...r?{note:r}:{},at:new Date().toISOString(),line:f},P=o.serialize(o.head()),I=_e(l,c),O=ke(i.proposalId,n),z={after:P,process:O.process,pid:O.pid},T=I?{target:I,...i.changeBasis?{source:i.changeBasis.source_id}:{},by:p}:void 0,oe=e==="reject"?null:e==="defer"?{...z,kind:"gap",proposal_id:i.proposalId,text:c.changeLine||c.title}:c.kind==="ARCHIVE"?{...z,kind:"archive",target:I??"",...T?{closes:T}:{}}:{...z,kind:"record",proposal_id:`${i.proposalId}:${n}`,offer:{kind:c.kind==="MODIFY"?"evolve":"design",title:c.kind==="ADD"?c.title:c.display,...c.kind==="MODIFY"&&I?{fallback:I}:{}},...c.kind==="MODIFY"&&T?{closes:T}:{}},de=g.verdicts(i.proposalId);de.verdicts[n]=oe?{...m,pending:oe}:m,g.saveVerdicts(i.proposalId,de);let ce=()=>{let v=g.verdicts(i.proposalId);delete v.verdicts[n],g.saveVerdicts(i.proposalId,v)},w;try{w=await be({store:o,graph:l,proposal:d,proposalId:i.proposalId,card:c,verdict:e,...r?{note:r}:{},by:p,sid:i.sid,...S?{changeBasis:S}:{},signals:v=>A(v.ref,v.verdict,v.reason),...t.probe?{probe:t.probe}:{},...t.matchUnreviewed?{matchUnreviewed:!0}:{}})}catch(v){throw ce(),O.done(),v}if(!w.ok)return ce(),O.done(),a(w.code,w.refusal);let U=w.offer&&w.offer.target?{kind:w.offer.kind,key:w.offer.target,title:c.kind==="ADD"?c.title:c.display}:void 0,E=g.verdicts(i.proposalId);E.verdicts[n]={...m,...U?{offer:U}:{}};let Ae=J(N(d,D(o)),E.verdicts).length,Ee=Object.values(E.verdicts).some(v=>v.pending);Ae===0&&!Ee&&(E.resolved=!0),g.saveVerdicts(i.proposalId,E),O.done();let x={ok:!0,line:f,...w.note?{note:w.note}:{},...U?{offer:U}:{}};return h({type:"card_verdict",source:i.source,key:n,verdict:e,line:x.line,...x.note?{note:x.note}:{},...x.offer?{offer:x.offer}:{}}),E.resolved&&h({type:"review_resolved",source:i.source}),x},async resumeReview(n,e,r){_=null;let s=await De(n,e);return r&&_&&(r.refused=_),s},givenVerdicts(){let n=[];for(let e of V(o,k,y))for(let[r,s]of Object.entries(b(o,e).verdicts))s.verdict!=="steer"&&n.push({card:r,verdict:s.verdict,...s.note?{note:s.note}:{},...s.line?{line:s.line}:{},at:s.at});return n.sort((e,r)=>e.at.localeCompare(r.at))},resumableChildren(){let n=[];for(let e of V(o,k,y))for(let[r,s]of Object.entries(b(o,e).verdicts)){let i=s.offer;i?.answer!=="accepted"||i.child===void 0||i.ended!==void 0||se(i.child)||n.push({proposalId:e,card:r,offer:{kind:i.kind,key:i.key,title:i.title},child:i.child,at:s.at})}return n.sort((e,r)=>e.at.localeCompare(r.at)).map(({proposalId:e,card:r,offer:s,child:i})=>({proposalId:e,card:r,offer:s,child:i}))},pendingOffers(){let n=[];for(let e of V(o,k,y))for(let[r,s]of Object.entries(b(o,e).verdicts)){if(!s.offer)continue;let{kind:i,key:a,title:d,answer:l,child:c,ended:u}=s.offer;l===void 0?n.push({proposalId:e,card:r,offer:{kind:i,key:a,title:d},at:s.at}):l==="accepted"&&c!==void 0&&u===void 0&&se(c)&&n.push({proposalId:e,card:r,offer:{kind:i,key:a,title:d},at:s.at,reopened:!0})}return n.sort((e,r)=>e.at.localeCompare(r.at)).map(({proposalId:e,card:r,offer:s,reopened:i})=>({proposalId:e,card:r,offer:s,...i?{reopened:i}:{}}))},offerAnswered(n,e,r,s){if(!V(o,k,y).includes(n))return!1;let i=b(o,n),a=i.verdicts[e];if(!a?.offer)return!1;let{kind:d,key:l,title:c}=a.offer;return a.offer={kind:d,key:l,title:c,answer:r,...r==="accepted"&&s!==void 0?{child:s}:{}},g.saveVerdicts(n,i),!0},offerEnded(n,e,r){if(!V(o,k,y).includes(n))return!1;let s=b(o,n),i=s.verdicts[e];return i?.offer?(i.offer={...i.offer,ended:r},g.saveVerdicts(n,s),!0):!1},async startReview(n){let e=pe(o,n,C);if(e.kind==="unchanged")return t.note?.(`no use case of ${n} is behind its current version, which has been read \u2014 nothing to review`),0;if(e.kind!=="ok"){let a=e.kind==="first"?`no change context for ${n}`:`${n}'s version ${e.version} cannot be read`;return t.note?.(`${a} \u2014 nothing to review`),_=e.kind==="first"?{code:"POSTURE_USAGE",final:!0}:{code:"SOURCE_UNREADABLE",final:!1},2}let r=e.changeContext;$.set(n,r.old_head);let s=D(o).extractedSourceCids.has(r.new_head)&&fe(o,n).length>0,i=t.childSession?.(n);return Y(n,(a,d)=>{let l=i&&{id:i.id,register:async c=>{await i.register(c),j.add(c),a(c)}};return l||a(),t.runPostureChild?t.runPostureChild(n,r,l):G({mode:W,posture:"reconcile",source:n,changeContext:r,...s?{force:!0}:{},...l?{sessionId:l.id,registerSession:c=>l.register(c)}:{}},d)})},requestPause(){return q=!0,B?(B(),!0):!1},async steer(n){let e=L(o,k,y);if(!e)return t.note?.("nothing is held to steer \u2014 the review has no changeset"),2;if(o.sessions().isLive(e.sid))return t.note?.(`session ${e.sid} is running \u2014 steer it there`),2;let r=g.verdicts(e.proposalId);return r.steer={text:n,at:new Date().toISOString(),seq:o.sessions().peek(e.sid)?.checkpoint?.seq??0},g.saveVerdicts(e.proposalId,r),ee(e.sid,e.proposalId,e.source,n)}};return F}export{Ce as a,He as b,Pe as c,Ne as d};
|
|
2
|
+
import{a as ke,b as we,c as H,d as b,m as N,n as J,o as _e,p as be}from"./chunk-TU2KPOW2.js";import{a as ye}from"./chunk-RTVWQK7I.js";import{b as pe,c as fe,e as ge}from"./chunk-WEJR2V7R.js";import{a as me}from"./chunk-VZJ6LUXX.js";import{n as ve}from"./chunk-DXIQVBMI.js";import{b as he}from"./chunk-W5HFUBXD.js";import{M as D}from"./chunk-PI7OXS62.js";import{e as K}from"./chunk-G4K3TP2I.js";import{o as ue}from"./chunk-HYJVYYAZ.js";var Ce=4;function He(t){return{ucRef:t.key,force:t.kind==="evolve",verb:t.kind}}function L(t,o,C){for(let{sid:R}of t.sessions().list()){if(C&&!C(R))continue;let p;try{p=t.sessions().peek(R)}catch{continue}if(!p?.reconcile||K(p,new Date)||(H(t,p.reconcile),b(t,p.reconcile.proposal_id).resolved))continue;let A=p.change_basis?.source_id??Object.keys(p.read_basis)[0]??"";if(!(o!==void 0&&A!==o))return{sid:p.sid,proposalId:p.reconcile.proposal_id,source:A,...p.change_basis?{changeBasis:{source_id:p.change_basis.source_id,to_cid:p.change_basis.new_head}}:{}}}return null}function V(t,o,C){let R=[];for(let{sid:p}of t.sessions().list()){if(C&&!C(p))continue;let h;try{h=t.sessions().peek(p)}catch{continue}if(!h?.reconcile||K(h,new Date))continue;let A=h.change_basis?.source_id??Object.keys(h.read_basis)[0]??"";o!==void 0&&A!==o||(H(t,h.reconcile),R.push(h.reconcile.proposal_id))}return R}var xe=80;function Pe(t){return{kind:t.kind,ref:t.display,title:t.kind==="ADD"?t.title:`${t.display} \xB7 ${t.title}`,why:t.changeLine,origin:"content-change",...t.tier!==void 0?{tier:t.tier}:{},...t.diffSummary==null&&t.diff.length>0?{diff:t.diff}:{},...t.diffSummary!=null?{diffSummary:t.diffSummary,viewDiff:!0}:{},...t.cites.length>0?{citeLines:t.cites.map(o=>`cite ${o.source_id??"conversation"} ${o.anchor} \u2014 "${o.quote.slice(0,xe)}"`)}:{},...t.impact?{impact:{stale_refs:Array(t.impact.stale).fill("\xB7"),...t.impact.direct.length>0?{direct_refs:t.impact.direct}:{}}}:{}}}function Ne(t){let o=t.store,C=t.changeSince?{since:t.changeSince}:{},R=he(),p=t.by??{kind:"human",id:"owner"},h=n=>t.emit?.(n),A=t.emitWalkSignal??((n,e,r)=>o.signals().append({ts:new Date().toISOString(),command:"reconcile-walk",id:n,verdict:e,polarity:"preference",by:p,target:n,...r!==void 0?{reason:r}:{}})),j=new Set(t.sessionId?[t.sessionId]:[]),y=t.sessionId?n=>j.has(n)||[...t.children?.()??[]].includes(n):void 0,g=o.proposals(),k=t.changeContext?.source_id,$=new Map;t.changeContext&&$.set(t.changeContext.source_id,t.changeContext.old_head);let Re=n=>{let e=$.get(n);if(e)return e;try{let r=ge(o,n,C);return r&&$.set(n,r.old_head),r?.old_head}catch{return}},X=n=>{let e=g.read(n);if(!e)return[];let r=N(e,D(o)),s=b(o,n);return J(r,s.verdicts)},Z=new Set,Se=()=>{let n=D(o);for(let{sid:e}of o.sessions().list()){if(y&&!y(e))continue;let r;try{r=o.sessions().peek(e)}catch{continue}if(!r||K(r,new Date))continue;let s=(r.ingest_schedule??[]).filter(i=>{if(i.status!=="skipped"||!(i.note??"").includes("review"))return!1;let a=n.heads.get(i.source_id);return typeof a!="string"||!n.extractedSourceCids.has(a)?!0:(Z.has(i.source_id)||(Z.add(i.source_id),t.note?.(`the new version of ${i.source_id} that waited for review has been extracted since, so its changes are not read again`)),!1)});if(s.length>0)return{source:s[0].source_id,count:s.length}}return null},ee=async(n,e,r,s)=>{let i=await Y(r,(d,l)=>(d(n),G({resume:n,...s!==null?{message:s}:{},mode:W},l))),a=null;try{a=o.sessions().peek(n)}catch{a=null}if(a?.reconcile&&a.reconcile.proposal_id!==e)H(o,a.reconcile);else{let d=g.verdicts(e);d.steer&&(delete d.steer,g.saveVerdicts(e,d))}return i},W=t.ask?"interactive":"override",q=!1,_=null,M=null,B=null,te={paused:!0},ne=t.ask,re=ne?n=>q?Promise.resolve(te):new Promise((e,r)=>{B=()=>e(te),ne(n).then(e,r)}).finally(()=>{B=null}):void 0,G=async(n,e)=>{let[{runExtract:r},{runAgent:s},{resolveAgentAuthEnv:i},{preflightTurn:a}]=await Promise.all([import("./run-YUHHD54J.js"),import("./bridge-2UHJOVLX.js"),import("./spawner-MQ4XEHIX.js"),import("./turn-preflight-R4PU6NYY.js")]),d=t.auth??await i(t.credentials),l=!1,c=!1;M=null;let u=t.parentLock?.()??null,S={...n,...t.changeSince?{changeSince:t.changeSince}:{}},Q=await r(u?{...S,underLock:u}:S,{...t.nested?{nested:!0}:{},...t.by?{by:t.by}:{},reviewsHeld:!0,...t.telemetry?{telemetry:t.telemetry}:{},...t.tracePath?{tracePath:t.tracePath}:{},...t.narrate?{narrate:t.narrate}:{},emit:f=>{f.type==="held"&&(c=!0),f.type==="error"&&(M={code:String(f.code??"ERROR"),message:String(f.message??"the run failed")});let m=me(f);m&&_===null&&(_=m);let P=f.type==="session_paused"?f.cause:void 0;P&&typeof P.code=="string"&&_===null&&(_={code:P.code,final:!1}),t.emit&&e(f)},agent:t.agent??s,store:o,credentials:t.credentials,onIngestRefusal:t.onIngestRefusal,preflightTurn:t.preflightTurn??(()=>a(d)),...t.probe?{probe:t.probe}:{},...t.matchUnreviewed?{matchUnreviewed:!0}:{},ask:re?async f=>{let m=await re(f);return!Array.isArray(m)&&"paused"in m&&(l=!0),m}:async f=>f.map(m=>({id:m.id,selected_index:m.recommended_index,free_text:null})),review:async f=>new Map(f.map(m=>[m.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:f=>t.note?.(f),progress:()=>{},isTTY:t.ask!==void 0,auth:d});return q=!1,Q!==3||c?Q:l?Ce:1},Y=async(n,e)=>{let r=null,s,i=[],a=u=>ye(u,{verb:"extract",...s!==void 0?{id:s}:{}}),d=u=>{r===null?i.push(u):t.emit?.(a(u))},l=u=>{r=Date.now(),s=u,h({type:"child_start",child:"extract",subject:n,...u?{session_id:u}:{}});for(let S of i.splice(0))t.emit?.(a(S))},c=1;try{return c=await e(l,d),c}finally{if(r!==null){let u=Math.round((Date.now()-r)/1e3);h({type:"child_end",child:"extract",ok:c===0||c===3||c===Ce,dur_s:u,exit_code:c})}else for(let u of i.splice(0))t.emit?.(a(u))}},ie=async n=>{let e=null;try{e=o.sessions().peek(n)}catch{return}if(!e?.reconcile?.pending)return;let r;try{r=o.sessions().resume(n)}catch{return}try{let s=r.state.reconcile;if(!s?.pending)return;let i=g.read(s.proposal_id);if(i){let[{extractProtocolCtx:l},{landHoldPassthrough:c}]=await Promise.all([import("./run-YUHHD54J.js"),import("./hold-passthrough-JGHWMYDM.js")]);if(!(await c({store:o,ctx:l(o,n,t.credentials,{probe:t.probe,runAuth:t.auth,similarity:R}),graph:D(o),sid:n,proposalId:s.proposal_id,proposal:i,by:p,durable:!0,...t.matchUnreviewed?{matchUnreviewed:!0}:{}})).ok)return}let{pending:a,...d}=s;r.save({reconcile:d})}finally{r.release()}},De=async(n,e)=>{let r=null;try{r=o.sessions().peek(e)}catch{r=null}if(!r)return F.startReview(n);if(o.sessions().isLive(e))return t.note?.(`session ${e} is running \u2014 it is not resumed here`),_={code:"SESSION_LOCKED",final:!1},2;if(r.reconcile?.pending&&await ie(e),r.reconcile&&g.read(r.reconcile.proposal_id)){let s=g.verdicts(r.reconcile.proposal_id).steer;if(!s)return 3;j.add(e);let i=(r.checkpoint?.seq??0)>s.seq;return ee(e,r.reconcile.proposal_id,n,i?null:s.text)}if(ve(r,o.sessions().hasBase(e))){try{o.sessions().resume(e).complete({ended:"failed",code:"SESSION_KEPT_NOTHING"})}catch{}return F.startReview(n)}return j.add(e),Y(n,(s,i)=>(s(e),G({resume:e,mode:W},i)))},se=n=>{if(o.sessions().isLive(n))return!1;let e=null;try{e=o.sessions().peek(n)}catch{e=null}return!e?.checkpoint&&!o.sessions().hasBase(n)&&o.sessions().appliedEvents(n).length===0},F={lastReadError(){return M},pending(){let n=L(o,k,y);if(n){let r=X(n.proposalId).length;return r>0?{source:n.source,count:r,kind:"cards"}:null}let e=Se();return e?{source:e.source,count:e.count,kind:"needs-run"}:null},loadCards(){let n=L(o,k,y);if(!n)return[];let e=X(n.proposalId),r=e.filter(d=>d.kind==="ADD"||d.ref!=null),s=e.filter(d=>d.kind!=="ADD"&&d.ref==null);for(let d of s)t.note?.(`dropped: [${d.kind}] ${d.title} \u2014 its target was retired while the review was open; nothing lands`);let i=g.verdicts(n.proposalId),a=r.map(d=>{let l=we(i.verdicts[d.key]);return l==="another session"&&t.note?.(`saving: [${d.kind}] ${d.title} \u2014 another session is saving its verdict; it comes back here if that save does not land`),{key:d.key,card:Pe(d),viewLines:d.diff,...l?{saving:l}:{}}});return h({type:"review_cards",source:n.source,cards:a.map(d=>({key:d.key,card:d.card})),dropped:s.map(d=>({kind:d.kind,title:d.title}))}),a},async applyVerdict(n,e,r){let s=L(o,k,y);s&&await ie(s.sid);let i=L(o,k,y),a=(v,ae)=>{let le=i?.source??k;return h({type:"card_refused",...le?{source:le}:{},key:n,verdict:e,code:v,refusal:ae}),{ok:!1,refusal:ae,code:v}};if(!i)return a("HOLD_GONE","the held changeset is gone \u2014 nothing to verdict");let d=g.read(i.proposalId);if(!d)return a("PROPOSAL_UNREADABLE",ue().text("PROPOSAL_UNREADABLE",{proposal:i.proposalId}));if(n in b(o,i.proposalId).verdicts)return a("ALREADY_VERDICTED","that change was already verdicted (another surface?) \u2014 refresh the review");let l=D(o),c=N(d,l).find(v=>v.key===n);if(!c)return a("CARD_GONE","that change no longer builds a card \u2014 the set may have moved; re-open the review");let u=Re(i.source),S=i.changeBasis?{source_id:i.changeBasis.source_id,...u?{from_cid:u}:{},...i.changeBasis.to_cid?{to_cid:i.changeBasis.to_cid}:{}}:void 0,f=`${e==="approve"?c.kind==="ARCHIVE"?"retired":"approved":e==="reject"?"rejected":"deferred"} change \xB7 [${c.kind}] ${c.display}${c.kind==="ADD"?"":` ${c.title}`} (you)`,m={verdict:e,...r?{note:r}:{},at:new Date().toISOString(),line:f},P=o.serialize(o.head()),I=_e(l,c),O=ke(i.proposalId,n),z={after:P,process:O.process,pid:O.pid},T=I?{target:I,...i.changeBasis?{source:i.changeBasis.source_id}:{},by:p}:void 0,oe=e==="reject"?null:e==="defer"?{...z,kind:"gap",proposal_id:i.proposalId,text:c.changeLine||c.title}:c.kind==="ARCHIVE"?{...z,kind:"archive",target:I??"",...T?{closes:T}:{}}:{...z,kind:"record",proposal_id:`${i.proposalId}:${n}`,offer:{kind:c.kind==="MODIFY"?"evolve":"design",title:c.kind==="ADD"?c.title:c.display,...c.kind==="MODIFY"&&I?{fallback:I}:{}},...c.kind==="MODIFY"&&T?{closes:T}:{}},de=g.verdicts(i.proposalId);de.verdicts[n]=oe?{...m,pending:oe}:m,g.saveVerdicts(i.proposalId,de);let ce=()=>{let v=g.verdicts(i.proposalId);delete v.verdicts[n],g.saveVerdicts(i.proposalId,v)},w;try{w=await be({store:o,graph:l,proposal:d,proposalId:i.proposalId,card:c,verdict:e,...r?{note:r}:{},by:p,sid:i.sid,...S?{changeBasis:S}:{},signals:v=>A(v.ref,v.verdict,v.reason),...t.probe?{probe:t.probe}:{},...t.matchUnreviewed?{matchUnreviewed:!0}:{}})}catch(v){throw ce(),O.done(),v}if(!w.ok)return ce(),O.done(),a(w.code,w.refusal);let U=w.offer&&w.offer.target?{kind:w.offer.kind,key:w.offer.target,title:c.kind==="ADD"?c.title:c.display}:void 0,E=g.verdicts(i.proposalId);E.verdicts[n]={...m,...U?{offer:U}:{}};let Ae=J(N(d,D(o)),E.verdicts).length,Ee=Object.values(E.verdicts).some(v=>v.pending);Ae===0&&!Ee&&(E.resolved=!0),g.saveVerdicts(i.proposalId,E),O.done();let x={ok:!0,line:f,...w.note?{note:w.note}:{},...U?{offer:U}:{}};return h({type:"card_verdict",source:i.source,key:n,verdict:e,line:x.line,...x.note?{note:x.note}:{},...x.offer?{offer:x.offer}:{}}),E.resolved&&h({type:"review_resolved",source:i.source}),x},async resumeReview(n,e,r){_=null;let s=await De(n,e);return r&&_&&(r.refused=_),s},givenVerdicts(){let n=[];for(let e of V(o,k,y))for(let[r,s]of Object.entries(b(o,e).verdicts))s.verdict!=="steer"&&n.push({card:r,verdict:s.verdict,...s.note?{note:s.note}:{},...s.line?{line:s.line}:{},at:s.at});return n.sort((e,r)=>e.at.localeCompare(r.at))},resumableChildren(){let n=[];for(let e of V(o,k,y))for(let[r,s]of Object.entries(b(o,e).verdicts)){let i=s.offer;i?.answer!=="accepted"||i.child===void 0||i.ended!==void 0||se(i.child)||n.push({proposalId:e,card:r,offer:{kind:i.kind,key:i.key,title:i.title},child:i.child,at:s.at})}return n.sort((e,r)=>e.at.localeCompare(r.at)).map(({proposalId:e,card:r,offer:s,child:i})=>({proposalId:e,card:r,offer:s,child:i}))},pendingOffers(){let n=[];for(let e of V(o,k,y))for(let[r,s]of Object.entries(b(o,e).verdicts)){if(!s.offer)continue;let{kind:i,key:a,title:d,answer:l,child:c,ended:u}=s.offer;l===void 0?n.push({proposalId:e,card:r,offer:{kind:i,key:a,title:d},at:s.at}):l==="accepted"&&c!==void 0&&u===void 0&&se(c)&&n.push({proposalId:e,card:r,offer:{kind:i,key:a,title:d},at:s.at,reopened:!0})}return n.sort((e,r)=>e.at.localeCompare(r.at)).map(({proposalId:e,card:r,offer:s,reopened:i})=>({proposalId:e,card:r,offer:s,...i?{reopened:i}:{}}))},offerAnswered(n,e,r,s){if(!V(o,k,y).includes(n))return!1;let i=b(o,n),a=i.verdicts[e];if(!a?.offer)return!1;let{kind:d,key:l,title:c}=a.offer;return a.offer={kind:d,key:l,title:c,answer:r,...r==="accepted"&&s!==void 0?{child:s}:{}},g.saveVerdicts(n,i),!0},offerEnded(n,e,r){if(!V(o,k,y).includes(n))return!1;let s=b(o,n),i=s.verdicts[e];return i?.offer?(i.offer={...i.offer,ended:r},g.saveVerdicts(n,s),!0):!1},async startReview(n){let e=pe(o,n,C);if(e.kind==="unchanged")return t.note?.(`no use case of ${n} is behind its current version, which has been read \u2014 nothing to review`),0;if(e.kind!=="ok"){let a=e.kind==="first"?`no change context for ${n}`:`${n}'s version ${e.version} cannot be read`;return t.note?.(`${a} \u2014 nothing to review`),_=e.kind==="first"?{code:"POSTURE_USAGE",final:!0}:{code:"SOURCE_UNREADABLE",final:!1},2}let r=e.changeContext;$.set(n,r.old_head);let s=D(o).extractedSourceCids.has(r.new_head)&&fe(o,n).length>0,i=t.childSession?.(n);return Y(n,(a,d)=>{let l=i&&{id:i.id,register:async c=>{await i.register(c),j.add(c),a(c)}};return l||a(),t.runPostureChild?t.runPostureChild(n,r,l):G({mode:W,posture:"reconcile",source:n,changeContext:r,...s?{force:!0}:{},...l?{sessionId:l.id,registerSession:c=>l.register(c)}:{}},d)})},requestPause(){return q=!0,B?(B(),!0):!1},async steer(n){let e=L(o,k,y);if(!e)return t.note?.("nothing is held to steer \u2014 the review has no changeset"),2;if(o.sessions().isLive(e.sid))return t.note?.(`session ${e.sid} is running \u2014 steer it there`),2;let r=g.verdicts(e.proposalId);return r.steer={text:n,at:new Date().toISOString(),seq:o.sessions().peek(e.sid)?.checkpoint?.seq??0},g.saveVerdicts(e.proposalId,r),ee(e.sid,e.proposalId,e.source,n)}};return F}export{Ce as a,He as b,Pe as c,Ne as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{h as I}from"./chunk-SXRHKXSE.js";import{f as c,h as w,i as y,l,q as f,t as A}from"./chunk-A7RJQJNT.js";import{b as m}from"./chunk-
|
|
2
|
+
import{h as I}from"./chunk-SXRHKXSE.js";import{f as c,h as w,i as y,l,q as f,t as A}from"./chunk-A7RJQJNT.js";import{b as m}from"./chunk-FAMQ4DHU.js";import{createHash as U}from"crypto";import{createReadStream as F}from"fs";import{mkdir as x,readFile as P,rename as $,writeFile as D}from"fs/promises";import{dirname as b,join as E}from"path";var k=60,S=5;function C(){return{entries:[]}}function v(){return E(m,"mobile","app-cache.json")}async function h(e){let r=U("sha256");for await(let t of F(e))r.update(t);return r.digest("hex")}function N(){return{readFile:e=>P(e,"utf8"),writeFile:async(e,r)=>{await x(b(e),{recursive:!0});let t=`${e}.tmp`;await D(t,r),await $(t,e)},hashFile:h,now:()=>new Date}}function g(e){if(!e)return;let r=/\/(\d{4})\/(\d{2})\/(\d{2})\//.exec(e);if(!r)return;let[,t,a,i]=r,o=new Date(`${t}-${a}-${i}T00:00:00Z`);return Number.isNaN(o.getTime())?void 0:o.toISOString()}function O(e,r){if(!e.storedAt)return!0;let t=new Date(e.storedAt).getTime();return Number.isNaN(t)?!0:(r.getTime()-t)/864e5>=k-S}var d=class{deps;constructor(r={}){this.deps={...N(),...r}}async read(){try{let r=JSON.parse(await this.deps.readFile(v()));if(!r||typeof r!="object")return C();let t=r;return{entries:Array.isArray(t.entries)?t.entries:[]}}catch{return C()}}async write(r){await this.deps.writeFile(v(),JSON.stringify(r,null,2))}async hashOf(r){return this.deps.hashFile(r)}async lookup(r){return(await this.read()).entries.find(a=>a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)}async remember(r){let t=await this.read();t.entries=[...t.entries.filter(a=>!(a.sha256===r.sha256&&a.env===r.env&&a.orgId===r.orgId&&a.type===r.type)),r],await this.write(t)}async forget(r){let t=await this.read(),a=t.entries.length;t.entries=t.entries.filter(i=>!(i.sha256===r.sha256&&i.env===r.env&&i.orgId===r.orgId&&i.type===r.type)),t.entries.length!==a&&await this.write(t)}isNearExpiry(r){return O(r,this.deps.now())}};import{createHash as j}from"crypto";import{readdir as T,stat as _}from"fs/promises";import{basename as p,extname as B,join as R,relative as Y}from"path";function ae(e){return e.skipped===!0}function H(e,r){return A(r,e)?null:B(e).toLowerCase()===".ipa"&&!c(r)?`${p(e)} is a device build \u2014 .ipa is not accepted for ${r} runs.`:c(r)?`${p(e)} is not an ${y(w(r))} build \u2014 ${l(r)} takes ${f(r).join(" or ")}.`:`${p(e)} cannot be uploaded for ${l(r)} \u2014 expected one of ${f(r).join(", ")}.`}async function J(e,r){if(!(await _(e)).isDirectory())return r.hashOf(e);let a=[],i=async n=>{for(let s of await T(n,{withFileTypes:!0})){let u=R(n,s.name);s.isDirectory()?await i(u):s.isFile()&&a.push(u)}};await i(e),a.sort();let o=j("sha256");for(let n of a)o.update(Y(e,n)),o.update("\0"),o.update(await h(n)),o.update("\0");return o.digest("hex")}async function se(e){let r=H(e.path,e.type);if(r)return{skipped:!0,reason:r};let t=e.cache??new d,a=e.client??new I(e.baseUrl,{...e.auth,orgId:e.orgId}),i;try{i=await J(e.path,t)}catch(s){return{skipped:!0,reason:`could not read ${p(e.path)}: ${s.message}`}}let o={sha256:i,env:e.env,orgId:e.orgId,type:e.type},n=await t.lookup(o);if(n){if(await a.liveness(n.appId)!=="gone")return{appId:n.appId,...n.appUrl?{appUrl:n.appUrl}:{},fromCache:!0};e.onProgress?.(`${n.appId} is no longer in the cloud \u2014 uploading again`),await t.forget(o)}try{e.onProgress?.(`uploading ${p(e.path)}\u2026`);let s=await a.upload(e.path,e.type);return await t.remember({sha256:i,env:e.env,orgId:e.orgId,type:e.type,appId:s.appId,...s.appUrl?{appUrl:s.appUrl}:{},...g(s.url)?{storedAt:g(s.url)}:{},sourcePath:e.path}),e.onProgress?.(s.cached?`${p(e.path)} already in the cloud (${s.appId})`:`${p(e.path)} uploaded (${s.appId})`),{appId:s.appId,...s.appUrl?{appUrl:s.appUrl}:{},fromCache:!1}}catch(s){return{skipped:!0,reason:s.message}}}export{d as a,ae as b,H as c,J as d,se as e};
|