@testmuai/kane-cli 0.10.2 → 0.10.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-FIYDTZSI.js → ChatSurface-Z26BOE5U.js} +1 -1
- package/dist/{ChromeProfilePicker-Q6FIGVYU.js → ChromeProfilePicker-ODRIAXL3.js} +1 -1
- package/dist/{CliFeedbackPrompt-2NV2G65E.js → CliFeedbackPrompt-JWCTMIGI.js} +1 -1
- package/dist/{CliUploadProgress-JZ5FXODE.js → CliUploadProgress-XFRRFRL4.js} +1 -1
- package/dist/{ConfigView-TZ4YINOE.js → ConfigView-6JF4DOJN.js} +1 -1
- package/dist/{EvidenceViewOffer-LKPN5BHX.js → EvidenceViewOffer-6344EX74.js} +1 -1
- package/dist/FolderPicker-4PCYHE75.js +2 -0
- package/dist/InfoBox-NJ2DL7YC.js +2 -0
- package/dist/{LinksBox-32TZOANP.js → LinksBox-HNDNFVUT.js} +1 -1
- package/dist/{ProfilesView-UC4MPM54.js → ProfilesView-DEJKJOHY.js} +1 -1
- package/dist/ProjectPicker-DTWMWOH7.js +2 -0
- package/dist/SaveSessionPrompt-3GCLB3ZT.js +2 -0
- package/dist/SingleShotApp-HMOXO5DW.js +2 -0
- package/dist/{SummaryBox-XGFO5X76.js → SummaryBox-7PPDMSSM.js} +1 -1
- package/dist/TestMdRunView-QLKRUU4V.js +2 -0
- package/dist/TestrunEvidenceTable-T2JUB4TE.js +2 -0
- package/dist/{WhoamiView-4XIJXMTU.js → WhoamiView-H7JNLLCY.js} +1 -1
- package/dist/{app-download-XEDO3EMV.js → app-download-GKRF2EIM.js} +1 -1
- package/dist/{assurance-job-MD65GQLC.js → assurance-job-F4L3T4VJ.js} +1 -1
- package/dist/{binary-NVYLR36K.js → binary-K3XMILST.js} +1 -1
- package/dist/{bind-H3ALI2NG.js → bind-SSHAZAB3.js} +1 -1
- package/dist/{bootstrap-JEVSVPQ2.js → bootstrap-XGKU4WXB.js} +1 -1
- package/dist/{catalog-5UYBWA4W.js → catalog-YCU6OHNV.js} +1 -1
- package/dist/{catalog-client-VVKV4JKW.js → catalog-client-MVEEHTG2.js} +1 -1
- package/dist/{changelog-FPWJXERY.js → changelog-5UB3AQT6.js} +1 -1
- package/dist/{chunk-GJ7MO2FW.js → chunk-2JFRN62I.js} +2 -2
- package/dist/chunk-2RBMQTYS.js +26 -0
- package/dist/{chunk-44SIFDNY.js → chunk-2TK4MDF2.js} +1 -1
- package/dist/{chunk-P4VFC6HO.js → chunk-35WUYKGO.js} +1 -1
- package/dist/{chunk-XCUF5AVM.js → chunk-3MD2XLE7.js} +2 -2
- package/dist/{chunk-TMH4TPMB.js → chunk-3NWUXRSI.js} +1 -1
- package/dist/{chunk-NVD2MXHQ.js → chunk-3RO2YGKH.js} +1 -1
- package/dist/{chunk-QUNIY6NN.js → chunk-3ZC7GSMM.js} +1 -1
- package/dist/{chunk-LXCTV75T.js → chunk-4CJQ7XZP.js} +1 -1
- package/dist/{chunk-LWCP4GLY.js → chunk-4KL3TSTT.js} +5 -5
- package/dist/{chunk-2ULYGALF.js → chunk-4UX5N7YI.js} +1 -1
- package/dist/{chunk-5KJU4MG4.js → chunk-5YYCCM6K.js} +1 -1
- package/dist/{chunk-IT5JVCZN.js → chunk-6FFX4S7N.js} +1 -1
- package/dist/{chunk-HM6LZ2KM.js → chunk-6HRNG4CK.js} +1 -1
- package/dist/{chunk-OK6NLITG.js → chunk-6QCCTZO3.js} +1 -1
- package/dist/{chunk-ZZZGTDYE.js → chunk-6QH75BPJ.js} +1 -1
- package/dist/{chunk-6SWHEBPR.js → chunk-7RELCXRW.js} +1 -1
- package/dist/{chunk-S7XCOBYD.js → chunk-7SU53QGU.js} +1 -1
- package/dist/{chunk-6JUS2ULI.js → chunk-7Y55CO42.js} +1 -1
- package/dist/{chunk-B57ZRHEQ.js → chunk-7YV2FCN4.js} +1 -1
- package/dist/{chunk-PC22QRIY.js → chunk-A2DODRHG.js} +1 -1
- package/dist/{chunk-ABMM37L2.js → chunk-AHT2ORJT.js} +1 -1
- package/dist/{chunk-A7IMHUFY.js → chunk-AT7AT3AR.js} +2 -2
- package/dist/{chunk-5WLXAQ4H.js → chunk-AVLYSNEG.js} +1 -1
- package/dist/{chunk-ZO3ZAMUU.js → chunk-BBJAKSA7.js} +1 -1
- package/dist/{chunk-DLP5S3TO.js → chunk-BJO6J5X2.js} +1 -1
- package/dist/{chunk-EEOAU43D.js → chunk-BLVDV3QQ.js} +1 -1
- package/dist/{chunk-I52NWH4U.js → chunk-C4KAPGBS.js} +1 -1
- package/dist/{chunk-7O2FIZB7.js → chunk-CB2BWDHG.js} +2 -2
- package/dist/{chunk-HWPWCCEV.js → chunk-CNHKZE4F.js} +1 -1
- package/dist/{chunk-5F44KH3R.js → chunk-CTHUX7O4.js} +1 -1
- package/dist/{chunk-FYPIF3BE.js → chunk-DC5F2ADJ.js} +1 -1
- package/dist/chunk-DIOK3SER.js +34 -0
- package/dist/{chunk-NCP54AIQ.js → chunk-DQXQJJOP.js} +2 -2
- package/dist/{chunk-W2HRX3DR.js → chunk-EBJW6POT.js} +1 -1
- package/dist/{chunk-GZQAETB2.js → chunk-EJGCIGQY.js} +1 -1
- package/dist/{chunk-7ZR5CQY3.js → chunk-ERRIDBE7.js} +1 -1
- package/dist/chunk-F2F257PU.js +6 -0
- package/dist/{chunk-EAWU2TOG.js → chunk-GQAWZEA4.js} +1 -1
- package/dist/{chunk-2QKBXRLI.js → chunk-GXQYFOBD.js} +1 -1
- package/dist/{chunk-RRKYHUOD.js → chunk-HBLHKQR7.js} +1 -1
- package/dist/chunk-HC6VLPUB.js +5 -0
- package/dist/{chunk-JUVY6PHY.js → chunk-HRIDAK6Y.js} +1 -1
- package/dist/{chunk-5MFPQYW3.js → chunk-HV2CDY4K.js} +1 -1
- package/dist/{chunk-YO6SNXBJ.js → chunk-IEHJG6J4.js} +1 -1
- package/dist/{chunk-FAMQ4DHU.js → chunk-J4FIESTB.js} +1 -1
- package/dist/{chunk-UICJ2KLJ.js → chunk-JBKHX5ES.js} +1 -1
- package/dist/{chunk-6CS23F3E.js → chunk-KBGMQYMD.js} +1 -1
- package/dist/{chunk-ZDQYGLCZ.js → chunk-KCXLRR3Q.js} +1 -1
- package/dist/{chunk-KN7GZWKK.js → chunk-KL7XFNSD.js} +1 -1
- package/dist/{chunk-V3OZJO7Y.js → chunk-KQ4XKTIZ.js} +1 -1
- package/dist/{chunk-PR5EGLEI.js → chunk-LHJSIHLC.js} +1 -1
- package/dist/{chunk-75FF7J5R.js → chunk-LPJKNX6D.js} +1 -1
- package/dist/{chunk-3V4J65GN.js → chunk-LRNUGKYH.js} +1 -1
- package/dist/{chunk-POA336CU.js → chunk-LUA25RYS.js} +1 -1
- package/dist/{chunk-BHQIH2FE.js → chunk-LV7224DG.js} +1 -1
- package/dist/{chunk-73HMW2WA.js → chunk-LXK4B2FE.js} +1 -1
- package/dist/{chunk-PWNYTIVA.js → chunk-M2E5CPPV.js} +1 -1
- package/dist/{chunk-OVNTCBNS.js → chunk-M7A66MSK.js} +1 -1
- package/dist/{chunk-MP6NCJFE.js → chunk-MD3RABID.js} +1 -1
- package/dist/{chunk-AUSLHNXQ.js → chunk-MEBEVHGP.js} +1 -1
- package/dist/{chunk-C6P6YUCR.js → chunk-N7IWR45S.js} +1 -1
- package/dist/{chunk-M3TFOFUQ.js → chunk-ND6OP3O2.js} +1 -1
- package/dist/{chunk-226AGYHB.js → chunk-NHGPMYM3.js} +1 -1
- package/dist/{chunk-VE4HLIGA.js → chunk-NI3TIAD7.js} +1 -1
- package/dist/{chunk-GQARXS6F.js → chunk-NPAUSUNM.js} +1 -1
- package/dist/{chunk-HX5OLRKU.js → chunk-NRAPCFI2.js} +2 -2
- package/dist/{chunk-RAVAJZV2.js → chunk-NZJSGINB.js} +16 -16
- package/dist/{chunk-X3A4QPA3.js → chunk-OBNVGD5H.js} +1 -1
- package/dist/{chunk-Q5AKIQIE.js → chunk-OCMPWCKQ.js} +1 -1
- package/dist/{chunk-BJT6PZXL.js → chunk-OCVDMZWB.js} +1 -1
- package/dist/{chunk-XZ6J3Y2W.js → chunk-OHGL4GEJ.js} +1 -1
- package/dist/{chunk-54NJJVG5.js → chunk-OOGKX4Y6.js} +1 -1
- package/dist/{chunk-UMNCM4RJ.js → chunk-OTMHCHH6.js} +2 -2
- package/dist/{chunk-45NM23EQ.js → chunk-OZNYQONA.js} +1 -1
- package/dist/{chunk-D4QXYAYA.js → chunk-PB6RXDWQ.js} +2 -2
- package/dist/{chunk-2GEAKFAV.js → chunk-PCQK62MP.js} +1 -1
- package/dist/{chunk-HHOVANJ7.js → chunk-PTLOOVV4.js} +1 -1
- package/dist/{chunk-QB77LRF4.js → chunk-Q4ALB7SH.js} +1 -1
- package/dist/{chunk-A474TUCE.js → chunk-Q4SMITTV.js} +1 -1
- package/dist/{chunk-HNF3PWF3.js → chunk-QE4AWNOV.js} +3 -3
- package/dist/{chunk-6YBH3WUW.js → chunk-QEM5ZRDN.js} +1 -1
- package/dist/{chunk-MSYRAPDK.js → chunk-QHH42RH5.js} +1 -1
- package/dist/{chunk-IB5WG5YY.js → chunk-RNHSULQM.js} +1 -1
- package/dist/chunk-SB26HQO7.js +2 -0
- package/dist/{chunk-QVMXL675.js → chunk-SJQTTEXQ.js} +1 -1
- package/dist/{chunk-UCVP7ZY4.js → chunk-SMGRXKXX.js} +1 -1
- package/dist/{chunk-RDAIOJCR.js → chunk-SXBPUUQ5.js} +1 -1
- package/dist/{chunk-K75WIRI5.js → chunk-TM45NPWL.js} +1 -1
- package/dist/{chunk-7DLDADQR.js → chunk-TUSG7DIL.js} +1 -1
- package/dist/{chunk-K4K2BGQC.js → chunk-UJ37XGSP.js} +3 -3
- package/dist/{chunk-DXLZCJH5.js → chunk-ULIIYKZB.js} +1 -1
- package/dist/{chunk-7PCLHURF.js → chunk-UXGMKRS4.js} +61 -60
- package/dist/{chunk-IH73ZCBB.js → chunk-VCVEZEVS.js} +1 -1
- package/dist/{chunk-XNXJXGVB.js → chunk-VKVYT6KZ.js} +2 -2
- package/dist/{chunk-PEUIHME2.js → chunk-VO2NNXKR.js} +1 -1
- package/dist/{chunk-H4TIVILC.js → chunk-WE7HRAGO.js} +1 -1
- package/dist/{chunk-O5KTMDTH.js → chunk-WIVKLNIO.js} +1 -1
- package/dist/chunk-WLEWXE6L.js +2 -0
- package/dist/{chunk-3YIA3DSL.js → chunk-X2MDL6S4.js} +1 -1
- package/dist/{chunk-M7Y5GGVJ.js → chunk-X45RZIAJ.js} +1 -1
- package/dist/{chunk-4LGQHTXM.js → chunk-XKOVEMVZ.js} +1 -1
- package/dist/{chunk-4HARMERK.js → chunk-Y2HQMJGS.js} +1 -1
- package/dist/{chunk-B226SFOV.js → chunk-Y3RJHWNK.js} +1 -1
- package/dist/{chunk-4HYPMGDF.js → chunk-YCVEI7BT.js} +1 -1
- package/dist/{chunk-HG2ILWCE.js → chunk-YILRYMMG.js} +1 -1
- package/dist/{chunk-2COXO5LQ.js → chunk-YNDELIXL.js} +1 -1
- package/dist/{chunk-4NEPHIAO.js → chunk-YPGZ5E4I.js} +1 -1
- package/dist/{chunk-GT3JDX5H.js → chunk-YQZ736IQ.js} +1 -1
- package/dist/{chunk-XHFU5TGS.js → chunk-YVVFXBT5.js} +1 -1
- package/dist/{chunk-ET5EK2CM.js → chunk-YWWVF5OU.js} +1 -1
- package/dist/{chunk-OKA6FPJM.js → chunk-Z47ZEFH7.js} +1 -1
- package/dist/{chunk-FI2DVNRT.js → chunk-ZCBOHWN3.js} +1 -1
- package/dist/{chunk-7XJNYLQW.js → chunk-ZIHQ5JGB.js} +4 -4
- package/dist/{chunk-Z6SI7YNV.js → chunk-ZMIKNNO6.js} +1 -1
- package/dist/{chunk-O3TXAMFW.js → chunk-ZPU3WAC4.js} +1 -1
- package/dist/{commands-R5AYK6XM.js → commands-JBFLLT7A.js} +1 -1
- package/dist/{config-YMHI3H3Y.js → config-7WTZPMAH.js} +1 -1
- package/dist/{cover-cmd-DVQIGFDY.js → cover-cmd-DU6ZYJFL.js} +1 -1
- package/dist/{credentials-BCR73VGS.js → credentials-5WIFF5DG.js} +1 -1
- package/dist/{deps-bundle-6WLX44OA.js → deps-bundle-BLLJ2BQ4.js} +1 -1
- package/dist/{deps-resolve-DSAKPZ3T.js → deps-resolve-WQ6J6RLI.js} +1 -1
- package/dist/{design-chat-YUI2JPO6.js → design-chat-ZICGVYIH.js} +1 -1
- package/dist/{design-headless-KIP6R7UV.js → design-headless-HYWZIIDS.js} +1 -1
- package/dist/{design-remote-XMSHDDUX.js → design-remote-HPX4VZ63.js} +2 -2
- package/dist/device-env-4P4GUVBW.js +2 -0
- package/dist/{doctor-PGTNOMSP.js → doctor-Z2YQ2DBX.js} +1 -1
- package/dist/{evidence-RO3RDZXO.js → evidence-BJIID6VT.js} +1 -1
- package/dist/{evolve-cmd-U2ALVGMT.js → evolve-cmd-GZCUSCEK.js} +1 -1
- package/dist/{evolve-remote-K2MCCVMM.js → evolve-remote-LILOAHYH.js} +1 -1
- package/dist/{explain-cmd-UWK5YVXG.js → explain-cmd-LXIVHGN7.js} +1 -1
- package/dist/explore-SA2P3SGX.js +2 -0
- package/dist/{explore-context-tty-WJHUSP3A.js → explore-context-tty-PERKIWXD.js} +1 -1
- package/dist/{explore-entry-3EX2T3NS.js → explore-entry-E6EY3VV3.js} +4 -4
- package/dist/{explore-live-TRY5A2ME.js → explore-live-XIWWUV52.js} +1 -1
- package/dist/{explore-run-tty-ZV5XFKZA.js → explore-run-tty-M56I23IF.js} +2 -2
- package/dist/{extract-bind-TXUBMK3T.js → extract-bind-LZ22VFKB.js} +3 -3
- package/dist/{extract-chat-VPYDGQKO.js → extract-chat-Z64LEAJ5.js} +1 -1
- package/dist/{extract-cmd-YUOYMVF5.js → extract-cmd-46E2XDWZ.js} +2 -2
- package/dist/{extract-headless-UWTAPOET.js → extract-headless-XLS56LMN.js} +1 -1
- package/dist/{folder-flags-WV7UV3JG.js → folder-flags-ZIDJVDKX.js} +1 -1
- package/dist/{gaps-cmd-PFV3FZCM.js → gaps-cmd-XYOBJVTO.js} +1 -1
- package/dist/{gate-7ALXLCNB.js → gate-AK44VDHC.js} +1 -1
- package/dist/{generate-headless-KMBBZTLS.js → generate-headless-HXAVEAEZ.js} +2 -2
- package/dist/{impact-cmd-PW33L5RF.js → impact-cmd-TJTUFAFO.js} +2 -2
- package/dist/index.js +162 -157
- package/dist/{ingest-cmd-MXYILQLV.js → ingest-cmd-OJSKTSQK.js} +3 -3
- package/dist/{ingest-remote-2EEJP6ML.js → ingest-remote-2WM6PYUW.js} +1 -1
- package/dist/install-JBWBF3WX.js +2 -0
- package/dist/{interactive-bind-FDWJUTI6.js → interactive-bind-SOD7VTAY.js} +2 -2
- package/dist/{interactive-remote-O2Q2FNOH.js → interactive-remote-7ZSTI66T.js} +1 -1
- package/dist/{lattice-auth-TXNDLHM6.js → lattice-auth-UQPFQSG7.js} +1 -1
- package/dist/{lifecycle-cmd-GFHDBRXX.js → lifecycle-cmd-DGIO3VAO.js} +1 -1
- package/dist/{list-cmd-RR75PMPE.js → list-cmd-HQIN3HX4.js} +1 -1
- package/dist/{list-commands-3QGZWJ5P.js → list-commands-OFRRBU3D.js} +1 -1
- package/dist/{list-remote-AA3VSWOI.js → list-remote-EFCET42K.js} +1 -1
- package/dist/login-flow-SYKXXDLH.js +2 -0
- package/dist/{maintenance-cmd-OHGVARQ2.js → maintenance-cmd-X5247RSJ.js} +1 -1
- package/dist/{mobile-prompts-FZRKLLTN.js → mobile-prompts-I66ENBDW.js} +1 -1
- package/dist/{onboarding-NXGMV3VG.js → onboarding-6HIP3KW6.js} +1 -1
- package/dist/{persist-recorded-session-INFN4JZT.js → persist-recorded-session-RSSMTVF3.js} +1 -1
- package/dist/pipeline-NTJDH5TC.js +2 -0
- package/dist/{policy-commands-3YJ6YCDN.js → policy-commands-4PUGESCW.js} +1 -1
- package/dist/{prepare-target-DII5WZCX.js → prepare-target-AI3GGZF6.js} +1 -1
- package/dist/{pull-cmd-XZN53XFZ.js → pull-cmd-NRVB5ZN7.js} +1 -1
- package/dist/{pull-route-R33BVADE.js → pull-route-FWCZW76M.js} +1 -1
- package/dist/real-device-run-NQ7RNH7C.js +2 -0
- package/dist/{reconcile-cmd-KFPRCCJB.js → reconcile-cmd-7B7THAFJ.js} +4 -4
- package/dist/{reconcile-remote-6WISFGRG.js → reconcile-remote-3W6ZTO3G.js} +2 -2
- package/dist/{recording-banner-XOX2CDCF.js → recording-banner-WVDTWTSE.js} +1 -1
- package/dist/registry-PFOSXOIH.js +2 -0
- package/dist/remote-entry-BZU4NFNS.js +2 -0
- package/dist/{remote-mode-4HN27MD4.js → remote-mode-NXUKDUXG.js} +1 -1
- package/dist/{remote-words-LFDYKIZ7.js → remote-words-JRDDNOZ6.js} +1 -1
- package/dist/{require-project-folder-ZK4JJCDB.js → require-project-folder-3DTI2CVB.js} +1 -1
- package/dist/{resolve-run-intent-LYLVNNDZ.js → resolve-run-intent-QCL7QXIB.js} +1 -1
- package/dist/{resolver-RMHGGYRP.js → resolver-CDF7QKVD.js} +1 -1
- package/dist/{review-cmd-UGF2FC5Y.js → review-cmd-XBK3TGRE.js} +1 -1
- package/dist/{run-remote-BGKQDAOA.js → run-remote-SFR3F2T5.js} +1 -1
- package/dist/{run-startup-gate-4XE73OON.js → run-startup-gate-QSFJRYUY.js} +1 -1
- package/dist/run-test-md-ZSREINDQ.js +20 -0
- package/dist/session-worker.js +2 -2
- package/dist/{sessions-cmd-CABAX7BO.js → sessions-cmd-TLUITRG5.js} +1 -1
- package/dist/{sessions-remote-Y4FTZL7Y.js → sessions-remote-INO7AWKB.js} +1 -1
- package/dist/{skill-installer-FS2AV7GX.js → skill-installer-7JH5QCJF.js} +1 -1
- package/dist/{store-PLKJZTGC.js → store-X4UK4AP7.js} +1 -1
- package/dist/{store-choice-UAB6Z4AL.js → store-choice-27HDIFTU.js} +1 -1
- package/dist/{store-guard-DUN2X3SR.js → store-guard-ZXKB5DQH.js} +1 -1
- package/dist/{sync-cmd-AGTOGPYM.js → sync-cmd-2PCO7LZA.js} +1 -1
- package/dist/{sync-setup-4KIY3PDO.js → sync-setup-5WQO73Y5.js} +1 -1
- package/dist/tcg-generate-DGJD5KSM.js +2 -0
- package/dist/{testmd-actions-UD6PAWUX.js → testmd-actions-XE2JPQHB.js} +1 -1
- package/dist/{testmd-sync-EEJ7GPLR.js → testmd-sync-LYHEXWCT.js} +1 -1
- package/dist/{tms-client-XWCR7O7J.js → tms-client-J4OCD3EP.js} +1 -1
- package/dist/token-refresh-E4FTJVHY.js +2 -0
- package/dist/{validate-basic-3JZRZL45.js → validate-basic-66XDPA3S.js} +1 -1
- package/dist/{version-check-IY3YSQIP.js → version-check-SHNVYTMU.js} +1 -1
- package/dist/{view-cmd-WUIGTRFX.js → view-cmd-QOB3O6YW.js} +1 -1
- package/dist/{walk-session-EH7227WR.js → walk-session-WIEROYOT.js} +1 -1
- package/dist/{with-telemetry-7JMZUBUZ.js → with-telemetry-T2PWI5CY.js} +1 -1
- package/package.json +11 -11
- package/dist/FolderPicker-H5K74PCH.js +0 -2
- package/dist/InfoBox-DNSOAK5L.js +0 -2
- package/dist/ProjectPicker-ZJ5RW6XL.js +0 -2
- package/dist/SaveSessionPrompt-F327WC7A.js +0 -2
- package/dist/SingleShotApp-OMLRYOSI.js +0 -2
- package/dist/TestMdRunView-ZZ77QTAQ.js +0 -2
- package/dist/TestrunEvidenceTable-G7MPF55X.js +0 -2
- package/dist/chunk-6K5BEEAJ.js +0 -2
- package/dist/chunk-6LEHGRRG.js +0 -34
- package/dist/chunk-A4ZV2SHL.js +0 -5
- package/dist/chunk-O2Y46A3G.js +0 -26
- package/dist/chunk-Y6Y6RAY4.js +0 -2
- package/dist/device-env-K7J5NN66.js +0 -2
- package/dist/explore-S2BGQUIF.js +0 -2
- package/dist/install-7J34AYB6.js +0 -2
- package/dist/login-flow-ZQ6UFTS2.js +0 -2
- package/dist/pipeline-MVZRI6YZ.js +0 -2
- package/dist/real-device-run-DGENHGUV.js +0 -2
- package/dist/registry-NV3EMDMK.js +0 -2
- package/dist/remote-entry-BCTFT643.js +0 -2
- package/dist/run-test-md-G6U3RU2Q.js +0 -19
- package/dist/tcg-generate-CUY4AZ2V.js +0 -2
- package/dist/token-refresh-K6PVBBFE.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as s}from"./chunk-KM3YCIDV.js";import{f as c}from"./chunk-PRBWZXFA.js";import{d as g}from"./chunk-ZMWTRXFH.js";import{a as l}from"./chunk-
|
|
2
|
+
import{a as s}from"./chunk-KM3YCIDV.js";import{f as c}from"./chunk-PRBWZXFA.js";import{d as g}from"./chunk-ZMWTRXFH.js";import{a as l}from"./chunk-YNDELIXL.js";import{f as a}from"./chunk-CB344EDO.js";import{c as m}from"./chunk-GBQ4K25P.js";import{b as n}from"./chunk-EBJW6POT.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-IIIYXOIW.js");return u({event:r=>t.emit(r)},i)}export{A as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{l as E}from"./chunk-UJLULWSR.js";import{a as x}from"./chunk-RZ4F3BHX.js";import{k as _,l as A}from"./chunk-
|
|
2
|
+
import{l as E}from"./chunk-UJLULWSR.js";import{a as x}from"./chunk-RZ4F3BHX.js";import{k as _,l as A}from"./chunk-J4FIESTB.js";import{spawn as S,spawnSync as T}from"child_process";import{existsSync as y,mkdirSync as I,readFileSync as M,writeFileSync as v}from"fs";import{createConnection as G}from"net";import{homedir as m,platform as h}from"os";import{join as i}from"path";var H=new Set(["1","true","yes"]),f=class extends Error{constructor(o){super(o),this.name="ChromeNotFoundError"}};function ie(e){return e instanceof f?e.message:`Chrome failed: ${e instanceof Error?e.message:String(e)}`}var w={darwin:["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",i(m(),"Applications/Google Chrome.app/Contents/MacOS/Google Chrome"),"/Applications/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing",i(m(),"Applications/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"),"/Applications/Chromium.app/Contents/MacOS/Chromium"],linux:["/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/usr/bin/google-chrome-for-testing","/usr/local/bin/google-chrome-for-testing",i(m(),"chrome-for-testing/chrome-linux64/chrome"),"/usr/bin/chromium","/usr/bin/chromium-browser","/snap/bin/chromium"],win32:["C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe","C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",i(m(),"AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"),"C:\\chrome-for-testing\\chrome-win64\\chrome.exe",i(m(),"AppData\\Local\\chrome-for-testing\\chrome-win64\\chrome.exe"),i(m(),"AppData\\Local\\kane-chrome\\chrome.exe")]};function L(){let e=process.env.KANE_CLI_CHROME_PATH?.trim();return e||void 0}function N(){let e=L();if(e)return e;let o=h(),r=w[o]??w.linux;for(let t of r)if(y(t))return t;return o==="win32"?"chrome.exe":"google-chrome"}function $(){let e=L();if(e)return y(e);let o=h();if((w[o]??w.linux).some(s=>y(s)))return!0;let t=o==="win32"?"chrome.exe":"google-chrome",n=o==="win32"?"where":"which";try{return T(n,[t],{stdio:"ignore"}).status===0}catch{return!1}}function F(){let e=h();return e==="darwin"?["Google Chrome is required but was not found at any standard path.","","Install via Homebrew (recommended):"," brew install --cask google-chrome","","Or download:"," https://www.google.com/chrome/","","Then re-run your command. Set KANE_CLI_CHROME_PATH=/path/to/chrome","to point at a non-standard install."].join(`
|
|
3
3
|
`):e==="linux"?["Google Chrome is required but was not found at /usr/bin/google-chrome.","(amd64 / x86_64 only \u2014 Google does not ship Chrome for Linux ARM.)","","Debian / Ubuntu (any version):"," wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb"," sudo apt install -y ./google-chrome-stable_current_amd64.deb","","Fedora / RHEL / AlmaLinux / Rocky:"," sudo dnf install -y https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm","","Then re-run your command. Set KANE_CLI_CHROME_PATH=/path/to/chrome","to point at a non-standard install."].join(`
|
|
4
4
|
`):e==="win32"?["Google Chrome is required but was not found in Program Files or AppData.","","Install via winget (Windows 10 1809+):"," winget install --id Google.Chrome -e --silent","","Or download:"," https://www.google.com/chrome/","","Then re-run your command. Set KANE_CLI_CHROME_PATH=C:\\path\\to\\chrome.exe","to point at a non-standard install."].join(`
|
|
5
5
|
`):["Google Chrome is required.","Install from https://www.google.com/chrome/","(Note: no official Chrome builds for BSD or Alpine/musl Linux.)"].join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as f}from"./chunk-
|
|
2
|
+
import{a as f}from"./chunk-SMGRXKXX.js";import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as n}from"./chunk-33DWJV67.js";import{a as R}from"./chunk-6YGTRKDT.js";import{z as t}from"./chunk-J4FIESTB.js";import{e as c}from"./chunk-UR6MHSHU.js";var p=c(R(),1);var e=c(x(),1);function v(){return[{name:"convert",label:"Converting session data",status:"pending"},{name:"zip",label:"Compressing artifacts",status:"pending"},{name:"presign",label:"Requesting upload URLs",status:"pending"},{name:"upload",label:"Uploading to KaneAI",status:"pending"},{name:"atomic_replace",label:"Replacing local output",status:"pending"},{name:"commit_lock",label:"Committing to TMS",status:"pending"},{name:"finalize",label:"Finalizing test case",status:"pending"},{name:"code_export",label:"Downloading test code",status:"pending"}]}function U(s,o,d,i){return s.map(l=>l.name===o?{...l,status:d,detail:i}:l)}function D(s){let o=s/1e3;if(o<60)return`${o.toFixed(1)}s`;let d=Math.floor(o/60),i=Math.round(o%60);return`${d}m ${i}s`}function w(s){let[o,d]=(0,p.useState)(0),i=p.default.useRef(Date.now());return(0,p.useEffect)(()=>{if(!s)return;i.current=Date.now();let l=setInterval(()=>{d(Date.now()-i.current)},100);return()=>clearInterval(l)},[s]),o}function h({steps:s,status:o,testUrl:d,error:i}){let l=w(o==="uploading");return o==="uploading"?(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.orange,children:"\u2601 "}),(0,e.jsx)(n,{color:t.orange,bold:!0,children:"Saving to KaneAI"}),(0,e.jsxs)(n,{color:t.dim,children:[" ",D(l)]})]}),(0,e.jsx)(a,{flexDirection:"column",marginTop:1,children:s.filter(r=>r.status!=="skipped"||r.detail).map((r,S,T)=>{let b=S===T.length-1?"\u2514\u2500":"\u251C\u2500",u=r.status==="done",m=r.status==="running",g=r.status==="failed",B=r.status==="skipped";return(0,e.jsxs)(a,{children:[(0,e.jsxs)(n,{color:t.dim,children:[" ",b," "]}),(0,e.jsx)(a,{width:3,children:m?(0,e.jsx)(f,{}):u?(0,e.jsx)(n,{color:t.green,children:"\u2713"}):g?(0,e.jsx)(n,{color:t.red,children:"\u2717"}):B?(0,e.jsx)(n,{color:t.muted,children:"\u2013"}):(0,e.jsx)(n,{color:t.muted,children:"\u25CB"})}),(0,e.jsx)(n,{color:u?t.dim:m?void 0:g?t.red:t.muted,children:r.label}),r.detail&&(0,e.jsxs)(n,{color:t.dim,children:[" ",r.detail]})]},r.name)})}),(0,e.jsx)(a,{marginTop:1,children:(0,e.jsx)(n,{color:t.muted,children:" press Ctrl+C twice to force exit"})})]}):o==="success"?(0,e.jsx)(e.Fragment,{}):(0,e.jsxs)(a,{flexDirection:"column",paddingX:1,paddingY:1,children:[(0,e.jsxs)(a,{children:[(0,e.jsx)(n,{color:t.red,children:"\u2601 "}),(0,e.jsx)(n,{color:t.red,bold:!0,children:"Save failed"})]}),i&&(0,e.jsxs)(a,{marginTop:0,children:[(0,e.jsx)(n,{color:t.dim,children:" "}),(0,e.jsx)(n,{color:t.dim,children:i})]})]})}export{v as a,U as b,h as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as v}from"./chunk-CCOD4GQJ.js";import{a as S}from"./chunk-QSCXXNC2.js";import{n as g}from"./chunk-UJLULWSR.js";import{a as u,b as d}from"./chunk-
|
|
2
|
+
import{b as v}from"./chunk-CCOD4GQJ.js";import{a as S}from"./chunk-QSCXXNC2.js";import{n as g}from"./chunk-UJLULWSR.js";import{a as u,b as d}from"./chunk-J4FIESTB.js";import{existsSync as P}from"fs";import{join as T}from"path";import{mkdirSync as b,rmSync as h,writeFileSync as k}from"fs";import{join as E,resolve as A}from"path";import{join as w}from"path";function m(){return process.env.KANE_CLI_WIRE_BASE_DIR||d}function J(e){return w(m(),"sessions",`testrun-${e}`)}function y(e=m()){return E(e,"sessions","active")}function _(e,r){return E(y(r),`${e}.json`)}function x(e){let r=e.pid??process.pid,n=_(r,e.baseDir);try{b(y(e.baseDir),{recursive:!0}),k(n,JSON.stringify({pid:r,cwd:process.cwd(),surface:e.surface,session_dir:A(e.sessionDir),started:new Date().toISOString(),cli_version:u,host_agent:S()},null,2)+`
|
|
3
3
|
`)}catch{}return n}function f(e=process.pid,r){try{h(_(e,r),{force:!0})}catch{}}var R={run:"run_end",testmd:"test_md_done",testrun:"testrun_done",explore:"done"};import{appendFileSync as I,mkdirSync as N}from"fs";import{dirname as O}from"path";function D(e){let r=!1;return{path:e,append(n){try{r||(N(O(e),{recursive:!0}),r=!0),I(e,n+`
|
|
4
4
|
`)}catch{}}}}function W(e,r=()=>new Date){let{v:n,ts:c,...i}=e;return{...i,v:1,ts:typeof c=="string"?c:r().toISOString()}}function V(e){let r=e.stdout??(t=>{process.stdout.write(t)}),n=R[e.surface],c=!1,i=null,o=null,p=[],l=()=>{if(!(o||!i||!P(i))){o=D(T(i,"events.ndjson"));for(let t of p)o.append(t);p=[];try{e.onAttach?.(i)}catch{}}};return{emit(t){if(c)return;let a=v(JSON.stringify(W(t,e.now)));r(a+`
|
|
5
5
|
`),l(),o?o.append(a):p.push(a),t.type===n&&(c=!0,p=[])},attachSessionDir(t){i=t,l()},setTerminal(t){n=t},get logPath(){return o?o.path:null}}}var s=null;function j(e){return r=>{x({surface:e,sessionDir:r}),g("wire-active-run",()=>f()),process.once("exit",()=>f())}}function se(e,r){return s=V({surface:e,cliVersion:u,onAttach:r??j(e)}),s.emit({type:"stream_start",cli_version:u,surface:e,pid:process.pid}),s}function ce(){return s}function ue(e){if(s){s.emit(e);return}process.stdout.write(JSON.stringify(W(e))+`
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as ae}from"./chunk-
|
|
2
|
+
import{a as ae}from"./chunk-YPGZ5E4I.js";import{b as ue}from"./chunk-ZUZ6QJRA.js";import{n as k,p as ce,q as de,r as pe,s as fe}from"./chunk-ZMIKNNO6.js";import{a as ge}from"./chunk-YDPTSDIJ.js";import{a as w,b as q}from"./chunk-KGNE5CIM.js";import{d as le}from"./chunk-3AGP2BVN.js";import{d as oe,f as se}from"./chunk-OOGKX4Y6.js";import{b as ie}from"./chunk-7Y55CO42.js";import{a as re}from"./chunk-Q4SMITTV.js";import{a as te}from"./chunk-SMGRXKXX.js";import{a as ne}from"./chunk-PVN64537.js";import{a as G}from"./chunk-ZCBOHWN3.js";import{a as ee}from"./chunk-TM45NPWL.js";import{a as I}from"./chunk-HCBYKLMW.js";import{a as M,b as E}from"./chunk-33DWJV67.js";import{a as h}from"./chunk-FOJHSG5M.js";import{z as m}from"./chunk-J4FIESTB.js";import{e as Z}from"./chunk-UR6MHSHU.js";function j(e){if(!e)return"";let t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toISOString().slice(0,16).replace("T"," ")} UTC`}function W(e){return e?e.code||e.message:""}function Y(e,t=Date.now()){if(!e)return"";let n=new Date(e).getTime();if(Number.isNaN(n))return e;let r=Math.floor(Math.max(0,t-n)/6e4);if(r<1)return"just now";if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function v(e,t=Date.now()){let n=Y(e,t);return!n||n==="just now"||!/^\d/.test(n)?n:`${n} ago`}function R(e){return e?e.slice(0,8):""}function me(e){if(!e)return"";try{return new URL(e).host||e}catch{return e}}function P(e){return e?e.replace(/_/g," "):""}var Ue={user_off:"turned off",project_not_shared:"project not shared: share it in Test Manager",project_unknown:"the project's sharing could not be checked",not_configured:"assurance jobs are not set up on this service",mark_refused:"the first assurance job could not share the project: ask a Test Manager admin for permission to create test cases, then turn context off and on"};function A(e){return e==null?"":e==="end"?"run end":`cut ${e}`}function xe(e){return e?e.enabled?e.running?"on \xB7 job running":e.last_job_status?`on \xB7 last job ${e.last_job_status}`:"on":"off":""}function K(e){let t=e.off_reason?Ue[e.off_reason]??e.off_reason:"";return e.enabled&&t?`on, blocked: ${t}`:e.enabled?"on":t?`off (${t})`:"off"}var f=e=>h.hex(m.dim)(e);var _e=e=>h.hex(m.orange)(e),J=e=>h.hex(m.green)(e),be=e=>h.hex(m.amber)(e),D=e=>h.hex(m.red)(e);function Be(e=process.stdout.columns){return Math.max(60,(e&&e>0?e:140)-2)}function Fe(e,t,n,r){let i=e.map((s,l)=>Math.max(s.length,...t.map(d=>(d[l]??"").length),1)),o=e.length*3+1,a=i.reduce((s,l)=>s+l,0)+o-n;if(a<=0)return t;let u=Math.min(a,Math.max(0,i[r]-7));for(i[r]-=u,a-=u;a>0;){let s=-1;if(i.forEach((l,d)=>{l>Math.max(7,e[d].length)&&(s<0||l>i[s])&&(s=d)}),s<0)break;i[s]-=1,a-=1}let c=(s,l)=>s.length<=l?s:`${s.slice(0,Math.max(0,l-1))}\u2026`;return t.map(s=>s.map((l,d)=>c(l,i[d])))}function ye(e,t,n,r){let i=Be(r);return le(e,Fe(e,t,i,n),i,n).map((o,a)=>a===1?h.bold(o):o)}function b(e,t="",n="open"){return`${(n==="done"?J:n==="failed"?D:_e)(`\u25CF ${e}`)}${t?f(t):""}`}function we(e,t){return[D(`error: ${e}`),...t?[`next: ${t}`]:[]]}function Ve(e){return e.current_session?`\u25CF ${e.current_session.state}`:"idle"}function Ge(e,t){if(e.current_session)return`run ${R(e.current_session.run_id)} \xB7 ${Y(e.current_session.started_at,t)}`;let n=e.last_session;return n?[W(n.remark)||"stopped",v(n.ended_at??n.started_at,t)].filter(Boolean).join(" \xB7 "):"never run"}function qe(e,t={}){return(e.project_id?t[e.project_id]:void 0)||(e.name?e.name:"")||R(e.project_id??e.exploration_id)}function $e(e,t){if(!e.length)return[f(t.all?"no explorations":"no running explorations (--all lists every one)")];let n=t.now??Date.now(),r=e.some(a=>a.context),i=["project","app","state","last run",...r?["context"]:[]],o=e.map(a=>[qe(a,t.projects),me(a.target_url),Ve(a),Ge(a,n),...r?[xe(a.context)]:[]]);return[...ye(i,o,1,t.cols),f(`${e.length} exploration${e.length===1?"":"s"} \xB7 newest first${t.nextCursor?` \xB7 more: --cursor ${t.nextCursor}`:""} \xB7 kane-cli explore to open one`)]}function ke(e){return e.credits&&typeof e.credits.total=="number"?Math.round(e.credits.total).toLocaleString("en-US"):""}function je(e,t,n){if(!t.length)return[f(`exploration ${e} has no sessions yet`)];let r=n.now??Date.now(),i=t.map(o=>[R(o.run_id),o.state==="stopped"?"stopped":`\u25CF ${o.state}`,W(o.remark)||"\u2014",o.mode,o.leases===void 0?"":String(o.leases),o.findings===void 0?"":String(o.findings),ke(o),v(o.started_at,r)]);return[...ye(["run","state","remark","mode","leases","findings","credits","started"],i,2,n.cols),f(`${t.length} session${t.length===1?"":"s"} \xB7 --run <run-id> for one in full${n.nextCursor?` \xB7 more: --cursor ${n.nextCursor}`:""}`)]}function X(e,t=18){let n=e.filter(([,i])=>i),r=Math.max(t,...n.map(([i])=>i.length+2));return n.map(([i,o,a])=>` ${f(i.padEnd(r))}${a?a(o):o}`)}function Ee(e){return[h.bold(`run ${e.run_id}`),...X([["exploration",e.exploration_id],["session",`#${e.version}`],["state",e.state,e.state==="stopped"?void 0:_e],["remark",e.remark?`${e.remark.code}: ${e.remark.message}`:""],["stop reason",e.stop_reason??""],["mode",e.mode],["started",j(e.started_at)],["started by",e.started_by_user_id?`user ${e.started_by_user_id}`:""],["claimed",j(e.claimed_at)],["stop asked",j(e.stop_requested_at)],["stopped by",e.stopped_by_user_id?`user ${e.stopped_by_user_id}`:""],["ended",j(e.ended_at)],["leases",e.leases===void 0?"":String(e.leases)],["findings",e.findings===void 0?"":String(e.findings)],["credits",ke(e)],["job",e.hx_job_link??e.hx_job_id??""]])]}function Ce(e){let t=K(e);return e.enabled?e.off_reason?be(t):J(t):f(t)}function We(e,t){return e?t!=null&&e===t?" by you":` by user ${e}`:""}function he(e,t){let n=P(e),r=A(t);return n?!r||r===n?n:`${n} \xB7 ${r}`:r}function at(e){let t=Math.max(20,e.cols??process.stdout.columns??100);return[f("\u2500".repeat(t)),`${e.status}${e.meta.filter(Boolean).length?f(` \xB7 ${e.meta.filter(Boolean).join(" \xB7 ")}`):""}`,...e.tallies?.length?[f(e.tallies.join(" \xB7 "))]:[],f(e.keys.join(" \xB7 "))]}function Te(e){if(!e)return[];let t=(n,r,i)=>typeof n=="number"?`${n} ${n===1?r:i}`:"";return[t(e.junctions,"screen","screens"),t(e.flows,"flow","flows"),t(e.findings,"finding","findings")].filter(Boolean)}function ut(e,t={}){let n=e.last_job,r=e.running_job,i=[h.bold(`Assurance context${t.project?` \xB7 "${t.project}"`:""}`),...X([["state",K(e),()=>Ce(e)],["changed",e.changed_at?`${v(e.changed_at)}${We(e.changed_by_user_id,t.me)}`:""],["pending cut",e.pending_cut?`${A(e.pending_cut.cut)} (${P(e.pending_cut.trigger)})`:"none"],["running job",r?`${R(r.job_id)} \xB7 ${he(r.trigger,r.cut)}${r.status==="launching"?" \xB7 launching (HyperExecute has not answered yet)":""}${r.hx_job_link?` \xB7 ${r.hx_job_link}`:""}`:"none"]]),""],o=["",f(`sync now: kane-cli explore context sync ${e.exploration_id}`)];if(!n)return[...i,f("no assurance job has run yet"),...o];let a=n.use_cases?.added?.length??0,u=n.use_cases?.modified?.length??0,c=n.tests?.failed??[],s=n.status==="ok"||n.status==="noop"?J:n.status==="partial"?be:D;return[...i,h.bold("Last job"),...X([["status",n.status,s],["trigger \xB7 cut",he(n.trigger,n.cut)],["use cases",a||u?`${a} added \xB7 ${u} modified`:""],["tests",n.tests?`${n.tests.designed??0} designed \xB7 ${n.tests.saved??0} saved${c.length?` \xB7 failed: ${c.join(", ")}`:""}`:""],["held",n.held?.length?n.held.map(l=>`${l.ref} (${l.why})`).join("; "):""],["error",n.error?`${n.error.code}${n.error.message?`: ${n.error.message}`:""}`:"",D],["ended",v(n.ended_at)],["credits",typeof n.credits=="number"?String(n.credits):""],["job",n.hx_job_link??n.hx_job_id??n.job_id]]),...(n.attempt??1)>1?[f(" retry of a failed attempt; counts cover this attempt only")]:[],...o]}function lt(e,t){let n=A(t.cut)||"the newest cut",r=f(` status: kane-cli explore context status ${e}`);return t.state==="launched"?[b("assurance job launched",` \xB7 ${P(t.trigger)||"manual"} \xB7 ${n}`),...t.hx_job_link?[f(` job: ${t.hx_job_link}`)]:[],r]:t.state==="launching"?[b("assurance job launching",` \xB7 ${n} \xB7 HyperExecute has not answered yet`),r]:t.state==="pending"&&t.trigger==="run_end"?[b("the run-end job is waiting",` \xB7 a job is running${t.running_job_id?` (${t.running_job_id})`:""}`),f(" this sync was folded into it: the run-end job reads the whole run, so nothing else is queued"),r]:t.state==="pending"?[b(`assurance ${n} pending`,` \xB7 a job is running${t.running_job_id?` (${t.running_job_id})`:""}; this cut runs after it (a newer one replaces it)`),r]:t.state==="running"?[b(`a job is already running on ${n}`,t.job_id?` (${t.job_id})`:""),r]:t.state==="up_to_date"?[b("assurance context up to date",` \xB7 ${t.cut!==void 0&&t.cut!==null?`${A(t.cut)} already read`:"nothing new"}`,"done")]:[b(`assurance sync: ${t.state}`)]}function ct(e,t,n,r){return[b(`assurance context ${n}`,r?` \xB7 "${r}"`:` \xB7 exploration ${e}`,"done"),` ${f("now")} ${Ce(t)}`,...n==="off"?[f(" the next cut is skipped; nothing already saved is deleted"),f(` turn on: kane-cli explore context on ${e}`)]:[f(" the controller catches up from the newest ended run")]]}function z(){return{stdin:!!process.stdin.isTTY,stdout:!!process.stdout.isTTY}}function Se(e,t=z()){return!!e.agent||!t.stdin||!t.stdout}var Ye=ce;function ve(e){return e.option("--agent",Ye)}function Re(e){return{formatHelp(t,n){let r=n.padWidth(t,n),i=n.helpWidth||80,o=2,a=2,u=(p,y)=>{if(!y)return p;let _=r+a;return y.split(`
|
|
3
3
|
`).map((V,Oe)=>n.wrap(`${(Oe===0?p:"").padEnd(_)}${V}`,i-o,_)).join(`
|
|
4
4
|
`)},c=p=>p.join(`
|
|
5
5
|
`).replace(/^/gm," ".repeat(o)),s=[`Usage: ${n.commandUsage(t)}`,""],l=n.commandDescription(t);l&&(s=s.concat([n.wrap(l,i,0),""]));let d=n.visibleArguments(t).map(p=>u(n.argumentTerm(p),n.argumentDescription(p)));d.length&&(s=s.concat(["Arguments:",c(d),""]));let g=n.visibleOptions(t),$=new Set;for(let p of e){let y=p.flags.map(_=>g.find(V=>V.long===_)).filter(_=>!!_&&!$.has(_));if(y.length){for(let _ of y)$.add(_);s=s.concat([`${p.title}:`,c(y.map(_=>u(n.optionTerm(_),_.description))),""])}}let T=g.filter(p=>!$.has(p));T.length&&(s=s.concat(["Other options:",c(T.map(p=>u(n.optionTerm(p),p.description))),""]));let S=n.visibleCommands(t).map(p=>u(n.subcommandTerm(p),n.subcommandDescription(p)));return S.length&&(s=s.concat(["Commands:",c(S),""])),s.join(`
|
|
6
|
-
`)}}}var x=Z(I(),1);function Ke({explorationId:e,facts:t={},done:n}){return(0,x.jsxs)(M,{flexDirection:"column",marginTop:1,children:[(0,x.jsx)(ie,{head:t.project?`Delete "${t.project}"'s exploration?`:"Delete this exploration?",rows:[{label:"exploration",text:e},...t.map?[{label:"map",text:t.map}]:[],{label:"after",text:"the map stays on the service; no command shows it; the project can start a new one"}],minWidth:12}),(0,x.jsx)(M,{marginTop:1,children:(0,x.jsx)(ae,{message:t.project?`Delete "${t.project}"'s exploration?`:"Delete this exploration?",confirmLabel:"Yes, delete",onConfirm:()=>n(!0),onCancel:()=>n(!1)})})]})}async function Q(e,t={}){return await ge(n=>(0,x.jsx)(Ke,{explorationId:e,facts:t,done:n}))===!0}async function Ae(e,t,n={}){let{render:r}=await import("./build-5ZN47FAT.js"),i=Math.max(20,process.stderr.columns??100),o=(n.meta??[]).filter(Boolean),a=r((0,x.jsxs)(M,{flexDirection:"column",children:[(0,x.jsx)(E,{color:m.dim,children:"\u2500".repeat(i)}),(0,x.jsxs)(E,{children:[(0,x.jsx)(te,{active:!0}),(0,x.jsx)(E,{color:m.orange,children:` ${e}`}),o.length?(0,x.jsx)(E,{color:m.dim,children:` \xB7 ${o.join(" \xB7 ")}`}):null]}),n.keys?.length?(0,x.jsx)(E,{color:m.dim,children:n.keys.join(" \xB7 ")}):null]}),{stdout:process.stderr,exitOnCtrlC:!1});try{return await t()}finally{a.clear(),a.unmount()}}var He=e=>h.hex(m.dim)(e),Xe=e=>h.hex(m.green)(e),Ne=2500;async function Je(e,t,n=Ne){let r=[...new Set(t.filter(Boolean))];if(!r.length)return{};let{TmsClient:i}=await import("./tms-client-
|
|
6
|
+
`)}}}var x=Z(I(),1);function Ke({explorationId:e,facts:t={},done:n}){return(0,x.jsxs)(M,{flexDirection:"column",marginTop:1,children:[(0,x.jsx)(ie,{head:t.project?`Delete "${t.project}"'s exploration?`:"Delete this exploration?",rows:[{label:"exploration",text:e},...t.map?[{label:"map",text:t.map}]:[],{label:"after",text:"the map stays on the service; no command shows it; the project can start a new one"}],minWidth:12}),(0,x.jsx)(M,{marginTop:1,children:(0,x.jsx)(ae,{message:t.project?`Delete "${t.project}"'s exploration?`:"Delete this exploration?",confirmLabel:"Yes, delete",onConfirm:()=>n(!0),onCancel:()=>n(!1)})})]})}async function Q(e,t={}){return await ge(n=>(0,x.jsx)(Ke,{explorationId:e,facts:t,done:n}))===!0}async function Ae(e,t,n={}){let{render:r}=await import("./build-5ZN47FAT.js"),i=Math.max(20,process.stderr.columns??100),o=(n.meta??[]).filter(Boolean),a=r((0,x.jsxs)(M,{flexDirection:"column",children:[(0,x.jsx)(E,{color:m.dim,children:"\u2500".repeat(i)}),(0,x.jsxs)(E,{children:[(0,x.jsx)(te,{active:!0}),(0,x.jsx)(E,{color:m.orange,children:` ${e}`}),o.length?(0,x.jsx)(E,{color:m.dim,children:` \xB7 ${o.join(" \xB7 ")}`}):null]}),n.keys?.length?(0,x.jsx)(E,{color:m.dim,children:n.keys.join(" \xB7 ")}):null]}),{stdout:process.stderr,exitOnCtrlC:!1});try{return await t()}finally{a.clear(),a.unmount()}}var He=e=>h.hex(m.dim)(e),Xe=e=>h.hex(m.green)(e),Ne=2500;async function Je(e,t,n=Ne){let r=[...new Set(t.filter(Boolean))];if(!r.length)return{};let{TmsClient:i}=await import("./tms-client-J4OCD3EP.js"),o=new i(G(e.environment??"prod").tmsBaseUrl,e.basic.username,e.basic.access_key),a=async c=>{let s,l=new Promise(d=>{s=setTimeout(()=>d(null),n)});try{let d=await Promise.race([o.getProject(c).catch(()=>null),l]);return d&&d.name?[c,d.name]:null}finally{clearTimeout(s)}},u=await Promise.all(r.map(a));return Object.fromEntries(u.filter(c=>c!==null))}function Le(e,t){return e.projectNames?e.projectNames:e.out?async()=>({}):n=>Je(t,n)}async function H(e,t){let n=new ee,r=e.env??n.getDefaultEnv()??"prod";if(r!=="prod"&&r!=="stage")return{ok:!1,error:`invalid --env: ${String(r)}`};let i=G(r);try{let o=await re({creds:n,env:r,usernameFlag:e.username,accessKeyFlag:e.accessKey,log:()=>{}});return o.basicAuth?{ok:!0,controllerBaseUrl:i.controllerBaseUrl,basic:o.basicAuth,environment:r}:{ok:!1,error:`${t} needs Basic credentials (username + access key); none resolved`}}catch(o){return o instanceof ne&&o.code==="not_authenticated"?{ok:!1,error:"not authenticated: pass --username/--access-key or run 'kane-cli login'"}:{ok:!1,error:`auth resolution failed: ${o.message}`}}}function B(e,t,n){let r=e.io??z(),i=e.tty??!Se(n,r),o=e.out??(s=>{process.stdout.write(s+`
|
|
7
7
|
`)}),a=e.err??(s=>{process.stderr.write(s+`
|
|
8
8
|
`)}),u=i?null:oe("explore"),c=(s,l,d)=>(u?.emit({type:"done",status:l,exit_code:s,exploration_id:t,...d?{error:d}:{}}),s);return{tty:i,out:o,io:r,event:s=>{u?.emit(s)},ok:()=>c(0,"ok"),fail:(s,l=2,d)=>{if(u)se({type:"error",message:s});else for(let g of we(s,d))a(g);return c(l,"error",s)}}}function C(e){if(e instanceof w){let t=e.body&&typeof e.body.message=="string"?e.body.message:e.body&&typeof e.body.error=="string"?e.body.error:"";return t?`${e.code}: ${t}`:e.message}return e instanceof Error?e.message:String(e)}function F(e){return new q({baseUrl:e.controllerBaseUrl,auth:e.basic})}async function ze(e,t={}){let n=B(t,null,e),r=await H(e,"explore list");if(!r.ok)return n.fail(r.error);let i=!!e.all,o;try{o=await F(r).listExplorations({state:i?"all":"running",project:e.project,limit:e.limit,cursor:e.cursor})}catch(u){return n.fail(`could not list explorations: ${C(u)}`,u instanceof w&&u.status<500?2:1)}if(!n.tty)return n.event({type:"explore_list",explorations:o.explorations,next_cursor:o.next_cursor}),n.ok();let a=await Le(t,r)(o.explorations.filter(u=>!u.name).map(u=>u.project_id??""));for(let u of $e(o.explorations,{all:i,nextCursor:o.next_cursor,projects:a}))n.out(u);return n.ok()}var O=class extends Error{constructor(n){super("ambiguous run id");this.ids=n}},U=class extends Error{constructor(n,r){super("no run matches");this.searched=n;this.capped=r}},Qe=100,Ze=100;async function Ie(e,t,n={}){let r=B(n,e,t),i=await H(t,"explore sessions");if(!i.ok)return r.fail(i.error);let o=F(i),a=typeof t.run=="string"&&t.run?t.run:null;try{if(a){let c=async()=>{try{return await o.getSession(e,a)}catch(l){if(!(l instanceof w&&l.status===404)||a.length<8)throw l;let d=[],g,$=0,T=!1;for(let S=0;;S++){if(S===Ze){T=!0;break}let p=await o.listSessions(e,{limit:Qe,cursor:g});if($+=p.sessions.length,d.push(...p.sessions.map(y=>y.run_id).filter(y=>y.startsWith(a)&&y!==a)),!p.next_cursor)break;g=p.next_cursor}if(d.length>1)throw new O(d);if(d.length===0)throw new U($,T);return o.getSession(e,d[0])}},s;try{s=await c()}catch(l){if(l instanceof O)return r.fail(`--run ${a} matches ${l.ids.length} runs`,2,`give more of the id: ${l.ids.join(", ")}`);if(l instanceof U)return r.fail(`session ${a} of exploration ${e} not found: no run id is or starts with it (${l.capped?`searched the newest ${l.searched} runs`:`searched all ${l.searched} runs`})`,2,l.capped?"give the full run id (kane-cli explore sessions <id> lists them)":`kane-cli explore sessions ${e}`);throw l}if(!r.tty)r.event({type:"explore_session",session:s});else for(let l of Ee(s))r.out(l);return r.ok()}let u=await o.listSessions(e,{limit:t.limit,cursor:t.cursor});if(!r.tty)return r.event({type:"explore_sessions",exploration_id:e,sessions:u.sessions,next_cursor:u.next_cursor}),r.ok();for(let c of je(e,u.sessions,{nextCursor:u.next_cursor}))r.out(c);return r.ok()}catch(u){return u instanceof w&&u.status===404?r.fail(a?`session ${a} of exploration ${e} not found`:`exploration ${e} not found`):r.fail(`could not read the sessions: ${C(u)}`,1)}}async function et(e,t,n={}){let r=B(n,e,t);if(!t.yes){if(!r.tty)return r.fail(r.io.stdout?"explore delete needs --yes with --agent or a piped stdin":"explore delete needs --yes when stdout is not a terminal");if(!await(n.confirm??(async()=>{let u=await H(t,"explore delete");if(!u.ok)return Q(e,{});let c=await new q({baseUrl:u.controllerBaseUrl,auth:u.basic,timeoutMs:Ne}).viewSummary(e),s=typeof c?.project_id=="string"?c.project_id:"",l=s?await Le(n,u)([s]):{};return Q(e,{project:l[s]??(s?s.slice(0,8):void 0),map:Te(c?.counts).join(" \xB7 ")})}))(`Delete exploration ${e}? Its map stays on the service but no command shows it again. [y/N] `))return r.out(`exploration ${e} not deleted`),1}let i=await H(t,"explore delete");if(!i.ok)return r.fail(i.error);let o;try{o=await F(i).deleteExploration(e)}catch(a){return a instanceof w&&a.status===404?r.fail(`exploration ${e} not found (or already deleted)`):a instanceof w&&a.code==="RUN_ACTIVE"?r.fail(C(a),1):r.fail(`could not delete exploration ${e}: ${C(a)}`,1)}return r.tty?r.out(b(`exploration ${e} deleted`,o.deleted_at?` \xB7 ${j(o.deleted_at)}`:"","done")):r.event({type:"explore_deleted",exploration_id:o.exploration_id,deleted_at:o.deleted_at}),r.ok()}async function tt(e,t,n={}){let r=B(n,e,t),i=await H(t,"explore stop");if(!i.ok)return r.fail(i.error);let o=t.wait!==!1,a;try{let g=()=>F(i).stopExploration(e,o),$=["explore",e.slice(0,8),i.environment??""];a=r.tty&&!n.out?await Ae(o?"waiting for the run to end":"asking the run to stop",g,{meta:$,keys:["ctrl+c stop waiting (the stop stays)"]}):await g()}catch(g){return g instanceof w&&g.status===404?r.fail(`exploration ${e} not found`):g instanceof w&&g.code==="RUN_NOT_ACTIVE"?r.fail(C(g),1,`nothing is running; kane-cli explore sessions ${e} shows its runs`):r.fail(C(g),1)}let u=a.body,c=typeof u.run_id=="string"?u.run_id:"",s=typeof u.state=="string"?u.state:"",l=u.remark&&typeof u.remark=="object"?u.remark:null,d=s!=="stopped";return r.tty?d?(r.out(b(`stopping run ${c}`," \xB7 its leases finish, every delta is sent")),u.hx_abort&&r.out(`${Xe("\u2713 stop sent")} ${He("the HyperExecute job is told too")}`),r.out(He(` kane-cli explore sessions ${e} --run ${c} shows when it stopped`))):r.out(b(`run ${c} stopped: ${l?`${l.code}${l.message?` (${l.message})`:""}`:"stopped"}`,"","done")):r.event({type:"explore_stop",exploration_id:e,run_id:c,state:s,remark:l,stopping:d,...u.hx_abort?{hx_abort:u.hx_abort}:{}}),r.ok()}function Me(e){let t=Number(e);if(!Number.isInteger(t)||t<1||t>100)throw new ue("must be an integer 1-100");return t}function N(e){return ve(e).option("--env <name>",de).option("--username <user>",pe).option("--access-key <key>",fe)}function L(e,t,n){return e.configureHelp(Re([...t?[t]:[],{title:"Output",flags:["--agent","--help"]},{title:"Account",flags:["--env","--username","--access-key"]}])).addHelpText("after",`
|
|
9
9
|
Examples:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as P}from"./chunk-
|
|
2
|
+
import{a as P}from"./chunk-7Y55CO42.js";import{b as Le}from"./chunk-YILRYMMG.js";import{a as _t}from"./chunk-BSRSXYDZ.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 Z,c as xt,e as It}from"./chunk-UWPG5MWM.js";import{a as Rt}from"./chunk-73Y6T2UK.js";import{d as Ot}from"./chunk-XMPTFXPW.js";import{a as et}from"./chunk-WN5VKKJ3.js";import{b as Pt,c as Ft}from"./chunk-23DKB2MT.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-CQDCNP7V.js";import{a as ot}from"./chunk-6PIIUAZF.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-PI7OXS62.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-G4K3TP2I.js";import{a as ae}from"./chunk-YJAQZMJT.js";import{s as tt,t as nt}from"./chunk-UJLULWSR.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{z as A}from"./chunk-J4FIESTB.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
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
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
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)+`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{N as v,O as x,Q as g}from"./chunk-
|
|
2
|
+
import{N as v,O as x,Q as g}from"./chunk-OZNYQONA.js";import{a as p}from"./chunk-HVOXMCKE.js";import{a as b}from"./chunk-YDSGXB25.js";import{d as h,i as C}from"./chunk-TM6VLC6V.js";import{b as y}from"./chunk-HD6NR44L.js";import{M as E}from"./chunk-PI7OXS62.js";async function O(o,e,n,t={},i=process.cwd()){let u=e.mode==="agent";if(o&&e.fromStale)return v(n,"pass a <ref> OR --from-stale, not both"),2;if(!o&&!e.fromStale)return v(n,"evolve needs a <ref> or --from-stale"),2;if(!u&&(e.answer?.length??0)>0)return v(n,"--answer rides --mode agent: the blast-radius question is asked on the stream and answered on the next call. In a terminal, answer the prompt instead"),2;let s=x(i,n);if(!s)return 2;let a=()=>h(E(p(s))).targets.length===0;if(!e.yes&&!n.isTTY&&!u&&!(e.fromStale&&a()))return v(n,"evolve needs a TTY \u2014 the blast-radius confirm is the point; headless, run with --mode agent (the question rides the stream and is answered with --answer on the next call) or let kane-cli maintain reconcile drive it"),2;let d=u?b(e.answer):null,m=t.emitEvent;return C(p(s),{...o?{ref:o}:{},...e.because?{because:e.because}:{},...e.mode?{mode:e.mode}:{},...e.yes?{yes:!0}:{}},{io:n,asks:{blast:d??{ask:async(c,l)=>await n.confirm(`proceed with the re-design of ${l}?`)?"proceed":"decline"}},runDesign:t.runDesignForUc??I,...t.onChild?{onChild:t.onChild}:!m&&n.isTTY?{onChild:$(n)}:{},...m?{emit:m}:{},by:{kind:"human",id:process.env.USER??"operator"}})}function $(o){let e="",n="evolve";return t=>{t.kind==="start"?(e=t.subject,n=t.verb,o.out(`\u25CF ${y(t.verb).ing} ${t.subject}`)):t.kind==="end"&&o.out(t.ok?`\u25CF ${y(n).ed} ${e} \u2014 ${t.durS}s`:`\u25CF ${n} failed \u2014 ${t.exitCode!=null?`exited ${t.exitCode}`:"error"}${t.fixCmd?` \xB7 ${t.fixCmd}`:""}`)}}var I=async(o,e)=>{let{designTestsCommand:n}=await import("./bind-SSHAZAB3.js"),t=a=>n({useCase:o,force:!0,...e.mode?{mode:e.mode}:e.yes?{mode:"override"}:{},...e.because?{because:e.because}:{},...e.changeDelta!==void 0?{changeDelta:e.changeDelta}:{},...e.priorDesign!==void 0?{priorDesign:e.priorDesign}:{},...e.repinsKept?{repinsKept:!0}:{},...e.statement?{statement:e.statement}:{},...a?{onEvent:a}:{}});if(e.mode!=="agent")return t(e.onChildEvent);let i=e.onChildEvent,u=process.stdout.write,s="";process.stdout.write=((a,d,m)=>{if(i){s+=typeof a=="string"?a:Buffer.isBuffer(a)?a.toString("utf8"):String(a);let l=s.indexOf(`
|
|
3
3
|
`);for(;l>=0;)S(s.slice(0,l),i),s=s.slice(l+1),l=s.indexOf(`
|
|
4
|
-
`)}let c=typeof d=="function"?d:m;return typeof c=="function"&&queueMicrotask(()=>c(null)),!0});try{return await t()}finally{process.stdout.write=u,i&&s.length>0&&S(s,i)}};function S(o,e){let n=o.trim();if(!n.startsWith("{"))return;let t;try{t=JSON.parse(n)}catch{return}if(!t||typeof t!="object"||typeof t.type!="string")return;let i=t;i.type!=="done"&&e(i)}async function B(o,e,n={},t,i=process.cwd()){if(!t&&i===process.cwd()){let{remoteEntry:d}=await import("./remote-entry-
|
|
4
|
+
`)}let c=typeof d=="function"?d:m;return typeof c=="function"&&queueMicrotask(()=>c(null)),!0});try{return await t()}finally{process.stdout.write=u,i&&s.length>0&&S(s,i)}};function S(o,e){let n=o.trim();if(!n.startsWith("{"))return;let t;try{t=JSON.parse(n)}catch{return}if(!t||typeof t!="object"||typeof t.type!="string")return;let i=t;i.type!=="done"&&e(i)}async function B(o,e,n={},t,i=process.cwd()){if(!t&&i===process.cwd()){let{remoteEntry:d}=await import("./remote-entry-BZU4NFNS.js"),m=await d("maintain evolve",e.mode==="agent");if(m!==null){if("exit"in m)return m.exit;let{remoteEvolve:c}=await import("./evolve-remote-LILOAHYH.js");return c({choice:m.choice,...o!==void 0?{ref:o}:{},opts:e})}}let{makeHeadlessIO:u,agentRefusal:s}=await import("./headless-io-FFM5T6KL.js");if(e.mode!==void 0&&e.mode!=="interactive"&&e.mode!=="agent")return s(u("ndjson","evolve",t),`--mode must be interactive | agent, got '${e.mode}'`,"MODE_USAGE");if(e.mode==="agent"){let d=process.stdout.write.bind(process.stdout),m=process.stderr.write.bind(process.stderr),c=u("ndjson","evolve",t??{stdout:r=>{d(r)},stderr:r=>{m(r)}}),l=[],D=r=>{(r.type==="evolve_paused"||r.type==="session_paused")&&Array.isArray(r.next)&&l.push(...r.next),c.event(r)},k={out:c.out,err:(r,w)=>c.event({type:"error",message:r,...w?{code:w}:{}}),isTTY:!1,confirm:async()=>!1,ask:async()=>""},{runWithChannel:T}=await import("./run-channel-IIIYXOIW.js"),f=2;try{f=await T({event:r=>c.event(r)},()=>O(o,e,k,{...n,emitEvent:D},i))}catch(r){f=1,c.event({type:"error",message:r instanceof Error?r.message:String(r)})}return c.done(f,void 0,l.length>0?l:void 0)}let a=t?{...g(),out:d=>t.stdout(`${d}
|
|
5
5
|
`),err:d=>t.stderr(`${d}
|
|
6
6
|
`),isTTY:!1}:g();return O(o,e,a,n,i)}export{O as a,I as b,S as c,B as d};
|
|
@@ -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-ZCBOHWN3.js";import{a as n}from"./chunk-RZ4F3BHX.js";import{w as s,x as a}from"./chunk-J4FIESTB.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};
|
|
@@ -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-J4FIESTB.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};
|
|
@@ -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-SMGRXKXX.js";import{h as Q}from"./chunk-A2DODRHG.js";import{b as G}from"./chunk-LPJKNX6D.js";import{c as O}from"./chunk-SMXABALN.js";import{a as E}from"./chunk-LXK4B2FE.js";import{a as z}from"./chunk-C4KAPGBS.js";import{a as B}from"./chunk-YCVEI7BT.js";import{e as q}from"./chunk-Z7S3IWUX.js";import{l as M,q as R,t as Z}from"./chunk-A7RJQJNT.js";import{a as A}from"./chunk-HCBYKLMW.js";import{a as n,b as r,i as N}from"./chunk-33DWJV67.js";import{a as L}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-J4FIESTB.js";import{e as g}from"./chunk-UR6MHSHU.js";var H=g(L(),1);var y=g(A(),1);function ie(e){return[{value:"local",label:"Local build",hint:R(e).join(" / "),available:!0},{value:"uploaded",label:"Uploaded app",hint:"an app id from your cloud uploads",available:!0}]}function he({kind:e,onSelect:i,onCancel:m}){let s=ie(e),[b,f]=(0,H.useState)(0),[l,d]=(0,H.useState)(null);return N((p,a)=>{if(a.escape){m();return}if(a.upArrow&&f(t=>Math.max(0,t-1)),a.downArrow&&f(t=>Math.min(s.length-1,t+1)),a.return){let t=s[b];if(!t.available){d("That source isn't available \u2014 choose a local build for now.");return}d(null),i(t.value)}}),(0,y.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,y.jsx)(r,{color:o.orange,bold:!0,children:"App under test"}),(0,y.jsx)(n,{marginTop:1,flexDirection:"column",children:s.map((p,a)=>{let t=a===b,S=p.available?t?o.orange:void 0:o.muted;return(0,y.jsxs)(n,{children:[(0,y.jsxs)(r,{color:S,children:[t?"\u276F ":" ",p.label]}),(0,y.jsxs)(r,{color:o.dim,children:[" ",p.hint]})]},p.value)})}),l&&(0,y.jsx)(n,{marginTop:1,children:(0,y.jsx)(r,{color:o.red,children:l})}),(0,y.jsx)(B,{bindings:[{keys:"\u2191\u2193",label:"navigate"},{keys:"\u21B5",label:"select"}],escBackLabel:"back"})]})}var x=g(L(),1);var u=g(A(),1),j=50,J=500;function ae(e){return`${e.name} (${e.appId})`}function Re({kind:e,listApps:i,onSelect:m,onManualEntry:s,onCancel:b,busyMessage:f}){let[l,d]=(0,x.useState)([]),[p,a]=(0,x.useState)(!0),[t,S]=(0,x.useState)(!1),[ee,$]=(0,x.useState)(!1),[w,V]=(0,x.useState)(null),[X,oe]=(0,x.useState)(""),[re,_]=(0,x.useState)(!1),F=(0,x.useRef)(!0),D=(0,x.useRef)(0);if((0,x.useEffect)(()=>{let T=++D.current,k=X.trim();F.current?a(!0):k&&$(!0),S(!0),V(null),_(!1),(async()=>{let I=[];try{for(let P=0;;P+=j){let Y=await i({limit:j,offset:P,search:k});if(T!==D.current)return;if(I.push(...Y.apps),d([...I]),F.current&&(a(!1),F.current=!1),$(!1),Y.apps.length===0||I.length>=Y.total)break;if(I.length>=J){_(!0);break}}}catch(P){if(T!==D.current)return;V(P instanceof Error?P.message:String(P)),a(!1),$(!1)}finally{T===D.current&&S(!1)}})()},[X,i]),N((T,k)=>{if(k.tab){s();return}k.escape&&b()},{isActive:!!w&&!f}),f)return(0,u.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,u.jsx)(r,{color:o.orange,bold:!0,children:"App under test"}),(0,u.jsxs)(n,{marginTop:1,children:[(0,u.jsx)(C,{}),(0,u.jsxs)(r,{color:o.secondary,children:[" ",f]})]})]});if(w)return(0,u.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.red,paddingX:2,paddingY:1,children:[(0,u.jsx)(r,{color:o.red,bold:!0,children:"App under test"}),(0,u.jsx)(n,{marginTop:1,children:(0,u.jsx)(r,{color:o.red,children:"Could not load your uploads."})}),(0,u.jsx)(n,{marginTop:1,children:(0,u.jsx)(r,{color:o.dim,children:w})}),(0,u.jsx)(B,{bindings:[{keys:"tab",label:"tab to enter an app id"}],escBackLabel:"back to chat"})]});let te=new Map(l.map(T=>[T.appId,T])),ne=l.map(T=>({id:T.appId,label:ae(T)})),W=!p&&!t&&l.length===0&&!X.trim()?`No builds for ${M(e)} uploaded to this account yet \u2014 press Tab to enter an app id.`:null;return(0,u.jsx)(E,{title:"App under test",items:ne,loading:p,loadingText:"Loading your uploads\u2026",loadingMore:t,searching:ee,itemNoun:"uploads",preserveSelectionById:!0,onSearch:oe,onTab:s,extraHint:"tab to enter an id",footer:W?(0,u.jsx)(r,{color:o.dim,children:W}):re?(0,u.jsx)(r,{color:o.dim,children:`Showing the first ${J} \u2014 type to search the rest.`}):void 0,onSelect:T=>{let k=te.get(T.id);k&&m({appId:k.appId,name:k.name})},onCancel:b})}var U=g(L(),1);var c=g(A(),1);function we({busyMessage:e,onSubmit:i,onBack:m}){let[s,b]=(0,U.useState)(""),[f,l]=(0,U.useState)(null);return e?(0,c.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,c.jsx)(r,{color:o.orange,bold:!0,children:"App under test"}),(0,c.jsxs)(n,{marginTop:1,children:[(0,c.jsx)(C,{}),(0,c.jsxs)(r,{color:o.secondary,children:[" ",e]})]})]}):(0,c.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,c.jsx)(r,{color:o.orange,bold:!0,children:"App under test"}),(0,c.jsx)(n,{marginTop:1,children:(0,c.jsx)(r,{color:o.dim,children:"App id from your cloud uploads:"})}),(0,c.jsxs)(n,{marginTop:1,children:[(0,c.jsx)(r,{color:o.dim,children:" "}),(0,c.jsx)(O,{value:s,onChange:d=>{b(d),f&&l(null)},onSubmit:d=>{let p=d.trim();if(!p){l("Enter an app id.");return}if(!G(p)){l("That doesn't look like an app id \u2014 they start with APP.");return}l(null),i(p).then(a=>{!a.ok&&a.error&&l(a.error)})},onCancel:m,placeholder:"APP1016032231178585590501450"})]}),f&&(0,c.jsxs)(n,{marginTop:1,flexDirection:"column",children:[(0,c.jsx)(r,{color:o.red,children:f}),(0,c.jsx)(r,{color:o.dim,children:"Enter a valid app id \u2014 copy it from your cloud uploads."})]}),(0,c.jsx)(B,{bindings:[{keys:"\u21B5",label:"use this app"}],escBackLabel:"back"})]})}var K=g(L(),1);var h=g(A(),1);function le(e){return Q(e.trim())}function _e({kind:e,onBack:i,onSelect:m,onCancel:s}){let[b,f]=(0,K.useState)(""),[l,d]=(0,K.useState)(null),p=R(e).join(" / ");return(0,h.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,h.jsx)(r,{color:o.orange,bold:!0,children:"App under test"}),(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{color:o.dim,children:`Path to a build (${p}): `})}),(0,h.jsxs)(n,{marginTop:1,children:[(0,h.jsx)(r,{color:o.dim,children:" "}),(0,h.jsx)(O,{value:b,onChange:a=>{f(a),l&&d(null)},onSubmit:a=>{let t=le(a);if(!t){d(a.trim()?`Not a build \u2014 expected ${p}.`:"Enter the path to a build.");return}if(!Z(e,t.value)){d(`${t.kind} builds don't run on ${M(e)} \u2014 expected ${p}.`);return}d(null),m(t).then(S=>{!S.ok&&S.error&&d(S.error)})},onCancel:i,placeholder:`/path/to/app${R(e)[0]}`})]}),l&&(0,h.jsx)(n,{marginTop:1,children:(0,h.jsx)(r,{color:o.red,children:l})}),(0,h.jsx)(B,{bindings:[{keys:"\u21B5",label:"use this build"}],escBackLabel:"back"})]})}var v=g(A(),1);function pe(e){let i=e.kind==="simulator";switch(e.state){case"ready":return i?"Booted":"Running";case"stopped":return i?"Shutdown":"Stopped";case"unauthorized":return"UNAUTHORIZED";case"offline":return"Offline"}}function ce(e){switch(e.state){case"unauthorized":return"accept the authorisation prompt on the device, then reopen this list";case"offline":return e.kind==="simulator"?"not responding \u2014 open Simulator.app to inspect it":"not responding \u2014 reconnect it, or restart the emulator";default:return}}function se(e,i){let m=i.id!==void 0?{...i,id:z(i.id)}:i,s=e.virtualName!==void 0?{...e,virtualName:z(e.virtualName)}:e;return q(s,m)}function de(e){return e.virtualName??e.displayName}function ue(e,i){let m=e.state==="ready"||e.state==="stopped",s=ce(e),b=e.osVersion?` (${e.osVersion})`:"";return{id:e.id,label:`${de(e)}${b} \xB7 ${pe(e)}`,...i&&se(e,i)?{isActive:!0}:{},...m?{}:{disabled:!0},...!m&&s?{disabledHint:s}:{}}}function me(e){return e==="emulator"?"No Android emulator found. Make sure an emulator exists on this machine (Android Studio \u2192 Device Manager), then reopen this list.":e==="simulator"?"No iOS simulator found. Make sure a simulator exists on this machine (Xcode \u2192 Windows \u2192 Devices and Simulators), then reopen this list.":"No emulator or simulator found. Make sure one exists on this machine, then reopen this list."}function eo({targets:e,preselectedTarget:i,preselectedId:m,busyMessage:s,onSelect:b,onCancel:f,kind:l}){if(s)return(0,v.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,v.jsx)(r,{color:o.orange,bold:!0,children:"Device"}),(0,v.jsxs)(n,{marginTop:1,children:[(0,v.jsx)(C,{}),(0,v.jsxs)(r,{color:o.secondary,children:[" ",s]})]})]});if(e.length===0)return(0,v.jsxs)(n,{flexDirection:"column",borderStyle:"round",borderColor:o.orange,paddingX:2,paddingY:1,children:[(0,v.jsx)(r,{color:o.orange,bold:!0,children:"Device"}),(0,v.jsx)(n,{marginTop:1,children:(0,v.jsx)(r,{color:o.dim,children:me(l)})})]});let d=e.map(t=>ue(t,i)),p=i?d.find(t=>t.isActive)?.id??null:m?e.find(t=>t.id===m||t.virtualName===m)?.id??null:null,a=new Map(e.map(t=>[t.id,t]));return(0,v.jsx)(E,{title:"Device",items:d,itemNoun:"devices",defaultActiveId:p,preserveSelectionById:!0,onSelect:t=>{let S=a.get(t.id);S&&b(S)},onCancel:f})}export{he as a,Re as b,we as c,_e as d,eo as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as _}from"./chunk-
|
|
2
|
+
import{a as _}from"./chunk-X45RZIAJ.js";import{a as A}from"./chunk-KCXLRR3Q.js";import{a as i}from"./chunk-PVN64537.js";import{a as h}from"./chunk-ZCBOHWN3.js";async function w(d){let{creds:a,env:l,usernameFlag:c,accessKeyFlag:u,log:r}=d,e=null,o=null;if(c&&u)e={username:c,access_key:u},r("info","AUTH_RESOLVE_FLAGS","Auth resolved via CLI flags",{username:c});else{let s=a.resolveAuth();s?.method==="basic"&&(e={username:s.username,access_key:s.access_key},r("info","AUTH_RESOLVE_CONFIG","Auth resolved via config",{username:s.username}))}if(!e){let{credentials:s,profile:k}=a.getActiveCredentials();if(!s)throw new i("Not authenticated \u2014 no credentials found","not_authenticated");if(o=s.access_token,s.expires_at-Date.now()/1e3<300)try{let n=await A({creds:a,profile:k,env:l,credentials:s});n&&(o=n.accessToken,r("info","AUTH_TOKEN_REFRESHED","OAuth token refreshed"))}catch(n){let m=n instanceof Error?n.message:String(n);throw r("error","TOKEN_REFRESH_FAILED","Token refresh failed",{error:m}),new i(`Token refresh failed: ${m}`,"refresh_failed")}}let v=h(l),E=async()=>o,g=e?{username:e.username,access_key:e.access_key}:null,f=new _(v.controllerBaseUrl,E,g,r),t=await f.resolve();return t&&!e&&(e={username:t.username,access_key:t.access_key},r("info","AUTH_RESOLVE_CONTROLLER","Auth resolved via controller",{username:t.username})),{basicAuth:e,token:o,resolver:f,resolvedCreds:t}}export{w as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{S as G,T as I,U as O,V as _}from"./chunk-
|
|
2
|
+
import{S as G,T as I,U as O,V as _}from"./chunk-OZNYQONA.js";import{a as S}from"./chunk-HVOXMCKE.js";import{a as u}from"./chunk-73Y6T2UK.js";import{Ia as N}from"./chunk-PI7OXS62.js";import{existsSync as M}from"fs";var q=new Set(["interactive","agent","ci","override"]);function B(t){return t.mode!=null&&!q.has(t.mode)?{error:`design: --mode must be interactive | agent | ci | override, got '${t.mode}'`}:t.strength!=null&&t.strength!=="pairwise"&&t.strength!=="3-wise"?{error:`design: --strength must be pairwise | 3-wise, got '${t.strength}'`}:t.max!=null&&(!Number.isInteger(t.max)||t.max<1)?{error:"design: --max must be a positive integer"}:!t.useCase&&!t.resume?{error:"design: --use-case is required (or --resume <sid> \u2014 the session remembers its use-case)"}:{useCase:t.useCase,max:t.max,strength:t.strength,mode:t.mode,force:t.force,resume:t.resume,plan:t.plan,message:t.message,phase:t.phase,allowUnreviewed:t.allowUnreviewed,because:t.because,changeDelta:t.changeDelta,priorDesign:t.priorDesign,...t.repinsKept?{repinsKept:!0}:{},statement:t.statement}}async function Z(t){let p=async(e,r)=>{if(t.mode!=="agent")return process.stderr.write(e+`
|
|
3
3
|
`),2;let{makeHeadlessIO:i,agentRefusal:d}=await import("./headless-io-FFM5T6KL.js");return d(i("ndjson","design"),e,r)};if(t.mode!=null&&!["interactive","agent","ci","override"].includes(t.mode)){let{makeHeadlessIO:e,agentRefusal:r}=await import("./headless-io-FFM5T6KL.js");return r(e("ndjson","design"),`design: --mode must be interactive | agent | ci | override, got '${t.mode}'`,"MODE_USAGE")}let l=t.json===!0;{let{jsonModeRefusal:e}=await import("./headless-io-FFM5T6KL.js"),r=e("design",t.mode,l);if(r!==null)return process.stderr.write(`${r}
|
|
4
4
|
`),2}let h=B(t);if("error"in h)return p(h.error);let s=h;if(s.useCase?.startsWith("sha256:"))try{let[{openGraph:e},{expandUseCaseRef:r}]=await Promise.all([import("./readmodel-TRV4E3MW.js"),import("./use-case-ref-44BPIP4N.js")]);s.useCase=r(e(u(process.cwd())),s.useCase)}catch{}{let{validateResumeMessage:e}=await import("./headless-io-FFM5T6KL.js"),r=e(s,"design");if(r)return p(r)}{let{gateStructuredFlags:e}=await import("./structured-answers-EQ2AP3F7.js"),r=e(t,"design");if(r)return p(r,"STRUCTURED_FLAGS_USAGE")}if(!M(u(process.cwd())))return p("error: no context store here (run `kane-cli context ingest` + `kane-cli context extract` first)","NO_STORE");{let e=O(u(process.cwd()));if(e){if(t.mode!=="agent")return p(`error: ${e.text}
|
|
5
5
|
next: ${e.remedy}`,e.code);let{makeHeadlessIO:r}=await import("./headless-io-FFM5T6KL.js"),i=r("ndjson","design");return i.event(_(e)),i.done(2,"refused")}}if(s.useCase&&!t.allowUnreviewed)try{let[{openGraph:e},{consentCanStart:r,designEntryGate:i},{peekSession:d}]=await Promise.all([import("./readmodel-TRV4E3MW.js"),import("./trust-gate-674C2NZS.js"),import("./sessions-NH2EG7BP.js")]),y;try{y=s.resume?d(u(process.cwd()),s.resume)?.use_case:void 0}catch{y=void 0}let o=i(e(u(process.cwd())),{useCase:s.useCase,resuming:!!s.resume,sessionUseCase:y});if(o){let b=r(o),T=s.mode??"interactive";if(b&&T==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY){let{createInterface:x}=await import("readline/promises"),m=x({input:process.stdin,output:process.stderr}),g=(await m.question(`design: ${o.detail}
|
|
@@ -8,9 +8,9 @@ Design against it anyway? (y/N) `)).trim().toLowerCase();if(m.close(),g!=="y"&&g
|
|
|
8
8
|
`),2}}catch(e){process.env.KANE_DEBUG&&process.stderr.write(`trust gate skipped: ${String(e)}
|
|
9
9
|
`)}let n=null,f=null;try{if(!s.mode&&!process.stdin.isTTY)return process.stderr.write(`design: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
|
|
10
10
|
`),2;let e=s.mode??"interactive";if(e==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`design: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
11
|
-
`),2;let{bindDesignInteractive:a}=await import("./interactive-bind-
|
|
11
|
+
`),2;let{bindDesignInteractive:a}=await import("./interactive-bind-SOD7VTAY.js");return await a(s)}let{runAgent:r}=await import("./bridge-2UHJOVLX.js"),{makeInterruptGuard:i}=await import("./interrupt-guard-QETBPINI.js"),{baseUrlAdvisory:d}=await import("./turn-preflight-R4PU6NYY.js"),{makeHeadlessIO:y,resolveEncoding:o,guardedChannels:b}=await import("./headless-io-FFM5T6KL.js"),{withStructuredNext:T,prepareStructuredResume:x}=await import("./structured-answers-EQ2AP3F7.js");n=T(y(o(e,l),"design"));let m=await G(u(process.cwd()));m&&(o(e,l)==="ndjson"?n.event(I(m)):n.progress(m.text));let g=n,k=a=>{g.out(a),g.event({type:"note",text:a})},{telemetryBootstrap:Y,telemetryEnvName:H}=await import("./bootstrap-XGKU4WXB.js"),v=Y({verb:"design",mode:e,contextRoot:u(process.cwd()),env:H(),resumeSid:s.resume,write:!0,longSession:!0});f=a=>v.end(a);let c=x({opts:t,reader:S(u(process.cwd())).sessions(),verb:"design"});if(c.kind==="refuse")return n.out(c.error),e==="agent"&&n.event({type:"error",message:c.error,code:c.code}),await v.end({exit_code:2}),e==="agent"?n.done(2,"refused"):2;let D;if(c.kind==="apply"){for(let a of c.notes)k(a);if(c.matchedQids.length>0){k(`applying ${c.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let a of c.matchedQids)n.event({type:"panel_resolved",id:a,by:"user",via:"flag"})}c.statement&&(D=[s.message,c.statement].filter(Boolean).join(`
|
|
12
12
|
|
|
13
|
-
`))}let R=d();R&&k(R);let C=i(r,a=>n.out(a)),j=b(n,()=>C.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let a=e==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY?async E=>{let{createInterface:L}=await import("readline/promises"),A=L({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await A.question(`${E} [y/N] `)).trim())}finally{A.close()}}:void 0,{headlessDesign:P}=await import("./design-headless-
|
|
13
|
+
`))}let R=d();R&&k(R);let C=i(r,a=>n.out(a)),j=b(n,()=>C.interrupted(),/^error: (design agent failed|the design agent ended)/);try{let a=e==="interactive"&&process.stdin.isTTY&&process.stdout.isTTY?async E=>{let{createInterface:L}=await import("readline/promises"),A=L({input:process.stdin,output:process.stdout});try{return/^y(es)?$/i.test((await A.question(`${E} [y/N] `)).trim())}finally{A.close()}}:void 0,{headlessDesign:P}=await import("./design-headless-HYWZIIDS.js"),{localSite:K}=await import("./store-site-K5NHLI7D.js"),$=u(process.cwd()),w=await P({...s,mode:e,...D!==void 0?{message:D}:{},...a?{confirmRetarget:a}:{}},K($,S($)),{out:j.out,emit:E=>{t.onEvent?.(E),j.emit(E)},progress:g.progress,channel:o(e,l)==="ndjson"},{agent:C.agent,telemetry:v});if(C.interrupted()&&w!==3)return n.out("interrupted \u2014 no session saved"),await v.end({exit_code:130}),n.done(130);if(w===1&&n.out(v.supportFooter()),await v.end({exit_code:w}),w!==0)return n.done(w);let U=await z($,s.useCase,s.resume);return U.length>0?n.done(w,void 0,U):n.done(w)}finally{C.dispose()}}catch(e){if(e instanceof N)return f&&await f({exit_code:2}).catch(()=>{}),n?(n.event(_({code:e.code,text:e.message,remedy:e.remedy})),n.done(2,"refused")):(process.stderr.write(`error: ${e.message}
|
|
14
14
|
next: ${e.remedy}
|
|
15
15
|
`),2);f&&await f({exit_code:1}).catch(()=>{});let r=e instanceof Error?e.message:String(e);n?.event({type:"error",message:`error: design failed: ${r}`});let i=n?d=>n.out(d):d=>process.stderr.write(d+`
|
|
16
16
|
`);return i(`error: design failed: ${r}`),(process.env.ASSURANCE_LOG_LEVEL??"").toLowerCase()==="debug"&&e instanceof Error&&e.stack&&i(e.stack),i('hint: the full trace is in the file named on the "trace:" line at the start of this run'),n?n.done(1):1}}async function z(t,p,l){try{let[{openGraph:h},{peekSession:s},{awaitingOfUseCase:n},{shellArg:f}]=await Promise.all([import("./readmodel-TRV4E3MW.js"),import("./sessions-NH2EG7BP.js"),import("./stream-warnings-GM7YEOVG.js"),import("./shell-arg-FN3MT5U7.js")]),e=p??(l?s(t,l)?.use_case:void 0);if(!e)return[];let r=h(t);return[...n(r,e)].map(([i,d])=>({cmd:`kane-cli context review --approve ${f(r.displayNameOf(i)??i.slice(0,19))} --mode agent`,why:`approves the criterion ${d.size===1?"1 test checks":`${d.size} tests check`}`}))}catch{return[]}}export{B as a,Z as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{r as i,s as u}from"./chunk-UJLULWSR.js";async function d(e){if(!e.isInteractive)return{recovered:!1};if(f(e.creds,e.authOnly===!0))return{recovered:!1};let{SingleShotApp:a}=await import("./SingleShotApp-
|
|
2
|
+
import{r as i,s as u}from"./chunk-UJLULWSR.js";async function d(e){if(!e.isInteractive)return{recovered:!1};if(f(e.creds,e.authOnly===!0))return{recovered:!1};let{SingleShotApp:a}=await import("./SingleShotApp-HMOXO5DW.js"),{ScrollbackProvider:t}=await import("./scrollback-GGNBDFQV.js"),{render:r}=await import("./build-5ZN47FAT.js"),o=await import("./react-QWOAB3TB.js"),n={current:null},l={current:!1},{waitUntilExit:c,unmount:s}=r(o.default.createElement(t,null,o.default.createElement(a,{resultRef:n,mode:"login",loginCompleteRef:l,...e.authOnly?{authOnly:!0}:{}})),{exitOnCtrlC:!1});u(()=>s()),await c();try{process.stdin.setRawMode?.(!1)}catch{}return process.stdout.write("\x1B[?25h"),l.current?{recovered:!0}:e.onCancel==="return"?{recovered:!1,cancelled:!0}:(i(0,"Startup gate cancelled"),{recovered:!1})}function f(e,a=!1){let t=e.getActiveProfile(),r=e.getDefaultEnv();if(!t||!!!(e.loadBasicAuth(t,r)||e.loadCredentials(t,r)))return!1;if(a)return!0;let n=e.loadProfileConfig(t,r)??{};return!!n.project_id&&!!n.folder_id}export{d as a,f as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as qr}from"./chunk-SALZ6WSF.js";import{a as Pr}from"./chunk-ENRFXGID.js";import{e as dt,f as jt,g as Bt,h as qe}from"./chunk-X6FCXBXU.js";import{A as st,B as ve,C as yr,D as oe,E as $e,F as ot,G as br,H as K,I as it,J as Tt,K as at,L as ke,M as wr,N as vr,Q as Te,a as tr,b as nr,c as Se,d as Ee,e as de,f as tt,g as sr,h as or,i as ce,j as cr,k as Ce,l as Ae,m as lr,n as fr,o as hr,p as At,q as Nt,r as Q,s as Ne,t as gr,u as Pt,v as Pe,w as mr,x as qt,y as te,z as rt}from"./chunk-
|
|
2
|
+
import{a as qr}from"./chunk-SALZ6WSF.js";import{a as Pr}from"./chunk-ENRFXGID.js";import{e as dt,f as jt,g as Bt,h as qe}from"./chunk-X6FCXBXU.js";import{A as st,B as ve,C as yr,D as oe,E as $e,F as ot,G as br,H as K,I as it,J as Tt,K as at,L as ke,M as wr,N as vr,Q as Te,a as tr,b as nr,c as Se,d as Ee,e as de,f as tt,g as sr,h as or,i as ce,j as cr,k as Ce,l as Ae,m as lr,n as fr,o as hr,p as At,q as Nt,r as Q,s as Ne,t as gr,u as Pt,v as Pe,w as mr,x as qt,y as te,z as rt}from"./chunk-OZNYQONA.js";import{a as R,b as rr,d as X,e as Oe,h as ir,i as ar,k as dr}from"./chunk-CB4ARIHR.js";import{a as Un,b as Vn,e as Wn}from"./chunk-SSOUYKVG.js";import{a as Zn}from"./chunk-HVOXMCKE.js";import{a as Yn,b as zn}from"./chunk-WMGKUERB.js";import{a as Qn}from"./chunk-UWPG5MWM.js";import{a as Jn}from"./chunk-73Y6T2UK.js";import{b as Xn,e as er,h as Ct,i as J}from"./chunk-XMPTFXPW.js";import{e as Ar,f as Nr}from"./chunk-MINDIQET.js";import{a as Er}from"./chunk-IZ66FKPC.js";import{a as Or,b as Lt,c as Cr}from"./chunk-E4GIGM5V.js";import{a as Ir,d as Sr}from"./chunk-3KY7HHQU.js";import{h as _r,i as Rr}from"./chunk-ZHAMVLQZ.js";import{g as Ft,h as $r,q as kr}from"./chunk-Z24SD2EJ.js";import{a as nt,b as le,c as pr,d as ur}from"./chunk-23DKB2MT.js";import{b as Ot,d as Kn}from"./chunk-CQDCNP7V.js";import{b as dn,f as cn,h as ln,k as pn,l as un,q as et}from"./chunk-7V34ZMMS.js";import{b as we}from"./chunk-6PIIUAZF.js";import{Ea as C,Fa as On,Ia as Cn,Ka as An,M as wn,Na as Nn,Oa as Pn,Pa as qn,Qa as ee,Ra as Tn,Sa as jn,Ua as Bn,Va as Qe,Ya as Fn,Za as Ln,a as ae,d as Et,da as vn,ea as $n,eb as xn,fa as kn,fb as Ze,ga as _n,ha as Rn,ia as In,ja as Sn,kb as Mn,mb as Hn,na as Ye,oa as En,ob as Xe,pa as ze,q as mn,r as yn,t as bn,vb as Dn,wb as Gn}from"./chunk-PI7OXS62.js";import{c as hn,n as gn}from"./chunk-DBMW3VUN.js";import{d as fn,f as Je,g as Ke}from"./chunk-KU3YHPWZ.js";import{b as an}from"./chunk-7V4BQSSV.js";import{g as We}from"./chunk-ZCRZFAOT.js";import{existsSync as De,readdirSync as ws,readFileSync as vs,realpathSync as oi,statSync as ii,writeFileSync as ai}from"fs";import{basename as Rt,join as Ge,relative as di,resolve as sn}from"path";import{randomBytes as Fs}from"crypto";var Tr=8,je=()=>dr(Fs(8).toString("hex")),jr=(e,t)=>e!==null&&Buffer.from(e).equals(Buffer.from(t)),Ls=[["P1 exclusive create",async e=>{for(let t=1;t<=2;t++){let n=je(),r=Buffer.from(`probe ${t} first`);if(await e.putIfAbsent(n,r)!=="created")return"a fresh key was reported as existing";if(await e.putIfAbsent(n,Buffer.from(`probe ${t} second`))!=="exists")return"the second write to one key was not refused";if(!jr(await e.get(n),r))return"the second write replaced the first"}return null}],["P2 contention",async e=>{let t=je(),r=(await Promise.all(Array.from({length:Tr},(o,i)=>e.putIfAbsent(t,Buffer.from(`contender ${i}`))))).filter(o=>o==="created").length;return r===1?null:`${r} of ${Tr} concurrent writers were told "created"`}],["P3 read-after-write",async e=>{let t=je(),n=Buffer.from("visible");return await e.putIfAbsent(t,n),await e.head(t)?jr(await e.get(t),n)?(await e.list(t)).includes(t)?null:"list does not show a key just created":"get does not return the bytes just created":"head does not see a key just created"}],["P4 definitive absence",async e=>await e.head(je())?"a never-written key was reported present":null]];async function ct(e){if(e.probe){let r=await e.probe();return{tier:Math.max(r.tier,e.ceilingTier),detail:r.detail}}let t=1,n="all probes passed";for(let[r,o]of Ls){let i;try{i=await o(e)}catch(s){if(s instanceof R){if(!(s.code==="SYNC_LOCATION_REFUSED_WRITE"&&r.startsWith("P1")&&await Br(e)))throw s;n=`${r}: ${s.message}`,t=3;break}n=`${r}: ${s instanceof Error?s.message:String(s)}`,t=r.startsWith("P1")&&await Br(e)?3:2;break}if(i!==null){n=`${r}: ${i}`,t=2;break}}return{tier:Math.max(t,e.ceilingTier),detail:n}}async function Br(e){try{return!await e.head(je())}catch(t){if(t instanceof R)throw t;return!1}}import{existsSync as xs,readFileSync as xr}from"fs";import{join as Ms}from"path";async function xt(e,t,n,r){let i=de(e).entries[n];if(!i)throw new Error(`no sync state for ${n} \u2014 run kane-cli context sync add ${n} <descriptor> first`);if(i.tier!==1)throw new R("SYNC_READ_ONLY",`${n} is a tier ${i.tier} location: it can be cloned and pulled, never pushed`,"push to a location whose probe reached tier 1, or pull from this one");let s=await Ce(e,t,i.witness);switch(s.kind){case"empty-storage":case"ahead":case"up-to-date":break;case"behind":case"empty-local":throw new R("SYNC_BEHIND",`${n} holds ${s.storage.seq} records, this store ${s.local?.seq??0}: it has records this store has not seen`,`kane-cli context pull ${n}`);case"diverged":throw new R("SYNC_DIVERGED",`you and ${n} both added work after position ${s.at-1}; nothing was pushed`,`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 R("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`)}let a=s.storage,c=qn(e),d;try{An(e),d=Hs(e,a)}catch(M){throw M instanceof Cn?new R("SYNC_REBASE_PENDING",`${M.message.split(";")[0]}; nothing was pushed`,M.remedy):M}finally{c()}let l=d.map(M=>Ds(e,M)),f=0,p=0,g=0,u=0,m=a,y=null,w=null,h=t.beginTransaction?await t.beginTransaction():void 0,b=h?{...t,head:h.head,get:h.get,list:t.list.bind(t),putIfAbsent:t.putIfAbsent.bind(t)}:t,v=h?h.stageIfAbsent.bind(h):t.putIfAbsent.bind(t),q=[],re=M=>h?q.push(M):r(M);try{let M=new Set;for(let S of l){for(let D of S.blobs)if(await v(D.key,D.bytes)!=="exists")p++,M.add(D.key);else if(!M.has(D.key)){let $=await b.get(D.key);if($===null||Ot(Buffer.from($))!==D.fp){w=new R("SYNC_OBJECT_CORRUPT",`the blob ${D.fp} ${n} already holds does not hash to its name (named by record ${S.seq}); the record was not pushed`,"the storage object needs a human look before anything more is pushed to it");break}M.add(D.key)}if(w)break;S.proposal&&await v(S.proposal.key,S.proposal.bytes)!=="exists"&&g++;let Z=Oe(S.seq);if(await v(Z,S.raw)!=="exists")f++;else if((await ce(b,S.seq)).hash===S.hash)re(`position ${S.seq} is already on ${n}`),u++;else{y=S.seq;break}m={seq:S.seq,hash:S.hash}}if(h||await Lr(t,m,a,n),m&&!await b.head(X)){let S=await ce(b,1),Z={layout:1,canonicalizer:"v1",genesis_hash:S.hash};await v(X,Buffer.from(JSON.stringify(Z)+`
|
|
3
3
|
`,"utf8"))!=="exists"&&re(`wrote ${X} on ${n}`)}if(h){if(m){let $=await b.get(X),ge=await ce(b,1),T={};try{let me=JSON.parse(Buffer.from($??[]).toString("utf8"));me&&typeof me=="object"&&!Array.isArray(me)&&(T=me)}catch{}if(T.layout!==1||T.canonicalizer!=="v1"||T.genesis_hash!==ge.hash)throw new R("SYNC_OBJECT_CORRUPT",`${X} does not describe this context's verified genesis and format.`,"Ask the location owner to inspect the metadata before publishing.")}if(w)throw w;if(y!==null)throw new R("SYNC_POSITION_TAKEN",`position ${y} on ${n} was taken by another writer; this batch was not published`,Fr(n,y));let S=await h.commit(),Z=new Set(S.created),D=l.filter($=>Z.has(Oe($.seq))).length;u+=f-D,f=D,p=new Set(l.flatMap($=>$.blobs.map(ge=>ge.key)).filter($=>Z.has($))).size,g=new Set(l.flatMap($=>$.proposal?[$.proposal.key]:[]).filter($=>Z.has($))).size}h&&await Lr(t,m,a,n);for(let S of q)r(S);let se="";if(m)try{lr(e,n,m,{forwardOnly:!0})}catch(S){if(y===null||!(S instanceof C))throw S;se=" (the witness was not saved; the next pull records it)"}if(w)throw w;if(y!==null)throw new R("SYNC_POSITION_TAKEN",`position ${y} on ${n} was taken by another writer while this push ran; this store's history through position ${m?.seq??0} is confirmed on ${n}${se}`,Fr(n,y))}finally{await h?.abort()}return{pushed:f,from:a?.seq??0,to:m?.seq??0,blobs:p,proposals:g,alreadyThere:u}}function Fr(e,t){return t===1?`${e} holds a different history: to work on it, clone it with kane-cli context clone <descriptor of ${e}> <dir>; to share this store, add an empty location`:`kane-cli context pull ${e} --rebase`}async function Lr(e,t,n,r){if(!t||t.seq<=(n?.seq??0))return;let o=await ce(e,t.seq);if(o.hash!==t.hash)throw new R("SYNC_OBJECT_CORRUPT",`${r} answered "created" for position ${t.seq} but serves a record hashing ${o.hash}, not ${t.hash}`,"The location needs inspection before publishing more context.")}function Hs(e,t){let{records:n,hashes:r}=Ln(e,t?.seq??0,t?.hash??null);return n.map((o,i)=>{let s=r[i],a=xr(Ms(e,"commits",`${String(o.seq).padStart(6,"0")}-${s.slice(7,19)}.json`));if(ee(JSON.parse(a.toString("utf8")))!==s)throw new Error(`record ${o.seq} changed on disk while it was being read \u2014 run kane-cli context fsck`);return{rec:o,hash:s,raw:a}})}function Ds(e,{rec:t,hash:n,raw:r}){{let o=tr(t),i=o.blobs.map(s=>{let a=Kn(e,s);if(a===null)throw new R("SYNC_CLOSURE_MISSING",`record ${t.seq} names blob ${s}, which this store does not hold`,"restore the blob from a copy of this store, or run kane-cli context fsck");if(Ot(a)!==s)throw new R("SYNC_LOCAL_BLOB_CORRUPT",`record ${t.seq} names blob ${s}, but the local file does not hash to that: it is torn`,"restore the blob from a copy of this store, or run kane-cli context fsck");return{key:ir(s),fp:s,bytes:a}});return{seq:t.seq,hash:n,raw:new Uint8Array(r),blobs:i,proposal:Gs(e,o.proposalId)}}}function Gs(e,t){if(t===null)return null;let n=Qn(e,t);if(!xs(n))return null;let r=xr(n);return{key:ar(t,nr(r.toString("utf8"))),bytes:r}}import{existsSync as Us,readdirSync as Vs,readFileSync as Mr}from"fs";import{basename as Ws,join as Mt}from"path";function lt(e){return{id:Ws(e),witness:()=>JSON.parse(Mr(Mt(e,"base-witness.json"),"utf8")),records:t=>Ht(e,t),readIntent:t=>bn(e,t)}}var Js=/^\d{6}-[0-9a-f]{12}\.json$/;function Ht(e,t){let n=Mt(e,"commits"),r=Us(n)?Vs(n).filter(s=>Js.test(s)).sort():[],o=t.hash,i=t.seq;return r.map(s=>{let a;try{a=JSON.parse(Mr(Mt(n,s),"utf8"))}catch(d){throw new C(`backup record ${s} is not JSON: ${String(d)}`)}if(i+=1,a.seq!==i||a.prev_hash!==o)throw new C(`backup record ${s} does not continue the chain at ${i} from ${String(o)}`);let c=ee(a);if(!c.slice(7).startsWith(s.slice(7,19)))throw new C(`backup record ${s} does not match its name`);return o=c,{seq:i,hash:c,body:a}})}function pt(e,t){let n=t.witness(),r=e.recordsSince(null).slice(0,n.base.seq),o=t.records(n.base),i=[...r,...o.map(p=>p.body)],s=[...r.map(ee),...o.map(p=>p.hash)],a=new Map;for(let p of i)for(let g of p.nodes)a.set(g.cid,{label:g.label,content:g.content});let c=Mn();Hn(null,c,i,s,{writeNodeFiles:!1});let d=Gn(null,c,a),l=new Map(o.map(p=>[p.seq,p])),f=p=>d.displayNameOf(p)??p.slice(0,19);return{backup:t,backupId:t.id,from:n.from,base:n.base,index:c,graph:d,records:o,chain:i,recordAt:p=>l.get(p),resolveName:p=>d.resolve(p)?.cid,nameOf:p=>d.displayNameOf(p)??void 0,displayNameFor:p=>{let g=Dt(t,p),u=Object.keys(p.source_head_moves),m=g==="revert"?String(Ks(t,p)??""):g==="names"?(p.names??[]).map(y=>y.slug).join(", "):u.length>0?u.join(", "):p.nodes.length>0?[...new Set(p.nodes.map(y=>f(y.cid)))].join(", "):(p.executions?.length??0)>0?[...new Set(p.executions.map(y=>f(y.about)))].join(", "):p.review.length>0?[...new Set(p.review.map(y=>f(y.id)))].join(", "):p.supersessions.length>0?[...new Set(p.supersessions.map(y=>y.kind==="node"?f(y.old):y.ecid.slice(0,19)))].join(", "):u.join(", ");return m?`${g} ${m}`:g}}}function Ks(e,t){try{let r=e.readIntent(ee(t))?.args?.seq;return typeof r=="number"?r:void 0}catch{return}}function Dt(e,t){let n=null;try{n=e.readIntent(ee(t))}catch{n=null}if(n)return n.verb;if(t.intent_verb)return t.intent_verb;let r=Object.entries(t.source_head_moves);return(t.executions?.length??0)>0?"execution":t.design_of?"design":t.proposal_id!=null?"extract":t.conv?t.conv.turn===0?"conv-mint":"conv-turn":r.length===1&&r[0][1]===null&&t.supersessions.some(o=>o.kind==="node"&&o.new===null)?"retire":r.length===1&&typeof r[0][1]=="string"&&t.nodes.some(o=>o.label==="source")?"ingest":t.review.some(o=>o.resolution==="reset")||t.supersessions.some(o=>o.kind==="node"&&o.new===o.old||o.kind==="edge"&&o.revoke)?"revert":t.nodes.length===0&&t.edges.length===0&&t.supersessions.length===1&&t.supersessions[0].kind==="node"&&t.supersessions[0].new===null?"archive":t.nodes.length===0&&t.edges.length===0&&t.review.length===0&&(t.names?.length??0)>0?"names":t.nodes.length===0&&t.edges.length===0&&t.supersessions.length===0&&t.review.length>0?"review":"unknown"}import{existsSync as Hr,readdirSync as Ys,readFileSync as Gt}from"fs";import{isAbsolute as zs,join as ut,normalize as Qs,relative as Zs,sep as Xs}from"path";var eo=e=>e===""||zs(e)||e.includes("\\")||Qs(e).split(Xs).some(t=>t==="..")||e.startsWith("./")||e.includes("\0");function Fe(e){let t=ut(e,"manifest.json");if(!Hr(t))throw new C(`backup ${e} has no manifest.json \u2014 it was never completed; kane-cli context sync doctor`);let n;try{n=JSON.parse(Gt(t,"utf8"))}catch(s){throw new C(`backup manifest ${t} is not JSON: ${s instanceof Error?s.message:String(s)}`)}if(!Array.isArray(n))throw new C(`backup manifest ${t} is not a list`);let r=new Set,o=[];for(let s of n){let a=typeof s?.name=="string"?s.name:"";if(eo(a))throw new C(`backup manifest names an unsafe path ${JSON.stringify(s?.name)} \u2014 the backup is not trusted`);let c=ut(e,a);if(!Hr(c))throw new C(`backup file ${a} is missing from ${e}`);let d=Gt(c);if("sha256:"+an(d)!==s.hash)throw new C(`backup file ${a} does not match its manifest hash \u2014 the backup was changed after it was written`);if(a.startsWith("commits/"))try{r.add(ee(JSON.parse(d.toString("utf8"))))}catch(l){throw new C(`backup record ${a} is not a record: ${l instanceof Error?l.message:String(l)}`)}a.startsWith("intents/")&&o.push(a)}let i=new Set(n.map(s=>s.name));for(let s of Dr(e)){let a=Zs(e,s);if(a!=="manifest.json"&&!i.has(a))throw new C(`backup ${e} holds ${a}, which its manifest does not name \u2014 the backup was changed after it was written`)}for(let s of o){let a;try{a=JSON.parse(Gt(ut(e,s),"utf8"))}catch(d){throw new C(`backup envelope ${s} is not JSON: ${d instanceof Error?d.message:String(d)}`)}let c=mn(a);if(c!==null)throw new C(`backup envelope ${s} is not a valid intent: ${c}`);if(typeof a.born?.hash!="string"||!r.has(a.born.hash))throw new C(`backup envelope ${s} was born from a record the backup does not hold`)}}function Dr(e){let t=[];for(let n of Ys(e,{withFileTypes:!0})){let r=ut(e,n.name);n.isDirectory()?t.push(...Dr(r)):t.push(r)}return t}import{basename as Oo,join as Co}from"path";import{existsSync as Ao,readFileSync as No}from"fs";var G=class extends Error{},L=(e,t)=>({kind:"apply",inputs:e,...t&&t.length>0?{aliases:t}:{}}),V=e=>({kind:"noop",reason:e}),Vt=e=>({kind:"dedupe",as:e}),k=(e,t,n,r,o={})=>({kind:"hold",hold:{kind:e,mine:t,theirs:n,answers:r,detail:o}}),Gr=(e,t)=>{let n=ft(t.label,t.content);return e.graph.byLabel(t.label).filter(r=>!e.graph.superseded.has(r.cid)&&ft(t.label,r.content)===n).map(r=>r.cid)},z=e=>e?e.slice(0,19):"none",H=(e,t)=>e.maps.cid.rewrite(t);function I(e,t,n){if(typeof t!="string")throw new G(`${n} was not pinned`);let r=H(e,t);if(!e.graph.hasNode(r))throw new G(`${n} ${_(e,t)} has no counterpart on ${e.location}`);return r}var j=(e,t)=>e.graph.tipOf(t),Wt=(e,t)=>e.graph.superseded.has(e.graph.tipOf(t)),_=(e,t)=>e.fold.nameOf(t)??z(t),E=(e,t)=>e.graph.displayNameOf(t)??z(t);function Jt(e,t,n,r){let o=r==="fold"?e.fold.graph:e.graph,i=o.displayNameOf(t);if(i!==null&&i!==n)return i;let s=o.tipOf(t);for(let[d,l]of o.heads)if(l===t||l===s)return d;let a=o.getNode(t);if(a?.label==="source"&&typeof a.content.source_id=="string")return a.content.source_id;let c=a?.content.title??a?.content.text??a?.content.statement;return a&&typeof c=="string"&&c!==""?`${a.label} "${Y(c,32)}"`:z(t)}var F=e=>e.created_by?.by?.id??e.review[0]?.by.id??e.supersessions[0]?.by.id??e.names?.[0]?.by.id??"someone",N=e=>e.ts;function Y(e,t=48){let n=typeof e=="string"?e:JSON.stringify(e);return n.length>t?`${n.slice(0,t-1)}\u2026`:n}var Ut={test_md_blob:"steps",objectives_blob:"checks"},to=/^sha256:[0-9a-f]{64}$/,no=(e,t)=>e==="derived"||Or.includes(e)||/_blob$/.test(e)||/(^|_)id$|Id$/.test(e)||t.some(n=>typeof n=="string"&&to.test(n));function pe(e,t,n,r){let o=[...new Set([...Object.keys(e),...Object.keys(t)])].filter(c=>JSON.stringify(e[c])!==JSON.stringify(t[c])),i=o.filter(c=>Ut[c]===void 0&&!no(c,[e[c],t[c]])).map(c=>`${c} "${Y(e[c]??"")}" \u2192 "${Y(t[c]??"")}"`),s=Object.keys(Ut).filter(c=>o.includes(c)).map(c=>Ut[c]);return`${[...i,...s.length>0?[`${s.join(" and ")} changed`]:[]].join(", ")||"no field changed"} by ${n} ${r===null?"since your last pull":`at ${r}`}`}var ro={usecase:"use case",scenario:"scenario",test:"test",ac:"acceptance criterion",source:"document"};function Ur(e,t){let n=e.graph.getNode(t),r=n?ro[n.label]??n.label:"item",o=n?.label!=="ac"?n?.content.title:void 0;if(typeof o=="string"&&o.trim()!=="")return`the ${r} "${o}"`;let i=e.fold.nameOf(t)??e.graph.displayNameOf(t);return i?`the ${r} ${En(i)}`:`the ${r}`}function ie(e,t){for(let n of e.theirs)for(let r of n.supersessions)if(r.kind==="node"&&r.old===t)return{rec:n,next:r.new}}function Kt(e,t){let n=new Set([t]);for(let o=!0;o;){o=!1;for(let[i,s]of e.graph.superseded)typeof s=="string"&&n.has(s)&&!n.has(i)&&(n.add(i),o=!0)}let r=[];for(let o of e.theirs)for(let i of o.review)n.has(i.id)&&i.resolution!=="pending"&&r.push({rec:o,resolution:i.resolution});return r}var so=new Set(Object.values(Ke).filter(e=>e!==Ke.DERIVES&&e!==Ke.ANNOTATES));function Yt(e,t){let n=new Set,r=[],o=[t,e.graph.tipOf(t)];for(;o.length>0;){let i=o.pop();if(!n.has(i)){n.add(i);for(let s of e.graph.edgesInto(i))!so.has(s.type)||e.graph.superseded.has(s.src)||(!(s.src in e.fold.index.nodeLabel)&&!r.some(a=>a.cid===s.src)&&r.push({cid:s.src,label:e.graph.nodeLabel.get(s.src)??"node"}),o.push(s.src))}}return r}function zt(e){let t=new Map;for(let n of e)t.set(n.label,(t.get(n.label)??0)+1);return[...t].map(([n,r])=>`${r} ${n}${r===1?"":"s"}`).join(", ")}function ht(e,t,n){if(!e.theirs.some(o=>o.edges.some(i=>i.type===t&&i.src===n)))return;let r=e.graph.edgesFrom(n).find(o=>o.type===t);return r?{live:r.dst}:void 0}function _e(e,t){let n=t.event_ids??[],r={token:e.store.parse(e.graph.latestHash)},o=new Map(n.map(a=>[a,e.store.appliedEvent(a,r)?.digest])),i=n.filter(a=>o.get(a)!==void 0);return n.length===0||i.length===0?void 0:i.every(a=>{let c=n.indexOf(a),d=t.event_digests?.[c];return d!==void 0&&d!==""&&o.get(a)===d})&&i.length===n.length?V("already applied: every event id is in the chain with the same intent"):k("ambiguous",`committed ${n.length} event id${n.length===1?"":"s"}`,`${i.length} of them already in the shared chain under another intent`,["keep-theirs"],{event_ids:n})}function oo(e){return String(e??"").toLowerCase().trim().replace(/\s+/g," ")}function ft(e,t){let n=t.question;return`${e}\0${oo(t.title??t.text??t.statement??n?.header??t.source_id??"")}`}function Vr(e,t){let n=[],r=new Set;for(let o of e.nodes){let i=ft(o.label,o.content),s=t.nodes.find(a=>!r.has(a.cid)&&ft(a.label,a.content)===i);s&&(r.add(s.cid),n.push([o.cid,s.cid]))}for(let o of e.nodes){if(n.some(([s])=>s===o.cid))continue;let i=t.nodes.find(s=>!r.has(s.cid)&&s.label===o.label);i&&(r.add(i.cid),n.push([o.cid,i.cid]))}return n}function Wr(e,t){let n=[],r=new Set;for(let o of t.names??[]){if(!Ye.test(o.slug))continue;let i=t.nodes.find(a=>a.cid===o.cid);if(!i||e.graph.nameOf.has(H(e,o.cid)))continue;let s=ze(i.label,a=>r.has(a),e.graph.names.keys());s!==null&&(r.add(s),s!==o.slug&&n.push({from:o.slug,to:s}))}return n}function Jr(e,t,n){let r=[];for(let o of e.names??[]){let i=n.find(([a])=>a===o.cid)?.[1],s=t.names?.find(a=>a.cid===i);s&&s.slug!==o.slug&&r.push({from:o.slug,to:s.slug})}return r}function Kr(e,t,n){let r=e===void 0?void 0:e.split(`
|
|
4
4
|
`).map(s=>{let a=/^(##\s.*?)\s@verifies\s+(.+?)\s*$/.exec(s);if(a)return`${a[1]} @verifies ${a[2].split(",").map(l=>l.trim()).filter(Boolean).map(n).join(", ")}`;let c=/^(\s*)@import\s+(\S+)\s*$/.exec(s);if(c)return`${c[1]}@import ${n(c[2])}`;let d=/^## Import: (\S+)\s*$/.exec(s);return d?`## Import: ${n(d[1])}`:s}).join(`
|
|
5
5
|
`),o=null,i=t===void 0?void 0:t.split(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as f,d as l}from"./chunk-
|
|
2
|
+
import{b as f,d as l}from"./chunk-C4KAPGBS.js";import{a as p}from"./chunk-TZXXJWHA.js";function d(t,e,o){return{id:`${t}.internal`,label:e,required:!0,status:"fail",detail:o instanceof Error?o.message:String(o)}}async function k(t,e={}){let o=p();if(!o.supported)return{sections:[{platform:"host",checks:[{id:"host.platform",label:"host",required:!0,status:"fail",detail:o.reason}]}]};let n=t?f().filter(r=>r.toLowerCase()===t.toLowerCase()):f(),{managedDeps:i}=await import("./deps-bundle-BLLJ2BQ4.js"),s=n.flatMap(r=>r==="android"?["emulator"]:r==="ios"?["simulator"]:[]);await Promise.allSettled(s.map(r=>i().warmResolveCache(r)));let c=[];for(let r of n){let u=l(r);if(!u)continue;let a;try{a=await u.checks(e)}catch(h){a=[d(r,"toolchain check",h)]}c.push({platform:r,checks:a})}return{sections:c}}function m(t){return t==="pass"?"\u2713":t==="fail"?"\u2717":"\u2139"}function x(t){return t.charAt(0).toUpperCase()+t.slice(1)}function C(t){let e=[];if(t.sections.length===0)return"No mobile platforms are supported on this host.";for(let o of t.sections){e.length>0&&e.push(""),e.push(`${x(o.platform)} toolchain`);let n=o.checks.filter(s=>s.status!=="info"),i=new Set;for(let s of n){let c=s.detail?` \u2014 ${s.detail}`:"";if(e.push(` ${m(s.status)} ${s.label}${c}`),s.status==="fail"&&s.fixText&&!i.has(s.fixText)){i.add(s.fixText);for(let r of s.fixText.split(`
|
|
3
3
|
`))e.push(` fix: ${r}`)}}}return e.join(`
|
|
4
4
|
`)}function w(t){return t.sections.length===0?!0:t.sections.every(e=>e.checks.some(o=>o.required&&o.status==="fail"&&!o.fixedByBundle))}function b(t){for(let e of t.sections)for(let o of e.checks)if(o.required&&o.status!=="pass")return 2;return 0}export{k as a,C as b,w as c,b as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as T}from"./chunk-3G2LSTK5.js";import{a as c}from"./chunk-RZ4F3BHX.js";var P=class extends Error{constructor(t,e){super(t);this.problems=e;this.name="PolicyRejectedError"}},h=class extends Error{constructor(t,e){super(t);this.status=e}name="EndTestError"},l=class extends Error{constructor(r){super(`Test Manager couldn't be reached: ${r}`),this.name="TmsUnreachable"}},p=class extends Error{constructor(t,e,s){super(t);this.status=e;this.body=s;this.name="TmsHttpError"}},S=class extends T{constructor(r,t,e){super(r,{username:t,accessKey:e})}async listProjects(r){let t=[],e=!1;for await(let s of this.listProjectsStream({log:r})){if(r&&!e&&s.projects.length>0){let n=s.projects[0];r("info","PROJECT_SAMPLE","Project list sample",{project_id:n.project_id,name:n.name}),e=!0}t.push(...s.projects)}return t}async*listProjectsStream(r){let t=r?.perPage??200,e=r?.maxPages??100,s=r?.signal,n=r?.log,o=r?.name?.trim(),a=0,d=null;for(let i=1;i<=e;i++){if(s?.aborted)return;let g=`${this.baseUrl}/v1/projects?page=${i}&per_page=${t}&sort=${r?.sort??"created_at"}&filter[product]=KTM`;o&&(g+=`&filter[name]=${encodeURIComponent(o)}`);let j=AbortSignal.timeout(15e3),$=s?AbortSignal.any([s,j]):j,m;try{m=await c(g,{method:"GET",headers:this.headers(),signal:$})}catch(y){if(s?.aborted)return;if(i===1)throw y;n?.("warn","PROJECTS_STREAM_PARTIAL","stream stopped mid-page",{page:i,total_loaded:a,error:y instanceof Error?y.message:String(y)}),yield{page:i,projects:[],totalLoaded:a,done:!0,total:d};return}if(!m.ok){if(i===1)throw new Error(`listProjects ${m.status}: ${await m.text()}`);n?.("warn","PROJECTS_STREAM_PARTIAL","stream stopped on non-OK response",{page:i,status:m.status,total_loaded:a}),yield{page:i,projects:[],totalLoaded:a,done:!0,total:d};return}let w=await m.json(),b=w.data??[];a+=b.length;let _=b.length<t;if(typeof w.pagination?.total=="number"&&(d=w.pagination.total),yield{page:i,projects:b,totalLoaded:a,done:_,total:d},_)return}n?.("warn","PROJECTS_STREAM_MAXPAGES","max pages reached",{max_pages:e,total_loaded:a}),yield{page:e,projects:[],totalLoaded:a,done:!0,total:d}}async getProject(r){let t;try{t=await c(`${this.baseUrl}/v1/projects/${encodeURIComponent(r)}`,{method:"GET",headers:this.headers(),signal:AbortSignal.timeout(15e3)})}catch(n){throw new l(n instanceof Error?n.message:String(n))}if(t.status===408||t.status===429)throw new l(`HTTP ${t.status}`);if(t.status>=400&&t.status<500)return null;if(!t.ok)throw new l(`HTTP ${t.status}`);let e;try{e=await t.json()}catch(n){throw new l(`an answer that isn't JSON: ${n instanceof Error?n.message:String(n)}`)}let s=typeof e.data?.name=="string"?e.data.name:typeof e.data?.project_name=="string"?e.data.project_name:null;if(s===null)throw new l("an answer with no project name");return{id:r,name:s}}async getDefaultFolder(r){let t=await c(`${this.baseUrl}/v1/projects/${r}/folder/default`,{method:"GET",headers:this.headers()});if(!t.ok)throw new Error(`Get default folder failed: ${t.status} ${await t.text()}`);return(await t.json()).id}async listFolders(r){let t=await c(`${this.baseUrl}/v1/folder/entity/${r}`,{method:"GET",headers:this.headers()});if(!t.ok)throw new Error(`List folders failed: ${t.status} ${await t.text()}`);return(await t.json()).data??[]}async validateProjectFolder(r,t){let e;try{e=await c(`${this.baseUrl}/v1/folder/entity/${r}`,{method:"GET",headers:this.headers()})}catch{return{project:"error",folder:"error"}}if(e.status>=400&&e.status<500)return{project:"missing",folder:"missing"};if(!e.ok)return{project:"error",folder:"error"};let s;try{s=await e.json()}catch{return{project:"error",folder:"error"}}return{project:"ok",folder:(s.data??[]).some(a=>a.id===t)?"ok":"missing"}}async createProject(r,t=""){let e=await c(`${this.baseUrl}/v1/projects`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({name:r,description:t,tags:[],source:"KTM"})});if(!e.ok){let n=await e.text(),o;try{o=JSON.parse(n)}catch{o=void 0}throw new p(`Create project failed: ${e.status} ${n}`,e.status,o)}let s=await e.json();return{id:s.id,name:r,...s.created===!1?{created:!1}:{}}}async createFolder(r,t,e=""){let s=await c(`${this.baseUrl}/v1/folder`,{method:"POST",headers:{...this.headers(),"Content-Type":"application/json"},body:JSON.stringify({folders:[{name:t,description:e,entity_id:r,entity_type:"project"}]})});if(!s.ok)throw new Error(`Create folder failed: ${s.status} ${await s.text()}`);return{id:(await s.json()).id,name:t}}async createAtmTest(r,t){let e=t?`Bearer ${t}`:this.authHeader,s=await c(`${this.baseUrl}/kane-cli/v1/test`,{method:"POST",headers:{Authorization:e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!s.ok){let o=await s.text(),a;try{a=JSON.parse(o)}catch{a=void 0}throw new p(`Create ATM test failed: ${s.status} ${o}`,s.status,a)}let n=await s.json();if(!n.test_id)throw new Error("Create ATM test returned no test_id");return n.test_id}async createAttachedTest(r,t){let e;try{e=await c(`${this.baseUrl}/kane-cli/v1/test`,{method:"POST",headers:{Authorization:t?`Bearer ${t}`:this.authHeader,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)})}catch{return{ok:!1,reason:"failed",status:null}}let s=await e.json().catch(()=>null);if(e.status>=500)return{ok:!1,reason:"failed",status:e.status};if(!e.ok){let a=s?.error;return{ok:!1,reason:"refused",code:typeof s?.code=="string"?s.code:typeof a?.code=="string"?a.code:`HTTP_${e.status}`,status:e.status}}let n=typeof s?.test_id=="string"?s.test_id:"";if(n==="")return{ok:!1,reason:"failed",status:e.status};let o=s?.test_case_id;return typeof o!="string"&&typeof o!="number"||String(o)!==r.test_case_id?{ok:!1,reason:"outdated"}:{ok:!0,testId:n}}async createMobileAtmTest(r,t){let e=t?`Bearer ${t}`:this.authHeader,s=await c(`${this.baseUrl}/kane-cli/v1/mobile/test`,{method:"POST",headers:{Authorization:e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(!s.ok){let o=await s.text(),a;try{a=JSON.parse(o)}catch{a=void 0}throw new p(`Create mobile ATM test failed: ${s.status} ${o}`,s.status,a)}let n=await s.json();if(!n.test_id)throw new Error("Create mobile ATM test returned no test_id");return n.test_id}async createBrowserSession(r,t={}){let e=await c(`${this.baseUrl}/kane-cli/v1/browser-sessions`,{...t.signal?{signal:t.signal}:{},method:"POST",headers:{Authorization:this.authHeader,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({metadata:r})});if(!e.ok)throw await f.from(e);let s=await e.json().catch(()=>null);if(typeof s?.id!="string"||!s.id)throw new Error("Create browser session returned no id");return s.id}async endBrowserSession(r,t={}){let e=await c(`${this.baseUrl}/kane-cli/v1/browser-sessions/${encodeURIComponent(r)}`,{...t.signal?{signal:t.signal}:{},method:"DELETE",headers:{Authorization:this.authHeader,Accept:"application/json"}});if(!e.ok)throw await f.from(e)}async endTest(r,t,e){let s=e?`Bearer ${e}`:this.authHeader,n=new URLSearchParams({commit_id:t.commit_id,time_taken:String(t.time_taken),steps_count:String(t.steps_count),commit_message:t.commit_message}),o={};t.objectives&&t.objectives.length>0&&(o.objectives=t.objectives),t.assurance&&(o.assurance={test:t.assurance.test,definition_id:t.assurance.definitionId});let a;try{a=await c(`${this.baseUrl}/kane-cli/v1/test/${r}?${n.toString()}`,{method:"DELETE",headers:{Authorization:s,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)})}catch(i){throw new h(`End test failed: ${i instanceof Error?i.message:String(i)}`,null)}if(!a.ok){let i=await a.text().catch(g=>g instanceof Error?g.message:String(g));throw new h(`End test failed: ${a.status} ${i}`,a.status)}let d;try{d=await a.json()}catch(i){throw new h(`End test failed: ${i instanceof Error?i.message:String(i)}`,null)}return{testcase_id:d.data?.testcase_id??"",test_id:d.data?.test_id??r,project_id:d.data?.project_id??"",...typeof d.data?.commit_id=="string"?{commit_id:d.data.commit_id}:{}}}async submitFeedback(r,t){let e=t?`Bearer ${t}`:this.authHeader,s={instruction_id:r.instruction_id,test_id:r.test_id,feedback_type:r.feedback_type,mode:r.mode??"human"};r.details&&(s.details=r.details);let n=await c(`${this.baseUrl}/atm/v1/generative-feedback`,{method:"POST",headers:{Authorization:e,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(s)});if(!n.ok)throw new Error(`Submit feedback failed: ${n.status} ${await n.text()}`);return await n.json()}async createPolicy(r){let t=await c(`${this.baseUrl}/kane-cli/v1/policies`,{method:"POST",headers:this.headers(),body:JSON.stringify({project_id:r.projectId,content:r.content,sha256:r.sha256})});if(t.status===422){let e=await t.text(),s={};try{s=JSON.parse(e)}catch{throw new Error(`Policy create failed: 422 ${e}`)}throw new P(typeof s.message=="string"?s.message:"policy rejected",s.errors?.problems??[])}if(!t.ok)throw new Error(`Policy create failed: ${t.status} ${await t.text()}`);return await t.json()}async listPolicies(r){let t=new URLSearchParams;r.projectId&&t.set("project_id",r.projectId),r.search&&t.set("search",r.search),t.set("page",String(r.page)),t.set("per_page",String(r.perPage));let e=await c(`${this.baseUrl}/kane-cli/v1/policies?${t}`,{headers:this.headers()});if(!e.ok)throw new Error(`Policy list failed: ${e.status} ${await e.text()}`);let s=await e.json(),n=s.pagination;return{policies:s.data,page:n.current_page,lastPage:n.last_page,perPage:n.per_page,total:n.total}}async getPolicy(r){let t=await c(`${this.baseUrl}/kane-cli/v1/policy/${encodeURIComponent(r)}`,{headers:this.headers()});if(t.status===404)throw new Error(`no policy with id "${r}" in Test Manager`);if(!t.ok)throw new Error(`Policy read failed: ${t.status} ${await t.text()}`);return await t.json()}async ingestEvidence(r,t,e={}){let s=await c(`${this.baseUrl}/kane-cli/v1/evidence/ingest`,{method:"POST",headers:{Authorization:this.authHeader,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({evidence_id:r,project_id:t,...e})});if(!s.ok)throw new p(`Evidence ingest failed: ${s.status} ${await s.text()}`,s.status)}},f=class u extends Error{constructor(t,e,s,n){super(`Browser session failed: ${t} ${e}`);this.status=t;this.text=e;this.code=s;this.detail=n;this.name="BrowserSessionRefusal"}static async from(t){let e=await t.text().catch(()=>""),s=null;try{s=JSON.parse(e)}catch{}let n=s?.error&&typeof s.error=="object"?s.error:null,o=a=>typeof a=="string"&&a.trim()?a:null;return new u(t.status,e,o(s?.errorCode)??o(s?.code)??o(n?.code),o(s?.message)??o(n?.message))}};export{P as a,h as b,l as c,p as d,S as e,f};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Ye}from"./chunk-
|
|
2
|
+
import{a as Ye}from"./chunk-X45RZIAJ.js";import{b as Ve}from"./chunk-LV7224DG.js";import{a as qe}from"./chunk-VE3SUJMA.js";import{c as We}from"./chunk-SMXABALN.js";import{a as be}from"./chunk-YCVEI7BT.js";import{a as Ge}from"./chunk-PCQK62MP.js";import{a as He}from"./chunk-ZCBOHWN3.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,z as u}from"./chunk-J4FIESTB.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,`
|