@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
@@ -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,MAA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S,CACtC,CAAC,UAAU,EAAE,EAAE,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,YAAY,CACrE,CAAC;IACF,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAChD,CAAC;IACD,MAAM,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IACvD,OAAO,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,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;I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,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QAC9D,OAAO,QAAQ,KAAK,IAAI,IAAI,MAAM,KAAK,EAAE,CAAC;IAC5C,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,mBAAmB,EAAE,CAAC;AACrF,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,0BAA0B,CAAC,kBAAsC;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"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Shared lock id for any process that rewrites the local vector store. Reindex
3
+ * and the background mutation-refresh worker both acquire this so they never
4
+ * write concurrently and corrupt the store. Exported so `pm reindex` reuses the
5
+ * same id rather than duplicating the literal.
6
+ */
7
+ export declare const REINDEX_LOCK_ID = "reindex";
8
+ /**
9
+ * Mutation search refresh runs inline (blocking) under test runners, inside the
10
+ * background worker child itself, or when explicitly requested. Otherwise the
11
+ * semantic refresh is dispatched to a detached child so mutations return without
12
+ * waiting on embeddings. Mirrors the telemetry-flush inline gate so the full test
13
+ * suite stays deterministic.
14
+ */
15
+ export declare function shouldRunSearchRefreshInForeground(): boolean;
16
+ declare function pendingQueuePath(pmRoot: string): string;
17
+ declare function acquireQueueGate(pmRoot: string): boolean;
18
+ declare function releaseQueueGate(pmRoot: string): void;
19
+ /** Merge mutated item ids into the persistent pending-refresh queue. */
20
+ export declare function enqueuePendingRefreshIds(pmRoot: string, itemIds: string[]): Promise<void>;
21
+ /** Atomically read and clear the pending-refresh queue, returning drained ids. */
22
+ export declare function drainPendingRefreshIds(pmRoot: string): Promise<string[]>;
23
+ /**
24
+ * Enqueue mutated ids and dispatch a detached worker child to refresh semantic
25
+ * embeddings without blocking the mutation. The reindex lock the worker acquires
26
+ * serializes concurrent refreshes, so the spawn itself stays unconditional and
27
+ * cheap; a worker that loses the lock exits and its ids are drained by the holder.
28
+ */
29
+ export declare function scheduleBackgroundSemanticRefresh(pmRoot: string, itemIds: string[]): Promise<void>;
30
+ export interface SemanticRefreshWorkerResult {
31
+ processed: string[];
32
+ rounds: number;
33
+ warnings: string[];
34
+ }
35
+ type SemanticRefreshFn = (pmRoot: string, itemIds: string[]) => Promise<{
36
+ refreshed: string[];
37
+ skipped: string[];
38
+ warnings: string[];
39
+ }>;
40
+ /**
41
+ * Drain the pending queue and refresh semantic vectors under the reindex lock so
42
+ * the local vector store is never rewritten concurrently. If the lock is held by
43
+ * another worker we exit immediately — that holder drains our enqueued ids. After
44
+ * releasing we re-check the queue once and re-dispatch if a sibling enqueued ids
45
+ * during our final window, guaranteeing eventual processing.
46
+ */
47
+ export declare function runSemanticRefreshWorker(pmRoot: string, refresh: SemanticRefreshFn): Promise<SemanticRefreshWorkerResult>;
48
+ export declare const _backgroundRefreshInternals: {
49
+ pendingQueuePath: typeof pendingQueuePath;
50
+ acquireQueueGate: typeof acquireQueueGate;
51
+ releaseQueueGate: typeof releaseQueueGate;
52
+ };
53
+ export {};
@@ -0,0 +1,286 @@
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]="d8990236-9b78-570d-bafa-5da0ce621293")}catch(e){}}();
3
+ import { spawn } from "node:child_process";
4
+ import { mkdirSync, rmSync, statSync } from "node:fs";
5
+ import path from "node:path";
6
+ import { pathExists, readFileIfExists, writeFileAtomic } from "../fs/fs-utils.js";
7
+ import { acquireLock } from "../lock/lock.js";
8
+ import { resolvePmPackageRootFromModule } from "../packages/root.js";
9
+ import { readSettings } from "../store/settings.js";
10
+ import { toErrorMessage } from "../shared/primitives.js";
11
+ import { resolveSettingsWithSemanticRuntimeDefaults } from "./semantic-defaults.js";
12
+ /**
13
+ * Shared lock id for any process that rewrites the local vector store. Reindex
14
+ * and the background mutation-refresh worker both acquire this so they never
15
+ * write concurrently and corrupt the store. Exported so `pm reindex` reuses the
16
+ * same id rather than duplicating the literal.
17
+ */
18
+ export const REINDEX_LOCK_ID = "reindex";
19
+ const PENDING_QUEUE_REL_PATH = "search/pending-refresh.json";
20
+ const PENDING_QUEUE_GATE_REL_PATH = "search/pending-refresh.gate.lock";
21
+ const PENDING_QUEUE_GATE_STALE_MS = 30_000;
22
+ // Bounded reindex-lock retry for the background worker (~3.2s worst case).
23
+ const LOCK_ACQUIRE_ATTEMPTS = 8;
24
+ const LOCK_ACQUIRE_BACKOFF_MS = 400;
25
+ const SEARCH_REFRESH_INLINE_ENV = "PM_SEARCH_REFRESH_INLINE";
26
+ const SEARCH_REFRESH_CHILD_ENV = "PM_SEARCH_REFRESH_CHILD";
27
+ function parseBooleanTrueLike(value) {
28
+ if (typeof value !== "string") {
29
+ return false;
30
+ }
31
+ const normalized = value.trim().toLowerCase();
32
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
33
+ }
34
+ /**
35
+ * Mutation search refresh runs inline (blocking) under test runners, inside the
36
+ * background worker child itself, or when explicitly requested. Otherwise the
37
+ * semantic refresh is dispatched to a detached child so mutations return without
38
+ * waiting on embeddings. Mirrors the telemetry-flush inline gate so the full test
39
+ * suite stays deterministic.
40
+ */
41
+ export function shouldRunSearchRefreshInForeground() {
42
+ if (parseBooleanTrueLike(process.env[SEARCH_REFRESH_INLINE_ENV])) {
43
+ return true;
44
+ }
45
+ if (parseBooleanTrueLike(process.env[SEARCH_REFRESH_CHILD_ENV])) {
46
+ return true;
47
+ }
48
+ const nodeEnv = (process.env.NODE_ENV ?? "").trim().toLowerCase();
49
+ return (typeof process.env.VITEST === "string" ||
50
+ typeof process.env.VITEST_WORKER_ID === "string" ||
51
+ nodeEnv === "test");
52
+ }
53
+ function pendingQueuePath(pmRoot) {
54
+ return path.join(pmRoot, PENDING_QUEUE_REL_PATH);
55
+ }
56
+ function pendingQueueGatePath(pmRoot) {
57
+ return path.join(pmRoot, PENDING_QUEUE_GATE_REL_PATH);
58
+ }
59
+ function acquireQueueGate(pmRoot) {
60
+ const gatePath = pendingQueueGatePath(pmRoot);
61
+ try {
62
+ if (Date.now() - statSync(gatePath).mtimeMs < PENDING_QUEUE_GATE_STALE_MS) {
63
+ return false;
64
+ }
65
+ rmSync(gatePath, { recursive: true, force: true });
66
+ }
67
+ catch {
68
+ // Missing gate is the common case; fall through to create it.
69
+ }
70
+ try {
71
+ mkdirSync(path.dirname(gatePath), { recursive: true });
72
+ mkdirSync(gatePath);
73
+ return true;
74
+ }
75
+ catch {
76
+ return false;
77
+ }
78
+ }
79
+ function releaseQueueGate(pmRoot) {
80
+ try {
81
+ rmSync(pendingQueueGatePath(pmRoot), { recursive: true, force: true });
82
+ }
83
+ catch {
84
+ // Best effort; a stale gate self-heals after PENDING_QUEUE_GATE_STALE_MS.
85
+ }
86
+ }
87
+ async function withQueueGate(pmRoot, fn, fallback) {
88
+ // Briefly serialize read-modify-write access to the pending queue across the
89
+ // mutation process and the worker child. Acquisition is best effort; if a
90
+ // healthy gate is held we skip rather than risk a torn queue.
91
+ for (let attempt = 0; attempt < 50; attempt += 1) {
92
+ if (acquireQueueGate(pmRoot)) {
93
+ try {
94
+ return await fn();
95
+ }
96
+ finally {
97
+ releaseQueueGate(pmRoot);
98
+ }
99
+ }
100
+ await delay(20);
101
+ }
102
+ return fallback;
103
+ }
104
+ function delay(ms) {
105
+ return new Promise((resolve) => {
106
+ setTimeout(resolve, ms).unref?.();
107
+ });
108
+ }
109
+ async function readPendingQueueIds(pmRoot) {
110
+ const raw = await readFileIfExists(pendingQueuePath(pmRoot));
111
+ if (!raw || raw.trim().length === 0) {
112
+ return [];
113
+ }
114
+ try {
115
+ const parsed = JSON.parse(raw);
116
+ if (!Array.isArray(parsed.ids)) {
117
+ return [];
118
+ }
119
+ return parsed.ids.filter((id) => typeof id === "string" && id.length > 0);
120
+ }
121
+ catch {
122
+ return [];
123
+ }
124
+ }
125
+ async function writePendingQueueIds(pmRoot, ids) {
126
+ await writeFileAtomic(pendingQueuePath(pmRoot), `${JSON.stringify({ ids })}\n`);
127
+ }
128
+ /** Merge mutated item ids into the persistent pending-refresh queue. */
129
+ export async function enqueuePendingRefreshIds(pmRoot, itemIds) {
130
+ const incoming = itemIds.filter((id) => typeof id === "string" && id.trim().length > 0);
131
+ if (incoming.length === 0) {
132
+ return;
133
+ }
134
+ const mergeIncoming = async () => {
135
+ const existing = await readPendingQueueIds(pmRoot);
136
+ const merged = [...new Set([...existing, ...incoming])].sort((left, right) => left.localeCompare(right));
137
+ await writePendingQueueIds(pmRoot, merged);
138
+ };
139
+ const gated = await withQueueGate(pmRoot, async () => {
140
+ await mergeIncoming();
141
+ return true;
142
+ }, false);
143
+ if (!gated) {
144
+ // The gate stayed contended past the retry budget. Never silently drop a
145
+ // mutation's refresh work: fall back to a best-effort unguarded merge.
146
+ // writeFileAtomic keeps the file valid; the only risk is losing a concurrent
147
+ // writer's delta, which its own next dispatch and the vector_index_stale
148
+ // warning both recover.
149
+ await mergeIncoming();
150
+ }
151
+ }
152
+ /** Atomically read and clear the pending-refresh queue, returning drained ids. */
153
+ export async function drainPendingRefreshIds(pmRoot) {
154
+ return withQueueGate(pmRoot, async () => {
155
+ const ids = await readPendingQueueIds(pmRoot);
156
+ if (ids.length > 0) {
157
+ await writePendingQueueIds(pmRoot, []);
158
+ }
159
+ return ids;
160
+ }, []);
161
+ }
162
+ function searchRefreshRunnerPath() {
163
+ return path.join(resolvePmPackageRootFromModule(import.meta.url, ["../../.."]), "dist", "cli", "search-refresh.js");
164
+ }
165
+ /**
166
+ * Spawn the detached refresh worker child for this pm root. Best effort: a
167
+ * failed dispatch must never keep the CLI alive or fail a mutation; the next
168
+ * mutation re-dispatches and `vector_index_stale` warns about the catch-up
169
+ * window in the meantime.
170
+ */
171
+ function dispatchRefreshChild(pmRoot) {
172
+ try {
173
+ const child = spawn(process.execPath, [searchRefreshRunnerPath()], {
174
+ detached: true,
175
+ stdio: "ignore",
176
+ env: {
177
+ ...process.env,
178
+ PM_PATH: pmRoot,
179
+ [SEARCH_REFRESH_CHILD_ENV]: "1",
180
+ },
181
+ });
182
+ // A detached child can emit an async 'error' event (e.g. spawn EAGAIN/ENOENT,
183
+ // resource limits). Swallow it so it never becomes an unhandled error that
184
+ // crashes the parent CLI; dispatch is best effort.
185
+ child.on("error", () => { });
186
+ child.unref();
187
+ }
188
+ catch {
189
+ // Best effort — see doc comment above.
190
+ }
191
+ }
192
+ /**
193
+ * Enqueue mutated ids and dispatch a detached worker child to refresh semantic
194
+ * embeddings without blocking the mutation. The reindex lock the worker acquires
195
+ * serializes concurrent refreshes, so the spawn itself stays unconditional and
196
+ * cheap; a worker that loses the lock exits and its ids are drained by the holder.
197
+ */
198
+ export async function scheduleBackgroundSemanticRefresh(pmRoot, itemIds) {
199
+ await enqueuePendingRefreshIds(pmRoot, itemIds);
200
+ dispatchRefreshChild(pmRoot);
201
+ }
202
+ /**
203
+ * Drain the pending queue and refresh semantic vectors under the reindex lock so
204
+ * the local vector store is never rewritten concurrently. If the lock is held by
205
+ * another worker we exit immediately — that holder drains our enqueued ids. After
206
+ * releasing we re-check the queue once and re-dispatch if a sibling enqueued ids
207
+ * during our final window, guaranteeing eventual processing.
208
+ */
209
+ export async function runSemanticRefreshWorker(pmRoot, refresh) {
210
+ const warnings = [];
211
+ const processed = [];
212
+ if (!(await pathExists(pmRoot))) {
213
+ return { processed, rounds: 0, warnings };
214
+ }
215
+ let settings;
216
+ try {
217
+ settings = resolveSettingsWithSemanticRuntimeDefaults(await readSettings(pmRoot)).settings;
218
+ }
219
+ catch (error) {
220
+ return { processed, rounds: 0, warnings: [`search_background_refresh_settings_read_failed:${toErrorMessage(error)}`] };
221
+ }
222
+ // Retry the reindex lock with backoff rather than exiting on the first
223
+ // conflict: a sibling refresh worker holds it only briefly (~one embed), so a
224
+ // few retries pick up the queued ids in this run instead of stranding them
225
+ // until the next mutation. If a long `pm reindex` keeps it, we give up — that
226
+ // full pass re-embeds everything anyway and the next dispatch retries.
227
+ let release = null;
228
+ for (let attempt = 0; attempt < LOCK_ACQUIRE_ATTEMPTS && !release; attempt += 1) {
229
+ try {
230
+ release = await acquireLock(pmRoot, REINDEX_LOCK_ID, settings.locks.ttl_seconds, process.env.PM_AUTHOR ?? "pm-search-refresh", false, settings.governance.force_required_for_stale_lock);
231
+ }
232
+ catch {
233
+ if (attempt < LOCK_ACQUIRE_ATTEMPTS - 1) {
234
+ await delay(LOCK_ACQUIRE_BACKOFF_MS);
235
+ }
236
+ }
237
+ }
238
+ if (!release) {
239
+ return { processed, rounds: 0, warnings };
240
+ }
241
+ let rounds = 0;
242
+ let failed = false;
243
+ try {
244
+ for (;;) {
245
+ const ids = await drainPendingRefreshIds(pmRoot);
246
+ if (ids.length === 0) {
247
+ break;
248
+ }
249
+ rounds += 1;
250
+ try {
251
+ const result = await refresh(pmRoot, ids);
252
+ processed.push(...result.refreshed);
253
+ warnings.push(...result.warnings);
254
+ }
255
+ catch (error) {
256
+ warnings.push(`search_background_refresh_failed:${toErrorMessage(error)}`);
257
+ // Re-enqueue so the work is retried by a later dispatch rather than lost.
258
+ await enqueuePendingRefreshIds(pmRoot, ids);
259
+ failed = true;
260
+ break;
261
+ }
262
+ }
263
+ }
264
+ finally {
265
+ await release?.();
266
+ }
267
+ // Close the race where a sibling enqueued ids between our last empty drain and
268
+ // releasing the lock: re-dispatch so those ids are eventually processed. Skip
269
+ // this after a refresh failure — the failed ids were re-enqueued and an
270
+ // immediate respawn would just fail again, spinning indefinitely. They wait
271
+ // for the next mutation's dispatch instead.
272
+ const remaining = failed ? [] : await readPendingQueueIds(pmRoot);
273
+ if (remaining.length > 0) {
274
+ dispatchRefreshChild(pmRoot);
275
+ }
276
+ return { processed: [...new Set(processed)].sort((a, b) => a.localeCompare(b)), rounds, warnings };
277
+ }
278
+ // Expose internals for focused tests without widening the production surface
279
+ // used by the mutation hot path.
280
+ export const _backgroundRefreshInternals = {
281
+ pendingQueuePath,
282
+ acquireQueueGate,
283
+ releaseQueueGate,
284
+ };
285
+ //# sourceMappingURL=background-refresh.js.map
286
+ //# debugId=d8990236-9b78-570d-bafa-5da0ce621293
@@ -0,0 +1 @@
1
+ {"version":3,"file":"background-refresh.js","sources":["core/search/background-refresh.ts"],"sourceRoot":"/","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { mkdirSync, rmSync, statSync } from \"node:fs\";\nimport path from \"node:path\";\n\nimport { pathExists, readFileIfExists, writeFileAtomic } from \"../fs/fs-utils.js\";\nimport { acquireLock } from \"../lock/lock.js\";\nimport { resolvePmPackageRootFromModule } from \"../packages/root.js\";\nimport { readSettings } from \"../store/settings.js\";\nimport { toErrorMessage } from \"../shared/primitives.js\";\nimport { resolveSettingsWithSemanticRuntimeDefaults } from \"./semantic-defaults.js\";\n\n/**\n * Shared lock id for any process that rewrites the local vector store. Reindex\n * and the background mutation-refresh worker both acquire this so they never\n * write concurrently and corrupt the store. Exported so `pm reindex` reuses the\n * same id rather than duplicating the literal.\n */\nexport const REINDEX_LOCK_ID = \"reindex\";\n\nconst PENDING_QUEUE_REL_PATH = \"search/pending-refresh.json\";\nconst PENDING_QUEUE_GATE_REL_PATH = \"search/pending-refresh.gate.lock\";\nconst PENDING_QUEUE_GATE_STALE_MS = 30_000;\n\n// Bounded reindex-lock retry for the background worker (~3.2s worst case).\nconst LOCK_ACQUIRE_ATTEMPTS = 8;\nconst LOCK_ACQUIRE_BACKOFF_MS = 400;\n\nconst SEARCH_REFRESH_INLINE_ENV = \"PM_SEARCH_REFRESH_INLINE\";\nconst SEARCH_REFRESH_CHILD_ENV = \"PM_SEARCH_REFRESH_CHILD\";\n\nfunction parseBooleanTrueLike(value: string | undefined): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n const normalized = value.trim().toLowerCase();\n return normalized === \"1\" || normalized === \"true\" || normalized === \"yes\" || normalized === \"on\";\n}\n\n/**\n * Mutation search refresh runs inline (blocking) under test runners, inside the\n * background worker child itself, or when explicitly requested. Otherwise the\n * semantic refresh is dispatched to a detached child so mutations return without\n * waiting on embeddings. Mirrors the telemetry-flush inline gate so the full test\n * suite stays deterministic.\n */\nexport function shouldRunSearchRefreshInForeground(): boolean {\n if (parseBooleanTrueLike(process.env[SEARCH_REFRESH_INLINE_ENV])) {\n return true;\n }\n if (parseBooleanTrueLike(process.env[SEARCH_REFRESH_CHILD_ENV])) {\n return true;\n }\n const nodeEnv = (process.env.NODE_ENV ?? \"\").trim().toLowerCase();\n return (\n typeof process.env.VITEST === \"string\" ||\n typeof process.env.VITEST_WORKER_ID === \"string\" ||\n nodeEnv === \"test\"\n );\n}\n\nfunction pendingQueuePath(pmRoot: string): string {\n return path.join(pmRoot, PENDING_QUEUE_REL_PATH);\n}\n\nfunction pendingQueueGatePath(pmRoot: string): string {\n return path.join(pmRoot, PENDING_QUEUE_GATE_REL_PATH);\n}\n\nfunction acquireQueueGate(pmRoot: string): boolean {\n const gatePath = pendingQueueGatePath(pmRoot);\n try {\n if (Date.now() - statSync(gatePath).mtimeMs < PENDING_QUEUE_GATE_STALE_MS) {\n return false;\n }\n rmSync(gatePath, { recursive: true, force: true });\n } catch {\n // Missing gate is the common case; fall through to create it.\n }\n try {\n mkdirSync(path.dirname(gatePath), { recursive: true });\n mkdirSync(gatePath);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction releaseQueueGate(pmRoot: string): void {\n try {\n rmSync(pendingQueueGatePath(pmRoot), { recursive: true, force: true });\n } catch {\n // Best effort; a stale gate self-heals after PENDING_QUEUE_GATE_STALE_MS.\n }\n}\n\nasync function withQueueGate<T>(pmRoot: string, fn: () => Promise<T>, fallback: T): Promise<T> {\n // Briefly serialize read-modify-write access to the pending queue across the\n // mutation process and the worker child. Acquisition is best effort; if a\n // healthy gate is held we skip rather than risk a torn queue.\n for (let attempt = 0; attempt < 50; attempt += 1) {\n if (acquireQueueGate(pmRoot)) {\n try {\n return await fn();\n } finally {\n releaseQueueGate(pmRoot);\n }\n }\n await delay(20);\n }\n return fallback;\n}\n\nfunction delay(ms: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(resolve, ms).unref?.();\n });\n}\n\nasync function readPendingQueueIds(pmRoot: string): Promise<string[]> {\n const raw = await readFileIfExists(pendingQueuePath(pmRoot));\n if (!raw || raw.trim().length === 0) {\n return [];\n }\n try {\n const parsed = JSON.parse(raw) as { ids?: unknown };\n if (!Array.isArray(parsed.ids)) {\n return [];\n }\n return parsed.ids.filter((id): id is string => typeof id === \"string\" && id.length > 0);\n } catch {\n return [];\n }\n}\n\nasync function writePendingQueueIds(pmRoot: string, ids: string[]): Promise<void> {\n await writeFileAtomic(pendingQueuePath(pmRoot), `${JSON.stringify({ ids })}\\n`);\n}\n\n/** Merge mutated item ids into the persistent pending-refresh queue. */\nexport async function enqueuePendingRefreshIds(pmRoot: string, itemIds: string[]): Promise<void> {\n const incoming = itemIds.filter((id) => typeof id === \"string\" && id.trim().length > 0);\n if (incoming.length === 0) {\n return;\n }\n const mergeIncoming = async (): Promise<void> => {\n const existing = await readPendingQueueIds(pmRoot);\n const merged = [...new Set([...existing, ...incoming])].sort((left, right) => left.localeCompare(right));\n await writePendingQueueIds(pmRoot, merged);\n };\n const gated = await withQueueGate(\n pmRoot,\n async () => {\n await mergeIncoming();\n return true;\n },\n false,\n );\n if (!gated) {\n // The gate stayed contended past the retry budget. Never silently drop a\n // mutation's refresh work: fall back to a best-effort unguarded merge.\n // writeFileAtomic keeps the file valid; the only risk is losing a concurrent\n // writer's delta, which its own next dispatch and the vector_index_stale\n // warning both recover.\n await mergeIncoming();\n }\n}\n\n/** Atomically read and clear the pending-refresh queue, returning drained ids. */\nexport async function drainPendingRefreshIds(pmRoot: string): Promise<string[]> {\n return withQueueGate(\n pmRoot,\n async () => {\n const ids = await readPendingQueueIds(pmRoot);\n if (ids.length > 0) {\n await writePendingQueueIds(pmRoot, []);\n }\n return ids;\n },\n [],\n );\n}\n\nfunction searchRefreshRunnerPath(): string {\n return path.join(\n resolvePmPackageRootFromModule(import.meta.url, [\"../../..\"]),\n \"dist\",\n \"cli\",\n \"search-refresh.js\",\n );\n}\n\n/**\n * Spawn the detached refresh worker child for this pm root. Best effort: a\n * failed dispatch must never keep the CLI alive or fail a mutation; the next\n * mutation re-dispatches and `vector_index_stale` warns about the catch-up\n * window in the meantime.\n */\nfunction dispatchRefreshChild(pmRoot: string): void {\n try {\n const child = spawn(process.execPath, [searchRefreshRunnerPath()], {\n detached: true,\n stdio: \"ignore\",\n env: {\n ...process.env,\n PM_PATH: pmRoot,\n [SEARCH_REFRESH_CHILD_ENV]: \"1\",\n },\n });\n // A detached child can emit an async 'error' event (e.g. spawn EAGAIN/ENOENT,\n // resource limits). Swallow it so it never becomes an unhandled error that\n // crashes the parent CLI; dispatch is best effort.\n child.on(\"error\", () => {});\n child.unref();\n } catch {\n // Best effort — see doc comment above.\n }\n}\n\n/**\n * Enqueue mutated ids and dispatch a detached worker child to refresh semantic\n * embeddings without blocking the mutation. The reindex lock the worker acquires\n * serializes concurrent refreshes, so the spawn itself stays unconditional and\n * cheap; a worker that loses the lock exits and its ids are drained by the holder.\n */\nexport async function scheduleBackgroundSemanticRefresh(pmRoot: string, itemIds: string[]): Promise<void> {\n await enqueuePendingRefreshIds(pmRoot, itemIds);\n dispatchRefreshChild(pmRoot);\n}\n\nexport interface SemanticRefreshWorkerResult {\n processed: string[];\n rounds: number;\n warnings: string[];\n}\n\ntype SemanticRefreshFn = (\n pmRoot: string,\n itemIds: string[],\n) => Promise<{ refreshed: string[]; skipped: string[]; warnings: string[] }>;\n\n/**\n * Drain the pending queue and refresh semantic vectors under the reindex lock so\n * the local vector store is never rewritten concurrently. If the lock is held by\n * another worker we exit immediately — that holder drains our enqueued ids. After\n * releasing we re-check the queue once and re-dispatch if a sibling enqueued ids\n * during our final window, guaranteeing eventual processing.\n */\nexport async function runSemanticRefreshWorker(\n pmRoot: string,\n refresh: SemanticRefreshFn,\n): Promise<SemanticRefreshWorkerResult> {\n const warnings: string[] = [];\n const processed: string[] = [];\n if (!(await pathExists(pmRoot))) {\n return { processed, rounds: 0, warnings };\n }\n\n let settings: Awaited<ReturnType<typeof readSettings>>;\n try {\n settings = resolveSettingsWithSemanticRuntimeDefaults(await readSettings(pmRoot)).settings;\n } catch (error: unknown) {\n return { processed, rounds: 0, warnings: [`search_background_refresh_settings_read_failed:${toErrorMessage(error)}`] };\n }\n\n // Retry the reindex lock with backoff rather than exiting on the first\n // conflict: a sibling refresh worker holds it only briefly (~one embed), so a\n // few retries pick up the queued ids in this run instead of stranding them\n // until the next mutation. If a long `pm reindex` keeps it, we give up — that\n // full pass re-embeds everything anyway and the next dispatch retries.\n let release: (() => Promise<void>) | null = null;\n for (let attempt = 0; attempt < LOCK_ACQUIRE_ATTEMPTS && !release; attempt += 1) {\n try {\n release = await acquireLock(\n pmRoot,\n REINDEX_LOCK_ID,\n settings.locks.ttl_seconds,\n process.env.PM_AUTHOR ?? \"pm-search-refresh\",\n false,\n settings.governance.force_required_for_stale_lock,\n );\n } catch {\n if (attempt < LOCK_ACQUIRE_ATTEMPTS - 1) {\n await delay(LOCK_ACQUIRE_BACKOFF_MS);\n }\n }\n }\n if (!release) {\n return { processed, rounds: 0, warnings };\n }\n\n let rounds = 0;\n let failed = false;\n try {\n for (;;) {\n const ids = await drainPendingRefreshIds(pmRoot);\n if (ids.length === 0) {\n break;\n }\n rounds += 1;\n try {\n const result = await refresh(pmRoot, ids);\n processed.push(...result.refreshed);\n warnings.push(...result.warnings);\n } catch (error: unknown) {\n warnings.push(`search_background_refresh_failed:${toErrorMessage(error)}`);\n // Re-enqueue so the work is retried by a later dispatch rather than lost.\n await enqueuePendingRefreshIds(pmRoot, ids);\n failed = true;\n break;\n }\n }\n } finally {\n await release?.();\n }\n\n // Close the race where a sibling enqueued ids between our last empty drain and\n // releasing the lock: re-dispatch so those ids are eventually processed. Skip\n // this after a refresh failure — the failed ids were re-enqueued and an\n // immediate respawn would just fail again, spinning indefinitely. They wait\n // for the next mutation's dispatch instead.\n const remaining = failed ? [] : await readPendingQueueIds(pmRoot);\n if (remaining.length > 0) {\n dispatchRefreshChild(pmRoot);\n }\n\n return { processed: [...new Set(processed)].sort((a, b) => a.localeCompare(b)), rounds, warnings };\n}\n\n// Expose internals for focused tests without widening the production surface\n// used by the mutation hot path.\nexport const _backgroundRefreshInternals = {\n pendingQueuePath,\n acquireQueueGate,\n releaseQueueGate,\n};\n"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,0CAA0C,EAAE,MAAM,wBAAwB,CAAC;AAEpF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC;AAEzC,MAAM,sBAAsB,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