@testmuai/kane-cli 0.8.12 → 0.8.14
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-DALSIICW.js → ChatSurface-AVL3TJA2.js} +3 -3
- package/dist/{ChromeProfilePicker-ZMVZH3AK.js → ChromeProfilePicker-WJZJOZ6Z.js} +1 -1
- package/dist/{CliFeedbackPrompt-K66H7YE6.js → CliFeedbackPrompt-65BQF5G5.js} +1 -1
- package/dist/{CliUploadProgress-5DZHZY4M.js → CliUploadProgress-HEBZYKGN.js} +1 -1
- package/dist/{ConfigView-S5KBV62S.js → ConfigView-JEVQ2SO4.js} +1 -1
- package/dist/EvidenceViewOffer-5MB4ZXKM.js +2 -0
- package/dist/FolderPicker-SYFXH6D5.js +2 -0
- package/dist/{InfoBox-7PAM2FQH.js → InfoBox-KM5DLBCV.js} +1 -1
- package/dist/{LinksBox-2NVZ3FHJ.js → LinksBox-FQA36GTV.js} +1 -1
- package/dist/{ProfilesView-SIUBF7IU.js → ProfilesView-76KGHTMK.js} +1 -1
- package/dist/{ProjectPicker-5NI554X3.js → ProjectPicker-65YOU46H.js} +1 -1
- package/dist/{SaveSessionPrompt-5OULBV5N.js → SaveSessionPrompt-QD6BNTWO.js} +1 -1
- package/dist/ScrollbackTap-QHJOFYMC.js +2 -0
- package/dist/SingleShotApp-U54ETXS3.js +2 -0
- package/dist/{SummaryBox-GTGF3CBO.js → SummaryBox-N2B6DUDD.js} +1 -1
- package/dist/TestMdRunView-WA4TC5PT.js +2 -0
- package/dist/{TestrunEvidenceTable-7WBCOGYW.js → TestrunEvidenceTable-3WLQVTF4.js} +1 -1
- package/dist/{WhoamiView-E2SVBHLC.js → WhoamiView-T26HA4ZZ.js} +1 -1
- package/dist/agent-parse-XMWVKCRD.js +2 -0
- package/dist/{app-download-SAXSYXIV.js → app-download-XKZWFMEK.js} +1 -1
- package/dist/attach-target-V6LECVES.js +2 -0
- package/dist/{auth-3LLVDHOJ.js → auth-PPJANIMZ.js} +1 -1
- package/dist/{binary-WSMIRJNC.js → binary-DKWWODT2.js} +1 -1
- package/dist/bind-62AZYFAY.js +15 -0
- package/dist/{bootstrap-QTVHGL45.js → bootstrap-6IJNZIPT.js} +1 -1
- package/dist/bridge-X5DEJL6F.js +2 -0
- package/dist/{changelog-CNYWOB2V.js → changelog-UTGJ7FSP.js} +1 -1
- package/dist/chat-committer-HDE3TP5I.js +2 -0
- package/dist/chat-controller-3EPK7UZG.js +2 -0
- package/dist/chunk-22QIVSQR.js +29 -0
- package/dist/{chunk-CQ3ZQ5UK.js → chunk-2BFXT7VQ.js} +3 -3
- package/dist/{chunk-AHRL4E3M.js → chunk-2RMHDOP4.js} +1 -1
- package/dist/{chunk-HPUQJRDX.js → chunk-3BHRGHIZ.js} +1 -1
- package/dist/{chunk-EEFZXZTZ.js → chunk-3IXEARDX.js} +1 -1
- package/dist/chunk-3N6IAVD5.js +7 -0
- package/dist/{chunk-3OU2F34I.js → chunk-3SPOJWRA.js} +1 -1
- package/dist/chunk-3YX3RQXO.js +2 -0
- package/dist/chunk-42FHKRPA.js +4 -0
- package/dist/{chunk-FBYB3SRE.js → chunk-4BBDKWM3.js} +1 -1
- package/dist/{chunk-UDFDTFBL.js → chunk-4K5XTIJ6.js} +1 -1
- package/dist/chunk-52WM3XYO.js +4 -0
- package/dist/{chunk-H6VS5RYO.js → chunk-53MPG2J3.js} +1 -1
- package/dist/{chunk-R7QAS6LZ.js → chunk-55YDTPB7.js} +1 -1
- package/dist/{chunk-IDX3TOPY.js → chunk-5LJRZI7S.js} +1 -1
- package/dist/chunk-66MOZKD2.js +2 -0
- package/dist/chunk-6F6YI3ZG.js +2 -0
- package/dist/chunk-6LGED4FC.js +35 -0
- package/dist/chunk-73ULUGBM.js +5 -0
- package/dist/{chunk-X6APRDUM.js → chunk-75I46VTM.js} +2 -2
- package/dist/{chunk-5FYO3PFG.js → chunk-7L25ZNNP.js} +1 -1
- package/dist/chunk-7O54QURK.js +2 -0
- package/dist/{chunk-4T35SA2O.js → chunk-7RAI77XD.js} +1 -1
- package/dist/{chunk-7NXHVC7G.js → chunk-AC7BPO4X.js} +1 -1
- package/dist/chunk-AHXOKBVE.js +7 -0
- package/dist/{chunk-DNNZ353O.js → chunk-ALCE5RLK.js} +1 -1
- package/dist/{chunk-5AHOVOWV.js → chunk-ARG56PJG.js} +1 -1
- package/dist/chunk-B2ZGG7WM.js +2 -0
- package/dist/{chunk-GNAPBOAJ.js → chunk-BAKJPQGU.js} +1 -1
- package/dist/chunk-BJYGWXVP.js +52 -0
- package/dist/chunk-C74ABM24.js +2 -0
- package/dist/chunk-CGT4NFQN.js +8 -0
- package/dist/{chunk-EV64VI66.js → chunk-CRZUBDJ3.js} +1 -1
- package/dist/{chunk-M4WSRYRA.js → chunk-DA57DXCF.js} +1 -1
- package/dist/chunk-DHJSM5DT.js +2 -0
- package/dist/{chunk-UZXCCO7V.js → chunk-EMSLJTYN.js} +1 -1
- package/dist/{chunk-2LXJ2ZM3.js → chunk-FFFB5BXL.js} +1 -1
- package/dist/{chunk-WIAZN7G4.js → chunk-FFVNISYH.js} +1 -1
- package/dist/chunk-FQNQVC5O.js +5 -0
- package/dist/{chunk-NSD2H67E.js → chunk-GESG672R.js} +1 -1
- package/dist/{chunk-FHYG3QLL.js → chunk-GKZ2KVE6.js} +1 -1
- package/dist/chunk-GP7WD4UY.js +4 -0
- package/dist/{chunk-7R5K4IGS.js → chunk-GPIXV7AV.js} +2 -2
- package/dist/chunk-H6TNBKGR.js +5 -0
- package/dist/chunk-HOA4VWSD.js +5 -0
- package/dist/chunk-IE3OO5GI.js +2 -0
- package/dist/chunk-IICQ5KRD.js +5 -0
- package/dist/{chunk-VG7BTA5G.js → chunk-IQ7GPETF.js} +1 -1
- package/dist/{chunk-AFNDJK2A.js → chunk-IQ7NGOAT.js} +1 -1
- package/dist/{chunk-F2CET54H.js → chunk-J7NRD4Q7.js} +1 -1
- package/dist/{chunk-FAREJ4P2.js → chunk-JH6E632O.js} +1 -1
- package/dist/{chunk-L7GAZQYL.js → chunk-JJJSDDQ2.js} +1 -1
- package/dist/{chunk-XWO5MDEU.js → chunk-JKX57HA7.js} +1 -1
- package/dist/{chunk-LLY7TQSI.js → chunk-K7K23DIQ.js} +1 -1
- package/dist/chunk-KN65CUNT.js +15 -0
- package/dist/{chunk-YF26DH4Z.js → chunk-KOL6ZWOQ.js} +1 -1
- package/dist/{chunk-COVIEKZN.js → chunk-KOPP4CJW.js} +1 -1
- package/dist/chunk-KZG4E5RM.js +2 -0
- package/dist/{chunk-GRDYYYIQ.js → chunk-L4M7753M.js} +1 -1
- package/dist/{chunk-ZVJGHQNG.js → chunk-L6MOO4WT.js} +1 -1
- package/dist/chunk-LBNADEQN.js +8 -0
- package/dist/{chunk-HWHLKBUT.js → chunk-LL5DQO6V.js} +1 -1
- package/dist/chunk-LNV7C2YO.js +6 -0
- package/dist/{chunk-3N2YOHD6.js → chunk-LR5DJ6EN.js} +1 -1
- package/dist/{chunk-ZXN67F4U.js → chunk-M7DN6FO3.js} +1 -1
- package/dist/chunk-MLRO7OH3.js +9 -0
- package/dist/{chunk-ZZI4Y3CX.js → chunk-MNE5VMHT.js} +1 -1
- package/dist/{chunk-3G3LY6BM.js → chunk-N7ZRF5K3.js} +1 -1
- package/dist/{chunk-MMQLVGUJ.js → chunk-NBMLBCJ3.js} +1 -1
- package/dist/{chunk-WHYEXCTG.js → chunk-NDCRJXYF.js} +1 -1
- package/dist/{chunk-4E4GJPEM.js → chunk-NOLYYHVG.js} +1 -1
- package/dist/{chunk-IWVA37B6.js → chunk-O25AL4B7.js} +1 -1
- package/dist/{chunk-2MTAXT2U.js → chunk-O2APH6TZ.js} +1 -1
- package/dist/{chunk-KAZGHWGK.js → chunk-O3XBIURC.js} +1 -1
- package/dist/{chunk-APZCLVZD.js → chunk-O5AS2ZIX.js} +1 -1
- package/dist/{chunk-43DM2I6Q.js → chunk-O6U2HU5M.js} +1 -1
- package/dist/{chunk-7KAPHA56.js → chunk-OH2NSBO6.js} +1 -1
- package/dist/{chunk-3CCD434H.js → chunk-OO5GMBVI.js} +1 -1
- package/dist/chunk-OPL2MIQG.js +2 -0
- package/dist/chunk-P3JUE2RM.js +17 -0
- package/dist/{chunk-QZRHXGNI.js → chunk-PGU64EWQ.js} +1 -1
- package/dist/{chunk-24QPDHRD.js → chunk-Q7XBMBMR.js} +1 -1
- package/dist/{chunk-4TZSEC2C.js → chunk-QJ5O27SJ.js} +1 -1
- package/dist/{chunk-YTAAF62A.js → chunk-QPUVOVD7.js} +1 -1
- package/dist/{chunk-5A4QG7ZM.js → chunk-RBHQXWR7.js} +1 -1
- package/dist/{chunk-G52YPXKT.js → chunk-RH6KFHJB.js} +1 -1
- package/dist/{chunk-ASYWKYTQ.js → chunk-RQLU4NDG.js} +12 -12
- package/dist/{chunk-U27OWZPW.js → chunk-SFTFHFG3.js} +7 -7
- package/dist/{chunk-H6NHARB4.js → chunk-SGHP44WS.js} +1 -1
- package/dist/{chunk-U2CIXGZR.js → chunk-SQDQADWD.js} +1 -1
- package/dist/{chunk-IE4BCGUE.js → chunk-SX56MVUO.js} +1 -1
- package/dist/{chunk-O5U6EAL3.js → chunk-TCAHDVII.js} +1 -1
- package/dist/chunk-TNBF5OMZ.js +2 -0
- package/dist/chunk-TU6IMGWO.js +2 -0
- package/dist/{chunk-5G22NOZK.js → chunk-UHT5SVP5.js} +1 -1
- package/dist/{chunk-L2BCQQLJ.js → chunk-UXH3RMQ7.js} +1 -1
- package/dist/{chunk-DYXYNH6X.js → chunk-VNFCX2SH.js} +1 -1
- package/dist/{chunk-O7U5BVX5.js → chunk-WBHSPN55.js} +2 -2
- package/dist/chunk-WILT62DP.js +16 -0
- package/dist/{chunk-I57TM22L.js → chunk-WOA7VCGA.js} +1 -1
- package/dist/{chunk-SA6EDKUF.js → chunk-WR42Q3HU.js} +1 -1
- package/dist/chunk-X5276I5H.js +9 -0
- package/dist/{chunk-75HF3GPO.js → chunk-X74PP5NJ.js} +1 -1
- package/dist/{chunk-3XWKKSIM.js → chunk-XGHMZJGI.js} +2 -2
- package/dist/{chunk-XS2LZFCH.js → chunk-YCH7H7JX.js} +1 -1
- package/dist/{chunk-IGW77FMB.js → chunk-YHR2YAN5.js} +1 -1
- package/dist/chunk-YHVG7V3E.js +21 -0
- package/dist/chunk-YLQHY4A7.js +2 -0
- package/dist/{chunk-KGKJU27A.js → chunk-YYYQ5MVD.js} +1 -1
- package/dist/chunk-ZA4M4O7E.js +27 -0
- package/dist/chunk-ZKEOPIQ3.js +9 -0
- package/dist/chunk-ZUZ6QJRA.js +23 -0
- package/dist/{chunk-4ASRA7CD.js → chunk-ZWHPIR2Z.js} +2 -2
- package/dist/chunk-ZZTZJPT2.js +88 -0
- package/dist/committer-IYQPXG6C.js +2 -0
- package/dist/{config-HUK7V364.js → config-3AKWRTFS.js} +1 -1
- package/dist/{controller-client-OB4WD2C4.js → controller-client-ZF5IXRUV.js} +1 -1
- package/dist/cover-cmd-ZLAWMEC2.js +3 -0
- package/dist/{credentials-6DP4KAMJ.js → credentials-Q4WH5CBN.js} +1 -1
- package/dist/{deps-bundle-PZNXSKLC.js → deps-bundle-RVZK6LZJ.js} +1 -1
- package/dist/{deps-resolve-62XK3LKV.js → deps-resolve-6F2U4TJP.js} +1 -1
- package/dist/design-committer-J57IAAA5.js +2 -0
- package/dist/dispatch-46BETGXY.js +2 -0
- package/dist/{doctor-ZQQ4VMPY.js → doctor-WRPG56HH.js} +1 -1
- package/dist/docx-convert-WPZS6OIC.js +2 -0
- package/dist/{dossier-Y6TJWFZU.js → dossier-UGJMYYAB.js} +1 -1
- package/dist/evidence-XWR32HWP.js +2 -0
- package/dist/evolve-cmd-27ZQN6YB.js +2 -0
- package/dist/explain-H5HJEDEF.js +2 -0
- package/dist/explain-cmd-JCJTXVZY.js +9 -0
- package/dist/{explain-cmd-XCRO4AS6.js → explain-cmd-R45I5MT7.js} +1 -1
- package/dist/extract-bind-D5BYYGYA.js +14 -0
- package/dist/{extract-cmd-IPBCCR3T.js → extract-cmd-CCYW7FIY.js} +3 -3
- package/dist/feeder-RSHMGW6B.js +2 -0
- package/dist/gaps-cmd-3VJKQ25D.js +3 -0
- package/dist/{generate-headless-CLMSXEAS.js → generate-headless-2M6UT3IK.js} +2 -2
- package/dist/headless-io-3A3BZVQ5.js +2 -0
- package/dist/index.js +206 -164
- package/dist/ingest-QGLVY7ND.js +2 -0
- package/dist/ingest-cmd-HVTUK264.js +2 -0
- package/dist/install-5WJLE7XT.js +2 -0
- package/dist/interactive-bind-OJCYNQPI.js +26 -0
- package/dist/lifecycle-cmd-GWFGUGTC.js +2 -0
- package/dist/{list-cmd-V3HJ5K4O.js → list-cmd-AXDW64OY.js} +1 -1
- package/dist/list-commands-YNZ6EFIF.js +2 -0
- package/dist/{locks-cmd-CSVSWY2Y.js → locks-cmd-67OHQZNV.js} +1 -1
- package/dist/logical-ids-DN6IZSUM.js +2 -0
- package/dist/login-flow-PRXFPRYZ.js +2 -0
- package/dist/maintenance-cmd-QEMK6YNV.js +2 -0
- package/dist/{mobile-prompts-WJVFBWW5.js → mobile-prompts-OXHA5GHJ.js} +1 -1
- package/dist/{objective-variable-gate-GCQYYM77.js → objective-variable-gate-76GYUHEP.js} +1 -1
- package/dist/open-provider-E5VUGFNE.js +2 -0
- package/dist/pdf-convert-5H4HQNN3.js +2 -0
- package/dist/{persist-recorded-session-MHLD4A32.js → persist-recorded-session-KWPH37HI.js} +1 -1
- package/dist/phase-seed-HKJ2EF7R.js +2 -0
- package/dist/pipeline-A2OGF4XW.js +2 -0
- package/dist/prepare-target-P6BWJZBZ.js +2 -0
- package/dist/readmodel-IBFRM6EO.js +2 -0
- package/dist/reconcile-cmd-V7TDYETT.js +2 -0
- package/dist/reconcile-deps-X6IGH4CA.js +4 -0
- package/dist/reconcile-engine-OGXSIE7O.js +2 -0
- package/dist/{recording-banner-4H4AL6YN.js → recording-banner-IZWN2XFY.js} +1 -1
- package/dist/records-TJJJWBUD.js +2 -0
- package/dist/registry-GOLIFVK5.js +2 -0
- package/dist/{require-project-folder-G2G4WKWW.js → require-project-folder-PEEUITK6.js} +1 -1
- package/dist/{resolve-run-intent-MZRPYN4V.js → resolve-run-intent-JGXXE45Y.js} +1 -1
- package/dist/{resolver-X5NHNX5O.js → resolver-TY7XLJBN.js} +1 -1
- package/dist/revert-6BBBK3I4.js +2 -0
- package/dist/review-cmd-74YTPT7E.js +5 -0
- package/dist/run-DN4XARP2.js +2 -0
- package/dist/run-GRYWYKIH.js +2 -0
- package/dist/{run-test-md-4VRH7FU5.js → run-test-md-DFCKCQ4T.js} +2 -2
- package/dist/sessions-NH7WQWMX.js +2 -0
- package/dist/{sessions-cmd-VDQGRBEM.js → sessions-cmd-DV442ZCY.js} +1 -1
- package/dist/{skill-installer-WPW6NDCR.js → skill-installer-GRU3HOYF.js} +1 -1
- package/dist/{spawner-R3XOP3GP.js → spawner-LNMD4NJF.js} +1 -1
- package/dist/store-guard-Q4MYZQHF.js +2 -0
- package/dist/structured-answers-NADW6D44.js +5 -0
- package/dist/sync-cmd-H6Y5EB3L.js +2 -0
- package/dist/sync-setup-THGRBKTA.js +2 -0
- package/dist/sync-setup-ui-RC727VK6.js +3 -0
- package/dist/tcg-generate-SZZ7MJXY.js +2 -0
- package/dist/testmd-actions-MRIUOOXO.js +2 -0
- package/dist/testmd-sync-UYVJ47BN.js +2 -0
- package/dist/token-refresh-KN5JK2U4.js +2 -0
- package/dist/{validate-basic-YNGP5JFB.js → validate-basic-RCBEELSB.js} +1 -1
- package/dist/{variable-receipt-2VCUG7NN.js → variable-receipt-JHRW73Z6.js} +1 -1
- package/dist/verdicts-XFXDRND4.js +2 -0
- package/dist/{version-check-GUGRBTIH.js → version-check-Z774UWW3.js} +1 -1
- package/dist/{view-cmd-SXXNDZIC.js → view-cmd-I4LQGJ2X.js} +1 -1
- package/dist/walk-session-FP52IGLB.js +2 -0
- package/dist/with-telemetry-P6RUPWBH.js +2 -0
- package/package.json +12 -11
- package/dist/EvidenceViewOffer-UACWB3YJ.js +0 -2
- package/dist/FolderPicker-YH5TKMX3.js +0 -2
- package/dist/ScrollbackTap-Q3IOKNMS.js +0 -2
- package/dist/SingleShotApp-LA3EMPUK.js +0 -2
- package/dist/TestMdRunView-5MNKJJMS.js +0 -2
- package/dist/bind-A3M4PV4V.js +0 -12
- package/dist/bridge-E2C5VV3H.js +0 -2
- package/dist/chat-committer-RAOIL2T6.js +0 -2
- package/dist/chat-controller-YJCNU76T.js +0 -2
- package/dist/chunk-4O6XBS5G.js +0 -5
- package/dist/chunk-54JZ6VEW.js +0 -4
- package/dist/chunk-5DT7PIGB.js +0 -5
- package/dist/chunk-5KLDW3ZW.js +0 -85
- package/dist/chunk-6A47PRDS.js +0 -4
- package/dist/chunk-6FCPS2VT.js +0 -4
- package/dist/chunk-7RFGO3TH.js +0 -2
- package/dist/chunk-DBIBROYW.js +0 -5
- package/dist/chunk-DPUV6OSP.js +0 -2
- package/dist/chunk-G2Q2TP3O.js +0 -9
- package/dist/chunk-IAHKTEET.js +0 -2
- package/dist/chunk-IVQX3AKL.js +0 -4
- package/dist/chunk-JDGBRACP.js +0 -16
- package/dist/chunk-JOATASPP.js +0 -4
- package/dist/chunk-KRL2BDI5.js +0 -8
- package/dist/chunk-N7Z7BQYO.js +0 -3
- package/dist/chunk-NJJQL54J.js +0 -2
- package/dist/chunk-NP3VGFZM.js +0 -26
- package/dist/chunk-NVGBE2DR.js +0 -2
- package/dist/chunk-OS4VSIHT.js +0 -4
- package/dist/chunk-OZMYKG6E.js +0 -6
- package/dist/chunk-QQ5MHSSY.js +0 -2
- package/dist/chunk-RV7Q4RUV.js +0 -7
- package/dist/chunk-SACCB44S.js +0 -21
- package/dist/chunk-T4OJX2GZ.js +0 -15
- package/dist/chunk-TLFNUXKS.js +0 -2
- package/dist/chunk-UH2ZTX4E.js +0 -2
- package/dist/chunk-VDM3TWF6.js +0 -17
- package/dist/chunk-W3Z7AZNT.js +0 -4
- package/dist/chunk-WMVPJWWA.js +0 -37
- package/dist/chunk-XMTSHHYQ.js +0 -4
- package/dist/chunk-ZVZHE7KH.js +0 -27
- package/dist/committer-C6UCDYMC.js +0 -2
- package/dist/cover-cmd-5LPHIOSI.js +0 -3
- package/dist/design-committer-UPC6NZUF.js +0 -2
- package/dist/dispatch-7JCKGQVC.js +0 -2
- package/dist/docx-convert-BIV5T7F5.js +0 -2
- package/dist/evidence-YAXIWZ6A.js +0 -2
- package/dist/evolve-cmd-5ACHYQPE.js +0 -2
- package/dist/explain-3HAZY7Q6.js +0 -2
- package/dist/explain-cmd-RMJPXD4U.js +0 -9
- package/dist/extract-bind-BF2G6AS6.js +0 -10
- package/dist/feeder-IOR3XRNF.js +0 -2
- package/dist/gaps-cmd-3WXL6PAW.js +0 -3
- package/dist/headless-io-66RG5NN5.js +0 -2
- package/dist/ingest-TTUQ7UDK.js +0 -2
- package/dist/ingest-cmd-KP5M6XTA.js +0 -2
- package/dist/install-5VWCH5GW.js +0 -2
- package/dist/interactive-bind-MOV2VWHJ.js +0 -25
- package/dist/lifecycle-cmd-KSMETBPP.js +0 -2
- package/dist/list-commands-KUDSKVP5.js +0 -2
- package/dist/logical-ids-MLXAH45L.js +0 -2
- package/dist/login-flow-GZ3XHVCS.js +0 -2
- package/dist/maintenance-cmd-VFYGKY3X.js +0 -2
- package/dist/pdf-convert-OZIRUADA.js +0 -2
- package/dist/phase-seed-BMOSAA74.js +0 -2
- package/dist/pipeline-G7KWRK2G.js +0 -2
- package/dist/prepare-target-SQ5IGKXD.js +0 -2
- package/dist/readmodel-TDRFVDVI.js +0 -2
- package/dist/reconcile-cmd-NI3AYU3Y.js +0 -2
- package/dist/reconcile-deps-DCHUFIEC.js +0 -4
- package/dist/reconcile-engine-QXUKUKSL.js +0 -2
- package/dist/records-JLS63SDI.js +0 -2
- package/dist/registry-R6QNPI5E.js +0 -2
- package/dist/revert-PRR3D4XM.js +0 -2
- package/dist/review-cmd-SAGIKWEW.js +0 -4
- package/dist/run-PBS2J4N4.js +0 -2
- package/dist/run-VTUYLPSG.js +0 -2
- package/dist/sessions-GIEXOCE4.js +0 -2
- package/dist/structured-answers-YAVW65G4.js +0 -5
- package/dist/tcg-generate-HIC5AA3L.js +0 -2
- package/dist/testmd-actions-VOSP7L74.js +0 -2
- package/dist/testmd-sync-GNCDKPQN.js +0 -2
- package/dist/token-refresh-GSFVJ6GU.js +0 -2
- package/dist/verdicts-PRXUKSDV.js +0 -2
- package/dist/walk-session-G3DLBR24.js +0 -2
- package/dist/with-telemetry-5Y2CVPXK.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{j as S,k as v}from"./chunk-6F6YI3ZG.js";import{d as c,i as m}from"./chunk-Z7S3IWUX.js";import{a as h,c as _,e as f}from"./chunk-EYOCNMUM.js";var y=["desktop","emulator","simulator"];function T(n,t){return n.kind==="app_id"?!0:t==="emulator"?n.kind==="apk":n.kind==="zip"}function $(n){let t=n.deviceName,e=n.osVersion;return t!==void 0&&t.trim()===""||e!==void 0&&e.trim()===""?{ok:!1,message:"--device-name and --os-version cannot be empty."}:{ok:!0,...t!==void 0?{name:t.trim()}:{},...e!==void 0?{osVersion:e.trim()}:{}}}function R(n){return`--device-name needs an OS version \u2014 a bare name matches every runtime that ships it.
|
|
3
3
|
Provide one: ${n}`}function k(n,t,e){let r=v(n);return r?T(r,t)?null:t==="emulator"?`${e} cannot run on an emulator (needs an .apk, or an APP\u2026 id).`:`${e} cannot run on a simulator (needs a .zip of the .app bundle, or an APP\u2026 id).`:`${n}: ${S}`}function I(n){return y.includes(n)?n:null}function V(n){return`--target must be one of desktop, emulator, simulator (got "${n}")`}function x(n){let t=[];for(let[e,r]of[["--device-name",n.deviceName],["--os-version",n.osVersion],["--app",n.app]])r!==void 0&&t.push(`ignored ${e} ${r}: session target is desktop \u2014 set --target emulator|simulator to run on a device`);return t}function F(n){let{flags:t,saved:e}=n,r=[],s;if(t.target!==void 0){let i=I(t.target);if(!i)return{kind:"invalid",message:V(t.target)};s=i}else{let i=h(e?.tui_target,e?.default_target?.kind);if(i.kind==="choose-mobile")return{kind:"choose-mobile-kind"};s=i.kind==="unset"?"desktop":i.kind}if(s==="desktop")return r.push(...x(t)),{kind:"web",warnings:r};if(!n.host.supported)return{kind:"invalid",message:n.host.reason??"this machine cannot run mobile targets."};let a=[],d,u,o=$(t);if(!o.ok)return{kind:"invalid",message:o.message};let l=e?.default_target&&e.default_target.kind===s?c(e.default_target):void 0;if(o.name!==void 0||o.osVersion!==void 0){let i=o.name??l?.name,p=o.osVersion??l?.osVersion;if(p===void 0)return{kind:"invalid",message:R("--os-version <version>, or save one (kane-cli config set-os-version)")};u={...i!==void 0?{name:i}:{},osVersion:p},d={value:i?`${i} (${p})`:`any device on ${p}`,source:"flag"}}else if(e?.default_target&&e.default_target.kind===s&&(c(e.default_target)!==void 0||e.default_target.id!==void 0))d={value:m(e.default_target)??"(saved device)",source:"saved"};else{if(e?.default_target&&e.default_target.kind!==s&&(c(e.default_target)!==void 0||e.default_target.id!==void 0))return{kind:"invalid",message:`Your saved device '${m(e.default_target)}' is ${e.default_target.kind==="simulator"?"a simulator":"an emulator"}, but this run targets ${s==="simulator"?"a simulator":"an emulator"}. Pass --device-name and --os-version, or update your config (set-target, set-device-name, set-os-version).`};a.push("device")}let g;if(t.app!==void 0){let i=k(t.app,s,`--app ${t.app}`);if(i)return{kind:"invalid",message:i};g={value:t.app,source:"flag"}}else{let i=e?.default_app,p=i?v(i):null;p&&T(p,s)&&e?.default_target?.kind===s?g={value:i,source:"saved"}:a.push("app")}return{kind:"mobile",target:s,...u?{deviceSelector:u}:{},...d?{device:d}:{},...g?{app:g}:{},missing:a,warnings:r}}function M(n){let{flags:t,file:e}=n,r=[],s=e.target==="emulator"||e.target==="simulator"?e.target:void 0,a;if(t.target!==void 0){let i=I(t.target);if(!i)return{kind:"invalid",message:V(t.target)};a=i,s&&s!==a&&r.push(`--target ${a} overrides the file's \`target: ${s}\` \u2014 steps recorded on ${s==="emulator"?"an emulator":"a simulator"} may not replay here`)}else a=s??"desktop";if(a==="desktop")return r.push(...x(t)),{kind:"web",warnings:r};let d=$(t);if(!d.ok)return{kind:"invalid",message:d.message};let u=d.name??(e.device_name?.trim()||void 0),o=d.osVersion??(e.os_version?.trim()||void 0);if(u!==void 0&&o===void 0)return{kind:"invalid",message:R("--os-version <version>, or os_version: in the test file")};let l=o!==void 0?{...u!==void 0?{name:u}:{},osVersion:o}:void 0;if(a==="simulator"&&l&&l.name===void 0&&r.push(`the file names no device_name \u2014 any simulator on ${o} may be used. Add device_name: to the file (or pass --device-name) to pin the device.`),t.app!==void 0){let i=k(t.app,a,`--app ${t.app}`);if(i)return{kind:"invalid",message:i}}else if(e.app){let i=k(e.app,a,`the file's app: ${e.app}`);if(i)return{kind:"invalid",message:i}}let g=t.app??(e.app||void 0);return{kind:"mobile",target:a,platform:_(a)??"",...g?{app:g}:{},...l?{deviceSelector:l}:{},...e.no_reset!==void 0?{noReset:e.no_reset}:{},warnings:r}}function D(n){return n.target==="desktop"?"Running on: Desktop \xB7 Chrome":`Running on: ${f(n.target)} \xB7 ${n.deviceLabel} \xB7 ${n.appLabel}`}var b={emulator:"</path/to/app.apk | AppId>",simulator:"</path/to/app.zip | AppId>"};function E(n,t){let e=f(n).toLowerCase();return t==="device"?[`session target is "${e}" but no device is set.`,` See devices: kane-cli devices list --target ${n}`,' Set one: kane-cli config set-device-name "<name>" && kane-cli config set-os-version "<version>"',' Or per-run: --device-name "<name>" --os-version "<version>"'].join(`
|
|
4
4
|
`):[`session target is "${e}" but no app is set.`,` Set one: kane-cli config set-app ${b[n]}`,` Or per-run: --app ${b[n]}`].join(`
|
|
5
5
|
`)}function K(n){return[`saved device "${n}" was not found on this machine.`," See devices: kane-cli devices list",' Set one: kane-cli config set-device-name "<name>" && kane-cli config set-os-version "<version>"'].join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{A as r}from"./chunk-
|
|
2
|
+
import{A as r}from"./chunk-GP7WD4UY.js";function i(t){return r.test(t)?t.toUpperCase():t}export{i as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as J,c as ve}from"./chunk-BZAGVBCX.js";import{a as M,b as me}from"./chunk-52WM3XYO.js";import{a as Ee}from"./chunk-427OQS2N.js";import{d as he}from"./chunk-IE3OO5GI.js";import{B as ue,C as ge,F as fe,e as ae,f as le,h as pe,p as j}from"./chunk-GP7WD4UY.js";import{a as ce}from"./chunk-JQW2QFSX.js";import{H as re,M as oe,c as F,d as k,m as de}from"./chunk-3N6IAVD5.js";import{e as N,f as L,g as se,h as Y}from"./chunk-AKX4VRRR.js";var Se=new Set(["approve","edit","reject"]);function je(v){let{contextDir:E,graph:s,ops:z,by:f}=v,w=v.mintable??Ee(),U=re(E);if(s.latestHash!==U)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(s.latestHash)} but chain head is ${String(U)} \u2014 re-open and retry`}]};let V=[],b=[],Q=new Set;for(let e of z){if(s.appliedEvents.has(e.eventId)||Q.has(e.eventId)){V.push(e.eventId);continue}Q.add(e.eventId),b.push(e)}if(b.length===0)return{record:null,errors:null,applied:[],skipped:V,minted:[],staleDelta:[]};let d=[],B=[],y=[],C=[],$=[],G=[],D=[...v.judgements??[]],K=[],q=new Map,X=new Set,Z=[],_=new Set,ye=new Set(w),ee=new Set;for(let e of b){if(!Se.has(e.kind))continue;let i=e.target,t=s.resolve(i),n=t?s.tipOf(t.cid):i;ee.has(n)&&d.push({code:"MULTIPLE_TERMINAL_OPS",detail:`${i} has more than one terminal op in this turn \u2014 normalize latest-wins first`}),ee.add(n)}let I={targets:{},enhance:{},redirectTo:{},retract:{},conv:{}},T=(e,i)=>{let{target:t,expectedCid:n}=i,o=s.resolve(t);if(!o)return d.push({code:"UNKNOWN_NODE",detail:`${e}: ${t} names nothing in the graph`}),null;let r=s.tipOf(o.cid);return r!==n||s.superseded.has(n)?(d.push({code:"EXPECTED_CID_MOVED",detail:`${e}: ${t} moved or was archived since it was displayed`,data:{tip:r}}),null):(I.targets[i.eventId]=n,n)},P=e=>new Set(fe(s,s.tipOf(e))),O=[],R=new Set,te=e=>({code:"RETRACT_FORBIDDEN",detail:`retract ${e}: provenance edges cannot be retracted \u2014 DERIVES is historical evidence; reject or edit the node instead`});for(let e of b){if(e.kind!=="retract"){O.push(e);continue}let i=T("retract",e);if(!i)continue;let t=new Map;for(let r of P(i))for(let p of[...s.edgesFrom(r),...s.edgesInto(r)])t.set(p.ecid,p);let n,o={};if(e.edgeEcid!==void 0){if(s.superseded.has(e.edgeEcid)){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is already retracted`});continue}if(n=t.get(e.edgeEcid),!n){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: ${e.edgeEcid} is not a live edge touching ${e.target} (checked the full version chain)`});continue}}else if(e.edgeRef!==void 0){let r=e.edgeRef;if(r.type===N.DERIVES){d.push(te(e.target));continue}let p=(a,h)=>{let S=j(s,h);if(S)return S;let u=s.resolve(h)!==null;return d.push(u?{code:"TOMBSTONED_REF",detail:`retract ${e.target}: ${r.type} ${a} '${h}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`retract ${e.target}: ${r.type} ${a} got (unknown) for '${h}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`}),null},l=p("dst",r.dst);if(!l)continue;o.dst=l.cid;let c=P(l.cid),m=null;if(r.src!==void 0){let a=p("src",r.src);if(!a)continue;o.src=a.cid,m=P(a.cid)}let g=[...t.values()].filter(a=>a.type===r.type&&c.has(a.dst)&&(m===null||m.has(a.src)));if(g.length===0){d.push({code:"UNKNOWN_EDGE",detail:`retract ${e.target}: no live ${r.type} edge onto ${r.dst}${r.src!==void 0?` from ${r.src}`:""} touches ${e.target} (checked the full version chain)`});continue}if(g.length>1){let a=g.map(h=>`${h.type} ${s.displayNameOf(h.src)??h.src} \u2192 ${s.displayNameOf(h.dst)??h.dst} (${h.ecid})`).join("; ");d.push({code:"AMBIGUOUS_RETRACT",detail:`retract ${e.target}: ${g.length} live ${r.type} edges match \u2014 ${a} \u2014 add src to disambiguate`});continue}n=g[0]}else{d.push({code:"INVALID_RETRACT",detail:`retract ${e.target}: neither edge_ecid nor edge {type, dst, src?} was given`});continue}if(n.type===N.DERIVES){d.push(te(e.target));continue}if(R.has(n.ecid)){d.push({code:"EDGE_RETRACTED",detail:`retract ${e.target}: ${n.ecid} was retracted earlier in this turn`});continue}R.add(n.ecid),I.retract[e.eventId]={ecid:n.ecid,...o},O.push({kind:"retract",target:e.target,expectedCid:e.expectedCid,edgeEcid:n.ecid,reason:e.reason,eventId:e.eventId})}let x=new Map;for(let e of O){if(e.kind!=="edit")continue;let i=s.resolve(e.target);if(!i||s.tipOf(i.cid)!==e.expectedCid||s.superseded.has(e.expectedCid))continue;let t=s.getNode(e.expectedCid);if(!t)continue;let n={...t.content};for(let[r,p]of Object.entries(e.edit))p!==void 0&&(n[r]=p);if(typeof n.title=="string"&&!n.title.trim()||L(t.label,n).length>0)continue;let o=F(t.label,n);o!==e.expectedCid&&x.set(e.expectedCid,o)}for(let e of O)if(e.kind==="approve"){let i=T("approve",e);i&&C.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f})}else if(e.kind==="reject"){let i=T("reject",e);if(!i)continue;if(C.push({id:i,kind:"review-item",resolution:"rejected",edit:null,reason:e.reason,by:f}),e.redirectTo!==void 0){let t=s.resolve(e.redirectTo);if(!t||t.superseded){d.push({code:"UNKNOWN_NODE",detail:`reject.redirectTo: ${e.redirectTo} is not a live node`});continue}I.redirectTo[e.eventId]=t.cid,$.push({kind:"node",old:i,new:t.cid,reason:e.reason,by:f})}}else if(e.kind==="edit"){let i=T("edit",e);if(!i)continue;let t=s.getNode(i);if(!t){d.push({code:"UNKNOWN_NODE",detail:`edit: ${e.target} node file unreadable`});continue}let n={...t.content};for(let[l,c]of Object.entries(e.edit))c!==void 0&&(n[l]=c);if(typeof n.title=="string"&&!n.title.trim()){d.push({code:"EMPTY_TITLE",detail:`edit: ${e.target} edited title is empty`});continue}let o=L(t.label,n);if(o.length>0){for(let l of o)d.push({code:l.code,detail:`edit ${e.target}: ${l.detail}`});continue}let r=F(t.label,n);if(r===i){C.push({id:i,kind:"review-item",resolution:"approved",edit:null,reason:null,by:f});continue}if(ae(s,i,r)){d.push({code:"SUPERSEDE_CYCLE",detail:`edit ${e.target}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let p=le({graph:s,oldTip:i,newCid:r,newLabel:t.label,by:f,reason:`re-blessed onto ${r} (edited in chat)`,skipEcids:R,dstRedirect:x});if(p.errors.length>0){for(let l of p.errors)d.push({code:"REBLESS_REFUSED",detail:`edit ${e.target}: ${l}`});continue}B.push({cid:r,label:t.label,content:n}),y.push(...p.edges),$.push({kind:"node",old:i,new:r,reason:e.reason??"edited in chat",by:f}),$.push(...p.supersessions),C.push({id:r,kind:"review-item",resolution:"edited",edit:{...e.edit},reason:null,by:f})}else if(e.kind==="enhance"){if(!T("enhance",e))continue;for(let t of e.edges){let n=j(s,t.src),o=j(s,t.dst);if(!n||!o){let[u,H]=n?["dst",t.dst]:["src",t.src],Re=s.resolve(H)!==null;d.push(Re?{code:"TOMBSTONED_REF",detail:`enhance ${e.target}: ${t.type} ${u} '${H}' is tombstoned (retired with no live successor) \u2014 pick a live node`}:{code:"UNKNOWN_REF",detail:`enhance ${e.target}: ${t.type} ${u} got (unknown) for '${H}' \u2014 not a committed node (a node added in this same turn has no id yet: commit the add first)`});continue}(I.enhance[e.eventId]??=[]).push({src:n.cid,dst:o.cid});let r=s.nodeLabel.get(n.cid)??"(unknown)",p=s.nodeLabel.get(o.cid)??"(unknown)";for(let u of Y(t.type,r,p,t.props))d.push({code:u.code,detail:`enhance ${e.target}: ${u.detail}`});let l=k(t.type,n.cid,o.cid,t.props),c=x.get(n.cid)??n.cid,m=x.get(o.cid)??o.cid,g=k(t.type,c,m,t.props);if(s.superseded.has(l)||R.has(l)||s.superseded.has(g)){let u=s.superseded.has(l)||R.has(l)?l:g;d.push({code:"EDGE_RETRACTED",detail:`enhance ${e.target}: this ${t.type} edge was retracted (${u}) \u2014 re-adding a retracted edge is refused (revival unsupported)`});continue}if(s.edgesFrom(n.cid).some(u=>u.ecid===l)||y.some(u=>u.ecid===g))continue;let a=pe(s,t.type,n.cid,o.cid,Z);a&&d.push(a);let h=ce(s,{type:t.type,src:n.cid,dst:o.cid},{pending:[],retracted:R},`enhance ${e.target}`);h&&d.push(h);let S=se(t.type)?.cardinality;if(S==="one-live-per-src"||S==="one-live-per-src-and-dst"){let u=`${t.type}|${n.cid}`;_.has(u)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} from ${n.cid}: two one-live edges in one turn`}),_.add(u)}if(S==="one-live-per-src-and-dst"){let u=`${t.type}|dst|${o.cid}`;_.has(u)&&d.push({code:"CARDINALITY_VIOLATION",detail:`${t.type} onto ${o.cid}: two one-live edges in one turn (strict 1:1)`}),_.add(u)}y.push({ecid:g,type:t.type,src:c,dst:m,props:t.props}),Z.push({src:n.cid,dst:o.cid,type:t.type})}}else if(e.kind==="retract")$.push({kind:"edge",ecid:e.edgeEcid,reason:e.reason,by:f});else if(e.kind==="add"){if(!ye.has(e.label)){d.push({code:"GATED_LABEL",detail:`add: ${e.label} is not mintable in v1 (gate: ${w.join("|")})`,data:{gate:[...w]}});continue}let i=s.heads.get(e.convSourceId),t=s.convChains.get(e.convSourceId);if(typeof i!="string"||!t){d.push({code:"CONV_SOURCE_MISSING",detail:`add: ${e.convSourceId} is not a live conversation source`});continue}I.conv[e.eventId]=i;let n=s.getNode(i)?.content?.blob,o=typeof n=="string"?he(E,n)?.toString("utf8")??"":"",r=me(o,e.cite.turn);if(r===null){d.push({code:"BAD_ANCHOR",detail:`add: ${M(e.cite.turn)} does not resolve in ${e.convSourceId}`});continue}if(!r.includes(e.cite.quote)){d.push({code:"QUOTE_MISMATCH",detail:`add: quote is not verbatim within ${M(e.cite.turn)}`});continue}let p={...e.content,derived:!0},l=L(e.label,p);if(l.length>0){for(let a of l)d.push({code:a.code,detail:`add: ${a.detail}`});continue}let c=F(e.label,p),m={source_id:e.convSourceId,source_cid:i,anchor:M(e.cite.turn),quote:e.cite.quote};for(let a of Y(N.DERIVES,"source",e.label,m))d.push({code:a.code,detail:`add: ${a.detail}`});if(s.hasNode(c)){if(s.superseded.has(c)){d.push({code:"NODE_TOMBSTONED",detail:`add: ${s.nameOf.get(c)??c} already exists and was retired \u2014 restore it deliberately or add it under new content`});continue}y.push({ecid:k("DERIVES",i,c,m),type:N.DERIVES,src:i,dst:c,props:m}),e.rationale&&D.push({about:c,rationale:e.rationale,by:f}),q.set(e.eventId,c);continue}B.push({cid:c,label:e.label,content:p}),y.push({ecid:k("DERIVES",i,c,m),type:N.DERIVES,src:i,dst:c,props:m}),e.rationale&&D.push({about:c,rationale:e.rationale,by:f});let g=ue(e.label,a=>X.has(a),s.names.keys());g!==null&&(X.add(g),G.push({cid:c,slug:g,by:f})),K.push({cid:c,...g!==null?{slug:g}:{}}),q.set(e.eventId,c)}if(d.length)return{record:null,errors:d};let ne=new Date().toISOString();for(let e of O){if(e.kind==="add"){let i=q.get(e.eventId);i&&J(E,{ts:ne,command:"extract-chat",id:i,verdict:"add",polarity:"preference",tag:e.label,by:f,event_id:e.eventId,target:i});continue}for(let i of ve(e,{ts:ne,command:"extract-chat",by:f}))J(E,i)}let ie=b.map(e=>e.eventId).sort(),$e=oe(E,{ts:new Date().toISOString(),proposal_id:null,nodes:B,edges:y,review:C,supersessions:$,...G.length>0?{names:G}:{},...D.length>0?{judgements:D}:{},event_ids:ie,...v.sid?{sid:v.sid}:{},source_head_moves:{}},{expectPrev:U,intent:{v:1,verb:"chat",args:de({ops:z,judgements:v.judgements??null,by:f,mintable:[...w],sid:v.sid??null}),pins:I},provenance:v.provenance}),W=ge(E),A=new Set;for(let e of $)if(e.kind==="node"){A.add(e.old);for(let i of W.edgesInto(e.old))A.add(i.src)}for(let e of K)A.add(e.cid);let Ie=[...A].map(e=>({cid:e,state:W.stale(W.tipOf(e))})).filter(e=>e.state!=="fresh");return{record:$e.record,errors:null,applied:ie,skipped:V,minted:K,staleDelta:Ie}}export{je as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{M as a,X as p,m as c}from"./chunk-3N6IAVD5.js";function v(t,e,s){let{ref:r,reason:o,by:i}=s;if(!o||o.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let d=e.resolve(r);if(!d)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${r}' in the graph`}]};let n=e.tipOf(d.cid);if(e.superseded.has(n))return{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${r} is already superseded at its tip (${n.slice(0,19)}\u2026)`}]};let l=a(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:n,new:null,reason:o,by:i}],source_head_moves:{}},{expectPrev:e.latestHash,intent:{v:1,verb:"archive",args:c({ref:r,reason:o,by:i}),pins:{ref:n}},provenance:s.provenance});return p(t),{record:l.record,errors:null}}export{v as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as N}from"./chunk-L2TV4G56.js";import{b as y,c as E,d as $,f as O,g as A,h as V,i as I,j as T}from"./chunk-
|
|
2
|
+
import{b as N}from"./chunk-L2TV4G56.js";import{b as y,c as E,d as $,f as O,g as A,h as V,i as I,j as T}from"./chunk-CRZUBDJ3.js";import{d as x}from"./chunk-5LJRZI7S.js";import{H as P,p as C}from"./chunk-3N6IAVD5.js";var G={extract:e=>`kane-cli context extract --resume ${e}`,design:e=>`kane-cli design tests --resume ${e}`};function Q(e,n,s){if(e===void 0||e===n)return null;if(e==="extract"||e==="design"){let a=G[e](s);return{code:"WRONG_VERB",message:`error: session ${s} is a ${e} session \u2014 resume it with ${a}`,next:[{cmd:a,why:`this session belongs to a ${e} run`}]}}return{code:"WRONG_VERB",message:`error: session ${s} belongs to a ${e} run \u2014 this command cannot resume it`,next:[]}}import{existsSync as K}from"fs";import{join as M}from"path";function ne(e){return{id:e.id,text:e.question,risk:["high","med","low"].includes(e.risk)?e.risk:"med",rationale:e.rationale,options:e.options.map(n=>({label:n.label,detail:n.description??""})),recommended_index:e.recommendedOptionIndex,allow_free_text:e.allowFreeText,kind:e.kind,consequence:e.consequence,evidence_count:e.evidence_count,multi_select:e.multiSelect}}function B(e){return{id:e.id,header:e.kind??"question",question:e.text,kind:e.kind??"clarify",multiSelect:e.multi_select??!1,options:e.options.map((n,s)=>({id:`o${s}`,label:n.label,description:n.detail||void 0})),recommendedOptionIndex:e.recommended_index,risk:e.risk,rationale:e.rationale,consequence:e.consequence??"",evidence_count:e.evidence_count,allowFreeText:e.allow_free_text}}function se(e,n){e.save({agent_state:n.agent_state,pending:{questions:n.pending.questions.map(B),proposals:n.pending.proposals??[]},assumed:n.assumed.map(s=>({questionId:s.question_id,optionId:s.option_id,flagged:!0,eventId:`assumed:${n.sid}:${s.question_id}`}))}),e.release(),$(e.state.sid)}function te(e){return{persist(n){let s=e.seqBase(),a={seq:n.seq+s,turn_id:n.turn_id,at:n.at,agent_state_schema:n.agent_state_schema,delta_items:n.delta_items,binding:n.binding,usage_total:n.usage_total,...n.base_fingerprint!==void 0?{base_fingerprint:n.base_fingerprint}:{}},l={applied_events:[...new Set([...e.handle.state.applied_events,...V(e.contextDir,e.handle.state.sid)])].sort(),held_receipts:e.peekHeldReceipts?.()??[],pending:{questions:n.at!=="turn"?(n.pending_questions??[]).map(B):[],proposals:e.stagedProposals?.()??[]},parent_asks:[],read_basis:e.readBasis(),corpus_cursor:e.corpusCursor(),store_watermark:P(e.contextDir),...(()=>{let o=e.ingestRegistry?e.ingestRegistry():e.handle.state.ingest_registry??[],p=e.ingestSchedule?e.ingestSchedule():e.handle.state.ingest_schedule??[];return{...o.length?{ingest_registry:o}:{},...p.length?{ingest_schedule:p}:{}}})()};return O(e.contextDir,e.handle,a,l,{...e.onSoftCap?{onSoftCap:e.onSoftCap}:{},...e.onStat?{onStat:e.onStat}:{},...e.now?{now:e.now}:{}})}}}var m=class extends Error{constructor(s,a,l=[]){super(`${s}: ${a}`);this.code=s;this.next=l}};async function ie(e,n,s,a={}){let l=a.deps??{},o=x(e,n);try{let p=o.state.checkpoint??null,w=K(M(e,"sessions",n,y,E)),j=!p&&o.state.agent_state.items.length>0;if(!p&&!w||j)throw new m("SESSION_V1",`session ${n} predates durable checkpoints \u2014 this build cannot resume it; abandon it with kane-cli context sessions clean ${n} and start a fresh run (committed work is untouched)`,[{cmd:`kane-cli context sessions clean ${n}`,why:"abandon the pre-checkpoint session, then start a fresh run"}]);!p&&w&&l.onWarn?.(`session ${n}: checkpoint chain present with no pointer \u2014 recovering from the chain`);let c=A(e,n);c.orphans.length>0&&T(e,n,c.orphans),c.fallback&&l.onWarn?.(`session ${n}: chain truncated to checkpoint ${c.fallback.resumableAt} \u2014 ${c.fallback.turnsLost} turn(s) lost to a corrupt record`);let r=c.base;if(a.verb){let i=Q(r.verb,a.verb,n);if(i)throw new m("WRONG_VERB",i.message,i.next)}if(a.useCase!==void 0&&a.useCase!==r.use_case&&!await(l.confirmRetarget?.(r.use_case,a.useCase)??!1))throw new m("RESUME_RETARGET_DECLINED",r.use_case?`session ${n} was designing ${r.use_case}; resuming onto ${a.useCase} needs an explicit retarget`:`session ${n} has no recorded use-case; adopting ${a.useCase} needs an explicit retarget`,r.use_case?[{cmd:`kane-cli design tests --resume ${n}`,why:`continue on ${r.use_case} (the session's own subject)`}]:[]);let d=c.kane,f=[],H=d?.read_basis??Object.fromEntries(Object.entries(o.state.read_basis));for(let[i,t]of Object.entries(H)){let u=s.heads.get(i)??null;u!==t&&f.push({subject:i,pinned:t,live:u})}r.uc_tip!==void 0&&l.liveUcTip!==void 0&&l.liveUcTip!==r.uc_tip&&f.push({subject:r.use_case??"use-case",pinned:r.uc_tip,live:l.liveUcTip}),l.locks?.reacquire?.(n);let _={...r.run_config,checkpoints:!0};delete _.resume;let R;if(c.pointer===null||c.agent===null)R=_;else{if(!c.agent.base_fingerprint)throw new m("CHECKPOINT_PROTOCOL",`session ${n}: chain carries no base fingerprint \u2014 cannot attest the seed rebuild`);R={..._,resume:{schema:2,binding:c.agent.binding,base_fingerprint:c.agent.base_fingerprint,delta_items:c.agent.delta_items,last_seq:c.pointer.seq}}}let S=d?.pending.questions??[],b=i=>{let t=`resolveq:${n}:${i}`,u=`assumed:${n}:${i}`;return s.appliedEvents.has(t)||s.appliedEvents.has(u)||o.isApplied(t)||o.isApplied(u)},W=d&&S.length>0?S.filter(i=>!b(i.id)):o.state.pending.questions.filter(i=>!b(i.id)),v={redeliverReceipts:[],recommit:[]},h,k;if(d){let i={...d,applied_events:[...new Set([...d.applied_events,...o.state.applied_events])].sort()},t;try{t=I(e,n,i,s,{verb:r.verb==="design"?"design":"extract",...r.use_case?{ucRef:r.use_case}:{},composeReceipt:(g,q,D)=>N(g,q,D),onNote:l.onWarn})}catch(g){throw g instanceof C?new m("CHECKPOINT_PROTOCOL",`store reconciliation refused: ${g.message}`,[{cmd:`kane-cli context sessions clean ${n}`,why:"abandon the session if the store was rebuilt"}]):g}v={redeliverReceipts:t.redeliverReceipts,recommit:t.recommit},k=t.prunedPending;let u=d.pending.proposals??[];h=(u.length>0?u:o.state.pending.proposals).filter(g=>!(typeof g.event_id=="string"&&s.appliedEvents.has(g.event_id))),(t.newlyApplied.length>0||t.prunedPending.length>0)&&o.reconcileSave({appliedEvents:t.newlyApplied,heldReceipts:[...o.state.held_receipts??[],...t.redeliverReceipts],pending:{questions:o.state.pending.questions,proposals:h}})}else{let i=o.state.pending.proposals;k=i.filter(t=>typeof t.event_id=="string"&&s.appliedEvents.has(t.event_id)),h=i.filter(t=>!(typeof t.event_id=="string"&&s.appliedEvents.has(t.event_id)))}return{kind:"v2",handle:o,base:r,view:c,kane:d,spawnConfig:R,drift:f,reconcile:v,questions:W,represent:h,prunedPending:k}}catch(p){throw o.release(),p}}export{Q as a,ne as b,se as c,te as d,m as e,ie as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{g as o,h as a}from"./chunk-
|
|
2
|
+
import{g as o,h as a}from"./chunk-NOLYYHVG.js";import{mkdirSync as p,writeFileSync as f,chmodSync as d,existsSync as m}from"fs";var y={darwin:"https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute",linux:"https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute",win32:"https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe"};function h(s){let t=y[s];if(!t)throw new Error(`unsupported platform for hyperexecute: ${s}`);return t}async function g(s,t={}){let i=t.platform??process.platform,u=t.existsImpl??m,c=t.fetchImpl??(r=>fetch(r)),e=a(s);if(u(e))return{status:"present",path:e};try{let r=h(i),n=await c(r);if(!n.ok)return{status:"failed",path:e,error:`download failed: HTTP ${n.status}`};let l=Buffer.from(await n.arrayBuffer());return p(o(s),{recursive:!0}),f(e,l),d(e,493),{status:"downloaded",path:e}}catch(r){return{status:"failed",path:e,error:r instanceof Error?r.message:String(r)}}}export{h as a,g as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as y}from"./chunk-
|
|
2
|
+
import{a as y}from"./chunk-OH2NSBO6.js";import{createServer as b}from"http";import{createReadStream as C,promises as S}from"fs";import{randomBytes as R}from"crypto";var u="127.0.0.1";function A(n,e){if(!n)return null;let o=/^bytes=(\d*)-(\d*)$/.exec(n.trim());if(!o)return null;let[,a,r]=o;if(a===""&&r==="")return null;if(a===""){let i=Number(r);return i===0||e===0?"unsatisfiable":{start:Math.max(0,e-i),end:e-1}}let t=Number(a);if(t>=e)return"unsatisfiable";let c=r===""?e-1:Math.min(Number(r),e-1);return c<t?null:{start:t,end:c}}async function I(n){let e=R(16).toString("hex"),o=b((r,t)=>{H(r,t,n,e).catch(()=>t.destroy())});await new Promise((r,t)=>{o.once("error",t),o.listen(n.port??0,u,()=>{o.removeListener("error",t),r()})});let a=o.address().port;return{port:a,urlFor:r=>`http://${u}:${a}/${e}/${encodeURIComponent(r)}`,close:()=>new Promise(r=>{o.close(()=>r()),o.closeAllConnections()})}}async function H(n,e,o,a){let r=n.url??"/",t=s=>{try{o.log?.("warn","EVIDENCE_SERVE_DENIED",{reason:s,path:r})}catch{}};if(n.headers.host!==`${u}:${n.socket.localPort}`){t("host_mismatch"),e.writeHead(403).end();return}let c=n.headers.origin;if(c!==void 0&&!o.allowedOrigins.includes(c)){t("origin_denied"),e.writeHead(403).end();return}let i=c?{"Access-Control-Allow-Origin":c,Vary:"Origin","Access-Control-Expose-Headers":"Content-Range, Content-Length"}:{};if(n.method==="OPTIONS"){let s={...i,"Access-Control-Allow-Methods":"GET, HEAD, OPTIONS","Access-Control-Allow-Headers":"range","Access-Control-Max-Age":"86400"};n.headers["access-control-request-private-network"]==="true"&&(s["Access-Control-Allow-Private-Network"]="true"),e.writeHead(204,s).end();return}if(n.method!=="GET"&&n.method!=="HEAD"){e.writeHead(405,i).end();return}let v;try{let s=new URL(n.url??"/",`http://${u}`).pathname.split("/");if(s.length!==3||s[1]!==a){t("bad_token"),e.writeHead(404,i).end();return}v=decodeURIComponent(s[2])}catch{t("not_found"),e.writeHead(404,i).end();return}let g=o.packs.get(v);if(!g){t("not_found"),e.writeHead(404,i).end();return}let d;try{let s=await S.stat(g);if(!s.isFile())throw new Error("not a file");d=s.size}catch{t("not_found"),e.writeHead(404,i).end();return}let h={...i,"Accept-Ranges":"bytes","Content-Type":"application/zip","Cache-Control":"no-store"};if(n.method==="HEAD"){e.writeHead(200,{...h,"Content-Length":String(d)}).end();return}let l=A(n.headers.range,d);if(l==="unsatisfiable"){t("unsatisfiable"),e.writeHead(416,{...i,"Content-Range":`bytes */${d}`}).end();return}let[m,p,w]=l===null?[0,d-1,200]:[l.start,l.end,206],E={...h,"Content-Length":String(p-m+1)};if(w===206&&(E["Content-Range"]=`bytes ${m}-${p}/${d}`),e.writeHead(w,E),d===0){e.end();return}let f=C(g,{start:m,end:p});f.on("error",()=>e.destroy()),e.on("close",()=>f.destroy()),f.pipe(e)}function O(n,e){return(e??y(n).evidenceViewerUrl).replace(/\/+$/,"")}function k(n,e){return`${e}/?pack=${encodeURIComponent(n)}`}function P(n){return`evidence: view locally with \`kane-cli evidence serve ${n}\``}export{A as a,I as b,O as c,k as d,P as e};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{d as W}from"./chunk-MSGW4JDG.js";import{d as U,e as F}from"./chunk-4JOD47QI.js";import{a as H}from"./chunk-
|
|
3
|
-
`));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var K=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*K)return null;let t=Math.min(ct,Math.floor(i/K)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function L(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:h}=await e.read();if(c)break;h&&(n.push(h),r+=h.length,t?.(h.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var z=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,h=null,b=!1;try{await Promise.all(e.map(async(f,M)=>{let P=0,V=d=>{P+=d,a+=d,n?.(a)},T=()=>{a=Math.max(0,a-P),P=0},R=null;for(let d=0;d<z;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${f.start}-${f.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,M===0?h=await L(p,I=>{$(),V(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=f.end-f.start+1,E=await L(p,I=>{$(),V(I)});if(E.length!==D)throw new Error(`range ${f.start}-${f.end} returned ${E.length} bytes (expected ${D})`);o.set(E,f.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;T(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${f.start}-${f.end} failed after ${z} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --target <emulator|simulator> --install\`.`)}))}catch(f){throw c.abort(),f}return h||(b?null:o)}async function ht(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return L(o,e&&(c=>{a+=c,e(a)}))}function ft(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function A(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:H,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-
|
|
2
|
+
import{d as W}from"./chunk-MSGW4JDG.js";import{d as U,e as F}from"./chunk-4JOD47QI.js";import{a as H}from"./chunk-B2ZGG7WM.js";import{createHash as Y}from"crypto";import{access as Q,mkdir as S,mkdtemp as Z,readdir as O,readFile as y,rename as N,rm as v,writeFile as x}from"fs/promises";import{homedir as tt}from"os";import{arch as et,platform as st}from"process";import{dirname as C,isAbsolute as nt,join as l,relative as X,resolve as rt,sep as it}from"path";var q=1,ot={emulator:"emulator",simulator:"simulator"};function Pt(i){return ot[i.kind]??null}var j=class extends Error{constructor(s,e,n){super([`Managed mobile dependencies for ${s} are not installed.`,`- kaneai-mobile-deps ${s} ${e.bundleVersion}: ${e.url} (${_(e.bytes)})`,`Destination: ${n}`,`Run \`kane-cli doctor --target ${s} --install\` to download it.`].join(`
|
|
3
|
+
`));this.deviceClass=s;this.name="DepsInstallRequiredError"}};function _(i){return i>=1024*1024?`${Math.ceil(i/(1024*1024))} MB`:`${i} bytes`}function at(i){let t=i/1048576;return t>=10?`${Math.round(t)} MB/s`:t>=1?`${t.toFixed(1)} MB/s`:`${Math.max(1,Math.round(i/1024))} KB/s`}function lt(i){let t=Math.max(1,Math.round(i));return t<60?`~${t}s left`:`~${Math.floor(t/60)}m ${t%60}s left`}var K=8*1024*1024,ct=8;function ut(i){if(!Number.isFinite(i)||i<2*K)return null;let t=Math.min(ct,Math.floor(i/K)),s=Math.ceil(i/t),e=[];for(let n=0;n<i;n+=s)e.push({start:n,end:Math.min(n+s,i)-1});return e}async function L(i,t){let s=i.body;if(!s||typeof s.getReader!="function"){let c=new Uint8Array(await i.arrayBuffer());return t?.(c.length),c}let e=s.getReader(),n=[],r=0;for(;;){let{done:c,value:h}=await e.read();if(c)break;h&&(n.push(h),r+=h.length,t?.(h.length))}let o=new Uint8Array(r),a=0;for(let c of n)o.set(c,a),a+=c.length;return o}var z=3,dt=3e4,k=class extends Error{};async function pt(i,t,s,e,n,r=dt){let o=new Uint8Array(s),a=0,c=new AbortController,h=null,b=!1;try{await Promise.all(e.map(async(f,M)=>{let P=0,V=d=>{P+=d,a+=d,n?.(a)},T=()=>{a=Math.max(0,a-P),P=0},R=null;for(let d=0;d<z;d+=1){if(c.signal.aborted)return;let u=new AbortController,m=()=>u.abort();c.signal.addEventListener("abort",m,{once:!0});let w=!1,g=null,$=()=>{g&&clearTimeout(g),g=setTimeout(()=>{w=!0,u.abort()},r)};try{$();let p=await i(t,{headers:{Range:`bytes=${f.start}-${f.end}`},signal:u.signal});if(typeof p.body?.getReader!="function"&&g&&(clearTimeout(g),g=null),!p.ok)throw new k(`Could not download ${t}: HTTP ${p.status}`);if(p.status!==206){b=!0,M===0?h=await L(p,I=>{$(),V(I)}):await(p.body?.cancel().catch(()=>{})??Promise.resolve());return}let D=f.end-f.start+1,E=await L(p,I=>{$(),V(I)});if(E.length!==D)throw new Error(`range ${f.start}-${f.end} returned ${E.length} bytes (expected ${D})`);o.set(E,f.start);return}catch(p){if(p instanceof k)throw p;if(c.signal.aborted)return;T(),R=w?new Error(`no data for ${Math.round(r/1e3)}s`):p instanceof Error?p:new Error(String(p))}finally{g&&clearTimeout(g),c.signal.removeEventListener("abort",m)}}throw new Error(`Could not download ${t}: range ${f.start}-${f.end} failed after ${z} attempts (${R?.message??"unknown error"}) \u2014 check your network and rerun \`kane-cli doctor --target <emulator|simulator> --install\`.`)}))}catch(f){throw c.abort(),f}return h||(b?null:o)}async function ht(i,t,s,e,n){let r=ut(s);if(r){let c=await pt(i,t,s,r,e,n?.stallMs);if(c)return c}let o=await i(t);if(!o.ok)throw new Error(`Could not download ${t}: HTTP ${o.status}`);let a=0;return L(o,e&&(c=>{a+=c,e(a)}))}function ft(i){return Y("sha256").update(i).digest("hex")}function mt(i,t){let s=X(i,t);return s!==""&&!s.startsWith(`..${it}`)&&s!==".."&&!nt(s)}async function A(i){try{return await Q(i),!0}catch{return!1}}function wt(){return{home:tt(),os:st,arch:et,cliVersion:H,nodeModuleVersion:process.versions.modules,fetch,resolveBundle:async i=>(await import("./deps-resolve-6F2U4TJP.js")).controllerResolveBundle()(i),exec:U,now:()=>new Date,wait:F,processAlive:i=>{try{return process.kill(i,0),!0}catch{return!1}}}}var B=class extends Error{constructor(s,e,n){super(`No managed mobile dependencies are published for ${s} (kane-cli ${e}).
|
|
4
4
|
This is a packaging gap, not something to install locally \u2014 report it, or pass --appium-url to use an Appium server you manage yourself.`);this.coordinate=s;this.cause=n;this.name="NoPublishedBundleError"}},J=class i{deps;constructor(t={}){this.deps={...wt(),...t}}mobileRoot(){return l(this.deps.home,".testmuai","kaneai","mobile")}depsRoot(){return l(this.mobileRoot(),"deps")}classRoot(t,s){return l(this.depsRoot(),s,t)}resolveCacheFile(){return l(this.depsRoot(),"resolve-cache.json")}resolveCacheKey(t){return`${this.deps.cliVersion}|${this.deps.os}-${this.deps.arch}-${t}`}static RESOLVE_CACHE_TTL_MS=1440*60*1e3;async readCachedWantedVersion(t){try{let e=JSON.parse(await y(this.resolveCacheFile(),"utf8"))[this.resolveCacheKey(t)];if(!e?.bundleVersion||!e.fetchedAt)return null;let n=this.deps.now().getTime()-new Date(e.fetchedAt).getTime();return n>=0&&n<i.RESOLVE_CACHE_TTL_MS?e.bundleVersion:null}catch{return null}}async writeResolveCache(t,s){try{let e={};try{e=JSON.parse(await y(this.resolveCacheFile(),"utf8"))}catch{}e[this.resolveCacheKey(t)]={bundleVersion:s,fetchedAt:this.deps.now().toISOString()},await S(this.depsRoot(),{recursive:!0}),await x(this.resolveCacheFile(),`${JSON.stringify(e,null,2)}
|
|
5
5
|
`)}catch{}}async warmResolveCache(t){if(await this.readCachedWantedVersion(t)===null)try{await this.resolveOrExplain(t)}catch{}}paths(t,s){let e=this.classRoot(t,s);return{root:e,appium:l(e,"appium"),appiumHome:l(e,"appium-home"),platformTools:l(e,"platform-tools"),wdaDir:l(e,"wda","Build","Products","Debug-iphonesimulator"),iwdpBinDir:l(e,"bin"),installManifest:l(e,"install-manifest.json")}}async status(t,s){s||(s=await this.readCachedWantedVersion(t)??void 0);let e=[];try{e=await O(this.depsRoot())}catch{}s&&(e=e.filter(c=>c===s));let n=null;for(let c of e){let h=this.classRoot(t,c),b=null;try{b=JSON.parse(await y(l(h,"install-manifest.json"),"utf8"))}catch{continue}b.schemaVersion===q&&(!s&&b.cliVersion!==this.deps.cliVersion||(!n||b.installedAt>n.manifest.installedAt)&&(n={manifest:b,root:h}))}if(!n)return{class:t,installed:!1};let r=this.paths(t,n.manifest.bundleVersion),o=[l(r.appium,"node_modules","appium","index.js")];t==="emulator"&&o.push(l(r.platformTools,this.deps.os==="win32"?"adb.exe":"adb")),t==="simulator"&&o.push(l(r.wdaDir,"WebDriverAgentRunner-Runner.app"));for(let c of o)if(!await A(c))return{class:t,installed:!1,version:n.manifest.bundleVersion,root:n.root,corrupt:`a bundle component is missing from disk (${X(n.root,c)})`};let a=await this.postInstallDrifted(r);return{class:t,installed:!0,version:n.manifest.bundleVersion,root:n.root,...a?{needsRepair:a}:{}}}async postInstallDrifted(t){let s=l(t.appiumHome,"node_modules",".cache","appium","extensions.yaml");if(!await A(s))return!1;let e=await y(s,"utf8");for(let n of e.split(`
|
|
6
6
|
`)){let r=/^\s*installPath:\s*(.+?)\s*$/.exec(n);if(r&&!r[1].startsWith(t.appiumHome))return!0}return!1}async environment(t){let s=await this.status(t);if(!s.installed||!s.version)return{dirs:[]};let e=this.paths(t,s.version),n=[],r={dirs:n,appiumHome:e.appiumHome};return t!=="simulator"&&(n.push(e.platformTools),r.platformToolsDir=e.platformTools),n.push(l(e.appium,"node_modules",".bin")),t==="simulator"&&(n.push(e.iwdpBinDir),r.wdaDir=e.wdaDir,r.wdaRoot=l(e.root,"wda"),r.iwdpBinDir=e.iwdpBinDir),r}async ensure(t,s){let e,n;try{e=await this.resolveOrExplain(t)}catch(a){n=a}let r=await this.status(t,e?.bundleVersion);if(r.installed&&!r.needsRepair)return e&&r.version&&await this.adoptInstall(t,r.version),r;if(!e)throw n;if(r.installed&&r.needsRepair&&r.version){let a=this.paths(t,r.version);return await this.withInstallLock(async()=>{await this.postInstall(a.root,a,s.onProgress)}),await this.adoptInstall(t,r.version),this.status(t,e.bundleVersion)}let o=e;if(!s.automatic&&!s.approved)throw new j(t,o,this.classRoot(t,o.bundleVersion));return await this.withInstallLock(async()=>{(await this.status(t,o.bundleVersion)).installed||await this.install(t,o,s.onProgress)}),this.status(t,o.bundleVersion)}async adoptInstall(t,s){try{let e=this.paths(t,s).installManifest,n=JSON.parse(await y(e,"utf8"));if(n.cliVersion===this.deps.cliVersion)return;n.cliVersion=this.deps.cliVersion;let r=l(C(e),`install-manifest-${process.pid}.json`);await x(r,`${JSON.stringify(n,null,2)}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as ee,d as te,h as D,i as ne,j as re,k as U,l as ie,m as se,n as oe,o as R,p as ae,q as H,r as he,s as ge,t as _e}from"./chunk-22QIVSQR.js";import{a as me}from"./chunk-CH273NAE.js";import{d as V}from"./chunk-LBNADEQN.js";import{C as $,e as pe,f as fe}from"./chunk-GP7WD4UY.js";import{H as M,M as T,P as le,X as O,c as de,m as L,u as ue,x as I,z as P}from"./chunk-3N6IAVD5.js";import{d as x,f as ce}from"./chunk-AKX4VRRR.js";import{appendFileSync as Ie,closeSync as Oe,existsSync as S,fsyncSync as Ce,openSync as Ne,readdirSync as je,readFileSync as k,renameSync as Fe,writeFileSync as J}from"fs";import{dirname as Q,isAbsolute as G,join as F,resolve as q}from"path";var Re=new Set(["inline","testmd","testrun"]),Le=new Set(["inferred","authored","runtime-derived"]),B=new Set(["passed","failed","broken","skipped"]);function ye(t,e,n){if(n.facts.length===0)return{record:null,errors:[{code:"EMPTY_EXECUTIONS",detail:"a run with no designed units attaches no facts \u2014 skip the call"}]};let o=e;for(let a=0;;a++){let c=M(t);if(o.latestHash!==c){if(a>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:`graph opened at ${String(o.latestHash)} but chain head is ${String(c)} \u2014 retry budget exhausted`}]};o=$(t);continue}let d=Te(t,o,n);if(d!=="cas")return d;if(a>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:"concurrent appends kept moving the head \u2014 retry budget exhausted"}]};o=$(t)}}function ve(t,e){return Re.has(t.mode)?B.has(t.verdict)?Le.has(t.oracle_mode)?typeof t.drift_flag!="boolean"||typeof t.stale_at_run!="boolean"?[{code:"MISSING_FIELD",detail:`${e}: drift_flag and stale_at_run are required booleans`}]:!t.execution_id||!t.started_at||!t.definition_id_at_run?[{code:"MISSING_FIELD",detail:`${e}: execution_id, started_at and definition_id_at_run are required`}]:[]:[{code:"BAD_ORACLE_MODE",detail:`${e}: oracle_mode '${t.oracle_mode}' not in inferred|authored|runtime-derived`}]:[{code:"BAD_VERDICT",detail:`${e}: verdict '${t.verdict}' not in ${[...B].join("|")}`}]:[{code:"BAD_MODE",detail:`${e}: mode '${t.mode}' not in inline|testmd|testrun`}]}function be(t,e,n,o){return{about:e,definition_id_at_run:t.definition_id_at_run,verdict:t.verdict,...n&&n.length?{per_ac:n}:{},drift_flag:t.drift_flag,oracle_mode:t.oracle_mode,stale_at_run:t.stale_at_run,...o.length?{unresolved_acs:o}:{},execution_id:t.execution_id,...t.evidence_id?{evidence_id:t.evidence_id}:{},...t.duration_ms!==void 0?{duration_ms:t.duration_ms}:{},started_at:t.started_at,mode:t.mode,local:t.local,...t.via_parent?{via_parent:t.via_parent}:{}}}function Ee(t,e,n={}){if(!Array.isArray(e.facts)||e.facts.length===0)return{record:null,errors:[{code:"EMPTY_EXECUTIONS",detail:"parked line carries no facts"}]};for(let o=0;;o++){let a=$(t),c=e.facts.filter(s=>a.appliedEvents.has(s.event_id)).map(s=>s.event_id),d=e.facts.filter(s=>!a.appliedEvents.has(s.event_id));if(d.length===0)return{record:null,errors:null,applied:[],skipped:c,rejected:[]};let l=[],i=[],g=[],m=[];for(let s of d){let r=`executions[${s.ref}]`,u=[];if(!s.about_cid||!a.hasNode(s.about_cid))u.push({code:"UNKNOWN_REF",detail:`${r}: about_cid '${String(s.about_cid)}' is not in the graph \u2014 the pinned run-time target is gone`});else if(a.nodeLabel.get(s.about_cid)!==x.TEST)u.push({code:"ILLEGAL_TARGET",detail:`${r}: execution facts attach to tests \u2014 '${s.about_cid}' is a ${a.nodeLabel.get(s.about_cid)}`});else if(!s.event_id)u.push({code:"MISSING_FIELD",detail:`${r}: parked facts require event_id`});else{u.push(...ve(s,r));for(let h of s.per_ac??[])B.has(h.verdict)||u.push({code:"BAD_VERDICT",detail:`${r}.per_ac['${h.ac_ref}']: verdict '${h.verdict}'`})}if(u.length>0){l.push({event_id:s.event_id??"",errors:u});continue}let p=[],f=[],_=[...s.unresolved_acs??[]];for(let h of s.per_ac??[]){let b=h.ac_cid&&a.hasNode(h.ac_cid)&&a.nodeLabel.get(h.ac_cid)===x.AC?h.ac_cid:null,y=b?null:a.resolve(h.ac_ref),E=b??(y?a.tipOf(y.cid):null);if(!E||!b&&(a.superseded.has(E)||a.nodeLabel.get(E)!==x.AC)){_.push(h.ac_ref);continue}p.push({ac_ref:a.nameOf.get(E)??h.ac_ref,ac_cid:E,verdict:h.verdict}),f.push(E)}i.push(be(s,s.about_cid,p,_)),m.push({about_cid:s.about_cid,per_ac:f}),g.push(s.event_id)}if(i.length===0)return{record:null,errors:null,applied:[],skipped:c,rejected:l};try{let s=T(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:i,event_ids:[...g].sort(),source_head_moves:{}},{expectPrev:a.latestHash,intent:{v:1,verb:"parked",args:L({line:e}),pins:{facts:m}},busyRetry:{deadlineMs:5e3},provenance:n.provenance}),r;try{O(t)}catch(u){r=`parked facts committed, but the projection refresh failed (${u instanceof Error?u.message:String(u)}) \u2014 read state rebuilds on the next open`}return{record:s.record,errors:null,applied:g,skipped:c,rejected:l,...r?{warnings:[r]}:{}}}catch(s){if(!(s instanceof I))throw s;if(o>=3)return{record:null,errors:[{code:"STALE_BASIS",detail:"concurrent appends kept moving the head \u2014 parked replay retry budget exhausted (line stays queued)"}]}}}}function Te(t,e,n){let o=[],a=[],c=[];for(let i of n.facts){let g=`executions[${i.ref}]`,m=n.pinned?null:e.resolve(i.ref),s=n.pinned?i.about_cid&&e.hasNode(i.about_cid)?i.about_cid:null:m?e.tipOf(m.cid):null;if(!s||!n.pinned&&e.superseded.has(s)){o.push({code:"UNKNOWN_REF",detail:`${g}: '${n.pinned?String(i.about_cid):i.ref}' is not a ${n.pinned?"":"live "}committed node`});continue}if(e.nodeLabel.get(s)!==x.TEST){o.push({code:"ILLEGAL_TARGET",detail:`${g}: execution facts attach to tests \u2014 '${i.ref}' is a ${e.nodeLabel.get(s)}`});continue}let r=ve(i,g);if(r.length>0){o.push(...r);continue}let u=[],p=[];for(let f of i.per_ac??[]){let _=n.pinned?null:e.resolve(f.ac_ref),h=n.pinned?f.ac_cid&&e.hasNode(f.ac_cid)?f.ac_cid:null:_?e.tipOf(_.cid):null;if(!h||!n.pinned&&e.superseded.has(h)||e.nodeLabel.get(h)!==x.AC){o.push({code:"UNKNOWN_REF",detail:`${g}.per_ac: '${n.pinned?String(f.ac_cid):f.ac_ref}' is not a${n.pinned?"n":" live"} AC`});continue}if(!B.has(f.verdict)){o.push({code:"BAD_VERDICT",detail:`${g}.per_ac['${f.ac_ref}']: verdict '${f.verdict}'`});continue}u.push({ac_ref:e.nameOf.get(h)??h,ac_cid:h,verdict:f.verdict}),p.push(h)}a.push(be(i,s,u,i.unresolved_acs??[])),c.push({about_cid:s,per_ac:p})}if(o.length>0)return{record:null,errors:o};let d;try{d=T(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],executions:a,...n.eventIds&&n.eventIds.length>0?{event_ids:n.eventIds}:{},source_head_moves:{}},{expectPrev:e.latestHash,intent:{v:1,verb:"execution",args:L({facts:n.facts,by:n.by,eventIds:n.eventIds??null}),pins:{facts:c}},busyRetry:{deadlineMs:n.lockDeadlineMs??5e3},provenance:n.provenance})}catch(i){if(i instanceof I)return"cas";throw i}let l;try{O(t)}catch(i){l=`facts committed, but the projection refresh failed (${i instanceof Error?i.message:String(i)}) \u2014 read state rebuilds on the next open`}return{record:d.record,errors:null,...l?{warnings:[l]}:{}}}function pt(t){let e={failed:3,broken:2,skipped:1,passed:0},n=new Map;for(let o of t)for(let a of o.verifies??[]){let c=n.get(a);(c===void 0||(e[o.status]??0)>(e[c]??0))&&n.set(a,o.status)}return[...n.entries()].map(([o,a])=>({ref:o,verdict:a}))}function ft(t){let e=[],n=me(t.cwd);if(!S(n))return{synced:0,superseded:0,skipped:"no-context",warnings:e};let o=t.by??{kind:"ai",id:"exec-sync"},a=t.lockDeadlineMs;try{Pe(n,e,a)}catch(r){e.push(`sync: parked-facts replay failed (${r instanceof Error?r.message:String(r)}) \u2014 queue intact, retrying next sync`)}let c=$(n),d=[],l=0,i=new Set,g=new Set(t.members.map(r=>G(r.path)?r.path:q(t.cwd,r.path))),m=new Map;for(let r of t.members){let u=G(r.path)?r.path:q(t.cwd,r.path);if(!S(u)){e.push(`sync: member file missing: ${u} \u2014 skipped, no fact attached`);continue}for(let p of Me(u,e))if(!i.has(p.path))try{let f=p.path===u,_=!f&&g.has(p.path),h=f?void 0:R(k(u,"utf8"))?.id,b=k(p.path,"utf8"),y=R(b);if(!y?.id){i.add(p.path);continue}let E=c.resolve(y.id),w=E?c.tipOf(E.cid):null;if(!E||!w||c.superseded.has(w)){i.add(p.path),e.push(`sync: ${y.id} does not resolve to a live test \u2014 skipped (foreign store?)`);continue}let C=D(U(b,se(Q(p.path),c))),Ae=String(c.getNode(w)?.content.test_md_blob??""),N=D(U(Ae,ie(c))),A=!1,j=w;if(C===N)y.base!==N&&xe(p.path,b,N,e);else if(y.base===N){let v=Ge(n,c,w,b,C,Q(p.path),o);v.error?(e.push(`sync: could not supersede ${y.id}: ${v.error}`),A=!0):(l++,j=v.newCid,A=v.oracleTier,xe(p.path,k(p.path,"utf8"),C,e),c=$(n))}else A=!0,e.push(y.base?`sync: ${y.id} was edited from an older version \u2014 graph kept; reconcile via a redesign or maintain`:`sync: ${y.id} carries no base pin (hand-copied file?) \u2014 fact attached with drift flag`);if(_){A&&m.set(p.path,!0);continue}i.add(p.path);let K=c.getNode(j)?.content.check,z=f?r.acs??[]:[],X=z.filter(v=>Se(c,v.ref)),Y=z.filter(v=>!Se(c,v.ref)).map(v=>v.ref);d.push({ref:y.id,about_cid:j,definition_id_at_run:C,verdict:r.verdict,...X.length?{per_ac:X.map(v=>{let Z=we(c,v.ref);return{ac_ref:v.ref,...Z?{ac_cid:Z}:{},verdict:v.verdict}})}:{},drift_flag:A||m.get(p.path)===!0||f&&r.driftFlag===!0,oracle_mode:K?.expected_mode??(ee(K?.operand)?"runtime-derived":"inferred"),stale_at_run:c.stale(j)!=="fresh",...Y.length?{unresolved_acs:Y}:{},execution_id:r.executionId,...r.evidenceId?{evidence_id:r.evidenceId}:{},...r.durationMs!==void 0?{duration_ms:r.durationMs}:{},started_at:r.startedAt,mode:r.mode,local:r.local,...h?{via_parent:h}:{}})}catch(f){p.path!==u&&g.has(p.path)||i.add(p.path),e.push(`sync: ${p.path} failed to sync (${f instanceof Error?f.message:String(f)}) \u2014 skipped; other members unaffected`)}}if(d.length===0)return{synced:0,superseded:l,warnings:e};let s;try{s=ye(n,$(n),{facts:d,by:o,eventIds:d.map(r=>`exec-fact:${r.execution_id}:${r.ref}`),lockDeadlineMs:a})}catch(r){return e.push(`sync facts: commit threw: ${r instanceof Error?r.message:String(r)}`),$e(n,d,o,e,a),{synced:0,superseded:l,warnings:e}}return s.errors?($e(n,d,o,e,a),e.push(...s.errors.map(r=>`sync facts: ${r.code}: ${r.detail}`)),{synced:0,superseded:l,warnings:e}):(s.warnings&&e.push(...s.warnings.map(r=>`sync facts: ${r}`)),{synced:d.length,superseded:l,warnings:e})}var W=".pending-facts.bad";function $e(t,e,n,o,a){try{let c={by:n,ts:new Date().toISOString(),facts:e.map(i=>({...i,about_cid:i.about_cid??"",event_id:`exec-fact:${i.execution_id}:${i.ref}`}))},d=null;try{d=P(t,{deadlineMs:a??5e3})}catch{d=null}let l=F(t,H);try{if(d)Ie(l,JSON.stringify(c)+`
|
|
3
|
+
`);else{l=F(t,ge());let i=Ne(l,"wx");try{J(i,JSON.stringify(c)+`
|
|
4
|
+
`),Ce(i)}finally{Oe(i)}le(t),o.push(`sync facts: store lock busy \u2014 parked to ${l}; it drains on the next sync`)}}finally{d?.()}o.push(`sync facts: commit failed \u2014 ${e.length} fact(s) parked to ${l}; they replay on the next sync`)}catch(c){o.push(`sync facts: could not park the failed batch (${c instanceof Error?c.message:String(c)}) \u2014 this run's facts are LOST`)}}function Pe(t,e,n){let o=F(t,H);if(!S(o)&&!je(t).some(m=>he.test(m)))return;let a=ue(t);if(a){e.push(`sync: parked facts stay queued while rebase ${a.id} is open \u2014 they drain on the first sync after it is finished`);return}let c;{let m=P(t,{deadlineMs:n??5e3});try{_e(t),c=S(o)?k(o,"utf8"):""}finally{m()}}let d=c.split(`
|
|
5
|
+
`).filter(m=>m.trim()!=="");if(d.length===0)return;let l=new Set,i=[],g=[];for(let m of d){let s=null;try{let u=JSON.parse(m);u&&Array.isArray(u.facts)&&(s=u)}catch{}if(!s){i.push(m),l.add(m);continue}let r=Ee(t,s);if(r.errors){if(r.errors.some(u=>u.code==="STALE_BASIS")){e.push(`sync: parked facts replay deferred (${r.errors[0].detail}) \u2014 retrying next sync`);continue}i.push(m),l.add(m),e.push(`sync: parked facts line quarantined to ${F(t,W)} (${r.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")})`);continue}for(let u of r.rejected){let p=s.facts.find(f=>f.event_id===u.event_id);g.push({parent:m,line:JSON.stringify({...p??{event_id:u.event_id},_reason:u.errors})})}r.rejected.length>0&&e.push(`sync: ${r.rejected.length} parked fact(s) quarantined to ${F(t,W)} (${r.rejected.map(u=>u.errors.map(p=>`${p.code}: ${p.detail}`).join("; ")).join(" | ")})`),l.add(m),r.warnings&&e.push(...r.warnings.map(u=>`sync: ${u}`)),r.applied.length>0&&e.push(`sync: replayed ${r.applied.length} parked fact(s) from a previous run`)}if(l.size!==0)try{let m=P(t,{deadlineMs:n??5e3});try{let r=(S(o)?k(o,"utf8"):"").split(`
|
|
6
|
+
`).filter(_=>_.trim()!==""),u=[...i.filter(_=>r.includes(_)),...g.filter(_=>r.includes(_.parent)).map(_=>_.line)];u.length>0&&Ie(F(t,W),u.map(_=>_+`
|
|
7
|
+
`).join(""));let p=r.filter(_=>!l.has(_)),f=`${o}.tmp.${process.pid}`;J(f,p.length>0?p.join(`
|
|
8
|
+
`)+`
|
|
9
|
+
`:""),Fe(f,o)}finally{m()}}catch(m){e.push(`sync: queue rewrite failed (${m instanceof Error?m.message:String(m)}) \u2014 already-applied lines dedupe next sync; bad lines re-quarantine then`)}}function Me(t,e){let n=[],o=new Set,a=c=>{if(o.has(c)||!S(c))return;o.add(c);let d;try{d=k(c,"utf8")}catch(l){e.push(`sync: unreadable unit ${c} (${l instanceof Error?l.message:String(l)}) \u2014 skipped`);return}for(let l of d.split(`
|
|
10
|
+
`)){let i=/^@import\s+(\S+)\s*$/.exec(l.trim());if(!i)continue;let g=G(i[1])?i[1]:q(Q(c),i[1]);if(!S(g))continue;let m;try{m=k(g,"utf8")}catch(s){e.push(`sync: unreadable import ${g} (${s instanceof Error?s.message:String(s)}) \u2014 skipped; importer continues`);continue}R(m)?.id&&a(g)}n.push({path:c})};return a(t),n}function Se(t,e){return we(t,e)!==null}function we(t,e){let n=t.resolve(e),o=n?t.tipOf(n.cid):null;return n&&o&&!t.superseded.has(o)&&t.nodeLabel.get(o)==="ac"?o:null}function Be(t,e,n,o){let a=t.split(`
|
|
11
|
+
`),c=re(a),d={};return{blob:a.map((i,g)=>{let m=ne.exec(i.trim());if(!m||c.has(g))return i;let s=m[1];if(o&&s in o){let _=n.tipOf(o[s]);d[s]=_;let h=n.displayNameOf(_);return h?`@import ${h}`:i}let r=n.resolve(s);if(r)return d[s]=r.tip,i;let u=G(s)?s:q(e,s);if(!S(u))return i;let p=R(k(u,"utf8"))?.id,f=p?n.resolve(p):null;return!p||!f?i:(d[s]=f.tip,`@import ${p}`)}).join(`
|
|
12
|
+
`),imports:d}}function Ge(t,e,n,o,a,c,d,l={}){let i=e.getNode(n);if(!i)return{oracleTier:!1,error:"tip unreadable"};let{blob:g,imports:m}=Be(ae(o),c,e,l.imports),s=String(i.content.test_md_blob??""),r=/^#\s+(.+?)\s*$/m.exec(g)?.[1]??String(i.content.title??""),u={...i.content,test_md_blob:g,definitionId:a,title:r};{let y=qe(g);y.target!==void 0?u.target=y.target:delete u.target,y.app!==void 0?u.app=y.app:delete u.app}let p=ce("test",u);if(p.length>0)return{oracleTier:!1,error:p.map(y=>y.detail).join("; ")};let f=de("test",u);if(f===n)return{newCid:n,oracleTier:!1};let _=ke(s)!==ke(g);if(pe(e,n,f))return{oracleTier:_,error:"file content reproduces an already-superseded version (supersession cycle guard) \u2014 graph kept; re-edit forward or redesign"};let h=fe({graph:e,oldTip:n,newCid:f,newLabel:"test",by:d,reason:`re-blessed onto ${f} (edited on disk, run sync)`});if(h.errors.length>0)return{oracleTier:_,error:`edge re-bless refused: ${h.errors.join("; ")}`};let b=M(t);if(e.latestHash!==b){if(l.throwTransient)throw new I(`store advanced under the sync (basis ${String(e.latestHash)} vs head ${String(b)})`);return{oracleTier:_,error:`store advanced under the sync (basis ${String(e.latestHash)} vs head ${String(b)}) \u2014 re-run to retry`}}try{T(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:f,label:"test",content:u}],edges:h.edges,review:[{id:f,kind:"review-item",resolution:"edited",edit:null,reason:"edited on disk (run sync)",by:d}],supersessions:[{kind:"node",old:n,new:f,reason:"edited on disk (run sync)",by:d},...h.supersessions],source_head_moves:{}},{expectPrev:b,intent:{v:1,verb:"exec-supersede",args:L({tip:n,raw:o,fileId:a,by:d}),pins:{tip:n,imports:m}},provenance:l.provenance})}catch(y){if(l.throwTransient&&y instanceof I)throw y;return{oracleTier:_,error:y instanceof Error?y.message:String(y)}}return O(t),{newCid:f,oracleTier:_}}function qe(t){let e=te(t);return{...typeof e.target=="string"?{target:e.target}:{},...typeof e.app=="string"?{app:e.app}:{}}}function ke(t){let e=[],n=t.split(`
|
|
13
|
+
`),o=n.some(c=>/^##\s/.test(c)&&V.test(c)),a=!1;for(let c of n){if(/^##\s/.test(c)){let d=V.exec(c);a=o?d!==null:/\bassert\b/i.test(c),d&&e.push(`v:${d[1].trim()}`);continue}a&&c.trim()!==""&&e.push(c.trim())}return e.join(`
|
|
14
|
+
`)}var Ve=0;function xe(t,e,n,o){try{let a=e.split(`
|
|
15
|
+
`),c=-1;if(a[0]?.trim()==="---"){for(let i=1;i<a.length;i++)if(a[i].trim()==="---"){c=i;break}}if(c<0)return;let d=oe(a,c);if(!d)return;if(d.baseLine!==void 0){let i=a[d.baseLine].endsWith("\r")?"\r":"";a[d.baseLine]=`${d.childIndent}base: ${n}${d.baseComment?` ${d.baseComment}`:""}${i}`}else if(d.strayBase){o.push(`sync: ${t} has a base: line this scanner cannot confidently rewrite (unexpected indentation or key quoting) \u2014 pin refresh skipped (stale pin until the shape is fixed)`);return}else{let g=a[d.idLine??d.start].endsWith("\r")?"\r":"";a.splice((d.idLine??d.start)+1,0,`${d.childIndent??" "}base: ${n}${g}`)}let l=`${t}.tmp-sync.${process.pid}-${Ve++}`;J(l,a.join(`
|
|
16
|
+
`)),Fe(l,t)}catch(a){o.push(`sync: pin refresh failed for ${t} (${a instanceof Error?a.message:String(a)}) \u2014 next run self-heals`)}}export{ye as a,Ee as b,pt as c,ft as d,Ge as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-YCCUBQY4.js";import{a as U}from"./chunk-RBHQXWR7.js";import{a as k}from"./chunk-BPMSNGXQ.js";import{a as _}from"./chunk-OO5GMBVI.js";import{a as T}from"./chunk-OH2NSBO6.js";import{y as i}from"./chunk-B2ZGG7WM.js";import{a as O}from"./chunk-HCBYKLMW.js";import{a as u,b as s}from"./chunk-C44QQJR4.js";import{a as K}from"./chunk-6YGTRKDT.js";import{e as S}from"./chunk-UR6MHSHU.js";var e=S(K(),1);var r=S(O(),1);function V(n,x,c){return{id:n,label:`${x} (${n})`,isActive:n===c}}function se({resolver:n,currentProjectId:x,env:c,onSelect:w,onCancel:C}){let[q,B]=(0,e.useState)([]),[D,l]=(0,e.useState)(!0),[H,m]=(0,e.useState)(!1),[J,g]=(0,e.useState)(!1),[Q,P]=(0,e.useState)(null),[d,p]=(0,e.useState)("list"),[v,R]=(0,e.useState)(""),[E,h]=(0,e.useState)(null),[I,X]=(0,e.useState)(""),b=(0,e.useRef)(!1),A=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(!n){P("Login first to browse projects"),l(!1);return}let o=new AbortController,a=I.trim();return A.current?l(!0):a&&g(!0),m(!0),P(null),(async()=>{try{let t=n.cached??await n.resolve();if(!t){P("Login first to browse projects"),l(!1),m(!1),g(!1);return}let L=T(c),F=new k(L.tmsBaseUrl,t.username,t.access_key),f=!0,N=0,G=a?{signal:o.signal,name:a,perPage:10}:{signal:o.signal,perPage:10};for await(let y of F.listProjectsStream(G)){if(f&&(l(!1),g(!1),A.current=!1,f=!1),y.totalLoaded===0&&y.done&&N===0&&!a){b.current=!0,p("naming"),m(!1);return}let M=y.projects.map(j=>V(j.project_id,j.name,x));B(N===0?M:j=>[...j,...M]),N+=y.projects.length,y.done&&m(!1)}f&&(l(!1),m(!1),g(!1))}catch(t){if(t?.name==="AbortError")return;P(t instanceof Error?t.message:String(t)),l(!1),m(!1),g(!1)}})(),()=>o.abort()},[n,x,c,I]);let Y=(0,e.useCallback)(o=>{let a=o.trim();if(!a){h("Name cannot be empty");return}h(null),p("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let t=n.cached??await n.resolve();if(!t)throw new Error("Not authenticated");let L=T(c),f=await new k(L.tmsBaseUrl,t.username,t.access_key).createProject(a);w(f.id,f.name)}catch(t){h(t instanceof Error?t.message:String(t)),p("naming")}})()},[n,c,w]),z=(0,e.useCallback)(()=>{R(""),h(null),b.current?C():p("list")},[C]);return d==="naming"||d==="creating"?(0,r.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:i.orange,paddingX:2,paddingY:1,children:[(0,r.jsx)(s,{color:i.orange,bold:!0,children:"Create new project"}),b.current&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"No projects yet \u2014 let's create one."})}),(0,r.jsxs)(u,{marginTop:1,children:[(0,r.jsx)(s,{color:i.dim,children:"Name: "}),d==="naming"?(0,r.jsx)($,{value:v,onChange:o=>{R(o),E&&h(null)},onSubmit:Y,onCancel:z}):(0,r.jsx)(s,{children:v})]}),E&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.red,children:E})}),d==="creating"&&(0,r.jsx)(u,{marginTop:1,children:(0,r.jsx)(s,{color:i.dim,children:"Creating..."})}),d==="naming"&&(0,r.jsx)(_,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:b.current?"cancel":"back"})]}):(0,r.jsx)(U,{title:"Projects",items:q,loading:D,loadingMore:H,searching:J,preserveSelectionById:!0,onSearch:X,error:Q,itemNoun:"projects",onTab:()=>{b.current=!1,p("naming")},extraHint:"tab to create new",onSelect:o=>{let a=o.label.replace(` (${o.id})`,"");w(o.id,a)},onCancel:C})}export{V as a,se as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-M7DN6FO3.js";import{f as D}from"./chunk-KOL6ZWOQ.js";import{a as E}from"./chunk-NLCCBXXV.js";function U(e){return["completed","failed","ended","stopped"].includes(e.trim().toLowerCase())}function je(e){return["ended","stopped"].includes(e.trim().toLowerCase())}function q(e){return{requestId:e.requestId,objective:e.objective,status:"",turnActive:!1,scenarios:[],thinking:"",thinkingLog:[],chatLog:[],progress:0}}function Re(e){return e.pendingClarification===void 0?e:{...e,pendingClarification:void 0}}function Ce(e){return{...e,turnActive:!0,error:void 0,thinking:"",thinkingLog:[]}}function P(e,t){switch(t.type){case"thinking":return{...e,status:"thinking",thinking:e.thinking+t.delta};case"thinking_done":return{...e,thinkingLog:[...e.thinkingLog,{text:e.thinking,tookMs:t.tookMs}],thinking:""};case"progress":return{...e,progress:t.pct};case"snapshot":return{...e,scenarios:t.data.scenarios,status:t.data.status,headline:t.data.headline??e.headline};case"chat":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}]};case"clarification":return{...e,turnActive:!1,chatLog:[...e.chatLog,{role:"model",text:t.text}],pendingClarification:t.text};case"limit":return{...e,limits:{scenarioLimit:t.scenarioLimit,perScenarioLimit:t.perScenarioLimit}};case"error":return{...e,error:t.message};case"done":return{...e,status:t.status,turnActive:!1,error:t.status==="failed"&&!e.error?"generation failed":e.error}}}function H(e,t){let n=[],i=e.type??"",d=e.status??"";if(i==="ping")return n;switch(i){case"thinking_token":typeof e.data=="string"&&n.push({type:"thinking",delta:e.data});break;case"thinking_stopped":{let r=e.data??{},o=se(r.time_taken);n.push({type:"thinking_done",text:typeof e.data=="string"?e.data:r.message??"",tookMs:o});break}case"progress":{let r=e.data??{};typeof r.progress=="number"&&n.push({type:"progress",pct:r.progress});break}case"clarification":{let r=e.data??{};typeof r.message=="string"&&n.push({type:"clarification",text:r.message});break}case"chatting_stopped":{let r=e.data??{};typeof r.message=="string"&&r.message.length>0&&n.push({type:"chat",text:r.message});break}case"limit_update":{let r=e.data??{},o=r.test_cases_limit??e.test_cases_limit,p=r.per_scenario_test_cases_limit??e.per_scenario_test_cases_limit;n.push({type:"limit",scenarioLimit:o,perScenarioLimit:p});break}case"error":{let r=typeof e.data=="string"?e.data:e.data?.message??"generation error";n.push({type:"error",message:r});break}case"request_cancelled":return n.push({type:"done",status:"stopped"}),n;case"session_ended":return n.push({type:"done",status:"ended"}),n;default:break}if(Array.isArray(e.scenarios)&&n.push({type:"snapshot",data:{requestId:t,status:d,headline:e.headline,scenarios:e.scenarios}}),d&&U(d)){let r=d.trim().toLowerCase();n.push({type:"done",status:r})}return n}function se(e){if(!e)return;let t=/^([\d.]+)(ms|s)?$/.exec(e.trim());if(!t)return;let n=Number(t[1]);if(Number.isFinite(n))return t[2]==="ms"?Math.round(n):Math.round(n*1e3)}var v=class extends Error{constructor(t){super(t),this.name="AuthError"}},M=class extends Error{constructor(t){super(t),this.name="ForbiddenError"}},I=class extends Error{constructor(t){super(t),this.name="InsufficientCreditsError"}},k=class extends Error{constructor(n,i){super(n);this.cause=i;this.name="TransportError"}};function x(e,t){let n=t?.message??t?.error??`HTTP ${e}`;return e===401?new v(n):e===403?t?.key==="insufficient_credits"?new I(n):new M(n):new k(n)}async function*J(e){let t=e.fetchImpl??fetch,n=e.maxRetries??5,i=e.maxBackoffMs??3e4,d=e.connectTimeoutMs??1e4,r=0,o=!1;for(;;){if(e.signal.aborted)return;let p=new AbortController,a=()=>p.abort();e.signal.addEventListener("abort",a,{once:!0});let c=setTimeout(()=>p.abort(),d),g;try{g=await t(e.url,{method:"GET",headers:{Authorization:await e.authHeader(),Accept:"text/event-stream"},signal:p.signal})}catch(w){if(clearTimeout(c),e.signal.removeEventListener("abort",a),e.signal.aborted)return;if(++r>n)throw new k("SSE connect failed",w);await O(F(r,i));continue}if(clearTimeout(c),!g.ok){e.signal.removeEventListener("abort",a);let w=await oe(g);if(g.status===401&&o){if(++r>n)throw x(401,w);await O(F(r,i));continue}throw x(g.status,w)}if(!g.body)throw e.signal.removeEventListener("abort",a),new k("SSE response had no body");o=!0,r=0;let m=g.body.getReader(),h=new TextDecoder("utf-8"),b="";try{for(;;){if(e.signal.aborted){await m.cancel().catch(()=>{});return}let{done:w,value:s}=await m.read();if(w)break;b+=h.decode(s,{stream:!0});let f;for(;(f=b.indexOf(`
|
|
3
3
|
|
|
4
4
|
`))>=0;){let u=b.slice(0,f);b=b.slice(f+2);let l=ie(u);l&&(yield l)}}}catch(w){if(e.signal.aborted)return;if(++r>n)throw new k("SSE stream dropped",w);await O(F(r,i));continue}finally{e.signal.removeEventListener("abort",a)}return}}function ie(e){let t="message",n="";for(let i of e.split(`
|
|
5
5
|
`))i.startsWith("event:")?t=i.slice(6).trim():i.startsWith("data:")&&(n+=i.slice(5).trim());if(t!=="message"||!n)return null;try{let i=Buffer.from(n,"base64").toString("utf-8");return JSON.parse(i)}catch{return null}}function F(e,t){return Math.min(t,1e3*2**(e-1))}function O(e){return new Promise(t=>setTimeout(t,e))}async function oe(e){try{return await e.clone().json()}catch{return}}function W(e,t){t?.length&&(e.append("files",t.map(n=>n.fileKey).join(",")),e.append("gemini_metadata",JSON.stringify(t.map(n=>({fileData:{fileUri:n.geminiUri,mimeType:n.mimeType}})))))}function Ue(e,t={}){let n=t.fetchImpl??fetch,i=new Map,d=!0;async function r(){let s=await e.authResolver.resolve();if(!s)throw new v("unauthorized; run `kane-cli login`");return E(s.username,s.access_key)}function o(s){return`${e.baseUrl}${s}`}async function p(s){if(!s.ok){let f;try{f=await s.clone().json()}catch{f=void 0}throw x(s.status,f)}return s.json()}function a(s){let f=s?.data??s;return{request_id:f.request_id??f.id,status:f.status??""}}function c(s,f,u,l){let y=q({requestId:s,objective:f});l&&(y=P(y,{type:"snapshot",data:l}),l.status==="cleaned_up"&&(y={...y,error:"session was reaped (cleaned_up) \u2014 continuing will destructively regenerate"}));let S=new AbortController;u&&(u.aborted?S.abort():u.addEventListener("abort",()=>S.abort(),{once:!0})),i.set(s,S);let A={requestId:s,state:y,events:void 0};return A.events=(async function*(){try{let C=J({url:o(`/requests/${s}/sse`),authHeader:r,signal:S.signal,log:e.log,fetchImpl:n});for await(let L of C)for(let z of H(L,s))A.state=P(A.state,z),yield z}finally{i.delete(s)}})(),A}async function g(s,f){let u=new FormData;u.append("prompt",s.prompt),d=s.memoryEnhancement??!0,u.append("memory_enhancement",String(d)),s.scenarioLimit!==void 0&&u.append("test_scenario_limit",String(s.scenarioLimit)),s.perScenarioLimit!==void 0&&u.append("per_scenario_test_cases_limit",String(s.perScenarioLimit));let l=s.projectId??e.projectId,y=s.folderId??e.folderId;l&&u.append("project_id",l),y&&u.append("folder_id",y),W(u,s.attachments);let S=await n(o("/requests"),{method:"POST",headers:{Authorization:await r()},body:u}),A=await p(S),{request_id:C}=a(A),L=String(C);return c(L,s.prompt,f)}async function m(s,f){let u=await n(o(`/requests/${s}`),{method:"GET",headers:{Authorization:await r()}}),l=await p(u),y=l?.data??l,S={requestId:s,status:y.status??"",headline:y.headline,scenarios:Array.isArray(y.scenarios)?y.scenarios:[]};return c(s,"",f,S)}async function h(s,f,u){let l=new FormData;l.append("prompt",f),l.append("chat_enabled","true"),l.append("memory_enhancement",String(d)),u?.mappings&&l.append("mappings",JSON.stringify(u.mappings)),W(l,u?.attachments);let y=await n(o(`/requests/${s}`),{method:"PUT",headers:{Authorization:await r()},body:l});if(!y.ok){let S;try{S=await y.clone().json()}catch{}throw x(y.status,S)}}async function b(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/stop`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let l;try{l=await u.clone().json()}catch{}throw x(u.status,l)}}async function w(s){i.get(s)?.abort();let u=await n(o(`/requests/${s}/end`),{method:"DELETE",headers:{Authorization:await r()}});if(!u.ok&&u.status!==404){let l;try{l=await u.clone().json()}catch{}throw x(u.status,l)}}return{start:g,attach:m,chat:h,cancel:b,end:w}}import{statSync as ae,realpathSync as G,existsSync as ce}from"fs";import{extname as ue,resolve as j,isAbsolute as pe}from"path";import{homedir as V}from"os";var de=new Set([".txt",".md",".json",".xml",".jpg",".jpeg",".png",".gif",".bmp",".webp",".pdf",".docx",".csv",".xlsx",".mp3",".wav",".m4a",".webm",".mpeg",".mpga",".mp4",".mov"]),le=50*1024*1024,X=10;function fe(e){return e==="~"?V():e.startsWith("~/")?j(V(),e.slice(2)):e}function Ge(e,t){let n=[],i=[],d=new Set,r=[],o=(()=>{try{return G(j(t))}catch{return j(t)}})(),p=o.endsWith("/")?o:o+"/";for(let a of e){let c=fe(a),g=pe(c)?c:j(t,c);if(!ce(g)){n.push(`Not found: ${a}`);continue}let m;try{m=G(g)}catch{n.push(`Cannot resolve: ${a}`);continue}if(d.has(m))continue;let h;try{h=ae(m)}catch{n.push(`Cannot read: ${a}`);continue}if(!h.isFile()){n.push(`Not a file: ${a}`);continue}if(h.size===0){n.push(`Empty file: ${a}`);continue}let b=ue(m).toLowerCase();if(!de.has(b)){n.push(`Unsupported type ${b||"(none)"}: ${a}`);continue}if(h.size>le){n.push(`Too large (>50MB): ${a}`);continue}m!==o&&!m.startsWith(p)&&i.push(`Outside working dir: ${a}`),d.add(m),r.push(m)}return r.length>X&&n.push(`Too many files: ${r.length} (max ${X})`),{ok:n.length?[]:r,errors:n,warnings:i}}var B=class extends Error{constructor(n){super(n.join("; "));this.errors=n;this.name="AttachmentValidationError"}};async function Xe(e){let{promptText:t,filePaths:n,cwd:i,scenarios:d,isRefine:r,conn:o,deps:p}=e,{ok:a,errors:c,warnings:g}=p.validate(n,i);if(c.length)throw new B(c);e.onValidated?.();let m=a.length?await p.upload(o,a,p.onUpload):[],h=r?p.buildMappings(t,d):void 0;return{promptText:t,mappings:h,attachments:m,warnings:g}}import{readFile as me}from"fs/promises";import{basename as K}from"path";async function ge(e){let t=await e.authResolver.resolve();if(!t)throw new v("unauthorized; run `kane-cli login`");return E(t.username,t.access_key)}async function he(e,t,n={}){let i=n.fetchImpl??fetch,d=await me(t),r=K(t),o=new FormData;o.append("file",new Blob([d]),r),o.append("source","omniBox"),o.append("geminiFileUpload","true");let p=await i(`${e.tmsBaseUrl}/v1/attachment`,{method:"POST",headers:{Authorization:await ge(e)},body:o,signal:n.signal});if(!p.ok){let h;try{h=await p.clone().json()}catch{}throw x(p.status,h)}let a=await p.json(),c=a?.data??a,g=c?.gemini_response?.uri,m=c?.gemini_response?.mimeType;if(!c?.file_key||!g){let h=c&&typeof c=="object"?Object.keys(c).join(","):typeof c,b=(()=>{try{return JSON.stringify(c).slice(0,500)}catch{return"<unserializable>"}})();throw new Error(`attachment upload for ${r} returned no file_key/gemini uri \u2014 status ${p.status}, body keys: [${h}], raw: ${b}`)}return{fileName:c.file_name??r,fileKey:c.file_key,geminiUri:g,mimeType:m??"application/octet-stream"}}async function tt(e,t,n,i={}){let d=[];for(let r=0;r<t.length;r++){if(i.signal?.aborted)throw Object.assign(new Error("upload aborted"),{name:"AbortError"});let o=K(t[r]);n?.({file:o,index:r+1,total:t.length,status:"uploading"});try{d.push(await he(e,t[r],i)),n?.({file:o,index:r+1,total:t.length,status:"done"})}catch(p){throw n?.({file:o,index:r+1,total:t.length,status:"failed"}),p}}return d}var ye=/@([sS])(\d+)\.([cC])(\d+)/g,be=/@([sS])(\d+)(?!\d)(?!\.[cC]\d)/g;function rt(e,t){let n={},i={};for(let d of e.matchAll(ye)){let r=Number(d[2]),o=Number(d[4]),p=t[r-1];if(!p)continue;n[`s${r}`]=String(p.id);let a=p.test_cases??[];if(a[o-1])for(let c=0;c<o;c++){let g=a[c];g&&(i[`s${r}.c${c+1}`]=String(g.id))}}for(let d of e.matchAll(be)){let r=Number(d[2]),o=t[r-1];o&&(n[`s${r}`]=String(o.id))}if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return{scenario:n,testcase:i}}function R(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(n==null||typeof n!="object")return[];let i=n;if(typeof i.step!="string")return[];let d=typeof i.expected_result=="string"?i.expected_result:typeof i.outcome=="string"?i.outcome:"";t.push({step:i.step,expected:d})}return t}var we=30,Se=300;function Z(){return{mode:"testing",max_steps:we,timeout:Se,variables:{}}}function Q(e){return e.title??`Test case ${e.id}`}function ct(e,t){return $({frontmatter:Z(),heading:Q(t),steps:e.sub_objectives.map(n=>n.objective)})}function Y(e){let t=R(e.manual_steps).map(n=>n.step);return $({frontmatter:Z(),heading:Q(e),steps:t})}import{mkdtempSync as xe,mkdirSync as N,writeFileSync as ee,rmSync as te,renameSync as _e,existsSync as ne,readFileSync as ve}from"fs";import{join as _,resolve as ke}from"path";async function ft(e,t,n,i=Y){(n.redirectBareCwd??!0)&&ke(t)===process.cwd()&&(t=_(t,".testmuai","tests"));let d=T(e.objective)??e.headline,r=T(n.suiteName)??`${T(re(d,4))??"tcg"}-${e.requestId}`,o=r,p=_(t,r);ne(p)&&!Te(p,e.requestId)&&(o=`${r}-${e.requestId}`);let a=_(t,o),c=[],g=new Map;for(let h of e.scenarios){let b=(h.test_cases??[]).filter(Ae);if(b.length===0)continue;let w=T(Ee(h.scode))??T(h.sid)??`s${h.id}`,s=g.get(w)??new Set;g.set(w,s);for(let f of b){let u=T(re(f.title,5))??"case",l=`${u}_test.md`;for(let y=2;s.has(l);y++)l=`${u}-${y}_test.md`;s.add(l),c.push({dir:w,file:l,tc:f})}}if(c.length===0)return{suiteDir:a,paths:[],warning:"no functional test cases generated"};N(t,{recursive:!0});let m=xe(_(t,".tcg-tmp-"));try{N(_(m,"helpers"),{recursive:!0}),ee(_(m,".tcg-suite.json"),JSON.stringify({requestId:e.requestId,suiteName:o}));let h=[],b=new Set;for(let s of c){let f=_(m,s.dir);b.has(f)||(N(f,{recursive:!0}),b.add(f));let u=_(f,s.file);ee(u,i(s.tc)),h.push(u)}ne(a)&&te(a,{recursive:!0,force:!0}),_e(m,a);let w=h.map(s=>s.replace(m,a));return{suiteDir:a,paths:w}}catch(h){try{te(m,{recursive:!0,force:!0})}catch{}throw h}}function Ae(e){return(e.category??"").trim().toLowerCase()==="functional"}function Te(e,t){try{return JSON.parse(ve(_(e,".tcg-suite.json"),"utf-8"))?.requestId===t}catch{return!1}}function T(e){return e&&e.length>0?e:void 0}function re(e,t){return e?e.toLowerCase().replace(/[^a-z0-9]+/g," ").trim().split(/\s+/).filter(Boolean).slice(0,t).join("-"):""}function Ee(e){return e?e.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/^-+|-+$/g,""):""}function ht(e){let t=[];e.title&&t.push(e.title),e.description&&t.push("",e.description);let n=R(e.manual_steps);return n.length>0&&(t.push("","Steps:"),n.forEach((i,d)=>{t.push(`${d+1}. ${i.step}`)})),t.join(`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as N,b as U,c as Y,d as L}from"./chunk-P3JUE2RM.js";import{l as R,m as D,o as P}from"./chunk-AHXOKBVE.js";import{g as A}from"./chunk-55YDTPB7.js";import{i as G}from"./chunk-YCH7H7JX.js";import{T as S,W as k,X as C}from"./chunk-6LGED4FC.js";import{c as E}from"./chunk-H6TNBKGR.js";import{a as h}from"./chunk-CH273NAE.js";import{C as y}from"./chunk-GP7WD4UY.js";import{t as T}from"./chunk-3N6IAVD5.js";import{existsSync as H}from"fs";import{basename as Z}from"path";import{appendFileSync as W,mkdirSync as B}from"fs";import{homedir as X}from"os";import{dirname as K,join as V}from"path";function F(d,a){let t=/^(DOCX_[A-Z_]+):/.exec(a)?.[1];if(t)try{let u=process.env.KANE_CONTEXT_REFUSAL_LOG??V(X(),".testmuai","kaneai","context-refusals.log");B(K(u),{recursive:!0}),W(u,`${new Date().toISOString()} ${t} ${d}
|
|
3
|
+
`)}catch{}}function j(d){return d?.outcome==="added"?"added .context/ to .gitignore":d?.outcome==="failed"?`warning: could not add .context/ to .gitignore: ${d.reason}`:null}async function x(d,a,t,u=process.cwd(),f){let l=h(u),g=[];if(a.as!==void 0&&d.length>1)return(t.err??t.out)(`error: --as names ONE source identity \u2014 pass a single file (got ${d.length})`,"AS_SINGLE_SOURCE"),{code:2,results:g};for(let i of d){if(Y(i)){let e=L(i);if(e===null)return(t.err??t.out)(`error: ${i}: unsupported remote URL \u2014 supported: ${U.map(c=>c.hint).join("; ")}`,"UNSUPPORTED_URL"),{code:1,results:g};let o=await e.ingest(i,a.as,t,l,f);if(o.code!==0)return{code:o.code,results:g};if(o.result){let c=j(o.result.gitignore);c&&t.out(c),g.push({status:o.result.status==="versioned"?"versioned":o.result.status==="unchanged"?"unchanged":"created",source_id:o.result.source_id,source_cid:o.result.source_cid,...o.result.gitignore?{gitignore:o.result.gitignore}:{}})}continue}let m=a.as,p;if(m===void 0&&H(l)){let e=R(i),o=D(e);if(o){let c=y(l);c.heads.get(o)!=null&&c.heads.get(e)==null&&(p=o,t.isTTY&&await t.confirm(`${e} looks like a new version of existing source '${o}' \u2014 ingest as '${o}' (replaces the current version; items built on it go stale)?`)&&(m=o))}}let n;try{n=await P({contextDir:l,filePath:i,asId:m,confirmSameSource:t.isTTY?e=>t.confirm(`identical bytes already ingested as ${e} \u2014 treat as the same source?`):void 0,converters:{pdf:A,docx:G}})}catch(e){let o=e instanceof Error?e.message:String(e);return e instanceof T?((t.err??t.out)(`error: ${o}`,e.code),(t.err??t.out)(`next: ${e.remedy}`,e.code),{code:2,results:g}):(F(i,o),(t.err??t.out)(`error: ${i}: ${o}`,"INGEST_FAILED"),{code:1,results:g})}t.out(N(t.isTTY,n,Z(i)));for(let e of n.warnings??[])t.out(`warning: ${e}`);let _=j(n.gitignore);if(_&&t.out(_),n.composite&&(n.composite.delivered>0||n.composite.omitted>0)){let e=n.composite.pages!==void 0?` ${n.composite.pages} pages,`:"";t.out(`${n.source_id}: ${n.composite.kind},${e} ${n.composite.delivered} images delivered (${n.composite.omitted} omitted)`)}let v;if(!t.isTTY&&n.status==="created"){let e=y(l);for(let[o,c]of e.heads.entries())if(!(o===n.source_id||c==null)&&e.getNode(c)?.content.blob===n.blob){v=o,t.out(`hint: identical bytes already ingested as ${o} \u2014 merged later via review`);break}}g.push({status:n.status,source_id:n.source_id,source_cid:n.cid,...n.warnings?.length?{warnings:n.warnings}:{},...n.composite?{media:{kind:n.composite.kind,...n.composite.pages!==void 0?{pages:n.composite.pages}:{},delivered:n.composite.delivered,omitted:n.composite.omitted}}:{},...v?{duplicate_of:v}:{},...p&&m===void 0?{lineage_candidate:p}:{},...n.gitignore?{gitignore:n.gitignore}:{}})}return{code:0,results:g}}async function le(d,a,t,u=process.cwd(),f){return(await x(d,a,t,u,f)).code}async function fe(d,a){if(a.mode!=null&&!["interactive","agent","ci","override"].includes(a.mode)){let{makeHeadlessIO:r,agentRefusal:s}=await import("./headless-io-3A3BZVQ5.js");return s(r("ndjson","extract"),`ingest: --mode must be interactive | agent | ci | override, got '${a.mode}'`,"MODE_USAGE")}let t=E();if(a.mode==="interactive"&&!t)return process.stderr.write(`ingest: --mode interactive needs a TTY on stdin and stdout (use --mode agent|ci|override headless)
|
|
4
|
+
`),2;let u=a.mode??(t?"interactive":void 0),f=u==="interactive"||u==="agent"||u==="override";if(!f&&(a.plan||a.force||a.trust!==void 0))return process.stderr.write(`ingest: --plan/--force/--trust steer the extraction \u2014 not available when only landing (use --mode agent to extract headless)
|
|
5
|
+
`),2;let{createInterface:l}=await import("readline/promises"),g=u==="agent",i=g?(await import("./headless-io-3A3BZVQ5.js")).makeHeadlessIO("ndjson","extract"):null,m=H(h(process.cwd()))?k(h(process.cwd())):null;if(m)return i?(i.event(C(m)),i.done(2,"refused")):(process.stderr.write(`error: ${m.text}
|
|
6
|
+
next: ${m.remedy}
|
|
7
|
+
`),2);let p=[],n=()=>{for(let r of p.splice(0))i.event({type:"error",message:r.message,...r.code?{code:r.code}:{}})},_=r=>{for(let s of r)i.event({type:"ingested",source_id:s.source_id,status:s.status,cid:s.source_cid,...s.warnings?.length?{warnings:s.warnings}:{},...s.media?{media:s.media}:{},...s.duplicate_of?{duplicate_of:s.duplicate_of}:{},...s.lineage_candidate?{lineage_candidate:s.lineage_candidate}:{}})},v=r=>{for(let s of r)s.gitignore?.outcome==="added"?i.event({type:"gitignore_updated",path:".gitignore"}):s.gitignore?.outcome==="failed"&&i.event({type:"warning",message:`could not add .context/ to .gitignore: ${s.gitignore.reason}`})},e=i?{out:()=>{},err:(r,s)=>p.push({message:r.replace(/^error: /,""),...s?{code:s}:{}}),isTTY:!1,confirm:async()=>!1}:{out:r=>process.stdout.write(r+`
|
|
8
|
+
`),err:r=>process.stderr.write(r+`
|
|
9
|
+
`),isTTY:t,confirm:async r=>{let s=l({input:process.stdin,output:process.stdout});try{let O=await s.question(`${r} [Y/n] `);return!/^n(o)?$/i.test(O.trim())}finally{s.close()}}};if(!f){let{withTelemetry:r}=await import("./with-telemetry-P6RUPWBH.js");return r("ingest",async()=>{await S(h(process.cwd()),I=>(e.err??e.out)(I));let{code:s,results:O}=await x(d,{as:a.as},e,void 0,void 0);if(s!==0)return s;let b=O.filter(I=>I.status!=="unchanged").length;return b>0&&(e.err??e.out)(`landed ${b} source(s) \u2014 run kane-cli context extract to extract them`),0},{write:!0})}let o;try{o=i?await(await import("./run-channel-RGH4WIQX.js")).runWithChannel({event:i.event},()=>x(d,{as:a.as},e,void 0,void 0)):await x(d,{as:a.as},e,void 0,void 0)}catch(r){if(i)return n(),i.event({type:"error",message:r instanceof Error?r.message:String(r),code:"INGEST_FAILED"}),i.done(1,"error");throw r}let{code:c,results:w}=o;if(i&&v(w),c!==0)return i?(_(w),n(),i.done(c,c===2?"refused":"error")):c;if(w.length===0)return i?i.done(0):0;let{extractCommand:q}=await import("./extract-cmd-CCYW7FIY.js"),M=[...new Set(w.map(r=>r.source_id))],$=await q({...a.mode!==void 0?{mode:a.mode}:{},...a.plan?{plan:!0}:{},...a.force?{force:!0}:{},...a.trust!==void 0?{trust:a.trust}:{},sources:M,landed:w});if($===2&&!g){let r=w.filter(s=>s.status!=="unchanged").length;r>0&&(e.err??e.out)(`note: the ${r} landed source(s) are safe \u2014 extract later with kane-cli context extract`)}return $}export{x as a,le as b,fe as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-5Y2G4NC7.js";import{
|
|
2
|
+
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-B2ZGG7WM.js";import{a as n}from"./chunk-HCBYKLMW.js";import{b as t}from"./chunk-C44QQJR4.js";import{a as s}from"./chunk-6YGTRKDT.js";import{e as r}from"./chunk-UR6MHSHU.js";var l=r(s(),1);var m=r(n(),1),i=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function b({active:e=!0}){let[p,c]=(0,l.useState)(0);return a(()=>{c(f=>(f+1)%i.length)},e?80:null),(0,m.jsx)(t,{color:o.orange,children:e?i[p]:"\u25CF"})}export{b as a};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as k}from"./chunk-
|
|
2
|
+
import{a as k}from"./chunk-4BBDKWM3.js";import{a as m}from"./chunk-BPMSNGXQ.js";import{r as a}from"./chunk-RSSOJ3L2.js";import{a as y}from"./chunk-OH2NSBO6.js";import{a as h}from"./chunk-IQ7NGOAT.js";var $=10,u=200,N=1e4,S=1e6;function T(t,e,r="streaming"){let n=r==="full-fetch"?S:N,o=$,i=0;if(t!==void 0){let s=Number(t);if(!Number.isInteger(s)||s<1||s>u)return{error:`--limit must be an integer in [1, ${u}] (got "${t}")`};o=s}if(e!==void 0){let s=Number(e);if(!Number.isInteger(s)||s<0||s>n)return{error:`--offset must be an integer in [0, ${n}] (got "${e}")`};i=s}return{limit:o,offset:i}}function C(t,e){if(!e)return t;let r=e.toLowerCase();return t.filter(n=>n.name.toLowerCase().includes(r))}function j(t,{limit:e,offset:r}){let n=t.slice(r,r+e),o=t.length>r+e;return{slice:n,hasMore:o}}function v(t,e,r=n=>process.stdout.write(`${n}
|
|
3
3
|
`)){for(let n of t)r(JSON.stringify(n));r(JSON.stringify({_meta:"page",limit:e.limit,offset:e.offset,returned:t.length,has_more:e.has_more}))}function b(t,e,r=n=>process.stdout.write(`${n}
|
|
4
|
-
`)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-
|
|
4
|
+
`)){if(t.length===0){r("(no results)");return}let n=Math.max(2,...t.map(s=>s.id.length)),o=`${"ID".padEnd(n)} NAME`;r(o),r(`${"-".repeat(n)} ----`);for(let s of t)r(`${s.id.padEnd(n)} ${s.name}`);r("");let i=e.offset+t.length;if(e.hasMore){let s=e.totalIsLowerBound?`${e.total}+`:`${e.total}`;r(`${i} of ${s} \u2014 next: --offset ${e.offset+e.limit}`)}else r(`${t.length} shown (${e.total} total)`)}async function B(t,e,r){if(r.username&&r.accessKey)return{ok:!0,creds:{username:r.username,access_key:r.accessKey}};let n=new h,o=n.loadBasicAuth(t,e);if(o)return{ok:!0,creds:{username:o.username,access_key:o.access_key}};let i=n.loadCredentials(t,e);if(!i)return{ok:!1,reason:"no_credentials"};let s=i.access_token;try{let{refreshOAuthToken:d}=await import("./token-refresh-KN5JK2U4.js"),w=await d({creds:n,profile:t,env:e,credentials:i});w&&(s=w.accessToken)}catch(d){return{ok:!1,reason:"refresh_failed",detail:d instanceof Error?d.message:String(d)}}let c=y(e),f=await new k(c.controllerBaseUrl,async()=>s,null).resolve();return f?{ok:!0,creds:{username:f.username,access_key:f.access_key}}:{ok:!1,reason:"exchange_failed"}}function E(t,e,r){switch(r.reason){case"no_credentials":return{message:`error: no credentials for profile "${t}" [${e}]. Run \`kane-cli login\` or pass --username/--access-key.
|
|
5
5
|
`,exitCode:2};case"refresh_failed":return{message:`error: OAuth token refresh failed for profile "${t}" [${e}]${r.detail?`: ${r.detail}`:""}. Run \`kane-cli login\` to re-auth.
|
|
6
6
|
`,exitCode:2};case"exchange_failed":return{message:`error: TMS credential exchange failed for profile "${t}" [${e}]. Token may be revoked \u2014 try \`kane-cli login\`; if the problem persists, TMS may be down.
|
|
7
7
|
`,exitCode:2}}}function O(t){return{id:t.project_id,name:t.name}}function M(t){return{id:t.id,name:t.name}}async function P(t,e,r,n){let o=r+n+1,i=[],s=!0;for await(let c of t.listProjectsStream({name:e})){if(i.push(...c.projects),c.done){s=!0;break}if(i.length>=o){s=!1;break}}return{items:i,doneStreaming:s}}function g(t){return!!t.agent||!process.stdin.isTTY||!process.stdout.isTTY}function _(t,e=r=>process.stdout.write(`${r}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as Ot,b as Mt}from"./chunk-2UIHS2FH.js";import{a as vt}from"./chunk-BKHXPBWN.js";import{a as kt}from"./chunk-N2P4MI32.js";import{b as wt}from"./chunk-IE3OO5GI.js";import{a as Nt,b as Ft,c as St}from"./chunk-MSGW4JDG.js";import{c as G,e as Rt}from"./chunk-UR6MHSHU.js";var Lt=G(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.CHAR=`
|
|
3
3
|
\r -\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}`;x.S=` \r
|
|
4
4
|
`;x.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";x.NAME_CHAR="-"+x.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";x.CHAR_RE=new RegExp("^["+x.CHAR+"]$","u");x.S_RE=new RegExp("^["+x.S+"]+$","u");x.NAME_START_CHAR_RE=new RegExp("^["+x.NAME_START_CHAR+"]$","u");x.NAME_CHAR_RE=new RegExp("^["+x.NAME_CHAR+"]$","u");x.NAME_RE=new RegExp("^["+x.NAME_START_CHAR+"]["+x.NAME_CHAR+"]*$","u");x.NMTOKEN_RE=new RegExp("^["+x.NAME_CHAR+"]+$","u");var tt=9,et=10,st=13,it=32;x.S_LIST=[it,et,st,tt];function Ne(e){return e>=it&&e<=55295||e===et||e===st||e===tt||e>=57344&&e<=65533||e>=65536&&e<=1114111}x.isChar=Ne;function Fe(e){return e===it||e===et||e===st||e===tt}x.isS=Fe;function Pt(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}x.isNameStartChar=Pt;function Se(e){return Pt(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}x.isNameChar=Se});var Ht=G(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.CHAR="-\uD7FF\uE000-\uFFFD\u{10000}-\u{10FFFF}";f.RESTRICTED_CHAR="-\b\v\f-\x7F-\x84\x86-\x9F";f.S=` \r
|
|
5
5
|
`;f.NAME_START_CHAR=":A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";f.NAME_CHAR="-"+f.NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";f.CHAR_RE=new RegExp("^["+f.CHAR+"]$","u");f.RESTRICTED_CHAR_RE=new RegExp("^["+f.RESTRICTED_CHAR+"]$","u");f.S_RE=new RegExp("^["+f.S+"]+$","u");f.NAME_START_CHAR_RE=new RegExp("^["+f.NAME_START_CHAR+"]$","u");f.NAME_CHAR_RE=new RegExp("^["+f.NAME_CHAR+"]$","u");f.NAME_RE=new RegExp("^["+f.NAME_START_CHAR+"]["+f.NAME_CHAR+"]*$","u");f.NMTOKEN_RE=new RegExp("^["+f.NAME_CHAR+"]+$","u");var yt=9,It=10,Bt=13,Xt=32;f.S_LIST=[Xt,It,Bt,yt];function we(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}f.isChar=we;function ke(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}f.isRestrictedChar=ke;function ve(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}f.isCharAndNotRestricted=ve;function Oe(e){return e===Xt||e===It||e===Bt||e===yt}f.isS=Oe;function $t(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}f.isNameStartChar=$t;function Me(e){return $t(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}f.isNameChar=Me});var Ut=G(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.NC_NAME_START_CHAR="A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u{10000}-\u{EFFFF}";N.NC_NAME_CHAR="-"+N.NC_NAME_START_CHAR+".0-9\xB7\u0300-\u036F\u203F-\u2040";N.NC_NAME_START_CHAR_RE=new RegExp("^["+N.NC_NAME_START_CHAR+"]$","u");N.NC_NAME_CHAR_RE=new RegExp("^["+N.NC_NAME_CHAR+"]$","u");N.NC_NAME_RE=new RegExp("^["+N.NC_NAME_START_CHAR+"]["+N.NC_NAME_CHAR+"]*$","u");function Wt(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}N.isNCNameStartChar=Wt;function Pe(e){return Wt(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}N.isNCNameChar=Pe});var Ct=G(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.SaxesParser=B.EVENTS=void 0;var X=Lt(),Le=Ht(),xt=Ut(),F=X.isS,ye=X.isChar,W=X.isNameStartChar,Vt=X.isNameChar,ne=X.S_LIST,Ie=X.NAME_RE,Be=Le.isChar,Xe=xt.isNCNameStartChar,$e=xt.isNCNameChar,He=xt.NC_NAME_RE,K="http://www.w3.org/XML/1998/namespace",I="http://www.w3.org/2000/xmlns/",We={__proto__:null,xml:K,xmlns:I},Ue={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},C=-1,k=-2,Gt=0,Ve=1,nt=2,Ge=3,P=4,qe=5,je=6,ze=7,rt=8,Ye=9,Qe=10,Ke=11,Ze=12,A=13,q=14,at=15,Je=16,ot=17,ts=18,es=19,ht=20,ss=21,is=22,ns=23,qt=24,lt=25,j=26,jt=27,rs=28,as=29,zt=30,os=31,hs=32,O=33,ls=34,ct=35,U=36,ut=37,cs=38,Yt=39,Qt=40,us=41,Kt=42,ds=43,fs=44,dt=9,w=10,ft=13,Zt=32,Jt=33,re=34,V=38,ae=39,z=45,Y=47,ps=59,v=60,L=61,D=62,T=63,oe=91,y=93,te=133,ee=8232,Q=e=>e===re||e===ae,he=[re,ae],ms=[...he,oe,D],gs=[...he,v,y],xs=[L,T,...ne],Cs=[...ne,D,V,v];function mt(e,t,s){switch(t){case"xml":s!==K&&e.fail(`xml prefix must be bound to ${K}.`);break;case"xmlns":s!==I&&e.fail(`xmlns prefix must be bound to ${I}.`);break;default:}switch(s){case I:e.fail(t===""?`the default namespace may not be set to ${s}.`:`may not assign a prefix (even "xmlns") to the URI ${I}.`);break;case K:switch(t){case"xml":break;case"":e.fail(`the default namespace may not be set to ${s}.`);break;default:e.fail("may not assign the xml namespace to another prefix.")}break;default:}}function _s(e,t){for(let s of Object.keys(t))mt(e,s,t[s])}var Es=e=>He.test(e),Ds=e=>Ie.test(e),M=0,se=1,pt=2;B.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var ie={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"},gt=class{constructor(t){this.opt=t??{},this.fragmentOpt=!!this.opt.fragment;let s=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,s){this.nameStartCheck=Xe,this.nameCheck=$e,this.isName=Es,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},We);let i=this.opt.additionalNamespaces;i!=null&&(_s(this,i),Object.assign(this.ns,i))}else this.nameStartCheck=W,this.nameCheck=Vt,this.isName=Ds,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var t;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=M,this.attribList=[];let{fragmentOpt:s}=this;this.state=s?A:Gt,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=s,this.xmlDeclPossible=!s,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:i}=this.opt;if(i===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");i="1.0"}this.setXMLVersion(i),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(Ue),(t=this.readyHandler)===null||t===void 0||t.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(t,s){this[ie[t]]=s}off(t){this[ie[t]]=void 0}makeError(t){var s;let i=(s=this.fileName)!==null&&s!==void 0?s:"";return this.trackPosition&&(i.length>0&&(i+=":"),i+=`${this.line}:${this.column}`),i.length>0&&(i+=": "),new Error(i+t)}fail(t){let s=this.makeError(t),i=this.errorHandler;if(i===void 0)throw s;return i(s),this}write(t){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let s=!1;t===null?(s=!0,t=""):typeof t=="object"&&(t=t.toString()),this.carriedFromPrevious!==void 0&&(t=`${this.carriedFromPrevious}${t}`,this.carriedFromPrevious=void 0);let i=t.length,n=t.charCodeAt(i-1);!s&&(n===ft||n>=55296&&n<=56319)&&(this.carriedFromPrevious=t[i-1],i--,t=t.slice(0,i));let{stateTable:r}=this;for(this.chunk=t,this.i=0;this.i<i;)r[this.state].call(this);return this.chunkPosition+=i,s?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:t,i:s}=this;if(this.prevI=s,this.i=s+1,s>=t.length)return C;let i=t.charCodeAt(s);if(this.column++,i<55296){if(i>=Zt||i===dt)return i;switch(i){case w:return this.line++,this.column=0,this.positionAtNewLine=this.position,w;case ft:return t.charCodeAt(s+1)===w&&(this.i=s+2),this.line++,this.column=0,this.positionAtNewLine=this.position,k;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;let n=65536+(i-55296)*1024+(t.charCodeAt(s+1)-56320);return this.i=s+2,n>1114111&&this.fail("disallowed character."),n}getCode11(){let{chunk:t,i:s}=this;if(this.prevI=s,this.i=s+1,s>=t.length)return C;let i=t.charCodeAt(s);if(this.column++,i<55296){if(i>31&&i<127||i>159&&i!==ee||i===dt)return i;switch(i){case w:return this.line++,this.column=0,this.positionAtNewLine=this.position,w;case ft:{let r=t.charCodeAt(s+1);(r===w||r===te)&&(this.i=s+2)}case te:case ee:return this.line++,this.column=0,this.positionAtNewLine=this.position,k;default:return this.fail("disallowed character."),i}}if(i>56319)return i>=57344&&i<=65533||this.fail("disallowed character."),i;let n=65536+(i-55296)*1024+(t.charCodeAt(s+1)-56320);return this.i=s+2,n>1114111&&this.fail("disallowed character."),n}getCodeNorm(){let t=this.getCode();return t===k?w:t}unget(){this.i=this.prevI,this.column--}captureTo(t){let{i:s}=this,{chunk:i}=this;for(;;){let n=this.getCode(),r=n===k,a=r?w:n;if(a===C||t.includes(a))return this.text+=i.slice(s,this.prevI),a;r&&(this.text+=`${i.slice(s,this.prevI)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-
|
|
2
|
+
import{a as A}from"./chunk-YCCUBQY4.js";import{a as _}from"./chunk-RBHQXWR7.js";import{a as B}from"./chunk-BPMSNGXQ.js";import{a as R}from"./chunk-OO5GMBVI.js";import{a as k}from"./chunk-OH2NSBO6.js";import{y as c}from"./chunk-B2ZGG7WM.js";import{a as P}from"./chunk-HCBYKLMW.js";import{a as u,b as l}from"./chunk-C44QQJR4.js";import{a as J}from"./chunk-6YGTRKDT.js";import{e as L}from"./chunk-UR6MHSHU.js";var t=L(J(),1);var e=L(P(),1);function X(n,i,y,m){return{id:n,label:`${i} (${n}) \xB7 ${y} tests`,isActive:n===m}}function W({resolver:n,projectId:i,currentFolderId:y,env:m,onSelect:x,onCancel:w}){let[I,M]=(0,t.useState)([]),[$,d]=(0,t.useState)(!0),[O,g]=(0,t.useState)(!1),[U,N]=(0,t.useState)(null),[p,b]=(0,t.useState)("list"),[S,v]=(0,t.useState)(""),[E,f]=(0,t.useState)(null),h=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(!n){N("Login first to browse folders"),d(!1);return}let o=new AbortController;return d(!0),g(!0),(async()=>{try{let r=n.cached??await n.resolve();if(!r){N("Login first to browse folders"),d(!1),g(!1);return}let a=k(m),T=new B(a.tmsBaseUrl,r.username,r.access_key),F=(async function*(){if(o.signal.aborted)return;let s=await T.listFolders(i);yield{page:1,folders:s,totalLoaded:s.length,done:!0}})();for await(let s of F){if(d(!1),s.totalLoaded===0){h.current=!0,b("naming"),g(!1);return}M(s.folders.map(C=>X(C.id,C.name,C.test_cases_count,y))),s.done&&g(!1)}}catch(r){if(r?.name==="AbortError")return;N(r instanceof Error?r.message:String(r)),d(!1),g(!1)}})(),()=>o.abort()},[n,i,y,m]);let D=(0,t.useCallback)(o=>{let r=o.trim();if(!r){f("Name cannot be empty");return}if(!i){f("No project selected \u2014 pick a project first");return}f(null),b("creating"),(async()=>{try{if(!n)throw new Error("Not authenticated");let a=n.cached??await n.resolve();if(!a)throw new Error("Not authenticated");let T=k(m),s=await new B(T.tmsBaseUrl,a.username,a.access_key).createFolder(i,r);x(s.id,s.name)}catch(a){f(a instanceof Error?a.message:String(a)),b("naming")}})()},[n,i,m,x]),H=(0,t.useCallback)(()=>{v(""),f(null),h.current?w():b("list")},[w]);return p==="naming"||p==="creating"?(0,e.jsxs)(u,{flexDirection:"column",borderStyle:"round",borderColor:c.orange,paddingX:2,paddingY:1,children:[(0,e.jsx)(l,{color:c.orange,bold:!0,children:"Create new folder"}),h.current&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"No folders yet \u2014 let's create one."})}),(0,e.jsxs)(u,{marginTop:1,children:[(0,e.jsx)(l,{color:c.dim,children:"Name: "}),p==="naming"?(0,e.jsx)(A,{value:S,onChange:o=>{v(o),E&&f(null)},onSubmit:D,onCancel:H}):(0,e.jsx)(l,{children:S})]}),E&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.red,children:E})}),p==="creating"&&(0,e.jsx)(u,{marginTop:1,children:(0,e.jsx)(l,{color:c.dim,children:"Creating..."})}),p==="naming"&&(0,e.jsx)(R,{bindings:[{keys:"\u21B5",label:"create"}],escBackLabel:h.current?"cancel":"back"})]}):(0,e.jsx)(_,{title:"Folders",items:I,loading:$,loadingMore:O,preserveSelectionById:!0,error:U,itemNoun:"folders",onTab:()=>{h.current=!1,b("naming")},extraHint:"tab to create new",onSelect:o=>{let r=o.label.split(" (")[0];x(o.id,r)},onCancel:w})}export{X as a,W as b};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as d,g as B,k as ee}from"./chunk-YLQHY4A7.js";import{P as Z}from"./chunk-3N6IAVD5.js";import{b as A}from"./chunk-B2ZGG7WM.js";import{createHash as Ie,randomBytes as F}from"crypto";import{mkdirSync as xe,mkdtempSync as P,rmSync as $,existsSync as ve,renameSync as ke}from"fs";import{tmpdir as j}from"os";import{join as _,dirname as ce}from"path";import{spawn as te}from"child_process";function N(n,e=process.env){let t=n.replace(/https?:\/\/[^\s/@]+:[^\s/@]+@/gi,"https://[redacted]@").replace(/(authorization\s*[:=])[^\r\n]+/gi,"$1 [redacted]"),r=e.KANE_SYNC_GIT_TOKEN;if(r)for(let i of[r,Buffer.from(`x-access-token:${r}`).toString("base64")])t=t.split(i).join("[redacted]");return t}function be(n,e){if(n.GIT_SSH_COMMAND)return re(n.GIT_SSH_COMMAND);if(!n.GIT_SSH)return e?re(e):"ssh -o BatchMode=yes"}function re(n){return/(^|\s)-o\s*BatchMode=yes(\s|$)/.test(n)?n:`${n} -o BatchMode=yes`}var _e=/^(?:ssh:\/\/|[^/\s@:]+@[^/\s:]+:)/i,ie=new Map;function Ae(n,e){let t=[e??"",n.GIT_CONFIG_GLOBAL??"",n.HOME??""].join("\0"),r=ie.get(t);return r===void 0&&(r=se(["config","--get","core.sshCommand"],n,e,12e4).then(i=>i.code===0&&i.stdout.toString().trim()||void 0,()=>{}),ie.set(t,r)),r}var ne=new Set(["fetch","push","clone","ls-remote"]);function Ce(n,e,t){if(t!==void 0)return t;if(!n.some(i=>ne.has(i)))return 12e4;let r=e.KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS;if(r!==void 0){if(!/^\d+$/.test(r)||Number(r)<60||Number(r)>3600)throw new Error("KANE_SYNC_GIT_TRANSFER_TIMEOUT_SECONDS must be 60 to 3600");return Number(r)*1e3}return 9e5}function Ne(n){if(n.some(t=>/^(--force(?:-with-lease|-if-includes)?(?:=|$)|--mirror(?:=|$)|--delete(?:=|$)|-f$)/.test(t)))throw new Error("Git location cannot force, mirror or delete");let e=n.indexOf("push");if(e>=0){let t=n.slice(e+1);if(t.length!==3||t[0]!=="--porcelain"||!/^[0-9a-f]{40,64}:refs\/(heads|kane\/probe)\/[A-Za-z0-9._/-]+$/.test(t[2]))throw new Error("Git location requires an exact commit SHA and explicit ref")}}var H=async(n,e={})=>{Ne(n);let t={...process.env,...e.env};for(let h of["GIT_DIR","GIT_WORK_TREE","GIT_INDEX_FILE","GIT_OBJECT_DIRECTORY","GIT_ALTERNATE_OBJECT_DIRECTORIES","GIT_CONFIG_PARAMETERS"])delete t[h];e.env?.GIT_INDEX_FILE&&(t.GIT_INDEX_FILE=e.env.GIT_INDEX_FILE);let r=[["core.autocrlf","false"],["core.eol","lf"],["core.symlinks","false"],["core.hooksPath","/dev/null"],["gc.autoDetach","false"],["gc.pruneExpire","3.days.ago"],["maintenance.auto","false"],["push.followTags","false"],["push.gpgSign","false"],["commit.gpgSign","false"]],i=t.KANE_SYNC_GIT_HTTP_POST_BUFFER;if(i!==void 0){if(!/^\d+$/.test(i)||Number(i)<1048576||Number(i)>536870912)throw new Error("KANE_SYNC_GIT_HTTP_POST_BUFFER must be 1048576 to 536870912 bytes; use it only for a proxy that rejects chunked uploads");r.push(["http.postBuffer",i])}for(let h of Object.keys(t))h.startsWith("GIT_TRACE")&&delete t[h];let s=n.find(h=>h.startsWith("https://"));if(t.KANE_SYNC_GIT_TOKEN&&s){let h=new URL(s);r.push([`http.${h.origin}${h.pathname}.extraheader`,""],[`http.${h.origin}${h.pathname}.extraheader`,`AUTHORIZATION: basic ${Buffer.from(`x-access-token:${t.KANE_SYNC_GIT_TOKEN}`).toString("base64")}`],["credential.helper",""])}for(let h of Object.keys(t))/^GIT_CONFIG_(COUNT|KEY_\d+|VALUE_\d+)$/.test(h)&&delete t[h];let a=!t.GIT_SSH_COMMAND&&!t.GIT_SSH&&n.some(h=>ne.has(h))&&n.some(h=>_e.test(h))?await Ae({...t},e.cwd):void 0;r.forEach(([h,u],g)=>{t[`GIT_CONFIG_KEY_${g}`]=h,t[`GIT_CONFIG_VALUE_${g}`]=u}),t.GIT_CONFIG_COUNT=String(r.length),t.GIT_TERMINAL_PROMPT="0",t.GCM_INTERACTIVE="never",t.GIT_ASKPASS="",t.SSH_ASKPASS="";let c=be(t,a);return c!==void 0&&(t.GIT_SSH_COMMAND=c),t.GIT_NO_REPLACE_OBJECTS="1",se(n,t,e.cwd,Ce(n,t,e.timeout),e.input)};function se(n,e,t,r,i){return new Promise((s,o)=>{let a=te("git",n,{cwd:t,env:e,windowsHide:!0,detached:process.platform!=="win32",stdio:["pipe","pipe","pipe"]}),c=[],h=0,u="",g=!1,w=()=>{if(process.platform==="win32"&&a.pid)te("taskkill",["/pid",String(a.pid),"/t","/f"],{windowsHide:!0,stdio:"ignore"}).on("error",()=>a.kill("SIGKILL"));else try{a.pid&&process.kill(-a.pid,"SIGKILL")}catch{a.kill("SIGKILL")}},S=setTimeout(()=>{g=!0,w()},r);a.stdout.on("data",l=>{h+=l.length,h>128*1024*1024?w():c.push(l)}),a.stderr.on("data",l=>{u.length<64e3&&(u+=l.toString())}),a.stdin.on("error",()=>{}),a.on("error",l=>{clearTimeout(S),o(new d("SYNC_GIT_REQUIRED",`Git could not start: ${N(l.message,e)}`,"Install Git 2.31 or newer, then run the command again: https://git-scm.com/downloads"))}),a.on("close",l=>{clearTimeout(S),s({code:g||h>128*1024*1024?124:l??1,stdout:Buffer.concat(c),stderr:N(g?"Git operation timed out":u,e)})}),a.stdin.end(i)})}async function oe(n=H){let e=await n(["--version"],{timeout:1e4}),t=/git version (\d+)\.(\d+)/.exec(e.stdout.toString());if(e.code||!t||+t[1]<2||+t[1]==2&&+t[2]<31)throw new d("SYNC_GIT_REQUIRED","This location needs Git 2.31 or newer.","Install or update Git, then run setup again: https://git-scm.com/downloads")}function ae(n){let e=/^([^/@:]+)@([^/:]+):/.exec(n);if(e)return{user:e[1],host:e[2]};try{let t=new URL(n);return{host:t.hostname||"the server",user:t.username||"git",port:t.port||void 0}}catch{return{host:"the server",user:"git"}}}function gt(n){let e=/^[^/@:]+@([^/:]+):/.exec(n);if(e)return e[1].toLowerCase();try{return new URL(n).hostname.toLowerCase()}catch{return""}}function Y(n,e){let{host:t,user:r,port:i}=ae(e),s=N(n).trim().split(`
|
|
3
|
+
`).slice(-2).join(" ").trim();return/Host key verification failed|REMOTE HOST IDENTIFICATION HAS CHANGED/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`this computer has not accepted ${t}'s SSH host key yet`,remedy:`in a terminal run: ssh -T ${i?`-p ${i} `:""}${r}@${t} and answer yes, then run the command again`,diagnostic:s}:/Permission denied \(publickey/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`${t} did not accept your SSH key`,remedy:"load it with ssh-add, or ask the repository owner to grant your account access",diagnostic:s}:/could not read Username|Authentication failed|Access denied|Invalid username or (password|token)|returned error: 401|returned error: 403/i.test(n)?{code:"SYNC_LOCATION_DENIED",message:`sign in is needed, or your account has no access to this repository on ${t}`,remedy:"sign in through Git, or ask the owner to grant your account access",diagnostic:s}:/Could not resolve host|Connection refused|Connection timed out|timed out|Network is unreachable|Failed to connect/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:`${t} could not be reached`,remedy:"check the address and your network, then run the command again",diagnostic:s}:/not found|does not appear to be a git repository|Repository not found/i.test(n)?{code:"SYNC_LOCATION_UNREACHABLE",message:"no repository answered at that address, or your account cannot see it; a private repository looks missing until access is granted",remedy:"check the address, then run the command again",diagnostic:s}:{code:"SYNC_LOCATION_UNREACHABLE",message:`git could not read the repository on ${t}`,remedy:"check the address and your access, then run the command again",...s?{diagnostic:s}:{}}}function M(n,e){return(n.startsWith(e)?n:n.charAt(0).toUpperCase()+n.slice(1))+"."}function yt(n,e){let t=Y(n,e),{host:r}=ae(e),i=t.remedy.replace(/,? ?(and )?then run the command again$/,"");return i?`${M(t.message,r)} ${M(i,r)}`:M(t.message,r)}var Oe=Buffer.from(`* -text -filter -ident -working-tree-encoding
|
|
4
|
+
`),Re="refs/kane/tip",Pe=/unexpected disconnect|hung up unexpectedly|Connection reset|Connection timed out|timed out|Could not resolve host|Failed to connect|RPC failed|Broken pipe|early EOF/i,$e={GIT_AUTHOR_NAME:"kane-cli context",GIT_AUTHOR_EMAIL:"context@kane-cli.invalid",GIT_COMMITTER_NAME:"kane-cli context",GIT_COMMITTER_EMAIL:"context@kane-cli.invalid"},G=class n{constructor(e){this.options=e;this.exec=e.exec??H,this.prefix=e.prefix?`${e.prefix}/`:"";let t=Ie("sha256").update(JSON.stringify([e.url,e.branch,this.prefix])).digest("hex");if(this.repo=_(e.cacheDir??_(A,"context-sync","mirrors"),`${t}.git`),this.ref=e.ref??`refs/heads/${e.branch}`,!/^refs\/(heads|kane\/probe)\/[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(this.ref)||this.ref.includes(".."))throw new Error("Invalid Git location ref")}kind="git";contractVersion=1;ceilingTier=1;exec;repo;ref;prefix;ready;tip=null;tree=new Map;async run(e,t={}){let r=await this.exec(["--git-dir",this.repo,...e],t);if(r.code)throw new Error(`Git ${e[0]} failed: ${r.stderr||"unable to read the location"}`);return r.stdout}async transfer(e){let t=await this.exec(["--git-dir",this.repo,...e]);if(t.code){let r=Y(t.stderr||"",this.options.url);throw new d(r.code,r.message,r.remedy,r.diagnostic)}return t.stdout}get name(){return this.options.name??"<name>"}takenRemedy(e){return e===1?`${this.name} holds a different history: to work on it, clone it with kane-cli context clone <descriptor of ${this.name}> <dir>; to share this store, add an empty location`:`kane-cli context pull ${this.name} --rebase`}init(){return this.ready??=(async()=>{if(await oe(this.exec),xe(ce(this.repo),{recursive:!0}),!ve(this.repo)){let e=P(_(ce(this.repo),".init-"));try{let t=await this.exec(["init","--bare",e]);if(t.code)throw new Error(`Cannot open Git cache: ${t.stderr}`);try{ke(e,this.repo)}catch(r){if(!["EEXIST","ENOTEMPTY"].includes(r.code??""))throw r}}finally{$(e,{recursive:!0,force:!0})}}if((await this.run(["rev-parse","--is-bare-repository"])).toString().trim()!=="true")throw new Error("The Git cache must be a bare repository");await this.refresh()})()}async refresh(){let t=(await this.transfer(["ls-remote",this.options.url,this.ref])).toString().trim();if(!t){this.tip=null,this.tree=new Map;return}let r=t.split(/\s+/)[0];if(!/^[0-9a-f]{40,64}$/.test(r))throw new Error("Git returned an invalid ref");if(r===this.tip)return;let i=`refs/kane/snapshots/${F(16).toString("hex")}`;await this.transfer(["fetch","--no-tags","--no-write-fetch-head",this.options.url,`${this.ref}:${i}`]);let s=(await this.run(["rev-parse",i])).toString().trim();await this.run(["update-ref",Re,s]),await this.run(["update-ref","-d",i]);let o=await this.readTree(s);this.tip=s,this.tree=o}contextKeys(e){let t=new Map;for(let[r,i]of e)r.startsWith(`${this.prefix}kane-context/`)&&t.set(r,i);return t}async readTree(e){let t=await this.run(["ls-tree","-rz","--full-tree",e]),r=new Map;for(let i of t.toString().split("\0").filter(Boolean)){let s=/^(\d+) (\w+) ([0-9a-f]+)\t([\s\S]+)$/.exec(i);if(!s)throw new Error("Git returned an invalid tree entry");if(s[4].startsWith(`${this.prefix}kane-context/`)&&(s[1]!=="100644"||s[2]!=="blob"))throw new d("SYNC_OBJECT_CORRUPT","Context storage contains a link or non-file object.","Ask the repository owner to restore the original context files.");r.set(s[4],s[3])}return r}key(e){if(!/^[a-zA-Z0-9_~./-]+$/.test(e)||e.split("/").some(t=>!t||t==="."||t===".."||t.toLowerCase()===".git"))throw new Error("Invalid context storage key");return this.prefix+e}async head(e){return await this.init(),this.tree.has(this.key(e))}async get(e){await this.init();let t=this.tree.get(this.key(e));return t?this.run(["cat-file","blob",t]):null}async list(e){return await this.init(),e&&e.replace(/\/$/,"")&&this.key(e.replace(/\/$/,"")),[...this.tree.keys()].filter(t=>t.startsWith(this.prefix+e)).map(t=>t.slice(this.prefix.length)).sort()}async beginTransaction(){await this.init();let e=new Map(this.tree),t=this.tip,r=new Map,i=!1,s=()=>{if(i)throw new Error("Git transaction is closed")},o=async a=>{s();let c=this.key(a),h=r.get(c),u=e.get(c);return h?Buffer.from(h):u?this.run(["cat-file","blob",u]):null};return{get:o,head:async a=>await o(a)!==null,stageIfAbsent:async(a,c)=>{s();let h=this.key(a);if(e.has(h)||r.has(h))return"exists";if(c.length>1e8)throw new d("SYNC_LOCATION_REFUSED_WRITE","A context object is too large for this Git location.","Use an S3 location for this context.");return r.set(h,Buffer.from(c)),"staged"},abort:async()=>{i=!0,r.clear()},commit:async()=>{s();try{if(!r.size)return{created:[]};let a=this.prefix+"kane-context/.gitattributes";e.has(a)||r.set(a,Oe);let c=new Map;for(let[l,m]of r)c.set(l,(await this.run(["hash-object","-w","--no-filters","--stdin"],{input:m})).toString().trim());let h=this.contextKeys(e),u=()=>{this.assertUnchanged(h);for(let[l,m]of this.contextKeys(this.tree))h.set(l,m)},g=!1,w="",S=0;for(let l=0;l<4;l++){u();for(let f of this.tree.keys())if(!(!f.startsWith(this.prefix)||e.has(f)||c.has(f))&&B(f.slice(this.prefix.length))!==null)throw new d("SYNC_BEHIND","the location gained records after this batch was prepared; nothing was published","run kane-cli context pull, then push again");let m=new Map;for(let[f,T]of c){let C=this.tree.get(f);if(C&&C!==T){let R=B(f.slice(this.prefix.length));throw R?new d("SYNC_POSITION_TAKEN",g?`position ${R} on ${this.name} now holds different work; an earlier publication could not be confirmed`:`position ${R} on ${this.name} was published by another writer; this batch was not published`,this.takenRemedy(R)):new d("SYNC_OBJECT_CORRUPT",`existing context object ${f} differs from the intended bytes`,"the object needs a person to look; nothing was published")}C||m.set(f,T)}if(!m.size)return await this.verifyPublication(c),{created:[]};t=this.tip;let I=await this.build(t,m);await this.checkAttributes(I,[...r.keys()]),S++;let E=await this.exec(["--git-dir",this.repo,"push","--porcelain",this.options.url,`${I}:${this.ref}`]),y=N(E.stdout.toString()+`
|
|
5
|
+
`+E.stderr);w=y.trim();let O=E.code!==0&&/\[rejected\]|\[remote rejected\]/.test(y),p=E.code!==0&&(E.code===124||Pe.test(y));g||=p;try{await this.refresh()}catch{throw new d("SYNC_PUBLICATION_UNKNOWN","we could not confirm whether your context was uploaded; your local work is safe","check the connection and retry; kane-cli compares the published data before writing again")}if(u(),[...c].every(([f,T])=>this.tree.get(f)===T)){await this.verifyPublication(c);let f=E.code===0&&!E.stdout.toString().split(`
|
|
6
|
+
`).some(T=>T.startsWith("= "));return f&&await this.maintain(),{created:f?[...m.keys()].map(T=>T.slice(this.prefix.length)):[]}}if(E.code===0)throw new d("SYNC_PUBLICATION_UNKNOWN","the server accepted publication, but a fresh read did not confirm all context objects","retry after checking the location; do not discard local context");if(this.tip===t&&!g)throw new d("SYNC_LOCATION_REFUSED_WRITE",`${this.name} refused publication`,"check repository write access and branch rules, then retry",y.trim());if(this.tip===t&&!O&&g){await new Promise(f=>setTimeout(f,200*(l+1)+Math.random()*200));continue}await new Promise(f=>setTimeout(f,50*(l+1)+Math.random()*100))}throw new d("SYNC_PUBLICATION_UNKNOWN",`publication could not be confirmed after ${S} attempts; your local work is safe`,"run kane-cli context sync status, then retry",w||void 0)}finally{i=!0,r.clear()}}}}async maintain(){try{await this.exec(["--git-dir",this.repo,"gc","--auto","--quiet"],{timeout:3e5})}catch{}}assertUnchanged(e){for(let[t,r]of e)if(t.startsWith(`${this.prefix}kane-context/`)&&this.tree.get(t)!==r)throw new d("SYNC_REMOTE_ROLLED_BACK","The location changed or removed previously observed context data.","Ask the repository owner to restore the published context; keep your local copy.")}async verifyPublication(e){try{await this.verify(e)}catch{throw new d("SYNC_PUBLICATION_UNKNOWN","Publication was observed, but its bytes could not be fully verified. Your local work is safe.","Check the connection and retry before discarding local context.")}}async verify(e){for(let[t,r]of e){if(this.tree.get(t)!==r)throw new Error("Published context verification failed");let i=await this.run(["cat-file","blob",r]);if((await this.run(["hash-object","--no-filters","--stdin"],{input:i})).toString().trim()!==r)throw new Error("Published bytes do not match their Git object")}}async checkAttributes(e,t=[]){if(!e)return;let r=P(_(j(),"kane-git-attributes-"));try{let i={GIT_INDEX_FILE:_(r,"index")};await this.run(["read-tree",e],{env:i});let s=["commits/000000/000000001.json","blobs/ab/1234","proposals/sample/1234.json"].map(u=>`${this.prefix}kane-context/v1/${u}`),o=t.filter(u=>u.startsWith(`${this.prefix}kane-context/`)&&!u.endsWith("/.gitattributes")),a=Buffer.from([...new Set([...s,...o])].join("\0")+"\0"),h=(await this.run(["check-attr","--cached","-z","--stdin","text","filter","ident","working-tree-encoding"],{env:i,input:a})).toString().split("\0");for(let u=0;u+2<h.length;u+=3)if(!["unset","unspecified"].includes(h[u+2]))throw new d("SYNC_LOCATION_REFUSED_WRITE",`Git attributes transform context bytes (${h[u+1]}).`,"Use a dedicated context repository with no text, filter, ident or encoding conversions.")}finally{$(r,{recursive:!0,force:!0})}}async build(e,t){let r=P(_(j(),"kane-git-index-"));try{let i={GIT_INDEX_FILE:_(r,"index")};await this.run(e?["read-tree",e]:["read-tree","--empty"],{env:i});let s=Buffer.from([...t].map(([l,m])=>`100644 ${m} ${l}\0`).join(""));await this.run(["update-index","-z","--index-info"],{env:i,input:s});let a=["commit-tree",(await this.run(["write-tree"],{env:i})).toString().trim(),...e?["-p",e]:[],"-m",`Append context objects
|
|
7
|
+
|
|
8
|
+
Kane-Context: v1`],c=await this.exec(["--git-dir",this.repo,...a]),h=(c.code===0?c.stdout:await this.run(a,{env:$e})).toString().trim(),u=(await this.run(["rev-list","--parents","-n","1",h])).toString().trim().split(" ");if(u.length!==(e?2:1)||e&&u[1]!==e)throw new Error("Unsafe Git commit parent");let g=(await this.run(["diff-tree","--no-commit-id","--name-status","--no-renames","-r","-z",...e?[e,h]:["--root",h]])).toString().split("\0").filter(Boolean);if(g.length!==t.size*2||g.some((l,m)=>m%2===0?l!=="A":!t.has(l)))throw new Error("Unsafe Git commit: unexpected changed path or file mode");let w=await this.readTree(h),S=e?await this.readTree(e):new Map;if(w.size!==S.size+t.size||[...S].some(([l,m])=>w.get(l)!==m)||[...t].some(([l,m])=>S.has(l)||w.get(l)!==m))throw new Error("Unsafe Git commit: only intended new keys may be added");return h}finally{$(r,{recursive:!0,force:!0})}}async putIfAbsent(e,t){let r=await this.beginTransaction();try{if(await r.stageIfAbsent(e,t)==="exists")return"exists";try{return(await r.commit()).created.includes(e)?"created":"exists"}catch(i){if(i instanceof d&&["SYNC_POSITION_TAKEN","SYNC_OBJECT_CORRUPT"].includes(i.code)&&await this.head(e))return"exists";throw i}}finally{await r.abort()}}async probe(){await this.init();let e=ee(F(16).toString("hex"));try{await this.putIfAbsent(e,Buffer.from("connection check"))}catch(c){if(c instanceof d&&c.code==="SYNC_LOCATION_REFUSED_WRITE")return await this.refresh(),{tier:3,detail:"This location can be downloaded, but publication was refused."};throw c}if(await this.putIfAbsent(e,Buffer.from("must not replace"))!=="exists")throw new d("SYNC_PROBE_INCONCLUSIVE","Exclusive create could not be verified.","Retry the connection check.");let t=P(_(j(),"kane-git-reader-"));try{let c=new n({...this.options,cacheDir:t});if(!Buffer.from(await c.get(e)??[]).equals(Buffer.from("connection check"))||!await c.head(e)||!(await c.list(e)).includes(e))throw new Error("Independent reader could not confirm published bytes")}finally{$(t,{recursive:!0,force:!0})}let r=`refs/kane/probe/${F(16).toString("hex")}`,i=Array.from({length:8},()=>new n({...this.options,ref:r}));if((await Promise.allSettled(i.map(c=>c.head(e)))).some(c=>c.status==="rejected"))throw new d("SYNC_PROBE_INCONCLUSIVE","The concurrent connection check could not initialize its independent clients.","Retry the connection check.");let o=await Promise.allSettled(i.map((c,h)=>c.putIfAbsent(e,Buffer.from(`contender ${h}`))));if(o.some(c=>c.status==="rejected"))throw new d("SYNC_PROBE_INCONCLUSIVE","The server did not complete the concurrent connection check. Its scratch-ref policy may differ from the storage branch.","Ask the repository owner to allow the connection-check ref, then retry.");if(o.filter(c=>c.status==="fulfilled"&&c.value==="created").length!==1)throw new d("SYNC_PROBE_INCONCLUSIVE","The concurrent connection check did not produce exactly one winner.","Do not publish to this location until its connection check passes.");return{tier:1,detail:"Can download and publish; independent reads and concurrent writes verified."}}};import{closeSync as Ge,existsSync as Ue,fsyncSync as De,linkSync as Le,lstatSync as Ke,mkdirSync as Be,openSync as He,readFileSync as Me,readdirSync as Ye,realpathSync as q,rmSync as he,statSync as z,writeFileSync as Fe}from"fs";import{randomBytes as je}from"crypto";import{dirname as de,join as ue,resolve as le,sep as U}from"path";var ze=[/^Dropbox( \(.*\))?$/,/^Mobile Documents$/,/^OneDrive(-.*)?$/,/^Google ?Drive(-.*)?$/,/^My Drive$/,/^CloudStorage$/,/^iCloud Drive/],We="a folder synced by Dropbox, OneDrive, Google Drive or iCloud cannot be a location: these keep both sides of a conflict as duplicate files instead of refusing the second write \u2014 use a directory outside the sync client, a git-tracked folder, or an s3:// bucket";function fe(n){return n.split(U).some(e=>ze.some(t=>t.test(e)))}function qe(n){try{return q(n)}catch{return n}}var pe=".tmp-";function Xe(n){try{return Ke(n),!0}catch{return!1}}var b=n=>n.code??"",x=new Set(["ENOENT","ENOTDIR"]),W=new Set(["EACCES","EPERM"]),D=class{kind="dir";contractVersion=1;ceilingTier;root;createRoot;constructor(e,t={}){if(this.root=le(e),fe(this.root)||fe(qe(this.root)))throw new Error(We);this.ceilingTier=1,this.createRoot=t.createRoot??!0}requireRoot(){if(!this.createRoot){try{if(z(this.root).isDirectory())return}catch(e){if(W.has(b(e)))throw this.denied();if(!x.has(b(e)))throw e}throw this.unreachable()}}unreachable(){return new d("SYNC_LOCATION_UNREACHABLE",`nothing answered at ${this.root}: that folder does not exist and cannot be created`,"check the path, then run the command again")}denied(){return new d("SYNC_LOCATION_DENIED",`${this.root} cannot be read by this account`,"ask the owner of the folder for access")}readFault(e){return W.has(b(e))?this.denied():e}writeFault(e){return x.has(b(e))||b(e)==="EROFS"?this.rootExists()?this.refusedWrite("its filesystem is read-only"):this.unreachable():W.has(b(e))?this.refusedWrite("this account has no write access"):e}refusedWrite(e){return new d("SYNC_LOCATION_REFUSED_WRITE",`${this.root} cannot be written: ${e}`,"ask the owner of the folder for write access, or pull from it without pushing")}rootExists(){try{return z(this.root).isDirectory()}catch{return!1}}path(e){let t=e.split("/"),r=e!==""&&!e.startsWith("/")&&!e.includes("\\")&&t.every(s=>s!==""&&s!=="."&&s!==".."),i=r?le(this.root,...t):"";if(!r||!i.startsWith(this.root+U)||!this.contained(i))throw new Error(`bad key ${e}`);return i}contained(e){let t=e;for(;!Xe(t);)t=de(t);if(t===this.root||!t.startsWith(this.root+U))return!0;try{let r=q(this.root),i=q(t);return i===r||i.startsWith(r+U)}catch{return!1}}async head(e){this.requireRoot();try{return z(this.path(e)).isFile()}catch(t){if(x.has(b(t)))return!1;throw this.readFault(t)}}async get(e){this.requireRoot();try{return new Uint8Array(Me(this.path(e)))}catch(t){if(x.has(b(t)))return null;throw this.readFault(t)}}async list(e){this.requireRoot();let t=e.lastIndexOf("/"),r=t===-1?"":e.slice(0,t),i=r===""?this.root:this.path(r),s=[],o=(a,c)=>{for(let h of Ye(a,{withFileTypes:!0})){let u=c+h.name;h.isDirectory()?o(ue(a,h.name),`${u}/`):!h.name.startsWith(pe)&&u.startsWith(e)&&s.push(u)}};try{o(i,r===""?"":`${r}/`)}catch(a){if(x.has(b(a))&&!Ue(i))return[];throw this.readFault(a)}return s.sort()}async putIfAbsent(e,t){this.requireRoot();let r=this.path(e),i=de(r),s=ue(i,`${pe}${process.pid}-${je(6).toString("hex")}`),o;try{Be(i,{recursive:!0}),o=He(s,"wx")}catch(c){throw this.writeFault(c)}try{Fe(o,t),De(o)}finally{Ge(o)}let a="created";try{Le(s,r)}catch(c){if(c.code!=="EEXIST")throw he(s,{force:!0}),c;a="exists"}return he(s,{force:!0}),Z(i),a}};var J=new TextEncoder,Je={appstream2:"appstream",cloudhsmv2:"cloudhsm",email:"ses",marketplace:"aws-marketplace",mobile:"AWSMobileHubService",pinpoint:"mobiletargeting",queue:"sqs","git-codecommit":"codecommit","mturk-requester-sandbox":"mturk-requester","personalize-runtime":"personalize"},Ve=new Set(["authorization","content-type","content-length","user-agent","presigned-expires","expect","x-amzn-trace-id","range","connection"]),L=class{constructor({accessKeyId:e,secretAccessKey:t,sessionToken:r,service:i,region:s,cache:o,retries:a,initRetryMs:c}){if(e==null)throw new TypeError("accessKeyId is a required option");if(t==null)throw new TypeError("secretAccessKey is a required option");this.accessKeyId=e,this.secretAccessKey=t,this.sessionToken=r,this.service=i,this.region=s,this.cache=o||new Map,this.retries=a??10,this.initRetryMs=c||50}async sign(e,t){if(e instanceof Request){let{method:s,url:o,headers:a,body:c}=e;t=Object.assign({method:s,url:o,headers:a},t),t.body==null&&a.has("Content-Type")&&(t.body=c!=null&&a.has("X-Amz-Content-Sha256")?c:await e.clone().arrayBuffer()),e=o}let r=new V(Object.assign({url:e.toString()},t,this,t&&t.aws)),i=Object.assign({},t,await r.sign());delete i.aws;try{return new Request(i.url.toString(),i)}catch(s){if(s instanceof TypeError)return new Request(i.url.toString(),Object.assign({duplex:"half"},i));throw s}}async fetch(e,t){for(let r=0;r<=this.retries;r++){let i=fetch(await this.sign(e,t));if(r===this.retries)return i;let s=await i;if(s.status<500&&s.status!==429)return s;await new Promise(o=>setTimeout(o,Math.random()*this.initRetryMs*Math.pow(2,r)))}throw new Error("An unknown error occurred, ensure retries is not negative")}},V=class{constructor({method:e,url:t,headers:r,body:i,accessKeyId:s,secretAccessKey:o,sessionToken:a,service:c,region:h,cache:u,datetime:g,signQuery:w,appendSessionToken:S,allHeaders:l,singleEncode:m}){if(t==null)throw new TypeError("url is a required option");if(s==null)throw new TypeError("accessKeyId is a required option");if(o==null)throw new TypeError("secretAccessKey is a required option");this.method=e||(i?"POST":"GET"),this.url=new URL(t),this.headers=new Headers(r||{}),this.body=i,this.accessKeyId=s,this.secretAccessKey=o,this.sessionToken=a;let I,E;(!c||!h)&&([I,E]=Qe(this.url,this.headers)),this.service=c||I||"",this.region=h||E||"us-east-1",this.cache=u||new Map,this.datetime=g||new Date().toISOString().replace(/[:-]|\.\d{3}/g,""),this.signQuery=w,this.appendSessionToken=S||this.service==="iotdevicegateway",this.headers.delete("Host"),this.service==="s3"&&!this.signQuery&&!this.headers.has("X-Amz-Content-Sha256")&&this.headers.set("X-Amz-Content-Sha256","UNSIGNED-PAYLOAD");let y=this.signQuery?this.url.searchParams:this.headers;if(y.set("X-Amz-Date",this.datetime),this.sessionToken&&!this.appendSessionToken&&y.set("X-Amz-Security-Token",this.sessionToken),this.signableHeaders=["host",...this.headers.keys()].filter(p=>l||!Ve.has(p)).sort(),this.signedHeaders=this.signableHeaders.join(";"),this.canonicalHeaders=this.signableHeaders.map(p=>p+":"+(p==="host"?this.url.host:(this.headers.get(p)||"").replace(/\s+/g," "))).join(`
|
|
9
|
+
`),this.credentialString=[this.datetime.slice(0,8),this.region,this.service,"aws4_request"].join("/"),this.signQuery&&(this.service==="s3"&&!y.has("X-Amz-Expires")&&y.set("X-Amz-Expires","86400"),y.set("X-Amz-Algorithm","AWS4-HMAC-SHA256"),y.set("X-Amz-Credential",this.accessKeyId+"/"+this.credentialString),y.set("X-Amz-SignedHeaders",this.signedHeaders)),this.service==="s3")try{this.encodedPath=decodeURIComponent(this.url.pathname.replace(/\+/g," "))}catch{this.encodedPath=this.url.pathname}else this.encodedPath=this.url.pathname.replace(/\/+/g,"/");m||(this.encodedPath=encodeURIComponent(this.encodedPath).replace(/%2F/g,"/")),this.encodedPath=ye(this.encodedPath);let O=new Set;this.encodedSearch=[...this.url.searchParams].filter(([p])=>{if(!p)return!1;if(this.service==="s3"){if(O.has(p))return!1;O.add(p)}return!0}).map(p=>p.map(f=>ye(encodeURIComponent(f)))).sort(([p,f],[T,C])=>p<T?-1:p>T?1:f<C?-1:f>C?1:0).map(p=>p.join("=")).join("&")}async sign(){return this.signQuery?(this.url.searchParams.set("X-Amz-Signature",await this.signature()),this.sessionToken&&this.appendSessionToken&&this.url.searchParams.set("X-Amz-Security-Token",this.sessionToken)):this.headers.set("Authorization",await this.authHeader()),{method:this.method,url:this.url,headers:this.headers,body:this.body}}async authHeader(){return["AWS4-HMAC-SHA256 Credential="+this.accessKeyId+"/"+this.credentialString,"SignedHeaders="+this.signedHeaders,"Signature="+await this.signature()].join(", ")}async signature(){let e=this.datetime.slice(0,8),t=[this.secretAccessKey,e,this.region,this.service].join(),r=this.cache.get(t);if(!r){let i=await v("AWS4"+this.secretAccessKey,e),s=await v(i,this.region),o=await v(s,this.service);r=await v(o,"aws4_request"),this.cache.set(t,r)}return X(await v(r,await this.stringToSign()))}async stringToSign(){return["AWS4-HMAC-SHA256",this.datetime,this.credentialString,X(await me(await this.canonicalString()))].join(`
|
|
10
|
+
`)}async canonicalString(){return[this.method.toUpperCase(),this.encodedPath,this.encodedSearch,this.canonicalHeaders+`
|
|
11
|
+
`,this.signedHeaders,await this.hexBodyHash()].join(`
|
|
12
|
+
`)}async hexBodyHash(){let e=this.headers.get("X-Amz-Content-Sha256")||(this.service==="s3"&&this.signQuery?"UNSIGNED-PAYLOAD":null);if(e==null){if(this.body&&typeof this.body!="string"&&!("byteLength"in this.body))throw new Error("body must be a string, ArrayBuffer or ArrayBufferView, unless you include the X-Amz-Content-Sha256 header");e=X(await me(this.body||""))}return e}};async function v(n,e){let t=await crypto.subtle.importKey("raw",typeof n=="string"?J.encode(n):n,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);return crypto.subtle.sign("HMAC",t,J.encode(e))}async function me(n){return crypto.subtle.digest("SHA-256",typeof n=="string"?J.encode(n):n)}var ge=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function X(n){let e=new Uint8Array(n),t="";for(let r=0;r<e.length;r++){let i=e[r];t+=ge[i>>>4&15],t+=ge[i&15]}return t}function ye(n){return n.replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase())}function Qe(n,e){let{hostname:t,pathname:r}=n;if(t.endsWith(".on.aws")){let a=t.match(/^[^.]{1,63}\.lambda-url\.([^.]{1,63})\.on\.aws$/);return a!=null?["lambda",a[1]||""]:["",""]}if(t.endsWith(".r2.cloudflarestorage.com"))return["s3","auto"];if(t.endsWith(".backblazeb2.com")){let a=t.match(/^(?:[^.]{1,63}\.)?s3\.([^.]{1,63})\.backblazeb2\.com$/);return a!=null?["s3",a[1]||""]:["",""]}let i=t.replace("dualstack.","").match(/([^.]{1,63})\.(?:([^.]{0,63})\.)?amazonaws\.com(?:\.cn)?$/),s=i&&i[1]||"",o=i&&i[2];if(o==="us-gov")o="us-gov-west-1";else if(o==="s3"||o==="s3-accelerate")o="us-east-1",s="s3";else if(s==="iot")t.startsWith("iot.")?s="execute-api":t.startsWith("data.jobs.iot.")?s="iot-jobs-data":s=r==="/mqtt"?"iotdevicegateway":"iotdata";else if(s==="autoscaling"){let a=(e.get("X-Amz-Target")||"").split(".")[0];a==="AnyScaleFrontendService"?s="application-autoscaling":a==="AnyScaleScalingPlannerFrontendService"&&(s="autoscaling-plans")}else o==null&&s.startsWith("s3-")?(o=s.slice(3).replace(/^fips-|^external-1/,""),s="s3"):s.endsWith("-fips")?s=s.slice(0,-5):o&&/-\d$/.test(s)&&!/-\d$/.test(o)&&([s,o]=[o,s]);return[Je[s]||s,o||""]}var Q=3,Ze=[300,900],et=200,tt=15e3,rt=/<Key>([^<]*)<\/Key>/g,it=/<NextContinuationToken>([^<]*)<\/NextContinuationToken>/,we=n=>new Promise(e=>setTimeout(e,n));function nt(n){let e=n instanceof Error?n.name:"";return e==="TimeoutError"||e==="AbortError"?"timeout":"network"}async function st(n){try{return await n.text()}catch{return""}}var K=class n{kind="s3";contractVersion=1;ceilingTier=1;client;base;prefix;pageSize;name;constructor(e){this.client=new L({accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,service:"s3",region:e.region}),this.base=e.endpoint?`${e.endpoint.replace(/\/+$/,"")}/${e.bucket}`:`https://${e.bucket}.s3.${e.region}.amazonaws.com`,this.prefix=e.prefix,this.pageSize=e.pageSize??1e3,this.name=e.name??"this location"}url(e){return`${this.base}/${this.prefix}${e}`}static line(e,t,r){return`${e} ${new URL(t).pathname} -> ${r}`}answer(e,t,r){let i=n.line(e,t,r);return r===404?new d("SYNC_LOCATION_UNREACHABLE",`nothing answered at ${this.base}: no bucket there`,"check the bucket name and the endpoint, then run the command again",i):r===401||r===403?new d("SYNC_LOCATION_DENIED",`the bucket at ${this.base} did not accept ${this.name}'s access keys, even for reading`,`ask the owner of the bucket for access, or bind it again with the right keys: kane-cli context sync add ${this.name} <descriptor> --credential-env <VAR>`,i):r>=500||r===429?this.unreachable(i):r===301||r===307||r===308?new d("SYNC_LOCATION_UNREACHABLE",`the bucket at ${this.base} answered with a redirect: it lives in another region or behind another endpoint`,`set region=<its region> (or endpoint=<its endpoint>) in the descriptor, then bind ${this.name} again`,i):new Error(i)}unreachable(e){return new d("SYNC_LOCATION_UNREACHABLE",`nothing answered at ${this.base}`,"check the endpoint and your network, then run the command again",e)}async request(e,t,r={}){let i="";for(let s=0;s<Q;s++){s>0&&await we(Ze[s-1]);let o;try{o=await fetch(await this.client.sign(t,{method:e,headers:r.headers,body:r.body&&new Uint8Array(r.body),signal:AbortSignal.timeout(tt)}))}catch(a){i=nt(a);continue}if((o.status>=500||o.status===429)&&s<Q-1){i=String(o.status);continue}return o}throw this.unreachable(`${n.line(e,t,i)} after ${Q} attempts`)}async head(e){let t=await this.request("HEAD",this.url(e));if(t.status===200)return!0;if(t.status===404)return!1;throw this.answer("HEAD",this.url(e),t.status)}async bodyOf(e,t,r,i){try{return await i(e)}catch{throw this.unreachable(n.line(t,r,"body read failed"))}}async get(e){let t=await this.request("GET",this.url(e));if(t.status===200)return new Uint8Array(await this.bodyOf(t,"GET",this.url(e),r=>r.arrayBuffer()));if(t.status===404)return null;throw this.answer("GET",this.url(e),t.status)}async list(e){let t=[],r=null;do{let i=new URLSearchParams({"list-type":"2",prefix:this.prefix+e,"max-keys":String(this.pageSize)});r&&i.set("continuation-token",r);let s=`${this.base}?${i.toString()}`,o=await this.request("GET",s);if(o.status!==200)throw this.answer("GET",s,o.status);let a=await this.bodyOf(o,"GET",s,c=>c.text());for(let c of a.matchAll(rt))t.push(c[1].slice(this.prefix.length));r=it.exec(a)?.[1]??null}while(r);return t.sort()}async putIfAbsent(e,t){let r=await this.create(e,t);if(r!=="conflict")return r;if(await we(et),await this.head(e))return"exists";let i=await this.create(e,t);if(i!=="conflict")return i;throw new Error(`${n.line("PUT",this.url(e),409)} twice (ConditionalRequestConflict) and the key is still absent`)}async create(e,t){let r=this.url(e),i=await this.request("PUT",r,{headers:{"If-None-Match":"*","Content-Type":"application/octet-stream"},body:t});if(i.status===200||i.status===201)return"created";if(i.status===412)return"exists";if(i.status===409&&(await st(i)).includes("ConditionalRequestConflict"))return"conflict";throw i.status===401||i.status===403?new d("SYNC_LOCATION_REFUSED_WRITE",`${this.name}'s access keys cannot write to ${this.base}`,"ask the owner of the bucket for write access, or pull from it without pushing",n.line("PUT",r,i.status)):this.answer("PUT",r,i.status)}};import{chmodSync as ot,mkdirSync as at,readFileSync as ct,rmSync as ht,writeFileSync as dt}from"fs";import{join as Se}from"path";var Ee="context-sync",ut=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function k(n,e=A){if(!ut.test(n))throw new Error(`bad location name ${JSON.stringify(n)} \u2014 letters, digits, dot, dash and underscore only`);return Se(e,Ee,`${n}.json`)}function Te(n,e=A){let t=process.env.KANE_SYNC_S3_ACCESS_KEY_ID,r=process.env.KANE_SYNC_S3_SECRET_ACCESS_KEY;if(t&&r)return{accessKeyId:t,secretAccessKey:r};let i=k(n,e),s;try{s=ct(i,"utf-8")}catch{return null}let o;try{o=JSON.parse(s)}catch(a){throw new Error(`${i} is not readable JSON: ${a instanceof Error?a.message:String(a)}`)}if(typeof o!="object"||o===null||!("accessKeyId"in o)||!("secretAccessKey"in o)||typeof o.accessKeyId!="string"||typeof o.secretAccessKey!="string")throw new Error(`${i} does not hold an access key and a secret \u2014 re-add the location to replace it`);return{accessKeyId:o.accessKeyId,secretAccessKey:o.secretAccessKey}}function Mt(n,e,t=A){let r=k(n,t);at(Se(t,Ee),{recursive:!0,mode:448}),dt(r,JSON.stringify(e)+`
|
|
13
|
+
`,{mode:384}),ot(r,384)}function Yt(n,e=A){ht(k(n,e),{force:!0})}function Xt(n,e,t,r={}){switch(n.kind){case"fake":{let i=t?.get(n.location.slice(7));if(!i)throw new Error(`${n.location} is a test-only location and no test registered it`);return i}case"git":return new G({url:n.gitUrl,branch:n.branch,prefix:n.prefix,name:e});case"dir":return new D(n.path,{createRoot:r.createRoot});case"s3":{let i=Te(e);if(!i)throw new Error(`no credentials for ${e} \u2014 re-add it with --credential-env <VAR> or --credential-file <path> (kane-cli context sync add), set KANE_SYNC_S3_ACCESS_KEY_ID and KANE_SYNC_S3_SECRET_ACCESS_KEY, or write {"accessKeyId", "secretAccessKey"} to ${k(e)} with mode 0600`);return new K({endpoint:n.endpoint,region:n.region,bucket:n.bucket,prefix:n.prefix,name:e,...i})}}}export{H as a,oe as b,gt as c,yt as d,k as e,Mt as f,Yt as g,Xt as h};
|
|
14
|
+
/*! Bundled license information:
|
|
15
|
+
|
|
16
|
+
aws4fetch/dist/aws4fetch.esm.mjs:
|
|
17
|
+
(**
|
|
18
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
19
|
+
* @copyright Michael Hart 2024
|
|
20
|
+
*)
|
|
21
|
+
*/
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var S=new Set(["SYNC_BEHIND","SYNC_DIVERGED","SYNC_POSITION_TAKEN","SYNC_LOCAL_MOVED"]),i=new Set(["SYNC_REMOTE_CHAIN_BROKEN","SYNC_OBJECT_CORRUPT","SYNC_LOCAL_RECORD_CORRUPT"]),s=class extends Error{constructor(n,e,u,p){super(e);this.code=n;this.remedy=u;this.diagnostic=p}};function Y(r){return S.has(r)?3:i.has(r)?1:2}var o="kane-context/v1",E=`${o}/commits/`,f=`${o}/meta.json`,O=1e3,C=999999999,c=new RegExp(`^${o}/commits/(\\d{6})/(\\d{9})\\.json$`),R=/^sha256:([0-9a-f]{64})$/;function N(r,t){let n=R.exec(r);if(!n)throw new Error(`not a ${t} fingerprint: ${r} \u2014 expected sha256:<64 lower-case hex>`);return n[1]}function _(r){if(!Number.isInteger(r)||r<1||r>C)throw new Error(`bad position ${r} \u2014 a position is a whole number from 1 to ${C}`);return String(Math.floor((r-1)/O)).padStart(6,"0")}function g(r){return`${E}${_(r)}/${String(r).padStart(9,"0")}.json`}function l(r){return`${E}${_(r)}/`}function d(r){let t=c.exec(r);if(!t)return null;let n=Number(t[2]);return n<1||t[1]!==_(n)?null:n}function D(r){let t=N(r,"blob");return`${o}/blobs/${t.slice(0,2)}/${t.slice(2)}`}function L(r,t){return`${a(r)}${N(t,"proposal digest").slice(0,12)}.json`}function a(r){let t=I(r);if(t===""||t==="."||t==="..")throw new Error(`bad proposal id ${JSON.stringify(r)} \u2014 a proposal id names a folder`);return`${o}/proposals/${t}/`}function I(r){let t="";for(let n of Buffer.from(r,"utf8")){let e=String.fromCharCode(n);t+=/^[a-z0-9._-]$/.test(e)?e:`~${n.toString(16).padStart(2,"0")}`}return t}function $(r){if(!/^[0-9a-f]{16,32}$/.test(r))throw new Error("probe nonce must be 16 to 32 lower-case hex characters");return`${o}/probe/${r}`}export{s as a,Y as b,E as c,f as d,g as e,l as f,d as g,D as h,L as i,a as j,$ as k};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b,b as $}from"./chunk-
|
|
2
|
+
import{a as b,b as $}from"./chunk-GP7WD4UY.js";function C(n){return n.replace(/\n$/,"").split(`
|
|
3
3
|
`).map((l,o)=>`${String(o+1).padStart(4,"0")}| ${l}`).join(`
|
|
4
4
|
`)}function S(n,d,l){if(!n.quote)return n;let o=$(l,n.anchor);if(o!==null&&o.includes(n.quote))return n;let a=d.indexOf(n.quote);if(a===-1||d.indexOf(n.quote,a+1)!==-1)return"gone-or-ambiguous";let t=d.slice(0,a).split(`
|
|
5
5
|
`).length,r=t+n.quote.replace(/\n$/,"").split(`
|