@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,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as g,d as u}from"./chunk-
|
|
2
|
+
import{c as g,d as u}from"./chunk-BJO6J5X2.js";import{a as f}from"./chunk-72KYMWQ5.js";import{readFileSync as E}from"fs";var p=/\{\{\s*([A-Za-z_][A-Za-z0-9_.]*)\s*\}\}/g;function h(a){let e=[];for(let o of a){let r=o.trim();if(r){if(r.startsWith("@")){let n=r.slice(1).trim(),t;try{t=E(n,"utf8")}catch(l){throw new Error(`--deps @${n}: ${l.message}`)}let s=t.trim();s&&e.push(s);continue}e.push(r)}}return e.join(`
|
|
3
3
|
|
|
4
4
|
`)}function y(a,e){let o=a.prompt.trim(),r=a.deps.trim(),n=[["--prompt",o],["--deps",r]];if(!n.some(([,i])=>p.test(i)))return p.lastIndex=0,{prompt:o,deps:r,variables:{},secretNames:[]};p.lastIndex=0;let t=u({objective:[o,r].join(`
|
|
5
5
|
`),globalDir:e.globalDir,localDir:e.localDir,file:e.file,inline:e.inline,onLoadError:e.onLoadError});for(let[i,x]of n)for(let v of x.matchAll(p)){let c=v[1],b=c.replace(/^(global\.|secrets\.user\.)/,"");if(!(c in t.raw)&&!(b in t.raw))return{error:`${i} uses {{${c}}} but no variable "${b}" is defined (variables files, --variables-file or --variables)`}}let s=o?f(t.raw,o).objective:"",l=r?f(t.raw,r).objective:"",m=g(t.auteur,[s,l].join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{f as c}from"./chunk-
|
|
2
|
+
import{f as c}from"./chunk-OOGKX4Y6.js";function m(o){if(o==null)return{ok:!0,url:void 0};if(typeof o!="string")return{ok:!1,message:`error: --override-start-url needs a URL (http:// or https://)
|
|
3
3
|
`};let t=o.trim(),i=a=>({ok:!1,message:`error: --override-start-url ${a}: ${JSON.stringify(o)} (expected an http:// or https:// URL, e.g. http://localhost:3000)
|
|
4
|
-
`});if(!t)return i("is empty");let n;try{n=new URL(t)}catch{return i("is not a URL")}return n.protocol!=="http:"&&n.protocol!=="https:"?i("must be http or https"):n.hostname?{ok:!0,url:t}:i("has no host")}function f(o){let t;try{t=new URL(o).hostname.toLowerCase()}catch{return!1}return t=t.replace(/^\[|\]$/g,""),t==="localhost"||t.endsWith(".localhost")||t==="::1"||/^127\./.test(t)||t==="0.0.0.0"||t.endsWith(".local")}function y(o){let{isAgent:t,log:i}=o,n=o.stdout??process.stderr,a=o.stdin??process.stdin,d=e=>{t&&c(e)};return{async runSteps(e){let{default:r}=await import("./react-QWOAB3TB.js"),{render:s}=await import("./build-5ZN47FAT.js"),{TestMdRunView:l}=await import("./TestMdRunView-
|
|
4
|
+
`});if(!t)return i("is empty");let n;try{n=new URL(t)}catch{return i("is not a URL")}return n.protocol!=="http:"&&n.protocol!=="https:"?i("must be http or https"):n.hostname?{ok:!0,url:t}:i("has no host")}function f(o){let t;try{t=new URL(o).hostname.toLowerCase()}catch{return!1}return t=t.replace(/^\[|\]$/g,""),t==="localhost"||t.endsWith(".localhost")||t==="::1"||/^127\./.test(t)||t==="0.0.0.0"||t.endsWith(".local")}function y(o){let{isAgent:t,log:i}=o,n=o.stdout??process.stderr,a=o.stdin??process.stdin,d=e=>{t&&c(e)};return{async runSteps(e){let{default:r}=await import("./react-QWOAB3TB.js"),{render:s}=await import("./build-5ZN47FAT.js"),{TestMdRunView:l}=await import("./TestMdRunView-QLKRUU4V.js"),{ScrollbackProvider:p}=await import("./scrollback-GGNBDFQV.js"),{waitUntilExit:u}=s(r.createElement(p,null,r.createElement(l,e)),{stdout:n,stdin:a,exitOnCtrlC:!1});await u()},async runUpload(e,r){let{renderUploadProgress:s}=await import("./CliUploadProgress-XFRRFRL4.js");return await s(e,r)},async onSummary(e){try{let{default:r}=await import("./react-QWOAB3TB.js"),{render:s}=await import("./build-5ZN47FAT.js"),{AutoExitSummaryBox:l}=await import("./SummaryBox-7PPDMSSM.js"),{waitUntilExit:p}=s(r.createElement(l,{data:e}),{stdout:n,stdin:a});await p()}catch(r){i("warn","TEST_MD_SUMMARY_RENDER_FAILED","Summary box render failed",{error:String(r)})}},async onLinks(e){try{let{default:r}=await import("./react-QWOAB3TB.js"),{render:s}=await import("./build-5ZN47FAT.js"),{LinksBox:l}=await import("./LinksBox-HNDNFVUT.js"),{waitUntilExit:p}=s(r.createElement(l,e),{stdout:n,stdin:a});await p()}catch(r){i("warn","TEST_MD_LINKS_RENDER_FAILED","LinksBox render failed",{error:String(r)})}},onLockState(e){d({type:"test_md_lock_state",...e})},onAdaptiveHeal(e){d({type:"test_md_adaptive_heal",...e})},onAgentEvent(e){d(e)}}}export{m as a,f as b,y as c};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as v,b as P}from"./chunk-TAY7J5VS.js";import{a as x,c as $,d as B,e as k}from"./chunk-GAKBHNC4.js";import{b as F,d as I}from"./chunk-23DKB2MT.js";import{o as j}from"./chunk-7V34ZMMS.js";import{c as M,d as _,e as R}from"./chunk-
|
|
2
|
+
import{a as v,b as P}from"./chunk-TAY7J5VS.js";import{a as x,c as $,d as B,e as k}from"./chunk-GAKBHNC4.js";import{b as F,d as I}from"./chunk-23DKB2MT.js";import{o as j}from"./chunk-7V34ZMMS.js";import{c as M,d as _,e as R}from"./chunk-WE7HRAGO.js";import{a as S}from"./chunk-4C7WVQOD.js";import{existsSync as A,readdirSync as U,readFileSync as D}from"fs";import{join as L}from"path";var H=new Set(["unwritable","unreadable","unresolved"]),K=/^@import\s+(\S+)\s*$/,N=1e3;async function V(e){let i=[];for(let t=e.basePosition+1;t<=e.position;t++)i.push(await e.person.mainRecord(e.projectId,t));return i}async function re(e){try{let i=Array.from({length:Math.max(0,e.landing.position-e.landing.basePosition)},(f,p)=>e.landing.basePosition+1+p),[t,d]=await Promise.all([Promise.all(i.map(f=>e.person.mainRecord(e.projectId,f))),e.person.nodes(e.projectId,"usecase")]),c=new Map(d.flatMap(f=>f.name?[[f.cid,f.name]]:[])),g=new Set;for(let{record:f}of t){for(let l of M(f))l.label==="usecase"&&g.add(l.cid);let p=f.design_of?.uc_cid;typeof p=="string"&&g.add(p);for(let l of f.edges??[])(l.type==="belongs_to"||l.type==="scoped_to")&&typeof l.dst=="string"&&g.add(l.dst)}let w=f=>e.person.mainNode(e.projectId,f).catch(p=>p instanceof S&&p.code==="NOT_FOUND"?null:Promise.reject(p)),h=new Set;for(let f of g){let p=c.get(f);if(p){h.add(p.toLowerCase());continue}let l=await w(f);for(let u=0;l!==null&&l.name===null&&l.supersededBy&&u<N;u++)l=await w(l.supersededBy);l?.label==="usecase"&&l.name&&h.add(l.name.toLowerCase())}return h}catch(i){(e.trace??v("test-manager"))(`the session's use cases couldn't be read after the save: ${P(i)}`);return}}function C(e){let i=e.content.test_md_blob;return typeof i!="string"?[]:i.split(`
|
|
3
3
|
`).flatMap(t=>{let d=K.exec(t.trim());return d?[d[1]]:[]})}async function W(e){let i=new Map,t=new Map,d=new Map,c=new Map;for(let{record:n}of e.records){for(let o of M(n))i.set(o.cid,{label:o.label,content:o.content});for(let{cid:o,slug:r}of _(n))t.set(o,r),d.set(r,o);for(let o of R(n))c.set(o.old,o.new)}let{chainOf:g,tipOf:w}=T(c),h=n=>e.person.mainNode(e.projectId,n).catch(o=>o instanceof S&&o.code==="NOT_FOUND"?null:Promise.reject(o)),f=new Map([...c].flatMap(([n,o])=>o===null?[]:[[o,n]]));for(let[n,o]of[...i]){if(o.label!=="test"||c.has(n))continue;let r=n;for(let y=0;f.has(r)&&!t.has(r)&&y<N;y++)r=f.get(r);if(t.has(r)||i.has(r))continue;let m=await h(r);m===null||m.label!=="test"||!m.name||d.has(m.name)||(i.set(r,{label:m.label,content:m.content}),t.set(r,m.name),d.set(m.name,r))}let p=[...t.keys()].filter(n=>{if(i.get(n)?.label!=="test")return!1;let{later:o,retired:r}=g(n);return!r&&!o.some(m=>t.has(m))}),l=await X({read:h,nodes:i,nameOf:t,byName:d,next:c,tests:p,cwd:e.cwd}),u=e.trace??v("test-files"),s=await z({records:e.records,read:h,nameOf:t,here:[...l.wrote,...l.unchanged??[]],cwd:e.cwd,trace:u}).catch(n=>(u(`the replaced tests' files couldn't be looked for: ${P(n)}`),[])),a=q({tests:p,nodes:i,nameOf:t,tipOf:w,minted:l,cwd:e.cwd,trace:e.trace??v("test-files")});return{...l,saved:p.map(n=>t.get(n)),...s.length>0?{replaced:s}:{},...a?{needed:a}:{}}}function T(e){let i=t=>{let d=[],c=t;for(let g=0;e.has(c)&&g<N;g++){let w=e.get(c);if(w===null)return{later:d,retired:!0};d.push(w),c=w}return{later:d,retired:!1}};return{chainOf:i,tipOf:t=>i(t).later.at(-1)??t}}async function X(e){let{read:i,nodes:t,nameOf:d,byName:c,next:g,tests:w}=e,{chainOf:h,tipOf:f}=T(g),p=w.flatMap(u=>C(t.get(f(u))));for(;p.length>0;){let u=p.pop();if(c.has(u))continue;let s=await i(u);if(s===null||s.label!=="test")continue;let a=s;for(let n=0;a.supersededBy&&n<N;n++){let o=await i(a.supersededBy);if(o===null)throw new Error(`main names ${a.supersededBy} as what replaced ${a.cid}, but doesn't hold it`);a=o}t.set(s.cid,{label:s.label,content:s.content}),t.set(a.cid,{label:a.label,content:a.content}),d.set(s.cid,u),c.set(u,s.cid),a.cid!==s.cid&&g.set(s.cid,a.cid),p.push(...C(t.get(a.cid)))}return I({graph:{nameOf:d,getNode:u=>t.get(u)??null,resolve:u=>{let s=c.get(u)??(t.has(u)?u:void 0);if(s===void 0)return null;let{later:a,retired:n}=h(s),o=a.at(-1)??s;return{cid:s,tip:o,superseded:n||o!==s}}},cids:w,cwd:e.cwd,skipSame:!0,refuseUnwritable:!0,...e.overwriteEdited?{overwriteEdited:!0}:{}})}function q(e){try{let i=new Map([...e.minted.wrote,...e.minted.unchanged??[]].map(d=>[d.id,d.path])),t=x({cwd:e.cwd,tests:e.tests.map(d=>{let c=e.nameOf.get(d);return $(c,e.nodes.get(e.tipOf(d))?.content??{},i.get(c))})});if(t.variables.length===0&&t.noStartPage.length===0)return;try{B(t,e.cwd)}catch(d){e.trace(`the variables the saved tests need couldn't be written to ${t.file}: ${k(d)}`)}return t}catch(i){e.trace(`what the saved tests need couldn't be read: ${k(i)}`);return}}async function z(e){let i=new Map,t=new Map,d=new Set,c=new Map;for(let{record:s}of e.records){for(let r of M(s))d.add(r.cid);for(let r of R(s))c.set(r.old,r.new);for(let r of s.edges??[])r.type!=="verifies"||typeof r.src!="string"||typeof r.dst!="string"||t.set(r.src,(t.get(r.src)??new Set).add(r.dst));let a=s.design_of?.uc_cid;if(typeof a!="string")continue;let n=i.get(a)??{retired:[],made:[]};i.set(a,n);let o=new Set(M(s).flatMap(r=>r.label==="test"?[r.cid]:[]));for(let r of R(s))(r.new===null||r.new!==r.old&&o.has(r.new))&&n.retired.push(r.old);n.made.push(...o)}let g=F(e.cwd);if(![...i.values()].some(s=>s.retired.length>0)||!A(g))return[];let w=new Map(e.here.map(s=>[s.id,s.path])),h=new Set(e.here.map(s=>s.path)),f=new Map;for(let s of U(g)){let a=L(g,s);if(!(!s.endsWith("_test.md")||h.has(a)))try{let n=j(D(a,"utf8"));n?.base&&n.id&&f.set(n.base,{id:n.id,file:a})}catch{}}let p=new Set([...i.values()].flatMap(s=>s.made.flatMap(a=>[...t.get(a)??[]]))),l=async s=>{let a=new Set;for(let n=s,o=0;n&&!a.has(n)&&o<N;o++){if(a.add(n),!c.has(n)&&!p.has(n)&&!d.has(n)){let r=await e.read(n).catch(m=>e.trace(`a criterion's later versions couldn't be read: ${P(m)}`));c.set(n,r?.supersededBy??null)}n=c.get(n)}return a},u=[];for(let{retired:s,made:a}of i.values())for(let n of s){let o=await e.read(n),r=o?.label==="test"?o.content.definitionId:void 0,m=typeof r=="string"?f.get(r):void 0;if(!m||!o)continue;let y=new Set;for(let b of o.edgesOut)if(b.type==="verifies"){b.other&&c.set(b.dst,b.other.supersededBy);for(let O of await l(b.dst))y.add(O)}let E=a.flatMap(b=>{let O=w.get(e.nameOf.get(b)??"");return O&&[...t.get(b)??[]].some(G=>y.has(G))?[O]:[]});u.push({test:m.id,file:m.file,replacedBy:E})}return u}async function ie(e){let i=e.trace??v("test-files");try{let t=await V({person:e.person,projectId:e.projectId,basePosition:e.landing.basePosition,position:e.landing.position}),d=await W({person:e.person,projectId:e.projectId,records:t,cwd:e.cwd,trace:i});for(let c of d.refused)H.has(c.kind)&&i(`test file for ${c.id} not written: ${c.reason}`);return d}catch(t){return i(`main couldn't be read after the save: ${P(t)}`),"unread"}}export{re as a,X as b,ie as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Ee,b as te}from"./chunk-GFLB2SHW.js";import{a as ee}from"./chunk-2TVPA3LL.js";import{c as G}from"./chunk-22PIMG52.js";import{a as z}from"./chunk-RQKMSNEU.js";import{a as v,b as be,d as B,e as Te}from"./chunk-4C7WVQOD.js";import{a as M}from"./chunk-QXQ7KVEN.js";import{a as Se}from"./chunk-OKA6FPJM.js";import{b as we,c as ye,d as Re,e as Z,f as $e}from"./chunk-B57ZRHEQ.js";import{na as ve,oa as P}from"./chunk-PI7OXS62.js";import{g as fe}from"./chunk-UJLULWSR.js";import{basename as wt,relative as ce}from"path";function Vt(e){return e.scope?.state==="finalized"?"saved":e.scope?.state==="discarded"?"discarded":e.ended==="complete"?"ready_to_save":e.ended==="failed"||e.status==="failed"?"failed":e.status==="paused"||e.status==="needs_attention"?"paused":"running"}var ne=["useCases","criteria","scenarios","tests","openQuestions","sources","styleNotes"],H=new Set(["sources","styleNotes"]);function xe(e){return ne.reduce((t,n)=>t+(H.has(n)?0:e[n]??0),0)}var nt=new Set(["NO_CASE","CASE_BROKEN","TEST_FILE_STALE","CASE_ARCHIVED"]),U=e=>typeof e=="string"?e:null;function st(e){let t=e.extra;switch(e.code){case"CASE_BROKEN":return{code:"CASE_BROKEN",session:U(t.session),caseId:U(t.caseId)??"",reason:t.reason==="moved"?"moved":"deleted"};case"CASE_ARCHIVED":return{code:"CASE_ARCHIVED",caseId:U(t.caseId)??"",internalId:U(t.internalId)??""};default:return{code:e.code,session:U(t.session),useCase:U(t.useCase)}}}function Jt(e){return(Array.isArray(e.nodes)?e.nodes:[]).filter(n=>typeof n.cid=="string"&&typeof n.label=="string").map(n=>({cid:n.cid,label:n.label,content:typeof n.content=="object"&&n.content!==null?n.content:{}}))}function qt(e){return(Array.isArray(e.names)?e.names:[]).filter(n=>typeof n.cid=="string"&&typeof n.slug=="string").map(n=>({cid:n.cid,slug:n.slug}))}function Kt(e){return(Array.isArray(e.supersessions)?e.supersessions:[]).filter(n=>n.kind==="node"&&typeof n.old=="string").map(n=>({old:n.old,new:typeof n.new=="string"?n.new:null}))}function Yt(e){let{request:t,exchange:n}=B(e),o=(s,r)=>`/v1/projects/${encodeURIComponent(s)}/uploads/${r}`,d=s=>`/v1/sessions/${encodeURIComponent(s)}`,a=async(s,r=null)=>{let l=[],g=r;do{let c=await t("GET",`${s}${g===null?"":`&after=${encodeURIComponent(g)}`}`);l.push(...c.items),g=c.next}while(g!==null);return l},i=async(s,r)=>{let l=await t("GET",`/v1/projects/${encodeURIComponent(s)}/sessions/${encodeURIComponent(r)}`),{proposes:g,heldChanges:c,changes:p,approves:u,archives:m,removes:w,chatTurns:h,uncounted:f}=l.drafts;return{proposes:g,heldChanges:c??0,changes:p??{},approves:u??{},archives:m??{},removes:w??{},chatTurns:h??0,uncounted:typeof f=="number"?f:null}};return{async*projects(){for(let s=1;s!==null;){let r=await t("GET",`/v1/projects?page=${s}`);r.items.length>0&&(yield r.items.map(({projectId:l,name:g,marked:c})=>({projectId:l,name:g,marked:c}))),s=r.next}},async project(s){let l=(await t("GET",`/v1/projects?projectId=${encodeURIComponent(s)}`)).items.find(g=>g.projectId===s);return l===void 0?null:{projectId:s,marked:l.marked===!0,mainPosition:l.context?.mainPosition??null}},async testCase(s,r,l){try{let g=await t("GET",`/v1/projects/${encodeURIComponent(s)}/tests/${encodeURIComponent(r)}/case?base=${encodeURIComponent(l)}`),{test:c,scenario:p,useCase:u,caseId:m,internalId:w,title:h,current:f,counts:$,canAttach:S}=g;return{linked:{test:c,scenario:p,useCase:u,caseId:m,internalId:w,title:h,current:f,counts:$,canAttach:S}}}catch(g){if(g instanceof v&&g.status===409&&nt.has(g.code))return{refused:st(g)};throw g}},async testCases(s){let r=await t("GET",`/v1/projects/${encodeURIComponent(s)}/graph?project=1&types=testCase`),l=g=>g.linkState==="linked"&&typeof g.internalId=="string"&&/^TC-\d+$/.test(g.internalId)?g.internalId:null;return new Map(r.nodes.filter(g=>g.type==="testCase").map(g=>[g.id,l(g.data)]))},async createSession(s){return(await t("POST","/v1/sessions",s)).session},async sources(s){let r=[],l=null;do{let g=`limit=1000${l===null?"":`&after=${encodeURIComponent(l)}`}`,c=await t("GET",`/v1/internal/projects/${encodeURIComponent(s)}/sources?${g}`);r.push(...c.items.map(({sourceId:p,head:u,completeness:m,origin:w,media:h})=>({sourceId:p,head:u,completeness:m,...w!==void 0?{origin:w}:{},...h!==void 0?{media:h}:{}}))),l=c.next}while(l!==null);return r},async mainRecord(s,r){let l=await t("GET",`/v1/internal/projects/${encodeURIComponent(s)}/positions/${r}`);return{position:l.position,record:l.record}},async mainNode(s,r){let l=await t("GET",`/v1/internal/projects/${encodeURIComponent(s)}/nodes/${encodeURIComponent(r)}`);return{cid:l.cid,name:l.name,label:l.label,content:l.content??{},supersededBy:l.supersededBy??null,edgesOut:(l.edgesOut??[]).map(({type:g,dst:c,other:p})=>({type:g,dst:c,other:p??null}))}},nodes:(s,r)=>a(`/v1/internal/projects/${encodeURIComponent(s)}/nodes?label=${encodeURIComponent(r)}&limit=1000`),async testsWithContent(s){let r=`/v1/internal/projects/${encodeURIComponent(s)}/nodes?label=test&content=1&limit=200`,l;try{l=await t("GET",r)}catch(c){if(c instanceof v&&c.status===400&&c.code==="BAD_REQUEST"&&c.message.includes('Unrecognized key: "content"'))return null;throw c}let g=l.next===null?[]:await a(r,l.next);return[...l.items,...g].map(c=>({...c,content:c.content??{}}))},edges:(s,r)=>a(`/v1/internal/projects/${encodeURIComponent(s)}/edges?type=${encodeURIComponent(r)}&limit=1000`),stale:s=>a(`/v1/internal/projects/${encodeURIComponent(s)}/stale?limit=1000`),async listSessions(s,r={}){let l=[],g=null,c=`${r.sourceId?`&sourceId=${encodeURIComponent(r.sourceId)}`:""}${r.useCase?`&useCase=${encodeURIComponent(r.useCase)}`:""}`;do{let p=`projectId=${encodeURIComponent(s)}${c}${g===null?"":`&after=${encodeURIComponent(g)}`}`,u=await t("GET",`/v1/sessions?${p}`);l.push(...u.items),g=u.next}while(g!==null);return l},getSession:s=>t("GET",d(s)),setStatus:(s,r)=>t("PATCH",d(s),{status:r}),land:(s,r)=>t("POST",`${d(s)}/land`,{generation:r}),discard:(s,r)=>t("POST",`${d(s)}/discard`,r===void 0?{}:{generation:r}),proposes:async(s,r)=>(await i(s,r)).proposes,counts:i,openUpload:(s,r)=>t("POST",`/v1/projects/${encodeURIComponent(s)}/uploads`,r),putUpload:async(s,r,l,g)=>{let{response:c,bytes:p}=await n("PUT",s,l,{headers:r,route:"PUT upload",...g?{onSend:g}:{}}),u=c.headers.get("etag");if(p.length>0)try{let m=JSON.parse(p.toString("utf8"));typeof m.etag=="string"&&(u=m.etag)}catch{}if(!u)throw new v(c.status,"BAD_RESPONSE","the upload's store answered no etag");return{etag:u}},completeUpload:(s,r,l)=>t("POST",`${o(s,r)}/complete`,{etag:l}),getUpload:(s,r)=>t("GET",o(s,r)),uploadResult:(s,r,l)=>t("POST",`${o(s,r)}/result`,l),async projectCoverage(s){let{state:r,doc:l}=await t("GET",`/v1/projects/${encodeURIComponent(s)}/coverage`);return{state:r,doc:l}},async coverageRun(s,r){return{pack:(await t("POST",`/v1/projects/${encodeURIComponent(s)}/coverage/run`,r)).pack}}}}import{isMainThread as lt}from"worker_threads";import{createHash as dt}from"crypto";function se(e){return e instanceof Error?e.message:String(e)}var ke="SUPERSEDED_WRITER",en="LEASE_LAPSED";function tn(e){let t=`/v1/sessions/${encodeURIComponent(e.sessionId)}/host`,{exchange:n,request:o}=B(e),d=i=>i===null?"limit=1000":`after=${encodeURIComponent(i)}&limit=1000`,a=i=>i===void 0?t:`${t}/children/${encodeURIComponent(i)}`;return{claim:()=>o("POST",`${t}/claim`,{forms:1}),session:()=>o("GET",t),renewLease:i=>o("POST",`${t}/lease`,{generation:i}),save:i=>o("PATCH",t,i),checkpointRows:i=>o("GET",`${a(i)}/checkpoints`,void 0,!0),async readCheckpointRow(i,s){return(await o("GET",`${a(s)}/checkpoints/${i}`,void 0,!0)).text},async writeCheckpointRow(i,s,r,{ifAbsent:l=!1,childId:g}={}){let c=`${a(g)}/checkpoints/${s}${l?"?ifAbsent=true":""}`;return(await o("PUT",c,{generation:i,text:r})).stored},async removeCheckpointRow(i,s,r){await o("DELETE",`${a(r)}/checkpoints/${s}?generation=${i}`)},registerChild:(i,s,r)=>o("POST",`${t}/children`,{generation:i,childId:s,...r?{useCase:r}:{}}),async sessionSide(){return(await o("GET",`${t}/side`)).text},async putSessionSide(i,s){await o("PUT",`${t}/side`,{generation:i,text:s})},saveChildPointer:(i,s,r,l)=>o("PATCH",a(s),{generation:i,checkpoint:r,state:l}),async sessionState(i){let{text:s}=await o("GET",`${a(i)}/state`);return s===null?null:JSON.parse(s)},async putSessionState(i,s,r){await o("PUT",`${a(r)}/state`,{generation:i,text:JSON.stringify(s)})},scope:()=>o("GET",`${t}/scope`),draftsPage:i=>o("GET",`${t}/scope/drafts?${d(i)}`,void 0,!0),appendDraft:(i,s)=>o("POST",`${t}/scope/drafts`,{generation:i,...s}),mainNodes:(i,s)=>o("POST",`${t}/main/nodes`,{position:i,cids:s}),async mainHistory(){let{response:i,bytes:s}=await n("GET",`${t}/main/history`,void 0,{headers:{"accept-encoding":"gzip"},bulk:!0}),r=Number(i.headers.get("lattice-history-position")),l=i.headers.get("lattice-history-hash");if(!Number.isInteger(r)||r<0||!l)throw new v(i.status,"UNEXPECTED_ANSWER",`GET ${t}/main/history answered without its Lattice-History-Position and Lattice-History-Hash headers`);return{position:r,hash:l,forms:be(i,"lattice-history-forms"),json:s}},async getBlob(i){try{return(await n("GET",`${t}/blobs/${encodeURIComponent(i)}`,void 0,{bulk:!0})).bytes}catch(s){if(s instanceof v&&s.code==="NOT_FOUND")return null;throw s}},putBlob:(i,s)=>o("PUT",`${t}/blobs?generation=${i}`,s),async files(i){return(await o("GET",`${t}/files?prefix=${encodeURIComponent(i)}`)).items},async readFile(i){try{let{response:s,bytes:r}=await n("GET",`${t}/file?name=${encodeURIComponent(i)}`,void 0,{bulk:!0}),l=Number(s.headers.get("lattice-file-version"));if(!Number.isInteger(l)||l<1)throw new v(s.status,"UNEXPECTED_ANSWER",`GET ${t}/file answered ${i} without a Lattice-File-Version header`);return{text:r.toString("utf8"),version:l}}catch(s){if(s instanceof v&&s.code==="NOT_FOUND")return null;throw s}},async embeddings(i,s){let r=`alias=${encodeURIComponent(i)}&purpose=${encodeURIComponent(s)}`,{bytes:l}=await n("GET",`${t}/embeddings?${r}`,void 0,{headers:{"accept-encoding":"gzip"},bulk:!0});return JSON.parse(l.toString("utf8"))},putEmbeddings:(i,s)=>o("POST",`${t}/embeddings`,{generation:i,...s}),putFile:(i,s,r,l)=>o("PUT",`${t}/file?name=${encodeURIComponent(s)}&generation=${i}&version=${r}`,l),appendEvents:(i,s)=>o("POST",`${t}/events`,{generation:i,events:s}),async eventsAfter(i){let s=[],r=null;do{let l=r===null?`after=${i}&limit=1000`:`after=${encodeURIComponent(r)}&limit=1000`,g=await o("GET",`${t}/events?${l}`);s.push(...g.items),r=g.next}while(r!==null);return s}}}var re="the session cannot go on: the project's context is being imported; it is served once an import of it completes",ot=5*6e4,Ce=2e3,it=15e3;function _e(e){return e instanceof v&&e.code==="CONTEXT_IMPORTING"}function Ie(){return new v(409,"CONTEXT_IMPORTING",re)}function on(e={}){let t=e.sleep??(a=>new Promise(i=>setTimeout(i,a))),n=e.budgetMs??ot,o=0,d=Ce;return{async wait(){let a=n-o;if(a<=0)return!1;let i=Math.min(d,a);return await t(i),o+=i,d=Math.min(d*2,it),!0},answered(){o=0,d=Ce}}}var R={scope:"store.scope",mainNodes:"store.mainNodes",mainNodesAhead:"store.mainNodesAhead",mainHistory:"store.mainHistory",drafts:"store.drafts",appendDraft:"store.appendDraft",vectorsRead:"store.vectorsRead",vectorsWrite:"store.vectorsWrite",getBlob:"store.getBlob",putBlob:"store.putBlob",chainRead:"chain.read",chainList:"chain.list",chainWrite:"chain.write",chainWriteIfAbsent:"chain.writeIfAbsent",chainRemove:"chain.remove",filesRead:"files.read",filesList:"files.list",filesWrite:"files.write",pointer:"session.pointer",stateGet:"session.stateGet",statePut:"session.statePut",acknowledge:"session.acknowledge",registerChild:"session.registerChild",children:"session.children",sideGet:"session.sideGet",sideSave:"session.sideSave"};var Pe=3e4,D=class extends Error{constructor(n,o,d,a=null){super(`Lattice refused ${n} (${o}): ${d}`);this.op=n;this.code=o;this.requestId=a;this.name="StepRefusedError"}};function ct(e){return e.status!==0?"not_ready":/no answer within/.test(e.message)?"timeout":"unreachable"}var Oe=new Set([ke,"SESSION_ENDED","PROJECT_NOT_MARKED"]);function fn(e,t){let n=t.sleep??(c=>new Promise(p=>setTimeout(p,c))),o=t.retryDeadlineMs??12e4,d=new Map((t.children??[]).map(c=>[c.childId,c.checkpoint?.pointer??null]));async function a(c,p){let u=Te(o,n,t.now);for(;;)try{let m=await p();return t.imports?.answered(),m}catch(m){if(!(m instanceof v))throw m;if(_e(m)&&t.imports){if(await t.imports.wait())continue;throw t.onStopped?.(Ie()),te(new Error(`Lattice refused ${c}: ${re}`),m)}if(Oe.has(m.code)&&t.onStopped?.(m),!m.retryable)throw new D(c,m.code,m.message,m.requestId);let w=h=>t.onRetry?.({op:c,attempt:u.attempt,nextInMs:h,giveUpAt:u.endsAt()??0,cause:ct(m)});if(!await u.again(w))throw t.onStopped?.(new v(m.status,m.code,`Lattice did not take ${c} within ${o/1e3} s: ${m.message}`,null,null,{},m.requestId)),te(new Error(`Lattice refused ${c} (${m.code}, still after ${o/1e3} s): ${m.message}`),m)}}async function i(c,p){try{return await p()}catch(u){throw u instanceof v?(Oe.has(u.code)&&t.onStopped?.(u),new D(c,u.code,u.message,u.requestId)):u}}async function s(c,p){let u=R.acknowledge,m=t.log;if(!m)throw new Error("the checkpoint barrier needs the session log, and this host gave it none");let w=Date.now()+Pe;for(;m.lastSeq()<c.eventSeq;){if(Date.now()>w)throw new Error(`the session log reached event ${m.lastSeq()}, not ${c.eventSeq}, within ${Pe/1e3} s; the checkpoint is not acknowledged`);await n(5)}await ut(m.flush(),o),await a(u,()=>e.writeCheckpointRow(t.generation,`side-${c.pointer.seq}.json`,JSON.stringify(c.side),{childId:p}));let h={pointer:c.pointer,covers:{eventSeq:c.eventSeq,scope:c.scope}},f=JSON.stringify(c.state);p===void 0?await a(u,()=>e.save({generation:t.generation,checkpoint:h,state:f})):d.set(p,(await a(u,()=>e.saveChildPointer(t.generation,p,h,f))).checkpoint.pointer)}async function r(){let c=await a(R.mainHistory,()=>e.mainHistory()),p=dt("sha256").update(c.json).digest("hex");if(p!==c.hash)throw new Error(`main's history from Lattice hashes to ${p}, not to ${c.hash}, the hash Lattice gave for it`);if(t.historyForms!==void 0&&c.forms!==t.historyForms){let u=`main's history pack was built at engine forms ${c.forms??"none named"}, not at ${t.historyForms}, the forms of the Lattice that took this host's claim: another Lattice served it`;throw t.onStopped?.(new v(409,"HISTORY_FORMS_MISMATCH",u)),new Error(u)}return c.json.toString("utf8")}let l=new Map,g=c=>`${Number(c.position)}:${c.cids.join(",")}`;return async(c,p)=>{let u=p??{},m=u.after??null,w=typeof u.childId=="string"?u.childId:void 0;switch(c){case R.scope:return await a(c,()=>e.scope());case R.mainHistory:return{json:await r()};case R.mainNodesAhead:{let h=e.mainNodes(Number(u.position),u.cids);return h.catch(()=>{}),l.set(g(u),h),null}case R.mainNodes:{let h=l.get(g(u));if(l.delete(g(u)),h)try{return await h}catch{}return await a(c,()=>e.mainNodes(Number(u.position),u.cids))}case R.drafts:return await a(c,()=>e.draftsPage(m));case R.appendDraft:{let h={eventId:u.eventId??null,record:u.record??null,envelope:u.envelope??null};return await a(c,()=>e.appendDraft(t.generation,h))}case R.filesRead:return(await a(c,()=>e.readFile(W(u.name))))?.text??null;case R.filesList:{let h=`${W(u.folder)}/`;return(await a(c,()=>e.files(h))).map($=>$.name.slice(h.length)).filter($=>!$.includes("/"))}case R.filesWrite:{if(!String(u.name).startsWith("rationale/"))throw new Error(`the host writes only test rationales; ${W(u.name)} is a configuration file, written by an operator`);try{return await a(c,()=>e.putFile(t.generation,W(u.name),0,Buffer.from(String(u.text),"utf8"))),{written:!0}}catch(h){if(/\(FILE_CHANGED\)/.test(se(h)))return{written:!1,message:se(h)};throw h}}case R.vectorsRead:return await i(c,()=>e.embeddings(String(u.alias),String(u.purpose)));case R.vectorsWrite:{let h={alias:String(u.alias),purpose:String(u.purpose),dims:Number(u.dims),vectors:u.vectors??{}};return await i(c,()=>e.putEmbeddings(t.generation,h))}case R.getBlob:{let h=await a(c,()=>e.getBlob(String(u.fingerprint)));return{bytes:h===null?null:h.toString("base64")}}case R.putBlob:return await a(c,()=>e.putBlob(t.generation,Buffer.from(String(u.bytes),"base64")));case R.chainRead:return await a(c,()=>e.readCheckpointRow(String(u.name),w));case R.chainList:return await a(c,()=>e.checkpointRows(w));case R.chainWrite:return await a(c,()=>e.writeCheckpointRow(t.generation,String(u.name),String(u.text),{childId:w})),null;case R.chainWriteIfAbsent:return await a(c,()=>e.writeCheckpointRow(t.generation,String(u.name),String(u.text),{ifAbsent:!0,childId:w}));case R.chainRemove:return await a(c,()=>e.removeCheckpointRow(t.generation,String(u.name),w)),null;case R.pointer:return w!==void 0?d.get(w)??null:(await a(c,()=>e.session())).checkpoint?.pointer??null;case R.stateGet:return await a(c,()=>e.sessionState(w));case R.statePut:return await a(c,()=>e.putSessionState(t.generation,u.state??null,w)),null;case R.acknowledge:return await s(u,w),null;case R.children:return[...(t.children??[]).map(h=>h.childId)];case R.sideGet:return await a(c,()=>e.sessionSide());case R.sideSave:return await a(c,()=>e.putSessionSide(t.generation,String(u.text))),{saved:!0};case R.registerChild:{let h=typeof u.useCase=="string"?u.useCase:void 0,f=await a(c,async()=>{try{return await e.registerChild(t.generation,String(u.childId),h)}catch($){throw $ instanceof v&&$.code==="SESSION_CLASH"?new Ee($.message,$.code,{heldBy:$.extra.heldBy??null},$.requestId):$}});return d.set(f.childId,f.checkpoint?.pointer??null),null}default:throw new Error(`the session thread asked for ${c}, which the main thread does not answer`)}}}function W(e){return`design/${String(e)}`}async function ut(e,t){let n,o=new Promise((d,a)=>{n=setTimeout(()=>a(new Error(`the session's events were not stored within ${t/1e3} s; the checkpoint is not acknowledged`)),t)});try{await Promise.race([e,o])}finally{clearTimeout(n)}}var x={verb:"remote",mode:"interactive"},oe=null,Ne=new Set;function Tn(e){x={...x,...e}}function V(e,t){return Ae(e,t),z()}function Ae(e,t){if(!(!Z()||Ne.has(e))){Ne.add(e);try{oe??=$e({verb:x.verb,mode:x.mode,contextRoot:null,env:Re(),sessionId:z(),errorsOnly:!0}),Object.assign(oe.ids,{...x.projectId?{project_id:x.projectId}:{},...x.latticeSessionId?{lattice_session_id:x.latticeSessionId}:{}}),oe.spoolError(e,t?{request_id:t}:{})}catch{}}}function gt(e){return e instanceof v||e instanceof D?`lattice_${e.code}`:"cli_crash"}function mt(e){let t=e?.requestId;return typeof t=="string"&&t?t:null}async function ht(){!Z()||!lt||await Promise.race([fe(ye()).catch(()=>{}),new Promise(e=>setTimeout(e,we).unref())])}async function xn(e,t){return e instanceof v&&Ae(gt(e),mt(e)),await ht(),t}import{isAbsolute as pt,relative as De}from"path";var k=e=>" ".repeat(e);function ft(e){return e.length<2?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}var J=e=>e===1?"this test runs":"these tests run";function Ue(e,t,n){if(n===void 0||t+e.length<=n)return[k(t)+e];let o=[],d="";for(let a of e.split(" "))d&&t+d.length+1+a.length>n?(o.push(k(t)+d),d=a):d=d?`${d} ${a}`:a;return[...o,k(t)+d]}function _n(e,t){let n=e.variables.length;if(n===0)return[];let o=n===1?`\u2692 1 variable needs a value before ${J(t.tests)}; fill it in:`:`\u2692 ${n} variables need values before ${J(t.tests)}; fill them in:`,d=[k(t.indent)+o,k(t.indent+4)+(De(t.cwd,e.file)||e.file)],a=e.variables.filter(i=>i.start_page).map(i=>i.name);return a.length===1?d.push(...Ue(`${a[0]} is the page ${t.tests===1?"it starts":"they start"} on`,t.indent+4,t.columns)):a.length>1&&d.push(...Ue(`${ft(a)} are the pages they start on`,t.indent+4,t.columns)),d}function Le(e,t){let n=t.cwd??process.cwd(),o=s=>pt(s)&&De(n,s)||s,d=e.length;if(d===0)return[];let a=d===1?"\u2692 1 test has no start page yet, so it can't run as it is:":`\u2692 ${d} tests have no start page yet, so they can't run as they are:`,i=d===1?"name the page in its first step, or run it with --url <the page>":"name the page in each one's first step, or run them with --url <the page>";return[k(t.indent)+a,...e.map(s=>k(t.indent+4)+(s.file?o(s.file):`${s.test} ${s.title}`)),k(t.indent+4)+i]}function je(e,t){let n=e.variables.length,o=e.noStartPage.length;return[...n===0?[]:[n===1?`1 variable needs a value before ${J(t.tests)}`:`${n} variables need values before ${J(t.tests)}`],...o===0?[]:[o===1?"1 test has no start page yet":`${o} tests have no start page yet`]]}function Bn(e,t="--mode agent"){if(!e.next)return e.remedy?{remedy:e.remedy}:{};let n=(e.remedy??"").split(`
|
|
2
|
+
import{a as Ee,b as te}from"./chunk-GFLB2SHW.js";import{a as ee}from"./chunk-2TVPA3LL.js";import{c as G}from"./chunk-22PIMG52.js";import{a as z}from"./chunk-RQKMSNEU.js";import{a as v,b as be,d as B,e as Te}from"./chunk-4C7WVQOD.js";import{a as M}from"./chunk-QXQ7KVEN.js";import{a as Se}from"./chunk-Z47ZEFH7.js";import{b as we,c as ye,d as Re,e as Z,f as $e}from"./chunk-7YV2FCN4.js";import{na as ve,oa as P}from"./chunk-PI7OXS62.js";import{g as fe}from"./chunk-UJLULWSR.js";import{basename as wt,relative as ce}from"path";function Vt(e){return e.scope?.state==="finalized"?"saved":e.scope?.state==="discarded"?"discarded":e.ended==="complete"?"ready_to_save":e.ended==="failed"||e.status==="failed"?"failed":e.status==="paused"||e.status==="needs_attention"?"paused":"running"}var ne=["useCases","criteria","scenarios","tests","openQuestions","sources","styleNotes"],H=new Set(["sources","styleNotes"]);function xe(e){return ne.reduce((t,n)=>t+(H.has(n)?0:e[n]??0),0)}var nt=new Set(["NO_CASE","CASE_BROKEN","TEST_FILE_STALE","CASE_ARCHIVED"]),U=e=>typeof e=="string"?e:null;function st(e){let t=e.extra;switch(e.code){case"CASE_BROKEN":return{code:"CASE_BROKEN",session:U(t.session),caseId:U(t.caseId)??"",reason:t.reason==="moved"?"moved":"deleted"};case"CASE_ARCHIVED":return{code:"CASE_ARCHIVED",caseId:U(t.caseId)??"",internalId:U(t.internalId)??""};default:return{code:e.code,session:U(t.session),useCase:U(t.useCase)}}}function Jt(e){return(Array.isArray(e.nodes)?e.nodes:[]).filter(n=>typeof n.cid=="string"&&typeof n.label=="string").map(n=>({cid:n.cid,label:n.label,content:typeof n.content=="object"&&n.content!==null?n.content:{}}))}function qt(e){return(Array.isArray(e.names)?e.names:[]).filter(n=>typeof n.cid=="string"&&typeof n.slug=="string").map(n=>({cid:n.cid,slug:n.slug}))}function Kt(e){return(Array.isArray(e.supersessions)?e.supersessions:[]).filter(n=>n.kind==="node"&&typeof n.old=="string").map(n=>({old:n.old,new:typeof n.new=="string"?n.new:null}))}function Yt(e){let{request:t,exchange:n}=B(e),o=(s,r)=>`/v1/projects/${encodeURIComponent(s)}/uploads/${r}`,d=s=>`/v1/sessions/${encodeURIComponent(s)}`,a=async(s,r=null)=>{let l=[],g=r;do{let c=await t("GET",`${s}${g===null?"":`&after=${encodeURIComponent(g)}`}`);l.push(...c.items),g=c.next}while(g!==null);return l},i=async(s,r)=>{let l=await t("GET",`/v1/projects/${encodeURIComponent(s)}/sessions/${encodeURIComponent(r)}`),{proposes:g,heldChanges:c,changes:p,approves:u,archives:m,removes:w,chatTurns:h,uncounted:f}=l.drafts;return{proposes:g,heldChanges:c??0,changes:p??{},approves:u??{},archives:m??{},removes:w??{},chatTurns:h??0,uncounted:typeof f=="number"?f:null}};return{async*projects(){for(let s=1;s!==null;){let r=await t("GET",`/v1/projects?page=${s}`);r.items.length>0&&(yield r.items.map(({projectId:l,name:g,marked:c})=>({projectId:l,name:g,marked:c}))),s=r.next}},async project(s){let l=(await t("GET",`/v1/projects?projectId=${encodeURIComponent(s)}`)).items.find(g=>g.projectId===s);return l===void 0?null:{projectId:s,marked:l.marked===!0,mainPosition:l.context?.mainPosition??null}},async testCase(s,r,l){try{let g=await t("GET",`/v1/projects/${encodeURIComponent(s)}/tests/${encodeURIComponent(r)}/case?base=${encodeURIComponent(l)}`),{test:c,scenario:p,useCase:u,caseId:m,internalId:w,title:h,current:f,counts:$,canAttach:S}=g;return{linked:{test:c,scenario:p,useCase:u,caseId:m,internalId:w,title:h,current:f,counts:$,canAttach:S}}}catch(g){if(g instanceof v&&g.status===409&&nt.has(g.code))return{refused:st(g)};throw g}},async testCases(s){let r=await t("GET",`/v1/projects/${encodeURIComponent(s)}/graph?project=1&types=testCase`),l=g=>g.linkState==="linked"&&typeof g.internalId=="string"&&/^TC-\d+$/.test(g.internalId)?g.internalId:null;return new Map(r.nodes.filter(g=>g.type==="testCase").map(g=>[g.id,l(g.data)]))},async createSession(s){return(await t("POST","/v1/sessions",s)).session},async sources(s){let r=[],l=null;do{let g=`limit=1000${l===null?"":`&after=${encodeURIComponent(l)}`}`,c=await t("GET",`/v1/internal/projects/${encodeURIComponent(s)}/sources?${g}`);r.push(...c.items.map(({sourceId:p,head:u,completeness:m,origin:w,media:h})=>({sourceId:p,head:u,completeness:m,...w!==void 0?{origin:w}:{},...h!==void 0?{media:h}:{}}))),l=c.next}while(l!==null);return r},async mainRecord(s,r){let l=await t("GET",`/v1/internal/projects/${encodeURIComponent(s)}/positions/${r}`);return{position:l.position,record:l.record}},async mainNode(s,r){let l=await t("GET",`/v1/internal/projects/${encodeURIComponent(s)}/nodes/${encodeURIComponent(r)}`);return{cid:l.cid,name:l.name,label:l.label,content:l.content??{},supersededBy:l.supersededBy??null,edgesOut:(l.edgesOut??[]).map(({type:g,dst:c,other:p})=>({type:g,dst:c,other:p??null}))}},nodes:(s,r)=>a(`/v1/internal/projects/${encodeURIComponent(s)}/nodes?label=${encodeURIComponent(r)}&limit=1000`),async testsWithContent(s){let r=`/v1/internal/projects/${encodeURIComponent(s)}/nodes?label=test&content=1&limit=200`,l;try{l=await t("GET",r)}catch(c){if(c instanceof v&&c.status===400&&c.code==="BAD_REQUEST"&&c.message.includes('Unrecognized key: "content"'))return null;throw c}let g=l.next===null?[]:await a(r,l.next);return[...l.items,...g].map(c=>({...c,content:c.content??{}}))},edges:(s,r)=>a(`/v1/internal/projects/${encodeURIComponent(s)}/edges?type=${encodeURIComponent(r)}&limit=1000`),stale:s=>a(`/v1/internal/projects/${encodeURIComponent(s)}/stale?limit=1000`),async listSessions(s,r={}){let l=[],g=null,c=`${r.sourceId?`&sourceId=${encodeURIComponent(r.sourceId)}`:""}${r.useCase?`&useCase=${encodeURIComponent(r.useCase)}`:""}`;do{let p=`projectId=${encodeURIComponent(s)}${c}${g===null?"":`&after=${encodeURIComponent(g)}`}`,u=await t("GET",`/v1/sessions?${p}`);l.push(...u.items),g=u.next}while(g!==null);return l},getSession:s=>t("GET",d(s)),setStatus:(s,r)=>t("PATCH",d(s),{status:r}),land:(s,r)=>t("POST",`${d(s)}/land`,{generation:r}),discard:(s,r)=>t("POST",`${d(s)}/discard`,r===void 0?{}:{generation:r}),proposes:async(s,r)=>(await i(s,r)).proposes,counts:i,openUpload:(s,r)=>t("POST",`/v1/projects/${encodeURIComponent(s)}/uploads`,r),putUpload:async(s,r,l,g)=>{let{response:c,bytes:p}=await n("PUT",s,l,{headers:r,route:"PUT upload",...g?{onSend:g}:{}}),u=c.headers.get("etag");if(p.length>0)try{let m=JSON.parse(p.toString("utf8"));typeof m.etag=="string"&&(u=m.etag)}catch{}if(!u)throw new v(c.status,"BAD_RESPONSE","the upload's store answered no etag");return{etag:u}},completeUpload:(s,r,l)=>t("POST",`${o(s,r)}/complete`,{etag:l}),getUpload:(s,r)=>t("GET",o(s,r)),uploadResult:(s,r,l)=>t("POST",`${o(s,r)}/result`,l),async projectCoverage(s){let{state:r,doc:l}=await t("GET",`/v1/projects/${encodeURIComponent(s)}/coverage`);return{state:r,doc:l}},async coverageRun(s,r){return{pack:(await t("POST",`/v1/projects/${encodeURIComponent(s)}/coverage/run`,r)).pack}}}}import{isMainThread as lt}from"worker_threads";import{createHash as dt}from"crypto";function se(e){return e instanceof Error?e.message:String(e)}var ke="SUPERSEDED_WRITER",en="LEASE_LAPSED";function tn(e){let t=`/v1/sessions/${encodeURIComponent(e.sessionId)}/host`,{exchange:n,request:o}=B(e),d=i=>i===null?"limit=1000":`after=${encodeURIComponent(i)}&limit=1000`,a=i=>i===void 0?t:`${t}/children/${encodeURIComponent(i)}`;return{claim:()=>o("POST",`${t}/claim`,{forms:1}),session:()=>o("GET",t),renewLease:i=>o("POST",`${t}/lease`,{generation:i}),save:i=>o("PATCH",t,i),checkpointRows:i=>o("GET",`${a(i)}/checkpoints`,void 0,!0),async readCheckpointRow(i,s){return(await o("GET",`${a(s)}/checkpoints/${i}`,void 0,!0)).text},async writeCheckpointRow(i,s,r,{ifAbsent:l=!1,childId:g}={}){let c=`${a(g)}/checkpoints/${s}${l?"?ifAbsent=true":""}`;return(await o("PUT",c,{generation:i,text:r})).stored},async removeCheckpointRow(i,s,r){await o("DELETE",`${a(r)}/checkpoints/${s}?generation=${i}`)},registerChild:(i,s,r)=>o("POST",`${t}/children`,{generation:i,childId:s,...r?{useCase:r}:{}}),async sessionSide(){return(await o("GET",`${t}/side`)).text},async putSessionSide(i,s){await o("PUT",`${t}/side`,{generation:i,text:s})},saveChildPointer:(i,s,r,l)=>o("PATCH",a(s),{generation:i,checkpoint:r,state:l}),async sessionState(i){let{text:s}=await o("GET",`${a(i)}/state`);return s===null?null:JSON.parse(s)},async putSessionState(i,s,r){await o("PUT",`${a(r)}/state`,{generation:i,text:JSON.stringify(s)})},scope:()=>o("GET",`${t}/scope`),draftsPage:i=>o("GET",`${t}/scope/drafts?${d(i)}`,void 0,!0),appendDraft:(i,s)=>o("POST",`${t}/scope/drafts`,{generation:i,...s}),mainNodes:(i,s)=>o("POST",`${t}/main/nodes`,{position:i,cids:s}),async mainHistory(){let{response:i,bytes:s}=await n("GET",`${t}/main/history`,void 0,{headers:{"accept-encoding":"gzip"},bulk:!0}),r=Number(i.headers.get("lattice-history-position")),l=i.headers.get("lattice-history-hash");if(!Number.isInteger(r)||r<0||!l)throw new v(i.status,"UNEXPECTED_ANSWER",`GET ${t}/main/history answered without its Lattice-History-Position and Lattice-History-Hash headers`);return{position:r,hash:l,forms:be(i,"lattice-history-forms"),json:s}},async getBlob(i){try{return(await n("GET",`${t}/blobs/${encodeURIComponent(i)}`,void 0,{bulk:!0})).bytes}catch(s){if(s instanceof v&&s.code==="NOT_FOUND")return null;throw s}},putBlob:(i,s)=>o("PUT",`${t}/blobs?generation=${i}`,s),async files(i){return(await o("GET",`${t}/files?prefix=${encodeURIComponent(i)}`)).items},async readFile(i){try{let{response:s,bytes:r}=await n("GET",`${t}/file?name=${encodeURIComponent(i)}`,void 0,{bulk:!0}),l=Number(s.headers.get("lattice-file-version"));if(!Number.isInteger(l)||l<1)throw new v(s.status,"UNEXPECTED_ANSWER",`GET ${t}/file answered ${i} without a Lattice-File-Version header`);return{text:r.toString("utf8"),version:l}}catch(s){if(s instanceof v&&s.code==="NOT_FOUND")return null;throw s}},async embeddings(i,s){let r=`alias=${encodeURIComponent(i)}&purpose=${encodeURIComponent(s)}`,{bytes:l}=await n("GET",`${t}/embeddings?${r}`,void 0,{headers:{"accept-encoding":"gzip"},bulk:!0});return JSON.parse(l.toString("utf8"))},putEmbeddings:(i,s)=>o("POST",`${t}/embeddings`,{generation:i,...s}),putFile:(i,s,r,l)=>o("PUT",`${t}/file?name=${encodeURIComponent(s)}&generation=${i}&version=${r}`,l),appendEvents:(i,s)=>o("POST",`${t}/events`,{generation:i,events:s}),async eventsAfter(i){let s=[],r=null;do{let l=r===null?`after=${i}&limit=1000`:`after=${encodeURIComponent(r)}&limit=1000`,g=await o("GET",`${t}/events?${l}`);s.push(...g.items),r=g.next}while(r!==null);return s}}}var re="the session cannot go on: the project's context is being imported; it is served once an import of it completes",ot=5*6e4,Ce=2e3,it=15e3;function _e(e){return e instanceof v&&e.code==="CONTEXT_IMPORTING"}function Ie(){return new v(409,"CONTEXT_IMPORTING",re)}function on(e={}){let t=e.sleep??(a=>new Promise(i=>setTimeout(i,a))),n=e.budgetMs??ot,o=0,d=Ce;return{async wait(){let a=n-o;if(a<=0)return!1;let i=Math.min(d,a);return await t(i),o+=i,d=Math.min(d*2,it),!0},answered(){o=0,d=Ce}}}var R={scope:"store.scope",mainNodes:"store.mainNodes",mainNodesAhead:"store.mainNodesAhead",mainHistory:"store.mainHistory",drafts:"store.drafts",appendDraft:"store.appendDraft",vectorsRead:"store.vectorsRead",vectorsWrite:"store.vectorsWrite",getBlob:"store.getBlob",putBlob:"store.putBlob",chainRead:"chain.read",chainList:"chain.list",chainWrite:"chain.write",chainWriteIfAbsent:"chain.writeIfAbsent",chainRemove:"chain.remove",filesRead:"files.read",filesList:"files.list",filesWrite:"files.write",pointer:"session.pointer",stateGet:"session.stateGet",statePut:"session.statePut",acknowledge:"session.acknowledge",registerChild:"session.registerChild",children:"session.children",sideGet:"session.sideGet",sideSave:"session.sideSave"};var Pe=3e4,D=class extends Error{constructor(n,o,d,a=null){super(`Lattice refused ${n} (${o}): ${d}`);this.op=n;this.code=o;this.requestId=a;this.name="StepRefusedError"}};function ct(e){return e.status!==0?"not_ready":/no answer within/.test(e.message)?"timeout":"unreachable"}var Oe=new Set([ke,"SESSION_ENDED","PROJECT_NOT_MARKED"]);function fn(e,t){let n=t.sleep??(c=>new Promise(p=>setTimeout(p,c))),o=t.retryDeadlineMs??12e4,d=new Map((t.children??[]).map(c=>[c.childId,c.checkpoint?.pointer??null]));async function a(c,p){let u=Te(o,n,t.now);for(;;)try{let m=await p();return t.imports?.answered(),m}catch(m){if(!(m instanceof v))throw m;if(_e(m)&&t.imports){if(await t.imports.wait())continue;throw t.onStopped?.(Ie()),te(new Error(`Lattice refused ${c}: ${re}`),m)}if(Oe.has(m.code)&&t.onStopped?.(m),!m.retryable)throw new D(c,m.code,m.message,m.requestId);let w=h=>t.onRetry?.({op:c,attempt:u.attempt,nextInMs:h,giveUpAt:u.endsAt()??0,cause:ct(m)});if(!await u.again(w))throw t.onStopped?.(new v(m.status,m.code,`Lattice did not take ${c} within ${o/1e3} s: ${m.message}`,null,null,{},m.requestId)),te(new Error(`Lattice refused ${c} (${m.code}, still after ${o/1e3} s): ${m.message}`),m)}}async function i(c,p){try{return await p()}catch(u){throw u instanceof v?(Oe.has(u.code)&&t.onStopped?.(u),new D(c,u.code,u.message,u.requestId)):u}}async function s(c,p){let u=R.acknowledge,m=t.log;if(!m)throw new Error("the checkpoint barrier needs the session log, and this host gave it none");let w=Date.now()+Pe;for(;m.lastSeq()<c.eventSeq;){if(Date.now()>w)throw new Error(`the session log reached event ${m.lastSeq()}, not ${c.eventSeq}, within ${Pe/1e3} s; the checkpoint is not acknowledged`);await n(5)}await ut(m.flush(),o),await a(u,()=>e.writeCheckpointRow(t.generation,`side-${c.pointer.seq}.json`,JSON.stringify(c.side),{childId:p}));let h={pointer:c.pointer,covers:{eventSeq:c.eventSeq,scope:c.scope}},f=JSON.stringify(c.state);p===void 0?await a(u,()=>e.save({generation:t.generation,checkpoint:h,state:f})):d.set(p,(await a(u,()=>e.saveChildPointer(t.generation,p,h,f))).checkpoint.pointer)}async function r(){let c=await a(R.mainHistory,()=>e.mainHistory()),p=dt("sha256").update(c.json).digest("hex");if(p!==c.hash)throw new Error(`main's history from Lattice hashes to ${p}, not to ${c.hash}, the hash Lattice gave for it`);if(t.historyForms!==void 0&&c.forms!==t.historyForms){let u=`main's history pack was built at engine forms ${c.forms??"none named"}, not at ${t.historyForms}, the forms of the Lattice that took this host's claim: another Lattice served it`;throw t.onStopped?.(new v(409,"HISTORY_FORMS_MISMATCH",u)),new Error(u)}return c.json.toString("utf8")}let l=new Map,g=c=>`${Number(c.position)}:${c.cids.join(",")}`;return async(c,p)=>{let u=p??{},m=u.after??null,w=typeof u.childId=="string"?u.childId:void 0;switch(c){case R.scope:return await a(c,()=>e.scope());case R.mainHistory:return{json:await r()};case R.mainNodesAhead:{let h=e.mainNodes(Number(u.position),u.cids);return h.catch(()=>{}),l.set(g(u),h),null}case R.mainNodes:{let h=l.get(g(u));if(l.delete(g(u)),h)try{return await h}catch{}return await a(c,()=>e.mainNodes(Number(u.position),u.cids))}case R.drafts:return await a(c,()=>e.draftsPage(m));case R.appendDraft:{let h={eventId:u.eventId??null,record:u.record??null,envelope:u.envelope??null};return await a(c,()=>e.appendDraft(t.generation,h))}case R.filesRead:return(await a(c,()=>e.readFile(W(u.name))))?.text??null;case R.filesList:{let h=`${W(u.folder)}/`;return(await a(c,()=>e.files(h))).map($=>$.name.slice(h.length)).filter($=>!$.includes("/"))}case R.filesWrite:{if(!String(u.name).startsWith("rationale/"))throw new Error(`the host writes only test rationales; ${W(u.name)} is a configuration file, written by an operator`);try{return await a(c,()=>e.putFile(t.generation,W(u.name),0,Buffer.from(String(u.text),"utf8"))),{written:!0}}catch(h){if(/\(FILE_CHANGED\)/.test(se(h)))return{written:!1,message:se(h)};throw h}}case R.vectorsRead:return await i(c,()=>e.embeddings(String(u.alias),String(u.purpose)));case R.vectorsWrite:{let h={alias:String(u.alias),purpose:String(u.purpose),dims:Number(u.dims),vectors:u.vectors??{}};return await i(c,()=>e.putEmbeddings(t.generation,h))}case R.getBlob:{let h=await a(c,()=>e.getBlob(String(u.fingerprint)));return{bytes:h===null?null:h.toString("base64")}}case R.putBlob:return await a(c,()=>e.putBlob(t.generation,Buffer.from(String(u.bytes),"base64")));case R.chainRead:return await a(c,()=>e.readCheckpointRow(String(u.name),w));case R.chainList:return await a(c,()=>e.checkpointRows(w));case R.chainWrite:return await a(c,()=>e.writeCheckpointRow(t.generation,String(u.name),String(u.text),{childId:w})),null;case R.chainWriteIfAbsent:return await a(c,()=>e.writeCheckpointRow(t.generation,String(u.name),String(u.text),{ifAbsent:!0,childId:w}));case R.chainRemove:return await a(c,()=>e.removeCheckpointRow(t.generation,String(u.name),w)),null;case R.pointer:return w!==void 0?d.get(w)??null:(await a(c,()=>e.session())).checkpoint?.pointer??null;case R.stateGet:return await a(c,()=>e.sessionState(w));case R.statePut:return await a(c,()=>e.putSessionState(t.generation,u.state??null,w)),null;case R.acknowledge:return await s(u,w),null;case R.children:return[...(t.children??[]).map(h=>h.childId)];case R.sideGet:return await a(c,()=>e.sessionSide());case R.sideSave:return await a(c,()=>e.putSessionSide(t.generation,String(u.text))),{saved:!0};case R.registerChild:{let h=typeof u.useCase=="string"?u.useCase:void 0,f=await a(c,async()=>{try{return await e.registerChild(t.generation,String(u.childId),h)}catch($){throw $ instanceof v&&$.code==="SESSION_CLASH"?new Ee($.message,$.code,{heldBy:$.extra.heldBy??null},$.requestId):$}});return d.set(f.childId,f.checkpoint?.pointer??null),null}default:throw new Error(`the session thread asked for ${c}, which the main thread does not answer`)}}}function W(e){return`design/${String(e)}`}async function ut(e,t){let n,o=new Promise((d,a)=>{n=setTimeout(()=>a(new Error(`the session's events were not stored within ${t/1e3} s; the checkpoint is not acknowledged`)),t)});try{await Promise.race([e,o])}finally{clearTimeout(n)}}var x={verb:"remote",mode:"interactive"},oe=null,Ne=new Set;function Tn(e){x={...x,...e}}function V(e,t){return Ae(e,t),z()}function Ae(e,t){if(!(!Z()||Ne.has(e))){Ne.add(e);try{oe??=$e({verb:x.verb,mode:x.mode,contextRoot:null,env:Re(),sessionId:z(),errorsOnly:!0}),Object.assign(oe.ids,{...x.projectId?{project_id:x.projectId}:{},...x.latticeSessionId?{lattice_session_id:x.latticeSessionId}:{}}),oe.spoolError(e,t?{request_id:t}:{})}catch{}}}function gt(e){return e instanceof v||e instanceof D?`lattice_${e.code}`:"cli_crash"}function mt(e){let t=e?.requestId;return typeof t=="string"&&t?t:null}async function ht(){!Z()||!lt||await Promise.race([fe(ye()).catch(()=>{}),new Promise(e=>setTimeout(e,we).unref())])}async function xn(e,t){return e instanceof v&&Ae(gt(e),mt(e)),await ht(),t}import{isAbsolute as pt,relative as De}from"path";var k=e=>" ".repeat(e);function ft(e){return e.length<2?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`}var J=e=>e===1?"this test runs":"these tests run";function Ue(e,t,n){if(n===void 0||t+e.length<=n)return[k(t)+e];let o=[],d="";for(let a of e.split(" "))d&&t+d.length+1+a.length>n?(o.push(k(t)+d),d=a):d=d?`${d} ${a}`:a;return[...o,k(t)+d]}function _n(e,t){let n=e.variables.length;if(n===0)return[];let o=n===1?`\u2692 1 variable needs a value before ${J(t.tests)}; fill it in:`:`\u2692 ${n} variables need values before ${J(t.tests)}; fill them in:`,d=[k(t.indent)+o,k(t.indent+4)+(De(t.cwd,e.file)||e.file)],a=e.variables.filter(i=>i.start_page).map(i=>i.name);return a.length===1?d.push(...Ue(`${a[0]} is the page ${t.tests===1?"it starts":"they start"} on`,t.indent+4,t.columns)):a.length>1&&d.push(...Ue(`${ft(a)} are the pages they start on`,t.indent+4,t.columns)),d}function Le(e,t){let n=t.cwd??process.cwd(),o=s=>pt(s)&&De(n,s)||s,d=e.length;if(d===0)return[];let a=d===1?"\u2692 1 test has no start page yet, so it can't run as it is:":`\u2692 ${d} tests have no start page yet, so they can't run as they are:`,i=d===1?"name the page in its first step, or run it with --url <the page>":"name the page in each one's first step, or run them with --url <the page>";return[k(t.indent)+a,...e.map(s=>k(t.indent+4)+(s.file?o(s.file):`${s.test} ${s.title}`)),k(t.indent+4)+i]}function je(e,t){let n=e.variables.length,o=e.noStartPage.length;return[...n===0?[]:[n===1?`1 variable needs a value before ${J(t.tests)}`:`${n} variables need values before ${J(t.tests)}`],...o===0?[]:[o===1?"1 test has no start page yet":`${o} tests have no start page yet`]]}function Bn(e,t="--mode agent"){if(!e.next)return e.remedy?{remedy:e.remedy}:{};let n=(e.remedy??"").split(`
|
|
3
3
|
`).filter(o=>!/^\s+kane-cli /.test(o)).join(" ").replace(/(, run)?:$/,"").replace(/[,;]\s*(then\s+)?run:\s*kane-cli\b.*$/,"").trim();return{...n?{remedy:n}:{},next:e.next.map(o=>({cmd:`${o.cmd} ${t}`,why:o.why}))}}function Gn(e){let t=e;return!t||typeof t.sessionId!="string"||typeof t.verb!="string"?null:{sessionId:t.sessionId,verb:t.verb,useCase:typeof t.useCase=="string"?t.useCase:null,mine:t.mine===!0,status:typeof t.status=="string"?t.status:"running"}}var Hn=e=>({sid:e.sessionId,verb:e.verb,use_case:e.useCase,mine:e.mine,status:e.status}),yt={useCases:["use-case","use-cases"],criteria:["acceptance criterion","acceptance criteria"],scenarios:["scenario","scenarios"],tests:["test","tests"],openQuestions:["open question","open questions"],sources:["source","sources"],styleNotes:["style note","style notes"]},ue=ne.map(e=>[e,...yt[e]]),X=(e,t=H)=>{let n=ue.filter(([d])=>(e[d]??0)>0),o=n.filter(([d])=>!t.has(d));return o.length>0?o:n},Rt=new Set(["styleNotes"]),le=e=>e?ue.filter(([t])=>(e[t]??0)>0).map(([t,n,o])=>`${e[t]} ${e[t]===1?n:o}`):[];function $t(e){let t=o=>o?I(X(o).map(([d,a,i])=>`${o[d]} ${o[d]===1?a:i}`)):"",n=[[t(e),"added"],...Ve.map(({key:o,done:d})=>[t(e[o]),o==="changes"?"changed":d])].filter(([o])=>o!=="").map(([o,d])=>`${o} ${d}`);return N(e)>0&&n.push(Ke(N(e))),n.length>0?n.join(", "):null}function Wn(e){let t=$t(e.counts),n=[G(e.durS),...t?[t]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 "),o=e.title?`"${e.title}"`:P(e.id??"");return t||(e.counts.uncounted??0)>0?`\u25CF updated ${o} \u2014 ${n}`:`\u25CF nothing changed in ${o} \u2014 ${n}`}function Vn(e){let t=e.title?`"${e.title}"`:P(e.id??""),n=[G(e.durS),`${e.tests} ${e.tests===1?"test":"tests"}`,...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return`\u25CF designed ${t} \u2014 ${n.join(" \xB7 ")}`}function Jn(e){return`\u25CF finished ${e.title?`"${e.title}"`:P(e.id??"")} \u2014 ${[G(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")}`}var I=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`,Ve=[{key:"changes",row:"updates",done:"updated",saving:"updates"},{key:"approves",row:"approves",done:"approved",saving:"approves"},{key:"archives",row:"archives",done:"archived",saving:"archives"},{key:"replaces",row:"replaces",done:"replaced",saving:"replaces"},{key:"removes",row:"removes",done:"removed",saving:"removes"}],Q=e=>Ve.filter(({key:t})=>j(e[t])),Je=e=>Q(e).length>0,ge=e=>e===1?"1 test":`${e} tests`,vt=e=>[...Q(e).map(({key:t,done:n})=>`${I(le(e[t]))} ${n}`),...e.keeps?[`${ge(e.keeps)} marked up to date`]:[]],qn=e=>[...Q(e).map(({key:t,saving:n})=>`saving it ${n} ${I(le(e[t]))}${t==="removes"?" from the project":""}`),...e.keeps?[`saving it marks ${ge(e.keeps)} up to date`]:[]],Kn=e=>[...vt(e),...N(e)>0?[Ye(N(e))]:[]],Yn=e=>ue.reduce((t,[n])=>t+(H.has(n)?0:e.changes?.[n]??0),0),Xn=e=>xe(e),bt=e=>F(e)!==""||j(e.changes)||j(e.approves)||j(e.archives),St="this session's work",Qn=e=>F(e)?"throw away what this session added":me(e)?"throw away this session's chat":"throw away this session's work",zn="already discarded \u2014 nothing was saved",Zn=e=>bt(e)?"your team can see it now":me(e)?Et:xt(e)?St:"",Et="this session's chat";function es(e,t){let n=t.removes;if(e==="extract"||!n||!((n.scenarios??0)>0||(n.tests??0)>0))return t;let o={...(n.scenarios??0)>0?{scenarios:n.scenarios}:{},...(n.tests??0)>0?{tests:n.tests}:{}},{scenarios:d,tests:a,...i}=n,{removes:s,...r}=t;return{...r,replaces:o,...j(i)?{removes:i}:{}}}function ts(e){let t=new Map;for(let n of e){if(n.kind!=="evolve_diff")continue;let o=n.payload??n.body;if(typeof o?.use_case!="string")continue;let d=o.repinned?.tests;typeof d=="number"&&d>0?t.set(o.use_case,d):t.delete(o.use_case)}return t}function ns(e,t){let n=[...t.values()].reduce((i,s)=>i+s,0);if(n===0)return e;let o=Math.max(0,(e.uncounted??0)-t.size),{uncounted:d,...a}=e;return{...a,keeps:n,...o>0?{uncounted:o}:{}}}var Tt=["changes","approves","archives","removes"],N=e=>e.heldChanges??0,j=e=>Object.values(e??{}).some(t=>(t??0)>0),qe=e=>!(e.adds??F(e))&&!Je(e)&&N(e)===0&&(e.keeps??0)===0,me=e=>qe(e)&&(e.chatTurns??0)>0&&(e.uncounted??0)===0,xt=e=>qe(e)&&!me(e);async function ss(e,t,n){let o=await e.counts(t,n),{proposes:d,heldChanges:a,chatTurns:i,uncounted:s}=o;return{...d,...a>0?{heldChanges:a}:{},...Object.fromEntries(Tt.flatMap(r=>j(o[r])?[[r,o[r]]]:[])),...i&&i>0?{chatTurns:i}:{},...typeof s=="number"?{exact:!0}:{},...typeof s=="number"&&s>0?{uncounted:s}:{}}}function Ke(e){return e===1?"1 change to an existing use-case":`${e} changes to existing use-cases`}function Ye(e){return`${Ke(e)}, saved but not applied`}var kt=e=>F(e)!==""||Je(e)||N(e)>0||(e.keeps??0)>0||(e.chatTurns??0)>0||(e.uncounted??0)>0,rs=(e,t)=>e.exact?kt(e):t;function os(e,t){let n=F(e),o=N(e),d=[];n&&d.push(["adds",n]);for(let{key:s,row:r}of Q(e))d.push([r,le(e[s]).join(", ")]);e.keeps&&d.push(["keeps",`${ge(e.keeps)}, marked up to date`]),o>0&&d.push(["held",Ye(o)]);let a=(e.chatTurns??0)>0;((e.uncounted??0)>0||!e.exact&&d.length===0&&!a)&&d.push(["other","work not counted here"]),a&&d.push(["chat","saved with the session; your team can read it"]),d.push(["project",t?"changed since this session started":"no changes since this session started"]);let i=s=>(s?.scenarios??0)+(s?.tests??0);return i(e)+i(e.changes)>0&&d.push(["then","its test cases are created or updated in Test Manager"]),d}function F(e){return X(e,Rt).map(([t,n,o])=>`${e[t]} ${e[t]===1?n:o}`).join(", ")}function is(e){let t=X(e);if(t.length!==1)return"your work is";let[n,o,d]=t[0];return e[n]===1?`your ${o} is`:`your ${e[n]} ${d} are`}function Ct(e,t=[]){return t.length>0?`start a new session from the latest project, adding this session's documents again; run:
|
|
4
4
|
${Xe(t)}`:`${e.startsWith("kane-cli design tests")?"to design it again from the latest project":"to start a new session from the latest project"}, run:
|
|
5
5
|
${e}`}var Xe=e=>`kane-cli context ingest ${e.map(Y).join(" ")}`;function as(e,t){return e.length>0?[...new Set(e)]:_t(t)}function _t(e){return[...new Set((e.uploads??[]).filter(t=>t.outcome==="created"&&t.filename).map(t=>t.filename))]}function It(e){let t=X(e);if(t.length!==1)return"its work";let[n,o,d]=t[0];return e[n]===1?`its ${o}`:`its ${e[n]} ${d}`}function ds(e){return e.replace(/\s*\([^()]*→[^()]*\)/g,"")}function cs(e,t,n){return`kane-cli ${e==="design"?"design tests":"context extract"} --resume ${t}${n?" --mode agent":""}`}var Me=e=>`updating kane-cli won't help \u2014 share this id with support: ${V(`refused_${e}`)}`,q="in a folder linked to a shared project",L="check the file, then run the command again",ie=e=>[`${e} has more inside it than kane-cli can read`,"save a smaller copy, or a PDF of it, then run the command again"],Pt={PDF_ENCRYPTED:e=>[`${e} is password-protected`,"remove the password, then run the command again"],PDF_NO_TEXT_LAYER:e=>[`${e} has no text to read; scanned PDFs aren't supported yet`,"use a PDF with text in it, then run the command again"],PDF_UNREADABLE:e=>[`${e} can't be read as a PDF`,L],DOCX_UNREADABLE:e=>[`${e} can't be read as a Word document`,L],DOCX_NOT_WORDPROCESSING:e=>[`${e} can't be read as a Word document`,L],DOCX_NO_TEXT:e=>[`${e} has no text to add`,L],DOCX_ENCRYPTED_OR_LEGACY:e=>[`${e} is password-protected or in the old Word format`,"save it as a .docx without a password, then run the command again"],DOCX_PART_TOO_LARGE:ie,DOCX_TOO_MANY_PARTS:ie,DOCX_BOMB:ie,SOURCE_ID_OWNED:e=>[`${e} can't become a version of that source: a source plugin reads it`,"add it under another id with --as <id>, then run the command again"]},Ot={changed_both_sides:"it was changed in Test Manager too; choose there which steps to keep",not_pushable:"its steps can't be changed from here; change them in Test Manager",archived:"it's archived in Test Manager; restore it there first",busy:"a test run is using it; wait until the run ends",not_accepted:"Test Manager has different steps for it; choose there which to keep"},O=e=>`${e} ${e===1?"test case":"test cases"}`,Fe={test_on_older_version:"it changed after its test was designed",test_unreadable:"its test can't be read",test_has_no_steps:"its test has no steps"},Qe=e=>ve.test(e)?e.toLowerCase():e,ze=e=>Object.hasOwn(Fe,e)?Fe[e]:void 0,Ze=e=>e.useCase&&ze(e.reason)!==void 0&&e.reason!=="test_unreadable"?Qe(e.useCase):null;function us(e){if(!e||e==="unread")return;let t=new Map([...e.wrote,...e.unchanged??[]].map(n=>[n.id.toLowerCase(),n.path]));for(let n of e.refused)n.file&&t.set(n.id.toLowerCase(),n.file);return n=>t.get(n.toLowerCase())}var de=e=>e.reason==="test_unreadable";function Nt(e,t){let n=ze(e.reason);if(n===void 0)return[{text:" it can't be sent to Test Manager yet",tone:"detail"}];if(e.reason==="test_unreadable"){let d=t?.(e.test);return[{text:` ${n}${d?`: ${pe(d)}`:""}`,tone:"detail"}]}let o=Ze(e);return o===null?[{text:` ${n}`,tone:"detail"}]:[{text:` ${n}; to design its tests again, run:`,tone:"detail"},{text:` kane-cli design tests --use-case ${o}`,tone:"detail",command:!0}]}var K=(e,t)=>t===void 0||typeof e.useCase!="string"||t.has(Qe(e.useCase));function At(e,t,n){let o=e===1,d=`to see ${o?"its use-case":"their use-cases"}, run: kane-cli context list --stale`,a=o?"1 scenario of another use-case":`${e} scenarios of other use-cases`;return n?[{text:` ${a} ${o?"isn't":"aren't"} in Test Manager either`,tone:"detail"},{text:` ${d}`,tone:"detail"}]:[{text:`${a} in ${y(t)} ${o?"isn't":"aren't"} in Test Manager`,tone:"detail"},{text:` ${d}`,tone:"detail"}]}var C="some test cases may not be there yet";function he(e,t){switch(e){case"TEST_MANAGER_TIMEOUT":return{why:`Test Manager took too long, so ${C}`,lead:`Test Manager took too long; ${C}`,next:"to finish them (nothing is saved twice), run:",remedy:!1,support:!1,agentCode:"TEST_MANAGER_TIMED_OUT"};case"FORGE_UNAVAILABLE":return{why:`Test Manager couldn't be reached, so ${C}`,lead:`Test Manager couldn't be reached; ${C}`,next:"to finish them (nothing is saved twice), run:",remedy:!1,support:!0,agentCode:"TEST_MANAGER_UNREACHABLE"};case"FORGE_REFUSED":return{why:`Test Manager refused your account, so ${C}`,lead:`Test Manager refused your account; ${C}`,next:"ask a Test Manager admin to grant your account access, then run:",remedy:!0,support:!1,agentCode:"PROJECT_NO_ACCESS"};case"PROJECT_NOT_MARKED":return{why:`assurance is now off for "${t}", so ${C}`,lead:`assurance is now off for "${t}"; ${C}`,next:"to try them again later (nothing is saved twice), run:",remedy:!0,support:!1,agentCode:"ASSURANCE_OFF"};default:return{why:"some test cases couldn't be created or updated in Test Manager",lead:"some test cases couldn't be created or updated in Test Manager",next:"to try them again (nothing is saved twice), run:",remedy:!1,support:!0,agentCode:"TEST_MANAGER_FAILED"}}}function ls(e,t,n,o,d){let a={receipt:null,summary:null,lines:[],support:!1};if(!e)return a;let{made:i,updated:s,waiting:r,error:l}=e,g=e.nextRun??[],c=e.notCovered??[],p=c.filter(b=>K(b,o)),u=c.length-p.length;if(i===0&&s===0&&r===0&&l===null&&g.length===0&&c.length===0)return a;let m=i>0&&s>0?`${O(i)} created and ${s} updated in Test Manager`:i>0?`${O(i)} created in Test Manager`:s>0?`${O(s)} updated in Test Manager`:null,w={text:` kane-cli context sessions save ${t}`,tone:"plain"},h=b=>b===1?"wasn't":"weren't",f=[];if(g.length>0){let b=g.length===1;f.push({text:`${O(g.length)} in Test Manager ${b?"updates on its":"update on their"} next kane-cli run:`,tone:"plain"});for(let A of g)f.push({text:` "${A.title}"`,tone:"detail"});(r>0||l!==null||c.length>0)&&f.push({text:"",tone:"plain"})}if(r>0){f.push({text:`warning: ${O(r)} in Test Manager ${h(r)} updated`,tone:"warning"});for(let b of e.waitingOn)f.push({text:` "${b.title}"`,tone:"detail"},{text:` ${Ot[b.reason]}`,tone:"detail"})}if(p.length>0){let b=p.length;f.push({text:`warning: ${b} ${b===1?"scenario wasn't":"scenarios weren't"} sent to Test Manager`,tone:"warning"});for(let A of p)f.push({text:` "${A.title}"`,tone:"detail"},...Nt(A,d))}u>0&&f.push(...At(u,n,p.length>0));let $=l===null?null:he(l.code,n);$&&f.push({text:`warning: the session was saved, but ${$.why}`,tone:"warning"});let S=$?$.remedy||r===0?$.next:"then, to finish them (nothing is saved twice), run:":r>0?`then, to update ${r===1?"it":"them"} (nothing is saved twice), run:`:null;S!==null&&f.push({text:`next: ${S}`,tone:"plain"},w);let E=[];if(m!==null&&E.push(m),r>0&&E.push(m!==null?`${r} ${h(r)} updated yet`:`${O(r)} in Test Manager ${h(r)} updated yet`),p.length>0){let b=p.length;E.push(`${E.length>0?b:`${b} ${b===1?"scenario":"scenarios"}`} ${b===1?"wasn't":"weren't"} sent to Test Manager`)}return $&&E.push(E.length>0?"some may not be there yet":$.lead),{receipt:m,summary:E.length>0?E.join("; "):null,...g.length>0?{nextRunSummary:`${O(g.length)} ${g.length===1?"updates on its":"update on their"} next kane-cli run`}:{},lines:f,support:($?.support??!1)||p.some(de)}}function gs(e,t,n,o){if(!e)return;let d=e.notCovered??[],a=[...new Set(d.flatMap(s=>{let r=K(s,n)?Ze(s):null;return r===null?[]:[r]}))],i=[...e.error!==null?[{cmd:`kane-cli context sessions save ${t} --mode agent`,why:"finishes the test cases that may not be there yet"}]:[],...a.map(s=>({cmd:`kane-cli design tests --use-case ${s} --force --mode agent`,why:"designs the use case's tests again, so its scenarios reach Test Manager"}))];return{total:e.total,created:e.made,updated:e.updated,already_there:e.linked,waiting:e.waiting,waiting_on:e.waitingOn.map(({scenario:s,title:r,reason:l})=>({scenario:s,title:r,reason:l})),next_run:(e.nextRun??[]).map(({scenario:s,title:r})=>({scenario:s,title:r})),...d.length>0?{not_covered:d.map(s=>{let r=de(s)?o?.(s.test):void 0;return{scenario:s.scenario,title:s.title,test:s.test,reason:s.reason,in_session:K(s,n),...r?{file:pe(r)}:{}}})}:{},...e.error!==null?{error:he(e.error.code,"").agentCode}:{},...d.some(s=>K(s,n)&&de(s))?{support_id:V("refused_TEST_UNREADABLE")}:{},...i.length>0?{next:i}:{}}}var Be=new Set(["duplicate","unwritable"]),et=e=>Be.has(e.kind)||e.kind==="import"&&e.via!==void 0&&Be.has(e.via),Ut=new Set(["unreadable","unresolved"]);function Dt(e,t){return!e||e.variables.length===0&&e.noStartPage.length===0?{}:{needed:{...e,tests:t},neededFacts:je(e,{tests:t})}}function Lt(e){if(!e||e.length===0)return{};let t=e.length===1?"1 test file here was replaced and won't run any more":`${e.length} test files here were replaced and won't run any more`;return{replacedHead:`\u2692 ${t}:`,replaced:e.map(n=>({file:ce(process.cwd(),n.file)||n.file,by:n.replacedBy.map(o=>wt(o))})),replacedSummary:t}}function jt(e){return e!=null&&e.error===null}var tt=(e,t)=>{if(!jt(t)||t.waitingOn.length>0)return[];let n=new Set((t.notCovered??[]).map(o=>o.test.toLowerCase()));return e.filter(o=>o.file&&!n.has(o.id.toLowerCase()))},pe=e=>M(ce(process.cwd(),e)||e);function ms(e,t,n,o={}){let d={text:` kane-cli context sessions save ${t}`,tone:"plain"};if(e==="unread")return{line:null,lines:[{text:"warning: the session was saved, but its test files couldn't be written here",tone:"warning"},{text:"next: to write them (nothing is saved twice), run:",tone:"plain"},d],support:!0,summary:"its test files aren't written here yet",kept:null,again:"all"};let a=e.wrote.length,i=e.refused.length,s=a+(e.unchanged?.length??0),r=s+i,l=e.saved?new Set(e.saved):null,g=l?e.wrote.filter(S=>!l.has(S.id)).length:0,c=S=>`${g} ${g===1?"test":"tests"} ${S?"it imports":"they import"}`,p=a===0?null:n||i===0&&s>a?`\u2692 wrote ${a===1?"1 test file that was":`${a} test files that were`} missing or out of date here`:i>0?`\u2692 wrote ${a} of the ${r} test files`:g>0?`\u2692 wrote ${a} test files, for ${a-g===1?`the saved test and ${c(!0)}`:`${a-g} saved tests and ${c(!1)}`}`:a===1?"\u2692 wrote 1 test file, for the saved test":`\u2692 wrote ${a} test files, one for each saved test`,u={...Lt(e.replaced),...Dt(e.needed,e.saved?.length??r)};if(i===0)return{line:p,lines:[],support:!1,summary:null,kept:null,again:0,...u};let w=[{text:`warning: ${i===r?`${i===1?"1 test file wasn't":`${i} test files weren't`} written`:`${i} of the ${r} test files ${i===1?"wasn't":"weren't"} written`}`,tone:"warning"}];for(let S of e.refused)w.push({text:S.title?` "${S.title}"`:" a test with no title",tone:"detail"},{text:` ${ee(S)}`,tone:"detail"});let h=e.refused.filter(et).length;h>0&&w.push({text:`next: then, to write ${h===1?"it":"them"} (nothing is saved twice), run:`,tone:"plain"},d);let f=e.refused.filter(S=>S.kind==="edited");if(f.length>0){let S=f.length===1,E=tt(f,o.testManager);if(E.length>0){w.push({text:E.length===1?"next: to send your edit to its test case in Test Manager, run:":"next: to send your edits to their test cases in Test Manager, run:",tone:"plain"});for(let A of E)w.push({text:` kane-cli testmd run ${pe(A.file)}`,tone:"plain"})}let b=`${E.length>0?"or, to":"next: to"} get the project's ${S?"version, move it":"versions, move them"} out of this folder`;h>0?w.push({text:`${b} and save again`,tone:"plain"}):w.push({text:`${b}, then run:`,tone:"plain"},d)}let $=i-f.length;return{line:p,lines:w,support:e.refused.some(S=>Ut.has(S.kind)),summary:s>0?`${s} of the ${r} test files written here`:$===0?null:f.length>0?`${$} of the ${r} test files ${$===1?"isn't":"aren't"} written here yet`:r===1?"its test file isn't written here yet":"its test files aren't written here yet",kept:f.length===0?null:f.length>1?`${f.length} test files here keep your edits`:r===1?"its test file here keeps your edit":"1 test file here keeps your edit",again:h,...u}}function hs(e,t,n){if(!e||!t||t.again===0)return null;let o=`write ${t.again===1?"the test file":"the test files"}`;return e.error!==null?he(e.error.code,n).remedy?null:`next: to finish them and ${o} (nothing is saved twice), run:`:e.waiting>0?`next: then, to update ${e.waiting===1?"the test case":"the test cases"} and ${o} (nothing is saved twice), run:`:null}function ps(e,t,n={}){let o=`kane-cli context sessions save ${t} --mode agent`;if(e==="unread")return{written:[],refused:[],error:"TEST_FILES_NOT_WRITTEN",next:[{cmd:o,why:"writes the test files here"}]};let d=e.refused.some(et),a=e.refused.filter(r=>r.kind==="edited"),i=a.length===0?"":a.length===1?", and the project's version of a kept file once it's moved out of its folder":", and the project's version of the kept files once they're moved out of their folder",s=[...d?[{cmd:o,why:`writes the test files not written here${i}`}]:[],...tt(a,n.testManager).map(r=>({cmd:`kane-cli testmd run ${M(r.file)} --agent`,why:"sends your edit to its test case in Test Manager"})),...a.length>0&&!d?[{cmd:o,why:"writes the project's version, once the file is moved out of its folder"}]:[]];return{written:e.wrote.map(r=>r.path),refused:e.refused.map(r=>({test:r.id,title:r.title,reason:ee(r),...r.kind==="edited"&&r.file?{file:r.file}:{}})),...e.replaced?.length?{replaced:e.replaced.map(r=>({test:r.test,file:r.file,replaced_by:r.replacedBy}))}:{},...e.needed?.variables.length?{variables_needed:{file:e.needed.file,variables:e.needed.variables}}:{},...e.needed?.noStartPage.length?{no_start_page:e.needed.noStartPage.map(r=>({test:r.test,...r.file?{file:r.file}:{}}))}:{},...s.length>0?{next:s}:{}}}var Mt={ac:"an acceptance criterion",scenario:"a scenario",test:"a test",gap:"an open question",source:"a source",stylenote:"a style note"},T=(e,t)=>e?`"${e}"`:P(t),Ge=(e,t,n)=>`${e} ${e===1?t:n}`,fs={trusted:"approved",derived:"proposed",archived:"archived"},ws={yes:"yes",source_changed:"no: its source changed",source_removed:"no: its source was removed",tests_out_of_date:"no: its tests are out of date",designed_from_changed:"no: what it was designed from changed",archived:"-"},ys={source_changed:"its source changed",source_removed:"its source was removed",tests_out_of_date:"changed after its tests were designed"},y=e=>e?`"${e}"`:"this session's project",_=(e,t)=>`kane-cli design tests --use-case ${e}${t}`,ae=e=>e?"its source's change was put off in an earlier review; to take it up":"to review its source's change",He=e=>e.split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as D}from"./chunk-SMXABALN.js";import{a as G}from"./chunk-
|
|
2
|
+
import{c as D}from"./chunk-SMXABALN.js";import{a as G}from"./chunk-LXK4B2FE.js";import{e as k}from"./chunk-SB26HQO7.js";import{a as q}from"./chunk-YCVEI7BT.js";import{a as S}from"./chunk-ZCBOHWN3.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as u,b as i}from"./chunk-33DWJV67.js";import{a as Z}from"./chunk-6YGTRKDT.js";import{z as s}from"./chunk-J4FIESTB.js";import{e as T}from"./chunk-UR6MHSHU.js";var e=T(Z(),1);var r=T($(),1);function ee(n,w,c){return{id:n,label:`${w} (${n})`,isActive:n===c}}var le={escLabel:"use defaults",newestFirst:!0};function me({resolver:n,currentProjectId:w,env:c,onSelect:j,onCancel:E,escLabel:R,newestFirst:B=!1}){let[H,v]=(0,e.useState)([]),[J,l]=(0,e.useState)(!0),[K,m]=(0,e.useState)(!1),[Q,g]=(0,e.useState)(!1),[X,x]=(0,e.useState)(null),[d,p]=(0,e.useState)("list"),[I,A]=(0,e.useState)(""),[C,h]=(0,e.useState)(null),[_,Y]=(0,e.useState)(""),b=(0,e.useRef)(!1),F=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(!n){x("Login first to browse projects"),l(!1);return}let o=new AbortController,a=_.trim();return F.current?l(!0):a&&g(!0),m(!0),x(null),(async()=>{try{let t=n.cached??await n.resolve();if(!t){x("Login first to browse projects"),l(!1),m(!1),g(!1);return}let L=S(c),M=new k(L.tmsBaseUrl,t.username,t.access_key),f=!0,N=0,O=B?{sort:"-created_at"}:{},W=a?{signal:o.signal,name:a,perPage:10,...O}:{signal:o.signal,perPage:10,...O};for await(let y of M.listProjectsStream(W)){if(f&&(l(!1),g(!1),F.current=!1,f=!1),y.totalLoaded===0&&y.done&&N===0&&!a){b.current=!0,p("naming"),m(!1);return}let U=y.projects.map(P=>ee(P.project_id,P.name,w));v(N===0?U:P=>[...P,...U]),N+=y.projects.length,y.done&&m(!1)}f&&(l(!1),m(!1),g(!1))}catch(t){if(t?.name==="AbortError")return;x(t instanceof Error?t.message:String(t)),l(!1),m(!1),g(!1)}})(),()=>o.abort()},[n,w,c,_,B]);let z=(0,e.useCallback)(o=>{let a=o.trim();if(!a){h("Name cannot be empty");return}h(null),p("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let t=n.cached??await n.resolve();if(!t)throw new Error("Not authenticated");let L=S(c),f=await new k(L.tmsBaseUrl,t.username,t.access_key).createProject(a);j(f.id,f.name)}catch(t){h(t instanceof Error?t.message:String(t)),p("naming")}})()},[n,c,j]),V=(0,e.useCallback)(()=>{A(""),h(null),b.current?E():p("list")},[E]);return d==="naming"||d==="creating"?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:s.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(i,{color:s.orange,bold:!0,children:"Create new project"}),b.current&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(i,{color:s.dim,children:"No projects yet \u2014 let's create one."})}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(i,{color:s.dim,children:"Name: "}),d==="naming"?(0,r.jsx)(D,{value:I,onChange:o=>{A(o),C&&h(null)},onSubmit:z,onCancel:V}):(0,r.jsx)(i,{children:I})]}),C&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(i,{color:s.red,children:C})}),d==="creating"&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(i,{color:s.dim,children:"Creating..."})}),d==="naming"&&(0,r.jsx)(q,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,r.jsx)(G,{title:"Projects",items:H,loading:J,loadingMore:K,searching:Q,preserveSelectionById:!0,onSearch:Y,error:X,itemNoun:"projects",onTab:()=>{b.current=!1,p("naming")},extraHint:"new",...R?{escLabel:R}:{},onSelect:o=>{let a=o.label.replace(` (${o.id})`,"");j(o.id,a)},onCancel:E})}export{ee as a,le as b,me as c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{h as c,i as f}from"./chunk-A7RJQJNT.js";import{readFileSync as l}from"fs";import{resolve as p}from"path";var i="KANE_CLI_DEVICE_CONFIG";function E(e=process.env){return(e[i]??"").trim()!==""}function m(e=process.env){let n=(e[i]??"").trim();if(!n)throw new Error(`a real-device run needs ${i} to name the run's device-config.json, and it is not set.`);let t=p(n),r;try{r=JSON.parse(l(t,"utf8"))}catch(o){throw new Error(`${i}: cannot read the device config at ${t}: ${o.message}`)}if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`${i}: ${t} is not a device config object.`);return{path:t,entry:r}}function s(e){if(typeof e=="number")return String(e);if(typeof e=="string")return e.trim()||void 0}function w(e,n=process.env){let{path:t,entry:r}=m(n),o=s(r.platform_name)?.toLowerCase();if(o!==e.platform)throw new Error(`${i}: ${t} describes ${o?`a "${o}" device`:"no platform_name"}, but the test file's target is ${e.platform}.`);if(!e.hasCredentials)throw new Error("a real-device run needs your TestMu AI username and access key, and none were found. Run kane-cli login, or pass --username and --access-key.");let a=s(r.device_name),d=s(r.platform_version),u=s(r.app);return{device:{platform:e.platform,target:e.platform,device_config_path:t},...a?{deviceName:a}:{},...d?{osVersion:d}:{},...u?{app:u}:{}}}function N(e,n){let t=n?n.name?` through LT tunnel ${n.name}`:" through your LT tunnel":"";return`Connecting to a real ${f(c(e))} device${t}\u2026`}function _(e){let n=e.deviceName??"any device";return e.osVersion?`${n} (${e.osVersion})`:n}function v(e){return/[*?^$[\]{}|\\]/.test(e)}function g(e){return e?.name&&!v(e.name)?e.name:void 0}function D(e){return g(e)||e?.model}function y(e,n,t){let r=D(n),o=n?.os_version?`${f(c(e))} ${n.os_version}`:void 0,a=t?`App ${t.replace(/^lt:\/\//,"")}`:void 0;return`Running on: ${["Real device",r,o,a].filter(Boolean).join(" \xB7 ")}`}function C(e,n,t){let r=!1;return o=>{r||o.type!=="run_start"||o.child_id||(r=!0,t(y(e,o.environment?.device,n)))}}export{E as a,w as b,N as c,_ as d,v as e,g as f,D as g,C as h};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as E}from"./chunk-
|
|
2
|
+
import{b as E}from"./chunk-LRNUGKYH.js";import{a as A,b as I,c as L,d as p,e as N,f as O,g as R,m as T}from"./chunk-L3BUPFAQ.js";import{Fa as f,ka as c}from"./chunk-WE7HRAGO.js";var h="https://integrations.lambdatest.com",m=" kane-cli context ingest <file>";function $(e){try{let n=new URL(e);return`${n.hostname}${n.pathname==="/"?"":n.pathname}`}catch{return e}}function D(e){switch(e.provider){case"web":return`the page ${e.display}`;case"jira":return`Jira issue ${e.display}`;case"confluence":return e.title?`Confluence page "${e.title}"`:`Confluence page ${e.display.split("/").at(-1)}`;case"linear":return`Linear issue ${e.display}`;case"linear-doc":return e.display.startsWith("document ")?`Linear ${e.display}`:`Linear document "${e.display}"`;default:return e.display}}function U(e,n){let t=C(e,n),i={jira:"Jira issue",confluence:"Confluence page",linear:"Linear issue","linear-doc":"Linear document"}[e];return i&&t!==n?`${i} ${t}`:t}function C(e,n){return e==="jira"?A(n)?.issueKey??n:e==="confluence"?L(n)?.pageId??n:e==="linear"?p(n)?.key??n:e==="linear-doc"?N(n)?.slugId??n:$(n)}var k=(e,n)=>e==="web"?`the page ${$(n)}`:U(e,n);function z(e){if(!e?.url)return null;let n=e.kind==="url"?"web":e.kind==="linear"?p(e.url)?"linear":"linear-doc":e.kind;return["web","jira","confluence","linear","linear-doc"].includes(n)?k(n,e.url):null}var x=e=>e.provider==="confluence"?e.title??e.display.split("/").at(-1):e.display;function P(e,n){let t={reading:e.provider==="web"?e.display:D(e),address:e.address,...n?{as:n}:{}};return e.provider==="confluence"&&!e.title?{...t,shown:`Confluence page ${e.display.split("/").at(-1)}`,bare:!0}:e.provider==="linear-doc"&&e.display.startsWith("document ")?{...t,shown:`Linear ${e.display}`,bare:!0}:{...t,shown:x(e)}}function q(e,n,t){return T(e)?.sourceIdFor(n)===t?void 0:t}function Q(e,n){try{let t=I(e,n)?.title;return typeof t=="string"&&t.length>0?t:void 0}catch{return}}function X(e,n,t,i){let s=C(e,n),d=e==="linear-doc"?t??`document ${s}`:s;return P({provider:e,display:d,...t?{title:t}:{},address:n},i)}var Z=e=>`with ${e.delivered+e.omitted} attachments: ${e.delivered} of its images added, ${e.omitted} left out`,ee=(e,n,t=!1)=>`the same ${t?"file":"text"} as "${e}", already in "${n}"`;function y(e,n){return e==="jira"?A(n)?.issueKey??n:e==="confluence"?`the Confluence page ${L(n)?.pageId??n}`:e==="linear"?p(n)?.key??n:e==="linear-doc"?`the Linear document ${N(n)?.slugId??n}`:`the page ${$(n)}`}var w=e=>e==="jira"?"Jira":e==="confluence"?"Confluence":e.startsWith("linear")?"Linear":"the web",S=e=>e.startsWith("linear")?"Linear":"Atlassian",b=e=>O(e)?.workspace??R(e)?.workspace??"<workspace>",G={invalid_url:"INVALID_URL",target_disallowed:"ADDRESS_NOT_ALLOWED",page_not_found:"PAGE_NOT_FOUND",page_access_blocked:"PAGE_BLOCKED",page_paywalled:"PAGE_PAYWALLED",unsupported_content_type:"NOT_A_PAGE",page_too_large:"PAGE_TOO_LARGE",page_timeout:"PAGE_TIMEOUT",scrape_unavailable:"PAGES_UNAVAILABLE",scrape_rate_limited:"PAGES_UNAVAILABLE",internal_error:"PAGES_UNAVAILABLE",malformed_response:"PAGES_UNAVAILABLE",credit_denied:"OUT_OF_CREDITS",auth_rejected:"CREDENTIALS_REJECTED",route_missing:"PAGES_NOT_AVAILABLE",transport_unreachable:"CONNECTION_FAILED",LIS_AUTH:"CREDENTIALS_REJECTED",JIRA_NOT_CONNECTED:"NO_CONNECTION",JIRA_ISSUE_UNAVAILABLE:"ITEM_UNAVAILABLE",LIS_UNAVAILABLE:"INTEGRATION_UNAVAILABLE",LIS_SETUP:"INTEGRATION_SETUP",LIS_FORBIDDEN:"NO_ACCESS",LIS_RATE_LIMITED:"INTEGRATION_BUSY"};function ne(e,n,t){let i=G[t.code]??t.code,s=y(e,n),d=w(e),a=(u,o,g=!1)=>({code:i,message:u,remedy:o,...g?{support:!0}:{}});switch(i){case"INVALID_URL":return a(`${n} isn't a valid public web address, so nothing was added`,"check the address, then run the command again");case"ADDRESS_NOT_ALLOWED":return a(`${n} can't be fetched: it isn't an allowed public web page, so nothing was added`,`use a public page's address, or save the page as a file and add the file:
|
|
3
3
|
${m}`);case"PAGE_NOT_FOUND":return a(`${s} couldn't be found, so nothing was added`,"check that the address is right and the page still exists, then run the command again");case"PAGE_BLOCKED":return a(`${s} refused automated access, so nothing was added`,`use a version of the page anyone can open, or save it as a file and add the file:
|
|
4
4
|
${m}`);case"PAGE_PAYWALLED":return a(`${s} is behind a paywall or a sign-in, so nothing was added`,`use a copy anyone can open, or save it as a file and add the file:
|
|
5
5
|
${m}`);case"NOT_A_PAGE":return a(`${$(n)} isn't a web page, so nothing was added`,`download the document, then add the file:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as l}from"./chunk-FCD3NYOM.js";import{a as c}from"./chunk-4QTH7VYE.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-HL5CJJXR.js"),import("./bootstrap-
|
|
2
|
+
import{a as l}from"./chunk-FCD3NYOM.js";import{a as c}from"./chunk-4QTH7VYE.js";import{a}from"./chunk-RZ4F3BHX.js";var h=class{constructor(e,t,r,s){this.controllerBaseUrl=e;this.getOAuthToken=t;this.directBasicAuth=r;this.log=s}_cached=null;_revoked=!1;_lastError=null;revoke(){this._revoked=!0,this._cached=null}prime(e){this._revoked||(this._cached=e)}get revoked(){return this._revoked}get cached(){return this._cached}get lastError(){return this._lastError}async resolve(e=!1){if(this._cached&&!e)return this._cached;try{let t;if(this.directBasicAuth)t=new l(this.controllerBaseUrl,{username:this.directBasicAuth.username,accessKey:this.directBasicAuth.access_key});else{let s=await this.getOAuthToken();if(!s)return null;t=new l(this.controllerBaseUrl,s)}let r=await t.getTmsCredentials();this.directBasicAuth&&!r.access_key&&(r.access_key=this.directBasicAuth.access_key),this._cached=r,this._lastError=null;try{let[{refreshIdentitySnapshot:s},{telemetryEnvName:n}]=await Promise.all([import("./identity-HL5CJJXR.js"),import("./bootstrap-XGKU4WXB.js")]);await s(n(),r)}catch{}return this.log?.("info","AUTH_RESOLVE_OK","Auth resolved",{username:r.username,org_id:r.org_id,user_id:r.user_id}),r}catch(t){return this._lastError=t instanceof Error?t:new Error(String(t)),this.log?.("warn","AUTH_RESOLVE_FAILED","Auth resolve failed",{error:this._lastError.message}),null}}async fetch(e,t={}){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");let r=await this.resolve();if(!r)throw new Error("Not authenticated \u2014 no credentials resolved");let s=i=>({...t,headers:{...t.headers,Authorization:c(i.username,i.access_key)}}),n=await a(e,s(r));if(n.status===401){if(this._revoked)throw new Error("Resolver has been revoked \u2014 identity changed");this.log?.("warn","AUTH_RESOLVE_401","Got 401, re-resolving",{url:e});let i=await this.resolve(!0);if(!i)throw new Error("Re-authentication failed after 401");return a(e,s(i))}return n}};function _(o){if(!o)return"network";let e=/failed:\s*(\d{3})\b/.exec(o.message)?.[1];return e==="401"||e==="403"?"auth":e?"server":"network"}export{h as a,_ as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as O,c as P}from"./chunk-SMXABALN.js";import{b as I,c as L}from"./chunk-BWXLZS5O.js";import{a as M,b as $}from"./chunk-3V4J65GN.js";import{oa as j}from"./chunk-PI7OXS62.js";import{a as D}from"./chunk-HCBYKLMW.js";import{a as m,b as s,k as _}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{z as f}from"./chunk-FAMQ4DHU.js";import{e as C}from"./chunk-UR6MHSHU.js";var F={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4,tests:4};function J(e,i,n={}){let r=[],u=L(e.turns).entries.length;if(i==="design"){let c;for(let g=e.ledger.length-1;g>=0;g--){let p=e.ledger[g];if(p.kind==="banner"&&p.text.startsWith("designing: ")){c=p.text.slice(11);break}}let o=n.remote&&!c?e.ledger.find(g=>g.kind==="header")?.phase:void 0,v=c?F[c]:o;v&&r.push(`phase ${v}/4`),u>0&&!n.remote&&r.push(`${u} item${u===1?"":"s"} this session`)}else u>0&&!n.remote&&r.push(`${u} saved as draft${u===1?"":"s"}`);let l=n.remote?n.added??I(e.turns):0,a=n.remote?n.updated??0:0;(l>0||a>0)&&r.push([l>0?`${l} added`:"",a>0?`${a} updated`:"","not saved yet"].filter(Boolean).join(" \xB7 "));let h=e.pending?e.pending.resolution.filter(c=>!c).length:0;return h>0&&r.push(`${h} question${h===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function Z(e,i){let n=[],r=e.applied+e.committed+e.retired;n.push(`${r} applied`),n.push(`${i} to decide`);let u=[];return e.skipped>0&&u.push(`${e.skipped} skipped`),e.deferred>0&&u.push(`${e.deferred} deferred`),e.failed>0&&u.push(`${e.failed} failed`),{items:[...n,...u]}}var x=C(q(),1);function ne({onToggleThinking:e,onCtrlC:i,explorer:n,panel:r}){let l=(0,x.useRef)(null),a=(0,x.useRef)(""),h=()=>{l.current&&clearTimeout(l.current),l.current=null,a.current=""};return(0,x.useEffect)(()=>h,[]),O((c,o)=>{if(o.ctrl&&c==="t"){e();return}if(o.ctrl&&c==="c"){i();return}if(!o.ctrl&&c.includes("")){i();return}if(!o.ctrl&&c.includes("")){e();return}if(n&&n.isOpen()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),n.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return){h(),o.return?n.onEnter():n.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){(p[1]==="A"||p[1]==="B")&&n.onMove(p[1]==="A"?-1:1);return}n.onBack();return}if(o.upArrow){n.onMove(-1);return}if(o.downArrow){n.onMove(1);return}if(o.return){n.onEnter();return}if(o.escape){a.current="",v();return}return}if(r&&r.isFocused()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),r.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){h(),o.return?r.onSelect():o.leftArrow?r.onLeft?.():o.rightArrow?r.onRight?.():r.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){p[1]==="A"||p[1]==="B"?r.onMove(p[1]==="A"?-1:1):p[1]==="C"?r.onRight?.():r.onLeft?.();return}r.onBack();return}if(o.upArrow){r.onMove(-1);return}if(o.downArrow){r.onMove(1);return}if(o.leftArrow){r.onLeft?.();return}if(o.rightArrow){r.onRight?.();return}if(o.return){r.onSelect();return}if(o.escape){a.current="",v();return}if(/^[1-9]$/.test(c)){r.onDigit(Number(c));return}if(o.tab){r.onTab?.();return}if(c===" "&&r.isMulti()){r.onSpace();return}if(c&&!o.ctrl&&!o.meta){r.onType(c);return}return}}),null}var t=C(D(),1);function N(e,i=!1){return i?Y(e):e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}var Q=e=>e===0?null:e===1?"its test was designed for the old version":`its ${e} tests were designed for the old version`;function Y(e){return e.heldPayload?[{v:"approve",label:"approve the change",detail:"the use-case takes the new version"},{v:"skip",label:"keep it as it is",detail:"the change is dropped"},{v:"defer",label:"decide later",detail:"it keeps waiting"}]:e.kind==="ARCHIVE"?[...e.archiveRefused?[]:[{v:"archive",label:"archive",detail:"it's hidden from the project from now on"}],{v:"skip",label:"keep it",detail:"it stays as it is; this may be suggested again"},{v:"defer",label:"defer",detail:"decide later; it's kept as an open question"}]:e.kind==="ADD"?[{v:"approve",label:"approve",detail:"add it to this session"},{v:"skip",label:"reject",detail:"leave it out; it may be suggested again"},{v:"defer",label:"defer",detail:"leave it out for now, as an open question"}]:[{v:"approve",label:"approve",detail:"the use-case takes the new version"},{v:"skip",label:"reject",detail:"it stays as it is; the change may be suggested again"},{v:"defer",label:"defer",detail:"it stays as it is for now, as an open question"}]}function K(e,i=!1){let n=N(e,i);return e.viewDiff&&n.push({v:"view_diff",label:"view diff",detail:i?"the whole change, old \u2192 new":"full old \u2192 new"}),n}function R(e,i=!1){return e.kind==="ARCHIVE"?null:K(e,i).length}var G={ADD:{color:f.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:f.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},U=60,X=(e,i)=>`${e.heldPayload?"changed earlier":e.kind==="ADD"?"new":e.kind==="ARCHIVE"?`no longer in ${$(i)}`:"changed"}:`;function de({card:e,position:i,sel:n=0,focused:r=!1,freeText:u=null,editorIntent:l="steer",remote:a,gapAbove:h=!0}){let{stdout:c}=_(),o=c?.columns??80,v=o<U,g=K(e,!!a),p=R(e,!!a),H=G[e.kind],S=d=>r&&n===d?(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"}):" ",b=e.impact,k=a?e.kind==="MODIFY"?Q(e.tests??0):null:b&&"stale_refs"in b&&b.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${b.stale_refs.length} item(s) stale`+((b.direct_refs?.length??0)>0?` \u2014 ${b.direct_refs.length} directly touched: ${b.direct_refs.join(", ")}`:""):b&&"design_children"in b?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${b.design_children} design child(ren)`:null,T=e.provenance&&e.provenance!==e.why?e.provenance:a?null:e.origin??null,B=a?[{label:"change",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...k?[{label:"tests",text:k}]:[]]:[{label:"why",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...k?[{label:"impact",text:k}]:[]],E=Math.max(...B.map(d=>d.label.length)),A=a?`? review the changes from ${$(a.source)}`:"? reconcile",y=a?`${i.n} of ${i.of}`:`item ${i.n} of ${i.of}`,W=(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{bold:!0,children:[(0,t.jsx)(s,{color:H.color,children:a?X(e,a.source):`[${e.kind}]`}),` ${a?M(e):j(e.title)}`]})}),B.map((d,w)=>a?(0,t.jsxs)(m,{paddingLeft:2,children:[(0,t.jsx)(m,{flexShrink:0,width:E+2,children:(0,t.jsx)(s,{color:f.dim,children:d.label})}),(0,t.jsx)(m,{flexGrow:1,children:(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})})]},`f-${w}`):(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.dim,children:`${d.label.padEnd(E)} `}),(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})]})},`f-${w}`)),e.diffSummary?(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:e.diffSummary})}):(e.diff??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:4,children:(0,t.jsx)(s,{color:d.op==="-"?"red":"green",children:`${d.op==="-"?"\u2212":"+"} ${d.field==="criteria"?a?"acceptance criterion":"criterion":d.field}: ${d.text}`})},`d-${w}`)),(a?[]:e.citeLines??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:d})},`c-${w}`)),(0,t.jsx)(s,{children:" "}),g.map((d,w)=>(0,t.jsxs)(s,{children:[S(w),` ${w+1}. ${d.label}`,(0,t.jsx)(s,{color:f.dim,children:` \u2014 ${d.detail}`})]},`o-${w}`)),p!==null||u&&l==="because"?u?(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsxs)(m,{children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"})," ",(0,t.jsx)(s,{color:f.dim,children:"\u270E "})]}),(0,t.jsx)(P,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:l==="because"?"why archive it?":l==="adjust"?"tell me what to change":"say what to adjust"})]}),(0,t.jsx)(s,{color:f.muted,children:l==="because"?" submits as: archive \xB7 your reason goes on the record":l==="adjust"?" the agent looks at this change again, with your words":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):p!==null?(0,t.jsxs)(s,{children:[S(p)," ",(0,t.jsx)(s,{color:f.dim,children:l==="adjust"?"\u270E adjust \u2014 tell me what to change":e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(v)return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A}),(0,t.jsx)(s,{color:f.dim,children:y}),W]});let V=Math.max(2,Math.min(o-1,100)-A.length-y.length);return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A})," ".repeat(V),(0,t.jsx)(s,{color:f.dim,children:y})]}),(0,t.jsx)(s,{children:" "}),W]})}function fe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&n.push("space toggle"),i.batchCount>1&&n.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(r=>r.input===!0))&&n.push("\u270E type your own"),i.canAttach&&n.push("@ attach a file or URL"),i.escBack&&n.push("esc back"),{keys:n}}function pe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.some(r=>r.free)&&n.push("\u270E type your own"),i.escBack&&n.push("esc back"),{keys:n}}function he(e){let i=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return R(e)!==null&&i.push("type = adjust"),i.push("esc \xB7 nothing to undo"),{keys:i}}export{J as a,Z as b,ne as c,N as d,K as e,R as f,de as g,fe as h,pe as i,he as j};
|
|
2
|
+
import{b as O,c as P}from"./chunk-SMXABALN.js";import{b as I,c as L}from"./chunk-BWXLZS5O.js";import{a as M,b as $}from"./chunk-LRNUGKYH.js";import{oa as j}from"./chunk-PI7OXS62.js";import{a as D}from"./chunk-HCBYKLMW.js";import{a as m,b as s,k as _}from"./chunk-33DWJV67.js";import{a as q}from"./chunk-6YGTRKDT.js";import{z as f}from"./chunk-J4FIESTB.js";import{e as C}from"./chunk-UR6MHSHU.js";var F={"acceptance criteria":1,scenarios:2,"acceptance criteria + exercises":3,"tests + gaps":4,tests:4};function J(e,i,n={}){let r=[],u=L(e.turns).entries.length;if(i==="design"){let c;for(let g=e.ledger.length-1;g>=0;g--){let p=e.ledger[g];if(p.kind==="banner"&&p.text.startsWith("designing: ")){c=p.text.slice(11);break}}let o=n.remote&&!c?e.ledger.find(g=>g.kind==="header")?.phase:void 0,v=c?F[c]:o;v&&r.push(`phase ${v}/4`),u>0&&!n.remote&&r.push(`${u} item${u===1?"":"s"} this session`)}else u>0&&!n.remote&&r.push(`${u} saved as draft${u===1?"":"s"}`);let l=n.remote?n.added??I(e.turns):0,a=n.remote?n.updated??0:0;(l>0||a>0)&&r.push([l>0?`${l} added`:"",a>0?`${a} updated`:"","not saved yet"].filter(Boolean).join(" \xB7 "));let h=e.pending?e.pending.resolution.filter(c=>!c).length:0;return h>0&&r.push(`${h} question${h===1?"":"s"} pending`),e.credits&&r.push(`${e.credits.total.toFixed(1)} credits`),{items:r}}function Z(e,i){let n=[],r=e.applied+e.committed+e.retired;n.push(`${r} applied`),n.push(`${i} to decide`);let u=[];return e.skipped>0&&u.push(`${e.skipped} skipped`),e.deferred>0&&u.push(`${e.deferred} deferred`),e.failed>0&&u.push(`${e.failed} failed`),{items:[...n,...u]}}var x=C(q(),1);function ne({onToggleThinking:e,onCtrlC:i,explorer:n,panel:r}){let l=(0,x.useRef)(null),a=(0,x.useRef)(""),h=()=>{l.current&&clearTimeout(l.current),l.current=null,a.current=""};return(0,x.useEffect)(()=>h,[]),O((c,o)=>{if(o.ctrl&&c==="t"){e();return}if(o.ctrl&&c==="c"){i();return}if(!o.ctrl&&c.includes("")){i();return}if(!o.ctrl&&c.includes("")){e();return}if(n&&n.isOpen()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),n.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return){h(),o.return?n.onEnter():n.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){(p[1]==="A"||p[1]==="B")&&n.onMove(p[1]==="A"?-1:1);return}n.onBack();return}if(o.upArrow){n.onMove(-1);return}if(o.downArrow){n.onMove(1);return}if(o.return){n.onEnter();return}if(o.escape){a.current="",v();return}return}if(r&&r.isFocused()){let v=()=>{l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{h(),r.onBack()},150)};if(l.current){if(o.upArrow||o.downArrow||o.return||o.leftArrow||o.rightArrow){h(),o.return?r.onSelect():o.leftArrow?r.onLeft?.():o.rightArrow?r.onRight?.():r.onMove(o.upArrow?-1:1);return}if(a.current+=c,a.current==="["){v();return}let g=a.current;h();let p=/^\[([ABCD])/.exec(g);if(p){p[1]==="A"||p[1]==="B"?r.onMove(p[1]==="A"?-1:1):p[1]==="C"?r.onRight?.():r.onLeft?.();return}r.onBack();return}if(o.upArrow){r.onMove(-1);return}if(o.downArrow){r.onMove(1);return}if(o.leftArrow){r.onLeft?.();return}if(o.rightArrow){r.onRight?.();return}if(o.return){r.onSelect();return}if(o.escape){a.current="",v();return}if(/^[1-9]$/.test(c)){r.onDigit(Number(c));return}if(o.tab){r.onTab?.();return}if(c===" "&&r.isMulti()){r.onSpace();return}if(c&&!o.ctrl&&!o.meta){r.onType(c);return}return}}),null}var t=C(D(),1);function N(e,i=!1){return i?Y(e):e.kind==="REVIEW"?[{v:"approve",label:"approve",detail:"mark it reviewed and trusted"},{v:"archive",label:"archive",detail:"reject it \u2014 asks for a reason; impact shown above"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="PAIR"?[{v:"merge",label:"merge",detail:"duplicate \u2014 fold into the older item (it stays unreviewed)"},{v:"keep_both",label:"keep both",detail:"genuinely distinct \u2014 promote both"},{v:"defer",label:"defer",detail:"not now \u2014 stays queued"}]:e.kind==="ARCHIVE"?[{v:"archive",label:"retire",detail:"hidden from now on; history is kept and it can be reverted"},{v:"skip",label:"skip",detail:"keep it \u2014 decided, never re-offered"},{v:"defer",label:"defer",detail:"not now \u2014 the plan re-offers it"}]:e.heldPayload?[{v:"approve",label:"approve update",detail:"commit the held payload \u2014 impact preview above"},{v:"skip",label:"keep current",detail:"drop the held payload (the owner's disk state stays untouched)"},{v:"defer",label:"defer",detail:"not now \u2014 stays held"}]:[{v:"approve",label:"approve",detail:e.kind==="ADD"?"commit + design it":"commit the updated version (old\u2192new redirect)"},{v:"skip",label:e.origin==="content-change"?"reject":"skip",detail:e.origin==="content-change"?"drop the staged proposal \u2014 nothing committed":"leave it as is"},{v:"defer",label:"defer",detail:"not now \u2014 the plan keeps it staged"}]}var Q=e=>e===0?null:e===1?"its test was designed for the old version":`its ${e} tests were designed for the old version`;function Y(e){return e.heldPayload?[{v:"approve",label:"approve the change",detail:"the use-case takes the new version"},{v:"skip",label:"keep it as it is",detail:"the change is dropped"},{v:"defer",label:"decide later",detail:"it keeps waiting"}]:e.kind==="ARCHIVE"?[...e.archiveRefused?[]:[{v:"archive",label:"archive",detail:"it's hidden from the project from now on"}],{v:"skip",label:"keep it",detail:"it stays as it is; this may be suggested again"},{v:"defer",label:"defer",detail:"decide later; it's kept as an open question"}]:e.kind==="ADD"?[{v:"approve",label:"approve",detail:"add it to this session"},{v:"skip",label:"reject",detail:"leave it out; it may be suggested again"},{v:"defer",label:"defer",detail:"leave it out for now, as an open question"}]:[{v:"approve",label:"approve",detail:"the use-case takes the new version"},{v:"skip",label:"reject",detail:"it stays as it is; the change may be suggested again"},{v:"defer",label:"defer",detail:"it stays as it is for now, as an open question"}]}function K(e,i=!1){let n=N(e,i);return e.viewDiff&&n.push({v:"view_diff",label:"view diff",detail:i?"the whole change, old \u2192 new":"full old \u2192 new"}),n}function R(e,i=!1){return e.kind==="ARCHIVE"?null:K(e,i).length}var G={ADD:{color:f.green??"green"},MODIFY:{color:"yellow"},ARCHIVE:{color:f.red},REVIEW:{color:"cyan"},PAIR:{color:"magenta"}},U=60,X=(e,i)=>`${e.heldPayload?"changed earlier":e.kind==="ADD"?"new":e.kind==="ARCHIVE"?`no longer in ${$(i)}`:"changed"}:`;function de({card:e,position:i,sel:n=0,focused:r=!1,freeText:u=null,editorIntent:l="steer",remote:a,gapAbove:h=!0}){let{stdout:c}=_(),o=c?.columns??80,v=o<U,g=K(e,!!a),p=R(e,!!a),H=G[e.kind],S=d=>r&&n===d?(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"}):" ",b=e.impact,k=a?e.kind==="MODIFY"?Q(e.tests??0):null:b&&"stale_refs"in b&&b.stale_refs.length>0?`${e.kind==="ARCHIVE"?"retiring leaves":"approving marks"} ${b.stale_refs.length} item(s) stale`+((b.direct_refs?.length??0)>0?` \u2014 ${b.direct_refs.length} directly touched: ${b.direct_refs.join(", ")}`:""):b&&"design_children"in b?`${e.kind==="REVIEW"?"archiving drops":"merging folds"} ${b.design_children} design child(ren)`:null,T=e.provenance&&e.provenance!==e.why?e.provenance:a?null:e.origin??null,B=a?[{label:"change",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...k?[{label:"tests",text:k}]:[]]:[{label:"why",text:e.why},...T?[{label:"from",text:T,dimmer:!0}]:[],...e.tier?[{label:"match",text:e.tier,dimmer:!0}]:[],...k?[{label:"impact",text:k}]:[]],E=Math.max(...B.map(d=>d.label.length)),A=a?`? review the changes from ${$(a.source)}`:"? reconcile",y=a?`${i.n} of ${i.of}`:`item ${i.n} of ${i.of}`,W=(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{bold:!0,children:[(0,t.jsx)(s,{color:H.color,children:a?X(e,a.source):`[${e.kind}]`}),` ${a?M(e):j(e.title)}`]})}),B.map((d,w)=>a?(0,t.jsxs)(m,{paddingLeft:2,children:[(0,t.jsx)(m,{flexShrink:0,width:E+2,children:(0,t.jsx)(s,{color:f.dim,children:d.label})}),(0,t.jsx)(m,{flexGrow:1,children:(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})})]},`f-${w}`):(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.dim,children:`${d.label.padEnd(E)} `}),(0,t.jsx)(s,{color:d.dimmer?f.dim:void 0,children:d.text})]})},`f-${w}`)),e.diffSummary?(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:e.diffSummary})}):(e.diff??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:4,children:(0,t.jsx)(s,{color:d.op==="-"?"red":"green",children:`${d.op==="-"?"\u2212":"+"} ${d.field==="criteria"?a?"acceptance criterion":"criterion":d.field}: ${d.text}`})},`d-${w}`)),(a?[]:e.citeLines??[]).map((d,w)=>(0,t.jsx)(m,{paddingLeft:2,children:(0,t.jsx)(s,{color:f.dim,children:d})},`c-${w}`)),(0,t.jsx)(s,{children:" "}),g.map((d,w)=>(0,t.jsxs)(s,{children:[S(w),` ${w+1}. ${d.label}`,(0,t.jsx)(s,{color:f.dim,children:` \u2014 ${d.detail}`})]},`o-${w}`)),p!==null||u&&l==="because"?u?(0,t.jsxs)(m,{flexDirection:"column",children:[(0,t.jsxs)(m,{children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{color:f.assuranceAccent,children:"\u276F"})," ",(0,t.jsx)(s,{color:f.dim,children:"\u270E "})]}),(0,t.jsx)(P,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:l==="because"?"why archive it?":l==="adjust"?"tell me what to change":"say what to adjust"})]}),(0,t.jsx)(s,{color:f.muted,children:l==="because"?" submits as: archive \xB7 your reason goes on the record":l==="adjust"?" the agent looks at this change again, with your words":e.kind==="PAIR"?" submits as: defer \xB7 your note parks with the card (it re-offers)":" submits as: approve \xB7 your words steer the re-design"})]}):p!==null?(0,t.jsxs)(s,{children:[S(p)," ",(0,t.jsx)(s,{color:f.dim,children:l==="adjust"?"\u270E adjust \u2014 tell me what to change":e.kind==="PAIR"?"\u270E defer with a note \u2014 say what you noticed":"\u270E approve with changes \u2014 say what to adjust"})]}):null:null]});if(v)return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A}),(0,t.jsx)(s,{color:f.dim,children:y}),W]});let V=Math.max(2,Math.min(o-1,100)-A.length-y.length);return(0,t.jsxs)(m,{marginTop:h?1:0,marginBottom:1,flexDirection:"column",children:[(0,t.jsxs)(s,{children:[(0,t.jsx)(s,{bold:!0,color:f.assuranceAccent,children:A})," ".repeat(V),(0,t.jsx)(s,{color:f.dim,children:y})]}),(0,t.jsx)(s,{children:" "}),W]})}function fe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.multi_select&&n.push("space toggle"),i.batchCount>1&&n.push("\u2190 \u2192 questions"),(e.allow_free_text||e.options.some(r=>r.input===!0))&&n.push("\u270E type your own"),i.canAttach&&n.push("@ attach a file or URL"),i.escBack&&n.push("esc back"),{keys:n}}function pe(e,i){let n=["\u2191\u2193 select","\u23CE confirm"];return e.some(r=>r.free)&&n.push("\u270E type your own"),i.escBack&&n.push("esc back"),{keys:n}}function he(e){let i=["\u2191\u2193 select","\u23CE confirm","1-9 verdict"];return R(e)!==null&&i.push("type = adjust"),i.push("esc \xB7 nothing to undo"),{keys:i}}export{J as a,Z as b,ne as c,N as d,K as e,R as f,de as g,fe as h,pe as i,he as j};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as l}from"./chunk-WD52ZNQY.js";import{b as i,d as p,e as f,g,h as u}from"./chunk-77ZZQJLX.js";import{b as d}from"./chunk-
|
|
2
|
+
import{b as l}from"./chunk-WD52ZNQY.js";import{b as i,d as p,e as f,g,h as u}from"./chunk-77ZZQJLX.js";import{b as d}from"./chunk-LV7224DG.js";import{existsSync as t,mkdirSync as w,readFileSync as S,renameSync as y,writeFileSync as D}from"fs";import{join as j}from"path";function O(r){l(i(r));let a=i(r);if(!t(a))return;let s=j(a,"meta.json"),n=f(r);if(t(s)&&!t(n))try{w(p(r),{recursive:!0}),y(s,n)}catch(e){process.stderr.write(`warn: meta.json migration failed: ${e.message}
|
|
3
3
|
`)}let c=u(r);if(t(c)){let e="python";try{let o=new d().load();o.code_export?.language&&(e=o.code_export.language)}catch{}let m=g(r,"playwright",e);if(!t(m))try{y(c,m)}catch(o){process.stderr.write(`warn: generated-code migration failed: ${o.message}
|
|
4
4
|
`)}}if(t(n))try{let e=JSON.parse(S(n,"utf8"));"md5sum"in e&&(delete e.md5sum,D(n,JSON.stringify(e,null,2)+`
|
|
5
5
|
`,"utf8"))}catch(e){process.stderr.write(`warn: meta.json md5sum strip failed: ${e.message}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as B,c as S,d as T}from"./chunk-
|
|
2
|
+
import{b as B,c as S,d as T}from"./chunk-35WUYKGO.js";import{c as g}from"./chunk-RFHMDQXZ.js";import{a as E}from"./chunk-ND6OP3O2.js";import{a as h}from"./chunk-HCBYKLMW.js";import{a as i,b as c,c as w,i as x}from"./chunk-33DWJV67.js";import{a as L}from"./chunk-6YGTRKDT.js";import{z as n}from"./chunk-J4FIESTB.js";import{e as u}from"./chunk-UR6MHSHU.js";var l=u(L(),1);var r=u(h(),1);function y(e){return new Map(e.map((o,s)=>[`${s}-${o.label}`,o.packPath]))}async function H(e){let o=e.deps?.viewerBase??S(e.env),s=e.deps?.startServer??B,a=e.deps?.openUrl??(m=>g(m).then(()=>{})),t=y(e.rows),d;try{d=await s({packs:t,allowedOrigins:[new URL(o).origin]});let m=d,D=async p=>{let v=[...t.keys()][p];await a(T(m.urlFor(v),o))};if(e.deps?.hold){await e.deps.hold();return}await new Promise(p=>{let v=w(l.default.createElement(P,{rows:e.rows,onOpen:D,onDone:()=>{v.unmount(),p()}}),{stdout:process.stderr,exitOnCtrlC:!1})})}finally{await d?.close()}}function I(e){return e==="passed"?n.green:e==="failed"||e==="broken"||e==="cancelled"?n.red:n.dim}var b=40,R=9,k=20;function f(e,o){return e.length>o?e.slice(0,o-1)+"\u2026":e.padEnd(o)}function O({row:e,selected:o}){let s=e.testId??e.commitId??"";return(0,r.jsxs)(i,{children:[(0,r.jsx)(i,{width:2,flexShrink:0,children:(0,r.jsx)(c,{color:n.orange,children:o?"\u25B8":" "})}),(0,r.jsx)(i,{width:2,flexShrink:0,children:(0,r.jsx)(c,{color:e.kind==="execution"?n.orange:n.muted,children:e.kind==="execution"?"\u25CF":"\u25CB"})}),(0,r.jsx)(i,{width:b,flexShrink:0,children:(0,r.jsx)(c,{color:o?n.orange:void 0,bold:o,wrap:"truncate-end",children:f(e.label,b)})}),(0,r.jsx)(i,{width:R,flexShrink:0,children:(0,r.jsx)(c,{color:I(e.status),bold:o,wrap:"truncate-end",children:f(e.status,R)})}),(0,r.jsx)(i,{width:k,flexShrink:0,children:(0,r.jsx)(c,{color:n.dim,wrap:"truncate-end",children:f(s,k)})})]})}function P(e){let[o,s]=(0,l.useState)(0);return x((a,t)=>{t.upArrow?s(d=>Math.max(0,d-1)):t.downArrow?s(d=>Math.min(e.rows.length-1,d+1)):t.return||a==="o"?e.onOpen(o):(a==="q"||t.escape)&&e.onDone()}),(0,r.jsx)(E,{title:"Evidence",borderColor:n.muted,children:(0,r.jsxs)(i,{flexDirection:"column",children:[e.rows.map((a,t)=>(0,r.jsx)(O,{row:a,selected:t===o},t)),(0,r.jsx)(i,{marginTop:1,children:(0,r.jsx)(c,{color:n.dim,children:"\u2191/\u2193 move \xB7 enter/o open \xB7 q quit"})})]})})}export{y as a,H as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as s}from"./chunk-HCBYKLMW.js";import{a as i,b as n}from"./chunk-33DWJV67.js";import{z as a}from"./chunk-
|
|
2
|
+
import{a as s}from"./chunk-HCBYKLMW.js";import{a as i,b as n}from"./chunk-33DWJV67.js";import{z as a}from"./chunk-J4FIESTB.js";import{e as r}from"./chunk-UR6MHSHU.js";var o=r(s(),1);function g({bindings:c,suppressEscBack:p=!1,escBackLabel:m="back to chat"}){let e=c.map(t=>`${t.keys} ${t.label}`);return p||e.push(`esc \xB7 ${m}`),(0,o.jsx)(i,{marginTop:1,children:(0,o.jsx)(n,{color:a.dim,children:e.join(" \xB7 ")})})}export{g as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as h,d as P}from"./chunk-SMXABALN.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as i,b as t,k as O}from"./chunk-33DWJV67.js";import{z as l}from"./chunk-
|
|
2
|
+
import{c as h,d as P}from"./chunk-SMXABALN.js";import{a as $}from"./chunk-HCBYKLMW.js";import{a as i,b as t,k as O}from"./chunk-33DWJV67.js";import{z as l}from"./chunk-J4FIESTB.js";import{e as y}from"./chunk-UR6MHSHU.js";var o=y($(),1);function L(a){let c=a.findIndex(m=>m.free);return c>=0?c:null}var v=60,A=100;function N({headline:a,ask:c=!1,rows:m,sel:u,focused:x,freeText:n=null,freeTextNote:d,sublines:B=[],gapAbove:p=!0,accent:s=l.assuranceAccent}){let{stdout:C}=O(),b=C?.columns??80,S=b<v,F=Math.min(b-1,A),f=e=>x&&u===e?(0,o.jsx)(t,{color:s,children:"\u276F"}):" ",T=c?`? ${a}`:a,g=Math.max(4,F-3),R=B.map((e,r)=>(0,o.jsx)(t,{color:l.dim,children:` ${e.length>g?`${e.slice(0,g-1)}\u2026`:e}`},`sub-${r}`)),k=0,w=m.map((e,r)=>e.free?n?(0,o.jsxs)(i,{flexDirection:"column",children:[(0,o.jsxs)(i,{children:[(0,o.jsxs)(t,{children:[(0,o.jsx)(t,{color:s,children:"\u276F"})," ",(0,o.jsx)(t,{color:l.dim,children:"\u270E "})]}),n.keysFromPanel?(0,o.jsx)(P,{value:n.value,placeholder:e.label}):(0,o.jsx)(h,{value:n.value,onChange:n.onChange,onSubmit:n.onSubmit,onCancel:n.onCancel,placeholder:e.label})]}),d?(0,o.jsx)(t,{color:l.muted,children:` ${d}`}):null]},e.key):(0,o.jsxs)(t,{children:[f(r)," ",(0,o.jsx)(t,{color:l.dim,children:`\u270E ${e.label}`})]},e.key):(k+=1,(0,o.jsxs)(t,{bold:x&&u===r,children:[f(r),` ${k}. ${e.label}`,e.detail?(0,o.jsx)(t,{color:l.dim,bold:!1,children:` \u2014 ${e.detail}`}):null]},e.key)));return S?(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,w]}):(0,o.jsxs)(i,{marginTop:p?1:0,marginBottom:1,flexDirection:"column",children:[(0,o.jsx)(t,{bold:!0,color:s,children:T}),R,(0,o.jsx)(t,{children:" "}),w]})}export{L as a,N as b};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as i}from"./chunk-
|
|
2
|
+
import{e as i}from"./chunk-7YV2FCN4.js";import{a as s,b as c,c as n}from"./chunk-ZCRZFAOT.js";import{appendFileSync as m,mkdirSync as u,readFileSync as g,writeFileSync as f}from"fs";import o from"path";var l=!1,p,x=({verb:r,contextInstanceId:e,sessionId:t})=>l&&e===null?n(p??r,t):c(e,r,t);function P(r){l=!0,p=r}function h(r,e){return{path:r,line:(t,d={})=>{if(r!==null)try{u(o.dirname(r),{recursive:!0}),m(r,JSON.stringify({ts:new Date().toISOString(),level:"info",user_session_id:e,source:"kane-cli",kind:t,data:d})+`
|
|
3
3
|
`)}catch{}}}}function k(r,e){return h(i()?n(r,e):null,e)}var a=r=>o.join(s(),"shared","logs","sessions",`${r}.trace`);function R(r,e){try{u(o.dirname(a(r)),{recursive:!0}),f(a(r),e)}catch{}}function O(r){if(!i())return null;try{return g(a(r),"utf8").trim()||null}catch{return null}}export{x as a,P as b,h as c,k as d,R as e,O as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-HCBYKLMW.js";import{a as m,b as r,i as d}from"./chunk-33DWJV67.js";import{a as u}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-HCBYKLMW.js";import{a as m,b as r,i as d}from"./chunk-33DWJV67.js";import{a as u}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-J4FIESTB.js";import{e as s}from"./chunk-UR6MHSHU.js";var l=s(u(),1);var e=s(a(),1);function T({message:t,confirmLabel:c,choice:n}){return(0,e.jsxs)(m,{flexDirection:"column",borderStyle:"round",borderColor:o.dim,paddingX:1,children:[(0,e.jsx)(r,{bold:!0,children:t}),(0,e.jsxs)(m,{marginTop:1,children:[(0,e.jsx)(r,{color:n==="yes"?o.red:o.dim,children:`\u276F ${c}`}),(0,e.jsx)(r,{children:" "}),(0,e.jsx)(r,{color:n==="no"?o.green:o.dim,children:"\u276F No"})]}),(0,e.jsx)(r,{color:o.dim,children:"\u2190 \u2192 choose \xB7 \u21B5 confirm \xB7 esc cancel"})]})}function y({message:t,onConfirm:c,onCancel:n,confirmLabel:p="Yes, end"}){let[f,g]=(0,l.useState)("no");return d((b,i)=>{(i.leftArrow||i.rightArrow)&&g(x=>x==="yes"?"no":"yes"),i.return&&(f==="yes"?c:n)(),i.escape&&n()}),(0,e.jsx)(T,{message:t,confirmLabel:p,choice:f})}export{y as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as w,c as L,g as fe,j as ge}from"./chunk-ZDCXWEQG.js";import{b as pe}from"./chunk-W2HRX3DR.js";import{d as X}from"./chunk-DBMW3VUN.js";import{a as Q}from"./chunk-7V4BQSSV.js";import{a as ue,b as le}from"./chunk-FI2DVNRT.js";import{a as de}from"./chunk-4QTH7VYE.js";var De={requestMs:3e4,requests:64,redirects:5,bodyBytes:X.contentBytes},Fe=new Set(["authorization","proxy-authorization","cookie","host"]),He=new Set(["set-cookie","set-cookie2","www-authenticate","proxy-authenticate"]);function he(e){try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.origin:null}catch{return null}}async function Je(e,t,n,r){let i=Number(e.headers.get("content-length"));if(Number.isFinite(i)&&i>t&&(await e.body?.cancel().catch(()=>{}),r(`${n} answered with ${i} bytes; a plugin's source may be at most ${t}`)),e.body===null)return new Uint8Array(0);let s=e.body.getReader(),u=[],c=0;for(;;){let{done:k,value:x}=await s.read();if(k)break;c+=x.byteLength,c>t&&(await s.cancel().catch(()=>{}),r(`${n} answered with more than ${t} bytes; a plugin's source may be at most ${t}`)),u.push(x)}let l=new Uint8Array(c),g=0;for(let k of u)l.set(k,g),g+=k.byteLength;return l}function xe(e){let{plugin:t}=e,n={...De,...e.limits},r=e.fetchImpl??fetch,i=new Set(e.allow.map(h=>he(h)).filter(h=>h!==null)),s=[...i].join(", ")||"no origin",u=0,c=null,l=!1,g=new Set,k=()=>{throw new L({code:"PLUGIN_CONNECTION_REFUSED",message:`the connection for plugin ${t} is closed: its fetch has ended`,plugin:t,hook:"fetch"})},x=(h,o)=>{let d=new L({code:h,message:o,plugin:t,hook:"fetch"});throw c??=d,d},$=h=>x("PLUGIN_CONNECTION_REFUSED",`plugin ${t} ${h}`),R=(h,o)=>{let d=he(h);return d===null&&$(`${o} ${JSON.stringify(h)}, which is not an http or https URL`),i.has(d)||$(`${o} ${h}, which is not an origin it may reach \u2014 it may reach ${s}`),new URL(h)};return{get breach(){return c},close(){l=!0;for(let h of g)h.abort();g.clear()},async request(h){l&&k();let o=h.method??"GET",d=o==="POST"?h.body:void 0;o!=="GET"&&o!=="POST"&&$(`asked for a ${JSON.stringify(o)} request; a plugin's connection makes GET and POST requests only`);let p={};for(let[m,O]of Object.entries(h.headers??{})){let E=m.toLowerCase();Fe.has(E)&&$(`set the ${E} header itself; the host adds its own credentials, and a plugin never sends any`),p[E]=String(O)}let a=R(h.url,"asked the connection for");for(let m=0;;m+=1){u+=1,u>n.requests&&$(`made more than ${n.requests} requests in one fetch`);let O={...p};for(let[C,T]of Object.entries(await e.authorize(a)))O[C.toLowerCase()]=String(T);l&&k();let E=new AbortController;g.add(E);let I=setTimeout(()=>E.abort(),n.requestMs),U;try{U=await r(a,{method:o,headers:O,redirect:"manual",signal:E.signal,...d!==void 0?{body:d}:{}})}catch(C){throw g.delete(E),clearTimeout(I),l&&k(),E.signal.aborted?new Error(`${a.origin} did not answer plugin ${t}'s request within ${n.requestMs/1e3} seconds`):new Error(`plugin ${t}'s request to ${a.origin} failed: ${C instanceof Error?C.message:String(C)}`)}try{let C=U.status>=300&&U.status<400?U.headers.get("location"):null;if(C!==null){await U.body?.cancel().catch(()=>{}),m>=n.redirects&&$(`was redirected more than ${n.redirects} times from ${h.url}`),a=R(new URL(C,a).href,"was redirected to"),(U.status===303||(U.status===301||U.status===302)&&o==="POST")&&(o="GET",d=void 0,delete p["content-type"],delete p["content-length"]);continue}let T=await Je(U,n.bodyBytes,a.href,M=>x("PLUGIN_CONTENT_TOO_LARGE",M)),H={};return U.headers.forEach((M,S)=>{He.has(S.toLowerCase())||(H[S.toLowerCase()]=M)}),{status:U.status,headers:H,body:T}}catch(C){throw l&&!(C instanceof L)&&k(),E.signal.aborted?new Error(`${a.origin} did not finish answering plugin ${t}'s request within ${n.requestMs/1e3} seconds`):C}finally{g.delete(E),clearTimeout(I)}}}}}var ee=()=>ue(le()).controllerBaseUrl,Me={explore:e=>[new URL(e).origin]};async function Xe(e){let t=await e.controller();if(t.basic)return{authorization:de(t.basic.username,t.basic.accessKey)};if(t.token)return{authorization:`Bearer ${t.token}`};throw new Error("no credentials for the controller: run `kane-cli login`, then try again")}var Ge="run `kane-cli login`, then run the command again";function qe(e,t){let n=null;return{get breach(){return t.breach??n},close:()=>t.close(),request:async r=>{if(n!==null)throw n;let i=await t.request(r);return i.status===401&&n===null&&(n=new L({code:"PLUGIN_REFUSED",message:`${new URL(r.url).origin} refused the credential this run holds (${i.status}) when plugin ${e} fetched`,plugin:e,hook:"fetch",remedy:Ge})),i}}}function Ve(e,t={}){let n=t.origins??Me;if(!Object.hasOwn(n,e))return;let r=n[e],i=t.credentials??pe;return qe(e,xe({plugin:e,allow:r((t.controller??ee)()),authorize:()=>Xe(i),...t.fetchImpl?{fetchImpl:t.fetchImpl}:{}}))}var we=e=>Ve(e);import{createHash as ze}from"crypto";var re="exploration-export/1",F="exploration-export/2",We=new Set([re,F]),ye="/exploration/{id}/assurance",W="explore",te=/^[0-9a-f]{8}-[0-9a-f]{4}-[47][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function $e(e){let t=`${W}://`;if(!e.startsWith(t))return{ok:!1,why:`it does not start with ${t}`};let n=e.slice(t.length),r=n.indexOf("?"),i=r===-1?n:n.slice(0,r);if(!te.test(i))return{ok:!1,why:`${JSON.stringify(i)} is not an exploration id: a lowercase UUID, as kane-cli explore prints it`};if(r===-1)return{ok:!0,value:{exploration:i}};let s={exploration:i};for(let u of n.slice(r+1).split("&")){let c=/^(run|cut)=(.*)$/.exec(u);if(c===null)return{ok:!1,why:`after "?" only run=<run id> and cut=<N>|end may come; found ${JSON.stringify(u)}`};let[,l,g]=c;if(s[l]!==void 0)return{ok:!1,why:`${l} is given twice`};if(l==="run"){if(!te.test(g))return{ok:!1,why:`${JSON.stringify(g)} is not a run id: a lowercase UUID`};s.run=g}else if(g==="end")s.cut="end";else if(/^(0|[1-9]\d{0,8})$/.test(g))s.cut=Number(g);else return{ok:!1,why:`${JSON.stringify(g)} is not a cut: a whole number or end`}}return{ok:!0,value:s}}var me=e=>`explore-${e.exploration}`,Ee=e=>`${W}://${e.exploration}`,Be={junction:"junctions",control:"controls",flow:"flows",finding:"findings"},ne=/^[A-Za-z0-9][A-Za-z0-9._:/#-]{0,127}$/,y=e=>{throw new w(`the exploration export cannot be read: ${e}`,"the explorer answered an export this build does not understand; update kane-cli, or report it to the explorer's team")};function oe(e){if(typeof e!="string"||!We.has(e))throw new w(`exploration export version ${JSON.stringify(e)} is not supported by this build \u2014 update kane-cli`,"update kane-cli, then ingest it again")}var P=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),D=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0,Ke=(e,t)=>e.id<t.id?-1:e.id>t.id?1:0;function z(e,t){let n=Be[e];Array.isArray(t)||y(`${n} is not a list`);let r=new Set;return t.map((i,s)=>{P(i)||y(`${n}[${s}] is not an object`);let u=i;(typeof u.id!="string"||!ne.test(u.id))&&y(`${n}[${s}] has no id the explorer gives a ${e}`);let c=u.id;return r.has(c)&&y(`${n} names ${c} twice`),r.add(c),(u.fp===void 0||u.fp===null)&&y(`${n}[${s}] (${c}) has no fp, which its fingerprint is made of`),{id:c,fp:u.fp,text:P(u.text)?u.text:{},info:P(u.info)?u.info:{}}}).sort(Ke)}var Ye=new Set(["stopped","completed","paused","failed","cancelled"]),ie="x-export-digest",_e=(e,t)=>t===`sha256:${ze("sha256").update(e).digest("hex")}`;function B(e,t){P(e)||y(`${t} has no cursor`);let n=e;oe(n.export_version),(typeof n.run!="string"||n.run==="")&&y(`${t}'s cursor names no run`),D(n.run_version)||y(`${t}'s cursor has no whole run_version`),D(n.deltas)||y(`${t}'s cursor has no whole deltas`);let r={export_version:n.export_version,run:n.run,run_version:n.run_version,deltas:n.deltas};return r.export_version===F&&(n.cut!=="end"&&!D(n.cut)&&y(`${t}'s cursor has no cut (a whole number or end)`),typeof n.provisional!="boolean"&&y(`${t}'s cursor does not say whether it is provisional`),r.cut=n.cut,r.provisional=n.provisional),r}var se=e=>JSON.stringify(e.export_version===F?[e.export_version,e.run,e.run_version,e.deltas,e.cut??"end",e.provisional===!0]:[e.export_version,e.run,e.run_version,e.deltas]);function ke(e){let t;try{t=JSON.parse(e)}catch{return null}if(!Array.isArray(t)||t.length<4)return null;let[n,r,i,s,u,c]=t;return typeof n!="string"||typeof r!="string"||!D(i)||!D(s)?null:{export_version:n,run:r,run_version:i,deltas:s,...t.length>=6&&(u==="end"||D(u))?{cut:u,provisional:c===!0}:{}}}function be(e){let t;try{t=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(e))}catch{y("it is not JSON")}P(t)||y("it is not a JSON object");let n=t;P(n.cursor)||y("the export has no cursor");let r=n.cursor;return n.cursor={export_version:r.export_version,...r.provisional!==void 0?{provisional:r.provisional}:{}},delete n.run_state,new TextEncoder().encode(JSON.stringify(n))}function Ze(e,t){if(P(e)&&e.run!==void 0)return B(e,t);P(e)||y(`${t} has no cursor`);let n=e;return oe(n.export_version),n.export_version===F&&typeof n.provisional!="boolean"&&y(`${t}'s cursor does not say whether it is provisional`),{export_version:n.export_version,...typeof n.provisional=="boolean"?{provisional:n.provisional}:{}}}function Se(e){return ve(e,B,!0)}function K(e){return ve(e,Ze,!1)}function ve(e,t,n){let r;try{r=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(e))}catch{y("it is not JSON")}P(r)||y("it is not a JSON object");let i=r;oe(i.export_version),(typeof i.exploration_id!="string"||!te.test(i.exploration_id))&&y("exploration_id is not a lowercase UUID");let s=t(i.cursor,"the export");if(s.export_version!==i.export_version&&y(`its cursor is of ${s.export_version}, the export of ${String(i.export_version)}`),n&&s.provisional!==!0&&(typeof i.run_state!="string"||!Ye.has(i.run_state))){let x=s.run;throw new w(`the export of exploration ${i.exploration_id} is of ${x!==void 0?`run ${x}`:"a run"}, which has not ended (${JSON.stringify(i.run_state??null)}): the export is read once it ends`,"try again after the run ends; the current version is kept")}let u=x=>typeof i[x]=="string"?i[x]:null,c={junctions:z("junction",i.junctions),controls:z("control",i.controls),flows:z("flow",i.flows),findings:z("finding",i.findings)},l=new Set(Object.values(c).flatMap(x=>x.map($=>$.id))),g=i.redirects??{};P(g)||y("redirects is not an object");let k={};for(let[x,$]of Object.entries(g).sort(([R],[h])=>R<h?-1:R>h?1:0))(!ne.test(x)||typeof $!="string"||!ne.test($))&&y(`the redirect from ${JSON.stringify(x)} is not one explorer id to another`),Object.hasOwn(g,$)&&y(`the redirect from ${x} goes to ${$}, which is itself redirected: a redirect names the unit that took the id over`),l.has(x)&&y(`${x} is both a unit and redirected to ${$}`),l.has($)||y(`${x} is redirected to ${$}, which is not a unit of the export`),k[x]=$;return{export_version:i.export_version,exploration_id:i.exploration_id,project_id:u("project_id"),target_url:u("target_url"),cursor:s,run_state:u("run_state"),skipped:D(i.skipped)?i.skipped:0,...c,redirects:k}}import{createHash as Qe}from"crypto";var b={junction:"junction",control:"control",flow:"flow",retiredFlow:"flow.retired",finding:"finding",alias:"merged"},Re=/^[0-9a-f]{64}$/,j={junction:e=>`j:${e}`,control:e=>`c:${Re.test(e)?e.slice(0,16):e}`,flow:e=>`f:${e}`,finding:e=>`fd:${e}`},Oe=e=>Qe("sha256").update(Q(e),"utf8").digest().subarray(0,16).toString("base64url"),G=(e,t)=>Oe({kind:e,fp:t.fp}),et=(e,t)=>Oe({kind:"alias",survivor:e,fingerprint:t}),v=(e,t=200)=>{let n=(typeof e=="string"?e:Q(e??null)).replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}\u2026`:n},N=e=>JSON.stringify(v(e??"")),Y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),f=(e,t)=>Y(e)?e[t]:void 0,_=e=>typeof e=="string"&&e!==""?e:void 0,ae=e=>typeof e=="string"&&Re.test(e)?e.slice(0,12):v(e),tt=" (in flight at this cut: not citable yet)";function Z(e){let t=o=>e.cursor.provisional===!0&&o.info.settled===!1,n=o=>t(o)?tt:"",r=[],i=[],s=new Map,u=(o,d,p,a,m,O)=>{let E=s.get(o);if(E!==void 0)throw new w(`two units of exploration ${e.exploration_id} have the id ${o} (${E} and ${d}), so neither can be told apart`,"report it to kane's team: the unit id needs more of the explorer's id");s.set(o,d),i.push({id:o,ref:o,kind:p,lines:[a,r.length],fingerprint:m,...O!==void 0?{label:v(O,80)}:{}})},c=new Map;for(let o of["junction","control","flow","finding"])for(let d of e[`${o}s`])c.set(d.id,o);let l=o=>{if(typeof o!="string")return v(o);let d=c.get(e.redirects[o]??o);return d!==void 0?j[d](o):o};r.push(`Exploration ${e.exploration_id}${e.target_url!==null?` of ${v(e.target_url)}`:""}`),r.push(`Project: ${e.project_id??"none"}`),e.skipped>0&&r.push(`Left out by the explorer: ${e.skipped} item(s) whose ids cannot be cited`),r.push("Units: j: a screen, c: a control on it, f: a flow, fd: a finding. Cite the unit's id.");let g=new Map,k=new Set(e.junctions.map(o=>o.id)),x=new Map,$=[];for(let o of e.controls){let d=_(o.info.junction);d!==void 0&&k.has(d)?x.set(d,[...x.get(d)??[],o]):$.push(o)}let R=o=>{let{text:d,fp:p,info:a}=o,m=[_(d.container)?` in ${N(d.container)}`:"",_(f(p,"href_pattern"))?` to ${v(f(p,"href_pattern"))}`:"",a.disabled===!0?" disabled":"",f(p,"gated")===!0?" gated":""].join("");r.push(`${j.control(o.id)} ${v(_(d.role)??f(p,"role")??"control")} ${N(d.name??d.label)}${m}${n(o)}`);let O=G("control",o);g.set(o.id,O),t(o)||u(j.control(o.id),o.id,b.control,r.length,O)};r.push("","## Screens");for(let o of e.junctions){let d=j.junction(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1;r.push(`${d} screen ${N(p.name??p.heading??p.url_pattern??o.id)} at ${v(p.url_pattern??f(a,"url_pattern")??"?")}${n(o)}`),_(p.heading)&&p.heading!==p.name&&r.push(` heading: ${N(p.heading)}`);let E=f(a,"signatures");r.push(` kind ${v(f(a,"kind")??"?")}, ${Array.isArray(E)?E.length:0} version(s), current ${ae(m.current_signature??"none")}`);let I=G("junction",o);g.set(o.id,I),t(o)||u(d,o.id,b.junction,O,I,_(p.name));for(let U of x.get(o.id)??[])R(U)}if($.length>0){r.push("","## Controls on no screen of this export");for(let o of $)R(o)}r.push("","## Flows");for(let o of e.flows){let d=j.flow(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1,E=f(a,"exit")!==null&&f(a,"exit")!==void 0?l(f(a,"exit")):"(no exit)";r.push(`${d} flow ${N(p.name??o.id)}: ${l(f(a,"entry"))} to ${E}, ${v(m.status??"?")}${n(o)}`),r.push(` steps key: ${ae(f(a,"steps_key")??"none")}`);let I=Array.isArray(p.steps)?p.steps:[];for(let S of I)r.push(` step: ${v(f(S,"kind")??"step")} ${N(f(S,"label")??"")}`);let U=Array.isArray(p.assertions)?p.assertions:[];for(let S of U)r.push(` asserts ${ae(f(S,"id"))}: ${N(f(S,"text")??"")}`);let C=f(a,"assertions");Array.isArray(C)&&C.length!==U.length&&r.push(` assertions: ${C.length}`);let T=f(a,"stateful");(Y(T)||f(a,"state")===!0||_(f(a,"in_state")))&&r.push(` stateful${Y(T)?` ${v([T.type,T.role,T.kind].filter(S=>typeof S=="string").join(" "))}`:""}${f(a,"state")===!0?", sets state":""}${_(f(a,"in_state"))?`, needs ${N(f(a,"in_state"))}`:""}`),_(f(a,"after_flow"))&&r.push(` after: ${l(f(a,"after_flow"))}`);let H=_(f(a,"retired"));H!==void 0&&r.push(` retired: ${v(H)}${_(f(a,"superseded_by"))?`, superseded by ${l(f(a,"superseded_by"))}`:""}`);let M=Array.isArray(m.changes)?m.changes.filter(Y).slice(-3).reverse():[];for(let S of M){let Le=_(S.from_exit)||_(S.to_exit)?`: exit ${_(S.from_exit)?l(S.from_exit):"none"} to ${_(S.to_exit)?l(S.to_exit):"none"}`:"";r.push(` changed in run ${v(S.run_id??"?")}: ${v(S.kind??"a change")}${Le}`)}t(o)||u(d,o.id,H!==void 0?b.retiredFlow:b.flow,O,G("flow",o),_(p.name))}r.push("","## Findings");for(let o of e.findings){let d=j.finding(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1,E=(Array.isArray(m.junctions)?m.junctions:[]).map(l).join(", "),I=[_(f(a,"candidate"))?` at ${l(f(a,"candidate"))}`:"",E!==""?` on ${E}`:""].join("");r.push(`${d} finding ${v(f(a,"kind")??"?")}${_(f(a,"category"))?` (${v(f(a,"category"))})`:""}${I}${_(m.severity)?`, ${v(m.severity)}`:""}${n(o)}`),_(p.title)&&r.push(` ${N(p.title)}`),_(p.description)&&r.push(` ${N(p.description)}`),f(a,"blocked_by")!==null&&f(a,"blocked_by")!==void 0&&r.push(` blocked by: ${v(f(a,"blocked_by"))}`),t(o)||u(d,o.id,b.finding,O,G("finding",o),_(p.title))}let h=Object.entries(e.redirects);if(h.length>0){r.push("","## Merged");for(let[o,d]of h){let p=c.get(d),a=e[`${p}s`].find(m=>m.id===d);r.push(`${j[p](o)} merged into ${j[p](d)}${n(a)}`),t(a)||u(j[p](o),o,b.alias,r.length,et(d,g.get(d)??G(p,e[`${p}s`].find(m=>m.id===d))))}}return{text:r.join(`
|
|
2
|
+
import{b as w,c as L,g as fe,j as ge}from"./chunk-ZDCXWEQG.js";import{b as pe}from"./chunk-EBJW6POT.js";import{d as X}from"./chunk-DBMW3VUN.js";import{a as Q}from"./chunk-7V4BQSSV.js";import{a as ue,b as le}from"./chunk-ZCBOHWN3.js";import{a as de}from"./chunk-4QTH7VYE.js";var De={requestMs:3e4,requests:64,redirects:5,bodyBytes:X.contentBytes},Fe=new Set(["authorization","proxy-authorization","cookie","host"]),He=new Set(["set-cookie","set-cookie2","www-authenticate","proxy-authenticate"]);function he(e){try{let t=new URL(e);return t.protocol==="https:"||t.protocol==="http:"?t.origin:null}catch{return null}}async function Je(e,t,n,r){let i=Number(e.headers.get("content-length"));if(Number.isFinite(i)&&i>t&&(await e.body?.cancel().catch(()=>{}),r(`${n} answered with ${i} bytes; a plugin's source may be at most ${t}`)),e.body===null)return new Uint8Array(0);let s=e.body.getReader(),u=[],c=0;for(;;){let{done:k,value:x}=await s.read();if(k)break;c+=x.byteLength,c>t&&(await s.cancel().catch(()=>{}),r(`${n} answered with more than ${t} bytes; a plugin's source may be at most ${t}`)),u.push(x)}let l=new Uint8Array(c),g=0;for(let k of u)l.set(k,g),g+=k.byteLength;return l}function xe(e){let{plugin:t}=e,n={...De,...e.limits},r=e.fetchImpl??fetch,i=new Set(e.allow.map(h=>he(h)).filter(h=>h!==null)),s=[...i].join(", ")||"no origin",u=0,c=null,l=!1,g=new Set,k=()=>{throw new L({code:"PLUGIN_CONNECTION_REFUSED",message:`the connection for plugin ${t} is closed: its fetch has ended`,plugin:t,hook:"fetch"})},x=(h,o)=>{let d=new L({code:h,message:o,plugin:t,hook:"fetch"});throw c??=d,d},$=h=>x("PLUGIN_CONNECTION_REFUSED",`plugin ${t} ${h}`),R=(h,o)=>{let d=he(h);return d===null&&$(`${o} ${JSON.stringify(h)}, which is not an http or https URL`),i.has(d)||$(`${o} ${h}, which is not an origin it may reach \u2014 it may reach ${s}`),new URL(h)};return{get breach(){return c},close(){l=!0;for(let h of g)h.abort();g.clear()},async request(h){l&&k();let o=h.method??"GET",d=o==="POST"?h.body:void 0;o!=="GET"&&o!=="POST"&&$(`asked for a ${JSON.stringify(o)} request; a plugin's connection makes GET and POST requests only`);let p={};for(let[m,O]of Object.entries(h.headers??{})){let E=m.toLowerCase();Fe.has(E)&&$(`set the ${E} header itself; the host adds its own credentials, and a plugin never sends any`),p[E]=String(O)}let a=R(h.url,"asked the connection for");for(let m=0;;m+=1){u+=1,u>n.requests&&$(`made more than ${n.requests} requests in one fetch`);let O={...p};for(let[C,T]of Object.entries(await e.authorize(a)))O[C.toLowerCase()]=String(T);l&&k();let E=new AbortController;g.add(E);let I=setTimeout(()=>E.abort(),n.requestMs),U;try{U=await r(a,{method:o,headers:O,redirect:"manual",signal:E.signal,...d!==void 0?{body:d}:{}})}catch(C){throw g.delete(E),clearTimeout(I),l&&k(),E.signal.aborted?new Error(`${a.origin} did not answer plugin ${t}'s request within ${n.requestMs/1e3} seconds`):new Error(`plugin ${t}'s request to ${a.origin} failed: ${C instanceof Error?C.message:String(C)}`)}try{let C=U.status>=300&&U.status<400?U.headers.get("location"):null;if(C!==null){await U.body?.cancel().catch(()=>{}),m>=n.redirects&&$(`was redirected more than ${n.redirects} times from ${h.url}`),a=R(new URL(C,a).href,"was redirected to"),(U.status===303||(U.status===301||U.status===302)&&o==="POST")&&(o="GET",d=void 0,delete p["content-type"],delete p["content-length"]);continue}let T=await Je(U,n.bodyBytes,a.href,M=>x("PLUGIN_CONTENT_TOO_LARGE",M)),H={};return U.headers.forEach((M,S)=>{He.has(S.toLowerCase())||(H[S.toLowerCase()]=M)}),{status:U.status,headers:H,body:T}}catch(C){throw l&&!(C instanceof L)&&k(),E.signal.aborted?new Error(`${a.origin} did not finish answering plugin ${t}'s request within ${n.requestMs/1e3} seconds`):C}finally{g.delete(E),clearTimeout(I)}}}}}var ee=()=>ue(le()).controllerBaseUrl,Me={explore:e=>[new URL(e).origin]};async function Xe(e){let t=await e.controller();if(t.basic)return{authorization:de(t.basic.username,t.basic.accessKey)};if(t.token)return{authorization:`Bearer ${t.token}`};throw new Error("no credentials for the controller: run `kane-cli login`, then try again")}var Ge="run `kane-cli login`, then run the command again";function qe(e,t){let n=null;return{get breach(){return t.breach??n},close:()=>t.close(),request:async r=>{if(n!==null)throw n;let i=await t.request(r);return i.status===401&&n===null&&(n=new L({code:"PLUGIN_REFUSED",message:`${new URL(r.url).origin} refused the credential this run holds (${i.status}) when plugin ${e} fetched`,plugin:e,hook:"fetch",remedy:Ge})),i}}}function Ve(e,t={}){let n=t.origins??Me;if(!Object.hasOwn(n,e))return;let r=n[e],i=t.credentials??pe;return qe(e,xe({plugin:e,allow:r((t.controller??ee)()),authorize:()=>Xe(i),...t.fetchImpl?{fetchImpl:t.fetchImpl}:{}}))}var we=e=>Ve(e);import{createHash as ze}from"crypto";var re="exploration-export/1",F="exploration-export/2",We=new Set([re,F]),ye="/exploration/{id}/assurance",W="explore",te=/^[0-9a-f]{8}-[0-9a-f]{4}-[47][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;function $e(e){let t=`${W}://`;if(!e.startsWith(t))return{ok:!1,why:`it does not start with ${t}`};let n=e.slice(t.length),r=n.indexOf("?"),i=r===-1?n:n.slice(0,r);if(!te.test(i))return{ok:!1,why:`${JSON.stringify(i)} is not an exploration id: a lowercase UUID, as kane-cli explore prints it`};if(r===-1)return{ok:!0,value:{exploration:i}};let s={exploration:i};for(let u of n.slice(r+1).split("&")){let c=/^(run|cut)=(.*)$/.exec(u);if(c===null)return{ok:!1,why:`after "?" only run=<run id> and cut=<N>|end may come; found ${JSON.stringify(u)}`};let[,l,g]=c;if(s[l]!==void 0)return{ok:!1,why:`${l} is given twice`};if(l==="run"){if(!te.test(g))return{ok:!1,why:`${JSON.stringify(g)} is not a run id: a lowercase UUID`};s.run=g}else if(g==="end")s.cut="end";else if(/^(0|[1-9]\d{0,8})$/.test(g))s.cut=Number(g);else return{ok:!1,why:`${JSON.stringify(g)} is not a cut: a whole number or end`}}return{ok:!0,value:s}}var me=e=>`explore-${e.exploration}`,Ee=e=>`${W}://${e.exploration}`,Be={junction:"junctions",control:"controls",flow:"flows",finding:"findings"},ne=/^[A-Za-z0-9][A-Za-z0-9._:/#-]{0,127}$/,y=e=>{throw new w(`the exploration export cannot be read: ${e}`,"the explorer answered an export this build does not understand; update kane-cli, or report it to the explorer's team")};function oe(e){if(typeof e!="string"||!We.has(e))throw new w(`exploration export version ${JSON.stringify(e)} is not supported by this build \u2014 update kane-cli`,"update kane-cli, then ingest it again")}var P=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),D=e=>typeof e=="number"&&Number.isSafeInteger(e)&&e>=0,Ke=(e,t)=>e.id<t.id?-1:e.id>t.id?1:0;function z(e,t){let n=Be[e];Array.isArray(t)||y(`${n} is not a list`);let r=new Set;return t.map((i,s)=>{P(i)||y(`${n}[${s}] is not an object`);let u=i;(typeof u.id!="string"||!ne.test(u.id))&&y(`${n}[${s}] has no id the explorer gives a ${e}`);let c=u.id;return r.has(c)&&y(`${n} names ${c} twice`),r.add(c),(u.fp===void 0||u.fp===null)&&y(`${n}[${s}] (${c}) has no fp, which its fingerprint is made of`),{id:c,fp:u.fp,text:P(u.text)?u.text:{},info:P(u.info)?u.info:{}}}).sort(Ke)}var Ye=new Set(["stopped","completed","paused","failed","cancelled"]),ie="x-export-digest",_e=(e,t)=>t===`sha256:${ze("sha256").update(e).digest("hex")}`;function B(e,t){P(e)||y(`${t} has no cursor`);let n=e;oe(n.export_version),(typeof n.run!="string"||n.run==="")&&y(`${t}'s cursor names no run`),D(n.run_version)||y(`${t}'s cursor has no whole run_version`),D(n.deltas)||y(`${t}'s cursor has no whole deltas`);let r={export_version:n.export_version,run:n.run,run_version:n.run_version,deltas:n.deltas};return r.export_version===F&&(n.cut!=="end"&&!D(n.cut)&&y(`${t}'s cursor has no cut (a whole number or end)`),typeof n.provisional!="boolean"&&y(`${t}'s cursor does not say whether it is provisional`),r.cut=n.cut,r.provisional=n.provisional),r}var se=e=>JSON.stringify(e.export_version===F?[e.export_version,e.run,e.run_version,e.deltas,e.cut??"end",e.provisional===!0]:[e.export_version,e.run,e.run_version,e.deltas]);function ke(e){let t;try{t=JSON.parse(e)}catch{return null}if(!Array.isArray(t)||t.length<4)return null;let[n,r,i,s,u,c]=t;return typeof n!="string"||typeof r!="string"||!D(i)||!D(s)?null:{export_version:n,run:r,run_version:i,deltas:s,...t.length>=6&&(u==="end"||D(u))?{cut:u,provisional:c===!0}:{}}}function be(e){let t;try{t=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(e))}catch{y("it is not JSON")}P(t)||y("it is not a JSON object");let n=t;P(n.cursor)||y("the export has no cursor");let r=n.cursor;return n.cursor={export_version:r.export_version,...r.provisional!==void 0?{provisional:r.provisional}:{}},delete n.run_state,new TextEncoder().encode(JSON.stringify(n))}function Ze(e,t){if(P(e)&&e.run!==void 0)return B(e,t);P(e)||y(`${t} has no cursor`);let n=e;return oe(n.export_version),n.export_version===F&&typeof n.provisional!="boolean"&&y(`${t}'s cursor does not say whether it is provisional`),{export_version:n.export_version,...typeof n.provisional=="boolean"?{provisional:n.provisional}:{}}}function Se(e){return ve(e,B,!0)}function K(e){return ve(e,Ze,!1)}function ve(e,t,n){let r;try{r=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(e))}catch{y("it is not JSON")}P(r)||y("it is not a JSON object");let i=r;oe(i.export_version),(typeof i.exploration_id!="string"||!te.test(i.exploration_id))&&y("exploration_id is not a lowercase UUID");let s=t(i.cursor,"the export");if(s.export_version!==i.export_version&&y(`its cursor is of ${s.export_version}, the export of ${String(i.export_version)}`),n&&s.provisional!==!0&&(typeof i.run_state!="string"||!Ye.has(i.run_state))){let x=s.run;throw new w(`the export of exploration ${i.exploration_id} is of ${x!==void 0?`run ${x}`:"a run"}, which has not ended (${JSON.stringify(i.run_state??null)}): the export is read once it ends`,"try again after the run ends; the current version is kept")}let u=x=>typeof i[x]=="string"?i[x]:null,c={junctions:z("junction",i.junctions),controls:z("control",i.controls),flows:z("flow",i.flows),findings:z("finding",i.findings)},l=new Set(Object.values(c).flatMap(x=>x.map($=>$.id))),g=i.redirects??{};P(g)||y("redirects is not an object");let k={};for(let[x,$]of Object.entries(g).sort(([R],[h])=>R<h?-1:R>h?1:0))(!ne.test(x)||typeof $!="string"||!ne.test($))&&y(`the redirect from ${JSON.stringify(x)} is not one explorer id to another`),Object.hasOwn(g,$)&&y(`the redirect from ${x} goes to ${$}, which is itself redirected: a redirect names the unit that took the id over`),l.has(x)&&y(`${x} is both a unit and redirected to ${$}`),l.has($)||y(`${x} is redirected to ${$}, which is not a unit of the export`),k[x]=$;return{export_version:i.export_version,exploration_id:i.exploration_id,project_id:u("project_id"),target_url:u("target_url"),cursor:s,run_state:u("run_state"),skipped:D(i.skipped)?i.skipped:0,...c,redirects:k}}import{createHash as Qe}from"crypto";var b={junction:"junction",control:"control",flow:"flow",retiredFlow:"flow.retired",finding:"finding",alias:"merged"},Re=/^[0-9a-f]{64}$/,j={junction:e=>`j:${e}`,control:e=>`c:${Re.test(e)?e.slice(0,16):e}`,flow:e=>`f:${e}`,finding:e=>`fd:${e}`},Oe=e=>Qe("sha256").update(Q(e),"utf8").digest().subarray(0,16).toString("base64url"),G=(e,t)=>Oe({kind:e,fp:t.fp}),et=(e,t)=>Oe({kind:"alias",survivor:e,fingerprint:t}),v=(e,t=200)=>{let n=(typeof e=="string"?e:Q(e??null)).replace(/\s+/g," ").trim();return n.length>t?`${n.slice(0,t-1)}\u2026`:n},N=e=>JSON.stringify(v(e??"")),Y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),f=(e,t)=>Y(e)?e[t]:void 0,_=e=>typeof e=="string"&&e!==""?e:void 0,ae=e=>typeof e=="string"&&Re.test(e)?e.slice(0,12):v(e),tt=" (in flight at this cut: not citable yet)";function Z(e){let t=o=>e.cursor.provisional===!0&&o.info.settled===!1,n=o=>t(o)?tt:"",r=[],i=[],s=new Map,u=(o,d,p,a,m,O)=>{let E=s.get(o);if(E!==void 0)throw new w(`two units of exploration ${e.exploration_id} have the id ${o} (${E} and ${d}), so neither can be told apart`,"report it to kane's team: the unit id needs more of the explorer's id");s.set(o,d),i.push({id:o,ref:o,kind:p,lines:[a,r.length],fingerprint:m,...O!==void 0?{label:v(O,80)}:{}})},c=new Map;for(let o of["junction","control","flow","finding"])for(let d of e[`${o}s`])c.set(d.id,o);let l=o=>{if(typeof o!="string")return v(o);let d=c.get(e.redirects[o]??o);return d!==void 0?j[d](o):o};r.push(`Exploration ${e.exploration_id}${e.target_url!==null?` of ${v(e.target_url)}`:""}`),r.push(`Project: ${e.project_id??"none"}`),e.skipped>0&&r.push(`Left out by the explorer: ${e.skipped} item(s) whose ids cannot be cited`),r.push("Units: j: a screen, c: a control on it, f: a flow, fd: a finding. Cite the unit's id.");let g=new Map,k=new Set(e.junctions.map(o=>o.id)),x=new Map,$=[];for(let o of e.controls){let d=_(o.info.junction);d!==void 0&&k.has(d)?x.set(d,[...x.get(d)??[],o]):$.push(o)}let R=o=>{let{text:d,fp:p,info:a}=o,m=[_(d.container)?` in ${N(d.container)}`:"",_(f(p,"href_pattern"))?` to ${v(f(p,"href_pattern"))}`:"",a.disabled===!0?" disabled":"",f(p,"gated")===!0?" gated":""].join("");r.push(`${j.control(o.id)} ${v(_(d.role)??f(p,"role")??"control")} ${N(d.name??d.label)}${m}${n(o)}`);let O=G("control",o);g.set(o.id,O),t(o)||u(j.control(o.id),o.id,b.control,r.length,O)};r.push("","## Screens");for(let o of e.junctions){let d=j.junction(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1;r.push(`${d} screen ${N(p.name??p.heading??p.url_pattern??o.id)} at ${v(p.url_pattern??f(a,"url_pattern")??"?")}${n(o)}`),_(p.heading)&&p.heading!==p.name&&r.push(` heading: ${N(p.heading)}`);let E=f(a,"signatures");r.push(` kind ${v(f(a,"kind")??"?")}, ${Array.isArray(E)?E.length:0} version(s), current ${ae(m.current_signature??"none")}`);let I=G("junction",o);g.set(o.id,I),t(o)||u(d,o.id,b.junction,O,I,_(p.name));for(let U of x.get(o.id)??[])R(U)}if($.length>0){r.push("","## Controls on no screen of this export");for(let o of $)R(o)}r.push("","## Flows");for(let o of e.flows){let d=j.flow(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1,E=f(a,"exit")!==null&&f(a,"exit")!==void 0?l(f(a,"exit")):"(no exit)";r.push(`${d} flow ${N(p.name??o.id)}: ${l(f(a,"entry"))} to ${E}, ${v(m.status??"?")}${n(o)}`),r.push(` steps key: ${ae(f(a,"steps_key")??"none")}`);let I=Array.isArray(p.steps)?p.steps:[];for(let S of I)r.push(` step: ${v(f(S,"kind")??"step")} ${N(f(S,"label")??"")}`);let U=Array.isArray(p.assertions)?p.assertions:[];for(let S of U)r.push(` asserts ${ae(f(S,"id"))}: ${N(f(S,"text")??"")}`);let C=f(a,"assertions");Array.isArray(C)&&C.length!==U.length&&r.push(` assertions: ${C.length}`);let T=f(a,"stateful");(Y(T)||f(a,"state")===!0||_(f(a,"in_state")))&&r.push(` stateful${Y(T)?` ${v([T.type,T.role,T.kind].filter(S=>typeof S=="string").join(" "))}`:""}${f(a,"state")===!0?", sets state":""}${_(f(a,"in_state"))?`, needs ${N(f(a,"in_state"))}`:""}`),_(f(a,"after_flow"))&&r.push(` after: ${l(f(a,"after_flow"))}`);let H=_(f(a,"retired"));H!==void 0&&r.push(` retired: ${v(H)}${_(f(a,"superseded_by"))?`, superseded by ${l(f(a,"superseded_by"))}`:""}`);let M=Array.isArray(m.changes)?m.changes.filter(Y).slice(-3).reverse():[];for(let S of M){let Le=_(S.from_exit)||_(S.to_exit)?`: exit ${_(S.from_exit)?l(S.from_exit):"none"} to ${_(S.to_exit)?l(S.to_exit):"none"}`:"";r.push(` changed in run ${v(S.run_id??"?")}: ${v(S.kind??"a change")}${Le}`)}t(o)||u(d,o.id,H!==void 0?b.retiredFlow:b.flow,O,G("flow",o),_(p.name))}r.push("","## Findings");for(let o of e.findings){let d=j.finding(o.id),{text:p,fp:a,info:m}=o;r.push("");let O=r.length+1,E=(Array.isArray(m.junctions)?m.junctions:[]).map(l).join(", "),I=[_(f(a,"candidate"))?` at ${l(f(a,"candidate"))}`:"",E!==""?` on ${E}`:""].join("");r.push(`${d} finding ${v(f(a,"kind")??"?")}${_(f(a,"category"))?` (${v(f(a,"category"))})`:""}${I}${_(m.severity)?`, ${v(m.severity)}`:""}${n(o)}`),_(p.title)&&r.push(` ${N(p.title)}`),_(p.description)&&r.push(` ${N(p.description)}`),f(a,"blocked_by")!==null&&f(a,"blocked_by")!==void 0&&r.push(` blocked by: ${v(f(a,"blocked_by"))}`),t(o)||u(d,o.id,b.finding,O,G("finding",o),_(p.title))}let h=Object.entries(e.redirects);if(h.length>0){r.push("","## Merged");for(let[o,d]of h){let p=c.get(d),a=e[`${p}s`].find(m=>m.id===d);r.push(`${j[p](o)} merged into ${j[p](d)}${n(a)}`),t(a)||u(j[p](o),o,b.alias,r.length,et(d,g.get(d)??G(p,e[`${p}s`].find(m=>m.id===d))))}}return{text:r.join(`
|
|
3
3
|
`)+`
|
|
4
4
|
`,units:i}}var nt="explore",rt="exploration-export/1";function Ue(e,t,n){let r=ye.replace("{id}",t.exploration);return`${e.replace(/\/+$/,"")}${r}/${n}?cut=${t.cut??"end"}${t.run!==void 0?`&run=${t.run}`:""}`}function ot(e,t){let n=e.headers[ie];if(n===void 0)throw new w(`the export of exploration ${t.exploration} came with no digest (the ${ie} header)`,V);if(!_e(e.body,n))throw new w(`the export of exploration ${t.exploration} is not the bytes its digest names: it was changed on the way, or not served whole`,V);let r=Se(e.body);if(r.exploration_id!==t.exploration)throw new w(`the explorer answered the export of exploration ${r.exploration_id} when asked for ${t.exploration}`,"report it to the explorer's team");if(t.run!==void 0&&r.cursor.run!==t.run)throw new w(`the explorer answered the export as of run ${r.cursor.run} when asked for run ${t.run}`,"report it to the explorer's team");if(r.export_version!==F)throw new w(`the explorer answered ${r.export_version} when asked for a cut (export/2)`,"report it to the explorer's team");if((r.cursor.cut??"end")!==(t.cut??"end"))throw new w(`the explorer answered ${r.cursor.cut==="end"?"the end":`cut ${String(r.cursor.cut)}`} when asked for ${ce(t)}`,"report it to the explorer's team");return Z(r),r}var ce=e=>e.cut===void 0||e.cut==="end"?e.run!==void 0?`the end of run ${e.run}`:"its latest ended run":`cut ${e.cut}${e.run!==void 0?` of run ${e.run}`:""}`,Ce=e=>{let t=$e(e);if(!t.ok)throw new w(`${e} is not an exploration reference: ${t.why}`,"name it as explore://<exploration id>, with ?run=<run id> and/or cut=<N>|end to read one cut");return t.value},V="try again later; the current version is kept";function it(e){try{let t=JSON.parse(new TextDecoder().decode(e));return typeof t=="object"&&t!==null?t:{}}catch{return{}}}function Pe(e,t,n,r){let i=`exploration ${n.exploration}${n.run!==void 0?` at run ${n.run}`:""}`,s=it(t);throw e===409&&s.code==="CUT_SUPERSEDED"?new w(`${ce(n)} of exploration ${n.exploration} is superseded (CUT_SUPERSEDED): a later run's cuts are served now`,"nothing to do: a later cut covers it"):e===404&&s.code==="CUT_NOT_FOUND"?new w(`${ce(n)} of exploration ${n.exploration} was never taken (CUT_NOT_FOUND)`,"name a cut the controller took (a checkpoint or a sync), or cut=end"):e===409&&s.code==="RUN_ACTIVE"?new w(`a run of exploration ${n.exploration} is in progress${typeof s.active_run=="string"?` (run ${s.active_run})`:""}: the export is read once it ends`,"try again after the run ends; the current version is kept"):e===409&&s.code==="EXPLORATION_OUTDATED"?new w(`${i} can no longer be read (OUTDATED): re-explore`,"explore the site again, then ingest the new exploration"):e===404&&s.code==="NO_ENDED_RUN"?new w(`exploration ${n.exploration} has no ended run yet: the export is read once its first run ends`,"try again after the first run ends"):e===404?new w(`${i} was not found (404): the explorer has no such exploration${n.run!==void 0?" or run":""}, or it is not one of your organisation's`,"check the id, and that kane-cli is signed in to the controller the exploration ran on"):e===401||e===403?new w(`the controller refused kane-cli's credentials (${e}) for ${i}`,"sign in again with kane-cli login, then try again"):e===400?new w(`the explorer refused the request for the ${r} of ${i} (400)${typeof s.error=="string"?`: ${s.error.slice(0,200)}`:""}`,"report it to kane's team"):new w(`the explorer answered ${e} for the ${r} of ${i}`,V)}async function Ne(e,t,n){try{return await e.connection.request({url:t,headers:{accept:"application/json"}})}catch(r){throw r instanceof L?r:new w(`exploration ${n.exploration} could not be read: ${r instanceof Error?r.message:String(r)}`,V)}}function Te(e){return{manifest:{contract:1,id:nt,version:"0.1.0",rules:rt,capabilities:["remote","explain","context","coverage","cites-deep"],claims:{schemes:[W]}},claim(t){if(t.isFile)return null;let n=Ce(t.ref),r=Ee(n);return{sourceId:me(n),label:`Exploration ${n.exploration}`,...r!==t.ref?{recorded:r}:{}}},async fetch(t){let n=Ce(t.ref);if(t.cursor!==null){let s=await Ne(t,Ue(e.controller,n,"head"),n);s.status!==200&&Pe(s.status,s.body,n,"head");let u;try{u=JSON.parse(new TextDecoder().decode(s.body))}catch{throw new w(`the head of exploration ${n.exploration} is not JSON`,V)}let c=B(u?.cursor,"the head");if(n.run!==void 0&&c.run!==n.run)throw new w(`the explorer answered the head as of run ${c.run} when asked for run ${n.run}`,"report it to the explorer's team");if(se(c)===t.cursor)return{kind:"unchanged"};let l=ke(t.cursor);if(l!==null&&l.export_version===re&&c.export_version===F&&l.run_version===c.run_version&&l.deltas===c.deltas)return{kind:"unchanged"}}let r=await Ne(t,Ue(e.controller,n,"export"),n);r.status!==200&&Pe(r.status,r.body,n,"export");let i=ot(r,n);return{kind:"content",bytes:be(r.body),cursor:se(i.cursor)}},render(t){return{text:Z(K(t.bytes)).text}},index(t){return Z(K(t.bytes)).units},explain:at,context:ct,coverage:ut}}var Ie=e=>e.replace(/\n$/,"").split(`
|
|
5
5
|
`).slice(1).map(t=>t.trim()),A=e=>e.split(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as u,b as x}from"./chunk-
|
|
2
|
+
import{a as u,b as x}from"./chunk-ND6OP3O2.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as r,b as m}from"./chunk-33DWJV67.js";import{z as i}from"./chunk-J4FIESTB.js";import{e as n}from"./chunk-UR6MHSHU.js";var e=n(f(),1);function C({title:B,titleColor:c,borderColor:d,variant:p,rows:s,footer:t,labelWidth:l=14,marginBottom:b=1}){return(0,e.jsxs)(u,{title:B,titleColor:c,borderColor:d,variant:p,marginBottom:b,children:[s.map((o,a)=>typeof o.value=="string"?(0,e.jsx)(x,{label:o.label,value:o.value,valueColor:o.valueColor,labelWidth:l},`${o.label}-${a}`):(0,e.jsxs)(r,{children:[(0,e.jsx)(r,{width:l,children:(0,e.jsx)(m,{color:i.dim,children:o.label})}),o.value]},`${o.label}-${a}`)),t&&(0,e.jsx)(r,{marginTop:1,children:t})]})}export{C as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as k}from"./chunk-
|
|
2
|
+
import{a as k}from"./chunk-ND6OP3O2.js";import{a as f}from"./chunk-HCBYKLMW.js";import{a as m,b as s,k as b}from"./chunk-33DWJV67.js";import{z as u}from"./chunk-J4FIESTB.js";import{e as p}from"./chunk-UR6MHSHU.js";function B(t){let e=t;return e=e.replace(/@TS\{([^}]+)\}/g,"@S{$1}"),e=e.replace(/@TS-(\d+)/g,(o,i)=>`@S${parseInt(i,10)}.C1`),e=e.replace(/@TS(\d+)/g,(o,i)=>`@S${parseInt(i,10)}`),e=e.replace(/\\n/g,`
|
|
3
3
|
`),e}var c=p(f(),1),S=t=>t!==void 0&&/[A-Za-z0-9]/.test(t);function x(t){let e=[],o="",i=()=>{o&&(e.push({text:o}),o="")},l=(a,d,r)=>(a===0||!S(t[a-1]))&&(d+r>=t.length||!S(t[d+r])),n=0;for(;n<t.length;){let a=t.slice(n,n+2),d=t[n];if(a==="**"||a==="__"){let r=t.indexOf(a,n+2);if(r!==-1&&r>n+2&&(a==="**"||l(n,r,2))){i(),e.push({text:t.slice(n+2,r),bold:!0}),n=r+2;continue}}if(d==="`"){let r=t.indexOf("`",n+1);if(r!==-1&&r>n+1){i(),e.push({text:t.slice(n+1,r),code:!0}),n=r+1;continue}}if(d==="*"||d==="_"){let r=t.indexOf(d,n+1);if(r!==-1&&r>n+1&&(d==="*"||l(n,r,1))){i(),e.push({text:t.slice(n+1,r),italic:!0}),n=r+1;continue}}o+=d,n+=1}return i(),e.length===0&&e.push({text:""}),e}function h(t){return t.map((e,o)=>(0,c.jsx)(s,{bold:e.bold,italic:e.italic,color:e.code?u.dim:void 0,children:e.text},o))}function T(t){return t.split(`
|
|
4
4
|
`).map(e=>{if(e.trim()==="")return{kind:"blank"};let o=e.match(/^\s*[-*+]\s+(.*)$/);if(o)return{kind:"bullet",segs:x(o[1])};let i=e.match(/^\s*(\d+)\.\s+(.*)$/);if(i)return{kind:"numbered",n:i[1],segs:x(i[2])};let l=e.match(/^#{1,6}\s+(.*)$/);return l?{kind:"heading",segs:x(l[1])}:{kind:"para",segs:x(e)}})}function R(t,e,o=""){switch(t.kind){case"blank":return(0,c.jsx)(s,{children:o||" "},e);case"heading":return(0,c.jsxs)(s,{bold:!0,children:[o,h(t.segs)]},e);case"bullet":return(0,c.jsx)(m,{marginLeft:1,children:(0,c.jsxs)(s,{children:[o,"\u2022 ",h(t.segs)]})},e);case"numbered":return(0,c.jsx)(m,{marginLeft:1,children:(0,c.jsxs)(s,{children:[o,`${t.n}. `,h(t.segs)]})},e);default:return(0,c.jsxs)(s,{children:[o,h(t.segs)]},e)}}function $({text:t,accent:e=u.generateAccent,indent:o=0}){let i=T(B(t)),{stdout:l}=b(),n=(l?.columns??80)-o;return(0,c.jsxs)(m,{marginBottom:1,children:[(0,c.jsx)(m,{width:2,flexShrink:0,children:(0,c.jsx)(s,{color:e,children:"\u2503"})}),(0,c.jsx)(m,{flexDirection:"column",width:n-2,children:i.map((a,d)=>R(a,d))})]})}var g=p(f(),1),I=5;function C({thinking:t,expanded:e,thinkingDone:o,maxLines:i=I}){if(!e)return(0,g.jsxs)(m,{paddingX:1,children:[(0,g.jsx)(s,{color:u.dim,children:o?"\u2237 thinking complete ":"\u2237 thinking\u2026 "}),(0,g.jsx)(s,{color:u.muted,children:o?"(ctrl+t to view)":"(ctrl+t to show)"})]});let l=t.split(`
|
|
5
5
|
`),n=Math.max(0,l.length-i),a=n>0?l.slice(-i).join(`
|