@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,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as xe}from"./chunk-IT5JVCZN.js";import{b as le}from"./chunk-GZQAETB2.js";import{a as ae,e as ce}from"./chunk-QUNIY6NN.js";import{a as W,b as q,d as I,e as ue,n as pe,q as V,s as T,t as H}from"./chunk-UMNCM4RJ.js";import"./chunk-4NEPHIAO.js";import"./chunk-ZUZ6QJRA.js";import"./chunk-Z6SI7YNV.js";import{a as de}from"./chunk-YDPTSDIJ.js";import"./chunk-KGNE5CIM.js";import"./chunk-GQARXS6F.js";import"./chunk-3AGP2BVN.js";import"./chunk-54NJJVG5.js";import"./chunk-6JUS2ULI.js";import{b as F}from"./chunk-HG2ILWCE.js";import"./chunk-A474TUCE.js";import"./chunk-CCOD4GQJ.js";import"./chunk-UCVP7ZY4.js";import"./chunk-5Y2G4NC7.js";import"./chunk-M7Y5GGVJ.js";import"./chunk-BHQIH2FE.js";import"./chunk-5D7ENQTQ.js";import"./chunk-SMXABALN.js";import{a as ie}from"./chunk-73HMW2WA.js";import{e as se}from"./chunk-6K5BEEAJ.js";import"./chunk-4HYPMGDF.js";import"./chunk-ZDQYGLCZ.js";import"./chunk-2GEAKFAV.js";import"./chunk-FCD3NYOM.js";import"./chunk-3G2LSTK5.js";import"./chunk-PVN64537.js";import"./chunk-QSCXXNC2.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import{a as oe}from"./chunk-FI2DVNRT.js";import{a as re}from"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import"./chunk-A7RJQJNT.js";import{a as ne}from"./chunk-K75WIRI5.js";import{a as te}from"./chunk-HCBYKLMW.js";import{a as O,b as M,i as ee}from"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import{a as ye}from"./chunk-6YGTRKDT.js";import{z as d}from"./chunk-FAMQ4DHU.js";import{e as z}from"./chunk-UR6MHSHU.js";var v=z(ye(),1);function A(e,n,t=`${n}s`){return`${e} ${e===1?n:t}`}function ve(e,n){if(!e)return"";let t=new Date(e).getTime();if(Number.isNaN(t))return"";let r=Math.max(0,Math.floor((n-t)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function Ee(e,n){if(!e)return"";let t=new Date(e).getTime();if(Number.isNaN(t))return"";let r=Math.max(0,Math.floor((n-t)/6e4));return r<60?`${r}m`:`${Math.floor(r/60)}h ${r%60}m`}var N=e=>e.slice(0,8);function _e(e){if(!e)return"";try{return new URL(e).host}catch{return e}}function me(e){return!!e&&(e.running||!!e.current_session)}function Re(e){return e?e.current_session?`exploration \xB7 \u25CF ${e.current_session.state}`:e.running?"exploration \xB7 \u25CF running":"exploration \xB7 idle":"no exploration yet"}function fe(e,n){let t=Math.min(30,Math.max(0,...e.map(i=>i.name.length)))+4,r=i=>{let a=n.get(i.id);return me(a)?0:a?1:2};return[...e].map((i,a)=>({p:i,i:a})).sort((i,a)=>r(i.p)-r(a.p)||i.i-a.i).map(({p:i})=>{let a=i.name.length>30?`${i.name.slice(0,29)}\u2026`:i.name;return{id:i.id,label:`${a.padEnd(t)}${Re(n.get(i.id))}`}})}function ge(e){let n=new Map;for(let t of e)t.project_id&&!n.has(t.project_id)&&n.set(t.project_id,t);return n}function $e(e,n){if(e){if(e.enabled&&e.off_reason)return{text:`on \xB7 blocked: ${q(e).replace(/^on, blocked: /,"").replace(/^(.*?): (.*)$/,"$1 ($2)")}`,color:d.amber,tally:"context blocked"};if(!e.enabled)return{text:q(e),color:d.dim,tally:"context off"};if(e.running_job)return{text:`on \xB7 job running on ${W(e.running_job.cut)}`,color:d.green,tally:"context on"};let r=e.last_job;if(!r)return{text:"on",color:d.green,tally:"context on"};let i=r.use_cases?.added?.length??0,a=r.use_cases?.modified?.length??0,w=i||a?` \xB7 ${i} use case${i===1?"":"s"} added, ${a} modified`:"";return{text:`on \xB7 last job ${r.status} \xB7 ${W(r.cut)}${w}`,color:d.green,tally:"context on"}}let t=n?.context;return t?t.enabled?t.running?{text:"on \xB7 job running",color:d.green,tally:"context on"}:{text:t.last_job_status?`on \xB7 last job ${t.last_job_status}`:"on",color:d.green,tally:"context on"}:{text:"off",color:d.dim,tally:"context off"}:{text:"",tally:""}}function Se(e,n){let t=[e.remark?.code||e.stop_reason||"stopped",ve(e.ended_at??e.started_at,n)];return typeof e.leases=="number"&&t.push(A(e.leases,"lease")),e.credits&&typeof e.credits.total=="number"&&t.push(`${Math.round(e.credits.total).toLocaleString("en-US")} credits`),t.filter(Boolean).join(" \xB7 ")}function Ce(e){return`${A(e.junctions,"screen")} \xB7 ${A(e.flows,"flow")} \xB7 ${A(e.findings,"finding")}`}function K(e,n,t,r,i){if(!n)return{mode:"new",title:`"${e.name}"`,state:{text:"no exploration yet",color:d.dim},rows:[{label:"one project",text:"one exploration: its map grows with every run"},{label:"assurance context",text:"on by default \xB7 builds the project's assurance context as it explores",color:d.green}],headline:"Start exploring?",ask:!0,menu:[{action:"run",label:"Set up the first run"},{action:"back",label:"Back"}],sel:0,tallies:[],sid:"",subject:e.name,working:null};let a=`"${e.name}" \xB7 exploration ${N(n.exploration_id)}`,w=$e(r,n),E=w.text?[{label:"assurance context",text:w.text,color:w.color}]:[],R=_e(n.target_url)||e.name,s=n.current_session;if(me(n)){let u=s?.state??"running",o=[...s?[{label:"run",text:[N(s.run_id),Ee(s.claimed_at??s.started_at,i)].filter(Boolean).join(" \xB7 ")}]:[],...s?[{label:"runs on",text:s.mode==="remote"?`HyperExecute${s.hx_job_id?` \xB7 job ${N(s.hx_job_id)}`:""}`:"this machine"}]:[],...s?.started_by_user_id?[{label:"started by",text:`user ${s.started_by_user_id}`}]:[],...s&&typeof s.leases=="number"?[{label:"leases",text:String(s.leases)}]:[],...E];return{mode:"running",title:a,state:{text:u,color:d.orange},rows:o,headline:"A run is going",ask:!1,menu:[{action:"watch",label:"Watch",detail:"live browsers and flows"},{action:"stop",label:"Stop the run",detail:"its leases finish, every delta is sent"},{action:"view",label:"Open the map"},{action:"back",label:"Back"}],sel:0,tallies:[...s&&typeof s.leases=="number"?[`leases ${s.leases}`]:[],...t?[`screens ${t.junctions}`,`flows ${t.flows}`]:[]],sid:N(s?s.run_id:n.exploration_id),subject:R,working:`${u}`}}let C=!!r&&r.enabled&&!!r.off_reason,$=n.last_session,y=[...n.target_url?[{label:"url",text:n.target_url}]:[],...t?[{label:"map",text:Ce(t)}]:[],{label:"last run",text:$?Se($,i):"never run"},...E],h=C?[{action:"run",label:"Run again"},{action:"context",label:"Assurance context",detail:"why it is blocked, turn off"},{action:"view",label:"Open the map"},{action:"sessions",label:"Sessions"},{action:"delete",label:"Delete the exploration"}]:[{action:"run",label:$?"Run again":"Run",detail:"continues from the map"},{action:"view",label:"Open the map",detail:"explore view, in your browser"},{action:"sessions",label:"Sessions",detail:"every run, newest first"},{action:"context",label:"Assurance context",detail:"status, sync, turn off"},{action:"delete",label:"Delete the exploration"}];return{mode:"idle",title:a,state:{text:"idle",color:d.dim},rows:y,headline:"What next?",ask:!0,menu:h,sel:C?1:0,tallies:[...t?[A(t.junctions,"screen"),A(t.flows,"flow"),A(t.findings,"finding")]:[],...w.tally?[w.tally]:[]],sid:N(n.exploration_id),subject:R,working:null}}var p=z(te(),1),G=d.orange,Pe=["\u2191\u2193 select","\u23CE confirm","esc projects","ctrl+c exit"];function Me(e,n){return ae(e,n,()=>{throw new Error("timed out")})}function Ie({deps:e,initial:n,done:t}){let[r,i]=(0,v.useState)(null),[a,w]=(0,v.useState)(new Map),[E,R]=(0,v.useState)(null),[s,C]=(0,v.useState)(null),[$,y]=(0,v.useState)(0),[h,u]=(0,v.useState)({kind:"none"}),[o,x]=(0,v.useState)(null),[b,_]=(0,v.useState)(null),P=async()=>{try{let[c,l]=await Promise.all([e.listProjects(),e.listExplorations()]),m=ge(l);return i(c),w(m),m}catch(c){return R(T(c)),i([]),new Map}},Y=(c,l,m)=>{x(c.id),u({kind:"none"}),C({project:c,row:l,counts:null,ctx:null,loading:!!l});let f=K(c,l,null,null,e.now()),g=m?f.menu.findIndex(S=>S.action===m):-1;if(g>=0&&(f.sel=g),y(f.sel),!l)return;let k=l.exploration_id;Promise.allSettled([e.viewSummary(k),Me(e.getContext(k),3e3)]).then(([S,L])=>{let Q=S.status==="fulfilled"?S.value:null,X=L.status==="fulfilled"?L.value:null;C(U=>U&&U.row?.exploration_id===k?{...U,counts:Q,ctx:X,loading:!1}:U);let Z=K(c,l,Q,X,e.now()).sel;g<0&&Z!==f.sel&&y(Z)})};(0,v.useEffect)(()=>{n?Y(n.project,n.row,n.at):P()},[]);let J=()=>{C(null),u({kind:"none"}),D.current.projects||P()},j=s?K(s.project,s.row,s.counts,s.ctx,e.now()):null,ke=c=>{let{card:l,model:m}=D.current;if(!l||!m)return;let f=l.row,g=f?.exploration_id??"";switch(c){case"back":return J();case"run":return t({kind:"run",projectId:l.project.id,projectName:l.project.name,explorationId:f?.exploration_id??null,url:f?.target_url??null});case"view":if(!e.openMap)return t({kind:"view",explorationId:g});_("opening the map\u2026"),e.openMap(g).then(k=>_(`map open at ${k.url} \xB7 serving until you leave explore`),k=>{_(null),u({kind:"error",text:`could not open the map: ${T(k)}`})});return;case"context":return t({kind:"context",explorationId:g,subject:m.subject});case"watch":{let k=f?.current_session;return t({kind:"watch",explorationId:g,runId:k?.run_id??"",mode:k?.mode??"remote"})}case"sessions":u({kind:"sessions",lines:["loading sessions\u2026"]}),e.listSessions(g).then(k=>u({kind:"sessions",lines:ue(g,k,{nextCursor:null})}),k=>u({kind:"sessions",lines:I(`could not list sessions: ${T(k)}`)}));return;case"delete":return u({kind:"delete"});case"stop":return u({kind:"stop",sel:1})}},he=async()=>{let{card:c}=D.current;if(!c)return;let l=await P();Y(c.project,l.get(c.project.id)??null)},D=(0,v.useRef)({card:s,model:j,sub:h,sel:$,projects:r});if(D.current={card:s,model:j,sub:h,sel:$,projects:r},ee((c,l)=>{let{card:m,model:f,sub:g,sel:k}=D.current;if(!(!m||!f)&&g.kind!=="delete"){if(g.kind==="sessions"||g.kind==="error"){(l.escape||l.return)&&u({kind:"none"});return}if(g.kind==="stop"){if(l.upArrow||l.downArrow)u({kind:"stop",sel:g.sel===0?1:0});else if(l.escape)u({kind:"none"});else if(l.return){if(g.sel===1)return u({kind:"none"});let S=m.row.exploration_id;u({kind:"none"}),e.stopExploration(S).then(()=>he(),L=>u({kind:"error",text:`could not stop: ${T(L)}`}))}return}if(l.escape)return J();l.upArrow?y(S=>(S-1+f.menu.length)%f.menu.length):l.downArrow?y(S=>(S+1)%f.menu.length):l.return&&ke(f.menu[k].action)}},{isActive:!!s}),!s||!j){let c=r?fe(r,a).map(l=>({...l,isActive:l.id===o})):[];return(0,p.jsx)(O,{flexDirection:"column",children:(0,p.jsx)(ie,{title:"Projects",items:c,itemNoun:"projects",loading:!r,loadingText:"loading projects\u2026",error:E,defaultActiveId:o,escLabel:"exit",onSelect:l=>{let m=r?.find(f=>f.id===l.id);m&&Y(m,a.get(m.id)??null)},onCancel:()=>t({kind:"exit",code:0})})})}let je=j.working?{kind:"working",step:j.working}:{kind:"waiting"},B;if(h.kind==="sessions")B=(0,p.jsxs)(O,{flexDirection:"column",marginTop:1,children:[h.lines.map((c,l)=>(0,p.jsx)(M,{children:c},l)),(0,p.jsx)(M,{color:d.dim,children:"esc back to the card"})]});else if(h.kind==="error")B=(0,p.jsxs)(O,{flexDirection:"column",marginTop:1,children:[I(h.text).map((c,l)=>(0,p.jsx)(M,{children:c},l)),(0,p.jsx)(M,{color:d.dim,children:"esc back to the card"})]});else if(h.kind==="delete"){let c=s.row.exploration_id;B=(0,p.jsx)(pe,{explorationId:c,facts:{project:s.project.name,...s.counts?{map:`${s.counts.junctions} screens \xB7 ${s.counts.flows} flows \xB7 ${s.counts.findings} findings`}:{}},done:l=>{if(!l)return void setTimeout(()=>u({kind:"none"}),0);e.deleteExploration(c).then(()=>{C(null),u({kind:"none"}),P()},m=>u({kind:"error",text:`could not delete: ${T(m)}`}))}})}else h.kind==="stop"?B=(0,p.jsx)(F,{headline:"Stop this run?",ask:!0,accent:G,sel:h.sel,focused:!0,rows:[{key:"yes",label:"Yes, stop it",detail:"its leases finish, every delta is sent"},{key:"no",label:"No"}]}):B=(0,p.jsx)(F,{headline:j.headline,ask:j.ask,accent:G,sel:$,focused:!0,rows:j.menu.map(c=>({key:c.action,label:c.label,detail:c.detail}))});return(0,p.jsxs)(O,{flexDirection:"column",children:[(0,p.jsx)(M,{color:d.dim,children:`project "${s.project.name}"`}),(0,p.jsx)(xe,{title:j.title,state:j.state,rows:j.rows}),s.loading?(0,p.jsx)(M,{color:d.dim,children:" reading the map\u2026"}):null,b?(0,p.jsx)(M,{color:d.dim,children:` ${b}`}):null,B,(0,p.jsx)(le,{status:je,meta:{verb:"explore",sid:j.sid,env:e.env,subject:j.subject},tallies:{items:j.tallies},keys:h.kind==="none"?Pe:["esc card","ctrl+c exit"],accent:G,remote:!0})]})}function be(e){return e.env??new ne().getDefaultEnv()??"prod"}async function we(e,n){let t=o=>{process.stderr.write(o+`
|
|
2
|
+
import{a as xe}from"./chunk-6FFX4S7N.js";import{b as le}from"./chunk-EJGCIGQY.js";import{a as ae,e as ce}from"./chunk-3ZC7GSMM.js";import{a as W,b as q,d as I,e as ue,n as pe,q as V,s as T,t as H}from"./chunk-OTMHCHH6.js";import"./chunk-YPGZ5E4I.js";import"./chunk-ZUZ6QJRA.js";import"./chunk-ZMIKNNO6.js";import{a as de}from"./chunk-YDPTSDIJ.js";import"./chunk-KGNE5CIM.js";import"./chunk-NPAUSUNM.js";import"./chunk-3AGP2BVN.js";import"./chunk-OOGKX4Y6.js";import"./chunk-7Y55CO42.js";import{b as F}from"./chunk-YILRYMMG.js";import"./chunk-Q4SMITTV.js";import"./chunk-CCOD4GQJ.js";import"./chunk-SMGRXKXX.js";import"./chunk-5Y2G4NC7.js";import"./chunk-X45RZIAJ.js";import"./chunk-LV7224DG.js";import"./chunk-5D7ENQTQ.js";import"./chunk-SMXABALN.js";import{a as ie}from"./chunk-LXK4B2FE.js";import{e as se}from"./chunk-SB26HQO7.js";import"./chunk-YCVEI7BT.js";import"./chunk-KCXLRR3Q.js";import"./chunk-PCQK62MP.js";import"./chunk-FCD3NYOM.js";import"./chunk-3G2LSTK5.js";import"./chunk-PVN64537.js";import"./chunk-QSCXXNC2.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import{a as oe}from"./chunk-ZCBOHWN3.js";import{a as re}from"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import"./chunk-A7RJQJNT.js";import{a as ne}from"./chunk-TM45NPWL.js";import{a as te}from"./chunk-HCBYKLMW.js";import{a as O,b as M,i as ee}from"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import{a as ye}from"./chunk-6YGTRKDT.js";import{z as d}from"./chunk-J4FIESTB.js";import{e as z}from"./chunk-UR6MHSHU.js";var v=z(ye(),1);function A(e,n,t=`${n}s`){return`${e} ${e===1?n:t}`}function ve(e,n){if(!e)return"";let t=new Date(e).getTime();if(Number.isNaN(t))return"";let r=Math.max(0,Math.floor((n-t)/1e3));return r<60?"just now":r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:`${Math.floor(r/86400)}d ago`}function Ee(e,n){if(!e)return"";let t=new Date(e).getTime();if(Number.isNaN(t))return"";let r=Math.max(0,Math.floor((n-t)/6e4));return r<60?`${r}m`:`${Math.floor(r/60)}h ${r%60}m`}var N=e=>e.slice(0,8);function _e(e){if(!e)return"";try{return new URL(e).host}catch{return e}}function me(e){return!!e&&(e.running||!!e.current_session)}function Re(e){return e?e.current_session?`exploration \xB7 \u25CF ${e.current_session.state}`:e.running?"exploration \xB7 \u25CF running":"exploration \xB7 idle":"no exploration yet"}function fe(e,n){let t=Math.min(30,Math.max(0,...e.map(i=>i.name.length)))+4,r=i=>{let a=n.get(i.id);return me(a)?0:a?1:2};return[...e].map((i,a)=>({p:i,i:a})).sort((i,a)=>r(i.p)-r(a.p)||i.i-a.i).map(({p:i})=>{let a=i.name.length>30?`${i.name.slice(0,29)}\u2026`:i.name;return{id:i.id,label:`${a.padEnd(t)}${Re(n.get(i.id))}`}})}function ge(e){let n=new Map;for(let t of e)t.project_id&&!n.has(t.project_id)&&n.set(t.project_id,t);return n}function $e(e,n){if(e){if(e.enabled&&e.off_reason)return{text:`on \xB7 blocked: ${q(e).replace(/^on, blocked: /,"").replace(/^(.*?): (.*)$/,"$1 ($2)")}`,color:d.amber,tally:"context blocked"};if(!e.enabled)return{text:q(e),color:d.dim,tally:"context off"};if(e.running_job)return{text:`on \xB7 job running on ${W(e.running_job.cut)}`,color:d.green,tally:"context on"};let r=e.last_job;if(!r)return{text:"on",color:d.green,tally:"context on"};let i=r.use_cases?.added?.length??0,a=r.use_cases?.modified?.length??0,w=i||a?` \xB7 ${i} use case${i===1?"":"s"} added, ${a} modified`:"";return{text:`on \xB7 last job ${r.status} \xB7 ${W(r.cut)}${w}`,color:d.green,tally:"context on"}}let t=n?.context;return t?t.enabled?t.running?{text:"on \xB7 job running",color:d.green,tally:"context on"}:{text:t.last_job_status?`on \xB7 last job ${t.last_job_status}`:"on",color:d.green,tally:"context on"}:{text:"off",color:d.dim,tally:"context off"}:{text:"",tally:""}}function Se(e,n){let t=[e.remark?.code||e.stop_reason||"stopped",ve(e.ended_at??e.started_at,n)];return typeof e.leases=="number"&&t.push(A(e.leases,"lease")),e.credits&&typeof e.credits.total=="number"&&t.push(`${Math.round(e.credits.total).toLocaleString("en-US")} credits`),t.filter(Boolean).join(" \xB7 ")}function Ce(e){return`${A(e.junctions,"screen")} \xB7 ${A(e.flows,"flow")} \xB7 ${A(e.findings,"finding")}`}function K(e,n,t,r,i){if(!n)return{mode:"new",title:`"${e.name}"`,state:{text:"no exploration yet",color:d.dim},rows:[{label:"one project",text:"one exploration: its map grows with every run"},{label:"assurance context",text:"on by default \xB7 builds the project's assurance context as it explores",color:d.green}],headline:"Start exploring?",ask:!0,menu:[{action:"run",label:"Set up the first run"},{action:"back",label:"Back"}],sel:0,tallies:[],sid:"",subject:e.name,working:null};let a=`"${e.name}" \xB7 exploration ${N(n.exploration_id)}`,w=$e(r,n),E=w.text?[{label:"assurance context",text:w.text,color:w.color}]:[],R=_e(n.target_url)||e.name,s=n.current_session;if(me(n)){let u=s?.state??"running",o=[...s?[{label:"run",text:[N(s.run_id),Ee(s.claimed_at??s.started_at,i)].filter(Boolean).join(" \xB7 ")}]:[],...s?[{label:"runs on",text:s.mode==="remote"?`HyperExecute${s.hx_job_id?` \xB7 job ${N(s.hx_job_id)}`:""}`:"this machine"}]:[],...s?.started_by_user_id?[{label:"started by",text:`user ${s.started_by_user_id}`}]:[],...s&&typeof s.leases=="number"?[{label:"leases",text:String(s.leases)}]:[],...E];return{mode:"running",title:a,state:{text:u,color:d.orange},rows:o,headline:"A run is going",ask:!1,menu:[{action:"watch",label:"Watch",detail:"live browsers and flows"},{action:"stop",label:"Stop the run",detail:"its leases finish, every delta is sent"},{action:"view",label:"Open the map"},{action:"back",label:"Back"}],sel:0,tallies:[...s&&typeof s.leases=="number"?[`leases ${s.leases}`]:[],...t?[`screens ${t.junctions}`,`flows ${t.flows}`]:[]],sid:N(s?s.run_id:n.exploration_id),subject:R,working:`${u}`}}let C=!!r&&r.enabled&&!!r.off_reason,$=n.last_session,y=[...n.target_url?[{label:"url",text:n.target_url}]:[],...t?[{label:"map",text:Ce(t)}]:[],{label:"last run",text:$?Se($,i):"never run"},...E],h=C?[{action:"run",label:"Run again"},{action:"context",label:"Assurance context",detail:"why it is blocked, turn off"},{action:"view",label:"Open the map"},{action:"sessions",label:"Sessions"},{action:"delete",label:"Delete the exploration"}]:[{action:"run",label:$?"Run again":"Run",detail:"continues from the map"},{action:"view",label:"Open the map",detail:"explore view, in your browser"},{action:"sessions",label:"Sessions",detail:"every run, newest first"},{action:"context",label:"Assurance context",detail:"status, sync, turn off"},{action:"delete",label:"Delete the exploration"}];return{mode:"idle",title:a,state:{text:"idle",color:d.dim},rows:y,headline:"What next?",ask:!0,menu:h,sel:C?1:0,tallies:[...t?[A(t.junctions,"screen"),A(t.flows,"flow"),A(t.findings,"finding")]:[],...w.tally?[w.tally]:[]],sid:N(n.exploration_id),subject:R,working:null}}var p=z(te(),1),G=d.orange,Pe=["\u2191\u2193 select","\u23CE confirm","esc projects","ctrl+c exit"];function Me(e,n){return ae(e,n,()=>{throw new Error("timed out")})}function Ie({deps:e,initial:n,done:t}){let[r,i]=(0,v.useState)(null),[a,w]=(0,v.useState)(new Map),[E,R]=(0,v.useState)(null),[s,C]=(0,v.useState)(null),[$,y]=(0,v.useState)(0),[h,u]=(0,v.useState)({kind:"none"}),[o,x]=(0,v.useState)(null),[b,_]=(0,v.useState)(null),P=async()=>{try{let[c,l]=await Promise.all([e.listProjects(),e.listExplorations()]),m=ge(l);return i(c),w(m),m}catch(c){return R(T(c)),i([]),new Map}},Y=(c,l,m)=>{x(c.id),u({kind:"none"}),C({project:c,row:l,counts:null,ctx:null,loading:!!l});let f=K(c,l,null,null,e.now()),g=m?f.menu.findIndex(S=>S.action===m):-1;if(g>=0&&(f.sel=g),y(f.sel),!l)return;let k=l.exploration_id;Promise.allSettled([e.viewSummary(k),Me(e.getContext(k),3e3)]).then(([S,L])=>{let Q=S.status==="fulfilled"?S.value:null,X=L.status==="fulfilled"?L.value:null;C(U=>U&&U.row?.exploration_id===k?{...U,counts:Q,ctx:X,loading:!1}:U);let Z=K(c,l,Q,X,e.now()).sel;g<0&&Z!==f.sel&&y(Z)})};(0,v.useEffect)(()=>{n?Y(n.project,n.row,n.at):P()},[]);let J=()=>{C(null),u({kind:"none"}),D.current.projects||P()},j=s?K(s.project,s.row,s.counts,s.ctx,e.now()):null,ke=c=>{let{card:l,model:m}=D.current;if(!l||!m)return;let f=l.row,g=f?.exploration_id??"";switch(c){case"back":return J();case"run":return t({kind:"run",projectId:l.project.id,projectName:l.project.name,explorationId:f?.exploration_id??null,url:f?.target_url??null});case"view":if(!e.openMap)return t({kind:"view",explorationId:g});_("opening the map\u2026"),e.openMap(g).then(k=>_(`map open at ${k.url} \xB7 serving until you leave explore`),k=>{_(null),u({kind:"error",text:`could not open the map: ${T(k)}`})});return;case"context":return t({kind:"context",explorationId:g,subject:m.subject});case"watch":{let k=f?.current_session;return t({kind:"watch",explorationId:g,runId:k?.run_id??"",mode:k?.mode??"remote"})}case"sessions":u({kind:"sessions",lines:["loading sessions\u2026"]}),e.listSessions(g).then(k=>u({kind:"sessions",lines:ue(g,k,{nextCursor:null})}),k=>u({kind:"sessions",lines:I(`could not list sessions: ${T(k)}`)}));return;case"delete":return u({kind:"delete"});case"stop":return u({kind:"stop",sel:1})}},he=async()=>{let{card:c}=D.current;if(!c)return;let l=await P();Y(c.project,l.get(c.project.id)??null)},D=(0,v.useRef)({card:s,model:j,sub:h,sel:$,projects:r});if(D.current={card:s,model:j,sub:h,sel:$,projects:r},ee((c,l)=>{let{card:m,model:f,sub:g,sel:k}=D.current;if(!(!m||!f)&&g.kind!=="delete"){if(g.kind==="sessions"||g.kind==="error"){(l.escape||l.return)&&u({kind:"none"});return}if(g.kind==="stop"){if(l.upArrow||l.downArrow)u({kind:"stop",sel:g.sel===0?1:0});else if(l.escape)u({kind:"none"});else if(l.return){if(g.sel===1)return u({kind:"none"});let S=m.row.exploration_id;u({kind:"none"}),e.stopExploration(S).then(()=>he(),L=>u({kind:"error",text:`could not stop: ${T(L)}`}))}return}if(l.escape)return J();l.upArrow?y(S=>(S-1+f.menu.length)%f.menu.length):l.downArrow?y(S=>(S+1)%f.menu.length):l.return&&ke(f.menu[k].action)}},{isActive:!!s}),!s||!j){let c=r?fe(r,a).map(l=>({...l,isActive:l.id===o})):[];return(0,p.jsx)(O,{flexDirection:"column",children:(0,p.jsx)(ie,{title:"Projects",items:c,itemNoun:"projects",loading:!r,loadingText:"loading projects\u2026",error:E,defaultActiveId:o,escLabel:"exit",onSelect:l=>{let m=r?.find(f=>f.id===l.id);m&&Y(m,a.get(m.id)??null)},onCancel:()=>t({kind:"exit",code:0})})})}let je=j.working?{kind:"working",step:j.working}:{kind:"waiting"},B;if(h.kind==="sessions")B=(0,p.jsxs)(O,{flexDirection:"column",marginTop:1,children:[h.lines.map((c,l)=>(0,p.jsx)(M,{children:c},l)),(0,p.jsx)(M,{color:d.dim,children:"esc back to the card"})]});else if(h.kind==="error")B=(0,p.jsxs)(O,{flexDirection:"column",marginTop:1,children:[I(h.text).map((c,l)=>(0,p.jsx)(M,{children:c},l)),(0,p.jsx)(M,{color:d.dim,children:"esc back to the card"})]});else if(h.kind==="delete"){let c=s.row.exploration_id;B=(0,p.jsx)(pe,{explorationId:c,facts:{project:s.project.name,...s.counts?{map:`${s.counts.junctions} screens \xB7 ${s.counts.flows} flows \xB7 ${s.counts.findings} findings`}:{}},done:l=>{if(!l)return void setTimeout(()=>u({kind:"none"}),0);e.deleteExploration(c).then(()=>{C(null),u({kind:"none"}),P()},m=>u({kind:"error",text:`could not delete: ${T(m)}`}))}})}else h.kind==="stop"?B=(0,p.jsx)(F,{headline:"Stop this run?",ask:!0,accent:G,sel:h.sel,focused:!0,rows:[{key:"yes",label:"Yes, stop it",detail:"its leases finish, every delta is sent"},{key:"no",label:"No"}]}):B=(0,p.jsx)(F,{headline:j.headline,ask:j.ask,accent:G,sel:$,focused:!0,rows:j.menu.map(c=>({key:c.action,label:c.label,detail:c.detail}))});return(0,p.jsxs)(O,{flexDirection:"column",children:[(0,p.jsx)(M,{color:d.dim,children:`project "${s.project.name}"`}),(0,p.jsx)(xe,{title:j.title,state:j.state,rows:j.rows}),s.loading?(0,p.jsx)(M,{color:d.dim,children:" reading the map\u2026"}):null,b?(0,p.jsx)(M,{color:d.dim,children:` ${b}`}):null,B,(0,p.jsx)(le,{status:je,meta:{verb:"explore",sid:j.sid,env:e.env,subject:j.subject},tallies:{items:j.tallies},keys:h.kind==="none"?Pe:["esc card","ctrl+c exit"],accent:G,remote:!0})]})}function be(e){return e.env??new ne().getDefaultEnv()??"prod"}async function we(e,n){let t=o=>{process.stderr.write(o+`
|
|
3
3
|
`)},r=await V(e,"explore");if(!r.ok){for(let o of I(r.error,"kane-cli login"))t(o);return 2}let i=be(e),a=H(r),w=new se(oe(i).tmsBaseUrl,r.basic.username,r.basic.access_key),E=async()=>{let o=[],x;for(let b=0;b<10;b++){let _=await a.listExplorations({state:"all",limit:100,cursor:x});if(o.push(..._.explorations),!_.next_cursor)break;x=_.next_cursor}return o},R=new Map,s=async o=>{try{await(await import("./open-MQLQKFAW.js")).default(o)}catch{}},C={env:i,listProjects:async()=>(await w.listProjects()).map(o=>({id:String(o.project_id),name:o.name})),listExplorations:E,viewSummary:async o=>{let x=(await a.viewSummary(o))?.counts;if(!x)throw new Error("the map's summary could not be read");return{junctions:x.junctions??0,flows:x.flows??0,findings:x.findings??0}},getContext:o=>a.getContext(o),listSessions:async o=>(await a.listSessions(o)).sessions,deleteExploration:async o=>{await a.deleteExploration(o)},stopExploration:async o=>{await a.stopExploration(o,!1)},openMap:async o=>{let x=R.get(o);if(x)return s(x.url),x;let b=re(r.basic.username,r.basic.access_key),_=r.controllerBaseUrl,P=await ce({controllerBaseUrl:_,authHeader:b,explorationId:o,live:{controller:{baseUrl:_,authHeader:b}}});return R.set(o,P),s(P.url),P},now:()=>Date.now()},$=null,y=String(e.explorationId??"").trim();if(y){let o;try{o=(await E()).find(b=>b.exploration_id===y)}catch(b){for(let _ of I(`could not list explorations: ${T(b)}`))t(_);return 1}if(!o){for(let b of I(`no exploration ${y} in your org`,"kane-cli explore list --all"))t(b);return 2}let x=o.name??o.project_id??y.slice(0,8);if(o.project_id)try{x=(await w.listProjects()).find(b=>String(b.project_id)===o.project_id)?.name??x}catch{}$={project:{id:o.project_id??"",name:x},row:o,...n?{at:n}:{}}}let h=await de(o=>(0,p.jsx)(Ie,{deps:C,initial:$,done:o}));h||(t(""),t("session summary \u2014 exited (ctrl+c)"),R.size&&t(` stopped serving the map${R.size===1?"":"s"} it opened`),t(` back: kane-cli explore${y?` --exploration-id ${y}`:""} --env ${i}`),t(""));let u=h??{kind:"exit",code:130};try{return await Te(u,e)}finally{await Promise.allSettled([...R.values()].map(o=>o.close()))}}async function Te(e,n){let t=be(n),r=i=>{process.stdout.write(i+`
|
|
4
|
-
`)};switch(e.kind){case"exit":return e.code;case"run":{let{explorationId:i,...a}=n,{runExploreSetupFlow:w}=await import("./explore-run-tty-
|
|
5
|
-
`);return 2}let{runLiveView:a}=await import("./explore-live-
|
|
6
|
-
`);return 2}let{runContextPanel:a}=await import("./explore-context-tty-
|
|
4
|
+
`)};switch(e.kind){case"exit":return e.code;case"run":{let{explorationId:i,...a}=n,{runExploreSetupFlow:w}=await import("./explore-run-tty-M56I23IF.js");return w({projectId:e.projectId,projectName:e.projectName??null,explorationId:e.explorationId,url:e.url,opts:a,back:()=>we({...n,...e.explorationId?{explorationId:e.explorationId}:{}},"run")})}case"watch":{let i=await V(n,"explore");if(!i.ok){for(let E of I(i.error))process.stderr.write(E+`
|
|
5
|
+
`);return 2}let{runLiveView:a}=await import("./explore-live-XIWWUV52.js");return(await a({client:H(i),explorationId:e.explorationId,runId:e.runId,mode:e.mode,env:t})).exitCode}case"context":{let i=await V(n,"explore");if(!i.ok){for(let E of I(i.error))process.stderr.write(E+`
|
|
6
|
+
`);return 2}let{runContextPanel:a}=await import("./explore-context-tty-PERKIWXD.js");return await a({client:H(i),explorationId:e.explorationId,env:t,compact:!0,...e.subject?{subject:e.subject}:{}})==="back"?we({...n,explorationId:e.explorationId},"context"):130}case"view":{let{runExploreViewAction:i}=await import("./explore-SA2P3SGX.js");return i({...n,explorationId:e.explorationId})}}}export{Ie as EntryApp,Te as dispatchEntryOutcome,we as runExploreEntryAction};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as W}from"./chunk-
|
|
2
|
+
import{b as W}from"./chunk-EJGCIGQY.js";import{a as J}from"./chunk-ERRIDBE7.js";import"./chunk-KGNE5CIM.js";import{m as F,o as _}from"./chunk-NPAUSUNM.js";import"./chunk-5Y2G4NC7.js";import"./chunk-LV7224DG.js";import"./chunk-5D7ENQTQ.js";import{a as q,b as N}from"./chunk-WN5VKKJ3.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import"./chunk-A7RJQJNT.js";import{a as j}from"./chunk-HCBYKLMW.js";import{b as O,h as A,i as T}from"./chunk-33DWJV67.js";import{a as g}from"./chunk-FOJHSG5M.js";import{a as ee}from"./chunk-6YGTRKDT.js";import{z as v}from"./chunk-J4FIESTB.js";import{e as $}from"./chunk-UR6MHSHU.js";var f=$(ee(),1);function G(e,t){return{mode:e.mode,explorationId:e.explorationId,runId:e.runId,env:e.env,phase:e.mode==="remote"?"queued":"running",openedAt:t,...e.policy?{policy:e.policy}:{}}}var y=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0;function K(e,t){let n=e.phase;return t.state==="stopped"?n="stopped":e.phase!=="stopping"&&(t.state==="queued"||t.state==="running")&&(n=t.state),{...e,phase:n,leases:y(t.leases)??e.leases,findings:y(t.findings)??e.findings,credits:y(t.credits?.total)??e.credits,remark:t.remark??e.remark,pollError:void 0,...e.policy?{}:F(t.requested?.policy)?{policy:t.requested.policy}:{}}}function U(e,t){if(!t)return e;let n=t.counts??{},i=y(n.flows)??e.flows,s=y(n.junctions)??e.screens,o=e.base??(i!==void 0&&s!==void 0?{flows:i,screens:s}:void 0);return{...e,flows:i,screens:s,...o?{base:o}:{}}}function k(e,t){return{...e,pollError:t}}function V(e){return e.phase==="stopped"?e:{...e,phase:"stopping"}}function I(e,t){let n=Math.max(0,Math.round((t-e.openedAt)/1e3)),i=e.phase==="queued"?"waiting for the VM":e.phase==="stopping"?"stopping":e.phase==="stopped"?"ended":"running";return{kind:"working",step:e.policy?`${i} \xB7 ${_(e.policy)}`:i,elapsedS:n}}var L=e=>Math.round(e).toLocaleString("en-US"),M=(e,t)=>e===void 0?null:`${t} ${L(e)}`,x=(e,t,n=`${t}s`)=>`${L(e)} ${Math.round(e)===1?t:n}`,D=(e,t,n)=>e===void 0?null:`${n} +${Math.max(0,e-(t??e))} (${L(e)})`;function z(e){return[e.phase==="queued"?"queued":null,M(e.leases,"leases"),D(e.screens,e.base?.screens,"screens"),D(e.flows,e.base?.flows,"flows"),M(e.findings,"findings"),M(e.credits,"credits"),e.pollError?`not refreshed: ${e.pollError}`:null].filter(n=>n!==null)}function Q(e){return e.phase==="stopping"?["stopping: the leases finish and every delta is sent"]:[e.mode==="local"&&e.owned!==!1?"ctrl+c stop":"ctrl+c detach"]}function H(e){return`kane-cli explore view --exploration-id ${e.explorationId} --env ${e.env}`}function te(e){return`kane-cli explore stop ${e.explorationId} --env ${e.env}`}function B(e){let t=[e.leases===void 0?null:x(e.leases,"lease"),e.screens===void 0?null:`${x(Math.max(0,e.screens-(e.base?.screens??e.screens)),"new screen")} (${L(e.screens)} on the map)`,e.flows===void 0?null:`${x(Math.max(0,e.flows-(e.base?.flows??e.flows)),"new flow")} (${L(e.flows)})`,e.findings===void 0?null:x(e.findings,"finding"),e.credits===void 0?null:x(e.credits,"credit")].filter(n=>n!==null);return t.length?t.join(" \xB7 "):"nothing reported yet"}function ne(e){if(e<60)return`${e}s`;let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t?`${t}h ${n}m`:`${n}m ${e%60}s`}function X(e,t,n){let i=m=>m.padEnd(9);if(t==="detached")return[{text:""},{text:`session summary \u2014 detached (the run keeps going${e.mode==="remote"?" on HyperExecute":""})`,tone:"bold"},{text:` ${i("run")}${e.runId}`},{text:` ${i("so far")}${B(e)}`},{text:` ${i("watch:")}kane-cli explore --exploration-id ${e.explorationId} --env ${e.env}`},{text:` ${i("map:")}${H(e)}`},{text:` ${i("stop:")}${te(e)}`},{text:""}];let s=e.remark?.code??"",o=s.startsWith("failed:"),d=e.remark?e.remark.message||s:t==="stopped"?"stopped":"ended",l=o?s.slice(7)||"failed":s||d,u=t==="stopped"||s==="user_stop"?e.remark?`stopped (${l})`:"stopped":o?`failed (${l})`:`complete (${l})`;return[{text:`\u25CF run ended \u2014 ${d} \xB7 ${ne(I(e,n).elapsedS)}`,tone:o?"dot-failed":"dot-done"},{text:""},{text:`session summary \u2014 ${u}`,tone:"bold"},{text:` ${i("run")}${e.runId}`},{text:` ${i("made")}${B(e)}`},{text:` ${i("map:")}${H(e)}`},{text:""}]}var c=$(j(),1),oe=3e3,Y=e=>e.split("-")[0]??e;function re(e){return{verb:"explore",sid:Y(e.runId),env:e.env,subject:`exploration ${Y(e.explorationId)}`}}function ie({model:e,now:t,cols:n}){return(0,c.jsx)(W,{status:I(e,t),meta:re(e),tallies:{items:z(e)},keys:Q(e),remote:!0,accent:v.orange,cols:n})}var C=class{constructor(t){this.model=t}listeners=new Set;logs=[];onLog=null;flush=async()=>{};log(t){this.onLog?this.onLog(t):this.logs.push(t)}takeLogs(t){for(let n of this.logs.splice(0))t(n);return this.onLog=t,()=>{this.onLog=null}}set(t){this.model=t;for(let n of this.listeners)n()}subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));get=()=>this.model};function se({store:e,now:t,onCtrlC:n}){let i=(0,f.useSyncExternalStore)(e.subscribe,e.get),[s,o]=(0,f.useState)(t());(0,f.useEffect)(()=>{let l=setInterval(()=>o(t()),1e3);return()=>clearInterval(l)},[t]);let{isRawModeSupported:d}=A();return T((l,a)=>{a.ctrl&&l==="c"&&n()},{isActive:d===!0}),(0,c.jsx)(ie,{model:i,now:s})}function le({store:e}){let t=N();return(0,f.useEffect)(()=>(e.flush=t.flush,e.takeLogs(n=>t.append((0,c.jsx)(O,{children:n})))),[e,t]),null}function de(e){return e.tone==="bold"?g.bold(e.text):e.tone==="dim"?g.hex(v.dim)(e.text):e.tone==="dot-done"?g.hex(v.green)(e.text):e.tone==="dot-failed"?g.hex(v.red)(e.text):e.text}async function be(e,t={}){let n=t.now??Date.now,i=t.print??(r=>process.stderr.write(`${r}
|
|
3
3
|
`)),s=e.mode==="local"&&e.ended!==void 0,o=new C({...G(e,n()),owned:s}),d,l=new Promise(r=>{d=r}),a=!1,u=(r,S)=>{a||(a=!0,d({outcome:r,exitCode:S}))},m=async()=>{try{let r=await e.client.getSession(e.explorationId,e.runId);o.set(K(o.model,r))}catch(r){o.set(k(o.model,r instanceof Error?r.message.slice(0,80):String(r)))}try{o.set(U(o.model,await e.client.viewSummary(e.explorationId)))}catch{}!s&&o.model.phase==="stopped"&&u("ended",o.model.remark?J(o.model.remark):0)},p=!1,b=()=>{if(!a){if(!s){u("detached",0);return}p||(p=!0,o.set(V(o.model)),e.client.stopExploration(e.explorationId,!1).catch(r=>{o.set(k(o.model,`stop: ${r instanceof Error?r.message.slice(0,80):String(r)}`))}))}};e.mode==="local"&&e.ended&&e.ended.then(async r=>{await m(),u(p?"stopped":"ended",r)},()=>u(p?"stopped":"ended",1));let P=()=>b();process.on("SIGINT",P);let E=()=>{},w,R,h;try{let r=t.stdout;r||({out:r,restore:E}=ae(Z=>o.log(Z)));let{render:S}=await import("./build-5ZN47FAT.js");R=S((0,c.jsxs)(q,{children:[(0,c.jsx)(le,{store:o}),(0,c.jsx)(se,{store:o,now:n,onCtrlC:b})]}),{stdout:r,stdin:t.stdin??process.stdin,exitOnCtrlC:!1,patchConsole:!1}),t.onReady?.({ctrlC:b}),m(),w=setInterval(()=>{m()},t.pollMs??oe),h=await l,await o.flush()}finally{w&&clearInterval(w),process.off("SIGINT",P),R?.unmount(),E()}for(let r of X(o.model,h.outcome,n()))i(de(r));return h}function ae(e){let t=process.stderr,n=t.write,i=n.bind(t),s=Object.create(t,{write:{value:(l,...a)=>i(l,...a)}}),o="";t.write=((l,...a)=>{o+=typeof l=="string"?l:Buffer.from(l).toString("utf8");let u=o.split(`
|
|
4
4
|
`);o=u.pop()??"";for(let p of u)e(p);return a.find(p=>typeof p=="function")?.(),!0});let d=!1;return{out:s,restore:()=>{d||(d=!0,t.write=n,o&&i(o+`
|
|
5
5
|
`))}}}export{ie as LiveScreen,ae as captureStderr,re as liveMeta,be as runLiveView};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as ae}from"./chunk-GZQAETB2.js";import{a as ie,b as ue}from"./chunk-IH73ZCBB.js";import{l as me}from"./chunk-Z6SI7YNV.js";import{a as I}from"./chunk-YDPTSDIJ.js";import{l as F,m as ce,o as R,p as pe}from"./chunk-GQARXS6F.js";import{d as se}from"./chunk-3AGP2BVN.js";import"./chunk-DLP5S3TO.js";import{b as le}from"./chunk-HG2ILWCE.js";import"./chunk-72KYMWQ5.js";import"./chunk-CCOD4GQJ.js";import"./chunk-JQ64X2TO.js";import"./chunk-5Y2G4NC7.js";import"./chunk-BHQIH2FE.js";import"./chunk-5D7ENQTQ.js";import{b as A,d as oe}from"./chunk-SMXABALN.js";import"./chunk-6K5BEEAJ.js";import"./chunk-3G2LSTK5.js";import"./chunk-4IEQNX7F.js";import"./chunk-FI2DVNRT.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import"./chunk-A7RJQJNT.js";import"./chunk-K75WIRI5.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as g,b as u}from"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import{a as Oe}from"./chunk-6YGTRKDT.js";import{b as ne,z as m}from"./chunk-FAMQ4DHU.js";import{e as y}from"./chunk-UR6MHSHU.js";var h=y(Oe(),1);import{join as ke}from"path";var p=y(O(),1);function de({title:e,sub:r,fields:t,sel:o,accent:n=m.orange}){let l=Math.max(0,...t.map(a=>a.label.length))+2,i;return(0,p.jsxs)(g,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(u,{bold:!0,color:n,children:e}),r?(0,p.jsx)(u,{color:m.dim,children:` ${r}`}):null,t.map((a,w)=>{let f=a.group&&a.group!==i?a.group:null;i=a.group??i;let S=o===w;return(0,p.jsxs)(g,{flexDirection:"column",children:[f?(0,p.jsx)(g,{marginTop:w===0?0:1,children:(0,p.jsx)(u,{color:m.secondary,bold:!0,children:` ${f}`})}):null,(0,p.jsxs)(g,{children:[(0,p.jsxs)(u,{children:[S?(0,p.jsx)(u,{color:n,children:"\u276F "}):" ",(0,p.jsx)(u,{color:S?void 0:m.dim,children:a.label.padEnd(l)})]}),a.editing!==void 0?(0,p.jsx)(oe,{value:a.editing}):(0,p.jsx)(u,{color:a.warn?m.amber:void 0,children:a.value}),a.from&&a.editing===void 0?(0,p.jsx)(u,{color:m.muted,children:` ${a.from}`}):null]}),S&&a.hint?(0,p.jsx)(u,{color:m.dim,wrap:"truncate-end",children:` ${a.hint}`}):null]},w)})]})}var P=["url","prompt","maxLeases","maxParallel","runsOn","policy","context","variables","more"],L=["allowDomain","allowPost","deny","deps","focus","browser","headless","tunnel","tunnelName","variablesFile","advanced"],T=["depthCaps","slowBudget","recheck"],ge={runsOn:["HyperExecute","this machine"],policy:[R(F),R(F==="read_only"?"mutating":"read_only")],context:["on","off"],recheck:["on","off"],browser:["local","remote"],headless:["off","on"],tunnel:["off","on"]},Fe=["variables","more","advanced"],Te={url:"url",prompt:"prompt",maxLeases:"max leases",maxParallel:"browsers",runsOn:"runs on",policy:"policy",context:"assurance context",variables:"variables",more:"more options",advanced:"advanced",allowDomain:"allow-domain",deny:"deny",focus:"focus",depthCaps:"depth caps",slowBudget:"slow budget",recheck:"recheck",allowPost:"allow-post",deps:"deps",browser:"browser",headless:"headless",variablesFile:"variables file",tunnel:"tunnel",tunnelName:"tunnel name"},Be={url:"url",prompt:"prompt",maxLeases:"maxLeases",maxParallel:"maxParallel",runsOn:"localOrchestration",policy:"policy",context:"context",variables:"variablesRow",more:"moreRow",advanced:"advancedRow",allowDomain:"allowDomain",deny:"deny",focus:"focus",depthCaps:"depthCaps",slowBudget:"slowBudget",recheck:"recheck",allowPost:"allowPost",deps:"deps",browser:"browser",headless:"headless",variablesFile:"variablesFile",tunnel:"tunnel",tunnelName:"tunnelName"},$e={allowDomain:"entries apart by ,",deny:"entries apart by ,",allowPost:"entries apart by ,",deps:"entries apart by |"};function De(e){return[me[Be[e]].purpose,$e[e]].filter(Boolean).join(" \xB7 ")}var H="Explore the app",M=e=>Array.isArray(e)?e.map(String).filter(Boolean).join(", "):"",x=e=>typeof e=="string"?e:typeof e=="number"?String(e):"";function xe(e){let r=e.opts,t={},o={},n=(f,S,D,N="default")=>{t[f]=S||D,o[f]=S?"flag":N},l=x(r.url);e.url?n("url","",e.url,"the exploration"):l?n("url",l,""):(t.url="",o.url="required");let i=x(r.prompt);n("prompt",i&&i!==H?i:"",H),n("maxLeases",x(r.maxLeases),""),n("maxParallel",x(r.maxParallel),"1"),n("runsOn",r.localOrchestration?"this machine":"","HyperExecute"),n("policy",ce(r.policy)?R(r.policy):"",R(F)),n("context",r.context===!1?"off":"","on"),t.variables="",o.variables=r.variables?"variables files \xB7 flag":"variables files",t.more="",t.advanced="",n("allowDomain",M(r.allowDomain),""),n("deny",M(r.deny),""),n("focus",x(r.focus),""),n("depthCaps",x(r.depthCaps),""),n("slowBudget",x(r.slowBudget),""),n("recheck",r.recheck===!1?"off":"","on"),n("allowPost",M(r.allowPost),""),n("deps",Array.isArray(r.deps)?r.deps.map(String).filter(Boolean).join(" | "):"",""),n("browser",r.browser==="remote"?"remote":"","local"),n("headless",r.headless?"on":"","off"),n("variablesFile",x(r.variablesFile),""),n("tunnel",r.tunnel===!0||x(r.tunnelName)?"on":"","off"),n("tunnelName",x(r.tunnelName),"");let a=T.some(f=>o[f]==="flag"),w=a||L.some(f=>o[f]==="flag");return{values:t,from:o,more:w,advanced:a,urlLocked:!!e.url,sel:0,editing:null}}function Y(e){return e.more?e.advanced?[...P,...L,...T]:[...P,...L]:P}function k(e){let r=Y(e);return r[Math.min(e.sel,r.length-1)]}function G(e,r){let t=Y(e).length;return{...e,sel:(e.sel+r+t)%t}}function U(e,r){let t=k(e);if(t==="maxLeases"){let o=Number(e.values.maxLeases)||0,n=Math.max(0,(r>0?Math.floor(o/10)+1:Math.ceil(o/10)-1)*10);return{...e,values:{...e.values,maxLeases:n?String(n):""},from:{...e.from,maxLeases:"you"}}}if(t==="maxParallel"){let o=Math.min(20,Math.max(1,(Number(e.values.maxParallel)||1)+r));return{...e,values:{...e.values,maxParallel:String(o)},from:{...e.from,maxParallel:"you"}}}return he(e)}function B(e){return e.values.runsOn!=="this machine"}function be(e,r=56){if(e.length<=r)return e;let t=Math.ceil((r-1)/2);return`${e.slice(0,t)}\u2026${e.slice(e.length-(r-1-t))}`}function he(e){let r=k(e);if(r==="more")return{...e,more:!e.more,advanced:e.more?!1:e.advanced,sel:e.sel};if(r==="advanced")return{...e,advanced:!e.advanced,sel:e.sel};if((r==="browser"||r==="headless")&&B(e))return e;let t=ge[r];if(!t)return e;let o=e.values[r]===t[0]?t[1]:t[0];return{...e,values:{...e.values,[r]:o},from:{...e.from,[r]:"you"}}}function we(e){let r=k(e);return r==="more"||r==="advanced"||ge[r]?he(e):Fe.includes(r)||r==="url"&&e.urlLocked?e:{...e,editing:{key:r,text:e.values[r]}}}function q(e,r){return e.editing?{...e,editing:{...e.editing,text:r}}:e}function Se(e){if(!e.editing)return e;let{key:r,text:t}=e.editing,o=t.trim();return o===e.values[r]?{...e,editing:null}:{...e,editing:null,values:{...e.values,[r]:o},from:{...e.from,[r]:"you"}}}function ve(e){return{...e,editing:null}}var fe=(e,r)=>e.from[r]==="you"||e.from[r]==="flag";function Ee(e,r,t){if(r==="variables")return t.text;if(r==="more"){let n=[...L.filter(i=>i!=="advanced"),...T],l=n.filter(i=>fe(e,i)).length;return`${n.length} more${l?` \xB7 ${l} set`:""}${e.more?" \xB7 \u2190 \u2192 hide":" \xB7 \u23CE show"}`}if(r==="advanced"){let n=T.filter(l=>fe(e,l)).length;return`depth caps, slow budget, recheck${n?` \xB7 ${n} set`:""}${e.advanced?" \xB7 \u2190 \u2192 hide":" \xB7 \u23CE show"}`}if(r==="browser"&&B(e))return"remote (HyperExecute runs always use remote)";if(r==="headless"&&B(e))return"\u2014";let o=e.values[r];return o?be(o):r==="url"?"required":r==="depthCaps"?"default":"none"}function ye(e,r){return Y(e).map((t,o)=>{let l=(t==="browser"||t==="headless")&&B(e)?"":t==="url"&&e.urlLocked?"the exploration \xB7 locked":e.from[t]??"";return{label:Te[t],value:Ee(e,t,r),...l?{from:l}:{},hint:De(t),...t==="url"&&!e.values.url||t==="variables"&&r.missing?{warn:!0}:{},...e.editing&&e.editing.key===t&&e.sel===o?{editing:e.editing.text}:{},...o>=P.length+L.length?{group:"advanced"}:o>=P.length?{group:"more options"}:{}}})}var $=e=>{let r=Number(e);return Number.isInteger(r)&&r>=1?r:null};function Re(e,r){return e.values.url?e.values.maxLeases&&$(e.values.maxLeases)===null?"max leases: a positive integer, or empty for no limit":$(e.values.maxParallel)===null?"browsers: a positive integer":r.missing?r.text:null:"url is required"}var V=e=>e.split(",").map(r=>r.trim()).filter(Boolean);function Pe(e,r){let t=e.values,o={...r,url:t.url,prompt:t.prompt||H},n=l=>{delete o[l]};return t.maxLeases?o.maxLeases=$(t.maxLeases)??t.maxLeases:n("maxLeases"),o.maxParallel=$(t.maxParallel)??1,t.runsOn==="this machine"?o.localOrchestration=!0:n("localOrchestration"),o.policy=pe(t.policy),t.context==="off"?o.context=!1:n("context"),o.allowDomain=V(t.allowDomain),o.deny=V(t.deny),t.focus?o.focus=t.focus:n("focus"),t.depthCaps?o.depthCaps=t.depthCaps:n("depthCaps"),t.slowBudget?o.slowBudget=t.slowBudget:n("slowBudget"),t.recheck==="off"?o.recheck=!1:n("recheck"),o.allowPost=V(t.allowPost),o.deps=t.deps.split("|").map(l=>l.trim()).filter(Boolean),o.browser=t.browser==="remote"?"remote":"local",t.headless==="on"?o.headless=!0:n("headless"),t.variablesFile?o.variablesFile=t.variablesFile:n("variablesFile"),t.tunnelName?(o.tunnelName=t.tunnelName,n("tunnel")):(n("tunnelName"),t.tunnel==="on"?o.tunnel=!0:n("tunnel")),o}var _=(e,r)=>[...new Set(r.map(t=>e.from[t]??"default"))].join(" \xB7 ");function Le(e,r){return Ke(e,r).map(t=>({...t,text:be(t.text,64)}))}function Ke(e,r){let t=e.values,o=i=>e.from[i]??"default",n=[{label:"url",text:t.url,from:o("url")},{label:"prompt",text:t.prompt,from:o("prompt")},{label:"runs on",text:t.runsOn==="this machine"?"this machine":"HyperExecute \xB7 remote browsers",from:o("runsOn")},{label:"budget",text:`${t.maxLeases?`${t.maxLeases} leases`:"no lease limit"} \xB7 ${t.maxParallel} browser${t.maxParallel==="1"?"":"s"}`,from:_(e,["maxLeases","maxParallel"])}],l=[t.allowDomain&&`allow ${t.allowDomain}`,t.deny&&`deny ${t.deny}`,t.focus&&`focus ${t.focus}`].filter(Boolean).join(" \xB7 ");return l&&n.push({label:"scope",text:l,from:_(e,["allowDomain","deny","focus"].filter(i=>t[i]))}),t.depthCaps&&n.push({label:"depth caps",text:t.depthCaps,from:o("depthCaps")}),t.slowBudget&&n.push({label:"slow budget",text:t.slowBudget,from:o("slowBudget")}),t.allowPost&&n.push({label:"allow-post",text:t.allowPost,from:o("allowPost")}),t.deps&&n.push({label:"deps",text:t.deps,from:o("deps")}),t.runsOn==="this machine"&&n.push({label:"browser",text:t.headless==="on"?`${t.browser} \xB7 headless`:t.browser,from:_(e,t.headless==="on"?["browser","headless"]:["browser"])}),t.variablesFile&&n.push({label:"variables file",text:t.variablesFile,from:o("variablesFile")}),(t.tunnel==="on"||t.tunnelName)&&n.push({label:"tunnel",text:t.tunnelName?`on \xB7 ${t.tunnelName}`:"on",from:o(t.tunnelName?"tunnelName":"tunnel")}),n.push({label:"recheck",text:t.recheck,from:o("recheck")}),n.push({label:"policy",text:t.policy,from:o("policy")}),n.push({label:"variables",text:r.text,from:o("variables")}),n.push({label:"assurance context",text:t.context,from:o("context")}),n}var c=y(O(),1);function Ce(e,r){try{let t=ie(r.deps??[]),o=ue({prompt:e,deps:t},{globalDir:ke(ne,"variables"),localDir:ke(process.cwd(),".testmuai","variables"),file:r.variablesFile,inline:r.variables});if("error"in o)return{text:o.error,missing:!0};let n=Object.entries(o.variables).map(([l,i])=>`${l.replace(/^(secrets\.user\.|global\.|environment\.)/,"")} \u2713${i.secret?" secret":""}`);return{text:n.length?n.join(" "):"none used",missing:!1}}catch(t){return{text:`variables: ${t.message}`,missing:!0}}}var j=[{key:"launch",label:"Launch"},{key:"back",label:"Back to setup"},{key:"cancel",label:"Cancel"}];function Ae({seed:e,done:r,variables:t,fromCard:o}){let[n,l]=(0,h.useState)(()=>xe(e)),[i,a]=(0,h.useState)(()=>typeof e.opts.url=="string"&&e.opts.url.trim()?"review":"setup"),[w,f]=(0,h.useState)(!1),[S,D]=(0,h.useState)(!1),[N,E]=(0,h.useState)(0),[z,J]=(0,h.useState)(null),Q=n.values.prompt,K=(0,h.useMemo)(()=>(t??(d=>Ce(d,e.opts)))(Q),[Q,t,e.opts]),W=Re(n,K);A((d,s)=>{if(i==="review"){if(s.upArrow)E(v=>(v+j.length-1)%j.length);else if(s.downArrow)E(v=>(v+1)%j.length);else if(s.escape)a("setup");else if(s.return){let v=j[N].key;if(v==="launch"){let C=Pe(n,e.opts);D(!0),setTimeout(()=>r({kind:"launch",opts:C}),0)}else v==="back"?a("setup"):r({kind:"discard"})}return}if(n.editing){s.return?l(Se(n)):s.escape?l(ve(n)):s.backspace||s.delete?l(q(n,n.editing.text.slice(0,-1))):d&&!s.ctrl&&!s.meta&&!s.tab&&l(q(n,n.editing.text+d));return}if(w){d==="y"||d==="Y"?r({kind:"discard"}):(d==="n"||d==="N"||s.return||s.escape)&&f(!1);return}J(null),s.upArrow?l(G(n,-1)):s.downArrow?l(G(n,1)):s.leftArrow?l(U(n,-1)):s.rightArrow||d===" "?l(U(n,1)):s.return?l(we(n)):s.tab?W?J(W):(E(0),a("review")):s.escape&&(o?r({kind:"back"}):f(!0))});let X=typeof e.opts.project=="string"&&e.opts.project?e.opts.project:"",Z=e.projectName||(X?X.slice(0,8):"the configured project");if(S)return(0,c.jsx)(u,{children:""});let ee=d=>(0,c.jsx)(ae,{status:{kind:"waiting",label:i==="review"?"review":"set up the run"},meta:{verb:"explore",sid:"",env:String(e.opts.env??"prod"),subject:n.values.url?n.values.url.replace(/^https?:\/\//,"").split("/")[0]:"new run"},tallies:{items:[`project ${Z}`]},keys:d,accent:m.orange,remote:!0});if(i==="review"){let d=[{label:"project",text:Z,from:e.projectFrom??(e.opts.project?"flag":"config")},...Le(n,K)],s=n.values.runsOn==="this machine"?"on this machine":"on HyperExecute",v=Math.max(60,(process.stderr.columns||100)-2),C=se(["setting","value","from"],d.map(b=>[b.label,b.text,b.from]),v,1);return(0,c.jsxs)(g,{flexDirection:"column",marginTop:1,children:[(0,c.jsx)(u,{bold:!0,color:m.orange,children:"Review"}),C.map((b,re)=>(0,c.jsx)(u,{bold:re===1,children:b},re)),(0,c.jsx)(le,{headline:"Launch?",ask:!0,rows:j.map(b=>b.key==="launch"?{...b,label:`Launch ${s}`}:b),sel:N,focused:!0,accent:m.orange}),ee(["\u2191\u2193 select","\u23CE confirm","esc setup","ctrl+c exit"])]})}let te=k(n);return(0,c.jsxs)(g,{flexDirection:"column",children:[(0,c.jsx)(de,{title:"New run",sub:"flags you passed are filled in; \u23CE edits a row",fields:ye(n,K),sel:n.sel}),(0,c.jsxs)(g,{marginTop:1,flexDirection:"column",children:[z?(0,c.jsx)(u,{color:m.amber,children:`launch refused: ${z}`}):null,w?(0,c.jsx)(u,{color:m.amber,children:"Discard this setup? (y/N)"}):null]}),ee(n.editing?["type","\u23CE keep","esc undo"]:["\u2191\u2193 select",["runsOn","policy","context","recheck","more","advanced","maxLeases","maxParallel","browser","headless","tunnel"].includes(te)?"\u2190 \u2192 change":te==="url"&&n.urlLocked?"url locked":"\u23CE edit","tab review",o?"esc card":"esc discard","ctrl+c exit"])]})}async function je(e,r=!1){return await I(t=>(0,c.jsx)(Ae,{seed:e,fromCard:r,done:t}))}function Ne(e){let r=t=>{process.stderr.write(t+`
|
|
2
|
+
import{b as ae}from"./chunk-EJGCIGQY.js";import{a as ie,b as ue}from"./chunk-VCVEZEVS.js";import{l as me}from"./chunk-ZMIKNNO6.js";import{a as I}from"./chunk-YDPTSDIJ.js";import{l as F,m as ce,o as R,p as pe}from"./chunk-NPAUSUNM.js";import{d as se}from"./chunk-3AGP2BVN.js";import"./chunk-BJO6J5X2.js";import{b as le}from"./chunk-YILRYMMG.js";import"./chunk-72KYMWQ5.js";import"./chunk-CCOD4GQJ.js";import"./chunk-JQ64X2TO.js";import"./chunk-5Y2G4NC7.js";import"./chunk-LV7224DG.js";import"./chunk-5D7ENQTQ.js";import{b as A,d as oe}from"./chunk-SMXABALN.js";import"./chunk-SB26HQO7.js";import"./chunk-3G2LSTK5.js";import"./chunk-4IEQNX7F.js";import"./chunk-ZCBOHWN3.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-2XW33VOK.js";import"./chunk-7HO4NX5W.js";import"./chunk-A7RJQJNT.js";import"./chunk-TM45NPWL.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as g,b as u}from"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import{a as Oe}from"./chunk-6YGTRKDT.js";import{b as ne,z as m}from"./chunk-J4FIESTB.js";import{e as y}from"./chunk-UR6MHSHU.js";var h=y(Oe(),1);import{join as ke}from"path";var p=y(O(),1);function de({title:e,sub:r,fields:t,sel:o,accent:n=m.orange}){let l=Math.max(0,...t.map(a=>a.label.length))+2,i;return(0,p.jsxs)(g,{flexDirection:"column",marginTop:1,children:[(0,p.jsx)(u,{bold:!0,color:n,children:e}),r?(0,p.jsx)(u,{color:m.dim,children:` ${r}`}):null,t.map((a,w)=>{let f=a.group&&a.group!==i?a.group:null;i=a.group??i;let S=o===w;return(0,p.jsxs)(g,{flexDirection:"column",children:[f?(0,p.jsx)(g,{marginTop:w===0?0:1,children:(0,p.jsx)(u,{color:m.secondary,bold:!0,children:` ${f}`})}):null,(0,p.jsxs)(g,{children:[(0,p.jsxs)(u,{children:[S?(0,p.jsx)(u,{color:n,children:"\u276F "}):" ",(0,p.jsx)(u,{color:S?void 0:m.dim,children:a.label.padEnd(l)})]}),a.editing!==void 0?(0,p.jsx)(oe,{value:a.editing}):(0,p.jsx)(u,{color:a.warn?m.amber:void 0,children:a.value}),a.from&&a.editing===void 0?(0,p.jsx)(u,{color:m.muted,children:` ${a.from}`}):null]}),S&&a.hint?(0,p.jsx)(u,{color:m.dim,wrap:"truncate-end",children:` ${a.hint}`}):null]},w)})]})}var P=["url","prompt","maxLeases","maxParallel","runsOn","policy","context","variables","more"],L=["allowDomain","allowPost","deny","deps","focus","browser","headless","tunnel","tunnelName","variablesFile","advanced"],T=["depthCaps","slowBudget","recheck"],ge={runsOn:["HyperExecute","this machine"],policy:[R(F),R(F==="read_only"?"mutating":"read_only")],context:["on","off"],recheck:["on","off"],browser:["local","remote"],headless:["off","on"],tunnel:["off","on"]},Fe=["variables","more","advanced"],Te={url:"url",prompt:"prompt",maxLeases:"max leases",maxParallel:"browsers",runsOn:"runs on",policy:"policy",context:"assurance context",variables:"variables",more:"more options",advanced:"advanced",allowDomain:"allow-domain",deny:"deny",focus:"focus",depthCaps:"depth caps",slowBudget:"slow budget",recheck:"recheck",allowPost:"allow-post",deps:"deps",browser:"browser",headless:"headless",variablesFile:"variables file",tunnel:"tunnel",tunnelName:"tunnel name"},Be={url:"url",prompt:"prompt",maxLeases:"maxLeases",maxParallel:"maxParallel",runsOn:"localOrchestration",policy:"policy",context:"context",variables:"variablesRow",more:"moreRow",advanced:"advancedRow",allowDomain:"allowDomain",deny:"deny",focus:"focus",depthCaps:"depthCaps",slowBudget:"slowBudget",recheck:"recheck",allowPost:"allowPost",deps:"deps",browser:"browser",headless:"headless",variablesFile:"variablesFile",tunnel:"tunnel",tunnelName:"tunnelName"},$e={allowDomain:"entries apart by ,",deny:"entries apart by ,",allowPost:"entries apart by ,",deps:"entries apart by |"};function De(e){return[me[Be[e]].purpose,$e[e]].filter(Boolean).join(" \xB7 ")}var H="Explore the app",M=e=>Array.isArray(e)?e.map(String).filter(Boolean).join(", "):"",x=e=>typeof e=="string"?e:typeof e=="number"?String(e):"";function xe(e){let r=e.opts,t={},o={},n=(f,S,D,N="default")=>{t[f]=S||D,o[f]=S?"flag":N},l=x(r.url);e.url?n("url","",e.url,"the exploration"):l?n("url",l,""):(t.url="",o.url="required");let i=x(r.prompt);n("prompt",i&&i!==H?i:"",H),n("maxLeases",x(r.maxLeases),""),n("maxParallel",x(r.maxParallel),"1"),n("runsOn",r.localOrchestration?"this machine":"","HyperExecute"),n("policy",ce(r.policy)?R(r.policy):"",R(F)),n("context",r.context===!1?"off":"","on"),t.variables="",o.variables=r.variables?"variables files \xB7 flag":"variables files",t.more="",t.advanced="",n("allowDomain",M(r.allowDomain),""),n("deny",M(r.deny),""),n("focus",x(r.focus),""),n("depthCaps",x(r.depthCaps),""),n("slowBudget",x(r.slowBudget),""),n("recheck",r.recheck===!1?"off":"","on"),n("allowPost",M(r.allowPost),""),n("deps",Array.isArray(r.deps)?r.deps.map(String).filter(Boolean).join(" | "):"",""),n("browser",r.browser==="remote"?"remote":"","local"),n("headless",r.headless?"on":"","off"),n("variablesFile",x(r.variablesFile),""),n("tunnel",r.tunnel===!0||x(r.tunnelName)?"on":"","off"),n("tunnelName",x(r.tunnelName),"");let a=T.some(f=>o[f]==="flag"),w=a||L.some(f=>o[f]==="flag");return{values:t,from:o,more:w,advanced:a,urlLocked:!!e.url,sel:0,editing:null}}function Y(e){return e.more?e.advanced?[...P,...L,...T]:[...P,...L]:P}function k(e){let r=Y(e);return r[Math.min(e.sel,r.length-1)]}function G(e,r){let t=Y(e).length;return{...e,sel:(e.sel+r+t)%t}}function U(e,r){let t=k(e);if(t==="maxLeases"){let o=Number(e.values.maxLeases)||0,n=Math.max(0,(r>0?Math.floor(o/10)+1:Math.ceil(o/10)-1)*10);return{...e,values:{...e.values,maxLeases:n?String(n):""},from:{...e.from,maxLeases:"you"}}}if(t==="maxParallel"){let o=Math.min(20,Math.max(1,(Number(e.values.maxParallel)||1)+r));return{...e,values:{...e.values,maxParallel:String(o)},from:{...e.from,maxParallel:"you"}}}return he(e)}function B(e){return e.values.runsOn!=="this machine"}function be(e,r=56){if(e.length<=r)return e;let t=Math.ceil((r-1)/2);return`${e.slice(0,t)}\u2026${e.slice(e.length-(r-1-t))}`}function he(e){let r=k(e);if(r==="more")return{...e,more:!e.more,advanced:e.more?!1:e.advanced,sel:e.sel};if(r==="advanced")return{...e,advanced:!e.advanced,sel:e.sel};if((r==="browser"||r==="headless")&&B(e))return e;let t=ge[r];if(!t)return e;let o=e.values[r]===t[0]?t[1]:t[0];return{...e,values:{...e.values,[r]:o},from:{...e.from,[r]:"you"}}}function we(e){let r=k(e);return r==="more"||r==="advanced"||ge[r]?he(e):Fe.includes(r)||r==="url"&&e.urlLocked?e:{...e,editing:{key:r,text:e.values[r]}}}function q(e,r){return e.editing?{...e,editing:{...e.editing,text:r}}:e}function Se(e){if(!e.editing)return e;let{key:r,text:t}=e.editing,o=t.trim();return o===e.values[r]?{...e,editing:null}:{...e,editing:null,values:{...e.values,[r]:o},from:{...e.from,[r]:"you"}}}function ve(e){return{...e,editing:null}}var fe=(e,r)=>e.from[r]==="you"||e.from[r]==="flag";function Ee(e,r,t){if(r==="variables")return t.text;if(r==="more"){let n=[...L.filter(i=>i!=="advanced"),...T],l=n.filter(i=>fe(e,i)).length;return`${n.length} more${l?` \xB7 ${l} set`:""}${e.more?" \xB7 \u2190 \u2192 hide":" \xB7 \u23CE show"}`}if(r==="advanced"){let n=T.filter(l=>fe(e,l)).length;return`depth caps, slow budget, recheck${n?` \xB7 ${n} set`:""}${e.advanced?" \xB7 \u2190 \u2192 hide":" \xB7 \u23CE show"}`}if(r==="browser"&&B(e))return"remote (HyperExecute runs always use remote)";if(r==="headless"&&B(e))return"\u2014";let o=e.values[r];return o?be(o):r==="url"?"required":r==="depthCaps"?"default":"none"}function ye(e,r){return Y(e).map((t,o)=>{let l=(t==="browser"||t==="headless")&&B(e)?"":t==="url"&&e.urlLocked?"the exploration \xB7 locked":e.from[t]??"";return{label:Te[t],value:Ee(e,t,r),...l?{from:l}:{},hint:De(t),...t==="url"&&!e.values.url||t==="variables"&&r.missing?{warn:!0}:{},...e.editing&&e.editing.key===t&&e.sel===o?{editing:e.editing.text}:{},...o>=P.length+L.length?{group:"advanced"}:o>=P.length?{group:"more options"}:{}}})}var $=e=>{let r=Number(e);return Number.isInteger(r)&&r>=1?r:null};function Re(e,r){return e.values.url?e.values.maxLeases&&$(e.values.maxLeases)===null?"max leases: a positive integer, or empty for no limit":$(e.values.maxParallel)===null?"browsers: a positive integer":r.missing?r.text:null:"url is required"}var V=e=>e.split(",").map(r=>r.trim()).filter(Boolean);function Pe(e,r){let t=e.values,o={...r,url:t.url,prompt:t.prompt||H},n=l=>{delete o[l]};return t.maxLeases?o.maxLeases=$(t.maxLeases)??t.maxLeases:n("maxLeases"),o.maxParallel=$(t.maxParallel)??1,t.runsOn==="this machine"?o.localOrchestration=!0:n("localOrchestration"),o.policy=pe(t.policy),t.context==="off"?o.context=!1:n("context"),o.allowDomain=V(t.allowDomain),o.deny=V(t.deny),t.focus?o.focus=t.focus:n("focus"),t.depthCaps?o.depthCaps=t.depthCaps:n("depthCaps"),t.slowBudget?o.slowBudget=t.slowBudget:n("slowBudget"),t.recheck==="off"?o.recheck=!1:n("recheck"),o.allowPost=V(t.allowPost),o.deps=t.deps.split("|").map(l=>l.trim()).filter(Boolean),o.browser=t.browser==="remote"?"remote":"local",t.headless==="on"?o.headless=!0:n("headless"),t.variablesFile?o.variablesFile=t.variablesFile:n("variablesFile"),t.tunnelName?(o.tunnelName=t.tunnelName,n("tunnel")):(n("tunnelName"),t.tunnel==="on"?o.tunnel=!0:n("tunnel")),o}var _=(e,r)=>[...new Set(r.map(t=>e.from[t]??"default"))].join(" \xB7 ");function Le(e,r){return Ke(e,r).map(t=>({...t,text:be(t.text,64)}))}function Ke(e,r){let t=e.values,o=i=>e.from[i]??"default",n=[{label:"url",text:t.url,from:o("url")},{label:"prompt",text:t.prompt,from:o("prompt")},{label:"runs on",text:t.runsOn==="this machine"?"this machine":"HyperExecute \xB7 remote browsers",from:o("runsOn")},{label:"budget",text:`${t.maxLeases?`${t.maxLeases} leases`:"no lease limit"} \xB7 ${t.maxParallel} browser${t.maxParallel==="1"?"":"s"}`,from:_(e,["maxLeases","maxParallel"])}],l=[t.allowDomain&&`allow ${t.allowDomain}`,t.deny&&`deny ${t.deny}`,t.focus&&`focus ${t.focus}`].filter(Boolean).join(" \xB7 ");return l&&n.push({label:"scope",text:l,from:_(e,["allowDomain","deny","focus"].filter(i=>t[i]))}),t.depthCaps&&n.push({label:"depth caps",text:t.depthCaps,from:o("depthCaps")}),t.slowBudget&&n.push({label:"slow budget",text:t.slowBudget,from:o("slowBudget")}),t.allowPost&&n.push({label:"allow-post",text:t.allowPost,from:o("allowPost")}),t.deps&&n.push({label:"deps",text:t.deps,from:o("deps")}),t.runsOn==="this machine"&&n.push({label:"browser",text:t.headless==="on"?`${t.browser} \xB7 headless`:t.browser,from:_(e,t.headless==="on"?["browser","headless"]:["browser"])}),t.variablesFile&&n.push({label:"variables file",text:t.variablesFile,from:o("variablesFile")}),(t.tunnel==="on"||t.tunnelName)&&n.push({label:"tunnel",text:t.tunnelName?`on \xB7 ${t.tunnelName}`:"on",from:o(t.tunnelName?"tunnelName":"tunnel")}),n.push({label:"recheck",text:t.recheck,from:o("recheck")}),n.push({label:"policy",text:t.policy,from:o("policy")}),n.push({label:"variables",text:r.text,from:o("variables")}),n.push({label:"assurance context",text:t.context,from:o("context")}),n}var c=y(O(),1);function Ce(e,r){try{let t=ie(r.deps??[]),o=ue({prompt:e,deps:t},{globalDir:ke(ne,"variables"),localDir:ke(process.cwd(),".testmuai","variables"),file:r.variablesFile,inline:r.variables});if("error"in o)return{text:o.error,missing:!0};let n=Object.entries(o.variables).map(([l,i])=>`${l.replace(/^(secrets\.user\.|global\.|environment\.)/,"")} \u2713${i.secret?" secret":""}`);return{text:n.length?n.join(" "):"none used",missing:!1}}catch(t){return{text:`variables: ${t.message}`,missing:!0}}}var j=[{key:"launch",label:"Launch"},{key:"back",label:"Back to setup"},{key:"cancel",label:"Cancel"}];function Ae({seed:e,done:r,variables:t,fromCard:o}){let[n,l]=(0,h.useState)(()=>xe(e)),[i,a]=(0,h.useState)(()=>typeof e.opts.url=="string"&&e.opts.url.trim()?"review":"setup"),[w,f]=(0,h.useState)(!1),[S,D]=(0,h.useState)(!1),[N,E]=(0,h.useState)(0),[z,J]=(0,h.useState)(null),Q=n.values.prompt,K=(0,h.useMemo)(()=>(t??(d=>Ce(d,e.opts)))(Q),[Q,t,e.opts]),W=Re(n,K);A((d,s)=>{if(i==="review"){if(s.upArrow)E(v=>(v+j.length-1)%j.length);else if(s.downArrow)E(v=>(v+1)%j.length);else if(s.escape)a("setup");else if(s.return){let v=j[N].key;if(v==="launch"){let C=Pe(n,e.opts);D(!0),setTimeout(()=>r({kind:"launch",opts:C}),0)}else v==="back"?a("setup"):r({kind:"discard"})}return}if(n.editing){s.return?l(Se(n)):s.escape?l(ve(n)):s.backspace||s.delete?l(q(n,n.editing.text.slice(0,-1))):d&&!s.ctrl&&!s.meta&&!s.tab&&l(q(n,n.editing.text+d));return}if(w){d==="y"||d==="Y"?r({kind:"discard"}):(d==="n"||d==="N"||s.return||s.escape)&&f(!1);return}J(null),s.upArrow?l(G(n,-1)):s.downArrow?l(G(n,1)):s.leftArrow?l(U(n,-1)):s.rightArrow||d===" "?l(U(n,1)):s.return?l(we(n)):s.tab?W?J(W):(E(0),a("review")):s.escape&&(o?r({kind:"back"}):f(!0))});let X=typeof e.opts.project=="string"&&e.opts.project?e.opts.project:"",Z=e.projectName||(X?X.slice(0,8):"the configured project");if(S)return(0,c.jsx)(u,{children:""});let ee=d=>(0,c.jsx)(ae,{status:{kind:"waiting",label:i==="review"?"review":"set up the run"},meta:{verb:"explore",sid:"",env:String(e.opts.env??"prod"),subject:n.values.url?n.values.url.replace(/^https?:\/\//,"").split("/")[0]:"new run"},tallies:{items:[`project ${Z}`]},keys:d,accent:m.orange,remote:!0});if(i==="review"){let d=[{label:"project",text:Z,from:e.projectFrom??(e.opts.project?"flag":"config")},...Le(n,K)],s=n.values.runsOn==="this machine"?"on this machine":"on HyperExecute",v=Math.max(60,(process.stderr.columns||100)-2),C=se(["setting","value","from"],d.map(b=>[b.label,b.text,b.from]),v,1);return(0,c.jsxs)(g,{flexDirection:"column",marginTop:1,children:[(0,c.jsx)(u,{bold:!0,color:m.orange,children:"Review"}),C.map((b,re)=>(0,c.jsx)(u,{bold:re===1,children:b},re)),(0,c.jsx)(le,{headline:"Launch?",ask:!0,rows:j.map(b=>b.key==="launch"?{...b,label:`Launch ${s}`}:b),sel:N,focused:!0,accent:m.orange}),ee(["\u2191\u2193 select","\u23CE confirm","esc setup","ctrl+c exit"])]})}let te=k(n);return(0,c.jsxs)(g,{flexDirection:"column",children:[(0,c.jsx)(de,{title:"New run",sub:"flags you passed are filled in; \u23CE edits a row",fields:ye(n,K),sel:n.sel}),(0,c.jsxs)(g,{marginTop:1,flexDirection:"column",children:[z?(0,c.jsx)(u,{color:m.amber,children:`launch refused: ${z}`}):null,w?(0,c.jsx)(u,{color:m.amber,children:"Discard this setup? (y/N)"}):null]}),ee(n.editing?["type","\u23CE keep","esc undo"]:["\u2191\u2193 select",["runsOn","policy","context","recheck","more","advanced","maxLeases","maxParallel","browser","headless","tunnel"].includes(te)?"\u2190 \u2192 change":te==="url"&&n.urlLocked?"url locked":"\u23CE edit","tab review",o?"esc card":"esc discard","ctrl+c exit"])]})}async function je(e,r=!1){return await I(t=>(0,c.jsx)(Ae,{seed:e,fromCard:r,done:t}))}function Ne(e){let r=t=>{process.stderr.write(t+`
|
|
3
3
|
`)};return r(""),r("session summary \u2014 exited (ctrl+c)"),r(" nothing launched; the setup was not kept"),r(` back: kane-cli explore run${typeof e.project=="string"?` --project ${e.project}`:""}${typeof e.url=="string"?` --url ${e.url}`:""}`),r(""),130}async function lt(e,r,t){let o=await je({url:r??null,opts:e,projectName:t??null});return o?o.kind==="launch"?{opts:o.opts}:(process.stderr.write(`setup discarded; nothing launched
|
|
4
4
|
`),{code:0}):{code:Ne(e)}}async function at(e){let r={...e.opts,...e.projectId?{project:e.projectId}:{}},t=await je({url:e.url??null,opts:r,projectName:e.projectName??null,...e.projectId?{projectFrom:e.explorationId?"the exploration":"you"}:{}},!!e.back);if(!t)return Ne(r);if(t.kind==="back")return e.back?e.back():0;if(t.kind==="discard")return process.stderr.write(`setup discarded; nothing launched
|
|
5
|
-
`),0;let o=t.opts,n=o.localOrchestration&&e.explorationId?{...o,explorationId:e.explorationId}:o,{runExploreAction:l}=await import("./explore-
|
|
5
|
+
`),0;let o=t.opts,n=o.localOrchestration&&e.explorationId?{...o,explorationId:e.explorationId}:o,{runExploreAction:l}=await import("./explore-SA2P3SGX.js");return await l(n,{stdin:!0,stdout:!0},{setup:async()=>n})}function Ie({host:e,project:r,done:t}){return A((o,n)=>{o==="y"||o==="Y"?t(!0):(o==="n"||o==="N"||n.return||n.escape)&&t(!1)}),(0,c.jsxs)(g,{flexDirection:"column",marginTop:1,children:[(0,c.jsx)(u,{color:m.amber,children:`The explorer may click, submit and delete on ${e}: it can change this app's data.`}),(0,c.jsx)(u,{children:r?`Allow mutating runs on project ${r}? Asked once per project. (y/N)`:"Allow this mutating run? (y/N)"})]})}async function st(e){let r=e.projectName||(e.projectId?e.projectId.slice(0,8):null);return await I(t=>(0,c.jsx)(Ie,{host:e.host,project:r,done:t}))}export{Ie as MutatingConfirm,Ae as RunSetup,st as confirmMutatingRun,at as runExploreSetupFlow,Ne as setupInterrupted,je as setupRun,lt as setupRunOpts,Ce as variablesSummary};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as C}from"./chunk-6SD4XTYC.js";import{b}from"./chunk-BY65QAAN.js";import{R as V,S as B,T as H,U as F,V as O}from"./chunk-
|
|
2
|
+
import{b as C}from"./chunk-6SD4XTYC.js";import{b}from"./chunk-BY65QAAN.js";import{R as V,S as B,T as H,U as F,V as O}from"./chunk-OZNYQONA.js";import"./chunk-7Y55CO42.js";import"./chunk-YILRYMMG.js";import"./chunk-BSRSXYDZ.js";import"./chunk-CB4ARIHR.js";import{a as S}from"./chunk-HVOXMCKE.js";import"./chunk-WMGKUERB.js";import"./chunk-UWPG5MWM.js";import{a as h}from"./chunk-73Y6T2UK.js";import{d as A}from"./chunk-XMPTFXPW.js";import"./chunk-SMXABALN.js";import"./chunk-WN5VKKJ3.js";import{g as Y}from"./chunk-47WQBG5I.js";import{a as q}from"./chunk-KM3YCIDV.js";import{i as $}from"./chunk-X52YIWGG.js";import"./chunk-R6TFRAMZ.js";import"./chunk-WEJR2V7R.js";import"./chunk-5F5IVART.js";import"./chunk-IZ66FKPC.js";import"./chunk-GLM5UGTF.js";import"./chunk-VZJ6LUXX.js";import"./chunk-DXIQVBMI.js";import"./chunk-MUX2A37P.js";import"./chunk-W5HFUBXD.js";import{a as N}from"./chunk-35BG2EMW.js";import"./chunk-63EKRZKI.js";import"./chunk-3JLEDSG5.js";import"./chunk-T77LTLAD.js";import"./chunk-73ZFOJOK.js";import"./chunk-EZMRWXRT.js";import"./chunk-3KY7HHQU.js";import"./chunk-Z55KBMYV.js";import"./chunk-LD5B3QFW.js";import"./chunk-32HED7X2.js";import{a as U}from"./chunk-YNDELIXL.js";import"./chunk-ZHAMVLQZ.js";import"./chunk-SIHX5FW5.js";import"./chunk-X7S7IGCV.js";import"./chunk-2RUSXQ3O.js";import{f as G}from"./chunk-CB344EDO.js";import"./chunk-FNUGDPTS.js";import"./chunk-ZDCXWEQG.js";import"./chunk-L3BUPFAQ.js";import{c as M}from"./chunk-GBQ4K25P.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-Z24SD2EJ.js";import"./chunk-AQ2OG2EF.js";import"./chunk-23DKB2MT.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-GJXO6FF7.js";import"./chunk-LLQWEGXD.js";import"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import"./chunk-CQDCNP7V.js";import"./chunk-TD6GCEIK.js";import"./chunk-7V34ZMMS.js";import"./chunk-B7ZX5HEN.js";import{b as P}from"./chunk-EBJW6POT.js";import"./chunk-PVN64537.js";import"./chunk-22PIMG52.js";import"./chunk-4C7WVQOD.js";import{d as j,f as T}from"./chunk-7YV2FCN4.js";import"./chunk-QSCXXNC2.js";import"./chunk-6PIIUAZF.js";import"./chunk-PI7OXS62.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-7V4BQSSV.js";import"./chunk-ZAQGIC33.js";import"./chunk-VO66KP2W.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-HYJVYYAZ.js";import"./chunk-VZ7KXRXB.js";import"./chunk-GMTHZUZ3.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import"./chunk-ZCBOHWN3.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A7RJQJNT.js";import"./chunk-TM45NPWL.js";import"./chunk-HCBYKLMW.js";import"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import"./chunk-6YGTRKDT.js";import"./chunk-J4FIESTB.js";import"./chunk-UR6MHSHU.js";import{existsSync as z}from"fs";async function ee(e){let[{render:n},a,{QuestionBatchPrompt:s}]=await Promise.all([import("./build-5ZN47FAT.js"),import("./react-QWOAB3TB.js"),import("./ui-SNV3FD2G.js")]),l=a.default??a;return new Promise(m=>{let f=n(l.createElement(s,{questions:e,onSubmit:t=>{f.unmount(),m(t)}}))})}async function te(e,n){let[{render:a},s,{ReviewChecklist:l}]=await Promise.all([import("./build-5ZN47FAT.js"),import("./react-QWOAB3TB.js"),import("./ui-SNV3FD2G.js")]),m=s.default??s;return new Promise(f=>{let t=a(m.createElement(l,{items:e.map(c=>{let o=n.get(c.temp_ref);return{uc:c,dedupWith:o&&!o.archived?o.cid:void 0,archivedMatch:o?.archived?{cid:o.cid,reason:o.reason}:void 0}}),onSubmit:c=>{t.unmount(),f(c)}}))})}async function re(e){let{createInterface:n}=await import("readline/promises"),a=n({input:process.stdin,output:process.stdout});try{let s=await a.question(`${e} [y/N] `);return/^y(es)?$/i.test(s.trim())}finally{a.close()}}async function ye(e){let n=h(process.cwd()),a=S(n),s=T({verb:"extract",mode:e.plan?"cli":"interactive",contextRoot:n,env:j(),resumeSid:e.resume,write:!0,longSession:!0});await V(n,d=>process.stderr.write(d+`
|
|
3
3
|
`));{let d=z(n)?F(n):null;if(d)return process.stderr.write(`error: ${d.text}
|
|
4
4
|
next: ${d.remedy}
|
|
5
5
|
`),await s.end({exit_code:2}),2}let m={...await G(P),...s.spawnEnv()},f=await M(m);if(!f.ok)return process.stderr.write((f.message??"error: turn-endpoint preflight failed")+`
|
|
@@ -7,8 +7,8 @@ next: ${d.remedy}
|
|
|
7
7
|
`),s.error("preflight_auth"),await s.end({exit_code:2}),2;let t=async()=>f;if(e.plan){let d=await $(e,{store:a,pendingReconcilePlan:p=>Y(n,p),agent:C,tracePath:U,credentials:P,onIngestRefusal:q,preflightTurn:t,ask:ee,review:te,confirmStale:re,out:p=>process.stdout.write(p+`
|
|
8
8
|
`),progress:p=>process.stderr.write(p+`
|
|
9
9
|
`),isTTY:A(),auth:m,telemetry:s});return d===1&&process.stderr.write(s.supportFooter()+`
|
|
10
|
-
`),await s.end({exit_code:d}),d}let[{render:c},o,{ScrollbackProvider:g},{ChatSurface:y},{ScrollbackTap:w},{setInkExit:k},{buildExtractChat:x}]=await Promise.all([import("./build-5ZN47FAT.js"),import("./react-QWOAB3TB.js"),import("./scrollback-GGNBDFQV.js"),import("./ChatSurface-
|
|
10
|
+
`),await s.end({exit_code:d}),d}let[{render:c},o,{ScrollbackProvider:g},{ChatSurface:y},{ScrollbackTap:w},{setInkExit:k},{buildExtractChat:x}]=await Promise.all([import("./build-5ZN47FAT.js"),import("./react-QWOAB3TB.js"),import("./scrollback-GGNBDFQV.js"),import("./ChatSurface-Z26BOE5U.js"),import("./ScrollbackTap-4SPXGFMU.js"),import("./exit-manager-EGWAZHCR.js"),import("./extract-chat-Z64LEAJ5.js")]),r=o.default??o,{controller:i,chain:u,inspect:W,reconcile:J,runDeps:K}=await x({site:N(n,a),store:a,credentials:P,agent:C,auth:m,preflight:t,...e.changeContext?{changeContext:e.changeContext}:{}}),I={current:null},v=null,D=0,R=null,E=!1,L=()=>{if(D+=1,D>=2){try{_.unmount()}catch{}b({state:"interrupted",reason:"ctrl+c \xD72",facts:["forced quit \u2014 anything already committed is safe in the store"]}),process.exit(130)}i.requestPause(),R=setTimeout(()=>{E||(E=!0,(async()=>{i.finalizeForExit(),await I.current?.flush();try{_.unmount()}catch{}b({state:"interrupted",facts:["the agent did not confirm the pause within 5s \u2014 nothing new was saved"]}),process.exit(130)})())},5e3)},X={verb:"extract",sid:e.resume??s.ids.session_id,env:j(),...e.source?{subject:e.source}:{}},_=c(r.createElement(g,null,r.createElement(w,{into:I}),r.createElement(y,{controller:i,verb:"extract",onCtrlC:L,chain:u,inspect:W,reconcile:J,meta:X})),{exitOnCtrlC:!1});k(()=>_.unmount());let Q=null;try{let d=$(e,K({isTTY:A(),onSummary:Z=>{v=Z},telemetry:s}));d.finally(()=>{E=!0});let p=await d;return Q=p,p===1&&process.stderr.write(s.supportFooter()+`
|
|
11
11
|
`),await s.end({exit_code:p}),p}catch(d){throw v||(v={state:"crashed",facts:[`the session ended unexpectedly \u2014 ${d instanceof Error?d.name:"error"}`]}),d}finally{E=!0,R&&clearTimeout(R),i.finalizeForExit(),await I.current?.flush();try{_.unmount()}catch{}v?b(v):Q===1&&b({state:"interrupted",facts:["the session ended without saving \u2014 see the error above"]})}}async function ve(e){let n=T({verb:"extract",mode:e.mode,contextRoot:h(process.cwd()),env:j(),resumeSid:e.resume,write:!0,longSession:!0}),{makeHeadlessIO:a,resolveEncoding:s,guardedChannels:l}=await import("./headless-io-FFM5T6KL.js"),{withStructuredNext:m,prepareStructuredResume:f}=await import("./structured-answers-EQ2AP3F7.js"),t=m(a(s(e.mode,e.json===!0),"extract")),c=await B(h(process.cwd()));c&&(s(e.mode,e.json===!0)==="ndjson"?t.event(H(c)):t.progress(c.text));for(let r of e.landed??[]){let i=r;t.event({type:"ingested",source_id:r.source_id,status:r.status,cid:r.source_cid,...i.warnings?.length?{warnings:i.warnings}:{},...i.media?{media:i.media}:{},...i.duplicate_of?{duplicate_of:i.duplicate_of}:{},...i.lineage_candidate?{lineage_candidate:i.lineage_candidate}:{}})}{let r=z(h(process.cwd()))?F(h(process.cwd())):null;if(r)return s(e.mode,e.json===!0)==="ndjson"?t.event(O(r)):t.progress(`error: ${r.text}
|
|
12
12
|
next: ${r.remedy}`),await n.end({exit_code:2}),t.done(2,"refused")}let o;try{o=f({opts:e,reader:S(h(process.cwd())).sessions(),verb:"extract"})}catch(r){let i=r instanceof Error?r.message:String(r);return t.out(`error: ${i}`),e.mode==="agent"&&t.event({type:"error",message:i}),await n.end({exit_code:1}),e.mode==="agent"?t.done(1,"error"):1}if(o.kind==="refuse")return t.out(o.error),e.mode==="agent"&&t.event({type:"error",message:o.error,code:o.code}),await n.end({exit_code:2}),e.mode==="agent"?t.done(2,"refused"):2;let g=e;if(o.kind==="apply"){for(let r of o.notes)t.out(r);if(o.matchedQids.length>0){t.out(`applying ${o.matchedQids.length} structured answer(s) from --answer to the paused session's pending questions`);for(let r of o.matchedQids)t.event({type:"panel_resolved",id:r,by:"user",via:"flag"})}o.statement&&(g={...e,message:[e.message,o.statement].filter(Boolean).join(`
|
|
13
13
|
|
|
14
|
-
`)})}let{makeInterruptGuard:y}=await import("./interrupt-guard-QETBPINI.js"),w=y(C,r=>t.out(r)),x=l(t,()=>w.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let{headlessExtract:r}=await import("./extract-headless-
|
|
14
|
+
`)})}let{makeInterruptGuard:y}=await import("./interrupt-guard-QETBPINI.js"),w=y(C,r=>t.out(r)),x=l(t,()=>w.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let{headlessExtract:r}=await import("./extract-headless-XLS56LMN.js"),i=h(process.cwd()),u=await r(g,N(i,S(i)),{emit:x.emit,out:x.out,progress:t.progress,channel:s(e.mode,e.json===!0)==="ndjson"},{agent:w.agent,telemetry:n});return w.interrupted()&&u!==3?(t.out("interrupted \u2014 no session saved"),await n.end({exit_code:130}),t.done(130)):(u===1&&t.out(n.supportFooter()),await n.end({exit_code:u}),t.done(u))}catch(r){return t.event({type:"error",message:`error: extract failed: ${r instanceof Error?r.message:String(r)}`}),t.out(`error: extract failed: ${r instanceof Error?r.message:String(r)}`),t.out('hint: the full trace is in the file named on the "trace:" line at the start of this run'),t.done(1)}finally{w.dispose()}}async function be(e,n,a="agent"){let[{makeHeadlessIO:s,agentRefusal:l,UsageRefused:m,resolveEncoding:f},{withStructuredNext:t}]=await Promise.all([import("./headless-io-FFM5T6KL.js"),import("./structured-answers-EQ2AP3F7.js")]),c=t(s(f(a,e.json===!0),"extract"),{atQuestionsOnly:!0});n.onboarded&&c.event({type:"folder_linked",project_id:n.projectId,project:n.projectName});let{answerGate:o}=await import("./gate-AK44VDHC.js"),g=o({...e,mode:a},"context extract");if(g!==null)return l(c,g.message,g.code,g.remedy);let{latticeBasicAuth:y}=await import("./lattice-auth-UQPFQSG7.js"),w;try{w=await y()}catch(u){if(u instanceof m)return l(c,u.message,u.code,u.remedy);throw u}let{runRemote:k,controllerCheck:x}=await import("./run-remote-SFR3F2T5.js"),{rememberUser:r}=await import("./store-choice-27HDIFTU.js"),i=await k({verb:"extract",mode:"agent",choice:n,basicAuth:w,start:e.resume?{kind:"resume",sessionId:e.resume}:{kind:"new",body:{projectId:n.projectId,verb:"extract",mode:"agent",...e.source?{sourceId:e.source}:{}}},run:{...e.source!==void 0?{source:e.source}:{},...e.message!==void 0?{message:e.message}:{},...e.force!==void 0?{force:e.force}:{},...e.trust!==void 0?{trust:e.trust}:{},...e.answer?.length?{answer:e.answer}:{},...a==="override"?{override:!0}:{}},io:c,check:x,onProgress:()=>{},onOpened:u=>r(process.cwd(),u.userId),signals:!0});return c.done(i)}async function ke(e,n){let{answerGate:a,printPair:s}=await import("./gate-AK44VDHC.js"),l=a(e,"context extract");if(l!==null)return s(l),2;let{runInteractiveRemote:m}=await import("./interactive-remote-7ZSTI66T.js");return m({verb:"extract",choice:n,start:e.resume?{kind:"resume",sessionId:e.resume}:{kind:"new",body:{projectId:n.projectId,verb:"extract",mode:"interactive",...e.source?{sourceId:e.source}:{}}},run:{...e.source!==void 0?{source:e.source}:{},...e.message!==void 0?{message:e.message}:{},...e.force!==void 0?{force:e.force}:{},...e.trust!==void 0?{trust:e.trust}:{}},...e.source?{subject:e.source}:{}})}export{ve as bindExtractHeadless,ye as bindExtractInteractive,be as bindExtractRemote,ke as bindExtractRemoteInteractive};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as f}from"./chunk-47WQBG5I.js";import{a as d}from"./chunk-KM3YCIDV.js";import{g}from"./chunk-X52YIWGG.js";import"./chunk-R6TFRAMZ.js";import"./chunk-WEJR2V7R.js";import"./chunk-5F5IVART.js";import"./chunk-IZ66FKPC.js";import"./chunk-GLM5UGTF.js";import"./chunk-VZJ6LUXX.js";import"./chunk-DXIQVBMI.js";import"./chunk-MUX2A37P.js";import"./chunk-W5HFUBXD.js";import{i as x}from"./chunk-LTPOMMAB.js";import"./chunk-E4GIGM5V.js";import"./chunk-63EKRZKI.js";import"./chunk-3JLEDSG5.js";import"./chunk-T77LTLAD.js";import"./chunk-73ZFOJOK.js";import"./chunk-EZMRWXRT.js";import"./chunk-3KY7HHQU.js";import"./chunk-Z55KBMYV.js";import"./chunk-LD5B3QFW.js";import"./chunk-32HED7X2.js";import{a as h}from"./chunk-
|
|
2
|
+
import{g as f}from"./chunk-47WQBG5I.js";import{a as d}from"./chunk-KM3YCIDV.js";import{g}from"./chunk-X52YIWGG.js";import"./chunk-R6TFRAMZ.js";import"./chunk-WEJR2V7R.js";import"./chunk-5F5IVART.js";import"./chunk-IZ66FKPC.js";import"./chunk-GLM5UGTF.js";import"./chunk-VZJ6LUXX.js";import"./chunk-DXIQVBMI.js";import"./chunk-MUX2A37P.js";import"./chunk-W5HFUBXD.js";import{i as x}from"./chunk-LTPOMMAB.js";import"./chunk-E4GIGM5V.js";import"./chunk-63EKRZKI.js";import"./chunk-3JLEDSG5.js";import"./chunk-T77LTLAD.js";import"./chunk-73ZFOJOK.js";import"./chunk-EZMRWXRT.js";import"./chunk-3KY7HHQU.js";import"./chunk-Z55KBMYV.js";import"./chunk-LD5B3QFW.js";import"./chunk-32HED7X2.js";import{a as h}from"./chunk-YNDELIXL.js";import"./chunk-ZHAMVLQZ.js";import"./chunk-SIHX5FW5.js";import"./chunk-X7S7IGCV.js";import"./chunk-2RUSXQ3O.js";import"./chunk-CB344EDO.js";import"./chunk-FNUGDPTS.js";import"./chunk-ZDCXWEQG.js";import"./chunk-L3BUPFAQ.js";import"./chunk-GBQ4K25P.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-Z24SD2EJ.js";import"./chunk-AQ2OG2EF.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-LLQWEGXD.js";import"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import"./chunk-CQDCNP7V.js";import"./chunk-TD6GCEIK.js";import"./chunk-22PIMG52.js";import"./chunk-4C7WVQOD.js";import"./chunk-7YV2FCN4.js";import"./chunk-QSCXXNC2.js";import"./chunk-6PIIUAZF.js";import"./chunk-PI7OXS62.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-7V4BQSSV.js";import"./chunk-ZAQGIC33.js";import"./chunk-VO66KP2W.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-HYJVYYAZ.js";import"./chunk-GMTHZUZ3.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-J4FIESTB.js";import"./chunk-UR6MHSHU.js";async function M(e){let{site:i,store:c}=e,[{makeChatController:k},{commitChatTurn:C},{topologyDescriptor:y},{explain:D},b,{testDefinitionOf:w}]=await Promise.all([import("./chat-controller-FXRJXUG3.js"),import("./chat-committer-ZKEKJA2R.js"),import("./descriptor-7T32VRMB.js"),import("./explain-DGJ5T6V5.js"),import("./dossier-5XKNAK6Q.js"),import("./test-definition-53XNBEDE.js")]),s=k({commitChatTurn:t=>C({...t,store:c,definitionOf:w}),descriptor:y(),store:c,refreshGraph:()=>i.graph(),graph:i.graph(),explain:D,by:{kind:"human",id:"owner"},dedupFlags:t=>g(t,i.graph()),...e.onRender?{onRender:e.onRender}:{},...e.addedBefore?{addedBefore:e.addedBefore}:{},...e.resumedCheckIn?{resumedCheckIn:e.resumedCheckIn}:{}}),S=t=>{try{return b.buildDossier(i.graph(),t)}catch{return null}},T={listUcs:()=>{let t=i.graph(),r=new Set(s.state.turns.flatMap(a=>(a.items??[]).map(n=>n.title.toLowerCase()))),o={high:0,med:1,low:2};return t.byLabel("usecase").filter(a=>!t.superseded.has(a.cid)).map((a,n)=>{let l=a.content,p=String(l.title??a.cid.slice(0,12)),m=x(t,a.cid);return{key:a.cid,title:p,badge:m==="current"?"designed":m==="stale"?"designed \xB7 stale":r.has(p.toLowerCase())?"drafted this session":"existing",designed:m,risk:l.risk,i:n}}).sort((a,n)=>(o[a.risk??"zz"]??3)-(o[n.risk??"zz"]??3)||a.i-n.i).map(({key:a,title:n,badge:l,designed:p})=>({key:a,title:n,badge:l,designed:p}))},runDesignChild:async(t,r=!1,o="design")=>{let{launchDesignChild:a}=await import("./child-JHYENXE7.js");return a({ucRef:t,force:r,verb:o},s,{store:c,projectDir:process.cwd(),agent:e.agent,tracePath:h,credentials:e.credentials,onIngestRefusal:d,preflightTurn:e.preflight,auth:e.auth})}},{makeReconcileDeps:R}=await import("./reconcile-deps-UDQBWSLE.js"),{emitWalkSignal:E,walkSignal:P}=await import("./reconcile-cmd-7B7THAFJ.js"),u=null,j=R({credentials:e.credentials,onIngestRefusal:d,store:c,parentLock:()=>u,agent:e.agent,...e.reviewChildren?.auth?{auth:e.reviewChildren.auth}:{},...e.reviewChildren?.preflightTurn?{preflightTurn:e.reviewChildren.preflightTurn}:{},...e.changeContext?{changeContext:e.changeContext}:{},...e.probe?{probe:e.probe}:{},...e.matchUnreviewed?{matchUnreviewed:!0}:{},note:t=>s.note(t),emitWalkSignal:(t,r,o)=>i.dir===null?c.signals().append(P(t,r,o)):E(i.dir,t,r,o)});return{controller:s,chain:T,inspect:S,reconcile:j,runDeps:t=>({store:c,onExtractLock:r=>{u=r},pendingReconcilePlan:r=>i.dir===null?null:f(i.dir,r),agent:e.agent,tracePath:h,credentials:e.credentials,onIngestRefusal:d,preflightTurn:e.preflight,...e.probe?{probe:e.probe}:{},...e.matchUnreviewed?{matchUnreviewed:!0}:{},...t.onSummary?{onSummary:t.onSummary}:{},ask:r=>s.ask(r),review:async r=>new Map(r.map(o=>[o.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:r=>s.note(r),progress:()=>{},isTTY:t.isTTY,auth:e.auth,chat:s,...t.telemetry?{telemetry:t.telemetry}:{}})}}export{M as buildExtractChat};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import{a as c}from"./chunk-73Y6T2UK.js";import"./chunk-UR6MHSHU.js";import{existsSync as l}from"fs";async function f(e){if(e.mode!=null&&!["interactive","agent","ci","override"].includes(e.mode)){let{makeHeadlessIO:t,agentRefusal:r}=await import("./headless-io-FFM5T6KL.js");return r(t("ndjson","extract"),`extract: --mode must be interactive | agent | ci | override, got '${e.mode}'`,"MODE_USAGE")}{let{jsonModeRefusal:t}=await import("./headless-io-FFM5T6KL.js"),r=t("extract",e.mode,e.json);if(r!==null)return process.stderr.write(`${r}
|
|
3
3
|
`),2}let i=async(t,r)=>{if(e.mode!=="agent")return process.stderr.write(t+`
|
|
4
|
-
`),2;let{makeHeadlessIO:n,agentRefusal:s}=await import("./headless-io-FFM5T6KL.js");return s(n("ndjson","extract"),t,r)};if(e.apply)return i("extract: --apply is not implemented yet \u2014 coming with the plan\u2192apply workflow (run without --apply, or use --plan to preview)");{let{validateResumeMessage:t}=await import("./headless-io-FFM5T6KL.js"),r=t(e,"extract");if(r)return i(r)}{let{linkedAnswerRefused:t}=await import("./gate-
|
|
4
|
+
`),2;let{makeHeadlessIO:n,agentRefusal:s}=await import("./headless-io-FFM5T6KL.js");return s(n("ndjson","extract"),t,r)};if(e.apply)return i("extract: --apply is not implemented yet \u2014 coming with the plan\u2192apply workflow (run without --apply, or use --plan to preview)");{let{validateResumeMessage:t}=await import("./headless-io-FFM5T6KL.js"),r=t(e,"extract");if(r)return i(r)}{let{linkedAnswerRefused:t}=await import("./gate-AK44VDHC.js"),r=t(e,"context extract");if(r!==null)return r;let{gateStructuredFlags:n}=await import("./structured-answers-EQ2AP3F7.js"),s=n(e,"extract");if(s)return i(s,"STRUCTURED_FLAGS_USAGE")}if(e.withSource&&!e.resume)return i("extract: --with-source pairs with --resume \u2014 it lands the source and sets the resumed session's pending questions aside");if(e.queued)return i("extract: --queued is gone \u2014 extract sweeps every pending source by default (just run kane-cli context extract)");{let{remoteEntry:t}=await import("./remote-entry-BZU4NFNS.js"),{folderFlagsOf:r}=await import("./folder-flags-ZIDJVDKX.js"),n=await t("context extract",e.mode==="agent"||e.json===!0,e.resume,{onboard:e.mode!=="ci"&&e.mode!=="override",...r(e)});if(n!==null){if("exit"in n)return n.exit;let{remoteMode:s}=await import("./remote-mode-NXUKDUXG.js"),o=s("extract",e.mode,"context extract");if(typeof o=="object")return o.exit;if(o==="agent"||o==="override"){let{bindExtractRemote:m}=await import("./extract-bind-LZ22VFKB.js");return m(e,n.choice,o)}let{bindExtractRemoteInteractive:u}=await import("./extract-bind-LZ22VFKB.js");return u(e,n.choice)}}if(!l(c(process.cwd())))return i("error: no context store here (run `kane-cli context ingest <files>` first)","NO_STORE");if(!e.mode&&!process.stdin.isTTY)return process.stderr.write(`extract: no TTY \u2014 pass an explicit --mode agent|ci|override to run headless
|
|
5
5
|
`),2;let a=e.mode??"interactive";if(a==="interactive"){if(!process.stdin.isTTY||!process.stdout.isTTY)return process.stderr.write(`extract: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
6
|
-
`),2;let{bindExtractInteractive:t}=await import("./extract-bind-
|
|
6
|
+
`),2;let{bindExtractInteractive:t}=await import("./extract-bind-LZ22VFKB.js");return t(e)}let{bindExtractHeadless:d}=await import("./extract-bind-LZ22VFKB.js");return d({...e,mode:a})}export{f as extractCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-6QCCTZO3.js";import"./chunk-47WQBG5I.js";import"./chunk-KM3YCIDV.js";import"./chunk-X52YIWGG.js";import"./chunk-R6TFRAMZ.js";import"./chunk-WEJR2V7R.js";import"./chunk-5F5IVART.js";import"./chunk-IZ66FKPC.js";import"./chunk-GLM5UGTF.js";import"./chunk-VZJ6LUXX.js";import"./chunk-DXIQVBMI.js";import"./chunk-MUX2A37P.js";import"./chunk-W5HFUBXD.js";import"./chunk-63EKRZKI.js";import"./chunk-3JLEDSG5.js";import"./chunk-T77LTLAD.js";import"./chunk-73ZFOJOK.js";import"./chunk-EZMRWXRT.js";import"./chunk-3KY7HHQU.js";import"./chunk-Z55KBMYV.js";import"./chunk-LD5B3QFW.js";import"./chunk-32HED7X2.js";import"./chunk-YNDELIXL.js";import"./chunk-ZHAMVLQZ.js";import"./chunk-SIHX5FW5.js";import"./chunk-X7S7IGCV.js";import"./chunk-2RUSXQ3O.js";import"./chunk-CB344EDO.js";import"./chunk-FNUGDPTS.js";import"./chunk-ZDCXWEQG.js";import"./chunk-L3BUPFAQ.js";import"./chunk-GBQ4K25P.js";import"./chunk-PGESS7BW.js";import"./chunk-FWGUISUG.js";import"./chunk-Z24SD2EJ.js";import"./chunk-AQ2OG2EF.js";import"./chunk-VRIZDOO5.js";import"./chunk-ZHWU6L2G.js";import"./chunk-LLQWEGXD.js";import"./chunk-ZCIWQHCO.js";import"./chunk-XB6BJPDL.js";import"./chunk-CQDCNP7V.js";import"./chunk-TD6GCEIK.js";import"./chunk-EBJW6POT.js";import"./chunk-PVN64537.js";import"./chunk-22PIMG52.js";import"./chunk-4C7WVQOD.js";import"./chunk-7YV2FCN4.js";import"./chunk-QSCXXNC2.js";import"./chunk-6PIIUAZF.js";import"./chunk-PI7OXS62.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-7V4BQSSV.js";import"./chunk-ZAQGIC33.js";import"./chunk-VO66KP2W.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-HYJVYYAZ.js";import"./chunk-GMTHZUZ3.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import"./chunk-ZCBOHWN3.js";import"./chunk-RZ4F3BHX.js";import"./chunk-TM45NPWL.js";import"./chunk-J4FIESTB.js";import"./chunk-UR6MHSHU.js";export{a as headlessExtract};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-GQAWZEA4.js";import"./chunk-XMPTFXPW.js";import"./chunk-SB26HQO7.js";import"./chunk-3G2LSTK5.js";import"./chunk-WE7HRAGO.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-RQKMSNEU.js";import"./chunk-4C7WVQOD.js";import"./chunk-QXQ7KVEN.js";import"./chunk-Z47ZEFH7.js";import"./chunk-7YV2FCN4.js";import"./chunk-QSCXXNC2.js";import"./chunk-6PIIUAZF.js";import"./chunk-PI7OXS62.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-7V4BQSSV.js";import"./chunk-ZAQGIC33.js";import"./chunk-VO66KP2W.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-HYJVYYAZ.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import"./chunk-4QTH7VYE.js";import"./chunk-RZ4F3BHX.js";import"./chunk-J4FIESTB.js";import"./chunk-UR6MHSHU.js";export{a as decideFolderFlags,b as folderFlagsOf};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{N as j,O as we,Q as Re}from"./chunk-45NM23EQ.js";import"./chunk-6JUS2ULI.js";import"./chunk-HG2ILWCE.js";import"./chunk-BSRSXYDZ.js";import"./chunk-CB4ARIHR.js";import{a as W,h as D,i as H,k as z,l as ge,m as fe,n as F,o as J,p as q,q as me,r as he}from"./chunk-MEMXFTLD.js";import"./chunk-UWPG5MWM.js";import"./chunk-73Y6T2UK.js";import"./chunk-XMPTFXPW.js";import{f as se}from"./chunk-Z36KVIRR.js";import"./chunk-Q4JV4U65.js";import"./chunk-SMXABALN.js";import"./chunk-WN5VKKJ3.js";import{b as xe,c as _e}from"./chunk-23DKB2MT.js";import{c as be}from"./chunk-VRIZDOO5.js";import{a as ye}from"./chunk-ZHWU6L2G.js";import{a as U,b as de,c as N,d as pe}from"./chunk-FOLUB336.js";import{d as ve}from"./chunk-CQDCNP7V.js";import"./chunk-7V34ZMMS.js";import"./chunk-B7ZX5HEN.js";import"./chunk-6PIIUAZF.js";import{T as ae,U as le,vb as ue}from"./chunk-PI7OXS62.js";import{c as re,e as oe,g as ie,n as ce}from"./chunk-DBMW3VUN.js";import{f as $,g as G}from"./chunk-KU3YHPWZ.js";import"./chunk-7V4BQSSV.js";import"./chunk-ZAQGIC33.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-HYJVYYAZ.js";import"./chunk-VZ7KXRXB.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A7RJQJNT.js";import"./chunk-HCBYKLMW.js";import"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import"./chunk-6YGTRKDT.js";import"./chunk-FAMQ4DHU.js";import"./chunk-UR6MHSHU.js";function ke(e){let t=e.byLabel($.USECASE).filter(({cid:u})=>U(e,u)),n=new Map(t.map(({cid:u})=>[u,[]]));for(let{cid:u}of e.byLabel($.AC)){if(!U(e,u))continue;let d=N(e,u),c=d?n.get(d):void 0;c&&c.push({designed:de(e,u),stale:e.stale(u)!=="fresh"})}let s={},i=0,m=0,a=0,f=0,x=new Set;for(let{cid:u}of e.byLabel($.SCENARIO))if(U(e,u))for(let d of e.edgesFrom(u))d.type===G.BELONGS_TO&&x.add(e.tipOf(d.dst));for(let{cid:u}of t){let d=n.get(u);m+=d.length;let c=d.filter(p=>p.designed).length;i+=c;let v=d.filter(p=>p.stale).length,o=x.has(u);o||f++;let l=d.length===0||c===0?"undesigned":c===d.length&&v===0&&o?"complete":"partial";l==="complete"&&a++,s[e.displayNameOf(u)??u]={status:l,staleAcs:v}}return{acs_designed:`${i}/${m}`,usecases_complete:`${a}/${t.length}`,ucs_needing_scenarios:f,perUc:s,config:{criterion:"live_verifies_edge",freshness:"not_discounted"}}}var De={[$.USECASE]:"use case",[$.AC]:"criterion",[$.SCENARIO]:"scenario",[$.TEST]:"test"},X=e=>{let t=ye(e);return t===null?null:t.replace(/\|/g,"/")};function Ne(e,t){let n=e.tipOf(t);return U(e,n)?n:null}function $e(e,t,n){let s=[],i=[...e.heads.entries()].filter(u=>typeof u[1]=="string").sort(([u],[d])=>u<d?-1:u>d?1:0),m=null,a=u=>{if(m===null){m=new Map;for(let{cid:d}of e.byLabel($.AC)){if(!U(e,d))continue;let c=N(e,d);c!==null&&m.set(c,[...m.get(c)??[],d])}}return m.get(u)??[]},f=(u,d)=>{if(d===$.USECASE)return a(u);if(d===$.AC)return[u];let c=d===$.SCENARIO?G.EXERCISES:d===$.TEST?G.VERIFIES:null;return c===null?[]:e.edgesFrom(u).filter(o=>o.type===c).map(o=>Ne(e,o.dst)).filter(o=>o!==null&&e.nodeLabel.get(o)===$.AC)},x=[];for(let u of[$.USECASE,$.AC,$.SCENARIO,$.TEST])for(let{cid:d}of e.byLabel(u)){if(!U(e,d))continue;let c=new Map;for(let v of e.derivesInto(d)){let o=v.props.source_id;typeof o=="string"&&c.set(o,[...c.get(o)??[],v])}c.size>0&&x.push({cid:d,label:u,name:e.displayNameOf(d)??d,bySource:c})}x.sort((u,d)=>u.name<d.name?-1:u.name>d.name?1:0);for(let[u,d]of i){let c=e.mediaOf(d)?.plugin;if(c===void 0||typeof c.index!="string")continue;let v=ce(t(c.index));if(v===null)continue;let o=v.units.filter(_=>_.id!==re),l=o.map(_=>_.id),p=be(t,c,l),g=p===null?l:p.expected,b=new Map((p?.groups??[]).flatMap(_=>_.units.map(S=>[S,_.name]))),h=oe(d,_=>e.mediaOf(_)?.plugin),y=new Map;for(let _ of x){let S=_.bySource.get(u);if(S===void 0)continue;let M=new Set(S.flatMap(T=>Array.isArray(T.props.units)?T.props.units:[]));if(M.size===0)continue;let I=new Set(h===null?M:ie(S,h).failing);for(let T of M)y.set(T,[...y.get(T)??[],{item:_,fresh:!I.has(T)}])}let w=e.extractionCompleteness.get(u),E=w?.source_cid===d&&(w.completeness==="complete"||w.completeness==="partial")?w.completeness:"none",C=new Map(o.map(_=>[_.id,_.label])),r=g.map(_=>{let S=y.get(_)??[],M=[...new Set(S.flatMap(({item:k})=>f(k.cid,k.label)))],I=M.filter(k=>J(e,k).length>0),T=k=>n?.perAc[e.nameOf.get(k)??k]?.state??"not_run",O=I.filter(k=>T(k)==="proven"||T(k)==="failing").length,B=I.filter(k=>T(k)==="proven").length;return{unit:_,cited:S.map(({item:k,fresh:Y})=>({item:k.name,kind:De[k.label],fresh:Y})),criteria:M.length,designed:I.length,run:O,passed:B,gap:S.length===0?"uncited":I.length===0?"untested":null,forPeople:{label:X(C.get(_)),group:X(b.get(_))}}}),R=(p?.groups??[]).map(_=>X(_.name)).filter(_=>_!==null);s.push({sourceId:u,plugin:c.id,units:l.length,plan:p===null?"every":"plugin",expected:g.length,extraction:E,rows:r,forPeople:{groups:R}})}return s}function Q(e){let t=e.flatMap(n=>n.rows);return{expected:t.length,tested:t.filter(n=>n.designed>0).length,proven:t.filter(n=>n.designed>0&&n.passed===n.designed).length}}var We=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],je={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},P={high:0,med:1,low:2};function A(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function Le(e,t=5){let n=e.trim().split(/\s+/);return n.slice(0,t).join(" ")+(n.length>t?"\u2026":"")}function Pe(e,t){let n=e.resolve(t),s=n?e.getNode(e.tipOf(n.cid))?.content:null;return String(s?.title??s?.text??"")}function Ce(e,t){let n=e.resolve(t);return{id:n?e.displayNameOf(e.tipOf(n.cid))??e.displayNameOf(n.cid):null,title:Le(Pe(e,t),8)}}function Fe(e,t){let n=e.resolve(t);if(!n)return null;let s=e.tipOf(n.cid);if(!U(e,s))return null;let i=e.nodeLabel.get(s);if(i===$.USECASE)return s;if(i===$.AC)return N(e,s);if(i===$.TEST){let m=e.edgesFrom(s).find(f=>f.type===G.VERIFIES&&U(e,f.dst));if(m)return N(e,m.dst);let a=e.edgesFrom(s).find(f=>f.type===G.AUTOMATES&&U(e,f.dst));if(a){let f=e.edgesFrom(a.dst).find(x=>x.type===G.BELONGS_TO&&U(e,x.dst));return f?f.dst:null}}return null}function Z(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function Be(e,t){let n=e.resolve(t),s=n?e.getNode(e.tipOf(n.cid))?.content.risk:null;return s==="high"||s==="med"||s==="low"?s:"med"}function te(e,t,n){let s=new Map;for(let[i,m]of Object.entries(t.perAc)){if(m.state!=="failing"&&m.state!=="not_run")continue;let a=e.resolve(i);if(!a)continue;let f=e.tipOf(a.cid),x=J(e,f);if(m.state==="failing"){let d=c=>q(e,n,f,[c]).some(v=>v.executionId===m.deciding_run&&v.verdict==="failed");s.set(i,{state:"failing",...m.deciding_run?{executionId:m.deciding_run}:{},viaTests:x.filter(d).map(c=>F(e,c))});continue}let u=me(q(e,n,f,x));s.set(i,u?{state:"blocked",executionId:u.executionId,viaTests:[]}:{state:"not_run",viaTests:[]})}return s}function Oe(e,t,n,s,i){let m=i.servePaths??new Map,a=i.work??te(e,s,z(e)),f=s.note!=="nothing_run_yet"||[...a.values()].some(o=>o.state==="blocked"),x=new Map(ge(e).inScope.map(o=>[F(e,o),o])),u=new Map([...x.values()].map(o=>[o,[]])),d=[];for(let o of t){if(o.stage!=="design")continue;let l={...o,...Ce(e,o.ref)},p=Fe(e,o.ref),g=p?u.get(p):void 0;g&&Z(o)!=="other"?g.push(l):d.push(l)}let c=new Map;for(let o of Object.values(s.perAc))o.state!=="not_designed"&&c.set(o.uc,(c.get(o.uc)??0)+1);for(let[o,l]of a){let p=u.get(x.get(s.perAc[o].uc)??"");if(!p)continue;let{id:g,title:b}=Ce(e,o),h={ref:o,id:g,title:b,risk:Be(e,o),stage:"cover"},y=l.executionId!==void 0?m.get(l.executionId):void 0,w={ready_command:y!==void 0?`kane-cli evidence serve ${y}`:"kane-cli testrun run",...l.executionId!==void 0?{execution_id:l.executionId}:{},...y!==void 0?{servePath:y}:{}};l.state==="failing"?p.push({...h,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",...w,via_tests:l.viaTests,...i.testFiles?{viaFiles:l.viaTests.map(E=>i.testFiles.get(E)??null)}:{}}):l.state==="blocked"?p.push({...h,kind:"execution-blocked",tag:"reuse-candidate",why:"its test ran, but every run broke or was skipped, so none counts",...w}):f&&p.push({...h,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let v=[];for(let o of s.perUc){let l=x.get(o.id);if(l===void 0)continue;let p=n.perUc[o.id]??{status:"undesigned",staleAcs:0},g=u.get(l)??[],b=new Set(g.filter(y=>Z(y)==="needs-refresh").map(y=>y.ref)),h=[];for(let y of We){let w=g.filter(C=>Z(C)===y);if(y==="needs-tests"&&(w=w.filter(C=>!b.has(C.ref))),w.length===0)continue;w.sort((C,r)=>(P[C.risk]??3)-(P[r.risk]??3)||W(C.ref,r.ref));let E=y==="failing"||y==="blocked"||w.length<=2||new Set(w.map(C=>C.ready_command)).size>1;h.push({key:y,label:je[y],...y==="needs-refresh"?{suffix:"source moved since these were designed"}:{},rows:w,...E?{}:{rosterCommand:w[0].ready_command}})}v.push({slug:o.id,title:o.title,risk:o.risk,cov:o,designed:c.get(o.id)??0,des:p,groups:h})}return v.sort((o,l)=>(P[o.risk]??3)-(P[l.risk]??3)||W(o.slug,l.slug)),d.sort((o,l)=>(P[o.risk]??3)-(P[l.risk]??3)||W(o.ref,l.ref)),{stage:i.stage,top:i.top,dc:n,coverage:s,ran:f,ucs:v,other:d,...i.units&&i.units.length>0?{units:i.units}:{}}}function ee(e,t){return e==="all"||t.stage===e}function L(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}var Ye={failing:"failing",blocked:"blocked","needs-refresh":"stale","needs-tests":"needs test","needs-scenarios":"no scenario","happy-only":"happy only","possible-duplicate":"duplicate?","not-yet-run":"to run"},ze=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate"];function Je(e,t,n){return(t.get("failing")??[]).length?0:(t.get("blocked")??[]).length?1:(t.get("needs-tests")??[]).length||(t.get("needs-scenarios")??[]).length?2:(t.get("needs-refresh")??[]).length?3:(t.get("not-yet-run")??[]).length>0||n&&e.cov.state==="not_run"?4:5}function Ue(e,t){let n=new Map;for(let c of t.groups)c.rows.length&&n.set(c.key,c.rows);let s=new Map;for(let c of t.groups){let v=c.rows.filter(o=>ee(e.stage,o));v.length&&s.set(c.key,v)}let i=[],m=[],a=[],f=new Set;for(let c of ze){let v=s.get(c);if(v){for(let o of v){let l=c==="failing"&&o.via_tests?.length?` \xB7 via ${o.via_tests.map(p=>A(p)).join(", ")}`:"";i.push({id:o.ref===t.slug?"\u2014":A(o.id??o.ref),cls:Ye[c],risk:o.ref===t.slug?"\u2014":o.risk,title:(o.ref===t.slug?o.why:o.title)+l})}if(c==="failing"||c==="blocked")for(let o of v)o.servePath&&f.add(`kane-cli evidence serve ${o.servePath}`);for(let o of v)o.ready_command&&!o.ready_command.startsWith("kane-cli evidence serve")&&o.ready_command!=="kane-cli testrun run"&&f.add(o.ready_command)}}let x=[...f].sort((c,v)=>Number(v.startsWith("kane-cli evidence serve"))-Number(c.startsWith("kane-cli evidence serve")));m.push(...x.map(c=>`\u21B3 ${c}`));let u=n.get("not-yet-run")??[],d=e.ran?u.length:t.designed;return e.ran&&d>0&&a.push(`${d} to run`),{uc:t,rows:i,spans:m,tails:a,toRun:d,severity:Je(t,n,e.ran)}}var Ke=e=>`${e} use-case${e===1?"":"s"}`,Ee=e=>`${e} ${e===1?"criterion":"criteria"}`;function Ve(e,t){let n=t!==void 0?`"${t}"'s`:"this folder's",s=e.note==="nothing_run_yet"?" \xB7 nothing run yet":"";return`coverage: ${Math.round(e.pct)}% across ${n} ${Ke(e.usecases.total)}${s} \xB7 ${H(e)} of ${e.usecases.total} designed`}var He={proven:"\x1B[32m",partial:"\x1B[33m",not_run:"\x1B[33m",failing:"\x1B[31m",not_designed:"\x1B[31m",no_criteria:"\x1B[2m"};function Se(e){return`${Math.round(e.pct)}% ${D[e.state]}`}function Ae(e,t){let{dc:n,coverage:s}=e,i=Math.max(80,Math.min(t.width,100)),m=r=>t.color?`\x1B[2m${r}\x1B[22m`:r,a=[Ve(s,t.project)],f=e.units??[];if(f.length>0){let r=Q(f);a.push(`units ${r.tested}/${r.expected} expected units have a test \xB7 ${r.proven} proven`)}a.push("");let x=e.ucs.map(r=>Ue(e,r));x.sort((r,R)=>r.severity-R.severity||W(r.uc.slug,R.uc.slug));let u=x.some(r=>r.rows.length||r.spans.length||r.tails.length||e.ran&&r.toRun>0),d=r=>{let[R,_]=r.split("/").map(Number);return _>0&&R===_},c=s.criteria.total>0&&s.criteria.proven===s.criteria.total,v=f.some(r=>r.rows.some(R=>R.gap!==null));if(!u&&!v&&d(n.acs_designed)&&(!e.ran||c)){let r=e.ucs.length,R=`use-case${r===1?"":"s"}`;return a.push(e.ran?`no gaps \u2014 all ${r} ${R} designed and proven`:`no gaps \u2014 all ${r} ${R} designed \xB7 nothing run yet`),f.length>0&&a.push("",...K(f,i)),a.push(m("inspect a use-case: kane-cli cover gaps <uc-id>")),a}let o=(r,R)=>r.groups.filter(_=>R.includes(_.key)).reduce((_,S)=>_+S.rows.length,0),l=x.map(r=>({band:r,failing:o(r.uc,["failing"]),blocked:o(r.uc,["blocked"]),stale:o(r.uc,["needs-refresh"]),design:o(r.uc,["needs-tests","needs-scenarios"]),run:r.toRun})),p=[];l.some(r=>r.failing)&&p.push({hdr:"FAILING",get:r=>r.failing}),l.some(r=>r.blocked)&&p.push({hdr:"BLOCKED",get:r=>r.blocked}),l.some(r=>r.stale)&&p.push({hdr:"STALE",get:r=>r.stale}),l.some(r=>r.design)&&p.push({hdr:"TO DESIGN",get:r=>r.design}),l.some(r=>r.run)&&p.push({hdr:"TO RUN",get:r=>r.run}),i<100&&(p.length=0);let g=r=>r.cov.criteria===0?"\u2014":`${r.designed} of ${r.cov.criteria}`,b=Math.min(16,Math.max(4,...x.map(r=>A(r.uc.slug).length))),h=Math.max(8,...x.map(r=>g(r.uc).length)),y=Math.max(8,...x.map(r=>Se(r.uc.cov).length)),w=p.map(r=>r.hdr.length+2),E=i-b-2-3-h-3-y-w.reduce((r,R)=>r+R,0)-2,C=`${" ".repeat(b+2)}${"USE CASE".padEnd(E+3)}${"DESIGNED".padEnd(h)} ${"COVERAGE".padEnd(y)}`+p.map((r,R)=>r.hdr.padStart(w[R])).join("");a.push(m(C.trimEnd().slice(0,i)));for(let r of l){let R=r.band.uc,_=Se(R.cov).padEnd(y),S=t.color?`${He[R.cov.state]}${_}${R.cov.state==="no_criteria"?"\x1B[22m":"\x1B[39m"}`:_,M=p.map((I,T)=>String(I.get(r)||"\u2014").padStart(w[T])).join("");a.push(`${L(A(R.slug),b).padEnd(b)} ${L(R.title,E).padEnd(E)} ${g(R).padEnd(h)} ${S}${M}`)}return a.push(""),f.length>0&&a.push(...K(f,i)),a.push(m("inspect a use-case: kane-cli cover gaps <uc-id>")),a}var Me=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function qe(e){let t=e.cited.map(n=>`${A(n.item)} (${n.fresh?"fresh":"stale"})`).join(", ");return e.gap==="uncited"?"no test \xB7 no use case cites this unit":e.gap==="untested"?`no test \xB7 cited by ${t}; no test verifies it`:`${Me(e.criteria,"criterion","criteria")} \xB7 ${e.designed} designed \xB7 ${e.run} run \xB7 ${e.passed} passed \xB7 cited by ${t}`}function K(e,t){let n=[];for(let s of e){let i=s.rows.filter(c=>c.designed>0).length,m=s.extraction==="none"?"no extraction recorded for this version":`this version's extraction is recorded ${s.extraction}`;n.push(L(`units of ${s.sourceId} (plugin ${s.plugin}) \xB7 ${i}/${s.expected} expected units have a test`,t)),n.push(` ${m}`),s.plan==="every"?n.push(" every unit is expected: the plugin gives no coverage plan"):s.expected<s.units&&n.push(` the plugin ${s.plugin} expects tests for ${s.expected} of ${Me(s.units,"unit")}`);let a=Math.min(24,Math.max(4,...s.rows.map(c=>c.unit.length))),f=Math.min(40,Math.max(0,...s.rows.map(c=>(c.forPeople.label??"").length))),x=(c,v)=>`${v}${L(c.unit,a).padEnd(a)} ${f>0?`${L(c.forPeople.label??"",f).padEnd(f)} `:""}${qe(c)}`,u=new Map(s.forPeople.groups.map(c=>[c,[]])),d=[];for(let c of s.rows)c.forPeople.group===null?d.push(c):u.set(c.forPeople.group,[...u.get(c.forPeople.group)??[],c]);for(let[c,v]of u)if(v.length!==0){n.push(L(` ${c}`,t));for(let o of v)n.push(x(o," "))}for(let c of d)n.push(x(c,u.size>0?" ":" "));n.push("")}return n}function Ie(e,t,n,s){let i=Math.max(80,Math.min(s.width,100)),m=l=>s.color?`\x1B[2m${l}\x1B[22m`:l,a=[],f=e.ucs.find(l=>l.slug===t);a.push(f?`${A(t)} "${f.title}": ${Math.round(f.cov.pct)}%, ${D[f.cov.state]}`:A(t));let x=Math.min(16,Math.max(4,...n.map(l=>A(l.id).length))),u=Math.max(0,...n.map(l=>l.state.length)),d=Math.min(Math.max(20,i-2-x-2-2-u),Math.max(0,...n.map(l=>l.text.length))),c=l=>{if(!s.color)return l;let p=l==="proven"?"\x1B[32m":l==="failing"||l==="not designed"?"\x1B[31m":"\x1B[2m";return`${p}${l}${p==="\x1B[2m"?"\x1B[22m":"\x1B[39m"}`};for(let l of n){let p=[],g="";for(let b of l.text.split(/\s+/))g&&g.length+1+b.length>d?(p.push(g),g=b):g=g?`${g} ${b}`:b;p.push(g),p.forEach((b,h)=>{h===0?a.push(` ${L(A(l.id),x).padEnd(x)} ${b.padEnd(d)} ${c(l.state)}`):a.push(` ${" ".repeat(x+2)}${b}`)})}let v=[],o=f?Ue(e,f):null;if(o){for(let p of o.spans){let g=p.replace(/^↳ /,"");if(g.startsWith("kane-cli evidence serve")){let b=n.filter(h=>h.blocked||h.state===D.failing).map(h=>A(h.id)).join(" \xB7 ");v.push({label:"see why",cmd:g,...b?{note:`(explains ${b})`}:{}})}else v.push({label:"design",cmd:g})}let l=n.filter(p=>p.state===D.not_run&&!p.blocked).length;if(l>0){let g=n.some(b=>b.state===D.failing)?"(review evidence first \u2014 a re-run may heal over failures)":v.some(b=>b.label==="see why")?`(${Ee(l)} not run \u2014 see why first)`:`(${Ee(l)} not run)`;v.push({label:"first run",cmd:"kane-cli testrun run",note:g})}}if(v.length){a.push(""),a.push("next");let l=Math.max(...v.map(g=>g.label.length))+2,p=g=>s.color?`\x1B[36m${g}\x1B[39m`:g;for(let g of v){let b=` ${g.label.padEnd(l)}`;if(b.length+g.cmd.length>i){let h=g.cmd.lastIndexOf(" ",i-b.length),y=h>0?g.cmd.slice(0,h):g.cmd.slice(0,i-b.length),w=h>0?g.cmd.slice(h+1):g.cmd.slice(i-b.length);a.push(`${b}${p(y)}`),a.push(`${" ".repeat(b.length)}${p(w)}`),g.note&&a.push(m(`${" ".repeat(b.length)}${g.note}`))}else g.note&&b.length+g.cmd.length+3+g.note.length<=i?a.push(`${b}${p(g.cmd)} ${m(g.note)}`):(a.push(`${b}${p(g.cmd)}`),g.note&&a.push(m(`${" ".repeat(b.length)}${g.note}`)))}}return a.push(""),a.push(m("all use-cases: kane-cli cover gaps")),a}function ne(e){let{dc:t,coverage:n}=e,s=i=>e.top!==void 0?i.slice(0,e.top):i;return{stage:e.stage,rollup_version:2,coverage:{pct:n.pct,usecases:n.usecases,criteria:n.criteria,...n.note?{note:n.note}:{}},designed:{usecases:H(n),of:n.usecases.total},design_completeness:{acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},usecases:e.ucs.map(i=>({id:/^sha256:/.test(i.slug)?null:i.slug,title:i.title,risk:i.risk,coverage:{pct:i.cov.pct,state:i.cov.state,criteria:i.cov.criteria,proven:i.cov.proven},designed:{criteria:i.designed,of:i.cov.criteria},design_completeness:{status:i.des.status},stale_acs:i.des.staleAcs,pending:s(i.groups.flatMap(m=>m.rows).filter(m=>ee(e.stage,m))).map(Te)})),other:e.other.filter(i=>ee(e.stage,i)).map(Te),...e.units&&e.units.length>0?{units:Xe(e.units)}:{}}}function Xe(e){return{rollup:Q(e),sources:e.map(t=>{let n=new Map(t.forPeople.groups.map((s,i)=>[s,i+1]));return{source_id:t.sourceId,plugin:t.plugin,units:t.units,plan:t.plan,expected:t.expected,extraction:t.extraction,rows:t.rows.map(s=>({unit:s.unit,group:s.forPeople.group===null?null:n.get(s.forPeople.group),criteria:s.criteria,designed:s.designed,run:s.run,passed:s.passed,gap:s.gap,cited:s.cited.map(i=>({item:i.item,kind:i.kind,fresh:i.fresh}))}))}})}}function Te(e){let{servePath:t,viaFiles:n,meta:s,...i}=e;return{...i}}var V="--rollup no longer changes the figure, and goes in a later release";async function Qe(e,t,n=Re(),s=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return j(n,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:h,agentRefusal:y}=await import("./headless-io-FFM5T6KL.js"),{parsesAgainstGrammar:w}=await import("./next-O6SUSX3R.js"),E=h("ndjson","gaps",{stdout:O=>n.out(O.replace(/\n$/,"")),stderr:O=>(n.err??n.out)(O.replace(/\n$/,""))}),C=[],r=[],R={out:O=>C.push(O),err:O=>r.push(O),confirm:async()=>!1,isTTY:!1};if(await Qe(e,{...t,json:!0,mode:void 0},R,s)!==0)return y(E,r.join("; ")||"cover gaps refused");let S=JSON.parse(C.join(`
|
|
2
|
+
import{N as j,O as we,Q as Re}from"./chunk-OZNYQONA.js";import"./chunk-7Y55CO42.js";import"./chunk-YILRYMMG.js";import"./chunk-BSRSXYDZ.js";import"./chunk-CB4ARIHR.js";import{a as W,h as D,i as H,k as z,l as ge,m as fe,n as F,o as J,p as q,q as me,r as he}from"./chunk-MEMXFTLD.js";import"./chunk-UWPG5MWM.js";import"./chunk-73Y6T2UK.js";import"./chunk-XMPTFXPW.js";import{f as se}from"./chunk-Z36KVIRR.js";import"./chunk-Q4JV4U65.js";import"./chunk-SMXABALN.js";import"./chunk-WN5VKKJ3.js";import{b as xe,c as _e}from"./chunk-23DKB2MT.js";import{c as be}from"./chunk-VRIZDOO5.js";import{a as ye}from"./chunk-ZHWU6L2G.js";import{a as U,b as de,c as N,d as pe}from"./chunk-FOLUB336.js";import{d as ve}from"./chunk-CQDCNP7V.js";import"./chunk-7V34ZMMS.js";import"./chunk-B7ZX5HEN.js";import"./chunk-6PIIUAZF.js";import{T as ae,U as le,vb as ue}from"./chunk-PI7OXS62.js";import{c as re,e as oe,g as ie,n as ce}from"./chunk-DBMW3VUN.js";import{f as $,g as G}from"./chunk-KU3YHPWZ.js";import"./chunk-7V4BQSSV.js";import"./chunk-ZAQGIC33.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-HYJVYYAZ.js";import"./chunk-VZ7KXRXB.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import"./chunk-RZ4F3BHX.js";import"./chunk-A7RJQJNT.js";import"./chunk-HCBYKLMW.js";import"./chunk-33DWJV67.js";import"./chunk-FOJHSG5M.js";import"./chunk-6YGTRKDT.js";import"./chunk-J4FIESTB.js";import"./chunk-UR6MHSHU.js";function ke(e){let t=e.byLabel($.USECASE).filter(({cid:u})=>U(e,u)),n=new Map(t.map(({cid:u})=>[u,[]]));for(let{cid:u}of e.byLabel($.AC)){if(!U(e,u))continue;let d=N(e,u),c=d?n.get(d):void 0;c&&c.push({designed:de(e,u),stale:e.stale(u)!=="fresh"})}let s={},i=0,m=0,a=0,f=0,x=new Set;for(let{cid:u}of e.byLabel($.SCENARIO))if(U(e,u))for(let d of e.edgesFrom(u))d.type===G.BELONGS_TO&&x.add(e.tipOf(d.dst));for(let{cid:u}of t){let d=n.get(u);m+=d.length;let c=d.filter(p=>p.designed).length;i+=c;let v=d.filter(p=>p.stale).length,o=x.has(u);o||f++;let l=d.length===0||c===0?"undesigned":c===d.length&&v===0&&o?"complete":"partial";l==="complete"&&a++,s[e.displayNameOf(u)??u]={status:l,staleAcs:v}}return{acs_designed:`${i}/${m}`,usecases_complete:`${a}/${t.length}`,ucs_needing_scenarios:f,perUc:s,config:{criterion:"live_verifies_edge",freshness:"not_discounted"}}}var De={[$.USECASE]:"use case",[$.AC]:"criterion",[$.SCENARIO]:"scenario",[$.TEST]:"test"},X=e=>{let t=ye(e);return t===null?null:t.replace(/\|/g,"/")};function Ne(e,t){let n=e.tipOf(t);return U(e,n)?n:null}function $e(e,t,n){let s=[],i=[...e.heads.entries()].filter(u=>typeof u[1]=="string").sort(([u],[d])=>u<d?-1:u>d?1:0),m=null,a=u=>{if(m===null){m=new Map;for(let{cid:d}of e.byLabel($.AC)){if(!U(e,d))continue;let c=N(e,d);c!==null&&m.set(c,[...m.get(c)??[],d])}}return m.get(u)??[]},f=(u,d)=>{if(d===$.USECASE)return a(u);if(d===$.AC)return[u];let c=d===$.SCENARIO?G.EXERCISES:d===$.TEST?G.VERIFIES:null;return c===null?[]:e.edgesFrom(u).filter(o=>o.type===c).map(o=>Ne(e,o.dst)).filter(o=>o!==null&&e.nodeLabel.get(o)===$.AC)},x=[];for(let u of[$.USECASE,$.AC,$.SCENARIO,$.TEST])for(let{cid:d}of e.byLabel(u)){if(!U(e,d))continue;let c=new Map;for(let v of e.derivesInto(d)){let o=v.props.source_id;typeof o=="string"&&c.set(o,[...c.get(o)??[],v])}c.size>0&&x.push({cid:d,label:u,name:e.displayNameOf(d)??d,bySource:c})}x.sort((u,d)=>u.name<d.name?-1:u.name>d.name?1:0);for(let[u,d]of i){let c=e.mediaOf(d)?.plugin;if(c===void 0||typeof c.index!="string")continue;let v=ce(t(c.index));if(v===null)continue;let o=v.units.filter(_=>_.id!==re),l=o.map(_=>_.id),p=be(t,c,l),g=p===null?l:p.expected,b=new Map((p?.groups??[]).flatMap(_=>_.units.map(S=>[S,_.name]))),h=oe(d,_=>e.mediaOf(_)?.plugin),y=new Map;for(let _ of x){let S=_.bySource.get(u);if(S===void 0)continue;let M=new Set(S.flatMap(T=>Array.isArray(T.props.units)?T.props.units:[]));if(M.size===0)continue;let I=new Set(h===null?M:ie(S,h).failing);for(let T of M)y.set(T,[...y.get(T)??[],{item:_,fresh:!I.has(T)}])}let w=e.extractionCompleteness.get(u),E=w?.source_cid===d&&(w.completeness==="complete"||w.completeness==="partial")?w.completeness:"none",C=new Map(o.map(_=>[_.id,_.label])),r=g.map(_=>{let S=y.get(_)??[],M=[...new Set(S.flatMap(({item:k})=>f(k.cid,k.label)))],I=M.filter(k=>J(e,k).length>0),T=k=>n?.perAc[e.nameOf.get(k)??k]?.state??"not_run",O=I.filter(k=>T(k)==="proven"||T(k)==="failing").length,B=I.filter(k=>T(k)==="proven").length;return{unit:_,cited:S.map(({item:k,fresh:Y})=>({item:k.name,kind:De[k.label],fresh:Y})),criteria:M.length,designed:I.length,run:O,passed:B,gap:S.length===0?"uncited":I.length===0?"untested":null,forPeople:{label:X(C.get(_)),group:X(b.get(_))}}}),R=(p?.groups??[]).map(_=>X(_.name)).filter(_=>_!==null);s.push({sourceId:u,plugin:c.id,units:l.length,plan:p===null?"every":"plugin",expected:g.length,extraction:E,rows:r,forPeople:{groups:R}})}return s}function Q(e){let t=e.flatMap(n=>n.rows);return{expected:t.length,tested:t.filter(n=>n.designed>0).length,proven:t.filter(n=>n.designed>0&&n.passed===n.designed).length}}var We=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate","not-yet-run"],je={failing:"failing",blocked:"blocked","needs-refresh":"needs refresh","needs-tests":"needs tests","needs-scenarios":"needs scenarios","happy-only":"happy path only","possible-duplicate":"possible duplicate","not-yet-run":"not yet run"},P={high:0,med:1,low:2};function A(e){if(!e||/^sha256:/.test(e))return"(unnamed)";let t=/^(uc|ac|sc|t)-(\d+)$/.exec(e);return t?`${t[1].toUpperCase()}-${t[2]}`:e}function Le(e,t=5){let n=e.trim().split(/\s+/);return n.slice(0,t).join(" ")+(n.length>t?"\u2026":"")}function Pe(e,t){let n=e.resolve(t),s=n?e.getNode(e.tipOf(n.cid))?.content:null;return String(s?.title??s?.text??"")}function Ce(e,t){let n=e.resolve(t);return{id:n?e.displayNameOf(e.tipOf(n.cid))??e.displayNameOf(n.cid):null,title:Le(Pe(e,t),8)}}function Fe(e,t){let n=e.resolve(t);if(!n)return null;let s=e.tipOf(n.cid);if(!U(e,s))return null;let i=e.nodeLabel.get(s);if(i===$.USECASE)return s;if(i===$.AC)return N(e,s);if(i===$.TEST){let m=e.edgesFrom(s).find(f=>f.type===G.VERIFIES&&U(e,f.dst));if(m)return N(e,m.dst);let a=e.edgesFrom(s).find(f=>f.type===G.AUTOMATES&&U(e,f.dst));if(a){let f=e.edgesFrom(a.dst).find(x=>x.type===G.BELONGS_TO&&U(e,x.dst));return f?f.dst:null}}return null}function Z(e){if(e.tag==="reuse-candidate"&&e.stage==="design")return"possible-duplicate";switch(e.kind){case"no-verifies":return"needs-tests";case"zero-scenario":return"needs-scenarios";case"happy-only":return"happy-only";case"stale-ac":case"stale-test":return"needs-refresh";case"execution-failed":return"failing";case"execution-blocked":return"blocked";case"covered-not-run":return"not-yet-run";default:return"other"}}function Be(e,t){let n=e.resolve(t),s=n?e.getNode(e.tipOf(n.cid))?.content.risk:null;return s==="high"||s==="med"||s==="low"?s:"med"}function te(e,t,n){let s=new Map;for(let[i,m]of Object.entries(t.perAc)){if(m.state!=="failing"&&m.state!=="not_run")continue;let a=e.resolve(i);if(!a)continue;let f=e.tipOf(a.cid),x=J(e,f);if(m.state==="failing"){let d=c=>q(e,n,f,[c]).some(v=>v.executionId===m.deciding_run&&v.verdict==="failed");s.set(i,{state:"failing",...m.deciding_run?{executionId:m.deciding_run}:{},viaTests:x.filter(d).map(c=>F(e,c))});continue}let u=me(q(e,n,f,x));s.set(i,u?{state:"blocked",executionId:u.executionId,viaTests:[]}:{state:"not_run",viaTests:[]})}return s}function Oe(e,t,n,s,i){let m=i.servePaths??new Map,a=i.work??te(e,s,z(e)),f=s.note!=="nothing_run_yet"||[...a.values()].some(o=>o.state==="blocked"),x=new Map(ge(e).inScope.map(o=>[F(e,o),o])),u=new Map([...x.values()].map(o=>[o,[]])),d=[];for(let o of t){if(o.stage!=="design")continue;let l={...o,...Ce(e,o.ref)},p=Fe(e,o.ref),g=p?u.get(p):void 0;g&&Z(o)!=="other"?g.push(l):d.push(l)}let c=new Map;for(let o of Object.values(s.perAc))o.state!=="not_designed"&&c.set(o.uc,(c.get(o.uc)??0)+1);for(let[o,l]of a){let p=u.get(x.get(s.perAc[o].uc)??"");if(!p)continue;let{id:g,title:b}=Ce(e,o),h={ref:o,id:g,title:b,risk:Be(e,o),stage:"cover"},y=l.executionId!==void 0?m.get(l.executionId):void 0,w={ready_command:y!==void 0?`kane-cli evidence serve ${y}`:"kane-cli testrun run",...l.executionId!==void 0?{execution_id:l.executionId}:{},...y!==void 0?{servePath:y}:{}};l.state==="failing"?p.push({...h,kind:"execution-failed",tag:"evolve",why:"covering test failed against this AC",...w,via_tests:l.viaTests,...i.testFiles?{viaFiles:l.viaTests.map(E=>i.testFiles.get(E)??null)}:{}}):l.state==="blocked"?p.push({...h,kind:"execution-blocked",tag:"reuse-candidate",why:"its test ran, but every run broke or was skipped, so none counts",...w}):f&&p.push({...h,kind:"covered-not-run",tag:"reuse-candidate",why:"a covering test exists but has not run yet",ready_command:"kane-cli testrun run"})}let v=[];for(let o of s.perUc){let l=x.get(o.id);if(l===void 0)continue;let p=n.perUc[o.id]??{status:"undesigned",staleAcs:0},g=u.get(l)??[],b=new Set(g.filter(y=>Z(y)==="needs-refresh").map(y=>y.ref)),h=[];for(let y of We){let w=g.filter(C=>Z(C)===y);if(y==="needs-tests"&&(w=w.filter(C=>!b.has(C.ref))),w.length===0)continue;w.sort((C,r)=>(P[C.risk]??3)-(P[r.risk]??3)||W(C.ref,r.ref));let E=y==="failing"||y==="blocked"||w.length<=2||new Set(w.map(C=>C.ready_command)).size>1;h.push({key:y,label:je[y],...y==="needs-refresh"?{suffix:"source moved since these were designed"}:{},rows:w,...E?{}:{rosterCommand:w[0].ready_command}})}v.push({slug:o.id,title:o.title,risk:o.risk,cov:o,designed:c.get(o.id)??0,des:p,groups:h})}return v.sort((o,l)=>(P[o.risk]??3)-(P[l.risk]??3)||W(o.slug,l.slug)),d.sort((o,l)=>(P[o.risk]??3)-(P[l.risk]??3)||W(o.ref,l.ref)),{stage:i.stage,top:i.top,dc:n,coverage:s,ran:f,ucs:v,other:d,...i.units&&i.units.length>0?{units:i.units}:{}}}function ee(e,t){return e==="all"||t.stage===e}function L(e,t){return e.length<=t?e:t<=1?e.slice(0,t):e.slice(0,t-1)+"\u2026"}var Ye={failing:"failing",blocked:"blocked","needs-refresh":"stale","needs-tests":"needs test","needs-scenarios":"no scenario","happy-only":"happy only","possible-duplicate":"duplicate?","not-yet-run":"to run"},ze=["failing","blocked","needs-refresh","needs-tests","needs-scenarios","happy-only","possible-duplicate"];function Je(e,t,n){return(t.get("failing")??[]).length?0:(t.get("blocked")??[]).length?1:(t.get("needs-tests")??[]).length||(t.get("needs-scenarios")??[]).length?2:(t.get("needs-refresh")??[]).length?3:(t.get("not-yet-run")??[]).length>0||n&&e.cov.state==="not_run"?4:5}function Ue(e,t){let n=new Map;for(let c of t.groups)c.rows.length&&n.set(c.key,c.rows);let s=new Map;for(let c of t.groups){let v=c.rows.filter(o=>ee(e.stage,o));v.length&&s.set(c.key,v)}let i=[],m=[],a=[],f=new Set;for(let c of ze){let v=s.get(c);if(v){for(let o of v){let l=c==="failing"&&o.via_tests?.length?` \xB7 via ${o.via_tests.map(p=>A(p)).join(", ")}`:"";i.push({id:o.ref===t.slug?"\u2014":A(o.id??o.ref),cls:Ye[c],risk:o.ref===t.slug?"\u2014":o.risk,title:(o.ref===t.slug?o.why:o.title)+l})}if(c==="failing"||c==="blocked")for(let o of v)o.servePath&&f.add(`kane-cli evidence serve ${o.servePath}`);for(let o of v)o.ready_command&&!o.ready_command.startsWith("kane-cli evidence serve")&&o.ready_command!=="kane-cli testrun run"&&f.add(o.ready_command)}}let x=[...f].sort((c,v)=>Number(v.startsWith("kane-cli evidence serve"))-Number(c.startsWith("kane-cli evidence serve")));m.push(...x.map(c=>`\u21B3 ${c}`));let u=n.get("not-yet-run")??[],d=e.ran?u.length:t.designed;return e.ran&&d>0&&a.push(`${d} to run`),{uc:t,rows:i,spans:m,tails:a,toRun:d,severity:Je(t,n,e.ran)}}var Ke=e=>`${e} use-case${e===1?"":"s"}`,Ee=e=>`${e} ${e===1?"criterion":"criteria"}`;function Ve(e,t){let n=t!==void 0?`"${t}"'s`:"this folder's",s=e.note==="nothing_run_yet"?" \xB7 nothing run yet":"";return`coverage: ${Math.round(e.pct)}% across ${n} ${Ke(e.usecases.total)}${s} \xB7 ${H(e)} of ${e.usecases.total} designed`}var He={proven:"\x1B[32m",partial:"\x1B[33m",not_run:"\x1B[33m",failing:"\x1B[31m",not_designed:"\x1B[31m",no_criteria:"\x1B[2m"};function Se(e){return`${Math.round(e.pct)}% ${D[e.state]}`}function Ae(e,t){let{dc:n,coverage:s}=e,i=Math.max(80,Math.min(t.width,100)),m=r=>t.color?`\x1B[2m${r}\x1B[22m`:r,a=[Ve(s,t.project)],f=e.units??[];if(f.length>0){let r=Q(f);a.push(`units ${r.tested}/${r.expected} expected units have a test \xB7 ${r.proven} proven`)}a.push("");let x=e.ucs.map(r=>Ue(e,r));x.sort((r,R)=>r.severity-R.severity||W(r.uc.slug,R.uc.slug));let u=x.some(r=>r.rows.length||r.spans.length||r.tails.length||e.ran&&r.toRun>0),d=r=>{let[R,_]=r.split("/").map(Number);return _>0&&R===_},c=s.criteria.total>0&&s.criteria.proven===s.criteria.total,v=f.some(r=>r.rows.some(R=>R.gap!==null));if(!u&&!v&&d(n.acs_designed)&&(!e.ran||c)){let r=e.ucs.length,R=`use-case${r===1?"":"s"}`;return a.push(e.ran?`no gaps \u2014 all ${r} ${R} designed and proven`:`no gaps \u2014 all ${r} ${R} designed \xB7 nothing run yet`),f.length>0&&a.push("",...K(f,i)),a.push(m("inspect a use-case: kane-cli cover gaps <uc-id>")),a}let o=(r,R)=>r.groups.filter(_=>R.includes(_.key)).reduce((_,S)=>_+S.rows.length,0),l=x.map(r=>({band:r,failing:o(r.uc,["failing"]),blocked:o(r.uc,["blocked"]),stale:o(r.uc,["needs-refresh"]),design:o(r.uc,["needs-tests","needs-scenarios"]),run:r.toRun})),p=[];l.some(r=>r.failing)&&p.push({hdr:"FAILING",get:r=>r.failing}),l.some(r=>r.blocked)&&p.push({hdr:"BLOCKED",get:r=>r.blocked}),l.some(r=>r.stale)&&p.push({hdr:"STALE",get:r=>r.stale}),l.some(r=>r.design)&&p.push({hdr:"TO DESIGN",get:r=>r.design}),l.some(r=>r.run)&&p.push({hdr:"TO RUN",get:r=>r.run}),i<100&&(p.length=0);let g=r=>r.cov.criteria===0?"\u2014":`${r.designed} of ${r.cov.criteria}`,b=Math.min(16,Math.max(4,...x.map(r=>A(r.uc.slug).length))),h=Math.max(8,...x.map(r=>g(r.uc).length)),y=Math.max(8,...x.map(r=>Se(r.uc.cov).length)),w=p.map(r=>r.hdr.length+2),E=i-b-2-3-h-3-y-w.reduce((r,R)=>r+R,0)-2,C=`${" ".repeat(b+2)}${"USE CASE".padEnd(E+3)}${"DESIGNED".padEnd(h)} ${"COVERAGE".padEnd(y)}`+p.map((r,R)=>r.hdr.padStart(w[R])).join("");a.push(m(C.trimEnd().slice(0,i)));for(let r of l){let R=r.band.uc,_=Se(R.cov).padEnd(y),S=t.color?`${He[R.cov.state]}${_}${R.cov.state==="no_criteria"?"\x1B[22m":"\x1B[39m"}`:_,M=p.map((I,T)=>String(I.get(r)||"\u2014").padStart(w[T])).join("");a.push(`${L(A(R.slug),b).padEnd(b)} ${L(R.title,E).padEnd(E)} ${g(R).padEnd(h)} ${S}${M}`)}return a.push(""),f.length>0&&a.push(...K(f,i)),a.push(m("inspect a use-case: kane-cli cover gaps <uc-id>")),a}var Me=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function qe(e){let t=e.cited.map(n=>`${A(n.item)} (${n.fresh?"fresh":"stale"})`).join(", ");return e.gap==="uncited"?"no test \xB7 no use case cites this unit":e.gap==="untested"?`no test \xB7 cited by ${t}; no test verifies it`:`${Me(e.criteria,"criterion","criteria")} \xB7 ${e.designed} designed \xB7 ${e.run} run \xB7 ${e.passed} passed \xB7 cited by ${t}`}function K(e,t){let n=[];for(let s of e){let i=s.rows.filter(c=>c.designed>0).length,m=s.extraction==="none"?"no extraction recorded for this version":`this version's extraction is recorded ${s.extraction}`;n.push(L(`units of ${s.sourceId} (plugin ${s.plugin}) \xB7 ${i}/${s.expected} expected units have a test`,t)),n.push(` ${m}`),s.plan==="every"?n.push(" every unit is expected: the plugin gives no coverage plan"):s.expected<s.units&&n.push(` the plugin ${s.plugin} expects tests for ${s.expected} of ${Me(s.units,"unit")}`);let a=Math.min(24,Math.max(4,...s.rows.map(c=>c.unit.length))),f=Math.min(40,Math.max(0,...s.rows.map(c=>(c.forPeople.label??"").length))),x=(c,v)=>`${v}${L(c.unit,a).padEnd(a)} ${f>0?`${L(c.forPeople.label??"",f).padEnd(f)} `:""}${qe(c)}`,u=new Map(s.forPeople.groups.map(c=>[c,[]])),d=[];for(let c of s.rows)c.forPeople.group===null?d.push(c):u.set(c.forPeople.group,[...u.get(c.forPeople.group)??[],c]);for(let[c,v]of u)if(v.length!==0){n.push(L(` ${c}`,t));for(let o of v)n.push(x(o," "))}for(let c of d)n.push(x(c,u.size>0?" ":" "));n.push("")}return n}function Ie(e,t,n,s){let i=Math.max(80,Math.min(s.width,100)),m=l=>s.color?`\x1B[2m${l}\x1B[22m`:l,a=[],f=e.ucs.find(l=>l.slug===t);a.push(f?`${A(t)} "${f.title}": ${Math.round(f.cov.pct)}%, ${D[f.cov.state]}`:A(t));let x=Math.min(16,Math.max(4,...n.map(l=>A(l.id).length))),u=Math.max(0,...n.map(l=>l.state.length)),d=Math.min(Math.max(20,i-2-x-2-2-u),Math.max(0,...n.map(l=>l.text.length))),c=l=>{if(!s.color)return l;let p=l==="proven"?"\x1B[32m":l==="failing"||l==="not designed"?"\x1B[31m":"\x1B[2m";return`${p}${l}${p==="\x1B[2m"?"\x1B[22m":"\x1B[39m"}`};for(let l of n){let p=[],g="";for(let b of l.text.split(/\s+/))g&&g.length+1+b.length>d?(p.push(g),g=b):g=g?`${g} ${b}`:b;p.push(g),p.forEach((b,h)=>{h===0?a.push(` ${L(A(l.id),x).padEnd(x)} ${b.padEnd(d)} ${c(l.state)}`):a.push(` ${" ".repeat(x+2)}${b}`)})}let v=[],o=f?Ue(e,f):null;if(o){for(let p of o.spans){let g=p.replace(/^↳ /,"");if(g.startsWith("kane-cli evidence serve")){let b=n.filter(h=>h.blocked||h.state===D.failing).map(h=>A(h.id)).join(" \xB7 ");v.push({label:"see why",cmd:g,...b?{note:`(explains ${b})`}:{}})}else v.push({label:"design",cmd:g})}let l=n.filter(p=>p.state===D.not_run&&!p.blocked).length;if(l>0){let g=n.some(b=>b.state===D.failing)?"(review evidence first \u2014 a re-run may heal over failures)":v.some(b=>b.label==="see why")?`(${Ee(l)} not run \u2014 see why first)`:`(${Ee(l)} not run)`;v.push({label:"first run",cmd:"kane-cli testrun run",note:g})}}if(v.length){a.push(""),a.push("next");let l=Math.max(...v.map(g=>g.label.length))+2,p=g=>s.color?`\x1B[36m${g}\x1B[39m`:g;for(let g of v){let b=` ${g.label.padEnd(l)}`;if(b.length+g.cmd.length>i){let h=g.cmd.lastIndexOf(" ",i-b.length),y=h>0?g.cmd.slice(0,h):g.cmd.slice(0,i-b.length),w=h>0?g.cmd.slice(h+1):g.cmd.slice(i-b.length);a.push(`${b}${p(y)}`),a.push(`${" ".repeat(b.length)}${p(w)}`),g.note&&a.push(m(`${" ".repeat(b.length)}${g.note}`))}else g.note&&b.length+g.cmd.length+3+g.note.length<=i?a.push(`${b}${p(g.cmd)} ${m(g.note)}`):(a.push(`${b}${p(g.cmd)}`),g.note&&a.push(m(`${" ".repeat(b.length)}${g.note}`)))}}return a.push(""),a.push(m("all use-cases: kane-cli cover gaps")),a}function ne(e){let{dc:t,coverage:n}=e,s=i=>e.top!==void 0?i.slice(0,e.top):i;return{stage:e.stage,rollup_version:2,coverage:{pct:n.pct,usecases:n.usecases,criteria:n.criteria,...n.note?{note:n.note}:{}},designed:{usecases:H(n),of:n.usecases.total},design_completeness:{acs_designed:t.acs_designed,usecases_complete:t.usecases_complete,ucs_needing_scenarios:t.ucs_needing_scenarios,config:t.config},usecases:e.ucs.map(i=>({id:/^sha256:/.test(i.slug)?null:i.slug,title:i.title,risk:i.risk,coverage:{pct:i.cov.pct,state:i.cov.state,criteria:i.cov.criteria,proven:i.cov.proven},designed:{criteria:i.designed,of:i.cov.criteria},design_completeness:{status:i.des.status},stale_acs:i.des.staleAcs,pending:s(i.groups.flatMap(m=>m.rows).filter(m=>ee(e.stage,m))).map(Te)})),other:e.other.filter(i=>ee(e.stage,i)).map(Te),...e.units&&e.units.length>0?{units:Xe(e.units)}:{}}}function Xe(e){return{rollup:Q(e),sources:e.map(t=>{let n=new Map(t.forPeople.groups.map((s,i)=>[s,i+1]));return{source_id:t.sourceId,plugin:t.plugin,units:t.units,plan:t.plan,expected:t.expected,extraction:t.extraction,rows:t.rows.map(s=>({unit:s.unit,group:s.forPeople.group===null?null:n.get(s.forPeople.group),criteria:s.criteria,designed:s.designed,run:s.run,passed:s.passed,gap:s.gap,cited:s.cited.map(i=>({item:i.item,kind:i.kind,fresh:i.fresh}))}))}})}}function Te(e){let{servePath:t,viaFiles:n,meta:s,...i}=e;return{...i}}var V="--rollup no longer changes the figure, and goes in a later release";async function Qe(e,t,n=Re(),s=process.cwd()){if(t.mode!==void 0&&t.mode!=="agent"&&t.mode!=="ci"&&t.mode!=="interactive")return j(n,`--mode must be interactive | agent | ci, got '${t.mode}'`),2;if(t.mode==="agent"||t.mode==="ci"){let{makeHeadlessIO:h,agentRefusal:y}=await import("./headless-io-FFM5T6KL.js"),{parsesAgainstGrammar:w}=await import("./next-O6SUSX3R.js"),E=h("ndjson","gaps",{stdout:O=>n.out(O.replace(/\n$/,"")),stderr:O=>(n.err??n.out)(O.replace(/\n$/,""))}),C=[],r=[],R={out:O=>C.push(O),err:O=>r.push(O),confirm:async()=>!1,isTTY:!1};if(await Qe(e,{...t,json:!0,mode:void 0},R,s)!==0)return y(E,r.join("; ")||"cover gaps refused");let S=JSON.parse(C.join(`
|
|
3
3
|
`));t.rollup!==void 0&&E.event({type:"warning",code:"ROLLUP_IGNORED",message:V}),E.event({type:"gaps",...S});let M=[],I=new Set,T=(O,B)=>{if(Array.isArray(O)){for(let k of O)T(k,B);return}if(O&&typeof O=="object"){let k=O,Y=typeof k.why=="string"?k.why:B;typeof k.ready_command=="string"&&k.ready_command.startsWith("kane-cli ")&&w(k.ready_command)&&!I.has(k.ready_command)&&(I.add(k.ready_command),M.push({cmd:k.ready_command,why:Y||"close the gap"}));for(let Ge of Object.values(k))T(Ge,Y)}};return T(S,"close the gap"),E.done(0,void 0,M.slice(0,4))}let i=t.stage??"all";if(i!=="design"&&i!=="cover"&&i!=="all")return j(n,`--stage must be design | cover | all, got '${i}'`),2;if(t.top!==void 0&&(!Number.isInteger(t.top)||t.top<1))return j(n,"--top must be a positive integer"),2;if(t.rollup!==void 0&&t.rollup!=="lenient"&&t.rollup!=="strict")return j(n,`--rollup must be lenient | strict, got '${t.rollup}'`),2;let m=we(s,n);if(!m)return 2;let a=ue(m);if(e!==void 0){let h=le(a,e);if(h!==null)return j(n,h),2;e=ae(a,e)}let f=ke(a),x=z(a),u=he({graph:a,runs:x}),d=te(a,u,x),c=await pe(a,"design"),v=new Map;for(let h of d.values()){if(!h.executionId||v.has(h.executionId))continue;let y=await se(h.executionId,s);y&&v.set(h.executionId,Ze(y,s))}let o=new Map;for(let[h,y]of _e(xe(s)))y.length===1&&o.set(h,y[0].split("/").pop());let l=$e(a,h=>ve(m,h),u),p=Oe(a,c,f,u,{stage:i,top:t.top,servePaths:v,testFiles:o,work:d,units:l}),g=()=>{t.rollup!==void 0&&(t.json?n.err?.(`note: ${V}`):n.out(n.isTTY?`\x1B[2mnote: ${V}\x1B[22m`:`note: ${V}`))};if(e!==void 0){let h=a.resolve(e),y=h?a.tipOf(h.cid):null;if(!y||a.nodeLabel.get(y)!==$.USECASE||!U(a,y))return j(n,`no use-case '${e}' in the graph`),2;let w=a.displayNameOf(y)??y;if(g(),t.json){let r=ne(p);return n.out(JSON.stringify({...r,usecases:r.usecases.filter(R=>R.id===w),other:[]},null,2)),0}if(!p.ucs.some(r=>r.slug===w)){let r=String(a.getNode(y)?.content.title??"");return n.out(`${A(w)} "${r}" isn't counted: every source it came from was removed`),n.out(""),n.out(n.isTTY?"\x1B[2mall use-cases: kane-cli cover gaps\x1B[22m":"all use-cases: kane-cli cover gaps"),0}let E=et(a,y,u,d),C=n.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let r of Ie(p,w,E,{width:C,color:n.isTTY}))n.out(r);return 0}if(g(),t.json)return n.out(JSON.stringify(ne(p),null,2)),0;if(u.usecases.total===0){if(n.out("nothing to measure yet \u2014 no live use-cases in the graph"),l.length>0)for(let h of["",...K(l,100)].slice(0,-1))n.out(h);return 0}let b=n.isTTY&&process.stdout.columns?process.stdout.columns:100;for(let h of Ae(p,{width:b,color:n.isTTY}))n.out(h);return 0}function Ze(e,t){let n=t.endsWith("/")?t:t+"/";return e.startsWith(n)?e.slice(n.length):e}function et(e,t,n,s){let i=[];for(let m of fe(e,new Set([t])).get(t)??[]){let a=F(e,m),f=e.getNode(m)?.content??{};i.push({id:a,state:D[n.perAc[a]?.state??"not_designed"],text:String(f.text??f.title??""),...s.get(a)?.state==="blocked"?{blocked:!0}:{}})}return i.sort((m,a)=>W(m.id,a.id)),i}export{Qe as gapsCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-4CJQ7XZP.js";import"./chunk-3RO2YGKH.js";import"./chunk-73Y6T2UK.js";import"./chunk-XMPTFXPW.js";import"./chunk-REKHAN53.js";import"./chunk-WE7HRAGO.js";import"./chunk-GFLB2SHW.js";import"./chunk-2TVPA3LL.js";import"./chunk-VJGWVBZR.js";import"./chunk-22PIMG52.js";import"./chunk-RQKMSNEU.js";import"./chunk-4C7WVQOD.js";import"./chunk-QXQ7KVEN.js";import"./chunk-Z47ZEFH7.js";import"./chunk-7YV2FCN4.js";import"./chunk-QSCXXNC2.js";import"./chunk-6PIIUAZF.js";import"./chunk-PI7OXS62.js";import"./chunk-DBMW3VUN.js";import"./chunk-KU3YHPWZ.js";import"./chunk-7V4BQSSV.js";import"./chunk-ZAQGIC33.js";import"./chunk-VO66KP2W.js";import"./chunk-G4K3TP2I.js";import"./chunk-YJAQZMJT.js";import"./chunk-HYJVYYAZ.js";import"./chunk-UJLULWSR.js";import"./chunk-ZCRZFAOT.js";import"./chunk-ZCBOHWN3.js";import"./chunk-RZ4F3BHX.js";import"./chunk-TM45NPWL.js";import"./chunk-FOJHSG5M.js";import"./chunk-J4FIESTB.js";import"./chunk-UR6MHSHU.js";export{d as ASSURANCE_GROUPS,b as ONBOARDING_VERBS,a as REMOTE_VERBS,c as TEST_RUN_VERBS,m as agentAsked,h as answerGate,n as installRemoteGate,i as linkedAnswerRefused,j as linkedLines,k as printPair,g as printReadFailure,f as printRefusal,e as remoteGate,l as wrap};
|