@testmuai/kane-cli 0.9.0 → 0.10.0-rc.3
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-6NZGMNHL.js +2 -0
- package/dist/ChromeProfilePicker-M4WXOB5O.js +2 -0
- package/dist/CliFeedbackPrompt-6MJA7DF6.js +2 -0
- package/dist/CliUploadProgress-6NLS7XHH.js +2 -0
- package/dist/ConfigView-O4WKZ5PU.js +2 -0
- package/dist/EvidenceViewOffer-WIEWCZUP.js +2 -0
- package/dist/FolderPicker-AF7ZMV3M.js +2 -0
- package/dist/InfoBox-D7GGZJU4.js +2 -0
- package/dist/LinksBox-DXP66H3H.js +2 -0
- package/dist/ProfilesView-TWOY5PVC.js +2 -0
- package/dist/ProjectPicker-OBYHJJLU.js +2 -0
- package/dist/SaveSessionPrompt-7XSHS4NL.js +2 -0
- package/dist/ScrollbackTap-4SPXGFMU.js +2 -0
- package/dist/SingleShotApp-XQUDR36R.js +2 -0
- package/dist/SummaryBox-IA2KS6GT.js +2 -0
- package/dist/TestMdRunView-LS2QUFWR.js +2 -0
- package/dist/TestrunEvidenceTable-HNDVJDIF.js +2 -0
- package/dist/WhoamiView-SNL75TEF.js +2 -0
- package/dist/{agent-parse-2MLJOJTH.js → agent-parse-CAS45UKA.js} +1 -1
- package/dist/app-client-U2YYF65L.js +2 -0
- package/dist/app-download-UI4ABEIX.js +2 -0
- package/dist/assurance-job-FFSSS4XV.js +7 -0
- package/dist/auth-7Z54TMQQ.js +2 -0
- package/dist/{binary-LVHXED3O.js → binary-THPLXCOD.js} +1 -1
- package/dist/bind-4XWK3DG2.js +2 -0
- package/dist/bootstrap-6ACT4ALI.js +2 -0
- package/dist/bridge-T6QMYKED.js +2 -0
- package/dist/build-5ZN47FAT.js +2 -0
- package/dist/catalog-MYPS2BXY.js +2 -0
- package/dist/{changelog-N5AZHXOS.js → changelog-SU674BVE.js} +1 -1
- package/dist/chat-committer-ZCSRJEUB.js +2 -0
- package/dist/chat-controller-XINCDH6Z.js +2 -0
- package/dist/child-G2GCW73X.js +2 -0
- package/dist/chunk-22PIMG52.js +2 -0
- package/dist/chunk-2DYHAP4E.js +2 -0
- package/dist/chunk-2TVPA3LL.js +2 -0
- package/dist/{chunk-FMUV6UCX.js → chunk-2XW33VOK.js} +1 -1
- package/dist/chunk-33DWJV67.js +235 -0
- package/dist/chunk-34R7BNZ2.js +2 -0
- package/dist/chunk-35ECWCCK.js +2 -0
- package/dist/{chunk-OHOJSADN.js → chunk-36N3EHW5.js} +1 -1
- package/dist/chunk-3BSYOCSW.js +3 -0
- package/dist/chunk-3E4ZO73O.js +6 -0
- package/dist/chunk-3F5FMH76.js +2 -0
- package/dist/chunk-3G2LSTK5.js +2 -0
- package/dist/chunk-3GXN6VF6.js +2 -0
- package/dist/chunk-3JLEDSG5.js +4 -0
- package/dist/chunk-3OQW2GTA.js +2 -0
- package/dist/chunk-3QICDXY5.js +5 -0
- package/dist/chunk-3RJHXOZH.js +3 -0
- package/dist/{chunk-Q5RDCSYM.js → chunk-3YTCKCBG.js} +1 -1
- package/dist/chunk-42PALMW2.js +4 -0
- package/dist/chunk-44B6THYK.js +2 -0
- package/dist/chunk-457Y5TEC.js +19 -0
- package/dist/chunk-47WQBG5I.js +6 -0
- package/dist/chunk-4I7YN6YY.js +3 -0
- package/dist/chunk-4IEQNX7F.js +2 -0
- package/dist/chunk-4LTHDJ3D.js +2 -0
- package/dist/chunk-4QFTHUJA.js +34 -0
- package/dist/chunk-4QTH7VYE.js +2 -0
- package/dist/chunk-4YW767UV.js +47 -0
- package/dist/chunk-54XA5MZH.js +2 -0
- package/dist/chunk-5AKJPYUW.js +11 -0
- package/dist/{chunk-AKE2CTV6.js → chunk-5D7ENQTQ.js} +1 -1
- package/dist/chunk-63EKRZKI.js +2 -0
- package/dist/{chunk-EHN5HTUD.js → chunk-65VANXOF.js} +51 -51
- package/dist/{chunk-J3BGYSMD.js → chunk-6DZX5HLZ.js} +8 -8
- package/dist/{chunk-YBAVDT3G.js → chunk-6EB5VRAN.js} +1 -1
- package/dist/chunk-6NFOH4AC.js +4 -0
- package/dist/chunk-6PIIUAZF.js +3 -0
- package/dist/chunk-6UVIY56J.js +2 -0
- package/dist/chunk-72KYMWQ5.js +2 -0
- package/dist/chunk-72RC7JSA.js +21 -0
- package/dist/chunk-734ORT6O.js +4 -0
- package/dist/chunk-77ZZQJLX.js +2 -0
- package/dist/chunk-7AET4JKQ.js +2 -0
- package/dist/chunk-7DFBOVUB.js +2 -0
- package/dist/chunk-7HMSMAUG.js +29 -0
- package/dist/chunk-7HO4NX5W.js +1 -0
- package/dist/chunk-7KX2BHKG.js +2 -0
- package/dist/{chunk-ULGZPRKU.js → chunk-7NCJMWFX.js} +1 -1
- package/dist/chunk-7NPTL66J.js +2 -0
- package/dist/chunk-7RWP4Y3H.js +2 -0
- package/dist/{chunk-PCKIANML.js → chunk-7SY34IIL.js} +1 -1
- package/dist/chunk-7V4BQSSV.js +2 -0
- package/dist/chunk-7XBNMOH4.js +6 -0
- package/dist/{chunk-SOCHN2PY.js → chunk-7YT4TTKL.js} +1 -1
- package/dist/{chunk-C25M2J5Q.js → chunk-ACMBMZDQ.js} +1 -1
- package/dist/chunk-AEWNWAXW.js +18 -0
- package/dist/chunk-AQ2OG2EF.js +2 -0
- package/dist/chunk-AUJSC7PU.js +4 -0
- package/dist/chunk-AVI5H4UM.js +13 -0
- package/dist/chunk-AVSMXDTX.js +2 -0
- package/dist/chunk-AZLNLHUA.js +4 -0
- package/dist/{chunk-HGFWIBVF.js → chunk-B7ZX5HEN.js} +5 -5
- package/dist/{chunk-66MOZKD2.js → chunk-BSRSXYDZ.js} +1 -1
- package/dist/chunk-BWXLZS5O.js +2 -0
- package/dist/chunk-BY65QAAN.js +4 -0
- package/dist/chunk-C2RUDJ46.js +2 -0
- package/dist/chunk-C5Z7MQE6.js +2 -0
- package/dist/{chunk-WDMUPK6I.js → chunk-C62QWG4B.js} +1 -1
- package/dist/chunk-C6HI6Y3S.js +2 -0
- package/dist/chunk-CB4ARIHR.js +2 -0
- package/dist/{chunk-7WXMV3O3.js → chunk-CCP4X75B.js} +1 -1
- package/dist/chunk-CGITGJ3I.js +4 -0
- package/dist/chunk-CM4CHYSN.js +2 -0
- package/dist/{chunk-ZXY4P76I.js → chunk-CUXY6KQ2.js} +1 -1
- package/dist/chunk-D36V5OX6.js +2 -0
- package/dist/chunk-D756UWY2.js +6 -0
- package/dist/chunk-D7TKE7LK.js +2 -0
- package/dist/{chunk-UWXDURAB.js → chunk-D7U2M26S.js} +1 -1
- package/dist/chunk-DBMW3VUN.js +4 -0
- package/dist/chunk-DDZLCAEO.js +5 -0
- package/dist/chunk-DJC7NTLA.js +3 -0
- package/dist/chunk-DPGOAFKF.js +2 -0
- package/dist/chunk-DREQ3RAA.js +2 -0
- package/dist/chunk-DTUPEKEO.js +2 -0
- package/dist/chunk-DZOYYWOW.js +2 -0
- package/dist/chunk-E6KSRQXL.js +8 -0
- package/dist/chunk-EBPRPNSA.js +2 -0
- package/dist/chunk-ECPFI75W.js +5 -0
- package/dist/chunk-EECDDDSB.js +3 -0
- package/dist/chunk-EF47KRUK.js +2 -0
- package/dist/chunk-ETZMFRD6.js +2 -0
- package/dist/chunk-EZN7CF45.js +4 -0
- package/dist/{chunk-CNUCP6DK.js → chunk-F22K3RRX.js} +1 -1
- package/dist/{chunk-WRSIKZ2V.js → chunk-F5NHG7VB.js} +1 -1
- package/dist/{chunk-DHJSM5DT.js → chunk-FCD3NYOM.js} +1 -1
- package/dist/chunk-FIP5L6LV.js +9 -0
- package/dist/chunk-FOJHSG5M.js +6 -0
- package/dist/chunk-FSYOTRMC.js +2 -0
- package/dist/chunk-FWDUVFS6.js +26 -0
- package/dist/chunk-FWUPJORV.js +6 -0
- package/dist/chunk-GFLB2SHW.js +2 -0
- package/dist/chunk-GMTHZUZ3.js +2 -0
- package/dist/chunk-GQRU3B54.js +1397 -0
- package/dist/chunk-GRURFGBP.js +2 -0
- package/dist/chunk-GXKY5A46.js +9 -0
- package/dist/chunk-HAW5WEKT.js +13 -0
- package/dist/chunk-HCJ2N3XB.js +12 -0
- package/dist/chunk-HHW6MRU3.js +6 -0
- package/dist/chunk-HIUAUZNL.js +2 -0
- package/dist/chunk-HJLMH7ZM.js +2 -0
- package/dist/{chunk-YWYORBY3.js → chunk-HJMCXSUJ.js} +1 -1
- package/dist/chunk-HK62JVQM.js +3 -0
- package/dist/{chunk-5GUD3CIH.js → chunk-HQ2E2XCU.js} +1 -1
- package/dist/chunk-I2MC6VVX.js +2 -0
- package/dist/chunk-I4RVVBG3.js +10 -0
- package/dist/chunk-I4WXALQR.js +2 -0
- package/dist/chunk-ICLUC44J.js +2 -0
- package/dist/{chunk-6HU5M2DS.js → chunk-IGEAET7M.js} +1 -1
- package/dist/{chunk-GCISXCDU.js → chunk-IINZZ4BZ.js} +1 -1
- package/dist/chunk-IJ2AHSWW.js +2 -0
- package/dist/{chunk-CSNJPD2J.js → chunk-IUQOG7Z5.js} +3 -3
- package/dist/chunk-IZ65ZPWY.js +3 -0
- package/dist/chunk-JGRXMTME.js +15 -0
- package/dist/{chunk-NBXYL2JT.js → chunk-JIRNI5TB.js} +7 -7
- package/dist/chunk-JNSWKGTB.js +2 -0
- package/dist/chunk-JZP3Y4ZM.js +2 -0
- package/dist/chunk-KF4DKXSS.js +2 -0
- package/dist/chunk-KGNE5CIM.js +2 -0
- package/dist/chunk-KM3YCIDV.js +3 -0
- package/dist/{chunk-HAYV4D2I.js → chunk-KODJVOCN.js} +1 -1
- package/dist/chunk-KU3YHPWZ.js +2 -0
- package/dist/{chunk-M3UAZTDK.js → chunk-KXHJMAZU.js} +2 -2
- package/dist/chunk-L5DALV5N.js +2 -0
- package/dist/chunk-LAOTVZHV.js +6 -0
- package/dist/chunk-LCSJ7GOG.js +2 -0
- package/dist/{chunk-DWMESHFI.js → chunk-LIGTP3A3.js} +1 -1
- package/dist/chunk-LKQFG4RW.js +5 -0
- package/dist/{chunk-EBLXHOE3.js → chunk-LQQNPMOD.js} +1 -1
- package/dist/chunk-LSDJOVWW.js +6 -0
- package/dist/{chunk-C6S2RPZA.js → chunk-LUR7JFPP.js} +1 -1
- package/dist/chunk-LUZBGTYB.js +2 -0
- package/dist/chunk-LX2I4JEH.js +2 -0
- package/dist/{chunk-7GAHJZLH.js → chunk-M43WH5DQ.js} +1 -1
- package/dist/chunk-MEKPGQAM.js +21 -0
- package/dist/chunk-MNBGG4H3.js +16 -0
- package/dist/chunk-MYVKUJGS.js +2 -0
- package/dist/chunk-MYZHOBS4.js +2 -0
- package/dist/chunk-NC7D7GOM.js +21 -0
- package/dist/chunk-NIVFEACM.js +2 -0
- package/dist/chunk-NLZZLANH.js +4 -0
- package/dist/{chunk-XT7XA4DN.js → chunk-NXAJBSIF.js} +1 -1
- package/dist/chunk-NXRF7FFS.js +2 -0
- package/dist/chunk-NZ6AV2TA.js +4 -0
- package/dist/chunk-O3HHTKZ5.js +6 -0
- package/dist/chunk-OCDBTAYS.js +12 -0
- package/dist/chunk-OFSDB7B4.js +3 -0
- package/dist/{chunk-Q5CINJYL.js → chunk-OGFU4YY4.js} +1 -1
- package/dist/chunk-OJ33Q6DU.js +2 -0
- package/dist/chunk-P2ZQDQDB.js +2 -0
- package/dist/{chunk-KXEE6VCA.js → chunk-P3JXJ4BW.js} +1 -1
- package/dist/chunk-PAWQ4AKN.js +2 -0
- package/dist/chunk-PUVMC4PX.js +26 -0
- package/dist/{chunk-SEEEGDVK.js → chunk-PZA3BSOE.js} +1 -1
- package/dist/chunk-Q3C6NDGI.js +2 -0
- package/dist/chunk-QBYENBMB.js +2 -0
- package/dist/chunk-QDFY5GGO.js +5 -0
- package/dist/chunk-QDXKEOKI.js +16 -0
- package/dist/{chunk-6VY62QC2.js → chunk-QENCC2ZS.js} +1 -1
- package/dist/chunk-QI5RZ7LL.js +2 -0
- package/dist/chunk-QXQ7KVEN.js +2 -0
- package/dist/chunk-R4JUKTDO.js +2 -0
- package/dist/chunk-R7KXAISS.js +12 -0
- package/dist/chunk-RDP7GWSY.js +2 -0
- package/dist/chunk-REKHAN53.js +5 -0
- package/dist/chunk-RF37IJNN.js +2 -0
- package/dist/{chunk-KWEOLPBJ.js → chunk-RFEON5GN.js} +1 -1
- package/dist/chunk-RHGW7B5Q.js +2 -0
- package/dist/chunk-RPRXRKKR.js +2 -0
- package/dist/{chunk-EOA6YPES.js → chunk-RTVHJ23A.js} +4 -4
- package/dist/chunk-RTVWQK7I.js +2 -0
- package/dist/chunk-RX6776AI.js +5 -0
- package/dist/{chunk-F7NSSQYZ.js → chunk-SGPAM5DZ.js} +1 -1
- package/dist/chunk-SMTBOSEJ.js +2 -0
- package/dist/chunk-SMXABALN.js +2 -0
- package/dist/{chunk-TM7VRLWS.js → chunk-SXRHKXSE.js} +1 -1
- package/dist/chunk-TNORODUF.js +2 -0
- package/dist/chunk-TU42YZOJ.js +6 -0
- package/dist/chunk-TU7TVFBK.js +2 -0
- package/dist/chunk-TW5AA5A7.js +8 -0
- package/dist/chunk-UEE3RZN4.js +14 -0
- package/dist/chunk-URH4FX3H.js +2 -0
- package/dist/chunk-UTM7D4PI.js +2 -0
- package/dist/chunk-UUJIGOEO.js +2 -0
- package/dist/chunk-UYDHOHSZ.js +2 -0
- package/dist/{chunk-4BZOG6PE.js → chunk-V7USCQWO.js} +1 -1
- package/dist/chunk-VJGWVBZR.js +1 -0
- package/dist/chunk-VLDCHFXF.js +2 -0
- package/dist/chunk-VO66KP2W.js +2 -0
- package/dist/chunk-VRIZDOO5.js +2 -0
- package/dist/{chunk-DOOI2JBD.js → chunk-VSVWNRI2.js} +1 -1
- package/dist/chunk-VUFIL5VR.js +6 -0
- package/dist/chunk-VX657KIK.js +2 -0
- package/dist/chunk-VXGN3IV7.js +2 -0
- package/dist/chunk-VZ4A6WMK.js +97 -0
- package/dist/chunk-VZJ6LUXX.js +2 -0
- package/dist/{chunk-RWSOZPJQ.js → chunk-W4QSZNMB.js} +1 -1
- package/dist/chunk-W54OT2FU.js +9 -0
- package/dist/{chunk-BL3SJDCG.js → chunk-W6HZF56M.js} +1 -1
- package/dist/chunk-W72ACCFL.js +27 -0
- package/dist/chunk-W7FLXW6Q.js +5 -0
- package/dist/chunk-WAOUE7MP.js +9 -0
- package/dist/chunk-WEIPY3CI.js +16 -0
- package/dist/chunk-WMGKUERB.js +6 -0
- package/dist/{chunk-DFS4RMVP.js → chunk-WN5VKKJ3.js} +1 -1
- package/dist/chunk-WOSANGV6.js +5 -0
- package/dist/{chunk-K3IQEL7R.js → chunk-WXJCJL5L.js} +1 -1
- package/dist/chunk-WZXPF3BI.js +2 -0
- package/dist/chunk-XB6BJPDL.js +2 -0
- package/dist/{chunk-4FHK4LKQ.js → chunk-XLEGGC4Y.js} +1 -1
- package/dist/chunk-XMPTFXPW.js +5 -0
- package/dist/chunk-XQMWHPZI.js +3 -0
- package/dist/{chunk-75MMTNPB.js → chunk-XRNQSXOM.js} +2 -2
- package/dist/{chunk-2PKME4VT.js → chunk-XZGEN4NU.js} +4 -4
- package/dist/chunk-XZYA7DNH.js +2 -0
- package/dist/{chunk-OIUV3ISA.js → chunk-Y6Y6RAY4.js} +1 -1
- package/dist/chunk-Y7E5L42F.js +3 -0
- package/dist/{chunk-GFBAK7WQ.js → chunk-YAW6JW6D.js} +7 -7
- package/dist/chunk-YDPTSDIJ.js +2 -0
- package/dist/chunk-YDSGXB25.js +2 -0
- package/dist/chunk-YGRULEZY.js +2 -0
- package/dist/chunk-YHFZFV3A.js +22 -0
- package/dist/chunk-YIKF4ERQ.js +375 -0
- package/dist/chunk-YLXWAY7D.js +2 -0
- package/dist/{chunk-UA2QDAWT.js → chunk-YPFQ4UGF.js} +1 -1
- package/dist/{chunk-4CYBXJIA.js → chunk-YQ5C6UDG.js} +1 -1
- package/dist/chunk-Z55KBMYV.js +2 -0
- package/dist/chunk-ZAFJQ3SM.js +2 -0
- package/dist/chunk-ZCRZFAOT.js +2 -0
- package/dist/chunk-ZFM77AQU.js +2 -0
- package/dist/{chunk-Q6F23V7L.js → chunk-ZFMRQ57Y.js} +1 -1
- package/dist/chunk-ZHWU6L2G.js +5 -0
- package/dist/chunk-ZTHYAHDN.js +17 -0
- package/dist/{chunk-X2A6CC6B.js → chunk-ZTRRFG52.js} +1 -1
- package/dist/chunk-ZU4W2QGM.js +3 -0
- package/dist/committer-JGY66PFM.js +2 -0
- package/dist/config-754B73XK.js +2 -0
- package/dist/controller-client-PB3AZAGG.js +2 -0
- package/dist/cover-cmd-NBNZCR6C.js +2 -0
- package/dist/{credentials-QD32Y7K7.js → credentials-F7DYLVWY.js} +1 -1
- package/dist/{deps-bundle-OI7JJ22L.js → deps-bundle-PW3WEQJ7.js} +1 -1
- package/dist/{deps-resolve-ZOALDS6H.js → deps-resolve-SQYVN76L.js} +1 -1
- package/dist/descriptor-7T32VRMB.js +2 -0
- package/dist/design-chat-F3OEZPNJ.js +2 -0
- package/dist/design-committer-TRYP3LOZ.js +2 -0
- package/dist/design-headless-OTHYOX3E.js +2 -0
- package/dist/design-remote-2BEGCVCX.js +3 -0
- package/dist/device-env-CHFRRV6W.js +2 -0
- package/dist/dispatch-DVQ3H7EJ.js +2 -0
- package/dist/doctor-XY26Z35T.js +2 -0
- package/dist/docx-convert-6IZO5P5K.js +2 -0
- package/dist/{dossier-7HVC6BNK.js → dossier-NROC2MCY.js} +1 -1
- package/dist/evidence-P6FFKC7B.js +2 -0
- package/dist/evidence-presentation-YYTIDCBS.js +2 -0
- package/dist/evolve-cmd-WWOB3QJR.js +2 -0
- package/dist/evolve-remote-WLVY3QID.js +2 -0
- package/dist/{exit-manager-ZLDO54S4.js → exit-manager-EDHCETUN.js} +1 -1
- package/dist/explain-DGJ5T6V5.js +2 -0
- package/dist/explain-cmd-OP5I5W3O.js +12 -0
- package/dist/explain-cmd-VYAANFFZ.js +4 -0
- package/dist/explore-K5YBGHK6.js +2 -0
- package/dist/explore-context-tty-RZ7D2TBV.js +2 -0
- package/dist/explore-entry-EKXJ67BD.js +6 -0
- package/dist/explore-live-2YVRAQZO.js +5 -0
- package/dist/explore-run-tty-D47FGPX7.js +5 -0
- package/dist/extract-bind-W2NET364.js +14 -0
- package/dist/extract-chat-M65NWGUK.js +2 -0
- package/dist/extract-cmd-FTFLETOP.js +6 -0
- package/dist/extract-headless-G6W6JQ27.js +2 -0
- package/dist/feeder-NY45UFJK.js +2 -0
- package/dist/folder-flags-KKIH654K.js +2 -0
- package/dist/gaps-cmd-OIDDLRYL.js +3 -0
- package/dist/gate-7AKRPRMK.js +2 -0
- package/dist/gate-WISOUTHQ.js +2 -0
- package/dist/{generate-headless-6WMJYNI6.js → generate-headless-RURIEKVS.js} +3 -3
- package/dist/headless-io-FFM5T6KL.js +2 -0
- package/dist/hold-passthrough-IOWPVB4W.js +2 -0
- package/dist/identity-HL5CJJXR.js +2 -0
- package/dist/index.js +178 -160
- package/dist/ingest-PDGS5ZTL.js +2 -0
- package/dist/ingest-cmd-4G2AK4Y2.js +8 -0
- package/dist/ingest-remote-SSLUHQVG.js +2 -0
- package/dist/ink-screen-RZ7QDIUI.js +2 -0
- package/dist/install-ZVBHPXGP.js +2 -0
- package/dist/interactive-bind-SI2ZS55Q.js +26 -0
- package/dist/interactive-remote-J56EWJGA.js +65 -0
- package/dist/interrupt-guard-QETBPINI.js +2 -0
- package/dist/lane-AQYRIW24.js +2 -0
- package/dist/lattice-auth-6FEVSR7E.js +2 -0
- package/dist/lifecycle-cmd-HJ37LTXE.js +2 -0
- package/dist/list-cmd-6XL2FYLQ.js +3 -0
- package/dist/list-commands-5DCCKU3L.js +2 -0
- package/dist/list-remote-LXPQNXYN.js +15 -0
- package/dist/locks-cmd-JJ2QNTNY.js +2 -0
- package/dist/logical-ids-RXAQJZ3T.js +2 -0
- package/dist/login-flow-WEK3E476.js +2 -0
- package/dist/maintenance-cmd-BXXHP36K.js +2 -0
- package/dist/mobile-prompts-CECJ5UY2.js +2 -0
- package/dist/{next-KZXH4UA4.js → next-O6SUSX3R.js} +1 -1
- package/dist/{objective-variable-gate-CG2KK5UX.js → objective-variable-gate-3Z7DNVVC.js} +1 -1
- package/dist/onboarding-PDVYMTY5.js +5 -0
- package/dist/open-provider-OZAG6WZS.js +2 -0
- package/dist/{paths-JCYX6UWL.js → paths-UMIX3RJF.js} +1 -1
- package/dist/pdf-convert-447ACUB3.js +2 -0
- package/dist/persist-recorded-session-A3ID7JFA.js +3 -0
- package/dist/phase-seed-LCJ4WSYV.js +2 -0
- package/dist/pipeline-GX3LKPI5.js +2 -0
- package/dist/prepare-target-FMT6QFHZ.js +2 -0
- package/dist/pull-cmd-UPFQYUND.js +2 -0
- package/dist/pull-route-FWBXJMR7.js +2 -0
- package/dist/readmodel-INMP6MNW.js +2 -0
- package/dist/real-device-run-X7JJWOIK.js +2 -0
- package/dist/reconcile-cmd-JBH365JL.js +5 -0
- package/dist/reconcile-deps-TWJ3FTSU.js +2 -0
- package/dist/reconcile-remote-BCX6SWFC.js +13 -0
- package/dist/recording-banner-YKBAL6UB.js +2 -0
- package/dist/registry-VQC757MJ.js +2 -0
- package/dist/remote-entry-X6JMPC2K.js +2 -0
- package/dist/remote-mode-FDPA7EWG.js +4 -0
- package/dist/remote-words-YVB66R3F.js +2 -0
- package/dist/require-project-folder-MLMEQJYP.js +2 -0
- package/dist/resolve-run-intent-PC7TQZUL.js +2 -0
- package/dist/resolver-EID34LQE.js +2 -0
- package/dist/revert-FHOBLZWF.js +2 -0
- package/dist/review-cmd-EUHFLFMY.js +5 -0
- package/dist/run-5RQUCNYP.js +2 -0
- package/dist/run-PC5YO4AS.js +2 -0
- package/dist/run-channel-63SVP5OI.js +2 -0
- package/dist/run-remote-SJCRTL7O.js +2 -0
- package/dist/run-startup-gate-YO66G6LS.js +2 -0
- package/dist/run-test-md-BLNBK4MH.js +17 -0
- package/dist/scrollback-GGNBDFQV.js +2 -0
- package/dist/session-target-DD53UXO7.js +2 -0
- package/dist/session-worker.js +12 -0
- package/dist/sessions-CFV7FOIT.js +2 -0
- package/dist/sessions-cmd-S7WZBUCN.js +26 -0
- package/dist/sessions-remote-IWHWIQ2T.js +3 -0
- package/dist/shell-arg-FN3MT5U7.js +2 -0
- package/dist/{skill-installer-32YYMM4N.js → skill-installer-MAVQY6GW.js} +1 -1
- package/dist/spawner-C7NLLM4F.js +2 -0
- package/dist/store-MSA7KASS.js +2 -0
- package/dist/store-choice-3OJCV26J.js +2 -0
- package/dist/store-guard-OOSDLMEC.js +2 -0
- package/dist/store-id-YZ5WKJ25.js +2 -0
- package/dist/store-site-KA2DNBGY.js +2 -0
- package/dist/stream-warnings-GEQKKJU7.js +2 -0
- package/dist/structured-answers-EQ2AP3F7.js +2 -0
- package/dist/sync-cmd-RDFDMVKQ.js +2 -0
- package/dist/sync-setup-RBRDUV7Q.js +2 -0
- package/dist/{sync-setup-ui-RC727VK6.js → sync-setup-ui-XITPGSO4.js} +2 -2
- package/dist/tcg-generate-KIECTZ2C.js +2 -0
- package/dist/test-definition-VRI4YIYL.js +2 -0
- package/dist/testmd-actions-CMAG6HWI.js +2 -0
- package/dist/testmd-sync-UPAA5UMD.js +2 -0
- package/dist/tms-client-NXAB6VJD.js +2 -0
- package/dist/token-refresh-KP3AYMYK.js +2 -0
- package/dist/trust-gate-AT2XBWN4.js +2 -0
- package/dist/turn-preflight-LHYLRL7G.js +2 -0
- package/dist/ui-SNV3FD2G.js +4 -0
- package/dist/use-case-ref-NE4X4MZN.js +2 -0
- package/dist/validate-basic-M5JHHNZA.js +2 -0
- package/dist/{variable-receipt-YWNS24TH.js → variable-receipt-BXSZO36E.js} +1 -1
- package/dist/verdicts-XK3GAUX3.js +2 -0
- package/dist/version-check-Q737BE65.js +2 -0
- package/dist/{view-cmd-3WHG6MVB.js → view-cmd-XSNL5DGI.js} +4 -3
- package/dist/walk-session-SHGYLFRB.js +2 -0
- package/dist/with-telemetry-PM2HVN2B.js +2 -0
- package/package.json +11 -11
- package/dist/ChatSurface-FJPK3XEJ.js +0 -8
- package/dist/ChromeProfilePicker-7DUDJTE2.js +0 -2
- package/dist/CliFeedbackPrompt-ZZPYC6OS.js +0 -2
- package/dist/CliUploadProgress-WQYKIBAR.js +0 -2
- package/dist/ConfigView-KXNOODDW.js +0 -2
- package/dist/EvidenceViewOffer-BTBVPBZX.js +0 -2
- package/dist/FolderPicker-H4YEX5LV.js +0 -2
- package/dist/InfoBox-DTM7X24Z.js +0 -2
- package/dist/LinksBox-KFG3FVOT.js +0 -2
- package/dist/ProfilesView-KBZHT4KL.js +0 -2
- package/dist/ProjectPicker-OARWULNN.js +0 -2
- package/dist/SaveSessionPrompt-37SMU5MC.js +0 -2
- package/dist/ScrollbackTap-QHJOFYMC.js +0 -2
- package/dist/SingleShotApp-UYCAW65Y.js +0 -2
- package/dist/SummaryBox-6RB5DSAH.js +0 -2
- package/dist/TestMdRunView-ZMOII3PL.js +0 -2
- package/dist/TestrunEvidenceTable-3UP2EYIV.js +0 -2
- package/dist/WhoamiView-MC62GERR.js +0 -2
- package/dist/app-client-PQFJAB63.js +0 -2
- package/dist/app-download-P6YXWSVQ.js +0 -2
- package/dist/auth-LXW4OFKF.js +0 -2
- package/dist/bind-ZYESQSCJ.js +0 -15
- package/dist/bootstrap-DI4UGMH3.js +0 -2
- package/dist/bridge-7J3JE3JS.js +0 -2
- package/dist/build-JIKYOZUH.js +0 -2
- package/dist/catalog-LLME3744.js +0 -2
- package/dist/chat-committer-6D7AQI6Z.js +0 -2
- package/dist/chat-controller-UJQ6Z4RE.js +0 -2
- package/dist/chunk-243ZJHT6.js +0 -4
- package/dist/chunk-2KVECC36.js +0 -2
- package/dist/chunk-2YEHV2CX.js +0 -2
- package/dist/chunk-3MCPTVJX.js +0 -2
- package/dist/chunk-3UI5VTQS.js +0 -4
- package/dist/chunk-3VAU3PNU.js +0 -2
- package/dist/chunk-3YIZG7WZ.js +0 -3
- package/dist/chunk-4Y2WH77W.js +0 -2
- package/dist/chunk-5EOX4MEY.js +0 -2
- package/dist/chunk-5HMN74RZ.js +0 -9
- package/dist/chunk-5LJRZI7S.js +0 -6
- package/dist/chunk-5RCS2LIQ.js +0 -26
- package/dist/chunk-5TQFOPJV.js +0 -2
- package/dist/chunk-5ZFOKYFB.js +0 -5
- package/dist/chunk-63DYVWNX.js +0 -2
- package/dist/chunk-6MD7SR7D.js +0 -9
- package/dist/chunk-7N6OCHPC.js +0 -7
- package/dist/chunk-A2SQD2AY.js +0 -4
- package/dist/chunk-AACQE24F.js +0 -2
- package/dist/chunk-AHFIRHSP.js +0 -18
- package/dist/chunk-AJT34ESA.js +0 -38
- package/dist/chunk-AUMJ4RVA.js +0 -21
- package/dist/chunk-AXTPNZPX.js +0 -2
- package/dist/chunk-BB2W35TW.js +0 -2
- package/dist/chunk-BKM2LWU2.js +0 -3
- package/dist/chunk-BUPRL2TE.js +0 -2
- package/dist/chunk-C44QQJR4.js +0 -239
- package/dist/chunk-CW3RHKLA.js +0 -5
- package/dist/chunk-D6E6KRVX.js +0 -2
- package/dist/chunk-DTRKTBCE.js +0 -17
- package/dist/chunk-DTRSYWZE.js +0 -2
- package/dist/chunk-EVFFDODK.js +0 -5
- package/dist/chunk-F2OBORCG.js +0 -2
- package/dist/chunk-FQNQVC5O.js +0 -5
- package/dist/chunk-FY7TCYPK.js +0 -6
- package/dist/chunk-GTVQYT3D.js +0 -35
- package/dist/chunk-HG5LLZBU.js +0 -2
- package/dist/chunk-I7TIGB7K.js +0 -2
- package/dist/chunk-IICT4VOU.js +0 -2
- package/dist/chunk-ILDHE4P4.js +0 -6
- package/dist/chunk-IPXKUYUK.js +0 -2
- package/dist/chunk-JQY5HRZ4.js +0 -15
- package/dist/chunk-JX6BFEDO.js +0 -4
- package/dist/chunk-K2UJYY2U.js +0 -2
- package/dist/chunk-KBM3XHAM.js +0 -2
- package/dist/chunk-KDNNMU7Q.js +0 -4
- package/dist/chunk-KJQNAOOE.js +0 -6
- package/dist/chunk-LH4IPANP.js +0 -2
- package/dist/chunk-LLG7NEGX.js +0 -6
- package/dist/chunk-LSDWPG6C.js +0 -2
- package/dist/chunk-MSGW4JDG.js +0 -2
- package/dist/chunk-NJ4BXZBX.js +0 -2
- package/dist/chunk-NLCCBXXV.js +0 -2
- package/dist/chunk-NMSZ7G6P.js +0 -2
- package/dist/chunk-OC6H6BYI.js +0 -6
- package/dist/chunk-OJAXOOZ5.js +0 -8
- package/dist/chunk-OMNLAGQC.js +0 -29
- package/dist/chunk-OOCCUUR2.js +0 -2
- package/dist/chunk-OXC6O5O7.js +0 -2
- package/dist/chunk-OZQDD2EX.js +0 -94
- package/dist/chunk-PEDINHVU.js +0 -2
- package/dist/chunk-PNUAP3RY.js +0 -8
- package/dist/chunk-Q2F5QB2W.js +0 -2
- package/dist/chunk-Q4YYAN6E.js +0 -2
- package/dist/chunk-Q6AHSGOE.js +0 -5
- package/dist/chunk-QAB3Y5FQ.js +0 -4
- package/dist/chunk-RDHWNSDP.js +0 -7
- package/dist/chunk-RKXHVP2Z.js +0 -2
- package/dist/chunk-RRY5IXOB.js +0 -2
- package/dist/chunk-RSSOJ3L2.js +0 -21
- package/dist/chunk-RTSBKCZY.js +0 -16
- package/dist/chunk-SID4X77D.js +0 -370
- package/dist/chunk-SRTKRHYI.js +0 -12
- package/dist/chunk-T2ONUKTL.js +0 -5
- package/dist/chunk-U6OTFMIT.js +0 -4
- package/dist/chunk-UD7KKHPW.js +0 -5
- package/dist/chunk-USOYXCZ4.js +0 -2
- package/dist/chunk-USY7VAO6.js +0 -2
- package/dist/chunk-V4B5QA3U.js +0 -4
- package/dist/chunk-VBS33P2C.js +0 -2
- package/dist/chunk-VHW7BMZQ.js +0 -2
- package/dist/chunk-VIO7CCFW.js +0 -5
- package/dist/chunk-VORWZLS3.js +0 -9
- package/dist/chunk-VVOKM2VO.js +0 -2
- package/dist/chunk-W5TTF7GB.js +0 -6
- package/dist/chunk-WESMQEPO.js +0 -2
- package/dist/chunk-WMI4P76K.js +0 -27
- package/dist/chunk-WNOC6MQC.js +0 -2
- package/dist/chunk-WVHMPIDQ.js +0 -2
- package/dist/chunk-XBX643ZD.js +0 -2
- package/dist/chunk-XKHWWKJZ.js +0 -3
- package/dist/chunk-XLSOQLVT.js +0 -2
- package/dist/chunk-Y3ZYN6AK.js +0 -4
- package/dist/chunk-YCCUBQY4.js +0 -2
- package/dist/chunk-YKTYVJBN.js +0 -3
- package/dist/chunk-YLQHY4A7.js +0 -2
- package/dist/chunk-Z7IGTVJW.js +0 -2
- package/dist/chunk-ZC2CKWLB.js +0 -2
- package/dist/chunk-ZER3FZSZ.js +0 -22
- package/dist/chunk-ZJYT72BA.js +0 -9
- package/dist/chunk-ZKSN2SJ7.js +0 -2
- package/dist/chunk-ZLWURCJ7.js +0 -2
- package/dist/committer-2QPBANRD.js +0 -2
- package/dist/config-YGTHSGQN.js +0 -2
- package/dist/controller-client-ZF5IXRUV.js +0 -2
- package/dist/cover-cmd-6RO366CC.js +0 -3
- package/dist/descriptor-3JJUOHBM.js +0 -2
- package/dist/design-committer-D44GSUXY.js +0 -2
- package/dist/device-env-DXDJJMTL.js +0 -2
- package/dist/dispatch-7EWWQRQ5.js +0 -2
- package/dist/doctor-TPYPEEUL.js +0 -2
- package/dist/docx-convert-SQRTF7XS.js +0 -2
- package/dist/evidence-NPFTBGDF.js +0 -2
- package/dist/evidence-presentation-XF23B7F2.js +0 -2
- package/dist/evolve-cmd-VGVXV6XW.js +0 -2
- package/dist/explain-NEFBUX5G.js +0 -2
- package/dist/explain-cmd-GOP5TE63.js +0 -9
- package/dist/explain-cmd-M7IX2YNB.js +0 -3
- package/dist/extract-bind-CKIRLXAJ.js +0 -14
- package/dist/extract-cmd-3EWLSPGS.js +0 -5
- package/dist/feeder-66TUPB2R.js +0 -2
- package/dist/gaps-cmd-WVC5GXQC.js +0 -3
- package/dist/gate-OYRDJMF6.js +0 -2
- package/dist/headless-io-75HUMWZB.js +0 -2
- package/dist/identity-ADZ4PAJF.js +0 -2
- package/dist/ingest-OSNNM3DH.js +0 -2
- package/dist/ingest-cmd-AECK5T4H.js +0 -2
- package/dist/install-ZV3KJZV4.js +0 -2
- package/dist/interactive-bind-IYS6KDOH.js +0 -26
- package/dist/interrupt-guard-UREUWNRL.js +0 -2
- package/dist/lifecycle-cmd-XCSBELFQ.js +0 -2
- package/dist/list-cmd-S4DSN2ET.js +0 -3
- package/dist/list-commands-GLNGHPDU.js +0 -2
- package/dist/locks-cmd-67OHQZNV.js +0 -2
- package/dist/logical-ids-GLVM2SVR.js +0 -2
- package/dist/login-flow-ASUUU7SO.js +0 -2
- package/dist/maintenance-cmd-K5KXRIFL.js +0 -2
- package/dist/mobile-prompts-ZUZTA3RV.js +0 -2
- package/dist/open-provider-YIBB77FE.js +0 -2
- package/dist/pdf-convert-RLXSXFWN.js +0 -2
- package/dist/persist-recorded-session-EWV56TSZ.js +0 -3
- package/dist/phase-seed-MKHEWUN6.js +0 -2
- package/dist/pipeline-LAWACB2O.js +0 -2
- package/dist/prepare-target-WGPCZKLE.js +0 -2
- package/dist/readmodel-FVLRQWZ7.js +0 -2
- package/dist/real-device-run-MDLFKFVQ.js +0 -2
- package/dist/reconcile-cmd-XFM2ZXUJ.js +0 -2
- package/dist/reconcile-deps-V5VLDPYT.js +0 -4
- package/dist/reconcile-engine-VZBTMPUK.js +0 -2
- package/dist/recording-banner-CJHRPHHF.js +0 -2
- package/dist/records-LMCVKPE5.js +0 -2
- package/dist/registry-3JXQFZEG.js +0 -2
- package/dist/require-project-folder-SE5GVCYJ.js +0 -2
- package/dist/resolve-run-intent-DD4MB6UD.js +0 -2
- package/dist/resolver-TLO4SRWV.js +0 -2
- package/dist/revert-NOUECRW4.js +0 -2
- package/dist/review-cmd-7EOYQMPE.js +0 -5
- package/dist/run-EHUNJPW6.js +0 -2
- package/dist/run-OTMPUQSH.js +0 -2
- package/dist/run-channel-RGH4WIQX.js +0 -2
- package/dist/run-test-md-KBDEHGXJ.js +0 -17
- package/dist/scrollback-JLPJR25X.js +0 -2
- package/dist/session-items-2ATN7VXG.js +0 -2
- package/dist/session-target-UMNASXI7.js +0 -2
- package/dist/sessions-NH7WQWMX.js +0 -2
- package/dist/sessions-cmd-M3SECFKQ.js +0 -25
- package/dist/spawner-DPT2RLAO.js +0 -2
- package/dist/store-guard-U32JE6JJ.js +0 -2
- package/dist/store-id-EOSGEKVK.js +0 -2
- package/dist/structured-answers-ZI2B6JJE.js +0 -2
- package/dist/sync-cmd-3EP7LZGL.js +0 -2
- package/dist/sync-setup-SWTBVQEV.js +0 -2
- package/dist/tcg-generate-KXU7E2GF.js +0 -2
- package/dist/testmd-actions-PEWCPQ5R.js +0 -2
- package/dist/testmd-sync-ZWFQWZ2X.js +0 -2
- package/dist/tms-client-KU6HCA23.js +0 -2
- package/dist/token-refresh-QD3OCGJJ.js +0 -2
- package/dist/trust-gate-EX7R2P4Y.js +0 -2
- package/dist/turn-preflight-JGYT7LXP.js +0 -2
- package/dist/ui-JEJGTURD.js +0 -4
- package/dist/validate-basic-AAIXSAWH.js +0 -2
- package/dist/verdicts-LAB5BGCC.js +0 -2
- package/dist/version-check-EHOLX3YH.js +0 -2
- package/dist/walk-session-XP4KYFKO.js +0 -2
- package/dist/with-telemetry-FJMJQDCM.js +0 -2
- /package/dist/{chunk-BKHXPBWN.js → chunk-2RUSXQ3O.js} +0 -0
- /package/dist/{chunk-6J5T5FEY.js → chunk-3AGP2BVN.js} +0 -0
- /package/dist/{chunk-CH273NAE.js → chunk-73Y6T2UK.js} +0 -0
- /package/dist/{chunk-ZMNJBUAO.js → chunk-73ZFOJOK.js} +0 -0
- /package/dist/{chunk-NOL7MNZH.js → chunk-A7RJQJNT.js} +0 -0
- /package/dist/{chunk-N2P4MI32.js → chunk-FWGUISUG.js} +0 -0
- /package/dist/{chunk-UJZZDPDY.js → chunk-HD6NR44L.js} +0 -0
- /package/dist/{chunk-LDPLJFCV.js → chunk-I6S6DZ2E.js} +0 -0
- /package/dist/{chunk-427OQS2N.js → chunk-LD5B3QFW.js} +0 -0
- /package/dist/{chunk-2UIHS2FH.js → chunk-PGESS7BW.js} +0 -0
- /package/dist/{chunk-BZAGVBCX.js → chunk-ZCIWQHCO.js} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as A,b as T,c as $,d as x,e as c,h as F}from"./chunk-UUJIGOEO.js";import{f as k,l as v,q as E}from"./chunk-AZLNLHUA.js";import{M as S,j as N,m as U,n as O}from"./chunk-UEE3RZN4.js";import{d as m}from"./chunk-DBMW3VUN.js";import{existsSync as R,readFileSync as H,statSync as M}from"fs";var B=t=>{try{return R(t)&&M(t).isFile()}catch{return!1}},C=t=>N(t)&&A.test(t);async function y(t,n,o,l){let e=t.manifest.id,s,a=new Promise((r,d)=>{s=setTimeout(()=>d(new $({code:"PLUGIN_HOOK_TIMEOUT",message:`plugin ${e} did not answer ${n} within ${Math.round(o/1e3)} seconds`,plugin:e,hook:n})),o)});try{return await Promise.race([Promise.resolve().then(l),a])}catch(r){throw r instanceof $?r:r instanceof T?new $({code:"PLUGIN_REFUSED",message:r.message,plugin:e,hook:n,...r.remedy?{remedy:r.remedy}:{}}):new $({code:"PLUGIN_HOOK_FAILED",message:`plugin ${e} failed in ${n}: ${r instanceof Error?r.message:String(r)}`,plugin:e,hook:n})}finally{clearTimeout(s)}}async function ee(t){let{plugin:n,ref:o,named:l}=t,e=n.manifest.id,s=t.hookMs??m.hookMs,a=t.isFile??B(o),r=!a&&x(n).includes("remote")&&typeof n.fetch=="function",d=l?`${e}:${o}`:o,I=r?O(d):null;I!==null&&c("PLUGIN_REF_INVALID",`${d.length>80?`${d.slice(0,80)}\u2026`:d} cannot be recorded as a reference: ${I}`,{plugin:e,remedy:`give the source as <scheme>:<rest>, one word of at most ${U} characters`});let h=await y(n,"claim",s,()=>n.claim({ref:o,named:l,isFile:a}));h==null&&c("PLUGIN_NOT_CLAIMED",`plugin ${e} does not read ${o}`,{plugin:e,hook:"claim",remedy:l?`drop the ${e}: prefix, or name the plugin that reads it`:"ingest it as a file of a built-in kind"}),(typeof h!="object"||typeof h.sourceId!="string")&&c("PLUGIN_HOOK_FAILED",`plugin ${e} answered claim with something that is not a claim`,{plugin:e,hook:"claim"});let p=t.asId??h.sourceId,b=h.recorded;if(r&&b!==void 0){(typeof b!="string"||b==="")&&c("PLUGIN_HOOK_FAILED",`plugin ${e} answered claim with a recorded reference that is not one`,{plugin:e,hook:"claim"});let i=l?`${e}:${b}`:b,u=O(i);u!==null&&c("PLUGIN_HOOK_FAILED",`plugin ${e} would record ${i.length>80?`${i.slice(0,80)}\u2026`:i}, which cannot be recorded as a reference: ${u}`,{plugin:e,hook:"claim"});let f=(t.registry??F()).route(i,()=>!1);(f===null||f.plugin.manifest.id!==e)&&c("PLUGIN_HOOK_FAILED",`plugin ${e} would record ${i.length>80?`${i.slice(0,80)}\u2026`:i}, which ${f===null?"no plugin reads":`plugin ${f.plugin.manifest.id} reads`}: a recorded reference must route back to the plugin that read it`,{plugin:e,hook:"claim"});let w=await y(n,"claim",s,()=>n.claim({ref:f.ref,named:f.named,isFile:!1}));(w==null||typeof w!="object"||w.sourceId!==h.sourceId)&&c("PLUGIN_HOOK_FAILED",`plugin ${e} would record ${b} for ${h.sourceId}, but claiming it again ${w?`gives ${String(w.sourceId)}`:"is refused"}: a recorded reference must name the same source`,{plugin:e,hook:"claim"}),d=i}C(p)||c("PLUGIN_SOURCE_ID_INVALID",`${JSON.stringify(p)} is not an id a source may have: it starts with a letter or digit and holds letters, digits and . _ -, at most 128 characters`,{plugin:e,hook:"claim",remedy:t.asId===void 0?"give the source an id with --as <id>":"give another id with --as <id>"});let g,L;if(!a&&t.supplied!==void 0){r||c("PLUGIN_REMOTE_UNAVAILABLE",`${o} is not a file on this machine, and plugin ${e} has no connection to fetch it through`,{plugin:e,remedy:"save the source to a file and ingest the file"}),g=Buffer.from(t.supplied.bytes),g.byteLength>m.contentBytes&&c("PLUGIN_CONTENT_TOO_LARGE",`${o} is ${g.byteLength} bytes; a plugin's source may be at most ${m.contentBytes}`,{plugin:e,hook:"fetch"});let i=t.supplied.cursor??null;L={ref:d,...i!==null?{cursor:i}:{}}}else if(a)g=t.supplied!==void 0?Buffer.from(t.supplied.bytes):H(o),g.byteLength>m.contentBytes&&c("PLUGIN_CONTENT_TOO_LARGE",`${o} is ${g.byteLength} bytes; a plugin's source may be at most ${m.contentBytes}`,{plugin:e});else{let i=r?t.connect?.(e):void 0;i===void 0&&c("PLUGIN_REMOTE_UNAVAILABLE",`${o} is not a file on this machine, and plugin ${e} has no connection to fetch it through`,{plugin:e,remedy:"save the source to a file and ingest the file"});let u=t.cursor!==void 0?t.cursor:j(t.store,p,e,d),f=await D(n,i,{ref:o,sourceId:p,cursor:u},s);if(f.kind==="unchanged")return K(t.store,p,e);g=f.bytes,L={ref:d,...f.cursor!==null?{cursor:f.cursor}:{}},t.onFetched?.({bytes:new Uint8Array(g),cursor:f.cursor})}let _={sourceId:p,bytes:new Uint8Array(g)},G=async()=>{let u=(await y(n,"render",s,()=>n.render(_)))?.text;(typeof u!="string"||u===""||u.includes("\0"))&&c("PLUGIN_TEXT_INVALID",`plugin ${e} rendered ${p} to something that is not text: ${typeof u!="string"?"no text":u===""?"empty text":"text holding a NUL"}`,{plugin:e,hook:"render"});let f=await y(n,"index",s,()=>n.index(_,{text:u}));return{projection:u,inventory:[],blobs:new Map,delivered:[],converter:{name:e,version:n.manifest.version,policy:`rules-${n.manifest.rules}`},units:f}},P=x(n);return E({store:t.store,bytes:g,media:k,sourceId:p,label:o,plugin:{id:e,rules:n.manifest.rules,...L!==void 0?{fetch:L}:{},...P.includes("cites-deep")?{citesDeep:!0}:{}},converters:{plugin:G},...P.includes("explain")&&typeof n.explain=="function"?{explain:(i,u)=>y(n,"explain",Math.min(u,s),()=>n.explain(i))}:{},...t.explainMs!==void 0?{explainMs:t.explainMs}:{},...P.includes("context")&&typeof n.context=="function"?{context:(i,u)=>y(n,"context",Math.min(u,s),()=>n.context({..._,text:i.text,units:i.units}))}:{},...P.includes("coverage")&&typeof n.coverage=="function"?{coverage:(i,u)=>y(n,"coverage",Math.min(u,s),()=>n.coverage({sourceId:_.sourceId,units:i.units}))}:{},...t.confirmSameSource?{confirmSameSource:t.confirmSameSource}:{},...t.eventIds?{eventIds:t.eventIds}:{},...t.provenance?{provenance:t.provenance}:{}})}async function D(t,n,o,l){let e=t.manifest.id,s;try{s=await y(t,"fetch",l,()=>t.fetch({...o,connection:n}))}catch(h){throw n.breach?n.breach:h}finally{n.close()}if(n.breach)throw n.breach;let a=s?.kind;if(a==="unchanged")return{kind:"unchanged"};let r=s;(a!=="content"||!(r.bytes instanceof Uint8Array))&&c("PLUGIN_HOOK_FAILED",`plugin ${e} answered fetch with something that is not an answer: neither the content, with its bytes, nor "unchanged"`,{plugin:e,hook:"fetch"});let d=Buffer.from(r.bytes);d.byteLength>m.contentBytes&&c("PLUGIN_CONTENT_TOO_LARGE",`plugin ${e} fetched ${d.byteLength} bytes for ${o.ref}; a plugin's source may be at most ${m.contentBytes}`,{plugin:e,hook:"fetch"}),r.cursor!==void 0&&typeof r.cursor!="string"&&c("PLUGIN_HOOK_FAILED",`plugin ${e} answered fetch with a cursor that is not a string`,{plugin:e,hook:"fetch"});let I=r.cursor===void 0?null:r.cursor;return I!==null&&Buffer.byteLength(I,"utf8")>m.cursorBytes&&c("PLUGIN_CURSOR_TOO_LARGE",`plugin ${e} answered fetch with a cursor of ${Buffer.byteLength(I,"utf8")} bytes; a cursor may be at most ${m.cursorBytes}`,{plugin:e,hook:"fetch",remedy:"the plugin must be fixed: every later fetch of this source starts from the same cursor and is refused the same way"}),{kind:"content",bytes:d,cursor:I}}function K(t,n,o){let l=S(t),e=l.heads.get(n);typeof e!="string"&&c("PLUGIN_HOOK_FAILED",`plugin ${o} answered fetch with "unchanged" for ${n}, which this store holds no current version of`,{plugin:o,hook:"fetch"});let s=l.mediaOf(e),a=v(n,s.format==="plugin"?s.plugin?.id??"":null,o,!1);if(a!==void 0)throw new Error(a);let r=l.getNode(e)?.content.blob;return{status:"unchanged",source_id:n,cid:e,blob:typeof r=="string"?r:""}}function j(t,n,o,l){let e=S(t),s=e.heads.get(n);if(typeof s!="string")return null;let a=e.mediaOf(s).plugin;return a?.id!==o||a.fetch?.ref!==l?null:a.fetch.cursor??null}export{B as a,C as b,y as c,ee as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as A}from"./chunk-SMXABALN.js";import{a as _}from"./chunk-ZAFJQ3SM.js";import{d as B}from"./chunk-C6HI6Y3S.js";import{a as R}from"./chunk-ICLUC44J.js";import{a as k}from"./chunk-C2RUDJ46.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as c}from"./chunk-33DWJV67.js";import{a as J}from"./chunk-6YGTRKDT.js";import{y as l}from"./chunk-D36V5OX6.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,s,y,m){return{id:n,label:`${s} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:s,currentFolderId:y,env:m,onSelect:w,onCancel:x}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,h]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),b=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=k(m),T=new B(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let i=await T.listFolders(s);yield{page:1,folders:i,totalLoaded:i.length,done:!0}})();for await(let i of F){if(d(!1),i.totalLoaded===0){b.current=!0,h("naming"),g(!1);return}M(i.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),i.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,s,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!s){f("No project selected \u2014 pick a project first");return}f(null),h("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=k(m),i=await new B(T.tmsBaseUrl,a.username,a.access_key).createFolder(s,r);w(i.id,i.name)}catch(a){f(a instanceof Error?a.message:String(a)),h("naming")}})()},[n,s,m,w]),H=(0,t.useCallback)(()=>{v(""),f(null),b.current?x():h("list")},[x]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:l.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(c,{color:l.orange,bold:!0,children:"Create new folder"}),b.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(c,{color:l.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(c,{color:l.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(c,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(c,{color:l.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(c,{color:l.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{b.current=!1,h("naming")},extraHint:"new",onSelect:o=>{let r=o.label.split(" (")[0];w(o.id,r)},onCancel:x})}export{X as a,W as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as f}from"./chunk-AUJSC7PU.js";import{c as d}from"./chunk-I2MC6VVX.js";import{g}from"./chunk-4I7YN6YY.js";import{existsSync as a}from"fs";import{resolve as i}from"path";function E(){let n=g().packageRoot;return n===null?[]:[n]}function A(n){return{"darwin-arm64":"kane-cli-darwin-arm64","darwin-x64":"kane-cli-darwin-x64","linux-x64":"kane-cli-linux-x64","linux-arm64":"kane-cli-linux-arm64","win32-x64":"kane-cli-win-x64"}[n]??null}function S(n){return{"darwin-arm64":"kane-cli-assurance-darwin-arm64","darwin-x64":"kane-cli-assurance-darwin-x64","linux-x64":"kane-cli-assurance-linux-x64","linux-arm64":"kane-cli-assurance-linux-arm64","win32-x64":"kane-cli-assurance-win-x64"}[n]??null}function v(n=E()){let e=A(`${process.platform}-${process.arch}`),c=S(`${process.platform}-${process.arch}`),t=process.platform==="win32"?"assurance-agent.exe":"assurance-agent";for(let r of n){for(let s of c?["@testmuai","@lambdatestincprivate"]:[]){let o=i(r,"node_modules",s,c,"bin",t);if(a(o))return{cmd:o,args:[],tier:"platform"}}for(let s of e?["@testmuai","@lambdatestincprivate"]:[]){let o=i(r,"node_modules",s,e,"bin",t);if(a(o))return{cmd:o,args:[],tier:"platform"}}let m=i(r,"dist","bin",t);if(a(m))return{cmd:m,args:[],tier:"embedded"};let u=i(r,"../assurance-agent/dist",t);if(a(u))return{cmd:u,args:[],tier:"sibling"};let l=i(r,"../assurance-agent/main.py");if(a(l)){let s=i(r,"../assurance-agent/.venv/bin/python");return{cmd:a(s)?s:"python3",args:[l],tier:"dev-python"}}}return null}var _=12e4+d;function P(n,e={}){return{...process.env,...e,...f(),TESTMUAI_SOURCE:"kane-cli",TESTMUAI_SESSION_ID:n,ASSURANCE_LOG_LEVEL:process.env.ASSURANCE_LOG_LEVEL??"info",PYTHONIOENCODING:"utf-8",PYTHONUTF8:"1",ASSURANCE_CHECKPOINT_SAVE_DEADLINE_S:String(_/1e3)}}async function C(n,e=process.env){if(e.TESTMUAI_API_KEY||e.TESTMUAI_BASIC_AUTH)return{};try{let t={TESTMUAI_ENV:e.TESTMUAI_ENV==="stage"?"stage":"prod"},r=await n.controller();return r.basic?(t.TESTMUAI_BASIC_AUTH=Buffer.from(`${r.basic.username}:${r.basic.accessKey}`,"utf8").toString("base64"),t):r.token?(t.TESTMUAI_API_KEY=r.token,t):{}}catch{return{}}}export{A as a,S as b,v as c,_ as d,P as e,C as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as f}from"./chunk-4QTH7VYE.js";import{a as w}from"./chunk-RZ4F3BHX.js";var g=class extends Error{constructor(n,e,r,s=null){super(r);this.status=n;this.code=e;this.body=s;this.name="ExplorationApiError"}},b=new Set([400,409,422]),R=new Set([408,425,429]),h=new Set(["RUN_NOT_ACTIVE","RUN_ENDED","NOT_FOUND"]),y=class{base;authHeader;timeoutMs;constructor(t){this.base=t.baseUrl.replace(/\/+$/,"")+"/exploration",this.authHeader=f(t.auth.username,t.auth.access_key),this.timeoutMs=t.timeoutMs??3e4}async createExploration(t){let n=await this.call("",t),e=typeof n.id=="string"?n.id:typeof n.exploration_id=="string"?n.exploration_id:null;if(!e)throw new g(0,"BAD_RESPONSE","create exploration: response carries no id");return{id:e,body:n}}async startRun(t,n){let e=await this.call(`/${a(t)}/runs`,n);return k(t,e)}async endRun(t,n,e){return this.call(`/${a(t)}/runs/${a(n)}/end`,e)}async listExplorations(t={}){let n=await this.getJson("",{state:t.state??"running",project:t.project,limit:t.limit,cursor:t.cursor});return{explorations:Array.isArray(n.explorations)?n.explorations:[],next_cursor:u(n.next_cursor)??null}}async listSessions(t,n={}){let e=await this.getJson(`/${a(t)}/sessions`,{limit:n.limit,cursor:n.cursor});return{sessions:Array.isArray(e.sessions)?e.sessions:[],next_cursor:u(e.next_cursor)??null}}async getSession(t,n){return await this.getJson(`/${a(t)}/sessions/${a(n)}`)}async remoteRun(t){return await this.call("/remote/run",t)}async runRequest(t,n){return this.getJson(`/${a(t)}/runs/${a(n)}/request`)}async stopExploration(t,n=!0){let e=`/${a(t)}/stop`,r=await this.post(e,{wait:n}),{json:s,text:i}=await m(r);if(!r.ok){let l=typeof s?.code=="string"?s.code:`HTTP_${r.status}`;throw new g(r.status,l,`POST /exploration${e} failed: ${_(s,i,r.status)}`,s)}return{status:r.status,body:s??{}}}async deleteExploration(t){let n=await this.send("DELETE",`/${a(t)}`),{json:e,text:r}=await m(n);if(!n.ok){let s=typeof e?.code=="string"?e.code:`HTTP_${n.status}`;throw new g(n.status,s,`DELETE /exploration/${t} failed: ${_(e,r,n.status)}`,e)}return{exploration_id:u(e?.exploration_id)??t,deleted_at:u(e?.deleted_at)??""}}async getContext(t){return this.getJson(`/${a(t)}/context`)}async setContext(t,n){return await this.jsonRequest("PUT",`/${a(t)}/context`,{enabled:n})}async syncContext(t){return await this.jsonRequest("POST",`/${a(t)}/context/sync`,{})}async queryMap(t){return this.getJson(`/${a(t)}/query/map`)}async viewSummary(t){try{return await this.getJson(`/${a(t)}/view/summary`)}catch{return null}}async wireVersion(){try{return u((await this.getJson("/wire")).wire_version)}catch(t){if(t instanceof g&&t.status===404)return;throw t}}async getJson(t,n={}){let e=new URLSearchParams;for(let[c,d]of Object.entries(n))d!==void 0&&d!==""&&e.set(c,String(d));let r=e.toString(),s=r?`${t}?${r}`:t,i=await this.send("GET",s),{json:l,text:p}=await m(i);if(!i.ok){let c=typeof l?.code=="string"?l.code:`HTTP_${i.status}`;throw new g(i.status,c,`GET /exploration${t} failed: ${_(l,p,i.status)}`,l)}return l??{}}async send(t,n){let e=new AbortController,r=setTimeout(()=>e.abort(),this.timeoutMs);try{return await w(`${this.base}${n}`,{method:t,headers:{Authorization:this.authHeader,Accept:"application/json"},signal:e.signal})}catch(s){throw s instanceof Error&&s.name==="AbortError"?new Error(`${t} /exploration${n} timed out after ${this.timeoutMs}ms`):s}finally{clearTimeout(r)}}async commitDelta(t,n,e){let r=e.seq,s;try{s=await this.post(`/${a(t)}/runs/${a(n)}/deltas`,e)}catch(d){return{kind:"transient",seq:r,reason:d instanceof Error?d.message:String(d)}}let{json:i,text:l}=await m(s);if(s.ok)return{kind:"committed",seq:r,body:i};let p=typeof i?.code=="string"?i.code:`HTTP_${s.status}`,c=_(i,l,s.status);return s.status>=500||R.has(s.status)?{kind:"transient",seq:r,reason:c}:b.has(s.status)&&!h.has(p)?{kind:"refused",seq:r,status:s.status,code:p,reason:c}:{kind:"fatal",seq:r,status:s.status,code:p,reason:c}}async call(t,n){let e=await this.post(t,n),{json:r,text:s}=await m(e);if(!e.ok){let i=typeof r?.code=="string"?r.code:`HTTP_${e.status}`;throw new g(e.status,i,`POST /exploration${t} failed: ${_(r,s,e.status)}`,r)}return r??{}}async jsonRequest(t,n,e){let r=await this.post(n,e,t),{json:s,text:i}=await m(r);if(!r.ok){let l=typeof s?.code=="string"?s.code:`HTTP_${r.status}`;throw new g(r.status,l,`${t} /exploration${n} failed: ${_(s,i,r.status)}`,s)}return s??{}}async post(t,n,e="POST"){let r=new AbortController,s=setTimeout(()=>r.abort(),this.timeoutMs);try{return await w(`${this.base}${t}`,{method:e,headers:{Authorization:this.authHeader,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(n),signal:r.signal})}catch(i){throw i instanceof Error&&i.name==="AbortError"?new Error(`${e} /exploration${t} timed out after ${this.timeoutMs}ms`):i}finally{clearTimeout(s)}}};function k(o,t){let n=t.run&&typeof t.run=="object"?t.run:{},e=u(t.run_id)??u(n.run_id)??u(n.id);if(!e)throw new g(0,"BAD_RESPONSE","start run: response carries no run_id");let r=t.projection&&typeof t.projection=="object"?t.projection:{},s={...r,exploration_id:u(r.exploration_id)??o},i=x(s.last_seq)??x(n.high_water_mark)??x(t.high_water_mark)??0;s.last_seq=i;let l=x(t.next_seq)??i+1,p=x(t.version),c=u(t.wire_version),d=u(t.live_token);return{run_id:e,projection:s,next_seq:l,...p!==void 0?{version:p}:{},...c?{wire_version:c}:{},...d?{live_token:d}:{}}}function a(o){return encodeURIComponent(o)}function u(o){return typeof o=="string"&&o?o:void 0}function x(o){return typeof o=="number"&&Number.isFinite(o)?o:void 0}async function m(o){let t="";try{t=await o.text()}catch{}try{let n=t?JSON.parse(t):null;return{json:n&&typeof n=="object"?n:null,text:t}}catch{return{json:null,text:t}}}function _(o,t,n){if(!o)return`${n} ${t.slice(0,500)}`.trim();let e=[],r=u(o.error)??u(o.message);return e.push(r?`${u(o.code)??n}: ${r}`:`${u(o.code)??n}`),(o.expected!==void 0||o.received!==void 0)&&e.push(`expected seq ${String(o.expected)}, received ${String(o.received)}`),Array.isArray(o.problems)&&o.problems.length&&e.push(`problems: ${o.problems.map(String).join("; ")}`),e.join(" \u2014 ")}export{g as a,y as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{appendFileSync as r,mkdirSync as t}from"fs";import{homedir as c}from"os";import{dirname as s,join as a}from"path";function u(i,e){let n=/^(DOCX_[A-Z_]+):/.exec(e)?.[1];n&&o(`${n} ${i}`)}function d(i,e){o(`review ${i} ${e}`)}function o(i){try{let e=process.env.KANE_CONTEXT_REFUSAL_LOG??a(c(),".testmuai","kaneai","context-refusals.log");t(s(e),{recursive:!0}),r(e,`${new Date().toISOString()} ${i}
|
|
3
|
+
`)}catch{}}export{u as a,d as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as Ye}from"./chunk-V7USCQWO.js";import{b as Ve}from"./chunk-CGITGJ3I.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{c as We}from"./chunk-SMXABALN.js";import{a as be}from"./chunk-ICLUC44J.js";import{a as Ge}from"./chunk-LUR7JFPP.js";import{a as He}from"./chunk-C2RUDJ46.js";import{a as re}from"./chunk-HCBYKLMW.js";import{a as h,b as f,h as Fe,i as Se,k as Ne}from"./chunk-33DWJV67.js";import{a as we}from"./chunk-6YGTRKDT.js";import{b as Le,y as u}from"./chunk-D36V5OX6.js";import{e as $}from"./chunk-UR6MHSHU.js";var je=$(we(),1);import{readFileSync as ct,writeFileSync as ut,mkdirSync as ft}from"fs";import{dirname as dt,join as ze}from"path";var mt=ze(Le,"command-history.json"),Dt=ze(Le,"generate-history.json"),ht=200,De=class{entries;filePath;max;constructor(t=mt,e=ht){this.filePath=t,this.max=e,this.entries=this._load()}push(t){this.entries.length>0&&this.entries[this.entries.length-1]===t||(this.entries.push(t),this.entries.length>this.max&&(this.entries=this.entries.slice(this.entries.length-this.max)),this._save())}getAll(){return[...this.entries]}search(t){let e=t.toLowerCase(),o=[];for(let s=this.entries.length-1;s>=0;s--)this.entries[s].toLowerCase().includes(e)&&o.push(this.entries[s]);return o}_load(){if(this.filePath===null)return[];try{let t=ct(this.filePath,"utf-8"),e=JSON.parse(t);return Array.isArray(e)?e:[]}catch{return[]}}_save(){if(this.filePath!==null)try{ft(dt(this.filePath),{recursive:!0}),ut(this.filePath,JSON.stringify(this.entries)+`
|
|
3
3
|
`)}catch{}}};function kt(n){let t=(0,je.useRef)(null);return t.current||(t.current=new De(n)),t.current}var D=$(we(),1);var ke=$(we(),1);var Z=$(re(),1);function Xe({history:n,onSelect:t,onClose:e}){let[o,s]=(0,ke.useState)(""),[l,m]=(0,ke.useState)(0),v=o?n.search(o).slice(0,8):[];return Se((b,d)=>{if(d.escape){e();return}if(d.return){v.length>0&&v[l]?t(v[l]):e();return}if(d.upArrow){m(S=>Math.max(0,S-1));return}if(d.downArrow){m(S=>Math.min(v.length-1,S+1));return}if(d.backspace||d.delete){s(S=>S.slice(0,-1)),m(0);return}b&&!d.ctrl&&!d.meta&&(s(S=>S+b),m(0))}),(0,Z.jsxs)(h,{flexDirection:"column",marginLeft:2,borderStyle:"single",paddingX:1,children:[(0,Z.jsx)(f,{color:u.muted,bold:!0,children:"reverse search"}),(0,Z.jsxs)(h,{gap:1,children:[(0,Z.jsx)(f,{color:u.dim,children:"search:"}),(0,Z.jsx)(f,{children:o}),(0,Z.jsx)(f,{color:u.orange,children:"\u2588"})]}),v.length>0&&(0,Z.jsx)(f,{children:" "}),v.map((b,d)=>(0,Z.jsx)(h,{marginLeft:2,children:(0,Z.jsxs)(f,{color:d===l?u.orange:u.dim,bold:d===l,children:[d===l?"\u25B8 ":" ",b]})},`${d}-${b}`))]})}var X=$(re(),1);function Je({commands:n,selectedIndex:t}){return n.length===0?null:(0,X.jsx)(h,{flexDirection:"column",marginBottom:0,children:n.map((e,o)=>{let s=o===t;return e.disabled?(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:u.dim,children:["/",e.name]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.disabledReason??e.description]})]},e.name):(0,X.jsxs)(h,{children:[(0,X.jsx)(f,{color:s?u.orange:u.dim,children:s?"\u276F ":" "}),(0,X.jsxs)(f,{color:s?u.orange:void 0,bold:s,children:["/",e.name]}),e.args&&(0,X.jsxs)(f,{color:u.dim,children:[" ",e.args]}),(0,X.jsxs)(f,{color:u.dim,children:[" ",e.description]})]},e.name)})})}var Ze=$(we(),1);var q=$(re(),1),et={scenario:"Scenarios",case:"Test Cases",file:"Files",artifact:"Artifact candidates",installed:"Installed on device"};function Qe(n){let t={scenario:0,case:0,file:0,artifact:0,installed:0};for(let e of n)t[e.kind]++;return["scenario","case","file","artifact","installed"].filter(e=>t[e]>0).map(e=>`${t[e]} ${et[e]}`).join(" \xB7 ")}var Pe=7;function tt({items:n,selectedIndex:t,accent:e=u.orange}){let o=n.length;if(o===0)return null;let s=Math.floor(Pe/2),l=o<=Pe?0:Math.max(0,Math.min(t-s,o-Pe)),m=Math.min(o,l+Pe),v=l,b=o-m;return(0,q.jsxs)(h,{flexDirection:"column",marginBottom:0,children:[v>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${v} above \u2014 ${Qe(n.slice(0,l))}`})}),n.slice(l,m).map((d,S)=>{let U=l+S,F=d.selectable!==!1,E=U===t&&F,R=S===0||n[U-1].kind!==d.kind;return(0,q.jsxs)(Ze.default.Fragment,{children:[R&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:et[d.kind]})}),(0,q.jsxs)(h,{children:[(0,q.jsx)(f,{color:E?e:u.dim,children:E?"\u276F ":" "}),(0,q.jsxs)(f,{color:E?e:F?void 0:u.dim,bold:E,children:[d.label,d.reason?` \u2014 ${d.reason}`:""]})]})]},`${d.kind}:${d.value}:${U}`)}),b>0&&(0,q.jsx)(h,{children:(0,q.jsx)(f,{color:u.dim,children:` \u22EF ${b} more \u2014 ${Qe(n.slice(m))}`})})]})}var Be=$(we(),1);var gt=27,pt=127,xt=11;function bt(n){return n>=64&&n<=126}function Tt(n,t){n===xt&&t({killToEnd:!0,ctrl:!0,raw:String.fromCharCode(n)})}function vt(n,t){n===pt&&t({backspace:!0,meta:!0,raw:"\x1B\x7F"})}function wt(n,t){let e=n.map(s=>String.fromCharCode(s)).join(""),o=/^\[1;([0-9]+)([A-D])$/.exec(e);if(o){let s=parseInt(o[1],10),l=o[2],m={raw:"\x1B"+e};if(s===2)m.shift=!0;else if(s===3)m.meta=!0;else if(s===5)m.ctrl=!0;else return;l==="A"?m.arrowUp=!0:l==="B"?m.arrowDown=!0:l==="C"?m.arrowRight=!0:l==="D"&&(m.arrowLeft=!0),t(m);return}if(e==="[H"||e==="[1~"||e==="[7~"){t({home:!0,raw:"\x1B"+e});return}if(e==="[F"||e==="[4~"||e==="[8~"){t({end:!0,raw:"\x1B"+e});return}if(e==="[3;5~"){t({delete:!0,ctrl:!0,raw:"\x1B"+e});return}if(e==="[3;3~"){t({delete:!0,meta:!0,raw:"\x1B"+e});return}}function St(n,t){n===72?t({home:!0,raw:"\x1BO"+String.fromCharCode(n)}):n===70&&t({end:!0,raw:"\x1BO"+String.fromCharCode(n)})}function Et(){let n="IDLE",t=[];function e(){n="IDLE",t=[]}return{feed(o,s){for(let l of o)n==="IDLE"?l===gt?(n="ESC",t=[]):Tt(l,s):n==="ESC"?l===91?(n="CSI",t=[]):l===79?(n="SS3",t=[]):(vt(l,s),e()):n==="CSI"?(t.push(l),bt(l)&&(wt([91,...t],s),e())):n==="SS3"&&(St(l,s),e())},flushIdle(o){n==="ESC"&&t.length===0&&o({raw:"\x1B"}),e()}}}function nt(n,t={}){let e=(0,Be.useRef)(n);e.current=n;let{stdin:o}=Fe();(0,Be.useEffect)(()=>{if(t.isActive===!1||!o)return;let s=Et(),l=null,m=v=>{l&&(clearTimeout(l),l=null);let b=Buffer.isBuffer(v)?v:Buffer.from(v,"binary");s.feed(b,d=>e.current(d)),l=setTimeout(()=>{s.flushIdle(d=>e.current(d)),l=null},50)};return o.on("data",m),()=>{o.removeListener("data",m),l&&clearTimeout(l)}},[t.isActive,o])}var w=$(re(),1);function yt(n,t){let e=t-1;for(;e>=0&&n[e]!=="@"&&n[e]!==" "&&n[e]!==`
|
|
4
4
|
`;)e--;return e<0||n[e]!=="@"||e>0&&n[e-1]!==" "&&n[e-1]!==`
|
|
5
5
|
`?null:{at:e,query:n.slice(e+1,t).join("")}}function rt(n,t,e){for(let o=t+e;o>=0&&o<n.length;o+=e)if(n[o]?.selectable!==!1)return o;return t}function At(n){let t=n.findIndex(e=>e.selectable!==!1);return t===-1?0:t}var Oe=10;function Rt(n){return n.replace(/\x1b?\[200~/g,"").replace(/\x1b?\[201~/g,"").replace(/\r\n/g,`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var l="assurance/context@1";var u={source:{hashed:["blob","source_id"],required:["blob","source_id"],enums:{}},usecase:{hashed:["actors","criteria","derived","description","risk","summary","title","value"],required:["derived","risk","title"],enums:{risk:["high","med","low"]}},scenario:{hashed:["case_type","derived","description","intent","parameters","tags","technique_notes","title"],required:["case_type","derived","intent","title"],enums:{case_type:["happy","negative","boundary","edge","security","a11y","perf","i18n"]}},ac:{hashed:["derived","expected_answer","kind","measurable","risk","text"],required:["derived","risk","text"],enums:{risk:["high","med","low"],kind:["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"]}},test:{hashed:["app","check","config","definitionId","derived","objectives_blob","surface_required","target","test_md_blob","title"],required:["definitionId","derived","title"],enums:{}},gap:{hashed:["basis","derived","kind","question","ref","risk","risk_rationale","text","uc"],unhashed:["proposal_id","temp_ref"],required:["derived","kind"],enums:{kind:["ambiguous","incomplete","contradictory","unmeasurable","missing-expected-result","budget-evicted","invariant-unexercised","reconcile_deferred"],risk:["high","med","low"]}},stylenote:{hashed:["derived","learned_from_kind","statement","tags","text"],unhashed:["learned_from"],required:["derived","learned_from_kind","statement"],enums:{learned_from_kind:["edit","directed-edit","mistake","usage"]}}},f={DERIVES:{src:["source"],dst:["usecase","ac","scenario","test"],salient:["anchor","source_cid","source_id"],optionalSalient:["claim","reconfirms"],props:["anchor","claim","quote","reconfirms","source_cid","source_id","units"],pin:{comparesTo:"source_head"},cardinality:"many",acyclic:!1},belongs_to:{src:["scenario"],dst:["usecase"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src",acyclic:!1},scoped_to:{src:["ac"],dst:["scenario","usecase"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src",acyclic:!1},exercises:{src:["scenario"],dst:["ac"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1},verifies:{src:["test"],dst:["ac"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1},automates:{src:["test"],dst:["scenario"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"one-live-per-src-and-dst",acyclic:!1},depends_on:{src:["usecase","scenario"],dst:["usecase","scenario"],salient:[],props:["reason"],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!0},reuses:{src:["test"],dst:["test"],salient:[],props:[],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!0},annotates:{src:["gap","stylenote"],dst:["source","usecase","scenario","ac","test"],salient:[],props:["reason"],pin:{comparesTo:"dst_tip"},cardinality:"many",acyclic:!1}},g=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];var E={presence:{operators:["exists","forall"],baseline:"null",requires:[]},"forbidden-presence":{operators:["exists","forall"],baseline:"null",requires:[]},count:{operators:["equals","gte","lte"],baseline:"null",requires:[],operand_forms:["literal","derived"]},delta:{operators:["changed-by"],baseline:"required",requires:[]},"state-transition":{operators:["changed-by","equals"],baseline:"required",requires:[]},absolute:{operators:["equals","contains","gte","lte"],baseline:"null",requires:[]},bound:{operators:["gte","lte"],baseline:"null",requires:[]},propagation:{operators:["exists","equals"],baseline:"null",requires:[]},latency:{operators:["lte"],baseline:"null",requires:["within"]},graded:{operators:["gte"],baseline:"null",requires:["metric","threshold"]}};function y(s){let n=/^design@(\d+)$/.exec(s??"");return n?Number(n[1]):0}var h=new Set(["unmeasurable","budget-evicted"]),m=Object.freeze({SOURCE:"source",USECASE:"usecase",SCENARIO:"scenario",AC:"ac",TEST:"test",GAP:"gap",STYLENOTE:"stylenote"}),S=Object.freeze({DERIVES:"DERIVES",BELONGS_TO:"belongs_to",SCOPED_TO:"scoped_to",EXERCISES:"exercises",VERIFIES:"verifies",AUTOMATES:"automates",DEPENDS_ON:"depends_on",REUSES:"reuses",ANNOTATES:"annotates"});function c(s,n,t){let r=[],e=E[s];if(!e)return r.push({code:"BAD_CHECK",detail:`${t}.kind ${JSON.stringify(s)} not in ${g.join("|")}`}),r;let o=n.operator;o!==void 0&&!e.operators.includes(o)&&r.push({code:"BAD_CHECK",detail:`${t}: operator ${JSON.stringify(o)} illegal for kind "${String(s)}" (legal: ${e.operators.join("|")})`});for(let a of e.requires)(n[a]===void 0||n[a]===null||n[a]==="")&&r.push({code:"BAD_CHECK",detail:`${t}: kind "${String(s)}" requires "${a}"`});e.baseline==="null"&&n.baseline!==void 0&&n.baseline!==null&&r.push({code:"BAD_CHECK",detail:`${t}: kind "${String(s)}" must carry baseline null (only delta/state-transition have one)`});let i=n.operand;if(i!==null&&typeof i=="object"&&!Array.isArray(i)){let a=Object.keys(i),d=i.derived;(!(e.operand_forms?.includes("derived")??!1)||a.length!==1||a[0]!=="derived"||typeof d!="string"||!d.trim())&&r.push({code:"BAD_CHECK",detail:`${t}: object operand is only the count derivation form {derived: "<how the runtime value is computed>"}`})}return r}function k(s,n){let t=u[s];if(!t)return[{code:"UNKNOWN_LABEL",detail:`unknown node label ${JSON.stringify(s)}`}];let r=[];for(let e of Object.keys(n))n[e]!==void 0&&!t.hashed.includes(e)&&!(t.unhashed??[]).includes(e)&&r.push({code:"UNKNOWN_FIELD",detail:`${s}.${e} is not in the ${l} schema`});for(let e of t.required)(n[e]===void 0||n[e]===null)&&r.push({code:"MISSING_FIELD",detail:`${s}.${e} is required`});for(let[e,o]of Object.entries(t.enums)){let i=n[e];i!==void 0&&!o.includes(i)&&r.push({code:"BAD_ENUM",detail:`${s}.${e} ${JSON.stringify(i)} not in ${o.join("|")}`})}if(s==="test"&&n.check&&typeof n.check=="object"){let e=n.check;r.push(...c(e.kind,e,"test.check"))}if(s==="ac"&&n.expected_answer&&typeof n.expected_answer=="object"){let e=n.expected_answer;r.push(...c(n.kind??e.kind,e,"ac.expected_answer"))}return r}function p(s){return f[s]}function N(s,n,t,r){let e=p(s);if(!e)return[{code:"UNKNOWN_EDGE_TYPE",detail:`unknown edge type ${JSON.stringify(s)}`}];let o=[];e.src.includes(n)||o.push({code:"ILLEGAL_EDGE",detail:`${s} src must be ${e.src.join("|")}, got ${n}`}),e.dst.includes(t)||o.push({code:"ILLEGAL_EDGE",detail:`${s} dst must be ${e.dst.join("|")}, got ${t}`}),s==="depends_on"&&n!==t&&o.push({code:"ILLEGAL_EDGE",detail:`depends_on links same-label nodes only, got ${n}\u2192${t}`});for(let i of e.salient)(r[i]===void 0||r[i]===null)&&o.push({code:"MISSING_SALIENT",detail:`${s}.props.${i} is salient (inside the ecid) and required`});for(let i of Object.keys(r))r[i]!==void 0&&(e.props.includes(i)||o.push({code:"UNKNOWN_EDGE_PROP",detail:`${s}.props.${i} is not in the ${l} schema`}));return o}function b(s,n){let t=u[s];if(!t)return n;let r={};for(let e of t.hashed)n[e]!==void 0&&(r[e]=n[e]);return r}function O(s,n){let t=p(s);if(!t)return n;let r={};for(let e of t.salient)n[e]!==void 0&&(r[e]=n[e]);for(let e of t.optionalSalient??[])n[e]!==void 0&&!(Array.isArray(n[e])&&n[e].length===0)&&(r[e]=n[e]);return r}export{l as a,u as b,f as c,y as d,h as e,m as f,S as g,k as h,p as i,N as j,b as k,O as l};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{b as f,c as j}from"./chunk-VE3SUJMA.js";import{d as g}from"./chunk-C6HI6Y3S.js";import{a as m}from"./chunk-C2RUDJ46.js";var _="KaneAI Generated",E="Untitled";async function p(e){let r=e.config.load(),d=new g(m(e.env).tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key),n=e.projectName??_,o=e.folderName??E,t=r.project_id??null,s=r.project_name??null;if(!t){let a=(await d.listProjects()).find(l=>l.name===n);if(a)t=a.project_id,s=a.name,e.log("info","ENSURE_PROJECT_FOUND","Found default project",{project_id:t,name:s});else{let l=await d.createProject(n);t=l.id,s=l.name,e.log("info","ENSURE_PROJECT_CREATED","Created default project",{project_id:t,name:s})}f(e.creds,e.config,e.profile,e.env,{projectId:t,projectName:s})}let c=r.folder_id??null,i=r.folder_name??null,u=!r.project_id;if(!c||u){let a=(await d.listFolders(t)).find(l=>l.name===o);if(a)c=a.id,i=a.name,e.log("info","ENSURE_FOLDER_FOUND","Found default folder",{folder_id:c,name:i});else{let l=await d.createFolder(t,o);c=l.id,i=l.name,e.log("info","ENSURE_FOLDER_CREATED","Created default folder",{folder_id:c,name:i})}f(e.creds,e.config,e.profile,e.env,{folderId:c,folderName:i})}return{projectId:t,projectName:s??n,folderId:c,folderName:i??o}}function A(e,r,d){let n=e.loadProfileConfig(r,d)??{};return{projectId:n.project_id??null,folderId:n.folder_id??null}}function N(e,r){return e.projectId===null||e.folderId===null||r===null?"needs-picker":r.project==="ok"&&r.folder==="ok"?"ok":r.project==="error"&&r.folder==="error"?"ok-tms-degraded":"needs-picker"}var k=(e,r)=>`error: profile "${e}" (${r}) has no project/folder configured AND no TMS credentials were available to auto-configure one.
|
|
3
3
|
|
|
4
4
|
discover IDs:
|
|
5
5
|
kane-cli projects list --search "<keyword>" --limit 10
|
|
@@ -14,4 +14,4 @@ set them:
|
|
|
14
14
|
kane-cli config folder <folder-id>
|
|
15
15
|
`;function C(e,r){return k(e,r)}function D(e){return`info: auto-configured project "${e.projectName}" (${e.projectId}) and folder "${e.folderName}" (${e.folderId}). Change with: kane-cli config project <id> / kane-cli config folder <id>.`}function S(e){return`${JSON.stringify(T(e))}
|
|
16
16
|
`}function T(e){return{type:"project_folder_auto_defaulted",project_id:e.projectId,project_name:e.projectName,folder_id:e.folderId,folder_name:e.folderName}}async function x(e){if(e.isLocal)return e.log("info","GATE_SKIP_LOCAL","Gate skipped (--local)",{}),{status:"skip",reason:"local"};j(e.creds,e.config,e.profile,e.env,e.log);let r=A(e.creds,e.profile,e.env),d=null;if(r.projectId!==null){let o=m(e.env);d=await new g(o.tmsBaseUrl,e.tmsCreds.username,e.tmsCreds.access_key).validateProjectFolder(r.projectId,r.folderId??""),e.log("info","GATE_VALIDATE","TMS project/folder validation",{project:d.project,folder:d.folder,folder_was_cached:r.folderId!==null})}else r.folderId!==null&&(f(e.creds,e.config,e.profile,e.env,{folderId:null,folderName:null}),e.log("warn","GATE_CLEARED_ORPHAN_FOLDER","Cleared orphan folder (no project cached)",{folder_id:r.folderId}),r.folderId=null);let n=N(r,d);if(n==="ok")return{status:"ok",projectId:r.projectId,folderId:r.folderId};if(n==="ok-tms-degraded")return e.log("warn","GATE_TMS_DEGRADED","TMS validation failed; using cached IDs",{project_id:r.projectId,folder_id:r.folderId}),{status:"ok",projectId:r.projectId,folderId:r.folderId};if(d){let o={};d.project==="missing"?(o.projectId=null,o.projectName=null,o.folderId=null,o.folderName=null):d.folder==="missing"&&(o.folderId=null,o.folderName=null),Object.keys(o).length>0&&(f(e.creds,e.config,e.profile,e.env,o),e.log("info","GATE_CLEARED_STALE","Cleared stale cached IDs before re-resolve",{project_cleared:d.project==="missing",folder_cleared:d.folder==="missing"||d.project==="missing"}))}try{let o=await p({creds:e.creds,config:e.config,profile:e.profile,env:e.env,tmsCreds:e.tmsCreds,log:e.log}),t={projectId:o.projectId,projectName:o.projectName,folderId:o.folderId,folderName:o.folderName};return e.log("info","GATE_AUTO_DEFAULTED","Auto-configured project/folder",{project_id:t.projectId,project_name:t.projectName,folder_id:t.folderId,folder_name:t.folderName}),e.onAnnounce?e.onAnnounce(t):process.stderr.write(`${D(t)}
|
|
17
|
-
`),{status:"ok",projectId:t.projectId,folderId:t.folderId,autoDefaulted:t}}catch(o){let t=C(e.profile,e.env);if(e.log("error","GATE_FATAL","Auto-default failed",{profile:e.profile,env:e.env,cached_project_id:r.projectId,cached_folder_id:r.folderId,validation:d,error:o instanceof Error?o.message:String(o)}),e.onFatalExit)e.onFatalExit(t);else{process.stderr.write(t);let{shutdown:s}=await import("./exit-manager-
|
|
17
|
+
`),{status:"ok",projectId:t.projectId,folderId:t.folderId,autoDefaulted:t}}catch(o){let t=C(e.profile,e.env);if(e.log("error","GATE_FATAL","Auto-default failed",{profile:e.profile,env:e.env,cached_project_id:r.projectId,cached_folder_id:r.folderId,validation:d,error:o instanceof Error?o.message:String(o)}),e.onFatalExit)e.onFatalExit(t);else{process.stderr.write(t);let{shutdown:s}=await import("./exit-manager-EDHCETUN.js");s(2,"Project/folder gate failed")}return{status:"cancelled"}}}export{p as a,A as b,N as c,C as d,D as e,S as f,T as g,x as h};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as h,b as x,c as O}from"./chunk-3AGP2BVN.js";import{oa as B}from"./chunk-UEE3RZN4.js";import{a as S}from"./chunk-HCBYKLMW.js";import{b as i}from"./chunk-33DWJV67.js";import{a as w}from"./chunk-FOJHSG5M.js";import{y as s}from"./chunk-D36V5OX6.js";import{e as L}from"./chunk-UR6MHSHU.js";var e=L(S(),1),W={high:0,med:1,low:2},E={high:s.red,med:"yellow",low:s.dim};function j(d){return d.map((n,o)=>({r:n,i:o})).sort((n,o)=>(W[n.r.risk??"zz"]??3)-(W[o.r.risk??"zz"]??3)||n.i-o.i).map(({r:n})=>n)}function z(d,n=120,o="risk"){if(d.length===0)return null;let a=j(d),l=t=>t.held?"(held)":t.staged||!t.id?"(staged)":B(t.id),p=Math.max(2,...a.map(t=>l(t).length)),g=o!==null,r=o!==null?Math.max(o.length,...a.map(t=>(t.badge??"").length)):0,m=n>=84&&a.some(t=>t.summary),c=2+(g?1:0)+(m?1:0),u=c+1+c*2,b=n-u-p-r,k=Math.max(...a.map(t=>Math.max(t.title.length,(t.marker??"").length)),5),f=Math.max(5,m?Math.min(k,Math.max(16,Math.floor(b*.5))):Math.min(k,b)),T=m?Math.max(7,b-f):0,R=(t,$,M,I)=>O(t,$,M,I.map(A=>A.length)),C=(t,$,M,I)=>[x(h(t,p),p),x(h($,f),f),...g?[x(h(M,r),r)]:[],...m?[x(h(I,T),T)]:[]],y=C("id","title",o??"","summary");return{showBadge:g,showSummary:m,headerCells:y,top:R("\u250C","\u252C","\u2510",y),middle:R("\u251C","\u253C","\u2524",y),bottom:R("\u2514","\u2534","\u2518",y),rows:a.map(t=>({cells:C(l(t),h(t.title,f),h(t.badge??"",r),h(t.summary??"",T)),badgeColor:t.badgeColor??E[t.badge??""]??s.dim,...t.marker?{markerCells:C("",h(t.marker,f),"","")}:{}}))}}function K(d,n){let o=z(d,n.width,n.badgeHeader===void 0?"risk":n.badgeHeader);if(o===null)return[];let a=(r,m)=>n.color?D(r,m):m,l=r=>a(s.dim,r),p=r=>n.color?w.bold(r):r,g=[l(o.top),`${l("\u2502 ")}${o.headerCells.map(p).join(l(" \u2502 "))}${l(" \u2502")}`,l(o.middle)];for(let r of o.rows){let[m,c,...u]=r.cells,b=o.showBadge?[a(r.badgeColor,u[0])]:[],k=o.showSummary?[u[o.showBadge?1:0]]:[];g.push(`${l("\u2502 ")}${a(s.assuranceAccent,m)}${l(" \u2502 ")}${[c,...b,...k].join(l(" \u2502 "))}${l(" \u2502")}`),r.markerCells&&g.push(l(`\u2502 ${r.markerCells.join(" \u2502 ")} \u2502`))}return g.push(l(o.bottom)),g}function D(d,n){if(d.startsWith("#"))return w.hex(d)(n);let o=w[d];return typeof o=="function"?o(n):n}function v({rows:d,width:n=120,badgeHeader:o="risk"}){let a=z(d,n,o);if(a===null)return null;let{showBadge:l,showSummary:p,headerCells:g}=a,r=[];r.push((0,e.jsx)(i,{color:s.dim,children:a.top},"t")),r.push((0,e.jsxs)(i,{children:[g.map((m,c)=>(0,e.jsxs)(i,{children:[(0,e.jsx)(i,{color:s.dim,children:c===0?"\u2502 ":" \u2502 "}),(0,e.jsx)(i,{bold:!0,children:m})]},c)),(0,e.jsx)(i,{color:s.dim,children:" \u2502"})]},"h")),r.push((0,e.jsx)(i,{color:s.dim,children:a.middle},"m"));for(let[m,c]of a.rows.entries()){let u=c.cells;r.push((0,e.jsxs)(i,{children:[(0,e.jsx)(i,{color:s.dim,children:"\u2502 "}),(0,e.jsx)(i,{color:s.assuranceAccent,children:u[0]}),(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),u[1],l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),(0,e.jsx)(i,{color:c.badgeColor,children:u[2]})]}):null,p?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),u[l?3:2]]}):null,(0,e.jsx)(i,{color:s.dim,children:" \u2502"})]},`r-${m}`)),c.markerCells&&r.push((0,e.jsx)(i,{color:s.dim,children:`\u2502 ${c.markerCells.join(" \u2502 ")} \u2502`},`mk-${m}`))}return r.push((0,e.jsx)(i,{color:s.dim,children:a.bottom},"b")),(0,e.jsx)(e.Fragment,{children:r})}export{K as a,v as b};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as g,d as u}from"./chunk-Y7E5L42F.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
|
+
|
|
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
|
+
`),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(`
|
|
6
|
+
`)),d=Object.entries(m).filter(([,i])=>i.secret).map(([i])=>i);return{prompt:s,deps:l,variables:m,secretNames:d}}export{h as a,y as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as l}from"./chunk-HAW5WEKT.js";import{M as f,sb as m}from"./chunk-UEE3RZN4.js";import{f as a,g as u}from"./chunk-KU3YHPWZ.js";function O(e){let i=f(e),s=new Set;for(let{cid:t}of i.byLabel(a.USECASE)){if(i.superseded.has(t)||i.trust.get(t)==="archived")continue;let o=i.displayNameOf(t);o&&s.add(o)}return s}function g(e,i){let s=f(e),t=[];for(let{cid:o,content:r}of s.byLabel(a.USECASE)){if(s.superseded.has(o)||s.trust.get(o)==="archived")continue;let d=s.displayNameOf(o);if(!d||i.has(d))continue;let n=new Set;for(let c of s.derivesInto(o)){let p=s.getNode(c.src)?.content.source_id;typeof p=="string"&&n.add(p)}t.push({id:d,title:String(r.title??""),source_ids:[...n].sort()})}return t.sort((o,r)=>o.id.localeCompare(r.id,void 0,{numeric:!0}))}function U(e,i,s){let t=f(e),r=g(e,s).filter(n=>n.source_ids.includes(i)).map(n=>({id:n.id,state:"new",units_moved:[]})),d=new Set(r.map(n=>n.id));for(let n of l(e,i)){let c=t.displayNameOf(n);!c||d.has(c)||r.push({id:c,state:"stale",units_moved:m(t,n,i)?.changed??[]})}return r.sort((n,c)=>n.id.localeCompare(c.id,void 0,{numeric:!0}))}function b(e){let i=t=>!e.superseded.has(t)&&e.trust.get(t)!=="archived",s=new Set;for(let{cid:t}of e.byLabel(a.TEST))if(i(t))for(let o of e.edgesFrom(t)){if(o.type!==u.AUTOMATES||e.superseded.has(o.ecid))continue;let r=e.tipOf(o.dst);if(i(r))for(let d of e.edgesFrom(r))d.type!==u.BELONGS_TO||e.superseded.has(d.ecid)||s.add(e.tipOf(d.dst))}return s}export{O as a,g as b,U as c,b as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-5Y2G4NC7.js";import{
|
|
2
|
+
import{a}from"./chunk-5Y2G4NC7.js";import{a as n}from"./chunk-HCBYKLMW.js";import{b as o}from"./chunk-33DWJV67.js";import{a as s}from"./chunk-6YGTRKDT.js";import{y as t}from"./chunk-D36V5OX6.js";import{e as r}from"./chunk-UR6MHSHU.js";var l=r(s(),1);var m=r(n(),1),i=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function b({active:e=!0}){let[p,c]=(0,l.useState)(0);return a(()=>{c(f=>(f+1)%i.length)},e?80:null),(0,m.jsx)(o,{color:t.orange,children:e?i[p]:"\u25CF"})}export{b as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as ae}from"./chunk-I6S6DZ2E.js";import{a as X,c as oe}from"./chunk-W7FLXW6Q.js";import{a as ie,b as W,c as B,d as F,e as V,f as M,g as J,h as S}from"./chunk-R4JUKTDO.js";import{a as re}from"./chunk-HD6NR44L.js";import{M as L,R as ne,S as se,xb as P}from"./chunk-UEE3RZN4.js";import{f as k,g as q}from"./chunk-KU3YHPWZ.js";import{d as Q,m as $}from"./chunk-4I7YN6YY.js";function I(e,t){(e.err??e.out)(`error: ${t}`)}function Y(e,t){let n=e.nameOf.get(t);if(n)return n;for(let[i,r]of e.names)if(e.tipOf(r)===t)return i;return t}function fe(e,t){return{ucTip:t,display:Y(e,t),seamRef:e.nameOf.get(t)??t}}function ye(e,t){let n=e.resolve(t);if(!n)return{ok:!1,message:`unknown ref '${t}' \u2014 no test/scenario/ac/use-case by that id or cid`};let i=n.tip,r=e.nodeLabel.get(i);if(!r||!W.has(r))return{ok:!1,message:`'${t}' is a ${r??"missing node"} \u2014 evolve takes a test, scenario, acceptance criterion, or use-case`};let o=F(e,i,r);return!o||e.nodeLabel.get(o)!==k.USECASE?{ok:!1,message:`cannot resolve '${t}' to a parent use-case \u2014 its ${r} chain is broken`}:e.superseded.has(o)?{ok:!1,message:`use-case ${Y(e,o)} was removed \u2014 nothing to evolve`}:e.trust.get(o)==="archived"?{ok:!1,message:`use-case ${Y(e,o)} was archived \u2014 nothing to evolve`}:{ok:!0,target:fe(e,o)}}function We(e,t){return j(e,t)}function j(e,t){let n=[];for(let{cid:r}of e.byLabel(k.SCENARIO)){if(!B(e,r)||!e.edgesFrom(r).some(s=>s.type===q.BELONGS_TO&&e.tipOf(s.dst)===t))continue;let o=e.edgesInto(r).filter(s=>s.type===q.AUTOMATES&&B(e,s.src));if(o.length===0)n.push({scenario:r,test:null});else for(let s of o)n.push({scenario:r,test:s.src})}let i=new Map;for(let{cid:r}of e.byLabel(k.AC)){if(!B(e,r)||F(e,r,k.AC)!==t)continue;let o=e.edgesInto(r).filter(s=>s.type===q.VERIFIES&&B(e,s.src)).map(s=>s.src).sort();i.set(r,o)}return{pairs:n,verifies:i}}function be(e,t){let n=s=>`${s.scenario}\0${s.test??""}`,i=new Set(e.pairs.map(n)),r=new Set(t.pairs.map(n)),o=[];for(let[s,a]of e.verifies){let l=t.verifies.get(s);l&&(a.length===l.length&&a.every((d,_)=>d===l[_])||o.push({ac:s,before:a,after:l}))}return{superseded:e.pairs.filter(s=>!r.has(n(s))),minted:t.pairs.filter(s=>!i.has(n(s))),retained:t.pairs.filter(s=>i.has(n(s))),moves:o}}function we(e,t,n,i,r){let o=a=>t.nameOf.get(a)??a,s=a=>` - ${o(a.scenario)} \xB7 ${a.test?o(a.test):"(no test)"}`;e.out(`evolved: use-case ${n} \u2014 design record ${i.before} \u2192 ${i.after}`),e.out(` superseded ${r.superseded.length} pair(s)`);for(let a of r.superseded)e.out(s(a));e.out(` minted ${r.minted.length} pair(s)`);for(let a of r.minted)e.out(s(a));e.out(` retained ${r.retained.length} pair(s)`);for(let a of r.retained)e.out(s(a));if(r.moves.length===0)e.out(" verifies none moved");else{e.out(" verifies moved:");for(let a of r.moves){let l=d=>d.length>0?d.map(o).join(" + "):"(none)";e.out(` - ${o(a.ac)}: ${l(a.before)} \u2192 ${l(a.after)}`)}}}async function ge(e,t,n,i,r,o,s,a){let l=L(e),d=S(l,t.ucTip);if(!d)return o==="batch"?(i.out($().text("note.no_design_skipped",{use_case:t.display})),a?.({type:"evolve_skipped",use_case:t.display,reason:"no-design"}),{code:0,outcome:"no-design"}):(I(i,$().text("note.no_design",{use_case:t.display})),{code:2,outcome:"no-design"});let _=j(l,t.ucTip),v=[`evolve ${t.display}`,` re-designs use-case ${t.display}`,` affects ${_.pairs.length} pair(s)`,...n.because?[` because ${n.because}`]:[]];if(n.yes)for(let p of v)i.out(p);else{for(let c of v)i.out(c);let p=n.confirm?await n.confirm():await i.confirm(`proceed with the re-design of ${t.display}?`)?"proceed":"decline";if(p==="defer")return i.out(`deferred: the re-design of ${t.display} waits for an answer \u2014 nothing evolved`),{code:3,outcome:"deferred"};if(p==="decline")return i.out(o==="batch"?`skipped ${t.display}`:"declined \u2014 nothing evolved"),{code:0,outcome:"declined"}}let E=t.named?Ce(t.named):void 0,x=oe(e,l,t.ucTip,n.because,E),R=t.named?Re(l,t.named,t.display,n.because,t.ucTip):void 0,D=!1,O,h=p=>{p.type==="nothing_to_change"&&(D=!0,typeof p.note=="string"&&(O=p.note)),a?.(p)},y=await re(s,{verb:"evolve",subject:t.display},()=>r(t.seamRef,{yes:!!n.yes,...n.mode?{mode:n.mode}:{},...n.because?{because:n.because}:{},...x!==void 0?{changeDelta:x.change_delta,priorDesign:x.prior_design}:{},onChildEvent:h,...R?{statement:R}:{},...n.repin?{repinsKept:!0}:{}}),p=>({ok:p===0,exitCode:p}));if(y===3)return i.out($().text("note.design_paused",{use_case:t.display})),{code:y,outcome:"paused"};if(y!==0)return I(i,`design run for ${t.display} ended with exit code ${y} \u2014 no diff to report`),{code:y,outcome:"failed"};let u=L(e),b=u.tipOf(t.ucTip),w=S(u,b)?.seq,T={before:d.seq,after:w??"?"},A=be(_,j(u,b)),C=n.sourceChanged?{source_changed:n.sourceChanged}:{};if(D&&w===d.seq){let p=n.repin?_e(e,b,n.repin.by,i,t.display):void 0;return i.out(`unchanged: use-case ${t.display} \u2014 the design agent found nothing to change`),a?.({...ue(u,t.display,T,A),nothing_to_change:!0,...O?{note:O}:{},...p?{repinned:p}:{},...C}),ce(i,t.display,n.sourceChanged),{code:0,outcome:"unchanged"}}return we(i,u,t.display,T,A),a?.({...ue(u,t.display,T,A),...C}),ce(i,t.display,n.sourceChanged),{code:0,outcome:"evolved"}}function _e(e,t,n,i,r){let o=ie({store:e,graph:L(e),ucTip:t,by:n});if(o.errors){i.err?.(`the tests of ${r} couldn't be marked up to date: ${o.errors.map(a=>a.detail).join("; ")}`);return}let s=L(e);if(!(o.moved===0||V(s,t)))return{tests:H(s,t).total}}function ce(e,t,n){n&&e.out($().text("note.source_changed_after",{use_case:t,review:z(n)}))}var z=e=>e.next&&e.next.length>0?e.next.map(t=>t.cmd).join(" and "):null;function Ee(e,t){return n=>{let r=L(e).heads.get(n),o=r?[...e.recordsSince(null)].reverse().find(l=>l.source_head_moves?.[n]===r):void 0,s=o?e.tokenAt(o.seq):null,a=s?e.intentOf(s)?.args?.label:void 0;return{cmd:$().command("next.review_source",{source_id:n,from:typeof a=="string"?a:null,agent_mode:t})}}}function $e(e){let t=new Map,n=0;for(let{cid:r,state:o}of e.staleList()){if(o==="superseded")continue;let s=e.nodeLabel.get(r);if(!s||!W.has(s)||!B(e,r)||!P(e,r))continue;let a=F(e,r,s);!a||e.nodeLabel.get(a)!==k.USECASE||!B(e,a)||(n++,t.has(a)||t.set(a,fe(e,a)))}return{targets:[...t.values()].sort((r,o)=>r.display<o.display?-1:r.display>o.display?1:0),staleCount:n}}function xe(e,t,n){let i=e.map(s=>t(s,n)),r=i.flatMap(s=>s.cmd?[{cmd:s.cmd,why:"review its source's change"}]:[]),o=i.flatMap(s=>s.remedy?[s.remedy]:[]).join(`
|
|
3
|
+
`);return{...r.length>0?{next:r}:{},...o?{remedy:o}:{}}}var pe={[k.TEST]:"test",[k.SCENARIO]:"scenario",[k.AC]:"ac",[k.USECASE]:"usecase"},ve={test:"test",scenario:"scenario",ac:"acceptance criterion",usecase:"use-case"},de=120;function Oe(e,t){let n=e.resolve(t);if(!n)return null;let i=pe[e.nodeLabel.get(n.tip)??""];if(!i)return null;let r=e.getNode(n.tip)?.content??{},o=i==="ac"?r.text:r.title,s=typeof o=="string"?o.replace(/[\u0000-\u001f\u007f]+/g," ").trim():"",a=Array.from(s),l=a.length===0?void 0:a.length>de?`${a.slice(0,de-1).join("")}\u2026`:s,d=e.superseded.has(n.tip)?"removed":e.trust.get(n.tip)==="archived"?"archived":void 0;return{ref:e.nameOf.get(n.tip)??e.displayNameOf(n.tip)??t,label:i,...l?{title:l}:{},cid:n.tip,...d?{dead:d}:{}}}function Ce(e){if(!e.dead)return{ref:e.ref,label:e.label,...e.title?{title:e.title}:{}}}function ke(e,t,n){let i=[];for(let{cid:r,state:o}of e.staleList()){if(o==="superseded"||r===n)continue;let s=e.nodeLabel.get(r),a=pe[s??""];if(!s||!a||!B(e,r)||!P(e,r)||F(e,r,s)!==t)continue;let l=X(e,r);if(!l)continue;let d=e.nameOf.get(r)??e.displayNameOf(r)??r;i.push({display:d,text:`${ve[a]} ${d} \u2014 ${l}`})}return i.sort((r,o)=>r.display<o.display?-1:r.display>o.display?1:0),i[0]?.text??null}var Se=`Judge the scope yourself: change what this genuinely affects and leave the rest as designed.
|
|
4
|
+
If it is ambiguous what should change, ask before changing anything.`;function Re(e,t,n,i,r){let o=t.label==="usecase"?"":` in use-case ${n}`,s=[t.title?`"${t.title}"`:"",t.dead?`${t.dead} earlier`:""].filter(Boolean).join(", "),a=`[kane] evolve started on ${ve[t.label]} ${t.ref}${s?` (${s})`:""}${o}.`,l=i?.trim(),d=l||t.dead?void 0:X(e,t.cid),_=l?void 0:d??(r?ke(e,r,t.cid):null),v=l?`Because: ${l}`:_?`Stale: ${_}`:null;return[a,v,Se].filter(E=>E!==null).join(`
|
|
5
|
+
`)}function ue(e,t,n,i){let r=s=>e.nameOf.get(s)??s,o=s=>({scenario:r(s.scenario),test:s.test?r(s.test):null});return{type:"evolve_diff",use_case:t,generation:n,superseded:i.superseded.map(o),minted:i.minted.map(o),retained:i.retained.map(o),moves:i.moves.map(s=>({ac:r(s.ac),before:s.before.map(r),after:s.after.map(r)}))}}function H(e,t){let n=j(e,t).pairs.flatMap(r=>r.test!==null?[{test:r.test,scenario:r.scenario}]:[]);return{touched:n.filter(({test:r,scenario:o})=>P(e,r)||P(e,o)||e.edgesFrom(r).some(s=>s.type===q.VERIFIES&&P(e,s.dst))).length,total:n.length}}async function Ve(e,t,n){let{io:i,asks:r,runDesign:o,emit:s}=n,a=t.because,l=n.onChild??(s?De(s):void 0);i.out(`evolving ${t.ref??"stale use-cases"}: reading the graph\u2026`);let d=L(e),_=t.ref!==void 0?se(d,t.ref):null;if(_!==null)return I(i,_),2;let v=t.ref!==void 0?ne(d,t.ref):void 0,E="given"in r.blast?r.blast:null,x=n.words?.review??Ee(e,t.mode==="agent"),R=(c,f)=>xe(c,x,f),D=c=>{let{sources:f}=M(d,c.ucTip);return f.length>0?R(f,c.ucTip):void 0},O=(c,f)=>n.words?n.words.question(c,H(d,c.ucTip),a,v===void 0):le(c,f,a),h,y,u=[],b=()=>{for(let{target:c,review:f}of u)i.out($().text("note.source_changed_skipped",{use_case:c.display,review:z(f)})),s?.({type:"evolve_skipped",use_case:c.display,reason:"source_changed",...f})};if(v){let c=ye(d,v);if(!c.ok)return I(i,c.message),2;let f=M(d,c.target.ucTip);if(!a&&S(d,c.target.ucTip)&&J(f)){let m=R(f.sources,c.target.ucTip);return I(i,$().text("note.source_changed",{use_case:c.target.display,review:z(m)})),s?.({type:"evolve_skipped",use_case:c.target.display,reason:"source_changed",...m}),2}if(!a&&S(d,c.target.ucTip)&&!V(d,c.target.ucTip)){let m=r.because?await r.because(c.target.display):void 0;if(m!==null&&typeof m=="object")return i.out(`deferred: the reason to re-design ${c.target.display} waits for an answer \u2014 nothing evolved`),s?.({type:"evolve_paused",pending_because:c.target.display}),3;let N=m?.trim();if(!N)return I(i,$().text("note.nothing_changed",{ref:v})),2;a=N}let g=Oe(d,v);h=[{...c.target,ref:v,...g?{named:g}:{}}]}else{let{targets:c,staleCount:f}=$e(d);if(c.length===0){let g=E?Z(E,[]):null;return g?te(i,g):(s?.({type:"evolve_batch",stale_nodes:f,use_cases:0}),i.out("nothing stale \u2014 nothing to evolve"),0)}if(i.out(`from-stale: ${f} stale node(s) \u2192 ${c.length} use-case(s)`),u=c.flatMap(g=>{let m=M(d,g.ucTip);return S(d,g.ucTip)&&J(m)?[{target:g,review:R(m.sources,g.ucTip)}]:[]}),h=c.filter(g=>!u.some(m=>m.target.ucTip===g.ucTip)),y={stale_nodes:f,use_cases:h.length},h.length===0){let g=E?Z(E,[]):null;return g?te(i,g):(b(),s?.({type:"evolve_batch",...y}),0)}}let w={...a?{because:a}:{},...t.mode?{mode:t.mode}:{},...t.yes?{yes:!0}:{},repin:{by:n.by??{kind:"human",id:"operator"}}},T=c=>{a&&e.signals().append({ts:new Date().toISOString(),command:"evolve",id:c,verdict:"gap-resolved-evolve",polarity:"preference",by:n.by??{kind:"human",id:"operator"},target:c,reason:a})};if(E)return Te({store:e,graph:d,ref:v,targets:h,batch:y,opts:w,answered:E,io:i,runDesign:o,onChild:l,emit:s,signal:T,sayLeftOut:b,reviewFor:D,question:(c,f)=>n.words?n.words.question(c,H(d,c.ucTip),w.because,v===void 0):le(c,f,w.because),...n.words?{why:n.words.answerWhy}:{}});let A=r.blast.ask,C=c=>S(d,c.ucTip)?j(d,c.ucTip).pairs.length:0;y&&(b(),s?.({type:"evolve_batch",...y}));let p=[];for(let[c,f]of h.entries()){let g=C(f);S(d,f.ucTip)&&s?.(me(f,g,a));let m=()=>A(O(f,g),f.display),N=D(f),U=await ge(e,f,{...w,confirm:m,...N?{sourceChanged:N}:{}},i,o,v?"single":"batch",l,s);if(U.outcome==="evolved"&&T(v??f.display),U.outcome==="declined"&&s?.({type:"evolve_skipped",use_case:f.display,reason:"declined"}),U.outcome==="deferred"){let he=h.slice(c).filter(K=>S(d,K.ucTip));return s?.({type:"evolve_paused",pending_questions:he.map(K=>O(K,C(K))),deferred:f.display}),ee([...p,3])}if(v)return U.code;p.push(U.code)}return ee(p)}function Z(e,t){if(e.unreadable!==void 0)return e.unreadable;for(let[n,i]of e.given){if(!t.includes(n))return`${n} is not a question this run asks \u2014 addressable: ${t.length>0?t.join(", "):"(none)"}`;if(typeof i=="object")return`'${i.invalid}' is not a choice for ${n} \u2014 use 1 or proceed, 2 or decline`}return null}async function Te(e){let{store:t,graph:n,ref:i,targets:r,batch:o,opts:s,answered:a,io:l,runDesign:d,onChild:_,emit:v,signal:E}=e,x=[],R=[];for(let u of r){if(!S(n,u.ucTip)){if(i)return I(l,$().text("note.no_design",{use_case:u.display})),2;R.push(u);continue}x.push({target:u,pairs:j(n,u.ucTip).pairs.length})}let D=Z(a,x.map(u=>G(u.target)));if(D)return te(l,D);let O=a.given;o&&(e.sayLeftOut(),v?.({type:"evolve_batch",...o}));for(let u of R)l.out($().text("note.no_design_skipped",{use_case:u.display})),v?.({type:"evolve_skipped",use_case:u.display,reason:"no-design"});for(let u of x)v?.(me(u.target,u.pairs,s.because));let h=x.filter(u=>!O.has(G(u.target)));if(h.length>0){let u=$(),b=[...O.entries()].map(([g,m])=>({id:g,choice:m})),w={...i!==void 0?{ref:i}:{},...s.because?{because:s.because}:{}},T=u.command("next.answer_evolve",{...w,answers:b}),A=g=>({...w,answers:[...b,...h.map(m=>({id:G(m.target),choice:g}))]}),C=h.length===1?`use-case ${h[0].target.display}`:`${h.length} use-cases`,p=[...O.values()].filter(g=>g==="proceed").length,c=p>0?`; the ${p} use-case(s) already answered proceed still re-design`:"",f=[Q(u,"next.answer_evolve",A("proceed"),{why:e.why?e.why("proceed",C):`re-design ${C} now \u2014 supersedes what the change touches, spends design credits${c}`,...e.why?{}:{title:p>0?"Proceed with the remaining re-design":"Proceed with the re-design"}}),Q(u,"next.answer_evolve",A("decline"),{why:e.why?e.why("decline",C):`leave ${C} as designed${c}`,...e.why?{}:{title:p>0?"Decline the remaining question(s)":"Decline"}})].filter(g=>!("cmd"in g)||ae(g.cmd));return v?.({type:"evolve_paused",pending_questions:h.map(g=>e.question(g.target,g.pairs)),...T!==null?{resume:T}:{},next:f}),3}let y=[];for(let{target:u}of x){if(O.get(G(u))==="decline"){l.out(i?"declined \u2014 nothing evolved":`skipped ${u.display}`),v?.({type:"evolve_skipped",use_case:u.display,reason:"declined"});continue}let b=e.reviewFor(u),w=await ge(t,u,{...s,yes:!0,...b?{sourceChanged:b}:{}},l,d,i?"single":"batch",_,v);w.outcome==="evolved"&&E(i??u.display),y.push(w.code)}return ee(y)}function ee(e){let t=e.find(n=>n!==0&&n!==3);return t!==void 0?t:e.includes(3)?3:0}function te(e,t){return e.err?e.err(`error: ${t}`,"ANSWER_USAGE"):e.out(`error: ${t}`),2}function G(e){return`evolve:${e.display}`}function me(e,t,n){return{type:"evolve_target",...e.ref!==void 0?{ref:e.ref}:{},use_case:e.display,pairs:t,...n?{because:n}:{}}}function le(e,t,n){return{id:G(e),header:"Re-design?",text:`Re-design use-case ${e.display}? ${t} scenario/test pair(s) are affected${n?` \u2014 because: ${n}`:""}.`,risk:"med",rationale:"evolve re-designs the whole parent use-case: what the change touches is superseded, the rest is re-emitted verbatim; the run spends design credits",options:[{label:"proceed",detail:`re-design use-case ${e.display} now (${t} pair(s) affected)`},{label:"decline",detail:"leave the current design as it is"}],recommended_index:0,allow_free_text:!1}}function De(e){return t=>{t.kind==="start"?e({type:"child_start",child:"design",subject:t.subject}):t.kind==="end"&&e({type:"child_end",ok:t.ok,dur_s:t.durS,...t.exitCode!==void 0?{exit_code:t.exitCode}:{}})}}export{ye as a,We as b,ge as c,$e as d,xe as e,Oe as f,Se as g,Re as h,Ve as i,G as j};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as G,f as K,h as j}from"./chunk-
|
|
2
|
+
import{d as G,f as K,h as j}from"./chunk-36N3EHW5.js";import{a as q,b as z,d as V,e as H}from"./chunk-7YT4TTKL.js";import{a as J,b as y,c as Q}from"./chunk-NXAJBSIF.js";import{a as N,b as L,c as O}from"./chunk-IGEAET7M.js";import{d as B,f as $}from"./chunk-CUXY6KQ2.js";import{a as E}from"./chunk-MMBBQ4OZ.js";import{b as R,c as I,j as U}from"./chunk-XRNQSXOM.js";import{a as F}from"./chunk-TZXXJWHA.js";import{e as S}from"./chunk-Z7S3IWUX.js";import{n as h}from"./chunk-NC7D7GOM.js";import{b as _,r as C,s as P}from"./chunk-A7RJQJNT.js";function W(e){return e.kind==="simulator"?e.id:e.virtualName??e.id}function X(e,r,o={}){let t={platform:e.platform,udid:e.id,target:e.kind};return r&&(t.app_package=r),o.noReset!==void 0&&(t.no_reset=o.noReset),o.appiumUrl&&(t.appium_url=o.appiumUrl),e.platform==="android"&&o.autoGrantPermissions!==void 0&&(t.auto_grant_permissions=o.autoGrantPermissions),e.platform==="ios"&&o.autoAcceptAlerts!==void 0&&(t.auto_accept_alerts=o.autoAcceptAlerts),t}function Y(e=process.env){let r=e.KANE_APPIUM_URL?.trim();return r||null}function m(e){return`${e.platform}|${W(e)}`}var g=new Map,Z=new Set;function ee(e){return Z.has(m(e))}function ye(e,r,o){r.state==="stopped"&&(g.has(m(r))||oe(e,r,o))}async function re(e,r,o){let t=g.get(m(r));return t?(o?.(`waiting for ${r.displayName} to finish booting\u2026`),t):oe(e,r,o)}function oe(e,r,o){let t=m(r),a=e.prepare(r,o);g.set(t,a),r.state==="stopped"&&a.then(()=>Z.add(t),()=>{});let n=()=>{g.get(t)===a&&g.delete(t)};return a.then(n,n),a.catch(()=>{}),a}import{basename as le}from"path";import{spawnSync as pe}from"child_process";async function de(e,r,o){if(!e.teardownPlan||!o.appPackage&&!o.shutdown)return;let t;try{t=await e.teardownPlan(r,o)}catch{return}t.length!==0&&h(`device:${r.id}`,()=>{G({udid:r.id,displayName:r.displayName});for(let a of t)try{pe(a.file,a.args,{timeout:3e4,stdio:"ignore"})}catch{}})}var te={emulator:[".apk"],simulator:[".zip"]};async function ce(e,r,o,t){if(e.kind==="package")return e;if(e.kind==="app_id"){let a=r.cloudUpload;if(!a)throw new Error(`${e.value} is an app id, which needs an account to download it. Log in, or pass a path to a local build instead.`);let n=await Q({appId:e.value,baseUrl:a.baseUrl,auth:a.auth,...te[o]?{accepts:te[o]}:{},...t?{onProgress:t}:{}}),s=x(n.path);if(!s||s.kind==="app_id")throw new Error(`${n.name} is not a build this CLI can install (from ${e.value}).`);return s}try{let a=new q,n=await V(e.value,a),s=new J;await s.find(n)||t?.(`copying ${le(e.value)} into the local app store\u2026`);let i=await s.put({key:n,sourcePath:e.value,source:"local"});return{...e,value:i.path}}catch{return e}}function ue(e){h(`appium:${e}`,()=>{j({deviceClass:e,owner:process.pid})})}var k=class extends Error{constructor(r){super(r),this.name="MobileHostUnsupportedError"}},v=class extends Error{constructor(o,t){super(o);this.doctorText=t;this.name="MobilePreflightError"}};async function ge(e,r,o){let t=o.cloudUpload,a=await H({path:e,type:r,env:t.env,orgId:t.orgId,userId:t.userId,auth:t.auth,baseUrl:t.baseUrl,...o.onProgress?{onProgress:o.onProgress}:{}});if(z(a)){o.onProgress?.(`app not uploaded \u2014 ${a.reason}`);return}return a.appId}var fe="app must be a build (.apk for an emulator, .zip of the .app bundle for a simulator) or an app id from your cloud uploads \u2014 a package id names something already installed on one device, so it cannot be uploaded, exported as code, or run anywhere else.",ae=C(_);function x(e){let r=e.trim();if(y(r))return{kind:"app_id",value:r};let o=P(r,ae);return o?{kind:o.slice(1),value:r}:null}function me(e){return!!e&&(P(e,ae)!==void 0||y(e.trim()))}function ve(e){return e.filter(r=>r.required&&r.status==="fail")}function be(e,r){return!!r&&S(e,r)}async function Ke(e){let r=F();if(!r.supported)throw new k(r.reason);let o=Y()??e.appiumUrl??e.defaults?.appium_url,t=!!(e.agent||!e.interactive),a=U(),n=!!E();t&&e.platform?.toLowerCase()!=="ios"&&!n&&((await a.status("emulator")).installed||await a.ensure("emulator",{automatic:!0,onProgress:e.onProgress}));let s=await N(e.platform,{appiumUrl:o});if(O(s)){let l=s.sections.flatMap(w=>ve(w.checks)).map(w=>w.label).join(", ");throw new v(`Mobile toolchain not ready (${l}). Run \`kane-cli doctor --target ${e.platform?.toLowerCase()==="ios"?"simulator":e.platform?.toLowerCase()==="android"?"emulator":"<emulator|simulator>"}\` for details.`,L(s))}let p=await $({device:e.device,platform:e.platform,defaultTarget:e.defaults?.default_target,interactive:e.interactive}),i;if(p.ok)i=p.target;else if(p.reason==="needs-picker"&&e.pickTarget){let l=await e.pickTarget(p.candidates);if(!l)throw new Error("Target selection cancelled");i=l}else throw new Error(p.message);let u=B(i.platform);if(!u)throw new Error(`No provider for platform "${i.platform}"`);let d=R(i);if(!d)throw new Error(`No managed dependencies serve ${i.platform} ${i.kind} targets yet.`);if(!(n&&i.platform.toLowerCase()==="android"))try{await a.ensure(d,{automatic:t,onProgress:e.onProgress})}catch(l){throw l instanceof I?new v(l.message,l.message):l}let ie=i.state!=="ready"||ee(i);i=await re(u,i,e.onProgress);let ne=await K(d,{...o?{appiumUrl:o}:{},device:{udid:i.id,displayName:i.displayName},onProgress:e.onProgress});ue(d);let D=be(i,e.defaults?.default_target)?e.defaults?.default_app:void 0,f=e.app??(me(D)?D:void 0);if(e.app&&!x(e.app))throw new Error(`${e.app}: ${fe}`);let c=f?x(f):null,M=c?await ce(c,e,d,e.onProgress):null,b=M?await u.ensureApp(i,M,e.onProgress):void 0,T=c?.kind==="app_id"?c.value:e.cloudUpload&&c&&f?await ge(c.value,d,e):void 0;await de(u,i,{shutdown:ie,...b?{appPackage:b}:{}});let se=X(i,b,{noReset:e.noReset??e.defaults?.no_reset,appiumUrl:ne.url,autoGrantPermissions:e.defaults?.auto_grant_permissions,autoAcceptAlerts:e.defaults?.auto_accept_alerts}),A=T??f;return{device:se,target:i,provider:u,...T?{appId:T}:{},...A?{appRef:A}:{}}}export{W as a,X as b,ye as c,re as d,k as e,v as f,fe as g,x as h,me as i,Ke as j};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as y,e as k}from"./chunk-KF4DKXSS.js";import{spawn as A}from"child_process";var S=new Set(["progress","ask_user","graph_query","ingest_request","proposal","design","error","done","reasoning_delta","reasoning_done","tool_activity","decision_activity","text_delta","usage","receipt","chat_ops","session_paused","session_complete","state_checkpoint","turn_retry"]),M=5e3,E=new Set(["done","session_paused","error"]);function R(u,t={}){let a=t.spawnCmd!==void 0?t.spawnCmd:y();if(!a)throw new Error("assurance agent not found \u2014 your platform package may be missing; reinstall kane-cli (npm i -g @testmuai/kane-cli)");let h=u.source.images?.length??0;a.tier==="dev-python"&&h>0&&t.onWarn?.("warn: development agent in use \u2014 if image citations are missing, update the agent package");let n=A(a.cmd,a.args,{stdio:["pipe","pipe","pipe"],env:k(u.session_id,t.auth)});if(n.stdin.on("error",e=>{e.code!=="EPIPE"&&t.onWarn?.(`agent stdin: ${e.message}`)}),n.stdin.write(JSON.stringify(u)+`
|
|
3
|
+
`),n.stdout.setEncoding("utf8"),n.stderr.setEncoding("utf8"),t.onStderr){let e="";n.stderr.on("data",r=>{e+=r;let i;for(;(i=e.indexOf(`
|
|
4
|
+
`))>=0;){let o=e.slice(0,i);e=e.slice(i+1),o.trim()&&t.onStderr(o)}})}let g=!1,d=new Promise(e=>{n.on("exit",(r,i)=>{g=!0,e({code:r,signal:i})})}),p=null,f=()=>(p??=(async()=>{if(g||n.pid===void 0)return;n.kill("SIGTERM");let e=setTimeout(()=>{g||n.kill("SIGKILL")},t.killGraceMs??M);e.unref?.(),await d,clearTimeout(e)})(),p),l,v=()=>{l===void 0&&(l=setTimeout(()=>{f()},t.killGraceMs??M),l.unref?.())};d.then(()=>clearTimeout(l));async function*w(){let e="",r=!1;for await(let i of n.stdout){e+=i;let o;for(;(o=e.indexOf(`
|
|
5
|
+
`))>=0;){let c=e.slice(0,o).trim();if(e=e.slice(o+1),!c)continue;let m;try{m=JSON.parse(c)}catch{t.onWarn?.(`agent: skipping malformed line: ${c.slice(0,120)}`);continue}let s=m;if(!s||typeof s!="object"||!S.has(s.type)){t.onWarn?.(`agent: skipping unknown event type "${s&&typeof s=="object"?String(s.type??"?"):"?"}"`);continue}if(E.has(s.type)&&v(),yield s,s.type==="done"){r=!0;break}}if(r)break}await d.catch(()=>{})}return{events:w(),send:e=>{n.stdin&&!n.stdin.destroyed&&n.stdin.write(JSON.stringify(e)+`
|
|
6
|
+
`)},kill:f,exited:d,...n.pid!==void 0?{pid:n.pid}:{}}}export{M as a,R as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as c}from"./chunk-
|
|
2
|
+
import{a as c}from"./chunk-C2RUDJ46.js";import{a as n}from"./chunk-RZ4F3BHX.js";import{v as s,w as a}from"./chunk-D36V5OX6.js";import{createHash as h,randomBytes as g}from"crypto";var l=class{authBaseUrl;consentUrl;constructor(t="prod"){let e=c(t);this.authBaseUrl=e.authBaseUrl,this.consentUrl=e.consentUrl}static generatePkce(){let t=g(96).toString("base64url").slice(0,128),e=h("sha256").update(t).digest("base64url");return[t,e]}buildAuthorizationUrl(t,e,r,o){let i=new URLSearchParams({response_type:"code",client_id:t,redirect_uri:o,scope:a,code_challenge:e,code_challenge_method:"S256",state:r});return`${this.consentUrl}/oauth2?${i.toString()}`}async registerClient(t){let e=await n(`${this.authBaseUrl}/oauth2/register`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_name:s,redirect_uris:[t],grant_types:["authorization_code"],response_types:["code"],client_type:"public",application_type:"native"})});if(!e.ok)throw new Error(`DCR failed: ${e.status} ${await e.text()}`);return e.json()}async exchangeCode(t,e,r,o){let i=await n(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"authorization_code",code:t,redirect_uri:o,client_id:e,code_verifier:r})});if(!i.ok)throw new Error(`Token exchange failed: ${i.status}`);return i.json()}async refreshToken(t,e){let r=await n(`${this.authBaseUrl}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"refresh_token",refresh_token:t,client_id:e})});if(!r.ok)throw new Error(`Token refresh failed: ${r.status}`);return r.json()}async revokeToken(t,e,r="access_token"){await n(`${this.authBaseUrl}/oauth2/revoke`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,token_type_hint:r,client_id:e})})}async validateToken(t){let e=new AbortController,r=setTimeout(()=>e.abort(),1e4);try{let o=await n(`${this.authBaseUrl}/api/user`,{headers:{Authorization:`Bearer ${t}`,Accept:"application/json","Content-Type":"application/json"},signal:e.signal});return clearTimeout(r),o.ok}catch{return clearTimeout(r),!1}}};export{l as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{f as c}from"./chunk-YIKF4ERQ.js";import{d as g}from"./chunk-W7FLXW6Q.js";import{a as s}from"./chunk-KM3YCIDV.js";import{a as l}from"./chunk-EECDDDSB.js";import{f as a}from"./chunk-KF4DKXSS.js";import{c as m}from"./chunk-DPGOAFKF.js";import{b as n}from"./chunk-RF37IJNN.js";async function A(p,o,t,e){let i=async()=>{let r=e.auth??{...await a(n),...e.telemetry?.spawnEnv()??{}};return c(g(o.store,p),{store:o.store,projectDir:process.cwd(),...e.testFilesAt?{testFilesAt:e.testFilesAt}:{},agent:e.agent,tracePath:l,credentials:n,onIngestRefusal:s,preflightTurn:e.preflightTurn??(()=>m(r)),ask:async()=>[],out:t.out,emit:t.emit,progress:t.progress,isTTY:!1,auth:r,...e.telemetry?{telemetry:e.telemetry}:{}})};if(!t.channel)return i();let{runWithChannel:u}=await import("./run-channel-63SVP5OI.js");return u({event:r=>t.emit(r)},i)}export{A as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{f as u,g as d}from"./chunk-KU3YHPWZ.js";function f(e,c){let n=new Set;for(let i of e.edgesInto(c)){if(i.type!==d.DERIVES||e.superseded.has(i.ecid))continue;let r=String(i.props.source_id),o=e.heads.get(r);typeof o=="string"&&e.mediaOf(o)?.plugin?.cites_deep===!0&&n.add(r)}return[...n].sort()}function g(e,c){let n=f(e,c);if(n.length===0)return{sources:n,missing:[]};let i=s=>!e.superseded.has(s),r=s=>e.edgesInto(s).some(t=>t.type===d.DERIVES&&!e.superseded.has(t.ecid)&&n.includes(String(t.props.source_id))),o=[];for(let s of e.edgesInto(c))if(!(s.type!==d.BELONGS_TO||e.superseded.has(s.ecid)||!i(s.src)||e.nodeLabel.get(s.src)!==u.SCENARIO)){r(s.src)||o.push(s.src);for(let t of e.edgesInto(s.src))t.type!==d.AUTOMATES||e.superseded.has(t.ecid)||!i(t.src)||r(t.src)||o.push(t.src)}return{sources:n,missing:o}}export{f as a,g as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as t}from"./chunk-
|
|
2
|
+
import{b as t}from"./chunk-D36V5OX6.js";import{join as i}from"path";function e(n=t){return i(n,"plugins")}function g(n,r=t){return i(e(r),n)}function c(n,r,o=t){return i(g(n,o),r)}function f(n,r=t){return i(g(n,r),"current")}function x(n,r=t){return i(g(n,r),"config.json")}function l(n,r=t){return i(g(n,r),".jobs")}function s(n=t){return i(n,"bin")}function h(n=t){return i(s(n),"hyperexecute")}export{e as a,g as b,c,f as d,x as e,l as f,s as g,h};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as P}from"./chunk-DZOYYWOW.js";import{b as Le}from"./chunk-VXGN3IV7.js";import{a as m,c as Nt,d as At,e as I,f as Ae,g as Ce,h as Ct,i as Te,j as Tt}from"./chunk-CB4ARIHR.js";import{a as _t}from"./chunk-BSRSXYDZ.js";import{a as Z,c as xt,e as It}from"./chunk-WOSANGV6.js";import{d as Ot}from"./chunk-XMPTFXPW.js";import{a as Rt}from"./chunk-73Y6T2UK.js";import{a as et}from"./chunk-WN5VKKJ3.js";import{b as Pt,c as Ft}from"./chunk-MNBGG4H3.js";import{a as Lt}from"./chunk-VRIZDOO5.js";import{b as qe,d as qt}from"./chunk-ZHWU6L2G.js";import{a as vt,b as Ne,c as Et,d as de}from"./chunk-ZFM77AQU.js";import{Da as pt,Ea as S,Ga as ft,Ha as ht,Ia as mt,Ka as gt,Na as bt,Pa as W,Qa as L,Sa as ke,Ta as wt,Ua as yt,Va as C,Xa as Re,Ya as St,bb as ve,cb as Ee,eb as $,fb as w,gb as xe,h as at,hb as $t,ib as Ie,kb as Oe,l as ct,lb as kt,mb as _e,o as lt,ob as X,s as dt,xa as K,ya as ut}from"./chunk-UEE3RZN4.js";import{c as st,n as it}from"./chunk-DBMW3VUN.js";import{a as q}from"./chunk-KU3YHPWZ.js";import{a as ce,b as le}from"./chunk-7V4BQSSV.js";import{c as rt}from"./chunk-HHW6MRU3.js";import{a as ae}from"./chunk-7DFBOVUB.js";import{a as ot}from"./chunk-6PIIUAZF.js";import{s as tt,t as nt}from"./chunk-NC7D7GOM.js";import{a as ie}from"./chunk-HCBYKLMW.js";import{a as M,b as k,i as se}from"./chunk-33DWJV67.js";import{a as Nn}from"./chunk-6YGTRKDT.js";import{y as A}from"./chunk-D36V5OX6.js";import{e as z}from"./chunk-UR6MHSHU.js";import{existsSync as co}from"fs";var D=z(Nn(),1);import{existsSync as re,mkdirSync as Sn,readdirSync as Lr,readFileSync as we,rmSync as yn,writeFileSync as Pr,renameSync as Fr}from"fs";import{randomBytes as Jr}from"crypto";import{basename as Br,join as ze}from"path";import{appendFileSync as he,closeSync as cr,existsSync as b,mkdirSync as T,openSync as lr,readdirSync as j,readFileSync as y,renameSync as ge,rmdirSync as dr,rmSync as _,realpathSync as ur,statfsSync as pr,statSync as on,writeFileSync as fr}from"fs";import{randomBytes as sn}from"crypto";import{basename as an,dirname as R,join as f,relative as Me}from"path";var An=/^sha256:[0-9a-f]{64}$/;function Q(t){let e=new Set,n=r=>{typeof r=="string"&&An.test(r)&&e.add(r)};for(let r of t.nodes??[])n(r.content?.blob);for(let r of Object.values(t.media??{})){n(r.text_blob);for(let o of r.images??[])n(o.blob);n(r.plugin?.index),n(r.plugin?.notes),n(r.plugin?.coverage)}return{blobs:[...e].sort(),proposalId:t.proposal_id??null}}function Pe(t){return"sha256:"+le(Buffer.from("assurance.proposal\0"+ce(JSON.parse(t)),"utf8"))}import{mkdirSync as Cn,readFileSync as Tn}from"fs";import{dirname as qn,join as Ln}from"path";var Jt="locations.json",Bt="state.json";function ue(t,e){return Ln(t,"sync",e)}function Ut(t){return Yt(ue(t,Jt),{version:1,locations:[]})}function $o(t,e){jt(ue(t,Jt),e)}function F(t){return Yt(ue(t,Bt),{version:1,entries:{}})}function Mt(t,e){jt(ue(t,Bt),e)}function Wt(t,e){let n=t.locations;if(n.length===0)throw new Error("no locations yet \u2014 add one with kane-cli context sync add <name> <descriptor>");if(e!==void 0){let o=n.find(i=>i.name===e);if(o)return o;throw new Error(`no location named ${e} \u2014 known locations: ${n.map(i=>i.name).join(", ")}`)}if(n.length===1)return n[0];let r=n.find(o=>o.name==="origin");if(r)return r;throw new Error(`name a location: ${n.map(o=>o.name).join(", ")}`)}var H=class extends Error{code="WITNESS_LOWERED"};function Ht(t,e,n){let r=t.entries[e];if(!r)throw new Error(`no sync state for ${e} \u2014 run kane-cli context sync add ${e} <descriptor> first`);let o=r.witness;if(o){if(n.seq<o.seq)throw new H(`${e} is behind what it already served: position ${o.seq} was seen there, now ${n.seq}`);if(n.seq===o.seq&&n.hash!==o.hash)throw new H(`${e} changed the record at position ${o.seq}: ${o.hash} was seen there, now ${n.hash}`)}r.witness=n}function ko(t,e,n){let r=t.locations.length,o=t.locations.filter(i=>i.name!==n);if(o.length===r){let i=r===0?"none":t.locations.map(s=>s.name).join(", ");throw new Error(`no location named ${n} \u2014 known locations: ${i}`)}return t.locations=o,e.entries[n]?.witness??null}function Yt(t,e){let n;try{n=Tn(t,"utf-8")}catch(o){if(o.code==="ENOENT")return e;throw new Error(`${t} could not be read: ${o instanceof Error?o.message:String(o)}`)}let r;try{r=JSON.parse(n)}catch(o){throw new Error(`${t} is not readable JSON: ${o instanceof Error?o.message:String(o)}`)}if(typeof r!="object"||r===null||!("version"in r)||r.version!==1)throw new Error(`${t} is not a version 1 sync file \u2014 this store was written by a newer kane-cli`);return r}function jt(t,e){Cn(qn(t),{recursive:!0}),$(t,JSON.stringify(e,null,2)+`
|
|
3
|
+
`)}import{closeSync as Yn,existsSync as Zt,linkSync as jn,mkdirSync as Vn,openSync as Gn,readFileSync as Dn,rmSync as Qt,writeFileSync as zn}from"fs";import{dirname as pe,join as en}from"path";import{existsSync as Un}from"fs";import{join as Mn}from"path";var Vt=1e3,Pn=999999999,Gt=/^assurance\/context@(\d+)$/,Fn=Number(Gt.exec(q)[1]);async function te(t,e){let n=await t.get(I(e));if(n===null)throw ee(`position ${e} is absent`);return{hash:Fe(e,n).hash,raw:n}}function Fe(t,e){let n=i=>new m("SYNC_OBJECT_CORRUPT",`the record at position ${t} on the storage is not usable: ${i}`,"the storage object needs a human look; nothing was changed"),r;try{r=JSON.parse(Buffer.from(e).toString("utf8"))}catch(i){throw n(`not JSON (${i instanceof Error?i.message:String(i)})`)}if(typeof r!="object"||r===null||Array.isArray(r)||r.seq!==t)throw n(`it says it is position ${String(r?.seq)}`);let o=r.schema_version===ve&&Ee(r);if(r.schema_version!==void 0&&r.schema_version!==q&&!o){let i=Gt.exec(r.schema_version);throw i&&Number(i[1])>Fn?new m("SYNC_CLIENT_TOO_OLD",`position ${t} is stamped ${r.schema_version}; this kane-cli reads ${q}`,`upgrade kane-cli to a release that reads ${r.schema_version}, then run the command again`):n(`it is stamped ${r.schema_version}, this build reads ${q}`)}if(r.schema_version===q&&Ee(r))throw n(`it carries a source-plugin fact and is stamped ${q}; such a record is stamped ${ve}`);if(r.parents!==void 0&&!(r.prev_hash===null?r.parents.length===0:r.parents.length===1&&r.parents[0]===r.prev_hash))throw n("parents does not mirror prev_hash");return{record:r,hash:L(r)}}async function J(t,e,n=0){let r=e,o=1,i;for(;;){let p=e+o;if(!await t.head(I(p))){i=p;break}r=p,o*=2}if(r===e&&e>0&&!await t.head(I(e)))return J(t,0);for(;i-r>1;){let p=r+Math.floor((i-r)/2);await t.head(I(p))?r=p:i=p}let s=r;if(s===0){if(await t.head(At))throw ee("meta.json exists but position 1 is gone");let p=(await t.list(Nt)).map(Ce).find(h=>h!==null);if(p!==void 0)throw ee(`position ${p} exists but position 1 is gone`);return{seq:0,hash:null,raw:null}}let a=[Ae(s),Ae(Math.min(s+Vt,Pn))];a[1]===a[0]&&a.pop();let c=new Set;for(let p of a)for(let h of await t.list(p)){let x=Ce(h);if(x!==null){if(x>s){if(await t.head(I(s+1))){if(n>=Jn)throw Bn(s);return J(t,s,n+1)}throw ee(`position ${x} exists above the tail at ${s}`)}c.add(x)}}let d=s-(s-1)%Vt;for(let p=d;p<=s;p++)if(!c.has(p))throw ee(`position ${p} is missing below the tail at ${s}`);let{hash:l,raw:u}=await te(t,s);return{seq:s,hash:l,raw:u}}var Jn=3;function Bn(t){return new m("SYNC_REMOTE_HOLE",`the storage kept growing while its tail was being found (last seen at ${t}); nothing was changed`,"run the command again in a moment")}function ee(t){return new m("SYNC_REMOTE_HOLE",`the storage has a hole: ${t} \u2014 a position was deleted below evidence of a later one`,"restore the missing position from a copy that holds it; nothing was changed")}function Dt(t,e){let n=St(t,e);if(n===null)throw new S(`no local record at position ${e} \u2014 run kane-cli context fsck`);if(!(n!==Re&&Un(Mn(t,"commits",`${String(e).padStart(6,"0")}-${n.slice(7,19)}.json`))))throw new m("SYNC_LOCAL_RECORD_CORRUPT",`the local record at position ${e} ${n===Re?"is unreadable":"does not hash to its file name"}`,"run kane-cli context fsck, then restore the record from a backup or a clone; nothing was changed");return n}async function zt(t,e,n){let r=C(t),o=await J(e,n?.seq??0),i=async u=>u===o.seq?o.hash:(await te(e,u)).hash;if(n&&(o.seq<n.seq||await i(n.seq)!==n.hash))throw new m("SYNC_REMOTE_ROLLED_BACK",`the storage was rolled back: position ${n.seq} was seen there with ${n.hash}, `+(o.seq<n.seq?`now its tail is ${o.seq}`:"now a different record sits there"),"restore the storage from a copy that holds the witnessed records, or remove and re-add the location after a human has decided it was rebuilt on purpose");let s=o.seq===0?null:{seq:o.seq,hash:o.hash};if(s===null)return{kind:"empty-storage",local:r,storage:s};if(r===null)return{kind:"empty-local",local:r,storage:s};if(Dt(t,1)!==await i(1))return{kind:"foreign-lineage",local:r,storage:s};let a=Math.min(r.seq,s.seq),c=async u=>(u===r.seq?r.hash:Dt(t,u))===await i(u);if(await c(a))return{kind:r.seq===s.seq?"up-to-date":r.seq<s.seq?"behind":"ahead",local:r,storage:s};let d=1,l=a;for(;l-d>1;){let u=d+Math.floor((l-d)/2);await c(u)?d=u:l=u}return{kind:"diverged",local:r,storage:s,at:l}}function Kt(t){let e=new Map;return{indexOf(n){if(!e.has(n)){let r=t(n);e.set(n,r===null?void 0:it(r))}return e.get(n)},notesBlob:n=>t(n),coverageBlob:n=>t(n)}}function Xt(t,e){for(let[n,r]of Object.entries(t??{})){let o=r?.plugin;if(o==null||typeof o!="object")continue;let i;if(typeof o.index=="string"){if(i=e.indexOf(o.index),i===null)return{code:"UNIT_INDEX_INVALID",sourceId:n,blob:o.index,detail:"that blob is not a unit index"};if(i!==void 0&&(i.plugin!==o.id||i.rules!==o.rules))return{code:"UNIT_INDEX_INVALID",sourceId:n,blob:o.index,detail:`that index was written by plugin ${JSON.stringify(i.plugin)} under rules ${JSON.stringify(i.rules)}, not by ${JSON.stringify(o.id)} under rules ${JSON.stringify(o.rules)} as the record says`}}if(typeof o.notes=="string"){let s=e.notesBlob(o.notes);if(s===null)continue;let a=qt(s);if(a===null)return{code:"NOTES_INVALID",sourceId:n,blob:o.notes,detail:`that blob is not the stored form of a version's notes${Hn(s)}`};if(a.plugin!==o.id)return{code:"NOTES_INVALID",sourceId:n,blob:o.notes,detail:`those notes were written by plugin ${JSON.stringify(a.plugin)}, not by ${JSON.stringify(o.id)} as the record says`};let c=new Set((i?.units??[]).map(l=>l.id).filter(l=>l!==st)),d=qe(a,c);if(d!==null)return{code:"NOTES_INVALID",sourceId:n,blob:o.notes,detail:d}}if(typeof o.coverage=="string"){let s=e.coverageBlob(o.coverage);if(s===null)continue;let a=Wn(s);if(a===void 0)return{code:"COVERAGE_INVALID",sourceId:n,blob:o.coverage,detail:"that blob is not the stored form of a coverage plan (it is not JSON)"};let c=(i?.units??[]).map(l=>l.id),d=Lt(a,c);if(d!==null)return{code:"COVERAGE_INVALID",sourceId:n,blob:o.coverage,detail:`that blob is not the stored form of a coverage plan of this version (${/^(expected|group \d|the unit|two groups)/.test(d)?d:`it ${d}`})`};if(ce(a)!==Buffer.from(s).toString("utf8"))return{code:"COVERAGE_INVALID",sourceId:n,blob:o.coverage,detail:"that blob is not the stored form of a coverage plan (its bytes are not the canonical form of what it holds)"};if(a.plugin!==o.id)return{code:"COVERAGE_INVALID",sourceId:n,blob:o.coverage,detail:`that coverage plan was written by plugin ${JSON.stringify(a.plugin)}, not by ${JSON.stringify(o.id)} as the record says`}}}return null}function Wn(t){try{return JSON.parse(Buffer.from(t).toString("utf8"))}catch{return}}function Hn(t){try{let e=qe(JSON.parse(Buffer.from(t).toString("utf8")));return e===null?" (its bytes are not the canonical form of what it holds)":e.startsWith("note ")?` (${e})`:` (it ${e})`}catch{return" (it is not JSON)"}}var Kn=2e3;async function rs(t,e,n,r,o){let i=F(t).entries[n]?.witness??null,s=await zt(t,e,i),a=s.local?.seq??0,c={imported:0,from:a,to:a,blobs:0,proposals:0};switch(s.kind){case"empty-storage":return r(`nothing to pull: ${n} is empty`),c;case"up-to-date":return r("up to date"),c;case"ahead":return o?.quietAhead||r(`nothing to pull; you are ahead of ${n} \u2014 run kane-cli context push ${n}`),c;case"diverged":throw new m("SYNC_DIVERGED",`you and ${n} both added work after position ${s.at-1}; nothing was pulled`,`run kane-cli context pull ${n} --rebase to save your local work, take the team version from ${n}, and then reapply yours`);case"foreign-lineage":throw new m("SYNC_FOREIGN_LINEAGE",`${n} holds a different history (its first record is not this store's)`,`to work on it, clone it: kane-cli context clone <descriptor of ${n}> <dir>; to share this store, add an empty location`);case"behind":case"empty-local":break}let d=s.storage.seq,l=await Be(t,e,s.local,s.storage,Xn(t,s.local),r);return Ue(t,l,s.local?.hash??null,n),X(t),Je(t,n,{seq:d,hash:l.records[l.records.length-1].hash}),{imported:l.records.length,from:a,to:d,blobs:l.blobs.size,proposals:l.proposals.size}}function Je(t,e,n,r){let o=r?.lockHeld?()=>{}:W(t,{deadlineMs:Kn});try{let i=F(t),s=i.entries[e]?.witness??null;if(r?.forwardOnly&&s&&s.seq>n.seq)return;try{Ht(i,e,n)}catch(a){throw a instanceof H?new m("SYNC_REMOTE_ROLLED_BACK",a.message,"restore the storage from a copy that holds the witnessed records, or remove and re-add the location after a human has decided it was rebuilt on purpose"):a}Mt(t,i)}finally{o()}}function Xn(t,e){let n=kt(t);return n&&n.applied.seq===(e?.seq??0)&&n.applied.hash===(e?.hash??null)?n:X(t)}async function Be(t,e,n,r,o,i=()=>{}){let s=await Qn(e,n?.seq??0,n?.hash??null,r.seq,r.hash),a=nr(s,o),c=await er(t,e,s);ir(t,s),ar(t,s,a);let d=await tr(t,e,s,i);return{records:s,blobs:c,proposals:d}}function Ue(t,e,n,r,o){for(let[a,c]of e.proposals){let[d,l]=a.split("/");Zn(en(pe(Z(t,d)),l),c)}let i=n,s=null;for(let a=0;a<e.records.length;a+=xe){let c=e.records.slice(a,a+xe),d=o?.lockHeld?()=>{}:W(t);try{$t(t,c.map(({seq:l,raw:u})=>({seq:l,raw:u})),i,{...o,lockHeld:!0})}catch(l){if(!(l instanceof bt))throw l;let u=`this store appended position ${C(t)?.seq??0} while the pull was`;throw new m("SYNC_LOCAL_MOVED",s===null?`${u} being prepared; nothing was imported`:`${u} landing; positions ${e.records[0].seq}..${s} were imported, a valid prefix, and nothing more`,`kane-cli context pull ${r}`)}finally{d()}i=c[c.length-1].hash,s=c[c.length-1].seq,o?.afterChunk?.(s)}}function Zn(t,e){Vn(pe(t),{recursive:!0});let n=`${t}.tmp-${process.pid}`,r=Gn(n,"w");try{zn(r,e),ae(r)}finally{Yn(r)}try{jn(n,t)}catch(o){if(o.code!=="EEXIST")throw Qt(n,{force:!0}),o}Qt(n,{force:!0}),w(pe(t))}async function Qn(t,e,n,r,o){let i=[],s=n;for(let a=e+1;a<=r;a++){let c=await t.get(I(a));if(c===null)throw new m("SYNC_REMOTE_HOLE",`the storage has a hole: position ${a} is missing below its tail at ${r}`,"restore the missing position from a copy that holds it; nothing was changed");let{record:d,hash:l}=Fe(a,c);if(d.prev_hash!==s)throw new m("SYNC_REMOTE_CHAIN_BROKEN",`position ${a} on the storage is sealed onto ${String(d.prev_hash)}, but position ${a-1} hashes ${String(s)}`,"the storage chain needs a human look; nothing was changed");if(a===r&&l!==o)throw new m("SYNC_REMOTE_CHAIN_BROKEN",`the tail at position ${r} changed while this pull ran: it hashed ${o}, now ${l}`,"run kane-cli context pull again");i.push({seq:a,hash:l,raw:Buffer.from(c).toString("utf8"),record:d}),s=l}return i}async function er(t,e,n){let r=new Set;for(let{seq:o,record:i}of n)for(let s of Q(i).blobs){if(r.has(s))continue;let a=de(t,s);if(a!==null&&Ne(a)===s)continue;let c=await e.get(Ct(s));if(c===null)throw new m("SYNC_REMOTE_HOLE",`the storage has a hole: position ${o} names blob ${s}, which the storage does not hold`,"restore the blob from a copy that holds it; nothing was changed");let d=Buffer.from(c);if(Ne(d)!==s)throw new m("SYNC_OBJECT_CORRUPT",`the blob ${s} on the storage does not hash to its name (named by position ${o})`,"the storage object needs a human look; nothing was changed");a===null?Et(t,d):$(vt(t,s),d),r.add(s)}return r}async function tr(t,e,n,r){let o=new Map,i=new Set;for(let{seq:s,record:a}of n){let c=Q(a).proposalId;if(c===null||i.has(c))continue;i.add(c);let d=Z(t,c),l=null;if(Zt(d))try{l=Pe(Dn(d,"utf8"))}catch{l=""}let u=await e.list(Tt(c));if(u.length===0)continue;if(u.length>1){r(`proposal ${c} (position ${s}) has ${u.length} payloads on the storage and the record names none of them; skipped`);continue}if(l!==null&&Te(c,l)===u[0])continue;let p=await e.get(u[0]);if(p===null)continue;let h=null;try{h=Pe(Buffer.from(p).toString("utf8"))}catch{h=null}if(h===null||Te(c,h)!==u[0]){r(`proposal ${c} (position ${s}) on the storage does not digest to its key ${u[0]}; skipped`);continue}if(l===null){o.set(`${c}/proposal.json`,Buffer.from(p));continue}let x=`${c}/proposal.${h.slice(7,19)}.json`;Zt(en(pe(d),x.slice(c.length+1)))||(r(`proposal ${c} (position ${s}) differs from the one here; the storage's payload is installed beside it as ${x}`),o.set(x,Buffer.from(p)))}return o}function nr(t,e){let n=structuredClone(e);for(let{seq:r,hash:o,record:i}of t)try{lt(n,i,o)}catch(s){throw s instanceof ct?new m("SYNC_REMOTE_ADMISSION_RED",`position ${r} would not pass this store's checks: ${s.message}`,`nothing was imported; ask whoever pushed position ${r} to run kane-cli context fsck on their store, or upgrade kane-cli if theirs is newer`):s}return n}var fe=t=>t.slice(0,19),rr=t=>t===null?"no units":`units [${t.join(", ")}]`,or=t=>t===null?"no units":`[${t.join(", ")}]`,sr=(t,e)=>`the record at position ${t} says citation ${fe(e.ecid)} is in ${rr(e.said)}; its lines ${e.anchor} of ${e.sourceId} fall in ${or(e.found)} \u2014 nothing was applied`;function ir(t,e){let n=Kt(r=>de(t,r));for(let{seq:r,record:o}of e){let i=Xt(o.media,n);if(i===null)continue;let s=i.code==="UNIT_INDEX_INVALID"?"unit index":i.code==="NOTES_INVALID"?"notes":"coverage plan";throw new m(i.code==="UNIT_INDEX_INVALID"?"SYNC_UNIT_INDEX_INVALID":i.code==="NOTES_INVALID"?"SYNC_NOTES_INVALID":"SYNC_COVERAGE_INVALID",`the record at position ${r} names blob ${fe(i.blob)} as the ${s} of ${i.sourceId}, and ${i.detail} \u2014 nothing was applied`,`this build cannot take that record. It was written by a kane-cli with a fault or was altered; tell whoever pushed position ${r}, and keep working from your own store`)}}function ar(t,e,n){let r={mediaOf:o=>Object.hasOwn(n.media,o)?n.media[o]:void 0,getBlob:o=>de(t,o)};for(let{seq:o,record:i}of e){let s=at(i.edges,r);if(s!==null)throw s.code==="UNIT_INDEX_MISSING"?new m("SYNC_UNIT_INDEX_MISSING",`the record at position ${o} cites ${s.anchor} of ${s.sourceId} at version ${fe(s.versionCid)}, and that version's unit index (blob ${fe(s.index??"")}) is not in this store's blob store, so the citation's units cannot be checked \u2014 nothing was applied`,"restore this store's blobs from a copy, or clone the location into a new folder (a clone fetches every blob); kane-cli context fsck names what is missing"):new m("SYNC_UNITS_MISMATCH",sr(o,s),`this build cannot take that record. It was written by a kane-cli with a fault or was altered; tell whoever pushed position ${o}, and keep working from your own store`)}}var hr=["pending-facts.ndjson","signals.ndjson","store.json"],mr=/^\d{6}-[0-9a-f]{12}\.json$/,tn=["staged","fenced","backed-up","trimmed","importing","imported","unfenced"],cn=2e3,gr=1440*60*1e3,br=(t,e)=>f(t,"sync","backups",`${e}-reset`),wr=()=>new Date().toISOString().replace(/[:.]/g,"-"),yr=t=>f(t,"sync","incoming"),v=t=>f(t,"sync","replay"),We=t=>an(t),ln=(t,e)=>f(v(t),`${We(e)}.receipt.json`),N=t=>f(t,"sync","journal.json"),O=t=>f(t,"commits"),ne=t=>f(O(t),ke),V=(t,e)=>f(yr(t),e),He=(t,e)=>`${String(t).padStart(6,"0")}-${e.slice(7,19)}.json`,Y=t=>"sha256:"+le(t),dn=()=>({pid:process.pid,nonce:sn(4).toString("hex")});async function vs(t,e,n,r,o,i={}){if(r.kind!=="diverged"||r.at===void 0)throw new Error(`reset needs a diverged relation, got ${r.kind}`);let s=r.at;if(b(N(t)))throw new m("SYNC_STORE_BUSY","a reset is already in progress","run kane-cli context sync doctor");rn(t),$r(t,n),Sr(t);let{records:a,hashes:c}=yt(t),d={seq:s-1,hash:c[s-2]},l=Oe();_e(t,l,a.slice(0,s-1),c.slice(0,s-1),{writeNodeFiles:!1});let u=await Be(t,e,d,r.storage,l),p=a.slice(s-1).map(U=>He(U.seq,c[U.seq-1])),h=Ar(t,a,c,s),x=fn(t,p,h);kr(t,Rr(u)+x.reduce((U,_n)=>U+on(_n.src).size,0));let Qe=i.ts??wr(),oe={nonce:sn(8).toString("hex"),state:"staged",name:n,holder:dn(),base:d,at:s,storage:r.storage,backup:br(t,Qe),ts:Qe,moved:p,testIds:h,counts:{records:u.records.length,blobs:u.blobs.size,proposals:u.proposals.size},manifest:[]};Er(t,oe.nonce,u);let On=W(t,{deadlineMs:cn});try{if(C(t)?.hash!==r.local?.hash)throw new m("SYNC_STORE_BUSY","the chain moved while the reset was being prepared",`run kane-cli context pull ${n} --rebase again`);return rn(t),Ye(t,oe,i.afterTransition),un(t,oe,o,i)}catch(U){throw b(N(t))||me(V(t,oe.nonce)),U}finally{On()}}async function Es(t,e,n=()=>{}){let r={state:"none",detail:"no reset in progress"},o=nn(t);if(o===null)return r;let i=W(t,{deadlineMs:cn});try{let s=nn(t);if(s===null||s.nonce!==o.nonce)return r;if(s.holder.pid!==process.pid&&K(s.holder.pid))throw new m("SYNC_STORE_BUSY",`a reset is running as pid ${s.holder.pid} \u2014 wait`,"wait for it to finish, then run the command again");if(s.holder=dn(),Ye(t,s),e==="resume"){let l=un(t,s,n,{});return{state:"resumed",detail:`finished the reset interrupted at '${s.state}': ${l.moved.length} records moved to ${l.backup}`,result:l}}if(B(s,"imported"))return{state:"refused",detail:`the shared records are already imported, so the reset can only finish (kane-cli context sync or kane-cli context pull finishes it); its receipt will be ${ln(t,s.backup)}`};let a=Nr(t,s),c=0;for(let{name:l,hash:u}of s.manifest){if(!l.startsWith("commits/")&&!l.startsWith("intents/"))continue;let p=f(t,l);try{if(b(p)){if(Y(y(p))!==u)throw new Error("the live file does not match the backup manifest");continue}let h=y(f(s.backup,l));if(Y(h)!==u)throw new Error("the backup copy does not match the manifest");T(R(p),{recursive:!0}),$(p,h),l.startsWith("commits/")&&c++}catch(h){throw new Error(`restore stopped at ${l}: ${h instanceof Error?h.message:String(h)}; re-run abort`)}}pn(t,s.nonce),_(Ie(t),{recursive:!0,force:!0});let d=`${s.backup}.aborted`;return b(s.backup)&&ge(s.backup,d),w(R(s.backup)),_(N(t),{force:!0}),w(R(N(t))),me(d),me(V(t,s.nonce)),{state:"aborted",detail:`aborted the reset at '${s.state}': ${a} imported records removed, ${c} records put back, the chain is as it was`}}finally{i()}}function nn(t){return b(N(t))?JSON.parse(y(N(t),"utf8")):null}var B=(t,e)=>tn.indexOf(t.state)>=tn.indexOf(e);function un(t,e,n,r){let o=l=>{e.state=l,Ye(t,e,r.afterTransition)},i=()=>{if(!je(t,e.nonce))throw new Error("sentinel missing \u2014 run kane-cli context sync doctor")};B(e,"fenced")||(vr(t,e.nonce),o("fenced")),B(e,"backed-up")||(i(),e.manifest=Ir(t,e),o("backed-up")),B(e,"trimmed")||(i(),Or(t,e),o("trimmed")),B(e,"importing")||(i(),o("importing")),B(e,"imported")||(i(),_(Ie(t),{recursive:!0,force:!0}),_r(t,e,xr(t,e.nonce),r.afterChunk),o("imported")),B(e,"unfenced")||(pn(t,e.nonce),o("unfenced"));let s=X(t),a=Cr(t,e),c=It(t,gr),d=Tr(t,f(v(t),We(e.backup)),new Set(Object.keys(s.nodeLabel)));T(v(t),{recursive:!0}),$(ln(t,e.backup),JSON.stringify({from:e.at,moved:e.moved,storageTail:e.storage,quarantinedTests:a,droppedPendingFacts:d,liveSideQueues:c},null,2)+`
|
|
4
|
+
`),w(v(t)),_(N(t),{force:!0}),w(R(N(t))),me(V(t,e.nonce)),Je(t,e.name,e.storage,{lockHeld:!0}),n(`saved ${e.moved.length} local record${e.moved.length===1?"":"s"} from position ${e.at} in ${e.backup}; ${e.name}'s records took their place`);for(let l of a)n(`quarantined test file ${l}: its test was minted by a moved record`);return{name:e.name,backup:e.backup,moved:e.moved,quarantinedTests:a,pulled:{imported:e.counts.records,from:e.base.seq,to:e.storage.seq,blobs:e.counts.blobs,proposals:e.counts.proposals}}}function rn(t){let e=new Date,n=f(t,"sessions");if(b(n))for(let r of j(n)){let o=f(n,r,".lock");if(!b(o))continue;let i;try{i=JSON.parse(y(o,"utf8"))}catch{continue}let s=e.getTime()-new Date(i.ts??0).getTime();if(typeof i.pid=="number"&&K(i.pid)&&s<rt)throw new m("SYNC_STORE_BUSY",`session ${r} is live (pid ${i.pid})`,"finish or pause that session, then run the reset again")}for(let{key:r,grant:o}of pt(t))if(!ut(o,e))throw new m("SYNC_STORE_BUSY",`lock ${r} is held by ${o.verb} (pid ${o.pid})`,"wait for that command to finish, then run the reset again")}function Sr(t){let e=gn(t);if(!e)return;let n=e.listHolds().length;throw new m("SYNC_REBASE_PENDING",`your last rebase still has ${n} unresolved decision${n===1?"":"s"}; no new rebase was started`,"run kane-cli context sync or kane-cli context pull again to continue. To discard the unresolved local changes instead, run kane-cli context sync doctor --abort")}function $r(t,e){let n=F(t).entries[e]?.binding,r=ot(t),o=ur(t),i=on(t),s=r!==null&&n?.instance_id===r.context_instance_id&&n.realpath===o;if(!(s&&n.dev===i.dev&&n.ino===i.ino))throw new m("SYNC_COPIED_STORE_UNRESOLVED",r===null?"this store has no store.json ids, so it cannot prove it is the one the location was added from":s?`this store's directory is not the one ${e} was bound from: same ids and path, but the .context inode changed \u2014 it was replaced in place by a copy`:`this store is not the one ${e} was added from (${n?`bound to ${n.realpath}`:"no binding"}; this is ${o})`,`re-run kane-cli context sync add ${e} <descriptor> from this directory to bind it`)}function kr(t,e){let n=pr(t),r=n.bavail*n.bsize;if(!(r>=2*e))throw new m("SYNC_DISK_LOW",`${r} bytes free, the reset needs ${2*e} (twice the staged suffix plus the backup)`,"free some disk space, then run the reset again")}function Rr(t){let e=0;for(let n of t.records)e+=Buffer.byteLength(n.raw);for(let n of t.proposals.values())e+=n.length;return e}function Ye(t,e,n){T(R(N(t)),{recursive:!0}),$(N(t),JSON.stringify(e,null,2)+`
|
|
5
|
+
`),n?.(e.state)}function vr(t,e){let n=ne(t);try{let r=lr(n,"wx");try{fr(r,wt(e)),ae(r)}finally{cr(r)}w(O(t))}catch(r){if(r.code!=="EEXIST")throw r;if(!je(t,e))throw new Error(`${n} belongs to another reset \u2014 run kane-cli context sync doctor`)}}function pn(t,e){if(b(ne(t))){if(!je(t,e))throw new Error(`${ne(t)} belongs to another reset \u2014 left in place`);_(ne(t)),w(O(t))}}function je(t,e){try{return JSON.parse(y(ne(t),"utf8")).kane?.nonce===e}catch{return!1}}function Er(t,e,n){let r=V(t,e);for(let o of["records","proposals"])T(f(r,o),{recursive:!0});for(let o of n.records)$(f(r,"records",`${o.seq}.json`),o.raw);for(let[o,i]of n.proposals)T(R(f(r,"proposals",o)),{recursive:!0}),$(f(r,"proposals",o),i)}function xr(t,e){let n=V(t,e),r=j(f(n,"records")).map(i=>Number(i.slice(0,-5))).sort((i,s)=>i-s).map(i=>{let s=y(f(n,"records",`${i}.json`),"utf8"),a=JSON.parse(s);return{seq:i,raw:s,record:a,hash:L(a)}}),o=new Map;for(let i of Ve(f(n,"proposals")))o.set(Me(f(n,"proposals"),i),y(i));return{records:r,blobs:new Set,proposals:o}}function me(t){_(t,{recursive:!0,force:!0});try{dr(R(t))}catch{}}function fn(t,e,n){let r=[],o=a=>{r.push({name:a,src:f(t,a)})},i=[];for(let a of e){o(`commits/${a}`);let c=JSON.parse(y(f(O(t),a),"utf8"));i.push(c);let d=dt(t,L(c));b(d)&&o(Me(t,d))}let s=f(t,"sessions");if(b(s))for(let a of Ve(s))o(Me(t,a));for(let a of hr)b(f(t,a))&&o(a);for(let a of j(t))xt.test(a)&&o(a);for(let a of i){let c=Q(a).proposalId;c!==null&&b(Z(t,c))&&o(`proposals/${c}/proposal.json`)}for(let a of mn(t,n))r.push({name:`tests/${an(a)}`,src:a});return r}function Ve(t){let e=[];for(let n of j(t,{withFileTypes:!0})){let r=f(t,n.name);n.isDirectory()?e.push(...Ve(r)):n.isFile()&&e.push(r)}return e}function Ir(t,e){let n=f(e.backup,"manifest.json");if(b(n))return JSON.parse(y(n,"utf8"));let r=[];T(e.backup,{recursive:!0}),w(R(e.backup)),w(R(R(e.backup)));let o=(i,s)=>{let a=f(e.backup,i);T(R(a),{recursive:!0}),$(a,s),r.push({name:i,hash:Y(s)})};for(let{name:i,src:s}of fn(t,e.moved,e.testIds??[]))o(i,y(s));return o("base-witness.json",Buffer.from(JSON.stringify({name:e.name,base:e.base,storage:e.storage,from:e.at},null,2)+`
|
|
6
|
+
`)),$(f(e.backup,"manifest.json"),JSON.stringify(r,null,2)+`
|
|
7
|
+
`),r}function Or(t,e){if(!b(f(O(t),He(e.base.seq,e.base.hash))))throw new Error(`the record at position ${e.base.seq} is not the one the reset was planned on \u2014 nothing removed; run kane-cli context sync doctor`);let n=e.manifest.filter(r=>r.name.startsWith("commits/")).sort((r,o)=>r.name<o.name?1:-1);for(let{name:r,hash:o}of n){let i=f(t,r);if(b(i)){if(Y(y(i))!==o)throw new Error(`${i} does not match the backup manifest \u2014 not removed; run kane-cli context sync doctor`);_(i)}}w(O(t));for(let{name:r}of e.manifest)r.startsWith("intents/")&&_(f(t,r),{force:!0})}function hn(t,e){return j(O(t)).filter(n=>mr.test(n)&&n!==ke&&Number(n.slice(0,6))>e.base.seq).sort()}function _r(t,e,n,r){let o=hn(t,e).at(-1),i=e.base;if(o!==void 0){let s=n.records.find(a=>o===He(a.seq,a.hash));if(!s)throw new Error(`commits/${o} is neither the base nor a staged record \u2014 run kane-cli context sync doctor`);i={seq:s.seq,hash:s.hash}}Ue(t,{...n,records:n.records.filter(s=>s.seq>i.seq)},i.hash,e.name,{lockHeld:!0,underReset:{nonce:e.nonce},afterChunk:r})}function Nr(t,e){let n=new Map(e.manifest.filter(s=>s.name.startsWith("commits/")).map(s=>[s.name.slice(8),s.hash])),r=f(V(t,e.nonce),"records"),o=new Set(b(r)?j(r).map(s=>Y(y(f(r,s)))):[]),i=[];for(let s of hn(t,e)){let a=Y(y(f(O(t),s)));if(n.get(s)!==a){if(!o.has(a))throw new Error(`commits/${s} is neither an original of this store nor a staged record \u2014 nothing changed; ask for help before touching commits/`);i.push(s)}}for(let s of i.reverse())_(f(O(t),s));return i.length>0&&w(O(t)),i.length}function Ar(t,e,n,r){let o=new Set;for(let a of e.slice(r-1))for(let c of a.nodes)c.label==="test"&&o.add(c.cid);if(o.size===0)return[];let i=Oe();_e(t,i,e,n,{writeNodeFiles:!1});let s=a=>{let c=new Set;for(let d=a;;){let l=i.superseded[d];if(typeof l!="string"||c.has(l))return d;c.add(l),d=l}};return Object.entries(i.names).filter(([,a])=>o.has(s(a))).map(([a])=>a).sort()}function mn(t,e){if(e.length===0)return[];let n=Ft(Pt(R(t)));return e.flatMap(r=>n.get(r)??[])}function Cr(t,e){let n=[];for(let r of mn(t,e.testIds??[]))b(r)&&(ge(r,`${r}.quarantined-${e.ts}`),n.push(r));return n}function xs(t,e,n,r){let o=`${f(v(t),We(e))}.pending-facts.dropped.ndjson`;if(!b(o))return{reparked:0,unmapped:[]};let i=[],s=[];for(let a of y(o,"utf8").split(`
|
|
8
|
+
`).filter(c=>c!=="")){let c;try{c=JSON.parse(a)}catch{continue}let d=(c.facts??[]).flatMap(l=>{let u=l.about_cid?n.get(l.about_cid)??l.about_cid:l.about_cid;if(!u||!r.has(u))return l.about_cid&&s.push(l.about_cid),[];let p=l.per_ac?.map(h=>h.ac_cid?{...h,ac_cid:n.get(h.ac_cid)??h.ac_cid}:h);return[{...l,about_cid:u,...p?{per_ac:p}:{}}]});d.length>0&&i.push(JSON.stringify({...c,facts:d}))}return i.length>0&&he(f(t,"pending-facts.ndjson"),i.join(`
|
|
9
|
+
`)+`
|
|
10
|
+
`),ge(o,o.replace(/\.dropped\.ndjson$/,".reparked.ndjson")),{reparked:i.reduce((a,c)=>a+JSON.parse(c).facts.length,0),unmapped:s}}function Tr(t,e,n){let r=f(t,"pending-facts.ndjson"),o=`${e}.pending-facts.rotated.ndjson`;if(!b(o)){if(!b(r))return 0;T(R(e),{recursive:!0}),ge(r,o)}let i=[],s=[],a=y(o,"utf8").split(`
|
|
11
|
+
`).filter(d=>d!=="");for(let d of a){let l;try{l=JSON.parse(d)}catch{s.push(d);continue}let u=l.facts??[],p=u.filter(h=>h.about_cid!==void 0&&h.about_cid!==""&&!n.has(h.about_cid));p.length===0?s.push(d):p.length===u.length?i.push(d):(i.push(JSON.stringify({...l,facts:p})),s.push(JSON.stringify({...l,facts:u.filter(h=>!p.includes(h))})))}i.length>0&&he(`${e}.pending-facts.dropped.ndjson`,i.join(`
|
|
12
|
+
`)+`
|
|
13
|
+
`),s.length>0&&he(r,s.join(`
|
|
14
|
+
`)+`
|
|
15
|
+
`);let c=y(o,"utf8").split(`
|
|
16
|
+
`).filter(d=>d!=="").slice(a.length);return c.length>0&&he(r,c.join(`
|
|
17
|
+
`)+`
|
|
18
|
+
`),_(o),i.length}var qr=/^sha256:[0-9a-f]{64}$/,Ge=class t{m=new Map;get size(){return this.m.size}set(e,n){this.m.set(e,n)}get(e){return this.m.get(e)}rewrite(e){if(typeof e=="string")return qr.test(e)?this.m.get(e)??e:e;if(Array.isArray(e))return e.map(n=>this.rewrite(n));if(e!==null&&typeof e=="object"){let n={};for(let[r,o]of Object.entries(e))n[r]=this.rewrite(o);return n}return e}toJSON(){return Object.fromEntries(this.m)}static fromJSON(e){let n=new t;for(let[r,o]of Object.entries(e??{}))n.set(r,o);return n}},De=class t{m=new Map;set(e,n){this.m.set(e.hash,{orig:e,fate:n})}get(e){let n=this.m.get(e.hash);return n&&n.orig.seq===e.seq?n.fate:void 0}byHash(e){return this.m.get(e)?.fate}toJSON(){return[...this.m.values()]}static fromJSON(e){let n=new t;for(let r of e??[])n.set(r.orig,r.fate);return n}},bn=t=>({cid:t.cid.toJSON(),record:t.record.toJSON()}),wn=t=>({cid:Ge.fromJSON(t?.cid),record:De.fromJSON(t?.record)});var Ps=["keep-theirs","apply-mine","apply-mine-as-new"];function Ke(t,e,n){switch(e){case"keep-theirs":return t==="generation"?"the local design stays in the backup; after this rebase, run design again if you want both":"the local change stays in the backup";case"apply-mine":return t==="slug"?`the name moves to the local node; the node that holds it on ${n} is reached by its id again`:t==="head"?`retire the source as it is now, ${n}'s version included`:`the local version lands on top of ${n}'s`;case"apply-mine-as-new":return`a new node beside ${n}'s (duplicate check first)`;case"later":return"leaves the rebase open; kane-cli context sync or kane-cli context pull asks again"}}function Fs(t,e,n){return{rebase_id:t,decision_id:e.holdId,kind:e.kind,intent:e.verb,seq:e.orig.seq,label:e.label,location:n,mine:e.mine,theirs:e.theirs,answers:e.answers.map(r=>({answer:r,consequence:Ke(e.kind,r,n)}))}}function Js(t){return{from:(n,r)=>{let o=n===0?null:t.tokenAt(n);if(n>0&&o===null)throw new S(`the record log holds no record at position ${n} \u2014 run kane-cli context rebuild`);let i=t.recordsSince(o);if(i.length>0&&o!==null&&t.resolveToken(o)?.hash!==r)throw new S(`broken chain after position ${n}: it no longer continues ${String(r)}`);return{records:i,hashes:i.map(L)}},hashAt:n=>{let r=t.tokenAt(n);return r===null?null:t.resolveToken(r)?.hash??null}}}var Bs=t=>t.dirOrThrow(),be=(t,e)=>ze(v(t),`${e}.json`),Ur=(t,e)=>ze(v(t),`${e}.lock`),G=class t{constructor(e,n){this.contextDir=e;this.data=n;this.maps=wn(n.maps)}maps;static create(e,n,r,o,i){let s=Br(n);if(re(be(e,s)))throw new S(`rebase ${s} already has a ledger \u2014 run kane-cli context sync or kane-cli context pull to continue it, or kane-cli context sync doctor --abort to close it`);let a=new t(e,{version:1,backup:n,backupId:s,from:o,state:"open",...i?{location:i}:{},items:r.map(d=>({...d})),maps:{cid:{},record:[]},aliases:[]}),c=!re(v(e));return Sn(v(e),{recursive:!0}),c&&w(ze(e,"sync")),a.save(),a}static open(e,n){let r=be(e,n);if(!re(r))throw new S(`no rebase ${n} here \u2014 kane-cli context sync doctor lists the rebases this store has`);let o;try{o=JSON.parse(we(r,"utf8"))}catch{o=null}if(!ht(o)||typeof o.backup!="string")throw new S(Hr(n));return new t(e,o)}get backupId(){return this.data.backupId}get location(){return this.data.location??"the location"}get rev(){return this.data.rev??0}get backup(){return this.data.backup}get from(){return this.data.from}get state(){return this.data.state}get closedBy(){return this.data.closedBy}get items(){return this.data.items}get aliases(){return this.data.aliases}item(e){let n=this.data.items.find(r=>r.k===e);if(!n)throw new Error(`no replay item ${e}`);return n}itemAt(e){return this.data.items.find(n=>n.orig.seq===e||n.group?.some(r=>r.seq===e))}beginItem(e,n){this.assertOpen();let r=this.item(e);r.begin={expectPrev:n},delete r.outcome,this.save()}endItem(e,n){this.assertOpen(),this.item(e).outcome=n,this.save()}pendingItem(){return this.data.items.find(e=>e.begin!==void 0&&e.outcome===void 0)}reconcileAll(e,n){let r=this.item(e);if(!r.begin)return[];let o=r.origins??Object.fromEntries((r.group??[r.orig]).map(c=>[c.hash,c.seq])),{records:i,hashes:s}=n.from(r.begin.expectPrev.seq,r.begin.expectPrev.hash),a=[];return i.forEach((c,d)=>{let l=c.replayed_from===void 0?void 0:o[c.replayed_from.orig.hash];l!==void 0&&a.push({seq:c.seq,hash:s[d],member:l})}),a}reconcileFrom(e,n,r){let o=this.item(e),i=o.origins??Object.fromEntries((o.group??[o.orig]).map(d=>[d.hash,d.seq])),{records:s,hashes:a}=n.from(r.seq,r.hash),c=[];return s.forEach((d,l)=>{let u=d.replayed_from===void 0?void 0:i[d.replayed_from.orig.hash];u!==void 0&&c.push({seq:d.seq,hash:a[l],member:u})}),c}reconcile(e,n){let r=this.reconcileAll(e,n).at(-1);return r?{seq:r.seq,hash:r.hash}:void 0}lastAppliedInChain(e){for(let n of[...this.data.items].reverse()){let r=n.outcome;if(r&&"applied"in r)return e.hashAt(r.applied.newSeq)===r.applied.newHash;if(r&&"deduped"in r&&r.deduped.newSeq!==void 0)return e.hashAt(r.deduped.newSeq)===r.deduped.newHash}return!0}setMaps(e){this.maps=e,this.data.maps=bn(e),this.save()}addAlias(e){this.data.aliases.push(e),this.save()}listHolds(){return this.data.items.flatMap(e=>e.outcome&&"held"in e.outcome?[e.outcome.held]:[])}resolveHold(e,n){let r=this.heldItem(e);if(!r.outcome.held.answers.includes(n))throw new S(`${n} is not an answer ${e} accepts`);return r.answer=n,this.reopen(r)}reopenHold(e){let n=this.heldItem(e);return delete n.answer,this.reopen(n)}heldItem(e){this.assertOpen();let n=this.data.items.find(r=>r.outcome&&"held"in r.outcome&&r.outcome.held.holdId===e);if(!n)throw new S(`${e} is not an open decision \u2014 kane-cli context sync status lists them`);return n}reopen(e){return delete e.outcome,delete e.begin,this.save(),e}close(e){this.data.state="closed",this.data.closedBy=e,this.save()}toJSON(){return structuredClone(this.data)}assertOpen(){if(this.data.state!=="open")throw new S(`rebase ${this.data.backupId} is closed \u2014 kane-cli context sync doctor lists every rebase and what it reapplied`)}save(){let e=be(this.contextDir,this.data.backupId);if(re(e)){let n=0;try{n=JSON.parse(we(e,"utf8")).rev??0}catch{n=0}if(n>(this.data.rev??0))throw new S(`the replay ledger for ${this.data.backupId} changed on disk (rev ${n}, this process holds rev ${this.data.rev??0}) \u2014 another process is working on it; run the command again`)}this.data.rev=(this.data.rev??0)+1,$(e,JSON.stringify(this.data,null,2)+`
|
|
19
|
+
`)}};function Mr(t,e){let n=Ur(t,e);Sn(v(t),{recursive:!0});let r=Jr(6).toString("hex");for(;;)try{return Pr(n,JSON.stringify({pid:process.pid,nonce:r}),{flag:"wx"}),()=>{try{JSON.parse(we(n,"utf8")).nonce===r&&yn(n)}catch{}}}catch(o){if(o.code!=="EEXIST")throw o;let i={};try{i=JSON.parse(we(n,"utf8"))}catch{i={}}if(typeof i.pid=="number"&&K(i.pid))throw new S(`rebase ${e} is being worked on by pid ${i.pid} \u2014 wait for it to finish`);yn(n,{force:!0})}}var Us=(t,e,n,r,o)=>G.create(t,e,n,r,o),Wr=(t,e)=>G.open(t,e),Hr=t=>`rebase ${t} has a ledger this store cannot read (sync/replay/${t}.json) \u2014 ${ft}`,$n=t=>{let e=v(t);return re(e)?Lr(e).filter(n=>n.endsWith(".json")&&!n.endsWith(".receipt.json")).sort().reverse().map(n=>n.slice(0,-5)):[]};function Yr(t,e={}){let n=[];for(let r of $n(t))try{n.push(G.open(t,r))}catch(o){if(!e.tolerant)throw o}return n}function Ms(t){return $n(t).filter(e=>{try{return G.open(t,e),!1}catch{return!0}})}function Ws(t,e){let n=be(t,e),r=`${n}.unreadable`;return Fr(n,r),w(v(t)),r}function gn(t){return Yr(t).find(e=>e.state==="open")}function jr(t){let e=t.outcome;return e?"applied"in e?`reapplied \u2192 record ${e.applied.newSeq}`:"held"in e?`decision ${e.held.holdId} (${e.held.kind})`:"deduped"in e?`already present: ${e.deduped.as.slice(0,19)}`:`not reapplied: ${e.skipped.reason}`:t.begin?"pending":"waiting"}function Hs(t,e,n={}){let r=t.itemAt(e);if(!r)throw new S(`no moved record at position ${e} in rebase ${t.backupId}`);let o=r.label.startsWith(`${r.verb} `)||r.label===r.verb?r.label:`${r.verb} ${r.label}`,i=[`record ${r.orig.seq}: ${o}`,`origin ${r.orig.hash}`,`outcome: ${jr(r)}`];if(r.group&&i.push(`group: records ${r.group.map(s=>s.seq).join(", ")}`),r.outcome&&"held"in r.outcome){let s=r.outcome.held,a=Math.max(5,t.location.length)+1;i.push(`${"local:".padEnd(a+1)}${s.mine}`,`${`${t.location}:`.padEnd(a+1)}${s.theirs}`,`choose: ${s.answers.join(", ")}`),n.detail!==!1&&i.push(JSON.stringify(s.detail,null,2))}return i}function Ys(t,e){let n=Mr(t,e);try{let r=Wr(t,e);return r.state==="open"&&r.close("abort"),r}finally{n()}}var g=z(ie(),1);function kn(t,e,n){let r={"keep-theirs":`keep ${n}'s version`,"apply-mine":"apply the local version","apply-mine-as-new":"add the local version as new",later:"decide later"},o=t.answers.map(i=>({key:i,answer:i,label:r[i],detail:e(i)}));return o.push({key:"later",answer:"later",label:r.later,detail:e("later")}),o}function Rn({card:t,index:e,total:n,rebaseId:r,location:o,diff:i,rows:s,sel:a,focused:c,expanded:d}){let l=Math.max(...(i??[]).map(u=>Math.max(u.was.length,u.local.length,u.origin.length)),8);return(0,g.jsxs)(M,{flexDirection:"column",children:[(0,g.jsxs)(k,{bold:!0,children:[`decision ${e} of ${n}`,(0,g.jsx)(k,{color:A.dim,children:` \xB7 ${t.kind} on your ${t.verb} from record ${t.orig.seq}`})]}),i&&i.length>0?(0,g.jsxs)(M,{flexDirection:"column",children:[(0,g.jsx)(k,{color:A.dim,children:` ${"".padEnd(12)}${"was".padEnd(l+2)}${"local".padEnd(l+2)}${o}`}),i.map(u=>(0,g.jsxs)(k,{children:[(0,g.jsx)(k,{color:A.dim,children:` ${u.field.padEnd(12)}`}),u.was.padEnd(l+2),(0,g.jsx)(k,{color:A.assuranceAccent,children:u.local.padEnd(l+2)}),u.origin]},u.field))]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(P,{label:"local",text:t.mine,accent:!0}),(0,g.jsx)(P,{label:o,text:t.theirs})]}),d?d.map((u,p)=>(0,g.jsx)(k,{color:A.dim,children:` ${u}`},`x-${p}`)):null,(0,g.jsx)(Le,{headline:`what should happen to the local ${t.verb} from record ${t.orig.seq}`,ask:!0,rows:s,sel:a,focused:c}),(0,g.jsx)(k,{color:A.dim,children:" \u2191\u2193 select \xB7 \u23CE confirm \xB7 1\u20139 jump \xB7 v full record \xB7 a decide everything later \xB7 ctrl+c pause"})]})}function vn({name:t,count:e,from:n,backupPath:r,taking:o,sel:i,focused:s}){let a=[{key:"continue",label:"continue",detail:"save, take, reapply"},{key:"not-now",label:"not now",detail:"nothing changes"}];return(0,g.jsxs)(M,{flexDirection:"column",children:[(0,g.jsx)(k,{bold:!0,children:`rebase from ${t}`}),(0,g.jsx)(P,{label:"local",text:`${e} record${e===1?"":"s"} from position ${n} saved to ${r}`}),(0,g.jsx)(P,{label:t,text:`records ${o.from}..${o.to} taken into this store`}),(0,g.jsx)(P,{label:"then",text:"the local records reapplied on top; a disagreement becomes a decision you answer"}),(0,g.jsx)(P,{label:"never",text:`history on ${t} rewritten`}),(0,g.jsx)(Le,{headline:"continue",ask:!0,rows:a,sel:i,focused:s}),(0,g.jsx)(k,{color:A.dim,children:" \u2191\u2193 select \xB7 \u23CE confirm \xB7 esc not now"})]})}var E=z(ie(),1);function Vr(t){let e=t.detail,n=c=>c&&typeof c=="object"&&!Array.isArray(c)?c:null,r=n(e.was),o=n(e.mine),i=n(e.theirs);if(!r||!o||!i)return[];let s=c=>c==null?"":typeof c=="string"?c:JSON.stringify(c);return[...new Set([...Object.keys(r),...Object.keys(o),...Object.keys(i)])].filter(c=>s(o[c])!==s(r[c])||s(i[c])!==s(r[c])).map(c=>({field:c,was:s(r[c]),local:s(o[c]),origin:s(i[c])}))}function oi(t,e,n,r){let o={"keep-theirs":`kept ${n}'s version`,"apply-mine":"applied the local version","apply-mine-as-new":"added the local version as new",later:"decided later","later-all":"decided later"},i=r&&"deduped"in r?`already present on ${n}`:r&&"skipped"in r&&e!=="keep-theirs"?`not reapplied (${r.skipped.reason})`:o[e];return`decision ${t.holdId}: ${i}`}var Xe=class{screen={kind:"idle"};version=0;interrupted=!1;scrollback={current:null};listeners=new Set;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));set(e){this.screen=e,this.emit()}note(e){this.scrollback.current?.append((0,E.jsx)(k,{children:e}))}flush(){return this.scrollback.current?.flush()??Promise.resolve()}emit(){this.version+=1;for(let e of this.listeners)e()}};function Gr(t){return(0,D.useSyncExternalStore)(t.subscribe,()=>t.version),t.screen}function Dr({ask:t,rows:e,done:n}){let[r,o]=(0,D.useState)(0),[i,s]=(0,D.useState)(!1);se((c,d)=>{if(d.ctrl&&c==="c")return n("later-all");if(d.escape)return n("later");if(c==="a")return n("later-all");if(c==="v")return s(u=>!u);if(d.upArrow)return o(u=>Math.max(0,u-1));if(d.downArrow)return o(u=>Math.min(e.length-1,u+1));if(d.return)return n(e[r].answer);let l=Number(c);Number.isInteger(l)&&l>=1&&l<=e.length&&o(l-1)});let a=Vr(t.card);return(0,E.jsx)(Rn,{card:t.card,index:t.index,total:t.total,rebaseId:t.rebaseId,location:t.location,diff:a,rows:e,sel:r,focused:!0,expanded:i?t.record:void 0})}function zr({ask:t,done:e}){let[n,r]=(0,D.useState)(0);return se((o,i)=>{if(i.ctrl&&o==="c"||i.escape)return e(!1);if(i.upArrow)return r(0);if(i.downArrow)return r(1);if(o==="1")return r(0);if(o==="2")return r(1);if(i.return)return e(n===0)}),(0,E.jsx)(vn,{...t,sel:n,focused:!0})}function Kr({store:t}){return se((e,n)=>{n.ctrl&&e==="c"&&(t.interrupted=!0)}),null}function Xr({store:t}){let e=Gr(t);return e.kind==="decide"?(0,E.jsx)(Dr,{ask:e.ask,rows:e.rows,done:e.done},e.ask.card.holdId):e.kind==="confirm"?(0,E.jsx)(zr,{ask:e.ask,done:e.done}):(0,E.jsx)(Kr,{store:t})}function Zr({store:t}){return(0,E.jsxs)(et,{children:[(0,E.jsx)(_t,{into:t.scrollback}),(0,E.jsx)(M,{flexDirection:"column",children:(0,E.jsx)(Xr,{store:t})})]})}function Qr(t,e){return kn(t,n=>Ke(t.kind,n,e),e)}function En(){let t=new Xe,e=null,n=async()=>{if(e)return;let{render:o}=await import("./build-5ZN47FAT.js");e=o((0,E.jsx)(Zr,{store:t}),{exitOnCtrlC:!1}),tt(()=>e?.unmount())},r=async()=>{if(!e)return;let o=e;e=null,await t.flush();let i=o.waitUntilExit().catch(()=>{});o.unmount(),await i,nt()};return{async confirm(o){await n();let i=await new Promise(s=>t.set({kind:"confirm",ask:o,done:s}));return t.set({kind:"idle"}),await r(),i},async decide(o){await n();let i=await new Promise(s=>t.set({kind:"decide",ask:o,rows:Qr(o.card,o.location),done:s}));return t.set({kind:"idle"}),i},note(o){t.note(o)},close:r,interrupted:()=>t.interrupted}}import{resolve as eo}from"path";import{fileURLToPath as to,pathToFileURL as no}from"url";var ro="us-east-1",oo=/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,$e="use file:///abs/path, an absolute or relative directory path, s3://<bucket>/<prefix>?endpoint=<url>®ion=<region>, or a GitHub HTTPS/SSH repository URL";function In(t,e){let n=t.trim();if(n==="")throw new Error(`a location is required \u2014 ${$e}`);if(/^(?:git\+)?https:\/\//i.test(n)||/^(?:git\+)?ssh:\/\//i.test(n)||/^[^/\s@:]+@[^/\s:]+:/.test(n)||n.startsWith("git+scp://"))return ao(n);if(!oo.test(n))return xn(eo(e,n));let r=new URL(n);switch(r.protocol){case"fake:":if(r.hostname==="")throw new Error(`fake:// needs a name \u2014 ${$e}`);return{kind:"fake",location:`fake://${r.hostname}`};case"file:":return xn(to(r));case"s3:":return so(r);default:throw new Error(`this release does not speak "${r.protocol}" \u2014 ${$e}`)}}function xn(t){return{kind:"dir",location:no(t).href,path:t}}function so(t){let e=t.hostname;if(e==="")throw new Error(`an s3 location needs a bucket \u2014 ${$e}`);let n=t.pathname.replace(/^\/+/,"").replace(/\/+$/,""),r=n===""?"":`${n}/`,o=t.searchParams.get("region")||ro;if(!/^[A-Za-z0-9-]{1,64}$/.test(o))throw new Error("the region must be letters, digits and dashes only, like us-east-1");let i=t.searchParams.get("endpoint"),s=i===null||i===""?null:io(i),a=s===null?`?region=${o}`:`?endpoint=${s}®ion=${o}`,c={kind:"s3",location:`s3://${e}/${r}${a}`,bucket:e,prefix:r,region:o};return s!==null&&(c.endpoint=s),c}function io(t){let e="the endpoint must be an http URL like http://127.0.0.1:9000",n;try{n=new URL(t)}catch{throw new Error(e)}if(n.protocol!=="http:"&&n.protocol!=="https:")throw new Error(e);if(n.username||n.password)throw new Error("an endpoint never carries a user name or password; pass credentials with --credential-env or --credential-file");if(n.search!==""||n.hash!==""||n.pathname!=="/")throw new Error(`the endpoint must be a host and port only, with no path or query \u2014 got ${n.origin}`);return`${n.protocol}//${n.host}`}var ye="Use a Git repository address with no dot or parent segments";function Se(t){return t.split("/").some(e=>e==="."||e==="..")}function ao(t){if(/[\x00-\x20\x7f]/.test(t))throw new Error("A Git location cannot contain whitespace or control characters");let e=t;if(e.startsWith("git+scp://")){let p=e.slice(10).replace(/[?#].*$/,"").replace(/^[^/]*/,"");if(Se(p.slice(1)))throw new Error(ye);let h=new URL(e);e=`${decodeURIComponent(h.username)}@${h.hostname}:${h.pathname.slice(1)}${h.search}${h.hash}`}else e=e.replace(/^git\+/,"");let n=e.indexOf("#"),r=n<0?"main":decodeURIComponent(e.slice(n+1)),o=n<0?e:e.slice(0,n),i=o.indexOf("?"),s=i<0?o:o.slice(0,i),a=new URLSearchParams(i<0?"":o.slice(i+1));for(let p of a.keys())if(p!=="prefix")throw new Error("https: and ssh: Git locations accept only the prefix query option; never put credentials in a location");if(a.getAll("prefix").length>1)throw new Error("Only one Git prefix may be supplied");let c=a.get("prefix")??"";if(c&&(!/^[a-zA-Z0-9_~./-]+$/.test(c)||c.split("/").some(p=>!p||p==="."||p===".."||p.toLowerCase()===".git")))throw new Error("Use a relative Git prefix with no empty, dot or parent segments");if(!/^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(r)||r.includes("..")||r.includes("//")||r.endsWith(".")||r.split("/").some(p=>!p||p.startsWith(".")||p.endsWith(".lock")))throw new Error("Use a valid Git branch name");let d=/^([^/@:]+)@([^/:]+):(.+)$/.exec(s),l;if(d){if(!/^[A-Za-z0-9._-]+$/.test(d[1])||!/^[A-Za-z0-9.-]+$/.test(d[2])||!/^[A-Za-z0-9_~./-]+$/.test(d[3]))throw new Error("Use a valid SSH repository address");if(Se(d[3]))throw new Error(ye);l=`git+scp://${d[1]}@${d[2]}/${d[3]}`}else{if(Se(s.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^/]*/,"")))throw new Error(ye);let p=new URL(s);if(!["https:","ssh:"].includes(p.protocol)||!p.hostname||!p.pathname||p.pathname==="/"||p.password||p.protocol==="https:"&&p.username)throw new Error("Use a secret-free HTTPS or SSH repository URL; sign in through Git instead");if(/%(?:00|0a|0d)/i.test(p.pathname))throw new Error("Invalid repository path");if(Se(p.pathname))throw new Error(ye);s=p.href,l=`git+${p.href}`}let u=c?`?${new URLSearchParams({prefix:c})}`:"";return{kind:"git",gitUrl:s,branch:r,prefix:c,location:`${l}${u}#${encodeURIComponent(r)}`}}function ci(t){if(t.kind==="dir")return t.path;if(t.kind!=="git")return t.location;let e=t.prefix?`?${new URLSearchParams({prefix:t.prefix})}`:"",n=t.branch&&t.branch!=="main"?`#${encodeURIComponent(t.branch)}`:"";return`${t.gitUrl}${e}${n}`}function Ze(t,e){(t.err??t.out)(`error: ${e}`)}function Si(t,e){let n=Rt(t);return co(n)?n:(Ze(e,"no context store here (run `kane-cli context ingest <files>` first)"),null)}async function $i(t,e,n){return n?!0:t.isTTY?t.confirm(`${e}?`):(Ze(t,`refusing to ${e} without --yes (no TTY to confirm)`),!1)}function ki(){return{out:t=>process.stdout.write(t+`
|
|
20
|
+
`),err:t=>process.stderr.write(t+`
|
|
21
|
+
`),isTTY:Ot(),walkUI:En,confirm:async t=>{let{createInterface:e}=await import("readline/promises"),n=e({input:process.stdin,output:process.stdout});try{let r=await n.question(`${t} [y/N] `);return/^y(es)?$/i.test(r.trim())}catch(r){if(r.name==="AbortError")return!1;throw r}finally{n.close()}},ask:async t=>{let{createInterface:e}=await import("readline/promises"),n=e({input:process.stdin,output:process.stdout});try{return await n.question(t)}finally{n.close()}}}}var lo=1500;function uo(t,e){return t==="behind"?`${e} has moved past this machine \u2014 run kane-cli context pull ${e}`:`this store and ${e} have diverged \u2014 run kane-cli context pull ${e} --rebase`}async function Ri(t,e,n){let r=await po(t,n);r&&e(r.text)}async function po(t,e){if(process.env.KANE_SYNC_GUARD==="0")return null;try{let n=Ut(t);if(n.locations.length===0)return null;let r=Wt(n),o=F(t).entries[r.name]?.witness;if(!o)return null;let{openProvider:i}=await import("./open-provider-OZAG6WZS.js"),s=i(In(r.location,t),r.name,e),a=await Promise.race([fo(t,s,o),ho()]);return a?{text:uo(a.kind,r.name),name:r.name,localSeq:a.localSeq,storageSeq:a.storageSeq}:null}catch{return null}}function vi(t){return{type:"sync_behind",name:t.name,local_seq:t.localSeq,storage_seq:t.storageSeq,text:t.text}}async function fo(t,e,n){try{let r=C(t),o=r?.seq??0;return await e.head(I(n.seq+1))?{kind:"behind",localSeq:o,storageSeq:(await J(e,n.seq+1)).seq}:r===null||(await te(e,r.seq)).hash===r.hash?null:{kind:"diverged",localSeq:o,storageSeq:(await J(e,r.seq)).seq}}catch{return null}}function ho(){return new Promise(t=>{setTimeout(()=>t(null),lo).unref()})}function mo(t){try{return gt(t),null}catch(e){if(e instanceof mt)return{code:e.code,text:e.message,remedy:e.remedy};throw e}}function Ei(t){return{type:"sync_error",code:t.code,detail:t.text,remedy:t.remedy}}function xi(t,e){let n=mo(t);return n?(Ze(e,n.text),(e.err??e.out)(`next: ${n.remedy}`),!0):!1}export{Q as a,Pe as b,Ut as c,$o as d,F as e,Mt as f,Wt as g,ko as h,te as i,J as j,zt as k,rs as l,Je as m,br as n,wr as o,yr as p,v as q,We as r,ln as s,vs as t,Es as u,nn as v,xs as w,Ps as x,Fs as y,Js as z,Bs as A,Mr as B,Us as C,Wr as D,Yr as E,Ms as F,Ws as G,gn as H,Hs as I,Ys as J,oi as K,In as L,ci as M,Ze as N,Si as O,$i as P,ki as Q,Ri as R,po as S,vi as T,mo as U,Ei as V,xi as W};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{O as W,ka as D}from"./chunk-UEE3RZN4.js";import{h as B,k as j,m as L,o as E,q as P}from"./chunk-PUVMC4PX.js";import{existsSync as I,mkdirSync as H,readdirSync as J,readFileSync as A,renameSync as Q,writeFileSync as X}from"fs";import{join as _}from"path";var Y=new Set(["duplicate","unwritable"]),Z=/^sha256:[0-9a-f]{64}$/,tt=/^@import\s+(\S+)\s*$/;function et(e,n,o,u){if(u===null||!("superseded"in e)||!("nodeLabel"in e))return!1;let r=e.resolve(n)?.tip;if(!r)return!1;for(let R of W(e,r)){let d=e.getNode(R)?.content;if(d?.definitionId===o&&typeof d.test_md_blob=="string")return P(e,d.test_md_blob)===u}return!1}function T(e,n){let o=e.resolve(n),u=o?String(e.getNode(o.tip)?.content.title??""):"";return u&&D(u,()=>!1)||n}function nt(e){return _(e,".testmuai","tests")}function rt(e){let n=new Map;if(!I(e))return n;for(let o of J(e)){if(!o.endsWith("_test.md"))continue;let u=_(e,o);try{let r=E(A(u,"utf8"))?.id;r&&n.set(r,[...n.get(r)??[],u])}catch{}}return n}function it(e,n,o){let u=`assurance:
|
|
3
|
+
id: ${n}
|
|
4
|
+
base: ${o}
|
|
5
|
+
`,r=e.endsWith(`
|
|
6
|
+
`)?e:e+`
|
|
7
|
+
`;return r.startsWith(`---
|
|
8
|
+
`)?`---
|
|
9
|
+
${u}${r.slice(4)}`:r.startsWith(`---\r
|
|
10
|
+
`)?`---\r
|
|
11
|
+
${u.replace(/\n/g,`\r
|
|
12
|
+
`)}${r.slice(5)}`:`---
|
|
13
|
+
${u}---
|
|
14
|
+
${r}`}function C(e,n){let o=`${e}.tmp-mint`;X(o,n),Q(o,e)}function dt(e){let{graph:n,cids:o,cwd:u}=e,r=nt(u),R=[],d=[],N=[],U=[],V=e.overwriteEdited===!0&&e.refuseUnwritable===!0,O=t=>{let f=n.resolve(t),l=f?n.getNode(f.tip)?.content.title:void 0;return typeof l=="string"&&l!==""?l:null},w=new Map,S=new Map,p=(t,f,l,g,y,m)=>{e.refuseUnwritable&&w.has(t)||(w.set(t,g??f),d.push({id:t,reason:l,kind:f,title:O(t),...g?{via:g}:{},...y?{imports:y}:{},...m?{file:m}:{}}))},b=rt(r),x=new Set,F=(t,f)=>{if(e.refuseUnwritable&&S.has(t))return S.get(t);if(e.refuseUnwritable&&w.has(t))return null;let l=b.get(t);if(l&&l.length>1)return p(t,"duplicate",`two files claim assurance.id ${t}: ${l.join(" \xB7 ")} \u2014 resolve the duplicate first`),null;if(x.has(t))return G(t);if(f.includes(t))return G(t)??`${T(n,t)}_test.md`;let g=n.resolve(t),y=g?n.getNode(g.tip):void 0,m=y?.content.test_md_blob,K=y?.content.definitionId;if(!m||!K)return p(t,"unresolved",`${t} has no test definition in the graph`),null;if(Z.test(m.trim()))return p(t,"unreadable","its text is held where this kane-cli can't read it"),null;let v=[],q=m.split(`
|
|
15
|
+
`).map(s=>{let a=tt.exec(s.trim());if(!a)return s;let c=a[1];if(!n.resolve(c))return s;let h=F(c,[...f,t]);if(!h&&!e.refuseUnwritable)throw new $(`dependency ${c} could not be minted/located`,w.get(c));return h?`@import ./${h}`:(v.push(c),s)});if(v.length>0){let s=v.map(a=>w.get(a));throw new $(`dependency ${v.join(", ")} could not be minted/located`,s.find(a=>a!==void 0&&!Y.has(a))??s[0],v.map(O))}let z=q.join(`
|
|
16
|
+
`),k=it(z,t,K),i=l?.[0];if(i){let s=A(i,"utf8"),a=E(s)?.base,c;try{c=B(j(s,L(r,n)))}catch(M){if(!e.refuseUnwritable)throw M;c=null}let h=!a||c!==a&&!et(n,t,a,c);if(h&&V){try{C(i,k)}catch(M){return p(t,"unwritable",M instanceof Error?M.message:String(M)),null}return x.add(t),b.set(t,[i]),U.push({id:t,path:i}),i.split("/").pop()}if(h)return p(t,"edited",`${i} was edited since the engine last wrote it \u2014 keeping yours (reconcile via a run or maintain)`,void 0,void 0,i),e.refuseUnwritable?(S.set(t,i.split("/").pop()),S.get(t)):null}else{let s=T(n,t),a=_(r,`${s}_test.md`);for(let c=2;I(a);c++)a=_(r,`${s}-${c}_test.md`);i=a}if(e.skipSame&&I(i)&&A(i,"utf8")===k)return x.add(t),b.set(t,[i]),N.push({id:t,path:i}),i.split("/").pop();try{H(r,{recursive:!0}),C(i,k)}catch(s){if(!e.refuseUnwritable)throw s;return p(t,"unwritable",s instanceof Error?s.message:String(s)),null}return x.add(t),b.set(t,[i]),R.push({id:t,path:i}),i.split("/").pop()},G=t=>b.get(t)?.[0]?.split("/").pop()??null;for(let t of o){let f=n.nameOf.get(t);if(!f){d.push({id:t,reason:"minted test has no logical id",kind:"unresolved",title:null});continue}try{F(f,[])}catch(l){if(l instanceof $)p(f,"import",l.message,l.via,l.imports);else throw l}}return{wrote:R,refused:d,...e.skipSame?{unchanged:N}:{},...e.overwriteEdited?{overwrote:U}:{}}}var $=class extends Error{constructor(o,u,r){super(o);this.via=u;this.imports=r}};export{T as a,nt as b,rt as c,dt as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{g as l}from"./chunk-4I7YN6YY.js";import{existsSync as u,readdirSync as d,readFileSync as f}from"fs";import{join as o}from"path";var m="--variables",g=["global","smart","environment","secrets","totp"],p=/^[a-z][a-z0-9_]*$/;function x(r){return typeof r=="string"?r.trim().length>0:typeof r=="number"&&Number.isFinite(r)}function a(r,e,n){let t=JSON.parse(r);if(!(!t||typeof t!="object")){for(let[i,s]of Object.entries(t))if(s&&typeof s=="object"&&"value"in s){let b={has_value:x(s.value),source:e};n.set(y(i),b)}}}function c(r,e){if(!u(r))return;let n;try{n=d(r).filter(t=>t.endsWith(".json")).sort()}catch{return}for(let t of n){let i=o(r,t);try{a(f(i,"utf-8"),i,e)}catch{}}}function w(r){return{globalDir:o(l().baseDir,"variables"),localDir:o(r,".testmuai","variables")}}function I(r){let e=new Map;if(c(r.globalDir,e),c(r.localDir,e),r.file&&u(r.file))try{a(f(r.file,"utf-8"),r.file,e)}catch{}if(r.inline)try{a(r.inline,m,e)}catch{}return e}function N(r){let e=r.trim();if(!e)return null;let n=e.split(/[.[]/).map(t=>t.trim()).filter(Boolean);return n.length===0||g.includes(n[0])?null:n[0]}function y(r){let e=/^(?:global|secrets\.user|environment)\.(.+)$/.exec(r);return e?e[1]:r}function V(r){if(!r||!r.trim())return"variable name is empty";let e=r.split(".")[0];return g.includes(e)?`'${r}' starts with a runtime namespace (global/secrets/smart/environment/totp) \u2014 declare the bare name`:p.test(r)?null:`'${r}' is not lower_snake_case (letters, digits, underscores; starts with a letter)`}export{m as a,w as b,I as c,N as d,y as e,V as f};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{e as R}from"./chunk-ZCRZFAOT.js";import{a as O}from"./chunk-RZ4F3BHX.js";var C={ASR_CMD_START:"info",ASR_CMD_END:"info",ASR_AGENT_SPAWN:"info",ASR_WORK_ITEM_START:"info",ASR_WORK_ITEM_END:"info",ASR_PROPOSAL:"info",ASR_VALIDATE_FAILED:"warn",ASR_COMMIT:"info",ASR_SESSION_PAUSED:"info",ASR_SESSION_RESUMED:"info",ASR_SESSION_COMPLETE:"info",ASR_AGENT_EXIT:"warn",ASR_RECONCILE_PLAN:"info",ASR_RECONCILE_ROW_END:"info",ASR_HIGH_RISK_CI:"warn",ASR_INGEST:"info",ASR_EMBED_DEGRADED:"warn",ASR_CONTEXT_CLONED:"warn",ASR_ERROR:"error",ASR_CRASH:"error",ASR_FSCK_REPORT:"warn"},L={ASR_CMD_START:["source_count","resumed","applied_plan"],ASR_CMD_END:["exit_code","duration_ms","credits_total","work_items_total","work_items_failed"],ASR_AGENT_SPAWN:["tier","duration_ms"],ASR_WORK_ITEM_START:["work_item_index","work_item_count","source_kind"],ASR_WORK_ITEM_END:["work_item_index","work_item_count","outcome","duration_ms","error_domain","error_code"],ASR_PROPOSAL:["item_count","turn_index"],ASR_VALIDATE_FAILED:["error_code","count","turn_index"],ASR_COMMIT:["trusted","derived","archived","items","items_dropped","record_seq","phase","duration_ms"],ASR_SESSION_PAUSED:["pending_questions","pending_proposals"],ASR_SESSION_RESUMED:["resume_count","expired_session_id"],ASR_SESSION_COMPLETE:["duration_ms","credits_total"],ASR_AGENT_EXIT:["exit_code","signal"],ASR_RECONCILE_PLAN:["row_count","add_count","modify_count","archive_count"],ASR_RECONCILE_ROW_END:["row_index","kind","outcome","duration_ms"],ASR_HIGH_RISK_CI:["count"],ASR_INGEST:["work_item_index","work_item_count","format","bytes","media_facts"],ASR_EMBED_DEGRADED:["held"],ASR_CONTEXT_CLONED:[],ASR_ERROR:["error_domain","error_code","exit_code","turn_index","request_id"],ASR_CRASH:["error_domain","error_code","error_name"],ASR_FSCK_REPORT:["issue_count","records","pending","codes","issues","issues_truncated"]},U=[[/^lattice_/,"lattice"],[/^refused_/,"refused"],[/^(auth_expired|401|preflight_auth|AUTH)/i,"auth"],[/^(credit_denied|402|CREDIT)/i,"credit"],[/^(stream_drop|read_timeout|connect_failed|dns|E(CONN|AI_AGAIN|TIMEDOUT)|network)/i,"network"],[/^(frame_parse|post_terminal_data|eof_without_terminal|turn_id_mismatch|binding_mismatch|schema_invalid|frame_too_large|protocol)/i,"protocol"],[/^(provider_error|http_5\d\d|turn_exhausted|adapter_integrity)/i,"provider"],[/^(STALE_BASIS|R\d+|validation|criteria)/i,"validation"],[/^(CHAIN_ERROR|DERIVED_(MISSING|DRIFT)|NODE_FILE_(MISSING|MISMATCH|CORRUPT)|CARDINALITY_VIOLATION|SUPERSEDE_(UNKNOWN_(OLD|NEW|ECID)|CYCLE)|DOUBLE_SUPERSEDE|NAME_UNKNOWN_TARGET|EDGE_CYCLE|UNKNOWN_(LABEL|FIELD|EDGE_TYPE|EDGE_PROP)|BAD_(CHECK|ENUM)|MISSING_(FIELD|SALIENT)|ILLEGAL_EDGE)$/,"graph"],[/^(BLOB_MISSING|SOURCE_UNKNOWN|SESSION_(LOCKED|EXPIRED|MISSING|LOCK_LOST)|NO_STORE|fsck|store)/i,"store"],[/^(usage|EX2|SOURCE_WITH_RESUME|HIGH_RISK_CI|bad_flag|no_tty)/i,"usage"],[/^exit_\d+_unattributed$/,"unattributed"],[/^agent_(crash|exit)/i,"agent_crash"]];function v(e){let t=(e||"unknown").slice(0,64);for(let[n,r]of U)if(n.test(t))return{error_domain:r,error_code:t};return{error_domain:"cli_crash",error_code:t}}import{randomBytes as w}from"crypto";var b=/^(uc|sc|ac|t|gap|sty)-\d+$/,K="0123456789abcdefghijklmnopqrstuvwxyz";function W(e){let t="",n=w(e);for(let r=0;r<e;r++)t+=K[n[r]%36];return t}function se(e=new Date){let t=(r,o)=>String(r).padStart(o,"0");return`as-${`${e.getUTCFullYear()}${t(e.getUTCMonth()+1,2)}${t(e.getUTCDate(),2)}T${t(e.getUTCHours(),2)}${t(e.getUTCMinutes(),2)}`}-${W(8)}`}var M=-1,S=0;function ce(e=new Date){let t=e.getTime(),n=w(10);t===M?S=S+1&4095:(M=t,S=(n[0]<<8|n[1])&4095);let r=Buffer.alloc(16);r.writeUIntBE(t,0,6),r[6]=112|S>>8,r[7]=S&255,r[8]=128|n[2]&63,n.copy(r,9,3,10);let o=r.toString("hex");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}var B=64,P=128,$=/^[A-Za-z0-9._:@\/-]+$/,j={codes:512},H={ASR_FSCK_REPORT:["issues"]},X=20480,V=0;function q(e,t){if(typeof t=="number"&&Number.isFinite(t)||typeof t=="boolean")return t;if(typeof t!="string")return;let n=e.endsWith("_id")||e==="signal"?P:j[e]??B;if(!(t.length===0||t.length>n)&&$.test(t))return t}var k=e=>e!==void 0&&e.length>0&&e.length<=P&&$.test(e);function F(e,t,n={}){let r=L[t],o={};for(let s of r){let i=n[s];if(i==null)continue;if(H[t]?.includes(s)){if(typeof i!="string"||i.length===0)continue;let _=i.replace(/[\u0000-\u001F\u007F]/g,"");if(Buffer.byteLength(_,"utf8")>X)continue;o[s]=_;continue}if(s==="items"){let _=Array.isArray(i)?i.filter(E=>typeof E=="string"):[],u=_.filter(E=>b.test(E));u.length>0&&(o.items=u.slice(0,50).join(","));let p=_.length-u.length;p>0&&(o.items_dropped=p);continue}let a=q(s,i);a!==void 0&&(o[s]=a)}if(typeof n.error_code=="string"&&r.includes("error_code")){let{error_domain:s,error_code:i}=v(n.error_code);o.error_code=i,r.includes("error_domain")&&(o.error_domain=s)}return{level:C[t],event:t,message:t,session_id:e.session_id,operation_id:e.operation_id,...e.parent_operation_id?{parent_operation_id:e.parent_operation_id}:{},...e.agent_session_id?{agent_session_id:e.agent_session_id}:{},context_lineage_id:e.context_lineage_id??null,context_instance_id:e.context_instance_id??null,...k(e.lattice_session_id)?{lattice_session_id:e.lattice_session_id}:{},...k(e.project_id)?{project_id:e.project_id}:{},verb:e.verb,mode:e.mode,component:"kane-cli",seq:V++,event_time:new Date().toISOString(),context:o}}import c from"fs";import A from"path";var z=500,Y=7,J=512*1024,Z=15*6e4;function y(e){if(e.length!==0)try{let t=R();c.mkdirSync(A.dirname(t),{recursive:!0});let n=e.map(o=>JSON.stringify(o)).join(`
|
|
3
|
+
`)+`
|
|
4
|
+
`;c.appendFileSync(t,n,{flag:"a",mode:384});let r=0;try{r=c.statSync(t).size}catch{r=0}r>J&&re()}catch{}}function Q(e){try{let t=A.dirname(e),n=A.basename(e);for(let r of c.readdirSync(t)){if(!r.startsWith(`${n}.claim-`)&&!r.startsWith(`${n}.prune-`))continue;let o=A.join(t,r),s=Number(r.slice(r.lastIndexOf("-")+1));if(s===process.pid)continue;let i=!1;if(Number.isFinite(s)&&s>0)try{process.kill(s,0),i=!0}catch{i=!1}let a=!i;if(i)try{a=Date.now()-c.statSync(o).mtimeMs>Z}catch{a=!1}if(a)try{let _=c.readFileSync(o,"utf8");_.trim()&&c.appendFileSync(e,_.endsWith(`
|
|
5
|
+
`)?_:_+`
|
|
6
|
+
`,{flag:"a",mode:384}),c.unlinkSync(o)}catch{}}}catch{}}function Se(e){ee(e).catch(()=>{})}function ee(e){return te(async t=>{try{return(await O(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok}catch{return!1}})}var G=Promise.resolve();function te(e){let t=G.then(()=>ne(e));return G=t.catch(()=>{}),t}async function ne(e){let t=R();Q(t);let n=`${t}.claim-${process.pid}`,r;try{c.renameSync(t,n),r=c.readFileSync(n,"utf8")}catch{return}let o=[];for(let s of r.split(`
|
|
7
|
+
`))if(s.trim())try{o.push(JSON.parse(s))}catch{}try{(o.length===0?!0:await e(o))?c.unlinkSync(n):(c.appendFileSync(t,r,{flag:"a",mode:384}),c.unlinkSync(n))}catch{try{c.appendFileSync(t,r,{flag:"a",mode:384}),c.unlinkSync(n)}catch{}}}function re(e=z,t=Y){try{let n=R(),r=`${n}.prune-${process.pid}`;c.renameSync(n,r);let s=c.readFileSync(r,"utf8").split(`
|
|
8
|
+
`).filter(u=>u.trim()),i=Date.now()-t*24*3600*1e3,_=s.filter(u=>{try{let p=JSON.parse(u),E=Date.parse(p.event_time??p.timestamp??"");return Number.isNaN(E)||E>=i}catch{return!1}}).slice(-e);_.length>0&&c.appendFileSync(n,_.join(`
|
|
9
|
+
`)+`
|
|
10
|
+
`,{flag:"a",mode:384}),c.unlinkSync(r)}catch{}}var f=null;function Ae(e){f=e}function ye(){return f}var N=()=>!!process.env.KANE_DEV_MODE,d=[],h=!1,D=null,m=null,T=null,l=null,g=[];function Ie(e){if(l=e,e&&g.length>0){let t=g;g=[];for(let n of t)try{e.log(n.level,n.event,n.message,n.context)}catch{}}}function he(e,t,n,r){if(l){try{l.log(e,t,n,r)}catch{}return}g.push({level:e,event:t,message:n,context:r})}function Te(){return l}function Ne(){return h}function De(e,t){d=d.filter(n=>n.name!==e),d.push({name:e,fn:t})}function xe(e){d=d.filter(t=>t.name!==e)}function Oe(e,t){let n=d.find(o=>o.name===e);if(!n)return;d=d.filter(o=>o.name!==e);let r=!0;try{n.fn()}catch(o){r=!1,process.stderr.write(`[exit-manager] cleanup(${e}) failed: ${o instanceof Error?o.message:String(o)}
|
|
11
|
+
`)}t&&r&&N()&&process.stderr.write(`[exit-manager] cleanup(${e}): ${t}
|
|
12
|
+
`)}async function Ce(e=1e3){let t=l;if(!(!t?.stopAndFlushOnce||!t.drainBuffer))try{let n=await t.stopAndFlushOnce(e);if(n!=="sent"&&n!=="empty"){let r=t.drainBuffer();r.length>0&&y(r)}}catch{}}function I(e,t,n=!1,r){if(h){process.exit(D??e);return}if(h=!0,D=e,n&&l)try{l.log("error","CRASH",t);let i=l.drainBuffer?.()??[];i.length>0&&y(i),l.shutdownSync()}catch{}if(n&&f&&e!==130&&e!==143)try{let i=/Uncaught exception:\s*([A-Za-z0-9_$]+)/.exec(t)?.[1]??"crash";y([F(f,"ASR_CRASH",{error_code:"cli_crash",error_name:i})])}catch{}let o=[...d].reverse(),s=[];for(let i of o)try{i.fn(),s.push(i.name)}catch(a){process.stderr.write(`[exit-manager] cleanup(${i.name}) failed: ${a instanceof Error?a.message:String(a)}
|
|
13
|
+
`)}if(d=[],N()&&(process.stderr.write(`[exit-manager] shutdown(${e}): ${t}
|
|
14
|
+
`),s.length>0&&process.stderr.write(`[exit-manager] cleaned up: ${s.join(", ")}
|
|
15
|
+
`)),n){if(T)try{T()}catch{}e===130||e===143||(process.stderr.write(`
|
|
16
|
+
kane-cli crashed: ${t}
|
|
17
|
+
`+(s.length>0?`Resources cleaned up (${s.join(", ")}).
|
|
18
|
+
`:"")),f&&process.stderr.write(`session: ${f.session_id} \u2014 share this id with support
|
|
19
|
+
`),r&&N()?process.stderr.write(`${r}
|
|
20
|
+
`):process.stderr.write(`(re-run with KANE_DEV_MODE=1 for the full stack)
|
|
21
|
+
`)),process.exit(e);return}if(m&&!n){m();return}process.exit(e)}function Le(e){m=e}function ve(){m=null}function Me(e){T=e}var x=!1;function we(){x||(x=!0,process.on("SIGINT",()=>{I(130,"Received SIGINT",!0)}),process.on("SIGTERM",()=>{I(143,"Received SIGTERM",!0)}),process.on("uncaughtException",e=>{I(1,`Uncaught exception: ${e.name}: ${e.message}`,!0,e.stack)}),process.on("unhandledRejection",e=>{I(1,`Unhandled rejection: ${String(e)}`,!0,e instanceof Error?e.stack:void 0)}))}function be(){d=[],h=!1,D=null,m=null,T=null,l=null,g=[],x=!1,f=null}export{se as a,ce as b,C as c,F as d,y as e,Se as f,ee as g,Ae as h,ye as i,Ie as j,he as k,Te as l,Ne as m,De as n,xe as o,Oe as p,Ce as q,I as r,Le as s,ve as t,Me as u,we as v,be as w};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{e as L}from"./chunk-457Y5TEC.js";async function T(n,i,c){let[h,d,l,m,a]=await Promise.all([c.includes("source")?n.sources(i):Promise.resolve([]),c.includes("usecase")?n.nodes(i,"usecase"):Promise.resolve([]),c.includes("usecase")?n.stale(i):Promise.resolve([]),c.includes("scenario")?n.nodes(i,"scenario"):Promise.resolve([]),c.includes("test")?n.nodes(i,"test"):Promise.resolve([])]),o=new Set;for(let e of l.filter(s=>s.label==="scenario"&&(s.freshness==="stale"||s.freshness==="orphaned"))){let s=await n.mainNode(i,e.cid);for(let t of s.edgesOut)t.type==="belongs_to"&&t.other?.name&&(t.other.freshness==="superseded"||t.other.supersededBy)&&o.add(t.other.name)}let r=h.filter(e=>e.head!==null).map(e=>{let s=L(e.origin);return{id:e.sourceId,label:"source",title:e.sourceId,trust:"-",fresh:"fresh",upToDate:"yes",...s?{shown:s}:{}}}),R=d.map(e=>{let s=e.name??"-";if(e.trust==="archived")return{id:s,label:"usecase",title:e.title??"",trust:e.trust,fresh:"-",upToDate:"archived"};let t=e.name!==null&&o.has(e.name),u=e.freshness??"fresh",f=u==="stale"?"source_changed":u==="orphaned"?"source_removed":t?"tests_out_of_date":"yes";return{id:s,label:"usecase",title:e.title??"",trust:e.trust,fresh:u,...t?{testsFresh:"stale"}:{},upToDate:f}}),g=(e,s)=>e.map(t=>{let u=t.name??"-",f=t.title??"";if(t.trust==="archived")return{id:u,label:s,title:f,trust:t.trust,fresh:"-",upToDate:"archived"};let w=t.freshness??"fresh",b=w==="stale"?"designed_from_changed":w==="orphaned"?"source_removed":"yes";return{id:u,label:s,title:f,trust:t.trust,fresh:w,upToDate:b}}),y=g(m,"scenario"),_=g(a,"test"),v=e=>Number(/^[a-z]+-(\d+)$/i.exec(e.id)?.[1]??Number.MAX_SAFE_INTEGER),p=(e,s)=>v(e)-v(s)||e.title.localeCompare(s.title);return r.sort((e,s)=>e.id.localeCompare(s.id)),R.sort(p),y.sort(p),_.sort(p),[...r,...R,...y,..._]}async function P(n,i){let c=(await n.nodes(i,"test")).filter(a=>a.trust!=="archived"),h=new Set((await n.nodes(i,"scenario")).filter(a=>a.trust==="archived").map(a=>a.cid)),d=new Set;for(let a of c){let o=await n.mainNode(i,a.cid);for(let r of o.edgesOut)r.type==="automates"&&r.other!==null&&d.add(r.other.cid)}let l=new Set,m=new Set;for(let a of d){let o=await n.mainNode(i,a);for(let r=0;o.supersededBy!==null&&o.supersededBy!==""&&r<64;r++)o=await n.mainNode(i,o.supersededBy);if(!(o.supersededBy===""||m.has(o.cid))&&(m.add(o.cid),!h.has(o.cid)))for(let r of o.edgesOut)r.type==="belongs_to"&&r.other?.name&&l.add(r.other.name)}return l}export{T as a,P as b};
|