@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{b as l}from"./chunk-
|
|
2
|
+
import{b as l}from"./chunk-3RO2YGKH.js";import{e as d,h as p}from"./chunk-XMPTFXPW.js";import{b as f}from"./chunk-REKHAN53.js";import{Ha as i,s as g}from"./chunk-WE7HRAGO.js";import{a as c}from"./chunk-FOJHSG5M.js";var h=new Set(["context extract","design tests","context sessions","context ingest","context list","maintain reconcile","maintain evolve","cover","context pull","context impact"]),I=new Set(["context ingest","context extract"]),y=new Set(["testmd run","testrun run"]),w=new Set(["context","design","maintain","cover"]);function $(e,n){return n.kind==="local"||n.kind==="pick"||!w.has(e.split(" ")[0])?null:n.kind==="refuse"?n.refusal:w.has(e)||h.has(e)||y.has(e)?null:i.notYet(e)}var R={tests:"design",sessions:"save","sessions discard":"discard",ingest:"extract",list:"list",reconcile:"reconcile"};function a(e,n,t){return t?p(d("ndjson",R[n]??n),e.message,e.code,e.remedy):(k(e),2)}function G(e,n,t){if(e.code!=="LIST_FAILED"&&e.code!=="COVERAGE_FAILED")return a(e,n,t);if(t){let r=d("ndjson",R[n]??n);return r.event({type:"error",code:e.code,message:e.message,...e.remedy?{remedy:e.remedy}:{}}),r.done(1)}return k(e),1}function E(e,n){if(!e.answer?.length)return null;let t=f({answer:e.answer});return t.ok?e.resume?e.mode!=="agent"?i.answerAgentOnly(n,e.resume):null:i.answerNeedsResume():i.answerParse(t.error)}function v(e,n){if(!e.answer?.length||l(process.cwd()).kind!=="remote")return null;let t=E(e,n);return t===null?null:a(t,n.split(" ")[1],e.mode==="agent")}var B=e=>`${c.green(`\u2713 Project: "${e}"`)}
|
|
3
3
|
${c.dim(" this folder is now linked to it; what you save goes to the project")}
|
|
4
4
|
`;function k(e){if(process.stderr.write(`${u(`error: ${e.message}`)}
|
|
5
5
|
`),e.detail&&process.stderr.write(`${c.dim(` ${e.detail}`)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as
|
|
3
|
-
`)}function
|
|
4
|
-
`;try{this.proc?.child.stdin?.write(s)}catch{}}async consume(){if(!this.proc)return;try{for await(let d of this.proc.events){if(d.type==="ready"){this.onReady();continue}if(d.type==="error"&&this.pendingReady){this.onStartError(d.message);continue}try{this.onEvent?.(d)}catch{}this.routeEvent(d)}}catch(d){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:d instanceof Error?d.message:String(d)})}let{code:e,signal:s}=await this.proc.exited;this.onExit(e,s)}onReady(){if(this.pendingReady){let{resolve:e}=this.pendingReady;this.pendingReady=null,e()}}onStartError(e){if(!this.pendingReady)return;let{reject:s}=this.pendingReady;this.pendingReady=null;let d=
|
|
5
|
-
${g}`:""}`))}}}}};var p
|
|
2
|
+
import{a as te,b as re,c as ie,d as se,e as z}from"./chunk-ULIIYKZB.js";import{b as oe,c as ae}from"./chunk-IINZZ4BZ.js";import{g as ne}from"./chunk-F2F257PU.js";import{n as ee,p as j}from"./chunk-UJLULWSR.js";import{a as De}from"./chunk-6YGTRKDT.js";import{e as $e}from"./chunk-UR6MHSHU.js";function Le(r){let e=r==="passed"?"passed":"failed";return{testStatus:e,remark:`kane-cli: ${e}`}}var Fe={testStatus:"failed",remark:"cancelled"};var Ae="https://www.testmuai.com/pricing/",Ue=/Real Mobile App Automation not allowed on your current plan/i,L=class extends Error{code="plan_required";constructor(e){super(e),this.name="RealDevicePlanError"}};function ue(r){return!r||!Ue.test(r)?null:["Real devices aren't included in your TestMu AI plan.","Running on a real device needs the KaneAI Max or Real Device Plus Automation Cloud plan.",`See plans: ${Ae}`].join(`
|
|
3
|
+
`)}function de(r){return{command:"start",...r}}function le(r,e,s){return{command:"run",run_id:r,kind:e,...s}}function ce(r){return{command:"cancel",...r?{run_id:r}:{}}}function pe(r){return{command:"ask_user_response",answer:r}}function he(r={}){return{command:"shutdown",...r.testStatus?{test_status:r.testStatus,remark:r.remark??""}:{}}}var W=Symbol("run-queue-end"),J=class{items=[];waiting=null;ended=!1;error=null;push(e){if(this.waiting){let{resolve:s}=this.waiting;this.waiting=null,s(e)}else this.items.push(e)}end(){if(this.ended=!0,this.waiting){let{resolve:e}=this.waiting;this.waiting=null,e(W)}}fail(e){if(this.error=e,this.waiting){let{reject:s}=this.waiting;this.waiting=null,s(e)}}next(){return this.items.length>0?Promise.resolve(this.items.shift()):this.error?Promise.reject(this.error):this.ended?Promise.resolve(W):new Promise((e,s)=>{this.waiting={resolve:e,reject:s}})}},F=class{env;runner;log;sessionId;spawnFn;proc=null;activeRun=null;pendingReady=null;shuttingDown=!1;finalized=!1;exitInfo=null;exitedUnexpectedly=!1;exitResolve;onEvent;exited;constructor(e){this.env=e.env,this.runner=e.runner,this.log=e.log,this.sessionId=e.sessionId,this.spawnFn=e.spawn??re,this.onEvent=e.onEvent;let s;this.exited=new Promise(d=>{s=d}),this.exitResolve=s}async start(e){if(this.proc)throw new Error("PersistentRunner.start called twice");this.proc=this.spawnFn({env:this.env,runner:this.runner,log:this.log,sessionId:this.sessionId}),this.consume();let s=new Promise((d,g)=>{this.pendingReady={resolve:d,reject:g}});this.writeCommand(de(e)),await s}async*run(e,s,d){if(!this.proc)throw new Error("PersistentRunner.run called before start");if(this.finalized)throw new Error(`v16-runner is not running (exited code=${this.exitInfo?.code??"null"}, signal=${this.exitInfo?.signal??"none"}) \u2014 cannot start run '${e}'`);if(this.activeRun)throw new Error(`PersistentRunner.run overlap: '${this.activeRun.runId}' still in flight`);let g=new J,_={runId:e,queue:g};this.activeRun=_,this.writeCommand(le(e,s,d));try{for(;;){let v=await g.next();if(v===W||(yield v,v.type==="run_end"&&(v.run_id===void 0||v.run_id===e)))break}}finally{this.activeRun===_&&(this.activeRun=null)}}sendUserResponse(e){this.writeCommand(pe(e))}cancel(e){this.writeCommand(ce(e))}kill(){this.proc?.child.kill("SIGTERM")}async shutdown(e={}){this.shuttingDown=!0,this.proc&&(this.writeCommand(he(e)),await this.exited)}get stderr(){return this.proc?.getStderr()??""}get diedUnexpectedly(){return this.exitedUnexpectedly}writeCommand(e){let s=JSON.stringify(e)+`
|
|
4
|
+
`;try{this.proc?.child.stdin?.write(s)}catch{}}async consume(){if(!this.proc)return;try{for await(let d of this.proc.events){if(d.type==="ready"){this.onReady();continue}if(d.type==="error"&&this.pendingReady){this.onStartError(d.message);continue}try{this.onEvent?.(d)}catch{}this.routeEvent(d)}}catch(d){this.log?.("error","PERSISTENT_RUNNER_STREAM_ERROR","Runner stdout stream errored",{error:d instanceof Error?d.message:String(d)})}let{code:e,signal:s}=await this.proc.exited;this.onExit(e,s)}onReady(){if(this.pendingReady){let{resolve:e}=this.pendingReady;this.pendingReady=null,e()}}onStartError(e){if(!this.pendingReady)return;let{reject:s}=this.pendingReady;this.pendingReady=null;let d=ue(e);if(d){this.log?.("error","REAL_DEVICE_PLAN_REQUIRED","The mobile hub refused the session over the plan",{reason:e}),s(new L(d));return}s(new Error(ne(e)??`failed to start: ${e??"unknown error"}`))}routeEvent(e){let s=this.activeRun;if(!s){this.log?.("warn","PERSISTENT_RUNNER_ORPHAN_EVENT","Runner event with no active run",{event_type:e.type});return}s.queue.push(e)}onExit(e,s){if(!this.finalized){if(this.finalized=!0,this.exitInfo={code:e,signal:s},this.shuttingDown||(this.exitedUnexpectedly=!0),this.exitResolve({code:e,signal:s}),this.pendingReady){let{reject:d}=this.pendingReady;this.pendingReady=null,d(new Error(`v16-runner exited before ready (code=${e}, signal=${s??"none"})`))}if(this.activeRun){let{queue:d}=this.activeRun;if(this.activeRun=null,this.shuttingDown)d.end();else{let g=this.proc?.getStderr()?.slice(-500)??"";d.fail(new Error(`v16-runner exited unexpectedly mid-run (code=${e}, signal=${s??"none"})${g?`
|
|
5
|
+
${g}`:""}`))}}}}};var p=$e(De(),1);function fe(r){let e={cdp_endpoint:r.cdp_endpoint,ws_endpoint:r.ws_endpoint,width:r.width,height:r.height,headless:r.headless,model:r.model,max_steps:r.max_steps,network_ws:r.network_ws,network_sse:r.network_sse,session_id:r.session_id};return r.device&&(e.device=r.device),r.auth&&(e.auth=r.auth),r.project_id&&(e.project_id=r.project_id),r.disable_ask_user&&(e.disable_ask_user=!0),r.media_upload&&(e.media_upload=r.media_upload),r.username&&(e.username=r.username),r.access_key&&(e.access_key=r.access_key),e}function T(r,e){let s=null,d=(g,_)=>{for(let v=0;v<g.length;v++){let E=g[v],h=[..._,v];e(E)&&(s===null||h.length>s.length)&&(s=h),E.children&&E.children.length>0&&d(E.children,h)}};return d(r,[]),s}function N(r,e,s){if(e.length===0)return[...r];let d=e[0],g=[...r],_=g[d];if(e.length===1)g[d]=s(_);else{let v=e.slice(1),E=N(_.children??[],v,s);g[d]={..._,children:E}}return g}var Me=6e4;function me(){return{steps:[],maxOrdinal:0}}function Oe(r,e){if(e.type==="run_start"&&e.child_id)return e.environment?.resolution?{...r,resolution:e.environment.resolution}:r;if(e.type==="run_start"){let s=ae(r.runnerEnvironment,oe(e.environment));if(s)return{...r,runnerEnvironment:s,...s.resolution?{resolution:s.resolution}:{}}}if(e.type==="step_end"&&typeof e.ordinal=="number"&&e.id){let s={id:e.id,ordinal:e.ordinal,status:e.status,...e.kind?{kind:e.kind}:{},...typeof e.duration=="number"?{duration_ms:Math.round(e.duration*1e3)}:{},...typeof e.action_id=="string"&&e.action_id?{action_id:e.action_id}:{}};return{...r,steps:[...r.steps,s],maxOrdinal:Math.max(r.maxOrdinal,e.ordinal)}}return r}function H(r){let e=r.indexOf(": ");return e>0&&e<15?r.slice(e+2):r}function Q(r){return r.map(e=>{let s=e.children?Q(e.children):e.children;return e.status==="running"?{...e,status:"stopped",phase:void 0,children:s}:s!==e.children?{...e,children:s}:e})}function rn(r,e,s,d,g){let[_,v]=(0,p.useState)(!1),[E,h]=(0,p.useState)([]),[ve,$]=(0,p.useState)(null),[ge,B]=(0,p.useState)(null),[Re,C]=(0,p.useState)(null),[Se,X]=(0,p.useState)(null),[ye,Y]=(0,p.useState)([]),[we,Z]=(0,p.useState)(null),[xe,_e]=(0,p.useState)(void 0),[Ee,D]=(0,p.useState)(0),x=(0,p.useRef)(null),A=(0,p.useRef)(null),k=(0,p.useRef)(null),w=(0,p.useRef)(null),b=(0,p.useRef)(0),V=(0,p.useRef)(!1),U=(0,p.useRef)(me()),M=(0,p.useRef)(null),be=(0,p.useCallback)(async(f,S)=>{let I=M.current;if(I)try{await I}catch{}h([]),$(null),B(null),C(null),X(null),Y([]),Z(null),_e(f.max_steps),v(!0),w.current=null,b.current=0,U.current=me();let y=x.current;if(y&&k.current!==f.session_id){try{y.kill()}catch{}x.current=null,k.current=null,D(n=>n+1),y=null}if(!y){let n=te();if(!n){C("v16-runner not found. Build the binary with `cd v16-runner && python build.py` or ensure Python is available."),v(!1);return}let l=se({environment:S?.environment,mode:S?.mode,assertionMode:S?.assertionMode,finalValidation:S?.finalValidation,username:f.username,accessKey:f.access_key,sessionId:f.session_id});f.device?.platform&&await ie(l,f.device);let u=new F({env:l,runner:n,log:S?.log,sessionId:f.session_id,...S?.onRunnerEvent?{onEvent:S.onRunnerEvent}:{}});x.current=u,k.current=f.session_id,y=u,ee("runner",()=>{try{u.kill()}catch{}});let o={...f};z(o,{environment:S?.environment});let a=fe(o);try{await u.start(a)}catch(t){C(t instanceof Error?t.message:String(t)),v(!1),j("runner","Runner start failed"),x.current=null,k.current=null,D(i=>i+1);return}}let q={...f};delete q.run_id,z(q,{environment:S?.environment});let Te=`run-${f.run_index}`,Ne=f.mode==="replay"?"replay":"author",G=y,K=(async()=>{V.current=!1;for await(let n of G.run(Te,Ne,q)){if(V.current)break;switch(U.current=Oe(U.current,n),n.type){case"run_start":if(n.child_id)break;if(w.current&&!w.current.isSingleFlow){let l=b.current;b.current++,h(u=>u.map((o,a)=>a===l?{...o,status:"running"}:o.status==="running"&&!o.children?.some(t=>t.status==="running")?{...o,status:o.children?.some(t=>t.status==="failed")?"failed":"passed"}:o))}break;case"bifurcation":{let l=n.flows??[],u=n.count??l.length,o={flows:l,isSingleFlow:n.is_single_flow??u<=1};X(o),w.current=o,b.current=0,h(l.map((a,t)=>({index:t+1,objective:a??`Flow ${t+1}`,status:"pending"})));break}case"step_start":{e?.("STEP_START",`Step ${n.index} started`,{index:n.index,objective:n.objective,child_id:n.child_id});let l=n.index,u=n.objective??`Step ${l}`,o=n.child_id,a=w.current&&!w.current.isSingleFlow;if(o)h(t=>{let i=T(t,c=>c.branchChildId===o)??T(t,c=>c.status==="running");return i?N(t,i,c=>{let m=(c.children??[]).map(R=>R.status==="running"&&R.childId===o?{...R,status:"stopped",phase:void 0}:R);return m.push({index:l,objective:u,status:"running",childId:o}),{...c,children:m}}):t});else if(a){let t=Math.max(0,b.current-1);h(i=>{let c=[...i];if(t>=c.length)return i;let m={...c[t]},P=[...m.children??[]].map(O=>O.status==="running"&&O.childId===void 0?{...O,status:"stopped",phase:void 0}:O);return P.push({index:l,objective:u,status:"running"}),m.children=P,m.status="running",c[t]=m,c})}else h(t=>{let i=Q(t);return i.some(m=>m.index===l)?i.map(m=>m.index===l?{...m,status:"running",objective:u}:m):[...i,{index:l,objective:u,status:"running"}]});break}case"step_event":{e?.("STEP_EVENT",`Step ${n.index} ${n.event}`,{index:n.index,phase:n.event,action_type:n.action_type,detail:n.detail,child_id:n.child_id});let l=n.child_id,u=w.current&&!w.current.isSingleFlow;if(n.event==="cm_init"&&n.checkpoint_count!=null){Y(o=>[...o,n.checkpoint_count]);break}if(n.event==="replay_started"){Z({recordingLength:n.recording_length??0});break}if(n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&s?.(n.detail),l){let o=t=>{if(t.index!==n.index||t.childId!==l)return t;let i={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(i.objective=n.detail),n.action_type&&(i.actionType=n.action_type),{...t,...i}},a=t=>t.map(i=>{let c=o(i);return c!==i?c:i.children&&i.children.length>0?{...i,children:a(i.children)}:i});h(t=>t.map(i=>i.children?{...i,children:a(i.children)}:i))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let i={...t[o]},c=[...i.children??[]];if(!c.some(R=>R.index===n.index&&R.childId===void 0))c.push({index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type});else for(let R=0;R<c.length;R++){if(c[R].index!==n.index||c[R].childId!==void 0)continue;let P={phase:n.event};n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(P.objective=n.detail),n.action_type&&(P.actionType=n.action_type),c[R]={...c[R],...P}}return i.children=c,t[o]=i,t})}else h(o=>o.some(t=>t.index===n.index)?o.map(t=>{if(t.index!==n.index)return t;let i={phase:n.event};return n.event==="reasoning"&&n.detail&&n.detail!=="reasoning"&&(i.objective=n.detail),n.action_type&&(i.actionType=n.action_type),{...t,...i}}):[...Q(o),{index:n.index,objective:`Step ${n.index}`,status:"running",phase:n.event,actionType:n.action_type}]);break}case"step_end":{e?.("STEP_END",`Step ${n.index} ${n.status}`,{index:n.index,status:n.status,duration:n.duration,summary:n.summary,child_id:n.child_id}),d?.();let l=n.child_id,u=w.current&&!w.current.isSingleFlow;if(l){let o=t=>t.index===n.index&&t.childId===l?{...t,status:n.status,duration:n.duration,phase:void 0,objective:t.objective.startsWith("Step ")?H(n.summary||t.objective):t.objective}:t,a=t=>t.map(i=>{let c=o(i);return c!==i?c:i.children&&i.children.length>0?{...i,children:a(i.children)}:i});h(t=>t.map(i=>i.children?{...i,children:a(i.children)}:i))}else if(u){let o=Math.max(0,b.current-1);h(a=>{let t=[...a];if(o>=t.length)return a;let i={...t[o]},c=(i.children??[]).map(m=>m.index===n.index&&m.childId===void 0?{...m,status:n.status,duration:n.duration,phase:void 0,objective:m.objective.startsWith("Step ")?H(n.summary||m.objective):m.objective}:m);return i.children=c,t[o]=i,t})}else h(o=>o.map(a=>a.index===n.index?{...a,status:n.status,duration:n.duration,phase:void 0,objective:a.objective.startsWith("Step ")?H(n.summary||a.objective):a.objective}:a));{let a=w.current&&!w.current.isSingleFlow?Math.max(0,b.current-1):0,t=typeof n.ordinal=="number"&&n.id?{ordinal:n.ordinal,id:n.id}:void 0;r?.(n.index,a,n.child_id,t)}break}case"child_agent_start":{let l=n.objective??"",u=n.child_id;h(o=>{let a=T(o,t=>t.status==="running");return a?N(o,a,t=>({...t,objective:`${l} (branch)`,phase:`child: ${l.slice(0,50)}`,branchObjective:l,branchChildId:u})):o});break}case"child_agent_end":{let l=n.child_id,u=`child ${n.success?"done":"failed"}`;h(o=>{let a=T(o,t=>t.branchChildId===l);return a?N(o,a,t=>({...t,phase:u})):o.map(t=>t.phase?.startsWith("child:")?{...t,phase:u}:t)});break}case"describe_trigger":g?.(n);break;case"ask_user":$(n.question??"");break;case"run_end":h(l=>l.map(u=>u.status==="running"?{...u,status:n.status,phase:void 0}:u)),v(!1),B(n);break;case"error":v(!1),C(n.message??"Runner error"),h(l=>l.map(u=>u.status==="running"?{...u,status:"failed",phase:void 0}:u));break}}})().catch(n=>{if(x.current!==G)return;let u=[n instanceof Error?n.message:String(n)],o=G.stderr;o&&!u.join(`
|
|
6
6
|
`).includes(o)&&u.push(o),C(u.join(`
|
|
7
|
-
`)),v(!1),h(a=>a.map(t=>t.status==="running"?{...t,status:"failed",phase:void 0}:t)),j("runner","Runner died mid-run"),x.current=null,k.current=null,
|
|
7
|
+
`)),v(!1),h(a=>a.map(t=>t.status==="running"?{...t,status:"failed",phase:void 0}:t)),j("runner","Runner died mid-run"),x.current=null,k.current=null,D(a=>a+1)});M.current=K,K.finally(()=>{M.current===K&&(M.current=null)})},[r,e,s,d,g]),ke=(0,p.useCallback)(f=>{x.current?.sendUserResponse(f),$(null)},[]),Ie=(0,p.useCallback)(()=>{let f=x.current;f&&(f.cancel(),v(!1),$(null))},[]),Ce=(0,p.useCallback)((f,S)=>{if(A.current)return A.current;let I=x.current;if(!I)return Promise.resolve();let y=Pe(I,f,S?.timeoutMs).finally(()=>{A.current=null});return A.current=y,y},[]),Pe=async(f,S,I)=>{try{await Promise.race([f.shutdown(S??{}),new Promise(y=>setTimeout(y,I??(S?Me:5e3)))])}catch{}j("runner","Runner shut down"),x.current=null,k.current=null,D(y=>y+1)},je=(0,p.useCallback)(()=>{h([]),B(null),C(null)},[]);return(0,p.useEffect)(()=>()=>{V.current=!0,j("runner","Component unmounted"),x.current=null,k.current=null},[]),{isRunning:_,steps:E,askingUser:ve,lastRunEnd:ge,runError:Re,bifurcationInfo:Se,cmInitCounts:ye,replayInfo:we,maxSteps:xe,sessionGen:Ee,startRun:be,sendAnswer:ke,cancelRun:Ie,shutdownRunner:Ce,clearLastRun:je,getEvidenceState:()=>U.current}}export{Le as a,Fe as b,F as c,fe as d,me as e,Oe as f,rn as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as m,j as g}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{z as u}from"./chunk-
|
|
2
|
+
import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as m,j as g}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{z as u}from"./chunk-J4FIESTB.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(a,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(a,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(m,{color:u.orange,children:[t.label,":"]}),(0,r.jsx)(m,{color:u.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as k,f as l}from"./chunk-
|
|
2
|
+
import{e as k,f as l}from"./chunk-WLEWXE6L.js";import{b as p}from"./chunk-LPJKNX6D.js";import{a as f}from"./chunk-ZCBOHWN3.js";import{a as d}from"./chunk-RZ4F3BHX.js";import{promises as g}from"fs";import{basename as _,join as w}from"path";var D=3e3,S="/deviceSkin";function b(e){return e.replace(/\([^)]*\)/g," ").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||void 0}function v(e){if(e.model){let r=b(e.model);return r?`real-${r}`:void 0}let n=e.name?.trim();return n&&!k(n)?n:void 0}function y(e){let n=e?.data?.skin,r=typeof n?.skin_url=="string"?n.skin_url.trim():"",t=n?.skin_data??{},i=u=>typeof u=="number"&&Number.isFinite(u)?u:void 0,s=i(t.width),o=i(t.height);if(!r||!s||!o)return;let m={width:s,height:o};for(let u of["top","right","bottom","left","radius"]){let c=i(t[u]);c!==void 0&&(m[u]=c)}return{skin_url:r,skin_data:m}}var a=new Map;async function h(e,n,r={}){let t=`${f(e).lrmaaBaseUrl}${S}/${encodeURIComponent(n)}`;if(a.has(t))return a.get(t);try{let i=await(r.request??d)(t,{method:"GET",signal:AbortSignal.timeout(D)});if(!i.ok)return;let s=y(await i.json());return a.set(t,s),s}catch{return}}function A(e){let n=(e??"").trim().replace(/^lt:\/\//i,"").trim();if(n)return(p(n)?n:_(n))||void 0}async function P(e){try{let n=w(e,"steps"),r=(await g.readdir(n,{withFileTypes:!0})).filter(t=>t.isDirectory()).map(t=>t.name).sort((t,i)=>(parseInt(t,10)||0)-(parseInt(i,10)||0));for(let t of r)try{let i=await g.readFile(w(n,t,"step.json"),"utf8"),o=JSON.parse(i).basis?.window;if(Array.isArray(o)&&o.length===2&&Number.isFinite(Number(o[0]))&&Number.isFinite(Number(o[1]))&&Number(o[0])>0&&Number(o[1])>0)return`${Math.round(Number(o[0]))}x${Math.round(Number(o[1]))}`}catch{}return}catch{return}}async function T(e,n,r){if(!e.native_platform||!n.environment)return e;let t=v({model:n.deviceModel,name:l(n.runnerEnvironment?.device)});if(!t)return e;let i=await h(n.environment,t,r);return i?{...e,skin_url:i.skin_url,skin_data:i.skin_data}:e}export{v as a,h as b,A as c,P as d,T as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as x}from"./chunk-
|
|
2
|
+
import{b as x}from"./chunk-7Y55CO42.js";import{a as l}from"./chunk-HCBYKLMW.js";import{a as i,b as r}from"./chunk-33DWJV67.js";import{e}from"./chunk-UR6MHSHU.js";var o=e(l(),1);function m({title:c,state:t,rows:n}){return(0,o.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,o.jsxs)(r,{children:[(0,o.jsx)(r,{bold:!0,children:c}),t?(0,o.jsx)(r,{color:t.color,children:` \u25CF ${t.text}`}):null]}),(0,o.jsx)(x,{rows:n,minWidth:20})]})}export{m as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as B}from"./chunk-
|
|
2
|
+
import{a as B}from"./chunk-JBKHX5ES.js";import{b as N,f as d}from"./chunk-4CJQ7XZP.js";import{a as g,b as E}from"./chunk-TAY7J5VS.js";import{b as F,f as U,g as v}from"./chunk-3RO2YGKH.js";import{e as y,f as _}from"./chunk-NI3TIAD7.js";import{d as C,e as O,i as x}from"./chunk-XMPTFXPW.js";import{C as h,Ha as c,f as R,r as P,w as S}from"./chunk-WE7HRAGO.js";import{a as w}from"./chunk-4C7WVQOD.js";async function I(e,r){let o=await r.project(e);return o===null?"no_access":o.marked?"marked":"unmarked"}var M=5e3;async function D(e,r=()=>!0){try{for(;;){if(!r())return{found:!1,failed:!0};let o=await e.next();if(o.done)return{found:!1};if(o.value.length>0)return{found:!0,rows:o.value}}}catch{return{found:!1,failed:!0}}}async function j(e,r={}){let o=await L(e,r.budgetMs??M);return o.state==="unknown"&&G(`shared projects weren't checked, so this folder goes on locally: ${o.reason}`),o}async function L(e,r){let o;try{o=await y()}catch(a){return a instanceof x?{state:"unknown",reason:"not signed in",signedOut:!0}:{state:"unknown",reason:"the credentials couldn't be read"}}let t,n=!1,s=new Promise(a=>{t=setTimeout(()=>{n=!0,a({state:"unknown",reason:`the project list took over ${r} ms`})},r)}),l=(async()=>{let a=R({url:e,basicAuth:o}).projects(),i=await D(a,()=>!n);return i.found?{state:"rolled_out",first:{rows:i.rows,more:a}}:i.failed?{state:"unknown",reason:"the project list couldn't be read"}:{state:"not_rolled_out"}})();try{return await Promise.race([l,s])}finally{clearTimeout(t)}}var G=g("remote-check");var T=e=>({code:e.code,message:e.message,...e.remedy?{remedy:e.remedy}:{}});async function A(e,r=_(e.latticeUrl)){let o;try{o=await I(e.projectId,r)}catch(t){if(t instanceof x)return T(t);if(t instanceof w&&t.retryable)return c.noConnection();if(t instanceof w&&t.status===401)return c.credentialsRejected();throw t}return o==="no_access"?c.noAccess(e.projectName):null}function H(e,r,o,t){if(e instanceof w){if(e.code==="SESSION_CLASH"&&t!==void 0&&h(e.extra.heldBy)!==null)return{...c.projectBusy({project:r.projectName,verb:t.verb==="evolve"?"design":t.verb,resume:o!==null,held:h(e.extra.heldBy),...t.useCase?{useCase:t.useCase}:{},...t.title!==void 0?{title:t.title}:{},...t.agent?{agent:!0}:{}}),exit:2};if(e.code==="MARK_REFUSED")return{...c.markRefused(r.projectName,r.onboarded===!0),exit:2};if(e.code==="PROJECT_NOT_MARKED")return{...c.assuranceOff(r.projectName),exit:2};if(e.retryable)return{...c.noConnectionAtStart(),exit:2};if(e.status===401)return{...c.credentialsRejected(),exit:2};if(e.code==="SESSION_ENDED")return{...$(e,o??""),exit:2};if(e.code==="NOT_FOUND"&&o!==null)return{...c.noSuchSession(o),exit:2};if(e.code==="FORMS_REFUSED")return{...J(e.extra)?c.versionCliOlder():c.versionServiceOlder(),exit:2}}else if(e instanceof B)return{...e.side==="cli_older"?c.versionCliOlder():c.versionServiceOlder(),exit:2};return{...c.openFailed(),exit:1}}function $(e,r){return e.extra.ended==="failed"?c.sessionFailed(r):c.sessionFinished(r)}function J(e){let r=typeof e.claimed=="number"?e.claimed:null;return r===null?!1:typeof e.oldestRead=="number"&&r<e.oldestRead?!0:typeof e.highestWriter=="number"&&e.highestWriter>r}async function fe(e,r,o,t={}){P({verb:e,mode:r?"agent":"interactive"});let n=await K(e,r,o,t);return n!==null&&"exit"in n&&await S(),n}async function K(e,r,o,t){let n=F(process.cwd()),s=e.split(" ").at(-1);if(t.project!==void 0||t.local===!0){let i=await W(n,e,s,r,{...t,...o!==void 0?{resume:o}:{}});if(i!=="undecided")return i}if(n.kind==="refuse")return{exit:d(n.refusal,s,r)};let l=n;if(n.kind==="pick"){if(o===void 0){if(!N.has(e)||!(!r&&C()&&t.onboard!==!1))return null;let u=await j(n.latticeUrl);if(u.state==="unknown"&&u.signedOut&&e==="context ingest"){let{signIn:m}=await import("./onboarding-6HIP3KW6.js");if(await m()!=="signed_in")return null;u=await j(n.latticeUrl)}if(u.state!=="rolled_out")return null;let{onboard:k}=await import("./onboarding-6HIP3KW6.js"),p=e==="context extract"?"context extract":"context ingest",f=await k(n,{first:u.first,verb:p});return"exit"in f?f:"local"in f?p==="context extract"&&f.made?{exit:0}:null:{choice:f.choice}}if((await j(n.latticeUrl)).state!=="rolled_out")return null;try{l=await V(n,o,await y())}catch(i){return i instanceof x?{exit:d(T(i),s,r)}:{exit:d(H(i,{kind:"remote",latticeUrl:n.latticeUrl,projectId:"",projectName:""},o),s,r)}}}if(l.kind!=="remote")return null;let a=await A(l);return a?{exit:d(a,s,r)}:{choice:l}}async function W(e,r,o,t,n){let[{decideFolderFlags:s},{personTms:l,workLocally:a}]=await Promise.all([import("./folder-flags-ZIDJVDKX.js"),import("./onboarding-6HIP3KW6.js")]),i=await s(e,{...n,agent:t},{getProject:async m=>(await l()).getProject(m)});if(i.kind==="none")return"undecided";if(i.kind==="refuse")return{exit:d(i.refusal,o,t)};let u=r==="context extract"?"context extract":"context ingest";if(i.kind==="local"){let m=a(u,{print:!t});if(!m.made)return null;if(t){let b=O("ndjson","extract");if(b.event({type:"folder_local",gitignore:m.gitignore}),u==="context extract")return{exit:b.done(0)}}return u==="context extract"?{exit:0}:null}if(n.notBuilt)return{exit:d(n.notBuilt,o,t)};let k=e;try{v(process.cwd(),{projectId:i.projectId,projectName:i.projectName,writtenBy:"kane-cli"})}catch(m){return g("remote-check")(`the folder's link couldn't be written: ${E(m)}`),{exit:d(c.projectFileUnwritable(U(process.cwd())),o,t)}}let p={kind:"remote",latticeUrl:k.latticeUrl,projectId:i.projectId,projectName:i.projectName,onboarded:!0},f=await A(p);return f?{exit:d(f,o,t)}:{choice:p}}async function V(e,r,o,t){let n=R({url:e.latticeUrl,basicAuth:o,...t?{fetch:t}:{}}),s=await n.getSession(r),l="";for await(let a of n.projects()){let i=a.find(u=>u.projectId===s.projectId);if(i){l=i.name;break}}return{kind:"remote",latticeUrl:e.latticeUrl,projectId:s.projectId,projectName:l}}export{A as a,H as b,$ as c,fe as d,V as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as f}from"./chunk-47WQBG5I.js";import{a as l}from"./chunk-KM3YCIDV.js";import{i as u}from"./chunk-X52YIWGG.js";import{a as c}from"./chunk-
|
|
2
|
+
import{g as f}from"./chunk-47WQBG5I.js";import{a as l}from"./chunk-KM3YCIDV.js";import{i as u}from"./chunk-X52YIWGG.js";import{a as c}from"./chunk-YNDELIXL.js";import{f as s}from"./chunk-CB344EDO.js";import{c as p}from"./chunk-GBQ4K25P.js";import{b as i}from"./chunk-EBJW6POT.js";async function E(n,o,e,t){let m=async()=>{let r=t.auth??{...await s(i),...t.telemetry?.spawnEnv()??{}};return u(e.sid!==void 0&&n.resume===void 0?{...n,sessionId:e.sid}:n,{store:o.store,pendingReconcilePlan:a=>o.dir===null?null:f(o.dir,a),agent:t.agent,tracePath:c,credentials:i,onIngestRefusal:l,preflightTurn:t.preflightTurn??(()=>p(r)),ask:async()=>[],review:async a=>new Map(a.map(d=>[d.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:e.out,...e.note?{note:e.note}:{},emit:e.emit,progress:e.progress,isTTY:!1,auth:r,...t.telemetry?{telemetry:t.telemetry}:{},...t.probe?{probe:t.probe}:{},...t.matchUnreviewed?{matchUnreviewed:!0}:{},...e.onSummary?{onSummary:e.onSummary}:{}})};if(!e.channel)return m();let{runWithChannel:g}=await import("./run-channel-IIIYXOIW.js");return g({event:r=>e.emit(r)},m)}export{E as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as h,b as x,c as O}from"./chunk-3AGP2BVN.js";import{oa as B}from"./chunk-PI7OXS62.js";import{a as S}from"./chunk-HCBYKLMW.js";import{b as i}from"./chunk-33DWJV67.js";import{a as w}from"./chunk-FOJHSG5M.js";import{z as s}from"./chunk-
|
|
2
|
+
import{a as h,b as x,c as O}from"./chunk-3AGP2BVN.js";import{oa as B}from"./chunk-PI7OXS62.js";import{a as S}from"./chunk-HCBYKLMW.js";import{b as i}from"./chunk-33DWJV67.js";import{a as w}from"./chunk-FOJHSG5M.js";import{z as s}from"./chunk-J4FIESTB.js";import{e as L}from"./chunk-UR6MHSHU.js";var e=L(S(),1),W={high:0,med:1,low:2},E={high:s.red,med:"yellow",low:s.dim};function j(d){return d.map((n,o)=>({r:n,i:o})).sort((n,o)=>(W[n.r.risk??"zz"]??3)-(W[o.r.risk??"zz"]??3)||n.i-o.i).map(({r:n})=>n)}function z(d,n=120,o="risk"){if(d.length===0)return null;let a=j(d),l=t=>t.held?"(held)":t.staged||!t.id?"(staged)":B(t.id),p=Math.max(2,...a.map(t=>l(t).length)),g=o!==null,r=o!==null?Math.max(o.length,...a.map(t=>(t.badge??"").length)):0,m=n>=84&&a.some(t=>t.summary),c=2+(g?1:0)+(m?1:0),u=c+1+c*2,b=n-u-p-r,k=Math.max(...a.map(t=>Math.max(t.title.length,(t.marker??"").length)),5),f=Math.max(5,m?Math.min(k,Math.max(16,Math.floor(b*.5))):Math.min(k,b)),T=m?Math.max(7,b-f):0,R=(t,$,M,I)=>O(t,$,M,I.map(A=>A.length)),C=(t,$,M,I)=>[x(h(t,p),p),x(h($,f),f),...g?[x(h(M,r),r)]:[],...m?[x(h(I,T),T)]:[]],y=C("id","title",o??"","summary");return{showBadge:g,showSummary:m,headerCells:y,top:R("\u250C","\u252C","\u2510",y),middle:R("\u251C","\u253C","\u2524",y),bottom:R("\u2514","\u2534","\u2518",y),rows:a.map(t=>({cells:C(l(t),h(t.title,f),h(t.badge??"",r),h(t.summary??"",T)),badgeColor:t.badgeColor??E[t.badge??""]??s.dim,...t.marker?{markerCells:C("",h(t.marker,f),"","")}:{}}))}}function K(d,n){let o=z(d,n.width,n.badgeHeader===void 0?"risk":n.badgeHeader);if(o===null)return[];let a=(r,m)=>n.color?D(r,m):m,l=r=>a(s.dim,r),p=r=>n.color?w.bold(r):r,g=[l(o.top),`${l("\u2502 ")}${o.headerCells.map(p).join(l(" \u2502 "))}${l(" \u2502")}`,l(o.middle)];for(let r of o.rows){let[m,c,...u]=r.cells,b=o.showBadge?[a(r.badgeColor,u[0])]:[],k=o.showSummary?[u[o.showBadge?1:0]]:[];g.push(`${l("\u2502 ")}${a(s.assuranceAccent,m)}${l(" \u2502 ")}${[c,...b,...k].join(l(" \u2502 "))}${l(" \u2502")}`),r.markerCells&&g.push(l(`\u2502 ${r.markerCells.join(" \u2502 ")} \u2502`))}return g.push(l(o.bottom)),g}function D(d,n){if(d.startsWith("#"))return w.hex(d)(n);let o=w[d];return typeof o=="function"?o(n):n}function v({rows:d,width:n=120,badgeHeader:o="risk"}){let a=z(d,n,o);if(a===null)return null;let{showBadge:l,showSummary:p,headerCells:g}=a,r=[];r.push((0,e.jsx)(i,{color:s.dim,children:a.top},"t")),r.push((0,e.jsxs)(i,{children:[g.map((m,c)=>(0,e.jsxs)(i,{children:[(0,e.jsx)(i,{color:s.dim,children:c===0?"\u2502 ":" \u2502 "}),(0,e.jsx)(i,{bold:!0,children:m})]},c)),(0,e.jsx)(i,{color:s.dim,children:" \u2502"})]},"h")),r.push((0,e.jsx)(i,{color:s.dim,children:a.middle},"m"));for(let[m,c]of a.rows.entries()){let u=c.cells;r.push((0,e.jsxs)(i,{children:[(0,e.jsx)(i,{color:s.dim,children:"\u2502 "}),(0,e.jsx)(i,{color:s.assuranceAccent,children:u[0]}),(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),u[1],l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),(0,e.jsx)(i,{color:c.badgeColor,children:u[2]})]}):null,p?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(i,{color:s.dim,children:" \u2502 "}),u[l?3:2]]}):null,(0,e.jsx)(i,{color:s.dim,children:" \u2502"})]},`r-${m}`)),c.markerCells&&r.push((0,e.jsx)(i,{color:s.dim,children:`\u2502 ${c.markerCells.join(" \u2502 ")} \u2502`},`mk-${m}`))}return r.push((0,e.jsx)(i,{color:s.dim,children:a.bottom},"b")),(0,e.jsx)(e.Fragment,{children:r})}export{K as a,v as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as Tr}from"./chunk-ZZZGTDYE.js";import{a as dn,c as mn,e as Et,f as Je,g as $r,h as Rr,i as gn,j as Cr}from"./chunk-4LGQHTXM.js";import{a as St,b as un}from"./chunk-JTNEF5ZP.js";import{a as ln,b as wr}from"./chunk-GZQAETB2.js";import{a as xr,b as kr,c as vr}from"./chunk-ET5EK2CM.js";import{a as pr,b as ue}from"./chunk-HG2ILWCE.js";import{a as dr}from"./chunk-5Y2G4NC7.js";import{c as Rt}from"./chunk-SMXABALN.js";import{b as fr}from"./chunk-WN5VKKJ3.js";import{b as fn}from"./chunk-HD6NR44L.js";import{a as Ct,b as an,c as Ye,d as yr,e as cn}from"./chunk-BWXLZS5O.js";import{e as ze,f as S,g as br}from"./chunk-3V4J65GN.js";import{b as gr,c as Ge,d as hr}from"./chunk-22PIMG52.js";import{na as mr,oa as on}from"./chunk-PI7OXS62.js";import{a as ur}from"./chunk-M3TFOFUQ.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as w,b as r,k as Me}from"./chunk-33DWJV67.js";import{a as cr}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-FAMQ4DHU.js";import{e as U}from"./chunk-UR6MHSHU.js";var bn=U(cr(),1);var g=U(cr(),1);var m=U(Y(),1),Wi=60,Vi=100;function hn(e,s){let c=e.options.length,f=c,p=e.multi_select?f++:null,a=e.allow_free_text?f++:null,u=s?f++:null;return{optionCount:c,doneIdx:p,freeIdx:a,batchIdx:u,maxSel:f-1}}var Ki="\xA0",Ui={high:{text:`\u203C${Ki}high`,color:o.red},med:{text:"med",color:"yellow"},low:{text:"low",color:o.dim}};function Hi(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Qi(e,s,c){let f=x=>e[x].length+6,p=f(s),a=s,u=s;for(;;){let x=u+1<e.length?f(u+1):1/0,y=a-1>=0?f(a-1):1/0;if(x===1/0&&y===1/0)break;if(x<=y){if(p+x>c)break;p+=x,u+=1}else{if(p+y>c)break;p+=y,a-=1}}return{lo:a,hi:u}}function Sr({batch:e,qView:s,sel:c=0,focused:f=!1,freeText:p=null,optionText:a=null,attach:u=null,multiSelFor:x,childPrefix:y,gapAbove:T=!0}){let{stdout:P}=Me(),V=P?.columns??80,re=V<Wi,C=Math.min(V-1,Vi),b=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),I=e.questions[b],pe=e.resolution[b],q=e.resolution.filter(B=>!B).length,fe=e.questions.length-q,we=St(e),W=hn(I,we!==""),xe=x?x(b):[],ie=Ui[I.risk],Z=B=>f&&c===B?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" ",A=`? ${y??""}the agent needs ${q===1?"one answer":`${q} answers`}`,Pe=e.questions.length>1?` \xB7 ${b+1} of ${e.questions.length} \xB7 ${fe} answered`:"",H=(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsxs)(r,{bold:!0,children:[I.text,ie?(0,m.jsx)(r,{color:ie.color,bold:!1,children:` ${ie.text}`}):null]})}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:I.rationale})}),(0,m.jsx)(r,{children:" "}),I.options.map((B,$)=>{let Q=f&&c===$;return a&&a.optionIndex===$?(0,m.jsx)(w,{flexDirection:"column",children:(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:`${$+1}. ${un(B.label)}`}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:a.value,onChange:a.onChange,onSubmit:a.onSubmit,onCancel:a.onCancel,placeholder:B.detail||"type your answer"})]})},`o-${$}`):(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsxs)(r,{children:[Z($)," ",I.multi_select?(0,m.jsx)(r,{color:xe.includes($)?o.green:o.dim,children:xe.includes($)?"[x] ":"[ ] "}):null,(0,m.jsx)(r,{color:Q?o.assuranceAccent:void 0,children:`${$+1}. ${un(B.label)}`}),$===I.recommended_index?(0,m.jsx)(r,{color:o.dim,children:" (recommended)"}):null,pe?.selected_index===$?(0,m.jsx)(r,{color:o.dim,children:" (current)"}):null]}),B.detail?(0,m.jsx)(w,{paddingLeft:5,children:(0,m.jsx)(r,{color:o.dim,children:B.detail})}):null]},`o-${$}`)}),I.multi_select&&W.doneIdx!=null?(0,m.jsxs)(r,{children:[Z(W.doneIdx)," ",(0,m.jsx)(r,{color:o.green,children:"\u2714"}),(0,m.jsx)(r,{color:f&&c===W.doneIdx?o.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,m.jsx)(r,{children:" "}):null,I.allow_free_text?p?(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.dim,children:"\u270E "})]}),(0,m.jsx)(Rt,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"Tell me what to do"})]}):(0,m.jsxs)(r,{children:[W.freeIdx!=null?Z(W.freeIdx):" "," ",(0,m.jsx)(r,{color:f&&W.freeIdx!=null&&c===W.freeIdx?o.assuranceAccent:o.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,m.jsxs)(w,{flexDirection:"column",marginTop:1,children:[(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"@ attach a file or URL"}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),F=we!==""?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r,{children:" "}),(0,m.jsxs)(r,{children:[f&&W.batchIdx!=null&&c===W.batchIdx?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" "," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"\xBB"}),(0,m.jsx)(r,{bold:!0,color:f&&W.batchIdx!=null&&c===W.batchIdx?o.assuranceAccent:void 0,children:" Go with recommendations"}),q>=5?(0,m.jsx)(r,{color:o.dim,children:` \u2014 resolves all ${q} open`}):null,(0,m.jsx)(r,{color:o.dim,children:" (tab)"})]})]}):null;if(re)return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(r,{color:o.assuranceAccent,bold:!0,children:A}),e.questions.length>1?(0,m.jsx)(r,{color:o.dim,children:Pe.replace(/^ · /,"")}):null,(0,m.jsx)(r,{children:" "}),H,F]});let h=e.questions.map(B=>Hi(B)),me=e.questions.length>1?Qi(h,b,C-8):null;return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(r,{color:o.assuranceAccent,children:[(0,m.jsx)(r,{bold:!0,children:A}),Pe?(0,m.jsx)(r,{color:o.dim,children:Pe}):null]}),me?(0,m.jsx)(w,{marginTop:1,children:(0,m.jsxs)(r,{children:[me.lo>0?(0,m.jsx)(r,{color:o.dim,children:"\u25C0 "}):" ",e.questions.slice(me.lo,me.hi+1).map((B,$)=>{let Q=me.lo+$,et=$>0?" ":"";return Q===b?(0,m.jsxs)(r,{children:[et,(0,m.jsx)(r,{backgroundColor:o.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[Q]} `})]},B.id):(0,m.jsxs)(r,{children:[et,e.resolution[Q]?(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.green,children:"\u2713 "}),(0,m.jsx)(r,{color:o.dim,children:h[Q]})]}):(0,m.jsx)(r,{color:o.dim,children:`\u25CB ${h[Q]}`})]},B.id)}),me.hi<e.questions.length-1?(0,m.jsx)(r,{color:o.dim,children:" \u25B6"}):null]})}):null,(0,m.jsx)(r,{children:" "}),H,F]})}var Er={ac:["acceptance criterion","acceptance criteria"],gap:["open question","open questions"],scenario:["scenario","scenarios"],test:["test","tests"],"use-case":["use-case","use-cases"]},pn=e=>Er[e]?.[1]??`${e}s`,At={label:(e,s)=>s===1?Er[e]?.[0]??e:pn(e),skip:new Set(["exercise"])},xn={ac:null,test:null,gap:null,scenario:"kind"},Xi=(e,s,c)=>`${e} ${e===1?s:c}`,Gi=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ar(e){let s=e.covers?on(e.covers):"1 scenario",c=e.verifies.slice(0,2).map(on),f=e.verifiesTotal-c.length,p=c.length===0?Xi(e.verifiesTotal,"acceptance criterion","acceptance criteria"):Gi([...c,...f>0?[`${f} more`]:[]]);return`covers ${s} \xB7 verifies ${p}`}function Dr(e,s){let c=typeof s=="string"&&s!==""?s.split(", "):[],f=p=>typeof p=="string"&&mr.test(p);return{covers:f(e)?e:null,verifies:c.filter(f),verifiesTotal:c.length}}var Dt={"acceptance criteria":{name:"acceptance criteria",next:"scenarios",done:"acceptance criteria say what the use-case must always do"},scenarios:{name:"scenarios",next:"scenario checks",done:"scenarios are the paths a user takes that test the criteria"},"acceptance criteria + exercises":{name:"scenario checks",next:"tests",done:"scenario checks say which criteria each scenario checks"},"tests + gaps":{name:"tests"},tests:{name:"tests"}};function Ze(e){let s=Dt[e]?.name;if(s)return s;let c={exercises:"scenario checks",gaps:"open questions"};return[...new Set(e.split(" + ").map(f=>c[f]??f))].join(" + ")}var Ir={scenarios:"next, scenarios: the paths a user takes that test them","scenario checks":"next, scenario checks: which criteria each scenario checks",tests:"next, tests: runnable tests, and open questions for what can't run"},Br="phases: acceptance criteria \u2192 scenarios \u2192 scenario checks \u2192 tests";var k=U(Y(),1),zi=e=>e.startsWith("designing: ")?`designing: ${Ze(e.slice(11))}`:e;function Yi(e,s){let c=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",f=e.note?` \u2014 ${e.note}`:"",p=s?`"${e.stub}"`:`q${e.qNum} ${e.stub}`;return e.form==="deferred"?`\u21B3 deferred ${p}${f}`:e.form==="changed"?`\u21B3 changed ${p}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${c}${f}`:`\u21B3 ${e.form} ${p}: ${e.choice??"?"}${c}${f}`}var Ji=()=>(process.stdout?.columns??100)-12,Zi=new Set(["banner","header","user","agent","worked","childOpen","lines"]);function Lr({block:e,annotations:s,remote:c=!1,afterHeader:f=!1}){let p=e.era??0,{stdout:a}=Me(),u=c||p>0?(a?.columns??100)-p*2:null,x=ns(e,s??null,c,u,(a?.columns??100)-p*2),y=p>0?(0,k.jsx)(w,{marginLeft:p*2,children:x}):x;return f&&!Zi.has(e.kind)?(0,k.jsx)(w,{marginTop:1,children:y}):y}var es=new RegExp("[\\u1100-\\u115F\\u2E80-\\u303E\\u3041-\\uA4CF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE6F\\uFF00-\\uFF60\\uFFE0-\\uFFE6\\u{20000}-\\u{3FFFD}\u2714\u26A0]|\\p{Emoji_Presentation}","u"),It=e=>[...e].reduce((s,c)=>s+(es.test(c)?2:1),0);function ts(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s){let x=a?`${a} \xB7 ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function _e(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s.split(" ")){let x=a?`${a} ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function ns(e,s,c,f=null,p=100){switch(e.kind){case"banner":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{bold:!0,color:o.assuranceAccent,children:` ${c?zi(e.text):e.text}`})});case"header":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${e.text}`,e.tail?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.tail}`}):null]})});case"user":return(0,k.jsxs)(w,{marginTop:1,children:[(0,k.jsx)(r,{color:o.orange,children:"\u276F "}),(0,k.jsx)(r,{children:e.text})]});case"note":return(0,k.jsx)(r,{color:o.dim,children:` ${e.text}`});case"lines":return(0,k.jsx)(w,{flexDirection:"column",marginTop:1,children:e.lines.map((a,u)=>(0,k.jsx)(r,{...a.dim?{color:o.dim}:{},children:a.text},u))});case"agent":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(kr,{text:e.text,accent:o.assuranceAccent,indent:f===null?0:(e.era??0)*2})});case"worked":return(0,k.jsx)(w,{marginTop:1,flexDirection:"column",children:ts(" \u2699 ",hr(e.durS,e.toolCalls,e.tools),p).map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},u))});case"usage":return(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let a=s,u=(a?a.fresh:e.items.map((C,b)=>({item:C,num:b+1,updated:!1}))).filter(C=>!(c&&At.skip?.has(C.item.kind??""))),x={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"risk",stylenote:"kind"},y=C=>C.kind??"use-case",T=new Map;for(let C of u){let b=C.item,I=y(C.item),pe=c&&I==="test"?{title:b.title,summary:Ar(b.links??Dr(b.extra?.automates,b.extra?.verifies)),badge:""}:c&&I==="gap"?{title:b.question??"",summary:b.rationale??"",badge:""}:null,q=b.risk==="high"||b.risk==="med"||b.risk==="low"?b.risk:void 0,fe=b.logical_id??(c?b.matched_id:void 0),we={id:fe??"",staged:!fe,...c&&b.held&&!fe?{held:!0}:{},title:pe?.title??b.title,badge:pe?.badge??b.badge??b.risk??"",summary:pe?.summary??b.why??b.summary??b.description??"",...q?{risk:q}:{},...C.updated?{marker:"\u21B3 changed"}:{}},W=T.get(I)??[];W.push(we),T.set(I,W)}let P=u.some(C=>!!C.item.kind),V=(a?.unchanged??[]).reduce((C,b)=>C+b.count,0),re=a?.headerStats?` \u2014 ${a.headerStats}${V>0?` (${V} unchanged)`:""}`:"";return(0,k.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(0,k.jsxs)(r,{bold:!0,children:[P?"design":e.heading,re?(0,k.jsx)(r,{bold:!1,color:o.dim,children:re}):null]}),[...T.entries()].map(([C,b])=>(0,k.jsxs)(w,{flexDirection:"column",children:[T.size>1?(0,k.jsx)(r,{color:o.dim,children:`${c?pn(C):Ct(C)} \xB7 ${b.length}`}):null,(0,k.jsx)(Tr,{rows:b,width:Ji(),badgeHeader:c&&C in xn?xn[C]:x[C]??"info"})]},C)),a&&a.unchanged.length>0&&(0,k.jsx)(r,{color:o.dim,children:` \u22EE unchanged: ${a.unchanged.map(C=>`${C.count} ${C.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,k.jsx)(r,{color:o.dim,children:Yi(e.receipt,c)});case"continued":return(0,k.jsx)(r,{color:o.dim,children:"\u21B3 continued"});case"childOpen":{if(c)return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{color:o.assuranceAccent,children:`\u25CF ${e.update?S.updateOpen(e.subject,e.changed===!0):S.childOpen(e.verb,e.subject)}`})});let{ing:a}=fn(e.verb);return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${a} ${e.subject}`,e.sid?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.sid}`}):null,e.note?(0,k.jsx)(r,{color:o.dim,children:` ${e.note}`}):null]})})}case"childClose":{if(e.held)return(0,k.jsx)(w,{});if(c&&e.update){let x=[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.updateFailed(e.subject)}`});if(e.untouched)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUntouched(e.subject)} \u2014 ${x.join(" \xB7 ")}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUnfinished(e.subject)} \u2014 ${x.join(" \xB7 ")}`});let y=e.testsWritten?S.updateTests(e.testsWritten):null,T=[x[0],...y?[y]:[],...x.slice(1)];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.updateClosed(e.subject,T)}`})}if(c){if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.childFailed(e.verb,e.subject)}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${[S.childUnfinished(e.verb),[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")].join(" \u2014 ")}`});let x=[Ge(e.durS),...e.tests?[S.childTests(e.verb,e.tests)]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.childClosed(e.verb,e.subject,x)}`})}let{ed:a}=fn(e.verb);if(!e.ok)return(0,k.jsxs)(r,{color:o.red,children:[`\u25CF ${e.verb} failed \u2014 ${e.exitCode!=null?`exited ${e.exitCode}`:"error"}`,e.fixCmd?(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.fixCmd}`}):null]});let u=[Ge(e.durS),...e.results?[e.results]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${a} ${e.subject} \u2014 ${u}`})}case"childBack":return(0,k.jsx)(r,{color:o.dim,children:`back with ${e.parentVerb} \u2014 ${e.context}`});case"commit":if(c&&e.person&&!e.ok&&e.refused?.length){let a=S.approveRefused(e.refused);return(0,k.jsxs)(w,{flexDirection:"column",children:[_e(" \u2717 ",a.line,f??100).map((u,x)=>(0,k.jsx)(r,{color:o.red,children:u},`p-${x}`)),a.notes.flatMap((u,x)=>_e(" ",u,f??100).map((y,T)=>(0,k.jsx)(r,{color:o.dim,children:y},`n-${x}-${T}`)))]})}return(0,k.jsxs)(w,{flexDirection:"column",children:[c&&e.held?_e(" \u2016 ",e.line,f??100).map((a,u)=>(0,k.jsx)(r,{children:a},`h-${u}`)):f!==null?_e(` ${e.ok?"\u2714":"\u2717"} `,e.line,f).map((a,u)=>(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:a},`c-${u}`)):(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),c&&e.refused?.length?S.chatRefused(e.refused).flatMap((a,u)=>_e(" ",a,f??100).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`r-${u}-${y}`))):(e.warnings??[]).flatMap((a,u)=>!c&&f!==null&&(e.era??0)>0?_e(" \u26A0 ",a,f).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`w-${u}-${y}`)):[(0,k.jsx)(r,{color:o.dim,children:` \u26A0 ${a}`},`w-${u}`)])]});case"error":return(0,k.jsxs)(ur,{variant:"error",paddingX:1,children:[(0,k.jsx)(r,{color:o.red,children:e.title}),e.detail.map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},`d-${u}`))]})}}var Oe=U(Y(),1);function Mr({item:e}){return(0,Oe.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,c)=>(0,Oe.jsx)(r,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${c}`)),(e.depends_on_hint??[]).length>0&&(0,Oe.jsx)(r,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,c])=>(0,Oe.jsx)(r,{dimColor:!0,children:`${s}: ${c}`},`extra-${s}`))]})}var E=U(Y(),1),kn=(e,s)=>Math.max(0,Math.min(s,e));function Lt(e,s,c){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:kn(e.cursor+s.delta,Math.max(0,c-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Or={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function Pr(e,s){if(e.level==="detail")return{level:"detail",cursor:kn(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let c=s.entries.findIndex(f=>Or[f.kind]===e.section);if(c>=0)return{level:"list",cursor:c}}return{level:"list",cursor:0}}function rs(e){let s=[];for(let c of e.entries){let f=s.find(p=>p.kind===c.kind);f?f.entries.push(c):s.push({kind:c.kind,entries:[c]})}return s}var _r=3;function is({items:e,cursor:s,verb:c,more:f}){let p=`view \xB7 ${c} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,a=e.entries[s];return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,color:o.assuranceAccent,children:p}),rs(e).map(({kind:u,entries:x})=>{let y=a?.kind===u,T=y?x.findIndex(C=>C.num===a.num):-1,P=y?kn(T-1,Math.max(0,x.length-_r)):0,V=x.slice(P,P+(y?_r:1)),re=x.length-V.length;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{color:o.dim,children:`${Or[u]??Ct(u)} \xB7 ${x.length}`}),V.map(C=>{let b=y&&C.num===a.num,I=C.item.badge;return(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:b?"\u203A ":" "}),(0,E.jsx)(r,{children:`${C.num} \xB7 ${C.item.title}`}),I?(0,E.jsx)(r,{color:o.dim,children:` \xB7 ${I}`}):null]},`${C.kind}:${C.num}`)}),re>0&&(0,E.jsx)(r,{color:o.dim,children:` \u22EE ${re} more`})]},u)}),f?(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,E.jsx)(r,{color:o.dim,children:`\u22EF show all \u2014 ${f.hidden} more from earlier turns`})]}):null]})}var Bt=14;function ss({items:e,cursor:s,explain:c,grandTotal:f,dossier:p,scroll:a=0}){let u=e.entries[s];if(!u)return(0,E.jsx)(r,{color:o.dim,children:"nothing to show"});if(p){let y=Math.max(0,Math.min(a,Math.max(0,p.lines.length-Bt))),T=p.lines.slice(y,y+Bt);return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsxs)(r,{bold:!0,children:[`view \xB7 ${p.id}`,p.id.toLowerCase()!==p.rawId?(0,E.jsx)(r,{bold:!1,color:o.dim,children:` \xB7 ${p.rawId}`}):null]}),(0,E.jsx)(r,{bold:!0,children:p.title}),y>0?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${y} above`}):null,T.map((P,V)=>(0,E.jsx)(r,{color:P.dim?o.dim:void 0,children:P.text},`dl-${V}`)),p.lines.length>y+Bt?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${p.lines.length-y-Bt} more`}):null]})}let x=u.item;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${f??e.entries.length}`}),(0,E.jsx)(r,{children:u.item.title}),x.badge?(0,E.jsx)(r,{color:o.dim,children:`kind: ${x.badge}`}):null,x.why?(0,E.jsx)(r,{color:o.dim,children:x.why}):null,(0,E.jsx)(Mr,{item:u.item}),c?.map((y,T)=>(0,E.jsx)(r,{color:o.dim,children:y},`ex-${T}`)),(0,E.jsx)(r,{color:o.dim,children:"view-only \u2014 approvals happen in chat"})]})}function jr({items:e,state:s,verb:c,more:f,explain:p,grandTotal:a,dossier:u=null}){return s.level==="list"?(0,E.jsx)(is,{items:e,cursor:s.cursor,verb:c,more:f}):(0,E.jsx)(ss,{items:e,cursor:s.cursor,explain:p,grandTotal:a,dossier:u,scroll:s.scroll??0})}var J=U(Y(),1),vn=14;function os(e){let s=[],c=null;for(let f of e)f.field!==c&&(c=f.field,s.push({kind:"field",field:c})),s.push({kind:"line",field:c,line:f});return s}function Fr({title:e,lines:s,offset:c=0,remote:f=!1}){let p=os(s),a=Math.max(0,Math.min(c,Math.max(0,p.length-vn))),u=p.slice(a,a+vn),x=a,y=Math.max(0,p.length-a-vn),T=f?`the change to ${e} \xB7 old \u2192 new`:`view \xB7 diff \xB7 ${e} \xB7 current \u2192 proposed`;return(0,J.jsxs)(w,{flexDirection:"column",children:[(0,J.jsx)(r,{bold:!0,color:o.assuranceAccent,children:T}),x>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${x} above`})}):null,u.map((P,V)=>P.kind==="field"?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:P.field==="criteria"?f?"acceptance criteria":"criteria":P.field})},`r-${a+V}`):(0,J.jsx)(w,{paddingLeft:4,children:(0,J.jsx)(r,{color:P.line.op==="-"?"red":"green",children:`${P.line.op==="-"?"\u2212":"+"} ${P.line.text}`})},`r-${a+V}`)),y>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${y} more`})}):null]})}var ls={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function qr(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let f=parseInt(s,10);return f>=1?{level:"detail",num:f}:{error:"items are numbered from 1 \u2014 /view 1"}}let c=ls[s];return c?{level:"list",section:c}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var D=U(Y(),1),as=6,Nr=12;function cs(e,s,c){let f=Math.max(20,s),p=[];for(let u of e.split(`
|
|
2
|
+
import{b as Tr}from"./chunk-6QH75BPJ.js";import{a as dn,c as mn,e as Et,f as Je,g as $r,h as Rr,i as gn,j as Cr}from"./chunk-XKOVEMVZ.js";import{a as St,b as un}from"./chunk-JTNEF5ZP.js";import{a as ln,b as wr}from"./chunk-EJGCIGQY.js";import{a as xr,b as kr,c as vr}from"./chunk-YWWVF5OU.js";import{a as pr,b as ue}from"./chunk-YILRYMMG.js";import{a as dr}from"./chunk-5Y2G4NC7.js";import{c as Rt}from"./chunk-SMXABALN.js";import{b as fr}from"./chunk-WN5VKKJ3.js";import{b as fn}from"./chunk-HD6NR44L.js";import{a as Ct,b as an,c as Ye,d as yr,e as cn}from"./chunk-BWXLZS5O.js";import{e as ze,f as S,g as br}from"./chunk-LRNUGKYH.js";import{b as gr,c as Ge,d as hr}from"./chunk-22PIMG52.js";import{na as mr,oa as on}from"./chunk-PI7OXS62.js";import{a as ur}from"./chunk-ND6OP3O2.js";import{a as Y}from"./chunk-HCBYKLMW.js";import{a as w,b as r,k as Me}from"./chunk-33DWJV67.js";import{a as cr}from"./chunk-6YGTRKDT.js";import{z as o}from"./chunk-J4FIESTB.js";import{e as U}from"./chunk-UR6MHSHU.js";var bn=U(cr(),1);var g=U(cr(),1);var m=U(Y(),1),Wi=60,Vi=100;function hn(e,s){let c=e.options.length,f=c,p=e.multi_select?f++:null,a=e.allow_free_text?f++:null,u=s?f++:null;return{optionCount:c,doneIdx:p,freeIdx:a,batchIdx:u,maxSel:f-1}}var Ki="\xA0",Ui={high:{text:`\u203C${Ki}high`,color:o.red},med:{text:"med",color:"yellow"},low:{text:"low",color:o.dim}};function Hi(e){let s=(e.header??e.text.split(/\s+/).slice(0,3).join(" ")).trim();return s.length>16?`${s.slice(0,15)}\u2026`:s}function Qi(e,s,c){let f=x=>e[x].length+6,p=f(s),a=s,u=s;for(;;){let x=u+1<e.length?f(u+1):1/0,y=a-1>=0?f(a-1):1/0;if(x===1/0&&y===1/0)break;if(x<=y){if(p+x>c)break;p+=x,u+=1}else{if(p+y>c)break;p+=y,a-=1}}return{lo:a,hi:u}}function Sr({batch:e,qView:s,sel:c=0,focused:f=!1,freeText:p=null,optionText:a=null,attach:u=null,multiSelFor:x,childPrefix:y,gapAbove:T=!0}){let{stdout:P}=Me(),V=P?.columns??80,re=V<Wi,C=Math.min(V-1,Vi),b=Math.max(0,Math.min(e.questions.length-1,s??(e.cursor<0?0:e.cursor))),I=e.questions[b],pe=e.resolution[b],q=e.resolution.filter(B=>!B).length,fe=e.questions.length-q,we=St(e),W=hn(I,we!==""),xe=x?x(b):[],ie=Ui[I.risk],Z=B=>f&&c===B?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" ",A=`? ${y??""}the agent needs ${q===1?"one answer":`${q} answers`}`,Pe=e.questions.length>1?` \xB7 ${b+1} of ${e.questions.length} \xB7 ${fe} answered`:"",H=(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsxs)(r,{bold:!0,children:[I.text,ie?(0,m.jsx)(r,{color:ie.color,bold:!1,children:` ${ie.text}`}):null]})}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:I.rationale})}),(0,m.jsx)(r,{children:" "}),I.options.map((B,$)=>{let Q=f&&c===$;return a&&a.optionIndex===$?(0,m.jsx)(w,{flexDirection:"column",children:(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:`${$+1}. ${un(B.label)}`}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:a.value,onChange:a.onChange,onSubmit:a.onSubmit,onCancel:a.onCancel,placeholder:B.detail||"type your answer"})]})},`o-${$}`):(0,m.jsxs)(w,{flexDirection:"column",children:[(0,m.jsxs)(r,{children:[Z($)," ",I.multi_select?(0,m.jsx)(r,{color:xe.includes($)?o.green:o.dim,children:xe.includes($)?"[x] ":"[ ] "}):null,(0,m.jsx)(r,{color:Q?o.assuranceAccent:void 0,children:`${$+1}. ${un(B.label)}`}),$===I.recommended_index?(0,m.jsx)(r,{color:o.dim,children:" (recommended)"}):null,pe?.selected_index===$?(0,m.jsx)(r,{color:o.dim,children:" (current)"}):null]}),B.detail?(0,m.jsx)(w,{paddingLeft:5,children:(0,m.jsx)(r,{color:o.dim,children:B.detail})}):null]},`o-${$}`)}),I.multi_select&&W.doneIdx!=null?(0,m.jsxs)(r,{children:[Z(W.doneIdx)," ",(0,m.jsx)(r,{color:o.green,children:"\u2714"}),(0,m.jsx)(r,{color:f&&c===W.doneIdx?o.assuranceAccent:void 0,children:" done \u2014 confirm selection"})]}):null,I.allow_free_text?(0,m.jsx)(r,{children:" "}):null,I.allow_free_text?p?(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.dim,children:"\u270E "})]}),(0,m.jsx)(Rt,{value:p.value,onChange:p.onChange,onSubmit:p.onSubmit,onCancel:p.onCancel,placeholder:"Tell me what to do"})]}):(0,m.jsxs)(r,{children:[W.freeIdx!=null?Z(W.freeIdx):" "," ",(0,m.jsx)(r,{color:f&&W.freeIdx!=null&&c===W.freeIdx?o.assuranceAccent:o.dim,children:"\u270E Tell me what to do"})]}):null,u?(0,m.jsxs)(w,{flexDirection:"column",marginTop:1,children:[(0,m.jsxs)(w,{children:[(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"})," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"@ attach a file or URL"}),(0,m.jsx)(r,{color:o.dim,children:" \u270E "})]}),(0,m.jsx)(Rt,{value:u.value,onChange:u.onChange,onSubmit:u.onSubmit,onCancel:u.onCancel,placeholder:"path or URL"})]}),(0,m.jsx)(w,{paddingLeft:2,children:(0,m.jsx)(r,{color:o.dim,children:"the questions are set aside \u2014 the agent reads the source and re-asks what's still open"})})]}):null]}),F=we!==""?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(r,{children:" "}),(0,m.jsxs)(r,{children:[f&&W.batchIdx!=null&&c===W.batchIdx?(0,m.jsx)(r,{color:o.assuranceAccent,children:"\u276F"}):" "," ",(0,m.jsx)(r,{color:o.assuranceAccent,children:"\xBB"}),(0,m.jsx)(r,{bold:!0,color:f&&W.batchIdx!=null&&c===W.batchIdx?o.assuranceAccent:void 0,children:" Go with recommendations"}),q>=5?(0,m.jsx)(r,{color:o.dim,children:` \u2014 resolves all ${q} open`}):null,(0,m.jsx)(r,{color:o.dim,children:" (tab)"})]})]}):null;if(re)return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsx)(r,{color:o.assuranceAccent,bold:!0,children:A}),e.questions.length>1?(0,m.jsx)(r,{color:o.dim,children:Pe.replace(/^ · /,"")}):null,(0,m.jsx)(r,{children:" "}),H,F]});let h=e.questions.map(B=>Hi(B)),me=e.questions.length>1?Qi(h,b,C-8):null;return(0,m.jsxs)(w,{marginTop:T?1:0,marginBottom:1,flexDirection:"column",children:[(0,m.jsxs)(r,{color:o.assuranceAccent,children:[(0,m.jsx)(r,{bold:!0,children:A}),Pe?(0,m.jsx)(r,{color:o.dim,children:Pe}):null]}),me?(0,m.jsx)(w,{marginTop:1,children:(0,m.jsxs)(r,{children:[me.lo>0?(0,m.jsx)(r,{color:o.dim,children:"\u25C0 "}):" ",e.questions.slice(me.lo,me.hi+1).map((B,$)=>{let Q=me.lo+$,et=$>0?" ":"";return Q===b?(0,m.jsxs)(r,{children:[et,(0,m.jsx)(r,{backgroundColor:o.assuranceAccent,color:"#0d1117",bold:!0,children:` ${h[Q]} `})]},B.id):(0,m.jsxs)(r,{children:[et,e.resolution[Q]?(0,m.jsxs)(r,{children:[(0,m.jsx)(r,{color:o.green,children:"\u2713 "}),(0,m.jsx)(r,{color:o.dim,children:h[Q]})]}):(0,m.jsx)(r,{color:o.dim,children:`\u25CB ${h[Q]}`})]},B.id)}),me.hi<e.questions.length-1?(0,m.jsx)(r,{color:o.dim,children:" \u25B6"}):null]})}):null,(0,m.jsx)(r,{children:" "}),H,F]})}var Er={ac:["acceptance criterion","acceptance criteria"],gap:["open question","open questions"],scenario:["scenario","scenarios"],test:["test","tests"],"use-case":["use-case","use-cases"]},pn=e=>Er[e]?.[1]??`${e}s`,At={label:(e,s)=>s===1?Er[e]?.[0]??e:pn(e),skip:new Set(["exercise"])},xn={ac:null,test:null,gap:null,scenario:"kind"},Xi=(e,s,c)=>`${e} ${e===1?s:c}`,Gi=e=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function Ar(e){let s=e.covers?on(e.covers):"1 scenario",c=e.verifies.slice(0,2).map(on),f=e.verifiesTotal-c.length,p=c.length===0?Xi(e.verifiesTotal,"acceptance criterion","acceptance criteria"):Gi([...c,...f>0?[`${f} more`]:[]]);return`covers ${s} \xB7 verifies ${p}`}function Dr(e,s){let c=typeof s=="string"&&s!==""?s.split(", "):[],f=p=>typeof p=="string"&&mr.test(p);return{covers:f(e)?e:null,verifies:c.filter(f),verifiesTotal:c.length}}var Dt={"acceptance criteria":{name:"acceptance criteria",next:"scenarios",done:"acceptance criteria say what the use-case must always do"},scenarios:{name:"scenarios",next:"scenario checks",done:"scenarios are the paths a user takes that test the criteria"},"acceptance criteria + exercises":{name:"scenario checks",next:"tests",done:"scenario checks say which criteria each scenario checks"},"tests + gaps":{name:"tests"},tests:{name:"tests"}};function Ze(e){let s=Dt[e]?.name;if(s)return s;let c={exercises:"scenario checks",gaps:"open questions"};return[...new Set(e.split(" + ").map(f=>c[f]??f))].join(" + ")}var Ir={scenarios:"next, scenarios: the paths a user takes that test them","scenario checks":"next, scenario checks: which criteria each scenario checks",tests:"next, tests: runnable tests, and open questions for what can't run"},Br="phases: acceptance criteria \u2192 scenarios \u2192 scenario checks \u2192 tests";var k=U(Y(),1),zi=e=>e.startsWith("designing: ")?`designing: ${Ze(e.slice(11))}`:e;function Yi(e,s){let c=e.form==="assumed"?" (assumed)":e.form==="deferred"?"":" (you)",f=e.note?` \u2014 ${e.note}`:"",p=s?`"${e.stub}"`:`q${e.qNum} ${e.stub}`;return e.form==="deferred"?`\u21B3 deferred ${p}${f}`:e.form==="changed"?`\u21B3 changed ${p}: ${e.prev??"?"} \u2192 ${e.choice??"?"}${c}${f}`:`\u21B3 ${e.form} ${p}: ${e.choice??"?"}${c}${f}`}var Ji=()=>(process.stdout?.columns??100)-12,Zi=new Set(["banner","header","user","agent","worked","childOpen","lines"]);function Lr({block:e,annotations:s,remote:c=!1,afterHeader:f=!1}){let p=e.era??0,{stdout:a}=Me(),u=c||p>0?(a?.columns??100)-p*2:null,x=ns(e,s??null,c,u,(a?.columns??100)-p*2),y=p>0?(0,k.jsx)(w,{marginLeft:p*2,children:x}):x;return f&&!Zi.has(e.kind)?(0,k.jsx)(w,{marginTop:1,children:y}):y}var es=new RegExp("[\\u1100-\\u115F\\u2E80-\\u303E\\u3041-\\uA4CF\\uAC00-\\uD7A3\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE6F\\uFF00-\\uFF60\\uFFE0-\\uFFE6\\u{20000}-\\u{3FFFD}\u2714\u26A0]|\\p{Emoji_Presentation}","u"),It=e=>[...e].reduce((s,c)=>s+(es.test(c)?2:1),0);function ts(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s){let x=a?`${a} \xB7 ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function _e(e,s,c){let f=Math.max(12,c-It(e)),p=[],a="";for(let u of s.split(" ")){let x=a?`${a} ${u}`:u;It(x)>f&&a?(p.push(a),a=u):a=x}return p.push(a),p.map((u,x)=>(x===0?e:" ".repeat(e.length))+u)}function ns(e,s,c,f=null,p=100){switch(e.kind){case"banner":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{bold:!0,color:o.assuranceAccent,children:` ${c?zi(e.text):e.text}`})});case"header":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${e.text}`,e.tail?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.tail}`}):null]})});case"user":return(0,k.jsxs)(w,{marginTop:1,children:[(0,k.jsx)(r,{color:o.orange,children:"\u276F "}),(0,k.jsx)(r,{children:e.text})]});case"note":return(0,k.jsx)(r,{color:o.dim,children:` ${e.text}`});case"lines":return(0,k.jsx)(w,{flexDirection:"column",marginTop:1,children:e.lines.map((a,u)=>(0,k.jsx)(r,{...a.dim?{color:o.dim}:{},children:a.text},u))});case"agent":return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(kr,{text:e.text,accent:o.assuranceAccent,indent:f===null?0:(e.era??0)*2})});case"worked":return(0,k.jsx)(w,{marginTop:1,flexDirection:"column",children:ts(" \u2699 ",hr(e.durS,e.toolCalls,e.tools),p).map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},u))});case"usage":return(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.credits.toFixed(1)} credits \u2014 total ${e.total.toFixed(1)}`});case"turn":{let a=s,u=(a?a.fresh:e.items.map((C,b)=>({item:C,num:b+1,updated:!1}))).filter(C=>!(c&&At.skip?.has(C.item.kind??""))),x={usecase:"risk","use-case":"risk",ac:"check",scenario:"kind",test:"check",gap:"risk",stylenote:"kind"},y=C=>C.kind??"use-case",T=new Map;for(let C of u){let b=C.item,I=y(C.item),pe=c&&I==="test"?{title:b.title,summary:Ar(b.links??Dr(b.extra?.automates,b.extra?.verifies)),badge:""}:c&&I==="gap"?{title:b.question??"",summary:b.rationale??"",badge:""}:null,q=b.risk==="high"||b.risk==="med"||b.risk==="low"?b.risk:void 0,fe=b.logical_id??(c?b.matched_id:void 0),we={id:fe??"",staged:!fe,...c&&b.held&&!fe?{held:!0}:{},title:pe?.title??b.title,badge:pe?.badge??b.badge??b.risk??"",summary:pe?.summary??b.why??b.summary??b.description??"",...q?{risk:q}:{},...C.updated?{marker:"\u21B3 changed"}:{}},W=T.get(I)??[];W.push(we),T.set(I,W)}let P=u.some(C=>!!C.item.kind),V=(a?.unchanged??[]).reduce((C,b)=>C+b.count,0),re=a?.headerStats?` \u2014 ${a.headerStats}${V>0?` (${V} unchanged)`:""}`:"";return(0,k.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(0,k.jsxs)(r,{bold:!0,children:[P?"design":e.heading,re?(0,k.jsx)(r,{bold:!1,color:o.dim,children:re}):null]}),[...T.entries()].map(([C,b])=>(0,k.jsxs)(w,{flexDirection:"column",children:[T.size>1?(0,k.jsx)(r,{color:o.dim,children:`${c?pn(C):Ct(C)} \xB7 ${b.length}`}):null,(0,k.jsx)(Tr,{rows:b,width:Ji(),badgeHeader:c&&C in xn?xn[C]:x[C]??"info"})]},C)),a&&a.unchanged.length>0&&(0,k.jsx)(r,{color:o.dim,children:` \u22EE unchanged: ${a.unchanged.map(C=>`${C.count} ${C.label}`).join(" \xB7 ")}`})]})}case"answer":return(0,k.jsx)(r,{color:o.dim,children:Yi(e.receipt,c)});case"continued":return(0,k.jsx)(r,{color:o.dim,children:"\u21B3 continued"});case"childOpen":{if(c)return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsx)(r,{color:o.assuranceAccent,children:`\u25CF ${e.update?S.updateOpen(e.subject,e.changed===!0):S.childOpen(e.verb,e.subject)}`})});let{ing:a}=fn(e.verb);return(0,k.jsx)(w,{marginTop:1,children:(0,k.jsxs)(r,{color:o.assuranceAccent,children:[`\u25CF ${a} ${e.subject}`,e.sid?(0,k.jsx)(r,{color:o.dim,children:` \u2014 ${e.sid}`}):null,e.note?(0,k.jsx)(r,{color:o.dim,children:` ${e.note}`}):null]})})}case"childClose":{if(e.held)return(0,k.jsx)(w,{});if(c&&e.update){let x=[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.updateFailed(e.subject)}`});if(e.untouched)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUntouched(e.subject)} \u2014 ${x.join(" \xB7 ")}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${S.updateUnfinished(e.subject)} \u2014 ${x.join(" \xB7 ")}`});let y=e.testsWritten?S.updateTests(e.testsWritten):null,T=[x[0],...y?[y]:[],...x.slice(1)];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.updateClosed(e.subject,T)}`})}if(c){if(!e.ok)return(0,k.jsx)(r,{color:o.red,children:`\u25CF ${S.childFailed(e.verb,e.subject)}`});if(e.unfinished)return(0,k.jsx)(r,{children:`\u25CF ${[S.childUnfinished(e.verb),[Ge(e.durS),...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ")].join(" \u2014 ")}`});let x=[Ge(e.durS),...e.tests?[S.childTests(e.verb,e.tests)]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]];return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${S.childClosed(e.verb,e.subject,x)}`})}let{ed:a}=fn(e.verb);if(!e.ok)return(0,k.jsxs)(r,{color:o.red,children:[`\u25CF ${e.verb} failed \u2014 ${e.exitCode!=null?`exited ${e.exitCode}`:"error"}`,e.fixCmd?(0,k.jsx)(r,{color:o.dim,children:` \xB7 ${e.fixCmd}`}):null]});let u=[Ge(e.durS),...e.results?[e.results]:[],...e.credits!==void 0?[`${e.credits.toFixed(1)} credits`]:[]].join(" \xB7 ");return(0,k.jsx)(r,{color:o.green,children:`\u25CF ${a} ${e.subject} \u2014 ${u}`})}case"childBack":return(0,k.jsx)(r,{color:o.dim,children:`back with ${e.parentVerb} \u2014 ${e.context}`});case"commit":if(c&&e.person&&!e.ok&&e.refused?.length){let a=S.approveRefused(e.refused);return(0,k.jsxs)(w,{flexDirection:"column",children:[_e(" \u2717 ",a.line,f??100).map((u,x)=>(0,k.jsx)(r,{color:o.red,children:u},`p-${x}`)),a.notes.flatMap((u,x)=>_e(" ",u,f??100).map((y,T)=>(0,k.jsx)(r,{color:o.dim,children:y},`n-${x}-${T}`)))]})}return(0,k.jsxs)(w,{flexDirection:"column",children:[c&&e.held?_e(" \u2016 ",e.line,f??100).map((a,u)=>(0,k.jsx)(r,{children:a},`h-${u}`)):f!==null?_e(` ${e.ok?"\u2714":"\u2717"} `,e.line,f).map((a,u)=>(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:a},`c-${u}`)):(0,k.jsx)(r,{color:e.ok?o.green:o.red,children:` ${e.ok?"\u2714":"\u2717"} ${e.line}`}),c&&e.refused?.length?S.chatRefused(e.refused).flatMap((a,u)=>_e(" ",a,f??100).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`r-${u}-${y}`))):(e.warnings??[]).flatMap((a,u)=>!c&&f!==null&&(e.era??0)>0?_e(" \u26A0 ",a,f).map((x,y)=>(0,k.jsx)(r,{color:o.dim,children:x},`w-${u}-${y}`)):[(0,k.jsx)(r,{color:o.dim,children:` \u26A0 ${a}`},`w-${u}`)])]});case"error":return(0,k.jsxs)(ur,{variant:"error",paddingX:1,children:[(0,k.jsx)(r,{color:o.red,children:e.title}),e.detail.map((a,u)=>(0,k.jsx)(r,{color:o.dim,children:a},`d-${u}`))]})}}var Oe=U(Y(),1);function Mr({item:e}){return(0,Oe.jsxs)(w,{flexDirection:"column",marginLeft:2,children:[(e.cite??[]).map((s,c)=>(0,Oe.jsx)(r,{dimColor:!0,children:`cite ${s.anchor??"conv"} \u2014 "${s.quote??""}"`},`cite-${c}`)),(e.depends_on_hint??[]).length>0&&(0,Oe.jsx)(r,{dimColor:!0,children:`depends on: ${(e.depends_on_hint??[]).join(", ")}`}),Object.entries(e.extra??{}).map(([s,c])=>(0,Oe.jsx)(r,{dimColor:!0,children:`${s}: ${c}`},`extra-${s}`))]})}var E=U(Y(),1),kn=(e,s)=>Math.max(0,Math.min(s,e));function Lt(e,s,c){switch(s.type){case"move":return e.level==="detail"?{...e,scroll:Math.max(0,(e.scroll??0)+s.delta)}:{...e,cursor:kn(e.cursor+s.delta,Math.max(0,c-1))};case"enter":return e.level==="list"?{...e,level:"detail",scroll:0}:e;case"back":return e.level==="detail"?{...e,level:"list",scroll:0}:null}}var Or={"use-case":"use-cases",ac:"acs",scenario:"scenarios",test:"tests",gap:"gaps"};function Pr(e,s){if(e.level==="detail")return{level:"detail",cursor:kn(e.num-1,Math.max(0,s.entries.length-1))};if(e.section){let c=s.entries.findIndex(f=>Or[f.kind]===e.section);if(c>=0)return{level:"list",cursor:c}}return{level:"list",cursor:0}}function rs(e){let s=[];for(let c of e.entries){let f=s.find(p=>p.kind===c.kind);f?f.entries.push(c):s.push({kind:c.kind,entries:[c]})}return s}var _r=3;function is({items:e,cursor:s,verb:c,more:f}){let p=`view \xB7 ${c} so far \xB7 ${e.counts.map(u=>`${u.count} ${u.count===1?u.label.replace(/s$/,""):u.label}`).join(" \xB7 ")}`,a=e.entries[s];return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,color:o.assuranceAccent,children:p}),rs(e).map(({kind:u,entries:x})=>{let y=a?.kind===u,T=y?x.findIndex(C=>C.num===a.num):-1,P=y?kn(T-1,Math.max(0,x.length-_r)):0,V=x.slice(P,P+(y?_r:1)),re=x.length-V.length;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{color:o.dim,children:`${Or[u]??Ct(u)} \xB7 ${x.length}`}),V.map(C=>{let b=y&&C.num===a.num,I=C.item.badge;return(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:b?"\u203A ":" "}),(0,E.jsx)(r,{children:`${C.num} \xB7 ${C.item.title}`}),I?(0,E.jsx)(r,{color:o.dim,children:` \xB7 ${I}`}):null]},`${C.kind}:${C.num}`)}),re>0&&(0,E.jsx)(r,{color:o.dim,children:` \u22EE ${re} more`})]},u)}),f?(0,E.jsxs)(r,{children:[(0,E.jsx)(r,{color:o.assuranceAccent,children:s===e.entries.length?"\u203A ":" "}),(0,E.jsx)(r,{color:o.dim,children:`\u22EF show all \u2014 ${f.hidden} more from earlier turns`})]}):null]})}var Bt=14;function ss({items:e,cursor:s,explain:c,grandTotal:f,dossier:p,scroll:a=0}){let u=e.entries[s];if(!u)return(0,E.jsx)(r,{color:o.dim,children:"nothing to show"});if(p){let y=Math.max(0,Math.min(a,Math.max(0,p.lines.length-Bt))),T=p.lines.slice(y,y+Bt);return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsxs)(r,{bold:!0,children:[`view \xB7 ${p.id}`,p.id.toLowerCase()!==p.rawId?(0,E.jsx)(r,{bold:!1,color:o.dim,children:` \xB7 ${p.rawId}`}):null]}),(0,E.jsx)(r,{bold:!0,children:p.title}),y>0?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${y} above`}):null,T.map((P,V)=>(0,E.jsx)(r,{color:P.dim?o.dim:void 0,children:P.text},`dl-${V}`)),p.lines.length>y+Bt?(0,E.jsx)(r,{color:o.muted,children:`\u22EE ${p.lines.length-y-Bt} more`}):null]})}let x=u.item;return(0,E.jsxs)(w,{flexDirection:"column",children:[(0,E.jsx)(r,{bold:!0,children:`view \xB7 ${u.kind} ${u.num} of ${f??e.entries.length}`}),(0,E.jsx)(r,{children:u.item.title}),x.badge?(0,E.jsx)(r,{color:o.dim,children:`kind: ${x.badge}`}):null,x.why?(0,E.jsx)(r,{color:o.dim,children:x.why}):null,(0,E.jsx)(Mr,{item:u.item}),c?.map((y,T)=>(0,E.jsx)(r,{color:o.dim,children:y},`ex-${T}`)),(0,E.jsx)(r,{color:o.dim,children:"view-only \u2014 approvals happen in chat"})]})}function jr({items:e,state:s,verb:c,more:f,explain:p,grandTotal:a,dossier:u=null}){return s.level==="list"?(0,E.jsx)(is,{items:e,cursor:s.cursor,verb:c,more:f}):(0,E.jsx)(ss,{items:e,cursor:s.cursor,explain:p,grandTotal:a,dossier:u,scroll:s.scroll??0})}var J=U(Y(),1),vn=14;function os(e){let s=[],c=null;for(let f of e)f.field!==c&&(c=f.field,s.push({kind:"field",field:c})),s.push({kind:"line",field:c,line:f});return s}function Fr({title:e,lines:s,offset:c=0,remote:f=!1}){let p=os(s),a=Math.max(0,Math.min(c,Math.max(0,p.length-vn))),u=p.slice(a,a+vn),x=a,y=Math.max(0,p.length-a-vn),T=f?`the change to ${e} \xB7 old \u2192 new`:`view \xB7 diff \xB7 ${e} \xB7 current \u2192 proposed`;return(0,J.jsxs)(w,{flexDirection:"column",children:[(0,J.jsx)(r,{bold:!0,color:o.assuranceAccent,children:T}),x>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${x} above`})}):null,u.map((P,V)=>P.kind==="field"?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:P.field==="criteria"?f?"acceptance criteria":"criteria":P.field})},`r-${a+V}`):(0,J.jsx)(w,{paddingLeft:4,children:(0,J.jsx)(r,{color:P.line.op==="-"?"red":"green",children:`${P.line.op==="-"?"\u2212":"+"} ${P.line.text}`})},`r-${a+V}`)),y>0?(0,J.jsx)(w,{paddingLeft:2,children:(0,J.jsx)(r,{color:o.dim,children:`\u22EE ${y} more`})}):null]})}var ls={"use-cases":"use-cases",usecases:"use-cases","use-case":"use-cases",acs:"acs",ac:"acs",scenarios:"scenarios",scenario:"scenarios",tests:"tests",test:"tests",gaps:"gaps",gap:"gaps"};function qr(e){let s=(e??"").trim().toLowerCase();if(!s)return{level:"list"};if(/^\d+$/.test(s)){let f=parseInt(s,10);return f>=1?{level:"detail",num:f}:{error:"items are numbered from 1 \u2014 /view 1"}}let c=ls[s];return c?{level:"list",section:c}:{error:"try /view, /view <number>, or /view acs|scenarios|tests"}}var D=U(Y(),1),as=6,Nr=12;function cs(e,s,c){let f=Math.max(20,s),p=[];for(let u of e.split(`
|
|
3
3
|
`)){if(u.length<=f){p.push(u);continue}let x="";for(let y of u.split(" "))x&&x.length+1+y.length>f?(p.push(x),x=y):x=x?`${x} ${y}`:y;p.push(x)}let a=Math.max(0,p.length-c);return{body:p.slice(-c).join(`
|
|
4
4
|
`),hidden:a}}function wn(e){return e.resumed?[{role:"agent",turnIndex:0,items:e.resumed.items},...e.turns]:e.turns}function Wr(e){let s={key:"redesign",label:"re-design from scratch",detail:"replaces the current design"},c={key:"keep",label:"keep the existing design",detail:"back to the list"};return e.designed==="stale"?[{...s,detail:"the use-case changed since it was designed"},c]:[c,s]}function Vr(e){return e.length===0?null:{approved:e.filter(s=>s.verdict==="approve").length,rejected:e.filter(s=>s.verdict==="reject").length,deferred:e.filter(s=>s.verdict==="defer").length}}function ds(e,s){return s?`the changes in ${e} could not be read: ${s.message}`:"no reviewable changes came back \u2014 the source may be unchanged"}function fo({controller:e,verb:s="extract",onCtrlC:c,chain:f=null,inspect:p=null,reconcile:a=null,autoReview:u=!1,onReviewExit:x,meta:y=null,remote:T=null}){let[,P]=(0,g.useState)(0),[V,re]=(0,g.useState)(!1),[C,b]=(0,g.useState)(null),[I,pe]=(0,g.useState)(null),q=(0,g.useRef)(null),[fe,we]=(0,g.useState)(null),W=(0,g.useRef)(null),xe=t=>{W.current=t,we(t)},ie=t=>{q.current=t,pe(t),t===null&&xe(null)},Z=(0,g.useRef)([]),[A,Pe]=(0,g.useState)(null),H=(0,g.useRef)(null),F=t=>{H.current=t,Pe(t)},[h,me]=(0,g.useState)(null),B=(0,g.useRef)(null),$=t=>{B.current=t,me(t)},[Q,et]=(0,g.useState)(null),yn=(0,g.useRef)(null),be=t=>{yn.current=t,et(t)},Mt=(0,g.useRef)({approved:0,rejected:0,deferred:0}),[Kr,Ur]=(0,g.useState)(null),je=(0,g.useRef)({added:0,updated:0}),Fe=(0,g.useRef)(!1),se=(0,g.useRef)(null),[ye,_t]=(0,g.useState)(null),Tn=(0,g.useRef)(new Set),$n=fr(),{stdout:Hr}=Me(),Qr=Hr?.columns??80,Rn=(0,g.useRef)(0),N=T!==null,R=T?.review??null,tt=N&&e.state.ledger.at(-1)?.kind==="agent",Ot=(0,g.useRef)(0);(0,g.useEffect)(()=>{let t=i=>R!==null&&i?.kind==="header"&&(i.era??0)>0,n=()=>{let i=e.state.ledger;for(let d=Rn.current;d<i.length;d++){let v=i[d];if(t(v))continue;let _=v.kind==="turn"?yr(e.state.turns,v.turnIndex,N?At:void 0):void 0;N&&_&&_.fresh.length===0&&_.unchanged.length===0||$n.append((0,D.jsx)(Lr,{block:v,annotations:_,remote:N,afterHeader:i[d-1]?.kind==="header"&&!t(i[d-1])||i[d-1]?.kind==="lines"},`lg-${d}`))}Rn.current=i.length};n();let l=e.subscribe(()=>{n();let i=e.state;q.current&&(i.pending||i.status==="pausing")&&(ie(null),i.pending&&b("questions arrived \u2014 back to chat")),P(d=>d+1)});return P(i=>i+1),l},[e,$n]);let{thinking:ge,status:ee,pending:M,confirm:qe,ledger:oe,activeTurn:Cn,stream:Xr,notice:nt}=e.state,Sn=(Xr?.text??"").trimEnd(),En=Sn.length>0,Gr=V&&(ge.liveThinking.length>0||ge.thinkingLog.length>0),zr=cs(ge.liveThinking||ge.thinkingLog.map(t=>t.text).join(`
|
|
5
5
|
`),Qr-6,Nr),An=En?Sn.split(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as At,b as Ct,d as Ot,f as Tt,t as Mt,u as jt}from"./chunk-
|
|
2
|
+
import{a as At,b as Ct,d as Ot,f as Tt,t as Mt,u as jt}from"./chunk-SXBPUUQ5.js";import{b as It}from"./chunk-6HRNG4CK.js";import{b as _t,d as Rt}from"./chunk-JBKHX5ES.js";import{k as yt}from"./chunk-4CJQ7XZP.js";import{a as ht,b as U}from"./chunk-TAY7J5VS.js";import{c as vt,h as wt}from"./chunk-3RO2YGKH.js";import{c as gt}from"./chunk-NI3TIAD7.js";import{a as Wt}from"./chunk-HIUAUZNL.js";import{g as Pt,h as Re,j as Et}from"./chunk-X2MDL6S4.js";import{c as Dt,d as $t,e as Ut}from"./chunk-YNDELIXL.js";import{d as xt}from"./chunk-LRNUGKYH.js";import{g as Nt}from"./chunk-ZHAMVLQZ.js";import{f as bt}from"./chunk-CB344EDO.js";import{k as St}from"./chunk-L3BUPFAQ.js";import{c as kt}from"./chunk-GBQ4K25P.js";import{B as ct,D as ut,Da as mt,Ha as P,W as _e,ba as pt,f as re,fa as ft,h as rt,i as st,n as k,o as dt,pa as ie,r as Se,t as z,u as se,v as oe,w as lt}from"./chunk-WE7HRAGO.js";import{a as ot,b as it,d as at}from"./chunk-GFLB2SHW.js";import{a as ke}from"./chunk-RQKMSNEU.js";import{a as ne}from"./chunk-4C7WVQOD.js";import{d as et}from"./chunk-7YV2FCN4.js";import{oa as nt}from"./chunk-PI7OXS62.js";import{b as tt}from"./chunk-ZAQGIC33.js";import{c as Ze}from"./chunk-ZCRZFAOT.js";import{a as Ye}from"./chunk-J4FIESTB.js";import{appendFileSync as tn,mkdirSync as nn,mkdtempSync as rn,rmSync as sn}from"fs";import{tmpdir as on}from"os";import{dirname as an,join as dn}from"path";import{MessageChannel as ln,Worker as cn}from"worker_threads";var Ft=["submit","submitAnswer","submitFreeText","submitAnswerWithText","toggleOption","confirmMulti","goWithRecommendations","ingestAttach","continueParked","completeSession","requestPause","finalizeForExit","note","ledger"],xn=[...Ft,"state","subscribe","multiSelection","canIngest","senderAlive","aliasOf","explainLines","ask","approveAdded"];function Lt(e,s){let n=s.state,o=s.view,i=new Set,l=[];e.on("message",m=>{if(m.type==="approved")return void l.shift()?.(m.go);if(m.type==="mirror"){n=m.state,o=m.view;for(let g of[...i])g()}});let f=(m,g)=>e.postMessage({type:"controller",member:m,args:g});return{...Object.fromEntries(Ft.map(m=>[m,(...g)=>{f(m,g)}])),get state(){return n},subscribe(m){return i.add(m),()=>i.delete(m)},goWithRecommendations(){return f("goWithRecommendations",[]),{picks:""}},async ingestAttach(m){f("ingestAttach",[m])},approveAdded(){return new Promise(m=>{l.push(m),f("approveAdded",[])})},multiSelection:m=>o.multi[m]??[],canIngest:()=>o.canIngest,senderAlive:()=>o.senderAlive,aliasOf:m=>o.aliases[m],explainLines:()=>null,ask:async()=>{throw new Error("a remote session's questions are asked on its session thread")}}}var Xt=e=>e.added===0?"":e.verb==="design"?`${e.added} added`:`${e.added} ${e.added===1?"use-case":"use-cases"} added`;function On(e,s,n){let o=e.length,i=s.title?`"${s.title}"`:nt(s.id);return[{text:` ${o} other ${o===1?"session is":"sessions are"} open on ${i} \u2014 you can still go ahead`},...Ie(e,n,4)]}function Ie(e,s,n){let o=" ".repeat(n),i=[];for(let l of e){let f=l.owner===null?"":(l.owner==="you"?"yours":"someone else").padEnd(15),j=[Mt[l.state]??l.state,jt(l.lastActivityAt,s),Xt(l)].filter(Boolean);i.push({text:`${o}${f}${j.join(" \xB7 ")}`,dim:!0}),l.owner!=="someone_else"&&(l.state==="ready_to_save"?i.push({text:`${o} save: kane-cli context sessions save ${l.sid}`,dim:!0}):l.state==="paused"&&i.push({text:`${o} resume: ${ie(l.verb==="design"||l.verb==="evolve"?"design":"extract",l.sid,!1)}`,dim:!0}))}return i}var ae=2e3,qt=2*ae,Yt=16;async function $n(e){let s=await xe(e);return s===null?null:s.length===0?P.nothingNewRead.map(n=>({text:n})):[{text:P.nothingNewInSession},...Ie(s,e.now,2)]}function Bt(e){if(e.length===0)return{type:"nothing_new",reason:"every_source_read",next:[{cmd:"kane-cli context ingest <files> --mode agent",why:"add more sources"}]};let s=e.filter(n=>n.owner!=="someone_else").flatMap(n=>n.state==="paused"?[{cmd:`kane-cli context extract --resume ${n.sid} --mode agent`,why:"resume your session"}]:n.state==="ready_to_save"?[{cmd:`kane-cli context sessions save ${n.sid} --yes --mode agent`,why:"save your session"}]:[]);return{type:"nothing_new",reason:"sources_in_a_session",open_sessions:e.map(({sid:n,owner:o,state:i,added:l})=>({sid:n,owner:o,state:i,added:l})),...s.length>0?{next:s}:{}}}async function xe(e){let s,n=new Promise(o=>{s=setTimeout(()=>{e.log?.(`the sources weren't read within ${e.budgetMs??qt} ms; the extract goes on`),o(null)},e.budgetMs??qt)});try{return await Promise.race([Zt(e),n])}catch(o){return e.log?.(`the sources weren't read: ${U(o)}; the extract goes on`),null}finally{clearTimeout(s)}}async function Zt(e){let[s,n]=await Promise.all([e.person.sources(e.projectId),e.person.listSessions(e.projectId)]),o=s.filter(l=>l.head!==null&&!l.sourceId.startsWith(Nt));if(o.length===0||o.some(l=>l.completeness?.sourceCid!==l.head))return null;let i=n.filter(l=>l.verb==="extract");return Rt(e.person,e.projectId,i,e.me,Math.min(Yt,Math.max(1,i.length)))}var Pe=class extends Error{constructor(){super("stopped while the file went up")}},de=class extends Error{constructor(n,o,i){super(n.message);this.refusal=n;this.exit=o;this.detail=i}};async function Sr(){let e=await bt(gt);return{auth:e,preflight:await kt(e)}}var un=500,le=5e3,Ht=6e4,pn=250;function fn(e){let s=e.now-e.pressedAt;if(s>=Ht)return"force";let n=e.saving>0?0:e.now-Math.max(e.quietSince,e.pressedAt);return n>=le?"force":{wait:Math.min(le-n,Ht-s)}}var mn=new Set([k.appendDraft,k.vectorsWrite,k.putBlob,k.chainWrite,k.chainWriteIfAbsent,k.chainRemove,k.filesWrite,k.statePut,k.acknowledge,k.registerChild,k.sideSave]);function gn(){return import.meta.url.endsWith(".ts")?new URL("./session-worker.boot.mjs",import.meta.url):new URL("./session-worker.js",import.meta.url)}function hn(e,s){if(e!=="ingested"||s===null||typeof s!="object")return{kind:e};let n=s,o={kind:e};for(let i of["source_id","status","behind","unread","cursor"])n[i]!==void 0&&(o[i]=n[i]);return o}function vn(e,s){let n=Ze(`remote-${e}`,s);return o=>{try{nn(an(n),{recursive:!0}),tn(n,`${new Date().toISOString()} ${o}
|
|
3
3
|
`)}catch{}}}var w=U;async function wn(e,s,n,o){let i,l;try{[i,l]=await Promise.all([pt(e.person,s,n),e.person.getSession(n)])}catch(f){return o(`the session that added nothing was not discarded: ${w(f)}`),!0}if(ft(i,(l.scope?.position??l.basePosition)>l.basePosition))return!0;try{await e.person.discard(n,e.claim.generation)}catch(f){o(`the session that added nothing was not discarded: ${w(f)}`)}return!1}function yn(e,s){return e===0&&s>0?1:e}async function _r(e){let s={trace:Dt(null,"")},n=1;Se({projectId:e.choice.projectId});try{return n=await bn(e,s),n}finally{s.trace.line("run_end",{code:n}),await lt()}}async function bn(e,s){let n=e.testing??{},o=null,i=new Set,l=r=>{if(r.type!=="session_paused"||e.verb!=="extract"||i.size<2)return r;let{resume:a,held_review:y,next:Y,...$}=r,Z=Ot(e.ingest?.map(ee=>ee.path??ee.file),A?.record??null),G=A?.record.sessionId??String(r.sid);return{...$,sid:G,...Tt(G,Z)}},f=r=>{let a=e.io?At(r,Date.now(),{sourceId:A?.record.sourceId??null,mode:e.mode}):null;a&&e.io.event(l(a)),e.onProgress(o!==null&&r.kind==="load"?{kind:"reading",file:o}:r)},j=e.start.kind==="resume"?e.start.sessionId:null,N=null,m=null,g=null,Ee=!1,ce=null,Ae=[],W=!1,ue=!1,pe=null,fe=!1,A=null,u=n.diagnostics??(()=>{}),C=(r,a={})=>{e.io?e.io.event({type:"error",code:r.code,message:r.message,...ct(r),...r.heldBy?{held_by:ut(r.heldBy)}:{},...r.notAdded?{not_added:r.notAdded}:{},...a}):e.onRefusal?e.onRefusal(r):yt(r)},Gt=r=>{if(!g){if(g=r,e.onEnding?.(),u(`the session's writer was stopped: ${U(r)}`),z(se(r),oe(r)),m?.close(P.stepRefused),r.code==="PROJECT_NOT_MARKED")Ee=!0;else if(r.code==="SESSION_ENDED"||r.code==="SCOPE_NOT_OPEN")pe=r;else{let a=r.code===rt?"resumed_elsewhere":r.code===st?"computer_slept":"connection_lost";W&&a==="connection_lost"?ue=!0:f({kind:"paused",reason:a,sid:A?.record.sessionId??j??""})}setTimeout(()=>{N?.terminate()},le).unref()}},E=!1,S=!1,me=0,ge=new Set,D=0,Ce=!1,J=!1,Oe=()=>{},Kt=new Promise(r=>Oe=r),Te=()=>{E=!0,N?.postMessage({type:"stop"})},Me=()=>{},je=new Promise(r=>Me=r),he=()=>{s.trace.line("run_forced",{}),S=!0,Me(),J&&Oe();let r=N;r?.postMessage({type:"kill"}),setTimeout(()=>{r?.terminate()},pn).unref()},ve=0,Ne=r=>{let a=()=>{if(S||Ce)return;let y=fn({now:Date.now(),pressedAt:r,saving:me+ge.size,quietSince:D});if(y==="force")return he();setTimeout(a,Math.max(50,y.wait)).unref()};setTimeout(a,le).unref()},We=()=>{if(ve+=1,s.trace.line("stop_asked",{by:"ctrl_c",press:ve}),J||ve>1)return he();Te(),Ne(Date.now())};e.onControls?.({pause:()=>{s.trace.line("stop_asked",{by:"pause"}),E=!0,Ne(Date.now())},force:he});let _=!1,De=null,$e=0;if(e.mode==="agent"&&e.io&&e.verb==="extract"&&e.start.kind==="new"&&!e.start.body.sourceId&&!e.run.force&&!e.ingest){let r=await xe({person:re({url:e.choice.latticeUrl,basicAuth:e.basicAuth,requestDeadlineMs:ae,...n.fetch?{fetch:n.fetch}:{}}),projectId:e.choice.projectId,me:vt(process.cwd()),now:Date.now(),log:n.diagnostics??ht("nothing-new")});if(r!==null)return e.io.event(Bt(r)),0}let F=e.io?await tt({event:r=>e.io.event(r)},e.check):await e.check();if(!F.preflight.ok){let{cause:r,final:a}=F.preflight;return u(`the controller's check refused the run: ${F.preflight.message}`),C(P.preflight(r??(a?"rejected":"unreachable")),{final:a}),2}if(S)return 130;let Vt=e.signals?process.listeners("SIGINT"):[],Q=!1,Ue=()=>{!e.signals||Q||(Q=!0,process.removeAllListeners("SIGINT"),process.on("SIGINT",We))},L=()=>{if(Q){Q=!1,process.removeListener("SIGINT",We);for(let r of Vt)process.on("SIGINT",r)}},q=null,X=[];if(e.ingest){Ue();try{for(let a of e.ingest){if(!a.fetch)continue;if(await Promise.race([a.fetch(f).then(()=>!0),je.then(()=>null)])===null||S||E)return L(),130}let r=[];for(let a of e.ingest){if(a.deferred){r.push(null);continue}let y=await Promise.race([a.upload(f,()=>E||S),je.then(()=>null)]);if(y===null||S)return L(),130;r.push(y)}q=r}catch(r){if(L(),r instanceof Pe)return 130;if(!(r instanceof de))throw r;return u(`the upload was refused: ${r.detail??r.message}`),C(r.refusal),r.exit}}try{A=await _t({url:e.choice.latticeUrl,basicAuth:e.basicAuth,start:e.start,...e.choice.projectName?{projectName:e.choice.projectName}:{},onProgress:f,onStopped:Gt,log:r=>u(r),testing:{...n.fetch?{fetch:n.fetch}:{},...n.leaseRenewMs!==void 0?{leaseRenewMs:n.leaseRenewMs}:{},...n.retryDeadlineMs!==void 0?{retryDeadlineMs:n.retryDeadlineMs}:{}}})}catch(r){L(),e.choice.onboarded&&r instanceof ne&&(r.code==="MARK_REFUSED"||r.code==="PROJECT_NOT_MARKED")&&wt(process.cwd());let a=await Rn(r,{latticeUrl:e.choice.latticeUrl,projectId:e.choice.projectId,basicAuth:e.basicAuth,sessionId:j,useCase:e.run.useCase,log:$=>u($),...n.fetch?{fetch:n.fetch}:{}}),{exit:y,...Y}=It(r,e.choice,j,e.verb==="reconcile"?void 0:{verb:e.verb,...(e.verb==="design"||e.verb==="evolve")&&e.run.useCase?{useCase:e.run.useCase}:{},...a!==void 0?{title:a}:{},...e.mode==="agent"?{agent:!0}:{}});return u(`the session could not be opened: ${w(r)}`),r instanceof ne&&z(se(r),oe(r)),C(Y),y}let c=A,p=c.record.sessionId;Se({latticeSessionId:p,projectId:e.choice.projectId});let Fe=e.start.kind==="resume"&&c.record.verb==="reconcile"&&c.record.sourceId!==null,B=Fe?_n({...c.record,sourceId:c.record.sourceId}):null;Fe&&e.io?.retag?.("reconcile");let H=e.start.kind==="resume"&&c.record.verb==="evolve";H&&e.io?.retag?.("evolve");let Le=H?Sn(c.log.since(0)):void 0;if(H)for(let[r,a]of _e(c.log.since(0)))e.onRepinned?.(r,a);n.diagnostics||(u=vn(e.verb,p)),s.trace=$t(e.traceVerb??e.verb,ke()),s.trace.path&&Ut(p,s.trace.path),s.trace.line("run_open",{sid:p,verb:e.verb,start:e.start.kind,mode:e.mode??"interactive",cli_version:Ye,env:et(),project_id:e.choice.projectId});{let r=u;u=a=>{r(a),s.trace.line("diag",{line:a})}}let qe=rn(dn(on(),"kane-remote-session-")),we=[],Be=!1;Ue();let He=async()=>{if(!(!e.ingest||q===null))for(let[r,a]of e.ingest.entries())X[r]||(X[r]=!0,await a.cancel(p).catch(y=>u(`the upload's cancel was not posted: ${w(y)}`)))},ye=()=>(e.start.kind==="new"?c.person.discard(p,c.claim.generation):c.person.setStatus(p,"paused")).then(()=>{},r=>u(`the unstarted session was not put away: ${w(r)}`)),Ge=async()=>(await c.person.setStatus(p,"paused").catch(r=>u(`the pause was not recorded: ${w(r)}`)),f({kind:"not_ended",sid:p,project:e.choice.projectName}),1),Ke=async()=>{let r=await c.person.getSession(p).then(y=>y.scope?.state,()=>null);return f({kind:"ended",reason:r==="finalized"?"saved_elsewhere":r==="discarded"?"discarded_elsewhere":"ended_elsewhere",sid:p}),0},zt=async()=>{let r=await c.client.sessionState().catch(a=>(u(`the session's state couldn't be read: ${w(a)}`),null));return r===null||typeof r.completed_at!="string"?null:r.ended?.ended==="failed"?"failed":"complete"};try{if(S)return await He(),await ye(),130;try{e.onOpened?.(c.record,d=>u(d))}catch(d){u(`the folder's project link could not be updated: ${w(d)}`)}let r=e.start.kind==="resume"?await zt():null;if(r!==null){J=!0,W=!0;try{await c.state.end(p,{state:r,panel:null,error:null,checkIn:!1,phase:null,child:null,pausing:!1})}catch(d){return u(`the ending was not recorded: ${w(d)}`),pe?await Ke():g&&!ue?3:await Ge()}return r==="failed"?(C(P.sessionFailed(p)),2):(f({kind:"finished_before",sid:p}),0)}let a=0,y=async(d,b)=>{let T=mn.has(d),v=String(b?.childId??"");d===k.chainWrite&&/^(delta|full)-\d+\.json$/.test(String(b?.name))&&ge.add(v),T&&(me+=1,D=Date.now());let R=d===k.appendDraft,K;R&&(a+=1,e.onWrites?.(a),K=setTimeout(()=>f({kind:"write",pending:a}),300));try{return await c.storeCalls(d,b)}catch(I){throw u(`${d} was refused: ${w(I)}`),I instanceof ot?I:(z(se(I),oe(I)),I instanceof dt&&!g&&(fe=!0,e.onEnding?.()),it(new Error(P.stepRefused),I))}finally{d===k.acknowledge&&ge.delete(v),T&&(me-=1,D=Date.now()),R&&(clearTimeout(K),a-=1,e.onWrites?.(a),a===0&&f({kind:"write",pending:0}))}},{port1:Y,port2:$}=new ln,Z=new SharedArrayBuffer(4);m=at({port:Y,signal:Z},y);let G=H||e.verb==="evolve"?await kn(re({url:e.choice.latticeUrl,basicAuth:e.basicAuth,requestDeadlineMs:ae,...n.fetch?{fetch:n.fetch}:{}}),e.choice.projectId,u):void 0,ee={verb:B?"reconcile":H?"evolve":e.verb,traceVerb:e.traceVerb??e.verb,mode:e.mode,sessionId:p,fresh:e.start.kind==="new",generation:c.claim.generation,projectDir:process.cwd(),projectName:e.choice.projectName,projectId:e.choice.projectId,sideDir:qe,bridge:{port:$,signal:Z},lastEventSeq:c.log.lastSeq(),run:e.start.kind==="resume"?{...e.run,resume:p,...Le!==void 0?{kept:Le,...c.record.useCase?{useCase:c.record.useCase}:{}}:{}}:e.run,...e.start.kind==="resume"&&e.verb==="extract"?{landed:[...new Set((c.record.uploads??[]).filter(d=>d.outcome!=="refused").map(d=>d.sourceId))]}:{},auth:F.auth,preflight:F.preflight,supportId:ke(),...n.agent||n.remoteDeps||n.sourcePlugins||n.refuseCard?{testing:{...n.agent?{agent:n.agent}:{},...n.remoteDeps?{remoteDeps:n.remoteDeps}:{},...n.sourcePlugins?{sourcePlugins:n.sourcePlugins}:{},...n.refuseCard?{refuseCard:n.refuseCard}:{}}}:{},...e.ingest&&q?{ingest:e.ingest.map((d,b)=>({bytes:new Uint8Array(d.bytes),file:d.file,sourceId:d.sourceId,fingerprint:q[b]?.fingerprint??"",then:d.then,...d.remote?{remote:d.remote}:{},...d.plugin?{plugin:d.plugin}:{}}))}:{},...B?{review:B}:{},...G?{origins:G}:{}},Ve=()=>e.io?.event({type:"error",message:P.runStopped(e.verb)}),O=await new Promise(d=>{let b=!1,T=t=>{b||(b=!0,d(t))},v;try{v=new cn(n.workerUrl??gn(),{workerData:ee,transferList:[$]})}catch(t){return u(`the session thread could not start: ${w(t)}`),Ve(),T(1)}N=v,E&&v.postMessage({type:"stop"});let R=e.ingest?.[0],K=R?.remote?Pt({...R.remote,address:R.remote.origin.url},Re(R.remote.provider,R.remote.origin.url,R.sourceId)):void 0,I=B??(e.verb==="reconcile"&&R?{sourceId:R.sourceId,file:R.path??R.file,...K?{page:K}:{}}:null);if(e.onReview&&I){let t=Wt(v),x={source:I.sourceId,file:I.file,...I.page?{page:I.page}:{}};e.onReview(t,x);let h=!1;v.on("message",V=>{if(h||V.type!=="reviewMirror"||!V.review.named)return;h=!0;let M=xt(x,V.review.named);M&&e.onReview(t,M)})}e.ingest&&(o=e.ingest[0].file,f({kind:"reading",file:o})),n.terminateOnHold?.then(()=>v.terminate());let Qe=!0,Xe=!1;v.on("message",t=>{if(t.type==="mirror"&&E&&t.state.nestedAgent===!0&&(D=Date.now()),t.type==="mirror"&&!Xe)Xe=!0,e.onController?.(Lt(v,{state:t.state,view:t.view}));else if(t.type==="event"){if(E&&t.event.child_id!==void 0&&(D=Date.now()),(fe||g)&&t.event.type==="error")return u(`after the run paused: ${String(t.event.message??"")}`);if(e.start.kind==="resume"&&t.event.type==="error"&&mt.has(String(t.event.code??"")))return ce=String(t.event.code),u(`the resume was refused: ${String(t.event.message??"")}`);if(t.event.type==="held"&&e.onHeld?.(Number(t.event.count)||0),t.event.type==="session_complete"&&e.mode==="agent"||(t.event.type==="source_start"&&i.add(String(t.event.source_id)),t.event.type==="child_start"?we.push({child:t.event.child,at:Date.now()}):t.event.type==="child_end"?we.pop():t.event.type==="session_paused"&&t.event.child_id===void 0&&(Be=!0),t.event.type==="run_start"&&t.event.child_id!==void 0))return;e.io?.event(l(t.event.type==="run_start"?{type:"run_start",session:p}:t.event.type==="session_paused"&&t.event.held!==void 0?{...t.event,reason:"held_back"}:t.event.type==="held"&&t.event.reason==="embed_degraded"?{...t.event,reason:"duplicate_check_reduced"}:t.event.type==="held"&&t.event.reason==="reconcile"?{...t.event,reason:"review"}:t.event)),(Qe&&n.stopAfterFirstEvent||!E&&t.event.type===n.stopAtEvent)&&Te(),Qe=!1}else if(t.type==="summary")e.onSummary?.(t.facts);else if(t.type==="notUpdated")e.onNotUpdated?.(t.useCases,t.titles,t.stillStale);else if(t.type==="unstarted")_=!0;else if(t.type==="needed")Ae=t.needed.noStartPage.map(({test:x})=>({test:x})),e.onNeeded?.({needed:t.needed,tests:t.tests});else if(t.type==="preMount")(e.onPreMount?e.onPreMount(t.question):Promise.resolve({go:!1,code:2})).then(x=>{!x.go&&t.question.kind!=="evolve-entry"&&t.question.kind!=="lines"&&(_=!0),v.postMessage({type:"preMountAnswer",answer:x})});else if(t.type==="ingestFetched"){let x=e.ingest[t.index];x.bytes=Buffer.from(t.bytes),x.upload(f,()=>E||S).then(h=>{q[t.index]=h,v.postMessage({type:"ingestUploaded",index:t.index,ok:!0,fingerprint:h.fingerprint})},h=>{h instanceof de?(u(`the upload was refused: ${h.detail??h.message}`),C(h.refusal),De=h.exit):u(`the fetched item's upload failed: ${w(h)}`),X[t.index]=!0,_=!0,v.postMessage({type:"ingestUploaded",index:t.index,ok:!1})})}else if(t.type==="ingestOutcome"){let{type:x,index:h,...V}=t;X[h]=!0,e.ingest[h].result(V,p,u).then(M=>{M?e.ingest[h+1]&&(o=e.ingest[h+1].file,f({kind:"reading",file:o})):(_=!0,o=null),v.postMessage({type:"ingestGo",index:h,go:M})},M=>{u(`the upload's result was not posted: ${w(M)}`),_=!0,v.postMessage({type:"ingestGo",index:h,go:!1})})}else if(t.type==="ingested")o=null,e.verb==="reconcile"&&t.status==="unchanged"&&!t.behind&&!t.unread&&(_=!0),e.ingest?.[t.index]?.onAdded?.(t.status,p,{...t.duplicateOf?{duplicateOf:t.duplicateOf}:{},...t.attachments?{attachments:t.attachments}:{},...t.behind?{behind:t.behind}:{},...t.unread?{unread:!0}:{}});else if(t.type==="ingestUnwritten")o=null,_=!0,e.ingest?.[t.index]?.onUnwritten?.(p);else if(t.type==="sessionEvent"){E&&t.payload.child_id!==void 0&&(D=Date.now()),c.log.append(t.kind,t.payload),s.trace.line("session_event",hn(t.kind,t.payload));for(let[x,h]of _e([t]))e.onRepinned?.(x,h)}else t.type==="itemsFailed"?$e+=t.count:t.type==="out"?e.io?.out(t.line):t.type==="log"?u(t.line):t.type==="done"&&T(De??t.code)}),v.on("error",t=>{u(`the session thread failed: ${t instanceof Error&&t.stack?t.stack:w(t)}`),z("thread_crash"),Ve(),T(1)}),v.on("exit",()=>{s.trace.line("thread_exit",{stopped:g!==null,forced:S}),T(g?3:S?130:1)})});J=!0;let ze=e.ingest?.[0]?.then==="pause";W=O===0&&!_&&!ze;let te=O!==0||_,Jt=fe&&!g&&!S&&O!==0&&!_,be=!1,Qt=async()=>{await He(),_?(await c.log.flush().catch(()=>{}),await ye()):O!==0&&!g&&await c.person.setStatus(p,"paused").catch(d=>u(`the pause was not recorded: ${w(d)}`)),await c.log.flush(),!g&&O===0&&!_&&(ze?await c.person.setStatus(p,"paused"):await c.state.end(p,{state:"complete",panel:null,error:null,checkIn:!1,phase:null,child:null,pausing:!1}),te=!0),be=!0};await Promise.race([Qt().catch(d=>u(`the run's ending was not recorded: ${w(d)}`)),Kt]);let Je=!0;if(e.mode==="agent"&&be&&W&&te&&!g&&!S&&(Je=await wn(c,e.choice.projectId,p,u)),S&&!be&&!g){let d=_?ye():c.person.setStatus(p,"paused").catch(b=>u(`the pause was not recorded: ${w(b)}`));await Promise.race([d,new Promise(b=>setTimeout(b,un).unref())])}if(Ee)return C(P.assuranceOff(e.choice.projectName)),2;if(ce!==null)return C(P.resumeUnreadable(ce,p,e.verb==="design"?"design":"extract",c.record.useCase)),2;if(pe)return await Ke();if(S){if(e.mode!=="agent"||g||_)return 130;if(Be)return 3;for(let b of we.splice(0).reverse())e.io?.event({type:"child_end",child:b.child,ok:!1,dur_s:Math.max(1,Math.round((Date.now()-b.at)/1e3)),exit_code:3});let d=ie(e.verb==="design"&&!B?"design":"extract",p,!0);return e.io?.event(l({type:"session_paused",sid:p,...c.record.sourceId?{source_id:c.record.sourceId}:{},mode:"agent",resume:d,expires_at:null,pending_questions:[],next:[{cmd:d,why:"resume"}]})),3}return ue||W&&!te&&!g?await Ge():g?3:Jt?(f({kind:"paused",reason:"not_accepted",sid:p}),3):te?(e.mode==="agent"&&W&&O===0&&e.io?.event(Ct(p,Je,{sourceId:A?.record.sourceId??null,noStartPage:Ae})),yn(O,$e)):(f({kind:"paused",reason:"connection_lost",sid:p}),3)}finally{Ce=!0,L(),c.release(),m?.close("the session ended"),await N?.terminate(),sn(qe,{recursive:!0,force:!0})}}async function kn(e,s,n){try{return Object.fromEntries((await e.sources(s)).map(o=>[o.sourceId,o.origin?.url??null]))}catch(o){return n(`the project's sources were not read: ${w(o)}`),{}}}function Sn(e){let s=e.filter(i=>i.kind==="evolve_answers").at(-1)?.payload,n=s?.request;if(!n||!Array.isArray(s?.answers))return"unread";let o=s.answers.flatMap(i=>typeof i.id=="string"&&(i.choice==="proceed"||i.choice==="decline")?[{id:i.id,choice:i.choice}]:[]);return{request:{...typeof n.ref=="string"?{ref:n.ref}:{},fromStale:n.fromStale===!0,...typeof n.because=="string"?{because:n.because}:{}},answers:o}}function _n(e){let s=[...e.uploads??[]].reverse().find(n=>n.sourceId===e.sourceId&&n.outcome!=="refused"&&(n.filename||n.originUrl));if(s&&!s.filename&&s.originUrl){let n=s.originUrl,o=St(n)?.name??"web";return{sourceId:e.sourceId,file:n,page:Et(o,n,void 0,Re(o,n,e.sourceId))}}return{sourceId:e.sourceId,file:s?.filename??"<file>"}}async function Rn(e,s){if(!(e instanceof ne)||e.code!=="SESSION_CLASH")return;let n=e.extra.heldBy;if(n?.verb!=="design"&&n?.verb!=="evolve")return;let o=re({url:s.latticeUrl,basicAuth:s.basicAuth,...s.fetch?{fetch:s.fetch}:{}});try{if(s.sessionId!==null)return(await o.getSession(s.sessionId)).useCaseTitle??null;if(!s.useCase)return null;let i=(await o.mainNode(s.projectId,s.useCase)).content.title;return typeof i=="string"&&i!==""?i:null}catch(i){return s.log(`the use case's title couldn't be read for the lock's words, so they name its id: ${U(i)}`),null}}export{On as a,ae as b,$n as c,Pe as d,de as e,Sr as f,fn as g,mn as h,hn as i,yn as j,_r as k};
|
|
@@ -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 m,b as o}from"./chunk-33DWJV67.js";import{z as i}from"./chunk-
|
|
2
|
+
import{a as s}from"./chunk-HCBYKLMW.js";import{a as m,b as o}from"./chunk-33DWJV67.js";import{z as i}from"./chunk-J4FIESTB.js";import{e as x}from"./chunk-UR6MHSHU.js";var t=x(s(),1);function d({label:r,text:c,accent:a,color:n,width:l=15}){return(0,t.jsxs)(o,{children:[(0,t.jsx)(o,{color:i.dim,children:` ${r.padEnd(l)}`}),(0,t.jsx)(o,{color:n??(a?i.assuranceAccent:void 0),children:c})]})}function u({head:r,rows:c,minWidth:a=15}){let n=c.filter(e=>e.text),l=Math.max(a,...n.map(e=>e.label.length+2));return(0,t.jsxs)(m,{flexDirection:"column",children:[r?(0,t.jsx)(o,{bold:!0,children:r}):null,n.map((e,p)=>(0,t.jsx)(d,{label:e.label,text:e.text,color:e.color,width:l},p))]})}export{d as a,u as b};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as O}from"./chunk-QSCXXNC2.js";import{a as k,b as P}from"./chunk-6PIIUAZF.js";import{b as A}from"./chunk-VO66KP2W.js";import{n as L}from"./chunk-G4K3TP2I.js";import{a as b,b as R,c as x,d as y,e as T,g as I,h as f}from"./chunk-UJLULWSR.js";import{d as w,g as p}from"./chunk-ZCRZFAOT.js";import{a as v}from"./chunk-RZ4F3BHX.js";import{a as m,i as S}from"./chunk-
|
|
2
|
+
import{a as O}from"./chunk-QSCXXNC2.js";import{a as k,b as P}from"./chunk-6PIIUAZF.js";import{b as A}from"./chunk-VO66KP2W.js";import{n as L}from"./chunk-G4K3TP2I.js";import{a as b,b as R,c as x,d as y,e as T,g as I,h as f}from"./chunk-UJLULWSR.js";import{d as w,g as p}from"./chunk-ZCRZFAOT.js";import{a as v}from"./chunk-RZ4F3BHX.js";import{a as m,i as S}from"./chunk-J4FIESTB.js";var h=class{config;buffer=[];stepBuffer=new Map;flushTimer=null;currentRunIndex=null;stopped=!1;_inFlightFlush=null;_stoppingFast=!1;_droppedBatches=0;_droppedEntries=0;constructor(e){this.config=e}start(){if(this.flushTimer)return;let e=this.config.flushIntervalMs??5e3;this.flushTimer=setInterval(()=>{this.flush().catch(()=>{})},e),this.flushTimer.unref&&this.flushTimer.unref()}setRunIndex(e){this.currentRunIndex=e}log(e,t,n,s={}){if(this.stopped)return;let o=this.buildEntry(e,t,n,s);this.buffer.push(o)}logStep(e,t,n,s={}){if(this.stopped)return;let o=this.buildEntry("debug",t,n,s);o.run_index=e,this.stepBuffer.has(e)||this.stepBuffer.set(e,[]),this.stepBuffer.get(e).push(o)}escalate(e){let t=this.stepBuffer.get(e);t&&t.length>0&&this.buffer.push(...t),this.stepBuffer.delete(e)}discardSteps(e){this.stepBuffer.delete(e)}async flush(){if(this.buffer.length===0)return;let e=this._flushBody();this._inFlightFlush=e;try{await e}finally{this._inFlightFlush===e&&(this._inFlightFlush=null)}}async _flushBody(){let e=this.buffer.splice(0),t=null;try{t=await this.config.getToken()}catch{this.buffer.unshift(...e);return}let n={"Content-Type":"application/json"};t&&(n.Authorization=`Bearer ${t}`);let s=JSON.stringify(e);for(let o=0;o<3;o++){try{let l=new AbortController,a=setTimeout(()=>l.abort(),1e4),c=await v(this.config.proxyUrl,{method:"POST",headers:n,body:s,signal:l.signal});if(clearTimeout(a),c.ok)return}catch{}if(this._stoppingFast){this.buffer.unshift(...e);return}o<2&&await new Promise(l=>setTimeout(l,1e3*Math.pow(2,o)))}this._droppedBatches++,this._droppedEntries+=e.length}async flushOnce(e){if(this.buffer.length===0)return"empty";let t=this.buffer.splice(0),n=Date.now()+e,s=!1,o,l=null;try{l=await Promise.race([this.config.getToken(),new Promise(d=>{o=setTimeout(()=>{s=!0,d(null)},e),o.unref&&o.unref()})])}catch{l=null}finally{o&&clearTimeout(o)}let a=n-Date.now();if(s||a<=0)return this.buffer.unshift(...t),"timeout";let c={"Content-Type":"application/json"};l&&(c.Authorization=`Bearer ${l}`);try{let d=new AbortController,u=setTimeout(()=>d.abort(),a);u.unref&&u.unref();let r=await v(this.config.proxyUrl,{method:"POST",headers:c,body:JSON.stringify(t),signal:d.signal});return clearTimeout(u),r.ok?"sent":(this.buffer.unshift(...t),"failed")}catch{return this.buffer.unshift(...t),Date.now()>=n?"timeout":"failed"}}async stopAndFlushOnce(e){let t=Date.now()+e;this._stoppingFast=!0,this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null);let n=this._inFlightFlush;if(n){let o;await Promise.race([n.catch(()=>{}),new Promise(l=>{o=setTimeout(l,e),o.unref&&o.unref()})]),o&&clearTimeout(o)}if(this.buffer.length===0)return"empty";let s=t-Date.now();if(s<=0)return"timeout";try{return await this.flushOnce(s)}catch{return"failed"}}drainBuffer(){return this.buffer.splice(0)}get droppedBatches(){return this._droppedBatches}get droppedEntries(){return this._droppedEntries}async shutdown(){this._droppedBatches>0&&this.log("warn","LOG_DROPS",`Dropped ${this._droppedEntries} entries in ${this._droppedBatches} batches`,{dropped_batches:this._droppedBatches,dropped_entries:this._droppedEntries}),this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),await this.flush()}shutdownSync(){this.stopped=!0,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null)}get bufferSize(){return this.buffer.length}stepBufferSize(e){return this.stepBuffer.get(e)?.length??0}buildEntry(e,t,n,s){return{hostname:"kane-cli",service:"kane-cli",ddsource:"kane-cli",ddtags:`version:${this.config.device.cli_version}`,level:e,event:t,message:n,session_id:this.config.sessionId,run_index:t.startsWith("tcg_")?null:this.currentRunIndex,identity:this.config.identity,device:this.config.device,context:s,timestamp:new Date().toISOString()}}};import{platform as $,arch as V}from"os";import M from"fs";import B from"fs";import U from"path";var F=1e3,_=0,j=new Set([130,3]),g=class i{ids;logger;opts;ended=!1;createdAt=Date.now();errorState;constructor(e,t={emitted:!1}){this.ids=e.envelope,this.logger=e.logger,this.opts=e,this.errorState=t}get enabled(){return this.logger!==null}event(e,t={}){if(!this.logger)return;e==="ASR_ERROR"&&(this.errorState.emitted=!0);let n=y(this.ids,e,t);this.logger.log(x[e],e,e,C(n))}error(e,t={}){this.logger&&(this.logger.escalate(_),this.event("ASR_ERROR",{...t,error_code:e}))}child(e,t){return new i({...this.opts,envelope:{...this.ids,operation_id:t,parent_operation_id:this.ids.operation_id,verb:"design"}},this.errorState)}async lateBindContext(e){if(!(!this.logger||this.ids.context_instance_id))try{let{ensureStoreIds:t}=await import("./store-id-YZ5WKJ25.js"),{ids:n,cloned:s}=t(e,p());this.ids.context_lineage_id=n.context_lineage_id,this.ids.context_instance_id=n.context_instance_id,s&&this.event("ASR_CONTEXT_CLONED")}catch{}}spoolError(e,t={}){this.logger&&(this.event("ASR_ERROR",{...t,error_code:e}),T(this.logger.drainBuffer()))}agentSession(e){this.ids.agent_session_id=e}spawnEnv(){if(!this.opts.telemetryEnabled)return{};let e={TESTMUAI_USER_SESSION_ID:this.ids.session_id,TESTMUAI_OPERATION_ID:this.ids.operation_id,TESTMUAI_CLIENT_VERSION:this.opts.clientVersion,TESTMUAI_TELEMETRY_PROXY_URL:this.opts.proxyUrl};return this.ids.context_instance_id&&(e.TESTMUAI_CONTEXT_INSTANCE_ID=this.ids.context_instance_id),e}traceTee(){return e=>{if(!this.logger)return;let t=typeof e.kind=="string"?e.kind.slice(0,64):"trace",n={...C(y(this.ids,"ASR_CMD_START",{})),trace_kind:t};typeof e.code=="string"&&(n.trace_code=e.code.slice(0,64)),delete n.event,this.logger.logStep(_,`trace_${t}`,t,n)}}wireTrace(e,t,n){if(!this.logger)return;n&&this.agentSession(n);let s=t&&typeof t=="object"?t:{};switch(e){case"spawn":this.event("ASR_AGENT_SPAWN",{tier:s.tier});break;case"session_paused":this.event("ASR_SESSION_PAUSED",s);break;case"commit":this.event("ASR_COMMIT",s);break;case"design_phase_committed":this.event("ASR_COMMIT",{phase:s.phase,duration_ms:s.ms});break;default:this.traceTee()({kind:e,code:typeof s.code=="string"?s.code:void 0})}}banner(){return`session: ${this.ids.session_id}`}supportFooter(){return`if this keeps failing, share this id with support: ${this.ids.session_id}`}async end(e){if(!this.ended){if(this.ended=!0,e.duration_ms===void 0&&(e={...e,duration_ms:Date.now()-this.createdAt}),this.logger)if(e.exit_code===0?this.logger.discardSteps(_):this.logger.escalate(_),e.exit_code>0&&!j.has(e.exit_code)&&!this.errorState.emitted&&this.event("ASR_ERROR",{error_code:e.exit_code===2?"usage_exit_unattributed":`exit_${e.exit_code}_unattributed`,exit_code:e.exit_code}),this.event("ASR_CMD_END",e),this.opts.longSession)await this.logger.shutdown();else{let t=await this.logger.flushOnce(F);(t==="failed"||t==="timeout")&&T(this.logger.drainBuffer())}this.logger&&this.writeManifestLine(e.exit_code),f(null)}}writeManifestLine(e){try{let t=w(this.ids.context_instance_id??null);B.mkdirSync(U.dirname(t),{recursive:!0});let n={ts:new Date().toISOString(),session_id:this.ids.session_id,operation_id:this.ids.operation_id,agent_session_id:this.ids.agent_session_id,verb:this.ids.verb,mode:this.ids.mode,exit_code:e};B.appendFileSync(t,JSON.stringify(n)+`
|
|
3
3
|
`,{flag:"a",mode:384})}catch{}}};function C(i){let e={event:i.event,session_id:i.session_id,operation_id:i.operation_id,verb:i.verb,mode:i.mode,component:i.component,seq:i.seq,context_lineage_id:i.context_lineage_id,context_instance_id:i.context_instance_id};i.parent_operation_id&&(e.parent_operation_id=i.parent_operation_id),i.agent_session_id&&(e.agent_session_id=i.agent_session_id),i.lattice_session_id&&(e.lattice_session_id=i.lattice_session_id),i.project_id&&(e.project_id=i.project_id);for(let[t,n]of Object.entries(i.context))e[t]=n;return e}import{isMainThread as X}from"worker_threads";var E=()=>process.env.KANE_TELEMETRY_URL||S;function Y(){return process.env.TESTMUAI_BASE_URL?"custom":process.env.TESTMUAI_ENV==="stage"?"stage":"prod"}function z(){return process.env.KANE_TELEMETRY!=="0"&&(!process.env.VITEST||process.env.KANE_TELEMETRY==="1")}function me(i){let e=z(),t=i.env??Y(),n=i.sessionId??null;if(!n&&i.resumeSid&&i.contextRoot)try{let r=L(i.contextRoot,i.resumeSid);r?.user_session_id&&(n=r.user_session_id)}catch{}if(!n&&i.applyPlanPath)try{let r=JSON.parse(M.readFileSync(i.applyPlanPath,"utf8"));r.telemetry?.user_session_id&&(n=r.telemetry.user_session_id)}catch{}let s=i.sessionId===void 0?n!==null:i.resumeSid!==void 0;n||(n=b());let o=null,l=null,a=!1;if(i.contextRoot&&M.existsSync(i.contextRoot))if(i.write&&e){let r=P(i.contextRoot,p());o=r.ids.context_lineage_id,l=r.ids.context_instance_id,a=r.cloned}else{let r=k(i.contextRoot);o=r?.context_lineage_id??null,l=r?.context_instance_id??null}let c={session_id:n,operation_id:R(),context_lineage_id:o,context_instance_id:l,...i.remote?{lattice_session_id:i.remote.sessionId,project_id:i.remote.projectId}:{},verb:i.verb,mode:i.mode,component:"kane-cli"},d=null;if(e){let r=A(t),N={org_id:r.org_id??"",user_id:r.user_id??"",machine_id:r.machine_id,email:null,email_domain:"",user_type:r.user_type??"unknown",env:r.env,plan:r.plan??"unknown"},D=i.mode==="interactive"||i.mode==="cli"?"cli":"agent";d=new h({proxyUrl:E(),sessionId:n,identity:N,device:{cli_version:m,platform:$(),arch:V(),host_agent:O(),invocation_mode:D},getToken:async()=>null}),i.longSession&&d.start()}let u=new g({envelope:c,logger:d,longSession:!!i.longSession,proxyUrl:E(),clientVersion:`kane-cli/${m}`,telemetryEnabled:e});return e&&!i.errorsOnly&&(f(c),u.event("ASR_CMD_START",{resumed:s,applied_plan:!!i.applyPlanPath}),a&&u.event("ASR_CONTEXT_CLONED"),X&&I(E()).catch(()=>{})),u}export{h as a,F as b,E as c,Y as d,z as e,me as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as G,f as K,h as j}from"./chunk-
|
|
2
|
+
import{d as G,f as K,h as j}from"./chunk-2TK4MDF2.js";import{a as q,b as z,d as V,e as H}from"./chunk-KL7XFNSD.js";import{a as J,b as y,c as Q}from"./chunk-LPJKNX6D.js";import{a as N,b as L,c as O}from"./chunk-RNHSULQM.js";import{d as B,f as $}from"./chunk-C4KAPGBS.js";import{a as E}from"./chunk-MMBBQ4OZ.js";import{b as R,c as I,j as U}from"./chunk-NRAPCFI2.js";import{a as F}from"./chunk-TZXXJWHA.js";import{e as S}from"./chunk-Z7S3IWUX.js";import{n as h}from"./chunk-UJLULWSR.js";import{b as _,r as C,s as P}from"./chunk-A7RJQJNT.js";function W(e){return e.kind==="simulator"?e.id:e.virtualName??e.id}function X(e,r,o={}){let t={platform:e.platform,udid:e.id,target:e.kind};return r&&(t.app_package=r),o.noReset!==void 0&&(t.no_reset=o.noReset),o.appiumUrl&&(t.appium_url=o.appiumUrl),e.platform==="android"&&o.autoGrantPermissions!==void 0&&(t.auto_grant_permissions=o.autoGrantPermissions),e.platform==="ios"&&o.autoAcceptAlerts!==void 0&&(t.auto_accept_alerts=o.autoAcceptAlerts),t}function Y(e=process.env){let r=e.KANE_APPIUM_URL?.trim();return r||null}function m(e){return`${e.platform}|${W(e)}`}var g=new Map,Z=new Set;function ee(e){return Z.has(m(e))}function ye(e,r,o){r.state==="stopped"&&(g.has(m(r))||oe(e,r,o))}async function re(e,r,o){let t=g.get(m(r));return t?(o?.(`waiting for ${r.displayName} to finish booting\u2026`),t):oe(e,r,o)}function oe(e,r,o){let t=m(r),a=e.prepare(r,o);g.set(t,a),r.state==="stopped"&&a.then(()=>Z.add(t),()=>{});let n=()=>{g.get(t)===a&&g.delete(t)};return a.then(n,n),a.catch(()=>{}),a}import{basename as le}from"path";import{spawnSync as pe}from"child_process";async function de(e,r,o){if(!e.teardownPlan||!o.appPackage&&!o.shutdown)return;let t;try{t=await e.teardownPlan(r,o)}catch{return}t.length!==0&&h(`device:${r.id}`,()=>{G({udid:r.id,displayName:r.displayName});for(let a of t)try{pe(a.file,a.args,{timeout:3e4,stdio:"ignore"})}catch{}})}var te={emulator:[".apk"],simulator:[".zip"]};async function ce(e,r,o,t){if(e.kind==="package")return e;if(e.kind==="app_id"){let a=r.cloudUpload;if(!a)throw new Error(`${e.value} is an app id, which needs an account to download it. Log in, or pass a path to a local build instead.`);let n=await Q({appId:e.value,baseUrl:a.baseUrl,auth:a.auth,...te[o]?{accepts:te[o]}:{},...t?{onProgress:t}:{}}),s=x(n.path);if(!s||s.kind==="app_id")throw new Error(`${n.name} is not a build this CLI can install (from ${e.value}).`);return s}try{let a=new q,n=await V(e.value,a),s=new J;await s.find(n)||t?.(`copying ${le(e.value)} into the local app store\u2026`);let i=await s.put({key:n,sourcePath:e.value,source:"local"});return{...e,value:i.path}}catch{return e}}function ue(e){h(`appium:${e}`,()=>{j({deviceClass:e,owner:process.pid})})}var k=class extends Error{constructor(r){super(r),this.name="MobileHostUnsupportedError"}},v=class extends Error{constructor(o,t){super(o);this.doctorText=t;this.name="MobilePreflightError"}};async function ge(e,r,o){let t=o.cloudUpload,a=await H({path:e,type:r,env:t.env,orgId:t.orgId,userId:t.userId,auth:t.auth,baseUrl:t.baseUrl,...o.onProgress?{onProgress:o.onProgress}:{}});if(z(a)){o.onProgress?.(`app not uploaded \u2014 ${a.reason}`);return}return a.appId}var fe="app must be a build (.apk for an emulator, .zip of the .app bundle for a simulator) or an app id from your cloud uploads \u2014 a package id names something already installed on one device, so it cannot be uploaded, exported as code, or run anywhere else.",ae=C(_);function x(e){let r=e.trim();if(y(r))return{kind:"app_id",value:r};let o=P(r,ae);return o?{kind:o.slice(1),value:r}:null}function me(e){return!!e&&(P(e,ae)!==void 0||y(e.trim()))}function ve(e){return e.filter(r=>r.required&&r.status==="fail")}function be(e,r){return!!r&&S(e,r)}async function Ke(e){let r=F();if(!r.supported)throw new k(r.reason);let o=Y()??e.appiumUrl??e.defaults?.appium_url,t=!!(e.agent||!e.interactive),a=U(),n=!!E();t&&e.platform?.toLowerCase()!=="ios"&&!n&&((await a.status("emulator")).installed||await a.ensure("emulator",{automatic:!0,onProgress:e.onProgress}));let s=await N(e.platform,{appiumUrl:o});if(O(s)){let l=s.sections.flatMap(w=>ve(w.checks)).map(w=>w.label).join(", ");throw new v(`Mobile toolchain not ready (${l}). Run \`kane-cli doctor --target ${e.platform?.toLowerCase()==="ios"?"simulator":e.platform?.toLowerCase()==="android"?"emulator":"<emulator|simulator>"}\` for details.`,L(s))}let p=await $({device:e.device,platform:e.platform,defaultTarget:e.defaults?.default_target,interactive:e.interactive}),i;if(p.ok)i=p.target;else if(p.reason==="needs-picker"&&e.pickTarget){let l=await e.pickTarget(p.candidates);if(!l)throw new Error("Target selection cancelled");i=l}else throw new Error(p.message);let u=B(i.platform);if(!u)throw new Error(`No provider for platform "${i.platform}"`);let d=R(i);if(!d)throw new Error(`No managed dependencies serve ${i.platform} ${i.kind} targets yet.`);if(!(n&&i.platform.toLowerCase()==="android"))try{await a.ensure(d,{automatic:t,onProgress:e.onProgress})}catch(l){throw l instanceof I?new v(l.message,l.message):l}let ie=i.state!=="ready"||ee(i);i=await re(u,i,e.onProgress);let ne=await K(d,{...o?{appiumUrl:o}:{},device:{udid:i.id,displayName:i.displayName},onProgress:e.onProgress});ue(d);let D=be(i,e.defaults?.default_target)?e.defaults?.default_app:void 0,f=e.app??(me(D)?D:void 0);if(e.app&&!x(e.app))throw new Error(`${e.app}: ${fe}`);let c=f?x(f):null,M=c?await ce(c,e,d,e.onProgress):null,b=M?await u.ensureApp(i,M,e.onProgress):void 0,T=c?.kind==="app_id"?c.value:e.cloudUpload&&c&&f?await ge(c.value,d,e):void 0;await de(u,i,{shutdown:ie,...b?{appPackage:b}:{}});let se=X(i,b,{noReset:e.noReset??e.defaults?.no_reset,appiumUrl:ne.url,autoGrantPermissions:e.defaults?.auto_grant_permissions,autoAcceptAlerts:e.defaults?.auto_accept_alerts}),A=T??f;return{device:se,target:i,provider:u,...T?{appId:T}:{},...A?{appRef:A}:{}}}export{W as a,X as b,ye as c,re as d,k as e,v as f,fe as g,x as h,me as i,Ke as j};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-
|
|
2
|
+
import{c as k}from"./chunk-RFHMDQXZ.js";import{a as b}from"./chunk-PCQK62MP.js";import{a as C}from"./chunk-TM45NPWL.js";import{r as m,s as u,t as f,u as x,v as y}from"./chunk-J4FIESTB.js";import{createServer as S}from"http";import{randomBytes as A}from"crypto";import{URL as L}from"url";var P=class{profile;environment;creds;oauth;constructor(r="default",o="prod",e){this.profile=r,this.environment=o,this.creds=e??new C,this.oauth=new b(o)}async login(){let{server:r,port:o}=await this.startCallbackServer(),e=y(o);try{let t=this.creds.loadClient(this.profile,this.environment),i=t?.redirect_uris;(!t||!i?.includes(e))&&(t=await this.oauth.registerClient(e),this.creds.saveClient(this.profile,this.environment,t));let c=t.client_id,[h,d]=b.generatePkce(),a=A(32).toString("hex"),n=this.oauth.buildAuthorizationUrl(c,d,a,e),l=await this.waitForCallback(r,o,n,a);if(!l)throw new Error("Login cancelled or timed out");let p=await this.oauth.exchangeCode(l,c,h,e),g={access_token:p.access_token,refresh_token:p.refresh_token,expires_at:Math.floor(Date.now()/1e3)+p.expires_in,scope:p.scope??"*"};return this.creds.saveCredentials(this.profile,this.environment,g),this.creds.setActiveProfile(this.profile),g}catch(t){throw r.close(),t}}startCallbackServer(){return new Promise((r,o)=>{let e=u,t=()=>{let i=S();i.on("error",c=>{c.code==="EADDRINUSE"&&e<f?(e++,t()):o(new Error(`Failed to start callback server: ${c.message}. Ports ${u}-${f} are all in use.`))}),i.listen(e,m,()=>{r({server:i,port:e})})};t()})}waitForCallback(r,o,e,t){return new Promise(i=>{let c=!1,h=setTimeout(()=>d(null),12e4),d=a=>{c||(c=!0,clearTimeout(h),r.close(),i(a))};r.on("request",(a,n)=>{let l=new L(a.url??"/",`http://${m}:${o}`);if(l.pathname!==x){n.writeHead(404),n.end();return}let p=l.searchParams.get("state"),g=l.searchParams.get("code");if(l.searchParams.get("error")){n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Login failed",message:"We couldn't complete the sign-in. You can close this tab and try again from your terminal."})),d(null);return}if(p!==t){n.writeHead(400,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"error",title:"Invalid state",message:"The sign-in response didn't match this session. Please return to your terminal and try again."})),d(null);return}n.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),n.end(v({state:"success",title:"You're signed in",message:"Head back to your terminal \u2014 KaneAI is ready when you are.",autoClose:!0})),d(g)}),k(e).catch(a=>{let n=a instanceof Error?a.message:String(a);process.stderr.write(`[auth] Could not open browser: ${n}
|
|
3
3
|
Please open this URL manually: ${e}
|
|
4
4
|
`)})})}};function v(s){let r=s.state==="success",o=r?"#22c55e":"#ef4444",e=r?"rgba(34, 197, 94, 0.12)":"rgba(239, 68, 68, 0.12)",t=r?'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7"/></svg>':'<svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>',i=s.autoClose?"<script>setTimeout(function(){try{window.close();}catch(e){}}, 1500);</script>":"";return`<!doctype html>
|
|
5
5
|
<html lang="en">
|