@unbrained/pm-cli 2026.6.19 → 2026.6.20

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 (517) hide show
  1. package/CHANGELOG.md +311 -258
  2. package/README.md +1 -1
  3. package/dist/cli/bootstrap-args.d.ts +12 -1
  4. package/dist/cli/bootstrap-args.js +20 -9
  5. package/dist/cli/bootstrap-args.js.map +1 -1
  6. package/dist/cli/commander-usage.js +31 -25
  7. package/dist/cli/commander-usage.js.map +1 -1
  8. package/dist/cli/commands/completion.js +3 -3
  9. package/dist/cli/commands/completion.js.map +1 -1
  10. package/dist/cli/commands/contracts.js +4 -3
  11. package/dist/cli/commands/contracts.js.map +1 -1
  12. package/dist/cli/commands/eval.d.ts +62 -0
  13. package/dist/cli/commands/eval.js +158 -0
  14. package/dist/cli/commands/eval.js.map +1 -0
  15. package/dist/cli/commands/extension/install-sources.d.ts +12 -0
  16. package/dist/cli/commands/extension/install-sources.js +77 -10
  17. package/dist/cli/commands/extension/install-sources.js.map +1 -1
  18. package/dist/cli/commands/gc.d.ts +12 -1
  19. package/dist/cli/commands/gc.js +53 -6
  20. package/dist/cli/commands/gc.js.map +1 -1
  21. package/dist/cli/commands/health.js +14 -8
  22. package/dist/cli/commands/health.js.map +1 -1
  23. package/dist/cli/commands/index.d.ts +1 -0
  24. package/dist/cli/commands/index.js +3 -2
  25. package/dist/cli/commands/index.js.map +1 -1
  26. package/dist/cli/commands/linked-artifacts.js +13 -3
  27. package/dist/cli/commands/linked-artifacts.js.map +1 -1
  28. package/dist/cli/commands/list.js +12 -9
  29. package/dist/cli/commands/list.js.map +1 -1
  30. package/dist/cli/commands/plan.js +2 -2
  31. package/dist/cli/commands/plan.js.map +1 -1
  32. package/dist/cli/commands/restore.js +5 -11
  33. package/dist/cli/commands/restore.js.map +1 -1
  34. package/dist/cli/commands/search.d.ts +39 -1
  35. package/dist/cli/commands/search.js +89 -12
  36. package/dist/cli/commands/search.js.map +1 -1
  37. package/dist/cli/commands/update.js +96 -58
  38. package/dist/cli/commands/update.js.map +1 -1
  39. package/dist/cli/extension-command-help.d.ts +9 -0
  40. package/dist/cli/extension-command-help.js +13 -2
  41. package/dist/cli/extension-command-help.js.map +1 -1
  42. package/dist/cli/extension-command-options.d.ts +8 -0
  43. package/dist/cli/extension-command-options.js +27 -2
  44. package/dist/cli/extension-command-options.js.map +1 -1
  45. package/dist/cli/help-content.js +15 -2
  46. package/dist/cli/help-content.js.map +1 -1
  47. package/dist/cli/main.d.ts +12 -0
  48. package/dist/cli/main.js +49 -9
  49. package/dist/cli/main.js.map +1 -1
  50. package/dist/cli/register-list-query.js +34 -4
  51. package/dist/cli/register-list-query.js.map +1 -1
  52. package/dist/cli/register-operations.js +3 -3
  53. package/dist/cli/register-operations.js.map +1 -1
  54. package/dist/cli-bundle/chunks/activity-7G7NNNZQ.js +18 -0
  55. package/dist/cli-bundle/chunks/{activity-XJ7WRNWS.js → activity-KEEITOTB.js} +11 -11
  56. package/dist/cli-bundle/chunks/{aggregate-OFT4YVB6.js → aggregate-5BTHOHW2.js} +10 -10
  57. package/dist/cli-bundle/chunks/{aggregate-LBCWF6UJ.js → aggregate-GB2LJNTZ.js} +10 -10
  58. package/dist/cli-bundle/chunks/{append-BP2ARHOK.js → append-BBM4MNVD.js} +8 -8
  59. package/dist/cli-bundle/chunks/{append-5U3XR5SD.js → append-BFV5UYWS.js} +8 -8
  60. package/dist/cli-bundle/chunks/{chunk-ZZEM2PH7.js → chunk-26OQTCGH.js} +19 -14
  61. package/dist/cli-bundle/chunks/chunk-26OQTCGH.js.map +1 -0
  62. package/dist/cli-bundle/chunks/{chunk-RVG3WLY3.js → chunk-2LUNPA3U.js} +2 -2
  63. package/dist/cli-bundle/chunks/{chunk-OURX4WVG.js → chunk-2QJLN4KM.js} +7 -7
  64. package/dist/cli-bundle/chunks/{search-2JX776KX.js → chunk-2ZY5SLNR.js} +184 -23
  65. package/dist/cli-bundle/chunks/chunk-2ZY5SLNR.js.map +1 -0
  66. package/dist/cli-bundle/chunks/{chunk-AVMSP2HH.js → chunk-3KVCMB2M.js} +2 -2
  67. package/dist/cli-bundle/chunks/{chunk-FVZSUIN5.js → chunk-3WAKNI2W.js} +3 -3
  68. package/dist/cli-bundle/chunks/{chunk-H3DP6OUM.js → chunk-4KFL5OYK.js} +3 -3
  69. package/dist/cli-bundle/chunks/{chunk-VG3B2CYD.js → chunk-4PW4C3ZB.js} +2 -2
  70. package/dist/cli-bundle/chunks/{chunk-SDUZTZ55.js → chunk-4S4INK3B.js} +7 -7
  71. package/dist/cli-bundle/chunks/{chunk-QCHNPN24.js → chunk-4YMX7XFI.js} +7 -5
  72. package/dist/cli-bundle/chunks/{chunk-QSH34DSQ.js → chunk-5MWA46UN.js} +3 -3
  73. package/dist/cli-bundle/chunks/{chunk-UIMLAFOE.js → chunk-5XK2RYJR.js} +7 -7
  74. package/dist/cli-bundle/chunks/{chunk-B2NEFANY.js → chunk-6DZO5NN7.js} +3 -3
  75. package/dist/cli-bundle/chunks/{chunk-VP4Z36GO.js → chunk-6FSPWUBI.js} +2 -2
  76. package/dist/cli-bundle/chunks/{chunk-MPEWACTG.js → chunk-6KARQMC6.js} +2 -2
  77. package/dist/cli-bundle/chunks/{chunk-N7LDJRB4.js → chunk-6KSFULO6.js} +2 -2
  78. package/dist/cli-bundle/chunks/{chunk-XV6N3QND.js → chunk-6LTSLEHD.js} +2 -2
  79. package/dist/cli-bundle/chunks/{chunk-X26ODPU4.js → chunk-6Y7IQ6XN.js} +14 -18
  80. package/dist/cli-bundle/chunks/chunk-6Y7IQ6XN.js.map +7 -0
  81. package/dist/cli-bundle/chunks/{chunk-USKTNI7P.js → chunk-7MMXBIRZ.js} +2 -2
  82. package/dist/cli-bundle/chunks/{chunk-UCNEPMPY.js → chunk-ACULWT7G.js} +105 -66
  83. package/dist/cli-bundle/chunks/chunk-ACULWT7G.js.map +7 -0
  84. package/dist/cli-bundle/chunks/{chunk-2K56AWDP.js → chunk-AOCYDQLT.js} +5 -5
  85. package/dist/cli-bundle/chunks/{chunk-ZBVYKWT2.js → chunk-ATRXPXAL.js} +15 -15
  86. package/dist/cli-bundle/chunks/{chunk-A5JPMD4Q.js → chunk-AW4PYYNF.js} +2 -2
  87. package/dist/cli-bundle/chunks/{chunk-I2VJM36R.js → chunk-AZ75OVK4.js} +20 -21
  88. package/dist/cli-bundle/chunks/chunk-AZ75OVK4.js.map +1 -0
  89. package/dist/cli-bundle/chunks/{chunk-MTGMNUMJ.js → chunk-B3LROPTV.js} +2 -2
  90. package/dist/cli-bundle/chunks/{chunk-NPNNW5TU.js → chunk-BBSUVIIT.js} +8 -8
  91. package/dist/cli-bundle/chunks/{chunk-47BYN6CA.js → chunk-BYNJWB5F.js} +7 -7
  92. package/dist/cli-bundle/chunks/{chunk-PSWSQHM7.js → chunk-BZWIDTDE.js} +15 -19
  93. package/dist/cli-bundle/chunks/chunk-BZWIDTDE.js.map +1 -0
  94. package/dist/cli-bundle/chunks/{chunk-S673PVHD.js → chunk-CNPWCUDR.js} +3 -3
  95. package/dist/cli-bundle/chunks/{chunk-TYQBGXH2.js → chunk-DKWIPIJY.js} +2 -2
  96. package/dist/cli-bundle/chunks/{search-AZR2JITW.js → chunk-DYOJJTCG.js} +190 -22
  97. package/dist/cli-bundle/chunks/chunk-DYOJJTCG.js.map +7 -0
  98. package/dist/cli-bundle/chunks/{chunk-Y4IBSEQ2.js → chunk-E4E7UQBT.js} +20 -8
  99. package/dist/cli-bundle/chunks/chunk-E4E7UQBT.js.map +1 -0
  100. package/dist/cli-bundle/chunks/{chunk-HMQMRHQJ.js → chunk-EKMHDL6Z.js} +8 -8
  101. package/dist/cli-bundle/chunks/{chunk-LIVRA6VG.js → chunk-EOFROIC5.js} +7 -7
  102. package/dist/cli-bundle/chunks/{chunk-NNMBNN6Q.js → chunk-ETJKPURB.js} +7 -5
  103. package/dist/cli-bundle/chunks/{chunk-2E3KSWFG.js → chunk-F4EYOSNC.js} +2 -2
  104. package/dist/cli-bundle/chunks/{chunk-DJ3YYLHG.js → chunk-FA5O2DEG.js} +5 -5
  105. package/dist/cli-bundle/chunks/{chunk-QTWWHFI3.js → chunk-FBBPCSJM.js} +8 -8
  106. package/dist/cli-bundle/chunks/{chunk-EMFDZ7N3.js → chunk-FSOJCFDS.js} +3 -3
  107. package/dist/cli-bundle/chunks/{chunk-M35R7LFX.js → chunk-FXKPUMIR.js} +5 -5
  108. package/dist/cli-bundle/chunks/{chunk-YOGXK3ON.js → chunk-GF44HVZL.js} +18 -13
  109. package/dist/cli-bundle/chunks/chunk-GF44HVZL.js.map +7 -0
  110. package/dist/cli-bundle/chunks/{chunk-UA4ANRJY.js → chunk-H3ZTSYPA.js} +71 -13
  111. package/dist/cli-bundle/chunks/chunk-H3ZTSYPA.js.map +7 -0
  112. package/dist/cli-bundle/chunks/{chunk-II3WDRCM.js → chunk-HWHZ7EY7.js} +3 -3
  113. package/dist/cli-bundle/chunks/{chunk-7R5YKVKO.js → chunk-ICEWMJYH.js} +7 -7
  114. package/dist/cli-bundle/chunks/{chunk-UMTPQMEG.js → chunk-II4BRHKM.js} +3 -3
  115. package/dist/cli-bundle/chunks/{chunk-GDOTTY2S.js → chunk-IWKD7B33.js} +19 -2
  116. package/dist/cli-bundle/chunks/chunk-IWKD7B33.js.map +7 -0
  117. package/dist/cli-bundle/chunks/{chunk-QG6M6XQE.js → chunk-J7VSEFWB.js} +3 -3
  118. package/dist/cli-bundle/chunks/{chunk-22YA6GCA.js → chunk-K2LBDYDC.js} +2 -2
  119. package/dist/cli-bundle/chunks/{chunk-BQVESTOG.js → chunk-KCJZREBI.js} +2 -2
  120. package/dist/cli-bundle/chunks/{chunk-YWAYOWDQ.js → chunk-LTUB7ARL.js} +72 -14
  121. package/dist/cli-bundle/chunks/chunk-LTUB7ARL.js.map +1 -0
  122. package/dist/cli-bundle/chunks/{chunk-DVUU3AHP.js → chunk-MFCFHL27.js} +17 -6
  123. package/dist/cli-bundle/chunks/chunk-MFCFHL27.js.map +1 -0
  124. package/dist/cli-bundle/chunks/{chunk-5P2LQV2F.js → chunk-MTQK5ZSB.js} +2 -2
  125. package/dist/cli-bundle/chunks/{chunk-LEC57E7K.js → chunk-NCGQ27PK.js} +2 -2
  126. package/dist/cli-bundle/chunks/{chunk-2RI3BDFK.js → chunk-NKTUBA2C.js} +10 -9
  127. package/dist/cli-bundle/chunks/chunk-NKTUBA2C.js.map +7 -0
  128. package/dist/cli-bundle/chunks/{chunk-5LZPDRFW.js → chunk-NMQNXH4U.js} +5 -5
  129. package/dist/cli-bundle/chunks/{chunk-COHNQLB2.js → chunk-OLEP5TJH.js} +20 -3
  130. package/dist/cli-bundle/chunks/chunk-OLEP5TJH.js.map +1 -0
  131. package/dist/cli-bundle/chunks/{chunk-PRUB7RI4.js → chunk-OVSFW4KD.js} +3 -3
  132. package/dist/cli-bundle/chunks/{chunk-4L7Q4OVT.js → chunk-PF5GLFPU.js} +9 -9
  133. package/dist/cli-bundle/chunks/{chunk-YVYJQR6S.js → chunk-QUTJOHGK.js} +9 -9
  134. package/dist/cli-bundle/chunks/{chunk-5QLHQK7V.js → chunk-QWAJPGEI.js} +25 -26
  135. package/dist/cli-bundle/chunks/chunk-QWAJPGEI.js.map +7 -0
  136. package/dist/cli-bundle/chunks/{chunk-K5TD74VU.js → chunk-RADIHKJ3.js} +19 -7
  137. package/dist/cli-bundle/chunks/chunk-RADIHKJ3.js.map +7 -0
  138. package/dist/cli-bundle/chunks/{chunk-CSRFOIHG.js → chunk-RICT5QYR.js} +3 -3
  139. package/dist/cli-bundle/chunks/{chunk-OUG4CL4H.js → chunk-RNKUCHUQ.js} +8 -8
  140. package/dist/cli-bundle/chunks/{chunk-X7RKOJXL.js → chunk-SL233DQD.js} +6 -6
  141. package/dist/cli-bundle/chunks/{chunk-USVOBLGB.js → chunk-U3WTMYBX.js} +2 -2
  142. package/dist/cli-bundle/chunks/{chunk-DYZKSIVX.js → chunk-VE3BUO3R.js} +3 -3
  143. package/dist/cli-bundle/chunks/{chunk-FPQA4ZMA.js → chunk-VONJSFUW.js} +18 -7
  144. package/dist/cli-bundle/chunks/chunk-VONJSFUW.js.map +7 -0
  145. package/dist/cli-bundle/chunks/{chunk-RNWE2HZR.js → chunk-W2ZESOQE.js} +15 -15
  146. package/dist/cli-bundle/chunks/{chunk-4BFNWAMQ.js → chunk-WFOITX4A.js} +29 -12
  147. package/dist/cli-bundle/chunks/chunk-WFOITX4A.js.map +7 -0
  148. package/dist/cli-bundle/chunks/{chunk-FP7YLQ52.js → chunk-WMQBNVZL.js} +11 -10
  149. package/dist/cli-bundle/chunks/chunk-WMQBNVZL.js.map +1 -0
  150. package/dist/cli-bundle/chunks/{chunk-5SRID7DV.js → chunk-X3CD2VUI.js} +29 -12
  151. package/dist/cli-bundle/chunks/chunk-X3CD2VUI.js.map +1 -0
  152. package/dist/cli-bundle/chunks/{chunk-GL3QKIET.js → chunk-XKJDCJEH.js} +6 -6
  153. package/dist/cli-bundle/chunks/{chunk-SO2IOH37.js → chunk-XNQ3YH6N.js} +2 -2
  154. package/dist/cli-bundle/chunks/{chunk-ZGEWEO7B.js → chunk-XXGAWTH5.js} +2 -2
  155. package/dist/cli-bundle/chunks/{chunk-4EOS35RL.js → chunk-YBQF4CAW.js} +3 -3
  156. package/dist/cli-bundle/chunks/{chunk-MTDEEUGV.js → chunk-YT4Z2OVB.js} +3 -3
  157. package/dist/cli-bundle/chunks/{chunk-5NS6TJ2F.js → chunk-ZHCSGIUX.js} +2 -2
  158. package/dist/cli-bundle/chunks/{chunk-MAKOMXVM.js → chunk-ZYG4TR32.js} +106 -67
  159. package/dist/cli-bundle/chunks/chunk-ZYG4TR32.js.map +1 -0
  160. package/dist/cli-bundle/chunks/{claim-2BSYPJTJ.js → claim-G57ZJLZ4.js} +10 -10
  161. package/dist/cli-bundle/chunks/{claim-EZ6JKY5X.js → claim-TRSDQO6L.js} +10 -10
  162. package/dist/cli-bundle/chunks/{close-3TSX6BYF.js → close-4QMUQMON.js} +8 -8
  163. package/dist/cli-bundle/chunks/close-NNZZTZ5V.js +15 -0
  164. package/dist/cli-bundle/chunks/{close-many-B7DBVA46.js → close-many-3UWKJRQK.js} +15 -15
  165. package/dist/cli-bundle/chunks/{close-many-HB4UFCS3.js → close-many-A7U62CRI.js} +15 -15
  166. package/dist/cli-bundle/chunks/{comments-M7PAINZT.js → comments-4EM7XR74.js} +10 -10
  167. package/dist/cli-bundle/chunks/{comments-X7M7XM6I.js → comments-URWDZP2I.js} +10 -10
  168. package/dist/cli-bundle/chunks/{config-YICACPHA.js → config-GRJYZ2O3.js} +30 -10
  169. package/dist/cli-bundle/chunks/config-GRJYZ2O3.js.map +1 -0
  170. package/dist/cli-bundle/chunks/{config-UWF3KRP5.js → config-PSZ5GWAK.js} +29 -9
  171. package/dist/cli-bundle/chunks/config-PSZ5GWAK.js.map +7 -0
  172. package/dist/cli-bundle/chunks/{context-EGUGU4K7.js → context-A46YAV2F.js} +13 -13
  173. package/dist/cli-bundle/chunks/{context-V32ZAPL6.js → context-BCR34RKM.js} +13 -13
  174. package/dist/cli-bundle/chunks/{contracts-7G553BHP.js → contracts-HPT25X4D.js} +10 -8
  175. package/dist/cli-bundle/chunks/contracts-HPT25X4D.js.map +1 -0
  176. package/dist/cli-bundle/chunks/{contracts-B2YWYUV5.js → contracts-JOPCQNDP.js} +10 -8
  177. package/dist/cli-bundle/chunks/contracts-JOPCQNDP.js.map +7 -0
  178. package/dist/cli-bundle/chunks/{copy-RMLXLZOL.js → copy-KBTIUW7L.js} +7 -7
  179. package/dist/cli-bundle/chunks/{copy-NWFFRYWM.js → copy-X7V6AEDB.js} +7 -7
  180. package/dist/cli-bundle/chunks/create-4KOAQ6ME.js +30 -0
  181. package/dist/cli-bundle/chunks/{create-GK4MX2LJ.js → create-ZPZKJDFQ.js} +14 -14
  182. package/dist/cli-bundle/chunks/{delete-EFQLVEAS.js → delete-2ZI6CJZM.js} +7 -7
  183. package/dist/cli-bundle/chunks/{delete-RMGNIL2S.js → delete-FGKVPUQZ.js} +7 -7
  184. package/dist/cli-bundle/chunks/{deps-WKHUPVD3.js → deps-IUJOBF2H.js} +7 -7
  185. package/dist/cli-bundle/chunks/{deps-K2I7QV4Y.js → deps-SJCEFU3C.js} +7 -7
  186. package/dist/cli-bundle/chunks/{docs-2H2UGIT6.js → docs-2LXF5SVC.js} +12 -11
  187. package/dist/cli-bundle/chunks/{docs-2H2UGIT6.js.map → docs-2LXF5SVC.js.map} +1 -1
  188. package/dist/cli-bundle/chunks/{docs-3FXRDYA7.js → docs-UWJ75CKR.js} +10 -9
  189. package/dist/cli-bundle/chunks/{docs-3FXRDYA7.js.map → docs-UWJ75CKR.js.map} +1 -1
  190. package/dist/cli-bundle/chunks/eval-FRIDCTM2.js +276 -0
  191. package/dist/cli-bundle/chunks/eval-FRIDCTM2.js.map +1 -0
  192. package/dist/cli-bundle/chunks/eval-ZTT3F3SL.js +286 -0
  193. package/dist/cli-bundle/chunks/eval-ZTT3F3SL.js.map +7 -0
  194. package/dist/cli-bundle/chunks/{extension-4LPTFTV4.js → extension-VRYTNNSV.js} +5 -5
  195. package/dist/cli-bundle/chunks/{extension-ASUPTDCC.js → extension-XFQG3BXL.js} +5 -5
  196. package/dist/cli-bundle/chunks/{files-UAZFB3EA.js → files-AJOGTTAN.js} +10 -9
  197. package/dist/cli-bundle/chunks/{files-UAZFB3EA.js.map → files-AJOGTTAN.js.map} +1 -1
  198. package/dist/cli-bundle/chunks/{files-TXEQOA7C.js → files-B2RUCA32.js} +12 -11
  199. package/dist/cli-bundle/chunks/{files-TXEQOA7C.js.map → files-B2RUCA32.js.map} +1 -1
  200. package/dist/cli-bundle/chunks/{focus-UGROAMAX.js → focus-7N36RIMT.js} +8 -8
  201. package/dist/cli-bundle/chunks/{focus-ELOPN2SR.js → focus-CFE33IYC.js} +8 -8
  202. package/dist/cli-bundle/chunks/gc-OYJK4YBY.js +395 -0
  203. package/dist/cli-bundle/chunks/gc-OYJK4YBY.js.map +7 -0
  204. package/dist/cli-bundle/chunks/gc-SBF2FGHK.js +385 -0
  205. package/dist/cli-bundle/chunks/gc-SBF2FGHK.js.map +1 -0
  206. package/dist/cli-bundle/chunks/{get-OTXPLWYW.js → get-577VLZZ7.js} +11 -11
  207. package/dist/cli-bundle/chunks/{get-IWZ7IMPS.js → get-LLFWSPXW.js} +11 -11
  208. package/dist/cli-bundle/chunks/{health-PPTJ7XKW.js → health-C2PUT6JZ.js} +21 -22
  209. package/dist/cli-bundle/chunks/{health-PPTJ7XKW.js.map → health-C2PUT6JZ.js.map} +1 -1
  210. package/dist/cli-bundle/chunks/{health-JEBESKID.js → health-PBJS7W2T.js} +20 -21
  211. package/dist/cli-bundle/chunks/{health-JEBESKID.js.map → health-PBJS7W2T.js.map} +2 -2
  212. package/dist/cli-bundle/chunks/{history-HNWBUDMI.js → history-4FJK6Y3O.js} +10 -10
  213. package/dist/cli-bundle/chunks/history-ZXNWG6H4.js +20 -0
  214. package/dist/cli-bundle/chunks/{history-compact-EQXVPK3V.js → history-compact-AXR6R6GU.js} +12 -12
  215. package/dist/cli-bundle/chunks/{history-compact-MMQC7MCW.js → history-compact-HXF3OT7G.js} +12 -12
  216. package/dist/cli-bundle/chunks/history-redact-GV633Z4H.js +21 -0
  217. package/dist/cli-bundle/chunks/{history-redact-UBDHBEJE.js → history-redact-UMPD4G3K.js} +11 -11
  218. package/dist/cli-bundle/chunks/{history-repair-GMMHFAGH.js → history-repair-WHOK2ICG.js} +12 -12
  219. package/dist/cli-bundle/chunks/{history-repair-7DSDRPMX.js → history-repair-X57HE5EA.js} +12 -12
  220. package/dist/cli-bundle/chunks/init-KQWZSNBX.js +20 -0
  221. package/dist/cli-bundle/chunks/{init-QGK4JFF6.js → init-N7MIIYCU.js} +10 -10
  222. package/dist/cli-bundle/chunks/{learnings-A6DGBMG3.js → learnings-FPG7WAVW.js} +10 -10
  223. package/dist/cli-bundle/chunks/{learnings-DR53TWRA.js → learnings-GZRBIEAN.js} +10 -10
  224. package/dist/cli-bundle/chunks/{list-LJ5DBXC3.js → list-MZBCSKLU.js} +10 -10
  225. package/dist/cli-bundle/chunks/{list-KOJN23UL.js → list-ZDQ2OBSO.js} +10 -10
  226. package/dist/cli-bundle/chunks/{notes-K5I3TAYR.js → notes-LW53PFLH.js} +10 -10
  227. package/dist/cli-bundle/chunks/{notes-7VLTHKPW.js → notes-WQAP67EC.js} +10 -10
  228. package/dist/cli-bundle/chunks/{plan-X3STKLED.js → plan-AVJ4VJQO.js} +15 -15
  229. package/dist/cli-bundle/chunks/plan-AVJ4VJQO.js.map +7 -0
  230. package/dist/cli-bundle/chunks/{plan-BK3OMLGP.js → plan-VZKICKIJ.js} +16 -16
  231. package/dist/cli-bundle/chunks/plan-VZKICKIJ.js.map +1 -0
  232. package/dist/cli-bundle/chunks/{register-list-query-FUMXPWZ4.js → register-list-query-7BD6ZHU5.js} +42 -21
  233. package/dist/cli-bundle/chunks/register-list-query-7BD6ZHU5.js.map +7 -0
  234. package/dist/cli-bundle/chunks/{register-list-query-XDLFESU7.js → register-list-query-CM4SVAQA.js} +43 -22
  235. package/dist/cli-bundle/chunks/register-list-query-CM4SVAQA.js.map +1 -0
  236. package/dist/cli-bundle/chunks/{register-mutation-ZAGVKMBQ.js → register-mutation-ANZIWHUF.js} +33 -33
  237. package/dist/cli-bundle/chunks/{register-mutation-RXRX4P7D.js → register-mutation-PLFHAS4N.js} +33 -33
  238. package/dist/cli-bundle/chunks/{register-operations-DGSHCS75.js → register-operations-KQPQIFF2.js} +35 -35
  239. package/dist/cli-bundle/chunks/register-operations-KQPQIFF2.js.map +1 -0
  240. package/dist/cli-bundle/chunks/{register-operations-6UURPZN5.js → register-operations-VLGCAWIW.js} +34 -34
  241. package/dist/cli-bundle/chunks/{register-operations-6UURPZN5.js.map → register-operations-VLGCAWIW.js.map} +2 -2
  242. package/dist/cli-bundle/chunks/{register-setup-2FEGSFLM.js → register-setup-KPTZ36D4.js} +15 -15
  243. package/dist/cli-bundle/chunks/{register-setup-LTJG52WP.js → register-setup-TMEF6V7O.js} +15 -15
  244. package/dist/cli-bundle/chunks/{restore-SJUWYOCK.js → restore-64JKQV7G.js} +11 -11
  245. package/dist/cli-bundle/chunks/restore-GKM26SAW.js +19 -0
  246. package/dist/cli-bundle/chunks/{scheduling-shortcuts-W4F2LKHW.js → scheduling-shortcuts-4ION7QAX.js} +14 -14
  247. package/dist/cli-bundle/chunks/{scheduling-shortcuts-VWAMP2S2.js → scheduling-shortcuts-X6D6VSZR.js} +14 -14
  248. package/dist/cli-bundle/chunks/{schema-N5ETYD4P.js → schema-OA4RSVMI.js} +9 -9
  249. package/dist/cli-bundle/chunks/{schema-DXQRIEFM.js → schema-TA3NF3RG.js} +9 -9
  250. package/dist/cli-bundle/chunks/search-INCM5I4J.js +33 -0
  251. package/dist/cli-bundle/chunks/search-UAIHEQZL.js +37 -0
  252. package/dist/cli-bundle/chunks/{stats-J563NJBY.js → stats-RHEMG4CE.js} +8 -8
  253. package/dist/cli-bundle/chunks/{stats-ZFESFVQC.js → stats-WQWTIA5Y.js} +8 -8
  254. package/dist/cli-bundle/chunks/{telemetry-BNGLIFEM.js → telemetry-G6UKGKJU.js} +4 -4
  255. package/dist/cli-bundle/chunks/{telemetry-SC7HPRXX.js → telemetry-XA5D2QEO.js} +4 -4
  256. package/dist/cli-bundle/chunks/{test-55RJCGRU.js → test-XF7BYLMZ.js} +15 -15
  257. package/dist/cli-bundle/chunks/{test-47UQGEXE.js → test-ZMQF23P3.js} +15 -15
  258. package/dist/cli-bundle/chunks/{test-all-DN6KG4FX.js → test-all-WUBBJCPU.js} +15 -15
  259. package/dist/cli-bundle/chunks/{test-all-5SFTTRNL.js → test-all-ZNQBMUOI.js} +15 -15
  260. package/dist/cli-bundle/chunks/{test-runs-DZEDJ4GH.js → test-runs-N7LI7HLH.js} +5 -5
  261. package/dist/cli-bundle/chunks/{test-runs-NHRBT7SN.js → test-runs-RFA42EEX.js} +5 -5
  262. package/dist/cli-bundle/chunks/update-CPNOG73P.js +24 -0
  263. package/dist/cli-bundle/chunks/update-CPNOG73P.js.map +7 -0
  264. package/dist/cli-bundle/chunks/update-T5AYT6ZN.js +28 -0
  265. package/dist/cli-bundle/chunks/update-T5AYT6ZN.js.map +1 -0
  266. package/dist/cli-bundle/chunks/{update-many-OKYWFCBO.js → update-many-6XFR7TFG.js} +23 -23
  267. package/dist/cli-bundle/chunks/{update-many-IRNV3OTG.js → update-many-NMRUQZL2.js} +23 -23
  268. package/dist/cli-bundle/chunks/{upgrade-KP4I45V5.js → upgrade-EJTME2YQ.js} +5 -5
  269. package/dist/cli-bundle/chunks/{upgrade-3RIAFQIK.js → upgrade-QMCSONWR.js} +5 -5
  270. package/dist/cli-bundle/chunks/{validate-GVY4VE43.js → validate-3SUCHXXX.js} +21 -21
  271. package/dist/cli-bundle/chunks/{validate-ADKGN37M.js → validate-KIIJY5RC.js} +21 -21
  272. package/dist/cli-bundle/main.js +133 -55
  273. package/dist/cli-bundle/main.js.map +2 -2
  274. package/dist/core/checkpoint/checkpoint-gc.d.ts +69 -0
  275. package/dist/core/checkpoint/checkpoint-gc.js +175 -0
  276. package/dist/core/checkpoint/checkpoint-gc.js.map +1 -0
  277. package/dist/core/config/nested-settings.js +22 -2
  278. package/dist/core/config/nested-settings.js.map +1 -1
  279. package/dist/core/diagnostics/remediation.js +19 -2
  280. package/dist/core/diagnostics/remediation.js.map +1 -1
  281. package/dist/core/extensions/extension-types.d.ts +0 -9
  282. package/dist/core/extensions/extension-types.js +2 -27
  283. package/dist/core/extensions/extension-types.js.map +1 -1
  284. package/dist/core/fs/fs-utils.d.ts +17 -1
  285. package/dist/core/fs/fs-utils.js +19 -3
  286. package/dist/core/fs/fs-utils.js.map +1 -1
  287. package/dist/core/history/drift-scan.d.ts +17 -5
  288. package/dist/core/history/drift-scan.js +22 -14
  289. package/dist/core/history/drift-scan.js.map +1 -1
  290. package/dist/core/history/replay.d.ts +7 -0
  291. package/dist/core/history/replay.js +11 -6
  292. package/dist/core/history/replay.js.map +1 -1
  293. package/dist/core/item/status-filter.d.ts +7 -3
  294. package/dist/core/item/status-filter.js +26 -5
  295. package/dist/core/item/status-filter.js.map +1 -1
  296. package/dist/core/search/bm25.d.ts +113 -0
  297. package/dist/core/search/bm25.js +178 -0
  298. package/dist/core/search/bm25.js.map +1 -0
  299. package/dist/core/search/eval.d.ts +114 -0
  300. package/dist/core/search/eval.js +217 -0
  301. package/dist/core/search/eval.js.map +1 -0
  302. package/dist/core/sentry/instrument.d.ts +14 -0
  303. package/dist/core/sentry/instrument.js +43 -3
  304. package/dist/core/sentry/instrument.js.map +1 -1
  305. package/dist/core/shared/constants.js +5 -2
  306. package/dist/core/shared/constants.js.map +1 -1
  307. package/dist/core/store/paths.js +4 -3
  308. package/dist/core/store/paths.js.map +1 -1
  309. package/dist/core/store/settings-validator.d.ts +7 -0
  310. package/dist/core/store/settings-validator.js +10 -2
  311. package/dist/core/store/settings-validator.js.map +1 -1
  312. package/dist/core/store/settings.js +6 -2
  313. package/dist/core/store/settings.js.map +1 -1
  314. package/dist/mcp/tool-definitions.js +4 -3
  315. package/dist/mcp/tool-definitions.js.map +1 -1
  316. package/dist/sdk/cli-contracts/enum-contracts.d.ts +1 -1
  317. package/dist/sdk/cli-contracts/enum-contracts.js +3 -2
  318. package/dist/sdk/cli-contracts/enum-contracts.js.map +1 -1
  319. package/dist/sdk/cli-contracts/tool-parameter-tables.js +4 -4
  320. package/dist/sdk/cli-contracts/tool-parameter-tables.js.map +1 -1
  321. package/dist/sdk/cli-contracts.d.ts +1 -0
  322. package/dist/sdk/cli-contracts.js +11 -2
  323. package/dist/sdk/cli-contracts.js.map +1 -1
  324. package/dist/types.d.ts +19 -0
  325. package/dist/types.js +2 -2
  326. package/dist/types.js.map +1 -1
  327. package/docs/AGENT_GUIDE.md +1 -0
  328. package/docs/ARCHITECTURE.md +124 -11
  329. package/docs/CLAUDE_CODE_PLUGIN.md +5 -13
  330. package/docs/COMMANDS.md +55 -5
  331. package/docs/CONFIGURATION.md +39 -0
  332. package/docs/EXTENSIONS.md +2 -2
  333. package/docs/MIGRATION_CLI_SIMPLIFICATION.md +9 -2
  334. package/docs/QUICKSTART.md +2 -0
  335. package/docs/README.md +2 -0
  336. package/docs/RELEASING.md +2 -1
  337. package/docs/SDK.md +9 -1
  338. package/docs/TESTING.md +18 -0
  339. package/package.json +4 -3
  340. package/packages/pm-todos/extensions/todos/index.js +2 -0
  341. package/packages/pm-todos/extensions/todos/index.ts +2 -0
  342. package/packages/pm-todos/extensions/todos/runtime.js +1 -1
  343. package/packages/pm-todos/extensions/todos/runtime.ts +4 -1
  344. package/dist/cli-bundle/chunks/activity-62I26XZB.js +0 -18
  345. package/dist/cli-bundle/chunks/chunk-2RI3BDFK.js.map +0 -7
  346. package/dist/cli-bundle/chunks/chunk-4BFNWAMQ.js.map +0 -7
  347. package/dist/cli-bundle/chunks/chunk-5QLHQK7V.js.map +0 -7
  348. package/dist/cli-bundle/chunks/chunk-5SRID7DV.js.map +0 -1
  349. package/dist/cli-bundle/chunks/chunk-COHNQLB2.js.map +0 -1
  350. package/dist/cli-bundle/chunks/chunk-DVUU3AHP.js.map +0 -1
  351. package/dist/cli-bundle/chunks/chunk-FP7YLQ52.js.map +0 -1
  352. package/dist/cli-bundle/chunks/chunk-FPQA4ZMA.js.map +0 -7
  353. package/dist/cli-bundle/chunks/chunk-GDOTTY2S.js.map +0 -7
  354. package/dist/cli-bundle/chunks/chunk-I2VJM36R.js.map +0 -1
  355. package/dist/cli-bundle/chunks/chunk-K5TD74VU.js.map +0 -7
  356. package/dist/cli-bundle/chunks/chunk-MAKOMXVM.js.map +0 -1
  357. package/dist/cli-bundle/chunks/chunk-PSWSQHM7.js.map +0 -1
  358. package/dist/cli-bundle/chunks/chunk-UA4ANRJY.js.map +0 -7
  359. package/dist/cli-bundle/chunks/chunk-UCNEPMPY.js.map +0 -7
  360. package/dist/cli-bundle/chunks/chunk-X26ODPU4.js.map +0 -7
  361. package/dist/cli-bundle/chunks/chunk-Y4IBSEQ2.js.map +0 -1
  362. package/dist/cli-bundle/chunks/chunk-YOGXK3ON.js.map +0 -7
  363. package/dist/cli-bundle/chunks/chunk-YWAYOWDQ.js.map +0 -1
  364. package/dist/cli-bundle/chunks/chunk-ZZEM2PH7.js.map +0 -1
  365. package/dist/cli-bundle/chunks/close-TQZK43Z5.js +0 -15
  366. package/dist/cli-bundle/chunks/config-UWF3KRP5.js.map +0 -7
  367. package/dist/cli-bundle/chunks/config-YICACPHA.js.map +0 -1
  368. package/dist/cli-bundle/chunks/contracts-7G553BHP.js.map +0 -1
  369. package/dist/cli-bundle/chunks/contracts-B2YWYUV5.js.map +0 -7
  370. package/dist/cli-bundle/chunks/create-UZLJXHLA.js +0 -30
  371. package/dist/cli-bundle/chunks/gc-5RTYXLQU.js +0 -211
  372. package/dist/cli-bundle/chunks/gc-5RTYXLQU.js.map +0 -7
  373. package/dist/cli-bundle/chunks/gc-FK5732EK.js +0 -208
  374. package/dist/cli-bundle/chunks/gc-FK5732EK.js.map +0 -1
  375. package/dist/cli-bundle/chunks/history-TKTULEVE.js +0 -20
  376. package/dist/cli-bundle/chunks/history-redact-SPIFIXVY.js +0 -21
  377. package/dist/cli-bundle/chunks/init-A6FTZ5UC.js +0 -20
  378. package/dist/cli-bundle/chunks/plan-BK3OMLGP.js.map +0 -1
  379. package/dist/cli-bundle/chunks/plan-X3STKLED.js.map +0 -7
  380. package/dist/cli-bundle/chunks/register-list-query-FUMXPWZ4.js.map +0 -7
  381. package/dist/cli-bundle/chunks/register-list-query-XDLFESU7.js.map +0 -1
  382. package/dist/cli-bundle/chunks/register-operations-DGSHCS75.js.map +0 -1
  383. package/dist/cli-bundle/chunks/restore-PI3WM4GK.js +0 -19
  384. package/dist/cli-bundle/chunks/search-2JX776KX.js.map +0 -1
  385. package/dist/cli-bundle/chunks/search-AZR2JITW.js.map +0 -7
  386. package/dist/cli-bundle/chunks/update-2BZEAI7B.js +0 -24
  387. package/dist/cli-bundle/chunks/update-GCNLER2H.js +0 -28
  388. /package/dist/cli-bundle/chunks/{activity-62I26XZB.js.map → activity-7G7NNNZQ.js.map} +0 -0
  389. /package/dist/cli-bundle/chunks/{activity-XJ7WRNWS.js.map → activity-KEEITOTB.js.map} +0 -0
  390. /package/dist/cli-bundle/chunks/{aggregate-OFT4YVB6.js.map → aggregate-5BTHOHW2.js.map} +0 -0
  391. /package/dist/cli-bundle/chunks/{aggregate-LBCWF6UJ.js.map → aggregate-GB2LJNTZ.js.map} +0 -0
  392. /package/dist/cli-bundle/chunks/{append-BP2ARHOK.js.map → append-BBM4MNVD.js.map} +0 -0
  393. /package/dist/cli-bundle/chunks/{append-5U3XR5SD.js.map → append-BFV5UYWS.js.map} +0 -0
  394. /package/dist/cli-bundle/chunks/{chunk-RVG3WLY3.js.map → chunk-2LUNPA3U.js.map} +0 -0
  395. /package/dist/cli-bundle/chunks/{chunk-OURX4WVG.js.map → chunk-2QJLN4KM.js.map} +0 -0
  396. /package/dist/cli-bundle/chunks/{chunk-AVMSP2HH.js.map → chunk-3KVCMB2M.js.map} +0 -0
  397. /package/dist/cli-bundle/chunks/{chunk-FVZSUIN5.js.map → chunk-3WAKNI2W.js.map} +0 -0
  398. /package/dist/cli-bundle/chunks/{chunk-H3DP6OUM.js.map → chunk-4KFL5OYK.js.map} +0 -0
  399. /package/dist/cli-bundle/chunks/{chunk-VG3B2CYD.js.map → chunk-4PW4C3ZB.js.map} +0 -0
  400. /package/dist/cli-bundle/chunks/{chunk-SDUZTZ55.js.map → chunk-4S4INK3B.js.map} +0 -0
  401. /package/dist/cli-bundle/chunks/{chunk-QCHNPN24.js.map → chunk-4YMX7XFI.js.map} +0 -0
  402. /package/dist/cli-bundle/chunks/{chunk-QSH34DSQ.js.map → chunk-5MWA46UN.js.map} +0 -0
  403. /package/dist/cli-bundle/chunks/{chunk-UIMLAFOE.js.map → chunk-5XK2RYJR.js.map} +0 -0
  404. /package/dist/cli-bundle/chunks/{chunk-B2NEFANY.js.map → chunk-6DZO5NN7.js.map} +0 -0
  405. /package/dist/cli-bundle/chunks/{chunk-VP4Z36GO.js.map → chunk-6FSPWUBI.js.map} +0 -0
  406. /package/dist/cli-bundle/chunks/{chunk-MPEWACTG.js.map → chunk-6KARQMC6.js.map} +0 -0
  407. /package/dist/cli-bundle/chunks/{chunk-N7LDJRB4.js.map → chunk-6KSFULO6.js.map} +0 -0
  408. /package/dist/cli-bundle/chunks/{chunk-XV6N3QND.js.map → chunk-6LTSLEHD.js.map} +0 -0
  409. /package/dist/cli-bundle/chunks/{chunk-USKTNI7P.js.map → chunk-7MMXBIRZ.js.map} +0 -0
  410. /package/dist/cli-bundle/chunks/{chunk-2K56AWDP.js.map → chunk-AOCYDQLT.js.map} +0 -0
  411. /package/dist/cli-bundle/chunks/{chunk-ZBVYKWT2.js.map → chunk-ATRXPXAL.js.map} +0 -0
  412. /package/dist/cli-bundle/chunks/{chunk-A5JPMD4Q.js.map → chunk-AW4PYYNF.js.map} +0 -0
  413. /package/dist/cli-bundle/chunks/{chunk-MTGMNUMJ.js.map → chunk-B3LROPTV.js.map} +0 -0
  414. /package/dist/cli-bundle/chunks/{chunk-NPNNW5TU.js.map → chunk-BBSUVIIT.js.map} +0 -0
  415. /package/dist/cli-bundle/chunks/{chunk-47BYN6CA.js.map → chunk-BYNJWB5F.js.map} +0 -0
  416. /package/dist/cli-bundle/chunks/{chunk-S673PVHD.js.map → chunk-CNPWCUDR.js.map} +0 -0
  417. /package/dist/cli-bundle/chunks/{chunk-TYQBGXH2.js.map → chunk-DKWIPIJY.js.map} +0 -0
  418. /package/dist/cli-bundle/chunks/{chunk-HMQMRHQJ.js.map → chunk-EKMHDL6Z.js.map} +0 -0
  419. /package/dist/cli-bundle/chunks/{chunk-LIVRA6VG.js.map → chunk-EOFROIC5.js.map} +0 -0
  420. /package/dist/cli-bundle/chunks/{chunk-NNMBNN6Q.js.map → chunk-ETJKPURB.js.map} +0 -0
  421. /package/dist/cli-bundle/chunks/{chunk-2E3KSWFG.js.map → chunk-F4EYOSNC.js.map} +0 -0
  422. /package/dist/cli-bundle/chunks/{chunk-DJ3YYLHG.js.map → chunk-FA5O2DEG.js.map} +0 -0
  423. /package/dist/cli-bundle/chunks/{chunk-QTWWHFI3.js.map → chunk-FBBPCSJM.js.map} +0 -0
  424. /package/dist/cli-bundle/chunks/{chunk-EMFDZ7N3.js.map → chunk-FSOJCFDS.js.map} +0 -0
  425. /package/dist/cli-bundle/chunks/{chunk-M35R7LFX.js.map → chunk-FXKPUMIR.js.map} +0 -0
  426. /package/dist/cli-bundle/chunks/{chunk-II3WDRCM.js.map → chunk-HWHZ7EY7.js.map} +0 -0
  427. /package/dist/cli-bundle/chunks/{chunk-7R5YKVKO.js.map → chunk-ICEWMJYH.js.map} +0 -0
  428. /package/dist/cli-bundle/chunks/{chunk-UMTPQMEG.js.map → chunk-II4BRHKM.js.map} +0 -0
  429. /package/dist/cli-bundle/chunks/{chunk-QG6M6XQE.js.map → chunk-J7VSEFWB.js.map} +0 -0
  430. /package/dist/cli-bundle/chunks/{chunk-22YA6GCA.js.map → chunk-K2LBDYDC.js.map} +0 -0
  431. /package/dist/cli-bundle/chunks/{chunk-BQVESTOG.js.map → chunk-KCJZREBI.js.map} +0 -0
  432. /package/dist/cli-bundle/chunks/{chunk-5P2LQV2F.js.map → chunk-MTQK5ZSB.js.map} +0 -0
  433. /package/dist/cli-bundle/chunks/{chunk-LEC57E7K.js.map → chunk-NCGQ27PK.js.map} +0 -0
  434. /package/dist/cli-bundle/chunks/{chunk-5LZPDRFW.js.map → chunk-NMQNXH4U.js.map} +0 -0
  435. /package/dist/cli-bundle/chunks/{chunk-PRUB7RI4.js.map → chunk-OVSFW4KD.js.map} +0 -0
  436. /package/dist/cli-bundle/chunks/{chunk-4L7Q4OVT.js.map → chunk-PF5GLFPU.js.map} +0 -0
  437. /package/dist/cli-bundle/chunks/{chunk-YVYJQR6S.js.map → chunk-QUTJOHGK.js.map} +0 -0
  438. /package/dist/cli-bundle/chunks/{chunk-CSRFOIHG.js.map → chunk-RICT5QYR.js.map} +0 -0
  439. /package/dist/cli-bundle/chunks/{chunk-OUG4CL4H.js.map → chunk-RNKUCHUQ.js.map} +0 -0
  440. /package/dist/cli-bundle/chunks/{chunk-X7RKOJXL.js.map → chunk-SL233DQD.js.map} +0 -0
  441. /package/dist/cli-bundle/chunks/{chunk-USVOBLGB.js.map → chunk-U3WTMYBX.js.map} +0 -0
  442. /package/dist/cli-bundle/chunks/{chunk-DYZKSIVX.js.map → chunk-VE3BUO3R.js.map} +0 -0
  443. /package/dist/cli-bundle/chunks/{chunk-RNWE2HZR.js.map → chunk-W2ZESOQE.js.map} +0 -0
  444. /package/dist/cli-bundle/chunks/{chunk-GL3QKIET.js.map → chunk-XKJDCJEH.js.map} +0 -0
  445. /package/dist/cli-bundle/chunks/{chunk-SO2IOH37.js.map → chunk-XNQ3YH6N.js.map} +0 -0
  446. /package/dist/cli-bundle/chunks/{chunk-ZGEWEO7B.js.map → chunk-XXGAWTH5.js.map} +0 -0
  447. /package/dist/cli-bundle/chunks/{chunk-4EOS35RL.js.map → chunk-YBQF4CAW.js.map} +0 -0
  448. /package/dist/cli-bundle/chunks/{chunk-MTDEEUGV.js.map → chunk-YT4Z2OVB.js.map} +0 -0
  449. /package/dist/cli-bundle/chunks/{chunk-5NS6TJ2F.js.map → chunk-ZHCSGIUX.js.map} +0 -0
  450. /package/dist/cli-bundle/chunks/{claim-2BSYPJTJ.js.map → claim-G57ZJLZ4.js.map} +0 -0
  451. /package/dist/cli-bundle/chunks/{claim-EZ6JKY5X.js.map → claim-TRSDQO6L.js.map} +0 -0
  452. /package/dist/cli-bundle/chunks/{close-3TSX6BYF.js.map → close-4QMUQMON.js.map} +0 -0
  453. /package/dist/cli-bundle/chunks/{close-TQZK43Z5.js.map → close-NNZZTZ5V.js.map} +0 -0
  454. /package/dist/cli-bundle/chunks/{close-many-B7DBVA46.js.map → close-many-3UWKJRQK.js.map} +0 -0
  455. /package/dist/cli-bundle/chunks/{close-many-HB4UFCS3.js.map → close-many-A7U62CRI.js.map} +0 -0
  456. /package/dist/cli-bundle/chunks/{comments-M7PAINZT.js.map → comments-4EM7XR74.js.map} +0 -0
  457. /package/dist/cli-bundle/chunks/{comments-X7M7XM6I.js.map → comments-URWDZP2I.js.map} +0 -0
  458. /package/dist/cli-bundle/chunks/{context-EGUGU4K7.js.map → context-A46YAV2F.js.map} +0 -0
  459. /package/dist/cli-bundle/chunks/{context-V32ZAPL6.js.map → context-BCR34RKM.js.map} +0 -0
  460. /package/dist/cli-bundle/chunks/{copy-RMLXLZOL.js.map → copy-KBTIUW7L.js.map} +0 -0
  461. /package/dist/cli-bundle/chunks/{copy-NWFFRYWM.js.map → copy-X7V6AEDB.js.map} +0 -0
  462. /package/dist/cli-bundle/chunks/{create-UZLJXHLA.js.map → create-4KOAQ6ME.js.map} +0 -0
  463. /package/dist/cli-bundle/chunks/{create-GK4MX2LJ.js.map → create-ZPZKJDFQ.js.map} +0 -0
  464. /package/dist/cli-bundle/chunks/{delete-EFQLVEAS.js.map → delete-2ZI6CJZM.js.map} +0 -0
  465. /package/dist/cli-bundle/chunks/{delete-RMGNIL2S.js.map → delete-FGKVPUQZ.js.map} +0 -0
  466. /package/dist/cli-bundle/chunks/{deps-WKHUPVD3.js.map → deps-IUJOBF2H.js.map} +0 -0
  467. /package/dist/cli-bundle/chunks/{deps-K2I7QV4Y.js.map → deps-SJCEFU3C.js.map} +0 -0
  468. /package/dist/cli-bundle/chunks/{extension-4LPTFTV4.js.map → extension-VRYTNNSV.js.map} +0 -0
  469. /package/dist/cli-bundle/chunks/{extension-ASUPTDCC.js.map → extension-XFQG3BXL.js.map} +0 -0
  470. /package/dist/cli-bundle/chunks/{focus-UGROAMAX.js.map → focus-7N36RIMT.js.map} +0 -0
  471. /package/dist/cli-bundle/chunks/{focus-ELOPN2SR.js.map → focus-CFE33IYC.js.map} +0 -0
  472. /package/dist/cli-bundle/chunks/{get-OTXPLWYW.js.map → get-577VLZZ7.js.map} +0 -0
  473. /package/dist/cli-bundle/chunks/{get-IWZ7IMPS.js.map → get-LLFWSPXW.js.map} +0 -0
  474. /package/dist/cli-bundle/chunks/{history-HNWBUDMI.js.map → history-4FJK6Y3O.js.map} +0 -0
  475. /package/dist/cli-bundle/chunks/{history-TKTULEVE.js.map → history-ZXNWG6H4.js.map} +0 -0
  476. /package/dist/cli-bundle/chunks/{history-compact-EQXVPK3V.js.map → history-compact-AXR6R6GU.js.map} +0 -0
  477. /package/dist/cli-bundle/chunks/{history-compact-MMQC7MCW.js.map → history-compact-HXF3OT7G.js.map} +0 -0
  478. /package/dist/cli-bundle/chunks/{history-redact-SPIFIXVY.js.map → history-redact-GV633Z4H.js.map} +0 -0
  479. /package/dist/cli-bundle/chunks/{history-redact-UBDHBEJE.js.map → history-redact-UMPD4G3K.js.map} +0 -0
  480. /package/dist/cli-bundle/chunks/{history-repair-GMMHFAGH.js.map → history-repair-WHOK2ICG.js.map} +0 -0
  481. /package/dist/cli-bundle/chunks/{history-repair-7DSDRPMX.js.map → history-repair-X57HE5EA.js.map} +0 -0
  482. /package/dist/cli-bundle/chunks/{init-A6FTZ5UC.js.map → init-KQWZSNBX.js.map} +0 -0
  483. /package/dist/cli-bundle/chunks/{init-QGK4JFF6.js.map → init-N7MIIYCU.js.map} +0 -0
  484. /package/dist/cli-bundle/chunks/{learnings-A6DGBMG3.js.map → learnings-FPG7WAVW.js.map} +0 -0
  485. /package/dist/cli-bundle/chunks/{learnings-DR53TWRA.js.map → learnings-GZRBIEAN.js.map} +0 -0
  486. /package/dist/cli-bundle/chunks/{list-LJ5DBXC3.js.map → list-MZBCSKLU.js.map} +0 -0
  487. /package/dist/cli-bundle/chunks/{list-KOJN23UL.js.map → list-ZDQ2OBSO.js.map} +0 -0
  488. /package/dist/cli-bundle/chunks/{notes-K5I3TAYR.js.map → notes-LW53PFLH.js.map} +0 -0
  489. /package/dist/cli-bundle/chunks/{notes-7VLTHKPW.js.map → notes-WQAP67EC.js.map} +0 -0
  490. /package/dist/cli-bundle/chunks/{register-mutation-ZAGVKMBQ.js.map → register-mutation-ANZIWHUF.js.map} +0 -0
  491. /package/dist/cli-bundle/chunks/{register-mutation-RXRX4P7D.js.map → register-mutation-PLFHAS4N.js.map} +0 -0
  492. /package/dist/cli-bundle/chunks/{register-setup-2FEGSFLM.js.map → register-setup-KPTZ36D4.js.map} +0 -0
  493. /package/dist/cli-bundle/chunks/{register-setup-LTJG52WP.js.map → register-setup-TMEF6V7O.js.map} +0 -0
  494. /package/dist/cli-bundle/chunks/{restore-SJUWYOCK.js.map → restore-64JKQV7G.js.map} +0 -0
  495. /package/dist/cli-bundle/chunks/{restore-PI3WM4GK.js.map → restore-GKM26SAW.js.map} +0 -0
  496. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-W4F2LKHW.js.map → scheduling-shortcuts-4ION7QAX.js.map} +0 -0
  497. /package/dist/cli-bundle/chunks/{scheduling-shortcuts-VWAMP2S2.js.map → scheduling-shortcuts-X6D6VSZR.js.map} +0 -0
  498. /package/dist/cli-bundle/chunks/{schema-N5ETYD4P.js.map → schema-OA4RSVMI.js.map} +0 -0
  499. /package/dist/cli-bundle/chunks/{schema-DXQRIEFM.js.map → schema-TA3NF3RG.js.map} +0 -0
  500. /package/dist/cli-bundle/chunks/{test-55RJCGRU.js.map → search-INCM5I4J.js.map} +0 -0
  501. /package/dist/cli-bundle/chunks/{test-47UQGEXE.js.map → search-UAIHEQZL.js.map} +0 -0
  502. /package/dist/cli-bundle/chunks/{stats-J563NJBY.js.map → stats-RHEMG4CE.js.map} +0 -0
  503. /package/dist/cli-bundle/chunks/{stats-ZFESFVQC.js.map → stats-WQWTIA5Y.js.map} +0 -0
  504. /package/dist/cli-bundle/chunks/{telemetry-BNGLIFEM.js.map → telemetry-G6UKGKJU.js.map} +0 -0
  505. /package/dist/cli-bundle/chunks/{telemetry-SC7HPRXX.js.map → telemetry-XA5D2QEO.js.map} +0 -0
  506. /package/dist/cli-bundle/chunks/{update-2BZEAI7B.js.map → test-XF7BYLMZ.js.map} +0 -0
  507. /package/dist/cli-bundle/chunks/{update-GCNLER2H.js.map → test-ZMQF23P3.js.map} +0 -0
  508. /package/dist/cli-bundle/chunks/{test-all-DN6KG4FX.js.map → test-all-WUBBJCPU.js.map} +0 -0
  509. /package/dist/cli-bundle/chunks/{test-all-5SFTTRNL.js.map → test-all-ZNQBMUOI.js.map} +0 -0
  510. /package/dist/cli-bundle/chunks/{test-runs-DZEDJ4GH.js.map → test-runs-N7LI7HLH.js.map} +0 -0
  511. /package/dist/cli-bundle/chunks/{test-runs-NHRBT7SN.js.map → test-runs-RFA42EEX.js.map} +0 -0
  512. /package/dist/cli-bundle/chunks/{update-many-OKYWFCBO.js.map → update-many-6XFR7TFG.js.map} +0 -0
  513. /package/dist/cli-bundle/chunks/{update-many-IRNV3OTG.js.map → update-many-NMRUQZL2.js.map} +0 -0
  514. /package/dist/cli-bundle/chunks/{upgrade-KP4I45V5.js.map → upgrade-EJTME2YQ.js.map} +0 -0
  515. /package/dist/cli-bundle/chunks/{upgrade-3RIAFQIK.js.map → upgrade-QMCSONWR.js.map} +0 -0
  516. /package/dist/cli-bundle/chunks/{validate-GVY4VE43.js.map → validate-3SUCHXXX.js.map} +0 -0
  517. /package/dist/cli-bundle/chunks/{validate-ADKGN37M.js.map → validate-KIIJY5RC.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"remediation.js","sources":["core/diagnostics/remediation.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Shared machine-executable remediation registry.\n *\n * `pm health` and `pm validate` both emit stable, colon-delimited warning tokens\n * (for example `history_drift_missing_stream:pm-abcd` or\n * `validate_resolution_missing_fields:3`). Agents that gate on these commands\n * previously had to hardcode the mapping from a warning code to the `pm` command\n * that fixes it. This module is the single source of truth for that mapping so\n * `pm health --json` (per-check `remediation_map`) and `pm validate --fix-hints`\n * (per-check `fix_hints`) can both surface executable remediation without any\n * duplicated, drift-prone lookup tables.\n *\n * Semantics of {@link RemediationEntry.command}: the suggested next `pm` command\n * an operator/agent should run to resolve findings with that code. Per-item\n * findings use an `<id>` placeholder (callers that have the concrete id may\n * substitute it); findings whose only fix is a manual file edit point at the\n * most useful diagnostic/repair command and describe the manual step in\n * {@link RemediationEntry.summary}.\n */\n\n/** Maps a stable diagnostic warning code to the command and summary that resolve it. */\nexport interface RemediationEntry {\n /**\n * Stable warning-code prefix this entry resolves. A warning matches when it\n * equals this code or begins with `<code>:`. Registry codes are mutually\n * exclusive under that colon-boundary rule (no code is a `:`-delimited prefix\n * of another — e.g. `settings:id_prefix_empty` is distinct from a bare\n * `settings`, which is intentionally not registered), so `resolveRemediation`\n * uses first-match with no ordering dependency.\n */\n readonly code: string;\n /** Executable `pm` command (or imperative) that resolves the finding. May contain an `<id>` placeholder. */\n readonly command: string;\n /** One-line description of what the command does / which manual step it covers. */\n readonly summary: string;\n}\n\n/**\n * Registry of every non-extension `pm health` / `pm validate` warning code and\n * its remediation. Extension findings keep their richer, contextual\n * `details.triage.remediation` produced by the extension health triage and are\n * intentionally excluded here (see pm-0hnu: \"all non-extension checks\").\n */\nexport const REMEDIATION_REGISTRY: readonly RemediationEntry[] = Object.freeze([\n // --- pm health: directories ---\n {\n code: \"missing_directory\",\n command: \"pm init\",\n summary: \"Recreate missing tracker directories (pm init is idempotent and restores the scaffold).\",\n },\n // --- pm health: settings (read/parse) ---\n {\n code: \"settings_read_invalid_json\",\n command: \"pm config list --json\",\n summary:\n \"settings.json is not valid JSON and pm fell back to defaults; fix the syntax error in the reported path, then re-run.\",\n },\n {\n code: \"settings_read_invalid_schema\",\n command: \"pm config list --json\",\n summary:\n \"settings.json failed schema validation and pm fell back to defaults; correct the reported key in the file, then re-run.\",\n },\n {\n code: \"settings_read_merge_failed\",\n command: \"pm config list --json\",\n summary: \"Global/project settings could not be merged; reconcile the conflicting keys in the reported settings files.\",\n },\n // --- pm health: settings_values ---\n {\n code: \"settings:id_prefix_empty\",\n command: \"pm config list --json\",\n summary: 'id_prefix is empty; set a non-empty \"id_prefix\" in settings.json so generated item ids are well-formed.',\n },\n {\n code: \"settings:locks_ttl_non_positive\",\n command: \"pm config list --json\",\n summary: 'locks.ttl_seconds must be positive; set a positive \"locks.ttl_seconds\" in settings.json.',\n },\n // --- pm health: telemetry (advisory) ---\n {\n code: \"telemetry_state_invalid_json\",\n command: \"pm health --check-telemetry\",\n summary: \"Local telemetry state file is corrupt; pm recreates it on the next flush. Advisory only.\",\n },\n {\n code: \"telemetry_queue_invalid_rows\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry queue has unparseable rows; they are skipped on the next flush. Advisory only.\",\n },\n {\n code: \"telemetry_queue_pending\",\n command: \"pm health --check-telemetry\",\n summary: \"Telemetry events are queued; they flush automatically on the next reachable command. Advisory only.\",\n },\n {\n code: \"telemetry_queue_high_retries\",\n command: \"pm telemetry flush\",\n summary:\n \"Some queued telemetry events are near retry exhaustion; flush now and verify endpoint reachability before entries are dropped.\",\n },\n {\n code: \"telemetry_endpoint_probe_failed\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry endpoint is unreachable; events stay queued until it recovers. Advisory only.\",\n },\n {\n code: \"telemetry_endpoint_probe_http_status\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry endpoint returned a non-success status; events stay queued until it recovers. Advisory only.\",\n },\n {\n code: \"telemetry_schema_version_behind\",\n command: \"pm health --check-telemetry\",\n summary: \"Client schema is behind server; upgrade pm-cli to emit the latest event shape.\",\n },\n {\n code: \"telemetry_otel_export_failing\",\n command: \"pm health --check-telemetry\",\n summary:\n \"OTLP trace spans are queued but the traces endpoint export is failing; spans retry automatically on the next reachable command, or set PM_TELEMETRY_OTEL_DISABLED=1 to skip OTLP export. Advisory only.\",\n },\n // --- pm health: integrity ---\n {\n code: \"integrity_item_unreadable\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file could not be read; restore or repair the file at the reported path.\",\n },\n {\n code: \"integrity_item_parse_failed\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file failed to parse; fix the malformed front matter at the reported path.\",\n },\n {\n code: \"integrity_item_conflict_marker\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file contains Git conflict markers; resolve the <<<<<<< / >>>>>>> markers at the reported line.\",\n },\n {\n code: \"integrity_history_unreadable\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream could not be read; re-anchor the affected item's history chain.\",\n },\n {\n code: \"integrity_history_invalid_json\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream contains invalid JSON; re-anchor the affected item's history chain.\",\n },\n {\n code: \"integrity_history_conflict_marker\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream contains Git conflict markers; resolve the markers, then re-anchor the chain.\",\n },\n // --- pm health: history_drift ---\n // `pm health` rewrites these commands to `pm history-repair --all` in the\n // per-check remediation_map when more than one stream is drifted.\n {\n code: \"history_drift_missing_stream\",\n command: \"pm history-repair <id>\",\n summary: \"The item has no history stream; re-anchor the chain to rebuild it (pm history-repair --all repairs every drifted stream in one pass).\",\n },\n {\n code: \"history_drift_unreadable_stream\",\n command: \"pm history-repair <id>\",\n summary: \"The item's history stream is unreadable; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass).\",\n },\n {\n code: \"history_drift_hash_mismatch\",\n command: \"pm history-repair <id>\",\n summary: \"The item's content hash no longer matches its history; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass).\",\n },\n {\n code: \"history_drift_chain_mismatch\",\n command: \"pm history-repair <id>\",\n summary: \"The item's history chain is broken; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass).\",\n },\n // --- pm health: storage (history compaction policy) ---\n {\n code: \"history_stream_over_compact_threshold\",\n command: \"pm history-compact <id>\",\n summary: \"The history stream exceeds the configured compaction threshold; compact it (pm history-compact --all-streams sweeps every over-threshold stream in one pass).\",\n },\n // --- pm health: locks ---\n {\n code: \"locks_stale_count\",\n command: \"pm gc --scope locks\",\n summary:\n \"Stale item-claim locks (embedded ttl elapsed) can block mutations; sweep them — gc retains active and unparseable locks.\",\n },\n {\n code: \"locks_unreadable\",\n command: \"pm gc --scope locks --dry-run\",\n summary:\n \"Some lock files could not be read; preview the sweep and inspect the unreadable files manually — gc never deletes what it cannot read.\",\n },\n // --- pm health: vectorization ---\n {\n code: \"vectorization_stale_items_remaining\",\n command: \"pm health --refresh-vectors\",\n summary: \"Some items have stale embeddings; refresh vectors so semantic search results stay current.\",\n },\n {\n code: \"vectorization_embedding_identity_changed\",\n command: \"pm reindex --mode semantic\",\n summary: \"Embedding provider/model changed since the last index; run a semantic reindex to rebuild vectors.\",\n },\n // --- pm validate: metadata ---\n // Note: validate_metadata_missing_author has no entry on purpose. `pm update\n // --author` sets the mutation/audit author (history), not the item's\n // `metadata.author` front-matter field, and there is no CLI flag that writes\n // that field — so emitting a command here would record an audit entry without\n // clearing the finding. A missing item author must be restored at the source.\n {\n code: \"validate_metadata_missing_acceptance_criteria\",\n command: 'pm update <id> --acceptance-criteria \"<criteria>\"',\n summary: \"Backfill the missing acceptance criteria on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_estimate\",\n command: 'pm update <id> --estimate \"<estimate>\"',\n summary: \"Backfill the missing estimate on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_close_reason\",\n command: 'pm update <id> --close-reason \"<reason>\"',\n summary: \"Backfill the missing close reason on the reported closed item(s).\",\n },\n {\n code: \"validate_metadata_missing_reviewer\",\n command: 'pm update <id> --reviewer \"<name>\"',\n summary: \"Backfill the missing reviewer on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_risk\",\n command: 'pm update <id> --risk \"<level>\"',\n summary: \"Backfill the missing risk on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_confidence\",\n command: 'pm update <id> --confidence \"<level>\"',\n summary: \"Backfill the missing confidence on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_sprint\",\n command: 'pm update <id> --sprint \"<sprint>\"',\n summary: \"Backfill the missing sprint on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_release\",\n command: 'pm update <id> --release \"<release>\"',\n summary: \"Backfill the missing release on the reported item(s).\",\n },\n {\n code: \"validate_metadata_custom_profile_missing_required_fields\",\n command: 'pm config set metadata-required-fields --criterion \"<field>\"',\n summary:\n \"Config-driven finding: the custom metadata profile has no required fields configured and falls back to core, so configure the fields rather than mutating items.\",\n },\n // --- pm validate: resolution ---\n {\n code: \"validate_resolution_missing_fields\",\n command: 'pm update <id> --resolution \"<how resolved>\"',\n summary: \"Backfill resolution / expected_result / actual_result on the reported closed item(s).\",\n },\n // --- pm validate: lifecycle ---\n {\n code: \"validate_lifecycle_active_closure_like_metadata\",\n command: \"pm update <id> --unset <closure-like-field>\",\n summary:\n \"Clear the closure-like field the validator flags on this active item — the detail row names it (resolution / actual-result / blocked-reason) — or close the item if it is actually done.\",\n },\n {\n code: \"validate_lifecycle_active_terminal_parent\",\n command: \"pm update <id> --parent <active-parent-id>\",\n summary: \"Reopen the terminal parent or move the active child under a non-terminal parent.\",\n },\n {\n code: \"validate_lifecycle_stale_blockers\",\n command: \"pm update <id> --unset blocked-by --unset blocked-reason\",\n summary:\n \"Resolve the stale blocker the validator flags: clear blocked-by/blocked-reason when they linger on a non-blocked item or report a resolved blocker; if instead a blocked item is missing blocker context, add the context or move it out of a blocked status.\",\n },\n {\n code: \"validate_lifecycle_dependency_cycles_error\",\n command: \"pm update <id> --dep-remove <dep-id>\",\n summary: \"Break the dependency cycle by removing one edge from the reported cycle.\",\n },\n {\n code: \"validate_lifecycle_dependency_cycles\",\n command: \"pm update <id> --dep-remove <dep-id>\",\n summary: \"Break the dependency cycle by removing one edge from the reported cycle.\",\n },\n {\n code: \"validate_hierarchy_parent_cycle_error\",\n command: \"pm update <id> --parent <other-id>\",\n summary:\n \"Break the parent-hierarchy cycle by reparenting one item in the reported cycle to a non-cyclic parent (or clear it with pm update <id> --unset parent).\",\n },\n {\n code: \"validate_hierarchy_parent_cycle\",\n command: \"pm update <id> --parent <other-id>\",\n summary:\n \"Break the parent-hierarchy cycle by reparenting one item in the reported cycle to a non-cyclic parent (or clear it with pm update <id> --unset parent).\",\n },\n // --- pm validate: files ---\n {\n code: \"validate_files_missing_linked_paths\",\n command: \"pm <files|docs> <id> --remove <path>\",\n summary:\n \"The check spans both item.files and item.docs under one code: restore the missing linked artifact, or unlink it with pm files (linked file) or pm docs (linked doc).\",\n },\n {\n code: \"validate_files_orphaned_paths\",\n command: \"pm <files|docs> <id> --add <path>\",\n summary:\n \"Link the orphaned artifact with pm files (file) or pm docs (doc), or remove it from the workspace.\",\n },\n {\n code: \"validate_files_tracked_all_strict_forces_pm_internals\",\n command: \"pm validate --check-files --include-pm-internals\",\n summary: \"tracked-all-strict scan flagged pm internals; re-run with --include-pm-internals or a softer --scan-mode.\",\n },\n // --- pm validate: history_drift ---\n {\n code: \"validate_history_drift_missing_streams\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items missing a history stream.\",\n },\n {\n code: \"validate_history_drift_unreadable_streams\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items with an unreadable history stream.\",\n },\n {\n code: \"validate_history_drift_hash_mismatches\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items whose content hash drifted.\",\n },\n {\n code: \"validate_history_drift_chain_mismatches\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items with a broken history chain.\",\n },\n // --- pm validate: command_references ---\n {\n code: \"validate_command_references_stale_pm_ids\",\n command: 'pm update <id> --replace-tests --test \"command=<corrected-command>\" [--test ...]',\n summary:\n \"Correct the stale pm-ID inside the item's linked test command (the check scans tests[].command, not the body). --replace-tests overwrites the entire tests list, so re-include the item's other linked tests in the same call.\",\n },\n]);\n\n/**\n * Resolve the remediation entry for a warning token, or `undefined` when no\n * entry is registered. A warning matches an entry when it equals the entry code\n * or begins with `<code>:` (the colon boundary keeps sibling codes such as\n * `validate_lifecycle_dependency_cycles` and\n * `validate_lifecycle_dependency_cycles_error` disjoint).\n *\n * First match is intentional and correct: registry codes are mutually exclusive\n * under the colon-boundary rule, so at most one entry can ever match a warning\n * and order is irrelevant. That invariant is enforced by a test (see\n * remediation-registry.spec.ts \"keeps every registry code mutually exclusive\"),\n * which is why this stays a simple linear scan rather than a longest-prefix\n * search — a longest-prefix tie-break is unreachable with disjoint codes.\n *\n * Accepts unknown input defensively (this is an exported helper SDK consumers\n * may call from untyped JS): a non-string `warning` resolves to `undefined`.\n */\nexport function resolveRemediation(warning: string): RemediationEntry | undefined {\n if (typeof warning !== \"string\") {\n return undefined;\n }\n const normalized = warning.trim();\n for (const entry of REMEDIATION_REGISTRY) {\n if (normalized === entry.code || normalized.startsWith(`${entry.code}:`)) {\n return entry;\n }\n }\n return undefined;\n}\n\n/**\n * Build a compact `remediation_map` (code -> command) for a set of warning\n * tokens. First match wins per code; unknown codes are skipped. Used by\n * `pm health --json` per-check details and as the source of deduped executable\n * commands for `pm validate --fix-hints`.\n */\nexport function buildRemediationMap(warnings: Iterable<string>): Record<string, string> {\n const map: Record<string, string> = {};\n for (const warning of warnings) {\n const entry = resolveRemediation(warning);\n if (entry !== undefined && !Object.prototype.hasOwnProperty.call(map, entry.code)) {\n map[entry.code] = entry.command;\n }\n }\n return map;\n}\n\n/**\n * Build a deduped, ordered list of executable remediation commands for a set of\n * warning tokens (one command per distinct matched code). Used by\n * `pm validate --fix-hints` for checks that do not already emit per-row\n * remediation commands.\n */\nexport function buildRemediationCommands(warnings: Iterable<string>): string[] {\n return Object.values(buildRemediationMap(warnings));\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAmBH;;;;;GAKG;;;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAC7E,iCAAiC;IACjC;QACE,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,yFAAyF;KACnG;IACD,2CAA2C;IAC3C;QACE,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE,uBAAuB;QAChC,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remediation.js","sources":["core/diagnostics/remediation.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Shared machine-executable remediation registry.\n *\n * `pm health` and `pm validate` both emit stable, colon-delimited warning tokens\n * (for example `history_drift_missing_stream:pm-abcd` or\n * `validate_resolution_missing_fields:3`). Agents that gate on these commands\n * previously had to hardcode the mapping from a warning code to the `pm` command\n * that fixes it. This module is the single source of truth for that mapping so\n * `pm health --json` (per-check `remediation_map`) and `pm validate --fix-hints`\n * (per-check `fix_hints`) can both surface executable remediation without any\n * duplicated, drift-prone lookup tables.\n *\n * Semantics of {@link RemediationEntry.command}: the suggested next `pm` command\n * an operator/agent should run to resolve findings with that code. Per-item\n * findings use an `<id>` placeholder (callers that have the concrete id may\n * substitute it); findings whose only fix is a manual file edit point at the\n * most useful diagnostic/repair command and describe the manual step in\n * {@link RemediationEntry.summary}.\n */\n\n/** Maps a stable diagnostic warning code to the command and summary that resolve it. */\nexport interface RemediationEntry {\n /**\n * Stable warning-code prefix this entry resolves. A warning matches when it\n * equals this code or begins with `<code>:`. Registry codes are mutually\n * exclusive under that colon-boundary rule (no code is a `:`-delimited prefix\n * of another — e.g. `settings:id_prefix_empty` is distinct from a bare\n * `settings`, which is intentionally not registered), so `resolveRemediation`\n * uses first-match with no ordering dependency.\n */\n readonly code: string;\n /** Executable `pm` command (or imperative) that resolves the finding. May contain an `<id>` placeholder. */\n readonly command: string;\n /** One-line description of what the command does / which manual step it covers. */\n readonly summary: string;\n}\n\n/**\n * Registry of every non-extension `pm health` / `pm validate` warning code and\n * its remediation. Extension findings keep their richer, contextual\n * `details.triage.remediation` produced by the extension health triage and are\n * intentionally excluded here (see pm-0hnu: \"all non-extension checks\").\n */\nexport const REMEDIATION_REGISTRY: readonly RemediationEntry[] = Object.freeze([\n // --- pm health: directories ---\n {\n code: \"missing_directory\",\n command: \"pm init\",\n summary: \"Recreate missing tracker directories (pm init is idempotent and restores the scaffold).\",\n },\n // --- pm health: settings (read/parse) ---\n {\n code: \"settings_read_invalid_json\",\n command: \"pm config list --json\",\n summary:\n \"settings.json is not valid JSON and pm fell back to defaults; fix the syntax error in the reported path, then re-run.\",\n },\n {\n code: \"settings_read_invalid_schema\",\n command: \"pm config list --json\",\n summary:\n \"settings.json failed schema validation and pm fell back to defaults; correct the reported key in the file, then re-run.\",\n },\n {\n code: \"settings_read_merge_failed\",\n command: \"pm config list --json\",\n summary: \"Global/project settings could not be merged; reconcile the conflicting keys in the reported settings files.\",\n },\n // --- pm health: settings_values ---\n {\n code: \"settings:id_prefix_empty\",\n command: \"pm config list --json\",\n summary: 'id_prefix is empty; set a non-empty \"id_prefix\" in settings.json so generated item ids are well-formed.',\n },\n {\n code: \"settings:locks_ttl_non_positive\",\n command: \"pm config list --json\",\n summary: 'locks.ttl_seconds must be positive; set a positive \"locks.ttl_seconds\" in settings.json.',\n },\n // --- pm health: telemetry (advisory) ---\n {\n code: \"telemetry_state_invalid_json\",\n command: \"pm health --check-telemetry\",\n summary: \"Local telemetry state file is corrupt; pm recreates it on the next flush. Advisory only.\",\n },\n {\n code: \"telemetry_queue_invalid_rows\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry queue has unparseable rows; they are skipped on the next flush. Advisory only.\",\n },\n {\n code: \"telemetry_queue_pending\",\n command: \"pm health --check-telemetry\",\n summary: \"Telemetry events are queued; they flush automatically on the next reachable command. Advisory only.\",\n },\n {\n code: \"telemetry_queue_high_retries\",\n command: \"pm telemetry flush\",\n summary:\n \"Some queued telemetry events are near retry exhaustion; flush now and verify endpoint reachability before entries are dropped.\",\n },\n {\n code: \"telemetry_endpoint_probe_failed\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry endpoint is unreachable; events stay queued until it recovers. Advisory only.\",\n },\n {\n code: \"telemetry_endpoint_probe_http_status\",\n command: \"pm health --check-telemetry\",\n summary: \"The telemetry endpoint returned a non-success status; events stay queued until it recovers. Advisory only.\",\n },\n {\n code: \"telemetry_schema_version_behind\",\n command: \"pm health --check-telemetry\",\n summary: \"Client schema is behind server; upgrade pm-cli to emit the latest event shape.\",\n },\n {\n code: \"telemetry_otel_export_failing\",\n command: \"pm health --check-telemetry\",\n summary:\n \"OTLP trace spans are queued but the traces endpoint export is failing; spans retry automatically on the next reachable command, or set PM_TELEMETRY_OTEL_DISABLED=1 to skip OTLP export. Advisory only.\",\n },\n // --- pm health: integrity ---\n {\n code: \"integrity_item_unreadable\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file could not be read; restore or repair the file at the reported path.\",\n },\n {\n code: \"integrity_item_parse_failed\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file failed to parse; fix the malformed front matter at the reported path.\",\n },\n {\n code: \"integrity_item_conflict_marker\",\n command: \"pm validate --check-files --verbose-diagnostics\",\n summary: \"An item file contains Git conflict markers; resolve the <<<<<<< / >>>>>>> markers at the reported line.\",\n },\n {\n code: \"integrity_history_unreadable\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream could not be read; re-anchor the affected item's history chain.\",\n },\n {\n code: \"integrity_history_invalid_json\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream contains invalid JSON; re-anchor the affected item's history chain.\",\n },\n {\n code: \"integrity_history_conflict_marker\",\n command: \"pm history-repair <id>\",\n summary: \"A history stream contains Git conflict markers; resolve the markers, then re-anchor the chain.\",\n },\n // --- pm health: history_drift ---\n // `pm health` rewrites these commands to `pm history-repair --all` in the\n // per-check remediation_map when more than one stream is drifted.\n {\n code: \"history_drift_missing_stream\",\n command: \"pm history-repair <id>\",\n summary: \"The item has no history stream; re-anchor the chain to rebuild it (pm history-repair --all repairs every drifted stream in one pass).\",\n },\n {\n code: \"history_drift_unreadable_stream\",\n command: \"pm history-repair <id>\",\n summary: \"The item's history stream is unreadable; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass).\",\n },\n {\n code: \"history_drift_hash_mismatch\",\n command: \"pm history-repair <id>\",\n summary: \"The item's content hash no longer matches its history; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass).\",\n },\n {\n code: \"history_drift_chain_mismatch\",\n command: \"pm history-repair <id>\",\n summary: \"The item's history chain is broken; re-anchor the chain (pm history-repair --all repairs every drifted stream in one pass).\",\n },\n // --- pm health: storage (history compaction policy) ---\n {\n code: \"history_stream_over_compact_threshold\",\n command: \"pm history-compact <id>\",\n summary: \"The history stream exceeds the configured compaction threshold; compact it (pm history-compact --all-streams sweeps every over-threshold stream in one pass).\",\n },\n // --- pm health: locks ---\n {\n code: \"locks_stale_count\",\n command: \"pm gc --scope locks\",\n summary:\n \"Stale item-claim locks (embedded ttl elapsed) can block mutations; sweep them — gc retains active and unparseable locks.\",\n },\n {\n code: \"locks_unreadable\",\n command: \"pm gc --scope locks --dry-run\",\n summary:\n \"Some lock files could not be read; preview the sweep and inspect the unreadable files manually — gc never deletes what it cannot read.\",\n },\n // --- pm health: extensions ---\n // Most extension findings keep their richer, contextual\n // `details.triage.remediation` and are intentionally absent here. The\n // partial-coverage code is the exception: it is not a per-extension triage\n // result but a system-wide adoption gap (unmanaged installs the update-health\n // scan had to skip), so it has a single deterministic fix and belongs in the\n // shared registry like any other health finding (pm-bdvm).\n {\n code: \"extension_update_health_partial_coverage\",\n command: \"pm extension --adopt-all --project\",\n summary:\n \"Update-health coverage is partial because unmanaged extensions were skipped; adopt the existing installs into managed metadata so the update scan covers them (use --global for global-scope extensions, or pm package --adopt-all when working with packages).\",\n },\n // --- pm health: vectorization ---\n {\n code: \"vectorization_stale_items_remaining\",\n command: \"pm health --refresh-vectors\",\n summary: \"Some items have stale embeddings; refresh vectors so semantic search results stay current.\",\n },\n {\n code: \"vectorization_embedding_identity_changed\",\n command: \"pm reindex --mode semantic\",\n summary: \"Embedding provider/model changed since the last index; run a semantic reindex to rebuild vectors.\",\n },\n // --- pm validate: metadata ---\n // Note: validate_metadata_missing_author has no entry on purpose. `pm update\n // --author` sets the mutation/audit author (history), not the item's\n // `metadata.author` front-matter field, and there is no CLI flag that writes\n // that field — so emitting a command here would record an audit entry without\n // clearing the finding. A missing item author must be restored at the source.\n {\n code: \"validate_metadata_missing_acceptance_criteria\",\n command: 'pm update <id> --acceptance-criteria \"<criteria>\"',\n summary: \"Backfill the missing acceptance criteria on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_estimate\",\n command: 'pm update <id> --estimate \"<estimate>\"',\n summary: \"Backfill the missing estimate on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_close_reason\",\n command: 'pm update <id> --close-reason \"<reason>\"',\n summary: \"Backfill the missing close reason on the reported closed item(s).\",\n },\n {\n code: \"validate_metadata_missing_reviewer\",\n command: 'pm update <id> --reviewer \"<name>\"',\n summary: \"Backfill the missing reviewer on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_risk\",\n command: 'pm update <id> --risk \"<level>\"',\n summary: \"Backfill the missing risk on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_confidence\",\n command: 'pm update <id> --confidence \"<level>\"',\n summary: \"Backfill the missing confidence on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_sprint\",\n command: 'pm update <id> --sprint \"<sprint>\"',\n summary: \"Backfill the missing sprint on the reported item(s).\",\n },\n {\n code: \"validate_metadata_missing_release\",\n command: 'pm update <id> --release \"<release>\"',\n summary: \"Backfill the missing release on the reported item(s).\",\n },\n {\n code: \"validate_metadata_custom_profile_missing_required_fields\",\n command: 'pm config set metadata-required-fields --criterion \"<field>\"',\n summary:\n \"Config-driven finding: the custom metadata profile has no required fields configured and falls back to core, so configure the fields rather than mutating items.\",\n },\n {\n code: \"validate_metadata_duplicate_issue_codes\",\n command: 'pm update <id> --title \"<distinct title>\"',\n summary:\n \"Two or more items share one logical issue code (GH-235); give each a distinct title so the derived code is unique, or close the redundant item with pm close <id> --duplicate-of <canonical-id> (closed-as-duplicate items are excluded from the check).\",\n },\n // --- pm validate: resolution ---\n {\n code: \"validate_resolution_missing_fields\",\n command: 'pm update <id> --resolution \"<how resolved>\"',\n summary: \"Backfill resolution / expected_result / actual_result on the reported closed item(s).\",\n },\n // --- pm validate: lifecycle ---\n {\n code: \"validate_lifecycle_active_closure_like_metadata\",\n command: \"pm update <id> --unset <closure-like-field>\",\n summary:\n \"Clear the closure-like field the validator flags on this active item — the detail row names it (resolution / actual-result / blocked-reason) — or close the item if it is actually done.\",\n },\n {\n code: \"validate_lifecycle_active_terminal_parent\",\n command: \"pm update <id> --parent <active-parent-id>\",\n summary: \"Reopen the terminal parent or move the active child under a non-terminal parent.\",\n },\n {\n code: \"validate_lifecycle_stale_blockers\",\n command: \"pm update <id> --unset blocked-by --unset blocked-reason\",\n summary:\n \"Resolve the stale blocker the validator flags: clear blocked-by/blocked-reason when they linger on a non-blocked item or report a resolved blocker; if instead a blocked item is missing blocker context, add the context or move it out of a blocked status.\",\n },\n {\n code: \"validate_lifecycle_dependency_cycles_error\",\n command: \"pm update <id> --dep-remove <dep-id>\",\n summary: \"Break the dependency cycle by removing one edge from the reported cycle.\",\n },\n {\n code: \"validate_lifecycle_dependency_cycles\",\n command: \"pm update <id> --dep-remove <dep-id>\",\n summary: \"Break the dependency cycle by removing one edge from the reported cycle.\",\n },\n {\n code: \"validate_hierarchy_parent_cycle_error\",\n command: \"pm update <id> --parent <other-id>\",\n summary:\n \"Break the parent-hierarchy cycle by reparenting one item in the reported cycle to a non-cyclic parent (or clear it with pm update <id> --unset parent).\",\n },\n {\n code: \"validate_hierarchy_parent_cycle\",\n command: \"pm update <id> --parent <other-id>\",\n summary:\n \"Break the parent-hierarchy cycle by reparenting one item in the reported cycle to a non-cyclic parent (or clear it with pm update <id> --unset parent).\",\n },\n // --- pm validate: files ---\n {\n code: \"validate_files_missing_linked_paths\",\n command: \"pm <files|docs> <id> --remove <path>\",\n summary:\n \"The check spans both item.files and item.docs under one code: restore the missing linked artifact, or unlink it with pm files (linked file) or pm docs (linked doc).\",\n },\n {\n code: \"validate_files_orphaned_paths\",\n command: \"pm <files|docs> <id> --add <path>\",\n summary:\n \"Link the orphaned artifact with pm files (file) or pm docs (doc), or remove it from the workspace.\",\n },\n {\n code: \"validate_files_tracked_all_strict_forces_pm_internals\",\n command: \"pm validate --check-files --include-pm-internals\",\n summary: \"tracked-all-strict scan flagged pm internals; re-run with --include-pm-internals or a softer --scan-mode.\",\n },\n // --- pm validate: history_drift ---\n {\n code: \"validate_history_drift_missing_streams\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items missing a history stream.\",\n },\n {\n code: \"validate_history_drift_unreadable_streams\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items with an unreadable history stream.\",\n },\n {\n code: \"validate_history_drift_hash_mismatches\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items whose content hash drifted.\",\n },\n {\n code: \"validate_history_drift_chain_mismatches\",\n command: \"pm history-repair <id>\",\n summary: \"Re-anchor the history chains of the items with a broken history chain.\",\n },\n // --- pm validate: command_references ---\n {\n code: \"validate_command_references_stale_pm_ids\",\n command: 'pm update <id> --replace-tests --test \"command=<corrected-command>\" [--test ...]',\n summary:\n \"Correct the stale pm-ID inside the item's linked test command (the check scans tests[].command, not the body). --replace-tests overwrites the entire tests list, so re-include the item's other linked tests in the same call.\",\n },\n]);\n\n/**\n * Resolve the remediation entry for a warning token, or `undefined` when no\n * entry is registered. A warning matches an entry when it equals the entry code\n * or begins with `<code>:` (the colon boundary keeps sibling codes such as\n * `validate_lifecycle_dependency_cycles` and\n * `validate_lifecycle_dependency_cycles_error` disjoint).\n *\n * First match is intentional and correct: registry codes are mutually exclusive\n * under the colon-boundary rule, so at most one entry can ever match a warning\n * and order is irrelevant. That invariant is enforced by a test (see\n * remediation-registry.spec.ts \"keeps every registry code mutually exclusive\"),\n * which is why this stays a simple linear scan rather than a longest-prefix\n * search — a longest-prefix tie-break is unreachable with disjoint codes.\n *\n * Accepts unknown input defensively (this is an exported helper SDK consumers\n * may call from untyped JS): a non-string `warning` resolves to `undefined`.\n */\nexport function resolveRemediation(warning: string): RemediationEntry | undefined {\n if (typeof warning !== \"string\") {\n return undefined;\n }\n const normalized = warning.trim();\n for (const entry of REMEDIATION_REGISTRY) {\n if (normalized === entry.code || normalized.startsWith(`${entry.code}:`)) {\n return entry;\n }\n }\n return undefined;\n}\n\n/**\n * Build a compact `remediation_map` (code -> command) for a set of warning\n * tokens. First match wins per code; unknown codes are skipped. Used by\n * `pm health --json` per-check details and as the source of deduped executable\n * commands for `pm validate --fix-hints`.\n */\nexport function buildRemediationMap(warnings: Iterable<string>): Record<string, string> {\n const map: Record<string, string> = {};\n for (const warning of warnings) {\n const entry = resolveRemediation(warning);\n if (entry !== undefined && !Object.prototype.hasOwnProperty.call(map, entry.code)) {\n map[entry.code] = entry.command;\n }\n }\n return map;\n}\n\n/**\n * Build a deduped, ordered list of executable remediation commands for a set of\n * warning tokens (one command per distinct matched code). Used by\n * `pm validate --fix-hints` for checks that do not already emit per-row\n * remediation commands.\n */\nexport function buildRemediationCommands(warnings: Iterable<string>): string[] {\n return Object.values(buildRemediationMap(warnings));\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAmBH;;;;;GAKG;;;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAgC,MAAM,CAAC,MAAM,CAAC;IAC7E,iCAAiC;IACjC;QACE,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,yFAAyF;KACnG;IACD,2CAA2C;IAC3C;QACE,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE,uBAAuB;QAChC,OAAO,EACL,uHAAuH;KAC1H;IACD;QACE,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,uBAAuB;QAChC,OAAO,EACL,yHAAyH;KAC5H;IACD;QACE,IAAI,EAAE,4BAA4B;QAClC,OAAO,EAAE,uBAAuB;QAChC,OAAO,EAAE,6GAA6G;KACvH;IACD,qCAAqC;IACrC;QACE,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,uBAAuB;QAChC,OAAO,EAAE,yGAAyG;KACnH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137
  activation?: ExtensionActivationMetadata;
138
138
  legacy_capability_aliases?: LegacyExtensionCapabilityAliasMapping[];
139
139
  }
140
- /**
141
- * Author-facing `manifest.json` fields recognized by the extension loader, plus
142
- * `$schema` (tolerated for inline IDE validation against
143
- * `docs/schemas/extension-manifest.schema.json`). `legacy_capability_aliases`
144
- * is loader-derived, never authored, so it is intentionally absent. A
145
- * governance test keeps the published JSON Schema's `properties` in sync with
146
- * this list.
147
- */
148
- export declare const KNOWN_EXTENSION_MANIFEST_FIELDS: readonly ["$schema", "name", "version", "entry", "priority", "manifest_version", "pm_min_version", "pm_max_version", "engines", "trusted", "provenance", "sandbox_profile", "permissions", "capabilities", "activation"];
149
140
  /**
150
141
  * Documents the extension diagnostic payload exchanged by command, SDK, and package integrations.
151
142
  */
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8a476e8d-7cae-5d53-b5f8-20771bd57388")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a8e01f7b-34b8-58a6-b894-3fcb8bad7d73")}catch(e){}}();
3
3
  export const KNOWN_EXTENSION_CAPABILITIES = [
4
4
  "commands",
5
5
  "renderers",
@@ -81,30 +81,5 @@ export function createDefaultExtensionGovernancePolicy() {
81
81
  extension_overrides: [],
82
82
  };
83
83
  }
