@unbrained/pm-cli 2026.5.31 → 2026.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (638) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/CONTRIBUTING.md +1 -0
  3. package/README.md +12 -4
  4. package/dist/cli/argv-utils.js +7 -3
  5. package/dist/cli/argv-utils.js.map +1 -1
  6. package/dist/cli/bootstrap-args.d.ts +1 -0
  7. package/dist/cli/bootstrap-args.js +23 -3
  8. package/dist/cli/bootstrap-args.js.map +1 -1
  9. package/dist/cli/commands/calendar.js +17 -3
  10. package/dist/cli/commands/calendar.js.map +1 -1
  11. package/dist/cli/commands/close-many.d.ts +63 -0
  12. package/dist/cli/commands/close-many.js +302 -0
  13. package/dist/cli/commands/close-many.js.map +1 -0
  14. package/dist/cli/commands/completion.d.ts +1 -0
  15. package/dist/cli/commands/completion.js +260 -32
  16. package/dist/cli/commands/completion.js.map +1 -1
  17. package/dist/cli/commands/config.d.ts +4 -4
  18. package/dist/cli/commands/config.js +115 -3
  19. package/dist/cli/commands/config.js.map +1 -1
  20. package/dist/cli/commands/contracts.js +193 -162
  21. package/dist/cli/commands/contracts.js.map +1 -1
  22. package/dist/cli/commands/create.d.ts +1 -0
  23. package/dist/cli/commands/create.js +77 -114
  24. package/dist/cli/commands/create.js.map +1 -1
  25. package/dist/cli/commands/extension/doctor.d.ts +12 -0
  26. package/dist/cli/commands/extension/doctor.js +97 -2
  27. package/dist/cli/commands/extension/doctor.js.map +1 -1
  28. package/dist/cli/commands/extension/scaffold.js +49 -48
  29. package/dist/cli/commands/extension/scaffold.js.map +1 -1
  30. package/dist/cli/commands/extension.js +51 -23
  31. package/dist/cli/commands/extension.js.map +1 -1
  32. package/dist/cli/commands/gc.d.ts +8 -1
  33. package/dist/cli/commands/gc.js +26 -3
  34. package/dist/cli/commands/gc.js.map +1 -1
  35. package/dist/cli/commands/get.js +7 -7
  36. package/dist/cli/commands/get.js.map +1 -1
  37. package/dist/cli/commands/health.js +51 -3
  38. package/dist/cli/commands/health.js.map +1 -1
  39. package/dist/cli/commands/history.d.ts +4 -1
  40. package/dist/cli/commands/history.js +12 -24
  41. package/dist/cli/commands/history.js.map +1 -1
  42. package/dist/cli/commands/index.d.ts +3 -1
  43. package/dist/cli/commands/index.js +5 -3
  44. package/dist/cli/commands/index.js.map +1 -1
  45. package/dist/cli/commands/init.d.ts +10 -0
  46. package/dist/cli/commands/init.js +107 -4
  47. package/dist/cli/commands/init.js.map +1 -1
  48. package/dist/cli/commands/list.d.ts +5 -0
  49. package/dist/cli/commands/list.js +58 -26
  50. package/dist/cli/commands/list.js.map +1 -1
  51. package/dist/cli/commands/reindex.js +163 -47
  52. package/dist/cli/commands/reindex.js.map +1 -1
  53. package/dist/cli/commands/repeatable-metadata-parsers.d.ts +15 -0
  54. package/dist/cli/commands/repeatable-metadata-parsers.js +120 -0
  55. package/dist/cli/commands/repeatable-metadata-parsers.js.map +1 -0
  56. package/dist/cli/commands/restore.js +25 -4
  57. package/dist/cli/commands/restore.js.map +1 -1
  58. package/dist/cli/commands/schema.d.ts +122 -1
  59. package/dist/cli/commands/schema.js +536 -6
  60. package/dist/cli/commands/schema.js.map +1 -1
  61. package/dist/cli/commands/search.d.ts +1 -0
  62. package/dist/cli/commands/search.js +18 -4
  63. package/dist/cli/commands/search.js.map +1 -1
  64. package/dist/cli/commands/stats.d.ts +8 -1
  65. package/dist/cli/commands/stats.js +18 -17
  66. package/dist/cli/commands/stats.js.map +1 -1
  67. package/dist/cli/commands/telemetry.d.ts +8 -0
  68. package/dist/cli/commands/telemetry.js +253 -0
  69. package/dist/cli/commands/telemetry.js.map +1 -0
  70. package/dist/cli/commands/test.js +4 -3
  71. package/dist/cli/commands/test.js.map +1 -1
  72. package/dist/cli/commands/update-many.js +69 -140
  73. package/dist/cli/commands/update-many.js.map +1 -1
  74. package/dist/cli/commands/update.d.ts +2 -0
  75. package/dist/cli/commands/update.js +138 -119
  76. package/dist/cli/commands/update.js.map +1 -1
  77. package/dist/cli/commands/validate.d.ts +1 -0
  78. package/dist/cli/commands/validate.js +63 -33
  79. package/dist/cli/commands/validate.js.map +1 -1
  80. package/dist/cli/error-guidance.js +26 -3
  81. package/dist/cli/error-guidance.js.map +1 -1
  82. package/dist/cli/help-content.js +91 -3
  83. package/dist/cli/help-content.js.map +1 -1
  84. package/dist/cli/main.js +377 -23
  85. package/dist/cli/main.js.map +1 -1
  86. package/dist/cli/register-list-query.js +14 -5
  87. package/dist/cli/register-list-query.js.map +1 -1
  88. package/dist/cli/register-mutation.js +200 -28
  89. package/dist/cli/register-mutation.js.map +1 -1
  90. package/dist/cli/register-operations.js +31 -6
  91. package/dist/cli/register-operations.js.map +1 -1
  92. package/dist/cli/register-setup.js +4 -2
  93. package/dist/cli/register-setup.js.map +1 -1
  94. package/dist/cli/registration-helpers.js +31 -4
  95. package/dist/cli/registration-helpers.js.map +1 -1
  96. package/dist/cli-bundle/chunks/activity-CVXTCHYY.js +16 -0
  97. package/dist/cli-bundle/chunks/activity-JM6DTDND.js +20 -0
  98. package/dist/cli-bundle/chunks/activity-JM6DTDND.js.map +1 -0
  99. package/dist/cli-bundle/chunks/aggregate-GI7WSZPH.js +206 -0
  100. package/dist/cli-bundle/chunks/aggregate-GI7WSZPH.js.map +1 -0
  101. package/dist/cli-bundle/chunks/{aggregate-ADUOSFRO.js → aggregate-VNAHUNNF.js} +11 -11
  102. package/dist/cli-bundle/chunks/{append-JD2DETU7.js → append-7H5N64R2.js} +8 -9
  103. package/dist/cli-bundle/chunks/{append-JD2DETU7.js.map → append-7H5N64R2.js.map} +1 -1
  104. package/dist/cli-bundle/chunks/append-WMKRXKCE.js +69 -0
  105. package/dist/cli-bundle/chunks/append-WMKRXKCE.js.map +1 -0
  106. package/dist/cli-bundle/chunks/{chunk-3M73P3G6.js → chunk-23YFZ3IG.js} +210 -132
  107. package/dist/cli-bundle/chunks/chunk-23YFZ3IG.js.map +7 -0
  108. package/dist/cli-bundle/chunks/chunk-2HVRUSQA.js +128 -0
  109. package/dist/cli-bundle/chunks/chunk-2HVRUSQA.js.map +1 -0
  110. package/dist/cli-bundle/chunks/chunk-2RSPZI5H.js +266 -0
  111. package/dist/cli-bundle/chunks/chunk-2RSPZI5H.js.map +1 -0
  112. package/dist/cli-bundle/chunks/chunk-2VBQ6ZXS.js +631 -0
  113. package/dist/cli-bundle/chunks/chunk-2VBQ6ZXS.js.map +1 -0
  114. package/dist/cli-bundle/chunks/chunk-2VVCGBNV.js +380 -0
  115. package/dist/cli-bundle/chunks/chunk-2VVCGBNV.js.map +1 -0
  116. package/dist/cli-bundle/chunks/chunk-3BWOVLTH.js +1664 -0
  117. package/dist/cli-bundle/chunks/chunk-3BWOVLTH.js.map +1 -0
  118. package/dist/cli-bundle/chunks/{chunk-6HT2F4TK.js → chunk-3FI4SEFT.js} +175 -54
  119. package/dist/cli-bundle/chunks/chunk-3FI4SEFT.js.map +7 -0
  120. package/dist/cli-bundle/chunks/{chunk-JULRTHJQ.js → chunk-3LB74A67.js} +119 -6
  121. package/dist/cli-bundle/chunks/chunk-3LB74A67.js.map +7 -0
  122. package/dist/cli-bundle/chunks/chunk-3VAM3NNM.js +57 -0
  123. package/dist/cli-bundle/chunks/chunk-3VAM3NNM.js.map +1 -0
  124. package/dist/cli-bundle/chunks/chunk-4LL6TK5B.js +1832 -0
  125. package/dist/cli-bundle/chunks/chunk-4LL6TK5B.js.map +1 -0
  126. package/dist/cli-bundle/chunks/chunk-52MAOQ6J.js +422 -0
  127. package/dist/cli-bundle/chunks/chunk-52MAOQ6J.js.map +7 -0
  128. package/dist/cli-bundle/chunks/chunk-5FDATVEZ.js +412 -0
  129. package/dist/cli-bundle/chunks/chunk-5FDATVEZ.js.map +1 -0
  130. package/dist/cli-bundle/chunks/chunk-5SFCOO6B.js +5622 -0
  131. package/dist/cli-bundle/chunks/chunk-5SFCOO6B.js.map +1 -0
  132. package/dist/cli-bundle/chunks/{chunk-U7FMKRXH.js → chunk-6ER6DXH5.js} +37 -16
  133. package/dist/cli-bundle/chunks/chunk-6ER6DXH5.js.map +7 -0
  134. package/dist/cli-bundle/chunks/chunk-6P6GGMOG.js +218 -0
  135. package/dist/cli-bundle/chunks/chunk-6P6GGMOG.js.map +1 -0
  136. package/dist/cli-bundle/chunks/chunk-77GFDHGF.js +80 -0
  137. package/dist/cli-bundle/chunks/chunk-77GFDHGF.js.map +1 -0
  138. package/dist/cli-bundle/chunks/{chunk-MD7K4JYF.js → chunk-AO442XLN.js} +26 -15
  139. package/dist/cli-bundle/chunks/chunk-AO442XLN.js.map +7 -0
  140. package/dist/cli-bundle/chunks/chunk-AY43SBIN.js +751 -0
  141. package/dist/cli-bundle/chunks/chunk-AY43SBIN.js.map +1 -0
  142. package/dist/cli-bundle/chunks/{chunk-D7AOMPRH.js → chunk-BQHUILZS.js} +5 -5
  143. package/dist/cli-bundle/chunks/chunk-E5FJNAZA.js +242 -0
  144. package/dist/cli-bundle/chunks/chunk-E5FJNAZA.js.map +1 -0
  145. package/dist/cli-bundle/chunks/{chunk-OGZEG5TT.js → chunk-ECCMVXGM.js} +164 -53
  146. package/dist/cli-bundle/chunks/chunk-ECCMVXGM.js.map +7 -0
  147. package/dist/cli-bundle/chunks/chunk-FRAUKRU2.js +182 -0
  148. package/dist/cli-bundle/chunks/chunk-FRAUKRU2.js.map +1 -0
  149. package/dist/cli-bundle/chunks/chunk-GCOQW437.js +130 -0
  150. package/dist/cli-bundle/chunks/chunk-GCOQW437.js.map +1 -0
  151. package/dist/cli-bundle/chunks/chunk-GGYWB3Y2.js +1340 -0
  152. package/dist/cli-bundle/chunks/chunk-GGYWB3Y2.js.map +1 -0
  153. package/dist/cli-bundle/chunks/{chunk-G57E5D7T.js → chunk-GU2ZJ2VV.js} +5 -5
  154. package/dist/cli-bundle/chunks/chunk-GXSUPCBV.js +231 -0
  155. package/dist/cli-bundle/chunks/chunk-GXSUPCBV.js.map +1 -0
  156. package/dist/cli-bundle/chunks/chunk-HZGUAH22.js +76 -0
  157. package/dist/cli-bundle/chunks/chunk-HZGUAH22.js.map +1 -0
  158. package/dist/cli-bundle/chunks/chunk-I2HSTRJF.js +346 -0
  159. package/dist/cli-bundle/chunks/chunk-I2HSTRJF.js.map +1 -0
  160. package/dist/cli-bundle/chunks/chunk-I6BNFU5X.js +140 -0
  161. package/dist/cli-bundle/chunks/chunk-I6BNFU5X.js.map +7 -0
  162. package/dist/cli-bundle/chunks/{chunk-JTWRXG4B.js → chunk-IJGCZSIQ.js} +251 -251
  163. package/dist/cli-bundle/chunks/chunk-IJGCZSIQ.js.map +7 -0
  164. package/dist/cli-bundle/chunks/chunk-IOR7LGF4.js +1491 -0
  165. package/dist/cli-bundle/chunks/chunk-IOR7LGF4.js.map +1 -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-AKOOMO3T.js → chunk-KAG77BY3.js} +2 -2
  171. package/dist/cli-bundle/chunks/{chunk-KBQY3YG5.js → chunk-KJ33AOCY.js} +3 -3
  172. package/dist/cli-bundle/chunks/{chunk-WDPXDQFG.js → chunk-KJE2FOS4.js} +6 -4
  173. package/dist/cli-bundle/chunks/chunk-KJE2FOS4.js.map +7 -0
  174. package/dist/cli-bundle/chunks/chunk-KWU6HG75.js +3883 -0
  175. package/dist/cli-bundle/chunks/chunk-KWU6HG75.js.map +1 -0
  176. package/dist/cli-bundle/chunks/chunk-LB3RUL2N.js +1325 -0
  177. package/dist/cli-bundle/chunks/chunk-LB3RUL2N.js.map +1 -0
  178. package/dist/cli-bundle/chunks/{chunk-5HSEP75M.js → chunk-LCM63IXU.js} +18 -6
  179. package/dist/cli-bundle/chunks/chunk-LCM63IXU.js.map +7 -0
  180. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js +24 -0
  181. package/dist/cli-bundle/chunks/chunk-LXYVKYMQ.js.map +1 -0
  182. package/dist/cli-bundle/chunks/chunk-ME2YH6FN.js +182 -0
  183. package/dist/cli-bundle/chunks/chunk-ME2YH6FN.js.map +1 -0
  184. package/dist/cli-bundle/chunks/chunk-MITFDD35.js +1809 -0
  185. package/dist/cli-bundle/chunks/chunk-MITFDD35.js.map +1 -0
  186. package/dist/cli-bundle/chunks/{chunk-WJ2NAC37.js → chunk-N7ACFE26.js} +3 -3
  187. package/dist/cli-bundle/chunks/chunk-NUZ5HKR4.js +332 -0
  188. package/dist/cli-bundle/chunks/chunk-NUZ5HKR4.js.map +1 -0
  189. package/dist/cli-bundle/chunks/{chunk-7Y53ZJIQ.js → chunk-OVQCEJPG.js} +22 -3
  190. package/dist/cli-bundle/chunks/chunk-OVQCEJPG.js.map +7 -0
  191. package/dist/cli-bundle/chunks/{chunk-PXUAZUUY.js → chunk-OZ7NSQHL.js} +12 -11
  192. package/dist/cli-bundle/chunks/chunk-OZ7NSQHL.js.map +7 -0
  193. package/dist/cli-bundle/chunks/{chunk-P53TN6IA.js → chunk-PDDFYW4X.js} +35 -8
  194. package/dist/cli-bundle/chunks/chunk-PDDFYW4X.js.map +7 -0
  195. package/dist/cli-bundle/chunks/{chunk-6YCV7WSL.js → chunk-PIU6RSL3.js} +10 -12
  196. package/dist/cli-bundle/chunks/{chunk-6YCV7WSL.js.map → chunk-PIU6RSL3.js.map} +1 -1
  197. package/dist/cli-bundle/chunks/chunk-PO3GSVFV.js +338 -0
  198. package/dist/cli-bundle/chunks/chunk-PO3GSVFV.js.map +1 -0
  199. package/dist/cli-bundle/chunks/{chunk-LRBOHPUE.js → chunk-PRJCELV4.js} +108 -21
  200. package/dist/cli-bundle/chunks/chunk-PRJCELV4.js.map +7 -0
  201. package/dist/cli-bundle/chunks/{chunk-GN7IJPCD.js → chunk-PROOHX4K.js} +332 -32
  202. package/dist/cli-bundle/chunks/chunk-PROOHX4K.js.map +7 -0
  203. package/dist/cli-bundle/chunks/{chunk-FQE6XZDB.js → chunk-Q7SPNHLW.js} +54 -32
  204. package/dist/cli-bundle/chunks/chunk-Q7SPNHLW.js.map +7 -0
  205. package/dist/cli-bundle/chunks/{chunk-PVNQLCIS.js → chunk-QO7EBBOM.js} +2 -2
  206. package/dist/cli-bundle/chunks/{chunk-A7E7PUVX.js → chunk-R6UFP2GE.js} +7 -7
  207. package/dist/cli-bundle/chunks/chunk-RWPSOIEE.js +154 -0
  208. package/dist/cli-bundle/chunks/chunk-RWPSOIEE.js.map +1 -0
  209. package/dist/cli-bundle/chunks/chunk-RZN6VURO.js +119 -0
  210. package/dist/cli-bundle/chunks/chunk-RZN6VURO.js.map +1 -0
  211. package/dist/cli-bundle/chunks/chunk-SKJWX3QB.js +1501 -0
  212. package/dist/cli-bundle/chunks/chunk-SKJWX3QB.js.map +7 -0
  213. package/dist/cli-bundle/chunks/{chunk-CEFIVZPG.js → chunk-T3LC5LKB.js} +2 -2
  214. package/dist/cli-bundle/chunks/chunk-TCD3R2PF.js +173 -0
  215. package/dist/cli-bundle/chunks/chunk-TCD3R2PF.js.map +1 -0
  216. package/dist/cli-bundle/chunks/chunk-TPH5XEVD.js +2988 -0
  217. package/dist/cli-bundle/chunks/chunk-TPH5XEVD.js.map +1 -0
  218. package/dist/cli-bundle/chunks/{chunk-LSXGH6NE.js → chunk-U5SXYXSY.js} +821 -200
  219. package/dist/cli-bundle/chunks/chunk-U5SXYXSY.js.map +7 -0
  220. package/dist/cli-bundle/chunks/chunk-UBOPJT3S.js +540 -0
  221. package/dist/cli-bundle/chunks/chunk-UBOPJT3S.js.map +1 -0
  222. package/dist/cli-bundle/chunks/{chunk-JFWUHHS2.js → chunk-UM2GBHS4.js} +5 -4
  223. package/dist/cli-bundle/chunks/chunk-W7XABV4H.js +454 -0
  224. package/dist/cli-bundle/chunks/chunk-W7XABV4H.js.map +1 -0
  225. package/dist/cli-bundle/chunks/{chunk-SEXQN4KL.js → chunk-WKY2IBOQ.js} +3 -3
  226. package/dist/cli-bundle/chunks/chunk-WOPXVEZP.js +698 -0
  227. package/dist/cli-bundle/chunks/chunk-WOPXVEZP.js.map +1 -0
  228. package/dist/cli-bundle/chunks/chunk-WSMOSYRD.js +1704 -0
  229. package/dist/cli-bundle/chunks/chunk-WSMOSYRD.js.map +1 -0
  230. package/dist/cli-bundle/chunks/{chunk-NGN7UV5K.js → chunk-XLTD2HN3.js} +2 -2
  231. package/dist/cli-bundle/chunks/chunk-XSJCLN2R.js +131 -0
  232. package/dist/cli-bundle/chunks/chunk-XSJCLN2R.js.map +7 -0
  233. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js +53 -0
  234. package/dist/cli-bundle/chunks/chunk-XSLQSXAH.js.map +1 -0
  235. package/dist/cli-bundle/chunks/{chunk-BUPWJ3IJ.js → chunk-XTGLRY2Y.js} +484 -49
  236. package/dist/cli-bundle/chunks/chunk-XTGLRY2Y.js.map +7 -0
  237. package/dist/cli-bundle/chunks/{chunk-L2FXEKDB.js → chunk-YL2DJGYS.js} +7 -7
  238. package/dist/cli-bundle/chunks/{claim-EE4TKKCV.js → claim-4DBF6RVG.js} +10 -11
  239. package/dist/cli-bundle/chunks/{claim-EE4TKKCV.js.map → claim-4DBF6RVG.js.map} +1 -1
  240. package/dist/cli-bundle/chunks/claim-X2P4IB7J.js +129 -0
  241. package/dist/cli-bundle/chunks/claim-X2P4IB7J.js.map +1 -0
  242. package/dist/cli-bundle/chunks/close-3HDWDA3L.js +13 -0
  243. package/dist/cli-bundle/chunks/close-PTYFA45H.js +17 -0
  244. package/dist/cli-bundle/chunks/close-PTYFA45H.js.map +1 -0
  245. package/dist/cli-bundle/chunks/close-many-7CGIDPTJ.js +314 -0
  246. package/dist/cli-bundle/chunks/close-many-7CGIDPTJ.js.map +7 -0
  247. package/dist/cli-bundle/chunks/close-many-ERFO6LHR.js +311 -0
  248. package/dist/cli-bundle/chunks/close-many-ERFO6LHR.js.map +1 -0
  249. package/dist/cli-bundle/chunks/comments-OONGABK5.js +100 -0
  250. package/dist/cli-bundle/chunks/comments-OONGABK5.js.map +1 -0
  251. package/dist/cli-bundle/chunks/{comments-AAKJQ6LW.js → comments-QKBYCWKD.js} +10 -11
  252. package/dist/cli-bundle/chunks/{comments-AAKJQ6LW.js.map → comments-QKBYCWKD.js.map} +1 -1
  253. package/dist/cli-bundle/chunks/config-6FXCQKIF.js +1671 -0
  254. package/dist/cli-bundle/chunks/config-6FXCQKIF.js.map +1 -0
  255. package/dist/cli-bundle/chunks/{config-V3FZOKLI.js → config-U4RZ4CQB.js} +121 -10
  256. package/dist/cli-bundle/chunks/config-U4RZ4CQB.js.map +7 -0
  257. package/dist/cli-bundle/chunks/{context-RZ5QPNJB.js → context-FYYJGFWS.js} +32 -19
  258. package/dist/cli-bundle/chunks/{context-RZ5QPNJB.js.map → context-FYYJGFWS.js.map} +2 -2
  259. package/dist/cli-bundle/chunks/context-YMJ3Z2HQ.js +1461 -0
  260. package/dist/cli-bundle/chunks/context-YMJ3Z2HQ.js.map +1 -0
  261. package/dist/cli-bundle/chunks/contracts-QDB6OMLQ.js +1278 -0
  262. package/dist/cli-bundle/chunks/contracts-QDB6OMLQ.js.map +1 -0
  263. package/dist/cli-bundle/chunks/{contracts-YLMH33VU.js → contracts-RFSPGVVJ.js} +198 -162
  264. package/dist/cli-bundle/chunks/contracts-RFSPGVVJ.js.map +7 -0
  265. package/dist/cli-bundle/chunks/create-I5L4EYYZ.js +31 -0
  266. package/dist/cli-bundle/chunks/create-I5L4EYYZ.js.map +1 -0
  267. package/dist/cli-bundle/chunks/create-JTZNCTQC.js +27 -0
  268. package/dist/cli-bundle/chunks/delete-7HPGI4GZ.js +55 -0
  269. package/dist/cli-bundle/chunks/delete-7HPGI4GZ.js.map +1 -0
  270. package/dist/cli-bundle/chunks/{delete-RHCTEORS.js → delete-VXUPH5RS.js} +7 -8
  271. package/dist/cli-bundle/chunks/{delete-RHCTEORS.js.map → delete-VXUPH5RS.js.map} +1 -1
  272. package/dist/cli-bundle/chunks/{deps-MZYCMLAO.js → deps-JSRRWC3Z.js} +7 -8
  273. package/dist/cli-bundle/chunks/{deps-MZYCMLAO.js.map → deps-JSRRWC3Z.js.map} +1 -1
  274. package/dist/cli-bundle/chunks/deps-SCZIFK2Z.js +225 -0
  275. package/dist/cli-bundle/chunks/deps-SCZIFK2Z.js.map +1 -0
  276. package/dist/cli-bundle/chunks/docs-GJK6K4VP.js +31 -0
  277. package/dist/cli-bundle/chunks/docs-GJK6K4VP.js.map +1 -0
  278. package/dist/cli-bundle/chunks/{docs-FXXUCZYU.js → docs-WW4N3MBM.js} +9 -10
  279. package/dist/cli-bundle/chunks/{docs-FXXUCZYU.js.map → docs-WW4N3MBM.js.map} +1 -1
  280. package/dist/cli-bundle/chunks/{extension-B4WL7BQU.js → extension-J7IBMFTD.js} +4 -5
  281. package/dist/cli-bundle/chunks/extension-VDY2U33M.js +28 -0
  282. package/dist/cli-bundle/chunks/extension-VDY2U33M.js.map +1 -0
  283. package/dist/cli-bundle/chunks/files-ISZJGILQ.js +282 -0
  284. package/dist/cli-bundle/chunks/files-ISZJGILQ.js.map +1 -0
  285. package/dist/cli-bundle/chunks/{files-WVOX67PE.js → files-WKOD326U.js} +9 -10
  286. package/dist/cli-bundle/chunks/{files-WVOX67PE.js.map → files-WKOD326U.js.map} +1 -1
  287. package/dist/cli-bundle/chunks/gc-JDVJ6OQ2.js +362 -0
  288. package/dist/cli-bundle/chunks/gc-JDVJ6OQ2.js.map +1 -0
  289. package/dist/cli-bundle/chunks/gc-ULPVWMTN.js +372 -0
  290. package/dist/cli-bundle/chunks/gc-ULPVWMTN.js.map +7 -0
  291. package/dist/cli-bundle/chunks/get-RV37HT3G.js +194 -0
  292. package/dist/cli-bundle/chunks/get-RV37HT3G.js.map +1 -0
  293. package/dist/cli-bundle/chunks/{get-LTK3HOCQ.js → get-WXU6WI5P.js} +16 -17
  294. package/dist/cli-bundle/chunks/get-WXU6WI5P.js.map +7 -0
  295. package/dist/cli-bundle/chunks/{health-TCWL55KM.js → health-6L6EH4WR.js} +57 -16
  296. package/dist/cli-bundle/chunks/health-6L6EH4WR.js.map +7 -0
  297. package/dist/cli-bundle/chunks/health-LOI2HHKB.js +1271 -0
  298. package/dist/cli-bundle/chunks/health-LOI2HHKB.js.map +1 -0
  299. package/dist/cli-bundle/chunks/history-2BA3T5AE.js +20 -0
  300. package/dist/cli-bundle/chunks/history-PKN67D5O.js +24 -0
  301. package/dist/cli-bundle/chunks/history-PKN67D5O.js.map +1 -0
  302. package/dist/cli-bundle/chunks/history-redact-JBZNXHGR.js +19 -0
  303. package/dist/cli-bundle/chunks/history-redact-V4FOJGS7.js +23 -0
  304. package/dist/cli-bundle/chunks/history-redact-V4FOJGS7.js.map +1 -0
  305. package/dist/cli-bundle/chunks/{history-repair-ZWSTDRH2.js → history-repair-HIBCBIKK.js} +12 -14
  306. package/dist/cli-bundle/chunks/{history-repair-ZWSTDRH2.js.map → history-repair-HIBCBIKK.js.map} +1 -1
  307. package/dist/cli-bundle/chunks/history-repair-SDMHR7JT.js +193 -0
  308. package/dist/cli-bundle/chunks/history-repair-SDMHR7JT.js.map +1 -0
  309. package/dist/cli-bundle/chunks/init-HIVSNX3O.js +16 -0
  310. package/dist/cli-bundle/chunks/init-P56QYWJF.js +20 -0
  311. package/dist/cli-bundle/chunks/init-P56QYWJF.js.map +1 -0
  312. package/dist/cli-bundle/chunks/learnings-GDFRG5J7.js +44 -0
  313. package/dist/cli-bundle/chunks/learnings-GDFRG5J7.js.map +1 -0
  314. package/dist/cli-bundle/chunks/{learnings-NXTWE3FR.js → learnings-MIXSESLK.js} +10 -11
  315. package/dist/cli-bundle/chunks/{learnings-NXTWE3FR.js.map → learnings-MIXSESLK.js.map} +1 -1
  316. package/dist/cli-bundle/chunks/list-FGOWQMSM.js +24 -0
  317. package/dist/cli-bundle/chunks/list-FGOWQMSM.js.map +1 -0
  318. package/dist/cli-bundle/chunks/list-MUSQNMTD.js +20 -0
  319. package/dist/cli-bundle/chunks/{notes-DFS5ZGOO.js → notes-4XVSH2AZ.js} +10 -11
  320. package/dist/cli-bundle/chunks/{notes-DFS5ZGOO.js.map → notes-4XVSH2AZ.js.map} +1 -1
  321. package/dist/cli-bundle/chunks/notes-5UK3GEH2.js +44 -0
  322. package/dist/cli-bundle/chunks/notes-5UK3GEH2.js.map +1 -0
  323. package/dist/cli-bundle/chunks/plan-DUMBV3QB.js +1171 -0
  324. package/dist/cli-bundle/chunks/plan-DUMBV3QB.js.map +1 -0
  325. package/dist/cli-bundle/chunks/{plan-67AB2PLM.js → plan-SLMODHWX.js} +13 -14
  326. package/dist/cli-bundle/chunks/{plan-67AB2PLM.js.map → plan-SLMODHWX.js.map} +1 -1
  327. package/dist/cli-bundle/chunks/register-list-query-POCFZ5JW.js +229 -0
  328. package/dist/cli-bundle/chunks/register-list-query-POCFZ5JW.js.map +1 -0
  329. package/dist/cli-bundle/chunks/{register-list-query-UP3VRUFS.js → register-list-query-WST76HSQ.js} +26 -26
  330. package/dist/cli-bundle/chunks/register-list-query-WST76HSQ.js.map +7 -0
  331. package/dist/cli-bundle/chunks/register-mutation-N5GSUZJV.js +813 -0
  332. package/dist/cli-bundle/chunks/register-mutation-N5GSUZJV.js.map +1 -0
  333. package/dist/cli-bundle/chunks/{register-mutation-YWSBF545.js → register-mutation-OA675SOU.js} +154 -43
  334. package/dist/cli-bundle/chunks/register-mutation-OA675SOU.js.map +7 -0
  335. package/dist/cli-bundle/chunks/register-operations-GNHBE5I3.js +383 -0
  336. package/dist/cli-bundle/chunks/register-operations-GNHBE5I3.js.map +1 -0
  337. package/dist/cli-bundle/chunks/{register-operations-3BDTGSDH.js → register-operations-N3PMHXH5.js} +49 -37
  338. package/dist/cli-bundle/chunks/register-operations-N3PMHXH5.js.map +7 -0
  339. package/dist/cli-bundle/chunks/register-setup-JIMPKJKV.js +242 -0
  340. package/dist/cli-bundle/chunks/register-setup-JIMPKJKV.js.map +1 -0
  341. package/dist/cli-bundle/chunks/{register-setup-V56GDRUS.js → register-setup-ZHJI2DI3.js} +18 -19
  342. package/dist/cli-bundle/chunks/{register-setup-V56GDRUS.js.map → register-setup-ZHJI2DI3.js.map} +2 -2
  343. package/dist/cli-bundle/chunks/restore-D4RGNX33.js +17 -0
  344. package/dist/cli-bundle/chunks/restore-PBL6T5TW.js +21 -0
  345. package/dist/cli-bundle/chunks/restore-PBL6T5TW.js.map +1 -0
  346. package/dist/cli-bundle/chunks/schema-2NOO6NGB.js +780 -0
  347. package/dist/cli-bundle/chunks/schema-2NOO6NGB.js.map +7 -0
  348. package/dist/cli-bundle/chunks/schema-EBI4NLUO.js +770 -0
  349. package/dist/cli-bundle/chunks/schema-EBI4NLUO.js.map +1 -0
  350. package/dist/cli-bundle/chunks/search-JPUQTVCY.js +1127 -0
  351. package/dist/cli-bundle/chunks/search-JPUQTVCY.js.map +1 -0
  352. package/dist/cli-bundle/chunks/{search-HENBL456.js → search-OA6JX27A.js} +25 -16
  353. package/dist/cli-bundle/chunks/search-OA6JX27A.js.map +7 -0
  354. package/dist/cli-bundle/chunks/stats-CV54BAWY.js +202 -0
  355. package/dist/cli-bundle/chunks/stats-CV54BAWY.js.map +1 -0
  356. package/dist/cli-bundle/chunks/stats-XYB6KTFG.js +212 -0
  357. package/dist/cli-bundle/chunks/stats-XYB6KTFG.js.map +7 -0
  358. package/dist/cli-bundle/chunks/telemetry-LMJ7PFUO.js +251 -0
  359. package/dist/cli-bundle/chunks/telemetry-LMJ7PFUO.js.map +7 -0
  360. package/dist/cli-bundle/chunks/telemetry-NCMEPJNR.js +248 -0
  361. package/dist/cli-bundle/chunks/telemetry-NCMEPJNR.js.map +1 -0
  362. package/dist/cli-bundle/chunks/test-MXX3E5JL.js +31 -0
  363. package/dist/cli-bundle/chunks/test-WBROAJIE.js +35 -0
  364. package/dist/cli-bundle/chunks/test-WBROAJIE.js.map +1 -0
  365. package/dist/cli-bundle/chunks/test-all-N6NSRDTV.js +328 -0
  366. package/dist/cli-bundle/chunks/test-all-N6NSRDTV.js.map +1 -0
  367. package/dist/cli-bundle/chunks/{test-all-G2AZOHXI.js → test-all-NTOZ7C3M.js} +13 -14
  368. package/dist/cli-bundle/chunks/{test-all-G2AZOHXI.js.map → test-all-NTOZ7C3M.js.map} +1 -1
  369. package/dist/cli-bundle/chunks/test-runs-V6A7LPWZ.js +929 -0
  370. package/dist/cli-bundle/chunks/test-runs-V6A7LPWZ.js.map +1 -0
  371. package/dist/cli-bundle/chunks/{test-runs-GX5HTPSF.js → test-runs-WMVTQU3Y.js} +5 -5
  372. package/dist/cli-bundle/chunks/update-OSV3NAQB.js +25 -0
  373. package/dist/cli-bundle/chunks/update-OSV3NAQB.js.map +1 -0
  374. package/dist/cli-bundle/chunks/update-YRXSUGYQ.js +21 -0
  375. package/dist/cli-bundle/chunks/update-many-EM6OXYGO.js +605 -0
  376. package/dist/cli-bundle/chunks/update-many-EM6OXYGO.js.map +1 -0
  377. package/dist/cli-bundle/chunks/{update-many-46HRSP2Q.js → update-many-KGGEYABR.js} +78 -146
  378. package/dist/cli-bundle/chunks/update-many-KGGEYABR.js.map +7 -0
  379. package/dist/cli-bundle/chunks/{upgrade-H5HHM5UV.js → upgrade-BLI7XBAJ.js} +5 -7
  380. package/dist/cli-bundle/chunks/{upgrade-H5HHM5UV.js.map → upgrade-BLI7XBAJ.js.map} +1 -1
  381. package/dist/cli-bundle/chunks/upgrade-LXPOQKFV.js +266 -0
  382. package/dist/cli-bundle/chunks/upgrade-LXPOQKFV.js.map +1 -0
  383. package/dist/cli-bundle/chunks/{validate-TMCVKIGZ.js → validate-AGOAUOVW.js} +61 -48
  384. package/dist/cli-bundle/chunks/validate-AGOAUOVW.js.map +7 -0
  385. package/dist/cli-bundle/chunks/validate-L5J6A7YO.js +1120 -0
  386. package/dist/cli-bundle/chunks/validate-L5J6A7YO.js.map +1 -0
  387. package/dist/cli-bundle/main.js +534 -1505
  388. package/dist/cli-bundle/main.js.map +4 -4
  389. package/dist/core/checkpoint/mutation-checkpoint.d.ts +44 -0
  390. package/dist/core/checkpoint/mutation-checkpoint.js +119 -0
  391. package/dist/core/checkpoint/mutation-checkpoint.js.map +1 -0
  392. package/dist/core/config/positional-value.js +4 -2
  393. package/dist/core/config/positional-value.js.map +1 -1
  394. package/dist/core/diagnostics/remediation.d.ts +73 -0
  395. package/dist/core/diagnostics/remediation.js +328 -0
  396. package/dist/core/diagnostics/remediation.js.map +1 -0
  397. package/dist/core/extensions/extension-hook-runtime.js +9 -2
  398. package/dist/core/extensions/extension-hook-runtime.js.map +1 -1
  399. package/dist/core/extensions/extension-types.d.ts +60 -4
  400. package/dist/core/extensions/extension-types.js +2 -2
  401. package/dist/core/extensions/extension-types.js.map +1 -1
  402. package/dist/core/extensions/index.d.ts +5 -1
  403. package/dist/core/extensions/index.js +61 -2
  404. package/dist/core/extensions/index.js.map +1 -1
  405. package/dist/core/extensions/item-fields.d.ts +5 -1
  406. package/dist/core/extensions/item-fields.js +126 -4
  407. package/dist/core/extensions/item-fields.js.map +1 -1
  408. package/dist/core/extensions/loader.js +283 -8
  409. package/dist/core/extensions/loader.js.map +1 -1
  410. package/dist/core/history/history-diff.d.ts +47 -0
  411. package/dist/core/history/history-diff.js +152 -0
  412. package/dist/core/history/history-diff.js.map +1 -0
  413. package/dist/core/history/history-storage-stats.d.ts +31 -0
  414. package/dist/core/history/history-storage-stats.js +101 -0
  415. package/dist/core/history/history-storage-stats.js.map +1 -0
  416. package/dist/core/item/item-format.d.ts +3 -2
  417. package/dist/core/item/item-format.js +15 -10
  418. package/dist/core/item/item-format.js.map +1 -1
  419. package/dist/core/item/status-filter.d.ts +29 -0
  420. package/dist/core/item/status-filter.js +97 -0
  421. package/dist/core/item/status-filter.js.map +1 -0
  422. package/dist/core/item/type-registry.js +4 -2
  423. package/dist/core/item/type-registry.js.map +1 -1
  424. package/dist/core/lock/lock-gc.d.ts +46 -0
  425. package/dist/core/lock/lock-gc.js +194 -0
  426. package/dist/core/lock/lock-gc.js.map +1 -0
  427. package/dist/core/output/output.js +17 -5
  428. package/dist/core/output/output.js.map +1 -1
  429. package/dist/core/schema/item-types-file.d.ts +15 -0
  430. package/dist/core/schema/item-types-file.js +27 -2
  431. package/dist/core/schema/item-types-file.js.map +1 -1
  432. package/dist/core/schema/runtime-field-filters.js +4 -3
  433. package/dist/core/schema/runtime-field-filters.js.map +1 -1
  434. package/dist/core/schema/runtime-field-values.d.ts +1 -1
  435. package/dist/core/schema/runtime-field-values.js +10 -4
  436. package/dist/core/schema/runtime-field-values.js.map +1 -1
  437. package/dist/core/schema/runtime-schema.js +75 -2
  438. package/dist/core/schema/runtime-schema.js.map +1 -1
  439. package/dist/core/schema/status-defs-file.d.ts +113 -0
  440. package/dist/core/schema/status-defs-file.js +260 -0
  441. package/dist/core/schema/status-defs-file.js.map +1 -0
  442. package/dist/core/schema/type-workflows.d.ts +64 -0
  443. package/dist/core/schema/type-workflows.js +98 -0
  444. package/dist/core/schema/type-workflows.js.map +1 -0
  445. package/dist/core/search/cache.d.ts +3 -1
  446. package/dist/core/search/cache.js +104 -28
  447. package/dist/core/search/cache.js.map +1 -1
  448. package/dist/core/search/http-client.d.ts +2 -2
  449. package/dist/core/search/http-client.js +2 -2
  450. package/dist/core/search/http-client.js.map +1 -1
  451. package/dist/core/search/vector-stores.d.ts +1 -0
  452. package/dist/core/search/vector-stores.js +64 -14
  453. package/dist/core/search/vector-stores.js.map +1 -1
  454. package/dist/core/search/vectorization-metadata.d.ts +13 -0
  455. package/dist/core/search/vectorization-metadata.js +65 -0
  456. package/dist/core/search/vectorization-metadata.js.map +1 -0
  457. package/dist/core/shared/serial-queue.d.ts +12 -0
  458. package/dist/core/shared/serial-queue.js +43 -0
  459. package/dist/core/shared/serial-queue.js.map +1 -0
  460. package/dist/core/shared/serialization.d.ts +1 -0
  461. package/dist/core/shared/serialization.js +86 -2
  462. package/dist/core/shared/serialization.js.map +1 -1
  463. package/dist/core/store/front-matter-cache.js +14 -5
  464. package/dist/core/store/front-matter-cache.js.map +1 -1
  465. package/dist/core/store/item-store.d.ts +2 -0
  466. package/dist/core/store/item-store.js +61 -6
  467. package/dist/core/store/item-store.js.map +1 -1
  468. package/dist/core/store/settings-validator.js +18 -2
  469. package/dist/core/store/settings-validator.js.map +1 -1
  470. package/dist/core/store/settings.d.ts +19 -1
  471. package/dist/core/store/settings.js +130 -10
  472. package/dist/core/store/settings.js.map +1 -1
  473. package/dist/core/telemetry/consent.js +3 -3
  474. package/dist/core/telemetry/consent.js.map +1 -1
  475. package/dist/core/telemetry/observability.js +5 -4
  476. package/dist/core/telemetry/observability.js.map +1 -1
  477. package/dist/core/telemetry/runtime.js +16 -4
  478. package/dist/core/telemetry/runtime.js.map +1 -1
  479. package/dist/mcp/server.d.ts +1 -0
  480. package/dist/mcp/server.js +372 -45
  481. package/dist/mcp/server.js.map +1 -1
  482. package/dist/sdk/cli-contracts/commander-mutation-options.js +16 -2
  483. package/dist/sdk/cli-contracts/commander-mutation-options.js.map +1 -1
  484. package/dist/sdk/cli-contracts/commander-types.js +7 -2
  485. package/dist/sdk/cli-contracts/commander-types.js.map +1 -1
  486. package/dist/sdk/cli-contracts/enum-contracts.d.ts +2 -2
  487. package/dist/sdk/cli-contracts/enum-contracts.js +6 -2
  488. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  489. package/dist/sdk/cli-contracts/tool-option-contracts.d.ts +1 -0
  490. package/dist/sdk/cli-contracts/tool-option-contracts.js +53 -3
  491. package/dist/sdk/cli-contracts/tool-option-contracts.js.map +1 -1
  492. package/dist/sdk/cli-contracts/tool-parameter-tables.js +42 -10
  493. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  494. package/dist/sdk/cli-contracts.d.ts +42 -1
  495. package/dist/sdk/cli-contracts.js +225 -19
  496. package/dist/sdk/cli-contracts.js.map +1 -1
  497. package/dist/sdk/errors.d.ts +22 -0
  498. package/dist/sdk/errors.js +46 -0
  499. package/dist/sdk/errors.js.map +1 -0
  500. package/dist/sdk/index.d.ts +2 -1
  501. package/dist/sdk/index.js +3 -2
  502. package/dist/sdk/index.js.map +1 -1
  503. package/dist/sdk/package-import-adapters.js +14 -3
  504. package/dist/sdk/package-import-adapters.js.map +1 -1
  505. package/dist/sdk/runtime.d.ts +1 -0
  506. package/dist/sdk/runtime.js +3 -2
  507. package/dist/sdk/runtime.js.map +1 -1
  508. package/dist/sdk/testing.d.ts +77 -0
  509. package/dist/sdk/testing.js +239 -0
  510. package/dist/sdk/testing.js.map +1 -0
  511. package/dist/types.d.ts +19 -0
  512. package/dist/types.js +3 -2
  513. package/dist/types.js.map +1 -1
  514. package/docs/AGENT_GUIDE.md +22 -3
  515. package/docs/ARCHITECTURE.md +11 -1
  516. package/docs/CLAUDE_CODE_PLUGIN.md +2 -2
  517. package/docs/COMMANDS.md +118 -7
  518. package/docs/CONFIGURATION.md +57 -2
  519. package/docs/EXTENSIONS.md +125 -6
  520. package/docs/EXTENSION_AUTHOR_CONTRACTS.md +73 -0
  521. package/docs/ONBOARDING.md +165 -0
  522. package/docs/QUICKSTART.md +3 -1
  523. package/docs/README.md +12 -4
  524. package/docs/RELEASING.md +38 -3
  525. package/docs/SDK.md +273 -1
  526. package/docs/TESTING.md +36 -1
  527. package/docs/examples/policy-restricted-extension/manifest.json +1 -0
  528. package/docs/examples/starter-extension/index.js +9 -1
  529. package/docs/examples/starter-extension/manifest.json +1 -0
  530. package/package.json +16 -7
  531. package/packages/pm-beads/extensions/beads/index.js +2 -4
  532. package/packages/pm-beads/extensions/beads/index.ts +43 -33
  533. package/packages/pm-beads/extensions/beads/manifest.json +12 -1
  534. package/packages/pm-calendar/README.md +6 -0
  535. package/packages/pm-calendar/extensions/calendar/index.js +6 -1
  536. package/packages/pm-calendar/extensions/calendar/index.ts +6 -1
  537. package/packages/pm-calendar/extensions/calendar/manifest.json +6 -1
  538. package/packages/pm-governance-audit/extensions/governance-audit/manifest.json +6 -1
  539. package/packages/pm-guide-shell/README.md +4 -0
  540. package/packages/pm-guide-shell/extensions/guide-shell/index.js +22 -0
  541. package/packages/pm-guide-shell/extensions/guide-shell/index.ts +22 -0
  542. package/packages/pm-guide-shell/extensions/guide-shell/manifest.json +6 -1
  543. package/packages/pm-guide-shell/extensions/guide-shell/runtime.js +74 -3
  544. package/packages/pm-guide-shell/extensions/guide-shell/runtime.ts +84 -4
  545. package/packages/pm-lifecycle-hooks/README.md +29 -0
  546. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.js +18 -0
  547. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/index.ts +20 -0
  548. package/packages/pm-lifecycle-hooks/extensions/lifecycle-hooks/manifest.json +9 -0
  549. package/packages/pm-lifecycle-hooks/package.json +52 -0
  550. package/packages/pm-linked-test-adapters/extensions/linked-test-adapters/manifest.json +13 -1
  551. package/packages/pm-search-advanced/extensions/search-advanced/index.js +69 -1
  552. package/packages/pm-search-advanced/extensions/search-advanced/index.ts +91 -2
  553. package/packages/pm-search-advanced/extensions/search-advanced/manifest.json +13 -1
  554. package/packages/pm-templates/extensions/templates/manifest.json +6 -1
  555. package/packages/pm-todos/extensions/todos/index.js +3 -7
  556. package/packages/pm-todos/extensions/todos/index.ts +55 -42
  557. package/packages/pm-todos/extensions/todos/manifest.json +13 -1
  558. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  559. package/plugins/pm-claude/README.md +7 -4
  560. package/plugins/pm-claude/agents/pm-coordinator.md +1 -1
  561. package/plugins/pm-claude/commands/pm-init.md +1 -1
  562. package/scripts/bundle-cli.mjs +121 -17
  563. package/dist/cli-bundle/chunks/activity-OWYSUZOY.js +0 -17
  564. package/dist/cli-bundle/chunks/chunk-3M73P3G6.js.map +0 -7
  565. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js +0 -189
  566. package/dist/cli-bundle/chunks/chunk-4AEZR5EJ.js.map +0 -7
  567. package/dist/cli-bundle/chunks/chunk-5HSEP75M.js.map +0 -7
  568. package/dist/cli-bundle/chunks/chunk-6HT2F4TK.js.map +0 -7
  569. package/dist/cli-bundle/chunks/chunk-7Y53ZJIQ.js.map +0 -7
  570. package/dist/cli-bundle/chunks/chunk-BUPWJ3IJ.js.map +0 -7
  571. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js +0 -47
  572. package/dist/cli-bundle/chunks/chunk-EGUGFSNX.js.map +0 -7
  573. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js +0 -56
  574. package/dist/cli-bundle/chunks/chunk-FM26RGSU.js.map +0 -7
  575. package/dist/cli-bundle/chunks/chunk-FQE6XZDB.js.map +0 -7
  576. package/dist/cli-bundle/chunks/chunk-GN7IJPCD.js.map +0 -7
  577. package/dist/cli-bundle/chunks/chunk-JTWRXG4B.js.map +0 -7
  578. package/dist/cli-bundle/chunks/chunk-JULRTHJQ.js.map +0 -7
  579. package/dist/cli-bundle/chunks/chunk-LRBOHPUE.js.map +0 -7
  580. package/dist/cli-bundle/chunks/chunk-LSXGH6NE.js.map +0 -7
  581. package/dist/cli-bundle/chunks/chunk-MD7K4JYF.js.map +0 -7
  582. package/dist/cli-bundle/chunks/chunk-OGZEG5TT.js.map +0 -7
  583. package/dist/cli-bundle/chunks/chunk-P53TN6IA.js.map +0 -7
  584. package/dist/cli-bundle/chunks/chunk-PXUAZUUY.js.map +0 -7
  585. package/dist/cli-bundle/chunks/chunk-U7FMKRXH.js.map +0 -7
  586. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js +0 -141
  587. package/dist/cli-bundle/chunks/chunk-VGICHR7D.js.map +0 -7
  588. package/dist/cli-bundle/chunks/chunk-WDPXDQFG.js.map +0 -7
  589. package/dist/cli-bundle/chunks/close-XY4CSAYF.js +0 -14
  590. package/dist/cli-bundle/chunks/config-V3FZOKLI.js.map +0 -7
  591. package/dist/cli-bundle/chunks/contracts-YLMH33VU.js.map +0 -7
  592. package/dist/cli-bundle/chunks/create-PZVHRIZQ.js +0 -28
  593. package/dist/cli-bundle/chunks/gc-JWNF66EC.js +0 -181
  594. package/dist/cli-bundle/chunks/gc-JWNF66EC.js.map +0 -7
  595. package/dist/cli-bundle/chunks/get-LTK3HOCQ.js.map +0 -7
  596. package/dist/cli-bundle/chunks/health-TCWL55KM.js.map +0 -7
  597. package/dist/cli-bundle/chunks/history-A2JUDXUE.js +0 -21
  598. package/dist/cli-bundle/chunks/history-redact-ED6RFCPL.js +0 -20
  599. package/dist/cli-bundle/chunks/init-M2WUB4YH.js +0 -16
  600. package/dist/cli-bundle/chunks/list-OGWQPC26.js +0 -20
  601. package/dist/cli-bundle/chunks/register-list-query-UP3VRUFS.js.map +0 -7
  602. package/dist/cli-bundle/chunks/register-mutation-YWSBF545.js.map +0 -7
  603. package/dist/cli-bundle/chunks/register-operations-3BDTGSDH.js.map +0 -7
  604. package/dist/cli-bundle/chunks/restore-MB2ISME7.js +0 -18
  605. package/dist/cli-bundle/chunks/schema-Q622KC46.js +0 -119
  606. package/dist/cli-bundle/chunks/schema-Q622KC46.js.map +0 -7
  607. package/dist/cli-bundle/chunks/search-HENBL456.js.map +0 -7
  608. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js +0 -124
  609. package/dist/cli-bundle/chunks/stats-N6H3YP2F.js.map +0 -7
  610. package/dist/cli-bundle/chunks/test-VNBDRJ4Z.js +0 -32
  611. package/dist/cli-bundle/chunks/update-H6SCWNMA.js +0 -22
  612. package/dist/cli-bundle/chunks/update-many-46HRSP2Q.js.map +0 -7
  613. package/dist/cli-bundle/chunks/validate-TMCVKIGZ.js.map +0 -7
  614. /package/dist/cli-bundle/chunks/{activity-OWYSUZOY.js.map → activity-CVXTCHYY.js.map} +0 -0
  615. /package/dist/cli-bundle/chunks/{aggregate-ADUOSFRO.js.map → aggregate-VNAHUNNF.js.map} +0 -0
  616. /package/dist/cli-bundle/chunks/{chunk-D7AOMPRH.js.map → chunk-BQHUILZS.js.map} +0 -0
  617. /package/dist/cli-bundle/chunks/{chunk-G57E5D7T.js.map → chunk-GU2ZJ2VV.js.map} +0 -0
  618. /package/dist/cli-bundle/chunks/{chunk-AKOOMO3T.js.map → chunk-KAG77BY3.js.map} +0 -0
  619. /package/dist/cli-bundle/chunks/{chunk-KBQY3YG5.js.map → chunk-KJ33AOCY.js.map} +0 -0
  620. /package/dist/cli-bundle/chunks/{chunk-WJ2NAC37.js.map → chunk-N7ACFE26.js.map} +0 -0
  621. /package/dist/cli-bundle/chunks/{chunk-PVNQLCIS.js.map → chunk-QO7EBBOM.js.map} +0 -0
  622. /package/dist/cli-bundle/chunks/{chunk-A7E7PUVX.js.map → chunk-R6UFP2GE.js.map} +0 -0
  623. /package/dist/cli-bundle/chunks/{chunk-CEFIVZPG.js.map → chunk-T3LC5LKB.js.map} +0 -0
  624. /package/dist/cli-bundle/chunks/{chunk-JFWUHHS2.js.map → chunk-UM2GBHS4.js.map} +0 -0
  625. /package/dist/cli-bundle/chunks/{chunk-SEXQN4KL.js.map → chunk-WKY2IBOQ.js.map} +0 -0
  626. /package/dist/cli-bundle/chunks/{chunk-NGN7UV5K.js.map → chunk-XLTD2HN3.js.map} +0 -0
  627. /package/dist/cli-bundle/chunks/{chunk-L2FXEKDB.js.map → chunk-YL2DJGYS.js.map} +0 -0
  628. /package/dist/cli-bundle/chunks/{close-XY4CSAYF.js.map → close-3HDWDA3L.js.map} +0 -0
  629. /package/dist/cli-bundle/chunks/{create-PZVHRIZQ.js.map → create-JTZNCTQC.js.map} +0 -0
  630. /package/dist/cli-bundle/chunks/{extension-B4WL7BQU.js.map → extension-J7IBMFTD.js.map} +0 -0
  631. /package/dist/cli-bundle/chunks/{history-A2JUDXUE.js.map → history-2BA3T5AE.js.map} +0 -0
  632. /package/dist/cli-bundle/chunks/{history-redact-ED6RFCPL.js.map → history-redact-JBZNXHGR.js.map} +0 -0
  633. /package/dist/cli-bundle/chunks/{init-M2WUB4YH.js.map → init-HIVSNX3O.js.map} +0 -0
  634. /package/dist/cli-bundle/chunks/{list-OGWQPC26.js.map → list-MUSQNMTD.js.map} +0 -0
  635. /package/dist/cli-bundle/chunks/{restore-MB2ISME7.js.map → restore-D4RGNX33.js.map} +0 -0
  636. /package/dist/cli-bundle/chunks/{test-VNBDRJ4Z.js.map → test-MXX3E5JL.js.map} +0 -0
  637. /package/dist/cli-bundle/chunks/{test-runs-GX5HTPSF.js.map → test-runs-WMVTQU3Y.js.map} +0 -0
  638. /package/dist/cli-bundle/chunks/{update-H6SCWNMA.js.map → update-YRXSUGYQ.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-defs-file.js","sources":["core/schema/status-defs-file.ts"],"sourceRoot":"/","sourcesContent":["import { RUNTIME_STATUS_ROLE_VALUES } from \"../../types/index.js\";\nimport type { RuntimeStatusDefinition, RuntimeStatusRole } from \"../../types/index.js\";\nimport { DEFAULT_RUNTIME_STATUS_DEFINITIONS } from \"./runtime-schema.js\";\n\nexport type { RuntimeStatusDefinition, RuntimeStatusRole } from \"../../types/index.js\";\n\n/**\n * Pure logic for the `pm schema add-status` / `pm schema remove-status`\n * commands. The CLI command file (schema.ts) owns IO/governance; everything\n * testable and side-effect-free lives here so it can be coverage-gated to 100%.\n *\n * Statuses persist at `.agents/pm/schema/statuses.json` under the shape\n * `{ statuses: RuntimeStatusDefinition[] }`. When the file is absent the runtime\n * merge layer (src/core/store/settings.ts) still supplies the built-in defaults\n * from DEFAULT_RUNTIME_STATUS_DEFINITIONS, so this module never duplicates them\n * into the persisted file.\n */\n\nconst RUNTIME_STATUS_ROLE_SET = new Set<string>(RUNTIME_STATUS_ROLE_VALUES);\n\n/**\n * The 5 lifecycle status ids that ship as built-in defaults and may never be\n * removed (their normalized ids match DEFAULT_RUNTIME_STATUS_DEFINITIONS:\n * open/in_progress/blocked/closed/canceled). `draft` is also a default but the\n * acceptance criteria enumerate the 5 terminal/active ids explicitly, so the\n * guard derives the full set from the canonical defaults to stay in sync.\n */\nexport const BUILTIN_STATUS_IDS: ReadonlySet<string> = new Set(\n DEFAULT_RUNTIME_STATUS_DEFINITIONS.map((definition) => normalizeStatusToken(definition.id)).filter(\n (id) => id.length > 0,\n ),\n);\n\n/**\n * The shape persisted at `.agents/pm/schema/statuses.json`.\n */\nexport interface StatusDefsFile {\n statuses: RuntimeStatusDefinition[];\n}\n\nexport interface RawAddStatusInput {\n id: string | undefined;\n roles?: string[];\n aliases?: string[];\n description?: string;\n order?: number;\n}\n\nexport interface NormalizedAddStatusInput {\n id: string;\n /**\n * Normalized roles, or `undefined` when the raw input did not supply a roles\n * field at all. `undefined` means \"leave existing roles untouched\" on upsert;\n * an explicit empty array means \"clear roles\". This distinction is what keeps\n * `add-status review --description x` from wiping a previously-set role.\n */\n roles?: RuntimeStatusRole[];\n /** Same omitted-vs-explicit-empty semantics as `roles`. */\n aliases?: string[];\n description?: string;\n order?: number;\n}\n\nexport interface UpsertStatusDefResult {\n file: StatusDefsFile;\n /** The definition as stored after the upsert (existing fields preserved). */\n definition: RuntimeStatusDefinition;\n /** True when an existing definition with the same (normalized) id was replaced. */\n replaced: boolean;\n}\n\nexport interface RemoveStatusDefResult {\n file: StatusDefsFile;\n /** True when a matching definition existed and was dropped from the file. */\n removed: boolean;\n /** The removed definition, when one matched the requested id. */\n definition?: RuntimeStatusDefinition;\n}\n\n/**\n * Normalizes a status token using the same rules as runtime-schema.ts: lowercase\n * and collapse any run of whitespace/hyphens into a single underscore.\n */\nexport function normalizeStatusToken(value: unknown): string {\n return typeof value === \"string\" ? value.trim().toLowerCase().replaceAll(/[\\s-]+/g, \"_\") : \"\";\n}\n\nfunction dedupeTokens(values: Iterable<string>): string[] {\n const seen = new Set<string>();\n for (const value of values) {\n const token = normalizeStatusToken(value);\n if (token.length > 0) {\n seen.add(token);\n }\n }\n return [...seen].sort((left, right) => left.localeCompare(right));\n}\n\n/**\n * Validates and normalizes raw add-status CLI input. Throws a plain Error with a\n * stable message when the id is missing/empty or a role is not one of\n * RUNTIME_STATUS_ROLE_VALUES; the CLI layer maps these to PmCliError exit codes.\n *\n * Omitted vs explicit-empty is preserved end-to-end: when `raw.roles`/`raw.aliases`\n * is `undefined` (flag not supplied) the normalized field is `undefined` so the\n * upsert leaves the existing value untouched; when supplied (even an empty array)\n * the field is normalized to an array so the upsert can apply an explicit clear.\n */\nexport function normalizeAddStatusInput(raw: RawAddStatusInput): NormalizedAddStatusInput {\n const id = normalizeStatusToken(raw.id);\n if (id.length === 0) {\n throw new Error(\"Status id must not be empty.\");\n }\n // Built-in lifecycle statuses are reserved and cannot be overridden: an\n // add-status override would change reserved metadata yet remove-status refuses\n // to delete a built-in id, leaving no CLI path to undo it. Reject up front,\n // symmetric with removeStatusDef.\n if (BUILTIN_STATUS_IDS.has(id)) {\n throw new Error(\n `Cannot add-status the built-in status \"${id}\". Built-in statuses are reserved: ${[...BUILTIN_STATUS_IDS].join(\", \")}.`,\n );\n }\n let roles: RuntimeStatusRole[] | undefined;\n if (raw.roles !== undefined) {\n roles = [];\n const seenRoles = new Set<string>();\n for (const rawRole of raw.roles) {\n const role = typeof rawRole === \"string\" ? rawRole.trim().toLowerCase() : \"\";\n if (role.length === 0) {\n continue;\n }\n if (!RUNTIME_STATUS_ROLE_SET.has(role)) {\n throw new Error(\n `Invalid status role \"${rawRole}\". Allowed roles: ${RUNTIME_STATUS_ROLE_VALUES.join(\", \")}.`,\n );\n }\n if (!seenRoles.has(role)) {\n seenRoles.add(role);\n roles.push(role as RuntimeStatusRole);\n }\n }\n }\n const aliases =\n raw.aliases === undefined ? undefined : dedupeTokens(raw.aliases).filter((alias) => alias !== id);\n const description = raw.description?.trim();\n const order =\n typeof raw.order === \"number\" && Number.isFinite(raw.order) ? Math.trunc(raw.order) : undefined;\n return {\n id,\n roles,\n aliases,\n description: description && description.length > 0 ? description : undefined,\n order,\n };\n}\n\nfunction selectStatusesArray(parsed: unknown): unknown[] | undefined {\n if (Array.isArray(parsed)) {\n return parsed;\n }\n if (typeof parsed !== \"object\" || parsed === null) {\n return undefined;\n }\n const record = parsed as Record<string, unknown>;\n if (Array.isArray(record.statuses)) {\n return record.statuses;\n }\n if (Array.isArray(record.definitions)) {\n return record.definitions;\n }\n return undefined;\n}\n\nfunction extractStatusDefinitions(parsed: unknown): RuntimeStatusDefinition[] {\n const candidate = selectStatusesArray(parsed);\n if (!candidate) {\n return [];\n }\n const definitions: RuntimeStatusDefinition[] = [];\n for (const entry of candidate) {\n if (typeof entry !== \"object\" || entry === null || Array.isArray(entry)) {\n continue;\n }\n const record = entry as Record<string, unknown>;\n if (typeof record.id !== \"string\" || record.id.trim().length === 0) {\n continue;\n }\n definitions.push(record as unknown as RuntimeStatusDefinition);\n }\n return definitions;\n}\n\n/**\n * Coerces an arbitrary parsed value from statuses.json into a StatusDefsFile.\n * Accepts the canonical `{ statuses: [...] }` shape, a bare array of\n * definitions, or a `{ definitions: [...] }` form, and tolerates a\n * missing/invalid file by returning an empty statuses list.\n */\nexport function parseStatusDefsFile(raw: string | null | undefined): StatusDefsFile {\n if (raw === null || raw === undefined || raw.trim().length === 0) {\n return { statuses: [] };\n }\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw) as unknown;\n } catch {\n throw new Error(\"schema/statuses.json contains invalid JSON.\");\n }\n return { statuses: extractStatusDefinitions(parsed) };\n}\n\n/**\n * Serializes the status definitions file with a trailing newline (matches the\n * rest of the schema scaffold files written by pm).\n */\nexport function serializeStatusDefsFile(file: StatusDefsFile): string {\n return `${JSON.stringify({ statuses: file.statuses }, null, 2)}\\n`;\n}\n\n/**\n * Idempotent UPSERT of a status definition into the parsed file. Matching is by\n * normalized id. When a definition already exists, fields supplied in `input`\n * override the previous values (roles/aliases replace when a non-empty array is\n * given, clear when an explicit empty array is given, and are left UNTOUCHED\n * when the field is `undefined` — i.e. the add-status flag was omitted);\n * description/order override when provided. Fields not addressed by add-status\n * flags are preserved untouched, so `add-status <id> --description x` keeps any\n * previously-set roles/aliases.\n */\nexport function upsertStatusDef(\n file: StatusDefsFile,\n input: NormalizedAddStatusInput,\n baseDefinition?: RuntimeStatusDefinition,\n): UpsertStatusDefResult {\n const statuses = file.statuses.slice();\n const existingIndex = statuses.findIndex(\n (definition) => normalizeStatusToken(definition.id) === input.id,\n );\n // A file-backed definition is the primary seed; when the status is not yet in\n // statuses.json fall back to `baseDefinition` (the resolved settings-backed\n // definition) so omitting --role/--alias preserves metadata that lives in\n // settings.schema.statuses rather than the file.\n const existing = existingIndex >= 0 ? statuses[existingIndex] : baseDefinition;\n\n const next: RuntimeStatusDefinition = {\n ...(existing ?? {}),\n id: input.id,\n };\n if (input.roles !== undefined) {\n if (input.roles.length > 0) {\n next.roles = [...input.roles];\n } else if (next.roles !== undefined) {\n delete next.roles;\n }\n }\n if (input.aliases !== undefined) {\n if (input.aliases.length > 0) {\n next.aliases = [...input.aliases];\n } else if (next.aliases !== undefined) {\n delete next.aliases;\n }\n }\n if (input.description !== undefined) {\n next.description = input.description;\n }\n if (input.order !== undefined) {\n next.order = input.order;\n }\n\n if (existingIndex >= 0) {\n statuses[existingIndex] = next;\n } else {\n statuses.push(next);\n }\n\n return {\n file: { statuses },\n definition: next,\n // \"replaced\" reflects whether the status already existed effectively (in the\n // file OR in resolved settings), so the CLI reports \"Updated\" vs \"Registered\"\n // correctly even when the prior definition lived only in settings.\n replaced: existing !== undefined,\n };\n}\n\n/**\n * Removes a status definition from the parsed file by id (normalized). Throws a\n * plain Error when `id` is empty or matches a reserved built-in default status\n * (those are never stored in the file and must never be deletable). Returns\n * `removed: false` when no matching definition exists so the CLI layer can treat\n * the call as an idempotent no-op.\n */\nexport function removeStatusDef(file: StatusDefsFile, id: string | undefined): RemoveStatusDefResult {\n const normalizedId = normalizeStatusToken(id);\n if (normalizedId.length === 0) {\n throw new Error(\"Status id must not be empty.\");\n }\n if (BUILTIN_STATUS_IDS.has(normalizedId)) {\n throw new Error(\n `Cannot remove built-in status \"${normalizedId}\". Built-in statuses are reserved: ${[...BUILTIN_STATUS_IDS].join(\", \")}.`,\n );\n }\n const statuses = file.statuses.slice();\n const existingIndex = statuses.findIndex(\n (definition) => normalizeStatusToken(definition.id) === normalizedId,\n );\n if (existingIndex < 0) {\n return { file: { statuses }, removed: false };\n }\n const [definition] = statuses.splice(existingIndex, 1);\n return { file: { statuses }, removed: true, definition };\n}\n\n/**\n * Throws when the new status id or any explicitly-supplied alias collides with a\n * DIFFERENT existing status's id/alias. `resolvedAliasToId` maps a normalized\n * token to its owning status id (the runtime status registry's alias_to_id map,\n * which stores ids and aliases in one namespace). Re-adding the same status\n * (matching id) is allowed — only cross-status collisions throw. This prevents a\n * custom status from shadowing a built-in lifecycle token (for example\n * `add-status review --alias open`, or a custom id `cancelled` that aliases the\n * built-in `canceled`), which would make `pm update --status open` resolve to the\n * wrong status. The CLI layer maps the thrown Error to a USAGE exit code.\n */\nexport function assertStatusTokensAvailable(\n input: { id: string; aliases?: string[] },\n resolvedAliasToId: ReadonlyMap<string, string>,\n): void {\n const candidates = [input.id, ...(input.aliases ?? [])];\n for (const candidate of candidates) {\n const token = normalizeStatusToken(candidate);\n if (token.length === 0) {\n continue;\n }\n const owner = resolvedAliasToId.get(token);\n if (owner !== undefined && owner !== input.id) {\n throw new Error(\n `Status token \"${token}\" already belongs to status \"${owner}\". Choose a different id/alias to avoid shadowing it.`,\n );\n }\n }\n}\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAIzE;;;;;;;;;;GAUG;AAEH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAS,0BAA0B,CAAC,CAAC;AAE5E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAC5D,kCAAkC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAChG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CACtB,CACF,CAAC;AAgDF;;;GAGG;AACH,MAAM,UAAU,oBAAoB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E,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAyC,EACzC,iBAA8C;IAE9C,MAAM,UAAU,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;IACxD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,SAAS;QACX,CAAC;QACD,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,CAAC,EAAE,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CACb,iBAAiB,KAAK,gCAAgC,KAAK,uDAAuD,CACnH,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","debugId":"d738db07-1d64-5ab0-9ebd-f9c9f6de5706"}
