@unbrained/pm-cli 2026.7.5 → 2026.7.6
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/CHANGELOG.md +10 -0
- package/dist/cli-bundle/chunks/activity-WJCGCYPU.js +18 -0
- package/dist/cli-bundle/chunks/activity-Z6QUAUSG.js +22 -0
- package/dist/cli-bundle/chunks/aggregate-BDM6EIAR.js +25 -0
- package/dist/cli-bundle/chunks/aggregate-VQ2DHU3S.js +21 -0
- package/dist/cli-bundle/chunks/append-BGML6VLD.js +19 -0
- package/dist/cli-bundle/chunks/append-RKJYPU74.js +15 -0
- package/dist/cli-bundle/chunks/chunk-22KBU3MW.js +57 -0
- package/dist/cli-bundle/chunks/chunk-24YG75HI.js +634 -0
- package/dist/cli-bundle/chunks/chunk-2XG4IZON.js +218 -0
- package/dist/cli-bundle/chunks/chunk-3GCS5SKL.js +228 -0
- package/dist/cli-bundle/chunks/chunk-3KTN6IBA.js +2330 -0
- package/dist/cli-bundle/chunks/chunk-3N6RRO2Q.js +808 -0
- package/dist/cli-bundle/chunks/chunk-3N6RRO2Q.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-3UJRFJ5R.js +1573 -0
- package/dist/cli-bundle/chunks/chunk-3VHSI5FL.js +1001 -0
- package/dist/cli-bundle/chunks/chunk-425E4QL5.js +278 -0
- package/dist/cli-bundle/chunks/chunk-425E4QL5.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-45FYNUFJ.js +38 -0
- package/dist/cli-bundle/chunks/chunk-45FYNUFJ.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-46CUF5L6.js +1018 -0
- package/dist/cli-bundle/chunks/chunk-4CJFCTLM.js +222 -0
- package/dist/cli-bundle/chunks/chunk-4CJFCTLM.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-4HIFVN7N.js +249 -0
- package/dist/cli-bundle/chunks/chunk-4HIFVN7N.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-4IWYTWGF.js +819 -0
- package/dist/cli-bundle/chunks/chunk-4LELACOL.js +391 -0
- package/dist/cli-bundle/chunks/chunk-4LELACOL.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-4MZVRJOE.js +279 -0
- package/dist/cli-bundle/chunks/chunk-4MZVRJOE.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-4ZBE5GUN.js +184 -0
- package/dist/cli-bundle/chunks/chunk-4ZBE5GUN.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-57NWPFF2.js +5640 -0
- package/dist/cli-bundle/chunks/chunk-57NWPFF2.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-5AJXHQM7.js +268 -0
- package/dist/cli-bundle/chunks/chunk-5AJXHQM7.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-5BMM6XQY.js +508 -0
- package/dist/cli-bundle/chunks/chunk-5BMM6XQY.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-5GZ7TDD6.js +1868 -0
- package/dist/cli-bundle/chunks/chunk-5VAA4YHR.js +1749 -0
- package/dist/cli-bundle/chunks/chunk-64YKRTSV.js +1961 -0
- package/dist/cli-bundle/chunks/chunk-6LLVNJXT.js +429 -0
- package/dist/cli-bundle/chunks/chunk-6QBJLYBP.js +120 -0
- package/dist/cli-bundle/chunks/chunk-6QBJLYBP.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-7D7OOEYG.js +278 -0
- package/dist/cli-bundle/chunks/chunk-7D7OOEYG.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-7DT4WSH2.js +60 -0
- package/dist/cli-bundle/chunks/chunk-7WBAJSS6.js +102 -0
- package/dist/cli-bundle/chunks/chunk-AGHMOTGM.js +150 -0
- package/dist/cli-bundle/chunks/chunk-ALFPSEWO.js +112 -0
- package/dist/cli-bundle/chunks/chunk-AZYGZGGI.js +361 -0
- package/dist/cli-bundle/chunks/chunk-B6DUFX6H.js +1413 -0
- package/dist/cli-bundle/chunks/chunk-B6XS3R3O.js +275 -0
- package/dist/cli-bundle/chunks/chunk-B6XS3R3O.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-B7FRNMYN.js +421 -0
- package/dist/cli-bundle/chunks/chunk-B7FRNMYN.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-C5JBZRPU.js +1985 -0
- package/dist/cli-bundle/chunks/chunk-CFB33L7W.js +398 -0
- package/dist/cli-bundle/chunks/chunk-CFNGIXZP.js +784 -0
- package/dist/cli-bundle/chunks/chunk-CFNGIXZP.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-CL36D4PC.js +225 -0
- package/dist/cli-bundle/chunks/chunk-COSPOP7H.js +6677 -0
- package/dist/cli-bundle/chunks/chunk-COSPOP7H.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-COWTDV6B.js +3461 -0
- package/dist/cli-bundle/chunks/chunk-COWTDV6B.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-CRVYGJUI.js +553 -0
- package/dist/cli-bundle/chunks/chunk-CRVYGJUI.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-D2XRLB55.js +645 -0
- package/dist/cli-bundle/chunks/chunk-DEWEK6AN.js +1858 -0
- package/dist/cli-bundle/chunks/chunk-DMRNBQOI.js +1063 -0
- package/dist/cli-bundle/chunks/chunk-DMRNBQOI.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-E3SZTQ4K.js +1932 -0
- package/dist/cli-bundle/chunks/chunk-E42XTBSP.js +1359 -0
- package/dist/cli-bundle/chunks/chunk-E42XTBSP.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-EBRZZ54H.js +655 -0
- package/dist/cli-bundle/chunks/chunk-EBRZZ54H.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-EGAP5OWD.js +4712 -0
- package/dist/cli-bundle/chunks/chunk-EGAP5OWD.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-EGY6JBQ3.js +160 -0
- package/dist/cli-bundle/chunks/chunk-EKFNL33R.js +222 -0
- package/dist/cli-bundle/chunks/chunk-ENGQOEUY.js +1704 -0
- package/dist/cli-bundle/chunks/chunk-EOKXK3R3.js +2046 -0
- package/dist/cli-bundle/chunks/chunk-F3K4JGFD.js +121 -0
- package/dist/cli-bundle/chunks/chunk-FLZSGSQR.js +231 -0
- package/dist/cli-bundle/chunks/chunk-FOUYJE4A.js +2090 -0
- package/dist/cli-bundle/chunks/chunk-FOUYJE4A.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-FT3QTERD.js +550 -0
- package/dist/cli-bundle/chunks/chunk-G24G7ZAV.js +1570 -0
- package/dist/cli-bundle/chunks/chunk-G64OCSKU.js +444 -0
- package/dist/cli-bundle/chunks/chunk-GANUTS7W.js +1775 -0
- package/dist/cli-bundle/chunks/chunk-GBAX2ZAQ.js +401 -0
- package/dist/cli-bundle/chunks/chunk-GDDAGPWJ.js +105 -0
- package/dist/cli-bundle/chunks/chunk-GDDAGPWJ.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-GEYZ4G4O.js +239 -0
- package/dist/cli-bundle/chunks/chunk-GEYZ4G4O.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-GJ7QC5DJ.js +624 -0
- package/dist/cli-bundle/chunks/chunk-GPLPTGOV.js +530 -0
- package/dist/cli-bundle/chunks/chunk-GZRDYONU.js +1005 -0
- package/dist/cli-bundle/chunks/chunk-HFDADVJZ.js +1356 -0
- package/dist/cli-bundle/chunks/chunk-HFDADVJZ.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-HIHMT6WS.js +41 -0
- package/dist/cli-bundle/chunks/chunk-HIHMT6WS.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-HN6NSXNW.js +277 -0
- package/dist/cli-bundle/chunks/chunk-HN6NSXNW.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-HOVCGJSD.js +293 -0
- package/dist/cli-bundle/chunks/chunk-HOVCGJSD.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-I36Y7PCE.js +38 -0
- package/dist/cli-bundle/chunks/chunk-I36Y7PCE.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-IQNVQHOP.js +309 -0
- package/dist/cli-bundle/chunks/chunk-IQNVQHOP.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-IWVU4C2F.js +358 -0
- package/dist/cli-bundle/chunks/chunk-IX5BXEMX.js +267 -0
- package/dist/cli-bundle/chunks/chunk-JDDLOQAE.js +265 -0
- package/dist/cli-bundle/chunks/chunk-JJP45OEI.js +119 -0
- package/dist/cli-bundle/chunks/chunk-JQXPY7DN.js +2257 -0
- package/dist/cli-bundle/chunks/chunk-JQXPY7DN.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-JVH7QBVV.js +24 -0
- package/dist/cli-bundle/chunks/chunk-JVH7QBVV.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-K46RF36U.js +207 -0
- package/dist/cli-bundle/chunks/chunk-KERMZVY5.js +371 -0
- package/dist/cli-bundle/chunks/chunk-KERMZVY5.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-KGFUY7WN.js +814 -0
- package/dist/cli-bundle/chunks/chunk-KSRUHV2H.js +76 -0
- package/dist/cli-bundle/chunks/chunk-KSRUHV2H.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-KUOOJR35.js +260 -0
- package/dist/cli-bundle/chunks/chunk-L5PSPMZ4.js +277 -0
- package/dist/cli-bundle/chunks/chunk-LK6XLOGP.js +5799 -0
- package/dist/cli-bundle/chunks/chunk-LK6XLOGP.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-LP3HSFZ2.js +140 -0
- package/dist/cli-bundle/chunks/chunk-LP3HSFZ2.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-LPSSSDJR.js +1239 -0
- package/dist/cli-bundle/chunks/chunk-M7JNBQAD.js +225 -0
- package/dist/cli-bundle/chunks/chunk-M7JNBQAD.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-MA4SM3QZ.js +655 -0
- package/dist/cli-bundle/chunks/chunk-MAWDPCJW.js +1601 -0
- package/dist/cli-bundle/chunks/chunk-MAWDPCJW.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-MFAZSEM5.js +1031 -0
- package/dist/cli-bundle/chunks/chunk-MFSCBT5Q.js +995 -0
- package/dist/cli-bundle/chunks/chunk-ML5X7DP2.js +296 -0
- package/dist/cli-bundle/chunks/chunk-ML5X7DP2.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-MLIYFOE7.js +357 -0
- package/dist/cli-bundle/chunks/chunk-MR6FJ7LL.js +2043 -0
- package/dist/cli-bundle/chunks/chunk-MR6FJ7LL.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-MUH7A3FD.js +61 -0
- package/dist/cli-bundle/chunks/chunk-MVSP7WGJ.js +108 -0
- package/dist/cli-bundle/chunks/chunk-MVSP7WGJ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-MVYWGY2A.js +262 -0
- package/dist/cli-bundle/chunks/chunk-MWMVPCIE.js +1423 -0
- package/dist/cli-bundle/chunks/chunk-MXYA5SAJ.js +2033 -0
- package/dist/cli-bundle/chunks/chunk-MXYA5SAJ.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-N745W3B3.js +1604 -0
- package/dist/cli-bundle/chunks/chunk-N745W3B3.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-NB7RLQFW.js +57 -0
- package/dist/cli-bundle/chunks/chunk-NB7RLQFW.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-NC33K5ZS.js +123 -0
- package/dist/cli-bundle/chunks/chunk-NC33K5ZS.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-NGXQ3PFT.js +263 -0
- package/dist/cli-bundle/chunks/chunk-NMP5I3I5.js +1615 -0
- package/dist/cli-bundle/chunks/chunk-NO442GWJ.js +41 -0
- package/dist/cli-bundle/chunks/chunk-NO442GWJ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-NZEHECMW.js +658 -0
- package/dist/cli-bundle/chunks/chunk-NZEHECMW.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-O6AWCQRQ.js +124 -0
- package/dist/cli-bundle/chunks/chunk-OGWQ2IEP.js +240 -0
- package/dist/cli-bundle/chunks/chunk-PZUGEOPS.js +143 -0
- package/dist/cli-bundle/chunks/chunk-PZUGEOPS.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-QLMX7SRD.js +210 -0
- package/dist/cli-bundle/chunks/chunk-QX6HM775.js +398 -0
- package/dist/cli-bundle/chunks/chunk-QX6HM775.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-R5BMJX33.js +27 -0
- package/dist/cli-bundle/chunks/chunk-R5BMJX33.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-RCQZK2GO.js +296 -0
- package/dist/cli-bundle/chunks/chunk-RCQZK2GO.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-RFNYTESG.js +520 -0
- package/dist/cli-bundle/chunks/chunk-RKQOO2UM.js +79 -0
- package/dist/cli-bundle/chunks/chunk-RKQOO2UM.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-RQLT6ZWB.js +282 -0
- package/dist/cli-bundle/chunks/chunk-RQLT6ZWB.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-S3JS6YVZ.js +274 -0
- package/dist/cli-bundle/chunks/chunk-S3JS6YVZ.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-SCUR7K7N.js +2198 -0
- package/dist/cli-bundle/chunks/chunk-SGMFPXKR.js +68 -0
- package/dist/cli-bundle/chunks/chunk-SGMFPXKR.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-SHQY2IDC.js +1977 -0
- package/dist/cli-bundle/chunks/chunk-SMB7RV23.js +130 -0
- package/dist/cli-bundle/chunks/chunk-SPZ6DOGY.js +1041 -0
- package/dist/cli-bundle/chunks/chunk-SQOIV3OQ.js +563 -0
- package/dist/cli-bundle/chunks/chunk-SQOIV3OQ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-SQYJ4HF2.js +1765 -0
- package/dist/cli-bundle/chunks/chunk-T42JWV3F.js +822 -0
- package/dist/cli-bundle/chunks/chunk-TKD5VCTD.js +6567 -0
- package/dist/cli-bundle/chunks/chunk-TKD5VCTD.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-TULGS6X6.js +2132 -0
- package/dist/cli-bundle/chunks/chunk-TZXRBVAM.js +2306 -0
- package/dist/cli-bundle/chunks/chunk-UH7T2DAX.js +181 -0
- package/dist/cli-bundle/chunks/chunk-UH7T2DAX.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-VIIUS6N6.js +4773 -0
- package/dist/cli-bundle/chunks/chunk-VIIUS6N6.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-VPIM42PC.js +367 -0
- package/dist/cli-bundle/chunks/chunk-VQRSPVME.js +368 -0
- package/dist/cli-bundle/chunks/chunk-VQRSPVME.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-W3DSJQIO.js +447 -0
- package/dist/cli-bundle/chunks/chunk-W572BIEB.js +1249 -0
- package/dist/cli-bundle/chunks/chunk-W6DYWXPQ.js +1073 -0
- package/dist/cli-bundle/chunks/chunk-W6DYWXPQ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-WG34ZNQQ.js +3423 -0
- package/dist/cli-bundle/chunks/chunk-WG34ZNQQ.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-WLSM645P.js +2247 -0
- package/dist/cli-bundle/chunks/chunk-WLSM645P.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-WRTENIX3.js +215 -0
- package/dist/cli-bundle/chunks/chunk-WSBLYDWV.js +388 -0
- package/dist/cli-bundle/chunks/chunk-WSBLYDWV.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-XB7KFVFI.js +533 -0
- package/dist/cli-bundle/chunks/chunk-XC5BURG2.js +306 -0
- package/dist/cli-bundle/chunks/chunk-XC5BURG2.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-XDB7RWQT.js +424 -0
- package/dist/cli-bundle/chunks/chunk-XDB7RWQT.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-XG625QP4.js +58 -0
- package/dist/cli-bundle/chunks/chunk-XHET7YUZ.js +71 -0
- package/dist/cli-bundle/chunks/chunk-XHET7YUZ.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-XUC7PI2H.js +243 -0
- package/dist/cli-bundle/chunks/chunk-Y46GD4IX.js +116 -0
- package/dist/cli-bundle/chunks/chunk-Y4M7CPQP.js +804 -0
- package/dist/cli-bundle/chunks/chunk-Y6BK55A3.js +2128 -0
- package/dist/cli-bundle/chunks/chunk-Y6BK55A3.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-YN7Y6DQZ.js +426 -0
- package/dist/cli-bundle/chunks/chunk-Z3U3U5KD.js +511 -0
- package/dist/cli-bundle/chunks/chunk-Z3U3U5KD.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-ZGK4L4JM.js +133 -0
- package/dist/cli-bundle/chunks/chunk-ZJ262CED.js +394 -0
- package/dist/cli-bundle/chunks/chunk-ZJ262CED.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-ZO3XKAOP.js +299 -0
- package/dist/cli-bundle/chunks/chunk-ZO3XKAOP.js.map +7 -0
- package/dist/cli-bundle/chunks/chunk-ZSUS2OD3.js +2105 -0
- package/dist/cli-bundle/chunks/chunk-ZWBEPGD7.js +54 -0
- package/dist/cli-bundle/chunks/chunk-ZWBEPGD7.js.map +1 -0
- package/dist/cli-bundle/chunks/chunk-ZZD4J5XY.js +1570 -0
- package/dist/cli-bundle/chunks/claim-RFS7BROJ.js +19 -0
- package/dist/cli-bundle/chunks/claim-XP5AWZ5H.js +23 -0
- package/dist/cli-bundle/chunks/close-2SSSHHUZ.js +20 -0
- package/dist/cli-bundle/chunks/close-GEANHQ2J.js +16 -0
- package/dist/cli-bundle/chunks/close-many-CMZW7ITN.js +31 -0
- package/dist/cli-bundle/chunks/close-many-ZFDIG6M7.js +27 -0
- package/dist/cli-bundle/chunks/comments-MFSYVNNU.js +21 -0
- package/dist/cli-bundle/chunks/comments-XUBPXDYX.js +17 -0
- package/dist/cli-bundle/chunks/config-D7XQMONX.js +18 -0
- package/dist/cli-bundle/chunks/config-T4FHBSYN.js +22 -0
- package/dist/cli-bundle/chunks/context-DIU275XI.js +48 -0
- package/dist/cli-bundle/chunks/context-JCOYB4LZ.js +44 -0
- package/dist/cli-bundle/chunks/contracts-BVO7CSLK.js +12 -0
- package/dist/cli-bundle/chunks/contracts-NYPEW2G4.js +16 -0
- package/dist/cli-bundle/chunks/copy-32ROBIDL.js +17 -0
- package/dist/cli-bundle/chunks/copy-NAGLGMHZ.js +13 -0
- package/dist/cli-bundle/chunks/create-4V7SWNBB.js +30 -0
- package/dist/cli-bundle/chunks/create-E77SDCUP.js +34 -0
- package/dist/cli-bundle/chunks/delete-NQI5OSKN.js +14 -0
- package/dist/cli-bundle/chunks/delete-RA5KTCLB.js +18 -0
- package/dist/cli-bundle/chunks/deps-32SU7HO5.js +21 -0
- package/dist/cli-bundle/chunks/deps-T7SCWXEX.js +17 -0
- package/dist/cli-bundle/chunks/docs-RRUPT7O2.js +22 -0
- package/dist/cli-bundle/chunks/docs-WL2IWGWV.js +18 -0
- package/dist/cli-bundle/chunks/eval-NF2J5SHR.js +23 -0
- package/dist/cli-bundle/chunks/eval-SKDT3MZU.js +27 -0
- package/dist/cli-bundle/chunks/extension-LAXKCAYE.js +42 -0
- package/dist/cli-bundle/chunks/extension-LAXKCAYE.js.map +1 -0
- package/dist/cli-bundle/chunks/extension-ZISPBRBC.js +38 -0
- package/dist/cli-bundle/chunks/extension-ZISPBRBC.js.map +7 -0
- package/dist/cli-bundle/chunks/files-EWRQHGIS.js +22 -0
- package/dist/cli-bundle/chunks/files-EWRQHGIS.js.map +7 -0
- package/dist/cli-bundle/chunks/files-PYKR2UUG.js +26 -0
- package/dist/cli-bundle/chunks/files-PYKR2UUG.js.map +1 -0
- package/dist/cli-bundle/chunks/focus-4T7TM4MT.js +18 -0
- package/dist/cli-bundle/chunks/focus-4T7TM4MT.js.map +1 -0
- package/dist/cli-bundle/chunks/focus-L3YUASOD.js +14 -0
- package/dist/cli-bundle/chunks/focus-L3YUASOD.js.map +7 -0
- package/dist/cli-bundle/chunks/gc-2DNMPXMC.js +16 -0
- package/dist/cli-bundle/chunks/gc-2DNMPXMC.js.map +1 -0
- package/dist/cli-bundle/chunks/gc-2PCTYYRI.js +12 -0
- package/dist/cli-bundle/chunks/gc-2PCTYYRI.js.map +7 -0
- package/dist/cli-bundle/chunks/get-7DMITJ3G.js +23 -0
- package/dist/cli-bundle/chunks/get-7DMITJ3G.js.map +1 -0
- package/dist/cli-bundle/chunks/get-VKQXCXLL.js +19 -0
- package/dist/cli-bundle/chunks/get-VKQXCXLL.js.map +7 -0
- package/dist/cli-bundle/chunks/health-CVSTAR2F.js +31 -0
- package/dist/cli-bundle/chunks/health-CVSTAR2F.js.map +7 -0
- package/dist/cli-bundle/chunks/health-TV3GKTFN.js +35 -0
- package/dist/cli-bundle/chunks/health-TV3GKTFN.js.map +1 -0
- package/dist/cli-bundle/chunks/history-D4JUX5XV.js +20 -0
- package/dist/cli-bundle/chunks/history-D4JUX5XV.js.map +7 -0
- package/dist/cli-bundle/chunks/history-LQ2UWZTE.js +24 -0
- package/dist/cli-bundle/chunks/history-LQ2UWZTE.js.map +1 -0
- package/dist/cli-bundle/chunks/history-compact-3MNXLKAT.js +29 -0
- package/dist/cli-bundle/chunks/history-compact-3MNXLKAT.js.map +1 -0
- package/dist/cli-bundle/chunks/history-compact-QWEO32FP.js +25 -0
- package/dist/cli-bundle/chunks/history-compact-QWEO32FP.js.map +7 -0
- package/dist/cli-bundle/chunks/history-redact-3OIVBVIY.js +21 -0
- package/dist/cli-bundle/chunks/history-redact-3OIVBVIY.js.map +7 -0
- package/dist/cli-bundle/chunks/history-redact-P6DYF55G.js +25 -0
- package/dist/cli-bundle/chunks/history-redact-P6DYF55G.js.map +1 -0
- package/dist/cli-bundle/chunks/history-repair-I3E73UGQ.js +23 -0
- package/dist/cli-bundle/chunks/history-repair-I3E73UGQ.js.map +7 -0
- package/dist/cli-bundle/chunks/history-repair-ZJQFMWPD.js +27 -0
- package/dist/cli-bundle/chunks/history-repair-ZJQFMWPD.js.map +1 -0
- package/dist/cli-bundle/chunks/init-C3LJPWQZ.js +30 -0
- package/dist/cli-bundle/chunks/init-C3LJPWQZ.js.map +1 -0
- package/dist/cli-bundle/chunks/init-J3DPGWQI.js +26 -0
- package/dist/cli-bundle/chunks/init-J3DPGWQI.js.map +7 -0
- package/dist/cli-bundle/chunks/learnings-5BO2SNDW.js +21 -0
- package/dist/cli-bundle/chunks/learnings-5BO2SNDW.js.map +1 -0
- package/dist/cli-bundle/chunks/learnings-OGP4JB4I.js +17 -0
- package/dist/cli-bundle/chunks/learnings-OGP4JB4I.js.map +7 -0
- package/dist/cli-bundle/chunks/list-O5NZVSPN.js +36 -0
- package/dist/cli-bundle/chunks/list-O5NZVSPN.js.map +1 -0
- package/dist/cli-bundle/chunks/list-Z55YCNTC.js +32 -0
- package/dist/cli-bundle/chunks/list-Z55YCNTC.js.map +7 -0
- package/dist/cli-bundle/chunks/next-GBNTGXFC.js +28 -0
- package/dist/cli-bundle/chunks/next-GBNTGXFC.js.map +7 -0
- package/dist/cli-bundle/chunks/next-QKW7PTKE.js +32 -0
- package/dist/cli-bundle/chunks/next-QKW7PTKE.js.map +1 -0
- package/dist/cli-bundle/chunks/notes-R5FZTKWF.js +17 -0
- package/dist/cli-bundle/chunks/notes-R5FZTKWF.js.map +7 -0
- package/dist/cli-bundle/chunks/notes-WCGIULVG.js +21 -0
- package/dist/cli-bundle/chunks/notes-WCGIULVG.js.map +1 -0
- package/dist/cli-bundle/chunks/plan-ADISFYH4.js +29 -0
- package/dist/cli-bundle/chunks/plan-ADISFYH4.js.map +7 -0
- package/dist/cli-bundle/chunks/plan-CHVE7PBR.js +33 -0
- package/dist/cli-bundle/chunks/plan-CHVE7PBR.js.map +1 -0
- package/dist/cli-bundle/chunks/profile-LD23PSI6.js +37 -0
- package/dist/cli-bundle/chunks/profile-LD23PSI6.js.map +7 -0
- package/dist/cli-bundle/chunks/profile-ZXGSKBJD.js +41 -0
- package/dist/cli-bundle/chunks/profile-ZXGSKBJD.js.map +1 -0
- package/dist/cli-bundle/chunks/register-list-query-B42JCCOI.js +409 -0
- package/dist/cli-bundle/chunks/register-list-query-OEYQHFXO.js +419 -0
- package/dist/cli-bundle/chunks/register-mutation-3QXIHCQG.js +1273 -0
- package/dist/cli-bundle/chunks/register-mutation-IAEST26S.js +1256 -0
- package/dist/cli-bundle/chunks/register-operations-I3M3U7DS.js +19 -0
- package/dist/cli-bundle/chunks/register-operations-I3M3U7DS.js.map +7 -0
- package/dist/cli-bundle/chunks/register-operations-UHKENLZV.js +23 -0
- package/dist/cli-bundle/chunks/register-operations-UHKENLZV.js.map +1 -0
- package/dist/cli-bundle/chunks/register-setup-3ZVVX2VN.js +324 -0
- package/dist/cli-bundle/chunks/register-setup-3ZVVX2VN.js.map +7 -0
- package/dist/cli-bundle/chunks/register-setup-Q6KFNIOZ.js +321 -0
- package/dist/cli-bundle/chunks/register-setup-Q6KFNIOZ.js.map +1 -0
- package/dist/cli-bundle/chunks/restore-5RQHAPMA.js +23 -0
- package/dist/cli-bundle/chunks/restore-5RQHAPMA.js.map +1 -0
- package/dist/cli-bundle/chunks/restore-PNEIBBLW.js +19 -0
- package/dist/cli-bundle/chunks/restore-PNEIBBLW.js.map +7 -0
- package/dist/cli-bundle/chunks/scheduling-shortcuts-4G56YHVQ.js +29 -0
- package/dist/cli-bundle/chunks/scheduling-shortcuts-4G56YHVQ.js.map +1 -0
- package/dist/cli-bundle/chunks/scheduling-shortcuts-75DULBYP.js +25 -0
- package/dist/cli-bundle/chunks/scheduling-shortcuts-75DULBYP.js.map +7 -0
- package/dist/cli-bundle/chunks/schema-245WW4G2.js +78 -0
- package/dist/cli-bundle/chunks/schema-245WW4G2.js.map +1 -0
- package/dist/cli-bundle/chunks/schema-HBORFC6B.js +74 -0
- package/dist/cli-bundle/chunks/schema-HBORFC6B.js.map +7 -0
- package/dist/cli-bundle/chunks/search-AOZC5SIK.js +34 -0
- package/dist/cli-bundle/chunks/search-AOZC5SIK.js.map +7 -0
- package/dist/cli-bundle/chunks/search-DRXPGHD7.js +38 -0
- package/dist/cli-bundle/chunks/search-DRXPGHD7.js.map +1 -0
- package/dist/cli-bundle/chunks/stats-NJG4NLHG.js +21 -0
- package/dist/cli-bundle/chunks/stats-NJG4NLHG.js.map +1 -0
- package/dist/cli-bundle/chunks/stats-RG6AG4N2.js +17 -0
- package/dist/cli-bundle/chunks/stats-RG6AG4N2.js.map +7 -0
- package/dist/cli-bundle/chunks/telemetry-HQC2JJIF.js +14 -0
- package/dist/cli-bundle/chunks/telemetry-HQC2JJIF.js.map +7 -0
- package/dist/cli-bundle/chunks/telemetry-MPNL3HHY.js +18 -0
- package/dist/cli-bundle/chunks/telemetry-MPNL3HHY.js.map +1 -0
- package/dist/cli-bundle/chunks/test-6CMOCWUC.js +39 -0
- package/dist/cli-bundle/chunks/test-6CMOCWUC.js.map +7 -0
- package/dist/cli-bundle/chunks/test-RI7XHBZL.js +43 -0
- package/dist/cli-bundle/chunks/test-RI7XHBZL.js.map +1 -0
- package/dist/cli-bundle/chunks/test-all-7R7YRZIA.js +29 -0
- package/dist/cli-bundle/chunks/test-all-7R7YRZIA.js.map +7 -0
- package/dist/cli-bundle/chunks/test-all-QEIORFYW.js +33 -0
- package/dist/cli-bundle/chunks/test-all-QEIORFYW.js.map +1 -0
- package/dist/cli-bundle/chunks/test-runs-5Y2BOU2S.js +28 -0
- package/dist/cli-bundle/chunks/test-runs-5Y2BOU2S.js.map +1 -0
- package/dist/cli-bundle/chunks/test-runs-PVGC3GRZ.js +24 -0
- package/dist/cli-bundle/chunks/test-runs-PVGC3GRZ.js.map +7 -0
- package/dist/cli-bundle/chunks/update-QVJDFEAP.js +30 -0
- package/dist/cli-bundle/chunks/update-QVJDFEAP.js.map +1 -0
- package/dist/cli-bundle/chunks/update-VQVHAY6X.js +26 -0
- package/dist/cli-bundle/chunks/update-VQVHAY6X.js.map +7 -0
- package/dist/cli-bundle/chunks/update-many-S7XWBSB3.js +37 -0
- package/dist/cli-bundle/chunks/update-many-S7XWBSB3.js.map +7 -0
- package/dist/cli-bundle/chunks/update-many-YIYW6XQ6.js +41 -0
- package/dist/cli-bundle/chunks/update-many-YIYW6XQ6.js.map +1 -0
- package/dist/cli-bundle/chunks/upgrade-OPRXA56R.js +24 -0
- package/dist/cli-bundle/chunks/upgrade-OPRXA56R.js.map +7 -0
- package/dist/cli-bundle/chunks/upgrade-WH4BTQLX.js +28 -0
- package/dist/cli-bundle/chunks/upgrade-WH4BTQLX.js.map +1 -0
- package/dist/cli-bundle/chunks/validate-4NTXSB62.js +36 -0
- package/dist/cli-bundle/chunks/validate-4NTXSB62.js.map +1 -0
- package/dist/cli-bundle/chunks/validate-MUFXQZMI.js +32 -0
- package/dist/cli-bundle/chunks/validate-MUFXQZMI.js.map +7 -0
- package/dist/cli-bundle/main.js +16 -16
- package/dist/cli-bundle/sdk-runtime.js +88 -28
- package/dist/cli-bundle/sdk-testing.js +6 -6
- package/dist/cli-bundle/sdk.js +92 -49
- package/dist/cli-bundle/sdk.js.map +2 -2
- package/dist/mcp/server.d.ts +22 -50
- package/dist/mcp/server.js +62 -916
- package/dist/mcp/server.js.map +1 -1
- package/dist/sdk/index.d.ts +4 -2
- package/dist/sdk/index.js +4 -4
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/runtime.d.ts +168 -4
- package/dist/sdk/runtime.js +1149 -25
- package/dist/sdk/runtime.js.map +1 -1
- package/dist/sdk/workspace-contracts-cache.d.ts +17 -0
- package/dist/sdk/workspace-contracts-cache.js +36 -0
- package/dist/sdk/workspace-contracts-cache.js.map +1 -0
- package/docs/RELEASING.md +3 -1
- package/docs/SDK.md +46 -0
- package/docs/examples/sdk-app-embedding/run-embedded-pm.mjs +16 -2
- package/docs/examples/sdk-contract-consumer/inspect-contracts.mjs +16 -1
- package/package.json +1 -1
- package/dist/cli-bundle/chunks/activity-4XQIDNM5.js +0 -18
- package/dist/cli-bundle/chunks/activity-YKAKZTZ4.js +0 -22
- package/dist/cli-bundle/chunks/aggregate-EQX2RGB7.js +0 -375
- package/dist/cli-bundle/chunks/aggregate-EQX2RGB7.js.map +0 -7
- package/dist/cli-bundle/chunks/aggregate-PEGZGJXD.js +0 -372
- package/dist/cli-bundle/chunks/aggregate-PEGZGJXD.js.map +0 -1
- package/dist/cli-bundle/chunks/append-CZGUZ45Q.js +0 -73
- package/dist/cli-bundle/chunks/append-CZGUZ45Q.js.map +0 -7
- package/dist/cli-bundle/chunks/append-NSQBCXZJ.js +0 -70
- package/dist/cli-bundle/chunks/append-NSQBCXZJ.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-3JZNEQBA.js +0 -1413
- package/dist/cli-bundle/chunks/chunk-3PL6LEKP.js +0 -1961
- package/dist/cli-bundle/chunks/chunk-3U3VEWK6.js +0 -1749
- package/dist/cli-bundle/chunks/chunk-3Y4OESPP.js +0 -277
- package/dist/cli-bundle/chunks/chunk-4LRVSBO6.js +0 -822
- package/dist/cli-bundle/chunks/chunk-4OFLJHX6.js +0 -356
- package/dist/cli-bundle/chunks/chunk-4QQ6PM7M.js +0 -1249
- package/dist/cli-bundle/chunks/chunk-53BTLLAF.js +0 -2181
- package/dist/cli-bundle/chunks/chunk-53BTLLAF.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-57C2RLW5.js +0 -1704
- package/dist/cli-bundle/chunks/chunk-5B3X4Y22.js +0 -2330
- package/dist/cli-bundle/chunks/chunk-5J2XPTAD.js +0 -225
- package/dist/cli-bundle/chunks/chunk-5JE6SMYS.js +0 -262
- package/dist/cli-bundle/chunks/chunk-5JZ7APJU.js +0 -995
- package/dist/cli-bundle/chunks/chunk-5VVUKE3U.js +0 -5789
- package/dist/cli-bundle/chunks/chunk-5VVUKE3U.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-75U6M5ZD.js +0 -819
- package/dist/cli-bundle/chunks/chunk-7EQNAZX2.js +0 -1018
- package/dist/cli-bundle/chunks/chunk-7MDXZAZS.js +0 -102
- package/dist/cli-bundle/chunks/chunk-7QH7DHUB.js +0 -2046
- package/dist/cli-bundle/chunks/chunk-7WYXBPYQ.js +0 -358
- package/dist/cli-bundle/chunks/chunk-AAEQMOC6.js +0 -150
- package/dist/cli-bundle/chunks/chunk-ABRA3BHY.js +0 -429
- package/dist/cli-bundle/chunks/chunk-BFVHCAOO.js +0 -240
- package/dist/cli-bundle/chunks/chunk-BVEUCSH2.js +0 -530
- package/dist/cli-bundle/chunks/chunk-C3PMDWGX.js +0 -160
- package/dist/cli-bundle/chunks/chunk-D3UCE7RW.js +0 -243
- package/dist/cli-bundle/chunks/chunk-DC3QJQWI.js +0 -275
- package/dist/cli-bundle/chunks/chunk-DC3QJQWI.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-DLQ4ZTCU.js +0 -634
- package/dist/cli-bundle/chunks/chunk-DRBV5UC2.js +0 -231
- package/dist/cli-bundle/chunks/chunk-E2FUG6GD.js +0 -2184
- package/dist/cli-bundle/chunks/chunk-E2FUG6GD.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-EEY54JMF.js +0 -60
- package/dist/cli-bundle/chunks/chunk-EZFKWSC7.js +0 -1615
- package/dist/cli-bundle/chunks/chunk-FDBARR33.js +0 -655
- package/dist/cli-bundle/chunks/chunk-FGQKEDE4.js +0 -447
- package/dist/cli-bundle/chunks/chunk-FJRKQREY.js +0 -228
- package/dist/cli-bundle/chunks/chunk-FUM6UMY4.js +0 -804
- package/dist/cli-bundle/chunks/chunk-GIWXVMZ3.js +0 -3237
- package/dist/cli-bundle/chunks/chunk-GIWXVMZ3.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-HBYZDSK5.js +0 -426
- package/dist/cli-bundle/chunks/chunk-HJE4JTKQ.js +0 -124
- package/dist/cli-bundle/chunks/chunk-HK72NWAD.js +0 -1570
- package/dist/cli-bundle/chunks/chunk-IJ6CO3JV.js +0 -645
- package/dist/cli-bundle/chunks/chunk-JFCVQXZX.js +0 -3206
- package/dist/cli-bundle/chunks/chunk-JFCVQXZX.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-JLA7EVYV.js +0 -222
- package/dist/cli-bundle/chunks/chunk-K32L7HZO.js +0 -76
- package/dist/cli-bundle/chunks/chunk-K32L7HZO.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-K3AGVXSF.js +0 -444
- package/dist/cli-bundle/chunks/chunk-KDZ6K25I.js +0 -79
- package/dist/cli-bundle/chunks/chunk-KDZ6K25I.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-KL22PY6L.js +0 -915
- package/dist/cli-bundle/chunks/chunk-KL22PY6L.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-KLG4ZULO.js +0 -218
- package/dist/cli-bundle/chunks/chunk-LEKT4K7I.js +0 -2105
- package/dist/cli-bundle/chunks/chunk-MNZ7DRNC.js +0 -1858
- package/dist/cli-bundle/chunks/chunk-MTTXDAK4.js +0 -2198
- package/dist/cli-bundle/chunks/chunk-MZ7VNEVY.js +0 -520
- package/dist/cli-bundle/chunks/chunk-N6DNM2FA.js +0 -116
- package/dist/cli-bundle/chunks/chunk-N7X4WP6L.js +0 -1041
- package/dist/cli-bundle/chunks/chunk-NBFCNJ7Q.js +0 -2132
- package/dist/cli-bundle/chunks/chunk-NER3KUUS.js +0 -260
- package/dist/cli-bundle/chunks/chunk-OBA2WH65.js +0 -918
- package/dist/cli-bundle/chunks/chunk-OBA2WH65.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-OESSOFJ4.js +0 -1985
- package/dist/cli-bundle/chunks/chunk-OK5NXCZB.js +0 -238
- package/dist/cli-bundle/chunks/chunk-OK5NXCZB.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-OWTIRHX4.js +0 -112
- package/dist/cli-bundle/chunks/chunk-P3VRG72Q.js +0 -1765
- package/dist/cli-bundle/chunks/chunk-P5TFTLWW.js +0 -1423
- package/dist/cli-bundle/chunks/chunk-P5YORJRH.js +0 -1977
- package/dist/cli-bundle/chunks/chunk-PDXT6Q55.js +0 -58
- package/dist/cli-bundle/chunks/chunk-PJ3A56YF.js +0 -1239
- package/dist/cli-bundle/chunks/chunk-PPAJG4GB.js +0 -1031
- package/dist/cli-bundle/chunks/chunk-PPE4YUQM.js +0 -4725
- package/dist/cli-bundle/chunks/chunk-PPE4YUQM.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-QHZO65XW.js +0 -1775
- package/dist/cli-bundle/chunks/chunk-R3ZBLGTC.js +0 -814
- package/dist/cli-bundle/chunks/chunk-RCT3YJOK.js +0 -624
- package/dist/cli-bundle/chunks/chunk-RX3HQSYG.js +0 -265
- package/dist/cli-bundle/chunks/chunk-S4APD35C.js +0 -210
- package/dist/cli-bundle/chunks/chunk-S5AYOUT5.js +0 -130
- package/dist/cli-bundle/chunks/chunk-STPSZ2XY.js +0 -1149
- package/dist/cli-bundle/chunks/chunk-STPSZ2XY.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-T35XLYZF.js +0 -263
- package/dist/cli-bundle/chunks/chunk-T3ABIMGW.js +0 -361
- package/dist/cli-bundle/chunks/chunk-T3F4DF23.js +0 -267
- package/dist/cli-bundle/chunks/chunk-T4MX77AK.js +0 -272
- package/dist/cli-bundle/chunks/chunk-T4MX77AK.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-T5Y3QSNF.js +0 -5354
- package/dist/cli-bundle/chunks/chunk-T5Y3QSNF.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-TSPKZRRW.js +0 -1570
- package/dist/cli-bundle/chunks/chunk-TT42JUMF.js +0 -207
- package/dist/cli-bundle/chunks/chunk-UHKX7I75.js +0 -165
- package/dist/cli-bundle/chunks/chunk-UHKX7I75.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-UI5BJ6DO.js +0 -4786
- package/dist/cli-bundle/chunks/chunk-UI5BJ6DO.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-US3T3W5J.js +0 -1932
- package/dist/cli-bundle/chunks/chunk-UZRDBL6W.js +0 -175
- package/dist/cli-bundle/chunks/chunk-UZRDBL6W.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-VZIYHZDX.js +0 -1868
- package/dist/cli-bundle/chunks/chunk-WISPVC2E.js +0 -401
- package/dist/cli-bundle/chunks/chunk-WVSGSZ6J.js +0 -5434
- package/dist/cli-bundle/chunks/chunk-WVSGSZ6J.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-XQCG2JGW.js +0 -1152
- package/dist/cli-bundle/chunks/chunk-XQCG2JGW.js.map +0 -7
- package/dist/cli-bundle/chunks/chunk-Y76TWC45.js +0 -550
- package/dist/cli-bundle/chunks/chunk-YD5FML7K.js +0 -5630
- package/dist/cli-bundle/chunks/chunk-YD5FML7K.js.map +0 -1
- package/dist/cli-bundle/chunks/chunk-YFIE7YK6.js +0 -57
- package/dist/cli-bundle/chunks/chunk-YMABYTNG.js +0 -1573
- package/dist/cli-bundle/chunks/chunk-YOF5VPKM.js +0 -119
- package/dist/cli-bundle/chunks/chunk-YPPVU5GX.js +0 -398
- package/dist/cli-bundle/chunks/chunk-YQMMMONE.js +0 -133
- package/dist/cli-bundle/chunks/chunk-YSAH5FY5.js +0 -1001
- package/dist/cli-bundle/chunks/chunk-YZIR4R3U.js +0 -1005
- package/dist/cli-bundle/chunks/chunk-Z2CRRZYF.js +0 -215
- package/dist/cli-bundle/chunks/chunk-ZAHXPXVY.js +0 -533
- package/dist/cli-bundle/chunks/chunk-ZCJAA3JK.js +0 -121
- package/dist/cli-bundle/chunks/chunk-ZD34OFFQ.js +0 -366
- package/dist/cli-bundle/chunks/chunk-ZJB3UV5U.js +0 -2306
- package/dist/cli-bundle/chunks/chunk-ZMD35NYG.js +0 -61
- package/dist/cli-bundle/chunks/chunk-ZVDL32GJ.js +0 -241
- package/dist/cli-bundle/chunks/chunk-ZVDL32GJ.js.map +0 -7
- package/dist/cli-bundle/chunks/claim-4DROPSIS.js +0 -144
- package/dist/cli-bundle/chunks/claim-4DROPSIS.js.map +0 -1
- package/dist/cli-bundle/chunks/claim-VX54TV5U.js +0 -147
- package/dist/cli-bundle/chunks/claim-VX54TV5U.js.map +0 -7
- package/dist/cli-bundle/chunks/close-3YRR3XY6.js +0 -20
- package/dist/cli-bundle/chunks/close-OB2Y4QP5.js +0 -16
- package/dist/cli-bundle/chunks/close-many-AP4MWU36.js +0 -397
- package/dist/cli-bundle/chunks/close-many-AP4MWU36.js.map +0 -1
- package/dist/cli-bundle/chunks/close-many-OMZIGZB4.js +0 -400
- package/dist/cli-bundle/chunks/close-many-OMZIGZB4.js.map +0 -7
- package/dist/cli-bundle/chunks/comments-MIW5MZOX.js +0 -128
- package/dist/cli-bundle/chunks/comments-MIW5MZOX.js.map +0 -7
- package/dist/cli-bundle/chunks/comments-SAG5LSKL.js +0 -125
- package/dist/cli-bundle/chunks/comments-SAG5LSKL.js.map +0 -1
- package/dist/cli-bundle/chunks/config-DJJKZB5R.js +0 -1075
- package/dist/cli-bundle/chunks/config-DJJKZB5R.js.map +0 -7
- package/dist/cli-bundle/chunks/config-V57QD47V.js +0 -1065
- package/dist/cli-bundle/chunks/config-V57QD47V.js.map +0 -1
- package/dist/cli-bundle/chunks/context-4OQGIPSO.js +0 -45
- package/dist/cli-bundle/chunks/context-WLA6IAWE.js +0 -49
- package/dist/cli-bundle/chunks/contracts-HXJLKCRI.js +0 -12
- package/dist/cli-bundle/chunks/contracts-OJEXMKVW.js +0 -16
- package/dist/cli-bundle/chunks/copy-LEE6P6EM.js +0 -184
- package/dist/cli-bundle/chunks/copy-LEE6P6EM.js.map +0 -7
- package/dist/cli-bundle/chunks/copy-OTJOWFL6.js +0 -181
- package/dist/cli-bundle/chunks/copy-OTJOWFL6.js.map +0 -1
- package/dist/cli-bundle/chunks/create-WKOZKPQR.js +0 -30
- package/dist/cli-bundle/chunks/create-XWWQFQ6S.js +0 -34
- package/dist/cli-bundle/chunks/delete-62JQTYT4.js +0 -59
- package/dist/cli-bundle/chunks/delete-62JQTYT4.js.map +0 -7
- package/dist/cli-bundle/chunks/delete-HQKGRNRZ.js +0 -56
- package/dist/cli-bundle/chunks/delete-HQKGRNRZ.js.map +0 -1
- package/dist/cli-bundle/chunks/deps-55FTG6Z5.js +0 -224
- package/dist/cli-bundle/chunks/deps-55FTG6Z5.js.map +0 -1
- package/dist/cli-bundle/chunks/deps-L2FPIAD3.js +0 -227
- package/dist/cli-bundle/chunks/deps-L2FPIAD3.js.map +0 -7
- package/dist/cli-bundle/chunks/docs-6CRCSVKK.js +0 -33
- package/dist/cli-bundle/chunks/docs-6CRCSVKK.js.map +0 -1
- package/dist/cli-bundle/chunks/docs-S6UTOTO5.js +0 -36
- package/dist/cli-bundle/chunks/docs-S6UTOTO5.js.map +0 -7
- package/dist/cli-bundle/chunks/eval-N6UHFWVO.js +0 -288
- package/dist/cli-bundle/chunks/eval-N6UHFWVO.js.map +0 -7
- package/dist/cli-bundle/chunks/eval-PHOTWYHI.js +0 -278
- package/dist/cli-bundle/chunks/eval-PHOTWYHI.js.map +0 -1
- package/dist/cli-bundle/chunks/extension-NBAH62ML.js +0 -40
- package/dist/cli-bundle/chunks/extension-ZF6ZZPOU.js +0 -44
- package/dist/cli-bundle/chunks/files-6P57MRKL.js +0 -301
- package/dist/cli-bundle/chunks/files-6P57MRKL.js.map +0 -7
- package/dist/cli-bundle/chunks/files-JPU3FNJ7.js +0 -298
- package/dist/cli-bundle/chunks/files-JPU3FNJ7.js.map +0 -1
- package/dist/cli-bundle/chunks/focus-LFZ6IDBR.js +0 -106
- package/dist/cli-bundle/chunks/focus-LFZ6IDBR.js.map +0 -1
- package/dist/cli-bundle/chunks/focus-WNMYCVYA.js +0 -109
- package/dist/cli-bundle/chunks/focus-WNMYCVYA.js.map +0 -7
- package/dist/cli-bundle/chunks/gc-AETFKZ44.js +0 -398
- package/dist/cli-bundle/chunks/gc-AETFKZ44.js.map +0 -7
- package/dist/cli-bundle/chunks/gc-RLBP4QVN.js +0 -388
- package/dist/cli-bundle/chunks/gc-RLBP4QVN.js.map +0 -1
- package/dist/cli-bundle/chunks/get-NH2MPBCI.js +0 -283
- package/dist/cli-bundle/chunks/get-NH2MPBCI.js.map +0 -1
- package/dist/cli-bundle/chunks/get-P4ZQXCPZ.js +0 -286
- package/dist/cli-bundle/chunks/get-P4ZQXCPZ.js.map +0 -7
- package/dist/cli-bundle/chunks/health-3GVPMQBL.js +0 -1612
- package/dist/cli-bundle/chunks/health-3GVPMQBL.js.map +0 -1
- package/dist/cli-bundle/chunks/health-DNTM72GJ.js +0 -1615
- package/dist/cli-bundle/chunks/health-DNTM72GJ.js.map +0 -7
- package/dist/cli-bundle/chunks/history-RYKLC72X.js +0 -20
- package/dist/cli-bundle/chunks/history-SGPYRAFT.js +0 -24
- package/dist/cli-bundle/chunks/history-compact-3F6VELO7.js +0 -565
- package/dist/cli-bundle/chunks/history-compact-3F6VELO7.js.map +0 -7
- package/dist/cli-bundle/chunks/history-compact-656Y2TN4.js +0 -555
- package/dist/cli-bundle/chunks/history-compact-656Y2TN4.js.map +0 -1
- package/dist/cli-bundle/chunks/history-redact-4H3FCKF3.js +0 -21
- package/dist/cli-bundle/chunks/history-redact-54ICFKXM.js +0 -25
- package/dist/cli-bundle/chunks/history-repair-4N6SDVHK.js +0 -281
- package/dist/cli-bundle/chunks/history-repair-4N6SDVHK.js.map +0 -7
- package/dist/cli-bundle/chunks/history-repair-EVTO6LIH.js +0 -278
- package/dist/cli-bundle/chunks/history-repair-EVTO6LIH.js.map +0 -1
- package/dist/cli-bundle/chunks/init-RPIPQUNV.js +0 -32
- package/dist/cli-bundle/chunks/init-SKQAESQS.js +0 -28
- package/dist/cli-bundle/chunks/learnings-2HTPZNGZ.js +0 -48
- package/dist/cli-bundle/chunks/learnings-2HTPZNGZ.js.map +0 -7
- package/dist/cli-bundle/chunks/learnings-YBIHY3D6.js +0 -45
- package/dist/cli-bundle/chunks/learnings-YBIHY3D6.js.map +0 -1
- package/dist/cli-bundle/chunks/list-64LHZ3HM.js +0 -32
- package/dist/cli-bundle/chunks/list-7LXBTEKI.js +0 -36
- package/dist/cli-bundle/chunks/next-7ODPAQ4U.js +0 -306
- package/dist/cli-bundle/chunks/next-7ODPAQ4U.js.map +0 -7
- package/dist/cli-bundle/chunks/next-ODJUM4ZM.js +0 -303
- package/dist/cli-bundle/chunks/next-ODJUM4ZM.js.map +0 -1
- package/dist/cli-bundle/chunks/notes-72YXN5JX.js +0 -48
- package/dist/cli-bundle/chunks/notes-72YXN5JX.js.map +0 -7
- package/dist/cli-bundle/chunks/notes-NJ7IQJX4.js +0 -45
- package/dist/cli-bundle/chunks/notes-NJ7IQJX4.js.map +0 -1
- package/dist/cli-bundle/chunks/plan-R4NDQ27E.js +0 -1366
- package/dist/cli-bundle/chunks/plan-R4NDQ27E.js.map +0 -7
- package/dist/cli-bundle/chunks/plan-XWY5T67S.js +0 -1363
- package/dist/cli-bundle/chunks/plan-XWY5T67S.js.map +0 -1
- package/dist/cli-bundle/chunks/profile-XQWEQKS3.js +0 -397
- package/dist/cli-bundle/chunks/profile-XQWEQKS3.js.map +0 -1
- package/dist/cli-bundle/chunks/profile-YRDHLMRO.js +0 -400
- package/dist/cli-bundle/chunks/profile-YRDHLMRO.js.map +0 -7
- package/dist/cli-bundle/chunks/register-list-query-5H66WFYF.js +0 -419
- package/dist/cli-bundle/chunks/register-list-query-FB3FNDLZ.js +0 -409
- package/dist/cli-bundle/chunks/register-mutation-UJO23C7R.js +0 -1256
- package/dist/cli-bundle/chunks/register-mutation-Z2ETYHKS.js +0 -1273
- package/dist/cli-bundle/chunks/register-operations-A3XAM5J7.js +0 -513
- package/dist/cli-bundle/chunks/register-operations-A3XAM5J7.js.map +0 -1
- package/dist/cli-bundle/chunks/register-operations-SG7HBSUP.js +0 -516
- package/dist/cli-bundle/chunks/register-operations-SG7HBSUP.js.map +0 -7
- package/dist/cli-bundle/chunks/register-setup-I45OGJUV.js +0 -323
- package/dist/cli-bundle/chunks/register-setup-I45OGJUV.js.map +0 -1
- package/dist/cli-bundle/chunks/register-setup-K6U3NVY5.js +0 -326
- package/dist/cli-bundle/chunks/register-setup-K6U3NVY5.js.map +0 -7
- package/dist/cli-bundle/chunks/restore-PXOFL6AM.js +0 -19
- package/dist/cli-bundle/chunks/restore-YJ2ET6AT.js +0 -23
- package/dist/cli-bundle/chunks/scheduling-shortcuts-SSC4MYWQ.js +0 -91
- package/dist/cli-bundle/chunks/scheduling-shortcuts-SSC4MYWQ.js.map +0 -7
- package/dist/cli-bundle/chunks/scheduling-shortcuts-ULRG7MNP.js +0 -88
- package/dist/cli-bundle/chunks/scheduling-shortcuts-ULRG7MNP.js.map +0 -1
- package/dist/cli-bundle/chunks/schema-2PUXCZ25.js +0 -74
- package/dist/cli-bundle/chunks/schema-Y6DXXK2F.js +0 -78
- package/dist/cli-bundle/chunks/search-3S72CTD6.js +0 -38
- package/dist/cli-bundle/chunks/search-WNUNBQXO.js +0 -34
- package/dist/cli-bundle/chunks/stats-IJYTRQGV.js +0 -250
- package/dist/cli-bundle/chunks/stats-IJYTRQGV.js.map +0 -7
- package/dist/cli-bundle/chunks/stats-L2D5Y2O5.js +0 -240
- package/dist/cli-bundle/chunks/stats-L2D5Y2O5.js.map +0 -1
- package/dist/cli-bundle/chunks/telemetry-L2CVOKVN.js +0 -309
- package/dist/cli-bundle/chunks/telemetry-L2CVOKVN.js.map +0 -7
- package/dist/cli-bundle/chunks/telemetry-QBYWQA76.js +0 -306
- package/dist/cli-bundle/chunks/telemetry-QBYWQA76.js.map +0 -1
- package/dist/cli-bundle/chunks/test-DQ2QFJ7W.js +0 -45
- package/dist/cli-bundle/chunks/test-W7QBLVJS.js +0 -41
- package/dist/cli-bundle/chunks/test-all-636NTRTT.js +0 -434
- package/dist/cli-bundle/chunks/test-all-636NTRTT.js.map +0 -1
- package/dist/cli-bundle/chunks/test-all-DWYK3RG6.js +0 -437
- package/dist/cli-bundle/chunks/test-all-DWYK3RG6.js.map +0 -7
- package/dist/cli-bundle/chunks/test-runs-245OINZR.js +0 -28
- package/dist/cli-bundle/chunks/test-runs-ZRD4GCTT.js +0 -24
- package/dist/cli-bundle/chunks/update-SFLZPJXX.js +0 -30
- package/dist/cli-bundle/chunks/update-SJZ6S77U.js +0 -26
- package/dist/cli-bundle/chunks/update-many-DC7X3EWM.js +0 -671
- package/dist/cli-bundle/chunks/update-many-DC7X3EWM.js.map +0 -7
- package/dist/cli-bundle/chunks/update-many-SLLAMHT7.js +0 -668
- package/dist/cli-bundle/chunks/update-many-SLLAMHT7.js.map +0 -1
- package/dist/cli-bundle/chunks/upgrade-HFFXLZJA.js +0 -290
- package/dist/cli-bundle/chunks/upgrade-HFFXLZJA.js.map +0 -7
- package/dist/cli-bundle/chunks/upgrade-UYQKM7RF.js +0 -287
- package/dist/cli-bundle/chunks/upgrade-UYQKM7RF.js.map +0 -1
- package/dist/cli-bundle/chunks/validate-PA4FDTOV.js +0 -2143
- package/dist/cli-bundle/chunks/validate-PA4FDTOV.js.map +0 -7
- package/dist/cli-bundle/chunks/validate-Z7L75YEJ.js +0 -2105
- package/dist/cli-bundle/chunks/validate-Z7L75YEJ.js.map +0 -1
- /package/dist/cli-bundle/chunks/{activity-4XQIDNM5.js.map → activity-WJCGCYPU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{activity-YKAKZTZ4.js.map → activity-Z6QUAUSG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-3YRR3XY6.js.map → aggregate-BDM6EIAR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{close-OB2Y4QP5.js.map → aggregate-VQ2DHU3S.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{context-WLA6IAWE.js.map → append-BGML6VLD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{context-4OQGIPSO.js.map → append-RKJYPU74.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YFIE7YK6.js.map → chunk-22KBU3MW.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DLQ4ZTCU.js.map → chunk-24YG75HI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-KLG4ZULO.js.map → chunk-2XG4IZON.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FJRKQREY.js.map → chunk-3GCS5SKL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5B3X4Y22.js.map → chunk-3KTN6IBA.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YMABYTNG.js.map → chunk-3UJRFJ5R.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YSAH5FY5.js.map → chunk-3VHSI5FL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7EQNAZX2.js.map → chunk-46CUF5L6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-75U6M5ZD.js.map → chunk-4IWYTWGF.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-VZIYHZDX.js.map → chunk-5GZ7TDD6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3U3VEWK6.js.map → chunk-5VAA4YHR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3PL6LEKP.js.map → chunk-64YKRTSV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ABRA3BHY.js.map → chunk-6LLVNJXT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-EEY54JMF.js.map → chunk-7DT4WSH2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7MDXZAZS.js.map → chunk-7WBAJSS6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-AAEQMOC6.js.map → chunk-AGHMOTGM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OWTIRHX4.js.map → chunk-ALFPSEWO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-T3ABIMGW.js.map → chunk-AZYGZGGI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3JZNEQBA.js.map → chunk-B6DUFX6H.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-OESSOFJ4.js.map → chunk-C5JBZRPU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YPPVU5GX.js.map → chunk-CFB33L7W.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5J2XPTAD.js.map → chunk-CL36D4PC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-IJ6CO3JV.js.map → chunk-D2XRLB55.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MNZ7DRNC.js.map → chunk-DEWEK6AN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-US3T3W5J.js.map → chunk-E3SZTQ4K.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-C3PMDWGX.js.map → chunk-EGY6JBQ3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-JLA7EVYV.js.map → chunk-EKFNL33R.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-57C2RLW5.js.map → chunk-ENGQOEUY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7QH7DHUB.js.map → chunk-EOKXK3R3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZCJAA3JK.js.map → chunk-F3K4JGFD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-DRBV5UC2.js.map → chunk-FLZSGSQR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Y76TWC45.js.map → chunk-FT3QTERD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HK72NWAD.js.map → chunk-G24G7ZAV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-K3AGVXSF.js.map → chunk-G64OCSKU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-QHZO65XW.js.map → chunk-GANUTS7W.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-WISPVC2E.js.map → chunk-GBAX2ZAQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RCT3YJOK.js.map → chunk-GJ7QC5DJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-BVEUCSH2.js.map → chunk-GPLPTGOV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YZIR4R3U.js.map → chunk-GZRDYONU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-7WYXBPYQ.js.map → chunk-IWVU4C2F.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-T3F4DF23.js.map → chunk-IX5BXEMX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-RX3HQSYG.js.map → chunk-JDDLOQAE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YOF5VPKM.js.map → chunk-JJP45OEI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TT42JUMF.js.map → chunk-K46RF36U.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-R3ZBLGTC.js.map → chunk-KGFUY7WN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-NER3KUUS.js.map → chunk-KUOOJR35.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-3Y4OESPP.js.map → chunk-L5PSPMZ4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-PJ3A56YF.js.map → chunk-LPSSSDJR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FDBARR33.js.map → chunk-MA4SM3QZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-PPAJG4GB.js.map → chunk-MFAZSEM5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5JZ7APJU.js.map → chunk-MFSCBT5Q.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4OFLJHX6.js.map → chunk-MLIYFOE7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZMD35NYG.js.map → chunk-MUH7A3FD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-5JE6SMYS.js.map → chunk-MVYWGY2A.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-P5TFTLWW.js.map → chunk-MWMVPCIE.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-T35XLYZF.js.map → chunk-NGXQ3PFT.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-EZFKWSC7.js.map → chunk-NMP5I3I5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HJE4JTKQ.js.map → chunk-O6AWCQRQ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-BFVHCAOO.js.map → chunk-OGWQ2IEP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-S4APD35C.js.map → chunk-QLMX7SRD.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MZ7VNEVY.js.map → chunk-RFNYTESG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-MTTXDAK4.js.map → chunk-SCUR7K7N.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-P5YORJRH.js.map → chunk-SHQY2IDC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-S5AYOUT5.js.map → chunk-SMB7RV23.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-N7X4WP6L.js.map → chunk-SPZ6DOGY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-P3VRG72Q.js.map → chunk-SQYJ4HF2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4LRVSBO6.js.map → chunk-T42JWV3F.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-NBFCNJ7Q.js.map → chunk-TULGS6X6.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZJB3UV5U.js.map → chunk-TZXRBVAM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZD34OFFQ.js.map → chunk-VPIM42PC.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FGQKEDE4.js.map → chunk-W3DSJQIO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-4QQ6PM7M.js.map → chunk-W572BIEB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-Z2CRRZYF.js.map → chunk-WRTENIX3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-ZAHXPXVY.js.map → chunk-XB7KFVFI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-PDXT6Q55.js.map → chunk-XG625QP4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-D3UCE7RW.js.map → chunk-XUC7PI2H.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-N6DNM2FA.js.map → chunk-Y46GD4IX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-FUM6UMY4.js.map → chunk-Y4M7CPQP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-HBYZDSK5.js.map → chunk-YN7Y6DQZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-YQMMMONE.js.map → chunk-ZGK4L4JM.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-LEKT4K7I.js.map → chunk-ZSUS2OD3.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{chunk-TSPKZRRW.js.map → chunk-ZZD4J5XY.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{contracts-HXJLKCRI.js.map → claim-RFS7BROJ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{contracts-OJEXMKVW.js.map → claim-XP5AWZ5H.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-XWWQFQ6S.js.map → close-2SSSHHUZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{create-WKOZKPQR.js.map → close-GEANHQ2J.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-ZF6ZZPOU.js.map → close-many-CMZW7ITN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{extension-NBAH62ML.js.map → close-many-ZFDIG6M7.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-SGPYRAFT.js.map → comments-MFSYVNNU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-RYKLC72X.js.map → comments-XUBPXDYX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-4H3FCKF3.js.map → config-D7XQMONX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{history-redact-54ICFKXM.js.map → config-T4FHBSYN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-RPIPQUNV.js.map → context-DIU275XI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{init-SKQAESQS.js.map → context-JCOYB4LZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-64LHZ3HM.js.map → contracts-BVO7CSLK.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{list-7LXBTEKI.js.map → contracts-NYPEW2G4.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-YJ2ET6AT.js.map → copy-32ROBIDL.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{restore-PXOFL6AM.js.map → copy-NAGLGMHZ.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-2PUXCZ25.js.map → create-4V7SWNBB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{schema-Y6DXXK2F.js.map → create-E77SDCUP.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{search-WNUNBQXO.js.map → delete-NQI5OSKN.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{search-3S72CTD6.js.map → delete-RA5KTCLB.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-DQ2QFJ7W.js.map → deps-32SU7HO5.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-W7QBLVJS.js.map → deps-T7SCWXEX.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-runs-245OINZR.js.map → docs-RRUPT7O2.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{test-runs-ZRD4GCTT.js.map → docs-WL2IWGWV.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-SJZ6S77U.js.map → eval-NF2J5SHR.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{update-SFLZPJXX.js.map → eval-SKDT3MZU.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-list-query-FB3FNDLZ.js.map → register-list-query-B42JCCOI.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-list-query-5H66WFYF.js.map → register-list-query-OEYQHFXO.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-mutation-Z2ETYHKS.js.map → register-mutation-3QXIHCQG.js.map} +0 -0
- /package/dist/cli-bundle/chunks/{register-mutation-UJO23C7R.js.map → register-mutation-IAEST26S.js.map} +0 -0
|
@@ -0,0 +1,2306 @@
|
|
|
1
|
+
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="106509f0-71e6-5a15-915f-acf57240a3e4")}catch(e){}}();
|
|
3
|
+
import {
|
|
4
|
+
collectStaleVectorizationIds
|
|
5
|
+
} from "./chunk-ROGZTCCB.js";
|
|
6
|
+
import {
|
|
7
|
+
applyFilterValueEcho,
|
|
8
|
+
buildContentFilterEcho,
|
|
9
|
+
buildGovernanceMissingFilterEcho,
|
|
10
|
+
collectRuntimeFilterValues,
|
|
11
|
+
isStatusAllFilterInput,
|
|
12
|
+
matchesRuntimeFilters,
|
|
13
|
+
parseStatusFilterCsv,
|
|
14
|
+
resolveContentFieldFilters,
|
|
15
|
+
resolveMissingMetadataFilters
|
|
16
|
+
} from "./chunk-3VHSI5FL.js";
|
|
17
|
+
import {
|
|
18
|
+
hasContentFieldFilter,
|
|
19
|
+
itemMatchesContentFilters
|
|
20
|
+
} from "./chunk-QB7XMHJW.js";
|
|
21
|
+
import {
|
|
22
|
+
hasMissingMetadataFilter,
|
|
23
|
+
itemMatchesMissingMetadata,
|
|
24
|
+
lifecycleClassifierFromStatusRegistry
|
|
25
|
+
} from "./chunk-MVYWGY2A.js";
|
|
26
|
+
import {
|
|
27
|
+
parseLimit,
|
|
28
|
+
parsePriority,
|
|
29
|
+
parseType
|
|
30
|
+
} from "./chunk-22KBU3MW.js";
|
|
31
|
+
import {
|
|
32
|
+
buildEventCorpus,
|
|
33
|
+
buildPlanFlatCorpus,
|
|
34
|
+
buildReminderCorpus,
|
|
35
|
+
buildSearchCorpus,
|
|
36
|
+
executeEmbeddingRequest,
|
|
37
|
+
executeVectorQuery,
|
|
38
|
+
readVectorizationStatusLedger,
|
|
39
|
+
resolveEmbeddingProviders,
|
|
40
|
+
resolveSearchCorpusFields,
|
|
41
|
+
resolveSettingsWithSemanticRuntimeDefaults,
|
|
42
|
+
resolveVectorStores
|
|
43
|
+
} from "./chunk-EOKXK3R3.js";
|
|
44
|
+
import {
|
|
45
|
+
resolveRegisteredSearchProvider,
|
|
46
|
+
resolveRegisteredVectorStoreAdapter
|
|
47
|
+
} from "./chunk-KGHH652T.js";
|
|
48
|
+
import {
|
|
49
|
+
collectRegisteredItemFieldNames,
|
|
50
|
+
listAllDocumentCandidatesCached,
|
|
51
|
+
listAllFrontMatter,
|
|
52
|
+
toItemRecord
|
|
53
|
+
} from "./chunk-ENGQOEUY.js";
|
|
54
|
+
import {
|
|
55
|
+
isTerminalStatus,
|
|
56
|
+
parseItemDocument
|
|
57
|
+
} from "./chunk-G24G7ZAV.js";
|
|
58
|
+
import {
|
|
59
|
+
compareTimestampStrings,
|
|
60
|
+
nowIso,
|
|
61
|
+
resolveIsoOrRelative
|
|
62
|
+
} from "./chunk-3GCS5SKL.js";
|
|
63
|
+
import {
|
|
64
|
+
PmCliError,
|
|
65
|
+
getActiveExtensionRegistrations,
|
|
66
|
+
readSettings,
|
|
67
|
+
runActiveOnReadHooks
|
|
68
|
+
} from "./chunk-E3SZTQ4K.js";
|
|
69
|
+
import {
|
|
70
|
+
EXIT_CODE,
|
|
71
|
+
coerceNumberInRange,
|
|
72
|
+
coercePositiveInteger,
|
|
73
|
+
getItemPath,
|
|
74
|
+
getSettingsPath,
|
|
75
|
+
isPathWithinDirectory,
|
|
76
|
+
pathExists,
|
|
77
|
+
resolveGlobalPmRoot,
|
|
78
|
+
resolveItemTypeRegistry,
|
|
79
|
+
resolvePmRoot,
|
|
80
|
+
resolveRuntimeFieldRegistry,
|
|
81
|
+
resolveRuntimeStatusRegistry,
|
|
82
|
+
toNonEmptyString,
|
|
83
|
+
toNonEmptyStringOrUndefined
|
|
84
|
+
} from "./chunk-57NWPFF2.js";
|
|
85
|
+
|
|
86
|
+
// dist/cli/commands/search.js
|
|
87
|
+
import fs from "node:fs/promises";
|
|
88
|
+
import path from "node:path";
|
|
89
|
+
|
|
90
|
+
// dist/core/shared/text-normalization.js
|
|
91
|
+
function normalizeLowercaseWhitespace(value) {
|
|
92
|
+
return value.trim().toLowerCase().replace(/\s+/g, " ");
|
|
93
|
+
}
|
|
94
|
+
function tokenizeAlphaNumeric(value) {
|
|
95
|
+
return normalizeLowercaseWhitespace(value).split(/[^a-z0-9]+/).filter((token) => token.length > 0);
|
|
96
|
+
}
|
|
97
|
+
function jaccardSimilarity(leftTokens, rightTokens) {
|
|
98
|
+
if (leftTokens.length === 0 && rightTokens.length === 0) {
|
|
99
|
+
return 1;
|
|
100
|
+
}
|
|
101
|
+
if (leftTokens.length === 0 || rightTokens.length === 0) {
|
|
102
|
+
return 0;
|
|
103
|
+
}
|
|
104
|
+
const leftSet = new Set(leftTokens);
|
|
105
|
+
const rightSet = new Set(rightTokens);
|
|
106
|
+
let intersection = 0;
|
|
107
|
+
for (const token of leftSet) {
|
|
108
|
+
if (rightSet.has(token)) {
|
|
109
|
+
intersection += 1;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const union = (/* @__PURE__ */ new Set([...leftSet, ...rightSet])).size;
|
|
113
|
+
return intersection / union;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// dist/core/search/relevance.js
|
|
117
|
+
var DEFAULT_QUERY_EXPANSION_MAX_QUERIES = 4;
|
|
118
|
+
var DEFAULT_RERANK_TOP_K = 20;
|
|
119
|
+
var MAX_RERANK_TOP_K = 200;
|
|
120
|
+
var QUERY_EXPANSION_STOP_WORDS = /* @__PURE__ */ new Set([
|
|
121
|
+
"a",
|
|
122
|
+
"an",
|
|
123
|
+
"and",
|
|
124
|
+
"for",
|
|
125
|
+
"from",
|
|
126
|
+
"in",
|
|
127
|
+
"into",
|
|
128
|
+
"of",
|
|
129
|
+
"on",
|
|
130
|
+
"or",
|
|
131
|
+
"the",
|
|
132
|
+
"to",
|
|
133
|
+
"with"
|
|
134
|
+
]);
|
|
135
|
+
function dedupeQueries(values, limit) {
|
|
136
|
+
const deduped = [];
|
|
137
|
+
const seen = /* @__PURE__ */ new Set();
|
|
138
|
+
for (const entry of values) {
|
|
139
|
+
const normalized = entry.trim().replaceAll(/\s+/g, " ");
|
|
140
|
+
if (normalized.length === 0) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const dedupeKey = normalized.toLowerCase();
|
|
144
|
+
if (seen.has(dedupeKey)) {
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
seen.add(dedupeKey);
|
|
148
|
+
deduped.push(normalized);
|
|
149
|
+
if (deduped.length >= limit) {
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return deduped;
|
|
154
|
+
}
|
|
155
|
+
function singularizeSimple(token) {
|
|
156
|
+
const normalizedToken = token.toLowerCase();
|
|
157
|
+
if (normalizedToken.length > 4 && normalizedToken.endsWith("ies")) {
|
|
158
|
+
return `${normalizedToken.slice(0, -3)}y`;
|
|
159
|
+
}
|
|
160
|
+
if (normalizedToken.length > 4 && (normalizedToken.endsWith("ches") || normalizedToken.endsWith("shes") || normalizedToken.endsWith("xes") || normalizedToken.endsWith("zes") || normalizedToken.endsWith("sses"))) {
|
|
161
|
+
return normalizedToken.slice(0, -2);
|
|
162
|
+
}
|
|
163
|
+
if (normalizedToken.length > 3 && normalizedToken.endsWith("s") && !normalizedToken.endsWith("ss") && !normalizedToken.endsWith("us") && !normalizedToken.endsWith("is") && !normalizedToken.endsWith("as")) {
|
|
164
|
+
return normalizedToken.slice(0, -1);
|
|
165
|
+
}
|
|
166
|
+
return normalizedToken;
|
|
167
|
+
}
|
|
168
|
+
function pluralizeSimple(token) {
|
|
169
|
+
const normalizedToken = token.toLowerCase();
|
|
170
|
+
if (normalizedToken.length > 2 && (!normalizedToken.endsWith("s") || normalizedToken.endsWith("ss"))) {
|
|
171
|
+
if (normalizedToken.endsWith("y") && !/[aeiou]y$/u.test(normalizedToken)) {
|
|
172
|
+
return `${normalizedToken.slice(0, -1)}ies`;
|
|
173
|
+
}
|
|
174
|
+
if (normalizedToken.endsWith("ch") || normalizedToken.endsWith("sh") || normalizedToken.endsWith("x") || normalizedToken.endsWith("z") || normalizedToken.endsWith("ss")) {
|
|
175
|
+
return `${normalizedToken}es`;
|
|
176
|
+
}
|
|
177
|
+
return `${normalizedToken}s`;
|
|
178
|
+
}
|
|
179
|
+
return normalizedToken;
|
|
180
|
+
}
|
|
181
|
+
function buildDeterministicQueryExpansions(query, maxQueries = DEFAULT_QUERY_EXPANSION_MAX_QUERIES) {
|
|
182
|
+
const normalizedQuery = query.trim().replaceAll(/\s+/g, " ");
|
|
183
|
+
if (normalizedQuery.length === 0) {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
const tokens = tokenizeAlphaNumeric(normalizedQuery);
|
|
187
|
+
if (tokens.length === 0) {
|
|
188
|
+
return [normalizedQuery];
|
|
189
|
+
}
|
|
190
|
+
const contentTokens = tokens.filter((token) => !QUERY_EXPANSION_STOP_WORDS.has(token.toLowerCase()));
|
|
191
|
+
const singularized = tokens.map((token) => singularizeSimple(token));
|
|
192
|
+
const pluralized = contentTokens.map((token) => pluralizeSimple(token));
|
|
193
|
+
return dedupeQueries([
|
|
194
|
+
normalizedQuery,
|
|
195
|
+
tokens.join(" "),
|
|
196
|
+
contentTokens.join(" "),
|
|
197
|
+
singularized.join(" "),
|
|
198
|
+
pluralized.join(" ")
|
|
199
|
+
], Math.max(1, maxQueries));
|
|
200
|
+
}
|
|
201
|
+
function normalizeQueryExpansionOutput(raw) {
|
|
202
|
+
const rawQueries = Array.isArray(raw) ? raw : raw?.queries;
|
|
203
|
+
if (!Array.isArray(rawQueries)) {
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
return dedupeQueries(rawQueries.filter((entry) => typeof entry === "string"), DEFAULT_QUERY_EXPANSION_MAX_QUERIES);
|
|
207
|
+
}
|
|
208
|
+
function mergeQueryExpansions(base, extra, maxQueries) {
|
|
209
|
+
return dedupeQueries([...base, ...extra], Math.max(1, maxQueries));
|
|
210
|
+
}
|
|
211
|
+
function resolveQueryExpansionConfig(settings, fallbackProviderName) {
|
|
212
|
+
const search = settings.search;
|
|
213
|
+
const queryExpansion = search?.query_expansion;
|
|
214
|
+
const configuredProvider = toNonEmptyString(queryExpansion?.provider);
|
|
215
|
+
return {
|
|
216
|
+
enabled: queryExpansion?.enabled === true,
|
|
217
|
+
provider: configuredProvider ?? fallbackProviderName,
|
|
218
|
+
max_queries: DEFAULT_QUERY_EXPANSION_MAX_QUERIES
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
function resolveRerankConfig(settings, fallbackModel) {
|
|
222
|
+
const search = settings.search;
|
|
223
|
+
const rerank = search?.rerank;
|
|
224
|
+
const configuredModel = toNonEmptyString(rerank?.model);
|
|
225
|
+
const configuredTopK = coercePositiveInteger(rerank?.top_k);
|
|
226
|
+
const normalizedTopK = configuredTopK ?? DEFAULT_RERANK_TOP_K;
|
|
227
|
+
return {
|
|
228
|
+
enabled: rerank?.enabled === true,
|
|
229
|
+
model: configuredModel ?? fallbackModel,
|
|
230
|
+
top_k: Math.min(MAX_RERANK_TOP_K, normalizedTopK)
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function normalizeRerankOutput(raw) {
|
|
234
|
+
const rawHits = Array.isArray(raw) ? raw : raw?.hits;
|
|
235
|
+
if (!Array.isArray(rawHits)) {
|
|
236
|
+
return [];
|
|
237
|
+
}
|
|
238
|
+
const bestById = /* @__PURE__ */ new Map();
|
|
239
|
+
for (const entry of rawHits) {
|
|
240
|
+
if (typeof entry !== "object" || entry === null) {
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
const id = toNonEmptyString(entry.id);
|
|
244
|
+
const score = entry.score;
|
|
245
|
+
if (!id || typeof score !== "number" || !Number.isFinite(score)) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
const existing = bestById.get(id);
|
|
249
|
+
if (existing === void 0 || score > existing) {
|
|
250
|
+
bestById.set(id, score);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const normalized = [...bestById.entries()].map(([id, score]) => ({ id, score }));
|
|
254
|
+
normalized.sort((left, right) => {
|
|
255
|
+
if (left.score !== right.score) {
|
|
256
|
+
return right.score - left.score;
|
|
257
|
+
}
|
|
258
|
+
return left.id.localeCompare(right.id);
|
|
259
|
+
});
|
|
260
|
+
return normalized;
|
|
261
|
+
}
|
|
262
|
+
function dotProduct(left, right) {
|
|
263
|
+
const size = left.length;
|
|
264
|
+
let result = 0;
|
|
265
|
+
for (let index = 0; index < size; index += 1) {
|
|
266
|
+
result += left[index] * right[index];
|
|
267
|
+
}
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
function l2Norm(vector) {
|
|
271
|
+
let sumSquares = 0;
|
|
272
|
+
for (let index = 0; index < vector.length; index += 1) {
|
|
273
|
+
sumSquares += vector[index] * vector[index];
|
|
274
|
+
}
|
|
275
|
+
return Math.sqrt(sumSquares);
|
|
276
|
+
}
|
|
277
|
+
function cosineSimilarityWithKnownLeftNorm(left, right, leftNorm) {
|
|
278
|
+
if (!left || !right || left.length === 0 || right.length === 0 || left.length !== right.length) {
|
|
279
|
+
return 0;
|
|
280
|
+
}
|
|
281
|
+
const numerator = dotProduct(left, right);
|
|
282
|
+
const rightNorm = l2Norm(right);
|
|
283
|
+
const denominator = leftNorm * rightNorm;
|
|
284
|
+
if (!Number.isFinite(numerator) || !Number.isFinite(leftNorm) || !Number.isFinite(rightNorm) || !Number.isFinite(denominator) || denominator === 0) {
|
|
285
|
+
return 0;
|
|
286
|
+
}
|
|
287
|
+
return Math.max(-1, Math.min(1, numerator / denominator));
|
|
288
|
+
}
|
|
289
|
+
async function rerankCandidatesWithEmbeddings(provider, model, query, candidates, timeoutMs) {
|
|
290
|
+
if (candidates.length === 0) {
|
|
291
|
+
return /* @__PURE__ */ new Map();
|
|
292
|
+
}
|
|
293
|
+
const effectiveModel = toNonEmptyString(model) ?? provider.model;
|
|
294
|
+
const rerankProvider = effectiveModel === provider.model ? provider : { ...provider, model: effectiveModel };
|
|
295
|
+
const payload = [query.trim(), ...candidates.map((entry) => entry.text)];
|
|
296
|
+
const vectors = await executeEmbeddingRequest(rerankProvider, payload, timeoutMs ? { timeout_ms: timeoutMs } : {});
|
|
297
|
+
const queryVector = vectors[0];
|
|
298
|
+
if (!queryVector) {
|
|
299
|
+
return /* @__PURE__ */ new Map();
|
|
300
|
+
}
|
|
301
|
+
const queryNorm = l2Norm(queryVector);
|
|
302
|
+
const scoreById = /* @__PURE__ */ new Map();
|
|
303
|
+
for (let index = 0; index < candidates.length; index += 1) {
|
|
304
|
+
const candidate = candidates[index];
|
|
305
|
+
const candidateVector = vectors[index + 1];
|
|
306
|
+
if (!candidateVector) {
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
309
|
+
const similarity = cosineSimilarityWithKnownLeftNorm(queryVector, candidateVector, queryNorm);
|
|
310
|
+
scoreById.set(candidate.id, Math.max(0, Math.min(1, (similarity + 1) / 2)));
|
|
311
|
+
}
|
|
312
|
+
return scoreById;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// dist/core/search/bm25.js
|
|
316
|
+
var DEFAULT_BM25_K1 = 1.2;
|
|
317
|
+
var DEFAULT_BM25_B = 0.75;
|
|
318
|
+
function tokenizeBm25(text) {
|
|
319
|
+
return tokenizeAlphaNumeric(text);
|
|
320
|
+
}
|
|
321
|
+
function buildTermFrequencies(tokens) {
|
|
322
|
+
const frequencies = /* @__PURE__ */ new Map();
|
|
323
|
+
for (const token of tokens) {
|
|
324
|
+
frequencies.set(token, (frequencies.get(token) ?? 0) + 1);
|
|
325
|
+
}
|
|
326
|
+
return frequencies;
|
|
327
|
+
}
|
|
328
|
+
function buildBm25Index(documents) {
|
|
329
|
+
const stats = [];
|
|
330
|
+
const documentFrequency = /* @__PURE__ */ new Map();
|
|
331
|
+
let totalLength = 0;
|
|
332
|
+
for (const document of documents) {
|
|
333
|
+
const tokens = tokenizeBm25(document.text);
|
|
334
|
+
const termFrequencies = buildTermFrequencies(tokens);
|
|
335
|
+
totalLength += tokens.length;
|
|
336
|
+
for (const term of termFrequencies.keys()) {
|
|
337
|
+
documentFrequency.set(term, (documentFrequency.get(term) ?? 0) + 1);
|
|
338
|
+
}
|
|
339
|
+
stats.push({ id: document.id, termFrequencies, length: tokens.length });
|
|
340
|
+
}
|
|
341
|
+
const documentCount = stats.length;
|
|
342
|
+
return {
|
|
343
|
+
documents: stats,
|
|
344
|
+
documentFrequency,
|
|
345
|
+
documentCount,
|
|
346
|
+
averageDocumentLength: documentCount > 0 ? totalLength / documentCount : 0
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function inverseDocumentFrequency(documentCount, termDocumentFrequency) {
|
|
350
|
+
return Math.log(1 + (documentCount - termDocumentFrequency + 0.5) / (termDocumentFrequency + 0.5));
|
|
351
|
+
}
|
|
352
|
+
function scoreBm25Query(index, queryTokens, params) {
|
|
353
|
+
const scores = /* @__PURE__ */ new Map();
|
|
354
|
+
if (index.documentCount === 0 || index.averageDocumentLength === 0) {
|
|
355
|
+
return scores;
|
|
356
|
+
}
|
|
357
|
+
const distinctQueryTerms = [...new Set(queryTokens.filter((token) => token.length > 0))];
|
|
358
|
+
if (distinctQueryTerms.length === 0) {
|
|
359
|
+
return scores;
|
|
360
|
+
}
|
|
361
|
+
const idfByTerm = /* @__PURE__ */ new Map();
|
|
362
|
+
for (const term of distinctQueryTerms) {
|
|
363
|
+
const termDocumentFrequency = index.documentFrequency.get(term);
|
|
364
|
+
if (termDocumentFrequency === void 0) {
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
idfByTerm.set(term, inverseDocumentFrequency(index.documentCount, termDocumentFrequency));
|
|
368
|
+
}
|
|
369
|
+
if (idfByTerm.size === 0) {
|
|
370
|
+
return scores;
|
|
371
|
+
}
|
|
372
|
+
for (const document of index.documents) {
|
|
373
|
+
let score = 0;
|
|
374
|
+
for (const [term, idf] of idfByTerm) {
|
|
375
|
+
const termFrequency = document.termFrequencies.get(term);
|
|
376
|
+
if (termFrequency === void 0) {
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
const lengthNormalization = 1 - params.b + params.b * document.length / index.averageDocumentLength;
|
|
380
|
+
const denominator = termFrequency + params.k1 * lengthNormalization;
|
|
381
|
+
score += idf * (termFrequency * (params.k1 + 1) / denominator);
|
|
382
|
+
}
|
|
383
|
+
if (score > 0) {
|
|
384
|
+
scores.set(document.id, score);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return scores;
|
|
388
|
+
}
|
|
389
|
+
function resolveClampedParam(candidate, fallback, min, max) {
|
|
390
|
+
if (typeof candidate !== "number" || !Number.isFinite(candidate)) {
|
|
391
|
+
return fallback;
|
|
392
|
+
}
|
|
393
|
+
return Math.min(max, Math.max(min, candidate));
|
|
394
|
+
}
|
|
395
|
+
function flattenSearchCorpusText(corpus) {
|
|
396
|
+
const collectValueText = (value) => {
|
|
397
|
+
if (typeof value === "string") {
|
|
398
|
+
return [value];
|
|
399
|
+
}
|
|
400
|
+
if (typeof value === "number") {
|
|
401
|
+
return [String(value)];
|
|
402
|
+
}
|
|
403
|
+
if (Array.isArray(value)) {
|
|
404
|
+
return value.flatMap(collectValueText);
|
|
405
|
+
}
|
|
406
|
+
if (typeof value === "object" && value !== null) {
|
|
407
|
+
return Object.values(value).flatMap(collectValueText);
|
|
408
|
+
}
|
|
409
|
+
return [];
|
|
410
|
+
};
|
|
411
|
+
return collectValueText(Object.values(corpus)).join(" ");
|
|
412
|
+
}
|
|
413
|
+
function resolveBm25Params(settings) {
|
|
414
|
+
const bm25 = settings?.search?.bm25;
|
|
415
|
+
return {
|
|
416
|
+
k1: resolveClampedParam(bm25?.k1, DEFAULT_BM25_K1, 0, 1e3),
|
|
417
|
+
b: resolveClampedParam(bm25?.b, DEFAULT_BM25_B, 0, 1)
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// dist/cli/commands/search.js
|
|
422
|
+
var DEFAULT_COMPACT_SEARCH_FIELDS = [
|
|
423
|
+
"id",
|
|
424
|
+
"title",
|
|
425
|
+
"status",
|
|
426
|
+
"type",
|
|
427
|
+
"priority",
|
|
428
|
+
"updated_at",
|
|
429
|
+
"score",
|
|
430
|
+
"matched_fields"
|
|
431
|
+
];
|
|
432
|
+
var SEARCH_HIT_FIELD_KEYS = /* @__PURE__ */ new Set(["score", "matched_fields", "highlights"]);
|
|
433
|
+
var SEARCH_ITEM_FIELD_KEYS = /* @__PURE__ */ new Set([
|
|
434
|
+
"id",
|
|
435
|
+
"title",
|
|
436
|
+
"description",
|
|
437
|
+
"type",
|
|
438
|
+
"status",
|
|
439
|
+
"priority",
|
|
440
|
+
"tags",
|
|
441
|
+
"created_at",
|
|
442
|
+
"updated_at",
|
|
443
|
+
"deadline",
|
|
444
|
+
"assignee",
|
|
445
|
+
"author",
|
|
446
|
+
"estimated_minutes",
|
|
447
|
+
"acceptance_criteria",
|
|
448
|
+
"dependencies",
|
|
449
|
+
"comments",
|
|
450
|
+
"notes",
|
|
451
|
+
"learnings",
|
|
452
|
+
"reminders",
|
|
453
|
+
"events",
|
|
454
|
+
"files",
|
|
455
|
+
"tests",
|
|
456
|
+
"docs",
|
|
457
|
+
"close_reason",
|
|
458
|
+
"parent",
|
|
459
|
+
"reviewer",
|
|
460
|
+
"risk",
|
|
461
|
+
"confidence",
|
|
462
|
+
"sprint",
|
|
463
|
+
"release",
|
|
464
|
+
"blocked_by",
|
|
465
|
+
"blocked_reason",
|
|
466
|
+
"reporter",
|
|
467
|
+
"severity",
|
|
468
|
+
"environment",
|
|
469
|
+
"repro_steps",
|
|
470
|
+
"resolution",
|
|
471
|
+
"expected_result",
|
|
472
|
+
"actual_result",
|
|
473
|
+
"affected_version",
|
|
474
|
+
"fixed_version",
|
|
475
|
+
"component",
|
|
476
|
+
"regression",
|
|
477
|
+
"customer_impact",
|
|
478
|
+
"definition_of_ready",
|
|
479
|
+
"order",
|
|
480
|
+
"rank",
|
|
481
|
+
"goal",
|
|
482
|
+
"objective",
|
|
483
|
+
"value",
|
|
484
|
+
"impact",
|
|
485
|
+
"outcome",
|
|
486
|
+
"why_now",
|
|
487
|
+
"plan"
|
|
488
|
+
]);
|
|
489
|
+
var LONG_QUERY_TOKEN_THRESHOLD = 2;
|
|
490
|
+
var LONG_QUERY_TITLE_EXACT_BONUS = 120;
|
|
491
|
+
var LONG_QUERY_PHRASE_MULTIPLIER = 6;
|
|
492
|
+
var ALL_TERMS_COVERAGE_BONUS = 40;
|
|
493
|
+
var EXACT_ID_MATCH_SCORE = 1e3;
|
|
494
|
+
var SHORT_ID_MATCH_SCORE = 900;
|
|
495
|
+
var HIGHLIGHT_OPEN = "\xAB";
|
|
496
|
+
var HIGHLIGHT_CLOSE = "\xBB";
|
|
497
|
+
var HIGHLIGHT_SNIPPET_RADIUS = 60;
|
|
498
|
+
var INLINE_QUERY_FILTER_FIELDS = ["tag", "status", "type", "priority"];
|
|
499
|
+
var COMPACT_SEARCH_VALUE_FILTER_ECHO_ENTRIES = [
|
|
500
|
+
{
|
|
501
|
+
optionKey: "status",
|
|
502
|
+
summaryKey: "status",
|
|
503
|
+
normalize: (value) => isStatusAllFilterInput(value) ? "all" : value
|
|
504
|
+
},
|
|
505
|
+
{ optionKey: "type", summaryKey: "type" },
|
|
506
|
+
{ optionKey: "tag", summaryKey: "tag" },
|
|
507
|
+
{ optionKey: "priority", summaryKey: "priority" },
|
|
508
|
+
{ optionKey: "deadlineBefore", summaryKey: "deadline_before" },
|
|
509
|
+
{ optionKey: "deadlineAfter", summaryKey: "deadline_after" },
|
|
510
|
+
{ optionKey: "updatedAfter", summaryKey: "updated_after" },
|
|
511
|
+
{ optionKey: "updatedBefore", summaryKey: "updated_before" },
|
|
512
|
+
{ optionKey: "createdAfter", summaryKey: "created_after" },
|
|
513
|
+
{ optionKey: "createdBefore", summaryKey: "created_before" },
|
|
514
|
+
{ optionKey: "assignee", summaryKey: "assignee" },
|
|
515
|
+
{ optionKey: "sprint", summaryKey: "sprint" },
|
|
516
|
+
{ optionKey: "release", summaryKey: "release" },
|
|
517
|
+
{ optionKey: "parent", summaryKey: "parent" }
|
|
518
|
+
];
|
|
519
|
+
function isNonEmptyRecord(value) {
|
|
520
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
521
|
+
}
|
|
522
|
+
function buildCompactSearchFilterSummary(params) {
|
|
523
|
+
const { mode, matchMode, options, includeLinked, titleExact, phraseExact, scoreThreshold, hybridSemanticWeight, runtimeFieldFilters } = params;
|
|
524
|
+
const filters = {};
|
|
525
|
+
applyFilterValueEcho(filters, options, COMPACT_SEARCH_VALUE_FILTER_ECHO_ENTRIES);
|
|
526
|
+
Object.assign(filters, buildGovernanceMissingFilterEcho(options));
|
|
527
|
+
Object.assign(filters, buildContentFilterEcho(options));
|
|
528
|
+
if (matchMode !== "or") {
|
|
529
|
+
filters.match_mode = matchMode;
|
|
530
|
+
}
|
|
531
|
+
if (includeLinked) {
|
|
532
|
+
filters.include_linked = true;
|
|
533
|
+
}
|
|
534
|
+
if (titleExact) {
|
|
535
|
+
filters.title_exact = true;
|
|
536
|
+
}
|
|
537
|
+
if (phraseExact) {
|
|
538
|
+
filters.phrase_exact = true;
|
|
539
|
+
}
|
|
540
|
+
if (scoreThreshold > 0) {
|
|
541
|
+
filters.score_threshold = scoreThreshold;
|
|
542
|
+
}
|
|
543
|
+
if (mode === "hybrid" && options.semanticWeight !== void 0) {
|
|
544
|
+
filters.hybrid_semantic_weight = hybridSemanticWeight;
|
|
545
|
+
}
|
|
546
|
+
if (options.limit !== void 0) {
|
|
547
|
+
filters.limit = options.limit;
|
|
548
|
+
}
|
|
549
|
+
if (isNonEmptyRecord(runtimeFieldFilters)) {
|
|
550
|
+
filters.runtime_filters = runtimeFieldFilters;
|
|
551
|
+
}
|
|
552
|
+
return filters;
|
|
553
|
+
}
|
|
554
|
+
function buildVerboseSearchFilters(params) {
|
|
555
|
+
const { effectiveMode, matchMode, options, includeLinked, titleExact, phraseExact, scoreThreshold, hybridSemanticWeight, queryExpansion, rerank, runtimeFieldFilters } = params;
|
|
556
|
+
return {
|
|
557
|
+
mode: effectiveMode,
|
|
558
|
+
match_mode: matchMode,
|
|
559
|
+
status: isStatusAllFilterInput(options.status) ? "all" : valueOrNull(options.status),
|
|
560
|
+
type: valueOrNull(options.type),
|
|
561
|
+
tag: valueOrNull(options.tag),
|
|
562
|
+
priority: valueOrNull(options.priority),
|
|
563
|
+
deadline_before: valueOrNull(options.deadlineBefore),
|
|
564
|
+
deadline_after: valueOrNull(options.deadlineAfter),
|
|
565
|
+
updated_after: valueOrNull(options.updatedAfter),
|
|
566
|
+
updated_before: valueOrNull(options.updatedBefore),
|
|
567
|
+
created_after: valueOrNull(options.createdAfter),
|
|
568
|
+
created_before: valueOrNull(options.createdBefore),
|
|
569
|
+
assignee: valueOrNull(options.assignee),
|
|
570
|
+
sprint: valueOrNull(options.sprint),
|
|
571
|
+
release: valueOrNull(options.release),
|
|
572
|
+
parent: valueOrNull(options.parent),
|
|
573
|
+
...buildGovernanceMissingFilterEcho(options),
|
|
574
|
+
...buildContentFilterEcho(options),
|
|
575
|
+
include_linked: includeLinked,
|
|
576
|
+
title_exact: titleExact,
|
|
577
|
+
phrase_exact: phraseExact,
|
|
578
|
+
score_threshold: scoreThreshold,
|
|
579
|
+
hybrid_semantic_weight: effectiveMode === "hybrid" ? hybridSemanticWeight : null,
|
|
580
|
+
query_expansion_enabled: queryExpansion.enabled,
|
|
581
|
+
query_expansion_provider: queryExpansion.provider,
|
|
582
|
+
rerank_enabled: rerank.enabled,
|
|
583
|
+
rerank_model: rerank.model,
|
|
584
|
+
rerank_top_k: rerank.top_k,
|
|
585
|
+
limit: valueOrNull(options.limit),
|
|
586
|
+
runtime_filters: runtimeFieldFilters
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function valueOrNull(value) {
|
|
590
|
+
return value ?? null;
|
|
591
|
+
}
|
|
592
|
+
function collectErrorCauseCodes(error) {
|
|
593
|
+
const codes = [];
|
|
594
|
+
let current = error;
|
|
595
|
+
for (let depth = 0; depth < 5 && current && typeof current === "object"; depth += 1) {
|
|
596
|
+
const code = current.code;
|
|
597
|
+
if (typeof code === "string") {
|
|
598
|
+
codes.push(code.toLowerCase());
|
|
599
|
+
}
|
|
600
|
+
current = current.cause;
|
|
601
|
+
}
|
|
602
|
+
return codes.join(" ");
|
|
603
|
+
}
|
|
604
|
+
function classifyImplicitSemanticFallbackReason(error) {
|
|
605
|
+
const message = (error instanceof Error ? error.message : String(error)).toLowerCase();
|
|
606
|
+
const causeCodes = collectErrorCauseCodes(error);
|
|
607
|
+
const haystack = `${message} ${causeCodes}`;
|
|
608
|
+
if (haystack.includes("timed out") || haystack.includes("timeout") || haystack.includes("etimedout")) {
|
|
609
|
+
return "timeout";
|
|
610
|
+
}
|
|
611
|
+
if (haystack.includes("econnrefused") || haystack.includes("connection refused") || haystack.includes("connect ") || haystack.includes("enotfound") || haystack.includes("eai_again") || haystack.includes("econnreset") || haystack.includes("fetch failed")) {
|
|
612
|
+
return "connection";
|
|
613
|
+
}
|
|
614
|
+
return "error";
|
|
615
|
+
}
|
|
616
|
+
function buildExplicitSemanticFallbackWarning(requestedMode, error) {
|
|
617
|
+
const reason = classifyImplicitSemanticFallbackReason(error);
|
|
618
|
+
return `search_${requestedMode}_fallback:${reason}:using_keyword_mode`;
|
|
619
|
+
}
|
|
620
|
+
async function maybeEmitVectorIndexStaleWarning(pmRoot, filteredDocuments, warnings) {
|
|
621
|
+
try {
|
|
622
|
+
const ledger = await readVectorizationStatusLedger(pmRoot);
|
|
623
|
+
if (ledger.warnings.length > 0) {
|
|
624
|
+
warnings.push(...ledger.warnings);
|
|
625
|
+
}
|
|
626
|
+
const staleIds = collectStaleVectorizationIds(filteredDocuments.map((document) => ({
|
|
627
|
+
id: document.metadata.id,
|
|
628
|
+
updated_at: document.metadata.updated_at
|
|
629
|
+
})), ledger.entries);
|
|
630
|
+
if (staleIds.length === 0) {
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
warnings.push(`vector_index_stale:${staleIds.length}`);
|
|
634
|
+
process.stderr.write(`[pm] warning: ${staleIds.length} item${staleIds.length === 1 ? " is" : "s are"} new or modified since the last reindex and ${staleIds.length === 1 ? "is" : "are"} NOT in the semantic index yet \u2014 they will be missing from semantic/hybrid results until you run 'pm reindex --mode hybrid'. (Write-time embedding is governed by search.mutation_refresh_policy; staleness means the embed was skipped, failed, or the backend was unreachable.)
|
|
635
|
+
`);
|
|
636
|
+
} catch {
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
function parseMode(raw, _context) {
|
|
640
|
+
if (raw === void 0) {
|
|
641
|
+
return "keyword";
|
|
642
|
+
}
|
|
643
|
+
const normalized = raw.trim().toLowerCase();
|
|
644
|
+
if (normalized !== "keyword" && normalized !== "semantic" && normalized !== "hybrid") {
|
|
645
|
+
throw new PmCliError("Search mode must be one of keyword|semantic|hybrid", EXIT_CODE.USAGE);
|
|
646
|
+
}
|
|
647
|
+
return normalized;
|
|
648
|
+
}
|
|
649
|
+
function parseIncludeLinked(raw) {
|
|
650
|
+
return raw === true;
|
|
651
|
+
}
|
|
652
|
+
function parseTitleExact(raw) {
|
|
653
|
+
return raw === true;
|
|
654
|
+
}
|
|
655
|
+
function parsePhraseExact(raw) {
|
|
656
|
+
return raw === true;
|
|
657
|
+
}
|
|
658
|
+
function parseSemanticWeightOverride(raw) {
|
|
659
|
+
return coerceNumberInRange(raw, 0, 1) ?? void 0;
|
|
660
|
+
}
|
|
661
|
+
function parseMatchMode(raw) {
|
|
662
|
+
if (raw === void 0) {
|
|
663
|
+
return "or";
|
|
664
|
+
}
|
|
665
|
+
const normalized = raw.trim().toLowerCase();
|
|
666
|
+
if (normalized !== "and" && normalized !== "or" && normalized !== "exact") {
|
|
667
|
+
throw new PmCliError("Search --match-mode must be one of and|or|exact", EXIT_CODE.USAGE);
|
|
668
|
+
}
|
|
669
|
+
return normalized;
|
|
670
|
+
}
|
|
671
|
+
function parseMinScoreOverride(raw) {
|
|
672
|
+
if (raw === void 0 || raw === null || raw === "") {
|
|
673
|
+
return void 0;
|
|
674
|
+
}
|
|
675
|
+
const parsed = typeof raw === "number" ? raw : Number(String(raw).trim());
|
|
676
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
677
|
+
throw new PmCliError("Search --min-score must be a finite number >= 0", EXIT_CODE.USAGE);
|
|
678
|
+
}
|
|
679
|
+
return parsed;
|
|
680
|
+
}
|
|
681
|
+
function parseTimestampWindow(raw, fieldLabel) {
|
|
682
|
+
if (raw == null)
|
|
683
|
+
return void 0;
|
|
684
|
+
const value = String(raw).trim();
|
|
685
|
+
if (value.length === 0)
|
|
686
|
+
return void 0;
|
|
687
|
+
return resolveIsoOrRelative(value, /* @__PURE__ */ new Date(), fieldLabel);
|
|
688
|
+
}
|
|
689
|
+
function normalizeSearchPhrase(value) {
|
|
690
|
+
return value.toLowerCase().replace(/\s+/g, " ").trim();
|
|
691
|
+
}
|
|
692
|
+
function parseDeadline(raw, fieldLabel) {
|
|
693
|
+
if (raw === void 0)
|
|
694
|
+
return void 0;
|
|
695
|
+
return resolveIsoOrRelative(raw, /* @__PURE__ */ new Date(), fieldLabel);
|
|
696
|
+
}
|
|
697
|
+
function parseFieldSelectors(raw) {
|
|
698
|
+
if (raw === void 0) {
|
|
699
|
+
return void 0;
|
|
700
|
+
}
|
|
701
|
+
const selectors = raw.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
|
|
702
|
+
if (selectors.length === 0) {
|
|
703
|
+
throw new PmCliError("Search --fields requires a comma-separated list of field names", EXIT_CODE.USAGE);
|
|
704
|
+
}
|
|
705
|
+
return [...new Set(selectors)];
|
|
706
|
+
}
|
|
707
|
+
function parseProjectionConfig(options) {
|
|
708
|
+
const compactRequested = options.compact === true;
|
|
709
|
+
const fullRequested = options.full === true;
|
|
710
|
+
const fieldSelectors = parseFieldSelectors(options.fields);
|
|
711
|
+
const enabledModes = Number(compactRequested) + Number(fullRequested) + Number(fieldSelectors !== void 0);
|
|
712
|
+
if (enabledModes > 1) {
|
|
713
|
+
throw new PmCliError("Search projection options are mutually exclusive. Use one of --compact, --full, or --fields.", EXIT_CODE.USAGE);
|
|
714
|
+
}
|
|
715
|
+
if (compactRequested) {
|
|
716
|
+
return {
|
|
717
|
+
mode: "compact",
|
|
718
|
+
fields: [...DEFAULT_COMPACT_SEARCH_FIELDS]
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
if (fullRequested) {
|
|
722
|
+
return {
|
|
723
|
+
mode: "full",
|
|
724
|
+
fields: []
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
if (fieldSelectors) {
|
|
728
|
+
return {
|
|
729
|
+
mode: "fields",
|
|
730
|
+
fields: fieldSelectors
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
return {
|
|
734
|
+
mode: "full",
|
|
735
|
+
fields: []
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
var _testOnlySearchCommand = {
|
|
739
|
+
applyFilters,
|
|
740
|
+
applyExactQueryFilters,
|
|
741
|
+
applyInlineQueryFilters,
|
|
742
|
+
buildHitHighlights,
|
|
743
|
+
buildVerboseSearchFilters,
|
|
744
|
+
buildExplicitSemanticFallbackWarning,
|
|
745
|
+
buildCompactSearchFilterSummary,
|
|
746
|
+
buildHybridLexicalScore,
|
|
747
|
+
buildRerankCorpus,
|
|
748
|
+
buildSemanticHits,
|
|
749
|
+
classifyImplicitSemanticFallbackReason,
|
|
750
|
+
collectErrorCauseCodes,
|
|
751
|
+
collectExactPhraseFields,
|
|
752
|
+
collectLinkedPaths,
|
|
753
|
+
combineHybridHits,
|
|
754
|
+
computeBuiltInBm25Hits,
|
|
755
|
+
computeSemanticOrHybridHits,
|
|
756
|
+
resolveBuiltInBm25Mode,
|
|
757
|
+
countOccurrences,
|
|
758
|
+
dependencyEntries,
|
|
759
|
+
documentContainsExactPhrase,
|
|
760
|
+
emptySearchResult,
|
|
761
|
+
highlightFieldSnippet,
|
|
762
|
+
loadDocuments,
|
|
763
|
+
markTokenRuns,
|
|
764
|
+
parseInlineQueryFilters,
|
|
765
|
+
maybeEmitVectorIndexStaleWarning,
|
|
766
|
+
loadLinkedCorpus,
|
|
767
|
+
mergeVectorHitsById,
|
|
768
|
+
normalizeExtensionProviderHits,
|
|
769
|
+
normalizeScoreMap,
|
|
770
|
+
parseProjectionConfig,
|
|
771
|
+
parseTimestampWindow,
|
|
772
|
+
parseTokens,
|
|
773
|
+
readSearchFieldValue,
|
|
774
|
+
requireSemanticDependencies,
|
|
775
|
+
resolveExtensionSearchProvider,
|
|
776
|
+
resolveExtensionSearchProviderByName,
|
|
777
|
+
resolveExtensionVectorAdapter,
|
|
778
|
+
resolveLinkedCorpusRoots,
|
|
779
|
+
scoreDocument,
|
|
780
|
+
sortHits,
|
|
781
|
+
stringArray,
|
|
782
|
+
textEntries,
|
|
783
|
+
validateSearchProjectionFields
|
|
784
|
+
};
|
|
785
|
+
function validateSearchProjectionFields(projection, runtimeFieldRegistry) {
|
|
786
|
+
if (projection.mode !== "fields") {
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
const runtimeKeys = new Set(runtimeFieldRegistry.definitions.flatMap((field) => [field.key, field.metadata_key]));
|
|
790
|
+
const unknown = projection.fields.filter((field) => {
|
|
791
|
+
const normalized = field.trim();
|
|
792
|
+
const itemKey = normalized.startsWith("item.") ? normalized.slice("item.".length) : normalized;
|
|
793
|
+
return !SEARCH_HIT_FIELD_KEYS.has(normalized) && !SEARCH_ITEM_FIELD_KEYS.has(itemKey) && !runtimeKeys.has(itemKey);
|
|
794
|
+
});
|
|
795
|
+
if (unknown.length > 0) {
|
|
796
|
+
throw new PmCliError(`Unknown search --fields value(s): ${unknown.join(", ")}`, EXIT_CODE.USAGE, {
|
|
797
|
+
examples: [
|
|
798
|
+
"pm search <query> --fields id,title,status,score",
|
|
799
|
+
"pm search <query> --fields id,title,item.description,matched_fields"
|
|
800
|
+
],
|
|
801
|
+
nextSteps: ["Use item.<field> for explicit item metadata fields, or run pm search --help for projection examples."]
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
function parseTokens(query) {
|
|
806
|
+
const normalized = normalizeSearchPhrase(query);
|
|
807
|
+
if (!normalized) {
|
|
808
|
+
throw new PmCliError("Search query must not be empty", EXIT_CODE.USAGE);
|
|
809
|
+
}
|
|
810
|
+
return normalized.split(/\s+/).filter(Boolean);
|
|
811
|
+
}
|
|
812
|
+
function parseInlineQueryFilters(query) {
|
|
813
|
+
const inlineFilters = {};
|
|
814
|
+
const residualTokens = [];
|
|
815
|
+
for (const token of query.split(/\s+/).filter((entry) => entry.length > 0)) {
|
|
816
|
+
const separatorIndex = token.indexOf(":");
|
|
817
|
+
const field = separatorIndex > 0 ? token.slice(0, separatorIndex).toLowerCase() : "";
|
|
818
|
+
const value = separatorIndex > 0 ? token.slice(separatorIndex + 1) : "";
|
|
819
|
+
const matchedField = INLINE_QUERY_FILTER_FIELDS.includes(field) ? field : void 0;
|
|
820
|
+
if (matchedField && value.length > 0 && inlineFilters[matchedField] === void 0) {
|
|
821
|
+
inlineFilters[matchedField] = value;
|
|
822
|
+
continue;
|
|
823
|
+
}
|
|
824
|
+
residualTokens.push(token);
|
|
825
|
+
}
|
|
826
|
+
return {
|
|
827
|
+
residualQuery: residualTokens.join(" "),
|
|
828
|
+
inlineFilters
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
function applyInlineQueryFilters(options, inlineFilters, warnings) {
|
|
832
|
+
const merged = { ...options };
|
|
833
|
+
for (const field of INLINE_QUERY_FILTER_FIELDS) {
|
|
834
|
+
const inlineValue = inlineFilters[field];
|
|
835
|
+
if (inlineValue === void 0) {
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
838
|
+
if (toNonEmptyStringOrUndefined(merged[field]) !== void 0) {
|
|
839
|
+
warnings.push(`search_inline_filter_ignored:${field}:flag_takes_precedence`);
|
|
840
|
+
continue;
|
|
841
|
+
}
|
|
842
|
+
merged[field] = inlineValue;
|
|
843
|
+
}
|
|
844
|
+
return merged;
|
|
845
|
+
}
|
|
846
|
+
function stringArray(value) {
|
|
847
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
848
|
+
}
|
|
849
|
+
function textEntries(value) {
|
|
850
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.text === "string") : [];
|
|
851
|
+
}
|
|
852
|
+
function dependencyEntries(value) {
|
|
853
|
+
return Array.isArray(value) ? value.filter((entry) => typeof entry === "object" && entry !== null && typeof entry.id === "string" && typeof entry.kind === "string") : [];
|
|
854
|
+
}
|
|
855
|
+
function collectExactPhraseFields(document) {
|
|
856
|
+
const item = document.metadata;
|
|
857
|
+
return [
|
|
858
|
+
item.title,
|
|
859
|
+
item.description,
|
|
860
|
+
item.status,
|
|
861
|
+
stringArray(item.tags).join(" "),
|
|
862
|
+
document.body,
|
|
863
|
+
textEntries(item.comments).map((entry) => entry.text).join(" "),
|
|
864
|
+
textEntries(item.notes).map((entry) => entry.text).join(" "),
|
|
865
|
+
textEntries(item.learnings).map((entry) => entry.text).join(" "),
|
|
866
|
+
buildReminderCorpus(item).join(" "),
|
|
867
|
+
buildEventCorpus(item).join(" "),
|
|
868
|
+
dependencyEntries(item.dependencies).map((entry) => `${entry.id} ${entry.kind}`).join(" "),
|
|
869
|
+
buildPlanFlatCorpus(item)
|
|
870
|
+
];
|
|
871
|
+
}
|
|
872
|
+
function documentContainsExactPhrase(document, normalizedQuery) {
|
|
873
|
+
return collectExactPhraseFields(document).some((fieldValue) => normalizeSearchPhrase(fieldValue).includes(normalizedQuery));
|
|
874
|
+
}
|
|
875
|
+
function applyExactQueryFilters(items, normalizedQuery, options) {
|
|
876
|
+
if (!options.titleExact && !options.phraseExact) {
|
|
877
|
+
return items;
|
|
878
|
+
}
|
|
879
|
+
return items.filter((document) => {
|
|
880
|
+
if (options.titleExact && normalizeSearchPhrase(document.metadata.title) !== normalizedQuery) {
|
|
881
|
+
return false;
|
|
882
|
+
}
|
|
883
|
+
if (options.phraseExact && !documentContainsExactPhrase(document, normalizedQuery)) {
|
|
884
|
+
return false;
|
|
885
|
+
}
|
|
886
|
+
return true;
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
function assertSearchAssigneeFilter(assigneeFilter) {
|
|
890
|
+
if (assigneeFilter && (assigneeFilter.toLowerCase() === "none" || assigneeFilter.toLowerCase() === "null")) {
|
|
891
|
+
throw new PmCliError('--assignee no longer accepts "none" or "null".', EXIT_CODE.USAGE);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
function resolveSearchMetadataFilterSet(options, typeRegistry, statusFilter) {
|
|
895
|
+
const assigneeFilter = options.assignee?.trim();
|
|
896
|
+
assertSearchAssigneeFilter(assigneeFilter);
|
|
897
|
+
const missingMetadataFilters = resolveMissingMetadataFilters(options);
|
|
898
|
+
const contentFieldFilters = resolveContentFieldFilters(options);
|
|
899
|
+
return {
|
|
900
|
+
typeFilter: parseType(options.type, typeRegistry),
|
|
901
|
+
tagFilter: options.tag?.trim().toLowerCase(),
|
|
902
|
+
priorityFilter: parsePriority(options.priority),
|
|
903
|
+
deadlineBefore: parseDeadline(options.deadlineBefore, "deadline-before"),
|
|
904
|
+
deadlineAfter: parseDeadline(options.deadlineAfter, "deadline-after"),
|
|
905
|
+
updatedAfter: parseTimestampWindow(options.updatedAfter, "updated-after"),
|
|
906
|
+
updatedBefore: parseTimestampWindow(options.updatedBefore, "updated-before"),
|
|
907
|
+
createdAfter: parseTimestampWindow(options.createdAfter, "created-after"),
|
|
908
|
+
createdBefore: parseTimestampWindow(options.createdBefore, "created-before"),
|
|
909
|
+
assigneeFilter,
|
|
910
|
+
sprintFilter: options.sprint?.trim(),
|
|
911
|
+
releaseFilter: options.release?.trim(),
|
|
912
|
+
parentFilter: options.parent?.trim(),
|
|
913
|
+
statusSet: statusFilter && statusFilter.length > 0 ? new Set(statusFilter) : void 0,
|
|
914
|
+
missingMetadataFilters,
|
|
915
|
+
missingMetadataActive: hasMissingMetadataFilter(missingMetadataFilters),
|
|
916
|
+
contentFieldFilters,
|
|
917
|
+
contentFiltersActive: hasContentFieldFilter(contentFieldFilters)
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
function matchesScalarSearchFilters(item, filters) {
|
|
921
|
+
return matchesIdentitySearchFilters(item, filters) && matchesTimestampSearchFilters(item, filters) && matchesOwnerSearchFilters(item, filters);
|
|
922
|
+
}
|
|
923
|
+
function matchesIdentitySearchFilters(item, filters) {
|
|
924
|
+
if (filters.statusSet && !filters.statusSet.has(item.status))
|
|
925
|
+
return false;
|
|
926
|
+
if (filters.typeFilter && item.type !== filters.typeFilter)
|
|
927
|
+
return false;
|
|
928
|
+
if (filters.tagFilter && !stringArray(item.tags).includes(filters.tagFilter))
|
|
929
|
+
return false;
|
|
930
|
+
if (filters.priorityFilter !== void 0 && item.priority !== filters.priorityFilter)
|
|
931
|
+
return false;
|
|
932
|
+
return true;
|
|
933
|
+
}
|
|
934
|
+
function matchesTimestampSearchFilters(item, filters) {
|
|
935
|
+
if (filters.deadlineBefore && (!item.deadline || compareTimestampStrings(item.deadline, filters.deadlineBefore) > 0))
|
|
936
|
+
return false;
|
|
937
|
+
if (filters.deadlineAfter && (!item.deadline || compareTimestampStrings(item.deadline, filters.deadlineAfter) < 0))
|
|
938
|
+
return false;
|
|
939
|
+
if (filters.updatedAfter && compareTimestampStrings(item.updated_at, filters.updatedAfter) < 0)
|
|
940
|
+
return false;
|
|
941
|
+
if (filters.updatedBefore && compareTimestampStrings(item.updated_at, filters.updatedBefore) > 0)
|
|
942
|
+
return false;
|
|
943
|
+
if (filters.createdAfter && compareTimestampStrings(item.created_at, filters.createdAfter) < 0)
|
|
944
|
+
return false;
|
|
945
|
+
if (filters.createdBefore && compareTimestampStrings(item.created_at, filters.createdBefore) > 0)
|
|
946
|
+
return false;
|
|
947
|
+
return true;
|
|
948
|
+
}
|
|
949
|
+
function matchesOwnerSearchFilters(item, filters) {
|
|
950
|
+
if (filters.assigneeFilter !== void 0 && item.assignee !== filters.assigneeFilter)
|
|
951
|
+
return false;
|
|
952
|
+
if (filters.sprintFilter !== void 0 && item.sprint !== filters.sprintFilter)
|
|
953
|
+
return false;
|
|
954
|
+
if (filters.releaseFilter !== void 0 && item.release !== filters.releaseFilter)
|
|
955
|
+
return false;
|
|
956
|
+
if (filters.parentFilter !== void 0 && item.parent !== filters.parentFilter)
|
|
957
|
+
return false;
|
|
958
|
+
return true;
|
|
959
|
+
}
|
|
960
|
+
function matchesSearchMetadataFilters(document, filters, runtimeFieldFilters, lifecycleClassifier) {
|
|
961
|
+
const item = document.metadata;
|
|
962
|
+
if (!matchesScalarSearchFilters(item, filters)) {
|
|
963
|
+
return false;
|
|
964
|
+
}
|
|
965
|
+
if (!matchesRuntimeFilters(item, runtimeFieldFilters)) {
|
|
966
|
+
return false;
|
|
967
|
+
}
|
|
968
|
+
if (filters.missingMetadataActive && !itemMatchesMissingMetadata(item, filters.missingMetadataFilters, lifecycleClassifier)) {
|
|
969
|
+
return false;
|
|
970
|
+
}
|
|
971
|
+
if (filters.contentFiltersActive && !itemMatchesContentFilters(item, filters.contentFieldFilters)) {
|
|
972
|
+
return false;
|
|
973
|
+
}
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
976
|
+
function applyFilters(items, options, typeRegistry, runtimeFieldFilters, statusFilter, lifecycleClassifier) {
|
|
977
|
+
const filters = resolveSearchMetadataFilterSet(options, typeRegistry, statusFilter);
|
|
978
|
+
return items.filter((document) => matchesSearchMetadataFilters(document, filters, runtimeFieldFilters, lifecycleClassifier));
|
|
979
|
+
}
|
|
980
|
+
function countOccurrences(haystack, needle) {
|
|
981
|
+
let count = 0;
|
|
982
|
+
let index = 0;
|
|
983
|
+
while (true) {
|
|
984
|
+
const foundAt = haystack.indexOf(needle, index);
|
|
985
|
+
if (foundAt < 0) {
|
|
986
|
+
return count;
|
|
987
|
+
}
|
|
988
|
+
count += 1;
|
|
989
|
+
index = foundAt + needle.length;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
function tokenizeForExactTokenMatch(value) {
|
|
993
|
+
return tokenizeAlphaNumeric(value);
|
|
994
|
+
}
|
|
995
|
+
function collectLinkedPaths(item) {
|
|
996
|
+
const fromFiles = (item.files ?? []).map((entry) => ({
|
|
997
|
+
scope: entry.scope,
|
|
998
|
+
path: entry.path.trim()
|
|
999
|
+
}));
|
|
1000
|
+
const fromDocs = (item.docs ?? []).map((entry) => ({
|
|
1001
|
+
scope: entry.scope,
|
|
1002
|
+
path: entry.path.trim()
|
|
1003
|
+
}));
|
|
1004
|
+
const fromTests = (item.tests ?? []).filter((entry) => typeof entry.path === "string" && entry.path.trim().length > 0).map((entry) => ({
|
|
1005
|
+
scope: entry.scope,
|
|
1006
|
+
path: entry.path.trim()
|
|
1007
|
+
}));
|
|
1008
|
+
const sorted = [...fromFiles, ...fromDocs, ...fromTests].filter((entry) => entry.path.length > 0).sort((a, b) => a.scope.localeCompare(b.scope) || a.path.localeCompare(b.path));
|
|
1009
|
+
const deduped = /* @__PURE__ */ new Map();
|
|
1010
|
+
for (const entry of sorted) {
|
|
1011
|
+
deduped.set(`${entry.scope}:${entry.path}`, entry);
|
|
1012
|
+
}
|
|
1013
|
+
return [...deduped.values()];
|
|
1014
|
+
}
|
|
1015
|
+
async function resolveContainmentRoot(root) {
|
|
1016
|
+
const resolved = path.resolve(root);
|
|
1017
|
+
try {
|
|
1018
|
+
const realpathRoot = await fs.realpath(resolved);
|
|
1019
|
+
return {
|
|
1020
|
+
resolved,
|
|
1021
|
+
realpath: realpathRoot
|
|
1022
|
+
};
|
|
1023
|
+
} catch {
|
|
1024
|
+
return null;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
async function resolveLinkedCorpusRoots(projectRoot, globalRoot) {
|
|
1028
|
+
const [projectContainmentRoot, globalContainmentRoot] = await Promise.all([
|
|
1029
|
+
resolveContainmentRoot(projectRoot),
|
|
1030
|
+
resolveContainmentRoot(globalRoot)
|
|
1031
|
+
]);
|
|
1032
|
+
return {
|
|
1033
|
+
projectContainmentRoot,
|
|
1034
|
+
globalContainmentRoot
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
async function loadLinkedCorpus(document, roots) {
|
|
1038
|
+
const linkedPaths = collectLinkedPaths(document.metadata);
|
|
1039
|
+
const chunks = [];
|
|
1040
|
+
for (const linkedPath of linkedPaths) {
|
|
1041
|
+
const containmentRoot = linkedPath.scope === "global" ? roots.globalContainmentRoot : roots.projectContainmentRoot;
|
|
1042
|
+
if (!containmentRoot) {
|
|
1043
|
+
continue;
|
|
1044
|
+
}
|
|
1045
|
+
const resolved = path.resolve(containmentRoot.resolved, linkedPath.path);
|
|
1046
|
+
if (!isPathWithinDirectory(containmentRoot.resolved, resolved)) {
|
|
1047
|
+
continue;
|
|
1048
|
+
}
|
|
1049
|
+
let linkedRealpath;
|
|
1050
|
+
try {
|
|
1051
|
+
linkedRealpath = await fs.realpath(resolved);
|
|
1052
|
+
} catch {
|
|
1053
|
+
continue;
|
|
1054
|
+
}
|
|
1055
|
+
if (!isPathWithinDirectory(containmentRoot.realpath, linkedRealpath)) {
|
|
1056
|
+
continue;
|
|
1057
|
+
}
|
|
1058
|
+
try {
|
|
1059
|
+
await runActiveOnReadHooks({
|
|
1060
|
+
path: resolved,
|
|
1061
|
+
scope: linkedPath.scope
|
|
1062
|
+
});
|
|
1063
|
+
chunks.push(await fs.readFile(resolved, "utf8"));
|
|
1064
|
+
} catch {
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
return chunks.join("\n");
|
|
1068
|
+
}
|
|
1069
|
+
var SEARCHABLE_FIELD_BUILDERS = [
|
|
1070
|
+
{ name: "title", weightKey: "title_weight", value: (document) => document.metadata.title },
|
|
1071
|
+
{ name: "description", weightKey: "description_weight", value: (document) => document.metadata.description },
|
|
1072
|
+
{ name: "tags", weightKey: "tags_weight", value: (document) => stringArray(document.metadata.tags).join(" ") },
|
|
1073
|
+
{
|
|
1074
|
+
name: "status",
|
|
1075
|
+
weightKey: "status_weight",
|
|
1076
|
+
value: (document) => typeof document.metadata.status === "string" ? document.metadata.status : ""
|
|
1077
|
+
},
|
|
1078
|
+
{ name: "body", weightKey: "body_weight", value: (document) => document.body },
|
|
1079
|
+
{
|
|
1080
|
+
name: "comments",
|
|
1081
|
+
weightKey: "comments_weight",
|
|
1082
|
+
value: (document) => textEntries(document.metadata.comments).map((entry) => entry.text).join(" ")
|
|
1083
|
+
},
|
|
1084
|
+
{
|
|
1085
|
+
name: "notes",
|
|
1086
|
+
weightKey: "notes_weight",
|
|
1087
|
+
value: (document) => textEntries(document.metadata.notes).map((entry) => entry.text).join(" ")
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
name: "learnings",
|
|
1091
|
+
weightKey: "learnings_weight",
|
|
1092
|
+
value: (document) => textEntries(document.metadata.learnings).map((entry) => entry.text).join(" ")
|
|
1093
|
+
},
|
|
1094
|
+
{ name: "reminders", weightKey: "reminders_weight", value: (document) => buildReminderCorpus(document.metadata).join(" ") },
|
|
1095
|
+
{ name: "events", weightKey: "events_weight", value: (document) => buildEventCorpus(document.metadata).join(" ") },
|
|
1096
|
+
{
|
|
1097
|
+
name: "dependencies",
|
|
1098
|
+
weightKey: "dependencies_weight",
|
|
1099
|
+
value: (document) => dependencyEntries(document.metadata.dependencies).map((entry) => `${entry.id} ${entry.kind}`).join(" ")
|
|
1100
|
+
},
|
|
1101
|
+
{ name: "plan", weightKey: "body_weight", value: (document) => buildPlanFlatCorpus(document.metadata) }
|
|
1102
|
+
];
|
|
1103
|
+
var SEARCHABLE_FIELD_BUILDER_BY_NAME = new Map(SEARCHABLE_FIELD_BUILDERS.map((builder) => [builder.name, builder]));
|
|
1104
|
+
function escapeRegExpLiteral(value) {
|
|
1105
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1106
|
+
}
|
|
1107
|
+
function markTokenRuns(text, tokens) {
|
|
1108
|
+
const escaped = tokens.filter((token) => token.length > 0).sort((left, right) => right.length - left.length).map(escapeRegExpLiteral);
|
|
1109
|
+
if (escaped.length === 0) {
|
|
1110
|
+
return text;
|
|
1111
|
+
}
|
|
1112
|
+
const pattern = new RegExp(escaped.join("|"), "gi");
|
|
1113
|
+
return text.replace(pattern, (match) => `${HIGHLIGHT_OPEN}${match}${HIGHLIGHT_CLOSE}`);
|
|
1114
|
+
}
|
|
1115
|
+
function highlightFieldSnippet(text, tokens) {
|
|
1116
|
+
if (text.length === 0) {
|
|
1117
|
+
return null;
|
|
1118
|
+
}
|
|
1119
|
+
const lowerText = text.toLowerCase();
|
|
1120
|
+
let firstMatchIndex = -1;
|
|
1121
|
+
for (const token of tokens) {
|
|
1122
|
+
if (token.length === 0) {
|
|
1123
|
+
continue;
|
|
1124
|
+
}
|
|
1125
|
+
const index = lowerText.indexOf(token);
|
|
1126
|
+
if (index >= 0 && (firstMatchIndex < 0 || index < firstMatchIndex)) {
|
|
1127
|
+
firstMatchIndex = index;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
if (firstMatchIndex < 0) {
|
|
1131
|
+
return null;
|
|
1132
|
+
}
|
|
1133
|
+
const windowStart = Math.max(0, firstMatchIndex - HIGHLIGHT_SNIPPET_RADIUS);
|
|
1134
|
+
const windowEnd = Math.min(text.length, firstMatchIndex + HIGHLIGHT_SNIPPET_RADIUS);
|
|
1135
|
+
const marked = markTokenRuns(text.slice(windowStart, windowEnd), tokens);
|
|
1136
|
+
const prefix = windowStart > 0 ? "\u2026" : "";
|
|
1137
|
+
const suffix = windowEnd < text.length ? "\u2026" : "";
|
|
1138
|
+
return `${prefix}${marked}${suffix}`;
|
|
1139
|
+
}
|
|
1140
|
+
function buildHitHighlights(document, matchedFields, tokens) {
|
|
1141
|
+
const highlights = [];
|
|
1142
|
+
for (const field of matchedFields) {
|
|
1143
|
+
const builder = SEARCHABLE_FIELD_BUILDER_BY_NAME.get(field);
|
|
1144
|
+
if (builder === void 0) {
|
|
1145
|
+
continue;
|
|
1146
|
+
}
|
|
1147
|
+
const snippet = highlightFieldSnippet(builder.value(document), tokens);
|
|
1148
|
+
if (snippet !== null) {
|
|
1149
|
+
highlights.push({ field, snippet });
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
return highlights;
|
|
1153
|
+
}
|
|
1154
|
+
function buildSearchableScoringFields(document, linkedCorpus, tuning) {
|
|
1155
|
+
return [
|
|
1156
|
+
...SEARCHABLE_FIELD_BUILDERS.map((builder) => ({
|
|
1157
|
+
name: builder.name,
|
|
1158
|
+
value: builder.value(document),
|
|
1159
|
+
weight: tuning[builder.weightKey]
|
|
1160
|
+
})),
|
|
1161
|
+
{ name: "linked_content", value: linkedCorpus, weight: tuning.linked_content_weight }
|
|
1162
|
+
];
|
|
1163
|
+
}
|
|
1164
|
+
function buildExactIdSearchHit(item, normalizedQuery, idPrefix) {
|
|
1165
|
+
const normalizedId = normalizeSearchPhrase(item.id);
|
|
1166
|
+
const normalizedIdPrefix = typeof idPrefix === "string" ? idPrefix.trim().toLowerCase() : "";
|
|
1167
|
+
const normalizedIdPrefixPhrase = normalizeSearchPhrase(normalizedIdPrefix);
|
|
1168
|
+
const normalizedShortId = normalizedIdPrefixPhrase.length > 0 && normalizedId.startsWith(normalizedIdPrefixPhrase) ? normalizedId.slice(normalizedIdPrefixPhrase.length).trim() : normalizedId;
|
|
1169
|
+
if (normalizedQuery !== normalizedId && normalizedQuery !== normalizedShortId) {
|
|
1170
|
+
return null;
|
|
1171
|
+
}
|
|
1172
|
+
return {
|
|
1173
|
+
item,
|
|
1174
|
+
score: normalizedQuery === normalizedId ? EXACT_ID_MATCH_SCORE : SHORT_ID_MATCH_SCORE,
|
|
1175
|
+
matched_fields: ["id"],
|
|
1176
|
+
matched_all_terms: true,
|
|
1177
|
+
exact_id_match: true
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
function scoreTokenMatches(tokens, titleTokenCounts, searchableFields, tuning, state) {
|
|
1181
|
+
for (const token of tokens) {
|
|
1182
|
+
const exactTitleMatches = titleTokenCounts.get(token) ?? 0;
|
|
1183
|
+
if (exactTitleMatches > 0) {
|
|
1184
|
+
state.score += exactTitleMatches * tuning.title_exact_bonus;
|
|
1185
|
+
state.matched.add("title");
|
|
1186
|
+
state.matchedTokens.add(token);
|
|
1187
|
+
}
|
|
1188
|
+
for (const field of searchableFields) {
|
|
1189
|
+
const occurrences = countOccurrences(field.value.toLowerCase(), token);
|
|
1190
|
+
if (occurrences > 0) {
|
|
1191
|
+
state.score += occurrences * field.weight;
|
|
1192
|
+
state.matched.add(field.name);
|
|
1193
|
+
state.matchedTokens.add(token);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
function scorePhraseMatches(item, normalizedQuery, searchableFields, state) {
|
|
1199
|
+
const normalizedTitle = normalizeSearchPhrase(item.title);
|
|
1200
|
+
if (normalizedTitle === normalizedQuery) {
|
|
1201
|
+
state.score += LONG_QUERY_TITLE_EXACT_BONUS;
|
|
1202
|
+
state.matched.add("title");
|
|
1203
|
+
}
|
|
1204
|
+
for (const field of searchableFields) {
|
|
1205
|
+
const phraseOccurrences = countOccurrences(normalizeSearchPhrase(field.value), normalizedQuery);
|
|
1206
|
+
if (phraseOccurrences > 0) {
|
|
1207
|
+
state.score += phraseOccurrences * field.weight * LONG_QUERY_PHRASE_MULTIPLIER;
|
|
1208
|
+
state.matched.add(field.name);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
function scoreDocument(document, tokens, normalizedQuery, linkedCorpus, tuning, idPrefix, applyCoverageBonus = false) {
|
|
1213
|
+
const item = document.metadata;
|
|
1214
|
+
const exactIdHit = buildExactIdSearchHit(item, normalizedQuery, idPrefix);
|
|
1215
|
+
if (exactIdHit) {
|
|
1216
|
+
return exactIdHit;
|
|
1217
|
+
}
|
|
1218
|
+
const titleTokenCounts = /* @__PURE__ */ new Map();
|
|
1219
|
+
for (const token of tokenizeForExactTokenMatch(item.title)) {
|
|
1220
|
+
titleTokenCounts.set(token, (titleTokenCounts.get(token) ?? 0) + 1);
|
|
1221
|
+
}
|
|
1222
|
+
const searchableFields = buildSearchableScoringFields(document, linkedCorpus, tuning);
|
|
1223
|
+
const state = { score: 0, matched: /* @__PURE__ */ new Set(), matchedTokens: /* @__PURE__ */ new Set() };
|
|
1224
|
+
scoreTokenMatches(tokens, titleTokenCounts, searchableFields, tuning, state);
|
|
1225
|
+
const distinctTokens = new Set(tokens);
|
|
1226
|
+
const matchedAllTerms = distinctTokens.size > 0 && state.matchedTokens.size === distinctTokens.size;
|
|
1227
|
+
if (applyCoverageBonus && distinctTokens.size > 1 && matchedAllTerms) {
|
|
1228
|
+
state.score += ALL_TERMS_COVERAGE_BONUS;
|
|
1229
|
+
}
|
|
1230
|
+
const isLongPhraseQuery = tokens.length >= LONG_QUERY_TOKEN_THRESHOLD && normalizedQuery.includes(" ");
|
|
1231
|
+
if (isLongPhraseQuery) {
|
|
1232
|
+
scorePhraseMatches(item, normalizedQuery, searchableFields, state);
|
|
1233
|
+
}
|
|
1234
|
+
if (state.score <= 0) {
|
|
1235
|
+
return null;
|
|
1236
|
+
}
|
|
1237
|
+
return {
|
|
1238
|
+
item,
|
|
1239
|
+
score: state.score,
|
|
1240
|
+
matched_fields: [...state.matched].sort((a, b) => a.localeCompare(b)),
|
|
1241
|
+
matched_all_terms: matchedAllTerms
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
function sortHits(items, statusRegistry) {
|
|
1245
|
+
return [...items].sort((a, b) => {
|
|
1246
|
+
const byScore = b.score - a.score;
|
|
1247
|
+
if (byScore !== 0)
|
|
1248
|
+
return byScore;
|
|
1249
|
+
const aTerminal = isTerminalStatus(a.item.status, statusRegistry);
|
|
1250
|
+
const bTerminal = isTerminalStatus(b.item.status, statusRegistry);
|
|
1251
|
+
if (aTerminal !== bTerminal) {
|
|
1252
|
+
return aTerminal ? 1 : -1;
|
|
1253
|
+
}
|
|
1254
|
+
const byPriority = a.item.priority - b.item.priority;
|
|
1255
|
+
if (byPriority !== 0)
|
|
1256
|
+
return byPriority;
|
|
1257
|
+
const byUpdated = compareTimestampStrings(b.item.updated_at, a.item.updated_at);
|
|
1258
|
+
if (byUpdated !== 0)
|
|
1259
|
+
return byUpdated;
|
|
1260
|
+
return a.item.id.localeCompare(b.item.id);
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
function buildHybridLexicalScore(document, tokens, normalizedQuery, includeLinked, linkedCorpusById, tuning, idPrefix, applyCoverageBonus = false) {
|
|
1264
|
+
return scoreDocument(document, tokens, normalizedQuery, includeLinked ? linkedCorpusById.get(document.metadata.id) ?? "" : "", tuning, idPrefix, applyCoverageBonus);
|
|
1265
|
+
}
|
|
1266
|
+
function normalizeScoreMap(scoreById) {
|
|
1267
|
+
if (scoreById.size === 0) {
|
|
1268
|
+
return /* @__PURE__ */ new Map();
|
|
1269
|
+
}
|
|
1270
|
+
const values = [...scoreById.values()];
|
|
1271
|
+
const minScore = Math.min(...values);
|
|
1272
|
+
const maxScore = Math.max(...values);
|
|
1273
|
+
if (maxScore === minScore) {
|
|
1274
|
+
return new Map([...scoreById.keys()].map((id) => [id, 1]));
|
|
1275
|
+
}
|
|
1276
|
+
const normalized = /* @__PURE__ */ new Map();
|
|
1277
|
+
for (const [id, score] of scoreById) {
|
|
1278
|
+
normalized.set(id, (score - minScore) / (maxScore - minScore));
|
|
1279
|
+
}
|
|
1280
|
+
return normalized;
|
|
1281
|
+
}
|
|
1282
|
+
function resolveSearchMaxResults(settings) {
|
|
1283
|
+
const candidate = settings.search?.max_results;
|
|
1284
|
+
if (typeof candidate === "number" && Number.isFinite(candidate) && candidate > 0) {
|
|
1285
|
+
return Math.floor(candidate);
|
|
1286
|
+
}
|
|
1287
|
+
return 50;
|
|
1288
|
+
}
|
|
1289
|
+
function resolveSearchScoreThreshold(settings) {
|
|
1290
|
+
const candidate = settings.search?.score_threshold;
|
|
1291
|
+
if (typeof candidate === "number" && Number.isFinite(candidate)) {
|
|
1292
|
+
return candidate;
|
|
1293
|
+
}
|
|
1294
|
+
return 0;
|
|
1295
|
+
}
|
|
1296
|
+
function resolveHybridSemanticWeight(settings) {
|
|
1297
|
+
const candidate = settings.search?.hybrid_semantic_weight;
|
|
1298
|
+
if (typeof candidate === "number" && Number.isFinite(candidate) && candidate >= 0 && candidate <= 1) {
|
|
1299
|
+
return candidate;
|
|
1300
|
+
}
|
|
1301
|
+
return 0.7;
|
|
1302
|
+
}
|
|
1303
|
+
function resolveSearchTuning(settings) {
|
|
1304
|
+
const defaults = {
|
|
1305
|
+
title_exact_bonus: 10,
|
|
1306
|
+
title_weight: 8,
|
|
1307
|
+
description_weight: 5,
|
|
1308
|
+
tags_weight: 6,
|
|
1309
|
+
status_weight: 2,
|
|
1310
|
+
body_weight: 1,
|
|
1311
|
+
comments_weight: 1,
|
|
1312
|
+
notes_weight: 1,
|
|
1313
|
+
learnings_weight: 1,
|
|
1314
|
+
reminders_weight: 2,
|
|
1315
|
+
events_weight: 2,
|
|
1316
|
+
dependencies_weight: 3,
|
|
1317
|
+
linked_content_weight: 1
|
|
1318
|
+
};
|
|
1319
|
+
const tuning = settings.search?.tuning;
|
|
1320
|
+
if (!tuning)
|
|
1321
|
+
return defaults;
|
|
1322
|
+
const resolveWeight = (candidate, fallback) => {
|
|
1323
|
+
if (typeof candidate === "number" && Number.isFinite(candidate) && candidate >= 0) {
|
|
1324
|
+
return candidate;
|
|
1325
|
+
}
|
|
1326
|
+
return fallback;
|
|
1327
|
+
};
|
|
1328
|
+
return {
|
|
1329
|
+
title_exact_bonus: resolveWeight(tuning.title_exact_bonus, defaults.title_exact_bonus),
|
|
1330
|
+
title_weight: resolveWeight(tuning.title_weight, defaults.title_weight),
|
|
1331
|
+
description_weight: resolveWeight(tuning.description_weight, defaults.description_weight),
|
|
1332
|
+
tags_weight: resolveWeight(tuning.tags_weight, defaults.tags_weight),
|
|
1333
|
+
status_weight: resolveWeight(tuning.status_weight, defaults.status_weight),
|
|
1334
|
+
body_weight: resolveWeight(tuning.body_weight, defaults.body_weight),
|
|
1335
|
+
comments_weight: resolveWeight(tuning.comments_weight, defaults.comments_weight),
|
|
1336
|
+
notes_weight: resolveWeight(tuning.notes_weight, defaults.notes_weight),
|
|
1337
|
+
learnings_weight: resolveWeight(tuning.learnings_weight, defaults.learnings_weight),
|
|
1338
|
+
reminders_weight: resolveWeight(tuning.reminders_weight, defaults.reminders_weight),
|
|
1339
|
+
events_weight: resolveWeight(tuning.events_weight, defaults.events_weight),
|
|
1340
|
+
dependencies_weight: resolveWeight(tuning.dependencies_weight, defaults.dependencies_weight),
|
|
1341
|
+
linked_content_weight: resolveWeight(tuning.linked_content_weight, defaults.linked_content_weight)
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
function emptySearchResult(query, mode, matchMode, options, includeLinked, scoreThreshold, hybridSemanticWeight, queryExpansion, rerank, projection, warnings, runtimeFieldFilters, countOnly = false) {
|
|
1345
|
+
const countExtras = countOnly ? { total: 0, count_only: true } : {};
|
|
1346
|
+
const compactSummaryMode = projection.mode === "compact" && options.compact === true;
|
|
1347
|
+
if (compactSummaryMode) {
|
|
1348
|
+
const compactFilters = buildCompactSearchFilterSummary({
|
|
1349
|
+
mode,
|
|
1350
|
+
matchMode,
|
|
1351
|
+
options,
|
|
1352
|
+
includeLinked,
|
|
1353
|
+
titleExact: options.titleExact === true,
|
|
1354
|
+
phraseExact: options.phraseExact === true,
|
|
1355
|
+
scoreThreshold,
|
|
1356
|
+
hybridSemanticWeight,
|
|
1357
|
+
runtimeFieldFilters
|
|
1358
|
+
});
|
|
1359
|
+
return {
|
|
1360
|
+
query: query.trim(),
|
|
1361
|
+
mode,
|
|
1362
|
+
items: [],
|
|
1363
|
+
count: 0,
|
|
1364
|
+
...countExtras,
|
|
1365
|
+
filters: compactFilters,
|
|
1366
|
+
...warnings.length > 0 ? { warnings } : {}
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
const projectionFields = projection.mode === "full" ? null : [...projection.fields];
|
|
1370
|
+
return {
|
|
1371
|
+
query: query.trim(),
|
|
1372
|
+
mode,
|
|
1373
|
+
items: [],
|
|
1374
|
+
count: 0,
|
|
1375
|
+
...countExtras,
|
|
1376
|
+
filters: buildVerboseSearchFilters({
|
|
1377
|
+
effectiveMode: mode,
|
|
1378
|
+
matchMode,
|
|
1379
|
+
options,
|
|
1380
|
+
includeLinked,
|
|
1381
|
+
titleExact: options.titleExact === true,
|
|
1382
|
+
phraseExact: options.phraseExact === true,
|
|
1383
|
+
scoreThreshold,
|
|
1384
|
+
hybridSemanticWeight,
|
|
1385
|
+
queryExpansion,
|
|
1386
|
+
rerank,
|
|
1387
|
+
runtimeFieldFilters: runtimeFieldFilters ?? {}
|
|
1388
|
+
}),
|
|
1389
|
+
projection: {
|
|
1390
|
+
mode: projection.mode,
|
|
1391
|
+
fields: projectionFields
|
|
1392
|
+
},
|
|
1393
|
+
now: nowIso(),
|
|
1394
|
+
...warnings.length > 0 ? { warnings } : {}
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
function requireSemanticDependencies(requestedMode, providerResolution, vectorResolution, hasExtensionVectorQuery) {
|
|
1398
|
+
if (!providerResolution.active) {
|
|
1399
|
+
throw new PmCliError(`Search mode '${requestedMode}' requires a configured embedding provider in settings.providers.openai or settings.providers.ollama`, EXIT_CODE.USAGE);
|
|
1400
|
+
}
|
|
1401
|
+
if (!vectorResolution.active && !hasExtensionVectorQuery) {
|
|
1402
|
+
throw new PmCliError(`Search mode '${requestedMode}' requires a configured vector store in settings.vector_store.qdrant/settings.vector_store.lancedb or an extension adapter selected by settings.vector_store.adapter`, EXIT_CODE.USAGE);
|
|
1403
|
+
}
|
|
1404
|
+
return {
|
|
1405
|
+
provider: providerResolution.active,
|
|
1406
|
+
vectorStore: vectorResolution.active ?? null
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
var toOptionalNonEmptyString = toNonEmptyStringOrUndefined;
|
|
1410
|
+
function resolveExtensionSearchProviderByName(providerName) {
|
|
1411
|
+
const registrations = getActiveExtensionRegistrations();
|
|
1412
|
+
const resolved = resolveRegisteredSearchProvider(registrations, providerName);
|
|
1413
|
+
if (!resolved) {
|
|
1414
|
+
return null;
|
|
1415
|
+
}
|
|
1416
|
+
const runtimeDefinition = resolved.runtime_definition ?? resolved.definition;
|
|
1417
|
+
const query = runtimeDefinition.query;
|
|
1418
|
+
const queryExpansion = runtimeDefinition.queryExpansion ?? runtimeDefinition.query_expansion;
|
|
1419
|
+
const rerank = runtimeDefinition.rerank;
|
|
1420
|
+
const registeredName = toOptionalNonEmptyString(runtimeDefinition.name) ?? toOptionalNonEmptyString(resolved.definition.name) ?? providerName;
|
|
1421
|
+
if (!registeredName) {
|
|
1422
|
+
return null;
|
|
1423
|
+
}
|
|
1424
|
+
const hooks = {
|
|
1425
|
+
providerName: registeredName,
|
|
1426
|
+
...typeof query === "function" ? { query } : {},
|
|
1427
|
+
...typeof queryExpansion === "function" ? { queryExpansion } : {},
|
|
1428
|
+
...typeof rerank === "function" ? { rerank } : {}
|
|
1429
|
+
};
|
|
1430
|
+
if (!hooks.query && !hooks.queryExpansion && !hooks.rerank) {
|
|
1431
|
+
return null;
|
|
1432
|
+
}
|
|
1433
|
+
return hooks;
|
|
1434
|
+
}
|
|
1435
|
+
function resolveExtensionSearchProvider(settings) {
|
|
1436
|
+
const providerName = toOptionalNonEmptyString(settings.search?.provider);
|
|
1437
|
+
const resolved = resolveExtensionSearchProviderByName(providerName);
|
|
1438
|
+
if (!resolved?.query) {
|
|
1439
|
+
return null;
|
|
1440
|
+
}
|
|
1441
|
+
return {
|
|
1442
|
+
providerName: resolved.providerName,
|
|
1443
|
+
query: resolved.query
|
|
1444
|
+
};
|
|
1445
|
+
}
|
|
1446
|
+
function resolveExtensionVectorAdapter(settings) {
|
|
1447
|
+
const registrations = getActiveExtensionRegistrations();
|
|
1448
|
+
const adapterName = toOptionalNonEmptyString(settings.vector_store?.adapter);
|
|
1449
|
+
const resolved = resolveRegisteredVectorStoreAdapter(registrations, adapterName);
|
|
1450
|
+
if (!resolved) {
|
|
1451
|
+
return null;
|
|
1452
|
+
}
|
|
1453
|
+
const runtimeDefinition = resolved.runtime_definition ?? resolved.definition;
|
|
1454
|
+
const query = runtimeDefinition.query;
|
|
1455
|
+
if (typeof query !== "function") {
|
|
1456
|
+
return null;
|
|
1457
|
+
}
|
|
1458
|
+
const upsert = runtimeDefinition.upsert;
|
|
1459
|
+
const runtimeAdapterName = toOptionalNonEmptyString(runtimeDefinition.name) ?? toOptionalNonEmptyString(resolved.definition.name) ?? adapterName ?? "extension";
|
|
1460
|
+
return {
|
|
1461
|
+
adapterName: runtimeAdapterName,
|
|
1462
|
+
query,
|
|
1463
|
+
...typeof upsert === "function" ? { upsert } : {}
|
|
1464
|
+
};
|
|
1465
|
+
}
|
|
1466
|
+
function normalizeExtensionProviderHits(providerName, raw, filteredById) {
|
|
1467
|
+
const rawHits = Array.isArray(raw) ? raw : raw?.hits;
|
|
1468
|
+
if (!Array.isArray(rawHits)) {
|
|
1469
|
+
throw new PmCliError(`Extension search provider "${providerName}" must return an array of hits or { hits: [...] }`, EXIT_CODE.GENERIC_FAILURE);
|
|
1470
|
+
}
|
|
1471
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1472
|
+
const hits = [];
|
|
1473
|
+
for (const rawHit of rawHits) {
|
|
1474
|
+
if (typeof rawHit !== "object" || rawHit === null) {
|
|
1475
|
+
continue;
|
|
1476
|
+
}
|
|
1477
|
+
const id = toOptionalNonEmptyString(rawHit.id);
|
|
1478
|
+
const score = rawHit.score;
|
|
1479
|
+
if (!id || typeof score !== "number" || !Number.isFinite(score) || seen.has(id)) {
|
|
1480
|
+
continue;
|
|
1481
|
+
}
|
|
1482
|
+
const document = filteredById.get(id);
|
|
1483
|
+
if (!document) {
|
|
1484
|
+
continue;
|
|
1485
|
+
}
|
|
1486
|
+
const matchedFieldsRaw = rawHit.matched_fields;
|
|
1487
|
+
const matchedFields = Array.isArray(matchedFieldsRaw) && matchedFieldsRaw.every((entry) => typeof entry === "string") ? [...new Set(matchedFieldsRaw.map((entry) => entry.trim()).filter((entry) => entry.length > 0))].sort((a, b) => a.localeCompare(b)) : [`provider:${providerName}`];
|
|
1488
|
+
seen.add(id);
|
|
1489
|
+
hits.push({
|
|
1490
|
+
item: document.metadata,
|
|
1491
|
+
score,
|
|
1492
|
+
matched_fields: matchedFields
|
|
1493
|
+
});
|
|
1494
|
+
}
|
|
1495
|
+
return hits;
|
|
1496
|
+
}
|
|
1497
|
+
function buildSemanticHits(vectorHits, filteredById) {
|
|
1498
|
+
const semanticHits = [];
|
|
1499
|
+
const semanticScores = /* @__PURE__ */ new Map();
|
|
1500
|
+
for (const vectorHit of vectorHits) {
|
|
1501
|
+
if (semanticScores.has(vectorHit.id)) {
|
|
1502
|
+
continue;
|
|
1503
|
+
}
|
|
1504
|
+
const document = filteredById.get(vectorHit.id);
|
|
1505
|
+
if (!document) {
|
|
1506
|
+
continue;
|
|
1507
|
+
}
|
|
1508
|
+
semanticScores.set(vectorHit.id, vectorHit.score);
|
|
1509
|
+
semanticHits.push({
|
|
1510
|
+
item: document.metadata,
|
|
1511
|
+
score: vectorHit.score,
|
|
1512
|
+
matched_fields: ["semantic"]
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
return {
|
|
1516
|
+
semanticHits,
|
|
1517
|
+
semanticScores
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
function forceExactIdHitsToTop(rankedHits, keywordHits) {
|
|
1521
|
+
const exactIdHits = keywordHits.filter((hit) => hit.exact_id_match === true);
|
|
1522
|
+
if (exactIdHits.length === 0) {
|
|
1523
|
+
return rankedHits;
|
|
1524
|
+
}
|
|
1525
|
+
const exactIdIds = new Set(exactIdHits.map((hit) => hit.item.id));
|
|
1526
|
+
const remaining = rankedHits.filter((hit) => !exactIdIds.has(hit.item.id));
|
|
1527
|
+
const maxRemainingScore = remaining.reduce((max, hit) => Math.max(max, hit.score), 0);
|
|
1528
|
+
const orderedExactHits = exactIdHits.sort((left, right) => right.score - left.score);
|
|
1529
|
+
const bandBase = maxRemainingScore + orderedExactHits.length + 1;
|
|
1530
|
+
const promoted = orderedExactHits.map((hit, index) => ({
|
|
1531
|
+
// Spread the original keyword hit so flags like matched_all_terms /
|
|
1532
|
+
// exact_id_match are preserved; only the band-slot score and the id-only
|
|
1533
|
+
// matched_fields are overridden.
|
|
1534
|
+
...hit,
|
|
1535
|
+
// Higher band slot for earlier (higher original keyword score) hits.
|
|
1536
|
+
score: bandBase - index,
|
|
1537
|
+
matched_fields: ["id"]
|
|
1538
|
+
}));
|
|
1539
|
+
return [...promoted, ...remaining];
|
|
1540
|
+
}
|
|
1541
|
+
function combineHybridHits(filteredById, semanticScores, keywordHits, hybridSemanticWeight, semanticFieldLabel = "semantic") {
|
|
1542
|
+
const keywordScores = new Map(keywordHits.map((entry) => [entry.item.id, entry.score]));
|
|
1543
|
+
const keywordMatches = new Map(keywordHits.map((entry) => [entry.item.id, entry.matched_fields]));
|
|
1544
|
+
const normalizedSemantic = normalizeScoreMap(semanticScores);
|
|
1545
|
+
const normalizedKeyword = normalizeScoreMap(keywordScores);
|
|
1546
|
+
const candidateIds = /* @__PURE__ */ new Set([...semanticScores.keys(), ...keywordScores.keys()]);
|
|
1547
|
+
const keywordWeight = 1 - hybridSemanticWeight;
|
|
1548
|
+
return [...candidateIds].map((id) => {
|
|
1549
|
+
const document = filteredById.get(id);
|
|
1550
|
+
const semanticScore = normalizedSemantic.get(id) ?? 0;
|
|
1551
|
+
const keywordScore = normalizedKeyword.get(id) ?? 0;
|
|
1552
|
+
const combinedScore = semanticScore * hybridSemanticWeight + keywordScore * keywordWeight;
|
|
1553
|
+
if (combinedScore <= 0) {
|
|
1554
|
+
return null;
|
|
1555
|
+
}
|
|
1556
|
+
const matchedFields = /* @__PURE__ */ new Set();
|
|
1557
|
+
if (semanticScores.has(id)) {
|
|
1558
|
+
matchedFields.add(semanticFieldLabel);
|
|
1559
|
+
}
|
|
1560
|
+
for (const field of keywordMatches.get(id) ?? []) {
|
|
1561
|
+
matchedFields.add(field);
|
|
1562
|
+
}
|
|
1563
|
+
return {
|
|
1564
|
+
item: document.metadata,
|
|
1565
|
+
score: combinedScore,
|
|
1566
|
+
matched_fields: [...matchedFields].sort((a, b) => a.localeCompare(b))
|
|
1567
|
+
};
|
|
1568
|
+
}).filter((entry) => entry !== null);
|
|
1569
|
+
}
|
|
1570
|
+
function resolveBuiltInBm25Mode(params) {
|
|
1571
|
+
const normalized = params.configuredProvider?.trim().toLowerCase();
|
|
1572
|
+
if (normalized === "bm25") {
|
|
1573
|
+
return "explicit";
|
|
1574
|
+
}
|
|
1575
|
+
if (normalized === "auto" && !params.hasEmbeddingProvider && !params.hasExtensionSearchProvider) {
|
|
1576
|
+
return "auto-fallback";
|
|
1577
|
+
}
|
|
1578
|
+
return null;
|
|
1579
|
+
}
|
|
1580
|
+
function computeBuiltInBm25Hits(params) {
|
|
1581
|
+
const bm25Documents = params.filteredDocuments.map((document) => ({
|
|
1582
|
+
id: document.metadata.id,
|
|
1583
|
+
text: flattenSearchCorpusText(buildSearchCorpus(document, { fields: params.corpusFields }))
|
|
1584
|
+
}));
|
|
1585
|
+
const index = buildBm25Index(bm25Documents);
|
|
1586
|
+
const bm25Scores = scoreBm25Query(index, tokenizeBm25(params.query), params.bm25Params);
|
|
1587
|
+
const filteredById = new Map(params.filteredDocuments.map((document) => [document.metadata.id, document]));
|
|
1588
|
+
if (params.requestedMode === "semantic") {
|
|
1589
|
+
const semanticHits = [...bm25Scores].map(([id, score]) => ({
|
|
1590
|
+
item: filteredById.get(id).metadata,
|
|
1591
|
+
score,
|
|
1592
|
+
matched_fields: ["bm25"]
|
|
1593
|
+
}));
|
|
1594
|
+
return forceExactIdHitsToTop(semanticHits, params.keywordHits);
|
|
1595
|
+
}
|
|
1596
|
+
const hybridHits = combineHybridHits(filteredById, bm25Scores, params.keywordHits, params.hybridSemanticWeight, "bm25");
|
|
1597
|
+
return forceExactIdHitsToTop(hybridHits, params.keywordHits);
|
|
1598
|
+
}
|
|
1599
|
+
function mergeVectorHitsById(vectorHitGroups) {
|
|
1600
|
+
const bestById = /* @__PURE__ */ new Map();
|
|
1601
|
+
for (const group of vectorHitGroups) {
|
|
1602
|
+
for (const hit of group) {
|
|
1603
|
+
const existing = bestById.get(hit.id);
|
|
1604
|
+
if (!existing || hit.score > existing.score) {
|
|
1605
|
+
bestById.set(hit.id, hit);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
const merged = [...bestById.values()];
|
|
1610
|
+
merged.sort((left, right) => {
|
|
1611
|
+
if (left.score !== right.score) {
|
|
1612
|
+
return right.score - left.score;
|
|
1613
|
+
}
|
|
1614
|
+
return left.id.localeCompare(right.id);
|
|
1615
|
+
});
|
|
1616
|
+
return merged;
|
|
1617
|
+
}
|
|
1618
|
+
function buildRerankCorpus(document) {
|
|
1619
|
+
const metadata = document.metadata;
|
|
1620
|
+
const tags = Array.isArray(metadata?.tags) ? metadata.tags.join(" ") : "";
|
|
1621
|
+
return [
|
|
1622
|
+
metadata?.title,
|
|
1623
|
+
metadata?.description,
|
|
1624
|
+
metadata?.type,
|
|
1625
|
+
metadata?.status,
|
|
1626
|
+
tags,
|
|
1627
|
+
document.body
|
|
1628
|
+
].map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0).join("\n");
|
|
1629
|
+
}
|
|
1630
|
+
async function resolveExpandedSemanticQueries(context, queryTrimmed) {
|
|
1631
|
+
const baseExpandedQueries = context.queryExpansion.enabled ? buildDeterministicQueryExpansions(queryTrimmed, context.queryExpansion.max_queries) : [queryTrimmed];
|
|
1632
|
+
const expandedQueries = baseExpandedQueries.length > 0 ? baseExpandedQueries : [queryTrimmed];
|
|
1633
|
+
if (!context.queryExpansion.enabled) {
|
|
1634
|
+
return expandedQueries;
|
|
1635
|
+
}
|
|
1636
|
+
if (context.queryExpansionExtension?.expand) {
|
|
1637
|
+
try {
|
|
1638
|
+
const rawExpansion = await Promise.resolve(context.queryExpansionExtension.expand({
|
|
1639
|
+
query: queryTrimmed,
|
|
1640
|
+
mode: context.requestedMode,
|
|
1641
|
+
settings: context.settings
|
|
1642
|
+
}));
|
|
1643
|
+
return mergeQueryExpansions(expandedQueries, normalizeQueryExpansionOutput(rawExpansion), context.queryExpansion.max_queries);
|
|
1644
|
+
} catch {
|
|
1645
|
+
context.warnings.push(`search_query_expansion_provider_failed:${context.queryExpansionExtension.providerName}:using_builtin`);
|
|
1646
|
+
return expandedQueries;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
if (context.queryExpansion.provider && context.queryExpansion.provider !== "openai" && context.queryExpansion.provider !== "ollama") {
|
|
1650
|
+
context.warnings.push(`search_query_expansion_provider_unavailable:${context.queryExpansion.provider}:using_builtin`);
|
|
1651
|
+
}
|
|
1652
|
+
return expandedQueries;
|
|
1653
|
+
}
|
|
1654
|
+
async function executeSemanticVectorQuery(context, semanticVector, semanticLimit, vectorQueryOptions) {
|
|
1655
|
+
if (context.extensionVectorAdapter?.query) {
|
|
1656
|
+
try {
|
|
1657
|
+
return await Promise.resolve(context.extensionVectorAdapter.query({
|
|
1658
|
+
vector: semanticVector,
|
|
1659
|
+
limit: semanticLimit,
|
|
1660
|
+
settings: context.settings
|
|
1661
|
+
}));
|
|
1662
|
+
} catch (error) {
|
|
1663
|
+
if (!context.vectorStore) {
|
|
1664
|
+
throw new PmCliError(`Extension vector adapter query failed and no built-in fallback store is configured (${error instanceof Error ? error.message : String(error)})`, EXIT_CODE.GENERIC_FAILURE);
|
|
1665
|
+
}
|
|
1666
|
+
context.warnings.push(`search_vector_adapter_failed:${context.extensionVectorAdapter.adapterName}:using_builtin`);
|
|
1667
|
+
return await executeVectorQuery(context.vectorStore, semanticVector, semanticLimit, vectorQueryOptions);
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
if (context.vectorStore) {
|
|
1671
|
+
return await executeVectorQuery(context.vectorStore, semanticVector, semanticLimit, vectorQueryOptions);
|
|
1672
|
+
}
|
|
1673
|
+
throw new PmCliError("Semantic search requires either a configured vector store or an extension vector adapter query handler", EXIT_CODE.USAGE);
|
|
1674
|
+
}
|
|
1675
|
+
function buildRerankCandidateContexts(hybridHits, filteredById, topK) {
|
|
1676
|
+
const sortedForCandidates = [...hybridHits].sort((left, right) => {
|
|
1677
|
+
if (left.score !== right.score) {
|
|
1678
|
+
return right.score - left.score;
|
|
1679
|
+
}
|
|
1680
|
+
return left.item.id.localeCompare(right.item.id);
|
|
1681
|
+
});
|
|
1682
|
+
return sortedForCandidates.slice(0, topK).map((hit) => {
|
|
1683
|
+
const document = filteredById.get(hit.item.id);
|
|
1684
|
+
return document ? { hit, text: buildRerankCorpus(document) } : null;
|
|
1685
|
+
}).filter((entry) => entry !== null);
|
|
1686
|
+
}
|
|
1687
|
+
async function resolveExtensionRerankScores(context, queryTrimmed, candidateContexts) {
|
|
1688
|
+
if (!context.rerankExtension?.rerank) {
|
|
1689
|
+
return null;
|
|
1690
|
+
}
|
|
1691
|
+
try {
|
|
1692
|
+
const rawRerank = await Promise.resolve(context.rerankExtension.rerank({
|
|
1693
|
+
query: queryTrimmed,
|
|
1694
|
+
mode: "hybrid",
|
|
1695
|
+
model: context.rerank.model,
|
|
1696
|
+
top_k: context.rerank.top_k,
|
|
1697
|
+
settings: context.settings,
|
|
1698
|
+
candidates: candidateContexts.map((entry) => ({
|
|
1699
|
+
id: entry.hit.item.id,
|
|
1700
|
+
text: entry.text,
|
|
1701
|
+
score: entry.hit.score
|
|
1702
|
+
}))
|
|
1703
|
+
}));
|
|
1704
|
+
const normalizedRerank = normalizeRerankOutput(rawRerank);
|
|
1705
|
+
if (normalizedRerank.length > 0) {
|
|
1706
|
+
return new Map(normalizedRerank.map((entry) => [entry.id, entry.score]));
|
|
1707
|
+
}
|
|
1708
|
+
context.warnings.push(`search_rerank_provider_invalid_response:${context.rerankExtension.providerName}:using_builtin`);
|
|
1709
|
+
return null;
|
|
1710
|
+
} catch {
|
|
1711
|
+
context.warnings.push(`search_rerank_provider_failed:${context.rerankExtension.providerName}:using_builtin`);
|
|
1712
|
+
return null;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
async function resolveRerankScores(context, queryTrimmed, candidateContexts) {
|
|
1716
|
+
const extensionScores = await resolveExtensionRerankScores(context, queryTrimmed, candidateContexts);
|
|
1717
|
+
if (extensionScores) {
|
|
1718
|
+
return extensionScores;
|
|
1719
|
+
}
|
|
1720
|
+
const rerankCandidates = candidateContexts.map((entry) => ({
|
|
1721
|
+
id: entry.hit.item.id,
|
|
1722
|
+
text: entry.text
|
|
1723
|
+
}));
|
|
1724
|
+
try {
|
|
1725
|
+
return await rerankCandidatesWithEmbeddings(context.provider, context.rerank.model, queryTrimmed, rerankCandidates, context.embeddingTimeoutMs);
|
|
1726
|
+
} catch {
|
|
1727
|
+
context.warnings.push("search_rerank_failed:using_hybrid_scores");
|
|
1728
|
+
return null;
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
function applyRerankScores(hybridHits, rerankScores) {
|
|
1732
|
+
const rerankedIds = new Set(rerankScores.keys());
|
|
1733
|
+
const rerankedHits = hybridHits.map((hit) => {
|
|
1734
|
+
const rerankScore = rerankScores.get(hit.item.id);
|
|
1735
|
+
if (rerankScore === void 0) {
|
|
1736
|
+
return hit;
|
|
1737
|
+
}
|
|
1738
|
+
const matchedFields = new Set(hit.matched_fields);
|
|
1739
|
+
matchedFields.add("rerank");
|
|
1740
|
+
return {
|
|
1741
|
+
...hit,
|
|
1742
|
+
score: rerankScore,
|
|
1743
|
+
matched_fields: [...matchedFields].sort((left, right) => left.localeCompare(right))
|
|
1744
|
+
};
|
|
1745
|
+
});
|
|
1746
|
+
rerankedHits.sort((left, right) => {
|
|
1747
|
+
const leftWasReranked = rerankedIds.has(left.item.id);
|
|
1748
|
+
const rightWasReranked = rerankedIds.has(right.item.id);
|
|
1749
|
+
if (leftWasReranked !== rightWasReranked) {
|
|
1750
|
+
return leftWasReranked ? -1 : 1;
|
|
1751
|
+
}
|
|
1752
|
+
if (left.score !== right.score) {
|
|
1753
|
+
return right.score - left.score;
|
|
1754
|
+
}
|
|
1755
|
+
return left.item.id.localeCompare(right.item.id);
|
|
1756
|
+
});
|
|
1757
|
+
return rerankedHits;
|
|
1758
|
+
}
|
|
1759
|
+
async function applyHybridRerank(context, queryTrimmed, hybridHits, filteredById) {
|
|
1760
|
+
if (!context.rerank.enabled || hybridHits.length <= 1) {
|
|
1761
|
+
return hybridHits;
|
|
1762
|
+
}
|
|
1763
|
+
const candidateContexts = buildRerankCandidateContexts(hybridHits, filteredById, context.rerank.top_k);
|
|
1764
|
+
const rerankScores = await resolveRerankScores(context, queryTrimmed, candidateContexts);
|
|
1765
|
+
return rerankScores && rerankScores.size > 0 ? applyRerankScores(hybridHits, rerankScores) : hybridHits;
|
|
1766
|
+
}
|
|
1767
|
+
async function computeSemanticOrHybridHits(context) {
|
|
1768
|
+
const semanticLimit = context.limit ?? context.maxResults;
|
|
1769
|
+
const embeddingOptions = context.embeddingTimeoutMs !== void 0 ? { timeout_ms: context.embeddingTimeoutMs } : {};
|
|
1770
|
+
const vectorQueryOptions = context.vectorQueryTimeoutMs !== void 0 ? { timeout_ms: context.vectorQueryTimeoutMs } : {};
|
|
1771
|
+
const queryTrimmed = context.query.trim();
|
|
1772
|
+
const expandedQueries = await resolveExpandedSemanticQueries(context, queryTrimmed);
|
|
1773
|
+
const queryVectors = await executeEmbeddingRequest(context.provider, expandedQueries, embeddingOptions);
|
|
1774
|
+
const queryVectorGroups = await Promise.all(queryVectors.map(async (semanticVector) => await executeSemanticVectorQuery(context, semanticVector, semanticLimit, vectorQueryOptions)));
|
|
1775
|
+
const vectorHits = mergeVectorHitsById(queryVectorGroups);
|
|
1776
|
+
const filteredById = new Map(context.filteredDocuments.map((document) => [document.metadata.id, document]));
|
|
1777
|
+
const { semanticHits, semanticScores } = buildSemanticHits(vectorHits, filteredById);
|
|
1778
|
+
const vectorMatchCount = semanticScores.size;
|
|
1779
|
+
if (context.requestedMode === "semantic") {
|
|
1780
|
+
return { hits: forceExactIdHitsToTop(semanticHits, context.keywordHits), vectorMatchCount };
|
|
1781
|
+
}
|
|
1782
|
+
const hybridHits = await applyHybridRerank(context, queryTrimmed, combineHybridHits(filteredById, semanticScores, context.keywordHits, context.hybridSemanticWeight), filteredById);
|
|
1783
|
+
return {
|
|
1784
|
+
// GH-281: applied LAST (after any rerank reordering) so an exact full-ID /
|
|
1785
|
+
// short-ID keyword match always ranks #1 in hybrid mode regardless of the
|
|
1786
|
+
// semantic blend weight or rerank scores.
|
|
1787
|
+
hits: forceExactIdHitsToTop(hybridHits, context.keywordHits),
|
|
1788
|
+
vectorMatchCount
|
|
1789
|
+
};
|
|
1790
|
+
}
|
|
1791
|
+
async function loadDocuments(pmRoot, itemFormat, typeToFolder, schema) {
|
|
1792
|
+
const extensionFieldNames = collectRegisteredItemFieldNames(getActiveExtensionRegistrations());
|
|
1793
|
+
const readDocumentBody = async (metadata, preferredPath, preferredFormat) => {
|
|
1794
|
+
const tryRead = async (targetPath, format) => {
|
|
1795
|
+
await runActiveOnReadHooks({ path: targetPath, scope: "project" });
|
|
1796
|
+
const raw = await fs.readFile(targetPath, "utf8");
|
|
1797
|
+
const parsed = parseItemDocument(raw, {
|
|
1798
|
+
format,
|
|
1799
|
+
schema,
|
|
1800
|
+
extensionFieldNames,
|
|
1801
|
+
onWarning: (warning) => listWarnings.push(warning)
|
|
1802
|
+
});
|
|
1803
|
+
return parsed.body;
|
|
1804
|
+
};
|
|
1805
|
+
try {
|
|
1806
|
+
return await tryRead(preferredPath, preferredFormat);
|
|
1807
|
+
} catch {
|
|
1808
|
+
const alternateFormat = preferredFormat === "toon" ? "json_markdown" : "toon";
|
|
1809
|
+
const alternatePath = getItemPath(pmRoot, metadata.type, metadata.id, alternateFormat, typeToFolder);
|
|
1810
|
+
try {
|
|
1811
|
+
return await tryRead(alternatePath, alternateFormat);
|
|
1812
|
+
} catch {
|
|
1813
|
+
listWarnings.push(`item_list_item_read_failed:${path.relative(pmRoot, alternatePath)}`);
|
|
1814
|
+
return "";
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
};
|
|
1818
|
+
const listWarnings = [];
|
|
1819
|
+
const cachedDocuments = await listAllDocumentCandidatesCached(pmRoot, itemFormat, typeToFolder, listWarnings, schema);
|
|
1820
|
+
const documents = [];
|
|
1821
|
+
if (cachedDocuments.length === 0) {
|
|
1822
|
+
const frontMatterDocuments = await listAllFrontMatter(pmRoot, itemFormat, typeToFolder, listWarnings, schema);
|
|
1823
|
+
for (const metadata of frontMatterDocuments) {
|
|
1824
|
+
const preferredPath = getItemPath(pmRoot, metadata.type, metadata.id, itemFormat, typeToFolder);
|
|
1825
|
+
const body = await readDocumentBody(metadata, preferredPath, itemFormat);
|
|
1826
|
+
documents.push({ metadata, body });
|
|
1827
|
+
}
|
|
1828
|
+
return {
|
|
1829
|
+
documents,
|
|
1830
|
+
warnings: [...new Set(listWarnings)].sort((left, right) => left.localeCompare(right))
|
|
1831
|
+
};
|
|
1832
|
+
}
|
|
1833
|
+
for (const cachedDocument of cachedDocuments) {
|
|
1834
|
+
if (typeof cachedDocument.body === "string") {
|
|
1835
|
+
documents.push({
|
|
1836
|
+
metadata: cachedDocument.metadata,
|
|
1837
|
+
body: cachedDocument.body
|
|
1838
|
+
});
|
|
1839
|
+
continue;
|
|
1840
|
+
}
|
|
1841
|
+
const body = await readDocumentBody(cachedDocument.metadata, cachedDocument.item_path, cachedDocument.item_format);
|
|
1842
|
+
documents.push({
|
|
1843
|
+
metadata: cachedDocument.metadata,
|
|
1844
|
+
body
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
return {
|
|
1848
|
+
documents,
|
|
1849
|
+
warnings: [...new Set(listWarnings)].sort((left, right) => left.localeCompare(right))
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
function readSearchFieldValue(hit, field) {
|
|
1853
|
+
const normalized = field.trim();
|
|
1854
|
+
if (normalized.length === 0) {
|
|
1855
|
+
return null;
|
|
1856
|
+
}
|
|
1857
|
+
if (normalized === "score") {
|
|
1858
|
+
return hit.score;
|
|
1859
|
+
}
|
|
1860
|
+
if (normalized === "matched_fields") {
|
|
1861
|
+
return hit.matched_fields;
|
|
1862
|
+
}
|
|
1863
|
+
if (normalized.startsWith("item.")) {
|
|
1864
|
+
const itemKey = normalized.slice("item.".length);
|
|
1865
|
+
if (itemKey.length === 0) {
|
|
1866
|
+
return null;
|
|
1867
|
+
}
|
|
1868
|
+
const itemRecord2 = toItemRecord(hit.item);
|
|
1869
|
+
return itemRecord2[itemKey] ?? null;
|
|
1870
|
+
}
|
|
1871
|
+
const hitRecord = hit;
|
|
1872
|
+
const itemRecord = toItemRecord(hit.item);
|
|
1873
|
+
if (Object.prototype.hasOwnProperty.call(itemRecord, normalized)) {
|
|
1874
|
+
return itemRecord[normalized] ?? null;
|
|
1875
|
+
}
|
|
1876
|
+
if (Object.prototype.hasOwnProperty.call(hitRecord, normalized)) {
|
|
1877
|
+
return hitRecord[normalized] ?? null;
|
|
1878
|
+
}
|
|
1879
|
+
return null;
|
|
1880
|
+
}
|
|
1881
|
+
function projectSearchHits(hits, projection) {
|
|
1882
|
+
if (projection.mode === "full") {
|
|
1883
|
+
return hits.map(({ matched_all_terms: _matchedAllTerms, ...hit }) => hit);
|
|
1884
|
+
}
|
|
1885
|
+
return hits.map((hit) => {
|
|
1886
|
+
const projected = {};
|
|
1887
|
+
for (const field of projection.fields) {
|
|
1888
|
+
projected[field] = readSearchFieldValue(hit, field);
|
|
1889
|
+
}
|
|
1890
|
+
return projected;
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
function resolveQueryExpansionExtension(queryExpansion) {
|
|
1894
|
+
const provider = resolveExtensionSearchProviderByName(queryExpansion.provider ?? void 0);
|
|
1895
|
+
return provider?.queryExpansion ? { providerName: provider.providerName, expand: provider.queryExpansion } : null;
|
|
1896
|
+
}
|
|
1897
|
+
function resolveRerankExtension(settings) {
|
|
1898
|
+
const provider = resolveExtensionSearchProviderByName(toOptionalNonEmptyString(settings.search?.provider));
|
|
1899
|
+
return provider?.rerank ? { providerName: provider.providerName, rerank: provider.rerank } : null;
|
|
1900
|
+
}
|
|
1901
|
+
function prepareSearchInput(rawQuery, rawOptions) {
|
|
1902
|
+
const inlineWarnings = [];
|
|
1903
|
+
const inlineParse = parseInlineQueryFilters(rawQuery);
|
|
1904
|
+
const hasInlineFilters = Object.keys(inlineParse.inlineFilters).length > 0;
|
|
1905
|
+
if (hasInlineFilters && inlineParse.residualQuery.trim().length === 0) {
|
|
1906
|
+
throw new PmCliError("Inline field:value tokens consumed the entire query, leaving no search terms.", EXIT_CODE.USAGE, {
|
|
1907
|
+
examples: ["pm search auth tag:area:search", "pm list --tag area:search --status open"],
|
|
1908
|
+
nextSteps: [
|
|
1909
|
+
"Add keyword terms alongside the inline filters, or use pm list for pure tag/status/type/priority filtering."
|
|
1910
|
+
]
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
const query = hasInlineFilters ? inlineParse.residualQuery : rawQuery;
|
|
1914
|
+
const options = applyInlineQueryFilters(rawOptions, inlineParse.inlineFilters, inlineWarnings);
|
|
1915
|
+
return {
|
|
1916
|
+
query,
|
|
1917
|
+
options,
|
|
1918
|
+
inlineWarnings,
|
|
1919
|
+
highlight: options.highlight === true,
|
|
1920
|
+
includeLinked: parseIncludeLinked(options.includeLinked),
|
|
1921
|
+
titleExact: parseTitleExact(options.titleExact),
|
|
1922
|
+
phraseExact: parsePhraseExact(options.phraseExact),
|
|
1923
|
+
matchMode: parseMatchMode(typeof options.matchMode === "string" ? options.matchMode : void 0),
|
|
1924
|
+
minScoreOverride: parseMinScoreOverride(options.minScore),
|
|
1925
|
+
countOnly: options.count === true,
|
|
1926
|
+
tokens: parseTokens(query),
|
|
1927
|
+
normalizedQuery: normalizeSearchPhrase(query),
|
|
1928
|
+
limit: parseLimit(options.limit),
|
|
1929
|
+
projection: parseProjectionConfig(options),
|
|
1930
|
+
modeWasExplicit: typeof options.mode === "string" && options.mode.trim().length > 0
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
async function resolveSearchRuntimeContext(prepared, global) {
|
|
1934
|
+
const pmRoot = resolvePmRoot(process.cwd(), global.path);
|
|
1935
|
+
if (!await pathExists(getSettingsPath(pmRoot))) {
|
|
1936
|
+
throw new PmCliError(`Tracker is not initialized at ${pmRoot}. Run pm init first.`, EXIT_CODE.NOT_FOUND);
|
|
1937
|
+
}
|
|
1938
|
+
const storedSettings = await readSettings(pmRoot);
|
|
1939
|
+
const settings = resolveSettingsWithSemanticRuntimeDefaults(storedSettings).settings;
|
|
1940
|
+
const statusRegistry = resolveRuntimeStatusRegistry(settings.schema);
|
|
1941
|
+
const runtimeFieldRegistry = resolveRuntimeFieldRegistry(settings.schema);
|
|
1942
|
+
validateSearchProjectionFields(prepared.projection, runtimeFieldRegistry);
|
|
1943
|
+
const runtimeFieldFilters = collectRuntimeFilterValues(prepared.options, runtimeFieldRegistry, "search");
|
|
1944
|
+
const typeRegistry = resolveItemTypeRegistry(settings, getActiveExtensionRegistrations());
|
|
1945
|
+
const providerResolution = resolveEmbeddingProviders(settings);
|
|
1946
|
+
const vectorResolution = resolveVectorStores(settings);
|
|
1947
|
+
const extensionSearchProvider = resolveExtensionSearchProvider(settings);
|
|
1948
|
+
const extensionVectorAdapter = resolveExtensionVectorAdapter(settings);
|
|
1949
|
+
const semanticWeightOverride = parseSemanticWeightOverride(prepared.options.semanticWeight);
|
|
1950
|
+
const queryExpansion = resolveQueryExpansionConfig(settings, providerResolution.active?.name ?? null);
|
|
1951
|
+
const rerank = resolveRerankConfig(settings, providerResolution.active?.model ?? toOptionalNonEmptyString(settings.search?.embedding_model) ?? "text-embedding-3-small");
|
|
1952
|
+
return {
|
|
1953
|
+
pmRoot,
|
|
1954
|
+
settings,
|
|
1955
|
+
statusRegistry,
|
|
1956
|
+
runtimeFieldRegistry,
|
|
1957
|
+
runtimeFieldFilters,
|
|
1958
|
+
typeRegistry,
|
|
1959
|
+
maxResults: resolveSearchMaxResults(settings),
|
|
1960
|
+
scoreThreshold: prepared.minScoreOverride ?? resolveSearchScoreThreshold(settings),
|
|
1961
|
+
semanticWeightProvided: prepared.options.semanticWeight !== void 0,
|
|
1962
|
+
semanticWeightOverride,
|
|
1963
|
+
hybridSemanticWeight: semanticWeightOverride ?? resolveHybridSemanticWeight(settings),
|
|
1964
|
+
tuning: resolveSearchTuning(settings),
|
|
1965
|
+
providerResolution,
|
|
1966
|
+
vectorResolution,
|
|
1967
|
+
extensionSearchProvider,
|
|
1968
|
+
extensionVectorAdapter,
|
|
1969
|
+
bm25Mode: resolveBuiltInBm25Mode({
|
|
1970
|
+
configuredProvider: toOptionalNonEmptyString(settings.search?.provider),
|
|
1971
|
+
hasEmbeddingProvider: providerResolution.active !== null,
|
|
1972
|
+
hasExtensionSearchProvider: extensionSearchProvider !== null
|
|
1973
|
+
}),
|
|
1974
|
+
queryExpansion,
|
|
1975
|
+
queryExpansionExtension: resolveQueryExpansionExtension(queryExpansion),
|
|
1976
|
+
rerank,
|
|
1977
|
+
rerankExtension: resolveRerankExtension(settings),
|
|
1978
|
+
effectiveMode: parseMode(prepared.options.mode, {
|
|
1979
|
+
hasProvider: providerResolution.active !== null || extensionSearchProvider !== null,
|
|
1980
|
+
hasVectorStore: vectorResolution.active !== null || extensionVectorAdapter !== null
|
|
1981
|
+
})
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
async function loadFilteredSearchCorpus(prepared, runtime) {
|
|
1985
|
+
const loadedDocuments = await loadDocuments(runtime.pmRoot, runtime.settings.item_format ?? "toon", runtime.typeRegistry.type_to_folder, runtime.settings.schema);
|
|
1986
|
+
const statusFilter = parseStatusFilterCsv(typeof prepared.options.status === "string" ? prepared.options.status : void 0, runtime.statusRegistry, { strict: true });
|
|
1987
|
+
const lifecycleClassifier = lifecycleClassifierFromStatusRegistry(runtime.statusRegistry);
|
|
1988
|
+
const metadataFilteredDocuments = applyFilters(loadedDocuments.documents, prepared.options, runtime.typeRegistry, runtime.runtimeFieldFilters, statusFilter, lifecycleClassifier);
|
|
1989
|
+
return {
|
|
1990
|
+
warnings: loadedDocuments.warnings,
|
|
1991
|
+
allDocuments: loadedDocuments.documents,
|
|
1992
|
+
filteredDocuments: applyExactQueryFilters(metadataFilteredDocuments, prepared.normalizedQuery, {
|
|
1993
|
+
titleExact: prepared.titleExact,
|
|
1994
|
+
phraseExact: prepared.phraseExact || prepared.matchMode === "exact"
|
|
1995
|
+
})
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
async function collectLinkedCorpusById(includeLinked, effectiveMode, filteredDocuments) {
|
|
1999
|
+
const linkedCorpusById = /* @__PURE__ */ new Map();
|
|
2000
|
+
if (!includeLinked || effectiveMode !== "keyword" && effectiveMode !== "hybrid") {
|
|
2001
|
+
return linkedCorpusById;
|
|
2002
|
+
}
|
|
2003
|
+
const projectRoot = process.cwd();
|
|
2004
|
+
const linkedCorpusRoots = await resolveLinkedCorpusRoots(projectRoot, resolveGlobalPmRoot(projectRoot));
|
|
2005
|
+
const linkedCorpusEntries = await Promise.all(filteredDocuments.map(async (document) => [document.metadata.id, await loadLinkedCorpus(document, linkedCorpusRoots)]));
|
|
2006
|
+
for (const [id, corpus] of linkedCorpusEntries) {
|
|
2007
|
+
linkedCorpusById.set(id, corpus);
|
|
2008
|
+
}
|
|
2009
|
+
return linkedCorpusById;
|
|
2010
|
+
}
|
|
2011
|
+
async function computeKeywordSearchHits(prepared, runtime, filteredDocuments) {
|
|
2012
|
+
const linkedCorpusById = await collectLinkedCorpusById(prepared.includeLinked, runtime.effectiveMode, filteredDocuments);
|
|
2013
|
+
const applyCoverageBonus = prepared.matchMode === "or";
|
|
2014
|
+
return filteredDocuments.map((document) => buildHybridLexicalScore(document, prepared.tokens, prepared.normalizedQuery, prepared.includeLinked, linkedCorpusById, runtime.tuning, runtime.settings.id_prefix, applyCoverageBonus)).filter((entry) => entry !== null).filter((entry) => prepared.matchMode !== "and" || entry.matched_all_terms === true);
|
|
2015
|
+
}
|
|
2016
|
+
function buildEmptySearchResultFromContext(response, countOnly) {
|
|
2017
|
+
return emptySearchResult(response.query, response.effectiveMode, response.matchMode, response.options, response.includeLinked, response.scoreThreshold, response.hybridSemanticWeight, response.queryExpansion, response.rerank, response.projection, response.warnings, response.runtimeFieldFilters, countOnly);
|
|
2018
|
+
}
|
|
2019
|
+
async function executeBuiltInBm25Search(prepared, runtime, filteredDocuments, keywordHits, warnings) {
|
|
2020
|
+
if (runtime.bm25Mode === null || runtime.effectiveMode === "keyword") {
|
|
2021
|
+
return null;
|
|
2022
|
+
}
|
|
2023
|
+
const hits = computeBuiltInBm25Hits({
|
|
2024
|
+
requestedMode: runtime.effectiveMode,
|
|
2025
|
+
query: prepared.query,
|
|
2026
|
+
filteredDocuments,
|
|
2027
|
+
keywordHits,
|
|
2028
|
+
corpusFields: resolveSearchCorpusFields(runtime.settings),
|
|
2029
|
+
bm25Params: resolveBm25Params(runtime.settings),
|
|
2030
|
+
hybridSemanticWeight: runtime.hybridSemanticWeight
|
|
2031
|
+
});
|
|
2032
|
+
if (runtime.bm25Mode === "auto-fallback") {
|
|
2033
|
+
warnings.push(`search_${runtime.effectiveMode}_offline_bm25:no_embedding_provider:using_lexical_bm25`);
|
|
2034
|
+
}
|
|
2035
|
+
return hits;
|
|
2036
|
+
}
|
|
2037
|
+
async function executeExtensionSearchProvider(prepared, runtime, filteredDocuments, filteredById) {
|
|
2038
|
+
if (!runtime.extensionSearchProvider) {
|
|
2039
|
+
return null;
|
|
2040
|
+
}
|
|
2041
|
+
const canUseBuiltInSemantic = runtime.providerResolution.active !== null && (runtime.vectorResolution.active !== null || runtime.extensionVectorAdapter !== null);
|
|
2042
|
+
try {
|
|
2043
|
+
const providerResponse = await Promise.resolve(runtime.extensionSearchProvider.query({
|
|
2044
|
+
query: prepared.query,
|
|
2045
|
+
mode: runtime.effectiveMode,
|
|
2046
|
+
tokens: prepared.tokens,
|
|
2047
|
+
options: prepared.options,
|
|
2048
|
+
settings: runtime.settings,
|
|
2049
|
+
documents: filteredDocuments
|
|
2050
|
+
}));
|
|
2051
|
+
return normalizeExtensionProviderHits(runtime.extensionSearchProvider.providerName, providerResponse, filteredById);
|
|
2052
|
+
} catch (error) {
|
|
2053
|
+
if (!canUseBuiltInSemantic) {
|
|
2054
|
+
throw new PmCliError(`Extension search provider "${runtime.extensionSearchProvider.providerName}" failed: ${error instanceof Error ? error.message : String(error)}`, EXIT_CODE.GENERIC_FAILURE);
|
|
2055
|
+
}
|
|
2056
|
+
return null;
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
function maybeApplyNoVectorFallback(effectiveMode, semanticResult, keywordHits, warnings) {
|
|
2060
|
+
if (semanticResult.vectorMatchCount > 0) {
|
|
2061
|
+
return semanticResult.hits;
|
|
2062
|
+
}
|
|
2063
|
+
warnings.push(`search_${effectiveMode}_degraded:no_vector_matches:results_are_lexical`);
|
|
2064
|
+
return effectiveMode === "semantic" ? keywordHits : semanticResult.hits;
|
|
2065
|
+
}
|
|
2066
|
+
async function prepareBuiltInSemanticSearch(runtime, effectiveMode, filteredDocuments, warnings, modeWasExplicit) {
|
|
2067
|
+
const builtInSemanticWillRun = !runtime.extensionSearchProvider && runtime.providerResolution.active !== null && (runtime.vectorResolution.active !== null || runtime.extensionVectorAdapter !== null);
|
|
2068
|
+
if (modeWasExplicit && builtInSemanticWillRun) {
|
|
2069
|
+
await maybeEmitVectorIndexStaleWarning(runtime.pmRoot, filteredDocuments, warnings);
|
|
2070
|
+
}
|
|
2071
|
+
if (!runtime.extensionSearchProvider) {
|
|
2072
|
+
requireSemanticDependencies(effectiveMode, runtime.providerResolution, runtime.vectorResolution, runtime.extensionVectorAdapter !== null);
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
async function executeSemanticSearch(input) {
|
|
2076
|
+
const { prepared, runtime, filteredDocuments, keywordHits, warnings, modeWasExplicit } = input;
|
|
2077
|
+
let hits = keywordHits;
|
|
2078
|
+
const bm25Hits = await executeBuiltInBm25Search(prepared, runtime, filteredDocuments, keywordHits, warnings);
|
|
2079
|
+
const semanticMode = runtime.effectiveMode;
|
|
2080
|
+
if (bm25Hits !== null || semanticMode === "keyword") {
|
|
2081
|
+
return { effectiveMode: runtime.effectiveMode, hits: bm25Hits ?? hits };
|
|
2082
|
+
}
|
|
2083
|
+
try {
|
|
2084
|
+
await prepareBuiltInSemanticSearch(runtime, semanticMode, filteredDocuments, warnings, modeWasExplicit);
|
|
2085
|
+
if (filteredDocuments.length === 0 || prepared.limit === 0) {
|
|
2086
|
+
return { effectiveMode: runtime.effectiveMode, hits: [] };
|
|
2087
|
+
}
|
|
2088
|
+
const filteredById = new Map(filteredDocuments.map((document) => [document.metadata.id, document]));
|
|
2089
|
+
hits = await executeExtensionSearchProvider(prepared, runtime, filteredDocuments, filteredById) ?? hits;
|
|
2090
|
+
if (hits === keywordHits) {
|
|
2091
|
+
const { provider, vectorStore } = requireSemanticDependencies(semanticMode, runtime.providerResolution, runtime.vectorResolution, runtime.extensionVectorAdapter !== null);
|
|
2092
|
+
const semanticResult = await computeSemanticOrHybridHits({
|
|
2093
|
+
requestedMode: semanticMode,
|
|
2094
|
+
query: prepared.query,
|
|
2095
|
+
filteredDocuments,
|
|
2096
|
+
keywordHits,
|
|
2097
|
+
hybridSemanticWeight: runtime.hybridSemanticWeight,
|
|
2098
|
+
limit: prepared.limit,
|
|
2099
|
+
maxResults: runtime.maxResults,
|
|
2100
|
+
provider,
|
|
2101
|
+
vectorStore,
|
|
2102
|
+
extensionVectorAdapter: runtime.extensionVectorAdapter,
|
|
2103
|
+
queryExpansion: runtime.queryExpansion,
|
|
2104
|
+
queryExpansionExtension: runtime.queryExpansionExtension,
|
|
2105
|
+
rerank: runtime.rerank,
|
|
2106
|
+
rerankExtension: runtime.rerankExtension,
|
|
2107
|
+
warnings,
|
|
2108
|
+
settings: runtime.settings
|
|
2109
|
+
});
|
|
2110
|
+
hits = maybeApplyNoVectorFallback(semanticMode, semanticResult, keywordHits, warnings);
|
|
2111
|
+
}
|
|
2112
|
+
return { effectiveMode: runtime.effectiveMode, hits };
|
|
2113
|
+
} catch (error) {
|
|
2114
|
+
warnings.push(buildExplicitSemanticFallbackWarning(runtime.effectiveMode, error));
|
|
2115
|
+
return { effectiveMode: "keyword", hits: keywordHits };
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
function buildCountOnlySearchResult(response, total) {
|
|
2119
|
+
if (response.projection.mode === "compact" && response.options.compact === true) {
|
|
2120
|
+
return withSearchWarnings({
|
|
2121
|
+
query: response.query.trim(),
|
|
2122
|
+
mode: response.effectiveMode,
|
|
2123
|
+
items: [],
|
|
2124
|
+
count: total,
|
|
2125
|
+
total,
|
|
2126
|
+
count_only: true,
|
|
2127
|
+
filters: buildCompactSearchFilterSummary({
|
|
2128
|
+
mode: response.effectiveMode,
|
|
2129
|
+
matchMode: response.matchMode,
|
|
2130
|
+
options: response.options,
|
|
2131
|
+
includeLinked: response.includeLinked,
|
|
2132
|
+
titleExact: response.titleExact,
|
|
2133
|
+
phraseExact: response.phraseExact,
|
|
2134
|
+
scoreThreshold: response.scoreThreshold,
|
|
2135
|
+
hybridSemanticWeight: response.hybridSemanticWeight,
|
|
2136
|
+
runtimeFieldFilters: response.runtimeFieldFilters
|
|
2137
|
+
})
|
|
2138
|
+
}, response.warnings);
|
|
2139
|
+
}
|
|
2140
|
+
const projectionFields = response.projection.mode === "full" ? null : [...response.projection.fields];
|
|
2141
|
+
return withSearchWarnings({
|
|
2142
|
+
query: response.query.trim(),
|
|
2143
|
+
mode: response.effectiveMode,
|
|
2144
|
+
items: [],
|
|
2145
|
+
count: total,
|
|
2146
|
+
total,
|
|
2147
|
+
count_only: true,
|
|
2148
|
+
filters: buildVerboseSearchFilters({
|
|
2149
|
+
effectiveMode: response.effectiveMode,
|
|
2150
|
+
matchMode: response.matchMode,
|
|
2151
|
+
options: response.options,
|
|
2152
|
+
includeLinked: response.includeLinked,
|
|
2153
|
+
titleExact: response.titleExact,
|
|
2154
|
+
phraseExact: response.phraseExact,
|
|
2155
|
+
scoreThreshold: response.scoreThreshold,
|
|
2156
|
+
hybridSemanticWeight: response.hybridSemanticWeight,
|
|
2157
|
+
queryExpansion: response.queryExpansion,
|
|
2158
|
+
rerank: response.rerank,
|
|
2159
|
+
runtimeFieldFilters: response.runtimeFieldFilters
|
|
2160
|
+
}),
|
|
2161
|
+
projection: {
|
|
2162
|
+
mode: response.projection.mode,
|
|
2163
|
+
fields: projectionFields
|
|
2164
|
+
},
|
|
2165
|
+
now: nowIso()
|
|
2166
|
+
}, response.warnings);
|
|
2167
|
+
}
|
|
2168
|
+
function withSearchWarnings(result, warnings) {
|
|
2169
|
+
if (warnings.length === 0) {
|
|
2170
|
+
return result;
|
|
2171
|
+
}
|
|
2172
|
+
return { ...result, warnings };
|
|
2173
|
+
}
|
|
2174
|
+
function attachSearchHighlights(prepared, filteredDocuments, limited) {
|
|
2175
|
+
if (!prepared.highlight) {
|
|
2176
|
+
return { hits: limited, projection: prepared.projection };
|
|
2177
|
+
}
|
|
2178
|
+
const documentById = new Map(filteredDocuments.map((document) => [document.metadata.id, document]));
|
|
2179
|
+
const hits = limited.map((hit) => ({
|
|
2180
|
+
...hit,
|
|
2181
|
+
highlights: buildHitHighlights(documentById.get(hit.item.id), hit.matched_fields, prepared.tokens)
|
|
2182
|
+
}));
|
|
2183
|
+
if (prepared.projection.mode === "full" || prepared.projection.fields.includes("highlights")) {
|
|
2184
|
+
return { hits, projection: prepared.projection };
|
|
2185
|
+
}
|
|
2186
|
+
return { hits, projection: { mode: prepared.projection.mode, fields: [...prepared.projection.fields, "highlights"] } };
|
|
2187
|
+
}
|
|
2188
|
+
function buildSearchResultForHits(response, projectedItems, total, limitedCount, effectiveProjection) {
|
|
2189
|
+
const truncationExtras = limitedCount < total ? { total } : {};
|
|
2190
|
+
if (response.projection.mode === "compact" && response.options.compact === true) {
|
|
2191
|
+
return withSearchWarnings({
|
|
2192
|
+
query: response.query.trim(),
|
|
2193
|
+
mode: response.effectiveMode,
|
|
2194
|
+
items: projectedItems,
|
|
2195
|
+
count: projectedItems.length,
|
|
2196
|
+
...truncationExtras,
|
|
2197
|
+
filters: buildCompactSearchFilterSummary({
|
|
2198
|
+
mode: response.effectiveMode,
|
|
2199
|
+
matchMode: response.matchMode,
|
|
2200
|
+
options: response.options,
|
|
2201
|
+
includeLinked: response.includeLinked,
|
|
2202
|
+
titleExact: response.titleExact,
|
|
2203
|
+
phraseExact: response.phraseExact,
|
|
2204
|
+
scoreThreshold: response.scoreThreshold,
|
|
2205
|
+
hybridSemanticWeight: response.hybridSemanticWeight,
|
|
2206
|
+
runtimeFieldFilters: response.runtimeFieldFilters
|
|
2207
|
+
})
|
|
2208
|
+
}, response.warnings);
|
|
2209
|
+
}
|
|
2210
|
+
const finalProjectionFields = effectiveProjection.mode === "full" ? null : [...effectiveProjection.fields];
|
|
2211
|
+
return {
|
|
2212
|
+
query: response.query.trim(),
|
|
2213
|
+
mode: response.effectiveMode,
|
|
2214
|
+
items: projectedItems,
|
|
2215
|
+
count: projectedItems.length,
|
|
2216
|
+
...truncationExtras,
|
|
2217
|
+
filters: buildVerboseSearchFilters({
|
|
2218
|
+
effectiveMode: response.effectiveMode,
|
|
2219
|
+
matchMode: response.matchMode,
|
|
2220
|
+
options: response.options,
|
|
2221
|
+
includeLinked: response.includeLinked,
|
|
2222
|
+
titleExact: response.titleExact,
|
|
2223
|
+
phraseExact: response.phraseExact,
|
|
2224
|
+
scoreThreshold: response.scoreThreshold,
|
|
2225
|
+
hybridSemanticWeight: response.hybridSemanticWeight,
|
|
2226
|
+
queryExpansion: response.queryExpansion,
|
|
2227
|
+
rerank: response.rerank,
|
|
2228
|
+
runtimeFieldFilters: response.runtimeFieldFilters
|
|
2229
|
+
}),
|
|
2230
|
+
projection: {
|
|
2231
|
+
mode: effectiveProjection.mode,
|
|
2232
|
+
fields: finalProjectionFields
|
|
2233
|
+
},
|
|
2234
|
+
now: nowIso(),
|
|
2235
|
+
...response.warnings.length > 0 ? { warnings: response.warnings } : {}
|
|
2236
|
+
};
|
|
2237
|
+
}
|
|
2238
|
+
async function runSearch(rawQuery, rawOptions, global) {
|
|
2239
|
+
const prepared = prepareSearchInput(rawQuery, rawOptions);
|
|
2240
|
+
const runtime = await resolveSearchRuntimeContext(prepared, global);
|
|
2241
|
+
const corpus = await loadFilteredSearchCorpus(prepared, runtime);
|
|
2242
|
+
const warnings = corpus.warnings;
|
|
2243
|
+
warnings.push(...prepared.inlineWarnings);
|
|
2244
|
+
if (runtime.effectiveMode === "hybrid" && runtime.semanticWeightProvided && runtime.semanticWeightOverride === void 0) {
|
|
2245
|
+
warnings.push("search_hybrid_semantic_weight_override_invalid:using_settings_default");
|
|
2246
|
+
}
|
|
2247
|
+
const responseBase = {
|
|
2248
|
+
query: prepared.query,
|
|
2249
|
+
matchMode: prepared.matchMode,
|
|
2250
|
+
options: prepared.options,
|
|
2251
|
+
includeLinked: prepared.includeLinked,
|
|
2252
|
+
titleExact: prepared.titleExact,
|
|
2253
|
+
phraseExact: prepared.phraseExact,
|
|
2254
|
+
scoreThreshold: runtime.scoreThreshold,
|
|
2255
|
+
hybridSemanticWeight: runtime.hybridSemanticWeight,
|
|
2256
|
+
queryExpansion: runtime.queryExpansion,
|
|
2257
|
+
rerank: runtime.rerank,
|
|
2258
|
+
projection: prepared.projection,
|
|
2259
|
+
warnings,
|
|
2260
|
+
runtimeFieldFilters: runtime.runtimeFieldFilters
|
|
2261
|
+
};
|
|
2262
|
+
if (runtime.effectiveMode === "keyword" && (corpus.filteredDocuments.length === 0 || prepared.limit === 0)) {
|
|
2263
|
+
return buildEmptySearchResultFromContext({ ...responseBase, effectiveMode: runtime.effectiveMode }, prepared.countOnly);
|
|
2264
|
+
}
|
|
2265
|
+
const keywordHits = await computeKeywordSearchHits(prepared, runtime, corpus.filteredDocuments);
|
|
2266
|
+
const modeResult = await executeSemanticSearch({
|
|
2267
|
+
prepared,
|
|
2268
|
+
runtime,
|
|
2269
|
+
filteredDocuments: corpus.filteredDocuments,
|
|
2270
|
+
keywordHits,
|
|
2271
|
+
warnings,
|
|
2272
|
+
modeWasExplicit: prepared.modeWasExplicit
|
|
2273
|
+
});
|
|
2274
|
+
if (modeResult.effectiveMode !== "keyword" && modeResult.hits.length === 0 && (corpus.filteredDocuments.length === 0 || prepared.limit === 0)) {
|
|
2275
|
+
return buildEmptySearchResultFromContext({ ...responseBase, effectiveMode: modeResult.effectiveMode }, prepared.countOnly);
|
|
2276
|
+
}
|
|
2277
|
+
const thresholded = modeResult.hits.filter((entry) => entry.exact_id_match === true || entry.score >= runtime.scoreThreshold);
|
|
2278
|
+
const sorted = sortHits(thresholded, runtime.statusRegistry);
|
|
2279
|
+
const total = sorted.length;
|
|
2280
|
+
const resolvedLimit = prepared.limit ?? runtime.maxResults;
|
|
2281
|
+
const limited = sorted.slice(0, resolvedLimit);
|
|
2282
|
+
const response = { ...responseBase, effectiveMode: modeResult.effectiveMode };
|
|
2283
|
+
if (prepared.countOnly) {
|
|
2284
|
+
return buildCountOnlySearchResult(response, total);
|
|
2285
|
+
}
|
|
2286
|
+
const { hits: projectedHits, projection: effectiveProjection } = attachSearchHighlights(prepared, corpus.filteredDocuments, limited);
|
|
2287
|
+
const projectedItems = projectSearchHits(projectedHits, effectiveProjection);
|
|
2288
|
+
return buildSearchResultForHits(response, projectedItems, total, limited.length, effectiveProjection);
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
export {
|
|
2292
|
+
normalizeLowercaseWhitespace,
|
|
2293
|
+
tokenizeAlphaNumeric,
|
|
2294
|
+
jaccardSimilarity,
|
|
2295
|
+
collectErrorCauseCodes,
|
|
2296
|
+
classifyImplicitSemanticFallbackReason,
|
|
2297
|
+
_testOnlySearchCommand,
|
|
2298
|
+
resolveSearchMaxResults,
|
|
2299
|
+
resolveSearchScoreThreshold,
|
|
2300
|
+
resolveHybridSemanticWeight,
|
|
2301
|
+
resolveSearchTuning,
|
|
2302
|
+
runSearch
|
|
2303
|
+
};
|
|
2304
|
+
//# sourceMappingURL=chunk-TZXRBVAM.js.map
|
|
2305
|
+
|
|
2306
|
+
//# debugId=106509f0-71e6-5a15-915f-acf57240a3e4
|