84
- /**
85
- * Author-facing `manifest.json` fields recognized by the extension loader, plus
86
- * `$schema` (tolerated for inline IDE validation against
87
- * `docs/schemas/extension-manifest.schema.json`). `legacy_capability_aliases`
88
- * is loader-derived, never authored, so it is intentionally absent. A
89
- * governance test keeps the published JSON Schema's `properties` in sync with
90
- * this list.
91
- */
92
- export const KNOWN_EXTENSION_MANIFEST_FIELDS = Object.freeze([
93
- "$schema",
94
- "name",
95
- "version",
96
- "entry",
97
- "priority",
98
- "manifest_version",
99
- "pm_min_version",
100
- "pm_max_version",
101
- "engines",
102
- "trusted",
103
- "provenance",
104
- "sandbox_profile",
105
- "permissions",
106
- "capabilities",
107
- "activation",
108
- ]);
109
84
  //# sourceMappingURL=extension-types.js.map
110
- //# debugId=8a476e8d-7cae-5d53-b5f8-20771bd57388
85
+ //# debugId=a8e01f7b-34b8-58a6-b894-3fcb8bad7d73
@@ -1 +1 @@
1
- {"version":3,"file":"extension-types.js","sources":["core/extensions/extension-types.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/extensions/extension-types\n *\n * Implements extension runtime contracts and governance for Extension Types.\n */\nimport type {\n ExtensionPolicyOverrideSettings,\n ExtensionPolicySettings,\n ItemDocument,\n ItemFrontMatter,\n ItemStatus,\n PmSettings,\n} from \"../../types/index.js\";\nimport type { GlobalOptions } from \"../shared/command-types.js\";\n\nexport const KNOWN_EXTENSION_CAPABILITIES = [\n \"commands\",\n \"renderers\",\n \"hooks\",\n \"schema\",\n \"importers\",\n \"search\",\n \"parser\",\n \"preflight\",\n \"services\",\n] as const;\n/**\n * Restricts extension capability values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionCapability = (typeof KNOWN_EXTENSION_CAPABILITIES)[number];\nexport const EXTENSION_CAPABILITY_CONTRACT_VERSION = 2;\nexport const EXTENSION_CAPABILITY_LEGACY_ALIASES: Readonly<Record<string, ExtensionCapability>> = Object.freeze({\n migration: \"schema\",\n validation: \"schema\",\n});\nexport const EXTENSION_CAPABILITY_CONTRACT = Object.freeze({\n version: EXTENSION_CAPABILITY_CONTRACT_VERSION,\n capabilities: [...KNOWN_EXTENSION_CAPABILITIES],\n legacy_aliases: { ...EXTENSION_CAPABILITY_LEGACY_ALIASES },\n});\n\nexport const KNOWN_EXTENSION_POLICY_MODES = [\"off\", \"warn\", \"enforce\"] as const;\n/**\n * Restricts extension policy mode values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionPolicyMode = (typeof KNOWN_EXTENSION_POLICY_MODES)[number];\nexport const KNOWN_EXTENSION_TRUST_MODES = [\"off\", \"warn\", \"enforce\"] as const;\n/**\n * Restricts extension trust mode values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionTrustMode = (typeof KNOWN_EXTENSION_TRUST_MODES)[number];\nexport const KNOWN_EXTENSION_SANDBOX_PROFILES = [\"none\", \"restricted\", \"strict\"] as const;\n/**\n * Restricts extension sandbox profile values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionSandboxProfile = (typeof KNOWN_EXTENSION_SANDBOX_PROFILES)[number];\n\nexport const KNOWN_PM_MAX_VERSION_EXCEEDED_MODES = [\"block\", \"warn\"] as const;\n/** How a `pm_max_version` violation is handled for an extension layer. */\nexport type PmMaxVersionExceededMode = (typeof KNOWN_PM_MAX_VERSION_EXCEEDED_MODES)[number];\n/** Optional per-layer override map for `extensions.policy.pm_max_version_exceeded_mode`. */\nexport interface PmMaxVersionExceededModeByLayer {\n global?: PmMaxVersionExceededMode;\n project?: PmMaxVersionExceededMode;\n}\n/**\n * Settings value for `extensions.policy.pm_max_version_exceeded_mode`: either a\n * single mode applied to both layers, or a per-layer override map. Unset (and\n * any unset layer key) defaults to `\"block\"`.\n */\nexport type PmMaxVersionExceededModeSetting = PmMaxVersionExceededMode | PmMaxVersionExceededModeByLayer;\n\nexport const KNOWN_EXTENSION_POLICY_SURFACES = [\n \"commands.override\",\n \"commands.handler\",\n \"hooks.beforecommand\",\n \"hooks.aftercommand\",\n \"hooks.onwrite\",\n \"hooks.onread\",\n \"hooks.onindex\",\n \"schema.flags\",\n \"schema.itemfields\",\n \"schema.itemtypes\",\n \"schema.migrations\",\n \"parser.override\",\n \"preflight.override\",\n \"services.override\",\n \"renderers.override\",\n \"importers.importer\",\n \"importers.exporter\",\n \"search.provider\",\n \"search.vectorstore\",\n] as const;\n/**\n * Restricts extension policy surface values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionPolicySurface = (typeof KNOWN_EXTENSION_POLICY_SURFACES)[number];\n\nexport const KNOWN_EXTENSION_SERVICE_NAMES = [\n \"output_format\",\n \"error_format\",\n \"help_format\",\n \"lock_acquire\",\n \"lock_release\",\n \"history_append\",\n \"item_store_write\",\n \"item_store_delete\",\n] as const;\n/**\n * Restricts extension service name values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionServiceName = (typeof KNOWN_EXTENSION_SERVICE_NAMES)[number];\n\n/**\n * Documents the extension provenance metadata payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionProvenanceMetadata {\n source?: string;\n signature?: string;\n attestation?: string;\n verified?: boolean;\n}\n\n/**\n * Documents the extension runtime permission declaration payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionRuntimePermissionDeclaration {\n fs_read?: boolean;\n fs_write?: boolean;\n network?: boolean;\n env_read?: boolean;\n env_write?: boolean;\n process_spawn?: boolean;\n}\n\n/**\n * Documents the extension activation metadata payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionActivationMetadata {\n commands?: string[];\n}\n\n/**\n * Restricts extension policy override values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionPolicyOverride = ExtensionPolicyOverrideSettings;\n/**\n * Extension governance policy as read from / serialized to settings. Extends the\n * stored settings shape with `pm_max_version_exceeded_mode` (pm-k5e8), which\n * relaxes the default-BLOCK on `pm_max_version` violations to warn-only —\n * globally or per extension layer.\n */\nexport type ExtensionGovernancePolicy = ExtensionPolicySettings & {\n pm_max_version_exceeded_mode?: PmMaxVersionExceededModeSetting;\n};\n\n/**\n * Documents the extension manifest engines payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionManifestEngines {\n pm?: string;\n node?: string;\n [engine: string]: string | undefined;\n}\n\n/**\n * Implements create default extension governance policy for the public runtime surface of this module.\n */\nexport function createDefaultExtensionGovernancePolicy(): ExtensionGovernancePolicy {\n return {\n mode: \"off\",\n trust_mode: \"off\",\n require_provenance: false,\n trusted_extensions: [],\n default_sandbox_profile: \"none\",\n allowed_extensions: [],\n blocked_extensions: [],\n allowed_capabilities: [],\n blocked_capabilities: [],\n allowed_surfaces: [],\n blocked_surfaces: [],\n allowed_commands: [],\n blocked_commands: [],\n allowed_actions: [],\n blocked_actions: [],\n allowed_services: [],\n blocked_services: [],\n extension_overrides: [],\n };\n}\n\n/**\n * Restricts extension layer values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionLayer = \"global\" | \"project\";\n/**\n * Restricts extension status values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionStatus = \"ok\" | \"warn\";\n\n/**\n * Documents the extension manifest payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionManifest {\n name: string;\n version: string;\n entry: string;\n priority: number;\n capabilities: string[];\n manifest_version?: number;\n pm_min_version?: string;\n pm_max_version?: string;\n engines?: ExtensionManifestEngines;\n trusted?: boolean;\n provenance?: ExtensionProvenanceMetadata;\n sandbox_profile?: ExtensionSandboxProfile;\n permissions?: ExtensionRuntimePermissionDeclaration;\n activation?: ExtensionActivationMetadata;\n legacy_capability_aliases?: LegacyExtensionCapabilityAliasMapping[];\n}\n\n/**\n * Author-facing `manifest.json` fields recognized by the extension loader, plus\n * `$schema` (tolerated for inline IDE validation against\n * `docs/schemas/extension-manifest.schema.json`). `legacy_capability_aliases`\n * is loader-derived, never authored, so it is intentionally absent. A\n * governance test keeps the published JSON Schema's `properties` in sync with\n * this list.\n */\nexport const KNOWN_EXTENSION_MANIFEST_FIELDS = Object.freeze([\n \"$schema\",\n \"name\",\n \"version\",\n \"entry\",\n \"priority\",\n \"manifest_version\",\n \"pm_min_version\",\n \"pm_max_version\",\n \"engines\",\n \"trusted\",\n \"provenance\",\n \"sandbox_profile\",\n \"permissions\",\n \"capabilities\",\n \"activation\",\n] as const) satisfies readonly (Exclude<keyof ExtensionManifest, \"legacy_capability_aliases\"> | \"$schema\")[];\n\n/**\n * Documents the extension diagnostic payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDiagnostic {\n layer: ExtensionLayer;\n directory: string;\n manifest_path: string;\n name: string | null;\n version: string | null;\n entry: string | null;\n priority: number | null;\n entry_path: string | null;\n enabled: boolean | null;\n status: ExtensionStatus;\n}\n\n/**\n * Documents the effective extension payload exchanged by command, SDK, and package integrations.\n */\nexport interface EffectiveExtension {\n layer: ExtensionLayer;\n directory: string;\n manifest_path: string;\n name: string;\n source_package?: string;\n version: string;\n entry: string;\n priority: number;\n entry_path: string;\n manifest_version?: number;\n pm_min_version?: string;\n pm_max_version?: string;\n engines?: ExtensionManifestEngines;\n trusted?: boolean;\n provenance?: ExtensionProvenanceMetadata;\n sandbox_profile?: ExtensionSandboxProfile;\n permissions?: ExtensionRuntimePermissionDeclaration;\n capabilities?: string[];\n activation?: ExtensionActivationMetadata;\n}\n\n/**\n * Documents the extension discovery result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDiscoveryResult {\n disabled_by_flag: boolean;\n roots: {\n global: string;\n project: string;\n };\n configured_enabled: string[];\n configured_disabled: string[];\n discovered: ExtensionDiagnostic[];\n effective: EffectiveExtension[];\n warnings: string[];\n policy: ExtensionGovernancePolicy;\n}\n\n/**\n * Documents the loaded extension payload exchanged by command, SDK, and package integrations.\n */\nexport interface LoadedExtension extends EffectiveExtension {\n module: unknown;\n}\n\n/**\n * Documents the failed extension load payload exchanged by command, SDK, and package integrations.\n */\nexport interface FailedExtensionLoad {\n layer: ExtensionLayer;\n name: string;\n entry_path: string;\n error: string;\n}\n\n/**\n * Documents the extension load result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionLoadResult extends ExtensionDiscoveryResult {\n loaded: LoadedExtension[];\n failed: FailedExtensionLoad[];\n}\n\n/**\n * Documents the before command hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface BeforeCommandHookContext {\n command: string;\n args: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n pm_root: string;\n}\n\n/**\n * Documents the after command hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface AfterCommandHookContext extends BeforeCommandHookContext {\n ok: boolean;\n error?: string;\n result?: unknown;\n affected?: AfterCommandAffectedItem[];\n}\n\n/**\n * Documents the after command affected item payload exchanged by command, SDK, and package integrations.\n */\nexport interface AfterCommandAffectedItem {\n id: string;\n op?: string;\n item_type?: string;\n previous_status?: ItemStatus;\n status?: ItemStatus;\n previous?: Partial<ItemFrontMatter>;\n current?: Partial<ItemFrontMatter>;\n changed_fields?: string[];\n}\n\n/**\n * Documents the on write hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface OnWriteHookContext {\n path: string;\n scope: \"project\" | \"global\";\n op: string;\n item_id?: string;\n item_type?: string;\n before?: ItemDocument;\n after?: ItemDocument;\n changed_fields?: string[];\n}\n\n/**\n * Documents the on read hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface OnReadHookContext {\n path: string;\n scope: \"project\" | \"global\";\n}\n\n/**\n * Documents the on index hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface OnIndexHookContext {\n mode: string;\n total_items?: number;\n}\n\n/**\n * Restricts before command hook values accepted by command, SDK, and storage contracts.\n */\nexport type BeforeCommandHook = (context: BeforeCommandHookContext) => Promise<void> | void;\n/**\n * Restricts after command hook values accepted by command, SDK, and storage contracts.\n */\nexport type AfterCommandHook = (context: AfterCommandHookContext) => Promise<void> | void;\n/**\n * Restricts on write hook values accepted by command, SDK, and storage contracts.\n */\nexport type OnWriteHook = (context: OnWriteHookContext) => Promise<void> | void;\n/**\n * Restricts on read hook values accepted by command, SDK, and storage contracts.\n */\nexport type OnReadHook = (context: OnReadHookContext) => Promise<void> | void;\n/**\n * Restricts on index hook values accepted by command, SDK, and storage contracts.\n */\nexport type OnIndexHook = (context: OnIndexHookContext) => Promise<void> | void;\n/**\n * Restricts output renderer format values accepted by command, SDK, and storage contracts.\n */\nexport type OutputRendererFormat = \"toon\" | \"json\";\n/**\n * Restricts command override values accepted by command, SDK, and storage contracts.\n */\nexport type CommandOverride = (context: CommandOverrideContext) => unknown;\n/**\n * Restricts renderer override values accepted by command, SDK, and storage contracts.\n */\nexport type RendererOverride = (context: RendererOverrideContext) => string | null | undefined;\n/**\n * Restricts command handler values accepted by command, SDK, and storage contracts.\n */\nexport type CommandHandler = (context: CommandHandlerContext) => unknown;\n/**\n * Restricts parser override values accepted by command, SDK, and storage contracts.\n */\nexport type ParserOverride = (context: ParserOverrideContext) => ParserOverrideDelta | Promise<ParserOverrideDelta>;\n/**\n * Restricts preflight override values accepted by command, SDK, and storage contracts.\n */\nexport type PreflightOverride = (context: PreflightOverrideContext) => PreflightOverrideDelta | Promise<PreflightOverrideDelta>;\n/**\n * Restricts service override values accepted by command, SDK, and storage contracts.\n */\nexport type ServiceOverride = (context: ServiceOverrideContext) => unknown;\n\n/**\n * Documents the registered extension hook payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionHook<THook> {\n layer: ExtensionLayer;\n name: string;\n run: THook;\n}\n\n/**\n * Documents the extension hook registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionHookRegistry {\n beforeCommand: Array<RegisteredExtensionHook<BeforeCommandHook>>;\n afterCommand: Array<RegisteredExtensionHook<AfterCommandHook>>;\n onWrite: Array<RegisteredExtensionHook<OnWriteHook>>;\n onRead: Array<RegisteredExtensionHook<OnReadHook>>;\n onIndex: Array<RegisteredExtensionHook<OnIndexHook>>;\n}\n\n/**\n * Documents the command override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandOverrideContext {\n command: string;\n args: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n pm_root: string;\n result: unknown;\n}\n\n/**\n * Documents the renderer override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface RendererOverrideContext {\n format: OutputRendererFormat;\n command?: string;\n args?: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n pm_root?: string;\n result: unknown;\n}\n\n/**\n * Documents the command handler context payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandHandlerContext {\n command: string;\n args: string[];\n options: Record<string, unknown>;\n global: GlobalOptions;\n pm_root: string;\n}\n\n/**\n * Documents the parser override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface ParserOverrideContext extends CommandHandlerContext {}\n\n/**\n * Documents the parser override delta payload exchanged by command, SDK, and package integrations.\n */\nexport interface ParserOverrideDelta {\n args?: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n}\n\n/**\n * Documents the preflight override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface PreflightOverrideContext extends CommandHandlerContext {\n decision: PreflightRuntimeDecision;\n}\n\n/**\n * Documents the preflight runtime decision payload exchanged by command, SDK, and package integrations.\n */\nexport interface PreflightRuntimeDecision {\n enforce_item_format_gate: boolean;\n run_preflight_item_format_sync: boolean;\n run_extension_migrations: boolean;\n enforce_mandatory_migration_gate: boolean;\n}\n\n/**\n * Documents the preflight override delta payload exchanged by command, SDK, and package integrations.\n */\nexport interface PreflightOverrideDelta extends ParserOverrideDelta {\n enforce_item_format_gate?: boolean;\n run_preflight_item_format_sync?: boolean;\n run_extension_migrations?: boolean;\n enforce_mandatory_migration_gate?: boolean;\n}\n\n/**\n * Documents the service override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface ServiceOverrideContext {\n service: ExtensionServiceName;\n command?: string;\n args?: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n pm_root?: string;\n payload: unknown;\n}\n\n/**\n * Documents the extension command argument definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionCommandArgumentDefinition {\n name: string;\n required?: boolean;\n variadic?: boolean;\n description?: string;\n}\n\n/**\n * Documents the command definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandDefinition {\n name: string;\n run?: CommandHandler;\n /**\n * @deprecated Use `run` instead. This alias remains for backward compatibility.\n */\n handler?: CommandHandler;\n action?: string;\n description?: string;\n intent?: string;\n examples?: string[];\n failure_hints?: string[];\n arguments?: ExtensionCommandArgumentDefinition[];\n flags?: FlagDefinition[];\n}\n\n/**\n * Optional command-definition metadata for first-class importer/exporter\n * registration.\n *\n * `registerImporter`/`registerExporter` always create a `<name> import` /\n * `<name> export` command path. By default that path only has a handler. When\n * these options are supplied, the auto-created command also gains a full command\n * definition (description, flags, intent, examples, failure hints, positional\n * arguments) — surfaced in help and runtime contracts exactly like\n * `registerCommand`. The registration `name` and `run` handler are implicit, so\n * they are not part of this options object.\n */\nexport interface ImportExportRegistrationOptions {\n action?: string;\n description?: string;\n intent?: string;\n examples?: string[];\n failure_hints?: string[];\n arguments?: ExtensionCommandArgumentDefinition[];\n flags?: FlagDefinition[];\n}\n\n/**\n * Restricts flag value type values accepted by command, SDK, and storage contracts.\n */\nexport type FlagValueType = \"string\" | \"number\" | \"boolean\";\n\n/**\n * Documents the flag definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface FlagDefinition {\n long?: string;\n short?: string;\n value_name?: string;\n description?: string;\n required?: boolean;\n enabled?: boolean;\n visible?: boolean;\n /**\n * Canonical flag value type. Prefer this field; it is the one runtime\n * contracts and help output read first.\n */\n value_type?: FlagValueType;\n /**\n * @deprecated Use `value_type`. Retained for backward compatibility: when\n * both are present `value_type` wins, and `type` resolves only when\n * `value_type` is absent (`value_type ?? type`).\n */\n type?: FlagValueType;\n /**\n * When true, a repeated comma-list flag accumulates values across repeats\n * — parity with core list flags such as `--tags` — instead of the last\n * value winning. Mirrors the core `CliFlagContract.list` field so\n * extension-registered list flags coalesce through the same bootstrap path.\n */\n list?: boolean;\n /**\n * Default value applied when the flag is omitted. Surfaced to runtime\n * contracts and help output. A `list` flag may default to an array of scalars\n * (e.g. `[\"a\", \"b\"]`); the array is flattened/coerced like any list value.\n */\n default?: string | number | boolean | Array<string | number | boolean>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema field definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaFieldDefinition {\n name: string;\n type: string;\n optional?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema item type command option policy definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaItemTypeCommandOptionPolicyDefinition {\n command: string;\n option: string;\n enabled?: boolean;\n required?: boolean;\n visible?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema item type option definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaItemTypeOptionDefinition {\n key: string;\n values?: string[];\n required?: boolean;\n aliases?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema item type definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaItemTypeDefinition {\n name: string;\n folder?: string;\n aliases?: string[];\n required_create_fields?: string[];\n required_create_repeatables?: string[];\n command_option_policies?: SchemaItemTypeCommandOptionPolicyDefinition[];\n options?: SchemaItemTypeOptionDefinition[];\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema migration run context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaMigrationRunContext {\n id: string;\n command: \"migration\";\n layer: ExtensionLayer;\n extension: string;\n pm_root: string;\n status: string;\n}\n\n/**\n * Restricts schema migration runner values accepted by command, SDK, and storage contracts.\n */\nexport type SchemaMigrationRunner = (context: SchemaMigrationRunContext) => unknown | Promise<unknown>;\n\n/**\n * Documents the schema migration definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaMigrationDefinition {\n id?: string;\n description?: string;\n status?: string;\n mandatory?: boolean;\n run?: SchemaMigrationRunner;\n [key: string]: unknown;\n}\n\n/**\n * Documents the import export context payload exchanged by command, SDK, and package integrations.\n */\nexport interface ImportExportContext {\n registration: string;\n action: \"import\" | \"export\";\n command: string;\n args: string[];\n options: Record<string, unknown>;\n global: GlobalOptions;\n pm_root: string;\n}\n\n/**\n * Restricts importer values accepted by command, SDK, and storage contracts.\n */\nexport type Importer = (context: ImportExportContext) => unknown | Promise<unknown>;\n/**\n * Restricts exporter values accepted by command, SDK, and storage contracts.\n */\nexport type Exporter = (context: ImportExportContext) => unknown | Promise<unknown>;\n\n/**\n * Restricts extension search mode values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionSearchMode = \"keyword\" | \"semantic\" | \"hybrid\";\n\n/**\n * Documents the search provider query context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderQueryContext {\n query: string;\n mode: ExtensionSearchMode;\n tokens: string[];\n options: Record<string, unknown>;\n settings: PmSettings;\n documents: ItemDocument[];\n [key: string]: unknown;\n}\n\n/**\n * Documents the search provider hit payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderHit {\n id: string;\n score: number;\n matched_fields?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Restricts search provider query result values accepted by command, SDK, and storage contracts.\n */\nexport type SearchProviderQueryResult = SearchProviderHit[] | { hits?: SearchProviderHit[] };\n\n/**\n * Documents the search provider query expansion context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderQueryExpansionContext {\n query: string;\n mode: Exclude<ExtensionSearchMode, \"keyword\">;\n settings: PmSettings;\n [key: string]: unknown;\n}\n\n/**\n * Restricts search provider query expansion result values accepted by command, SDK, and storage contracts.\n */\nexport type SearchProviderQueryExpansionResult = string[] | { queries?: string[] };\n\n/**\n * Documents the search provider rerank candidate payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderRerankCandidate {\n id: string;\n text: string;\n score: number;\n}\n\n/**\n * Documents the search provider rerank hit payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderRerankHit {\n id: string;\n score: number;\n}\n\n/**\n * Restricts search provider rerank result values accepted by command, SDK, and storage contracts.\n */\nexport type SearchProviderRerankResult = SearchProviderRerankHit[] | { hits?: SearchProviderRerankHit[] };\n\n/**\n * Documents the search provider rerank context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderRerankContext {\n query: string;\n mode: \"hybrid\";\n model: string;\n top_k: number;\n settings: PmSettings;\n candidates: SearchProviderRerankCandidate[];\n [key: string]: unknown;\n}\n\n/**\n * Documents the search provider embed batch context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderEmbedBatchContext {\n inputs: string[];\n settings: PmSettings;\n model: string;\n [key: string]: unknown;\n}\n\n/**\n * Documents the search provider embed context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderEmbedContext {\n input: string;\n settings: PmSettings;\n model: string;\n [key: string]: unknown;\n}\n\n/**\n * Documents the search provider definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderDefinition {\n name: string;\n query?: (context: SearchProviderQueryContext) => SearchProviderQueryResult | Promise<SearchProviderQueryResult>;\n queryExpansion?: (\n context: SearchProviderQueryExpansionContext,\n ) => SearchProviderQueryExpansionResult | Promise<SearchProviderQueryExpansionResult>;\n query_expansion?: (\n context: SearchProviderQueryExpansionContext,\n ) => SearchProviderQueryExpansionResult | Promise<SearchProviderQueryExpansionResult>;\n rerank?: (context: SearchProviderRerankContext) => SearchProviderRerankResult | Promise<SearchProviderRerankResult>;\n embedBatch?: (context: SearchProviderEmbedBatchContext) => number[][] | Promise<number[][]>;\n embed_batch?: (context: SearchProviderEmbedBatchContext) => number[][] | Promise<number[][]>;\n embed?: (context: SearchProviderEmbedContext) => number[] | Promise<number[]>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store query hit payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreQueryHit {\n id: string;\n score: number;\n payload?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store query context payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreQueryContext {\n vector: number[];\n limit: number;\n settings: PmSettings;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store upsert point payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreUpsertPoint {\n id: string;\n vector: number[];\n payload?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store upsert context payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreUpsertContext {\n points: VectorStoreUpsertPoint[];\n settings: PmSettings;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store delete context payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreDeleteContext {\n ids: string[];\n settings: PmSettings;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store adapter definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreAdapterDefinition {\n name: string;\n query?: (context: VectorStoreQueryContext) => VectorStoreQueryHit[] | Promise<VectorStoreQueryHit[]>;\n upsert?: (context: VectorStoreUpsertContext) => unknown | Promise<unknown>;\n delete?: (context: VectorStoreDeleteContext) => unknown | Promise<unknown>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the registered extension command override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionCommandOverride {\n layer: ExtensionLayer;\n name: string;\n command: string;\n run: CommandOverride;\n}\n\n/**\n * Documents the registered extension command handler payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionCommandHandler {\n layer: ExtensionLayer;\n name: string;\n command: string;\n run: CommandHandler;\n}\n\n/**\n * Documents the registered extension parser override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionParserOverride {\n layer: ExtensionLayer;\n name: string;\n command: string;\n run: ParserOverride;\n}\n\n/**\n * Documents the registered extension preflight override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionPreflightOverride {\n layer: ExtensionLayer;\n name: string;\n run: PreflightOverride;\n}\n\n/**\n * Documents the registered extension service override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionServiceOverride {\n layer: ExtensionLayer;\n name: string;\n service: ExtensionServiceName;\n run: ServiceOverride;\n}\n\n/**\n * Documents the registered extension renderer override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionRendererOverride {\n layer: ExtensionLayer;\n name: string;\n format: OutputRendererFormat;\n run: RendererOverride;\n}\n\n/**\n * Documents the extension command registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionCommandRegistry {\n overrides: RegisteredExtensionCommandOverride[];\n handlers: RegisteredExtensionCommandHandler[];\n}\n\n/**\n * Documents the extension parser registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionParserRegistry {\n overrides: RegisteredExtensionParserOverride[];\n}\n\n/**\n * Documents the extension preflight registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionPreflightRegistry {\n overrides: RegisteredExtensionPreflightOverride[];\n}\n\n/**\n * Documents the extension service registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionServiceRegistry {\n overrides: RegisteredExtensionServiceOverride[];\n}\n\n/**\n * Documents the extension renderer registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionRendererRegistry {\n overrides: RegisteredExtensionRendererOverride[];\n}\n\n/**\n * Documents the registered extension flag definitions payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionFlagDefinitions {\n layer: ExtensionLayer;\n name: string;\n target_command: string;\n flags: FlagDefinition[];\n}\n\n/**\n * Documents the registered extension command definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionCommandDefinition {\n layer: ExtensionLayer;\n name: string;\n source_package?: string;\n command: string;\n action: string;\n description?: string;\n intent?: string;\n examples: string[];\n failure_hints: string[];\n arguments: ExtensionCommandArgumentDefinition[];\n}\n\n/**\n * Documents the registered extension schema field definitions payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionSchemaFieldDefinitions {\n layer: ExtensionLayer;\n name: string;\n fields: SchemaFieldDefinition[];\n}\n\n/**\n * Documents the registered extension schema item type definitions payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionSchemaItemTypeDefinitions {\n layer: ExtensionLayer;\n name: string;\n types: SchemaItemTypeDefinition[];\n}\n\n/**\n * Documents the registered extension schema migration definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionSchemaMigrationDefinition {\n layer: ExtensionLayer;\n name: string;\n definition: SchemaMigrationDefinition;\n runtime_definition: SchemaMigrationDefinition;\n}\n\n/**\n * Documents the registered extension importer payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionImporter {\n layer: ExtensionLayer;\n name: string;\n importer: string;\n}\n\n/**\n * Documents the registered extension exporter payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionExporter {\n layer: ExtensionLayer;\n name: string;\n exporter: string;\n}\n\n/**\n * Documents the registered extension search provider payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionSearchProvider {\n layer: ExtensionLayer;\n name: string;\n definition: SearchProviderDefinition;\n runtime_definition: SearchProviderDefinition;\n}\n\n/**\n * Documents the registered extension vector store adapter payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionVectorStoreAdapter {\n layer: ExtensionLayer;\n name: string;\n definition: VectorStoreAdapterDefinition;\n runtime_definition: VectorStoreAdapterDefinition;\n}\n\n/**\n * Documents the extension registration registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionRegistrationRegistry {\n commands: RegisteredExtensionCommandDefinition[];\n flags: RegisteredExtensionFlagDefinitions[];\n item_fields: RegisteredExtensionSchemaFieldDefinitions[];\n item_types: RegisteredExtensionSchemaItemTypeDefinitions[];\n migrations: RegisteredExtensionSchemaMigrationDefinition[];\n importers: RegisteredExtensionImporter[];\n exporters: RegisteredExtensionExporter[];\n search_providers: RegisteredExtensionSearchProvider[];\n vector_store_adapters: RegisteredExtensionVectorStoreAdapter[];\n}\n\n/**\n * Documents the extension registration counts payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionRegistrationCounts {\n commands: number;\n flags: number;\n item_fields: number;\n item_types: number;\n migrations: number;\n importers: number;\n exporters: number;\n search_providers: number;\n vector_store_adapters: number;\n}\n\n/**\n * Read-only identity an extension's `activate(api)` receives about itself, so\n * authors can emit self-identifying logs, gate on their own version, and build\n * better error messages without re-reading the on-disk manifest or duplicating\n * metadata in-module. Exposed as `api.extension`.\n */\nexport interface ExtensionSelfIdentity {\n readonly name: string;\n readonly layer: ExtensionLayer;\n readonly version: string;\n readonly capabilities: readonly ExtensionCapability[];\n readonly pm_min_version?: string;\n readonly pm_max_version?: string;\n readonly source_package?: string;\n}\n\n/**\n * Documents the extension api payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionApi {\n /** Read-only identity of the extension this `api` was created for. */\n readonly extension: ExtensionSelfIdentity;\n registerCommand(command: string, override: CommandOverride): void;\n registerCommand(definition: CommandDefinition): void;\n registerParser(command: string, override: ParserOverride): void;\n registerPreflight(override: PreflightOverride): void;\n registerService(service: ExtensionServiceName, override: ServiceOverride): void;\n registerFlags(targetCommand: string, flags: FlagDefinition[]): void;\n registerItemFields(fields: SchemaFieldDefinition[]): void;\n registerItemTypes(types: SchemaItemTypeDefinition[]): void;\n registerMigration(definition: SchemaMigrationDefinition): void;\n registerRenderer(format: OutputRendererFormat, renderer: RendererOverride): void;\n registerImporter(name: string, importer: Importer, options?: ImportExportRegistrationOptions): void;\n registerExporter(name: string, exporter: Exporter, options?: ImportExportRegistrationOptions): void;\n registerSearchProvider(provider: SearchProviderDefinition): void;\n registerVectorStoreAdapter(adapter: VectorStoreAdapterDefinition): void;\n hooks: {\n beforeCommand(hook: BeforeCommandHook): void;\n afterCommand(hook: AfterCommandHook): void;\n onWrite(hook: OnWriteHook): void;\n onRead(hook: OnReadHook): void;\n onIndex(hook: OnIndexHook): void;\n };\n}\n\n/**\n * Documents the failed extension activation payload exchanged by command, SDK, and package integrations.\n */\nexport interface FailedExtensionActivation {\n layer: ExtensionLayer;\n name: string;\n entry_path: string;\n error: string;\n trace?: ExtensionActivationFailureTrace;\n}\n\n/**\n * Documents the extension activation failure trace payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionActivationFailureTrace {\n method: string;\n /** `-1` means the failure happened before a numbered registration was accepted. */\n registration_index: number;\n command?: string;\n capability?: ExtensionCapability;\n missing_capability?: ExtensionCapability;\n expected_schema: string;\n received?: unknown;\n hint?: string;\n}\n\n/**\n * Documents the extension activation result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionActivationResult {\n hooks: ExtensionHookRegistry;\n commands: ExtensionCommandRegistry;\n parsers: ExtensionParserRegistry;\n preflight: ExtensionPreflightRegistry;\n services: ExtensionServiceRegistry;\n renderers: ExtensionRendererRegistry;\n registrations: ExtensionRegistrationRegistry;\n failed: FailedExtensionActivation[];\n warnings: string[];\n hook_counts: {\n before_command: number;\n after_command: number;\n on_write: number;\n on_read: number;\n on_index: number;\n };\n command_override_count: number;\n command_handler_count: number;\n parser_override_count: number;\n preflight_override_count: number;\n service_override_count: number;\n renderer_override_count: number;\n registration_counts: ExtensionRegistrationCounts;\n}\n\n/**\n * Documents the extension candidate payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionCandidate {\n layer: ExtensionLayer;\n directory: string;\n manifest_path: string;\n entry_path: string;\n manifest: ExtensionManifest;\n source_package?: string;\n}\n\n/**\n * Documents the extension layer scan result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionLayerScanResult {\n diagnostics: ExtensionDiagnostic[];\n warnings: string[];\n candidates: ExtensionCandidate[];\n}\n\n/**\n * Documents the scanned extension directory payload exchanged by command, SDK, and package integrations.\n */\nexport interface ScannedExtensionDirectory {\n diagnostic: ExtensionDiagnostic;\n warnings: string[];\n candidate: ExtensionCandidate | null;\n}\n\n/**\n * Documents the legacy extension capability alias mapping payload exchanged by command, SDK, and package integrations.\n */\nexport interface LegacyExtensionCapabilityAliasMapping {\n alias: string;\n target: ExtensionCapability;\n}\n\n/**\n * Documents the discover extensions options payload exchanged by command, SDK, and package integrations.\n */\nexport interface DiscoverExtensionsOptions {\n pmRoot: string;\n settings: PmSettings;\n cwd?: string;\n noExtensions?: boolean;\n reload_token?: string;\n cache_bust?: boolean;\n}\n\n/**\n * Documents the activatable extension payload exchanged by command, SDK, and package integrations.\n */\nexport interface ActivatableExtension {\n activate: (api: ExtensionApi) => void | Promise<void>;\n /**\n * Optional teardown lifecycle hook, analogous to VS Code's `deactivate`\n * export. Invoked when the host tears the extension down — on long-running\n * MCP-server reload between requests, or via the `deactivateExtensions`\n * primitive — so an extension can close connections, clear timers, and\n * release buffers it opened during `activate`.\n */\n deactivate?: () => void | Promise<void>;\n}\n\n/**\n * Documents the extension deactivation failure payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDeactivationFailure {\n layer: ExtensionLayer;\n name: string;\n error: string;\n}\n\n/**\n * Documents the extension deactivation options payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDeactivationOptions {\n /**\n * Maximum time to wait for each extension's `deactivate` hook. Defaults to\n * 5000ms so a hanging teardown cannot block host shutdown or reload. Set to\n * 0 or Infinity only when the host intentionally wants to wait indefinitely.\n */\n deactivate_timeout_ms?: number;\n}\n\n/**\n * Documents the extension deactivation result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDeactivationResult {\n /** Count of loaded extensions whose `deactivate` hook ran without throwing. */\n deactivated: number;\n warnings: string[];\n failed: ExtensionDeactivationFailure[];\n}\n\n/**\n * Documents the service override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ServiceOverrideResult {\n handled: boolean;\n result: unknown;\n warnings: string[];\n}\n\n/**\n * Documents the command override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandOverrideResult {\n overridden: boolean;\n result: unknown;\n warnings: string[];\n}\n\n/**\n * Documents the command handler result payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandHandlerResult {\n handled: boolean;\n result: unknown;\n warnings: string[];\n /**\n * Human-readable, single-line, length-bounded message describing why an\n * extension command handler failed. Surfaced to the user/CI so the real cause\n * (e.g. \"Changelog is out of date: CHANGELOG.md\") is visible instead of only\n * the opaque `extension_command_handler_failed` warning code.\n */\n errorMessage?: string;\n}\n\n/**\n * Documents the parser override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ParserOverrideResult {\n overridden: boolean;\n context: CommandHandlerContext;\n warnings: string[];\n}\n\n/**\n * Documents the preflight override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface PreflightOverrideResult {\n overridden: boolean;\n context: CommandHandlerContext;\n decision: PreflightRuntimeDecision;\n warnings: string[];\n}\n\n/**\n * Documents the renderer override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface RendererOverrideResult {\n overridden: boolean;\n rendered: string | null;\n warnings: string[];\n}\n\n/**\n * Documents the unknown extension capability warning details payload exchanged by command, SDK, and package integrations.\n */\nexport interface UnknownExtensionCapabilityWarningDetails {\n layer: ExtensionLayer;\n name: string;\n capability: string;\n allowed_capabilities: string[];\n capability_contract_version: number;\n suggested_capability?: string;\n suggestion_source?: \"legacy_alias\" | \"nearest_match\";\n legacy_alias_target?: string;\n}\n"],"names":[],"mappings":";;AAeA,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,UAAU;IACV,WAAW;IACX,OAAO;IACP,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,UAAU;CACF,CAAC;AAKX,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,mCAAmC,GAAkD,MAAM,CAAC,MAAM,CAAC;IAC9G,SAAS,EAAE,QAAQ;IACnB,UAAU,EAAE,QAAQ;CACrB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,CAAC;IACzD,OAAO,EAAE,qCAAqC;IAC9C,YAAY,EAAE,CAAC,GAAG,4BAA4B,CAAC;IAC/C,cAAc,EAAE,EAAE,GAAG,mCAAmC,EAAE;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAKhF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAU,CAAC;AAK/E,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,MAAM,EAAE,YA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O;IACP,UAAU;IACV,kBAAkB;IAClB,gBAAgB;IAChB,gBAAgB;IAChB,SAAS;IACT,SAAS;IACT,YAAY;IACZ,iBAAiB;IACjB,aAAa;IACb,cAAc;IACd,YAAY;CACJ,CAAkG,CAAC","debugId":"8a476e8d-7cae-5d53-b5f8-20771bd57388"}
1
+ {"version":3,"file":"extension-types.js","sources":["core/extensions/extension-types.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/extensions/extension-types\n *\n * Implements extension runtime contracts and governance for Extension Types.\n */\nimport type {\n ExtensionPolicyOverrideSettings,\n ExtensionPolicySettings,\n ItemDocument,\n ItemFrontMatter,\n ItemStatus,\n PmSettings,\n} from \"../../types/index.js\";\nimport type { GlobalOptions } from \"../shared/command-types.js\";\n\nexport const KNOWN_EXTENSION_CAPABILITIES = [\n \"commands\",\n \"renderers\",\n \"hooks\",\n \"schema\",\n \"importers\",\n \"search\",\n \"parser\",\n \"preflight\",\n \"services\",\n] as const;\n/**\n * Restricts extension capability values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionCapability = (typeof KNOWN_EXTENSION_CAPABILITIES)[number];\nexport const EXTENSION_CAPABILITY_CONTRACT_VERSION = 2;\nexport const EXTENSION_CAPABILITY_LEGACY_ALIASES: Readonly<Record<string, ExtensionCapability>> = Object.freeze({\n migration: \"schema\",\n validation: \"schema\",\n});\nexport const EXTENSION_CAPABILITY_CONTRACT = Object.freeze({\n version: EXTENSION_CAPABILITY_CONTRACT_VERSION,\n capabilities: [...KNOWN_EXTENSION_CAPABILITIES],\n legacy_aliases: { ...EXTENSION_CAPABILITY_LEGACY_ALIASES },\n});\n\nexport const KNOWN_EXTENSION_POLICY_MODES = [\"off\", \"warn\", \"enforce\"] as const;\n/**\n * Restricts extension policy mode values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionPolicyMode = (typeof KNOWN_EXTENSION_POLICY_MODES)[number];\nexport const KNOWN_EXTENSION_TRUST_MODES = [\"off\", \"warn\", \"enforce\"] as const;\n/**\n * Restricts extension trust mode values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionTrustMode = (typeof KNOWN_EXTENSION_TRUST_MODES)[number];\nexport const KNOWN_EXTENSION_SANDBOX_PROFILES = [\"none\", \"restricted\", \"strict\"] as const;\n/**\n * Restricts extension sandbox profile values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionSandboxProfile = (typeof KNOWN_EXTENSION_SANDBOX_PROFILES)[number];\n\nexport const KNOWN_PM_MAX_VERSION_EXCEEDED_MODES = [\"block\", \"warn\"] as const;\n/** How a `pm_max_version` violation is handled for an extension layer. */\nexport type PmMaxVersionExceededMode = (typeof KNOWN_PM_MAX_VERSION_EXCEEDED_MODES)[number];\n/** Optional per-layer override map for `extensions.policy.pm_max_version_exceeded_mode`. */\nexport interface PmMaxVersionExceededModeByLayer {\n global?: PmMaxVersionExceededMode;\n project?: PmMaxVersionExceededMode;\n}\n/**\n * Settings value for `extensions.policy.pm_max_version_exceeded_mode`: either a\n * single mode applied to both layers, or a per-layer override map. Unset (and\n * any unset layer key) defaults to `\"block\"`.\n */\nexport type PmMaxVersionExceededModeSetting = PmMaxVersionExceededMode | PmMaxVersionExceededModeByLayer;\n\nexport const KNOWN_EXTENSION_POLICY_SURFACES = [\n \"commands.override\",\n \"commands.handler\",\n \"hooks.beforecommand\",\n \"hooks.aftercommand\",\n \"hooks.onwrite\",\n \"hooks.onread\",\n \"hooks.onindex\",\n \"schema.flags\",\n \"schema.itemfields\",\n \"schema.itemtypes\",\n \"schema.migrations\",\n \"parser.override\",\n \"preflight.override\",\n \"services.override\",\n \"renderers.override\",\n \"importers.importer\",\n \"importers.exporter\",\n \"search.provider\",\n \"search.vectorstore\",\n] as const;\n/**\n * Restricts extension policy surface values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionPolicySurface = (typeof KNOWN_EXTENSION_POLICY_SURFACES)[number];\n\nexport const KNOWN_EXTENSION_SERVICE_NAMES = [\n \"output_format\",\n \"error_format\",\n \"help_format\",\n \"lock_acquire\",\n \"lock_release\",\n \"history_append\",\n \"item_store_write\",\n \"item_store_delete\",\n] as const;\n/**\n * Restricts extension service name values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionServiceName = (typeof KNOWN_EXTENSION_SERVICE_NAMES)[number];\n\n/**\n * Documents the extension provenance metadata payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionProvenanceMetadata {\n source?: string;\n signature?: string;\n attestation?: string;\n verified?: boolean;\n}\n\n/**\n * Documents the extension runtime permission declaration payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionRuntimePermissionDeclaration {\n fs_read?: boolean;\n fs_write?: boolean;\n network?: boolean;\n env_read?: boolean;\n env_write?: boolean;\n process_spawn?: boolean;\n}\n\n/**\n * Documents the extension activation metadata payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionActivationMetadata {\n commands?: string[];\n}\n\n/**\n * Restricts extension policy override values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionPolicyOverride = ExtensionPolicyOverrideSettings;\n/**\n * Extension governance policy as read from / serialized to settings. Extends the\n * stored settings shape with `pm_max_version_exceeded_mode` (pm-k5e8), which\n * relaxes the default-BLOCK on `pm_max_version` violations to warn-only —\n * globally or per extension layer.\n */\nexport type ExtensionGovernancePolicy = ExtensionPolicySettings & {\n pm_max_version_exceeded_mode?: PmMaxVersionExceededModeSetting;\n};\n\n/**\n * Documents the extension manifest engines payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionManifestEngines {\n pm?: string;\n node?: string;\n [engine: string]: string | undefined;\n}\n\n/**\n * Implements create default extension governance policy for the public runtime surface of this module.\n */\nexport function createDefaultExtensionGovernancePolicy(): ExtensionGovernancePolicy {\n return {\n mode: \"off\",\n trust_mode: \"off\",\n require_provenance: false,\n trusted_extensions: [],\n default_sandbox_profile: \"none\",\n allowed_extensions: [],\n blocked_extensions: [],\n allowed_capabilities: [],\n blocked_capabilities: [],\n allowed_surfaces: [],\n blocked_surfaces: [],\n allowed_commands: [],\n blocked_commands: [],\n allowed_actions: [],\n blocked_actions: [],\n allowed_services: [],\n blocked_services: [],\n extension_overrides: [],\n };\n}\n\n/**\n * Restricts extension layer values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionLayer = \"global\" | \"project\";\n/**\n * Restricts extension status values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionStatus = \"ok\" | \"warn\";\n\n/**\n * Documents the extension manifest payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionManifest {\n name: string;\n version: string;\n entry: string;\n priority: number;\n capabilities: string[];\n manifest_version?: number;\n pm_min_version?: string;\n pm_max_version?: string;\n engines?: ExtensionManifestEngines;\n trusted?: boolean;\n provenance?: ExtensionProvenanceMetadata;\n sandbox_profile?: ExtensionSandboxProfile;\n permissions?: ExtensionRuntimePermissionDeclaration;\n activation?: ExtensionActivationMetadata;\n legacy_capability_aliases?: LegacyExtensionCapabilityAliasMapping[];\n}\n\n/**\n * Documents the extension diagnostic payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDiagnostic {\n layer: ExtensionLayer;\n directory: string;\n manifest_path: string;\n name: string | null;\n version: string | null;\n entry: string | null;\n priority: number | null;\n entry_path: string | null;\n enabled: boolean | null;\n status: ExtensionStatus;\n}\n\n/**\n * Documents the effective extension payload exchanged by command, SDK, and package integrations.\n */\nexport interface EffectiveExtension {\n layer: ExtensionLayer;\n directory: string;\n manifest_path: string;\n name: string;\n source_package?: string;\n version: string;\n entry: string;\n priority: number;\n entry_path: string;\n manifest_version?: number;\n pm_min_version?: string;\n pm_max_version?: string;\n engines?: ExtensionManifestEngines;\n trusted?: boolean;\n provenance?: ExtensionProvenanceMetadata;\n sandbox_profile?: ExtensionSandboxProfile;\n permissions?: ExtensionRuntimePermissionDeclaration;\n capabilities?: string[];\n activation?: ExtensionActivationMetadata;\n}\n\n/**\n * Documents the extension discovery result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDiscoveryResult {\n disabled_by_flag: boolean;\n roots: {\n global: string;\n project: string;\n };\n configured_enabled: string[];\n configured_disabled: string[];\n discovered: ExtensionDiagnostic[];\n effective: EffectiveExtension[];\n warnings: string[];\n policy: ExtensionGovernancePolicy;\n}\n\n/**\n * Documents the loaded extension payload exchanged by command, SDK, and package integrations.\n */\nexport interface LoadedExtension extends EffectiveExtension {\n module: unknown;\n}\n\n/**\n * Documents the failed extension load payload exchanged by command, SDK, and package integrations.\n */\nexport interface FailedExtensionLoad {\n layer: ExtensionLayer;\n name: string;\n entry_path: string;\n error: string;\n}\n\n/**\n * Documents the extension load result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionLoadResult extends ExtensionDiscoveryResult {\n loaded: LoadedExtension[];\n failed: FailedExtensionLoad[];\n}\n\n/**\n * Documents the before command hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface BeforeCommandHookContext {\n command: string;\n args: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n pm_root: string;\n}\n\n/**\n * Documents the after command hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface AfterCommandHookContext extends BeforeCommandHookContext {\n ok: boolean;\n error?: string;\n result?: unknown;\n affected?: AfterCommandAffectedItem[];\n}\n\n/**\n * Documents the after command affected item payload exchanged by command, SDK, and package integrations.\n */\nexport interface AfterCommandAffectedItem {\n id: string;\n op?: string;\n item_type?: string;\n previous_status?: ItemStatus;\n status?: ItemStatus;\n previous?: Partial<ItemFrontMatter>;\n current?: Partial<ItemFrontMatter>;\n changed_fields?: string[];\n}\n\n/**\n * Documents the on write hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface OnWriteHookContext {\n path: string;\n scope: \"project\" | \"global\";\n op: string;\n item_id?: string;\n item_type?: string;\n before?: ItemDocument;\n after?: ItemDocument;\n changed_fields?: string[];\n}\n\n/**\n * Documents the on read hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface OnReadHookContext {\n path: string;\n scope: \"project\" | \"global\";\n}\n\n/**\n * Documents the on index hook context payload exchanged by command, SDK, and package integrations.\n */\nexport interface OnIndexHookContext {\n mode: string;\n total_items?: number;\n}\n\n/**\n * Restricts before command hook values accepted by command, SDK, and storage contracts.\n */\nexport type BeforeCommandHook = (context: BeforeCommandHookContext) => Promise<void> | void;\n/**\n * Restricts after command hook values accepted by command, SDK, and storage contracts.\n */\nexport type AfterCommandHook = (context: AfterCommandHookContext) => Promise<void> | void;\n/**\n * Restricts on write hook values accepted by command, SDK, and storage contracts.\n */\nexport type OnWriteHook = (context: OnWriteHookContext) => Promise<void> | void;\n/**\n * Restricts on read hook values accepted by command, SDK, and storage contracts.\n */\nexport type OnReadHook = (context: OnReadHookContext) => Promise<void> | void;\n/**\n * Restricts on index hook values accepted by command, SDK, and storage contracts.\n */\nexport type OnIndexHook = (context: OnIndexHookContext) => Promise<void> | void;\n/**\n * Restricts output renderer format values accepted by command, SDK, and storage contracts.\n */\nexport type OutputRendererFormat = \"toon\" | \"json\";\n/**\n * Restricts command override values accepted by command, SDK, and storage contracts.\n */\nexport type CommandOverride = (context: CommandOverrideContext) => unknown;\n/**\n * Restricts renderer override values accepted by command, SDK, and storage contracts.\n */\nexport type RendererOverride = (context: RendererOverrideContext) => string | null | undefined;\n/**\n * Restricts command handler values accepted by command, SDK, and storage contracts.\n */\nexport type CommandHandler = (context: CommandHandlerContext) => unknown;\n/**\n * Restricts parser override values accepted by command, SDK, and storage contracts.\n */\nexport type ParserOverride = (context: ParserOverrideContext) => ParserOverrideDelta | Promise<ParserOverrideDelta>;\n/**\n * Restricts preflight override values accepted by command, SDK, and storage contracts.\n */\nexport type PreflightOverride = (context: PreflightOverrideContext) => PreflightOverrideDelta | Promise<PreflightOverrideDelta>;\n/**\n * Restricts service override values accepted by command, SDK, and storage contracts.\n */\nexport type ServiceOverride = (context: ServiceOverrideContext) => unknown;\n\n/**\n * Documents the registered extension hook payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionHook<THook> {\n layer: ExtensionLayer;\n name: string;\n run: THook;\n}\n\n/**\n * Documents the extension hook registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionHookRegistry {\n beforeCommand: Array<RegisteredExtensionHook<BeforeCommandHook>>;\n afterCommand: Array<RegisteredExtensionHook<AfterCommandHook>>;\n onWrite: Array<RegisteredExtensionHook<OnWriteHook>>;\n onRead: Array<RegisteredExtensionHook<OnReadHook>>;\n onIndex: Array<RegisteredExtensionHook<OnIndexHook>>;\n}\n\n/**\n * Documents the command override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandOverrideContext {\n command: string;\n args: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n pm_root: string;\n result: unknown;\n}\n\n/**\n * Documents the renderer override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface RendererOverrideContext {\n format: OutputRendererFormat;\n command?: string;\n args?: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n pm_root?: string;\n result: unknown;\n}\n\n/**\n * Documents the command handler context payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandHandlerContext {\n command: string;\n args: string[];\n options: Record<string, unknown>;\n global: GlobalOptions;\n pm_root: string;\n}\n\n/**\n * Documents the parser override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface ParserOverrideContext extends CommandHandlerContext {}\n\n/**\n * Documents the parser override delta payload exchanged by command, SDK, and package integrations.\n */\nexport interface ParserOverrideDelta {\n args?: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n}\n\n/**\n * Documents the preflight override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface PreflightOverrideContext extends CommandHandlerContext {\n decision: PreflightRuntimeDecision;\n}\n\n/**\n * Documents the preflight runtime decision payload exchanged by command, SDK, and package integrations.\n */\nexport interface PreflightRuntimeDecision {\n enforce_item_format_gate: boolean;\n run_preflight_item_format_sync: boolean;\n run_extension_migrations: boolean;\n enforce_mandatory_migration_gate: boolean;\n}\n\n/**\n * Documents the preflight override delta payload exchanged by command, SDK, and package integrations.\n */\nexport interface PreflightOverrideDelta extends ParserOverrideDelta {\n enforce_item_format_gate?: boolean;\n run_preflight_item_format_sync?: boolean;\n run_extension_migrations?: boolean;\n enforce_mandatory_migration_gate?: boolean;\n}\n\n/**\n * Documents the service override context payload exchanged by command, SDK, and package integrations.\n */\nexport interface ServiceOverrideContext {\n service: ExtensionServiceName;\n command?: string;\n args?: string[];\n options?: Record<string, unknown>;\n global?: GlobalOptions;\n pm_root?: string;\n payload: unknown;\n}\n\n/**\n * Documents the extension command argument definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionCommandArgumentDefinition {\n name: string;\n required?: boolean;\n variadic?: boolean;\n description?: string;\n}\n\n/**\n * Documents the command definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandDefinition {\n name: string;\n run?: CommandHandler;\n /**\n * @deprecated Use `run` instead. This alias remains for backward compatibility.\n */\n handler?: CommandHandler;\n action?: string;\n description?: string;\n intent?: string;\n examples?: string[];\n failure_hints?: string[];\n arguments?: ExtensionCommandArgumentDefinition[];\n flags?: FlagDefinition[];\n}\n\n/**\n * Optional command-definition metadata for first-class importer/exporter\n * registration.\n *\n * `registerImporter`/`registerExporter` always create a `<name> import` /\n * `<name> export` command path. By default that path only has a handler. When\n * these options are supplied, the auto-created command also gains a full command\n * definition (description, flags, intent, examples, failure hints, positional\n * arguments) — surfaced in help and runtime contracts exactly like\n * `registerCommand`. The registration `name` and `run` handler are implicit, so\n * they are not part of this options object.\n */\nexport interface ImportExportRegistrationOptions {\n action?: string;\n description?: string;\n intent?: string;\n examples?: string[];\n failure_hints?: string[];\n arguments?: ExtensionCommandArgumentDefinition[];\n flags?: FlagDefinition[];\n}\n\n/**\n * Restricts flag value type values accepted by command, SDK, and storage contracts.\n */\nexport type FlagValueType = \"string\" | \"number\" | \"boolean\";\n\n/**\n * Documents the flag definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface FlagDefinition {\n long?: string;\n short?: string;\n value_name?: string;\n description?: string;\n required?: boolean;\n enabled?: boolean;\n visible?: boolean;\n /**\n * Canonical flag value type. Prefer this field; it is the one runtime\n * contracts and help output read first.\n */\n value_type?: FlagValueType;\n /**\n * @deprecated Use `value_type`. Retained for backward compatibility: when\n * both are present `value_type` wins, and `type` resolves only when\n * `value_type` is absent (`value_type ?? type`).\n */\n type?: FlagValueType;\n /**\n * When true, a repeated comma-list flag accumulates values across repeats\n * — parity with core list flags such as `--tags` — instead of the last\n * value winning. Mirrors the core `CliFlagContract.list` field so\n * extension-registered list flags coalesce through the same bootstrap path.\n */\n list?: boolean;\n /**\n * Default value applied when the flag is omitted. Surfaced to runtime\n * contracts and help output. A `list` flag may default to an array of scalars\n * (e.g. `[\"a\", \"b\"]`); the array is flattened/coerced like any list value.\n */\n default?: string | number | boolean | Array<string | number | boolean>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema field definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaFieldDefinition {\n name: string;\n type: string;\n optional?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema item type command option policy definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaItemTypeCommandOptionPolicyDefinition {\n command: string;\n option: string;\n enabled?: boolean;\n required?: boolean;\n visible?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema item type option definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaItemTypeOptionDefinition {\n key: string;\n values?: string[];\n required?: boolean;\n aliases?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema item type definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaItemTypeDefinition {\n name: string;\n folder?: string;\n aliases?: string[];\n required_create_fields?: string[];\n required_create_repeatables?: string[];\n command_option_policies?: SchemaItemTypeCommandOptionPolicyDefinition[];\n options?: SchemaItemTypeOptionDefinition[];\n [key: string]: unknown;\n}\n\n/**\n * Documents the schema migration run context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaMigrationRunContext {\n id: string;\n command: \"migration\";\n layer: ExtensionLayer;\n extension: string;\n pm_root: string;\n status: string;\n}\n\n/**\n * Restricts schema migration runner values accepted by command, SDK, and storage contracts.\n */\nexport type SchemaMigrationRunner = (context: SchemaMigrationRunContext) => unknown | Promise<unknown>;\n\n/**\n * Documents the schema migration definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SchemaMigrationDefinition {\n id?: string;\n description?: string;\n status?: string;\n mandatory?: boolean;\n run?: SchemaMigrationRunner;\n [key: string]: unknown;\n}\n\n/**\n * Documents the import export context payload exchanged by command, SDK, and package integrations.\n */\nexport interface ImportExportContext {\n registration: string;\n action: \"import\" | \"export\";\n command: string;\n args: string[];\n options: Record<string, unknown>;\n global: GlobalOptions;\n pm_root: string;\n}\n\n/**\n * Restricts importer values accepted by command, SDK, and storage contracts.\n */\nexport type Importer = (context: ImportExportContext) => unknown | Promise<unknown>;\n/**\n * Restricts exporter values accepted by command, SDK, and storage contracts.\n */\nexport type Exporter = (context: ImportExportContext) => unknown | Promise<unknown>;\n\n/**\n * Restricts extension search mode values accepted by command, SDK, and storage contracts.\n */\nexport type ExtensionSearchMode = \"keyword\" | \"semantic\" | \"hybrid\";\n\n/**\n * Documents the search provider query context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderQueryContext {\n query: string;\n mode: ExtensionSearchMode;\n tokens: string[];\n options: Record<string, unknown>;\n settings: PmSettings;\n documents: ItemDocument[];\n [key: string]: unknown;\n}\n\n/**\n * Documents the search provider hit payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderHit {\n id: string;\n score: number;\n matched_fields?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Restricts search provider query result values accepted by command, SDK, and storage contracts.\n */\nexport type SearchProviderQueryResult = SearchProviderHit[] | { hits?: SearchProviderHit[] };\n\n/**\n * Documents the search provider query expansion context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderQueryExpansionContext {\n query: string;\n mode: Exclude<ExtensionSearchMode, \"keyword\">;\n settings: PmSettings;\n [key: string]: unknown;\n}\n\n/**\n * Restricts search provider query expansion result values accepted by command, SDK, and storage contracts.\n */\nexport type SearchProviderQueryExpansionResult = string[] | { queries?: string[] };\n\n/**\n * Documents the search provider rerank candidate payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderRerankCandidate {\n id: string;\n text: string;\n score: number;\n}\n\n/**\n * Documents the search provider rerank hit payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderRerankHit {\n id: string;\n score: number;\n}\n\n/**\n * Restricts search provider rerank result values accepted by command, SDK, and storage contracts.\n */\nexport type SearchProviderRerankResult = SearchProviderRerankHit[] | { hits?: SearchProviderRerankHit[] };\n\n/**\n * Documents the search provider rerank context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderRerankContext {\n query: string;\n mode: \"hybrid\";\n model: string;\n top_k: number;\n settings: PmSettings;\n candidates: SearchProviderRerankCandidate[];\n [key: string]: unknown;\n}\n\n/**\n * Documents the search provider embed batch context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderEmbedBatchContext {\n inputs: string[];\n settings: PmSettings;\n model: string;\n [key: string]: unknown;\n}\n\n/**\n * Documents the search provider embed context payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderEmbedContext {\n input: string;\n settings: PmSettings;\n model: string;\n [key: string]: unknown;\n}\n\n/**\n * Documents the search provider definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface SearchProviderDefinition {\n name: string;\n query?: (context: SearchProviderQueryContext) => SearchProviderQueryResult | Promise<SearchProviderQueryResult>;\n queryExpansion?: (\n context: SearchProviderQueryExpansionContext,\n ) => SearchProviderQueryExpansionResult | Promise<SearchProviderQueryExpansionResult>;\n query_expansion?: (\n context: SearchProviderQueryExpansionContext,\n ) => SearchProviderQueryExpansionResult | Promise<SearchProviderQueryExpansionResult>;\n rerank?: (context: SearchProviderRerankContext) => SearchProviderRerankResult | Promise<SearchProviderRerankResult>;\n embedBatch?: (context: SearchProviderEmbedBatchContext) => number[][] | Promise<number[][]>;\n embed_batch?: (context: SearchProviderEmbedBatchContext) => number[][] | Promise<number[][]>;\n embed?: (context: SearchProviderEmbedContext) => number[] | Promise<number[]>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store query hit payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreQueryHit {\n id: string;\n score: number;\n payload?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store query context payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreQueryContext {\n vector: number[];\n limit: number;\n settings: PmSettings;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store upsert point payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreUpsertPoint {\n id: string;\n vector: number[];\n payload?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store upsert context payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreUpsertContext {\n points: VectorStoreUpsertPoint[];\n settings: PmSettings;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store delete context payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreDeleteContext {\n ids: string[];\n settings: PmSettings;\n [key: string]: unknown;\n}\n\n/**\n * Documents the vector store adapter definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface VectorStoreAdapterDefinition {\n name: string;\n query?: (context: VectorStoreQueryContext) => VectorStoreQueryHit[] | Promise<VectorStoreQueryHit[]>;\n upsert?: (context: VectorStoreUpsertContext) => unknown | Promise<unknown>;\n delete?: (context: VectorStoreDeleteContext) => unknown | Promise<unknown>;\n [key: string]: unknown;\n}\n\n/**\n * Documents the registered extension command override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionCommandOverride {\n layer: ExtensionLayer;\n name: string;\n command: string;\n run: CommandOverride;\n}\n\n/**\n * Documents the registered extension command handler payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionCommandHandler {\n layer: ExtensionLayer;\n name: string;\n command: string;\n run: CommandHandler;\n}\n\n/**\n * Documents the registered extension parser override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionParserOverride {\n layer: ExtensionLayer;\n name: string;\n command: string;\n run: ParserOverride;\n}\n\n/**\n * Documents the registered extension preflight override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionPreflightOverride {\n layer: ExtensionLayer;\n name: string;\n run: PreflightOverride;\n}\n\n/**\n * Documents the registered extension service override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionServiceOverride {\n layer: ExtensionLayer;\n name: string;\n service: ExtensionServiceName;\n run: ServiceOverride;\n}\n\n/**\n * Documents the registered extension renderer override payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionRendererOverride {\n layer: ExtensionLayer;\n name: string;\n format: OutputRendererFormat;\n run: RendererOverride;\n}\n\n/**\n * Documents the extension command registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionCommandRegistry {\n overrides: RegisteredExtensionCommandOverride[];\n handlers: RegisteredExtensionCommandHandler[];\n}\n\n/**\n * Documents the extension parser registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionParserRegistry {\n overrides: RegisteredExtensionParserOverride[];\n}\n\n/**\n * Documents the extension preflight registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionPreflightRegistry {\n overrides: RegisteredExtensionPreflightOverride[];\n}\n\n/**\n * Documents the extension service registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionServiceRegistry {\n overrides: RegisteredExtensionServiceOverride[];\n}\n\n/**\n * Documents the extension renderer registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionRendererRegistry {\n overrides: RegisteredExtensionRendererOverride[];\n}\n\n/**\n * Documents the registered extension flag definitions payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionFlagDefinitions {\n layer: ExtensionLayer;\n name: string;\n target_command: string;\n flags: FlagDefinition[];\n}\n\n/**\n * Documents the registered extension command definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionCommandDefinition {\n layer: ExtensionLayer;\n name: string;\n source_package?: string;\n command: string;\n action: string;\n description?: string;\n intent?: string;\n examples: string[];\n failure_hints: string[];\n arguments: ExtensionCommandArgumentDefinition[];\n}\n\n/**\n * Documents the registered extension schema field definitions payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionSchemaFieldDefinitions {\n layer: ExtensionLayer;\n name: string;\n fields: SchemaFieldDefinition[];\n}\n\n/**\n * Documents the registered extension schema item type definitions payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionSchemaItemTypeDefinitions {\n layer: ExtensionLayer;\n name: string;\n types: SchemaItemTypeDefinition[];\n}\n\n/**\n * Documents the registered extension schema migration definition payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionSchemaMigrationDefinition {\n layer: ExtensionLayer;\n name: string;\n definition: SchemaMigrationDefinition;\n runtime_definition: SchemaMigrationDefinition;\n}\n\n/**\n * Documents the registered extension importer payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionImporter {\n layer: ExtensionLayer;\n name: string;\n importer: string;\n}\n\n/**\n * Documents the registered extension exporter payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionExporter {\n layer: ExtensionLayer;\n name: string;\n exporter: string;\n}\n\n/**\n * Documents the registered extension search provider payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionSearchProvider {\n layer: ExtensionLayer;\n name: string;\n definition: SearchProviderDefinition;\n runtime_definition: SearchProviderDefinition;\n}\n\n/**\n * Documents the registered extension vector store adapter payload exchanged by command, SDK, and package integrations.\n */\nexport interface RegisteredExtensionVectorStoreAdapter {\n layer: ExtensionLayer;\n name: string;\n definition: VectorStoreAdapterDefinition;\n runtime_definition: VectorStoreAdapterDefinition;\n}\n\n/**\n * Documents the extension registration registry payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionRegistrationRegistry {\n commands: RegisteredExtensionCommandDefinition[];\n flags: RegisteredExtensionFlagDefinitions[];\n item_fields: RegisteredExtensionSchemaFieldDefinitions[];\n item_types: RegisteredExtensionSchemaItemTypeDefinitions[];\n migrations: RegisteredExtensionSchemaMigrationDefinition[];\n importers: RegisteredExtensionImporter[];\n exporters: RegisteredExtensionExporter[];\n search_providers: RegisteredExtensionSearchProvider[];\n vector_store_adapters: RegisteredExtensionVectorStoreAdapter[];\n}\n\n/**\n * Documents the extension registration counts payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionRegistrationCounts {\n commands: number;\n flags: number;\n item_fields: number;\n item_types: number;\n migrations: number;\n importers: number;\n exporters: number;\n search_providers: number;\n vector_store_adapters: number;\n}\n\n/**\n * Read-only identity an extension's `activate(api)` receives about itself, so\n * authors can emit self-identifying logs, gate on their own version, and build\n * better error messages without re-reading the on-disk manifest or duplicating\n * metadata in-module. Exposed as `api.extension`.\n */\nexport interface ExtensionSelfIdentity {\n readonly name: string;\n readonly layer: ExtensionLayer;\n readonly version: string;\n readonly capabilities: readonly ExtensionCapability[];\n readonly pm_min_version?: string;\n readonly pm_max_version?: string;\n readonly source_package?: string;\n}\n\n/**\n * Documents the extension api payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionApi {\n /** Read-only identity of the extension this `api` was created for. */\n readonly extension: ExtensionSelfIdentity;\n registerCommand(command: string, override: CommandOverride): void;\n registerCommand(definition: CommandDefinition): void;\n registerParser(command: string, override: ParserOverride): void;\n registerPreflight(override: PreflightOverride): void;\n registerService(service: ExtensionServiceName, override: ServiceOverride): void;\n registerFlags(targetCommand: string, flags: FlagDefinition[]): void;\n registerItemFields(fields: SchemaFieldDefinition[]): void;\n registerItemTypes(types: SchemaItemTypeDefinition[]): void;\n registerMigration(definition: SchemaMigrationDefinition): void;\n registerRenderer(format: OutputRendererFormat, renderer: RendererOverride): void;\n registerImporter(name: string, importer: Importer, options?: ImportExportRegistrationOptions): void;\n registerExporter(name: string, exporter: Exporter, options?: ImportExportRegistrationOptions): void;\n registerSearchProvider(provider: SearchProviderDefinition): void;\n registerVectorStoreAdapter(adapter: VectorStoreAdapterDefinition): void;\n hooks: {\n beforeCommand(hook: BeforeCommandHook): void;\n afterCommand(hook: AfterCommandHook): void;\n onWrite(hook: OnWriteHook): void;\n onRead(hook: OnReadHook): void;\n onIndex(hook: OnIndexHook): void;\n };\n}\n\n/**\n * Documents the failed extension activation payload exchanged by command, SDK, and package integrations.\n */\nexport interface FailedExtensionActivation {\n layer: ExtensionLayer;\n name: string;\n entry_path: string;\n error: string;\n trace?: ExtensionActivationFailureTrace;\n}\n\n/**\n * Documents the extension activation failure trace payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionActivationFailureTrace {\n method: string;\n /** `-1` means the failure happened before a numbered registration was accepted. */\n registration_index: number;\n command?: string;\n capability?: ExtensionCapability;\n missing_capability?: ExtensionCapability;\n expected_schema: string;\n received?: unknown;\n hint?: string;\n}\n\n/**\n * Documents the extension activation result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionActivationResult {\n hooks: ExtensionHookRegistry;\n commands: ExtensionCommandRegistry;\n parsers: ExtensionParserRegistry;\n preflight: ExtensionPreflightRegistry;\n services: ExtensionServiceRegistry;\n renderers: ExtensionRendererRegistry;\n registrations: ExtensionRegistrationRegistry;\n failed: FailedExtensionActivation[];\n warnings: string[];\n hook_counts: {\n before_command: number;\n after_command: number;\n on_write: number;\n on_read: number;\n on_index: number;\n };\n command_override_count: number;\n command_handler_count: number;\n parser_override_count: number;\n preflight_override_count: number;\n service_override_count: number;\n renderer_override_count: number;\n registration_counts: ExtensionRegistrationCounts;\n}\n\n/**\n * Documents the extension candidate payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionCandidate {\n layer: ExtensionLayer;\n directory: string;\n manifest_path: string;\n entry_path: string;\n manifest: ExtensionManifest;\n source_package?: string;\n}\n\n/**\n * Documents the extension layer scan result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionLayerScanResult {\n diagnostics: ExtensionDiagnostic[];\n warnings: string[];\n candidates: ExtensionCandidate[];\n}\n\n/**\n * Documents the scanned extension directory payload exchanged by command, SDK, and package integrations.\n */\nexport interface ScannedExtensionDirectory {\n diagnostic: ExtensionDiagnostic;\n warnings: string[];\n candidate: ExtensionCandidate | null;\n}\n\n/**\n * Documents the legacy extension capability alias mapping payload exchanged by command, SDK, and package integrations.\n */\nexport interface LegacyExtensionCapabilityAliasMapping {\n alias: string;\n target: ExtensionCapability;\n}\n\n/**\n * Documents the discover extensions options payload exchanged by command, SDK, and package integrations.\n */\nexport interface DiscoverExtensionsOptions {\n pmRoot: string;\n settings: PmSettings;\n cwd?: string;\n noExtensions?: boolean;\n reload_token?: string;\n cache_bust?: boolean;\n}\n\n/**\n * Documents the activatable extension payload exchanged by command, SDK, and package integrations.\n */\nexport interface ActivatableExtension {\n activate: (api: ExtensionApi) => void | Promise<void>;\n /**\n * Optional teardown lifecycle hook, analogous to VS Code's `deactivate`\n * export. Invoked when the host tears the extension down — on long-running\n * MCP-server reload between requests, or via the `deactivateExtensions`\n * primitive — so an extension can close connections, clear timers, and\n * release buffers it opened during `activate`.\n */\n deactivate?: () => void | Promise<void>;\n}\n\n/**\n * Documents the extension deactivation failure payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDeactivationFailure {\n layer: ExtensionLayer;\n name: string;\n error: string;\n}\n\n/**\n * Documents the extension deactivation options payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDeactivationOptions {\n /**\n * Maximum time to wait for each extension's `deactivate` hook. Defaults to\n * 5000ms so a hanging teardown cannot block host shutdown or reload. Set to\n * 0 or Infinity only when the host intentionally wants to wait indefinitely.\n */\n deactivate_timeout_ms?: number;\n}\n\n/**\n * Documents the extension deactivation result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ExtensionDeactivationResult {\n /** Count of loaded extensions whose `deactivate` hook ran without throwing. */\n deactivated: number;\n warnings: string[];\n failed: ExtensionDeactivationFailure[];\n}\n\n/**\n * Documents the service override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ServiceOverrideResult {\n handled: boolean;\n result: unknown;\n warnings: string[];\n}\n\n/**\n * Documents the command override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandOverrideResult {\n overridden: boolean;\n result: unknown;\n warnings: string[];\n}\n\n/**\n * Documents the command handler result payload exchanged by command, SDK, and package integrations.\n */\nexport interface CommandHandlerResult {\n handled: boolean;\n result: unknown;\n warnings: string[];\n /**\n * Human-readable, single-line, length-bounded message describing why an\n * extension command handler failed. Surfaced to the user/CI so the real cause\n * (e.g. \"Changelog is out of date: CHANGELOG.md\") is visible instead of only\n * the opaque `extension_command_handler_failed` warning code.\n */\n errorMessage?: string;\n}\n\n/**\n * Documents the parser override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface ParserOverrideResult {\n overridden: boolean;\n context: CommandHandlerContext;\n warnings: string[];\n}\n\n/**\n * Documents the preflight override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface PreflightOverrideResult {\n overridden: boolean;\n context: CommandHandlerContext;\n decision: PreflightRuntimeDecision;\n warnings: string[];\n}\n\n/**\n * Documents the renderer override result payload exchanged by command, SDK, and package integrations.\n */\nexport interface RendererOverrideResult {\n overridden: boolean;\n rendered: string | null;\n warnings: string[];\n}\n\n/**\n * Documents the unknown extension capability warning details payload exchanged by command, SDK, and package integrations.\n */\nexport interface UnknownExtensionCapabilityWarningDetails {\n layer: ExtensionLayer;\n name: string;\n capability: string;\n allowed_capabilities: string[];\n capability_contract_version: number;\n suggested_capability?: string;\n suggestion_source?: \"legacy_alias\" | \"nearest_match\";\n legacy_alias_target?: string;\n}\n"],"names":[],"mappings":";;AAeA,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,UAAU;IACV,WAAW;IACX,OAAO;IACP,QAAQ;IACR,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,UAAU;CACF,CAAC;AAKX,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAA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KAAK;QACjB,kBAAkB,EAAE,KAAK;QACzB,kBAAkB,EAAE,EAAE;QACtB,uBAAuB,EAAE,MAAM;QAC/B,kBAAkB,EAAE,EAAE;QACtB,kBAAkB,EAAE,EAAE;QACtB,oBAAoB,EAAE,EAAE;QACxB,oBAAoB,EAAE,EAAE;QACxB,gBAAgB,EAAE,EAAE;QACpB,gBAAgB,EAAE,EAAE;QACpB,gBAAgB,EAAE,EAAE;QACpB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,EAAE;QACnB,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,EAAE;QACpB,gBAAgB,EAAE,EAAE;QACpB,mBAAmB,EAAE,EAAE;KACxB,CAAC;AACJ,CAAC","debugId":"a8e01f7b-34b8-58a6-b894-3fcb8bad7d73"}
@@ -15,7 +15,23 @@ export declare function readFileIfExists(targetPath: string): Promise<string | n
15
15
  */
