@unbrained/pm-cli 2026.5.30 → 2026.6.5

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.
Files changed (578) hide show
  1. package/CHANGELOG.md +152 -0
  2. package/dist/cli/argv-utils.js +7 -3
  3. package/dist/cli/argv-utils.js.map +1 -1
  4. package/dist/cli/bootstrap-args.d.ts +1 -0
  5. package/dist/cli/bootstrap-args.js +23 -3
  6. package/dist/cli/bootstrap-args.js.map +1 -1
  7. package/dist/cli/commands/calendar.js +96 -10
  8. package/dist/cli/commands/calendar.js.map +1 -1
  9. package/dist/cli/commands/close-many.d.ts +63 -0
  10. package/dist/cli/commands/close-many.js +302 -0
  11. package/dist/cli/commands/close-many.js.map +1 -0
  12. package/dist/cli/commands/completion.d.ts +1 -0
  13. package/dist/cli/commands/completion.js +241 -27
  14. package/dist/cli/commands/completion.js.map +1 -1
  15. package/dist/cli/commands/config.d.ts +4 -4
  16. package/dist/cli/commands/config.js +115 -3
  17. package/dist/cli/commands/config.js.map +1 -1
  18. package/dist/cli/commands/contracts.js +191 -162
  19. package/dist/cli/commands/contracts.js.map +1 -1
  20. package/dist/cli/commands/create.d.ts +1 -0
  21. package/dist/cli/commands/create.js +109 -116
  22. package/dist/cli/commands/create.js.map +1 -1
  23. package/dist/cli/commands/extension/doctor.d.ts +12 -0
  24. package/dist/cli/commands/extension/doctor.js +97 -2
  25. package/dist/cli/commands/extension/doctor.js.map +1 -1
  26. package/dist/cli/commands/extension/install-sources.d.ts +2 -0
  27. package/dist/cli/commands/extension/install-sources.js +11 -4
  28. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  29. package/dist/cli/commands/extension/scaffold.js +49 -48
  30. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  31. package/dist/cli/commands/extension.js +51 -23
  32. package/dist/cli/commands/extension.js.map +1 -1
  33. package/dist/cli/commands/get.js +7 -7
  34. package/dist/cli/commands/get.js.map +1 -1
  35. package/dist/cli/commands/health.js +38 -3
  36. package/dist/cli/commands/health.js.map +1 -1
  37. package/dist/cli/commands/index.d.ts +2 -1
  38. package/dist/cli/commands/index.js +4 -3
  39. package/dist/cli/commands/index.js.map +1 -1
  40. package/dist/cli/commands/init.d.ts +10 -0
  41. package/dist/cli/commands/init.js +107 -4
  42. package/dist/cli/commands/init.js.map +1 -1
  43. package/dist/cli/commands/list.d.ts +5 -0
  44. package/dist/cli/commands/list.js +58 -26
  45. package/dist/cli/commands/list.js.map +1 -1
  46. package/dist/cli/commands/reindex.js +164 -48
  47. package/dist/cli/commands/reindex.js.map +1 -1
  48. package/dist/cli/commands/repeatable-metadata-parsers.d.ts +15 -0
  49. package/dist/cli/commands/repeatable-metadata-parsers.js +120 -0
  50. package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -0
  51. package/dist/cli/commands/restore.js +25 -4
  52. package/dist/cli/commands/restore.js.map +1 -1
  53. package/dist/cli/commands/schema.d.ts +122 -1
  54. package/dist/cli/commands/schema.js +536 -6
  55. package/dist/cli/commands/schema.js.map +1 -1
  56. package/dist/cli/commands/search.d.ts +18 -0
  57. package/dist/cli/commands/search.js +56 -12
  58. package/dist/cli/commands/search.js.map +1 -1
  59. package/dist/cli/commands/test.js +4 -3
  60. package/dist/cli/commands/test.js.map +1 -1
  61. package/dist/cli/commands/update-many.js +69 -140
  62. package/dist/cli/commands/update-many.js.map +1 -1
  63. package/dist/cli/commands/update.d.ts +2 -0
  64. package/dist/cli/commands/update.js +138 -119
  65. package/dist/cli/commands/update.js.map +1 -1
  66. package/dist/cli/commands/validate.d.ts +1 -0
  67. package/dist/cli/commands/validate.js +63 -33
  68. package/dist/cli/commands/validate.js.map +1 -1
  69. package/dist/cli/error-guidance.js +26 -3
  70. package/dist/cli/error-guidance.js.map +1 -1
  71. package/dist/cli/help-content.js +82 -3
  72. package/dist/cli/help-content.js.map +1 -1
  73. package/dist/cli/main.js +377 -23
  74. package/dist/cli/main.js.map +1 -1
  75. package/dist/cli/register-list-query.js +16 -12
  76. package/dist/cli/register-list-query.js.map +1 -1
  77. package/dist/cli/register-mutation.js +217 -47
  78. package/dist/cli/register-mutation.js.map +1 -1
  79. package/dist/cli/register-operations.js +34 -25
  80. package/dist/cli/register-operations.js.map +1 -1
  81. package/dist/cli/register-setup.js +8 -8
  82. package/dist/cli/register-setup.js.map +1 -1
  83. package/dist/cli/registration-helpers.js +35 -5
  84. package/dist/cli/registration-helpers.js.map +1 -1
  85. package/dist/cli/search-refresh.d.ts +2 -0
  86. package/dist/cli/search-refresh.js +13 -0
  87. package/dist/cli/search-refresh.js.map +1 -0
  88. package/dist/cli-bundle/chunks/activity-3RWRRNOW.js +20 -0
  89. package/dist/cli-bundle/chunks/activity-3RWRRNOW.js.map +1 -0
  90. package/dist/cli-bundle/chunks/activity-P5BUMWP3.js +16 -0
  91. package/dist/cli-bundle/chunks/activity-P5BUMWP3.js.map +7 -0
  92. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js +206 -0
  93. package/dist/cli-bundle/chunks/aggregate-J35K7WZB.js.map +1 -0
  94. package/dist/cli-bundle/chunks/aggregate-OOAGKWRG.js +209 -0
  95. package/dist/cli-bundle/chunks/aggregate-OOAGKWRG.js.map +7 -0
  96. package/dist/cli-bundle/chunks/append-5JE3YGXU.js +72 -0
  97. package/dist/cli-bundle/chunks/append-5JE3YGXU.js.map +7 -0
  98. package/dist/cli-bundle/chunks/append-PNN6UIBZ.js +69 -0
  99. package/dist/cli-bundle/chunks/append-PNN6UIBZ.js.map +1 -0
  100. package/dist/cli-bundle/chunks/chunk-26KTVXJW.js +218 -0
  101. package/dist/cli-bundle/chunks/chunk-26KTVXJW.js.map +1 -0
  102. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js +27 -0
  103. package/dist/cli-bundle/chunks/chunk-3HUE7XOF.js.map +7 -0
  104. package/dist/cli-bundle/chunks/chunk-3OH4DAEB.js +761 -0
  105. package/dist/cli-bundle/chunks/chunk-3OH4DAEB.js.map +7 -0
  106. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js +5553 -0
  107. package/dist/cli-bundle/chunks/chunk-4LTBNUYT.js.map +1 -0
  108. package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js +634 -0
  109. package/dist/cli-bundle/chunks/chunk-4PJQSECJ.js.map +7 -0
  110. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js +1832 -0
  111. package/dist/cli-bundle/chunks/chunk-4QCR4QW3.js.map +1 -0
  112. package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js +1891 -0
  113. package/dist/cli-bundle/chunks/chunk-5IRA6IYD.js.map +7 -0
  114. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js +412 -0
  115. package/dist/cli-bundle/chunks/chunk-5KB4X7YY.js.map +1 -0
  116. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js +182 -0
  117. package/dist/cli-bundle/chunks/chunk-5PAOPUZX.js.map +1 -0
  118. package/dist/cli-bundle/chunks/chunk-7K24QB23.js +698 -0
  119. package/dist/cli-bundle/chunks/chunk-7K24QB23.js.map +1 -0
  120. package/dist/cli-bundle/chunks/chunk-A6PEXMYN.js +380 -0
  121. package/dist/cli-bundle/chunks/chunk-A6PEXMYN.js.map +1 -0
  122. package/dist/cli-bundle/chunks/chunk-ASQM3IF5.js +230 -0
  123. package/dist/cli-bundle/chunks/chunk-ASQM3IF5.js.map +1 -0
  124. package/dist/cli-bundle/chunks/chunk-ATBVS6WW.js +185 -0
  125. package/dist/cli-bundle/chunks/chunk-ATBVS6WW.js.map +7 -0
  126. package/dist/cli-bundle/chunks/chunk-AXXKLVTW.js +332 -0
  127. package/dist/cli-bundle/chunks/chunk-AXXKLVTW.js.map +1 -0
  128. package/dist/cli-bundle/chunks/chunk-B3N4TKNL.js +1681 -0
  129. package/dist/cli-bundle/chunks/chunk-B3N4TKNL.js.map +7 -0
  130. package/dist/cli-bundle/chunks/{chunk-PB2YU2E3.js → chunk-BNL6S7QH.js} +28 -70
  131. package/dist/cli-bundle/chunks/chunk-BNL6S7QH.js.map +7 -0
  132. package/dist/cli-bundle/chunks/chunk-CCUFLH4J.js +154 -0
  133. package/dist/cli-bundle/chunks/chunk-CCUFLH4J.js.map +1 -0
  134. package/dist/cli-bundle/chunks/chunk-CJDQB2ED.js +341 -0
  135. package/dist/cli-bundle/chunks/chunk-CJDQB2ED.js.map +7 -0
  136. package/dist/cli-bundle/chunks/chunk-CWT53EYT.js +1340 -0
  137. package/dist/cli-bundle/chunks/chunk-CWT53EYT.js.map +1 -0
  138. package/dist/cli-bundle/chunks/chunk-D3WUNETC.js +349 -0
  139. package/dist/cli-bundle/chunks/chunk-D3WUNETC.js.map +7 -0
  140. package/dist/cli-bundle/chunks/chunk-D5X7N6FI.js +1714 -0
  141. package/dist/cli-bundle/chunks/chunk-D5X7N6FI.js.map +7 -0
  142. package/dist/cli-bundle/chunks/chunk-DFIZGAI5.js +550 -0
  143. package/dist/cli-bundle/chunks/chunk-DFIZGAI5.js.map +7 -0
  144. package/dist/cli-bundle/chunks/chunk-DFUSXJDE.js +1704 -0
  145. package/dist/cli-bundle/chunks/chunk-DFUSXJDE.js.map +1 -0
  146. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js +56 -0
  147. package/dist/cli-bundle/chunks/chunk-EAOG77HM.js.map +7 -0
  148. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js +2988 -0
  149. package/dist/cli-bundle/chunks/chunk-EHXPIKKP.js.map +1 -0
  150. package/dist/cli-bundle/chunks/chunk-FVXM3GKS.js +128 -0
  151. package/dist/cli-bundle/chunks/chunk-FVXM3GKS.js.map +1 -0
  152. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js +454 -0
  153. package/dist/cli-bundle/chunks/chunk-G5BACLYH.js.map +1 -0
  154. package/dist/cli-bundle/chunks/chunk-GCAVRLGE.js +383 -0
  155. package/dist/cli-bundle/chunks/chunk-GCAVRLGE.js.map +7 -0
  156. package/dist/cli-bundle/chunks/chunk-GFWHHMVV.js +57 -0
  157. package/dist/cli-bundle/chunks/chunk-GFWHHMVV.js.map +1 -0
  158. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js +3860 -0
  159. package/dist/cli-bundle/chunks/chunk-GNHVV4SY.js.map +1 -0
  160. package/dist/cli-bundle/chunks/chunk-GPGAYASV.js +346 -0
  161. package/dist/cli-bundle/chunks/chunk-GPGAYASV.js.map +1 -0
  162. package/dist/cli-bundle/chunks/chunk-HPH6X4ZZ.js +1356 -0
  163. package/dist/cli-bundle/chunks/chunk-HPH6X4ZZ.js.map +7 -0
  164. package/dist/cli-bundle/chunks/chunk-HZOS2UG5.js +342 -0
  165. package/dist/cli-bundle/chunks/chunk-HZOS2UG5.js.map +7 -0
  166. package/dist/cli-bundle/chunks/chunk-IUV734HF.js +17 -0
  167. package/dist/cli-bundle/chunks/chunk-IUV734HF.js.map +1 -0
  168. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js +15 -0
  169. package/dist/cli-bundle/chunks/chunk-J27KIHTG.js.map +1 -0
  170. package/dist/cli-bundle/chunks/chunk-JB4RGL4V.js +185 -0
  171. package/dist/cli-bundle/chunks/chunk-JB4RGL4V.js.map +7 -0
  172. package/dist/cli-bundle/chunks/chunk-JQI2HE55.js +130 -0
  173. package/dist/cli-bundle/chunks/chunk-JQI2HE55.js.map +1 -0
  174. package/dist/cli-bundle/chunks/chunk-K47WAYQV.js +60 -0
  175. package/dist/cli-bundle/chunks/chunk-K47WAYQV.js.map +7 -0
  176. package/dist/cli-bundle/chunks/chunk-KA24HME7.js +79 -0
  177. package/dist/cli-bundle/chunks/chunk-KA24HME7.js.map +7 -0
  178. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js +1325 -0
  179. package/dist/cli-bundle/chunks/chunk-KBG47ZOY.js.map +1 -0
  180. package/dist/cli-bundle/chunks/chunk-KCMIYKTA.js +242 -0
  181. package/dist/cli-bundle/chunks/chunk-KCMIYKTA.js.map +1 -0
  182. package/dist/cli-bundle/chunks/chunk-KK6YPGH3.js +221 -0
  183. package/dist/cli-bundle/chunks/chunk-KK6YPGH3.js.map +7 -0
  184. package/dist/cli-bundle/chunks/chunk-LDJK7SHN.js +157 -0
  185. package/dist/cli-bundle/chunks/chunk-LDJK7SHN.js.map +7 -0
  186. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js +24 -0
  187. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js.map +1 -0
  188. package/dist/cli-bundle/chunks/chunk-MISYRLEP.js +80 -0
  189. package/dist/cli-bundle/chunks/chunk-MISYRLEP.js.map +1 -0
  190. package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js +457 -0
  191. package/dist/cli-bundle/chunks/chunk-N5YF3VFN.js.map +7 -0
  192. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js +173 -0
  193. package/dist/cli-bundle/chunks/chunk-NQP3ECKF.js.map +1 -0
  194. package/dist/cli-bundle/chunks/chunk-O5IBJE6S.js +338 -0
  195. package/dist/cli-bundle/chunks/chunk-O5IBJE6S.js.map +1 -0
  196. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js +18 -0
  197. package/dist/cli-bundle/chunks/chunk-O7IWB35H.js.map +7 -0
  198. package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js +3040 -0
  199. package/dist/cli-bundle/chunks/chunk-OIQIXTNB.js.map +7 -0
  200. package/dist/cli-bundle/chunks/chunk-ORTLYVA4.js +751 -0
  201. package/dist/cli-bundle/chunks/chunk-ORTLYVA4.js.map +1 -0
  202. package/dist/cli-bundle/chunks/chunk-OUF3ARDX.js +1861 -0
  203. package/dist/cli-bundle/chunks/chunk-OUF3ARDX.js.map +7 -0
  204. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js +20 -0
  205. package/dist/cli-bundle/chunks/chunk-QAJBIGRA.js.map +7 -0
  206. package/dist/cli-bundle/chunks/chunk-RANZIID5.js +176 -0
  207. package/dist/cli-bundle/chunks/chunk-RANZIID5.js.map +7 -0
  208. package/dist/cli-bundle/chunks/chunk-RQAWLSUU.js +140 -0
  209. package/dist/cli-bundle/chunks/chunk-RQAWLSUU.js.map +7 -0
  210. package/dist/cli-bundle/chunks/chunk-S3CV7JGJ.js +233 -0
  211. package/dist/cli-bundle/chunks/chunk-S3CV7JGJ.js.map +7 -0
  212. package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js +5705 -0
  213. package/dist/cli-bundle/chunks/chunk-SRVKTWPR.js.map +7 -0
  214. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js +76 -0
  215. package/dist/cli-bundle/chunks/chunk-SSFMJCPF.js.map +1 -0
  216. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js +631 -0
  217. package/dist/cli-bundle/chunks/chunk-SZQCER6S.js.map +1 -0
  218. package/dist/cli-bundle/chunks/chunk-T2ORWB6D.js +540 -0
  219. package/dist/cli-bundle/chunks/chunk-T2ORWB6D.js.map +1 -0
  220. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js +422 -0
  221. package/dist/cli-bundle/chunks/chunk-TBQVUNVH.js.map +7 -0
  222. package/dist/cli-bundle/chunks/{chunk-RJONRNXN.js → chunk-TK633IVD.js} +51 -32
  223. package/dist/cli-bundle/chunks/chunk-TK633IVD.js.map +7 -0
  224. package/dist/cli-bundle/chunks/chunk-TQ3ZK6VD.js +131 -0
  225. package/dist/cli-bundle/chunks/chunk-TQ3ZK6VD.js.map +7 -0
  226. package/dist/cli-bundle/chunks/chunk-UFCG3SWR.js +119 -0
  227. package/dist/cli-bundle/chunks/chunk-UFCG3SWR.js.map +1 -0
  228. package/dist/cli-bundle/chunks/chunk-UOVLWB47.js +1664 -0
  229. package/dist/cli-bundle/chunks/chunk-UOVLWB47.js.map +1 -0
  230. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js +186 -0
  231. package/dist/cli-bundle/chunks/chunk-V3JQ4IPL.js.map +1 -0
  232. package/dist/cli-bundle/chunks/chunk-VGO2T3TY.js +182 -0
  233. package/dist/cli-bundle/chunks/chunk-VGO2T3TY.js.map +1 -0
  234. package/dist/cli-bundle/chunks/chunk-WIKR7KFL.js +189 -0
  235. package/dist/cli-bundle/chunks/chunk-WIKR7KFL.js.map +7 -0
  236. package/dist/cli-bundle/chunks/chunk-XG7RJYHV.js +1385 -0
  237. package/dist/cli-bundle/chunks/chunk-XG7RJYHV.js.map +7 -0
  238. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js +53 -0
  239. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js.map +1 -0
  240. package/dist/cli-bundle/chunks/chunk-XX5LRINW.js +90 -0
  241. package/dist/cli-bundle/chunks/chunk-XX5LRINW.js.map +7 -0
  242. package/dist/cli-bundle/chunks/chunk-Y2AKE2HS.js +252 -0
  243. package/dist/cli-bundle/chunks/chunk-Y2AKE2HS.js.map +7 -0
  244. package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js +3898 -0
  245. package/dist/cli-bundle/chunks/chunk-ZQ4F6EC4.js.map +7 -0
  246. package/dist/cli-bundle/chunks/chunk-ZRVSMOMR.js +1809 -0
  247. package/dist/cli-bundle/chunks/chunk-ZRVSMOMR.js.map +1 -0
  248. package/dist/cli-bundle/chunks/claim-AZLP7YFO.js +132 -0
  249. package/dist/cli-bundle/chunks/claim-AZLP7YFO.js.map +7 -0
  250. package/dist/cli-bundle/chunks/claim-ZFA7HKU4.js +129 -0
  251. package/dist/cli-bundle/chunks/claim-ZFA7HKU4.js.map +1 -0
  252. package/dist/cli-bundle/chunks/close-65DFYAVS.js +17 -0
  253. package/dist/cli-bundle/chunks/close-65DFYAVS.js.map +1 -0
  254. package/dist/cli-bundle/chunks/close-RMHQ3KWH.js +13 -0
  255. package/dist/cli-bundle/chunks/close-RMHQ3KWH.js.map +7 -0
  256. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js +311 -0
  257. package/dist/cli-bundle/chunks/close-many-AKPZNSGI.js.map +1 -0
  258. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js +314 -0
  259. package/dist/cli-bundle/chunks/close-many-UKZSQGM7.js.map +7 -0
  260. package/dist/cli-bundle/chunks/comments-AGBNSJJH.js +103 -0
  261. package/dist/cli-bundle/chunks/comments-AGBNSJJH.js.map +7 -0
  262. package/dist/cli-bundle/chunks/comments-CJWXQI7X.js +100 -0
  263. package/dist/cli-bundle/chunks/comments-CJWXQI7X.js.map +1 -0
  264. package/dist/cli-bundle/chunks/config-5ON3ADRH.js +1688 -0
  265. package/dist/cli-bundle/chunks/config-5ON3ADRH.js.map +7 -0
  266. package/dist/cli-bundle/chunks/config-DDPYIA6J.js +1671 -0
  267. package/dist/cli-bundle/chunks/config-DDPYIA6J.js.map +1 -0
  268. package/dist/cli-bundle/chunks/context-E6U3DWVM.js +1471 -0
  269. package/dist/cli-bundle/chunks/context-E6U3DWVM.js.map +7 -0
  270. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js +1461 -0
  271. package/dist/cli-bundle/chunks/context-ZOJEN5VT.js.map +1 -0
  272. package/dist/cli-bundle/chunks/contracts-CXSFM45B.js +1277 -0
  273. package/dist/cli-bundle/chunks/contracts-CXSFM45B.js.map +7 -0
  274. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js +1274 -0
  275. package/dist/cli-bundle/chunks/contracts-LCSX5R53.js.map +1 -0
  276. package/dist/cli-bundle/chunks/create-ATONSAZW.js +27 -0
  277. package/dist/cli-bundle/chunks/create-ATONSAZW.js.map +7 -0
  278. package/dist/cli-bundle/chunks/create-WYFKN2U4.js +31 -0
  279. package/dist/cli-bundle/chunks/create-WYFKN2U4.js.map +1 -0
  280. package/dist/cli-bundle/chunks/delete-RONNH4F4.js +58 -0
  281. package/dist/cli-bundle/chunks/delete-RONNH4F4.js.map +7 -0
  282. package/dist/cli-bundle/chunks/delete-ZXWC56WO.js +55 -0
  283. package/dist/cli-bundle/chunks/delete-ZXWC56WO.js.map +1 -0
  284. package/dist/cli-bundle/chunks/deps-EHXIFOZR.js +225 -0
  285. package/dist/cli-bundle/chunks/deps-EHXIFOZR.js.map +1 -0
  286. package/dist/cli-bundle/chunks/deps-WII3O4HB.js +228 -0
  287. package/dist/cli-bundle/chunks/deps-WII3O4HB.js.map +7 -0
  288. package/dist/cli-bundle/chunks/docs-JMVCFNHH.js +34 -0
  289. package/dist/cli-bundle/chunks/docs-JMVCFNHH.js.map +7 -0
  290. package/dist/cli-bundle/chunks/docs-PDREIMLS.js +31 -0
  291. package/dist/cli-bundle/chunks/docs-PDREIMLS.js.map +1 -0
  292. package/dist/cli-bundle/chunks/extension-B4ROVWJD.js +28 -0
  293. package/dist/cli-bundle/chunks/extension-B4ROVWJD.js.map +1 -0
  294. package/dist/cli-bundle/chunks/extension-G6UXSM5S.js +24 -0
  295. package/dist/cli-bundle/chunks/extension-G6UXSM5S.js.map +7 -0
  296. package/dist/cli-bundle/chunks/files-2PN7UM2D.js +282 -0
  297. package/dist/cli-bundle/chunks/files-2PN7UM2D.js.map +1 -0
  298. package/dist/cli-bundle/chunks/files-MXYS5W4M.js +285 -0
  299. package/dist/cli-bundle/chunks/files-MXYS5W4M.js.map +7 -0
  300. package/dist/cli-bundle/chunks/gc-GT552UJH.js +178 -0
  301. package/dist/cli-bundle/chunks/gc-GT552UJH.js.map +1 -0
  302. package/dist/cli-bundle/chunks/gc-QNBRJG6H.js +181 -0
  303. package/dist/cli-bundle/chunks/gc-QNBRJG6H.js.map +7 -0
  304. package/dist/cli-bundle/chunks/get-CINFEUIY.js +197 -0
  305. package/dist/cli-bundle/chunks/get-CINFEUIY.js.map +7 -0
  306. package/dist/cli-bundle/chunks/get-WXMLRG7M.js +194 -0
  307. package/dist/cli-bundle/chunks/get-WXMLRG7M.js.map +1 -0
  308. package/dist/cli-bundle/chunks/health-5VPOJQ53.js +1258 -0
  309. package/dist/cli-bundle/chunks/health-5VPOJQ53.js.map +1 -0
  310. package/dist/cli-bundle/chunks/health-IT5DBPRJ.js +1261 -0
  311. package/dist/cli-bundle/chunks/health-IT5DBPRJ.js.map +7 -0
  312. package/dist/cli-bundle/chunks/history-6FC4H6HI.js +20 -0
  313. package/dist/cli-bundle/chunks/history-6FC4H6HI.js.map +7 -0
  314. package/dist/cli-bundle/chunks/history-FLZIP7PM.js +24 -0
  315. package/dist/cli-bundle/chunks/history-FLZIP7PM.js.map +1 -0
  316. package/dist/cli-bundle/chunks/history-redact-SSZBAD76.js +23 -0
  317. package/dist/cli-bundle/chunks/history-redact-SSZBAD76.js.map +1 -0
  318. package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js +19 -0
  319. package/dist/cli-bundle/chunks/history-redact-XKYEZDBL.js.map +7 -0
  320. package/dist/cli-bundle/chunks/history-repair-KC5ZOJRZ.js +196 -0
  321. package/dist/cli-bundle/chunks/history-repair-KC5ZOJRZ.js.map +7 -0
  322. package/dist/cli-bundle/chunks/history-repair-X7CO5JJZ.js +193 -0
  323. package/dist/cli-bundle/chunks/history-repair-X7CO5JJZ.js.map +1 -0
  324. package/dist/cli-bundle/chunks/init-6MRFVOLH.js +20 -0
  325. package/dist/cli-bundle/chunks/init-6MRFVOLH.js.map +1 -0
  326. package/dist/cli-bundle/chunks/init-KHX3FEEM.js +16 -0
  327. package/dist/cli-bundle/chunks/init-KHX3FEEM.js.map +7 -0
  328. package/dist/cli-bundle/chunks/learnings-A3CLB5CO.js +47 -0
  329. package/dist/cli-bundle/chunks/learnings-A3CLB5CO.js.map +7 -0
  330. package/dist/cli-bundle/chunks/learnings-DCX55BNX.js +44 -0
  331. package/dist/cli-bundle/chunks/learnings-DCX55BNX.js.map +1 -0
  332. package/dist/cli-bundle/chunks/list-53LZ2AEO.js +20 -0
  333. package/dist/cli-bundle/chunks/list-53LZ2AEO.js.map +7 -0
  334. package/dist/cli-bundle/chunks/list-DBRECOG4.js +24 -0
  335. package/dist/cli-bundle/chunks/list-DBRECOG4.js.map +1 -0
  336. package/dist/cli-bundle/chunks/notes-42LIC3UE.js +47 -0
  337. package/dist/cli-bundle/chunks/notes-42LIC3UE.js.map +7 -0
  338. package/dist/cli-bundle/chunks/notes-P5O3VMQ3.js +44 -0
  339. package/dist/cli-bundle/chunks/notes-P5O3VMQ3.js.map +1 -0
  340. package/dist/cli-bundle/chunks/plan-HDQXEUKD.js +1174 -0
  341. package/dist/cli-bundle/chunks/plan-HDQXEUKD.js.map +7 -0
  342. package/dist/cli-bundle/chunks/plan-IGTE3WOJ.js +1171 -0
  343. package/dist/cli-bundle/chunks/plan-IGTE3WOJ.js.map +1 -0
  344. package/dist/cli-bundle/chunks/{register-list-query-EIVQ5FMR.js → register-list-query-AG3XKXWL.js} +25 -18
  345. package/dist/cli-bundle/chunks/register-list-query-AG3XKXWL.js.map +7 -0
  346. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js +227 -0
  347. package/dist/cli-bundle/chunks/register-list-query-EMNSIUO4.js.map +1 -0
  348. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js +813 -0
  349. package/dist/cli-bundle/chunks/register-mutation-M3YS6XDO.js.map +1 -0
  350. package/dist/cli-bundle/chunks/{register-mutation-RSZNPSGI.js → register-mutation-RSMT6DPK.js} +160 -39
  351. package/dist/cli-bundle/chunks/register-mutation-RSMT6DPK.js.map +7 -0
  352. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js +370 -0
  353. package/dist/cli-bundle/chunks/register-operations-KYUOOOOD.js.map +1 -0
  354. package/dist/cli-bundle/chunks/{register-operations-APUSYDMR.js → register-operations-Q54JQZUN.js} +50 -32
  355. package/dist/cli-bundle/chunks/register-operations-Q54JQZUN.js.map +7 -0
  356. package/dist/cli-bundle/chunks/register-setup-DI6P7X75.js +242 -0
  357. package/dist/cli-bundle/chunks/register-setup-DI6P7X75.js.map +1 -0
  358. package/dist/cli-bundle/chunks/{register-setup-OZOKSMPJ.js → register-setup-YJKIQRKA.js} +21 -13
  359. package/dist/cli-bundle/chunks/register-setup-YJKIQRKA.js.map +7 -0
  360. package/dist/cli-bundle/chunks/restore-2XVTBLKQ.js +21 -0
  361. package/dist/cli-bundle/chunks/restore-2XVTBLKQ.js.map +1 -0
  362. package/dist/cli-bundle/chunks/restore-JL5QIH7H.js +17 -0
  363. package/dist/cli-bundle/chunks/restore-JL5QIH7H.js.map +7 -0
  364. package/dist/cli-bundle/chunks/schema-LVXZWFGY.js +770 -0
  365. package/dist/cli-bundle/chunks/schema-LVXZWFGY.js.map +1 -0
  366. package/dist/cli-bundle/chunks/schema-V6BX65Q2.js +780 -0
  367. package/dist/cli-bundle/chunks/schema-V6BX65Q2.js.map +7 -0
  368. package/dist/cli-bundle/chunks/search-5A3BMFA7.js +1144 -0
  369. package/dist/cli-bundle/chunks/search-5A3BMFA7.js.map +7 -0
  370. package/dist/cli-bundle/chunks/search-C7NPB7G7.js +1127 -0
  371. package/dist/cli-bundle/chunks/search-C7NPB7G7.js.map +1 -0
  372. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js +120 -0
  373. package/dist/cli-bundle/chunks/stats-FNLYVXTB.js.map +1 -0
  374. package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js +123 -0
  375. package/dist/cli-bundle/chunks/stats-Y2CBTZSL.js.map +7 -0
  376. package/dist/cli-bundle/chunks/test-OFYONO3C.js +35 -0
  377. package/dist/cli-bundle/chunks/test-OFYONO3C.js.map +1 -0
  378. package/dist/cli-bundle/chunks/test-RJ4ZF35X.js +31 -0
  379. package/dist/cli-bundle/chunks/test-RJ4ZF35X.js.map +7 -0
  380. package/dist/cli-bundle/chunks/test-all-EEMKNTGU.js +331 -0
  381. package/dist/cli-bundle/chunks/test-all-EEMKNTGU.js.map +7 -0
  382. package/dist/cli-bundle/chunks/test-all-OJE6CIO7.js +328 -0
  383. package/dist/cli-bundle/chunks/test-all-OJE6CIO7.js.map +1 -0
  384. package/dist/cli-bundle/chunks/test-runs-IPOPFOAF.js +929 -0
  385. package/dist/cli-bundle/chunks/test-runs-IPOPFOAF.js.map +1 -0
  386. package/dist/cli-bundle/chunks/test-runs-L2M7WKH7.js +939 -0
  387. package/dist/cli-bundle/chunks/test-runs-L2M7WKH7.js.map +7 -0
  388. package/dist/cli-bundle/chunks/update-6YEHPVXH.js +25 -0
  389. package/dist/cli-bundle/chunks/update-6YEHPVXH.js.map +1 -0
  390. package/dist/cli-bundle/chunks/update-PYLVHMRD.js +21 -0
  391. package/dist/cli-bundle/chunks/update-PYLVHMRD.js.map +7 -0
  392. package/dist/cli-bundle/chunks/update-many-322CCH2L.js +608 -0
  393. package/dist/cli-bundle/chunks/update-many-322CCH2L.js.map +7 -0
  394. package/dist/cli-bundle/chunks/update-many-DYWGW57M.js +605 -0
  395. package/dist/cli-bundle/chunks/update-many-DYWGW57M.js.map +1 -0
  396. package/dist/cli-bundle/chunks/upgrade-2U727SAM.js +269 -0
  397. package/dist/cli-bundle/chunks/upgrade-2U727SAM.js.map +7 -0
  398. package/dist/cli-bundle/chunks/upgrade-3W3RVSNM.js +266 -0
  399. package/dist/cli-bundle/chunks/upgrade-3W3RVSNM.js.map +1 -0
  400. package/dist/cli-bundle/chunks/validate-GZ24NYHO.js +1120 -0
  401. package/dist/cli-bundle/chunks/validate-GZ24NYHO.js.map +1 -0
  402. package/dist/cli-bundle/chunks/validate-ZFVWPEEN.js +1123 -0
  403. package/dist/cli-bundle/chunks/validate-ZFVWPEEN.js.map +7 -0
  404. package/dist/cli-bundle/main.js +615 -121
  405. package/dist/cli-bundle/main.js.map +4 -4
  406. package/dist/core/checkpoint/mutation-checkpoint.d.ts +44 -0
  407. package/dist/core/checkpoint/mutation-checkpoint.js +119 -0
  408. package/dist/core/checkpoint/mutation-checkpoint.js.map +1 -0
  409. package/dist/core/config/positional-value.js +4 -2
  410. package/dist/core/config/positional-value.js.map +1 -1
  411. package/dist/core/diagnostics/remediation.d.ts +73 -0
  412. package/dist/core/diagnostics/remediation.js +328 -0
  413. package/dist/core/diagnostics/remediation.js.map +1 -0
  414. package/dist/core/extensions/extension-hook-runtime.js +9 -2
  415. package/dist/core/extensions/extension-hook-runtime.js.map +1 -1
  416. package/dist/core/extensions/extension-types.d.ts +60 -4
  417. package/dist/core/extensions/extension-types.js +2 -2
  418. package/dist/core/extensions/extension-types.js.map +1 -1
  419. package/dist/core/extensions/index.d.ts +5 -1
  420. package/dist/core/extensions/index.js +61 -2
  421. package/dist/core/extensions/index.js.map +1 -1
  422. package/dist/core/extensions/item-fields.d.ts +5 -1
  423. package/dist/core/extensions/item-fields.js +126 -4
  424. package/dist/core/extensions/item-fields.js.map +1 -1
  425. package/dist/core/extensions/loader.js +283 -8
  426. package/dist/core/extensions/loader.js.map +1 -1
  427. package/dist/core/item/item-format.d.ts +3 -2
  428. package/dist/core/item/item-format.js +15 -10
  429. package/dist/core/item/item-format.js.map +1 -1
  430. package/dist/core/item/item-type-definition.js +6 -2
  431. package/dist/core/item/item-type-definition.js.map +1 -1
  432. package/dist/core/item/status-filter.d.ts +29 -0
  433. package/dist/core/item/status-filter.js +97 -0
  434. package/dist/core/item/status-filter.js.map +1 -0
  435. package/dist/core/item/type-registry.d.ts +4 -0
  436. package/dist/core/item/type-registry.js +12 -2
  437. package/dist/core/item/type-registry.js.map +1 -1
  438. package/dist/core/output/output.js +17 -5
  439. package/dist/core/output/output.js.map +1 -1
  440. package/dist/core/schema/item-types-file.d.ts +15 -0
  441. package/dist/core/schema/item-types-file.js +27 -2
  442. package/dist/core/schema/item-types-file.js.map +1 -1
  443. package/dist/core/schema/runtime-field-filters.js +4 -3
  444. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  445. package/dist/core/schema/runtime-field-values.d.ts +1 -1
  446. package/dist/core/schema/runtime-field-values.js +10 -4
  447. package/dist/core/schema/runtime-field-values.js.map +1 -1
  448. package/dist/core/schema/runtime-schema.js +75 -2
  449. package/dist/core/schema/runtime-schema.js.map +1 -1
  450. package/dist/core/schema/status-defs-file.d.ts +113 -0
  451. package/dist/core/schema/status-defs-file.js +260 -0
  452. package/dist/core/schema/status-defs-file.js.map +1 -0
  453. package/dist/core/schema/type-workflows.d.ts +64 -0
  454. package/dist/core/schema/type-workflows.js +98 -0
  455. package/dist/core/schema/type-workflows.js.map +1 -0
  456. package/dist/core/search/background-refresh.d.ts +53 -0
  457. package/dist/core/search/background-refresh.js +286 -0
  458. package/dist/core/search/background-refresh.js.map +1 -0
  459. package/dist/core/search/cache.d.ts +23 -2
  460. package/dist/core/search/cache.js +135 -30
  461. package/dist/core/search/cache.js.map +1 -1
  462. package/dist/core/search/http-client.d.ts +2 -2
  463. package/dist/core/search/http-client.js +2 -2
  464. package/dist/core/search/http-client.js.map +1 -1
  465. package/dist/core/search/vector-stores.d.ts +1 -0
  466. package/dist/core/search/vector-stores.js +69 -15
  467. package/dist/core/search/vector-stores.js.map +1 -1
  468. package/dist/core/search/vectorization-metadata.d.ts +13 -0
  469. package/dist/core/search/vectorization-metadata.js +65 -0
  470. package/dist/core/search/vectorization-metadata.js.map +1 -0
  471. package/dist/core/shared/constants.d.ts +2 -2
  472. package/dist/core/shared/constants.js +2 -3
  473. package/dist/core/shared/constants.js.map +1 -1
  474. package/dist/core/shared/serialization.d.ts +1 -0
  475. package/dist/core/shared/serialization.js +86 -2
  476. package/dist/core/shared/serialization.js.map +1 -1
  477. package/dist/core/store/front-matter-cache.js +14 -5
  478. package/dist/core/store/front-matter-cache.js.map +1 -1
  479. package/dist/core/store/item-format-migration.js +25 -15
  480. package/dist/core/store/item-format-migration.js.map +1 -1
  481. package/dist/core/store/item-store.d.ts +2 -0
  482. package/dist/core/store/item-store.js +61 -6
  483. package/dist/core/store/item-store.js.map +1 -1
  484. package/dist/core/store/settings-validator.js +22 -2
  485. package/dist/core/store/settings-validator.js.map +1 -1
  486. package/dist/core/store/settings.js +40 -5
  487. package/dist/core/store/settings.js.map +1 -1
  488. package/dist/core/telemetry/consent.js +3 -3
  489. package/dist/core/telemetry/consent.js.map +1 -1
  490. package/dist/core/telemetry/observability.js +4 -3
  491. package/dist/core/telemetry/observability.js.map +1 -1
  492. package/dist/core/telemetry/runtime.d.ts +10 -0
  493. package/dist/core/telemetry/runtime.js +86 -2
  494. package/dist/core/telemetry/runtime.js.map +1 -1
  495. package/dist/mcp/server.js +221 -12
  496. package/dist/mcp/server.js.map +1 -1
  497. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -2
  498. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  499. package/dist/sdk/cli-contracts/commander-types.js +7 -2
  500. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  501. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  502. package/dist/sdk/cli-contracts/enum-contracts.js +4 -2
  503. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  504. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -0
  505. package/dist/sdk/cli-contracts/tool-option-contracts.js +53 -3
  506. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  507. package/dist/sdk/cli-contracts/tool-parameter-tables.js +37 -8
  508. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  509. package/dist/sdk/cli-contracts.d.ts +19 -1
  510. package/dist/sdk/cli-contracts.js +211 -18
  511. package/dist/sdk/cli-contracts.js.map +1 -1
  512. package/dist/sdk/errors.d.ts +22 -0
  513. package/dist/sdk/errors.js +46 -0
  514. package/dist/sdk/errors.js.map +1 -0
  515. package/dist/sdk/index.d.ts +2 -1
  516. package/dist/sdk/index.js +3 -2
  517. package/dist/sdk/index.js.map +1 -1
  518. package/dist/sdk/package-import-adapters.js +14 -3
  519. package/dist/sdk/package-import-adapters.js.map +1 -1
  520. package/dist/sdk/runtime.d.ts +1 -0
  521. package/dist/sdk/runtime.js +3 -2
  522. package/dist/sdk/runtime.js.map +1 -1
  523. package/dist/sdk/testing.d.ts +77 -0
  524. package/dist/sdk/testing.js +239 -0
  525. package/dist/sdk/testing.js.map +1 -0
  526. package/dist/types.d.ts +26 -1
  527. package/dist/types.js +3 -2
  528. package/dist/types.js.map +1 -1
  529. package/docs/AGENT_GUIDE.md +21 -2
  530. package/docs/COMMANDS.md +85 -5
  531. package/docs/CONFIGURATION.md +49 -2
  532. package/docs/EXTENSIONS.md +118 -6
  533. package/docs/QUICKSTART.md +2 -0
  534. package/docs/RELEASING.md +3 -3
  535. package/docs/SDK.md +273 -1
  536. package/docs/TESTING.md +17 -0
  537. package/docs/examples/policy-restricted-extension/manifest.json +1 -0
  538. package/docs/examples/starter-extension/index.js +9 -1
  539. package/docs/examples/starter-extension/manifest.json +1 -0
  540. package/package.json +12 -7
  541. package/packages/pm-beads/extensions/beads/index.js +2 -4
  542. package/packages/pm-beads/extensions/beads/index.ts +43 -33
  543. package/packages/pm-beads/extensions/beads/manifest.json +12 -1
  544. package/packages/pm-calendar/README.md +6 -0
  545. package/packages/pm-calendar/extensions/calendar/index.js +6 -1
  546. package/packages/pm-calendar/extensions/calendar/index.ts +6 -1
  547. package/packages/pm-calendar/extensions/calendar/manifest.json +6 -1
  548. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +6 -1
  549. package/packages/pm-guide-shell/README.md +4 -0
  550. package/packages/pm-guide-shell/extensions/guide-shell/index.js +22 -0
  551. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +22 -0
  552. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +6 -1
  553. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +74 -3
  554. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +84 -4
  555. package/packages/pm-lifecycle-hooks/README.md +29 -0
  556. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.js +18 -0
  557. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.ts +20 -0
  558. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +9 -0
  559. package/packages/pm-lifecycle-hooks/package.json +52 -0
  560. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +13 -1
  561. package/packages/pm-search-advanced/extensions/search-advanced/index.js +69 -1
  562. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +91 -2
  563. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +13 -1
  564. package/packages/pm-templates/extensions/templates/manifest.json +6 -1
  565. package/packages/pm-todos/extensions/todos/index.js +3 -7
  566. package/packages/pm-todos/extensions/todos/index.ts +55 -42
  567. package/packages/pm-todos/extensions/todos/manifest.json +13 -1
  568. package/scripts/bundle-cli.mjs +121 -17
  569. package/dist/cli-bundle/chunks/chunk-PB2YU2E3.js.map +0 -7
  570. package/dist/cli-bundle/chunks/chunk-RJONRNXN.js.map +0 -7
  571. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js +0 -13864
  572. package/dist/cli-bundle/chunks/chunk-SW5BMMCU.js.map +0 -7
  573. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js +0 -24225
  574. package/dist/cli-bundle/chunks/commands-XJ4TJ5UN.js.map +0 -7
  575. package/dist/cli-bundle/chunks/register-list-query-EIVQ5FMR.js.map +0 -7
  576. package/dist/cli-bundle/chunks/register-mutation-RSZNPSGI.js.map +0 -7
  577. package/dist/cli-bundle/chunks/register-operations-APUSYDMR.js.map +0 -7
  578. package/dist/cli-bundle/chunks/register-setup-OZOKSMPJ.js.map +0 -7
