@hawkeyexl/manni 4.20.1 → 4.22.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-J626LZ22.js → batch-C3NN2YXB.js} +20 -21
- package/dist/build-CEVEAHN7.js +36 -0
- package/dist/calibrate-CSKPY5AK.js +42 -0
- package/dist/capture-3HDBIHH6.js +37 -0
- package/dist/check-555TCJGF.js +45 -0
- package/dist/check-KGJBV42O.js +30 -0
- package/dist/{check-RCSQARQE.js → check-KXWHSCCR.js} +13 -16
- package/dist/check-MZSXCS2M.js +33 -0
- package/dist/{check-PQ7S5I3I.js → check-QNHLTYPN.js} +23 -23
- package/dist/{chunk-YIHIRMXN.js → chunk-2VLZDU4E.js} +5 -5
- package/dist/{chunk-D54BQM5P.js → chunk-37Q7WEJJ.js} +9 -9
- package/dist/{chunk-QSPH4F56.js → chunk-3ZVRGBK6.js} +5 -5
- package/dist/chunk-3ZVRGBK6.js.map +1 -0
- package/dist/{chunk-P5DWBG6T.js → chunk-46MMIJWR.js} +3 -3
- package/dist/{chunk-P6XZ44C2.js → chunk-4LYVTR2T.js} +4 -4
- package/dist/{chunk-ODSIHEIW.js → chunk-562QZKAB.js} +6599 -3508
- package/dist/chunk-562QZKAB.js.map +1 -0
- package/dist/{chunk-ACJUZFRT.js → chunk-57LZPG4V.js} +29 -4
- package/dist/chunk-57LZPG4V.js.map +1 -0
- package/dist/chunk-5LQX57BW.js +100 -0
- package/dist/chunk-5LQX57BW.js.map +1 -0
- package/dist/{chunk-MPXMQGJI.js → chunk-63EQKVNT.js} +45 -910
- package/dist/chunk-63EQKVNT.js.map +1 -0
- package/dist/{chunk-6FY573GB.js → chunk-64DULZIG.js} +4 -4
- package/dist/{chunk-TAJYMXMM.js → chunk-6SVHI2U6.js} +2 -2
- package/dist/{chunk-OVUQNM7Y.js → chunk-6UHEMPEY.js} +3 -157
- package/dist/chunk-6UHEMPEY.js.map +1 -0
- package/dist/{chunk-A633WB3N.js → chunk-A5YUK3SG.js} +37 -26
- package/dist/chunk-A5YUK3SG.js.map +1 -0
- package/dist/{chunk-C5BXSQDO.js → chunk-A67EJ3J6.js} +6 -6
- package/dist/{chunk-2GTR24SA.js → chunk-BLDL23RY.js} +8 -8
- package/dist/{chunk-JPXC62SD.js → chunk-BY3635RR.js} +82 -16
- package/dist/chunk-BY3635RR.js.map +1 -0
- package/dist/{chunk-CFMI74TP.js → chunk-BZ74YUYE.js} +2 -2
- package/dist/{chunk-NDPQ2GQ4.js → chunk-CHTSA3YR.js} +6 -6
- package/dist/{chunk-5CJ3P5O3.js → chunk-CPYQ4BJK.js} +19 -100
- package/dist/chunk-CPYQ4BJK.js.map +1 -0
- package/dist/{chunk-Z2T5U7HN.js → chunk-CQTESLC5.js} +2 -2
- package/dist/{chunk-245W2Q7C.js → chunk-D4BGNAN5.js} +2 -2
- package/dist/{chunk-XPO655IX.js → chunk-E3HYSNS6.js} +4 -4
- package/dist/{chunk-LPJ3IB26.js → chunk-EL2KNRC3.js} +17 -3
- package/dist/chunk-EL2KNRC3.js.map +1 -0
- package/dist/{chunk-ISDFYXLA.js → chunk-FTSNG6DZ.js} +48 -28
- package/dist/chunk-FTSNG6DZ.js.map +1 -0
- package/dist/{chunk-MJZK7G4B.js → chunk-FXE5K56B.js} +3 -3
- package/dist/{chunk-YM2W43DI.js → chunk-HYEKQ22B.js} +13 -9
- package/dist/chunk-HYEKQ22B.js.map +1 -0
- package/dist/{chunk-QGBNWEWS.js → chunk-IC3FJWIF.js} +2 -2
- package/dist/{chunk-OQR3VVAX.js → chunk-IDDRHB7E.js} +3 -3
- package/dist/chunk-INOVEO32.js +28 -0
- package/dist/chunk-INOVEO32.js.map +1 -0
- package/dist/chunk-IXFFVI5S.js +409 -0
- package/dist/chunk-IXFFVI5S.js.map +1 -0
- package/dist/{chunk-OXCWCEVV.js → chunk-JA7DWOVV.js} +5 -5
- package/dist/{chunk-B2242FYO.js → chunk-JF4BC7ZD.js} +38 -3
- package/dist/chunk-JF4BC7ZD.js.map +1 -0
- package/dist/{chunk-RN7IA742.js → chunk-JL5FHNQK.js} +9 -11
- package/dist/{chunk-RN7IA742.js.map → chunk-JL5FHNQK.js.map} +1 -1
- package/dist/{chunk-HGUCJ3K3.js → chunk-JVE5YQN4.js} +4 -4
- package/dist/chunk-K5LBIAOM.js +700 -0
- package/dist/chunk-K5LBIAOM.js.map +1 -0
- package/dist/{chunk-5E3ABFOQ.js → chunk-KIUFBUUZ.js} +13 -11
- package/dist/{chunk-5E3ABFOQ.js.map → chunk-KIUFBUUZ.js.map} +1 -1
- package/dist/{chunk-SUTY4VCZ.js → chunk-LCMBG4LY.js} +3635 -3409
- package/dist/chunk-LCMBG4LY.js.map +1 -0
- package/dist/{chunk-H3C3UXTA.js → chunk-LMS2RWDS.js} +15 -13
- package/dist/{chunk-H3C3UXTA.js.map → chunk-LMS2RWDS.js.map} +1 -1
- package/dist/{chunk-RA2BER5P.js → chunk-MR5JWMC2.js} +2 -2
- package/dist/{chunk-JCTHXG33.js → chunk-NHOGTAPK.js} +2 -2
- package/dist/{chunk-VM7VAFJW.js → chunk-NVYDWVXN.js} +2 -1
- package/dist/{chunk-N2VB6UUE.js → chunk-O6IDYZVW.js} +7 -5
- package/dist/{chunk-N2VB6UUE.js.map → chunk-O6IDYZVW.js.map} +1 -1
- package/dist/{chunk-MTMR65NM.js → chunk-OHMLEITS.js} +2 -2
- package/dist/{chunk-NUQF5F5J.js → chunk-PNDEKFF3.js} +2 -2
- package/dist/{chunk-S2HW3CBF.js → chunk-PX7OTUNU.js} +6 -6
- package/dist/{chunk-4F5WGZRP.js → chunk-Q7FFJMFO.js} +19 -15
- package/dist/chunk-Q7FFJMFO.js.map +1 -0
- package/dist/{chunk-D4XQX4W7.js → chunk-QJJPTS6L.js} +5 -3
- package/dist/{chunk-D4XQX4W7.js.map → chunk-QJJPTS6L.js.map} +1 -1
- package/dist/chunk-RAN3CF33.js +1875 -0
- package/dist/chunk-RAN3CF33.js.map +1 -0
- package/dist/{chunk-YYWZ2MSL.js → chunk-S7V4F7HC.js} +16 -11
- package/dist/chunk-S7V4F7HC.js.map +1 -0
- package/dist/{chunk-CXL6ES7O.js → chunk-SCKVDD4E.js} +4 -4
- package/dist/{chunk-ZB3OFSRB.js → chunk-TJYJ4BNK.js} +4 -4
- package/dist/{chunk-MJZ5HYYL.js → chunk-TR5TNPWT.js} +2 -2
- package/dist/{chunk-MJZ5HYYL.js.map → chunk-TR5TNPWT.js.map} +1 -1
- package/dist/chunk-TT5UDTDM.js +888 -0
- package/dist/chunk-TT5UDTDM.js.map +1 -0
- package/dist/{chunk-N3DYE6LJ.js → chunk-TWYJ2TVS.js} +7 -7
- package/dist/{chunk-BM43RJIS.js → chunk-UQI463L3.js} +9 -9
- package/dist/{chunk-FIR2MAGS.js → chunk-V27DOGAO.js} +2 -2
- package/dist/{chunk-O4O6JOGD.js → chunk-VSDXZAQU.js} +14 -20
- package/dist/chunk-VSDXZAQU.js.map +1 -0
- package/dist/{chunk-4DFBBU4A.js → chunk-VSHMXMBZ.js} +2 -2
- package/dist/{chunk-ROZDHPKA.js → chunk-VZSATUI7.js} +4 -4
- package/dist/{chunk-EOJEPEYY.js → chunk-W5OZMYMX.js} +2 -2
- package/dist/{chunk-KERICP5Y.js → chunk-WW4JATBJ.js} +6 -6
- package/dist/{chunk-SSQZB5SQ.js → chunk-XG6PVB5S.js} +11 -1
- package/dist/chunk-XG6PVB5S.js.map +1 -0
- package/dist/{chunk-TDG2S5UE.js → chunk-XQKRD5A3.js} +4 -4
- package/dist/{chunk-GGTCSMNX.js → chunk-XSP3TUFN.js} +5 -5
- package/dist/{chunk-UVC3BUKU.js → chunk-XTMONCQE.js} +6 -405
- package/dist/chunk-XTMONCQE.js.map +1 -0
- package/dist/{chunk-WRWW6SGG.js → chunk-YB3KD5RI.js} +3 -3
- package/dist/chunk-ZAOJYN2D.js +159 -0
- package/dist/chunk-ZAOJYN2D.js.map +1 -0
- package/dist/{chunk-FKELQCGN.js → chunk-ZKIXGFID.js} +2 -2
- package/dist/{chunk-BY4THWAQ.js → chunk-ZT3ERG4B.js} +3 -3
- package/dist/chunk-ZTRC37NH.js +38 -0
- package/dist/chunk-ZTRC37NH.js.map +1 -0
- package/dist/{chunk-LXJ4FZ7Y.js → chunk-ZW4YASUB.js} +4 -4
- package/dist/{chunk-E6JYRVR5.js → chunk-ZX4TOTZS.js} +27 -8
- package/dist/chunk-ZX4TOTZS.js.map +1 -0
- package/dist/{cli-4RTNEVVX.js → cli-4QAH3DBX.js} +9 -11
- package/dist/{cli-IIFCE6GY.js → cli-6476FRBK.js} +16 -19
- package/dist/{cli-IIFCE6GY.js.map → cli-6476FRBK.js.map} +1 -1
- package/dist/{cli-DQRFSU7U.js → cli-7XT7O5YM.js} +16 -18
- package/dist/{cli-DQRFSU7U.js.map → cli-7XT7O5YM.js.map} +1 -1
- package/dist/{cli-PCZ7XNCO.js → cli-FGCHGJYZ.js} +70 -53
- package/dist/cli-FGCHGJYZ.js.map +1 -0
- package/dist/{cli-6J4P5MLU.js → cli-JE4LG35H.js} +4 -4
- package/dist/{cli-K5635N25.js → cli-U3622DIB.js} +14 -17
- package/dist/{cli-K5635N25.js.map → cli-U3622DIB.js.map} +1 -1
- package/dist/{cli-K5QWXB7H.js → cli-ULHJTJHH.js} +74 -41
- package/dist/cli-ULHJTJHH.js.map +1 -0
- package/dist/{cli-ISKXSN3P.js → cli-W7B2PNZO.js} +18 -21
- package/dist/{cli-ISKXSN3P.js.map → cli-W7B2PNZO.js.map} +1 -1
- package/dist/{cli-FTSJQSB4.js → cli-YGMXZ46V.js} +17 -20
- package/dist/{cli-FTSJQSB4.js.map → cli-YGMXZ46V.js.map} +1 -1
- package/dist/{cli-TCHSYJLB.js → cli-YINQL2NI.js} +28 -29
- package/dist/{cli-TCHSYJLB.js.map → cli-YINQL2NI.js.map} +1 -1
- package/dist/cli-Z3ART5DN.js +152 -0
- package/dist/cli-Z3ART5DN.js.map +1 -0
- package/dist/cli.js +15 -15
- package/dist/cli.js.map +1 -1
- package/dist/{config-7I5CHHRZ.js → config-2YJPJ36T.js} +5 -5
- package/dist/docmeta.js +8 -10
- package/dist/docmeta.js.map +1 -1
- package/dist/github-64ZVAUIT.js +28 -0
- package/dist/github-ARGPMQD2.js +32 -0
- package/dist/github-YHJABBUI.js +33 -0
- package/dist/graph/runtime.js.map +1 -1
- package/dist/{host-YSTYO5DX.js → host-JT27OWTC.js} +3 -3
- package/dist/index.d.ts +334 -24
- package/dist/index.js +218 -203
- package/dist/index.js.map +1 -1
- package/dist/{json-7Z2IFGB3.js → json-CVOVXB7O.js} +12 -15
- package/dist/json-QNGJFUY2.js +40 -0
- package/dist/{labels-SE2WL7WD.js → labels-5WOKC3VR.js} +11 -14
- package/dist/{labels-SE2WL7WD.js.map → labels-5WOKC3VR.js.map} +1 -1
- package/dist/lint-OQGB4DWJ.js +32 -0
- package/dist/list-EDAB7X5Y.js +30 -0
- package/dist/list-OQ3IYV2W.js +37 -0
- package/dist/list-PN6JKYNX.js +33 -0
- package/dist/{page-A2Y4ZMV4.js → page-TPNMHL27.js} +11 -14
- package/dist/{prepare-M2COBP5O.js → prepare-3V2QYBKL.js} +20 -22
- package/dist/{prepare-M2COBP5O.js.map → prepare-3V2QYBKL.js.map} +1 -1
- package/dist/{pretty-SFFOMSG5.js → pretty-EZ2NFU3C.js} +13 -16
- package/dist/pretty-HO2LYG5N.js +41 -0
- package/dist/{pretty-D3DZFC5U.js → pretty-K3M4AW2D.js} +12 -15
- package/dist/{provider-JY2I3VLF.js → provider-YWNTTQPA.js} +3 -3
- package/dist/{release-VHHASAG7.js → release-EFLQT3FW.js} +3 -3
- package/dist/{reporters-TO7Q6JYF.js → reporters-4R2E7PRJ.js} +6 -6
- package/dist/{reporters-UTLJVSWX.js → reporters-YVLLFBO5.js} +11 -14
- package/dist/run-H4BOR2FR.js +36 -0
- package/dist/{sarif-IAGMXA6C.js → sarif-GWHWJJFP.js} +10 -13
- package/dist/sarif-SJFVSOBV.js +33 -0
- package/dist/sarif-YBFD5OUL.js +28 -0
- package/dist/{strategy-UKRA6WO4.js → strategy-T56PH2VK.js} +29 -46
- package/dist/strategy-T56PH2VK.js.map +1 -0
- package/dist/{term-AMORBEO7.js → term-33YSMISR.js} +18 -22
- package/dist/{term-AMORBEO7.js.map → term-33YSMISR.js.map} +1 -1
- package/dist/{validate-CDTKFZUV.js → validate-6R5UBDGU.js} +6 -7
- package/package.json +1 -1
- package/plugin/manni/.claude-plugin/plugin.json +11 -3
- package/plugin/manni/hooks/graph-server.mjs +3 -3
- package/plugin/manni/hooks/hooks.json +4 -4
- package/plugin/manni/hooks/manni.mjs +18 -5
- package/plugin/manni/hooks/page-metadata.mjs +81 -7
- package/plugin/manni/hooks/tracevals.mjs +7 -0
- package/plugin/manni/skills/fix/SKILL.md +8 -4
- package/shapes/graph/shapes-1.3.0.ttl +1250 -0
- package/dist/build-AYLD6V6Y.js +0 -38
- package/dist/calibrate-2HZFACIX.js +0 -43
- package/dist/capture-NMDIPC6S.js +0 -39
- package/dist/check-KNQV7GLU.js +0 -33
- package/dist/check-OH4KKXP3.js +0 -33
- package/dist/check-PRAMKQCI.js +0 -47
- package/dist/chunk-4F5WGZRP.js.map +0 -1
- package/dist/chunk-4H3IOF52.js +0 -3200
- package/dist/chunk-4H3IOF52.js.map +0 -1
- package/dist/chunk-5CJ3P5O3.js.map +0 -1
- package/dist/chunk-A633WB3N.js.map +0 -1
- package/dist/chunk-ACJUZFRT.js.map +0 -1
- package/dist/chunk-B2242FYO.js.map +0 -1
- package/dist/chunk-CT5WSUUZ.js +0 -441
- package/dist/chunk-CT5WSUUZ.js.map +0 -1
- package/dist/chunk-DNF42MK7.js +0 -326
- package/dist/chunk-DNF42MK7.js.map +0 -1
- package/dist/chunk-E6JYRVR5.js.map +0 -1
- package/dist/chunk-ISDFYXLA.js.map +0 -1
- package/dist/chunk-JPXC62SD.js.map +0 -1
- package/dist/chunk-LPJ3IB26.js.map +0 -1
- package/dist/chunk-MPXMQGJI.js.map +0 -1
- package/dist/chunk-O4O6JOGD.js.map +0 -1
- package/dist/chunk-ODSIHEIW.js.map +0 -1
- package/dist/chunk-OVUQNM7Y.js.map +0 -1
- package/dist/chunk-QSPH4F56.js.map +0 -1
- package/dist/chunk-SIREOHLW.js +0 -233
- package/dist/chunk-SIREOHLW.js.map +0 -1
- package/dist/chunk-SSQZB5SQ.js.map +0 -1
- package/dist/chunk-SUTY4VCZ.js.map +0 -1
- package/dist/chunk-UP6NBQ62.js +0 -2
- package/dist/chunk-UVC3BUKU.js.map +0 -1
- package/dist/chunk-WI3PPQQX.js +0 -164
- package/dist/chunk-WI3PPQQX.js.map +0 -1
- package/dist/chunk-YM2W43DI.js.map +0 -1
- package/dist/chunk-YYWZ2MSL.js.map +0 -1
- package/dist/chunk-ZPLVANY2.js +0 -15
- package/dist/chunk-ZPLVANY2.js.map +0 -1
- package/dist/cli-K5QWXB7H.js.map +0 -1
- package/dist/cli-PCZ7XNCO.js.map +0 -1
- package/dist/cli-TM2JCTQT.js +0 -84
- package/dist/cli-TM2JCTQT.js.map +0 -1
- package/dist/github-BUK5CVQW.js +0 -27
- package/dist/github-CMAZWS76.js +0 -31
- package/dist/github-NXR4QMMM.js +0 -35
- package/dist/json-NZSGRYOE.js +0 -34
- package/dist/lint-VUYM5PPM.js +0 -35
- package/dist/list-4JGOXLOZ.js +0 -33
- package/dist/list-LTF25DQE.js +0 -33
- package/dist/list-WD3TZS5R.js +0 -36
- package/dist/pretty-R67YU6TU.js +0 -35
- package/dist/run-BDGYRUXJ.js +0 -39
- package/dist/sarif-EHAMGCVR.js +0 -36
- package/dist/sarif-GJYLRXLS.js +0 -30
- package/dist/strategy-UKRA6WO4.js.map +0 -1
- package/dist/validate-CDTKFZUV.js.map +0 -1
- /package/dist/{batch-J626LZ22.js.map → batch-C3NN2YXB.js.map} +0 -0
- /package/dist/{build-AYLD6V6Y.js.map → build-CEVEAHN7.js.map} +0 -0
- /package/dist/{calibrate-2HZFACIX.js.map → calibrate-CSKPY5AK.js.map} +0 -0
- /package/dist/{capture-NMDIPC6S.js.map → capture-3HDBIHH6.js.map} +0 -0
- /package/dist/{check-KNQV7GLU.js.map → check-555TCJGF.js.map} +0 -0
- /package/dist/{check-OH4KKXP3.js.map → check-KGJBV42O.js.map} +0 -0
- /package/dist/{check-PRAMKQCI.js.map → check-KXWHSCCR.js.map} +0 -0
- /package/dist/{check-RCSQARQE.js.map → check-MZSXCS2M.js.map} +0 -0
- /package/dist/{check-PQ7S5I3I.js.map → check-QNHLTYPN.js.map} +0 -0
- /package/dist/{chunk-YIHIRMXN.js.map → chunk-2VLZDU4E.js.map} +0 -0
- /package/dist/{chunk-D54BQM5P.js.map → chunk-37Q7WEJJ.js.map} +0 -0
- /package/dist/{chunk-P5DWBG6T.js.map → chunk-46MMIJWR.js.map} +0 -0
- /package/dist/{chunk-P6XZ44C2.js.map → chunk-4LYVTR2T.js.map} +0 -0
- /package/dist/{chunk-6FY573GB.js.map → chunk-64DULZIG.js.map} +0 -0
- /package/dist/{chunk-TAJYMXMM.js.map → chunk-6SVHI2U6.js.map} +0 -0
- /package/dist/{chunk-C5BXSQDO.js.map → chunk-A67EJ3J6.js.map} +0 -0
- /package/dist/{chunk-2GTR24SA.js.map → chunk-BLDL23RY.js.map} +0 -0
- /package/dist/{chunk-CFMI74TP.js.map → chunk-BZ74YUYE.js.map} +0 -0
- /package/dist/{chunk-NDPQ2GQ4.js.map → chunk-CHTSA3YR.js.map} +0 -0
- /package/dist/{chunk-Z2T5U7HN.js.map → chunk-CQTESLC5.js.map} +0 -0
- /package/dist/{chunk-245W2Q7C.js.map → chunk-D4BGNAN5.js.map} +0 -0
- /package/dist/{chunk-XPO655IX.js.map → chunk-E3HYSNS6.js.map} +0 -0
- /package/dist/{chunk-MJZK7G4B.js.map → chunk-FXE5K56B.js.map} +0 -0
- /package/dist/{chunk-QGBNWEWS.js.map → chunk-IC3FJWIF.js.map} +0 -0
- /package/dist/{chunk-OQR3VVAX.js.map → chunk-IDDRHB7E.js.map} +0 -0
- /package/dist/{chunk-OXCWCEVV.js.map → chunk-JA7DWOVV.js.map} +0 -0
- /package/dist/{chunk-HGUCJ3K3.js.map → chunk-JVE5YQN4.js.map} +0 -0
- /package/dist/{chunk-RA2BER5P.js.map → chunk-MR5JWMC2.js.map} +0 -0
- /package/dist/{chunk-JCTHXG33.js.map → chunk-NHOGTAPK.js.map} +0 -0
- /package/dist/{chunk-VM7VAFJW.js.map → chunk-NVYDWVXN.js.map} +0 -0
- /package/dist/{chunk-MTMR65NM.js.map → chunk-OHMLEITS.js.map} +0 -0
- /package/dist/{chunk-NUQF5F5J.js.map → chunk-PNDEKFF3.js.map} +0 -0
- /package/dist/{chunk-S2HW3CBF.js.map → chunk-PX7OTUNU.js.map} +0 -0
- /package/dist/{chunk-CXL6ES7O.js.map → chunk-SCKVDD4E.js.map} +0 -0
- /package/dist/{chunk-ZB3OFSRB.js.map → chunk-TJYJ4BNK.js.map} +0 -0
- /package/dist/{chunk-N3DYE6LJ.js.map → chunk-TWYJ2TVS.js.map} +0 -0
- /package/dist/{chunk-BM43RJIS.js.map → chunk-UQI463L3.js.map} +0 -0
- /package/dist/{chunk-FIR2MAGS.js.map → chunk-V27DOGAO.js.map} +0 -0
- /package/dist/{chunk-4DFBBU4A.js.map → chunk-VSHMXMBZ.js.map} +0 -0
- /package/dist/{chunk-ROZDHPKA.js.map → chunk-VZSATUI7.js.map} +0 -0
- /package/dist/{chunk-EOJEPEYY.js.map → chunk-W5OZMYMX.js.map} +0 -0
- /package/dist/{chunk-KERICP5Y.js.map → chunk-WW4JATBJ.js.map} +0 -0
- /package/dist/{chunk-TDG2S5UE.js.map → chunk-XQKRD5A3.js.map} +0 -0
- /package/dist/{chunk-GGTCSMNX.js.map → chunk-XSP3TUFN.js.map} +0 -0
- /package/dist/{chunk-WRWW6SGG.js.map → chunk-YB3KD5RI.js.map} +0 -0
- /package/dist/{chunk-FKELQCGN.js.map → chunk-ZKIXGFID.js.map} +0 -0
- /package/dist/{chunk-BY4THWAQ.js.map → chunk-ZT3ERG4B.js.map} +0 -0
- /package/dist/{chunk-LXJ4FZ7Y.js.map → chunk-ZW4YASUB.js.map} +0 -0
- /package/dist/{chunk-UP6NBQ62.js.map → cli-4QAH3DBX.js.map} +0 -0
- /package/dist/{cli-6J4P5MLU.js.map → cli-JE4LG35H.js.map} +0 -0
- /package/dist/{cli-4RTNEVVX.js.map → config-2YJPJ36T.js.map} +0 -0
- /package/dist/{config-7I5CHHRZ.js.map → github-64ZVAUIT.js.map} +0 -0
- /package/dist/{github-BUK5CVQW.js.map → github-ARGPMQD2.js.map} +0 -0
- /package/dist/{github-CMAZWS76.js.map → github-YHJABBUI.js.map} +0 -0
- /package/dist/{github-NXR4QMMM.js.map → host-JT27OWTC.js.map} +0 -0
- /package/dist/{host-YSTYO5DX.js.map → json-CVOVXB7O.js.map} +0 -0
- /package/dist/{json-7Z2IFGB3.js.map → json-QNGJFUY2.js.map} +0 -0
- /package/dist/{json-NZSGRYOE.js.map → lint-OQGB4DWJ.js.map} +0 -0
- /package/dist/{lint-VUYM5PPM.js.map → list-EDAB7X5Y.js.map} +0 -0
- /package/dist/{list-4JGOXLOZ.js.map → list-OQ3IYV2W.js.map} +0 -0
- /package/dist/{list-LTF25DQE.js.map → list-PN6JKYNX.js.map} +0 -0
- /package/dist/{list-WD3TZS5R.js.map → page-TPNMHL27.js.map} +0 -0
- /package/dist/{page-A2Y4ZMV4.js.map → pretty-EZ2NFU3C.js.map} +0 -0
- /package/dist/{pretty-D3DZFC5U.js.map → pretty-HO2LYG5N.js.map} +0 -0
- /package/dist/{pretty-R67YU6TU.js.map → pretty-K3M4AW2D.js.map} +0 -0
- /package/dist/{pretty-SFFOMSG5.js.map → provider-YWNTTQPA.js.map} +0 -0
- /package/dist/{release-VHHASAG7.js.map → release-EFLQT3FW.js.map} +0 -0
- /package/dist/{provider-JY2I3VLF.js.map → reporters-4R2E7PRJ.js.map} +0 -0
- /package/dist/{reporters-TO7Q6JYF.js.map → reporters-YVLLFBO5.js.map} +0 -0
- /package/dist/{reporters-UTLJVSWX.js.map → run-H4BOR2FR.js.map} +0 -0
- /package/dist/{run-BDGYRUXJ.js.map → sarif-GWHWJJFP.js.map} +0 -0
- /package/dist/{sarif-EHAMGCVR.js.map → sarif-SJFVSOBV.js.map} +0 -0
- /package/dist/{sarif-GJYLRXLS.js.map → sarif-YBFD5OUL.js.map} +0 -0
- /package/dist/{sarif-IAGMXA6C.js.map → validate-6R5UBDGU.js.map} +0 -0
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
GraphError,
|
|
4
4
|
STDIN_PATH
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CPYQ4BJK.js";
|
|
6
6
|
import {
|
|
7
7
|
metaPageView
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-FXE5K56B.js";
|
|
9
9
|
import {
|
|
10
10
|
parseLines
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-562QZKAB.js";
|
|
12
12
|
import {
|
|
13
13
|
errorMessage
|
|
14
14
|
} from "./chunk-G3T47CFV.js";
|
|
@@ -48,6 +48,26 @@ async function deliveredFields(data, refs, validator) {
|
|
|
48
48
|
for (const path of paths) removeAt(copy, path);
|
|
49
49
|
return copy;
|
|
50
50
|
}
|
|
51
|
+
var EVALS_ARE_AUTHOR_FACING = "--evals attaches eval verdicts, which are author-facing, and this run leaves author-facing content out.";
|
|
52
|
+
var CONFIGURED_EVALS_LEFT_OUT = "graph.export.chunks.evals is set, but eval verdicts are author-facing, so this run leaves them out.";
|
|
53
|
+
var NO_AUTHORING_EXPORT = "--no-authoring applies only to graph export chunks and llms; the others write the graph as built, so build it with --no-authoring.";
|
|
54
|
+
var NO_AUTHORING_NEEDS_PUBLISH = "--no-authoring decides what --publish builds, so it needs --publish.";
|
|
55
|
+
async function userFacing(docs, sets) {
|
|
56
|
+
return Promise.all(
|
|
57
|
+
docs.map(async (doc) => {
|
|
58
|
+
const refs = sets.refsFor(doc.path, doc.frontmatter);
|
|
59
|
+
const frontmatter = await deliveredFields(doc.frontmatter, refs, sets.validator);
|
|
60
|
+
const statements = doc.statements && await Promise.all(
|
|
61
|
+
doc.statements.map(async (s) => {
|
|
62
|
+
const data = await deliveredFields(s.data, refs, sets.validator);
|
|
63
|
+
return data === s.data ? s : { ...s, data };
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
const same = frontmatter === doc.frontmatter && (statements ?? []).every((s, i) => s === doc.statements?.[i]);
|
|
67
|
+
return same ? doc : { ...doc, frontmatter, ...statements ? { statements } : {} };
|
|
68
|
+
})
|
|
69
|
+
);
|
|
70
|
+
}
|
|
51
71
|
function comparePaths(a, b) {
|
|
52
72
|
for (let i = 0; i < Math.min(a.length, b.length); i++) {
|
|
53
73
|
const x = a[i] ?? "";
|
|
@@ -307,8 +327,13 @@ export {
|
|
|
307
327
|
copiedPairs,
|
|
308
328
|
suppressGraphOutput,
|
|
309
329
|
deliveredFields,
|
|
330
|
+
EVALS_ARE_AUTHOR_FACING,
|
|
331
|
+
CONFIGURED_EVALS_LEFT_OUT,
|
|
332
|
+
NO_AUTHORING_EXPORT,
|
|
333
|
+
NO_AUTHORING_NEEDS_PUBLISH,
|
|
334
|
+
userFacing,
|
|
310
335
|
openMetaView,
|
|
311
336
|
mergePage,
|
|
312
337
|
withExternalMetadata
|
|
313
338
|
};
|
|
314
|
-
//# sourceMappingURL=chunk-
|
|
339
|
+
//# sourceMappingURL=chunk-57LZPG4V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/core/graph-output.ts","../src/graph/core/external.ts","../src/graph/core/questions.ts","../src/graph/core/questions-schema.json"],"sourcesContent":["/**\n * `x-manni-graph-output` (proposal 0051 §5), on graph's side of the seam.\n *\n * Which fields belong in a published graph is a property of the field, not of\n * this tool, so it is recorded where the field is defined. The keyword is a\n * boolean beside a top-level property, registered on every Ajv `manni meta`\n * builds and read back through `Validator.graphOutputPreferences`. Absent means\n * `true`: every field is harvested. A mark nested inside `graph` is ignored, as\n * 0047 rule 2 ignores an `x-manni-location` there — the mark governs a\n * top-level key, and `graph` is the top-level key.\n *\n * The filter runs once, before `deriveGraph`, because all four published\n * outputs descend from what derivation produces: `emitTurtle` writes the graph,\n * and JSON-LD, the iiRDS package and the search index are all built by reading\n * that graph back. Dropping the field here keeps it out of every one of them.\n *\n * Encrypted values (proposal 0045) are harvested like any other value. graph\n * never decrypts, so what lands in the graph is the `~…` token, which says a\n * value exists and nothing about what it is. A field that should not reach a\n * published graph at all is marked `false` — one mechanism for \"keep this out\n * of the output\", rather than one rule for encryption and another for\n * everything else (0051 stress test 4).\n */\nimport type { MetaPageView } from \"../../meta/internal.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { GraphError } from \"../types.js\";\nimport type { DocModel } from \"../types.js\";\n\n/**\n * `docs`, with every top-level frontmatter key its schemas mark\n * `x-manni-graph-output: false` removed, and every such field of its inline\n * `meta` statements.\n *\n * A page's schemas are the set `manni meta validate` resolves for it (proposal\n * 0074): its own `$schema`, then meta's overrides, `schemas:`, `strict` and\n * the default set, read from meta's section of the same config. graph keeps\n * no schema set of its own, so one config answers both what a page is checked\n * against and what its published graph may carry.\n *\n * The docs arrive with their manifests' values already merged\n * (`withExternalMetadata`), so a field kept beside the page is filtered by\n * the same mark as one kept on it.\n *\n * A document whose schemas mark nothing is returned as it came in, so the\n * common case allocates nothing.\n */\nexport async function suppressGraphOutput(\n docs: readonly DocModel[],\n sets: Pick<MetaPageView, \"validator\" | \"refsFor\">,\n): Promise<DocModel[]> {\n const out: DocModel[] = [];\n for (const doc of docs) {\n let refs: string[];\n let frontmatter: Record<string, unknown>;\n let statements: DocModel[\"statements\"];\n try {\n refs = sets.refsFor(doc.path, doc.frontmatter);\n frontmatter = await allowed(doc.frontmatter, refs, sets.validator);\n // A statement's fields validate against the page's own schemas\n // (proposal 0099), so the same marks govern them.\n statements =\n doc.statements &&\n (await Promise.all(\n doc.statements.map(async (s) => {\n const data = await allowed(s.data, refs, sets.validator);\n return data === s.data ? s : { ...s, data };\n }),\n ));\n } catch (e) {\n // Loudly, and for the whole run. The schema is what decides which fields\n // a published graph may carry; a graph built while it could not be read\n // is a graph nobody checked, and quietly building one is the failure\n // this keyword exists to prevent.\n throw new GraphError(\n `${doc.path}: cannot read which fields the graph may carry: ${errorMessage(e)}`,\n );\n }\n const same =\n frontmatter === doc.frontmatter &&\n (statements ?? []).every((s, i) => s === doc.statements?.[i]);\n out.push(same ? doc : { ...doc, frontmatter, ...(statements ? { statements } : {}) });\n }\n return out;\n}\n\n/**\n * `data` as agent-facing output carries it (proposal 0090, decision 12): every\n * value its schemas mark `x-manni-graph-output: false` or\n * `x-manni-location: external` removed, at any depth, so an answer pin inside\n * a `sample-questions` item goes while its question stays. `data` itself when\n * nothing is marked, and a copy otherwise; the input is never changed.\n *\n * This is the rule for the chunk artifact's metadata. The graph build keeps\n * `suppressGraphOutput`'s top-level rule, because the graph is linked data,\n * not agent context.\n */\nexport async function deliveredFields(\n data: Record<string, unknown>,\n refs: string[],\n validator: Pick<MetaPageView[\"validator\"], \"deliveryExclusions\">,\n): Promise<Record<string, unknown>> {\n const pointers = await validator.deliveryExclusions(data, refs);\n if (pointers.length === 0) return data;\n const copy = structuredClone(data);\n // Deepest and highest index first, so removing one never shifts another.\n const paths = pointers.map((p) => p.slice(1).split(\"/\").map((s) => s.replace(/~1/g, \"/\").replace(/~0/g, \"~\")));\n paths.sort((a, b) => -comparePaths(a, b));\n for (const path of paths) removeAt(copy, path);\n return copy;\n}\n\n/** `--evals` in a run that leaves author-facing content out (proposal 0110): exit 2. */\nexport const EVALS_ARE_AUTHOR_FACING =\n \"--evals attaches eval verdicts, which are author-facing, and this run leaves author-facing content out.\";\n\n/** `graph.export.chunks.evals` in such a run: a warning, said once. */\nexport const CONFIGURED_EVALS_LEFT_OUT =\n \"graph.export.chunks.evals is set, but eval verdicts are author-facing, so this run leaves them out.\";\n\n/** `export --no-authoring` on a target that reserializes the built graph: exit 2. */\nexport const NO_AUTHORING_EXPORT =\n \"--no-authoring applies only to graph export chunks and llms; the others write the graph as built, so build it with --no-authoring.\";\n\n/** `serve --no-authoring` without `--publish`: exit 2. */\nexport const NO_AUTHORING_NEEDS_PUBLISH = \"--no-authoring decides what --publish builds, so it needs --publish.\";\n\n/**\n * `docs` as a `--no-authoring` build reads them (proposal 0110, D2): every\n * value its schemas mark `x-manni-location: external` or\n * `x-manni-graph-output: false` removed, at any depth, from the front matter\n * and from each inline statement. It is the rule chunk metadata already\n * follows, `deliveredFields`, so the graph and the chunks leave out the same\n * values. A document whose schemas mark nothing it holds is returned as it\n * came in.\n *\n * Strategy records are not this function's business. The build drops them\n * before analysis, so a link to one resolves as a link outside the build.\n */\nexport async function userFacing(\n docs: readonly DocModel[],\n sets: Pick<MetaPageView, \"validator\" | \"refsFor\">,\n): Promise<DocModel[]> {\n return Promise.all(\n docs.map(async (doc) => {\n const refs = sets.refsFor(doc.path, doc.frontmatter);\n const frontmatter = await deliveredFields(doc.frontmatter, refs, sets.validator);\n const statements =\n doc.statements &&\n (await Promise.all(\n doc.statements.map(async (s) => {\n const data = await deliveredFields(s.data, refs, sets.validator);\n return data === s.data ? s : { ...s, data };\n }),\n ));\n const same =\n frontmatter === doc.frontmatter && (statements ?? []).every((s, i) => s === doc.statements?.[i]);\n return same ? doc : { ...doc, frontmatter, ...(statements ? { statements } : {}) };\n }),\n );\n}\n\n/** Segment by segment, numbers as numbers, a prefix first. */\nfunction comparePaths(a: readonly string[], b: readonly string[]): number {\n for (let i = 0; i < Math.min(a.length, b.length); i++) {\n const x = a[i] ?? \"\";\n const y = b[i] ?? \"\";\n if (x === y) continue;\n const nx = /^\\d+$/.test(x) ? Number(x) : Number.NaN;\n const ny = /^\\d+$/.test(y) ? Number(y) : Number.NaN;\n if (!Number.isNaN(nx) && !Number.isNaN(ny)) return nx - ny;\n return x < y ? -1 : 1;\n }\n return a.length - b.length;\n}\n\nfunction removeAt(root: unknown, path: readonly string[]): void {\n let node: unknown = root;\n for (const segment of path.slice(0, -1)) {\n if (typeof node !== \"object\" || node === null) return;\n node = (node as Record<string, unknown>)[segment];\n }\n const last = path[path.length - 1];\n if (last === undefined || typeof node !== \"object\" || node === null) return;\n if (Array.isArray(node)) {\n const index = Number(last);\n if (Number.isInteger(index) && index < node.length) node.splice(index, 1);\n return;\n }\n Reflect.deleteProperty(node, last);\n}\n\n/** `data` without the keys its schemas mark `false`, or `data` itself when none are. */\nasync function allowed(\n data: Record<string, unknown>,\n refs: string[],\n validator: MetaPageView[\"validator\"],\n): Promise<Record<string, unknown>> {\n const preferences = await validator.graphOutputPreferences(data, refs);\n const suppressed = [...preferences].filter(([, ok]) => !ok).map(([key]) => key);\n if (suppressed.length === 0) return data;\n const kept: Record<string, unknown> = { ...data };\n for (const key of suppressed) Reflect.deleteProperty(kept, key);\n return kept;\n}\n","/**\n * A page's metadata as `manni meta validate` reads it: its frontmatter, plus\n * every key an external-metadata manifest of one of its collections owns\n * (proposals 0037, 0041, 0047, 0058 and 0068).\n *\n * A corpus that keeps `owner`, `last-updated` or `meta-provenance` in a\n * `{page}.meta.yaml` beside each page would otherwise read to graph as a set\n * of pages that declare none of them. So graph reads through meta's merge,\n * not a loader of its own: the join, ownership and keyless-manifest rules are\n * the ones `meta validate` applies, and so are its refusals, which reach the\n * user in meta's words and exit 2.\n *\n * The config is meta's section of the file the run is under, the same one\n * graph already reads the output marks from (proposal 0074). `--no-config`\n * declares no collection, so no manifest is read, exactly as meta reads none.\n * A page read from stdin belongs to no collection, so no manifest supplies it.\n *\n * Encrypted values (proposal 0045) are merged as the manifest holds them.\n * graph never decrypts, so the graph carries the `~…` token.\n */\nimport { resolve } from \"node:path\";\nimport { metaPageView, type MetaPageView } from \"../../meta/internal.js\";\nimport { errorMessage } from \"../../shared/errors.js\";\nimport { GraphError, type DocModel } from \"../types.js\";\nimport type { DocFormat } from \"./analyze.js\";\nimport { STDIN_PATH } from \"./iri.js\";\n\n/** Which config a run reads meta's section of, as its flags said. */\nexport interface MetaViewSource {\n /** `-c/--config`. */\n configPath?: string;\n /** `--no-config`. */\n noConfig?: boolean;\n}\n\n/**\n * Meta's view of the run's pages. `paths` are the run's documents relative\n * to `base` (`documentBase`), and the view's labels are too. `-c` stays\n * relative to `cwd`, where it was typed. A `{page}` manifest is read for\n * exactly these. A manifest meta refuses is refused here in meta's sentence,\n * as an operational error.\n */\nexport async function openMetaView(\n source: MetaViewSource,\n cwd: string,\n paths: readonly string[],\n base = cwd,\n): Promise<MetaPageView> {\n try {\n return await metaPageView({\n cwd: base,\n ...(source.configPath === undefined\n ? {}\n : { configPath: resolve(cwd, source.configPath) }),\n ...(source.noConfig === undefined ? {} : { noConfig: source.noConfig }),\n pages: paths.filter((p) => p !== STDIN_PATH).map((p) => resolve(base, p)),\n });\n } catch (e) {\n throw new GraphError(errorMessage(e));\n }\n}\n\n/** A page's own metadata and what its manifests add to it. */\nexport interface MergedPage {\n /** The page's metadata with every manifest-supplied key in place. */\n data: Record<string, unknown>;\n /** The top-level keys a manifest supplied, with their merged values. */\n supplied: Record<string, unknown>;\n}\n\n/** The `/key` pointer of a top-level key, RFC 6901 escaped. */\nfunction pointerOf(key: string): string {\n return `/${key.replace(/~/g, \"~0\").replace(/\\//g, \"~1\")}`;\n}\n\n/**\n * Merge one page's frontmatter with its manifests. `present` is whether the\n * page has a frontmatter block at all, and `format` is what graph parsed it as.\n */\nexport async function mergePage(\n view: MetaPageView,\n path: string,\n frontmatter: Record<string, unknown>,\n present: boolean,\n format: DocFormat,\n): Promise<MergedPage> {\n let merged;\n try {\n merged = await view.merge(path, {\n data: frontmatter,\n present,\n format,\n lineFor: () => undefined,\n });\n } catch (e) {\n throw new GraphError(errorMessage(e));\n }\n const data = merged.extracted.data;\n const supplied: Record<string, unknown> = {};\n for (const key of Object.keys(data)) {\n if (merged.locate(pointerOf(key)) !== undefined) supplied[key] = data[key];\n }\n return { data, supplied };\n}\n\n/** `docs`, each with its manifests' values merged into its frontmatter. */\nexport async function withExternalMetadata(\n docs: readonly DocModel[],\n view: MetaPageView,\n): Promise<DocModel[]> {\n const out: DocModel[] = [];\n for (const doc of docs) {\n const { data } = await mergePage(\n view,\n doc.path,\n doc.frontmatter,\n doc.frontmatterPresent,\n doc.format,\n );\n // A run with no manifest hands the page's own object back, so the common\n // case allocates nothing.\n out.push(data === doc.frontmatter ? doc : { ...doc, frontmatter: data });\n }\n return out;\n}\n","/**\n * A page's `sample-questions`, read into one shape (manni:ai-context:1.1.0,\n * proposal 0087). An item is a string, or an object whose `answers` pin the\n * body lines that answer it. `build` derives only the question text; `check`\n * reads the pins and the review state, which never reach the graph.\n *\n * Reading is lenient: `meta validate` owns the schema, so an item it would\n * refuse is skipped here, and a malformed pin is dropped, rather than failing\n * a build or a check over a shape another command already reports.\n */\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { Ajv2020 } from \"ajv/dist/2020.js\";\nimport { isNode, isSeq, LineCounter, parseDocument } from \"yaml\";\nimport { parseLines, type PageLines } from \"../../shared/pin.js\";\nimport { GraphError } from \"../types.js\";\nimport questionsSchema from \"./questions-schema.json\" with { type: \"json\" };\n\n/** One pinned answer: body lines of the page, and the pin over them. */\nexport interface AnswerPin {\n lines: PageLines;\n integrity?: string;\n /** `false` only when the pin says so; absent means confirmed. */\n reviewed: boolean;\n}\n\nexport interface SampleQuestion {\n question: string;\n /** Empty for an unpinned question, which must find the page itself. */\n answers: AnswerPin[];\n /** `false` only when the item says so; absent means confirmed. */\n reviewed: boolean;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction readPin(value: unknown): AnswerPin | undefined {\n if (!isRecord(value)) return undefined;\n const spec = value.lines;\n const lines =\n typeof spec === \"number\" || typeof spec === \"string\" ? parseLines(spec) : undefined;\n if (lines === undefined) return undefined;\n const integrity = value.integrity;\n return {\n lines,\n ...(typeof integrity === \"string\" ? { integrity } : {}),\n reviewed: value.reviewed !== false,\n };\n}\n\nfunction readItem(item: unknown): SampleQuestion | undefined {\n if (typeof item === \"string\") {\n return item === \"\" ? undefined : { question: item, answers: [], reviewed: true };\n }\n if (!isRecord(item) || typeof item.question !== \"string\") return undefined;\n const question = item.question;\n if (question === \"\") return undefined;\n const answers = Array.isArray(item.answers)\n ? item.answers.flatMap((a) => readPin(a) ?? [])\n : [];\n return { question, answers, reviewed: item.reviewed !== false };\n}\n\n/** The questions a `sample-questions` value holds: one item, or a list of them. */\nexport function readSampleQuestions(value: unknown): SampleQuestion[] {\n const items: unknown[] = Array.isArray(value) ? value : value === undefined ? [] : [value];\n return items.flatMap((item) => readItem(item) ?? []);\n}\n\n/** One answer in a golden-set file: a pin on the page `file` names. */\nexport interface FileAnswerPin extends AnswerPin {\n /** The page, relative to the config file, as the item names it. */\n file: string;\n}\n\n/** One question in a golden-set file (proposal 0087). */\nexport interface FileQuestion {\n question: string;\n /** Empty for a known gap, a question the docs don't answer. */\n answers: FileAnswerPin[];\n reviewed: boolean;\n /** The item's own `language`, when it names one. */\n language?: string;\n /** The file line the item starts on, 1-based. */\n line: number;\n}\n\nlet validateFile: ReturnType<Ajv2020[\"compile\"]> | undefined;\n\n/**\n * The questions of one golden-set file. `abs` is where it is read from, and\n * `label` is how messages name it. A missing file, a YAML error and a schema\n * failure are each a `GraphError`, an operational error: a golden set that\n * cannot be read gates nothing.\n */\nexport function readQuestionFile(abs: string, label: string, text?: string): FileQuestion[] {\n if (text === undefined && !existsSync(abs)) {\n throw new GraphError(\n `graph.questionFiles names ${label}, which does not exist. Fix the path, or remove it from graph.questionFiles.`,\n );\n }\n const counter = new LineCounter();\n const doc = parseDocument(text ?? readFileSync(abs, \"utf8\"), { lineCounter: counter });\n const [error] = doc.errors;\n if (error) throw new GraphError(`${label}: ${error.message}`);\n const value: unknown = doc.toJS() ?? [];\n validateFile ??= new Ajv2020({ allowUnionTypes: true }).compile(questionsSchema);\n if (!validateFile(value) || !Array.isArray(value)) {\n const [first] = validateFile.errors ?? [];\n const where = [first?.instancePath, first?.message ?? \"is invalid\"].filter(Boolean).join(\" \");\n throw new GraphError(`${label}: ${where}.`);\n }\n const nodes = isSeq(doc.contents) ? doc.contents.items : [];\n return value.flatMap((item: unknown, n): FileQuestion[] => {\n if (!isRecord(item) || typeof item.question !== \"string\") return [];\n const node = nodes[n];\n const offset = isNode(node) ? node.range[0] : undefined;\n const answers = Array.isArray(item.answers)\n ? item.answers.flatMap((a: unknown): FileAnswerPin[] => {\n const pin = readPin(a);\n return pin && isRecord(a) && typeof a.file === \"string\" ? [{ ...pin, file: a.file }] : [];\n })\n : [];\n return [\n {\n question: item.question,\n answers,\n reviewed: item.reviewed !== false,\n ...(typeof item.language === \"string\" ? { language: item.language } : {}),\n line: offset === undefined ? 1 : counter.linePos(offset).line,\n },\n ];\n });\n}\n\n/**\n * A question as duplicates are compared: lowercased, punctuation dropped,\n * and runs of spaces folded to one.\n */\nexport function questionKey(question: string): string {\n return question\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}\\s]/gu, \"\")\n .replace(/\\s+/gu, \" \")\n .trim();\n}\n\n/** The share of a question its answer already says, past which it copies. */\nexport const COPIED_SHARE = 0.5;\n\n/**\n * How many of the question's adjacent word pairs, lowercased, the text of its\n * answers also holds. Undefined under two words, where there is no pair to measure.\n */\nexport function copiedPairs(\n question: string,\n ...answers: string[]\n): { copied: number; of: number } | undefined {\n const words = (text: string): string[] => text.toLowerCase().match(/[\\p{L}\\p{N}]+/gu) ?? [];\n const pairs = (list: string[]): string[] => list.slice(1).map((w, i) => `${list[i] ?? \"\"} ${w}`);\n const asked = pairs(words(question));\n if (asked.length === 0) return undefined;\n // Each answer on its own, so no pair spans two of them.\n const said = new Set(answers.flatMap((a) => pairs(words(a))));\n return { copied: asked.filter((p) => said.has(p)).length, of: asked.length };\n}\n","{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"$id\": \"manni:graph:questions\",\n \"title\": \"manni graph golden-set file\",\n \"description\": \"A list of reader questions that span pages or that the docs don't answer (proposal 0087). Each item is a page sample question's object form, plus `answers[].file` and `language`. `graph.questionFiles` names the files, and `manni graph check` asks their questions.\",\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"question\", \"answers\"],\n \"properties\": {\n \"question\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The question, as a reader would ask it.\"\n },\n \"answers\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"file\", \"lines\"],\n \"properties\": {\n \"file\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The page that holds this answer, relative to the config file.\"\n },\n \"lines\": {\n \"oneOf\": [\n { \"type\": \"integer\", \"minimum\": 1 },\n { \"type\": \"string\", \"pattern\": \"^[1-9][0-9]*-[1-9][0-9]*$\" }\n ],\n \"description\": \"Body lines of that page, counted as for a citation's claim.\"\n },\n \"integrity\": {\n \"type\": \"string\",\n \"pattern\": \"^sha256-[0-9a-f]{64}$\",\n \"description\": \"The pin over those lines, under cite's hashing rule. Without it, the lines are not checked for change.\"\n },\n \"reviewed\": {\n \"type\": \"boolean\",\n \"description\": \"`false` marks a pin nobody has confirmed. Absent means `true`.\"\n }\n }\n },\n \"description\": \"The lines that answer the question, on one page or several. An empty list marks a known gap: a question the docs don't answer.\"\n },\n \"language\": {\n \"type\": \"string\",\n \"pattern\": \"^[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}))*$\",\n \"description\": \"The question's language, as a BCP-47 tag. Absent, it is the first answer's page language.\"\n },\n \"generated-by\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"The model that drafted the question or any of its pins, as `provider/model`.\"\n },\n \"confidence\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"maximum\": 1,\n \"description\": \"The drafting model's confidence, 0..1.\"\n },\n \"reviewed\": {\n \"type\": \"boolean\",\n \"description\": \"`false` marks a drafted question, and its pins are drafts with it. Absent means `true`.\"\n },\n \"reviewed-by\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"description\": \"Who confirmed the question. An optional record.\"\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA8CA,eAAsB,oBACpB,MACA,MACqB;AACrB,QAAM,MAAkB,CAAC;AACzB,aAAW,OAAO,MAAM;AACtB,QAAI;AACJ,QAAI;AACJ,QAAI;AACJ,QAAI;AACF,aAAO,KAAK,QAAQ,IAAI,MAAM,IAAI,WAAW;AAC7C,oBAAc,MAAM,QAAQ,IAAI,aAAa,MAAM,KAAK,SAAS;AAGjE,mBACE,IAAI,cACH,MAAM,QAAQ;AAAA,QACb,IAAI,WAAW,IAAI,OAAO,MAAM;AAC9B,gBAAM,OAAO,MAAM,QAAQ,EAAE,MAAM,MAAM,KAAK,SAAS;AACvD,iBAAO,SAAS,EAAE,OAAO,IAAI,EAAE,GAAG,GAAG,KAAK;AAAA,QAC5C,CAAC;AAAA,MACH;AAAA,IACJ,SAAS,GAAG;AAKV,YAAM,IAAI;AAAA,QACR,GAAG,IAAI,IAAI,mDAAmD,aAAa,CAAC,CAAC;AAAA,MAC/E;AAAA,IACF;AACA,UAAM,OACJ,gBAAgB,IAAI,gBACnB,cAAc,CAAC,GAAG,MAAM,CAAC,GAAG,MAAM,MAAM,IAAI,aAAa,CAAC,CAAC;AAC9D,QAAI,KAAK,OAAO,MAAM,EAAE,GAAG,KAAK,aAAa,GAAI,aAAa,EAAE,WAAW,IAAI,CAAC,EAAG,CAAC;AAAA,EACtF;AACA,SAAO;AACT;AAaA,eAAsB,gBACpB,MACA,MACA,WACkC;AAClC,QAAM,WAAW,MAAM,UAAU,mBAAmB,MAAM,IAAI;AAC9D,MAAI,SAAS,WAAW,EAAG,QAAO;AAClC,QAAM,OAAO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env node
|
|
2
|
+
import {
|
|
3
|
+
byCodeUnit
|
|
4
|
+
} from "./chunk-CPYQ4BJK.js";
|
|
5
|
+
|
|
6
|
+
// src/graph/core/localizations.ts
|
|
7
|
+
var LOCALIZATIONS_FILENAME = "localizations.json";
|
|
8
|
+
var UNDETERMINED = "und";
|
|
9
|
+
var LANGUAGE_TAG = /^[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}))*$/;
|
|
10
|
+
function isLanguageTag(value) {
|
|
11
|
+
return LANGUAGE_TAG.test(value);
|
|
12
|
+
}
|
|
13
|
+
function canonicalLanguageTag(tag) {
|
|
14
|
+
try {
|
|
15
|
+
return Intl.getCanonicalLocales(tag)[0] ?? tag;
|
|
16
|
+
} catch {
|
|
17
|
+
return tag;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function searchIndexFilename(language) {
|
|
21
|
+
return `search.${language}.json`;
|
|
22
|
+
}
|
|
23
|
+
function vectorIndexFilename(language) {
|
|
24
|
+
return `vectors.${language}.bin`;
|
|
25
|
+
}
|
|
26
|
+
function emitLocalizations(doc) {
|
|
27
|
+
const languages = [...doc.languages].sort(
|
|
28
|
+
(a, b) => byCodeUnit(a.language, b.language)
|
|
29
|
+
);
|
|
30
|
+
return `${JSON.stringify({ version: doc.version, languages }, null, 2)}
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
function isRecord(v) {
|
|
34
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
35
|
+
}
|
|
36
|
+
function parseLocalizations(text) {
|
|
37
|
+
let parsed;
|
|
38
|
+
try {
|
|
39
|
+
parsed = JSON.parse(text);
|
|
40
|
+
} catch {
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
if (!isRecord(parsed)) return void 0;
|
|
44
|
+
if (parsed["version"] !== 1 || !Array.isArray(parsed["languages"])) {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
for (const entry of parsed["languages"]) {
|
|
48
|
+
if (!isRecord(entry)) return void 0;
|
|
49
|
+
const language = entry["language"];
|
|
50
|
+
const search = entry["search"];
|
|
51
|
+
if (typeof language !== "string" || !isLanguageTag(language) || typeof entry["documents"] !== "number" || !isRecord(search) || typeof search["path"] !== "string" || typeof search["entries"] !== "number" || typeof search["digest"] !== "string" || !ownsFilename(search["path"], searchIndexFilename(language))) {
|
|
52
|
+
return void 0;
|
|
53
|
+
}
|
|
54
|
+
const v = entry["vectors"];
|
|
55
|
+
if (v !== void 0) {
|
|
56
|
+
if (!isRecord(v) || typeof v["path"] !== "string" || typeof v["model"] !== "string" || typeof v["dtype"] !== "string" || typeof v["dims"] !== "number" || typeof v["count"] !== "number" || // Same constraint `search.path` gets: the last segment must be the
|
|
57
|
+
// filename this language's sidecar would be given. Without it,
|
|
58
|
+
// `isSafeRelativePath` alone leaves `vectors.path` far more reachable
|
|
59
|
+
// than `search.path` — and `search --mode vector` opens it.
|
|
60
|
+
!ownsFilename(v["path"], vectorIndexFilename(language))) {
|
|
61
|
+
return void 0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return parsed;
|
|
66
|
+
}
|
|
67
|
+
function isSafeRelativePath(path) {
|
|
68
|
+
if (path === "" || path.startsWith("/") || /^[A-Za-z]:/.test(path)) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (path.includes("\\")) return false;
|
|
72
|
+
const segments = path.split("/");
|
|
73
|
+
let leading = true;
|
|
74
|
+
for (const segment of segments) {
|
|
75
|
+
if (segment === "" || segment === ".") return false;
|
|
76
|
+
if (segment === "..") {
|
|
77
|
+
if (!leading) return false;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
leading = false;
|
|
81
|
+
}
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
function ownsFilename(path, expected) {
|
|
85
|
+
if (!isSafeRelativePath(path)) return false;
|
|
86
|
+
return path.slice(path.lastIndexOf("/") + 1) === expected;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
LOCALIZATIONS_FILENAME,
|
|
91
|
+
UNDETERMINED,
|
|
92
|
+
isLanguageTag,
|
|
93
|
+
canonicalLanguageTag,
|
|
94
|
+
searchIndexFilename,
|
|
95
|
+
vectorIndexFilename,
|
|
96
|
+
emitLocalizations,
|
|
97
|
+
parseLocalizations,
|
|
98
|
+
isSafeRelativePath
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=chunk-5LQX57BW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/core/localizations.ts"],"sourcesContent":["/**\n * The localization manifest (ADR 01038) — `graph/localizations.json`, the index of\n * indexes.\n *\n * Retrieval artifacts fan out per language: one `search.<lang>.json` and one\n * `vectors.<lang>.bin` each, because a single flat index over every locale\n * ranks across the boundary it exists to respect, and because one embedding\n * model cannot serve every language. The manifest is what makes that navigable\n * — a browser fetches this one small file, learns which localizations exist and\n * what each costs, and downloads only the pair it needs.\n *\n * Written by `manni graph export search`; `manni graph embed` fills in the\n * `vectors` block as it produces each sidecar, so a manifest entry without one\n * means exactly \"this language has no vectors yet\".\n *\n * No `node:` imports: the CLI writes it and the browser runtime reads it.\n */\nimport { byCodeUnit } from \"./sort.js\";\n\n/** Conventional filename, written beside the graph. */\nexport const LOCALIZATIONS_FILENAME = \"localizations.json\";\n\n/**\n * BCP-47's tag for undetermined, used as the bucket for documents that declare\n * no language. A real tag rather than a dockg invention, so a consumer that\n * knows BCP-47 already knows what it means — and so the bucket sorts, filters,\n * and names a file like any other language.\n */\nexport const UNDETERMINED = \"und\";\n\n/**\n * BCP-47's common shape: language(2-3) + optional script(4) + optional\n * region(2 alpha or 3 digit) + variants. Accepts de, de-DE, zh-Hans,\n * zh-Hans-CN, pt-BR and und; rejects English and de_DE.\n *\n * The same grammar appears in `config-schema.json` (for `routes[].language` and\n * `embed.byLanguage`) and in `shapes/graph/shapes-1.3.0.ttl` (for `dcterms:language`).\n * This copy exists because a tag also becomes a **filename**, and the shapes\n * only run under `manni graph check` — an unvalidated literal from the graph would\n * otherwise reach `writeFileSync` as a path segment. `test/unit/schema-sync.test.ts`\n * pins all three to each other.\n */\nexport const LANGUAGE_TAG =\n /^[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}))*$/;\n\n/** Whether a string is usable as a language tag — and so as a filename segment. */\nexport function isLanguageTag(value: string): boolean {\n return LANGUAGE_TAG.test(value);\n}\n\n/**\n * The canonical spelling of a BCP-47 tag: `en-us` and `EN-US` both become\n * `en-US`. Tags are case-insensitive, so without this one locale splits into\n * two indexes and a filter matches only the spelling its author happened to\n * type. A string `Intl` refuses comes back as written, so the tag check that\n * guards filenames still sees, and reports, what the author wrote.\n *\n * `Intl` exists in every browser, so the runtime calls this too.\n */\nexport function canonicalLanguageTag(tag: string): string {\n try {\n return Intl.getCanonicalLocales(tag)[0] ?? tag;\n } catch {\n return tag;\n }\n}\n\n/** Where one language's lexical index lives, and what it holds. */\nexport interface SearchArtifact {\n /** Filename, relative to the manifest. */\n path: string;\n /** Indexed nodes. */\n entries: number;\n /** `sha256:…` of the file, so a consumer can detect a stale pair. */\n digest: string;\n}\n\n/** Where one language's vector sidecar lives, and what produced it. */\nexport interface VectorArtifact {\n path: string;\n /** The embedding model this language was embedded with. */\n model: string;\n dtype: string;\n dims: number;\n count: number;\n}\n\nexport interface LocalizationEntry {\n /** BCP-47 tag, or `und` for the undeclared bucket. */\n language: string;\n /** Documents in this language (sections excluded). */\n documents: number;\n search: SearchArtifact;\n /** Absent until `manni graph embed` has run for this language. */\n vectors?: VectorArtifact;\n}\n\nexport interface LocalizationsDoc {\n version: 1;\n /** One entry per language present, sorted by tag. */\n languages: LocalizationEntry[];\n}\n\n/** `search.de.json` — the lexical index for one language. */\nexport function searchIndexFilename(language: string): string {\n return `search.${language}.json`;\n}\n\n/** `vectors.de.bin` — the vector sidecar for one language. */\nexport function vectorIndexFilename(language: string): string {\n return `vectors.${language}.bin`;\n}\n\n/**\n * Serialize the manifest: sorted by language, two-space indent, trailing\n * newline — byte-stable like every other dockg artifact.\n */\nexport function emitLocalizations(doc: LocalizationsDoc): string {\n const languages = [...doc.languages].sort((a, b) =>\n byCodeUnit(a.language, b.language),\n );\n return `${JSON.stringify({ version: doc.version, languages }, null, 2)}\\n`;\n}\n\n/**\n * Parse and shape-check a manifest. Returns undefined for anything else.\n *\n * Every entry is checked, not just the envelope: callers reach straight for\n * `entry.search.path`, and a truncated or hand-edited file would otherwise\n * dereference `undefined` and surface as a raw TypeError with exit 1 rather\n * than the operational error (exit 2) an unreadable artifact owes.\n */\n/** A plain JSON object — not `null`, not an array. */\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\nexport function parseLocalizations(text: string): LocalizationsDoc | undefined {\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch {\n return undefined;\n }\n // Checked as `unknown`. Casting to `LocalizationsDoc` first would hand the\n // compiler the answer to the question this function exists to ask, and every\n // guard below would then read as a test that cannot fail.\n if (!isRecord(parsed)) return undefined;\n if (parsed[\"version\"] !== 1 || !Array.isArray(parsed[\"languages\"])) {\n return undefined;\n }\n for (const entry of parsed[\"languages\"] as unknown[]) {\n if (!isRecord(entry)) return undefined;\n const language = entry[\"language\"];\n const search = entry[\"search\"];\n if (\n typeof language !== \"string\" ||\n !isLanguageTag(language) ||\n typeof entry[\"documents\"] !== \"number\" ||\n !isRecord(search) ||\n typeof search[\"path\"] !== \"string\" ||\n typeof search[\"entries\"] !== \"number\" ||\n typeof search[\"digest\"] !== \"string\" ||\n !ownsFilename(search[\"path\"], searchIndexFilename(language))\n ) {\n return undefined;\n }\n const v = entry[\"vectors\"];\n if (v !== undefined) {\n if (\n !isRecord(v) ||\n typeof v[\"path\"] !== \"string\" ||\n typeof v[\"model\"] !== \"string\" ||\n typeof v[\"dtype\"] !== \"string\" ||\n typeof v[\"dims\"] !== \"number\" ||\n typeof v[\"count\"] !== \"number\" ||\n // Same constraint `search.path` gets: the last segment must be the\n // filename this language's sidecar would be given. Without it,\n // `isSafeRelativePath` alone leaves `vectors.path` far more reachable\n // than `search.path` — and `search --mode vector` opens it.\n !ownsFilename(v[\"path\"], vectorIndexFilename(language))\n ) {\n return undefined;\n }\n }\n }\n return parsed as unknown as LocalizationsDoc;\n}\n\n/**\n * A path from the manifest is joined onto a directory and opened, so it is\n * checked like any other untrusted path segment.\n *\n * `export` refuses to *write* a filename it built from a bad language tag; this\n * is the same hole on the read side, reached through a manifest instead of\n * through frontmatter. A hand-edited `\"path\": \"../../etc/passwd\"` would\n * otherwise be joined and read by `embed` and `search`.\n *\n * Rejects an absolute path, a Windows drive letter, a backslash, and any `.`\n * or empty segment. `..` is allowed **only as a prefix**, so `a/../../x` — an\n * escape wearing a normal first segment — is refused while `../vecs/x.bin`,\n * the layout `embed -o` produces, is not.\n *\n * How far up a leading run may climb is deliberately *not* capped. It was,\n * briefly, and the cap rejected manifests `embed -o` itself writes: a sidecar\n * directory two levels from the index directory produced an artifact set dockg\n * could not read back. The bound that matters is `ownsFilename` — a crafted\n * manifest can only ever name a file already called `search.<lang>.json` or\n * `vectors.<lang>.bin`, which is a long way from arbitrary-file read, and no\n * number of `..` segments widens it.\n */\nexport function isSafeRelativePath(path: string): boolean {\n if (path === \"\" || path.startsWith(\"/\") || /^[A-Za-z]:/.test(path)) {\n return false;\n }\n if (path.includes(\"\\\\\")) return false;\n const segments = path.split(\"/\");\n let leading = true;\n for (const segment of segments) {\n if (segment === \"\" || segment === \".\") return false;\n if (segment === \"..\") {\n if (!leading) return false;\n continue;\n }\n leading = false;\n }\n return true;\n}\n\n/**\n * The path is relative-safe *and* its last segment is the filename this\n * language's artifact would be given.\n *\n * The filename check is the constraint that actually narrows what a crafted\n * manifest can reach: `isSafeRelativePath` bounds the directory it can point\n * into, this bounds the file.\n */\nfunction ownsFilename(path: string, expected: string): boolean {\n if (!isSafeRelativePath(path)) return false;\n return path.slice(path.lastIndexOf(\"/\") + 1) === expected;\n}\n"],"mappings":";;;;;;AAoBO,IAAM,yBAAyB;AAQ/B,IAAM,eAAe;AAcrB,IAAM,eACX;AAGK,SAAS,cAAc,OAAwB;AACpD,SAAO,aAAa,KAAK,KAAK;AAChC;AAWO,SAAS,qBAAqB,KAAqB;AACxD,MAAI;AACF,WAAO,KAAK,oBAAoB,GAAG,EAAE,CAAC,KAAK;AAAA,EAC7C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAuCO,SAAS,oBAAoB,UAA0B;AAC5D,SAAO,UAAU,QAAQ;AAC3B;AAGO,SAAS,oBAAoB,UAA0B;AAC5D,SAAO,WAAW,QAAQ;AAC5B;AAMO,SAAS,kBAAkB,KAA+B;AAC/D,QAAM,YAAY,CAAC,GAAG,IAAI,SAAS,EAAE;AAAA,IAAK,CAAC,GAAG,MAC5C,WAAW,EAAE,UAAU,EAAE,QAAQ;AAAA,EACnC;AACA,SAAO,GAAG,KAAK,UAAU,EAAE,SAAS,IAAI,SAAS,UAAU,GAAG,MAAM,CAAC,CAAC;AAAA;AACxE;AAWA,SAAS,SAAS,GAA0C;AAC1D,SAAO,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAChE;AAEO,SAAS,mBAAmB,MAA4C;AAC7E,MAAI;AACJ,MAAI;AACF,aAAS,KAAK,MAAM,IAAI;AAAA,EAC1B,QAAQ;AACN,WAAO;AAAA,EACT;AAIA,MAAI,CAAC,SAAS,MAAM,EAAG,QAAO;AAC9B,MAAI,OAAO,SAAS,MAAM,KAAK,CAAC,MAAM,QAAQ,OAAO,WAAW,CAAC,GAAG;AAClE,WAAO;AAAA,EACT;AACA,aAAW,SAAS,OAAO,WAAW,GAAgB;AACpD,QAAI,CAAC,S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