16
16
  export declare function writeFileAtomic(targetPath: string, contents: string): Promise<void>;
17
17
  /**
18
- * Implements append line atomic for the public runtime surface of this module.
18
+ * Append a single newline-terminated line to a file, opened with `O_APPEND`.
19
+ *
20
+ * Concurrency contract: `O_APPEND` makes the seek-to-EOF that precedes each
21
+ * `write(2)` atomic, so independent appenders never overwrite each other's
22
+ * bytes. For the common case the whole `${line}\n` buffer is handed to the
23
+ * kernel in one `write(2)`, which mainstream filesystems (ext4/xfs/apfs) commit
24
+ * atomically under the inode lock — concurrent multi-process appends of small
25
+ * records (e.g. the telemetry and OTLP-span queues) therefore stay
26
+ * line-coherent without an external lock.
27
+ *
28
+ * The guarantee weakens only for a single record large enough that the OS
29
+ * splits it across multiple `write(2)` calls (multi-KiB lines), where another
30
+ * process's append could interleave between fragments. History JSONL — the only
31
+ * caller that can produce large lines — is always written while the per-item
32
+ * store lock is held (see core/store/item-store.ts), so those appends are
33
+ * serialized regardless. Callers writing large records concurrently from
34
+ * multiple processes must hold an equivalent lock.
19
35
  */
