@hawkeyexl/manni 4.30.0 → 4.32.0
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/README.md +1 -1
- package/dist/{batch-23GVYKFP.js → batch-EXTFKUAM.js} +14 -14
- package/dist/{build-CRK3HT5F.js → build-GADI674Y.js} +15 -15
- package/dist/{calibrate-2RFP3QX2.js → calibrate-UC4DGHYL.js} +15 -15
- package/dist/{capture-267IEE6B.js → capture-HIBYY5R3.js} +14 -14
- package/dist/{check-6FCVYM62.js → check-F7HHGF3D.js} +11 -11
- package/dist/{check-5QX33J6O.js → check-FQ7N5Z2F.js} +32 -32
- package/dist/check-KF453CLV.js +58 -0
- package/dist/{check-2HIBGMXD.js → check-PPNKOK37.js} +14 -14
- package/dist/check-QA3FIAPV.js +58 -0
- package/dist/{chunk-AP3PCNKS.js → chunk-2EA6MOCN.js} +3 -3
- package/dist/{chunk-7PF47O3H.js → chunk-2HKNDIP3.js} +6 -6
- package/dist/{chunk-4YCPB67J.js → chunk-2JQPC5RK.js} +7 -7
- package/dist/chunk-2JQPC5RK.js.map +1 -0
- package/dist/{chunk-SWCFJC7W.js → chunk-2KCIETVY.js} +4 -4
- package/dist/{chunk-UYKRP3M3.js → chunk-2YV6K44B.js} +6 -6
- package/dist/{chunk-DKV6BVW5.js → chunk-3AB4UPAH.js} +3 -3
- package/dist/{chunk-SXNK6FPC.js → chunk-3Q2GJERD.js} +11 -8
- package/dist/chunk-3Q2GJERD.js.map +1 -0
- package/dist/{chunk-7INXFEI7.js → chunk-3SHTLHQ6.js} +7 -7
- package/dist/{chunk-WMI2RDSG.js → chunk-3WUATOHK.js} +4 -4
- package/dist/{chunk-CMJEB5V5.js → chunk-5LLPUOYC.js} +6 -6
- package/dist/{chunk-67GJRC62.js → chunk-5YCFOK6Y.js} +2 -2
- package/dist/{chunk-O2STKCTP.js → chunk-6SB3IQWD.js} +9 -9
- package/dist/{chunk-OZH46DBT.js → chunk-7OMLNFP7.js} +6 -1
- package/dist/chunk-7OMLNFP7.js.map +1 -0
- package/dist/{chunk-4L62A7YB.js → chunk-7PMYQS5K.js} +5 -5
- package/dist/{cli-A5TGO26R.js → chunk-A2KXDBRL.js} +177 -227
- package/dist/chunk-A2KXDBRL.js.map +1 -0
- package/dist/{chunk-6KNIQ2SK.js → chunk-B5DAXZLE.js} +7 -7
- package/dist/{chunk-VGGIJMDA.js → chunk-BHVVKRVV.js} +2 -2
- package/dist/{chunk-C5NE3ZIC.js → chunk-C3WYV3L4.js} +3 -3
- package/dist/{chunk-KAIJHQR2.js → chunk-CWDUIJJX.js} +2 -2
- package/dist/{chunk-KAIJHQR2.js.map → chunk-CWDUIJJX.js.map} +1 -1
- package/dist/{chunk-VCIC7XJB.js → chunk-DUKZLNBC.js} +4 -4
- package/dist/{chunk-U4CWWG2Y.js → chunk-DVHVNTP7.js} +2 -2
- package/dist/{chunk-TU7T6YRR.js → chunk-EESOMRVW.js} +7 -7
- package/dist/{chunk-2FGWZH7A.js → chunk-EOFXK7ON.js} +3 -3
- package/dist/{chunk-5S5DYW7W.js → chunk-GC7FAGRL.js} +10 -10
- package/dist/{chunk-CZFP6Q5O.js → chunk-GEA5SVJU.js} +8 -8
- package/dist/{chunk-ZZGHTXZ2.js → chunk-GY3RMN64.js} +2 -2
- package/dist/{chunk-OJZOKTTX.js → chunk-GYEP6KX7.js} +2 -2
- package/dist/{chunk-GBZVXEVE.js → chunk-HD4IZVVX.js} +3 -3
- package/dist/{chunk-O632I7AB.js → chunk-HG7O47EK.js} +13 -11
- package/dist/chunk-HG7O47EK.js.map +1 -0
- package/dist/{chunk-ERXM4UF7.js → chunk-IFHB4QBS.js} +5 -5
- package/dist/{chunk-77U6NQKQ.js → chunk-IPS3B5WV.js} +3 -3
- package/dist/{chunk-3YA6TGWH.js → chunk-J2PUJFA4.js} +5 -5
- package/dist/{chunk-ZI7RMN3H.js → chunk-J6QJ7T6M.js} +4 -4
- package/dist/{chunk-HXILODV5.js → chunk-JXGJLJOP.js} +2 -2
- package/dist/{chunk-MBJINPKU.js → chunk-KJOF3TAE.js} +14 -14
- package/dist/{chunk-3VBEUMKQ.js → chunk-KU7MRVTB.js} +2 -2
- package/dist/{chunk-OXFNU2IO.js → chunk-L7WBKQ2R.js} +4 -4
- package/dist/{chunk-OPF3NOKF.js → chunk-M77SIRUX.js} +1 -1
- package/dist/{chunk-OPF3NOKF.js.map → chunk-M77SIRUX.js.map} +1 -1
- package/dist/{chunk-JG2QWMDX.js → chunk-MBPDZWYI.js} +457 -366
- package/dist/chunk-MBPDZWYI.js.map +1 -0
- package/dist/{chunk-4MD2JG2F.js → chunk-MRFSWEJA.js} +2 -2
- package/dist/{chunk-BTFXOKCP.js → chunk-MSLBEN74.js} +2 -2
- package/dist/chunk-NFZE4MXL.js +14 -0
- package/dist/chunk-NFZE4MXL.js.map +1 -0
- package/dist/{chunk-ZE3BXQED.js → chunk-OILHKIBL.js} +3 -3
- package/dist/{chunk-LGHJFEEH.js → chunk-PKLRFHO5.js} +2 -2
- package/dist/{chunk-GK3F3FIP.js → chunk-POPJ4INH.js} +94 -169
- package/dist/chunk-POPJ4INH.js.map +1 -0
- package/dist/{chunk-NIXJOL7G.js → chunk-PXUAUKLB.js} +3 -3
- package/dist/{chunk-E6S3VGN6.js → chunk-Q6INPRTC.js} +5 -5
- package/dist/{chunk-CDX4QK6O.js → chunk-QMYR4OI5.js} +29 -2
- package/dist/chunk-QMYR4OI5.js.map +1 -0
- package/dist/{chunk-SXMTWMZZ.js → chunk-QVDRRK5K.js} +40 -12
- package/dist/chunk-QVDRRK5K.js.map +1 -0
- package/dist/{chunk-QEFVMOWF.js → chunk-QYKTIRRE.js} +2 -2
- package/dist/{chunk-MYYTLNO5.js → chunk-RC7TM74Z.js} +7 -7
- package/dist/{chunk-5RCCJ446.js → chunk-RNXOPBBD.js} +9 -9
- package/dist/chunk-RNXOPBBD.js.map +1 -0
- package/dist/{chunk-K5VWSQ4K.js → chunk-RRXIIMKU.js} +3 -3
- package/dist/{chunk-MWWPADYI.js → chunk-RV5GZTXH.js} +6 -6
- package/dist/{chunk-KNMDIR7D.js → chunk-SHTMF6PC.js} +3 -4
- package/dist/chunk-SHTMF6PC.js.map +1 -0
- package/dist/{chunk-YGUAY67B.js → chunk-SMQMGAP3.js} +2 -2
- package/dist/{chunk-5MKSZSXH.js → chunk-SVUF42MI.js} +3 -3
- package/dist/{chunk-F76DU7FH.js → chunk-TZOBQ3TA.js} +3 -3
- package/dist/{chunk-XZFJAVX7.js → chunk-UH7KFBBM.js} +9 -8
- package/dist/chunk-UH7KFBBM.js.map +1 -0
- package/dist/{chunk-V52AGLNN.js → chunk-UKWWA4T7.js} +3 -3
- package/dist/{chunk-YLWI7FR2.js → chunk-UMCTYM7L.js} +3 -3
- package/dist/{chunk-TAGYZJQA.js → chunk-VLUJ46LV.js} +51 -21
- package/dist/chunk-VLUJ46LV.js.map +1 -0
- package/dist/{chunk-6U3XF5VY.js → chunk-VQ3FZVNM.js} +2 -2
- package/dist/{chunk-Z3YNYZR2.js → chunk-VXZ2CIH7.js} +2 -2
- package/dist/{chunk-RKZ2NPO4.js → chunk-WWP6Y7S7.js} +4 -4
- package/dist/{chunk-UUZJP47H.js → chunk-WX7NURTP.js} +8 -8
- package/dist/{chunk-7YDGDI26.js → chunk-XWVXPXWI.js} +6 -6
- package/dist/{chunk-N3J22ZRL.js → chunk-YAPFEDGW.js} +579 -29
- package/dist/chunk-YAPFEDGW.js.map +1 -0
- package/dist/{chunk-7ZRX2OPC.js → chunk-Z6T7UX7R.js} +70 -33
- package/dist/chunk-Z6T7UX7R.js.map +1 -0
- package/dist/{chunk-RRAJMTHV.js → chunk-ZIXRI5XY.js} +4 -4
- package/dist/{chunk-5DER6O26.js → chunk-ZWL5ST2M.js} +3 -3
- package/dist/{cli-NIHSHMIV.js → cli-5UAQT4OU.js} +8 -8
- package/dist/{cli-GKRMSA26.js → cli-67XDE7Q7.js} +28 -28
- package/dist/{cli-Y4ARUWKJ.js → cli-EDXJFE5T.js} +3 -3
- package/dist/{cli-CCUZFOPQ.js → cli-GJ6GRHZN.js} +19 -19
- package/dist/{cli-NKRJ5C4G.js → cli-LQFBUP6H.js} +16 -16
- package/dist/{cli-MT4EPC63.js → cli-MXEFSQJC.js} +15 -15
- package/dist/{cli-S5CSPYEZ.js → cli-OZ4YL6WS.js} +22 -22
- package/dist/{cli-2MHUVZH2.js → cli-PG6Z6YXW.js} +29 -29
- package/dist/cli-SSK7GS43.js +80 -0
- package/dist/cli-TIQNAQJA.js +133 -0
- package/dist/cli-TIQNAQJA.js.map +1 -0
- package/dist/{cli-B7QCMRWR.js → cli-W7QU573I.js} +32 -32
- package/dist/{cli-KUMDTVHH.js → cli-XXJQS3F3.js} +63 -58
- package/dist/cli-XXJQS3F3.js.map +1 -0
- package/dist/cli.js +21 -15
- package/dist/cli.js.map +1 -1
- package/dist/{config-Z3FYLJ6X.js → config-ISXGJ4XM.js} +3 -3
- package/dist/docmeta.js +7 -7
- package/dist/{github-2PYSX7EK.js → github-IKC7EPZ6.js} +11 -11
- package/dist/{github-POT6K5GH.js → github-LUJDHQRN.js} +14 -14
- package/dist/github-Z6S7HS6X.js +49 -0
- package/dist/graph/embed.d.ts +1 -1
- package/dist/graph/embed.js.map +1 -1
- package/dist/graph/runtime.d.ts +2 -2
- package/dist/graph/runtime.js +4 -4
- package/dist/graph/runtime.js.map +1 -1
- package/dist/index.d.ts +854 -787
- package/dist/index.js +85 -72
- package/dist/index.js.map +1 -1
- package/dist/{json-ZWSUMRI5.js → json-FBYXDIQQ.js} +11 -11
- package/dist/{json-3HPHYGQC.js → json-OZKTEKPS.js} +15 -15
- package/dist/{labels-5P4CKGPW.js → labels-MFHU6ZPR.js} +10 -10
- package/dist/{lint-K7R4WNMG.js → lint-2TA4DFLT.js} +13 -13
- package/dist/list-3RIITWCX.js +56 -0
- package/dist/{list-3C7Q6VMU.js → list-JLBUOBV5.js} +14 -14
- package/dist/{list-HOTRWPC7.js → list-YO3W3VKA.js} +11 -11
- package/dist/{page-6U3CEGTB.js → page-4MZGF2N2.js} +10 -10
- package/dist/{prepare-PZVX2VVT.js → prepare-PKGPBUNT.js} +17 -17
- package/dist/{pretty-ENVCHUYG.js → pretty-7PT7ETKZ.js} +24 -24
- package/dist/{pretty-ODBO2IIJ.js → pretty-YHIPZV5I.js} +11 -11
- package/dist/{pretty-53N5ZMM3.js → pretty-YIWBO6C3.js} +14 -14
- package/dist/{release-EFLQT3FW.js → release-VQQXI4XB.js} +4 -4
- package/dist/{reporters-3GE5FK5L.js → reporters-QJ7QC3XA.js} +12 -12
- package/dist/{reporters-MK62LRGW.js → reporters-Y2AUVODK.js} +4 -4
- package/dist/{reporters-FWSJ3O4V.js → reporters-ZUKUAWKX.js} +5 -5
- package/dist/run-ZK6EY5V7.js +59 -0
- package/dist/sarif-HYGCKXCT.js +50 -0
- package/dist/{sarif-IFFO37SO.js → sarif-PIUCN7PT.js} +9 -9
- package/dist/{sarif-2L4MLVF5.js → sarif-YP2DCLLU.js} +9 -9
- package/dist/{strategy-BCRB4A55.js → strategy-E2YCBTAW.js} +21 -21
- package/dist/{term-HPRQBB2A.js → term-RLQ6WZUD.js} +16 -16
- package/dist/{types-GV2THIRC.js → types-YREQ2DQG.js} +6 -4
- package/dist/{validate-TEYFOGI5.js → validate-OPLT7USL.js} +5 -5
- package/dist/validate-OPLT7USL.js.map +1 -0
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +1 -1
- package/dist/check-MYUFZGKO.js +0 -58
- package/dist/check-VKQ6GM5D.js +0 -58
- package/dist/chunk-4YCPB67J.js.map +0 -1
- package/dist/chunk-5RCCJ446.js.map +0 -1
- package/dist/chunk-7ZRX2OPC.js.map +0 -1
- package/dist/chunk-CDX4QK6O.js.map +0 -1
- package/dist/chunk-GK3F3FIP.js.map +0 -1
- package/dist/chunk-JG2QWMDX.js.map +0 -1
- package/dist/chunk-KNMDIR7D.js.map +0 -1
- package/dist/chunk-N3J22ZRL.js.map +0 -1
- package/dist/chunk-O632I7AB.js.map +0 -1
- package/dist/chunk-OZH46DBT.js.map +0 -1
- package/dist/chunk-SXMTWMZZ.js.map +0 -1
- package/dist/chunk-SXNK6FPC.js.map +0 -1
- package/dist/chunk-TAGYZJQA.js.map +0 -1
- package/dist/chunk-XZFJAVX7.js.map +0 -1
- package/dist/cli-A5TGO26R.js.map +0 -1
- package/dist/cli-KUMDTVHH.js.map +0 -1
- package/dist/github-M4QRPNXT.js +0 -49
- package/dist/list-O7IREFT2.js +0 -56
- package/dist/run-GUHRZ3OX.js +0 -59
- package/dist/sarif-2BGXPVSR.js +0 -50
- /package/dist/{batch-23GVYKFP.js.map → batch-EXTFKUAM.js.map} +0 -0
- /package/dist/{build-CRK3HT5F.js.map → build-GADI674Y.js.map} +0 -0
- /package/dist/{calibrate-2RFP3QX2.js.map → calibrate-UC4DGHYL.js.map} +0 -0
- /package/dist/{capture-267IEE6B.js.map → capture-HIBYY5R3.js.map} +0 -0
- /package/dist/{check-2HIBGMXD.js.map → check-F7HHGF3D.js.map} +0 -0
- /package/dist/{check-5QX33J6O.js.map → check-FQ7N5Z2F.js.map} +0 -0
- /package/dist/{check-6FCVYM62.js.map → check-KF453CLV.js.map} +0 -0
- /package/dist/{check-MYUFZGKO.js.map → check-PPNKOK37.js.map} +0 -0
- /package/dist/{check-VKQ6GM5D.js.map → check-QA3FIAPV.js.map} +0 -0
- /package/dist/{chunk-AP3PCNKS.js.map → chunk-2EA6MOCN.js.map} +0 -0
- /package/dist/{chunk-7PF47O3H.js.map → chunk-2HKNDIP3.js.map} +0 -0
- /package/dist/{chunk-SWCFJC7W.js.map → chunk-2KCIETVY.js.map} +0 -0
- /package/dist/{chunk-UYKRP3M3.js.map → chunk-2YV6K44B.js.map} +0 -0
- /package/dist/{chunk-DKV6BVW5.js.map → chunk-3AB4UPAH.js.map} +0 -0
- /package/dist/{chunk-7INXFEI7.js.map → chunk-3SHTLHQ6.js.map} +0 -0
- /package/dist/{chunk-WMI2RDSG.js.map → chunk-3WUATOHK.js.map} +0 -0
- /package/dist/{chunk-CMJEB5V5.js.map → chunk-5LLPUOYC.js.map} +0 -0
- /package/dist/{chunk-67GJRC62.js.map → chunk-5YCFOK6Y.js.map} +0 -0
- /package/dist/{chunk-O2STKCTP.js.map → chunk-6SB3IQWD.js.map} +0 -0
- /package/dist/{chunk-4L62A7YB.js.map → chunk-7PMYQS5K.js.map} +0 -0
- /package/dist/{chunk-6KNIQ2SK.js.map → chunk-B5DAXZLE.js.map} +0 -0
- /package/dist/{chunk-VGGIJMDA.js.map → chunk-BHVVKRVV.js.map} +0 -0
- /package/dist/{chunk-C5NE3ZIC.js.map → chunk-C3WYV3L4.js.map} +0 -0
- /package/dist/{chunk-VCIC7XJB.js.map → chunk-DUKZLNBC.js.map} +0 -0
- /package/dist/{chunk-U4CWWG2Y.js.map → chunk-DVHVNTP7.js.map} +0 -0
- /package/dist/{chunk-TU7T6YRR.js.map → chunk-EESOMRVW.js.map} +0 -0
- /package/dist/{chunk-2FGWZH7A.js.map → chunk-EOFXK7ON.js.map} +0 -0
- /package/dist/{chunk-5S5DYW7W.js.map → chunk-GC7FAGRL.js.map} +0 -0
- /package/dist/{chunk-CZFP6Q5O.js.map → chunk-GEA5SVJU.js.map} +0 -0
- /package/dist/{chunk-ZZGHTXZ2.js.map → chunk-GY3RMN64.js.map} +0 -0
- /package/dist/{chunk-OJZOKTTX.js.map → chunk-GYEP6KX7.js.map} +0 -0
- /package/dist/{chunk-GBZVXEVE.js.map → chunk-HD4IZVVX.js.map} +0 -0
- /package/dist/{chunk-ERXM4UF7.js.map → chunk-IFHB4QBS.js.map} +0 -0
- /package/dist/{chunk-77U6NQKQ.js.map → chunk-IPS3B5WV.js.map} +0 -0
- /package/dist/{chunk-3YA6TGWH.js.map → chunk-J2PUJFA4.js.map} +0 -0
- /package/dist/{chunk-ZI7RMN3H.js.map → chunk-J6QJ7T6M.js.map} +0 -0
- /package/dist/{chunk-HXILODV5.js.map → chunk-JXGJLJOP.js.map} +0 -0
- /package/dist/{chunk-MBJINPKU.js.map → chunk-KJOF3TAE.js.map} +0 -0
- /package/dist/{chunk-3VBEUMKQ.js.map → chunk-KU7MRVTB.js.map} +0 -0
- /package/dist/{chunk-OXFNU2IO.js.map → chunk-L7WBKQ2R.js.map} +0 -0
- /package/dist/{chunk-4MD2JG2F.js.map → chunk-MRFSWEJA.js.map} +0 -0
- /package/dist/{chunk-BTFXOKCP.js.map → chunk-MSLBEN74.js.map} +0 -0
- /package/dist/{chunk-ZE3BXQED.js.map → chunk-OILHKIBL.js.map} +0 -0
- /package/dist/{chunk-LGHJFEEH.js.map → chunk-PKLRFHO5.js.map} +0 -0
- /package/dist/{chunk-NIXJOL7G.js.map → chunk-PXUAUKLB.js.map} +0 -0
- /package/dist/{chunk-E6S3VGN6.js.map → chunk-Q6INPRTC.js.map} +0 -0
- /package/dist/{chunk-QEFVMOWF.js.map → chunk-QYKTIRRE.js.map} +0 -0
- /package/dist/{chunk-MYYTLNO5.js.map → chunk-RC7TM74Z.js.map} +0 -0
- /package/dist/{chunk-K5VWSQ4K.js.map → chunk-RRXIIMKU.js.map} +0 -0
- /package/dist/{chunk-MWWPADYI.js.map → chunk-RV5GZTXH.js.map} +0 -0
- /package/dist/{chunk-YGUAY67B.js.map → chunk-SMQMGAP3.js.map} +0 -0
- /package/dist/{chunk-5MKSZSXH.js.map → chunk-SVUF42MI.js.map} +0 -0
- /package/dist/{chunk-F76DU7FH.js.map → chunk-TZOBQ3TA.js.map} +0 -0
- /package/dist/{chunk-V52AGLNN.js.map → chunk-UKWWA4T7.js.map} +0 -0
- /package/dist/{chunk-YLWI7FR2.js.map → chunk-UMCTYM7L.js.map} +0 -0
- /package/dist/{chunk-6U3XF5VY.js.map → chunk-VQ3FZVNM.js.map} +0 -0
- /package/dist/{chunk-Z3YNYZR2.js.map → chunk-VXZ2CIH7.js.map} +0 -0
- /package/dist/{chunk-RKZ2NPO4.js.map → chunk-WWP6Y7S7.js.map} +0 -0
- /package/dist/{chunk-UUZJP47H.js.map → chunk-WX7NURTP.js.map} +0 -0
- /package/dist/{chunk-7YDGDI26.js.map → chunk-XWVXPXWI.js.map} +0 -0
- /package/dist/{chunk-RRAJMTHV.js.map → chunk-ZIXRI5XY.js.map} +0 -0
- /package/dist/{chunk-5DER6O26.js.map → chunk-ZWL5ST2M.js.map} +0 -0
- /package/dist/{cli-NIHSHMIV.js.map → cli-5UAQT4OU.js.map} +0 -0
- /package/dist/{cli-GKRMSA26.js.map → cli-67XDE7Q7.js.map} +0 -0
- /package/dist/{cli-Y4ARUWKJ.js.map → cli-EDXJFE5T.js.map} +0 -0
- /package/dist/{cli-CCUZFOPQ.js.map → cli-GJ6GRHZN.js.map} +0 -0
- /package/dist/{cli-NKRJ5C4G.js.map → cli-LQFBUP6H.js.map} +0 -0
- /package/dist/{cli-MT4EPC63.js.map → cli-MXEFSQJC.js.map} +0 -0
- /package/dist/{cli-S5CSPYEZ.js.map → cli-OZ4YL6WS.js.map} +0 -0
- /package/dist/{cli-2MHUVZH2.js.map → cli-PG6Z6YXW.js.map} +0 -0
- /package/dist/{config-Z3FYLJ6X.js.map → cli-SSK7GS43.js.map} +0 -0
- /package/dist/{cli-B7QCMRWR.js.map → cli-W7QU573I.js.map} +0 -0
- /package/dist/{github-2PYSX7EK.js.map → config-ISXGJ4XM.js.map} +0 -0
- /package/dist/{github-M4QRPNXT.js.map → github-IKC7EPZ6.js.map} +0 -0
- /package/dist/{github-POT6K5GH.js.map → github-LUJDHQRN.js.map} +0 -0
- /package/dist/{json-3HPHYGQC.js.map → github-Z6S7HS6X.js.map} +0 -0
- /package/dist/{json-ZWSUMRI5.js.map → json-FBYXDIQQ.js.map} +0 -0
- /package/dist/{lint-K7R4WNMG.js.map → json-OZKTEKPS.js.map} +0 -0
- /package/dist/{labels-5P4CKGPW.js.map → labels-MFHU6ZPR.js.map} +0 -0
- /package/dist/{list-3C7Q6VMU.js.map → lint-2TA4DFLT.js.map} +0 -0
- /package/dist/{list-HOTRWPC7.js.map → list-3RIITWCX.js.map} +0 -0
- /package/dist/{list-O7IREFT2.js.map → list-JLBUOBV5.js.map} +0 -0
- /package/dist/{page-6U3CEGTB.js.map → list-YO3W3VKA.js.map} +0 -0
- /package/dist/{pretty-53N5ZMM3.js.map → page-4MZGF2N2.js.map} +0 -0
- /package/dist/{prepare-PZVX2VVT.js.map → prepare-PKGPBUNT.js.map} +0 -0
- /package/dist/{pretty-ENVCHUYG.js.map → pretty-7PT7ETKZ.js.map} +0 -0
- /package/dist/{pretty-ODBO2IIJ.js.map → pretty-YHIPZV5I.js.map} +0 -0
- /package/dist/{reporters-3GE5FK5L.js.map → pretty-YIWBO6C3.js.map} +0 -0
- /package/dist/{release-EFLQT3FW.js.map → release-VQQXI4XB.js.map} +0 -0
- /package/dist/{reporters-FWSJ3O4V.js.map → reporters-QJ7QC3XA.js.map} +0 -0
- /package/dist/{reporters-MK62LRGW.js.map → reporters-Y2AUVODK.js.map} +0 -0
- /package/dist/{run-GUHRZ3OX.js.map → reporters-ZUKUAWKX.js.map} +0 -0
- /package/dist/{sarif-2BGXPVSR.js.map → run-ZK6EY5V7.js.map} +0 -0
- /package/dist/{sarif-2L4MLVF5.js.map → sarif-HYGCKXCT.js.map} +0 -0
- /package/dist/{sarif-IFFO37SO.js.map → sarif-PIUCN7PT.js.map} +0 -0
- /package/dist/{strategy-BCRB4A55.js.map → sarif-YP2DCLLU.js.map} +0 -0
- /package/dist/{types-GV2THIRC.js.map → strategy-E2YCBTAW.js.map} +0 -0
- /package/dist/{term-HPRQBB2A.js.map → term-RLQ6WZUD.js.map} +0 -0
- /package/dist/{validate-TEYFOGI5.js.map → types-YREQ2DQG.js.map} +0 -0
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
import {
|
|
3
3
|
detectFramework,
|
|
4
4
|
loadSiteConfig
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GY3RMN64.js";
|
|
6
6
|
import {
|
|
7
|
+
buildGraph,
|
|
7
8
|
canonicalLanguage,
|
|
8
9
|
deriveGraph,
|
|
9
10
|
termIndex
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-HG7O47EK.js";
|
|
11
12
|
import {
|
|
13
|
+
DEFAULT_MODEL,
|
|
12
14
|
EmbedderUnavailableError,
|
|
13
15
|
bodyOf,
|
|
14
16
|
buildSearchIndex,
|
|
@@ -25,14 +27,15 @@ import {
|
|
|
25
27
|
freshness,
|
|
26
28
|
loadGraph,
|
|
27
29
|
matchList,
|
|
30
|
+
parseGraph,
|
|
28
31
|
partitionByLanguage,
|
|
29
32
|
storeToQuads,
|
|
30
33
|
validateGraph
|
|
31
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-Z6T7UX7R.js";
|
|
32
35
|
import {
|
|
33
36
|
GraphIndex,
|
|
34
37
|
encodeVectorIndex
|
|
35
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-2JQPC5RK.js";
|
|
36
39
|
import {
|
|
37
40
|
COPIED_SHARE,
|
|
38
41
|
EVALS_ARE_AUTHOR_FACING,
|
|
@@ -44,18 +47,17 @@ import {
|
|
|
44
47
|
questionKey,
|
|
45
48
|
readQuestionFile,
|
|
46
49
|
withExternalMetadata
|
|
47
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-WWP6Y7S7.js";
|
|
48
51
|
import {
|
|
49
52
|
LOCALIZATIONS_FILENAME,
|
|
50
53
|
UNDETERMINED,
|
|
51
54
|
canonicalLanguageTag,
|
|
52
55
|
emitLocalizations,
|
|
53
56
|
isLanguageTag,
|
|
54
|
-
isSafeRelativePath,
|
|
55
57
|
parseLocalizations,
|
|
56
58
|
searchIndexFilename,
|
|
57
59
|
vectorIndexFilename
|
|
58
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-SHTMF6PC.js";
|
|
59
61
|
import {
|
|
60
62
|
COVERAGE_FIELDS,
|
|
61
63
|
GRAPH_NOT_APPLICABLE_TO_VARIANT,
|
|
@@ -104,12 +106,12 @@ import {
|
|
|
104
106
|
parseContexts,
|
|
105
107
|
resolveDocumentSet,
|
|
106
108
|
routesFrom
|
|
107
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-POPJ4INH.js";
|
|
108
110
|
import {
|
|
109
111
|
mergeMetaProvenance,
|
|
110
112
|
readRecord,
|
|
111
113
|
splitBody
|
|
112
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-IFHB4QBS.js";
|
|
113
115
|
import {
|
|
114
116
|
findWindows,
|
|
115
117
|
isMissing,
|
|
@@ -118,7 +120,7 @@ import {
|
|
|
118
120
|
pinOfLines,
|
|
119
121
|
spellLines,
|
|
120
122
|
spliceManifestValue
|
|
121
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-C3WYV3L4.js";
|
|
122
124
|
import {
|
|
123
125
|
termLabelSource
|
|
124
126
|
} from "./chunk-DSWKBZWW.js";
|
|
@@ -126,7 +128,11 @@ import {
|
|
|
126
128
|
DocmetaError,
|
|
127
129
|
urlManifestMessage,
|
|
128
130
|
writeFileAtomic
|
|
129
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-RRXIIMKU.js";
|
|
132
|
+
import {
|
|
133
|
+
findConfigFileSync,
|
|
134
|
+
readConfigFileSync
|
|
135
|
+
} from "./chunk-QMYR4OI5.js";
|
|
130
136
|
import {
|
|
131
137
|
noticeOnce,
|
|
132
138
|
warn
|
|
@@ -143,6 +149,7 @@ import {
|
|
|
143
149
|
selectProvider
|
|
144
150
|
} from "./chunk-NVYDWVXN.js";
|
|
145
151
|
import {
|
|
152
|
+
ToolError,
|
|
146
153
|
errorMessage
|
|
147
154
|
} from "./chunk-G3T47CFV.js";
|
|
148
155
|
|
|
@@ -334,8 +341,8 @@ var MEDIA_TYPES = {
|
|
|
334
341
|
".fltoc": "application/xml",
|
|
335
342
|
".flbrs": "application/xml"
|
|
336
343
|
};
|
|
337
|
-
function mediaTypeOf(
|
|
338
|
-
return MEDIA_TYPES[extname(
|
|
344
|
+
function mediaTypeOf(path) {
|
|
345
|
+
return MEDIA_TYPES[extname(path).toLowerCase()] ?? "text/markdown";
|
|
339
346
|
}
|
|
340
347
|
var CARRIED = [
|
|
341
348
|
IIRDS_HAS_TOPIC_TYPE,
|
|
@@ -379,25 +386,25 @@ function projectPackage(store, opts, cwd) {
|
|
|
379
386
|
if (title) add(doc, IIRDS_TITLE, lit(title));
|
|
380
387
|
const language = firstObject(store, doc, `${NS.dcterms}language`);
|
|
381
388
|
if (language) add(doc, IIRDS_LANGUAGE, lit(language));
|
|
382
|
-
const
|
|
383
|
-
if (
|
|
384
|
-
if (escapesArchiveRoot(
|
|
389
|
+
const path = firstObject(store, doc, `${NS.graph}path`);
|
|
390
|
+
if (path) {
|
|
391
|
+
if (escapesArchiveRoot(path)) {
|
|
385
392
|
throw new GraphError(
|
|
386
|
-
`Cannot package "${
|
|
393
|
+
`Cannot package "${path}": an iiRDS package has one root, and a path that climbs above it has no place inside it. Re-run \`manni graph build\` from a directory that contains every document, then export again.`
|
|
387
394
|
);
|
|
388
395
|
}
|
|
389
|
-
const absPath = resolve(cwd,
|
|
396
|
+
const absPath = resolve(cwd, path);
|
|
390
397
|
if (!existsSync(absPath)) {
|
|
391
398
|
throw new GraphError(
|
|
392
|
-
`Content file for ${
|
|
399
|
+
`Content file for ${path} not found at ${absPath} \u2014 re-run \`manni graph build\`, or the source moved.`
|
|
393
400
|
);
|
|
394
401
|
}
|
|
395
|
-
const zipPath = `content/${
|
|
402
|
+
const zipPath = `content/${path}`;
|
|
396
403
|
const rendition = `${doc}/rendition`;
|
|
397
404
|
add(doc, IIRDS_HAS_RENDITION, iri(rendition));
|
|
398
405
|
add(rendition, RDF_TYPE, iri(IIRDS_RENDITION));
|
|
399
406
|
add(rendition, IIRDS_SOURCE, lit(zipPath));
|
|
400
|
-
add(rendition, IIRDS_FORMAT, lit(mediaTypeOf(
|
|
407
|
+
add(rendition, IIRDS_FORMAT, lit(mediaTypeOf(path)));
|
|
401
408
|
contentFiles.push({ zipPath, absPath });
|
|
402
409
|
} else {
|
|
403
410
|
warnings.push(
|
|
@@ -451,11 +458,11 @@ function urlStyle(framework) {
|
|
|
451
458
|
if (framework === "Flare") return "htm";
|
|
452
459
|
return "slash";
|
|
453
460
|
}
|
|
454
|
-
function routeOf(
|
|
455
|
-
const holders = routes.filter((r) => r.root === "" ||
|
|
461
|
+
function routeOf(path, routes, style) {
|
|
462
|
+
const holders = routes.filter((r) => r.root === "" || path.startsWith(`${r.root}/`));
|
|
456
463
|
const route = holders.sort((a, b) => b.root.length - a.root.length)[0];
|
|
457
464
|
if (route === void 0) return void 0;
|
|
458
|
-
const rest = (route.root === "" ?
|
|
465
|
+
const rest = (route.root === "" ? path : path.slice(route.root.length + 1)).replace(/\.[^./]+$/, "");
|
|
459
466
|
const segments = rest.split("/");
|
|
460
467
|
const last = segments[segments.length - 1] ?? "";
|
|
461
468
|
const index = route.indexFiles.includes(last);
|
|
@@ -494,10 +501,10 @@ async function exportLlms(opts) {
|
|
|
494
501
|
const pages = [];
|
|
495
502
|
let missing = 0;
|
|
496
503
|
for (const doc of graph.instancesOf(`${NS.graph}Document`)) {
|
|
497
|
-
const
|
|
498
|
-
if (
|
|
499
|
-
const abs = resolve2(sources,
|
|
500
|
-
if (existsSync2(abs)) pages.push({ doc, path
|
|
504
|
+
const path = graph.literal(doc, `${NS.graph}path`);
|
|
505
|
+
if (path === void 0 || path === STDIN_PATH) continue;
|
|
506
|
+
const abs = resolve2(sources, path);
|
|
507
|
+
if (existsSync2(abs)) pages.push({ doc, path, content: readFileSync(abs, "utf8") });
|
|
501
508
|
else missing += 1;
|
|
502
509
|
}
|
|
503
510
|
pages.sort((a, b) => byCodeUnit(a.path, b.path));
|
|
@@ -554,8 +561,8 @@ var EXTENSION = {
|
|
|
554
561
|
jsonld: ".jsonld",
|
|
555
562
|
iirds: ".iirds"
|
|
556
563
|
};
|
|
557
|
-
function withExtension(
|
|
558
|
-
return
|
|
564
|
+
function withExtension(path, ext) {
|
|
565
|
+
return path.replace(/\.[^./\\]*$/, "") + ext;
|
|
559
566
|
}
|
|
560
567
|
function runJsonLd(cwd, graphPath, out) {
|
|
561
568
|
const store = loadGraph(graphPath);
|
|
@@ -600,16 +607,18 @@ function searchIndexDigest(raw) {
|
|
|
600
607
|
return `sha256:${createHash("sha256").update(raw, "utf8").digest("hex")}`;
|
|
601
608
|
}
|
|
602
609
|
async function runSearchIndex(cwd, sources, graphPath, out, context) {
|
|
603
|
-
const
|
|
610
|
+
const outDir = out ? resolve3(cwd, out) : dirname2(graphPath);
|
|
611
|
+
return writeSearchIndex(loadGraph(graphPath), sources, outDir, { context });
|
|
612
|
+
}
|
|
613
|
+
async function writeSearchIndex(store, sources, outDir, options) {
|
|
604
614
|
const graph = GraphIndex.fromQuads(
|
|
605
615
|
storeToQuads(store),
|
|
606
616
|
Object.fromEntries(PREFIXES)
|
|
607
617
|
);
|
|
608
618
|
const warnings = [];
|
|
609
|
-
const index = await buildSearchIndex(graph, sources, { warnings,
|
|
619
|
+
const index = await buildSearchIndex(graph, sources, { warnings, ...options });
|
|
610
620
|
const byLanguage = partitionByLanguage(graph, index);
|
|
611
621
|
const docCounts = documentsByLanguage(graph);
|
|
612
|
-
const outDir = out ? resolve3(cwd, out) : dirname2(graphPath);
|
|
613
622
|
mkdirSync2(outDir, { recursive: true });
|
|
614
623
|
const languages = [];
|
|
615
624
|
for (const [language, doc] of byLanguage) {
|
|
@@ -825,7 +834,7 @@ function frontmatterKind(content) {
|
|
|
825
834
|
if (/^(\+\+\+|;;;)(\r?\n)/.test(body)) return "unsupported";
|
|
826
835
|
return "none";
|
|
827
836
|
}
|
|
828
|
-
function splitYamlFrontmatter(content,
|
|
837
|
+
function splitYamlFrontmatter(content, path) {
|
|
829
838
|
const bom = content.charCodeAt(0) === 65279 ? content.slice(0, 1) : "";
|
|
830
839
|
const body = bom ? content.slice(1) : content;
|
|
831
840
|
const openMatch = /^---(\r?\n)/.exec(body);
|
|
@@ -846,7 +855,7 @@ function splitYamlFrontmatter(content, path2) {
|
|
|
846
855
|
}
|
|
847
856
|
offset += line.length;
|
|
848
857
|
}
|
|
849
|
-
throw new GraphError(`${
|
|
858
|
+
throw new GraphError(`${path}: unterminated frontmatter block`);
|
|
850
859
|
}
|
|
851
860
|
function flowSeqs(node) {
|
|
852
861
|
if (node instanceof YAMLSeq) {
|
|
@@ -861,7 +870,7 @@ function setField(doc, map, field, value) {
|
|
|
861
870
|
flowSeqs(node);
|
|
862
871
|
map.set(field, node);
|
|
863
872
|
}
|
|
864
|
-
function applyGraphFields(content,
|
|
873
|
+
function applyGraphFields(content, path, values, options = {}) {
|
|
865
874
|
const entries = writable(values);
|
|
866
875
|
const pageEntries = Object.entries(options.page ?? {});
|
|
867
876
|
if (entries.length === 0 && pageEntries.length === 0) {
|
|
@@ -869,10 +878,10 @@ function applyGraphFields(content, path2, values, options = {}) {
|
|
|
869
878
|
}
|
|
870
879
|
if (frontmatterKind(content) === "unsupported") {
|
|
871
880
|
throw new GraphError(
|
|
872
|
-
`${
|
|
881
|
+
`${path}: only YAML frontmatter can be edited (found a TOML/JSON fence)`
|
|
873
882
|
);
|
|
874
883
|
}
|
|
875
|
-
const split = splitYamlFrontmatter(content,
|
|
884
|
+
const split = splitYamlFrontmatter(content, path);
|
|
876
885
|
if (split === null) {
|
|
877
886
|
const eol = content.includes("\r\n") ? "\r\n" : "\n";
|
|
878
887
|
const nested = {};
|
|
@@ -902,12 +911,12 @@ function applyGraphFields(content, path2, values, options = {}) {
|
|
|
902
911
|
const doc = parseDocument(split.block);
|
|
903
912
|
if (doc.errors.length > 0) {
|
|
904
913
|
throw new GraphError(
|
|
905
|
-
`${
|
|
914
|
+
`${path}: cannot edit frontmatter \u2014 ${doc.errors[0]?.message ?? "parse error"}`
|
|
906
915
|
);
|
|
907
916
|
}
|
|
908
917
|
let graph = doc.get("graph", true);
|
|
909
918
|
if (graph !== void 0 && !isMap(graph)) {
|
|
910
|
-
throw new GraphError(`${
|
|
919
|
+
throw new GraphError(`${path}: frontmatter key "graph" is not a map`);
|
|
911
920
|
}
|
|
912
921
|
if (graph === void 0 && entries.length > 0) {
|
|
913
922
|
graph = doc.createNode({});
|
|
@@ -980,9 +989,9 @@ function mergeFields(doc, graphMap, entries, force) {
|
|
|
980
989
|
}
|
|
981
990
|
return { applied, skipped };
|
|
982
991
|
}
|
|
983
|
-
function writeGraphFields(content,
|
|
992
|
+
function writeGraphFields(content, path, format, values, options = {}) {
|
|
984
993
|
if (format === "markdown" || format === "mdx") {
|
|
985
|
-
return applyGraphFields(content,
|
|
994
|
+
return applyGraphFields(content, path, values, options);
|
|
986
995
|
}
|
|
987
996
|
const entries = writable(values);
|
|
988
997
|
const patch = {};
|
|
@@ -990,10 +999,10 @@ function writeGraphFields(content, path2, format, values, options = {}) {
|
|
|
990
999
|
let skipped = [];
|
|
991
1000
|
if (entries.length > 0) {
|
|
992
1001
|
const doc = new Document(
|
|
993
|
-
metadataOf(content,
|
|
1002
|
+
metadataOf(content, path, format).data[GRAPH_KEY] ?? {}
|
|
994
1003
|
);
|
|
995
1004
|
if (!isMap(doc.contents)) {
|
|
996
|
-
throw new GraphError(`${
|
|
1005
|
+
throw new GraphError(`${path}: metadata key "graph" is not a map`);
|
|
997
1006
|
}
|
|
998
1007
|
({ applied, skipped } = mergeFields(
|
|
999
1008
|
doc,
|
|
@@ -1007,9 +1016,9 @@ function writeGraphFields(content, path2, format, values, options = {}) {
|
|
|
1007
1016
|
if (Object.keys(patch).length === 0) return { content, applied, skipped };
|
|
1008
1017
|
const apply = extractorFor(format)?.apply;
|
|
1009
1018
|
if (apply === void 0) {
|
|
1010
|
-
throw new GraphError(`${
|
|
1019
|
+
throw new GraphError(`${path}: manni cannot write ${format} metadata`);
|
|
1011
1020
|
}
|
|
1012
|
-
return { content: apply(content, patch, { filePath:
|
|
1021
|
+
return { content: apply(content, patch, { filePath: path }), applied, skipped };
|
|
1013
1022
|
}
|
|
1014
1023
|
function frontmatterData(content) {
|
|
1015
1024
|
const split = splitYamlFrontmatter(content, "");
|
|
@@ -1123,19 +1132,19 @@ var FillGuard = class _FillGuard {
|
|
|
1123
1132
|
force
|
|
1124
1133
|
);
|
|
1125
1134
|
const byExtension = { routes: config.routes, context };
|
|
1126
|
-
for (const
|
|
1135
|
+
for (const path of all) {
|
|
1127
1136
|
try {
|
|
1128
1137
|
guard.models.set(
|
|
1129
|
-
|
|
1138
|
+
path,
|
|
1130
1139
|
await analyzeDoc(
|
|
1131
|
-
inline.get(
|
|
1132
|
-
|
|
1140
|
+
inline.get(path) ?? readFileSync3(resolve5(cwd, path), "utf8"),
|
|
1141
|
+
path,
|
|
1133
1142
|
guard.allPaths,
|
|
1134
|
-
inputs.has(
|
|
1143
|
+
inputs.has(path) ? guard.analyzeOptions : byExtension
|
|
1135
1144
|
)
|
|
1136
1145
|
);
|
|
1137
1146
|
} catch {
|
|
1138
|
-
guard.unreadable.push(
|
|
1147
|
+
guard.unreadable.push(path);
|
|
1139
1148
|
}
|
|
1140
1149
|
}
|
|
1141
1150
|
guard.unreadable.sort(byCodeUnit);
|
|
@@ -1143,8 +1152,8 @@ var FillGuard = class _FillGuard {
|
|
|
1143
1152
|
}
|
|
1144
1153
|
buildStore(override) {
|
|
1145
1154
|
const models = [];
|
|
1146
|
-
for (const [
|
|
1147
|
-
models.push(override &&
|
|
1155
|
+
for (const [path, model] of this.models) {
|
|
1156
|
+
models.push(override && path === override.path ? override.model : model);
|
|
1148
1157
|
}
|
|
1149
1158
|
return toStore(
|
|
1150
1159
|
deriveGraph(models, { baseIri: this.baseIri, derive: this.sources })
|
|
@@ -1200,7 +1209,7 @@ var FillGuard = class _FillGuard {
|
|
|
1200
1209
|
* reject the proposed label (an LLM must not introduce a second
|
|
1201
1210
|
* spelling of an existing concept).
|
|
1202
1211
|
*/
|
|
1203
|
-
async vet(
|
|
1212
|
+
async vet(path, content, values) {
|
|
1204
1213
|
const current = { ...values };
|
|
1205
1214
|
const rejected = [];
|
|
1206
1215
|
const guardedLeaves = new Set(GUARDED_FIELDS);
|
|
@@ -1212,19 +1221,19 @@ var FillGuard = class _FillGuard {
|
|
|
1212
1221
|
while (guarded().length > 0) {
|
|
1213
1222
|
const applied = writeGraphFields(
|
|
1214
1223
|
content,
|
|
1215
|
-
|
|
1216
|
-
formatOf(
|
|
1224
|
+
path,
|
|
1225
|
+
formatOf(path, this.analyzeOptions.format),
|
|
1217
1226
|
current,
|
|
1218
1227
|
{ force: this.force }
|
|
1219
1228
|
);
|
|
1220
1229
|
const model = await analyzeDoc(
|
|
1221
1230
|
applied.content,
|
|
1222
|
-
|
|
1231
|
+
path,
|
|
1223
1232
|
this.allPaths,
|
|
1224
1233
|
this.analyzeOptions
|
|
1225
1234
|
);
|
|
1226
1235
|
const findings = await validateGraph(
|
|
1227
|
-
this.buildStore({ path
|
|
1236
|
+
this.buildStore({ path, model }),
|
|
1228
1237
|
this.shapesPaths
|
|
1229
1238
|
);
|
|
1230
1239
|
const introduced = findings.filter(
|
|
@@ -1256,10 +1265,10 @@ var FillGuard = class _FillGuard {
|
|
|
1256
1265
|
return { values: current, rejected };
|
|
1257
1266
|
}
|
|
1258
1267
|
/** Fold an accepted (written or would-be-written) doc into guard state. */
|
|
1259
|
-
async commit(
|
|
1268
|
+
async commit(path, content) {
|
|
1260
1269
|
this.models.set(
|
|
1261
|
-
|
|
1262
|
-
await analyzeDoc(content,
|
|
1270
|
+
path,
|
|
1271
|
+
await analyzeDoc(content, path, this.allPaths, this.analyzeOptions)
|
|
1263
1272
|
);
|
|
1264
1273
|
this.baselineKeys = null;
|
|
1265
1274
|
}
|
|
@@ -1692,8 +1701,8 @@ function locateQuote(body, quote) {
|
|
|
1692
1701
|
const twice = folded.indexOf(wanted, found + wanted.length) >= 0;
|
|
1693
1702
|
return { start: lineAt(start), end: lineAt(end), ...twice ? { ambiguous: true } : {} };
|
|
1694
1703
|
}
|
|
1695
|
-
function twiceWarning(
|
|
1696
|
-
return `${
|
|
1704
|
+
function twiceWarning(path, question, lines) {
|
|
1705
|
+
return `${path}: the answer to "${question}" appears more than once, so ${spellLines(lines)} is pinned; check it is the right one.`;
|
|
1697
1706
|
}
|
|
1698
1707
|
function pinFor(body, lines) {
|
|
1699
1708
|
return { lines: lineSpec(lines), integrity: pinOfLines(body, lines) };
|
|
@@ -1727,9 +1736,9 @@ function settle(tracked) {
|
|
|
1727
1736
|
});
|
|
1728
1737
|
}
|
|
1729
1738
|
async function fillPageQuestions(input) {
|
|
1730
|
-
const { path
|
|
1739
|
+
const { path, format, content, settings, asker, known } = input;
|
|
1731
1740
|
const { body } = bodyOf(content, format);
|
|
1732
|
-
const held = metadataOf(content,
|
|
1741
|
+
const held = metadataOf(content, path, format).data[QUESTIONS_KEY];
|
|
1733
1742
|
const raw = Array.isArray(held) ? held : held === void 0 ? [] : [held];
|
|
1734
1743
|
const tracked = [];
|
|
1735
1744
|
const warnings = [];
|
|
@@ -1785,7 +1794,7 @@ async function fillPageQuestions(input) {
|
|
|
1785
1794
|
changed = true;
|
|
1786
1795
|
} else if (fresh.state === "ambiguous") {
|
|
1787
1796
|
warnings.push(
|
|
1788
|
-
`${
|
|
1797
|
+
`${path}: the answer to "${question}" moved, and ${matchList(fresh.ranges)}, so pin one of them by hand.`
|
|
1789
1798
|
);
|
|
1790
1799
|
}
|
|
1791
1800
|
}
|
|
@@ -1811,7 +1820,7 @@ async function fillPageQuestions(input) {
|
|
|
1811
1820
|
if (!changed) {
|
|
1812
1821
|
return { content, outcomes: settle(tracked), state, ...skipped ? { skipped } : {}, warnings };
|
|
1813
1822
|
}
|
|
1814
|
-
const write = () => writeGraphFields(content,
|
|
1823
|
+
const write = () => writeGraphFields(content, path, format, {}, { page: { [QUESTIONS_KEY]: items } }).content;
|
|
1815
1824
|
let next = write();
|
|
1816
1825
|
let before = body;
|
|
1817
1826
|
for (let round = 0; ; round++) {
|
|
@@ -1819,7 +1828,7 @@ async function fillPageQuestions(input) {
|
|
|
1819
1828
|
if (!relocate(pins, before, after)) break;
|
|
1820
1829
|
if (round === 2) {
|
|
1821
1830
|
next = write();
|
|
1822
|
-
warnings.push(`${
|
|
1831
|
+
warnings.push(`${path}: the answer pins did not settle, so check their lines.`);
|
|
1823
1832
|
break;
|
|
1824
1833
|
}
|
|
1825
1834
|
before = after;
|
|
@@ -1834,7 +1843,7 @@ async function fillPageQuestions(input) {
|
|
|
1834
1843
|
};
|
|
1835
1844
|
async function ask(model) {
|
|
1836
1845
|
const request = {
|
|
1837
|
-
path
|
|
1846
|
+
path,
|
|
1838
1847
|
title: input.title,
|
|
1839
1848
|
concepts: await input.concepts(),
|
|
1840
1849
|
pair: needs.map((n) => n.question),
|
|
@@ -1862,7 +1871,7 @@ async function fillPageQuestions(input) {
|
|
|
1862
1871
|
for (const c of candidates) {
|
|
1863
1872
|
const lines = locateQuote(body, c.quote);
|
|
1864
1873
|
if (lines !== void 0) {
|
|
1865
|
-
if (lines.ambiguous) warnings.push(twiceWarning(
|
|
1874
|
+
if (lines.ambiguous) warnings.push(twiceWarning(path, question, lines));
|
|
1866
1875
|
found = { lines: { start: lines.start, end: lines.end }, confidence: c.confidence };
|
|
1867
1876
|
break;
|
|
1868
1877
|
}
|
|
@@ -1902,7 +1911,7 @@ async function fillPageQuestions(input) {
|
|
|
1902
1911
|
tracked.push({ action: "dropped", question, reason: "answer not on page" });
|
|
1903
1912
|
continue;
|
|
1904
1913
|
}
|
|
1905
|
-
if (located.ambiguous) warnings.push(twiceWarning(
|
|
1914
|
+
if (located.ambiguous) warnings.push(twiceWarning(path, question, located));
|
|
1906
1915
|
const lines = { start: located.start, end: located.end };
|
|
1907
1916
|
const key = questionKey(question);
|
|
1908
1917
|
const asked = key === "" ? void 0 : known.get(key);
|
|
@@ -1931,15 +1940,15 @@ async function fillPageQuestions(input) {
|
|
|
1931
1940
|
...settings.writeProvenance ? { "generated-by": model.generatedBy, confidence } : {},
|
|
1932
1941
|
reviewed: false
|
|
1933
1942
|
});
|
|
1934
|
-
if (key !== "") known.set(key,
|
|
1943
|
+
if (key !== "") known.set(key, path);
|
|
1935
1944
|
tracked.push({ action: "drafted", question, confidence, pin });
|
|
1936
1945
|
accepted++;
|
|
1937
1946
|
}
|
|
1938
1947
|
return accepted > 0;
|
|
1939
1948
|
}
|
|
1940
1949
|
}
|
|
1941
|
-
function questionsIn(content,
|
|
1942
|
-
const held = metadataOf(content,
|
|
1950
|
+
function questionsIn(content, path, format) {
|
|
1951
|
+
const held = metadataOf(content, path, format).data[QUESTIONS_KEY];
|
|
1943
1952
|
const raw = Array.isArray(held) ? held : held === void 0 ? [] : [held];
|
|
1944
1953
|
return raw.flatMap(
|
|
1945
1954
|
(v) => typeof v === "string" ? [v] : isRecord(v) && typeof v.question === "string" ? [v.question] : []
|
|
@@ -2140,7 +2149,7 @@ async function runFill(opts = {}) {
|
|
|
2140
2149
|
])
|
|
2141
2150
|
];
|
|
2142
2151
|
const inputs = new Set(files);
|
|
2143
|
-
const formatFor = (
|
|
2152
|
+
const formatFor = (path) => inputs.has(path) ? format : void 0;
|
|
2144
2153
|
const mergeErrors = /* @__PURE__ */ new Map();
|
|
2145
2154
|
const view = await openMetaViewPerPage(
|
|
2146
2155
|
{
|
|
@@ -2154,33 +2163,33 @@ async function runFill(opts = {}) {
|
|
|
2154
2163
|
);
|
|
2155
2164
|
const mergedTexts = /* @__PURE__ */ new Map();
|
|
2156
2165
|
const inline = /* @__PURE__ */ new Map();
|
|
2157
|
-
for (const
|
|
2158
|
-
if (mergeErrors.has(
|
|
2166
|
+
for (const path of guardFiles) {
|
|
2167
|
+
if (mergeErrors.has(path)) continue;
|
|
2159
2168
|
let text;
|
|
2160
2169
|
try {
|
|
2161
|
-
text = readFileSync5(resolve7(base2,
|
|
2170
|
+
text = readFileSync5(resolve7(base2, path), "utf8");
|
|
2162
2171
|
} catch (e) {
|
|
2163
|
-
mergeErrors.set(
|
|
2172
|
+
mergeErrors.set(path, e);
|
|
2164
2173
|
continue;
|
|
2165
2174
|
}
|
|
2166
2175
|
let asMetaReadsIt;
|
|
2167
2176
|
try {
|
|
2168
2177
|
asMetaReadsIt = await mergedText(
|
|
2169
2178
|
view,
|
|
2170
|
-
|
|
2179
|
+
path,
|
|
2171
2180
|
text,
|
|
2172
|
-
formatOf(
|
|
2181
|
+
formatOf(path, formatFor(path))
|
|
2173
2182
|
);
|
|
2174
2183
|
} catch (e) {
|
|
2175
|
-
mergeErrors.set(
|
|
2184
|
+
mergeErrors.set(path, e);
|
|
2176
2185
|
continue;
|
|
2177
2186
|
}
|
|
2178
|
-
mergedTexts.set(
|
|
2179
|
-
if (asMetaReadsIt !== text) inline.set(
|
|
2187
|
+
mergedTexts.set(path, asMetaReadsIt);
|
|
2188
|
+
if (asMetaReadsIt !== text) inline.set(path, asMetaReadsIt);
|
|
2180
2189
|
}
|
|
2181
2190
|
if (stdinContent !== void 0) inline.set(STDIN_PATH, stdinContent);
|
|
2182
2191
|
const guard = !opts.noValidateGraph && config.fill.validateGraph ? await FillGuard.create(
|
|
2183
|
-
guardFiles.filter((
|
|
2192
|
+
guardFiles.filter((path) => !mergeErrors.has(path)),
|
|
2184
2193
|
base2,
|
|
2185
2194
|
{ ...config, routes: routesFrom(config, base2) },
|
|
2186
2195
|
shapesPaths,
|
|
@@ -2194,8 +2203,8 @@ async function runFill(opts = {}) {
|
|
|
2194
2203
|
) : void 0;
|
|
2195
2204
|
if (guard) {
|
|
2196
2205
|
const leftOut = [
|
|
2197
|
-
...guardFiles.filter((
|
|
2198
|
-
...guard.unreadable.filter((
|
|
2206
|
+
...guardFiles.filter((path) => !inputs.has(path) && mergeErrors.has(path)),
|
|
2207
|
+
...guard.unreadable.filter((path) => !inputs.has(path) && path !== STDIN_PATH)
|
|
2199
2208
|
].sort(byCodeUnit);
|
|
2200
2209
|
if (leftOut.length > 0) {
|
|
2201
2210
|
warn(
|
|
@@ -2215,10 +2224,10 @@ async function runFill(opts = {}) {
|
|
|
2215
2224
|
...[...mergedTexts].sort(([a], [b]) => byCodeUnit(a, b)),
|
|
2216
2225
|
...stdinContent === void 0 ? [] : [[STDIN_PATH, stdinContent]]
|
|
2217
2226
|
];
|
|
2218
|
-
for (const [
|
|
2219
|
-
for (const q of questionsIn(text,
|
|
2227
|
+
for (const [path, text] of asked) {
|
|
2228
|
+
for (const q of questionsIn(text, path, formatOf(path, formatFor(path)))) {
|
|
2220
2229
|
const key = questionKey(q);
|
|
2221
|
-
if (key !== "" && !known.has(key)) known.set(key,
|
|
2230
|
+
if (key !== "" && !known.has(key)) known.set(key, path);
|
|
2222
2231
|
}
|
|
2223
2232
|
}
|
|
2224
2233
|
for (const label of config.questionFiles) {
|
|
@@ -2290,21 +2299,21 @@ async function runFill(opts = {}) {
|
|
|
2290
2299
|
}
|
|
2291
2300
|
return [...out].map(([label, altLabels]) => ({ label, altLabels }));
|
|
2292
2301
|
}
|
|
2293
|
-
for (const
|
|
2294
|
-
const absPath = resolve7(base2,
|
|
2302
|
+
for (const path of files) {
|
|
2303
|
+
const absPath = resolve7(base2, path);
|
|
2295
2304
|
let content;
|
|
2296
2305
|
try {
|
|
2297
2306
|
content = readFileSync5(absPath, "utf8");
|
|
2298
2307
|
} catch (e) {
|
|
2299
2308
|
throw new GraphError(
|
|
2300
|
-
`cannot read ${
|
|
2309
|
+
`cannot read ${path}: ${errorMessage(e)}`
|
|
2301
2310
|
);
|
|
2302
2311
|
}
|
|
2303
2312
|
try {
|
|
2304
|
-
results.push(await fillPage(
|
|
2313
|
+
results.push(await fillPage(path, absPath, content));
|
|
2305
2314
|
} catch (e) {
|
|
2306
2315
|
results.push({
|
|
2307
|
-
path
|
|
2316
|
+
path,
|
|
2308
2317
|
status: "error",
|
|
2309
2318
|
fields: [],
|
|
2310
2319
|
preserved: [],
|
|
@@ -2371,16 +2380,16 @@ async function runFill(opts = {}) {
|
|
|
2371
2380
|
exitCode: hasErrors ? 1 : 0,
|
|
2372
2381
|
...stdinDocument === void 0 ? {} : { stdinDocument }
|
|
2373
2382
|
};
|
|
2374
|
-
async function fillPage(
|
|
2375
|
-
const { after, merged, ...result } = await fillOne(
|
|
2383
|
+
async function fillPage(path, absPath, content) {
|
|
2384
|
+
const { after, merged, ...result } = await fillOne(path, absPath, content);
|
|
2376
2385
|
if (!withQuestions) return result;
|
|
2377
|
-
const pageFormat = formatOf(
|
|
2378
|
-
const data = metadataOf(merged ?? mergedTexts.get(
|
|
2386
|
+
const pageFormat = formatOf(path, format);
|
|
2387
|
+
const data = metadataOf(merged ?? mergedTexts.get(path) ?? content, path, pageFormat).data;
|
|
2379
2388
|
const pass = await fillPageQuestions({
|
|
2380
|
-
path
|
|
2389
|
+
path,
|
|
2381
2390
|
format: pageFormat,
|
|
2382
2391
|
content: after ?? content,
|
|
2383
|
-
title: typeof data["title"] === "string" ? data["title"] :
|
|
2392
|
+
title: typeof data["title"] === "string" ? data["title"] : path,
|
|
2384
2393
|
concepts: () => conceptsOf(data),
|
|
2385
2394
|
settings: questionSettings,
|
|
2386
2395
|
asker,
|
|
@@ -2410,22 +2419,22 @@ async function runFill(opts = {}) {
|
|
|
2410
2419
|
}
|
|
2411
2420
|
return { ...result, ...outcomes };
|
|
2412
2421
|
}
|
|
2413
|
-
async function fillOne(
|
|
2414
|
-
const pageFormat = formatOf(
|
|
2422
|
+
async function fillOne(path, absPath, content) {
|
|
2423
|
+
const pageFormat = formatOf(path, format);
|
|
2415
2424
|
if ((pageFormat === "markdown" || pageFormat === "mdx") && frontmatterKind(content) === "unsupported") {
|
|
2416
2425
|
throw new GraphError(
|
|
2417
2426
|
"only YAML frontmatter can be edited (found a TOML/JSON fence) \u2014 exclude this file or convert its frontmatter"
|
|
2418
2427
|
);
|
|
2419
2428
|
}
|
|
2420
|
-
const effective = absPath === void 0 ? content : mergedTexts.get(
|
|
2429
|
+
const effective = absPath === void 0 ? content : mergedTexts.get(path);
|
|
2421
2430
|
if (effective === void 0) {
|
|
2422
|
-
const failure = mergeErrors.get(
|
|
2431
|
+
const failure = mergeErrors.get(path);
|
|
2423
2432
|
throw failure instanceof Error ? failure : new GraphError(errorMessage(failure));
|
|
2424
2433
|
}
|
|
2425
2434
|
if (absPath !== void 0) {
|
|
2426
|
-
const own2 = metadataOf(content,
|
|
2435
|
+
const own2 = metadataOf(content, path, pageFormat).data;
|
|
2427
2436
|
if (GRAPH_KEY2 in own2) {
|
|
2428
|
-
const home = await view.home(
|
|
2437
|
+
const home = await view.home(path, own2, GRAPH_KEY2);
|
|
2429
2438
|
if (home.kind !== "unowned") {
|
|
2430
2439
|
throw new GraphError(
|
|
2431
2440
|
`"${GRAPH_KEY2}" is owned by manifest ${home.file} (collection ${home.collection}); remove it from the document`
|
|
@@ -2433,7 +2442,7 @@ async function runFill(opts = {}) {
|
|
|
2433
2442
|
}
|
|
2434
2443
|
}
|
|
2435
2444
|
}
|
|
2436
|
-
const held = metadataOf(effective,
|
|
2445
|
+
const held = metadataOf(effective, path, pageFormat).data;
|
|
2437
2446
|
const heldGraph = held[GRAPH_KEY2];
|
|
2438
2447
|
const present = new Set(
|
|
2439
2448
|
heldGraph !== null && typeof heldGraph === "object" && !Array.isArray(heldGraph) ? Object.keys(heldGraph) : []
|
|
@@ -2441,7 +2450,7 @@ async function runFill(opts = {}) {
|
|
|
2441
2450
|
const missing = opts.force ? fields : fields.filter((f) => !present.has(f));
|
|
2442
2451
|
if (fields.length === 0 || missing.length === 0 && !withSections) {
|
|
2443
2452
|
return {
|
|
2444
|
-
path
|
|
2453
|
+
path,
|
|
2445
2454
|
status: "complete",
|
|
2446
2455
|
fields: [],
|
|
2447
2456
|
preserved: [],
|
|
@@ -2450,7 +2459,7 @@ async function runFill(opts = {}) {
|
|
|
2450
2459
|
}
|
|
2451
2460
|
if (identity === void 0) {
|
|
2452
2461
|
return {
|
|
2453
|
-
path
|
|
2462
|
+
path,
|
|
2454
2463
|
status: "skipped",
|
|
2455
2464
|
reason: OFFLINE_REASON,
|
|
2456
2465
|
fields: [],
|
|
@@ -2471,11 +2480,11 @@ async function runFill(opts = {}) {
|
|
|
2471
2480
|
}
|
|
2472
2481
|
const cached = proposal !== void 0;
|
|
2473
2482
|
let docModel;
|
|
2474
|
-
const doc = () => docModel ??= analyzeDoc(effective,
|
|
2483
|
+
const doc = () => docModel ??= analyzeDoc(effective, path, allPaths, analyzeOptions);
|
|
2475
2484
|
if (proposal === void 0) {
|
|
2476
2485
|
if (maxTurns !== null && turnsUsed >= maxTurns) {
|
|
2477
2486
|
return {
|
|
2478
|
-
path
|
|
2487
|
+
path,
|
|
2479
2488
|
status: "skipped",
|
|
2480
2489
|
reason: TURN_BUDGET_REASON,
|
|
2481
2490
|
fields: [],
|
|
@@ -2551,7 +2560,7 @@ async function runFill(opts = {}) {
|
|
|
2551
2560
|
const lowConf = lowConfidence.length > 0 ? { lowConfidence } : {};
|
|
2552
2561
|
let rejected;
|
|
2553
2562
|
if (guard) {
|
|
2554
|
-
const vetted = await guard.vet(
|
|
2563
|
+
const vetted = await guard.vet(path, effective, narrowed);
|
|
2555
2564
|
if (vetted.rejected.length > 0) {
|
|
2556
2565
|
rejected = vetted.rejected.map((r) => r.field);
|
|
2557
2566
|
for (const field of rejected) Reflect.deleteProperty(narrowed, field);
|
|
@@ -2564,7 +2573,7 @@ async function runFill(opts = {}) {
|
|
|
2564
2573
|
});
|
|
2565
2574
|
if (realFields.length === 0) {
|
|
2566
2575
|
return {
|
|
2567
|
-
path
|
|
2576
|
+
path,
|
|
2568
2577
|
status: "nothing-proposed",
|
|
2569
2578
|
fields: [],
|
|
2570
2579
|
preserved: [],
|
|
@@ -2577,7 +2586,7 @@ async function runFill(opts = {}) {
|
|
|
2577
2586
|
let provenanceList;
|
|
2578
2587
|
if (config.fill.writeProvenance) {
|
|
2579
2588
|
const recordable = realFields.filter((f) => !f.includes(".")).sort();
|
|
2580
|
-
if (recordable.length < realFields.length) sectionsUnrecorded.push(
|
|
2589
|
+
if (recordable.length < realFields.length) sectionsUnrecorded.push(path);
|
|
2581
2590
|
const heldProvenance = held[META_PROVENANCE_KEY];
|
|
2582
2591
|
const priorEntry = Array.isArray(heldProvenance) ? heldProvenance.find(
|
|
2583
2592
|
(e) => !!e && typeof e === "object" && !Array.isArray(e) && e["generated-by"] === identity.model
|
|
@@ -2606,13 +2615,13 @@ async function runFill(opts = {}) {
|
|
|
2606
2615
|
provenanceList = merged.list;
|
|
2607
2616
|
}
|
|
2608
2617
|
}
|
|
2609
|
-
const applied = writeGraphFields(effective,
|
|
2618
|
+
const applied = writeGraphFields(effective, path, pageFormat, narrowed, {
|
|
2610
2619
|
force: opts.force
|
|
2611
2620
|
});
|
|
2612
2621
|
const reportedFields = applied.applied;
|
|
2613
2622
|
if (reportedFields.length === 0) {
|
|
2614
2623
|
return {
|
|
2615
|
-
path
|
|
2624
|
+
path,
|
|
2616
2625
|
status: "nothing-proposed",
|
|
2617
2626
|
fields: [],
|
|
2618
2627
|
preserved: applied.skipped,
|
|
@@ -2622,14 +2631,14 @@ async function runFill(opts = {}) {
|
|
|
2622
2631
|
cached
|
|
2623
2632
|
};
|
|
2624
2633
|
}
|
|
2625
|
-
const own = metadataOf(content,
|
|
2626
|
-
const graphHome = absPath === void 0 ? void 0 : await view.home(
|
|
2627
|
-
const provenanceHome = absPath === void 0 || provenanceList === void 0 ? void 0 : await view.home(
|
|
2628
|
-
const graphTarget = writeTarget(
|
|
2634
|
+
const own = metadataOf(content, path, pageFormat).data;
|
|
2635
|
+
const graphHome = absPath === void 0 ? void 0 : await view.home(path, own, GRAPH_KEY2);
|
|
2636
|
+
const provenanceHome = absPath === void 0 || provenanceList === void 0 ? void 0 : await view.home(path, own, META_PROVENANCE_KEY);
|
|
2637
|
+
const graphTarget = writeTarget(path, graphHome, GRAPH_KEY2);
|
|
2629
2638
|
if (typeof graphTarget === "string") throw new GraphError(graphTarget);
|
|
2630
|
-
let provenanceTarget = writeTarget(
|
|
2639
|
+
let provenanceTarget = writeTarget(path, provenanceHome, META_PROVENANCE_KEY);
|
|
2631
2640
|
if (typeof provenanceTarget === "string") {
|
|
2632
|
-
warnings.push(`${provenanceTarget} The fill of ${
|
|
2641
|
+
warnings.push(`${provenanceTarget} The fill of ${path} is not recorded.`);
|
|
2633
2642
|
provenanceList = void 0;
|
|
2634
2643
|
provenanceTarget = null;
|
|
2635
2644
|
}
|
|
@@ -2639,7 +2648,7 @@ async function runFill(opts = {}) {
|
|
|
2639
2648
|
}
|
|
2640
2649
|
const pageContent = writeGraphFields(
|
|
2641
2650
|
content,
|
|
2642
|
-
|
|
2651
|
+
path,
|
|
2643
2652
|
pageFormat,
|
|
2644
2653
|
graphTarget === null ? narrowed : {},
|
|
2645
2654
|
{ force: opts.force, page: pageKeys }
|
|
@@ -2649,7 +2658,7 @@ async function runFill(opts = {}) {
|
|
|
2649
2658
|
manifestWrites.push({
|
|
2650
2659
|
home: graphTarget,
|
|
2651
2660
|
key: GRAPH_KEY2,
|
|
2652
|
-
value: metadataOf(applied.content,
|
|
2661
|
+
value: metadataOf(applied.content, path, pageFormat).data[GRAPH_KEY2]
|
|
2653
2662
|
});
|
|
2654
2663
|
}
|
|
2655
2664
|
if (provenanceList !== void 0 && provenanceTarget !== null) {
|
|
@@ -2668,11 +2677,11 @@ async function runFill(opts = {}) {
|
|
|
2668
2677
|
}
|
|
2669
2678
|
}
|
|
2670
2679
|
}
|
|
2671
|
-
await guard?.commit(
|
|
2680
|
+
await guard?.commit(path, applied.content);
|
|
2672
2681
|
return {
|
|
2673
2682
|
after: pageContent,
|
|
2674
2683
|
merged: applied.content,
|
|
2675
|
-
path
|
|
2684
|
+
path,
|
|
2676
2685
|
status: opts.dryRun ? "proposed" : "filled",
|
|
2677
2686
|
fields: reportedFields,
|
|
2678
2687
|
preserved: applied.skipped,
|
|
@@ -2685,11 +2694,11 @@ async function runFill(opts = {}) {
|
|
|
2685
2694
|
}
|
|
2686
2695
|
}
|
|
2687
2696
|
var GRAPH_KEY2 = "graph";
|
|
2688
|
-
function writeTarget(
|
|
2697
|
+
function writeTarget(path, home, key) {
|
|
2689
2698
|
if (home === void 0 || home.kind === "unowned") return null;
|
|
2690
2699
|
if (home.kind === "url") return urlManifestMessage(key, home.file);
|
|
2691
2700
|
if (home.entry === void 0) {
|
|
2692
|
-
return `${
|
|
2701
|
+
return `${path} carries no ${home.join}, which ${home.file} joins on, so its ${key} has no entry there.`;
|
|
2693
2702
|
}
|
|
2694
2703
|
return {
|
|
2695
2704
|
file: home.file,
|
|
@@ -2730,18 +2739,18 @@ async function spliceAll(writes) {
|
|
|
2730
2739
|
}
|
|
2731
2740
|
return [...out.values()];
|
|
2732
2741
|
}
|
|
2733
|
-
async function mergedText(view,
|
|
2742
|
+
async function mergedText(view, path, content, format) {
|
|
2734
2743
|
const markdown = format === "markdown" || format === "mdx";
|
|
2735
2744
|
if (markdown && frontmatterKind(content) === "unsupported") return content;
|
|
2736
|
-
const own = metadataOf(content,
|
|
2737
|
-
const { supplied } = await mergePage(view,
|
|
2745
|
+
const own = metadataOf(content, path, format);
|
|
2746
|
+
const { supplied } = await mergePage(view, path, own.data, own.present, format);
|
|
2738
2747
|
if (Object.keys(supplied).length === 0) return content;
|
|
2739
2748
|
try {
|
|
2740
|
-
return writeGraphFields(content,
|
|
2749
|
+
return writeGraphFields(content, path, format, {}, { page: supplied }).content;
|
|
2741
2750
|
} catch (e) {
|
|
2742
2751
|
const noFence = (format === "asciidoc" || format === "rst") && e instanceof DocmetaError;
|
|
2743
2752
|
if (!noFence) throw e;
|
|
2744
|
-
return applyGraphFields(content,
|
|
2753
|
+
return applyGraphFields(content, path, {}, { page: supplied }).content;
|
|
2745
2754
|
}
|
|
2746
2755
|
}
|
|
2747
2756
|
async function openMetaViewPerPage(source, cwd, paths, base2, failures) {
|
|
@@ -2750,12 +2759,12 @@ async function openMetaViewPerPage(source, cwd, paths, base2, failures) {
|
|
|
2750
2759
|
} catch (whole) {
|
|
2751
2760
|
await openMetaView(source, cwd, [], base2);
|
|
2752
2761
|
const readable = [];
|
|
2753
|
-
for (const
|
|
2762
|
+
for (const path of paths) {
|
|
2754
2763
|
try {
|
|
2755
|
-
await openMetaView(source, cwd, [
|
|
2756
|
-
readable.push(
|
|
2764
|
+
await openMetaView(source, cwd, [path], base2);
|
|
2765
|
+
readable.push(path);
|
|
2757
2766
|
} catch (e) {
|
|
2758
|
-
failures.set(
|
|
2767
|
+
failures.set(path, e);
|
|
2759
2768
|
}
|
|
2760
2769
|
}
|
|
2761
2770
|
if (readable.length === paths.length) throw whole;
|
|
@@ -2819,226 +2828,8 @@ function renderFill(report, format) {
|
|
|
2819
2828
|
return lines.join("\n");
|
|
2820
2829
|
}
|
|
2821
2830
|
|
|
2822
|
-
// src/graph/commands/embed.ts
|
|
2823
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
2824
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
|
|
2825
|
-
import path, { dirname as dirname3, join as join3, resolve as resolve8 } from "node:path";
|
|
2826
|
-
function embedText(entry) {
|
|
2827
|
-
return [entry.title, entry.labels, entry.description, entry.text].filter((part) => part !== void 0 && part !== "").join("\n\n");
|
|
2828
|
-
}
|
|
2829
|
-
function sha2562(text) {
|
|
2830
|
-
return createHash2("sha256").update(text, "utf8").digest("hex");
|
|
2831
|
-
}
|
|
2832
|
-
var VectorCache = class {
|
|
2833
|
-
constructor(dir, enabled) {
|
|
2834
|
-
this.dir = dir;
|
|
2835
|
-
this.enabled = enabled;
|
|
2836
|
-
}
|
|
2837
|
-
dir;
|
|
2838
|
-
enabled;
|
|
2839
|
-
path(key) {
|
|
2840
|
-
return join3(this.dir, `${key}.json`);
|
|
2841
|
-
}
|
|
2842
|
-
get(key) {
|
|
2843
|
-
if (!this.enabled) return void 0;
|
|
2844
|
-
const file = this.path(key);
|
|
2845
|
-
if (!existsSync4(file)) return void 0;
|
|
2846
|
-
try {
|
|
2847
|
-
const parsed = JSON.parse(readFileSync6(file, "utf8"));
|
|
2848
|
-
return Array.isArray(parsed) ? Float32Array.from(parsed) : void 0;
|
|
2849
|
-
} catch {
|
|
2850
|
-
return void 0;
|
|
2851
|
-
}
|
|
2852
|
-
}
|
|
2853
|
-
set(key, vector) {
|
|
2854
|
-
if (!this.enabled) return;
|
|
2855
|
-
mkdirSync3(this.dir, { recursive: true });
|
|
2856
|
-
writeFileSync5(this.path(key), JSON.stringify([...vector]), "utf8");
|
|
2857
|
-
}
|
|
2858
|
-
};
|
|
2859
|
-
async function makeEmbedder(opts, model, dtype) {
|
|
2860
|
-
if (opts.embedder) return opts.embedder;
|
|
2861
|
-
if (model === "mock") return createMockEmbedder({ dtype });
|
|
2862
|
-
try {
|
|
2863
|
-
return await createLocalEmbedder({ model, dtype, role: "passage" });
|
|
2864
|
-
} catch (e) {
|
|
2865
|
-
if (e instanceof EmbedderUnavailableError) {
|
|
2866
|
-
throw new GraphError(e.message);
|
|
2867
|
-
}
|
|
2868
|
-
throw new GraphError(
|
|
2869
|
-
`Failed to load embedding model ${model}: ${errorMessage(e)}`
|
|
2870
|
-
);
|
|
2871
|
-
}
|
|
2872
|
-
}
|
|
2873
|
-
function manifestRelativePath(indexDir, outPath, pathApi = path) {
|
|
2874
|
-
const rel = pathApi.relative(indexDir, outPath);
|
|
2875
|
-
const recorded = rel.split(pathApi.sep).join("/");
|
|
2876
|
-
if (pathApi.isAbsolute(rel) || !isSafeRelativePath(recorded)) {
|
|
2877
|
-
throw new GraphError(
|
|
2878
|
-
`Cannot record vectors at ${outPath}: the localization manifest needs a path relative to ${indexDir}. Write the sidecars on the index's drive.`
|
|
2879
|
-
);
|
|
2880
|
-
}
|
|
2881
|
-
return recorded;
|
|
2882
|
-
}
|
|
2883
|
-
async function runEmbed(opts = {}) {
|
|
2884
|
-
const cwd = opts.cwd ?? process.cwd();
|
|
2885
|
-
const config = loadRunConfig(
|
|
2886
|
-
{
|
|
2887
|
-
...opts.config === void 0 ? {} : { configPath: opts.config },
|
|
2888
|
-
...opts.noConfig === void 0 ? {} : { noConfig: opts.noConfig }
|
|
2889
|
-
},
|
|
2890
|
-
cwd
|
|
2891
|
-
);
|
|
2892
|
-
const graphPath = resolve8(cwd, opts.graph ?? config.out);
|
|
2893
|
-
const indexDir = opts.index ? resolve8(cwd, opts.index) : dirname3(graphPath);
|
|
2894
|
-
const manifestPath = join3(indexDir, LOCALIZATIONS_FILENAME);
|
|
2895
|
-
if (!existsSync4(manifestPath)) {
|
|
2896
|
-
throw new GraphError(
|
|
2897
|
-
`Localization manifest not found: ${manifestPath} \u2014 run \`manni graph export search\` first.`
|
|
2898
|
-
);
|
|
2899
|
-
}
|
|
2900
|
-
const manifest = parseLocalizations(readFileSync6(manifestPath, "utf8"));
|
|
2901
|
-
if (!manifest) {
|
|
2902
|
-
throw new GraphError(
|
|
2903
|
-
`Not a manni graph localization manifest: ${manifestPath} \u2014 re-run \`manni graph export search\`.`
|
|
2904
|
-
);
|
|
2905
|
-
}
|
|
2906
|
-
const outSetting = opts.out ?? config.embed.out;
|
|
2907
|
-
const outDir = outSetting ? resolve8(cwd, outSetting) : indexDir;
|
|
2908
|
-
mkdirSync3(outDir, { recursive: true });
|
|
2909
|
-
const cache = new VectorCache(
|
|
2910
|
-
resolve8(cwd, config.embed.cacheDir),
|
|
2911
|
-
!opts.noCache
|
|
2912
|
-
);
|
|
2913
|
-
const embedders = /* @__PURE__ */ new Map();
|
|
2914
|
-
const getEmbedder = (model, dtype) => {
|
|
2915
|
-
const key = JSON.stringify([model, dtype]);
|
|
2916
|
-
const existing = embedders.get(key);
|
|
2917
|
-
if (existing) return existing;
|
|
2918
|
-
const built = makeEmbedder(opts, model, dtype);
|
|
2919
|
-
embedders.set(key, built);
|
|
2920
|
-
return built;
|
|
2921
|
-
};
|
|
2922
|
-
const languages = [];
|
|
2923
|
-
const updated = [];
|
|
2924
|
-
for (const entry of manifest.languages) {
|
|
2925
|
-
const indexPath = join3(indexDir, entry.search.path);
|
|
2926
|
-
if (!existsSync4(indexPath)) {
|
|
2927
|
-
throw new GraphError(
|
|
2928
|
-
`Search index not found: ${indexPath} \u2014 the manifest names it; re-run \`manni graph export search\`.`
|
|
2929
|
-
);
|
|
2930
|
-
}
|
|
2931
|
-
const raw = readFileSync6(indexPath, "utf8");
|
|
2932
|
-
const source = `sha256:${sha2562(raw)}`;
|
|
2933
|
-
if (entry.search.digest !== source) {
|
|
2934
|
-
throw new GraphError(
|
|
2935
|
-
`Stale manifest: ${entry.search.path} does not match the digest recorded for "${entry.language}" \u2014 re-run \`manni graph export search\`.`
|
|
2936
|
-
);
|
|
2937
|
-
}
|
|
2938
|
-
let parsed;
|
|
2939
|
-
try {
|
|
2940
|
-
parsed = JSON.parse(raw);
|
|
2941
|
-
} catch (e) {
|
|
2942
|
-
throw new GraphError(
|
|
2943
|
-
`Failed to parse ${indexPath}: ${errorMessage(e)} \u2014 re-run \`manni graph export search\`.`
|
|
2944
|
-
);
|
|
2945
|
-
}
|
|
2946
|
-
const entries = parsed?.entries;
|
|
2947
|
-
if (!Array.isArray(entries)) {
|
|
2948
|
-
throw new GraphError(
|
|
2949
|
-
`Not a manni graph search index: ${indexPath} \u2014 expected an \`entries\` array.`
|
|
2950
|
-
);
|
|
2951
|
-
}
|
|
2952
|
-
const wanted = canonicalLanguageTag(entry.language);
|
|
2953
|
-
const perLanguage = Object.entries(config.embed.byLanguage).find(
|
|
2954
|
-
([tag]) => canonicalLanguageTag(tag) === wanted
|
|
2955
|
-
)?.[1];
|
|
2956
|
-
const model = opts.model ?? perLanguage?.model ?? config.embed.model;
|
|
2957
|
-
const dtype = opts.dtype ?? perLanguage?.dtype ?? config.embed.dtype;
|
|
2958
|
-
const identity = opts.embedder ? { model: opts.embedder.model, dtype: opts.embedder.dtype } : { model, dtype };
|
|
2959
|
-
const vectors = [];
|
|
2960
|
-
let embedded = 0;
|
|
2961
|
-
let cached = 0;
|
|
2962
|
-
for (const item of entries) {
|
|
2963
|
-
const text = embedText(item);
|
|
2964
|
-
if (text === "") continue;
|
|
2965
|
-
const key = sha2562(
|
|
2966
|
-
JSON.stringify([identity.model, identity.dtype, text])
|
|
2967
|
-
);
|
|
2968
|
-
let vector = cache.get(key);
|
|
2969
|
-
if (vector) {
|
|
2970
|
-
cached += 1;
|
|
2971
|
-
} else {
|
|
2972
|
-
vector = await (await getEmbedder(model, dtype)).embed(text);
|
|
2973
|
-
cache.set(key, vector);
|
|
2974
|
-
embedded += 1;
|
|
2975
|
-
}
|
|
2976
|
-
vectors.push({ id: item.id, vector });
|
|
2977
|
-
}
|
|
2978
|
-
const filename = vectorIndexFilename(entry.language);
|
|
2979
|
-
const outPath = join3(outDir, filename);
|
|
2980
|
-
const manifestRelative = manifestRelativePath(indexDir, outPath);
|
|
2981
|
-
writeFileSync5(
|
|
2982
|
-
outPath,
|
|
2983
|
-
encodeVectorIndex(vectors, {
|
|
2984
|
-
model: identity.model,
|
|
2985
|
-
dtype: identity.dtype,
|
|
2986
|
-
source,
|
|
2987
|
-
language: entry.language
|
|
2988
|
-
})
|
|
2989
|
-
);
|
|
2990
|
-
const dims = vectors[0]?.vector.length ?? 0;
|
|
2991
|
-
languages.push({
|
|
2992
|
-
language: entry.language,
|
|
2993
|
-
outPath,
|
|
2994
|
-
model: identity.model,
|
|
2995
|
-
dims,
|
|
2996
|
-
embedded,
|
|
2997
|
-
cached,
|
|
2998
|
-
total: vectors.length
|
|
2999
|
-
});
|
|
3000
|
-
updated.push({
|
|
3001
|
-
...entry,
|
|
3002
|
-
vectors: {
|
|
3003
|
-
path: manifestRelative,
|
|
3004
|
-
model: identity.model,
|
|
3005
|
-
dtype: identity.dtype,
|
|
3006
|
-
dims,
|
|
3007
|
-
count: vectors.length
|
|
3008
|
-
}
|
|
3009
|
-
});
|
|
3010
|
-
}
|
|
3011
|
-
writeFileSync5(
|
|
3012
|
-
manifestPath,
|
|
3013
|
-
emitLocalizations({ version: 1, languages: updated }),
|
|
3014
|
-
"utf8"
|
|
3015
|
-
);
|
|
3016
|
-
return {
|
|
3017
|
-
manifestPath,
|
|
3018
|
-
languages,
|
|
3019
|
-
embedded: languages.reduce((n, l) => n + l.embedded, 0),
|
|
3020
|
-
cached: languages.reduce((n, l) => n + l.cached, 0),
|
|
3021
|
-
total: languages.reduce((n, l) => n + l.total, 0)
|
|
3022
|
-
};
|
|
3023
|
-
}
|
|
3024
|
-
function renderEmbed(report, format) {
|
|
3025
|
-
if (format === "json") return JSON.stringify(report, null, 2);
|
|
3026
|
-
const lines = report.languages.map(
|
|
3027
|
-
(l) => ` ${l.language}: ${l.total} vector${l.total === 1 ? "" : "s"} (${l.dims}-d, ${l.model}) -> ${l.outPath}`
|
|
3028
|
-
);
|
|
3029
|
-
if (lines.length === 0) lines.push(" (no languages in the manifest)");
|
|
3030
|
-
const n = report.languages.length;
|
|
3031
|
-
return [
|
|
3032
|
-
// Not "beside": `-o` may put the sidecars in a different directory from
|
|
3033
|
-
// the manifest, and each line below names the path it actually wrote.
|
|
3034
|
-
`Wrote ${n} sidecar${n === 1 ? "" : "s"}, recorded in ${report.manifestPath}`,
|
|
3035
|
-
...lines,
|
|
3036
|
-
` ${report.embedded} embedded, ${report.cached} from cache`
|
|
3037
|
-
].join("\n");
|
|
3038
|
-
}
|
|
3039
|
-
|
|
3040
2831
|
// src/graph/commands/stats.ts
|
|
3041
|
-
import { resolve as
|
|
2832
|
+
import { resolve as resolve8 } from "node:path";
|
|
3042
2833
|
import { DataFactory as DataFactory4 } from "n3";
|
|
3043
2834
|
function subjectsOfType(store, typeIri) {
|
|
3044
2835
|
return store.getQuads(null, DataFactory4.namedNode(RDF_TYPE), DataFactory4.namedNode(typeIri), null).map((q) => q.subject.value).sort();
|
|
@@ -3059,7 +2850,7 @@ function runStats(opts = {}) {
|
|
|
3059
2850
|
},
|
|
3060
2851
|
cwd
|
|
3061
2852
|
);
|
|
3062
|
-
const store = loadGraph(
|
|
2853
|
+
const store = loadGraph(resolve8(cwd, opts.graph ?? config.out));
|
|
3063
2854
|
const top = opts.top ?? 5;
|
|
3064
2855
|
const docIris = subjectsOfType(store, `${NS.graph}Document`);
|
|
3065
2856
|
const docSet = new Set(docIris);
|
|
@@ -3277,9 +3068,9 @@ function renderStats(report, format) {
|
|
|
3277
3068
|
);
|
|
3278
3069
|
lines.push("", "Localization:");
|
|
3279
3070
|
for (const { language, docs, untranslated } of report.localization.languages) {
|
|
3280
|
-
const
|
|
3071
|
+
const plural2 = docs === 1 ? "doc" : "docs";
|
|
3281
3072
|
const backlog = untranslated.length === 0 ? "" : ` ${untranslated.length} untranslated`;
|
|
3282
|
-
lines.push(` ${language.padEnd(tagWidth)} ${docs} ${
|
|
3073
|
+
lines.push(` ${language.padEnd(tagWidth)} ${docs} ${plural2}${backlog}`);
|
|
3283
3074
|
}
|
|
3284
3075
|
lines.push(` no language: ${report.localization.unlabelled}`);
|
|
3285
3076
|
}
|
|
@@ -3292,6 +3083,304 @@ function renderStats(report, format) {
|
|
|
3292
3083
|
return lines.join("\n");
|
|
3293
3084
|
}
|
|
3294
3085
|
|
|
3086
|
+
// src/vector/commands/build.ts
|
|
3087
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
3088
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "node:fs";
|
|
3089
|
+
import { dirname as dirname3, isAbsolute, join as join3, relative, resolve as resolve9 } from "node:path";
|
|
3090
|
+
|
|
3091
|
+
// src/vector/core/config.ts
|
|
3092
|
+
import { parse as parseYaml } from "yaml";
|
|
3093
|
+
import { Ajv2020 } from "ajv/dist/2020.js";
|
|
3094
|
+
|
|
3095
|
+
// src/vector/core/config-schema.json
|
|
3096
|
+
var config_schema_default = {
|
|
3097
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
3098
|
+
$id: "manni:vector:config",
|
|
3099
|
+
title: "manni vector configuration",
|
|
3100
|
+
type: "object",
|
|
3101
|
+
additionalProperties: false,
|
|
3102
|
+
properties: {
|
|
3103
|
+
model: {
|
|
3104
|
+
type: "string",
|
|
3105
|
+
minLength: 1,
|
|
3106
|
+
description: "The embedding model id. Default onnx-community/granite-embedding-small-english-r2-ONNX. mock embeds offline."
|
|
3107
|
+
},
|
|
3108
|
+
dtype: {
|
|
3109
|
+
type: "string",
|
|
3110
|
+
minLength: 1,
|
|
3111
|
+
description: "The weight quantization the model loads at. Default q8."
|
|
3112
|
+
},
|
|
3113
|
+
cacheDir: {
|
|
3114
|
+
type: "string",
|
|
3115
|
+
minLength: 1,
|
|
3116
|
+
description: "Where computed vectors are cached, relative to the working directory. Default .manni/vector/cache."
|
|
3117
|
+
},
|
|
3118
|
+
byLanguage: {
|
|
3119
|
+
type: "object",
|
|
3120
|
+
additionalProperties: false,
|
|
3121
|
+
description: "The model and quantization for one language, keyed by BCP-47 tag and matched canonically.",
|
|
3122
|
+
patternProperties: {
|
|
3123
|
+
"^[A-Za-z]{2,3}(-[A-Za-z]{4})?(-([A-Za-z]{2}|[0-9]{3}))?(-([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*$": {
|
|
3124
|
+
type: "object",
|
|
3125
|
+
additionalProperties: false,
|
|
3126
|
+
properties: {
|
|
3127
|
+
model: {
|
|
3128
|
+
type: "string",
|
|
3129
|
+
minLength: 1
|
|
3130
|
+
},
|
|
3131
|
+
dtype: {
|
|
3132
|
+
type: "string",
|
|
3133
|
+
minLength: 1
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
};
|
|
3141
|
+
|
|
3142
|
+
// src/vector/types.ts
|
|
3143
|
+
var VectorError = class extends ToolError {
|
|
3144
|
+
constructor(message) {
|
|
3145
|
+
super(message);
|
|
3146
|
+
this.name = "VectorError";
|
|
3147
|
+
}
|
|
3148
|
+
};
|
|
3149
|
+
|
|
3150
|
+
// src/vector/core/config.ts
|
|
3151
|
+
var CONFIG_SECTION = "vector";
|
|
3152
|
+
var validate = new Ajv2020({ allErrors: true }).compile(config_schema_default);
|
|
3153
|
+
var CONFIG_FILE = {
|
|
3154
|
+
section: CONFIG_SECTION,
|
|
3155
|
+
legacyNames: [],
|
|
3156
|
+
toError: (message) => new VectorError(message)
|
|
3157
|
+
};
|
|
3158
|
+
function parseVectorSection(raw, source, declared) {
|
|
3159
|
+
const value = raw ?? {};
|
|
3160
|
+
if (!validate(value)) {
|
|
3161
|
+
const details = (validate.errors ?? []).map((e) => {
|
|
3162
|
+
const where = `/${CONFIG_SECTION}${e.instancePath}`;
|
|
3163
|
+
const extra = e.keyword === "additionalProperties" ? e.params.additionalProperty : void 0;
|
|
3164
|
+
return extra === void 0 ? ` ${where}: ${e.message ?? "is invalid"}` : ` ${where}: unknown key "${extra}"`;
|
|
3165
|
+
});
|
|
3166
|
+
throw new VectorError(`Invalid config in ${source}:
|
|
3167
|
+
${details.join("\n")}`);
|
|
3168
|
+
}
|
|
3169
|
+
const r = value;
|
|
3170
|
+
return {
|
|
3171
|
+
model: r.model ?? DEFAULT_MODEL,
|
|
3172
|
+
dtype: r.dtype ?? "q8",
|
|
3173
|
+
cacheDir: r.cacheDir ?? ".manni/vector/cache",
|
|
3174
|
+
byLanguage: r.byLanguage ?? {},
|
|
3175
|
+
declared
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3178
|
+
function loadVectorConfig(opts, cwd = process.cwd()) {
|
|
3179
|
+
const file = opts.noConfig ? null : opts.configPath === void 0 ? findConfigFileSync(cwd, CONFIG_FILE) : readConfigFileSync(opts.configPath, cwd, CONFIG_FILE);
|
|
3180
|
+
if (file === null || !file.wrapped) return parseVectorSection(null, "", false);
|
|
3181
|
+
const doc = parseYaml(file.text);
|
|
3182
|
+
const declared = doc !== null && typeof doc === "object" && Object.hasOwn(doc, CONFIG_SECTION);
|
|
3183
|
+
return parseVectorSection(file.value, file.source, declared);
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
// src/vector/commands/build.ts
|
|
3187
|
+
function embedText(entry) {
|
|
3188
|
+
return [entry.title, entry.labels, entry.description, entry.text].filter((part) => part !== void 0 && part !== "").join("\n\n");
|
|
3189
|
+
}
|
|
3190
|
+
function sha2562(text) {
|
|
3191
|
+
return createHash2("sha256").update(text, "utf8").digest("hex");
|
|
3192
|
+
}
|
|
3193
|
+
var VectorCache = class {
|
|
3194
|
+
constructor(dir, enabled) {
|
|
3195
|
+
this.dir = dir;
|
|
3196
|
+
this.enabled = enabled;
|
|
3197
|
+
}
|
|
3198
|
+
dir;
|
|
3199
|
+
enabled;
|
|
3200
|
+
path(key) {
|
|
3201
|
+
return join3(this.dir, `${key}.json`);
|
|
3202
|
+
}
|
|
3203
|
+
get(key) {
|
|
3204
|
+
if (!this.enabled) return void 0;
|
|
3205
|
+
const file = this.path(key);
|
|
3206
|
+
if (!existsSync4(file)) return void 0;
|
|
3207
|
+
try {
|
|
3208
|
+
const parsed = JSON.parse(readFileSync6(file, "utf8"));
|
|
3209
|
+
if (!Array.isArray(parsed)) return void 0;
|
|
3210
|
+
return parsed.every((n) => typeof n === "number") ? Float32Array.from(parsed) : void 0;
|
|
3211
|
+
} catch {
|
|
3212
|
+
return void 0;
|
|
3213
|
+
}
|
|
3214
|
+
}
|
|
3215
|
+
set(key, vector) {
|
|
3216
|
+
if (!this.enabled) return;
|
|
3217
|
+
mkdirSync3(this.dir, { recursive: true });
|
|
3218
|
+
writeFileSync5(this.path(key), JSON.stringify([...vector]), "utf8");
|
|
3219
|
+
}
|
|
3220
|
+
};
|
|
3221
|
+
async function makeEmbedder(override, model, dtype) {
|
|
3222
|
+
if (override) return override;
|
|
3223
|
+
if (model === "mock") return createMockEmbedder({ dtype });
|
|
3224
|
+
try {
|
|
3225
|
+
return await createLocalEmbedder({ model, dtype, role: "passage" });
|
|
3226
|
+
} catch (e) {
|
|
3227
|
+
if (e instanceof EmbedderUnavailableError) throw new VectorError(e.message);
|
|
3228
|
+
throw new VectorError(`Failed to load embedding model ${model}: ${errorMessage(e)}`);
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
async function embedIndex(indexDir, settings, opts = {}) {
|
|
3232
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
3233
|
+
const manifestPath = join3(indexDir, LOCALIZATIONS_FILENAME);
|
|
3234
|
+
if (!existsSync4(manifestPath)) {
|
|
3235
|
+
throw new VectorError(`Localization manifest not found: ${manifestPath} \u2014 run \`manni vector build\` first.`);
|
|
3236
|
+
}
|
|
3237
|
+
const manifest = parseLocalizations(readFileSync6(manifestPath, "utf8"));
|
|
3238
|
+
if (!manifest) {
|
|
3239
|
+
throw new VectorError(`Not a manni graph localization manifest: ${manifestPath} \u2014 re-run \`manni vector build\`.`);
|
|
3240
|
+
}
|
|
3241
|
+
const cache = new VectorCache(resolve9(cwd, settings.cacheDir), opts.noCache !== true);
|
|
3242
|
+
const embedders = /* @__PURE__ */ new Map();
|
|
3243
|
+
const getEmbedder = (model, dtype) => {
|
|
3244
|
+
const key = JSON.stringify([model, dtype]);
|
|
3245
|
+
const existing = embedders.get(key);
|
|
3246
|
+
if (existing) return existing;
|
|
3247
|
+
const built = makeEmbedder(opts.embedder, model, dtype);
|
|
3248
|
+
embedders.set(key, built);
|
|
3249
|
+
return built;
|
|
3250
|
+
};
|
|
3251
|
+
const languages = [];
|
|
3252
|
+
const updated = [];
|
|
3253
|
+
for (const entry of manifest.languages) {
|
|
3254
|
+
const indexPath = join3(indexDir, entry.search.path);
|
|
3255
|
+
if (!existsSync4(indexPath)) {
|
|
3256
|
+
throw new VectorError(`Search index not found: ${indexPath} \u2014 the manifest names it; re-run \`manni vector build\`.`);
|
|
3257
|
+
}
|
|
3258
|
+
const raw = readFileSync6(indexPath, "utf8");
|
|
3259
|
+
const source = `sha256:${sha2562(raw)}`;
|
|
3260
|
+
if (entry.search.digest !== source) {
|
|
3261
|
+
throw new VectorError(
|
|
3262
|
+
`Stale manifest: ${entry.search.path} does not match the digest recorded for "${entry.language}" \u2014 re-run \`manni vector build\`.`
|
|
3263
|
+
);
|
|
3264
|
+
}
|
|
3265
|
+
let parsed;
|
|
3266
|
+
try {
|
|
3267
|
+
parsed = JSON.parse(raw);
|
|
3268
|
+
} catch (e) {
|
|
3269
|
+
throw new VectorError(`Failed to parse ${indexPath}: ${errorMessage(e)} \u2014 re-run \`manni vector build\`.`);
|
|
3270
|
+
}
|
|
3271
|
+
const entries = parsed?.entries;
|
|
3272
|
+
if (!Array.isArray(entries)) {
|
|
3273
|
+
throw new VectorError(`Not a manni graph search index: ${indexPath} \u2014 expected an \`entries\` array.`);
|
|
3274
|
+
}
|
|
3275
|
+
const wanted = canonicalLanguageTag(entry.language);
|
|
3276
|
+
const perLanguage = Object.entries(settings.byLanguage).find(
|
|
3277
|
+
([tag]) => canonicalLanguageTag(tag) === wanted
|
|
3278
|
+
)?.[1];
|
|
3279
|
+
const model = opts.model ?? perLanguage?.model ?? settings.model;
|
|
3280
|
+
const dtype = opts.dtype ?? perLanguage?.dtype ?? settings.dtype;
|
|
3281
|
+
const identity = opts.embedder ? { model: opts.embedder.model, dtype: opts.embedder.dtype } : { model, dtype };
|
|
3282
|
+
const vectors = [];
|
|
3283
|
+
let embedded = 0;
|
|
3284
|
+
let cached = 0;
|
|
3285
|
+
for (const item of entries) {
|
|
3286
|
+
const text = embedText(item);
|
|
3287
|
+
if (text === "") continue;
|
|
3288
|
+
const key = sha2562(JSON.stringify([identity.model, identity.dtype, text]));
|
|
3289
|
+
let vector = cache.get(key);
|
|
3290
|
+
if (vector) {
|
|
3291
|
+
cached += 1;
|
|
3292
|
+
} else {
|
|
3293
|
+
vector = await (await getEmbedder(model, dtype)).embed(text);
|
|
3294
|
+
cache.set(key, vector);
|
|
3295
|
+
embedded += 1;
|
|
3296
|
+
}
|
|
3297
|
+
vectors.push({ id: item.id, vector });
|
|
3298
|
+
}
|
|
3299
|
+
const filename = vectorIndexFilename(entry.language);
|
|
3300
|
+
const outPath = join3(indexDir, filename);
|
|
3301
|
+
writeFileSync5(
|
|
3302
|
+
outPath,
|
|
3303
|
+
encodeVectorIndex(vectors, { model: identity.model, dtype: identity.dtype, source, language: entry.language })
|
|
3304
|
+
);
|
|
3305
|
+
const dims = vectors[0]?.vector.length ?? 0;
|
|
3306
|
+
languages.push({
|
|
3307
|
+
language: entry.language,
|
|
3308
|
+
searchPath: indexPath,
|
|
3309
|
+
entries: entry.search.entries,
|
|
3310
|
+
outPath,
|
|
3311
|
+
model: identity.model,
|
|
3312
|
+
dims,
|
|
3313
|
+
embedded,
|
|
3314
|
+
cached,
|
|
3315
|
+
total: vectors.length
|
|
3316
|
+
});
|
|
3317
|
+
updated.push({
|
|
3318
|
+
...entry,
|
|
3319
|
+
vectors: { path: filename, model: identity.model, dtype: identity.dtype, dims, count: vectors.length }
|
|
3320
|
+
});
|
|
3321
|
+
}
|
|
3322
|
+
writeFileSync5(manifestPath, emitLocalizations({ version: 1, languages: updated }), "utf8");
|
|
3323
|
+
return { manifestPath, languages };
|
|
3324
|
+
}
|
|
3325
|
+
async function runBuild(opts = {}) {
|
|
3326
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
3327
|
+
const { out, model, dtype, noCache, embedder, ...graphOptions } = opts;
|
|
3328
|
+
const source = {
|
|
3329
|
+
...opts.config === void 0 ? {} : { configPath: opts.config },
|
|
3330
|
+
...opts.noConfig === void 0 ? {} : { noConfig: opts.noConfig }
|
|
3331
|
+
};
|
|
3332
|
+
const settings = loadVectorConfig(source, cwd);
|
|
3333
|
+
const built = await buildGraph({ ...graphOptions, cwd });
|
|
3334
|
+
const { config } = built;
|
|
3335
|
+
const base2 = documentBase(config, opts, cwd);
|
|
3336
|
+
const outDir = out === void 0 ? dirname3(built.outPath) : resolve9(cwd, out);
|
|
3337
|
+
const index = await writeSearchIndex(parseGraph(built.turtle, "the built graph"), base2, outDir, {
|
|
3338
|
+
context: parseContexts(config, base2),
|
|
3339
|
+
readDoc: (path) => {
|
|
3340
|
+
if (path === STDIN_PATH) return opts.stdinContent;
|
|
3341
|
+
const abs = resolve9(base2, path);
|
|
3342
|
+
return existsSync4(abs) ? readFileSync6(abs, "utf8") : void 0;
|
|
3343
|
+
}
|
|
3344
|
+
});
|
|
3345
|
+
const embedded = await embedIndex(outDir, settings, {
|
|
3346
|
+
...model === void 0 ? {} : { model },
|
|
3347
|
+
...dtype === void 0 ? {} : { dtype },
|
|
3348
|
+
...noCache === void 0 ? {} : { noCache },
|
|
3349
|
+
...embedder === void 0 ? {} : { embedder },
|
|
3350
|
+
cwd
|
|
3351
|
+
});
|
|
3352
|
+
const shown = (path) => {
|
|
3353
|
+
const rel = relative(cwd, path);
|
|
3354
|
+
return rel.startsWith("..") || isAbsolute(rel) ? path : rel.split("\\").join("/");
|
|
3355
|
+
};
|
|
3356
|
+
const languages = embedded.languages.map((l) => ({ ...l, searchPath: shown(l.searchPath), outPath: shown(l.outPath) }));
|
|
3357
|
+
return {
|
|
3358
|
+
manifestPath: shown(embedded.manifestPath),
|
|
3359
|
+
documents: built.docs,
|
|
3360
|
+
// What the indexes hold: concepts are filed in every language (ADR 01038).
|
|
3361
|
+
entries: languages.reduce((n, l) => n + l.entries, 0),
|
|
3362
|
+
languages,
|
|
3363
|
+
embedded: languages.reduce((n, l) => n + l.embedded, 0),
|
|
3364
|
+
cached: languages.reduce((n, l) => n + l.cached, 0),
|
|
3365
|
+
total: languages.reduce((n, l) => n + l.total, 0),
|
|
3366
|
+
warnings: [...built.warnings, ...index.warnings]
|
|
3367
|
+
};
|
|
3368
|
+
}
|
|
3369
|
+
var plural = (n, one, many = `${one}s`) => `${String(n)} ${n === 1 ? one : many}`;
|
|
3370
|
+
function renderBuild(report, format) {
|
|
3371
|
+
const { warnings: _warnings, ...printed } = report;
|
|
3372
|
+
if (format === "json") return JSON.stringify(printed, null, 2);
|
|
3373
|
+
const lines = report.languages.map(
|
|
3374
|
+
(l) => ` ${l.language}: ${plural(l.total, "vector")} (${String(l.dims)}-d, ${l.model}) -> ${l.outPath}`
|
|
3375
|
+
);
|
|
3376
|
+
return [
|
|
3377
|
+
`Indexed ${plural(report.documents, "page")}: ${plural(report.entries, "entry", "entries")} in ${plural(report.languages.length, "language")}`,
|
|
3378
|
+
`Wrote ${plural(report.languages.length, "sidecar")}, recorded in ${report.manifestPath}`,
|
|
3379
|
+
...lines,
|
|
3380
|
+
` ${String(report.embedded)} embedded, ${String(report.cached)} from cache`
|
|
3381
|
+
].join("\n");
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3295
3384
|
export {
|
|
3296
3385
|
emitRdfXml,
|
|
3297
3386
|
writeZip,
|
|
@@ -3313,10 +3402,12 @@ export {
|
|
|
3313
3402
|
makeProvider,
|
|
3314
3403
|
runFill,
|
|
3315
3404
|
renderFill,
|
|
3316
|
-
embedText,
|
|
3317
|
-
runEmbed,
|
|
3318
|
-
renderEmbed,
|
|
3319
3405
|
runStats,
|
|
3320
|
-
renderStats
|
|
3406
|
+
renderStats,
|
|
3407
|
+
loadVectorConfig,
|
|
3408
|
+
embedText,
|
|
3409
|
+
embedIndex,
|
|
3410
|
+
runBuild,
|
|
3411
|
+
renderBuild
|
|
3321
3412
|
};
|
|
3322
|
-
//# sourceMappingURL=chunk-
|
|
3413
|
+
//# sourceMappingURL=chunk-MBPDZWYI.js.map
|