@testmuai/kane-cli 0.8.23 → 0.10.0-rc.1
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-VPD5G67Q.js +2 -0
- package/dist/ChromeProfilePicker-CRKQEFYD.js +2 -0
- package/dist/CliFeedbackPrompt-M7BMWLKK.js +2 -0
- package/dist/CliUploadProgress-OP7DXMC2.js +2 -0
- package/dist/ConfigView-XI74BCCH.js +2 -0
- package/dist/EvidenceViewOffer-HAAK6DS5.js +2 -0
- package/dist/FolderPicker-W5S6RFCP.js +2 -0
- package/dist/InfoBox-OWUEHV2D.js +2 -0
- package/dist/LinksBox-PNSESNCU.js +2 -0
- package/dist/ProfilesView-PYDZZHKO.js +2 -0
- package/dist/ProjectPicker-BGFCUGT5.js +2 -0
- package/dist/SaveSessionPrompt-SUJE54GS.js +2 -0
- package/dist/ScrollbackTap-4SPXGFMU.js +2 -0
- package/dist/SingleShotApp-4TDXZEUA.js +2 -0
- package/dist/SummaryBox-FALOODAQ.js +2 -0
- package/dist/TestMdRunView-4GPRWHEU.js +2 -0
- package/dist/TestrunEvidenceTable-OBVQJ6IO.js +2 -0
- package/dist/WhoamiView-6WXGRANY.js +2 -0
- package/dist/{agent-parse-2MLJOJTH.js → agent-parse-CAS45UKA.js} +1 -1
- package/dist/app-client-U2YYF65L.js +2 -0
- package/dist/app-download-RXVZB6MM.js +2 -0
- package/dist/assurance-job-C3TXZGLL.js +7 -0
- package/dist/auth-7Z54TMQQ.js +2 -0
- package/dist/{binary-MOJTQGUV.js → binary-DJCDMGPX.js} +1 -1
- package/dist/bind-XVO4CQYV.js +2 -0
- package/dist/bootstrap-TY5RANJ7.js +2 -0
- package/dist/bridge-T6QMYKED.js +2 -0
- package/dist/build-5ZN47FAT.js +2 -0
- package/dist/catalog-RRQF4TCA.js +2 -0
- package/dist/{changelog-2N6HKKKQ.js → changelog-GBEVIUFJ.js} +1 -1
- package/dist/chat-committer-ZCSRJEUB.js +2 -0
- package/dist/chat-controller-XINCDH6Z.js +2 -0
- package/dist/child-G2GCW73X.js +2 -0
- package/dist/chunk-22PIMG52.js +2 -0
- package/dist/chunk-252FWF2G.js +19 -0
- package/dist/{chunk-AT3RME5W.js → chunk-2IZRPMZN.js} +1 -1
- package/dist/chunk-2NFS4KE4.js +2 -0
- package/dist/{chunk-LHUW5QDT.js → chunk-2OOFURWD.js} +1 -1
- package/dist/chunk-2OSFI33O.js +97 -0
- package/dist/chunk-2S3W2JT3.js +5 -0
- package/dist/chunk-2SWSVJUP.js +12 -0
- package/dist/chunk-2TVPA3LL.js +2 -0
- package/dist/chunk-2XW33VOK.js +2 -0
- package/dist/chunk-33DWJV67.js +235 -0
- package/dist/chunk-34R7BNZ2.js +2 -0
- package/dist/chunk-35ECWCCK.js +2 -0
- package/dist/chunk-3BSYOCSW.js +3 -0
- package/dist/chunk-3G2LSTK5.js +2 -0
- package/dist/chunk-3GXN6VF6.js +2 -0
- package/dist/chunk-3JLEDSG5.js +4 -0
- package/dist/chunk-3QICDXY5.js +5 -0
- package/dist/chunk-3UVSAAES.js +10 -0
- package/dist/chunk-42PALMW2.js +4 -0
- package/dist/chunk-432ZOE42.js +21 -0
- package/dist/chunk-44B6THYK.js +2 -0
- package/dist/chunk-47WQBG5I.js +6 -0
- package/dist/{chunk-J2FJ62K4.js → chunk-4D5PC6QE.js} +1 -1
- package/dist/chunk-4I7YN6YY.js +3 -0
- package/dist/chunk-4IEQNX7F.js +2 -0
- package/dist/{chunk-SYJXTB4J.js → chunk-4LPX2OLV.js} +1 -1
- package/dist/chunk-4LTHDJ3D.js +2 -0
- package/dist/chunk-4QTH7VYE.js +2 -0
- package/dist/chunk-54XA5MZH.js +2 -0
- package/dist/chunk-57MDWTON.js +2 -0
- package/dist/{chunk-3C32LVLX.js → chunk-5BUIIFLC.js} +1 -1
- package/dist/chunk-5D7ENQTQ.js +2 -0
- package/dist/chunk-63EKRZKI.js +2 -0
- package/dist/{chunk-EHN5HTUD.js → chunk-65VANXOF.js} +51 -51
- package/dist/chunk-672CQECV.js +47 -0
- package/dist/chunk-6LIC2R22.js +3 -0
- package/dist/chunk-6NFOH4AC.js +4 -0
- package/dist/chunk-6NWT2TEJ.js +2 -0
- package/dist/chunk-6PIIUAZF.js +3 -0
- package/dist/{chunk-MBJHS653.js → chunk-6U7ID777.js} +1 -1
- package/dist/chunk-6UVIY56J.js +2 -0
- package/dist/chunk-72KYMWQ5.js +2 -0
- package/dist/chunk-72RC7JSA.js +21 -0
- package/dist/chunk-74W4AOT2.js +2 -0
- package/dist/chunk-77ZZQJLX.js +2 -0
- package/dist/chunk-7DFBOVUB.js +2 -0
- package/dist/chunk-7EXDYXXD.js +2 -0
- package/dist/chunk-7HO4NX5W.js +1 -0
- package/dist/chunk-7KX2BHKG.js +2 -0
- package/dist/chunk-7LKCWO2R.js +11 -0
- package/dist/{chunk-ULGZPRKU.js → chunk-7NCJMWFX.js} +1 -1
- package/dist/chunk-7RPKHKA3.js +2 -0
- package/dist/chunk-7RWP4Y3H.js +2 -0
- package/dist/chunk-7V4BQSSV.js +2 -0
- package/dist/chunk-7XBNMOH4.js +6 -0
- package/dist/chunk-A6TJOZ24.js +2 -0
- package/dist/chunk-A7RJQJNT.js +2 -0
- package/dist/chunk-AA674WLL.js +2 -0
- package/dist/chunk-AIXJYMSP.js +9 -0
- package/dist/chunk-AJQZ3ST5.js +8 -0
- package/dist/chunk-AQ2OG2EF.js +2 -0
- package/dist/chunk-AUJSC7PU.js +4 -0
- package/dist/chunk-AVI5H4UM.js +13 -0
- package/dist/chunk-AZLNLHUA.js +4 -0
- package/dist/chunk-B2HXPGIZ.js +26 -0
- package/dist/chunk-B7ZX5HEN.js +8 -0
- package/dist/{chunk-XQQHSC7G.js → chunk-BJJUKB5K.js} +1 -1
- package/dist/{chunk-66MOZKD2.js → chunk-BSRSXYDZ.js} +1 -1
- package/dist/{chunk-TONFENRW.js → chunk-BVO4C5F2.js} +1 -1
- package/dist/chunk-BWXLZS5O.js +2 -0
- package/dist/chunk-BY65QAAN.js +4 -0
- package/dist/chunk-BZVNI44O.js +6 -0
- package/dist/chunk-C5Z7MQE6.js +2 -0
- package/dist/chunk-C6HI6Y3S.js +2 -0
- package/dist/chunk-CB4ARIHR.js +2 -0
- package/dist/chunk-CPBBYNL7.js +4 -0
- package/dist/{chunk-GFNCGN5V.js → chunk-D4FFXCX6.js} +2 -2
- package/dist/chunk-D756UWY2.js +6 -0
- package/dist/chunk-DBMW3VUN.js +4 -0
- package/dist/chunk-DD5TULWQ.js +34 -0
- package/dist/{chunk-SY4T44VC.js → chunk-DDJNYQBH.js} +1 -1
- package/dist/{chunk-KJIDMW6N.js → chunk-DHQ4SQWA.js} +1 -1
- package/dist/chunk-DNGOT65K.js +3 -0
- package/dist/chunk-DPGOAFKF.js +2 -0
- package/dist/chunk-DREQ3RAA.js +2 -0
- package/dist/chunk-DTUPEKEO.js +2 -0
- package/dist/chunk-E6KSRQXL.js +8 -0
- package/dist/chunk-EF47KRUK.js +2 -0
- package/dist/chunk-ENL4XTQ2.js +2 -0
- package/dist/chunk-EXFDIVNI.js +9 -0
- package/dist/chunk-EZN7CF45.js +4 -0
- package/dist/chunk-F3U6T4YD.js +22 -0
- package/dist/{chunk-DHJSM5DT.js → chunk-FCD3NYOM.js} +1 -1
- package/dist/chunk-FFL55I2M.js +2 -0
- package/dist/chunk-FIP5L6LV.js +9 -0
- package/dist/chunk-FOJHSG5M.js +6 -0
- package/dist/chunk-FSYOTRMC.js +2 -0
- package/dist/chunk-GFLB2SHW.js +2 -0
- package/dist/chunk-GMTHZUZ3.js +2 -0
- package/dist/chunk-GRURFGBP.js +2 -0
- package/dist/chunk-GZFLJORM.js +2 -0
- package/dist/{chunk-PXHN7SFG.js → chunk-H3HHSTEK.js} +4 -4
- package/dist/chunk-HAW5WEKT.js +13 -0
- package/dist/chunk-HFJSP4KD.js +2 -0
- package/dist/chunk-HHW6MRU3.js +6 -0
- package/dist/chunk-HIUAUZNL.js +2 -0
- package/dist/chunk-HJLMH7ZM.js +2 -0
- package/dist/{chunk-5GUD3CIH.js → chunk-HQ2E2XCU.js} +1 -1
- package/dist/chunk-I2KOGINW.js +7 -0
- package/dist/chunk-I2MC6VVX.js +2 -0
- package/dist/chunk-I5NSJBOZ.js +2 -0
- package/dist/chunk-I6OQISK4.js +2 -0
- package/dist/chunk-IBBD36FQ.js +2 -0
- package/dist/chunk-IINZZ4BZ.js +2 -0
- package/dist/{chunk-UYI4WPNQ.js → chunk-IMDMRJQ6.js} +2 -2
- package/dist/chunk-IXW7FOGX.js +2 -0
- package/dist/chunk-IZ65ZPWY.js +3 -0
- package/dist/chunk-JD52IXON.js +9 -0
- package/dist/chunk-JGRXMTME.js +15 -0
- package/dist/{chunk-NBXYL2JT.js → chunk-JIRNI5TB.js} +7 -7
- package/dist/chunk-JNSWKGTB.js +2 -0
- package/dist/chunk-JPYW6U4D.js +2 -0
- package/dist/chunk-JQSLUGD4.js +3 -0
- package/dist/chunk-K45BKGB5.js +8 -0
- package/dist/chunk-KF4DKXSS.js +2 -0
- package/dist/chunk-KGNE5CIM.js +2 -0
- package/dist/chunk-KM3YCIDV.js +3 -0
- package/dist/chunk-KU3YHPWZ.js +2 -0
- package/dist/chunk-L4UVUFL6.js +3 -0
- package/dist/chunk-LCSJ7GOG.js +2 -0
- package/dist/chunk-LKQFG4RW.js +5 -0
- package/dist/chunk-LNNWCBPQ.js +2 -0
- package/dist/chunk-LRS5MGBY.js +3 -0
- package/dist/chunk-LRXBJTD4.js +4 -0
- package/dist/chunk-LSDJOVWW.js +6 -0
- package/dist/chunk-LWJRSUE2.js +2 -0
- package/dist/chunk-LX2I4JEH.js +2 -0
- package/dist/{chunk-K6VDRR3H.js → chunk-M6MBMRFR.js} +1 -1
- package/dist/chunk-MGNRNLBE.js +2 -0
- package/dist/chunk-MII3JOO3.js +4 -0
- package/dist/chunk-MNBGG4H3.js +16 -0
- package/dist/chunk-MYVKUJGS.js +2 -0
- package/dist/chunk-MYZHOBS4.js +2 -0
- package/dist/chunk-MZOIHUVX.js +27 -0
- package/dist/{chunk-OFRYEWZE.js → chunk-N3TCNZSX.js} +1 -1
- package/dist/chunk-NC7D7GOM.js +21 -0
- package/dist/{chunk-CLQP3DHT.js → chunk-NDEI7R4K.js} +1 -1
- package/dist/chunk-NFRA64NU.js +10 -0
- package/dist/chunk-NLZZLANH.js +4 -0
- package/dist/{chunk-5HOHXV2K.js → chunk-NQTYWHPB.js} +1 -1
- package/dist/chunk-NWBLYMH7.js +3 -0
- package/dist/chunk-NWD54VV5.js +2 -0
- package/dist/chunk-NXRF7FFS.js +2 -0
- package/dist/chunk-O3HHTKZ5.js +6 -0
- package/dist/{chunk-FPFS6OSR.js → chunk-OAKYUBD3.js} +1 -1
- package/dist/chunk-OEWYXCTA.js +7 -0
- package/dist/{chunk-BASTDR3M.js → chunk-OF7WPCTQ.js} +1 -1
- package/dist/chunk-OFSDB7B4.js +3 -0
- package/dist/chunk-OJ33Q6DU.js +2 -0
- package/dist/chunk-OQ5G773E.js +2 -0
- package/dist/chunk-OVNRRI4E.js +2 -0
- package/dist/{chunk-RAARDC2O.js → chunk-OZNBTSW5.js} +1 -1
- package/dist/chunk-P2ZQDQDB.js +2 -0
- package/dist/chunk-P7MSVLAH.js +6 -0
- package/dist/chunk-PUVMC4PX.js +26 -0
- package/dist/{chunk-SEEEGDVK.js → chunk-PZA3BSOE.js} +1 -1
- package/dist/chunk-Q3C6NDGI.js +2 -0
- package/dist/chunk-QCKA665H.js +2 -0
- package/dist/chunk-QDFY5GGO.js +5 -0
- package/dist/chunk-QHRUBG7J.js +2 -0
- package/dist/chunk-QI5RZ7LL.js +2 -0
- package/dist/chunk-QNLVC5ZB.js +2 -0
- package/dist/{chunk-DSKJ6J7Y.js → chunk-QQ4TKLWP.js} +1 -1
- package/dist/chunk-QS5ZJFGF.js +4 -0
- package/dist/chunk-QTZBVDPR.js +12 -0
- package/dist/chunk-QXQ7KVEN.js +2 -0
- package/dist/chunk-R4JUKTDO.js +2 -0
- package/dist/chunk-R7KXAISS.js +12 -0
- package/dist/chunk-RDP7GWSY.js +2 -0
- package/dist/chunk-REKHAN53.js +5 -0
- package/dist/{chunk-5RHR4DMF.js → chunk-RFEON5GN.js} +1 -1
- package/dist/chunk-RFIIM33J.js +2 -0
- package/dist/chunk-RG372DON.js +6 -0
- package/dist/chunk-RPRXRKKR.js +2 -0
- package/dist/chunk-RTVWQK7I.js +2 -0
- package/dist/chunk-RW3Z2HMB.js +7 -0
- package/dist/chunk-RX47NRSM.js +2 -0
- package/dist/chunk-RX6776AI.js +5 -0
- package/dist/chunk-S53AQU7R.js +6 -0
- package/dist/{chunk-HJX5PQRD.js → chunk-SA6IKFFD.js} +1 -1
- package/dist/{chunk-2MEQTHNI.js → chunk-SLKYD44Y.js} +1 -1
- package/dist/chunk-SMTBOSEJ.js +2 -0
- package/dist/chunk-SMXABALN.js +2 -0
- package/dist/chunk-SONMD3W5.js +5 -0
- package/dist/chunk-SWMTXMKB.js +2 -0
- package/dist/chunk-SXRHKXSE.js +2 -0
- package/dist/chunk-T3HEJASG.js +5 -0
- package/dist/chunk-T4AVLJCW.js +6 -0
- package/dist/{chunk-J6TBTWW7.js → chunk-T6K2MEWP.js} +1 -1
- package/dist/{chunk-D6BULK7E.js → chunk-T7H4LBFK.js} +1 -1
- package/dist/chunk-TNORODUF.js +2 -0
- package/dist/chunk-TW63WWEN.js +2 -0
- package/dist/chunk-UALJTPSA.js +18 -0
- package/dist/chunk-UAWWLLTI.js +2 -0
- package/dist/chunk-UEE3RZN4.js +14 -0
- package/dist/chunk-UTM7D4PI.js +2 -0
- package/dist/chunk-UUJIGOEO.js +2 -0
- package/dist/chunk-UYDHOHSZ.js +2 -0
- package/dist/chunk-V5JGXOV7.js +2 -0
- package/dist/chunk-V7S6S5W3.js +2 -0
- package/dist/{chunk-HBSYBL6J.js → chunk-VG44B5JD.js} +1 -1
- package/dist/chunk-VJGWVBZR.js +1 -0
- package/dist/chunk-VLDCHFXF.js +2 -0
- package/dist/chunk-VO66KP2W.js +2 -0
- package/dist/{chunk-D4XR7EEQ.js → chunk-VQLH63X7.js} +14 -12
- package/dist/chunk-VRIZDOO5.js +2 -0
- package/dist/chunk-VYHT2IET.js +1397 -0
- package/dist/chunk-VZJ6LUXX.js +2 -0
- package/dist/chunk-W3OVSDBN.js +29 -0
- package/dist/chunk-W7FLXW6Q.js +5 -0
- package/dist/{chunk-IEW7AW64.js → chunk-WEM3MOAL.js} +1 -1
- package/dist/chunk-WI7K6VKQ.js +2 -0
- package/dist/chunk-WMGKUERB.js +6 -0
- package/dist/{chunk-DFS4RMVP.js → chunk-WN5VKKJ3.js} +1 -1
- package/dist/chunk-WOSANGV6.js +5 -0
- package/dist/chunk-WYSZ6TPW.js +15 -0
- package/dist/chunk-XB6BJPDL.js +2 -0
- package/dist/{chunk-5ESGUPSR.js → chunk-XBEYWXPV.js} +1 -1
- package/dist/chunk-XIPKSXRQ.js +16 -0
- package/dist/chunk-XJ7HCXKW.js +2 -0
- package/dist/chunk-XMPTFXPW.js +5 -0
- package/dist/chunk-XZYA7DNH.js +2 -0
- package/dist/chunk-Y4T4SLDO.js +2 -0
- package/dist/chunk-Y6Y6RAY4.js +2 -0
- package/dist/chunk-YDPTSDIJ.js +2 -0
- package/dist/chunk-YDSGXB25.js +2 -0
- package/dist/chunk-YIKF4ERQ.js +375 -0
- package/dist/chunk-Z55KBMYV.js +2 -0
- package/dist/chunk-ZCRZFAOT.js +2 -0
- package/dist/chunk-ZFM77AQU.js +2 -0
- package/dist/{chunk-Q6F23V7L.js → chunk-ZFMRQ57Y.js} +1 -1
- package/dist/chunk-ZHWU6L2G.js +5 -0
- package/dist/chunk-ZTHYAHDN.js +17 -0
- package/dist/chunk-ZZP5SHUV.js +3 -0
- package/dist/committer-JGY66PFM.js +2 -0
- package/dist/config-5ZOALGKE.js +2 -0
- package/dist/controller-client-PB3AZAGG.js +2 -0
- package/dist/cover-cmd-UA2SVIZZ.js +2 -0
- package/dist/{credentials-PSQWWFGD.js → credentials-MRG452Y6.js} +1 -1
- package/dist/{deps-bundle-PPOQHJTB.js → deps-bundle-FWINW4XM.js} +1 -1
- package/dist/{deps-resolve-AX6ZAKLH.js → deps-resolve-IET4KIBO.js} +1 -1
- package/dist/descriptor-7T32VRMB.js +2 -0
- package/dist/design-chat-MM5PJD2N.js +2 -0
- package/dist/design-committer-TRYP3LOZ.js +2 -0
- package/dist/design-headless-FZONCKHW.js +2 -0
- package/dist/design-remote-SPVRIY2H.js +3 -0
- package/dist/device-env-LXJ65AVF.js +2 -0
- package/dist/dispatch-DVQ3H7EJ.js +2 -0
- package/dist/doctor-VAX2BWQF.js +2 -0
- package/dist/docx-convert-6IZO5P5K.js +2 -0
- package/dist/{dossier-7HVC6BNK.js → dossier-NROC2MCY.js} +1 -1
- package/dist/evidence-LVVK7ROT.js +2 -0
- package/dist/evidence-presentation-YYTIDCBS.js +2 -0
- package/dist/evolve-cmd-AGRKG7T3.js +2 -0
- package/dist/evolve-remote-BGHULJTL.js +2 -0
- package/dist/{exit-manager-ZLDO54S4.js → exit-manager-EDHCETUN.js} +1 -1
- package/dist/explain-DGJ5T6V5.js +2 -0
- package/dist/explain-cmd-VYAANFFZ.js +4 -0
- package/dist/explain-cmd-WOBGS6KX.js +12 -0
- package/dist/explore-LOKNOVNP.js +2 -0
- package/dist/explore-context-tty-JTZVZFOE.js +2 -0
- package/dist/explore-entry-5OGNLFAU.js +6 -0
- package/dist/explore-live-2XZHUYFS.js +5 -0
- package/dist/explore-run-tty-LGTIK2NA.js +5 -0
- package/dist/extract-bind-NM2BBK4I.js +14 -0
- package/dist/extract-chat-HLQMJJIC.js +2 -0
- package/dist/extract-cmd-T2TSAC3N.js +6 -0
- package/dist/extract-headless-OQTQ3FJK.js +2 -0
- package/dist/feeder-NY45UFJK.js +2 -0
- package/dist/folder-flags-WXUR6OPJ.js +2 -0
- package/dist/gaps-cmd-PTSKPTF7.js +3 -0
- package/dist/gate-P57VP4E5.js +2 -0
- package/dist/gate-WISOUTHQ.js +2 -0
- package/dist/{generate-headless-TEDHS3F2.js → generate-headless-JYZP6VXZ.js} +3 -3
- package/dist/headless-io-FFM5T6KL.js +2 -0
- package/dist/hold-passthrough-IOWPVB4W.js +2 -0
- package/dist/identity-HL5CJJXR.js +2 -0
- package/dist/index.js +194 -175
- package/dist/ingest-PDGS5ZTL.js +2 -0
- package/dist/ingest-cmd-LHCBMO4Z.js +8 -0
- package/dist/ingest-remote-D5TO5JQP.js +2 -0
- package/dist/ink-screen-RZ7QDIUI.js +2 -0
- package/dist/install-Z6K2D2VY.js +2 -0
- package/dist/interactive-bind-5EJQUGKI.js +26 -0
- package/dist/interactive-remote-D77ULJGL.js +65 -0
- package/dist/interrupt-guard-QETBPINI.js +2 -0
- package/dist/lane-AQYRIW24.js +2 -0
- package/dist/lattice-auth-74XGF77Y.js +2 -0
- package/dist/lifecycle-cmd-7SM6UCMH.js +2 -0
- package/dist/list-cmd-Z6FZXMFU.js +3 -0
- package/dist/list-commands-CZYZ7GIG.js +2 -0
- package/dist/list-remote-WOPOC6KK.js +15 -0
- package/dist/locks-cmd-JJ2QNTNY.js +2 -0
- package/dist/logical-ids-RXAQJZ3T.js +2 -0
- package/dist/login-flow-2FZEOVHM.js +2 -0
- package/dist/maintenance-cmd-VRTGZVRE.js +2 -0
- package/dist/mobile-prompts-KNAHU64X.js +2 -0
- package/dist/{next-KZXH4UA4.js → next-O6SUSX3R.js} +1 -1
- package/dist/{objective-variable-gate-JALOH6SL.js → objective-variable-gate-3Z7DNVVC.js} +1 -1
- package/dist/onboarding-LGT6PMDZ.js +5 -0
- package/dist/open-provider-OZAG6WZS.js +2 -0
- package/dist/{paths-JCYX6UWL.js → paths-UMIX3RJF.js} +1 -1
- package/dist/pdf-convert-447ACUB3.js +2 -0
- package/dist/persist-recorded-session-BX7II5P7.js +3 -0
- package/dist/phase-seed-LCJ4WSYV.js +2 -0
- package/dist/pipeline-IXVTVRS5.js +2 -0
- package/dist/prepare-target-ULMKVKMC.js +2 -0
- package/dist/pull-cmd-6AL2WYHB.js +2 -0
- package/dist/pull-route-TTVARJMV.js +2 -0
- package/dist/readmodel-INMP6MNW.js +2 -0
- package/dist/real-device-run-2LFS5WE2.js +2 -0
- package/dist/reconcile-cmd-R6H37SQR.js +5 -0
- package/dist/reconcile-deps-TWJ3FTSU.js +2 -0
- package/dist/reconcile-remote-GWDV5CUT.js +13 -0
- package/dist/recording-banner-ACC67Q2U.js +2 -0
- package/dist/registry-6IJYQXQC.js +2 -0
- package/dist/remote-entry-YL7O2NJQ.js +2 -0
- package/dist/remote-mode-7G6PLJCW.js +4 -0
- package/dist/remote-words-45USLRVN.js +2 -0
- package/dist/require-project-folder-A3UDRELU.js +2 -0
- package/dist/resolve-run-intent-ZGPSUBXV.js +2 -0
- package/dist/resolver-IPM6R7U4.js +2 -0
- package/dist/revert-FHOBLZWF.js +2 -0
- package/dist/review-cmd-NNT5C5RZ.js +5 -0
- package/dist/run-5RQUCNYP.js +2 -0
- package/dist/run-PC5YO4AS.js +2 -0
- package/dist/run-channel-63SVP5OI.js +2 -0
- package/dist/run-remote-3AYYVPKX.js +2 -0
- package/dist/run-startup-gate-NKRMKYBB.js +2 -0
- package/dist/run-test-md-HE6DUWQR.js +17 -0
- package/dist/scrollback-GGNBDFQV.js +2 -0
- package/dist/session-target-DD53UXO7.js +2 -0
- package/dist/session-worker.js +12 -0
- package/dist/sessions-CFV7FOIT.js +2 -0
- package/dist/sessions-cmd-GYMETJHG.js +26 -0
- package/dist/sessions-remote-GI7GOBMH.js +3 -0
- package/dist/shell-arg-FN3MT5U7.js +2 -0
- package/dist/{skill-installer-T2IOCPET.js → skill-installer-3QAVQGDH.js} +1 -1
- package/dist/spawner-C7NLLM4F.js +2 -0
- package/dist/store-X6XPFSKF.js +2 -0
- package/dist/store-choice-RT73HAI7.js +2 -0
- package/dist/store-guard-SNWKLHQV.js +2 -0
- package/dist/store-id-YZ5WKJ25.js +2 -0
- package/dist/store-site-KA2DNBGY.js +2 -0
- package/dist/stream-warnings-GEQKKJU7.js +2 -0
- package/dist/structured-answers-EQ2AP3F7.js +2 -0
- package/dist/sync-cmd-NBPPDG3B.js +2 -0
- package/dist/sync-setup-5NUCH6N3.js +2 -0
- package/dist/{sync-setup-ui-RC727VK6.js → sync-setup-ui-XITPGSO4.js} +2 -2
- package/dist/tcg-generate-Z23CUISY.js +2 -0
- package/dist/test-definition-VRI4YIYL.js +2 -0
- package/dist/testmd-actions-GH5BW5V5.js +2 -0
- package/dist/testmd-sync-ACKCIOL3.js +2 -0
- package/dist/tms-client-NXAB6VJD.js +2 -0
- package/dist/token-refresh-4UCYAG6A.js +2 -0
- package/dist/trust-gate-AT2XBWN4.js +2 -0
- package/dist/turn-preflight-LHYLRL7G.js +2 -0
- package/dist/ui-SNV3FD2G.js +4 -0
- package/dist/use-case-ref-NE4X4MZN.js +2 -0
- package/dist/validate-basic-RE2WLIGQ.js +2 -0
- package/dist/{variable-receipt-F55CSW5Z.js → variable-receipt-BXSZO36E.js} +1 -1
- package/dist/verdicts-XK3GAUX3.js +2 -0
- package/dist/version-check-4FJVZP3K.js +2 -0
- package/dist/{view-cmd-ELDKYRMZ.js → view-cmd-N47BQZPD.js} +4 -3
- package/dist/walk-session-DA7QWXSW.js +2 -0
- package/dist/with-telemetry-7V4LY2BG.js +2 -0
- package/package.json +11 -11
- package/dist/ChatSurface-GBZX4LWL.js +0 -8
- package/dist/ChromeProfilePicker-UONX2UVC.js +0 -2
- package/dist/CliFeedbackPrompt-6BJCNRNG.js +0 -2
- package/dist/CliUploadProgress-K4Z22DSY.js +0 -2
- package/dist/ConfigView-BB22G7JO.js +0 -2
- package/dist/EvidenceViewOffer-25IQF3TX.js +0 -2
- package/dist/FolderPicker-65JFR2NW.js +0 -2
- package/dist/InfoBox-OU5PLRIL.js +0 -2
- package/dist/LinksBox-DH7TSUXW.js +0 -2
- package/dist/ProfilesView-MGJKBOF5.js +0 -2
- package/dist/ProjectPicker-YFV6K77F.js +0 -2
- package/dist/SaveSessionPrompt-64QKQB6B.js +0 -2
- package/dist/ScrollbackTap-QHJOFYMC.js +0 -2
- package/dist/SingleShotApp-VYKUCRVW.js +0 -2
- package/dist/SummaryBox-DGS3LVRF.js +0 -2
- package/dist/TestMdRunView-LKAITAA4.js +0 -2
- package/dist/TestrunEvidenceTable-PHBAB4XQ.js +0 -2
- package/dist/WhoamiView-6HWPYN6Y.js +0 -2
- package/dist/app-client-ZCCNE3RV.js +0 -2
- package/dist/app-download-SQ2LYYL7.js +0 -2
- package/dist/auth-NWBIFCB7.js +0 -2
- package/dist/bind-S3IQTPNN.js +0 -15
- package/dist/bootstrap-RCV7PNMQ.js +0 -2
- package/dist/bridge-O7ENTV4K.js +0 -2
- package/dist/build-JIKYOZUH.js +0 -2
- package/dist/chat-committer-6D7AQI6Z.js +0 -2
- package/dist/chat-controller-UJQ6Z4RE.js +0 -2
- package/dist/chunk-2A7OQRAD.js +0 -17
- package/dist/chunk-2FH4HJYB.js +0 -5
- package/dist/chunk-2KVECC36.js +0 -2
- package/dist/chunk-2YEHV2CX.js +0 -2
- package/dist/chunk-3OKX64UR.js +0 -2
- package/dist/chunk-3UI5VTQS.js +0 -4
- package/dist/chunk-3UMVRJX3.js +0 -6
- package/dist/chunk-3VAU3PNU.js +0 -2
- package/dist/chunk-5EOX4MEY.js +0 -2
- package/dist/chunk-5LJRZI7S.js +0 -6
- package/dist/chunk-5UHY3PTQ.js +0 -3
- package/dist/chunk-5ZFOKYFB.js +0 -5
- package/dist/chunk-63DYVWNX.js +0 -2
- package/dist/chunk-6YZ3VP3E.js +0 -2
- package/dist/chunk-7KRY26OF.js +0 -4
- package/dist/chunk-7N6OCHPC.js +0 -7
- package/dist/chunk-A2SQD2AY.js +0 -4
- package/dist/chunk-AACQE24F.js +0 -2
- package/dist/chunk-AGDPEZXT.js +0 -4
- package/dist/chunk-AIK7BAME.js +0 -8
- package/dist/chunk-ATYXPCM6.js +0 -6
- package/dist/chunk-AXTPNZPX.js +0 -2
- package/dist/chunk-BB2W35TW.js +0 -2
- package/dist/chunk-BKM2LWU2.js +0 -3
- package/dist/chunk-BL5QHONU.js +0 -2
- package/dist/chunk-C44QQJR4.js +0 -239
- package/dist/chunk-C7NWWGLT.js +0 -6
- package/dist/chunk-CAJZQQ3G.js +0 -3
- package/dist/chunk-CSVPZ33X.js +0 -2
- package/dist/chunk-CXF6AZWY.js +0 -2
- package/dist/chunk-D6E6KRVX.js +0 -2
- package/dist/chunk-D7WG7SRA.js +0 -2
- package/dist/chunk-DDHGEJJP.js +0 -2
- package/dist/chunk-DUYRCVI5.js +0 -2
- package/dist/chunk-DWHF5HUD.js +0 -2
- package/dist/chunk-EM3PU2YW.js +0 -2
- package/dist/chunk-EVFFDODK.js +0 -5
- package/dist/chunk-EYOCNMUM.js +0 -2
- package/dist/chunk-F2OBORCG.js +0 -2
- package/dist/chunk-FMBPUXWL.js +0 -8
- package/dist/chunk-FORNRNHU.js +0 -2
- package/dist/chunk-FQJOWUEN.js +0 -2
- package/dist/chunk-FQNQVC5O.js +0 -5
- package/dist/chunk-FY7TCYPK.js +0 -6
- package/dist/chunk-HJGVM6TS.js +0 -370
- package/dist/chunk-HPHETGRE.js +0 -2
- package/dist/chunk-I7TIGB7K.js +0 -2
- package/dist/chunk-IGHK2ENL.js +0 -2
- package/dist/chunk-IICT4VOU.js +0 -2
- package/dist/chunk-IIDBLJ5A.js +0 -18
- package/dist/chunk-JFZA4UON.js +0 -9
- package/dist/chunk-K2UJYY2U.js +0 -2
- package/dist/chunk-KBM3XHAM.js +0 -2
- package/dist/chunk-KDNNMU7Q.js +0 -4
- package/dist/chunk-KJQNAOOE.js +0 -6
- package/dist/chunk-LF42V6P6.js +0 -7
- package/dist/chunk-LNFU4JZ7.js +0 -2
- package/dist/chunk-LNSBC32V.js +0 -2
- package/dist/chunk-LSDWPG6C.js +0 -2
- package/dist/chunk-MKMJOMLX.js +0 -8
- package/dist/chunk-MKQ7ZRDW.js +0 -2
- package/dist/chunk-MSGW4JDG.js +0 -2
- package/dist/chunk-MV3Q335C.js +0 -7
- package/dist/chunk-MWIE6LOZ.js +0 -4
- package/dist/chunk-MZ7W4WLF.js +0 -4
- package/dist/chunk-NIFJJX6N.js +0 -12
- package/dist/chunk-NJ4BXZBX.js +0 -2
- package/dist/chunk-NLCCBXXV.js +0 -2
- package/dist/chunk-ODU2JSMA.js +0 -8
- package/dist/chunk-OYKRCDT4.js +0 -15
- package/dist/chunk-Q2F5QB2W.js +0 -2
- package/dist/chunk-Q4YYAN6E.js +0 -2
- package/dist/chunk-Q6AHSGOE.js +0 -5
- package/dist/chunk-QAG67DUT.js +0 -2
- package/dist/chunk-QGXVQIN5.js +0 -27
- package/dist/chunk-QQCEP3QP.js +0 -2
- package/dist/chunk-QU7P7B3W.js +0 -4
- package/dist/chunk-RAPV3BTA.js +0 -98
- package/dist/chunk-RD72POF2.js +0 -2
- package/dist/chunk-RDHWNSDP.js +0 -7
- package/dist/chunk-RGRFL7XG.js +0 -29
- package/dist/chunk-RKXHVP2Z.js +0 -2
- package/dist/chunk-RMVASIVL.js +0 -35
- package/dist/chunk-RRY5IXOB.js +0 -2
- package/dist/chunk-RSSOJ3L2.js +0 -21
- package/dist/chunk-SB2SKN34.js +0 -2
- package/dist/chunk-SFFDVF3J.js +0 -9
- package/dist/chunk-T2ONUKTL.js +0 -5
- package/dist/chunk-TAOHYWEO.js +0 -2
- package/dist/chunk-U6OTFMIT.js +0 -4
- package/dist/chunk-UD7KKHPW.js +0 -5
- package/dist/chunk-UF4MU2AZ.js +0 -22
- package/dist/chunk-UQSVO7TY.js +0 -9
- package/dist/chunk-URWWROLS.js +0 -9
- package/dist/chunk-V4B5QA3U.js +0 -4
- package/dist/chunk-VACHFCNC.js +0 -21
- package/dist/chunk-VAN7ECN6.js +0 -2
- package/dist/chunk-VIO7CCFW.js +0 -5
- package/dist/chunk-VOYMN2WQ.js +0 -5
- package/dist/chunk-VVOKM2VO.js +0 -2
- package/dist/chunk-W5TTF7GB.js +0 -6
- package/dist/chunk-WESMQEPO.js +0 -2
- package/dist/chunk-WICJY6KL.js +0 -6
- package/dist/chunk-WJR2FU7S.js +0 -16
- package/dist/chunk-WVHMPIDQ.js +0 -2
- package/dist/chunk-X4NUVVCJ.js +0 -26
- package/dist/chunk-XLSOQLVT.js +0 -2
- package/dist/chunk-YCCUBQY4.js +0 -2
- package/dist/chunk-YFQGOOF7.js +0 -2
- package/dist/chunk-YI3H2UIB.js +0 -2
- package/dist/chunk-YKTYVJBN.js +0 -3
- package/dist/chunk-YLQHY4A7.js +0 -2
- package/dist/chunk-ZIHG6EKH.js +0 -2
- package/dist/chunk-ZKSN2SJ7.js +0 -2
- package/dist/chunk-ZLWURCJ7.js +0 -2
- package/dist/committer-2QPBANRD.js +0 -2
- package/dist/config-7E4NS553.js +0 -2
- package/dist/controller-client-ZF5IXRUV.js +0 -2
- package/dist/cover-cmd-6KZX46S2.js +0 -3
- package/dist/descriptor-3JJUOHBM.js +0 -2
- package/dist/design-committer-D44GSUXY.js +0 -2
- package/dist/device-env-TZQDB5T3.js +0 -2
- package/dist/dispatch-KMWEDMKE.js +0 -2
- package/dist/doctor-XDF3MA4W.js +0 -2
- package/dist/docx-convert-SQRTF7XS.js +0 -2
- package/dist/evidence-EUIDOVOR.js +0 -2
- package/dist/evidence-presentation-XF23B7F2.js +0 -2
- package/dist/evolve-cmd-QVTGTCJ5.js +0 -2
- package/dist/explain-NEFBUX5G.js +0 -2
- package/dist/explain-cmd-36SVSHU7.js +0 -9
- package/dist/explain-cmd-JAOHSI4F.js +0 -3
- package/dist/extract-bind-PLMSZKLZ.js +0 -14
- package/dist/extract-cmd-RJBHPPF3.js +0 -5
- package/dist/feeder-66TUPB2R.js +0 -2
- package/dist/gaps-cmd-3WZPDDYS.js +0 -3
- package/dist/gate-OYRDJMF6.js +0 -2
- package/dist/headless-io-75HUMWZB.js +0 -2
- package/dist/identity-ADZ4PAJF.js +0 -2
- package/dist/ingest-OSNNM3DH.js +0 -2
- package/dist/ingest-cmd-JDIOPJBN.js +0 -2
- package/dist/install-Y3VKFBK3.js +0 -2
- package/dist/interactive-bind-XUMKEGAN.js +0 -26
- package/dist/interrupt-guard-UREUWNRL.js +0 -2
- package/dist/lifecycle-cmd-FBDRFIOE.js +0 -2
- package/dist/list-cmd-TFUACRAM.js +0 -3
- package/dist/list-commands-OHIQFJGQ.js +0 -2
- package/dist/locks-cmd-67OHQZNV.js +0 -2
- package/dist/logical-ids-GLVM2SVR.js +0 -2
- package/dist/login-flow-OHNKSVYZ.js +0 -2
- package/dist/maintenance-cmd-7OSUIDL4.js +0 -2
- package/dist/mobile-prompts-DEVUZRG3.js +0 -2
- package/dist/open-provider-746LLSEO.js +0 -2
- package/dist/pdf-convert-RLXSXFWN.js +0 -2
- package/dist/persist-recorded-session-GPP6UKN6.js +0 -3
- package/dist/phase-seed-MKHEWUN6.js +0 -2
- package/dist/pipeline-QPTPZVUJ.js +0 -2
- package/dist/prepare-target-N7QRNYOS.js +0 -2
- package/dist/readmodel-FVLRQWZ7.js +0 -2
- package/dist/reconcile-cmd-SMGLHMLF.js +0 -2
- package/dist/reconcile-deps-DVIJK5UZ.js +0 -4
- package/dist/reconcile-engine-KL2J5SNQ.js +0 -2
- package/dist/recording-banner-TCFFB6KE.js +0 -2
- package/dist/records-LMCVKPE5.js +0 -2
- package/dist/registry-BFFA4YJK.js +0 -2
- package/dist/require-project-folder-2224ZMJ5.js +0 -2
- package/dist/resolve-run-intent-HFXGEOYK.js +0 -2
- package/dist/resolver-GJR2Z7JY.js +0 -2
- package/dist/revert-NOUECRW4.js +0 -2
- package/dist/review-cmd-CQE6SBZA.js +0 -5
- package/dist/run-BXKWDJFJ.js +0 -2
- package/dist/run-HSP2MZPU.js +0 -2
- package/dist/run-channel-RGH4WIQX.js +0 -2
- package/dist/run-test-md-2ELPAASM.js +0 -17
- package/dist/scrollback-JLPJR25X.js +0 -2
- package/dist/session-items-2ATN7VXG.js +0 -2
- package/dist/session-target-UWROGOCY.js +0 -2
- package/dist/sessions-NH7WQWMX.js +0 -2
- package/dist/sessions-cmd-IV25N2L7.js +0 -25
- package/dist/spawner-HQM2757J.js +0 -2
- package/dist/store-guard-NAW26EEQ.js +0 -2
- package/dist/store-id-EOSGEKVK.js +0 -2
- package/dist/structured-answers-ZI2B6JJE.js +0 -2
- package/dist/sync-cmd-Q6ZYEVWI.js +0 -2
- package/dist/sync-setup-CA362C5S.js +0 -2
- package/dist/tcg-generate-CDB2N5LD.js +0 -2
- package/dist/testmd-actions-BDWDE2TG.js +0 -2
- package/dist/testmd-sync-EPTUVJYJ.js +0 -2
- package/dist/tms-client-KU6HCA23.js +0 -2
- package/dist/token-refresh-TKBOHXSD.js +0 -2
- package/dist/trust-gate-EX7R2P4Y.js +0 -2
- package/dist/turn-preflight-JGYT7LXP.js +0 -2
- package/dist/ui-JEJGTURD.js +0 -4
- package/dist/validate-basic-V7R4RH5M.js +0 -2
- package/dist/verdicts-7IUZFXB4.js +0 -2
- package/dist/version-check-PUUSB7AY.js +0 -2
- package/dist/walk-session-EGIMA4VG.js +0 -2
- package/dist/with-telemetry-LRWWBISP.js +0 -2
- /package/dist/{chunk-BKHXPBWN.js → chunk-2RUSXQ3O.js} +0 -0
- /package/dist/{chunk-6J5T5FEY.js → chunk-3AGP2BVN.js} +0 -0
- /package/dist/{chunk-CH273NAE.js → chunk-73Y6T2UK.js} +0 -0
- /package/dist/{chunk-ZMNJBUAO.js → chunk-73ZFOJOK.js} +0 -0
- /package/dist/{chunk-N2P4MI32.js → chunk-FWGUISUG.js} +0 -0
- /package/dist/{chunk-UJZZDPDY.js → chunk-HD6NR44L.js} +0 -0
- /package/dist/{chunk-LDPLJFCV.js → chunk-I6S6DZ2E.js} +0 -0
- /package/dist/{chunk-427OQS2N.js → chunk-LD5B3QFW.js} +0 -0
- /package/dist/{chunk-2UIHS2FH.js → chunk-PGESS7BW.js} +0 -0
- /package/dist/{chunk-BZAGVBCX.js → chunk-ZCIWQHCO.js} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as on,b as cn,c as an,d as he,f as dn,g as un,h as We,i as Ye,n as ln,o as pn,q as fn,r as Xe,s as gn}from"./chunk-DBMW3VUN.js";import{a as ce,f as se,g as R,h as Z,i as ae,j as de,k as rn,l as sn}from"./chunk-KU3YHPWZ.js";import{c as hn,d as mn,e as _n}from"./chunk-6NFOH4AC.js";import{a as Ce,b as Te}from"./chunk-7V4BQSSV.js";import{a as It}from"./chunk-7DFBOVUB.js";import{m as nn}from"./chunk-4I7YN6YY.js";import{closeSync as Jn,existsSync as Wn,mkdirSync as Yn,openSync as Xn,readFileSync as le,readdirSync as zn,renameSync as Pt,rmSync as Ut,writeFileSync as Qn}from"fs";import{dirname as cs,join as te}from"path";var $r=/^L([1-9]\d*)-L([1-9]\d*)$/,Rr=/^img#(p[1-9]\d*-[1-9]\d*|i[1-9]\d*)$/;function Ae(e){if(e==="img#whole")return{kind:"img-whole"};let t=Rr.exec(e);if(t)return{kind:"img-part",ref:t[1]};let n=$r.exec(e);return n?{kind:"lines",a:parseInt(n[1],10),b:parseInt(n[2],10)}:null}function ee(e,t){return"sha256:"+Te(Buffer.from("assurance."+e+"\0"+Ce(rn(e,t)),"utf8"))}function B(e,t,n,r){return"sha256:"+Te(Buffer.from("assurance.edge\0"+Ce({type:e,src:t,dst:n,props:sn(e,r)}),"utf8"))}function Qs(e,t){return{source_id:e,blob:t}}function ze(e){return{...e,derived:!0}}var Ue=e=>e.slice(0,19),Or=(e,t,n)=>`the unit index of ${e} at version ${Ue(t)} (blob ${Ue(n)}) is not in this store's blob store, so the units of a citation into it cannot be worked out \u2014 nothing was written. Restore the store's blobs from a copy, or clone the shared location into a new folder (a clone fetches every blob; a pull does not fetch a blob of a record this store already holds). kane-cli context fsck names what is missing.`,kr=(e,t)=>`no unit was found for the citation ${t} of ${e} \u2014 this is a fault in kane, not in what you sent; nothing was written. Report it with this message.`,Nr=(e,t,n)=>`keeping ${e} would take over ${t} units of ${n}, the limit is ${he.reconfirms} \u2014 extract the item again from the current version instead of keeping it; nothing was written.`;function vn(e){let t=new Map;return n=>{let r=String(n.source_id),s=String(n.source_cid),a=e.mediaOf(s)?.plugin?.index;if(a===void 0)return{units:null};let u=t.get(a);if(u===void 0&&t.set(a,u=ln(e.getBlob(a))),u===null)return{fault:{code:"UNIT_INDEX_MISSING",detail:Or(r,s,a)}};let c=Ae(String(n.anchor)),o=c?.kind==="lines"?pn(u,Math.min(c.a,c.b),Math.max(c.a,c.b)):[];return o.length===0?{fault:{code:"UNIT_LIST_EMPTY",detail:kr(r,String(n.anchor))}}:{units:o}}}var yn=(e,t)=>Array.isArray(e)&&e.length===t.length&&e.every((n,r)=>n===t[r]),En=(e,t)=>({mediaOf:n=>t.mediaOf(n),getBlob:n=>e.getBlob(n),headOf:n=>t.heads.get(n),edgesInto:n=>t.edgesInto(n),refOf:n=>t.nameOf.get(n)??Ue(n)});function wn(e){let t=vn(e),n=We({pluginOf:s=>e.mediaOf(s)?.plugin}),r=(s,a,u)=>{let c=a.source_id,o=e.headOf(c);if(o==null||o!==a.source_cid)return{reconfirms:null};let h=n(c,o);if(h===null)return{reconfirms:null};let i=new Set,d=[...e.edgesInto(s),...u].filter(l=>l.type!==R.DERIVES||l.dst!==s||l.props.source_id!==c||i.has(l.ecid)?!1:(i.add(l.ecid),!0)),{failing:g}=dn([...d,{ecid:"",type:R.DERIVES,src:o,dst:s,props:a}],h);return g.length===0?{reconfirms:null}:g.length>he.reconfirms?{fault:{code:"RECONFIRMS_OVER_LIMIT",detail:Nr(e.refOf(s),g.length,c)}}:{reconfirms:g}};return{all(s){let a=[],u=s.map(c=>{if(c.type!==R.DERIVES)return c;let o=t(c.props);if("fault"in o)return a.push(o.fault),c;if(o.units===null){if(c.props.units===void 0)return c;let{units:h,...i}=c.props;return{...c,props:i}}return yn(c.props.units,o.units)?c:{...c,props:{...c.props,units:o.units}}});if(a.length>0)return{edges:u,faults:a};for(let c=0;c<u.length;c++){let o=u[c];if(o.type!==R.DERIVES||o.props.units===void 0||o.props.reconfirms!==void 0)continue;let h=r(o.dst,o.props,u.filter((i,d)=>d!==c));if("fault"in h)a.push(h.fault);else if(h.reconfirms!==null){let i={...o.props,reconfirms:h.reconfirms};u[c]={...o,ecid:B(o.type,o.src,o.dst,i),props:i}}}return{edges:u,faults:a}},one(s,a,u){let{units:c,reconfirms:o,...h}=a,i=a.units===void 0&&a.reconfirms===void 0,d=t(h);if("fault"in d)return d;if(d.units===null)return{props:i?a:h};let g={...h,units:d.units},l=r(s,g,u);return"fault"in l?l:{props:l.reconfirms===null?g:{...g,reconfirms:l.reconfirms}}}}}function oi(e,t){let n=vn(t);for(let r of e){if(r?.type!==R.DERIVES)continue;let s=Array.isArray(r.props.units)?r.props.units:null,a={ecid:r.ecid,sourceId:String(r.props.source_id),versionCid:String(r.props.source_cid),anchor:String(r.props.anchor),said:s},u=n(r.props);if("fault"in u)return u.fault.code==="UNIT_INDEX_MISSING"?{code:"UNIT_INDEX_MISSING",...a,found:null,index:t.mediaOf(a.versionCid)?.plugin?.index}:{code:"UNITS_MISMATCH",...a,found:[]};if(u.units===null?s!==null:!yn(s,u.units))return{code:"UNITS_MISMATCH",...a,found:u.units}}return null}var xr=new Set(["scenario","test"]);function Rt(e,t){let n=new Map(t.nodes.map(s=>[s.cid,s.label])),r=new Map;for(let[s,a]of Object.entries(t.media??{})){let u=t.source_head_moves?.[s];typeof u=="string"&&a&&r.set(u,a)}return{mediaOf:s=>r.get(s)??(Object.hasOwn(e.media,s)?e.media[s]:void 0),labelOf:s=>n.get(s)??(Object.hasOwn(e.nodeLabel,s)?e.nodeLabel[s]:void 0)}}var Ot=e=>`CITE_DEPTH_UNSUPPORTED: citation ${Ue(e.ecid)} lays ${e.sourceId} at version ${Ue(e.versionCid)} onto a ${e.label}, and the plugin that read that version does not allow citations below the use case (it was stored before its plugin declared cites-deep, or by a plugin that does not) \u2014 re-ingest the source, or cite it at the use case`;function kt(e,t){for(let n of e){if(n?.type!==R.DERIVES)continue;let r=t.labelOf(n.dst);if(r===void 0||!xr.has(r))continue;let s=t.mediaOf(n.src);if(!(s?.format!=="plugin"||s.plugin?.cites_deep===!0))return{ecid:n.ecid,sourceId:String(n.props.source_id),versionCid:n.src,label:r}}return null}var $t=class extends Error{code="CITE_DEPTH_UNSUPPORTED";constructor(t){super(t),this.name="CiteDepthRefused"}};function ci(e,t){let n=kt(t.edges,Rt(e,t));if(n!==null)throw new $t(`${Ot(n)}; nothing was written`)}import{existsSync as et,mkdirSync as Cr,readFileSync as xt,renameSync as Tr,rmSync as In,writeFileSync as Ar}from"fs";import{dirname as Lr,join as tt}from"path";var nt=e=>tt(e,"derived"),$n=e=>tt(nt(e),"index.json");function rt(e,t){let n=t.startsWith("sha256:")?t.slice(7):t;if(!/^[A-Za-z0-9_-]{2,}$/.test(n))throw new Error(`${t} is not a fingerprint: it cannot name a node file`);return tt(nt(e),"nodes",n.slice(0,2),n.slice(2)+".json")}function Pe(){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 st(e){let t=$n(e);if(!et(t))return null;try{let n=JSON.parse(xt(t,"utf8"));if(n.superseded===void 0||n.names===void 0||n.archivedReason===void 0||n.appliedEvents===void 0||n.conv===void 0||n.media===void 0||n.exec===void 0||n.completeness===void 0||n.srcOwner===void 0||n.design_phases===void 0||n.edgeRetractions===void 0||n.eventDigests===void 0)return null;let r=n.reverse;return r!==void 0&&r!==On?null:(delete n.reverse,n)}catch{return null}}function Rn(e,t){Cr(Lr(e),{recursive:!0});let n=`${e}.tmp-${process.pid}`;Ar(n,t),Tr(n,e)}function Ee(e,t,n,r,s={}){let a=s.writeNodeFiles!==!1,u=new Set(t.extracted),c=new Set(t.appliedEvents);n.forEach((o,h)=>{for(let i of o.nodes){if(a){if(e===null)throw new Error("node files need the store's directory");let d=rt(e,i.cid);et(d)||Rn(d,JSON.stringify({label:i.label,content:i.content})+`
|
|
3
|
+
`)}!(i.cid in t.trust)&&i.content.derived===!0&&(t.trust[i.cid]="derived"),t.nodeLabel[i.cid]=i.label}for(let[i,d]of Object.entries(o.source_head_moves))typeof d=="string"&&(t.srcOwner[d]=i);if(o.proposal_id!=null&&typeof o.extraction_of=="string"){u.add(o.extraction_of);let i=null;for(let d of o.edges)if(d.type===R.DERIVES&&d.props.source_cid===o.extraction_of&&typeof d.props.source_id=="string"){i=d.props.source_id;break}if(i??=t.srcOwner[o.extraction_of]??null,i!==null){let d=t.completeness[i];(!d||o.seq>=d.seq)&&(t.completeness[i]={source_cid:o.extraction_of,completeness:"complete",...o.extractor_version?{extractor_version:o.extractor_version}:{},at:o.ts,seq:o.seq})}else t.completenessSkipped=(t.completenessSkipped??0)+1}else if(o.proposal_id!=null&&Array.isArray(o.extraction_of))for(let i of o.extraction_of){u.add(i.source_cid);let d=t.completeness[i.source_id];(!d||o.seq>=d.seq)&&(t.completeness[i.source_id]={source_cid:i.source_cid,completeness:i.completeness,...i.extractor_version?{extractor_version:i.extractor_version}:{},at:i.at,seq:o.seq})}o.design_of&&((t.design_of??={})[o.design_of.uc_cid]={engine:o.design_of.engine,seq:o.seq}),o.design_generation&&((t.design_generation??={})[o.design_generation.uc_root]={gen:o.design_generation.generation,seq:o.seq});{let i=o.design_phase;i&&typeof i.uc_root=="string"&&typeof i.phase=="string"&&typeof i.generation=="number"&&((t.design_phases??={})[i.uc_root]??=[]).push({phase:i.phase,generation:i.generation,seq:o.seq,completeness:i.completeness==="partial"?"partial":"complete"})}for(let i of o.executions??[])((t.exec??={})[i.about]??=[]).push(i);for(let i of o.edges){let{quote:d,...g}=i.props,l=t.forward[i.src]??=[];l.some(p=>p.ecid===i.ecid)||l.push({...i,props:g}),o.proposal_id!=null&&i.type===R.DERIVES&&typeof i.props.source_cid=="string"&&u.add(i.props.source_cid)}for(let i of o.review)i.resolution==="approved"||i.resolution==="edited"?(t.trust[i.id]="trusted",delete t.archivedReason[i.id]):i.resolution==="rejected"?(t.trust[i.id]="archived",i.reason?t.archivedReason[i.id]=i.reason:delete t.archivedReason[i.id]):i.resolution==="reset"&&(t.trust[i.id]="derived",delete t.archivedReason[i.id]);for(let i of o.supersessions)i.kind==="node"?i.new===i.old?delete t.superseded[i.old]:t.superseded[i.old]=i.new:i.revoke?(delete t.superseded[i.ecid],delete t.edgeRetractions[i.ecid]):(t.superseded[i.ecid]=null,t.edgeRetractions[i.ecid]={at:o.ts,...i.by?{by:i.by}:{},...i.reason?{reason:i.reason}:{}});for(let i of o.names??[])t.names[i.slug]=i.cid;for(let[i,d]of Object.entries(o.source_head_moves))t.heads[i]=d;if((o.event_ids??[]).forEach((i,d)=>{c.add(i),t.eventDigests[i]=o.event_digests?.[d]??""}),o.media)for(let[i,d]of Object.entries(o.media)){let g=o.source_head_moves[i];typeof g=="string"&&(t.media[g]=d)}if(o.conv){let i=o.source_head_moves[o.conv.source_id];if(typeof i=="string"){let d=t.conv[o.conv.source_id],g=d&&d.chain.length>0?d.chain[d.chain.length-1]:null;o.conv.append_of===g?t.conv[o.conv.source_id]={turns:o.conv.turn,chain:[...d?.chain??[],i]}:t.conv[o.conv.source_id]={turns:o.conv.turn,chain:[i]}}}for(let[i,d]of Object.entries(o.source_head_moves))o.conv?.source_id!==i&&t.conv[i]!==void 0&&(t.conv[i]=typeof d=="string"?{turns:t.conv[i].turns,chain:[d]}:{turns:t.conv[i].turns,chain:[]});t.applied={seq:o.seq,hash:r[h]}}),t.extracted=[...u].sort(),t.appliedEvents=[...c].sort()}var On="source-plugin@2";function bn(e,t){let n=Object.values(t.media).some(r=>r.plugin!==void 0);Rn($n(e),JSON.stringify(n?{...t,reverse:On}:t)+`
|
|
4
|
+
`)}function Dr(e){let t=tt(e,"meta.json");if(et(t))try{let n=JSON.parse(xt(t,"utf8"));if(n.schema!==ce||n.canonicalizer!=="v1")throw new b(`schema fence: store is ${n.schema}/${n.canonicalizer}, this build is ${ce}/${"v1"} \u2014 migrate explicitly (kane-cli context rebuild after upgrading)`)}catch(n){throw n instanceof b?n:new b(`corrupt meta.json in ${e} \u2014 fix or remove it`)}}function Ct(e){Dr(e);let t=st(e),n=t!==null&&t.applied.seq>0?Ze(e,t.applied.seq):null;if(t!==null&&n!==null&&n!==t.applied.hash&&(In(nt(e),{recursive:!0,force:!0}),t=null),t===null){t=Pe();let{records:a,hashes:u}=Qe(e);return Ee(e,t,a,u),bn(e,t),t}let{records:r,hashes:s}=je(e,t.applied.seq,t.applied.hash);return r.length>0&&(Ee(e,t,r,s),bn(e,t)),t}function gi(e){return In(nt(e),{recursive:!0,force:!0}),Ct(e)}var Fr=new Set(["CHAIN_ERROR","DERIVED_MISSING","DERIVED_DRIFT","NODE_FILE_MISSING","NODE_FILE_MISMATCH","NODE_FILE_CORRUPT"]);function hi(e){return Fr.has(e.code)?e.detail:`${e.code}: ${e.detail}`}function mi(e){let t=[],n=(l,p)=>{t.push({code:l,detail:p})},r=[],s=[];try{({records:r,hashes:s}=Qe(e))}catch(l){return{ok:!1,issues:[{code:"CHAIN_ERROR",detail:l instanceof b?l.message:String(l)}],records:0}}let a=Pe();Ee(e,a,r,s,{writeNodeFiles:!1});let u=st(e),c=0,o=a;if(u!==null&&u.applied.seq<r.length){let l=u.applied.seq;u.applied.hash===(l===0?null:s[l-1])&&(c=r.length-l,o=Pe(),Ee(e,o,r.slice(0,l),s.slice(0,l),{writeNodeFiles:!1}))}if(u===null)n("DERIVED_MISSING","derived/index.json missing or corrupt (run kane-cli context rebuild)");else{let l=p=>JSON.stringify(Nt(p));for(let p of["applied","heads","trust","nodeLabel","forward","extracted","superseded","names","archivedReason","appliedEvents","eventDigests","conv","media","design_of","design_generation","design_phases","exec","completeness","srcOwner","edgeRetractions"])l(o[p])!==l(u[p])&&n("DERIVED_DRIFT",`derived drift in index.${p} (run kane-cli context rebuild)`)}let h=new Set;for(let l of Object.values(a.forward))for(let p of l)h.add(p.ecid);let i=new Set,d=new Set;for(let l of r)for(let p of l.supersessions)p.kind==="node"?(p.old in a.nodeLabel||n("SUPERSEDE_UNKNOWN_OLD",`${p.old} (record ${l.seq})`),p.new!==null&&p.new!==p.old&&!(p.new in a.nodeLabel)&&n("SUPERSEDE_UNKNOWN_NEW",`${String(p.new)} (record ${l.seq})`),p.new===p.old?i.delete(p.old):(i.has(p.old)&&n("DOUBLE_SUPERSEDE",`${p.old} re-superseded while live (record ${l.seq})`),i.add(p.old))):(h.has(p.ecid)||n("SUPERSEDE_UNKNOWN_ECID",`${p.ecid} (record ${l.seq})`),p.revoke?(d.has(p.ecid)||n("EDGE_ORPHAN_REVOKE",`${p.ecid} revoked without a standing retraction (record ${l.seq})`),d.delete(p.ecid)):(d.has(p.ecid)&&n("EDGE_DOUBLE_RETRACT",`${p.ecid} re-retracted while already retracted (record ${l.seq})`),d.add(p.ecid)));for(let l of Object.keys(a.superseded)){let p=new Set,_=l;for(;_!==null&&_ in a.superseded;){if(p.has(_)){n("SUPERSEDE_CYCLE",`chain from ${l} revisits ${_}`);break}p.add(_),_=a.superseded[_]}}for(let[l,p]of Object.entries(a.names))p in a.nodeLabel||n("NAME_UNKNOWN_TARGET",`slug ${l} \u2192 ${p} not in the graph`);for(let l of r)for(let p of l.edges){let _=a.nodeLabel[p.src]??"(unknown)",S=a.nodeLabel[p.dst]??"(unknown)";for(let E of de(p.type,_,S,p.props))n(E.code,`${p.ecid} ${E.detail}`)}let g=new Map;for(let l of Object.values(a.forward))for(let p of l){if(p.ecid in a.superseded)continue;let _=g.get(p.type)??[];_.push(p),g.set(p.type,_)}for(let[l,p]of g){let _=ae(l);if(_?.acyclic){let S=new Map;for(let N of p)S.set(N.src,[...S.get(N.src)??[],N.dst]);let E=new Map,O=N=>{E.set(N,1);for(let U of S.get(N)??[])if(E.get(U)===1||E.get(U)===void 0&&O(U))return!0;return E.set(N,2),!1};for(let N of S.keys())if(E.get(N)===void 0&&O(N)){n("EDGE_CYCLE",`live ${l} edges form a cycle reachable from ${N}`);break}}if(_?.cardinality==="one-live-per-src"||_?.cardinality==="one-live-per-src-and-dst"){let S=new Map;for(let E of p)E.dst in a.superseded||S.set(E.src,[...S.get(E.src)??[],E]);for(let[E,O]of S)O.length>1&&n("CARDINALITY_VIOLATION",`${O.length} live ${l} edges from ${E} (one-live-per-src): ecids ${O.map(N=>N.ecid).join(",")}`)}if(_?.cardinality==="one-live-per-src-and-dst"){let S=new Map;for(let E of p)E.src in a.superseded||E.dst in a.superseded||S.set(E.dst,[...S.get(E.dst)??[],E]);for(let[E,O]of S)O.length>1&&n("CARDINALITY_VIOLATION",`${O.length} live ${l} edges onto ${E} (one-live-per-dst): ecids ${O.map(N=>N.ecid).join(",")}`)}}for(let[l,p]of Object.entries(o.nodeLabel)){let _=rt(e,l);if(!et(_)){n("NODE_FILE_MISSING",`missing node file for ${l} (run kane-cli context rebuild)`);continue}try{let S=JSON.parse(xt(_,"utf8"));(S.label!==p||ee(S.label,S.content)!==l)&&n("NODE_FILE_MISMATCH",`node file content mismatch for ${l} (run kane-cli context rebuild)`);for(let E of Z(S.label,S.content))n(E.code,`${l} ${E.detail}`)}catch{n("NODE_FILE_CORRUPT",`corrupt node file for ${l} (run kane-cli context rebuild)`)}}return{ok:t.length===0,issues:t,records:r.length,...c>0?{pending:c}:{}}}function Nt(e){return Array.isArray(e)?e.map(Nt):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([t],[n])=>t<n?-1:1).map(([t,n])=>[t,Nt(n)])):e}var kn=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function Tt(e){return typeof e=="string"&&e!=="."&&e!==".."&&kn.test(e)}function vi(e){if(!Tt(e))throw new Error(`unsafe logical_id: ${JSON.stringify(e)} \u2014 must match ${String(kn)} (no path separators)`)}var Ge=class extends Error{},Mr=new Set(["UNKNOWN_LABEL","MISSING_FIELD","BAD_ENUM"]),Ur=new Set(["UNKNOWN_EDGE_TYPE","ILLEGAL_EDGE","MISSING_SALIENT"]),Pr=["nodes","edges","review","supersessions"],Ve=/^sha256:[0-9a-f]{64}$/,xn=e=>typeof e=="string"&&(e===an||cn.test(e));function jr(e,t){if(!Array.isArray(e))return"is not a list";if(e.length===0)return"is empty";let n=e.find(r=>!xn(r));return n!==void 0?`holds ${JSON.stringify(n)}, which is not a unit id`:new Set(e).size!==e.length?"names a unit twice":t&&e.some((r,s)=>s>0&&e[s-1]>=r)?"is not sorted":t&&e.length>he.reconfirms?`names ${e.length} units, the limit is ${he.reconfirms}`:null}var Nn=2048,Vr=/^[a-z][a-z0-9-]{1,31}:[^\s\0]+$/;function Gr(e){return e.length>Nn?`it is ${e.length} characters, and a reference is at most ${Nn}`:/[\s\0]/.test(e)?"it holds a space, a line break or a NUL, and a reference is one word":Vr.test(e)?null:"it is not in a scheme (<scheme>:<rest>)"}function qr(e){if(typeof e!="object"||e===null||Array.isArray(e))return"has a fetch that is not an object";let t=e,n=Object.keys(t).find(r=>r!=="ref"&&r!=="cursor");return n!==void 0?`has a fetch with ${JSON.stringify(n)}, which a fetch does not hold`:typeof t.ref!="string"||Gr(t.ref)!==null?"has a fetch whose reference is not a reference in a scheme":t.cursor!==void 0&&(typeof t.cursor!="string"||Buffer.byteLength(t.cursor,"utf8")>he.cursorBytes)?`has a fetch whose cursor is not a string of at most ${he.cursorBytes} bytes`:null}function Hr(e){if(typeof e!="object"||e===null||Array.isArray(e))return"is not an object";let t=e;if(typeof t.id!="string"||t.id==="")return"names no plugin";if(!on.test(t.id))return`names ${JSON.stringify(t.id)}, which is not a plugin id`;if(typeof t.rules!="string"||t.rules==="")return"names no fingerprint rules";if(t.index!==void 0&&(typeof t.index!="string"||!Ve.test(t.index)))return"has an index that is not a sha256 fingerprint";if(t.notes!==void 0&&(typeof t.notes!="string"||!Ve.test(t.notes)))return"has notes that are not a sha256 fingerprint";if(t.coverage!==void 0&&(typeof t.coverage!="string"||!Ve.test(t.coverage)))return"has a coverage plan that is not a sha256 fingerprint";if(t.reasons!==void 0)return"has reasons outside its changes";if(t.cites_deep!==void 0&&t.cites_deep!==!0)return"has a cites_deep that is not true";if(t.fetch!==void 0){let n=qr(t.fetch);if(n!==null)return n}if(t.changes!==void 0){let n=t.changes;if(typeof n!="object"||n===null||Array.isArray(n))return"has changes that are not an object";if(t.index===void 0)return"has changes and no index";if(typeof n.from!="string"||!Ve.test(n.from))return"has changes from something that is not a sha256 fingerprint";let r=new Map;for(let s of["changed","removed","added"]){let a=n[s];if(!Array.isArray(a))return`has changes whose ${s} is not a list`;let u=a.find(c=>!xn(c));if(u!==void 0)return`has changes whose ${s} holds ${JSON.stringify(u)}, which is not a unit id`;if(new Set(a).size!==a.length)return`has changes whose ${s} names a unit twice`;if(a.some((c,o)=>o>0&&a[o-1]>=c))return`has changes whose ${s} is not sorted`;for(let c of a){let o=r.get(c);if(o!==void 0)return`has changes that name ${JSON.stringify(c)} in both ${o} and ${s}`;r.set(c,s)}}if(n.reasons!==void 0){let s=gn(n.reasons,n.changed);if(s!==null)return s}}return null}function Br(e){let t=[];for(let n of e.nodes)t.push(["node cid",n?.cid]);for(let n of e.edges)t.push(["edge ecid",n?.ecid],["edge src",n?.src],["edge dst",n?.dst]);for(let n of e.supersessions)n?.kind==="node"?(t.push(["superseded cid",n.old]),n.new!==null&&t.push(["superseding cid",n.new])):t.push(["retracted ecid",n?.ecid]);for(let n of e.names??[])t.push(["named cid",n?.cid]);return t}function Kr(e){let t=e.media;if(typeof t=="object"&&t!==null&&!Array.isArray(t))for(let[n,r]of Object.entries(t)){let s=r?.plugin;if(s===void 0)continue;if(r.format!=="plugin")return`the fact of ${n} has a plugin fact and is not a source-plugin version (its kind is ${JSON.stringify(r.format)})`;let a=Hr(s);if(a)return`the plugin fact of ${n} ${a}`}for(let n of Array.isArray(e.edges)?e.edges:[])if(n?.type==="DERIVES")for(let r of["units","reconfirms"]){let s=n?.props?.[r];if(s===void 0)continue;let a=jr(s,r==="reconfirms");if(a)return`${String(n.ecid)} ${r} ${a}`}return null}function Cn(e){let t=st(e),r=t!==null&&(t.applied.seq===0||Ze(e,t.applied.seq)===t.applied.hash)?t:Pe(),{records:s,hashes:a}=je(e,r.applied.seq,r.applied.hash);return s.length>0&&Ee(e,r,s,a,{writeNodeFiles:!1}),r}function Tn(e,t,n){let r=d=>new Ge(d);for(let d of Pr)if(!Array.isArray(t[d]))throw r(`${d} is not a list`);if(typeof t.source_head_moves!="object"||t.source_head_moves===null||Array.isArray(t.source_head_moves))throw r("source_head_moves is not an object");if(t.media!==void 0&&(typeof t.media!="object"||t.media===null||Array.isArray(t.media)))throw r("media is not an object");if(t.names!==void 0&&!Array.isArray(t.names))throw r("names is not a list");let s=Kr(t);if(s!==null)throw r(s);for(let[d,g]of Br(t))if(typeof g!="string"||!Ve.test(g))throw r(`${d} ${String(g)} is not a sha256 fingerprint`);if(t.proposal_id!=null&&!Tt(t.proposal_id))throw r(`proposal id ${JSON.stringify(t.proposal_id)} is not a plain name (letters, digits, . _ - after a letter or digit)`);let a=new Map;for(let d of t.nodes){let g=Z(d.label,d.content);for(let l of g)if(Mr.has(l.code))throw r(`${d.cid} ${l.detail}`);if(!g.some(l=>l.code==="UNKNOWN_FIELD")&&ee(d.label,d.content)!==d.cid)throw r(`${d.cid} is not the hash of its content`);a.set(d.cid,d.label)}let u=d=>e.nodeLabel[d]??a.get(d)??"(unknown)",c=d=>d in e.nodeLabel||a.has(d),o=new Set(t.edges.map(d=>d.ecid)),h=d=>o.has(d)||Object.values(e.forward).some(g=>g.some(l=>l.ecid===d));for(let d of t.edges)for(let g of de(d.type,u(d.src),u(d.dst),d.props))if(Ur.has(g.code))throw r(`${d.ecid} ${g.detail}`);let i=kt(t.edges,Rt(e,t));if(i!==null)throw r(Ot(i));for(let d of t.supersessions)if(d.kind==="node"){if(!c(d.old))throw r(`supersedes ${d.old}, which the graph does not hold`);if(d.new!==null&&!c(d.new))throw r(`supersedes with ${d.new}, which the graph does not hold`);if(d.new!==d.old&&d.old in e.superseded)throw r(`${d.old} is re-superseded while already superseded`)}else{if(!h(d.ecid))throw r(`retracts edge ${d.ecid}, which the graph does not hold`);if(d.revoke&&!(d.ecid in e.superseded))throw r(`${d.ecid} is revoked without a standing retraction`);if(!d.revoke&&d.ecid in e.superseded)throw r(`${d.ecid} is re-retracted while already retracted`)}for(let d of t.names??[])if(!c(d.cid))throw r(`names ${d.slug} \u2192 ${d.cid}, which the graph does not hold`);Ee(null,e,[t],[n],{writeNodeFiles:!1});for(let d of t.supersessions){if(d.kind!=="node"||d.new===d.old)continue;let g=new Set,l=d.old;for(;l!==null&&l in e.superseded;){if(g.has(l))throw r(`supersession chain from ${d.old} revisits ${l}`);g.add(l),l=e.superseded[l]}}}import{existsSync as At,mkdirSync as Jr,readFileSync as Wr}from"fs";import{dirname as An,join as Yr}from"path";var Lt="unknown",Dn=()=>Lt;function Ti(e){Lt=e}var Xr=["extract","review","pair-merge","names","retire","gap","gap-close","chat","design","execution","parked","exec-supersede","ingest","distill","conv-mint","conv-turn","archive","revert"],Ln={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 it(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ot(e){return e===null||typeof e=="string"||typeof e=="boolean"?!0:typeof e=="number"?Number.isFinite(e):Array.isArray(e)?e.every(ot):it(e)&&Object.values(e).every(ot)}var zr=e=>typeof e=="string"&&Xr.includes(e);function Fn(e){if(!it(e))return"intent is missing: every append names the intent it fulfils";if(!zr(e.verb))return`intent verb ${String(e.verb)} is not a writer this build knows`;let t=Ln[e.verb].v;if(e.v!==t)return`intent ${e.verb} v ${String(e.v)} is not the version this build writes (v ${t})`;if(!it(e.pins)||!ot(e.pins))return"intent pins is not a plain JSON object";if(!ot(e.args))return"intent args is not JSON";let n=Ln[e.verb];for(let r of n.args??[])if(!it(e.args)||!(r in e.args))return`intent ${e.verb} arg ${r} is missing`;for(let r of n.pins??[])if(!(r in e.pins))return`intent ${e.verb} pin ${r} is missing`;return null}function me(e){return JSON.parse(JSON.stringify(e))}function Mn(e,t){let n=t.slice(7);return Yr(e,"intents",n.slice(0,2),`${n}.json`)}function Ai(e,t){let n=Mn(e,t);return At(n)?JSON.parse(Wr(n,"utf8")):null}function Qr(e,t){return{v:e.v,verb:e.verb,args:e.args,pins:e.pins,born:{...t,build:Lt}}}function Un(e,t,n){let r=Mn(e,n.hash),s=An(r),a=An(s),u=!At(a),c=u||!At(s);return Jr(s,{recursive:!0}),Dt(r,JSON.stringify(Qr(t,n))+`
|
|
5
|
+
`),c&&ct(a),u&&ct(e),r}import{closeSync as Zr,existsSync as es,mkdirSync as Pn,openSync as ts,readFileSync as Hn,readdirSync as ns,renameSync as jn,rmSync as Le,watch as rs,writeFileSync as Ft}from"fs";import{join as we}from"path";import{randomBytes as ss}from"crypto";var is=1440*60*1e3,De=class extends Error{constructor(n,r,s,a){super(`${n}: ${s}`);this.code=n;this.key=r;this.holder=a}},qe=e=>(e?.now??(()=>new Date))();function pt(e){if(!Number.isInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}function Vn(e,t){let n=t.getTime()-new Date(e.ts).getTime();return!pt(e.pid)||n>=is||Number.isNaN(n)}var Se=e=>we(e,"locks"),Gn=e=>we(Se(e),"waiters");function at(e,t){return t.kind==="context"?we(Se(e),"context.lock"):t.kind==="extract"?we(Se(e),"extract.lock"):we(Se(e),`uc-${t.id}.lock`)}var Mt=e=>e.kind==="uc"?e.id:e.kind,dt=e=>e.kind==="uc"?`uc:${e.id}`:e.kind,ut=e=>e.kind==="uc"?e.id:`~${e.kind}`;function qn(e){return[...e].sort((t,n)=>ut(t)<ut(n)?-1:ut(t)>ut(n)?1:0)}function ue(e){try{return JSON.parse(Hn(e,"utf8"))}catch{return null}}function os(e,t,n){let r=`${e}.break-${n}`;try{jn(e,r)}catch(a){if(a.code==="ENOENT")return!1;throw a}let s;try{s=JSON.parse(Hn(r,"utf8"))}catch{s=null}if(s===null||s.nonce===t)return Le(r,{force:!0}),!0;try{jn(r,e)}catch{Le(r,{force:!0})}return!1}var ie=new Map,lt=new Map;function ji(e,t,n){let r=c=>`${e}|${t}|${Mt(c)}`;function s(c,o,h=0){if(h>20)throw new De("LOCK_CONTENTION_UNSETTLED",c,`${dt(c)}: lock contention did not settle`);let i=at(e,c);Pn(Se(e),{recursive:!0});let d=ss(8).toString("hex");try{let g=ts(i,"wx",384);return Ft(g,JSON.stringify({...o,nonce:d})+`
|
|
6
|
+
`),Zr(g),d}catch(g){if(g.code!=="EEXIST")throw g;let l=ue(i),p=qe(n);if(l!==null&&!Vn(l,p)){let _=c.kind==="context"?"CONTEXT_HELD":c.kind==="extract"?"EXTRACT_HELD":"UC_HELD";throw new De(_,c,`${dt(c)} is held by ${l.owner_sid} (${l.verb})`,{owner_sid:l.owner_sid,pid:l.pid,ts:l.ts,verb:l.verb,alive:pt(l.pid)})}return os(i,l?.nonce,d)&&hn({type:"lock_steal",key:dt(c),stale_owner:l?.owner_sid??"corrupt",by:t,ts:p.toISOString()}),s(c,o,h+1)}}function a(c,o){let h=!1;return{keys:o,assertHeld(){for(let{key:i,sk:d}of c){let g=ie.get(d),l=g?ue(g.path):null;if(!g||l===null||l.nonce!==g.nonce)throw new De("LOCK_LOST",i,`${dt(i)} grant was taken over or removed`)}},touch(){for(let{sk:i}of c){let d=ie.get(i);if(!d)continue;let g=ue(d.path);g!==null&&g.nonce===d.nonce&&Ft(d.path,JSON.stringify({...g,ts:qe(n).toISOString()})+`
|
|
7
|
+
`,{mode:384})}},release(){if(!h){h=!0;for(let{sk:i}of[...c].reverse()){let d=ie.get(i);if(d&&(d.count-=1,d.count<=0)){ie.delete(i);let g=ue(d.path);g!==null&&g.nonce===d.nonce&&Le(d.path,{force:!0})}}}}}}function u(c,o){let h=qn(c),i=[];try{for(let d of h){let g=r(d),l=ie.get(g);if(l)l.count+=1;else{let p=s(d,{owner_sid:t,pid:process.pid,ts:qe(n).toISOString(),verb:o.verb??"unknown",hold:o.hold,...d.kind==="uc"?{logical_display:d.id.toUpperCase()}:{}});ie.set(g,{nonce:p,count:1,path:at(e,d),key:d})}i.push({key:d,sk:g})}return a(i,h)}catch(d){for(let{sk:g}of[...i].reverse()){let l=ie.get(g);if(l&&(l.count-=1,l.count<=0)){ie.delete(g);let p=ue(l.path);p!==null&&p.nonce===l.nonce&&Le(l.path,{force:!0})}}throw d}}return{acquire:u,tryAcquire(c,o){try{return u(c,o)}catch(h){if(h instanceof De&&(h.code==="UC_HELD"||h.code==="CONTEXT_HELD"||h.code==="EXTRACT_HELD"))return{contended:h};throw h}},holder(c){return ue(at(e,c))},async wait(c,o){let h=at(e,c);Pn(Gn(e),{recursive:!0});let i=we(Gn(e),`${Mt(c)}.${t}.${process.pid}.json`);try{Ft(i,JSON.stringify({sid:t,pid:process.pid,ts:qe(n).toISOString()})+`
|
|
8
|
+
`,{mode:384})}catch{}let d=Date.now()+o.timeoutMs,g=null,l=null;try{try{g=rs(Se(e),()=>{l?.()}),g.on("error",()=>{l?.(),g=null})}catch{g=null}for(;;){if(o.signal?.aborted)return"cancelled";let p=ue(h);if(p===null||Vn(p,qe(n)))return"free";let _=d-Date.now();if(_<=0)return"timeout";await new Promise(S=>{l=S;let E=setTimeout(S,Math.min(g?250:100,Math.max(1,_)));o.signal?.addEventListener?.("abort",()=>{clearTimeout(E),S()},{once:!0})}),l=null}}finally{g?.close(),Le(i,{force:!0})}},async withKeySerialized(c,o){let i=qn(c).map(p=>`${e}|${Mt(p)}`),d=i.map(p=>lt.get(p)??Promise.resolve()),g,l=new Promise(p=>{g=p});for(let p of i)lt.set(p,l);await Promise.all(d);try{return await o()}finally{g();for(let p of i)lt.get(p)===l&<.delete(p)}},releaseAll(c){let o=`${e}|${c}|`;for(let[h,i]of[...ie]){if(!h.startsWith(o))continue;ie.delete(h);let d=ue(i.path);d!==null&&d.nonce===i.nonce&&Le(i.path,{force:!0})}}}}function Vi(e,t){let n=e.resolve(t);if(n===null)return{key:{kind:"uc",id:t.toLowerCase()},display:t};let r=e.displayNameOf(n.tip)??e.displayNameOf(n.cid);if(r!==null&&/^uc-\d+$/i.test(r))return{key:{kind:"uc",id:r.toLowerCase()},display:r.toUpperCase()};let s=Fe(e.superseded,o=>e.nodeLabel.get(o)),a=n.cid,u=new Set;for(;s.has(a)&&!u.has(a);)u.add(a),a=s.get(a);let c=a.slice(0,12);return{key:{kind:"uc",id:c},display:r??c}}function Gi(e){let t=Se(e);if(!es(t))return[];let n=[];for(let r of ns(t)){if(!r.endsWith(".lock"))continue;let s=ue(we(t,r));s!==null&&n.push({key:r.replace(/\.lock$/,""),grant:s})}return n}var b=class extends Error{},Zn="run kane-cli context sync or kane-cli context pull to continue, or kane-cli context sync doctor --abort to close it",Bn="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 as(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e;if(t.state!=="open"&&t.state!=="closed"||!Array.isArray(t.items))return null;let n=["applied","held","skipped","deduped"];for(let r of t.items){if(!r||typeof r!="object"||Array.isArray(r))return null;let s=r.outcome;if(s===void 0)continue;if(!s||typeof s!="object"||Array.isArray(s))return null;let a=Object.keys(s);if(a.length!==1||!n.includes(a[0]))return null;let u=s[a[0]];if(!u||typeof u!="object")return null}return t}var ft=class extends b{constructor(n,r=Zn){super(n);this.remedy=r}code="SYNC_REBASE_PENDING"};function ds(e){let t=te(e,"sync","replay");if(!Wn(t))return null;let n=zn(t).filter(r=>r.endsWith(".json")&&!r.endsWith(".receipt.json")).sort().reverse();for(let r of n){let s=r.slice(0,-5),a;try{a=as(JSON.parse(le(te(t,r),"utf8")))}catch{a=null}if(a===null)return{id:s,decisions:0,unreadable:!0};if(a.state==="open")return{id:s,decisions:a.items.filter(u=>u.outcome!==void 0&&u.outcome!==null&&"held"in u.outcome).length}}return null}function us(e){let t=ds(e);if(!t)return;if(t.unreadable)throw new ft(`rebase ${t.id} has a ledger this store cannot read (sync/replay/${t.id}.json); this store takes no other change until it is set aside \u2014 ${Bn}`,Bn);let n=t.decisions>0?`a rebase (${t.id}) is open with ${t.decisions} decision${t.decisions===1?"":"s"} unresolved`:`a rebase (${t.id}) is open and not finished`;throw new ft(`${n}; this store takes no other change until it is finished \u2014 ${Zn}`)}function ls(e){let t=e.args?.by,n=typeof t=="object"&&t!==null&&typeof t.kind=="string"&&typeof t.id=="string";return{build:Dn(),...n?{by:t}:{}}}function ps(e){return"sha256:"+Te(Buffer.from(Ce({verb:e.verb,args:e.args,pins:e.pins})))}function gt(e,t){let n=e.schema_version===Gt&&qt(e);if(e.schema_version!==void 0&&e.schema_version!==ce&&!n)throw new b(`record ${t} is stamped ${e.schema_version}, this build reads ${ce} \u2014 migrate explicitly`);if(e.schema_version===ce&&qt(e))throw new b(`record ${t} carries a source-plugin fact and is stamped ${ce} \u2014 such a record is stamped ${Gt}`);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 b(`record ${t}: parents does not mirror prev_hash \u2014 multi-parent records need a DAG-aware reader`)}var be=class extends b{},jt=class extends b{code="CONTEXT_APPEND_BUSY"};function er(e,t){Yn(e,{recursive:!0});let n=te(e,".lock"),r=Date.now()+(t?t.deadlineMs:2e3);for(;;)try{return Qn(n,`${process.pid}
|
|
9
|
+
`,{flag:"wx"}),()=>{try{Ut(n)}catch{}}}catch(s){if(s.code!=="EEXIST")throw s;if(t){let a=null,u=null;try{u=le(n,"utf8");let c=Number.parseInt(u.trim(),10);a=Number.isInteger(c)?c:null}catch{u=null}if(u!==null&&a!==null&&!pt(a)){let c=`${n}.break-${process.pid}-${Date.now()}`;try{Pt(n,c);let o=null;try{o=le(c,"utf8")}catch{o=null}if(o===null||o===u)Ut(c,{force:!0});else try{Pt(c,n)}catch{Ut(c,{force:!0})}}catch(o){if(o.code!=="ENOENT")throw o}continue}if(Date.now()>r)throw new jt(`.context append is busy: ${n} held ${a===null?"by a holder that has not written its pid":`by live pid ${a}`} past the deadline`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25+Math.floor(Math.random()*50));continue}if(Date.now()>r)throw new b(`.context is locked by another process \u2014 remove ${n} if that process is gone`);Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,25)}}var fs=/^\d{6}-[0-9a-f]{12}\.json$/,gs=999999;function tr(e,t){if(e>gs)throw new b(`${t}: 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=e=>te(e,"commits");function Ie(e){return"sha256:"+Te(Buffer.from(Ce(e),"utf8"))}var Vt=class extends b{constructor(n){let r=[...new Set(n.map(s=>Number(s.slice(0,6))))];super(`FORKED: more than one record at position${r.length>1?"s":""} ${r.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=n}code="CONTEXT_FORKED"},nr="000001-000000000000.json",rr="store is mid-reset: run kane-cli context sync doctor";function Qi(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 He(e){let{files:t,midReset:n}=sr(e);if(n)throw new b(rr);return t}function sr(e){let t=_e(e);if(!Wn(t))return{files:[],midReset:!1};let n=zn(t).filter(a=>fs.test(a)).sort(),r=n.indexOf(nr);r>=0&&n.splice(r,1);let s=[];for(let a=0;a<n.length;a++){let u=n[a].slice(0,6);(a>0&&n[a-1].slice(0,6)===u||a+1<n.length&&n[a+1].slice(0,6)===u)&&s.push(n[a])}if(s.length>0)throw new Vt(s);return{files:n,midReset:r>=0}}function Qe(e){let t=He(e),n=[],r=[],s=null;return t.forEach((a,u)=>{let c=le(te(_e(e),a),"utf8"),o;try{o=JSON.parse(c)}catch(d){throw new b(`corrupt commit record ${a}: ${String(d)}`)}if(o.seq!==u+1)throw new b(`sequence gap: expected seq ${u+1}, ${a} has ${o.seq}`);if(o.prev_hash!==s)throw new b(`broken chain at ${a}: prev_hash ${String(o.prev_hash)} != ${String(s)}`);gt(o,a);let h=Ie(o),i=a.slice(7,19);if(!h.slice(7).startsWith(i))throw new b(`tampered record ${a}: content hash ${h} does not match filename`);n.push(o),r.push(h),s=h}),{records:n,hashes:r}}function ir(e){return or(e,He(e))}function or(e,t){if(t.length===0)return null;let n=t[t.length-1],r=le(te(_e(e),n),"utf8"),s;try{s=JSON.parse(r)}catch(u){throw new b(`corrupt tail record ${n}: ${String(u)}`)}gt(s,n);let a=Ie(s);if(!a.slice(7).startsWith(n.slice(7,19)))throw new b(`tampered tail record ${n}: content hash ${a} does not match filename`);if(s.seq!==t.length)throw new b(`sequence gap at tail: ${t.length} record files but tail seq is ${s.seq}`);return{seq:s.seq,hash:a}}function Zi(e){return ir(e)?.hash??null}var hs="corrupt";function Ze(e,t){let n=He(e)[t-1];if(!n)return null;try{return Ie(JSON.parse(le(te(_e(e),n),"utf8")))}catch{return hs}}function je(e,t,n){let r=He(e);if(r.length<t)throw new b(`derived state is ahead of the record log (applied seq ${t}, ${r.length} records) \u2014 run kane-cli context rebuild`);let s=[],a=[],u=n;for(let c=t;c<r.length;c++){let o=r[c],h=le(te(_e(e),o),"utf8"),i;try{i=JSON.parse(h)}catch(g){throw new b(`corrupt commit record ${o}: ${String(g)}`)}if(i.seq!==c+1)throw new b(`sequence gap: expected seq ${c+1}, ${o} has ${i.seq}`);if(i.prev_hash!==u)throw new b(`broken chain at ${o}: prev_hash ${String(i.prev_hash)} != ${String(u)}`);gt(i,o);let d=Ie(i);if(!d.slice(7).startsWith(o.slice(7,19)))throw new b(`tampered record ${o}: content hash ${d} does not match filename`);s.push(i),a.push(d),u=d}return{records:s,hashes:a}}function ms(e,t){if(t.seq===0){if(t.hash!==null)throw new b("watermark not in chain: seq 0 cannot carry a hash");return Qe(e)}let n=He(e);if(n.length<t.seq)throw new b(`watermark not in chain: seq ${t.seq} is beyond the ${n.length}-record chain`);let r=n[t.seq-1],s;try{s=JSON.parse(le(te(_e(e),r),"utf8"))}catch(u){throw new b(`watermark record ${r} unreadable: ${String(u)}`)}let a=Ie(s);if(a!==t.hash)throw new b(`watermark not in chain: seq ${t.seq} hashes ${a}, watermark claims ${String(t.hash)}`);return je(e,t.seq,t.hash)}function _s(e,t){let n=Fn(t);if(n!==null)throw new b(`append refused: ${n}; nothing was written`);if("replayed_from"in e)throw new b("append refused: replayed_from is stamped by the append layer from opts.provenance; nothing was written");if("event_digests"in e||"intent_verb"in e||"created_by"in e)throw new b("append refused: event_digests, intent_verb and created_by are stamped by the append layer from the intent; nothing was written")}function eo(e,t,n){_s(t,n.intent);let r=er(e,n.busyRetry);try{return ys(e,t,n)}finally{r()}}var Gt="assurance/context@2";function qt(e){if(e.media){for(let t of Object.values(e.media))if(t!==null&&typeof t=="object"&&"plugin"in t)return!0}for(let t of e.edges??[])if(t.type==="DERIVES"&&t.props!==void 0&&t.props!==null&&("units"in t.props||"reconfirms"in t.props))return!0;return!1}function vs(e,t,n,r){return{seq:t,prev_hash:n,...e,schema_version:qt(e)?Gt:ce,parents:n===null?[]:[n],...r.intent?{intent_verb:r.intent.verb,created_by:ls(r.intent)}:{},...r.intent&&e.event_ids&&e.event_ids.length>0?{event_digests:e.event_ids.map(()=>ps(r.intent))}:{},...r.provenance?{replayed_from:r.provenance.replayed_from}:{}}}function ys(e,t,n){n.provenance||us(e);let r=ir(e),s=(r?.seq??0)+1;tr(s,"append");let a=r?.hash??null;if(n.expectPrev!==void 0&&n.expectPrev!==a)throw new be(`concurrent append detected: validated against ${String(n.expectPrev)} but the chain head is ${String(a)} \u2014 re-open and retry`);let u=vs(t,s,a,n),c=Ie(u);if(n.provenance)try{Tn(Cn(e),u,c)}catch(h){throw h instanceof Ge?new b(`replayed record would not pass this store's checks: ${h.message}; nothing was written`):h}n.intent&&Un(e,n.intent,{seq:s,hash:c,ts:u.ts});let o=cr(e,s,c,JSON.stringify(u)+`
|
|
10
|
+
`);return{seq:s,hash:c,file:o,record:u}}function Dt(e,t){let n=`${e}.tmp-${process.pid}`,r=Xn(n,"w");try{Qn(r,t),It(r)}finally{Jn(r)}Pt(n,e),ct(cs(e))}function ct(e){try{let t=Xn(e,"r");try{It(t)}finally{Jn(t)}}catch{}}function cr(e,t,n,r){let s=_e(e);Yn(s,{recursive:!0});let a=`${String(t).padStart(6,"0")}-${n.slice(7,19)}.json`,u=te(s,a);return Dt(u,r),u}var Kn=100;function to(e,t,n,r={}){if(t.length===0)return[];if(t.length>Kn)throw new b(`import: batch of ${t.length} exceeds ${Kn} records per lock \u2014 chunk it`);let s=t[0].seq;if(!Number.isInteger(s)||s<1)throw new b(`import: batch starts at seq ${String(s)}, positions start at 1`);tr(s+t.length-1,"import");let a=[],u=n;t.forEach(({seq:o,raw:h},i)=>{let d=s+i;if(o!==d)throw new b(`import: expected seq ${d}, batch carries ${String(o)}`);let g;try{g=JSON.parse(h)}catch(_){throw new b(`import: record ${o} is not JSON: ${String(_)}`)}if(g===null||typeof g!="object"||Array.isArray(g))throw new b(`import: record ${o} is not a JSON object`);let l=g;if(l.seq!==o)throw new b(`import: expected seq ${o}, record carries ${String(l.seq)}`);if(l.prev_hash!==u)throw new b(`import: record ${o} is sealed onto ${String(l.prev_hash)}, local tail is ${String(u)}`);gt(l,`import@${o}`);let p=Ie(l);a.push({seq:o,hash:p,raw:h}),u=p});let c=r.lockHeld?()=>{}:er(e);try{let o=sr(e);if(o.midReset&&!Es(e,r.underReset))throw new b(rr);let h=or(e,o.files);if((h?.hash??null)!==n)throw new be(`import: local tail moved to ${String(h?.seq??0)} ${String(h?.hash??null)} \u2014 re-plan the pull`);if((h?.seq??0)!==s-1)throw new b(`import: batch starts at seq ${s}, local tail is at ${String(h?.seq??0)}`);return a.map(({seq:i,hash:d,raw:g})=>({seq:i,hash:d,file:cr(e,i,d,g)}))}finally{c()}}function Es(e,t){if(!t)return!1;try{return JSON.parse(le(te(_e(e),nr),"utf8")).kane?.nonce===t.nonce}catch{return!1}}function ro(e,t,n){let r=t.mediaOf(n),s=typeof r?.text_blob=="string"&&r.text_blob!==""?r.text_blob:null,a=String(t.getNode(n)?.content.blob??""),u=s!==null?e.getBlob(s):a===""?null:e.getBlob(a);return u===null||r?.format==="image"||!u.includes(0)||ws(u)!==null?u:Buffer.from(mt(u.toString("utf8")).text,"utf8")}function ws(e){return e.length>8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?"image/png":e.length>3&&e[0]===255&&e[1]===216&&e[2]===255?"image/jpeg":e.length>12&&e.toString("ascii",0,4)==="RIFF"&&e.toString("ascii",8,12)==="WEBP"?"image/webp":null}var Ss="\uFFFD";function mt(e){let t=0;return{text:e.replace(/\u0000/g,()=>(t++,Ss)),replaced:t}}function so(e,t){let n=t===1?"1 NUL character":`${t} NUL characters`;return`${e}: ${n} in its text replaced with U+FFFD, the replacement character; the file itself is stored unchanged`}function ht(e,t){if(typeof e=="string")return e.includes("\0")?t:null;if(Array.isArray(e)){for(let[n,r]of e.entries()){let s=ht(r,`${t}[${n}]`);if(s!==null)return s}return null}if(e!==null&&typeof e=="object")for(let[n,r]of Object.entries(e)){let s=`${t}.${n.includes("\0")?JSON.stringify(n):n}`;if(n.includes("\0"))return s;let a=ht(r,s);if(a!==null)return a}return null}function ar(e){return`${e} holds U+0000, a NUL character, which no store can keep \u2014 write it again without the NUL`}function io(e){return e.toString("utf8").replace(/\n$/,"").split(`
|
|
11
|
+
`).map((n,r)=>`${String(r+1).padStart(4,"0")}| ${n}`).join(`
|
|
12
|
+
`)}function bs(e,t){let n=/^L(\d+)-L(\d+)$/.exec(t);if(!n)return null;let r=parseInt(n[1],10),s=parseInt(n[2],10),a=e.split(`
|
|
13
|
+
`);return r<1||s<r||s>a.length?null:a.slice(r-1,s).map(u=>u.replace(/^\d+\| /,"")).join(`
|
|
14
|
+
`)}function dr(e){return e.replace(/\s+/g," ").trim()}function Is(e,t){let n=dr(mt(e).text);return n.length>0&&dr(t).includes(n)}function $s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function uo(e,t){let n=mt(t).text.split(/\s+/).filter(a=>a.length>0);if(n.length===0)return[];let r=new RegExp(n.map($s).join("\\s+"),"g"),s=[];for(let a=r.exec(e);a!==null;a=r.exec(e))s.push({index:a.index,length:a[0].length}),r.lastIndex=a.index+1;return s}function ur(e,t,n){let r=Ae(t.anchor);if(e.format==="image")return r?.kind==="img-whole"?[]:[{code:"CITE_ANCHOR_INVALID",detail:`image cites are anchor-only (img#whole), got ${t.anchor}`}];if(r?.kind==="img-part")return new Set((e.images??[]).map(u=>u.ref)).has(r.ref)?[]:[{code:"CITE_ANCHOR_INVALID",detail:`anchor ${t.anchor} names no embedded image of this source version`}];if(!t.anchor||t.quote===void 0||t.quote==="")return[{code:"MISSING_CITE",detail:"text-kind cites need anchor+quote"}];let s=n!==null?bs(n,t.anchor):null;return s===null?[{code:"BAD_ANCHOR",detail:`anchor ${t.anchor} does not resolve in the source`}]:Is(t.quote,s)?[]:[{code:"QUOTE_MISMATCH",detail:`quote is not verbatim within ${t.anchor}`}]}import{existsSync as Os,readFileSync as ks}from"fs";var lr=new WeakMap;function pr(e,t,n){let r=e.heads.get(n);if(r==null)return null;let s=lr.get(e);s===void 0&&lr.set(e,s=We({pluginOf:i=>e.mediaOf(i).plugin}));let a=s(n,r);if(a===null)return null;let u=un(e.derivesInto(t).filter(i=>i.props.source_id===n),a),c=new Set,o=!1;for(let i of u.failed){let d=a.distance.get(i.props.source_cid);if(d===void 0)o=!0;else for(let g of Array.isArray(i.props.units)?i.props.units:[])(a.touchedAt.get(g)??1/0)<=d&&c.add(g)}let h={};if(c.size>0){let i=new Map([...a.distance].map(([d,g])=>[g,d]));for(let d of c){let g=a.touchedAt.get(d),l=g===void 0?void 0:i.get(g-1),p=l===void 0?null:fn(e.mediaOf(l).plugin?.changes?.reasons?.[d]);p!==null&&(h[d]=p)}}return{...u,changed:[...c].sort(),unreached:o,notes:h}}function go(e,t){let n=Rs(e,t),r=t.changed.filter(s=>Xe(t.notes[s])!==null);return r.length===0?n:t.changed.length===1?`${n} (the plugin's note: ${Xe(t.notes[r[0]])})`:`${n} (the plugin's notes: ${r.slice(0,8).map(s=>`${s} ${Xe(t.notes[s])}`).join("; ")})`}function Rs(e,t){if(t.changed.length>0){let n=t.changed.slice(0,8).join(", "),r=t.changed.length>8?` and ${t.changed.length-8} more`:"";return`${t.changed.length===1?"unit":"units"} ${n}${r} of ${e} changed or ${t.changed.length===1?"was":"were"} removed`}return t.unreached?`a citation of ${e} is pinned to a version the current one was not measured against`:`a citation of ${e} with no units is behind the current version`}function So(e){return Ns(e,Ct(e))}function Ns(e,t,n){let r=new Map(Object.entries(t.heads)),s=new Map(Object.entries(t.trust)),a=new Map(Object.entries(t.nodeLabel)),u=new Map(Object.entries(t.superseded)),c=new Map(Object.entries(t.names)),o=new Map(Object.entries(t.archivedReason)),h=new Set(t.appliedEvents),i=new Map(Object.entries(t.conv)),d=y=>yt(t.media[y]),g=new Map;for(let[y,$]of c)g.set($,y);let l=new Map,p=y=>{if(l.has(y))return l.get(y);if(!a.has(y))return l.set(y,null),null;let $=n?.get(y);if($)return l.set(y,$),$;if(e===null)throw new b(`node ${y} is labelled in the fold but its content was not handed to it`);let F=rt(e,y);if(!Os(F))throw new b(`derived node file missing for ${y} \u2014 run kane-cli context rebuild`);let D=JSON.parse(ks(F,"utf8"));return l.set(y,D),D},_=y=>u.get(y),S=y=>Ht(y,_),E=null,O=y=>fr(y,$=>g.get($),$=>(E??=Fe(u,F=>a.get(F))).get($)),N=y=>{let $=_t(y,{hasNode:D=>a.has(D),cidOfName:D=>c.get(D),headOf:D=>r.get(D)});if($===null)return null;let F=S($);return{cid:$,tip:F,superseded:u.has($)||u.has(F)}},U=new Map;for(let y of Object.values(t.forward))for(let $ of y){let F=U.get($.dst);F?F.push($):U.set($.dst,[$])}let T=y=>(y??[]).filter($=>!u.has($.ecid)),G=y=>T(U.get(y)),P=y=>G(y).filter($=>$.type===R.DERIVES),fe=Ye({supersededBy:_,edgesInto:G,edgesFrom:y=>T(t.forward[y]),headOf:y=>r.get(y),convChain:y=>i.get(y)?.chain,pluginOf:y=>Object.hasOwn(t.media,y)?t.media[y].plugin:void 0});return{heads:r,trust:s,nodeLabel:a,superseded:u,names:c,nameOf:g,archivedReason:o,appliedEvents:h,convChains:i,mediaOf:d,extractedSourceCids:new Set(t.extracted),extractionCompleteness:new Map(Object.entries(t.completeness??{}).map(([y,{seq:$,...F}])=>[y,F])),designOf:new Map(Object.entries(t.design_of??{})),designGenerationOf:new Map(Object.entries(t.design_generation??{})),latestHash:t.applied.hash,lastSeq:t.applied.seq,hasNode:y=>a.has(y),getNode:p,byLabel:y=>[...a.entries()].filter(([,$])=>$===y).map(([$])=>({cid:$,content:p($)?.content??{}})),edgesFrom:y=>T(t.forward[y]),edgesInto:G,derivesInto:P,resolve:N,tipOf:S,displayNameOf:O,stale:fe,staleList:()=>[...a.keys()].map(y=>({cid:y,state:fe(y)})).filter(y=>y.state!=="fresh"),execHistory:y=>{let $=N(y);if(!$)return[];let F=Be($.cid,_,()=>u,K=>a.get(K)),D=[];for(let K of Object.entries(t.exec??{}))F.has(K[0])&&D.push(...K[1]);return D.sort((K,W)=>K.started_at<W.started_at?-1:K.started_at>W.started_at?1:0)},retractedEdgesTouching:y=>{let $=Be(y,_,()=>u,W=>a.get(W)),F=t.edgeRetractions??{},D=[],K=new Set;for(let W of $)for(let ge of[...t.forward[W]??[],...U.get(W)??[]]){let oe=F[ge.ecid];!oe||K.has(ge.ecid)||(K.add(ge.ecid),D.push({...ge,retraction:oe}))}return D}}}function bo(e,t){let n=xs(e,t);return n.sources.length>0||n.pin}function xs(e,t){if(e.stale(t)!=="stale")return{sources:[],pin:!1};let n=new Map;for(let s of e.derivesInto(t))n.set(s.props.source_id,s);let r=[];for(let[s,a]of n){let u=e.heads.get(s);if(u==null)continue;let c=pr(e,t,s);if(c!==null){c.stale&&r.push(s);continue}if(u===a.props.source_cid)continue;let o=e.convChains.get(s)?.chain;(!o||!o.includes(a.props.source_cid))&&r.push(s)}return{sources:r,pin:Cs(e,t)}}function Cs(e,t){for(let n of e.edgesFrom(t)){if(ae(n.type)?.pin?.comparesTo!=="dst_tip"||!e.superseded.has(n.dst))continue;let r=e.tipOf(n.dst);if(e.superseded.has(r)||e.nodeLabel.get(r)==="usecase")return!0}return!1}function Et(e,t){let n=new Map,r=c=>e.nodeLabel.get(c);for(let[c,o]of e.superseded)typeof o=="string"&&o!==c&&!vt(c,o,r)&&n.set(o,[...n.get(o)??[],c]);let s=[],a=[t],u=new Set;for(;a.length>0;){let c=a.pop();u.has(c)||(u.add(c),s.push(c),a.push(...n.get(c)??[]))}return s}function Ts(e,t){return(e.extraction_claims??[]).some(n=>n.source_id===t&&n.completeness==="complete")}function As(e,t){let n=new Set;for(let r of Et(e,t))for(let s of e.derivesInto(r))n.add(s.props?.source_id??"conversation");return n}function Bt(e,t){let n=[],r=[],s=e.archived??[];if(s.length===0)return{valid:n,errors:r};let a=new Set([...e.source?[e.source.source_id]:[],...(e.sources??[]).map(c=>c.source_id)]),u=new Set;for(let c of e.use_cases){if(!c.matches_existing)continue;let o=t.resolve(c.matches_existing.cid);o&&u.add(t.tipOf(o.cid))}for(let c of s){let o=`archived[${c.target}]`,h=t.resolve(c.target),i=h?t.tipOf(h.cid):null;if(!i||(t.trust.get(i)??null)==="archived"){r.push({code:"ARCHIVE_TARGET_UNKNOWN",detail:`${o}: target does not resolve to an existing, live item`});continue}let d=As(t,i);if(!d.has(c.basis)){r.push({code:"ARCHIVE_FOREIGN_PROVENANCE",detail:`${o}: its provenance does not include ${c.basis} \u2014 an archive claim must come from a source that evidences the item`});continue}if(!a.has(c.basis)){r.push({code:"ARCHIVE_WITHOUT_COMPLETE_CLAIM",detail:`${o}: ${c.basis} was not read by this extraction \u2014 a completeness claim only counts for a source this run actually read`});continue}if(!Ts(e,c.basis)){r.push({code:"ARCHIVE_WITHOUT_COMPLETE_CLAIM",detail:`${o}: archiving needs an EXPLICIT complete extraction claim for ${c.basis} (the omitted-claims default does not count) \u2014 add extraction_claims`});continue}if(u.has(i)){r.push({code:"ARCHIVE_TARGET_MATCHED",detail:`${o}: this proposal also matches the target via matches_existing \u2014 a matched item cannot be archived by the same extraction; propose the change as an update instead`});continue}let g=[...d].filter(l=>l!==c.basis);if(g.length>0){r.push({code:"ARCHIVE_OTHER_LIVE_EVIDENCE",detail:`${o}: still evidenced by ${g.join(", ")} \u2014 an item another live source evidences is never archived from here`});continue}n.push({op:c,cid:i})}return{valid:n,errors:r}}function hr(e,t,n,r){let s=ae(t.type)?.cardinality;if(s!=="one-live-per-src"&&s!=="one-live-per-src-and-dst")return null;let a=c=>n.freed?.has(c)??!1,u=e.edgesFrom(t.src).find(c=>c.type===t.type&&!n.retracted.has(c.ecid)&&!e.superseded.has(c.dst)&&!a(c.dst))??n.pending.find(c=>c.type===t.type&&c.src===t.src);if(u){let c="ecid"in u?` (${u.ecid})`:" in this record";return{code:"CARDINALITY_VIOLATION",detail:`${r}: ${t.type} from ${t.src} already has a live edge${c} \u2014 supersede or retract it first`}}if(s==="one-live-per-src-and-dst"){let c=e.edgesInto(t.dst).find(o=>o.type===t.type&&o.src!==t.src&&!n.retracted.has(o.ecid)&&!e.superseded.has(o.src)&&!a(o.src))??n.pending.find(o=>o.type===t.type&&o.dst===t.dst&&o.src!==t.src);if(c){let o="ecid"in c?` (${c.ecid})`:" in this record";return{code:"CARDINALITY_VIOLATION",detail:`${r}: ${t.type} onto ${t.dst} already has a live edge${o} \u2014 strict 1:1, supersede or retract it first`}}}return null}function Kt(e,t,n){return e.superseded.has(n)}function mr(e){let{graph:t,oldTip:n,newCid:r,newLabel:s,by:a}=e,u=[],c=[],o=[],h=[],i=new Set;for(let d of t.edgesFrom(n)){if(d.type===R.DERIVES||e.skipEcids?.has(d.ecid))continue;c.push({kind:"edge",ecid:d.ecid,reason:e.reason,by:a}),i.add(d.ecid);let g=e.dstRedirect?.get(d.dst)??d.dst,l=t.nodeLabel.get(d.dst)??"(unknown)",p=de(d.type,s,l,d.props);if(p.length>0){o.push(`rebless ${d.type} \u2192 ${d.dst}: ${p.map(E=>E.detail).join("; ")}`);continue}let _=hr(t,{type:d.type,src:r,dst:g},{pending:h,retracted:i},`rebless ${d.type}`);if(_){o.push(_.detail);continue}let S=B(d.type,r,g,d.props);if(t.superseded.has(S)){o.push(`rebless ${d.type} \u2192 ${g}: the re-derived edge (${S}) was retracted \u2014 retraction is terminal, the successor cannot revive it`);continue}u.push({ecid:S,type:d.type,src:r,dst:g,props:d.props}),h.push({src:r,dst:g,type:d.type})}return{edges:u,supersessions:c,errors:o}}var pe=e=>[...new Set(e)].sort();function Ke(e,t){return{ucTargets:[...e?.ucTargets??[],...t?.ucTargets??[]],sourcePins:[...e?.sourcePins??[],...t?.sourcePins??[]],...e?.generationTicket??t?.generationTicket?{generationTicket:e?.generationTicket??t?.generationTicket}:{}}}function Ls(e,t){let n=new Set,r=new Set,s=new Set,a=new Set;for(let c of e.nodes)n.add(c.cid);for(let c of e.edges)r.add(c.ecid),n.add(c.src),n.add(c.dst);for(let c of e.supersessions)c.kind==="node"?(n.add(c.old),c.new!==null&&n.add(c.new)):r.add(c.ecid);for(let c of e.names??[])a.add(c.slug);for(let c of Object.keys(e.source_head_moves))s.add(c);for(let c of e.review)n.add(c.id);for(let c of e.judgements??[])(t(c.about)?n:r).add(c.about);if(Array.isArray(e.extraction_of))for(let c of e.extraction_of)s.add(c.source_id);else if(typeof e.extraction_of=="string"){n.add(e.extraction_of);for(let c of e.edges)c.props.source_cid===e.extraction_of&&typeof c.props.source_id=="string"&&s.add(c.props.source_id)}for(let c of Object.keys(e.media??{}))s.add(c);e.conv&&s.add(e.conv.source_id);for(let c of e.executions??[])n.add(c.about);e.design_of&&n.add(e.design_of.uc_cid),e.design_generation&&(n.add(e.design_generation.uc_root),n.add(e.design_generation.uc_cid));let u=e.design_phase;typeof u?.uc_root=="string"&&n.add(u.uc_root);for(let c of e.criteria_removed??[])(t(c.about)?n:r).add(c.about);return{nodes:pe(n),edges:pe(r),sources:pe(s),names:pe(a)}}function _r(e,t,n){let r=new Set,s=new Set,a=new Set,u=new Set,c=new Set;for(let h of e.ucTargets??[]){let i=n.resolve(h.ref)?.tip??n.tipOf(h.ref);a.add(i),r.add(i)}for(let h of e.sourcePins??[])u.add(h.source_id);if(t!==null){let h=Ls(t,i=>n.resolve(i)!==null);for(let i of h.nodes)r.add(i);for(let i of h.edges)s.add(i);for(let i of h.sources)u.add(i);for(let i of h.names)c.add(i)}let o=e.generationTicket;return{nodes:pe(r),edges:pe(s),usecases:pe(a),sources:pe(u),names:pe(c),generation:o?{ucRoot:o.uc_root,gen:o.next_gen}:null}}import{randomUUID as Ds}from"crypto";var Fs=Ds(),vr=0;function yr(){return vr+=1,`${Fs}:${vr}`}var Ms={resolve:e=>({cid:e,tip:e,superseded:!1}),tipOf:e=>e};function ve(e,t,n){let r=_r(n.scope??{},t,n.graph??Ms),s=e.append(t,{intent:n.intent,footprint:r,basis:e.parse(n.expectPrev),eventId:mn()??yr(),...n.provenance?{provenance:n.provenance}:{},...n.busyRetry?{busyRetry:n.busyRetry}:{}});if(s.warnings&&!n.returnWarnings)for(let a of s.warnings)_n(a,"INDEX_REFRESH_FAILED","warning: ");return s}var X=class extends Map{constructor(n,r){super();this.resolve=n;this.enumerate=r}filled=!1;missing=new Set;fetch(n){if(super.has(n))return!0;if(this.missing.has(n))return!1;let r=this.resolve(n);return r===void 0?(this.missing.add(n),!1):(super.set(n,r),!0)}has(n){return this.fetch(n)}get(n){return this.fetch(n)?super.get(n):void 0}fill(){if(!this.filled){let n=new Map(super.entries());super.clear();for(let[r,s]of this.enumerate())n.has(r)?super.set(r,n.get(r)):s!==void 0&&super.set(r,s);this.filled=!0}return this}get size(){return this.fill(),super.size}keys(){return this.fill(),super.keys()}values(){return this.fill(),super.values()}entries(){return this.fill(),super.entries()}forEach(n,r){this.fill(),super.forEach(n,r)}[Symbol.iterator](){return this.fill(),super[Symbol.iterator]()}},wt=class extends Set{constructor(n,r){super();this.member=n;this.all=r}filled=!1;has(n){return super.has(n)?!0:this.member(n)?(super.add(n),!0):!1}fill(){if(!this.filled){super.clear();for(let n of this.all())super.add(n);this.filled=!0}return this}get size(){return this.fill(),super.size}values(){return this.fill(),super.values()}keys(){return this.fill(),super.keys()}entries(){return this.fill(),super.entries()}forEach(n,r){this.fill(),super.forEach(n,r)}[Symbol.iterator](){return this.fill(),super[Symbol.iterator]()}},$e=e=>{let t=!1,n;return()=>(t||(n=e(),t=!0),n)};function Er(e,t={token:null}){let n=e.head(),r=t.token===null?{token:n}:t,s=r.token,a=s===null?null:e.resolveToken(s),u=a?.seq??0,c=a?.hash??null,o=$e(()=>e.nodeIds(r)),h=$e(()=>e.supersessions(r)),i=$e(()=>e.allNames(r)),d=$e(()=>e.retractedEdges(r)),g=new Map,l=f=>()=>{let v=g.get(f);return v||(v=$e(()=>e.factIds(r,f)),g.set(f,v)),v()},p=f=>f===null?void 0:f,_=(f,v)=>()=>f().map(I=>[I,v(I)]),S=f=>p(e.labelOf(f,r)),E=new X(S,()=>o().map(f=>[f.cid,f.label])),O=f=>p(e.trustOf(f,r)),N=new X(O,_(l("trust"),O)),U=f=>p(e.archivedReason(f,r)),T=new X(U,_(l("archivedReason"),U)),G=f=>e.supersededBy(f,r),P=new X(G,()=>h().map(f=>[f.id,f.next])),fe=new X(f=>p(e.cidOfName(f,r)),()=>i().map(f=>[f.slug,f.cid])),y=$e(()=>{let f=new Map;for(let{slug:v,cid:I}of i())f.set(I,v);return[...f.entries()]}),$=new X(f=>p(e.assignedName(f,r)),y),F=new X(f=>e.headOf(f,r),()=>e.sourceIds(r).map(f=>[f.sourceId,f.head])),D=f=>p(e.convChain(f,r)),K=new X(D,_(l("conv"),D)),W=f=>p(e.completenessOf(f,r)),ge=new X(W,_(l("completeness"),W)),oe=f=>p(e.designOf(f,r)),ye=new X(oe,_(l("designOf"),oe)),Re=f=>p(e.designFacts(f,r).generation),Qt=new X(Re,_(l("designGeneration"),Re)),m=new wt(f=>e.appliedEvent(f,r)!==null,()=>e.appliedEventsAt(r)),w=$e(()=>new Set(e.extractedSources(r))),q=new wt(f=>w().has(f),()=>e.extractedSources(r)),J=new Map,Oe=f=>{let v=J.get(f);if(v!==void 0)return v;let I=e.tipOf(f,r);return J.set(f,I),I},x=f=>{let v=_t(f,{hasNode:A=>e.labelOf(A,r)!==null,cidOfName:A=>e.cidOfName(A,r),headOf:A=>e.headOf(A,r)});if(v===null)return null;let I=Oe(v);return{cid:v,tip:I,superseded:G(v)!==void 0||G(I)!==void 0}},ke=f=>e.edgesFrom(f,r),Ne=f=>e.edgesInto(f,r),Q=f=>Ne(f).filter(v=>v.type===R.DERIVES),C=Ye({supersededBy:G,edgesInto:Ne,edgesFrom:ke,headOf:f=>e.headOf(f,r),convChain:f=>e.convChain(f,r)?.chain,pluginOf:f=>e.mediaOf(f,r)?.plugin}),Zt=f=>Be(f,G,()=>h().map(v=>[v.id,v.next]),v=>E.get(v));return{heads:F,trust:N,nodeLabel:E,superseded:P,names:fe,nameOf:$,archivedReason:T,appliedEvents:m,convChains:K,mediaOf:f=>yt(e.mediaOf(f,r)),extractedSourceCids:q,extractionCompleteness:ge,designOf:ye,designGenerationOf:Qt,latestHash:c,lastSeq:u,hasNode:f=>e.labelOf(f,r)!==null,getNode:f=>e.getNode(f,r),byLabel:f=>e.byLabel(f,r).map(v=>({cid:v,content:e.getNode(v,r)?.content??{}})),edgesFrom:ke,edgesInto:Ne,derivesInto:Q,resolve:x,tipOf:Oe,displayNameOf:f=>e.nameOf(f,r),stale:C,staleList:()=>e.staleList(r),execHistory:f=>e.execHistory(f,r),retractedEdgesTouching:f=>{let v=Zt(f),I=d(),A=[],M=new Set;for(let j of v)for(let{edge:V,retraction:L}of[...I.filter(H=>H.edge.src===j),...I.filter(H=>H.edge.dst===j)])M.has(V.ecid)||(M.add(V.ecid),A.push({...V,retraction:L}));return A}}}var Je=/^[a-z0-9][a-z0-9-]{1,63}$/;function Sr(e,t,n,r){if(!t)return{error:{code:"SUPERSEDE_TARGET_MISSING",detail:"supersede verdict needs a target (slug or cid)"}};let s=e.resolve(t);return s?s.superseded||r.has(s.cid)?{error:{code:"ALREADY_SUPERSEDED",detail:`${t} is already superseded (tip: ${s.tip})`}}:s.cid===n?{error:{code:"SELF_SUPERSEDE",detail:"a node cannot supersede itself"}}:{targetCid:s.cid}:{error:{code:"UNKNOWN_SUPERSEDE_TARGET",detail:`${t} names nothing in the graph`}}}function Us(e,t,n,r,s=[]){if(!ae(t)?.acyclic)return null;if(n===r)return{code:"EDGE_CYCLE",detail:`${t} ${n} \u2192 itself`};let u=h=>[...e.edgesFrom(h).filter(i=>i.type===t).map(i=>i.dst),...s.filter(i=>i.type===t&&i.src===h).map(i=>i.dst)],c=new Set,o=[r];for(;o.length>0;){let h=o.pop();if(h===n)return{code:"EDGE_CYCLE",detail:`${t} ${n} \u2192 ${r} closes a cycle`};c.has(h)||(c.add(h),o.push(...u(h)))}return null}function oc(e,t,n,r){let a=ae(t)?.cardinality;if(a!=="one-live-per-src"&&a!=="one-live-per-src-and-dst")return null;let u=e.edgesFrom(n).filter(c=>c.type===t&&!e.superseded.has(c.dst));if(u.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${t} from ${n} already has a live edge (${u[0].ecid}) \u2014 supersede it first`};if(a==="one-live-per-src-and-dst"&&r!==void 0){let c=e.edgesInto(r).filter(o=>o.type===t&&!e.superseded.has(o.src));if(c.length>0)return{code:"CARDINALITY_VIOLATION",detail:`${t} onto ${r} already has a live edge (${c[0].ecid}) \u2014 strict 1:1, supersede it first`}}return null}var Jt=new Set(["high","med","low"]),St=e=>e.cites&&e.cites.length>0?e.cites:[e.cite];function bt(e){let t=0;for(let n of e)typeof n=="object"&&n!==null&&"op"in n&&t++;return t===0?"flat":t===e.length?"ops":"mixed"}var Ps=/^c[1-9][0-9]*$/;function br(e,t,n,r){let s=new Map,a=[],u=[];for(let[o,h]of t.entries()){let i=`${e}.updated.criteria[${o}]`;if(h.op==="keep"||h.op==="remove"){if(!Ps.test(h.ref??"")){r.push({code:"CRITERIA_REF_UNKNOWN",detail:`${i}: ref ${JSON.stringify(h.ref)} is not a c<N> criterion index`});continue}if(s.has(h.ref)){r.push({code:"CRITERIA_REF_DUPLICATE",detail:`${i}: ${h.ref} is already named by another op \u2014 every prior criterion appears in exactly one keep or remove`});continue}s.set(h.ref,h);let d=Number.parseInt(h.ref.slice(1),10);if(d>n.length){r.push({code:"CRITERIA_REF_UNKNOWN",detail:`${i}: ${h.ref} \u2014 the live target has ${n.length} criteria`});continue}if(n[d-1]!==h.text){r.push({code:"CRITERIA_REF_MISMATCH",detail:`${i}: ${h.ref} echo mismatch \u2014 the live target's criterion ${d} reads ${JSON.stringify(n[d-1])}, the op echoed ${JSON.stringify(h.text)} \u2014 re-read the node and re-emit`});continue}h.op==="remove"&&(a.push(h.text),(!h.reason||!h.reason.trim())&&r.push({code:"EMPTY_REASON",detail:`${i}: a remove op carries its reason`}))}else!h.text||!h.text.trim()?r.push({code:"EMPTY_CRITERION",detail:`${i}: set text is empty`}):u.push(h.text)}let c=[];for(let o=1;o<=n.length;o++)s.has(`c${o}`)||c.push(`c${o}`);c.length>0&&r.push({code:"CRITERIA_PARTITION_INCOMPLETE",detail:`${e}: prior criteria ${c.join(", ")} named by no keep/remove op \u2014 every prior criterion must be kept or removed (with a reason)`});for(let o of a)u.includes(o)&&r.push({code:"CRITERIA_OP_CONFLICT",detail:`${e}: ${JSON.stringify(o)} is removed AND re-set in the same update \u2014 drop one of the two ops`})}function cc(e,t,n){let r=[],s=ht(e,"proposal");s!==null&&r.push({code:"NUL_IN_TEXT",detail:ar(s)});let a=e.sources??[e.source],u=new Map(a.map(i=>[i.source_id,i.source_cid])),c=new Map;if(typeof t=="string")c.set(e.source.source_id,{media:n.mediaOf(e.source.source_cid),numberedText:t});else for(let[i,d]of t)c.set(i,d);for(let i of a)n.hasNode(i.source_cid)||r.push({code:"MISSING_SOURCE_NODE",detail:`source ${i.source_id} (${i.source_cid}) is not a committed node \u2014 ingest it first`});let o=(i,d)=>{let g=d.source_id??e.source.source_id;if(!u.has(g)){r.push({code:"CITE_SOURCE_UNKNOWN",detail:`${i}: cite source ${JSON.stringify(g)} is not in read_basis`});return}let l=c.get(g);if(!l){r.push({code:"MISSING_SOURCE_NODE",detail:`${i}: no citable text available for source ${g}`});return}for(let p of ur(l.media,d,l.numberedText))r.push({code:p.code,detail:`${i}: ${p.detail}`})},h=new Set;for(let i of e.use_cases){if(h.has(i.temp_ref)&&r.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${i.temp_ref}`}),h.add(i.temp_ref),(!i.title||!i.title.trim())&&r.push({code:"EMPTY_TITLE",detail:`${i.temp_ref}: title is empty`}),Jt.has(i.risk)||r.push({code:"BAD_RISK",detail:`${i.temp_ref}: risk ${JSON.stringify(i.risk)} not in high|med|low`}),!i.cite||!i.cite.anchor)r.push({code:"MISSING_CITE",detail:`${i.temp_ref}: every derived use-case must carry a cite`});else for(let g of St(i))o(i.temp_ref,g);i.matches_existing&&!n.hasNode(i.matches_existing.cid)&&r.push({code:"UNKNOWN_MATCH",detail:`${i.temp_ref}: matches_existing ${i.matches_existing.cid} is not in the graph`});for(let[g,l]of(i.criteria??[]).entries())(!l.text||!l.text.trim())&&r.push({code:"EMPTY_CRITERION",detail:`${i.temp_ref}.criteria[${g}]: text is empty`}),!l.cite||!l.cite.anchor?r.push({code:"MISSING_CITE",detail:`${i.temp_ref}.criteria[${g}]: every criterion carries its own cite`}):o(`${i.temp_ref}.criteria[${g}]`,l.cite);let d=i.updated?.criteria??[];if(d.length>0){let g=bt(d);if(g==="mixed")r.push({code:"CRITERIA_SHAPE_MIXED",detail:`${i.temp_ref}.updated.criteria mixes op-shaped (keep/set/remove) and {text, cite} entries \u2014 emit ONE shape for the whole array`});else if(g==="ops"){let l=d,p=i.matches_existing?Gs(n,i.matches_existing.cid):null;if(!p)r.push({code:"CRITERIA_REF_UNKNOWN",detail:`${i.temp_ref}: op-union criteria address a prior version \u2014 they need a resolvable matches_existing target`});else{let _=n.getNode(p.cid)?.content.criteria??[];br(i.temp_ref,l,_,r)}for(let[_,S]of l.entries())S.op==="set"&&(!S.cite||!S.cite.anchor?r.push({code:"MISSING_CITE",detail:`${i.temp_ref}.updated.criteria[${_}]: a set op carries the proposing source's cite`}):o(`${i.temp_ref}.updated.criteria[${_}]`,S.cite))}else for(let[l,p]of d.entries())(!p.text||!p.text.trim())&&r.push({code:"EMPTY_CRITERION",detail:`${i.temp_ref}.updated.criteria[${l}]: text is empty`}),!p.cite||!p.cite.anchor?r.push({code:"MISSING_CITE",detail:`${i.temp_ref}.updated.criteria[${l}]: every updated criterion carries its own cite`}):o(`${i.temp_ref}.updated.criteria[${l}]`,p.cite)}}return r.push(...Bt(e,n).errors),r}function js(e,t,n){return`${e}:${t}:${n}`}function Vs(e,t,n,r){let s=`${t}:${n}:`,a=0;for(let u of e.appliedEvents){if(!u.startsWith(s))continue;let c=u.slice(s.length);if(!/^\d+$/.test(c))continue;let o=Number.parseInt(c,10);o>a&&(a=o)}return Array.from({length:r},(u,c)=>js(t,n,a+1+c))}function Gs(e,t){let n=e.resolve(t),r=Wt(e,t);return n===null||r===null?null:{cid:r,redirected:r!==n.cid}}function ac(e){let{store:t,graph:n,proposal:r,proposalId:s,verdicts:a,by:u,allowStaleBasis:c,extractorVersion:o,autoName:h}=e,i=t.head(),d=t.serialize(i);if(!c&&!t.sameToken(t.parse(r.read_basis),i))return{record:null,errors:[{code:"STALE_BASIS",detail:`proposal read_basis ${String(r.read_basis)} != latest ${String(d)}`}]};for(let m of r.sources??[r.source])if(!n.hasNode(m.source_cid))return{record:null,errors:[{code:"MISSING_SOURCE_NODE",detail:`source ${m.source_id} (${m.source_cid}) is not a committed node \u2014 ingest it first`}]};let g=new Map((r.sources??[r.source]).map(m=>[m.source_id,m.source_cid])),l={supersedeTarget:{},matches_existing:{},conflicts_with:{},depends_on_hint:{},read_basis_heads:Object.fromEntries(g)},p=[],_=[],S=new Map,E=[],O=n.mediaOf(r.source.source_cid),N=new Set,U=[],T=[],G=[],P=[];for(let m of Bt(r,n).valid)P.push({id:m.cid,kind:"pending_archive",resolution:"pending",edit:null,reason:m.op.reason,by:u});let fe=[],y=[],$=new Set,F=new Set,D=(m,w,q)=>{let J=Sr(n,w.supersedeTarget,q,$);if("error"in J){p.push({code:J.error.code,detail:`${m}: ${J.error.detail}`});return}$.add(J.targetCid),l.supersedeTarget[m]=J.targetCid,fe.push({kind:"node",old:J.targetCid,new:q,reason:w.reason??`superseded via review by ${u.id}`,by:u})};for(let m of r.use_cases){let w=a.get(m.temp_ref)??{resolution:"skipped"};N.has(m.temp_ref)&&p.push({code:"DUP_TEMP_REF",detail:`duplicate temp_ref ${m.temp_ref}`}),N.add(m.temp_ref),m.conflicts_with&&(l.conflicts_with[m.temp_ref]=m.conflicts_with.map(f=>n.resolve(f)?.cid??null)),(!m.title||!m.title.trim())&&p.push({code:"EMPTY_TITLE",detail:`${m.temp_ref}: title is empty`}),Jt.has(m.risk)||p.push({code:"BAD_RISK",detail:`${m.temp_ref}: risk ${JSON.stringify(m.risk)} not in high|med|low`});let q=Ae(m.cite?.anchor??""),J=m.cite?.source_id!==void 0&&g.has(m.cite.source_id)?n.mediaOf(g.get(m.cite.source_id)):O;if(J.format==="image"){if(q?.kind!=="img-whole"){p.push({code:m.cite?.anchor?"CITE_ANCHOR_INVALID":"MISSING_CITE",detail:`${m.temp_ref}: image cites are anchor-only (img#whole)`});continue}}else if(q?.kind==="img-part"){if(!(J.images??[]).some(v=>v.ref===q.ref)){p.push({code:"CITE_ANCHOR_INVALID",detail:`${m.temp_ref}: anchor ${m.cite?.anchor} names no embedded image of this source version`});continue}}else if(!m.cite||!m.cite.anchor||!m.cite.quote){p.push({code:"MISSING_CITE",detail:`${m.temp_ref}: every derived use-case must cite anchor+quote`});continue}w.resolution==="edited"&&w.edit&&(w.edit.title!==void 0&&!w.edit.title.trim()&&p.push({code:"EMPTY_TITLE",detail:`${m.temp_ref}: edited title is empty`}),w.edit.risk!==void 0&&!Jt.has(w.edit.risk)&&p.push({code:"BAD_RISK",detail:`${m.temp_ref}: edited risk ${JSON.stringify(w.edit.risk)} invalid`}));let Oe=ze({title:w.edit?.title??m.title,description:m.description,summary:w.edit?.summary??m.summary,actors:m.actors,value:m.value,risk:w.edit?.risk??m.risk,...m.criteria&&m.criteria.length>0?{criteria:m.criteria.map(f=>f.text)}:{}}),x=ee("usecase",Oe),ke=m.cite.source_id??r.source.source_id,Ne=g.get(ke);if(m.cite.source_id!==void 0&&Ne===void 0){p.push({code:"CITE_SOURCE_UNKNOWN",detail:`${m.temp_ref}: cite source ${JSON.stringify(ke)} is not in read_basis`});continue}let Q={source_id:ke,source_cid:Ne??r.source.source_cid,anchor:m.cite.anchor,...m.cite.quote?{quote:m.cite.quote}:{}};if(m.matches_existing&&!n.hasNode(m.matches_existing.cid)){p.push({code:"UNKNOWN_MATCH",detail:`${m.temp_ref}: matches_existing ${m.matches_existing.cid} is not in the graph`});continue}let C=m.matches_existing?.cid??(n.hasNode(x)?x:null);if(C&&n.superseded.has(C)){let f=n.tipOf(C);C=n.superseded.has(f)?null:f}if(C&&m.matches_existing&&(l.matches_existing[m.temp_ref]=C),C&&m.matches_existing&&!e.matchUnreviewed&&(n.trust.get(C)??null)==="derived"){let f=m.updated?.criteria??[];if(m.changed&&f.length>0&&bt(f)==="ops"&&(w.resolution==="approved"||w.resolution==="edited")){p.push({code:"UC_UNREVIEWED",detail:nn().text("UC_UNREVIEWED.merge_target",{temp_ref:m.temp_ref,target:C.slice(0,19)})});continue}let v=(e.probeHits??[]).find(I=>I.tempRef===m.temp_ref&&I.candidateCid===C);E.push({tempRef:m.temp_ref,candidate_cid:C,score:v?.score??1,scorer:v?.scorer??"lexical_fallback"}),C=null}if(C){if(m.changed&&(w.resolution==="approved"||w.resolution==="edited")){let f=m.updated;if(!f||Object.keys(f).length===0){p.push({code:"CHANGED_NEEDS_PAYLOAD",detail:`${m.temp_ref}: changed:true needs an updated{...} payload naming the moved fields`});continue}let v=n.getNode(C)?.content??{},I=f.criteria??[],A=I.length>0?bt(I):"flat";if(A==="mixed"){p.push({code:"CRITERIA_SHAPE_MIXED",detail:`${m.temp_ref}.updated.criteria mixes op-shaped (keep/set/remove) and {text, cite} entries \u2014 emit ONE shape for the whole array`});continue}if(A==="ops"){let M=I,j=v.criteria??[],V=p.length;br(m.temp_ref,M,j,p);for(let[xe,Me]of M.entries())Me.op==="set"&&(!Me.cite||!Me.cite.anchor)&&p.push({code:"MISSING_CITE",detail:`${m.temp_ref}.updated.criteria[${xe}]: a set op carries the proposing source's cite`});if(p.length>V)continue;let L=M.filter(xe=>xe.op!=="remove").map(xe=>xe.text),H=ze({title:w.edit?.title??f.title??String(v.title??m.title),...f.description??v.description?{description:f.description??v.description}:{},...w.edit?.summary??f.summary??v.summary?{summary:w.edit?.summary??f.summary??v.summary}:{},...f.actors??v.actors?{actors:f.actors??v.actors}:{},...f.value??v.value?{value:f.value??v.value}:{},risk:w.edit?.risk??f.risk??String(v.risk??m.risk),...L.length>0?{criteria:L}:{}}),ne=ee("usecase",H);if(ne!==C){for(let k of Z("usecase",H))p.push({code:k.code,detail:`${m.temp_ref}: ${k.detail}`});U.push({cid:ne,label:se.USECASE,content:H});for(let k of St(m)){let re=k.source_id??r.source.source_id,Y=g.get(re);if(!Y){p.push({code:"CITE_SOURCE_UNKNOWN",detail:`${m.temp_ref}: cite source ${JSON.stringify(re)} is not in read_basis`});continue}let z={source_id:re,source_cid:Y,anchor:k.anchor,...k.quote?{quote:k.quote}:{}};T.push({ecid:B("DERIVES",Y,ne,z),type:R.DERIVES,src:Y,dst:ne,props:z})}let Me=Et(n,C).flatMap(k=>n.edgesInto(k)).filter(k=>k.type===R.DERIVES&&typeof k.props.claim=="string");for(let k of M){if(k.op!=="keep")continue;let re=new Set;for(let Y of Me){let z=Y.props;if(z.claim!==k.text)continue;let en=`${z.source_id}|${z.source_cid}|${z.anchor}${z.reconfirms===void 0?"":`|${z.reconfirms.join(",")}`}`;if(re.has(en))continue;re.add(en);let tn={...Y.props};T.push({ecid:B("DERIVES",Y.src,ne,tn),type:R.DERIVES,src:Y.src,dst:ne,props:tn})}}for(let k of M){if(k.op!=="set")continue;let re=k.cite.source_id??r.source.source_id,Y=g.get(re);if(!Y){p.push({code:"CITE_SOURCE_UNKNOWN",detail:`${m.temp_ref}: set cite source ${JSON.stringify(re)} is not in read_basis`});continue}let z={source_id:re,source_cid:Y,anchor:k.cite.anchor,...k.cite.quote?{quote:k.cite.quote}:{},claim:k.text};T.push({ecid:B("DERIVES",Y,ne,z),type:R.DERIVES,src:Y,dst:ne,props:z})}for(let k of M)k.op==="remove"&&_.push({about:C,ref:k.ref,text:k.text,reason:k.reason});D(m.temp_ref,{resolution:"supersede",supersedeTarget:C,reason:w.reason??`criteria merge: ${r.source.source_id} (${M.filter(k=>k.op==="keep").length} kept, ${M.filter(k=>k.op==="set").length} set, ${M.filter(k=>k.op==="remove").length} removed)`},ne),P.push({id:ne,kind:"review-item",resolution:w.resolution,edit:w.resolution==="edited"?{...w.edit}:null,reason:null,by:u});continue}}else{let M=I.map(L=>typeof L=="string"?{text:L,cite:void 0}:L),j=ze({title:w.edit?.title??f.title??String(v.title??m.title),...f.description??v.description?{description:f.description??v.description}:{},...w.edit?.summary??f.summary??v.summary?{summary:w.edit?.summary??f.summary??v.summary}:{},...f.actors??v.actors?{actors:f.actors??v.actors}:{},...f.value??v.value?{value:f.value??v.value}:{},risk:w.edit?.risk??f.risk??String(v.risk??m.risk),...f.criteria?M.length>0?{criteria:M.map(L=>L.text)}:{}:v.criteria?{criteria:v.criteria}:{}}),V=ee("usecase",j);if(V!==C){for(let L of Z("usecase",j))p.push({code:L.code,detail:`${m.temp_ref}: ${L.detail}`});U.push({cid:V,label:se.USECASE,content:j}),T.push({ecid:B("DERIVES",Q.source_cid,V,Q),type:R.DERIVES,src:Q.source_cid,dst:V,props:Q});for(let L of M){if(!L.cite)continue;let H={source_id:r.source.source_id,source_cid:r.source.source_cid,anchor:L.cite.anchor,...L.cite.quote?{quote:L.cite.quote}:{},claim:L.text};T.push({ecid:B("DERIVES",H.source_cid,V,H),type:R.DERIVES,src:H.source_cid,dst:V,props:H})}D(m.temp_ref,{resolution:"supersede",supersedeTarget:C,reason:w.reason??`matches-but-changed: ${r.source.source_id} moved (${Object.keys(f).join(", ")})`},V),P.push({id:V,kind:"review-item",resolution:w.resolution,edit:w.resolution==="edited"?{...w.edit}:null,reason:null,by:u});continue}for(let L of M){if(!L.cite)continue;let H={source_id:r.source.source_id,source_cid:r.source.source_cid,anchor:L.cite.anchor,...L.cite.quote?{quote:L.cite.quote}:{},claim:L.text};T.push({ecid:B("DERIVES",H.source_cid,C,H),type:R.DERIVES,src:H.source_cid,dst:C,props:H})}}}if(m.changed&&w.resolution==="skipped"){let f=m.updated?.criteria??[];f.length>0&&bt(f)==="ops"&&P.push({id:C,kind:"pending_update",resolution:"pending",edit:{temp_ref:m.temp_ref,source_id:r.source.source_id,updated:m.updated},reason:m.change_note??null,by:u})}if(w.resolution!=="rejected"){for(let f of St(m)){let v=f.source_id??r.source.source_id,I=g.get(v);if(!I){p.push({code:"CITE_SOURCE_UNKNOWN",detail:`${m.temp_ref}: cite source ${JSON.stringify(v)} is not in read_basis`});continue}let A={source_id:v,source_cid:I,anchor:f.anchor,...f.quote?{quote:f.quote}:{}};T.push({ecid:B("DERIVES",I,C,A),type:R.DERIVES,src:I,dst:C,props:A})}(w.resolution==="approved"||w.resolution==="edited"||w.resolution==="supersede")&&P.push({id:C,kind:"review-item",resolution:"approved",edit:null,reason:null,by:u}),w.resolution==="supersede"&&D(m.temp_ref,w,C)}continue}for(let f of Z("usecase",Oe))p.push({code:f.code,detail:`${m.temp_ref}: ${f.detail}`});for(let f of de(R.DERIVES,"source","usecase",Q))p.push({code:f.code,detail:`${m.temp_ref}: ${f.detail}`});U.push({cid:x,label:se.USECASE,content:Oe}),S.set(m.temp_ref,x),T.push({ecid:B("DERIVES",Q.source_cid,x,Q),type:R.DERIVES,src:Q.source_cid,dst:x,props:Q});for(let f of St(m).slice(1)){let v=f.source_id??r.source.source_id,I=g.get(v);if(!I){p.push({code:"CITE_SOURCE_UNKNOWN",detail:`${m.temp_ref}: cite source ${JSON.stringify(v)} is not in read_basis`});continue}let A={source_id:v,source_cid:I,anchor:f.anchor,...f.quote?{quote:f.quote}:{}};for(let M of de(R.DERIVES,"source","usecase",A))p.push({code:M.code,detail:`${m.temp_ref}: ${M.detail}`});T.push({ecid:B("DERIVES",I,x,A),type:R.DERIVES,src:I,dst:x,props:A})}for(let f of m.criteria??[]){let v=f.cite.source_id??r.source.source_id,I=g.get(v);if(!I){p.push({code:"CITE_SOURCE_UNKNOWN",detail:`${m.temp_ref}: criterion cite source ${JSON.stringify(v)} is not in read_basis`});continue}let A={source_id:v,source_cid:I,anchor:f.cite.anchor,...f.cite.quote?{quote:f.cite.quote}:{},claim:f.text};T.push({ecid:B("DERIVES",A.source_cid,x,A),type:R.DERIVES,src:A.source_cid,dst:x,props:A})}for(let f of m.depends_on_hint??[]){let v=j=>j.toLowerCase().trim().replace(/\s+/g," "),I=null,A=wr(n,f);if(A.ok&&(I=A.cid),!I){for(let{cid:j,content:V}of n.byLabel(se.USECASE))if(!n.superseded.has(j)&&v(String(V.title??""))===v(f)){I=j;break}}if(!I){let j=U.find(V=>V.label===se.USECASE&&v(String(V.content.title??""))===v(f));j&&(I=j.cid)}!I||I===x||Us(n,R.DEPENDS_ON,x,I,G)||G.some(j=>j.src===x&&j.dst===I)||(T.push({ecid:B(R.DEPENDS_ON,x,I,{reason:"extract hint"}),type:R.DEPENDS_ON,src:x,dst:I,props:{reason:"extract hint"}}),G.push({src:x,dst:I,type:R.DEPENDS_ON}),(l.depends_on_hint[m.temp_ref]??=[]).push(I))}if((w.resolution==="approved"||w.resolution==="edited"||w.resolution==="supersede")&&n.superseded.get(x)===null&&!$.has(x)&&fe.push({kind:"node",old:x,new:x,reason:`re-minted after tombstone via review by ${u.id}`,by:u}),h){let f=Yt("usecase",v=>F.has(v),n.names.keys());f!==null&&!n.nameOf.has(x)&&(F.add(f),y.push({cid:x,slug:f,by:u}))}w.resolution==="approved"?P.push({id:x,kind:"review-item",resolution:"approved",edit:null,reason:null,by:u}):w.resolution==="edited"?P.push({id:x,kind:"review-item",resolution:"edited",edit:{...w.edit},reason:null,by:u}):w.resolution==="rejected"?P.push({id:x,kind:"review-item",resolution:"rejected",edit:null,reason:w.reason??null,by:u}):w.resolution==="supersede"&&(P.push({id:x,kind:"review-item",resolution:"approved",edit:null,reason:w.reason??null,by:u}),D(m.temp_ref,w,x))}if(p.length)return{record:null,errors:p};let K=wn(En(t,n)).all(T);if(K.faults.length)return{record:null,errors:K.faults};let W=new Date().toISOString(),ge=(r.sources?.length??0)>1||(r.extraction_claims?.length??0)>0,oe;if(ge){let m=[];if(r.extraction_claims==null)m.push({source_id:r.source.source_id,source_cid:r.source.source_cid,completeness:"complete",...o?{extractor_version:o}:{},at:W});else{let w=new Map(r.extraction_claims.map(q=>[q.source_id,q.completeness]));for(let q of r.sources??[r.source]){let J=w.get(q.source_id)??null;J!==null&&m.push({source_id:q.source_id,source_cid:q.source_cid,completeness:J,...o?{extractor_version:o}:{},at:W})}}oe=m}else oe=r.source.source_cid;let ye=[];for(let m of e.probeHits??[])ye.push({...S.has(m.tempRef)?{new_cid:S.get(m.tempRef)}:{},candidate_cid:m.candidateCid,score:m.score,scorer:m.scorer,probe_basis:null});for(let m of E){let w=S.get(m.tempRef);ye.some(q=>q.new_cid===w&&q.candidate_cid===m.candidate_cid)||ye.push({...w!==void 0?{new_cid:w}:{},candidate_cid:m.candidate_cid,score:m.score,scorer:m.scorer,probe_basis:null})}let Re=e.eventIds&&e.eventIds.length>0?e.eventIds:e.sid?Vs(n,e.sid,"extract",1):void 0;return{record:ve(t,{ts:W,proposal_id:s,...s!=null?{extraction_of:oe}:{},...s!=null&&o?{extractor_version:o}:{},..._.length>0?{criteria_removed:_}:{},...ye.length>0?{dedup_hits:ye}:{},nodes:U,edges:K.edges,review:P,supersessions:fe,...y.length>0?{names:y}:{},...e.judgements&&e.judgements.length>0?{judgements:e.judgements}:{},...Re?{event_ids:Re}:{},...e.sid?{sid:e.sid}:{},source_head_moves:{}},{graph:n,scope:e.scope,expectPrev:d,intent:{v:1,verb:"extract",args:me({proposal:r,proposalId:s,verdicts:Object.fromEntries(a),by:u,flags:{allowStaleBasis:c??null,autoName:h??null,extractorVersion:o??null,sid:e.sid??null,...e.matchUnreviewed?{matchUnreviewed:!0}:{}},judgements:e.judgements??null,probeHits:e.probeHits??null,eventIds:Re??null}),pins:l},provenance:e.provenance}).record,errors:null}}function dc(e){let{store:t,graph:n,verdicts:r,by:s}=e,a=[],u=[],c=[],o=[],h=[],i=new Set,d={verdicts:{},supersedeTarget:{}},g=new Map;for(let[p,_]of r){if(_.resolution!=="edited")continue;let S=n.resolve(p);if(!S||S.superseded)continue;let E=n.getNode(S.cid);if(!E)continue;let O={...E.content,..._.edit?.title!==void 0?{title:_.edit.title}:{},..._.edit?.summary!==void 0?{summary:_.edit.summary}:{},..._.edit?.risk!==void 0?{risk:_.edit.risk}:{}};if(Z(E.label,O).length>0)continue;let N=ee(E.label,O);N===S.cid||Kt(n,S.cid,N)||g.set(S.cid,N)}for(let[p,_]of r){if(_.resolution==="skipped")continue;let S=n.resolve(p);if(!S){a.push({code:"UNKNOWN_NODE",detail:`${p} names nothing in the graph`});continue}if(S.superseded){a.push({code:"SUPERSEDED_TARGET",detail:`${p} is superseded \u2014 review the tip (${S.tip})`});continue}let E=S.cid;if(d.verdicts[p]=E,_.resolution==="approved")o.push({id:E,kind:"review-item",resolution:"approved",edit:null,reason:null,by:s});else if(_.resolution==="rejected")e.holdArchives?o.push({id:E,kind:"pending_archive",resolution:"pending",edit:null,reason:_.reason??null,by:s}):o.push({id:E,kind:"review-item",resolution:"rejected",edit:null,reason:_.reason??null,by:s});else if(_.resolution==="edited"){if(i.has(E)){a.push({code:"DUPLICATE_TARGET",detail:`${p}: this node was already superseded by another verdict in this batch \u2014 one verdict per node`});continue}let O=n.getNode(E);if(!O){a.push({code:"UNKNOWN_NODE",detail:`${p}: node file unreadable`});continue}let N={...O.content,..._.edit?.title!==void 0?{title:_.edit.title}:{},..._.edit?.summary!==void 0?{summary:_.edit.summary}:{},..._.edit?.risk!==void 0?{risk:_.edit.risk}:{}},U=Z(O.label,N);if(U.length>0){for(let P of U)a.push({code:P.code,detail:`${p}: ${P.detail}`});continue}let T=ee(O.label,N);if(T===E){o.push({id:E,kind:"review-item",resolution:"approved",edit:null,reason:null,by:s});continue}if(Kt(n,E,T)){a.push({code:"SUPERSEDE_CYCLE",detail:`${p}: edit reproduces an already-superseded version (supersession cycle guard) \u2014 re-edit forward or redesign`});continue}let G=mr({graph:n,oldTip:E,newCid:T,newLabel:O.label,by:s,reason:`re-blessed onto ${T} (edited in review)`,dstRedirect:g});if(G.errors.length>0){for(let P of G.errors)a.push({code:"REBLESS_REFUSED",detail:`${p}: ${P}`});continue}u.push({cid:T,label:O.label,content:N}),c.push(...G.edges),i.add(E),h.push({kind:"node",old:E,new:T,reason:_.reason??"edited in review",by:s}),h.push(...G.supersessions),o.push({id:T,kind:"review-item",resolution:"edited",edit:{..._.edit},reason:null,by:s})}else if(_.resolution==="supersede"){let O=Sr(n,_.supersedeTarget,E,i);if("error"in O){a.push({code:O.error.code,detail:`${p}: ${O.error.detail}`});continue}i.add(O.targetCid),d.supersedeTarget[p]=O.targetCid,e.holdArchives?o.push({id:O.targetCid,kind:"pending_archive",resolution:"pending",edit:null,reason:`supersede by ${E}${_.reason?` \u2014 ${_.reason}`:""}`,by:s}):(h.push({kind:"node",old:O.targetCid,new:E,reason:_.reason??`superseded via review by ${s.id}`,by:s}),o.push({id:E,kind:"review-item",resolution:"approved",edit:null,reason:_.reason??null,by:s}))}}return a.length?{record:null,errors:a}:o.length===0&&h.length===0?{record:null,errors:[{code:"NO_VERDICTS",detail:"every item was skipped \u2014 nothing to commit"}]}:{record:ve(t,{ts:new Date().toISOString(),proposal_id:null,nodes:u,edges:c,review:o,supersessions:h,source_head_moves:{}},{graph:n,scope:e.scope,expectPrev:n.latestHash,intent:{v:1,verb:"review",args:me({verdicts:Object.fromEntries(r),by:s,holdArchives:e.holdArchives??null}),pins:d},provenance:e.provenance}).record,errors:null}}function uc(e){let{store:t,graph:n,survivor:r,merged:s,reason:a,by:u}=e,c=n.resolve(r),o=n.resolve(s);return c?o?c.superseded||o.superseded?{record:null,errors:[{code:"ALREADY_SUPERSEDED",detail:"a side of the pair is already superseded \u2014 the pair is drained"}]}:c.cid===o.cid?{record:null,errors:[{code:"SELF_SUPERSEDE",detail:"a pair cannot merge a node into itself"}]}:{record:ve(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:o.cid,new:c.cid,reason:a??`pair merge: duplicate of ${r}`,by:u}],source_head_moves:{}},{graph:n,scope:Ke(e.scope,{ucTargets:[{ref:r},{ref:s}]}),expectPrev:n.latestHash,intent:{v:1,verb:"pair-merge",args:me({survivor:r,merged:s,reason:a??null,by:u}),pins:{survivor:c.cid,merged:o.cid}},provenance:e.provenance}).record,errors:null}:{record:null,errors:[{code:"UNKNOWN_NODE",detail:`${s} names nothing in the graph`}]}:{record:null,errors:[{code:"UNKNOWN_NODE",detail:`${r} names nothing in the graph`}]}}function lc(e){let{store:t,graph:n,assignments:r,by:s}=e,a=new Set(e.reassign??[]),u=[],c=[],o=new Set,h={};for(let{ref:d,slug:g}of r){if(!Je.test(g)){u.push({code:"BAD_SLUG",detail:`${JSON.stringify(g)} \u2014 slugs are kebab-case ${String(Je)}`});continue}let l=n.resolve(d);if(!l){u.push({code:"UNKNOWN_REF",detail:`${d} names nothing in the graph`});continue}if(l.superseded){u.push({code:"SUPERSEDED_TARGET",detail:`${d} is superseded \u2014 name the tip instead (${l.tip})`});continue}let p=n.names.get(g);if(p!==void 0&&!n.superseded.has(p)&&p!==l.cid&&!a.has(g)||o.has(g)){u.push({code:"SLUG_TAKEN",detail:`${g} already names ${p??"another node in this record"}`});continue}o.add(g),h[d]=l.cid,c.push({cid:l.cid,slug:g,by:s})}return u.length?{record:null,errors:u}:c.length===0?{record:null,errors:[{code:"NO_ASSIGNMENTS",detail:"nothing to name"}]}:{record:ve(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[],names:c,source_head_moves:{}},{graph:n,scope:e.scope,expectPrev:n.latestHash,intent:{v:1,verb:"names",args:me({assignments:r,by:s,...e.reassign&&e.reassign.length>0?{reassign:e.reassign}:{}}),pins:{refs:h}},provenance:e.provenance}).record,errors:null}}function pc(e){let{store:t,graph:n,sourceId:r,reason:s,by:a}=e,u=n.heads.get(r);return u===void 0?{record:null,errors:[{code:"UNKNOWN_SOURCE",detail:`no source ${r} in the graph`}]}:u===null?{record:null,errors:[{code:"ALREADY_RETIRED",detail:`source ${r} is already retired`}]}:{record:ve(t,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:u,new:null,reason:s??`retired source ${r}`,by:a}],source_head_moves:{[r]:null},names:[]},{graph:n,scope:Ke(e.scope,{sourcePins:[{source_id:r}]}),expectPrev:n.latestHash,intent:{v:1,verb:"retire",args:me({sourceId:r,reason:s??null,by:a}),pins:{head:u}},provenance:e.provenance}).record,errors:null}}var qs={kind:"system",id:"reconcile-defer"};function fc(e){let t=Z("gap",e.content);if(t.length>0)return{ok:!1,refusal:`defer gap failed schema validation: ${t.map(c=>c.detail).join("; ")}`};let n=ee("gap",e.content),r={reason:"reconcile change deferred"},s=e.annotates?[{ecid:B(R.ANNOTATES,n,e.annotates,r),type:R.ANNOTATES,src:n,dst:e.annotates,props:r}]:[],a=e.by??qs,u=e.autoName??!0;for(let c=0;;c++){let o=e.store.head(),h=[];if(u){let i=Er(e.store,{token:o}),d=i.nameOf.has(n)?null:Yt("gap",()=>!1,i.names.keys());d!==null&&h.push({cid:n,slug:d,by:a})}try{return ve(e.store,{ts:new Date().toISOString(),proposal_id:null,nodes:[{cid:n,label:"gap",content:e.content}],edges:s,review:[],supersessions:[],...h.length>0?{names:h}:{},source_head_moves:{}},{scope:Ke(e.scope,e.annotates?{ucTargets:[{ref:e.annotates}]}:{}),expectPrev:e.store.serialize(o),intent:{v:1,verb:"gap",args:me({content:e.content,annotates:e.annotates??null,by:a,flags:{autoName:u}}),pins:{annotates:e.annotates??null}},provenance:e.provenance}),{ok:!0,cid:n}}catch(i){if(i instanceof be){if(c<3)continue;return{ok:!1,refusal:"concurrent activity kept moving the store \u2014 try the card again"}}throw i}}}function gc(e){let t=e.graph.byLabel("gap").filter(n=>(e.gaps===void 0||e.gaps.includes(n.cid))&&n.content.kind==="reconcile_deferred"&&typeof n.content.uc=="string"&&e.graph.tipOf(n.content.uc)===e.targetTip&&(e.sourceId===void 0||n.content.basis?.source_id===void 0||n.content.basis.source_id===e.sourceId)&&!e.graph.superseded.has(n.cid)&&e.graph.trust.get(n.cid)!=="archived");if(t.length===0)return{resolved:0};for(let n=0;;n++)try{return ve(e.store,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:t.map(r=>({kind:"node",old:r.cid,new:e.resolvedBy,reason:"reconcile change resolved by a later verdict",by:e.by})),source_head_moves:{}},{graph:e.graph,scope:Ke(e.scope,{ucTargets:[{ref:e.targetTip}]}),expectPrev:e.store.serialize(e.store.head()),intent:{v:1,verb:"gap-close",args:me({targetTip:e.targetTip,resolvedBy:e.resolvedBy,sourceId:e.sourceId??null,by:e.by}),pins:{gaps:t.map(r=>r.cid)}},provenance:e.provenance}),{resolved:t.length}}catch(r){if(r instanceof be){if(n<3)continue;return{resolved:0}}throw r}}function Hs(e,t){let n=e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");if(n.length>60){let s=n.lastIndexOf("-",60);n=(s>0?n.slice(0,s):n.slice(0,60)).replace(/-+$/g,"")}if(!Je.test(n))return null;let r=n;for(let s=2;t(r);s++)r=`${n}-${s}`;return Je.test(r)?r:null}var Bs={source:"src",usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"};function vc(e,t,n){let r=Bs[e];return Hs(r?`${r} ${t}`:t,n)}var Ks={usecase:"uc",scenario:"sc",ac:"ac",test:"t",gap:"gap",stylenote:"sty"},Xt=/^(uc|sc|ac|t|gap|sty)-\d+$/i;function yc(e){return Xt.test(e)?e.toUpperCase():e}function Yt(e,t,n){let r=Ks[e];if(!r)return null;let s=new RegExp(`^${r}-(\\d+)$`),a=0;for(let c of n){let o=s.exec(c);if(!o)continue;let h=Number(o[1]);Number.isSafeInteger(h)&&h>a&&(a=h)}let u=a+1;for(;t(`${r}-${u}`);)u+=1;return`${r}-${u}`}function Ht(e,t){let n=e,r=new Set;for(;!r.has(n);){r.add(n);let s=t(n);if(typeof s!="string")break;n=s}return n}function _t(e,t){let n=Xt.test(e)?e.toLowerCase():e,r=t.headOf(n),s=t.hasNode(n)?n:t.cidOfName(n)??(typeof r=="string"?r:void 0);return s!==void 0&&t.hasNode(s)?s:null}function vt(e,t,n){return n(e)==="gap"&&n(t)!=="gap"}function Fe(e,t){let n=new Map;for(let[r,s]of e)typeof s!="string"||vt(r,s,t)||n.set(s,r);return n}function fr(e,t,n){let r=t(e);if(r!==void 0)return r;let s=new Set,a=e;for(;!s.has(a);){s.add(a);let u=n(a);if(u===void 0)return null;let c=t(u);if(c!==void 0)return c;a=u}return null}function Be(e,t,n,r){let s=new Set([Ht(e,t),e]),a=!0;for(;a;){a=!1;for(let[u,c]of n())typeof c=="string"&&s.has(c)&&!s.has(u)&&!vt(u,c,r)&&(s.add(u),a=!0)}return s}function yt(e){return e??{format:"text",media_type:"text/plain",anchors_supported:["L-L"]}}function Wt(e,t){let n=e.resolve(t);return n&&!e.superseded.has(n.tip)?n.tip:null}function Ic(e,t){let n=Fe(e.superseded,s=>e.nodeLabel.get(s)),r=[t];for(let s=n.get(t);s!==void 0&&!r.includes(s);s=n.get(s))r.unshift(s);return r}function wr(e,t){if(!e.resolve(t))return{ok:!1,why:"unknown"};let n=Wt(e,t);if(n===null)return{ok:!1,why:"removed"};let r=e.nodeLabel.get(n);return r!==se.USECASE?{ok:!1,why:"not-a-use-case",...r?{label:r}:{}}:{ok:!0,cid:n}}function Ir(e,t,n){if(!/^sha256:[0-9a-f]{12,63}$/.test(t)||e.resolve(t))return[];let r=n===void 0?null:typeof n=="string"?[n]:n;return[...e.nodeLabel.entries()].filter(([s,a])=>(r===null||r.includes(a))&&s.startsWith(t)).map(([s])=>s)}function Js(e,t,n){let r=Ir(e,t,n);return r.length===1?r[0]:t}var zt=5;function Ws(e,t,n){let r=Ir(e,t,n);if(r.length<2)return null;let s=r.length>zt?` and ${r.length-zt} more`:"";return`${t} matches ${r.length} ids (${r.slice(0,zt).join(", ")}${s}) \u2014 give more digits`}function $c(e,t){return Js(e,t,se.USECASE)}function Rc(e,t){return Ws(e,t,se.USECASE)}export{ee as a,B as b,Qs as c,ze as d,Ae as e,En as f,wn as g,oi as h,ci as i,Tt as j,vi as k,Ge as l,Nn as m,Gr as n,Tn as o,Ti as p,Fn as q,me as r,Mn as s,Ai as t,Qr as u,ro as v,ws as w,mt as x,so as y,ht as z,ar as A,io as B,bs as C,Is as D,uo as E,ur as F,Bt as G,hr as H,Kt as I,mr as J,_r as K,ve as L,Er as M,Wt as N,Ic as O,wr as P,Ir as Q,Js as R,Ws as S,$c as T,Rc as U,Je as V,Us as W,oc as X,St as Y,bt as Z,br as _,cc as $,js as aa,Vs as ba,Gs as ca,ac as da,dc as ea,uc as fa,lc as ga,pc as ha,fc as ia,gc as ja,Hs as ka,Bs as la,vc as ma,Xt as na,yc as oa,Yt as pa,Ht as qa,_t as ra,vt as sa,Fe as ta,fr as ua,Be as va,De as wa,pt as xa,Vn as ya,Gn as za,qn as Aa,ji as Ba,Vi as Ca,Gi as Da,b as Ea,Zn as Fa,Bn as Ga,as as Ha,ft as Ia,ds as Ja,us as Ka,ps as La,gt as Ma,be as Na,jt as Oa,er as Pa,Ie as Qa,Vt as Ra,nr as Sa,Qi as Ta,Qe as Ua,ir as Va,Zi as Wa,hs as Xa,Ze as Ya,je as Za,ms as _a,_s as $a,eo as ab,Gt as bb,qt as cb,vs as db,Dt as eb,ct as fb,Kn as gb,to as hb,nt as ib,rt as jb,Pe as kb,st as lb,Ee as mb,bn as nb,Ct as ob,gi as pb,hi as qb,mi as rb,pr as sb,go as tb,Rs as ub,So as vb,Ns as wb,bo as xb,xs as yb,Et as zb};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as e}from"./chunk-RZ4F3BHX.js";async function s(o,r,i){let t=await e(o,{method:"PUT",headers:{"Content-Type":i,"x-ms-blob-type":"BlockBlob"},body:new Uint8Array(r)});if(!t.ok)throw new Error(`Azure upload failed: ${t.status} ${await t.text()}`)}export{s as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{i as U}from"./chunk-ZTHYAHDN.js";import{g as S}from"./chunk-AZLNLHUA.js";import{a as E}from"./chunk-DBMW3VUN.js";var h=1,v=/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;var L=["cites-deep"],C=["observe","events","refresh","check","tools","migrate"],d={remote:"fetch",explain:"explain",context:"context",coverage:"coverage"},x=class extends Error{remedy;constructor(a,p){super(a),this.name="SourcePluginRefusal",this.remedy=p}};var T=class extends Error{refusal;constructor(a){super(`${a.code}: ${a.message}${a.remedy?` \u2014 ${a.remedy}`:""}`),this.name="SourcePluginError",this.refusal=a}};function A(l){let a=l.manifest?.capabilities;return Array.isArray(a)?a:[]}var i=(l,a,p={})=>{throw new T({code:l,message:a,...p})},R="test-",O=new Set(["http","https","file"]),b=new Set(U.map(l=>l.name)),G=Object.values(d),$=/^([a-z][a-z0-9-]{1,31}):([\s\S]+)$/,_={plugins:[],byId:()=>{},route:()=>null},D=l=>/(\.[^./\\]+)$/.exec(l)?.[1]?.toLowerCase()??"";function Y(l,a={}){let p=new Set(S.flatMap(o=>o.extensions)),c=new Map,P=new Map,I=new Map;for(let o of l){let r=o?.manifest,e=typeof r?.id=="string"?r.id:"",t={plugin:e||"(no id)"};r?.contract!==h&&i("PLUGIN_CONTRACT_UNSUPPORTED",`plugin ${t.plugin} is written against contract ${String(r?.contract)}; this build has contract ${h}`,t),E.test(e)||i("PLUGIN_ID_INVALID",`${JSON.stringify(r.id)} is not a plugin id: lower-case letters, digits and hyphens, starting with a letter, 2 to 32 characters`,t),e.startsWith(R)&&a.allowTestPlugins!==!0&&i("PLUGIN_ID_RESERVED",`plugin ${e} is a test plugin: an id starting with ${R} is loaded by the conformance suite only`,t),O.has(e)&&i("PLUGIN_ID_TAKEN",`${e} cannot be a plugin id: it already means something at the start of an input`,t),b.has(e)&&i("PLUGIN_ID_TAKEN",`${e} cannot be a plugin id: it is the name of a built-in remote source kind`,t),(c.has(e)||I.has(e))&&i("PLUGIN_ID_TAKEN",`two loaded plugins use the name ${e}`,t),(typeof r.version!="string"||r.version==="")&&i("PLUGIN_ID_INVALID",`plugin ${e} names no version`,t),(typeof r.rules!="string"||r.rules==="")&&i("PLUGIN_RULES_MISSING",`plugin ${e} names no fingerprint-rules version`,t),r.capabilities!==void 0&&!Array.isArray(r.capabilities)&&i("PLUGIN_CAPABILITY_UNKNOWN",`plugin ${e}: capabilities must be a list of capability names`,t);let u=A(o);for(let n of u){if(L.includes(n))continue;if(!(n in d)){let N=C.includes(n);i("PLUGIN_CAPABILITY_UNKNOWN",`plugin ${e} lists the capability ${JSON.stringify(n)}, which ${N?"is reserved and not defined yet":"this contract does not define"}`,t)}let s=d[n];typeof o[s]!="function"&&i("PLUGIN_CAPABILITY_WITHOUT_HOOK",`plugin ${e} lists the capability ${n} and has no ${s} hook`,t)}u.includes("cites-deep")&&!(u.includes("context")&&typeof o.context=="function")&&i("PLUGIN_CITES_DEEP_WITHOUT_CONTEXT",`plugin ${e} lists the capability cites-deep without the capability context and its hook: the instruction to cite each criterion, scenario and test could never reach the design agent`,{...t,remedy:"list the context capability, with its hook, and say in its design note what each item should cite"});for(let n of G){let s=Object.entries(d).find(([,N])=>N===n)[0];o[n]!==void 0&&!u.includes(s)&&i("PLUGIN_HOOK_WITHOUT_CAPABILITY",`plugin ${e} has the hook ${n} and does not list the capability ${s}`,t)}for(let n of["claim","render","index"])typeof o[n]!="function"&&i("PLUGIN_CAPABILITY_WITHOUT_HOOK",`plugin ${e} has no ${n} hook, which every plugin needs`,t);let g=r.claims?.extensions??[];Array.isArray(g)||i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims its extensions as ${JSON.stringify(g)}, which is not a list`,t);for(let n of g){(typeof n!="string"||!/^\.[a-z0-9][a-z0-9._-]*$/.test(n))&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${JSON.stringify(n)}, which is not a file extension: lower-case, starting with a dot`,t);let s=n;s.lastIndexOf(".")!==0&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which holds a second dot: an input's extension is what follows its last dot, so no input would ever be routed to it`,t),p.has(s)&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which a built-in source kind already reads`,t),P.has(s)&&i("PLUGIN_EXTENSION_TAKEN",`plugin ${e} claims ${s}, which plugin ${P.get(s).manifest.id} already claims`,t),P.set(s,o)}let y=r.claims?.schemes??[];Array.isArray(y)||i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims its schemes as ${JSON.stringify(y)}, which is not a list`,t);for(let n of y){(typeof n!="string"||!E.test(n)||O.has(n))&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${JSON.stringify(n)}, which is not one a plugin may have`,t);let s=n;b.has(s)&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${s}, which is the name of a built-in remote source kind`,t),(I.has(s)||c.has(s)&&s!==e)&&i("PLUGIN_SCHEME_TAKEN",`plugin ${e} claims the scheme ${s}, which another loaded plugin already uses`,t),I.set(s,o)}c.set(e,o)}for(let[o,r]of I)A(r).includes("remote")||i("PLUGIN_SCHEME_WITHOUT_REMOTE",`plugin ${r.manifest.id} claims the scheme ${o} but has no remote capability, so it can never read a ${o}:// input`,{plugin:r.manifest.id});return c.size===0?_:{plugins:[...c.values()],byId:o=>c.get(o),route(o,r){let e=$.exec(o);if(e&&!r(o)){let u=I.get(e[1]);if(u)return{plugin:u,ref:o,named:!1};let g=c.get(e[1]);if(g)return{plugin:g,ref:e[2],named:!0}}let t=P.get(D(o));return t&&!/^https?:\/\//i.test(o)?{plugin:t,ref:o,named:!1}:null}}}var f=_,m,J=()=>f,j=()=>m;function q(l,a){if(f!==_)throw new Error("a source-plugin registry is already installed: a host installs its registry once");return f=l,m=a,()=>{f===l&&(f=_,m=void 0)}}export{v as a,x as b,T as c,A as d,i as e,_ as f,Y as g,J as h,j as i,q as j};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{L as c,r as d}from"./chunk-UEE3RZN4.js";function u(a,e,t){let{ref:r,reason:o,by:s}=t;if(!o||o.trim().length===0)return{record:null,errors:[{code:"REASON_REQUIRED",detail:"archiving a node needs a reason \u2014 it becomes the tombstone's provenance"}]};let i=e.resolve(r);if(!i)return{record:null,errors:[{code:"UNKNOWN_REF",detail:`no node '${r}' in the graph`}]};let n=e.tipOf(i.cid);return e.superseded.has(n)?{record:null,errors:[{code:"ALREADY_ARCHIVED",detail:`${r} is already superseded at its tip (${n.slice(0,19)}\u2026)`}]}:{record:c(a,{ts:new Date().toISOString(),proposal_id:null,nodes:[],edges:[],review:[],supersessions:[{kind:"node",old:n,new:null,reason:o,by:s}],source_head_moves:{}},{graph:e,expectPrev:e.latestHash,intent:{v:1,verb:"archive",args:d({ref:r,reason:o,by:s}),pins:{ref:n}},provenance:t.provenance}).record,errors:null}}export{u as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{b as x}from"./chunk-TW63WWEN.js";import{a as l}from"./chunk-HCBYKLMW.js";import{a as i,b as r}from"./chunk-33DWJV67.js";import{e}from"./chunk-UR6MHSHU.js";var o=e(l(),1);function m({title:c,state:t,rows:n}){return(0,o.jsxs)(i,{flexDirection:"column",marginTop:1,children:[(0,o.jsxs)(r,{children:[(0,o.jsx)(r,{bold:!0,children:c}),t?(0,o.jsx)(r,{color:t.color,children:` \u25CF ${t.text}`}):null]}),(0,o.jsx)(x,{rows:n,minWidth:20})]})}export{m as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as x}from"./chunk-HCBYKLMW.js";import{a,b as m,j as g}from"./chunk-33DWJV67.js";import{a as b}from"./chunk-6YGTRKDT.js";import{y as u}from"./chunk-I6OQISK4.js";import{e as f}from"./chunk-UR6MHSHU.js";var T=f(b(),1);function k(i,n){if(!n)return i;let l=i.trim()||n;return`\x1B]8;;${n}\x07${l}\x1B]8;;\x07`}var r=f(x(),1);function $({shareableLink:i,testCaseLink:n,codeExportDir:l,recordedTestPath:s,outputDir:o,autoExit:p=!0}){let{exit:c}=g();(0,T.useEffect)(()=>{if(!p)return;let t=setTimeout(()=>c(),100);return()=>clearTimeout(t)},[c,p]);let e=[];return s&&e.push({label:"Test",url:s,linkUrl:`file://${s}`}),o&&e.push({label:"Output",url:o,linkUrl:`file://${o}`}),i&&e.push({label:"ShareLink",url:i}),n&&e.push({label:"TestCase",url:n}),l&&!o&&e.push({label:"CodeExport",url:l,linkUrl:`file://${l}`}),e.length===0?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(a,{flexDirection:"column",marginTop:1,marginLeft:1,children:e.map(t=>(0,r.jsxs)(a,{flexDirection:"column",marginBottom:1,children:[(0,r.jsxs)(m,{color:u.orange,children:[t.label,":"]}),(0,r.jsx)(m,{color:u.dim,children:k(t.url,t.linkUrl??t.url)})]},t.label))})}export{$ as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as $}from"./chunk-MMBBQ4OZ.js";import{j as h}from"./chunk-
|
|
2
|
+
import{a as $}from"./chunk-MMBBQ4OZ.js";import{j as h}from"./chunk-D4FFXCX6.js";import{a as w}from"./chunk-RZ4F3BHX.js";import{b as v}from"./chunk-I6OQISK4.js";import{spawn as V,spawnSync as _}from"child_process";import{createServer as K}from"net";import{mkdirSync as g,openSync as W,readFileSync as I,renameSync as j,rmSync as x,statSync as Y,writeFileSync as M}from"fs";import{readFile as q}from"fs/promises";import{dirname as l,join as y}from"path";var G=[4723,4724,4725,4726,4727,4728,4729,4730],X={emulator:4750,simulator:4790},z=40,E=2e3,D=3e4,T=500,Ce=["emulator","simulator"];function Q(e){return y(v,"mobile",`appium-server-${e}.log`)}function m(){return y(v,"mobile","appium-servers.json")}function Z(){return y(v,"mobile","appium-servers.lock")}var ee=1e4,re=50;function C(e){let r=Z();try{g(l(r),{recursive:!0})}catch{return e()}let n=!1;for(let o=0;o<re;o++)try{g(r),n=!0;break}catch{try{Date.now()-Y(r).mtimeMs>ee&&x(r,{recursive:!0,force:!0})}catch{}ne(10)}try{return e()}finally{if(n)try{x(r,{recursive:!0,force:!0})}catch{}}}function ne(e){try{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e)}catch{}}function te(){try{let e=JSON.parse(I(m(),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}function oe(e){let r=m();g(l(r),{recursive:!0});let n=`${r}.tmp`;M(n,JSON.stringify(e,null,2)),j(n,r)}function se(e,r,n){return`Another mobile session is already running${n?` on ${n}`:""}. Wait for it to finish, or close the terminal running it.`}var A=class extends Error{constructor(n,o){super(n);this.port=o;this.name="DeviceBusyError"}};function ie(e){return w(e,{signal:AbortSignal.timeout(E)}).then(r=>r.ok,()=>!1)}async function ae(e,r){try{return(await w(`http://127.0.0.1:${e}/session/${r}`,{method:"DELETE",signal:AbortSignal.timeout(E)})).ok}catch{return!1}}function R(e){let r=e?.value;return Array.isArray(r)?r.map(n=>{let o=n??{},t=o.capabilities??o;return{...typeof o.id=="string"?{id:o.id}:{},caps:t}}):[]}async function ue(e){try{let r=await w(`http://127.0.0.1:${e}/sessions`,{signal:AbortSignal.timeout(E)});return r.ok?R(await r.json()):[]}catch{return[]}}var ce=["udid","appium:udid","deviceUDID","appium:deviceUDID","deviceName","appium:deviceName"];function L(){let e=r=>{try{let n=_("curl",["-s","--noproxy","*","--max-time","2",...r],{encoding:"utf8",timeout:5e3});return{ok:n.status===0,stdout:n.stdout??""}}catch{return{ok:!1,stdout:""}}};return{readState:()=>{try{let r=JSON.parse(I(m(),"utf8"));return Array.isArray(r)?r:[]}catch{return[]}},alive:b,getJson:r=>{let n=e([r]);if(n.ok)try{return JSON.parse(n.stdout)}catch{return}},del:r=>{let n=e(["-o","/dev/null","-w","%{http_code}","-X","DELETE",r]);return n.ok&&/^2\d\d$/.test(n.stdout.trim())}}}function Le(e,r={}){let n={...L(),...r},o=0;try{for(let t of n.readState()){if(!n.alive(t.pid))continue;let i=R(n.getJson(`http://127.0.0.1:${t.port}/sessions`));for(let s of i)s.id&&de(s.caps,e.udid,e.displayName)&&n.del(`http://127.0.0.1:${t.port}/session/${s.id}`)&&(o+=1)}}catch{}return o}function de(e,r,n){let o=[r,n].filter(t=>!!t).map(t=>t.toLowerCase());for(let t of ce){let i=e[t];if(typeof i=="string"&&o.includes(i.toLowerCase()))return!0}return!1}function pe(e,r,n){let o=W(n.logPath,"a"),t=V(e,r,{stdio:["ignore",o,o],detached:!0,env:{...process.env,...n.env}});return t.unref(),t.pid}async function le(e,r){for(let n=e;n<e+r;n++)if(await new Promise(t=>{let i=K();i.once("error",()=>t(!1)),i.once("listening",()=>i.close(()=>t(!0))),i.listen(n)}))return n;throw new Error(`No free port for the managed Appium server in ${e}-${e+r-1}.`)}function b(e){try{return process.kill(e,0),!0}catch{return!1}}function P(e){try{let r=_("ps",["-o","comm=","-p",String(e)],{encoding:"utf8",timeout:2e3});if(r.status!==0)return!1;let n=r.stdout.trim().toLowerCase();return n===""?!0:n.includes("node")||n.includes("kane")}catch{return!0}}function k(e){try{process.kill(e)}catch{}}async function me(){try{let e=JSON.parse(await q(m(),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}async function fe(e){let r=process.pid,n=e.filter(o=>o.owner===r);C(()=>{let o=[];for(let t of te())t.owner!==r&&(Se(t)?o.push(t):b(t.pid)&&k(t.pid));oe([...o,...n])})}function Se(e){return e.owner===void 0?!1:b(e.owner)&&P(e.owner)}function ve(){return{probe:ie,sessions:ue,deleteSession:ae,spawn:pe,freePort:le,alive:b,kill:k,readState:me,writeState:fe,owner:process.pid,depsEnv:e=>h().environment(e),bundleVersion:async e=>(await h().status(e)).version,nodeBinary:process.execPath,env:process.env,os:process.platform,now:()=>Date.now(),sleep:e=>new Promise(r=>setTimeout(r,e))}}function we(e,r,n){if(!e.platformToolsDir)return{};let o=n==="win32"?";":":",t=$(r),i=t?.root??l(e.platformToolsDir),s=t?.platformToolsDir??e.platformToolsDir;return{ANDROID_HOME:i,ANDROID_SDK_ROOT:i,PATH:r.PATH?`${s}${o}${r.PATH}`:s}}async function ge(e){let r=await e.readState(),n=[],o=[];for(let t of r)t.owner!==void 0&&e.alive(t.owner)&&(e.ownerIsOurs??P)(t.owner)?n.push(t):o.push(t);for(let t of o){let i=e.ownerIsOurs??P;e.alive(t.pid)&&i(t.pid)&&e.kill(t.pid)}return o.length>0&&await e.writeState(n),n}async function Je(e,r={}){if(r.appiumUrl)return{result:"external",url:r.appiumUrl};let n={...ve(),...r.deps},o=await ge(n),t=o.filter(a=>a.owner===n.owner),i=new Set(t.map(a=>a.port)),s=new Set(o.map(a=>a.port));if(r.device){let a=await ye(n,s,i,e);if(a!==null)throw new A(se(r.device,a.port,a.device),a.port)}let c=await n.bundleVersion(e),u=t.find(a=>a.deviceClass===e&&(a.bundleVersion??c)===c);if(u&&await n.probe(`http://127.0.0.1:${u.port}/status`))return{result:"reused",url:`http://127.0.0.1:${u.port}`};for(let a of t.filter(S=>S.deviceClass===e&&S!==u))n.kill(a.pid);u&&n.kill(u.pid);let d=await n.depsEnv(e);if(!d.appiumHome)throw new Error(`The managed dependencies for the ${e} class are not installed.
|
|
3
3
|
Run \`kane-cli doctor --target ${e} --install\` to install them, or pass --appium-url for an external server.`);let p=await n.freePort(X[e],z),O=`http://127.0.0.1:${p}`,J=l(d.appiumHome),U=y(J,"appium","node_modules","appium","index.js"),N=Q(e);r.onProgress?.(`starting the managed Appium server (${e}, port ${p})\u2026`);let f=n.spawn(n.nodeBinary,[U,"--port",String(p),"--allow-insecure=uiautomator2:adb_shell"],{env:{APPIUM_HOME:d.appiumHome,...we(d,n.env,n.os)},logPath:N}),B=n.now()+D,F=Math.ceil(D/T)+1;for(let a=0;a<F&&n.now()<B;a++)if(await n.sleep(T),await n.probe(`${O}/status`)){if(f!==void 0){let S=t.filter(H=>H.deviceClass!==e);await n.writeState([...S,{port:p,pid:f,owner:n.owner,deviceClass:e,...c?{bundleVersion:c}:{},startedAt:new Date(n.now()).toISOString()}])}return r.onProgress?.("Appium server ready"),{result:"started",url:O}}throw f!==void 0&&n.kill(f),new Error(`The managed Appium server (${e}) did not answer on ${p} within ${D/1e3}s.
|
|
4
4
|
Check its log: ${N}`)}async function ye(e,r=[],n=[],o){let t=new Set(n),i=new Set([...G,...r]);for(let s of i)if(!t.has(s))for(let c of await e.sessions(s)){if(!c.id)continue;if(o){let d=be(c.caps);if(d&&d!==o)continue}let u=De(c.caps);return{port:s,...u?{device:u}:{}}}return null}function be(e){let r=t=>{let i=e[t];return typeof i=="string"?i.toLowerCase():""},n=r("platformName")||r("appium:platformName");if(n.includes("ios"))return"simulator";if(n.includes("android"))return"emulator";let o=r("appium:automationName")||r("automationName");if(o.includes("xcuitest"))return"simulator";if(o.includes("uiautomator"))return"emulator"}var he=["appium:deviceName","deviceName","appium:udid","udid","appium:deviceUDID","deviceUDID"];function De(e){for(let r of he){let n=e[r];if(typeof n=="string"&&n.trim())return n}}function Ue(e={}){let r={...L(),kill:k,writeState:Ae,...e.deps};try{let n=r.readState(),o=e.owner??process.pid,t=n.filter(s=>s.owner===o&&(!e.deviceClass||s.deviceClass===e.deviceClass));for(let s of t){if(!r.alive(s.pid))continue;let c=R(r.getJson(`http://127.0.0.1:${s.port}/sessions`));for(let u of c)u.id&&r.del(`http://127.0.0.1:${s.port}/session/${u.id}`);r.kill(s.pid)}let i=new Set(t.map(s=>`${s.port}:${s.pid}`));C(()=>{r.writeState(r.readState().filter(s=>!i.has(`${s.port}:${s.pid}`)))})}catch{}}function Ae(e){try{let r=m();g(l(r),{recursive:!0}),M(r,JSON.stringify(e,null,2))}catch{}}export{Ce as a,Q as b,se as c,Le as d,ve as e,Je as f,ye as g,Ue as h};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{N as y}from"./chunk-UEE3RZN4.js";import{f as d,g as m}from"./chunk-KU3YHPWZ.js";var b={high:3,med:2,low:1},R={create:0,evolve:1,"reuse-candidate":2},E=.75;function u(e,s){return!e.superseded.has(s)&&e.trust.get(s)!=="archived"}function S(e,s){return e.edgesInto(s).some(n=>n.type===m.VERIFIES&&u(e,n.src))}function p(e,s="med"){let n=e.risk;return n==="high"||n==="med"||n==="low"?n:s}function l(e,s){return e.displayNameOf(s)??s}function g(e,s){return`kane-cli design tests --use-case ${l(e,s)}`}function _(e,s){let n=(r,o)=>{for(let c of e.edgesFrom(o)){let f=c.type===r?y(e,c.dst):null;if(f!==null&&u(e,f))return f}return null},t=n(m.SCOPED_TO,s);if(!t)return null;let i=e.nodeLabel.get(t);return i===d.USECASE?t:i===d.SCENARIO?n(m.BELONGS_TO,t):null}function w(e,s){let n=_(e,s);return n?g(e,n):G(e,s)}function G(e,s){return`kane-cli design explain ${l(e,s)}`}function h(e,s){let n=e.edgesFrom(s).find(i=>i.type===m.AUTOMATES&&u(e,i.dst));if(!n)return null;let t=e.edgesFrom(n.dst).find(i=>i.type===m.BELONGS_TO&&u(e,i.dst));return t?t.dst:null}function x(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC))u(e,n)&&(S(e,n)||s.push({ref:l(e,n),kind:"no-verifies",why:"no live test verifies this acceptance criterion",risk:p(t),stage:"design",tag:"create",ready_command:w(e,n)}));return s}function L(e){let s=[],n=new Map;for(let{cid:t}of e.byLabel(d.SCENARIO))if(u(e,t))for(let i of e.edgesFrom(t)){if(i.type!==m.BELONGS_TO)continue;let r=e.tipOf(i.dst);(n.get(r)??n.set(r,new Set).get(r)).add(t)}for(let{cid:t,content:i}of e.byLabel(d.USECASE)){if(!u(e,t))continue;let r=[...n.get(t)??[]];if(r.length===0){s.push({ref:l(e,t),kind:"zero-scenario",why:"use-case has no scenarios",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)});continue}r.every(c=>e.getNode(c)?.content.case_type==="happy")&&s.push({ref:l(e,t),kind:"happy-only",why:"use-case is exercised by happy-path scenarios only",risk:p(i),stage:"design",tag:"create",ready_command:g(e,t)})}return s}function C(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.GAP)){if(!u(e,n))continue;let i=t.ref,r=typeof i=="string"?e.resolve(i):null,o=r&&u(e,r.tip)?r.tip:null,c=o?e.nodeLabel.get(o):null,f=t.kind==="reconcile_deferred"?"kane-cli maintain reconcile":c===d.USECASE?g(e,o):c===d.AC?w(e,o):G(e,n),a=t.question&&typeof t.question=="object"?t.question:void 0,v=typeof t.text=="string"&&t.text||(a&&typeof a.header=="string"?a.header:"")||"design gap";s.push({ref:l(e,n),kind:String(t.kind),why:v,risk:p(t),stage:"design",tag:"create",ready_command:f,...typeof t.risk_rationale=="string"?{risk_rationale:t.risk_rationale}:{},...a?{question:a}:{}})}return s}function O(e){let s=[];for(let{cid:n,content:t}of e.byLabel(d.AC)){if(!u(e,n))continue;let i=e.stale(n);i==="fresh"||i==="superseded"||s.push({ref:l(e,n),kind:"stale-ac",why:`acceptance criterion is ${i} \u2014 its source moved since this was authored \xB7 why: kane-cli design explain ${l(e,n)}`,risk:p(t),stage:"design",tag:"evolve",ready_command:"kane-cli maintain reconcile"})}for(let{cid:n,content:t}of e.byLabel(d.TEST)){if(!u(e,n))continue;let i=e.stale(n);if(i==="fresh"||i==="superseded")continue;let r=e.edgesFrom(n).filter(k=>k.type===m.VERIFIES&&u(e,k.dst)),o=r.map(k=>p(e.getNode(k.dst)?.content??{})),c=o.includes("high")?"high":o.includes("med")?"med":o.includes("low")?"low":"med",f=r[0]?.dst??null,a=f?null:h(e,n),v=f?w(e,f):a?g(e,a):G(e,n);s.push({ref:l(e,n),kind:"stale-test",why:`test is ${i} \u2014 its source moved since this was authored`,risk:c,stage:"design",tag:"evolve",ready_command:v})}return s}async function A(e,s,n){for(let t of e)if(t.tag==="create"){if(!n){t.meta={embed_arm:"skipped"};continue}try{let i=s.resolve(t.ref),r=i?s.getNode(i.tip):null,o=r&&(String(r.content.title??"")||String(r.content.text??""))||t.why,c=r?.label===d.USECASE?"scenario":"test",a=(await n.searchSimilar(o,{label:c,k:1}))[0];a&&a.score>=E?(t.tag="reuse-candidate",t.meta={embed_arm:"used",near_hit:{ref:l(s,a.cid),score:a.score}}):t.meta={embed_arm:"used",near_hit:null}}catch{t.meta={embed_arm:"skipped"}}}}function T(e,s){let n=b[s.risk]-b[e.risk];if(n!==0)return n;let t=R[e.tag]-R[s.tag];return t!==0?t:e.ref<s.ref?-1:e.ref>s.ref?1:0}function N(e,s){let n=[],t=r=>{let o=y(e,r);return o?p(e.getNode(o)?.content??{}):"med"},i=r=>{let o=y(e,r),c=o?_(e,o):null;return c?l(e,c):r};for(let r of s.usecases??[])for(let o of r.acceptance_criteria??[])(o.covered_by??[]).length>0&&(o.execution==="failed"?n.push({ref:o.id,kind:"execution-failed",stage:"cover",tag:"evolve",risk:t(o.id),why:`covering test failed against this AC (tests: ${(o.covered_by??[]).join(", ")})`,ready_command:`kane-cli maintain evolve ${i(o.id)}`}):o.execution==="blocked"?n.push({ref:o.id,kind:"execution-blocked",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"the oracle could not run (infrastructure) \u2014 the covering test exists and is reusable",ready_command:"kane-cli testrun run"}):o.execution==="not-run"&&n.push({ref:o.id,kind:"covered-not-run",stage:"cover",tag:"reuse-candidate",risk:t(o.id),why:"a covering test exists but never joined this pack \u2014 run it",ready_command:"kane-cli testrun run"}));return n}async function U(e,s,n,t){if(s!=="design"&&!t)throw new Error(`gaps-engine: stage "${s}" requires a pack's usecases doc`);let i=[];return(s==="design"||s==="all")&&i.push(...x(e),...L(e),...C(e),...O(e)),(s==="cover"||s==="all")&&i.push(...N(e,t)),await A(i,e,n),i.sort(T),i}export{u as a,S as b,_ as c,U as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{f as a}from"./chunk-ZCRZFAOT.js";import s from"fs";import h from"path";import{execSync as p}from"child_process";import{readFileSync as f}from"fs";import{createHash as c}from"crypto";import{hostname as g,platform as d,arch as m}from"os";var o=null;function u(){return o||(o=l(),o)}function l(){let e=d();if(e==="darwin")try{let i=p("ioreg -rd1 -c IOPlatformExpertDevice",{encoding:"utf-8",timeout:5e3}).match(/"IOPlatformUUID"\s*=\s*"([^"]+)"/);if(i?.[1])return i[1]}catch{}if(e==="linux")try{let r=f("/etc/machine-id","utf-8").trim();if(r)return r}catch{}let t=`${g()}:${e}:${m()}`;return c("sha256").update(t).digest("hex").slice(0,32)}var _=new Set(["org_id","user_id","plan","user_type"]);function k(e){let t={machine_id:u(),env:e};try{let r=JSON.parse(s.readFileSync(a(e),"utf8"));for(let[i,n]of Object.entries(r))_.has(i)&&typeof n=="string"&&n.length>0&&n.length<=128&&(t[i]=n)}catch{}return t}async function A(e,t){if(!t)return;let r={};if(t.org_id!==void 0&&t.org_id!==null&&(r.org_id=String(t.org_id)),t.user_id!==void 0&&t.user_id!==null&&(r.user_id=String(t.user_id)),typeof t.plan=="string"&&t.plan&&(r.plan=t.plan),typeof t.user_type=="string"&&t.user_type&&(r.user_type=t.user_type),Object.keys(r).length===0)return;let i=a(e);await s.promises.mkdir(h.dirname(i),{recursive:!0});let n=`${i}.tmp-${process.pid}`;await s.promises.writeFile(n,JSON.stringify(r),{mode:384}),await s.promises.rename(n,i)}export{u as a,k as b,A as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as
|
|
2
|
+
import{c as d,d as p,e as g}from"./chunk-N3TCNZSX.js";import{b as m}from"./chunk-I6OQISK4.js";import{mkdirSync as y,writeFileSync as o,existsSync as u,readFileSync as M}from"fs";import{join as a}from"path";var E={name:"remote-execution",version:"0.5.0",backendId:"hyper",kaneCompat:">=0.4.0",defaults:{runson:"mac",concurrency:1}},f={runson:"mac",concurrency:1,timeoutMinutes:120,mobile:{runson:"mac26",queueTimeout:300,appiumPort:4739,androidHome:"$HOME/android-sdk-shim",globalTimeout:90,testSuiteTimeout:90,testSuiteStep:45,ios:{runson:{}},realDevice:{runson:"linux"}}},v=`version: "0.1"
|
|
3
3
|
runson: {{runson}}
|
|
4
4
|
autosplit: true
|
|
5
5
|
concurrency: {{concurrency}}
|
|
@@ -11,7 +11,7 @@ runtime:
|
|
|
11
11
|
{{timeouts}}{{deviceDirective}}env:
|
|
12
12
|
KANE_CLI_MODE: hyperexecute
|
|
13
13
|
TESTMUAI_ENV: {{env}}
|
|
14
|
-
pre:
|
|
14
|
+
{{gridEnv}}pre:
|
|
15
15
|
- rm -rf .testmuai/evidence
|
|
16
16
|
- npm install -g @testmuai/kane-cli@{{kaneVersion}}
|
|
17
17
|
{{devicePre}} - kane-cli login --env {{env}} --username \${{.secrets.LT_USERNAME}} --access-key \${{.secrets.LT_ACCESS_KEY}}{{projectFolderFlags}}
|
|
@@ -25,28 +25,30 @@ uploadArtefacts:
|
|
|
25
25
|
- name: kane-testrun
|
|
26
26
|
path:
|
|
27
27
|
{{uploadPaths}}
|
|
28
|
-
`,
|
|
28
|
+
`,R=` KANE_SESSIONS="$HOME/.testmuai/kaneai/sessions"
|
|
29
29
|
mkdir -p "$KANE_SESSIONS"
|
|
30
30
|
KANE_MARK=$(mktemp)
|
|
31
|
-
`,
|
|
31
|
+
`,h=` mkdir -p artifacts/session
|
|
32
32
|
find "$KANE_SESSIONS" -mindepth 1 -maxdepth 1 -type d -newer "$KANE_MARK" -exec cp -R {} artifacts/session/ \\; 2>/dev/null || true
|
|
33
33
|
rm -f "$KANE_MARK" 2>/dev/null || true
|
|
34
|
-
|
|
34
|
+
`,$=`{{kaneDistSwap}} C=$(find /Users/ltuser/lrc/chrome /Applications "$HOME/Applications" -maxdepth 6 -name 'Google Chrome' -path '*/MacOS/*' -type f 2>/dev/null | head -1)
|
|
35
35
|
if [ -z "$C" ]; then C=$(command -v google-chrome || command -v google-chrome-stable || true); fi
|
|
36
36
|
if [ -n "$C" ]; then export KANE_CLI_CHROME_PATH="$C"; echo "using chrome: $C"; fi
|
|
37
|
-
{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --headless --agent{{memberFlags}}
|
|
37
|
+
{{memberLookup}}{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --headless --agent{{caseFlag}}{{memberFlags}}
|
|
38
38
|
rc=$?
|
|
39
|
-
{{sessionCopy}} exit $rc
|
|
39
|
+
{{sessionCopy}} exit $rc`,P=` NPMROOT=$(npm root -g)
|
|
40
40
|
rm -rf "$NPMROOT/@testmuai/kane-cli/dist"
|
|
41
41
|
cp -R {{kaneDist}} "$NPMROOT/@testmuai/kane-cli/dist"
|
|
42
42
|
echo "[swap] patched kane-cli dist installed from {{kaneDist}}"
|
|
43
43
|
`,C=`{{kaneDistSwap}} adb devices
|
|
44
|
-
{{
|
|
44
|
+
{{memberLookup}}{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --agent{{deviceFlags}}{{caseFlag}}{{memberFlags}}
|
|
45
45
|
rc=$?
|
|
46
46
|
{{sessionCopy}} exit $rc`,x=`{{kaneDistSwap}} xcrun simctl list devices available | grep -v -- '-- Unavailable' || true
|
|
47
|
-
{{
|
|
47
|
+
{{memberLookup}}{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --agent{{deviceFlags}}{{caseFlag}}{{memberFlags}}
|
|
48
48
|
rc=$?
|
|
49
|
-
{{sessionCopy}} exit $rc
|
|
50
|
-
|
|
49
|
+
{{sessionCopy}} exit $rc`,b=`{{kaneDistSwap}}{{memberLookup}}{{sessionMark}} kane-cli testmd run "$test" --env {{env}} --no-evidence-publish --agent{{deviceFlags}}{{caseFlag}}{{memberFlags}}
|
|
50
|
+
rc=$?
|
|
51
|
+
{{sessionCopy}} exit $rc`;var O={"remote-execution":{manifest:E,templates:{"hyperexecute.yaml.tmpl":v},config:f}};function S(e){return O[e]}function B(e,i){let l=i.base??m,s=S(e);if(!s)return{status:"failed",name:e,version:"",dir:"",error:`unknown plugin '${e}'`};let n=s.manifest.version;if(i.version&&i.version!==n)return{status:"failed",name:e,version:n,dir:"",error:`only bundled version ${n} is available (requested ${i.version})`};let t=d(e,n,l),c=p(e,l),_=u(a(t,"plugin.json"))&&u(c)&&M(c,"utf8").trim()===n;try{y(a(t,"templates"),{recursive:!0}),o(a(t,"plugin.json"),JSON.stringify(s.manifest,null,2)+`
|
|
52
|
+
`);for(let[N,k]of Object.entries(s.templates))o(a(t,"templates",N),k);let r=g(e,l);return u(r)||o(r,JSON.stringify(s.config,null,2)+`
|
|
51
53
|
`),o(c,n+`
|
|
52
|
-
`),{status:
|
|
54
|
+
`),{status:_?"already-installed":"installed",name:e,version:n,dir:t}}catch(r){return{status:"failed",name:e,version:n,dir:t,error:r.message}}}export{v as a,R as b,h as c,$ as d,P as e,C as f,x as g,b as h,B as i};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a as $}from"./chunk-ZHWU6L2G.js";import{a as x,b as A,c as m,d}from"./chunk-DBMW3VUN.js";import{a as v}from"./chunk-7V4BQSSV.js";var C=e=>typeof e=="string"&&A.test(e),c=e=>JSON.stringify(e);function w(e,r,n,o){if(!Array.isArray(e)||!e.every(t=>typeof t=="string"))return`${n} is not a list of unit ids`;let s=new Set;for(let t of e){if(t===m)return`${n} names ${c(t)}, the core's own unit, which is never in a plan`;if(!C(t))return`${n} names ${c(t)}, which is not a unit id`;if(!r.has(t))return`${n} names the unit ${c(t)}, which this version does not have`;if(s.has(t))return`${n} names the unit ${c(t)} twice`;s.add(t)}return o&&e.some((t,i)=>i>0&&r.get(e[i-1])>r.get(t))?`${n} is not in the order of the version's units`:null}function S(e,r,n,o){if(!Array.isArray(e))return"groups is not a list of groups";if(e.length>d.coverageGroups)return`has ${e.length} groups, the limit is ${d.coverageGroups}`;let s=new Set,t=new Set;for(let i=0;i<e.length;i++){let u=e[i],l=`group ${i+1}`;if(typeof u!="object"||u===null||Array.isArray(u))return`${l} is not an object`;let g=u,h=Object.keys(g).find(a=>a!=="name"&&a!=="units");if(h!==void 0)return`${l} has a field ${c(h)} a group does not have`;let p=$(g.name);if(p===null||o&&p!==g.name)return`${l} has a name that is not one clean line`;if(p.length>d.coverageGroupNameChars)return`${l} has a name over ${d.coverageGroupNameChars} characters`;if(s.has(p))return`two groups are named ${c(p)}`;s.add(p);let f=w(g.units,n,`${l}`,o);if(f!==null)return f;if(g.units.length===0)return`${l} has no unit`;for(let a of g.units){if(!r.has(a))return`${l} names the unit ${c(a)}, which the plan does not expect`;if(t.has(a))return`the unit ${c(a)} is in two groups`;t.add(a)}}return null}var b=e=>new Map(e.filter(r=>r!==m).map((r,n)=>[r,n]));function k(e,r){if(typeof e!="object"||e===null||Array.isArray(e))return"is not an object";let n=e,o=Object.keys(n).find(u=>!["v","plugin","expected","groups"].includes(u));if(o!==void 0)return`has a field ${c(o)} a coverage plan does not have`;if(n.v!==1)return"is not version 1 of the coverage form";if(typeof n.plugin!="string"||!x.test(n.plugin))return"names no plugin";let s=b(r),t=w(n.expected,s,"expected",!0);if(t!==null)return t;if(n.groups!==void 0){if(Array.isArray(n.groups)&&n.groups.length===0)return"has a list of groups with no group";let u=S(n.groups,new Set(n.expected),s,!0);if(u!==null)return u}let i=Buffer.byteLength(v(n),"utf8");return i>d.coverageBytes?`is ${i} bytes, the limit is ${d.coverageBytes}`:null}var R=e=>Buffer.from(v(e),"utf8");function I(e){if(e===null)return null;try{let r=Buffer.from(e).toString("utf8"),n=JSON.parse(r),o=Array.isArray(n?.expected)?n.expected:[],s=Array.isArray(n?.groups)?n.groups.flatMap(t=>Array.isArray(t?.units)?t.units:[]):[];return k(n,[...new Set([...o,...s])].filter(t=>typeof t=="string"))!==null?null:v(n)===r?n:null}catch{return null}}function N(e,r,n){if(r===void 0||typeof r.coverage!="string")return null;let o=I(e(r.coverage));return o!==null&&o.plugin===r.id&&k(o,n)===null?o:null}function _(e,r,n){if(typeof r!="object"||r===null||Array.isArray(r))return{plan:null,fault:"it answered something that is not a coverage plan"};let o=r,s=Object.keys(o).find(f=>f!=="expected"&&f!=="groups");if(s!==void 0)return{plan:null,fault:`the plan has a field ${c(s)} a coverage plan does not have`};let t=b(n),i=f=>[...f].sort((a,y)=>t.get(a)-t.get(y)),u=w(o.expected,t,"expected",!1);if(u!==null)return{plan:null,fault:u};let l=i(o.expected),g;if(o.groups!==void 0&&o.groups!==null){let f=S(o.groups,new Set(l),t,!1);if(f!==null)return{plan:null,fault:f};let a=o.groups;a.length>0&&(g=a.map(y=>({name:$(y.name),units:i(y.units)})))}let h={v:1,plugin:e,expected:l,...g?{groups:g}:{}},p=R(h).byteLength;return p>d.coverageBytes?{plan:null,fault:`the plan is ${p} bytes stored, the limit is ${d.coverageBytes}`}:{plan:h}}export{k as a,R as b,N as c,_ as d};
|