20
36
  export declare function appendLineAtomic(targetPath: string, line: string): Promise<void>;
21
37
  /**
@@ -4,7 +4,7 @@
4
4
  * Provides filesystem helpers for Fs Utils.
5
5
  */
6
6
 
7
- !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]="cb287876-29a3-5f7c-ba86-54c965536ac6")}catch(e){}}();
7
+ !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]="4ddafbee-315f-5aa0-b08f-d4d7a82cfe8d")}catch(e){}}();
8
8
  import * as fs from "node:fs/promises";
9
9
  import path from "node:path";
10
10
  import crypto from "node:crypto";
@@ -76,7 +76,23 @@ export async function writeFileAtomic(targetPath, contents) {
76
76
  }
77
77
  }
78
78
  /**
79
- * Implements append line atomic for the public runtime surface of this module.
79
+ * Append a single newline-terminated line to a file, opened with `O_APPEND`.
80
+ *
81
+ * Concurrency contract: `O_APPEND` makes the seek-to-EOF that precedes each
82
+ * `write(2)` atomic, so independent appenders never overwrite each other's
83
+ * bytes. For the common case the whole `${line}\n` buffer is handed to the
84
+ * kernel in one `write(2)`, which mainstream filesystems (ext4/xfs/apfs) commit
85
+ * atomically under the inode lock — concurrent multi-process appends of small
86
+ * records (e.g. the telemetry and OTLP-span queues) therefore stay
87
+ * line-coherent without an external lock.
88
+ *
89
+ * The guarantee weakens only for a single record large enough that the OS
90
+ * splits it across multiple `write(2)` calls (multi-KiB lines), where another
91
+ * process's append could interleave between fragments. History JSONL — the only
92
+ * caller that can produce large lines — is always written while the per-item
93
+ * store lock is held (see core/store/item-store.ts), so those appends are
94
+ * serialized regardless. Callers writing large records concurrently from
95
+ * multiple processes must hold an equivalent lock.
80
96
  */