@@ -1,4 +1,5 @@
1
1
  import { readSettings } from "../store/settings.js";
2
+ import type { VectorizationEmbeddingMetadata } from "./vectorization-metadata.js";
2
3
  export declare const SEARCH_CACHE_ARTIFACT_PATHS: readonly ["index/manifest.json", "search/embeddings.jsonl"];
3
4
  export declare const VECTORIZATION_STATUS_LEDGER_PATH = "search/vectorization-status.json";
4
5
  export interface SearchCacheInvalidationResult {
@@ -13,6 +14,17 @@ export interface SemanticMutationRefreshResult {
13
14
  export interface SearchMutationArtifactRefreshResult extends SearchCacheInvalidationResult {
14
15
  refreshed: string[];
15
16
  skipped: string[];
17
+ /** True when the semantic refresh was dispatched to a detached background worker. */
18
+ scheduled?: boolean;
19
+ }
20
+ export interface RefreshSearchArtifactsForMutationOptions {
21
+ /**
22
+ * When true and semantic search is active, the (slow) embedding refresh is
23
+ * dispatched to a detached background worker instead of awaited inline so the
24
+ * mutation returns immediately. The synchronous keyword-cache invalidation
25
+ * still runs first. Callers pass this only outside test runners.
26
+ */
27
+ background?: boolean;
16
28
  }
17
29
  export interface SemanticRefreshOptions {
18
30
  settings?: Awaited<ReturnType<typeof readSettings>>;
@@ -20,10 +32,19 @@ export interface SemanticRefreshOptions {
20
32
  }
21
33
  export interface VectorizationStatusLedgerReadResult {
22
34
  entries: Record<string, string>;
35
+ embedding: VectorizationEmbeddingMetadata | null;
23
36
  warnings: string[];
24
37
  }
25
38
  export declare function readVectorizationStatusLedger(pmRoot: string): Promise<VectorizationStatusLedgerReadResult>;
26
- export declare function writeVectorizationStatusLedger(pmRoot: string, entries: Record<string, string>): Promise<void>;
39
+ export declare function writeVectorizationStatusLedger(pmRoot: string, entries: Record<string, string>, embedding?: VectorizationEmbeddingMetadata | null): Promise<void>;
27
40
  export declare function invalidateSearchCacheArtifacts(pmRoot: string): Promise<SearchCacheInvalidationResult>;
28
41
  export declare function refreshSemanticEmbeddingsForMutatedItems(pmRoot: string, itemIds: string[], options?: SemanticRefreshOptions): Promise<SemanticMutationRefreshResult>;
29
- export declare function refreshSearchArtifactsForMutation(pmRoot: string, itemIds: string[]): Promise<SearchMutationArtifactRefreshResult>;
42
+ /**
43
+ * Returns true when a semantic embedding refresh would do real work for these
44
+ * settings (an embedding provider AND a vector store both resolve). Used to
45
+ * decide whether a mutation's refresh is worth dispatching to a background
46
+ * worker — when semantic search is not configured the inline path is already a
47
+ * fast no-op and no child is spawned.
48
+ */
49
+ export declare function isSemanticRefreshActive(settings: Awaited<ReturnType<typeof readSettings>>, applyRuntimeDefaults: boolean): boolean;
50
+ export declare function refreshSearchArtifactsForMutation(pmRoot: string, itemIds: string[], options?: RefreshSearchArtifactsForMutationOptions): Promise<SearchMutationArtifactRefreshResult>;
@@ -1,5 +1,5 @@
1
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]="4a4a71bc-457b-5496-a2e8-e3e3537d01ae")}catch(e){}}();
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]="5d698c95-b557-5c29-bc3f-caf70b5d6d0f")}catch(e){}}();
3
3
  import path from "node:path";