@@ -0,0 +1,64 @@
1
+ import type { RuntimeSchemaSettings } from "../../types/index.js";
2
+ /**
3
+ * Per-type allowed-transition support (governance.workflow_enforcement).
4
+ *
5
+ * Rule semantics:
6
+ * - A type with NO matching type_workflows entry is UNRESTRICTED (every
7
+ * transition is allowed).
8
+ * - A type WITH an entry allows only the listed [from, to] pairs. from/to are
9
+ * compared as normalized status ids (resolved through the status registry's
10
+ * alias_to_id map when available, otherwise via token normalization).
11
+ * - A same-status no-op (from === to) is ALWAYS allowed.
12
+ *
13
+ * This module is intentionally dependency-light and fully unit-testable; the
14
+ * CLI enforcement point (src/cli/commands/update.ts) is the only consumer.
15
+ */
16
+ export interface NormalizedTypeWorkflow {
17
+ /** Lower-cased type name used for case-insensitive matching. */
18
+ type: string;
19
+ /** Allowed [from, to] pairs as normalized status ids. */
20
+ allowed_transitions: [string, string][];
21
+ }
22
+ /** Minimal status-registry surface needed to resolve a status token to its id. */
23
+ export interface StatusTokenResolver {
24
+ alias_to_id: Map<string, string>;
25
+ }
26
+ export interface EvaluateTransitionInput {
27
+ typeName: string;
28
+ fromStatus: string;
29
+ toStatus: string;
30
+ typeWorkflows: NormalizedTypeWorkflow[];
31
+ statusRegistry?: StatusTokenResolver;
32
+ }
33
+ export interface EvaluateTransitionResult {
34
+ /** Whether the transition is permitted. */
35
+ allowed: boolean;
36
+ /** Whether a matching per-type rule constrained the transition. */
37
+ hasRule: boolean;
38
+ /**
39
+ * Allowed [from, to] pairs for the matched type (normalized ids). Empty when
40
+ * the type is unrestricted.
41
+ */
42
+ allowedTransitions: [string, string][];
43
+ }
44
+ /** Normalize a status token the same way runtime-schema statuses are normalized. */
45
+ export declare function normalizeStatusToken(value: unknown): string;
46
+ /**
47
+ * Normalize the raw type_workflows from a runtime schema into a deduped,
48
+ * lower-cased-type list with normalized status tokens.
49
+ *
50
+ * An entry is kept when it has a valid (non-empty) `type` AND its
51
+ * `allowed_transitions` is an ARRAY — even when that array is empty. An explicit
52
+ * empty array is a deliberate DENY-ALL rule (only same-status no-ops are
53
+ * permitted, see evaluateTransition), so it must NOT collapse into "no rule"
54
+ * (which would leave the type unrestricted). Entries with a missing/empty type
55
+ * or a non-array `allowed_transitions` are dropped, as are malformed/short pairs.
56
+ */
57
+ export declare function resolveTypeWorkflows(schema: Pick<RuntimeSchemaSettings, "type_workflows"> | undefined): NormalizedTypeWorkflow[];
58
+ /**
59
+ * Evaluate whether a status transition is allowed for the given item type.
60
+ * Returns hasRule=false (allowed) when the type is unrestricted.
61
+ */
62
+ export declare function evaluateTransition(input: EvaluateTransitionInput): EvaluateTransitionResult;
63
+ /** Render the allowed transitions for an error/warning hint. */
64
+ export declare function describeAllowedTransitions(allowedTransitions: [string, string][]): string;
@@ -0,0 +1,98 @@
1
+ /** Normalize a status token the same way runtime-schema statuses are normalized. */
2
+
3
+ !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]="70ab7197-566b-52de-8a82-e432b324ad8d")}catch(e){}}();
4
+ export function normalizeStatusToken(value) {
5
+ return typeof value === "string" ? value.trim().toLowerCase().replaceAll(/[\s-]+/g, "_") : "";
6
+ }
7
+ function normalizeTypeName(value) {
8
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
9
+ }
10
+ function resolveStatusId(value, statusRegistry) {
11
+ const token = normalizeStatusToken(value);
12
+ if (token.length === 0) {
13
+ return "";
14
+ }
15
+ return statusRegistry?.alias_to_id?.get(token) ?? token;
16
+ }
17
+ /**
18
+ * Normalize the raw type_workflows from a runtime schema into a deduped,
19
+ * lower-cased-type list with normalized status tokens.
20
+ *
21
+ * An entry is kept when it has a valid (non-empty) `type` AND its
22
+ * `allowed_transitions` is an ARRAY — even when that array is empty. An explicit
23
+ * empty array is a deliberate DENY-ALL rule (only same-status no-ops are
24
+ * permitted, see evaluateTransition), so it must NOT collapse into "no rule"
25
+ * (which would leave the type unrestricted). Entries with a missing/empty type
26
+ * or a non-array `allowed_transitions` are dropped, as are malformed/short pairs.
27
+ */
28
+ export function resolveTypeWorkflows(schema) {
29
+ const rawWorkflows = Array.isArray(schema?.type_workflows) ? schema.type_workflows : [];
30
+ const byType = new Map();
31
+ for (const entry of rawWorkflows) {
32
+ const type = normalizeTypeName(entry?.type);
33
+ if (type.length === 0) {
34
+ continue;
35
+ }
36
+ if (!Array.isArray(entry?.allowed_transitions)) {
37
+ continue;
38
+ }
39
+ const pairs = entry.allowed_transitions;
40
+ const record = byType.get(type) ?? { pairs: [], denyAll: false };
41
+ // Only an explicitly empty array is an intentional deny-all; a nonempty array
42
+ // whose pairs are all malformed is a typo and must be dropped (not deny-all).
43
+ if (pairs.length === 0) {
44
+ record.denyAll = true;
45
+ }
46
+ for (const pair of pairs) {
47
+ if (!Array.isArray(pair) || pair.length !== 2) {
48
+ continue;
49
+ }
50
+ const from = normalizeStatusToken(pair[0]);
51
+ const to = normalizeStatusToken(pair[1]);
52
+ if (from.length === 0 || to.length === 0) {
53
+ continue;
54
+ }
55
+ if (record.pairs.some((candidate) => candidate[0] === from && candidate[1] === to)) {
56
+ continue;
57
+ }
58
+ record.pairs.push([from, to]);
59
+ }
60
+ byType.set(type, record);
61
+ }
62
+ return [...byType.entries()]
63
+ .filter(([, record]) => record.pairs.length > 0 || record.denyAll)
64
+ .map(([type, record]) => ({ type, allowed_transitions: record.pairs }))
65
+ .sort((left, right) => left.type.localeCompare(right.type));
66
+ }
67
+ /**
68
+ * Evaluate whether a status transition is allowed for the given item type.
69
+ * Returns hasRule=false (allowed) when the type is unrestricted.
70
+ */
71
+ export function evaluateTransition(input) {
72
+ const typeName = normalizeTypeName(input.typeName);
73
+ const matched = input.typeWorkflows.find((workflow) => workflow.type === typeName);
74
+ if (!matched) {
75
+ return { allowed: true, hasRule: false, allowedTransitions: [] };
76
+ }
77
+ const from = resolveStatusId(input.fromStatus, input.statusRegistry);
78
+ const to = resolveStatusId(input.toStatus, input.statusRegistry);
79
+ // A no-op self-transition is always permitted, even under a restricting rule.
80
+ if (from.length > 0 && from === to) {
81
+ return { allowed: true, hasRule: true, allowedTransitions: matched.allowed_transitions };
82
+ }
83
+ const allowed = matched.allowed_transitions.some((pair) => {
84
+ const ruleFrom = resolveStatusId(pair[0], input.statusRegistry);
85
+ const ruleTo = resolveStatusId(pair[1], input.statusRegistry);
86
+ return ruleFrom === from && ruleTo === to;
87
+ });
88
+ return { allowed, hasRule: true, allowedTransitions: matched.allowed_transitions };
89
+ }
90
+ /** Render the allowed transitions for an error/warning hint. */
91
+ export function describeAllowedTransitions(allowedTransitions) {
92
+ if (allowedTransitions.length === 0) {
93
+ return "(no transitions allowed)";
94
+ }
95
+ return allowedTransitions.map((pair) => `${pair[0]} -> ${pair[1]}`).join(", ");
96
+ }
97
+ //# sourceMappingURL=type-workflows.js.map
98
+ //# debugId=70ab7197-566b-52de-8a82-e432b324ad8d
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-workflows.js","sources":["core/schema/type-workflows.ts"],"sourceRoot":"/","sourcesContent":["import type { RuntimeSchemaSettings, TypeWorkflowDefinition } from \"../../types/index.js\";\n\n/**\n * Per-type allowed-transition support (governance.workflow_enforcement).\n *\n * Rule semantics:\n * - A type with NO matching type_workflows entry is UNRESTRICTED (every\n * transition is allowed).\n * - A type WITH an entry allows only the listed [from, to] pairs. from/to are\n * compared as normalized status ids (resolved through the status registry's\n * alias_to_id map when available, otherwise via token normalization).\n * - A same-status no-op (from === to) is ALWAYS allowed.\n *\n * This module is intentionally dependency-light and fully unit-testable; the\n * CLI enforcement point (src/cli/commands/update.ts) is the only consumer.\n */\n\nexport interface NormalizedTypeWorkflow {\n /** Lower-cased type name used for case-insensitive matching. */\n type: string;\n /** Allowed [from, to] pairs as normalized status ids. */\n allowed_transitions: [string, string][];\n}\n\n/** Minimal status-registry surface needed to resolve a status token to its id. */\nexport interface StatusTokenResolver {\n alias_to_id: Map<string, string>;\n}\n\nexport interface EvaluateTransitionInput {\n typeName: string;\n fromStatus: string;\n toStatus: string;\n typeWorkflows: NormalizedTypeWorkflow[];\n statusRegistry?: StatusTokenResolver;\n}\n\nexport interface EvaluateTransitionResult {\n /** Whether the transition is permitted. */\n allowed: boolean;\n /** Whether a matching per-type rule constrained the transition. */\n hasRule: boolean;\n /**\n * Allowed [from, to] pairs for the matched type (normalized ids). Empty when\n * the type is unrestricted.\n */\n allowedTransitions: [string, string][];\n}\n\n/** Normalize a status token the same way runtime-schema statuses are normalized. */\nexport function normalizeStatusToken(value: unknown): string {\n return typeof value === \"string\" ? value.trim().toLowerCase().replaceAll(/[\\s-]+/g, \"_\") : \"\";\n}\n\nfunction normalizeTypeName(value: unknown): string {\n return typeof value === \"string\" ? value.trim().toLowerCase() : \"\";\n}\n\nfunction resolveStatusId(value: string, statusRegistry: StatusTokenResolver | undefined): string {\n const token = normalizeStatusToken(value);\n if (token.length === 0) {\n return \"\";\n }\n return statusRegistry?.alias_to_id?.get(token) ?? token;\n}\n\n/**\n * Normalize the raw type_workflows from a runtime schema into a deduped,\n * lower-cased-type list with normalized status tokens.\n *\n * An entry is kept when it has a valid (non-empty) `type` AND its\n * `allowed_transitions` is an ARRAY — even when that array is empty. An explicit\n * empty array is a deliberate DENY-ALL rule (only same-status no-ops are\n * permitted, see evaluateTransition), so it must NOT collapse into \"no rule\"\n * (which would leave the type unrestricted). Entries with a missing/empty type\n * or a non-array `allowed_transitions` are dropped, as are malformed/short pairs.\n */\nexport function resolveTypeWorkflows(\n schema: Pick<RuntimeSchemaSettings, \"type_workflows\"> | undefined,\n): NormalizedTypeWorkflow[] {\n const rawWorkflows: TypeWorkflowDefinition[] = Array.isArray(schema?.type_workflows) ? schema!.type_workflows! : [];\n const byType = new Map<string, { pairs: [string, string][]; denyAll: boolean }>();\n for (const entry of rawWorkflows) {\n const type = normalizeTypeName(entry?.type);\n if (type.length === 0) {\n continue;\n }\n if (!Array.isArray(entry?.allowed_transitions)) {\n continue;\n }\n const pairs = entry.allowed_transitions;\n const record = byType.get(type) ?? { pairs: [], denyAll: false };\n // Only an explicitly empty array is an intentional deny-all; a nonempty array\n // whose pairs are all malformed is a typo and must be dropped (not deny-all).\n if (pairs.length === 0) {\n record.denyAll = true;\n }\n for (const pair of pairs) {\n if (!Array.isArray(pair) || pair.length !== 2) {\n continue;\n }\n const from = normalizeStatusToken(pair[0]);\n const to = normalizeStatusToken(pair[1]);\n if (from.length === 0 || to.length === 0) {\n continue;\n }\n if (record.pairs.some((candidate) => candidate[0] === from && candidate[1] === to)) {\n continue;\n }\n record.pairs.push([from, to]);\n }\n byType.set(type, record);\n }\n return [...byType.entries()]\n .filter(([, record]) => record.pairs.length > 0 || record.denyAll)\n .map(([type, record]) => ({ type, allowed_transitions: record.pairs }))\n .sort((left, right) => left.type.localeCompare(right.type));\n}\n\n/**\n * Evaluate whether a status transition is allowed for the given item type.\n * Returns hasRule=false (allowed) when the type is unrestricted.\n */\nexport function evaluateTransition(input: EvaluateTransitionInput): EvaluateTransitionResult {\n const typeName = normalizeTypeName(input.typeName);\n const matched = input.typeWorkflows.find((workflow) => workflow.type === typeName);\n if (!matched) {\n return { allowed: true, hasRule: false, allowedTransitions: [] };\n }\n const from = resolveStatusId(input.fromStatus, input.statusRegistry);\n const to = resolveStatusId(input.toStatus, input.statusRegistry);\n // A no-op self-transition is always permitted, even under a restricting rule.\n if (from.length > 0 && from === to) {\n return { allowed: true, hasRule: true, allowedTransitions: matched.allowed_transitions };\n }\n const allowed = matched.allowed_transitions.some((pair) => {\n const ruleFrom = resolveStatusId(pair[0], input.statusRegistry);\n const ruleTo = resolveStatusId(pair[1], input.statusRegistry);\n return ruleFrom === from && ruleTo === to;\n });\n return { allowed, hasRule: true, allowedTransitions: matched.allowed_transitions };\n}\n\n/** Render the allowed transitions for an error/warning hint. */\nexport function describeAllowedTransitions(allowedTransitions: [string, string][]): string {\n if (allowedTransitions.length === 0) {\n return \"(no transitions allowed)\";\n }\n return allowedTransitions.map((pair) => `${pair[0]} -> ${pair[1]}`).join(\", \");\n}\n"],"names":[],"mappings":"AAiDA,oFAAoF;;;AACpF,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChG,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,eAAe,CAAC,KAAa,EAAE,cAA+C;IACrF,MAAM,KAAK,GAAG,o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AsC;IAC/E,IAAI,kBAAkB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,0BAA0B,CAAC;IACpC,CAAC;IACD,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC","debugId":"70ab7197-566b-52de-8a82-e432b324ad8d"}
@@ -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 {
@@ -31,10 +32,11 @@ export interface SemanticRefreshOptions {
31
32
  }
32
33
  export interface VectorizationStatusLedgerReadResult {
33
34
  entries: Record<string, string>;
35
+ embedding: VectorizationEmbeddingMetadata | null;
34
36
  warnings: string[];
35
37
  }
36
38
  export declare function readVectorizationStatusLedger(pmRoot: string): Promise<VectorizationStatusLedgerReadResult>;
37
- 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>;
38
40
  export declare function invalidateSearchCacheArtifacts(pmRoot: string): Promise<SearchCacheInvalidationResult>;
39
41
  export declare function refreshSemanticEmbeddingsForMutatedItems(pmRoot: string, itemIds: string[], options?: SemanticRefreshOptions): Promise<SemanticMutationRefreshResult>;
40
42
  /**
@@ -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]="d04073fd-fa5a-5454-8e71-11bc477005b0")}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";
@@ -13,7 +13,8 @@ import { buildSemanticCorpusInput } from "./corpus.js";
13
13
  import { resolveEmbeddingProviders } from "./providers.js";
14
14
  import { resolveSettingsWithSemanticRuntimeDefaults } from "./semantic-defaults.js";
15
15
  import { scheduleBackgroundSemanticRefresh } from "./background-refresh.js";
16
- import { executeVectorDelete, executeVectorUpsert, resolveVectorStores } from "./vector-stores.js";
16
+ import { executeVectorDelete, executeVectorReset, executeVectorUpsert, resolveVectorStores } from "./vector-stores.js";
17
+ import { buildVectorizationEmbeddingIdentity, buildVectorizationEmbeddingMetadata, hasVectorizationEmbeddingIdentityChanged, hasVectorizationVectorDimensionChanged, inferConsistentVectorDimension, normalizeVectorizationEmbeddingMetadata, } from "./vectorization-metadata.js";
17
18
  import { nowIso } from "../shared/time.js";
18
19
  export const SEARCH_CACHE_ARTIFACT_PATHS = ["index/manifest.json", "search/embeddings.jsonl"];
19
20
  export const VECTORIZATION_STATUS_LEDGER_PATH = "search/vectorization-status.json";
@@ -44,6 +45,7 @@ export async function readVectorizationStatusLedger(pmRoot) {
44
45
  if (raw === null || raw.trim().length === 0) {
45
46
  return {
46
47
  entries: {},
48
+ embedding: null,
47
49
  warnings: [],
48
50
  };
49
51
  }
@@ -54,6 +56,7 @@ export async function readVectorizationStatusLedger(pmRoot) {
54
56
  catch {
55
57
  return {
56
58
  entries: {},
59
+ embedding: null,
57
60
  warnings: ["search_vectorization_status_ledger_invalid"],
58
61
  };
59
62
  }
@@ -63,6 +66,7 @@ export async function readVectorizationStatusLedger(pmRoot) {
63
66
  !Array.isArray(parsed.items)) {
64
67
  return {
65
68
  entries: {},
69
+ embedding: null,
66
70
  warnings: ["search_vectorization_status_ledger_invalid"],
67
71
  };
68
72
  }
@@ -71,6 +75,7 @@ export async function readVectorizationStatusLedger(pmRoot) {
71
75
  if (typeof entry !== "object" || entry === null) {
72
76
  return {
73
77
  entries: {},
78
+ embedding: null,
74
79
  warnings: ["search_vectorization_status_ledger_invalid"],
75
80
  };
76
81
  }
@@ -79,22 +84,36 @@ export async function readVectorizationStatusLedger(pmRoot) {
79
84
  if (typeof id !== "string" || id.trim().length === 0 || !isValidUpdatedAt(updatedAt)) {
80
85
  return {
81
86
  entries: {},
87
+ embedding: null,
82
88
  warnings: ["search_vectorization_status_ledger_invalid"],
83
89
  };
84
90
  }
85
91
  mapped.set(id.trim(), updatedAt);
86
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
+ }
87
104
  return {
88
105
  entries: Object.fromEntries([...mapped.entries()].sort((left, right) => left[0].localeCompare(right[0]))),
106
+ embedding,
89
107
  warnings: [],
90
108
  };
91
109
  }
92
- export async function writeVectorizationStatusLedger(pmRoot, entries) {
110
+ export async function writeVectorizationStatusLedger(pmRoot, entries, embedding) {
93
111
  const normalizedEntries = normalizeVectorizationLedgerEntries(entries);
94
112
  const ledgerPath = path.join(pmRoot, VECTORIZATION_STATUS_LEDGER_PATH);
95
113
  const serialized = `${JSON.stringify({
96
114
  version: 1,
97
115
  generated_at: nowIso(),
116
+ ...(embedding ? { embedding } : {}),
98
117
  items: Object.entries(normalizedEntries).map(([id, updated_at]) => ({
99
118
  id,
100
119
  updated_at,
@@ -111,6 +130,13 @@ function buildVectorPayload(item) {
111
130
  updated_at: item.updated_at,
112
131
  };
113
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
+ }
114
140
  function buildSkippedSemanticRefreshResult(itemIds, warning) {
115
141
  return {
116
142
  refreshed: [],
@@ -177,31 +203,39 @@ async function collectSemanticRefreshWorkload(pmRoot, idPrefix, preferredFormat,
177
203
  warnings,
178
204
  };
179
205
  }
180
- async function refreshLocatedSemanticVectors(settings, provider, vectorStore, documents) {
181
- if (documents.length === 0) {
182
- return { refreshed: [], skipped: [], warnings: [] };
183
- }
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) {
184
230
  try {
185
- const corpusInputs = documents.map((entry) => buildSemanticCorpusInput(entry.document, {
186
- providerName: provider.name,
187
- }));
188
- const embeddingResult = await executeEmbeddingBatchesWithRetry(provider, settings, corpusInputs);
189
- await executeVectorUpsert(vectorStore, documents.map((entry, index) => ({
190
- id: entry.id,
191
- vector: embeddingResult.vectors[index],
192
- payload: buildVectorPayload(entry.document.metadata),
193
- })));
194
- return {
195
- refreshed: documents.map((entry) => entry.id),
196
- skipped: [],
197
- warnings: embeddingResult.warnings,
198
- };
231
+ await executeVectorReset(vectorStore, Object.keys(ledgerEntries));
232
+ return { refreshed: [], skipped: [], warnings: [] };
199
233
  }
200
234
  catch (error) {
201
235
  return {
202
236
  refreshed: [],
203
- skipped: documents.map((entry) => entry.id),
204
- warnings: [`search_semantic_refresh_failed:${toErrorMessage(error)}`],
237
+ skipped: [],
238
+ warnings: [`search_semantic_refresh_reset_failed:${toErrorMessage(error)}`],
205
239
  };
206
240
  }
207
241
  }
@@ -261,7 +295,50 @@ export async function refreshSemanticEmbeddingsForMutatedItems(pmRoot, itemIds,
261
295
  }
262
296
  const typeRegistry = resolveItemTypeRegistry(runtimeContext.settings, getActiveExtensionRegistrations());
263
297
  const workload = await collectSemanticRefreshWorkload(pmRoot, runtimeContext.settings.id_prefix, runtimeContext.settings.item_format, normalizedItemIds, typeRegistry.type_to_folder, runtimeContext.settings.schema);
264
- 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
+ }
265
342
  const pruneResult = await pruneMissingSemanticVectors(runtimeContext.vectorStore, workload.missingIds);
266
343
  const refreshedIdSet = new Set(refreshedResult.refreshed);
267
344
  const refreshedEntries = Object.fromEntries(workload.documents
@@ -269,16 +346,15 @@ export async function refreshSemanticEmbeddingsForMutatedItems(pmRoot, itemIds,
269
346
  .map((entry) => [entry.id, entry.document.metadata.updated_at]));
270
347
  const ledgerWarnings = [];
271
348
  if (Object.keys(refreshedEntries).length > 0 || workload.missingIds.length > 0) {
272
- const ledgerRead = await readVectorizationStatusLedger(pmRoot);
273
349
  const nextEntries = {
274
- ...ledgerRead.entries,
350
+ ...nextLedgerBaseEntries,
275
351
  ...normalizeVectorizationLedgerEntries(refreshedEntries),
276
352
  };
277
353
  for (const missingId of workload.missingIds) {
278
354
  delete nextEntries[missingId];
279
355
  }
280
356
  try {
281
- await writeVectorizationStatusLedger(pmRoot, nextEntries);
357
+ await writeVectorizationStatusLedger(pmRoot, nextEntries, nextEmbeddingMetadata);
282
358
  }
283
359
  catch (error) {
284
360
  ledgerWarnings.push(`search_vectorization_status_ledger_write_failed:${toErrorMessage(error)}`);
@@ -374,4 +450,4 @@ export async function refreshSearchArtifactsForMutation(pmRoot, itemIds, options
374
450
  };
375
451
  }
376
452
  //# sourceMappingURL=cache.js.map
377
- //# debugId=d04073fd-fa5a-5454-8e71-11bc477005b0
453
+ //# debugId=5d698c95-b557-5c29-bc3f-caf70b5d6d0f