81
97
  export async function appendLineAtomic(targetPath, line) {
82
98
  const dirPath = path.dirname(targetPath);
@@ -106,4 +122,4 @@ function isErrno(error, code) {
106
122
  return typeof error === "object" && error !== null && "code" in error && error.code === code;
107
123
  }
108
124
  //# sourceMappingURL=fs-utils.js.map
109
- //# debugId=cb287876-29a3-5f7c-ba86-54c965536ac6
125
+ //# debugId=4ddafbee-315f-5aa0-b08f-d4d7a82cfe8d
@@ -1 +1 @@
1
- {"version":3,"file":"fs-utils.js","sources":["core/fs/fs-utils.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/fs/fs-utils\n *\n * Provides filesystem helpers for Fs Utils.\n */\nimport * as fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport crypto from \"node:crypto\";\n\n/**\n * Implements ensure dir for the public runtime surface of this module.\n */\nexport async function ensureDir(dirPath: string): Promise<void> {\n await fs.mkdir(dirPath, { recursive: true });\n}\n\n/**\n * Implements path exists for the public runtime surface of this module.\n */\nexport async function pathExists(targetPath: string): Promise<boolean> {\n try {\n await fs.access(targetPath);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Implements read file if exists for the public runtime surface of this module.\n */\nexport async function readFileIfExists(targetPath: string): Promise<string | null> {\n try {\n return await fs.readFile(targetPath, \"utf8\");\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n return null;\n }\n throw error;\n }\n}\n\n/**\n * Implements write file atomic for the public runtime surface of this module.\n */\nexport async function writeFileAtomic(targetPath: string, contents: string): Promise<void> {\n const dirPath = path.dirname(targetPath);\n await ensureDir(dirPath);\n const tempPath = path.join(\n dirPath,\n `.${path.basename(targetPath)}.${process.pid}.${Date.now()}.${crypto.randomBytes(4).toString(\"hex\")}.tmp`,\n );\n await fs.writeFile(tempPath, contents, \"utf8\");\n try {\n await fs.rename(tempPath, targetPath);\n } catch (error: unknown) {\n if (isErrno(error, \"EXDEV\")) {\n try {\n await fs.copyFile(tempPath, targetPath);\n } finally {\n try {\n await fs.unlink(tempPath);\n } catch {\n // Best-effort cleanup only.\n }\n }\n return;\n }\n try {\n await fs.unlink(tempPath);\n } catch {\n // Best-effort cleanup only.\n }\n throw error;\n }\n}\n\n/**\n * Implements append line atomic for the public runtime surface of this module.\n */\nexport async function appendLineAtomic(targetPath: string, line: string): Promise<void> {\n const dirPath = path.dirname(targetPath);\n await ensureDir(dirPath);\n const handle = await fs.open(targetPath, \"a\");\n try {\n await handle.writeFile(`${line}\\n`, \"utf8\");\n } finally {\n await handle.close();\n }\n}\n\n/**\n * Implements remove file if exists for the public runtime surface of this module.\n */\nexport async function removeFileIfExists(targetPath: string): Promise<void> {\n try {\n await fs.unlink(targetPath);\n } catch (error: unknown) {\n if (!isErrno(error, \"ENOENT\")) {\n throw error;\n }\n }\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === code;\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAAkB;IACjD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAkB;IACvD,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;I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AAC;QAAC,MAAM,CAAC;YACP,4BAA4B;QAC9B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAkB,EAAE,IAAY;IACrE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IAC9C,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,UAAkB;IACzD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,KAAc,EAAE,IAAY;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAK,KAA2B,CAAC,IAAI,KAAK,IAAI,CAAC;AACtH,CAAC","debugId":"cb287876-29a3-5f7c-ba86-54c965536ac6"}
1
+ {"version":3,"file":"fs-utils.js","sources":["core/fs/fs-utils.ts"],"sourceRoot":"/","sourcesContent":["/**\n * @module core/fs/fs-utils\n *\n * Provides filesystem helpers for Fs Utils.\n */\nimport * as fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport crypto from \"node:crypto\";\n\n/**\n * Implements ensure dir for the public runtime surface of this module.\n */\nexport async function ensureDir(dirPath: string): Promise<void> {\n await fs.mkdir(dirPath, { recursive: true });\n}\n\n/**\n * Implements path exists for the public runtime surface of this module.\n */\nexport async function pathExists(targetPath: string): Promise<boolean> {\n try {\n await fs.access(targetPath);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Implements read file if exists for the public runtime surface of this module.\n */\nexport async function readFileIfExists(targetPath: string): Promise<string | null> {\n try {\n return await fs.readFile(targetPath, \"utf8\");\n } catch (error: unknown) {\n if (isErrno(error, \"ENOENT\")) {\n return null;\n }\n throw error;\n }\n}\n\n/**\n * Implements write file atomic for the public runtime surface of this module.\n */\nexport async function writeFileAtomic(targetPath: string, contents: string): Promise<void> {\n const dirPath = path.dirname(targetPath);\n await ensureDir(dirPath);\n const tempPath = path.join(\n dirPath,\n `.${path.basename(targetPath)}.${process.pid}.${Date.now()}.${crypto.randomBytes(4).toString(\"hex\")}.tmp`,\n );\n await fs.writeFile(tempPath, contents, \"utf8\");\n try {\n await fs.rename(tempPath, targetPath);\n } catch (error: unknown) {\n if (isErrno(error, \"EXDEV\")) {\n try {\n await fs.copyFile(tempPath, targetPath);\n } finally {\n try {\n await fs.unlink(tempPath);\n } catch {\n // Best-effort cleanup only.\n }\n }\n return;\n }\n try {\n await fs.unlink(tempPath);\n } catch {\n // Best-effort cleanup only.\n }\n throw error;\n }\n}\n\n/**\n * Append a single newline-terminated line to a file, opened with `O_APPEND`.\n *\n * Concurrency contract: `O_APPEND` makes the seek-to-EOF that precedes each\n * `write(2)` atomic, so independent appenders never overwrite each other's\n * bytes. For the common case the whole `${line}\\n` buffer is handed to the\n * kernel in one `write(2)`, which mainstream filesystems (ext4/xfs/apfs) commit\n * atomically under the inode lock — concurrent multi-process appends of small\n * records (e.g. the telemetry and OTLP-span queues) therefore stay\n * line-coherent without an external lock.\n *\n * The guarantee weakens only for a single record large enough that the OS\n * splits it across multiple `write(2)` calls (multi-KiB lines), where another\n * process's append could interleave between fragments. History JSONL — the only\n * caller that can produce large lines — is always written while the per-item\n * store lock is held (see core/store/item-store.ts), so those appends are\n * serialized regardless. Callers writing large records concurrently from\n * multiple processes must hold an equivalent lock.\n */\nexport async function appendLineAtomic(targetPath: string, line: string): Promise<void> {\n const dirPath = path.dirname(targetPath);\n await ensureDir(dirPath);\n const handle = await fs.open(targetPath, \"a\");\n try {\n await handle.writeFile(`${line}\\n`, \"utf8\");\n } finally {\n await handle.close();\n }\n}\n\n/**\n * Implements remove file if exists for the public runtime surface of this module.\n */\nexport async function removeFileIfExists(targetPath: string): Promise<void> {\n try {\n await fs.unlink(targetPath);\n } catch (error: unknown) {\n if (!isErrno(error, \"ENOENT\")) {\n throw error;\n }\n }\n}\n\nfunction isErrno(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && \"code\" in error && (error as { code?: string }).code === code;\n}\n"],"names":[],"mappings":"AAAA;;;;GAIG;;;AACH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAAkB;IACjD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAkB;IACvD,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,CAAC,QAAQ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 /**
13
+ * Controls how cached history stream verification is trusted when the file stat
14
+ * tuple still matches a previous scan.
15
+ */
16
+ export type DriftCacheHitVerification = "content_hash" | "metadata";
17
+ /**
18
+ * Documents the history drift scan options shared by health, validate, and
19
+ * repair callers.
20
+ */
21
+ export interface DriftScanOptions {
22
+ cacheHitVerification?: DriftCacheHitVerification;
23
+ }
12
24
  /**
13
25
  * Scan every item's history stream for drift (missing/unreadable streams, broken
14
26
  * hash chains, and item/history hash mismatches).
15
27
  *
16
- * Full chain re-verification of a 17MB+ history tree is the dominant cost of
28
+ * Full chain re-verification of a large history tree is the dominant cost of
17
29
  * `pm health`. We cache the per-stream verification keyed by the history file's
18
- * mtime/ctime/size + content hash: metadata-stable replacements (same stat tuple)
19
- * can still happen, so each metadata hit recomputes a content hash guard before
20
- * trusting the cached chain/hash verification.
30
+ * mtime/ctime/size plus content hash. Strict callers keep recomputing the
31
+ * content hash on metadata hits; latency-sensitive health checks can opt into
32
+ * trusting the stat tuple and skip rereading unchanged streams.
21
33
  */
22
34
  export declare function scanHistoryDrift(pmRoot: string, items: Array<ItemMetadata & {
23
35
  body: string;
24
- }>): Promise<DriftScanResult>;
36
+ }>, options?: DriftScanOptions): Promise<DriftScanResult>;