4
4
  import { getActiveExtensionRegistrations } from "../extensions/index.js";
5
5
  import { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic } from "../fs/fs-utils.js";
@@ -12,7 +12,9 @@ import { executeEmbeddingBatchesWithRetry } from "./embedding-batches.js";
12
12
  import { buildSemanticCorpusInput } from "./corpus.js";
13
13
  import { resolveEmbeddingProviders } from "./providers.js";
14
14
  import { resolveSettingsWithSemanticRuntimeDefaults } from "./semantic-defaults.js";
15
- import { executeVectorDelete, executeVectorUpsert, resolveVectorStores } from "./vector-stores.js";
15
+ import { scheduleBackgroundSemanticRefresh } from "./background-refresh.js";
16
+ import { executeVectorDelete, executeVectorReset, executeVectorUpsert, resolveVectorStores } from "./vector-stores.js";
17
+ import { buildVectorizationEmbeddingIdentity, buildVectorizationEmbeddingMetadata, hasVectorizationEmbeddingIdentityChanged, hasVectorizationVectorDimensionChanged, inferConsistentVectorDimension, normalizeVectorizationEmbeddingMetadata, } from "./vectorization-metadata.js";
16
18
  import { nowIso } from "../shared/time.js";
17
19
  export const SEARCH_CACHE_ARTIFACT_PATHS = ["index/manifest.json", "search/embeddings.jsonl"];
