@testmuai/kane-cli 0.8.13 → 0.8.15
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-B6ZIO3JL.js → ChatSurface-2GPR4S7I.js} +3 -3
- package/dist/{ChromeProfilePicker-QSICCUMV.js → ChromeProfilePicker-XAZGCJKR.js} +1 -1
- package/dist/{CliFeedbackPrompt-LLLNSKW2.js → CliFeedbackPrompt-4SILDU7S.js} +1 -1
- package/dist/{CliUploadProgress-N5IY66T2.js → CliUploadProgress-OAQBY55Y.js} +1 -1
- package/dist/{ConfigView-UQIRPENS.js → ConfigView-FDBMJC26.js} +1 -1
- package/dist/EvidenceViewOffer-YSNRKKPC.js +2 -0
- package/dist/FolderPicker-XCTJ5447.js +2 -0
- package/dist/{InfoBox-ZGSLEOPE.js → InfoBox-ZPUBB7J4.js} +1 -1
- package/dist/{LinksBox-JFT44YUK.js → LinksBox-MNNNOH23.js} +1 -1
- package/dist/{ProfilesView-WZSPK3HF.js → ProfilesView-GY5QCIT3.js} +1 -1
- package/dist/{ProjectPicker-SBBGVF4L.js → ProjectPicker-UCHMCNFV.js} +1 -1
- package/dist/{SaveSessionPrompt-F3563T3C.js → SaveSessionPrompt-ATVHKAHN.js} +1 -1
- package/dist/ScrollbackTap-QHJOFYMC.js +2 -0
- package/dist/SingleShotApp-IPNZBFXB.js +2 -0
- package/dist/{SummaryBox-6N6NESLI.js → SummaryBox-2DTNE25L.js} +1 -1
- package/dist/TestMdRunView-2FQIEI5W.js +2 -0
- package/dist/{TestrunEvidenceTable-JLJBJ76Q.js → TestrunEvidenceTable-6UE5EMON.js} +1 -1
- package/dist/{WhoamiView-PNVUCWLB.js → WhoamiView-TFCHIOW5.js} +1 -1
- package/dist/agent-parse-XMWVKCRD.js +2 -0
- package/dist/{app-download-NNB52ZRJ.js → app-download-N7MLJQ42.js} +1 -1
- package/dist/attach-target-V6LECVES.js +2 -0
- package/dist/{auth-JIDDELKY.js → auth-IQPCVCZK.js} +1 -1
- package/dist/{binary-LXYAW7WQ.js → binary-VML7EGV4.js} +1 -1
- package/dist/bind-YV6V5AI6.js +15 -0
- package/dist/{bootstrap-THOC3SS7.js → bootstrap-KCPWDBLX.js} +1 -1
- package/dist/bridge-5UKX7YIO.js +2 -0
- package/dist/{changelog-BSMZXLTG.js → changelog-CJFWGRIL.js} +1 -1
- package/dist/chat-committer-HDE3TP5I.js +2 -0
- package/dist/chat-controller-3EPK7UZG.js +2 -0
- package/dist/chunk-27ERHOW3.js +2 -0
- package/dist/{chunk-RN5ERSV2.js → chunk-2WRBCTNM.js} +1 -1
- package/dist/chunk-3D5MKSG3.js +5 -0
- package/dist/{chunk-FNIL4G3V.js → chunk-3GELV4IN.js} +3 -3
- package/dist/{chunk-EEFZXZTZ.js → chunk-3IXEARDX.js} +1 -1
- package/dist/chunk-3N6IAVD5.js +7 -0
- package/dist/{chunk-DXFMELKC.js → chunk-4TMQTSIO.js} +1 -1
- package/dist/chunk-52WM3XYO.js +4 -0
- package/dist/{chunk-R7QAS6LZ.js → chunk-55YDTPB7.js} +1 -1
- package/dist/{chunk-477DYMXZ.js → chunk-5HTSKF5K.js} +1 -1
- package/dist/{chunk-IDX3TOPY.js → chunk-5LJRZI7S.js} +1 -1
- package/dist/chunk-66MOZKD2.js +2 -0
- package/dist/chunk-6DHEOPXX.js +9 -0
- package/dist/{chunk-NU45ROHH.js → chunk-6GLFQHSW.js} +2 -2
- package/dist/chunk-6K4FDYMH.js +89 -0
- package/dist/{chunk-7GUFVQOQ.js → chunk-6L5RV62W.js} +1 -1
- package/dist/{chunk-TDNM22BQ.js → chunk-74FHTDEE.js} +1 -1
- package/dist/chunk-7EGIX6Y4.js +8 -0
- package/dist/chunk-7O54QURK.js +2 -0
- package/dist/chunk-7WDPU33M.js +2 -0
- package/dist/{chunk-BTBUIL4Q.js → chunk-7X4R6464.js} +1 -1
- package/dist/{chunk-FUP4AP6J.js → chunk-A557OSRS.js} +1 -1
- package/dist/chunk-AHXOKBVE.js +7 -0
- package/dist/{chunk-DNNZ353O.js → chunk-ALCE5RLK.js} +1 -1
- package/dist/{chunk-I75FRXKE.js → chunk-AYJ2YZP5.js} +1 -1
- package/dist/chunk-BMVE73M7.js +21 -0
- package/dist/chunk-CAOZKSQ3.js +8 -0
- package/dist/{chunk-BJAHVN2F.js → chunk-CNPIJFZM.js} +1 -1
- package/dist/{chunk-EV64VI66.js → chunk-CRZUBDJ3.js} +1 -1
- package/dist/{chunk-PUM5J56E.js → chunk-D6GBOFK5.js} +1 -1
- package/dist/{chunk-YEZYO5QH.js → chunk-DMCEGMGB.js} +1 -1
- package/dist/{chunk-TMRLBSIA.js → chunk-DMT3W26F.js} +1 -1
- package/dist/{chunk-XS3HIVNS.js → chunk-EDQZIEPJ.js} +1 -1
- package/dist/{chunk-VJ3ES3RR.js → chunk-EFTRH35G.js} +1 -1
- package/dist/{chunk-Q4YAJJPP.js → chunk-EJXBKCNF.js} +1 -1
- package/dist/{chunk-NUWOQS6L.js → chunk-EPE2ELDH.js} +1 -1
- package/dist/{chunk-WIAZN7G4.js → chunk-FFVNISYH.js} +1 -1
- package/dist/chunk-FQNQVC5O.js +5 -0
- package/dist/chunk-FXO7JKMZ.js +4 -0
- package/dist/chunk-GP7WD4UY.js +4 -0
- package/dist/{chunk-K2UEVCIJ.js → chunk-GSDXZS4U.js} +1 -1
- package/dist/{chunk-J2UN2AHO.js → chunk-GZ65ZA4C.js} +1 -1
- package/dist/chunk-H6TNBKGR.js +5 -0
- package/dist/{chunk-GILD6RGH.js → chunk-HLCETZ73.js} +1 -1
- package/dist/chunk-HOA4VWSD.js +5 -0
- package/dist/{chunk-33GXXC2L.js → chunk-HYTBEPC2.js} +1 -1
- package/dist/{chunk-PWRIG6UB.js → chunk-IAHOLH5W.js} +1 -1
- package/dist/chunk-IE3OO5GI.js +2 -0
- package/dist/{chunk-UF4JZXEE.js → chunk-JCMHB4KH.js} +1 -1
- package/dist/{chunk-KV5BOFPK.js → chunk-JFUFWICY.js} +2 -2
- package/dist/{chunk-FE6XRABM.js → chunk-JGAMMOUC.js} +1 -1
- package/dist/{chunk-CAO3XRA2.js → chunk-JL3L6KOG.js} +1 -1
- package/dist/chunk-JQCOKL6U.js +15 -0
- package/dist/{chunk-IZU5ND2C.js → chunk-JSS22MFY.js} +9 -9
- package/dist/chunk-JVEZBJJ7.js +2 -0
- package/dist/{chunk-3SP4JVDN.js → chunk-KALEPJAV.js} +2 -2
- package/dist/{chunk-AIVOYTYQ.js → chunk-KUS324VE.js} +1 -1
- package/dist/chunk-KZG4E5RM.js +2 -0
- package/dist/{chunk-KSLJOUH4.js → chunk-LJGAXIDU.js} +1 -1
- package/dist/chunk-M36MOFJW.js +9 -0
- package/dist/{chunk-ZOSY2PJM.js → chunk-MLYNVJNH.js} +1 -1
- package/dist/{chunk-XL6HDWM3.js → chunk-N3CVR4Z2.js} +1 -1
- package/dist/{chunk-2X3TANEV.js → chunk-NLEA6NPU.js} +1 -1
- package/dist/{chunk-4PARDPK2.js → chunk-NUJVYAI4.js} +1 -1
- package/dist/{chunk-3M2D7UUI.js → chunk-NWNG5UWD.js} +1 -1
- package/dist/{chunk-IWVA37B6.js → chunk-O25AL4B7.js} +1 -1
- package/dist/{chunk-KAZGHWGK.js → chunk-O3XBIURC.js} +1 -1
- package/dist/chunk-O66WXOOC.js +5 -0
- package/dist/{chunk-W2UYUV47.js → chunk-OFWJBOGT.js} +2 -2
- package/dist/{chunk-DMLYUTS4.js → chunk-OGDAWNFY.js} +1 -1
- package/dist/chunk-OPL2MIQG.js +2 -0
- package/dist/{chunk-F5AI3UVS.js → chunk-ORQGQSWG.js} +2 -2
- package/dist/{chunk-7KIIM6H7.js → chunk-OWGFFJKK.js} +1 -1
- package/dist/{chunk-6AZNGOLH.js → chunk-PGXJ275T.js} +1 -1
- package/dist/chunk-Q77QO3PC.js +17 -0
- package/dist/{chunk-XH2KDLZO.js → chunk-QVLYK5JL.js} +1 -1
- package/dist/{chunk-UZCSVEWP.js → chunk-QXRT6HSV.js} +1 -1
- package/dist/{chunk-LWQNRZH3.js → chunk-R7QMZBBH.js} +1 -1
- package/dist/{chunk-DIM5X2FR.js → chunk-RI4ILZZC.js} +1 -1
- package/dist/{chunk-D4G3SEBU.js → chunk-RQILLYSP.js} +1 -1
- package/dist/chunk-S4JUCBCT.js +7 -0
- package/dist/{chunk-VYMMGWVO.js → chunk-SHSXOYKT.js} +1 -1
- package/dist/{chunk-XAM5E27U.js → chunk-SIYSKT6I.js} +1 -1
- package/dist/chunk-SWTJMTBY.js +29 -0
- package/dist/chunk-T4R26WER.js +9 -0
- package/dist/{chunk-O5U6EAL3.js → chunk-TCAHDVII.js} +1 -1
- package/dist/{chunk-LAQBCZ5A.js → chunk-TEHZUSUY.js} +1 -1
- package/dist/chunk-TNBF5OMZ.js +2 -0
- package/dist/chunk-TU6IMGWO.js +2 -0
- package/dist/{chunk-NM76SG3S.js → chunk-TVELOH5A.js} +1 -1
- package/dist/chunk-UHSNUUX3.js +35 -0
- package/dist/{chunk-5G22NOZK.js → chunk-UHT5SVP5.js} +1 -1
- package/dist/{chunk-KXUTO5WC.js → chunk-UZIMYV5U.js} +1 -1
- package/dist/chunk-VOTIGXQ4.js +16 -0
- package/dist/{chunk-MXDWS7S4.js → chunk-VZDLRJ5N.js} +7 -7
- package/dist/{chunk-3FXNQTCE.js → chunk-W77SZLFC.js} +1 -1
- package/dist/{chunk-OHK6V7JX.js → chunk-WFBJNVMQ.js} +1 -1
- package/dist/{chunk-N2I23ANS.js → chunk-WNB2IYHY.js} +1 -1
- package/dist/chunk-XSUJJB7Z.js +11 -0
- package/dist/{chunk-TXZ66K4Q.js → chunk-XUJXGE42.js} +1 -1
- package/dist/{chunk-AQWTK6IN.js → chunk-XXE7W5AV.js} +1 -1
- package/dist/{chunk-EXLXV5OU.js → chunk-YAAQER2L.js} +1 -1
- package/dist/{chunk-XS2LZFCH.js → chunk-YCH7H7JX.js} +1 -1
- package/dist/{chunk-SEKJZOKW.js → chunk-YGMUNNKH.js} +1 -1
- package/dist/{chunk-ARU6KAGY.js → chunk-YKYKOV6U.js} +1 -1
- package/dist/chunk-YLQHY4A7.js +2 -0
- package/dist/{chunk-KGKJU27A.js → chunk-YYYQ5MVD.js} +1 -1
- package/dist/chunk-YZVR7ESF.js +2 -0
- package/dist/{chunk-PYQS5ST6.js → chunk-Z3YYMZHT.js} +2 -2
- package/dist/{chunk-QD2BUO5M.js → chunk-Z73ZYROU.js} +1 -1
- package/dist/{chunk-JX2CAVX6.js → chunk-ZCSEBT2W.js} +1 -1
- package/dist/{chunk-MCKBJIBB.js → chunk-ZEVU2OT3.js} +1 -1
- package/dist/{chunk-K4SULRBL.js → chunk-ZKCCG3GK.js} +1 -1
- package/dist/chunk-ZUZ6QJRA.js +23 -0
- package/dist/committer-IYQPXG6C.js +2 -0
- package/dist/{config-BCGD2FEX.js → config-UGCWZGH5.js} +1 -1
- package/dist/cover-cmd-SWJ2NZUZ.js +3 -0
- package/dist/{credentials-YNH5BU2Z.js → credentials-GWLYYRTL.js} +1 -1
- package/dist/{deps-bundle-LOFI4DAJ.js → deps-bundle-VNGC2UG6.js} +1 -1
- package/dist/{deps-resolve-GA6IPHVZ.js → deps-resolve-YLCEU6I7.js} +1 -1
- package/dist/design-committer-J57IAAA5.js +2 -0
- package/dist/dispatch-OMQCT7WO.js +2 -0
- package/dist/{doctor-W5TQBYB5.js → doctor-B4Z6RPKQ.js} +1 -1
- package/dist/docx-convert-WPZS6OIC.js +2 -0
- package/dist/{dossier-Y6TJWFZU.js → dossier-UGJMYYAB.js} +1 -1
- package/dist/evidence-XJGXVLO5.js +2 -0
- package/dist/evolve-cmd-QQQPPGL3.js +2 -0
- package/dist/explain-H5HJEDEF.js +2 -0
- package/dist/{explain-cmd-XCRO4AS6.js → explain-cmd-R45I5MT7.js} +1 -1
- package/dist/explain-cmd-XVE6Z67Q.js +9 -0
- package/dist/extract-bind-7IDQS4QP.js +14 -0
- package/dist/{extract-cmd-7FKQJNS7.js → extract-cmd-KIEOBRIT.js} +3 -3
- package/dist/feeder-RSHMGW6B.js +2 -0
- package/dist/gaps-cmd-RGIPUSIR.js +3 -0
- package/dist/{generate-headless-OBMB5CSB.js → generate-headless-XGRIDD6O.js} +2 -2
- package/dist/headless-io-3A3BZVQ5.js +2 -0
- package/dist/index.js +187 -206
- package/dist/ingest-QGLVY7ND.js +2 -0
- package/dist/ingest-cmd-R5H5SF5K.js +2 -0
- package/dist/install-W3VPVPAQ.js +2 -0
- package/dist/interactive-bind-X5DVLRRW.js +26 -0
- package/dist/lifecycle-cmd-6R2PR2HM.js +2 -0
- package/dist/{list-cmd-V3HJ5K4O.js → list-cmd-QCIYKWYQ.js} +1 -1
- package/dist/{list-commands-SH4HPFI4.js → list-commands-VRRCVWKO.js} +1 -1
- package/dist/{locks-cmd-CSVSWY2Y.js → locks-cmd-67OHQZNV.js} +1 -1
- package/dist/logical-ids-DN6IZSUM.js +2 -0
- package/dist/login-flow-5HL2QYEL.js +2 -0
- package/dist/maintenance-cmd-GZ4EMT3V.js +2 -0
- package/dist/{mobile-prompts-UZTRJ3L7.js → mobile-prompts-CMIVWDHQ.js} +1 -1
- package/dist/objective-variable-gate-EEYJ6B3X.js +2 -0
- package/dist/open-provider-UFSCTIQQ.js +2 -0
- package/dist/pdf-convert-5H4HQNN3.js +2 -0
- package/dist/{persist-recorded-session-QMRY4DOF.js → persist-recorded-session-JXL5E53A.js} +1 -1
- package/dist/phase-seed-HKJ2EF7R.js +2 -0
- package/dist/pipeline-RSCRNNPW.js +2 -0
- package/dist/prepare-target-XZ3FTVBW.js +2 -0
- package/dist/readmodel-IBFRM6EO.js +2 -0
- package/dist/reconcile-cmd-4VRTUM2D.js +2 -0
- package/dist/reconcile-deps-ZCJ2QCK5.js +4 -0
- package/dist/reconcile-engine-IVLZCYZB.js +2 -0
- package/dist/{recording-banner-7E75ERQJ.js → recording-banner-SRLPSTFP.js} +1 -1
- package/dist/records-TJJJWBUD.js +2 -0
- package/dist/registry-CPQHW2L2.js +2 -0
- package/dist/{require-project-folder-LBUYWQOF.js → require-project-folder-SKEZMSN7.js} +1 -1
- package/dist/{resolve-run-intent-GHISMXLZ.js → resolve-run-intent-THC3EPAX.js} +1 -1
- package/dist/{resolver-7JC5VZ4S.js → resolver-2NUNLK7N.js} +1 -1
- package/dist/revert-6BBBK3I4.js +2 -0
- package/dist/review-cmd-BMJQZ6XJ.js +5 -0
- package/dist/run-TURFDLC6.js +2 -0
- package/dist/run-UDP5VPYS.js +2 -0
- package/dist/{run-test-md-5LPCKCW7.js → run-test-md-MRYNFNPO.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-YQPZZB7I.js → skill-installer-CVJ5VTEJ.js} +1 -1
- package/dist/{spawner-X2FOOONV.js → spawner-7FUA3JXA.js} +1 -1
- package/dist/store-guard-XQ5MSUB2.js +2 -0
- package/dist/structured-answers-NADW6D44.js +5 -0
- package/dist/sync-cmd-5INKTZN2.js +2 -0
- package/dist/sync-setup-4R54VRAO.js +2 -0
- package/dist/sync-setup-ui-RC727VK6.js +3 -0
- package/dist/tcg-generate-2BOPGRM6.js +2 -0
- package/dist/testmd-actions-2CPJZAC2.js +2 -0
- package/dist/testmd-sync-HYZI6NRM.js +2 -0
- package/dist/token-refresh-NTE4LQRN.js +2 -0
- package/dist/{validate-basic-GTSVZFQI.js → validate-basic-OKLJLDML.js} +1 -1
- package/dist/{variable-receipt-IHQAYWMZ.js → variable-receipt-CMCDUJI2.js} +1 -1
- package/dist/verdicts-EMCYGQWM.js +2 -0
- package/dist/{version-check-IPEPJZDX.js → version-check-4DQJBSXW.js} +1 -1
- package/dist/{view-cmd-SXXNDZIC.js → view-cmd-P3XRFORJ.js} +1 -1
- package/dist/walk-session-MUGS6CZY.js +2 -0
- package/dist/with-telemetry-3T53GIQC.js +2 -0
- package/package.json +12 -11
- package/dist/EvidenceViewOffer-AZRAILJQ.js +0 -2
- package/dist/FolderPicker-OJFR7AKZ.js +0 -2
- package/dist/ScrollbackTap-Q3IOKNMS.js +0 -2
- package/dist/SingleShotApp-72D5VVLE.js +0 -2
- package/dist/TestMdRunView-4OA52DA2.js +0 -2
- package/dist/bind-F36JFHUK.js +0 -12
- package/dist/bridge-KMDML2NB.js +0 -2
- package/dist/chat-committer-RAOIL2T6.js +0 -2
- package/dist/chat-controller-YJCNU76T.js +0 -2
- package/dist/chunk-4WOVHRI2.js +0 -15
- package/dist/chunk-54JZ6VEW.js +0 -4
- package/dist/chunk-5DT7PIGB.js +0 -5
- package/dist/chunk-6FCPS2VT.js +0 -4
- package/dist/chunk-6IAA644J.js +0 -9
- package/dist/chunk-6J635CRI.js +0 -5
- package/dist/chunk-AGRUULPT.js +0 -4
- package/dist/chunk-BZTWTYQQ.js +0 -6
- package/dist/chunk-CUSTYILP.js +0 -2
- package/dist/chunk-DBIBROYW.js +0 -5
- package/dist/chunk-I27YRAGO.js +0 -7
- package/dist/chunk-IAHKTEET.js +0 -2
- package/dist/chunk-IVQX3AKL.js +0 -4
- package/dist/chunk-J3Q63NFG.js +0 -2
- package/dist/chunk-K6RAOZHP.js +0 -4
- package/dist/chunk-KO3FL2XW.js +0 -26
- package/dist/chunk-L32DKFRQ.js +0 -16
- package/dist/chunk-LPDBTGO5.js +0 -21
- package/dist/chunk-N7Z7BQYO.js +0 -3
- package/dist/chunk-NVGBE2DR.js +0 -2
- package/dist/chunk-OS4VSIHT.js +0 -4
- package/dist/chunk-OTMAFCZK.js +0 -8
- package/dist/chunk-P5MJMM3X.js +0 -85
- package/dist/chunk-QQ5MHSSY.js +0 -2
- package/dist/chunk-T7DGNWI2.js +0 -17
- package/dist/chunk-UH2ZTX4E.js +0 -2
- package/dist/chunk-W3Z7AZNT.js +0 -4
- package/dist/chunk-WUV3FJ7C.js +0 -11
- package/dist/chunk-XMTSHHYQ.js +0 -4
- 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-FRCPK3AZ.js +0 -2
- package/dist/docx-convert-BIV5T7F5.js +0 -2
- package/dist/evidence-FHO36EEV.js +0 -2
- package/dist/evolve-cmd-6RXLKERE.js +0 -2
- package/dist/explain-3HAZY7Q6.js +0 -2
- package/dist/explain-cmd-RMJPXD4U.js +0 -9
- package/dist/extract-bind-BFJPRNPQ.js +0 -10
- package/dist/feeder-IOR3XRNF.js +0 -2
- package/dist/gaps-cmd-FDJ3PT4C.js +0 -3
- package/dist/headless-io-66RG5NN5.js +0 -2
- package/dist/ingest-TTUQ7UDK.js +0 -2
- package/dist/ingest-cmd-AV66Q5LC.js +0 -2
- package/dist/install-SFJ2FFQ6.js +0 -2
- package/dist/interactive-bind-N5AQB26T.js +0 -25
- package/dist/lifecycle-cmd-KSMETBPP.js +0 -2
- package/dist/logical-ids-MLXAH45L.js +0 -2
- package/dist/login-flow-ODVWEPRU.js +0 -2
- package/dist/maintenance-cmd-VFYGKY3X.js +0 -2
- package/dist/objective-variable-gate-3VUXNDCZ.js +0 -2
- package/dist/pdf-convert-OZIRUADA.js +0 -2
- package/dist/phase-seed-BMOSAA74.js +0 -2
- package/dist/pipeline-5FHWZAXK.js +0 -2
- package/dist/prepare-target-UJEY2FSR.js +0 -2
- package/dist/readmodel-TDRFVDVI.js +0 -2
- package/dist/reconcile-cmd-2QHZML2L.js +0 -2
- package/dist/reconcile-deps-ZBWUY3SM.js +0 -4
- package/dist/reconcile-engine-YC4RQYF2.js +0 -2
- package/dist/records-JLS63SDI.js +0 -2
- package/dist/registry-JJTRUPH7.js +0 -2
- package/dist/revert-PRR3D4XM.js +0 -2
- package/dist/review-cmd-SAGIKWEW.js +0 -4
- package/dist/run-43ACVPJK.js +0 -2
- package/dist/run-EOTOXNQO.js +0 -2
- package/dist/sessions-GIEXOCE4.js +0 -2
- package/dist/structured-answers-YAVW65G4.js +0 -5
- package/dist/tcg-generate-V4QRNEZV.js +0 -2
- package/dist/testmd-actions-2UMU3QMV.js +0 -2
- package/dist/testmd-sync-UBXDLWYD.js +0 -2
- package/dist/token-refresh-NL5AM446.js +0 -2
- package/dist/verdicts-QU6W3TUF.js +0 -2
- package/dist/walk-session-7JVB4Z5S.js +0 -2
- package/dist/with-telemetry-LRI7H6DH.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{F as c}from"./chunk-3N6IAVD5.js";import{d as l}from"./chunk-AKX4VRRR.js";function h(f,o,u){let n=o.resolve(u);if(!n)return{target:null,entries:[]};let t=new Set([n.cid]),r=n.cid;for(;o.superseded.has(r);){let s=o.superseded.get(r);if(typeof s!="string"||t.has(s))break;t.add(s),r=s}let d=o.nodeLabel.get(n.cid)??"(unknown)",{records:p}=c(f),i=[];for(let s of p){for(let e of s.nodes)t.has(e.cid)&&i.push({seq:s.seq,ts:s.ts,kind:"minted",detail:`minted ${e.label} ${e.cid}`});for(let e of s.judgements??[])t.has(e.about)&&i.push({seq:s.seq,ts:s.ts,kind:"judgement",rationale:e.rationale,detail:`judgement on ${e.about}`,by:e.by});for(let e of s.review)t.has(e.id)&&i.push({seq:s.seq,ts:s.ts,kind:"review",detail:`${e.resolution}${e.reason?` \u2014 ${e.reason}`:""}`,by:e.by});for(let e of s.supersessions)e.kind==="node"&&(t.has(e.old)||e.new!==null&&t.has(e.new))&&i.push({seq:s.seq,ts:s.ts,kind:"supersession",detail:`${e.old} \u2192 ${String(e.new)} \u2014 ${e.reason}`,by:e.by});for(let e of s.names??[])t.has(e.cid)&&i.push({seq:s.seq,ts:s.ts,kind:"name",detail:`named ${e.slug}`,by:e.by});if(d===l.SOURCE)for(let[e,a]of Object.entries(s.source_head_moves))(t.has(a??"")||o.heads.get(e)!==void 0&&t.has(n.cid)&&e===o.getNode(n.cid)?.content?.source_id)&&i.push({seq:s.seq,ts:s.ts,kind:"head_move",detail:`${e} head \u2192 ${String(a)}`})}return i.sort((s,e)=>e.seq-s.seq),{target:{cid:n.cid,tip:n.tip,label:d,slug:o.nameOf.get(n.cid)},entries:i}}export{h as a};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as le}from"./chunk-FQNQVC5O.js";import{a as S,e as K,f as C,g as ae,h as j,i as ce,j as de}from"./chunk-AKX4VRRR.js";import{closeSync as Oe,existsSync as Ae,fsyncSync as qe,mkdirSync as xe,openSync as Ce,readFileSync as R,readdirSync as je,renameSync as re,rmSync as te,writeFileSync as Fe}from"fs";import{dirname as un,join as b}from"path";import{createHash as He}from"crypto";function E(e){if(e===null)return"null";let n=typeof e;if(n==="string")return JSON.stringify(e.normalize("NFC"));if(n==="boolean")return e?"true":"false";if(n==="number"){if(!Number.isFinite(e))throw new Error("non-finite number is not canonicalizable");return JSON.stringify(e)}if(Array.isArray(e))return"["+e.map(t=>t===void 0?"null":E(t)).join(",")+"]";if(n==="object"){let t=e,a=new Map;for(let o of Object.keys(t)){if(t[o]===void 0)continue;let c=o.normalize("NFC");if(a.has(c))throw new Error(`canonicalization collision: NFC-equivalent duplicate key ${JSON.stringify(c)}`);a.set(c,t[o])}return"{"+[...a.keys()].sort((o,c)=>Buffer.compare(Buffer.from(o,"utf8"),Buffer.from(c,"utf8"))).map(o=>JSON.stringify(o)+":"+E(a.get(o))).join(",")+"}"}throw new Error("unsupported type for canonicalization: "+n)}function I(e){return He("sha256").update(e).digest("hex")}function F(e,n){return"sha256:"+I(Buffer.from("assurance."+e+"\0"+E(ce(e,n)),"utf8"))}function Sn(e,n,t,a){return"sha256:"+I(Buffer.from("assurance.edge\0"+E({type:e,src:n,dst:t,props:de(e,a)}),"utf8"))}function kn(e,n){return{source_id:e,blob:n}}function Nn(e){return{...e,derived:!0}}import{existsSync as D,mkdirSync as Ge,readFileSync as X,renameSync as We,rmSync as pe,writeFileSync as ze}from"fs";import{dirname as Ke,join as J}from"path";var B=e=>J(e,"derived"),ge=e=>J(B(e),"index.json");function he(e,n){let t=n.startsWith("sha256:")?n.slice(7):n;if(!/^[A-Za-z0-9_-]{2,}$/.test(t))throw new Error(`${n} is not a fingerprint: it cannot name a node file`);return J(B(e),"nodes",t.slice(0,2),t.slice(2)+".json")}function O(){return{applied:{seq:0,hash:null},heads:{},trust:{},nodeLabel:{},forward:{},extracted:[],design_of:{},design_generation:{},exec:{},superseded:{},names:{},archivedReason:{},appliedEvents:[],eventDigests:{},completeness:{},srcOwner:{},conv:{},media:{},design_phases:{},edgeRetractions:{}}}function M(e){let n=ge(e);if(!D(n))return null;try{let t=JSON.parse(X(n,"utf8"));return t.superseded===void 0||t.names===void 0||t.archivedReason===void 0||t.appliedEvents===void 0||t.conv===void 0||t.media===void 0||t.exec===void 0||t.completeness===void 0||t.srcOwner===void 0||t.design_phases===void 0||t.edgeRetractions===void 0||t.eventDigests===void 0||t.reverse!==void 0?null:t}catch{return null}}function me(e,n){Ge(Ke(e),{recursive:!0});let t=`${e}.tmp-${process.pid}`;ze(t,n),We(t,e)}function k(e,n,t,a,i={}){let o=i.writeNodeFiles!==!1,c=new Set(n.extracted),p=new Set(n.appliedEvents);t.forEach((s,h)=>{for(let r of s.nodes){let d=he(e,r.cid);o&&!D(d)&&me(d,JSON.stringify({label:r.label,content:r.content})+`
|
|
3
|
+
`),!(r.cid in n.trust)&&r.content.derived===!0&&(n.trust[r.cid]="derived"),n.nodeLabel[r.cid]=r.label}for(let[r,d]of Object.entries(s.source_head_moves))typeof d=="string"&&(n.srcOwner[d]=r);if(s.proposal_id!=null&&typeof s.extraction_of=="string"){c.add(s.extraction_of);let r=null;for(let d of s.edges)if(d.type===K.DERIVES&&d.props.source_cid===s.extraction_of&&typeof d.props.source_id=="string"){r=d.props.source_id;break}if(r??=n.srcOwner[s.extraction_of]??null,r!==null){let d=n.completeness[r];(!d||s.seq>=d.seq)&&(n.completeness[r]={source_cid:s.extraction_of,completeness:"complete",...s.extractor_version?{extractor_version:s.extractor_version}:{},at:s.ts,seq:s.seq})}else n.completenessSkipped=(n.completenessSkipped??0)+1}else if(s.proposal_id!=null&&Array.isArray(s.extraction_of))for(let r of s.extraction_of){c.add(r.source_cid);let d=n.completeness[r.source_id];(!d||s.seq>=d.seq)&&(n.completeness[r.source_id]={source_cid:r.source_cid,completeness:r.completeness,...r.extractor_version?{extractor_version:r.extractor_version}:{},at:r.at,seq:s.seq})}s.design_of&&((n.design_of??={})[s.design_of.uc_cid]={engine:s.design_of.engine,seq:s.seq}),s.design_generation&&((n.design_generation??={})[s.design_generation.uc_root]={gen:s.design_generation.generation,seq:s.seq});{let r=s.design_phase;r&&typeof r.uc_root=="string"&&typeof r.phase=="string"&&typeof r.generation=="number"&&((n.design_phases??={})[r.uc_root]??=[]).push({phase:r.phase,generation:r.generation,seq:s.seq,completeness:r.completeness==="partial"?"partial":"complete"})}for(let r of s.executions??[])((n.exec??={})[r.about]??=[]).push(r);for(let r of s.edges){let{quote:d,...g}=r.props,u=n.forward[r.src]??=[];u.some(l=>l.ecid===r.ecid)||u.push({...r,props:g}),s.proposal_id!=null&&r.type===K.DERIVES&&typeof r.props.source_cid=="string"&&c.add(r.props.source_cid)}for(let r of s.review)r.resolution==="approved"||r.resolution==="edited"?(n.trust[r.id]="trusted",delete n.archivedReason[r.id]):r.resolution==="rejected"?(n.trust[r.id]="archived",r.reason?n.archivedReason[r.id]=r.reason:delete n.archivedReason[r.id]):r.resolution==="reset"&&(n.trust[r.id]="derived",delete n.archivedReason[r.id]);for(let r of s.supersessions)r.kind==="node"?r.new===r.old?delete n.superseded[r.old]:n.superseded[r.old]=r.new:r.revoke?(delete n.superseded[r.ecid],delete n.edgeRetractions[r.ecid]):(n.superseded[r.ecid]=null,n.edgeRetractions[r.ecid]={at:s.ts,...r.by?{by:r.by}:{},...r.reason?{reason:r.reason}:{}});for(let r of s.names??[])n.names[r.slug]=r.cid;for(let[r,d]of Object.entries(s.source_head_moves))n.heads[r]=d;if((s.event_ids??[]).forEach((r,d)=>{p.add(r),n.eventDigests[r]=s.event_digests?.[d]??""}),s.media)for(let[r,d]of Object.entries(s.media)){let g=s.source_head_moves[r];typeof g=="string"&&(n.media[g]=d)}if(s.conv){let r=s.source_head_moves[s.conv.source_id];if(typeof r=="string"){let d=n.conv[s.conv.source_id],g=d&&d.chain.length>0?d.chain[d.chain.length-1]:null;s.conv.append_of===g?n.conv[s.conv.source_id]={turns:s.conv.turn,chain:[...d?.chain??[],r]}:n.conv[s.conv.source_id]={turns:s.conv.turn,chain:[r]}}}for(let[r,d]of Object.entries(s.source_head_moves))s.conv?.source_id!==r&&n.conv[r]!==void 0&&(n.conv[r]=typeof d=="string"?{turns:n.conv[r].turns,chain:[d]}:{turns:n.conv[r].turns,chain:[]});n.applied={seq:s.seq,hash:a[h]}}),n.extracted=[...c].sort(),n.appliedEvents=[...p].sort()}function fe(e,n){me(ge(e),JSON.stringify(n)+`
|
|
4
|
+
`)}function Ye(e){let n=J(e,"meta.json");if(D(n))try{let t=JSON.parse(X(n,"utf8"));if(t.schema!==S||t.canonicalizer!=="v1")throw new f(`schema fence: store is ${t.schema}/${t.canonicalizer}, this build is ${S}/${"v1"} \u2014 migrate explicitly (kane-cli context rebuild after upgrading)`)}catch(t){throw t instanceof f?t:new f(`corrupt meta.json in ${e} \u2014 fix or remove it`)}}function Xe(e){Ye(e);let n=M(e),t=n!==null&&n.applied.seq>0?T(e,n.applied.seq):null;if(n!==null&&t!==null&&t!==n.applied.hash&&(pe(B(e),{recursive:!0,force:!0}),n=null),n===null){n=O();let{records:o,hashes:c}=L(e);return k(e,n,o,c),fe(e,n),n}let{records:a,hashes:i}=A(e,n.applied.seq,n.applied.hash);return a.length>0&&(k(e,n,a,i),fe(e,n)),n}function jn(e){return pe(B(e),{recursive:!0,force:!0}),Xe(e)}var Ze=new Set(["CHAIN_ERROR","DERIVED_MISSING","DERIVED_DRIFT","NODE_FILE_MISSING","NODE_FILE_MISMATCH","NODE_FILE_CORRUPT"]);function Fn(e){return Ze.has(e.code)?e.detail:`${e.code}: ${e.detail}`}function Ln(e){let n=[],t=(u,l)=>{n.push({code:u,detail:l})},a=[],i=[];try{({records:a,hashes:i}=L(e))}catch(u){return{ok:!1,issues:[{code:"CHAIN_ERROR",detail:u instanceof f?u.message:String(u)}],records:0}}let o=O();k(e,o,a,i,{writeNodeFiles:!1});let c=M(e),p=0,s=o;if(c!==null&&c.applied.seq<a.length){let u=c.applied.seq;c.applied.hash===(u===0?null:i[u-1])&&(p=a.length-u,s=O(),k(e,s,a.slice(0,u),i.slice(0,u),{writeNodeFiles:!1}))}if(c===null)t("DERIVED_MISSING","derived/index.json missing or corrupt (run kane-cli context rebuild)");else{let u=l=>JSON.stringify(Y(l));for(let l of["applied","heads","trust","nodeLabel","forward","extracted","superseded","names","archivedReason","appliedEvents","eventDigests","conv","media","design_of","design_generation","design_phases","exec","completeness","srcOwner","edgeRetractions"])u(s[l])!==u(c[l])&&t("DERIVED_DRIFT",`derived drift in index.${l} (run kane-cli context rebuild)`)}let h=new Set;for(let u of Object.values(o.forward))for(let l of u)h.add(l.ecid);let r=new Set,d=new Set;for(let u of a)for(let l of u.supersessions)l.kind==="node"?(l.old in o.nodeLabel||t("SUPERSEDE_UNKNOWN_OLD",`${l.old} (record ${u.seq})`),l.new!==null&&l.new!==l.old&&!(l.new in o.nodeLabel)&&t("SUPERSEDE_UNKNOWN_NEW",`${String(l.new)} (record ${u.seq})`),l.new===l.old?r.delete(l.old):(r.has(l.old)&&t("DOUBLE_SUPERSEDE",`${l.old} re-superseded while live (record ${u.seq})`),r.add(l.old))):(h.has(l.ecid)||t("SUPERSEDE_UNKNOWN_ECID",`${l.ecid} (record ${u.seq})`),l.revoke?(d.has(l.ecid)||t("EDGE_ORPHAN_REVOKE",`${l.ecid} revoked without a standing retraction (record ${u.seq})`),d.delete(l.ecid)):(d.has(l.ecid)&&t("EDGE_DOUBLE_RETRACT",`${l.ecid} re-retracted while already retracted (record ${u.seq})`),d.add(l.ecid)));for(let u of Object.keys(o.superseded)){let l=new Set,y=u;for(;y!==null&&y in o.superseded;){if(l.has(y)){t("SUPERSEDE_CYCLE",`chain from ${u} revisits ${y}`);break}l.add(y),y=o.superseded[y]}}for(let[u,l]of Object.entries(o.names))l in o.nodeLabel||t("NAME_UNKNOWN_TARGET",`slug ${u} \u2192 ${l} not in the graph`);for(let u of a)for(let l of u.edges){let y=o.nodeLabel[l.src]??"(unknown)",w=o.nodeLabel[l.dst]??"(unknown)";for(let m of j(l.type,y,w,l.props))t(m.code,`${l.ecid} ${m.detail}`)}let g=new Map;for(let u of Object.values(o.forward))for(let l of u){if(l.ecid in o.superseded)continue;let y=g.get(l.type)??[];y.push(l),g.set(l.type,y)}for(let[u,l]of g){let y=ae(u);if(y?.acyclic){let w=new Map;for(let v of l)w.set(v.src,[...w.get(v.src)??[],v.dst]);let m=new Map,_=v=>{m.set(v,1);for(let z of w.get(v)??[])if(m.get(z)===1||m.get(z)===void 0&&_(z))return!0;return m.set(v,2),!1};for(let v of w.keys())if(m.get(v)===void 0&&_(v)){t("EDGE_CYCLE",`live ${u} edges form a cycle reachable from ${v}`);break}}if(y?.cardinality==="one-live-per-src"||y?.cardinality==="one-live-per-src-and-dst"){let w=new Map;for(let m of l)m.dst in o.superseded||w.set(m.src,[...w.get(m.src)??[],m]);for(let[m,_]of w)_.length>1&&t("CARDINALITY_VIOLATION",`${_.length} live ${u} edges from ${m} (one-live-per-src): ecids ${_.map(v=>v.ecid).join(",")}`)}if(y?.cardinality==="one-live-per-src-and-dst"){let w=new Map;for(let m of l)m.src in o.superseded||m.dst in o.superseded||w.set(m.dst,[...w.get(m.dst)??[],m]);for(let[m,_]of w)_.length>1&&t("CARDINALITY_VIOLATION",`${_.length} live ${u} edges onto ${m} (one-live-per-dst): ecids ${_.map(v=>v.ecid).join(",")}`)}}for(let[u,l]of Object.entries(s.nodeLabel)){let y=he(e,u);if(!D(y)){t("NODE_FILE_MISSING",`missing node file for ${u} (run kane-cli context rebuild)`);continue}try{let w=JSON.parse(X(y,"utf8"));(w.label!==l||F(w.label,w.content)!==u)&&t("NODE_FILE_MISMATCH",`node file content mismatch for ${u} (run kane-cli context rebuild)`);for(let m of C(w.label,w.content))t(m.code,`${u} ${m.detail}`)}catch{t("NODE_FILE_CORRUPT",`corrupt node file for ${u} (run kane-cli context rebuild)`)}}return{ok:n.length===0,issues:n,records:a.length,...p>0?{pending:p}:{}}}function Y(e){return Array.isArray(e)?e.map(Y):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([n],[t])=>n<t?-1:1).map(([n,t])=>[n,Y(t)])):e}import{join as Qe}from"path";var ye=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function Z(e){return typeof e=="string"&&e!=="."&&e!==".."&&ye.test(e)}function Dn(e){if(!Z(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(ye)} (no path separators)`)}function we(e,n){if(!Z(n))throw new Error(`proposal id ${JSON.stringify(n)} is not a plain name (letters, digits, . _ - after a letter or digit)`);return Qe(e,"proposals",n,"proposal.json")}var q=class extends Error{},en=new Set(["UNKNOWN_LABEL","MISSING_FIELD","BAD_ENUM"]),nn=new Set(["UNKNOWN_EDGE_TYPE","ILLEGAL_EDGE","MISSING_SALIENT"]),tn=["nodes","edges","review","supersessions"],rn=/^sha256:[0-9a-f]{64}$/;function sn(e){let n=[];for(let t of e.nodes)n.push(["node cid",t?.cid]);for(let t of e.edges)n.push(["edge ecid",t?.ecid],["edge src",t?.src],["edge dst",t?.dst]);for(let t of e.supersessions)t?.kind==="node"?(n.push(["superseded cid",t.old]),t.new!==null&&n.push(["superseding cid",t.new])):n.push(["retracted ecid",t?.ecid]);for(let t of e.names??[])n.push(["named cid",t?.cid]);return n}function ve(e){let n=M(e),a=n!==null&&(n.applied.seq===0||T(e,n.applied.seq)===n.applied.hash)?n:O(),{records:i,hashes:o}=A(e,a.applied.seq,a.applied.hash);return i.length>0&&k(e,a,i,o,{writeNodeFiles:!1}),a}function be(e,n,t,a){let i=r=>new q(r);for(let r of tn)if(!Array.isArray(t[r]))throw i(`${r} is not a list`);if(typeof t.source_head_moves!="object"||t.source_head_moves===null||Array.isArray(t.source_head_moves))throw i("source_head_moves is not an object");if(t.media!==void 0&&(typeof t.media!="object"||t.media===null||Array.isArray(t.media)))throw i("media is not an object");if(t.names!==void 0&&!Array.isArray(t.names))throw i("names is not a list");for(let[r,d]of sn(t))if(typeof d!="string"||!rn.test(d))throw i(`${r} ${String(d)} is not a sha256 fingerprint`);if(t.proposal_id!=null)try{we(e,t.proposal_id)}catch(r){throw i(r instanceof Error?r.message:String(r))}let o=new Map;for(let r of t.nodes){let d=C(r.label,r.content);for(let g of d)if(en.has(g.code))throw i(`${r.cid} ${g.detail}`);if(!d.some(g=>g.code==="UNKNOWN_FIELD")&&F(r.label,r.content)!==r.cid)throw i(`${r.cid} is not the hash of its content`);o.set(r.cid,r.label)}let c=r=>n.nodeLabel[r]??o.get(r)??"(unknown)",p=r=>r in n.nodeLabel||o.has(r),s=new Set(t.edges.map(r=>r.ecid)),h=r=>s.has(r)||Object.values(n.forward).some(d=>d.some(g=>g.ecid===r));for(let r of t.edges)for(let d of j(r.type,c(r.src),c(r.dst),r.props))if(nn.has(d.code))throw i(`${r.ecid} ${d.detail}`);for(let r of t.supersessions)if(r.kind==="node"){if(!p(r.old))throw i(`supersedes ${r.old}, which the graph does not hold`);if(r.new!==null&&!p(r.new))throw i(`supersedes with ${r.new}, which the graph does not hold`);if(r.new!==r.old&&r.old in n.superseded)throw i(`${r.old} is re-superseded while already superseded`)}else{if(!h(r.ecid))throw i(`retracts edge ${r.ecid}, which the graph does not hold`);if(r.revoke&&!(r.ecid in n.superseded))throw i(`${r.ecid} is revoked without a standing retraction`);if(!r.revoke&&r.ecid in n.superseded)throw i(`${r.ecid} is re-retracted while already retracted`)}for(let r of t.names??[])if(!p(r.cid))throw i(`names ${r.slug} \u2192 ${r.cid}, which the graph does not hold`);k(e,n,[t],[a],{writeNodeFiles:!1});for(let r of t.supersessions){if(r.kind!=="node"||r.new===r.old)continue;let d=new Set,g=r.old;for(;g!==null&&g in n.superseded;){if(d.has(g))throw i(`supersession chain from ${r.old} revisits ${g}`);d.add(g),g=n.superseded[g]}}}import{existsSync as Q,mkdirSync as on,readFileSync as an}from"fs";import{dirname as _e,join as cn}from"path";var ee="unknown",Ee=()=>ee;function Zn(e){ee=e}var dn=["extract","review","pair-merge","names","retire","gap","gap-close","chat","design","execution","parked","exec-supersede","ingest","distill","conv-mint","conv-turn","archive","revert"],Re={extract:{v:1,args:["proposal","proposalId","verdicts","by","flags","judgements","probeHits","eventIds"],pins:["supersedeTarget","matches_existing","conflicts_with","depends_on_hint","read_basis_heads"]},review:{v:1,args:["verdicts","by","holdArchives"],pins:["verdicts","supersedeTarget"]},"pair-merge":{v:1,args:["survivor","merged","reason","by"],pins:["survivor","merged"]},names:{v:1,args:["assignments","by"],pins:["refs"]},retire:{v:1,args:["sourceId","reason","by"],pins:["head"]},gap:{v:1,args:["content","annotates"],pins:["annotates"]},"gap-close":{v:1,args:["targetTip","resolvedBy","sourceId","by"],pins:["gaps"]},chat:{v:1,args:["ops","judgements","by","mintable","sid"],pins:["targets","enhance","redirectTo","retract","conv"]},design:{v:1,args:["ucRef","sections","by","engine","force","forceScope","reason","generationTicket","templateVersion","phase","phaseCompleteness","eventIds","sid"],pins:["ucRef","automates","verifies","reuses","scope","depends_on","exercises","scoped_to_repoints","judgements","body_tags","forceScope"]},execution:{v:1,args:["facts","by","eventIds"],pins:["facts"]},parked:{v:1,args:["line"],pins:["facts"]},"exec-supersede":{v:1,args:["tip","raw","fileId","by"],pins:["tip","imports"]},ingest:{v:1,args:["source_id","blob","label","media","derived_blobs","eventIds"],pins:["prior_head"]},distill:{v:1,args:["watermark","by"],pins:["events"]},"conv-mint":{v:1,args:["sessionStamp","by"],pins:[]},"conv-turn":{v:1,args:["sourceId","text","force","by"],pins:["append_of"]},archive:{v:1,args:["ref","reason","by"],pins:["ref"]},revert:{v:1,args:["seq","reason","by"],pins:["target"]}};function P(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function V(e){return e===null||typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.every(V):P(e)&&Object.values(e).every(V)}var ln=e=>typeof e=="string"&&dn.includes(e);function $e(e){if(!P(e))return"intent is missing: every append names the intent it fulfils";if(!ln(e.verb))return`intent verb ${String(e.verb)} is not a writer this build knows`;let n=Re[e.verb].v;if(e.v!==n)return`intent ${e.verb} v ${String(e.v)} is not the version this build writes (v ${n})`;if(!P(e.pins)||!V(e.pins))return"intent pins is not a plain JSON object";if(!V(e.args))return"intent args is not JSON";let t=Re[e.verb];for(let a of t.args??[])if(!P(e.args)||!(a in e.args))return`intent ${e.verb} arg ${a} is missing`;for(let a of t.pins??[])if(!(a in e.pins))return`intent ${e.verb} pin ${a} is missing`;return null}function Qn(e){return JSON.parse(JSON.stringify(e))}function Se(e,n){let t=n.slice(7);return cn(e,"intents",t.slice(0,2),`${t}.json`)}function et(e,n){let t=Se(e,n);return Q(t)?JSON.parse(an(t,"utf8")):null}function ke(e,n,t){let a=Se(e,t.hash),i=_e(a),o=_e(i),c=!Q(o),p=c||!Q(i);on(i,{recursive:!0});let s={v:n.v,verb:n.verb,args:n.args,pins:n.pins,born:{...t,build:ee}};return ne(a,JSON.stringify(s)+`
|
|
5
|
+
`),p&&U(o),c&&U(e),a}var f=class extends Error{},Le="run kane-cli context sync or kane-cli context pull to continue, or kane-cli context sync doctor --abort to close it",Ne="run kane-cli context sync doctor to see it, and kane-cli context sync doctor --abort to set the unreadable ledger aside; the backup stays";function fn(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=e;if(n.state!=="open"&&n.state!=="closed"||!Array.isArray(n.items))return null;let t=["applied","held","skipped","deduped"];for(let a of n.items){if(!a||typeof a!="object"||Array.isArray(a))return null;let i=a.outcome;if(i===void 0)continue;if(!i||typeof i!="object"||Array.isArray(i))return null;let o=Object.keys(i);if(o.length!==1||!t.includes(o[0]))return null;let c=i[o[0]];if(!c||typeof c!="object")return null}return n}var H=class extends f{constructor(t,a=Le){super(t);this.remedy=a}code="SYNC_REBASE_PENDING"};function pn(e){let n=b(e,"sync","replay");if(!Ae(n))return null;let t=je(n).filter(a=>a.endsWith(".json")&&!a.endsWith(".receipt.json")).sort().reverse();for(let a of t){let i=a.slice(0,-5),o;try{o=fn(JSON.parse(R(b(n,a),"utf8")))}catch{o=null}if(o===null)return{id:i,decisions:0,unreadable:!0};if(o.state==="open")return{id:i,decisions:o.items.filter(c=>c.outcome!==void 0&&c.outcome!==null&&"held"in c.outcome).length}}return null}function gn(e){let n=pn(e);if(!n)return;if(n.unreadable)throw new H(`rebase ${n.id} has a ledger this store cannot read (sync/replay/${n.id}.json); this store takes no other change until it is set aside \u2014 ${Ne}`,Ne);let t=n.decisions>0?`a rebase (${n.id}) is open with ${n.decisions} decision${n.decisions===1?"":"s"} unresolved`:`a rebase (${n.id}) is open and not finished`;throw new H(`${t}; this store takes no other change until it is finished \u2014 ${Le}`)}function hn(e){let n=e.args?.by,t=typeof n=="object"&&n!==null&&typeof n.kind=="string"&&typeof n.id=="string";return{build:Ee(),...t?{by:n}:{}}}function mn(e){return"sha256:"+I(Buffer.from(E({verb:e.verb,args:e.args,pins:e.pins})))}function W(e,n){if(e.schema_version!==void 0&&e.schema_version!==S)throw new f(`record ${n} is stamped ${e.schema_version}, this build reads ${S} \u2014 migrate explicitly`);if(e.parents!==void 0&&!(e.prev_hash===null?e.parents.length===0:e.parents.length===1&&e.parents[0]===e.prev_hash))throw new f(`record ${n}: parents does not mirror prev_hash \u2014 multi-parent records need a DAG-aware reader`)}var G=class extends f{},se=class extends f{code="CONTEXT_APPEND_BUSY"};function ie(e,n){xe(e,{recursive:!0});let t=b(e,".lock"),a=Date.now()+(n?n.deadlineMs:2e3);for(;;)try{return Fe(t,`${process.pid}
|
|
6
|
+
`,{flag:"wx"}),()=>{try{te(t)}catch{}}}catch(i){if(i.code!=="EEXIST")throw i;if(n){let o=null,c=null;try{c=R(t,"utf8");let p=Number.parseInt(c.trim(),10);o=Number.isInteger(p)?p:null}catch{c=null}if(c!==null&&o!==null&&!le(o)){let p=`${t}.break-${process.pid}-${Date.now()}`;try{re(t,p);let s=null;try{s=R(p,"utf8")}catch{s=null}if(s===null||s===c)te(p,{force:!0});else try{re(p,t)}catch{te(p,{force:!0})}}catch(s){if(s.code!=="ENOENT")throw s}continue}if(Date.now()>a)throw new se(`.context append is busy: ${t} held ${o===null?"by a holder that has not written its pid":`by live pid ${o}`} past the deadline`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25+Math.floor(Math.random()*50));continue}if(Date.now()>a)throw new f(`.context is locked by another process \u2014 remove ${t} if that process is gone`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25)}}var yn=/^\d{6}-[0-9a-f]{12}\.json$/,wn=999999;function Te(e,n){if(e>wn)throw new f(`${n}: position ${e} is above 999,999, the highest a six-digit record file can name \u2014 the sharded commits layout is a follow-up; nothing was written`)}var $=e=>b(e,"commits");function N(e){return"sha256:"+I(Buffer.from(E(e),"utf8"))}var oe=class extends f{constructor(t){let a=[...new Set(t.map(i=>Number(i.slice(0,6))))];super(`FORKED: more than one record at position${a.length>1?"s":""} ${a.join(", ")} \u2014 another copy of this store was merged into commits/. kane-cli context sync doctor lists the files; move the foreign ones out and rebuild.`);this.duplicates=t}code="CONTEXT_FORKED"},De="000001-000000000000.json",Je="store is mid-reset: run kane-cli context sync doctor";function dt(e){return JSON.stringify({seq:1,prev_hash:null,schema_version:"assurance/context@1 :: mid-reset :: run kane-cli context sync doctor",kane:{fence:"reset",nonce:e,journal:"sync/journal.json"}})}function x(e){let{files:n,midReset:t}=Be(e);if(t)throw new f(Je);return n}function Be(e){let n=$(e);if(!Ae(n))return{files:[],midReset:!1};let t=je(n).filter(o=>yn.test(o)).sort(),a=t.indexOf(De);a>=0&&t.splice(a,1);let i=[];for(let o=0;o<t.length;o++){let c=t[o].slice(0,6);(o>0&&t[o-1].slice(0,6)===c||o+1<t.length&&t[o+1].slice(0,6)===c)&&i.push(t[o])}if(i.length>0)throw new oe(i);return{files:t,midReset:a>=0}}function L(e){let n=x(e),t=[],a=[],i=null;return n.forEach((o,c)=>{let p=R(b($(e),o),"utf8"),s;try{s=JSON.parse(p)}catch(d){throw new f(`corrupt commit record ${o}: ${String(d)}`)}if(s.seq!==c+1)throw new f(`sequence gap: expected seq ${c+1}, ${o} has ${s.seq}`);if(s.prev_hash!==i)throw new f(`broken chain at ${o}: prev_hash ${String(s.prev_hash)} != ${String(i)}`);W(s,o);let h=N(s),r=o.slice(7,19);if(!h.slice(7).startsWith(r))throw new f(`tampered record ${o}: content hash ${h} does not match filename`);t.push(s),a.push(h),i=h}),{records:t,hashes:a}}function Me(e){return Pe(e,x(e))}function Pe(e,n){if(n.length===0)return null;let t=n[n.length-1],a=R(b($(e),t),"utf8"),i;try{i=JSON.parse(a)}catch(c){throw new f(`corrupt tail record ${t}: ${String(c)}`)}W(i,t);let o=N(i);if(!o.slice(7).startsWith(t.slice(7,19)))throw new f(`tampered tail record ${t}: content hash ${o} does not match filename`);if(i.seq!==n.length)throw new f(`sequence gap at tail: ${n.length} record files but tail seq is ${i.seq}`);return{seq:i.seq,hash:o}}function lt(e){return Me(e)?.hash??null}var vn="corrupt";function T(e,n){let t=x(e)[n-1];if(!t)return null;try{return N(JSON.parse(R(b($(e),t),"utf8")))}catch{return vn}}function A(e,n,t){let a=x(e);if(a.length<n)throw new f(`derived state is ahead of the record log (applied seq ${n}, ${a.length} records) \u2014 run kane-cli context rebuild`);let i=[],o=[],c=t;for(let p=n;p<a.length;p++){let s=a[p],h=R(b($(e),s),"utf8"),r;try{r=JSON.parse(h)}catch(g){throw new f(`corrupt commit record ${s}: ${String(g)}`)}if(r.seq!==p+1)throw new f(`sequence gap: expected seq ${p+1}, ${s} has ${r.seq}`);if(r.prev_hash!==c)throw new f(`broken chain at ${s}: prev_hash ${String(r.prev_hash)} != ${String(c)}`);W(r,s);let d=N(r);if(!d.slice(7).startsWith(s.slice(7,19)))throw new f(`tampered record ${s}: content hash ${d} does not match filename`);i.push(r),o.push(d),c=d}return{records:i,hashes:o}}function ut(e,n){if(n.seq===0){if(n.hash!==null)throw new f("watermark not in chain: seq 0 cannot carry a hash");return L(e)}let t=x(e);if(t.length<n.seq)throw new f(`watermark not in chain: seq ${n.seq} is beyond the ${t.length}-record chain`);let a=t[n.seq-1],i;try{i=JSON.parse(R(b($(e),a),"utf8"))}catch(c){throw new f(`watermark record ${a} unreadable: ${String(c)}`)}let o=N(i);if(o!==n.hash)throw new f(`watermark not in chain: seq ${n.seq} hashes ${o}, watermark claims ${String(n.hash)}`);return A(e,n.seq,n.hash)}function ft(e,n,t){let a=$e(t.intent);if(a!==null)throw new f(`append refused: ${a}; nothing was written`);if("replayed_from"in n)throw new f("append refused: replayed_from is stamped by the append layer from opts.provenance; nothing was written");if("event_digests"in n||"intent_verb"in n||"created_by"in n)throw new f("append refused: event_digests, intent_verb and created_by are stamped by the append layer from the intent; nothing was written");let i=ie(e,t.busyRetry);try{return Ve(e,n,t)}finally{i()}}function pt(e,n){let t=ie(e);try{return Ve(e,n,{})}finally{t()}}function Ve(e,n,t){t.provenance||gn(e);let a=Me(e),i=(a?.seq??0)+1;Te(i,"append");let o=a?.hash??null;if(t.expectPrev!==void 0&&t.expectPrev!==o)throw new G(`concurrent append detected: validated against ${String(t.expectPrev)} but the chain head is ${String(o)} \u2014 re-open and retry`);let c={seq:i,prev_hash:o,...n,schema_version:S,parents:o===null?[]:[o],...t.intent?{intent_verb:t.intent.verb,created_by:hn(t.intent)}:{},...t.intent&&n.event_ids&&n.event_ids.length>0?{event_digests:n.event_ids.map(()=>mn(t.intent))}:{},...t.provenance?{replayed_from:t.provenance.replayed_from}:{}},p=N(c);if(t.provenance)try{be(e,ve(e),c,p)}catch(h){throw h instanceof q?new f(`replayed record would not pass this store's checks: ${h.message}; nothing was written`):h}t.intent&&ke(e,t.intent,{seq:i,hash:p,ts:c.ts});let s=Ue(e,i,p,JSON.stringify(c)+`
|
|
7
|
+
`);return{seq:i,hash:p,file:s,record:c}}function ne(e,n){let t=`${e}.tmp-${process.pid}`,a=Ce(t,"w");try{Fe(a,n),qe(a)}finally{Oe(a)}re(t,e),U(un(e))}function U(e){try{let n=Ce(e,"r");try{qe(n)}finally{Oe(n)}}catch{}}function Ue(e,n,t,a){let i=$(e);xe(i,{recursive:!0});let o=`${String(n).padStart(6,"0")}-${t.slice(7,19)}.json`,c=b(i,o);return ne(c,a),c}var Ie=100;function gt(e,n,t,a={}){if(n.length===0)return[];if(n.length>Ie)throw new f(`import: batch of ${n.length} exceeds ${Ie} records per lock \u2014 chunk it`);let i=n[0].seq;if(!Number.isInteger(i)||i<1)throw new f(`import: batch starts at seq ${String(i)}, positions start at 1`);Te(i+n.length-1,"import");let o=[],c=t;n.forEach(({seq:s,raw:h},r)=>{let d=i+r;if(s!==d)throw new f(`import: expected seq ${d}, batch carries ${String(s)}`);let g;try{g=JSON.parse(h)}catch(y){throw new f(`import: record ${s} is not JSON: ${String(y)}`)}if(g===null||typeof g!="object"||Array.isArray(g))throw new f(`import: record ${s} is not a JSON object`);let u=g;if(u.seq!==s)throw new f(`import: expected seq ${s}, record carries ${String(u.seq)}`);if(u.prev_hash!==c)throw new f(`import: record ${s} is sealed onto ${String(u.prev_hash)}, local tail is ${String(c)}`);W(u,`import@${s}`);let l=N(u);o.push({seq:s,hash:l,raw:h}),c=l});let p=a.lockHeld?()=>{}:ie(e);try{let s=Be(e);if(s.midReset&&!bn(e,a.underReset))throw new f(Je);let h=Pe(e,s.files);if((h?.hash??null)!==t)throw new G(`import: local tail moved to ${String(h?.seq??0)} ${String(h?.hash??null)} \u2014 re-plan the pull`);if((h?.seq??0)!==i-1)throw new f(`import: batch starts at seq ${i}, local tail is at ${String(h?.seq??0)}`);return o.map(({seq:r,hash:d,raw:g})=>({seq:r,hash:d,file:Ue(e,r,d,g)}))}finally{p()}}function bn(e,n){if(!n)return!1;try{return JSON.parse(R(b($(e),De),"utf8")).kane?.nonce===n.nonce}catch{return!1}}export{E as a,I as b,F as c,Sn as d,kn as e,Nn as f,Dn as g,we as h,q as i,be as j,Zn as k,$e as l,Qn as m,Se as n,et as o,f as p,Le as q,Ne as r,fn as s,H as t,pn as u,gn as v,mn as w,G as x,se as y,ie as z,wn as A,N as B,oe as C,De as D,dt as E,L as F,Me as G,lt as H,vn as I,T as J,A as K,ut as L,ft as M,pt as N,ne as O,U as P,Ie as Q,gt as R,B as S,he as T,O as U,M as V,k as W,Xe as X,jn as Y,Fn as Z,Ln as _};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as S}from"./chunk-
|
|
2
|
+
import{a as S}from"./chunk-YGMUNNKH.js";import{y as o}from"./chunk-HYTBEPC2.js";import{a as R}from"./chunk-HCBYKLMW.js";import{a as y,b as c,j as x}from"./chunk-C44QQJR4.js";import{a as w}from"./chunk-6YGTRKDT.js";import{e as b}from"./chunk-UR6MHSHU.js";var k=b(w(),1);var i=b(R(),1);function A(e){let t=e.decisions.filter(l=>l.kind==="replay").length,s=e.decisions.filter(l=>l.kind==="author").length,d=e.outcomes.filter(l=>l.status==="passed").length,f=e.outcomes.filter(l=>l.status==="failed").length,h=e.outcomes.filter(l=>l.status==="skipped").length,a=o.green,u;e.cancelled||e.overallStatus==="interrupted"?(a=o.orange,u="CANCELLED"):e.overallStatus==="failed"?(a=o.red,u="FAILED"):u="PASSED";let r=`${u} \xB7 ${e.durationS}s \xB7 ${e.outcomes.length} steps (${d} passed, ${f} failed, ${h} skipped)`,T=`${t} replay \xB7 ${s} author`,C=e.retryTriggered,_="yes \u2014 healed after a replay miss",n,p=o.dim;if(e.cancelled)n="\u2013 not committed (cancellation)";else if(e.overallStatus==="failed")n="\u2013 not committed (run failed)",p=o.red;else if(!e.shouldCommit)e.isFirstRun?n="\u2013 not committed (first run skipped commit)":e.lockHeld?n="\u2013 not committed":n="\u2013 not committed (readonly fallback / no lock)";else if(e.committed===!1&&!e.uploadResult?.testcaseId)n="\u2013 not committed (commit did not land)",p=o.red;else{let l=e.uploadResult?.testcaseId;n=l?`\u2713 pushed (testcase=${l})`:"\u2713 pushed",p=o.green}let v=e.shouldReplaceLocalOutput?"output dir replaced":e.anyAuthorStepRan?"untouched (cancellation or no replace)":"untouched (replay-only)",m,g=o.dim;return e.shouldUploadArtifacts?e.uploadResult?.success?(m="\u2713 TMS",g=o.green):e.uploadResult?(m=`\u2717 failed${e.uploadResult.error?`: ${e.uploadResult.error}`:""}`,g=o.red):m="\u2013 not run":m="\u2013 skipped (--local or no auth)",{resultLine:{color:a,text:r},breakdown:T,showRetries:C,retriesText:_,commitText:n,commitColor:p,artifactsText:v,uploadText:m,uploadColor:g}}function I(e){let t=e.decisions.filter(r=>r.kind==="replay").length,s=e.decisions.filter(r=>r.kind==="author").length,d=e.outcomes.filter(r=>r.status==="passed").length,f=e.outcomes.filter(r=>r.status==="failed").length,h=e.outcomes.filter(r=>r.status==="skipped").length,a,u=!1;return e.cancelled?a="cancellation":e.overallStatus==="failed"?a="run_failed":e.shouldCommit&&(e.committed===!0||e.uploadResult?.testcaseId)?(a="ok",u=!0):!e.shouldCommit&&!e.lockHeld&&!e.isFirstRun?a="readonly_fallback":a="not_committed",{type:"test_md_summary",overall_status:e.overallStatus,duration_s:e.durationS,steps:{total:e.outcomes.length,passed:d,failed:f,skipped:h,replay_decisions:t,author_decisions:s},adaptive_heal:{triggered:e.retryTriggered},commit:{committed:u,reason:a,...e.uploadResult?.testcaseId?{testcase_id:e.uploadResult.testcaseId}:{}},artifacts:{replaced:e.shouldReplaceLocalOutput},upload:{performed:e.shouldUploadArtifacts,...e.uploadResult?{succeeded:!!e.uploadResult.success}:{}},...e.shareUrl?{share_url:e.shareUrl}:{},cancelled:e.cancelled,...e.imports&&e.imports.length>0?{imports:e.imports}:{}}}function D({data:e}){let t=A(e),s=[{label:"result",value:(0,i.jsx)(c,{color:t.resultLine.color,bold:!0,children:t.resultLine.text})},{label:"breakdown",value:(0,i.jsx)(c,{color:o.dim,children:t.breakdown})}];return t.showRetries&&s.push({label:"adaptive heal",value:(0,i.jsx)(c,{color:o.orange,children:t.retriesText})}),s.push({label:"commit",value:(0,i.jsx)(c,{color:t.commitColor,children:t.commitText})}),s.push({label:"artifacts",value:(0,i.jsx)(c,{color:o.dim,children:t.artifactsText})}),s.push({label:"upload",value:(0,i.jsx)(c,{color:t.uploadColor,children:t.uploadText})}),(0,i.jsx)(S,{title:"Run summary",titleColor:"#ff9500",rows:s})}function O({data:e}){let{exit:t}=x();return(0,k.useEffect)(()=>{let s=setTimeout(()=>t(),50);return()=>clearTimeout(s)},[t]),(0,i.jsx)(y,{flexDirection:"column",children:(0,i.jsx)(D,{data:e})})}export{A as a,I as b,D as c,O as d};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{c as y,d as _}from"./chunk-IE3OO5GI.js";import{M as h,c as g,e as v,m as b}from"./chunk-3N6IAVD5.js";import{d as f,f as x}from"./chunk-AKX4VRRR.js";var G=n=>`conv#turn=${n}`;function I(n,t){for(let o of n.split(`
|
|
3
|
+
`))if(o.trim())try{let r=JSON.parse(o);if(r.turn===t)return r.text}catch{}return null}var C={format:"conversation",media_type:"text/x-conversation",anchors_supported:["#turn="]};function P(n){let{contextDir:t,graph:o,sessionStamp:r}=n,e=`su-conv-${r}`,a=o.heads.get(e);if(typeof a=="string")return{record:null,errors:[{code:"CONV_SOURCE_EXISTS",detail:`${e} already exists \u2014 resume it`}],sourceId:e,cid:a};let s=y(t,Buffer.from("","utf8")),i=v(e,s),u=x("source",i);if(u.length>0)return{record:null,errors:u.map(c=>({code:c.code,detail:c.detail})),sourceId:e,cid:""};let d=g("source",i);return{record:h(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:d,label:f.SOURCE,content:i}],edges:[],review:[],supersessions:[],source_head_moves:{[e]:d},media:{[e]:C},conv:{source_id:e,turn:0,append_of:null}},{expectPrev:o.latestHash,intent:{v:1,verb:"conv-mint",args:b({sessionStamp:r,by:n.by}),pins:{}},provenance:n.provenance}).record,errors:null,sourceId:e,cid:d}}function T(n){let{contextDir:t,graph:o,sourceId:r,text:e,force:a}=n,s=o.heads.get(r),i=o.convChains.get(r);if(typeof s!="string"||!i)return{record:null,errors:[{code:"CONV_SOURCE_MISSING",detail:`${r} is not a live conversation source`}]};let d=o.getNode(s)?.content?.blob;if(typeof d!="string")return{record:null,errors:[{code:"CONV_SOURCE_MISSING",detail:`${r} head node unreadable`}]};let p=_(t,d)?.toString("utf8")??"",c=i.turns;if(!a&&c>0&&I(p,c)===e)return{record:null,errors:null,turn:c,cid:s,idempotent:!0};let l=c+1,O=`${p}${JSON.stringify({turn:l,text:e})}
|
|
4
|
+
`,E=y(t,Buffer.from(O,"utf8")),S=v(r,E),m=g("source",S);return{record:h(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:m,label:f.SOURCE,content:S}],edges:[],review:[],supersessions:[],source_head_moves:{[r]:m},media:{[r]:C},conv:{source_id:r,turn:l,append_of:s}},{expectPrev:o.latestHash,intent:{v:1,verb:"conv-turn",args:b({sourceId:r,text:e,force:a??!1,by:n.by}),pins:{append_of:s}},provenance:n.provenance}).record,errors:null,turn:l,cid:m,idempotent:!1}}export{G as a,I as b,P as c,T as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as F}from"./chunk-BKHXPBWN.js";import{a as k}from"./chunk-N2P4MI32.js";import{b as $}from"./chunk-
|
|
2
|
+
import{a as F}from"./chunk-BKHXPBWN.js";import{a as k}from"./chunk-N2P4MI32.js";import{b as $}from"./chunk-IE3OO5GI.js";import{deflateSync as Y}from"zlib";function j(n,s){let e=Buffer.alloc(4);e.writeUInt32BE(s.length);let o=Buffer.concat([Buffer.from(n,"latin1"),s]),i=Buffer.alloc(4);return i.writeUInt32BE(F(o)),Buffer.concat([e,o,i])}var G={1:0,3:2,4:6};function N(n,s){let{width:e,height:o,channels:i}=s;if(n.byteLength!==e*o*i)throw new Error(`pngEncode: raw length ${n.byteLength} != ${e}x${o}x${i}`);let d=Buffer.alloc(13);d.writeUInt32BE(e,0),d.writeUInt32BE(o,4),d[8]=8,d[9]=G[i];let t=e*i,a=Buffer.alloc(o*(t+1));for(let f=0;f<o;f++)a[f*(t+1)]=0,n.copy(a,f*(t+1)+1,f*t,(f+1)*t);return Buffer.concat([Buffer.from([137,80,78,71,13,10,26,10]),j("IHDR",d),j("IDAT",Y(a)),j("IEND",Buffer.alloc(0))])}var U=64,X=16,J=12e6,V=6e6,K=5e3,W=3e4,H="",_=class extends Error{constructor(e,o){super(`${e}: ${o}`);this.code=e}};async function q(n,s,e){let o=n.objs.has(s)?n.objs:n.commonObjs.has(s)?n.commonObjs:null;if(o)try{return o.get(s)??null}catch{return null}if(e.remainingMs<=0)return null;let i=s.startsWith("g_")?n.commonObjs:n.objs,d,t=Date.now();try{return await Promise.race([new Promise(a=>{try{i.get(s,f=>a(f??null))}catch{a(null)}}),new Promise(a=>{d=setTimeout(()=>a(null),Math.min(K,e.remainingMs))})])}finally{clearTimeout(d),e.remainingMs-=Date.now()-t}}async function z(){let n=await import("pdfjs-dist/legacy/build/pdf.mjs");return n.default??n}async function oe(n,s){let e=await z();H=e.version;let o={remainingMs:s?.resolveBudgetMs??W},i,d=e.getDocument({data:new Uint8Array(n),isEvalSupported:!1,verbosity:0});try{i=await d.promise}catch(t){throw t.name==="PasswordException"?new _("PDF_ENCRYPTED","password-protected \u2014 decrypt and re-ingest"):new _("PDF_UNREADABLE",String(t.message??t))}try{let t=[],a=[],f=new Map,D=[],T=new Map,R=0,A=0;for(let u=1;u<=i.numPages;u++){let O=await i.getPage(u);t.push(`[page ${u}]`);let C=await O.getTextContent(),c="",E=null;for(let m of C.items){if(typeof m!="object"||m===null||!("str"in m))continue;let p=m,P=Math.round(p.transform[5]);E!==null&&P!==E&&c.trim()!==""&&(t.push(c.trimEnd()),c=""),c!==""&&!c.endsWith(" ")&&p.str!==""&&!p.str.startsWith(" ")&&P===E&&(c+=" "),c+=p.str,A+=p.str.trim().length,E=P,p.hasEOL&&c.trim()!==""&&(t.push(c.trimEnd()),c="",E=null)}c.trim()!==""&&t.push(c.trimEnd());let B=await O.getOperatorList(),M=0;for(let m=0;m<B.fnArray.length;m++){let p=B.fnArray[m]===e.OPS.paintImageXObject,P=B.fnArray[m]===e.OPS.paintInlineImageXObject;if(!p&&!P)continue;M+=1;let h=`p${u}-${M}`,l=(v,L,w,S)=>{a.push({ref:h,page:u,media_type:"image/png",...L?{blob:L}:{},...S?{appearance:S}:{},delivery:v,...w?{duplicate_of:w}:{}}),t.push(v==="duplicate"&&w?`[img#${h}: image on page ${u} \u2014 same as img#${w}; cite img#${w}]`:`[img#${h} omitted: ${v}]`)};if(P){l("unsupported-image-kind");continue}let r=await q(O,B.argsArray[m][0],o);if(!r?.data||!r.width||!r.height){l("undecodable");continue}let I;if(r.kind===e.ImageKind.RGB_24BPP)I=3;else if(r.kind===e.ImageKind.RGBA_32BPP)I=4;else{l("unsupported-image-kind");continue}let y;try{y=N(Buffer.from(r.data.buffer,r.data.byteOffset,r.data.byteLength),{width:r.width,height:r.height,channels:I})}catch{l("undecodable");continue}let g=$(y);f.set(g,y);let b=k(Buffer.from(r.data.buffer,r.data.byteOffset,r.data.byteLength),{width:r.width,height:r.height,channels:I});if(r.width<U||r.height<U){l("below-dimension-floor",g,void 0,b);continue}let x=T.get(g);if(x!==void 0){l("duplicate",g,x,b);continue}if(y.byteLength>V){l("image-too-large",g,void 0,b);continue}if(R+y.byteLength>J){l("vision-byte-budget-reached",g,void 0,b);continue}if(D.length>=X){l("image-cap-reached",g,void 0,b);continue}T.set(g,h),R+=y.byteLength,D.push(h),a.push({ref:h,page:u,media_type:"image/png",blob:g,appearance:b,delivery:"selected"}),t.push(`[img#${h}: image on page ${u}]`)}}if(A===0&&i.numPages>0)throw new _("PDF_NO_TEXT_LAYER","no extractable text \u2014 image-only or scanned pdfs are not supported yet");return{projection:t.join(`
|
|
3
3
|
`)+`
|
|
4
4
|
`,inventory:a,blobs:f,delivered:D,pages:i.numPages,converter:{name:"pdfjs-dist",version:e.version,policy:"v1"}}}finally{await d.destroy().catch(()=>{})}}export{U as a,X as b,J as c,V as d,H as e,_ as f,oe as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-5Y2G4NC7.js";import{y as o}from"./chunk-HYTBEPC2.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};
|
|
@@ -3,4 +3,4 @@ import{existsSync as f,fsyncSync as X,mkdirSync as z,readFileSync as S,readdirSy
|
|
|
3
3
|
`;try{let i=K(o,"wx",384);return H(i,c),j(i),s}catch(i){if(i.code!=="EEXIST")throw i;let p=!1,a;try{let d=JSON.parse(S(o,"utf8")),_=t.getTime()-new Date(d.ts).getTime();p=!M(d.pid)||_>=q,a=d.nonce}catch{p=!0}if(!p)throw new u("SESSION_LOCKED",`${e} is held by another live process`);let g=`${o}.break-${s}`;try{E(o,g);let d;try{d=JSON.parse(S(g,"utf8"))}catch{d=null}if(d===null||d.nonce===a)m(g,{force:!0});else try{E(g,o)}catch{m(g,{force:!0})}}catch(d){if(d.code!=="ENOENT")throw d}return k(n,e,t,r+1)}}function G(n,e,t,r,o){let s=()=>{try{if(JSON.parse(S(h(n,e),"utf8")).nonce!==r)throw new u("SESSION_LOCK_LOST",`${e} lock was taken over`)}catch(i){throw i instanceof u?i:new u("SESSION_LOCK_LOST",`${e} lock file unreadable/gone`)}},c=()=>b(l(n,e),JSON.stringify(t)+`
|
|
4
4
|
`);return{get state(){return t},isApplied:i=>t.applied_events.includes(i),markApplied(i){s(),t={...t,applied_events:[...new Set([...t.applied_events,...i])].sort()},c()},reconcileSave(i){s(),t={...t,applied_events:[...new Set([...t.applied_events,...i.appliedEvents])].sort(),held_receipts:i.heldReceipts,pending:i.pending},c()},save(i){s();let{agent_state:p,pending:a,assumed:g,read_basis:d,corpus_cursor:_,expires_at:I,force:x,conv_source:R,held_receipts:T,force_scope:D,user_session_id:J,checkpoint:L,target_pins:$,ingest_registry:A,ingest_schedule:P,reconcile:C}=i;t={...t,...p!==void 0?{agent_state:p}:{},...a!==void 0?{pending:a}:{},...g!==void 0?{assumed:g}:{},...d!==void 0?{read_basis:d}:{},..._!==void 0?{corpus_cursor:_}:{},...I!==void 0?{expires_at:I}:{},...x!==void 0?{force:x}:{},...R!==void 0?{conv_source:R}:{},...T!==void 0?{held_receipts:T}:{},...D!==void 0?{force_scope:D}:{},...J!==void 0?{user_session_id:J}:{},...L!==void 0?{checkpoint:L}:{},...$!==void 0?{target_pins:$}:{},...A!==void 0?{ingest_registry:A}:{},...P!==void 0?{ingest_schedule:P}:{},...C!==void 0?{reconcile:C}:{}},c()},complete(){s(),m(O(n,e),{recursive:!0,force:!0})},release(){try{s(),m(h(n,e),{force:!0})}catch(i){if(i instanceof u||i.code==="ENOENT")return;throw i}}}}function W(n,e,t){if(!F.test(e.sid))throw new u("SESSION_MISSING",`bad sid ${JSON.stringify(e.sid)}`);let r=w(t);if(f(l(n,e.sid)))throw new u("SESSION_LOCKED",`${e.sid} already exists \u2014 resume it`);z(O(n,e.sid),{recursive:!0,mode:448});let o=k(n,e.sid,r),s={schema:1,applied_events:[],...e};return b(l(n,e.sid),JSON.stringify(s)+`
|
|
5
5
|
`),G(n,e.sid,s,o,t)}function Y(n,e,t){if(!F.test(e)||!f(l(n,e)))throw new u("SESSION_MISSING",`no session ${e}`);let r=w(t),o=k(n,e,r),s=JSON.parse(S(l(n,e),"utf8"));if(new Date(s.expires_at).getTime()<=r.getTime())throw m(h(n,e),{force:!0}),new u("SESSION_EXPIRED",`${e} expired at ${s.expires_at}`);let c={...s,expires_at:new Date(r.getTime()+q).toISOString()};return b(l(n,e),JSON.stringify(c)+`
|
|
6
|
-
`),G(n,e,c,o,t)}function Z(n,e){try{let t=y(n,"proposals",e,"verdicts.json");return JSON.parse(S(t,"utf8")).resolved===!0}catch{return!1}}function ee(n,e){let t=l(n,e);return f(t)?JSON.parse(S(t,"utf8")):null}function ne(n){let e=v(n);if(!f(e))return[];let t=[];for(let r of N(e)){let o=l(n,r);if(f(o))try{let s=JSON.parse(S(o,"utf8"));t.push({sid:s.sid,mode:s.mode,created_at:s.created_at,expires_at:s.expires_at,pendingCount:s.pending.questions.length+s.pending.proposals.length,verb:s.verb,use_case:s.use_case})}catch{t.push({sid:r,mode:"?",created_at:"",expires_at:"",pendingCount:0,corrupt:!0})}}return t.sort((r,o)=>r.created_at<o.created_at?-1:1)}function te(n,e,t){let r=v(n);if(!f(r))return{holders:[],corrupt:0};let o=w(t),s=[],c=0;for(let i of N(r)){let p=l(n,i);if(f(p))try{let a=JSON.parse(S(p,"utf8"));if(new Date(a.expires_at).getTime()<=o.getTime())continue;let g=a.pending.proposals.some(_=>(_.content?._held?.source_id??null)===e),d=a.reconcile!=null&&e in a.read_basis&&!Z(n,a.reconcile.proposal_id);(g||d)&&s.push(a.sid)}catch{c+=1}}return{holders:s,corrupt:c}}function se(n,e){let t=w(e),r=[],o=[],s=v(n);if(!f(s))return{removed:r,skipped:o};for(let c of N(s)){if(e?.sid&&c!==e.sid)continue;let i=!1,p=!1;try{let a=JSON.parse(S(l(n,c),"utf8"));i=new Date(a.expires_at).getTime()<=t.getTime()}catch{p=!0}if(e?.sid||e?.all||i||p&&e?.all){try{let a=JSON.parse(S(h(n,c),"utf8"));if(M(a.pid)&&a.pid!==process.pid){o.push({sid:c,reason:`in use by live pid ${a.pid}`});continue}}catch{}m(O(n,c),{recursive:!0,force:!0}),r.push(c)}}return{removed:r,skipped:o}}export{u as a,
|
|
6
|
+
`),G(n,e,c,o,t)}function Z(n,e){try{let t=y(n,"proposals",e,"verdicts.json");return JSON.parse(S(t,"utf8")).resolved===!0}catch{return!1}}function ee(n,e){let t=l(n,e);return f(t)?JSON.parse(S(t,"utf8")):null}function ne(n){let e=v(n);if(!f(e))return[];let t=[];for(let r of N(e)){let o=l(n,r);if(f(o))try{let s=JSON.parse(S(o,"utf8"));t.push({sid:s.sid,mode:s.mode,created_at:s.created_at,expires_at:s.expires_at,pendingCount:s.pending.questions.length+s.pending.proposals.length,verb:s.verb,use_case:s.use_case})}catch{t.push({sid:r,mode:"?",created_at:"",expires_at:"",pendingCount:0,corrupt:!0})}}return t.sort((r,o)=>r.created_at<o.created_at?-1:1)}function te(n,e,t){let r=v(n);if(!f(r))return{holders:[],corrupt:0};let o=w(t),s=[],c=0;for(let i of N(r)){let p=l(n,i);if(f(p))try{let a=JSON.parse(S(p,"utf8"));if(new Date(a.expires_at).getTime()<=o.getTime())continue;let g=a.pending.proposals.some(_=>(_.content?._held?.source_id??null)===e),d=a.reconcile!=null&&e in a.read_basis&&!Z(n,a.reconcile.proposal_id);(g||d)&&s.push(a.sid)}catch{c+=1}}return{holders:s,corrupt:c}}function se(n,e){let t=w(e),r=[],o=[],s=v(n);if(!f(s))return{removed:r,skipped:o};for(let c of N(s)){if(e?.sid&&c!==e.sid)continue;let i=!1,p=!1;try{let a=JSON.parse(S(l(n,c),"utf8"));i=new Date(a.expires_at).getTime()<=t.getTime()}catch{p=!0}if(e?.sid||e?.all||i||p&&e?.all){try{let a=JSON.parse(S(h(n,c),"utf8"));if(M(a.pid)&&a.pid!==process.pid){o.push({sid:c,reason:`in use by live pid ${a.pid}`});continue}}catch{}m(O(n,c),{recursive:!0,force:!0}),r.push(c)}}return{removed:r,skipped:o}}export{u as a,q as b,W as c,Y as d,Z as e,ee as f,ne as g,te as h,se as i};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as he}from"./chunk-KZG4E5RM.js";import{a as pe}from"./chunk-T4R26WER.js";import{b as ue,c as de,d as q,e as Y}from"./chunk-DMCEGMGB.js";import{d as ge,e as me}from"./chunk-AXTPNZPX.js";import{d as fe}from"./chunk-BZAGVBCX.js";import{a as L}from"./chunk-ALCE5RLK.js";import{a as le}from"./chunk-DMT3W26F.js";import{C as I}from"./chunk-GP7WD4UY.js";import{F as ce,X as ae}from"./chunk-3N6IAVD5.js";function mt(t){let e=process.env.HOME??"";return e&&t.startsWith(e)?`~${t.slice(e.length)}`:t}import{randomBytes as lt}from"crypto";function J(t,e){let r=Math.min(t.length,e.length),o=0,n=0,c=0;for(let s=0;s<r;s++)o+=t[s]*e[s],n+=t[s]*t[s],c+=e[s]*e[s];return n===0||c===0?0:o/(Math.sqrt(n)*Math.sqrt(c))}function Z(t,e,r){return r*t+(1-r)*e}var ee=.7;var je=["get_node","get_edges","find_by_provenance","match_by_type","stale_nodes","search_similar","search_similar_batch","history"],Pe=["source_read","source_grep","source_list"],Ue=[...je,...Pe],ke=50,be=200,te=10,xe=50,_e=20,Ve=200,He=50;function P(t,e,r){let o=typeof t=="number"&&Number.isFinite(t)?Math.floor(t):e;return Math.max(1,Math.min(o,r))}function M(t,e){let r=t[e];if(typeof r!="string"||r.length===0)throw new k(`param "${e}" must be a non-empty string`);return r}function $(t,e){let r=t[e];if(r==null)return null;if(typeof r!="string")throw new k(`param "${e}" must be a string when present`);return r}var k=class extends Error{},ye=24,Qe=10,ze=10;function Ke(t){let e=t.cursor;if(e==null)return 0;if(typeof e=="string"&&/^\d+$/.test(e))return Number.parseInt(e,10);throw new k(`BAD_CURSOR: cursor ${JSON.stringify(e)} is not a cursor this store minted`)}function ve(t,e){let r=e.fields;if(!Array.isArray(r)||r.length===0)return t;let o=new Set(r.filter(n=>typeof n=="string"));return t.map(n=>Object.fromEntries(Object.entries(n).filter(([c])=>o.has(c))))}function ne(t,e,r=ke,o=be){let n=Ke(e),c=P(e.limit,r,o),s=t.slice(n,n+c),u=n+s.length<t.length;return{rows:ve(s,e),truncated:u,next_cursor:u?String(n+s.length):null}}var We=t=>t.cursor!=null||t.fields!=null;function U(t,e,r=ke){let o=ne(t,e,r);return We(e)||o.truncated?{rows:o.rows,truncated:o.truncated,next_cursor:o.next_cursor}:o.rows}function re(t,e){let r=t.getNode(e);return r?{cid:e,label:r.label,content:r.content,trust:t.trust.get(e)??null,freshness:t.stale(e)}:null}function we(t){return new Set(t.toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").split(" ").filter(Boolean))}function V(t,...e){let r=we(t);if(r.size===0)return 0;let o=t.trim().toLowerCase(),n=0;for(let c of e){let s=we(c);if(s.size===0)continue;let u=0;for(let l of r)s.has(l)&&u++;let f=r.size+s.size-u,d=f===0?0:u/f;o&&c.toLowerCase().includes(o)&&(d=Math.max(d,.9)),n=Math.max(n,d)}return n}function Xe(t,e){let r=M(e,"cid"),o=$(e,"type"),n=$(e,"direction")??"both";if(!["out","in","both"].includes(n))throw new k('param "direction" must be out|in|both');let c=[];(n==="out"||n==="both")&&c.push(...t.edgesFrom(r)),(n==="in"||n==="both")&&c.push(...t.edgesInto(r));let s=c.filter(u=>o==null||u.type===o);return U(s,e)}function qe(t,e){let r=M(e,"source_id"),o=t.heads.get(r)??null,n=[];for(let c of t.nodeLabel.keys()){let s=t.derivesInto(c).filter(f=>f.props.source_id===r).map(f=>({source_cid:f.props.source_cid,anchor:f.props.anchor??null}));if(s.length===0)continue;let u=re(t,c);u&&n.push({...u,pins:s,pinned_to_head:o!=null&&s.some(f=>f.source_cid===o)})}return U(n,e,be)}function Ye(t,e){let r=M(e,"label"),o=$(e,"trust"),n=$(e,"freshness"),c=[];for(let{cid:s}of t.byLabel(r)){let u=re(t,s);u&&(o!=null&&u.trust!==o||n!=null&&u.freshness!==n||c.push(u))}return U(c,e)}function Je(t,e={}){let r=$(e,"label"),o=t.staleList().map(({cid:n,state:c})=>{let s=t.getNode(n);return{cid:n,state:c,label:s?.label??null,title:s?.content.title??null}}).filter(n=>r==null||n.label===r);return U(o,e)}function Ze(t,e,r){let o=e.extracted,n=$(e,"kind"),c=[];for(let d of[...t.heads.keys()].sort()){let l=t.heads.get(d);if(typeof l!="string")continue;let h=t.mediaOf(l).format;if(n!=null&&h!==n)continue;let p=t.extractedSourceCids.has(l);if(typeof o=="boolean"&&p!==o)continue;let S=0;if(h!=="image"){let b=L(r,t,l);b&&(S=b.toString("utf8").replace(/\n$/,"").split(`
|
|
3
|
+
`).length)}let _=t.extractionCompleteness.get(d);c.push({source_id:d,kind:h,lines:S,head_cid:l,extracted:p,last_extract_at:_?.at??null,extractor_version:_?.extractor_version??null})}let{rows:s,truncated:u,next_cursor:f}=ne(c,e);return{sources:s,truncated:u,next_cursor:f}}function et(t,e,r){let o=M(e,"ref"),n=t.resolve(o);if(!n)throw new k(`UNKNOWN_REF: ${o} names nothing in the graph`);let c=n.tip,s=new Map;for(let[m,w]of t.superseded)typeof w=="string"&&w!==m&&s.set(w,[...s.get(w)??[],m]);let u=[],f=[c],d=new Set;for(;f.length>0;){let m=f.pop();d.has(m)||(d.add(m),u.push(m),f.push(...s.get(m)??[]))}let{records:l}=ce(r),g=new Map,h=new Map;for(let m of l){for(let w of m.nodes)g.has(w.cid)||g.set(w.cid,m.ts);for(let w of m.supersessions)w.kind==="node"&&h.set(w.old,{by_cid:w.new,reason:w.reason})}let p=u.map(m=>({cid:m,minted_at:g.get(m)??null,superseded_by:h.get(m)?.by_cid??null,reason:h.get(m)?.reason??null,change_note:null})),{rows:S,truncated:_,next_cursor:b}=ne(p,e,ze);return{root_logical_id:t.displayNameOf(c),live_tip:t.superseded.has(c)?null:c,truncated:_,next_cursor:b,chain:S}}function Se(t){let e=t.queries;if(!Array.isArray(e)||e.length<1||e.length>ye)throw new k(`param "queries" must be 1..${ye} entries`);return e.map((r,o)=>{if(typeof r!="object"||r===null)throw new k(`queries[${o}] must be an object`);let n=r;if(typeof n.qid!="string"||n.qid.length===0)throw new k(`queries[${o}].qid must be a non-empty string`);if(typeof n.text!="string"||n.text.length===0)throw new k(`queries[${o}].text must be a non-empty string`);return{qid:n.qid,text:n.text,topK:P(n.top_k,te,Qe)}})}function Ae(t){let e=[];for(let{cid:r,content:o}of t.byLabel("usecase"))t.superseded.has(r)||e.push({cid:r,title:String(o.title??""),summary:String(o.summary??""),description:String(o.description??"")});return e}function Re(t,e,r){let o=Ae(t);return e.map(n=>{let c=[];for(let s of o){let u=r(n,s);u<=0||c.push({cid:s.cid,logical_id:t.displayNameOf(s.cid),title:s.title,score:Math.round(u*1e3)/1e3,trust:t.trust.get(s.cid)??null,superseded:!1})}return c.sort((s,u)=>u.score-s.score||s.cid.localeCompare(u.cid)),{qid:n.qid,truncated:c.length>n.topK,matches:c.slice(0,n.topK)}})}function Ee(t,e){let r=Se(e);return{results:Re(t,r,(o,n)=>V(o.text,n.title,n.summary,n.description)),scorer:"lexical_fallback"}}function tt(t,e){let r=M(e,"text"),o=$(e,"label")??"usecase",n=P(e.k,te,xe),c=[];for(let{cid:s,content:u}of t.byLabel(o)){let f=String(u.title??""),d=String(u.summary??""),l=V(r,f,d);l<=0||c.push({cid:s,title:f,summary:d,score:Math.round(l*1e3)/1e3,trust:t.trust.get(s)??null,freshness:t.stale(s)})}return c.sort((s,u)=>u.score-s.score||s.cid.localeCompare(u.cid)),c.slice(0,n)}function De(t,e,r){let o=t.heads.get(r);if(typeof o!="string"){let c=[...t.heads.keys()].sort().join(", ");throw new k(`unknown source_id "${r}" \u2014 known: ${c||"(none)"}`)}if(t.mediaOf(o).format==="image")throw new k(`source "${r}" is an image \u2014 no line window (cite img#whole)`);let n=L(e,t,o);if(n==null)throw new k(`source "${r}" blob is missing from the store`);return{head:o,lines:n.toString("utf8").replace(/\n$/,"").split(`
|
|
4
|
+
`)}}function nt(t,e,r){return t.slice(e-1,r).map((o,n)=>`${String(e+n).padStart(4,"0")}| ${o}`).join(`
|
|
5
|
+
`)}function rt(t,e,r){let o=M(e,"source_id"),n=$(e,"anchor"),c=e.line_range;if(n!=null&&c!=null)throw new k("give anchor OR line_range, not both");let{head:s,lines:u}=De(t,r,o),f=u.length,d,l;if(n!=null){let g=/^L(\d+)-L(\d+)$/.exec(n);if(!g)throw new k(`anchor "${n}" is not L<a>-L<b>`);let h=Number(g[1]),p=Number(g[2]);if(h<1||p<h||p>f)throw new k(`anchor "${n}" does not resolve (source has ${f} lines)`);d=Math.max(1,h-_e),l=Math.min(f,p+_e)}else if(c!=null){if(!Array.isArray(c)||c.length!==2||!c.every(p=>Number.isInteger(p)))throw new k('param "line_range" must be [from_line, to_line]');let[g,h]=c;if(g<1||h<g)throw new k('param "line_range" must be 1-based with from \u2264 to');if(g>f)throw new k(`line_range starts past the end (source has ${f} lines)`);d=g,l=Math.min(h,f)}else d=1,l=f;return l=Math.min(l,d+Ve-1),{window:nt(u,d,l),from_line:d,to_line:l,source_cid:s,total_lines:f}}function st(t,e,r){let o=M(e,"pattern"),n=$(e,"source_id"),c;try{c=new RegExp(o,"u")}catch(d){throw new k(`invalid pattern: ${d instanceof Error?d.message:String(d)}`)}let s=n!=null?[n]:[...t.heads.keys()].sort(),u=[],f=!1;e:for(let d of s){if(n==null){let g=t.heads.get(d);if(typeof g!="string"||t.mediaOf(g).format==="image")continue}let{lines:l}=De(t,r,d);for(let g=0;g<l.length;g++)if(c.test(l[g])){if(u.length>=He){f=!0;break e}u.push({source_id:d,line:g+1,text:l[g]})}}return{matches:u,truncated:f}}function ot(t,e,r,o){try{switch(e){case"get_node":{let n=re(t,M(r,"cid"));return n==null?{ok:!0,result:null}:{ok:!0,result:ve([n],r)[0]}}case"get_edges":return{ok:!0,result:Xe(t,r)};case"find_by_provenance":return{ok:!0,result:qe(t,r)};case"match_by_type":return{ok:!0,result:Ye(t,r)};case"stale_nodes":return{ok:!0,result:Je(t,r)};case"search_similar":return{ok:!0,result:tt(t,r)};case"search_similar_batch":return{ok:!0,result:Ee(t,r)};case"history":{if(o==null)throw new k("history unavailable (no context store)");return{ok:!0,result:et(t,r,o)}}case"source_list":{if(o==null)throw new k("source roster unavailable (no context store)");return{ok:!0,result:Ze(t,r,o)}}case"source_read":case"source_grep":{if(o==null)throw new k("source text unavailable (no context store)");return{ok:!0,result:(e==="source_read"?rt:st)(t,r,o)}}default:return{ok:!1,error:`unknown method: ${e} \u2014 available: ${Ue.join(", ")}`}}}catch(n){return n instanceof k?{ok:!1,error:`${e}: ${n.message}`}:{ok:!1,error:`${e}: graph read failed: ${n instanceof Error?n.message:String(n)}`}}}var j="assurance.sim";function it(t){return[t.title,t.summary,t.description].filter(Boolean).join(`
|
|
6
|
+
`)}async function ct(t,e,r){let o=M(e,"text"),n=$(e,"label")??"usecase",c=P(e.k,te,xe),s=[];for(let{cid:f,content:d}of t.byLabel(n)){if(t.superseded.has(f))continue;let l=String(d.title??""),g=String(d.summary??""),h=String(d.description??"");s.push({cid:f,title:l,summary:g,description:h,lex:V(o,l,g,h)})}let u=f=>{let d=[];for(let l of s){let g=f(l);g.score<=0||d.push({cid:l.cid,title:l.title,summary:l.summary,score:Math.round(g.score*1e3)/1e3,trust:t.trust.get(l.cid)??null,freshness:t.stale(l.cid),...g.dense!==void 0?{dense_score:Math.round(g.dense*1e3)/1e3,lexical_score:Math.round(l.lex*1e3)/1e3}:{}})}return d.sort((l,g)=>g.score-l.score||l.cid.localeCompare(g.cid)),d.slice(0,c)};try{let f=r.readVector??q,d=r.writeVector??Y,l=r.alpha??ee,{alias:g}=await r.resolveAlias(j),h=new Map,p=[],S=[];for(let m of s){let w=f(r.contextDir,g,m.cid);w?h.set(m.cid,w):(p.push(m.cid),S.push(it(m)))}let{vectors:_}=await r.embed(j,[o,...S]),b=Float32Array.from(_[0]);for(let m=0;m<p.length;m++){let w=Float32Array.from(_[m+1]);h.set(p[m],w),d(r.contextDir,g,p[m],w)}return u(m=>{let w=h.get(m.cid),C=w?J(b,w):0;return{score:Z(C,m.lex,l),dense:C}})}catch{return r.onDegraded?.(),u(f=>({score:f.lex}))}}async function at(t,e,r){let o=Se(e),n=Ae(t);try{let c=r.readVector??q,s=r.writeVector??Y,u=r.alpha??ee,{alias:f}=await r.resolveAlias(j),d=new Map,l=[],g=[];for(let _ of n){let b=c(r.contextDir,f,_.cid);b?d.set(_.cid,b):(l.push(_.cid),g.push([_.title,_.summary,_.description].filter(Boolean).join(`
|
|
7
|
+
`)))}let{vectors:h}=await r.embed(j,[...o.map(_=>_.text),...g]),p=o.map((_,b)=>Float32Array.from(h[b]));for(let _=0;_<l.length;_++){let b=Float32Array.from(h[o.length+_]);d.set(l[_],b),s(r.contextDir,f,l[_],b)}let S=new Map(o.map((_,b)=>[_.qid,b]));return{results:Re(t,o,(_,b)=>{let m=d.get(b.cid),w=m?J(p[S.get(_.qid)],m):0;return Z(w,V(_.text,b.title,b.summary,b.description),u)}),scorer:"embedding"}}catch{return r.onDegraded?.(),Ee(t,e)}}async function $e(t,e,r,o){if((e==="search_similar"||e==="search_similar_batch")&&o)try{return{ok:!0,result:e==="search_similar"?await ct(t,r,o):await at(t,r,o)}}catch(n){return n instanceof k?{ok:!1,error:`${e}: ${n.message}`}:{ok:!1,error:`${e}: graph read failed: ${n instanceof Error?n.message:String(n)}`}}return ot(t,e,r,o?.contextDir)}var ut=2,Me=10,dt=2;function Ce(t,e,r){return t.map(o=>{let n=e.find(c=>c.id===o.id);if(n&&n.selected_index!=null&&n.selected_index>=0&&n.selected_index<o.options.length){let s=(o.allow_free_text||o.options[n.selected_index]?.input===!0)&&n.free_text!=null?n.free_text:null;return{id:o.id,resolution:"answered",selected_index:n.selected_index,free_text:s}}return n&&n.free_text!=null&&o.allow_free_text?{id:o.id,resolution:"answered",selected_index:-1,free_text:n.free_text}:r.explicitAcceptDefaults?{id:o.id,resolution:"assumed-default",selected_index:o.recommended_index,flagged:!0}:{id:o.id,resolution:"deferred",selected_index:null}})}async function Et(t,e,r,o,n=()=>{},c){let s=(i,a)=>n(i,a,t.session_id),u=(process.env.ASSURANCE_LOG_LEVEL??"info").toLowerCase()==="debug",f={contextDir:e.contextDir,resolveAlias:i=>ue(i,{env:process.env,auth:e.auth}),embed:(i,a)=>de(i,a,{env:process.env,auth:e.auth}),...e.onEmbedDegraded?{onDegraded:e.onEmbedDegraded}:{}},d=0,l=e.agent(t,{auth:e.auth,onWarn:i=>{s("warn",i),e.out(i)},onStderr:i=>s("agent_stderr",i)}),g=null,h=null,p,S,_=l.send.bind(l),b=new Set(["user_response","user_message","session_complete"]),m=null,w=!1,C=[],A=i=>{if(i.type==="session_complete"&&(w=!0),m!==null&&b.has(i.type)){C.push(i),s("belt_withheld",{type:i.type,unacked_seq:m});return}_(i)};if(t.checkpoints&&!e.checkpoint)throw l.kill(),new Error("run_config.checkpoints is on but DriverDeps.checkpoint sink is absent (programming error)");let se=!1,Q=e.pendingDeferral??null,O=!1,Ne=e.chat?.attachSender?.(i=>A(i));e.initialMessage&&(A({type:"user_message",message_id:`msg-${t.session_id}-${lt(3).toString("hex")}`,text:e.initialMessage}),s("user_message_sent",{chars:e.initialMessage.length,...u?{text:e.initialMessage}:{}}),e.emit?.({type:"message_sent",sid:t.session_id,chars:e.initialMessage.length}),e.chat?.note("\u21B3 delivered to the agent"));let z,F=0,K=0,B=0,W,R=ge(),G=e.progress??e.out;try{for await(let i of l.events){try{e.chat?.onAgentEvent(i)}catch(a){s("chat_mirror_error",{event_type:i.type,message:a instanceof Error?a.message:String(a)})}if(i.type==="reasoning_delta"?(d+=i.text.length,process.env.KANE_TRACE_REASONING&&s("reasoning_delta",i.text)):i.type==="state_checkpoint"&&!process.env.KANE_TRACE_REASONING?s("state_checkpoint",{seq:i.seq,items:i.delta_items.length,bytes:JSON.stringify(i.delta_items).length}):s(i.type,i),i.type==="reasoning_done"&&s("reasoning_chars",d),i.type==="progress")G(`\u2026 ${i.stage}${i.n?` #${i.n}`:""}`),e.emit?.({type:"agent_activity",kind:"progress",label:`${i.stage}${i.n?` #${i.n}`:""}`});else if(i.type==="reasoning_delta"||i.type==="reasoning_done"||i.type==="tool_activity"||i.type==="decision_activity"){e.onStreamEvent?.(i);let a=R;if(R=me(R,i),R===a)continue;i.type==="reasoning_delta"?R.liveThinking===i.text&&G("\u2237 thinking\u2026"):i.type==="reasoning_done"?i.present&&(G(`thought for ${(i.took_ms/1e3).toFixed(1)}s`),e.emit?.({type:"agent_activity",kind:"thinking_done",label:`thought for ${(i.took_ms/1e3).toFixed(1)}s`})):i.type==="tool_activity"?i.status!=="done"&&(G(R.activity[R.activity.length-1].label),e.emit?.({type:"agent_activity",kind:"tool",label:R.activity[R.activity.length-1].label})):(G(`\xB7 ${R.activity[R.activity.length-1].label}`),e.emit?.({type:"agent_activity",kind:"decision",label:R.activity[R.activity.length-1].label}))}else if(i.type==="usage"){W=i.total_credits;let a=x=>Math.round(x*100)/100;e.emit?.({type:"usage",credits:a(i.credits),total_credits:a(i.total_credits)})}else if(i.type==="graph_query"){let a=await $e(e.graphSlot?.current??o,i.method,i.params??{},f),x=a.ok?{type:"graph_result",id:i.id,ok:!0,result:a.result}:{type:"graph_result",id:i.id,ok:!1,error:a.error};s("graph_result",u?{id:i.id,method:i.method,ok:a.ok,result:a.ok?a.result:a.error}:{id:i.id,method:i.method,ok:a.ok}),A(x)}else if(i.type==="ingest_request")if(e.ingest){let a;try{a=await e.ingest({id:i.id,ref:i.ref,purpose:i.purpose??null})}catch(T){s("ingest_executor_threw",{id:i.id,error:T instanceof Error?T.message:String(T)}),a={ok:!1,error:{code:"INGEST_FAILED",message:"the landing failed \u2014 see the trace for detail"}}}let x=a.ok?{type:"ingest_result",id:i.id,ok:!0,result:a.result}:{type:"ingest_result",id:i.id,ok:!1,error:a.error};s("ingest_result",a.ok?{id:i.id,ok:!0,source_id:a.result.source_id}:{id:i.id,ok:!1,code:a.error.code}),A(x)}else{let a={type:"ingest_result",id:i.id,ok:!1,error:{code:"INGEST_UNAVAILABLE",message:"this session has no ingest executor"}};s("ingest_result",{id:i.id,ok:!1,code:a.error.code}),A(a)}else if(i.type==="state_checkpoint"){if(!e.checkpoint)throw new Error("state_checkpoint arrived with no checkpoint sink (programming error)");m=i.seq;try{for(e.checkpoint.persist(i),m=null,_({type:"checkpoint_ack",seq:i.seq}),s("checkpoint_acked",{seq:i.seq,at:i.at});C.length>0&&m===null;)A(C.shift())}catch(a){let x=a instanceof Error?a.message:String(a);se||(se=!0,e.out("warning: couldn't save the session checkpoint \u2014 pausing so no work is lost")),s("checkpoint_persist_failed",{seq:i.seq,message:x}),_({type:"pause"})}}else if(i.type==="session_paused")O=!0,S=i;else if(i.type==="done")O=!0;else if(i.type==="ask_user"){i.text&&(e.chat?e.chat.ledger({kind:"agent",text:i.text}):e.out(i.text),e.emit?.({type:"agent_message",text:i.text}));let a=t.mode;if(Q){let y=Q;Q=null,e.emit?.({type:"ask_deferred",source_id:y.ingested.source_id,cid:y.ingested.cid,questions:i.questions.length}),s("ask_deferred",{source_id:y.ingested.source_id,questions:i.questions.length}),A({type:"user_response",answers:[],deferral:{deferred:!0,ingested:y.ingested}});continue}if(a!=="interactive"){if(a==="agent"){s("pause_requested",{questions:i.questions.map(v=>v.id)}),A({type:"pause"});continue}if(a==="ci"){let v=i.questions.filter(E=>E.risk==="high");if(v.length>0){z=v,l.kill();break}}let y=Ce(i.questions,[],{explicitAcceptDefaults:!0});F+=y.length;for(let v of y)s("assumed_default",{id:v.id,resolution:v.resolution}),e.emit?.({type:"assumed_default",id:v.id,selected_index:v.selected_index,risk:i.questions.find(E=>E.id===v.id)?.risk});let D={type:"user_response",answers:y.map(v=>({id:v.id,selected_index:v.resolution==="deferred"?null:v.selected_index,free_text:null}))};A(D);continue}let x=await e.ask(i.questions);if(!Array.isArray(x)){A({type:"user_response",answers:[],deferral:x});continue}let T=x,Oe=Ce(i.questions,T,{explicitAcceptDefaults:!1}),Fe={type:"user_response",answers:i.questions.map(y=>{let D=T.find(E=>E.id===y.id);if(D?.free_text!=null){let E=D.selected_index!=null&&D.selected_index>=0&&D.selected_index<y.options.length?D.selected_index:null;if(E!=null){let N=y.allow_free_text||y.options[E]?.input===!0;return N&&D.free_text!=null&&r.set(y.id,(r.get(y.id)??0)+1),{id:y.id,selected_index:E,free_text:N?D.free_text:null}}let ie=r.get(y.id)??0;if(!y.allow_free_text||ie>=ut){let N=y.options[y.recommended_index]?.label??"recommended option";if(F+=1,e.emit?.({type:"assumed_default",id:y.id,selected_index:y.recommended_index,risk:y.risk}),e.chat?.noteCoercion)e.chat.noteCoercion(y,N);else{let X=y.text.replace(/\?+\s*$/,""),Be=X.length<=36?X:`${X.slice(0,33)}\u2026`;e.out(`note: couldn't use a typed answer for "${Be}" \u2014 kept the recommended option (${N})`)}return{id:y.id,selected_index:y.recommended_index,free_text:null}}return r.set(y.id,ie+1),{id:y.id,selected_index:null,free_text:D.free_text}}let v=Oe.find(E=>E.id===y.id);return v.resolution==="deferred"?{id:y.id,selected_index:null,free_text:null}:{id:y.id,selected_index:v.selected_index,free_text:null}})};A(Fe)}else if(i.type==="chat_ops"&&!e.chat){let a=i.chat_ops??i,x=Array.isArray(a.ops)?a.ops.length:0;if(x===0)a.text&&(e.out(a.text),e.emit?.({type:"agent_message",text:a.text})),A({type:"session_complete"}),s("headless_zero_op_chat_turn_complete",{chars:a.text?.length??0});else if(B<dt)B+=1,A({type:"user_message",message_id:`nochat-${t.session_id}-${B}`,text:"[auto-repair] chat ops are unavailable in this mode \u2014 commit through finalize_design, or finish if nothing remains."}),s("headless_chat_ops_nudge",{n:B,ops:x});else{h="the agent kept trying to hold a conversation in a non-interactive run",e.out("error: the agent kept trying to hold a conversation in a non-interactive run \u2014 session closed; re-run interactively, or retry"),s("headless_chat_ops_terminal",{ops:x}),l.kill();break}}else if(i.type===(c.terminalEventType??"proposal")){let a=await c.onProposalEvent(i[i.type]);if(g=a.proposal,a.error&&(h=a.error),a.receipt)e.emit?.(a.receipt.event),t.mode!=="interactive"?(K+=1,a.sessionComplete||K>=Me?(a.sessionComplete||(e.out(`warning: ${Me} commits without completion \u2014 closing the session (runaway guard)`),s("receipt_runaway_cap",{commits:K})),A({type:"session_complete"}),s("session_complete_sent",{commit_n:a.receipt.event.commit_n,runaway:!a.sessionComplete})):(A({type:"user_message",message_id:`receipt-${t.session_id}-${String(a.receipt.event.commit_n??0)}`,text:a.receipt.text}),s("receipt_sent",{commit_n:a.receipt.event.commit_n,chars:a.receipt.text.length}))):e.chat?.holdReceipt&&(e.chat.holdReceipt(a.receipt.text),s("receipt_held",{commit_n:a.receipt.event.commit_n}));else if(a.error&&t.mode!=="interactive"){e.out("error: saving the agent's work failed and can't be retried in this mode \u2014 session closed; re-run to retry"),e.emit?.({type:"warning",code:"SAVE_FAILED",message:"saving the agent's work failed and can't be retried in this mode \u2014 session closed; re-run to retry"}),s("headless_commit_error_terminal",{error:a.error}),l.kill();break}}else if(i.type==="error"){O=!0;let a=i;if(a.code==="PAIR_MISMATCH")throw new le(a.expected??"",a.actual??"");h=i.message,typeof a.code=="string"&&(p=a.code);let x=i.failed_proposal;x&&s("failed_proposal",x)}}}finally{l.kill(),Ne?.()}let Le=t.chat===!0&&t.mode==="interactive",oe=!!e.checkpoint&&!O&&!w&&!S&&!z&&h===null&&g===null&&!Le;return{proposal:g,error:h,...p!==void 0?{errorCode:p}:{},paused:S,highRisk:z,...F>0?{assumedDefaults:F}:{},...W!==void 0?{creditsTotal:W}:{},...oe?{crashed:oe}:{}}}function Te(t,e){let r=e.trim(),o=null;for(let n of t??[])if(n.ref===r){if(!n.consumed)return{kind:"unconsumed"};o={kind:"consumed",identity:n.consumed}}return o??{kind:"unauthorized"}}function $t(t,e,r){let o=e.trim(),n=[...t??[]];return n.find(s=>s.ref===o&&!s.consumed)||n.push({ref:o,entered_at:r.toISOString()}),n}function Ie(t,e,r){let o=e.trim(),n=[...t??[]],c=n.findIndex(s=>s.ref===o&&!s.consumed);return c<0||(n[c]={...n[c],consumed:r}),n}import{basename as H}from"path";function Ge(t,e,r,o,n){let c=e.mediaOf(o),s=0;if(c.format!=="image"){let u=L(t,e,o);u&&(s=u.toString("utf8").replace(/\n$/,"").split(`
|
|
8
|
+
`).length)}return{source_id:r,cid:o,total_lines:s,media_type:c.format,status:n}}function Lt(t){return async e=>{let r=Te(t.handle.state.ingest_registry,e.ref);if(r.kind==="unauthorized")return{ok:!1,error:{code:"INGEST_UNAUTHORIZED_REF",message:"that ref was not provided by the owner this session \u2014 only owner-provided refs may land"}};if(r.kind==="consumed"){let p=t.graphSlot?.current??I(t.contextDir);return{ok:!0,result:Ge(t.contextDir,p,r.identity.source_id,r.identity.cid,"unchanged")}}let o=[],n={out:p=>o.push(p),err:p=>o.push(p),confirm:async()=>!1,isTTY:!1},c;try{c=await pe([e.ref],{},n,t.cwd,t.remoteDeps)}catch(p){return{ok:!1,error:{code:"INGEST_FAILED",message:p instanceof Error?p.message:String(p)}}}if(c.code!==0||c.results.length===0)return{ok:!1,error:{code:"INGEST_FAILED",message:o.find(S=>S.startsWith("error:"))??o.at(-1)??"the landing failed"}};let s=c.results[0],u={source_id:s.source_id,cid:s.source_cid},f=Ie(t.handle.state.ingest_registry,e.ref,u),d=s.status==="versioned"&&t.schedule,l=t.schedule?[...t.handle.state.ingest_schedule??[],d?{source_id:s.source_id,cid:s.source_cid,status:"skipped",note:"new version of a known source \u2014 its changes await your review (reconcile), never a blind re-extraction"}:{source_id:s.source_id,cid:s.source_cid,status:"pending"}]:void 0;t.handle.save({ingest_registry:f,...l!==void 0?{ingest_schedule:l}:{}}),t.graphSlot&&(t.graphSlot.current=I(t.contextDir));let g=t.graphSlot?.current??I(t.contextDir),h=Ge(t.contextDir,g,s.source_id,s.source_cid,s.status==="unchanged"?"unchanged":"landed");return t.note(d?`landed ${s.source_id} (${H(e.ref)}) \u2014 ${h.total_lines} lines; a NEW VERSION of a known source \u2014 its changes await your review (the check-in offers it), not a blind re-extraction`:t.schedule?`landed ${s.source_id} (${H(e.ref)}) \u2014 ${h.total_lines} lines; scheduled for extraction in this run`:t.scheduleRefused?`landed ${s.source_id} (${H(e.ref)}) \u2014 ${h.total_lines} lines; ${t.scheduleRefused}`:`landed ${s.source_id} (${H(e.ref)}) \u2014 ${h.total_lines} lines; it guides this design only (not extracted \u2014 its own extraction pass adds its use-cases)`),{ok:!0,result:h}}}var ft={kind:"system",id:"distiller"};function Ut(t,e=r=>process.stderr.write(r+`
|
|
9
|
+
`)){try{let r=I(t),{watermark:o}=fe(t),n=he({contextDir:t,graph:r,watermark:o,by:ft});if(n.errors){let c=n.errors.map(s=>`${s.code}: ${s.detail}`).join("; ");return e(`warning: style-note distill skipped \u2014 ${c}`),{minted:0,error:c}}if(n.minted>0)try{ae(t)}catch{}return{minted:n.minted,error:null}}catch(r){let o=r instanceof Error?r.message:String(r);return e(`warning: style-note distill skipped \u2014 ${o}`),{minted:0,error:o}}}export{mt as a,$e as b,ut as c,Ce as d,Et as e,$t as f,Lt as g,Ut as h};
|
|
@@ -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-HYTBEPC2.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-YLCEU6I7.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)}
|