18
20
  export const VECTORIZATION_STATUS_LEDGER_PATH = "search/vectorization-status.json";
@@ -43,6 +45,7 @@ export async function readVectorizationStatusLedger(pmRoot) {
43
45
  if (raw === null || raw.trim().length === 0) {
44
46
  return {
45
47
  entries: {},
48
+ embedding: null,
46
49
  warnings: [],
47
50
  };
48
51
  }
@@ -53,6 +56,7 @@ export async function readVectorizationStatusLedger(pmRoot) {
53
56
  catch {
54
57
  return {
55
58
  entries: {},
59
+ embedding: null,
56
60
  warnings: ["search_vectorization_status_ledger_invalid"],
57
61
  };
58
62
  }
@@ -62,6 +66,7 @@ export async function readVectorizationStatusLedger(pmRoot) {
62
66
  !Array.isArray(parsed.items)) {
63
67
  return {
64
68
  entries: {},
69
+ embedding: null,
65
70
  warnings: ["search_vectorization_status_ledger_invalid"],
66
71
  };
67
72
  }
@@ -70,6 +75,7 @@ export async function readVectorizationStatusLedger(pmRoot) {
70
75
  if (typeof entry !== "object" || entry === null) {
71
76
  return {
72
77
  entries: {},
78
+ embedding: null,
73
79
  warnings: ["search_vectorization_status_ledger_invalid"],
74
80
  };
75
81
  }
@@ -78,22 +84,36 @@ export async function readVectorizationStatusLedger(pmRoot) {
78
84
  if (typeof id !== "string" || id.trim().length === 0 || !isValidUpdatedAt(updatedAt)) {
79
85
  return {
80
86
  entries: {},
87
+ embedding: null,
81
88
  warnings: ["search_vectorization_status_ledger_invalid"],
82
89
  };
83
90
  }
84
91
  mapped.set(id.trim(), updatedAt);
85
92
  }
93
+ let embedding = null;
94
+ try {
95
+ embedding = normalizeVectorizationEmbeddingMetadata(parsed.embedding);
96
+ }
97
+ catch {
98
+ return {
99
+ entries: {},
100
+ embedding: null,
101
+ warnings: ["search_vectorization_status_ledger_invalid"],
102
+ };
103
+ }
86
104
  return {
87
105
  entries: Object.fromEntries([...mapped.entries()].sort((left, right) => left[0].localeCompare(right[0]))),
106
+ embedding,
88
107
  warnings: [],
89
108
  };
90
109
  }
91
- export async function writeVectorizationStatusLedger(pmRoot, entries) {
110
+ export async function writeVectorizationStatusLedger(pmRoot, entries, embedding) {
92
111
  const normalizedEntries = normalizeVectorizationLedgerEntries(entries);
93
112
  const ledgerPath = path.join(pmRoot, VECTORIZATION_STATUS_LEDGER_PATH);
94
113
  const serialized = `${JSON.stringify({
95
114
  version: 1,
96
115
  generated_at: nowIso(),
116
+ ...(embedding ? { embedding } : {}),
97
117
  items: Object.entries(normalizedEntries).map(([id, updated_at]) => ({
98
118
  id,
99
119
  updated_at,
@@ -110,6 +130,13 @@ function buildVectorPayload(item) {
110
130
  updated_at: item.updated_at,
111
131
  };
112
132
  }
133
+ function buildVectorizationIdentityForProvider(provider) {
134
+ const identity = buildVectorizationEmbeddingIdentity(provider.name, provider.model);
135
+ if (!identity) {
136
+ throw new Error("Embedding provider must include a provider name and model");
137
+ }
138
+ return identity;
139
+ }
113
140
  function buildSkippedSemanticRefreshResult(itemIds, warning) {
114
141
  return {
115
142
  refreshed: [],
@@ -176,31 +203,39 @@ async function collectSemanticRefreshWorkload(pmRoot, idPrefix, preferredFormat,
176
203
  warnings,
177
204
  };
178
205
  }
179
- async function refreshLocatedSemanticVectors(settings, provider, vectorStore, documents) {
180
- if (documents.length === 0) {
181
- return { refreshed: [], skipped: [], warnings: [] };
182
- }
206
+ async function embedLocatedSemanticVectors(settings, provider, documents) {
207
+ const corpusInputs = documents.map((entry) => buildSemanticCorpusInput(entry.document, {
208
+ providerName: provider.name,
209
+ }));
210
+ const embeddingResult = await executeEmbeddingBatchesWithRetry(provider, settings, corpusInputs);
211
+ return {
212
+ vectors: embeddingResult.vectors,
213
+ vector_dimension: inferConsistentVectorDimension(embeddingResult.vectors, "Semantic refresh embedding"),
214
+ warnings: embeddingResult.warnings,
215
+ };
216
+ }
217
+ async function upsertLocatedSemanticVectors(vectorStore, documents, vectors) {
218
+ await executeVectorUpsert(vectorStore, documents.map((entry, index) => ({
219
+ id: entry.id,
220
+ vector: vectors[index],
221
+ payload: buildVectorPayload(entry.document.metadata),
222
+ })));
223
+ return {
224
+ refreshed: documents.map((entry) => entry.id),
225
+ skipped: [],
226
+ warnings: [],
227
+ };
228
+ }
229
+ async function resetSemanticVectorStore(vectorStore, ledgerEntries) {
183
230
  try {
184
- const corpusInputs = documents.map((entry) => buildSemanticCorpusInput(entry.document, {
185
- providerName: provider.name,
186
- }));
187
- const embeddingResult = await executeEmbeddingBatchesWithRetry(provider, settings, corpusInputs);
188
- await executeVectorUpsert(vectorStore, documents.map((entry, index) => ({
189
- id: entry.id,
190
- vector: embeddingResult.vectors[index],
191
- payload: buildVectorPayload(entry.document.metadata),
192
- })));
193
- return {
194
- refreshed: documents.map((entry) => entry.id),
195
- skipped: [],
196
- warnings: embeddingResult.warnings,
197
- };
231
+ await executeVectorReset(vectorStore, Object.keys(ledgerEntries));
232
+ return { refreshed: [], skipped: [], warnings: [] };
198
233
  }
199
234
  catch (error) {
200
235
  return {
201
236
  refreshed: [],
202
- skipped: documents.map((entry) => entry.id),
203
- warnings: [`search_semantic_refresh_failed:${toErrorMessage(error)}`],
237
+ skipped: [],
238
+ warnings: [`search_semantic_refresh_reset_failed:${toErrorMessage(error)}`],
204
239
  };
205
240
  }
206
241
  }
@@ -260,7 +295,50 @@ export async function refreshSemanticEmbeddingsForMutatedItems(pmRoot, itemIds,
260
295
  }
261
296
  const typeRegistry = resolveItemTypeRegistry(runtimeContext.settings, getActiveExtensionRegistrations());
262
297
  const workload = await collectSemanticRefreshWorkload(pmRoot, runtimeContext.settings.id_prefix, runtimeContext.settings.item_format, normalizedItemIds, typeRegistry.type_to_folder, runtimeContext.settings.schema);
263
- const refreshedResult = await refreshLocatedSemanticVectors(runtimeContext.settings, runtimeContext.provider, runtimeContext.vectorStore, workload.documents);
298
+ const ledgerRead = workload.documents.length > 0 || workload.missingIds.length > 0
299
+ ? await readVectorizationStatusLedger(pmRoot)
300
+ : { entries: {}, embedding: null, warnings: [] };
301
+ const embeddingIdentity = buildVectorizationIdentityForProvider(runtimeContext.provider);
302
+ const nextLedgerBaseEntries = ledgerRead.entries;
303
+ let refreshedResult = { refreshed: [], skipped: [], warnings: [] };
304
+ let nextEmbeddingMetadata = ledgerRead.embedding;
305
+ if (workload.documents.length > 0) {
306
+ if (ledgerRead.embedding && hasVectorizationEmbeddingIdentityChanged(ledgerRead.embedding, embeddingIdentity)) {
307
+ refreshedResult = {
308
+ refreshed: [],
309
+ skipped: workload.documents.map((entry) => entry.id),
310
+ warnings: ["search_semantic_refresh_requires_reindex:embedding_identity_changed"],
311
+ };
312
+ }
313
+ else {
314
+ try {
315
+ const embedded = await embedLocatedSemanticVectors(runtimeContext.settings, runtimeContext.provider, workload.documents);
316
+ if (hasVectorizationVectorDimensionChanged(ledgerRead.embedding, embedded.vector_dimension)) {
317
+ refreshedResult = {
318
+ refreshed: [],
319
+ skipped: workload.documents.map((entry) => entry.id),
320
+ warnings: [...embedded.warnings, "search_semantic_refresh_requires_reindex:vector_dimension_changed"],
321
+ };
322
+ }
323
+ else {
324
+ nextEmbeddingMetadata = buildVectorizationEmbeddingMetadata(embeddingIdentity, embedded.vector_dimension);
325
+ const upserted = await upsertLocatedSemanticVectors(runtimeContext.vectorStore, workload.documents, embedded.vectors);
326
+ refreshedResult = {
327
+ refreshed: upserted.refreshed,
328
+ skipped: upserted.skipped,
329
+ warnings: [...embedded.warnings, ...upserted.warnings],
330
+ };
331
+ }
332
+ }
333
+ catch (error) {
334
+ refreshedResult = {
335
+ refreshed: [],
336
+ skipped: workload.documents.map((entry) => entry.id),
337
+ warnings: [`search_semantic_refresh_failed:${toErrorMessage(error)}`],
338
+ };
339
+ }
340
+ }
341
+ }
264
342
  const pruneResult = await pruneMissingSemanticVectors(runtimeContext.vectorStore, workload.missingIds);
265
343
  const refreshedIdSet = new Set(refreshedResult.refreshed);
266
344
  const refreshedEntries = Object.fromEntries(workload.documents
@@ -268,16 +346,15 @@ export async function refreshSemanticEmbeddingsForMutatedItems(pmRoot, itemIds,
268
346
  .map((entry) => [entry.id, entry.document.metadata.updated_at]));
269
347
  const ledgerWarnings = [];
270
348
  if (Object.keys(refreshedEntries).length > 0 || workload.missingIds.length > 0) {
271
- const ledgerRead = await readVectorizationStatusLedger(pmRoot);
272
349
  const nextEntries = {
273
- ...ledgerRead.entries,
350
+ ...nextLedgerBaseEntries,
274
351
  ...normalizeVectorizationLedgerEntries(refreshedEntries),
275
352
  };
276
353
  for (const missingId of workload.missingIds) {
277
354
  delete nextEntries[missingId];
278
355
  }
279
356
  try {
280
- await writeVectorizationStatusLedger(pmRoot, nextEntries);
357
+ await writeVectorizationStatusLedger(pmRoot, nextEntries, nextEmbeddingMetadata);
281
358
  }
282
359
  catch (error) {
283
360
  ledgerWarnings.push(`search_vectorization_status_ledger_write_failed:${toErrorMessage(error)}`);
@@ -290,7 +367,20 @@ export async function refreshSemanticEmbeddingsForMutatedItems(pmRoot, itemIds,
290
367
  warnings: [...workload.warnings, ...refreshedResult.warnings, ...pruneResult.warnings, ...ledgerWarnings],
291
368
  };
292
369
  }
293
- export async function refreshSearchArtifactsForMutation(pmRoot, itemIds) {
370
+ /**
371
+ * Returns true when a semantic embedding refresh would do real work for these
372
+ * settings (an embedding provider AND a vector store both resolve). Used to
373
+ * decide whether a mutation's refresh is worth dispatching to a background
374
+ * worker — when semantic search is not configured the inline path is already a
375
+ * fast no-op and no child is spawned.
376
+ */
377
+ export function isSemanticRefreshActive(settings, applyRuntimeDefaults) {
378
+ const effectiveSettings = applyRuntimeDefaults
379
+ ? resolveSettingsWithSemanticRuntimeDefaults(settings).settings
380
+ : settings;
381
+ return Boolean(resolveEmbeddingProviders(effectiveSettings).active && resolveVectorStores(effectiveSettings).active);
382
+ }
383
+ export async function refreshSearchArtifactsForMutation(pmRoot, itemIds, options = {}) {
294
384
  const invalidation = await invalidateSearchCacheArtifacts(pmRoot);
295
385
  const normalizedItemIds = toUniqueSorted(itemIds);
296
386
  if (normalizedItemIds.length === 0) {
@@ -333,9 +423,24 @@ export async function refreshSearchArtifactsForMutation(pmRoot, itemIds) {
333
423
  warnings: invalidation.warnings,
334
424
  };
335
425
  }
426
+ const applyRuntimeDefaults = settings.search.mutation_refresh_policy === "semantic_auto";
427
+ // Keyword cache is already invalidated synchronously above (so keyword search
428
+ // stays immediately correct). When requested, dispatch the slow embedding
429
+ // refresh to a detached worker so the mutation returns instantly; the
430
+ // vector_index_stale health/search warning covers the catch-up window.
431
+ if (options.background && isSemanticRefreshActive(settings, applyRuntimeDefaults)) {
432
+ await scheduleBackgroundSemanticRefresh(pmRoot, normalizedItemIds);
433
+ return {
434
+ invalidated: invalidation.invalidated,
435
+ refreshed: [],
436
+ skipped: [],
437
+ warnings: [...invalidation.warnings, "search_semantic_refresh_scheduled_background"],
438
+ scheduled: true,
439
+ };
440
+ }
336
441
  const semanticRefresh = await refreshSemanticEmbeddingsForMutatedItems(pmRoot, normalizedItemIds, {
337
442
  settings,
338
- apply_runtime_defaults: settings.search.mutation_refresh_policy === "semantic_auto",
443
+ apply_runtime_defaults: applyRuntimeDefaults,
339
444
  });
340
445
  return {
341
446
  invalidated: invalidation.invalidated,
@@ -345,4 +450,4 @@ export async function refreshSearchArtifactsForMutation(pmRoot, itemIds) {
345
450
  };
346
451
  }
347
452
  //# sourceMappingURL=cache.js.map
348
- //# debugId=4a4a71bc-457b-5496-a2e8-e3e3537d01ae
453
+ //# debugId=5d698c95-b557-5c29-bc3f-caf70b5d6d0f
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sources":["core/search/cache.ts"],"sourceRoot":"/","sourcesContent":["import path from \"node:path\";\nimport { getActiveExtensionRegistrations } from \"../extensions/index.js\";\nimport { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { resolveItemTypeRegistry } from \"../item/type-registry.js\";\nimport { toErrorMessage } from \"../shared/primitives.js\";\nimport { locateItem, readLocatedItem } from \"../store/item-store.js\";\nimport { getSettingsPath } from \"../store/paths.js\";\nimport { readSettings } from \"../store/settings.js\";\nimport { executeEmbeddingBatchesWithRetry } from \"./embedding-batches.js\";\nimport { buildSemanticCorpusInput } from \"./corpus.js\";\nimport { resolveEmbeddingProviders } from \"./providers.js\";\nimport type { EmbeddingProviderConfig } from \"./providers.js\";\nimport { resolveSettingsWithSemanticRuntimeDefaults } from \"./semantic-defaults.js\";\nimport { executeVectorDelete, executeVectorUpsert, resolveVectorStores } from \"./vector-stores.js\";\nimport type { VectorStoreConfig } from \"./vector-stores.js\";\nimport { nowIso } from \"../shared/time.js\";\nimport type { ItemDocument, ItemFrontMatter } from \"../../types/index.js\";\n\nexport const SEARCH_CACHE_ARTIFACT_PATHS = [\"index/manifest.json\", \"search/embeddings.jsonl\"] as const;\nexport const VECTORIZATION_STATUS_LEDGER_PATH = \"search/vectorization-status.json\";\n\nexport interface SearchCacheInvalidationResult {\n invalidated: string[];\n warnings: string[];\n}\n\nexport interface SemanticMutationRefreshResult {\n refreshed: string[];\n skipped: string[];\n warnings: string[];\n}\n\nexport interface SearchMutationArtifactRefreshResult extends SearchCacheInvalidationResult {\n refreshed: string[];\n skipped: string[];\n}\n\nexport interface SemanticRefreshOptions {\n settings?: Awaited<ReturnType<typeof readSettings>>;\n apply_runtime_defaults?: boolean;\n}\n\nexport interface VectorizationStatusLedgerReadResult {\n entries: Record<string, string>;\n warnings: string[];\n}\n\nfunction formatInvalidationWarning(relativePath: string, error: unknown): string {\n return `search_cache_invalidation_failed:${relativePath}:${String(error)}`;\n}\n\n\nfunction toUniqueSorted(values: Iterable<string>): string[] {\n return [...new Set([...values].map((value) => value.trim()).filter((value) => value.length > 0))]\n .sort((left, right) => left.localeCompare(right));\n}\n\nfunction isValidUpdatedAt(value: unknown): value is string {\n return typeof value === \"string\" && value.trim().length > 0 && Number.isFinite(Date.parse(value));\n}\n\nfunction normalizeVectorizationLedgerEntries(entries: Record<string, string>): Record<string, string> {\n const normalized = new Map<string, string>();\n for (const [rawId, rawUpdatedAt] of Object.entries(entries)) {\n const id = rawId.trim();\n if (id.length === 0 || !isValidUpdatedAt(rawUpdatedAt)) {\n continue;\n }\n normalized.set(id, rawUpdatedAt);\n }\n return Object.fromEntries([...normalized.entries()].sort((left, right) => left[0].localeCompare(right[0])));\n}\n\nexport async function readVectorizationStatusLedger(pmRoot: string): Promise<VectorizationStatusLedgerReadResult> {\n const ledgerPath = path.join(pmRoot, VECTORIZATION_STATUS_LEDGER_PATH);\n const raw = await readFileIfExists(ledgerPath);\n if (raw === null || raw.trim().length === 0) {\n return {\n entries: {},\n warnings: [],\n };\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n return {\n entries: {},\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n (parsed as { version?: unknown }).version !== 1 ||\n !Array.isArray((parsed as { items?: unknown }).items)\n ) {\n return {\n entries: {},\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n\n const mapped = new Map<string, string>();\n for (const entry of (parsed as { items: unknown[] }).items) {\n if (typeof entry !== \"object\" || entry === null) {\n return {\n entries: {},\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n const id = (entry as { id?: unknown }).id;\n const updatedAt = (entry as { updated_at?: unknown }).updated_at;\n if (typeof id !== \"string\" || id.trim().length === 0 || !isValidUpdatedAt(updatedAt)) {\n return {\n entries: {},\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n mapped.set(id.trim(), updatedAt);\n }\n\n return {\n entries: Object.fromEntries([...mapped.entries()].sort((left, right) => left[0].localeCompare(right[0]))),\n warnings: [],\n };\n}\n\nexport async function writeVectorizationStatusLedger(pmRoot: string, entries: Record<string, string>): Promise<void> {\n const normalizedEntries = normalizeVectorizationLedgerEntries(entries);\n const ledgerPath = path.join(pmRoot, VECTORIZATION_STATUS_LEDGER_PATH);\n const serialized = `${JSON.stringify(\n {\n version: 1,\n generated_at: nowIso(),\n items: Object.entries(normalizedEntries).map(([id, updated_at]) => ({\n id,\n updated_at,\n })),\n },\n null,\n 2,\n )}\\n`;\n await writeFileAtomic(ledgerPath, serialized);\n}\n\nfunction buildVectorPayload(item: ItemFrontMatter): Record<string, unknown> {\n return {\n id: item.id,\n type: item.type,\n status: item.status,\n priority: item.priority,\n updated_at: item.updated_at,\n };\n}\n\ninterface SemanticRefreshRuntimeContext {\n settings: Awaited<ReturnType<typeof readSettings>>;\n provider: EmbeddingProviderConfig;\n vectorStore: VectorStoreConfig;\n}\n\ninterface SemanticRefreshWorkload {\n documents: Array<{ id: string; document: ItemDocument }>;\n missingIds: string[];\n skippedIds: string[];\n warnings: string[];\n}\n\ninterface SemanticRefreshOperationResult {\n refreshed: string[];\n skipped: string[];\n warnings: string[];\n}\n\nfunction buildSkippedSemanticRefreshResult(itemIds: string[], warning: string): SemanticMutationRefreshResult {\n return {\n refreshed: [],\n skipped: itemIds,\n warnings: [warning],\n };\n}\n\nasync function resolveSemanticRefreshRuntimeContext(\n pmRoot: string,\n normalizedItemIds: string[],\n options: SemanticRefreshOptions,\n): Promise<SemanticRefreshRuntimeContext | SemanticMutationRefreshResult> {\n if (!options.settings && !(await pathExists(getSettingsPath(pmRoot)))) {\n return buildSkippedSemanticRefreshResult(normalizedItemIds, \"search_semantic_refresh_skipped:settings_not_initialized\");\n }\n\n let settings: Awaited<ReturnType<typeof readSettings>>;\n try {\n settings = options.settings ?? (await readSettings(pmRoot));\n } catch (error: unknown) {\n return buildSkippedSemanticRefreshResult(\n normalizedItemIds,\n `search_semantic_refresh_skipped:settings_read_failed:${toErrorMessage(error)}`,\n );\n }\n const effectiveSettings = options.apply_runtime_defaults\n ? resolveSettingsWithSemanticRuntimeDefaults(settings).settings\n : settings;\n\n const provider = resolveEmbeddingProviders(effectiveSettings).active;\n if (!provider) {\n return buildSkippedSemanticRefreshResult(normalizedItemIds, \"search_semantic_refresh_skipped:provider_unconfigured\");\n }\n const vectorStore = resolveVectorStores(effectiveSettings).active;\n if (!vectorStore) {\n return buildSkippedSemanticRefreshResult(normalizedItemIds, \"search_semantic_refresh_skipped:vector_store_unconfigured\");\n }\n\n return {\n settings: effectiveSettings,\n provider,\n vectorStore,\n };\n}\n\nasync function collectSemanticRefreshWorkload(\n pmRoot: string,\n idPrefix: string,\n preferredFormat: \"toon\" | \"json_markdown\",\n normalizedItemIds: string[],\n typeToFolder: Record<string, string>,\n schema: Awaited<ReturnType<typeof readSettings>>[\"schema\"],\n): Promise<SemanticRefreshWorkload> {\n const warnings: string[] = [];\n const skipped = new Set<string>();\n const missing = new Set<string>();\n const documents: Array<{ id: string; document: ItemDocument }> = [];\n\n for (const itemId of normalizedItemIds) {\n const located = await locateItem(pmRoot, itemId, idPrefix, preferredFormat, typeToFolder);\n if (!located) {\n missing.add(itemId);\n continue;\n }\n\n try {\n const loaded = await readLocatedItem(located, { schema });\n documents.push({\n id: loaded.document.metadata.id,\n document: loaded.document,\n });\n } catch (error: unknown) {\n skipped.add(located.id);\n warnings.push(`search_semantic_refresh_item_read_failed:${located.id}:${toErrorMessage(error)}`);\n }\n }\n\n documents.sort((left, right) => left.id.localeCompare(right.id));\n return {\n documents,\n missingIds: toUniqueSorted(missing),\n skippedIds: toUniqueSorted(skipped),\n warnings,\n };\n}\n\nasync function refreshLocatedSemanticVectors(\n settings: Awaited<ReturnType<typeof readSettings>>,\n provider: EmbeddingProviderConfig,\n vectorStore: VectorStoreConfig,\n documents: Array<{ id: string; document: ItemDocument }>,\n): Promise<SemanticRefreshOperationResult> {\n if (documents.length === 0) {\n return { refreshed: [], skipped: [], warnings: [] };\n }\n\n try {\n const corpusInputs = documents.map((entry) =>\n buildSemanticCorpusInput(entry.document, {\n providerName: provider.name,\n }),\n );\n const embeddingResult = await executeEmbeddingBatchesWithRetry(provider, settings, corpusInputs);\n await executeVectorUpsert(\n vectorStore,\n documents.map((entry, index) => ({\n id: entry.id,\n vector: embeddingResult.vectors[index],\n payload: buildVectorPayload(entry.document.metadata),\n })),\n );\n return {\n refreshed: documents.map((entry) => entry.id),\n skipped: [],\n warnings: embeddingResult.warnings,\n };\n } catch (error: unknown) {\n return {\n refreshed: [],\n skipped: documents.map((entry) => entry.id),\n warnings: [`search_semantic_refresh_failed:${toErrorMessage(error)}`],\n };\n }\n}\n\nasync function pruneMissingSemanticVectors(\n vectorStore: VectorStoreConfig,\n missingIds: string[],\n): Promise<SemanticRefreshOperationResult> {\n if (missingIds.length === 0) {\n return { refreshed: [], skipped: [], warnings: [] };\n }\n try {\n await executeVectorDelete(vectorStore, missingIds);\n return {\n refreshed: [],\n skipped: [],\n warnings: [],\n };\n } catch (error: unknown) {\n return {\n refreshed: [],\n skipped: missingIds,\n warnings: [`search_semantic_refresh_delete_failed:${toErrorMessage(error)}`],\n };\n }\n}\n\nexport async function invalidateSearchCacheArtifacts(pmRoot: string): Promise<SearchCacheInvalidationResult> {\n const invalidated: string[] = [];\n const warnings: string[] = [];\n\n for (const relativePath of SEARCH_CACHE_ARTIFACT_PATHS) {\n const artifactPath = path.join(pmRoot, relativePath);\n try {\n if (!(await pathExists(artifactPath))) {\n continue;\n }\n await removeFileIfExists(artifactPath);\n invalidated.push(relativePath);\n } catch (error: unknown) {\n warnings.push(formatInvalidationWarning(relativePath, error));\n }\n }\n\n return {\n invalidated,\n warnings,\n };\n}\n\nexport async function refreshSemanticEmbeddingsForMutatedItems(\n pmRoot: string,\n itemIds: string[],\n options: SemanticRefreshOptions = {},\n): Promise<SemanticMutationRefreshResult> {\n const normalizedItemIds = toUniqueSorted(itemIds);\n if (normalizedItemIds.length === 0) {\n return {\n refreshed: [],\n skipped: [],\n warnings: [],\n };\n }\n\n const runtimeContext = await resolveSemanticRefreshRuntimeContext(pmRoot, normalizedItemIds, options);\n if (!(\"settings\" in runtimeContext)) {\n return runtimeContext;\n }\n const typeRegistry = resolveItemTypeRegistry(runtimeContext.settings, getActiveExtensionRegistrations());\n const workload = await collectSemanticRefreshWorkload(\n pmRoot,\n runtimeContext.settings.id_prefix,\n runtimeContext.settings.item_format,\n normalizedItemIds,\n typeRegistry.type_to_folder,\n runtimeContext.settings.schema,\n );\n const refreshedResult = await refreshLocatedSemanticVectors(\n runtimeContext.settings,\n runtimeContext.provider,\n runtimeContext.vectorStore,\n workload.documents,\n );\n const pruneResult = await pruneMissingSemanticVectors(runtimeContext.vectorStore, workload.missingIds);\n const refreshedIdSet = new Set(refreshedResult.refreshed);\n const refreshedEntries = Object.fromEntries(\n workload.documents\n .filter((entry) => refreshedIdSet.has(entry.id))\n .map((entry) => [entry.id, entry.document.metadata.updated_at]),\n );\n const ledgerWarnings: string[] = [];\n if (Object.keys(refreshedEntries).length > 0 || workload.missingIds.length > 0) {\n const ledgerRead = await readVectorizationStatusLedger(pmRoot);\n const nextEntries = {\n ...ledgerRead.entries,\n ...normalizeVectorizationLedgerEntries(refreshedEntries),\n };\n for (const missingId of workload.missingIds) {\n delete nextEntries[missingId];\n }\n try {\n await writeVectorizationStatusLedger(pmRoot, nextEntries);\n } catch (error: unknown) {\n ledgerWarnings.push(`search_vectorization_status_ledger_write_failed:${toErrorMessage(error)}`);\n }\n ledgerWarnings.push(...ledgerRead.warnings);\n }\n\n return {\n refreshed: toUniqueSorted([...refreshedResult.refreshed, ...pruneResult.refreshed]),\n skipped: toUniqueSorted([...workload.skippedIds, ...refreshedResult.skipped, ...pruneResult.skipped]),\n warnings: [...workload.warnings, ...refreshedResult.warnings, ...pruneResult.warnings, ...ledgerWarnings],\n };\n}\n\nexport async function refreshSearchArtifactsForMutation(\n pmRoot: string,\n itemIds: string[],\n): Promise<SearchMutationArtifactRefreshResult> {\n const invalidation = await invalidateSearchCacheArtifacts(pmRoot);\n const normalizedItemIds = toUniqueSorted(itemIds);\n if (normalizedItemIds.length === 0) {\n return {\n invalidated: invalidation.invalidated,\n refreshed: [],\n skipped: [],\n warnings: invalidation.warnings,\n };\n }\n\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n const semanticRefresh = await refreshSemanticEmbeddingsForMutatedItems(pmRoot, normalizedItemIds);\n return {\n invalidated: invalidation.invalidated,\n refreshed: semanticRefresh.refreshed,\n skipped: semanticRefresh.skipped,\n warnings: [...invalidation.warnings, ...semanticRefresh.warnings],\n };\n }\n\n let settings: Awaited<ReturnType<typeof readSettings>>;\n try {\n settings = await readSettings(pmRoot);\n } catch (error: unknown) {\n return {\n invalidated: invalidation.invalidated,\n refreshed: [],\n skipped: normalizedItemIds,\n warnings: [\n ...invalidation.warnings,\n `search_semantic_refresh_skipped:settings_read_failed:${toErrorMessage(error)}`,\n ],\n };\n }\n\n if (settings.search.mutation_refresh_policy === \"cache_only\") {\n return {\n invalidated: invalidation.invalidated,\n refreshed: [],\n skipped: normalizedItemIds,\n warnings: invalidation.warnings,\n };\n }\n\n const semanticRefresh = await refreshSemanticEmbeddingsForMutatedItems(pmRoot, normalizedItemIds, {\n settings,\n apply_runtime_defaults: settings.search.mutation_refresh_policy === \"semantic_auto\",\n });\n return {\n invalidated: invalidation.invalidated,\n refreshed: semanticRefresh.refreshed,\n skipped: semanticRefresh.skipped,\n warnings: [...invalidation.warnings, ...semanticRefresh.warnings],\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,0CAA0C,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEnG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,MAAM,CAAC,MAAM,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AW;QACrC,SAAS,EAAE,eAAe,CAAC,SAAS;QACpC,OAAO,EAAE,eAAe,CAAC,OAAO;QAChC,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,eAAe,CAAC,QAAQ,CAAC;KAClE,CAAC;AACJ,CAAC","debugId":"4a4a71bc-457b-5496-a2e8-e3e3537d01ae"}
1
+ {"version":3,"file":"cache.js","sources":["core/search/cache.ts"],"sourceRoot":"/","sourcesContent":["import path from \"node:path\";\nimport { getActiveExtensionRegistrations } from \"../extensions/index.js\";\nimport { pathExists, readFileIfExists, removeFileIfExists, writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { resolveItemTypeRegistry } from \"../item/type-registry.js\";\nimport { toErrorMessage } from \"../shared/primitives.js\";\nimport { locateItem, readLocatedItem } from \"../store/item-store.js\";\nimport { getSettingsPath } from \"../store/paths.js\";\nimport { readSettings } from \"../store/settings.js\";\nimport { executeEmbeddingBatchesWithRetry } from \"./embedding-batches.js\";\nimport { buildSemanticCorpusInput } from \"./corpus.js\";\nimport { resolveEmbeddingProviders } from \"./providers.js\";\nimport type { EmbeddingProviderConfig } from \"./providers.js\";\nimport { resolveSettingsWithSemanticRuntimeDefaults } from \"./semantic-defaults.js\";\nimport { scheduleBackgroundSemanticRefresh } from \"./background-refresh.js\";\nimport { executeVectorDelete, executeVectorReset, executeVectorUpsert, resolveVectorStores } from \"./vector-stores.js\";\nimport type { VectorStoreConfig } from \"./vector-stores.js\";\nimport {\n buildVectorizationEmbeddingIdentity,\n buildVectorizationEmbeddingMetadata,\n hasVectorizationEmbeddingIdentityChanged,\n hasVectorizationVectorDimensionChanged,\n inferConsistentVectorDimension,\n normalizeVectorizationEmbeddingMetadata,\n} from \"./vectorization-metadata.js\";\nimport type {\n VectorizationEmbeddingIdentity,\n VectorizationEmbeddingMetadata,\n} from \"./vectorization-metadata.js\";\nimport { nowIso } from \"../shared/time.js\";\nimport type { ItemDocument, ItemFrontMatter } from \"../../types/index.js\";\n\nexport const SEARCH_CACHE_ARTIFACT_PATHS = [\"index/manifest.json\", \"search/embeddings.jsonl\"] as const;\nexport const VECTORIZATION_STATUS_LEDGER_PATH = \"search/vectorization-status.json\";\n\nexport interface SearchCacheInvalidationResult {\n invalidated: string[];\n warnings: string[];\n}\n\nexport interface SemanticMutationRefreshResult {\n refreshed: string[];\n skipped: string[];\n warnings: string[];\n}\n\nexport interface SearchMutationArtifactRefreshResult extends SearchCacheInvalidationResult {\n refreshed: string[];\n skipped: string[];\n /** True when the semantic refresh was dispatched to a detached background worker. */\n scheduled?: boolean;\n}\n\nexport interface RefreshSearchArtifactsForMutationOptions {\n /**\n * When true and semantic search is active, the (slow) embedding refresh is\n * dispatched to a detached background worker instead of awaited inline so the\n * mutation returns immediately. The synchronous keyword-cache invalidation\n * still runs first. Callers pass this only outside test runners.\n */\n background?: boolean;\n}\n\nexport interface SemanticRefreshOptions {\n settings?: Awaited<ReturnType<typeof readSettings>>;\n apply_runtime_defaults?: boolean;\n}\n\nexport interface VectorizationStatusLedgerReadResult {\n entries: Record<string, string>;\n embedding: VectorizationEmbeddingMetadata | null;\n warnings: string[];\n}\n\nfunction formatInvalidationWarning(relativePath: string, error: unknown): string {\n return `search_cache_invalidation_failed:${relativePath}:${String(error)}`;\n}\n\n\nfunction toUniqueSorted(values: Iterable<string>): string[] {\n return [...new Set([...values].map((value) => value.trim()).filter((value) => value.length > 0))]\n .sort((left, right) => left.localeCompare(right));\n}\n\nfunction isValidUpdatedAt(value: unknown): value is string {\n return typeof value === \"string\" && value.trim().length > 0 && Number.isFinite(Date.parse(value));\n}\n\nfunction normalizeVectorizationLedgerEntries(entries: Record<string, string>): Record<string, string> {\n const normalized = new Map<string, string>();\n for (const [rawId, rawUpdatedAt] of Object.entries(entries)) {\n const id = rawId.trim();\n if (id.length === 0 || !isValidUpdatedAt(rawUpdatedAt)) {\n continue;\n }\n normalized.set(id, rawUpdatedAt);\n }\n return Object.fromEntries([...normalized.entries()].sort((left, right) => left[0].localeCompare(right[0])));\n}\n\nexport async function readVectorizationStatusLedger(pmRoot: string): Promise<VectorizationStatusLedgerReadResult> {\n const ledgerPath = path.join(pmRoot, VECTORIZATION_STATUS_LEDGER_PATH);\n const raw = await readFileIfExists(ledgerPath);\n if (raw === null || raw.trim().length === 0) {\n return {\n entries: {},\n embedding: null,\n warnings: [],\n };\n }\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n return {\n entries: {},\n embedding: null,\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n\n if (\n typeof parsed !== \"object\" ||\n parsed === null ||\n (parsed as { version?: unknown }).version !== 1 ||\n !Array.isArray((parsed as { items?: unknown }).items)\n ) {\n return {\n entries: {},\n embedding: null,\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n\n const mapped = new Map<string, string>();\n for (const entry of (parsed as { items: unknown[] }).items) {\n if (typeof entry !== \"object\" || entry === null) {\n return {\n entries: {},\n embedding: null,\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n const id = (entry as { id?: unknown }).id;\n const updatedAt = (entry as { updated_at?: unknown }).updated_at;\n if (typeof id !== \"string\" || id.trim().length === 0 || !isValidUpdatedAt(updatedAt)) {\n return {\n entries: {},\n embedding: null,\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n mapped.set(id.trim(), updatedAt);\n }\n\n let embedding: VectorizationEmbeddingMetadata | null = null;\n try {\n embedding = normalizeVectorizationEmbeddingMetadata((parsed as { embedding?: unknown }).embedding);\n } catch {\n return {\n entries: {},\n embedding: null,\n warnings: [\"search_vectorization_status_ledger_invalid\"],\n };\n }\n\n return {\n entries: Object.fromEntries([...mapped.entries()].sort((left, right) => left[0].localeCompare(right[0]))),\n embedding,\n warnings: [],\n };\n}\n\nexport async function writeVectorizationStatusLedger(\n pmRoot: string,\n entries: Record<string, string>,\n embedding?: VectorizationEmbeddingMetadata | null,\n): Promise<void> {\n const normalizedEntries = normalizeVectorizationLedgerEntries(entries);\n const ledgerPath = path.join(pmRoot, VECTORIZATION_STATUS_LEDGER_PATH);\n const serialized = `${JSON.stringify(\n {\n version: 1,\n generated_at: nowIso(),\n ...(embedding ? { embedding } : {}),\n items: Object.entries(normalizedEntries).map(([id, updated_at]) => ({\n id,\n updated_at,\n })),\n },\n null,\n 2,\n )}\\n`;\n await writeFileAtomic(ledgerPath, serialized);\n}\n\nfunction buildVectorPayload(item: ItemFrontMatter): Record<string, unknown> {\n return {\n id: item.id,\n type: item.type,\n status: item.status,\n priority: item.priority,\n updated_at: item.updated_at,\n };\n}\n\ninterface SemanticRefreshRuntimeContext {\n settings: Awaited<ReturnType<typeof readSettings>>;\n provider: EmbeddingProviderConfig;\n vectorStore: VectorStoreConfig;\n}\n\ninterface SemanticRefreshWorkload {\n documents: Array<{ id: string; document: ItemDocument }>;\n missingIds: string[];\n skippedIds: string[];\n warnings: string[];\n}\n\ninterface SemanticRefreshOperationResult {\n refreshed: string[];\n skipped: string[];\n warnings: string[];\n}\n\ninterface SemanticEmbeddingOperationResult {\n vectors: number[][];\n vector_dimension: number;\n warnings: string[];\n}\n\nfunction buildVectorizationIdentityForProvider(provider: EmbeddingProviderConfig): VectorizationEmbeddingIdentity {\n const identity = buildVectorizationEmbeddingIdentity(provider.name, provider.model);\n if (!identity) {\n throw new Error(\"Embedding provider must include a provider name and model\");\n }\n return identity;\n}\n\nfunction buildSkippedSemanticRefreshResult(itemIds: string[], warning: string): SemanticMutationRefreshResult {\n return {\n refreshed: [],\n skipped: itemIds,\n warnings: [warning],\n };\n}\n\nasync function resolveSemanticRefreshRuntimeContext(\n pmRoot: string,\n normalizedItemIds: string[],\n options: SemanticRefreshOptions,\n): Promise<SemanticRefreshRuntimeContext | SemanticMutationRefreshResult> {\n if (!options.settings && !(await pathExists(getSettingsPath(pmRoot)))) {\n return buildSkippedSemanticRefreshResult(normalizedItemIds, \"search_semantic_refresh_skipped:settings_not_initialized\");\n }\n\n let settings: Awaited<ReturnType<typeof readSettings>>;\n try {\n settings = options.settings ?? (await readSettings(pmRoot));\n } catch (error: unknown) {\n return buildSkippedSemanticRefreshResult(\n normalizedItemIds,\n `search_semantic_refresh_skipped:settings_read_failed:${toErrorMessage(error)}`,\n );\n }\n const effectiveSettings = options.apply_runtime_defaults\n ? resolveSettingsWithSemanticRuntimeDefaults(settings).settings\n : settings;\n\n const provider = resolveEmbeddingProviders(effectiveSettings).active;\n if (!provider) {\n return buildSkippedSemanticRefreshResult(normalizedItemIds, \"search_semantic_refresh_skipped:provider_unconfigured\");\n }\n const vectorStore = resolveVectorStores(effectiveSettings).active;\n if (!vectorStore) {\n return buildSkippedSemanticRefreshResult(normalizedItemIds, \"search_semantic_refresh_skipped:vector_store_unconfigured\");\n }\n\n return {\n settings: effectiveSettings,\n provider,\n vectorStore,\n };\n}\n\nasync function collectSemanticRefreshWorkload(\n pmRoot: string,\n idPrefix: string,\n preferredFormat: \"toon\" | \"json_markdown\",\n normalizedItemIds: string[],\n typeToFolder: Record<string, string>,\n schema: Awaited<ReturnType<typeof readSettings>>[\"schema\"],\n): Promise<SemanticRefreshWorkload> {\n const warnings: string[] = [];\n const skipped = new Set<string>();\n const missing = new Set<string>();\n const documents: Array<{ id: string; document: ItemDocument }> = [];\n\n for (const itemId of normalizedItemIds) {\n const located = await locateItem(pmRoot, itemId, idPrefix, preferredFormat, typeToFolder);\n if (!located) {\n missing.add(itemId);\n continue;\n }\n\n try {\n const loaded = await readLocatedItem(located, { schema });\n documents.push({\n id: loaded.document.metadata.id,\n document: loaded.document,\n });\n } catch (error: unknown) {\n skipped.add(located.id);\n warnings.push(`search_semantic_refresh_item_read_failed:${located.id}:${toErrorMessage(error)}`);\n }\n }\n\n documents.sort((left, right) => left.id.localeCompare(right.id));\n return {\n documents,\n missingIds: toUniqueSorted(missing),\n skippedIds: toUniqueSorted(skipped),\n warnings,\n };\n}\n\nasync function embedLocatedSemanticVectors(\n settings: Awaited<ReturnType<typeof readSettings>>,\n provider: EmbeddingProviderConfig,\n documents: Array<{ id: string; document: ItemDocument }>,\n): Promise<SemanticEmbeddingOperationResult> {\n const corpusInputs = documents.map((entry) =>\n buildSemanticCorpusInput(entry.document, {\n providerName: provider.name,\n }),\n );\n const embeddingResult = await executeEmbeddingBatchesWithRetry(provider, settings, corpusInputs);\n return {\n vectors: embeddingResult.vectors,\n vector_dimension: inferConsistentVectorDimension(embeddingResult.vectors, \"Semantic refresh embedding\"),\n warnings: embeddingResult.warnings,\n };\n}\n\nasync function upsertLocatedSemanticVectors(\n vectorStore: VectorStoreConfig,\n documents: Array<{ id: string; document: ItemDocument }>,\n vectors: number[][],\n): Promise<SemanticRefreshOperationResult> {\n await executeVectorUpsert(\n vectorStore,\n documents.map((entry, index) => ({\n id: entry.id,\n vector: vectors[index],\n payload: buildVectorPayload(entry.document.metadata),\n })),\n );\n return {\n refreshed: documents.map((entry) => entry.id),\n skipped: [],\n warnings: [],\n };\n}\n\nasync function resetSemanticVectorStore(\n vectorStore: VectorStoreConfig,\n ledgerEntries: Record<string, string>,\n): Promise<SemanticRefreshOperationResult> {\n try {\n await executeVectorReset(vectorStore, Object.keys(ledgerEntries));\n return { refreshed: [], skipped: [], warnings: [] };\n } catch (error: unknown) {\n return {\n refreshed: [],\n skipped: [],\n warnings: [`search_semantic_refresh_reset_failed:${toErrorMessage(error)}`],\n };\n }\n}\n\nasync function pruneMissingSemanticVectors(\n vectorStore: VectorStoreConfig,\n missingIds: string[],\n): Promise<SemanticRefreshOperationResult> {\n if (missingIds.length === 0) {\n return { refreshed: [], skipped: [], warnings: [] };\n }\n try {\n await executeVectorDelete(vectorStore, missingIds);\n return {\n refreshed: [],\n skipped: [],\n warnings: [],\n };\n } catch (error: unknown) {\n return {\n refreshed: [],\n skipped: missingIds,\n warnings: [`search_semantic_refresh_delete_failed:${toErrorMessage(error)}`],\n };\n }\n}\n\nexport async function invalidateSearchCacheArtifacts(pmRoot: string): Promise<SearchCacheInvalidationResult> {\n const invalidated: string[] = [];\n const warnings: string[] = [];\n\n for (const relativePath of SEARCH_CACHE_ARTIFACT_PATHS) {\n const artifactPath = path.join(pmRoot, relativePath);\n try {\n if (!(await pathExists(artifactPath))) {\n continue;\n }\n await removeFileIfExists(artifactPath);\n invalidated.push(relativePath);\n } catch (error: unknown) {\n warnings.push(formatInvalidationWarning(relativePath, error));\n }\n }\n\n return {\n invalidated,\n warnings,\n };\n}\n\nexport async function refreshSemanticEmbeddingsForMutatedItems(\n pmRoot: string,\n itemIds: string[],\n options: SemanticRefreshOptions = {},\n): Promise<SemanticMutationRefreshResult> {\n const normalizedItemIds = toUniqueSorted(itemIds);\n if (normalizedItemIds.length === 0) {\n return {\n refreshed: [],\n skipped: [],\n warnings: [],\n };\n }\n\n const runtimeContext = await resolveSemanticRefreshRuntimeContext(pmRoot, normalizedItemIds, options);\n if (!(\"settings\" in runtimeContext)) {\n return runtimeContext;\n }\n const typeRegistry = resolveItemTypeRegistry(runtimeContext.settings, getActiveExtensionRegistrations());\n const workload = await collectSemanticRefreshWorkload(\n pmRoot,\n runtimeContext.settings.id_prefix,\n runtimeContext.settings.item_format,\n normalizedItemIds,\n typeRegistry.type_to_folder,\n runtimeContext.settings.schema,\n );\n const ledgerRead =\n workload.documents.length > 0 || workload.missingIds.length > 0\n ? await readVectorizationStatusLedger(pmRoot)\n : { entries: {}, embedding: null, warnings: [] };\n const embeddingIdentity = buildVectorizationIdentityForProvider(runtimeContext.provider);\n const nextLedgerBaseEntries = ledgerRead.entries;\n let refreshedResult: SemanticRefreshOperationResult = { refreshed: [], skipped: [], warnings: [] };\n let nextEmbeddingMetadata = ledgerRead.embedding;\n if (workload.documents.length > 0) {\n if (ledgerRead.embedding && hasVectorizationEmbeddingIdentityChanged(ledgerRead.embedding, embeddingIdentity)) {\n refreshedResult = {\n refreshed: [],\n skipped: workload.documents.map((entry) => entry.id),\n warnings: [\"search_semantic_refresh_requires_reindex:embedding_identity_changed\"],\n };\n } else {\n try {\n const embedded = await embedLocatedSemanticVectors(\n runtimeContext.settings,\n runtimeContext.provider,\n workload.documents,\n );\n if (hasVectorizationVectorDimensionChanged(ledgerRead.embedding, embedded.vector_dimension)) {\n refreshedResult = {\n refreshed: [],\n skipped: workload.documents.map((entry) => entry.id),\n warnings: [...embedded.warnings, \"search_semantic_refresh_requires_reindex:vector_dimension_changed\"],\n };\n } else {\n nextEmbeddingMetadata = buildVectorizationEmbeddingMetadata(embeddingIdentity, embedded.vector_dimension);\n const upserted = await upsertLocatedSemanticVectors(runtimeContext.vectorStore, workload.documents, embedded.vectors);\n refreshedResult = {\n refreshed: upserted.refreshed,\n skipped: upserted.skipped,\n warnings: [...embedded.warnings, ...upserted.warnings],\n };\n }\n } catch (error: unknown) {\n refreshedResult = {\n refreshed: [],\n skipped: workload.documents.map((entry) => entry.id),\n warnings: [`search_semantic_refresh_failed:${toErrorMessage(error)}`],\n };\n }\n }\n }\n const pruneResult = await pruneMissingSemanticVectors(runtimeContext.vectorStore, workload.missingIds);\n const refreshedIdSet = new Set(refreshedResult.refreshed);\n const refreshedEntries = Object.fromEntries(\n workload.documents\n .filter((entry) => refreshedIdSet.has(entry.id))\n .map((entry) => [entry.id, entry.document.metadata.updated_at]),\n );\n const ledgerWarnings: string[] = [];\n if (Object.keys(refreshedEntries).length > 0 || workload.missingIds.length > 0) {\n const nextEntries = {\n ...nextLedgerBaseEntries,\n ...normalizeVectorizationLedgerEntries(refreshedEntries),\n };\n for (const missingId of workload.missingIds) {\n delete nextEntries[missingId];\n }\n try {\n await writeVectorizationStatusLedger(pmRoot, nextEntries, nextEmbeddingMetadata);\n } catch (error: unknown) {\n ledgerWarnings.push(`search_vectorization_status_ledger_write_failed:${toErrorMessage(error)}`);\n }\n ledgerWarnings.push(...ledgerRead.warnings);\n }\n\n return {\n refreshed: toUniqueSorted([...refreshedResult.refreshed, ...pruneResult.refreshed]),\n skipped: toUniqueSorted([...workload.skippedIds, ...refreshedResult.skipped, ...pruneResult.skipped]),\n warnings: [...workload.warnings, ...refreshedResult.warnings, ...pruneResult.warnings, ...ledgerWarnings],\n };\n}\n\n/**\n * Returns true when a semantic embedding refresh would do real work for these\n * settings (an embedding provider AND a vector store both resolve). Used to\n * decide whether a mutation's refresh is worth dispatching to a background\n * worker — when semantic search is not configured the inline path is already a\n * fast no-op and no child is spawned.\n */\nexport function isSemanticRefreshActive(\n settings: Awaited<ReturnType<typeof readSettings>>,\n applyRuntimeDefaults: boolean,\n): boolean {\n const effectiveSettings = applyRuntimeDefaults\n ? resolveSettingsWithSemanticRuntimeDefaults(settings).settings\n : settings;\n return Boolean(resolveEmbeddingProviders(effectiveSettings).active && resolveVectorStores(effectiveSettings).active);\n}\n\nexport async function refreshSearchArtifactsForMutation(\n pmRoot: string,\n itemIds: string[],\n options: RefreshSearchArtifactsForMutationOptions = {},\n): Promise<SearchMutationArtifactRefreshResult> {\n const invalidation = await invalidateSearchCacheArtifacts(pmRoot);\n const normalizedItemIds = toUniqueSorted(itemIds);\n if (normalizedItemIds.length === 0) {\n return {\n invalidated: invalidation.invalidated,\n refreshed: [],\n skipped: [],\n warnings: invalidation.warnings,\n };\n }\n\n if (!(await pathExists(getSettingsPath(pmRoot)))) {\n const semanticRefresh = await refreshSemanticEmbeddingsForMutatedItems(pmRoot, normalizedItemIds);\n return {\n invalidated: invalidation.invalidated,\n refreshed: semanticRefresh.refreshed,\n skipped: semanticRefresh.skipped,\n warnings: [...invalidation.warnings, ...semanticRefresh.warnings],\n };\n }\n\n let settings: Awaited<ReturnType<typeof readSettings>>;\n try {\n settings = await readSettings(pmRoot);\n } catch (error: unknown) {\n return {\n invalidated: invalidation.invalidated,\n refreshed: [],\n skipped: normalizedItemIds,\n warnings: [\n ...invalidation.warnings,\n `search_semantic_refresh_skipped:settings_read_failed:${toErrorMessage(error)}`,\n ],\n };\n }\n\n if (settings.search.mutation_refresh_policy === \"cache_only\") {\n return {\n invalidated: invalidation.invalidated,\n refreshed: [],\n skipped: normalizedItemIds,\n warnings: invalidation.warnings,\n };\n }\n\n const applyRuntimeDefaults = settings.search.mutation_refresh_policy === \"semantic_auto\";\n\n // Keyword cache is already invalidated synchronously above (so keyword search\n // stays immediately correct). When requested, dispatch the slow embedding\n // refresh to a detached worker so the mutation returns instantly; the\n // vector_index_stale health/search warning covers the catch-up window.\n if (options.background && isSemanticRefreshActive(settings, applyRuntimeDefaults)) {\n await scheduleBackgroundSemanticRefresh(pmRoot, normalizedItemIds);\n return {\n invalidated: invalidation.invalidated,\n refreshed: [],\n skipped: [],\n warnings: [...invalidation.warnings, \"search_semantic_refresh_scheduled_background\"],\n scheduled: true,\n };\n }\n\n const semanticRefresh = await refreshSemanticEmbeddingsForMutatedItems(pmRoot, normalizedItemIds, {\n settings,\n apply_runtime_defaults: applyRuntimeDefaults,\n });\n return {\n invalidated: invalidation.invalidated,\n refreshed: semanticRefresh.refreshed,\n skipped: semanticRefresh.skipped,\n warnings: [...invalidation.warnings, ...semanticRefresh.warnings],\n };\n}\n"],"names":[],"mappings":";;AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,0CAA0C,EAAE,MAAM,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AAC,EAAE,CAAC;QAClF,MAAM,iCAAiC,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACnE,OAAO;YACL,WAAW,EAAE,YAAY,CAAC,WAAW;YACrC,SAAS,EAAE,EAAE;YACb,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,8CAA8C,CAAC;YACpF,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,wCAAwC,CAAC,MAAM,EAAE,iBAAiB,EAAE;QAChG,QAAQ;QACR,sBAAsB,EAAE,oBAAoB;KAC7C,CAAC,CAAC;IACH,OAAO;QACL,WAAW,EAAE,YAAY,CAAC,WAAW;QACrC,SAAS,EAAE,eAAe,CAAC,SAAS;QACpC,OAAO,EAAE,eAAe,CAAC,OAAO;QAChC,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,GAAG,eAAe,CAAC,QAAQ,CAAC;KAClE,CAAC;AACJ,CAAC","debugId":"5d698c95-b557-5c29-bc3f-caf70b5d6d0f"}
@@ -7,7 +7,7 @@ export interface SearchHttpResponse {
7
7
  text(): Promise<string>;
8
8
  }
9
9
  export interface SearchHttpRequestInit {
10
- method: "POST";
10
+ method: "DELETE" | "POST" | "PUT";
11
11
  headers: Record<string, string>;
12
12
  body: string;
13
13
  signal: AbortSignal;
@@ -15,7 +15,7 @@ export interface SearchHttpRequestInit {
15
15
  export type SearchHttpFetcher<ResponseType extends SearchHttpResponse = SearchHttpResponse> = (url: string, init: SearchHttpRequestInit) => Promise<ResponseType>;
16
16
  export interface ExecuteSearchJsonRequestOptions<ResponseType extends SearchHttpResponse = SearchHttpResponse> {
17
17
  endpoint: string;
18
- method: "POST";
18
+ method: "DELETE" | "POST" | "PUT";
19
19
  headers: Record<string, string>;
20
20
  body: Record<string, unknown>;
21
21
  timeoutMs: number;
@@ -1,5 +1,5 @@
1
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]="38ceb1f2-1c32-5e61-9982-cac553c770f4")}catch(e){}}();
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]="197ad05c-3904-5eed-8de9-def28a40c3f4")}catch(e){}}();
3
3
  import { toErrorMessage } from "../shared/primitives.js";
4
4
  export const DEFAULT_SEARCH_HTTP_TIMEOUT_MS = 30_000;
5
5
  export function normalizeSearchHttpTimeoutMs(timeoutMs, requestLabel, defaultTimeoutMs = DEFAULT_SEARCH_HTTP_TIMEOUT_MS) {
@@ -64,4 +64,4 @@ export async function executeSearchJsonRequest(options) {
64
64
  }
65
65
  }
66
66
  //# sourceMappingURL=http-client.js.map
67
- //# debugId=38ceb1f2-1c32-5e61-9982-cac553c770f4
67
+ //# debugId=197ad05c-3904-5eed-8de9-def28a40c3f4
@@ -1 +1 @@
1
- {"version":3,"file":"http-client.js","sources":["core/search/http-client.ts"],"sourceRoot":"/","sourcesContent":["import { toErrorMessage } from \"../shared/primitives.js\";\n\nexport const DEFAULT_SEARCH_HTTP_TIMEOUT_MS = 30_000;\n\nexport interface SearchHttpResponse {\n ok: boolean;\n status: number;\n statusText: string;\n json(): Promise<unknown>;\n text(): Promise<string>;\n}\n\nexport interface SearchHttpRequestInit {\n method: \"POST\";\n headers: Record<string, string>;\n body: string;\n signal: AbortSignal;\n}\n\nexport type SearchHttpFetcher<ResponseType extends SearchHttpResponse = SearchHttpResponse> = (\n url: string,\n init: SearchHttpRequestInit,\n) => Promise<ResponseType>;\n\nexport interface ExecuteSearchJsonRequestOptions<ResponseType extends SearchHttpResponse = SearchHttpResponse> {\n endpoint: string;\n method: \"POST\";\n headers: Record<string, string>;\n body: Record<string, unknown>;\n timeoutMs: number;\n fetcher: SearchHttpFetcher<ResponseType>;\n requestLabel: string;\n responseLabel: string;\n}\n\nexport function normalizeSearchHttpTimeoutMs(\n timeoutMs: number | undefined,\n requestLabel: string,\n defaultTimeoutMs = DEFAULT_SEARCH_HTTP_TIMEOUT_MS,\n): number {\n const resolved = timeoutMs ?? defaultTimeoutMs;\n if (!Number.isFinite(resolved) || resolved <= 0) {\n throw new Error(`${requestLabel} timeout must be a positive finite number`);\n }\n return Math.floor(resolved);\n}\n\nexport function resolveSearchHttpFetcher<ResponseType extends SearchHttpResponse>(\n fetcher: SearchHttpFetcher<ResponseType> | undefined,\n requestLabel: string,\n): SearchHttpFetcher<ResponseType> {\n if (fetcher) {\n return fetcher;\n }\n if (typeof globalThis.fetch === \"function\") {\n return globalThis.fetch.bind(globalThis) as unknown as SearchHttpFetcher<ResponseType>;\n }\n throw new Error(`${requestLabel} execution requires a fetch implementation`);\n}\n\nexport async function readFailedSearchHttpResponseBody(response: SearchHttpResponse): Promise<string> {\n try {\n return (await response.text()).replaceAll(/\\s+/g, \" \").trim();\n } catch (error) {\n return `(failed to read response body: ${toErrorMessage(error)})`;\n }\n}\n\nexport async function executeSearchJsonRequest<ResponseType extends SearchHttpResponse>(\n options: ExecuteSearchJsonRequestOptions<ResponseType>,\n): Promise<unknown> {\n const controller = new AbortController();\n const timeoutHandle = setTimeout(() => {\n controller.abort();\n }, options.timeoutMs);\n\n try {\n let response: ResponseType;\n try {\n response = await options.fetcher(options.endpoint, {\n method: options.method,\n headers: options.headers,\n body: JSON.stringify(options.body),\n signal: controller.signal,\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new Error(`${options.requestLabel} timed out after ${options.timeoutMs}ms`);\n }\n throw new Error(`${options.requestLabel} execution failed: ${toErrorMessage(error)}`);\n }\n\n if (!response.ok) {\n const responseBody = await readFailedSearchHttpResponseBody(response);\n const detail = responseBody.length > 0 ? `: ${responseBody}` : \"\";\n throw new Error(`${options.requestLabel} failed with status ${response.status} ${response.statusText}${detail}`);\n }\n\n try {\n return await response.json();\n } catch (error) {\n throw new Error(`${options.responseLabel} JSON parse failed: ${toErrorMessage(error)}`);\n }\n } finally {\n clearTimeout(timeoutHandle);\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAiCrD,MAAM,UAAU,4BAA4B,CAC1C,SAA6B,EAC7B,YAAoB,EACpB,gBAAgB,GAAG,8BAA8B;IAEjD,MAAM,QAAQ,GAAG,SAAS,IAAI,gBAAgB,CAAC;IAC/C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,2CAA2C,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,OAAoD,EACpD,YAAoB;IAEpB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;QAC3C,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAA+C,CAAC;IACzF,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,4CAA4C,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,QAA4B;IACjF,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAChE,CAAC;IAAC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CAAC,EAAE,CAAC;YAClE,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,YAAY,uBAAuB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,GAAG,MAAM,EAAE,CAAC,CAAC;QACnH,CAAC;QAED,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,aAAa,uBAAuB,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","debugId":"38ceb1f2-1c32-5e61-9982-cac553c770f4"}
1
+ {"version":3,"file":"http-client.js","sources":["core/search/http-client.ts"],"sourceRoot":"/","sourcesContent":["import { toErrorMessage } from \"../shared/primitives.js\";\n\nexport const DEFAULT_SEARCH_HTTP_TIMEOUT_MS = 30_000;\n\nexport interface SearchHttpResponse {\n ok: boolean;\n status: number;\n statusText: string;\n json(): Promise<unknown>;\n text(): Promise<string>;\n}\n\nexport interface SearchHttpRequestInit {\n method: \"DELETE\" | \"POST\" | \"PUT\";\n headers: Record<string, string>;\n body: string;\n signal: AbortSignal;\n}\n\nexport type SearchHttpFetcher<ResponseType extends SearchHttpResponse = SearchHttpResponse> = (\n url: string,\n init: SearchHttpRequestInit,\n) => Promise<ResponseType>;\n\nexport interface ExecuteSearchJsonRequestOptions<ResponseType extends SearchHttpResponse = SearchHttpResponse> {\n endpoint: string;\n method: \"DELETE\" | \"POST\" | \"PUT\";\n headers: Record<string, string>;\n body: Record<string, unknown>;\n timeoutMs: number;\n fetcher: SearchHttpFetcher<ResponseType>;\n requestLabel: string;\n responseLabel: string;\n}\n\nexport function normalizeSearchHttpTimeoutMs(\n timeoutMs: number | undefined,\n requestLabel: string,\n defaultTimeoutMs = DEFAULT_SEARCH_HTTP_TIMEOUT_MS,\n): number {\n const resolved = timeoutMs ?? defaultTimeoutMs;\n if (!Number.isFinite(resolved) || resolved <= 0) {\n throw new Error(`${requestLabel} timeout must be a positive finite number`);\n }\n return Math.floor(resolved);\n}\n\nexport function resolveSearchHttpFetcher<ResponseType extends SearchHttpResponse>(\n fetcher: SearchHttpFetcher<ResponseType> | undefined,\n requestLabel: string,\n): SearchHttpFetcher<ResponseType> {\n if (fetcher) {\n return fetcher;\n }\n if (typeof globalThis.fetch === \"function\") {\n return globalThis.fetch.bind(globalThis) as unknown as SearchHttpFetcher<ResponseType>;\n }\n throw new Error(`${requestLabel} execution requires a fetch implementation`);\n}\n\nexport async function readFailedSearchHttpResponseBody(response: SearchHttpResponse): Promise<string> {\n try {\n return (await response.text()).replaceAll(/\\s+/g, \" \").trim();\n } catch (error) {\n return `(failed to read response body: ${toErrorMessage(error)})`;\n }\n}\n\nexport async function executeSearchJsonRequest<ResponseType extends SearchHttpResponse>(\n options: ExecuteSearchJsonRequestOptions<ResponseType>,\n): Promise<unknown> {\n const controller = new AbortController();\n const timeoutHandle = setTimeout(() => {\n controller.abort();\n }, options.timeoutMs);\n\n try {\n let response: ResponseType;\n try {\n response = await options.fetcher(options.endpoint, {\n method: options.method,\n headers: options.headers,\n body: JSON.stringify(options.body),\n signal: controller.signal,\n });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new Error(`${options.requestLabel} timed out after ${options.timeoutMs}ms`);\n }\n throw new Error(`${options.requestLabel} execution failed: ${toErrorMessage(error)}`);\n }\n\n if (!response.ok) {\n const responseBody = await readFailedSearchHttpResponseBody(response);\n const detail = responseBody.length > 0 ? `: ${responseBody}` : \"\";\n throw new Error(`${options.requestLabel} failed with status ${response.status} ${response.statusText}${detail}`);\n }\n\n try {\n return await response.json();\n } catch (error) {\n throw new Error(`${options.responseLabel} JSON parse failed: ${toErrorMessage(error)}`);\n }\n } finally {\n clearTimeout(timeoutHandle);\n }\n}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,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,aAAa,uBAAuB,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,aAAa,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC","debugId":"197ad05c-3904-5eed-8de9-def28a40c3f4"}
@@ -77,4 +77,5 @@ export declare function buildVectorDeletePlan(store: VectorStoreConfig, ids: str
77
77
  export declare function executeVectorQuery(store: VectorStoreConfig, vector: number[], limit: number, options?: ExecuteVectorRequestOptions): Promise<VectorQueryHit[]>;
78
78
  export declare function executeVectorUpsert(store: VectorStoreConfig, records: VectorRecord[], options?: ExecuteVectorRequestOptions): Promise<VectorUpsertResult>;
79
79
  export declare function executeVectorDelete(store: VectorStoreConfig, ids: string[], options?: ExecuteVectorRequestOptions): Promise<VectorUpsertResult>;
80
+ export declare function executeVectorReset(store: VectorStoreConfig, knownIds?: string[], options?: ExecuteVectorRequestOptions, vectorDimension?: number): Promise<VectorUpsertResult>;
80
81
  export {};